/*! 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="",n(n.s=1)}([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:'
'};function r(e,t,n){return en?n:e}function o(e){return 100*(-1+e)}function a(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}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 o=n.render(!t),c=o.querySelector(i.barSelector),l=i.speed,h=i.easing;return o.offsetWidth,s((function(t){""===i.positionUsing&&(i.positionUsing=n.getPositioningCSS()),u(c,a(e,l,h)),1===e?(u(o,{transition:"none",opacity:1}),o.offsetWidth,setTimeout((function(){u(o,{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");l(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=i.template;var r,a=t.querySelector(i.barSelector),s=e?"-100":o(n.status||0),c=document.querySelector(i.parent);return u(a,{transition:"all 0 linear",transform:"translate3d("+s+"%,0,0)"}),i.showSpinner||(r=t.querySelector(i.spinnerSelector))&&d(r),c!=document.body&&l(c,"nprogress-custom-parent"),c.appendChild(t),t},n.remove=function(){h(document.documentElement,"nprogress-busy"),h(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 s=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),u=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function i(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}function r(e){return e=n(e),t[e]||(t[e]=i(e))}function o(e,t,n){t=r(t),e.style[t]=n}return function(e,t){var n,i,r=arguments;if(2==r.length)for(n in t)void 0!==(i=t[n])&&t.hasOwnProperty(n)&&o(e,n,i);else o(e,r[1],r[2])}}();function c(e,t){return("string"==typeof e?e:f(e)).indexOf(" "+t+" ")>=0}function l(e,t){var n=f(e),i=n+t;c(n,t)||(e.className=i.substring(1))}function h(e,t){var n,i=f(e);c(e,t)&&(n=i.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function f(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=n(5)},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,n){var i=e.getAttribute("data-to"),r=t("_method",e.getAttribute("data-method")),o=t("_csrf_token",e.getAttribute("data-csrf")),a=document.createElement("form"),s=e.getAttribute("target");a.method="get"===e.getAttribute("data-method")?"get":"post",a.action=i,a.style.display="hidden",s?a.target=s:n&&(a.target="_blank"),a.appendChild(o),a.appendChild(r),document.body.appendChild(a),a.submit()}window.addEventListener("click",(function(t){var i=t.target;if(!t.defaultPrevented)for(;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.metaKey||t.shiftKey),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)}()},function(e,t,n){},function(e,t,n){"use strict";n.r(t);n(2),n(3);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e))&&"[object Arguments]"!==Object.prototype.toString.call(e))return;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)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}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){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n0&&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(E,e)}},{key:"onError",value:function(e){return this.on(S,(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(t=t||{},!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 D(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=w;var n=function(){e.socket.hasLogger()&&e.socket.log("channel","leave ".concat(e.topic)),e.trigger(E,"leave")},i=new D(this,A,u({}),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:"isMember",value:function(e,t,n,i){return this.topic===e&&(!i||i===this.joinRef()||(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=k,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;a1&&void 0!==arguments[1]?arguments[1]:{};o(this,e),this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=i.timeout||1e4,this.transport=i.transport||h.WebSocket||O,this.establishedConnections=0,this.defaultEncoder=I.encode.bind(I),this.defaultDecoder=I.decode.bind(I),this.closeWasClean=!1,this.binaryType=i.binaryType||"arraybuffer",this.connectClock=1,this.transport!==O?(this.encode=i.encode||this.defaultEncoder,this.decode=i.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);var r=null;l&&l.addEventListener&&(l.addEventListener("pagehide",(function(e){n.conn&&(n.disconnect(),r=n.connectClock)})),l.addEventListener("pageshow",(function(e){r===n.connectClock&&(r=null,n.connect())}))),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 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=u(i.params||{}),this.endPoint="".concat(t,"/").concat(P),this.vsn=i.vsn||f,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new L((function(){n.teardown((function(){return n.connect()}))}),this.reconnectAfterMs)}return s(e,[{key:"replaceTransport",value:function(e){this.disconnect(),this.transport=e}},{key:"protocol",value:function(){return location.protocol.match(/^https/)?"wss":"ws"}},{key:"endPointURL",value:function(){var e=M.appendParams(M.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.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(e,t,n)}},{key:"connect",value:function(e){var t=this;this.connectClock++,e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=u(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.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach((function(e){return(0,i(e,2)[1])()}))}},{key:"heartbeatTimeout",value:function(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.abnormalClose("heartbeat timeout"))}},{key:"resetHeartbeat",value:function(){var e=this;this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearTimeout(this.heartbeatTimer),setTimeout((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&&this.conn.readyState!==m?setTimeout((function(){t.waitForSocketClosed(e,n+1)}),150*n):e()}},{key:"onConnClose",value:function(e){var t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),clearTimeout(this.heartbeatTimer),this.closeWasClean||1e3===t||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((function(t){return(0,i(t,2)[1])(e)}))}},{key:"onConnError",value:function(e){this.hasLogger()&&this.log("transport",e);var t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach((function(r){(0,i(r,2)[1])(e,t,n)})),(t===this.transport||n>0)&&this.triggerChanError()}},{key:"triggerChanError",value:function(){this.channels.forEach((function(e){e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(S)}))}},{key:"connectionState",value:function(){switch(this.conn&&this.conn.readyState){case d:return"connecting";case v:return"open";case p: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=i(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 R(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(){var e=this;this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimer=setTimeout((function(){return e.heartbeatTimeout()}),this.heartbeatIntervalMs))}},{key:"abnormalClose",value:function(e){this.closeWasClean=!1,this.isConnected()&&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,r=e.event,o=e.payload,a=e.ref,s=e.join_ref;a&&a===t.pendingHeartbeatRef&&(clearTimeout(t.heartbeatTimer),t.pendingHeartbeatRef=null,setTimeout((function(){return t.sendHeartbeat()}),t.heartbeatIntervalMs)),t.hasLogger()&&t.log("receive","".concat(o.status||""," ").concat(n," ").concat(r," ").concat(a&&"("+a+")"||""),o);for(var u=0;u=this.entry.file.size}},{key:"readNextChunk",value:function(){var e=this,t=new window.FileReader,n=this.entry.file.slice(this.offset,this.chunkSize+this.offset);t.onload=function(t){if(null!==t.target.error)return ze("Read error: "+t.target.error);e.offset+=t.target.result.byteLength,e.pushChunk(t.target.result)},t.readAsArrayBuffer(n)}},{key:"pushChunk",value:function(e){var t=this;this.uploadChannel.isJoined()&&this.uploadChannel.push("chunk",e).receive("ok",(function(){t.entry.progress(t.offset/t.entry.file.size*100),t.isDone()||(t.chunkTimer=setTimeout((function(){return t.readNextChunk()}),t.liveSocket.getLatencySim()||0))}))}}]),e}(),ze=function(e,t){return console.error&&console.error(e,t)},Ve=function(e){var t=G(e);return"number"===t||"string"===t&&/^(0|[1-9]\d*)$/.test(e)};var Ge,Ke=function(e){return"function"==typeof e?e:function(){return e}},Xe=function(e){return JSON.parse(JSON.stringify(e))},$e=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(Ae)));return null},Qe=function(e){return null!==e&&"object"===G(e)&&!(e instanceof Array)},Ze=function(e){for(var t in e)return!1;return!0},et=function(e,t){return e&&t(e)},tt=function(e,t,n,i){e.forEach((function(e){new qe(e,n.config.chunk_size,i).upload()}))},nt={canPushState:function(){return void 0!==history.pushState},dropLocal:function(e,t,n){return e.removeItem(this.localKey(t,n))},updateLocal:function(e,t,n,i,r){var o=this.getLocal(e,t,n),a=this.localKey(t,n),s=null===o?i:r(o);return e.setItem(a,JSON.stringify(s)),s},getLocal:function(e,t,n){return JSON.parse(e.getItem(this.localKey(t,n)))},updateCurrentState:function(e){this.canPushState()&&history.replaceState(e(history.state||{}),"",window.location.href)},pushState:function(e,t,n){if(this.canPushState()){if(n!==window.location.href){if("redirect"==t.type&&t.scroll){var i=history.state||{};i.scroll=t.scroll,history.replaceState(i,"",window.location.href)}delete t.scroll,history[e+"State"](t,"",n||null);var r=this.getHashTargetEl(window.location.hash);r?r.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&&nt.setCookie("__phoenix_flash__",t+"; max-age=60000; path=/"),window.location=e},localKey:function(e,t){return"".concat(e,"-").concat(t)},getHashTargetEl:function(e){var t=e.toString().substring(1);if(""!==t)return document.getElementById(t)||document.querySelector('a[name="'.concat(t,'"]'))}},it=nt,rt={byId:function(e){return document.getElementById(e)||ze("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){if(!e)return[];var i=Array.from(e.querySelectorAll(t));return n?i.forEach(n):i},childNodeLength:function(e){var t=document.createElement("template");return t.innerHTML=e,t.content.childElementCount},isUploadInput:function(e){return"file"===e.type&&null!==e.getAttribute(oe)},findUploadInputs:function(e){return this.all(e,'input[type="file"]['.concat(oe,"]"))},findComponentNodeList:function(e,t){return this.filterWithinSameLiveView(this.all(e,"[".concat(ee,'="').concat(t,'"]')),e)},isPhxDestroyed:function(e){return!(!e.id||!rt.private(e,"destroyed"))},markPhxChildDestroyed:function(e){this.isPhxChild(e)&&e.setAttribute(Ce,""),this.putPrivate(e,"destroyed",!0)},findPhxChildrenInFragment:function(e,t){var n=document.createElement("template");return n.innerHTML=e,this.findPhxChildren(n.content,t)},isIgnored:function(e,t){return"ignore"===(e.getAttribute(t)||e.getAttribute("data-phx-update"))},isPhxUpdate:function(e,t,n){return e.getAttribute&&n.indexOf(e.getAttribute(t))>=0},findPhxSticky:function(e){return this.all(e,"[".concat(Te,"]"))},findPhxChildren:function(e,t){return this.all(e,"".concat(Ae,"[").concat(ge,'="').concat(t,'"]'))},findParentCIDs:function(e,t){var n=this,i=new Set(t);return t.reduce((function(t,i){var r="[".concat(ee,'="').concat(i,'"] [').concat(ee,"]");return n.filterWithinSameLiveView(n.all(e,r),e).map((function(e){return parseInt(e.getAttribute(ee))})).forEach((function(e){return t.delete(e)})),t}),i)},filterWithinSameLiveView:function(e,t){var n=this;return t.querySelector(Ae)?e.filter((function(e){return n.withinSameLiveView(e,t)})):e},withinSameLiveView:function(e,t){for(;e=e.parentNode;){if(e.isSameNode(t))return!0;if(null!==e.getAttribute(Ce))return!1}},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},updatePrivate:function(e,t,n,i){var r=this.private(e,t);void 0===r?this.putPrivate(e,t,i(n)):this.putPrivate(e,t,i(r))},copyPrivates:function(e,t){t.phxPrivate&&(e.phxPrivate=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),f=this.incCycle(e,Be,(function(){return c?s.deletePrivate(e,Ye):a()}));if(isNaN(h))return ze("invalid throttle/debounce value: ".concat(l));if(c){var d=!1;if("keydown"===t.type){var v=this.private(e,Je);this.putPrivate(e,Je,t.key),d=v!==t.key}if(!d&&this.private(e,Ye))return!1;a(),this.putPrivate(e,Ye,!0),setTimeout((function(){return s.triggerCycle(e,Be)}),h)}else setTimeout((function(){return s.triggerCycle(e,Be,f)}),h);var p=e.form;p&&this.once(p,"bind-debounce")&&p.addEventListener("submit",(function(){Array.from(new FormData(p).entries(),(function(e){var t=q(e,1)[0],n=p.querySelector('[name="'.concat(t,'"]'));s.incCycle(n,Be),s.deletePrivate(n,Ye)}))})),this.once(e,"bind-debounce")&&e.addEventListener("blur",(function(){return s.triggerCycle(e,Be)}))}},triggerCycle:function(e,t,n){var i=q(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=this.private(e,t)||[0,n],r=q(i,1),o=r[0];return o++,this.putPrivate(e,t,[o,n]),o},discardError:function(e,t,n){var i=t.getAttribute&&t.getAttribute(n),r=i&&e.querySelector('[id="'.concat(i,'"], [name="').concat(i,'"]'));r&&(this.private(r,we)||this.private(r.form,xe)||t.classList.add(pe))},showError:function(e,t){var n=this;(e.id||e.name)&&this.all(e.form,"[".concat(t,'="').concat(e.id,'"], [').concat(t,'="').concat(e.name,'"]'),(function(e){n.removeClass(e,pe)}))},isPhxChild:function(e){return e.getAttribute&&e.getAttribute(ge)},isPhxSticky:function(e){return e.getAttribute&&null!==e.getAttribute(Te)},firstPhxChild:function(e){return this.isPhxChild(e)?e:this.all(e,"[".concat(ge,"]"))[0]},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=n.exclude||[],r=n.isIgnored,o=t.attributes,a=o.length-1;a>=0;a--){var s=o[a].name;i.indexOf(s)<0&&e.setAttribute(s,t.getAttribute(s))}for(var u=e.attributes,c=u.length-1;c>=0;c--){var l=u[c].name;r?l.startsWith("data-")&&!t.hasAttribute(l)&&e.removeAttribute(l):t.hasAttribute(l)||e.removeAttribute(l)}},mergeFocusedInput:function(e,t){e instanceof HTMLSelectElement||rt.mergeAttrs(e,t,{except:["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(rt.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&&Se.indexOf(e.type.toLocaleLowerCase())>=0&&(e.checked=null!==e.getAttribute("checked"))},isTextualInput:function(e){return Ee.indexOf(e.type)>=0},isNowTriggerFormExternal:function(e,t){return e.getAttribute&&null!==e.getAttribute(t)},syncPendingRef:function(e,t,n){var i=e.getAttribute(ne);if(null===i)return!0;var r=e.getAttribute(ie);return rt.isFormInput(e)||null!==e.getAttribute(n)?(rt.isUploadInput(e)&&rt.mergeAttrs(e,t,{isIgnored:!0}),rt.putPrivate(e,ne,t),!1):(Z.forEach((function(n){e.classList.contains(n)&&t.classList.add(n)})),t.setAttribute(ne,i),t.setAttribute(ie,r),!0)},cleanChildNodes:function(e,t){if(rt.isPhxUpdate(e,t,["append","prepend"])){var n=[];e.childNodes.forEach((function(e){e.id||(e.nodeType===Node.TEXT_NODE&&""===e.nodeValue.trim()||ze('only HTML element tags with an id are allowed inside containers with phx-update.\n\nremoving illegal node: "'.concat((e.outerHTML||e.nodeValue).trim(),'"\n\n')),n.push(e))})),n.forEach((function(e){return e.remove()}))}},replaceRootContainer:function(e,t,n){var i=new Set(["id",Ce,Pe,ye,be]);if(e.tagName.toLowerCase()===t.toLowerCase())return Array.from(e.attributes).filter((function(e){return!i.has(e.name.toLowerCase())})).forEach((function(t){return e.removeAttribute(t.name)})),Object.keys(n).filter((function(e){return!i.has(e.toLowerCase())})).forEach((function(t){return e.setAttribute(t,n[t])})),e;var r=document.createElement(t);return Object.keys(n).forEach((function(e){return r.setAttribute(e,n[e])})),i.forEach((function(t){return r.setAttribute(t,e.getAttribute(t))})),r.innerHTML=e.innerHTML,e.replaceWith(r),r},getSticky:function(e,t,n){var i=(rt.private(e,"sticky")||[]).find((function(e){var n=q(e,1)[0];return t===n}));if(i){var r=q(i,3);r[0],r[1];return r[2]}return"function"==typeof n?n():n},deleteSticky:function(e,t){this.updatePrivate(e,"sticky",[],(function(e){return e.filter((function(e){var n=q(e,2),i=n[0];n[1];return i!==t}))}))},putSticky:function(e,t,n){var i=n(e);this.updatePrivate(e,"sticky",[],(function(e){var r=e.findIndex((function(e){var n=q(e,1)[0];return t===n}));return r>=0?e[r]=[t,n,i]:e.push([t,n,i]),e}))},applyStickyOperations:function(e){var t=this,n=rt.private(e,"sticky");n&&n.forEach((function(n){var i=q(n,3),r=i[0],o=i[1];i[2];return t.putSticky(e,r,o)}))}},ot=rt,at=function(){function e(t,n,i){K(this,e),this.ref=ut.genFileRef(n),this.fileEl=t,this.file=n,this.view=i,this.meta=null,this._isCancelled=!1,this._isDone=!1,this._progress=0,this._lastProgressSent=-1,this._onDone=function(){},this._onElUpdated=this.onElUpdated.bind(this),this.fileEl.addEventListener(ce,this._onElUpdated)}return $(e,null,[{key:"isActive",value:function(e,t){var n=void 0===t._phxRef,i=e.getAttribute(ue).split(",").indexOf(ut.genFileRef(t))>=0;return t.size>0&&(n||i)}},{key:"isPreflighted",value:function(e,t){var n=e.getAttribute(ae).split(",").indexOf(ut.genFileRef(t))>=0;return n&&this.isActive(e,t)}}]),$(e,[{key:"metadata",value:function(){return this.meta}},{key:"progress",value:function(e){var t=this;this._progress=Math.floor(e),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,(function(){ut.untrackFile(t.fileEl,t.file),t._onDone()}))):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}},{key:"cancel",value:function(){this._isCancelled=!0,this._isDone=!0,this._onDone()}},{key:"isDone",value:function(){return this._isDone}},{key:"error",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"failed";this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),ut.clearFiles(this.fileEl)}},{key:"onDone",value:function(e){var t=this;this._onDone=function(){t.fileEl.removeEventListener(ce,t._onElUpdated),e()}}},{key:"onElUpdated",value:function(){-1===this.fileEl.getAttribute(ue).split(",").indexOf(this.ref)&&this.cancel()}},{key:"toPreflightPayload",value:function(){return{last_modified:this.file.lastModified,name:this.file.name,size:this.file.size,type:this.file.type,ref:this.ref}}},{key:"uploader",value:function(e){if(this.meta.uploader){var t=e[this.meta.uploader]||ze("no uploader configured for ".concat(this.meta.uploader));return{name:this.meta.uploader,callback:t}}return{name:"channel",callback:tt}}},{key:"zipPostFlight",value:function(e){this.meta=e.entries[this.ref],this.meta||ze("no preflight upload response returned with ref ".concat(this.ref),{input:this.fileEl,response:e})}}]),e}(),st=0,ut=function(){function e(t,n,i){K(this,e),this.view=n,this.onComplete=i,this._entries=Array.from(e.filesAwaitingPreflight(t)||[]).map((function(e){return new at(t,e,n)})),this.numEntriesInProgress=this._entries.length}return $(e,null,[{key:"genFileRef",value:function(e){var t=e._phxRef;return void 0!==t?t:(e._phxRef=(st++).toString(),e._phxRef)}},{key:"getEntryDataURL",value:function(e,t,n){var i=this,r=this.activeFiles(e).find((function(e){return i.genFileRef(e)===t}));n(URL.createObjectURL(r))}},{key:"hasUploadsInProgress",value:function(e){var t=0;return ot.findUploadInputs(e).forEach((function(e){e.getAttribute(ae)!==e.getAttribute("data-phx-done-refs")&&t++})),t>0}},{key:"serializeUploads",value:function(e){var t=this,n=this.activeFiles(e),i={};return n.forEach((function(n){var r={path:e.name},o=e.getAttribute(oe);i[o]=i[o]||[],r.ref=t.genFileRef(n),r.name=n.name||r.ref,r.type=n.type,r.size=n.size,i[o].push(r)})),i}},{key:"clearFiles",value:function(e){e.value=null,e.removeAttribute(oe),ot.putPrivate(e,"files",[])}},{key:"untrackFile",value:function(e,t){ot.putPrivate(e,"files",ot.private(e,"files").filter((function(e){return!Object.is(e,t)})))}},{key:"trackFiles",value:function(e,t){var n=this;if(null!==e.getAttribute("multiple")){var i=t.filter((function(t){return!n.activeFiles(e).find((function(e){return Object.is(e,t)}))}));ot.putPrivate(e,"files",this.activeFiles(e).concat(i)),e.value=null}else ot.putPrivate(e,"files",t)}},{key:"activeFileInputs",value:function(e){var t=this,n=ot.findUploadInputs(e);return Array.from(n).filter((function(e){return e.files&&t.activeFiles(e).length>0}))}},{key:"activeFiles",value:function(e){return(ot.private(e,"files")||[]).filter((function(t){return at.isActive(e,t)}))}},{key:"inputsAwaitingPreflight",value:function(e){var t=this,n=ot.findUploadInputs(e);return Array.from(n).filter((function(e){return t.filesAwaitingPreflight(e).length>0}))}},{key:"filesAwaitingPreflight",value:function(e){return this.activeFiles(e).filter((function(t){return!at.isPreflighted(e,t)}))}}]),$(e,[{key:"entries",value:function(){return this._entries}},{key:"initAdapterUpload",value:function(e,t,n){var i=this;this._entries=this._entries.map((function(t){return t.zipPostFlight(e),t.onDone((function(){i.numEntriesInProgress--,0===i.numEntriesInProgress&&i.onComplete()})),t}));var r=this._entries.reduce((function(e,t){var i=t.uploader(n.uploaders),r=i.name,o=i.callback;return e[r]=e[r]||{callback:o,entries:[]},e[r].entries.push(t),e}),{});for(var o in r){var a=r[o];(0,a.callback)(a.entries,t,e,n)}}}]),e}(),ct={LiveFileUpload:{activeRefs:function(){return this.el.getAttribute(ue)},preflightedRefs:function(){return this.el.getAttribute(ae)},mounted:function(){this.preflightedWas=this.preflightedRefs()},updated:function(){var e=this.preflightedRefs();this.preflightedWas!==e&&(this.preflightedWas=e,""===e&&this.__view.cancelSubmit(this.el.form)),""===this.activeRefs()&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(ce))}},LiveImgPreview:{mounted:function(){var e=this;this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(oe)),ut.getEntryDataURL(this.inputEl,this.ref,(function(t){e.url=t,e.el.src=t}))},destroyed:function(){URL.revokeObjectURL(this.url)}}},lt=function(){function e(t,n,i){K(this,e);var r=new Set,o=new Set(J(n.children).map((function(e){return e.id}))),a=[];Array.from(t.children).forEach((function(e){if(e.id&&(r.add(e.id),o.has(e.id))){var t=e.previousElementSibling&&e.previousElementSibling.id;a.push({elementId:e.id,previousElementId:t})}})),this.containerId=n.id,this.updateType=i,this.elementsToModify=a,this.elementIdsToAdd=J(o).filter((function(e){return!r.has(e)}))}return $(e,[{key:"perform",value:function(){var e=ot.byId(this.containerId);this.elementsToModify.forEach((function(t){t.previousElementId?et(document.getElementById(t.previousElementId),(function(e){et(document.getElementById(t.elementId),(function(t){t.previousElementSibling&&t.previousElementSibling.id==e.id||e.insertAdjacentElement("afterend",t)}))})):et(document.getElementById(t.elementId),(function(t){null==t.previousElementSibling||e.insertAdjacentElement("afterbegin",t)}))})),"prepend"==this.updateType&&this.elementIdsToAdd.reverse().forEach((function(t){et(document.getElementById(t),(function(t){return e.insertAdjacentElement("afterbegin",t)}))}))}}]),e}();var ht="undefined"==typeof document?void 0:document,ft=!!ht&&"content"in ht.createElement("template"),dt=!!ht&&ht.createRange&&"createContextualFragment"in ht.createRange();function vt(e){return e=e.trim(),ft?function(e){var t=ht.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(e):dt?function(e){return Ge||(Ge=ht.createRange()).selectNode(ht.body),Ge.createContextualFragment(e).childNodes[0]}(e):function(e){var t=ht.createElement("body");return t.innerHTML=e,t.childNodes[0]}(e)}function pt(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 mt(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n))}var gt={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)}mt(e,t,"selected")},INPUT:function(e,t){mt(e,t,"checked"),mt(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 yt(){}function bt(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}var kt,wt=(kt=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(e,t,n){if(n||(n={}),"string"==typeof t)if("#document"===e.nodeName||"HTML"===e.nodeName||"BODY"===e.nodeName){var i=t;(t=ht.createElement("html")).innerHTML=i}else t=vt(t);var r=n.getNodeKey||bt,o=n.onBeforeNodeAdded||yt,a=n.onNodeAdded||yt,s=n.onBeforeElUpdated||yt,u=n.onElUpdated||yt,c=n.onBeforeNodeDiscarded||yt,l=n.onNodeDiscarded||yt,h=n.onBeforeElChildrenUpdated||yt,f=!0===n.childrenOnly,d=Object.create(null),v=[];function p(e){v.push(e)}function m(e,t){if(1===e.nodeType)for(var n=e.firstChild;n;){var i=void 0;t&&(i=r(n))?p(i):(l(n),n.firstChild&&m(n,t)),n=n.nextSibling}}function g(e,t,n){!1!==c(e)&&(t&&t.removeChild(e),l(e),m(e,n))}function y(e){a(e);for(var t=e.firstChild;t;){var n=t.nextSibling,i=r(t);if(i){var o=d[i];o&&pt(t,o)?(t.parentNode.replaceChild(o,t),b(o,t)):y(t)}else y(t);t=n}}function b(e,t,n){var i=r(t);if(i&&delete d[i],!n){if(!1===s(e,t))return;if(kt(e,t),u(e),!1===h(e,t))return}"TEXTAREA"!==e.nodeName?function(e,t){var n,i,a,s,u,c=t.firstChild,l=e.firstChild;e:for(;c;){for(s=c.nextSibling,n=r(c);l;){if(a=l.nextSibling,c.isSameNode&&c.isSameNode(l)){c=s,l=a;continue e}i=r(l);var h=l.nodeType,f=void 0;if(h===c.nodeType&&(1===h?(n?n!==i&&((u=d[n])?a===u?f=!1:(e.insertBefore(u,l),i?p(i):g(l,e,!0),l=u):f=!1):i&&(f=!1),(f=!1!==f&&pt(l,c))&&b(l,c)):3!==h&&8!=h||(f=!0,l.nodeValue!==c.nodeValue&&(l.nodeValue=c.nodeValue))),f){c=s,l=a;continue e}i?p(i):g(l,e,!0),l=a}if(n&&(u=d[n])&&pt(u,c))e.appendChild(u),b(u,c);else{var v=o(c);!1!==v&&(v&&(c=v),c.actualize&&(c=c.actualize(e.ownerDocument||ht)),e.appendChild(c),y(c))}c=s,l=a}!function(e,t,n){for(;t;){var i=t.nextSibling;(n=r(t))?p(n):g(t,e,!0),t=i}}(e,l,i);var m=gt[e.nodeName];m&&m(e,t)}(e,t):gt.TEXTAREA(e,t)}!function e(t){if(1===t.nodeType||11===t.nodeType)for(var n=t.firstChild;n;){var i=r(n);i&&(d[i]=n),e(n),n=n.nextSibling}}(e);var k,w,E=e,S=E.nodeType,x=t.nodeType;if(!f)if(1===S)1===x?pt(e,t)||(l(e),E=function(e,t){for(var n=e.firstChild;n;){var i=n.nextSibling;t.appendChild(n),n=i}return t}(e,(k=t.nodeName,(w=t.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==w?ht.createElementNS(w,k):ht.createElement(k)))):E=t;else if(3===S||8===S){if(x===S)return E.nodeValue!==t.nodeValue&&(E.nodeValue=t.nodeValue),E;E=t}if(E===t)l(e);else{if(t.isSameNode&&t.isSameNode(E))return;if(b(E,t,f),v)for(var C=0,A=v.length;C1?t-1:0),i=1;i1?t-1:0),i=1;i *, [phx-update=prepend] > *",(function(e){e.setAttribute(he,"")}))}},{key:"perform",value:function(){var e=this,t=this.view,n=this.liveSocket,i=this.container,r=this.html,o=this.isCIDPatch()?this.targetCIDContainer(r):i;if(!this.isCIDPatch()||o){var a=n.getActiveElement(),s=a&&ot.hasSelectionRange(a)?a:{},u=s.selectionStart,c=s.selectionEnd,l=n.binding(Oe),h=n.binding(ke),f=n.binding(Le),d=n.binding("trigger-action"),v=n.binding("remove"),p=[],m=[],g=[],y=[],b=null,k=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(){wt(o,k,{childrenOnly:null===o.getAttribute(ee),getNodeKey:function(e){return ot.isPhxDestroyed(e)?null:e.id},onBeforeNodeAdded:function(t){return e.trackBefore("added",t),t},onNodeAdded:function(n){n instanceof HTMLImageElement&&n.srcset?n.srcset=n.srcset:n instanceof HTMLVideoElement&&n.autoplay&&n.play(),ot.isNowTriggerFormExternal(n,d)&&(b=n),ot.discardError(o,n,h),(ot.isPhxChild(n)&&t.ownsElement(n)||ot.isPhxSticky(n)&&t.ownsElement(n.parentNode))&&e.trackAfter("phxChildAdded",n),p.push(n)},onNodeDiscarded:function(t){(ot.isPhxChild(t)||ot.isPhxSticky(t))&&n.destroyViewByEl(t),e.trackAfter("discarded",t)},onBeforeNodeDiscarded:function(t){return!(!t.getAttribute||null===t.getAttribute(he))||(null===t.parentNode||!ot.isPhxUpdate(t.parentNode,l,["append","prepend"])||!t.id)&&(t.getAttribute&&t.getAttribute(v)?(y.push(t),!1):!e.skipCIDSibling(t))},onElUpdated:function(e){ot.isNowTriggerFormExternal(e,d)&&(b=e),m.push(e)},onBeforeElUpdated:function(t,n){if(ot.cleanChildNodes(n,l),e.skipCIDSibling(n))return!1;if(ot.isPhxSticky(t))return!1;if(ot.isIgnored(t,l))return e.trackBefore("updated",t,n),ot.mergeAttrs(t,n,{isIgnored:!0}),m.push(t),ot.applyStickyOperations(t),!1;if("number"===t.type&&t.validity&&t.validity.badInput)return!1;if(!ot.syncPendingRef(t,n,f))return ot.isUploadInput(t)&&(e.trackBefore("updated",t,n),m.push(t)),ot.applyStickyOperations(t),!1;if(ot.isPhxChild(n)){var i=t.getAttribute(Ce);return ot.mergeAttrs(t,n,{exclude:[Pe]}),""!==i&&t.setAttribute(Ce,i),t.setAttribute(be,e.rootID),ot.applyStickyOperations(t),!1}return ot.copyPrivates(n,t),ot.discardError(o,n,h),a&&t.isSameNode(a)&&ot.isFormInput(t)?(e.trackBefore("updated",t,n),ot.mergeFocusedInput(t,n),ot.syncAttrsToProps(t),m.push(t),ot.applyStickyOperations(t),!1):(ot.isPhxUpdate(n,l,["append","prepend"])&&g.push(new lt(t,n,n.getAttribute(l))),ot.syncAttrsToProps(n),ot.applyStickyOperations(n),e.trackBefore("updated",t,n),!0)}})})),n.isDebugEnabled()&&function(){for(var e=new Set,t=document.querySelectorAll("*[id]"),n=0,i=t.length;n0&&n.time("post-morph append/prepend restoration",(function(){g.forEach((function(e){return e.perform()}))})),n.silenceEvents((function(){return ot.restoreFocus(a,u,c)})),ot.dispatchEvent(document,"phx:update"),p.forEach((function(t){return e.trackAfter("added",t)})),m.forEach((function(t){return e.trackAfter("updated",t)})),y.length>0&&(n.transitionRemoves(y),n.requestDOMUpdate((function(){y.forEach((function(e){var t=ot.firstPhxChild(e);t&&n.destroyViewByEl(t),e.remove()})),e.trackAfter("transitionsDiscarded",y)}))),b&&(n.disconnect(),b.submit()),!0}}},{key:"isCIDPatch",value:function(){return this.cidPatch}},{key:"skipCIDSibling",value:function(e){return e.nodeType===Node.ELEMENT_NODE&&null!==e.getAttribute(le)}},{key:"targetCIDContainer",value:function(e){if(this.isCIDPatch()){var t=Y(ot.findComponentNodeList(this.container,this.targetCID)),n=t[0];return 0===t.slice(1).length&&1===ot.childNodeLength(e)?n:n&&n.parentNode}}},{key:"buildDiffHTML",value:function(e,t,n,i){var r=this,o=this.isCIDPatch(),a=o&&i.getAttribute(ee)===this.targetCID.toString();if(!o||a)return t;var s=null,u=document.createElement("template");s=ot.cloneNode(i);var c=Y(ot.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(ee)!==r.targetCID.toString()&&(e.setAttribute(le,""),e.innerHTML="")})),Array.from(u.content.childNodes).forEach((function(e){return s.insertBefore(e,l)})),l.remove(),s.outerHTML}}]),e}(),St=function(){function e(t,n){K(this,e),this.viewId=t,this.rendered={},this.mergeDiff(n)}return $(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||[]}}}]),$(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,null,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,n={};if(delete e.c,this.rendered=this.mutableMerge(this.rendered,e),this.rendered.c=this.rendered.c||{},t){var i=this.rendered.c;for(var r in t)t[r]=this.cachedFindComponent(r,t[r],i,t,n);for(var o in t)i[o]=t[o];e.c=t}}},{key:"cachedFindComponent",value:function(e,t,n,i,r){if(r[e])return r[e];var o,a,s,u=t.s;return Ve(u)?(a=(s=u>0?this.cachedFindComponent(u,i[u],n,i,r):n[-u]).s,(o=this.cloneMerge(s,t)).s=a):o=void 0!==t.s?t:this.cloneMerge(n[e]||{},t),r[e]=o,o}},{key:"mutableMerge",value:function(e,t){return void 0!==t.s?t:(this.doMutableMerge(e,t),e)}},{key:"doMutableMerge",value:function(e,t){for(var n in t){var i=t[n],r=e[n];Qe(i)&&void 0===i.s&&Qe(r)?this.doMutableMerge(r,i):e[n]=i}}},{key:"cloneMerge",value:function(e,t){var n=F({},e,{},t);for(var i in n){var r=t[i],o=e[i];Qe(r)&&void 0===r.s&&Qe(o)&&(n[i]=this.cloneMerge(o,r))}return n}},{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(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!!e.s}},{key:"templateStatic",value:function(e,t){return"number"==typeof e?t[e]:e}},{key:"toOutputBuffer",value:function(e,t,n){if(e.d)return this.comprehensionToBuffer(e,t,n);var i=e.s;i=this.templateStatic(i,t),n.buffer+=i[0];for(var r=1;r1&&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:".concat(e),n),this.__listeners.add(n),n}},{key:"removeHandleEvent",value:function(e){var t=e(null,!0);window.removeEventListener("phx:".concat(t),e),this.__listeners.delete(e)}},{key:"upload",value:function(e,t){return this.__view.dispatchUploads(e,t)}},{key:"uploadTo",value:function(e,t,n){return this.__view.withinTargets(e,(function(e){return e.dispatchUploads(t,n)}))}},{key:"__cleanup__",value:function(){var e=this;this.__listeners.forEach((function(t){return e.removeHandleEvent(t)}))}}]),e}(),At={exec:function(e,t,n,i,r){var o=this,a=q(r||[null,{}],2),s=a[0],u=a[1];("["===t.charAt(0)?JSON.parse(t):[[s,u]]).forEach((function(r){var a=q(r,2),c=a[0],l=a[1];c===s&&u.data&&(l.data=Object.assign(l.data||{},u.data)),o.filterToEls(i,l).forEach((function(r){o["exec_".concat(c)](e,t,n,i,r,l)}))}))},isVisible:function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length>0)},exec_dispatch:function(e,t,n,i,r,o){o.to;var a=o.event,s=o.detail;ot.dispatchEvent(r,a,s)},exec_push:function(e,t,n,i,r,o){var a=o.event,s=o.data,u=o.target,c=o.page_loading,l={loading:o.loading,value:o.value,target:u,page_loading:!!c},h="change"===e?i.form:i,f=u||h.getAttribute(n.binding("target"))||h;n.withinTargets(f,(function(n,r){if("change"===e){var u=o.newCid,c=o._target,h=o.callback;c&&(l._target=c),n.pushInput(i,r,u,a||t,l,h)}else"submit"===e?n.submitForm(i,r,a||t,l):n.pushEvent(e,i,r,a||t,s,l)}))},exec_add_class:function(e,t,n,i,r,o){var a=o.names,s=o.transition,u=o.time;this.addOrRemoveClasses(r,a,[],s,u,n)},exec_remove_class:function(e,t,n,i,r,o){var a=o.names,s=o.transition,u=o.time;this.addOrRemoveClasses(r,[],a,s,u,n)},exec_transition:function(e,t,n,i,r,o){var a=this,s=o.time,u=q(o.transition,3),c=u[0],l=u[1],h=u[2];n.transition(s,(function(){return a.addOrRemoveClasses(r,c.concat(l),[])}),(function(){return a.addOrRemoveClasses(r,h,c.concat(l))}))},exec_toggle:function(e,t,n,i,r,o){var a=o.display,s=o.ins,u=o.outs,c=o.time;this.toggle(e,n,r,a,s,u,c)},exec_show:function(e,t,n,i,r,o){var a=o.display,s=o.transition,u=o.time;this.show(e,n,r,a,s,u)},exec_hide:function(e,t,n,i,r,o){var a=o.display,s=o.transition,u=o.time;this.hide(e,n,r,a,s,u)},exec_set_attr:function(e,t,n,i,r,o){var a=q(o.attr,2),s=a[0],u=a[1];this.setOrRemoveAttrs(r,[[s,u]],[])},exec_remove_attr:function(e,t,n,i,r,o){var a=o.attr;this.setOrRemoveAttrs(r,[],[a])},show:function(e,t,n,i,r,o){this.isVisible(n)||this.toggle(e,t,n,i,r,null,o)},hide:function(e,t,n,i,r,o){this.isVisible(n)&&this.toggle(e,t,n,i,null,r,o)},toggle:function(e,t,n,i,r,o,a){var s=this,u=q(r||[[],[],[]],3),c=u[0],l=u[1],h=u[2],f=q(o||[[],[],[]],3),d=f[0],v=f[1],p=f[2];if(c.length>0||d.length>0)if(this.isVisible(n)){n.dispatchEvent(new Event("phx:hide-start")),t.transition(a,(function(){s.addOrRemoveClasses(n,v,c.concat(l).concat(h)),window.requestAnimationFrame((function(){s.addOrRemoveClasses(n,d,[]),window.requestAnimationFrame((function(){return s.addOrRemoveClasses(n,p,v)}))}))}),(function(){s.addOrRemoveClasses(n,[],d.concat(p)),ot.putSticky(n,"toggle",(function(e){return e.style.display="none"})),n.dispatchEvent(new Event("phx:hide-end"))}))}else{if("remove"===e)return;n.dispatchEvent(new Event("phx:show-start")),t.transition(a,(function(){s.addOrRemoveClasses(n,l,d.concat(v).concat(p)),ot.putSticky(n,"toggle",(function(e){return e.style.display=i||"block"})),window.requestAnimationFrame((function(){s.addOrRemoveClasses(n,c,[]),window.requestAnimationFrame((function(){return s.addOrRemoveClasses(n,h,l)}))}))}),(function(){s.addOrRemoveClasses(n,[],c.concat(h)),n.dispatchEvent(new Event("phx:show-end"))}))}else this.isVisible(n)?window.requestAnimationFrame((function(){n.dispatchEvent(new Event("phx:hide-start")),ot.putSticky(n,"toggle",(function(e){return e.style.display="none"})),n.dispatchEvent(new Event("phx:hide-end"))})):window.requestAnimationFrame((function(){n.dispatchEvent(new Event("phx:show-start")),ot.putSticky(n,"toggle",(function(e){return e.style.display=i||"block"})),n.dispatchEvent(new Event("phx:show-end"))}))},addOrRemoveClasses:function(e,t,n,i,r,o){var a=this,s=q(i||[[],[],[]],3),u=s[0],c=s[1],l=s[2];if(u.length>0){return o.transition(r,(function(){return a.addOrRemoveClasses(e,c.concat(u),[])}),(function(){return a.addOrRemoveClasses(e,t.concat(l),n.concat(u).concat(c))}))}window.requestAnimationFrame((function(){var i=q(ot.getSticky(e,"classes",[[],[]]),2),r=i[0],o=i[1],a=t.filter((function(t){return r.indexOf(t)<0&&!e.classList.contains(t)})),s=n.filter((function(t){return o.indexOf(t)<0&&e.classList.contains(t)})),u=r.filter((function(e){return n.indexOf(e)<0})).concat(a),c=o.filter((function(e){return t.indexOf(e)<0})).concat(s);ot.putSticky(e,"classes",(function(e){var t,n;return(t=e.classList).remove.apply(t,J(c)),(n=e.classList).add.apply(n,J(u)),[u,c]}))}))},setOrRemoveAttrs:function(e,t,n){var i=this,r=q(ot.getSticky(e,"attrs",[[],[]]),2),o=r[0],a=r[1],s=t.filter((function(t){var n=q(t,2),r=n[0];n[1];return!i.hasSet(o,r)&&!e.attributes.getNamedItem(r)})),u=n.filter((function(t){return a.indexOf(t)<0&&e.attributes.getNamedItem(t)})),c=o.filter((function(e){var t=q(e,2),i=t[0];t[1];return n.indexOf(i)<0})).concat(s),l=a.filter((function(e){return!i.hasSet(t,e)})).concat(u);ot.putSticky(e,"attrs",(function(e){return l.forEach((function(t){return e.removeAttribute(t)})),c.forEach((function(t){var n=q(t,2),i=n[0],r=n[1];return e.setAttribute(i,r)})),[c,l]}))},hasSet:function(e,t){return e.find((function(e){var n=q(e,2),i=n[0];n[1];return i===t}))},hasAllClasses:function(e,t){return t.every((function(t){return e.classList.contains(t)}))},isToggledOut:function(e,t){return!this.isVisible(e)||this.hasAllClasses(e,t)},filterToEls:function(e,t){var n=t.to;return n?ot.all(document,n):[e]}},Tt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new FormData(e),i=[];n.forEach((function(e,t,n){e instanceof File&&i.push(t)})),i.forEach((function(e){return n.delete(e)}));var r=new URLSearchParams,o=!0,a=!1,s=void 0;try{for(var u,c=n.entries()[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var l=q(u.value,2),h=l[0],f=l[1];r.append(h,f)}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}for(var d in t)r.append(d,t[d]);return r.toString()},Pt=function(){function e(t,n,i,r){var o=this;K(this,e),this.liveSocket=n,this.flash=r,this.parent=i,this.root=i?i.root:this,this.el=t,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.pruningCIDs=[],this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(e){e&&e()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.uploaders={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.channel=this.liveSocket.channel("lv:".concat(this.id),(function(){return{redirect:o.redirect?o.href:void 0,url:o.redirect?void 0:o.href||void 0,params:o.connectParams(),session:o.getSession(),static:o.getStatic(),flash:o.flash}})),this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel()}return $(e,[{key:"setHref",value:function(e){this.href=e}},{key:"setRedirect",value:function(e){this.redirect=!0,this.href=e}},{key:"isMain",value:function(){return null!==this.el.getAttribute(ye)}},{key:"connectParams",value:function(){var e=this.liveSocket.params(this.el),t=ot.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:"isConnected",value:function(){return this.channel.canPush()}},{key:"getSession",value:function(){return this.el.getAttribute(Ce)}},{key:"getStatic",value:function(){var e=this.el.getAttribute(Pe);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.destroyHook(e.viewHooks[n])};ot.markPhxChildDestroyed(this.el),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(de,ve,me),(e=this.el.classList).add.apply(e,arguments)}},{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].__disconnected();this.setContainerClasses(ve)}}},{key:"hideLoader",value:function(){clearTimeout(this.loaderTimer),this.setContainerClasses(de)}},{key:"triggerReconnected",value:function(){for(var e in this.viewHooks)this.viewHooks[e].__reconnected()}},{key:"log",value:function(e,t){this.liveSocket.log(this,e,t)}},{key:"transition",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};this.liveSocket.transition(e,t,n)}},{key:"withinTargets",value:function(e,t){var n=this;if(e instanceof HTMLElement||e instanceof SVGElement)return this.liveSocket.owner(e,(function(n){return t(n,e)}));if(Ve(e)){0===ot.findComponentNodeList(this.el,e).length?ze("no component found matching phx-target of ".concat(e)):t(this,parseInt(e))}else{var i=Array.from(document.querySelectorAll(e));0===i.length&&ze('nothing found matching the phx-target selector "'.concat(e,'"')),i.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["",Xe(t)]}));var i=St.extract(t),r=i.diff,o=i.reply,a=i.events,s=i.title;return s&&ot.putTitle(s),n({diff:r,reply:o,events:a}),o}},{key:"onJoin",value:function(e){var t=this,n=e.rendered,i=e.container;if(i){var r=q(i,2),o=r[0],a=r[1];this.el=ot.replaceRootContainer(this.el,o,a)}this.childJoins=0,this.joinPending=!0,this.flash=null,it.dropLocal(this.liveSocket.localStorage,window.location.pathname,Q),this.applyDiff("mount",n,(function(n){var i=n.diff,r=n.events;t.rendered=new St(t.id,i);var o=t.renderContainer(null,"join");t.dropPendingRefs();var a=t.formsForRecovery(o);t.joinCount++,a.length>0?a.forEach((function(e,n){var i=q(e,3),s=i[0],u=(i[1],i[2]);t.pushFormRecovery(s,u,(function(e){n===a.length-1&&t.onJoinComplete(e,o,r)}))})):t.onJoinComplete(e,o,r)}))}},{key:"dropPendingRefs",value:function(){ot.all(document,"[".concat(ie,'="').concat(this.id,'"][').concat(ne,"]"),(function(e){e.removeAttribute(ne),e.removeAttribute(ie)}))}},{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===ot.findPhxChildrenInFragment(t,this.id).filter((function(e){var t=e.id&&i.el.querySelector('[id="'.concat(e.id,'"]')),n=t&&t.getAttribute(Pe);return n&&e.setAttribute(Pe,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=ot.byId(this.id),this.el.setAttribute(be,this.root.id)}},{key:"applyJoinPatch",value:function(e,t,n){var i=this;this.attachTrueDocEl();var r=new Et(this,this.el,this.id,t,null);if(r.markPrunableContentForRemoval(),this.performPatch(r,!1),this.joinNewChildren(),ot.all(this.el,"[".concat(this.binding(Me),"], [data-phx-").concat(Me,"]"),(function(e){var t=i.addHook(e);t&&t.__mounted()})),this.joinPending=!1,this.liveSocket.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,i,r=this.getHook(e),o=r&&ot.isIgnored(e,this.binding(Oe));if(r&&!e.isEqualNode(t)&&(!o||(n=e.dataset,i=t.dataset,JSON.stringify(n)!==JSON.stringify(i))))return r.__beforeUpdate(),r}},{key:"performPatch",value:function(e,t){var n=this,i=[],r=!1,o=new Set;return e.after("added",(function(e){n.liveSocket.triggerDOM("onNodeAdded",[e]);var t=n.addHook(e);t&&t.__mounted()})),e.after("phxChildAdded",(function(e){ot.isPhxSticky(e)?n.liveSocket.joinRootViews():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.getHook(e).__updated()})),e.after("discarded",(function(e){e.nodeType===Node.ELEMENT_NODE&&i.push(e)})),e.after("transitionsDiscarded",(function(e){return n.afterElementsRemoved(e,t)})),e.perform(),this.afterElementsRemoved(i,t),r}},{key:"afterElementsRemoved",value:function(e,t){var n=this,i=[];e.forEach((function(e){ot.all(e,"[".concat(ee,"]")).concat(e).forEach((function(e){var t=n.componentID(e);Ve(t)&&-1===i.indexOf(t)&&i.push(t);var r=n.getHook(e);r&&n.destroyHook(r)}))})),t&&this.maybePushComponentsDestroyed(i)}},{key:"joinNewChildren",value:function(){var e=this;ot.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(ge)][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(){var e=this;this.joinCallback((function(){e.pendingJoinOps.forEach((function(e){var t=q(e,2),n=t[0],i=t[1];n.isDestroyed()||i()})),e.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(){ot.findParentCIDs(n.el,n.rendered.componentCIDs(e)).forEach((function(t){n.componentPatch(n.rendered.getComponent(e,t),t)&&(i=!0)}))})):Ze(e)||this.liveSocket.time("full patch complete",(function(){var t=n.renderContainer(e,"update"),r=new Et(n,n.el,n.id,t,null);i=n.performPatch(r,!0)})),this.liveSocket.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).concat(n.pruningCIDs):null,r=n.rendered.toString(i);return"<".concat(t,">").concat(r,"").concat(t,">")}))}},{key:"componentPatch",value:function(e,t){if(Ze(e))return!1;var n=this.rendered.componentToString(t),i=new Et(this,this.el,this.id,n,t);return this.performPatch(i,!0)}},{key:"getHook",value:function(e){return this.viewHooks[Ct.elementID(e)]}},{key:"addHook",value:function(e){if(!Ct.elementID(e)&&e.getAttribute){var t=e.getAttribute("data-phx-".concat(Me))||e.getAttribute(this.binding(Me));if(!t||this.ownsElement(e)){var n=this.liveSocket.getHookCallbacks(t);if(n){e.id||ze('no DOM ID for hook "'.concat(t,'". Hooks require a unique ID on each element.'),e);var i=new Ct(this,e,n);return this.viewHooks[Ct.elementID(i.el)]=i,i}null!==t&&ze('unknown hook found for "'.concat(t,'"'),e)}}}},{key:"destroyHook",value:function(e){e.__destroyed(),e.__cleanup__(),delete this.viewHooks[Ct.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)}]):n.liveSocket.requestDOMUpdate((function(){return t(e)}))}))}},{key:"bindChannel",value:function(){var e=this;this.liveSocket.onChannel(this.channel,"diff",(function(t){e.liveSocket.requestDOMUpdate((function(){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(t){return e.onClose(t)}))}},{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.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=function(n){n=n||function(){},e?e(t.joinCount,n):n()},this.liveSocket.wrapPush(this,{timeout:!1},(function(){return t.channel.join().receive("ok",(function(e){t.isDestroyed()||t.liveSocket.requestDOMUpdate((function(){return t.onJoin(e)}))})).receive("error",(function(e){return!t.isDestroyed()&&t.onJoinError(e)})).receive("timeout",(function(){return!t.isDestroyed()&&t.onJoinError({reason:"timeout"})}))}))}},{key:"onJoinError",value:function(e){return"unauthorized"===e.reason||"stale"===e.reason?(this.log("error",(function(){return["unauthorized live_redirect. Falling back to page request",e]})),this.onRedirect({to:this.href})):((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(e){if(!this.isDestroyed()){if(this.isJoinPending()&&"hidden"!==document.visibilityState||this.liveSocket.hasPendingLink()&&"leave"!==e)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(e),this.log("error",(function(){return["view crashed",e]})),this.liveSocket.isUnloaded()||this.displayError()}},{key:"displayError",value:function(){this.isMain()&&ot.dispatchEvent(window,"phx:page-loading-start",{to:this.href,kind:"error"}),this.showLoader(),this.setContainerClasses(ve,me)}},{key:"pushWithReply",value:function(e,t,n){var i=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){};if(this.isConnected()){var o=e?e():[null,[],{}],a=q(o,3),s=a[0],u=q(a[1],1),c=u[0],l=a[2],h=function(){};return(l.page_loading||c&&null!==c.getAttribute(this.binding(fe)))&&(h=this.liveSocket.withPageLoading({kind:"element",target:c})),"number"!=typeof n.cid&&delete n.cid,this.liveSocket.wrapPush(this,{timeout:!0},(function(){return i.channel.push(t,n,3e4).receive("ok",(function(e){null!==s&&i.undoRefs(s);var t=function(t){e.redirect&&i.onRedirect(e.redirect),e.live_patch&&i.onLivePatch(e.live_patch),e.live_redirect&&i.onLiveRedirect(e.live_redirect),h(),r(e,t)};e.diff?i.liveSocket.requestDOMUpdate((function(){var n=i.applyDiff("update",e.diff,(function(e){var t=e.diff,n=e.events;i.update(t,n)}));t(n)})):t(null)}))}))}}},{key:"undoRefs",value:function(e){var t=this;ot.all(document,"[".concat(ie,'="').concat(this.id,'"][').concat(ne,'="').concat(e,'"]'),(function(e){var n=e.getAttribute(De);e.removeAttribute(ne),e.removeAttribute(ie),null!==e.getAttribute(_e)&&(e.readOnly=!1,e.removeAttribute(_e)),null!==n&&(e.disabled="true"===n,e.removeAttribute(De)),Z.forEach((function(t){return ot.removeClass(e,t)}));var i=e.getAttribute(Re);null!==i&&(e.innerText=i,e.removeAttribute(Re));var r=ot.private(e,ne);if(r){var o=t.triggerBeforeUpdateHook(e,r);Et.patchEl(e,r,t.liveSocket.getActiveElement()),o&&o.__updated(),ot.deletePrivate(e,ne)}}))}},{key:"putRef",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.ref++,o=this.binding(Le);return i.loading&&(e=e.concat(ot.all(document,i.loading))),e.forEach((function(e){e.classList.add("phx-".concat(t,"-loading")),e.setAttribute(ne,r),e.setAttribute(ie,n.el.id);var i=e.getAttribute(o);null!==i&&(e.getAttribute(Re)||e.setAttribute(Re,e.innerText),""!==i&&(e.innerText=i),e.setAttribute("disabled",""))})),[r,e,i]}},{key:"componentID",value:function(e){var t=e.getAttribute&&e.getAttribute(ee);return t?parseInt(t):null}},{key:"targetComponentID",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Ve(t))return t;var i=e.getAttribute(this.binding("target"));return Ve(i)?parseInt(i):t&&(null!==i||n.target)?this.closestComponentID(t):null}},{key:"closestComponentID",value:function(e){var t=this;return Ve(e)?e:e?et(e.closest("[".concat(ee,"]")),(function(e){return t.ownsElement(e)&&t.componentID(e)})):null}},{key:"pushHookEvent",value:function(e,t,n,i){if(!this.isConnected())return this.log("hook",(function(){return["unable to push hook event. LiveView not connected",t,n]})),!1;var r=q(this.putRef([],"hook"),3),o=r[0],a=r[1],s=r[2];return this.pushWithReply((function(){return[o,a,s]}),"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,n){for(var i=this.binding("value-"),r=0;r=0&&!e.checked&&delete t.value),n)for(var a in t||(t={}),n)t[a]=n[a];return t}},{key:"pushEvent",value:function(e,t,n,i,r){var o=this,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.pushWithReply((function(){return o.putRef([t],e,a)}),"event",{type:e,event:i,value:this.extractMeta(t,r,a.value),cid:this.targetComponentID(t,n,a)})}},{key:"pushFileProgress",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){};this.liveSocket.withinOwners(e.form,(function(r,o){r.pushWithReply(null,"progress",{event:e.getAttribute(r.binding(Ue)),ref:e.getAttribute(oe),entry_ref:t,progress:n,cid:r.targetComponentID(e.form,o)},i)}))}},{key:"pushInput",value:function(e,t,n,i,r,o){var a=this,s=Ve(n)?n:this.targetComponentID(e.form,t),u=function(){return a.putRef([e,e.form],"change",r)},c=Tt(e.form,{_target:r._target});ot.isUploadInput(e)&&e.files&&e.files.length>0&&ut.trackFiles(e,Array.from(e.files));var l={type:"form",event:i,value:c,uploads:ut.serializeUploads(e),cid:s};this.pushWithReply(u,"event",l,(function(n){if(ot.showError(e,a.liveSocket.binding(ke)),ot.isUploadInput(e)&&null!==e.getAttribute("data-phx-auto-upload")){if(ut.filesAwaitingPreflight(e).length>0){var i=q(u(),2),r=i[0];i[1];a.uploadFiles(e.form,t,r,s,(function(t){o&&o(n),a.triggerAwaitingSubmit(e.form)}))}}else o&&o(n)}))}},{key:"triggerAwaitingSubmit",value:function(e){var t=this.getScheduledSubmit(e);if(t){var n=q(t,4),i=(n[0],n[1],n[2],n[3]);this.cancelSubmit(e),i()}}},{key:"getScheduledSubmit",value:function(e){return this.formSubmits.find((function(t){var n=q(t,4),i=n[0];n[1],n[2],n[3];return i.isSameNode(e)}))}},{key:"scheduleSubmit",value:function(e,t,n,i){if(this.getScheduledSubmit(e))return!0;this.formSubmits.push([e,t,n,i])}},{key:"cancelSubmit",value:function(e){var t=this;this.formSubmits=this.formSubmits.filter((function(n){var i=q(n,3),r=i[0],o=i[1];i[2];return!r.isSameNode(e)||(t.undoRefs(o),!1)}))}},{key:"pushFormSubmit",value:function(e,t,n,i,r){var o=this,a=function(e){return!($e(e,"".concat(o.binding(Oe),"=ignore"),e.form)||$e(e,"data-phx-update=ignore",e.form))},s=function(e){return e.hasAttribute(o.binding(Le))},u=function(e){return"BUTTON"==e.tagName},c=function(e){return["INPUT","TEXTAREA","SELECT"].includes(e.tagName)},l=function(){var t=Array.from(e.elements),n=t.filter(s),r=t.filter(u).filter(a),l=t.filter(c).filter(a);return r.forEach((function(e){e.setAttribute(De,e.disabled),e.disabled=!0})),l.forEach((function(e){e.setAttribute(_e,e.readOnly),e.readOnly=!0,e.files&&(e.setAttribute(De,e.disabled),e.disabled=!0)})),e.setAttribute(o.binding(fe),""),o.putRef([e].concat(n).concat(r).concat(l),"submit",i)},h=this.targetComponentID(e,t);if(ut.hasUploadsInProgress(e)){var f=q(l(),2),d=f[0];f[1];return this.scheduleSubmit(e,d,i,(function(){return o.pushFormSubmit(e,t,n,i,r)}))}if(ut.inputsAwaitingPreflight(e).length>0){var v=q(l(),2),p=v[0],m=v[1],g=function(){return[p,m,i]};this.uploadFiles(e,t,p,h,(function(t){var i=Tt(e,{});o.pushWithReply(g,"event",{type:"form",event:n,value:i,cid:h},r)}))}else{var y=Tt(e);this.pushWithReply(l,"event",{type:"form",event:n,value:y,cid:h},r)}}},{key:"uploadFiles",value:function(e,t,n,i,r){var o=this,a=this.joinCount,s=ut.activeFileInputs(e),u=s.length;s.forEach((function(e){var i=new ut(e,o,(function(){0===--u&&r()}));o.uploaders[e]=i;var s=i.entries().map((function(e){return e.toPreflightPayload()})),c={ref:e.getAttribute(oe),entries:s,cid:o.targetComponentID(e.form,t)};o.log("upload",(function(){return["sending preflight request",c]})),o.pushWithReply(null,"allow_upload",c,(function(e){if(o.log("upload",(function(){return["got preflight response",e]})),e.error){o.undoRefs(n);var t=q(e.error,2),r=t[0],s=t[1];o.log("upload",(function(){return["error for entry ".concat(r),s]}))}else{i.initAdapterUpload(e,(function(e){o.channel.onError((function(){o.joinCount===a&&e()}))}),o.liveSocket)}}))}))}},{key:"dispatchUploads",value:function(e,t){var n=ot.findUploadInputs(this.el).filter((function(t){return t.name===e}));0===n.length?ze('no live file inputs found matching the name "'.concat(e,'"')):n.length>1?ze('duplicate live file inputs found matching the name "'.concat(e,'"')):ot.dispatchEvent(n[0],re,{files:t})}},{key:"pushFormRecovery",value:function(e,t,n){var i=this;this.liveSocket.withinOwners(e,(function(r,o){var a=e.elements[0],s=e.getAttribute(i.binding(Ie))||e.getAttribute(i.binding("change"));At.exec("change",s,r,a,["push",{_target:a.name,newCid:t,callback:n}])}))}},{key:"pushLinkPatch",value:function(e,t,n){var i=this,r=this.liveSocket.setPendingLink(e),o=t?function(){return i.putRef([t],"click")}:null,a=function(){return i.liveSocket.redirect(window.location.href)},s=this.pushWithReply(o,"live_patch",{url:e},(function(t){i.liveSocket.requestDOMUpdate((function(){t.link_redirect?i.liveSocket.replaceMain(e,null,n,r):(i.liveSocket.commitPendingLink(r)&&(i.href=e),i.applyPendingUpdates(),n&&n(r))}))}));s?s.receive("timeout",a):a()}},{key:"formsForRecovery",value:function(e){var t=this;if(0===this.joinCount)return[];var n=this.binding("change"),i=document.createElement("template");return i.innerHTML=e,ot.all(this.el,"form[".concat(n,"]")).filter((function(e){return e.id&&t.ownsElement(e)})).filter((function(e){return e.elements.length>0})).filter((function(e){return"ignore"!==e.getAttribute(t.binding(Ie))})).map((function(e){var r=i.content.querySelector('form[id="'.concat(e.id,'"][').concat(n,'="').concat(e.getAttribute(n),'"]'));return r?[e,r,t.targetComponentID(r)]:[e,null,null]})).filter((function(e){var t=q(e,3),n=(t[0],t[1]);t[2];return n}))}},{key:"maybePushComponentsDestroyed",value:function(e){var t,n=this,i=e.filter((function(e){return 0===ot.findComponentNodeList(n.el,e).length}));i.length>0&&((t=this.pruningCIDs).push.apply(t,J(i)),this.pushWithReply(null,"cids_will_destroy",{cids:i},(function(){n.pruningCIDs=n.pruningCIDs.filter((function(e){return-1!==i.indexOf(e)}));var e=i.filter((function(e){return 0===ot.findComponentNodeList(n.el,e).length}));e.length>0&&n.pushWithReply(null,"cids_destroyed",{cids:e},(function(e){n.rendered.pruneCIDs(e.cids)}))})))}},{key:"ownsElement",value:function(e){return e.getAttribute(ge)===this.id||et(e.closest(Ae),(function(e){return e.id}))===this.id}},{key:"submitForm",value:function(e,t,n){var i=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};ot.putPrivate(e,xe,!0);var o=this.liveSocket.binding(ke),a=Array.from(e.elements);this.liveSocket.blurActiveElement(this),this.pushFormSubmit(e,t,n,r,(function(){a.forEach((function(e){return ot.showError(e,o)})),i.liveSocket.restorePreviouslyActiveFocus()}))}},{key:"binding",value:function(e){return this.liveSocket.binding(e)}}]),e}(),_t=function(){function e(t,n){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(K(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||Fe,this.opts=r,this.params=Ke(r.params||{}),this.viewLogger=r.viewLogger,this.metadataCallbacks=r.metadata||{},this.defaults=Object.assign(Xe(We),r.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.linkRef=1,this.clickRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=Xe(window.location),this.hooks=r.hooks||{},this.uploaders=r.uploaders||{},this.loaderTimeout=r.loaderTimeout||1,this.maxReloads=r.maxReloads||10,this.reloadJitterMin=r.reloadJitterMin||1e3,this.reloadJitterMax=r.reloadJitterMax||3e3,this.failsafeJitter=r.failsafeJitter||3e4,this.localStorage=r.localStorage||window.localStorage,this.sessionStorage=r.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.domCallbacks=Object.assign({onNodeAdded:Ke(),onBeforeElUpdated:Ke()},r.dom||{}),this.transitions=new Dt,window.addEventListener("pagehide",(function(e){i.unloaded=!0})),this.socket.onOpen((function(){i.isUnloaded()&&window.location.reload()}))}return $(e,[{key:"isProfileEnabled",value:function(){return"true"===this.sessionStorage.getItem(Ne)}},{key:"isDebugEnabled",value:function(){return"true"===this.sessionStorage.getItem(je)}},{key:"enableDebug",value:function(){this.sessionStorage.setItem(je,"true")}},{key:"enableProfiling",value:function(){this.sessionStorage.setItem(Ne,"true")}},{key:"disableDebug",value:function(){this.sessionStorage.removeItem(je)}},{key:"disableProfiling",value:function(){this.sessionStorage.removeItem(Ne)}},{key:"enableLatencySim",value:function(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(He,e)}},{key:"disableLatencySim",value:function(){this.sessionStorage.removeItem(He)}},{key:"getLatencySim",value:function(){var e=this.sessionStorage.getItem(He);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:"execJS",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.owner(e,(function(i){return At.exec(n,t,i,e)}))}},{key:"triggerDOM",value:function(e,t){var n;(n=this.domCallbacks)[e].apply(n,J(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=q(n(),2),r=i[0],o=i[1];this.viewLogger(e,t,r,o)}else if(this.isDebugEnabled()){var a=q(n(),2);!function(e,t,n,i){e.liveSocket.isDebugEnabled()&&console.log("".concat(e.id," ").concat(t,": ").concat(n," - "),i)}(e,t,a[0],a[1])}}},{key:"requestDOMUpdate",value:function(e){this.transitions.after(e)}},{key:"transition",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};this.transitions.addTransition(e,t,n)}},{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,t,n){var i=this,r=this.getLatencySim(),o=e.joinCount;if(!r)return t.timeout?n().receive("timeout",(function(){e.joinCount!==o||e.isDestroyed()||i.reloadWithJitter(e,(function(){i.log(e,"timeout",(function(){return["received timeout while communicating with server. Falling back to hard refresh for recovery"]}))}))})):n();console.log("simulating ".concat(r,"ms of latency from client to server"));var a={receives:[],receive:function(e,t){this.receives.push([e,t])}};return setTimeout((function(){e.isDestroyed()||a.receives.reduce((function(e,t){var n=q(t,2),i=n[0],r=n[1];return e.receive(i,r)}),n())}),r),a}},{key:"reloadWithJitter",value:function(e,t){var n=this;e.destroy(),this.disconnect();var i=this.reloadJitterMin,r=this.reloadJitterMax,o=Math.floor(Math.random()*(r-i+1))+i,a=it.updateLocal(this.localStorage,window.location.pathname,Q,0,(function(e){return e+1}));t?t():this.log(e,"join",(function(){return["encountered ".concat(a," consecutive reloads")]})),a>this.maxReloads&&(this.log(e,"join",(function(){return["exceeded ".concat(n.maxReloads," consecutive reloads. Entering failsafe mode")]})),o=this.failsafeJitter),setTimeout((function(){n.hasPendingLink()?window.location=n.pendingLink:window.location.reload()}),o)}},{key:"getHookCallbacks",value:function(e){return e&&e.startsWith("Phoenix.")?ct[e.split(".")[1]]: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 ot.all(document,"".concat(Ae,":not([").concat(ge,"])"),(function(n){if(!e.getRootById(n.id)){var i=e.newRootView(n);i.setHref(e.getHref()),i.join(),n.getAttribute(ye)&&(e.main=i)}t=!0})),t}},{key:"redirect",value:function(e,t){this.disconnect(),it.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,a=ot.cloneNode(o,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(a,t),this.main.setRedirect(e),this.transitionRemoves(),this.main.join((function(e,t){1===e&&n.commitPendingLink(r)&&n.requestDOMUpdate((function(){ot.findPhxSticky(document).forEach((function(e){return a.appendChild(e)})),o.replaceWith(a),i&&i(),t()}))}))}},{key:"transitionRemoves",value:function(e){var t=this,n=this.binding("remove");(e=e||ot.all(document,"[".concat(n,"]"))).forEach((function(e){document.body.contains(e)&&t.execJS(e,e.getAttribute(n),"remove")}))}},{key:"isPhxView",value:function(e){return e.getAttribute&&null!==e.getAttribute(Ce)}},{key:"newRootView",value:function(e,t){var n=new Pt(e,this,null,t);return this.roots[n.id]=n,n}},{key:"owner",value:function(e,t){var n=this,i=et(e.closest(Ae),(function(e){return n.getViewByEl(e)}))||this.main;i&&t(i)}},{key:"withinOwners",value:function(e,t){this.owner(e,(function(n){return t(n,e)}))}},{key:"getViewByEl",value:function(e){var t=e.getAttribute(be);return et(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(be));t&&t.id===e.id?(t.destroy(),delete this.roots[t.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,this.socket.onClose((function(t){1e3===t.code&&e.main&&e.reloadWithJitter(e.main)})),document.body.addEventListener("click",(function(){})),window.addEventListener("pageshow",(function(t){t.persisted&&(e.getSocket().disconnect(),e.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())}),!0),this.bindNav(),this.bindClicks(),this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(function(t,n,i,r,o,a){var s=r.getAttribute(e.binding("key")),u=t.key&&t.key.toLowerCase();if(!s||s.toLowerCase()===u){var c=F({key:t.key},e.eventMeta(n,t,r));At.exec(n,o,i,r,["push",{data:c}])}})),this.bind({blur:"focusout",focus:"focusin"},(function(t,n,i,r,o,a){if(!a){var s=F({key:t.key},e.eventMeta(n,t,r));At.exec(n,o,i,r,["push",{data:s}])}})),this.bind({blur:"blur",focus:"focus"},(function(t,n,i,r,o,a,s){if("window"===s){var u=e.eventMeta(n,t,r);At.exec(n,a,i,r,["push",{data:u}])}})),window.addEventListener("dragover",(function(e){return e.preventDefault()})),window.addEventListener("drop",(function(t){t.preventDefault();var n=et($e(t.target,e.binding(se)),(function(t){return t.getAttribute(e.binding(se))})),i=n&&document.getElementById(n),r=Array.from(t.dataTransfer.files||[]);i&&!i.disabled&&0!==r.length&&i.files instanceof FileList&&(ut.trackFiles(i,r),i.dispatchEvent(new Event("input",{bubbles:!0})))})),this.on(re,(function(e){var t=e.target;if(ot.isUploadInput(t)){var n=Array.from(e.detail.files||[]).filter((function(e){return e instanceof File||e instanceof Blob}));ut.trackFiles(t,n),t.dispatchEvent(new Event("input",{bubbles:!0}))}})))}},{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){t(e,i,n,e.target,a,null)}))})):ot.all(document,"[".concat(o,"]"),(function(r){var a=r.getAttribute(o);n.debounce(r,e,(function(){n.withinOwners(r,(function(n){t(e,i,n,r,a,"window")}))}))}))}))};for(var r in e)i(r)}},{key:"bindClicks",value:function(){this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}},{key:"bindClick",value:function(e,t,n){var i=this,r=this.binding(t);window.addEventListener(e,(function(e){if(i.isConnected()){i.clickRef++;var t=i.clickRef,o=null;n?o=e.target.matches("[".concat(r,"]"))?e.target:e.target.querySelector("[".concat(r,"]")):(o=$e(e.target,r),i.dispatchClickAway(e,t));var a=o&&o.getAttribute(r);a&&("#"===o.getAttribute("href")&&e.preventDefault(),i.debounce(o,e,(function(){i.withinOwners(o,(function(t){At.exec("click",a,t,o,["push",{data:i.eventMeta("click",e,o)}])}))})))}}),n)}},{key:"dispatchClickAway",value:function(e,t){var n=this,i=this.binding("click-away"),r=this.binding("click");ot.all(document,"[".concat(i,"]"),(function(t){t.isSameNode(e.target)||t.contains(e.target)||n.withinOwners(e.target,(function(o){var a=t.getAttribute(i);if(At.isVisible(t)){e.target.closest("[".concat(r,"]"))||e.target;At.exec("click",a,o,t,["push",{data:n.eventMeta("click",e,e.target)}])}}))}))}},{key:"bindNav",value:function(){var e=this;if(it.canPushState()){history.scrollRestoration&&(history.scrollRestoration="manual");var t=null;window.addEventListener("scroll",(function(e){clearTimeout(t),t=setTimeout((function(){it.updateCurrentState((function(e){return Object.assign(e,{scroll:window.scrollY})}))}),100)})),window.addEventListener("popstate",(function(t){if(e.registerNewLocation(window.location)){var n=t.state||{},i=n.type,r=n.id,o=n.root,a=n.scroll,s=window.location.href;e.requestDOMUpdate((function(){e.main.isConnected()&&"patch"===i&&r===e.main.id?e.main.pushLinkPatch(s,null):e.replaceMain(s,null,(function(){o&&e.replaceRootHistory(),"number"==typeof a&&setTimeout((function(){window.scrollTo(0,a)}),0)}))}))}}),!1),window.addEventListener("click",(function(t){var n=$e(t.target,te),i=n&&n.getAttribute(te),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");t.preventDefault(),e.pendingLink!==o&&e.requestDOMUpdate((function(){if("patch"===i)e.pushHistoryPatch(o,a,n);else{if("redirect"!==i)throw new Error("expected ".concat(te,' to be "patch" or "redirect", got: ').concat(i));e.historyRedirect(o,a)}}))}}),!1)}}},{key:"dispatchEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ot.dispatchEvent(window,"phx:".concat(e),t)}},{key:"dispatchEvents",value:function(e){var t=this;e.forEach((function(e){var n=q(e,2),i=n[0],r=n[1];return t.dispatchEvent(i,r)}))}},{key:"withPageLoading",value:function(e,t){ot.dispatchEvent(window,"phx:page-loading-start",e);var n=function(){return ot.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(n){i.historyPatch(e,t,n),r()}))}))}},{key:"historyPatch",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.setPendingLink(e);this.commitPendingLink(n)&&(it.pushState(t,{type:"patch",id:this.main.id},e),this.registerNewLocation(window.location))}},{key:"historyRedirect",value:function(e,t,n){var i=this,r=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},(function(o){i.replaceMain(e,n,(function(){it.pushState(t,{type:"redirect",id:i.main.id,scroll:r},e),i.registerNewLocation(window.location),o()}))}))}},{key:"replaceRootHistory",value:function(){it.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=Xe(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){At.exec("submit",n,e,t.target,["push",{}])})))}),!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=ot.private(r,"prev-iteration")||{},u=s.at,c=s.type;u===a-1&&n!==c||(ot.putPrivate(r,"prev-iteration",{at:a,type:n}),e.debounce(r,i,(function(){e.withinOwners(r.form,(function(t){ot.putPrivate(r,we,!0),ot.isTextualInput(r)||e.setActiveElement(r),At.exec("change",o,t,r,["push",{_target:i.target.name}])}))})))}}),!1)},i=0,r=["change","input"];i1;)r=o?n+i>>1:Ft((n+i)/2),t[r]0?(c=0,l=2*t):t<0&&(l=0,c=2*e):(l-t=0&&c<0&&(c=0),t<=0&&l>0&&(l=0))),[c,l]}const Ht=Math,Ut=Ht.abs,Ft=Ht.floor,Bt=Ht.round,Yt=Ht.ceil,Jt=Ht.min,Wt=Ht.max,qt=Ht.pow,zt=Ht.log10,Vt=Ht.PI,Gt=1/0;function Kt(e,t){return Bt(e/t)*t}function Xt(e,t,n){return Jt(Wt(e,t),n)}function $t(e){return"function"==typeof e?e:()=>e}function Qt(e,t){return Yt(e/t)*t}function Zt(e){return Bt(1e3*e)/1e3}function en(e){return Bt(1e6*e)/1e6}const tn=Array.isArray;function nn(e){return"object"==typeof e&&null!==e}function rn(e){let t;if(tn(e))t=e.map(rn);else if(nn(e))for(var n in t={},e)t[n]=rn(e[n]);else t=e;return t}function on(e){let t=arguments;for(let n=1;ne.getFullYear(),YY:e=>(e.getFullYear()+"").slice(2),MMMM:(e,t)=>t.MMMM[e.getMonth()],MMM:(e,t)=>t.MMM[e.getMonth()],MM:e=>Un(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>Un(e.getDate()),D:e=>e.getDate(),WWWW:(e,t)=>t.WWWW[e.getDay()],WWW:(e,t)=>t.WWW[e.getDay()],HH:e=>Un(e.getHours()),H:e=>e.getHours(),h:e=>{let t=e.getHours();return 0==t?12:t>12?t-12:t},AA:e=>e.getHours()>=12?"PM":"AM",aa:e=>e.getHours()>=12?"pm":"am",a:e=>e.getHours()>=12?"p":"a",mm:e=>Un(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>Un(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>{return((t=e.getMilliseconds())<10?"00":t<100?"0":"")+t;var t}};function Bn(e,t){t=t||Hn;let n,i=[],r=/\{([a-z]+)\}|[^{]+/gi;for(;n=r.exec(e);)i.push("{"==n[0][0]?Fn[n[1]]:n[0]);return e=>{let n="";for(let r=0;r[e[0],t(e[1]),e[2],t(e[4]?e[1]+e[3]:e[3])]))}const ei="{YYYY}",ti="\n"+ei,ni="{M}/{D}",ii="\n"+ni,ri="{aa}",oi="{h}:{mm}"+ri,ai=":{ss}",si=[[$n,ei,7,"",1],[28*Kn,"{MMM}",7,ti,1],[Kn,ni,7,ti,1],[Gn,"{h}"+ri,4,ii,1],[Vn,oi,4,ii,1],[1,ai,2,ii+" "+oi,1],[.001,ai+".{fff}",2,ii+" "+oi,1]];function ui(e,t){return(n,i,r,o)=>{let a=t.find((e=>o>=e[0]))||t[t.length-1],s=null,u=null,c=null;return i.map(((t,n)=>{let i=e(t),r=i.getFullYear(),o=i.getDate(),l=i.getMinutes(),h=r!=s,f=o!=u,d=l!=c,v=7==a[2]&&h||4==a[2]&&f||2==a[2]&&d?a[3]:a[1];return s=r,u=o,c=l,v(i)}))}}function ci(e,t,n){return new Date(e,t,n)}function li(e,t){return t(e)}function hi(e,t){return(n,i)=>t(e(i))}const fi={show:!0,x:!0,y:!0,lock:!1,points:{show:function(e,t){let n=e.series[t],i=Pn();i.style.background=n.stroke||fn;let r=xi(n.width,1),o=(r-1)/-2;return An(i,an,r),An(i,sn,r),An(i,"marginLeft",o),An(i,"marginTop",o),i}},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,_x:!1,_y:!1},focus:{prox:-1},locked:!1,left:-10,top:-10,idx:null},di={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},vi=on({},di,{size:10}),pi='12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',mi="bold "+pi,gi={type:"x",show:!0,scale:"x",space:50,gap:5,size:50,labelSize:30,labelFont:mi,side:2,grid:di,ticks:vi,font:pi,rotate:0},yi={show:!0,scale:"x",min:Gt,max:-Gt,idxs:[]};let bi=new Intl.NumberFormat(navigator.language);function ki(e,t,n,i){return t.map(bi.format)}function wi(e,t,n,i,r,o){let a=[];for(let e=t=o?t:+Qt(t,i).toFixed(12);e<=n;e=+(e+i).toFixed(12))a.push(e);return a}function Ei(e,t){return t}const Si={type:"y",show:!0,scale:"y",space:40,gap:5,size:50,labelSize:30,labelFont:mi,side:3,grid:di,ticks:vi,font:pi,rotate:0};function xi(e,t){return Zt((3+2*(e||1))*t)}const Ci={scale:"y",show:!0,band:!1,spanGaps:!1,alpha:1,points:{show:function(e,t){const n=xi(e.series[t].width,xn);let i=e.bbox.width/n/2,r=e.series[0].idxs;return r[1]-r[0]<=i}},values:null,min:Gt,max:-Gt,idxs:[],path:null,clip:null},Ai={time:!0,auto:!1,distr:1,min:null,max:null},Ti=on({},Ai,{time:!1,auto:!0}),Pi={};function _i(e){let t=[];return{sub(e){t.push(e)},unsub(e){t=t.filter((t=>t!=e))},pub(e,n,i,r,o,a,s){t.length>1&&t.forEach((t=>{t!=n&&t.pub(e,n,i,r,o,a,s)}))}}}function Di(e,t,n,i){return(i?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map(((e,i)=>Li(e,i,t,n)))}function Li(e,t,n,i){return on({},0==t||e&&e.side%2==0?n:i,e)}function Ri(e,t,n,i){return i+(1-(e-t.min)/(t.max-t.min))*n}function Mi(e,t,n,i){return i+(e-t.min)/(t.max-t.min)*n}function Oi(e,t,n){return[t,n>t?n:n+86400]}function Ii(e,t,n){const i=n-t;if(0==i){const e=zt(i||Ut(n)||1),r=Ft(e)+1;return[t,Qt(n,qt(10,r))]}return[t,n]}function ji(e,t,n){return Nt(t,n,.2,!0)}function Ni(e){return 0==e.button}function Hi(e){let t;return[e=e.replace(/\d+/,(e=>t=Bt(e*xn))),t]}function Ui(e,t,n){const i={},r=i.root=Pn("uplot");if(null!=e.id&&(r.id=e.id),Cn(r,e.class),e.title){Pn("title",r).textContent=e.title}const o=Tn("canvas"),a=i.ctx=o.getContext("2d"),s=Pn("wrap",r),u=Pn("under",s);s.appendChild(o);const c=Pn("over",s);((e=rn(e)).plugins||[]).forEach((t=>{t.opts&&(e=t.opts(i,e)||e)}));let l=!1;const h=i.series=Di(e.series||[],yi,Ci,!1),f=i.axes=Di(e.axes||[],gi,Si,!0),d=i.scales=on({},{x:Ai,y:Ti},e.scales),v=on({x:Bt(Si.size/2),y:Bt(gi.size/3)},e.gutters),p=e.tzDate||(e=>new Date(1e3*e)),m=e.fmtDate||Bn,g=function(e){return(t,n,i,r,o)=>{let a=[],s=r>=Xn&&r<$n,u=e(n),c=u/1e3,l=ci(u.getFullYear(),u.getMonth(),s?1:u.getDate()),h=l/1e3;if(s){let t=r/Xn,n=c==h?c:ci(l.getFullYear(),l.getMonth()+t,1)/1e3,o=new Date(1e3*n),s=o.getFullYear(),u=o.getMonth();for(let r=0;n<=i;r++){let o=ci(s,u+t*r,1),c=o-e(o/1e3);n=(+o+c)/1e3,n<=i&&a.push(n)}}else{let t=r>=Kn?Kn:r,s=h+(Ft(n)-Ft(c))+Qt(c-h,t);a.push(s);let u=e(s),l=u.getHours()+u.getMinutes()/Vn+u.getSeconds()/Gn,f=r/Gn;for(;;){s=Zt(s+r);let t=Ft(en(l+f))%24,n=e(s).getHours()-t;if(n>1&&(n=-1),s-=n*Gn,s>i)break;l=(l+f)%24,Zt((s-a[a.length-1])/r)*o>=.7&&a.push(s)}}return a}}(p),y=ui(p,Zn(si,m)),b=hi(p,li("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",m)),k={};for(let e in d){let t=d[e];null==t.min&&null==t.max||(k[e]={min:t.min,max:t.max})}const w=on({show:!0},e.legend).show;let E,S,x=[],C=!1;if(w){E=Tn("table","legend",r);const e=h[1]?h[1].values:null;if(C=null!=e,C){let t=Tn("tr","labels",E);for(var A in Tn("th",null,t),S=e(i,1,0),S)Tn("th",null,t).textContent=A}else S={_:0},Cn(E,"inline")}const T=i.cursor=on({},fi,e.cursor);T.points.show=$t(T.points.show);const P=i.focus=on({},e.focus||{alpha:.3},T.focus),_=P.prox>=0;let D=[null];function L(e,t){const n=e.scale,r=d[n]=on({},0==t?Ai:Ti,d[n]);let o=r.time;r.range=$t(r.range||(o?Oi:0==t?Ii:ji));let a=e.value;if(e.value=o?"string"==typeof a?hi(p,li(a,m)):a||b:a||Ei,e.label=e.label||(o?"Time":"Value"),t>0){e.width=null==e.width?1:e.width,e.paths=e.paths||le;let t=xi(e.width,1);e.points=on({},{size:t,width:Wt(1,.2*t)},e.points),e.points.show=$t(e.points.show),e._paths=null}if(w&&x.splice(t,0,function(e,t){if(0==t&&C)return null;let n=[],i=Tn("tr","series",E,E.childNodes[t]);Cn(i,e.class),e.show||Cn(i,"off");let r=Tn("th",null,i),o=Pn("ident",r);e.width&&(o.style.borderColor=e.stroke),o.style.backgroundColor=e.fill;let a=Pn("text",r);for(var s in a.textContent=e.label,t>0&&(Ln("click",r,(t=>{T.locked||Ni(t)&&Ce(h.indexOf(e),{show:!e.show},$e.setSeries)})),_&&Ln(mn,r,(t=>{T.locked||Ce(h.indexOf(e),{focus:!0},$e.setSeries)}))),S){let e=Tn("td",null,i);e.textContent="--",n.push(e)}return n}(e,t)),T.show){let n=function(e,t){if(t>0){let n=T.points.show(i,t);if(n)return Cn(n,"cursor-pt"),Cn(n,e.class),_n(n,-10,-10),c.insertBefore(n,D[t]),n}}(e,t);n&&D.splice(t,0,n)}}i.addSeries=function(e,t){e=Li(e,t=null==t?h.length:t,yi,Ci),h.splice(t,0,e),L(h[t],t)},i.delSeries=function(e){h.splice(e,1),w&&x.splice(e,1)[0][0].parentNode.remove(),D.length>1&&D.splice(e,1)[0].remove()},h.forEach(L);for(let e in d){let t=d[e];null!=t.from&&(d[e]=on({},d[t.from],t))}const R=h[0].scale,M=d[R].distr;let O;f.forEach((function(e,t){if(e.show){let t=e.side%2,n=d[e.scale];null==n&&(e.scale=t?h[1].scale:R,n=d[e.scale]);let i=n.time;e.space=$t(e.space),e.rotate=$t(e.rotate),e.incrs=$t(e.incrs||(2==n.distr?qn:i?Qn:zn)),e.split=$t(e.split||(i&&1==n.distr?g:wi));let r=e.values;e.values=i?tn(r)?ui(p,Zn(r,m)):r||y:r||ki,e.font=Hi(e.font),e.labelFont=Hi(e.labelFont)}}));let I=null,j=null;const N=h[0].idxs;let H,U,F,B,Y,J,W,q,z,V,G=null;function K(e,n){(e=e||[])[0]=e[0]||[],i.data=e,t=e.slice(),G=t[0],O=G.length,2==M&&(t[0]=G.map(((e,t)=>t))),de(),Xe("setData"),!1!==n&&X()}function X(){I=N[0]=0,j=N[1]=O-1;let e=2==M?I:t[0][I],n=2==M?j:t[0][j];xe(R,e,n)}function $(e,t,n,i){a.strokeStyle=e||fn,a.lineWidth=t,a.lineJoin="round",a.setLineDash(n||[]),a.fillStyle=i||fn}function Q(e,t){i.width=H=F=e,i.height=U=B=t,Y=J=0,function(){let e=!1,t=!1,n=!1,i=!1;f.forEach(((r,o)=>{if(r.show){let{side:o,size:a}=r,s=o%2,u=a+(r.labelSize=null!=r.label?r.labelSize||30:0);u>0&&(s?(F-=u,3==o?(Y+=u,i=!0):n=!0):(B-=u,0==o?(J+=u,e=!0):t=!0))}})),(e||t)&&(n||(F-=v.x),i||(F-=v.x,Y+=v.x));(i||n)&&(t||(B-=v.y),e||(B-=v.y,J+=v.y))}(),function(){let e=Y+F,t=J+B,n=Y,i=J;function r(r,o){switch(r){case 1:return e+=o,e-o;case 2:return t+=o,t-o;case 3:return n-=o,n+o;case 0:return i-=o,i+o}}f.forEach(((e,t)=>{let n=e.side;e._pos=r(n,e.size),null!=e.label&&(e._lpos=r(n,e.labelSize))}))}();let n=i.bbox;W=n.left=Kt(Y*xn,.5),q=n.top=Kt(J*xn,.5),z=n.width=Kt(F*xn,.5),V=n.height=Kt(B*xn,.5),An(u,ln,Y),An(u,un,J),An(u,an,F),An(u,sn,B),An(c,ln,Y),An(c,un,J),An(c,an,F),An(c,sn,B),An(s,an,H),An(s,sn,U),o.width=Bt(H*xn),o.height=Bt(U*xn),Ue(),l&&xe(R,d[R].min,d[R].max),l&&Xe("setSize")}function Z(){if(Le)Me=!0;else{if(O>0){let e=rn(d);for(let t in e){let n=e[t],i=k[t];null!=i?(on(n,i),t==R&&de()):t!=R&&(n.min=Gt,n.max=-Gt)}h.forEach(((n,r)=>{let o=n.scale,a=e[o];if(0==r){let e=a.range(i,a.min,a.max);a.min=e[0],a.max=e[1],I=jt(a.min,t[0]),j=jt(a.max,t[0]),t[0][I]a.max&&j--,n.min=G[I],n.max=G[j]}else if(n.show&&null==k[o]){let e=n.min==Gt?a.auto?function(e,t,n){let i=Gt,r=-Gt;for(let o=t;o<=n;o++)null!=e[o]&&(i=Jt(i,e[o]),r=Wt(r,e[o]));return[i,r]}(t[r],I,j):[0,100]:[n.min,n.max];a.min=Jt(a.min,n.min=e[0]),a.max=Wt(a.max,n.max=e[1])}n.idxs[0]=I,n.idxs[1]=j}));for(let t in e){let n=e[t];if(null==n.from&&n.min!=Gt&&null==k[t]){let e=n.range(i,n.min,n.max);n.min=e[0],n.max=e[1]}}for(let t in e){let n=e[t];if(null!=n.from){let t=e[n.from];if(t.min!=Gt){let e=n.range(i,t.min,t.max);n.min=e[0],n.max=e[1]}}}let n={};for(let t in e){let i=e[t],r=d[t];r.min==i.min&&r.max==i.max||(r.min=i.min,r.max=i.max,n[t]=!0)}h.forEach((e=>{n[e.scale]&&(e._paths=null)}));for(let e in n)Xe("setScale",e)}for(let e in k)k[e]=null;T.show&&Ne()}}i.setData=K,i.bbox={},i.setSize=function({width:e,height:t}){Q(e,t)};let ee,te,ne,ie,re,oe,ae,se=1;function ue(){h.forEach(((e,n)=>{if(n>0&&e.show&&O>0&&null==e._paths){let r=function(e){let t=Xt(I-1,0,O-1),n=Xt(j+1,0,O-1);for(;null==e[t]&&t>0;)t--;for(;null==e[n]&&n{n>0&&e.show&&(e._paths&&function(e){const t=h[e];if(1==se){const{stroke:e,fill:n,clip:i}=t._paths,r=Zt(t.width*xn),o=r%2/2;$(t.stroke,r,t.dash,t.fill),a.globalAlpha=t.alpha,a.translate(o,o),a.save();let s=W,u=q,c=z,l=V,h=r*xn/2;0==t.min&&(l+=h),0==t.max&&(u-=h,l+=h),a.beginPath(),a.rect(s,u,c,l),a.clip(),null!=i&&a.clip(i),t.band?(a.fill(e),r&&a.stroke(e)):(r&&a.stroke(e),null!=t.fill&&a.fill(n)),a.restore(),a.translate(-o,-o),a.globalAlpha=1}t.band&&(se*=-1)}(n),e.points.show(i,n,I,j)&&function(e){let n=h[e],i=n.points;const r=Zt(i.width*xn),o=r%2/2,s=i.width>0;let u=(i.size-i.width)/2*xn,c=Zt(2*u);a.translate(o,o),a.save(),a.beginPath(),a.rect(W-c,q-c,z+2*c,V+2*c),a.clip(),a.globalAlpha=n.alpha;const l=new Path2D;for(let i=I;i<=j;i++)if(null!=t[e][i]){let r=Bt(Mi(t[0][i],d[R],z,W)),o=Bt(Ri(t[e][i],d[n.scale],V,q));l.moveTo(r+u,o),l.arc(r,o,u,0,2*Vt)}$(i.stroke||n.stroke||fn,r,null,i.fill||(s?"#fff":n.stroke||fn)),a.fill(l),s&&a.stroke(l),a.globalAlpha=1,a.restore(),a.translate(-o,-o)}(n),Xe("drawSeries",n))}))}function ce(e,t,n){let i=e[e.length-1];i&&i[0]==t?i[1]=n:e.push([t,n])}function le(e,n,i,r){const o=h[n],a=t[0],s=t[n],u=d[R],c=d[o.scale],l=1==se?{stroke:new Path2D,fill:null,clip:null}:h[n-1]._paths,f=l.stroke,v=Zt(o.width*xn);let p,m,g=Gt,y=-Gt,b=[],k=Bt(Mi(a[1==se?i:r],u,z,W));o.band&&1==se&&i==I&&(v&&f.lineTo(-v,Bt(Ri(s[i],c,V,q))),u.min=i&&e<=r;e+=se){let t=Bt(Mi(a[e],u,z,W));if(t==k)null!=s[e]&&(p=Bt(Ri(s[e],c,V,q)),g=Jt(p,g),y=Wt(p,y));else{let n=!1;g!=Gt?(f.lineTo(k,g),f.lineTo(k,y),f.lineTo(k,p),m=k):n=!0,null!=s[e]?(p=Bt(Ri(s[e],c,V,q)),f.lineTo(t,p),g=y=p,t-k>1&&null==s[e-1]&&(n=!0)):(g=Gt,y=-Gt),n&&ce(b,m,t),k=t}}if(null==s[r]&&ce(b,m,k),o.band){let e,t,n=100*v;-1==se&&i==I&&(t=W-n,e=i),1==se&&r==j&&(t=W+z+n,e=r,u.max>a[O-1]&&b.push([k,W+z])),f.lineTo(t,Bt(Ri(s[e],c,V,q)))}if(1==se&&(l.clip=function(e,t,n,i){let r=h[e],o=null;if(t.length>0){if(r.spanGaps){let e=t[0],r=t[t.length-1];t=[],n&&t.push(e),i&&t.push(r)}o=new Path2D;let e=W;for(let n=0;n=i)return[t[o],e]}}(n-t,e.incrs(i,t,n,r,a),r,a),o.push(o[1]/a)}return o}function fe(e,t,n,i,r,o,s,u){let c=o%2/2;a.translate(c,c),$(s,o,u),a.beginPath();let l,h,f,d,v=i+(0==n||3==n?-r:r);0==t?(h=i,d=v):(l=i,f=v),e.forEach(((e,n)=>{0==t?l=f=e:h=d=e,a.moveTo(l,h),a.lineTo(f,d)})),a.stroke(),a.translate(-c,-c)}function de(){h.forEach(((e,t)=>{t>0&&(e.min=Gt,e.max=-Gt,e._paths=null)}))}function ve(){Le?Re=!0:(a.clearRect(0,0,o.width,o.height),Xe("drawClear"),f.forEach(((e,t)=>{if(!e.show)return;let n=d[e.scale];if(n.min==Gt)return;let r=e.side,o=r%2,{min:s,max:u}=n,[c,l,h]=he(e,s,u,0==o?F:B),f=2==n.distr,v=e.split(i,s,u,c,h,f),p=0==o?Mi:Ri,m=0==o?z:V,g=0==o?W:q,y=v.map((e=>Bt(p(e,n,m,g)))),b=Bt(e.gap*xn),k=e.ticks,w=k.show?Bt(k.size*xn):0,E=e.values(i,2==n.distr?v.map((e=>G[e])):v,l,2==n.distr?G[v[1]]-G[v[0]]:c),S=2==r?e.rotate(i,E,l)*-Vt/180:0,x=Bt(e._pos*xn),C=x+(w+b)*(0==o&&0==r||1==o&&3==r?-1:1),A=0==o?C:0,T=1==o?C:0;a.font=e.font[0],a.fillStyle=e.stroke||fn,a.textAlign=S>0?ln:S<0?hn:0==o?"center":3==r?hn:ln,a.textBaseline=S||1==o?"middle":2==r?un:cn;let P=1.5*e.font[1];if(E.forEach(((e,t)=>{0==o?T=y[t]:A=y[t],(""+e).split(/\n/gm).forEach(((e,t)=>{S?(a.save(),a.translate(T,A+t*P),a.rotate(S),a.fillText(e,0,0),a.restore()):a.fillText(e,T,A+t*P)}))})),e.label){a.save();let t=Bt(e._lpos*xn);1==o?(T=A=0,a.translate(t,Bt(q+V/2)),a.rotate((3==r?-Vt:Vt)/2)):(T=Bt(W+z/2),A=t),a.font=e.labelFont[0],a.textAlign="center",a.textBaseline=2==r?un:cn,a.fillText(e.label,T,A),a.restore()}k.show&&fe(y,o,r,x,w,Zt(k.width*xn),k.stroke);let _=e.grid;_.show&&fe(y,o,0==o?2:1,0==o?q:W,0==o?V:z,Zt(_.width*xn),_.stroke,_.dash)})),Xe("drawAxes"),ue(),ee=!0,Xe("draw"))}function pe(e,n){let i=d[e];if(null==i.from){if(e==R&&(2==i.distr&&(n.min=jt(n.min,t[0]),n.max=jt(n.max,t[0])),i.time&&f[0].show&&n.max>n.min)){if(he(f[0],n.min,n.max,F)[0]<.001)return}k[e]=n,ee=!1,Z(),!ee&&ve(),ee=!1}}i.redraw=e=>{!1!==e?xe(R,d[R].min,d[R].max):ve()},i.setScale=pe;let me=!1;const ge=T.drag;let ye=ge.x,be=ge.y;if(T.show){let e="cursor-";T.x&&(oe=T.left,te=Pn(e+"x",c)),T.y&&(ae=T.top,ne=Pn(e+"y",c))}const ke=i.select=on({show:!0,left:0,width:0,top:0,height:0},e.select),we=ke.show?Pn("select",c):null;function Ee(e,t){if(ke.show){for(let t in e)An(we,t,ke[t]=e[t]);!1!==t&&Xe("setSelect")}}function Se(e,t){let n=h[e],i=w?x[e][0].parentNode:null;var r;n.show?i&&(r="off",i.classList.remove(r)):(i&&Cn(i,"off"),D.length>1&&_n(D[e],0,-10))}function xe(e,t,n){pe(e,{min:t,max:n})}function Ce(e,t,n){let r=h[e];if(null!=t.focus&&function(e){e!=Pe&&(h.forEach(((t,n)=>{!function(e,t){let n=h[e];if(Ae(e,t),n.band){Ae(h[e+1].band?e+1:e-1,t)}}(n,null==e||0==n||n==e?1:P.alpha)})),Pe=e,ve())}(e),null!=t.show){if(r.show=t.show,Se(e,t.show),r.band){let n=h[e+1]&&h[e+1].band?e+1:e-1;h[n].show=r.show,Se(n,t.show)}xe(R,d[R].min,d[R].max)}Xe("setSeries",e,t),n&&Ze.pub("setSeries",i,e,t)}function Ae(e,t){h[e].alpha=t,x&&(x[e][0].parentNode.style.opacity=t)}i.setSelect=Ee,i.setSeries=Ce;const Te=Array(h.length);let Pe=null;function _e(e,t){let n=F;t!=R&&(n=B,e=n-e);let i=e/n,r=d[t],o=r.max-r.min;return r.min+i*o}function De(e){return jt(_e(e,R),t[0],I,j)}w&&_&&Ln(gn,E,(e=>{T.locked||(Ce(null,{focus:!1},$e.setSeries),Ne())})),i.valToIdx=e=>jt(e,t[0]),i.posToIdx=De,i.posToVal=_e,i.valToPos=(e,t,n)=>t==R?Mi(e,d[t],n?z:F,n?W:0):Ri(e,d[t],n?V:B,n?q:0);let Le=!1,Re=!1,Me=!1,Oe=!1;function Ie(e){Le=!0,e(i),Le=!1,Me&&Z(),Oe&&Ne(),Re&&!ee&&ve(),Me=Oe=Re=ee=Le}i.batch=Ie,i.setCursor=e=>{oe=e.left,ae=e.top,Ne()};let je=0;function Ne(e,n){if(Le)return void(Oe=!0);let r;if(je=0,T.show&&(T.x&&_n(te,Bt(oe),0),T.y&&_n(ne,0,Bt(ae))),oe<0||0==O||I>j){r=null;for(let e=0;e0&&(Te[e]=Gt,D.length>1&&_n(D[e],-10,-10)),w){if(0==e&&C)continue;for(let t=0;t0&&o.show){let i=t[e][r],a=null==i?-10:Zt(Ri(i,d[o.scale],B,0));Te[e]=a>0?Ut(a-ae):Gt,D.length>1&&_n(D[e],n,a)}else Te[e]=Gt;if(w){if(r==T.idx||0==e&&C)continue;let n=0==e&&2==M?G:t[e],a=C?o.values(i,e,r):{_:o.value(i,n[r],e,r)},s=0;for(let t in a)x[e][s++].firstChild.nodeValue=a[t]}}}if(ke.show&&me){let e=Ut(oe-ie),t=Ut(ae-re);if(null!=n){let[e,t]=$e.scales,i=n.cursor.drag;if(ye=i._x,be=i._y,e){let i=d[e],r=n.posToVal(n.select.left,e),o=n.posToVal(n.select.left+n.select.width,e);ke.left=Mi(r,i,F,0),ke.width=Ut(ke.left-Mi(o,i,F,0)),An(we,ln,ke.left),An(we,an,ke.width),t||(An(we,un,ke.top=0),An(we,sn,ke.height=B))}if(t){let i=d[t],r=n.posToVal(n.select.top,t),o=n.posToVal(n.select.top+n.select.height,t);ke.top=Ri(r,i,B,0),ke.height=Ut(ke.top-Ri(o,i,B,0)),An(we,un,ke.top),An(we,sn,ke.height),e||(An(we,ln,ke.left=0),An(we,an,ke.width=F))}}else{ye=ge.x&&e>=ge.dist,be=ge.y&&t>=ge.dist;let n=ge.uni;if(null!=n?ye&&be&&(ye=e>=n,be=t>=n,ye||be||(t>e?be=!0:ye=!0)):ge.x&&ge.y&&(ye||be)&&(ye=be=!0),ye){let t=Jt(ie,oe);An(we,ln,ke.left=t),An(we,an,ke.width=e),be||(An(we,un,ke.top=0),An(we,sn,ke.height=B))}if(be){let e=Jt(re,ae);An(we,un,ke.top=e),An(we,sn,ke.height=t),ye||(An(we,ln,ke.left=0),An(we,an,ke.width=F))}ye||be||(An(we,sn,ke.height=0),An(we,an,ke.width=0))}}if(T.idx=r,T.left=oe,T.top=ae,ge._x=ye,ge._y=be,null!=e&&(Ze.pub(dn,i,oe,ae,F,B,r),_)){let e=Jt.apply(null,Te),t=null;e<=P.prox&&Te.some(((n,i)=>{if(n==e)return t=i})),Ce(t,{focus:!0},$e.setSeries)}l&&Xe("setCursor")}let He=null;function Ue(){He=c.getBoundingClientRect()}function Fe(e,t,n,i,r,o,a){T.locked||(Be(e,t,n,i,r,o,a,!1,null!=e),null!=e?0==je&&(je=wn(Ne)):Ne(null,t))}function Be(e,t,n,i,r,o,a,s,u){if(null!=e)n=e.clientX-He.left,i=e.clientY-He.top;else{if(n<0||i<0)return oe=-10,void(ae=-10);let[e,a]=$e.scales;n=null!=e?Mi(t.posToVal(n,e),d[e],F,0):F*(n/r),i=null!=a?Ri(t.posToVal(i,a),d[a],B,0):B*(i/o)}u&&((n<=1||n>=F-1)&&(n=Kt(n,F)),(i<=1||i>=B-1)&&(i=Kt(i,B))),s?(ie=n,re=i):(oe=n,ae=i)}function Ye(){Ee({width:0,height:0},!1)}function Je(e,t,n,r,o,a,s){(null!=t||Ni(e))&&(me=!0,ye=be=ge._x=ge._y=!1,Be(e,t,n,r,o,a,0,!0,!1),null!=e&&(Ln(pn,En,We),Ze.pub(vn,i,ie,re,F,B,null)))}function We(e,t,n,r,o,a,s){if(null!=t||Ni(e)){me=ge._x=ge._y=!1,Be(e,t,n,r,o,a,0,!1,!0);let i=ke.width>0||ke.height>0;i&&Ee(ke),ge.setScale&&i?(Ie((()=>{if(ye&&xe(R,_e(ke.left,R),_e(ke.left+ke.width,R)),be)for(let e in d){let t=d[e];e!=R&&null==t.from&&xe(e,_e(ke.top+ke.height,e),_e(ke.top,e))}})),Ye()):T.lock&&(T.locked=!T.locked,T.locked||Ne())}null!=e&&(Rn(pn,En,We),Ze.pub(pn,i,oe,ae,F,B,null))}function qe(e,t,n,i,r,o,a){if(!T.locked){let e=me;if(me){let e=!0,t=!0,n=10;if(ye&&be&&(e=oe<=n||oe>=F-n,t=ae<=n||ae>=B-n),ye&&e){let e=oe,t=F-oe,n=Jt(e,t);n==e&&(oe=0),n==t&&(oe=F)}if(be&&t){let e=ae,t=B-ae,n=Jt(e,t);n==e&&(ae=0),n==t&&(ae=B)}Ne(1),me=!1}oe=-10,ae=-10,Ne(1),e&&(me=e)}}function ze(e,t,n,r,o,a,s){X(),Ye(),null!=e&&Ze.pub(yn,i,oe,ae,F,B,null)}const Ve={};let Ge;Ve.mousedown=Je,Ve.mousemove=Fe,Ve.mouseup=We,Ve.dblclick=ze,Ve.setSeries=(e,t,n,i)=>{Ce(n,i)},T.show&&(Ln(vn,c,Je),Ln(dn,c,Fe),Ln(mn,c,Ue),Ln(gn,c,(e=>{wn(qe)})),Ln(yn,c,ze),Ge=function(e,t){let n=null;function i(){n=null,e()}return function(){clearTimeout(n),n=setTimeout(i,t)}}(Ue,100),Ln(bn,Sn,Ge),Ln(kn,Sn,Ge),i.syncRect=Ue);const Ke=i.hooks=e.hooks||{};function Xe(e,t,n){e in Ke&&Ke[e].forEach((e=>{e.call(null,i,t,n)}))}(e.plugins||[]).forEach((e=>{for(let t in e.hooks)Ke[t]=(Ke[t]||[]).concat(e.hooks[t])}));const $e=on({key:null,setSeries:!1,scales:[R,null]},T.sync),Qe=$e.key,Ze=null!=Qe?Pi[Qe]=Pi[Qe]||_i():_i();function et(){Q(e.width,e.height),Xe("init",e,t),K(t||e.data,!1),k[R]?pe(R,k[R]):X(),Ee(ke,!1),l=!0,Xe("ready")}return Ze.sub(i),i.pub=function(e,t,n,i,r,o,a){Ve[e](null,t,n,i,r,o,a)},i.destroy=function(){Ze.unsub(i),Rn(bn,Sn,Ge),Rn(kn,Sn,Ge),r.remove(),Xe("destroy")},n?n instanceof HTMLElement?(n.appendChild(r),et()):n(i,et):et(),i}Ui.assign=on,Ui.rangeNum=Nt,Ui.fmtDate=Bn,Ui.tzDate=function(e,t){let n;return"Etc/UTC"==t?n=new Date(+e+6e4*e.getTimezoneOffset()):(n=new Date(e.toLocaleString("en-US",{timeZone:t})),n.setMilliseconds(e.getMilliseconds())),n};var Fi=Ui;function Bi(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Ji(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wi(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:0;return Vi({},It(t),{},Ki(e),{label:e.label,spanGaps:!0,points:{show:!1}})},er=function(e){return e.slice(0).map((function(e){return e.data}))};function tr(e,t){var n=e.y,i=e.z;this.datasets[0].data.push(i);var r=this.datasets[1].data[this.datasets[1].data.length-1]||0,o=t.call(this,n,r);this.datasets[1].data.push(o)}var nr=function(e){return e.reduceRight((function(e,t){return null!=t&&null==e?t:e}),null)};function ir(e,t){var n=this,i=e.x,r=e.y,o=e.z,a=this.datasets.findIndex((function(e){var t=e.key;return i===t}));-1===a&&(a=this.datasets.push({key:i,data:Array(this.datasets[0].data.length).fill(null)})-1,this.chart.addSeries(Zi({label:i,unit:this.options.unit},a-1),a)),this.datasets=this.datasets.map((function(e,i){return 0===i?e.data.push(o):i===a?e.data.push(t.call(n,r,nr(e.data)||0)):e.data.push(null),e}))}var rr,or=function(e){var t=e.pruneThreshold;return void 0===t?1e3:t},ar=function(){function e(t,n){Ji(this,e),this.__callback=this.constructor.__projections()[n.metric],this.chart=t,this.datasets=[{key:"|x|",data:[]}],this.options=n,this.pruneThreshold=or(n),n.tagged?(this.chart.delSeries(1),this.__handler=ir):(this.datasets.push({key:n.label,data:[]}),this.__handler=tr)}return qi(e,null,[{key:"__projections",value:function(){return{counter:function(e,t){return t+1},last_value:function(e){return e},sum:function(e,t){return t+e}}}},{key:"getConfig",value:function(e){return{class:e.kind,title:e.title,width:e.width,height:e.height,series:[Vi({},{value:"{YYYY}-{MM}-{DD} {HH}:{mm}:{ss}"}),Zi(e,0)],scales:{x:{min:e.now-60,max:e.now},y:{min:0,max:1}},axes:[{space:55,values:[[31536e3,"{YYYY}",7,"{YYYY}"],[2419200,"{MMM}",7,"{MMM}\n{YYYY}"],[86400,"{MM}-{DD}",7,"{MM}-{DD}\n{YYYY}"],[3600,"{HH}:{mm}",4,"{HH}:{mm}\n{YYYY}-{MM}-{DD}"],[60,"{HH}:{mm}",4,"{HH}:{mm}\n{YYYY}-{MM}-{DD}"],[1,"{ss}",2,"{HH}:{mm}:{ss}\n{YYYY}-{MM}-{DD}"]]},Xi(e)]}}},{key:"initialData",value:function(){return[[],[]]}}]),qi(e,[{key:"handleMeasurements",value:function(e){var t=this;e.forEach((function(e){return t.__handler.call(t,e,t.__callback)})),this.datasets[0].data.length>=this.pruneThreshold&&(this.datasets=this.datasets.map((function(e){var n=e.data,i=Yi(e,["data"]);return Vi({data:n.slice(-t.pruneThreshold)},i)}))),this.chart.setData(er(this.datasets))}}]),e}(),sr=function(){function e(t,n){Ji(this,e);var i=this.constructor.getConfig(t);i.series[1].values=this.__seriesValues.bind(this),this.datasets=[{key:"|x|",data:[]}],this.chart=new Fi(i,this.constructor.initialData(t),n),this.pruneThreshold=or(t),this.options=t,t.tagged?(this.chart.delSeries(1),this.__handler=this.handleTaggedMeasurement.bind(this)):(this.datasets.push(this.constructor.newDataset(t.label)),this.__handler=this.handleMeasurement.bind(this))}return qi(e,[{key:"handleMeasurements",value:function(e){var t=this;e.forEach((function(e){return t.__handler(e)})),this.__maybePruneDatasets(),this.chart.setData(er(this.datasets))}},{key:"handleTaggedMeasurement",value:function(e){var t=this.findOrCreateSeries(e.x);this.handleMeasurement(e,t)}},{key:"handleMeasurement",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=e.z;this.datasets=this.datasets.map((function(r,o){return"|x|"===r.key?r.data.push(i):o===n?t.pushToDataset(r,e):t.pushToDataset(r,null),r}))}},{key:"findOrCreateSeries",value:function(e){var t=this.datasets.findIndex((function(t){var n=t.key;return e===n}));if(-1===t){t=this.datasets.push(this.constructor.newDataset(e,this.datasets[0].data.length))-1;var n=Vi({values:this.__seriesValues.bind(this)},Zi({label:e},t-1));this.chart.addSeries(n,t)}return t}},{key:"pushToDataset",value:function(e,t){if(null===t)return e.data.push(null),e.agg.avg.push(null),e.agg.max.push(null),void e.agg.min.push(null);var n=t.y;return e.agg.count++,e.agg.total+=n,e.data.push(n),(null===e.last.min||ne.last.max)&&(e.last.max=n),e.agg.max.push(e.last.max),e.agg.avg.push(e.agg.total/e.agg.count),e}},{key:"__maybePruneDatasets",value:function(){if(this.datasets[0].data.length>this.pruneThreshold){var e=-this.pruneThreshold;this.datasets=this.datasets.map((function(t){var n=t.key,i=t.data,r=t.agg,o=i.slice(e);if(!r)return{key:n,data:o};var a=r.avg,s=r.count,u=r.max,c=r.min,l=r.total,h=c.slice(e),f=u.slice(e);return{key:n,data:o,agg:{avg:a.slice(e),count:s,min:h,max:f,total:l},last:{min:nr(h),max:nr(f)}}}))}}},{key:"__seriesValues",value:function(e,t,n){var i=this.datasets[t];if(i&&i.data&&i.data[n]){var r=i.agg,o=r.avg,a=r.max,s=r.min;return{Value:i.data[n].toFixed(3),Min:s[n].toFixed(3),Max:a[n].toFixed(3),Avg:o[n].toFixed(3)}}return{Value:"--",Min:"--",Max:"--",Avg:"--"}}}],[{key:"initialData",value:function(){return[[],[]]}},{key:"getConfig",value:function(e){return{class:e.kind,title:e.title,width:e.width,height:e.height,series:[Vi({},{value:"{YYYY}-{MM}-{DD} {HH}:{mm}:{ss}"}),Zi(e,0)],scales:{x:{min:e.now-60,max:e.now},y:{min:0,max:1}},axes:[{space:55,values:[[31536e3,"{YYYY}",7,"{YYYY}"],[2419200,"{MMM}",7,"{MMM}\n{YYYY}"],[86400,"{MM}-{DD}",7,"{MM}-{DD}\n{YYYY}"],[3600,"{HH}:{mm}",4,"{HH}:{mm}\n{YYYY}-{MM}-{DD}"],[60,"{HH}:{mm}",4,"{HH}:{mm}\n{YYYY}-{MM}-{DD}"],[1,"{ss}",2,"{HH}:{mm}:{ss}\n{YYYY}-{MM}-{DD}"]]},Xi(e)]}}},{key:"newDataset",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=t>0?Array(t).fill(null):[];return{key:e,data:Bi(n),agg:{avg:Bi(n),count:0,max:Bi(n),min:Bi(n),total:0},last:{max:null,min:null}}}}]),e}(),ur={counter:ar,last_value:ar,sum:ar,summary:sr},cr=function(){function e(t,n){if(Ji(this,e),!n.metric)throw new TypeError("No metric type was provided");if(n.metric&&!ur[n.metric])throw new TypeError("No metric defined for type ".concat(n.metric));var i=ur[n.metric];i===sr?(this.metric=new sr(n,t),this.uplotChart=this.metric.chart):(this.uplotChart=new Fi(i.getConfig(n),i.initialData(n),t),this.metric=new i(this.uplotChart,n));var r=void 0!==n.refreshInterval;this._isBufferingData=r,this._buffer=[],this._timer=r?setInterval(this._flushToChart.bind(this),+n.refreshInterval):null}return qi(e,[{key:"clearTimers",value:function(){clearInterval(this._timer)}},{key:"resize",value:function(e){this.uplotChart.setSize({width:Math.max(e.width,$i),height:Qi})}},{key:"pushData",value:function(e){e.length&&(this._isBufferingData?this._pushToBuffer:this._pushToChart).call(this,e)}},{key:"_pushToBuffer",value:function(e){this._buffer=this._buffer.concat(e)}},{key:"_pushToChart",value:function(e){this.metric.handleMeasurements(e)}},{key:"_flushToChart",value:function(){var e=this._flushBuffer();e.length&&this._pushToChart(e)}},{key:"_flushBuffer",value:function(){if(this._buffer&&!this._buffer.length)return[];var e=this._buffer;return this._buffer=[],e.reduce((function(e,t){return e.concat(t)}),[])}}]),e}(),lr=".progress-bar, .color-bar-legend-entry",hr=function(e){e.querySelectorAll(lr).forEach((function(e){if(rr){var t=e.getAttribute("data-name")!==rr;e.setAttribute("data-muted",t)}else e.removeAttribute("data-muted")}))},fr="_refresh_data";function dr(e,t){var n=JSON.stringify(e),i=btoa(unescape(encodeURIComponent(n)));!function(e,t,n,i){var r="".concat(e,"=").concat(t,";max-age=").concat(i,";path=").concat(n);document.cookie=r}(fr,i,t,15768e4)}function vr(){var e,t,n=(e=fr,(t=document.cookie.split("; ").find((function(t){return t.startsWith("".concat(e,"="))})))?t.replace("".concat(e,"="),""):null);if(n){var i=decodeURIComponent(escape(atob(n)));return JSON.parse(i)}return null}var pr={PhxChartComponent:{mounted:function(){var e,t,n,i=this,r=this.el.parentElement.querySelector(".chart"),o=r.getBoundingClientRect(),a=Object.assign({},r.dataset,{tagged:r.dataset.tags&&""!==r.dataset.tags||!1,width:Math.max(o.width,$i),height:Qi,now:new Date/1e3,refreshInterval:1e3});this.chart=new cr(r,a),window.addEventListener("resize",(e=function(){var e=r.getBoundingClientRect();i.chart.resize(e)},n=!1,function(){n||(requestAnimationFrame(e),n=!0,setTimeout((function(){n=!1}),t))}))},updated:function(){var e=Array.from(this.el.children||[]).map((function(e){var t=e.dataset;return{x:t.x,y:+t.y,z:+t.z/1e6}}));e.length>0&&this.chart.pushData(e)},destroyed:function(){this.chart.clearTimers()}},PhxRequestLoggerCookie:{updated:function(){var e,t,n={key:(e=this).el.getAttribute("data-cookie-key"),value:e.el.getAttribute("data-cookie-value"),domain:e.el.getAttribute("data-cookie-domain")};t=n,document.cookie="".concat(t.key,"=; expires=").concat("Thu, 01 Jan 1970 00:00:00 GMT"),function(e){return e.el.hasAttribute("data-cookie-enabled")}(this)&&function(e){var t="".concat(e.key,"=").concat(e.value,";path=/");"https:"===window.location.protocol&&(t+=";samesite=strict"),e.domain&&(t+=";domain=".concat(e.domain)),document.cookie=t}(n)}},PhxRequestLoggerQueryParameter:{mounted:function(){var e=this;this.el.querySelector(".btn-primary").addEventListener("click",(function(t){!function(e){if(navigator.clipboard){var t=e.value;navigator.clipboard.writeText(t)}else e.select(),e.setSelectionRange(0,99999),document.execCommand("copy")}(e.el.querySelector("textarea"));var n=e.el.querySelector(".copy-indicator");n.setAttribute("data-enabled","false"),n.offsetWidth,n.setAttribute("data-enabled","true")}))}},PhxRequestLoggerMessages:{updated:function(){if(this.el.querySelector(".logger-autoscroll-checkbox").checked){var e=this.el.querySelector("#logger-messages");e.scrollTop=e.scrollHeight}}},PhxColorBarHighlight:{mounted:function(){var e=this;this.el.setAttribute("data-highlight-enabled","true"),this.el.querySelectorAll(lr).forEach((function(t){return t.addEventListener("click",(function(t){var n=t.currentTarget.getAttribute("data-name");rr=n===rr?null:n,hr(e.el)}))}))},updated:function(){this.el.setAttribute("data-highlight-enabled","true"),hr(this.el)}},PhxRememberRefresh:{updated:function(){var e=vr()||{};e[this.el.dataset.page]=this.el.value,dr(e,this.el.dataset.dashboardMountPath)}}},mr=document.querySelector("html").getAttribute("phx-socket")||"/live",gr=document.querySelector("meta[name='csrf-token']").getAttribute("content"),yr=new _t(mr,j,{hooks:pr,params:function(e){return{_csrf_token:gr,refresh_data:vr()}}}),br=yr.socket,kr=br.onConnError,wr=!0;br.onOpen((function(){wr=!1})),br.onConnError=function(){if(wr)wr=!1,br.disconnect(null,3e3),br.transport=O,br.connect();else{for(var e=arguments.length,t=new Array(e),n=0;n