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

post-robot

Package Overview
Dependencies
Maintainers
2
Versions
246
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

post-robot - npm Package Compare versions

Comparing version 2.0.29 to 2.0.30

2

bower.json
{
"name": "post-robot",
"main": "index.js",
"version": "2.0.29",
"version": "2.0.30",
"authors": [

@@ -6,0 +6,0 @@ "Daniel Brain <dbrain@paypal.com>"

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

!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("postRobot",[],n):"object"==typeof exports?exports.postRobot=n():e.postRobot=n()}(this,function(){return function(e){function n(t){if(r[t])return r[t].exports;var o=r[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){"use strict";function t(){(0,u.registerGlobals)(),i.util.listen(window,"message",a.messageListener),(0,i.initOnReady)()}Object.defineProperty(n,"__esModule",{value:!0}),n.Promise=void 0;var o=r(1);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(8);Object.defineProperty(n,"Promise",{enumerable:!0,get:function(){return i.Promise}});var a=r(6),u=r(17);t(),n["default"]=e.exports},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.linkUrl=n.util=n.openBridge=n.reset=n.parent=void 0;var t=r(2);Object.keys(t).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(25);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(26);Object.keys(i).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})});var a=r(27);Object.keys(a).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return a[e]}})});var u=r(6);Object.defineProperty(n,"reset",{enumerable:!0,get:function(){return u.resetListeners}});var s=r(18);Object.defineProperty(n,"openBridge",{enumerable:!0,get:function(){return s.openBridge}});var c=r(12);Object.defineProperty(n,"util",{enumerable:!0,get:function(){return c.util}});var d=r(14);Object.defineProperty(n,"linkUrl",{enumerable:!0,get:function(){return d.linkUrl}});n.parent=(0,d.getParentWindow)()},function(e,n,r){"use strict";function t(e){return s.promise.nodeify(new s.promise.Promise(function(n,r){if(!e.name)throw new Error("Expected options.name");if(!e.window)throw new Error("Expected options.window");if(a.CONFIG.MOCK_MODE)e.window=window;else if("string"==typeof e.window){var t=document.getElementById(e.window);if(!t)throw new Error("Expected options.window "+e.window+" to be a valid element id");if("iframe"!==t.tagName.toLowerCase())throw new Error("Expected options.window "+e.window+" to be an iframe");if(e.window=t.contentWindow,!e.window)throw new Error("Expected options.window")}var o=e.name+"_"+s.util.uniqueID();if(u.listeners.response[o]=e,(0,s.isWindowClosed)(e.window))throw new Error("Target window is closed");var i=!1;return e.respond=function(e,t){return e||(i=!0),e?r(e):n(t)},s.promise.run(function(){return(0,s.getParentWindow)(e.window)===window?(0,s.onWindowReady)(e.window):void 0}).then(function(){if((0,u.sendMessage)(e.window,{hash:o,type:a.CONSTANTS.POST_MESSAGE_TYPE.REQUEST,name:e.name,data:e.data,fireAndForget:e.fireAndForget},e.domain||"*")["catch"](r),e.fireAndForget)return n();var t=s.util.intervalTimeout(a.CONFIG.ACK_TIMEOUT,100,function(n){return e.ack||(0,s.isWindowClosed)(e.window)?t.cancel():n?void 0:r(new Error("No ack for postMessage "+e.name+" in "+a.CONFIG.ACK_TIMEOUT+"ms"))});e.timeout&&!function(){var n=s.util.intervalTimeout(e.timeout,100,function(t){return i||(0,s.isWindowClosed)(e.window)?n.cancel():t?void 0:r(new Error("Post message response timed out after "+e.timeout+" ms"))},e.timeout)}()})["catch"](r)}),e.callback)}function o(e,n,r,o,i){return i||(!o&&r instanceof Function?(i=r,o={},r={}):o instanceof Function&&(i=o,o={})),o=o||{},o.window=e,o.name=n,o.data=r,o.callback=i,t(o)}function i(e,n,r,t){var i=(0,s.getParentWindow)();if(!window)throw new Error("Window does not have a parent");return o(i,e,n,r,t)}Object.defineProperty(n,"__esModule",{value:!0}),n.request=t,n.send=o,n.sendToParent=i;var a=r(3),u=r(6),s=r(8)},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(4);Object.keys(t).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(5);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})})},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}Object.defineProperty(n,"__esModule",{value:!0}),n.CONFIG=void 0;var o,i=r(5);n.CONFIG={ALLOW_POSTMESSAGE_POPUP:!1,LOG_LEVEL:"info",ACK_TIMEOUT:500,LOG_TO_PAGE:!1,MOCK_MODE:!1,ALLOWED_POST_MESSAGE_METHODS:(o={},t(o,i.CONSTANTS.SEND_STRATEGIES.POST_MESSAGE,!0),t(o,i.CONSTANTS.SEND_STRATEGIES.GLOBAL_METHOD,!0),t(o,i.CONSTANTS.SEND_STRATEGIES.REMOTE_BRIDGE,!0),t(o,i.CONSTANTS.SEND_STRATEGIES.LOCAL_BRIDGE,!0),o)}},function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=n.CONSTANTS={POST_MESSAGE_TYPE:{REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},POST_MESSAGE_ACK:{SUCCESS:"success",ERROR:"error"},POST_MESSAGE_NAMES:{METHOD:"postrobot_method",READY:"postrobot_ready"},WINDOW_TYPES:{FULLPAGE:"fullpage",POPUP:"popup",IFRAME:"iframe"},WINDOW_PROPS:{POSTROBOT:"__postRobot__"},SERIALIZATION_TYPES:{METHOD:"postrobot_method"},SEND_STRATEGIES:{POST_MESSAGE:"postrobot_post_message",GLOBAL_METHOD:"postrobot_global_method",REMOTE_BRIDGE:"postrobot_remote_bridge",LOCAL_BRIDGE:"postrobot_local_bridge"}};n.POST_MESSAGE_NAMES_LIST=Object.keys(r.POST_MESSAGE_NAMES).map(function(e){return r.POST_MESSAGE_NAMES[e]})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(7);Object.keys(t).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(21);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(23);Object.keys(i).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})})},function(e,n,r){"use strict";function t(e){try{e=JSON.parse(e)}catch(n){return}if(e.type&&w.RECEIVE_MESSAGE_TYPES[e.type])return e}function o(e,n){var r={"window.parent":function(e){return window.parent},"window.opener":function(e){return(0,c.getOpener)(window)},"window.parent.opener":function(e){return(0,c.getOpener)(window.parent)},"window.opener.parent":function(e){return(0,c.getOpener)(window).parent}},t=void 0;try{t=r[e](n)}catch(o){throw new Error("Can not get "+e+": "+o.message)}if(!t)throw new Error("Can not get "+e+": not available");return t}function i(e,n){if(!s.CONFIG.MOCK_MODE&&n){var r=(0,l.getRequestListener)(n.name,e);if(n.type!==s.CONSTANTS.POST_MESSAGE_TYPE.REQUEST||!n.name||!r||r.proxy!==!1){var t=(n.type===s.CONSTANTS.POST_MESSAGE_TYPE.REQUEST||n.type===s.CONSTANTS.POST_MESSAGE_TYPE.ACK)&&l.listeners.response[n.hash];if(!t)for(var i=0;i<l.listeners.proxies.length;i++){var a=l.listeners.proxies[i];if(e===a.from)return a.to}if(n.targetHint){var u=o(n.targetHint,n.target);return delete n.targetHint,u}if(n.target&&n.target!==(0,c.getWindowId)(window)){var d=(0,c.getWindowById)(n.target);if(!d)throw new Error("Unable to find window to proxy message to: "+n.target);return d}}}}function a(e){try{e.source}catch(n){return}var r=e.source,a=e.origin,u=e.data,l=t(u);if(l&&-1===p.indexOf(l.id)){p.push(l.id),(0,c.registerWindow)(l.source,r,a);var S=void 0;try{S=i(r,l)}catch(n){return c.log.debug(n.message)}var m=void 0;if(m=-1!==s.POST_MESSAGE_NAMES_LIST.indexOf(l.name)||l.type===s.CONSTANTS.POST_MESSAGE_TYPE.ACK||S?"debug":"error"===l.ack?"error":"info",c.log.logLevel(m,[S?"#receiveproxy":"#receive",l.type,l.name,l]),S)return(0,c.isWindowClosed)(S)?c.log.debug("Target window is closed: "+l.target+" - can not proxy "+l.type+" "+l.name):(delete l.target,(0,f.sendMessage)(S,l,l.domain||"*",!0));var h=r;if(l.originalSource!==l.source){if(l.sourceHint)h=o(l.sourceHint,l.originalSource),delete l.sourceHint;else if(h=(0,c.getWindowById)(l.originalSource),!h)throw new Error("Can not find original message source: "+l.originalSource);(0,c.registerWindow)(l.originalSource,h,l.originalSourceDomain)}if(h!==r&&(0,d.registerBridge)(r,h),(0,c.isWindowClosed)(h))return c.log.debug("Source window is closed: "+l.originalSource+" - can not send "+l.type+" "+l.name);if(s.CONFIG.MOCK_MODE)return w.RECEIVE_MESSAGE_TYPES[l.type](h,l,a);l.data&&(l.data=(0,c.deserializeMethods)(h,l.data)),w.RECEIVE_MESSAGE_TYPES[l.type](h,l,a)}}function u(e){try{e.source}catch(n){return}e={source:e.source||e.sourceElement,origin:e.origin||e.originalEvent.origin,data:e.data};try{(0,d.emulateIERestrictions)(e.source,window)}catch(n){return}a(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.receiveMessage=a,n.messageListener=u;var s=r(3),c=r(8),d=r(17),f=r(21),l=r(23),w=r(24),p=[]},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(9);Object.keys(t).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(12);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(13);Object.keys(i).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})});var a=r(14);Object.keys(a).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return a[e]}})});var u=r(15);Object.keys(u).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return u[e]}})});var s=r(11);Object.keys(s).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return s[e]}})});var c=r(16);Object.keys(c).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return c[e]}})})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.promise=n.Promise=void 0;var t=r(10),o=r(11),i=n.Promise=t.SyncPromise,a=n.promise={Promise:i,run:function(e){return i.resolve().then(e)},nextTick:function(e){return new i(function(n,r){(0,o.nextTick)(function(){return a.run(e).then(n,r)})})},method:function(e){return function(){var n=this,r=arguments;return i.resolve().then(function(){return e.apply(n,r)})}},nodeify:function(e,n){return n?void e.then(function(e){n(null,e)},function(e){n(e)}):e},deNodeify:function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),t=1;n>t;t++)r[t-1]=arguments[t];return new i(function(n,t){try{return r.length<e.length?e.apply(void 0,r.concat([function(e,r){return e?t(e):n(r)}])):a.run(function(){return e.apply(void 0,r)}).then(n,t)}catch(o){return t(o)}})},map:function(e,n){for(var r=[],t=function(t){r.push(a.run(function(){return n(e[t])}))},o=0;o<e.length;o++)t(o);return i.all(r)}}},function(e,n){"use strict";function r(e,n,r){function t(){if(a){if(s)return r(o);if(u)return n(i)}}var o,i,a=!1,u=!1,s=!1;try{e(function(e){i=e,u=!0,t()},function(e){o=e,s=!0,t()})}catch(c){return r(c)}a=!0,t()}function t(e){c.push(e),s=s||setTimeout(o,1)}function o(){s=null;var e=c;c=[];for(var n=0;n<e.length;n++){var r=e[n];r.hasHandlers||(r.handlers.push({onError:function(e){r.hasHandlers||i(e)}}),r.dispatch())}}function i(e){setTimeout(function(){throw e})}function a(e){try{if(e&&e.then instanceof Function)return!0}catch(n){return!1}return!1}function u(){window.Promise=d}Object.defineProperty(n,"__esModule",{value:!0}),n.patchPromise=u;var s,c=[],d=n.SyncPromise=function(e,n){if(this.parent=n,this.resolved=!1,this.rejected=!1,this.hasHandlers=!1,this.handlers=[],t(this),e){var o=this;r(e,function(e){return o.resolve(e)},function(e){return o.reject(e)})}};d.resolve=function(e){return a(e)?e:(new d).resolve(e)},d.reject=function(e){return(new d).reject(e)},d.prototype.resolve=function(e){if(this.resolved||this.rejected)return this;if(a(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},d.prototype.reject=function(e){if(this.resolved||this.rejected)return this;if(a(e))throw new Error("Can not reject promise with another promise");return this.rejected=!0,this.value=e,this.dispatch(),this},d.prototype.dispatch=function(){var e=this;if(this.resolved||this.rejected)for(var n=function(){var n=e.handlers.shift();try{e.resolved?r=n.onSuccess?n.onSuccess(e.value):e.value:n.onError?r=n.onError(e.value):t=e.value}catch(o){t=o}if(r===e)throw new Error("Can not return a promise from the the then handler of the same promise");return n.promise?void(t?n.promise.reject(t):a(r)?r.then(function(e){n.promise.resolve(e)},function(e){n.promise.reject(e)}):n.promise.resolve(r)):"continue"};this.handlers.length;){var r,t;n()}},d.prototype.then=function(e,n){var r=new d(null,this);return this.handlers.push({promise:r,onSuccess:e,onError:n}),this.hasHandlers=!0,this.dispatch(),r},d.prototype["catch"]=function(e){return this.then(null,e)},d.prototype["finally"]=function(e){return this.then(function(n){return e(),n},function(n){throw e(),n})},d.all=function(e){for(var n=new d,r=e.length,t=[],o=0;o<e.length;o++)e[o].then(function(e){t[o]=e,r-=1,0===r&&n.resolve(t)},function(e){n.reject(e)});return n}},function(e,n,r){"use strict";function t(e){a.push(e),window.postMessage(i,"*")}Object.defineProperty(n,"__esModule",{value:!0}),n.nextTick=t;var o=r(12),i="__nextTick__postRobot__"+o.util.uniqueID(),a=[];window.addEventListener("message",function(e){if(e.data===i){var n=a.shift();n.call()}})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.util=void 0;var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=r(3),i=n.util={isPopup:function(){return Boolean(window.opener)},isIframe:function(){return Boolean(window.parent&&window!==window.parent)},isFullpage:function(){return Boolean(!i.isIframe()&&!i.isPopup())},getType:function(){return i.isPopup()?o.CONSTANTS.WINDOW_TYPES.POPUP:i.isIframe()?o.CONSTANTS.WINDOW_TYPES.IFRAME:o.CONSTANTS.WINDOW_TYPES.FULLPAGE},once:function(e){if(!e)return e;var n=!1;return function(){return n?void 0:(n=!0,e.apply(this,arguments))}},noop:function(){},safeHasProp:function(e,n){try{return!!e[n]}catch(r){return!1}},safeGetProp:function(e,n){try{return e[n]}catch(r){return}},listen:function(e,n,r){return e.addEventListener?e.addEventListener(n,r):e.attachEvent("on"+n,r),{cancel:function(){e.removeEventListener?e.removeEventListener(n,r):e.detachEvent("on"+n,r)}}},apply:function(e,n,r){return e.apply instanceof Function?e.apply(n,r):e(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9])},find:function(e,n,r){if(!e)return r;for(var t=0;t<e.length;t++)if(n(e[t]))return e[t];return r},map:function(e,n){for(var r=[],t=0;t<e.length;t++)r.push(n(e[t]));return r},some:function(e,n){n=n||Boolean;for(var r=0;r<e.length;r++)if(n(e[r]))return!0;return!1},keys:function(e){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(r);return n},values:function(e){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(e[r]);return n},getByValue:function(e,n){for(var r in e)if(e.hasOwnProperty(r)&&e[r]===n)return r},uniqueID:function(){var e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})},memoize:function(e){var n={};return function(){var r=JSON.stringify(Array.prototype.slice.call(arguments));return n.hasOwnProperty(r)||(n[r]=e.apply(this,arguments)),n[r]}},extend:function(e,n){if(!n)return e;for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r]);return e},each:function(e,n){if(e instanceof Array)for(var r=0;r<e.length;r++)n(e[r],r);else if(e instanceof Object&&!(e instanceof Function))for(var t in e)e.hasOwnProperty(t)&&n(e[t],t)},replaceObject:function(e,n){var r=e instanceof Array?[]:{};return i.each(e,function(e,o){var a=n(e,o);void 0!==a?r[o]=a:"object"===("undefined"==typeof e?"undefined":t(e))&&null!==e?r[o]=i.replaceObject(e,n):r[o]=e}),r},safeInterval:function(e,n){function r(){t=setTimeout(r,n),e.call()}var t=void 0;return t=setTimeout(r,n),{cancel:function(){clearTimeout(t)}}},intervalTimeout:function(e,n,r){var t=i.safeInterval(function(){e-=n,e=0>=e?0:e,0===e&&t.cancel(),r(e)},n);return t},getDomain:function(e){return e=e||window,e.mockDomain||e.location.protocol+"//"+e.location.host},getDomainFromUrl:function(e){var n=void 0;return 0!==e.indexOf("http://")&&0!==e.indexOf("https://")?this.getDomain():(n=e,n=n.split("/").slice(0,3).join("/"))},isFrameOwnedBy:function(e,n){try{return n.parent===e}catch(r){try{for(var t=0;t<e.frames.length;t++)if(e.frames[t]===n)return!0}catch(o){return!1}}return!1}}},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.log=void 0;var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=r(12),i=r(3),a=["debug","info","warn","error"];Function.prototype.bind&&window.console&&"object"===t(console.log)&&["log","info","warn","error"].forEach(function(e){console[e]=this.bind(console[e],console)},Function.prototype.call);var u=n.log={clearLogs:function(){if(window.console&&window.console.clear&&window.console.clear(),i.CONFIG.LOG_TO_PAGE){var e=document.getElementById("postRobotLogs");e&&e.parentNode.removeChild(e)}},writeToPage:function(e,n){setTimeout(function(){var r=document.getElementById("postRobotLogs");r||(r=document.createElement("div"),r.id="postRobotLogs",r.style.cssText="width: 800px; font-family: monospace; white-space: pre-wrap;",document.body.appendChild(r));var t=document.createElement("div"),i=(new Date).toString().split(" ")[4],a=o.util.map(n,function(e){if("string"==typeof e)return e;if(!e)return toString.call(e);var n=void 0;try{n=JSON.stringify(e,0,2)}catch(r){n="[object]"}return"\n\n"+n+"\n\n"}).join(" "),u=i+" "+e+" "+a;t.innerHTML=u;var s={log:"#ddd",warn:"orange",error:"red",info:"blue",debug:"#aaa"}[e];t.style.cssText="margin-top: 10px; color: "+s+";",r.childNodes.length?r.insertBefore(t,r.childNodes[0]):r.appendChild(t)})},logLevel:function(e,n){a.indexOf(e)<a.indexOf(i.CONFIG.LOG_LEVEL)||(n=Array.prototype.slice.call(n),n.unshift(window.location.pathname),n.unshift(window.location.host),n.unshift("<"+o.util.getType().toLowerCase()+">"),n.unshift("[post-robot]"),i.CONFIG.LOG_TO_PAGE&&u.writeToPage(e,n),window.console&&(window.console[e]||(e="log"),window.console[e]&&window.console[e].apply(window.console,n)))},debug:function(){u.logLevel("debug",arguments)},info:function(){u.logLevel("info",arguments)},warn:function(){u.logLevel("warn",arguments)},error:function(){u.logLevel("error",arguments)}}},function(e,n,r){"use strict";function t(e,n){var r=void 0;try{r=e[n]}catch(t){}return r}function o(e){for(var n=m,r=Array.isArray(n),t=0,n=r?n:n[Symbol.iterator]();;){var o;if(r){if(t>=n.length)break;o=n[t++]}else{if(t=n.next(),t.done)break;o=t.value}var i=o;if(i.win===e){if(!i.match)return!1;i.match=!1;try{i.match=S.util.getDomain(window)===S.util.getDomain(e)}catch(a){return}return i.match}}var u=!1;try{S.util.getDomain(window)===S.util.getDomain(e)&&(u=!0)}catch(a){}return m.push({win:e,match:u}),u}function i(e){try{return!e||e.closed||"undefined"==typeof e.closed||o(e)&&t(e,"mockclosed")}catch(n){return!0}}function a(e){if(e)try{return e.opener}catch(n){return}}function u(e){e=e||window;var n=a(e);return n?n:e.parent!==e?e.parent:void 0}function s(e){if(e===window)return E;for(var n=h.length-1;n>=0;n--){var r=h[n];try{if(r.win===e)return r.id}catch(t){continue}}}function c(e){if(e===window.name||e===E)return window;if(window.frames&&window.frames[e])return window.frames[e];for(var n=h.length-1;n>=0;n--){var r=h[n];try{if(r.id===e)return r.win}catch(t){continue}}}function d(e){if(e===window)return S.util.getDomain(window);for(var n=h.length-1;n>=0;n--){var r=h[n];try{if(r.win===e&&r.domain)return r.domain}catch(t){continue}}}function f(e,n,r){for(var t=h,o=Array.isArray(t),a=0,t=o?t:t[Symbol.iterator]();;){var u;if(o){if(a>=t.length)break;u=t[a++]}else{if(a=t.next(),a.done)break;u=a.value}var s=u;try{if(s.id===e&&s.win===n)return void(s.domain=r)}catch(c){continue}if(s.id===e&&s.win!==n&&!i(s.win))throw new Error("Can not register a duplicate window with name "+e)}h.push({id:e,win:n,domain:r})}function l(e,n){if(e===n)return!0;var r=s(e),t=s(n);return!(!r||!t||r!==t)}function w(e,n){try{return e.top===n.top}catch(r){return!1}}function p(e,n,r){var t=S.util.getDomainFromUrl(r);f(e,n,t),m.push({win:n,match:S.util.getDomain()===t})}Object.defineProperty(n,"__esModule",{value:!0}),n.isSameDomain=o,n.isWindowClosed=i,n.getOpener=a,n.getParentWindow=u,n.getWindowId=s,n.getWindowById=c,n.getWindowDomain=d,n.registerWindow=f,n.isWindowEqual=l,n.isSameTopWindow=w,n.linkUrl=p;var S=r(12),m=[],h=[],E=window.name||S.util.getType()+"_"+S.util.uniqueID(),g=window.open;window.open=function(e,n,r,t){n||(n=S.util.uniqueID(),arguments[1]=n);var o=S.util.apply(g,this,arguments);return e?p(n,o,e):f(n,o),o}},function(e,n,r){"use strict";function t(e){return e instanceof Object&&e.__type__===s.CONSTANTS.SERIALIZATION_TYPES.METHOD&&e.__id__}function o(e,n,r){var t=c.util.uniqueID();return w[t]={win:e,method:n},{__type__:s.CONSTANTS.SERIALIZATION_TYPES.METHOD,__id__:t,__name__:r}}function i(e,n){return p(),c.util.replaceObject({obj:n},function(n,r){return n instanceof Function?o(e,n,r):void 0}).obj}function a(e,n){function r(){var r=Array.prototype.slice.call(arguments);return f.log.debug("Call foreign method",n.__name__,r),(0,d.send)(e,s.CONSTANTS.POST_MESSAGE_NAMES.METHOD,{id:n.__id__,name:n.__name__,args:r}).then(function(e){return f.log.debug("Got foreign method result",n.__name__,e.result),e.result})}return r.__name__=n.__name__,r}function u(e,n){return c.util.replaceObject({obj:n},function(n,r){return t(n)?a(e,n):void 0}).obj}Object.defineProperty(n,"__esModule",{value:!0}),n.listenForMethods=void 0,n.serializeMethod=o,n.serializeMethods=i,n.deserializeMethod=a,n.deserializeMethods=u;var s=r(3),c=r(12),d=r(1),f=r(13),l=r(9),w={},p=n.listenForMethods=c.util.once(function(){(0,d.on)(s.CONSTANTS.POST_MESSAGE_NAMES.METHOD,function(e,n){if(!w[n.id])throw new Error("Could not find method with id: "+n.id);if(w[n.id].win!==e)throw new Error("Method window does not match");var r=w[n.id].method;return f.log.debug("Call local method",n.name,n.args),l.promise.run(function(){return r.apply(null,n.args)}).then(function(e){return{result:e,id:n.id,name:n.name}})})})},function(e,n,r){"use strict";function t(){(0,u.on)(i.CONSTANTS.POST_MESSAGE_NAMES.READY,function(e,n){for(var r=d,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.win===e)return void a.promise.resolve(e)}d.push({win:e,promise:(new c.SyncPromise).resolve(e)})});var e=(0,a.getParentWindow)();e&&(0,u.send)(e,i.CONSTANTS.POST_MESSAGE_NAMES.READY,{})["catch"](function(e){s.log.debug(e.stack||e.toString())})}function o(e){for(var n=arguments.length<=1||void 0===arguments[1]?5e3:arguments[1],r=arguments.length<=2||void 0===arguments[2]?"Window":arguments[2],t=d,o=Array.isArray(t),i=0,t=o?t:t[Symbol.iterator]();;){var a;if(o){if(i>=t.length)break;a=t[i++]}else{if(i=t.next(),i.done)break;a=i.value}var u=a;if(u.win===e)return u.promise}var s=new c.SyncPromise;return d.push({win:e,promise:s}),setTimeout(function(){return s.reject(new Error(r+" did not load after "+n+"ms"))},n),s}Object.defineProperty(n,"__esModule",{value:!0}),n.initOnReady=t,n.onWindowReady=o;var i=r(3),a=r(14),u=r(1),s=r(13),c=r(10),d=[]},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(18);Object.keys(t).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(19);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(20);Object.keys(i).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})})},function(e,n,r){"use strict";function t(){return new w.promise.Promise(function(e){return window.document&&window.document.body?e(window.document):void window.document.addEventListener("DOMContentLoaded",function(n){return e(window.document)})})}function o(e){var n=arguments.length<=1||void 0===arguments[1]?h.LOCAL:arguments[1];return w.promise.run(function(){if(n===h.LOCAL&&S[e])return S[e];for(var r=m,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.domain===e&&a.zone===n)return a.bridge}}).then(function(e){return e&&n===h.LOCAL?(0,w.onWindowReady)(e):e})}function i(e){var n=arguments.length<=1||void 0===arguments[1]?h.LOCAL:arguments[1];return w.promise.run(function(){return(0,w.getOpener)(e)===window?(0,w.onWindowReady)(e):void 0}).then(function(){for(var r=m,t=Array.isArray(r),i=0,r=t?r:r[Symbol.iterator]();;){var a;if(t){if(i>=r.length)break;a=r[i++]}else{if(i=r.next(),i.done)break;a=i.value}var u=a;if(u.win===e&&u.zone===n)return u.bridge}var s=(0,w.getWindowDomain)(e);return s?o(s,n):void 0}).then(function(e){return e&&n===h.LOCAL?(0,w.onWindowReady)(e):e})}function a(e){return o(e,h.LOCAL)}function u(e){return i(e,h.LOCAL)}function s(e){return o(e,h.REMOTE)}function c(e){return w.promise.run(function(){return i(e,h.REMOTE)}).then(function(n){if(n)return n;try{if(!e||!e.frames||!e.frames.length)return;for(var r=0;r<e.frames.length;r++)try{var t=e.frames[r];if(t&&t!==window&&(0,w.isSameDomain)(t)&&t[l.CONSTANTS.WINDOW_PROPS.POSTROBOT])return t}catch(o){continue}}catch(o){return}})}function d(e,n){for(var r=void 0,t=m,o=Array.isArray(t),i=0,t=o?t:t[Symbol.iterator]();;){var a;if(o){if(i>=t.length)break;a=t[i++]}else{if(i=t.next(),i.done)break;a=i.value}var u=a;if(u.bridge===e){r=u;break}}if(!r){var s=w.util.isFrameOwnedBy(window,e)?h.LOCAL:h.REMOTE;r={bridge:e,domain:(0,w.getWindowDomain)(e),windows:[],zone:s},m.push(r)}n&&-1===r.windows.indexOf(n)&&r.windows.push(n)}function f(e,n){n=n||w.util.getDomainFromUrl(e);var r=w.promise.run(function(){return a(n)}).then(function(r){if(r)return r;if(w.util.getDomain()!==n){var o=p+"_"+w.util.uniqueID();w.log.debug("Opening bridge:",e);var i=document.createElement("iframe");return i.setAttribute("name",o),i.setAttribute("id",o),i.setAttribute("style","margin: 0; padding: 0; border: 0px none; overflow: hidden;"),i.setAttribute("frameborder","0"),i.setAttribute("border","0"),i.setAttribute("scrolling","no"),i.setAttribute("allowTransparency","true"),i.setAttribute("tabindex","-1"),i.setAttribute("hidden","true"),i.setAttribute("title",""),i.setAttribute("role","presentation"),i.src=e,t().then(function(r){r.body.appendChild(i);var t=i.contentWindow;return(0,w.registerWindow)(o,t,n),d(t),delete S[n],new w.promise.Promise(function(e,n){i.onload=e,i.onerror=n}).then(function(){return(0,w.onWindowReady)(t,5e3,"Bridge "+e)}).then(function(){return t})})}});return S[n]=r,r}Object.defineProperty(n,"__esModule",{value:!0}),n.getLocalBridgeForDomain=a,n.getLocalBridgeForWindow=u,n.getRemoteBridgeForDomain=s,n.getRemoteBridgeForWindow=c,n.registerBridge=d,n.openBridge=f;var l=r(3),w=r(8),p="__postrobot_bridge__",S={},m=[],h={LOCAL:"local",REMOTE:"remote"}},function(e,n,r){"use strict";function t(){if(window[o.CONSTANTS.WINDOW_PROPS.POSTROBOT])throw new Error("Attempting to load postRobot twice on the same window");window[o.CONSTANTS.WINDOW_PROPS.POSTROBOT]={postMessage:function(e){(0,i.receiveMessage)(e)}}}Object.defineProperty(n,"__esModule",{value:!0}),n.registerGlobals=t;var o=r(3),i=r(6)},function(e,n,r){"use strict";function t(e,n){if(!o.CONFIG.ALLOW_POSTMESSAGE_POPUP&&!(0,i.isSameTopWindow)(e,n))throw new Error("Can not send and receive post messages between two different windows (disabled to emulate IE)")}Object.defineProperty(n,"__esModule",{value:!0}),n.emulateIERestrictions=t;var o=r(3),i=r(8)},function(e,n,r){"use strict";function t(e,n){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],t=u.util.uniqueID(),o=(0,u.getWindowId)(window),a=u.util.getType(),s=(0,u.getWindowId)(e),c=u.util.getDomain(window);return i({},n,r,{id:n.id||t,source:o,originalSource:n.originalSource||o,sourceDomain:c,originalSourceDomain:n.sourceDomain||c,windowType:a,originalWindowType:n.originalWindowType||a,target:n.target||s})}function o(e,n,r,o){return u.promise.run(function(){n=t(e,n,{data:(0,u.serializeMethods)(e,n.data),domain:r});var i=void 0;if(i=-1!==a.POST_MESSAGE_NAMES_LIST.indexOf(n.name)||n.type===a.CONSTANTS.POST_MESSAGE_TYPE.ACK||o?"debug":"error"===n.ack?"error":"info",u.log.logLevel(i,[o?"#sendproxy":"#send",n.type,n.name,n]),a.CONFIG.MOCK_MODE)return delete n.target,window[a.CONSTANTS.WINDOW_PROPS.POSTROBOT].postMessage({origin:u.util.getDomain(window),source:window,data:JSON.stringify(n)});if(e===window)throw new Error("Attemping to send message to self");if((0,u.isWindowClosed)(e))throw new Error("Window is closed");u.log.debug("Running send message strategies",n);var c=[];return u.promise.map(u.util.keys(s.SEND_MESSAGE_STRATEGIES),function(t){return u.promise.run(function(){if(!a.CONFIG.ALLOWED_POST_MESSAGE_METHODS[t])throw new Error("Strategy disallowed: "+t);return s.SEND_MESSAGE_STRATEGIES[t](e,n,r)}).then(function(){return c.push(t+": success"),!0},function(e){return c.push(t+": "+e.message),!1})}).then(function(e){var r=u.util.some(e),t=n.type+" "+n.name+" "+(r?"success":"error")+":\n - "+c.join("\n - ")+"\n";if(u.log.debug(t),!r)throw new Error(t)})})}Object.defineProperty(n,"__esModule",{value:!0});var i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e};n.buildMessage=t,n.sendMessage=o;var a=r(3),u=r(8),s=r(22)},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}Object.defineProperty(n,"__esModule",{value:!0}),n.SEND_MESSAGE_STRATEGIES=void 0;var o,i=r(3),a=r(8),u=r(17);n.SEND_MESSAGE_STRATEGIES=(o={},t(o,i.CONSTANTS.SEND_STRATEGIES.POST_MESSAGE,function(e,n,r){return(0,u.emulateIERestrictions)(window,e),e.postMessage(JSON.stringify(n,0,2),r)}),t(o,i.CONSTANTS.SEND_STRATEGIES.GLOBAL_METHOD,function(e,n,r){if(!(0,a.isSameDomain)(e))throw new Error("Window is not on the same domain");if((0,a.isSameTopWindow)(window,e))throw new Error("Can only use global method to communicate between two different windows, not between frames");var t=a.util.getDomain(window),o=void 0;try{o=a.util.getDomain(e)}catch(u){throw new Error("Can not read target window domain: "+u.message)}if(t!==o)throw new Error("Can not send global message - source "+t+" does not match target "+o);if("*"!==r&&o!==r)throw new Error("Can post post through global method - specified domain "+r+" does not match target domain "+o);if(!a.util.safeHasProp(e,i.CONSTANTS.WINDOW_PROPS.POSTROBOT))throw new Error("post-robot not available on target window at "+o);e[i.CONSTANTS.WINDOW_PROPS.POSTROBOT].postMessage({origin:a.util.getDomain(window),source:window,data:JSON.stringify(n,0,2)})}),t(o,i.CONSTANTS.SEND_STRATEGIES.REMOTE_BRIDGE,function(e,n,r){if((0,a.isSameTopWindow)(window,e))throw new Error("Can only use bridge to communicate between two different windows, not between frames");return(0,u.getRemoteBridgeForWindow)(e).then(function(r){if(!r)throw new Error("No bridge available in window");var t=a.util.getDomain(window),o=void 0;try{o=a.util.getDomain(r)}catch(u){throw new Error("Can not read bridge window domain: "+u.message)}if(t!==o)throw new Error("Can not accept global message through bridge - source "+t+" does not match bridge "+o);if(!a.util.safeHasProp(r,i.CONSTANTS.WINDOW_PROPS.POSTROBOT))throw new Error("post-robot not available on bridge at "+o);
n.targetHint="window.parent",window===(0,a.getOpener)(e)&&(n.sourceHint="window.opener"),r[i.CONSTANTS.WINDOW_PROPS.POSTROBOT].postMessage({origin:a.util.getDomain(window),source:window,data:JSON.stringify(n,0,2)})})}),t(o,i.CONSTANTS.SEND_STRATEGIES.LOCAL_BRIDGE,function(e,n,r){if((0,a.isSameTopWindow)(window,e))throw new Error("Can only use bridge to communicate between two different windows, not between frames");if(e===(0,a.getOpener)(window)&&(n.targetHint="window.parent.opener"),!n.target&&!n.targetHint)throw new Error("Can not post message down through bridge without target or targetHint");var t=(0,a.getOpener)(e);return t&&window===t&&(n.sourceHint="window.opener"),t&&window===t.parent&&(n.sourceHint="window.opener.parent"),(0,u.getLocalBridgeForWindow)(e).then(function(t){if(!t)throw new Error("Bridge not initialized");if(e===t)throw new Error("Message target is bridge");t.postMessage(JSON.stringify(n,0,2),r)})}),o)},function(e,n,r){"use strict";function t(){n.listeners=s={request:[],response:{},proxies:[]}}function o(e,n){for(var r=s.request,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.name===e){if(!a.win)return a.options;if(n&&(0,u.isWindowEqual)(n,a.win))return a.options}}}function i(e){for(var n=void 0,r=s.request,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.options===e){n=a;break}}n&&s.request.splice(s.request.indexOf(n),1)}function a(e,n,r,t){var a=o(e,n);if(a){if(!t)throw new Error("Request listener already exists for "+e);i(a)}s.request.push({name:e,win:n,options:r})}Object.defineProperty(n,"__esModule",{value:!0}),n.listeners=void 0,n.resetListeners=t,n.getRequestListener=o,n.removeRequestListener=i,n.addRequestListener=a;var u=r(8),s=n.listeners=void 0;t()},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}Object.defineProperty(n,"__esModule",{value:!0}),n.RECEIVE_MESSAGE_TYPES=void 0;var o,i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},a=r(3),u=r(8),s=r(21),c=r(23);n.RECEIVE_MESSAGE_TYPES=(o={},t(o,a.CONSTANTS.POST_MESSAGE_TYPE.ACK,function(e,n,r){var t=c.listeners.response[n.hash];if(!t)throw new Error("No handler found for post message ack for message: "+n.name+" in "+window.location.href);t.ack=!0}),t(o,a.CONSTANTS.POST_MESSAGE_TYPE.REQUEST,function(e,n,r){function t(r){return n.fireAndForget||(0,u.isWindowClosed)(e)?u.promise.Promise.resolve():(0,s.sendMessage)(e,i({target:n.originalSource,hash:n.hash,name:n.name},r),"*")}var o=(0,c.getRequestListener)(n.name,e);return u.promise.Promise.all([t({type:a.CONSTANTS.POST_MESSAGE_TYPE.ACK}),u.promise.run(function(){if(!o)throw new Error("No postmessage request handler for "+n.name+" in "+window.location.href);if(o.domain){var t="string"==typeof o.domain&&r===o.domain||o.domain instanceof RegExp&&r.match(o.domain);if(!t)throw new Error("Message origin "+r+" does not match domain "+o.domain)}return u.promise.deNodeify(o.handler,e,n.data)}).then(function(e){return t({type:a.CONSTANTS.POST_MESSAGE_TYPE.RESPONSE,ack:a.CONSTANTS.POST_MESSAGE_ACK.SUCCESS,data:e})},function(e){return t({type:a.CONSTANTS.POST_MESSAGE_TYPE.RESPONSE,ack:a.CONSTANTS.POST_MESSAGE_ACK.ERROR,error:e.stack?e.message+"\n"+e.stack:e.toString()})})])["catch"](function(e){return o&&o.handleError?o.handleError(e):void u.log.error(e.stack||e.toString())})}),t(o,a.CONSTANTS.POST_MESSAGE_TYPE.RESPONSE,function(e,n,r){var t=c.listeners.response[n.hash];if(!t)throw new Error("No response handler found for post message response "+n.name+" in "+window.location.href);return delete c.listeners.response[n.hash],n.ack===a.CONSTANTS.POST_MESSAGE_ACK.ERROR?t.respond(new Error(n.error)):n.ack===a.CONSTANTS.POST_MESSAGE_ACK.SUCCESS?t.respond(null,n.data||n.response):void 0}),o)},function(e,n,r){"use strict";function t(e){if(!e.name)throw new Error("Expected options.name");e.handler=e.handler||u.util.noop,e.errorHandler=e.errorHandler||function(e){throw e},e.once&&!function(){var n=e.handler;e.handler=u.util.once(function(){return(0,s.removeRequestListener)(e),n.apply(this,arguments)})}();var n=e.override||a.CONFIG.MOCK_MODE;return(0,s.addRequestListener)(e.name,e.window,e,n),e.handleError=function(n){e.errorHandler(n)},e.window&&e.errorOnClose&&!function(){var n=u.util.safeInterval(function(){(0,u.isWindowClosed)(e.window)&&(n.cancel(),e.handleError(new Error("Post message target window is closed")))},50)}(),{cancel:function(){(0,s.removeRequestListener)(e)}}}function o(e,n,r,o){return n instanceof Function&&(o=r,r=n,n={}),n=n||{},n.name=e,n.handler=r||n.handler,n.errorHandler=o||n.errorHandler,t(n)}function i(e,n,r,o){n instanceof Function&&(o=r,r=n,n={}),n=n||{},n.name=e,n.handler=r||n.handler,n.errorHandler=o||n.errorHandler,n.once=!0;var i=new u.promise.Promise(function(e,r){n.handler=n.handler||function(n,r){return e(r)},n.errorHandler=n.errorHandler||r}),a=t(n);return u.util.extend(i,a),i}Object.defineProperty(n,"__esModule",{value:!0}),n.listen=t,n.on=o,n.once=i;var a=r(3),u=r(8),s=r(6)},function(e,n,r){"use strict";function t(e,n){i.listeners.proxies.push({from:e,to:n}),i.listeners.proxies.push({from:n,to:e})}function o(e,n){for(var r=[],t=0;t<i.listeners.proxies.length;t++){var o=i.listeners.proxies[t];(o.to===e&&o.from===n||o.to===n&&o.from===e)&&r.push(o)}for(var a=0;a<r.length;a++)i.listeners.proxies.splice(i.listeners.proxies.indexOf(r[a]),1)}Object.defineProperty(n,"__esModule",{value:!0}),n.proxy=t,n.unproxy=o;var i=r(6)},function(e,n,r){"use strict";function t(){i.CONFIG.MOCK_MODE=!0}function o(){i.CONFIG.MOCK_MODE=!1}Object.defineProperty(n,"__esModule",{value:!0}),n.CONSTANTS=n.CONFIG=void 0,n.enableMockMode=t,n.disableMockMode=o;var i=r(3);Object.defineProperty(n,"CONFIG",{enumerable:!0,get:function(){return i.CONFIG}}),Object.defineProperty(n,"CONSTANTS",{enumerable:!0,get:function(){return i.CONSTANTS}})}])});
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("postRobot",[],n):"object"==typeof exports?exports.postRobot=n():e.postRobot=n()}(this,function(){return function(e){function n(t){if(r[t])return r[t].exports;var o=r[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){"use strict";function t(){(0,u.registerGlobals)(),i.util.listen(window,"message",a.messageListener),(0,i.initOnReady)()}Object.defineProperty(n,"__esModule",{value:!0}),n.Promise=void 0;var o=r(1);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(8);Object.defineProperty(n,"Promise",{enumerable:!0,get:function(){return i.Promise}});var a=r(6),u=r(17);t(),n["default"]=e.exports},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.linkUrl=n.util=n.openBridge=n.reset=n.parent=void 0;var t=r(2);Object.keys(t).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(25);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(26);Object.keys(i).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})});var a=r(27);Object.keys(a).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return a[e]}})});var u=r(6);Object.defineProperty(n,"reset",{enumerable:!0,get:function(){return u.resetListeners}});var s=r(18);Object.defineProperty(n,"openBridge",{enumerable:!0,get:function(){return s.openBridge}});var c=r(12);Object.defineProperty(n,"util",{enumerable:!0,get:function(){return c.util}});var d=r(14);Object.defineProperty(n,"linkUrl",{enumerable:!0,get:function(){return d.linkUrl}});n.parent=(0,d.getParentWindow)()},function(e,n,r){"use strict";function t(e){return s.promise.nodeify(new s.promise.Promise(function(n,r){if(!e.name)throw new Error("Expected options.name");if(!e.window)throw new Error("Expected options.window");if(a.CONFIG.MOCK_MODE)e.window=window;else if("string"==typeof e.window){var t=document.getElementById(e.window);if(!t)throw new Error("Expected options.window "+e.window+" to be a valid element id");if("iframe"!==t.tagName.toLowerCase())throw new Error("Expected options.window "+e.window+" to be an iframe");if(e.window=t.contentWindow,!e.window)throw new Error("Expected options.window")}var o=e.name+"_"+s.util.uniqueID();if(u.listeners.response[o]=e,(0,s.isWindowClosed)(e.window))throw new Error("Target window is closed");var i=!1;return e.respond=function(e,t){return e||(i=!0),e?r(e):n(t)},s.promise.run(function(){return(0,s.getParentWindow)(e.window)===window?(0,s.onWindowReady)(e.window):void 0}).then(function(){if((0,u.sendMessage)(e.window,{hash:o,type:a.CONSTANTS.POST_MESSAGE_TYPE.REQUEST,name:e.name,data:e.data,fireAndForget:e.fireAndForget},e.domain||"*")["catch"](r),e.fireAndForget)return n();var t=s.util.intervalTimeout(a.CONFIG.ACK_TIMEOUT,100,function(n){return e.ack||(0,s.isWindowClosed)(e.window)?t.cancel():n?void 0:r(new Error("No ack for postMessage "+e.name+" in "+a.CONFIG.ACK_TIMEOUT+"ms"))});e.timeout&&!function(){var n=s.util.intervalTimeout(e.timeout,100,function(t){return i||(0,s.isWindowClosed)(e.window)?n.cancel():t?void 0:r(new Error("Post message response timed out after "+e.timeout+" ms"))},e.timeout)}()})["catch"](r)}),e.callback)}function o(e,n,r,o,i){return i||(!o&&r instanceof Function?(i=r,o={},r={}):o instanceof Function&&(i=o,o={})),o=o||{},o.window=e,o.name=n,o.data=r,o.callback=i,t(o)}function i(e,n,r,t){var i=(0,s.getParentWindow)();if(!window)throw new Error("Window does not have a parent");return o(i,e,n,r,t)}Object.defineProperty(n,"__esModule",{value:!0}),n.request=t,n.send=o,n.sendToParent=i;var a=r(3),u=r(6),s=r(8)},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(4);Object.keys(t).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(5);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})})},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}Object.defineProperty(n,"__esModule",{value:!0}),n.CONFIG=void 0;var o,i=r(5);n.CONFIG={ALLOW_POSTMESSAGE_POPUP:!1,LOG_LEVEL:"info",ACK_TIMEOUT:500,LOG_TO_PAGE:!1,MOCK_MODE:!1,ALLOWED_POST_MESSAGE_METHODS:(o={},t(o,i.CONSTANTS.SEND_STRATEGIES.POST_MESSAGE,!0),t(o,i.CONSTANTS.SEND_STRATEGIES.GLOBAL_METHOD,!0),t(o,i.CONSTANTS.SEND_STRATEGIES.REMOTE_BRIDGE,!0),t(o,i.CONSTANTS.SEND_STRATEGIES.LOCAL_BRIDGE,!0),o)}},function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=n.CONSTANTS={POST_MESSAGE_TYPE:{REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},POST_MESSAGE_ACK:{SUCCESS:"success",ERROR:"error"},POST_MESSAGE_NAMES:{METHOD:"postrobot_method",READY:"postrobot_ready"},WINDOW_TYPES:{FULLPAGE:"fullpage",POPUP:"popup",IFRAME:"iframe"},WINDOW_PROPS:{POSTROBOT:"__postRobot__"},SERIALIZATION_TYPES:{METHOD:"postrobot_method"},SEND_STRATEGIES:{POST_MESSAGE:"postrobot_post_message",GLOBAL_METHOD:"postrobot_global_method",REMOTE_BRIDGE:"postrobot_remote_bridge",LOCAL_BRIDGE:"postrobot_local_bridge"}};n.POST_MESSAGE_NAMES_LIST=Object.keys(r.POST_MESSAGE_NAMES).map(function(e){return r.POST_MESSAGE_NAMES[e]})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(7);Object.keys(t).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(21);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(23);Object.keys(i).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})})},function(e,n,r){"use strict";function t(e){try{e=JSON.parse(e)}catch(n){return}if(e.type&&w.RECEIVE_MESSAGE_TYPES[e.type])return e}function o(e,n){var r={"window.parent":function(e){return window.parent},"window.opener":function(e){return(0,c.getOpener)(window)},"window.parent.opener":function(e){return(0,c.getOpener)(window.parent)},"window.opener.parent":function(e){return(0,c.getOpener)(window).parent}},t=void 0;try{t=r[e](n)}catch(o){throw new Error("Can not get "+e+": "+o.message)}if(!t)throw new Error("Can not get "+e+": not available");return t}function i(e,n){if(!s.CONFIG.MOCK_MODE&&n){var r=(0,l.getRequestListener)(n.name,e);if(n.type!==s.CONSTANTS.POST_MESSAGE_TYPE.REQUEST||!n.name||!r||r.proxy!==!1){var t=(n.type===s.CONSTANTS.POST_MESSAGE_TYPE.REQUEST||n.type===s.CONSTANTS.POST_MESSAGE_TYPE.ACK)&&l.listeners.response[n.hash];if(!t)for(var i=0;i<l.listeners.proxies.length;i++){var a=l.listeners.proxies[i];if(e===a.from)return a.to}if(n.targetHint){var u=o(n.targetHint,n.target);return delete n.targetHint,u}if(n.target&&n.target!==(0,c.getWindowId)(window)){var d=(0,c.getWindowById)(n.target);if(!d)throw new Error("Unable to find window to proxy message to: "+n.target);return d}}}}function a(e){try{e.source}catch(n){return}var r=e.source,a=e.origin,u=e.data,l=t(u);if(l&&-1===p.indexOf(l.id)){p.push(l.id),(0,c.registerWindow)(l.source,r,a);var S=void 0;try{S=i(r,l)}catch(n){return c.log.debug(n.message)}var m=void 0;if(m=-1!==s.POST_MESSAGE_NAMES_LIST.indexOf(l.name)||l.type===s.CONSTANTS.POST_MESSAGE_TYPE.ACK||S?"debug":"error"===l.ack?"error":"info",c.log.logLevel(m,[S?"#receiveproxy":"#receive",l.type,l.name,l]),S)return(0,c.isWindowClosed)(S)?c.log.debug("Target window is closed: "+l.target+" - can not proxy "+l.type+" "+l.name):(delete l.target,(0,f.sendMessage)(S,l,l.domain||"*",!0));var E=r;if(l.originalSource!==l.source){if(l.sourceHint)E=o(l.sourceHint,l.originalSource),delete l.sourceHint;else if(E=(0,c.getWindowById)(l.originalSource),!E)throw new Error("Can not find original message source: "+l.originalSource);(0,c.registerWindow)(l.originalSource,E,l.originalSourceDomain)}if(E!==r&&(0,d.registerBridge)(r,E),(0,c.isWindowClosed)(E))return c.log.debug("Source window is closed: "+l.originalSource+" - can not send "+l.type+" "+l.name);if(s.CONFIG.MOCK_MODE)return w.RECEIVE_MESSAGE_TYPES[l.type](E,l,a);l.data&&(l.data=(0,c.deserializeMethods)(E,l.data)),w.RECEIVE_MESSAGE_TYPES[l.type](E,l,a)}}function u(e){try{e.source}catch(n){return}e={source:e.source||e.sourceElement,origin:e.origin||e.originalEvent.origin,data:e.data};try{(0,d.emulateIERestrictions)(e.source,window)}catch(n){return}a(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.receiveMessage=a,n.messageListener=u;var s=r(3),c=r(8),d=r(17),f=r(21),l=r(23),w=r(24),p=[]},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(9);Object.keys(t).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(12);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(13);Object.keys(i).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})});var a=r(14);Object.keys(a).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return a[e]}})});var u=r(15);Object.keys(u).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return u[e]}})});var s=r(11);Object.keys(s).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return s[e]}})});var c=r(16);Object.keys(c).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return c[e]}})})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.promise=n.Promise=void 0;var t=r(10),o=r(11),i=n.Promise=t.SyncPromise,a=n.promise={Promise:i,run:function(e){return i.resolve().then(e)},nextTick:function(e){return new i(function(n,r){(0,o.nextTick)(function(){return a.run(e).then(n,r)})})},method:function(e){return function(){var n=this,r=arguments;return i.resolve().then(function(){return e.apply(n,r)})}},nodeify:function(e,n){return n?void e.then(function(e){n(null,e)},function(e){n(e)}):e},deNodeify:function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),t=1;n>t;t++)r[t-1]=arguments[t];return new i(function(n,t){try{return r.length<e.length?e.apply(void 0,r.concat([function(e,r){return e?t(e):n(r)}])):a.run(function(){return e.apply(void 0,r)}).then(n,t)}catch(o){return t(o)}})},map:function(e,n){for(var r=[],t=function(t){r.push(a.run(function(){return n(e[t])}))},o=0;o<e.length;o++)t(o);return i.all(r)}}},function(e,n){"use strict";function r(e,n,r){function t(){if(a){if(s)return r(o);if(u)return n(i)}}var o,i,a=!1,u=!1,s=!1;try{e(function(e){i=e,u=!0,t()},function(e){o=e,s=!0,t()})}catch(c){return r(c)}a=!0,t()}function t(e){c.push(e),s=s||setTimeout(o,1)}function o(){s=null;var e=c;c=[];for(var n=0;n<e.length;n++){var r=e[n];r.hasHandlers||(r.handlers.push({onError:function(e){r.hasHandlers||i(e)}}),r.dispatch())}}function i(e){setTimeout(function(){throw e})}function a(e){try{if(e&&e.then instanceof Function)return!0}catch(n){return!1}return!1}function u(){window.Promise=d}Object.defineProperty(n,"__esModule",{value:!0}),n.patchPromise=u;var s,c=[],d=n.SyncPromise=function(e,n){if(this.parent=n,this.resolved=!1,this.rejected=!1,this.hasHandlers=!1,this.handlers=[],t(this),e){var o=this;r(e,function(e){return o.resolve(e)},function(e){return o.reject(e)})}};d.resolve=function(e){return a(e)?e:(new d).resolve(e)},d.reject=function(e){return(new d).reject(e)},d.prototype.resolve=function(e){if(this.resolved||this.rejected)return this;if(a(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},d.prototype.reject=function(e){if(this.resolved||this.rejected)return this;if(a(e))throw new Error("Can not reject promise with another promise");return this.rejected=!0,this.value=e,this.dispatch(),this},d.prototype.dispatch=function(){var e=this;if(this.resolved||this.rejected)for(var n=function(){var n=e.handlers.shift();try{e.resolved?r=n.onSuccess?n.onSuccess(e.value):e.value:n.onError?r=n.onError(e.value):t=e.value}catch(o){t=o}if(r===e)throw new Error("Can not return a promise from the the then handler of the same promise");return n.promise?void(t?n.promise.reject(t):a(r)?r.then(function(e){n.promise.resolve(e)},function(e){n.promise.reject(e)}):n.promise.resolve(r)):"continue"};this.handlers.length;){var r,t;n()}},d.prototype.then=function(e,n){var r=new d(null,this);return this.handlers.push({promise:r,onSuccess:e,onError:n}),this.hasHandlers=!0,this.dispatch(),r},d.prototype["catch"]=function(e){return this.then(null,e)},d.prototype["finally"]=function(e){return this.then(function(n){return e(),n},function(n){throw e(),n})},d.all=function(e){for(var n=new d,r=e.length,t=[],o=0;o<e.length;o++)e[o].then(function(e){t[o]=e,r-=1,0===r&&n.resolve(t)},function(e){n.reject(e)});return n}},function(e,n,r){"use strict";function t(e){a.push(e),window.postMessage(i,"*")}Object.defineProperty(n,"__esModule",{value:!0}),n.nextTick=t;var o=r(12),i="__nextTick__postRobot__"+o.util.uniqueID(),a=[];window.addEventListener("message",function(e){if(e.data===i){var n=a.shift();n.call()}})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.util=void 0;var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=r(3),i=n.util={isPopup:function(){return Boolean(window.opener)},isIframe:function(){return Boolean(window.parent&&window!==window.parent)},isFullpage:function(){return Boolean(!i.isIframe()&&!i.isPopup())},getType:function(){return i.isPopup()?o.CONSTANTS.WINDOW_TYPES.POPUP:i.isIframe()?o.CONSTANTS.WINDOW_TYPES.IFRAME:o.CONSTANTS.WINDOW_TYPES.FULLPAGE},once:function(e){if(!e)return e;var n=!1;return function(){return n?void 0:(n=!0,e.apply(this,arguments))}},noop:function(){},safeHasProp:function(e,n){try{return!!e[n]}catch(r){return!1}},safeGetProp:function(e,n){try{return e[n]}catch(r){return}},listen:function(e,n,r){return e.addEventListener?e.addEventListener(n,r):e.attachEvent("on"+n,r),{cancel:function(){e.removeEventListener?e.removeEventListener(n,r):e.detachEvent("on"+n,r)}}},apply:function(e,n,r){return e.apply instanceof Function?e.apply(n,r):e(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9])},find:function(e,n,r){if(!e)return r;for(var t=0;t<e.length;t++)if(n(e[t]))return e[t];return r},map:function(e,n){for(var r=[],t=0;t<e.length;t++)r.push(n(e[t]));return r},some:function(e,n){n=n||Boolean;for(var r=0;r<e.length;r++)if(n(e[r]))return!0;return!1},keys:function(e){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(r);return n},values:function(e){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(e[r]);return n},getByValue:function(e,n){for(var r in e)if(e.hasOwnProperty(r)&&e[r]===n)return r},uniqueID:function(){var e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})},memoize:function(e){var n={};return function(){var r=JSON.stringify(Array.prototype.slice.call(arguments));return n.hasOwnProperty(r)||(n[r]=e.apply(this,arguments)),n[r]}},extend:function(e,n){if(!n)return e;for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r]);return e},each:function(e,n){if(e instanceof Array)for(var r=0;r<e.length;r++)n(e[r],r);else if(e instanceof Object&&!(e instanceof Function))for(var t in e)e.hasOwnProperty(t)&&n(e[t],t)},replaceObject:function(e,n){var r=e instanceof Array?[]:{};return i.each(e,function(e,o){var a=n(e,o);void 0!==a?r[o]=a:"object"===("undefined"==typeof e?"undefined":t(e))&&null!==e?r[o]=i.replaceObject(e,n):r[o]=e}),r},safeInterval:function(e,n){function r(){t=setTimeout(r,n),e.call()}var t=void 0;return t=setTimeout(r,n),{cancel:function(){clearTimeout(t)}}},intervalTimeout:function(e,n,r){var t=i.safeInterval(function(){e-=n,e=0>=e?0:e,0===e&&t.cancel(),r(e)},n);return t},getDomain:function(e){return e=e||window,e.mockDomain||e.location.protocol+"//"+e.location.host},getDomainFromUrl:function(e){var n=void 0;return 0!==e.indexOf("http://")&&0!==e.indexOf("https://")?this.getDomain():(n=e,n=n.split("/").slice(0,3).join("/"))},isFrameOwnedBy:function(e,n){try{return n.parent===e}catch(r){try{for(var t=0;t<e.frames.length;t++)if(e.frames[t]===n)return!0}catch(o){return!1}}return!1}}},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.log=void 0;var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=r(12),i=r(3),a=["debug","info","warn","error"];Function.prototype.bind&&window.console&&"object"===t(console.log)&&["log","info","warn","error"].forEach(function(e){console[e]=this.bind(console[e],console)},Function.prototype.call);var u=n.log={clearLogs:function(){if(window.console&&window.console.clear&&window.console.clear(),i.CONFIG.LOG_TO_PAGE){var e=document.getElementById("postRobotLogs");e&&e.parentNode.removeChild(e)}},writeToPage:function(e,n){setTimeout(function(){var r=document.getElementById("postRobotLogs");r||(r=document.createElement("div"),r.id="postRobotLogs",r.style.cssText="width: 800px; font-family: monospace; white-space: pre-wrap;",document.body.appendChild(r));var t=document.createElement("div"),i=(new Date).toString().split(" ")[4],a=o.util.map(n,function(e){if("string"==typeof e)return e;if(!e)return toString.call(e);var n=void 0;try{n=JSON.stringify(e,0,2)}catch(r){n="[object]"}return"\n\n"+n+"\n\n"}).join(" "),u=i+" "+e+" "+a;t.innerHTML=u;var s={log:"#ddd",warn:"orange",error:"red",info:"blue",debug:"#aaa"}[e];t.style.cssText="margin-top: 10px; color: "+s+";",r.childNodes.length?r.insertBefore(t,r.childNodes[0]):r.appendChild(t)})},logLevel:function(e,n){a.indexOf(e)<a.indexOf(i.CONFIG.LOG_LEVEL)||(n=Array.prototype.slice.call(n),n.unshift(window.location.pathname),n.unshift(window.location.host),n.unshift("<"+o.util.getType().toLowerCase()+">"),n.unshift("[post-robot]"),i.CONFIG.LOG_TO_PAGE&&u.writeToPage(e,n),window.console&&(window.console[e]||(e="log"),window.console[e]&&window.console[e].apply(window.console,n)))},debug:function(){u.logLevel("debug",arguments)},info:function(){u.logLevel("info",arguments)},warn:function(){u.logLevel("warn",arguments)},error:function(){u.logLevel("error",arguments)}}},function(e,n,r){"use strict";function t(e,n){var r=void 0;try{r=e[n]}catch(t){}return r}function o(e){for(var n=m,r=Array.isArray(n),t=0,n=r?n:n[Symbol.iterator]();;){var o;if(r){if(t>=n.length)break;o=n[t++]}else{if(t=n.next(),t.done)break;o=t.value}var i=o;if(i.win===e){if(!i.match)return!1;i.match=!1;try{i.match=S.util.getDomain(window)===S.util.getDomain(e)}catch(a){return}return i.match}}var u=!1;try{S.util.getDomain(window)===S.util.getDomain(e)&&(u=!0)}catch(a){}return m.push({win:e,match:u}),u}function i(e){try{return!e||e.closed||"undefined"==typeof e.closed||o(e)&&t(e,"mockclosed")}catch(n){return!0}}function a(e){if(e)try{return e.opener}catch(n){return}}function u(e){e=e||window;var n=a(e);return n?n:e.parent!==e?e.parent:void 0}function s(e){if(e===window)return h;for(var n=E.length-1;n>=0;n--){var r=E[n];try{if(r.win===e)return r.id}catch(t){continue}}}function c(e){if(e===window.name||e===h)return window;if(window.frames&&window.frames[e])return window.frames[e];for(var n=E.length-1;n>=0;n--){var r=E[n];try{if(r.id===e)return r.win}catch(t){continue}}}function d(e){if(e===window)return S.util.getDomain(window);for(var n=E.length-1;n>=0;n--){var r=E[n];try{if(r.win===e&&r.domain)return r.domain}catch(t){continue}}}function f(e,n,r){for(var t=E,o=Array.isArray(t),a=0,t=o?t:t[Symbol.iterator]();;){var u;if(o){if(a>=t.length)break;u=t[a++]}else{if(a=t.next(),a.done)break;u=a.value}var s=u;try{if(s.id===e&&s.win===n)return void(s.domain=r)}catch(c){continue}if(s.id===e&&s.win!==n&&!i(s.win))throw new Error("Can not register a duplicate window with name "+e)}E.push({id:e,win:n,domain:r})}function l(e,n){if(e===n)return!0;var r=s(e),t=s(n);return!(!r||!t||r!==t)}function w(e,n){try{return e.top===n.top}catch(r){return!1}}function p(e,n,r){var t=S.util.getDomainFromUrl(r);f(e,n,t),m.push({win:n,match:S.util.getDomain()===t})}Object.defineProperty(n,"__esModule",{value:!0}),n.isSameDomain=o,n.isWindowClosed=i,n.getOpener=a,n.getParentWindow=u,n.getWindowId=s,n.getWindowById=c,n.getWindowDomain=d,n.registerWindow=f,n.isWindowEqual=l,n.isSameTopWindow=w,n.linkUrl=p;var S=r(12),m=[],E=[],h=window.name||S.util.getType()+"_"+S.util.uniqueID(),g=window.open;window.open=function(e,n,r,t){n||(n=S.util.uniqueID(),arguments[1]=n);var o=S.util.apply(g,this,arguments);return e?p(n,o,e):f(n,o),o}},function(e,n,r){"use strict";function t(e){return e instanceof Object&&e.__type__===s.CONSTANTS.SERIALIZATION_TYPES.METHOD&&e.__id__}function o(e,n,r){var t=c.util.uniqueID();return w[t]={win:e,method:n},{__type__:s.CONSTANTS.SERIALIZATION_TYPES.METHOD,__id__:t,__name__:r}}function i(e,n){return p(),c.util.replaceObject({obj:n},function(n,r){return n instanceof Function?o(e,n,r):void 0}).obj}function a(e,n){function r(){var r=Array.prototype.slice.call(arguments);return f.log.debug("Call foreign method",n.__name__,r),(0,d.send)(e,s.CONSTANTS.POST_MESSAGE_NAMES.METHOD,{id:n.__id__,name:n.__name__,args:r}).then(function(e){return f.log.debug("Got foreign method result",n.__name__,e.result),e.result})}return r.__name__=n.__name__,r}function u(e,n){return c.util.replaceObject({obj:n},function(n,r){return t(n)?a(e,n):void 0}).obj}Object.defineProperty(n,"__esModule",{value:!0}),n.listenForMethods=void 0,n.serializeMethod=o,n.serializeMethods=i,n.deserializeMethod=a,n.deserializeMethods=u;var s=r(3),c=r(12),d=r(1),f=r(13),l=r(9),w={},p=n.listenForMethods=c.util.once(function(){(0,d.on)(s.CONSTANTS.POST_MESSAGE_NAMES.METHOD,function(e,n){if(!w[n.id])throw new Error("Could not find method with id: "+n.id);if(w[n.id].win!==e)throw new Error("Method window does not match");var r=w[n.id].method;return f.log.debug("Call local method",n.name,n.args),l.promise.run(function(){return r.apply(null,n.args)}).then(function(e){return{result:e,id:n.id,name:n.name}})})})},function(e,n,r){"use strict";function t(){(0,u.on)(i.CONSTANTS.POST_MESSAGE_NAMES.READY,function(e,n){for(var r=d,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.win===e)return void a.promise.resolve(e)}d.push({win:e,promise:(new c.SyncPromise).resolve(e)})});var e=(0,a.getParentWindow)();e&&(0,u.send)(e,i.CONSTANTS.POST_MESSAGE_NAMES.READY,{})["catch"](function(e){s.log.debug(e.stack||e.toString())})}function o(e){for(var n=arguments.length<=1||void 0===arguments[1]?5e3:arguments[1],r=arguments.length<=2||void 0===arguments[2]?"Window":arguments[2],t=d,o=Array.isArray(t),i=0,t=o?t:t[Symbol.iterator]();;){var a;if(o){if(i>=t.length)break;a=t[i++]}else{if(i=t.next(),i.done)break;a=i.value}var u=a;if(u.win===e)return u.promise}var s=new c.SyncPromise;return d.push({win:e,promise:s}),setTimeout(function(){return s.reject(new Error(r+" did not load after "+n+"ms"))},n),s}Object.defineProperty(n,"__esModule",{value:!0}),n.initOnReady=t,n.onWindowReady=o;var i=r(3),a=r(14),u=r(1),s=r(13),c=r(10),d=[]},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(18);Object.keys(t).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(19);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(20);Object.keys(i).forEach(function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})})},function(e,n,r){"use strict";function t(){return new w.promise.Promise(function(e){return window.document&&window.document.body?e(window.document):void window.document.addEventListener("DOMContentLoaded",function(n){return e(window.document)})})}function o(e){var n=arguments.length<=1||void 0===arguments[1]?E.LOCAL:arguments[1];return w.promise.run(function(){if(n===E.LOCAL&&S[e])return S[e];for(var r=m,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.domain===e&&a.zone===n)return a.bridge}}).then(function(e){return e&&n===E.LOCAL?(0,w.onWindowReady)(e):e})}function i(e){var n=arguments.length<=1||void 0===arguments[1]?E.LOCAL:arguments[1];return w.promise.run(function(){return(0,w.getOpener)(e)===window?(0,w.onWindowReady)(e):void 0}).then(function(){for(var r=m,t=Array.isArray(r),i=0,r=t?r:r[Symbol.iterator]();;){var a;if(t){if(i>=r.length)break;a=r[i++]}else{if(i=r.next(),i.done)break;a=i.value}var u=a;if(u.win===e&&u.zone===n)return u.bridge}var s=(0,w.getWindowDomain)(e);return s?o(s,n):void 0}).then(function(e){return e&&n===E.LOCAL?(0,w.onWindowReady)(e):e})}function a(e){return o(e,E.LOCAL)}function u(e){return i(e,E.LOCAL)}function s(e){return o(e,E.REMOTE)}function c(e){return w.promise.run(function(){return i(e,E.REMOTE)}).then(function(n){if(n)return n;try{if(!e||!e.frames||!e.frames.length)return;for(var r=0;r<e.frames.length;r++)try{var t=e.frames[r];if(t&&t!==window&&(0,w.isSameDomain)(t)&&t[l.CONSTANTS.WINDOW_PROPS.POSTROBOT])return t}catch(o){continue}}catch(o){return}})}function d(e,n){for(var r=void 0,t=m,o=Array.isArray(t),i=0,t=o?t:t[Symbol.iterator]();;){var a;if(o){if(i>=t.length)break;a=t[i++]}else{if(i=t.next(),i.done)break;a=i.value}var u=a;if(u.bridge===e){r=u;break}}if(!r){var s=w.util.isFrameOwnedBy(window,e)?E.LOCAL:E.REMOTE;r={bridge:e,domain:(0,w.getWindowDomain)(e),windows:[],zone:s},m.push(r)}n&&-1===r.windows.indexOf(n)&&r.windows.push(n)}function f(e,n){n=n||w.util.getDomainFromUrl(e);var r=w.promise.run(function(){return a(n)}).then(function(r){if(r)return r;if(w.util.getDomain()!==n){var o=p+"_"+w.util.uniqueID();w.log.debug("Opening bridge:",e);var i=document.createElement("iframe");return i.setAttribute("name",o),i.setAttribute("id",o),i.setAttribute("style","margin: 0; padding: 0; border: 0px none; overflow: hidden;"),i.setAttribute("frameborder","0"),i.setAttribute("border","0"),i.setAttribute("scrolling","no"),i.setAttribute("allowTransparency","true"),i.setAttribute("tabindex","-1"),i.setAttribute("hidden","true"),i.setAttribute("title",""),i.setAttribute("role","presentation"),i.src=e,t().then(function(r){r.body.appendChild(i);var t=i.contentWindow;return(0,w.registerWindow)(o,t,n),d(t),delete S[n],new w.promise.Promise(function(e,n){i.onload=e,i.onerror=n}).then(function(){return(0,w.onWindowReady)(t,5e3,"Bridge "+e)}).then(function(){return t})})}});return S[n]=r,r}Object.defineProperty(n,"__esModule",{value:!0}),n.getLocalBridgeForDomain=a,n.getLocalBridgeForWindow=u,n.getRemoteBridgeForDomain=s,n.getRemoteBridgeForWindow=c,n.registerBridge=d,n.openBridge=f;var l=r(3),w=r(8),p="__postrobot_bridge__",S={},m=[],E={LOCAL:"local",REMOTE:"remote"}},function(e,n,r){"use strict";function t(){if(window[o.CONSTANTS.WINDOW_PROPS.POSTROBOT])throw new Error("Attempting to load postRobot twice on the same window");window[o.CONSTANTS.WINDOW_PROPS.POSTROBOT]={postMessage:function(e){(0,i.receiveMessage)(e)}}}Object.defineProperty(n,"__esModule",{value:!0}),n.registerGlobals=t;var o=r(3),i=r(6)},function(e,n,r){"use strict";function t(e,n){if(!o.CONFIG.ALLOW_POSTMESSAGE_POPUP&&!(0,i.isSameTopWindow)(e,n))throw new Error("Can not send and receive post messages between two different windows (disabled to emulate IE)")}Object.defineProperty(n,"__esModule",{value:!0}),n.emulateIERestrictions=t;var o=r(3),i=r(8)},function(e,n,r){"use strict";function t(e,n){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],t=u.util.uniqueID(),o=(0,u.getWindowId)(window),a=u.util.getType(),s=(0,u.getWindowId)(e),c=u.util.getDomain(window);return i({},n,r,{id:n.id||t,source:o,originalSource:n.originalSource||o,sourceDomain:c,originalSourceDomain:n.sourceDomain||c,windowType:a,originalWindowType:n.originalWindowType||a,target:n.target||s})}function o(e,n,r,o){return u.promise.run(function(){n=t(e,n,{data:(0,u.serializeMethods)(e,n.data),domain:r});var i=void 0;if(i=-1!==a.POST_MESSAGE_NAMES_LIST.indexOf(n.name)||n.type===a.CONSTANTS.POST_MESSAGE_TYPE.ACK||o?"debug":"error"===n.ack?"error":"info",u.log.logLevel(i,[o?"#sendproxy":"#send",n.type,n.name,n]),a.CONFIG.MOCK_MODE)return delete n.target,window[a.CONSTANTS.WINDOW_PROPS.POSTROBOT].postMessage({origin:u.util.getDomain(window),source:window,data:JSON.stringify(n)});if(e===window)throw new Error("Attemping to send message to self");if((0,u.isWindowClosed)(e))throw new Error("Window is closed");u.log.debug("Running send message strategies",n);var c=[];return u.promise.map(u.util.keys(s.SEND_MESSAGE_STRATEGIES),function(t){return u.promise.run(function(){if(!a.CONFIG.ALLOWED_POST_MESSAGE_METHODS[t])throw new Error("Strategy disallowed: "+t);return s.SEND_MESSAGE_STRATEGIES[t](e,n,r)}).then(function(){return c.push(t+": success"),!0},function(e){return c.push(t+": "+e.message),!1})}).then(function(e){var r=u.util.some(e),t=n.type+" "+n.name+" "+(r?"success":"error")+":\n - "+c.join("\n - ")+"\n";if(u.log.debug(t),!r)throw new Error(t)})})}Object.defineProperty(n,"__esModule",{value:!0});var i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e};n.buildMessage=t,n.sendMessage=o;var a=r(3),u=r(8),s=r(22)},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}Object.defineProperty(n,"__esModule",{value:!0}),n.SEND_MESSAGE_STRATEGIES=void 0;var o,i=r(3),a=r(8),u=r(17);n.SEND_MESSAGE_STRATEGIES=(o={},t(o,i.CONSTANTS.SEND_STRATEGIES.POST_MESSAGE,function(e,n,r){return(0,u.emulateIERestrictions)(window,e),e.postMessage(JSON.stringify(n,0,2),r)}),t(o,i.CONSTANTS.SEND_STRATEGIES.GLOBAL_METHOD,function(e,n,r){if(!(0,a.isSameDomain)(e))throw new Error("Window is not on the same domain");if((0,a.isSameTopWindow)(window,e))throw new Error("Can only use global method to communicate between two different windows, not between frames");var t=a.util.getDomain(window),o=void 0;try{o=a.util.getDomain(e)}catch(u){throw new Error("Can not read target window domain: "+u.message)}if(t!==o)throw new Error("Can not send global message - source "+t+" does not match target "+o);if("*"!==r&&o!==r)throw new Error("Can post post through global method - specified domain "+r+" does not match target domain "+o);if(!a.util.safeHasProp(e,i.CONSTANTS.WINDOW_PROPS.POSTROBOT))throw new Error("post-robot not available on target window at "+o);e[i.CONSTANTS.WINDOW_PROPS.POSTROBOT].postMessage({origin:a.util.getDomain(window),source:window,data:JSON.stringify(n,0,2)})}),t(o,i.CONSTANTS.SEND_STRATEGIES.REMOTE_BRIDGE,function(e,n,r){if((0,a.isSameTopWindow)(window,e))throw new Error("Can only use bridge to communicate between two different windows, not between frames");return(0,u.getRemoteBridgeForWindow)(e).then(function(r){if(!r)throw new Error("No bridge available in window");var t=a.util.getDomain(window),o=void 0;try{o=a.util.getDomain(r)}catch(u){throw new Error("Can not read bridge window domain: "+u.message)}if(t!==o)throw new Error("Can not accept global message through bridge - source "+t+" does not match bridge "+o);if(!a.util.safeHasProp(r,i.CONSTANTS.WINDOW_PROPS.POSTROBOT))throw new Error("post-robot not available on bridge at "+o);
n.targetHint="window.parent",window===(0,a.getOpener)(e)&&(n.sourceHint="window.opener"),r[i.CONSTANTS.WINDOW_PROPS.POSTROBOT].postMessage({origin:a.util.getDomain(window),source:window,data:JSON.stringify(n,0,2)})})}),t(o,i.CONSTANTS.SEND_STRATEGIES.LOCAL_BRIDGE,function(e,n,r){if((0,a.isSameTopWindow)(window,e))throw new Error("Can only use bridge to communicate between two different windows, not between frames");if(e===(0,a.getOpener)(window)&&(n.targetHint="window.parent.opener"),!n.target&&!n.targetHint)throw new Error("Can not post message down through bridge without target or targetHint");var t=(0,a.getOpener)(e);return t&&window===t&&(n.sourceHint="window.opener"),t&&window===t.parent&&(n.sourceHint="window.opener.parent"),(0,u.getLocalBridgeForWindow)(e).then(function(t){if(!t)throw new Error("Bridge not initialized");if(e===t)throw new Error("Message target is bridge");t.postMessage(JSON.stringify(n,0,2),r)})}),o)},function(e,n,r){"use strict";function t(){n.listeners=s={request:[],response:{},proxies:[]}}function o(e,n){for(var r=s.request,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.name===e){if(!a.win)return a.options;if(n&&(0,u.isWindowEqual)(n,a.win))return a.options}}}function i(e){for(var n=void 0,r=s.request,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.options===e){n=a;break}}n&&s.request.splice(s.request.indexOf(n),1)}function a(e,n,r,t){var a=o(e,n);if(a){if(!t)throw new Error("Request listener already exists for "+e);i(a)}s.request.push({name:e,win:n,options:r})}Object.defineProperty(n,"__esModule",{value:!0}),n.listeners=void 0,n.resetListeners=t,n.getRequestListener=o,n.removeRequestListener=i,n.addRequestListener=a;var u=r(8),s=n.listeners=void 0;t()},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}Object.defineProperty(n,"__esModule",{value:!0}),n.RECEIVE_MESSAGE_TYPES=void 0;var o,i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},a=r(3),u=r(8),s=r(21),c=r(23);n.RECEIVE_MESSAGE_TYPES=(o={},t(o,a.CONSTANTS.POST_MESSAGE_TYPE.ACK,function(e,n,r){var t=c.listeners.response[n.hash];if(!t)throw new Error("No handler found for post message ack for message: "+n.name+" in "+window.location.href);t.ack=!0}),t(o,a.CONSTANTS.POST_MESSAGE_TYPE.REQUEST,function(e,n,r){function t(r){return n.fireAndForget||(0,u.isWindowClosed)(e)?u.promise.Promise.resolve():(0,s.sendMessage)(e,i({target:n.originalSource,hash:n.hash,name:n.name},r),"*")}var o=(0,c.getRequestListener)(n.name,e);return u.promise.Promise.all([t({type:a.CONSTANTS.POST_MESSAGE_TYPE.ACK}),u.promise.run(function(){if(!o)throw new Error("No postmessage request handler for "+n.name+" in "+window.location.href);if(o.domain){var t="string"==typeof o.domain&&r===o.domain||o.domain instanceof RegExp&&r.match(o.domain);if(!t)throw new Error("Message origin "+r+" does not match domain "+o.domain)}return u.promise.deNodeify(o.handler,e,n.data)}).then(function(e){return t({type:a.CONSTANTS.POST_MESSAGE_TYPE.RESPONSE,ack:a.CONSTANTS.POST_MESSAGE_ACK.SUCCESS,data:e})},function(e){return t({type:a.CONSTANTS.POST_MESSAGE_TYPE.RESPONSE,ack:a.CONSTANTS.POST_MESSAGE_ACK.ERROR,error:e.stack?e.message+"\n"+e.stack:e.toString()})})])["catch"](function(e){return o&&o.handleError?o.handleError(e):void u.log.error(e.stack||e.toString())})}),t(o,a.CONSTANTS.POST_MESSAGE_TYPE.RESPONSE,function(e,n,r){var t=c.listeners.response[n.hash];if(!t)throw new Error("No response handler found for post message response "+n.name+" in "+window.location.href);return delete c.listeners.response[n.hash],n.ack===a.CONSTANTS.POST_MESSAGE_ACK.ERROR?t.respond(new Error(n.error)):n.ack===a.CONSTANTS.POST_MESSAGE_ACK.SUCCESS?t.respond(null,n.data||n.response):void 0}),o)},function(e,n,r){"use strict";function t(e){if(!e.name)throw new Error("Expected options.name");e.handler=e.handler||u.util.noop,e.errorHandler=e.errorHandler||function(e){throw e},e.once&&!function(){var n=e.handler;e.handler=u.util.once(function(){return(0,s.removeRequestListener)(e),n.apply(this,arguments)})}();var n=e.override||a.CONFIG.MOCK_MODE;return(0,s.addRequestListener)(e.name,e.window,e,n),e.handleError=function(n){e.errorHandler(n)},e.window&&e.errorOnClose&&!function(){var n=u.util.safeInterval(function(){(0,u.isWindowClosed)(e.window)&&(n.cancel(),e.handleError(new Error("Post message target window is closed")))},50)}(),{cancel:function(){(0,s.removeRequestListener)(e)}}}function o(e,n,r,o){return n instanceof Function&&(o=r,r=n,n={}),n=n||{},n.name=e,n.handler=r||n.handler,n.errorHandler=o||n.errorHandler,t(n)}function i(e,n,r,o){n instanceof Function&&(o=r,r=n,n={}),n=n||{},n.name=e,n.handler=r||n.handler,n.errorHandler=o||n.errorHandler,n.once=!0;var i=new u.promise.Promise(function(e,r){n.handler=n.handler||function(n,r){return e(r)},n.errorHandler=n.errorHandler||r}),a=t(n);return u.util.extend(i,a),i}Object.defineProperty(n,"__esModule",{value:!0}),n.listen=t,n.on=o,n.once=i;var a=r(3),u=r(8),s=r(6)},function(e,n,r){"use strict";function t(e,n){i.listeners.proxies.push({from:e,to:n}),i.listeners.proxies.push({from:n,to:e})}function o(e,n){for(var r=[],t=0;t<i.listeners.proxies.length;t++){var o=i.listeners.proxies[t];(o.to===e&&o.from===n||o.to===n&&o.from===e)&&r.push(o)}for(var a=0;a<r.length;a++)i.listeners.proxies.splice(i.listeners.proxies.indexOf(r[a]),1)}Object.defineProperty(n,"__esModule",{value:!0}),n.proxy=t,n.unproxy=o;var i=r(6)},function(e,n,r){"use strict";function t(){a.CONFIG.MOCK_MODE=!0}function o(){a.CONFIG.MOCK_MODE=!1}function i(){delete window[a.CONSTANTS.WINDOW_PROPS.POSTROBOT],window.removeEventListener("message",u.messageListener)}Object.defineProperty(n,"__esModule",{value:!0}),n.CONSTANTS=n.CONFIG=void 0,n.enableMockMode=t,n.disableMockMode=o;var a=r(3);Object.defineProperty(n,"CONFIG",{enumerable:!0,get:function(){return a.CONFIG}}),Object.defineProperty(n,"CONSTANTS",{enumerable:!0,get:function(){return a.CONSTANTS}}),n.disable=i;var u=r(6)}])});
{
"name": "post-robot",
"version": "2.0.29",
"version": "2.0.30",
"description": "Simple postMessage based server.",

@@ -5,0 +5,0 @@ "main": "dist/post-robot.min.js",

import { CONFIG } from '../conf';
import { CONFIG, CONSTANTS } from '../conf';
import { messageListener } from '../drivers';

@@ -12,2 +13,7 @@ export function enableMockMode() {

export { CONFIG, CONSTANTS } from '../conf';
export { CONFIG, CONSTANTS } from '../conf';
export function disable() {
delete window[CONSTANTS.WINDOW_PROPS.POSTROBOT];
window.removeEventListener('message', messageListener);
}

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc