UNPKG

zoid

Version:
1 lines 83.5 kB
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("zoid",[],e):"object"==typeof exports?exports.zoid=e():n.zoid=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,e){return(t=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n})(n,e)}function o(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,t(n,e)}function i(){return(i=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 a(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}r.r(e),r.d(e,"PopupOpenError",(function(){return zn})),r.d(e,"create",(function(){return hr})),r.d(e,"destroy",(function(){return vr})),r.d(e,"destroyComponents",(function(){return wr})),r.d(e,"destroyAll",(function(){return pr})),r.d(e,"PROP_TYPE",(function(){return Ye})),r.d(e,"PROP_SERIALIZATION",(function(){return Ze})),r.d(e,"CONTEXT",(function(){return Ge})),r.d(e,"EVENT",(function(){return Ve}));var u,c=[],f=[],s=0;function d(){if(!s&&u){var n=u;u=null,n.resolve()}}function l(){s+=1}function h(){s-=1,d()}var w=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;l();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 h(),void this.reject(n)}h(),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(a(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(a(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===c.indexOf(n)){c.push(n),setTimeout((function(){throw n}),1);for(var r=0;r<f.length;r++)f[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.resolved,r=this.rejected,t=this.handlers;if(!this.dispatching&&(e||r)){this.dispatching=!0,l();for(var o=function(n,e){return n.then((function(n){e.resolve(n)}),(function(n){e.reject(n)}))},i=0;i<t.length;i++){var u=t[i],c=u.onSuccess,f=u.onError,s=u.promise,d=void 0;if(e)try{d=c?c(this.value):this.value}catch(n){s.reject(n);continue}else if(r){if(!f){s.reject(this.error);continue}try{d=f(this.error)}catch(n){s.reject(n);continue}}if(d instanceof n&&(d.resolved||d.rejected)){var w=d;w.resolved?s.resolve(w.value):s.reject(w.error),w.errorHandled=!0}else a(d)?d instanceof n&&(d.resolved||d.rejected)?d.resolved?s.resolve(d.value):s.reject(d.error):o(d,s):s.resolve(d)}t.length=0,this.dispatching=!1,h()}},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)},e.lazy=function(){return this.errorHandled=!0,this},n.resolve=function(e){return e instanceof n?e:a(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=[].slice();if(!t)return r.resolve(o),r;for(var i=function(n,e,i){return e.then((function(e){o[n]=e,0==(t-=1)&&r.resolve(o)}),(function(n){i.reject(n)}))},u=0;u<e.length;u++){var c=e[u];if(c instanceof n){if(c.resolved){o[u]=c.value,t-=1;continue}}else if(!a(c)){o[u]=c,t-=1;continue}i(u,n.resolve(c),r)}return 0===t&&r.resolve(o),r},n.hash=function(e){var r={},t=[],o=function(n){if(e.hasOwnProperty(n)){var o=e[n];a(o)?t.push(o.then((function(e){r[n]=e}))):r[n]=o}};for(var i in e)o(i);return n.all(t).then((function(){return r}))},n.map=function(e,r){return n.all(e.map(r))},n.onPossiblyUnhandledException=function(n){return function(n){return f.push(n),{cancel:function(){f.splice(f.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;l();try{o=e.apply(r,t||[])}catch(e){return h(),n.reject(e)}return h(),n.resolve(o)},n.delay=function(e){return new n((function(n){setTimeout(n,e)}))},n.isPromise=function(e){return!!(e&&e instanceof n)||a(e)},n.flush=function(){return e=u=u||new n,d(),e;var e},n}();function p(n){return"[object RegExp]"==={}.toString.call(n)}var v={IFRAME:"iframe",POPUP:"popup"},m="Call was rejected by callee.\r\n";function y(n){return void 0===n&&(n=window),n.location.protocol}function g(n){if(void 0===n&&(n=window),n.mockDomain){var e=n.mockDomain.split("//")[0];if(e)return e}return y(n)}function E(n){return void 0===n&&(n=window),"about:"===g(n)}function b(n){if(void 0===n&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function _(n){if(void 0===n&&(n=window),n&&!b(n))try{return n.opener}catch(n){}}function x(n){try{return!0}catch(n){}return!1}function P(n){void 0===n&&(n=window);var e=n.location;if(!e)throw new Error("Can not read window location");var r=y(n);if(!r)throw new Error("Can not read window protocol");if("file:"===r)return"file://";if("about:"===r){var t=b(n);return t&&x()?P(t):"about://"}var o=e.host;if(!o)throw new Error("Can not read window host");return r+"//"+o}function O(n){void 0===n&&(n=window);var e=P(n);return e&&n.mockDomain&&0===n.mockDomain.indexOf("mock:")?n.mockDomain:e}function C(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(E(n)&&x())return!0}catch(n){}try{if(function(n){return void 0===n&&(n=window),"mock:"===g(n)}(n)&&x())return!0}catch(n){}try{if(P(n)===P(window))return!0}catch(n){}return!1}(n))return!1;try{if(n===window)return!0;if(E(n)&&x())return!0;if(O(window)===O(n))return!0}catch(n){}return!1}function S(n){if(!C(n))throw new Error("Expected window to be same domain");return n}function W(n,e){if(!n||!e)return!1;var r=b(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 D(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 N(n){for(var e=[],r=0,t=D(n);r<t.length;r++){var o=t[r];e.push(o);for(var i=0,a=N(o);i<a.length;i++)e.push(a[i])}return e}function j(n){void 0===n&&(n=window);try{if(n.top)return n.top}catch(n){}if(b(n)===n)return n;try{if(W(window,n)&&window.top)return window.top}catch(n){}try{if(W(n,window)&&window.top)return window.top}catch(n){}for(var e=0,r=N(n);e<r.length;e++){var t=r[e];try{if(t.top)return t.top}catch(n){}if(b(t)===t)return t}}function R(n){var e=j(n);if(!e)throw new Error("Can not determine top window");var r=[].concat(N(e),[e]);return-1===r.indexOf(n)&&(r=[].concat(r,[n],N(n))),r}var T=[],A=[];function I(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!==m}if(e&&C(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}(T,n);if(-1!==r){var t=A[r];if(t&&function(n){if(!n.contentWindow)return!0;if(!n.parentNode)return!0;var e=n.ownerDocument;if(e&&e.documentElement&&!e.documentElement.contains(n)){for(var r=n;r.parentNode&&r.parentNode!==r;)r=r.parentNode;if(!r.host||!e.documentElement.contains(r.host))return!0}return!1}(t))return!0}return!1}function z(n,e){for(var r=D(n),t=0;t<r.length;t++){var o=r[t];try{if(C(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 k(n){return void 0===n&&(n=window),_(n=n||window)||b(n)||void 0}function F(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 M(n){void 0===n&&(n=window);for(var e=0,r=n;r;)(r=b(r))&&(e+=1);return e}function U(n,e){var r=j(n)||n,t=j(e)||e;try{if(r&&t)return r===t}catch(n){}var o=R(n),i=R(e);if(F(o,i))return!0;var a=_(r),u=_(t);return a&&F(R(a),i)||u&&F(R(u),o),!1}function L(n,e){if("string"==typeof n){if("string"==typeof e)return"*"===n||e===n;if(p(e))return!1;if(Array.isArray(e))return!1}return p(n)?p(e)?n.toString()===e.toString():!Array.isArray(e)&&Boolean(e.match(n)):!!Array.isArray(n)&&(Array.isArray(e)?JSON.stringify(n)===JSON.stringify(e):!p(e)&&n.some((function(n){return L(n,e)})))}function q(n){return n.match(/^(https?|mock|file):\/\//)?n.split("/").slice(0,3).join("/"):O()}function B(n,e,r,t){var o;return void 0===r&&(r=1e3),void 0===t&&(t=1/0),function i(){if(I(n))return o&&clearTimeout(o),e();t<=0?clearTimeout(o):(t-=r,o=setTimeout(i,r))}(),{cancel:function(){o&&clearTimeout(o)}}}function J(n){try{if(n===window)return!0}catch(n){if(n&&n.message===m)return!0}try{if("[object Window]"==={}.toString.call(n))return!0}catch(n){if(n&&n.message===m)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===m)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===m)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===m)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===m)return!0}try{if(n&&"__unlikely_value__"===n.__cross_domain_utils_window_check__)return!1}catch(n){return!0}try{if("postMessage"in n&&"self"in n&&"location"in n)return!0}catch(n){}return!1}function H(n){if(C(n))return S(n).frameElement;for(var e=0,r=document.querySelectorAll("iframe");e<r.length;e++){var t=r[e];if(t&&t.contentWindow&&t.contentWindow===n)return t}}function Y(n){if(function(n){return void 0===n&&(n=window),Boolean(b(n))}(n)){var e=H(n);if(e&&e.parentElement)return void e.parentElement.removeChild(e)}try{n.close()}catch(n){}}function Z(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}var G,V=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(J(t)&&I(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!J(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=Z(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=Z(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=Z(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!==Z(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 $(n){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)})(n)}function X(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(n){return!1}}function K(n,e,r){return(K=X()?Reflect.construct:function(n,e,r){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(n,o));return r&&t(i,r.prototype),i}).apply(null,arguments)}function Q(n){var e="function"==typeof Map?new Map:void 0;return(Q=function(n){if(null===n||-1===Function.toString.call(n).indexOf("[native code]"))return n;if("function"!=typeof n)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return K(n,arguments,$(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),t(r,n)})(n)}function nn(n){return n.name||n.__name__||n.displayName||"anonymous"}function en(n,e){try{delete n.name,n.name=e}catch(n){}return n.__name__=n.displayName=e,n}function rn(n){if("function"==typeof btoa)return btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(function(n,e){return String.fromCharCode(parseInt(e,16))}))).replace(/[=]/g,"");if("undefined"!=typeof Buffer)return Buffer.from(n,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}function tn(){var n="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,(function(){return n.charAt(Math.floor(Math.random()*n.length))}))+"_"+rn((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function on(n){try{return JSON.stringify([].slice.call(n),(function(n,e){return"function"==typeof e?"memoize["+function(n){if(G=G||new V,null==n||"object"!=typeof n&&"function"!=typeof n)throw new Error("Invalid object");var e=G.get(n);return e||(e=typeof n+":"+tn(),G.set(n,e)),e}(e)+"]":e}))}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}function an(){return{}}var un=0,cn=0;function fn(n,e){void 0===e&&(e={});var r,t,o=e.thisNamespace,i=void 0!==o&&o,a=e.time,u=un;un+=1;var c=function(){for(var e=arguments.length,o=new Array(e),c=0;c<e;c++)o[c]=arguments[c];var f;u<cn&&(r=null,t=null,u=un,un+=1),f=i?(t=t||new V).getOrSet(this,an):r=r||{};var s=on(o),d=f[s];if(d&&a&&Date.now()-d.time<a&&(delete f[s],d=null),d)return d.value;var l=Date.now(),h=n.apply(this,arguments);return f[s]={time:l,value:h},h};return c.reset=function(){r=null,t=null},en(c,(e.name||nn(n))+"::memoized")}function sn(n){var e={};function r(){for(var r=arguments,t=this,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];var u=on(i);return e.hasOwnProperty(u)||(e[u]=w.try((function(){return n.apply(t,r)})).finally((function(){delete e[u]}))),e[u]}return r.reset=function(){e={}},en(r,nn(n)+"::promiseMemoized")}function dn(){}function ln(n){var e=!1;return en((function(){if(!e)return e=!0,n.apply(this,arguments)}),nn(n)+"::once")}function hn(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: "+hn(n,e+1)}}function wn(n){return"string"==typeof n?n:n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}function pn(n,e){if(!e)return n;if(Object.assign)return Object.assign(n,e);for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return n}function vn(n){return n}function mn(n,e){var r;return function t(){r=setTimeout((function(){n(),t()}),e)}(),{cancel:function(){clearTimeout(r)}}}function yn(n){return[].slice.call(n)}function gn(n){return null!=n}function En(n){return"[object RegExp]"==={}.toString.call(n)}function bn(n,e,r){if(n.hasOwnProperty(e))return n[e];var t=r();return n[e]=t,t}function _n(n){var e,r=[],t=!1,o={set:function(e,r){return t||(n[e]=r,o.register((function(){delete n[e]}))),r},register:function(n){var o=ln((function(){return n(e)}));return t?n(e):r.push(o),{cancel:function(){var n=r.indexOf(o);-1!==n&&r.splice(n,1)}}},all:function(n){e=n;var o=[];for(t=!0;r.length;){var i=r.shift();o.push(i())}return w.all(o).then(dn)}};return o}function xn(n,e){if(null==e)throw new Error("Expected "+n+" to be present");return e}fn.clear=function(){cn=un},fn((function(n){if(Object.values)return Object.values(n);var e=[];for(var r in n)n.hasOwnProperty(r)&&e.push(n[r]);return e}));var Pn=function(n){function e(e){var r;return(r=n.call(this,e)||this).name=r.constructor.name,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(r),r.constructor):r.stack=new Error(e).stack,r}return o(e,n),e}(Q(Error));function On(){var n=document.body;if(!n)throw new Error("Body element not found");return n}function Cn(){return Boolean(document.body)&&"complete"===document.readyState}function Sn(){return Boolean(document.body)&&"interactive"===document.readyState}function Wn(n){return encodeURIComponent(n)}function Dn(n){return function(e,r,t){void 0===t&&(t=[]);var o=e.__inline_memoize_cache__=e.__inline_memoize_cache__||{},i=on(t);return o.hasOwnProperty(i)?o[i]:o[i]=function(){var e={};if(!n)return e;if(-1===n.indexOf("="))return e;for(var r=0,t=n.split("&");r<t.length;r++){var o=t[r];(o=o.split("="))[0]&&o[1]&&(e[decodeURIComponent(o[0])]=decodeURIComponent(o[1]))}return e}.apply(void 0,t)}(Dn,0,[n])}function Nn(n,e){return void 0===e&&(e={}),e&&Object.keys(e).length?(void 0===(r=i({},Dn(n),e))&&(r={}),Object.keys(r).filter((function(n){return"string"==typeof r[n]||"boolean"==typeof r[n]})).map((function(n){var e=r[n];if("string"!=typeof e&&"boolean"!=typeof e)throw new TypeError("Invalid type for query");return Wn(n)+"="+Wn(e.toString())})).join("&")):n;var r}function jn(n,e){n.appendChild(e)}function Rn(n){return n instanceof window.Element||null!==n&&"object"==typeof n&&1===n.nodeType&&"object"==typeof n.style&&"object"==typeof n.ownerDocument}function Tn(n,e){return void 0===e&&(e=document),Rn(n)?n:"string"==typeof n?e.querySelector(n):void 0}function An(n){return new w((function(e,r){var t=wn(n),o=Tn(n);if(o)return e(o);if(Cn())return r(new Error("Document is ready and element "+t+" does not exist"));var i=setInterval((function(){return(o=Tn(n))?(e(o),void clearInterval(i)):Cn()?(clearInterval(i),r(new Error("Document is ready and element "+t+" does not exist"))):void 0}),10)}))}fn((function(){return new w((function(n){if(Cn()||Sn())return n();var e=setInterval((function(){if(Cn()||Sn())return clearInterval(e),n()}),10)}))}));var In,zn=function(n){function e(){return n.apply(this,arguments)||this}return o(e,n),e}(Pn);function kn(n){if((In=In||new V).has(n)){var e=In.get(n);if(e)return e}var r=new w((function(e,r){n.addEventListener("load",(function(){(function(n){if(function(){for(var n=0;n<T.length;n++){var e=!1;try{e=T[n].closed}catch(n){}e&&(A.splice(n,1),T.splice(n,1))}}(),n&&n.contentWindow)try{T.push(n.contentWindow),A.push(n)}catch(n){}})(n),e(n)})),n.addEventListener("error",(function(t){n.contentWindow?e(n):r(t)}))}));return In.set(n,r),r}function Fn(n){return kn(n).then((function(n){if(!n.contentWindow)throw new Error("Could not find window in iframe");return n.contentWindow}))}function Mn(n,e){void 0===n&&(n={});var r=n.style||{},t=function(n,e,r){void 0===n&&(n="div"),void 0===e&&(e={}),n=n.toLowerCase();var t,o,i,a=document.createElement(n);if(e.style&&pn(a.style,e.style),e.class&&(a.className=e.class.join(" ")),e.id&&a.setAttribute("id",e.id),e.attributes)for(var u=0,c=Object.keys(e.attributes);u<c.length;u++){var f=c[u];a.setAttribute(f,e.attributes[f])}if(e.styleSheet&&(t=a,o=e.styleSheet,void 0===i&&(i=window.document),t.styleSheet?t.styleSheet.cssText=o:t.appendChild(i.createTextNode(o))),e.html){if("iframe"===n)throw new Error("Iframe html can not be written unless container provided and iframe in DOM");a.innerHTML=e.html}return a}("iframe",{attributes:i({allowTransparency:"true"},n.attributes||{}),style:i({backgroundColor:"transparent",border:"none"},r),html:n.html,class:n.class}),o=window.navigator.userAgent.match(/MSIE|Edge/i);return t.hasAttribute("id")||t.setAttribute("id",tn()),kn(t),e&&function(n,e){void 0===e&&(e=document);var r=Tn(n,e);if(r)return r;throw new Error("Can not find element: "+wn(n))}(e).appendChild(t),(n.url||o)&&t.setAttribute("src",n.url||"about:blank"),t}function Un(n,e,r){return n.addEventListener(e,r),{cancel:function(){n.removeEventListener(e,r)}}}function Ln(n){n.style.setProperty("display","")}function qn(n){n.style.setProperty("display","none","important")}function Bn(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function Jn(n){return!(n&&n.parentNode&&n.ownerDocument&&n.ownerDocument.documentElement&&n.ownerDocument.documentElement.contains(n))}function Hn(n,e,r){var t=void 0===r?{}:r,o=t.width,i=void 0===o||o,a=t.height,u=void 0===a||a,c=t.interval,f=void 0===c?100:c,s=t.win,d=void 0===s?window:s,l=n.offsetWidth,h=n.offsetHeight,w=!1;e({width:l,height:h});var p,v,m=function(){if(!w&&function(n){return Boolean(n.offsetWidth||n.offsetHeight||n.getClientRects().length)}(n)){var r=n.offsetWidth,t=n.offsetHeight;(i&&r!==l||u&&t!==h)&&e({width:r,height:t}),l=r,h=t}};return d.addEventListener("resize",m),void 0!==d.ResizeObserver?((p=new d.ResizeObserver(m)).observe(n),v=mn(m,10*f)):void 0!==d.MutationObserver?((p=new d.MutationObserver(m)).observe(n,{attributes:!0,childList:!0,subtree:!0,characterData:!1}),v=mn(m,10*f)):v=mn(m,f),{cancel:function(){w=!0,p.disconnect(),window.removeEventListener("resize",m),v.cancel()}}}function Yn(n){for(;n.parentNode;)n=n.parentNode;return"[object ShadowRoot]"===n.toString()}var Zn="undefined"!=typeof document?document.currentScript:null,Gn=fn((function(){if(Zn)return Zn;if(Zn=function(){try{var n=function(){try{throw new Error("_")}catch(n){return n.stack||""}}(),e=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(n),r=e&&e[1];if(!r)return;for(var t=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();t<o.length;t++){var i=o[t];if(i.src&&i.src===r)return i}}catch(n){}}())return Zn;throw new Error("Can not determine current script")})),Vn=tn();function $n(n){return function(n){if("number"==typeof n)return n;var e=n.match(/^([0-9]+)(px|%)$/);if(!e)throw new Error("Could not match css value from "+n);return parseInt(e[1],10)}(n)+"px"}function Xn(n){return"number"==typeof n?$n(n):"string"==typeof(e=n)&&/^[0-9]+%$/.test(e)?n:$n(n);var e}function Kn(n){void 0===n&&(n=window);var e="__post_robot_10_0_44__";return n!==window?n[e]:n[e]=n[e]||{}}fn((function(){var n;try{n=Gn()}catch(n){return Vn}var e=n.getAttribute("data-uid");if(e&&"string"==typeof e)return e;if((e=n.getAttribute("data-uid-auto"))&&"string"==typeof e)return e;if(n.src){var r=function(n){for(var e="",r=0;r<n.length;r++){var t=n[r].charCodeAt(0)*r;n[r+1]&&(t+=n[r+1].charCodeAt(0)*(r-1)),e+=String.fromCharCode(97+Math.abs(t)%26)}return e}(JSON.stringify({src:n.src,dataset:n.dataset}));e="uid_"+r.slice(r.length-30)}else e=tn();return n.setAttribute("data-uid-auto",e),e}));var Qn=function(){return{}};function ne(n,e){return void 0===n&&(n="store"),void 0===e&&(e=Qn),bn(Kn(),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 bn(n,e,r)},reset:function(){n=e()},keys:function(){return Object.keys(n)}}}))}var ee,re=function(){};function te(){var n=Kn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new re,n.WINDOW_WILDCARD}function oe(n,e){return void 0===n&&(n="store"),void 0===e&&(e=Qn),ne("windowStore").getOrSet(n,(function(){var r=new V,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 bn(t(e),n,r)}}}))}function ie(){return ne("instance").getOrSet("instanceID",tn)}function ae(n,e){var r=e.domain,t=oe("helloPromises"),o=t.get(n);o&&o.resolve({domain:r});var i=w.resolve({domain:r});return t.set(n,i),i}function ue(n,e){return(0,e.send)(n,"postrobot_hello",{instanceID:ie()},{domain:"*",timeout:-1}).then((function(e){var r=e.origin,t=e.data.instanceID;return ae(n,{domain:r}),{win:n,domain:r,instanceID:t}}))}function ce(n,e){var r=e.send;return oe("windowInstanceIDPromises").getOrSet(n,(function(){return ue(n,{send:r}).then((function(n){return n.instanceID}))}))}function fe(n){oe("knownWindows").set(n,!0)}function se(n){return"object"==typeof n&&null!==n&&"string"==typeof n.__type__}function de(n){return void 0===n?"undefined":null===n?"null":Array.isArray(n)?"array":"function"==typeof n?"function":"object"==typeof n?n instanceof Error?"error":"function"==typeof n.then?"promise":"[object RegExp]"==={}.toString.call(n)?"regex":"[object Date]"==={}.toString.call(n)?"date":"object":"string"==typeof n?"string":"number"==typeof n?"number":"boolean"==typeof n?"boolean":void 0}function le(n,e){return{__type__:n,__val__:e}}var he,we=((ee={}).function=function(){},ee.error=function(n){return le("error",{message:n.message,stack:n.stack,code:n.code,data:n.data})},ee.promise=function(){},ee.regex=function(n){return le("regex",n.source)},ee.date=function(n){return le("date",n.toJSON())},ee.array=function(n){return n},ee.object=function(n){return n},ee.string=function(n){return n},ee.number=function(n){return n},ee.boolean=function(n){return n},ee.null=function(n){return n},ee[void 0]=function(n){return le("undefined",n)},ee),pe={},ve=((he={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},he.error=function(n){var e=n.stack,r=n.code,t=n.data,o=new Error(n.message);return o.code=r,t&&(o.data=t),o.stack=e+"\n\n"+o.stack,o},he.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},he.regex=function(n){return new RegExp(n)},he.date=function(n){return new Date(n)},he.array=function(n){return n},he.object=function(n){return n},he.string=function(n){return n},he.number=function(n){return n},he.boolean=function(n){return n},he.null=function(n){return n},he[void 0]=function(){},he),me={};function ye(){for(var n=ne("idToProxyWindow"),e=0,r=n.keys();e<r.length;e++){var t=r[e];n.get(t).shouldClean()&&n.del(t)}}function ge(n,e){var r=e.send,t=e.id,o=void 0===t?tn():t,i=n.then((function(n){if(C(n))return S(n).name})),a=n.then((function(n){if(I(n))throw new Error("Window is closed, can not determine type");return _(n)?v.POPUP:v.IFRAME}));i.catch(dn),a.catch(dn);var u=function(){return n.then((function(n){if(!I(n))return C(n)?S(n).name:i}))};return{id:o,getType:function(){return a},getInstanceID:sn((function(){return n.then((function(n){return ce(n,{send:r})}))})),close:function(){return n.then(Y)},getName:u,focus:function(){return n.then((function(n){n.focus()}))},isClosed:function(){return n.then((function(n){return I(n)}))},setLocation:function(e,r){return void 0===r&&(r={}),n.then((function(n){var t=window.location.protocol+"//"+window.location.host,o=r.method,i=void 0===o?"get":o,a=r.body;if(0===e.indexOf("/"))e=""+t+e;else if(!e.match(/^https?:\/\//)&&0!==e.indexOf(t))throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(e));if("post"===i)return u().then((function(n){if(!n)throw new Error("Can not post to window without target name");!function(n){var e=n.url,r=n.target,t=n.body,o=n.method,i=void 0===o?"post":o,a=document.createElement("form");if(a.setAttribute("target",r),a.setAttribute("method",i),a.setAttribute("action",e),a.style.display="none",t)for(var u=0,c=Object.keys(t);u<c.length;u++){var f,s=c[u],d=document.createElement("input");d.setAttribute("name",s),d.setAttribute("value",null==(f=t[s])?void 0:f.toString()),a.appendChild(d)}On().appendChild(a),a.submit(),On().removeChild(a)}({url:e,target:n,method:i,body:a})}));if("get"!==i)throw new Error("Unsupported method: "+i);if(C(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 r=C(n),t=H(n);if(!r)throw new Error("Can not set name for cross-domain window: "+e);S(n).name=e,t&&t.setAttribute("name",e),i=w.resolve(e)}))}}}new w((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 Ee=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 w,this.serializedWindow=t||ge(this.actualWindowPromise,{send:e}),ne("idToProxyWindow").set(this.getID(),this),r&&this.setWindow(r,{send:e})}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().then((function(n){return n===v.POPUP}))},e.setLocation=function(n,e){var r=this;return this.serializedWindow.setLocation(n,e).then((function(){return r}))},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,e=this.isPopup(),r=this.getName(),t=w.hash({isPopup:e,name:r}).then((function(n){var e=n.name;n.isPopup&&e&&window.open("",e)})),o=this.serializedWindow.focus();return w.all([t,o]).then((function(){return n}))},e.isClosed=function(){return this.serializedWindow.isClosed()},e.getWindow=function(){return this.actualWindow},e.setWindow=function(n,e){var r=e.send;this.actualWindow=n,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=ge(this.actualWindowPromise,{send:r,id:this.getID()}),oe("winToProxyWindow").set(n,this)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(n,e){var r=this,t=e.send;return w.try((function(){return r.actualWindow?n===r.actualWindow:w.hash({proxyInstanceID:r.getInstanceID(),knownWindowInstanceID:ce(n,{send:t})}).then((function(e){var o=e.proxyInstanceID===e.knownWindowInstanceID;return o&&r.setWindow(n,{send:t}),o}))}))},e.unwrap=function(){return this.actualWindow||this},e.getInstanceID=function(){return this.serializedWindow.getInstanceID()},e.shouldClean=function(){return Boolean(this.actualWindow&&I(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 ye(),n.toProxyWindow(e,{send:t}).serialize()},n.deserialize=function(e,r){var t=r.send;return ye(),ne("idToProxyWindow").get(e.id)||new n({serializedWindow:e,send:t})},n.isProxyWindow=function(n){return Boolean(n&&!J(n)&&n.isProxyWindow)},n.toProxyWindow=function(e,r){var t=r.send;if(ye(),n.isProxyWindow(e))return e;var o=e;return oe("winToProxyWindow").get(o)||new n({win:o,send:t})},n}();function be(n,e,r,t,o){var i=oe("methodStore"),a=ne("proxyWindowMethods");Ee.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 _e(n,e){var r=oe("methodStore"),t=ne("proxyWindowMethods");return r.getOrSet(n,(function(){return{}}))[e]||t.get(e)}function xe(n,e,r,t,o){var i,a,u;a=(i={on:o.on,send:o.send}).on,u=i.send,ne("builtinListeners").getOrSet("functionCalls",(function(){return a("postrobot_method",{domain:"*"},(function(n){var e=n.source,r=n.origin,t=n.data,o=t.id,i=t.name,a=_e(e,o);if(!a)throw new Error("Could not find method '"+i+"' with id: "+t.id+" in "+O(window));var c=a.source,f=a.domain,s=a.val;return w.try((function(){if(!L(f,r))throw new Error("Method '"+t.name+"' domain "+JSON.stringify(En(a.domain)?a.domain.source:a.domain)+" does not match origin "+r+" in "+O(window));if(Ee.isProxyWindow(c))return c.matchWindow(e,{send:u}).then((function(n){if(!n)throw new Error("Method call '"+t.name+"' failed - proxy window does not match source in "+O(window))}))})).then((function(){return s.apply({source:e,origin:r},t.args)}),(function(n){return w.try((function(){if(s.onError)return s.onError(n)})).then((function(){var e;throw n.stack&&(n.stack="Remote call to "+i+"("+(void 0===(e=t.args)&&(e=[]),yn(e).map((function(n){return"string"==typeof n?"'"+n+"'":void 0===n?"undefined":null===n?"null":"boolean"==typeof n?n.toString():Array.isArray(n)?"[ ... ]":"object"==typeof n?"{ ... }":"function"==typeof n?"() => { ... }":"<"+typeof n+">"})).join(", ")+") failed\n\n")+n.stack),n}))})).then((function(n){return{result:n,id:o,name:i}}))}))}));var c=r.__id__||tn();n=Ee.unwrap(n);var f=r.__name__||r.name||t;return"string"==typeof f&&"function"==typeof f.indexOf&&0===f.indexOf("anonymous::")&&(f=f.replace("anonymous::",t+"::")),Ee.isProxyWindow(n)?(be(c,r,f,n,e),n.awaitWindow().then((function(n){be(c,r,f,n,e)}))):be(c,r,f,n,e),le("cross_domain_function",{id:c,name:f})}function Pe(n,e,r,t){var o,i=t.on,a=t.send;return function(n,e){void 0===e&&(e=pe);var r=JSON.stringify(n,(function(n){var r=this[n];if(se(this))return r;var t=de(r);if(!t)return r;var o=e[t]||we[t];return o?o(r,n):r}));return void 0===r?"undefined":r}(r,((o={}).promise=function(r,t){return function(n,e,r,t,o){return le("cross_domain_zalgo_promise",{then:xe(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.function=function(r,t){return xe(n,e,r,t,{on:i,send:a})},o.object=function(n){return J(n)||Ee.isProxyWindow(n)?le("cross_domain_window",Ee.serialize(n,{send:a})):n},o))}function Oe(n,e,r,t){var o,i=t.send;return function(n,e){if(void 0===e&&(e=me),"undefined"!==n)return JSON.parse(n,(function(n,r){if(se(this))return r;var t,o;if(se(r)?(t=r.__type__,o=r.__val__):(t=de(r),o=r),!t)return o;var i=e[t]||ve[t];return i?i(o,n):o}))}(r,((o={}).cross_domain_zalgo_promise=function(n){return function(n,e,r){return new w(r.then)}(0,0,n)},o.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 Ee.toProxyWindow(n,{send:a}).awaitWindow().then((function(n){var c=_e(n,o);if(c&&c.val!==t)return c.val.apply({source:window,origin:O()},u);var f=[].slice.call(u);return r.fireAndForget?a(n,"postrobot_method",{id:o,name:i,args:f},{domain:e,fireAndForget:!0}):a(n,"postrobot_method",{id:o,name:i,args:f},{domain:e,fireAndForget:!1}).then((function(n){return n.data.result}))})).catch((function(n){throw n}))}return void 0===r&&(r={}),t.__name__=i,t.__origin__=e,t.__source__=n,t.__id__=o,t.origin=e,t},c=u();return c.fireAndForget=u({fireAndForget:!0}),c}(n,e,r,{send:i})},o.cross_domain_window=function(n){return Ee.deserialize(n,{send:i})},o))}var Ce={};function Se(n,e,r,t){var o=t.on,i=t.send;return w.try((function(){var t=oe().getOrSet(n,(function(){return{}}));return t.buffer=t.buffer||[],t.buffer.push(r),t.flush=t.flush||w.flush().then((function(){if(I(n))throw new Error("Window is closed");var r,a=Pe(n,e,((r={}).__post_robot_10_0_44__=t.buffer||[],r),{on:o,send:i});delete t.buffer;for(var u=Object.keys(Ce),c=[],f=0;f<u.length;f++){var s=u[f];try{Ce[s](n,a,e)}catch(n){c.push(n)}}if(c.length===u.length)throw new Error("All post-robot messaging strategies failed:\n\n"+c.map((function(n,e){return e+". "+hn(n)})).join("\n\n"))})),t.flush.then((function(){delete t.flush}))})).then(dn)}function We(n){return ne("responseListeners").get(n)}function De(n){ne("responseListeners").del(n)}function Ne(n){return ne("erroredResponseListeners").has(n)}function je(n){var e=n.name,r=n.win,t=n.domain,o=oe("requestListeners");if("*"===r&&(r=null),"*"===t&&(t=null),!e)throw new Error("Name required to get request listener");for(var i=0,a=[r,te()];i<a.length;i++){var u=a[i];if(u){var c=o.get(u);if(c){var f=c[e];if(f){if(t&&"string"==typeof t){if(f[t])return f[t];if(f.__domain_regex__)for(var s=0,d=f.__domain_regex__;s<d.length;s++){var l=d[s],h=l.listener;if(L(l.regex,t))return h}}if(f["*"])return f["*"]}}}}}function Re(n,e,r,t){var o=t.on,i=t.send,a=je({name:r.name,win:n,domain:e}),u="postrobot_method"===r.name&&r.data&&"string"==typeof r.data.name?r.data.name+"()":r.name;function c(t,a,c){return w.flush().then((function(){if(!r.fireAndForget&&!I(n))try{return Se(n,e,{id:tn(),origin:O(window),type:"postrobot_message_response",hash:r.hash,name:r.name,ack:t,data:a,error:c},{on:o,send:i})}catch(n){throw new Error("Send response message failed for "+u+" in "+O()+"\n\n"+hn(n))}}))}return w.all([w.flush().then((function(){if(!r.fireAndForget&&!I(n))try{return Se(n,e,{id:tn(),origin:O(window),type:"postrobot_message_ack",hash:r.hash,name:r.name},{on:o,send:i})}catch(n){throw new Error("Send ack message failed for "+u+" in "+O()+"\n\n"+hn(n))}})),w.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(!L(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 c("success",n)}),(function(n){return c("error",null,n)}))]).then(dn).catch((function(n){if(a&&a.handleError)return a.handleError(n);throw n}))}function Te(n,e,r){if(!Ne(r.hash)){var t=We(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);try{if(!L(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")}catch(n){t.promise.reject(n)}t.ack=!0}}function Ae(n,e,r){if(!Ne(r.hash)){var t,o=We(r.hash);if(!o)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(!L(o.domain,e))throw new Error("Response origin "+e+" does not match domain "+(t=o.domain,Array.isArray(t)?"("+t.join(" | ")+")":p(t)?"RegExp("+t.toString()+")":t.toString()));if(n!==o.win)throw new Error("Response source does not match registered window");De(r.hash),"error"===r.ack?o.promise.reject(r.error):"success"===r.ack&&o.promise.resolve({source:n,origin:e,data:r.data})}}function Ie(n,e){var r=e.on,t=e.send,o=ne("receivedMessages");try{if(!window||window.closed||!n.source)return}catch(n){return}var i=n.source,a=n.origin,u=function(n,e,r,t){var o,i=t.on,a=t.send;try{o=Oe(e,r,n,{on:i,send:a})}catch(n){return}if(o&&"object"==typeof o&&null!==o){var u=o.__post_robot_10_0_44__;if(Array.isArray(u))return u}}(n.data,i,a,{on:r,send:t});if(u){fe(i);for(var c=0;c<u.length;c++){var f=u[c];if(o.has(f.id))return;if(o.set(f.id,!0),I(i)&&!f.fireAndForget)return;0===f.origin.indexOf("file:")&&(a="file://");try{"postrobot_message_request"===f.type?Re(i,a,f,{on:r,send:t}):"postrobot_message_response"===f.type?Ae(i,a,f):"postrobot_message_ack"===f.type&&Te(i,a,f)}catch(n){setTimeout((function(){throw n}),0)}}}}function ze(n,e,r){if(!n)throw new Error("Expected name");if("function"==typeof(e=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=oe("requestListeners");if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var u=[],c=0,f=o;c<f.length;c++)u.push(n({name:t,domain:i,win:f[c]},r));return{cancel:function(){for(var n=0;n<u.length;n++)u[n].cancel()}}}if(Array.isArray(i)){for(var s=[],d=0,l=i;d<l.length;d++)s.push(n({name:t,win:o,domain:l[d]},r));return{cancel:function(){for(var n=0;n<s.length;n++)s[n].cancel()}}}var h=je({name:t,win:o,domain:i});if(o&&"*"!==o||(o=te()),i=i||"*",h)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===te()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===te()?"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=a.getOrSet(o,(function(){return{}})),m=bn(v,t,(function(){return{}})),y=i.toString();return En(i)?(w=bn(m,"__domain_regex__",(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.__domain_regex__),Object.keys(m).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||"*",name:n});return{cancel:function(){i.cancel()}}}Ce.postrobot_post_message=function(n,e,r){0===r.indexOf("file:")&&(r="*"),n.postMessage(e,r)},Ce.postrobot_global=function(n,e){if(!function(n){return(n=n||window).navigator.mockUserAgent||n.navigator.userAgent}(window).match(/MSIE|rv:11|trident|edge\/12|edge\/13/i))throw new Error("Global messaging not needed for browser");if(!C(n))throw new Error("Post message through global disabled between different domain windows");if(!1!==U(window,n))throw new Error("Can only use global to communicate between two different windows, not between frames");var r=Kn(n);if(!r)throw new Error("Can not find postRobot global on foreign window");r.receiveMessage({source:window,origin:O(),data:e})};var ke=function n(e,r,t,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,u=o.timeout||5e3,c=o.fireAndForget||!1;return w.try((function(){if(function(n,e,r){if(!n)throw new Error("Expected name");if(r&&"string"!=typeof r&&!Array.isArray(r)&&!En(r))throw new TypeError("Can not send "+n+". Expected domain "+JSON.stringify(r)+" to be a string, array, or regex");if(I(e))throw new Error("Can not send "+n+". Target window is closed")}(r,e,i),function(n,e){var r=k(e);if(r)return r===n;if(e===n)return!1;if(j(e)===e)return!1;for(var t=0,o=D(n);t<o.length;t++)if(o[t]===e)return!0;return!1}(window,e))return function(n,e,r){void 0===e&&(e=5e3),void 0===r&&(r="Window");var t=function(n){return oe("helloPromises").getOrSet(n,(function(){return new w}))}(n);return-1!==e&&(t=t.timeout(e,new Error(r+" did not load after "+e+"ms"))),t}(e,u)})).then((function(r){return function(n,e,r,t){var o=t.send;return w.try((function(){return"string"==typeof e?e:w.try((function(){return r||ue(n,{send:o}).then((function(n){return n.domain}))})).then((function(n){if(!L(e,e))throw new Error("Domain "+wn(e)+" does not match "+wn(e));return n}))}))}(e,i,(void 0===r?{}:r).domain,{send:n})})).then((function(o){var i=o,u="postrobot_method"===r&&t&&"string"==typeof t.name?t.name+"()":r,f=new w,s=r+"_"+tn();if(!c){var d={name:r,win:e,domain:i,promise:f};!function(n,e){ne("responseListeners").set(n,e)}(s,d);var l=oe("requestPromises").getOrSet(e,(function(){return[]}));l.push(f),f.catch((function(){!function(n){ne("erroredResponseListeners").set(n,!0)}(s),De(s)}));var h=function(n){return oe("knownWindows").get(n,!1)}(e)?1e4:2e3,p=a,v=h,m=p,y=mn((function(){return I(e)?f.reject(new Error("Window closed for "+r+" before "+(d.ack?"response":"ack"))):d.cancelled?f.reject(new Error("Response listener was cancelled for "+r)):(v=Math.max(v-500,0),-1!==m&&(m=Math.max(m-500,0)),d.ack||0!==v?0===m?f.reject(new Error("No response for postMessage "+u+" in "+O()+" in "+p+"ms")):void 0:f.reject(new Error("No ack for postMessage "+u+" in "+O()+" in "+h+"ms")))}),500);f.finally((function(){y.cancel(),l.splice(l.indexOf(f,1))})).catch(dn)}return Se(e,i,{id:tn(),origin:O(window),type:"postrobot_message_request",hash:s,name:r,data:t,fireAndForget:c},{on:ze,send:n}).then((function(){return c?f.resolve():f}),(function(n){throw new Error("Send request message failed for "+u+" in "+O()+"\n\n"+hn(n))}))}))};function Fe(n){return Ee.toProxyWindow(n,{send:ke})}function Me(n){if(!C(n))throw new Error("Can not get global for window on different domain");return n.__zoid_9_0_86__||(n.__zoid_9_0_86__={}),n.__zoid_9_0_86__}function Ue(n,e){try{return e(Me(n))}catch(n){}}function Le(n){return{get:function(){var e=this;return w.try((function(){if(e.source&&e.source!==window)throw new Error("Can not call get on proxy object from a remote window");return n}))}}}function qe(n){return rn(JSON.stringify(n))}function Be(n){var e=Me(n);return e.references=e.references||{},e.references}function Je(n){var e,r,t=n.data,o=n.metaData,i=n.sender,a=n.receiver,u=n.passByReference,c=void 0!==u&&u,f=n.basic,s=void 0!==f&&f,d=Fe(a.win),l=s?JSON.stringify(t):Pe(d,a.domain,t,{on:ze,send:ke}),h=c?(e=l,r=tn(),Be(window)[r]=e,{type:"uid",uid:r}):function(n){return{type:"raw",val:n}}(l);return{serializedData:qe({sender:{domain:i.domain},metaData:o,reference:h}),cleanReference:function(){var n,e;n=window,"uid"===(e=h).type&&delete Be(n)[e.uid]}}}function He(n){var e,r,t=n.sender,o=n.basic,i=void 0!==o&&o,a=function(n){return JSON.parse(function(n){if("function"==typeof atob)return decodeURIComponent([].map.call(atob(n),(function(n){return"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)})).join(""));if("undefined"!=typeof Buffer)return Buffer.from(n,"base64").toString("utf8");throw new Error("Can not find window.atob or Buffer")}(n))}(n.data),u=a.reference,c=a.metaData;e="function"==typeof t.win?t.win({metaData:c}):t.win,r="function"==typeof t.domain?t.domain({metaData:c}):"string"==typeof t.domain?t.domain:a.sender.domain;var f=function(n,e){if("raw"===e.type)return e.val;if("uid"===e.type)return Be(n)[e.uid];throw new Error("Unsupported ref type: "+e.type)}(e,u);return{data:i?JSON.parse(f):function(n,e,r){return Oe(n,e,r,{on:ze,send:ke})}(e,r,f),metaData:c,sender:{win:e,domain:r},reference:u}}var Ye={STRING:"string",OBJECT:"object",FUNCTION:"function",BOOLEAN:"boolean",NUMBER:"number",ARRAY:"array"},Ze={JSON:"json",DOTIFY:"dotify",BASE64:"base64"},Ge=v,Ve={RENDER:"zoid-render",RENDERED:"zoid-rendered",DISPLAY:"zoid-display",ERROR:"zoid-error",CLOSE:"zoid-close",DESTROY:"zoid-destroy",PROPS:"zoid-props",RESIZE:"zoid-resize",FOCUS:"zoid-focus"};function $e(n){return"__zoid__"+n.name+"__"+n.serializedPayload+"__"}function Xe(n){if(!n)throw new Error("No window name");var e=n.split("__"),r=e[1],t=e[2],o=e[3];if("zoid"!==r)throw new Error("Window not rendered by zoid - got "+r);i