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")&&i.getAttribute("data-to"))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,c,u={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*u.barThickness;var t=o.getContext("2d");t.shadowBlur=u.shadowBlur,t.shadowColor=u.shadowColor;var e=t.createLinearGradient(0,0,o.width,0);for(var n in u.barColors)e.addColorStop(n,u.barColors[n]);t.lineWidth=u.barThickness,t.beginPath(),t.moveTo(0,u.barThickness/2),t.lineTo(Math.ceil(h*o.width),u.barThickness/2),t.strokeStyle=e,t.stroke()},f={config:function(t){for(var e in t)u.hasOwnProperty(e)&&(u[e]=t[e])},show:function(){var t,e,n,i;c||(c=!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",u.className&&o.classList.add(u.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),u.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(){c&&(c=!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||globalThis,s=0,o=1,a=2,l=3,h="closed",c="errored",u="joined",d="joining",f="leaving",p="phx_close",m="phx_error",g="phx_join",v="phx_reply",b="phx_leave",y="longpoll",w="websocket",k=4,E="base64url.bearer.phx.",A=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})}},C=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))}},_=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 A(this,g,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new C(()=>{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=u,this.rejoinTimer.reset(),this.pushBuffer.forEach(t=>t.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=c,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=c,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 A(this,b,t({}),this.timeout).send(),this.state=c,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(m,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 A(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 A(this,b,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===c}isJoined(){return this.state===u}isJoining(){return this.state===d}isLeaving(){return this.state===f}},x=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)}if(r.XMLHttpRequest){let l=new r.XMLHttpRequest;return this.xhrRequest(l,t,e,n,i,s,o,a)}if(r.fetch&&r.AbortController)return this.fetchRequest(t,e,n,i,s,o,a);throw new Error("No suitable XMLHttpRequest implementation found")}static fetchRequest(t,e,n,i,s,o,a){let l={method:t,headers:n,body:i},h=null;if(s){h=new AbortController;setTimeout(()=>h.abort(),s);l.signal=h.signal}return r.fetch(e,l).then(t=>t.text()).then(t=>this.parseJSON(t)).then(t=>a&&a(t)).catch(t=>{"AbortError"===t.name&&o?o():a&&a(null)}),h}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){t.open(e,n,!0),t.timeout=s;for(let[e,n]of Object.entries(i))t.setRequestHeader(e,n);return 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{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)}`}},S=class{constructor(t,e){e&&2===e.length&&e[1].startsWith(E)&&(this.authToken=atob(e[1].slice(21))),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,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+w),"$1/"+y)}endpointURL(){return x.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(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,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",{"Content-Type":"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=x.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)}},T={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 c=new Uint8Array(a.byteLength+s.byteLength);return c.set(new Uint8Array(a),0),c.set(new Uint8Array(s),a.byteLength),c.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 c=n.decode(t.slice(a,a+s));a+=s;let u=n.decode(t.slice(a,a+o));a+=o;let d=t.slice(a,t.byteLength);return{join_ref:l,ref:h,topic:c,event:v,payload:{status:u,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)}}},M=n(747),P=n.n(M),R="consecutive-reloads",L=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading","phx-hook-loading"],D="data-phx-component",I="data-phx-view",N="data-phx-link",$="data-phx-ref-loading",F="data-phx-ref-src",O="data-phx-ref-lock",U="phx-pending-refs",H="track-uploads",j="data-phx-upload-ref",B="data-phx-preflighted-refs",q="drop-target",J="data-phx-active-refs",V="phx:live-file:updated",W="data-phx-skip",z="data-phx-id",Y="data-phx-prune",X="phx-connected",K="phx-loading",G="phx-error",Z="phx-client-error",Q="phx-server-error",tt="data-phx-parent-id",et="data-phx-main",nt="data-phx-root-id",it="viewport-top",rt="viewport-bottom",st="phx-has-focused",ot=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],at=["checkbox","radio"],lt="phx-has-submitted",ht="data-phx-session",ct=`[${ht}]`,ut="data-phx-sticky",dt="data-phx-static",ft="data-phx-readonly",pt="data-phx-disabled",mt="disable-with",gt="data-phx-disable-with-restore",vt="hook",bt="update",yt="stream",wt="data-phx-stream",kt="data-phx-portal",Et="data-phx-teleported",At="data-phx-teleported-src",Ct="data-phx-runtime-hook",_t="phxPrivate",xt="auto-recover",St="phx:live-socket:debug",Tt="phx:live-socket:profiling",Mt="phx:live-socket:latency-sim",Pt="phx:nav-history-position",Rt="mounted",Lt="__phoenix_reload_status__",Dt="debounce-trigger",It="throttled",Nt="debounce-prev-key",$t={debounce:300,throttle:300},Ft=[$,F,O],Ot="s",Ut="c",Ht="k",jt="kc",Bt="e",qt="r",Jt="t",Vt="p",Wt="stream",zt=class{constructor(t,e,n){const{chunk_size:i,chunk_timeout:r}=e;this.liveSocket=n,this.entry=t,this.offset=0,this.chunkSize=i,this.chunkTimeout=r,this.chunkTimer=null,this.errored=!1,this.uploadChannel=n.channel(`lvu:${t.ref}`,{token:t.metadata()})}error(t){this.errored||(this.uploadChannel.leave(),this.errored=!0,clearTimeout(this.chunkTimer),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(){const t=new window.FileReader,e=this.entry.file.slice(this.offset,this.chunkSize+this.offset);t.onload=t=>{if(null!==t.target.error)return Yt("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,this.chunkTimeout).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))}).receive("error",({reason:t})=>this.error(t))}},Yt=(t,e)=>console.error&&console.error(t,e),Xt=t=>{const e=typeof t;return"number"===e||"string"===e&&/^(0|[1-9]\d*)$/.test(t)};var Kt=t=>"function"==typeof t?t:function(){return t},Gt=t=>JSON.parse(JSON.stringify(t)),Zt=(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(ct)));return null},Qt=t=>null!==t&&"object"==typeof t&&!(t instanceof Array),te=t=>{for(const e in t)return!1;return!0},ee=(t,e)=>t&&e(t),ne=function(t,e,n,i){t.forEach(t=>{new zt(t,n.config,i).upload()})},ie={canPushState:()=>void 0!==history.pushState,dropLocal(t,e,n){return t.removeItem(this.localKey(e,n))},updateLocal(t,e,n,i,r){const 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){const t=history.state||{};t.scroll=e.scroll,history.replaceState(t,"",window.location.href)}delete e.scroll,history[t+"State"](e,"",n||null),window.requestAnimationFrame(()=>{const t=this.getHashTargetEl(window.location.hash);t?t.scrollIntoView():"redirect"===e.type&&window.scroll(0,0)})}}else this.redirect(n)},setCookie(t,e,n){const i="number"==typeof n?` max-age=${n};`:"";document.cookie=`${t}=${e};${i} path=/`},getCookie:t=>document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${t}s*=s*([^;]*).*$)|^.*$`),"$1"),deleteCookie(t){document.cookie=`${t}=; max-age=-1; path=/`},redirect(t,e,n=t=>{window.location.href=t}){e&&this.setCookie("__phoenix_flash__",e,60),n(t)},localKey:(t,e)=>`${t}-${e}`,getHashTargetEl(t){const e=t.toString().substring(1);if(""!==e)return document.getElementById(e)||document.querySelector(`a[name="${e}"]`)}},re=ie,se={byId:t=>document.getElementById(t)||Yt(`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[];const i=Array.from(t.querySelectorAll(e));return n&&i.forEach(n),i},childNodeLength(t){const e=document.createElement("template");return e.innerHTML=t,e.content.childElementCount},isUploadInput:t=>"file"===t.type&&null!==t.getAttribute(j),isAutoUpload:t=>t.hasAttribute("data-phx-auto-upload"),findUploadInputs(t){const e=t.id,n=this.all(document,`input[type="file"][${j}][form="${e}"]`);return this.all(t,`input[type="file"][${j}]`).concat(n)},findComponentNodeList(t,e,n=document){return this.all(n,`[${I}="${t}"][${D}="${e}"]`)},isPhxDestroyed:t=>!(!t.id||!se.private(t,"destroyed")),wantsNewTab(t){const e=t.ctrlKey||t.shiftKey||t.metaKey||t.button&&1===t.button,n=t.target instanceof HTMLAnchorElement&&t.target.hasAttribute("download"),i=t.target.hasAttribute("target")&&"_blank"===t.target.getAttribute("target").toLowerCase(),r=t.target.hasAttribute("target")&&!t.target.getAttribute("target").startsWith("_");return e||i||n||r},isUnloadableFormSubmit(t){return!(t.target&&"dialog"===t.target.getAttribute("method")||t.submitter&&"dialog"===t.submitter.getAttribute("formmethod"))&&(!t.defaultPrevented&&!this.wantsNewTab(t))},isNewPageClick(t,e){const n=t.target instanceof HTMLAnchorElement?t.target.getAttribute("href"):null;let i;if(t.defaultPrevented||null===n||this.wantsNewTab(t))return!1;if(n.startsWith("mailto:")||n.startsWith("tel:"))return!1;if(t.target.isContentEditable)return!1;try{i=new URL(n)}catch{try{i=new URL(n,e)}catch{return!0}}return i.host===e.host&&i.protocol===e.protocol&&i.pathname===e.pathname&&i.search===e.search?""===i.hash&&!i.href.endsWith("#"):i.protocol.startsWith("http")},markPhxChildDestroyed(t){this.isPhxChild(t)&&t.setAttribute(ht,""),this.putPrivate(t,"destroyed",!0)},findPhxChildrenInFragment(t,e){const 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,`[${ut}]`)},findPhxChildren(t,e){return this.all(t,`${ct}[${tt}="${e}"]`)},findExistingParentCIDs(t,e){const n=new Set,i=new Set;return e.forEach(e=>{this.all(document,`[${I}="${t}"][${D}="${e}"]`).forEach(r=>{n.add(e),this.all(r,`[${I}="${t}"][${D}]`).map(t=>parseInt(t.getAttribute(D))).forEach(t=>i.add(t))})}),i.forEach(t=>n.delete(t)),n},private:(t,e)=>t[_t]&&t[_t][e],deletePrivate(t,e){t[_t]&&delete t[_t][e]},putPrivate(t,e,n){t[_t]||(t[_t]={}),t[_t][e]=n},updatePrivate(t,e,n,i){const r=this.private(t,e);void 0===r?this.putPrivate(t,e,i(n)):this.putPrivate(t,e,i(r))},syncPendingAttrs(t,e){t.hasAttribute(F)&&(L.forEach(n=>{t.classList.contains(n)&&e.classList.add(n)}),Ft.filter(e=>t.hasAttribute(e)).forEach(n=>{e.setAttribute(n,t.getAttribute(n))}))},copyPrivates(t,e){e[_t]&&(t[_t]=e[_t])},putTitle(t){const e=document.querySelector("title");if(e){const{prefix:n,suffix:i,default:r}=e.dataset,s="string"!=typeof t||""===t.trim();if(s&&"string"!=typeof r)return;const o=s?r:t;document.title=`${n||""}${o||""}${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);const c=l||h;switch(c){case null:return a();case"blur":return this.incCycle(t,"debounce-blur-cycle",()=>{o()&&a()}),void(this.once(t,"debounce-blur")&&t.addEventListener("blur",()=>this.triggerCycle(t,"debounce-blur-cycle")));default:const n=parseInt(c),i=()=>h?this.deletePrivate(t,It):a(),r=this.incCycle(t,Dt,i);if(isNaN(n))return Yt(`invalid throttle/debounce value: ${c}`);if(h){let i=!1;if("keydown"===e.type){const n=this.private(t,Nt);this.putPrivate(t,Nt,e.key),i=n!==e.key}if(!i&&this.private(t,It))return!1;{a();const e=setTimeout(()=>{o()&&this.triggerCycle(t,Dt)},n);this.putPrivate(t,It,e)}}else setTimeout(()=>{o()&&this.triggerCycle(t,Dt,r)},n);const s=t.form;s&&this.once(s,"bind-debounce")&&s.addEventListener("submit",()=>{Array.from(new FormData(s).entries(),([t])=>{const e=s.querySelector(`[name="${t}"]`);this.incCycle(e,Dt),this.deletePrivate(e,It)})}),this.once(t,"bind-debounce")&&t.addEventListener("blur",()=>{clearTimeout(this.private(t,It)),this.triggerCycle(t,Dt)})}},triggerCycle(t,e,n){const[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},maintainPrivateHooks(t,e,n,i){t.hasAttribute&&t.hasAttribute("data-phx-hook")&&!e.hasAttribute("data-phx-hook")&&e.setAttribute("data-phx-hook",t.getAttribute("data-phx-hook")),e.hasAttribute&&(e.hasAttribute(n)||e.hasAttribute(i))&&e.setAttribute("data-phx-hook","Phoenix.InfiniteScroll")},putCustomElHook(t,e){t.isConnected?t.setAttribute("data-phx-hook",""):console.error(`\n hook attached to non-connected DOM element\n ensure you are calling createHook within your connectedCallback. ${t.outerHTML}\n `),this.putPrivate(t,"custom-el-hook",e)},getCustomElHook(t){return this.private(t,"custom-el-hook")},isUsedInput(t){return t.nodeType===Node.ELEMENT_NODE&&(this.private(t,st)||this.private(t,lt))},resetForm(t){Array.from(t.elements).forEach(t=>{this.deletePrivate(t,st),this.deletePrivate(t,lt)})},isPhxChild:t=>t.getAttribute&&t.getAttribute(tt),isPhxSticky:t=>t.getAttribute&&null!==t.getAttribute(ut),isChildOfAny:(t,e)=>!!e.find(e=>e.contains(t)),firstPhxChild(t){return this.isPhxChild(t)?t:this.all(t,`[${tt}]`)[0]},isPortalTemplate:t=>"TEMPLATE"===t.tagName&&t.hasAttribute(kt),closestViewEl(t){const e=t.closest(`[${Et}],${ct}`);return e?e.hasAttribute(Et)?this.byId(e.getAttribute(Et)):e.hasAttribute(ht)?e:null:null},dispatchEvent(t,e,n={}){let i=!0;"INPUT"===t.nodeName&&"file"===t.type&&"click"===e&&(i=!1);const r={bubbles:void 0===n.bubbles?i:!!n.bubbles,cancelable:!0,detail:n.detail||{}},s="click"===e?new MouseEvent("click",r):new CustomEvent(e,r);t.dispatchEvent(s)},cloneNode(t,e){if(void 0===e)return t.cloneNode(!0);{const n=t.cloneNode(!1);return n.innerHTML=e,n}},mergeAttrs(t,e,n={}){const i=new Set(n.exclude||[]),r=n.isIgnored,s=e.attributes;for(let n=s.length-1;n>=0;n--){const o=s[n].name;if(i.has(o)){if("value"===o){const n=e.value??e.getAttribute(o);t.value===n&&t.setAttribute("value",e.getAttribute(o))}}else{const n=e.getAttribute(o);t.getAttribute(o)!==n&&(!r||r&&o.startsWith("data-"))&&t.setAttribute(o,n)}}const o=t.attributes;for(let n=o.length-1;n>=0;n--){const i=o[n].name;r?!i.startsWith("data-")||e.hasAttribute(i)||Ft.includes(i)||t.removeAttribute(i):e.hasAttribute(i)||t.removeAttribute(i)}},mergeFocusedInput(t,e){t instanceof HTMLSelectElement||se.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(t instanceof HTMLSelectElement&&t.focus(),!se.isTextualInput(t))return;t.matches(":focus")||t.focus(),this.hasSelectionRange(t)&&t.setSelectionRange(e,n)},isFormInput:t=>t.localName&&customElements.get(t.localName)?customElements.get(t.localName).formAssociated:/^(?:input|select|textarea)$/i.test(t.tagName)&&"button"!==t.type,syncAttrsToProps(t){t instanceof HTMLInputElement&&at.indexOf(t.type.toLocaleLowerCase())>=0&&(t.checked=null!==t.getAttribute("checked"))},isTextualInput:t=>ot.indexOf(t.type)>=0,isNowTriggerFormExternal:(t,e)=>t.getAttribute&&null!==t.getAttribute(e)&&document.body.contains(t),cleanChildNodes(t,e){if(se.isPhxUpdate(t,e,["append","prepend",yt])){const e=[];t.childNodes.forEach(t=>{if(!t.id){t.nodeType===Node.TEXT_NODE&&""===t.nodeValue.trim()||t.nodeType===Node.COMMENT_NODE||Yt(`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){const i=new Set(["id",ht,dt,et,nt]);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;{const 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){const i=(se.private(t,"sticky")||[]).find(([t])=>e===t);if(i){const[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){const i=n(t);this.updatePrivate(t,"sticky",[],t=>{const r=t.findIndex(([t])=>e===t);return r>=0?t[r]=[e,n,i]:t.push([e,n,i]),t})},applyStickyOperations(t){const e=se.private(t,"sticky");e&&e.forEach(([e,n,i])=>this.putSticky(t,e,n))},isLocked:t=>t.hasAttribute&&t.hasAttribute(O)},oe=se,ae=class{static isActive(t,e){const n=void 0===e._phxRef,i=t.getAttribute(J).split(",").indexOf(he.genFileRef(e))>=0;return e.size>0&&(n||i)}static isPreflighted(t,e){return t.getAttribute(B).split(",").indexOf(he.genFileRef(e))>=0&&this.isActive(t,e)}static isPreflightInProgress(t){return!0===t._preflightInProgress}static markPreflightInProgress(t){t._preflightInProgress=!0}constructor(t,e,n,i){this.ref=he.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(V,this._onElUpdated),this.autoUpload=i}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,()=>{he.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}isCancelled(){return this._isCancelled}cancel(){this.file._preflightInProgress=!1,this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(t="failed"){this.fileEl.removeEventListener(V,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:t}),this.isAutoUpload()||he.clearFiles(this.fileEl)}isAutoUpload(){return this.autoUpload}onDone(t){this._onDone=()=>{this.fileEl.removeEventListener(V,this._onElUpdated),t()}}onElUpdated(){-1===this.fileEl.getAttribute(J).split(",").indexOf(this.ref)&&(he.untrackFile(this.fileEl,this.file),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,meta:"function"==typeof this.file.meta?this.file.meta():void 0}}uploader(t){if(this.meta.uploader){const e=t[this.meta.uploader]||Yt(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:e}}return{name:"channel",callback:ne}}zipPostFlight(t){this.meta=t.entries[this.ref],this.meta||Yt(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:t})}},le=0,he=class t{static genFileRef(t){const e=t._phxRef;return void 0!==e?e:(t._phxRef=(le++).toString(),t._phxRef)}static getEntryDataURL(t,e,n){const i=this.activeFiles(t).find(t=>this.genFileRef(t)===e);n(URL.createObjectURL(i))}static hasUploadsInProgress(t){let e=0;return oe.findUploadInputs(t).forEach(t=>{t.getAttribute(B)!==t.getAttribute("data-phx-done-refs")&&e++}),e>0}static serializeUploads(t){const e=this.activeFiles(t),n={};return e.forEach(e=>{const i={path:t.name},r=t.getAttribute(j);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,"function"==typeof e.meta&&(i.meta=e.meta()),n[r].push(i)}),n}static clearFiles(t){t.value=null,t.removeAttribute(j),oe.putPrivate(t,"files",[])}static untrackFile(t,e){oe.putPrivate(t,"files",oe.private(t,"files").filter(t=>!Object.is(t,e)))}static trackFiles(t,e,n){if(null!==t.getAttribute("multiple")){const n=e.filter(e=>!this.activeFiles(t).find(t=>Object.is(t,e)));oe.updatePrivate(t,"files",[],t=>t.concat(n)),t.value=null}else n&&n.files.length>0&&(t.files=n.files),oe.putPrivate(t,"files",e)}static activeFileInputs(t){const e=oe.findUploadInputs(t);return Array.from(e).filter(t=>t.files&&this.activeFiles(t).length>0)}static activeFiles(t){return(oe.private(t,"files")||[]).filter(e=>ae.isActive(t,e))}static inputsAwaitingPreflight(t){const e=oe.findUploadInputs(t);return Array.from(e).filter(t=>this.filesAwaitingPreflight(t).length>0)}static filesAwaitingPreflight(t){return this.activeFiles(t).filter(e=>!ae.isPreflighted(t,e)&&!ae.isPreflightInProgress(e))}static markPreflightInProgress(t){t.forEach(t=>ae.markPreflightInProgress(t.file))}constructor(e,n,i){this.autoUpload=oe.isAutoUpload(e),this.view=n,this.onComplete=i,this._entries=Array.from(t.filesAwaitingPreflight(e)||[]).map(t=>new ae(e,t,n,this.autoUpload)),t.markPreflightInProgress(this._entries),this.numEntriesInProgress=this._entries.length}isAutoUpload(){return this.autoUpload}entries(){return this._entries}initAdapterUpload(t,e,n){this._entries=this._entries.map(e=>(e.isCancelled()?(this.numEntriesInProgress--,0===this.numEntriesInProgress&&this.onComplete()):(e.zipPostFlight(t),e.onDone(()=>{this.numEntriesInProgress--,0===this.numEntriesInProgress&&this.onComplete()})),e));const i=this._entries.reduce((t,e)=>{if(!e.meta)return t;const{name:i,callback:r}=e.uploader(n.uploaders);return t[i]=t[i]||{callback:r,entries:[]},t[i].entries.push(e),t},{});for(const r in i){const{callback:s,entries:o}=i[r];s(o,e,t,n)}}},ce={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&&"true"!==t.getAttribute("aria-hidden")||!e&&null!==t.getAttribute("tabindex")&&"true"!==t.getAttribute("aria-hidden")},attemptFocus(t,e){if(this.isFocusable(t,e))try{t.focus()}catch{}return!!document.activeElement&&document.activeElement.isSameNode(t)},focusFirstInteractive(t){let e=t.firstElementChild;for(;e;){if(this.attemptFocus(e,!0)||this.focusFirstInteractive(e))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}}},ue={LiveFileUpload:{activeRefs(){return this.el.getAttribute(J)},preflightedRefs(){return this.el.getAttribute(B)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){const 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(V))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(j)),he.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",t=>{if(t.relatedTarget&&this.el.contains(t.relatedTarget))ce.focusLast(this.el);else{const e=t.target.nextElementSibling;ce.attemptFocus(e)||ce.focusFirst(e)}}),this.focusEnd.addEventListener("focus",t=>{if(t.relatedTarget&&this.el.contains(t.relatedTarget))ce.focusFirst(this.el);else{const e=t.target.previousElementSibling;ce.attemptFocus(e)||ce.focusLast(e)}}),this.el.contains(document.activeElement)||(this.el.addEventListener("phx:show-end",()=>this.el.focus()),"none"!==window.getComputedStyle(this.el).display&&ce.focusFirst(this.el))}}},de=t=>["HTML","BODY"].indexOf(t.nodeName.toUpperCase())>=0?null:["scroll","auto"].indexOf(getComputedStyle(t).overflowY)>=0?t:de(t.parentElement),fe=t=>t?t.scrollTop:document.documentElement.scrollTop||document.body.scrollTop,pe=t=>t?t.getBoundingClientRect().bottom:window.innerHeight||document.documentElement.clientHeight,me=t=>t?t.getBoundingClientRect().top:0,ge=(t,e)=>{const n=t.getBoundingClientRect();return Math.ceil(n.top)>=me(e)&&Math.ceil(n.left)>=0&&Math.floor(n.top)<=pe(e)};ue.InfiniteScroll={mounted(){this.scrollContainer=de(this.el);let t=fe(this.scrollContainer),e=!1;let n=null;const i=this.throttle(500,(t,e)=>{n=()=>!0,this.liveSocket.js().push(this.el,t,{value:{id:e.id,_overran:!0},callback:()=>{n=null}})}),r=this.throttle(500,(t,e)=>{n=()=>e.scrollIntoView({block:"start"}),this.liveSocket.js().push(this.el,t,{value:{id:e.id},callback:()=>{n=null,window.requestAnimationFrame(()=>{ge(e,this.scrollContainer)||e.scrollIntoView({block:"start"})})}})}),s=this.throttle(500,(t,e)=>{n=()=>e.scrollIntoView({block:"end"}),this.liveSocket.js().push(this.el,t,{value:{id:e.id},callback:()=>{n=null,window.requestAnimationFrame(()=>{ge(e,this.scrollContainer)||e.scrollIntoView({block:"end"})})}})});this.onScroll=o=>{const a=fe(this.scrollContainer);if(n)return t=a,n();const l=this.el.getBoundingClientRect(),h=this.el.getAttribute(this.liveSocket.binding("viewport-top")),c=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),u=this.el.lastElementChild,d=this.el.firstElementChild,f=a<t,p=a>t;f&&h&&!e&&l.top>=0?(e=!0,i(h,d)):p&&e&&l.top<=0&&(e=!1),h&&f&&((t,e)=>{const n=t.getBoundingClientRect();return Math.ceil(n.top)>=me(e)&&Math.ceil(n.left)>=0&&Math.floor(n.top)<=pe(e)})(d,this.scrollContainer)?r(h,d):c&&p&&((t,e)=>{const n=t.getBoundingClientRect();return Math.ceil(n.bottom)>=me(e)&&Math.ceil(n.left)>=0&&Math.floor(n.bottom)<=pe(e)})(u,this.scrollContainer)&&s(c,u),t=a},this.scrollContainer?this.scrollContainer.addEventListener("scroll",this.onScroll):window.addEventListener("scroll",this.onScroll)},destroyed(){this.scrollContainer?this.scrollContainer.removeEventListener("scroll",this.onScroll):window.removeEventListener("scroll",this.onScroll)},throttle(t,e){let n,i=0;return(...r)=>{const s=Date.now(),o=t-(s-i);o<=0||o>t?(n&&(clearTimeout(n),n=null),i=s,e(...r)):n||(n=setTimeout(()=>{i=Date.now(),n=null,e(...r)},o))}}};var ve,be=ue,ye=class{static onUnlock(t,e){if(!oe.isLocked(t)&&!t.closest(`[${O}]`))return e();const n=t.closest(`[${O}]`),i=n.closest(`[${O}]`).getAttribute(O);n.addEventListener(`phx:undo-lock:${i}`,()=>{e()},{once:!0})}constructor(t){this.el=t,this.loadingRef=t.hasAttribute($)?parseInt(t.getAttribute($),10):null,this.lockRef=t.hasAttribute(O)?parseInt(t.getAttribute(O),10):null}maybeUndo(t,e,n){this.isWithin(t)?(this.undoLocks(t,e,n),this.undoLoading(t,e),oe.updatePrivate(this.el,U,[],n=>n.filter(n=>{let i={detail:{ref:n,event:e},bubbles:!0,cancelable:!1};return this.loadingRef&&this.loadingRef>n&&this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${n}`,i)),this.lockRef&&this.lockRef>n&&this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${n}`,i)),n>t})),this.isFullyResolvedBy(t)&&this.el.removeAttribute(F)):oe.updatePrivate(this.el,U,[],e=>(e.push(t),e))}isWithin(t){return!(null!==this.loadingRef&&this.loadingRef>t&&null!==this.lockRef&&this.lockRef>t)}undoLocks(t,e,n){if(!this.isLockUndoneBy(t))return;const i=oe.private(this.el,O);i&&(n(i),oe.deletePrivate(this.el,O)),this.el.removeAttribute(O);const r={detail:{ref:t,event:e},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${this.lockRef}`,r))}undoLoading(t,e){if(this.isLoadingUndoneBy(t)){if(this.canUndoLoading(t)){this.el.removeAttribute($);const n=this.el.getAttribute(pt),i=this.el.getAttribute(ft);null!==i&&(this.el.readOnly="true"===i,this.el.removeAttribute(ft)),null!==n&&(this.el.disabled="true"===n,this.el.removeAttribute(pt));const r=this.el.getAttribute(gt);null!==r&&(this.el.textContent=r,this.el.removeAttribute(gt));const s={detail:{ref:t,event:e},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${this.loadingRef}`,s))}L.forEach(e=>{("phx-submit-loading"!==e||this.canUndoLoading(t))&&oe.removeClass(this.el,e)})}else this.canUndoLoading(t)&&this.el.classList.contains("phx-submit-loading")&&this.el.classList.remove("phx-change-loading")}isLoadingUndoneBy(t){return null!==this.loadingRef&&this.loadingRef<=t}isLockUndoneBy(t){return null!==this.lockRef&&this.lockRef<=t}isFullyResolvedBy(t){return(null===this.loadingRef||this.loadingRef<=t)&&(null===this.lockRef||this.lockRef<=t)}canUndoLoading(t){return null===this.lockRef||this.lockRef<=t}},we=class{constructor(t,e,n){const 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))){const 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(){const t=oe.byId(this.containerId);t&&(this.elementsToModify.forEach(e=>{e.previousElementId?ee(document.getElementById(e.previousElementId),t=>{ee(document.getElementById(e.elementId),e=>{e.previousElementSibling&&e.previousElementSibling.id==t.id||t.insertAdjacentElement("afterend",e)})}):ee(document.getElementById(e.elementId),e=>{null==e.previousElementSibling||t.insertAdjacentElement("afterbegin",e)})}),"prepend"==this.updateType&&this.elementIdsToAdd.reverse().forEach(e=>{ee(document.getElementById(e),e=>t.insertAdjacentElement("afterbegin",e))}))}};var ke="undefined"==typeof document?void 0:document,Ee=!!ke&&"content"in ke.createElement("template"),Ae=!!ke&&ke.createRange&&"createContextualFragment"in ke.createRange();function Ce(t){return t=t.trim(),Ee?function(t){var e=ke.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}(t):Ae?function(t){return ve||(ve=ke.createRange()).selectNode(ke.body),ve.createContextualFragment(t).childNodes[0]}(t):function(t){var e=ke.createElement("body");return e.innerHTML=t,e.childNodes[0]}(t)}function _e(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 xe(t,e,n){t[n]!==e[n]&&(t[n]=e[n],t[n]?t.setAttribute(n,""):t.removeAttribute(n))}var Se={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)}xe(t,e,"selected")},INPUT:function(t,e){xe(t,e,"checked"),xe(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)||(o=n.nextSibling,n=null);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 Te(){}function Me(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}var Pe,Re=(Pe=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=ke.createElement("html")).innerHTML=i}else e=Ce(e);else 11===e.nodeType&&(e=e.firstElementChild);var r=n.getNodeKey||Me,s=n.onBeforeNodeAdded||Te,o=n.onNodeAdded||Te,a=n.onBeforeElUpdated||Te,l=n.onElUpdated||Te,h=n.onBeforeNodeDiscarded||Te,c=n.onNodeDiscarded||Te,u=n.onBeforeElChildrenUpdated||Te,d=n.skipFromChildren||Te,f=n.addChild||function(t,e){return t.appendChild(e)},p=!0===n.childrenOnly,m=Object.create(null),g=[];function v(t){g.push(t)}function b(t,e){if(1===t.nodeType)for(var n=t.firstChild;n;){var i=void 0;e&&(i=r(n))?v(i):(c(n),n.firstChild&&b(n,e)),n=n.nextSibling}}function y(t,e,n){!1!==h(t)&&(e&&e.removeChild(t),c(t),b(t,n))}function w(t){if(1===t.nodeType||11===t.nodeType)for(var e=t.firstChild;e;){var n=r(e);n&&(m[n]=e),w(e),e=e.nextSibling}}function k(t){o(t);for(var e=t.firstChild;e;){var n=e.nextSibling,i=r(e);if(i){var s=m[i];s&&_e(e,s)?(e.parentNode.replaceChild(s,e),E(s,e)):k(e)}else k(e);e=n}}function E(t,e,n){var i=r(e);if(i&&delete m[i],!n){var o=a(t,e);if(!1===o)return;if(o instanceof HTMLElement&&w(t=o),Pe(t,e),l(t),!1===u(t,e))return}"TEXTAREA"!==t.nodeName?function(t,e){var n,i,o,a,l,h=d(t,e),c=e.firstChild,u=t.firstChild;t:for(;c;){for(a=c.nextSibling,n=r(c);!h&&u;){if(o=u.nextSibling,c.isSameNode&&c.isSameNode(u)){c=a,u=o;continue t}i=r(u);var p=u.nodeType,g=void 0;if(p===c.nodeType&&(1===p?(n?n!==i&&((l=m[n])?o===l?g=!1:(t.insertBefore(l,u),i?v(i):y(u,t,!0),i=r(u=l)):g=!1):i&&(g=!1),(g=!1!==g&&_e(u,c))&&E(u,c)):3!==p&&8!=p||(g=!0,u.nodeValue!==c.nodeValue&&(u.nodeValue=c.nodeValue))),g){c=a,u=o;continue t}i?v(i):y(u,t,!0),u=o}if(n&&(l=m[n])&&_e(l,c))h||f(t,l),E(l,c);else{var b=s(c);!1!==b&&(b&&(c=b),c.actualize&&(c=c.actualize(t.ownerDocument||ke)),f(t,c),k(c))}c=a,u=o}!function(t,e,n){for(;e;){var i=e.nextSibling;(n=r(e))?v(n):y(e,t,!0),e=i}}(t,u,i);var w=Se[t.nodeName];w&&w(t,e)}(t,e):Se.TEXTAREA(t,e)}w(t);var A,C,_=t,x=_.nodeType,S=e.nodeType;if(!p)if(1===x)1===S?_e(t,e)||(c(t),_=function(t,e){for(var n=t.firstChild;n;){var i=n.nextSibling;e.appendChild(n),n=i}return e}(t,(A=e.nodeName,(C=e.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==C?ke.createElementNS(C,A):ke.createElement(A)))):_=e;else if(3===x||8===x){if(S===x)return _.nodeValue!==e.nodeValue&&(_.nodeValue=e.nodeValue),_;_=e}if(_===e)c(t);else{if(e.isSameNode&&e.isSameNode(_))return;if(E(_,e,p),g)for(var T=0,M=g.length;T<M;T++){var P=m[g[T]];P&&y(P,P.parentNode,!1)}}return!p&&_!==t&&t.parentNode&&(_.actualize&&(_=_.actualize(t.ownerDocument||ke)),t.parentNode.replaceChild(_,t)),_}),Le=Re,De=class{constructor(t,e,n,i,r,s,o={}){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.streamComponentRestore={},this.targetCID=s,this.cidPatch=Xt(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.targetContainer=this.isCIDPatch()?this.targetCIDContainer(i):e,this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]},this.withChildren=o.withChildren||o.undoRef||!1,this.undoRef=o.undoRef}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(){const t=this.liveSocket.binding(bt);oe.all(this.container,`[${t}=append] > *, [${t}=prepend] > *`,t=>{t.setAttribute(Y,"")})}perform(t){const{view:e,liveSocket:n,html:i,container:r}=this;let s=this.targetContainer;if(this.isCIDPatch()&&!this.targetContainer)return;if(this.isCIDPatch()){const t=s.closest(`[${O}]`);if(t){const e=oe.private(t,O);e&&(s=e.querySelector(`[data-phx-component="${this.targetCID}"]`))}}const o=n.getActiveElement(),{selectionStart:a,selectionEnd:l}=o&&oe.hasSelectionRange(o)?o:{},h=n.binding(bt),c=n.binding(it),u=n.binding(rt),d=n.binding("trigger-action"),f=[],p=[],m=[],g=[];let v=null;const b=(n,i,r=this.withChildren)=>{const s={childrenOnly:null===n.getAttribute(D)&&!r,getNodeKey:e=>oe.isPhxDestroyed(e)?null:t?e.id:e.id||e.getAttribute&&e.getAttribute(z),skipFromChildren:t=>t.getAttribute(h)===yt,addChild:(t,e)=>{const{ref:n,streamAt:i}=this.getStreamInsert(e);if(void 0===n)return t.appendChild(e);if(this.setStreamRef(e,n),0===i)t.insertAdjacentElement("afterbegin",e);else if(-1===i){const n=t.lastElementChild;if(n&&!n.hasAttribute(wt)){const n=Array.from(t.children).find(t=>!t.hasAttribute(wt));t.insertBefore(e,n)}else t.appendChild(e)}else if(i>0){const n=Array.from(t.children)[i];t.insertBefore(e,n)}},onBeforeNodeAdded:t=>{if(this.getStreamInsert(t)?.updateOnly&&!this.streamComponentRestore[t.id])return!1;oe.maintainPrivateHooks(t,t,c,u),this.trackBefore("added",t);let e=t;return this.streamComponentRestore[t.id]&&(e=this.streamComponentRestore[t.id],delete this.streamComponentRestore[t.id],b(e,t,!0)),e},onNodeAdded:t=>{t.getAttribute&&this.maybeReOrderStream(t,!0),oe.isPortalTemplate(t)&&g.push(()=>this.teleport(t,b)),t instanceof HTMLImageElement&&t.srcset?t.srcset=t.srcset:t instanceof HTMLVideoElement&&t.autoplay&&t.play(),oe.isNowTriggerFormExternal(t,d)&&(v=t),(oe.isPhxChild(t)&&e.ownsElement(t)||oe.isPhxSticky(t)&&e.ownsElement(t.parentNode))&&this.trackAfter("phxChildAdded",t),"SCRIPT"===t.nodeName&&t.hasAttribute(Ct)&&this.handleRuntimeHook(t,i),f.push(t)},onNodeDiscarded:t=>this.onNodeDiscarded(t),onBeforeNodeDiscarded:t=>{if(t.getAttribute&&null!==t.getAttribute(Y))return!0;if(null!==t.parentElement&&t.id&&oe.isPhxUpdate(t.parentElement,h,[yt,"append","prepend"]))return!1;if(t.getAttribute&&t.getAttribute(Et))return!1;if(this.maybePendingRemove(t))return!1;if(this.skipCIDSibling(t))return!1;if(oe.isPortalTemplate(t)){const e=document.getElementById(t.content.firstElementChild.id);e&&(e.remove(),s.onNodeDiscarded(e),this.view.dropPortalElementId(e.id))}return!0},onElUpdated:t=>{oe.isNowTriggerFormExternal(t,d)&&(v=t),p.push(t),this.maybeReOrderStream(t,!1)},onBeforeElUpdated:(t,e)=>{if(t.id&&t.isSameNode(n)&&t.id!==e.id)return s.onNodeDiscarded(t),t.replaceWith(e),s.onNodeAdded(e);if(oe.syncPendingAttrs(t,e),oe.maintainPrivateHooks(t,e,c,u),oe.cleanChildNodes(e,h),this.skipCIDSibling(e))return this.maybeReOrderStream(t),!1;if(oe.isPhxSticky(t))return[ht,dt,nt].map(n=>[n,t.getAttribute(n),e.getAttribute(n)]).forEach(([e,n,i])=>{i&&n!==i&&t.setAttribute(e,i)}),!1;if(oe.isIgnored(t,h)||t.form&&t.form.isSameNode(v))return this.trackBefore("updated",t,e),oe.mergeAttrs(t,e,{isIgnored:oe.isIgnored(t,h)}),p.push(t),oe.applyStickyOperations(t),!1;if("number"===t.type&&t.validity&&t.validity.badInput)return!1;const i=o&&t.isSameNode(o)&&oe.isFormInput(t),r=i&&this.isChangedSelect(t,e);if(t.hasAttribute(F)){const n=new ye(t);if(n.lockRef&&(!this.undoRef||!n.isLockUndoneBy(this.undoRef))){oe.isUploadInput(t)&&(oe.mergeAttrs(t,e,{isIgnored:!0}),this.trackBefore("updated",t,e),p.push(t)),oe.applyStickyOperations(t);const n=t.hasAttribute(O)?oe.private(t,O)||t.cloneNode(!0):null;n&&(oe.putPrivate(t,O,n),i||(t=n))}}if(oe.isPhxChild(e)){const n=t.getAttribute(ht);return oe.mergeAttrs(t,e,{exclude:[dt]}),""!==n&&t.setAttribute(ht,n),t.setAttribute(nt,this.rootID),oe.applyStickyOperations(t),!1}return this.undoRef&&oe.private(e,O)&&oe.putPrivate(t,O,oe.private(e,O)),oe.copyPrivates(e,t),oe.isPortalTemplate(e)?(g.push(()=>this.teleport(e,b)),!1):i&&"hidden"!==t.type&&!r?(this.trackBefore("updated",t,e),oe.mergeFocusedInput(t,e),oe.syncAttrsToProps(t),p.push(t),oe.applyStickyOperations(t),!1):(r&&t.blur(),oe.isPhxUpdate(e,h,["append","prepend"])&&m.push(new we(t,e,e.getAttribute(h))),oe.syncAttrsToProps(e),oe.applyStickyOperations(e),this.trackBefore("updated",t,e),t)}};Le(n,i,s)};if(this.trackBefore("added",r),this.trackBefore("updated",r,r),n.time("morphdom",()=>{this.streams.forEach(([t,e,n,i])=>{e.forEach(([e,n,r,s])=>{this.streamInserts[e]={ref:t,streamAt:n,limit:r,reset:i,updateOnly:s}}),void 0!==i&&oe.all(r,`[${wt}="${t}"]`,t=>{this.removeStreamChildElement(t)}),n.forEach(t=>{const e=r.querySelector(`[id="${t}"]`);e&&this.removeStreamChildElement(e)})}),t&&oe.all(this.container,`[${h}=${yt}]`).filter(t=>this.view.ownsElement(t)).forEach(t=>{Array.from(t.children).forEach(t=>{this.removeStreamChildElement(t,!0)})}),b(s,i),g.forEach(t=>t()),this.view.portalElementIds.forEach(t=>{const e=document.getElementById(t);if(e){document.getElementById(e.getAttribute(At))||(e.remove(),this.onNodeDiscarded(e),this.view.dropPortalElementId(t))}})}),n.isDebugEnabled()&&(!function(){const 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)}(),function(t){const e=new Set;Object.keys(t).forEach(t=>{const n=document.getElementById(t);n&&n.parentElement&&"stream"!==n.parentElement.getAttribute("phx-update")&&e.add(`The stream container with id "${n.parentElement.id}" is missing the phx-update="stream" attribute. Ensure it is set for streams to work properly.`)}),e.forEach(t=>console.error(t))}(this.streamInserts),Array.from(document.querySelectorAll("input[name=id]")).forEach(t=>{t instanceof HTMLInputElement&&t.form&&console.error('Detected an input with name="id" inside a form! This will cause problems when patching the DOM.\n',t)})),m.length>0&&n.time("post-morph append/prepend restoration",()=>{m.forEach(t=>t.perform())}),n.silenceEvents(()=>oe.restoreFocus(o,a,l)),oe.dispatchEvent(document,"phx:update"),f.forEach(t=>this.trackAfter("added",t)),p.forEach(t=>this.trackAfter("updated",t)),this.transitionPendingRemoves(),v){n.unload();const t=oe.private(v,"submitter");if(t&&t.name&&s.contains(t)){const e=document.createElement("input");e.type="hidden";const n=t.getAttribute("form");n&&e.setAttribute("form",n),e.name=t.name,e.value=t.value,t.parentElement.insertBefore(e,t)}Object.getPrototypeOf(v).submit.call(v)}return!0}onNodeDiscarded(t){(oe.isPhxChild(t)||oe.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)}removeStreamChildElement(t,e=!1){(e||this.view.ownsElement(t))&&(this.streamInserts[t.id]?(this.streamComponentRestore[t.id]=t,t.remove()):this.maybePendingRemove(t)||(t.remove(),this.onNodeDiscarded(t)))}getStreamInsert(t){return(t.id?this.streamInserts[t.id]:{})||{}}setStreamRef(t,e){oe.putSticky(t,wt,t=>t.setAttribute(wt,e))}maybeReOrderStream(t,e){const{ref:n,streamAt:i,reset:r}=this.getStreamInsert(t);if(void 0!==i&&(this.setStreamRef(t,n),(r||e)&&t.parentElement)){if(0===i)t.parentElement.insertBefore(t,t.parentElement.firstElementChild);else if(i>0){const e=Array.from(t.parentElement.children),n=e.indexOf(t);if(i>=e.length-1)t.parentElement.appendChild(t);else{const r=e[i];n>i?t.parentElement.insertBefore(t,r):t.parentElement.insertBefore(t,r.nextElementSibling)}}this.maybeLimitStream(t)}}maybeLimitStream(t){const{limit:e}=this.getStreamInsert(t),n=null!==e&&Array.from(t.parentElement.children);e&&e<0&&n.length>-1*e?n.slice(0,n.length+e).forEach(t=>this.removeStreamChildElement(t)):e&&e>=0&&n.length>e&&n.slice(e).forEach(t=>this.removeStreamChildElement(t))}transitionPendingRemoves(){const{pendingRemoves:t,liveSocket:e}=this;t.length>0&&e.transitionRemoves(t,()=>{t.forEach(t=>{const n=oe.firstPhxChild(t);n&&e.destroyViewByEl(n),t.remove()}),this.trackAfter("transitionsDiscarded",t)})}isChangedSelect(t,e){return t instanceof HTMLSelectElement&&!t.multiple&&(t.options.length!==e.options.length||(e.value=t.value,!t.isEqualNode(e)))}isCIDPatch(){return this.cidPatch}skipCIDSibling(t){return t.nodeType===Node.ELEMENT_NODE&&t.hasAttribute(W)}targetCIDContainer(t){if(!this.isCIDPatch())return;const[e,...n]=oe.findComponentNodeList(this.view.id,this.targetCID);return 0===n.length&&1===oe.childNodeLength(t)?e:e&&e.parentNode}indexOf(t,e){return Array.from(t.children).indexOf(e)}teleport(t,e){const n=t.getAttribute(kt),i=document.querySelector(n);if(!i)throw new Error("portal target with selector "+n+" not found");const r=t.content.firstElementChild;if(this.skipCIDSibling(r))return;if(!r?.id)throw new Error("phx-portal template must have a single root element with ID!");const s=document.getElementById(r.id);let o;s?(i.contains(s)||i.appendChild(s),o=s):(o=document.createElement(r.tagName),i.appendChild(o)),r.setAttribute(Et,this.view.id),r.setAttribute(At,t.id),e(o,r,!0),r.removeAttribute(Et),r.removeAttribute(At),this.view.pushPortalElementId(r.id)}handleRuntimeHook(t,e){const n=t.getAttribute(Ct);let i=t.hasAttribute("nonce")?t.getAttribute("nonce"):null;if(t.hasAttribute("nonce")){const t=document.createElement("template");t.innerHTML=e,i=t.content.querySelector(`script[${Ct}="${CSS.escape(n)}"]`).getAttribute("nonce")}const r=document.createElement("script");r.textContent=t.textContent,oe.mergeAttrs(r,t,{isIgnored:!1}),i&&(r.nonce=i),t.replaceWith(r),t=r}},Ie=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),Ne=new Set(["'",'"']),$e=(t,e,n)=>{let i,r,s,o,a,l,h=0,c=!1;const u=t.match(/^(\s*(?:<!--.*?-->\s*)*)<([^\s\/>]+)/);if(null===u)throw new Error(`malformed html ${t}`);for(h=u[0].length,i=u[1],s=u[2],o=h;h<t.length&&">"!==t.charAt(h);h++)if("="===t.charAt(h)){const e=" id"===t.slice(h-3,h);h++;const n=t.charAt(h);if(Ne.has(n)){const i=h;for(h++;h<t.length&&t.charAt(h)!==n;h++);if(e){a=t.slice(i+1,h);break}}}let d=t.length-1;for(c=!1;d>=i.length+s.length;){const e=t.charAt(d);if(c)"-"===e&&"<!-"===t.slice(d-3,d)?(c=!1,d-=4):d-=1;else if(">"===e&&"--"===t.slice(d-2,d))c=!0,d-=3;else{if(">"===e)break;d-=1}}r=t.slice(d+1,t.length);const f=Object.keys(e).map(t=>!0===e[t]?t:`${t}="${e[t]}"`).join(" ");if(n){const t=a?` id="${a}"`:"";l=Ie.has(s)?`<${s}${t}${""===f?"":" "}${f}/>`:`<${s}${t}${""===f?"":" "}${f}></${s}>`}else{l=`<${s}${""===f?"":" "}${f}${t.slice(o,d+1)}`}return[l,i,r]},Fe=class{static extract(t){const{[qt]:e,[Bt]:n,[Jt]:i}=t;return delete t[qt],delete t[Bt],delete t[Jt],{diff:t,title:i,reply:e||null,events:n||[]}}constructor(t,e){this.viewId=t,this.rendered={},this.magicId=0,this.mergeDiff(e)}parentViewId(){return this.viewId}toString(t){const{buffer:e,streams:n}=this.recursiveToString(this.rendered,this.rendered[Ut],t,!0,{});return{buffer:e,streams:n}}recursiveToString(t,e=t[Ut],n,i,r){const s={buffer:"",components:e,onlyCids:n=n?new Set(n):null,streams:new Set};return this.toOutputBuffer(t,null,s,i,r),{buffer:s.buffer,streams:s.streams}}componentCIDs(t){return Object.keys(t[Ut]||{}).map(t=>parseInt(t))}isComponentOnlyDiff(t){return!!t[Ut]&&1===Object.keys(t).length}getComponent(t,e){return t[Ut][e]}resetRender(t){this.rendered[Ut][t]&&(this.rendered[Ut][t].reset=!0)}mergeDiff(t){const e=t[Ut],n={};if(delete t[Ut],this.rendered=this.mutableMerge(this.rendered,t),this.rendered[Ut]=this.rendered[Ut]||{},e){const i=this.rendered[Ut];for(const t in e)e[t]=this.cachedFindComponent(t,e[t],i,e,n);for(const t in e)i[t]=e[t];t[Ut]=e}}cachedFindComponent(t,e,n,i,r){if(r[t])return r[t];{let s,o,a=e[Ot];if(Xt(a)){let t;t=a>0?this.cachedFindComponent(a,i[a],n,i,r):n[-a],o=t[Ot],s=this.cloneMerge(t,e,!0),s[Ot]=o}else s=void 0!==e[Ot]||void 0===n[t]?e:this.cloneMerge(n[t],e,!1);return r[t]=s,s}}mutableMerge(t,e){return void 0!==e[Ot]?e:(this.doMutableMerge(t,e),t)}doMutableMerge(t,e){if(e[Ht])this.mergeKeyed(t,e);else for(const n in e){const i=e[n],r=t[n];Qt(i)&&void 0===i[Ot]&&Qt(r)?this.doMutableMerge(r,i):t[n]=i}t.r&&(t.newRender=!0)}clone(t){return"structuredClone"in window?structuredClone(t):JSON.parse(JSON.stringify(t))}mergeKeyed(t,e){const n=this.clone(t);if(Object.entries(e[Ht]).forEach(([e,i])=>{if(e!==jt)if(Array.isArray(i)){const[r,s]=i;t[Ht][e]=n[Ht][r],this.doMutableMerge(t[Ht][e],s)}else if("number"==typeof i){const r=i;t[Ht][e]=n[Ht][r]}else"object"==typeof i&&(t[Ht][e]||(t[Ht][e]={}),this.doMutableMerge(t[Ht][e],i))}),e[Ht][jt]<t[Ht][jt])for(let n=e[Ht][jt];n<t[Ht][jt];n++)delete t[Ht][n];t[Ht][jt]=e[Ht][jt],e[Wt]&&(t[Wt]=e[Wt]),e[Vt]&&(t[Vt]=e[Vt])}cloneMerge(t,e,n){let i;if(e[Ht])i=this.clone(t),this.mergeKeyed(i,e);else{i={...t,...e};for(const r in i){const s=e[r],o=t[r];Qt(s)&&void 0===s[Ot]&&Qt(o)?i[r]=this.cloneMerge(o,s,n):void 0===s&&Qt(o)&&(i[r]=this.cloneMerge(o,{},n))}}return n?(delete i.magicId,delete i.newRender):t.r&&(i.newRender=!0),i}componentToString(t){const{buffer:e,streams:n}=this.recursiveCIDToString(this.rendered[Ut],t,null),[i,r,s]=$e(e,{});return{buffer:i,streams:n}}pruneCIDs(t){t.forEach(t=>delete this.rendered[Ut][t])}get(){return this.rendered}isNewFingerprint(t={}){return!!t[Ot]}templateStatic(t,e){return"number"==typeof t?e[t]:t}nextMagicID(){return this.magicId++,`m${this.magicId}-${this.parentViewId()}`}toOutputBuffer(t,e,n,i,r={}){if(t[Ht])return this.comprehensionToBuffer(t,e,n,i);t[Vt]&&(e=t[Vt],delete t[Vt]);let{[Ot]:s}=t;s=this.templateStatic(s,e),t[Ot]=s;const o=t.r,a=n.buffer;o&&(n.buffer=""),i&&o&&!t.magicId&&(t.newRender=!0,t.magicId=this.nextMagicID()),n.buffer+=s[0];for(let r=1;r<s.length;r++)this.dynamicToBuffer(t[r-1],e,n,i),n.buffer+=s[r];if(o){let e,s=!1;i||t.magicId?(s=i&&!t.newRender,e={[z]:t.magicId,...r}):e=r,s&&(e[W]=!0);const[o,l,h]=$e(n.buffer,e,s);t.newRender=!1,n.buffer=a+l+o+h}}comprehensionToBuffer(t,e,n,i){const r=e||t[Vt],s=this.templateStatic(t[Ot],e);t[Ot]=s,delete t[Vt];for(let e=0;e<t[Ht][jt];e++){n.buffer+=s[0];for(let o=1;o<s.length;o++)this.dynamicToBuffer(t[Ht][e][o-1],r,n,i),n.buffer+=s[o]}if(t[Wt]){const e=t[Wt],[i,r,s,o]=e||[null,{},[],null];void 0!==e&&(t[Ht][jt]>0||s.length>0||o)&&(delete t[Wt],t[Ht]={[jt]:0},n.streams.add(e))}}dynamicToBuffer(t,e,n,i){if("number"==typeof t){const{buffer:e,streams:i}=this.recursiveCIDToString(n.components,t,n.onlyCids);n.buffer+=e,n.streams=new Set([...n.streams,...i])}else Qt(t)?this.toOutputBuffer(t,e,n,i,{}):n.buffer+=t}recursiveCIDToString(t,e,n){const i=t[e]||Yt(`no component for CID ${e}`,t),r={[D]:e,[I]:this.viewId},s=n&&!n.has(e);i.newRender=!s,i.magicId=`c${e}-${this.parentViewId()}`;const o=!i.reset,{buffer:a,streams:l}=this.recursiveToString(i,t,n,o,r);return delete i.reset,{buffer:a,streams:l}}},Oe=[],Ue={exec(t,e,n,i,r,s){const[o,a]=s||[null,{callback:s&&s.callback}];("["===n.charAt(0)?JSON.parse(n):[[o,a]]).forEach(([s,l])=>{s===o&&((l={...a,...l}).callback=l.callback||a.callback),this.filterToEls(i.liveSocket,r,l).forEach(o=>{this[`exec_${s}`](t,e,n,i,r,o,l)})})},isVisible:t=>!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length>0),isInViewport(t){const e=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth;return e.right>0&&e.bottom>0&&e.left<i&&e.top<n},exec_exec(t,e,n,i,r,s,{attr:o,to:a}){const l=s.getAttribute(o);if(!l)throw new Error(`expected ${o} to contain JS command on "${a}"`);i.liveSocket.execJS(s,l,e)},exec_dispatch(t,e,n,i,r,s,{event:o,detail:a,bubbles:l,blocking:h}){if((a=a||{}).dispatcher=r,h){const t=new Promise((t,e)=>{a.done=t});i.liveSocket.asyncTransition(t)}oe.dispatchEvent(s,o,{detail:a,bubbles:l})},exec_push(t,e,n,i,r,s,o){const{event:a,data:l,target:h,page_loading:c,loading:u,value:d,dispatcher:f,callback:p}=o,m={loading:u,value:d,target:h,page_loading:!!c,originalEvent:t},g="change"===e&&f?f:r,v=h||g.getAttribute(i.binding("target"))||g,b=(t,i)=>{if(t.isConnected())if("change"===e){let{newCid:e,_target:s}=o;s=s||(oe.isFormInput(r)?r.name:void 0),s&&(m._target=s),t.pushInput(r,i,e,a||n,m,p)}else if("submit"===e){const{submitter:e}=o;t.submitForm(r,i,a||n,e,m,p)}else t.pushEvent(e,r,i,a||n,l,m,p)};o.targetView&&o.targetCtx?b(o.targetView,o.targetCtx):i.withinTargets(v,b)},exec_navigate(t,e,n,i,r,s,{href:o,replace:a}){i.liveSocket.historyRedirect(t,o,a?"replace":"push",null,r)},exec_patch(t,e,n,i,r,s,{href:o,replace:a}){i.liveSocket.pushHistoryPatch(t,o,a?"replace":"push",r)},exec_focus(t,e,n,i,r,s){ce.attemptFocus(s),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>ce.attemptFocus(s))})},exec_focus_first(t,e,n,i,r,s){ce.focusFirstInteractive(s)||ce.focusFirst(s),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>ce.focusFirstInteractive(s)||ce.focusFirst(s))})},exec_push_focus(t,e,n,i,r,s){Oe.push(s||r)},exec_pop_focus(t,e,n,i,r,s){const o=Oe.pop();o&&(o.focus(),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>o.focus())}))},exec_add_class(t,e,n,i,r,s,{names:o,transition:a,time:l,blocking:h}){this.addOrRemoveClasses(s,o,[],a,l,i,h)},exec_remove_class(t,e,n,i,r,s,{names:o,transition:a,time:l,blocking:h}){this.addOrRemoveClasses(s,[],o,a,l,i,h)},exec_toggle_class(t,e,n,i,r,s,{names:o,transition:a,time:l,blocking:h}){this.toggleClasses(s,o,a,l,i,h)},exec_toggle_attr(t,e,n,i,r,s,{attr:[o,a,l]}){this.toggleAttr(s,o,a,l)},exec_ignore_attrs(t,e,n,i,r,s,{attrs:o}){this.ignoreAttrs(s,o)},exec_transition(t,e,n,i,r,s,{time:o,transition:a,blocking:l}){this.addOrRemoveClasses(s,[],[],a,o,i,l)},exec_toggle(t,e,n,i,r,s,{display:o,ins:a,outs:l,time:h,blocking:c}){this.toggle(e,i,s,o,a,l,h,c)},exec_show(t,e,n,i,r,s,{display:o,transition:a,time:l,blocking:h}){this.show(e,i,s,o,a,l,h)},exec_hide(t,e,n,i,r,s,{display:o,transition:a,time:l,blocking:h}){this.hide(e,i,s,o,a,l,h)},exec_set_attr(t,e,n,i,r,s,{attr:[o,a]}){this.setOrRemoveAttrs(s,[[o,a]],[])},exec_remove_attr(t,e,n,i,r,s,{attr:o}){this.setOrRemoveAttrs(s,[],[o])},ignoreAttrs(t,e){oe.putPrivate(t,"JS:ignore_attrs",{apply:(t,n)=>{Array.from(t.attributes).forEach(t=>{e.some(e=>t.name==e||"*"===e||e.includes("*")&&null!=t.name.match(e))&&n.setAttribute(t.name,t.value)})}})},onBeforeElUpdated(t,e){const n=oe.private(t,"JS:ignore_attrs");n&&n.apply(t,e)},show(t,e,n,i,r,s,o){this.isVisible(n)||this.toggle(t,e,n,i,r,null,s,o)},hide(t,e,n,i,r,s,o){this.isVisible(n)&&this.toggle(t,e,n,i,null,r,s,o)},toggle(t,e,n,i,r,s,o,a){o=o||200;const[l,h,c]=r||[[],[],[]],[u,d,f]=s||[[],[],[]];if(l.length>0||u.length>0)if(this.isVisible(n)){const t=()=>{this.addOrRemoveClasses(n,d,l.concat(h).concat(c)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(n,u,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(n,f,d))})},i=()=>{this.addOrRemoveClasses(n,[],u.concat(f)),oe.putSticky(n,"toggle",t=>t.style.display="none"),n.dispatchEvent(new Event("phx:hide-end"))};n.dispatchEvent(new Event("phx:hide-start")),!1===a?(t(),setTimeout(i,o)):e.transition(o,t,i)}else{if("remove"===t)return;const r=()=>{this.addOrRemoveClasses(n,h,u.concat(d).concat(f));const t=i||this.defaultDisplay(n);window.requestAnimationFrame(()=>{this.addOrRemoveClasses(n,l,[]),window.requestAnimationFrame(()=>{oe.putSticky(n,"toggle",e=>e.style.display=t),this.addOrRemoveClasses(n,c,h)})})},s=()=>{this.addOrRemoveClasses(n,[],l.concat(c)),n.dispatchEvent(new Event("phx:show-end"))};n.dispatchEvent(new Event("phx:show-start")),!1===a?(r(),setTimeout(s,o)):e.transition(o,r,s)}else this.isVisible(n)?window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("phx:hide-start")),oe.putSticky(n,"toggle",t=>t.style.display="none"),n.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("phx:show-start"));const t=i||this.defaultDisplay(n);oe.putSticky(n,"toggle",e=>e.style.display=t),n.dispatchEvent(new Event("phx:show-end"))})},toggleClasses(t,e,n,i,r,s){window.requestAnimationFrame(()=>{const[o,a]=oe.getSticky(t,"classes",[[],[]]),l=e.filter(e=>o.indexOf(e)<0&&!t.classList.contains(e)),h=e.filter(e=>a.indexOf(e)<0&&t.classList.contains(e));this.addOrRemoveClasses(t,l,h,n,i,r,s)})},toggleAttr(t,e,n,i){t.hasAttribute(e)?void 0!==i?t.getAttribute(e)===n?this.setOrRemoveAttrs(t,[[e,i]],[]):this.setOrRemoveAttrs(t,[[e,n]],[]):this.setOrRemoveAttrs(t,[],[e]):this.setOrRemoveAttrs(t,[[e,n]],[])},addOrRemoveClasses(t,e,n,i,r,s,o){r=r||200;const[a,l,h]=i||[[],[],[]];if(a.length>0){const i=()=>{this.addOrRemoveClasses(t,l,[].concat(a).concat(h)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(t,h,l))})},c=()=>this.addOrRemoveClasses(t,e.concat(h),n.concat(a).concat(l));return void(!1===o?(i(),setTimeout(c,r)):s.transition(r,i,c))}window.requestAnimationFrame(()=>{const[i,r]=oe.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);oe.putSticky(t,"classes",t=>(t.classList.remove(...l),t.classList.add(...a),[a,l]))})},setOrRemoveAttrs(t,e,n){const[i,r]=oe.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);oe.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,e,{to:n})=>n?t.jsQuerySelectorAll(e,n,()=>{if("string"==typeof n)return document.querySelectorAll(n);if(n.closest){const t=e.closest(n.closest);return t?[t]:[]}return n.inner?e.querySelectorAll(n.inner):void 0}):[e],defaultDisplay:t=>({tr:"table-row",td:"table-cell"}[t.tagName.toLowerCase()]||"block"),transitionClasses(t){if(!t)return null;let[e,n,i]=Array.isArray(t)?t:[t.split(" "),[],[]];return e=Array.isArray(e)?e:e.split(" "),n=Array.isArray(n)?n:n.split(" "),i=Array.isArray(i)?i:i.split(" "),[e,n,i]}},He=Ue,je=(t,e)=>({exec(n,i){t.execJS(n,i,e)},show(n,i={}){const r=t.owner(n);He.show(e,r,n,i.display,He.transitionClasses(i.transition),i.time,i.blocking)},hide(n,i={}){const r=t.owner(n);He.hide(e,r,n,null,He.transitionClasses(i.transition),i.time,i.blocking)},toggle(n,i={}){const r=t.owner(n),s=He.transitionClasses(i.in),o=He.transitionClasses(i.out);He.toggle(e,r,n,i.display,s,o,i.time,i.blocking)},addClass(e,n,i={}){const r=Array.isArray(n)?n:n.split(" "),s=t.owner(e);He.addOrRemoveClasses(e,r,[],He.transitionClasses(i.transition),i.time,s,i.blocking)},removeClass(e,n,i={}){const r=Array.isArray(n)?n:n.split(" "),s=t.owner(e);He.addOrRemoveClasses(e,[],r,He.transitionClasses(i.transition),i.time,s,i.blocking)},toggleClass(e,n,i={}){const r=Array.isArray(n)?n:n.split(" "),s=t.owner(e);He.toggleClasses(e,r,He.transitionClasses(i.transition),i.time,s,i.blocking)},transition(e,n,i={}){const r=t.owner(e);He.addOrRemoveClasses(e,[],[],He.transitionClasses(n),i.time,r,i.blocking)},setAttribute(t,e,n){He.setOrRemoveAttrs(t,[[e,n]],[])},removeAttribute(t,e){He.setOrRemoveAttrs(t,[],[e])},toggleAttribute(t,e,n,i){He.toggleAttr(t,e,n,i)},push(n,i,r={}){t.withinOwners(n,t=>{const s=r.value||{};delete r.value;let o=new CustomEvent("phx:exec",{detail:{sourceElement:n}});He.exec(o,e,i,t,n,["push",{data:s,...r}])})},navigate(e,n={}){const i=new CustomEvent("phx:exec");t.historyRedirect(i,e,n.replace?"replace":"push",null,null)},patch(e,n={}){const i=new CustomEvent("phx:exec");t.pushHistoryPatch(i,e,n.replace?"replace":"push",null)},ignoreAttributes(t,e){He.ignoreAttrs(t,Array.isArray(e)?e:[e])}}),Be="hookId",qe=1,Je=class t{static makeID(){return qe++}static elementID(t){return oe.private(t,Be)}constructor(e,n,i){if(this.el=n,this.__attachView(e),this.__listeners=new Set,this.__isDisconnected=!1,oe.putPrivate(this.el,Be,t.makeID()),i){const t=new Set(["el","liveSocket","__view","__listeners","__isDisconnected","constructor","js","pushEvent","pushEventTo","handleEvent","removeHandleEvent","upload","uploadTo","__mounted","__updated","__beforeUpdate","__destroyed","__reconnected","__disconnected","__cleanup__"]);for(const e in i)Object.prototype.hasOwnProperty.call(i,e)&&(this[e]=i[e],t.has(e)&&console.warn(`Hook object for element #${n.id} overwrites core property '${e}'!`));["mounted","beforeUpdate","updated","destroyed","disconnected","reconnected"].forEach(t=>{i[t]&&"function"==typeof i[t]&&(this[t]=i[t])})}}__attachView(t){t?(this.__view=()=>t,this.liveSocket=t.liveSocket):(this.__view=()=>{throw new Error(`hook not yet attached to a live view: ${this.el.outerHTML}`)},this.liveSocket=null)}mounted(){}beforeUpdate(){}updated(){}destroyed(){}disconnected(){}reconnected(){}__mounted(){this.mounted()}__updated(){this.updated()}__beforeUpdate(){this.beforeUpdate()}__destroyed(){this.destroyed(),oe.deletePrivate(this.el,Be)}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected()}js(){return{...je(this.__view().liveSocket,"hook"),exec:t=>{this.__view().liveSocket.execJS(this.el,t,"hook")}}}pushEvent(t,e,n){const i=this.__view().pushHookEvent(this.el,null,t,e||{});if(void 0===n)return i.then(({reply:t})=>t);i.then(({reply:t,ref:e})=>n(t,e)).catch(()=>{})}pushEventTo(t,e,n,i){if(void 0===i){const i=[];this.__view().withinTargets(t,(t,e)=>{i.push({view:t,targetCtx:e})});const r=i.map(({view:t,targetCtx:i})=>t.pushHookEvent(this.el,i,e,n||{}));return Promise.allSettled(r)}this.__view().withinTargets(t,(t,r)=>{t.pushHookEvent(this.el,r,e,n||{}).then(({reply:t,ref:e})=>i(t,e)).catch(()=>{})})}handleEvent(t,e){const n={event:t,callback:t=>e(t.detail)};return window.addEventListener(`phx:${t}`,n.callback),this.__listeners.add(n),n}removeHandleEvent(t){window.removeEventListener(`phx:${t.event}`,t.callback),this.__listeners.delete(t)}upload(t,e){return this.__view().dispatchUploads(null,t,e)}uploadTo(t,e,n){return this.__view().withinTargets(t,(t,i)=>{t.dispatchUploads(i,e,n)})}__cleanup__(){this.__listeners.forEach(t=>this.removeHandleEvent(t))}},Ve=(t,e)=>{const n=t.endsWith("[]");let i=n?t.slice(0,-2):t;return i=i.replace(/([^\[\]]+)(\]?$)/,`${e}$1$2`),n&&(i+="[]"),i},We=(t,e,n=[])=>{const{submitter:i}=e;let r;if(i&&i.name){const t=document.createElement("input");t.type="hidden";const e=i.getAttribute("form");e&&t.setAttribute("form",e),t.name=i.name,t.value=i.value,i.parentElement.insertBefore(t,i),r=t}const s=new FormData(t),o=[];s.forEach((t,e,n)=>{t instanceof File&&o.push(e)}),o.forEach(t=>s.delete(t));const a=new URLSearchParams,{inputsUnused:l,onlyHiddenInputs:h}=Array.from(t.elements).reduce((t,e)=>{const{inputsUnused:n,onlyHiddenInputs:i}=t,r=e.name;if(!r)return t;void 0===n[r]&&(n[r]=!0),void 0===i[r]&&(i[r]=!0);const s=oe.private(e,st)||oe.private(e,lt),o="hidden"===e.type;return n[r]=n[r]&&!s,i[r]=i[r]&&o,t},{inputsUnused:{},onlyHiddenInputs:{}});for(const[t,e]of s.entries())if(0===n.length||n.indexOf(t)>=0){const n=l[t],r=h[t];!n||i&&i.name==t||r||a.append(Ve(t,"_unused_"),""),"string"==typeof e&&a.append(t,e)}return i&&r&&i.parentElement.removeChild(r),a.toString()},ze=class t{static closestView(t){const e=t.closest(ct);return e?oe.private(e,"view"):null}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;const s=oe.private(this.el,"view");if(void 0!==s&&!0!==s.isDead)throw Yt("The DOM element for this view has already been bound to a view.\n\n An element can only ever be associated with a single view!\n Please ensure that you are not trying to initialize multiple LiveSockets on the same page.\n This could happen if you're accidentally trying to render your root layout more than once.\n Ensure that the template set on the LiveView is different than the root layout.\n ",{view:s}),new Error("Cannot bind multiple views to the same DOM element.");oe.putPrivate(this.el,"view",this),this.id=this.el.id,this.ref=0,this.lastAckRef=null,this.childJoins=0,this.loaderTimer=null,this.disconnectedTimer=null,this.pendingDiffs=[],this.pendingForms=new Set,this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinAttempts=0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(t){t&&t()},this.stopCallback=function(){},this.pendingJoinOps=[],this.viewHooks={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.formsForRecovery={},this.channel=this.liveSocket.channel(`lv:${this.id}`,()=>{const t=this.href&&this.expandURL(this.href);return{redirect:this.redirect?t:void 0,url:this.redirect?void 0:t||void 0,params:this.connectParams(r),session:this.getSession(),static:this.getStatic(),flash:this.flash,sticky:this.el.hasAttribute(ut)}}),this.portalElementIds=new Set}setHref(t){this.href=t}setRedirect(t){this.redirect=!0,this.href=t}isMain(){return this.el.hasAttribute(et)}connectParams(t){const e=this.liveSocket.params(this.el),n=oe.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._mount_attempts=this.joinAttempts,e._live_referer=t,this.joinAttempts++,e}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(ht)}getStatic(){const t=this.el.getAttribute(dt);return""===t?null:t}destroy(t=function(){}){this.destroyAllChildren(),this.destroyPortalElements(),this.destroyed=!0,oe.deletePrivate(this.el,"view"),delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);const e=()=>{t();for(const t in this.viewHooks)this.destroyHook(this.viewHooks[t])};oe.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(X,K,G,Z,Q),this.el.classList.add(...t)}showLoader(t){if(clearTimeout(this.loaderTimer),t)this.loaderTimer=setTimeout(()=>this.showLoader(),t);else{for(const t in this.viewHooks)this.viewHooks[t].__disconnected();this.setContainerClasses(K)}}execAll(t){oe.all(this.el,`[${t}]`,e=>this.liveSocket.execJS(e,e.getAttribute(t)))}hideLoader(){clearTimeout(this.loaderTimer),clearTimeout(this.disconnectedTimer),this.setContainerClasses(X),this.execAll(this.binding("connected"))}triggerReconnected(){for(const 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,n=document){if(t instanceof HTMLElement||t instanceof SVGElement)return this.liveSocket.owner(t,n=>e(n,t));if(Xt(t)){0===oe.findComponentNodeList(this.id,t,n).length?Yt(`no component found matching phx-target of ${t}`):e(this,parseInt(t))}else{const i=Array.from(n.querySelectorAll(t));0===i.length&&Yt(`nothing found matching the phx-target selector "${t}"`),i.forEach(t=>this.liveSocket.owner(t,n=>e(n,t)))}}applyDiff(t,e,n){this.log(t,()=>["",Gt(e)]);const{diff:i,reply:r,events:s,title:o}=Fe.extract(e);n({diff:i,reply:r,events:s}),("string"==typeof o||"mount"==t&&this.isMain())&&window.requestAnimationFrame(()=>oe.putTitle(o))}onJoin(t){const{rendered:e,container:n,liveview_version:i,pid:r}=t;if(n){const[t,e]=n;this.el=oe.replaceRootContainer(this.el,t,e)}this.childJoins=0,this.joinPending=!0,this.flash=null,this.root===this&&(this.formsForRecovery=this.getFormsForRecovery()),this.isMain()&&null===window.history.state&&re.pushState("replace",{type:"patch",id:this.id,position:this.liveSocket.currentHistoryPosition}),i!==this.liveSocket.version()&&console.error(`LiveView asset version mismatch. JavaScript version ${this.liveSocket.version()} vs. server ${i}. To avoid issues, please ensure that your assets use the same version as the server.`),r&&this.el.setAttribute("data-phx-pid",r),re.dropLocal(this.liveSocket.localStorage,window.location.pathname,R),this.applyDiff("mount",e,({diff:e,events:n})=>{this.rendered=new Fe(this.id,e);const[i,r]=this.renderContainer(null,"join");this.dropPendingRefs(),this.joinCount++,this.joinAttempts=0,this.maybeRecoverForms(i,()=>{this.onJoinComplete(t,i,r,n)})})}dropPendingRefs(){oe.all(document,`[${F}="${this.refSrc()}"]`,t=>{t.removeAttribute($),t.removeAttribute(F),t.removeAttribute(O)})}onJoinComplete({live_patch:t},e,n,i){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(t,e,n,i);0===oe.findPhxChildrenInFragment(e,this.id).filter(t=>{const e=t.id&&this.el.querySelector(`[id="${t.id}"]`),n=e&&e.getAttribute(dt);return n&&t.setAttribute(dt,n),e&&e.setAttribute(nt,this.root.id),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=oe.byId(this.id),this.el.setAttribute(nt,this.root.id)}execNewMounted(t=document){let e=this.binding(it),n=this.binding(rt);this.all(t,`[${e}], [${n}]`,t=>{oe.maintainPrivateHooks(t,t,e,n),this.maybeAddNewHook(t)}),this.all(t,`[${this.binding(vt)}], [data-phx-${vt}]`,t=>{this.maybeAddNewHook(t)}),this.all(t,`[${this.binding(Rt)}]`,t=>{this.maybeMounted(t)})}all(t,e,n){oe.all(t,e,t=>{this.ownsElement(t)&&n(t)})}applyJoinPatch(t,e,n,i){this.joinCount>1&&this.pendingJoinOps.length&&(this.pendingJoinOps.forEach(t=>"function"==typeof t&&t()),this.pendingJoinOps=[]),this.attachTrueDocEl();const r=new De(this,this.el,this.id,e,n,null);if(r.markPrunableContentForRemoval(),this.performPatch(r,!1,!0),this.joinNewChildren(),this.execNewMounted(),this.joinPending=!1,this.liveSocket.dispatchEvents(i),this.applyPendingUpdates(),t){const{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]);const n=this.getHook(t),i=n&&oe.isIgnored(t,this.binding(bt));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){const e=t.getAttribute(this.binding(Rt)),n=e&&oe.private(t,"mounted");e&&!n&&(this.liveSocket.execJS(t,e),oe.putPrivate(t,"mounted",!0))}maybeAddNewHook(t){const e=this.addHook(t);e&&e.__mounted()}performPatch(t,e,n=!1){const i=[];let r=!1;const s=new Set;return this.liveSocket.triggerDOM("onPatchStart",[t.targetContainer]),t.after("added",t=>{this.liveSocket.triggerDOM("onNodeAdded",[t]);const e=this.binding(it),n=this.binding(rt);oe.maintainPrivateHooks(t,t,e,n),this.maybeAddNewHook(t),t.getAttribute&&this.maybeMounted(t)}),t.after("phxChildAdded",t=>{oe.isPhxSticky(t)?this.liveSocket.joinRootViews():r=!0}),t.before("updated",(t,e)=>{this.triggerBeforeUpdateHook(t,e)&&s.add(t.id),He.onBeforeElUpdated(t,e)}),t.after("updated",t=>{s.has(t.id)&&this.getHook(t).__updated()}),t.after("discarded",t=>{t.nodeType===Node.ELEMENT_NODE&&i.push(t)}),t.after("transitionsDiscarded",t=>this.afterElementsRemoved(t,e)),t.perform(n),this.afterElementsRemoved(i,e),this.liveSocket.triggerDOM("onPatchEnd",[t.targetContainer]),r}afterElementsRemoved(t,e){const n=[];t.forEach(t=>{const e=oe.all(t,`[${I}="${this.id}"][${D}]`),i=oe.all(t,`[${this.binding(vt)}], [data-phx-hook]`);e.concat(t).forEach(t=>{const e=this.componentID(t);Xt(e)&&-1===n.indexOf(e)&&t.getAttribute(I)===this.id&&n.push(e)}),i.concat(t).forEach(t=>{const e=this.getHook(t);e&&this.destroyHook(e)})}),e&&this.maybePushComponentsDestroyed(n)}joinNewChildren(){oe.findPhxChildren(document,this.id).forEach(t=>this.joinChild(t))}maybeRecoverForms(t,e){const n=this.binding("change"),i=this.root.formsForRecovery,r=document.createElement("template");r.innerHTML=t,oe.all(r.content,`[${kt}]`).forEach(t=>{r.content.firstElementChild.appendChild(t.content.firstElementChild)});const s=r.content.firstElementChild;s.id=this.id,s.setAttribute(nt,this.root.id),s.setAttribute(ht,this.getSession()),s.setAttribute(dt,this.getStatic()),s.setAttribute(tt,this.parent?this.parent.id:null);const o=oe.all(r.content,"form").filter(t=>t.id&&i[t.id]).filter(t=>!this.pendingForms.has(t.id)).filter(t=>i[t.id].getAttribute(n)===t.getAttribute(n)).map(t=>[i[t.id],t]);if(0===o.length)return e();o.forEach(([t,n],i)=>{this.pendingForms.add(n.id),this.pushFormRecovery(t,n,r.content.firstElementChild,()=>{this.pendingForms.delete(n.id),i===o.length-1&&e()})})}getChildById(t){return this.root.children[this.id][t]}getDescendentByEl(t){return t.id===this.id?this:this.children[t.getAttribute(tt)]?.[t.id]}destroyDescendent(t){for(const e in this.root.children)for(const n in this.root.children[e])if(n===t)return this.root.children[e][n].destroy()}joinChild(e){if(!this.getChildById(e.id)){const n=new t(e,this.liveSocket,this);return this.root.children[this.id][n.id]=n,n.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.pendingForms.clear(),this.formsForRecovery={},this.joinCallback(()=>{this.pendingJoinOps.forEach(([t,e])=>{t.isDestroyed()||e()}),this.pendingJoinOps=[]})}update(t,e,n=!1){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&this.root.isMain())return n||this.pendingDiffs.push({diff:t,events:e}),!1;this.rendered.mergeDiff(t);let i=!1;return this.rendered.isComponentOnlyDiff(t)?this.liveSocket.time("component patch complete",()=>{oe.findExistingParentCIDs(this.id,this.rendered.componentCIDs(t)).forEach(e=>{this.componentPatch(this.rendered.getComponent(t,e),e)&&(i=!0)})}):te(t)||this.liveSocket.time("full patch complete",()=>{const[e,n]=this.renderContainer(t,"update"),r=new De(this,this.el,this.id,e,n,null);i=this.performPatch(r,!0)}),this.liveSocket.dispatchEvents(e),i&&this.joinNewChildren(),!0}renderContainer(t,e){return this.liveSocket.time(`toString diff (${e})`,()=>{const e=this.el.tagName,n=t?this.rendered.componentCIDs(t):null,{buffer:i,streams:r}=this.rendered.toString(n);return[`<${e}>${i}</${e}>`,r]})}componentPatch(t,e){if(te(t))return!1;const{buffer:n,streams:i}=this.rendered.componentToString(e),r=new De(this,this.el,this.id,n,i,e);return this.performPatch(r,!0)}getHook(t){return this.viewHooks[Je.elementID(t)]}addHook(t){const e=Je.elementID(t);if(!t.getAttribute||this.ownsElement(t)){if(e&&!this.viewHooks[e]){const n=oe.getCustomElHook(t)||Yt(`no hook found for custom element: ${t.id}`);return this.viewHooks[e]=n,n.__attachView(this),n}if(!e&&t.getAttribute){const e=t.getAttribute(`data-phx-${vt}`)||t.getAttribute(this.binding(vt));if(!e)return;const n=this.liveSocket.getHookDefinition(e);if(n){if(!t.id)return void Yt(`no DOM ID for hook "${e}". Hooks require a unique ID on each element.`,t);let i;try{if("function"==typeof n&&n.prototype instanceof Je)i=new n(this,t);else{if("object"!=typeof n||null===n)return void Yt(`Invalid hook definition for "${e}". Expected a class extending ViewHook or an object definition.`,t);i=new Je(this,t,n)}}catch(n){const i=n instanceof Error?n.message:String(n);return void Yt(`Failed to create hook "${e}": ${i}`,t)}return this.viewHooks[Je.elementID(i.el)]=i,i}null!==e&&Yt(`unknown hook found for "${e}"`,t)}}}destroyHook(t){const e=Je.elementID(t.el);t.__destroyed(),t.__cleanup__(),delete this.viewHooks[e]}applyPendingUpdates(){this.pendingDiffs=this.pendingDiffs.filter(({diff:t,events:e})=>!this.update(t,e,!0)),this.eachChild(t=>t.applyPendingUpdates())}eachChild(t){const e=this.root.children[this.id]||{};for(const n in e)t(this.getChildById(n))}onChannel(t,e){this.liveSocket.onChannel(this.channel,t,t=>{this.isJoinPending()?this.joinCount>1?this.pendingJoinOps.push(()=>e(t)):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){const{to:e,kind:n,flash:i}=t,r=this.expandURL(e),s=new CustomEvent("phx:server-navigate",{detail:{to:e,kind:n,flash:i}});this.liveSocket.historyRedirect(s,r,n,i)}onLivePatch(t){const{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,reloadToken:n}){this.liveSocket.redirect(t,e,n)}isDestroyed(){return this.destroyed}joinDead(){this.isDead=!0}joinPush(){return this.joinPush=this.joinPush||this.channel.join(),this.joinPush}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.wrapPush(()=>this.channel.join(),{ok:t=>this.liveSocket.requestDOMUpdate(()=>this.onJoin(t)),error:t=>this.onJoinError(t),timeout:()=>this.onJoinError({reason:"timeout"})})}onJoinError(t){if("reload"===t.reason)return this.log("error",()=>[`failed mount with ${t.status}. Falling back to page reload`,t]),void this.onRedirect({to:this.root.href,reloadToken:t.token});if("unauthorized"===t.reason||"stale"===t.reason)return this.log("error",()=>["unauthorized live_redirect. Falling back to page request",t]),void this.onRedirect({to:this.root.href,flash:this.flash});if((t.redirect||t.live_redirect)&&(this.joinPending=!1,this.channel.leave()),t.redirect)return this.onRedirect(t.redirect);if(t.live_redirect)return this.onLiveRedirect(t.live_redirect);if(this.log("error",()=>["unable to join",t]),this.isMain())this.displayError([K,G,Q],{unstructuredError:t,errorKind:"server"}),this.liveSocket.isConnected()&&this.liveSocket.reloadWithJitter(this);else{this.joinAttempts>=3&&(this.root.displayError([K,G,Q],{unstructuredError:t,errorKind:"server"}),this.log("error",()=>["giving up trying to mount after 3 tries",t]),this.destroy());const e=oe.byId(this.el.id);e?(oe.mergeAttrs(e,this.el),this.displayError([K,G,Q],{unstructuredError:t,errorKind:"server"}),this.el=e):this.destroy()}}onClose(t){if(!this.isDestroyed()){if(this.isMain()&&this.liveSocket.hasPendingLink()&&"leave"!==t)return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),this.liveSocket.isUnloaded()&&this.showLoader(200)}}onError(t){this.onClose(t),this.liveSocket.isConnected()&&this.log("error",()=>["view crashed",t]),this.liveSocket.isUnloaded()||(this.liveSocket.isConnected()?this.displayError([K,G,Q],{unstructuredError:t,errorKind:"server"}):this.displayError([K,G,Z],{unstructuredError:t,errorKind:"client"}))}displayError(t,e={}){this.isMain()&&oe.dispatchEvent(window,"phx:page-loading-start",{detail:{to:this.href,kind:"error",...e}}),this.showLoader(),this.setContainerClasses(...t),this.delayedDisconnected()}delayedDisconnected(){this.disconnectedTimer=setTimeout(()=>{this.execAll(this.binding("disconnected"))},this.liveSocket.disconnectedTimeout)}wrapPush(t,e){const n=this.liveSocket.getLatencySim(),i=n?t=>setTimeout(()=>!this.isDestroyed()&&t(),n):t=>!this.isDestroyed()&&t();i(()=>{t().receive("ok",t=>i(()=>e.ok&&e.ok(t))).receive("error",t=>i(()=>e.error&&e.error(t))).receive("timeout",()=>i(()=>e.timeout&&e.timeout()))})}pushWithReply(t,e,n){if(!this.isConnected())return Promise.reject(new Error("no connection"));const[i,[r],s]=t?t({payload:n}):[null,[],{}],o=this.joinCount;let a=function(){};return s.page_loading&&(a=this.liveSocket.withPageLoading({kind:"element",target:r})),"number"!=typeof n.cid&&delete n.cid,new Promise((t,r)=>{this.wrapPush(()=>this.channel.push(e,n,3e4),{ok:e=>{null!==i&&(this.lastAckRef=i);const r=n=>{e.redirect&&this.onRedirect(e.redirect),e.live_patch&&this.onLivePatch(e.live_patch),e.live_redirect&&this.onLiveRedirect(e.live_redirect),a(),t({resp:e,reply:n,ref:i})};e.diff?this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",e.diff,({diff:t,reply:e,events:s})=>{null!==i&&this.undoRefs(i,n.event),this.update(t,s),r(e)})}):(null!==i&&this.undoRefs(i,n.event),r(null))},error:t=>r(new Error(`failed with reason: ${JSON.stringify(t)}`)),timeout:()=>{r(new Error("timeout")),this.joinCount===o&&this.liveSocket.reloadWithJitter(this,()=>{this.log("timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}})})}undoRefs(t,e,n){if(!this.isConnected())return;const i=`[${F}="${this.refSrc()}"]`;n?(n=new Set(n),oe.all(document,i,r=>{n&&!n.has(r)||(oe.all(r,i,n=>this.undoElRef(n,t,e)),this.undoElRef(r,t,e))})):oe.all(document,i,n=>this.undoElRef(n,t,e))}undoElRef(t,e,n){new ye(t).maybeUndo(e,n,i=>{const r=new De(this,t,this.id,i,[],null,{undoRef:e}),s=this.performPatch(r,!0);oe.all(t,`[${F}="${this.refSrc()}"]`,t=>this.undoElRef(t,e,n)),s&&this.joinNewChildren()})}refSrc(){return this.el.id}putRef(t,e,n,i={}){const r=this.ref++,s=this.binding(mt);if(i.loading){const e=oe.all(document,i.loading).map(t=>({el:t,lock:!0,loading:!0}));t=t.concat(e)}for(const{el:o,lock:a,loading:l}of t){if(!a&&!l)throw new Error("putRef requires lock or loading");if(o.setAttribute(F,this.refSrc()),l&&o.setAttribute($,r),a&&o.setAttribute(O,r),!l||i.submitter&&o!==i.submitter&&o!==i.form)continue;const h=new Promise(t=>{o.addEventListener(`phx:undo-lock:${r}`,()=>t(d),{once:!0})}),c=new Promise(t=>{o.addEventListener(`phx:undo-loading:${r}`,()=>t(d),{once:!0})});o.classList.add(`phx-${n}-loading`);const u=o.getAttribute(s);null!==u&&(o.getAttribute(gt)||o.setAttribute(gt,o.textContent),""!==u&&(o.textContent=u),o.setAttribute(pt,o.getAttribute(pt)||o.disabled),o.setAttribute("disabled",""));const d={event:e,eventType:n,ref:r,isLoading:l,isLocked:a,lockElements:t.filter(({lock:t})=>t).map(({el:t})=>t),loadingElements:t.filter(({loading:t})=>t).map(({el:t})=>t),unlock:t=>{t=Array.isArray(t)?t:[t],this.undoRefs(r,e,t)},lockComplete:h,loadingComplete:c,lock:t=>new Promise(e=>{if(this.isAcked(r))return e(d);t.setAttribute(O,r),t.setAttribute(F,this.refSrc()),t.addEventListener(`phx:lock-stop:${r}`,()=>e(d),{once:!0})})};i.payload&&(d.payload=i.payload),i.target&&(d.target=i.target),i.originalEvent&&(d.originalEvent=i.originalEvent),o.dispatchEvent(new CustomEvent("phx:push",{detail:d,bubbles:!0,cancelable:!1})),e&&o.dispatchEvent(new CustomEvent(`phx:push:${e}`,{detail:d,bubbles:!0,cancelable:!1}))}return[r,t.map(({el:t})=>t),i]}isAcked(t){return null!==this.lastAckRef&&this.lastAckRef>=t}componentID(t){const e=t.getAttribute&&t.getAttribute(D);return e?parseInt(e):null}targetComponentID(t,e,n={}){if(Xt(e))return e;const i=n.target||t.getAttribute(this.binding("target"));return Xt(i)?parseInt(i):e&&(null!==i||n.target)?this.closestComponentID(e):null}closestComponentID(t){return Xt(t)?t:t?ee(t.closest(`[${D}]`),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",n,i]),Promise.reject(new Error("unable to push hook event. LiveView not connected"));return this.pushWithReply(()=>this.putRef([{el:t,loading:!0,lock:!0}],n,"hook",{payload:i,target:e}),"event",{type:"hook",event:n,value:i,cid:this.closestComponentID(e)}).then(({resp:t,reply:e,ref:n})=>({reply:e,ref:n}))}extractMeta(t,e,n){const i=this.binding("value-");for(let n=0;n<t.attributes.length;n++){e||(e={});const r=t.attributes[n].name;r.startsWith(i)&&(e[r.replace(i,"")]=t.getAttribute(r))}if(void 0===t.value||t instanceof HTMLFormElement||(e||(e={}),e.value=t.value,"INPUT"===t.tagName&&at.indexOf(t.type)>=0&&!t.checked&&delete e.value),n){e||(e={});for(const t in n)e[t]=n[t]}return e}pushEvent(t,e,n,i,r,s={},o){this.pushWithReply(n=>this.putRef([{el:e,loading:!0,lock:!0}],i,t,{...s,payload:n?.payload}),"event",{type:t,event:i,value:this.extractMeta(e,r,s.value),cid:this.targetComponentID(e,n,s)}).then(({reply:t})=>o&&o(t)).catch(t=>Yt("Failed to push event",t))}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(j),entry_ref:e,progress:n,cid:r.targetComponentID(t.form,s)}).then(()=>i()).catch(t=>Yt("Failed to push file progress",t))})}pushInput(t,e,n,i,r,s){if(!t.form)throw new Error("form events require the input to be inside a form");let o;const a=Xt(n)?n:this.targetComponentID(t.form,e,r),l=e=>this.putRef([{el:t,loading:!0,lock:!0},{el:t.form,loading:!0,lock:!0}],i,"change",{...r,payload:e?.payload});let h;const c=this.extractMeta(t.form,{},r.value),u={};t instanceof HTMLButtonElement&&(u.submitter=t),h=t.getAttribute(this.binding("change"))?We(t.form,u,[t.name]):We(t.form,u),oe.isUploadInput(t)&&t.files&&t.files.length>0&&he.trackFiles(t,Array.from(t.files)),o=he.serializeUploads(t);const d={type:"form",event:i,value:h,meta:{_target:r._target||"undefined",...c},uploads:o,cid:a};this.pushWithReply(l,"event",d).then(({resp:n})=>{oe.isUploadInput(t)&&oe.isAutoUpload(t)?ye.onUnlock(t,()=>{if(he.filesAwaitingPreflight(t).length>0){const[r,o]=l();this.undoRefs(r,i,[t.form]),this.uploadFiles(t.form,i,e,r,a,e=>{s&&s(n),this.triggerAwaitingSubmit(t.form,i),this.undoRefs(r,i)})}}):s&&s(n)}).catch(t=>Yt("Failed to push input event",t))}triggerAwaitingSubmit(t,e){const n=this.getScheduledSubmit(t);if(n){const[i,r,s,o]=n;this.cancelSubmit(t,e),o()}}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,e){this.formSubmits=this.formSubmits.filter(([n,i,r,s])=>!n.isSameNode(t)||(this.undoRefs(i,e),!1))}disableForm(t,e,n={}){const i=t=>!(Zt(t,`${this.binding(bt)}=ignore`,t.form)||Zt(t,"data-phx-update=ignore",t.form)),r=Array.from(t.elements),s=r.filter(t=>t.hasAttribute(this.binding(mt))),o=r.filter(t=>"BUTTON"==t.tagName).filter(i),a=r.filter(t=>["INPUT","TEXTAREA","SELECT"].includes(t.tagName)).filter(i);o.forEach(t=>{t.setAttribute(pt,t.disabled),t.disabled=!0}),a.forEach(t=>{t.setAttribute(ft,t.readOnly),t.readOnly=!0,t.files&&(t.setAttribute(pt,t.disabled),t.disabled=!0)});const l=s.concat(o).concat(a).map(t=>({el:t,loading:!0,lock:!0})),h=[{el:t,loading:!0,lock:!1}].concat(l).reverse();return this.putRef(h,e,"submit",n)}pushFormSubmit(t,e,n,i,r,s){const o=e=>this.disableForm(t,n,{...r,form:t,payload:e?.payload,submitter:i});oe.putPrivate(t,"submitter",i);const a=this.targetComponentID(t,e);if(he.hasUploadsInProgress(t)){const[a,l]=o(),h=()=>this.pushFormSubmit(t,e,n,i,r,s);return this.scheduleSubmit(t,a,r,h)}if(he.inputsAwaitingPreflight(t).length>0){const[l,h]=o(),c=()=>[l,h,r];this.uploadFiles(t,n,e,l,a,e=>{if(he.inputsAwaitingPreflight(t).length>0)return this.undoRefs(l,n);const o=this.extractMeta(t,{},r.value),h=We(t,{submitter:i});this.pushWithReply(c,"event",{type:"form",event:n,value:h,meta:o,cid:a}).then(({resp:t})=>s(t)).catch(t=>Yt("Failed to push form submit",t))})}else if(!t.hasAttribute(F)||!t.classList.contains("phx-submit-loading")){const e=this.extractMeta(t,{},r.value),l=We(t,{submitter:i});this.pushWithReply(o,"event",{type:"form",event:n,value:l,meta:e,cid:a}).then(({resp:t})=>s(t)).catch(t=>Yt("Failed to push form submit",t))}}uploadFiles(t,e,n,i,r,s){const o=this.joinCount,a=he.activeFileInputs(t);let l=a.length;a.forEach(t=>{const r=new he(t,this,()=>{l--,0===l&&s()}),a=r.entries().map(t=>t.toPreflightPayload());if(0===a.length)return void l--;const h={ref:t.getAttribute(j),entries:a,cid:this.targetComponentID(t.form,n)};this.log("upload",()=>["sending preflight request",h]),this.pushWithReply(null,"allow_upload",h).then(({resp:t})=>{if(this.log("upload",()=>["got preflight response",t]),r.entries().forEach(e=>{t.entries&&!t.entries[e.ref]&&this.handleFailedEntryPreflight(e.ref,"failed preflight",r)}),t.error||0===Object.keys(t.entries).length){this.undoRefs(i,e);(t.error||[]).map(([t,e])=>{this.handleFailedEntryPreflight(t,e,r)})}else{const e=t=>{this.channel.onError(()=>{this.joinCount===o&&t()})};r.initAdapterUpload(t,e,this.liveSocket)}}).catch(t=>Yt("Failed to push upload",t))})}handleFailedEntryPreflight(t,e,n){if(n.isAutoUpload()){const e=n.entries().find(e=>e.ref===t.toString());e&&e.cancel()}else n.entries().map(t=>t.cancel());this.log("upload",()=>[`error for entry ${t}`,e])}dispatchUploads(t,e,n){const i=this.targetCtxElement(t)||this.el,r=oe.findUploadInputs(i).filter(t=>t.name===e);0===r.length?Yt(`no live file inputs found matching the name "${e}"`):r.length>1?Yt(`duplicate live file inputs found matching the name "${e}"`):oe.dispatchEvent(r[0],H,{detail:{files:n}})}targetCtxElement(t){if(Xt(t)){const[e]=oe.findComponentNodeList(this.id,t);return e}return t||null}pushFormRecovery(t,e,n,i){const r=this.binding("change"),s=e.getAttribute(this.binding("target"))||e,o=e.getAttribute(this.binding(xt))||e.getAttribute(this.binding("change")),a=Array.from(t.elements).filter(t=>oe.isFormInput(t)&&t.name&&!t.hasAttribute(r));if(0===a.length)return void i();a.forEach(t=>t.hasAttribute(j)&&he.clearFiles(t));const l=a.find(t=>"hidden"!==t.type)||a[0];let h=0;this.withinTargets(s,(n,r)=>{const s=this.targetComponentID(e,r);h++;let a=new CustomEvent("phx:form-recovery",{detail:{sourceElement:t}});He.exec(a,"change",o,this,l,["push",{_target:l.name,targetView:n,targetCtx:r,newCid:s,callback:()=>{h--,0===h&&i()}}])},n)}pushLinkPatch(t,e,n,i){const r=this.liveSocket.setPendingLink(e),s=t.isTrusted&&"popstate"!==t.type,o=n?()=>this.putRef([{el:n,loading:s,lock:!0}],null,"click"):null,a=()=>this.liveSocket.redirect(window.location.href),l=e.startsWith("/")?`${location.protocol}//${location.host}${e}`:e;this.pushWithReply(o,"live_patch",{url:l}).then(({resp:t})=>{this.liveSocket.requestDOMUpdate(()=>{t.link_redirect?this.liveSocket.replaceMain(e,null,i,r):(this.liveSocket.commitPendingLink(r)&&(this.href=e),this.applyPendingUpdates(),i&&i(r))})},({error:t,timeout:e})=>a())}getFormsForRecovery(){if(0===this.joinCount)return{};const t=this.binding("change");return oe.all(document,`#${CSS.escape(this.id)} form[${t}], [${Et}="${CSS.escape(this.id)}"] form[${t}]`).filter(t=>t.id).filter(t=>t.elements.length>0).filter(t=>"ignore"!==t.getAttribute(this.binding(xt))).map(t=>{const e=t.cloneNode(!0);Le(e,t,{onBeforeElUpdated:(e,n)=>(oe.copyPrivates(e,n),e.getAttribute("form")!==t.id||(e.parentNode.removeChild(e),!1))});const n=document.querySelectorAll(`[form="${CSS.escape(t.id)}"]`);return Array.from(n).forEach(t=>{const n=t.cloneNode(!0);Le(n,t),oe.copyPrivates(n,t),n.removeAttribute("form"),e.appendChild(n)}),e}).reduce((t,e)=>(t[e.id]=e,t),{})}maybePushComponentsDestroyed(t){let e=t.filter(t=>0===oe.findComponentNodeList(this.id,t).length);const n=t=>{this.isDestroyed()||Yt("Failed to push components destroyed",t)};e.length>0&&(e.forEach(t=>this.rendered.resetRender(t)),this.pushWithReply(null,"cids_will_destroy",{cids:e}).then(()=>{this.liveSocket.requestDOMUpdate(()=>{let t=e.filter(t=>0===oe.findComponentNodeList(this.id,t).length);t.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:t}).then(({resp:t})=>{this.rendered.pruneCIDs(t.cids)}).catch(n)})}).catch(n))}ownsElement(t){let e=oe.closestViewEl(t);return t.getAttribute(tt)===this.id||e&&e.id===this.id||!e&&this.isDead}submitForm(t,e,n,i,r={}){oe.putPrivate(t,lt,!0);Array.from(t.elements).forEach(t=>oe.putPrivate(t,lt,!0)),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(t,e,n,i,r,()=>{this.liveSocket.restorePreviouslyActiveFocus()})}binding(t){return this.liveSocket.binding(t)}pushPortalElementId(t){this.portalElementIds.add(t)}dropPortalElementId(t){this.portalElementIds.delete(t)}destroyPortalElements(){this.portalElementIds.forEach(t=>{const e=document.getElementById(t);e&&e.remove()})}},Ye=class{constructor(){this.transitions=new Set,this.promises=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(t=>{clearTimeout(t),this.transitions.delete(t)}),this.promises.clear(),this.flushPendingOps()}after(t){0===this.size()?t():this.pushPendingOp(t)}addTransition(t,e,n){e();const i=setTimeout(()=>{this.transitions.delete(i),n(),this.flushPendingOps()},t);this.transitions.add(i)}addAsyncTransition(t){this.promises.add(t),t.then(()=>{this.promises.delete(t),this.flushPendingOps()})}pushPendingOp(t){this.pendingOps.push(t)}size(){return this.transitions.size+this.promises.size}flushPendingOps(){if(this.size()>0)return;const t=this.pendingOps.shift();t&&(t(),this.flushPendingOps())}},Xe=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=Kt(n.params||{}),this.viewLogger=n.viewLogger,this.metadataCallbacks=n.metadata||{},this.defaults=Object.assign(Gt($t),n.defaults||{}),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=Gt(window.location),this.hooks=n.hooks||{},this.uploaders=n.uploaders||{},this.loaderTimeout=n.loaderTimeout||1,this.disconnectedTimeout=n.disconnectedTimeout||500,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.boundEventNames=new Set,this.blockPhxChangeWhileComposing=n.blockPhxChangeWhileComposing||!1,this.serverCloseRef=null,this.domCallbacks=Object.assign({jsQuerySelectorAll:null,onPatchStart:Kt(),onPatchEnd:Kt(),onNodeAdded:Kt(),onBeforeElUpdated:Kt()},n.dom||{}),this.transitions=new Ye,this.currentHistoryPosition=parseInt(this.sessionStorage.getItem(Pt))||0,window.addEventListener("pagehide",t=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.1.17"}isProfileEnabled(){return"true"===this.sessionStorage.getItem(Tt)}isDebugEnabled(){return"true"===this.sessionStorage.getItem(St)}isDebugDisabled(){return"false"===this.sessionStorage.getItem(St)}enableDebug(){this.sessionStorage.setItem(St,"true")}enableProfiling(){this.sessionStorage.setItem(Tt,"true")}disableDebug(){this.sessionStorage.setItem(St,"false")}disableProfiling(){this.sessionStorage.removeItem(Tt)}enableLatencySim(t){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(Mt,t)}disableLatencySim(){this.sessionStorage.removeItem(Mt)}getLatencySim(){const t=this.sessionStorage.getItem(Mt);return t?parseInt(t):null}getSocket(){return this.socket}connect(){"localhost"!==window.location.hostname||this.isDebugDisabled()||this.enableDebug();const t=()=>{this.resetReloadStatus(),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.serverCloseRef&&(this.socket.off(this.serverCloseRef),this.serverCloseRef=null),this.socket.disconnect(t)}replaceTransport(t){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(t),this.connect()}execJS(t,e,n=null){const i=new CustomEvent("phx:exec",{detail:{sourceElement:t}});this.owner(t,r=>He.exec(i,n,e,r,t))}js(){return je(this,"js")}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);const n=e();return console.timeEnd(t),n}log(t,e,n){if(this.viewLogger){const[i,r]=n();this.viewLogger(t,e,i,r)}else if(this.isDebugEnabled()){const[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)}asyncTransition(t){this.transitions.addAsyncTransition(t)}transition(t,e,n=function(){}){this.transitions.addTransition(t,e,n)}onChannel(t,e,n){t.on(e,t=>{const e=this.getLatencySim();e?setTimeout(()=>n(t),e):n(t)})}reloadWithJitter(t,e){clearTimeout(this.reloadWithJitterTimer),this.disconnect();const n=this.reloadJitterMin,i=this.reloadJitterMax;let r=Math.floor(Math.random()*(i-n+1))+n;const s=re.updateLocal(this.localStorage,window.location.pathname,R,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)}getHookDefinition(t){if(t)return this.maybeInternalHook(t)||this.hooks[t]||this.maybeRuntimeHook(t)}maybeInternalHook(t){return t&&t.startsWith("Phoenix.")&&be[t.split(".")[1]]}maybeRuntimeHook(t){const e=document.querySelector(`script[${Ct}="${CSS.escape(t)}"]`);if(!e)return;let n=window[`phx_hook_${t}`];if(!n||"function"!=typeof n)return void Yt("a runtime hook must be a function",e);const i=n();if(i&&("object"==typeof i||"function"==typeof i))return i;Yt("runtime hook must return an object with hook callbacks or an instance of ViewHook",e)}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(){const t=document.body;if(t&&!this.isPhxView(t)&&!this.isPhxView(document.firstElementChild)){const e=this.newRootView(t);e.setHref(this.getHref()),e.joinDead(),this.main||(this.main=e),window.requestAnimationFrame(()=>{e.execNewMounted(),this.maybeScroll(history.state?.scroll)})}}joinRootViews(){let t=!1;return oe.all(document,`${ct}:not([${tt}])`,e=>{if(!this.getRootById(e.id)){const t=this.newRootView(e);oe.isPhxSticky(e)||t.setHref(this.getHref()),t.join(),e.hasAttribute(et)&&(this.main=t)}t=!0}),t}redirect(t,e,n){n&&re.setCookie(Lt,n,60),this.unload(),re.redirect(t,e)}replaceMain(t,e,n=null,i=this.setPendingLink(t)){const r=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;const s=oe.findPhxSticky(document)||[],o=oe.all(this.outgoingMainEl,`[${this.binding("remove")}]`).filter(t=>!oe.isChildOfAny(t,s)),a=oe.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(a,e,r),this.main.setRedirect(t),this.transitionRemoves(o),this.main.join((t,e)=>{1===t&&this.commitPendingLink(i)&&this.requestDOMUpdate(()=>{o.forEach(t=>t.remove()),s.forEach(t=>a.appendChild(t)),this.outgoingMainEl.replaceWith(a),this.outgoingMainEl=null,n&&n(i),e()})})}transitionRemoves(t,e){const n=this.binding("remove"),i=t=>{t.preventDefault(),t.stopImmediatePropagation()};t.forEach(t=>{for(const e of this.boundEventNames)t.addEventListener(e,i,!0);this.execJS(t,t.getAttribute(n),"remove")}),this.requestDOMUpdate(()=>{t.forEach(t=>{for(const e of this.boundEventNames)t.removeEventListener(e,i,!0)}),e&&e()})}isPhxView(t){return t.getAttribute&&null!==t.getAttribute(ht)}newRootView(t,e,n){const i=new ze(t,this,null,e,n);return this.roots[i.id]=i,i}owner(t,e){let n;const i=oe.closestViewEl(t);return n=i?this.getViewByEl(i):this.main,n&&e?e(n):n}withinOwners(t,e){this.owner(t,n=>e(n,t))}getViewByEl(t){const e=t.getAttribute(nt);return ee(this.getRootById(e),e=>e.getDescendentByEl(t))}getRootById(t){return this.roots[t]}destroyAllViews(){for(const t in this.roots)this.roots[t].destroy(),delete this.roots[t];this.main=null}destroyViewByEl(t){const e=this.getRootById(t.getAttribute(nt));e&&e.id===t.id?(e.destroy(),delete this.roots[e.id]):e&&e.destroyDescendent(t.id)}getActiveElement(){return document.activeElement}dropActiveElement(t){this.prevActive&&t.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive instanceof HTMLElement&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive instanceof HTMLElement&&this.prevActive.blur()}bindTopLevelEvents({dead:t}={}){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.serverCloseRef=this.socket.onClose(t=>{if(t&&1e3===t.code&&this.main)return this.reloadWithJitter(this.main)}),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)=>{const o=i.getAttribute(this.binding("key")),a=t.key&&t.key.toLowerCase();if(o&&o.toLowerCase()!==a)return;const l={key:t.key,...this.eventMeta(e,t,i)};He.exec(t,e,r,n,i,["push",{data:l}])}),this.bind({blur:"focusout",focus:"focusin"},(t,e,n,i,r,s)=>{if(!s){const s={key:t.key,...this.eventMeta(e,t,i)};He.exec(t,e,r,n,i,["push",{data:s}])}}),this.bind({blur:"blur",focus:"focus"},(t,e,n,i,r,s)=>{if("window"===s){const s=this.eventMeta(e,t,i);He.exec(t,e,r,n,i,["push",{data:s}])}}),this.on("dragover",t=>t.preventDefault()),this.on("drop",t=>{t.preventDefault();const e=ee(Zt(t.target,this.binding(q)),t=>t.getAttribute(this.binding(q))),n=e&&document.getElementById(e),i=Array.from(t.dataTransfer.files||[]);n&&n instanceof HTMLInputElement&&!n.disabled&&0!==i.length&&n.files instanceof FileList&&(he.trackFiles(n,i,t.dataTransfer),n.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(H,t=>{const e=t.target;if(!oe.isUploadInput(e))return;const n=Array.from(t.detail.files||[]).filter(t=>t instanceof File||t instanceof Blob);he.trackFiles(e,n),e.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(t,e,n){const i=this.metadataCallbacks[t];return i?i(e,n):{}}setPendingLink(t){return this.linkRef++,this.pendingLink=t,this.resetReloadStatus(),this.linkRef}resetReloadStatus(){re.deleteCookie(Lt)}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(const n in t){const i=t[n];this.on(i,t=>{const 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)})}):oe.all(document,`[${s}]`,r=>{const o=r.getAttribute(s);this.debounce(r,t,i,()=>{this.withinOwners(r,i=>{e(t,n,i,r,o,"window")})})})})}}bindClicks(){this.on("mousedown",t=>this.clickStartedAtTarget=t.target),this.bindClick("click","click")}bindClick(t,e){const n=this.binding(e);window.addEventListener(t,t=>{let e=null;0===t.detail&&(this.clickStartedAtTarget=t.target);const i=this.clickStartedAtTarget||t.target;e=Zt(t.target,n),this.dispatchClickAway(t,i),this.clickStartedAtTarget=null;const r=e&&e.getAttribute(n);r?("#"===e.getAttribute("href")&&t.preventDefault(),e.hasAttribute(F)||this.debounce(e,t,"click",()=>{this.withinOwners(e,n=>{He.exec(t,"click",r,n,e,["push",{data:this.eventMeta("click",t,e)}])})})):oe.isNewPageClick(t,window.location)&&this.unload()},!1)}dispatchClickAway(t,e){const n=this.binding("click-away");oe.all(document,`[${n}]`,i=>{i.isSameNode(e)||i.contains(e)||this.withinOwners(i,e=>{const r=i.getAttribute(n);He.isVisible(i)&&He.isInViewport(i)&&He.exec(t,"click",r,e,i,["push",{data:this.eventMeta("click",t,t.target)}])})})}bindNav(){if(!re.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let t=null;window.addEventListener("scroll",e=>{clearTimeout(t),t=setTimeout(()=>{re.updateCurrentState(t=>Object.assign(t,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;const{type:e,backType:n,id:i,scroll:r,position:s}=t.state||{},o=window.location.href,a=s>this.currentHistoryPosition,l=a?e:n||e;this.currentHistoryPosition=s||0,this.sessionStorage.setItem(Pt,this.currentHistoryPosition.toString()),oe.dispatchEvent(window,"phx:navigate",{detail:{href:o,patch:"patch"===l,pop:!0,direction:a?"forward":"backward"}}),this.requestDOMUpdate(()=>{const e=()=>{this.maybeScroll(r)};this.main.isConnected()&&"patch"===l&&i===this.main.id?this.main.pushLinkPatch(t,o,null,e):this.replaceMain(o,null,e)})},!1),window.addEventListener("click",t=>{const e=Zt(t.target,N),n=e&&e.getAttribute(N);if(!n||!this.isConnected()||!this.main||oe.wantsNewTab(t))return;const i=e.href instanceof SVGAnimatedString?e.href.baseVal:e.href,r=e.getAttribute("data-phx-link-state");t.preventDefault(),t.stopImmediatePropagation(),this.pendingLink!==i&&this.requestDOMUpdate(()=>{if("patch"===n)this.pushHistoryPatch(t,i,r,e);else{if("redirect"!==n)throw new Error(`expected ${N} to be "patch" or "redirect", got: ${n}`);this.historyRedirect(t,i,r,null,e)}const s=e.getAttribute(this.binding("click"));s&&this.requestDOMUpdate(()=>this.execJS(e,s,"click"))})},!1)}maybeScroll(t){"number"==typeof t&&requestAnimationFrame(()=>{window.scrollTo(0,t)})}dispatchEvent(t,e={}){oe.dispatchEvent(window,`phx:${t}`,{detail:e})}dispatchEvents(t){t.forEach(([t,e])=>this.dispatchEvent(t,e))}withPageLoading(t,e){oe.dispatchEvent(window,"phx:page-loading-start",{detail:t});const n=()=>oe.dispatchEvent(window,"phx:page-loading-stop",{detail:t});return e?e(n):n}pushHistoryPatch(t,e,n,i){if(!this.isConnected()||!this.main.isMain())return re.redirect(e);this.withPageLoading({to:e,kind:"patch"},r=>{this.main.pushLinkPatch(t,e,i,t=>{this.historyPatch(e,n,t),r()})})}historyPatch(t,e,n=this.setPendingLink(t)){this.commitPendingLink(n)&&(this.currentHistoryPosition++,this.sessionStorage.setItem(Pt,this.currentHistoryPosition.toString()),re.updateCurrentState(t=>({...t,backType:"patch"})),re.pushState(e,{type:"patch",id:this.main.id,position:this.currentHistoryPosition},t),oe.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:t,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location))}historyRedirect(t,e,n,i,r){const s=r&&t.isTrusted&&"popstate"!==t.type;if(s&&r.classList.add("phx-click-loading"),!this.isConnected()||!this.main.isMain())return re.redirect(e,i);if(/^\/$|^\/[^\/]+.*$/.test(e)){const{protocol:t,host:n}=window.location;e=`${t}//${n}${e}`}const o=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},t=>{this.replaceMain(e,i,i=>{i===this.linkRef&&(this.currentHistoryPosition++,this.sessionStorage.setItem(Pt,this.currentHistoryPosition.toString()),re.updateCurrentState(t=>({...t,backType:"redirect"})),re.pushState(n,{type:"redirect",id:this.main.id,scroll:o,position:this.currentHistoryPosition},e),oe.dispatchEvent(window,"phx:navigate",{detail:{href:e,patch:!1,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location)),s&&r.classList.remove("phx-click-loading"),t()})})}registerNewLocation(t){const{pathname:e,search:n}=this.currentLocation;return e+n!==t.pathname+t.search&&(this.currentLocation=Gt(t),!0)}bindForms(){let t=0,e=!1;this.on("submit",t=>{const 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(()=>{oe.isUnloadableFormSubmit(t)&&this.unload(),t.target.submit()})}))}),this.on("submit",t=>{const e=t.target.getAttribute(this.binding("submit"));e?(t.preventDefault(),t.target.disabled=!0,this.withinOwners(t.target,n=>{He.exec(t,"submit",e,n,t.target,["push",{submitter:t.submitter}])})):oe.isUnloadableFormSubmit(t)&&this.unload()});for(const e of["change","input"])this.on(e,n=>{if(n instanceof CustomEvent&&(n.target instanceof HTMLInputElement||n.target instanceof HTMLSelectElement||n.target instanceof HTMLTextAreaElement)&&void 0===n.target.form){if(n.detail&&n.detail.dispatcher)throw new Error(`dispatching a custom ${e} event is only supported on input elements inside a form`);return}const i=this.binding("change"),r=n.target;if(this.blockPhxChangeWhileComposing&&n.isComposing){const t=`composition-listener-${e}`;return void(oe.private(r,t)||(oe.putPrivate(r,t,!0),r.addEventListener("compositionend",()=>{r.dispatchEvent(new Event(e,{bubbles:!0})),oe.deletePrivate(r,t)},{once:!0})))}const 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;const l=s?r:r.form,h=t;t++;const{at:c,type:u}=oe.private(r,"prev-iteration")||{};c===h-1&&"change"===e&&"input"===u||(oe.putPrivate(r,"prev-iteration",{at:h,type:e}),this.debounce(r,n,e,()=>{this.withinOwners(l,t=>{oe.putPrivate(r,st,!0),He.exec(n,"change",a,t,r,["push",{_target:n.target.name,dispatcher:l}])})}))});this.on("reset",t=>{const e=t.target;oe.resetForm(e);const n=Array.from(e.elements).find(t=>"reset"===t.type);n&&window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(t,e,n,i){if("blur"===n||"focusout"===n)return i();const r=this.binding("debounce"),s=this.binding("throttle"),o=this.defaults.debounce.toString(),a=this.defaults.throttle.toString();this.withinOwners(t,n=>{oe.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){this.boundEventNames.add(t),window.addEventListener(t,t=>{this.silenced||e(t)})}jsQuerySelectorAll(t,e,n){const i=this.domCallbacks.jsQuerySelectorAll;return i?i(t,e,n):n()}};var Ke={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(){var t=this.dataset.confirm_message;t&&!window.confirm(t)||(e.value=this.dataset.name,n.click())})})}};function Ge(t){return t}var Ze=1e-6;function Qe(t){return"translate("+t+",0)"}function tn(t){return"translate(0,"+t+")"}function en(t){return e=>+t(e)}function nn(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function rn(){return!this.__axis}function sn(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,c=4===t||2===t?"x":"y",u=1===t||3===t?Qe:tn;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):Ge:r,m=Math.max(s,0)+a,g=e.range(),v=+g[0]+l,b=+g[g.length-1]+l,y=(e.bandwidth?nn:en)(e.copy(),l),w=d.selection?d.selection():d,k=w.selectAll(".domain").data([null]),E=w.selectAll(".tick").data(f,e).order(),A=E.exit(),C=E.enter().append("g").attr("class","tick"),_=E.select("line"),x=E.select("text");k=k.merge(k.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),E=E.merge(C),_=_.merge(C.append("line").attr("stroke","currentColor").attr(c+"2",h*s)),x=x.merge(C.append("text").attr("fill","currentColor").attr(c,h*m).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),d!==w&&(k=k.transition(d),E=E.transition(d),_=_.transition(d),x=x.transition(d),A=A.transition(d).attr("opacity",Ze).attr("transform",function(t){return isFinite(t=y(t))?u(t+l):this.getAttribute("transform")}),C.attr("opacity",Ze).attr("transform",function(t){var e=this.parentNode.__axis;return u((e&&isFinite(e=e(t))?e:y(t))+l)})),A.remove(),k.attr("d",4===t||2===t?o?"M"+h*o+","+v+"H"+l+"V"+b+"H"+h*o:"M"+l+","+v+"V"+b:o?"M"+v+","+h*o+"V"+l+"H"+b+"V"+h*o:"M"+v+","+l+"H"+b),E.attr("opacity",1).attr("transform",function(t){return u(y(t)+l)}),_.attr(c+"2",h*s),x.attr(c,h*m).text(p),w.filter(rn).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=y})}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 on(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function an(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=on,i=(e,n)=>on(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 ln=Math.sqrt(50),hn=Math.sqrt(10),cn=Math.sqrt(2);function un(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>=ln?10:s>=hn?5:s>=cn?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(s>=ln?10:s>=hn?5:s>=cn?2:1)}function dn(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>=ln?r*=10:s>=hn?r*=5:s>=cn&&(r*=2),e<t?-r:r}const fn=1e3,pn=6e4,mn=36e5,gn=864e5,vn=6048e5,bn=2592e6,yn=31536e6;var wn=new Date,kn=new Date;function En(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 En(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 wn.setTime(+e),kn.setTime(+i),t(wn),t(kn),Math.floor(n(wn,kn))},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 An=En(function(){},function(t,e){t.setTime(+t+e)},function(t,e){return e-t});An.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?En(function(e){e.setTime(Math.floor(e/t)*t)},function(e,n){e.setTime(+e+n*t)},function(e,n){return(n-e)/t}):An:null};const Cn=An;An.range;var _n=En(function(t){t.setTime(t-t.getMilliseconds())},function(t,e){t.setTime(+t+e*fn)},function(t,e){return(e-t)/fn},function(t){return t.getUTCSeconds()});const xn=_n;_n.range;var Sn=En(function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*fn)},function(t,e){t.setTime(+t+e*pn)},function(t,e){return(e-t)/pn},function(t){return t.getMinutes()});const Tn=Sn;Sn.range;var Mn=En(function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*fn-t.getMinutes()*pn)},function(t,e){t.setTime(+t+e*mn)},function(t,e){return(e-t)/mn},function(t){return t.getHours()});const Pn=Mn;Mn.range;var Rn=En(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*pn)/gn,t=>t.getDate()-1);const Ln=Rn;Rn.range;function Dn(t){return En(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-(e.getTimezoneOffset()-t.getTimezoneOffset())*pn)/vn})}var In=Dn(0),Nn=Dn(1),$n=Dn(2),Fn=Dn(3),On=Dn(4),Un=Dn(5),Hn=Dn(6),jn=(In.range,Nn.range,$n.range,Fn.range,On.range,Un.range,Hn.range,En(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 Bn=jn;jn.range;var qn=En(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()});qn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?En(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 Jn=qn;qn.range;var Vn=En(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+e*pn)},function(t,e){return(e-t)/pn},function(t){return t.getUTCMinutes()});const Wn=Vn;Vn.range;var zn=En(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+e*mn)},function(t,e){return(e-t)/mn},function(t){return t.getUTCHours()});const Yn=zn;zn.range;var Xn=En(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/gn},function(t){return t.getUTCDate()-1});const Kn=Xn;Xn.range;function Gn(t){return En(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)/vn})}var Zn=Gn(0),Qn=Gn(1),ti=Gn(2),ei=Gn(3),ni=Gn(4),ii=Gn(5),ri=Gn(6),si=(Zn.range,Qn.range,ti.range,ei.range,ni.range,ii.range,ri.range,En(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 oi=si;si.range;var ai=En(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()});ai.every=function(t){return isFinite(t=Math.floor(t))&&t>0?En(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 li=ai;ai.range;function hi(t,e,n,i,r,s){const o=[[xn,1,fn],[xn,5,5e3],[xn,15,15e3],[xn,30,3e4],[s,1,pn],[s,5,3e5],[s,15,9e5],[s,30,18e5],[r,1,mn],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,gn],[i,2,1728e5],[n,1,vn],[e,1,bn],[e,3,7776e6],[t,1,yn]];function a(e,n,i){const r=Math.abs(n-e)/i,s=an(([,,t])=>t).right(o,r);if(s===o.length)return t.every(dn(e/yn,n/yn,i));if(0===s)return Cn.every(Math.max(dn(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[ci,ui]=hi(li,oi,Zn,Kn,Yn,Wn),[di,fi]=hi(Jn,Bn,In,Ln,Pn,Tn);function pi(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 mi(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 gi(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}var vi,bi,yi={"-":"",_:" ",0:"0"},wi=/^\s*\d+/,ki=/^%/,Ei=/[\\^$*+?|[\]().{}]/g;function Ai(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 Ci(t){return t.replace(Ei,"\\$&")}function _i(t){return new RegExp("^(?:"+t.map(Ci).join("|")+")","i")}function xi(t){return new Map(t.map((t,e)=>[t.toLowerCase(),e]))}function Si(t,e,n){var i=wi.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function Ti(t,e,n){var i=wi.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function Mi(t,e,n){var i=wi.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function Pi(t,e,n){var i=wi.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function Ri(t,e,n){var i=wi.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function Li(t,e,n){var i=wi.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function Di(t,e,n){var i=wi.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Ii(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 Ni(t,e,n){var i=wi.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function $i(t,e,n){var i=wi.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function Fi(t,e,n){var i=wi.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function Oi(t,e,n){var i=wi.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function Ui(t,e,n){var i=wi.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function Hi(t,e,n){var i=wi.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function ji(t,e,n){var i=wi.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function Bi(t,e,n){var i=wi.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function qi(t,e,n){var i=wi.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function Ji(t,e,n){var i=ki.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function Vi(t,e,n){var i=wi.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function Wi(t,e,n){var i=wi.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function zi(t,e){return Ai(t.getDate(),e,2)}function Yi(t,e){return Ai(t.getHours(),e,2)}function Xi(t,e){return Ai(t.getHours()%12||12,e,2)}function Ki(t,e){return Ai(1+Ln.count(Jn(t),t),e,3)}function Gi(t,e){return Ai(t.getMilliseconds(),e,3)}function Zi(t,e){return Gi(t,e)+"000"}function Qi(t,e){return Ai(t.getMonth()+1,e,2)}function tr(t,e){return Ai(t.getMinutes(),e,2)}function er(t,e){return Ai(t.getSeconds(),e,2)}function nr(t){var e=t.getDay();return 0===e?7:e}function ir(t,e){return Ai(In.count(Jn(t)-1,t),e,2)}function rr(t){var e=t.getDay();return e>=4||0===e?On(t):On.ceil(t)}function sr(t,e){return t=rr(t),Ai(On.count(Jn(t),t)+(4===Jn(t).getDay()),e,2)}function or(t){return t.getDay()}function ar(t,e){return Ai(Nn.count(Jn(t)-1,t),e,2)}function lr(t,e){return Ai(t.getFullYear()%100,e,2)}function hr(t,e){return Ai((t=rr(t)).getFullYear()%100,e,2)}function cr(t,e){return Ai(t.getFullYear()%1e4,e,4)}function ur(t,e){var n=t.getDay();return Ai((t=n>=4||0===n?On(t):On.ceil(t)).getFullYear()%1e4,e,4)}function dr(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Ai(e/60|0,"0",2)+Ai(e%60,"0",2)}function fr(t,e){return Ai(t.getUTCDate(),e,2)}function pr(t,e){return Ai(t.getUTCHours(),e,2)}function mr(t,e){return Ai(t.getUTCHours()%12||12,e,2)}function gr(t,e){return Ai(1+Kn.count(li(t),t),e,3)}function vr(t,e){return Ai(t.getUTCMilliseconds(),e,3)}function br(t,e){return vr(t,e)+"000"}function yr(t,e){return Ai(t.getUTCMonth()+1,e,2)}function wr(t,e){return Ai(t.getUTCMinutes(),e,2)}function kr(t,e){return Ai(t.getUTCSeconds(),e,2)}function Er(t){var e=t.getUTCDay();return 0===e?7:e}function Ar(t,e){return Ai(Zn.count(li(t)-1,t),e,2)}function Cr(t){var e=t.getUTCDay();return e>=4||0===e?ni(t):ni.ceil(t)}function _r(t,e){return t=Cr(t),Ai(ni.count(li(t),t)+(4===li(t).getUTCDay()),e,2)}function xr(t){return t.getUTCDay()}function Sr(t,e){return Ai(Qn.count(li(t)-1,t),e,2)}function Tr(t,e){return Ai(t.getUTCFullYear()%100,e,2)}function Mr(t,e){return Ai((t=Cr(t)).getUTCFullYear()%100,e,2)}function Pr(t,e){return Ai(t.getUTCFullYear()%1e4,e,4)}function Rr(t,e){var n=t.getUTCDay();return Ai((t=n>=4||0===n?ni(t):ni.ceil(t)).getUTCFullYear()%1e4,e,4)}function Lr(){return"+0000"}function Dr(){return"%"}function Ir(t){return+t}function Nr(t){return Math.floor(+t/1e3)}vi=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=_i(r),c=xi(r),u=_i(s),d=xi(s),f=_i(o),p=xi(o),m=_i(a),g=xi(a),v=_i(l),b=xi(l),y={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:zi,e:zi,f:Zi,g:hr,G:ur,H:Yi,I:Xi,j:Ki,L:Gi,m:Qi,M:tr,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ir,s:Nr,S:er,u:nr,U:ir,V:sr,w:or,W:ar,x:null,X:null,y:lr,Y:cr,Z:dr,"%":Dr},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:fr,e:fr,f:br,g:Mr,G:Rr,H:pr,I:mr,j:gr,L:vr,m:yr,M:wr,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ir,s:Nr,S:kr,u:Er,U:Ar,V:_r,w:xr,W:Sr,x:null,X:null,y:Tr,Y:Pr,Z:Lr,"%":Dr},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=u.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=b.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){var i=m.exec(e.slice(n));return i?(t.m=g.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,n,i){return C(t,e,n,i)},d:Fi,e:Fi,f:qi,g:Di,G:Li,H:Ui,I:Ui,j:Oi,L:Bi,m:$i,M:Hi,p:function(t,e,n){var i=h.exec(e.slice(n));return i?(t.p=c.get(i[0].toLowerCase()),n+i[0].length):-1},q:Ni,Q:Vi,s:Wi,S:ji,u:Ti,U:Mi,V:Pi,w:Si,W:Ri,x:function(t,e,i){return C(t,n,e,i)},X:function(t,e,n){return C(t,i,e,n)},y:Di,Y:Li,Z:Ii,"%":Ji};function E(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=yi[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 A(t,e){return function(n){var i,r,s=gi(1900,void 0,1);if(C(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=mi(gi(s.y,0,1))).getUTCDay(),i=r>4||0===r?Qn.ceil(i):Qn(i),i=Kn.offset(i,7*(s.V-1)),s.y=i.getUTCFullYear(),s.m=i.getUTCMonth(),s.d=i.getUTCDate()+(s.w+6)%7):(r=(i=pi(gi(s.y,0,1))).getDay(),i=r>4||0===r?Nn.ceil(i):Nn(i),i=Ln.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?mi(gi(s.y,0,1)).getUTCDay():pi(gi(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,mi(s)):pi(s)}}function C(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 yi?e.charAt(o++):r])||(i=s(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return y.x=E(n,y),y.X=E(i,y),y.c=E(e,y),w.x=E(n,w),w.X=E(i,w),w.c=E(e,w),{format:function(t){var e=E(t+="",y);return e.toString=function(){return t},e},parse:function(t){var e=A(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=E(t+="",w);return e.toString=function(){return t},e},utcParse:function(t){var e=A(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"]}),bi=vi.format,vi.parse,vi.utcFormat,vi.utcParse;const $r=an(on),Fr=$r.right,Or=($r.left,an(function(t){return null===t?NaN:+t}).center,Fr);function Ur(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Hr(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function jr(){}var Br=.7,qr=1/Br,Jr="\\s*([+-]?\\d+)\\s*",Vr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Wr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",zr=/^#([0-9a-f]{3,8})$/,Yr=new RegExp(`^rgb\\(${Jr},${Jr},${Jr}\\)$`),Xr=new RegExp(`^rgb\\(${Wr},${Wr},${Wr}\\)$`),Kr=new RegExp(`^rgba\\(${Jr},${Jr},${Jr},${Vr}\\)$`),Gr=new RegExp(`^rgba\\(${Wr},${Wr},${Wr},${Vr}\\)$`),Zr=new RegExp(`^hsl\\(${Vr},${Wr},${Wr}\\)$`),Qr=new RegExp(`^hsla\\(${Vr},${Wr},${Wr},${Vr}\\)$`),ts={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 es(){return this.rgb().formatHex()}function ns(){return this.rgb().formatRgb()}function is(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=zr.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?rs(e):3===n?new as(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ss(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ss(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=Yr.exec(t))?new as(e[1],e[2],e[3],1):(e=Xr.exec(t))?new as(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Kr.exec(t))?ss(e[1],e[2],e[3],e[4]):(e=Gr.exec(t))?ss(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Zr.exec(t))?fs(e[1],e[2]/100,e[3]/100,1):(e=Qr.exec(t))?fs(e[1],e[2]/100,e[3]/100,e[4]):ts.hasOwnProperty(t)?rs(ts[t]):"transparent"===t?new as(NaN,NaN,NaN,0):null}function rs(t){return new as(t>>16&255,t>>8&255,255&t,1)}function ss(t,e,n,i){return i<=0&&(t=e=n=NaN),new as(t,e,n,i)}function os(t,e,n,i){return 1===arguments.length?((r=t)instanceof jr||(r=is(r)),r?new as((r=r.rgb()).r,r.g,r.b,r.opacity):new as):new as(t,e,n,null==i?1:i);var r}function as(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function ls(){return`#${ds(this.r)}${ds(this.g)}${ds(this.b)}`}function hs(){const t=cs(this.opacity);return`${1===t?"rgb(":"rgba("}${us(this.r)}, ${us(this.g)}, ${us(this.b)}${1===t?")":`, ${t})`}`}function cs(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function us(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ds(t){return((t=us(t))<16?"0":"")+t.toString(16)}function fs(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ms(t,e,n,i)}function ps(t){if(t instanceof ms)return new ms(t.h,t.s,t.l,t.opacity);if(t instanceof jr||(t=is(t)),!t)return new ms;if(t instanceof ms)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 ms(o,a,l,t.opacity)}function ms(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function gs(t){return(t=(t||0)%360)<0?t+360:t}function vs(t){return Math.max(0,Math.min(1,t||0))}function bs(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 ys(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}Ur(jr,is,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:es,formatHex:es,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ps(this).formatHsl()},formatRgb:ns,toString:ns}),Ur(as,os,Hr(jr,{brighter(t){return t=null==t?qr:Math.pow(qr,t),new as(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Br:Math.pow(Br,t),new as(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new as(us(this.r),us(this.g),us(this.b),cs(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:ls,formatHex:ls,formatHex8:function(){return`#${ds(this.r)}${ds(this.g)}${ds(this.b)}${ds(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:hs,toString:hs})),Ur(ms,function(t,e,n,i){return 1===arguments.length?ps(t):new ms(t,e,n,null==i?1:i)},Hr(jr,{brighter(t){return t=null==t?qr:Math.pow(qr,t),new ms(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Br:Math.pow(Br,t),new ms(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 as(bs(t>=240?t-240:t+120,r,i),bs(t,r,i),bs(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new ms(gs(this.h),vs(this.s),vs(this.l),cs(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=cs(this.opacity);return`${1===t?"hsl(":"hsla("}${gs(this.h)}, ${100*vs(this.s)}%, ${100*vs(this.l)}%${1===t?")":`, ${t})`}`}}));const ws=t=>()=>t;function ks(t,e){return function(n){return t+n*e}}function Es(t){return 1===(t=+t)?As: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):ws(isNaN(e)?n:e)}}function As(t,e){var n=e-t;return n?ks(t,n):ws(isNaN(t)?e:t)}const Cs=function t(e){var n=Es(e);function i(t,e){var i=n((t=os(t)).r,(e=os(e)).r),r=n(t.g,e.g),s=n(t.b,e.b),o=As(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 _s(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=os(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+""}}}_s(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 ys((n-i/e)*e,o,r,s,a)}}),_s(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 ys((n-i/e)*e,r,s,o,a)}});function xs(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]=Is(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 Ss(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function Ts(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Ms(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]=Is(t[n],e[n]):r[n]=e[n];return function(t){for(n in i)r[n]=i[n](t);return r}}var Ps=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Rs=new RegExp(Ps.source,"g");function Ls(t,e){var n,i,r,s=Ps.lastIndex=Rs.lastIndex=0,o=-1,a=[],l=[];for(t+="",e+="";(n=Ps.exec(t))&&(i=Rs.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:Ts(n,i)})),s=Rs.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 Ds(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 Is(t,e){var n,i,r=typeof e;return null==e||"boolean"===r?ws(e):("number"===r?Ts:"string"===r?(n=is(e))?(e=n,Cs):Ls:e instanceof is?Cs:e instanceof Date?Ss:(i=e,!ArrayBuffer.isView(i)||i instanceof DataView?Array.isArray(e)?xs:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Ms:Ts:Ds))(t,e)}function Ns(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function $s(t){return+t}var Fs=[0,1];function Os(t){return t}function Us(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function Hs(t,e,n){var i=t[0],r=t[1],s=e[0],o=e[1];return r<i?(i=Us(r,i),s=n(o,s)):(i=Us(i,r),s=n(s,o)),function(t){return s(i(t))}}function js(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]=Us(t[o],t[o+1]),s[o]=n(e[o],e[o+1]);return function(e){var n=Or(t,e,1,i)-1;return s[n](r[n](e))}}function Bs(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function qs(){var t,e,n,i,r,s,o=Fs,a=Fs,l=Is,h=Os;function c(){var t,e,n,l=Math.min(o.length,a.length);return h!==Os&&(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?js:Hs,r=s=null,u}function u(e){return null==e||isNaN(e=+e)?n:(r||(r=i(o.map(t),a,l)))(t(h(e)))}return u.invert=function(n){return h(e((s||(s=i(a,o.map(t),Ts)))(n)))},u.domain=function(t){return arguments.length?(o=Array.from(t,$s),c()):o.slice()},u.range=function(t){return arguments.length?(a=Array.from(t),c()):a.slice()},u.rangeRound=function(t){return a=Array.from(t),l=Ns,c()},u.clamp=function(t){return arguments.length?(h=!!t||Os,c()):h!==Os},u.interpolate=function(t){return arguments.length?(l=t,c()):l},u.unknown=function(t){return arguments.length?(n=t,u):n},function(n,i){return t=n,e=i,c()}}function Js(){return qs()(Os,Os)}function Vs(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Ws(t){return new Date(t)}function zs(t){return t instanceof Date?+t:+new Date(+t)}function Ys(t,e,n,i,r,s,o,a,l,h){var c=Js(),u=c.invert,d=c.domain,f=h(".%L"),p=h(":%S"),m=h("%I:%M"),g=h("%I %p"),v=h("%a %d"),b=h("%b %d"),y=h("%B"),w=h("%Y");function k(t){return(l(t)<t?f:a(t)<t?p:o(t)<t?m:s(t)<t?g:i(t)<t?r(t)<t?v:b:n(t)<t?y:w)(t)}return c.invert=function(t){return new Date(u(t))},c.domain=function(t){return arguments.length?d(Array.from(t,zs)):d().map(Ws)},c.ticks=function(e){var n=d();return t(n[0],n[n.length-1],null==e?10:e)},c.tickFormat=function(t,e){return null==e?k:h(e)},c.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)):c},c.copy=function(){return Bs(c,Ys(t,e,n,i,r,s,o,a,l,h))},c}function Xs(){return Vs.apply(Ys(di,fi,Jn,Bn,In,Ln,Pn,Tn,xn,bi).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}var Ks,Gs=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Zs(t){if(!(e=Gs.exec(t)))throw new Error("invalid format: "+t);var e;return new Qs({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 Qs(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 to(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 eo(t){return(t=to(Math.abs(t)))?t[1]:NaN}function no(t,e){var n=to(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")}Zs.prototype=Qs.prototype,Qs.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 io={"%":(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)=>no(100*t,e),r:no,s:function(t,e){var n=to(t,e);if(!n)return t+"";var i=n[0],r=n[1],s=r-(Ks=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")+to(t,Math.max(0,e+s-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function ro(t){return t}var so,oo,ao,lo=Array.prototype.map,ho=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function co(t){var e,n,i=void 0===t.grouping||void 0===t.thousands?ro:(e=lo.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?ro:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(lo.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",h=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function u(t){var e=(t=Zs(t)).fill,n=t.align,u=t.sign,d=t.symbol,f=t.zero,p=t.width,m=t.comma,g=t.precision,v=t.trim,b=t.type;"n"===b?(m=!0,b="g"):io[b]||(void 0===g&&(g=12),v=!0,b="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var y="$"===d?r:"#"===d&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",w="$"===d?s:/[%p]/.test(b)?l:"",k=io[b],E=/[defgprs%]/.test(b);function A(t){var r,s,l,d=y,A=w;if("c"===b)A=k(t)+A,t="";else{var C=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:k(Math.abs(t),g),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)),C&&0===+t&&"+"!==u&&(C=!1),d=(C?"("===u?u:h:"-"===u||"("===u?"":u)+d,A=("s"===b?ho[8+Ks/3]:"")+A+(C&&"("===u?")":""),E)for(r=-1,s=t.length;++r<s;)if(48>(l=t.charCodeAt(r))||l>57){A=(46===l?o+t.slice(r+1):t.slice(r))+A,t=t.slice(0,r);break}}m&&!f&&(t=i(t,1/0));var _=d.length+t.length+A.length,x=_<p?new Array(p-_+1).join(e):"";switch(m&&f&&(t=i(x+t,x.length?p-A.length:1/0),x=""),n){case"<":t=d+t+A+x;break;case"=":t=d+x+t+A;break;case"^":t=x.slice(0,_=x.length>>1)+d+t+A+x.slice(_);break;default:t=x+d+t+A}return a(t)}return g=void 0===g?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),A.toString=function(){return t+""},A}return{format:u,formatPrefix:function(t,e){var n=u(((t=Zs(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(eo(e)/3))),r=Math.pow(10,-i),s=ho[8+i/3];return function(t){return n(r*t)+s}}}}function uo(t,e,n,i){var r,s=dn(t,e,n);switch((i=Zs(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(eo(e)/3)))-eo(Math.abs(t)))}(s,o))||(i.precision=r),ao(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,eo(e)-eo(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,-eo(Math.abs(t)))}(s))||(i.precision=r-2*("%"===i.type))}return oo(i)}function fo(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=un(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 uo(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],c=10;for(h<l&&(r=l,l=h,h=r,r=o,o=a,a=r);c-- >0;){if((r=un(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 po(){var t=Js();return t.copy=function(){return Bs(t,po())},Vs.apply(t,arguments),fo(t)}function mo(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){so=co(t),oo=so.format,ao=so.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});const go=Math.PI,vo=2*go,bo=1e-6,yo=vo-bo;function wo(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function ko(){return new wo}wo.prototype=ko.prototype={constructor:wo,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,c=o-e,u=h*h+c*c;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(u>bo)if(Math.abs(c*a-l*h)>bo&&r){var d=n-s,f=i-o,p=a*a+l*l,m=d*d+f*f,g=Math.sqrt(p),v=Math.sqrt(u),b=r*Math.tan((go-Math.acos((p+u-m)/(2*g*v)))/2),y=b/v,w=b/g;Math.abs(y-1)>bo&&(this._+="L"+(t+y*h)+","+(e+y*c)),this._+="A"+r+","+r+",0,0,"+ +(c*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,c=1^s,u=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)>bo||Math.abs(this._y1-h)>bo)&&(this._+="L"+l+","+h),n&&(u<0&&(u=u%vo+vo),u>yo?this._+="A"+n+","+n+",0,1,"+c+","+(t-o)+","+(e-a)+"A"+n+","+n+",0,1,"+c+","+(this._x1=l)+","+(this._y1=h):u>bo&&(this._+="A"+n+","+n+",0,"+ +(u>=go)+","+c+","+(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 Eo=ko;Array.prototype.slice;function Ao(t){return function(){return t}}function Co(t){this._context=t}function _o(t){return new Co(t)}function xo(t){return t[0]}function So(t){return t[1]}function To(t,e){var n=Ao(!0),i=null,r=_o,s=null;function o(o){var a,l,h,c=(o=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(o)).length,u=!1;for(null==i&&(s=r(h=Eo())),a=0;a<=c;++a)!(a<c&&n(l=o[a],a,o))===u&&((u=!u)?s.lineStart():s.lineEnd()),u&&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?xo:Ao(t),e="function"==typeof e?e:void 0===e?So:Ao(e),o.x=function(e){return arguments.length?(t="function"==typeof e?e:Ao(+e),o):t},o.y=function(t){return arguments.length?(e="function"==typeof t?t:Ao(+t),o):e},o.defined=function(t){return arguments.length?(n="function"==typeof t?t:Ao(!!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 Mo(){}function Po(t){return null==t?Mo:function(){return this.querySelector(t)}}function Ro(){return[]}function Lo(t){return null==t?Ro:function(){return this.querySelectorAll(t)}}function Do(t){return function(){return null==(e=t.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}function Io(t){return function(){return this.matches(t)}}function No(t){return function(e){return e.matches(t)}}Co.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 $o=Array.prototype.find;function Fo(){return this.firstElementChild}var Oo=Array.prototype.filter;function Uo(){return Array.from(this.children)}function Ho(t){return new Array(t.length)}function jo(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function Bo(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 jo(t,s[a]);for(;a<l;++a)(o=e[a])&&(r[a]=o)}function qo(t,e,n,i,r,s,o){var a,l,h,c=new Map,u=e.length,d=s.length,f=new Array(u);for(a=0;a<u;++a)(l=e[a])&&(f[a]=h=o.call(l,l.__data__,a,e)+"",c.has(h)?r[a]=l:c.set(h,l));for(a=0;a<d;++a)h=o.call(t,s[a],a,s)+"",(l=c.get(h))?(i[a]=l,l.__data__=s[a],c.delete(h)):n[a]=new jo(t,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(f[a])===l&&(r[a]=l)}function Jo(t){return t.__data__}function Vo(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Wo(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}jo.prototype={constructor:jo,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 zo="http://www.w3.org/1999/xhtml";const Yo={svg:"http://www.w3.org/2000/svg",xhtml:zo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Xo(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Yo.hasOwnProperty(e)?{space:Yo[e],local:t}:t}function Ko(t){return function(){this.removeAttribute(t)}}function Go(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Zo(t,e){return function(){this.setAttribute(t,e)}}function Qo(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ta(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function ea(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 na(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ia(t){return function(){this.style.removeProperty(t)}}function ra(t,e,n){return function(){this.style.setProperty(t,e,n)}}function sa(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function oa(t,e){return t.style.getPropertyValue(e)||na(t).getComputedStyle(t,null).getPropertyValue(e)}function aa(t){return function(){delete this[t]}}function la(t,e){return function(){this[t]=e}}function ha(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ca(t){return t.trim().split(/^|\s+/)}function ua(t){return t.classList||new da(t)}function da(t){this._node=t,this._names=ca(t.getAttribute("class")||"")}function fa(t,e){for(var n=ua(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function pa(t,e){for(var n=ua(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function ma(t){return function(){fa(this,t)}}function ga(t){return function(){pa(this,t)}}function va(t,e){return function(){(e.apply(this,arguments)?fa:pa)(this,t)}}function ba(){this.textContent=""}function ya(t){return function(){this.textContent=t}}function wa(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function ka(){this.innerHTML=""}function Ea(t){return function(){this.innerHTML=t}}function Aa(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Ca(){this.nextSibling&&this.parentNode.appendChild(this)}function _a(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xa(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===zo&&e.documentElement.namespaceURI===zo?e.createElement(t):e.createElementNS(n,t)}}function Sa(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ta(t){var e=Xo(t);return(e.local?Sa:xa)(e)}function Ma(){return null}function Pa(){var t=this.parentNode;t&&t.removeChild(this)}function Ra(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function La(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Da(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 Ia(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 Na(t,e,n){var i=na(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 $a(t,e){return function(){return Na(this,t,e)}}function Fa(t,e){return function(){return Na(this,t,e.apply(this,arguments))}}da.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 Oa=[null];function Ua(t,e){this._groups=t,this._parents=e}function Ha(){return new Ua([[document.documentElement]],Oa)}Ua.prototype=Ha.prototype={constructor:Ua,select:function(t){"function"!=typeof t&&(t=Po(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),c=0;c<l;++c)(s=a[c])&&(o=t.call(s,s.__data__,c,a))&&("__data__"in s&&(o.__data__=s.__data__),h[c]=o);return new Ua(i,this._parents)},selectAll:function(t){t="function"==typeof t?Do(t):Lo(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 Ua(i,r)},selectChild:function(t){return this.select(null==t?Fo:function(t){return function(){return $o.call(this.children,t)}}("function"==typeof t?t:No(t)))},selectChildren:function(t){return this.selectAll(null==t?Uo:function(t){return function(){return Oo.call(this.children,t)}}("function"==typeof t?t:No(t)))},filter:function(t){"function"!=typeof t&&(t=Io(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 Ua(i,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,Jo);var n,i=e?qo:Bo,r=this._parents,s=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var o=s.length,a=new Array(o),l=new Array(o),h=new Array(o),c=0;c<o;++c){var u=r[c],d=s[c],f=d.length,p=Vo(t.call(u,u&&u.__data__,c,r)),m=p.length,g=l[c]=new Array(m),v=a[c]=new Array(m);i(u,d,g,v,h[c]=new Array(f),p,e);for(var b,y,w=0,k=0;w<m;++w)if(b=g[w]){for(w>=k&&(k=w+1);!(y=v[k])&&++k<m;);b._next=y||null}}return(a=new Ua(a,r))._enter=l,a._exit=h,a},enter:function(){return new Ua(this._enter||this._groups.map(Ho),this._parents)},exit:function(){return new Ua(this._exit||this._groups.map(Ho),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,c=n[l],u=i[l],d=c.length,f=a[l]=new Array(d),p=0;p<d;++p)(h=c[p]||u[p])&&(f[p]=h);for(;l<r;++l)a[l]=n[l];return new Ua(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=Wo);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),c=0;c<l;++c)(o=a[c])&&(h[c]=o);h.sort(e)}return new Ua(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=Xo(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?Go:Ko:"function"==typeof e?n.local?ea:ta:n.local?Qo:Zo)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?ia:"function"==typeof e?sa:ra)(t,e,null==n?"":n)):oa(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?aa:"function"==typeof e?ha:la)(t,e)):this.node()[t]},classed:function(t,e){var n=ca(t+"");if(arguments.length<2){for(var i=ua(this.node()),r=-1,s=n.length;++r<s;)if(!i.contains(n[r]))return!1;return!0}return this.each(("function"==typeof e?va:e?ma:ga)(n,e))},text:function(t){return arguments.length?this.each(null==t?ba:("function"==typeof t?wa:ya)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?ka:("function"==typeof t?Aa:Ea)(t)):this.node().innerHTML},raise:function(){return this.each(Ca)},lower:function(){return this.each(_a)},append:function(t){var e="function"==typeof t?t:Ta(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:Ta(t),i=null==e?Ma:"function"==typeof e?e:Po(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})},remove:function(){return this.each(Pa)},clone:function(t){return this.select(t?La:Ra)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var i,r,s=function(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}})}(t+""),o=s.length;if(!(arguments.length<2)){for(a=e?Ia:Da,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,c=a.length;h<c;++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?Fa:$a)(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 ja=Ha;var Ba={value:()=>{}};function qa(){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 Ja(i)}function Ja(t){this._=t}function Va(t,e){for(var n,i=0,r=t.length;i<r;++i)if((n=t[i]).name===e)return n.value}function Wa(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=Ba,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}Ja.prototype=qa.prototype={constructor:Ja,on:function(t,e){var n,i,r=this._,s=(i=r,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!i.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),o=-1,a=s.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=s[o]).type)r[n]=Wa(r[n],t.name,e);else if(null==e)for(n in r)r[n]=Wa(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=s[o]).type)&&(n=Va(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Ja(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 za=qa;var Ya,Xa,Ka=0,Ga=0,Za=0,Qa=0,tl=0,el=0,nl="object"==typeof performance&&performance.now?performance:Date,il="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function rl(){return tl||(il(sl),tl=nl.now()+el)}function sl(){tl=0}function ol(){this._call=this._time=this._next=null}function al(t,e,n){var i=new ol;return i.restart(t,e,n),i}function ll(){tl=(Qa=nl.now())+el,Ka=Ga=0;try{!function(){rl(),++Ka;for(var t,e=Ya;e;)(t=tl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ka}()}finally{Ka=0,function(){var t,e,n=Ya,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:Ya=e);Xa=t,cl(i)}(),tl=0}}function hl(){var t=nl.now(),e=t-Qa;e>1e3&&(el-=e,Qa=t)}function cl(t){Ka||(Ga&&(Ga=clearTimeout(Ga)),t-tl>24?(t<1/0&&(Ga=setTimeout(ll,t-nl.now()-el)),Za&&(Za=clearInterval(Za))):(Za||(Qa=nl.now(),Za=setInterval(hl,1e3)),Ka=1,il(ll)))}function ul(t,e,n){var i=new ol;return e=null==e?0:+e,i.restart(n=>{i.stop(),t(n+e)},e,n),i}ol.prototype=al.prototype={constructor:ol,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?rl():+n)+(null==e?0:+e),this._next||Xa===this||(Xa?Xa._next=this:Ya=this,Xa=this),this._call=t,this._time=n,cl()},stop:function(){this._call&&(this._call=null,this._time=1/0,cl())}};var dl=za("start","end","cancel","interrupt"),fl=[];function pl(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(t){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=t&&o(t-n.delay)}function o(s){var h,c,u,d;if(1!==n.state)return l();for(h in r)if((d=r[h]).name===n.name){if(3===d.state)return ul(o);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(ul(function(){3===n.state&&(n.state=4,n.timer.restart(a,n.delay,n.time),a(s))}),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,i=new Array(u=n.tween.length),h=0,c=-1;h<u;++h)(d=n.tween[h].value.call(t,t.__data__,n.index,n.group))&&(i[++c]=d);i.length=c+1}}function a(e){for(var r=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),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),l())}function l(){for(var i in n.state=6,n.timer.stop(),delete r[e],r)return;delete t.__transition}r[e]=n,n.timer=al(s,0,n.time)}(t,n,{name:e,index:i,group:r,on:dl,tween:fl,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:0})}function ml(t,e){var n=vl(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function gl(t,e){var n=vl(t,e);if(n.state>3)throw new Error("too late; already running");return n}function vl(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var bl,yl=180/Math.PI,wl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function kl(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)*yl,skewX:Math.atan(l)*yl,scaleX:o,scaleY:a}}function El(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:Ts(t,r)},{i:l-2,x:Ts(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:Ts(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:Ts(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:Ts(t,n)},{i:a-2,x:Ts(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 Al=El(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?wl:kl(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),Cl=El(function(t){return null==t?wl:(bl||(bl=document.createElementNS("http://www.w3.org/2000/svg","g")),bl.setAttribute("transform",t),(t=bl.transform.baseVal.consolidate())?kl((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):wl)},", ",")",")");function _l(t,e){var n,i;return function(){var r=gl(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 xl(t,e,n){var i,r;if("function"!=typeof n)throw new Error;return function(){var s=gl(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 Sl(t,e,n){var i=t._id;return t.each(function(){var t=gl(this,i);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return vl(t,i).value[e]}}function Tl(t,e){var n;return("number"==typeof e?Ts:e instanceof is?Cs:(n=is(e))?(e=n,Cs):Ls)(t,e)}function Ml(t){return function(){this.removeAttribute(t)}}function Pl(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Rl(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 Ll(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 Dl(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 Il(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 Nl(t,e){var n,i;function r(){var r=e.apply(this,arguments);return r!==i&&(n=(i=r)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,r)),n}return r._value=e,r}function $l(t,e){var n,i;function r(){var r=e.apply(this,arguments);return r!==i&&(n=(i=r)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,r)),n}return r._value=e,r}function Fl(t,e){return function(){ml(this,t).delay=+e.apply(this,arguments)}}function Ol(t,e){return e=+e,function(){ml(this,t).delay=e}}function Ul(t,e){return function(){gl(this,t).duration=+e.apply(this,arguments)}}function Hl(t,e){return e=+e,function(){gl(this,t).duration=e}}var jl=ja.prototype.constructor;function Bl(t){return function(){this.style.removeProperty(t)}}var ql=0;function Jl(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function Vl(){return++ql}var Wl=ja.prototype;Jl.prototype=function(t){return ja().transition(t)}.prototype={constructor:Jl,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Po(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],c=h.length,u=s[o]=new Array(c),d=0;d<c;++d)(a=h[d])&&(l=t.call(a,a.__data__,d,h))&&("__data__"in a&&(l.__data__=a.__data__),u[d]=l,pl(u[d],e,n,d,u,vl(a,n)));return new Jl(s,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Lo(t));for(var i=this._groups,r=i.length,s=[],o=[],a=0;a<r;++a)for(var l,h=i[a],c=h.length,u=0;u<c;++u)if(l=h[u]){for(var d,f=t.call(l,l.__data__,u,h),p=vl(l,n),m=0,g=f.length;m<g;++m)(d=f[m])&&pl(d,e,n,m,f,p);s.push(f),o.push(l)}return new Jl(s,o,e,n)},selectChild:Wl.selectChild,selectChildren:Wl.selectChildren,filter:function(t){"function"!=typeof t&&(t=Io(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 Jl(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],c=n[a],u=h.length,d=o[a]=new Array(u),f=0;f<u;++f)(l=h[f]||c[f])&&(d[f]=l);for(;a<i;++a)o[a]=e[a];return new Jl(o,this._parents,this._name,this._id)},selection:function(){return new jl(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Vl(),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 c=vl(o,e);pl(o,t,n,h,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Jl(i,this._parents,t,n)},call:Wl.call,nodes:Wl.nodes,node:Wl.node,size:Wl.size,empty:Wl.empty,each:Wl.each,on:function(t,e){var n=this._id;return arguments.length<2?vl(this.node(),n).on.on(t):this.each(function(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)?ml:gl;return function(){var o=s(this,t),a=o.on;a!==i&&(r=(i=a).copy()).on(e,n),o.on=r}}(n,t,e))},attr:function(t,e){var n=Xo(t),i="transform"===n?Cl:Tl;return this.attrTween(t,"function"==typeof e?(n.local?Il:Dl)(n,i,Sl(this,"attr."+t,e)):null==e?(n.local?Pl:Ml)(n):(n.local?Ll:Rl)(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=Xo(t);return this.tween(n,(i.local?Nl:$l)(i,e))},style:function(t,e,n){var i="transform"==(t+="")?Al:Tl;return null==e?this.styleTween(t,function(t,e){var n,i,r;return function(){var s=oa(this,t),o=(this.style.removeProperty(t),oa(this,t));return s===o?null:s===n&&o===i?r:r=e(n=s,i=o)}}(t,i)).on("end.style."+t,Bl(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var i,r,s;return function(){var o=oa(this,t),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(t),l=a=oa(this,t)),o===l?null:o===i&&l===r?s:(r=l,s=e(i=o,a))}}(t,i,Sl(this,"style."+t,e))).each(function(t,e){var n,i,r,s,o="style."+e,a="end."+o;return function(){var l=gl(this,t),h=l.on,c=null==l.value[o]?s||(s=Bl(e)):void 0;h===n&&r===c||(i=(n=h).copy()).on(a,r=c),l.on=i}}(this._id,t)):this.styleTween(t,function(t,e,n){var i,r,s=n+"";return function(){var o=oa(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,function(t,e,n){var i,r;function s(){var s=e.apply(this,arguments);return s!==r&&(i=(r=s)&&function(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}(t,s,n)),i}return s._value=e,s}(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}}(Sl(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,function(t){var e,n;function i(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&function(t){return function(e){this.textContent=t.call(this,e)}}(i)),e}return i._value=t,i}(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=vl(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?_l:xl)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Fl:Ol)(e,t)):vl(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ul:Hl)(e,t)):vl(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){gl(this,t).ease=e}}(e,t)):vl(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;gl(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=gl(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]:Wl[Symbol.iterator]};var zl={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Yl(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 Xl(t){var e=10,n=20,i=30,r=40,s=t.clientWidth,o=function(t){return"string"==typeof t?new Ua([[document.querySelector(t)]],[document.documentElement]):new Ua([[t]],Oa)}(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"),c=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=Xs().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]),u=sn(3,o),d=po().domain([0,mo(t,function(t){return mo([t.processed,t.failed])})]).range([250-i,e]).nice(),f=function(t){return sn(4,t)}(d).tickFormat(oo("~s")),p=To().x(function(t){return o(t.date)}).defined(function(t){return t.defined}).y(function(t){return d(t.failed)}),m=To().x(function(t){return o(t.date)}).defined(function(t){return t.defined}).y(function(t){return d(t.processed)});a.call(u),l.call(f),h.datum(t).attr("d",m),c.datum(t).attr("d",p)}}ja.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)})},ja.prototype.transition=function(t){var e,n;t instanceof Jl?(e=t._id,t=t._name):(e=Vl(),(n=zl).time=rl(),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])&&pl(o,t,e,h,a,n||Yl(o,e));return new Jl(i,this._parents,t,e)};var Kl={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=Xl(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)})}},Gl={mounted:function(){var t=[],e=Xl(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)})}},Zl="refresh_interval",Ql={mounted:function(){var t=this;this.el.addEventListener("change",function(e){var n=Number(e.target.value);localStorage.setItem(Zl,n),t.pushEventTo("#stats","refresh-interval",{interval:n})});var e=Number(localStorage.getItem(Zl))||5;this.el.value=e,t.pushEventTo("#stats","refresh-interval",{interval:e})}};function th(t){return th="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},th(t)}var eh={mounted:function(){var t=this.el.textContent.trim();this.el.innerText=function(t){if("object"!=th(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)}},nh=document.querySelector("meta[name='csrf-token']").getAttribute("content"),ih=new Xe(document.querySelector("html").getAttribute("phx-socket")||"/live",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||S,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=n.sessionStorage||r&&r.sessionStorage,this.establishedConnections=0,this.defaultEncoder=T.encode.bind(T),this.defaultDecoder=T.decode.bind(T),this.closeWasClean=!1,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.transport!==S?(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.logger&&n.debug&&(this.logger=(t,e,n)=>{console.log(`${t}: ${e}`,n)}),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 C(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return S}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=x.appendParams(x.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.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&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.disconnecting||(this.longPollFallbackMs&&this.transport!==S?this.connectWithFallback(S,this.longPollFallbackMs):this.transportConnect())}log(t,e,n){this.logger&&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}transportConnect(){let t;this.connectClock++,this.closeWasClean=!1,this.authToken&&(t=["phoenix",`${E}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),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)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let n,i=!1,r=!0,s=e=>{this.log("transport",`falling back to ${t.name}...`,e),this.off([undefined,n]),r=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${t.name}`))return s("memorized");this.fallbackTimer=setTimeout(s,e),n=this.onError(t=>{this.log("transport","error",t),r&&!i&&(clearTimeout(this.fallbackTimer),s(t))}),this.onOpen(()=>{if(i=!0,!r)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t.name}`,"true"),this.log("transport",`established ${t.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(s,e),this.ping(t=>{this.log("transport","connected to primary after",t),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!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();let i=this.connectClock;this.waitForBufferDone(()=>{i===this.connectClock&&(this.conn&&(e?this.conn.close(e,n||""):this.conn.close()),this.waitForSocketClosed(()=>{i===this.connectClock&&(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(m)})}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!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([e])=>-1===t.indexOf(e))}channel(t,e={}){let n=new _(t,e,this);return this.channels.push(n),n}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:nh},hooks:{Table:Ke,RealtimePlot:Kl,HistoricalPlot:Gl,Refresh:Ql,Timestamp:eh}});P().config({barColors:{0:"#B5179E"},shadowColor:"rgba(0, 0, 0, .3)"}),window.addEventListener("phx:page-loading-start",function(t){return P().show()}),window.addEventListener("phx:page-loading-stop",function(t){return P().hide()}),ih.connect(),window.liveSocket=ih})()})();