text: /*! For license information please see app.js.LICENSE.txt */
  !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}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="/js/",n(n.s=3)}([function(e,t,n){var i,r;void 0===(r="function"==typeof(i=function(){var e,t,n={version:"0.2.0"},i=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function r(e,t,n){return e<t?t:e>n?n:e}function o(e){return 100*(-1+e)}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(i[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=r(e,i.minimum,1),n.status=1===e?null:e;var u=n.render(!t),c=u.querySelector(i.barSelector),l=i.speed,h=i.easing;return u.offsetWidth,a((function(t){""===i.positionUsing&&(i.positionUsing=n.getPositioningCSS()),s(c,function(e,t,n){var r;return(r="translate3d"===i.positionUsing?{transform:"translate3d("+o(e)+"%,0,0)"}:"translate"===i.positionUsing?{transform:"translate("+o(e)+"%,0)"}:{"margin-left":o(e)+"%"}).transition="all "+t+"ms "+n,r}(e,l,h)),1===e?(s(u,{transition:"none",opacity:1}),u.offsetWidth,setTimeout((function(){s(u,{transition:"all "+l+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),l)}),l)):setTimeout(t,l)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),i.trickleSpeed)};return i.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*r(Math.random()*t,.1,.95)),t=r(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*i.trickleRate)},e=0,t=0,n.promise=function(i){return i&&"resolved"!==i.state()?(0===t&&n.start(),e++,t++,i.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");c(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=i.template;var r,a=t.querySelector(i.barSelector),u=e?"-100":o(n.status||0),l=document.querySelector(i.parent);return s(a,{transition:"all 0 linear",transform:"translate3d("+u+"%,0,0)"}),i.showSpinner||(r=t.querySelector(i.spinnerSelector))&&d(r),l!=document.body&&c(l,"nprogress-custom-parent"),l.appendChild(t),t},n.remove=function(){l(document.documentElement,"nprogress-busy"),l(document.querySelector(i.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&d(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var a=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),s=function(){var e=["Webkit","O","Moz","ms"],t={};function n(n){return n=n.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()})),t[n]||(t[n]=function(t){var n=document.body.style;if(t in n)return t;for(var i,r=e.length,o=t.charAt(0).toUpperCase()+t.slice(1);r--;)if((i=e[r]+o)in n)return i;return t}(n))}function i(e,t,i){t=n(t),e.style[t]=i}return function(e,t){var n,r,o=arguments;if(2==o.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&i(e,n,r);else i(e,o[1],o[2])}}();function u(e,t){return("string"==typeof e?e:h(e)).indexOf(" "+t+" ")>=0}function c(e,t){var n=h(e),i=n+t;u(n,t)||(e.className=i.substring(1))}function l(e,t){var n,i=h(e);u(e,t)&&(n=i.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function h(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function d(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n})?i.call(t,n,t,e):i)||(e.exports=r)},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||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";function i(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e){return(r="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 o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n}}(e,t)||a(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),e}n.r(t),n.d(t,"Channel",(function(){return T})),n.d(t,"Serializer",(function(){return L})),n.d(t,"Socket",(function(){return R})),n.d(t,"LongPoll",(function(){return j})),n.d(t,"Ajax",(function(){return I})),n.d(t,"Presence",(function(){return O}));var h="undefined"!=typeof self?self:null,d="undefined"!=typeof window?window:null,f=h||d||void 0,v="closed",p="errored",m="joined",g="joining",y="leaving",b="phx_close",k="phx_error",w="phx_join",E="phx_reply",S="phx_leave",C=[b,k,w,E,S],x="websocket",A=function(e){return"function"==typeof e?e:function(){return e}},P=function(){function e(t,n,i,r){u(this,e),this.channel=t,this.event=n,this.payload=i||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}return l(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}(),T=function(){function e(t,n,i){var r=this;u(this,e),this.state=v,this.topic=t,this.params=A(n||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new P(this,w,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new _((function(){r.socket.isConnected()&&r.rejoin()}),this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError((function(){return r.rejoinTimer.reset()}))),this.stateChangeRefs.push(this.socket.onOpen((function(){r.rejoinTimer.reset(),r.isErrored()&&r.rejoin()}))),this.joinPush.receive("ok",(function(){r.state=m,r.rejoinTimer.reset(),r.pushBuffer.forEach((function(e){return e.send()})),r.pushBuffer=[]})),this.joinPush.receive("error",(function(){r.state=p,r.socket.isConnected()&&r.rejoinTimer.scheduleTimeout()})),this.onClose((function(){r.rejoinTimer.reset(),r.socket.hasLogger()&&r.socket.log("channel","close ".concat(r.topic," ").concat(r.joinRef())),r.state=v,r.socket.remove(r)})),this.onError((function(e){r.socket.hasLogger()&&r.socket.log("channel","error ".concat(r.topic),e),r.isJoining()&&r.joinPush.reset(),r.state=p,r.socket.isConnected()&&r.rejoinTimer.scheduleTimeout()})),this.joinPush.receive("timeout",(function(){r.socket.hasLogger()&&r.socket.log("channel","timeout ".concat(r.topic," (").concat(r.joinRef(),")"),r.joinPush.timeout),new P(r,S,A({}),r.timeout).send(),r.state=p,r.joinPush.reset(),r.socket.isConnected()&&r.rejoinTimer.scheduleTimeout()})),this.on(E,(function(e,t){r.trigger(r.replyEventName(t),e)}))}return l(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(b,e)}},{key:"onError",value:function(e){return this.on(k,(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 P(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.joinPush.cancelTimeout(),this.state=y;var n=function(){e.socket.hasLogger()&&e.socket.log("channel","leave ".concat(e.topic)),e.trigger(b,"leave")},i=new P(this,S,A({}),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 C.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:"rejoin",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=g,this.joinPush.resend(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=this.bindings.filter((function(t){return t.event===e})),a=0;a<o.length;a++)o[a].callback(r,n,i||this.joinRef())}},{key:"replyEventName",value:function(e){return"chan_reply_".concat(e)}},{key:"isClosed",value:function(){return this.state===v}},{key:"isErrored",value:function(){return this.state===p}},{key:"isJoined",value:function(){return this.state===m}},{key:"isJoining",value:function(){return this.state===g}},{key:"isLeaving",value:function(){return this.state===y}}]),e}(),L={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=o(JSON.parse(e),5);return t({join_ref:n[0],ref:n[1],topic:n[2],event:n[3],payload:n[4]})}},R=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u(this,e),this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=i.timeout||1e4,this.transport=i.transport||f.WebSocket||j,this.defaultEncoder=L.encode,this.defaultDecoder=L.decode,this.closeWasClean=!1,this.unloaded=!1,this.binaryType=i.binaryType||"arraybuffer",this.transport!==j?(this.encode=i.encode||this.defaultEncoder,this.decode=i.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder),d&&d.addEventListener&&d.addEventListener("unload",(function(e){n.conn&&(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=A(i.params||{}),this.endPoint="".concat(t,"/").concat(x),this.vsn=i.vsn||"2.0.0",this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new _((function(){n.teardown((function(){return n.connect()}))}),this.reconnectAfterMs)}return l(e,[{key:"protocol",value:function(){return location.protocol.match(/^https/)?"wss":"ws"}},{key:"endPointURL",value:function(){var e=I.appendParams(I.appendParams(this.endPoint,this.params()),{vsn:this.vsn});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=A(e)),this.conn||(this.closeWasClean=!1,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){var t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}},{key:"onClose",value:function(e){var t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}},{key:"onError",value:function(e){var t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}},{key:"onMessage",value:function(e){var t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}},{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(0,o(e,2)[1])()}))}},{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){var i=this;if(!this.conn)return e&&e();this.waitForBufferDone((function(){i.conn&&(t?i.conn.close(t,n||""):i.conn.close()),i.waitForSocketClosed((function(){i.conn&&(i.conn.onclose=function(){},i.conn=null),e&&e()}))}))}},{key:"waitForBufferDone",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;5!==n&&this.conn&&this.conn.bufferedAmount?setTimeout((function(){t.waitForBufferDone(e,n+1)}),150*n):e()}},{key:"waitForSocketClosed",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;5!==n&&this.conn&&3!==this.conn.readyState?setTimeout((function(){t.waitForSocketClosed(e,n+1)}),150*n):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(0,o(t,2)[1])(e)}))}},{key:"onConnError",value:function(e){this.hasLogger()&&this.log("transport",e),this.triggerChanError(),this.stateChangeCallbacks.error.forEach((function(t){return(0,o(t,2)[1])(e)}))}},{key:"triggerChanError",value:function(){this.channels.forEach((function(e){e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(k)}))}},{key:"connectionState",value:function(){switch(this.conn&&this.conn.readyState){case 0:return"connecting";case 1:return"open";case 2:return"closing";default:return"closed"}}},{key:"isConnected",value:function(){return"open"===this.connectionState()}},{key:"remove",value:function(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter((function(t){return t.joinRef()!==e.joinRef()}))}},{key:"off",value:function(e){for(var t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter((function(t){var n=o(t,1)[0];return-1===e.indexOf(n)}))}},{key:"channel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new T(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,a=e.join_ref;this.log("push","".concat(n," ").concat(i," (").concat(a,", ").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,a=e.ref,s=e.join_ref;a&&a===t.pendingHeartbeatRef&&(t.pendingHeartbeatRef=null),t.hasLogger()&&t.log("receive","".concat(r.status||""," ").concat(n," ").concat(i," ").concat(a&&"("+a+")"||""),r);for(var u=0;u<t.channels.length;u++){var c=t.channels[u];c.isMember(n,i,r,s)&&c.trigger(i,r,a,s)}for(var l=0;l<t.stateChangeCallbacks.message.length;l++)(0,o(t.stateChangeCallbacks.message[l],2)[1])(e)}))}},{key:"leaveOpenTopic",value:function(e){var t=this.channels.find((function(t){return t.topic===e&&(t.isJoined()||t.isJoining())}));t&&(this.hasLogger()&&this.log("transport",'leaving duplicate topic "'.concat(e,'"')),t.leave())}}]),e}(),j=function(){function e(t){u(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=0,this.poll()}return l(e,[{key:"normalizeEndpoint",value:function(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+x),"$1/longpoll")}},{key:"endpointURL",value:function(){return I.appendParams(this.pollEndpoint,{token:this.token})}},{key:"closeAndRetry",value:function(){this.close(),this.readyState=0}},{key:"ontimeout",value:function(){this.onerror("timeout"),this.closeAndRetry()}},{key:"poll",value:function(){var e=this;1!==this.readyState&&0!==this.readyState||I.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=1,e.onopen(),e.poll();break;case 403:e.onerror(),e.close();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;I.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=3,this.onclose()}}]),e}(),I=function(){function e(){u(this,e)}return l(e,null,[{key:"request",value:function(e,t,n,i,r,o,a){if(f.XDomainRequest){var s=new XDomainRequest;this.xdomainRequest(s,e,t,i,r,o,a)}else{var u=new f.XMLHttpRequest;this.xhrRequest(u,e,t,n,i,r,o,a)}}},{key:"xdomainRequest",value:function(e,t,n,i,r,o,a){var s=this;e.timeout=r,e.open(t,n),e.onload=function(){var t=s.parseJSON(e.responseText);a&&a(t)},o&&(e.ontimeout=o),e.onprogress=function(){},e.send(i)}},{key:"xhrRequest",value:function(e,t,n,i,r,o,a,s){var u=this;e.open(t,n,!0),e.timeout=o,e.setRequestHeader("Content-Type",i),e.onerror=function(){s&&s(null)},e.onreadystatechange=function(){if(e.readyState===u.states.complete&&s){var t=u.parseJSON(e.responseText);s(t)}},a&&(e.ontimeout=a),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 i in e)if(e.hasOwnProperty(i)){var o=t?"".concat(t,"[").concat(i,"]"):i,a=e[i];"object"===r(a)?n.push(this.serialize(a,o)):n.push(encodeURIComponent(o)+"="+encodeURIComponent(a))}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}();I.states={complete:4};var O=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u(this,e);var r=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(r.state,(function(t){var i=n.caller,r=i.onJoin,o=i.onLeave,a=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=[],a()})),this.channel.on(r.diff,(function(t){var i=n.caller,r=i.onJoin,o=i.onLeave,a=i.onSync;n.inPendingSyncState()?n.pendingDiffs.push(t):(n.state=e.syncDiff(n.state,t,r,o),a())}))}return l(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),a={},s={};return this.map(o,(function(e,n){t[e]||(s[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&&(a[e]=t,a[e].metas=c),l.length>0&&(s[e]=r.clone(n),s[e].metas=l)}else a[e]=t})),this.syncDiff(o,{joins:a,leaves:s},n,i)}},{key:"syncDiff",value:function(e,t,n,r){var o=t.joins,a=t.leaves,s=this.clone(e);return n||(n=function(){}),r||(r=function(){}),this.map(o,(function(e,t){var r=s[e];if(s[e]=t,r){var o,a=s[e].metas.map((function(e){return e.phx_ref})),u=r.metas.filter((function(e){return a.indexOf(e.phx_ref)<0}));(o=s[e].metas).unshift.apply(o,i(u))}n(e,r,t)})),this.map(a,(function(e,t){var n=s[e];if(n){var i=t.metas.map((function(e){return e.phx_ref}));n.metas=n.metas.filter((function(e){return i.indexOf(e.phx_ref)<0})),r(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}(),_=function(){function e(t,n){u(this,e),this.callback=t,this.timerCalc=n,this.timer=null,this.tries=0}return l(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){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,{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=2)}([function(e,t,n){"use strict";n.r(t);var i,r="undefined"==typeof document?void 0:document,o=!!r&&"content"in r.createElement("template"),a=!!r&&r.createRange&&"createContextualFragment"in r.createRange();function s(e){return e=e.trim(),o?function(e){var t=r.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(e):a?function(e){return i||(i=r.createRange()).selectNode(r.body),i.createContextualFragment(e).childNodes[0]}(e):function(e){var t=r.createElement("body");return t.innerHTML=e,t.childNodes[0]}(e)}function u(e,t){var n,i,r=e.nodeName,o=t.nodeName;return r===o||(n=r.charCodeAt(0),i=o.charCodeAt(0),n<=90&&i>=97?r===o.toUpperCase():i<=90&&n>=97&&o===r.toUpperCase())}function c(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n))}var l={OPTION:function(e,t){var n=e.parentNode;if(n){var i=n.nodeName.toUpperCase();"OPTGROUP"===i&&(i=(n=n.parentNode)&&n.nodeName.toUpperCase()),"SELECT"!==i||n.hasAttribute("multiple")||(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),n.selectedIndex=-1)}c(e,t,"selected")},INPUT:function(e,t){c(e,t,"checked"),c(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,i,r=-1,o=0,a=e.firstChild;a;)if("OPTGROUP"===(i=a.nodeName&&a.nodeName.toUpperCase()))a=(n=a).firstChild;else{if("OPTION"===i){if(a.hasAttribute("selected")){r=o;break}o++}!(a=a.nextSibling)&&n&&(a=n.nextSibling,n=null)}e.selectedIndex=r}}};function h(){}function d(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}var f=function(e){return function(t,n,i){if(i||(i={}),"string"==typeof n)if("#document"===t.nodeName||"HTML"===t.nodeName||"BODY"===t.nodeName){var o=n;(n=r.createElement("html")).innerHTML=o}else n=s(n);var a=i.getNodeKey||d,c=i.onBeforeNodeAdded||h,f=i.onNodeAdded||h,v=i.onBeforeElUpdated||h,p=i.onElUpdated||h,m=i.onBeforeNodeDiscarded||h,g=i.onNodeDiscarded||h,y=i.onBeforeElChildrenUpdated||h,b=!0===i.childrenOnly,k=Object.create(null),w=[];function E(e){w.push(e)}function S(e,t,n){!1!==m(e)&&(t&&t.removeChild(e),g(e),function e(t,n){if(1===t.nodeType)for(var i=t.firstChild;i;){var r=void 0;n&&(r=a(i))?E(r):(g(i),i.firstChild&&e(i,n)),i=i.nextSibling}}(e,n))}function C(e){f(e);for(var t=e.firstChild;t;){var n=t.nextSibling,i=a(t);if(i){var r=k[i];r&&u(t,r)?(t.parentNode.replaceChild(r,t),x(r,t)):C(t)}else C(t);t=n}}function x(t,n,i){var o=a(n);if(o&&delete k[o],!i){if(!1===v(t,n))return;if(e(t,n),p(t),!1===y(t,n))return}"TEXTAREA"!==t.nodeName?function(e,t){var n,i,o,s,h,d=t.firstChild,f=e.firstChild;e:for(;d;){for(s=d.nextSibling,n=a(d);f;){if(o=f.nextSibling,d.isSameNode&&d.isSameNode(f)){d=s,f=o;continue e}i=a(f);var v=f.nodeType,p=void 0;if(v===d.nodeType&&(1===v?(n?n!==i&&((h=k[n])?o===h?p=!1:(e.insertBefore(h,f),i?E(i):S(f,e,!0),f=h):p=!1):i&&(p=!1),(p=!1!==p&&u(f,d))&&x(f,d)):3!==v&&8!=v||(p=!0,f.nodeValue!==d.nodeValue&&(f.nodeValue=d.nodeValue))),p){d=s,f=o;continue e}i?E(i):S(f,e,!0),f=o}if(n&&(h=k[n])&&u(h,d))e.appendChild(h),x(h,d);else{var m=c(d);!1!==m&&(m&&(d=m),d.actualize&&(d=d.actualize(e.ownerDocument||r)),e.appendChild(d),C(d))}d=s,f=o}!function(e,t,n){for(;t;){var i=t.nextSibling;(n=a(t))?E(n):S(t,e,!0),t=i}}(e,f,i);var g=l[e.nodeName];g&&g(e,t)}(t,n):l.TEXTAREA(t,n)}!function e(t){if(1===t.nodeType||11===t.nodeType)for(var n=t.firstChild;n;){var i=a(n);i&&(k[i]=n),e(n),n=n.nextSibling}}(t);var A=t,P=A.nodeType,T=n.nodeType;if(!b)if(1===P)1===T?u(t,n)||(g(t),A=function(e,t){for(var n=e.firstChild;n;){var i=n.nextSibling;t.appendChild(n),n=i}return t}(t,function(e,t){return t&&"http://www.w3.org/1999/xhtml"!==t?r.createElementNS(t,e):r.createElement(e)}(n.nodeName,n.namespaceURI))):A=n;else if(3===P||8===P){if(T===P)return A.nodeValue!==n.nodeValue&&(A.nodeValue=n.nodeValue),A;A=n}if(A===n)g(t);else{if(n.isSameNode&&n.isSameNode(A))return;if(x(A,n,b),w)for(var L=0,R=w.length;L<R;L++){var j=k[w[L]];j&&S(j,j.parentNode,!1)}}return!b&&A!==t&&t.parentNode&&(A.actualize&&(A=A.actualize(t.ownerDocument||r)),t.parentNode.replaceChild(A,t)),A}}((function(e,t){var n,i,r,o,a=t.attributes;if(11!==t.nodeType&&11!==e.nodeType){for(var s=a.length-1;s>=0;s--)i=(n=a[s]).name,r=n.namespaceURI,o=n.value,r?(i=n.localName||i,e.getAttributeNS(r,i)!==o&&("xmlns"===n.prefix&&(i=n.name),e.setAttributeNS(r,i,o))):e.getAttribute(i)!==o&&e.setAttribute(i,o);for(var u=e.attributes,c=u.length-1;c>=0;c--)i=(n=u[c]).name,(r=n.namespaceURI)?(i=n.localName||i,t.hasAttributeNS(r,i)||e.removeAttributeNS(r,i)):t.hasAttribute(i)||e.removeAttribute(i)}}));function v(e){return S(e)||g(e)||C(e)||E()}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(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 k(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),e}function w(e,t){return S(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n}}(e,t)||C(e,t)||E()}function E(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function S(e){if(Array.isArray(e))return e}function C(e,t){if(e){if("string"==typeof e)return x(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x(e,t):void 0}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function A(e){return(A="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)}n.d(t,"debug",(function(){return B})),n.d(t,"Rendered",(function(){return K})),n.d(t,"LiveSocket",(function(){return X})),n.d(t,"Browser",(function(){return $})),n.d(t,"DOM",(function(){return G})),n.d(t,"View",(function(){return Z}));var P=[1e3,3e3],T="data-phx-view",L=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading"],R="data-phx-component",j="data-phx-ref",I="[".concat(T,"]"),O=["text","textarea","number","email","password","search","tel","url","date","time"],_=["checkbox","radio"],D="data-phx-static",N="phx-",H={debounce:300,throttle:300},M=function(e,t){return console.error&&console.error(e,t)},B=function(e,t,n,i){e.liveSocket.isDebugEnabled()&&console.log("".concat(e.id," ").concat(t,": ").concat(n," - "),i)},U=function(e){return"function"==typeof e?e:function(){return e}},J=function(e){return JSON.parse(JSON.stringify(e))},F=function(e,t,n){do{if(e.matches("[".concat(t,"]")))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType&&!(n&&n.isSameNode(e)||e.matches(I)));return null},q=function(e){return null!==e&&"object"===A(e)&&!(e instanceof Array)},V=function(e){for(var t in e)return!1;return!0},W=function(e,t){return e&&t(e)},z=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=new FormData(e),r=new URLSearchParams,o=function(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=C(e))){var t=0,n=function(){};return{s:n,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,r,o=!0,a=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return o=e.done,e},e:function(e){a=!0,r=e},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw r}}}}(i.entries());try{for(o.s();!(t=o.n()).done;){var a=w(t.value,2),s=a[0],u=a[1];r.append(s,u)}}catch(e){o.e(e)}finally{o.f()}for(var c in n)r.append(c,n[c]);return r.toString()},K=function(){function e(t,n){y(this,e),this.viewId=t,this.rendered={},this.mergeDiff(n)}return k(e,null,[{key:"extract",value:function(e){var t=e.r,n=e.e,i=e.t;return delete e.r,delete e.e,delete e.t,{diff:e,title:i,reply:t||null,events:n||[]}}}]),k(e,[{key:"parentViewId",value:function(){return this.viewId}},{key:"toString",value:function(e){return this.recursiveToString(this.rendered,this.rendered.c,e)}},{key:"recursiveToString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.c,n=arguments.length>2?arguments[2]:void 0,i={buffer:"",components:t,onlyCids:n=n?new Set(n):null};return this.toOutputBuffer(e,i),i.buffer}},{key:"componentCIDs",value:function(e){return Object.keys(e.c||{}).map((function(e){return parseInt(e)}))}},{key:"isComponentOnlyDiff",value:function(e){return!!e.c&&1===Object.keys(e).length}},{key:"getComponent",value:function(e,t){return e.c[t]}},{key:"mergeDiff",value:function(e){var t=e.c;if(delete e.c,this.rendered=this.recursiveMerge(this.rendered,e),this.rendered.c=this.rendered.c||{},t){var n=this.rendered.c;for(var i in t){var r=t[i],o=r,a=o.s;if("number"==typeof a){for(;"number"==typeof a;)a=(o=a>0?t[a]:n[-a]).s;o=J(o),this.doRecursiveMerge(o,r),o.s=a}else o=n[i]||{},o=this.recursiveMerge(o,r);t[i]=o}for(var s in t)n[s]=t[s];e.c=t}}},{key:"recursiveMerge",value:function(e,t){return void 0!==t.s?t:(this.doRecursiveMerge(e,t),e)}},{key:"doRecursiveMerge",value:function(e,t){for(var n in t){var i=t[n],r=e[n];q(i)&&void 0===i.s&&q(r)?this.doRecursiveMerge(r,i):e[n]=i}}},{key:"componentToString",value:function(e){return this.recursiveCIDToString(this.rendered.c,e)}},{key:"pruneCIDs",value:function(e){var t=this;e.forEach((function(e){return delete t.rendered.c[e]}))}},{key:"get",value:function(){return this.rendered}},{key:"isNewFingerprint",value:function(){return!!(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).s}},{key:"toOutputBuffer",value:function(e,t){if(e.d)return this.comprehensionToBuffer(e,t);var n=e.s;t.buffer+=n[0];for(var i=1;i<n.length;i++)this.dynamicToBuffer(e[i-1],t),t.buffer+=n[i]}},{key:"comprehensionToBuffer",value:function(e,t){for(var n=e.d,i=e.s,r=0;r<n.length;r++){var o=n[r];t.buffer+=i[0];for(var a=1;a<i.length;a++)this.dynamicToBuffer(o[a-1],t),t.buffer+=i[a]}}},{key:"dynamicToBuffer",value:function(e,t){"number"==typeof e?t.buffer+=this.recursiveCIDToString(t.components,e,t.onlyCids):q(e)?this.toOutputBuffer(e,t):t.buffer+=e}},{key:"recursiveCIDToString",value:function(e,t,n){var i=this,r=e[t]||M("no component for CID ".concat(t),e),o=document.createElement("template");o.innerHTML=this.recursiveToString(r,e,n);var a=o.content,s=n&&!n.has(t),u=w(Array.from(a.childNodes).reduce((function(e,n,r){var a=w(e,2),u=a[0],c=a[1];return n.nodeType===Node.ELEMENT_NODE?n.getAttribute(R)?[u,!0]:(n.setAttribute(R,t),n.id||(n.id="".concat(i.parentViewId(),"-").concat(t,"-").concat(r)),s&&(n.setAttribute("data-phx-skip",""),n.innerHTML=""),[!0,c]):""!==n.nodeValue.trim()?(M("only HTML element tags are allowed at the root of components.\n\n"+'got: "'.concat(n.nodeValue.trim(),'"\n\n')+"within:\n",o.innerHTML.trim()),n.replaceWith(i.createSpan(n.nodeValue,t)),[!0,c]):(n.remove(),[u,c])}),[!1,!1]),2),c=u[0],l=u[1];return c||l?!c&&l?(M("expected at least one HTML element tag directly inside a component, but only subcomponents were found. A component must render at least one HTML tag directly inside itself.",o.innerHTML.trim()),o.innerHTML):o.innerHTML:(M("expected at least one HTML element tag inside a component, but the component is empty:\n",o.innerHTML.trim()),this.createSpan("",t).outerHTML)}},{key:"createSpan",value:function(e,t){var n=document.createElement("span");return n.innerText=e,n.setAttribute(R,t),n}}]),e}(),X=function(){function e(t,n){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(this,e),this.unloaded=!1,!n||"Object"===n.constructor.name)throw new Error('\n      a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example:\n\n          import {Socket} from "phoenix"\n          import {LiveSocket} from "phoenix_live_view"\n          let liveSocket = new LiveSocket("/live", Socket, {...})\n      ');this.socket=new n(t,r),this.bindingPrefix=r.bindingPrefix||N,this.opts=r,this.params=U(r.params||{}),this.viewLogger=r.viewLogger,this.metadataCallbacks=r.metadata||{},this.defaults=Object.assign(J(H),r.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.linkRef=0,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=J(window.location),this.hooks=r.hooks||{},this.loaderTimeout=r.loaderTimeout||1,this.boundTopLevelEvents=!1,this.domCallbacks=r.dom||{onBeforeElUpdated:U()},window.addEventListener("unload",(function(e){i.unloaded=!0})),this.socket.onOpen((function(){i.isUnloaded()&&window.location.reload()}))}return k(e,[{key:"isProfileEnabled",value:function(){return"true"===sessionStorage.getItem("phx:live-socket:profiling")}},{key:"isDebugEnabled",value:function(){return"true"===sessionStorage.getItem("phx:live-socket:debug")}},{key:"enableDebug",value:function(){sessionStorage.setItem("phx:live-socket:debug","true")}},{key:"enableProfiling",value:function(){sessionStorage.setItem("phx:live-socket:profiling","true")}},{key:"disableDebug",value:function(){sessionStorage.removeItem("phx:live-socket:debug")}},{key:"disableProfiling",value:function(){sessionStorage.removeItem("phx:live-socket:profiling")}},{key:"enableLatencySim",value:function(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),sessionStorage.setItem("phx:live-socket:latency-sim",e)}},{key:"disableLatencySim",value:function(){sessionStorage.removeItem("phx:live-socket:latency-sim")}},{key:"getLatencySim",value:function(){var e=sessionStorage.getItem("phx:live-socket:latency-sim");return e?parseInt(e):null}},{key:"getSocket",value:function(){return this.socket}},{key:"connect",value:function(){var e=this,t=function(){e.joinRootViews()&&(e.bindTopLevelEvents(),e.socket.connect())};["complete","loaded","interactive"].indexOf(document.readyState)>=0?t():document.addEventListener("DOMContentLoaded",(function(){return t()}))}},{key:"disconnect",value:function(e){this.socket.disconnect(e)}},{key:"triggerDOM",value:function(e,t){var n;(n=this.domCallbacks)[e].apply(n,function(e){return function(e){if(Array.isArray(e))return x(e)}(e)||g(e)||C(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t))}},{key:"time",value:function(e,t){if(!this.isProfileEnabled()||!console.time)return t();console.time(e);var n=t();return console.timeEnd(e),n}},{key:"log",value:function(e,t,n){if(this.viewLogger){var i=w(n(),2),r=i[0],o=i[1];this.viewLogger(e,t,r,o)}else if(this.isDebugEnabled()){var a=w(n(),2),s=a[0],u=a[1];B(e,t,s,u)}}},{key:"onChannel",value:function(e,t,n){var i=this;e.on(t,(function(e){var t=i.getLatencySim();t?(console.log("simulating ".concat(t,"ms of latency from server to client")),setTimeout((function(){return n(e)}),t)):n(e)}))}},{key:"wrapPush",value:function(e){var t=this.getLatencySim();if(!t)return e();console.log("simulating ".concat(t,"ms of latency from client to server"));var n={receives:[],receive:function(e,t){this.receives.push([e,t])}};return setTimeout((function(){n.receives.reduce((function(e,t){var n=w(t,2),i=n[0],r=n[1];return e.receive(i,r)}),e())}),t),n}},{key:"reloadWithJitter",value:function(e){var t=this;e.destroy(),this.disconnect();var n=P[0],i=P[1],r=Math.floor(Math.random()*(i-n+1))+n,o=$.updateLocal(e.name(),"consecutive-reloads",0,(function(e){return e+1}));this.log(e,"join",(function(){return["encountered ".concat(o," consecutive reloads")]})),o>10&&(this.log(e,"join",(function(){return["exceeded ".concat(10," consecutive reloads. Entering failsafe mode")]})),r=3e4),setTimeout((function(){t.hasPendingLink()?window.location=t.pendingLink:window.location.reload()}),r)}},{key:"getHookCallbacks",value:function(e){return this.hooks[e]}},{key:"isUnloaded",value:function(){return this.unloaded}},{key:"isConnected",value:function(){return this.socket.isConnected()}},{key:"getBindingPrefix",value:function(){return this.bindingPrefix}},{key:"binding",value:function(e){return"".concat(this.getBindingPrefix()).concat(e)}},{key:"channel",value:function(e,t){return this.socket.channel(e,t)}},{key:"joinRootViews",value:function(){var e=this,t=!1;return G.all(document,"".concat(I,":not([").concat("data-phx-parent-id","])"),(function(n){if(!e.getRootById(n.id)){var i=e.joinRootView(n,e.getHref());e.root=e.root||i,n.getAttribute("data-phx-main")&&(e.main=i)}t=!0})),t}},{key:"redirect",value:function(e,t){this.disconnect(),$.redirect(e,t)}},{key:"replaceMain",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.setPendingLink(e),o=this.main.el;this.main.showLoader(this.loaderTimeout),this.main.destroy(),$.fetchPage(e,(function(a,s){if(200!==a)return n.redirect(e);var u=document.createElement("template");u.innerHTML=s;var c=u.content.childNodes[0];if(!c||!n.isPhxView(c))return n.redirect(e);n.joinRootView(c,e,t,(function(e,t){1===t&&(n.commitPendingLink(r)?(o.replaceWith(e.el),n.main=e,i&&i()):e.destroy())}))}))}},{key:"isPhxView",value:function(e){return e.getAttribute&&null!==e.getAttribute(T)}},{key:"joinRootView",value:function(e,t,n,i){var r=new Z(e,this,null,t,n);return this.roots[r.id]=r,r.join(i),r}},{key:"owner",value:function(e,t){var n=this,i=W(e.closest(I),(function(e){return n.getViewByEl(e)}));i&&t(i)}},{key:"withinOwners",value:function(e,t){var n=this;this.owner(e,(function(i){var r=e.getAttribute(n.binding("target"));null===r?t(i,e):i.withinTargets(r,t)}))}},{key:"getViewByEl",value:function(e){var t=e.getAttribute("data-phx-root-id");return W(this.getRootById(t),(function(t){return t.getDescendentByEl(e)}))}},{key:"getRootById",value:function(e){return this.roots[e]}},{key:"destroyAllViews",value:function(){for(var e in this.roots)this.roots[e].destroy(),delete this.roots[e]}},{key:"destroyViewByEl",value:function(e){var t=this.getRootById(e.getAttribute("data-phx-root-id"));t&&t.destroyDescendent(e.id)}},{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:document.activeElement||document.body}},{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(){var e=this;this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,window.addEventListener("pageshow",(function(t){t.persisted&&(e.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())})),this.bindClicks(),this.bindNav(),this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(function(t,n,i,r,o,a,s){var u=r.getAttribute(e.binding("key")),c=t.key&&t.key.toLowerCase();u&&u.toLowerCase()!==c||i.pushKey(r,o,n,a,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({key:t.key},e.eventMeta(n,t,r)))})),this.bind({blur:"focusout",focus:"focusin"},(function(t,n,i,r,o,a,s){s||i.pushEvent(n,r,o,a,e.eventMeta(n,t,r))})),this.bind({blur:"blur",focus:"focus"},(function(t,n,i,r,o,a,s){s&&"window"!==!s&&i.pushEvent(n,r,o,a,e.eventMeta(n,t,r))})))}},{key:"eventMeta",value:function(e,t,n){var i=this.metadataCallbacks[e];return i?i(t,n):{}}},{key:"setPendingLink",value:function(e){return this.linkRef++,this.pendingLink=e,this.linkRef}},{key:"commitPendingLink",value:function(e){return this.linkRef===e&&(this.href=this.pendingLink,this.pendingLink=null,!0)}},{key:"getHref",value:function(){return this.href}},{key:"hasPendingLink",value:function(){return!!this.pendingLink}},{key:"bind",value:function(e,t){var n=this,i=function(i){var r=e[i];n.on(r,(function(e){var r=n.binding(i),o=n.binding("window-".concat(i)),a=e.target.getAttribute&&e.target.getAttribute(r);a?n.debounce(e.target,e,(function(){n.withinOwners(e.target,(function(n,r){t(e,i,n,e.target,r,a,null)}))})):G.all(document,"[".concat(o,"]"),(function(r){var a=r.getAttribute(o);n.debounce(r,e,(function(){n.withinOwners(r,(function(n,o){t(e,i,n,r,o,a,"window")}))}))}))}))};for(var r in e)i(r)}},{key:"bindClicks",value:function(){var e=this;[!0,!1].forEach((function(t){var n=t?e.binding("capture-click"):e.binding("click");window.addEventListener("click",(function(i){var r=null,o=(r=t?i.target.matches("[".concat(n,"]"))?i.target:i.target.querySelector("[".concat(n,"]")):F(i.target,n))&&r.getAttribute(n);o&&("#"===r.getAttribute("href")&&i.preventDefault(),e.debounce(r,i,(function(){e.withinOwners(r,(function(t,n){t.pushEvent("click",r,n,o,e.eventMeta("click",i,r))}))})))}),t)}))}},{key:"bindNav",value:function(){var e=this;$.canPushState()&&(window.addEventListener("popstate",(function(t){if(e.registerNewLocation(window.location)){var n=t.state||{},i=n.type,r=n.id,o=n.root,a=window.location.href;e.main.isConnected()&&"patch"===i&&r===e.main.id?e.main.pushLinkPatch(a,null):e.replaceMain(a,null,(function(){o&&e.replaceRootHistory()}))}}),!1),window.addEventListener("click",(function(t){var n=F(t.target,"data-phx-link"),i=n&&n.getAttribute("data-phx-link"),r=t.metaKey||t.ctrlKey||1===t.button;if(i&&e.isConnected()&&e.main&&!r){var o=n.href,a=n.getAttribute("data-phx-link-state");if(t.preventDefault(),e.pendingLink!==o)if("patch"===i)e.pushHistoryPatch(o,a,n);else{if("redirect"!==i)throw new Error("expected ".concat("data-phx-link",' to be "patch" or "redirect", got: ').concat(i));e.historyRedirect(o,a)}}}),!1))}},{key:"withPageLoading",value:function(e,t){G.dispatchEvent(window,"phx:page-loading-start",e);var n=function(){return G.dispatchEvent(window,"phx:page-loading-stop",e)};return t?t(n):n}},{key:"pushHistoryPatch",value:function(e,t,n){var i=this;this.withPageLoading({to:e,kind:"patch"},(function(r){i.main.pushLinkPatch(e,n,(function(){i.historyPatch(e,t),r()}))}))}},{key:"historyPatch",value:function(e,t){$.pushState(t,{type:"patch",id:this.main.id},e),this.registerNewLocation(window.location)}},{key:"historyRedirect",value:function(e,t,n){var i=this;this.withPageLoading({to:e,kind:"redirect"},(function(r){i.replaceMain(e,n,(function(){$.pushState(t,{type:"redirect",id:i.main.id},e),i.registerNewLocation(window.location),r()}))}))}},{key:"replaceRootHistory",value:function(){$.pushState("replace",{root:!0,type:"patch",id:this.main.id})}},{key:"registerNewLocation",value:function(e){var t=this.currentLocation;return t.pathname+t.search!==e.pathname+e.search&&(this.currentLocation=J(e),!0)}},{key:"bindForms",value:function(){var e=this,t=0;this.on("submit",(function(t){var n=t.target.getAttribute(e.binding("submit"));n&&(t.preventDefault(),t.target.disabled=!0,e.withinOwners(t.target,(function(e,i){return e.submitForm(t.target,i,n)})))}),!1);for(var n=function(){var n=r[i];e.on(n,(function(i){var r=i.target,o=r.form&&r.form.getAttribute(e.binding("change"));if(o&&("number"!==r.type||!r.validity||!r.validity.badInput)){var a=t;t++;var s=G.private(r,"prev-iteration")||{},u=s.at,c=s.type;u===a-1&&n!==c||(G.putPrivate(r,"prev-iteration",{at:a,type:n}),e.debounce(r,i,(function(){e.withinOwners(r.form,(function(t,n){G.putPrivate(r,"phx-has-focused",!0),G.isTextualInput(r)||e.setActiveElement(r),t.pushInput(r,n,o,i.target)}))})))}}),!1)},i=0,r=["change","input"];i<r.length;i++)n()}},{key:"debounce",value:function(e,t,n){var i=this.binding("debounce"),r=this.binding("throttle"),o=this.defaults.debounce.toString(),a=this.defaults.throttle.toString();G.debounce(e,t,i,o,r,a,n)}},{key:"silenceEvents",value:function(e){this.silenced=!0,e(),this.silenced=!1}},{key:"on",value:function(e,t){var n=this;window.addEventListener(e,(function(e){n.silenced||t(e)}))}}]),e}(),$={canPushState:function(){return void 0!==history.pushState},dropLocal:function(e,t){return window.localStorage.removeItem(this.localKey(e,t))},updateLocal:function(e,t,n,i){var r=this.getLocal(e,t),o=this.localKey(e,t),a=null===r?n:i(r);return window.localStorage.setItem(o,JSON.stringify(a)),a},getLocal:function(e,t){return JSON.parse(window.localStorage.getItem(this.localKey(e,t)))},fetchPage:function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.timeout=3e4,n.setRequestHeader("content-type","text/html"),n.setRequestHeader("cache-control","max-age=0, no-cache, no-store, must-revalidate, post-check=0, pre-check=0"),n.setRequestHeader("x-requested-with","live-link"),n.onerror=function(){return t(400)},n.ontimeout=function(){return t(504)},n.onreadystatechange=function(){if(4===n.readyState){var i=new URL(e),r=i.pathname+i.search,o=W(n.getResponseHeader("x-response-url")||n.responseURL,(function(e){return new URL(e)})),a=o?o.pathname+o.search:null;return"live-link"!==n.getResponseHeader("x-requested-with")?t(400):null===o||a!=r?t(302):200!==n.status?t(n.status):void t(200,n.responseText)}},n.send()},pushState:function(e,t,n){if(this.canPushState()){if(n!==window.location.href){history[e+"State"](t,"",n||null);var i=this.getHashTargetEl(window.location.hash);i?i.scrollIntoView():"redirect"===t.type&&window.scroll(0,0)}}else this.redirect(n)},setCookie:function(e,t){document.cookie="".concat(e,"=").concat(t)},getCookie:function(e){return document.cookie.replace(new RegExp("(?:(?:^|.*;s*)".concat(e,"s*=s*([^;]*).*$)|^.*$")),"$1")},redirect:function(e,t){t&&$.setCookie("__phoenix_flash__",t+"; max-age=60000; path=/"),window.location=e},localKey:function(e,t){return"".concat(e,"-").concat(t)},getHashTargetEl:function(e){if(""!==e.toString())return document.getElementById(e)||document.querySelector('a[name="'.concat(e.substring(1),'"]'))}},G={byId:function(e){return document.getElementById(e)||M("no id found for ".concat(e))},removeClass:function(e,t){e.classList.remove(t),0===e.classList.length&&e.removeAttribute("class")},all:function(e,t,n){var i=Array.from(e.querySelectorAll(t));return n?i.forEach(n):i},findComponentNodeList:function(e,t){var n=this.all(e,I),i=this.all(e,"[".concat(R,'="').concat(t,'"]'));return 0===n.length?i:i.filter((function(e){return!n.some((function(t){return t.contains(e)}))}))},findPhxChildrenInFragment:function(e,t){var n=document.createElement("template");return n.innerHTML=e,this.findPhxChildren(n.content,t)},isPhxUpdate:function(e,t,n){return e.getAttribute&&n.indexOf(e.getAttribute(t))>=0},findPhxChildren:function(e,t){return this.all(e,"".concat(I,"[").concat("data-phx-parent-id",'="').concat(t,'"]'))},findParentCIDs:function(e,t){var n=this,i=new Set(t);return t.reduce((function(t,i){var r="[".concat(R,'="').concat(i,'"] [').concat(R,"]");return n.all(e,r).map((function(e){return parseInt(e.getAttribute(R))})).forEach((function(e){return t.delete(e)})),t}),i)},private:function(e,t){return e.phxPrivate&&e.phxPrivate[t]},deletePrivate:function(e,t){e.phxPrivate&&delete e.phxPrivate[t]},putPrivate:function(e,t,n){e.phxPrivate||(e.phxPrivate={}),e.phxPrivate[t]=n},copyPrivates:function(e,t){t.phxPrivate&&(e.phxPrivate=J(t.phxPrivate))},putTitle:function(e){var t=document.querySelector("title").dataset,n=t.prefix,i=t.suffix;document.title="".concat(n||"").concat(e).concat(i||"")},debounce:function(e,t,n,i,r,o,a){var s=this,u=e.getAttribute(n),c=e.getAttribute(r);""===u&&(u=i),""===c&&(c=o);var l=u||c;switch(l){case null:return a();case"blur":return void(this.once(e,"debounce-blur")&&e.addEventListener("blur",(function(){return a()})));default:var h=parseInt(l),d=this.incCycle(e,"debounce-trigger",(function(){return c?s.deletePrivate(e,"throttled"):a()}));if(isNaN(h))return M("invalid throttle/debounce value: ".concat(l));if(c){var f=!1;if("keydown"===t.type){var v=this.private(e,"debounce-prev-key");this.putPrivate(e,"debounce-prev-key",t.key),f=v!==t.key}if(!f&&this.private(e,"throttled"))return!1;a(),this.putPrivate(e,"throttled",!0),setTimeout((function(){return s.triggerCycle(e,"debounce-trigger")}),h)}else setTimeout((function(){return s.triggerCycle(e,"debounce-trigger",d)}),h);e.form&&this.once(e.form,"bind-debounce")&&e.form.addEventListener("submit",(function(t){Array.from(new FormData(e.form).entries(),(function(t){var n=w(t,2),i=n[0],r=(n[1],e.form.querySelector('[name="'.concat(i,'"]')));s.incCycle(r,"debounce-trigger"),s.deletePrivate(r,"throttled")}))})),this.once(e,"bind-debounce")&&e.addEventListener("blur",(function(t){return s.triggerCycle(e,"debounce-trigger")}))}},triggerCycle:function(e,t,n){var i=w(this.private(e,t),2),r=i[0],o=i[1];n||(n=r),n===r&&(this.incCycle(e,t),o())},once:function(e,t){return!0!==this.private(e,t)&&(this.putPrivate(e,t,!0),!0)},incCycle:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},i=w(this.private(e,t)||[0,n],2),r=i[0];return i[1],r++,this.putPrivate(e,t,[r,n]),r},discardError:function(e,t,n){var i=t.getAttribute&&t.getAttribute(n),r=i&&e.querySelector("#".concat(i));r&&(this.private(r,"phx-has-focused")||this.private(r.form,"phx-has-submitted")||t.classList.add("phx-no-feedback"))},isPhxChild:function(e){return e.getAttribute&&e.getAttribute("data-phx-parent-id")},dispatchEvent:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(i)},cloneNode:function(e,t){if(void 0===t)return e.cloneNode(!0);var n=e.cloneNode(!1);return n.innerHTML=t,n},mergeAttrs:function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=t.attributes,r=i.length-1;r>=0;r--){var o=i[r].name;n.indexOf(o)<0&&e.setAttribute(o,t.getAttribute(o))}for(var a=e.attributes,s=a.length-1;s>=0;s--){var u=a[s].name;t.hasAttribute(u)||e.removeAttribute(u)}},mergeFocusedInput:function(e,t){e instanceof HTMLSelectElement||G.mergeAttrs(e,t,["value"]),t.readOnly?e.setAttribute("readonly",!0):e.removeAttribute("readonly")},hasSelectionRange:function(e){return e.setSelectionRange&&("text"===e.type||"textarea"===e.type)},restoreFocus:function(e,t,n){if(G.isTextualInput(e)){var i=e.matches(":focus");e.readOnly&&e.blur(),i||e.focus(),this.hasSelectionRange(e)&&e.setSelectionRange(t,n)}},isFormInput:function(e){return/^(?:input|select|textarea)$/i.test(e.tagName)&&"button"!==e.type},syncAttrsToProps:function(e){e instanceof HTMLInputElement&&_.indexOf(e.type.toLocaleLowerCase())>=0&&(e.checked=null!==e.getAttribute("checked"))},isTextualInput:function(e){return O.indexOf(e.type)>=0},isNowTriggerFormExternal:function(e,t){return e.getAttribute&&null!==e.getAttribute(t)},syncPendingRef:function(e,t,n){var i=e.getAttribute(j);return null===i||(G.isFormInput(e)||null!==e.getAttribute(n)?(G.putPrivate(e,j,t),!1):(L.forEach((function(n){e.classList.contains(n)&&t.classList.add(n)})),t.setAttribute(j,i),!0))},cleanChildNodes:function(e,t){if(G.isPhxUpdate(e,t,["append","prepend"])){var n=[];e.childNodes.forEach((function(e){e.id||(e.nodeType===Node.TEXT_NODE&&""===e.nodeValue.trim()||M("only HTML element tags with an id are allowed inside containers with phx-update.\n\n"+'removing illegal node: "'.concat((e.outerHTML||e.nodeValue).trim(),'"\n\n')),n.push(e))})),n.forEach((function(e){return e.remove()}))}}},Y=function(){function e(t,n,i){y(this,e);var r=Array.from(n.children).map((function(e){return e.id})),o=[],a=[];t.childNodes.forEach((function(e){e.id&&(o.push(e.id),r.indexOf(e.id)>=0&&a.push([e.id,e.previousElementSibling&&e.previousElementSibling.id]))})),this.containerID=n.id,this.updateType=i,this.modifiedIds=a,this.newIds=r.filter((function(e){return o.indexOf(e)<0}))}return k(e,[{key:"perform",value:function(){var e=G.byId(this.containerID);this.modifiedIds.forEach((function(t){var n=w(t,2),i=n[0],r=n[1];r?W(document.getElementById(r),(function(e){W(document.getElementById(i),(function(t){t.previousElementSibling&&t.previousElementSibling.id==e.id||e.insertAdjacentElement("afterend",t)}))})):W(document.getElementById(i),(function(t){null==t.previousElementSibling||e.insertAdjacentElement("afterbegin",t)}))})),"prepend"==this.updateType&&this.newIds.reverse().forEach((function(t){W(document.getElementById(t),(function(t){return e.insertAdjacentElement("afterbegin",t)}))}))}}]),e}(),Q=function(){function e(t,n,i,r,o){y(this,e),this.view=t,this.liveSocket=t.liveSocket,this.container=n,this.id=i,this.rootID=t.root.id,this.html=r,this.targetCID=o,this.cidPatch="number"==typeof this.targetCID,this.callbacks={beforeadded:[],beforeupdated:[],beforediscarded:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[]}}return k(e,null,[{key:"patchEl",value:function(e,t,n){f(e,t,{childrenOnly:!1,onBeforeElUpdated:function(e,t){if(n&&n.isSameNode(e)&&G.isFormInput(e))return G.mergeFocusedInput(e,t),!1}})}}]),k(e,[{key:"before",value:function(e,t){this.callbacks["before".concat(e)].push(t)}},{key:"after",value:function(e,t){this.callbacks["after".concat(e)].push(t)}},{key:"trackBefore",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.callbacks["before".concat(e)].forEach((function(e){return e.apply(void 0,n)}))}},{key:"trackAfter",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.callbacks["after".concat(e)].forEach((function(e){return e.apply(void 0,n)}))}},{key:"markPrunableContentForRemoval",value:function(){G.all(this.container,"[phx-update=append] > *, [phx-update=prepend] > *",(function(e){e.setAttribute("data-phx-remove","")}))}},{key:"perform",value:function(){var e=this,t=this.view,n=this.liveSocket,i=this.container,r=this.html,o=this.isCIDPatch()?this.targetCIDContainer():i;if(!this.isCIDPatch()||o){var a=n.getActiveElement(),s=a&&G.hasSelectionRange(a)?a:{},u=s.selectionStart,c=s.selectionEnd,l=n.binding("update"),h=n.binding("feedback-for"),d=n.binding("disable-with"),v=n.binding("trigger-action"),p=[],m=[],g=[],y=n.time("premorph container prep",(function(){return e.buildDiffHTML(i,r,l,o)}));return this.trackBefore("added",i),this.trackBefore("updated",i,i),n.time("morphdom",(function(){f(o,y,{childrenOnly:null===o.getAttribute(R),onBeforeNodeAdded:function(t){return G.discardError(o,t,h),e.trackBefore("added",t),t},onNodeAdded:function(n){G.isNowTriggerFormExternal(n,v)&&n.submit(),G.isPhxChild(n)&&t.ownsElement(n)&&e.trackAfter("phxChildAdded",n),p.push(n)},onNodeDiscarded:function(t){G.isPhxChild(t)&&n.destroyViewByEl(t),e.trackAfter("discarded",t)},onBeforeNodeDiscarded:function(t){return!((!t.getAttribute||null===t.getAttribute("data-phx-remove"))&&(null!==t.parentNode&&G.isPhxUpdate(t.parentNode,l,["append","prepend"])&&t.id||e.skipCIDSibling(t)||(e.trackBefore("discarded",t),0)))},onElUpdated:function(e){G.isNowTriggerFormExternal(e,v)&&e.submit(),m.push(e)},onBeforeElUpdated:function(t,n){if(G.cleanChildNodes(n,l),e.skipCIDSibling(n))return!1;if("ignore"===t.getAttribute(l))return e.trackBefore("updated",t,n),G.mergeAttrs(t,n),m.push(t),!1;if("number"===t.type&&t.validity&&t.validity.badInput)return!1;if(!G.syncPendingRef(t,n,d))return!1;if(G.isPhxChild(n)){var i=t.getAttribute(D);return G.mergeAttrs(t,n),t.setAttribute(D,i),t.setAttribute("data-phx-root-id",e.rootID),!1}return G.copyPrivates(n,t),G.discardError(o,n,h),a&&t.isSameNode(a)&&G.isFormInput(t)&&!e.forceFocusedSelectUpdate(t,n)?(e.trackBefore("updated",t,n),G.mergeFocusedInput(t,n),G.syncAttrsToProps(t),m.push(t),!1):(G.isPhxUpdate(n,l,["append","prepend"])&&g.push(new Y(t,n,n.getAttribute(l))),G.syncAttrsToProps(n),e.trackBefore("updated",t,n),!0)}})})),n.isDebugEnabled()&&function(){for(var e=new Set,t=document.querySelectorAll("*[id]"),n=0,i=t.length;n<i;n++)e.has(t[n].id)?console.error("Multiple IDs detected: ".concat(t[n].id,". Ensure unique element ids.")):e.add(t[n].id)}(),g.length>0&&n.time("post-morph append/prepend restoration",(function(){g.forEach((function(e){return e.perform()}))})),n.silenceEvents((function(){return G.restoreFocus(a,u,c)})),G.dispatchEvent(document,"phx:update"),p.forEach((function(t){return e.trackAfter("added",t)})),m.forEach((function(t){return e.trackAfter("updated",t)})),!0}}},{key:"forceFocusedSelectUpdate",value:function(e,t){return!0===e.multiple||e.innerHTML!=t.innerHTML}},{key:"isCIDPatch",value:function(){return this.cidPatch}},{key:"skipCIDSibling",value:function(e){return e.nodeType===Node.ELEMENT_NODE&&null!==e.getAttribute("data-phx-skip")}},{key:"targetCIDContainer",value:function(){if(this.isCIDPatch()){var e=v(G.findComponentNodeList(this.container,this.targetCID)),t=e[0];return 0===e.slice(1).length?t:t&&t.parentNode}}},{key:"buildDiffHTML",value:function(e,t,n,i){var r=this,o=this.isCIDPatch(),a=o&&i.getAttribute(R)===this.targetCID.toString();if(!o||a)return t;var s=null,u=document.createElement("template");s=G.cloneNode(i);var c=v(G.findComponentNodeList(s,this.targetCID)),l=c[0],h=c.slice(1);return u.innerHTML=t,h.forEach((function(e){return e.remove()})),Array.from(s.childNodes).forEach((function(e){e.id&&e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(R)!==r.targetCID.toString()&&(e.setAttribute("data-phx-skip",""),e.innerHTML="")})),Array.from(u.content.childNodes).forEach((function(e){return s.insertBefore(e,l)})),l.remove(),s.outerHTML}}]),e}(),Z=function(){function e(t,n,i,r,o){var a=this;y(this,e),this.liveSocket=n,this.flash=o,this.parent=i,this.root=i?i.root:this,this.el=t,this.id=this.el.id,this.view=this.el.getAttribute(T),this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.href=r,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(){},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.children=this.parent?null:{},this.root.children[this.id]={},this.channel=this.liveSocket.channel("lv:".concat(this.id),(function(){return{url:a.href,params:a.connectParams(),session:a.getSession(),static:a.getStatic(),flash:a.flash}})),this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel()}return k(e,[{key:"isMain",value:function(){return this.liveSocket.main===this}},{key:"connectParams",value:function(){var e=this.liveSocket.params(this.view),t=G.all(document,"[".concat(this.binding("track-static"),"]")).map((function(e){return e.src||e.href})).filter((function(e){return"string"==typeof e}));return t.length>0&&(e._track_static=t),e._mounts=this.joinCount,e}},{key:"name",value:function(){return this.view}},{key:"isConnected",value:function(){return this.channel.canPush()}},{key:"getSession",value:function(){return this.el.getAttribute("data-phx-session")}},{key:"getStatic",value:function(){var e=this.el.getAttribute(D);return""===e?null:e}},{key:"destroy",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);var n=function(){for(var n in t(),e.viewHooks)e.viewHooks[n].__trigger__("beforeDestroy"),e.destroyHook(e.viewHooks[n])};this.log("destroyed",(function(){return["the child has been removed from the parent"]})),this.channel.leave().receive("ok",n).receive("error",n).receive("timeout",n)}},{key:"setContainerClasses",value:function(){var e;this.el.classList.remove("phx-connected","phx-disconnected","phx-error"),(e=this.el.classList).add.apply(e,arguments)}},{key:"isLoading",value:function(){return this.el.classList.contains("phx-disconnected")}},{key:"showLoader",value:function(e){var t=this;if(clearTimeout(this.loaderTimer),e)this.loaderTimer=setTimeout((function(){return t.showLoader()}),e);else{for(var n in this.viewHooks)this.viewHooks[n].__trigger__("disconnected");this.setContainerClasses("phx-disconnected")}}},{key:"hideLoader",value:function(){clearTimeout(this.loaderTimer),this.setContainerClasses("phx-connected")}},{key:"triggerReconnected",value:function(){for(var e in this.viewHooks)this.viewHooks[e].__trigger__("reconnected")}},{key:"log",value:function(e,t){this.liveSocket.log(this,e,t)}},{key:"withinTargets",value:function(e,t){var n=this;if(/^(0|[1-9]\d*)$/.test(e)){var i=G.findComponentNodeList(this.el,e);0===i.length?M("no component found matching phx-target of ".concat(e)):t(this,i[0])}else{var r=Array.from(document.querySelectorAll(e));0===r.length&&M('nothing found matching the phx-target selector "'.concat(e,'"')),r.forEach((function(e){return n.liveSocket.owner(e,(function(n){return t(n,e)}))}))}}},{key:"applyDiff",value:function(e,t,n){this.log(e,(function(){return["",J(t)]}));var i=K.extract(t),r=i.diff,o=i.reply,a=i.events,s=i.title;return s&&G.putTitle(s),n({diff:r,reply:o,events:a}),o}},{key:"onJoin",value:function(e){var t=this,n=e.rendered;this.joinCount++,this.childJoins=0,this.joinPending=!0,this.flash=null,$.dropLocal(this.name(),"consecutive-reloads"),this.applyDiff("mount",n,(function(n){var i=n.diff,r=n.events;t.rendered=new K(t.id,i);var o=t.renderContainer(null,"join");t.dropPendingRefs();var a=t.formsForRecovery(o);t.joinCount>1&&a.length>0?a.forEach((function(e,n){t.pushFormRecovery(e,(function(e){n===a.length-1&&t.onJoinComplete(e,o,r)}))})):t.onJoinComplete(e,o,r)}))}},{key:"dropPendingRefs",value:function(){G.all(this.el,"[".concat(j,"]"),(function(e){return e.removeAttribute(j)}))}},{key:"onJoinComplete",value:function(e,t,n){var i=this,r=e.live_patch;if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(r,t,n);0===G.findPhxChildrenInFragment(t,this.id).filter((function(e){var t=e.id&&i.el.querySelector("#".concat(e.id)),n=t&&t.getAttribute(D);return n&&e.setAttribute(D,n),i.joinChild(e)})).length?this.parent?(this.root.pendingJoinOps.push([this,function(){return i.applyJoinPatch(r,t,n)}]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(r,t,n)):this.root.pendingJoinOps.push([this,function(){return i.applyJoinPatch(r,t,n)}])}},{key:"attachTrueDocEl",value:function(){this.el=G.byId(this.id),this.el.setAttribute("data-phx-root-id",this.root.id)}},{key:"dispatchEvents",value:function(e){e.forEach((function(e){var t=w(e,2),n=t[0],i=t[1];window.dispatchEvent(new CustomEvent("phx:hook:".concat(n),{detail:i}))}))}},{key:"applyJoinPatch",value:function(e,t,n){var i=this;this.attachTrueDocEl();var r=new Q(this,this.el,this.id,t,null);if(r.markPrunableContentForRemoval(),this.performPatch(r,!1),this.joinNewChildren(),G.all(this.el,"[".concat(this.binding("hook"),"]"),(function(e){var t=i.addHook(e);t&&t.__trigger__("mounted")})),this.joinPending=!1,this.dispatchEvents(n),this.applyPendingUpdates(),e){var o=e.kind,a=e.to;this.liveSocket.historyPatch(a,o)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}},{key:"triggerBeforeUpdateHook",value:function(e,t){this.liveSocket.triggerDOM("onBeforeElUpdated",[e,t]);var n=this.getHook(e),i=n&&"ignore"===e.getAttribute(this.binding("update"));if(n&&!e.isEqualNode(t)&&(!i||!function(e,t){return JSON.stringify(e)===JSON.stringify(t)}(e.dataset,t.dataset)))return n.__trigger__("beforeUpdate"),n}},{key:"triggerUpdatedHook",value:function(e){e.__trigger__("updated")}},{key:"performPatch",value:function(e,t){var n=this,i=[],r=!1,o=new Set;return e.after("added",(function(e){var t=n.addHook(e);t&&t.__trigger__("mounted")})),e.after("phxChildAdded",(function(e){return r=!0})),e.before("updated",(function(e,t){n.triggerBeforeUpdateHook(e,t)&&o.add(e.id)})),e.after("updated",(function(e){o.has(e.id)&&n.triggerUpdatedHook(n.getHook(e))})),e.before("discarded",(function(e){var t=n.getHook(e);t&&t.__trigger__("beforeDestroy")})),e.after("discarded",(function(e){var t=n.componentID(e);"number"==typeof t&&-1===i.indexOf(t)&&i.push(t);var r=n.getHook(e);r&&n.destroyHook(r)})),e.perform(),t&&this.maybePushComponentsDestroyed(i),r}},{key:"joinNewChildren",value:function(){var e=this;G.findPhxChildren(this.el,this.id).forEach((function(t){return e.joinChild(t)}))}},{key:"getChildById",value:function(e){return this.root.children[this.id][e]}},{key:"getDescendentByEl",value:function(e){return e.id===this.id?this:this.children[e.getAttribute("data-phx-parent-id")][e.id]}},{key:"destroyDescendent",value:function(e){for(var t in this.root.children)for(var n in this.root.children[t])if(n===e)return this.root.children[t][n].destroy()}},{key:"joinChild",value:function(t){if(!this.getChildById(t.id)){var n=new e(t,this.liveSocket,this);return this.root.children[this.id][n.id]=n,n.join(),this.childJoins++,!0}}},{key:"isJoinPending",value:function(){return this.joinPending}},{key:"ackJoin",value:function(e){this.childJoins--,0===this.childJoins&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}},{key:"onAllChildJoinsComplete",value:function(){this.joinCallback(),this.pendingJoinOps.forEach((function(e){var t=w(e,2),n=t[0],i=t[1];n.isDestroyed()||i()})),this.pendingJoinOps=[]}},{key:"update",value:function(e,t){var n=this;if(this.isJoinPending()||this.liveSocket.hasPendingLink())return this.pendingDiffs.push({diff:e,events:t});this.rendered.mergeDiff(e);var i=!1;this.rendered.isComponentOnlyDiff(e)?this.liveSocket.time("component patch complete",(function(){G.findParentCIDs(n.el,n.rendered.componentCIDs(e)).forEach((function(t){n.componentPatch(n.rendered.getComponent(e,t),t)&&(i=!0)}))})):V(e)||this.liveSocket.time("full patch complete",(function(){var t=n.renderContainer(e,"update"),r=new Q(n,n.el,n.id,t,null);i=n.performPatch(r,!0)})),this.dispatchEvents(t),i&&this.joinNewChildren()}},{key:"renderContainer",value:function(e,t){var n=this;return this.liveSocket.time("toString diff (".concat(t,")"),(function(){var t=n.el.tagName,i=e?n.rendered.componentCIDs(e):null,r=n.rendered.toString(i);return"<".concat(t,">").concat(r,"</").concat(t,">")}))}},{key:"componentPatch",value:function(e,t){if(V(e))return!1;var n=this.rendered.componentToString(t),i=new Q(this,this.el,this.id,n,t);return this.performPatch(i,!0)}},{key:"getHook",value:function(e){return this.viewHooks[te.elementID(e)]}},{key:"addHook",value:function(e){if(!te.elementID(e)&&e.getAttribute){var t=e.getAttribute(this.binding("hook"));if(!t||this.ownsElement(e)){var n=this.liveSocket.getHookCallbacks(t);if(n){e.id||M('no DOM ID for hook "'.concat(t,'". Hooks require a unique ID on each element.'),e);var i=new te(this,e,n);return this.viewHooks[te.elementID(i.el)]=i,i}null!==t&&M('unknown hook found for "'.concat(t,'"'),e)}}}},{key:"destroyHook",value:function(e){e.__trigger__("destroyed"),e.__cleanup__(),delete this.viewHooks[te.elementID(e.el)]}},{key:"applyPendingUpdates",value:function(){var e=this;this.pendingDiffs.forEach((function(t){var n=t.diff,i=t.events;return e.update(n,i)})),this.pendingDiffs=[]}},{key:"onChannel",value:function(e,t){var n=this;this.liveSocket.onChannel(this.channel,e,(function(e){n.isJoinPending()?n.root.pendingJoinOps.push([n,function(){return t(e)}]):t(e)}))}},{key:"bindChannel",value:function(){var e=this;this.liveSocket.onChannel(this.channel,"diff",(function(t){e.applyDiff("update",t,(function(t){var n=t.diff,i=t.events;return e.update(n,i)}))})),this.onChannel("redirect",(function(t){var n=t.to,i=t.flash;return e.onRedirect({to:n,flash:i})})),this.onChannel("live_patch",(function(t){return e.onLivePatch(t)})),this.onChannel("live_redirect",(function(t){return e.onLiveRedirect(t)})),this.channel.onError((function(t){return e.onError(t)})),this.channel.onClose((function(){return e.onClose()}))}},{key:"destroyAllChildren",value:function(){for(var e in this.root.children[this.id])this.getChildById(e).destroy()}},{key:"onLiveRedirect",value:function(e){var t=e.to,n=e.kind,i=e.flash,r=this.expandURL(t);this.liveSocket.historyRedirect(r,n,i)}},{key:"onLivePatch",value:function(e){var t=e.to,n=e.kind;this.href=this.expandURL(t),this.liveSocket.historyPatch(t,n)}},{key:"expandURL",value:function(e){return e.startsWith("/")?"".concat(window.location.protocol,"//").concat(window.location.host).concat(e):e}},{key:"onRedirect",value:function(e){var t=e.to,n=e.flash;this.liveSocket.redirect(t,n)}},{key:"isDestroyed",value:function(){return this.destroyed}},{key:"join",value:function(e){var t=this;this.parent||(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=function(){return e&&e(t,t.joinCount)},this.liveSocket.wrapPush((function(){return t.channel.join().receive("ok",(function(e){return t.onJoin(e)})).receive("error",(function(e){return t.onJoinError(e)})).receive("timeout",(function(){return t.onJoinError({reason:"timeout"})}))}))}},{key:"onJoinError",value:function(e){return(e.redirect||e.live_redirect)&&(this.joinPending=!1,this.channel.leave()),e.redirect?this.onRedirect(e.redirect):e.live_redirect?this.onLiveRedirect(e.live_redirect):(this.log("error",(function(){return["unable to join",e]})),this.liveSocket.reloadWithJitter(this))}},{key:"onClose",value:function(){if(!this.isDestroyed()){if(this.isJoinPending()||this.liveSocket.hasPendingLink())return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(200)}}},{key:"onError",value:function(e){this.onClose(),this.log("error",(function(){return["view crashed",e]})),this.liveSocket.isUnloaded()||this.displayError()}},{key:"displayError",value:function(){this.isMain()&&G.dispatchEvent(window,"phx:page-loading-start",{to:this.href,kind:"error"}),this.showLoader(),this.setContainerClasses("phx-disconnected","phx-error")}},{key:"pushWithReply",value:function(e,t,n){var i=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=w(e?e():[null,[]],2),a=o[0],s=w(o[1],1)[0],u=function(){};return s&&null!==s.getAttribute(this.binding("page-loading"))&&(u=this.liveSocket.withPageLoading({kind:"element",target:s})),"number"!=typeof n.cid&&delete n.cid,this.liveSocket.wrapPush((function(){return i.channel.push(t,n,3e4).receive("ok",(function(e){var t=null;null!==a&&i.undoRefs(a),e.diff&&(t=i.applyDiff("update",e.diff,(function(e){var t=e.diff,n=e.events;i.update(t,n)}))),e.redirect&&i.onRedirect(e.redirect),e.live_patch&&i.onLivePatch(e.live_patch),e.live_redirect&&i.onLiveRedirect(e.live_redirect),u(),r(e,t)}))}))}},{key:"undoRefs",value:function(e){var t=this;G.all(this.el,"[".concat(j,'="').concat(e,'"]'),(function(e){e.removeAttribute(j),null!==e.getAttribute("data-phx-readonly")&&(e.readOnly=!1,e.removeAttribute("data-phx-readonly")),null!==e.getAttribute("data-phx-disabled")&&(e.disabled=!1,e.removeAttribute("data-phx-disabled")),L.forEach((function(t){return G.removeClass(e,t)}));var n=e.getAttribute("data-phx-disable-with-restore");null!==n&&(e.innerText=n,e.removeAttribute("data-phx-disable-with-restore"));var i=G.private(e,j);if(i){var r=t.triggerBeforeUpdateHook(e,i);Q.patchEl(e,i,t.liveSocket.getActiveElement()),r&&t.triggerUpdatedHook(r),G.deletePrivate(e,j)}}))}},{key:"putRef",value:function(e,t){var n=this.ref++,i=this.binding("disable-with");return e.forEach((function(e){e.classList.add("phx-".concat(t,"-loading")),e.setAttribute(j,n);var r=e.getAttribute(i);null!==r&&(e.getAttribute("data-phx-disable-with-restore")||e.setAttribute("data-phx-disable-with-restore",e.innerText),e.innerText=r)})),[n,e]}},{key:"componentID",value:function(e){var t=e.getAttribute&&e.getAttribute(R);return t?parseInt(t):null}},{key:"targetComponentID",value:function(e,t){return e.getAttribute(this.binding("target"))?this.closestComponentID(t):null}},{key:"closestComponentID",value:function(e){var t=this;return e?W(e.closest("[".concat(R,"]")),(function(e){return t.ownsElement(e)&&t.componentID(e)})):null}},{key:"pushHookEvent",value:function(e,t,n,i){var r=w(this.putRef([],"hook"),2),o=r[0],a=r[1];return this.pushWithReply((function(){return[o,a]}),"event",{type:"hook",event:t,value:n,cid:this.closestComponentID(e)},(function(e,t){return i(t,o)})),o}},{key:"extractMeta",value:function(e,t){for(var n=this.binding("value-"),i=0;i<e.attributes.length;i++){var r=e.attributes[i].name;r.startsWith(n)&&(t[r.replace(n,"")]=e.getAttribute(r))}return void 0!==e.value&&(t.value=e.value,"INPUT"===e.tagName&&_.indexOf(e.type)>=0&&!e.checked&&delete t.value),t}},{key:"pushEvent",value:function(e,t,n,i,r){var o=this;this.pushWithReply((function(){return o.putRef([t],e)}),"event",{type:e,event:i,value:this.extractMeta(t,r),cid:this.targetComponentID(t,n)})}},{key:"pushKey",value:function(e,t,n,i,r){var o=this;this.pushWithReply((function(){return o.putRef([e],n)}),"event",{type:n,event:i,value:this.extractMeta(e,r),cid:this.targetComponentID(e,t)})}},{key:"pushInput",value:function(e,t,n,i,r){var o=this;this.pushWithReply((function(){return o.putRef([e,e.form],"change")}),"event",{type:"form",event:n,value:z(e.form,{_target:i.name}),cid:this.targetComponentID(e.form,t)},r)}},{key:"pushFormSubmit",value:function(e,t,n,i){var r=this,o=function(e){return!F(e,"".concat(r.binding("update"),"=ignore"),e.form)};this.pushWithReply((function(){var t=G.all(e,"[".concat(r.binding("disable-with"),"]")),n=G.all(e,"button").filter(o),i=G.all(e,"input,textarea,select").filter(o);return n.forEach((function(e){e.setAttribute("data-phx-disabled",e.disabled),e.disabled=!0})),i.forEach((function(e){e.setAttribute("data-phx-readonly",e.readOnly),e.readOnly=!0})),e.setAttribute(r.binding("page-loading"),""),r.putRef([e].concat(t).concat(n).concat(i),"submit")}),"event",{type:"form",event:n,value:z(e),cid:this.targetComponentID(e,t)},i)}},{key:"pushFormRecovery",value:function(e,t){var n=this;this.liveSocket.withinOwners(e,(function(i,r){var o=e.elements[0],a=e.getAttribute(n.binding("auto-recover"))||e.getAttribute(n.binding("change"));i.pushInput(o,r,a,o,t)}))}},{key:"pushLinkPatch",value:function(e,t,n){var i=this,r=this.liveSocket.setPendingLink(e),o=t?function(){return i.putRef([t],"click")}:null;this.pushWithReply(o,"link",{url:e},(function(t){t.link_redirect?i.liveSocket.replaceMain(e,null,n,r):i.liveSocket.commitPendingLink(r)&&(i.href=e,i.applyPendingUpdates(),n&&n())})).receive("timeout",(function(){return i.liveSocket.redirect(window.location.href)}))}},{key:"formsForRecovery",value:function(e){var t=this,n=this.binding("change"),i=document.createElement("template");return i.innerHTML=e,G.all(this.el,"form[".concat(n,"]")).filter((function(e){return t.ownsElement(e)})).filter((function(e){return"ignore"!==e.getAttribute(t.binding("auto-recover"))})).filter((function(e){return i.content.querySelector("form[".concat(n,'="').concat(e.getAttribute(n),'"]'))}))}},{key:"maybePushComponentsDestroyed",value:function(e){var t=this,n=e.filter((function(e){return 0===G.findComponentNodeList(t.el,e).length}));n.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:n},(function(){t.rendered.pruneCIDs(n)}))}},{key:"ownsElement",value:function(e){return e.getAttribute("data-phx-parent-id")===this.id||W(e.closest(I),(function(e){return e.id}))===this.id}},{key:"submitForm",value:function(e,t,n){var i=this;G.putPrivate(e,"phx-has-submitted",!0),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(e,t,n,(function(){i.liveSocket.restorePreviouslyActiveFocus()}))}},{key:"binding",value:function(e){return this.liveSocket.binding(e)}}]),e}(),ee=1,te=function(){function e(t,n,i){for(var r in y(this,e),this.__view=t,this.__liveSocket=t.liveSocket,this.__callbacks=i,this.__listeners=new Set,this.el=n,this.viewName=t.name(),this.el.phxHookId=this.constructor.makeID(),this.__callbacks)this[r]=this.__callbacks[r]}return k(e,null,[{key:"makeID",value:function(){return ee++}},{key:"elementID",value:function(e){return e.phxHookId}}]),k(e,[{key:"pushEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};return this.__view.pushHookEvent(null,e,t,n)}},{key:"pushEventTo",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){};return this.__view.withinTargets(e,(function(e,r){return e.pushHookEvent(r,t,n,i)}))}},{key:"handleEvent",value:function(e,t){var n=function(n,i){return i?e:t(n.detail)};return window.addEventListener("phx:hook:".concat(e),n),this.__listeners.add(n),n}},{key:"removeHandleEvent",value:function(e){var t=e(null,!0);window.removeEventListener("phx:hook:".concat(t),e),this.__listeners.delete(e)}},{key:"__cleanup__",value:function(){var e=this;this.__listeners.forEach((function(t){return e.removeHandleEvent(t)}))}},{key:"__trigger__",value:function(e){var t=this.__callbacks[e];t&&t.call(this)}}]),e}();t.default=X},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(0)}).call(this,n(1))}])},function(e,t,n){e.exports=n(4)},function(e,t,n){"use strict";n.r(t);n(5),n(6);var i=n(1),r=n(0),o=n.n(r),a=n(2);console.log("Hello world from assets");let s=document.querySelector("meta[name='csrf-token']").getAttribute("content"),u=new a.LiveSocket("/live",i.Socket,{params:{_csrf_token:s}});window.addEventListener("phx:page-loading-start",e=>o.a.start()),window.addEventListener("phx:page-loading-stop",e=>o.a.done()),u.connect(),window.liveSocket=u},function(e,t,n){},function(e,t,n){"use strict";!function(){var e=function(){if("function"==typeof window.CustomEvent)return window.CustomEvent;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}return e.prototype=window.Event.prototype,e}();function t(e,t){var n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n}function n(e){var n=e.getAttribute("data-to"),i=t("_method",e.getAttribute("data-method")),r=t("_csrf_token",e.getAttribute("data-csrf")),o=document.createElement("form"),a=e.getAttribute("target");o.method="get"===e.getAttribute("data-method")?"get":"post",o.action=n,o.style.display="hidden",a&&(o.target=a),o.appendChild(r),o.appendChild(i),document.body.appendChild(o),o.submit()}window.addEventListener("click",(function(t){for(var i=t.target;i&&i.getAttribute;){var r=new e("phoenix.link.click",{bubbles:!0,cancelable:!0});if(!i.dispatchEvent(r))return t.preventDefault(),t.stopImmediatePropagation(),!1;if(i.getAttribute("data-method"))return n(i),t.preventDefault(),!1;i=i.parentNode}}),!1),window.addEventListener("phoenix.link.click",(function(e){var t=e.target.getAttribute("data-confirm");t&&!window.confirm(t)&&e.preventDefault()}),!1)}()}]);