@jumpn/absinthe-phoenix-socket
Advanced tools
Comparing version 0.3.3 to 0.4.0
@@ -1,2 +0,2 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var _newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck")),utilsComposite=require("@jumpn/utils-composite");require("phoenix");var utilsArray=require("@jumpn/utils-array"),_extends=_interopDefault(require("babel-runtime/helpers/extends")),utilsGraphql=require("@jumpn/utils-graphql"),_toConsumableArray=_interopDefault(require("babel-runtime/helpers/toConsumableArray")),_objectWithoutProperties=_interopDefault(require("babel-runtime/helpers/objectWithoutProperties")),_this$2=void 0,find=function(e,n,i){return _newArrowCheck(this,_this$2),e.find(utilsComposite.hasIn([n],i))}.bind(void 0),_this$1=void 0,createEventHandler=function(e,n){return _newArrowCheck(this,_this$1),function(i){return _newArrowCheck(this,_this$1),function(){for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];_newArrowCheck(this,_this$1);var s=find(e.notifiers,"request",n);s&&i.apply(void 0,[e,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(e,n,i){return _newArrowCheck(this,_this$1),utilsComposite.map(createEventHandler(n,i),e)}.bind(void 0),_this$3=void 0,handlePush=function(e,n){return _newArrowCheck(this,_this$3),e.receive("ok",n.onSucceed).receive("error",n.onError).receive("timeout",n.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(e,n){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[e]&&i[e](n)}.bind(this)}.bind(void 0),getHandlerName=function(e){return _newArrowCheck(this,_this$4),"on"+String(e)}.bind(void 0),notify=function(e,n,i){return _newArrowCheck(this,_this$4),e.observers.forEach(getNotifier(getHandlerName(n),i))}.bind(void 0),_this$6=void 0,findIndex=function(e,n,i){return _newArrowCheck(this,_this$6),e.findIndex(utilsComposite.hasIn([n],i))}.bind(void 0),_this$5=void 0,remove$1=function(e){return _newArrowCheck(this,_this$5),function(n){return _newArrowCheck(this,_this$5),utilsArray.remove(findIndex(n,"request",e),1,n)}.bind(this)}.bind(void 0),_this$7=void 0,updateNotifiers=function(e,n){return _newArrowCheck(this,_this$7),e.notifiers=n(e.notifiers),e}.bind(void 0),_this=void 0,removeNotifiers=function(e,n){_newArrowCheck(this,_this),updateNotifiers(e,remove$1(n)),notify(n,"Cancel",n)}.bind(void 0),onError=function(e,n,i){_newArrowCheck(this,_this),unsubscribe(e,n),notify(n,"Error","unsubscribe: "+String(i))}.bind(void 0),onTimeout=function(e,n){return _newArrowCheck(this,_this),notify(n,"Error","unsubscribe: timeout")}.bind(void 0),notifierPushHandler={onError:onError,onTimeout:onTimeout,onSucceed:removeNotifiers},unsubscribe=function(e,n){return _newArrowCheck(this,_this),handlePush(e.channel.push("unsubscribe",{subscriptionId:n.subscriptionId}),createPushHandler(notifierPushHandler,e,n.request))}.bind(void 0),cancel=function(e,n){return _newArrowCheck(this,_this),"subscription"===n.operationType?unsubscribe(e,n):removeNotifiers(e,n),e}.bind(void 0),_this$10=void 0,notifyall=function(e,n,i){return _newArrowCheck(this,_this$10),e.forEach(function(e){return _newArrowCheck(this,_this$10),notify(e,n,i)}.bind(this))}.bind(void 0),_this$12=void 0,refresh=function(e){return _newArrowCheck(this,_this$12),function(n){return _newArrowCheck(this,_this$12),utilsArray.replace(findIndex(n,"request",e),[e],n)}.bind(this)}.bind(void 0),_this$11=void 0,onQueryOrMutationResponse=function(e,n,i){_newArrowCheck(this,_this$11),updateNotifiers(e,remove$1(n)),notify(n,"Result",i.payload.result)}.bind(void 0),notifyStart=function(e){return _newArrowCheck(this,_this$11),notify(e,"Start",e)}.bind(void 0),onSubscriptionResponse=function(e,n,i){var r=i.subscriptionId;_newArrowCheck(this,_this$11),updateNotifiers(e,refresh(_extends({},n,{subscriptionId:r}))),notifyStart(n)}.bind(void 0),onResponse=function(e,n,i){_newArrowCheck(this,_this$11),i.subscriptionId?onSubscriptionResponse(e,n,i):i.payload&&onQueryOrMutationResponse(e,n,i)}.bind(void 0),abortRequest=function(e,n,i){_newArrowCheck(this,_this$11),updateNotifiers(e,remove$1(n)),notify(n,"Abort",i)}.bind(void 0),onError$1=function(e,n,i){return _newArrowCheck(this,_this$11),abortRequest(e,n,new Error(i))}.bind(void 0),onSucceed=function(e,n,i){_newArrowCheck(this,_this$11),i.errors?onError$1(e,n,utilsGraphql.errorsToString(i.errors)):onResponse(e,n,i)}.bind(void 0),onTimeout$1=function(e,n){return _newArrowCheck(this,_this$11),notify(n,"Error",new Error("request: timeout"))}.bind(void 0),notifierPushHandler$1={onError:onError$1,onSucceed:onSucceed,onTimeout:onTimeout$1},pushRequest=function(e,n){_newArrowCheck(this,_this$11),"subscription"!==n.operationType&¬ifyStart(n),handlePush(e.channel.push("doc",n.request),createPushHandler(notifierPushHandler$1,e,n.request))}.bind(void 0),_this$9=void 0,createChannelJoinHandler=function(e){return _newArrowCheck(this,_this$9),{onError:function(n){return _newArrowCheck(this,_this$9),notifyall(e.notifiers,"Error",new Error("channel join: "+String(n)))}.bind(this),onSucceed:function(){_newArrowCheck(this,_this$9),e.isJoining=!1,e.notifiers.forEach(function(n){return _newArrowCheck(this,_this$9),pushRequest(e,n)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$9),notifyall(e.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(e){return _newArrowCheck(this,_this$9),handlePush(e.channel.join(),createChannelJoinHandler(e))}.bind(void 0),_this$8=void 0,createConnectionCloseError=function(){return _newArrowCheck(this,_this$8),new Error("connection: close")}.bind(void 0),mutationOnConnectionClose=function(e,n){_newArrowCheck(this,_this$8),updateNotifiers(e,remove$1(n)),notify(n,"Abort",createConnectionCloseError())}.bind(void 0),notifierOnConnectionClose=function(e){return _newArrowCheck(this,_this$8),function(n){_newArrowCheck(this,_this$8),"mutation"===n.operationType?mutationOnConnectionClose(e,n):notify(n,"Error",createConnectionCloseError())}.bind(this)}.bind(void 0),onConnectionClose=function(e){return _newArrowCheck(this,_this$8),function(){_newArrowCheck(this,_this$8),0!==e.notifiers.length&&(e.isJoining=!0,e.notifiers.forEach(notifierOnConnectionClose(e)))}.bind(this)}.bind(void 0),onSubscriptionData=function(e,n){var i=n.payload;_newArrowCheck(this,_this$8);var r=find(e.notifiers,"subscriptionId",i.subscriptionId);r&¬ify(r,"Result",i.result)}.bind(void 0),onMessage=function(e){return _newArrowCheck(this,_this$8),function(n){_newArrowCheck(this,_this$8),"subscription:data"===n.event&&onSubscriptionData(e,n)}.bind(this)}.bind(void 0),joinChannelIfNeeded=function(e){_newArrowCheck(this,_this$8),0===e.notifiers.length?e.isJoining=!1:joinChannel(e)}.bind(void 0),onConnectionOpen=function(e){return _newArrowCheck(this,_this$8),function(){_newArrowCheck(this,_this$8),e.isJoining&&joinChannelIfNeeded(e)}.bind(this)}.bind(void 0),absintheChannelName="__absinthe__:control",create=function(e){_newArrowCheck(this,_this$8);var n={phoenixSocket:e,channel:e.channel(absintheChannelName),isJoining:!1,notifiers:[]};return e.onOpen(onConnectionOpen(n)),e.onMessage(onMessage(n)),e.onClose(onConnectionClose(n)),n}.bind(void 0),_this$14=void 0,observe$2=function(e,n){var i=e.observers,r=_objectWithoutProperties(e,["observers"]);return _newArrowCheck(this,_this$14),_extends({},r,{observers:[].concat(_toConsumableArray(i),[n])})}.bind(void 0),_this$13=void 0,observe=function(e,n,i){return _newArrowCheck(this,_this$13),updateNotifiers(e,refresh(observe$2(n,i)))}.bind(void 0),_this$16=void 0,create$2=function(e){return _newArrowCheck(this,_this$16),{request:e,observers:[],operationType:utilsGraphql.getOperationType(e.operation),subscriptionId:void 0}}.bind(void 0),_this$15=void 0,connectOrJoin=function(e){_newArrowCheck(this,_this$15),e.isJoining=!0,e.phoenixSocket.isConnected()?joinChannel(e):e.phoenixSocket.connect()}.bind(void 0),isJoined=function(e){return _newArrowCheck(this,_this$15),e.phoenixSocket.isConnected()&&!e.isJoining}.bind(void 0),send=function(e,n){_newArrowCheck(this,_this$15);var i=create$2(n);return updateNotifiers(e,utilsArray.append([i])),isJoined(e)?pushRequest(e,i):connectOrJoin(e),i}.bind(void 0),_this$18=void 0,unobserve$2=function(e,n){var i=e.observers,r=_objectWithoutProperties(e,["observers"]);return _newArrowCheck(this,_this$18),_extends({},r,{observers:utilsArray.remove(i.indexOf(n),1,i)})}.bind(void 0),_this$17=void 0,unobserve=function(e,n,i){return _newArrowCheck(this,_this$17),updateNotifiers(e,refresh(unobserve$2(n,i))),e}.bind(void 0);exports.cancel=cancel,exports.create=create,exports.observe=observe,exports.send=send,exports.unobserve=unobserve; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var _newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck")),utilsComposite=require("@jumpn/utils-composite");require("phoenix");var utilsArray=require("@jumpn/utils-array"),_extends=_interopDefault(require("babel-runtime/helpers/extends")),utilsGraphql=require("@jumpn/utils-graphql"),_toConsumableArray=_interopDefault(require("babel-runtime/helpers/toConsumableArray")),_objectWithoutProperties=_interopDefault(require("babel-runtime/helpers/objectWithoutProperties")),Observable=_interopDefault(require("zen-observable")),_this$2=void 0,find=function(e,n,i){return _newArrowCheck(this,_this$2),e.find(utilsComposite.hasIn([n],i))}.bind(void 0),_this$1=void 0,createEventHandler=function(e,n){return _newArrowCheck(this,_this$1),function(i){return _newArrowCheck(this,_this$1),function(){for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];_newArrowCheck(this,_this$1);var s=find(e.notifiers,"request",n);s&&i.apply(void 0,[e,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(e,n,i){return _newArrowCheck(this,_this$1),utilsComposite.map(createEventHandler(n,i),e)}.bind(void 0),_this$3=void 0,handlePush=function(e,n){return _newArrowCheck(this,_this$3),e.receive("ok",n.onSucceed).receive("error",n.onError).receive("timeout",n.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(e,n){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[e]&&i[e](n)}.bind(this)}.bind(void 0),getHandlerName=function(e){return _newArrowCheck(this,_this$4),"on"+String(e)}.bind(void 0),notify=function(e,n,i){return _newArrowCheck(this,_this$4),e.observers.forEach(getNotifier(getHandlerName(n),i))}.bind(void 0),_this$6=void 0,findIndex=function(e,n,i){return _newArrowCheck(this,_this$6),e.findIndex(utilsComposite.hasIn([n],i))}.bind(void 0),_this$5=void 0,remove$1=function(e){return _newArrowCheck(this,_this$5),function(n){return _newArrowCheck(this,_this$5),utilsArray.remove(findIndex(n,"request",e),1,n)}.bind(this)}.bind(void 0),_this$7=void 0,updateNotifiers=function(e,n){return _newArrowCheck(this,_this$7),e.notifiers=n(e.notifiers),e}.bind(void 0),_this=void 0,removeNotifiers=function(e,n){_newArrowCheck(this,_this),updateNotifiers(e,remove$1(n)),notify(n,"Cancel",n)}.bind(void 0),onError=function(e,n,i){_newArrowCheck(this,_this),unsubscribe(e,n),notify(n,"Error","unsubscribe: "+String(i))}.bind(void 0),onTimeout=function(e,n){return _newArrowCheck(this,_this),notify(n,"Error","unsubscribe: timeout")}.bind(void 0),notifierPushHandler={onError:onError,onTimeout:onTimeout,onSucceed:removeNotifiers},unsubscribe=function(e,n){return _newArrowCheck(this,_this),handlePush(e.channel.push("unsubscribe",{subscriptionId:n.subscriptionId}),createPushHandler(notifierPushHandler,e,n.request))}.bind(void 0),cancel=function(e,n){return _newArrowCheck(this,_this),"subscription"===n.operationType?unsubscribe(e,n):removeNotifiers(e,n),e}.bind(void 0),_this$10=void 0,notifyall=function(e,n,i){return _newArrowCheck(this,_this$10),e.forEach(function(e){return _newArrowCheck(this,_this$10),notify(e,n,i)}.bind(this))}.bind(void 0),_this$12=void 0,refresh=function(e){return _newArrowCheck(this,_this$12),function(n){return _newArrowCheck(this,_this$12),utilsArray.replace(findIndex(n,"request",e),[e],n)}.bind(this)}.bind(void 0),_this$11=void 0,onQueryOrMutationResponse=function(e,n,i){_newArrowCheck(this,_this$11),updateNotifiers(e,remove$1(n)),notify(n,"Result",i.payload.result)}.bind(void 0),notifyStart=function(e){return _newArrowCheck(this,_this$11),notify(e,"Start",e)}.bind(void 0),onSubscriptionResponse=function(e,n,i){var r=i.subscriptionId;_newArrowCheck(this,_this$11),updateNotifiers(e,refresh(_extends({},n,{subscriptionId:r}))),notifyStart(n)}.bind(void 0),onResponse=function(e,n,i){_newArrowCheck(this,_this$11),i.subscriptionId?onSubscriptionResponse(e,n,i):i.payload&&onQueryOrMutationResponse(e,n,i)}.bind(void 0),abortRequest=function(e,n,i){_newArrowCheck(this,_this$11),updateNotifiers(e,remove$1(n)),notify(n,"Abort",i)}.bind(void 0),onError$1=function(e,n,i){return _newArrowCheck(this,_this$11),abortRequest(e,n,new Error(i))}.bind(void 0),onSucceed=function(e,n,i){_newArrowCheck(this,_this$11),i.errors?onError$1(e,n,utilsGraphql.errorsToString(i.errors)):onResponse(e,n,i)}.bind(void 0),onTimeout$1=function(e,n){return _newArrowCheck(this,_this$11),notify(n,"Error",new Error("request: timeout"))}.bind(void 0),notifierPushHandler$1={onError:onError$1,onSucceed:onSucceed,onTimeout:onTimeout$1},pushRequest=function(e,n){_newArrowCheck(this,_this$11),"subscription"!==n.operationType&¬ifyStart(n),handlePush(e.channel.push("doc",n.request),createPushHandler(notifierPushHandler$1,e,n.request))}.bind(void 0),_this$9=void 0,createChannelJoinHandler=function(e){return _newArrowCheck(this,_this$9),{onError:function(n){return _newArrowCheck(this,_this$9),notifyall(e.notifiers,"Error",new Error("channel join: "+String(n)))}.bind(this),onSucceed:function(){_newArrowCheck(this,_this$9),e.isJoining=!1,e.notifiers.forEach(function(n){return _newArrowCheck(this,_this$9),pushRequest(e,n)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$9),notifyall(e.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(e){return _newArrowCheck(this,_this$9),handlePush(e.channel.join(),createChannelJoinHandler(e))}.bind(void 0),_this$8=void 0,createConnectionCloseError=function(){return _newArrowCheck(this,_this$8),new Error("connection: close")}.bind(void 0),mutationOnConnectionClose=function(e,n){_newArrowCheck(this,_this$8),updateNotifiers(e,remove$1(n)),notify(n,"Abort",createConnectionCloseError())}.bind(void 0),notifierOnConnectionClose=function(e){return _newArrowCheck(this,_this$8),function(n){_newArrowCheck(this,_this$8),"mutation"===n.operationType?mutationOnConnectionClose(e,n):notify(n,"Error",createConnectionCloseError())}.bind(this)}.bind(void 0),onConnectionClose=function(e){return _newArrowCheck(this,_this$8),function(){_newArrowCheck(this,_this$8),0!==e.notifiers.length&&(e.isJoining=!0,e.notifiers.forEach(notifierOnConnectionClose(e)))}.bind(this)}.bind(void 0),onSubscriptionData=function(e,n){var i=n.payload;_newArrowCheck(this,_this$8);var r=find(e.notifiers,"subscriptionId",i.subscriptionId);r&¬ify(r,"Result",i.result)}.bind(void 0),onMessage=function(e){return _newArrowCheck(this,_this$8),function(n){_newArrowCheck(this,_this$8),"subscription:data"===n.event&&onSubscriptionData(e,n)}.bind(this)}.bind(void 0),joinChannelIfNeeded=function(e){_newArrowCheck(this,_this$8),0===e.notifiers.length?e.isJoining=!1:joinChannel(e)}.bind(void 0),onConnectionOpen=function(e){return _newArrowCheck(this,_this$8),function(){_newArrowCheck(this,_this$8),e.isJoining&&joinChannelIfNeeded(e)}.bind(this)}.bind(void 0),absintheChannelName="__absinthe__:control",create=function(e){_newArrowCheck(this,_this$8);var n={phoenixSocket:e,channel:e.channel(absintheChannelName),isJoining:!1,notifiers:[]};return e.onOpen(onConnectionOpen(n)),e.onMessage(onMessage(n)),e.onClose(onConnectionClose(n)),n}.bind(void 0),_this$14=void 0,observe$2=function(e,n){var i=e.observers,r=_objectWithoutProperties(e,["observers"]);return _newArrowCheck(this,_this$14),_extends({},r,{observers:[].concat(_toConsumableArray(i),[n])})}.bind(void 0),_this$13=void 0,observe=function(e,n,i){return _newArrowCheck(this,_this$13),updateNotifiers(e,refresh(observe$2(n,i)))}.bind(void 0),_this$16=void 0,create$2=function(e){return _newArrowCheck(this,_this$16),{request:e,observers:[],operationType:utilsGraphql.getOperationType(e.operation),subscriptionId:void 0}}.bind(void 0),_this$15=void 0,connectOrJoin=function(e){_newArrowCheck(this,_this$15),e.isJoining=!0,e.phoenixSocket.isConnected()?joinChannel(e):e.phoenixSocket.connect()}.bind(void 0),isJoined=function(e){return _newArrowCheck(this,_this$15),e.phoenixSocket.isConnected()&&!e.isJoining}.bind(void 0),send=function(e,n){_newArrowCheck(this,_this$15);var i=create$2(n);return updateNotifiers(e,utilsArray.append([i])),isJoined(e)?pushRequest(e,i):connectOrJoin(e),i}.bind(void 0),_this$17=void 0,onResult=function(e,n){return _newArrowCheck(this,_this$17),function(i){_newArrowCheck(this,_this$17),n.next(i),"subscription"!==e.operationType&&n.complete()}.bind(this)}.bind(void 0),toObservable=function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i.onError,t=i.onStart,o=i.unsubscribe;return _newArrowCheck(this,_this$17),new Observable(function(i){return _newArrowCheck(this,_this$17),observe(e,n,{onError:r,onStart:t,onAbort:i.error,onresult:onResult(n,i)}),o}.bind(this))}.bind(void 0),_this$19=void 0,unobserve$2=function(e,n){var i=e.observers,r=_objectWithoutProperties(e,["observers"]);return _newArrowCheck(this,_this$19),_extends({},r,{observers:utilsArray.remove(i.indexOf(n),1,i)})}.bind(void 0),_this$18=void 0,unobserve=function(e,n,i){return _newArrowCheck(this,_this$18),updateNotifiers(e,refresh(unobserve$2(n,i))),e}.bind(void 0);exports.cancel=cancel,exports.create=create,exports.observe=observe,exports.send=send,exports.toObservable=toObservable,exports.unobserve=unobserve; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.AbsinthePhoenixSocket={})}(this,function(t){"use strict";function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t,n){return n={exports:{}},t(n,n.exports),n.exports}"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var i=n(e(function(t,n){n.__esModule=!0,n.default=function(t,n){if(t!==n)throw new TypeError("Cannot instantiate an arrow function")}})),r=e(function(t,n){function e(t,n,i){return function(){var r=i.concat(Array.prototype.slice.call(arguments));return r.length>=n?t.apply(this,r):e(t,n,r)}}Object.defineProperty(n,"__esModule",{value:!0}),n.flip=function(t){return function(n,e){return t(e,n)}},n.constant=function(t){return function(){return t}},n.on=function(t,n){return function(e,i){return t(n(e),n(i))}},n.compose=function(){for(var t=this,n=arguments.length,e=Array(n),i=0;i<n;i++)e[i]=arguments[i];var r=e.length-1;return function(n){for(var i=n,o=r;o>-1;o--)i=e[o].call(t,i);return i}},n.pipe=function(){for(var t=this,n=arguments.length,e=Array(n),i=0;i<n;i++)e[i]=arguments[i];var r=e.length-1;return function(n){for(var i=n,o=0;o<=r;o++)i=e[o].call(t,i);return i}},n.curry=function(t){return e(t,t.length,[])}});n(r);var o=r.curry,u=Math.ceil,s=Math.floor,c=function(t){return isNaN(t=+t)?0:(t>0?s:u)(t)},a=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t},f=e(function(t){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)}),h=e(function(t){var n=t.exports={version:"2.5.1"};"number"==typeof __e&&(__e=n)}),l=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t},d=function(t,n,e){if(l(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,i){return t.call(n,e,i)};case 3:return function(e,i,r){return t.call(n,e,i,r)}}return function(){return t.apply(n,arguments)}},v=function(t){return"object"==typeof t?null!==t:"function"==typeof t},p=function(t){if(!v(t))throw TypeError(t+" is not an object!");return t},y=function(t){try{return!!t()}catch(t){return!0}},b=!y(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),m=f.document,g=v(m)&&v(m.createElement),k=function(t){return g?m.createElement(t):{}},j=!b&&!y(function(){return 7!=Object.defineProperty(k("div"),"a",{get:function(){return 7}}).a}),S=function(t,n){if(!v(t))return t;var e,i;if(n&&"function"==typeof(e=t.toString)&&!v(i=e.call(t)))return i;if("function"==typeof(e=t.valueOf)&&!v(i=e.call(t)))return i;if(!n&&"function"==typeof(e=t.toString)&&!v(i=e.call(t)))return i;throw TypeError("Can't convert object to primitive value")},w=Object.defineProperty,O={f:b?Object.defineProperty:function(t,n,e){if(p(t),n=S(n,!0),p(e),j)try{return w(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},_=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}},E=b?function(t,n,e){return O.f(t,n,_(1,e))}:function(t,n,e){return t[n]=e,t},T=function(t,n,e){var i,r,o,u=t&T.F,s=t&T.G,c=t&T.S,a=t&T.P,l=t&T.B,v=t&T.W,p=s?h:h[n]||(h[n]={}),y=p.prototype,b=s?f:c?f[n]:(f[n]||{}).prototype;s&&(e=n);for(i in e)(r=!u&&b&&void 0!==b[i])&&i in p||(o=r?b[i]:e[i],p[i]=s&&"function"!=typeof b[i]?e[i]:l&&r?d(o,f):v&&b[i]==o?function(t){var n=function(n,e,i){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,e)}return new t(n,e,i)}return t.apply(this,arguments)};return n.prototype=t.prototype,n}(o):a&&"function"==typeof o?d(Function.call,o):o,a&&((p.virtual||(p.virtual={}))[i]=o,t&T.R&&y&&!y[i]&&E(y,i,o)))};T.F=1,T.G=2,T.S=4,T.P=8,T.B=16,T.W=32,T.U=64,T.R=128;var A=T,P=E,C={}.hasOwnProperty,M=function(t,n){return C.call(t,n)},R={},x={}.toString,L=function(t){return x.call(t).slice(8,-1)},I=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==L(t)?t.split(""):Object(t)},N=function(t){return I(a(t))},J=Math.min,q=function(t){return t>0?J(c(t),9007199254740991):0},H=Math.max,F=Math.min,D=function(t,n){return(t=c(t))<0?H(t+n,0):F(t,n)},B=f["__core-js_shared__"]||(f["__core-js_shared__"]={}),U=function(t){return B[t]||(B[t]={})},G=0,z=Math.random(),V=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++G+z).toString(36))},W=U("keys"),X=function(t){return W[t]||(W[t]=V(t))},K=function(t){return function(n,e,i){var r,o=N(n),u=q(o.length),s=D(i,u);if(t&&e!=e){for(;u>s;)if((r=o[s++])!=r)return!0}else for(;u>s;s++)if((t||s in o)&&o[s]===e)return t||s||0;return!t&&-1}}(!1),Y=X("IE_PROTO"),Q=function(t,n){var e,i=N(t),r=0,o=[];for(e in i)e!=Y&&M(i,e)&&o.push(e);for(;n.length>r;)M(i,e=n[r++])&&(~K(o,e)||o.push(e));return o},$="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Z=Object.keys||function(t){return Q(t,$)},tt=b?Object.defineProperties:function(t,n){p(t);for(var e,i=Z(n),r=i.length,o=0;r>o;)O.f(t,e=i[o++],n[e]);return t},nt=f.document,et=nt&&nt.documentElement,it=X("IE_PROTO"),rt=function(){},ot=function(){var t,n=k("iframe"),e=$.length;for(n.style.display="none",et.appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),ot=t.F;e--;)delete ot.prototype[$[e]];return ot()},ut=Object.create||function(t,n){var e;return null!==t?(rt.prototype=p(t),e=new rt,rt.prototype=null,e[it]=t):e=ot(),void 0===n?e:tt(e,n)},st=e(function(t){var n=U("wks"),e=f.Symbol,i="function"==typeof e;(t.exports=function(t){return n[t]||(n[t]=i&&e[t]||(i?e:V)("Symbol."+t))}).store=n}),ct=O.f,at=st("toStringTag"),ft=function(t,n,e){t&&!M(t=e?t:t.prototype,at)&&ct(t,at,{configurable:!0,value:n})},ht={};E(ht,st("iterator"),function(){return this});var lt=function(t,n,e){t.prototype=ut(ht,{next:_(1,e)}),ft(t,n+" Iterator")},dt=function(t){return Object(a(t))},vt=X("IE_PROTO"),pt=Object.prototype,yt=Object.getPrototypeOf||function(t){return t=dt(t),M(t,vt)?t[vt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?pt:null},bt=st("iterator"),mt=!([].keys&&"next"in[].keys()),gt=function(){return this},kt=function(t,n,e,i,r,o,u){lt(e,n,i);var s,c,a,f=function(t){if(!mt&&t in v)return v[t];switch(t){case"keys":case"values":return function(){return new e(this,t)}}return function(){return new e(this,t)}},h=n+" Iterator",l="values"==r,d=!1,v=t.prototype,p=v[bt]||v["@@iterator"]||r&&v[r],y=p||f(r),b=r?l?f("entries"):y:void 0,m="Array"==n?v.entries||p:p;if(m&&(a=yt(m.call(new t)))!==Object.prototype&&a.next&&ft(a,h,!0),l&&p&&"values"!==p.name&&(d=!0,y=function(){return p.call(this)}),u&&(mt||d||!v[bt])&&E(v,bt,y),R[n]=y,R[h]=gt,r)if(s={values:l?y:f("values"),keys:o?y:f("keys"),entries:b},u)for(c in s)c in v||P(v,c,s[c]);else A(A.P+A.F*(mt||d),n,s);return s},jt=function(t){return function(n,e){var i,r,o=String(a(n)),u=c(e),s=o.length;return u<0||u>=s?t?"":void 0:(i=o.charCodeAt(u))<55296||i>56319||u+1===s||(r=o.charCodeAt(u+1))<56320||r>57343?t?o.charAt(u):i:t?o.slice(u,u+2):r-56320+(i-55296<<10)+65536}}(!0);kt(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,e=this._i;return e>=n.length?{value:void 0,done:!0}:(t=jt(n,e),this._i+=t.length,{value:t,done:!1})});var St=function(t,n,e,i){try{return i?n(p(e)[0],e[1]):n(e)}catch(n){var r=t.return;throw void 0!==r&&p(r.call(t)),n}},wt=st("iterator"),Ot=Array.prototype,_t=function(t){return void 0!==t&&(R.Array===t||Ot[wt]===t)},Et=function(t,n,e){n in t?O.f(t,n,_(0,e)):t[n]=e},Tt=st("toStringTag"),At="Arguments"==L(function(){return arguments}()),Pt=function(t,n){try{return t[n]}catch(t){}},Ct=function(t){var n,e,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=Pt(n=Object(t),Tt))?e:At?L(n):"Object"==(i=L(n))&&"function"==typeof n.callee?"Arguments":i},Mt=st("iterator"),Rt=h.getIteratorMethod=function(t){if(void 0!=t)return t[Mt]||t["@@iterator"]||R[Ct(t)]},xt=st("iterator"),Lt=!1;try{[7][xt]().return=function(){Lt=!0}}catch(t){}A(A.S+A.F*!function(t,n){if(!n&&!Lt)return!1;var e=!1;try{var i=[7],r=i[xt]();r.next=function(){return{done:e=!0}},i[xt]=function(){return r},t(i)}catch(t){}return e}(function(t){}),"Array",{from:function(t){var n,e,i,r,o=dt(t),u="function"==typeof this?this:Array,s=arguments.length,c=s>1?arguments[1]:void 0,a=void 0!==c,f=0,h=Rt(o);if(a&&(c=d(c,s>2?arguments[2]:void 0,2)),void 0==h||u==Array&&_t(h))for(e=new u(n=q(o.length));n>f;f++)Et(e,f,a?c(o[f],f):o[f]);else for(r=h.call(o),e=new u;!(i=r.next()).done;f++)Et(e,f,a?St(r,c,[i.value,f],!0):i.value);return e.length=f,e}});var It=h.Array.from,Nt=e(function(t){t.exports={default:It,__esModule:!0}}),Jt=n(Nt),qt=n(e(function(t,n){n.__esModule=!0;var e=function(t){return t&&t.__esModule?t:{default:t}}(Nt);n.default=function(t){if(Array.isArray(t)){for(var n=0,i=Array(t.length);n<t.length;n++)i[n]=t[n];return i}return(0,e.default)(t)}})),Ht={f:Object.getOwnPropertySymbols},Ft={f:{}.propertyIsEnumerable},Dt=Object.assign,Bt=!Dt||y(function(){var t={},n={},e=Symbol(),i="abcdefghijklmnopqrst";return t[e]=7,i.split("").forEach(function(t){n[t]=t}),7!=Dt({},t)[e]||Object.keys(Dt({},n)).join("")!=i})?function(t,n){for(var e=dt(t),i=arguments.length,r=1,o=Ht.f,u=Ft.f;i>r;)for(var s,c=I(arguments[r++]),a=o?Z(c).concat(o(c)):Z(c),f=a.length,h=0;f>h;)u.call(c,s=a[h++])&&(e[s]=c[s]);return e}:Dt;A(A.S+A.F,"Object",{assign:Bt});var Ut=h.Object.assign,Gt=e(function(t){t.exports={default:Ut,__esModule:!0}});n(Gt);var zt=n(e(function(t,n){n.__esModule=!0;var e=function(t){return t&&t.__esModule?t:{default:t}}(Gt);n.default=e.default||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t}}));!function(t,n){var e=(h.Object||{})[t]||Object[t],i={};i[t]=n(e),A(A.S+A.F*y(function(){e(1)}),"Object",i)}("keys",function(){return function(t){return Z(dt(t))}});var Vt=h.Object.keys,Wt=n(e(function(t){t.exports={default:Vt,__esModule:!0}})),Xt=Math.floor;A(A.S,"Number",{isInteger:function(t){return!v(t)&&isFinite(t)&&Xt(t)===t}});var Kt=h.Number.isInteger,Yt=n(e(function(t){t.exports={default:Kt,__esModule:!0}})),Qt=n(e(function(t,n){n.__esModule=!0,n.default=function(t,n){var e={};for(var i in t)n.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}})),$t=o(function(t,n){return i(this,void 0),[].concat(qt(n),qt(t))}.bind(void 0)),Zt=(function(t){return i(this,void 0),Array.isArray(t)?t:[t]}.bind(void 0),o(function(t,n){return i(this,void 0),n===t.length-1}.bind(void 0))),tn=(o(function(t,n){return i(this,void 0),Zt(t,n)?0:n+1}.bind(void 0)),function(t){return i(this,void 0),Math.max.apply(Math,qt(Wt(t)))+1}.bind(void 0)),nn=(function(t){return i(this,void 0),Jt("length"in t?t:zt({},t,{length:tn(t)}))}.bind(void 0),o(function(t,n,e){return i(this,void 0),[].concat(qt(e.slice(0,t)),qt(n),qt(e.slice(t+1)))}.bind(void 0)),function(t,n){return i(this,void 0),Yt(t)&&t>=n}.bind(void 0)),en=function(t){return i(this,void 0),nn(Number(t),0)}.bind(void 0),rn=(function(t){t.length;var n=Qt(t,["length"]);return i(this,void 0),Wt(n).every(en)}.bind(void 0),o(function(t,n){return i(this,void 0),[].concat(qt(t),qt(n))}.bind(void 0)),o(function(t,n,e,r){return i(this,void 0),r.reduce(function(e,r,o){return i(this,void 0),t(r,o,e)?n(e,r,o):e}.bind(this),e)}.bind(void 0)),o(function(t,n,e,r){i(this,void 0);var o=e;return r.every(function(e,r){i(this,void 0);var u=t(e,r,o);return u&&(o=n(o,e,r)),u}.bind(this)),o}.bind(void 0)),o(function(t,n,e){return i(this,void 0),[].concat(qt(e.slice(0,t)),qt(e.slice(t+n)))}.bind(void 0))),on=(o(function(t,n){return i(this,void 0),[].concat(qt(Array(t))).map(function(){return i(this,void 0),n}.bind(this))}.bind(void 0)),o(function(t,n,e){return i(this,void 0),[].concat(qt(e.slice(0,t)),qt(n),qt(e.slice(t+n.length)))}.bind(void 0)));o(function(t,n){return i(this,void 0),n<0?t.length-n:n}.bind(void 0));A(A.S+A.F*!b,"Object",{defineProperty:O.f});var un=h.Object,sn=function(t,n,e){return un.defineProperty(t,n,e)},cn=e(function(t){t.exports={default:sn,__esModule:!0}});n(cn);var an=n(e(function(t,n){n.__esModule=!0;var e=function(t){return t&&t.__esModule?t:{default:t}}(cn);n.default=function(t,n,i){return n in t?(0,e.default)(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}})),fn=function(t,n){return{value:n,done:!!t}};kt(Array,"Array",function(t,n){this._t=N(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,e=this._i++;return!t||e>=t.length?(this._t=void 0,fn(1)):"keys"==n?fn(0,e):"values"==n?fn(0,t[e]):fn(0,[e,t[e]])},"values");R.Arguments=R.Array;for(var hn=st("toStringTag"),ln="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),dn=0;dn<ln.length;dn++){var vn=ln[dn],pn=f[vn],yn=pn&&pn.prototype;yn&&!yn[hn]&&E(yn,hn,vn),R[vn]=R.Array}var bn=st("iterator"),mn=h.isIterable=function(t){var n=Object(t);return void 0!==n[bn]||"@@iterator"in n||R.hasOwnProperty(Ct(n))},gn=e(function(t){t.exports={default:mn,__esModule:!0}});n(gn);var kn=h.getIterator=function(t){var n=Rt(t);if("function"!=typeof n)throw TypeError(t+" is not iterable!");return p(n.call(t))},jn=e(function(t){t.exports={default:kn,__esModule:!0}});n(jn);var Sn=n(e(function(t,n){function e(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0;var i=e(gn),r=e(jn);n.default=function(){function t(t,n){var e=[],i=!0,o=!1,u=void 0;try{for(var s,c=(0,r.default)(t);!(i=(s=c.next()).done)&&(e.push(s.value),!n||e.length!==n);i=!0);}catch(t){o=!0,u=t}finally{try{!i&&c.return&&c.return()}finally{if(o)throw u}}return e}return function(n,e){if(Array.isArray(n))return n;if((0,i.default)(Object(n)))return t(n,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()})),wn=Ft.f,On=function(t){return function(n){for(var e,i=N(n),r=Z(i),o=r.length,u=0,s=[];o>u;)wn.call(i,e=r[u++])&&s.push(t?[e,i[e]]:i[e]);return s}}(!0);A(A.S,"Object",{entries:function(t){return On(t)}});var _n=h.Object.entries,En=n(e(function(t){t.exports={default:_n,__esModule:!0}})),Tn=e(function(t){var n=V("meta"),e=O.f,i=0,r=Object.isExtensible||function(){return!0},o=!y(function(){return r(Object.preventExtensions({}))}),u=function(t){e(t,n,{value:{i:"O"+ ++i,w:{}}})},s=t.exports={KEY:n,NEED:!1,fastKey:function(t,e){if(!v(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!M(t,n)){if(!r(t))return"F";if(!e)return"E";u(t)}return t[n].i},getWeak:function(t,e){if(!M(t,n)){if(!r(t))return!0;if(!e)return!1;u(t)}return t[n].w},onFreeze:function(t){return o&&s.NEED&&r(t)&&!M(t,n)&&u(t),t}}}),An={f:st},Pn=O.f,Cn=function(t){var n=h.Symbol||(h.Symbol={});"_"==t.charAt(0)||t in n||Pn(n,t,{value:An.f(t)})},Mn=function(t){var n=Z(t),e=Ht.f;if(e)for(var i,r=e(t),o=Ft.f,u=0;r.length>u;)o.call(t,i=r[u++])&&n.push(i);return n},Rn=Array.isArray||function(t){return"Array"==L(t)},xn=$.concat("length","prototype"),Ln={f:Object.getOwnPropertyNames||function(t){return Q(t,xn)}},In=Ln.f,Nn={}.toString,Jn="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],qn=function(t){try{return In(t)}catch(t){return Jn.slice()}},Hn={f:function(t){return Jn&&"[object Window]"==Nn.call(t)?qn(t):In(N(t))}},Fn=Object.getOwnPropertyDescriptor,Dn={f:b?Fn:function(t,n){if(t=N(t),n=S(n,!0),j)try{return Fn(t,n)}catch(t){}if(M(t,n))return _(!Ft.f.call(t,n),t[n])}},Bn=Tn.KEY,Un=Dn.f,Gn=O.f,zn=Hn.f,Vn=f.Symbol,Wn=f.JSON,Xn=Wn&&Wn.stringify,Kn=st("_hidden"),Yn=st("toPrimitive"),Qn={}.propertyIsEnumerable,$n=U("symbol-registry"),Zn=U("symbols"),te=U("op-symbols"),ne=Object.prototype,ee="function"==typeof Vn,ie=f.QObject,re=!ie||!ie.prototype||!ie.prototype.findChild,oe=b&&y(function(){return 7!=ut(Gn({},"a",{get:function(){return Gn(this,"a",{value:7}).a}})).a})?function(t,n,e){var i=Un(ne,n);i&&delete ne[n],Gn(t,n,e),i&&t!==ne&&Gn(ne,n,i)}:Gn,ue=function(t){var n=Zn[t]=ut(Vn.prototype);return n._k=t,n},se=ee&&"symbol"==typeof Vn.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof Vn},ce=function(t,n,e){return t===ne&&ce(te,n,e),p(t),n=S(n,!0),p(e),M(Zn,n)?(e.enumerable?(M(t,Kn)&&t[Kn][n]&&(t[Kn][n]=!1),e=ut(e,{enumerable:_(0,!1)})):(M(t,Kn)||Gn(t,Kn,_(1,{})),t[Kn][n]=!0),oe(t,n,e)):Gn(t,n,e)},ae=function(t,n){p(t);for(var e,i=Mn(n=N(n)),r=0,o=i.length;o>r;)ce(t,e=i[r++],n[e]);return t},fe=function(t){var n=Qn.call(this,t=S(t,!0));return!(this===ne&&M(Zn,t)&&!M(te,t))&&(!(n||!M(this,t)||!M(Zn,t)||M(this,Kn)&&this[Kn][t])||n)},he=function(t,n){if(t=N(t),n=S(n,!0),t!==ne||!M(Zn,n)||M(te,n)){var e=Un(t,n);return!e||!M(Zn,n)||M(t,Kn)&&t[Kn][n]||(e.enumerable=!0),e}},le=function(t){for(var n,e=zn(N(t)),i=[],r=0;e.length>r;)M(Zn,n=e[r++])||n==Kn||n==Bn||i.push(n);return i},de=function(t){for(var n,e=t===ne,i=zn(e?te:N(t)),r=[],o=0;i.length>o;)!M(Zn,n=i[o++])||e&&!M(ne,n)||r.push(Zn[n]);return r};ee||(P((Vn=function(){if(this instanceof Vn)throw TypeError("Symbol is not a constructor!");var t=V(arguments.length>0?arguments[0]:void 0),n=function(e){this===ne&&n.call(te,e),M(this,Kn)&&M(this[Kn],t)&&(this[Kn][t]=!1),oe(this,t,_(1,e))};return b&&re&&oe(ne,t,{configurable:!0,set:n}),ue(t)}).prototype,"toString",function(){return this._k}),Dn.f=he,O.f=ce,Ln.f=Hn.f=le,Ft.f=fe,Ht.f=de,An.f=function(t){return ue(st(t))}),A(A.G+A.W+A.F*!ee,{Symbol:Vn});for(var ve="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),pe=0;ve.length>pe;)st(ve[pe++]);for(var ye=Z(st.store),be=0;ye.length>be;)Cn(ye[be++]);A(A.S+A.F*!ee,"Symbol",{for:function(t){return M($n,t+="")?$n[t]:$n[t]=Vn(t)},keyFor:function(t){if(!se(t))throw TypeError(t+" is not a symbol!");for(var n in $n)if($n[n]===t)return n},useSetter:function(){re=!0},useSimple:function(){re=!1}}),A(A.S+A.F*!ee,"Object",{create:function(t,n){return void 0===n?ut(t):ae(ut(t),n)},defineProperty:ce,defineProperties:ae,getOwnPropertyDescriptor:he,getOwnPropertyNames:le,getOwnPropertySymbols:de}),Wn&&A(A.S+A.F*(!ee||y(function(){var t=Vn();return"[null]"!=Xn([t])||"{}"!=Xn({a:t})||"{}"!=Xn(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!se(t)){for(var n,e,i=[t],r=1;arguments.length>r;)i.push(arguments[r++]);return"function"==typeof(n=i[1])&&(e=n),!e&&Rn(n)||(n=function(t,n){if(e&&(n=e.call(this,t,n)),!se(n))return n}),i[1]=n,Xn.apply(Wn,i)}}}),Vn.prototype[Yn]||E(Vn.prototype,Yn,Vn.prototype.valueOf),ft(Vn,"Symbol"),ft(Math,"Math",!0),ft(f.JSON,"JSON",!0),Cn("asyncIterator"),Cn("observable");var me=h.Symbol,ge=n(e(function(t){t.exports={default:me,__esModule:!0}})),ke=o(function(t,n){return i(this,void 0),n[t]}.bind(void 0)),je=o(function(t,n){return i(this,void 0),Object.prototype.hasOwnProperty.call(n,t)}.bind(void 0)),Se=function(t,n,e){return i(this,void 0),Zt(n,t)?ke(n[t],e):je(n[t],e)?Se(t+1,n,ke(n[t],e)):void 0}.bind(void 0),we=o(function(t,n){return i(this,void 0),0===t.length?void 0:Se(0,t,n)}.bind(void 0)),Oe=function(t){return i(this,void 0),Array.isArray(t)?[].concat(qt(t.keys())):Wt(t)}.bind(void 0),_e=o(function(t,n,e){return i(this,void 0),we(t,e)===n}.bind(void 0)),Ee=o(function(t,n){i(this,void 0);var e=Oe(t);return e.length===Oe(n).length&&e.every(function(e){return i(this,void 0),je(e,n)&&ke(e,t)===ke(e,n)}.bind(this))}.bind(void 0)),Te=function(t,n){return i(this,void 0),En(n).reduce(function(e,r){var o=Sn(r,2),u=o[0],s=o[1];return i(this,void 0),zt({},e,an({},u,t(s,u,n)))}.bind(this),{})}.bind(void 0),Ae=o(function(t,n){return i(this,void 0),Array.isArray(n)?n.map(t):Te(t,n)}.bind(void 0)),Pe=function(t,n){n[t];var e=Qt(n,[t]);return i(this,void 0),e}.bind(void 0),Ce=o(function(t,n){return i(this,void 0),Array.isArray(n)?rn(t,1,n):Pe(t,n)}.bind(void 0)),Me=function(t){return i(this,void 0),Array.isArray(t)?[].concat(qt(t)):zt({},t)}.bind(void 0),Re=function(t){i(this,void 0);var n=Me(t);return{origin:n,previous:void 0,current:n}}.bind(void 0),xe=function(t){return i(this,void 0),"number"==typeof t?[]:{}}.bind(void 0),Le=function(t,n,e){return i(this,void 0),je(t,e)?Me(ke(t,e)):xe(n)}.bind(void 0),Ie=function(t,n,e,r){return i(this,void 0),Zt(t,e)?n(ke(t[e],r)):Le(t[e],t[e+1],r)}.bind(void 0),Ne=function(t,n,e){return i(this,void 0),e[t]=n,ke(t,e)}.bind(void 0),Je=function(t,n,e,r){return i(this,void 0),zt({},r,{current:Ne(t[n],e,r.current)})}.bind(void 0),qe=function(t,n,e){i(this,void 0);var r=Ce(t[n],e.current);return 0===n?zt({},e,{current:r,origin:r}):zt({},e,{previous:Ne(t[n-1],r,e.previous)})}.bind(void 0),He=ge("composite.updateIn.removeAction"),Fe=function(t,n,e,r){return i(this,void 0),e===He?qe(t,n,r):Je(t,n,e,r)}.bind(void 0),De=function(t,n){return i(this,void 0),function(e,r,o){return i(this,void 0),Fe(t,o,Ie(t,n,o,e.current),e)}.bind(this)}.bind(void 0),Be=o(function(t,n,e){return i(this,void 0),0===t.length?e:t.reduce(De(t,n),Re(e)).origin}.bind(void 0));Be.remove=He;var Ue=function(){return i(this,void 0),Be.remove}.bind(void 0),Ge=(o(function(t,n){return i(this,void 0),Be(t,Ue,n)}.bind(void 0)),o(function(t,n,e){i(this,void 0);var r=Me(e);return r[t]=n,r}.bind(void 0)),o(function(t,n,e){return i(this,void 0),Be(t,function(){return i(this,void 0),n}.bind(this),e)}.bind(void 0)),function(t,n){return i(this,void 0),Boolean(Number(t)^Number(n))}.bind(void 0)),ze=(o(function(t,n){return i(this,void 0),t===n||!Ge(Array.isArray(t),Array.isArray(n))&&Ee(t,n)}.bind(void 0)),function(t,n,e){return i(this,void 0),t.find(_e([n],e))}.bind(void 0)),Ve=function(t,n){return i(this,void 0),function(e){return i(this,void 0),function(){for(var r=arguments.length,o=Array(r),u=0;u<r;u++)o[u]=arguments[u];i(this,void 0);var s=ze(t.notifiers,"request",n);s&&e.apply(void 0,[t,s].concat(o))}.bind(this)}.bind(this)}.bind(void 0),We=function(t,n,e){return i(this,void 0),Ae(Ve(n,e),t)}.bind(void 0);n(e(function(t,n){!function(t,e){e(n)}(0,function(t){function n(t){if(Array.isArray(t)){for(var n=0,e=Array(t.length);n<t.length;n++)e[n]=t[n];return e}return Array.from(t)}function e(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function(){function t(t,n){var e=[],i=!0,r=!1,o=void 0;try{for(var u,s=t[Symbol.iterator]();!(i=(u=s.next()).done)&&(e.push(u.value),!n||e.length!==n);i=!0);}catch(t){r=!0,o=t}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return e}return function(n,e){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return t(n,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function t(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(n,e,i){return e&&t(n.prototype,e),i&&t(n,i),n}}(),u={connecting:0,open:1,closing:2,closed:3},s=1e4,c={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},a={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},f=[a.close,a.error,a.join,a.reply,a.leave],h={longpoll:"longpoll",websocket:"websocket"},l=function(){function t(n,i,r,o){e(this,t),this.channel=n,this.event=i,this.payload=r||{},this.receivedResp=null,this.timeout=o,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}return o(t,[{key:"resend",value:function(t){this.timeout=t,this.reset(),this.send()}},{key:"send",value:function(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel.joinRef()}))}},{key:"receive",value:function(t,n){return this.hasReceived(t)&&n(this.receivedResp.response),this.recHooks.push({status:t,callback:n}),this}},{key:"reset",value:function(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}},{key:"matchReceive",value:function(t){var n=t.status,e=t.response;this.recHooks.filter(function(t){return t.status===n}).forEach(function(t){return t.callback(e)})}},{key:"cancelRefEvent",value:function(){this.refEvent&&this.channel.off(this.refEvent)}},{key:"cancelTimeout",value:function(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}},{key:"startTimeout",value:function(){var t=this;this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,function(n){t.cancelRefEvent(),t.cancelTimeout(),t.receivedResp=n,t.matchReceive(n)}),this.timeoutTimer=setTimeout(function(){t.trigger("timeout",{})},this.timeout)}},{key:"hasReceived",value:function(t){return this.receivedResp&&this.receivedResp.status===t}},{key:"trigger",value:function(t,n){this.channel.trigger(this.refEvent,{status:t,response:n})}}]),t}(),d=t.Channel=function(){function t(n,i,r){var o=this;e(this,t),this.state=c.closed,this.topic=n,this.params=i||{},this.socket=r,this.bindings=[],this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new l(this,a.join,this.params,this.timeout),this.pushBuffer=[],this.rejoinTimer=new b(function(){return o.rejoinUntilConnected()},this.socket.reconnectAfterMs),this.joinPush.receive("ok",function(){o.state=c.joined,o.rejoinTimer.reset(),o.pushBuffer.forEach(function(t){return t.send()}),o.pushBuffer=[]}),this.onClose(function(){o.rejoinTimer.reset(),o.socket.log("channel","close "+o.topic+" "+o.joinRef()),o.state=c.closed,o.socket.remove(o)}),this.onError(function(t){o.isLeaving()||o.isClosed()||(o.socket.log("channel","error "+o.topic,t),o.state=c.errored,o.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",function(){o.isJoining()&&(o.socket.log("channel","timeout "+o.topic+" ("+o.joinRef()+")",o.joinPush.timeout),new l(o,a.leave,{},o.timeout).send(),o.state=c.errored,o.joinPush.reset(),o.rejoinTimer.scheduleTimeout())}),this.on(a.reply,function(t,n){o.trigger(o.replyEventName(n),t)})}return o(t,[{key:"rejoinUntilConnected",value:function(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this.rejoin()}},{key:"join",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;if(this.joinedOnce)throw"tried to join multiple times. 'join' can only be called a single time per channel instance";return this.joinedOnce=!0,this.rejoin(t),this.joinPush}},{key:"onClose",value:function(t){this.on(a.close,t)}},{key:"onError",value:function(t){this.on(a.error,function(n){return t(n)})}},{key:"on",value:function(t,n){this.bindings.push({event:t,callback:n})}},{key:"off",value:function(t){this.bindings=this.bindings.filter(function(n){return n.event!==t})}},{key:"canPush",value:function(){return this.socket.isConnected()&&this.isJoined()}},{key:"push",value:function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.timeout;if(!this.joinedOnce)throw"tried to push '"+t+"' to '"+this.topic+"' before joining. Use channel.join() before pushing events";var i=new l(this,t,n,e);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}},{key:"leave",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.state=c.leaving;var e=function(){t.socket.log("channel","leave "+t.topic),t.trigger(a.close,"leave")},i=new l(this,a.leave,{},n);return i.receive("ok",function(){return e()}).receive("timeout",function(){return e()}),i.send(),this.canPush()||i.trigger("ok",{}),i}},{key:"onMessage",value:function(t,n,e){return n}},{key:"isMember",value:function(t,n,e,i){if(this.topic!==t)return!1;var r=f.indexOf(n)>=0;return!i||!r||i===this.joinRef()||(this.socket.log("channel","dropping outdated message",{topic:t,event:n,payload:e,joinRef:i}),!1)}},{key:"joinRef",value:function(){return this.joinPush.ref}},{key:"sendJoin",value:function(t){this.state=c.joining,this.joinPush.resend(t)}},{key:"rejoin",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.isLeaving()||this.sendJoin(t)}},{key:"trigger",value:function(t,n,e,i){var r=this,o=this.onMessage(t,n,e,i);if(n&&!o)throw"channel onMessage callbacks must return the payload, modified or unmodified";this.bindings.filter(function(n){return n.event===t}).map(function(t){return t.callback(o,e,i||r.joinRef())})}},{key:"replyEventName",value:function(t){return"chan_reply_"+t}},{key:"isClosed",value:function(){return this.state===c.closed}},{key:"isErrored",value:function(){return this.state===c.errored}},{key:"isJoined",value:function(){return this.state===c.joined}},{key:"isJoining",value:function(){return this.state===c.joining}},{key:"isLeaving",value:function(){return this.state===c.leaving}}]),t}(),v={encode:function(t,n){var e=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(e))},decode:function(t,n){var e=JSON.parse(t),i=r(e,5);return n({join_ref:i[0],ref:i[1],topic:i[2],event:i[3],payload:i[4]})}},p=(t.Socket=function(){function t(n){var i=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e(this,t),this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=r.timeout||s,this.transport=r.transport||window.WebSocket||p,this.defaultEncoder=v.encode,this.defaultDecoder=v.decode,this.transport!==p?(this.encode=r.encode||this.defaultEncoder,this.decode=r.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder),this.heartbeatIntervalMs=r.heartbeatIntervalMs||3e4,this.reconnectAfterMs=r.reconnectAfterMs||function(t){return[1e3,2e3,5e3,1e4][t-1]||1e4},this.logger=r.logger||function(){},this.longpollerTimeout=r.longpollerTimeout||2e4,this.params=r.params||{},this.endPoint=n+"/"+h.websocket,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new b(function(){i.disconnect(function(){return i.connect()})},this.reconnectAfterMs)}return o(t,[{key:"protocol",value:function(){return location.protocol.match(/^https/)?"wss":"ws"}},{key:"endPointURL",value:function(){var t=y.appendParams(y.appendParams(this.endPoint,this.params),{vsn:"2.0.0"});return"/"!==t.charAt(0)?t:"/"===t.charAt(1)?this.protocol()+":"+t:this.protocol()+"://"+location.host+t}},{key:"disconnect",value:function(t,n,e){this.conn&&(this.conn.onclose=function(){},n?this.conn.close(n,e||""):this.conn.close(),this.conn=null),t&&t()}},{key:"connect",value:function(t){var n=this;t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=t),this.conn||(this.conn=new this.transport(this.endPointURL()),this.conn.timeout=this.longpollerTimeout,this.conn.onopen=function(){return n.onConnOpen()},this.conn.onerror=function(t){return n.onConnError(t)},this.conn.onmessage=function(t){return n.onConnMessage(t)},this.conn.onclose=function(t){return n.onConnClose(t)})}},{key:"log",value:function(t,n,e){this.logger(t,n,e)}},{key:"onOpen",value:function(t){this.stateChangeCallbacks.open.push(t)}},{key:"onClose",value:function(t){this.stateChangeCallbacks.close.push(t)}},{key:"onError",value:function(t){this.stateChangeCallbacks.error.push(t)}},{key:"onMessage",value:function(t){this.stateChangeCallbacks.message.push(t)}},{key:"onConnOpen",value:function(){var t=this;this.log("transport","connected to "+this.endPointURL()),this.flushSendBuffer(),this.reconnectTimer.reset(),this.conn.skipHeartbeat||(clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(function(){return t.sendHeartbeat()},this.heartbeatIntervalMs)),this.stateChangeCallbacks.open.forEach(function(t){return t()})}},{key:"onConnClose",value:function(t){this.log("transport","close",t),this.triggerChanError(),clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(function(n){return n(t)})}},{key:"onConnError",value:function(t){this.log("transport",t),this.triggerChanError(),this.stateChangeCallbacks.error.forEach(function(n){return n(t)})}},{key:"triggerChanError",value:function(){this.channels.forEach(function(t){return t.trigger(a.error)})}},{key:"connectionState",value:function(){switch(this.conn&&this.conn.readyState){case u.connecting:return"connecting";case u.open:return"open";case u.closing:return"closing";default:return"closed"}}},{key:"isConnected",value:function(){return"open"===this.connectionState()}},{key:"remove",value:function(t){this.channels=this.channels.filter(function(n){return n.joinRef()!==t.joinRef()})}},{key:"channel",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=new d(t,n,this);return this.channels.push(e),e}},{key:"push",value:function(t){var n=this,e=t.topic,i=t.event,r=t.payload,o=t.ref,u=t.join_ref,s=function(){n.encode(t,function(t){n.conn.send(t)})};this.log("push",e+" "+i+" ("+u+", "+o+")",r),this.isConnected()?s():this.sendBuffer.push(s)}},{key:"makeRef",value:function(){var t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}},{key:"sendHeartbeat",value:function(){if(this.isConnected()){if(this.pendingHeartbeatRef)return this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),void this.conn.close(1e3,"hearbeat timeout");this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef})}}},{key:"flushSendBuffer",value:function(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(function(t){return t()}),this.sendBuffer=[])}},{key:"onConnMessage",value:function(t){var n=this;this.decode(t.data,function(t){var e=t.topic,i=t.event,r=t.payload,o=t.ref,u=t.join_ref;o&&o===n.pendingHeartbeatRef&&(n.pendingHeartbeatRef=null),n.log("receive",(r.status||"")+" "+e+" "+i+" "+(o&&"("+o+")"||""),r),n.channels.filter(function(t){return t.isMember(e,i,r,u)}).forEach(function(t){return t.trigger(i,r,o,u)}),n.stateChangeCallbacks.message.forEach(function(n){return n(t)})})}}]),t}(),t.LongPoll=function(){function t(n){e(this,t),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(n),this.readyState=u.connecting,this.poll()}return o(t,[{key:"normalizeEndpoint",value:function(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+h.websocket),"$1/"+h.longpoll)}},{key:"endpointURL",value:function(){return y.appendParams(this.pollEndpoint,{token:this.token})}},{key:"closeAndRetry",value:function(){this.close(),this.readyState=u.connecting}},{key:"ontimeout",value:function(){this.onerror("timeout"),this.closeAndRetry()}},{key:"poll",value:function(){var t=this;this.readyState!==u.open&&this.readyState!==u.connecting||y.request("GET",this.endpointURL(),"application/json",null,this.timeout,this.ontimeout.bind(this),function(n){if(n){var e=n.status,i=n.token,r=n.messages;t.token=i}else e=0;switch(e){case 200:r.forEach(function(n){return t.onmessage({data:n})}),t.poll();break;case 204:t.poll();break;case 410:t.readyState=u.open,t.onopen(),t.poll();break;case 0:case 500:t.onerror(),t.closeAndRetry();break;default:throw"unhandled poll status "+e}})}},{key:"send",value:function(t){var n=this;y.request("POST",this.endpointURL(),"application/json",t,this.timeout,this.onerror.bind(this,"timeout"),function(t){t&&200===t.status||(n.onerror(t&&t.status),n.closeAndRetry())})}},{key:"close",value:function(t,n){this.readyState=u.closed,this.onclose()}}]),t}()),y=t.Ajax=function(){function t(){e(this,t)}return o(t,null,[{key:"request",value:function(t,n,e,i,r,o,u){if(window.XDomainRequest){var s=new XDomainRequest;this.xdomainRequest(s,t,n,i,r,o,u)}else{var c=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");this.xhrRequest(c,t,n,e,i,r,o,u)}}},{key:"xdomainRequest",value:function(t,n,e,i,r,o,u){var s=this;t.timeout=r,t.open(n,e),t.onload=function(){var n=s.parseJSON(t.responseText);u&&u(n)},o&&(t.ontimeout=o),t.onprogress=function(){},t.send(i)}},{key:"xhrRequest",value:function(t,n,e,i,r,o,u,s){var c=this;t.open(n,e,!0),t.timeout=o,t.setRequestHeader("Content-Type",i),t.onerror=function(){s&&s(null)},t.onreadystatechange=function(){if(t.readyState===c.states.complete&&s){var n=c.parseJSON(t.responseText);s(n)}},u&&(t.ontimeout=u),t.send(r)}},{key:"parseJSON",value:function(t){if(!t||""===t)return null;try{return JSON.parse(t)}catch(n){return console&&console.log("failed to parse JSON response",t),null}}},{key:"serialize",value:function(t,n){var e=[];for(var r in t)if(t.hasOwnProperty(r)){var o=n?n+"["+r+"]":r,u=t[r];"object"===(void 0===u?"undefined":i(u))?e.push(this.serialize(u,o)):e.push(encodeURIComponent(o)+"="+encodeURIComponent(u))}return e.join("&")}},{key:"appendParams",value:function(t,n){return 0===Object.keys(n).length?t:""+t+(t.match(/\?/)?"&":"?")+this.serialize(n)}}]),t}();y.states={complete:4};t.Presence={syncState:function(t,n,e,i){var r=this,o=this.clone(t),u={},s={};return this.map(o,function(t,e){n[t]||(s[t]=e)}),this.map(n,function(t,n){var e=o[t];if(e){var i=n.metas.map(function(t){return t.phx_ref}),c=e.metas.map(function(t){return t.phx_ref}),a=n.metas.filter(function(t){return c.indexOf(t.phx_ref)<0}),f=e.metas.filter(function(t){return i.indexOf(t.phx_ref)<0});a.length>0&&(u[t]=n,u[t].metas=a),f.length>0&&(s[t]=r.clone(e),s[t].metas=f)}else u[t]=n}),this.syncDiff(o,{joins:u,leaves:s},e,i)},syncDiff:function(t,e,i,r){var o=e.joins,u=e.leaves,s=this.clone(t);return i||(i=function(){}),r||(r=function(){}),this.map(o,function(t,e){var r=s[t];if(s[t]=e,r){var o;(o=s[t].metas).unshift.apply(o,n(r.metas))}i(t,r,e)}),this.map(u,function(t,n){var e=s[t];if(e){var i=n.metas.map(function(t){return t.phx_ref});e.metas=e.metas.filter(function(t){return i.indexOf(t.phx_ref)<0}),r(t,e,n),0===e.metas.length&&delete s[t]}}),s},list:function(t,n){return n||(n=function(t,n){return n}),this.map(t,function(t,e){return n(t,e)})},map:function(t,n){return Object.getOwnPropertyNames(t).map(function(e){return n(e,t[e])})},clone:function(t){return JSON.parse(JSON.stringify(t))}};var b=function(){function t(n,i){e(this,t),this.callback=n,this.timerCalc=i,this.timer=null,this.tries=0}return o(t,[{key:"reset",value:function(){this.tries=0,clearTimeout(this.timer)}},{key:"scheduleTimeout",value:function(){var t=this;clearTimeout(this.timer),this.timer=setTimeout(function(){t.tries=t.tries+1,t.callback()},this.timerCalc(this.tries+1))}}]),t}()})}));var Xe=function(t,n){return i(this,void 0),t.receive("ok",n.onSucceed).receive("error",n.onError).receive("timeout",n.onTimeout)}.bind(void 0),Ke=function(t,n){return i(this,void 0),function(e){return i(this,void 0),e[t]&&e[t](n)}.bind(this)}.bind(void 0),Ye=function(t){return i(this,void 0),"on"+String(t)}.bind(void 0),Qe=function(t,n,e){return i(this,void 0),t.observers.forEach(Ke(Ye(n),e))}.bind(void 0),$e=function(t,n,e){return i(this,void 0),t.findIndex(_e([n],e))}.bind(void 0),Ze=function(t){return i(this,void 0),function(n){return i(this,void 0),rn($e(n,"request",t),1,n)}.bind(this)}.bind(void 0),ti=function(t,n){return i(this,void 0),t.notifiers=n(t.notifiers),t}.bind(void 0),ni=function(t,n){i(this,void 0),ti(t,Ze(n)),Qe(n,"Cancel",n)}.bind(void 0),ei={onError:function(t,n,e){i(this,void 0),ii(t,n),Qe(n,"Error","unsubscribe: "+String(e))}.bind(void 0),onTimeout:function(t,n){return i(this,void 0),Qe(n,"Error","unsubscribe: timeout")}.bind(void 0),onSucceed:ni},ii=function(t,n){return i(this,void 0),Xe(t.channel.push("unsubscribe",{subscriptionId:n.subscriptionId}),We(ei,t,n.request))}.bind(void 0),ri=function(t,n){return i(this,void 0),"subscription"===n.operationType?ii(t,n):ni(t,n),t}.bind(void 0),oi=function(t,n,e){return i(this,void 0),t.forEach(function(t){return i(this,void 0),Qe(t,n,e)}.bind(this))}.bind(void 0),ui=function(t){return i(this,void 0),t.map(function(t){var n=t.column,e=t.line;return i(this,void 0),String(e)+":"+String(n)}.bind(this)).join("; ")}.bind(void 0),si=function(t){var n=t.message,e=t.locations;return i(this,void 0),n+(e?" ("+String(ui(e))+")":"")}.bind(void 0),ci=function(t){return i(this,void 0),t.map(si).join("\n")}.bind(void 0),ai=/^\s*(query|mutation|subscription|\{)/,fi=function(t){return i(this,void 0),"{"===t?"query":t}.bind(void 0),hi=function(t){i(this,void 0);var n=t.match(ai);if(!n)throw new TypeError("Invalid operation:\n"+String(t));return fi(n[1])}.bind(void 0),li=function(t){return i(this,void 0),function(n){return i(this,void 0),on($e(n,"request",t),[t],n)}.bind(this)}.bind(void 0),di=function(t,n,e){i(this,void 0),ti(t,Ze(n)),Qe(n,"Result",e.payload.result)}.bind(void 0),vi=function(t){return i(this,void 0),Qe(t,"Start",t)}.bind(void 0),pi=function(t,n,e){var r=e.subscriptionId;i(this,void 0),ti(t,li(zt({},n,{subscriptionId:r}))),vi(n)}.bind(void 0),yi=function(t,n,e){i(this,void 0),e.subscriptionId?pi(t,n,e):e.payload&&di(t,n,e)}.bind(void 0),bi=function(t,n,e){i(this,void 0),ti(t,Ze(n)),Qe(n,"Abort",e)}.bind(void 0),mi=function(t,n,e){return i(this,void 0),bi(t,n,new Error(e))}.bind(void 0),gi=function(t,n,e){i(this,void 0),e.errors?mi(t,n,ci(e.errors)):yi(t,n,e)}.bind(void 0),ki=function(t,n){return i(this,void 0),Qe(n,"Error",new Error("request: timeout"))}.bind(void 0),ji={onError:mi,onSucceed:gi,onTimeout:ki},Si=function(t,n){i(this,void 0),"subscription"!==n.operationType&&vi(n),Xe(t.channel.push("doc",n.request),We(ji,t,n.request))}.bind(void 0),wi=function(t){return i(this,void 0),{onError:function(n){return i(this,void 0),oi(t.notifiers,"Error",new Error("channel join: "+String(n)))}.bind(this),onSucceed:function(){i(this,void 0),t.isJoining=!1,t.notifiers.forEach(function(n){return i(this,void 0),Si(t,n)}.bind(this))}.bind(this),onTimeout:function(){return i(this,void 0),oi(t.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),Oi=function(t){return i(this,void 0),Xe(t.channel.join(),wi(t))}.bind(void 0),_i=function(){return i(this,void 0),new Error("connection: close")}.bind(void 0),Ei=function(t,n){i(this,void 0),ti(t,Ze(n)),Qe(n,"Abort",_i())}.bind(void 0),Ti=function(t){return i(this,void 0),function(n){i(this,void 0),"mutation"===n.operationType?Ei(t,n):Qe(n,"Error",_i())}.bind(this)}.bind(void 0),Ai=function(t){return i(this,void 0),function(){i(this,void 0),0!==t.notifiers.length&&(t.isJoining=!0,t.notifiers.forEach(Ti(t)))}.bind(this)}.bind(void 0),Pi=function(t,n){var e=n.payload;i(this,void 0);var r=ze(t.notifiers,"subscriptionId",e.subscriptionId);r&&Qe(r,"Result",e.result)}.bind(void 0),Ci=function(t){return i(this,void 0),function(n){i(this,void 0),"subscription:data"===n.event&&Pi(t,n)}.bind(this)}.bind(void 0),Mi=function(t){i(this,void 0),0===t.notifiers.length?t.isJoining=!1:Oi(t)}.bind(void 0),Ri=function(t){return i(this,void 0),function(){i(this,void 0),t.isJoining&&Mi(t)}.bind(this)}.bind(void 0),xi=function(t){i(this,void 0);var n={phoenixSocket:t,channel:t.channel("__absinthe__:control"),isJoining:!1,notifiers:[]};return t.onOpen(Ri(n)),t.onMessage(Ci(n)),t.onClose(Ai(n)),n}.bind(void 0),Li=function(t,n){var e=t.observers,r=Qt(t,["observers"]);return i(this,void 0),zt({},r,{observers:[].concat(qt(e),[n])})}.bind(void 0),Ii=function(t,n,e){return i(this,void 0),ti(t,li(Li(n,e)))}.bind(void 0),Ni=function(t){return i(this,void 0),{request:t,observers:[],operationType:hi(t.operation),subscriptionId:void 0}}.bind(void 0),Ji=function(t){i(this,void 0),t.isJoining=!0,t.phoenixSocket.isConnected()?Oi(t):t.phoenixSocket.connect()}.bind(void 0),qi=function(t){return i(this,void 0),t.phoenixSocket.isConnected()&&!t.isJoining}.bind(void 0),Hi=function(t,n){i(this,void 0);var e=Ni(n);return ti(t,$t([e])),qi(t)?Si(t,e):Ji(t),e}.bind(void 0),Fi=function(t,n){var e=t.observers,r=Qt(t,["observers"]);return i(this,void 0),zt({},r,{observers:rn(e.indexOf(n),1,e)})}.bind(void 0),Di=function(t,n,e){return i(this,void 0),ti(t,li(Fi(n,e))),t}.bind(void 0);t.cancel=ri,t.create=xi,t.observe=Ii,t.send=Hi,t.unobserve=Di,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.AbsinthePhoenixSocket={})}(this,function(t){"use strict";function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t,n){return n={exports:{}},t(n,n.exports),n.exports}"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var i=n(e(function(t,n){n.__esModule=!0,n.default=function(t,n){if(t!==n)throw new TypeError("Cannot instantiate an arrow function")}})),r=e(function(t,n){function e(t,n,i){return function(){var r=i.concat(Array.prototype.slice.call(arguments));return r.length>=n?t.apply(this,r):e(t,n,r)}}Object.defineProperty(n,"__esModule",{value:!0}),n.flip=function(t){return function(n,e){return t(e,n)}},n.constant=function(t){return function(){return t}},n.on=function(t,n){return function(e,i){return t(n(e),n(i))}},n.compose=function(){for(var t=this,n=arguments.length,e=Array(n),i=0;i<n;i++)e[i]=arguments[i];var r=e.length-1;return function(n){for(var i=n,o=r;o>-1;o--)i=e[o].call(t,i);return i}},n.pipe=function(){for(var t=this,n=arguments.length,e=Array(n),i=0;i<n;i++)e[i]=arguments[i];var r=e.length-1;return function(n){for(var i=n,o=0;o<=r;o++)i=e[o].call(t,i);return i}},n.curry=function(t){return e(t,t.length,[])}});n(r);var o=r.curry,u=Math.ceil,s=Math.floor,c=function(t){return isNaN(t=+t)?0:(t>0?s:u)(t)},a=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t},f=e(function(t){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)}),l=e(function(t){var n=t.exports={version:"2.5.1"};"number"==typeof __e&&(__e=n)}),h=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t},d=function(t,n,e){if(h(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,i){return t.call(n,e,i)};case 3:return function(e,i,r){return t.call(n,e,i,r)}}return function(){return t.apply(n,arguments)}},v=function(t){return"object"==typeof t?null!==t:"function"==typeof t},p=function(t){if(!v(t))throw TypeError(t+" is not an object!");return t},b=function(t){try{return!!t()}catch(t){return!0}},y=!b(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),m=f.document,g=v(m)&&v(m.createElement),w=function(t){return g?m.createElement(t):{}},k=!y&&!b(function(){return 7!=Object.defineProperty(w("div"),"a",{get:function(){return 7}}).a}),j=function(t,n){if(!v(t))return t;var e,i;if(n&&"function"==typeof(e=t.toString)&&!v(i=e.call(t)))return i;if("function"==typeof(e=t.valueOf)&&!v(i=e.call(t)))return i;if(!n&&"function"==typeof(e=t.toString)&&!v(i=e.call(t)))return i;throw TypeError("Can't convert object to primitive value")},S=Object.defineProperty,_={f:y?Object.defineProperty:function(t,n,e){if(p(t),n=j(n,!0),p(e),k)try{return S(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},O=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}},E=y?function(t,n,e){return _.f(t,n,O(1,e))}:function(t,n,e){return t[n]=e,t},T=function(t,n,e){var i,r,o,u=t&T.F,s=t&T.G,c=t&T.S,a=t&T.P,h=t&T.B,v=t&T.W,p=s?l:l[n]||(l[n]={}),b=p.prototype,y=s?f:c?f[n]:(f[n]||{}).prototype;s&&(e=n);for(i in e)(r=!u&&y&&void 0!==y[i])&&i in p||(o=r?y[i]:e[i],p[i]=s&&"function"!=typeof y[i]?e[i]:h&&r?d(o,f):v&&y[i]==o?function(t){var n=function(n,e,i){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,e)}return new t(n,e,i)}return t.apply(this,arguments)};return n.prototype=t.prototype,n}(o):a&&"function"==typeof o?d(Function.call,o):o,a&&((p.virtual||(p.virtual={}))[i]=o,t&T.R&&b&&!b[i]&&E(b,i,o)))};T.F=1,T.G=2,T.S=4,T.P=8,T.B=16,T.W=32,T.U=64,T.R=128;var x=T,P=E,A={}.hasOwnProperty,C=function(t,n){return A.call(t,n)},M={},R={}.toString,L=function(t){return R.call(t).slice(8,-1)},I=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==L(t)?t.split(""):Object(t)},N=function(t){return I(a(t))},J=Math.min,q=function(t){return t>0?J(c(t),9007199254740991):0},H=Math.max,F=Math.min,D=function(t,n){return(t=c(t))<0?H(t+n,0):F(t,n)},B=f["__core-js_shared__"]||(f["__core-js_shared__"]={}),U=function(t){return B[t]||(B[t]={})},G=0,z=Math.random(),V=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++G+z).toString(36))},W=U("keys"),X=function(t){return W[t]||(W[t]=V(t))},K=function(t){return function(n,e,i){var r,o=N(n),u=q(o.length),s=D(i,u);if(t&&e!=e){for(;u>s;)if((r=o[s++])!=r)return!0}else for(;u>s;s++)if((t||s in o)&&o[s]===e)return t||s||0;return!t&&-1}}(!1),Y=X("IE_PROTO"),Q=function(t,n){var e,i=N(t),r=0,o=[];for(e in i)e!=Y&&C(i,e)&&o.push(e);for(;n.length>r;)C(i,e=n[r++])&&(~K(o,e)||o.push(e));return o},$="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Z=Object.keys||function(t){return Q(t,$)},tt=y?Object.defineProperties:function(t,n){p(t);for(var e,i=Z(n),r=i.length,o=0;r>o;)_.f(t,e=i[o++],n[e]);return t},nt=f.document,et=nt&&nt.documentElement,it=X("IE_PROTO"),rt=function(){},ot=function(){var t,n=w("iframe"),e=$.length;for(n.style.display="none",et.appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),ot=t.F;e--;)delete ot.prototype[$[e]];return ot()},ut=Object.create||function(t,n){var e;return null!==t?(rt.prototype=p(t),e=new rt,rt.prototype=null,e[it]=t):e=ot(),void 0===n?e:tt(e,n)},st=e(function(t){var n=U("wks"),e=f.Symbol,i="function"==typeof e;(t.exports=function(t){return n[t]||(n[t]=i&&e[t]||(i?e:V)("Symbol."+t))}).store=n}),ct=_.f,at=st("toStringTag"),ft=function(t,n,e){t&&!C(t=e?t:t.prototype,at)&&ct(t,at,{configurable:!0,value:n})},lt={};E(lt,st("iterator"),function(){return this});var ht=function(t,n,e){t.prototype=ut(lt,{next:O(1,e)}),ft(t,n+" Iterator")},dt=function(t){return Object(a(t))},vt=X("IE_PROTO"),pt=Object.prototype,bt=Object.getPrototypeOf||function(t){return t=dt(t),C(t,vt)?t[vt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?pt:null},yt=st("iterator"),mt=!([].keys&&"next"in[].keys()),gt=function(){return this},wt=function(t,n,e,i,r,o,u){ht(e,n,i);var s,c,a,f=function(t){if(!mt&&t in v)return v[t];switch(t){case"keys":case"values":return function(){return new e(this,t)}}return function(){return new e(this,t)}},l=n+" Iterator",h="values"==r,d=!1,v=t.prototype,p=v[yt]||v["@@iterator"]||r&&v[r],b=p||f(r),y=r?h?f("entries"):b:void 0,m="Array"==n?v.entries||p:p;if(m&&(a=bt(m.call(new t)))!==Object.prototype&&a.next&&ft(a,l,!0),h&&p&&"values"!==p.name&&(d=!0,b=function(){return p.call(this)}),u&&(mt||d||!v[yt])&&E(v,yt,b),M[n]=b,M[l]=gt,r)if(s={values:h?b:f("values"),keys:o?b:f("keys"),entries:y},u)for(c in s)c in v||P(v,c,s[c]);else x(x.P+x.F*(mt||d),n,s);return s},kt=function(t){return function(n,e){var i,r,o=String(a(n)),u=c(e),s=o.length;return u<0||u>=s?t?"":void 0:(i=o.charCodeAt(u))<55296||i>56319||u+1===s||(r=o.charCodeAt(u+1))<56320||r>57343?t?o.charAt(u):i:t?o.slice(u,u+2):r-56320+(i-55296<<10)+65536}}(!0);wt(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,e=this._i;return e>=n.length?{value:void 0,done:!0}:(t=kt(n,e),this._i+=t.length,{value:t,done:!1})});var jt=function(t,n,e,i){try{return i?n(p(e)[0],e[1]):n(e)}catch(n){var r=t.return;throw void 0!==r&&p(r.call(t)),n}},St=st("iterator"),_t=Array.prototype,Ot=function(t){return void 0!==t&&(M.Array===t||_t[St]===t)},Et=function(t,n,e){n in t?_.f(t,n,O(0,e)):t[n]=e},Tt=st("toStringTag"),xt="Arguments"==L(function(){return arguments}()),Pt=function(t,n){try{return t[n]}catch(t){}},At=function(t){var n,e,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=Pt(n=Object(t),Tt))?e:xt?L(n):"Object"==(i=L(n))&&"function"==typeof n.callee?"Arguments":i},Ct=st("iterator"),Mt=l.getIteratorMethod=function(t){if(void 0!=t)return t[Ct]||t["@@iterator"]||M[At(t)]},Rt=st("iterator"),Lt=!1;try{[7][Rt]().return=function(){Lt=!0}}catch(t){}x(x.S+x.F*!function(t,n){if(!n&&!Lt)return!1;var e=!1;try{var i=[7],r=i[Rt]();r.next=function(){return{done:e=!0}},i[Rt]=function(){return r},t(i)}catch(t){}return e}(function(t){}),"Array",{from:function(t){var n,e,i,r,o=dt(t),u="function"==typeof this?this:Array,s=arguments.length,c=s>1?arguments[1]:void 0,a=void 0!==c,f=0,l=Mt(o);if(a&&(c=d(c,s>2?arguments[2]:void 0,2)),void 0==l||u==Array&&Ot(l))for(e=new u(n=q(o.length));n>f;f++)Et(e,f,a?c(o[f],f):o[f]);else for(r=l.call(o),e=new u;!(i=r.next()).done;f++)Et(e,f,a?jt(r,c,[i.value,f],!0):i.value);return e.length=f,e}});var It=l.Array.from,Nt=e(function(t){t.exports={default:It,__esModule:!0}}),Jt=n(Nt),qt=n(e(function(t,n){n.__esModule=!0;var e=function(t){return t&&t.__esModule?t:{default:t}}(Nt);n.default=function(t){if(Array.isArray(t)){for(var n=0,i=Array(t.length);n<t.length;n++)i[n]=t[n];return i}return(0,e.default)(t)}})),Ht={f:Object.getOwnPropertySymbols},Ft={f:{}.propertyIsEnumerable},Dt=Object.assign,Bt=!Dt||b(function(){var t={},n={},e=Symbol(),i="abcdefghijklmnopqrst";return t[e]=7,i.split("").forEach(function(t){n[t]=t}),7!=Dt({},t)[e]||Object.keys(Dt({},n)).join("")!=i})?function(t,n){for(var e=dt(t),i=arguments.length,r=1,o=Ht.f,u=Ft.f;i>r;)for(var s,c=I(arguments[r++]),a=o?Z(c).concat(o(c)):Z(c),f=a.length,l=0;f>l;)u.call(c,s=a[l++])&&(e[s]=c[s]);return e}:Dt;x(x.S+x.F,"Object",{assign:Bt});var Ut=l.Object.assign,Gt=e(function(t){t.exports={default:Ut,__esModule:!0}});n(Gt);var zt=n(e(function(t,n){n.__esModule=!0;var e=function(t){return t&&t.__esModule?t:{default:t}}(Gt);n.default=e.default||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t}}));!function(t,n){var e=(l.Object||{})[t]||Object[t],i={};i[t]=n(e),x(x.S+x.F*b(function(){e(1)}),"Object",i)}("keys",function(){return function(t){return Z(dt(t))}});var Vt=l.Object.keys,Wt=n(e(function(t){t.exports={default:Vt,__esModule:!0}})),Xt=Math.floor;x(x.S,"Number",{isInteger:function(t){return!v(t)&&isFinite(t)&&Xt(t)===t}});var Kt=l.Number.isInteger,Yt=n(e(function(t){t.exports={default:Kt,__esModule:!0}})),Qt=n(e(function(t,n){n.__esModule=!0,n.default=function(t,n){var e={};for(var i in t)n.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}})),$t=o(function(t,n){return i(this,void 0),[].concat(qt(n),qt(t))}.bind(void 0)),Zt=(function(t){return i(this,void 0),Array.isArray(t)?t:[t]}.bind(void 0),o(function(t,n){return i(this,void 0),n===t.length-1}.bind(void 0))),tn=(o(function(t,n){return i(this,void 0),Zt(t,n)?0:n+1}.bind(void 0)),function(t){return i(this,void 0),Math.max.apply(Math,qt(Wt(t)))+1}.bind(void 0)),nn=(function(t){return i(this,void 0),Jt("length"in t?t:zt({},t,{length:tn(t)}))}.bind(void 0),o(function(t,n,e){return i(this,void 0),[].concat(qt(e.slice(0,t)),qt(n),qt(e.slice(t+1)))}.bind(void 0)),function(t,n){return i(this,void 0),Yt(t)&&t>=n}.bind(void 0)),en=function(t){return i(this,void 0),nn(Number(t),0)}.bind(void 0),rn=(function(t){t.length;var n=Qt(t,["length"]);return i(this,void 0),Wt(n).every(en)}.bind(void 0),o(function(t,n){return i(this,void 0),[].concat(qt(t),qt(n))}.bind(void 0)),o(function(t,n,e,r){return i(this,void 0),r.reduce(function(e,r,o){return i(this,void 0),t(r,o,e)?n(e,r,o):e}.bind(this),e)}.bind(void 0)),o(function(t,n,e,r){i(this,void 0);var o=e;return r.every(function(e,r){i(this,void 0);var u=t(e,r,o);return u&&(o=n(o,e,r)),u}.bind(this)),o}.bind(void 0)),o(function(t,n,e){return i(this,void 0),[].concat(qt(e.slice(0,t)),qt(e.slice(t+n)))}.bind(void 0))),on=(o(function(t,n){return i(this,void 0),[].concat(qt(Array(t))).map(function(){return i(this,void 0),n}.bind(this))}.bind(void 0)),o(function(t,n,e){return i(this,void 0),[].concat(qt(e.slice(0,t)),qt(n),qt(e.slice(t+n.length)))}.bind(void 0)));o(function(t,n){return i(this,void 0),n<0?t.length-n:n}.bind(void 0));x(x.S+x.F*!y,"Object",{defineProperty:_.f});var un=l.Object,sn=function(t,n,e){return un.defineProperty(t,n,e)},cn=e(function(t){t.exports={default:sn,__esModule:!0}});n(cn);var an=n(e(function(t,n){n.__esModule=!0;var e=function(t){return t&&t.__esModule?t:{default:t}}(cn);n.default=function(t,n,i){return n in t?(0,e.default)(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}})),fn=function(t,n){return{value:n,done:!!t}};wt(Array,"Array",function(t,n){this._t=N(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,e=this._i++;return!t||e>=t.length?(this._t=void 0,fn(1)):"keys"==n?fn(0,e):"values"==n?fn(0,t[e]):fn(0,[e,t[e]])},"values");M.Arguments=M.Array;for(var ln=st("toStringTag"),hn="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),dn=0;dn<hn.length;dn++){var vn=hn[dn],pn=f[vn],bn=pn&&pn.prototype;bn&&!bn[ln]&&E(bn,ln,vn),M[vn]=M.Array}var yn=st("iterator"),mn=l.isIterable=function(t){var n=Object(t);return void 0!==n[yn]||"@@iterator"in n||M.hasOwnProperty(At(n))},gn=e(function(t){t.exports={default:mn,__esModule:!0}});n(gn);var wn=l.getIterator=function(t){var n=Mt(t);if("function"!=typeof n)throw TypeError(t+" is not iterable!");return p(n.call(t))},kn=e(function(t){t.exports={default:wn,__esModule:!0}});n(kn);var jn=n(e(function(t,n){function e(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0;var i=e(gn),r=e(kn);n.default=function(){function t(t,n){var e=[],i=!0,o=!1,u=void 0;try{for(var s,c=(0,r.default)(t);!(i=(s=c.next()).done)&&(e.push(s.value),!n||e.length!==n);i=!0);}catch(t){o=!0,u=t}finally{try{!i&&c.return&&c.return()}finally{if(o)throw u}}return e}return function(n,e){if(Array.isArray(n))return n;if((0,i.default)(Object(n)))return t(n,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()})),Sn=Ft.f,_n=function(t){return function(n){for(var e,i=N(n),r=Z(i),o=r.length,u=0,s=[];o>u;)Sn.call(i,e=r[u++])&&s.push(t?[e,i[e]]:i[e]);return s}}(!0);x(x.S,"Object",{entries:function(t){return _n(t)}});var On=l.Object.entries,En=n(e(function(t){t.exports={default:On,__esModule:!0}})),Tn=e(function(t){var n=V("meta"),e=_.f,i=0,r=Object.isExtensible||function(){return!0},o=!b(function(){return r(Object.preventExtensions({}))}),u=function(t){e(t,n,{value:{i:"O"+ ++i,w:{}}})},s=t.exports={KEY:n,NEED:!1,fastKey:function(t,e){if(!v(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!C(t,n)){if(!r(t))return"F";if(!e)return"E";u(t)}return t[n].i},getWeak:function(t,e){if(!C(t,n)){if(!r(t))return!0;if(!e)return!1;u(t)}return t[n].w},onFreeze:function(t){return o&&s.NEED&&r(t)&&!C(t,n)&&u(t),t}}}),xn={f:st},Pn=_.f,An=function(t){var n=l.Symbol||(l.Symbol={});"_"==t.charAt(0)||t in n||Pn(n,t,{value:xn.f(t)})},Cn=function(t){var n=Z(t),e=Ht.f;if(e)for(var i,r=e(t),o=Ft.f,u=0;r.length>u;)o.call(t,i=r[u++])&&n.push(i);return n},Mn=Array.isArray||function(t){return"Array"==L(t)},Rn=$.concat("length","prototype"),Ln={f:Object.getOwnPropertyNames||function(t){return Q(t,Rn)}},In=Ln.f,Nn={}.toString,Jn="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],qn=function(t){try{return In(t)}catch(t){return Jn.slice()}},Hn={f:function(t){return Jn&&"[object Window]"==Nn.call(t)?qn(t):In(N(t))}},Fn=Object.getOwnPropertyDescriptor,Dn={f:y?Fn:function(t,n){if(t=N(t),n=j(n,!0),k)try{return Fn(t,n)}catch(t){}if(C(t,n))return O(!Ft.f.call(t,n),t[n])}},Bn=Tn.KEY,Un=Dn.f,Gn=_.f,zn=Hn.f,Vn=f.Symbol,Wn=f.JSON,Xn=Wn&&Wn.stringify,Kn=st("_hidden"),Yn=st("toPrimitive"),Qn={}.propertyIsEnumerable,$n=U("symbol-registry"),Zn=U("symbols"),te=U("op-symbols"),ne=Object.prototype,ee="function"==typeof Vn,ie=f.QObject,re=!ie||!ie.prototype||!ie.prototype.findChild,oe=y&&b(function(){return 7!=ut(Gn({},"a",{get:function(){return Gn(this,"a",{value:7}).a}})).a})?function(t,n,e){var i=Un(ne,n);i&&delete ne[n],Gn(t,n,e),i&&t!==ne&&Gn(ne,n,i)}:Gn,ue=function(t){var n=Zn[t]=ut(Vn.prototype);return n._k=t,n},se=ee&&"symbol"==typeof Vn.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof Vn},ce=function(t,n,e){return t===ne&&ce(te,n,e),p(t),n=j(n,!0),p(e),C(Zn,n)?(e.enumerable?(C(t,Kn)&&t[Kn][n]&&(t[Kn][n]=!1),e=ut(e,{enumerable:O(0,!1)})):(C(t,Kn)||Gn(t,Kn,O(1,{})),t[Kn][n]=!0),oe(t,n,e)):Gn(t,n,e)},ae=function(t,n){p(t);for(var e,i=Cn(n=N(n)),r=0,o=i.length;o>r;)ce(t,e=i[r++],n[e]);return t},fe=function(t){var n=Qn.call(this,t=j(t,!0));return!(this===ne&&C(Zn,t)&&!C(te,t))&&(!(n||!C(this,t)||!C(Zn,t)||C(this,Kn)&&this[Kn][t])||n)},le=function(t,n){if(t=N(t),n=j(n,!0),t!==ne||!C(Zn,n)||C(te,n)){var e=Un(t,n);return!e||!C(Zn,n)||C(t,Kn)&&t[Kn][n]||(e.enumerable=!0),e}},he=function(t){for(var n,e=zn(N(t)),i=[],r=0;e.length>r;)C(Zn,n=e[r++])||n==Kn||n==Bn||i.push(n);return i},de=function(t){for(var n,e=t===ne,i=zn(e?te:N(t)),r=[],o=0;i.length>o;)!C(Zn,n=i[o++])||e&&!C(ne,n)||r.push(Zn[n]);return r};ee||(P((Vn=function(){if(this instanceof Vn)throw TypeError("Symbol is not a constructor!");var t=V(arguments.length>0?arguments[0]:void 0),n=function(e){this===ne&&n.call(te,e),C(this,Kn)&&C(this[Kn],t)&&(this[Kn][t]=!1),oe(this,t,O(1,e))};return y&&re&&oe(ne,t,{configurable:!0,set:n}),ue(t)}).prototype,"toString",function(){return this._k}),Dn.f=le,_.f=ce,Ln.f=Hn.f=he,Ft.f=fe,Ht.f=de,xn.f=function(t){return ue(st(t))}),x(x.G+x.W+x.F*!ee,{Symbol:Vn});for(var ve="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),pe=0;ve.length>pe;)st(ve[pe++]);for(var be=Z(st.store),ye=0;be.length>ye;)An(be[ye++]);x(x.S+x.F*!ee,"Symbol",{for:function(t){return C($n,t+="")?$n[t]:$n[t]=Vn(t)},keyFor:function(t){if(!se(t))throw TypeError(t+" is not a symbol!");for(var n in $n)if($n[n]===t)return n},useSetter:function(){re=!0},useSimple:function(){re=!1}}),x(x.S+x.F*!ee,"Object",{create:function(t,n){return void 0===n?ut(t):ae(ut(t),n)},defineProperty:ce,defineProperties:ae,getOwnPropertyDescriptor:le,getOwnPropertyNames:he,getOwnPropertySymbols:de}),Wn&&x(x.S+x.F*(!ee||b(function(){var t=Vn();return"[null]"!=Xn([t])||"{}"!=Xn({a:t})||"{}"!=Xn(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!se(t)){for(var n,e,i=[t],r=1;arguments.length>r;)i.push(arguments[r++]);return"function"==typeof(n=i[1])&&(e=n),!e&&Mn(n)||(n=function(t,n){if(e&&(n=e.call(this,t,n)),!se(n))return n}),i[1]=n,Xn.apply(Wn,i)}}}),Vn.prototype[Yn]||E(Vn.prototype,Yn,Vn.prototype.valueOf),ft(Vn,"Symbol"),ft(Math,"Math",!0),ft(f.JSON,"JSON",!0),An("asyncIterator"),An("observable");var me=l.Symbol,ge=n(e(function(t){t.exports={default:me,__esModule:!0}})),we=o(function(t,n){return i(this,void 0),n[t]}.bind(void 0)),ke=o(function(t,n){return i(this,void 0),Object.prototype.hasOwnProperty.call(n,t)}.bind(void 0)),je=function(t,n,e){return i(this,void 0),Zt(n,t)?we(n[t],e):ke(n[t],e)?je(t+1,n,we(n[t],e)):void 0}.bind(void 0),Se=o(function(t,n){return i(this,void 0),0===t.length?void 0:je(0,t,n)}.bind(void 0)),_e=function(t){return i(this,void 0),Array.isArray(t)?[].concat(qt(t.keys())):Wt(t)}.bind(void 0),Oe=o(function(t,n,e){return i(this,void 0),Se(t,e)===n}.bind(void 0)),Ee=o(function(t,n){i(this,void 0);var e=_e(t);return e.length===_e(n).length&&e.every(function(e){return i(this,void 0),ke(e,n)&&we(e,t)===we(e,n)}.bind(this))}.bind(void 0)),Te=function(t,n){return i(this,void 0),En(n).reduce(function(e,r){var o=jn(r,2),u=o[0],s=o[1];return i(this,void 0),zt({},e,an({},u,t(s,u,n)))}.bind(this),{})}.bind(void 0),xe=o(function(t,n){return i(this,void 0),Array.isArray(n)?n.map(t):Te(t,n)}.bind(void 0)),Pe=function(t,n){n[t];var e=Qt(n,[t]);return i(this,void 0),e}.bind(void 0),Ae=o(function(t,n){return i(this,void 0),Array.isArray(n)?rn(t,1,n):Pe(t,n)}.bind(void 0)),Ce=function(t){return i(this,void 0),Array.isArray(t)?[].concat(qt(t)):zt({},t)}.bind(void 0),Me=function(t){i(this,void 0);var n=Ce(t);return{origin:n,previous:void 0,current:n}}.bind(void 0),Re=function(t){return i(this,void 0),"number"==typeof t?[]:{}}.bind(void 0),Le=function(t,n,e){return i(this,void 0),ke(t,e)?Ce(we(t,e)):Re(n)}.bind(void 0),Ie=function(t,n,e,r){return i(this,void 0),Zt(t,e)?n(we(t[e],r)):Le(t[e],t[e+1],r)}.bind(void 0),Ne=function(t,n,e){return i(this,void 0),e[t]=n,we(t,e)}.bind(void 0),Je=function(t,n,e,r){return i(this,void 0),zt({},r,{current:Ne(t[n],e,r.current)})}.bind(void 0),qe=function(t,n,e){i(this,void 0);var r=Ae(t[n],e.current);return 0===n?zt({},e,{current:r,origin:r}):zt({},e,{previous:Ne(t[n-1],r,e.previous)})}.bind(void 0),He=ge("composite.updateIn.removeAction"),Fe=function(t,n,e,r){return i(this,void 0),e===He?qe(t,n,r):Je(t,n,e,r)}.bind(void 0),De=function(t,n){return i(this,void 0),function(e,r,o){return i(this,void 0),Fe(t,o,Ie(t,n,o,e.current),e)}.bind(this)}.bind(void 0),Be=o(function(t,n,e){return i(this,void 0),0===t.length?e:t.reduce(De(t,n),Me(e)).origin}.bind(void 0));Be.remove=He;var Ue=function(){return i(this,void 0),Be.remove}.bind(void 0),Ge=(o(function(t,n){return i(this,void 0),Be(t,Ue,n)}.bind(void 0)),o(function(t,n,e){i(this,void 0);var r=Ce(e);return r[t]=n,r}.bind(void 0)),o(function(t,n,e){return i(this,void 0),Be(t,function(){return i(this,void 0),n}.bind(this),e)}.bind(void 0)),function(t,n){return i(this,void 0),Boolean(Number(t)^Number(n))}.bind(void 0)),ze=(o(function(t,n){return i(this,void 0),t===n||!Ge(Array.isArray(t),Array.isArray(n))&&Ee(t,n)}.bind(void 0)),function(t,n,e){return i(this,void 0),t.find(Oe([n],e))}.bind(void 0)),Ve=function(t,n){return i(this,void 0),function(e){return i(this,void 0),function(){for(var r=arguments.length,o=Array(r),u=0;u<r;u++)o[u]=arguments[u];i(this,void 0);var s=ze(t.notifiers,"request",n);s&&e.apply(void 0,[t,s].concat(o))}.bind(this)}.bind(this)}.bind(void 0),We=function(t,n,e){return i(this,void 0),xe(Ve(n,e),t)}.bind(void 0);n(e(function(t,n){!function(t,e){e(n)}(0,function(t){function n(t){if(Array.isArray(t)){for(var n=0,e=Array(t.length);n<t.length;n++)e[n]=t[n];return e}return Array.from(t)}function e(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function(){function t(t,n){var e=[],i=!0,r=!1,o=void 0;try{for(var u,s=t[Symbol.iterator]();!(i=(u=s.next()).done)&&(e.push(u.value),!n||e.length!==n);i=!0);}catch(t){r=!0,o=t}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return e}return function(n,e){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return t(n,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function t(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(n,e,i){return e&&t(n.prototype,e),i&&t(n,i),n}}(),u={connecting:0,open:1,closing:2,closed:3},s=1e4,c={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},a={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},f=[a.close,a.error,a.join,a.reply,a.leave],l={longpoll:"longpoll",websocket:"websocket"},h=function(){function t(n,i,r,o){e(this,t),this.channel=n,this.event=i,this.payload=r||{},this.receivedResp=null,this.timeout=o,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}return o(t,[{key:"resend",value:function(t){this.timeout=t,this.reset(),this.send()}},{key:"send",value:function(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel.joinRef()}))}},{key:"receive",value:function(t,n){return this.hasReceived(t)&&n(this.receivedResp.response),this.recHooks.push({status:t,callback:n}),this}},{key:"reset",value:function(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}},{key:"matchReceive",value:function(t){var n=t.status,e=t.response;this.recHooks.filter(function(t){return t.status===n}).forEach(function(t){return t.callback(e)})}},{key:"cancelRefEvent",value:function(){this.refEvent&&this.channel.off(this.refEvent)}},{key:"cancelTimeout",value:function(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}},{key:"startTimeout",value:function(){var t=this;this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,function(n){t.cancelRefEvent(),t.cancelTimeout(),t.receivedResp=n,t.matchReceive(n)}),this.timeoutTimer=setTimeout(function(){t.trigger("timeout",{})},this.timeout)}},{key:"hasReceived",value:function(t){return this.receivedResp&&this.receivedResp.status===t}},{key:"trigger",value:function(t,n){this.channel.trigger(this.refEvent,{status:t,response:n})}}]),t}(),d=t.Channel=function(){function t(n,i,r){var o=this;e(this,t),this.state=c.closed,this.topic=n,this.params=i||{},this.socket=r,this.bindings=[],this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new h(this,a.join,this.params,this.timeout),this.pushBuffer=[],this.rejoinTimer=new y(function(){return o.rejoinUntilConnected()},this.socket.reconnectAfterMs),this.joinPush.receive("ok",function(){o.state=c.joined,o.rejoinTimer.reset(),o.pushBuffer.forEach(function(t){return t.send()}),o.pushBuffer=[]}),this.onClose(function(){o.rejoinTimer.reset(),o.socket.log("channel","close "+o.topic+" "+o.joinRef()),o.state=c.closed,o.socket.remove(o)}),this.onError(function(t){o.isLeaving()||o.isClosed()||(o.socket.log("channel","error "+o.topic,t),o.state=c.errored,o.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",function(){o.isJoining()&&(o.socket.log("channel","timeout "+o.topic+" ("+o.joinRef()+")",o.joinPush.timeout),new h(o,a.leave,{},o.timeout).send(),o.state=c.errored,o.joinPush.reset(),o.rejoinTimer.scheduleTimeout())}),this.on(a.reply,function(t,n){o.trigger(o.replyEventName(n),t)})}return o(t,[{key:"rejoinUntilConnected",value:function(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this.rejoin()}},{key:"join",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;if(this.joinedOnce)throw"tried to join multiple times. 'join' can only be called a single time per channel instance";return this.joinedOnce=!0,this.rejoin(t),this.joinPush}},{key:"onClose",value:function(t){this.on(a.close,t)}},{key:"onError",value:function(t){this.on(a.error,function(n){return t(n)})}},{key:"on",value:function(t,n){this.bindings.push({event:t,callback:n})}},{key:"off",value:function(t){this.bindings=this.bindings.filter(function(n){return n.event!==t})}},{key:"canPush",value:function(){return this.socket.isConnected()&&this.isJoined()}},{key:"push",value:function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.timeout;if(!this.joinedOnce)throw"tried to push '"+t+"' to '"+this.topic+"' before joining. Use channel.join() before pushing events";var i=new h(this,t,n,e);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}},{key:"leave",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.state=c.leaving;var e=function(){t.socket.log("channel","leave "+t.topic),t.trigger(a.close,"leave")},i=new h(this,a.leave,{},n);return i.receive("ok",function(){return e()}).receive("timeout",function(){return e()}),i.send(),this.canPush()||i.trigger("ok",{}),i}},{key:"onMessage",value:function(t,n,e){return n}},{key:"isMember",value:function(t,n,e,i){if(this.topic!==t)return!1;var r=f.indexOf(n)>=0;return!i||!r||i===this.joinRef()||(this.socket.log("channel","dropping outdated message",{topic:t,event:n,payload:e,joinRef:i}),!1)}},{key:"joinRef",value:function(){return this.joinPush.ref}},{key:"sendJoin",value:function(t){this.state=c.joining,this.joinPush.resend(t)}},{key:"rejoin",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.isLeaving()||this.sendJoin(t)}},{key:"trigger",value:function(t,n,e,i){var r=this,o=this.onMessage(t,n,e,i);if(n&&!o)throw"channel onMessage callbacks must return the payload, modified or unmodified";this.bindings.filter(function(n){return n.event===t}).map(function(t){return t.callback(o,e,i||r.joinRef())})}},{key:"replyEventName",value:function(t){return"chan_reply_"+t}},{key:"isClosed",value:function(){return this.state===c.closed}},{key:"isErrored",value:function(){return this.state===c.errored}},{key:"isJoined",value:function(){return this.state===c.joined}},{key:"isJoining",value:function(){return this.state===c.joining}},{key:"isLeaving",value:function(){return this.state===c.leaving}}]),t}(),v={encode:function(t,n){var e=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(e))},decode:function(t,n){var e=JSON.parse(t),i=r(e,5);return n({join_ref:i[0],ref:i[1],topic:i[2],event:i[3],payload:i[4]})}},p=(t.Socket=function(){function t(n){var i=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e(this,t),this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=r.timeout||s,this.transport=r.transport||window.WebSocket||p,this.defaultEncoder=v.encode,this.defaultDecoder=v.decode,this.transport!==p?(this.encode=r.encode||this.defaultEncoder,this.decode=r.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder),this.heartbeatIntervalMs=r.heartbeatIntervalMs||3e4,this.reconnectAfterMs=r.reconnectAfterMs||function(t){return[1e3,2e3,5e3,1e4][t-1]||1e4},this.logger=r.logger||function(){},this.longpollerTimeout=r.longpollerTimeout||2e4,this.params=r.params||{},this.endPoint=n+"/"+l.websocket,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new y(function(){i.disconnect(function(){return i.connect()})},this.reconnectAfterMs)}return o(t,[{key:"protocol",value:function(){return location.protocol.match(/^https/)?"wss":"ws"}},{key:"endPointURL",value:function(){var t=b.appendParams(b.appendParams(this.endPoint,this.params),{vsn:"2.0.0"});return"/"!==t.charAt(0)?t:"/"===t.charAt(1)?this.protocol()+":"+t:this.protocol()+"://"+location.host+t}},{key:"disconnect",value:function(t,n,e){this.conn&&(this.conn.onclose=function(){},n?this.conn.close(n,e||""):this.conn.close(),this.conn=null),t&&t()}},{key:"connect",value:function(t){var n=this;t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=t),this.conn||(this.conn=new this.transport(this.endPointURL()),this.conn.timeout=this.longpollerTimeout,this.conn.onopen=function(){return n.onConnOpen()},this.conn.onerror=function(t){return n.onConnError(t)},this.conn.onmessage=function(t){return n.onConnMessage(t)},this.conn.onclose=function(t){return n.onConnClose(t)})}},{key:"log",value:function(t,n,e){this.logger(t,n,e)}},{key:"onOpen",value:function(t){this.stateChangeCallbacks.open.push(t)}},{key:"onClose",value:function(t){this.stateChangeCallbacks.close.push(t)}},{key:"onError",value:function(t){this.stateChangeCallbacks.error.push(t)}},{key:"onMessage",value:function(t){this.stateChangeCallbacks.message.push(t)}},{key:"onConnOpen",value:function(){var t=this;this.log("transport","connected to "+this.endPointURL()),this.flushSendBuffer(),this.reconnectTimer.reset(),this.conn.skipHeartbeat||(clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(function(){return t.sendHeartbeat()},this.heartbeatIntervalMs)),this.stateChangeCallbacks.open.forEach(function(t){return t()})}},{key:"onConnClose",value:function(t){this.log("transport","close",t),this.triggerChanError(),clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(function(n){return n(t)})}},{key:"onConnError",value:function(t){this.log("transport",t),this.triggerChanError(),this.stateChangeCallbacks.error.forEach(function(n){return n(t)})}},{key:"triggerChanError",value:function(){this.channels.forEach(function(t){return t.trigger(a.error)})}},{key:"connectionState",value:function(){switch(this.conn&&this.conn.readyState){case u.connecting:return"connecting";case u.open:return"open";case u.closing:return"closing";default:return"closed"}}},{key:"isConnected",value:function(){return"open"===this.connectionState()}},{key:"remove",value:function(t){this.channels=this.channels.filter(function(n){return n.joinRef()!==t.joinRef()})}},{key:"channel",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=new d(t,n,this);return this.channels.push(e),e}},{key:"push",value:function(t){var n=this,e=t.topic,i=t.event,r=t.payload,o=t.ref,u=t.join_ref,s=function(){n.encode(t,function(t){n.conn.send(t)})};this.log("push",e+" "+i+" ("+u+", "+o+")",r),this.isConnected()?s():this.sendBuffer.push(s)}},{key:"makeRef",value:function(){var t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}},{key:"sendHeartbeat",value:function(){if(this.isConnected()){if(this.pendingHeartbeatRef)return this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),void this.conn.close(1e3,"hearbeat timeout");this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef})}}},{key:"flushSendBuffer",value:function(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(function(t){return t()}),this.sendBuffer=[])}},{key:"onConnMessage",value:function(t){var n=this;this.decode(t.data,function(t){var e=t.topic,i=t.event,r=t.payload,o=t.ref,u=t.join_ref;o&&o===n.pendingHeartbeatRef&&(n.pendingHeartbeatRef=null),n.log("receive",(r.status||"")+" "+e+" "+i+" "+(o&&"("+o+")"||""),r),n.channels.filter(function(t){return t.isMember(e,i,r,u)}).forEach(function(t){return t.trigger(i,r,o,u)}),n.stateChangeCallbacks.message.forEach(function(n){return n(t)})})}}]),t}(),t.LongPoll=function(){function t(n){e(this,t),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(n),this.readyState=u.connecting,this.poll()}return o(t,[{key:"normalizeEndpoint",value:function(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+l.websocket),"$1/"+l.longpoll)}},{key:"endpointURL",value:function(){return b.appendParams(this.pollEndpoint,{token:this.token})}},{key:"closeAndRetry",value:function(){this.close(),this.readyState=u.connecting}},{key:"ontimeout",value:function(){this.onerror("timeout"),this.closeAndRetry()}},{key:"poll",value:function(){var t=this;this.readyState!==u.open&&this.readyState!==u.connecting||b.request("GET",this.endpointURL(),"application/json",null,this.timeout,this.ontimeout.bind(this),function(n){if(n){var e=n.status,i=n.token,r=n.messages;t.token=i}else e=0;switch(e){case 200:r.forEach(function(n){return t.onmessage({data:n})}),t.poll();break;case 204:t.poll();break;case 410:t.readyState=u.open,t.onopen(),t.poll();break;case 0:case 500:t.onerror(),t.closeAndRetry();break;default:throw"unhandled poll status "+e}})}},{key:"send",value:function(t){var n=this;b.request("POST",this.endpointURL(),"application/json",t,this.timeout,this.onerror.bind(this,"timeout"),function(t){t&&200===t.status||(n.onerror(t&&t.status),n.closeAndRetry())})}},{key:"close",value:function(t,n){this.readyState=u.closed,this.onclose()}}]),t}()),b=t.Ajax=function(){function t(){e(this,t)}return o(t,null,[{key:"request",value:function(t,n,e,i,r,o,u){if(window.XDomainRequest){var s=new XDomainRequest;this.xdomainRequest(s,t,n,i,r,o,u)}else{var c=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");this.xhrRequest(c,t,n,e,i,r,o,u)}}},{key:"xdomainRequest",value:function(t,n,e,i,r,o,u){var s=this;t.timeout=r,t.open(n,e),t.onload=function(){var n=s.parseJSON(t.responseText);u&&u(n)},o&&(t.ontimeout=o),t.onprogress=function(){},t.send(i)}},{key:"xhrRequest",value:function(t,n,e,i,r,o,u,s){var c=this;t.open(n,e,!0),t.timeout=o,t.setRequestHeader("Content-Type",i),t.onerror=function(){s&&s(null)},t.onreadystatechange=function(){if(t.readyState===c.states.complete&&s){var n=c.parseJSON(t.responseText);s(n)}},u&&(t.ontimeout=u),t.send(r)}},{key:"parseJSON",value:function(t){if(!t||""===t)return null;try{return JSON.parse(t)}catch(n){return console&&console.log("failed to parse JSON response",t),null}}},{key:"serialize",value:function(t,n){var e=[];for(var r in t)if(t.hasOwnProperty(r)){var o=n?n+"["+r+"]":r,u=t[r];"object"===(void 0===u?"undefined":i(u))?e.push(this.serialize(u,o)):e.push(encodeURIComponent(o)+"="+encodeURIComponent(u))}return e.join("&")}},{key:"appendParams",value:function(t,n){return 0===Object.keys(n).length?t:""+t+(t.match(/\?/)?"&":"?")+this.serialize(n)}}]),t}();b.states={complete:4};t.Presence={syncState:function(t,n,e,i){var r=this,o=this.clone(t),u={},s={};return this.map(o,function(t,e){n[t]||(s[t]=e)}),this.map(n,function(t,n){var e=o[t];if(e){var i=n.metas.map(function(t){return t.phx_ref}),c=e.metas.map(function(t){return t.phx_ref}),a=n.metas.filter(function(t){return c.indexOf(t.phx_ref)<0}),f=e.metas.filter(function(t){return i.indexOf(t.phx_ref)<0});a.length>0&&(u[t]=n,u[t].metas=a),f.length>0&&(s[t]=r.clone(e),s[t].metas=f)}else u[t]=n}),this.syncDiff(o,{joins:u,leaves:s},e,i)},syncDiff:function(t,e,i,r){var o=e.joins,u=e.leaves,s=this.clone(t);return i||(i=function(){}),r||(r=function(){}),this.map(o,function(t,e){var r=s[t];if(s[t]=e,r){var o;(o=s[t].metas).unshift.apply(o,n(r.metas))}i(t,r,e)}),this.map(u,function(t,n){var e=s[t];if(e){var i=n.metas.map(function(t){return t.phx_ref});e.metas=e.metas.filter(function(t){return i.indexOf(t.phx_ref)<0}),r(t,e,n),0===e.metas.length&&delete s[t]}}),s},list:function(t,n){return n||(n=function(t,n){return n}),this.map(t,function(t,e){return n(t,e)})},map:function(t,n){return Object.getOwnPropertyNames(t).map(function(e){return n(e,t[e])})},clone:function(t){return JSON.parse(JSON.stringify(t))}};var y=function(){function t(n,i){e(this,t),this.callback=n,this.timerCalc=i,this.timer=null,this.tries=0}return o(t,[{key:"reset",value:function(){this.tries=0,clearTimeout(this.timer)}},{key:"scheduleTimeout",value:function(){var t=this;clearTimeout(this.timer),this.timer=setTimeout(function(){t.tries=t.tries+1,t.callback()},this.timerCalc(this.tries+1))}}]),t}()})}));var Xe=function(t,n){return i(this,void 0),t.receive("ok",n.onSucceed).receive("error",n.onError).receive("timeout",n.onTimeout)}.bind(void 0),Ke=function(t,n){return i(this,void 0),function(e){return i(this,void 0),e[t]&&e[t](n)}.bind(this)}.bind(void 0),Ye=function(t){return i(this,void 0),"on"+String(t)}.bind(void 0),Qe=function(t,n,e){return i(this,void 0),t.observers.forEach(Ke(Ye(n),e))}.bind(void 0),$e=function(t,n,e){return i(this,void 0),t.findIndex(Oe([n],e))}.bind(void 0),Ze=function(t){return i(this,void 0),function(n){return i(this,void 0),rn($e(n,"request",t),1,n)}.bind(this)}.bind(void 0),ti=function(t,n){return i(this,void 0),t.notifiers=n(t.notifiers),t}.bind(void 0),ni=function(t,n){i(this,void 0),ti(t,Ze(n)),Qe(n,"Cancel",n)}.bind(void 0),ei={onError:function(t,n,e){i(this,void 0),ii(t,n),Qe(n,"Error","unsubscribe: "+String(e))}.bind(void 0),onTimeout:function(t,n){return i(this,void 0),Qe(n,"Error","unsubscribe: timeout")}.bind(void 0),onSucceed:ni},ii=function(t,n){return i(this,void 0),Xe(t.channel.push("unsubscribe",{subscriptionId:n.subscriptionId}),We(ei,t,n.request))}.bind(void 0),ri=function(t,n){return i(this,void 0),"subscription"===n.operationType?ii(t,n):ni(t,n),t}.bind(void 0),oi=function(t,n,e){return i(this,void 0),t.forEach(function(t){return i(this,void 0),Qe(t,n,e)}.bind(this))}.bind(void 0),ui=function(t){return i(this,void 0),t.map(function(t){var n=t.column,e=t.line;return i(this,void 0),String(e)+":"+String(n)}.bind(this)).join("; ")}.bind(void 0),si=function(t){var n=t.message,e=t.locations;return i(this,void 0),n+(e?" ("+String(ui(e))+")":"")}.bind(void 0),ci=function(t){return i(this,void 0),t.map(si).join("\n")}.bind(void 0),ai=/^\s*(query|mutation|subscription|\{)/,fi=function(t){return i(this,void 0),"{"===t?"query":t}.bind(void 0),li=function(t){i(this,void 0);var n=t.match(ai);if(!n)throw new TypeError("Invalid operation:\n"+String(t));return fi(n[1])}.bind(void 0),hi=function(t){return i(this,void 0),function(n){return i(this,void 0),on($e(n,"request",t),[t],n)}.bind(this)}.bind(void 0),di=function(t,n,e){i(this,void 0),ti(t,Ze(n)),Qe(n,"Result",e.payload.result)}.bind(void 0),vi=function(t){return i(this,void 0),Qe(t,"Start",t)}.bind(void 0),pi=function(t,n,e){var r=e.subscriptionId;i(this,void 0),ti(t,hi(zt({},n,{subscriptionId:r}))),vi(n)}.bind(void 0),bi=function(t,n,e){i(this,void 0),e.subscriptionId?pi(t,n,e):e.payload&&di(t,n,e)}.bind(void 0),yi=function(t,n,e){i(this,void 0),ti(t,Ze(n)),Qe(n,"Abort",e)}.bind(void 0),mi=function(t,n,e){return i(this,void 0),yi(t,n,new Error(e))}.bind(void 0),gi=function(t,n,e){i(this,void 0),e.errors?mi(t,n,ci(e.errors)):bi(t,n,e)}.bind(void 0),wi=function(t,n){return i(this,void 0),Qe(n,"Error",new Error("request: timeout"))}.bind(void 0),ki={onError:mi,onSucceed:gi,onTimeout:wi},ji=function(t,n){i(this,void 0),"subscription"!==n.operationType&&vi(n),Xe(t.channel.push("doc",n.request),We(ki,t,n.request))}.bind(void 0),Si=function(t){return i(this,void 0),{onError:function(n){return i(this,void 0),oi(t.notifiers,"Error",new Error("channel join: "+String(n)))}.bind(this),onSucceed:function(){i(this,void 0),t.isJoining=!1,t.notifiers.forEach(function(n){return i(this,void 0),ji(t,n)}.bind(this))}.bind(this),onTimeout:function(){return i(this,void 0),oi(t.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),_i=function(t){return i(this,void 0),Xe(t.channel.join(),Si(t))}.bind(void 0),Oi=function(){return i(this,void 0),new Error("connection: close")}.bind(void 0),Ei=function(t,n){i(this,void 0),ti(t,Ze(n)),Qe(n,"Abort",Oi())}.bind(void 0),Ti=function(t){return i(this,void 0),function(n){i(this,void 0),"mutation"===n.operationType?Ei(t,n):Qe(n,"Error",Oi())}.bind(this)}.bind(void 0),xi=function(t){return i(this,void 0),function(){i(this,void 0),0!==t.notifiers.length&&(t.isJoining=!0,t.notifiers.forEach(Ti(t)))}.bind(this)}.bind(void 0),Pi=function(t,n){var e=n.payload;i(this,void 0);var r=ze(t.notifiers,"subscriptionId",e.subscriptionId);r&&Qe(r,"Result",e.result)}.bind(void 0),Ai=function(t){return i(this,void 0),function(n){i(this,void 0),"subscription:data"===n.event&&Pi(t,n)}.bind(this)}.bind(void 0),Ci=function(t){i(this,void 0),0===t.notifiers.length?t.isJoining=!1:_i(t)}.bind(void 0),Mi=function(t){return i(this,void 0),function(){i(this,void 0),t.isJoining&&Ci(t)}.bind(this)}.bind(void 0),Ri=function(t){i(this,void 0);var n={phoenixSocket:t,channel:t.channel("__absinthe__:control"),isJoining:!1,notifiers:[]};return t.onOpen(Mi(n)),t.onMessage(Ai(n)),t.onClose(xi(n)),n}.bind(void 0),Li=function(t,n){var e=t.observers,r=Qt(t,["observers"]);return i(this,void 0),zt({},r,{observers:[].concat(qt(e),[n])})}.bind(void 0),Ii=function(t,n,e){return i(this,void 0),ti(t,hi(Li(n,e)))}.bind(void 0),Ni=function(t){return i(this,void 0),{request:t,observers:[],operationType:li(t.operation),subscriptionId:void 0}}.bind(void 0),Ji=function(t){i(this,void 0),t.isJoining=!0,t.phoenixSocket.isConnected()?_i(t):t.phoenixSocket.connect()}.bind(void 0),qi=function(t){return i(this,void 0),t.phoenixSocket.isConnected()&&!t.isJoining}.bind(void 0),Hi=function(t,n){i(this,void 0);var e=Ni(n);return ti(t,$t([e])),qi(t)?ji(t,e):Ji(t),e}.bind(void 0),Fi=e(function(t,n){!function(e,i){e(n,t)}(function(t,n){function e(t){return"function"==typeof Symbol&&Boolean(Symbol[t])}function i(t){return e(t)?Symbol[t]:"@@"+t}function r(t,n){var e=t[n];if(null!=e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}}function o(t){var n=t.constructor;return void 0!==n&&null===(n=n[i("species")])&&(n=void 0),void 0!==n?n:d}function u(t,n){Object.keys(n).forEach(function(e){var i=Object.getOwnPropertyDescriptor(n,e);i.enumerable=!1,Object.defineProperty(t,e,i)})}function s(t){var n=t._cleanup;n&&(t._cleanup=void 0,n())}function c(t){return void 0===t._observer}function a(t){c(t)||(t._observer=void 0,s(t))}function f(t){return function(){t.unsubscribe()}}function l(t,n){if(Object(t)!==t)throw new TypeError("Observer must be an object");this._cleanup=void 0,this._observer=t;var e=r(t,"start");if(e&&e.call(t,this),!c(this)){t=new h(this);try{var i=n.call(void 0,t);if(null!=i){if("function"==typeof i.unsubscribe)i=f(i);else if("function"!=typeof i)throw new TypeError(i+" is not a function");this._cleanup=i}}catch(n){return void t.error(n)}c(this)&&s(this)}}function h(t){this._subscription=t}function d(t){if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}"function"!=typeof Symbol||Symbol.observable||(Symbol.observable=Symbol("observable")),u(l.prototype={},{get closed(){return c(this)},unsubscribe:function(){a(this)}}),u(h.prototype={},{get closed(){return c(this._subscription)},next:function(t){var n=this._subscription;if(!c(n)){var e=n._observer,i=r(e,"next");if(i)return i.call(e,t)}},error:function(t){var n=this._subscription;if(c(n))throw t;var e=n._observer;n._observer=void 0;try{var i=r(e,"error");if(!i)throw t;t=i.call(e,t)}catch(t){try{s(n)}finally{throw t}}return s(n),t},complete:function(t){var n=this._subscription;if(!c(n)){var e=n._observer;n._observer=void 0;try{var i=r(e,"complete");t=i?i.call(e,t):void 0}catch(t){try{s(n)}finally{throw t}}return s(n),t}}}),u(d.prototype,{subscribe:function(t){for(var n=[],e=1;e<arguments.length;++e)n.push(arguments[e]);return"function"==typeof t&&(t={next:t,error:n[0],complete:n[1]}),new l(t,this._subscriber)},forEach:function(t){var n=this;return new Promise(function(e,i){if("function"!=typeof t)return Promise.reject(new TypeError(t+" is not a function"));n.subscribe({_subscription:null,start:function(t){if(Object(t)!==t)throw new TypeError(t+" is not an object");this._subscription=t},next:function(n){var e=this._subscription;if(!e.closed)try{return t(n)}catch(t){i(t),e.unsubscribe()}},error:i,complete:e})})},map:function(t){var n=this;if("function"!=typeof t)throw new TypeError(t+" is not a function");return new(o(this))(function(e){return n.subscribe({next:function(n){if(!e.closed){try{n=t(n)}catch(t){return e.error(t)}return e.next(n)}},error:function(t){return e.error(t)},complete:function(t){return e.complete(t)}})})},filter:function(t){var n=this;if("function"!=typeof t)throw new TypeError(t+" is not a function");return new(o(this))(function(e){return n.subscribe({next:function(n){if(!e.closed){try{if(!t(n))return}catch(t){return e.error(t)}return e.next(n)}},error:function(t){return e.error(t)},complete:function(){return e.complete()}})})},reduce:function(t){var n=this;if("function"!=typeof t)throw new TypeError(t+" is not a function");var e=o(this),i=arguments.length>1,r=!1,u=arguments[1];return new e(function(e){return n.subscribe({next:function(n){if(!e.closed){var o=!r;if(r=!0,!o||i)try{u=t(u,n)}catch(t){return e.error(t)}else u=n}},error:function(t){e.error(t)},complete:function(){r||i?(e.next(u),e.complete()):e.error(new TypeError("Cannot reduce an empty sequence"))}})})},flatMap:function(t){var n=this;if("function"!=typeof t)throw new TypeError(t+" is not a function");return new(o(this))(function(e){function i(){r&&0===o.length&&e.complete()}var r=!1,o=[],u=n.subscribe({next:function(n){if(t)try{n=t(n)}catch(t){return void e.error(t)}d.from(n).subscribe({_subscription:null,start:function(t){o.push(this._subscription=t)},next:function(t){e.next(t)},error:function(t){e.error(t)},complete:function(){var t=o.indexOf(this._subscription);t>=0&&o.splice(t,1),i()}})},error:function(t){return e.error(t)},complete:function(){r=!0,i()}});return function(){o.forEach(function(t){return t.unsubscribe()}),u.unsubscribe()}})}}),Object.defineProperty(d.prototype,i("observable"),{value:function(){return this},writable:!0,configurable:!0}),u(d,{from:function(t){var n="function"==typeof this?this:d;if(null==t)throw new TypeError(t+" is not an object");var o=r(t,i("observable"));if(o){var u=o.call(t);if(Object(u)!==u)throw new TypeError(u+" is not an object");return u.constructor===n?u:new n(function(t){return u.subscribe(t)})}if(e("iterator")&&(o=r(t,i("iterator"))))return new n(function(n){for(var e,i=o.call(t)[Symbol.iterator]();!(e=i.next()).done;){var r=e.value;if(n.next(r),n.closed)return}n.complete()});if(Array.isArray(t))return new n(function(n){for(var e=0;e<t.length;++e)if(n.next(t[e]),n.closed)return;n.complete()});throw new TypeError(t+" is not observable")},of:function(){for(var t=[],n=0;n<arguments.length;++n)t.push(arguments[n]);return new("function"==typeof this?this:d)(function(n){for(var e=0;e<t.length;++e)if(n.next(t[e]),n.closed)return;n.complete()})}}),Object.defineProperty(d,i("species"),{get:function(){return this},configurable:!0}),t.Observable=d})}).Observable,Di=function(t,n){return i(this,void 0),function(e){i(this,void 0),n.next(e),"subscription"!==t.operationType&&n.complete()}.bind(this)}.bind(void 0),Bi=function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=e.onError,o=e.onStart,u=e.unsubscribe;return i(this,void 0),new Fi(function(e){return i(this,void 0),Ii(t,n,{onError:r,onStart:o,onAbort:e.error,onresult:Di(n,e)}),u}.bind(this))}.bind(void 0),Ui=function(t,n){var e=t.observers,r=Qt(t,["observers"]);return i(this,void 0),zt({},r,{observers:rn(e.indexOf(n),1,e)})}.bind(void 0),Gi=function(t,n,e){return i(this,void 0),ti(t,hi(Ui(n,e))),t}.bind(void 0);t.cancel=ri,t.create=Ri,t.observe=Ii,t.send=Hi,t.toObservable=Bi,t.unobserve=Gi,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import{hasIn,map}from"@jumpn/utils-composite";import"phoenix";import{append,remove,replace}from"@jumpn/utils-array";import _extends from"babel-runtime/helpers/extends";import{errorsToString,getOperationType}from"@jumpn/utils-graphql";import _toConsumableArray from"babel-runtime/helpers/toConsumableArray";import _objectWithoutProperties from"babel-runtime/helpers/objectWithoutProperties";var _this$2=void 0,find=function(n,i,e){return _newArrowCheck(this,_this$2),n.find(hasIn([i],e))}.bind(void 0),_this$1=void 0,createEventHandler=function(n,i){return _newArrowCheck(this,_this$1),function(e){return _newArrowCheck(this,_this$1),function(){for(var r=arguments.length,o=Array(r),t=0;t<r;t++)o[t]=arguments[t];_newArrowCheck(this,_this$1);var s=find(n.notifiers,"request",i);s&&e.apply(void 0,[n,s].concat(o))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(n,i,e){return _newArrowCheck(this,_this$1),map(createEventHandler(i,e),n)}.bind(void 0),_this$3=void 0,handlePush=function(n,i){return _newArrowCheck(this,_this$3),n.receive("ok",i.onSucceed).receive("error",i.onError).receive("timeout",i.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(n,i){return _newArrowCheck(this,_this$4),function(e){return _newArrowCheck(this,_this$4),e[n]&&e[n](i)}.bind(this)}.bind(void 0),getHandlerName=function(n){return _newArrowCheck(this,_this$4),"on"+String(n)}.bind(void 0),notify=function(n,i,e){return _newArrowCheck(this,_this$4),n.observers.forEach(getNotifier(getHandlerName(i),e))}.bind(void 0),_this$6=void 0,findIndex=function(n,i,e){return _newArrowCheck(this,_this$6),n.findIndex(hasIn([i],e))}.bind(void 0),_this$5=void 0,remove$1=function(n){return _newArrowCheck(this,_this$5),function(i){return _newArrowCheck(this,_this$5),remove(findIndex(i,"request",n),1,i)}.bind(this)}.bind(void 0),_this$7=void 0,updateNotifiers=function(n,i){return _newArrowCheck(this,_this$7),n.notifiers=i(n.notifiers),n}.bind(void 0),_this=void 0,removeNotifiers=function(n,i){_newArrowCheck(this,_this),updateNotifiers(n,remove$1(i)),notify(i,"Cancel",i)}.bind(void 0),onError=function(n,i,e){_newArrowCheck(this,_this),unsubscribe(n,i),notify(i,"Error","unsubscribe: "+String(e))}.bind(void 0),onTimeout=function(n,i){return _newArrowCheck(this,_this),notify(i,"Error","unsubscribe: timeout")}.bind(void 0),notifierPushHandler={onError:onError,onTimeout:onTimeout,onSucceed:removeNotifiers},unsubscribe=function(n,i){return _newArrowCheck(this,_this),handlePush(n.channel.push("unsubscribe",{subscriptionId:i.subscriptionId}),createPushHandler(notifierPushHandler,n,i.request))}.bind(void 0),cancel=function(n,i){return _newArrowCheck(this,_this),"subscription"===i.operationType?unsubscribe(n,i):removeNotifiers(n,i),n}.bind(void 0),_this$10=void 0,notifyall=function(n,i,e){return _newArrowCheck(this,_this$10),n.forEach(function(n){return _newArrowCheck(this,_this$10),notify(n,i,e)}.bind(this))}.bind(void 0),_this$12=void 0,refresh=function(n){return _newArrowCheck(this,_this$12),function(i){return _newArrowCheck(this,_this$12),replace(findIndex(i,"request",n),[n],i)}.bind(this)}.bind(void 0),_this$11=void 0,onQueryOrMutationResponse=function(n,i,e){_newArrowCheck(this,_this$11),updateNotifiers(n,remove$1(i)),notify(i,"Result",e.payload.result)}.bind(void 0),notifyStart=function(n){return _newArrowCheck(this,_this$11),notify(n,"Start",n)}.bind(void 0),onSubscriptionResponse=function(n,i,e){var r=e.subscriptionId;_newArrowCheck(this,_this$11),updateNotifiers(n,refresh(_extends({},i,{subscriptionId:r}))),notifyStart(i)}.bind(void 0),onResponse=function(n,i,e){_newArrowCheck(this,_this$11),e.subscriptionId?onSubscriptionResponse(n,i,e):e.payload&&onQueryOrMutationResponse(n,i,e)}.bind(void 0),abortRequest=function(n,i,e){_newArrowCheck(this,_this$11),updateNotifiers(n,remove$1(i)),notify(i,"Abort",e)}.bind(void 0),onError$1=function(n,i,e){return _newArrowCheck(this,_this$11),abortRequest(n,i,new Error(e))}.bind(void 0),onSucceed=function(n,i,e){_newArrowCheck(this,_this$11),e.errors?onError$1(n,i,errorsToString(e.errors)):onResponse(n,i,e)}.bind(void 0),onTimeout$1=function(n,i){return _newArrowCheck(this,_this$11),notify(i,"Error",new Error("request: timeout"))}.bind(void 0),notifierPushHandler$1={onError:onError$1,onSucceed:onSucceed,onTimeout:onTimeout$1},pushRequest=function(n,i){_newArrowCheck(this,_this$11),"subscription"!==i.operationType&¬ifyStart(i),handlePush(n.channel.push("doc",i.request),createPushHandler(notifierPushHandler$1,n,i.request))}.bind(void 0),_this$9=void 0,createChannelJoinHandler=function(n){return _newArrowCheck(this,_this$9),{onError:function(i){return _newArrowCheck(this,_this$9),notifyall(n.notifiers,"Error",new Error("channel join: "+String(i)))}.bind(this),onSucceed:function(){_newArrowCheck(this,_this$9),n.isJoining=!1,n.notifiers.forEach(function(i){return _newArrowCheck(this,_this$9),pushRequest(n,i)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$9),notifyall(n.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(n){return _newArrowCheck(this,_this$9),handlePush(n.channel.join(),createChannelJoinHandler(n))}.bind(void 0),_this$8=void 0,createConnectionCloseError=function(){return _newArrowCheck(this,_this$8),new Error("connection: close")}.bind(void 0),mutationOnConnectionClose=function(n,i){_newArrowCheck(this,_this$8),updateNotifiers(n,remove$1(i)),notify(i,"Abort",createConnectionCloseError())}.bind(void 0),notifierOnConnectionClose=function(n){return _newArrowCheck(this,_this$8),function(i){_newArrowCheck(this,_this$8),"mutation"===i.operationType?mutationOnConnectionClose(n,i):notify(i,"Error",createConnectionCloseError())}.bind(this)}.bind(void 0),onConnectionClose=function(n){return _newArrowCheck(this,_this$8),function(){_newArrowCheck(this,_this$8),0!==n.notifiers.length&&(n.isJoining=!0,n.notifiers.forEach(notifierOnConnectionClose(n)))}.bind(this)}.bind(void 0),onSubscriptionData=function(n,i){var e=i.payload;_newArrowCheck(this,_this$8);var r=find(n.notifiers,"subscriptionId",e.subscriptionId);r&¬ify(r,"Result",e.result)}.bind(void 0),onMessage=function(n){return _newArrowCheck(this,_this$8),function(i){_newArrowCheck(this,_this$8),"subscription:data"===i.event&&onSubscriptionData(n,i)}.bind(this)}.bind(void 0),joinChannelIfNeeded=function(n){_newArrowCheck(this,_this$8),0===n.notifiers.length?n.isJoining=!1:joinChannel(n)}.bind(void 0),onConnectionOpen=function(n){return _newArrowCheck(this,_this$8),function(){_newArrowCheck(this,_this$8),n.isJoining&&joinChannelIfNeeded(n)}.bind(this)}.bind(void 0),absintheChannelName="__absinthe__:control",create=function(n){_newArrowCheck(this,_this$8);var i={phoenixSocket:n,channel:n.channel(absintheChannelName),isJoining:!1,notifiers:[]};return n.onOpen(onConnectionOpen(i)),n.onMessage(onMessage(i)),n.onClose(onConnectionClose(i)),i}.bind(void 0),_this$14=void 0,observe$2=function(n,i){var e=n.observers,r=_objectWithoutProperties(n,["observers"]);return _newArrowCheck(this,_this$14),_extends({},r,{observers:[].concat(_toConsumableArray(e),[i])})}.bind(void 0),_this$13=void 0,observe=function(n,i,e){return _newArrowCheck(this,_this$13),updateNotifiers(n,refresh(observe$2(i,e)))}.bind(void 0),_this$16=void 0,create$2=function(n){return _newArrowCheck(this,_this$16),{request:n,observers:[],operationType:getOperationType(n.operation),subscriptionId:void 0}}.bind(void 0),_this$15=void 0,connectOrJoin=function(n){_newArrowCheck(this,_this$15),n.isJoining=!0,n.phoenixSocket.isConnected()?joinChannel(n):n.phoenixSocket.connect()}.bind(void 0),isJoined=function(n){return _newArrowCheck(this,_this$15),n.phoenixSocket.isConnected()&&!n.isJoining}.bind(void 0),send=function(n,i){_newArrowCheck(this,_this$15);var e=create$2(i);return updateNotifiers(n,append([e])),isJoined(n)?pushRequest(n,e):connectOrJoin(n),e}.bind(void 0),_this$18=void 0,unobserve$2=function(n,i){var e=n.observers,r=_objectWithoutProperties(n,["observers"]);return _newArrowCheck(this,_this$18),_extends({},r,{observers:remove(e.indexOf(i),1,e)})}.bind(void 0),_this$17=void 0,unobserve=function(n,i,e){return _newArrowCheck(this,_this$17),updateNotifiers(n,refresh(unobserve$2(i,e))),n}.bind(void 0);export{cancel,create,observe,send,unobserve}; | ||
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import{hasIn,map}from"@jumpn/utils-composite";import"phoenix";import{append,remove,replace}from"@jumpn/utils-array";import _extends from"babel-runtime/helpers/extends";import{errorsToString,getOperationType}from"@jumpn/utils-graphql";import _toConsumableArray from"babel-runtime/helpers/toConsumableArray";import _objectWithoutProperties from"babel-runtime/helpers/objectWithoutProperties";import Observable from"zen-observable";var _this$2=void 0,find=function(n,e,i){return _newArrowCheck(this,_this$2),n.find(hasIn([e],i))}.bind(void 0),_this$1=void 0,createEventHandler=function(n,e){return _newArrowCheck(this,_this$1),function(i){return _newArrowCheck(this,_this$1),function(){for(var r=arguments.length,o=Array(r),t=0;t<r;t++)o[t]=arguments[t];_newArrowCheck(this,_this$1);var s=find(n.notifiers,"request",e);s&&i.apply(void 0,[n,s].concat(o))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(n,e,i){return _newArrowCheck(this,_this$1),map(createEventHandler(e,i),n)}.bind(void 0),_this$3=void 0,handlePush=function(n,e){return _newArrowCheck(this,_this$3),n.receive("ok",e.onSucceed).receive("error",e.onError).receive("timeout",e.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(n,e){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[n]&&i[n](e)}.bind(this)}.bind(void 0),getHandlerName=function(n){return _newArrowCheck(this,_this$4),"on"+String(n)}.bind(void 0),notify=function(n,e,i){return _newArrowCheck(this,_this$4),n.observers.forEach(getNotifier(getHandlerName(e),i))}.bind(void 0),_this$6=void 0,findIndex=function(n,e,i){return _newArrowCheck(this,_this$6),n.findIndex(hasIn([e],i))}.bind(void 0),_this$5=void 0,remove$1=function(n){return _newArrowCheck(this,_this$5),function(e){return _newArrowCheck(this,_this$5),remove(findIndex(e,"request",n),1,e)}.bind(this)}.bind(void 0),_this$7=void 0,updateNotifiers=function(n,e){return _newArrowCheck(this,_this$7),n.notifiers=e(n.notifiers),n}.bind(void 0),_this=void 0,removeNotifiers=function(n,e){_newArrowCheck(this,_this),updateNotifiers(n,remove$1(e)),notify(e,"Cancel",e)}.bind(void 0),onError=function(n,e,i){_newArrowCheck(this,_this),unsubscribe(n,e),notify(e,"Error","unsubscribe: "+String(i))}.bind(void 0),onTimeout=function(n,e){return _newArrowCheck(this,_this),notify(e,"Error","unsubscribe: timeout")}.bind(void 0),notifierPushHandler={onError:onError,onTimeout:onTimeout,onSucceed:removeNotifiers},unsubscribe=function(n,e){return _newArrowCheck(this,_this),handlePush(n.channel.push("unsubscribe",{subscriptionId:e.subscriptionId}),createPushHandler(notifierPushHandler,n,e.request))}.bind(void 0),cancel=function(n,e){return _newArrowCheck(this,_this),"subscription"===e.operationType?unsubscribe(n,e):removeNotifiers(n,e),n}.bind(void 0),_this$10=void 0,notifyall=function(n,e,i){return _newArrowCheck(this,_this$10),n.forEach(function(n){return _newArrowCheck(this,_this$10),notify(n,e,i)}.bind(this))}.bind(void 0),_this$12=void 0,refresh=function(n){return _newArrowCheck(this,_this$12),function(e){return _newArrowCheck(this,_this$12),replace(findIndex(e,"request",n),[n],e)}.bind(this)}.bind(void 0),_this$11=void 0,onQueryOrMutationResponse=function(n,e,i){_newArrowCheck(this,_this$11),updateNotifiers(n,remove$1(e)),notify(e,"Result",i.payload.result)}.bind(void 0),notifyStart=function(n){return _newArrowCheck(this,_this$11),notify(n,"Start",n)}.bind(void 0),onSubscriptionResponse=function(n,e,i){var r=i.subscriptionId;_newArrowCheck(this,_this$11),updateNotifiers(n,refresh(_extends({},e,{subscriptionId:r}))),notifyStart(e)}.bind(void 0),onResponse=function(n,e,i){_newArrowCheck(this,_this$11),i.subscriptionId?onSubscriptionResponse(n,e,i):i.payload&&onQueryOrMutationResponse(n,e,i)}.bind(void 0),abortRequest=function(n,e,i){_newArrowCheck(this,_this$11),updateNotifiers(n,remove$1(e)),notify(e,"Abort",i)}.bind(void 0),onError$1=function(n,e,i){return _newArrowCheck(this,_this$11),abortRequest(n,e,new Error(i))}.bind(void 0),onSucceed=function(n,e,i){_newArrowCheck(this,_this$11),i.errors?onError$1(n,e,errorsToString(i.errors)):onResponse(n,e,i)}.bind(void 0),onTimeout$1=function(n,e){return _newArrowCheck(this,_this$11),notify(e,"Error",new Error("request: timeout"))}.bind(void 0),notifierPushHandler$1={onError:onError$1,onSucceed:onSucceed,onTimeout:onTimeout$1},pushRequest=function(n,e){_newArrowCheck(this,_this$11),"subscription"!==e.operationType&¬ifyStart(e),handlePush(n.channel.push("doc",e.request),createPushHandler(notifierPushHandler$1,n,e.request))}.bind(void 0),_this$9=void 0,createChannelJoinHandler=function(n){return _newArrowCheck(this,_this$9),{onError:function(e){return _newArrowCheck(this,_this$9),notifyall(n.notifiers,"Error",new Error("channel join: "+String(e)))}.bind(this),onSucceed:function(){_newArrowCheck(this,_this$9),n.isJoining=!1,n.notifiers.forEach(function(e){return _newArrowCheck(this,_this$9),pushRequest(n,e)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$9),notifyall(n.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(n){return _newArrowCheck(this,_this$9),handlePush(n.channel.join(),createChannelJoinHandler(n))}.bind(void 0),_this$8=void 0,createConnectionCloseError=function(){return _newArrowCheck(this,_this$8),new Error("connection: close")}.bind(void 0),mutationOnConnectionClose=function(n,e){_newArrowCheck(this,_this$8),updateNotifiers(n,remove$1(e)),notify(e,"Abort",createConnectionCloseError())}.bind(void 0),notifierOnConnectionClose=function(n){return _newArrowCheck(this,_this$8),function(e){_newArrowCheck(this,_this$8),"mutation"===e.operationType?mutationOnConnectionClose(n,e):notify(e,"Error",createConnectionCloseError())}.bind(this)}.bind(void 0),onConnectionClose=function(n){return _newArrowCheck(this,_this$8),function(){_newArrowCheck(this,_this$8),0!==n.notifiers.length&&(n.isJoining=!0,n.notifiers.forEach(notifierOnConnectionClose(n)))}.bind(this)}.bind(void 0),onSubscriptionData=function(n,e){var i=e.payload;_newArrowCheck(this,_this$8);var r=find(n.notifiers,"subscriptionId",i.subscriptionId);r&¬ify(r,"Result",i.result)}.bind(void 0),onMessage=function(n){return _newArrowCheck(this,_this$8),function(e){_newArrowCheck(this,_this$8),"subscription:data"===e.event&&onSubscriptionData(n,e)}.bind(this)}.bind(void 0),joinChannelIfNeeded=function(n){_newArrowCheck(this,_this$8),0===n.notifiers.length?n.isJoining=!1:joinChannel(n)}.bind(void 0),onConnectionOpen=function(n){return _newArrowCheck(this,_this$8),function(){_newArrowCheck(this,_this$8),n.isJoining&&joinChannelIfNeeded(n)}.bind(this)}.bind(void 0),absintheChannelName="__absinthe__:control",create=function(n){_newArrowCheck(this,_this$8);var e={phoenixSocket:n,channel:n.channel(absintheChannelName),isJoining:!1,notifiers:[]};return n.onOpen(onConnectionOpen(e)),n.onMessage(onMessage(e)),n.onClose(onConnectionClose(e)),e}.bind(void 0),_this$14=void 0,observe$2=function(n,e){var i=n.observers,r=_objectWithoutProperties(n,["observers"]);return _newArrowCheck(this,_this$14),_extends({},r,{observers:[].concat(_toConsumableArray(i),[e])})}.bind(void 0),_this$13=void 0,observe=function(n,e,i){return _newArrowCheck(this,_this$13),updateNotifiers(n,refresh(observe$2(e,i)))}.bind(void 0),_this$16=void 0,create$2=function(n){return _newArrowCheck(this,_this$16),{request:n,observers:[],operationType:getOperationType(n.operation),subscriptionId:void 0}}.bind(void 0),_this$15=void 0,connectOrJoin=function(n){_newArrowCheck(this,_this$15),n.isJoining=!0,n.phoenixSocket.isConnected()?joinChannel(n):n.phoenixSocket.connect()}.bind(void 0),isJoined=function(n){return _newArrowCheck(this,_this$15),n.phoenixSocket.isConnected()&&!n.isJoining}.bind(void 0),send=function(n,e){_newArrowCheck(this,_this$15);var i=create$2(e);return updateNotifiers(n,append([i])),isJoined(n)?pushRequest(n,i):connectOrJoin(n),i}.bind(void 0),_this$17=void 0,onResult=function(n,e){return _newArrowCheck(this,_this$17),function(i){_newArrowCheck(this,_this$17),e.next(i),"subscription"!==n.operationType&&e.complete()}.bind(this)}.bind(void 0),toObservable=function(n,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i.onError,o=i.onStart,t=i.unsubscribe;return _newArrowCheck(this,_this$17),new Observable(function(i){return _newArrowCheck(this,_this$17),observe(n,e,{onError:r,onStart:o,onAbort:i.error,onresult:onResult(e,i)}),t}.bind(this))}.bind(void 0),_this$19=void 0,unobserve$2=function(n,e){var i=n.observers,r=_objectWithoutProperties(n,["observers"]);return _newArrowCheck(this,_this$19),_extends({},r,{observers:remove(i.indexOf(e),1,i)})}.bind(void 0),_this$18=void 0,unobserve=function(n,e,i){return _newArrowCheck(this,_this$18),updateNotifiers(n,refresh(unobserve$2(e,i))),n}.bind(void 0);export{cancel,create,observe,send,toObservable,unobserve}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@jumpn/absinthe-phoenix-socket", | ||
"version": "0.3.3", | ||
"version": "0.4.0", | ||
"description": "Absinthe Phoenix Socket", | ||
@@ -54,3 +54,4 @@ "module": "dist/index.js", | ||
"babel-runtime": "6.26.0", | ||
"phoenix": "1.3.0" | ||
"phoenix": "1.3.0", | ||
"zen-observable": "0.6.0" | ||
}, | ||
@@ -57,0 +58,0 @@ "devDependencies": { |
@@ -19,2 +19,3 @@ # @jumpn/absinthe-phoenix-socket | ||
- [send](#send) | ||
- [toObservable](#toobservable) | ||
- [unobserve](#unobserve) | ||
@@ -45,3 +46,3 @@ - [License](#license) | ||
> and sends a Cancel event to all its observers and unsubscribes in case it | ||
> holds a subscription request. | ||
> holds a subscription request. | ||
- Observer support of recoverable errors | ||
@@ -209,2 +210,17 @@ > Since connection lost is handled, then two events needs to exist to represent | ||
### toObservable | ||
Creates an Observable that will follow the given notifier | ||
**Parameters** | ||
- `absintheSocket` **AbsintheSocket** | ||
- `notifier` **Notifier<Result>** | ||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** (optional, default `{}`) | ||
- `options.onError` **function (error: [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)): [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)?** | ||
- `options.onStart` **function (notifier: Notifier<Result>): [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)?** | ||
- `options.unsubscribe` **function (): [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)?** | ||
Returns **Observable** | ||
### unobserve | ||
@@ -211,0 +227,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
603371
144
642
246
6
18
+ Addedzen-observable@0.6.0
+ Addedzen-observable@0.6.0(transitive)