Current section
Files
Jump to
Current section
Files
priv/static/js/app.js
/*! For license information please see app.js.LICENSE.txt */
(()=>{var t={458:()=>{"use strict";!function(){var t=function(){if("function"==typeof window.CustomEvent)return window.CustomEvent;function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}return t.prototype=window.Event.prototype,t}();function e(t,e){var n=document.createElement("input");return n.type="hidden",n.name=t,n.value=e,n}function n(t,n){var i=t.getAttribute("data-to"),r=e("_method",t.getAttribute("data-method")),s=e("_csrf_token",t.getAttribute("data-csrf")),o=document.createElement("form"),a=document.createElement("input"),l=t.getAttribute("target");o.method="get"===t.getAttribute("data-method")?"get":"post",o.action=i,o.style.display="none",l?o.target=l:n&&(o.target="_blank"),o.appendChild(s),o.appendChild(r),document.body.appendChild(o),a.type="submit",o.appendChild(a),a.click()}window.addEventListener("click",(function(e){var i=e.target;if(!e.defaultPrevented)for(;i&&i.getAttribute;){var r=new t("phoenix.link.click",{bubbles:!0,cancelable:!0});if(!i.dispatchEvent(r))return e.preventDefault(),e.stopImmediatePropagation(),!1;if(i.getAttribute("data-method"))return n(i,e.metaKey||e.shiftKey),e.preventDefault(),!1;i=i.parentNode}}),!1),window.addEventListener("phoenix.link.click",(function(t){var e=t.target.getAttribute("data-confirm");e&&!window.confirm(e)&&t.preventDefault()}),!1)}()},747:function(t,e,n){var i;(function(r,s){"use strict";!function(){for(var t=0,e=["ms","moz","webkit","o"],n=0;n<e.length&&!r.requestAnimationFrame;++n)r.requestAnimationFrame=r[e[n]+"RequestAnimationFrame"],r.cancelAnimationFrame=r[e[n]+"CancelAnimationFrame"]||r[e[n]+"CancelRequestAnimationFrame"];r.requestAnimationFrame||(r.requestAnimationFrame=function(e,n){var i=(new Date).getTime(),s=Math.max(0,16-(i-t)),o=r.setTimeout((function(){e(i+s)}),s);return t=i+s,o}),r.cancelAnimationFrame||(r.cancelAnimationFrame=function(t){clearTimeout(t)})}();var o,a,l,h,u,c={autoRun:!0,barThickness:3,barColors:{0:"rgba(26, 188, 156, .9)",".25":"rgba(52, 152, 219, .9)",".50":"rgba(241, 196, 15, .9)",".75":"rgba(230, 126, 34, .9)","1.0":"rgba(211, 84, 0, .9)"},shadowBlur:10,shadowColor:"rgba(0, 0, 0, .6)",className:null},d=function(){o.width=r.innerWidth,o.height=5*c.barThickness;var t=o.getContext("2d");t.shadowBlur=c.shadowBlur,t.shadowColor=c.shadowColor;var e=t.createLinearGradient(0,0,o.width,0);for(var n in c.barColors)e.addColorStop(n,c.barColors[n]);t.lineWidth=c.barThickness,t.beginPath(),t.moveTo(0,c.barThickness/2),t.lineTo(Math.ceil(h*o.width),c.barThickness/2),t.strokeStyle=e,t.stroke()},f={config:function(t){for(var e in t)c.hasOwnProperty(e)&&(c[e]=t[e])},show:function(){var t,e,n,i;u||(u=!0,null!==l&&r.cancelAnimationFrame(l),o||((i=(o=s.createElement("canvas")).style).position="fixed",i.top=i.left=i.right=i.margin=i.padding=0,i.zIndex=100001,i.display="none",c.className&&o.classList.add(c.className),s.body.appendChild(o),e="resize",n=d,(t=r).addEventListener?t.addEventListener(e,n,!1):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n),o.style.opacity=1,o.style.display="block",f.progress(0),c.autoRun&&function t(){a=r.requestAnimationFrame(t),f.progress("+"+.05*Math.pow(1-Math.sqrt(h),2))}())},progress:function(t){return void 0===t||("string"==typeof t&&(t=(t.indexOf("+")>=0||t.indexOf("-")>=0?h:0)+parseFloat(t)),h=t>1?1:t,d()),h},hide:function(){u&&(u=!1,null!=a&&(r.cancelAnimationFrame(a),a=null),function t(){if(f.progress("+.1")>=1&&(o.style.opacity-=.05,o.style.opacity<=.05))return o.style.display="none",void(l=null);l=r.requestAnimationFrame(t)}())}};"object"==typeof t.exports?t.exports=f:void 0===(i=function(){return f}.call(e,n,e,t))||(t.exports=i)}).call(this,window,document)}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var s=e[i]={exports:{}};return t[i].call(s.exports,s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";n(458);var t=t=>{if("function"==typeof t)return t;return function(){return t}},e="undefined"!=typeof self?self:null,i="undefined"!=typeof window?window:null,r=e||i||r,s=0,o=1,a=2,l=3,h="closed",u="errored",c="joined",d="joining",f="leaving",p="phx_close",g="phx_error",m="phx_join",v="phx_reply",y="phx_leave",b="longpoll",w="websocket",k=4,_=class{constructor(t,e,n,i){this.channel=t,this.event=e,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(t){this.timeout=t,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:t,response:e,_ref:n}){this.recHooks.filter(e=>e.status===t).forEach(t=>t.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},x=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},E=class{static request(t,e,n,i,s,o,a){if(r.XDomainRequest){let n=new r.XDomainRequest;return this.xdomainRequest(n,t,e,i,s,o,a)}{let l=new r.XMLHttpRequest;return this.xhrRequest(l,t,e,n,i,s,o,a)}}static xdomainRequest(t,e,n,i,r,s,o){return t.timeout=r,t.open(e,n),t.onload=()=>{let e=this.parseJSON(t.responseText);o&&o(e)},s&&(t.ontimeout=s),t.onprogress=()=>{},t.send(i),t}static xhrRequest(t,e,n,i,r,s,o,a){return t.open(e,n,!0),t.timeout=s,t.setRequestHeader("Content-Type",i),t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===k&&a){let e=this.parseJSON(t.responseText);a(e)}},o&&(t.ontimeout=o),t.send(r),t}static parseJSON(t){if(!t||""===t)return null;try{return JSON.parse(t)}catch(e){return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let n=[];for(var i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let r=e?`${e}[${i}]`:i,s=t[i];"object"==typeof s?n.push(this.serialize(s,r)):n.push(encodeURIComponent(r)+"="+encodeURIComponent(s))}return n.join("&")}static appendParams(t,e){if(0===Object.keys(e).length)return t;let n=t.match(/\?/)?"&":"?";return`${t}${n}${this.serialize(e)}`}},C=class{constructor(t){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=s,this.poll()}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+w),"$1/"+b)}endpointURL(){return E.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,n){this.close(t,e,n),this.readyState=s}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===o||this.readyState===s}poll(){this.ajax("GET","application/json",null,()=>this.ontimeout(),t=>{if(t){var{status:e,token:n,messages:i}=t;this.token=n}else e=0;switch(e){case 200:i.forEach(t=>{setTimeout(()=>this.onmessage({data:t}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=o,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error("unhandled poll status "+e)}})}send(t){"string"!=typeof t&&(t=(t=>{let e="",n=new Uint8Array(t),i=n.byteLength;for(let t=0;t<i;t++)e+=String.fromCharCode(n[t]);return btoa(e)})(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",t.join("\n"),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,t&&200===t.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1))})}close(t,e,n){for(let t of this.reqs)t.abort();this.readyState=l;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(t,e,n,i,r){let s;s=E.request(t,this.endpointURL(),e,n,this.timeout,()=>{this.reqs.delete(s),i()},t=>{this.reqs.delete(s),this.isActive()&&r(t)}),this.reqs.add(s)}},A={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(n))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[n,i,r,s,o]=JSON.parse(t);return e({join_ref:n,ref:i,topic:r,event:s,payload:o})}},binaryEncode(t){let{join_ref:e,ref:n,event:i,topic:r,payload:s}=t,o=this.META_LENGTH+e.length+n.length+r.length+i.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),h=0;l.setUint8(h++,this.KINDS.push),l.setUint8(h++,e.length),l.setUint8(h++,n.length),l.setUint8(h++,r.length),l.setUint8(h++,i.length),Array.from(e,t=>l.setUint8(h++,t.charCodeAt(0))),Array.from(n,t=>l.setUint8(h++,t.charCodeAt(0))),Array.from(r,t=>l.setUint8(h++,t.charCodeAt(0))),Array.from(i,t=>l.setUint8(h++,t.charCodeAt(0)));var u=new Uint8Array(a.byteLength+s.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(s),a.byteLength),u.buffer},binaryDecode(t){let e=new DataView(t),n=e.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(t,e,i);case this.KINDS.reply:return this.decodeReply(t,e,i);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,i)}},decodePush(t,e,n){let i=e.getUint8(1),r=e.getUint8(2),s=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(t.slice(o,o+i));o+=i;let l=n.decode(t.slice(o,o+r));o+=r;let h=n.decode(t.slice(o,o+s));return o+=s,{join_ref:a,ref:null,topic:l,event:h,payload:t.slice(o,t.byteLength)}},decodeReply(t,e,n){let i=e.getUint8(1),r=e.getUint8(2),s=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=n.decode(t.slice(a,a+i));a+=i;let h=n.decode(t.slice(a,a+r));a+=r;let u=n.decode(t.slice(a,a+s));a+=s;let c=n.decode(t.slice(a,a+o));a+=o;let d=t.slice(a,t.byteLength);return{join_ref:l,ref:h,topic:u,event:v,payload:{status:c,response:d}}},decodeBroadcast(t,e,n){let i=e.getUint8(1),r=e.getUint8(2),s=this.HEADER_LENGTH+2,o=n.decode(t.slice(s,s+i));s+=i;let a=n.decode(t.slice(s,s+r));return s+=r,{join_ref:null,ref:null,topic:o,event:a,payload:t.slice(s,t.byteLength)}}},S=n(747),T=n.n(S),M=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading"],L="data-phx-component",D="data-phx-ref",P="data-phx-ref-src",N="data-phx-upload-ref",R="data-phx-parent-id",I="data-phx-root-id",F=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],U=["checkbox","radio"],O="data-phx-session",$=`[${O}]`,H="data-phx-static",j="phx:live-socket:debug",B={debounce:300,throttle:300},q="d",J="s",V="e",W="r",z="t",Y="stream",X=(t,e)=>console.error&&console.error(t,e),G=t=>{let e=typeof t;return"number"===e||"string"===e&&/^(0|[1-9]\d*)$/.test(t)};var K,Z=t=>"function"==typeof t?t:function(){return t},Q=t=>JSON.parse(JSON.stringify(t)),tt=(t,e,n)=>{do{if(t.matches(`[${e}]`)&&!t.disabled)return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType&&!(n&&n.isSameNode(t)||t.matches($)));return null},et=t=>null!==t&&"object"==typeof t&&!(t instanceof Array),nt=t=>{for(let e in t)return!1;return!0},it=(t,e)=>t&&e(t),rt=function(t,e,n,i){t.forEach(t=>{new class{constructor(t,e,n){this.liveSocket=n,this.entry=t,this.offset=0,this.chunkSize=e,this.chunkTimer=null,this.uploadChannel=n.channel("lvu:"+t.ref,{token:t.metadata()})}error(t){clearTimeout(this.chunkTimer),this.uploadChannel.leave(),this.entry.error(t)}upload(){this.uploadChannel.onError(t=>this.error(t)),this.uploadChannel.join().receive("ok",t=>this.readNextChunk()).receive("error",t=>this.error(t))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let t=new window.FileReader,e=this.entry.file.slice(this.offset,this.chunkSize+this.offset);t.onload=t=>{if(null!==t.target.error)return X("Read error: "+t.target.error);this.offset+=t.target.result.byteLength,this.pushChunk(t.target.result)},t.readAsArrayBuffer(e)}pushChunk(t){this.uploadChannel.isJoined()&&this.uploadChannel.push("chunk",t).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))})}}(t,n.config.chunk_size,i).upload()})},st={canPushState:()=>void 0!==history.pushState,dropLocal(t,e,n){return t.removeItem(this.localKey(e,n))},updateLocal(t,e,n,i,r){let s=this.getLocal(t,e,n),o=this.localKey(e,n),a=null===s?i:r(s);return t.setItem(o,JSON.stringify(a)),a},getLocal(t,e,n){return JSON.parse(t.getItem(this.localKey(e,n)))},updateCurrentState(t){this.canPushState()&&history.replaceState(t(history.state||{}),"",window.location.href)},pushState(t,e,n){if(this.canPushState()){if(n!==window.location.href){if("redirect"==e.type&&e.scroll){let t=history.state||{};t.scroll=e.scroll,history.replaceState(t,"",window.location.href)}delete e.scroll,history[t+"State"](e,"",n||null);let i=this.getHashTargetEl(window.location.hash);i?i.scrollIntoView():"redirect"===e.type&&window.scroll(0,0)}}else this.redirect(n)},setCookie(t,e){document.cookie=`${t}=${e}`},getCookie:t=>document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${t}s*=s*([^;]*).*$)|^.*$`),"$1"),redirect(t,e){e&&st.setCookie("__phoenix_flash__",e+"; max-age=60000; path=/"),window.location=t},localKey:(t,e)=>`${t}-${e}`,getHashTargetEl(t){let e=t.toString().substring(1);if(""!==e)return document.getElementById(e)||document.querySelector(`a[name="${e}"]`)}},ot=st,at={byId:t=>document.getElementById(t)||X("no id found for "+t),removeClass(t,e){t.classList.remove(e),0===t.classList.length&&t.removeAttribute("class")},all(t,e,n){if(!t)return[];let i=Array.from(t.querySelectorAll(e));return n?i.forEach(n):i},childNodeLength(t){let e=document.createElement("template");return e.innerHTML=t,e.content.childElementCount},isUploadInput:t=>"file"===t.type&&null!==t.getAttribute(N),findUploadInputs(t){return this.all(t,`input[type="file"][${N}]`)},findComponentNodeList(t,e){return this.filterWithinSameLiveView(this.all(t,`[${L}="${e}"]`),t)},isPhxDestroyed:t=>!(!t.id||!at.private(t,"destroyed")),wantsNewTab:t=>t.ctrlKey||t.shiftKey||t.metaKey||t.button&&1===t.button||"_blank"===t.target.getAttribute("target"),isUnloadableFormSubmit(t){return!t.defaultPrevented&&!this.wantsNewTab(t)},isNewPageHref(t,e){let n;try{n=new URL(t)}catch(i){try{n=new URL(t,e)}catch(t){return!0}}return n.host!==e.host||n.protocol!==e.protocol||n.pathname!==e.pathname||n.search!==e.search||""===n.hash&&!n.href.endsWith("#")},markPhxChildDestroyed(t){this.isPhxChild(t)&&t.setAttribute(O,""),this.putPrivate(t,"destroyed",!0)},findPhxChildrenInFragment(t,e){let n=document.createElement("template");return n.innerHTML=t,this.findPhxChildren(n.content,e)},isIgnored:(t,e)=>"ignore"===(t.getAttribute(e)||t.getAttribute("data-phx-update")),isPhxUpdate:(t,e,n)=>t.getAttribute&&n.indexOf(t.getAttribute(e))>=0,findPhxSticky(t){return this.all(t,"[data-phx-sticky]")},findPhxChildren(t,e){return this.all(t,`${$}[${R}="${e}"]`)},findParentCIDs(t,e){let n=new Set(e),i=e.reduce((e,n)=>{let i=`[${L}="${n}"] [${L}]`;return this.filterWithinSameLiveView(this.all(t,i),t).map(t=>parseInt(t.getAttribute(L))).forEach(t=>e.delete(t)),e},n);return 0===i.size?new Set(e):i},filterWithinSameLiveView(t,e){return e.querySelector($)?t.filter(t=>this.withinSameLiveView(t,e)):t},withinSameLiveView(t,e){for(;t=t.parentNode;){if(t.isSameNode(e))return!0;if(null!==t.getAttribute(O))return!1}},private:(t,e)=>t.phxPrivate&&t.phxPrivate[e],deletePrivate(t,e){t.phxPrivate&&delete t.phxPrivate[e]},putPrivate(t,e,n){t.phxPrivate||(t.phxPrivate={}),t.phxPrivate[e]=n},updatePrivate(t,e,n,i){let r=this.private(t,e);void 0===r?this.putPrivate(t,e,i(n)):this.putPrivate(t,e,i(r))},copyPrivates(t,e){e.phxPrivate&&(t.phxPrivate=e.phxPrivate)},putTitle(t){let e=document.querySelector("title");if(e){let{prefix:n,suffix:i}=e.dataset;document.title=`${n||""}${t}${i||""}`}else document.title=t},debounce(t,e,n,i,r,s,o,a){let l=t.getAttribute(n),h=t.getAttribute(r);""===l&&(l=i),""===h&&(h=s);let u=l||h;switch(u){case null:return a();case"blur":return void(this.once(t,"debounce-blur")&&t.addEventListener("blur",()=>a()));default:let n=parseInt(u),i=()=>h?this.deletePrivate(t,"throttled"):a(),r=this.incCycle(t,"debounce-trigger",i);if(isNaN(n))return X("invalid throttle/debounce value: "+u);if(h){let i=!1;if("keydown"===e.type){let n=this.private(t,"debounce-prev-key");this.putPrivate(t,"debounce-prev-key",e.key),i=n!==e.key}if(!i&&this.private(t,"throttled"))return!1;a(),this.putPrivate(t,"throttled",!0),setTimeout(()=>{o()&&this.triggerCycle(t,"debounce-trigger")},n)}else setTimeout(()=>{o()&&this.triggerCycle(t,"debounce-trigger",r)},n);let s=t.form;s&&this.once(s,"bind-debounce")&&s.addEventListener("submit",()=>{Array.from(new FormData(s).entries(),([t])=>{let e=s.querySelector(`[name="${t}"]`);this.incCycle(e,"debounce-trigger"),this.deletePrivate(e,"throttled")})}),this.once(t,"bind-debounce")&&t.addEventListener("blur",()=>this.triggerCycle(t,"debounce-trigger"))}},triggerCycle(t,e,n){let[i,r]=this.private(t,e);n||(n=i),n===i&&(this.incCycle(t,e),r())},once(t,e){return!0!==this.private(t,e)&&(this.putPrivate(t,e,!0),!0)},incCycle(t,e,n=function(){}){let[i]=this.private(t,e)||[0,n];return i++,this.putPrivate(t,e,[i,n]),i},discardError(t,e,n){let i=e.getAttribute&&e.getAttribute(n),r=i&&t.querySelector(`[id="${i}"], [name="${i}"], [name="${i}[]"]`);r&&(this.private(r,"phx-has-focused")||this.private(r,"phx-has-submitted")||e.classList.add("phx-no-feedback"))},resetForm(t,e){Array.from(t.elements).forEach(t=>{let n=`[${e}="${t.id}"],\n [${e}="${t.name}"],\n [${e}="${t.name.replace(/\[\]$/,"")}"]`;this.deletePrivate(t,"phx-has-focused"),this.deletePrivate(t,"phx-has-submitted"),this.all(document,n,t=>{t.classList.add("phx-no-feedback")})})},showError(t,e){(t.id||t.name)&&this.all(t.form,`[${e}="${t.id}"], [${e}="${t.name}"]`,t=>{this.removeClass(t,"phx-no-feedback")})},isPhxChild:t=>t.getAttribute&&t.getAttribute(R),isPhxSticky:t=>t.getAttribute&&null!==t.getAttribute("data-phx-sticky"),firstPhxChild(t){return this.isPhxChild(t)?t:this.all(t,`[${R}]`)[0]},dispatchEvent(t,e,n={}){let i={bubbles:void 0===n.bubbles||!!n.bubbles,cancelable:!0,detail:n.detail||{}},r="click"===e?new MouseEvent("click",i):new CustomEvent(e,i);t.dispatchEvent(r)},cloneNode(t,e){if(void 0===e)return t.cloneNode(!0);{let n=t.cloneNode(!1);return n.innerHTML=e,n}},mergeAttrs(t,e,n={}){let i=n.exclude||[],r=n.isIgnored,s=e.attributes;for(let n=s.length-1;n>=0;n--){let r=s[n].name;i.indexOf(r)<0&&t.setAttribute(r,e.getAttribute(r))}let o=t.attributes;for(let n=o.length-1;n>=0;n--){let i=o[n].name;r?i.startsWith("data-")&&!e.hasAttribute(i)&&t.removeAttribute(i):e.hasAttribute(i)||t.removeAttribute(i)}},mergeFocusedInput(t,e){t instanceof HTMLSelectElement||at.mergeAttrs(t,e,{exclude:["value"]}),e.readOnly?t.setAttribute("readonly",!0):t.removeAttribute("readonly")},hasSelectionRange:t=>t.setSelectionRange&&("text"===t.type||"textarea"===t.type),restoreFocus(t,e,n){if(!at.isTextualInput(t))return;let i=t.matches(":focus");t.readOnly&&t.blur(),i||t.focus(),this.hasSelectionRange(t)&&t.setSelectionRange(e,n)},isFormInput:t=>/^(?:input|select|textarea)$/i.test(t.tagName)&&"button"!==t.type,syncAttrsToProps(t){t instanceof HTMLInputElement&&U.indexOf(t.type.toLocaleLowerCase())>=0&&(t.checked=null!==t.getAttribute("checked"))},isTextualInput:t=>F.indexOf(t.type)>=0,isNowTriggerFormExternal:(t,e)=>t.getAttribute&&null!==t.getAttribute(e),syncPendingRef(t,e,n){let i=t.getAttribute(D);if(null===i)return!0;let r=t.getAttribute(P);return at.isFormInput(t)||null!==t.getAttribute(n)?(at.isUploadInput(t)&&at.mergeAttrs(t,e,{isIgnored:!0}),at.putPrivate(t,D,e),!1):(M.forEach(n=>{t.classList.contains(n)&&e.classList.add(n)}),e.setAttribute(D,i),e.setAttribute(P,r),!0)},cleanChildNodes(t,e){if(at.isPhxUpdate(t,e,["append","prepend"])){let e=[];t.childNodes.forEach(t=>{if(!t.id){t.nodeType===Node.TEXT_NODE&&""===t.nodeValue.trim()||X(`only HTML element tags with an id are allowed inside containers with phx-update.\n\nremoving illegal node: "${(t.outerHTML||t.nodeValue).trim()}"\n\n`),e.push(t)}}),e.forEach(t=>t.remove())}},replaceRootContainer(t,e,n){let i=new Set(["id",O,H,"data-phx-main",I]);if(t.tagName.toLowerCase()===e.toLowerCase())return Array.from(t.attributes).filter(t=>!i.has(t.name.toLowerCase())).forEach(e=>t.removeAttribute(e.name)),Object.keys(n).filter(t=>!i.has(t.toLowerCase())).forEach(e=>t.setAttribute(e,n[e])),t;{let r=document.createElement(e);return Object.keys(n).forEach(t=>r.setAttribute(t,n[t])),i.forEach(e=>r.setAttribute(e,t.getAttribute(e))),r.innerHTML=t.innerHTML,t.replaceWith(r),r}},getSticky(t,e,n){let i=(at.private(t,"sticky")||[]).find(([t])=>e===t);if(i){let[t,e,n]=i;return n}return"function"==typeof n?n():n},deleteSticky(t,e){this.updatePrivate(t,"sticky",[],t=>t.filter(([t,n])=>t!==e))},putSticky(t,e,n){let i=n(t);this.updatePrivate(t,"sticky",[],t=>{let r=t.findIndex(([t])=>e===t);return r>=0?t[r]=[e,n,i]:t.push([e,n,i]),t})},applyStickyOperations(t){let e=at.private(t,"sticky");e&&e.forEach(([e,n,i])=>this.putSticky(t,e,n))}},lt=at,ht=class{static isActive(t,e){let n=void 0===e._phxRef,i=t.getAttribute("data-phx-active-refs").split(",").indexOf(ct.genFileRef(e))>=0;return e.size>0&&(n||i)}static isPreflighted(t,e){return t.getAttribute("data-phx-preflighted-refs").split(",").indexOf(ct.genFileRef(e))>=0&&this.isActive(t,e)}constructor(t,e,n){this.ref=ct.genFileRef(e),this.fileEl=t,this.file=e,this.view=n,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("phx:live-file:updated",this._onElUpdated)}metadata(){return this.meta}progress(t){this._progress=Math.floor(t),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{ct.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}cancel(){this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(t="failed"){this.fileEl.removeEventListener("phx:live-file:updated",this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:t}),ct.clearFiles(this.fileEl)}onDone(t){this._onDone=()=>{this.fileEl.removeEventListener("phx:live-file:updated",this._onElUpdated),t()}}onElUpdated(){-1===this.fileEl.getAttribute("data-phx-active-refs").split(",").indexOf(this.ref)&&this.cancel()}toPreflightPayload(){return{last_modified:this.file.lastModified,name:this.file.name,relative_path:this.file.webkitRelativePath,size:this.file.size,type:this.file.type,ref:this.ref}}uploader(t){if(this.meta.uploader){let e=t[this.meta.uploader]||X("no uploader configured for "+this.meta.uploader);return{name:this.meta.uploader,callback:e}}return{name:"channel",callback:rt}}zipPostFlight(t){this.meta=t.entries[this.ref],this.meta||X("no preflight upload response returned with ref "+this.ref,{input:this.fileEl,response:t})}},ut=0,ct=class{static genFileRef(t){let e=t._phxRef;return void 0!==e?e:(t._phxRef=(ut++).toString(),t._phxRef)}static getEntryDataURL(t,e,n){let i=this.activeFiles(t).find(t=>this.genFileRef(t)===e);n(URL.createObjectURL(i))}static hasUploadsInProgress(t){let e=0;return lt.findUploadInputs(t).forEach(t=>{t.getAttribute("data-phx-preflighted-refs")!==t.getAttribute("data-phx-done-refs")&&e++}),e>0}static serializeUploads(t){let e=this.activeFiles(t),n={};return e.forEach(e=>{let i={path:t.name},r=t.getAttribute(N);n[r]=n[r]||[],i.ref=this.genFileRef(e),i.last_modified=e.lastModified,i.name=e.name||i.ref,i.relative_path=e.webkitRelativePath,i.type=e.type,i.size=e.size,n[r].push(i)}),n}static clearFiles(t){t.value=null,t.removeAttribute(N),lt.putPrivate(t,"files",[])}static untrackFile(t,e){lt.putPrivate(t,"files",lt.private(t,"files").filter(t=>!Object.is(t,e)))}static trackFiles(t,e,n){if(null!==t.getAttribute("multiple")){let n=e.filter(e=>!this.activeFiles(t).find(t=>Object.is(t,e)));lt.putPrivate(t,"files",this.activeFiles(t).concat(n)),t.value=null}else n&&n.files.length>0&&(t.files=n.files),lt.putPrivate(t,"files",e)}static activeFileInputs(t){let e=lt.findUploadInputs(t);return Array.from(e).filter(t=>t.files&&this.activeFiles(t).length>0)}static activeFiles(t){return(lt.private(t,"files")||[]).filter(e=>ht.isActive(t,e))}static inputsAwaitingPreflight(t){let e=lt.findUploadInputs(t);return Array.from(e).filter(t=>this.filesAwaitingPreflight(t).length>0)}static filesAwaitingPreflight(t){return this.activeFiles(t).filter(e=>!ht.isPreflighted(t,e))}constructor(t,e,n){this.view=e,this.onComplete=n,this._entries=Array.from(ct.filesAwaitingPreflight(t)||[]).map(n=>new ht(t,n,e)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(t,e,n){this._entries=this._entries.map(e=>(e.zipPostFlight(t),e.onDone(()=>{this.numEntriesInProgress--,0===this.numEntriesInProgress&&this.onComplete()}),e));let i=this._entries.reduce((t,e)=>{let{name:i,callback:r}=e.uploader(n.uploaders);return t[i]=t[i]||{callback:r,entries:[]},t[i].entries.push(e),t},{});for(let r in i){let{callback:s,entries:o}=i[r];s(o,e,t,n)}}},dt={focusMain(){let t=document.querySelector("main h1, main, h1");if(t){let e=t.tabIndex;t.tabIndex=-1,t.focus(),t.tabIndex=e}},anyOf:(t,e)=>e.find(e=>t instanceof e),isFocusable(t,e){return t instanceof HTMLAnchorElement&&"ignore"!==t.rel||t instanceof HTMLAreaElement&&void 0!==t.href||!t.disabled&&this.anyOf(t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||t instanceof HTMLIFrameElement||t.tabIndex>0||!e&&0===t.tabIndex&&null!==t.getAttribute("tabindex")&&"true"!==t.getAttribute("aria-hidden")},attemptFocus(t,e){if(this.isFocusable(t,e))try{t.focus()}catch(t){}return!!document.activeElement&&document.activeElement.isSameNode(t)},focusFirstInteractive(t){let e=t.firstElementChild;for(;e;){if(this.attemptFocus(e,!0)||this.focusFirstInteractive(e,!0))return!0;e=e.nextElementSibling}},focusFirst(t){let e=t.firstElementChild;for(;e;){if(this.attemptFocus(e)||this.focusFirst(e))return!0;e=e.nextElementSibling}},focusLast(t){let e=t.lastElementChild;for(;e;){if(this.attemptFocus(e)||this.focusLast(e))return!0;e=e.previousElementSibling}}},ft={LiveFileUpload:{activeRefs(){return this.el.getAttribute("data-phx-active-refs")},preflightedRefs(){return this.el.getAttribute("data-phx-preflighted-refs")},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let t=this.preflightedRefs();this.preflightedWas!==t&&(this.preflightedWas=t,""===t&&this.__view.cancelSubmit(this.el.form)),""===this.activeRefs()&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent("phx:live-file:updated"))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(N)),ct.getEntryDataURL(this.inputEl,this.ref,t=>{this.url=t,this.el.src=t})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",()=>dt.focusLast(this.el)),this.focusEnd.addEventListener("focus",()=>dt.focusFirst(this.el)),this.el.addEventListener("phx:show-end",()=>this.el.focus()),"none"!==window.getComputedStyle(this.el).display&&dt.focusFirst(this.el)}}};var pt="undefined"==typeof document?void 0:document,gt=!!pt&&"content"in pt.createElement("template"),mt=!!pt&&pt.createRange&&"createContextualFragment"in pt.createRange();function vt(t){return t=t.trim(),gt?function(t){var e=pt.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}(t):mt?function(t){return K||(K=pt.createRange()).selectNode(pt.body),K.createContextualFragment(t).childNodes[0]}(t):function(t){var e=pt.createElement("body");return e.innerHTML=t,e.childNodes[0]}(t)}function yt(t,e){var n,i,r=t.nodeName,s=e.nodeName;return r===s||(n=r.charCodeAt(0),i=s.charCodeAt(0),n<=90&&i>=97?r===s.toUpperCase():i<=90&&n>=97&&s===r.toUpperCase())}function bt(t,e,n){t[n]!==e[n]&&(t[n]=e[n],t[n]?t.setAttribute(n,""):t.removeAttribute(n))}var wt={OPTION:function(t,e){var n=t.parentNode;if(n){var i=n.nodeName.toUpperCase();"OPTGROUP"===i&&(i=(n=n.parentNode)&&n.nodeName.toUpperCase()),"SELECT"!==i||n.hasAttribute("multiple")||(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),n.selectedIndex=-1)}bt(t,e,"selected")},INPUT:function(t,e){bt(t,e,"checked"),bt(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var n=e.value;t.value!==n&&(t.value=n);var i=t.firstChild;if(i){var r=i.nodeValue;if(r==n||!n&&r==t.placeholder)return;i.nodeValue=n}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var n,i,r=-1,s=0,o=t.firstChild;o;)if("OPTGROUP"===(i=o.nodeName&&o.nodeName.toUpperCase()))o=(n=o).firstChild;else{if("OPTION"===i){if(o.hasAttribute("selected")){r=s;break}s++}!(o=o.nextSibling)&&n&&(o=n.nextSibling,n=null)}t.selectedIndex=r}}};function kt(){}function _t(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}var xt,Et=(xt=function(t,e){var n,i,r,s,o=e.attributes;if(11!==e.nodeType&&11!==t.nodeType){for(var a=o.length-1;a>=0;a--)i=(n=o[a]).name,r=n.namespaceURI,s=n.value,r?(i=n.localName||i,t.getAttributeNS(r,i)!==s&&("xmlns"===n.prefix&&(i=n.name),t.setAttributeNS(r,i,s))):t.getAttribute(i)!==s&&t.setAttribute(i,s);for(var l=t.attributes,h=l.length-1;h>=0;h--)i=(n=l[h]).name,(r=n.namespaceURI)?(i=n.localName||i,e.hasAttributeNS(r,i)||t.removeAttributeNS(r,i)):e.hasAttribute(i)||t.removeAttribute(i)}},function(t,e,n){if(n||(n={}),"string"==typeof e)if("#document"===t.nodeName||"HTML"===t.nodeName||"BODY"===t.nodeName){var i=e;(e=pt.createElement("html")).innerHTML=i}else e=vt(e);else 11===e.nodeType&&(e=e.firstElementChild);var r=n.getNodeKey||_t,s=n.onBeforeNodeAdded||kt,o=n.onNodeAdded||kt,a=n.onBeforeElUpdated||kt,l=n.onElUpdated||kt,h=n.onBeforeNodeDiscarded||kt,u=n.onNodeDiscarded||kt,c=n.onBeforeElChildrenUpdated||kt,d=n.skipFromChildren||kt,f=n.addChild||function(t,e){return t.appendChild(e)},p=!0===n.childrenOnly,g=Object.create(null),m=[];function v(t){m.push(t)}function y(t,e,n){!1!==h(t)&&(e&&e.removeChild(t),u(t),function t(e,n){if(1===e.nodeType)for(var i=e.firstChild;i;){var s=void 0;n&&(s=r(i))?v(s):(u(i),i.firstChild&&t(i,n)),i=i.nextSibling}}(t,n))}function b(t){o(t);for(var e=t.firstChild;e;){var n=e.nextSibling,i=r(e);if(i){var s=g[i];s&&yt(e,s)?(e.parentNode.replaceChild(s,e),w(s,e)):b(e)}else b(e);e=n}}function w(t,e,n){var i=r(e);if(i&&delete g[i],!n){if(!1===a(t,e))return;if(xt(t,e),l(t),!1===c(t,e))return}"TEXTAREA"!==t.nodeName?function(t,e){var n,i,o,a,l,h=d(t),u=e.firstChild,c=t.firstChild;t:for(;u;){for(a=u.nextSibling,n=r(u);!h&&c;){if(o=c.nextSibling,u.isSameNode&&u.isSameNode(c)){u=a,c=o;continue t}i=r(c);var p=c.nodeType,m=void 0;if(p===u.nodeType&&(1===p?(n?n!==i&&((l=g[n])?o===l?m=!1:(t.insertBefore(l,c),i?v(i):y(c,t,!0),c=l):m=!1):i&&(m=!1),(m=!1!==m&&yt(c,u))&&w(c,u)):3!==p&&8!=p||(m=!0,c.nodeValue!==u.nodeValue&&(c.nodeValue=u.nodeValue))),m){u=a,c=o;continue t}i?v(i):y(c,t,!0),c=o}if(n&&(l=g[n])&&yt(l,u))h||f(t,l),w(l,u);else{var k=s(u);!1!==k&&(k&&(u=k),u.actualize&&(u=u.actualize(t.ownerDocument||pt)),f(t,u),b(u))}u=a,c=o}!function(t,e,n){for(;e;){var i=e.nextSibling;(n=r(e))?v(n):y(e,t,!0),e=i}}(t,c,i);var _=wt[t.nodeName];_&&_(t,e)}(t,e):wt.TEXTAREA(t,e)}!function t(e){if(1===e.nodeType||11===e.nodeType)for(var n=e.firstChild;n;){var i=r(n);i&&(g[i]=n),t(n),n=n.nextSibling}}(t);var k,_,x=t,E=x.nodeType,C=e.nodeType;if(!p)if(1===E)1===C?yt(t,e)||(u(t),x=function(t,e){for(var n=t.firstChild;n;){var i=n.nextSibling;e.appendChild(n),n=i}return e}(t,(k=e.nodeName,(_=e.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==_?pt.createElementNS(_,k):pt.createElement(k)))):x=e;else if(3===E||8===E){if(C===E)return x.nodeValue!==e.nodeValue&&(x.nodeValue=e.nodeValue),x;x=e}if(x===e)u(t);else{if(e.isSameNode&&e.isSameNode(x))return;if(w(x,e,p),m)for(var A=0,S=m.length;A<S;A++){var T=g[m[A]];T&&y(T,T.parentNode,!1)}}return!p&&x!==t&&t.parentNode&&(x.actualize&&(x=x.actualize(t.ownerDocument||pt)),t.parentNode.replaceChild(x,t)),x}),Ct=class{static patchEl(t,e,n){Et(t,e,{childrenOnly:!1,onBeforeElUpdated:(t,e)=>{if(n&&n.isSameNode(t)&<.isFormInput(t))return lt.mergeFocusedInput(t,e),!1}})}constructor(t,e,n,i,r,s){this.view=t,this.liveSocket=t.liveSocket,this.container=e,this.id=n,this.rootID=t.root.id,this.html=i,this.streams=r,this.streamInserts={},this.targetCID=s,this.cidPatch=G(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(t,e){this.callbacks["before"+t].push(e)}after(t,e){this.callbacks["after"+t].push(e)}trackBefore(t,...e){this.callbacks["before"+t].forEach(t=>t(...e))}trackAfter(t,...e){this.callbacks["after"+t].forEach(t=>t(...e))}markPrunableContentForRemoval(){let t=this.liveSocket.binding("update");lt.all(this.container,`[${t}=stream]`,t=>t.innerHTML=""),lt.all(this.container,`[${t}=append] > *, [${t}=prepend] > *`,t=>{t.setAttribute("data-phx-prune","")})}perform(){let{view:t,liveSocket:e,container:n,html:i}=this,r=this.isCIDPatch()?this.targetCIDContainer(i):n;if(this.isCIDPatch()&&!r)return;let s=e.getActiveElement(),{selectionStart:o,selectionEnd:a}=s&<.hasSelectionRange(s)?s:{},l=e.binding("update"),h=e.binding("feedback-for"),u=e.binding("disable-with"),c=e.binding("trigger-action"),d=[],f=[],p=[],g=null,m=e.time("premorph container prep",()=>this.buildDiffHTML(n,i,l,r));return this.trackBefore("added",n),this.trackBefore("updated",n,n),e.time("morphdom",()=>{this.streams.forEach(([t,e])=>{this.streamInserts=Object.assign(this.streamInserts,t),e.forEach(t=>{let e=n.querySelector(`[id="${t}"]`);e&&(this.maybePendingRemove(e)||(e.remove(),this.onNodeDiscarded(e)))})}),Et(r,m,{childrenOnly:null===r.getAttribute(L),getNodeKey:t=>lt.isPhxDestroyed(t)?null:t.id,skipFromChildren:t=>"stream"===t.getAttribute(l),addChild:(t,e)=>{let n=e.id?this.streamInserts[e.id]:void 0;if(void 0===n)return t.appendChild(e);if(0===n)t.insertAdjacentElement("afterbegin",e);else if(-1===n)t.appendChild(e);else if(n>0){let i=Array.from(t.children)[n];t.insertBefore(e,i)}},onBeforeNodeAdded:t=>(this.trackBefore("added",t),t),onNodeAdded:e=>{e instanceof HTMLImageElement&&e.srcset?e.srcset=e.srcset:e instanceof HTMLVideoElement&&e.autoplay&&e.play(),lt.isNowTriggerFormExternal(e,c)&&(g=e),lt.discardError(r,e,h),(lt.isPhxChild(e)&&t.ownsElement(e)||lt.isPhxSticky(e)&&t.ownsElement(e.parentNode))&&this.trackAfter("phxChildAdded",e),d.push(e)},onNodeDiscarded:t=>this.onNodeDiscarded(t),onBeforeNodeDiscarded:t=>!(!t.getAttribute||null===t.getAttribute("data-phx-prune"))||(null===t.parentElement||!t.id||!lt.isPhxUpdate(t.parentElement,l,["stream","append","prepend"]))&&(!this.maybePendingRemove(t)&&!this.skipCIDSibling(t)),onElUpdated:t=>{lt.isNowTriggerFormExternal(t,c)&&(g=t),f.push(t),this.maybeReOrderStream(t)},onBeforeElUpdated:(t,e)=>{if(lt.cleanChildNodes(e,l),this.skipCIDSibling(e))return!1;if(lt.isPhxSticky(t))return!1;if(lt.isIgnored(t,l)||t.form&&t.form.isSameNode(g))return this.trackBefore("updated",t,e),lt.mergeAttrs(t,e,{isIgnored:!0}),f.push(t),lt.applyStickyOperations(t),!1;if("number"===t.type&&t.validity&&t.validity.badInput)return!1;if(!lt.syncPendingRef(t,e,u))return lt.isUploadInput(t)&&(this.trackBefore("updated",t,e),f.push(t)),lt.applyStickyOperations(t),!1;if(lt.isPhxChild(e)){let n=t.getAttribute(O);return lt.mergeAttrs(t,e,{exclude:[H]}),""!==n&&t.setAttribute(O,n),t.setAttribute(I,this.rootID),lt.applyStickyOperations(t),!1}return lt.copyPrivates(e,t),lt.discardError(r,e,h),s&&t.isSameNode(s)&<.isFormInput(t)&&"hidden"!==t.type?(this.trackBefore("updated",t,e),lt.mergeFocusedInput(t,e),lt.syncAttrsToProps(t),f.push(t),lt.applyStickyOperations(t),!1):(lt.isPhxUpdate(e,l,["append","prepend"])&&p.push(new class{constructor(t,e,n){let i=new Set,r=new Set([...e.children].map(t=>t.id)),s=[];Array.from(t.children).forEach(t=>{if(t.id&&(i.add(t.id),r.has(t.id))){let e=t.previousElementSibling&&t.previousElementSibling.id;s.push({elementId:t.id,previousElementId:e})}}),this.containerId=e.id,this.updateType=n,this.elementsToModify=s,this.elementIdsToAdd=[...r].filter(t=>!i.has(t))}perform(){let t=lt.byId(this.containerId);this.elementsToModify.forEach(e=>{e.previousElementId?it(document.getElementById(e.previousElementId),t=>{it(document.getElementById(e.elementId),e=>{e.previousElementSibling&&e.previousElementSibling.id==t.id||t.insertAdjacentElement("afterend",e)})}):it(document.getElementById(e.elementId),e=>{null==e.previousElementSibling||t.insertAdjacentElement("afterbegin",e)})}),"prepend"==this.updateType&&this.elementIdsToAdd.reverse().forEach(e=>{it(document.getElementById(e),e=>t.insertAdjacentElement("afterbegin",e))})}}(t,e,e.getAttribute(l))),lt.syncAttrsToProps(e),lt.applyStickyOperations(e),this.trackBefore("updated",t,e),!0)}})}),e.isDebugEnabled()&&function(){let t=new Set,e=document.querySelectorAll("*[id]");for(let n=0,i=e.length;n<i;n++)t.has(e[n].id)?console.error(`Multiple IDs detected: ${e[n].id}. Ensure unique element ids.`):t.add(e[n].id)}(),p.length>0&&e.time("post-morph append/prepend restoration",()=>{p.forEach(t=>t.perform())}),e.silenceEvents(()=>lt.restoreFocus(s,o,a)),lt.dispatchEvent(document,"phx:update"),d.forEach(t=>this.trackAfter("added",t)),f.forEach(t=>this.trackAfter("updated",t)),this.transitionPendingRemoves(),g&&(e.unload(),g.submit()),!0}onNodeDiscarded(t){(lt.isPhxChild(t)||lt.isPhxSticky(t))&&this.liveSocket.destroyViewByEl(t),this.trackAfter("discarded",t)}maybePendingRemove(t){return!(!t.getAttribute||null===t.getAttribute(this.phxRemove))&&(this.pendingRemoves.push(t),!0)}maybeReOrderStream(t){let e=t.id?this.streamInserts[t.id]:void 0;if(void 0!==e)if(0===e)t.parentElement.insertBefore(t,t.parentElement.firstElementChild);else if(e>0){let n=Array.from(t.parentElement.children),i=n.indexOf(t);if(e>=n.length-1)t.parentElement.appendChild(t);else{let r=n[e];i>e?t.parentElement.insertBefore(t,r):t.parentElement.insertBefore(t,r.nextElementSibling)}}}transitionPendingRemoves(){let{pendingRemoves:t,liveSocket:e}=this;t.length>0&&(e.transitionRemoves(t),e.requestDOMUpdate(()=>{t.forEach(t=>{let n=lt.firstPhxChild(t);n&&e.destroyViewByEl(n),t.remove()}),this.trackAfter("transitionsDiscarded",t)}))}isCIDPatch(){return this.cidPatch}skipCIDSibling(t){return t.nodeType===Node.ELEMENT_NODE&&null!==t.getAttribute("data-phx-skip")}targetCIDContainer(t){if(!this.isCIDPatch())return;let[e,...n]=lt.findComponentNodeList(this.container,this.targetCID);return 0===n.length&&1===lt.childNodeLength(t)?e:e&&e.parentNode}buildDiffHTML(t,e,n,i){let r=this.isCIDPatch(),s=r&&i.getAttribute(L)===this.targetCID.toString();if(!r||s)return e;{let t=null,n=document.createElement("template");t=lt.cloneNode(i);let[r,...s]=lt.findComponentNodeList(t,this.targetCID);return n.innerHTML=e,s.forEach(t=>t.remove()),Array.from(t.childNodes).forEach(t=>{t.id&&t.nodeType===Node.ELEMENT_NODE&&t.getAttribute(L)!==this.targetCID.toString()&&(t.setAttribute("data-phx-skip",""),t.innerHTML="")}),Array.from(n.content.childNodes).forEach(e=>t.insertBefore(e,r)),r.remove(),t.outerHTML}}indexOf(t,e){return Array.from(t.children).indexOf(e)}},At=class{static extract(t){let{[W]:e,[V]:n,[z]:i}=t;return delete t[W],delete t[V],delete t[z],{diff:t,title:i,reply:e||null,events:n||[]}}constructor(t,e){this.viewId=t,this.rendered={},this.mergeDiff(e)}parentViewId(){return this.viewId}toString(t){let[e,n]=this.recursiveToString(this.rendered,this.rendered.c,t);return[e,n]}recursiveToString(t,e=t.c,n){let i={buffer:"",components:e,onlyCids:n=n?new Set(n):null,streams:new Set};return this.toOutputBuffer(t,null,i),[i.buffer,i.streams]}componentCIDs(t){return Object.keys(t.c||{}).map(t=>parseInt(t))}isComponentOnlyDiff(t){return!!t.c&&1===Object.keys(t).length}getComponent(t,e){return t.c[e]}mergeDiff(t){let e=t.c,n={};if(delete t.c,this.rendered=this.mutableMerge(this.rendered,t),this.rendered.c=this.rendered.c||{},e){let i=this.rendered.c;for(let t in e)e[t]=this.cachedFindComponent(t,e[t],i,e,n);for(let t in e)i[t]=e[t];t.c=e}}cachedFindComponent(t,e,n,i,r){if(r[t])return r[t];{let s,o,a=e[J];if(G(a)){let t;t=a>0?this.cachedFindComponent(a,i[a],n,i,r):n[-a],o=t[J],s=this.cloneMerge(t,e),s[J]=o}else s=void 0!==e[J]?e:this.cloneMerge(n[t]||{},e);return r[t]=s,s}}mutableMerge(t,e){return void 0!==e[J]?e:(this.doMutableMerge(t,e),t)}doMutableMerge(t,e){for(let n in e){let i=e[n],r=t[n];et(i)&&void 0===i[J]&&et(r)?this.doMutableMerge(r,i):t[n]=i}}cloneMerge(t,e){let n={...t,...e};for(let i in n){let r=e[i],s=t[i];et(r)&&void 0===r[J]&&et(s)&&(n[i]=this.cloneMerge(s,r))}return n}componentToString(t){let[e,n]=this.recursiveCIDToString(this.rendered.c,t);return[e,n]}pruneCIDs(t){t.forEach(t=>delete this.rendered.c[t])}get(){return this.rendered}isNewFingerprint(t={}){return!!t[J]}templateStatic(t,e){return"number"==typeof t?e[t]:t}toOutputBuffer(t,e,n){if(t[q])return this.comprehensionToBuffer(t,e,n);let{[J]:i}=t;i=this.templateStatic(i,e),n.buffer+=i[0];for(let r=1;r<i.length;r++)this.dynamicToBuffer(t[r-1],e,n),n.buffer+=i[r]}comprehensionToBuffer(t,e,n){let{[q]:i,[J]:r,[Y]:s}=t,[o,a]=s||[{},[]];r=this.templateStatic(r,e);let l=e||t.p;for(let t=0;t<i.length;t++){let e=i[t];n.buffer+=r[0];for(let t=1;t<r.length;t++)this.dynamicToBuffer(e[t-1],l,n),n.buffer+=r[t]}void 0!==s&&(t[q].length>0||a.length>0)&&(t[q]=[],n.streams.add(s))}dynamicToBuffer(t,e,n){if("number"==typeof t){let[e,i]=this.recursiveCIDToString(n.components,t,n.onlyCids);n.buffer+=e,n.streams=new Set([...n.streams,...i])}else et(t)?this.toOutputBuffer(t,e,n):n.buffer+=t}recursiveCIDToString(t,e,n){let i=t[e]||X("no component for CID "+e,t),r=document.createElement("template"),[s,o]=this.recursiveToString(i,t,n);r.innerHTML=s;let a=r.content,l=n&&!n.has(e),[h,u]=Array.from(a.childNodes).reduce(([t,n],i,s)=>i.nodeType===Node.ELEMENT_NODE?i.getAttribute(L)?[t,!0]:(i.setAttribute(L,e),i.id||(i.id=`${this.parentViewId()}-${e}-${s}`),l&&(i.setAttribute("data-phx-skip",""),i.innerHTML=""),[!0,n]):""!==i.nodeValue.trim()?(X(`only HTML element tags are allowed at the root of components.\n\ngot: "${i.nodeValue.trim()}"\n\nwithin:\n`,r.innerHTML.trim()),i.replaceWith(this.createSpan(i.nodeValue,e)),[!0,n]):(i.remove(),[t,n]),[!1,!1]);return h||u?!h&&u?(X("expected at least one HTML element tag directly inside a component, but only subcomponents were found. A component must render at least one HTML tag directly inside itself.",r.innerHTML.trim()),[r.innerHTML,o]):[r.innerHTML,o]:(X("expected at least one HTML element tag inside a component, but the component is empty:\n",r.innerHTML.trim()),[this.createSpan("",e).outerHTML,o])}createSpan(t,e){let n=document.createElement("span");return n.innerText=t,n.setAttribute(L,e),n}},St=1,Tt=class{static makeID(){return St++}static elementID(t){return t.phxHookId}constructor(t,e,n){this.__view=t,this.liveSocket=t.liveSocket,this.__callbacks=n,this.__listeners=new Set,this.__isDisconnected=!1,this.el=e,this.el.phxHookId=this.constructor.makeID();for(let t in this.__callbacks)this[t]=this.__callbacks[t]}__mounted(){this.mounted&&this.mounted()}__updated(){this.updated&&this.updated()}__beforeUpdate(){this.beforeUpdate&&this.beforeUpdate()}__destroyed(){this.destroyed&&this.destroyed()}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected&&this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected&&this.disconnected()}pushEvent(t,e={},n=function(){}){return this.__view.pushHookEvent(null,t,e,n)}pushEventTo(t,e,n={},i=function(){}){return this.__view.withinTargets(t,(t,r)=>t.pushHookEvent(r,e,n,i))}handleEvent(t,e){let n=(n,i)=>i?t:e(n.detail);return window.addEventListener("phx:"+t,n),this.__listeners.add(n),n}removeHandleEvent(t){let e=t(null,!0);window.removeEventListener("phx:"+e,t),this.__listeners.delete(t)}upload(t,e){return this.__view.dispatchUploads(t,e)}uploadTo(t,e,n){return this.__view.withinTargets(t,t=>t.dispatchUploads(e,n))}__cleanup__(){this.__listeners.forEach(t=>this.removeHandleEvent(t))}},Mt=null,Lt={exec(t,e,n,i,r){let[s,o]=r||[null,{}];("["===e.charAt(0)?JSON.parse(e):[[s,o]]).forEach(([r,a])=>{r===s&&o.data&&(a.data=Object.assign(a.data||{},o.data)),this.filterToEls(i,a).forEach(s=>{this["exec_"+r](t,e,n,i,s,a)})})},isVisible:t=>!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length>0),exec_exec(t,e,n,i,r,[s,o]){(o?lt.all(document,o):[i]).forEach(e=>{let i=e.getAttribute(s);if(!i)throw new Error(`expected ${s} to contain JS command on "${o}"`);n.liveSocket.execJS(e,i,t)})},exec_dispatch(t,e,n,i,r,{to:s,event:o,detail:a,bubbles:l}){(a=a||{}).dispatcher=i,lt.dispatchEvent(r,o,{detail:a,bubbles:l})},exec_push(t,e,n,i,r,s){if(!n.isConnected())return;let{event:o,data:a,target:l,page_loading:h,loading:u,value:c,dispatcher:d}=s,f={loading:u,value:c,target:l,page_loading:!!h},p="change"===t&&d?d:i,g=l||p.getAttribute(n.binding("target"))||p;n.withinTargets(g,(n,r)=>{if("change"===t){let{newCid:t,_target:a,callback:l}=s;a=a||(lt.isFormInput(i)?i.name:void 0),a&&(f._target=a),n.pushInput(i,r,t,o||e,f,l)}else if("submit"===t){let{submitter:t}=s;n.submitForm(i,r,o||e,t,f)}else n.pushEvent(t,i,r,o||e,a,f)})},exec_navigate(t,e,n,i,r,{href:s,replace:o}){n.liveSocket.historyRedirect(s,o?"replace":"push")},exec_patch(t,e,n,i,r,{href:s,replace:o}){n.liveSocket.pushHistoryPatch(s,o?"replace":"push",i)},exec_focus(t,e,n,i,r){window.requestAnimationFrame(()=>dt.attemptFocus(r))},exec_focus_first(t,e,n,i,r){window.requestAnimationFrame(()=>dt.focusFirstInteractive(r)||dt.focusFirst(r))},exec_push_focus(t,e,n,i,r){window.requestAnimationFrame(()=>Mt=r||i)},exec_pop_focus(t,e,n,i,r){window.requestAnimationFrame(()=>{Mt&&Mt.focus(),Mt=null})},exec_add_class(t,e,n,i,r,{names:s,transition:o,time:a}){this.addOrRemoveClasses(r,s,[],o,a,n)},exec_remove_class(t,e,n,i,r,{names:s,transition:o,time:a}){this.addOrRemoveClasses(r,[],s,o,a,n)},exec_transition(t,e,n,i,r,{time:s,transition:o}){this.addOrRemoveClasses(r,[],[],o,s,n)},exec_toggle(t,e,n,i,r,{display:s,ins:o,outs:a,time:l}){this.toggle(t,n,r,s,o,a,l)},exec_show(t,e,n,i,r,{display:s,transition:o,time:a}){this.show(t,n,r,s,o,a)},exec_hide(t,e,n,i,r,{display:s,transition:o,time:a}){this.hide(t,n,r,s,o,a)},exec_set_attr(t,e,n,i,r,{attr:[s,o]}){this.setOrRemoveAttrs(r,[[s,o]],[])},exec_remove_attr(t,e,n,i,r,{attr:s}){this.setOrRemoveAttrs(r,[],[s])},show(t,e,n,i,r,s){this.isVisible(n)||this.toggle(t,e,n,i,r,null,s)},hide(t,e,n,i,r,s){this.isVisible(n)&&this.toggle(t,e,n,i,null,r,s)},toggle(t,e,n,i,r,s,o){let[a,l,h]=r||[[],[],[]],[u,c,d]=s||[[],[],[]];if(a.length>0||u.length>0)if(this.isVisible(n)){let t=()=>{this.addOrRemoveClasses(n,c,a.concat(l).concat(h)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(n,u,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(n,d,c))})};n.dispatchEvent(new Event("phx:hide-start")),e.transition(o,t,()=>{this.addOrRemoveClasses(n,[],u.concat(d)),lt.putSticky(n,"toggle",t=>t.style.display="none"),n.dispatchEvent(new Event("phx:hide-end"))})}else{if("remove"===t)return;let r=()=>{this.addOrRemoveClasses(n,l,u.concat(c).concat(d));let t=i||this.defaultDisplay(n);lt.putSticky(n,"toggle",e=>e.style.display=t),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(n,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(n,h,l))})};n.dispatchEvent(new Event("phx:show-start")),e.transition(o,r,()=>{this.addOrRemoveClasses(n,[],a.concat(h)),n.dispatchEvent(new Event("phx:show-end"))})}else this.isVisible(n)?window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("phx:hide-start")),lt.putSticky(n,"toggle",t=>t.style.display="none"),n.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("phx:show-start"));let t=i||this.defaultDisplay(n);lt.putSticky(n,"toggle",e=>e.style.display=t),n.dispatchEvent(new Event("phx:show-end"))})},addOrRemoveClasses(t,e,n,i,r,s){let[o,a,l]=i||[[],[],[]];if(o.length>0){let i=()=>this.addOrRemoveClasses(t,a.concat(o),[]),h=()=>this.addOrRemoveClasses(t,e.concat(l),n.concat(o).concat(a));return s.transition(r,i,h)}window.requestAnimationFrame(()=>{let[i,r]=lt.getSticky(t,"classes",[[],[]]),s=e.filter(e=>i.indexOf(e)<0&&!t.classList.contains(e)),o=n.filter(e=>r.indexOf(e)<0&&t.classList.contains(e)),a=i.filter(t=>n.indexOf(t)<0).concat(s),l=r.filter(t=>e.indexOf(t)<0).concat(o);lt.putSticky(t,"classes",t=>(t.classList.remove(...l),t.classList.add(...a),[a,l]))})},setOrRemoveAttrs(t,e,n){let[i,r]=lt.getSticky(t,"attrs",[[],[]]),s=e.map(([t,e])=>t).concat(n),o=i.filter(([t,e])=>!s.includes(t)).concat(e),a=r.filter(t=>!s.includes(t)).concat(n);lt.putSticky(t,"attrs",t=>(a.forEach(e=>t.removeAttribute(e)),o.forEach(([e,n])=>t.setAttribute(e,n)),[o,a]))},hasAllClasses:(t,e)=>e.every(e=>t.classList.contains(e)),isToggledOut(t,e){return!this.isVisible(t)||this.hasAllClasses(t,e)},filterToEls:(t,{to:e})=>e?lt.all(document,e):[t],defaultDisplay:t=>({tr:"table-row",td:"table-cell"}[t.tagName.toLowerCase()]||"block")},Dt=(t,e,n=[])=>{let{submitter:i,...r}=e,s=new FormData(t);i&&i.hasAttribute("name")&&i.form&&i.form===t&&s.append(i.name,i.value);let o=[];s.forEach((t,e,n)=>{t instanceof File&&o.push(e)}),o.forEach(t=>s.delete(t));let a=new URLSearchParams;for(let[t,e]of s.entries())(0===n.length||n.indexOf(t)>=0)&&a.append(t,e);for(let t in r)a.append(t,r[t]);return a.toString()},Pt=class{constructor(t,e,n,i,r){this.isDead=!1,this.liveSocket=e,this.flash=i,this.parent=n,this.root=n?n.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(t){t&&t()},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:"+this.id,()=>({redirect:this.redirect?this.href:void 0,url:this.redirect?void 0:this.href||void 0,params:this.connectParams(r),session:this.getSession(),static:this.getStatic(),flash:this.flash}))}setHref(t){this.href=t}setRedirect(t){this.redirect=!0,this.href=t}isMain(){return this.el.hasAttribute("data-phx-main")}connectParams(t){let e=this.liveSocket.params(this.el),n=lt.all(document,`[${this.binding("track-static")}]`).map(t=>t.src||t.href).filter(t=>"string"==typeof t);return n.length>0&&(e._track_static=n),e._mounts=this.joinCount,e._live_referer=t,e}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(O)}getStatic(){let t=this.el.getAttribute(H);return""===t?null:t}destroy(t=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);let e=()=>{t();for(let t in this.viewHooks)this.destroyHook(this.viewHooks[t])};lt.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",e).receive("error",e).receive("timeout",e)}setContainerClasses(...t){this.el.classList.remove("phx-connected","phx-loading","phx-error"),this.el.classList.add(...t)}showLoader(t){if(clearTimeout(this.loaderTimer),t)this.loaderTimer=setTimeout(()=>this.showLoader(),t);else{for(let t in this.viewHooks)this.viewHooks[t].__disconnected();this.setContainerClasses("phx-loading")}}execAll(t){lt.all(this.el,`[${t}]`,e=>this.liveSocket.execJS(e,e.getAttribute(t)))}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses("phx-connected"),this.execAll(this.binding("connected"))}triggerReconnected(){for(let t in this.viewHooks)this.viewHooks[t].__reconnected()}log(t,e){this.liveSocket.log(this,t,e)}transition(t,e,n=function(){}){this.liveSocket.transition(t,e,n)}withinTargets(t,e){if(t instanceof HTMLElement||t instanceof SVGElement)return this.liveSocket.owner(t,n=>e(n,t));if(G(t)){0===lt.findComponentNodeList(this.el,t).length?X("no component found matching phx-target of "+t):e(this,parseInt(t))}else{let n=Array.from(document.querySelectorAll(t));0===n.length&&X(`nothing found matching the phx-target selector "${t}"`),n.forEach(t=>this.liveSocket.owner(t,n=>e(n,t)))}}applyDiff(t,e,n){this.log(t,()=>["",Q(e)]);let{diff:i,reply:r,events:s,title:o}=At.extract(e);n({diff:i,reply:r,events:s}),o&&window.requestAnimationFrame(()=>lt.putTitle(o))}onJoin(t){let{rendered:e,container:n}=t;if(n){let[t,e]=n;this.el=lt.replaceRootContainer(this.el,t,e)}this.childJoins=0,this.joinPending=!0,this.flash=null,ot.dropLocal(this.liveSocket.localStorage,window.location.pathname,"consecutive-reloads"),this.applyDiff("mount",e,({diff:e,events:n})=>{this.rendered=new At(this.id,e);let[i,r]=this.renderContainer(null,"join");this.dropPendingRefs();let s=this.formsForRecovery(i);this.joinCount++,s.length>0?s.forEach(([t,e,o],a)=>{this.pushFormRecovery(t,o,t=>{a===s.length-1&&this.onJoinComplete(t,i,r,n)})}):this.onJoinComplete(t,i,r,n)})}dropPendingRefs(){lt.all(document,`[${P}="${this.id}"][${D}]`,t=>{t.removeAttribute(D),t.removeAttribute(P)})}onJoinComplete({live_patch:t},e,n,i){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(t,e,n,i);0===lt.findPhxChildrenInFragment(e,this.id).filter(t=>{let e=t.id&&this.el.querySelector(`[id="${t.id}"]`),n=e&&e.getAttribute(H);return n&&t.setAttribute(H,n),this.joinChild(t)}).length?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(t,e,n,i)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(t,e,n,i)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(t,e,n,i)])}attachTrueDocEl(){this.el=lt.byId(this.id),this.el.setAttribute(I,this.root.id)}execNewMounted(){lt.all(this.el,`[${this.binding("hook")}], [data-phx-hook]`,t=>{this.maybeAddNewHook(t)}),lt.all(this.el,`[${this.binding("mounted")}]`,t=>this.maybeMounted(t))}applyJoinPatch(t,e,n,i){this.attachTrueDocEl();let r=new Ct(this,this.el,this.id,e,n,null);if(r.markPrunableContentForRemoval(),this.performPatch(r,!1),this.joinNewChildren(),this.execNewMounted(),this.joinPending=!1,this.liveSocket.dispatchEvents(i),this.applyPendingUpdates(),t){let{kind:e,to:n}=t;this.liveSocket.historyPatch(n,e)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(t,e){this.liveSocket.triggerDOM("onBeforeElUpdated",[t,e]);let n=this.getHook(t),i=n&<.isIgnored(t,this.binding("update"));if(n&&!t.isEqualNode(e)&&(!i||(r=t.dataset,s=e.dataset,JSON.stringify(r)!==JSON.stringify(s))))return n.__beforeUpdate(),n;var r,s}maybeMounted(t){let e=t.getAttribute(this.binding("mounted")),n=e&<.private(t,"mounted");e&&!n&&(this.liveSocket.execJS(t,e),lt.putPrivate(t,"mounted",!0))}maybeAddNewHook(t,e){let n=this.addHook(t);n&&n.__mounted()}performPatch(t,e){let n=[],i=!1,r=new Set;return t.after("added",t=>{this.liveSocket.triggerDOM("onNodeAdded",[t]),this.maybeAddNewHook(t),t.getAttribute&&this.maybeMounted(t)}),t.after("phxChildAdded",t=>{lt.isPhxSticky(t)?this.liveSocket.joinRootViews():i=!0}),t.before("updated",(t,e)=>{this.triggerBeforeUpdateHook(t,e)&&r.add(t.id)}),t.after("updated",t=>{r.has(t.id)&&this.getHook(t).__updated()}),t.after("discarded",t=>{t.nodeType===Node.ELEMENT_NODE&&n.push(t)}),t.after("transitionsDiscarded",t=>this.afterElementsRemoved(t,e)),t.perform(),this.afterElementsRemoved(n,e),i}afterElementsRemoved(t,e){let n=[];t.forEach(t=>{let e=lt.all(t,`[${L}]`),i=lt.all(t,`[${this.binding("hook")}]`);e.concat(t).forEach(t=>{let e=this.componentID(t);G(e)&&-1===n.indexOf(e)&&n.push(e)}),i.concat(t).forEach(t=>{let e=this.getHook(t);e&&this.destroyHook(e)})}),e&&this.maybePushComponentsDestroyed(n)}joinNewChildren(){lt.findPhxChildren(this.el,this.id).forEach(t=>this.joinChild(t))}getChildById(t){return this.root.children[this.id][t]}getDescendentByEl(t){return t.id===this.id?this:this.children[t.getAttribute(R)][t.id]}destroyDescendent(t){for(let e in this.root.children)for(let n in this.root.children[e])if(n===t)return this.root.children[e][n].destroy()}joinChild(t){if(!this.getChildById(t.id)){let e=new Pt(t,this.liveSocket,this);return this.root.children[this.id][e.id]=e,e.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(t){this.childJoins--,0===this.childJoins&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.joinCallback(()=>{this.pendingJoinOps.forEach(([t,e])=>{t.isDestroyed()||e()}),this.pendingJoinOps=[]})}update(t,e){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&this.root.isMain())return this.pendingDiffs.push({diff:t,events:e});this.rendered.mergeDiff(t);let n=!1;this.rendered.isComponentOnlyDiff(t)?this.liveSocket.time("component patch complete",()=>{lt.findParentCIDs(this.el,this.rendered.componentCIDs(t)).forEach(e=>{this.componentPatch(this.rendered.getComponent(t,e),e)&&(n=!0)})}):nt(t)||this.liveSocket.time("full patch complete",()=>{let[e,i]=this.renderContainer(t,"update"),r=new Ct(this,this.el,this.id,e,i,null);n=this.performPatch(r,!0)}),this.liveSocket.dispatchEvents(e),n&&this.joinNewChildren()}renderContainer(t,e){return this.liveSocket.time(`toString diff (${e})`,()=>{let e=this.el.tagName,n=t?this.rendered.componentCIDs(t).concat(this.pruningCIDs):null,[i,r]=this.rendered.toString(n);return[`<${e}>${i}</${e}>`,r]})}componentPatch(t,e){if(nt(t))return!1;let[n,i]=this.rendered.componentToString(e),r=new Ct(this,this.el,this.id,n,i,e);return this.performPatch(r,!0)}getHook(t){return this.viewHooks[Tt.elementID(t)]}addHook(t){if(Tt.elementID(t)||!t.getAttribute)return;let e=t.getAttribute("data-phx-hook")||t.getAttribute(this.binding("hook"));if(e&&!this.ownsElement(t))return;let n=this.liveSocket.getHookCallbacks(e);if(n){t.id||X(`no DOM ID for hook "${e}". Hooks require a unique ID on each element.`,t);let i=new Tt(this,t,n);return this.viewHooks[Tt.elementID(i.el)]=i,i}null!==e&&X(`unknown hook found for "${e}"`,t)}destroyHook(t){t.__destroyed(),t.__cleanup__(),delete this.viewHooks[Tt.elementID(t.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:t,events:e})=>this.update(t,e)),this.pendingDiffs=[],this.eachChild(t=>t.applyPendingUpdates())}eachChild(t){let e=this.root.children[this.id]||{};for(let n in e)t(this.getChildById(n))}onChannel(t,e){this.liveSocket.onChannel(this.channel,t,t=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>e(t)]):this.liveSocket.requestDOMUpdate(()=>e(t))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",t=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",t,({diff:t,events:e})=>this.update(t,e))})}),this.onChannel("redirect",({to:t,flash:e})=>this.onRedirect({to:t,flash:e})),this.onChannel("live_patch",t=>this.onLivePatch(t)),this.onChannel("live_redirect",t=>this.onLiveRedirect(t)),this.channel.onError(t=>this.onError(t)),this.channel.onClose(t=>this.onClose(t))}destroyAllChildren(){this.eachChild(t=>t.destroy())}onLiveRedirect(t){let{to:e,kind:n,flash:i}=t,r=this.expandURL(e);this.liveSocket.historyRedirect(r,n,i)}onLivePatch(t){let{to:e,kind:n}=t;this.href=this.expandURL(e),this.liveSocket.historyPatch(e,n)}expandURL(t){return t.startsWith("/")?`${window.location.protocol}//${window.location.host}${t}`:t}onRedirect({to:t,flash:e}){this.liveSocket.redirect(t,e)}isDestroyed(){return this.destroyed}joinDead(){this.isDead=!0}join(t){this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel(),this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=e=>{e=e||function(){},t?t(this.joinCount,e):e()},this.liveSocket.wrapPush(this,{timeout:!1},()=>this.channel.join().receive("ok",t=>{this.isDestroyed()||this.liveSocket.requestDOMUpdate(()=>this.onJoin(t))}).receive("error",t=>!this.isDestroyed()&&this.onJoinError(t)).receive("timeout",()=>!this.isDestroyed()&&this.onJoinError({reason:"timeout"})))}onJoinError(t){return"reload"===t.reason?(this.log("error",()=>[`failed mount with ${t.status}. Falling back to page request`,t]),this.onRedirect({to:this.href})):"unauthorized"===t.reason||"stale"===t.reason?(this.log("error",()=>["unauthorized live_redirect. Falling back to page request",t]),this.onRedirect({to:this.href})):((t.redirect||t.live_redirect)&&(this.joinPending=!1,this.channel.leave()),t.redirect?this.onRedirect(t.redirect):t.live_redirect?this.onLiveRedirect(t.live_redirect):(this.log("error",()=>["unable to join",t]),void(this.liveSocket.isConnected()&&this.liveSocket.reloadWithJitter(this))))}onClose(t){if(!this.isDestroyed()){if(this.liveSocket.hasPendingLink()&&"leave"!==t)return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(200)}}onError(t){this.onClose(t),this.liveSocket.isConnected()&&this.log("error",()=>["view crashed",t]),this.liveSocket.isUnloaded()||this.displayError()}displayError(){this.isMain()&<.dispatchEvent(window,"phx:page-loading-start",{detail:{to:this.href,kind:"error"}}),this.showLoader(),this.setContainerClasses("phx-loading","phx-error"),this.execAll(this.binding("disconnected"))}pushWithReply(t,e,n,i=function(){}){if(!this.isConnected())return;let[r,[s],o]=t?t():[null,[],{}],a=function(){};return(o.page_loading||s&&null!==s.getAttribute(this.binding("page-loading")))&&(a=this.liveSocket.withPageLoading({kind:"element",target:s})),"number"!=typeof n.cid&&delete n.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(e,n,3e4).receive("ok",t=>{let e=e=>{t.redirect&&this.onRedirect(t.redirect),t.live_patch&&this.onLivePatch(t.live_patch),t.live_redirect&&this.onLiveRedirect(t.live_redirect),null!==r&&this.undoRefs(r),a(),i(t,e)};t.diff?this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",t.diff,({diff:t,reply:n,events:i})=>{this.update(t,i),e(n)})}):e(null)}))}undoRefs(t){this.isConnected()&<.all(document,`[${P}="${this.id}"][${D}="${t}"]`,t=>{let e=t.getAttribute("data-phx-disabled");t.removeAttribute(D),t.removeAttribute(P),null!==t.getAttribute("data-phx-readonly")&&(t.readOnly=!1,t.removeAttribute("data-phx-readonly")),null!==e&&(t.disabled="true"===e,t.removeAttribute("data-phx-disabled")),M.forEach(e=>lt.removeClass(t,e));let n=t.getAttribute("data-phx-disable-with-restore");null!==n&&(t.innerText=n,t.removeAttribute("data-phx-disable-with-restore"));let i=lt.private(t,D);if(i){let e=this.triggerBeforeUpdateHook(t,i);Ct.patchEl(t,i,this.liveSocket.getActiveElement()),e&&e.__updated(),lt.deletePrivate(t,D)}})}putRef(t,e,n={}){let i=this.ref++,r=this.binding("disable-with");return n.loading&&(t=t.concat(lt.all(document,n.loading))),t.forEach(t=>{t.classList.add(`phx-${e}-loading`),t.setAttribute(D,i),t.setAttribute(P,this.el.id);let n=t.getAttribute(r);null!==n&&(t.getAttribute("data-phx-disable-with-restore")||t.setAttribute("data-phx-disable-with-restore",t.innerText),""!==n&&(t.innerText=n),t.setAttribute("disabled",""))}),[i,t,n]}componentID(t){let e=t.getAttribute&&t.getAttribute(L);return e?parseInt(e):null}targetComponentID(t,e,n={}){if(G(e))return e;let i=t.getAttribute(this.binding("target"));return G(i)?parseInt(i):e&&(null!==i||n.target)?this.closestComponentID(e):null}closestComponentID(t){return G(t)?t:t?it(t.closest(`[${L}]`),t=>this.ownsElement(t)&&this.componentID(t)):null}pushHookEvent(t,e,n,i){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",e,n]),!1;let[r,s,o]=this.putRef([],"hook");return this.pushWithReply(()=>[r,s,o],"event",{type:"hook",event:e,value:n,cid:this.closestComponentID(t)},(t,e)=>i(e,r)),r}extractMeta(t,e,n){let i=this.binding("value-");for(let n=0;n<t.attributes.length;n++){e||(e={});let r=t.attributes[n].name;r.startsWith(i)&&(e[r.replace(i,"")]=t.getAttribute(r))}if(void 0!==t.value&&(e||(e={}),e.value=t.value,"INPUT"===t.tagName&&U.indexOf(t.type)>=0&&!t.checked&&delete e.value),n){e||(e={});for(let t in n)e[t]=n[t]}return e}pushEvent(t,e,n,i,r,s={}){this.pushWithReply(()=>this.putRef([e],t,s),"event",{type:t,event:i,value:this.extractMeta(e,r,s.value),cid:this.targetComponentID(e,n,s)})}pushFileProgress(t,e,n,i=function(){}){this.liveSocket.withinOwners(t.form,(r,s)=>{r.pushWithReply(null,"progress",{event:t.getAttribute(r.binding("progress")),ref:t.getAttribute(N),entry_ref:e,progress:n,cid:r.targetComponentID(t.form,s)},i)})}pushInput(t,e,n,i,r,s){let o,a,l=G(n)?n:this.targetComponentID(t.form,e),h=()=>this.putRef([t,t.form],"change",r);a=t.getAttribute(this.binding("change"))?Dt(t.form,{_target:r._target},[t.name]):Dt(t.form,{_target:r._target}),lt.isUploadInput(t)&&t.files&&t.files.length>0&&ct.trackFiles(t,Array.from(t.files)),o=ct.serializeUploads(t);let u={type:"form",event:i,value:a,uploads:o,cid:l};this.pushWithReply(h,"event",u,n=>{if(lt.showError(t,this.liveSocket.binding("feedback-for")),lt.isUploadInput(t)&&null!==t.getAttribute("data-phx-auto-upload")){if(ct.filesAwaitingPreflight(t).length>0){let[i,r]=h();this.uploadFiles(t.form,e,i,l,e=>{s&&s(n),this.triggerAwaitingSubmit(t.form)})}}else s&&s(n)})}triggerAwaitingSubmit(t){let e=this.getScheduledSubmit(t);if(e){let[n,i,r,s]=e;this.cancelSubmit(t),s()}}getScheduledSubmit(t){return this.formSubmits.find(([e,n,i,r])=>e.isSameNode(t))}scheduleSubmit(t,e,n,i){if(this.getScheduledSubmit(t))return!0;this.formSubmits.push([t,e,n,i])}cancelSubmit(t){this.formSubmits=this.formSubmits.filter(([e,n,i])=>!e.isSameNode(t)||(this.undoRefs(n),!1))}disableForm(t,e={}){let n=t=>!(tt(t,this.binding("update")+"=ignore",t.form)||tt(t,"data-phx-update=ignore",t.form)),i=Array.from(t.elements),r=i.filter(t=>t.hasAttribute(this.binding("disable-with"))),s=i.filter(t=>"BUTTON"==t.tagName).filter(n),o=i.filter(t=>["INPUT","TEXTAREA","SELECT"].includes(t.tagName)).filter(n);return s.forEach(t=>{t.setAttribute("data-phx-disabled",t.disabled),t.disabled=!0}),o.forEach(t=>{t.setAttribute("data-phx-readonly",t.readOnly),t.readOnly=!0,t.files&&(t.setAttribute("data-phx-disabled",t.disabled),t.disabled=!0)}),t.setAttribute(this.binding("page-loading"),""),this.putRef([t].concat(r).concat(s).concat(o),"submit",e)}pushFormSubmit(t,e,n,i,r,s){let o=()=>this.disableForm(t,r),a=this.targetComponentID(t,e);if(ct.hasUploadsInProgress(t)){let[a,l]=o(),h=()=>this.pushFormSubmit(t,i,e,n,r,s);return this.scheduleSubmit(t,a,r,h)}if(ct.inputsAwaitingPreflight(t).length>0){let[l,h]=o(),u=()=>[l,h,r];this.uploadFiles(t,e,l,a,e=>{let r=Dt(t,{submitter:i});this.pushWithReply(u,"event",{type:"form",event:n,value:r,cid:a},s)})}else{let e=Dt(t,{submitter:i});this.pushWithReply(o,"event",{type:"form",event:n,value:e,cid:a},s)}}uploadFiles(t,e,n,i,r){let s=this.joinCount,o=ct.activeFileInputs(t),a=o.length;o.forEach(t=>{let i=new ct(t,this,()=>{a--,0===a&&r()});this.uploaders[t]=i;let o=i.entries().map(t=>t.toPreflightPayload()),l={ref:t.getAttribute(N),entries:o,cid:this.targetComponentID(t.form,e)};this.log("upload",()=>["sending preflight request",l]),this.pushWithReply(null,"allow_upload",l,t=>{if(this.log("upload",()=>["got preflight response",t]),t.error){this.undoRefs(n);let[e,i]=t.error;this.log("upload",()=>["error for entry "+e,i])}else{let e=t=>{this.channel.onError(()=>{this.joinCount===s&&t()})};i.initAdapterUpload(t,e,this.liveSocket)}})})}dispatchUploads(t,e){let n=lt.findUploadInputs(this.el).filter(e=>e.name===t);0===n.length?X(`no live file inputs found matching the name "${t}"`):n.length>1?X(`duplicate live file inputs found matching the name "${t}"`):lt.dispatchEvent(n[0],"track-uploads",{detail:{files:e}})}pushFormRecovery(t,e,n){this.liveSocket.withinOwners(t,(i,r)=>{let s=Array.from(t.elements).find(t=>lt.isFormInput(t)&&"hidden"!==t.type&&!t.hasAttribute(this.binding("change"))),o=t.getAttribute(this.binding("auto-recover"))||t.getAttribute(this.binding("change"));Lt.exec("change",o,i,s,["push",{_target:s.name,newCid:e,callback:n}])})}pushLinkPatch(t,e,n){let i=this.liveSocket.setPendingLink(t),r=e?()=>this.putRef([e],"click"):null,s=()=>this.liveSocket.redirect(window.location.href),o=this.pushWithReply(r,"live_patch",{url:t},e=>{this.liveSocket.requestDOMUpdate(()=>{e.link_redirect?this.liveSocket.replaceMain(t,null,n,i):(this.liveSocket.commitPendingLink(i)&&(this.href=t),this.applyPendingUpdates(),n&&n(i))})});o?o.receive("timeout",s):s()}formsForRecovery(t){if(0===this.joinCount)return[];let e=this.binding("change"),n=document.createElement("template");return n.innerHTML=t,lt.all(this.el,`form[${e}]`).filter(t=>t.id&&this.ownsElement(t)).filter(t=>t.elements.length>0).filter(t=>"ignore"!==t.getAttribute(this.binding("auto-recover"))).map(t=>{let i=n.content.querySelector(`form[id="${t.id}"][${e}="${t.getAttribute(e)}"]`);return i?[t,i,this.targetComponentID(i)]:[t,null,null]}).filter(([t,e,n])=>e)}maybePushComponentsDestroyed(t){let e=t.filter(t=>0===lt.findComponentNodeList(this.el,t).length);e.length>0&&(this.pruningCIDs.push(...e),this.pushWithReply(null,"cids_will_destroy",{cids:e},()=>{this.pruningCIDs=this.pruningCIDs.filter(t=>-1!==e.indexOf(t));let t=e.filter(t=>0===lt.findComponentNodeList(this.el,t).length);t.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:t},t=>{this.rendered.pruneCIDs(t.cids)})}))}ownsElement(t){let e=t.closest($);return t.getAttribute(R)===this.id||e&&e.id===this.id||!e&&this.isDead}submitForm(t,e,n,i,r={}){lt.putPrivate(t,"phx-has-submitted",!0);let s=this.liveSocket.binding("feedback-for"),o=Array.from(t.elements);o.forEach(t=>lt.putPrivate(t,"phx-has-submitted",!0)),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(t,e,n,i,r,()=>{o.forEach(t=>lt.showError(t,s)),this.liveSocket.restorePreviouslyActiveFocus()})}binding(t){return this.liveSocket.binding(t)}},Nt=class{constructor(){this.transitions=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(t=>{clearTimeout(t),this.transitions.delete(t)}),this.flushPendingOps()}after(t){0===this.size()?t():this.pushPendingOp(t)}addTransition(t,e,n){e();let i=setTimeout(()=>{this.transitions.delete(i),n(),this.flushPendingOps()},t);this.transitions.add(i)}pushPendingOp(t){this.pendingOps.push(t)}size(){return this.transitions.size}flushPendingOps(){if(this.size()>0)return;let t=this.pendingOps.shift();t&&(t(),this.flushPendingOps())}};function Rt(t){return t}function It(t){return"translate("+t+",0)"}function Ft(t){return"translate(0,"+t+")"}function Ut(t){return e=>+t(e)}function Ot(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function $t(){return!this.__axis}function Ht(t,e){var n=[],i=null,r=null,s=6,o=6,a=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,h=1===t||4===t?-1:1,u=4===t||2===t?"x":"y",c=1===t||3===t?It:Ft;function d(d){var f=null==i?e.ticks?e.ticks.apply(e,n):e.domain():i,p=null==r?e.tickFormat?e.tickFormat.apply(e,n):Rt:r,g=Math.max(s,0)+a,m=e.range(),v=+m[0]+l,y=+m[m.length-1]+l,b=(e.bandwidth?Ot:Ut)(e.copy(),l),w=d.selection?d.selection():d,k=w.selectAll(".domain").data([null]),_=w.selectAll(".tick").data(f,e).order(),x=_.exit(),E=_.enter().append("g").attr("class","tick"),C=_.select("line"),A=_.select("text");k=k.merge(k.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),_=_.merge(E),C=C.merge(E.append("line").attr("stroke","currentColor").attr(u+"2",h*s)),A=A.merge(E.append("text").attr("fill","currentColor").attr(u,h*g).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),d!==w&&(k=k.transition(d),_=_.transition(d),C=C.transition(d),A=A.transition(d),x=x.transition(d).attr("opacity",1e-6).attr("transform",(function(t){return isFinite(t=b(t))?c(t+l):this.getAttribute("transform")})),E.attr("opacity",1e-6).attr("transform",(function(t){var e=this.parentNode.__axis;return c((e&&isFinite(e=e(t))?e:b(t))+l)}))),x.remove(),k.attr("d",4===t||2===t?o?"M"+h*o+","+v+"H"+l+"V"+y+"H"+h*o:"M"+l+","+v+"V"+y:o?"M"+v+","+h*o+"V"+l+"H"+y+"V"+h*o:"M"+v+","+l+"H"+y),_.attr("opacity",1).attr("transform",(function(t){return c(b(t)+l)})),C.attr(u+"2",h*s),A.attr(u,h*g).text(p),w.filter($t).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),w.each((function(){this.__axis=b}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),d):n.slice()},d.tickValues=function(t){return arguments.length?(i=null==t?null:Array.from(t),d):i&&i.slice()},d.tickFormat=function(t){return arguments.length?(r=t,d):r},d.tickSize=function(t){return arguments.length?(s=o=+t,d):s},d.tickSizeInner=function(t){return arguments.length?(s=+t,d):s},d.tickSizeOuter=function(t){return arguments.length?(o=+t,d):o},d.tickPadding=function(t){return arguments.length?(a=+t,d):a},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function jt(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Bt(t){let e=t,n=t,i=t;function r(t,e,r=0,s=t.length){if(r<s){if(0!==n(e,e))return s;do{const n=r+s>>>1;i(t[n],e)<0?r=n+1:s=n}while(r<s)}return r}return 1===t.length&&(e=(e,n)=>t(e)-n,n=jt,i=(e,n)=>jt(t(e),n)),{left:r,center:function(t,n,i=0,s=t.length){const o=r(t,n,i,s-1);return o>i&&e(t[o-1],n)>-e(t[o],n)?o-1:o},right:function(t,e,r=0,s=t.length){if(r<s){if(0!==n(e,e))return s;do{const n=r+s>>>1;i(t[n],e)<=0?r=n+1:s=n}while(r<s)}return r}}}var qt=Math.sqrt(50),Jt=Math.sqrt(10),Vt=Math.sqrt(2);function Wt(t,e,n){var i=(e-t)/Math.max(0,n),r=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,r);return r>=0?(s>=qt?10:s>=Jt?5:s>=Vt?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(s>=qt?10:s>=Jt?5:s>=Vt?2:1)}function zt(t,e,n){var i=Math.abs(e-t)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),s=i/r;return s>=qt?r*=10:s>=Jt?r*=5:s>=Vt&&(r*=2),e<t?-r:r}var Yt=new Date,Xt=new Date;function Gt(t,e,n,i){function r(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return r.floor=function(e){return t(e=new Date(+e)),e},r.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},r.round=function(t){var e=r(t),n=r.ceil(t);return t-e<n-t?e:n},r.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},r.range=function(n,i,s){var o,a=[];if(n=r.ceil(n),s=null==s?1:Math.floor(s),!(n<i&&s>0))return a;do{a.push(o=new Date(+n)),e(n,s),t(n)}while(o<n&&n<i);return a},r.filter=function(n){return Gt((function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,i){if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););}))},n&&(r.count=function(e,i){return Yt.setTime(+e),Xt.setTime(+i),t(Yt),t(Xt),Math.floor(n(Yt,Xt))},r.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(i?function(e){return i(e)%t==0}:function(e){return r.count(0,e)%t==0}):r:null}),r}var Kt=Gt((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));Kt.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Gt((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):Kt:null};const Zt=Kt;Kt.range;var Qt=Gt((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()}));const te=Qt;Qt.range;var ee=Gt((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()}));const ne=ee;ee.range;var ie=Gt((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()}));const re=ie;ie.range;var se=Gt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5,t=>t.getDate()-1);const oe=se;se.range;function ae(t){return Gt((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var le=ae(0),he=ae(1),ue=ae(2),ce=ae(3),de=ae(4),fe=ae(5),pe=ae(6),ge=(le.range,he.range,ue.range,ce.range,de.range,fe.range,pe.range,Gt((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})));const me=ge;ge.range;var ve=Gt((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));ve.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Gt((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};const ye=ve;ve.range;var be=Gt((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()}));const we=be;be.range;var ke=Gt((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()}));const _e=ke;ke.range;var xe=Gt((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1}));const Ee=xe;xe.range;function Ce(t){return Gt((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var Ae=Ce(0),Se=Ce(1),Te=Ce(2),Me=Ce(3),Le=Ce(4),De=Ce(5),Pe=Ce(6),Ne=(Ae.range,Se.range,Te.range,Me.range,Le.range,De.range,Pe.range,Gt((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})));const Re=Ne;Ne.range;var Ie=Gt((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));Ie.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Gt((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};const Fe=Ie;Ie.range;function Ue(t,e,n,i,r,s){const o=[[te,1,1e3],[te,5,5e3],[te,15,15e3],[te,30,3e4],[s,1,6e4],[s,5,3e5],[s,15,9e5],[s,30,18e5],[r,1,36e5],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,864e5],[i,2,1728e5],[n,1,6048e5],[e,1,2592e6],[e,3,7776e6],[t,1,31536e6]];function a(e,n,i){const r=Math.abs(n-e)/i,s=Bt(([,,t])=>t).right(o,r);if(s===o.length)return t.every(zt(e/31536e6,n/31536e6,i));if(0===s)return Zt.every(Math.max(zt(e,n,i),1));const[a,l]=o[r/o[s-1][2]<o[s][2]/r?s-1:s];return a.every(l)}return[function(t,e,n){const i=e<t;i&&([t,e]=[e,t]);const r=n&&"function"==typeof n.range?n:a(t,e,n),s=r?r.range(t,+e+1):[];return i?s.reverse():s},a]}const[Oe,$e]=Ue(Fe,Re,Ae,Ee,_e,we),[He,je]=Ue(ye,me,le,oe,re,ne);function Be(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function qe(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Je(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}var Ve,We,ze={"-":"",_:" ",0:"0"},Ye=/^\s*\d+/,Xe=/^%/,Ge=/[\\^$*+?|[\]().{}]/g;function Ke(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",s=r.length;return i+(s<n?new Array(n-s+1).join(e)+r:r)}function Ze(t){return t.replace(Ge,"\\$&")}function Qe(t){return new RegExp("^(?:"+t.map(Ze).join("|")+")","i")}function tn(t){return new Map(t.map((t,e)=>[t.toLowerCase(),e]))}function en(t,e,n){var i=Ye.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function nn(t,e,n){var i=Ye.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function rn(t,e,n){var i=Ye.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function sn(t,e,n){var i=Ye.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function on(t,e,n){var i=Ye.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function an(t,e,n){var i=Ye.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function ln(t,e,n){var i=Ye.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function hn(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function un(t,e,n){var i=Ye.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function cn(t,e,n){var i=Ye.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function dn(t,e,n){var i=Ye.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function fn(t,e,n){var i=Ye.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function pn(t,e,n){var i=Ye.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function gn(t,e,n){var i=Ye.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function mn(t,e,n){var i=Ye.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function vn(t,e,n){var i=Ye.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function yn(t,e,n){var i=Ye.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function bn(t,e,n){var i=Xe.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function wn(t,e,n){var i=Ye.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function kn(t,e,n){var i=Ye.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function _n(t,e){return Ke(t.getDate(),e,2)}function xn(t,e){return Ke(t.getHours(),e,2)}function En(t,e){return Ke(t.getHours()%12||12,e,2)}function Cn(t,e){return Ke(1+oe.count(ye(t),t),e,3)}function An(t,e){return Ke(t.getMilliseconds(),e,3)}function Sn(t,e){return An(t,e)+"000"}function Tn(t,e){return Ke(t.getMonth()+1,e,2)}function Mn(t,e){return Ke(t.getMinutes(),e,2)}function Ln(t,e){return Ke(t.getSeconds(),e,2)}function Dn(t){var e=t.getDay();return 0===e?7:e}function Pn(t,e){return Ke(le.count(ye(t)-1,t),e,2)}function Nn(t){var e=t.getDay();return e>=4||0===e?de(t):de.ceil(t)}function Rn(t,e){return t=Nn(t),Ke(de.count(ye(t),t)+(4===ye(t).getDay()),e,2)}function In(t){return t.getDay()}function Fn(t,e){return Ke(he.count(ye(t)-1,t),e,2)}function Un(t,e){return Ke(t.getFullYear()%100,e,2)}function On(t,e){return Ke((t=Nn(t)).getFullYear()%100,e,2)}function $n(t,e){return Ke(t.getFullYear()%1e4,e,4)}function Hn(t,e){var n=t.getDay();return Ke((t=n>=4||0===n?de(t):de.ceil(t)).getFullYear()%1e4,e,4)}function jn(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Ke(e/60|0,"0",2)+Ke(e%60,"0",2)}function Bn(t,e){return Ke(t.getUTCDate(),e,2)}function qn(t,e){return Ke(t.getUTCHours(),e,2)}function Jn(t,e){return Ke(t.getUTCHours()%12||12,e,2)}function Vn(t,e){return Ke(1+Ee.count(Fe(t),t),e,3)}function Wn(t,e){return Ke(t.getUTCMilliseconds(),e,3)}function zn(t,e){return Wn(t,e)+"000"}function Yn(t,e){return Ke(t.getUTCMonth()+1,e,2)}function Xn(t,e){return Ke(t.getUTCMinutes(),e,2)}function Gn(t,e){return Ke(t.getUTCSeconds(),e,2)}function Kn(t){var e=t.getUTCDay();return 0===e?7:e}function Zn(t,e){return Ke(Ae.count(Fe(t)-1,t),e,2)}function Qn(t){var e=t.getUTCDay();return e>=4||0===e?Le(t):Le.ceil(t)}function ti(t,e){return t=Qn(t),Ke(Le.count(Fe(t),t)+(4===Fe(t).getUTCDay()),e,2)}function ei(t){return t.getUTCDay()}function ni(t,e){return Ke(Se.count(Fe(t)-1,t),e,2)}function ii(t,e){return Ke(t.getUTCFullYear()%100,e,2)}function ri(t,e){return Ke((t=Qn(t)).getUTCFullYear()%100,e,2)}function si(t,e){return Ke(t.getUTCFullYear()%1e4,e,4)}function oi(t,e){var n=t.getUTCDay();return Ke((t=n>=4||0===n?Le(t):Le.ceil(t)).getUTCFullYear()%1e4,e,4)}function ai(){return"+0000"}function li(){return"%"}function hi(t){return+t}function ui(t){return Math.floor(+t/1e3)}Ve=function(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,s=t.days,o=t.shortDays,a=t.months,l=t.shortMonths,h=Qe(r),u=tn(r),c=Qe(s),d=tn(s),f=Qe(o),p=tn(o),g=Qe(a),m=tn(a),v=Qe(l),y=tn(l),b={a:function(t){return o[t.getDay()]},A:function(t){return s[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return a[t.getMonth()]},c:null,d:_n,e:_n,f:Sn,g:On,G:Hn,H:xn,I:En,j:Cn,L:An,m:Tn,M:Mn,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:hi,s:ui,S:Ln,u:Dn,U:Pn,V:Rn,w:In,W:Fn,x:null,X:null,y:Un,Y:$n,Z:jn,"%":li},w={a:function(t){return o[t.getUTCDay()]},A:function(t){return s[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return a[t.getUTCMonth()]},c:null,d:Bn,e:Bn,f:zn,g:ri,G:oi,H:qn,I:Jn,j:Vn,L:Wn,m:Yn,M:Xn,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:hi,s:ui,S:Gn,u:Kn,U:Zn,V:ti,w:ei,W:ni,x:null,X:null,y:ii,Y:si,Z:ai,"%":li},k={a:function(t,e,n){var i=f.exec(e.slice(n));return i?(t.w=p.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(t,e,n){var i=c.exec(e.slice(n));return i?(t.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){var i=v.exec(e.slice(n));return i?(t.m=y.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){var i=g.exec(e.slice(n));return i?(t.m=m.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,n,i){return E(t,e,n,i)},d:dn,e:dn,f:yn,g:ln,G:an,H:pn,I:pn,j:fn,L:vn,m:cn,M:gn,p:function(t,e,n){var i=h.exec(e.slice(n));return i?(t.p=u.get(i[0].toLowerCase()),n+i[0].length):-1},q:un,Q:wn,s:kn,S:mn,u:nn,U:rn,V:sn,w:en,W:on,x:function(t,e,i){return E(t,n,e,i)},X:function(t,e,n){return E(t,i,e,n)},y:ln,Y:an,Z:hn,"%":bn};function _(t,e){return function(n){var i,r,s,o=[],a=-1,l=0,h=t.length;for(n instanceof Date||(n=new Date(+n));++a<h;)37===t.charCodeAt(a)&&(o.push(t.slice(l,a)),null!=(r=ze[i=t.charAt(++a)])?i=t.charAt(++a):r="e"===i?" ":"0",(s=e[i])&&(i=s(n,r)),o.push(i),l=a+1);return o.push(t.slice(l,a)),o.join("")}}function x(t,e){return function(n){var i,r,s=Je(1900,void 0,1);if(E(s,t,n+="",0)!=n.length)return null;if("Q"in s)return new Date(s.Q);if("s"in s)return new Date(1e3*s.s+("L"in s?s.L:0));if(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"V"in s){if(s.V<1||s.V>53)return null;"w"in s||(s.w=1),"Z"in s?(r=(i=qe(Je(s.y,0,1))).getUTCDay(),i=r>4||0===r?Se.ceil(i):Se(i),i=Ee.offset(i,7*(s.V-1)),s.y=i.getUTCFullYear(),s.m=i.getUTCMonth(),s.d=i.getUTCDate()+(s.w+6)%7):(r=(i=Be(Je(s.y,0,1))).getDay(),i=r>4||0===r?he.ceil(i):he(i),i=oe.offset(i,7*(s.V-1)),s.y=i.getFullYear(),s.m=i.getMonth(),s.d=i.getDate()+(s.w+6)%7)}else("W"in s||"U"in s)&&("w"in s||(s.w="u"in s?s.u%7:"W"in s?1:0),r="Z"in s?qe(Je(s.y,0,1)).getUTCDay():Be(Je(s.y,0,1)).getDay(),s.m=0,s.d="W"in s?(s.w+6)%7+7*s.W-(r+5)%7:s.w+7*s.U-(r+6)%7);return"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,qe(s)):Be(s)}}function E(t,e,n,i){for(var r,s,o=0,a=e.length,l=n.length;o<a;){if(i>=l)return-1;if(37===(r=e.charCodeAt(o++))){if(r=e.charAt(o++),!(s=k[r in ze?e.charAt(o++):r])||(i=s(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return b.x=_(n,b),b.X=_(i,b),b.c=_(e,b),w.x=_(n,w),w.X=_(i,w),w.c=_(e,w),{format:function(t){var e=_(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=x(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=_(t+="",w);return e.toString=function(){return t},e},utcParse:function(t){var e=x(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),We=Ve.format,Ve.parse,Ve.utcFormat,Ve.utcParse;const ci=Bt(jt),di=ci.right,fi=(ci.left,Bt((function(t){return null===t?NaN:+t})).center,di);function pi(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function gi(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function mi(){}var vi="\\s*([+-]?\\d+)\\s*",yi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",bi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",wi=/^#([0-9a-f]{3,8})$/,ki=new RegExp(`^rgb\\(${vi},${vi},${vi}\\)$`),_i=new RegExp(`^rgb\\(${bi},${bi},${bi}\\)$`),xi=new RegExp(`^rgba\\(${vi},${vi},${vi},${yi}\\)$`),Ei=new RegExp(`^rgba\\(${bi},${bi},${bi},${yi}\\)$`),Ci=new RegExp(`^hsl\\(${yi},${bi},${bi}\\)$`),Ai=new RegExp(`^hsla\\(${yi},${bi},${bi},${yi}\\)$`),Si={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ti(){return this.rgb().formatHex()}function Mi(){return this.rgb().formatRgb()}function Li(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=wi.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Di(e):3===n?new Ii(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Pi(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Pi(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=ki.exec(t))?new Ii(e[1],e[2],e[3],1):(e=_i.exec(t))?new Ii(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=xi.exec(t))?Pi(e[1],e[2],e[3],e[4]):(e=Ei.exec(t))?Pi(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ci.exec(t))?ji(e[1],e[2]/100,e[3]/100,1):(e=Ai.exec(t))?ji(e[1],e[2]/100,e[3]/100,e[4]):Si.hasOwnProperty(t)?Di(Si[t]):"transparent"===t?new Ii(NaN,NaN,NaN,0):null}function Di(t){return new Ii(t>>16&255,t>>8&255,255&t,1)}function Pi(t,e,n,i){return i<=0&&(t=e=n=NaN),new Ii(t,e,n,i)}function Ni(t){return t instanceof mi||(t=Li(t)),t?new Ii((t=t.rgb()).r,t.g,t.b,t.opacity):new Ii}function Ri(t,e,n,i){return 1===arguments.length?Ni(t):new Ii(t,e,n,null==i?1:i)}function Ii(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function Fi(){return`#${Hi(this.r)}${Hi(this.g)}${Hi(this.b)}`}function Ui(){const t=Oi(this.opacity);return`${1===t?"rgb(":"rgba("}${$i(this.r)}, ${$i(this.g)}, ${$i(this.b)}${1===t?")":`, ${t})`}`}function Oi(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function $i(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Hi(t){return((t=$i(t))<16?"0":"")+t.toString(16)}function ji(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new qi(t,e,n,i)}function Bi(t){if(t instanceof qi)return new qi(t.h,t.s,t.l,t.opacity);if(t instanceof mi||(t=Li(t)),!t)return new qi;if(t instanceof qi)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),s=Math.max(e,n,i),o=NaN,a=s-r,l=(s+r)/2;return a?(o=e===s?(n-i)/a+6*(n<i):n===s?(i-e)/a+2:(e-n)/a+4,a/=l<.5?s+r:2-s-r,o*=60):a=l>0&&l<1?0:o,new qi(o,a,l,t.opacity)}function qi(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function Ji(t){return(t=(t||0)%360)<0?t+360:t}function Vi(t){return Math.max(0,Math.min(1,t||0))}function Wi(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function zi(t,e,n,i,r){var s=t*t,o=s*t;return((1-3*t+3*s-o)*e+(4-6*s+3*o)*n+(1+3*t+3*s-3*o)*i+o*r)/6}pi(mi,Li,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ti,formatHex:Ti,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Bi(this).formatHsl()},formatRgb:Mi,toString:Mi}),pi(Ii,Ri,gi(mi,{brighter(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Ii(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new Ii(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ii($i(this.r),$i(this.g),$i(this.b),Oi(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Fi,formatHex:Fi,formatHex8:function(){return`#${Hi(this.r)}${Hi(this.g)}${Hi(this.b)}${Hi(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ui,toString:Ui})),pi(qi,(function(t,e,n,i){return 1===arguments.length?Bi(t):new qi(t,e,n,null==i?1:i)}),gi(mi,{brighter(t){return t=null==t?1/.7:Math.pow(1/.7,t),new qi(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new qi(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Ii(Wi(t>=240?t-240:t+120,r,i),Wi(t,r,i),Wi(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new qi(Ji(this.h),Vi(this.s),Vi(this.l),Oi(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Oi(this.opacity);return`${1===t?"hsl(":"hsla("}${Ji(this.h)}, ${100*Vi(this.s)}%, ${100*Vi(this.l)}%${1===t?")":`, ${t})`}`}}));const Yi=t=>()=>t;function Xi(t,e){return function(n){return t+n*e}}function Gi(t){return 1==(t=+t)?Ki:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):Yi(isNaN(e)?n:e)}}function Ki(t,e){var n=e-t;return n?Xi(t,n):Yi(isNaN(t)?e:t)}const Zi=function t(e){var n=Gi(e);function i(t,e){var i=n((t=Ri(t)).r,(e=Ri(e)).r),r=n(t.g,e.g),s=n(t.b,e.b),o=Ki(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=s(e),t.opacity=o(e),t+""}}return i.gamma=t,i}(1);function Qi(t){return function(e){var n,i,r=e.length,s=new Array(r),o=new Array(r),a=new Array(r);for(n=0;n<r;++n)i=Ri(e[n]),s[n]=i.r||0,o[n]=i.g||0,a[n]=i.b||0;return s=t(s),o=t(o),a=t(a),i.opacity=1,function(t){return i.r=s(t),i.g=o(t),i.b=a(t),i+""}}}Qi((function(t){var e=t.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),r=t[i],s=t[i+1],o=i>0?t[i-1]:2*r-s,a=i<e-1?t[i+2]:2*s-r;return zi((n-i/e)*e,o,r,s,a)}})),Qi((function(t){var e=t.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*e),r=t[(i+e-1)%e],s=t[i%e],o=t[(i+1)%e],a=t[(i+2)%e];return zi((n-i/e)*e,r,s,o,a)}}));function tr(t,e){var n,i=e?e.length:0,r=t?Math.min(i,t.length):0,s=new Array(r),o=new Array(i);for(n=0;n<r;++n)s[n]=lr(t[n],e[n]);for(;n<i;++n)o[n]=e[n];return function(t){for(n=0;n<r;++n)o[n]=s[n](t);return o}}function er(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function nr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function ir(t,e){var n,i={},r={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?i[n]=lr(t[n],e[n]):r[n]=e[n];return function(t){for(n in i)r[n]=i[n](t);return r}}var rr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sr=new RegExp(rr.source,"g");function or(t,e){var n,i,r,s=rr.lastIndex=sr.lastIndex=0,o=-1,a=[],l=[];for(t+="",e+="";(n=rr.exec(t))&&(i=sr.exec(e));)(r=i.index)>s&&(r=e.slice(s,r),a[o]?a[o]+=r:a[++o]=r),(n=n[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:nr(n,i)})),s=sr.lastIndex;return s<e.length&&(r=e.slice(s),a[o]?a[o]+=r:a[++o]=r),a.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,i=0;i<e;++i)a[(n=l[i]).i]=n.x(t);return a.join("")})}function ar(t,e){e||(e=[]);var n,i=t?Math.min(e.length,t.length):0,r=e.slice();return function(s){for(n=0;n<i;++n)r[n]=t[n]*(1-s)+e[n]*s;return r}}function lr(t,e){var n,i,r=typeof e;return null==e||"boolean"===r?Yi(e):("number"===r?nr:"string"===r?(n=Li(e))?(e=n,Zi):or:e instanceof Li?Zi:e instanceof Date?er:(i=e,!ArrayBuffer.isView(i)||i instanceof DataView?Array.isArray(e)?tr:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?ir:nr:ar))(t,e)}function hr(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function ur(t){return+t}var cr=[0,1];function dr(t){return t}function fr(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function pr(t,e,n){var i=t[0],r=t[1],s=e[0],o=e[1];return r<i?(i=fr(r,i),s=n(o,s)):(i=fr(i,r),s=n(s,o)),function(t){return s(i(t))}}function gr(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),s=new Array(i),o=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<i;)r[o]=fr(t[o],t[o+1]),s[o]=n(e[o],e[o+1]);return function(e){var n=fi(t,e,1,i)-1;return s[n](r[n](e))}}function mr(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function vr(){var t,e,n,i,r,s,o=cr,a=cr,l=lr,h=dr;function u(){var t,e,n,l=Math.min(o.length,a.length);return h!==dr&&(t=o[0],e=o[l-1],t>e&&(n=t,t=e,e=n),h=function(n){return Math.max(t,Math.min(e,n))}),i=l>2?gr:pr,r=s=null,c}function c(e){return null==e||isNaN(e=+e)?n:(r||(r=i(o.map(t),a,l)))(t(h(e)))}return c.invert=function(n){return h(e((s||(s=i(a,o.map(t),nr)))(n)))},c.domain=function(t){return arguments.length?(o=Array.from(t,ur),u()):o.slice()},c.range=function(t){return arguments.length?(a=Array.from(t),u()):a.slice()},c.rangeRound=function(t){return a=Array.from(t),l=hr,u()},c.clamp=function(t){return arguments.length?(h=!!t||dr,u()):h!==dr},c.interpolate=function(t){return arguments.length?(l=t,u()):l},c.unknown=function(t){return arguments.length?(n=t,c):n},function(n,i){return t=n,e=i,u()}}function yr(){return vr()(dr,dr)}function br(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function wr(t){return new Date(t)}function kr(t){return t instanceof Date?+t:+new Date(+t)}function _r(t,e,n,i,r,s,o,a,l,h){var u=yr(),c=u.invert,d=u.domain,f=h(".%L"),p=h(":%S"),g=h("%I:%M"),m=h("%I %p"),v=h("%a %d"),y=h("%b %d"),b=h("%B"),w=h("%Y");function k(t){return(l(t)<t?f:a(t)<t?p:o(t)<t?g:s(t)<t?m:i(t)<t?r(t)<t?v:y:n(t)<t?b:w)(t)}return u.invert=function(t){return new Date(c(t))},u.domain=function(t){return arguments.length?d(Array.from(t,kr)):d().map(wr)},u.ticks=function(e){var n=d();return t(n[0],n[n.length-1],null==e?10:e)},u.tickFormat=function(t,e){return null==e?k:h(e)},u.nice=function(t){var n=d();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?d(function(t,e){var n,i=0,r=(t=t.slice()).length-1,s=t[i],o=t[r];return o<s&&(n=i,i=r,r=n,n=s,s=o,o=n),t[i]=e.floor(s),t[r]=e.ceil(o),t}(n,t)):u},u.copy=function(){return mr(u,_r(t,e,n,i,r,s,o,a,l,h))},u}var xr,Er=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Cr(t){if(!(e=Er.exec(t)))throw new Error("invalid format: "+t);var e;return new Ar({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Ar(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Sr(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}function Tr(t){return(t=Sr(Math.abs(t)))?t[1]:NaN}function Mr(t,e){var n=Sr(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}Cr.prototype=Ar.prototype,Ar.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Lr={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Mr(100*t,e),r:Mr,s:function(t,e){var n=Sr(t,e);if(!n)return t+"";var i=n[0],r=n[1],s=r-(xr=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+Sr(t,Math.max(0,e+s-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Dr(t){return t}var Pr,Nr,Rr,Ir=Array.prototype.map,Fr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ur(t){var e,n,i=void 0===t.grouping||void 0===t.thousands?Dr:(e=Ir.call(t.grouping,Number),n=t.thousands+"",function(t,i){for(var r=t.length,s=[],o=0,a=e[0],l=0;r>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),s.push(t.substring(r-=a,r+a)),!((l+=a+1)>i));)a=e[o=(o+1)%e.length];return s.reverse().join(n)}),r=void 0===t.currency?"":t.currency[0]+"",s=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",a=void 0===t.numerals?Dr:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Ir.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",h=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function c(t){var e=(t=Cr(t)).fill,n=t.align,c=t.sign,d=t.symbol,f=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,y=t.type;"n"===y?(g=!0,y="g"):Lr[y]||(void 0===m&&(m=12),v=!0,y="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var b="$"===d?r:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===d?s:/[%p]/.test(y)?l:"",k=Lr[y],_=/[defgprs%]/.test(y);function x(t){var r,s,l,d=b,x=w;if("c"===y)x=k(t)+x,t="";else{var E=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:k(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,i=1,r=-1;i<n;++i)switch(t[i]){case".":r=e=i;break;case"0":0===r&&(r=i),e=i;break;default:if(!+t[i])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),E&&0==+t&&"+"!==c&&(E=!1),d=(E?"("===c?c:h:"-"===c||"("===c?"":c)+d,x=("s"===y?Fr[8+xr/3]:"")+x+(E&&"("===c?")":""),_)for(r=-1,s=t.length;++r<s;)if(48>(l=t.charCodeAt(r))||l>57){x=(46===l?o+t.slice(r+1):t.slice(r))+x,t=t.slice(0,r);break}}g&&!f&&(t=i(t,1/0));var C=d.length+t.length+x.length,A=C<p?new Array(p-C+1).join(e):"";switch(g&&f&&(t=i(A+t,A.length?p-x.length:1/0),A=""),n){case"<":t=d+t+x+A;break;case"=":t=d+A+t+x;break;case"^":t=A.slice(0,C=A.length>>1)+d+t+x+A.slice(C);break;default:t=A+d+t+x}return a(t)}return m=void 0===m?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),x.toString=function(){return t+""},x}return{format:c,formatPrefix:function(t,e){var n=c(((t=Cr(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(Tr(e)/3))),r=Math.pow(10,-i),s=Fr[8+i/3];return function(t){return n(r*t)+s}}}}function Or(t,e,n,i){var r,s=zt(t,e,n);switch((i=Cr(null==i?",f":i)).type){case"s":var o=Math.max(Math.abs(t),Math.abs(e));return null!=i.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Tr(e)/3)))-Tr(Math.abs(t)))}(s,o))||(i.precision=r),Rr(i,o);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Tr(e)-Tr(t))+1}(s,Math.max(Math.abs(t),Math.abs(e))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=function(t){return Math.max(0,-Tr(Math.abs(t)))}(s))||(i.precision=r-2*("%"===i.type))}return Nr(i)}function $r(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){var i,r,s,o,a=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];if((i=e<t)&&(r=t,t=e,e=r),0===(o=Wt(t,e,n))||!isFinite(o))return[];if(o>0){let n=Math.round(t/o),i=Math.round(e/o);for(n*o<t&&++n,i*o>e&&--i,s=new Array(r=i-n+1);++a<r;)s[a]=(n+a)*o}else{o=-o;let n=Math.round(t*o),i=Math.round(e*o);for(n/o<t&&++n,i/o>e&&--i,s=new Array(r=i-n+1);++a<r;)s[a]=(n+a)/o}return i&&s.reverse(),s}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var i=e();return Or(i[0],i[i.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var i,r,s=e(),o=0,a=s.length-1,l=s[o],h=s[a],u=10;for(h<l&&(r=l,l=h,h=r,r=o,o=a,a=r);u-- >0;){if((r=Wt(l,h,n))===i)return s[o]=l,s[a]=h,e(s);if(r>0)l=Math.floor(l/r)*r,h=Math.ceil(h/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,h=Math.floor(h*r)/r}i=r}return t},t}function Hr(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let i=-1;for(let r of t)null!=(r=e(r,++i,t))&&(n<r||void 0===n&&r>=r)&&(n=r)}return n}!function(t){Pr=Ur(t),Nr=Pr.format,Rr=Pr.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});const jr=Math.PI,Br=2*jr,qr=Br-1e-6;function Jr(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Vr(){return new Jr}Jr.prototype=Vr.prototype={constructor:Jr,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,s){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+s)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var s=this._x1,o=this._y1,a=n-t,l=i-e,h=s-t,u=o-e,c=h*h+u*u;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(c>1e-6)if(Math.abs(u*a-l*h)>1e-6&&r){var d=n-s,f=i-o,p=a*a+l*l,g=d*d+f*f,m=Math.sqrt(p),v=Math.sqrt(c),y=r*Math.tan((jr-Math.acos((p+c-g)/(2*m*v)))/2),b=y/v,w=y/m;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*h)+","+(e+b*u)),this._+="A"+r+","+r+",0,0,"+ +(u*d>h*f)+","+(this._x1=t+w*a)+","+(this._y1=e+w*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,r,s){t=+t,e=+e,s=!!s;var o=(n=+n)*Math.cos(i),a=n*Math.sin(i),l=t+o,h=e+a,u=1^s,c=s?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+l+","+h:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-h)>1e-6)&&(this._+="L"+l+","+h),n&&(c<0&&(c=c%Br+Br),c>qr?this._+="A"+n+","+n+",0,1,"+u+","+(t-o)+","+(e-a)+"A"+n+","+n+",0,1,"+u+","+(this._x1=l)+","+(this._y1=h):c>1e-6&&(this._+="A"+n+","+n+",0,"+ +(c>=jr)+","+u+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};const Wr=Vr;Array.prototype.slice;function zr(t){return function(){return t}}function Yr(t){this._context=t}function Xr(t){return new Yr(t)}function Gr(t){return t[0]}function Kr(t){return t[1]}function Zr(t,e){var n=zr(!0),i=null,r=Xr,s=null;function o(o){var a,l,h,u=(o=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(o)).length,c=!1;for(null==i&&(s=r(h=Wr())),a=0;a<=u;++a)!(a<u&&n(l=o[a],a,o))===c&&((c=!c)?s.lineStart():s.lineEnd()),c&&s.point(+t(l,a,o),+e(l,a,o));if(h)return s=null,h+""||null}return t="function"==typeof t?t:void 0===t?Gr:zr(t),e="function"==typeof e?e:void 0===e?Kr:zr(e),o.x=function(e){return arguments.length?(t="function"==typeof e?e:zr(+e),o):t},o.y=function(t){return arguments.length?(e="function"==typeof t?t:zr(+t),o):e},o.defined=function(t){return arguments.length?(n="function"==typeof t?t:zr(!!t),o):n},o.curve=function(t){return arguments.length?(r=t,null!=i&&(s=r(i)),o):r},o.context=function(t){return arguments.length?(null==t?i=s=null:s=r(i=t),o):i},o}function Qr(){}function ts(t){return null==t?Qr:function(){return this.querySelector(t)}}function es(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function ns(){return[]}function is(t){return null==t?ns:function(){return this.querySelectorAll(t)}}function rs(t){return function(){return this.matches(t)}}function ss(t){return function(e){return e.matches(t)}}Yr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var os=Array.prototype.find;function as(){return this.firstElementChild}var ls=Array.prototype.filter;function hs(){return Array.from(this.children)}function us(t){return new Array(t.length)}function cs(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ds(t){return function(){return t}}function fs(t,e,n,i,r,s){for(var o,a=0,l=e.length,h=s.length;a<h;++a)(o=e[a])?(o.__data__=s[a],i[a]=o):n[a]=new cs(t,s[a]);for(;a<l;++a)(o=e[a])&&(r[a]=o)}function ps(t,e,n,i,r,s,o){var a,l,h,u=new Map,c=e.length,d=s.length,f=new Array(c);for(a=0;a<c;++a)(l=e[a])&&(f[a]=h=o.call(l,l.__data__,a,e)+"",u.has(h)?r[a]=l:u.set(h,l));for(a=0;a<d;++a)h=o.call(t,s[a],a,s)+"",(l=u.get(h))?(i[a]=l,l.__data__=s[a],u.delete(h)):n[a]=new cs(t,s[a]);for(a=0;a<c;++a)(l=e[a])&&u.get(f[a])===l&&(r[a]=l)}function gs(t){return t.__data__}function ms(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function vs(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}cs.prototype={constructor:cs,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var ys="http://www.w3.org/1999/xhtml";const bs={svg:"http://www.w3.org/2000/svg",xhtml:ys,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ws(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),bs.hasOwnProperty(e)?{space:bs[e],local:t}:t}function ks(t){return function(){this.removeAttribute(t)}}function _s(t){return function(){this.removeAttributeNS(t.space,t.local)}}function xs(t,e){return function(){this.setAttribute(t,e)}}function Es(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Cs(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function As(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ss(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Ts(t){return function(){this.style.removeProperty(t)}}function Ms(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Ls(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function Ds(t,e){return t.style.getPropertyValue(e)||Ss(t).getComputedStyle(t,null).getPropertyValue(e)}function Ps(t){return function(){delete this[t]}}function Ns(t,e){return function(){this[t]=e}}function Rs(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function Is(t){return t.trim().split(/^|\s+/)}function Fs(t){return t.classList||new Us(t)}function Us(t){this._node=t,this._names=Is(t.getAttribute("class")||"")}function Os(t,e){for(var n=Fs(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function $s(t,e){for(var n=Fs(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function Hs(t){return function(){Os(this,t)}}function js(t){return function(){$s(this,t)}}function Bs(t,e){return function(){(e.apply(this,arguments)?Os:$s)(this,t)}}function qs(){this.textContent=""}function Js(t){return function(){this.textContent=t}}function Vs(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Ws(){this.innerHTML=""}function zs(t){return function(){this.innerHTML=t}}function Ys(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Xs(){this.nextSibling&&this.parentNode.appendChild(this)}function Gs(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ks(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===ys&&e.documentElement.namespaceURI===ys?e.createElement(t):e.createElementNS(n,t)}}function Zs(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Qs(t){var e=ws(t);return(e.local?Zs:Ks)(e)}function to(){return null}function eo(){var t=this.parentNode;t&&t.removeChild(this)}function no(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function io(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ro(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function so(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,s=e.length;i<s;++i)n=e[i],t.type&&n.type!==t.type||n.name!==t.name?e[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?e.length=r:delete this.__on}}}function oo(t,e,n){return function(){var i,r=this.__on,s=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(r)for(var o=0,a=r.length;o<a;++o)if((i=r[o]).type===t.type&&i.name===t.name)return this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),void(i.value=e);this.addEventListener(t.type,s,n),i={type:t.type,name:t.name,value:e,listener:s,options:n},r?r.push(i):this.__on=[i]}}function ao(t,e,n){var i=Ss(t),r=i.CustomEvent;"function"==typeof r?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function lo(t,e){return function(){return ao(this,t,e)}}function ho(t,e){return function(){return ao(this,t,e.apply(this,arguments))}}Us.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var uo=[null];function co(t,e){this._groups=t,this._parents=e}function fo(){return new co([[document.documentElement]],uo)}co.prototype=fo.prototype={constructor:co,select:function(t){"function"!=typeof t&&(t=ts(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s,o,a=e[r],l=a.length,h=i[r]=new Array(l),u=0;u<l;++u)(s=a[u])&&(o=t.call(s,s.__data__,u,a))&&("__data__"in s&&(o.__data__=s.__data__),h[u]=o);return new co(i,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return es(t.apply(this,arguments))}}(t):is(t);for(var e=this._groups,n=e.length,i=[],r=[],s=0;s<n;++s)for(var o,a=e[s],l=a.length,h=0;h<l;++h)(o=a[h])&&(i.push(t.call(o,o.__data__,h,a)),r.push(o));return new co(i,r)},selectChild:function(t){return this.select(null==t?as:function(t){return function(){return os.call(this.children,t)}}("function"==typeof t?t:ss(t)))},selectChildren:function(t){return this.selectAll(null==t?hs:function(t){return function(){return ls.call(this.children,t)}}("function"==typeof t?t:ss(t)))},filter:function(t){"function"!=typeof t&&(t=rs(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s,o=e[r],a=o.length,l=i[r]=[],h=0;h<a;++h)(s=o[h])&&t.call(s,s.__data__,h,o)&&l.push(s);return new co(i,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,gs);var n=e?ps:fs,i=this._parents,r=this._groups;"function"!=typeof t&&(t=ds(t));for(var s=r.length,o=new Array(s),a=new Array(s),l=new Array(s),h=0;h<s;++h){var u=i[h],c=r[h],d=c.length,f=ms(t.call(u,u&&u.__data__,h,i)),p=f.length,g=a[h]=new Array(p),m=o[h]=new Array(p),v=l[h]=new Array(d);n(u,c,g,m,v,f,e);for(var y,b,w=0,k=0;w<p;++w)if(y=g[w]){for(w>=k&&(k=w+1);!(b=m[k])&&++k<p;);y._next=b||null}}return(o=new co(o,i))._enter=a,o._exit=l,o},enter:function(){return new co(this._enter||this._groups.map(us),this._parents)},exit:function(){return new co(this._exit||this._groups.map(us),this._parents)},join:function(t,e,n){var i=this.enter(),r=this,s=this.exit();return"function"==typeof t?(i=t(i))&&(i=i.selection()):i=i.append(t+""),null!=e&&(r=e(r))&&(r=r.selection()),null==n?s.remove():n(s),i&&r?i.merge(r).order():r},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,r=n.length,s=i.length,o=Math.min(r,s),a=new Array(r),l=0;l<o;++l)for(var h,u=n[l],c=i[l],d=u.length,f=a[l]=new Array(d),p=0;p<d;++p)(h=u[p]||c[p])&&(f[p]=h);for(;l<r;++l)a[l]=n[l];return new co(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i,r=t[e],s=r.length-1,o=r[s];--s>=0;)(i=r[s])&&(o&&4^i.compareDocumentPosition(o)&&o.parentNode.insertBefore(i,o),o=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=vs);for(var n=this._groups,i=n.length,r=new Array(i),s=0;s<i;++s){for(var o,a=n[s],l=a.length,h=r[s]=new Array(l),u=0;u<l;++u)(o=a[u])&&(h[u]=o);h.sort(e)}return new co(r,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,s=i.length;r<s;++r){var o=i[r];if(o)return o}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r,s=e[n],o=0,a=s.length;o<a;++o)(r=s[o])&&t.call(r,r.__data__,o,s);return this},attr:function(t,e){var n=ws(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==e?n.local?_s:ks:"function"==typeof e?n.local?As:Cs:n.local?Es:xs)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?Ts:"function"==typeof e?Ls:Ms)(t,e,null==n?"":n)):Ds(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Ps:"function"==typeof e?Rs:Ns)(t,e)):this.node()[t]},classed:function(t,e){var n=Is(t+"");if(arguments.length<2){for(var i=Fs(this.node()),r=-1,s=n.length;++r<s;)if(!i.contains(n[r]))return!1;return!0}return this.each(("function"==typeof e?Bs:e?Hs:js)(n,e))},text:function(t){return arguments.length?this.each(null==t?qs:("function"==typeof t?Vs:Js)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Ws:("function"==typeof t?Ys:zs)(t)):this.node().innerHTML},raise:function(){return this.each(Xs)},lower:function(){return this.each(Gs)},append:function(t){var e="function"==typeof t?t:Qs(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:Qs(t),i=null==e?to:"function"==typeof e?e:ts(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)}))},remove:function(){return this.each(eo)},clone:function(t){return this.select(t?io:no)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var i,r,s=ro(t+""),o=s.length;if(!(arguments.length<2)){for(a=e?oo:so,i=0;i<o;++i)this.each(a(s[i],e,n));return this}var a=this.node().__on;if(a)for(var l,h=0,u=a.length;h<u;++h)for(i=0,l=a[h];i<o;++i)if((r=s[i]).type===l.type&&r.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?ho:lo)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i,r=t[e],s=0,o=r.length;s<o;++s)(i=r[s])&&(yield i)}};const po=fo;var go={value:()=>{}};function mo(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new vo(i)}function vo(t){this._=t}function yo(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function bo(t,e){for(var n,i=0,r=t.length;i<r;++i)if((n=t[i]).name===e)return n.value}function wo(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=go,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}vo.prototype=mo.prototype={constructor:vo,on:function(t,e){var n,i=this._,r=yo(t+"",i),s=-1,o=r.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<o;)if(n=(t=r[s]).type)i[n]=wo(i[n],t.name,e);else if(null==e)for(n in i)i[n]=wo(i[n],t.name,null);return this}for(;++s<o;)if((n=(t=r[s]).type)&&(n=bo(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new vo(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),s=0;s<n;++s)r[s]=arguments[s+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=0,n=(i=this._[t]).length;s<n;++s)i[s].value.apply(e,r)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,s=i.length;r<s;++r)i[r].value.apply(e,n)}};const ko=mo;var _o,xo,Eo=0,Co=0,Ao=0,So=0,To=0,Mo=0,Lo="object"==typeof performance&&performance.now?performance:Date,Do="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Po(){return To||(Do(No),To=Lo.now()+Mo)}function No(){To=0}function Ro(){this._call=this._time=this._next=null}function Io(t,e,n){var i=new Ro;return i.restart(t,e,n),i}function Fo(){To=(So=Lo.now())+Mo,Eo=Co=0;try{!function(){Po(),++Eo;for(var t,e=_o;e;)(t=To-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Eo}()}finally{Eo=0,function(){var t,e,n=_o,i=1/0;for(;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:_o=e);xo=t,Oo(i)}(),To=0}}function Uo(){var t=Lo.now(),e=t-So;e>1e3&&(Mo-=e,So=t)}function Oo(t){Eo||(Co&&(Co=clearTimeout(Co)),t-To>24?(t<1/0&&(Co=setTimeout(Fo,t-Lo.now()-Mo)),Ao&&(Ao=clearInterval(Ao))):(Ao||(So=Lo.now(),Ao=setInterval(Uo,1e3)),Eo=1,Do(Fo)))}function $o(t,e,n){var i=new Ro;return e=null==e?0:+e,i.restart(n=>{i.stop(),t(n+e)},e,n),i}Ro.prototype=Io.prototype={constructor:Ro,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Po():+n)+(null==e?0:+e),this._next||xo===this||(xo?xo._next=this:_o=this,xo=this),this._call=t,this._time=n,Oo()},stop:function(){this._call&&(this._call=null,this._time=1/0,Oo())}};var Ho=ko("start","end","cancel","interrupt"),jo=[];function Bo(t,e,n,i,r,s){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var i,r=t.__transition;function s(l){var h,u,c,d;if(1!==n.state)return a();for(h in r)if((d=r[h]).name===n.name){if(3===d.state)return $o(s);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[h]):+h<e&&(d.state=6,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete r[h])}if($o((function(){3===n.state&&(n.state=4,n.timer.restart(o,n.delay,n.time),o(l))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,i=new Array(c=n.tween.length),h=0,u=-1;h<c;++h)(d=n.tween[h].value.call(t,t.__data__,n.index,n.group))&&(i[++u]=d);i.length=u+1}}function o(e){for(var r=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(a),n.state=5,1),s=-1,o=i.length;++s<o;)i[s].call(t,r);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),a())}function a(){for(var i in n.state=6,n.timer.stop(),delete r[e],r)return;delete t.__transition}r[e]=n,n.timer=Io((function(t){n.state=1,n.timer.restart(s,n.delay,n.time),n.delay<=t&&s(t-n.delay)}),0,n.time)}(t,n,{name:e,index:i,group:r,on:Ho,tween:jo,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:0})}function qo(t,e){var n=Vo(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Jo(t,e){var n=Vo(t,e);if(n.state>3)throw new Error("too late; already running");return n}function Vo(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var Wo,zo=180/Math.PI,Yo={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Xo(t,e,n,i,r,s){var o,a,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*n+e*i)&&(n-=t*l,i-=e*l),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,l/=a),t*i<e*n&&(t=-t,e=-e,l=-l,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(e,t)*zo,skewX:Math.atan(l)*zo,scaleX:o,scaleY:a}}function Go(t,e,n,i){function r(t){return t.length?t.pop()+" ":""}return function(s,o){var a=[],l=[];return s=t(s),o=t(o),function(t,i,r,s,o,a){if(t!==r||i!==s){var l=o.push("translate(",null,e,null,n);a.push({i:l-4,x:nr(t,r)},{i:l-2,x:nr(i,s)})}else(r||s)&&o.push("translate("+r+e+s+n)}(s.translateX,s.translateY,o.translateX,o.translateY,a,l),function(t,e,n,s){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),s.push({i:n.push(r(n)+"rotate(",null,i)-2,x:nr(t,e)})):e&&n.push(r(n)+"rotate("+e+i)}(s.rotate,o.rotate,a,l),function(t,e,n,s){t!==e?s.push({i:n.push(r(n)+"skewX(",null,i)-2,x:nr(t,e)}):e&&n.push(r(n)+"skewX("+e+i)}(s.skewX,o.skewX,a,l),function(t,e,n,i,s,o){if(t!==n||e!==i){var a=s.push(r(s)+"scale(",null,",",null,")");o.push({i:a-4,x:nr(t,n)},{i:a-2,x:nr(e,i)})}else 1===n&&1===i||s.push(r(s)+"scale("+n+","+i+")")}(s.scaleX,s.scaleY,o.scaleX,o.scaleY,a,l),s=o=null,function(t){for(var e,n=-1,i=l.length;++n<i;)a[(e=l[n]).i]=e.x(t);return a.join("")}}}var Ko=Go((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Yo:Xo(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Zo=Go((function(t){return null==t?Yo:(Wo||(Wo=document.createElementNS("http://www.w3.org/2000/svg","g")),Wo.setAttribute("transform",t),(t=Wo.transform.baseVal.consolidate())?Xo((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Yo)}),", ",")",")");function Qo(t,e){var n,i;return function(){var r=Jo(this,t),s=r.tween;if(s!==n)for(var o=0,a=(i=n=s).length;o<a;++o)if(i[o].name===e){(i=i.slice()).splice(o,1);break}r.tween=i}}function ta(t,e,n){var i,r;if("function"!=typeof n)throw new Error;return function(){var s=Jo(this,t),o=s.tween;if(o!==i){r=(i=o).slice();for(var a={name:e,value:n},l=0,h=r.length;l<h;++l)if(r[l].name===e){r[l]=a;break}l===h&&r.push(a)}s.tween=r}}function ea(t,e,n){var i=t._id;return t.each((function(){var t=Jo(this,i);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return Vo(t,i).value[e]}}function na(t,e){var n;return("number"==typeof e?nr:e instanceof Li?Zi:(n=Li(e))?(e=n,Zi):or)(t,e)}function ia(t){return function(){this.removeAttribute(t)}}function ra(t){return function(){this.removeAttributeNS(t.space,t.local)}}function sa(t,e,n){var i,r,s=n+"";return function(){var o=this.getAttribute(t);return o===s?null:o===i?r:r=e(i=o,n)}}function oa(t,e,n){var i,r,s=n+"";return function(){var o=this.getAttributeNS(t.space,t.local);return o===s?null:o===i?r:r=e(i=o,n)}}function aa(t,e,n){var i,r,s;return function(){var o,a,l=n(this);if(null!=l)return(o=this.getAttribute(t))===(a=l+"")?null:o===i&&a===r?s:(r=a,s=e(i=o,l));this.removeAttribute(t)}}function la(t,e,n){var i,r,s;return function(){var o,a,l=n(this);if(null!=l)return(o=this.getAttributeNS(t.space,t.local))===(a=l+"")?null:o===i&&a===r?s:(r=a,s=e(i=o,l));this.removeAttributeNS(t.space,t.local)}}function ha(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function ua(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function ca(t,e){var n,i;function r(){var r=e.apply(this,arguments);return r!==i&&(n=(i=r)&&ua(t,r)),n}return r._value=e,r}function da(t,e){var n,i;function r(){var r=e.apply(this,arguments);return r!==i&&(n=(i=r)&&ha(t,r)),n}return r._value=e,r}function fa(t,e){return function(){qo(this,t).delay=+e.apply(this,arguments)}}function pa(t,e){return e=+e,function(){qo(this,t).delay=e}}function ga(t,e){return function(){Jo(this,t).duration=+e.apply(this,arguments)}}function ma(t,e){return e=+e,function(){Jo(this,t).duration=e}}function va(t,e){if("function"!=typeof e)throw new Error;return function(){Jo(this,t).ease=e}}function ya(t,e,n){var i,r,s=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?qo:Jo;return function(){var o=s(this,t),a=o.on;a!==i&&(r=(i=a).copy()).on(e,n),o.on=r}}var ba=po.prototype.constructor;function wa(t){return function(){this.style.removeProperty(t)}}function ka(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function _a(t,e,n){var i,r;function s(){var s=e.apply(this,arguments);return s!==r&&(i=(r=s)&&ka(t,s,n)),i}return s._value=e,s}function xa(t){return function(e){this.textContent=t.call(this,e)}}function Ea(t){var e,n;function i(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&xa(i)),e}return i._value=t,i}var Ca=0;function Aa(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function Sa(){return++Ca}var Ta=po.prototype;Aa.prototype=function(t){return po().transition(t)}.prototype={constructor:Aa,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=ts(t));for(var i=this._groups,r=i.length,s=new Array(r),o=0;o<r;++o)for(var a,l,h=i[o],u=h.length,c=s[o]=new Array(u),d=0;d<u;++d)(a=h[d])&&(l=t.call(a,a.__data__,d,h))&&("__data__"in a&&(l.__data__=a.__data__),c[d]=l,Bo(c[d],e,n,d,c,Vo(a,n)));return new Aa(s,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=is(t));for(var i=this._groups,r=i.length,s=[],o=[],a=0;a<r;++a)for(var l,h=i[a],u=h.length,c=0;c<u;++c)if(l=h[c]){for(var d,f=t.call(l,l.__data__,c,h),p=Vo(l,n),g=0,m=f.length;g<m;++g)(d=f[g])&&Bo(d,e,n,g,f,p);s.push(f),o.push(l)}return new Aa(s,o,e,n)},selectChild:Ta.selectChild,selectChildren:Ta.selectChildren,filter:function(t){"function"!=typeof t&&(t=rs(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s,o=e[r],a=o.length,l=i[r]=[],h=0;h<a;++h)(s=o[h])&&t.call(s,s.__data__,h,o)&&l.push(s);return new Aa(i,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,r=n.length,s=Math.min(i,r),o=new Array(i),a=0;a<s;++a)for(var l,h=e[a],u=n[a],c=h.length,d=o[a]=new Array(c),f=0;f<c;++f)(l=h[f]||u[f])&&(d[f]=l);for(;a<i;++a)o[a]=e[a];return new Aa(o,this._parents,this._name,this._id)},selection:function(){return new ba(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Sa(),i=this._groups,r=i.length,s=0;s<r;++s)for(var o,a=i[s],l=a.length,h=0;h<l;++h)if(o=a[h]){var u=Vo(o,e);Bo(o,t,n,h,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Aa(i,this._parents,t,n)},call:Ta.call,nodes:Ta.nodes,node:Ta.node,size:Ta.size,empty:Ta.empty,each:Ta.each,on:function(t,e){var n=this._id;return arguments.length<2?Vo(this.node(),n).on.on(t):this.each(ya(n,t,e))},attr:function(t,e){var n=ws(t),i="transform"===n?Zo:na;return this.attrTween(t,"function"==typeof e?(n.local?la:aa)(n,i,ea(this,"attr."+t,e)):null==e?(n.local?ra:ia)(n):(n.local?oa:sa)(n,i,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var i=ws(t);return this.tween(n,(i.local?ca:da)(i,e))},style:function(t,e,n){var i="transform"==(t+="")?Ko:na;return null==e?this.styleTween(t,function(t,e){var n,i,r;return function(){var s=Ds(this,t),o=(this.style.removeProperty(t),Ds(this,t));return s===o?null:s===n&&o===i?r:r=e(n=s,i=o)}}(t,i)).on("end.style."+t,wa(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var i,r,s;return function(){var o=Ds(this,t),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(t),l=a=Ds(this,t)),o===l?null:o===i&&l===r?s:(r=l,s=e(i=o,a))}}(t,i,ea(this,"style."+t,e))).each(function(t,e){var n,i,r,s,o="style."+e,a="end."+o;return function(){var l=Jo(this,t),h=l.on,u=null==l.value[o]?s||(s=wa(e)):void 0;h===n&&r===u||(i=(n=h).copy()).on(a,r=u),l.on=i}}(this._id,t)):this.styleTween(t,function(t,e,n){var i,r,s=n+"";return function(){var o=Ds(this,t);return o===s?null:o===i?r:r=e(i=o,n)}}(t,i,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==e)return this.tween(i,null);if("function"!=typeof e)throw new Error;return this.tween(i,_a(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(ea(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,Ea(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i,r=Vo(this.node(),n).tween,s=0,o=r.length;s<o;++s)if((i=r[s]).name===t)return i.value;return null}return this.each((null==e?Qo:ta)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?fa:pa)(e,t)):Vo(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?ga:ma)(e,t)):Vo(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(va(e,t)):Vo(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;Jo(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,i=n._id,r=n.size();return new Promise((function(s,o){var a={value:o},l={value:function(){0==--r&&s()}};n.each((function(){var n=Jo(this,i),r=n.on;r!==t&&((e=(t=r).copy())._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),n.on=e})),0===r&&s()}))},[Symbol.iterator]:Ta[Symbol.iterator]};var Ma={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function La(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Da(t){var e=10,n=20,i=30,r=40,s=t.clientWidth,o=function(t){return"string"==typeof t?new co([[document.querySelector(t)]],[document.documentElement]):new co([[t]],uo)}(t).append("svg").attr("viewBox",[0,0,s,250]),a=o.append("g").attr("transform","translate(0,".concat(250-i,")")),l=o.append("g").attr("transform","translate(".concat(r,", 0)")),h=o.append("path").attr("fill","none").attr("stroke","#007200").attr("stroke-width",1.5).attr("stroke-linejoin","round").attr("stroke-linecap","round"),u=o.append("path").attr("fill","none").attr("stroke","#dc3545").attr("stroke-width",1.5).attr("stroke-linejoin","round").attr("stroke-linecap","round");return function(t){var o=function(){return br.apply(_r(He,je,ye,me,le,oe,re,ne,te,We).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}().domain(function(t,e){let n,i;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=i=e):(n>e&&(n=e),i<e&&(i=e)));else{let r=-1;for(let s of t)null!=(s=e(s,++r,t))&&(void 0===n?s>=s&&(n=i=s):(n>s&&(n=s),i<s&&(i=s)))}return[n,i]}(t,(function(t){return t.date}))).range([r,s-n]),c=Ht(3,o),d=function t(){var e=yr();return e.copy=function(){return mr(e,t())},br.apply(e,arguments),$r(e)}().domain([0,Hr(t,(function(t){return Hr([t.processed,t.failed])}))]).range([250-i,e]).nice(),f=function(t){return Ht(4,t)}(d).ticks(7),p=Zr().x((function(t){return o(t.date)})).defined((function(t){return t.defined})).y((function(t){return d(t.failed)})),g=Zr().x((function(t){return o(t.date)})).defined((function(t){return t.defined})).y((function(t){return d(t.processed)}));a.call(c),l.call(f),h.datum(t).attr("d",g),u.datum(t).attr("d",p)}}po.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var n,i,r,s=t.__transition,o=!0;if(s){for(r in e=null==e?null:e+"",s)(n=s[r]).name===e?(i=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete s[r]):o=!1;o&&delete t.__transition}}(this,t)}))},po.prototype.transition=function(t){var e,n;t instanceof Aa?(e=t._id,t=t._name):(e=Sa(),(n=Ma).time=Po(),t=null==t?null:t+"");for(var i=this._groups,r=i.length,s=0;s<r;++s)for(var o,a=i[s],l=a.length,h=0;h<l;++h)(o=a[h])&&Bo(o,t,e,h,a,n||La(o,e));return new Aa(i,this._parents,t,e)};var Pa={mounted:function(){for(var t=[],e=Number(this.el.dataset.tick),n=new Date,i=0;i<150;i++)t.unshift({date:n,processed:0,failed:0,defined:!1}),n=new Date(n-e);var r=Da(this.el);r(t),this.handleEvent("append-point",(function(e){var n=e.processed,i=e.failed;t.shift(),t.push({date:new Date,processed:n,failed:i,defined:!0}),r(t)}))}},Na={mounted:function(){var t=[],e=Da(this.el);e(t),this.handleEvent("replace-points",(function(n){var i=n.points;t=i.map((function(t){return t.date=new Date(t.date),t.defined=!0,t})),e(t)}))}},Ra={mounted:function(){var t=this;this.el.addEventListener("change",(function(e){var n=Number(e.target.value);localStorage.setItem("refresh_interval",n),t.pushEventTo("#stats","refresh-interval",{interval:n})}));var e=Number(localStorage.getItem("refresh_interval"))||5;this.el.value=e,t.pushEventTo("#stats","refresh-interval",{interval:e})}};function Ia(t){return(Ia="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Fa={mounted:function(){var t=this.el.textContent.trim();this.el.innerText=function(t){if("object"!=Ia(window.Intl)||"function"!=typeof window.Intl.RelativeTimeFormat)return t;var e,n=(new Date(t)-new Date)/1e3,i=Math.abs(n);return i<60?e="second":i<3600?(e="minute",n/=60):i<216e3?(e="hour",n/=3600):(e="day",n/=216e3),new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(Math.round(n),e)}(t)}},Ua=document.querySelector("meta[name='csrf-token']").getAttribute("content"),Oa=document.querySelector("html").getAttribute("phx-socket")||"/live",$a=new class{constructor(t,e,n={}){if(this.unloaded=!1,!e||"Object"===e.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 e(t,n),this.bindingPrefix=n.bindingPrefix||"phx-",this.opts=n,this.params=Z(n.params||{}),this.viewLogger=n.viewLogger,this.metadataCallbacks=n.metadata||{},this.defaults=Object.assign(Q(B),n.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.outgoingMainEl=null,this.clickStartedAtTarget=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=Q(window.location),this.hooks=n.hooks||{},this.uploaders=n.uploaders||{},this.loaderTimeout=n.loaderTimeout||1,this.reloadWithJitterTimer=null,this.maxReloads=n.maxReloads||10,this.reloadJitterMin=n.reloadJitterMin||5e3,this.reloadJitterMax=n.reloadJitterMax||1e4,this.failsafeJitter=n.failsafeJitter||3e4,this.localStorage=n.localStorage||window.localStorage,this.sessionStorage=n.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.domCallbacks=Object.assign({onNodeAdded:Z(),onBeforeElUpdated:Z()},n.dom||{}),this.transitions=new Nt,window.addEventListener("pagehide",t=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}isProfileEnabled(){return"true"===this.sessionStorage.getItem("phx:live-socket:profiling")}isDebugEnabled(){return"true"===this.sessionStorage.getItem(j)}isDebugDisabled(){return"false"===this.sessionStorage.getItem(j)}enableDebug(){this.sessionStorage.setItem(j,"true")}enableProfiling(){this.sessionStorage.setItem("phx:live-socket:profiling","true")}disableDebug(){this.sessionStorage.setItem(j,"false")}disableProfiling(){this.sessionStorage.removeItem("phx:live-socket:profiling")}enableLatencySim(t){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem("phx:live-socket:latency-sim",t)}disableLatencySim(){this.sessionStorage.removeItem("phx:live-socket:latency-sim")}getLatencySim(){let t=this.sessionStorage.getItem("phx:live-socket:latency-sim");return t?parseInt(t):null}getSocket(){return this.socket}connect(){"localhost"!==window.location.hostname||this.isDebugDisabled()||this.enableDebug();let t=()=>{this.joinRootViews()?(this.bindTopLevelEvents(),this.socket.connect()):this.main?this.socket.connect():this.bindTopLevelEvents({dead:!0}),this.joinDeadView()};["complete","loaded","interactive"].indexOf(document.readyState)>=0?t():document.addEventListener("DOMContentLoaded",()=>t())}disconnect(t){clearTimeout(this.reloadWithJitterTimer),this.socket.disconnect(t)}replaceTransport(t){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(t),this.connect()}execJS(t,e,n=null){this.owner(t,i=>Lt.exec(n,e,i,t))}unload(){this.unloaded||(this.main&&this.isConnected()&&this.log(this.main,"socket",()=>["disconnect for page nav"]),this.unloaded=!0,this.destroyAllViews(),this.disconnect())}triggerDOM(t,e){this.domCallbacks[t](...e)}time(t,e){if(!this.isProfileEnabled()||!console.time)return e();console.time(t);let n=e();return console.timeEnd(t),n}log(t,e,n){if(this.viewLogger){let[i,r]=n();this.viewLogger(t,e,i,r)}else if(this.isDebugEnabled()){let[i,r]=n();((t,e,n,i)=>{t.liveSocket.isDebugEnabled()&&console.log(`${t.id} ${e}: ${n} - `,i)})(t,e,i,r)}}requestDOMUpdate(t){this.transitions.after(t)}transition(t,e,n=function(){}){this.transitions.addTransition(t,e,n)}onChannel(t,e,n){t.on(e,t=>{let e=this.getLatencySim();e?setTimeout(()=>n(t),e):n(t)})}wrapPush(t,e,n){let i=this.getLatencySim(),r=t.joinCount;if(!i)return this.isConnected()&&e.timeout?n().receive("timeout",()=>{t.joinCount!==r||t.isDestroyed()||this.reloadWithJitter(t,()=>{this.log(t,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):n();let s={receives:[],receive(t,e){this.receives.push([t,e])}};return setTimeout(()=>{t.isDestroyed()||s.receives.reduce((t,[e,n])=>t.receive(e,n),n())},i),s}reloadWithJitter(t,e){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let n=this.reloadJitterMin,i=this.reloadJitterMax,r=Math.floor(Math.random()*(i-n+1))+n,s=ot.updateLocal(this.localStorage,window.location.pathname,"consecutive-reloads",0,t=>t+1);s>this.maxReloads&&(r=this.failsafeJitter),this.reloadWithJitterTimer=setTimeout(()=>{t.isDestroyed()||t.isConnected()||(t.destroy(),e?e():this.log(t,"join",()=>[`encountered ${s} consecutive reloads`]),s>this.maxReloads&&this.log(t,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),this.hasPendingLink()?window.location=this.pendingLink:window.location.reload())},r)}getHookCallbacks(t){return t&&t.startsWith("Phoenix.")?ft[t.split(".")[1]]:this.hooks[t]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(t){return`${this.getBindingPrefix()}${t}`}channel(t,e){return this.socket.channel(t,e)}joinDeadView(){let t=document.body;if(t&&!this.isPhxView(t)&&!this.isPhxView(document.firstElementChild)){let e=this.newRootView(t);e.setHref(this.getHref()),e.joinDead(),this.main||(this.main=e),window.requestAnimationFrame(()=>e.execNewMounted())}}joinRootViews(){let t=!1;return lt.all(document,`${$}:not([${R}])`,e=>{if(!this.getRootById(e.id)){let t=this.newRootView(e);t.setHref(this.getHref()),t.join(),e.hasAttribute("data-phx-main")&&(this.main=t)}t=!0}),t}redirect(t,e){this.unload(),ot.redirect(t,e)}replaceMain(t,e,n=null,i=this.setPendingLink(t)){let r=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let s=lt.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(s,e,r),this.main.setRedirect(t),this.transitionRemoves(),this.main.join((t,e)=>{1===t&&this.commitPendingLink(i)&&this.requestDOMUpdate(()=>{lt.findPhxSticky(document).forEach(t=>s.appendChild(t)),this.outgoingMainEl.replaceWith(s),this.outgoingMainEl=null,n&&requestAnimationFrame(n),e()})})}transitionRemoves(t){let e=this.binding("remove");(t=t||lt.all(document,`[${e}]`)).forEach(t=>{document.body.contains(t)&&this.execJS(t,t.getAttribute(e),"remove")})}isPhxView(t){return t.getAttribute&&null!==t.getAttribute(O)}newRootView(t,e,n){let i=new Pt(t,this,null,e,n);return this.roots[i.id]=i,i}owner(t,e){let n=it(t.closest($),t=>this.getViewByEl(t))||this.main;n&&e(n)}withinOwners(t,e){this.owner(t,n=>e(n,t))}getViewByEl(t){let e=t.getAttribute(I);return it(this.getRootById(e),e=>e.getDescendentByEl(t))}getRootById(t){return this.roots[t]}destroyAllViews(){for(let t in this.roots)this.roots[t].destroy(),delete this.roots[t];this.main=null}destroyViewByEl(t){let e=this.getRootById(t.getAttribute(I));e&&e.id===t.id?(e.destroy(),delete this.roots[e.id]):e&&e.destroyDescendent(t.id)}setActiveElement(t){if(this.activeElement===t)return;this.activeElement=t;let e=()=>{t===this.activeElement&&(this.activeElement=null),t.removeEventListener("mouseup",this),t.removeEventListener("touchend",this)};t.addEventListener("mouseup",e),t.addEventListener("touchend",e)}getActiveElement(){return document.activeElement===document.body?this.activeElement||document.activeElement:document.activeElement||document.body}dropActiveElement(t){this.prevActive&&t.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive.blur()}bindTopLevelEvents({dead:t}={}){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.socket.onClose(t=>t&&1001===t.code?this.unload():t&&1e3===t.code&&this.main?this.reloadWithJitter(this.main):void 0),document.body.addEventListener("click",(function(){})),window.addEventListener("pageshow",t=>{t.persisted&&(this.getSocket().disconnect(),this.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())},!0),t||this.bindNav(),this.bindClicks(),t||this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(t,e,n,i,r,s)=>{let o=i.getAttribute(this.binding("key")),a=t.key&&t.key.toLowerCase();if(o&&o.toLowerCase()!==a)return;let l={key:t.key,...this.eventMeta(e,t,i)};Lt.exec(e,r,n,i,["push",{data:l}])}),this.bind({blur:"focusout",focus:"focusin"},(t,e,n,i,r,s)=>{if(!s){let s={key:t.key,...this.eventMeta(e,t,i)};Lt.exec(e,r,n,i,["push",{data:s}])}}),this.bind({blur:"blur",focus:"focus"},(t,e,n,i,r,s,o)=>{if("window"===o){let r=this.eventMeta(e,t,i);Lt.exec(e,s,n,i,["push",{data:r}])}}),window.addEventListener("dragover",t=>t.preventDefault()),window.addEventListener("drop",t=>{t.preventDefault();let e=it(tt(t.target,this.binding("drop-target")),t=>t.getAttribute(this.binding("drop-target"))),n=e&&document.getElementById(e),i=Array.from(t.dataTransfer.files||[]);n&&!n.disabled&&0!==i.length&&n.files instanceof FileList&&(ct.trackFiles(n,i,t.dataTransfer),n.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on("track-uploads",t=>{let e=t.target;if(!lt.isUploadInput(e))return;let n=Array.from(t.detail.files||[]).filter(t=>t instanceof File||t instanceof Blob);ct.trackFiles(e,n),e.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(t,e,n){let i=this.metadataCallbacks[t];return i?i(e,n):{}}setPendingLink(t){return this.linkRef++,this.pendingLink=t,this.linkRef}commitPendingLink(t){return this.linkRef===t&&(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(t,e){for(let n in t){let i=t[n];this.on(i,t=>{let r=this.binding(n),s=this.binding("window-"+n),o=t.target.getAttribute&&t.target.getAttribute(r);o?this.debounce(t.target,t,i,()=>{this.withinOwners(t.target,i=>{e(t,n,i,t.target,o,null)})}):lt.all(document,`[${s}]`,r=>{let o=r.getAttribute(s);this.debounce(r,t,i,()=>{this.withinOwners(r,i=>{e(t,n,i,r,o,"window")})})})})}}bindClicks(){window.addEventListener("click",t=>this.clickStartedAtTarget=t.target),this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}bindClick(t,e,n){let i=this.binding(e);window.addEventListener(t,t=>{let e=null;if(n)e=t.target.matches(`[${i}]`)?t.target:t.target.querySelector(`[${i}]`);else{let n=this.clickStartedAtTarget||t.target;e=tt(n,i),this.dispatchClickAway(t,n),this.clickStartedAtTarget=null}let r=e&&e.getAttribute(i);if(r)"#"===e.getAttribute("href")&&t.preventDefault(),this.debounce(e,t,"click",()=>{this.withinOwners(e,n=>{Lt.exec("click",r,n,e,["push",{data:this.eventMeta("click",t,e)}])})});else{let e=t.target instanceof HTMLAnchorElement?t.target.getAttribute("href"):null;n||null===e||lt.wantsNewTab(t)||!lt.isNewPageHref(e,window.location)||this.unload()}},n)}dispatchClickAway(t,e){let n=this.binding("click-away");lt.all(document,`[${n}]`,i=>{i.isSameNode(e)||i.contains(e)||this.withinOwners(t.target,e=>{let r=i.getAttribute(n);Lt.isVisible(i)&&Lt.exec("click",r,e,i,["push",{data:this.eventMeta("click",t,t.target)}])})})}bindNav(){if(!ot.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let t=null;window.addEventListener("scroll",e=>{clearTimeout(t),t=setTimeout(()=>{ot.updateCurrentState(t=>Object.assign(t,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:e,id:n,root:i,scroll:r}=t.state||{},s=window.location.href;this.requestDOMUpdate(()=>{this.main.isConnected()&&"patch"===e&&n===this.main.id?this.main.pushLinkPatch(s,null,()=>{this.maybeScroll(r)}):this.replaceMain(s,null,()=>{i&&this.replaceRootHistory(),this.maybeScroll(r)})})},!1),window.addEventListener("click",t=>{let e=tt(t.target,"data-phx-link"),n=e&&e.getAttribute("data-phx-link");if(!n||!this.isConnected()||!this.main||lt.wantsNewTab(t))return;let i=e.href,r=e.getAttribute("data-phx-link-state");t.preventDefault(),t.stopImmediatePropagation(),this.pendingLink!==i&&this.requestDOMUpdate(()=>{if("patch"===n)this.pushHistoryPatch(i,r,e);else{if("redirect"!==n)throw new Error('expected data-phx-link to be "patch" or "redirect", got: '+n);this.historyRedirect(i,r)}let t=e.getAttribute(this.binding("click"));t&&this.requestDOMUpdate(()=>this.execJS(e,t,"click"))})},!1)}maybeScroll(t){"number"==typeof t&&requestAnimationFrame(()=>{window.scrollTo(0,t)})}dispatchEvent(t,e={}){lt.dispatchEvent(window,"phx:"+t,{detail:e})}dispatchEvents(t){t.forEach(([t,e])=>this.dispatchEvent(t,e))}withPageLoading(t,e){lt.dispatchEvent(window,"phx:page-loading-start",{detail:t});let n=()=>lt.dispatchEvent(window,"phx:page-loading-stop",{detail:t});return e?e(n):n}pushHistoryPatch(t,e,n){if(!this.isConnected())return ot.redirect(t);this.withPageLoading({to:t,kind:"patch"},i=>{this.main.pushLinkPatch(t,n,n=>{this.historyPatch(t,e,n),i()})})}historyPatch(t,e,n=this.setPendingLink(t)){this.commitPendingLink(n)&&(ot.pushState(e,{type:"patch",id:this.main.id},t),this.registerNewLocation(window.location))}historyRedirect(t,e,n){if(!this.isConnected())return ot.redirect(t,n);if(/^\/$|^\/[^\/]+.*$/.test(t)){let{protocol:e,host:n}=window.location;t=`${e}//${n}${t}`}let i=window.scrollY;this.withPageLoading({to:t,kind:"redirect"},r=>{this.replaceMain(t,n,()=>{ot.pushState(e,{type:"redirect",id:this.main.id,scroll:i},t),this.registerNewLocation(window.location),r()})})}replaceRootHistory(){ot.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(t){let{pathname:e,search:n}=this.currentLocation;return e+n!==t.pathname+t.search&&(this.currentLocation=Q(t),!0)}bindForms(){let t=0,e=!1;this.on("submit",t=>{let n=t.target.getAttribute(this.binding("submit")),i=t.target.getAttribute(this.binding("change"));e||!i||n||(e=!0,t.preventDefault(),this.withinOwners(t.target,e=>{e.disableForm(t.target),window.requestAnimationFrame(()=>{lt.isUnloadableFormSubmit(t)&&this.unload(),t.target.submit()})}))},!0),this.on("submit",t=>{let e=t.target.getAttribute(this.binding("submit"));e?(t.preventDefault(),t.target.disabled=!0,this.withinOwners(t.target,n=>{Lt.exec("submit",e,n,t.target,["push",{submitter:t.submitter}])})):lt.isUnloadableFormSubmit(t)&&this.unload()},!1);for(let e of["change","input"])this.on(e,n=>{let i=this.binding("change"),r=n.target,s=r.getAttribute(i),o=r.form&&r.form.getAttribute(i),a=s||o;if(!a)return;if("number"===r.type&&r.validity&&r.validity.badInput)return;let l=s?r:r.form,h=t;t++;let{at:u,type:c}=lt.private(r,"prev-iteration")||{};u===h-1&&e!==c||(lt.putPrivate(r,"prev-iteration",{at:h,type:e}),this.debounce(r,n,e,()=>{this.withinOwners(l,t=>{lt.putPrivate(r,"phx-has-focused",!0),lt.isTextualInput(r)||this.setActiveElement(r),Lt.exec("change",a,t,r,["push",{_target:n.target.name,dispatcher:l}])})}))},!1);this.on("reset",t=>{let e=t.target;lt.resetForm(e,this.binding("feedback-for"));let n=Array.from(e.elements).find(t=>"reset"===t.type);window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(t,e,n,i){if("blur"===n||"focusout"===n)return i();let r=this.binding("debounce"),s=this.binding("throttle"),o=this.defaults.debounce.toString(),a=this.defaults.throttle.toString();this.withinOwners(t,n=>{lt.debounce(t,e,r,o,s,a,()=>!n.isDestroyed()&&document.body.contains(t),()=>{i()})})}silenceEvents(t){this.silenced=!0,t(),this.silenced=!1}on(t,e){window.addEventListener(t,t=>{this.silenced||e(t)})}}(Oa,class{constructor(e,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=n.timeout||1e4,this.transport=n.transport||r.WebSocket||C,this.establishedConnections=0,this.defaultEncoder=A.encode.bind(A),this.defaultDecoder=A.decode.bind(A),this.closeWasClean=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.transport!==C?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;i&&i.addEventListener&&(i.addEventListener("pagehide",t=>{this.conn&&(this.disconnect(),s=this.connectClock)}),i.addEventListener("pageshow",t=>{s===this.connectClock&&(s=null,this.connect())})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.rejoinAfterMs=t=>n.rejoinAfterMs?n.rejoinAfterMs(t):[1e3,2e3,5e3][t-1]||1e4,this.reconnectAfterMs=t=>n.reconnectAfterMs?n.reconnectAfterMs(t):[10,50,100,150,200,250,500,1e3,2e3][t-1]||5e3,this.logger=n.logger||null,this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=t(n.params||{}),this.endPoint=`${e}/${w}`,this.vsn=n.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new x(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return C}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.sendBuffer=[],this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=E.appendParams(E.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==t.charAt(0)?t:"/"===t.charAt(1)?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,n){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(t,e,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=t(e)),this.conn||(this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t))}log(t,e,n){this.logger(t,e,n)}hasLogger(){return null!==this.logger}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let i=this.onMessage(r=>{r.ref===e&&(this.off([i]),t(Date.now()-n))});return!0}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport","connected to "+this.endPointURL()),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,t])=>t())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,n){if(!this.conn)return t&&t();this.waitForBufferDone(()=>{this.conn&&(e?this.conn.close(e,n||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e=1){5!==e&&this.conn&&this.conn.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(t,e+1)},150*e):t()}waitForSocketClosed(t,e=1){5!==e&&this.conn&&this.conn.readyState!==l?setTimeout(()=>{this.waitForSocketClosed(t,e+1)},150*e):t()}onConnClose(t){let e=t&&t.code;this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(),this.clearHeartbeats(),this.closeWasClean||1e3===e||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,e])=>e(t))}onConnError(t){this.hasLogger()&&this.log("transport",t);let e=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,i])=>{i(t,e,n)}),(e===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(g)})}connectionState(){switch(this.conn&&this.conn.readyState){case s:return"connecting";case o:return"open";case a:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e.joinRef()!==t.joinRef())}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([e])=>-1===t.indexOf(e))}channel(e,n={}){let i=new class{constructor(e,n,i){this.state=h,this.topic=e,this.params=t(n||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new _(this,m,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new x(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=c,this.rejoinTimer.reset(),this.pushBuffer.forEach(t=>t.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=u,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=h,this.socket.remove(this)}),this.onError(t=>{this.socket.hasLogger()&&this.socket.log("channel","error "+this.topic,t),this.isJoining()&&this.joinPush.reset(),this.state=u,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new _(this,y,t({}),this.timeout).send(),this.state=u,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(v,(t,e)=>{this.trigger(this.replyEventName(e),t)})}join(t=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=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(t){this.on(p,t)}onError(t){return this.on(g,e=>t(e))}on(t,e){let n=this.bindingRef++;return this.bindings.push({event:t,ref:n,callback:e}),n}off(t,e){this.bindings=this.bindings.filter(n=>!(n.event===t&&(void 0===e||e===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,n=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new _(this,t,(function(){return e}),n);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=f;let n=()=>{this.socket.hasLogger()&&this.socket.log("channel","leave "+this.topic),this.trigger(p,"leave")},i=new _(this,y,t({}),e);return i.receive("ok",()=>n()).receive("timeout",()=>n()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(t,e,n){return e}isMember(t,e,n,i){return this.topic===t&&(!i||i===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:n,joinRef:i}),!1))}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=d,this.joinPush.resend(t))}trigger(t,e,n,i){let r=this.onMessage(t,e,n,i);if(e&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let s=this.bindings.filter(e=>e.event===t);for(let t=0;t<s.length;t++){s[t].callback(r,n,i||this.joinRef())}}replyEventName(t){return"chan_reply_"+t}isClosed(){return this.state===h}isErrored(){return this.state===u}isJoined(){return this.state===c}isJoining(){return this.state===d}isLeaving(){return this.state===f}}(e,n,this);return this.channels.push(i),i}push(t){if(this.hasLogger()){let{topic:e,event:n,payload:i,ref:r,join_ref:s}=t;this.log("push",`${e} ${n} (${s}, ${r})`,i)}this.isConnected()?this.encode(t,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(t,t=>this.conn.send(t)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,t=>{let{topic:e,event:n,payload:i,ref:r,join_ref:s}=t;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${i.status||""} ${e} ${n} ${r&&"("+r+")"||""}`,i);for(let t=0;t<this.channels.length;t++){const o=this.channels[t];o.isMember(e,n,i,s)&&o.trigger(n,i,r,s)}for(let e=0;e<this.stateChangeCallbacks.message.length;e++){let[,n]=this.stateChangeCallbacks.message[e];n(t)}})}leaveOpenTopic(t){let e=this.channels.find(e=>e.topic===t&&(e.isJoined()||e.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}},{params:{_csrf_token:Ua},hooks:{Table:{mounted:function(){var t=this.el,e=t.querySelector(".js-hidden-submit"),n=t.querySelector(".js-submit-button");t.querySelector(".js-select-all-rows").addEventListener("change",(function(){var e=this;t.querySelectorAll(".js-select-row").forEach((function(t){t.checked=e.checked}))})),t.querySelectorAll(".js-action").forEach((function(t){t.addEventListener("click",(function(){e.value=this.dataset.name,n.click()}))}))}},RealtimePlot:Pa,HistoricalPlot:Na,Refresh:Ra,Timestamp:Fa}});T().config({barColors:{0:"#B5179E"},shadowColor:"rgba(0, 0, 0, .3)"}),window.addEventListener("phx:page-loading-start",(function(t){return T().show()})),window.addEventListener("phx:page-loading-stop",(function(t){return T().hide()})),$a.connect(),window.liveSocket=$a})()})();