!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("pmrpc",[],r):"object"==typeof exports?exports.pmrpc=r():t.pmrpc=r()}(this,function(){return function(t){function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var e={};return r.m=t,r.c=e,r.i=function(t){return t},r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},r.p="",r(r.s=151)}([function(t,r){var e=Array.isArray;t.exports=e},function(t,r,e){var n=e(39),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},function(t,r,e){function n(t){return null==t?void 0===t?a:c:s&&s in Object(t)?i(t):u(t)}var o=e(9),i=e(99),u=e(125),c="[object Null]",a="[object Undefined]",s=o?o.toStringTag:void 0;t.exports=n},function(t,r,e){function n(t,r){var e=i(t,r);return o(e)?e:void 0}var o=e(34),i=e(101);t.exports=n},function(t,r){function e(t){return null!=t&&"object"==typeof t}t.exports=e},function(t,r,e){function n(t){if(!i(t))return!1;var r=o(t);return r==c||r==a||r==u||r==s}var o=e(2),i=e(6),u="[object AsyncFunction]",c="[object Function]",a="[object GeneratorFunction]",s="[object Proxy]";t.exports=n},function(t,r){function e(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}t.exports=e},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default={INVOKE:"invoke",RPC_RESOLVE:"rpc-resolve",RPC_REJECT:"rpc-reject",API_DESCRIPTION:"api-desc",INVOKE_FUNCTION:"invoke-func",RESOLVE:"resolve",REJECT:"reject",REQUEST_API:"request-api"}},function(t,r,e){function n(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r0&&void 0!==arguments[0]?arguments[0]:{},r=t.type;return"Error"===r||(0,c.default)((0,i.default)(self,[r,"prototype"]))},l=function(t){var r=t.type,e=t.stack,n=t.message,o=new self[r](n);return o.stack=e,o},p=function(t){var r=t.constructor.name,e=t.message,n=t.stack;return{type:(0,s.default)(self[r])?r:"Error",message:e,stack:n}};r.serialize=function(t){return Promise.reject((0,c.default)(t)?p(t):t)},r.deserialize=function(t){return f(t)?l(t):t}},function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,"__esModule",{value:!0}),r.sendResponse=r.send=void 0;var o=e(148),i=n(o);r.send=function(t,r,e){var n=r.target,o=r.targetOrigin;return(0,i.default)(t,n,{targetOrigin:o,transfer:e})},r.sendResponse=function(t,r){return function(e){return t.postMessage({intent:r,result:e})}}},function(t,r,e){var n=e(3),o=e(1),i=n(o,"Map");t.exports=i},function(t,r,e){function n(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1&&t%1==0&&t<=n}var n=9007199254740991;t.exports=e},function(t,r,e){function n(t){return"symbol"==typeof t||i(t)&&o(t)==u}var o=e(2),i=e(4),u="[object Symbol]";t.exports=n},function(t,r,e){function n(t){return u(t)?o(t):i(t)}var o=e(70),i=e(35),u=e(14);t.exports=n},function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,"__esModule",{value:!0});var o=e(7),i=n(o),u=e(17);r.default=function(t){var r=t.intent,e=t.result;switch(r){case i.default.RESOLVE:return e;case i.default.REJECT:return Promise.reject((0,u.deserialize)(e))}}},function(t,r,e){function n(t){var r=this.__data__=new o(t);this.size=r.size}var o=e(8),i=e(129),u=e(130),c=e(131),a=e(132),s=e(133);n.prototype.clear=i,n.prototype.delete=u,n.prototype.get=c,n.prototype.has=a,n.prototype.set=s,t.exports=n},function(t,r){function e(t,r){for(var e=-1,n=null==t?0:t.length,o=Array(n);++ep))return!1;var d=f.get(t);if(d&&f.get(r))return d==r;var h=-1,y=!0,_=e&a?new o:void 0;for(f.set(t,r),f.set(r,t);++h-1&&t%1==0&&t2&&void 0!==arguments[2]?arguments[2]:{},n=e.onApiCall;c.hasApp(t)||(c.registerApp(t,r,n),d.addSingleHandler(_))},r.request=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=y(r);return(0,p.send)({intent:f.default.REQUEST_API,appId:t},e).then(function(r){return r?(0,l.buildApiFromDescription)(t,r,e):Promise.reject(new Error("App with ID "+t+" not found"))})},r.unset=function(t){c.unregisterApp(t),c.isEmpty()&&d.removeSingleHandler(_)}},function(t,r,e){(function(r,n){!function(r,e){t.exports=e()}(0,function(){"use strict";function t(t){return"function"==typeof t||"object"==typeof t&&null!==t}function o(t){return"function"==typeof t}function i(t){H=t}function u(t){Q=t}function c(){return function(){return r.nextTick(p)}}function a(){return void 0!==K?function(){K(p)}:l()}function s(){var t=0,r=new Z(p),e=document.createTextNode("");return r.observe(e,{characterData:!0}),function(){e.data=t=++t%2}}function f(){var t=new MessageChannel;return t.port1.onmessage=p,function(){return t.port2.postMessage(0)}}function l(){var t=setTimeout;return function(){return t(p,1)}}function p(){for(var t=0;t0?1:-1)*Math.floor(Math.abs(r)):r},e=Math.pow(2,53)-1,n=function(t){var n=r(t);return Math.min(Math.max(n,0),e)},o=function(t){if(null!=t){if(["string","number","boolean","symbol"].indexOf(typeof t)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in t)return Symbol.iterator;if("@@iterator"in t)return"@@iterator"}},i=function(r,e){if(null!=r&&null!=e){var n=r[e];if(null==n)return;if(!t(n))throw new TypeError(n+" is not a function");return n}},u=function(t){var r=t.next();return!Boolean(r.done)&&r};return function(r){"use strict";var e,c=this,a=arguments.length>1?arguments[1]:void 0;if(void 0!==a){if(!t(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(e=arguments[2])}var s,f,l=i(r,o(r));if(void 0!==l){s=t(c)?Object(new c):[];var p=l.call(r);if(null==p)throw new TypeError("Array.from requires an array-like or iterable object");f=0;for(var v,d;;){if(!(v=u(p)))return s.length=f,s;d=v.value,s[f]=a?a.call(e,d,f):d,f++}}else{var h=Object(r);if(null==r)throw new TypeError("Array.from requires an array-like object - not null or undefined");var y=n(h.length);s=t(c)?Object(new c(y)):new Array(y),f=0;for(var _;f-1}var o=e(10);t.exports=n},function(t,r,e){function n(t,r){var e=this.__data__,n=o(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this}var o=e(10);t.exports=n},function(t,r,e){function n(){this.size=0,this.__data__={hash:new o,map:new(u||i),string:new o}}var o=e(62),i=e(8),u=e(19);t.exports=n},function(t,r,e){function n(t){var r=o(this,t).delete(t);return this.size-=r?1:0,r}var o=e(11);t.exports=n},function(t,r,e){function n(t){return o(this,t).get(t)}var o=e(11);t.exports=n},function(t,r,e){function n(t){return o(this,t).has(t)}var o=e(11);t.exports=n},function(t,r,e){function n(t,r){var e=o(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this}var o=e(11);t.exports=n},function(t,r){function e(t){var r=-1,e=Array(t.size);return t.forEach(function(t,n){e[++r]=[n,t]}),e}t.exports=e},function(t,r,e){function n(t){var r=o(t,function(t){return e.size===i&&e.clear(),t}),e=r.cache;return r}var o=e(143),i=500;t.exports=n},function(t,r,e){var n=e(46),o=n(Object.keys,Object);t.exports=o},function(t,r,e){(function(t){var n=e(39),o="object"==typeof r&&r&&!r.nodeType&&r,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,u=i&&i.exports===o,c=u&&n.process,a=function(){try{return c&&c.binding&&c.binding("util")}catch(t){}}();t.exports=a}).call(r,e(51)(t))},function(t,r){function e(t){return o.call(t)}var n=Object.prototype,o=n.toString;t.exports=e},function(t,r){function e(t){return this.__data__.set(t,n),this}var n="__lodash_hash_undefined__";t.exports=e},function(t,r){function e(t){return this.__data__.has(t)}t.exports=e},function(t,r){function e(t){var r=-1,e=Array(t.size);return t.forEach(function(t){e[++r]=t}),e}t.exports=e},function(t,r,e){function n(){this.__data__=new o,this.size=0}var o=e(8);t.exports=n},function(t,r){function e(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e}t.exports=e},function(t,r){function e(t){return this.__data__.get(t)}t.exports=e},function(t,r){function e(t){return this.__data__.has(t)}t.exports=e},function(t,r,e){function n(t,r){var e=this.__data__;if(e instanceof o){var n=e.__data__;if(!i||n.length2&&void 0!==arguments[2]?arguments[2]:{},o=n.targetOrigin,i=void 0===o?"*":o,u=n.transfer,c=void 0===u?[]:u,a="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;return new Promise(function(n,o){a&&(r=self),r&&r.postMessage||o(new Error("Invalid target"));var u=new MessageChannel,s=u.port1,f=u.port2;r===self||r instanceof Worker||r instanceof MessagePort?r.postMessage(t,[f].concat(e(c))):r.postMessage(t,i,[f].concat(e(c))),s.onmessage=function(t){var r=t.data;return n(r)}})}}])})},function(t,r){function e(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===e||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(r){try{return f.call(null,t,0)}catch(r){return f.call(this,t,0)}}}function i(t){if(l===clearTimeout)return clearTimeout(t);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(r){try{return l.call(null,t)}catch(r){return l.call(this,t)}}}function u(){h&&v&&(h=!1,v.length?d=v.concat(d):y=-1,d.length&&c())}function c(){if(!h){var t=o(u);h=!0;for(var r=d.length;r;){for(v=d,d=[];++y1)for(var e=1;e