/
app.js
131 lines (115 loc) · 49 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ({
/***/ "./css/app.css":
/*!*********************!*\
!*** ./css/app.css ***!
\*********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// extracted by mini-css-extract-plugin\n\n//# sourceURL=webpack:///./css/app.css?");
/***/ }),
/***/ "./js/app.js":
/*!*******************!*\
!*** ./js/app.js ***!
\*******************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _css_app_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../css/app.css */ \"./css/app.css\");\n/* harmony import */ var _css_app_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_css_app_css__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var phoenix_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! phoenix_html */ \"./node_modules/phoenix_html/priv/static/phoenix_html.js\");\n/* harmony import */ var phoenix_html__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(phoenix_html__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var phoenix_live_view__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! phoenix_live_view */ \"./node_modules/phoenix_live_view/priv/static/phoenix_live_view.js\");\n/* harmony import */ var phoenix_live_view__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(phoenix_live_view__WEBPACK_IMPORTED_MODULE_2__);\n// We need to import the CSS so that webpack will load it.\n// The MiniCssExtractPlugin is used to separate it out into\n// its own CSS file.\n // webpack automatically bundles all modules in your\n// entry points. Those entry points can be configured\n// in \"webpack.config.js\".\n//\n// Import dependencies\n//\n\n // Enable LiveView client side connections\n\n\nvar liveSocket = new phoenix_live_view__WEBPACK_IMPORTED_MODULE_2___default.a(\"/live\");\nliveSocket.connect();\n\n//# sourceURL=webpack:///./js/app.js?");
/***/ }),
/***/ "./node_modules/phoenix_html/priv/static/phoenix_html.js":
/*!***************************************************************!*\
!*** ./node_modules/phoenix_html/priv/static/phoenix_html.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\n(function() {\n var PolyfillEvent = eventConstructor();\n\n function eventConstructor() {\n if (typeof window.CustomEvent === \"function\") return window.CustomEvent;\n // IE<=9 Support\n function CustomEvent(event, params) {\n params = params || {bubbles: false, cancelable: false, detail: undefined};\n var evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n }\n CustomEvent.prototype = window.Event.prototype;\n return CustomEvent;\n }\n\n function buildHiddenInput(name, value) {\n var input = document.createElement(\"input\");\n input.type = \"hidden\";\n input.name = name;\n input.value = value;\n return input;\n }\n\n function handleClick(element) {\n var to = element.getAttribute(\"data-to\"),\n method = buildHiddenInput(\"_method\", element.getAttribute(\"data-method\")),\n csrf = buildHiddenInput(\"_csrf_token\", element.getAttribute(\"data-csrf\")),\n form = document.createElement(\"form\"),\n target = element.getAttribute(\"target\");\n\n form.method = (element.getAttribute(\"data-method\") === \"get\") ? \"get\" : \"post\";\n form.action = to;\n form.style.display = \"hidden\";\n\n if (target) form.target = target;\n\n form.appendChild(csrf);\n form.appendChild(method);\n document.body.appendChild(form);\n form.submit();\n }\n\n window.addEventListener(\"click\", function(e) {\n var element = e.target;\n\n while (element && element.getAttribute) {\n var phoenixLinkEvent = new PolyfillEvent('phoenix.link.click', {\n \"bubbles\": true, \"cancelable\": true\n });\n\n if (!element.dispatchEvent(phoenixLinkEvent)) {\n e.preventDefault();\n return false;\n }\n\n if (element.getAttribute(\"data-method\")) {\n handleClick(element);\n e.preventDefault();\n return false;\n } else {\n element = element.parentNode;\n }\n }\n }, false);\n\n window.addEventListener('phoenix.link.click', function (e) {\n var message = e.target.getAttribute(\"data-confirm\");\n if(message && !window.confirm(message)) {\n e.preventDefault();\n }\n }, false);\n})();\n\n\n//# sourceURL=webpack:///./node_modules/phoenix_html/priv/static/phoenix_html.js?");
/***/ }),
/***/ "./node_modules/phoenix_live_view/priv/static/phoenix_live_view.js":
/*!*************************************************************************!*\
!*** ./node_modules/phoenix_live_view/priv/static/phoenix_live_view.js ***!
\*************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("!function(e,t){ true?module.exports=t():undefined}(this,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.r=function(e){Object.defineProperty(e,\"__esModule\",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,\"a\",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=\"\",n(n.s=4)}([function(e,t,n){e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&\"object\"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,\"default\",{enumerable:!0,value:e}),2&t&&\"string\"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,\"a\",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=\"\",n(n.s=0)}([function(e,t,n){(function(t){e.exports=t.Phoenix=n(2)}).call(this,n(1))},function(e,t){var n;n=function(){return this}();try{n=n||Function(\"return this\")()||(0,eval)(\"this\")}catch(e){\"object\"==typeof window&&(n=window)}e.exports=n},function(e,t,n){\"use strict\";function i(e){return(i=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e})(e)}function r(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,\"value\"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}n.r(t),n.d(t,\"Channel\",function(){return g}),n.d(t,\"Socket\",function(){return k}),n.d(t,\"LongPoll\",function(){return w}),n.d(t,\"Ajax\",function(){return E}),n.d(t,\"Presence\",function(){return A});var a=\"undefined\"!=typeof self?self:null,u=\"undefined\"!=typeof window?window:null,c=a||u||void 0,l={connecting:0,open:1,closing:2,closed:3},h=1e4,f={closed:\"closed\",errored:\"errored\",joined:\"joined\",joining:\"joining\",leaving:\"leaving\"},d={close:\"phx_close\",error:\"phx_error\",join:\"phx_join\",reply:\"phx_reply\",leave:\"phx_leave\"},v=[d.close,d.error,d.join,d.reply,d.leave],p={longpoll:\"longpoll\",websocket:\"websocket\"},y=function(e){return\"function\"==typeof e?e:function(){return e}},m=function(){function e(t,n,i,o){r(this,e),this.channel=t,this.event=n,this.payload=i||function(){return{}},this.receivedResp=null,this.timeout=o,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}return s(e,[{key:\"resend\",value:function(e){this.timeout=e,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(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}},{key:\"reset\",value:function(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}},{key:\"matchReceive\",value:function(e){var t=e.status,n=e.response;e.ref,this.recHooks.filter(function(e){return e.status===t}).forEach(function(e){return e.callback(n)})}},{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 e=this;this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,function(t){e.cancelRefEvent(),e.cancelTimeout(),e.receivedResp=t,e.matchReceive(t)}),this.timeoutTimer=setTimeout(function(){e.trigger(\"timeout\",{})},this.timeout)}},{key:\"hasReceived\",value:function(e){return this.receivedResp&&this.receivedResp.status===e}},{key:\"trigger\",value:function(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}}]),e}(),g=function(){function e(t,n,i){var o=this;r(this,e),this.state=f.closed,this.topic=t,this.params=y(n||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new m(this,d.join,this.params,this.timeout),this.pushBuffer=[],this.rejoinTimer=new x(function(){o.socket.isConnected()&&o.rejoin()},this.socket.rejoinAfterMs),this.socket.onError(function(){return o.rejoinTimer.reset()}),this.socket.onOpen(function(){o.rejoinTimer.reset(),o.isErrored()&&o.rejoin()}),this.joinPush.receive(\"ok\",function(){o.state=f.joined,o.rejoinTimer.reset(),o.pushBuffer.forEach(function(e){return e.send()}),o.pushBuffer=[]}),this.joinPush.receive(\"error\",function(){o.state=f.errored,o.socket.isConnected()&&o.rejoinTimer.scheduleTimeout()}),this.onClose(function(){o.rejoinTimer.reset(),o.socket.hasLogger()&&o.socket.log(\"channel\",\"close \".concat(o.topic,\" \").concat(o.joinRef())),o.state=f.closed,o.socket.remove(o)}),this.onError(function(e){o.socket.hasLogger()&&o.socket.log(\"channel\",\"error \".concat(o.topic),e),o.isJoining()&&o.joinPush.reset(),o.state=f.errored,o.socket.isConnected()&&o.rejoinTimer.scheduleTimeout()}),this.joinPush.receive(\"timeout\",function(){o.socket.hasLogger()&&o.socket.log(\"channel\",\"timeout \".concat(o.topic,\" (\").concat(o.joinRef(),\")\"),o.joinPush.timeout),new m(o,d.leave,y({}),o.timeout).send(),o.state=f.errored,o.joinPush.reset(),o.socket.isConnected()&&o.rejoinTimer.scheduleTimeout()}),this.on(d.reply,function(e,t){o.trigger(o.replyEventName(t),e)})}return s(e,[{key:\"join\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;if(this.joinedOnce)throw new Error(\"tried to join multiple times. 'join' can only be called a single time per channel instance\");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}},{key:\"onClose\",value:function(e){this.on(d.close,e)}},{key:\"onError\",value:function(e){return this.on(d.error,function(t){return e(t)})}},{key:\"on\",value:function(e,t){var n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}},{key:\"off\",value:function(e,t){this.bindings=this.bindings.filter(function(n){return!(n.event===e&&(void 0===t||t===n.ref))})}},{key:\"canPush\",value:function(){return this.socket.isConnected()&&this.isJoined()}},{key:\"push\",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.timeout;if(!this.joinedOnce)throw new Error(\"tried to push '\".concat(e,\"' to '\").concat(this.topic,\"' before joining. Use channel.join() before pushing events\"));var i=new m(this,e,function(){return t},n);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}},{key:\"leave\",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.rejoinTimer.reset(),this.state=f.leaving;var n=function(){e.socket.hasLogger()&&e.socket.log(\"channel\",\"leave \".concat(e.topic)),e.trigger(d.close,\"leave\")},i=new m(this,d.leave,y({}),t);return i.receive(\"ok\",function(){return n()}).receive(\"timeout\",function(){return n()}),i.send(),this.canPush()||i.trigger(\"ok\",{}),i}},{key:\"onMessage\",value:function(e,t,n){return t}},{key:\"isLifecycleEvent\",value:function(e){return v.indexOf(e)>=0}},{key:\"isMember\",value:function(e,t,n,i){return!(this.topic!==e||i&&i!==this.joinRef()&&this.isLifecycleEvent(t)&&(this.socket.hasLogger()&&this.socket.log(\"channel\",\"dropping outdated message\",{topic:e,event:t,payload:n,joinRef:i}),1))}},{key:\"joinRef\",value:function(){return this.joinPush.ref}},{key:\"sendJoin\",value:function(e){this.state=f.joining,this.joinPush.resend(e)}},{key:\"rejoin\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.isLeaving()||this.sendJoin(e)}},{key:\"trigger\",value:function(e,t,n,i){var r=this.onMessage(e,t,n,i);if(t&&!r)throw new Error(\"channel onMessage callbacks must return the payload, modified or unmodified\");for(var o=0;o<this.bindings.length;o++){var s=this.bindings[o];s.event===e&&s.callback(r,n,i||this.joinRef())}}},{key:\"replyEventName\",value:function(e){return\"chan_reply_\".concat(e)}},{key:\"isClosed\",value:function(){return this.state===f.closed}},{key:\"isErrored\",value:function(){return this.state===f.errored}},{key:\"isJoined\",value:function(){return this.state===f.joined}},{key:\"isJoining\",value:function(){return this.state===f.joining}},{key:\"isLeaving\",value:function(){return this.state===f.leaving}}]),e}(),b={encode:function(e,t){var n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))},decode:function(e,t){var n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(i=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw o}}return n}(e,t)||function(){throw new TypeError(\"Invalid attempt to destructure non-iterable instance\")}()}(JSON.parse(e),5);return t({join_ref:n[0],ref:n[1],topic:n[2],event:n[3],payload:n[4]})}},k=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(this,e),this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=i.timeout||h,this.transport=i.transport||c.WebSocket||w,this.defaultEncoder=b.encode,this.defaultDecoder=b.decode,this.closeWasClean=!1,this.unloaded=!1,this.binaryType=i.binaryType||\"arraybuffer\",this.transport!==w?(this.encode=i.encode||this.defaultEncoder,this.decode=i.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder),u&&u.addEventListener(\"beforeunload\",function(e){n.unloaded=!0,n.abnormalClose(\"unloaded\")}),this.heartbeatIntervalMs=i.heartbeatIntervalMs||3e4,this.rejoinAfterMs=function(e){return i.rejoinAfterMs?i.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4},this.reconnectAfterMs=function(e){return n.unloaded?100:i.reconnectAfterMs?i.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3},this.logger=i.logger||null,this.longpollerTimeout=i.longpollerTimeout||2e4,this.params=y(i.params||{}),this.endPoint=\"\".concat(t,\"/\").concat(p.websocket),this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new x(function(){n.teardown(function(){return n.connect()})},this.reconnectAfterMs)}return s(e,[{key:\"protocol\",value:function(){return location.protocol.match(/^https/)?\"wss\":\"ws\"}},{key:\"endPointURL\",value:function(){var e=E.appendParams(E.appendParams(this.endPoint,this.params()),{vsn:\"2.0.0\"});return\"/\"!==e.charAt(0)?e:\"/\"===e.charAt(1)?\"\".concat(this.protocol(),\":\").concat(e):\"\".concat(this.protocol(),\"://\").concat(location.host).concat(e)}},{key:\"disconnect\",value:function(e,t,n){this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(e,t,n)}},{key:\"connect\",value:function(e){var t=this;e&&(console&&console.log(\"passing params to connect is deprecated. Instead pass :params to the Socket constructor\"),this.params=y(e)),this.conn||(this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=function(){return t.onConnOpen()},this.conn.onerror=function(e){return t.onConnError(e)},this.conn.onmessage=function(e){return t.onConnMessage(e)},this.conn.onclose=function(e){return t.onConnClose(e)})}},{key:\"log\",value:function(e,t,n){this.logger(e,t,n)}},{key:\"hasLogger\",value:function(){return null!==this.logger}},{key:\"onOpen\",value:function(e){this.stateChangeCallbacks.open.push(e)}},{key:\"onClose\",value:function(e){this.stateChangeCallbacks.close.push(e)}},{key:\"onError\",value:function(e){this.stateChangeCallbacks.error.push(e)}},{key:\"onMessage\",value:function(e){this.stateChangeCallbacks.message.push(e)}},{key:\"onConnOpen\",value:function(){this.hasLogger()&&this.log(\"transport\",\"connected to \".concat(this.endPointURL())),this.unloaded=!1,this.closeWasClean=!1,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(function(e){return e()})}},{key:\"resetHeartbeat\",value:function(){var e=this;this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(function(){return e.sendHeartbeat()},this.heartbeatIntervalMs))}},{key:\"teardown\",value:function(e,t,n){this.conn&&(this.conn.onclose=function(){},t?this.conn.close(t,n||\"\"):this.conn.close(),this.conn=null),e&&e()}},{key:\"onConnClose\",value:function(e){this.hasLogger()&&this.log(\"transport\",\"close\",e),this.triggerChanError(),clearInterval(this.heartbeatTimer),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(function(t){return t(e)})}},{key:\"onConnError\",value:function(e){this.hasLogger()&&this.log(\"transport\",e),this.triggerChanError(),this.stateChangeCallbacks.error.forEach(function(t){return t(e)})}},{key:\"triggerChanError\",value:function(){this.channels.forEach(function(e){e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(d.error)})}},{key:\"connectionState\",value:function(){switch(this.conn&&this.conn.readyState){case l.connecting:return\"connecting\";case l.open:return\"open\";case l.closing:return\"closing\";default:return\"closed\"}}},{key:\"isConnected\",value:function(){return\"open\"===this.connectionState()}},{key:\"remove\",value:function(e){this.channels=this.channels.filter(function(t){return t.joinRef()!==e.joinRef()})}},{key:\"channel\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new g(e,t,this);return this.channels.push(n),n}},{key:\"push\",value:function(e){var t=this;if(this.hasLogger()){var n=e.topic,i=e.event,r=e.payload,o=e.ref,s=e.join_ref;this.log(\"push\",\"\".concat(n,\" \").concat(i,\" (\").concat(s,\", \").concat(o,\")\"),r)}this.isConnected()?this.encode(e,function(e){return t.conn.send(e)}):this.sendBuffer.push(function(){return t.encode(e,function(e){return t.conn.send(e)})})}},{key:\"makeRef\",value:function(){var e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}},{key:\"sendHeartbeat\",value:function(){if(this.isConnected()){if(this.pendingHeartbeatRef)return this.pendingHeartbeatRef=null,this.hasLogger()&&this.log(\"transport\",\"heartbeat timeout. Attempting to re-establish connection\"),void this.abnormalClose(\"heartbeat timeout\");this.pendingHeartbeatRef=this.makeRef(),this.push({topic:\"phoenix\",event:\"heartbeat\",payload:{},ref:this.pendingHeartbeatRef})}}},{key:\"abnormalClose\",value:function(e){this.closeWasClean=!1,this.conn.close(1e3,e)}},{key:\"flushSendBuffer\",value:function(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(function(e){return e()}),this.sendBuffer=[])}},{key:\"onConnMessage\",value:function(e){var t=this;this.decode(e.data,function(e){var n=e.topic,i=e.event,r=e.payload,o=e.ref,s=e.join_ref;o&&o===t.pendingHeartbeatRef&&(t.pendingHeartbeatRef=null),t.hasLogger()&&t.log(\"receive\",\"\".concat(r.status||\"\",\" \").concat(n,\" \").concat(i,\" \").concat(o&&\"(\"+o+\")\"||\"\"),r);for(var a=0;a<t.channels.length;a++){var u=t.channels[a];u.isMember(n,i,r,s)&&u.trigger(i,r,o,s)}for(var c=0;c<t.stateChangeCallbacks.message.length;c++)t.stateChangeCallbacks.message[c](e)})}}]),e}(),w=function(){function e(t){r(this,e),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(t),this.readyState=l.connecting,this.poll()}return s(e,[{key:\"normalizeEndpoint\",value:function(e){return e.replace(\"ws://\",\"http://\").replace(\"wss://\",\"https://\").replace(new RegExp(\"(.*)/\"+p.websocket),\"$1/\"+p.longpoll)}},{key:\"endpointURL\",value:function(){return E.appendParams(this.pollEndpoint,{token:this.token})}},{key:\"closeAndRetry\",value:function(){this.close(),this.readyState=l.connecting}},{key:\"ontimeout\",value:function(){this.onerror(\"timeout\"),this.closeAndRetry()}},{key:\"poll\",value:function(){var e=this;this.readyState!==l.open&&this.readyState!==l.connecting||E.request(\"GET\",this.endpointURL(),\"application/json\",null,this.timeout,this.ontimeout.bind(this),function(t){if(t){var n=t.status,i=t.token,r=t.messages;e.token=i}else n=0;switch(n){case 200:r.forEach(function(t){return e.onmessage({data:t})}),e.poll();break;case 204:e.poll();break;case 410:e.readyState=l.open,e.onopen(),e.poll();break;case 0:case 500:e.onerror(),e.closeAndRetry();break;default:throw new Error(\"unhandled poll status \".concat(n))}})}},{key:\"send\",value:function(e){var t=this;E.request(\"POST\",this.endpointURL(),\"application/json\",e,this.timeout,this.onerror.bind(this,\"timeout\"),function(e){e&&200===e.status||(t.onerror(e&&e.status),t.closeAndRetry())})}},{key:\"close\",value:function(e,t){this.readyState=l.closed,this.onclose()}}]),e}(),E=function(){function e(){r(this,e)}return s(e,null,[{key:\"request\",value:function(e,t,n,i,r,o,s){if(c.XDomainRequest){var a=new XDomainRequest;this.xdomainRequest(a,e,t,i,r,o,s)}else{var u=c.XMLHttpRequest?new c.XMLHttpRequest:new ActiveXObject(\"Microsoft.XMLHTTP\");this.xhrRequest(u,e,t,n,i,r,o,s)}}},{key:\"xdomainRequest\",value:function(e,t,n,i,r,o,s){var a=this;e.timeout=r,e.open(t,n),e.onload=function(){var t=a.parseJSON(e.responseText);s&&s(t)},o&&(e.ontimeout=o),e.onprogress=function(){},e.send(i)}},{key:\"xhrRequest\",value:function(e,t,n,i,r,o,s,a){var u=this;e.open(t,n,!0),e.timeout=o,e.setRequestHeader(\"Content-Type\",i),e.onerror=function(){a&&a(null)},e.onreadystatechange=function(){if(e.readyState===u.states.complete&&a){var t=u.parseJSON(e.responseText);a(t)}},s&&(e.ontimeout=s),e.send(r)}},{key:\"parseJSON\",value:function(e){if(!e||\"\"===e)return null;try{return JSON.parse(e)}catch(t){return console&&console.log(\"failed to parse JSON response\",e),null}}},{key:\"serialize\",value:function(e,t){var n=[];for(var r in e)if(e.hasOwnProperty(r)){var o=t?\"\".concat(t,\"[\").concat(r,\"]\"):r,s=e[r];\"object\"===i(s)?n.push(this.serialize(s,o)):n.push(encodeURIComponent(o)+\"=\"+encodeURIComponent(s))}return n.join(\"&\")}},{key:\"appendParams\",value:function(e,t){if(0===Object.keys(t).length)return e;var n=e.match(/\\?/)?\"&\":\"?\";return\"\".concat(e).concat(n).concat(this.serialize(t))}}]),e}();E.states={complete:4};var A=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(this,e);var o=i.events||{state:\"presence_state\",diff:\"presence_diff\"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(o.state,function(t){var i=n.caller,r=i.onJoin,o=i.onLeave,s=i.onSync;n.joinRef=n.channel.joinRef(),n.state=e.syncState(n.state,t,r,o),n.pendingDiffs.forEach(function(t){n.state=e.syncDiff(n.state,t,r,o)}),n.pendingDiffs=[],s()}),this.channel.on(o.diff,function(t){var i=n.caller,r=i.onJoin,o=i.onLeave,s=i.onSync;n.inPendingSyncState()?n.pendingDiffs.push(t):(n.state=e.syncDiff(n.state,t,r,o),s())})}return s(e,[{key:\"onJoin\",value:function(e){this.caller.onJoin=e}},{key:\"onLeave\",value:function(e){this.caller.onLeave=e}},{key:\"onSync\",value:function(e){this.caller.onSync=e}},{key:\"list\",value:function(t){return e.list(this.state,t)}},{key:\"inPendingSyncState\",value:function(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}}],[{key:\"syncState\",value:function(e,t,n,i){var r=this,o=this.clone(e),s={},a={};return this.map(o,function(e,n){t[e]||(a[e]=n)}),this.map(t,function(e,t){var n=o[e];if(n){var i=t.metas.map(function(e){return e.phx_ref}),u=n.metas.map(function(e){return e.phx_ref}),c=t.metas.filter(function(e){return u.indexOf(e.phx_ref)<0}),l=n.metas.filter(function(e){return i.indexOf(e.phx_ref)<0});c.length>0&&(s[e]=t,s[e].metas=c),l.length>0&&(a[e]=r.clone(n),a[e].metas=l)}else s[e]=t}),this.syncDiff(o,{joins:s,leaves:a},n,i)}},{key:\"syncDiff\",value:function(e,t,n,i){var r=t.joins,o=t.leaves,s=this.clone(e);return n||(n=function(){}),i||(i=function(){}),this.map(r,function(e,t){var i=s[e];if(s[e]=t,i){var r,o=s[e].metas.map(function(e){return e.phx_ref}),a=i.metas.filter(function(e){return o.indexOf(e.phx_ref)<0});(r=s[e].metas).unshift.apply(r,function(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||\"[object Arguments]\"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError(\"Invalid attempt to spread non-iterable instance\")}()}(a))}n(e,i,t)}),this.map(o,function(e,t){var n=s[e];if(n){var r=t.metas.map(function(e){return e.phx_ref});n.metas=n.metas.filter(function(e){return r.indexOf(e.phx_ref)<0}),i(e,n,t),0===n.metas.length&&delete s[e]}}),s}},{key:\"list\",value:function(e,t){return t||(t=function(e,t){return t}),this.map(e,function(e,n){return t(e,n)})}},{key:\"map\",value:function(e,t){return Object.getOwnPropertyNames(e).map(function(n){return t(n,e[n])})}},{key:\"clone\",value:function(e){return JSON.parse(JSON.stringify(e))}}]),e}(),x=function(){function e(t,n){r(this,e),this.callback=t,this.timerCalc=n,this.timer=null,this.tries=0}return s(e,[{key:\"reset\",value:function(){this.tries=0,clearTimeout(this.timer)}},{key:\"scheduleTimeout\",value:function(){var e=this;clearTimeout(this.timer),this.timer=setTimeout(function(){e.tries=e.tries+1,e.callback()},this.timerCalc(this.tries+1))}}]),e}()}])},function(e,t,n){\"use strict\";var i;n.r(t);var r=\"http://www.w3.org/1999/xhtml\",o=\"undefined\"==typeof document?void 0:document;function s(e,t){var n=e.nodeName,i=t.nodeName;return n===i||!!(t.actualize&&n.charCodeAt(0)<91&&i.charCodeAt(0)>90)&&n===i.toUpperCase()}function a(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,\"\"):e.removeAttribute(n))}var u={OPTION:function(e,t){a(e,t,\"selected\")},INPUT:function(e,t){a(e,t,\"checked\"),a(e,t,\"disabled\"),e.value!==t.value&&(e.value=t.value),t.hasAttribute(\"value\")||e.removeAttribute(\"value\")},TEXTAREA:function(e,t){var n=t.value;e.value!==n&&(e.value=n);var i=e.firstChild;if(i){var r=i.nodeValue;if(r==n||!n&&r==e.placeholder)return;i.nodeValue=n}},SELECT:function(e,t){if(!t.hasAttribute(\"multiple\")){for(var n=0,i=t.firstChild;i;){var r=i.nodeName;if(r&&\"OPTION\"===r.toUpperCase()){if(i.hasAttribute(\"selected\"))break;n++}i=i.nextSibling}e.selectedIndex=n}}},c=1,l=3,h=8;function f(){}function d(e){return e.id}var v=function(e){return function(t,n,a){if(a||(a={}),\"string\"==typeof n)if(\"#document\"===t.nodeName||\"HTML\"===t.nodeName){var v=n;(n=o.createElement(\"html\")).innerHTML=v}else p=n,!i&&o.createRange&&(i=o.createRange()).selectNode(o.body),i&&i.createContextualFragment?y=i.createContextualFragment(p):(y=o.createElement(\"body\")).innerHTML=p,n=y.childNodes[0];var p,y,m,g=a.getNodeKey||d,b=a.onBeforeNodeAdded||f,k=a.onNodeAdded||f,w=a.onBeforeElUpdated||f,E=a.onElUpdated||f,A=a.onBeforeNodeDiscarded||f,x=a.onNodeDiscarded||f,S=a.onBeforeElChildrenUpdated||f,j=!0===a.childrenOnly,C={};function T(e){m?m.push(e):m=[e]}function R(e,t,n){!1!==A(e)&&(t&&t.removeChild(e),x(e),function e(t,n){if(t.nodeType===c)for(var i=t.firstChild;i;){var r=void 0;n&&(r=g(i))?T(r):(x(i),i.firstChild&&e(i,n)),i=i.nextSibling}}(e,n))}function L(e){k(e);for(var t=e.firstChild;t;){var n=t.nextSibling,i=g(t);if(i){var r=C[i];r&&s(t,r)&&(t.parentNode.replaceChild(r,t),O(r,t))}L(t),t=n}}function O(i,r,a){var f,d=g(r);if(d&&delete C[d],!n.isSameNode||!n.isSameNode(t)){if(!a){if(!1===w(i,r))return;if(e(i,r),E(i),!1===S(i,r))return}if(\"TEXTAREA\"!==i.nodeName){var v,p,y,m,k=r.firstChild,A=i.firstChild;e:for(;k;){for(y=k.nextSibling,v=g(k);A;){if(p=A.nextSibling,k.isSameNode&&k.isSameNode(A)){k=y,A=p;continue e}f=g(A);var x=A.nodeType,j=void 0;if(x===k.nodeType&&(x===c?(v?v!==f&&((m=C[v])?A.nextSibling===m?j=!1:(i.insertBefore(m,A),p=A.nextSibling,f?T(f):R(A,i,!0),A=m):j=!1):f&&(j=!1),(j=!1!==j&&s(A,k))&&O(A,k)):x!==l&&x!=h||(j=!0,A.nodeValue!==k.nodeValue&&(A.nodeValue=k.nodeValue))),j){k=y,A=p;continue e}f?T(f):R(A,i,!0),A=p}if(v&&(m=C[v])&&s(m,k))i.appendChild(m),O(m,k);else{var P=b(k);!1!==P&&(P&&(k=P),k.actualize&&(k=k.actualize(i.ownerDocument||o)),i.appendChild(k),L(k))}k=y,A=p}for(;A;)p=A.nextSibling,(f=g(A))?T(f):R(A,i,!0),A=p}var N=u[i.nodeName];N&&N(i,r)}}!function e(t){if(t.nodeType===c)for(var n=t.firstChild;n;){var i=g(n);i&&(C[i]=n),e(n),n=n.nextSibling}}(t);var P,N,_=t,B=_.nodeType,I=n.nodeType;if(!j)if(B===c)I===c?s(t,n)||(x(t),_=function(e,t){for(var n=e.firstChild;n;){var i=n.nextSibling;t.appendChild(n),n=i}return t}(t,(P=n.nodeName,(N=n.namespaceURI)&&N!==r?o.createElementNS(N,P):o.createElement(P)))):_=n;else if(B===l||B===h){if(I===B)return _.nodeValue!==n.nodeValue&&(_.nodeValue=n.nodeValue),_;_=n}if(_===n)x(t);else if(O(_,n,j),m)for(var M=0,V=m.length;M<V;M++){var J=C[m[M]];J&&R(J,J.parentNode,!1)}return!j&&_!==t&&t.parentNode&&(_.actualize&&(_=_.actualize(t.ownerDocument||o)),t.parentNode.replaceChild(_,t)),_}}(function(e,t){var n,i,r,o,s,a=t.attributes;for(n=a.length-1;n>=0;--n)r=(i=a[n]).name,o=i.namespaceURI,s=i.value,o?(r=i.localName||r,e.getAttributeNS(o,r)!==s&&e.setAttributeNS(o,r,s)):e.getAttribute(r)!==s&&e.setAttribute(r,s);for(n=(a=e.attributes).length-1;n>=0;--n)!1!==(i=a[n]).specified&&(r=i.name,(o=i.namespaceURI)?(r=i.localName||r,t.hasAttributeNS(o,r)||e.removeAttributeNS(o,r)):t.hasAttribute(r)||e.removeAttribute(r))});t.default=v},function(e,t,n){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0}),t.View=t.Browser=t.LiveSocket=t.Rendered=t.debug=void 0;var i,r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(i=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&a.return&&a.return()}finally{if(r)throw o}}return n}(e,t);throw new TypeError(\"Invalid attempt to destructure non-iterable instance\")}}(),o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,\"value\"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e},a=n(1),u=(i=a)&&i.__esModule?i:{default:i},c=n(0);function l(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}var h=\"data-phx-view\",f=\"[\"+h+\"]\",d=[\"text\",\"textarea\",\"number\",\"email\",\"password\",\"search\",\"tel\",\"url\"],v=100,p=\"phx-\",y=(t.debug=function(e,t,n,i){console.log(e.id+\" \"+t+\": \"+n+\" - \",i)},function(e){return\"object\"===(void 0===e?\"undefined\":s(e))&&!(e instanceof Array)}),m=function(e,t){return e?e[t]:null},g=function(e){return new URLSearchParams(new FormData(e)).toString()},b=t.Rendered={mergeDiff:function(e,t){return this.isNewFingerprint(t)?t:(function e(t,n){for(var i in n){var r=n[i];y(r)&&t[i]?e(t[i],r):t[i]=r}}(e,t),e)},isNewFingerprint:function(){return!!(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).static},toString:function(e){var t={buffer:\"\"};return this.toOutputBuffer(e,t),t.buffer},toOutputBuffer:function(e,t){if(e.dynamics)return this.comprehensionToBuffer(e,t);var n=e.static;t.buffer+=n[0];for(var i=1;i<n.length;i++)this.dynamicToBuffer(e[i-1],t),t.buffer+=n[i]},comprehensionToBuffer:function(e,t){for(var n=e.dynamics,i=e.static,r=0;r<n.length;r++){var o=n[r];t.buffer+=i[0];for(var s=1;s<i.length;s++)this.dynamicToBuffer(o[s-1],t),t.buffer+=i[s]}},dynamicToBuffer:function(e,t){y(e)?this.toOutputBuffer(e,t):t.buffer+=e}},k=t.LiveSocket=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};l(this,e),this.unloaded=!1,this.socket=new c.Socket(t,i),this.socket.onOpen(function(){n.isUnloaded()&&(n.destroyAllViews(),n.joinRootViews()),n.unloaded=!1}),window.addEventListener(\"beforeunload\",function(e){n.unloaded=!0}),this.bindingPrefix=i.bindingPrefix||p,this.opts=i,this.views={},this.viewLogger=i.viewLogger,this.activeElement=null,this.prevActive=null,this.bindTopLevelEvents()}return o(e,[{key:\"isUnloaded\",value:function(){return this.unloaded}},{key:\"getSocket\",value:function(){return this.socket}},{key:\"log\",value:function(e,t,n){if(this.viewLogger){var i=n(),o=r(i,2),s=o[0],a=o[1];this.viewLogger(e,t,s,a)}}},{key:\"connect\",value:function(){var e=this;return[\"complete\",\"loaded\",\"interactive\"].indexOf(document.readyState)>=0?this.joinRootViews():document.addEventListener(\"DOMContentLoaded\",function(){e.joinRootViews()}),this.socket.connect()}},{key:\"getBindingPrefix\",value:function(){return this.bindingPrefix}},{key:\"binding\",value:function(e){return\"\"+this.getBindingPrefix()+e}},{key:\"disconnect\",value:function(){this.socket.disconnect()}},{key:\"channel\",value:function(e,t){return this.socket.channel(e,t||{})}},{key:\"joinRootViews\",value:function(){var e=this;document.querySelectorAll(f+\":not([data-phx-parent-id])\").forEach(function(t){e.joinView(t)})}},{key:\"joinView\",value:function(e,t){if(!this.getViewById(e.id)){var n=new A(e,this,t);this.views[n.id]=n,n.join()}}},{key:\"owner\",value:function(e,t){var n=this.getViewById(m(e.closest(f),\"id\"));n&&t(n)}},{key:\"getViewById\",value:function(e){return this.views[e]}},{key:\"onViewError\",value:function(e){this.dropActiveElement(e)}},{key:\"destroyAllViews\",value:function(){for(var e in this.views)this.destroyViewById(e)}},{key:\"destroyViewById\",value:function(e){var t=this.views[e];t&&(delete this.views[t.id],t.destroy())}},{key:\"setActiveElement\",value:function(e){var t=this;if(this.activeElement!==e){this.activeElement=e;var n=function(){e===t.activeElement&&(t.activeElement=null),e.removeEventListener(\"mouseup\",t),e.removeEventListener(\"touchend\",t)};e.addEventListener(\"mouseup\",n),e.addEventListener(\"touchend\",n)}}},{key:\"getActiveElement\",value:function(){return document.activeElement===document.body&&this.activeElement||document.activeElement}},{key:\"dropActiveElement\",value:function(e){this.prevActive&&e.ownsElement(this.prevActive)&&(this.prevActive=null)}},{key:\"restorePreviouslyActiveFocus\",value:function(){this.prevActive&&this.prevActive!==document.body&&this.prevActive.focus()}},{key:\"blurActiveElement\",value:function(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive.blur()}},{key:\"bindTopLevelEvents\",value:function(){this.bindClicks(),this.bindForms(),this.bindTargetable([\"keyup\",\"keydown\"],function(e,t,n,i,r,o){n.pushKey(i,t,e,r)}),this.bindTargetable([\"blur\",\"focus\"],function(e,t,n,i,r,o){\"window\"===o&&e.target!==window||e.target===document||n.pushEvent(t,i,r)})}},{key:\"bindTargetable\",value:function(e,t){var n=this,i=function(e){window.addEventListener(e,function(i){var r=n.binding(e),o=n.binding(\"target\"),s=i.target.getAttribute&&i.target.getAttribute(r);s&&!i.target.getAttribute(o)?n.owner(i.target,function(n){return t(i,e,n,i.target,s,null)}):document.querySelectorAll(\"[\"+r+\"][\"+o+\"=window]\").forEach(function(o){var s=o.getAttribute(r);n.owner(o,function(n){return t(i,e,n,o,s,\"window\")})})},!0)},r=!0,o=!1,s=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){i(a.value)}}catch(e){o=!0,s=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw s}}}},{key:\"bindClicks\",value:function(){var e=this;window.addEventListener(\"click\",function(t){var n=e.binding(\"click\"),i=function(e,t){do{if(e.matches(\"[\"+t+\"]\"))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType&&!e.matches(f));return null}(t.target,n),r=i&&i.getAttribute(n);r&&(t.preventDefault(),e.owner(i,function(e){return e.pushEvent(\"click\",i,r)}))},!0)}},{key:\"bindForms\",value:function(){var e=this;window.addEventListener(\"submit\",function(t){var n=t.target.getAttribute(e.binding(\"submit\"));n&&(t.preventDefault(),t.target.disabled=!0,e.owner(t.target,function(e){return e.submitForm(t.target,n)}))},!0);for(var t=function(t){window.addEventListener(t,function(n){var i=n.target;if(\"input\"!==t||\"radio\"!==i.type){var r=i.form&&i.form.getAttribute(e.binding(\"change\"));r&&e.owner(i,function(t){E.isTextualInput(i)?i.setAttribute(\"data-phx-has-focused\",!0):e.setActiveElement(i),t.pushInput(i,r)})}},!0)},n=[\"change\",\"input\"],i=0;i<n.length;i++){t(n[i])}}}]),e}(),w=t.Browser={setCookie:function(e,t){document.cookie=e+\"=\"+t},getCookie:function(e){return document.cookie.replace(new RegExp(\"(?:(?:^|.*;s*)\"+e+\"s*=s*([^;]*).*$)|^.*$\"),\"$1\")},redirect:function(e,t){t&&w.setCookie(\"__phoenix_flash__\",t+\"; max-age=60000; path=/\"),window.location=e}},E={disableForm:function(e,t){var n=t+\"disable-with\";e.classList.add(\"phx-loading\"),e.querySelectorAll(\"[\"+n+\"]\").forEach(function(e){var t=e.getAttribute(n);e.setAttribute(n+\"-restore\",e.innerText),e.innerText=t}),e.querySelectorAll(\"button\").forEach(function(e){e.setAttribute(\"data-phx-disabled\",e.disabled),e.disabled=!0}),e.querySelectorAll(\"input\").forEach(function(e){e.setAttribute(\"data-phx-readonly\",e.readOnly),e.readOnly=!0})},restoreDisabledForm:function(e,t){var n=t+\"disable-with\";e.classList.remove(\"phx-loading\"),e.querySelectorAll(\"[\"+n+\"]\").forEach(function(e){var t=e.getAttribute(n+\"-restore\");t&&(e.innerText=t,e.removeAttribute(n+\"-restore\"))}),e.querySelectorAll(\"button\").forEach(function(e){var t=e.getAttribute(\"data-phx-disabled\");t&&(e.disabled=\"true\"===t,e.removeAttribute(\"data-phx-disabled\"))}),e.querySelectorAll(\"input\").forEach(function(e){var t=e.getAttribute(\"data-phx-readonly\");t&&(e.readOnly=\"true\"===t,e.removeAttribute(\"data-phx-readonly\"))})},discardError:function(e){var t=e.getAttribute&&e.getAttribute(\"data-phx-error-for\");if(t){var n=document.getElementById(t);!t||n.getAttribute(\"data-phx-has-focused\")||n.form.getAttribute(\"data-phx-has-submitted\")||(e.style.display=\"none\")}},isPhxChild:function(e){return e.getAttribute&&e.getAttribute(\"data-phx-parent-id\")},patch:function(e,t,n,i){var r=e.liveSocket.getActiveElement(),o=null,s=null;E.isTextualInput(r)&&(o=r.selectionStart,s=r.selectionEnd),(0,u.default)(t,\"<div>\"+i+\"</div>\",{childrenOnly:!0,onBeforeNodeAdded:function(e){return E.discardError(e),e},onNodeAdded:function(t){if(E.isPhxChild(t)&&e.ownsElement(t))return e.onNewChildAdded(t),!0},onBeforeNodeDiscarded:function(t){if(E.isPhxChild(t))return e.liveSocket.destroyViewById(t.id),!0},onBeforeElUpdated:function(e,t){return E.isPhxChild(t)?(E.mergeAttrs(e,t),!1):(e.getAttribute&&e.getAttribute(\"data-phx-has-submitted\")&&t.setAttribute(\"data-phx-has-submitted\",!0),e.getAttribute&&e.getAttribute(\"data-phx-has-focused\")&&t.setAttribute(\"data-phx-has-focused\",!0),E.discardError(t),!E.isTextualInput(e)||e!==r||(E.mergeInputs(e,t),!1))}}),E.restoreFocus(r,o,s),document.dispatchEvent(new Event(\"phx:update\"))},mergeAttrs:function(e,t){t.getAttributeNames().forEach(function(n){var i=t.getAttribute(n);e.setAttribute(n,i)})},mergeInputs:function(e,t){E.mergeAttrs(e,t),e.readOnly=t.readOnly},restoreFocus:function(e,t,n){E.isTextualInput(e)&&((\"\"===e.value||e.readOnly)&&e.blur(),e.focus(),(e.setSelectionRange&&\"text\"===e.type||\"textarea\"===e.type)&&e.setSelectionRange(t,n))},isTextualInput:function(e){return d.indexOf(e.type)>=0}},A=t.View=function(){function e(t,n,i){var r=this;l(this,e),this.liveSocket=n,this.parent=i,this.newChildrenAdded=!1,this.gracefullyClosed=!1,this.el=t,this.loader=this.el.nextElementSibling,this.id=this.el.id,this.view=this.el.getAttribute(h),this.channel=this.liveSocket.channel(\"lv:\"+this.id,function(){return{session:r.getSession()}}),this.loaderTimer=setTimeout(function(){return r.showLoader()},v),this.bindChannel()}return o(e,[{key:\"getSession\",value:function(){return this.el.getAttribute(\"data-phx-session\")}},{key:\"destroy\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};this.hasGracefullyClosed()?(this.log(\"destroyed\",function(){return[\"the server view has gracefully closed\"]}),e()):(this.log(\"destroyed\",function(){return[\"the child has been removed from the parent\"]}),this.channel.leave().receive(\"ok\",e).receive(\"error\",e).receive(\"timeout\",e))}},{key:\"hideLoader\",value:function(){clearTimeout(this.loaderTimer),this.loader.style.display=\"none\"}},{key:\"showLoader\",value:function(){clearTimeout(this.loaderTimer),this.el.classList=\"phx-disconnected\",this.loader.style.display=\"block\";var e=Math.floor(this.el.clientHeight/2);this.loader.style.top=\"-\"+e+\"px\"}},{key:\"log\",value:function(e,t){this.liveSocket.log(this,e,t)}},{key:\"onJoin\",value:function(e){var t=e.rendered;this.log(\"join\",function(){return[\"\",JSON.stringify(t)]}),this.rendered=t,this.hideLoader(),this.el.classList=\"phx-connected\",E.patch(this,this.el,this.id,b.toString(this.rendered)),this.joinNewChildren()}},{key:\"joinNewChildren\",value:function(){var e=this,t=f+'[data-phx-parent-id=\"'+this.id+'\"]';document.querySelectorAll(t).forEach(function(t){e.liveSocket.getViewById(t.id)||e.liveSocket.joinView(t,e)})}},{key:\"update\",value:function(e){if(t=e,0!==Object.keys(t).length){var t;this.log(\"update\",function(){return[\"\",JSON.stringify(e)]}),this.rendered=b.mergeDiff(this.rendered,e);var n=b.toString(this.rendered);this.newChildrenAdded=!1,E.patch(this,this.el,this.id,n),this.newChildrenAdded&&this.joinNewChildren()}}},{key:\"onNewChildAdded\",value:function(e){this.newChildrenAdded=!0}},{key:\"bindChannel\",value:function(){var e=this;this.channel.on(\"render\",function(t){return e.update(t)}),this.channel.on(\"redirect\",function(e){var t=e.to,n=e.flash;return w.redirect(t,n)}),this.channel.on(\"session\",function(t){var n=t.token;return e.el.setAttribute(\"data-phx-session\",n)}),this.channel.onError(function(t){return e.onError(t)}),this.channel.onClose(function(){return e.onGracefulClose()})}},{key:\"onGracefulClose\",value:function(){this.gracefullyClosed=!0,this.liveSocket.destroyViewById(this.id)}},{key:\"hasGracefullyClosed\",value:function(){return this.gracefullyClosed}},{key:\"join\",value:function(){var e=this;this.parent&&(this.parent.channel.onClose(function(){return e.onGracefulClose()}),this.parent.channel.onError(function(){return e.liveSocket.destroyViewById(e.id)})),this.channel.join().receive(\"ok\",function(t){return e.onJoin(t)}).receive(\"error\",function(t){return e.onJoinError(t)}).receive(\"timeout\",function(){return e.onJoinError(\"timeout\")})}},{key:\"onJoinError\",value:function(e){this.displayError(),this.log(\"error\",function(){return[\"unable to join\",e]})}},{key:\"onError\",value:function(e){this.log(\"error\",function(){return[\"view crashed\",e]}),this.liveSocket.onViewError(this),document.activeElement.blur(),this.liveSocket.isUnloaded()?this.showLoader():this.displayError()}},{key:\"displayError\",value:function(){this.showLoader(),this.el.classList=\"phx-disconnected phx-error\"}},{key:\"pushWithReply\",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};this.channel.push(e,t,2e4).receive(\"ok\",function(e){n.update(e),i()})}},{key:\"pushEvent\",value:function(e,t,n){var i=t.getAttribute(this.binding(\"value\"))||t.value||\"\";this.pushWithReply(\"event\",{type:e,event:n,value:i})}},{key:\"pushKey\",value:function(e,t,n,i){this.pushWithReply(\"event\",{type:t,event:i,value:e.value||n.key})}},{key:\"pushInput\",value:function(e,t){this.pushWithReply(\"event\",{type:\"form\",event:t,value:g(e.form)})}},{key:\"pushFormSubmit\",value:function(e,t,n){this.pushWithReply(\"event\",{type:\"form\",event:t,value:g(e)},n)}},{key:\"ownsElement\",value:function(e){return e.getAttribute(\"data-phx-parent-id\")===this.id||m(e.closest(f),\"id\")===this.id}},{key:\"submitForm\",value:function(e,t){var n=this,i=this.liveSocket.getBindingPrefix();e.setAttribute(\"data-phx-has-submitted\",\"true\"),E.disableForm(e,i),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(e,t,function(){E.restoreDisabledForm(e,i),n.liveSocket.restorePreviouslyActiveFocus()})}},{key:\"binding\",value:function(e){return this.liveSocket.binding(e)}}]),e}();t.default=k},function(e,t){var n;n=function(){return this}();try{n=n||Function(\"return this\")()||(0,eval)(\"this\")}catch(e){\"object\"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){t.Phoenix||(t.Phoenix={}),e.exports=t.Phoenix.LiveView=n(2)}).call(this,n(3))}])});\n\n//# sourceURL=webpack:///./node_modules/phoenix_live_view/priv/static/phoenix_live_view.js?");
/***/ }),
/***/ 0:
/*!*************************!*\
!*** multi ./js/app.js ***!
\*************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("module.exports = __webpack_require__(/*! ./js/app.js */\"./js/app.js\");\n\n\n//# sourceURL=webpack:///multi_./js/app.js?");
/***/ })
/******/ });