Current section

Files

Jump to
exq_ui priv static js app.js
Raw

priv/static/js/app.js

/*! For license information please see app.js.LICENSE.txt */
!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/js/",n(n.s=11)}([,,function(t,e,n){var i;(function(r,o){"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(),o=Math.max(0,16-(i-t)),s=r.setTimeout((function(){e(i+o)}),o);return t=i+o,s}),r.cancelAnimationFrame||(r.cancelAnimationFrame=function(t){clearTimeout(t)})}();var s,a,u,l,c,h={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},f=function(){s.width=r.innerWidth,s.height=5*h.barThickness;var t=s.getContext("2d");t.shadowBlur=h.shadowBlur,t.shadowColor=h.shadowColor;var e=t.createLinearGradient(0,0,s.width,0);for(var n in h.barColors)e.addColorStop(n,h.barColors[n]);t.lineWidth=h.barThickness,t.beginPath(),t.moveTo(0,h.barThickness/2),t.lineTo(Math.ceil(l*s.width),h.barThickness/2),t.strokeStyle=e,t.stroke()},d={config:function(t){for(var e in t)h.hasOwnProperty(e)&&(h[e]=t[e])},show:function(){var t,e,n,i;c||(c=!0,null!==u&&r.cancelAnimationFrame(u),s||((i=(s=o.createElement("canvas")).style).position="fixed",i.top=i.left=i.right=i.margin=i.padding=0,i.zIndex=100001,i.display="none",h.className&&s.classList.add(h.className),o.body.appendChild(s),e="resize",n=f,(t=r).addEventListener?t.addEventListener(e,n,!1):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n),s.style.opacity=1,s.style.display="block",d.progress(0),h.autoRun&&function t(){a=r.requestAnimationFrame(t),d.progress("+"+.05*Math.pow(1-Math.sqrt(l),2))}())},progress:function(t){return void 0===t||("string"==typeof t&&(t=(t.indexOf("+")>=0||t.indexOf("-")>=0?l:0)+parseFloat(t)),l=t>1?1:t,f()),l},hide:function(){c&&(c=!1,null!=a&&(r.cancelAnimationFrame(a),a=null),function t(){if(d.progress("+.1")>=1&&(s.style.opacity-=.05,s.style.opacity<=.05))return s.style.display="none",void(u=null);u=r.requestAnimationFrame(t)}())}};"object"==typeof t.exports?t.exports=d:void 0===(i=function(){return d}.call(e,n,e,t))||(t.exports=i)}).call(this,window,document)},,,function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){(function(e){t.exports=e.Phoenix=n(2)}).call(this,n(1))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";function i(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||s(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],i=!0,r=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done)&&(n.push(s.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{i||null==a.return||a.return()}finally{if(r)throw o}}return n}}(t,e)||s(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function c(t,e,n){return e&&l(t.prototype,e),n&&l(t,n),t}n.r(e),n.d(e,"Channel",(function(){return T})),n.d(e,"Serializer",(function(){return M})),n.d(e,"Socket",(function(){return L})),n.d(e,"LongPoll",(function(){return P})),n.d(e,"Ajax",(function(){return D})),n.d(e,"Presence",(function(){return N}));var h="undefined"!=typeof self?self:null,f="undefined"!=typeof window?window:null,d=h||f||void 0,p="closed",g="errored",m="joined",v="joining",y="leaving",b="phx_close",w="phx_error",k="phx_join",_="phx_reply",x="phx_leave",C=[b,w,k,_,x],A="websocket",E=function(t){return"function"==typeof t?t:function(){return t}},S=function(){function t(e,n,i,r){u(this,t),this.channel=e,this.event=n,this.payload=i||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}return c(t,[{key:"resend",value:function(t){this.timeout=t,this.reset(),this.send()}},{key:"send",value:function(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}},{key:"receive",value:function(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}},{key:"reset",value:function(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}},{key:"matchReceive",value:function(t){var e=t.status,n=t.response;t.ref,this.recHooks.filter((function(t){return t.status===e})).forEach((function(t){return t.callback(n)}))}},{key:"cancelRefEvent",value:function(){this.refEvent&&this.channel.off(this.refEvent)}},{key:"cancelTimeout",value:function(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}},{key:"startTimeout",value:function(){var t=this;this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,(function(e){t.cancelRefEvent(),t.cancelTimeout(),t.receivedResp=e,t.matchReceive(e)})),this.timeoutTimer=setTimeout((function(){t.trigger("timeout",{})}),this.timeout)}},{key:"hasReceived",value:function(t){return this.receivedResp&&this.receivedResp.status===t}},{key:"trigger",value:function(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}}]),t}(),T=function(){function t(e,n,i){var r=this;u(this,t),this.state=p,this.topic=e,this.params=E(n||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new S(this,k,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new R((function(){r.socket.isConnected()&&r.rejoin()}),this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError((function(){return r.rejoinTimer.reset()}))),this.stateChangeRefs.push(this.socket.onOpen((function(){r.rejoinTimer.reset(),r.isErrored()&&r.rejoin()}))),this.joinPush.receive("ok",(function(){r.state=m,r.rejoinTimer.reset(),r.pushBuffer.forEach((function(t){return t.send()})),r.pushBuffer=[]})),this.joinPush.receive("error",(function(){r.state=g,r.socket.isConnected()&&r.rejoinTimer.scheduleTimeout()})),this.onClose((function(){r.rejoinTimer.reset(),r.socket.hasLogger()&&r.socket.log("channel","close ".concat(r.topic," ").concat(r.joinRef())),r.state=p,r.socket.remove(r)})),this.onError((function(t){r.socket.hasLogger()&&r.socket.log("channel","error ".concat(r.topic),t),r.isJoining()&&r.joinPush.reset(),r.state=g,r.socket.isConnected()&&r.rejoinTimer.scheduleTimeout()})),this.joinPush.receive("timeout",(function(){r.socket.hasLogger()&&r.socket.log("channel","timeout ".concat(r.topic," (").concat(r.joinRef(),")"),r.joinPush.timeout),new S(r,x,E({}),r.timeout).send(),r.state=g,r.joinPush.reset(),r.socket.isConnected()&&r.rejoinTimer.scheduleTimeout()})),this.on(_,(function(t,e){r.trigger(r.replyEventName(e),t)}))}return c(t,[{key:"join",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}},{key:"onClose",value:function(t){this.on(b,t)}},{key:"onError",value:function(t){return this.on(w,(function(e){return t(e)}))}},{key:"on",value:function(t,e){var n=this.bindingRef++;return this.bindings.push({event:t,ref:n,callback:e}),n}},{key:"off",value:function(t,e){this.bindings=this.bindings.filter((function(n){return!(n.event===t&&(void 0===e||e===n.ref))}))}},{key:"canPush",value:function(){return this.socket.isConnected()&&this.isJoined()}},{key:"push",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.timeout;if(e=e||{},!this.joinedOnce)throw new Error("tried to push '".concat(t,"' to '").concat(this.topic,"' before joining. Use channel.join() before pushing events"));var i=new S(this,t,(function(){return e}),n);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}},{key:"leave",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=y;var n=function(){t.socket.hasLogger()&&t.socket.log("channel","leave ".concat(t.topic)),t.trigger(b,"leave")},i=new S(this,x,E({}),e);return i.receive("ok",(function(){return n()})).receive("timeout",(function(){return n()})),i.send(),this.canPush()||i.trigger("ok",{}),i}},{key:"onMessage",value:function(t,e,n){return e}},{key:"isLifecycleEvent",value:function(t){return C.indexOf(t)>=0}},{key:"isMember",value:function(t,e,n,i){return!(this.topic!==t||i&&i!==this.joinRef()&&this.isLifecycleEvent(e)&&(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:n,joinRef:i}),1))}},{key:"joinRef",value:function(){return this.joinPush.ref}},{key:"rejoin",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=v,this.joinPush.resend(t))}},{key:"trigger",value:function(t,e,n,i){var r=this.onMessage(t,e,n,i);if(e&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");for(var o=this.bindings.filter((function(e){return e.event===t})),s=0;s<o.length;s++)o[s].callback(r,n,i||this.joinRef())}},{key:"replyEventName",value:function(t){return"chan_reply_".concat(t)}},{key:"isClosed",value:function(){return this.state===p}},{key:"isErrored",value:function(){return this.state===g}},{key:"isJoined",value:function(){return this.state===m}},{key:"isJoining",value:function(){return this.state===v}},{key:"isLeaving",value:function(){return this.state===y}}]),t}(),M={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode:function(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));var n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(n))},decode:function(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));var n=o(JSON.parse(t),5);return e({join_ref:n[0],ref:n[1],topic:n[2],event:n[3],payload:n[4]})},binaryEncode:function(t){var e=t.join_ref,n=t.ref,i=t.event,r=t.topic,o=t.payload,s=this.META_LENGTH+e.length+n.length+r.length+i.length,a=new ArrayBuffer(this.HEADER_LENGTH+s),u=new DataView(a),l=0;u.setUint8(l++,this.KINDS.push),u.setUint8(l++,e.length),u.setUint8(l++,n.length),u.setUint8(l++,r.length),u.setUint8(l++,i.length),Array.from(e,(function(t){return u.setUint8(l++,t.charCodeAt(0))})),Array.from(n,(function(t){return u.setUint8(l++,t.charCodeAt(0))})),Array.from(r,(function(t){return u.setUint8(l++,t.charCodeAt(0))})),Array.from(i,(function(t){return u.setUint8(l++,t.charCodeAt(0))}));var c=new Uint8Array(a.byteLength+o.byteLength);return c.set(new Uint8Array(a),0),c.set(new Uint8Array(o),a.byteLength),c.buffer},binaryDecode:function(t){var 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:function(t,e,n){var i=e.getUint8(1),r=e.getUint8(2),o=e.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(t.slice(s,s+i));s+=i;var u=n.decode(t.slice(s,s+r));s+=r;var l=n.decode(t.slice(s,s+o));return s+=o,{join_ref:a,ref:null,topic:u,event:l,payload:t.slice(s,t.byteLength)}},decodeReply:function(t,e,n){var i=e.getUint8(1),r=e.getUint8(2),o=e.getUint8(3),s=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,u=n.decode(t.slice(a,a+i));a+=i;var l=n.decode(t.slice(a,a+r));a+=r;var c=n.decode(t.slice(a,a+o));a+=o;var h=n.decode(t.slice(a,a+s));a+=s;var f=t.slice(a,t.byteLength);return{join_ref:u,ref:l,topic:c,event:_,payload:{status:h,response:f}}},decodeBroadcast:function(t,e,n){var i=e.getUint8(1),r=e.getUint8(2),o=this.HEADER_LENGTH+2,s=n.decode(t.slice(o,o+i));o+=i;var a=n.decode(t.slice(o,o+r));return o+=r,{join_ref:null,ref:null,topic:s,event:a,payload:t.slice(o,t.byteLength)}}},L=function(){function t(e){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u(this,t),this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=i.timeout||1e4,this.transport=i.transport||d.WebSocket||P,this.defaultEncoder=M.encode.bind(M),this.defaultDecoder=M.decode.bind(M),this.closeWasClean=!1,this.unloaded=!1,this.binaryType=i.binaryType||"arraybuffer",this.transport!==P?(this.encode=i.encode||this.defaultEncoder,this.decode=i.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder),f&&f.addEventListener&&f.addEventListener("beforeunload",(function(t){n.conn&&(n.unloaded=!0,n.abnormalClose("unloaded"))})),this.heartbeatIntervalMs=i.heartbeatIntervalMs||3e4,this.rejoinAfterMs=function(t){return i.rejoinAfterMs?i.rejoinAfterMs(t):[1e3,2e3,5e3][t-1]||1e4},this.reconnectAfterMs=function(t){return n.unloaded?100:i.reconnectAfterMs?i.reconnectAfterMs(t):[10,50,100,150,200,250,500,1e3,2e3][t-1]||5e3},this.logger=i.logger||null,this.longpollerTimeout=i.longpollerTimeout||2e4,this.params=E(i.params||{}),this.endPoint="".concat(e,"/").concat(A),this.vsn=i.vsn||"2.0.0",this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new R((function(){n.teardown((function(){return n.connect()}))}),this.reconnectAfterMs)}return c(t,[{key:"protocol",value:function(){return location.protocol.match(/^https/)?"wss":"ws"}},{key:"endPointURL",value:function(){var t=D.appendParams(D.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==t.charAt(0)?t:"/"===t.charAt(1)?"".concat(this.protocol(),":").concat(t):"".concat(this.protocol(),"://").concat(location.host).concat(t)}},{key:"disconnect",value:function(t,e,n){this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(t,e,n)}},{key:"connect",value:function(t){var e=this;t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=E(t)),this.conn||(this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=function(){return e.onConnOpen()},this.conn.onerror=function(t){return e.onConnError(t)},this.conn.onmessage=function(t){return e.onConnMessage(t)},this.conn.onclose=function(t){return e.onConnClose(t)})}},{key:"log",value:function(t,e,n){this.logger(t,e,n)}},{key:"hasLogger",value:function(){return null!==this.logger}},{key:"onOpen",value:function(t){var e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}},{key:"onClose",value:function(t){var e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}},{key:"onError",value:function(t){var e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}},{key:"onMessage",value:function(t){var e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}},{key:"onConnOpen",value:function(){this.hasLogger()&&this.log("transport","connected to ".concat(this.endPointURL())),this.unloaded=!1,this.closeWasClean=!1,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach((function(t){return(0,o(t,2)[1])()}))}},{key:"heartbeatTimeout",value:function(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.abnormalClose("heartbeat timeout"))}},{key:"resetHeartbeat",value:function(){var t=this;this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearTimeout(this.heartbeatTimer),setTimeout((function(){return t.sendHeartbeat()}),this.heartbeatIntervalMs))}},{key:"teardown",value:function(t,e,n){var i=this;if(!this.conn)return t&&t();this.waitForBufferDone((function(){i.conn&&(e?i.conn.close(e,n||""):i.conn.close()),i.waitForSocketClosed((function(){i.conn&&(i.conn.onclose=function(){},i.conn=null),t&&t()}))}))}},{key:"waitForBufferDone",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;5!==n&&this.conn&&this.conn.bufferedAmount?setTimeout((function(){e.waitForBufferDone(t,n+1)}),150*n):t()}},{key:"waitForSocketClosed",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;5!==n&&this.conn&&3!==this.conn.readyState?setTimeout((function(){e.waitForSocketClosed(t,n+1)}),150*n):t()}},{key:"onConnClose",value:function(t){this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(),clearTimeout(this.heartbeatTimer),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((function(e){return(0,o(e,2)[1])(t)}))}},{key:"onConnError",value:function(t){this.hasLogger()&&this.log("transport",t),this.triggerChanError(),this.stateChangeCallbacks.error.forEach((function(e){return(0,o(e,2)[1])(t)}))}},{key:"triggerChanError",value:function(){this.channels.forEach((function(t){t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(w)}))}},{key:"connectionState",value:function(){switch(this.conn&&this.conn.readyState){case 0:return"connecting";case 1:return"open";case 2:return"closing";default:return"closed"}}},{key:"isConnected",value:function(){return"open"===this.connectionState()}},{key:"remove",value:function(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter((function(e){return e.joinRef()!==t.joinRef()}))}},{key:"off",value:function(t){for(var e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter((function(e){var n=o(e,1)[0];return-1===t.indexOf(n)}))}},{key:"channel",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new T(t,e,this);return this.channels.push(n),n}},{key:"push",value:function(t){var e=this;if(this.hasLogger()){var n=t.topic,i=t.event,r=t.payload,o=t.ref,s=t.join_ref;this.log("push","".concat(n," ").concat(i," (").concat(s,", ").concat(o,")"),r)}this.isConnected()?this.encode(t,(function(t){return e.conn.send(t)})):this.sendBuffer.push((function(){return e.encode(t,(function(t){return e.conn.send(t)}))}))}},{key:"makeRef",value:function(){var t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}},{key:"sendHeartbeat",value:function(){var t=this;this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimer=setTimeout((function(){return t.heartbeatTimeout()}),this.heartbeatIntervalMs))}},{key:"abnormalClose",value:function(t){this.closeWasClean=!1,this.isConnected()&&this.conn.close(1e3,t)}},{key:"flushSendBuffer",value:function(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((function(t){return t()})),this.sendBuffer=[])}},{key:"onConnMessage",value:function(t){var e=this;this.decode(t.data,(function(t){var n=t.topic,i=t.event,r=t.payload,s=t.ref,a=t.join_ref;s&&s===e.pendingHeartbeatRef&&(clearTimeout(e.heartbeatTimer),e.pendingHeartbeatRef=null,setTimeout((function(){return e.sendHeartbeat()}),e.heartbeatIntervalMs)),e.hasLogger()&&e.log("receive","".concat(r.status||""," ").concat(n," ").concat(i," ").concat(s&&"("+s+")"||""),r);for(var u=0;u<e.channels.length;u++){var l=e.channels[u];l.isMember(n,i,r,a)&&l.trigger(i,r,s,a)}for(var c=0;c<e.stateChangeCallbacks.message.length;c++)(0,o(e.stateChangeCallbacks.message[c],2)[1])(t)}))}},{key:"leaveOpenTopic",value:function(t){var e=this.channels.find((function(e){return e.topic===t&&(e.isJoined()||e.isJoining())}));e&&(this.hasLogger()&&this.log("transport",'leaving duplicate topic "'.concat(t,'"')),e.leave())}}]),t}(),P=function(){function t(e){u(this,t),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,this.poll()}return c(t,[{key:"normalizeEndpoint",value:function(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+A),"$1/longpoll")}},{key:"endpointURL",value:function(){return D.appendParams(this.pollEndpoint,{token:this.token})}},{key:"closeAndRetry",value:function(){this.close(),this.readyState=0}},{key:"ontimeout",value:function(){this.onerror("timeout"),this.closeAndRetry()}},{key:"poll",value:function(){var t=this;1!==this.readyState&&0!==this.readyState||D.request("GET",this.endpointURL(),"application/json",null,this.timeout,this.ontimeout.bind(this),(function(e){if(e){var n=e.status,i=e.token,r=e.messages;t.token=i}else n=0;switch(n){case 200:r.forEach((function(e){setTimeout((function(){t.onmessage({data:e})}),0)})),t.poll();break;case 204:t.poll();break;case 410:t.readyState=1,t.onopen(),t.poll();break;case 403:t.onerror(),t.close();break;case 0:case 500:t.onerror(),t.closeAndRetry();break;default:throw new Error("unhandled poll status ".concat(n))}}))}},{key:"send",value:function(t){var e=this;D.request("POST",this.endpointURL(),"application/json",t,this.timeout,this.onerror.bind(this,"timeout"),(function(t){t&&200===t.status||(e.onerror(t&&t.status),e.closeAndRetry())}))}},{key:"close",value:function(t,e){this.readyState=3,this.onclose()}}]),t}(),D=function(){function t(){u(this,t)}return c(t,null,[{key:"request",value:function(t,e,n,i,r,o,s){if(d.XDomainRequest){var a=new XDomainRequest;this.xdomainRequest(a,t,e,i,r,o,s)}else{var u=new d.XMLHttpRequest;this.xhrRequest(u,t,e,n,i,r,o,s)}}},{key:"xdomainRequest",value:function(t,e,n,i,r,o,s){var a=this;t.timeout=r,t.open(e,n),t.onload=function(){var e=a.parseJSON(t.responseText);s&&s(e)},o&&(t.ontimeout=o),t.onprogress=function(){},t.send(i)}},{key:"xhrRequest",value:function(t,e,n,i,r,o,s,a){var u=this;t.open(e,n,!0),t.timeout=o,t.setRequestHeader("Content-Type",i),t.onerror=function(){a&&a(null)},t.onreadystatechange=function(){if(t.readyState===u.states.complete&&a){var e=u.parseJSON(t.responseText);a(e)}},s&&(t.ontimeout=s),t.send(r)}},{key:"parseJSON",value:function(t){if(!t||""===t)return null;try{return JSON.parse(t)}catch(e){return console&&console.log("failed to parse JSON response",t),null}}},{key:"serialize",value:function(t,e){var n=[];for(var i in t)if(t.hasOwnProperty(i)){var o=e?"".concat(e,"[").concat(i,"]"):i,s=t[i];"object"===r(s)?n.push(this.serialize(s,o)):n.push(encodeURIComponent(o)+"="+encodeURIComponent(s))}return n.join("&")}},{key:"appendParams",value:function(t,e){if(0===Object.keys(e).length)return t;var n=t.match(/\?/)?"&":"?";return"".concat(t).concat(n).concat(this.serialize(e))}}]),t}();D.states={complete:4};var N=function(){function t(e){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u(this,t);var r=i.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,(function(e){var i=n.caller,r=i.onJoin,o=i.onLeave,s=i.onSync;n.joinRef=n.channel.joinRef(),n.state=t.syncState(n.state,e,r,o),n.pendingDiffs.forEach((function(e){n.state=t.syncDiff(n.state,e,r,o)})),n.pendingDiffs=[],s()})),this.channel.on(r.diff,(function(e){var i=n.caller,r=i.onJoin,o=i.onLeave,s=i.onSync;n.inPendingSyncState()?n.pendingDiffs.push(e):(n.state=t.syncDiff(n.state,e,r,o),s())}))}return c(t,[{key:"onJoin",value:function(t){this.caller.onJoin=t}},{key:"onLeave",value:function(t){this.caller.onLeave=t}},{key:"onSync",value:function(t){this.caller.onSync=t}},{key:"list",value:function(e){return t.list(this.state,e)}},{key:"inPendingSyncState",value:function(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}}],[{key:"syncState",value:function(t,e,n,i){var r=this,o=this.clone(t),s={},a={};return this.map(o,(function(t,n){e[t]||(a[t]=n)})),this.map(e,(function(t,e){var n=o[t];if(n){var i=e.metas.map((function(t){return t.phx_ref})),u=n.metas.map((function(t){return t.phx_ref})),l=e.metas.filter((function(t){return u.indexOf(t.phx_ref)<0})),c=n.metas.filter((function(t){return i.indexOf(t.phx_ref)<0}));l.length>0&&(s[t]=e,s[t].metas=l),c.length>0&&(a[t]=r.clone(n),a[t].metas=c)}else s[t]=e})),this.syncDiff(o,{joins:s,leaves:a},n,i)}},{key:"syncDiff",value:function(t,e,n,r){var o=e.joins,s=e.leaves,a=this.clone(t);return n||(n=function(){}),r||(r=function(){}),this.map(o,(function(t,e){var r=a[t];if(a[t]=e,r){var o,s=a[t].metas.map((function(t){return t.phx_ref})),u=r.metas.filter((function(t){return s.indexOf(t.phx_ref)<0}));(o=a[t].metas).unshift.apply(o,i(u))}n(t,r,e)})),this.map(s,(function(t,e){var n=a[t];if(n){var i=e.metas.map((function(t){return t.phx_ref}));n.metas=n.metas.filter((function(t){return i.indexOf(t.phx_ref)<0})),r(t,n,e),0===n.metas.length&&delete a[t]}})),a}},{key:"list",value:function(t,e){return e||(e=function(t,e){return e}),this.map(t,(function(t,n){return e(t,n)}))}},{key:"map",value:function(t,e){return Object.getOwnPropertyNames(t).map((function(n){return e(n,t[n])}))}},{key:"clone",value:function(t){return JSON.parse(JSON.stringify(t))}}]),t}(),R=function(){function t(e,n){u(this,t),this.callback=e,this.timerCalc=n,this.timer=null,this.tries=0}return c(t,[{key:"reset",value:function(){this.tries=0,clearTimeout(this.timer)}},{key:"scheduleTimeout",value:function(){var t=this;clearTimeout(this.timer),this.timer=setTimeout((function(){t.tries=t.tries+1,t.callback()}),this.timerCalc(this.tries+1))}}]),t}()}])},,,,,,function(t,e,n){t.exports=n(14)},function(t,e,n){},function(t,e,n){"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")),o=e("_csrf_token",t.getAttribute("data-csrf")),s=document.createElement("form"),a=t.getAttribute("target");s.method="get"===t.getAttribute("data-method")?"get":"post",s.action=i,s.style.display="hidden",a?s.target=a:n&&(s.target="_blank"),s.appendChild(o),s.appendChild(r),document.body.appendChild(s),s.submit()}window.addEventListener("click",(function(e){for(var i=e.target;i&&i.getAttribute;){var r=new t("phoenix.link.click",{bubbles:!0,cancelable:!0});if(!i.dispatchEvent(r))return e.preventDefault(),e.stopImmediatePropagation(),!1;if(i.getAttribute("data-method"))return n(i,e.metaKey||e.shiftKey),e.preventDefault(),!1;i=i.parentNode}}),!1),window.addEventListener("phoenix.link.click",(function(t){var e=t.target.getAttribute("data-confirm");e&&!window.confirm(e)&&t.preventDefault()}),!1)}()},function(t,e,n){"use strict";n.r(e);n(12),n(13);var i=n(5),r=n(2),o=n.n(r),s=[1e3,3e3],a=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading"],u="data-phx-component",l="data-phx-ref",c="data-phx-upload-ref",h=["text","textarea","number","email","password","search","tel","url","date","time"],f=["checkbox","radio"],d="data-phx-session",p=`[${d}]`,g="data-phx-static",m={debounce:300,throttle:300},v="d",y="s",b="e",w="r",k="t",_=(t,e)=>console.error&&console.error(t,e);var x,C=t=>"function"==typeof t?t:function(){return t},A=t=>JSON.parse(JSON.stringify(t)),E=(t,e,n)=>{do{if(t.matches(`[${e}]`))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType&&!(n&&n.isSameNode(t)||t.matches(p)));return null},S=t=>null!==t&&"object"==typeof t&&!(t instanceof Array),T=t=>{for(let e in t)return!1;return!0},M=(t,e)=>t&&e(t),L=function(t,e,n,i){t.forEach(t=>{new class{constructor(t,e,n){this.liveSocket=n,this.entry=t,this.offset=0,this.chunkSize=e,this.chunkTimer=null,this.uploadChannel=n.channel("lvu:"+t.ref,{token:t.metadata()})}error(t){clearTimeout(this.chunkTimer),this.uploadChannel.leave(),this.entry.error(t)}upload(){this.uploadChannel.onError(t=>this.error(t)),this.uploadChannel.join().receive("ok",t=>this.readNextChunk()).receive("error",t=>this.error(t))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let t=new window.FileReader,e=this.entry.file.slice(this.offset,this.chunkSize+this.offset);t.onload=t=>{if(null!==t.target.error)return _("Read error: "+t.target.error);this.offset+=t.target.result.byteLength,this.pushChunk(t.target.result)},t.readAsArrayBuffer(e)}pushChunk(t){this.uploadChannel.isJoined()&&this.uploadChannel.push("chunk",t).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))})}}(t,n.config.chunk_size,i).upload()})},P={canPushState:()=>void 0!==history.pushState,dropLocal(t,e,n){return t.removeItem(this.localKey(e,n))},updateLocal(t,e,n,i,r){let o=this.getLocal(t,e,n),s=this.localKey(e,n),a=null===o?i:r(o);return t.setItem(s,JSON.stringify(a)),a},getLocal(t,e,n){return JSON.parse(t.getItem(this.localKey(e,n)))},updateCurrentState(t){this.canPushState()&&history.replaceState(t(history.state||{}),"",window.location.href)},pushState(t,e,n){if(this.canPushState()){if(n!==window.location.href){if("redirect"==e.type&&e.scroll){let t=history.state||{};t.scroll=e.scroll,history.replaceState(t,"",window.location.href)}delete e.scroll,history[t+"State"](e,"",n||null);let i=this.getHashTargetEl(window.location.hash);i?i.scrollIntoView():"redirect"===e.type&&window.scroll(0,0)}}else this.redirect(n)},setCookie(t,e){document.cookie=`${t}=${e}`},getCookie:t=>document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${t}s*=s*([^;]*).*$)|^.*$`),"$1"),redirect(t,e){e&&P.setCookie("__phoenix_flash__",e+"; max-age=60000; path=/"),window.location=t},localKey:(t,e)=>`${t}-${e}`,getHashTargetEl(t){let e=t.toString().substring(1);if(""!==e)return document.getElementById(e)||document.querySelector(`a[name="${e}"]`)}},D=P,N={byId:t=>document.getElementById(t)||_("no id found for "+t),removeClass(t,e){t.classList.remove(e),0===t.classList.length&&t.removeAttribute("class")},all(t,e,n){if(!t)return[];let i=Array.from(t.querySelectorAll(e));return n?i.forEach(n):i},childNodeLength(t){let e=document.createElement("template");return e.innerHTML=t,e.content.childElementCount},isUploadInput:t=>"file"===t.type&&null!==t.getAttribute(c),findUploadInputs(t){return this.all(t,`input[type="file"][${c}]`)},findComponentNodeList(t,e){return this.filterWithinSameLiveView(this.all(t,`[${u}="${e}"]`),t)},isPhxDestroyed:t=>!(!t.id||!N.private(t,"destroyed")),markPhxChildDestroyed(t){t.setAttribute(d,""),this.putPrivate(t,"destroyed",!0)},findPhxChildrenInFragment(t,e){let n=document.createElement("template");return n.innerHTML=t,this.findPhxChildren(n.content,e)},isIgnored:(t,e)=>"ignore"===(t.getAttribute(e)||t.getAttribute("data-phx-update")),isPhxUpdate:(t,e,n)=>t.getAttribute&&n.indexOf(t.getAttribute(e))>=0,findPhxChildren(t,e){return this.all(t,`${p}[data-phx-parent-id="${e}"]`)},findParentCIDs(t,e){let n=new Set(e);return e.reduce((e,n)=>{let i=`[${u}="${n}"] [${u}]`;return this.filterWithinSameLiveView(this.all(t,i),t).map(t=>parseInt(t.getAttribute(u))).forEach(t=>e.delete(t)),e},n)},filterWithinSameLiveView(t,e){return e.querySelector(p)?t.filter(t=>this.withinSameLiveView(t,e)):t},withinSameLiveView(t,e){for(;t=t.parentNode;){if(t.isSameNode(e))return!0;if(null!==t.getAttribute(d))return!1}},private:(t,e)=>t.phxPrivate&&t.phxPrivate[e],deletePrivate(t,e){t.phxPrivate&&delete t.phxPrivate[e]},putPrivate(t,e,n){t.phxPrivate||(t.phxPrivate={}),t.phxPrivate[e]=n},copyPrivates(t,e){e.phxPrivate&&(t.phxPrivate=A(e.phxPrivate))},putTitle(t){let e=document.querySelector("title"),{prefix:n,suffix:i}=e.dataset;document.title=`${n||""}${t}${i||""}`},debounce(t,e,n,i,r,o,s){let a=t.getAttribute(n),u=t.getAttribute(r);""===a&&(a=i),""===u&&(u=o);let l=a||u;switch(l){case null:return s();case"blur":return void(this.once(t,"debounce-blur")&&t.addEventListener("blur",()=>s()));default:let n=parseInt(l),i=()=>u?this.deletePrivate(t,"throttled"):s(),r=this.incCycle(t,"debounce-trigger",i);if(isNaN(n))return _("invalid throttle/debounce value: "+l);if(u){let i=!1;if("keydown"===e.type){let n=this.private(t,"debounce-prev-key");this.putPrivate(t,"debounce-prev-key",e.key),i=n!==e.key}if(!i&&this.private(t,"throttled"))return!1;s(),this.putPrivate(t,"throttled",!0),setTimeout(()=>this.triggerCycle(t,"debounce-trigger"),n)}else setTimeout(()=>this.triggerCycle(t,"debounce-trigger",r),n);let o=t.form;o&&this.once(o,"bind-debounce")&&o.addEventListener("submit",()=>{Array.from(new FormData(o).entries(),([t])=>{let e=o.querySelector(`[name="${t}"]`);this.incCycle(e,"debounce-trigger"),this.deletePrivate(e,"throttled")})}),this.once(t,"bind-debounce")&&t.addEventListener("blur",()=>this.triggerCycle(t,"debounce-trigger"))}},triggerCycle(t,e,n){let[i,r]=this.private(t,e);n||(n=i),n===i&&(this.incCycle(t,e),r())},once(t,e){return!0!==this.private(t,e)&&(this.putPrivate(t,e,!0),!0)},incCycle(t,e,n=function(){}){let[i]=this.private(t,e)||[0,n];return i++,this.putPrivate(t,e,[i,n]),i},discardError(t,e,n){let i=e.getAttribute&&e.getAttribute(n),r=i&&t.querySelector(`[id="${i}"], [name="${i}"]`);r&&(this.private(r,"phx-has-focused")||this.private(r.form,"phx-has-submitted")||e.classList.add("phx-no-feedback"))},showError(t,e){(t.id||t.name)&&this.all(t.form,`[${e}="${t.id}"], [${e}="${t.name}"]`,t=>{this.removeClass(t,"phx-no-feedback")})},isPhxChild:t=>t.getAttribute&&t.getAttribute("data-phx-parent-id"),dispatchEvent(t,e,n={}){let i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t.dispatchEvent(i)},cloneNode(t,e){if(void 0===e)return t.cloneNode(!0);{let n=t.cloneNode(!1);return n.innerHTML=e,n}},mergeAttrs(t,e,n={}){let i=n.exclude||[],r=n.isIgnored,o=e.attributes;for(let n=o.length-1;n>=0;n--){let r=o[n].name;i.indexOf(r)<0&&t.setAttribute(r,e.getAttribute(r))}let s=t.attributes;for(let n=s.length-1;n>=0;n--){let i=s[n].name;r?i.startsWith("data-")&&!e.hasAttribute(i)&&t.removeAttribute(i):e.hasAttribute(i)||t.removeAttribute(i)}},mergeFocusedInput(t,e){t instanceof HTMLSelectElement||N.mergeAttrs(t,e,{except:["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(!N.isTextualInput(t))return;let i=t.matches(":focus");t.readOnly&&t.blur(),i||t.focus(),this.hasSelectionRange(t)&&t.setSelectionRange(e,n)},isFormInput:t=>/^(?:input|select|textarea)$/i.test(t.tagName)&&"button"!==t.type,syncAttrsToProps(t){t instanceof HTMLInputElement&&f.indexOf(t.type.toLocaleLowerCase())>=0&&(t.checked=null!==t.getAttribute("checked"))},syncPropsToAttrs(t){if(t instanceof HTMLSelectElement){let e=t.options.item(t.selectedIndex);e&&null===e.getAttribute("selected")&&e.setAttribute("selected","")}},isTextualInput:t=>h.indexOf(t.type)>=0,isNowTriggerFormExternal:(t,e)=>t.getAttribute&&null!==t.getAttribute(e),syncPendingRef(t,e,n){let i=t.getAttribute(l);return null===i||(N.isFormInput(t)||null!==t.getAttribute(n)?(N.isUploadInput(t)&&N.mergeAttrs(t,e,{isIgnored:!0}),N.putPrivate(t,l,e),!1):(a.forEach(n=>{t.classList.contains(n)&&e.classList.add(n)}),e.setAttribute(l,i),!0))},cleanChildNodes(t,e){if(N.isPhxUpdate(t,e,["append","prepend"])){let e=[];t.childNodes.forEach(t=>{if(!t.id){t.nodeType===Node.TEXT_NODE&&""===t.nodeValue.trim()||_(`only HTML element tags with an id are allowed inside containers with phx-update.\n\nremoving illegal node: "${(t.outerHTML||t.nodeValue).trim()}"\n\n`),e.push(t)}}),e.forEach(t=>t.remove())}},replaceRootContainer(t,e,n){let i=new Set(["id",d,g,"data-phx-main"]);if(t.tagName.toLowerCase()===e.toLowerCase())return Array.from(t.attributes).filter(t=>!i.has(t.name.toLowerCase())).forEach(e=>t.removeAttribute(e.name)),Object.keys(n).filter(t=>!i.has(t.toLowerCase())).forEach(e=>t.setAttribute(e,n[e])),t;{let r=document.createElement(e);return Object.keys(n).forEach(t=>r.setAttribute(t,n[t])),i.forEach(e=>r.setAttribute(e,t.getAttribute(e))),r.innerHTML=t.innerHTML,t.replaceWith(r),r}}},R=N,I=class{static isActive(t,e){let n=void 0===e._phxRef,i=t.getAttribute("data-phx-active-refs").split(",").indexOf(j.genFileRef(e))>=0;return e.size>0&&(n||i)}static isPreflighted(t,e){return t.getAttribute("data-phx-preflighted-refs").split(",").indexOf(j.genFileRef(e))>=0&&this.isActive(t,e)}constructor(t,e,n){this.ref=j.genFileRef(e),this.fileEl=t,this.file=e,this.view=n,this.meta=null,this._isCancelled=!1,this._isDone=!1,this._progress=0,this._lastProgressSent=-1,this._onDone=function(){},this._onElUpdated=this.onElUpdated.bind(this),this.fileEl.addEventListener("phx:live-file:updated",this._onElUpdated)}metadata(){return this.meta}progress(t){this._progress=Math.floor(t),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{j.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}cancel(){this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(t="failed"){this.view.pushFileProgress(this.fileEl,this.ref,{error:t}),j.clearFiles(this.fileEl)}onDone(t){this._onDone=()=>{this.fileEl.removeEventListener("phx:live-file:updated",this._onElUpdated),t()}}onElUpdated(){-1===this.fileEl.getAttribute("data-phx-active-refs").split(",").indexOf(this.ref)&&this.cancel()}toPreflightPayload(){return{last_modified:this.file.lastModified,name:this.file.name,size:this.file.size,type:this.file.type,ref:this.ref}}uploader(t){if(this.meta.uploader){let e=t[this.meta.uploader]||_("no uploader configured for "+this.meta.uploader);return{name:this.meta.uploader,callback:e}}return{name:"channel",callback:L}}zipPostFlight(t){this.meta=t.entries[this.ref],this.meta||_("no preflight upload response returned with ref "+this.ref,{input:this.fileEl,response:t})}},U=0,j=class{static genFileRef(t){let e=t._phxRef;return void 0!==e?e:(t._phxRef=(U++).toString(),t._phxRef)}static getEntryDataURL(t,e,n){let i=this.activeFiles(t).find(t=>this.genFileRef(t)===e);n(URL.createObjectURL(i))}static hasUploadsInProgress(t){let e=0;return R.findUploadInputs(t).forEach(t=>{t.getAttribute("data-phx-preflighted-refs")!==t.getAttribute("data-phx-done-refs")&&e++}),e>0}static serializeUploads(t){let e=this.activeFiles(t),n={};return e.forEach(e=>{let i={path:t.name},r=t.getAttribute(c);n[r]=n[r]||[],i.ref=this.genFileRef(e),i.name=e.name||i.ref,i.type=e.type,i.size=e.size,n[r].push(i)}),n}static clearFiles(t){t.value=null,t.removeAttribute(c),R.putPrivate(t,"files",[])}static untrackFile(t,e){R.putPrivate(t,"files",R.private(t,"files").filter(t=>!Object.is(t,e)))}static trackFiles(t,e){if(null!==t.getAttribute("multiple")){let n=e.filter(e=>!this.activeFiles(t).find(t=>Object.is(t,e)));R.putPrivate(t,"files",this.activeFiles(t).concat(n)),t.value=null}else R.putPrivate(t,"files",e)}static activeFileInputs(t){let e=R.findUploadInputs(t);return Array.from(e).filter(t=>t.files&&this.activeFiles(t).length>0)}static activeFiles(t){return(R.private(t,"files")||[]).filter(e=>I.isActive(t,e))}static inputsAwaitingPreflight(t){let e=R.findUploadInputs(t);return Array.from(e).filter(t=>this.filesAwaitingPreflight(t).length>0)}static filesAwaitingPreflight(t){return this.activeFiles(t).filter(e=>!I.isPreflighted(t,e))}constructor(t,e,n){this.view=e,this.onComplete=n,this._entries=Array.from(j.filesAwaitingPreflight(t)||[]).map(n=>new I(t,n,e)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(t,e,n){this._entries=this._entries.map(e=>(e.zipPostFlight(t),e.onDone(()=>{this.numEntriesInProgress--,0===this.numEntriesInProgress&&this.onComplete()}),e));let i=this._entries.reduce((t,e)=>{let{name:i,callback:r}=e.uploader(n.uploaders);return t[i]=t[i]||{callback:r,entries:[]},t[i].entries.push(e),t},{});for(let r in i){let{callback:o,entries:s}=i[r];o(s,e,t,n)}}},H={LiveFileUpload:{activeRefs(){return this.el.getAttribute("data-phx-active-refs")},preflightedRefs(){return this.el.getAttribute("data-phx-preflighted-refs")},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let t=this.preflightedRefs();this.preflightedWas!==t&&(this.preflightedWas=t,""===t&&this.__view.cancelSubmit(this.el.form)),""===this.activeRefs()&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent("phx:live-file:updated"))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(c)),j.getEntryDataURL(this.inputEl,this.ref,t=>{this.url=t,this.el.src=t})},destroyed(){URL.revokeObjectURL(this.url)}}};var F="undefined"==typeof document?void 0:document,O=!!F&&"content"in F.createElement("template"),B=!!F&&F.createRange&&"createContextualFragment"in F.createRange();function $(t){return t=t.trim(),O?function(t){var e=F.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}(t):B?function(t){return x||(x=F.createRange()).selectNode(F.body),x.createContextualFragment(t).childNodes[0]}(t):function(t){var e=F.createElement("body");return e.innerHTML=t,e.childNodes[0]}(t)}function q(t,e){var n,i,r=t.nodeName,o=e.nodeName;return r===o||(n=r.charCodeAt(0),i=o.charCodeAt(0),n<=90&&i>=97?r===o.toUpperCase():i<=90&&n>=97&&o===r.toUpperCase())}function J(t,e,n){t[n]!==e[n]&&(t[n]=e[n],t[n]?t.setAttribute(n,""):t.removeAttribute(n))}var V={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)}J(t,e,"selected")},INPUT:function(t,e){J(t,e,"checked"),J(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,o=0,s=t.firstChild;s;)if("OPTGROUP"===(i=s.nodeName&&s.nodeName.toUpperCase()))s=(n=s).firstChild;else{if("OPTION"===i){if(s.hasAttribute("selected")){r=o;break}o++}!(s=s.nextSibling)&&n&&(s=n.nextSibling,n=null)}t.selectedIndex=r}}};function z(){}function Y(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}var W,X=(W=function(t,e){var n,i,r,o,s=e.attributes;if(11!==e.nodeType&&11!==t.nodeType){for(var a=s.length-1;a>=0;a--)i=(n=s[a]).name,r=n.namespaceURI,o=n.value,r?(i=n.localName||i,t.getAttributeNS(r,i)!==o&&("xmlns"===n.prefix&&(i=n.name),t.setAttributeNS(r,i,o))):t.getAttribute(i)!==o&&t.setAttribute(i,o);for(var u=t.attributes,l=u.length-1;l>=0;l--)i=(n=u[l]).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=F.createElement("html")).innerHTML=i}else e=$(e);var r=n.getNodeKey||Y,o=n.onBeforeNodeAdded||z,s=n.onNodeAdded||z,a=n.onBeforeElUpdated||z,u=n.onElUpdated||z,l=n.onBeforeNodeDiscarded||z,c=n.onNodeDiscarded||z,h=n.onBeforeElChildrenUpdated||z,f=!0===n.childrenOnly,d=Object.create(null),p=[];function g(t){p.push(t)}function m(t,e,n){!1!==l(t)&&(e&&e.removeChild(t),c(t),function t(e,n){if(1===e.nodeType)for(var i=e.firstChild;i;){var o=void 0;n&&(o=r(i))?g(o):(c(i),i.firstChild&&t(i,n)),i=i.nextSibling}}(t,n))}function v(t){s(t);for(var e=t.firstChild;e;){var n=e.nextSibling,i=r(e);if(i){var o=d[i];o&&q(e,o)?(e.parentNode.replaceChild(o,e),y(o,e)):v(e)}else v(e);e=n}}function y(t,e,n){var i=r(e);if(i&&delete d[i],!n){if(!1===a(t,e))return;if(W(t,e),u(t),!1===h(t,e))return}"TEXTAREA"!==t.nodeName?function(t,e){var n,i,s,a,u,l=e.firstChild,c=t.firstChild;t:for(;l;){for(a=l.nextSibling,n=r(l);c;){if(s=c.nextSibling,l.isSameNode&&l.isSameNode(c)){l=a,c=s;continue t}i=r(c);var h=c.nodeType,f=void 0;if(h===l.nodeType&&(1===h?(n?n!==i&&((u=d[n])?s===u?f=!1:(t.insertBefore(u,c),i?g(i):m(c,t,!0),c=u):f=!1):i&&(f=!1),(f=!1!==f&&q(c,l))&&y(c,l)):3!==h&&8!=h||(f=!0,c.nodeValue!==l.nodeValue&&(c.nodeValue=l.nodeValue))),f){l=a,c=s;continue t}i?g(i):m(c,t,!0),c=s}if(n&&(u=d[n])&&q(u,l))t.appendChild(u),y(u,l);else{var p=o(l);!1!==p&&(p&&(l=p),l.actualize&&(l=l.actualize(t.ownerDocument||F)),t.appendChild(l),v(l))}l=a,c=s}!function(t,e,n){for(;e;){var i=e.nextSibling;(n=r(e))?g(n):m(e,t,!0),e=i}}(t,c,i);var b=V[t.nodeName];b&&b(t,e)}(t,e):V.TEXTAREA(t,e)}!function t(e){if(1===e.nodeType||11===e.nodeType)for(var n=e.firstChild;n;){var i=r(n);i&&(d[i]=n),t(n),n=n.nextSibling}}(t);var b,w,k=t,_=k.nodeType,x=e.nodeType;if(!f)if(1===_)1===x?q(t,e)||(c(t),k=function(t,e){for(var n=t.firstChild;n;){var i=n.nextSibling;e.appendChild(n),n=i}return e}(t,(b=e.nodeName,(w=e.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==w?F.createElementNS(w,b):F.createElement(b)))):k=e;else if(3===_||8===_){if(x===_)return k.nodeValue!==e.nodeValue&&(k.nodeValue=e.nodeValue),k;k=e}if(k===e)c(t);else{if(e.isSameNode&&e.isSameNode(k))return;if(y(k,e,f),p)for(var C=0,A=p.length;C<A;C++){var E=d[p[C]];E&&m(E,E.parentNode,!1)}}return!f&&k!==t&&t.parentNode&&(k.actualize&&(k=k.actualize(t.ownerDocument||F)),t.parentNode.replaceChild(k,t)),k}),K=class{static patchEl(t,e,n){X(t,e,{childrenOnly:!1,onBeforeElUpdated:(t,e)=>{if(n&&n.isSameNode(t)&&R.isFormInput(t))return R.mergeFocusedInput(t,e),!1}})}constructor(t,e,n,i,r){this.view=t,this.liveSocket=t.liveSocket,this.container=e,this.id=n,this.rootID=t.root.id,this.html=i,this.targetCID=r,this.cidPatch="number"==typeof this.targetCID,this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[]}}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(){R.all(this.container,"[phx-update=append] > *, [phx-update=prepend] > *",t=>{t.setAttribute("data-phx-remove","")})}perform(){let{view:t,liveSocket:e,container:n,html:i}=this,r=this.isCIDPatch()?this.targetCIDContainer(i):n;if(this.isCIDPatch()&&!r)return;let o=e.getActiveElement(),{selectionStart:s,selectionEnd:a}=o&&R.hasSelectionRange(o)?o:{},l=e.binding("update"),c=e.binding("feedback-for"),h=e.binding("disable-with"),f=e.binding("trigger-action"),p=[],m=[],v=[],y=null,b=e.time("premorph container prep",()=>this.buildDiffHTML(n,i,l,r));return this.trackBefore("added",n),this.trackBefore("updated",n,n),e.time("morphdom",()=>{X(r,b,{childrenOnly:null===r.getAttribute(u),getNodeKey:t=>R.isPhxDestroyed(t)?null:t.id,onBeforeNodeAdded:t=>(this.trackBefore("added",t),t),onNodeAdded:e=>{R.isNowTriggerFormExternal(e,f)&&(y=e),R.discardError(r,e,c),R.isPhxChild(e)&&t.ownsElement(e)&&this.trackAfter("phxChildAdded",e),p.push(e)},onNodeDiscarded:t=>{R.isPhxChild(t)&&e.destroyViewByEl(t),this.trackAfter("discarded",t)},onBeforeNodeDiscarded:t=>!(!t.getAttribute||null===t.getAttribute("data-phx-remove"))||(null===t.parentNode||!R.isPhxUpdate(t.parentNode,l,["append","prepend"])||!t.id)&&!this.skipCIDSibling(t),onElUpdated:t=>{R.isNowTriggerFormExternal(t,f)&&(y=t),m.push(t)},onBeforeElUpdated:(t,e)=>{if(R.cleanChildNodes(e,l),this.skipCIDSibling(e))return!1;if(R.isIgnored(t,l))return this.trackBefore("updated",t,e),R.mergeAttrs(t,e,{isIgnored:!0}),m.push(t),!1;if("number"===t.type&&t.validity&&t.validity.badInput)return!1;if(!R.syncPendingRef(t,e,h))return R.isUploadInput(t)&&(this.trackBefore("updated",t,e),m.push(t)),!1;if(R.isPhxChild(e)){let n=t.getAttribute(d);return R.mergeAttrs(t,e,{exclude:[g]}),""!==n&&t.setAttribute(d,n),t.setAttribute("data-phx-root-id",this.rootID),!1}return R.copyPrivates(e,t),R.discardError(r,e,c),R.syncPropsToAttrs(e),o&&t.isSameNode(o)&&R.isFormInput(t)&&!this.forceFocusedSelectUpdate(t,e)?(this.trackBefore("updated",t,e),R.mergeFocusedInput(t,e),R.syncAttrsToProps(t),m.push(t),!1):(R.isPhxUpdate(e,l,["append","prepend"])&&v.push(new class{constructor(t,e,n){let i=new Set,r=new Set([...e.children].map(t=>t.id)),o=[];Array.from(t.children).forEach(t=>{if(t.id&&(i.add(t.id),r.has(t.id))){let e=t.previousElementSibling&&t.previousElementSibling.id;o.push({elementId:t.id,previousElementId:e})}}),this.containerId=e.id,this.updateType=n,this.elementsToModify=o,this.elementIdsToAdd=[...r].filter(t=>!i.has(t))}perform(){let t=R.byId(this.containerId);this.elementsToModify.forEach(e=>{e.previousElementId?M(document.getElementById(e.previousElementId),t=>{M(document.getElementById(e.elementId),e=>{e.previousElementSibling&&e.previousElementSibling.id==t.id||t.insertAdjacentElement("afterend",e)})}):M(document.getElementById(e.elementId),e=>{null==e.previousElementSibling||t.insertAdjacentElement("afterbegin",e)})}),"prepend"==this.updateType&&this.elementIdsToAdd.reverse().forEach(e=>{M(document.getElementById(e),e=>t.insertAdjacentElement("afterbegin",e))})}}(t,e,e.getAttribute(l))),R.syncAttrsToProps(e),this.trackBefore("updated",t,e),!0)}})}),e.isDebugEnabled()&&function(){let t=new Set,e=document.querySelectorAll("*[id]");for(let n=0,i=e.length;n<i;n++)t.has(e[n].id)?console.error(`Multiple IDs detected: ${e[n].id}. Ensure unique element ids.`):t.add(e[n].id)}(),v.length>0&&e.time("post-morph append/prepend restoration",()=>{v.forEach(t=>t.perform())}),e.silenceEvents(()=>R.restoreFocus(o,s,a)),R.dispatchEvent(document,"phx:update"),p.forEach(t=>this.trackAfter("added",t)),m.forEach(t=>this.trackAfter("updated",t)),y&&(e.disconnect(),y.submit()),!0}forceFocusedSelectUpdate(t,e){let n=["select","select-one","select-multiple"].find(e=>e===t.type);return!0===t.multiple||n&&t.innerHTML!=e.innerHTML}isCIDPatch(){return this.cidPatch}skipCIDSibling(t){return t.nodeType===Node.ELEMENT_NODE&&null!==t.getAttribute("data-phx-skip")}targetCIDContainer(t){if(!this.isCIDPatch())return;let[e,...n]=R.findComponentNodeList(this.container,this.targetCID);return 0===n.length&&1===R.childNodeLength(t)?e:e&&e.parentNode}buildDiffHTML(t,e,n,i){let r=this.isCIDPatch(),o=r&&i.getAttribute(u)===this.targetCID.toString();if(!r||o)return e;{let t=null,n=document.createElement("template");t=R.cloneNode(i);let[r,...o]=R.findComponentNodeList(t,this.targetCID);return n.innerHTML=e,o.forEach(t=>t.remove()),Array.from(t.childNodes).forEach(t=>{t.id&&t.nodeType===Node.ELEMENT_NODE&&t.getAttribute(u)!==this.targetCID.toString()&&(t.setAttribute("data-phx-skip",""),t.innerHTML="")}),Array.from(n.content.childNodes).forEach(e=>t.insertBefore(e,r)),r.remove(),t.outerHTML}}},G=class{static extract(t){let{[w]:e,[b]:n,[k]:i}=t;return delete t[w],delete t[b],delete t[k],{diff:t,title:i,reply:e||null,events:n||[]}}constructor(t,e){this.viewId=t,this.rendered={},this.mergeDiff(e)}parentViewId(){return this.viewId}toString(t){return this.recursiveToString(this.rendered,this.rendered.c,t)}recursiveToString(t,e=t.c,n){let i={buffer:"",components:e,onlyCids:n=n?new Set(n):null};return this.toOutputBuffer(t,i),i.buffer}componentCIDs(t){return Object.keys(t.c||{}).map(t=>parseInt(t))}isComponentOnlyDiff(t){return!!t.c&&1===Object.keys(t).length}getComponent(t,e){return t.c[e]}mergeDiff(t){let e=t.c,n={};if(delete t.c,this.rendered=this.mutableMerge(this.rendered,t),this.rendered.c=this.rendered.c||{},e){let r=this.rendered.c;for(let t in e)e[t]=this.cachedFindComponent(t,e[t],r,e,n);for(var i in e)r[i]=e[i];t.c=e}}cachedFindComponent(t,e,n,i,r){if(r[t])return r[t];{let o,s,a=e[y];if("number"==typeof a){let t;t=a>0?this.cachedFindComponent(a,i[a],n,i,r):n[-a],s=t[y],o=this.cloneMerge(t,e),o[y]=s}else o=void 0!==e[y]?e:this.cloneMerge(n[t]||{},e);return r[t]=o,o}}mutableMerge(t,e){return void 0!==e[y]?e:(this.doMutableMerge(t,e),t)}doMutableMerge(t,e){for(let n in e){let i=e[n],r=t[n];S(i)&&void 0===i[y]&&S(r)?this.doMutableMerge(r,i):t[n]=i}}cloneMerge(t,e){let n={...t,...e};for(let i in n){let r=e[i],o=t[i];S(r)&&void 0===r[y]&&S(o)&&(n[i]=this.cloneMerge(o,r))}return n}componentToString(t){return this.recursiveCIDToString(this.rendered.c,t)}pruneCIDs(t){t.forEach(t=>delete this.rendered.c[t])}get(){return this.rendered}isNewFingerprint(t={}){return!!t[y]}toOutputBuffer(t,e){if(t[v])return this.comprehensionToBuffer(t,e);let{[y]:n}=t;e.buffer+=n[0];for(let i=1;i<n.length;i++)this.dynamicToBuffer(t[i-1],e),e.buffer+=n[i]}comprehensionToBuffer(t,e){let{[v]:n,[y]:i}=t;for(let t=0;t<n.length;t++){let r=n[t];e.buffer+=i[0];for(let t=1;t<i.length;t++)this.dynamicToBuffer(r[t-1],e),e.buffer+=i[t]}}dynamicToBuffer(t,e){"number"==typeof t?e.buffer+=this.recursiveCIDToString(e.components,t,e.onlyCids):S(t)?this.toOutputBuffer(t,e):e.buffer+=t}recursiveCIDToString(t,e,n){let i=t[e]||_("no component for CID "+e,t),r=document.createElement("template");r.innerHTML=this.recursiveToString(i,t,n);let o=r.content,s=n&&!n.has(e),[a,l]=Array.from(o.childNodes).reduce(([t,n],i,o)=>i.nodeType===Node.ELEMENT_NODE?i.getAttribute(u)?[t,!0]:(i.setAttribute(u,e),i.id||(i.id=`${this.parentViewId()}-${e}-${o}`),s&&(i.setAttribute("data-phx-skip",""),i.innerHTML=""),[!0,n]):""!==i.nodeValue.trim()?(_(`only HTML element tags are allowed at the root of components.\n\ngot: "${i.nodeValue.trim()}"\n\nwithin:\n`,r.innerHTML.trim()),i.replaceWith(this.createSpan(i.nodeValue,e)),[!0,n]):(i.remove(),[t,n]),[!1,!1]);return a||l?!a&&l?(_("expected at least one HTML element tag directly inside a component, but only subcomponents were found. A component must render at least one HTML tag directly inside itself.",r.innerHTML.trim()),r.innerHTML):r.innerHTML:(_("expected at least one HTML element tag inside a component, but the component is empty:\n",r.innerHTML.trim()),this.createSpan("",e).outerHTML)}createSpan(t,e){let n=document.createElement("span");return n.innerText=t,n.setAttribute(u,e),n}},Z=1,Q=class{static makeID(){return Z++}static elementID(t){return t.phxHookId}constructor(t,e,n){this.__view=t,this.__liveSocket=t.liveSocket,this.__callbacks=n,this.__listeners=new Set,this.__isDisconnected=!1,this.el=e,this.el.phxHookId=this.constructor.makeID();for(let t in this.__callbacks)this[t]=this.__callbacks[t]}__mounted(){this.mounted&&this.mounted()}__updated(){this.updated&&this.updated()}__beforeUpdate(){this.beforeUpdate&&this.beforeUpdate()}__destroyed(){this.destroyed&&this.destroyed()}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected&&this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected&&this.disconnected()}pushEvent(t,e={},n=function(){}){return this.__view.pushHookEvent(null,t,e,n)}pushEventTo(t,e,n={},i=function(){}){return this.__view.withinTargets(t,(t,r)=>t.pushHookEvent(r,e,n,i))}handleEvent(t,e){let n=(n,i)=>i?t:e(n.detail);return window.addEventListener("phx:hook:"+t,n),this.__listeners.add(n),n}removeHandleEvent(t){let e=t(null,!0);window.removeEventListener("phx:hook:"+e,t),this.__listeners.delete(t)}upload(t,e){return this.__view.dispatchUploads(t,e)}uploadTo(t,e,n){return this.__view.withinTargets(t,t=>t.dispatchUploads(e,n))}__cleanup__(){this.__listeners.forEach(t=>this.removeHandleEvent(t))}},tt=(t,e={})=>{let n=new FormData(t),i=[];n.forEach((t,e,n)=>{t instanceof File&&i.push(e)}),i.forEach(t=>n.delete(t));let r=new URLSearchParams;for(let[t,e]of n.entries())r.append(t,e);for(let t in e)r.append(t,e[t]);return r.toString()},et=class{constructor(t,e,n,i){this.liveSocket=e,this.flash=i,this.parent=n,this.root=n?n.root:this,this.el=t,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.pruningCIDs=[],this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(){},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.uploaders={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.channel=this.liveSocket.channel("lv:"+this.id,()=>({redirect:this.redirect?this.href:void 0,url:this.redirect?void 0:this.href||void 0,params:this.connectParams(),session:this.getSession(),static:this.getStatic(),flash:this.flash})),this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel()}setHref(t){this.href=t}setRedirect(t){this.redirect=!0,this.href=t}isMain(){return this.liveSocket.main===this}connectParams(){let t=this.liveSocket.params(this.el),e=R.all(document,`[${this.binding("track-static")}]`).map(t=>t.src||t.href).filter(t=>"string"==typeof t);return e.length>0&&(t._track_static=e),t._mounts=this.joinCount,t}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(d)}getStatic(){let t=this.el.getAttribute(g);return""===t?null:t}destroy(t=function(){}){this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);let e=()=>{t();for(let t in this.viewHooks)this.destroyHook(this.viewHooks[t])};R.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",e).receive("error",e).receive("timeout",e)}setContainerClasses(...t){this.el.classList.remove("phx-connected","phx-disconnected","phx-error"),this.el.classList.add(...t)}isLoading(){return this.el.classList.contains("phx-disconnected")}showLoader(t){if(clearTimeout(this.loaderTimer),t)this.loaderTimer=setTimeout(()=>this.showLoader(),t);else{for(let t in this.viewHooks)this.viewHooks[t].__disconnected();this.setContainerClasses("phx-disconnected")}}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses("phx-connected")}triggerReconnected(){for(let t in this.viewHooks)this.viewHooks[t].__reconnected()}log(t,e){this.liveSocket.log(this,t,e)}withinTargets(t,e){if(t instanceof HTMLElement)return this.liveSocket.owner(t,n=>e(n,t));if(/^(0|[1-9]\d*)$/.test(t)){let n=R.findComponentNodeList(this.el,t);0===n.length?_("no component found matching phx-target of "+t):e(this,n[0])}else{let n=Array.from(document.querySelectorAll(t));0===n.length&&_(`nothing found matching the phx-target selector "${t}"`),n.forEach(t=>this.liveSocket.owner(t,n=>e(n,t)))}}applyDiff(t,e,n){this.log(t,()=>["",A(e)]);let{diff:i,reply:r,events:o,title:s}=G.extract(e);return s&&R.putTitle(s),n({diff:i,reply:r,events:o}),r}onJoin(t){let{rendered:e,container:n}=t;if(n){let[t,e]=n;this.el=R.replaceRootContainer(this.el,t,e)}this.childJoins=0,this.joinPending=!0,this.flash=null,D.dropLocal(this.liveSocket.localStorage,window.location.pathname,"consecutive-reloads"),this.applyDiff("mount",e,({diff:e,events:n})=>{this.rendered=new G(this.id,e);let i=this.renderContainer(null,"join");this.dropPendingRefs();let r=this.formsForRecovery(i);this.joinCount++,r.length>0?r.forEach((t,e)=>{this.pushFormRecovery(t,t=>{e===r.length-1&&this.onJoinComplete(t,i,n)})}):this.onJoinComplete(t,i,n)})}dropPendingRefs(){R.all(this.el,`[${l}]`,t=>t.removeAttribute(l))}onJoinComplete({live_patch:t},e,n){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(t,e,n);0===R.findPhxChildrenInFragment(e,this.id).filter(t=>{let e=t.id&&this.el.querySelector(`[id="${t.id}"]`),n=e&&e.getAttribute(g);return n&&t.setAttribute(g,n),this.joinChild(t)}).length?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(t,e,n)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(t,e,n)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(t,e,n)])}attachTrueDocEl(){this.el=R.byId(this.id),this.el.setAttribute("data-phx-root-id",this.root.id)}dispatchEvents(t){t.forEach(([t,e])=>{window.dispatchEvent(new CustomEvent("phx:hook:"+t,{detail:e}))})}applyJoinPatch(t,e,n){this.attachTrueDocEl();let i=new K(this,this.el,this.id,e,null);if(i.markPrunableContentForRemoval(),this.performPatch(i,!1),this.joinNewChildren(),R.all(this.el,`[${this.binding("hook")}], [data-phx-hook]`,t=>{let e=this.addHook(t);e&&e.__mounted()}),this.joinPending=!1,this.dispatchEvents(n),this.applyPendingUpdates(),t){let{kind:e,to:n}=t;this.liveSocket.historyPatch(n,e)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(t,e){this.liveSocket.triggerDOM("onBeforeElUpdated",[t,e]);let n=this.getHook(t),i=n&&R.isIgnored(t,this.binding("update"));if(n&&!t.isEqualNode(e)&&(!i||(r=t.dataset,o=e.dataset,JSON.stringify(r)!==JSON.stringify(o))))return n.__beforeUpdate(),n;var r,o}performPatch(t,e){let n=[],i=!1,r=new Set;return t.after("added",t=>{this.liveSocket.triggerDOM("onNodeAdded",[t]);let e=this.addHook(t);e&&e.__mounted()}),t.after("phxChildAdded",t=>i=!0),t.before("updated",(t,e)=>{this.triggerBeforeUpdateHook(t,e)&&r.add(t.id)}),t.after("updated",t=>{r.has(t.id)&&this.getHook(t).__updated()}),t.after("discarded",t=>{let e=this.componentID(t);"number"==typeof e&&-1===n.indexOf(e)&&n.push(e);let i=this.getHook(t);i&&this.destroyHook(i)}),t.perform(),e&&this.maybePushComponentsDestroyed(n),i}joinNewChildren(){R.findPhxChildren(this.el,this.id).forEach(t=>this.joinChild(t))}getChildById(t){return this.root.children[this.id][t]}getDescendentByEl(t){return t.id===this.id?this:this.children[t.getAttribute("data-phx-parent-id")][t.id]}destroyDescendent(t){for(let e in this.root.children)for(let n in this.root.children[e])if(n===t)return this.root.children[e][n].destroy()}joinChild(t){if(!this.getChildById(t.id)){let e=new et(t,this.liveSocket,this);return this.root.children[this.id][e.id]=e,e.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(t){this.childJoins--,0===this.childJoins&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.joinCallback(),this.pendingJoinOps.forEach(([t,e])=>{t.isDestroyed()||e()}),this.pendingJoinOps=[]}update(t,e){if(this.isJoinPending()||this.liveSocket.hasPendingLink())return this.pendingDiffs.push({diff:t,events:e});this.rendered.mergeDiff(t);let n=!1;this.rendered.isComponentOnlyDiff(t)?this.liveSocket.time("component patch complete",()=>{R.findParentCIDs(this.el,this.rendered.componentCIDs(t)).forEach(e=>{this.componentPatch(this.rendered.getComponent(t,e),e)&&(n=!0)})}):T(t)||this.liveSocket.time("full patch complete",()=>{let e=this.renderContainer(t,"update"),i=new K(this,this.el,this.id,e,null);n=this.performPatch(i,!0)}),this.dispatchEvents(e),n&&this.joinNewChildren()}renderContainer(t,e){return this.liveSocket.time(`toString diff (${e})`,()=>{let e=this.el.tagName,n=t?this.rendered.componentCIDs(t).concat(this.pruningCIDs):null;return`<${e}>${this.rendered.toString(n)}</${e}>`})}componentPatch(t,e){if(T(t))return!1;let n=this.rendered.componentToString(e),i=new K(this,this.el,this.id,n,e);return this.performPatch(i,!0)}getHook(t){return this.viewHooks[Q.elementID(t)]}addHook(t){if(Q.elementID(t)||!t.getAttribute)return;let e=t.getAttribute("data-phx-hook")||t.getAttribute(this.binding("hook"));if(e&&!this.ownsElement(t))return;let n=this.liveSocket.getHookCallbacks(e);if(n){t.id||_(`no DOM ID for hook "${e}". Hooks require a unique ID on each element.`,t);let i=new Q(this,t,n);return this.viewHooks[Q.elementID(i.el)]=i,i}null!==e&&_(`unknown hook found for "${e}"`,t)}destroyHook(t){t.__destroyed(),t.__cleanup__(),delete this.viewHooks[Q.elementID(t.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:t,events:e})=>this.update(t,e)),this.pendingDiffs=[]}onChannel(t,e){this.liveSocket.onChannel(this.channel,t,t=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>e(t)]):e(t)})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",t=>{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(){for(let t in this.root.children[this.id])this.getChildById(t).destroy()}onLiveRedirect(t){let{to:e,kind:n,flash:i}=t,r=this.expandURL(e);this.liveSocket.historyRedirect(r,n,i)}onLivePatch(t){let{to:e,kind:n}=t;this.href=this.expandURL(e),this.liveSocket.historyPatch(e,n)}expandURL(t){return t.startsWith("/")?`${window.location.protocol}//${window.location.host}${t}`:t}onRedirect({to:t,flash:e}){this.liveSocket.redirect(t,e)}isDestroyed(){return this.destroyed}join(t){this.parent||(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=()=>t&&t(this.joinCount),this.liveSocket.wrapPush(this,{timeout:!1},()=>this.channel.join().receive("ok",t=>!this.isDestroyed()&&this.onJoin(t)).receive("error",t=>!this.isDestroyed()&&this.onJoinError(t)).receive("timeout",()=>!this.isDestroyed()&&this.onJoinError({reason:"timeout"})))}onJoinError(t){return"unauthorized"===t.reason||"stale"===t.reason?(this.log("error",()=>["unauthorized live_redirect. Falling back to page request",t]),this.onRedirect({to:this.href})):((t.redirect||t.live_redirect)&&(this.joinPending=!1,this.channel.leave()),t.redirect?this.onRedirect(t.redirect):t.live_redirect?this.onLiveRedirect(t.live_redirect):(this.log("error",()=>["unable to join",t]),this.liveSocket.reloadWithJitter(this)))}onClose(t){if(!this.isDestroyed()){if(this.isJoinPending()&&"hidden"!==document.visibilityState||this.liveSocket.hasPendingLink()&&"leave"!==t)return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(200)}}onError(t){this.onClose(t),this.log("error",()=>["view crashed",t]),this.liveSocket.isUnloaded()||this.displayError()}displayError(){this.isMain()&&R.dispatchEvent(window,"phx:page-loading-start",{to:this.href,kind:"error"}),this.showLoader(),this.setContainerClasses("phx-disconnected","phx-error")}pushWithReply(t,e,n,i=function(){}){if(!this.isConnected())return;let[r,[o]]=t?t():[null,[]],s=function(){};return o&&null!==o.getAttribute(this.binding("page-loading"))&&(s=this.liveSocket.withPageLoading({kind:"element",target:o})),"number"!=typeof n.cid&&delete n.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(e,n,3e4).receive("ok",t=>{let e=null;null!==r&&this.undoRefs(r),t.diff&&(e=this.applyDiff("update",t.diff,({diff:t,events:e})=>{this.update(t,e)})),t.redirect&&this.onRedirect(t.redirect),t.live_patch&&this.onLivePatch(t.live_patch),t.live_redirect&&this.onLiveRedirect(t.live_redirect),s(),i(t,e)}))}undoRefs(t){R.all(this.el,`[${l}="${t}"]`,t=>{let e=t.getAttribute("data-phx-disabled");t.removeAttribute(l),null!==t.getAttribute("data-phx-readonly")&&(t.readOnly=!1,t.removeAttribute("data-phx-readonly")),null!==e&&(t.disabled="true"===e,t.removeAttribute("data-phx-disabled")),a.forEach(e=>R.removeClass(t,e));let n=t.getAttribute("data-phx-disable-with-restore");null!==n&&(t.innerText=n,t.removeAttribute("data-phx-disable-with-restore"));let i=R.private(t,l);if(i){let e=this.triggerBeforeUpdateHook(t,i);K.patchEl(t,i,this.liveSocket.getActiveElement()),e&&e.__updated(),R.deletePrivate(t,l)}})}putRef(t,e){let n=this.ref++,i=this.binding("disable-with");return t.forEach(t=>{t.classList.add(`phx-${e}-loading`),t.setAttribute(l,n);let r=t.getAttribute(i);null!==r&&(t.getAttribute("data-phx-disable-with-restore")||t.setAttribute("data-phx-disable-with-restore",t.innerText),t.innerText=r)}),[n,t]}componentID(t){let e=t.getAttribute&&t.getAttribute(u);return e?parseInt(e):null}targetComponentID(t,e){return t.getAttribute(this.binding("target"))?this.closestComponentID(e):null}closestComponentID(t){return t?M(t.closest(`[${u}]`),t=>this.ownsElement(t)&&this.componentID(t)):null}pushHookEvent(t,e,n,i){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",e,n]),!1;let[r,o]=this.putRef([],"hook");return this.pushWithReply(()=>[r,o],"event",{type:"hook",event:e,value:n,cid:this.closestComponentID(t)},(t,e)=>i(e,r)),r}extractMeta(t,e){let n=this.binding("value-");for(let i=0;i<t.attributes.length;i++){let r=t.attributes[i].name;r.startsWith(n)&&(e[r.replace(n,"")]=t.getAttribute(r))}return void 0!==t.value&&(e.value=t.value,"INPUT"===t.tagName&&f.indexOf(t.type)>=0&&!t.checked&&delete e.value),e}pushEvent(t,e,n,i,r){this.pushWithReply(()=>this.putRef([e],t),"event",{type:t,event:i,value:this.extractMeta(e,r),cid:this.targetComponentID(e,n)})}pushKey(t,e,n,i,r){this.pushWithReply(()=>this.putRef([t],n),"event",{type:n,event:i,value:this.extractMeta(t,r),cid:this.targetComponentID(t,e)})}pushFileProgress(t,e,n,i=function(){}){this.liveSocket.withinOwners(t.form,(r,o)=>{r.pushWithReply(null,"progress",{event:t.getAttribute(r.binding("progress")),ref:t.getAttribute(c),entry_ref:e,progress:n,cid:r.targetComponentID(t.form,o)},i)})}pushInput(t,e,n,i,r){let o,s=this.targetComponentID(t.form,e),a=()=>this.putRef([t,t.form],"change"),u=tt(t.form,{_target:i.name});t.files&&t.files.length>0&&j.trackFiles(t,Array.from(t.files)),o=j.serializeUploads(t);let l={type:"form",event:n,value:u,uploads:o,cid:s};this.pushWithReply(a,"event",l,n=>{if(R.showError(t,this.liveSocket.binding("feedback-for")),R.isUploadInput(t)&&null!==t.getAttribute("data-phx-auto-upload")){if(j.filesAwaitingPreflight(t).length>0){let[i,o]=a();this.uploadFiles(t.form,e,i,s,e=>{r&&r(n),this.triggerAwaitingSubmit(t.form)})}}else r&&r(n)})}triggerAwaitingSubmit(t){let e=this.getScheduledSubmit(t);if(e){let[n,i,r]=e;this.cancelSubmit(t),r()}}getScheduledSubmit(t){return this.formSubmits.find(([e,n])=>e.isSameNode(t))}scheduleSubmit(t,e,n){if(this.getScheduledSubmit(t))return!0;this.formSubmits.push([t,e,n])}cancelSubmit(t){this.formSubmits=this.formSubmits.filter(([e,n,i])=>!e.isSameNode(t)||(this.undoRefs(n),!1))}pushFormSubmit(t,e,n,i){let r=t=>!(E(t,this.binding("update")+"=ignore",t.form)||E(t,"data-phx-update=ignore",t.form)),o=t=>t.hasAttribute(this.binding("disable-with")),s=t=>"BUTTON"==t.tagName,a=t=>["INPUT","TEXTAREA","SELECT"].includes(t.tagName),u=()=>{let e=Array.from(t.elements),n=e.filter(o),i=e.filter(s).filter(r),u=e.filter(a).filter(r);return i.forEach(t=>{t.setAttribute("data-phx-disabled",t.disabled),t.disabled=!0}),u.forEach(t=>{t.setAttribute("data-phx-readonly",t.readOnly),t.readOnly=!0,t.files&&(t.setAttribute("data-phx-disabled",t.disabled),t.disabled=!0)}),t.setAttribute(this.binding("page-loading"),""),this.putRef([t].concat(n).concat(i).concat(u),"submit")},l=this.targetComponentID(t,e);if(j.hasUploadsInProgress(t)){let[r,o]=u();return this.scheduleSubmit(t,r,()=>this.pushFormSubmit(t,e,n,i))}if(j.inputsAwaitingPreflight(t).length>0){let[r,o]=u(),s=()=>[r,o];this.uploadFiles(t,e,r,l,e=>{let r=tt(t,{});this.pushWithReply(s,"event",{type:"form",event:n,value:r,cid:l},i)})}else{let e=tt(t);this.pushWithReply(u,"event",{type:"form",event:n,value:e,cid:l},i)}}uploadFiles(t,e,n,i,r){let o=this.joinCount,s=j.activeFileInputs(t),a=s.length;s.forEach(t=>{let i=new j(t,this,()=>{a--,0===a&&r()});this.uploaders[t]=i;let s=i.entries().map(t=>t.toPreflightPayload()),u={ref:t.getAttribute(c),entries:s,cid:this.targetComponentID(t.form,e)};this.log("upload",()=>["sending preflight request",u]),this.pushWithReply(null,"allow_upload",u,t=>{if(this.log("upload",()=>["got preflight response",t]),t.error){this.undoRefs(n);let[e,i]=t.error;this.log("upload",()=>["error for entry "+e,i])}else{let e=t=>{this.channel.onError(()=>{this.joinCount===o&&t()})};i.initAdapterUpload(t,e,this.liveSocket)}})})}dispatchUploads(t,e){let n=R.findUploadInputs(this.el).filter(e=>e.name===t);0===n.length?_(`no live file inputs found matching the name "${t}"`):n.length>1?_(`duplicate live file inputs found matching the name "${t}"`):R.dispatchEvent(n[0],"track-uploads",{files:e})}pushFormRecovery(t,e){this.liveSocket.withinOwners(t,(n,i)=>{let r=t.elements[0],o=t.getAttribute(this.binding("auto-recover"))||t.getAttribute(this.binding("change"));n.pushInput(r,i,o,r,e)})}pushLinkPatch(t,e,n){let i=this.liveSocket.setPendingLink(t),r=e?()=>this.putRef([e],"click"):null;this.pushWithReply(r,"live_patch",{url:t},e=>{e.link_redirect?this.liveSocket.replaceMain(t,null,n,i):(this.liveSocket.commitPendingLink(i)&&(this.href=t),this.applyPendingUpdates(),n&&n(i))}).receive("timeout",()=>this.liveSocket.redirect(window.location.href))}formsForRecovery(t){if(0===this.joinCount)return[];let e=this.binding("change"),n=document.createElement("template");return n.innerHTML=t,R.all(this.el,`form[${e}]`).filter(t=>this.ownsElement(t)).filter(t=>t.elements.length>0).filter(t=>"ignore"!==t.getAttribute(this.binding("auto-recover"))).filter(t=>n.content.querySelector(`form[${e}="${t.getAttribute(e)}"]`))}maybePushComponentsDestroyed(t){let e=t.filter(t=>0===R.findComponentNodeList(this.el,t).length);e.length>0&&(this.pruningCIDs.push(...e),this.pushWithReply(null,"cids_will_destroy",{cids:e},()=>{this.pruningCIDs=this.pruningCIDs.filter(t=>-1!==e.indexOf(t));let t=e.filter(t=>0===R.findComponentNodeList(this.el,t).length);t.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:t},t=>{this.rendered.pruneCIDs(t.cids)})}))}ownsElement(t){return t.getAttribute("data-phx-parent-id")===this.id||M(t.closest(p),t=>t.id)===this.id}submitForm(t,e,n){R.putPrivate(t,"phx-has-submitted",!0),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(t,e,n,()=>{this.liveSocket.restorePreviouslyActiveFocus()})}binding(t){return this.liveSocket.binding(t)}},nt=function(t){return t};function it(t){return"translate("+t+",0)"}function rt(t){return"translate(0,"+t+")"}function ot(t){return e=>+t(e)}function st(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function at(){return!this.__axis}function ut(t,e){var n=[],i=null,r=null,o=6,s=6,a=3,u="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,l=1===t||4===t?-1:1,c=4===t||2===t?"x":"y",h=1===t||3===t?it:rt;function f(f){var d=null==i?e.ticks?e.ticks.apply(e,n):e.domain():i,p=null==r?e.tickFormat?e.tickFormat.apply(e,n):nt:r,g=Math.max(o,0)+a,m=e.range(),v=+m[0]+u,y=+m[m.length-1]+u,b=(e.bandwidth?st:ot)(e.copy(),u),w=f.selection?f.selection():f,k=w.selectAll(".domain").data([null]),_=w.selectAll(".tick").data(d,e).order(),x=_.exit(),C=_.enter().append("g").attr("class","tick"),A=_.select("line"),E=_.select("text");k=k.merge(k.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),_=_.merge(C),A=A.merge(C.append("line").attr("stroke","currentColor").attr(c+"2",l*o)),E=E.merge(C.append("text").attr("fill","currentColor").attr(c,l*g).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),f!==w&&(k=k.transition(f),_=_.transition(f),A=A.transition(f),E=E.transition(f),x=x.transition(f).attr("opacity",1e-6).attr("transform",(function(t){return isFinite(t=b(t))?h(t+u):this.getAttribute("transform")})),C.attr("opacity",1e-6).attr("transform",(function(t){var e=this.parentNode.__axis;return h((e&&isFinite(e=e(t))?e:b(t))+u)}))),x.remove(),k.attr("d",4===t||2===t?s?"M"+l*s+","+v+"H"+u+"V"+y+"H"+l*s:"M"+u+","+v+"V"+y:s?"M"+v+","+l*s+"V"+u+"H"+y+"V"+l*s:"M"+v+","+u+"H"+y),_.attr("opacity",1).attr("transform",(function(t){return h(b(t)+u)})),A.attr(c+"2",l*o),E.attr(c,l*g).text(p),w.filter(at).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),w.each((function(){this.__axis=b}))}return f.scale=function(t){return arguments.length?(e=t,f):e},f.ticks=function(){return n=Array.from(arguments),f},f.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),f):n.slice()},f.tickValues=function(t){return arguments.length?(i=null==t?null:Array.from(t),f):i&&i.slice()},f.tickFormat=function(t){return arguments.length?(r=t,f):r},f.tickSize=function(t){return arguments.length?(o=s=+t,f):o},f.tickSizeInner=function(t){return arguments.length?(o=+t,f):o},f.tickSizeOuter=function(t){return arguments.length?(s=+t,f):s},f.tickPadding=function(t){return arguments.length?(a=+t,f):a},f.offset=function(t){return arguments.length?(u=+t,f):u},f}function lt(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ct(t){let e=t,n=t,i=t;function r(t,e,r=0,o=t.length){if(r<o){if(0!==n(e,e))return o;do{const n=r+o>>>1;i(t[n],e)<0?r=n+1:o=n}while(r<o)}return r}return 1===t.length&&(e=(e,n)=>t(e)-n,n=lt,i=(e,n)=>lt(t(e),n)),{left:r,center:function(t,n,i=0,o=t.length){const s=r(t,n,i,o-1);return s>i&&e(t[s-1],n)>-e(t[s],n)?s-1:s},right:function(t,e,r=0,o=t.length){if(r<o){if(0!==n(e,e))return o;do{const n=r+o>>>1;i(t[n],e)<=0?r=n+1:o=n}while(r<o)}return r}}}var ht=Math.sqrt(50),ft=Math.sqrt(10),dt=Math.sqrt(2);function pt(t,e,n){var i=(e-t)/Math.max(0,n),r=Math.floor(Math.log(i)/Math.LN10),o=i/Math.pow(10,r);return r>=0?(o>=ht?10:o>=ft?5:o>=dt?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(o>=ht?10:o>=ft?5:o>=dt?2:1)}function gt(t,e,n){var i=Math.abs(e-t)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),o=i/r;return o>=ht?r*=10:o>=ft?r*=5:o>=dt&&(r*=2),e<t?-r:r}var mt=new Date,vt=new Date;function yt(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,o){var s,a=[];if(n=r.ceil(n),o=null==o?1:Math.floor(o),!(n<i&&o>0))return a;do{a.push(s=new Date(+n)),e(n,o),t(n)}while(s<n&&n<i);return a},r.filter=function(n){return yt((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 mt.setTime(+e),vt.setTime(+i),t(mt),t(vt),Math.floor(n(mt,vt))},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 bt=yt((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));bt.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?yt((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):bt:null};var wt=bt,kt=(bt.range,yt((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()}))),_t=kt,xt=(kt.range,yt((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()}))),Ct=xt,At=(xt.range,yt((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()}))),Et=At,St=(At.range,yt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5,t=>t.getDate()-1)),Tt=St;St.range;function Mt(t){return yt((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var Lt=Mt(0),Pt=Mt(1),Dt=Mt(2),Nt=Mt(3),Rt=Mt(4),It=Mt(5),Ut=Mt(6),jt=(Lt.range,Pt.range,Dt.range,Nt.range,Rt.range,It.range,Ut.range,yt((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()}))),Ht=jt,Ft=(jt.range,yt((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()})));Ft.every=function(t){return isFinite(t=Math.floor(t))&&t>0?yt((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};var Ot=Ft,Bt=(Ft.range,yt((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()}))),$t=Bt,qt=(Bt.range,yt((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()}))),Jt=qt,Vt=(qt.range,yt((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1}))),zt=Vt;Vt.range;function Yt(t){return yt((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var Wt=Yt(0),Xt=Yt(1),Kt=Yt(2),Gt=Yt(3),Zt=Yt(4),Qt=Yt(5),te=Yt(6),ee=(Wt.range,Xt.range,Kt.range,Gt.range,Zt.range,Qt.range,te.range,yt((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()}))),ne=ee,ie=(ee.range,yt((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()})));ie.every=function(t){return isFinite(t=Math.floor(t))&&t>0?yt((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};var re=ie;ie.range;function oe(t,e,n,i,r,o){const s=[[_t,1,1e3],[_t,5,5e3],[_t,15,15e3],[_t,30,3e4],[o,1,6e4],[o,5,3e5],[o,15,9e5],[o,30,18e5],[r,1,36e5],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,864e5],[i,2,1728e5],[n,1,6048e5],[e,1,2592e6],[e,3,7776e6],[t,1,31536e6]];function a(e,n,i){const r=Math.abs(n-e)/i,o=ct(([,,t])=>t).right(s,r);if(o===s.length)return t.every(gt(e/31536e6,n/31536e6,i));if(0===o)return wt.every(Math.max(gt(e,n,i),1));const[a,u]=s[r/s[o-1][2]<s[o][2]/r?o-1:o];return a.every(u)}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),o=r?r.range(t,+e+1):[];return i?o.reverse():o},a]}const[se,ae]=oe(re,ne,Wt,zt,Jt,$t),[ue,le]=oe(Ot,Ht,Lt,Tt,Et,Ct);function ce(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 he(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 fe(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}var de,pe,ge={"-":"",_:" ",0:"0"},me=/^\s*\d+/,ve=/^%/,ye=/[\\^$*+?|[\]().{}]/g;function be(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",o=r.length;return i+(o<n?new Array(n-o+1).join(e)+r:r)}function we(t){return t.replace(ye,"\\$&")}function ke(t){return new RegExp("^(?:"+t.map(we).join("|")+")","i")}function _e(t){return new Map(t.map((t,e)=>[t.toLowerCase(),e]))}function xe(t,e,n){var i=me.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function Ce(t,e,n){var i=me.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function Ae(t,e,n){var i=me.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function Ee(t,e,n){var i=me.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function Se(t,e,n){var i=me.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function Te(t,e,n){var i=me.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function Me(t,e,n){var i=me.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Le(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 Pe(t,e,n){var i=me.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function De(t,e,n){var i=me.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function Ne(t,e,n){var i=me.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function Re(t,e,n){var i=me.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function Ie(t,e,n){var i=me.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function Ue(t,e,n){var i=me.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function je(t,e,n){var i=me.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function He(t,e,n){var i=me.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function Fe(t,e,n){var i=me.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function Oe(t,e,n){var i=ve.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function Be(t,e,n){var i=me.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function $e(t,e,n){var i=me.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function qe(t,e){return be(t.getDate(),e,2)}function Je(t,e){return be(t.getHours(),e,2)}function Ve(t,e){return be(t.getHours()%12||12,e,2)}function ze(t,e){return be(1+Tt.count(Ot(t),t),e,3)}function Ye(t,e){return be(t.getMilliseconds(),e,3)}function We(t,e){return Ye(t,e)+"000"}function Xe(t,e){return be(t.getMonth()+1,e,2)}function Ke(t,e){return be(t.getMinutes(),e,2)}function Ge(t,e){return be(t.getSeconds(),e,2)}function Ze(t){var e=t.getDay();return 0===e?7:e}function Qe(t,e){return be(Lt.count(Ot(t)-1,t),e,2)}function tn(t){var e=t.getDay();return e>=4||0===e?Rt(t):Rt.ceil(t)}function en(t,e){return t=tn(t),be(Rt.count(Ot(t),t)+(4===Ot(t).getDay()),e,2)}function nn(t){return t.getDay()}function rn(t,e){return be(Pt.count(Ot(t)-1,t),e,2)}function on(t,e){return be(t.getFullYear()%100,e,2)}function sn(t,e){return be((t=tn(t)).getFullYear()%100,e,2)}function an(t,e){return be(t.getFullYear()%1e4,e,4)}function un(t,e){var n=t.getDay();return be((t=n>=4||0===n?Rt(t):Rt.ceil(t)).getFullYear()%1e4,e,4)}function ln(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+be(e/60|0,"0",2)+be(e%60,"0",2)}function cn(t,e){return be(t.getUTCDate(),e,2)}function hn(t,e){return be(t.getUTCHours(),e,2)}function fn(t,e){return be(t.getUTCHours()%12||12,e,2)}function dn(t,e){return be(1+zt.count(re(t),t),e,3)}function pn(t,e){return be(t.getUTCMilliseconds(),e,3)}function gn(t,e){return pn(t,e)+"000"}function mn(t,e){return be(t.getUTCMonth()+1,e,2)}function vn(t,e){return be(t.getUTCMinutes(),e,2)}function yn(t,e){return be(t.getUTCSeconds(),e,2)}function bn(t){var e=t.getUTCDay();return 0===e?7:e}function wn(t,e){return be(Wt.count(re(t)-1,t),e,2)}function kn(t){var e=t.getUTCDay();return e>=4||0===e?Zt(t):Zt.ceil(t)}function _n(t,e){return t=kn(t),be(Zt.count(re(t),t)+(4===re(t).getUTCDay()),e,2)}function xn(t){return t.getUTCDay()}function Cn(t,e){return be(Xt.count(re(t)-1,t),e,2)}function An(t,e){return be(t.getUTCFullYear()%100,e,2)}function En(t,e){return be((t=kn(t)).getUTCFullYear()%100,e,2)}function Sn(t,e){return be(t.getUTCFullYear()%1e4,e,4)}function Tn(t,e){var n=t.getUTCDay();return be((t=n>=4||0===n?Zt(t):Zt.ceil(t)).getUTCFullYear()%1e4,e,4)}function Mn(){return"+0000"}function Ln(){return"%"}function Pn(t){return+t}function Dn(t){return Math.floor(+t/1e3)}de=function(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,s=t.shortDays,a=t.months,u=t.shortMonths,l=ke(r),c=_e(r),h=ke(o),f=_e(o),d=ke(s),p=_e(s),g=ke(a),m=_e(a),v=ke(u),y=_e(u),b={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return a[t.getMonth()]},c:null,d:qe,e:qe,f:We,g:sn,G:un,H:Je,I:Ve,j:ze,L:Ye,m:Xe,M:Ke,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Pn,s:Dn,S:Ge,u:Ze,U:Qe,V:en,w:nn,W:rn,x:null,X:null,y:on,Y:an,Z:ln,"%":Ln},w={a:function(t){return s[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return u[t.getUTCMonth()]},B:function(t){return a[t.getUTCMonth()]},c:null,d:cn,e:cn,f:gn,g:En,G:Tn,H:hn,I:fn,j:dn,L:pn,m:mn,M:vn,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Pn,s:Dn,S:yn,u:bn,U:wn,V:_n,w:xn,W:Cn,x:null,X:null,y:An,Y:Sn,Z:Mn,"%":Ln},k={a:function(t,e,n){var i=d.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=h.exec(e.slice(n));return i?(t.w=f.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){var i=v.exec(e.slice(n));return i?(t.m=y.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){var i=g.exec(e.slice(n));return i?(t.m=m.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,n,i){return C(t,e,n,i)},d:Ne,e:Ne,f:Fe,g:Me,G:Te,H:Ie,I:Ie,j:Re,L:He,m:De,M:Ue,p:function(t,e,n){var i=l.exec(e.slice(n));return i?(t.p=c.get(i[0].toLowerCase()),n+i[0].length):-1},q:Pe,Q:Be,s:$e,S:je,u:Ce,U:Ae,V:Ee,w:xe,W:Se,x:function(t,e,i){return C(t,n,e,i)},X:function(t,e,n){return C(t,i,e,n)},y:Me,Y:Te,Z:Le,"%":Oe};function _(t,e){return function(n){var i,r,o,s=[],a=-1,u=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++a<l;)37===t.charCodeAt(a)&&(s.push(t.slice(u,a)),null!=(r=ge[i=t.charAt(++a)])?i=t.charAt(++a):r="e"===i?" ":"0",(o=e[i])&&(i=o(n,r)),s.push(i),u=a+1);return s.push(t.slice(u,a)),s.join("")}}function x(t,e){return function(n){var i,r,o=fe(1900,void 0,1);if(C(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=he(fe(o.y,0,1))).getUTCDay(),i=r>4||0===r?Xt.ceil(i):Xt(i),i=zt.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=ce(fe(o.y,0,1))).getDay(),i=r>4||0===r?Pt.ceil(i):Pt(i),i=Tt.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?he(fe(o.y,0,1)).getUTCDay():ce(fe(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,he(o)):ce(o)}}function C(t,e,n,i){for(var r,o,s=0,a=e.length,u=n.length;s<a;){if(i>=u)return-1;if(37===(r=e.charCodeAt(s++))){if(r=e.charAt(s++),!(o=k[r in ge?e.charAt(s++):r])||(i=o(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return b.x=_(n,b),b.X=_(i,b),b.c=_(e,b),w.x=_(n,w),w.X=_(i,w),w.c=_(e,w),{format:function(t){var e=_(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=x(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=_(t+="",w);return e.toString=function(){return t},e},utcParse:function(t){var e=x(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),pe=de.format,de.parse,de.utcFormat,de.utcParse;const Nn=ct(lt),Rn=Nn.right;Nn.left,ct((function(t){return null===t?NaN:+t})).center;var In=Rn,Un=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t};function jn(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Hn(){}var Fn="\\s*([+-]?\\d+)\\s*",On="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Bn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$n=/^#([0-9a-f]{3,8})$/,qn=new RegExp("^rgb\\("+[Fn,Fn,Fn]+"\\)$"),Jn=new RegExp("^rgb\\("+[Bn,Bn,Bn]+"\\)$"),Vn=new RegExp("^rgba\\("+[Fn,Fn,Fn,On]+"\\)$"),zn=new RegExp("^rgba\\("+[Bn,Bn,Bn,On]+"\\)$"),Yn=new RegExp("^hsl\\("+[On,Bn,Bn]+"\\)$"),Wn=new RegExp("^hsla\\("+[On,Bn,Bn,On]+"\\)$"),Xn={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 Kn(){return this.rgb().formatHex()}function Gn(){return this.rgb().formatRgb()}function Zn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=$n.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Qn(e):3===n?new ii(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ti(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ti(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=qn.exec(t))?new ii(e[1],e[2],e[3],1):(e=Jn.exec(t))?new ii(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Vn.exec(t))?ti(e[1],e[2],e[3],e[4]):(e=zn.exec(t))?ti(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Yn.exec(t))?ai(e[1],e[2]/100,e[3]/100,1):(e=Wn.exec(t))?ai(e[1],e[2]/100,e[3]/100,e[4]):Xn.hasOwnProperty(t)?Qn(Xn[t]):"transparent"===t?new ii(NaN,NaN,NaN,0):null}function Qn(t){return new ii(t>>16&255,t>>8&255,255&t,1)}function ti(t,e,n,i){return i<=0&&(t=e=n=NaN),new ii(t,e,n,i)}function ei(t){return t instanceof Hn||(t=Zn(t)),t?new ii((t=t.rgb()).r,t.g,t.b,t.opacity):new ii}function ni(t,e,n,i){return 1===arguments.length?ei(t):new ii(t,e,n,null==i?1:i)}function ii(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function ri(){return"#"+si(this.r)+si(this.g)+si(this.b)}function oi(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function si(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ai(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new li(t,e,n,i)}function ui(t){if(t instanceof li)return new li(t.h,t.s,t.l,t.opacity);if(t instanceof Hn||(t=Zn(t)),!t)return new li;if(t instanceof li)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),s=NaN,a=o-r,u=(o+r)/2;return a?(s=e===o?(n-i)/a+6*(n<i):n===o?(i-e)/a+2:(e-n)/a+4,a/=u<.5?o+r:2-o-r,s*=60):a=u>0&&u<1?0:s,new li(s,a,u,t.opacity)}function li(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function ci(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 hi(t,e,n,i,r){var o=t*t,s=o*t;return((1-3*t+3*o-s)*e+(4-6*o+3*s)*n+(1+3*t+3*o-3*s)*i+s*r)/6}Un(Hn,Zn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Kn,formatHex:Kn,formatHsl:function(){return ui(this).formatHsl()},formatRgb:Gn,toString:Gn}),Un(ii,ni,jn(Hn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new ii(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new ii(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:ri,formatHex:ri,formatRgb:oi,toString:oi})),Un(li,(function(t,e,n,i){return 1===arguments.length?ui(t):new li(t,e,n,null==i?1:i)}),jn(Hn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new li(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new li(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new ii(ci(t>=240?t-240:t+120,r,i),ci(t,r,i),ci(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var fi=t=>()=>t;function di(t,e){return function(n){return t+n*e}}function pi(t){return 1==(t=+t)?gi: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):fi(isNaN(e)?n:e)}}function gi(t,e){var n=e-t;return n?di(t,n):fi(isNaN(t)?e:t)}var mi=function t(e){var n=pi(e);function i(t,e){var i=n((t=ni(t)).r,(e=ni(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),s=gi(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=o(e),t.opacity=s(e),t+""}}return i.gamma=t,i}(1);function vi(t){return function(e){var n,i,r=e.length,o=new Array(r),s=new Array(r),a=new Array(r);for(n=0;n<r;++n)i=ni(e[n]),o[n]=i.r||0,s[n]=i.g||0,a[n]=i.b||0;return o=t(o),s=t(s),a=t(a),i.opacity=1,function(t){return i.r=o(t),i.g=s(t),i.b=a(t),i+""}}}vi((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],o=t[i+1],s=i>0?t[i-1]:2*r-o,a=i<e-1?t[i+2]:2*o-r;return hi((n-i/e)*e,s,r,o,a)}})),vi((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],o=t[i%e],s=t[(i+1)%e],a=t[(i+2)%e];return hi((n-i/e)*e,r,o,s,a)}}));var yi=function(t,e){e||(e=[]);var n,i=t?Math.min(e.length,t.length):0,r=e.slice();return function(o){for(n=0;n<i;++n)r[n]=t[n]*(1-o)+e[n]*o;return r}};function bi(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function wi(t,e){var n,i=e?e.length:0,r=t?Math.min(i,t.length):0,o=new Array(r),s=new Array(i);for(n=0;n<r;++n)o[n]=Si(t[n],e[n]);for(;n<i;++n)s[n]=e[n];return function(t){for(n=0;n<r;++n)s[n]=o[n](t);return s}}var ki=function(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}},_i=function(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}},xi=function(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]=Si(t[n],e[n]):r[n]=e[n];return function(t){for(n in i)r[n]=i[n](t);return r}},Ci=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ai=new RegExp(Ci.source,"g");var Ei=function(t,e){var n,i,r,o=Ci.lastIndex=Ai.lastIndex=0,s=-1,a=[],u=[];for(t+="",e+="";(n=Ci.exec(t))&&(i=Ai.exec(e));)(r=i.index)>o&&(r=e.slice(o,r),a[s]?a[s]+=r:a[++s]=r),(n=n[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,u.push({i:s,x:_i(n,i)})),o=Ai.lastIndex;return o<e.length&&(r=e.slice(o),a[s]?a[s]+=r:a[++s]=r),a.length<2?u[0]?function(t){return function(e){return t(e)+""}}(u[0].x):function(t){return function(){return t}}(e):(e=u.length,function(t){for(var n,i=0;i<e;++i)a[(n=u[i]).i]=n.x(t);return a.join("")})},Si=function(t,e){var n,i=typeof e;return null==e||"boolean"===i?fi(e):("number"===i?_i:"string"===i?(n=Zn(e))?(e=n,mi):Ei:e instanceof Zn?mi:e instanceof Date?ki:bi(e)?yi:Array.isArray(e)?wi:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?xi:_i)(t,e)},Ti=function(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}};function Mi(t){return+t}var Li=[0,1];function Pi(t){return t}function Di(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function Ni(t,e,n){var i=t[0],r=t[1],o=e[0],s=e[1];return r<i?(i=Di(r,i),o=n(s,o)):(i=Di(i,r),o=n(o,s)),function(t){return o(i(t))}}function Ri(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),o=new Array(i),s=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<i;)r[s]=Di(t[s],t[s+1]),o[s]=n(e[s],e[s+1]);return function(e){var n=In(t,e,1,i)-1;return o[n](r[n](e))}}function Ii(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Ui(){var t,e,n,i,r,o,s=Li,a=Li,u=Si,l=Pi;function c(){var t,e,n,u=Math.min(s.length,a.length);return l!==Pi&&(t=s[0],e=s[u-1],t>e&&(n=t,t=e,e=n),l=function(n){return Math.max(t,Math.min(e,n))}),i=u>2?Ri:Ni,r=o=null,h}function h(e){return null==e||isNaN(e=+e)?n:(r||(r=i(s.map(t),a,u)))(t(l(e)))}return h.invert=function(n){return l(e((o||(o=i(a,s.map(t),_i)))(n)))},h.domain=function(t){return arguments.length?(s=Array.from(t,Mi),c()):s.slice()},h.range=function(t){return arguments.length?(a=Array.from(t),c()):a.slice()},h.rangeRound=function(t){return a=Array.from(t),u=Ti,c()},h.clamp=function(t){return arguments.length?(l=!!t||Pi,c()):l!==Pi},h.interpolate=function(t){return arguments.length?(u=t,c()):u},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,i){return t=n,e=i,c()}}function ji(){return Ui()(Pi,Pi)}function Hi(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Fi(t){return new Date(t)}function Oi(t){return t instanceof Date?+t:+new Date(+t)}function Bi(t,e,n,i,r,o,s,a,u,l){var c=ji(),h=c.invert,f=c.domain,d=l(".%L"),p=l(":%S"),g=l("%I:%M"),m=l("%I %p"),v=l("%a %d"),y=l("%b %d"),b=l("%B"),w=l("%Y");function k(t){return(u(t)<t?d:a(t)<t?p:s(t)<t?g:o(t)<t?m:i(t)<t?r(t)<t?v:y:n(t)<t?b:w)(t)}return c.invert=function(t){return new Date(h(t))},c.domain=function(t){return arguments.length?f(Array.from(t,Oi)):f().map(Fi)},c.ticks=function(e){var n=f();return t(n[0],n[n.length-1],null==e?10:e)},c.tickFormat=function(t,e){return null==e?k:l(e)},c.nice=function(t){var n=f();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?f(function(t,e){var n,i=0,r=(t=t.slice()).length-1,o=t[i],s=t[r];return s<o&&(n=i,i=r,r=n,n=o,o=s,s=n),t[i]=e.floor(o),t[r]=e.ceil(s),t}(n,t)):c},c.copy=function(){return Ii(c,Bi(t,e,n,i,r,o,s,a,u,l))},c}var $i=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function qi(t){if(!(e=$i.exec(t)))throw new Error("invalid format: "+t);var e;return new Ji({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 Ji(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+""}qi.prototype=Ji.prototype,Ji.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};function Vi(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)]}var zi,Yi,Wi,Xi,Ki=function(t){return(t=Vi(Math.abs(t)))?t[1]:NaN},Gi=function(t,e){var n=Vi(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")},Zi={"%":(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)=>Gi(100*t,e),r:Gi,s:function(t,e){var n=Vi(t,e);if(!n)return t+"";var i=n[0],r=n[1],o=r-(zi=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,s=i.length;return o===s?i:o>s?i+new Array(o-s+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+Vi(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)},Qi=function(t){return t},tr=Array.prototype.map,er=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],nr=function(t){var e,n,i=void 0===t.grouping||void 0===t.thousands?Qi:(e=tr.call(t.grouping,Number),n=t.thousands+"",function(t,i){for(var r=t.length,o=[],s=0,a=e[0],u=0;r>0&&a>0&&(u+a+1>i&&(a=Math.max(1,i-u)),o.push(t.substring(r-=a,r+a)),!((u+=a+1)>i));)a=e[s=(s+1)%e.length];return o.reverse().join(n)}),r=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",s=void 0===t.decimal?".":t.decimal+"",a=void 0===t.numerals?Qi:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(tr.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=qi(t)).fill,n=t.align,h=t.sign,f=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,y=t.type;"n"===y?(g=!0,y="g"):Zi[y]||(void 0===m&&(m=12),v=!0,y="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var b="$"===f?r:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===f?o:/[%p]/.test(y)?u:"",k=Zi[y],_=/[defgprs%]/.test(y);function x(t){var r,o,u,f=b,x=w;if("c"===y)x=k(t)+x,t="";else{var C=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:k(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,i=1,r=-1;i<n;++i)switch(t[i]){case".":r=e=i;break;case"0":0===r&&(r=i),e=i;break;default:if(!+t[i])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),C&&0==+t&&"+"!==h&&(C=!1),f=(C?"("===h?h:l:"-"===h||"("===h?"":h)+f,x=("s"===y?er[8+zi/3]:"")+x+(C&&"("===h?")":""),_)for(r=-1,o=t.length;++r<o;)if(48>(u=t.charCodeAt(r))||u>57){x=(46===u?s+t.slice(r+1):t.slice(r))+x,t=t.slice(0,r);break}}g&&!d&&(t=i(t,1/0));var A=f.length+t.length+x.length,E=A<p?new Array(p-A+1).join(e):"";switch(g&&d&&(t=i(E+t,E.length?p-x.length:1/0),E=""),n){case"<":t=f+t+x+E;break;case"=":t=f+E+t+x;break;case"^":t=E.slice(0,A=E.length>>1)+f+t+x+E.slice(A);break;default:t=E+f+t+x}return a(t)}return m=void 0===m?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),x.toString=function(){return t+""},x}return{format:h,formatPrefix:function(t,e){var n=h(((t=qi(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(Ki(e)/3))),r=Math.pow(10,-i),o=er[8+i/3];return function(t){return n(r*t)+o}}}};!function(t){Yi=nr(t),Wi=Yi.format,Xi=Yi.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});function ir(t,e,n,i){var r,o=gt(t,e,n);switch((i=qi(null==i?",f":i)).type){case"s":var s=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(Ki(e)/3)))-Ki(Math.abs(t)))}(o,s))||(i.precision=r),Xi(i,s);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,Ki(e)-Ki(t))+1}(o,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,-Ki(Math.abs(t)))}(o))||(i.precision=r-2*("%"===i.type))}return Wi(i)}function rr(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){var i,r,o,s,a=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];if((i=e<t)&&(r=t,t=e,e=r),0===(s=pt(t,e,n))||!isFinite(s))return[];if(s>0){let n=Math.round(t/s),i=Math.round(e/s);for(n*s<t&&++n,i*s>e&&--i,o=new Array(r=i-n+1);++a<r;)o[a]=(n+a)*s}else{s=-s;let n=Math.round(t*s),i=Math.round(e*s);for(n/s<t&&++n,i/s>e&&--i,o=new Array(r=i-n+1);++a<r;)o[a]=(n+a)/s}return i&&o.reverse(),o}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var i=e();return ir(i[0],i[i.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var i,r,o=e(),s=0,a=o.length-1,u=o[s],l=o[a],c=10;for(l<u&&(r=u,u=l,l=r,r=s,s=a,a=r);c-- >0;){if((r=pt(u,l,n))===i)return o[s]=u,o[a]=l,e(o);if(r>0)u=Math.floor(u/r)*r,l=Math.ceil(l/r)*r;else{if(!(r<0))break;u=Math.ceil(u*r)/r,l=Math.floor(l*r)/r}i=r}return t},t}function or(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}const sr=Math.PI,ar=2*sr,ur=ar-1e-6;function lr(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function cr(){return new lr}lr.prototype=cr.prototype={constructor:lr,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,o){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+o)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var o=this._x1,s=this._y1,a=n-t,u=i-e,l=o-t,c=s-e,h=l*l+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(h>1e-6)if(Math.abs(c*a-u*l)>1e-6&&r){var f=n-o,d=i-s,p=a*a+u*u,g=f*f+d*d,m=Math.sqrt(p),v=Math.sqrt(h),y=r*Math.tan((sr-Math.acos((p+h-g)/(2*m*v)))/2),b=y/v,w=y/m;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*l)+","+(e+b*c)),this._+="A"+r+","+r+",0,0,"+ +(c*f>l*d)+","+(this._x1=t+w*a)+","+(this._y1=e+w*u)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,r,o){t=+t,e=+e,o=!!o;var s=(n=+n)*Math.cos(i),a=n*Math.sin(i),u=t+s,l=e+a,c=1^o,h=o?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+u+","+l:(Math.abs(this._x1-u)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+u+","+l),n&&(h<0&&(h=h%ar+ar),h>ur?this._+="A"+n+","+n+",0,1,"+c+","+(t-s)+","+(e-a)+"A"+n+","+n+",0,1,"+c+","+(this._x1=u)+","+(this._y1=l):h>1e-6&&(this._+="A"+n+","+n+",0,"+ +(h>=sr)+","+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._}};var hr=cr,fr=(Array.prototype.slice,function(t){return function(){return t}});function dr(t){this._context=t}dr.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 pr=function(t){return new dr(t)};function gr(t){return t[0]}function mr(t){return t[1]}var vr=function(t,e){var n=fr(!0),i=null,r=pr,o=null;function s(s){var a,u,l,c=(s=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(s)).length,h=!1;for(null==i&&(o=r(l=hr())),a=0;a<=c;++a)!(a<c&&n(u=s[a],a,s))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+t(u,a,s),+e(u,a,s));if(l)return o=null,l+""||null}return t="function"==typeof t?t:void 0===t?gr:fr(t),e="function"==typeof e?e:void 0===e?mr:fr(e),s.x=function(e){return arguments.length?(t="function"==typeof e?e:fr(+e),s):t},s.y=function(t){return arguments.length?(e="function"==typeof t?t:fr(+t),s):e},s.defined=function(t){return arguments.length?(n="function"==typeof t?t:fr(!!t),s):n},s.curve=function(t){return arguments.length?(r=t,null!=i&&(o=r(i)),s):r},s.context=function(t){return arguments.length?(null==t?i=o=null:o=r(i=t),s):i},s};function yr(){}var br=function(t){return null==t?yr:function(){return this.querySelector(t)}};function wr(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function kr(){return[]}var _r=function(t){return null==t?kr:function(){return this.querySelectorAll(t)}};var xr=function(t){return function(){return this.matches(t)}};function Cr(t){return function(e){return e.matches(t)}}var Ar=Array.prototype.find;function Er(){return this.firstElementChild}var Sr=Array.prototype.filter;function Tr(){return Array.from(this.children)}var Mr=function(t){return new Array(t.length)};function Lr(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Lr.prototype={constructor:Lr,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 Pr=function(t){return function(){return t}};function Dr(t,e,n,i,r,o){for(var s,a=0,u=e.length,l=o.length;a<l;++a)(s=e[a])?(s.__data__=o[a],i[a]=s):n[a]=new Lr(t,o[a]);for(;a<u;++a)(s=e[a])&&(r[a]=s)}function Nr(t,e,n,i,r,o,s){var a,u,l,c=new Map,h=e.length,f=o.length,d=new Array(h);for(a=0;a<h;++a)(u=e[a])&&(d[a]=l=s.call(u,u.__data__,a,e)+"",c.has(l)?r[a]=u:c.set(l,u));for(a=0;a<f;++a)l=s.call(t,o[a],a,o)+"",(u=c.get(l))?(i[a]=u,u.__data__=o[a],c.delete(l)):n[a]=new Lr(t,o[a]);for(a=0;a<h;++a)(u=e[a])&&c.get(d[a])===u&&(r[a]=u)}function Rr(t){return t.__data__}function Ir(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Ur(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var jr="http://www.w3.org/1999/xhtml",Hr={svg:"http://www.w3.org/2000/svg",xhtml:jr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},Fr=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Hr.hasOwnProperty(e)?{space:Hr[e],local:t}:t};function Or(t){return function(){this.removeAttribute(t)}}function Br(t){return function(){this.removeAttributeNS(t.space,t.local)}}function $r(t,e){return function(){this.setAttribute(t,e)}}function qr(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Jr(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function Vr(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)}}var zr=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function Yr(t){return function(){this.style.removeProperty(t)}}function Wr(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Xr(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function Kr(t,e){return t.style.getPropertyValue(e)||zr(t).getComputedStyle(t,null).getPropertyValue(e)}function Gr(t){return function(){delete this[t]}}function Zr(t,e){return function(){this[t]=e}}function Qr(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function to(t){return t.trim().split(/^|\s+/)}function eo(t){return t.classList||new no(t)}function no(t){this._node=t,this._names=to(t.getAttribute("class")||"")}function io(t,e){for(var n=eo(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function ro(t,e){for(var n=eo(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function oo(t){return function(){io(this,t)}}function so(t){return function(){ro(this,t)}}function ao(t,e){return function(){(e.apply(this,arguments)?io:ro)(this,t)}}no.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}};function uo(){this.textContent=""}function lo(t){return function(){this.textContent=t}}function co(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function ho(){this.innerHTML=""}function fo(t){return function(){this.innerHTML=t}}function po(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function go(){this.nextSibling&&this.parentNode.appendChild(this)}function mo(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function vo(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===jr&&e.documentElement.namespaceURI===jr?e.createElement(t):e.createElementNS(n,t)}}function yo(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}var bo=function(t){var e=Fr(t);return(e.local?yo:vo)(e)};function wo(){return null}function ko(){var t=this.parentNode;t&&t.removeChild(this)}function _o(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function xo(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Co(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function Ao(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,o=e.length;i<o;++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 Eo(t,e,n){return function(){var i,r=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(r)for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===t.type&&i.name===t.name)return this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),void(i.value=e);this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function So(t,e,n){var i=zr(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 To(t,e){return function(){return So(this,t,e)}}function Mo(t,e){return function(){return So(this,t,e.apply(this,arguments))}}var Lo=[null];function Po(t,e){this._groups=t,this._parents=e}function Do(){return new Po([[document.documentElement]],Lo)}Po.prototype=Do.prototype={constructor:Po,select:function(t){"function"!=typeof t&&(t=br(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o,s,a=e[r],u=a.length,l=i[r]=new Array(u),c=0;c<u;++c)(o=a[c])&&(s=t.call(o,o.__data__,c,a))&&("__data__"in o&&(s.__data__=o.__data__),l[c]=s);return new Po(i,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return wr(t.apply(this,arguments))}}(t):_r(t);for(var e=this._groups,n=e.length,i=[],r=[],o=0;o<n;++o)for(var s,a=e[o],u=a.length,l=0;l<u;++l)(s=a[l])&&(i.push(t.call(s,s.__data__,l,a)),r.push(s));return new Po(i,r)},selectChild:function(t){return this.select(null==t?Er:function(t){return function(){return Ar.call(this.children,t)}}("function"==typeof t?t:Cr(t)))},selectChildren:function(t){return this.selectAll(null==t?Tr:function(t){return function(){return Sr.call(this.children,t)}}("function"==typeof t?t:Cr(t)))},filter:function(t){"function"!=typeof t&&(t=xr(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o,s=e[r],a=s.length,u=i[r]=[],l=0;l<a;++l)(o=s[l])&&t.call(o,o.__data__,l,s)&&u.push(o);return new Po(i,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,Rr);var n=e?Nr:Dr,i=this._parents,r=this._groups;"function"!=typeof t&&(t=Pr(t));for(var o=r.length,s=new Array(o),a=new Array(o),u=new Array(o),l=0;l<o;++l){var c=i[l],h=r[l],f=h.length,d=Ir(t.call(c,c&&c.__data__,l,i)),p=d.length,g=a[l]=new Array(p),m=s[l]=new Array(p),v=u[l]=new Array(f);n(c,h,g,m,v,d,e);for(var y,b,w=0,k=0;w<p;++w)if(y=g[w]){for(w>=k&&(k=w+1);!(b=m[k])&&++k<p;);y._next=b||null}}return(s=new Po(s,i))._enter=a,s._exit=u,s},enter:function(){return new Po(this._enter||this._groups.map(Mr),this._parents)},exit:function(){return new Po(this._exit||this._groups.map(Mr),this._parents)},join:function(t,e,n){var i=this.enter(),r=this,o=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?o.remove():n(o),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,o=i.length,s=Math.min(r,o),a=new Array(r),u=0;u<s;++u)for(var l,c=n[u],h=i[u],f=c.length,d=a[u]=new Array(f),p=0;p<f;++p)(l=c[p]||h[p])&&(d[p]=l);for(;u<r;++u)a[u]=n[u];return new Po(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],o=r.length-1,s=r[o];--o>=0;)(i=r[o])&&(s&&4^i.compareDocumentPosition(s)&&s.parentNode.insertBefore(i,s),s=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=Ur);for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o){for(var s,a=n[o],u=a.length,l=r[o]=new Array(u),c=0;c<u;++c)(s=a[c])&&(l[c]=s);l.sort(e)}return new Po(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,o=i.length;r<o;++r){var s=i[r];if(s)return s}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,o=e[n],s=0,a=o.length;s<a;++s)(r=o[s])&&t.call(r,r.__data__,s,o);return this},attr:function(t,e){var n=Fr(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?Br:Or:"function"==typeof e?n.local?Vr:Jr:n.local?qr:$r)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?Yr:"function"==typeof e?Xr:Wr)(t,e,null==n?"":n)):Kr(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Gr:"function"==typeof e?Qr:Zr)(t,e)):this.node()[t]},classed:function(t,e){var n=to(t+"");if(arguments.length<2){for(var i=eo(this.node()),r=-1,o=n.length;++r<o;)if(!i.contains(n[r]))return!1;return!0}return this.each(("function"==typeof e?ao:e?oo:so)(n,e))},text:function(t){return arguments.length?this.each(null==t?uo:("function"==typeof t?co:lo)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?ho:("function"==typeof t?po:fo)(t)):this.node().innerHTML},raise:function(){return this.each(go)},lower:function(){return this.each(mo)},append:function(t){var e="function"==typeof t?t:bo(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:bo(t),i=null==e?wo:"function"==typeof e?e:br(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)}))},remove:function(){return this.each(ko)},clone:function(t){return this.select(t?xo:_o)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var i,r,o=Co(t+""),s=o.length;if(!(arguments.length<2)){for(a=e?Eo:Ao,i=0;i<s;++i)this.each(a(o[i],e,n));return this}var a=this.node().__on;if(a)for(var u,l=0,c=a.length;l<c;++l)for(i=0,u=a[l];i<s;++i)if((r=o[i]).type===u.type&&r.name===u.name)return u.value},dispatch:function(t,e){return this.each(("function"==typeof e?Mo:To)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i,r=t[e],o=0,s=r.length;o<s;++o)(i=r[o])&&(yield i)}};var No=Do,Ro={value:()=>{}};function Io(){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 Uo(i)}function Uo(t){this._=t}function jo(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function Ho(t,e){for(var n,i=0,r=t.length;i<r;++i)if((n=t[i]).name===e)return n.value}function Fo(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=Ro,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}Uo.prototype=Io.prototype={constructor:Uo,on:function(t,e){var n,i=this._,r=jo(t+"",i),o=-1,s=r.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<s;)if(n=(t=r[o]).type)i[n]=Fo(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Fo(i[n],t.name,null);return this}for(;++o<s;)if((n=(t=r[o]).type)&&(n=Ho(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Uo(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),o=0;o<n;++o)r[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(i=this._[t]).length;o<n;++o)i[o].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,o=i.length;r<o;++r)i[r].value.apply(e,n)}};var Oo,Bo,$o=Io,qo=0,Jo=0,Vo=0,zo=0,Yo=0,Wo=0,Xo="object"==typeof performance&&performance.now?performance:Date,Ko="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Go(){return Yo||(Ko(Zo),Yo=Xo.now()+Wo)}function Zo(){Yo=0}function Qo(){this._call=this._time=this._next=null}function ts(t,e,n){var i=new Qo;return i.restart(t,e,n),i}function es(){Yo=(zo=Xo.now())+Wo,qo=Jo=0;try{!function(){Go(),++qo;for(var t,e=Oo;e;)(t=Yo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--qo}()}finally{qo=0,function(){var t,e,n=Oo,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:Oo=e);Bo=t,is(i)}(),Yo=0}}function ns(){var t=Xo.now(),e=t-zo;e>1e3&&(Wo-=e,zo=t)}function is(t){qo||(Jo&&(Jo=clearTimeout(Jo)),t-Yo>24?(t<1/0&&(Jo=setTimeout(es,t-Xo.now()-Wo)),Vo&&(Vo=clearInterval(Vo))):(Vo||(zo=Xo.now(),Vo=setInterval(ns,1e3)),qo=1,Ko(es)))}Qo.prototype=ts.prototype={constructor:Qo,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Go():+n)+(null==e?0:+e),this._next||Bo===this||(Bo?Bo._next=this:Oo=this,Bo=this),this._call=t,this._time=n,is()},stop:function(){this._call&&(this._call=null,this._time=1/0,is())}};var rs=function(t,e,n){var i=new Qo;return e=null==e?0:+e,i.restart(n=>{i.stop(),t(n+e)},e,n),i},os=$o("start","end","cancel","interrupt"),ss=[],as=function(t,e,n,i,r,o){var s=t.__transition;if(s){if(n in s)return}else t.__transition={};!function(t,e,n){var i,r=t.__transition;function o(u){var l,c,h,f;if(1!==n.state)return a();for(l in r)if((f=r[l]).name===n.name){if(3===f.state)return rs(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete r[l]):+l<e&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete r[l])}if(rs((function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(u))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,i=new Array(h=n.tween.length),l=0,c=-1;l<h;++l)(f=n.tween[l].value.call(t,t.__data__,n.index,n.group))&&(i[++c]=f);i.length=c+1}}function s(e){for(var r=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(a),n.state=5,1),o=-1,s=i.length;++o<s;)i[o].call(t,r);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),a())}function a(){for(var i in n.state=6,n.timer.stop(),delete r[e],r)return;delete t.__transition}r[e]=n,n.timer=ts((function(t){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=t&&o(t-n.delay)}),0,n.time)}(t,n,{name:e,index:i,group:r,on:os,tween:ss,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})};function us(t,e){var n=cs(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function ls(t,e){var n=cs(t,e);if(n.state>3)throw new Error("too late; already running");return n}function cs(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var hs,fs=180/Math.PI,ds={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},ps=function(t,e,n,i,r,o){var s,a,u;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(u=t*n+e*i)&&(n-=t*u,i-=e*u),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,u/=a),t*i<e*n&&(t=-t,e=-e,u=-u,s=-s),{translateX:r,translateY:o,rotate:Math.atan2(e,t)*fs,skewX:Math.atan(u)*fs,scaleX:s,scaleY:a}};function gs(t,e,n,i){function r(t){return t.length?t.pop()+" ":""}return function(o,s){var a=[],u=[];return o=t(o),s=t(s),function(t,i,r,o,s,a){if(t!==r||i!==o){var u=s.push("translate(",null,e,null,n);a.push({i:u-4,x:_i(t,r)},{i:u-2,x:_i(i,o)})}else(r||o)&&s.push("translate("+r+e+o+n)}(o.translateX,o.translateY,s.translateX,s.translateY,a,u),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(r(n)+"rotate(",null,i)-2,x:_i(t,e)})):e&&n.push(r(n)+"rotate("+e+i)}(o.rotate,s.rotate,a,u),function(t,e,n,o){t!==e?o.push({i:n.push(r(n)+"skewX(",null,i)-2,x:_i(t,e)}):e&&n.push(r(n)+"skewX("+e+i)}(o.skewX,s.skewX,a,u),function(t,e,n,i,o,s){if(t!==n||e!==i){var a=o.push(r(o)+"scale(",null,",",null,")");s.push({i:a-4,x:_i(t,n)},{i:a-2,x:_i(e,i)})}else 1===n&&1===i||o.push(r(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,s.scaleX,s.scaleY,a,u),o=s=null,function(t){for(var e,n=-1,i=u.length;++n<i;)a[(e=u[n]).i]=e.x(t);return a.join("")}}}var ms=gs((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ds:ps(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),vs=gs((function(t){return null==t?ds:(hs||(hs=document.createElementNS("http://www.w3.org/2000/svg","g")),hs.setAttribute("transform",t),(t=hs.transform.baseVal.consolidate())?(t=t.matrix,ps(t.a,t.b,t.c,t.d,t.e,t.f)):ds)}),", ",")",")");function ys(t,e){var n,i;return function(){var r=ls(this,t),o=r.tween;if(o!==n)for(var s=0,a=(i=n=o).length;s<a;++s)if(i[s].name===e){(i=i.slice()).splice(s,1);break}r.tween=i}}function bs(t,e,n){var i,r;if("function"!=typeof n)throw new Error;return function(){var o=ls(this,t),s=o.tween;if(s!==i){r=(i=s).slice();for(var a={name:e,value:n},u=0,l=r.length;u<l;++u)if(r[u].name===e){r[u]=a;break}u===l&&r.push(a)}o.tween=r}}function ws(t,e,n){var i=t._id;return t.each((function(){var t=ls(this,i);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return cs(t,i).value[e]}}var ks=function(t,e){var n;return("number"==typeof e?_i:e instanceof Zn?mi:(n=Zn(e))?(e=n,mi):Ei)(t,e)};function _s(t){return function(){this.removeAttribute(t)}}function xs(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Cs(t,e,n){var i,r,o=n+"";return function(){var s=this.getAttribute(t);return s===o?null:s===i?r:r=e(i=s,n)}}function As(t,e,n){var i,r,o=n+"";return function(){var s=this.getAttributeNS(t.space,t.local);return s===o?null:s===i?r:r=e(i=s,n)}}function Es(t,e,n){var i,r,o;return function(){var s,a,u=n(this);if(null!=u)return(s=this.getAttribute(t))===(a=u+"")?null:s===i&&a===r?o:(r=a,o=e(i=s,u));this.removeAttribute(t)}}function Ss(t,e,n){var i,r,o;return function(){var s,a,u=n(this);if(null!=u)return(s=this.getAttributeNS(t.space,t.local))===(a=u+"")?null:s===i&&a===r?o:(r=a,o=e(i=s,u));this.removeAttributeNS(t.space,t.local)}}function Ts(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Ms(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Ls(t,e){var n,i;function r(){var r=e.apply(this,arguments);return r!==i&&(n=(i=r)&&Ms(t,r)),n}return r._value=e,r}function Ps(t,e){var n,i;function r(){var r=e.apply(this,arguments);return r!==i&&(n=(i=r)&&Ts(t,r)),n}return r._value=e,r}function Ds(t,e){return function(){us(this,t).delay=+e.apply(this,arguments)}}function Ns(t,e){return e=+e,function(){us(this,t).delay=e}}function Rs(t,e){return function(){ls(this,t).duration=+e.apply(this,arguments)}}function Is(t,e){return e=+e,function(){ls(this,t).duration=e}}function Us(t,e){if("function"!=typeof e)throw new Error;return function(){ls(this,t).ease=e}}function js(t,e,n){var i,r,o=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)?us:ls;return function(){var s=o(this,t),a=s.on;a!==i&&(r=(i=a).copy()).on(e,n),s.on=r}}var Hs=No.prototype.constructor;function Fs(t){return function(){this.style.removeProperty(t)}}function Os(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function Bs(t,e,n){var i,r;function o(){var o=e.apply(this,arguments);return o!==r&&(i=(r=o)&&Os(t,o,n)),i}return o._value=e,o}function $s(t){return function(e){this.textContent=t.call(this,e)}}function qs(t){var e,n;function i(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&$s(i)),e}return i._value=t,i}var Js=0;function Vs(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function zs(){return++Js}var Ys=No.prototype;Vs.prototype=function(t){return No().transition(t)}.prototype={constructor:Vs,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=br(t));for(var i=this._groups,r=i.length,o=new Array(r),s=0;s<r;++s)for(var a,u,l=i[s],c=l.length,h=o[s]=new Array(c),f=0;f<c;++f)(a=l[f])&&(u=t.call(a,a.__data__,f,l))&&("__data__"in a&&(u.__data__=a.__data__),h[f]=u,as(h[f],e,n,f,h,cs(a,n)));return new Vs(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=_r(t));for(var i=this._groups,r=i.length,o=[],s=[],a=0;a<r;++a)for(var u,l=i[a],c=l.length,h=0;h<c;++h)if(u=l[h]){for(var f,d=t.call(u,u.__data__,h,l),p=cs(u,n),g=0,m=d.length;g<m;++g)(f=d[g])&&as(f,e,n,g,d,p);o.push(d),s.push(u)}return new Vs(o,s,e,n)},selectChild:Ys.selectChild,selectChildren:Ys.selectChildren,filter:function(t){"function"!=typeof t&&(t=xr(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o,s=e[r],a=s.length,u=i[r]=[],l=0;l<a;++l)(o=s[l])&&t.call(o,o.__data__,l,s)&&u.push(o);return new Vs(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,o=Math.min(i,r),s=new Array(i),a=0;a<o;++a)for(var u,l=e[a],c=n[a],h=l.length,f=s[a]=new Array(h),d=0;d<h;++d)(u=l[d]||c[d])&&(f[d]=u);for(;a<i;++a)s[a]=e[a];return new Vs(s,this._parents,this._name,this._id)},selection:function(){return new Hs(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=zs(),i=this._groups,r=i.length,o=0;o<r;++o)for(var s,a=i[o],u=a.length,l=0;l<u;++l)if(s=a[l]){var c=cs(s,e);as(s,t,n,l,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Vs(i,this._parents,t,n)},call:Ys.call,nodes:Ys.nodes,node:Ys.node,size:Ys.size,empty:Ys.empty,each:Ys.each,on:function(t,e){var n=this._id;return arguments.length<2?cs(this.node(),n).on.on(t):this.each(js(n,t,e))},attr:function(t,e){var n=Fr(t),i="transform"===n?vs:ks;return this.attrTween(t,"function"==typeof e?(n.local?Ss:Es)(n,i,ws(this,"attr."+t,e)):null==e?(n.local?xs:_s)(n):(n.local?As:Cs)(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=Fr(t);return this.tween(n,(i.local?Ls:Ps)(i,e))},style:function(t,e,n){var i="transform"==(t+="")?ms:ks;return null==e?this.styleTween(t,function(t,e){var n,i,r;return function(){var o=Kr(this,t),s=(this.style.removeProperty(t),Kr(this,t));return o===s?null:o===n&&s===i?r:r=e(n=o,i=s)}}(t,i)).on("end.style."+t,Fs(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var i,r,o;return function(){var s=Kr(this,t),a=n(this),u=a+"";return null==a&&(this.style.removeProperty(t),u=a=Kr(this,t)),s===u?null:s===i&&u===r?o:(r=u,o=e(i=s,a))}}(t,i,ws(this,"style."+t,e))).each(function(t,e){var n,i,r,o,s="style."+e,a="end."+s;return function(){var u=ls(this,t),l=u.on,c=null==u.value[s]?o||(o=Fs(e)):void 0;l===n&&r===c||(i=(n=l).copy()).on(a,r=c),u.on=i}}(this._id,t)):this.styleTween(t,function(t,e,n){var i,r,o=n+"";return function(){var s=Kr(this,t);return s===o?null:s===i?r:r=e(i=s,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,Bs(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}}(ws(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,qs(t))},remove:function(){return this.on("end.remove",(t=this._id,function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}));var t},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i,r=cs(this.node(),n).tween,o=0,s=r.length;o<s;++o)if((i=r[o]).name===t)return i.value;return null}return this.each((null==e?ys:bs)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ds:Ns)(e,t)):cs(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Rs:Is)(e,t)):cs(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(Us(e,t)):cs(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;ls(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,i=n._id,r=n.size();return new Promise((function(o,s){var a={value:s},u={value:function(){0==--r&&o()}};n.each((function(){var n=ls(this,i),r=n.on;r!==t&&((e=(t=r).copy())._.cancel.push(a),e._.interrupt.push(a),e._.end.push(u)),n.on=e})),0===r&&o()}))},[Symbol.iterator]:Ys[Symbol.iterator]};var Ws={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Xs(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 Ks(t){var e,n=10,i=20,r=30,o=40,s=t.clientWidth,a=(e=t,"string"==typeof e?new Po([[document.querySelector(e)]],[document.documentElement]):new Po([[e]],Lo)).append("svg").attr("viewBox",[0,0,s,250]),u=a.append("g").attr("transform","translate(0,".concat(250-r,")")),l=a.append("g").attr("transform","translate(".concat(o,", 0)")),c=a.append("path").attr("fill","none").attr("stroke","#007200").attr("stroke-width",1.5).attr("stroke-linejoin","round").attr("stroke-linecap","round"),h=a.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 e=function(){return Hi.apply(Bi(ue,le,Ot,Ht,Lt,Tt,Et,Ct,_t,pe).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}().domain(function(t,e){let n,i;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=i=e):(n>e&&(n=e),i<e&&(i=e)));else{let r=-1;for(let o of t)null!=(o=e(o,++r,t))&&(void 0===n?o>=o&&(n=i=o):(n>o&&(n=o),i<o&&(i=o)))}return[n,i]}(t,(function(t){return t.date}))).range([o,s-i]),a=ut(3,e),f=function t(){var e=ji();return e.copy=function(){return Ii(e,t())},Hi.apply(e,arguments),rr(e)}().domain([0,or(t,(function(t){return or([t.processed,t.failed])}))]).range([250-r,n]).nice(),d=function(t){return ut(4,t)}(f).ticks(7),p=vr().x((function(t){return e(t.date)})).defined((function(t){return t.defined})).y((function(t){return f(t.failed)})),g=vr().x((function(t){return e(t.date)})).defined((function(t){return t.defined})).y((function(t){return f(t.processed)}));u.call(a),l.call(d),c.datum(t).attr("d",g),h.datum(t).attr("d",p)}}No.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var n,i,r,o=t.__transition,s=!0;if(o){for(r in e=null==e?null:e+"",o)(n=o[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 o[r]):s=!1;s&&delete t.__transition}}(this,t)}))},No.prototype.transition=function(t){var e,n;t instanceof Vs?(e=t._id,t=t._name):(e=zs(),(n=Ws).time=Go(),t=null==t?null:t+"");for(var i=this._groups,r=i.length,o=0;o<r;++o)for(var s,a=i[o],u=a.length,l=0;l<u;++l)(s=a[l])&&as(s,t,e,l,a,n||Xs(s,e));return new Vs(i,this._parents,t,e)};var Gs={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=Ks(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)}))}},Zs={mounted:function(){var t=[],e=Ks(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)}))}},Qs={mounted:function(){var t=this;this.el.addEventListener("change",(function(e){var n=Number(e.target.value);localStorage.setItem("refresh_interval",n),t.pushEventTo("#stats","refresh-interval",{interval:n})}));var e=Number(localStorage.getItem("refresh_interval"))||5;this.el.value=e,t.pushEventTo("#stats","refresh-interval",{interval:e})}},ta=document.querySelector("meta[name='csrf-token']").getAttribute("content"),ea=new class{constructor(t,e,n={}){if(this.unloaded=!1,!e||"Object"===e.constructor.name)throw new Error('\n a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example:\n\n import {Socket} from "phoenix"\n import LiveSocket from "phoenix_live_view"\n let liveSocket = new LiveSocket("/live", Socket, {...})\n ');this.socket=new e(t,n),this.bindingPrefix=n.bindingPrefix||"phx-",this.opts=n,this.params=C(n.params||{}),this.viewLogger=n.viewLogger,this.metadataCallbacks=n.metadata||{},this.defaults=Object.assign(A(m),n.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=A(window.location),this.hooks=n.hooks||{},this.uploaders=n.uploaders||{},this.loaderTimeout=n.loaderTimeout||1,this.localStorage=n.localStorage||window.localStorage,this.sessionStorage=n.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.domCallbacks=Object.assign({onNodeAdded:C(),onBeforeElUpdated:C()},n.dom||{}),window.addEventListener("pagehide",t=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}isProfileEnabled(){return"true"===this.sessionStorage.getItem("phx:live-socket:profiling")}isDebugEnabled(){return"true"===this.sessionStorage.getItem("phx:live-socket:debug")}enableDebug(){this.sessionStorage.setItem("phx:live-socket:debug","true")}enableProfiling(){this.sessionStorage.setItem("phx:live-socket:profiling","true")}disableDebug(){this.sessionStorage.removeItem("phx:live-socket:debug")}disableProfiling(){this.sessionStorage.removeItem("phx:live-socket:profiling")}enableLatencySim(t){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem("phx:live-socket:latency-sim",t)}disableLatencySim(){this.sessionStorage.removeItem("phx:live-socket:latency-sim")}getLatencySim(){let t=this.sessionStorage.getItem("phx:live-socket:latency-sim");return t?parseInt(t):null}getSocket(){return this.socket}connect(){let t=()=>{this.joinRootViews()&&(this.bindTopLevelEvents(),this.socket.connect())};["complete","loaded","interactive"].indexOf(document.readyState)>=0?t():document.addEventListener("DOMContentLoaded",()=>t())}disconnect(t){this.socket.disconnect(t)}triggerDOM(t,e){this.domCallbacks[t](...e)}time(t,e){if(!this.isProfileEnabled()||!console.time)return e();console.time(t);let n=e();return console.timeEnd(t),n}log(t,e,n){if(this.viewLogger){let[i,r]=n();this.viewLogger(t,e,i,r)}else if(this.isDebugEnabled()){let[i,r]=n();((t,e,n,i)=>{t.liveSocket.isDebugEnabled()&&console.log(`${t.id} ${e}: ${n} - `,i)})(t,e,i,r)}}onChannel(t,e,n){t.on(e,t=>{let e=this.getLatencySim();e?(console.log(`simulating ${e}ms of latency from server to client`),setTimeout(()=>n(t),e)):n(t)})}wrapPush(t,e,n){let i=this.getLatencySim(),r=t.joinCount;if(!i)return e.timeout?n().receive("timeout",()=>{t.joinCount!==r||t.isDestroyed()||this.reloadWithJitter(t,()=>{this.log(t,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):n();console.log(`simulating ${i}ms of latency from client to server`);let o={receives:[],receive(t,e){this.receives.push([t,e])}};return setTimeout(()=>{t.isDestroyed()||o.receives.reduce((t,[e,n])=>t.receive(e,n),n())},i),o}reloadWithJitter(t,e){t.destroy(),this.disconnect();let[n,i]=s,r=Math.floor(Math.random()*(i-n+1))+n,o=D.updateLocal(this.localStorage,window.location.pathname,"consecutive-reloads",0,t=>t+1);e?e():this.log(t,"join",()=>[`encountered ${o} consecutive reloads`]),o>10&&(this.log(t,"join",()=>["exceeded 10 consecutive reloads. Entering failsafe mode"]),r=3e4),setTimeout(()=>{this.hasPendingLink()?window.location=this.pendingLink:window.location.reload()},r)}getHookCallbacks(t){return t&&t.startsWith("Phoenix.")?H[t.split(".")[1]]:this.hooks[t]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(t){return`${this.getBindingPrefix()}${t}`}channel(t,e){return this.socket.channel(t,e)}joinRootViews(){let t=!1;return R.all(document,p+":not([data-phx-parent-id])",e=>{if(!this.getRootById(e.id)){let t=this.newRootView(e);t.setHref(this.getHref()),t.join(),e.getAttribute("data-phx-main")&&(this.main=t)}t=!0}),t}redirect(t,e){this.disconnect(),D.redirect(t,e)}replaceMain(t,e,n=null,i=this.setPendingLink(t)){let r=this.main.el,o=R.cloneNode(r,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(o,e),this.main.setRedirect(t),this.main.join(t=>{1===t&&this.commitPendingLink(i)&&(r.replaceWith(o),n&&n())})}isPhxView(t){return t.getAttribute&&null!==t.getAttribute(d)}newRootView(t,e){let n=new et(t,this,null,e);return this.roots[n.id]=n,n}owner(t,e){let n=M(t.closest(p),t=>this.getViewByEl(t));n&&e(n)}withinOwners(t,e){this.owner(t,n=>{let i=t.getAttribute(this.binding("target"));null===i?e(n,t):n.withinTargets(i,e)})}getViewByEl(t){let e=t.getAttribute("data-phx-root-id");return M(this.getRootById(e),e=>e.getDescendentByEl(t))}getRootById(t){return this.roots[t]}destroyAllViews(){for(let t in this.roots)this.roots[t].destroy(),delete this.roots[t]}destroyViewByEl(t){let e=this.getRootById(t.getAttribute("data-phx-root-id"));e&&e.destroyDescendent(t.id)}setActiveElement(t){if(this.activeElement===t)return;this.activeElement=t;let e=()=>{t===this.activeElement&&(this.activeElement=null),t.removeEventListener("mouseup",this),t.removeEventListener("touchend",this)};t.addEventListener("mouseup",e),t.addEventListener("touchend",e)}getActiveElement(){return document.activeElement===document.body?this.activeElement||document.activeElement:document.activeElement||document.body}dropActiveElement(t){this.prevActive&&t.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive.blur()}bindTopLevelEvents(){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,document.body.addEventListener("click",(function(){})),window.addEventListener("pageshow",t=>{t.persisted&&(this.getSocket().disconnect(),this.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())},!0),this.bindNav(),this.bindClicks(),this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(t,e,n,i,r,o,s)=>{let a=i.getAttribute(this.binding("key")),u=t.key&&t.key.toLowerCase();a&&a.toLowerCase()!==u||n.pushKey(i,r,e,o,{key:t.key,...this.eventMeta(e,t,i)})}),this.bind({blur:"focusout",focus:"focusin"},(t,e,n,i,r,o,s)=>{s||n.pushEvent(e,i,r,o,this.eventMeta(e,t,i))}),this.bind({blur:"blur",focus:"focus"},(t,e,n,i,r,o,s)=>{s&&"window"!==!s&&n.pushEvent(e,i,r,o,this.eventMeta(e,t,i))}),window.addEventListener("dragover",t=>t.preventDefault()),window.addEventListener("drop",t=>{t.preventDefault();let e=M(E(t.target,this.binding("drop-target")),t=>t.getAttribute(this.binding("drop-target"))),n=e&&document.getElementById(e),i=Array.from(t.dataTransfer.files||[]);n&&!n.disabled&&0!==i.length&&n.files instanceof FileList&&(j.trackFiles(n,i),n.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on("track-uploads",t=>{let e=t.target;if(!R.isUploadInput(e))return;let n=Array.from(t.detail.files||[]).filter(t=>t instanceof File||t instanceof Blob);j.trackFiles(e,n),e.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(t,e,n){let i=this.metadataCallbacks[t];return i?i(e,n):{}}setPendingLink(t){return this.linkRef++,this.pendingLink=t,this.linkRef}commitPendingLink(t){return this.linkRef===t&&(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(t,e){for(let n in t){let i=t[n];this.on(i,t=>{let i=this.binding(n),r=this.binding("window-"+n),o=t.target.getAttribute&&t.target.getAttribute(i);o?this.debounce(t.target,t,()=>{this.withinOwners(t.target,(i,r)=>{e(t,n,i,t.target,r,o,null)})}):R.all(document,`[${r}]`,i=>{let o=i.getAttribute(r);this.debounce(i,t,()=>{this.withinOwners(i,(r,s)=>{e(t,n,r,i,s,o,"window")})})})})}}bindClicks(){this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}bindClick(t,e,n){let i=this.binding(e);window.addEventListener(t,t=>{if(!this.isConnected())return;let e=null;e=n?t.target.matches(`[${i}]`)?t.target:t.target.querySelector(`[${i}]`):E(t.target,i);let r=e&&e.getAttribute(i);r&&("#"===e.getAttribute("href")&&t.preventDefault(),this.debounce(e,t,()=>{this.withinOwners(e,(n,i)=>{n.pushEvent("click",e,i,r,this.eventMeta("click",t,e))})}))},n)}bindNav(){if(!D.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let t=null;window.addEventListener("scroll",e=>{clearTimeout(t),t=setTimeout(()=>{D.updateCurrentState(t=>Object.assign(t,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:e,id:n,root:i,scroll:r}=t.state||{},o=window.location.href;this.main.isConnected()&&"patch"===e&&n===this.main.id?this.main.pushLinkPatch(o,null):this.replaceMain(o,null,()=>{i&&this.replaceRootHistory(),"number"==typeof r&&setTimeout(()=>{window.scrollTo(0,r)},0)})},!1),window.addEventListener("click",t=>{let e=E(t.target,"data-phx-link"),n=e&&e.getAttribute("data-phx-link"),i=t.metaKey||t.ctrlKey||1===t.button;if(!n||!this.isConnected()||!this.main||i)return;let r=e.href,o=e.getAttribute("data-phx-link-state");if(t.preventDefault(),this.pendingLink!==r)if("patch"===n)this.pushHistoryPatch(r,o,e);else{if("redirect"!==n)throw new Error('expected data-phx-link to be "patch" or "redirect", got: '+n);this.historyRedirect(r,o)}},!1)}withPageLoading(t,e){R.dispatchEvent(window,"phx:page-loading-start",t);let n=()=>R.dispatchEvent(window,"phx:page-loading-stop",t);return e?e(n):n}pushHistoryPatch(t,e,n){this.withPageLoading({to:t,kind:"patch"},i=>{this.main.pushLinkPatch(t,n,n=>{this.historyPatch(t,e,n),i()})})}historyPatch(t,e,n=this.setPendingLink(t)){this.commitPendingLink(n)&&(D.pushState(e,{type:"patch",id:this.main.id},t),this.registerNewLocation(window.location))}historyRedirect(t,e,n){let i=window.scrollY;this.withPageLoading({to:t,kind:"redirect"},r=>{this.replaceMain(t,n,()=>{D.pushState(e,{type:"redirect",id:this.main.id,scroll:i},t),this.registerNewLocation(window.location),r()})})}replaceRootHistory(){D.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(t){let{pathname:e,search:n}=this.currentLocation;return e+n!==t.pathname+t.search&&(this.currentLocation=A(t),!0)}bindForms(){let t=0;this.on("submit",t=>{let e=t.target.getAttribute(this.binding("submit"));e&&(t.preventDefault(),t.target.disabled=!0,this.withinOwners(t.target,(n,i)=>n.submitForm(t.target,i,e)))},!1);for(let e of["change","input"])this.on(e,n=>{let i=n.target,r=i.form&&i.form.getAttribute(this.binding("change"));if(!r)return;if("number"===i.type&&i.validity&&i.validity.badInput)return;let o=t;t++;let{at:s,type:a}=R.private(i,"prev-iteration")||{};s===o-1&&e!==a||(R.putPrivate(i,"prev-iteration",{at:o,type:e}),this.debounce(i,n,()=>{this.withinOwners(i.form,(t,e)=>{R.putPrivate(i,"phx-has-focused",!0),R.isTextualInput(i)||this.setActiveElement(i),t.pushInput(i,e,r,n.target)})}))},!1)}debounce(t,e,n){let i=this.binding("debounce"),r=this.binding("throttle"),o=this.defaults.debounce.toString(),s=this.defaults.throttle.toString();R.debounce(t,e,i,o,r,s,n)}silenceEvents(t){this.silenced=!0,t(),this.silenced=!1}on(t,e){window.addEventListener(t,t=>{this.silenced||e(t)})}}("/live",i.Socket,{params:{_csrf_token:ta},hooks:{Table:{mounted:function(){var t=this.el,e=t.querySelector(".js-hidden-submit"),n=t.querySelector(".js-submit-button");t.querySelector(".js-select-all-rows").addEventListener("change",(function(){var e=this;t.querySelectorAll(".js-select-row").forEach((function(t){t.checked=e.checked}))})),t.querySelectorAll(".js-action").forEach((function(t){t.addEventListener("click",(function(){e.value=this.dataset.name,n.click()}))}))}},RealtimePlot:Gs,HistoricalPlot:Zs,Refresh:Qs}});o.a.config({barColors:{0:"#B5179E"},shadowColor:"rgba(0, 0, 0, .3)"}),window.addEventListener("phx:page-loading-start",(function(t){return o.a.show()})),window.addEventListener("phx:page-loading-stop",(function(t){return o.a.hide()})),ea.connect(),window.liveSocket=ea}]);