Current section
Files
Jump to
Current section
Files
priv/static/assets/app.js
(()=>{var Bt=Object.create;var Ie=Object.defineProperty;var Jt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames,it=Object.getOwnPropertySymbols,Xt=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable;var st=(e,t,i)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ie=(e,t)=>{for(var i in t||(t={}))nt.call(t,i)&&st(e,i,t[i]);if(it)for(var i of it(t))Wt.call(t,i)&&st(e,i,t[i]);return e};var qt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var zt=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Vt(t))!nt.call(e,n)&&n!==i&&Ie(e,n,{get:()=>t[n],enumerable:!(s=Jt(t,n))||s.enumerable});return e};var Kt=(e,t,i)=>(i=e!=null?Bt(Xt(e)):{},zt(t||!e||!e.__esModule?Ie(i,"default",{value:e,enumerable:!0}):i,e));var lt=qt((He,at)=>{(function(e,t){typeof define=="function"&&define.amd?define(t):typeof He=="object"?at.exports=t():e.NProgress=t()})(He,function(){var e={};e.version="0.2.0";var t=e.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};e.configure=function(h){var f,v;for(f in h)v=h[f],v!==void 0&&h.hasOwnProperty(f)&&(t[f]=v);return this},e.status=null,e.set=function(h){var f=e.isStarted();h=i(h,t.minimum,1),e.status=h===1?null:h;var v=e.render(!f),m=v.querySelector(t.barSelector),k=t.speed,E=t.easing;return v.offsetWidth,r(function(C){t.positionUsing===""&&(t.positionUsing=e.getPositioningCSS()),o(m,n(h,k,E)),h===1?(o(v,{transition:"none",opacity:1}),v.offsetWidth,setTimeout(function(){o(v,{transition:"all "+k+"ms linear",opacity:0}),setTimeout(function(){e.remove(),C()},k)},k)):setTimeout(C,k)}),this},e.isStarted=function(){return typeof e.status=="number"},e.start=function(){e.status||e.set(0);var h=function(){setTimeout(function(){!e.status||(e.trickle(),h())},t.trickleSpeed)};return t.trickle&&h(),this},e.done=function(h){return!h&&!e.status?this:e.inc(.3+.5*Math.random()).set(1)},e.inc=function(h){var f=e.status;return f?(typeof h!="number"&&(h=(1-f)*i(Math.random()*f,.1,.95)),f=i(f+h,0,.994),e.set(f)):e.start()},e.trickle=function(){return e.inc(Math.random()*t.trickleRate)},function(){var h=0,f=0;e.promise=function(v){return!v||v.state()==="resolved"?this:(f===0&&e.start(),h++,f++,v.always(function(){f--,f===0?(h=0,e.done()):e.set((h-f)/h)}),this)}}(),e.render=function(h){if(e.isRendered())return document.getElementById("nprogress");l(document.documentElement,"nprogress-busy");var f=document.createElement("div");f.id="nprogress",f.innerHTML=t.template;var v=f.querySelector(t.barSelector),m=h?"-100":s(e.status||0),k=document.querySelector(t.parent),E;return o(v,{transition:"all 0 linear",transform:"translate3d("+m+"%,0,0)"}),t.showSpinner||(E=f.querySelector(t.spinnerSelector),E&&p(E)),k!=document.body&&l(k,"nprogress-custom-parent"),k.appendChild(f),f},e.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(t.parent),"nprogress-custom-parent");var h=document.getElementById("nprogress");h&&p(h)},e.isRendered=function(){return!!document.getElementById("nprogress")},e.getPositioningCSS=function(){var h=document.body.style,f="WebkitTransform"in h?"Webkit":"MozTransform"in h?"Moz":"msTransform"in h?"ms":"OTransform"in h?"O":"";return f+"Perspective"in h?"translate3d":f+"Transform"in h?"translate":"margin"};function i(h,f,v){return h<f?f:h>v?v:h}function s(h){return(-1+h)*100}function n(h,f,v){var m;return t.positionUsing==="translate3d"?m={transform:"translate3d("+s(h)+"%,0,0)"}:t.positionUsing==="translate"?m={transform:"translate("+s(h)+"%,0)"}:m={"margin-left":s(h)+"%"},m.transition="all "+f+"ms "+v,m}var r=function(){var h=[];function f(){var v=h.shift();v&&v(f)}return function(v){h.push(v),h.length==1&&f()}}(),o=function(){var h=["Webkit","O","Moz","ms"],f={};function v(C){return C.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(c,S){return S.toUpperCase()})}function m(C){var c=document.body.style;if(C in c)return C;for(var S=h.length,O=C.charAt(0).toUpperCase()+C.slice(1),I;S--;)if(I=h[S]+O,I in c)return I;return C}function k(C){return C=v(C),f[C]||(f[C]=m(C))}function E(C,c,S){c=k(c),C.style[c]=S}return function(C,c){var S=arguments,O,I;if(S.length==2)for(O in c)I=c[O],I!==void 0&&c.hasOwnProperty(O)&&E(C,O,I);else E(C,S[1],S[2])}}();function a(h,f){var v=typeof h=="string"?h:g(h);return v.indexOf(" "+f+" ")>=0}function l(h,f){var v=g(h),m=v+f;a(v,f)||(h.className=m.substring(1))}function u(h,f){var v=g(h),m;!a(h,f)||(m=v.replace(" "+f+" "," "),h.className=m.substring(1,m.length-1))}function g(h){return(" "+(h.className||"")+" ").replace(/\s+/gi," ")}function p(h){h&&h.parentNode&&h.parentNode.removeChild(h)}return e})});(function(){var e=t();function t(){if(typeof window.CustomEvent=="function")return window.CustomEvent;function n(r,o){o=o||{bubbles:!1,cancelable:!1,detail:void 0};var a=document.createEvent("CustomEvent");return a.initCustomEvent(r,o.bubbles,o.cancelable,o.detail),a}return n.prototype=window.Event.prototype,n}function i(n,r){var o=document.createElement("input");return o.type="hidden",o.name=n,o.value=r,o}function s(n,r){var o=n.getAttribute("data-to"),a=i("_method",n.getAttribute("data-method")),l=i("_csrf_token",n.getAttribute("data-csrf")),u=document.createElement("form"),g=n.getAttribute("target");u.method=n.getAttribute("data-method")==="get"?"get":"post",u.action=o,u.style.display="hidden",g?u.target=g:r&&(u.target="_blank"),u.appendChild(l),u.appendChild(a),document.body.appendChild(u),u.submit()}window.addEventListener("click",function(n){var r=n.target;if(!n.defaultPrevented)for(;r&&r.getAttribute;){var o=new e("phoenix.link.click",{bubbles:!0,cancelable:!0});if(!r.dispatchEvent(o))return n.preventDefault(),n.stopImmediatePropagation(),!1;if(r.getAttribute("data-method"))return s(r,n.metaKey||n.shiftKey),n.preventDefault(),!1;r=r.parentNode}},!1),window.addEventListener("phoenix.link.click",function(n){var r=n.target.getAttribute("data-confirm");r&&!window.confirm(r)&&n.preventDefault()},!1)})();var ne=e=>typeof e=="function"?e:function(){return e},Gt=typeof self!="undefined"?self:null,se=typeof window!="undefined"?window:null,re=Gt||se||re,Yt="2.0.0",M={connecting:0,open:1,closing:2,closed:3},Qt=1e4,Zt=1e3,L={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},B={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Ne={longpoll:"longpoll",websocket:"websocket"},ei={complete:4},be=class{constructor(e,t,i,s){this.channel=e,this.event=t,this.payload=i||function(){return{}},this.receivedResp=null,this.timeout=s,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:i}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t))}cancelRefEvent(){!this.refEvent||this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},rt=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},ti=class{constructor(e,t,i){this.state=L.closed,this.topic=e,this.params=ne(t||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new be(this,B.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new rt(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=L.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=L.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=L.closed,this.socket.remove(this)}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=L.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new be(this,B.leave,ne({}),this.timeout).send(),this.state=L.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(B.reply,(s,n)=>{this.trigger(this.replyEventName(n),s)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(B.close,e)}onError(e){return this.on(B.error,t=>e(t))}on(e,t){let i=this.bindingRef++;return this.bindings.push({event:e,ref:i,callback:t}),i}off(e,t){this.bindings=this.bindings.filter(i=>!(i.event===e&&(typeof t=="undefined"||t===i.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,i=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let s=new be(this,e,function(){return t},i);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=L.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(B.close,"leave")},i=new be(this,B.leave,ne({}),e);return i.receive("ok",()=>t()).receive("timeout",()=>t()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,i){return t}isMember(e,t,i,s){return this.topic!==e?!1:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:i,joinRef:s}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=L.joining,this.joinPush.resend(e))}trigger(e,t,i,s){let n=this.onMessage(e,t,i,s);if(t&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(o=>o.event===e);for(let o=0;o<r.length;o++)r[o].callback(n,i,s||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===L.closed}isErrored(){return this.state===L.errored}isJoined(){return this.state===L.joined}isJoining(){return this.state===L.joining}isLeaving(){return this.state===L.leaving}},Se=class{static request(e,t,i,s,n,r,o){if(re.XDomainRequest){let a=new re.XDomainRequest;return this.xdomainRequest(a,e,t,s,n,r,o)}else{let a=new re.XMLHttpRequest;return this.xhrRequest(a,e,t,i,s,n,r,o)}}static xdomainRequest(e,t,i,s,n,r,o){return e.timeout=n,e.open(t,i),e.onload=()=>{let a=this.parseJSON(e.responseText);o&&o(a)},r&&(e.ontimeout=r),e.onprogress=()=>{},e.send(s),e}static xhrRequest(e,t,i,s,n,r,o,a){return e.open(t,i,!0),e.timeout=r,e.setRequestHeader("Content-Type",s),e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(e.readyState===ei.complete&&a){let l=this.parseJSON(e.responseText);a(l)}},o&&(e.ontimeout=o),e.send(n),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch(t){return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let i=[];for(var s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let n=t?`${t}[${s}]`:s,r=e[s];typeof r=="object"?i.push(this.serialize(r,n)):i.push(encodeURIComponent(n)+"="+encodeURIComponent(r))}return i.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let i=e.match(/\?/)?"&":"?";return`${e}${i}${this.serialize(t)}`}},Oe=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=M.connecting,this.poll()}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Ne.websocket),"$1/"+Ne.longpoll)}endpointURL(){return Se.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,i){this.close(e,t,i),this.readyState=M.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===M.open||this.readyState===M.connecting}poll(){this.ajax("GET",null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:i,messages:s}=e;this.token=i}else t=0;switch(t){case 200:s.forEach(n=>{setTimeout(()=>this.onmessage({data:n}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=M.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){this.ajax("POST",e,()=>this.onerror("timeout"),t=>{(!t||t.status!==200)&&(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,i){for(let n of this.reqs)n.abort();this.readyState=M.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:i});typeof CloseEvent!="undefined"?this.onclose(new CloseEvent("close",s)):this.onclose(s)}ajax(e,t,i,s){let n,r=()=>{this.reqs.delete(n),i()};n=Se.request(e,this.endpointURL(),"application/json",t,this.timeout,r,o=>{this.reqs.delete(n),this.isActive()&&s(o)}),this.reqs.add(n)}};var ye={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(i))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[i,s,n,r,o]=JSON.parse(e);return t({join_ref:i,ref:s,topic:n,event:r,payload:o})}},binaryEncode(e){let{join_ref:t,ref:i,event:s,topic:n,payload:r}=e,o=this.META_LENGTH+t.length+i.length+n.length+s.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,i.length),l.setUint8(u++,n.length),l.setUint8(u++,s.length),Array.from(t,p=>l.setUint8(u++,p.charCodeAt(0))),Array.from(i,p=>l.setUint8(u++,p.charCodeAt(0))),Array.from(n,p=>l.setUint8(u++,p.charCodeAt(0))),Array.from(s,p=>l.setUint8(u++,p.charCodeAt(0)));var g=new Uint8Array(a.byteLength+r.byteLength);return g.set(new Uint8Array(a),0),g.set(new Uint8Array(r),a.byteLength),g.buffer},binaryDecode(e){let t=new DataView(e),i=t.getUint8(0),s=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(e,t,s);case this.KINDS.reply:return this.decodeReply(e,t,s);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,s)}},decodePush(e,t,i){let s=t.getUint8(1),n=t.getUint8(2),r=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=i.decode(e.slice(o,o+s));o=o+s;let l=i.decode(e.slice(o,o+n));o=o+n;let u=i.decode(e.slice(o,o+r));o=o+r;let g=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:l,event:u,payload:g}},decodeReply(e,t,i){let s=t.getUint8(1),n=t.getUint8(2),r=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=i.decode(e.slice(a,a+s));a=a+s;let u=i.decode(e.slice(a,a+n));a=a+n;let g=i.decode(e.slice(a,a+r));a=a+r;let p=i.decode(e.slice(a,a+o));a=a+o;let h=e.slice(a,e.byteLength),f={status:p,response:h};return{join_ref:l,ref:u,topic:g,event:B.reply,payload:f}},decodeBroadcast(e,t,i){let s=t.getUint8(1),n=t.getUint8(2),r=this.HEADER_LENGTH+2,o=i.decode(e.slice(r,r+s));r=r+s;let a=i.decode(e.slice(r,r+n));r=r+n;let l=e.slice(r,e.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},ot=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||Qt,this.transport=t.transport||re.WebSocket||Oe,this.establishedConnections=0,this.defaultEncoder=ye.encode.bind(ye),this.defaultDecoder=ye.decode.bind(ye),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==Oe?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;se&&se.addEventListener&&(se.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock)}),se.addEventListener("pageshow",s=>{i===this.connectClock&&(i=null,this.connect())})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=ne(t.params||{}),this.endPoint=`${e}/${Ne.websocket}`,this.vsn=t.vsn||Yt,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new rt(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return Oe}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.sendBuffer=[],this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Se.appendParams(Se.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,i){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(e,t,i)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=ne(e)),!this.conn&&(this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t))}log(e,t,i){this.logger(e,t,i)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),i=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let s=this.onMessage(n=>{n.ref===t&&(this.off([s]),e(Date.now()-i))});return!0}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.abnormalClose("heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearTimeout(this.heartbeatTimer),setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,i){if(!this.conn)return e&&e();this.waitForBufferDone(()=>{this.conn&&(t?this.conn.close(t,i||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1)},150*t)}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===M.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1)},150*t)}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),clearTimeout(this.heartbeatTimer),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,i])=>i(e))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,i=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,s])=>{s(e,t,i)}),(t===this.transport||i>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(B.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case M.connecting:return"connecting";case M.open:return"open";case M.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t.joinRef()!==e.joinRef())}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([i])=>e.indexOf(i)===-1)}channel(e,t={}){let i=new ti(e,t,this);return this.channels.push(i),i}push(e){if(this.hasLogger()){let{topic:t,event:i,payload:s,ref:n,join_ref:r}=e;this.log("push",`${t} ${i} (${r}, ${n})`,s)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}abnormalClose(e){this.closeWasClean=!1,this.isConnected()&&this.conn.close(Zt,e)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:i,event:s,payload:n,ref:r,join_ref:o}=t;r&&r===this.pendingHeartbeatRef&&(clearTimeout(this.heartbeatTimer),this.pendingHeartbeatRef=null,setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${n.status||""} ${i} ${s} ${r&&"("+r+")"||""}`,n);for(let a=0;a<this.channels.length;a++){let l=this.channels[a];!l.isMember(i,s,n,o)||l.trigger(s,n,r,o)}for(let a=0;a<this.stateChangeCallbacks.message.length;a++){let[,l]=this.stateChangeCallbacks.message[a];l(t)}})}leaveOpenTopic(e){let t=this.channels.find(i=>i.topic===e&&(i.isJoined()||i.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};var Ze=Kt(lt());var Rt="consecutive-reloads",ii=10,si=5e3,ni=1e4,ri=3e4,Lt=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading"],D="data-phx-component",Me="data-phx-link",oi="track-static",ai="data-phx-link-state",F="data-phx-ref",Y="data-phx-ref-src",xt="track-uploads",Q="data-phx-upload-ref",Ye="data-phx-preflighted-refs",li="data-phx-done-refs",ht="drop-target",Xe="data-phx-active-refs",We="phx:live-file:updated",qe="data-phx-skip",dt="data-phx-prune",ct="page-loading",ut="phx-connected",Ue="phx-loading",ft="phx-no-feedback",pt="phx-error",ee="data-phx-parent-id",Qe="data-phx-main",fe="data-phx-root-id",hi="trigger-action",ze="feedback-for",Dt="phx-has-focused",di=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],It=["checkbox","radio"],Ot="phx-has-submitted",K="data-phx-session",te=`[${K}]`,gt="data-phx-sticky",ce="data-phx-static",je="data-phx-readonly",we="data-phx-disabled",Ke="disable-with",ke="data-phx-disable-with-restore",oe="hook",ci="debounce",ui="throttle",Ge="update",fi="key",U="phxPrivate",vt="auto-recover",Ae="phx:live-socket:debug",$e="phx:live-socket:profiling",Fe="phx:live-socket:latency-sim",pi="progress",gi=1,vi=200,mi="phx-",bi=3e4,ae="debounce-trigger",Ce="throttled",mt="debounce-prev-key",yi={debounce:300,throttle:300},bt="d",j="s",x="c",yt="e",St="r",wt="t",Si="p",wi=class{constructor(e,t,i){this.liveSocket=i,this.entry=e,this.offset=0,this.chunkSize=t,this.chunkTimer=null,this.uploadChannel=i.channel(`lvu:${e.ref}`,{token:e.metadata()})}error(e){clearTimeout(this.chunkTimer),this.uploadChannel.leave(),this.entry.error(e)}upload(){this.uploadChannel.onError(e=>this.error(e)),this.uploadChannel.join().receive("ok",e=>this.readNextChunk()).receive("error",e=>this.error(e))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let e=new window.FileReader,t=this.entry.file.slice(this.offset,this.chunkSize+this.offset);e.onload=i=>{if(i.target.error===null)this.offset+=i.target.result.byteLength,this.pushChunk(i.target.result);else return P("Read error: "+i.target.error)},e.readAsArrayBuffer(t)}pushChunk(e){!this.uploadChannel.isJoined()||this.uploadChannel.push("chunk",e).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))})}},P=(e,t)=>console.error&&console.error(e,t),z=e=>{let t=typeof e;return t==="number"||t==="string"&&/^(0|[1-9]\d*)$/.test(e)};function ki(){let e=new Set,t=document.querySelectorAll("*[id]");for(let i=0,s=t.length;i<s;i++)e.has(t[i].id)?console.error(`Multiple IDs detected: ${t[i].id}. Ensure unique element ids.`):e.add(t[i].id)}var Ai=(e,t,i,s)=>{e.liveSocket.isDebugEnabled()&&console.log(`${e.id} ${t}: ${i} - `,s)},Be=e=>typeof e=="function"?e:function(){return e},Re=e=>JSON.parse(JSON.stringify(e)),ue=(e,t,i)=>{do{if(e.matches(`[${t}]`))return e;e=e.parentElement||e.parentNode}while(e!==null&&e.nodeType===1&&!(i&&i.isSameNode(e)||e.matches(te)));return null},le=e=>e!==null&&typeof e=="object"&&!(e instanceof Array),Ci=(e,t)=>JSON.stringify(e)===JSON.stringify(t),kt=e=>{for(let t in e)return!1;return!0},J=(e,t)=>e&&t(e),Ei=function(e,t,i,s){e.forEach(n=>{new wi(n,i.config.chunk_size,s).upload()})},Nt={canPushState(){return typeof history.pushState!="undefined"},dropLocal(e,t,i){return e.removeItem(this.localKey(t,i))},updateLocal(e,t,i,s,n){let r=this.getLocal(e,t,i),o=this.localKey(t,i),a=r===null?s:n(r);return e.setItem(o,JSON.stringify(a)),a},getLocal(e,t,i){return JSON.parse(e.getItem(this.localKey(t,i)))},updateCurrentState(e){!this.canPushState()||history.replaceState(e(history.state||{}),"",window.location.href)},pushState(e,t,i){if(this.canPushState()){if(i!==window.location.href){if(t.type=="redirect"&&t.scroll){let n=history.state||{};n.scroll=t.scroll,history.replaceState(n,"",window.location.href)}delete t.scroll,history[e+"State"](t,"",i||null);let s=this.getHashTargetEl(window.location.hash);s?s.scrollIntoView():t.type==="redirect"&&window.scroll(0,0)}}else this.redirect(i)},setCookie(e,t){document.cookie=`${e}=${t}`},getCookie(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${e}s*=s*([^;]*).*$)|^.*$`),"$1")},redirect(e,t){t&&Nt.setCookie("__phoenix_flash__",t+"; max-age=60000; path=/"),window.location=e},localKey(e,t){return`${e}-${t}`},getHashTargetEl(e){let t=e.toString().substring(1);if(t!=="")return document.getElementById(t)||document.querySelector(`a[name="${t}"]`)}},q=Nt,H={byId(e){return document.getElementById(e)||P(`no id found for ${e}`)},removeClass(e,t){e.classList.remove(t),e.classList.length===0&&e.removeAttribute("class")},all(e,t,i){if(!e)return[];let s=Array.from(e.querySelectorAll(t));return i?s.forEach(i):s},childNodeLength(e){let t=document.createElement("template");return t.innerHTML=e,t.content.childElementCount},isUploadInput(e){return e.type==="file"&&e.getAttribute(Q)!==null},findUploadInputs(e){return this.all(e,`input[type="file"][${Q}]`)},findComponentNodeList(e,t){return this.filterWithinSameLiveView(this.all(e,`[${D}="${t}"]`),e)},isPhxDestroyed(e){return!!(e.id&&H.private(e,"destroyed"))},markPhxChildDestroyed(e){this.isPhxChild(e)&&e.setAttribute(K,""),this.putPrivate(e,"destroyed",!0)},findPhxChildrenInFragment(e,t){let i=document.createElement("template");return i.innerHTML=e,this.findPhxChildren(i.content,t)},isIgnored(e,t){return(e.getAttribute(t)||e.getAttribute("data-phx-update"))==="ignore"},isPhxUpdate(e,t,i){return e.getAttribute&&i.indexOf(e.getAttribute(t))>=0},findPhxSticky(e){return this.all(e,`[${gt}]`)},findPhxChildren(e,t){return this.all(e,`${te}[${ee}="${t}"]`)},findParentCIDs(e,t){let i=new Set(t);return t.reduce((s,n)=>{let r=`[${D}="${n}"] [${D}]`;return this.filterWithinSameLiveView(this.all(e,r),e).map(o=>parseInt(o.getAttribute(D))).forEach(o=>s.delete(o)),s},i)},filterWithinSameLiveView(e,t){return t.querySelector(te)?e.filter(i=>this.withinSameLiveView(i,t)):e},withinSameLiveView(e,t){for(;e=e.parentNode;){if(e.isSameNode(t))return!0;if(e.getAttribute(K)!==null)return!1}},private(e,t){return e[U]&&e[U][t]},deletePrivate(e,t){e[U]&&delete e[U][t]},putPrivate(e,t,i){e[U]||(e[U]={}),e[U][t]=i},updatePrivate(e,t,i,s){let n=this.private(e,t);n===void 0?this.putPrivate(e,t,s(i)):this.putPrivate(e,t,s(n))},copyPrivates(e,t){t[U]&&(e[U]=t[U])},putTitle(e){let t=document.querySelector("title"),{prefix:i,suffix:s}=t.dataset;document.title=`${i||""}${e}${s||""}`},debounce(e,t,i,s,n,r,o,a){let l=e.getAttribute(i),u=e.getAttribute(n);l===""&&(l=s),u===""&&(u=r);let g=l||u;switch(g){case null:return a();case"blur":this.once(e,"debounce-blur")&&e.addEventListener("blur",()=>a());return;default:let p=parseInt(g),h=()=>u?this.deletePrivate(e,Ce):a(),f=this.incCycle(e,ae,h);if(isNaN(p))return P(`invalid throttle/debounce value: ${g}`);if(u){let m=!1;if(t.type==="keydown"){let k=this.private(e,mt);this.putPrivate(e,mt,t.key),m=k!==t.key}if(!m&&this.private(e,Ce))return!1;a(),this.putPrivate(e,Ce,!0),setTimeout(()=>{o()&&this.triggerCycle(e,ae)},p)}else setTimeout(()=>{o()&&this.triggerCycle(e,ae,f)},p);let v=e.form;v&&this.once(v,"bind-debounce")&&v.addEventListener("submit",()=>{Array.from(new FormData(v).entries(),([m])=>{let k=v.querySelector(`[name="${m}"]`);this.incCycle(k,ae),this.deletePrivate(k,Ce)})}),this.once(e,"bind-debounce")&&e.addEventListener("blur",()=>this.triggerCycle(e,ae))}},triggerCycle(e,t,i){let[s,n]=this.private(e,t);i||(i=s),i===s&&(this.incCycle(e,t),n())},once(e,t){return this.private(e,t)===!0?!1:(this.putPrivate(e,t,!0),!0)},incCycle(e,t,i=function(){}){let[s]=this.private(e,t)||[0,i];return s++,this.putPrivate(e,t,[s,i]),s},discardError(e,t,i){let s=t.getAttribute&&t.getAttribute(i),n=s&&e.querySelector(`[id="${s}"], [name="${s}"]`);!n||this.private(n,Dt)||this.private(n.form,Ot)||t.classList.add(ft)},showError(e,t){(e.id||e.name)&&this.all(e.form,`[${t}="${e.id}"], [${t}="${e.name}"]`,i=>{this.removeClass(i,ft)})},isPhxChild(e){return e.getAttribute&&e.getAttribute(ee)},isPhxSticky(e){return e.getAttribute&&e.getAttribute(gt)!==null},firstPhxChild(e){return this.isPhxChild(e)?e:this.all(e,`[${ee}]`)[0]},dispatchEvent(e,t,i={}){let n={bubbles:i.bubbles===void 0?!0:!!i.bubbles,cancelable:!0,detail:i.detail||{}},r=t==="click"?new MouseEvent("click",n):new CustomEvent(t,n);e.dispatchEvent(r)},cloneNode(e,t){if(typeof t=="undefined")return e.cloneNode(!0);{let i=e.cloneNode(!1);return i.innerHTML=t,i}},mergeAttrs(e,t,i={}){let s=i.exclude||[],n=i.isIgnored,r=t.attributes;for(let a=r.length-1;a>=0;a--){let l=r[a].name;s.indexOf(l)<0&&e.setAttribute(l,t.getAttribute(l))}let o=e.attributes;for(let a=o.length-1;a>=0;a--){let l=o[a].name;n?l.startsWith("data-")&&!t.hasAttribute(l)&&e.removeAttribute(l):t.hasAttribute(l)||e.removeAttribute(l)}},mergeFocusedInput(e,t){e instanceof HTMLSelectElement||H.mergeAttrs(e,t,{exclude:["value"]}),t.readOnly?e.setAttribute("readonly",!0):e.removeAttribute("readonly")},hasSelectionRange(e){return e.setSelectionRange&&(e.type==="text"||e.type==="textarea")},restoreFocus(e,t,i){if(!H.isTextualInput(e))return;let s=e.matches(":focus");e.readOnly&&e.blur(),s||e.focus(),this.hasSelectionRange(e)&&e.setSelectionRange(t,i)},isFormInput(e){return/^(?:input|select|textarea)$/i.test(e.tagName)&&e.type!=="button"},syncAttrsToProps(e){e instanceof HTMLInputElement&&It.indexOf(e.type.toLocaleLowerCase())>=0&&(e.checked=e.getAttribute("checked")!==null)},isTextualInput(e){return di.indexOf(e.type)>=0},isNowTriggerFormExternal(e,t){return e.getAttribute&&e.getAttribute(t)!==null},syncPendingRef(e,t,i){let s=e.getAttribute(F);if(s===null)return!0;let n=e.getAttribute(Y);return H.isFormInput(e)||e.getAttribute(i)!==null?(H.isUploadInput(e)&&H.mergeAttrs(e,t,{isIgnored:!0}),H.putPrivate(e,F,t),!1):(Lt.forEach(r=>{e.classList.contains(r)&&t.classList.add(r)}),t.setAttribute(F,s),t.setAttribute(Y,n),!0)},cleanChildNodes(e,t){if(H.isPhxUpdate(e,t,["append","prepend"])){let i=[];e.childNodes.forEach(s=>{s.id||(s.nodeType===Node.TEXT_NODE&&s.nodeValue.trim()===""||P(`only HTML element tags with an id are allowed inside containers with phx-update.
removing illegal node: "${(s.outerHTML||s.nodeValue).trim()}"
`),i.push(s))}),i.forEach(s=>s.remove())}},replaceRootContainer(e,t,i){let s=new Set(["id",K,ce,Qe,fe]);if(e.tagName.toLowerCase()===t.toLowerCase())return Array.from(e.attributes).filter(n=>!s.has(n.name.toLowerCase())).forEach(n=>e.removeAttribute(n.name)),Object.keys(i).filter(n=>!s.has(n.toLowerCase())).forEach(n=>e.setAttribute(n,i[n])),e;{let n=document.createElement(t);return Object.keys(i).forEach(r=>n.setAttribute(r,i[r])),s.forEach(r=>n.setAttribute(r,e.getAttribute(r))),n.innerHTML=e.innerHTML,e.replaceWith(n),n}},getSticky(e,t,i){let s=(H.private(e,"sticky")||[]).find(([n])=>t===n);if(s){let[n,r,o]=s;return o}else return typeof i=="function"?i():i},deleteSticky(e,t){this.updatePrivate(e,"sticky",[],i=>i.filter(([s,n])=>s!==t))},putSticky(e,t,i){let s=i(e);this.updatePrivate(e,"sticky",[],n=>{let r=n.findIndex(([o])=>t===o);return r>=0?n[r]=[t,i,s]:n.push([t,i,s]),n})},applyStickyOperations(e){let t=H.private(e,"sticky");!t||t.forEach(([i,s,n])=>this.putSticky(e,i,s))}},d=H,Je=class{static isActive(e,t){let i=t._phxRef===void 0,n=e.getAttribute(Xe).split(",").indexOf(_.genFileRef(t))>=0;return t.size>0&&(i||n)}static isPreflighted(e,t){return e.getAttribute(Ye).split(",").indexOf(_.genFileRef(t))>=0&&this.isActive(e,t)}constructor(e,t,i){this.ref=_.genFileRef(t),this.fileEl=e,this.file=t,this.view=i,this.meta=null,this._isCancelled=!1,this._isDone=!1,this._progress=0,this._lastProgressSent=-1,this._onDone=function(){},this._onElUpdated=this.onElUpdated.bind(this),this.fileEl.addEventListener(We,this._onElUpdated)}metadata(){return this.meta}progress(e){this._progress=Math.floor(e),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{_.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(e="failed"){this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),_.clearFiles(this.fileEl)}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(We,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(Xe).split(",").indexOf(this.ref)===-1&&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(e){if(this.meta.uploader){let t=e[this.meta.uploader]||P(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:Ei}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||P(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}},Ti=0,_=class{static genFileRef(e){let t=e._phxRef;return t!==void 0?t:(e._phxRef=(Ti++).toString(),e._phxRef)}static getEntryDataURL(e,t,i){let s=this.activeFiles(e).find(n=>this.genFileRef(n)===t);i(URL.createObjectURL(s))}static hasUploadsInProgress(e){let t=0;return d.findUploadInputs(e).forEach(i=>{i.getAttribute(Ye)!==i.getAttribute(li)&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(s=>{let n={path:e.name},r=e.getAttribute(Q);i[r]=i[r]||[],n.ref=this.genFileRef(s),n.name=s.name||n.ref,n.type=s.type,n.size=s.size,i[r].push(n)}),i}static clearFiles(e){e.value=null,e.removeAttribute(Q),d.putPrivate(e,"files",[])}static untrackFile(e,t){d.putPrivate(e,"files",d.private(e,"files").filter(i=>!Object.is(i,t)))}static trackFiles(e,t){if(e.getAttribute("multiple")!==null){let i=t.filter(s=>!this.activeFiles(e).find(n=>Object.is(n,s)));d.putPrivate(e,"files",this.activeFiles(e).concat(i)),e.value=null}else d.putPrivate(e,"files",t)}static activeFileInputs(e){let t=d.findUploadInputs(e);return Array.from(t).filter(i=>i.files&&this.activeFiles(i).length>0)}static activeFiles(e){return(d.private(e,"files")||[]).filter(t=>Je.isActive(e,t))}static inputsAwaitingPreflight(e){let t=d.findUploadInputs(e);return Array.from(t).filter(i=>this.filesAwaitingPreflight(i).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(t=>!Je.isPreflighted(e,t))}constructor(e,t,i){this.view=t,this.onComplete=i,this._entries=Array.from(_.filesAwaitingPreflight(e)||[]).map(s=>new Je(e,s,t)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(e,t,i){this._entries=this._entries.map(n=>(n.zipPostFlight(e),n.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()}),n));let s=this._entries.reduce((n,r)=>{let{name:o,callback:a}=r.uploader(i.uploaders);return n[o]=n[o]||{callback:a,entries:[]},n[o].entries.push(r),n},{});for(let n in s){let{callback:r,entries:o}=s[n];r(o,t,e,i)}}},_i={LiveFileUpload:{activeRefs(){return this.el.getAttribute(Xe)},preflightedRefs(){return this.el.getAttribute(Ye)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let e=this.preflightedRefs();this.preflightedWas!==e&&(this.preflightedWas=e,e===""&&this.__view.cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(We))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(Q)),_.getEntryDataURL(this.inputEl,this.ref,e=>{this.url=e,this.el.src=e})},destroyed(){URL.revokeObjectURL(this.url)}}},Pi=_i,Ri=class{constructor(e,t,i){let s=new Set,n=new Set([...t.children].map(o=>o.id)),r=[];Array.from(e.children).forEach(o=>{if(o.id&&(s.add(o.id),n.has(o.id))){let a=o.previousElementSibling&&o.previousElementSibling.id;r.push({elementId:o.id,previousElementId:a})}}),this.containerId=t.id,this.updateType=i,this.elementsToModify=r,this.elementIdsToAdd=[...n].filter(o=>!s.has(o))}perform(){let e=d.byId(this.containerId);this.elementsToModify.forEach(t=>{t.previousElementId?J(document.getElementById(t.previousElementId),i=>{J(document.getElementById(t.elementId),s=>{s.previousElementSibling&&s.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",s)})}):J(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(t=>{J(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))})}},At=11;function Li(e,t){var i=t.attributes,s,n,r,o,a;if(!(t.nodeType===At||e.nodeType===At)){for(var l=i.length-1;l>=0;l--)s=i[l],n=s.name,r=s.namespaceURI,o=s.value,r?(n=s.localName||n,a=e.getAttributeNS(r,n),a!==o&&(s.prefix==="xmlns"&&(n=s.name),e.setAttributeNS(r,n,o))):(a=e.getAttribute(n),a!==o&&e.setAttribute(n,o));for(var u=e.attributes,g=u.length-1;g>=0;g--)s=u[g],n=s.name,r=s.namespaceURI,r?(n=s.localName||n,t.hasAttributeNS(r,n)||e.removeAttributeNS(r,n)):t.hasAttribute(n)||e.removeAttribute(n)}}var Ee,xi="http://www.w3.org/1999/xhtml",R=typeof document=="undefined"?void 0:document,Di=!!R&&"content"in R.createElement("template"),Ii=!!R&&R.createRange&&"createContextualFragment"in R.createRange();function Oi(e){var t=R.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}function Ni(e){Ee||(Ee=R.createRange(),Ee.selectNode(R.body));var t=Ee.createContextualFragment(e);return t.childNodes[0]}function Hi(e){var t=R.createElement("body");return t.innerHTML=e,t.childNodes[0]}function Mi(e){return e=e.trim(),Di?Oi(e):Ii?Ni(e):Hi(e)}function Te(e,t){var i=e.nodeName,s=t.nodeName,n,r;return i===s?!0:(n=i.charCodeAt(0),r=s.charCodeAt(0),n<=90&&r>=97?i===s.toUpperCase():r<=90&&n>=97?s===i.toUpperCase():!1)}function Ui(e,t){return!t||t===xi?R.createElement(e):R.createElementNS(t,e)}function ji(e,t){for(var i=e.firstChild;i;){var s=i.nextSibling;t.appendChild(i),i=s}return t}function Ve(e,t,i){e[i]!==t[i]&&(e[i]=t[i],e[i]?e.setAttribute(i,""):e.removeAttribute(i))}var Ct={OPTION:function(e,t){var i=e.parentNode;if(i){var s=i.nodeName.toUpperCase();s==="OPTGROUP"&&(i=i.parentNode,s=i&&i.nodeName.toUpperCase()),s==="SELECT"&&!i.hasAttribute("multiple")&&(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),i.selectedIndex=-1)}Ve(e,t,"selected")},INPUT:function(e,t){Ve(e,t,"checked"),Ve(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var i=t.value;e.value!==i&&(e.value=i);var s=e.firstChild;if(s){var n=s.nodeValue;if(n==i||!i&&n==e.placeholder)return;s.nodeValue=i}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var i=-1,s=0,n=e.firstChild,r,o;n;)if(o=n.nodeName&&n.nodeName.toUpperCase(),o==="OPTGROUP")r=n,n=r.firstChild;else{if(o==="OPTION"){if(n.hasAttribute("selected")){i=s;break}s++}n=n.nextSibling,!n&&r&&(n=r.nextSibling,r=null)}e.selectedIndex=i}}},he=1,$i=11,Et=3,Tt=8;function G(){}function Fi(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}function Bi(e){return function(i,s,n){if(n||(n={}),typeof s=="string")if(i.nodeName==="#document"||i.nodeName==="HTML"||i.nodeName==="BODY"){var r=s;s=R.createElement("html"),s.innerHTML=r}else s=Mi(s);var o=n.getNodeKey||Fi,a=n.onBeforeNodeAdded||G,l=n.onNodeAdded||G,u=n.onBeforeElUpdated||G,g=n.onElUpdated||G,p=n.onBeforeNodeDiscarded||G,h=n.onNodeDiscarded||G,f=n.onBeforeElChildrenUpdated||G,v=n.childrenOnly===!0,m=Object.create(null),k=[];function E(w){k.push(w)}function C(w,y){if(w.nodeType===he)for(var b=w.firstChild;b;){var A=void 0;y&&(A=o(b))?E(A):(h(b),b.firstChild&&C(b,y)),b=b.nextSibling}}function c(w,y,b){p(w)!==!1&&(y&&y.removeChild(w),h(w),C(w,b))}function S(w){if(w.nodeType===he||w.nodeType===$i)for(var y=w.firstChild;y;){var b=o(y);b&&(m[b]=y),S(y),y=y.nextSibling}}S(i);function O(w){l(w);for(var y=w.firstChild;y;){var b=y.nextSibling,A=o(y);if(A){var N=m[A];N&&Te(y,N)?(y.parentNode.replaceChild(N,y),pe(N,y)):O(y)}else O(y);y=b}}function I(w,y,b){for(;y;){var A=y.nextSibling;(b=o(y))?E(b):c(y,w,!0),y=A}}function pe(w,y,b){var A=o(y);A&&delete m[A],!(!b&&(u(w,y)===!1||(e(w,y),g(w),f(w,y)===!1)))&&(w.nodeName!=="TEXTAREA"?$t(w,y):Ct.TEXTAREA(w,y))}function $t(w,y){var b=y.firstChild,A=w.firstChild,N,V,Z,ve,X;e:for(;b;){for(ve=b.nextSibling,N=o(b);A;){if(Z=A.nextSibling,b.isSameNode&&b.isSameNode(A)){b=ve,A=Z;continue e}V=o(A);var me=A.nodeType,W=void 0;if(me===b.nodeType&&(me===he?(N?N!==V&&((X=m[N])?Z===X?W=!1:(w.insertBefore(X,A),V?E(V):c(A,w,!0),A=X):W=!1):V&&(W=!1),W=W!==!1&&Te(A,b),W&&pe(A,b)):(me===Et||me==Tt)&&(W=!0,A.nodeValue!==b.nodeValue&&(A.nodeValue=b.nodeValue))),W){b=ve,A=Z;continue e}V?E(V):c(A,w,!0),A=Z}if(N&&(X=m[N])&&Te(X,b))w.appendChild(X),pe(X,b);else{var De=a(b);De!==!1&&(De&&(b=De),b.actualize&&(b=b.actualize(w.ownerDocument||R)),w.appendChild(b),O(b))}b=ve,A=Z}I(w,A,V);var tt=Ct[w.nodeName];tt&&tt(w,y)}var T=i,ge=T.nodeType,et=s.nodeType;if(!v){if(ge===he)et===he?Te(i,s)||(h(i),T=ji(i,Ui(s.nodeName,s.namespaceURI))):T=s;else if(ge===Et||ge===Tt){if(et===ge)return T.nodeValue!==s.nodeValue&&(T.nodeValue=s.nodeValue),T;T=s}}if(T===s)h(i);else{if(s.isSameNode&&s.isSameNode(T))return;if(pe(T,s,v),k)for(var Le=0,Ft=k.length;Le<Ft;Le++){var xe=m[k[Le]];xe&&c(xe,xe.parentNode,!1)}}return!v&&T!==i&&i.parentNode&&(T.actualize&&(T=T.actualize(i.ownerDocument||R)),i.parentNode.replaceChild(T,i)),T}}var Ji=Bi(Li),_t=Ji,_e=class{static patchEl(e,t,i){_t(e,t,{childrenOnly:!1,onBeforeElUpdated:(s,n)=>{if(i&&i.isSameNode(s)&&d.isFormInput(s))return d.mergeFocusedInput(s,n),!1}})}constructor(e,t,i,s,n){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=s,this.targetCID=n,this.cidPatch=z(this.targetCID),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(e,t){this.callbacks[`before${e}`].push(t)}after(e,t){this.callbacks[`after${e}`].push(t)}trackBefore(e,...t){this.callbacks[`before${e}`].forEach(i=>i(...t))}trackAfter(e,...t){this.callbacks[`after${e}`].forEach(i=>i(...t))}markPrunableContentForRemoval(){d.all(this.container,"[phx-update=append] > *, [phx-update=prepend] > *",e=>{e.setAttribute(dt,"")})}perform(){let{view:e,liveSocket:t,container:i,html:s}=this,n=this.isCIDPatch()?this.targetCIDContainer(s):i;if(this.isCIDPatch()&&!n)return;let r=t.getActiveElement(),{selectionStart:o,selectionEnd:a}=r&&d.hasSelectionRange(r)?r:{},l=t.binding(Ge),u=t.binding(ze),g=t.binding(Ke),p=t.binding(hi),h=t.binding("remove"),f=[],v=[],m=[],k=[],E=null,C=t.time("premorph container prep",()=>this.buildDiffHTML(i,s,l,n));return this.trackBefore("added",i),this.trackBefore("updated",i,i),t.time("morphdom",()=>{_t(n,C,{childrenOnly:n.getAttribute(D)===null,getNodeKey:c=>d.isPhxDestroyed(c)?null:c.id,onBeforeNodeAdded:c=>(this.trackBefore("added",c),c),onNodeAdded:c=>{c instanceof HTMLImageElement&&c.srcset?c.srcset=c.srcset:c instanceof HTMLVideoElement&&c.autoplay&&c.play(),d.isNowTriggerFormExternal(c,p)&&(E=c),d.discardError(n,c,u),(d.isPhxChild(c)&&e.ownsElement(c)||d.isPhxSticky(c)&&e.ownsElement(c.parentNode))&&this.trackAfter("phxChildAdded",c),f.push(c)},onNodeDiscarded:c=>{(d.isPhxChild(c)||d.isPhxSticky(c))&&t.destroyViewByEl(c),this.trackAfter("discarded",c)},onBeforeNodeDiscarded:c=>c.getAttribute&&c.getAttribute(dt)!==null?!0:c.parentNode!==null&&d.isPhxUpdate(c.parentNode,l,["append","prepend"])&&c.id?!1:c.getAttribute&&c.getAttribute(h)?(k.push(c),!1):!this.skipCIDSibling(c),onElUpdated:c=>{d.isNowTriggerFormExternal(c,p)&&(E=c),v.push(c)},onBeforeElUpdated:(c,S)=>{if(d.cleanChildNodes(S,l),this.skipCIDSibling(S)||d.isPhxSticky(c))return!1;if(d.isIgnored(c,l))return this.trackBefore("updated",c,S),d.mergeAttrs(c,S,{isIgnored:!0}),v.push(c),d.applyStickyOperations(c),!1;if(c.type==="number"&&c.validity&&c.validity.badInput)return!1;if(!d.syncPendingRef(c,S,g))return d.isUploadInput(c)&&(this.trackBefore("updated",c,S),v.push(c)),d.applyStickyOperations(c),!1;if(d.isPhxChild(S)){let I=c.getAttribute(K);return d.mergeAttrs(c,S,{exclude:[ce]}),I!==""&&c.setAttribute(K,I),c.setAttribute(fe,this.rootID),d.applyStickyOperations(c),!1}return d.copyPrivates(S,c),d.discardError(n,S,u),r&&c.isSameNode(r)&&d.isFormInput(c)?(this.trackBefore("updated",c,S),d.mergeFocusedInput(c,S),d.syncAttrsToProps(c),v.push(c),d.applyStickyOperations(c),!1):(d.isPhxUpdate(S,l,["append","prepend"])&&m.push(new Ri(c,S,S.getAttribute(l))),d.syncAttrsToProps(S),d.applyStickyOperations(S),this.trackBefore("updated",c,S),!0)}})}),t.isDebugEnabled()&&ki(),m.length>0&&t.time("post-morph append/prepend restoration",()=>{m.forEach(c=>c.perform())}),t.silenceEvents(()=>d.restoreFocus(r,o,a)),d.dispatchEvent(document,"phx:update"),f.forEach(c=>this.trackAfter("added",c)),v.forEach(c=>this.trackAfter("updated",c)),k.length>0&&(t.transitionRemoves(k),t.requestDOMUpdate(()=>{k.forEach(c=>{let S=d.firstPhxChild(c);S&&t.destroyViewByEl(S),c.remove()}),this.trackAfter("transitionsDiscarded",k)})),E&&(t.disconnect(),E.submit()),!0}isCIDPatch(){return this.cidPatch}skipCIDSibling(e){return e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(qe)!==null}targetCIDContainer(e){if(!this.isCIDPatch())return;let[t,...i]=d.findComponentNodeList(this.container,this.targetCID);return i.length===0&&d.childNodeLength(e)===1?t:t&&t.parentNode}buildDiffHTML(e,t,i,s){let n=this.isCIDPatch(),r=n&&s.getAttribute(D)===this.targetCID.toString();if(!n||r)return t;{let o=null,a=document.createElement("template");o=d.cloneNode(s);let[l,...u]=d.findComponentNodeList(o,this.targetCID);return a.innerHTML=t,u.forEach(g=>g.remove()),Array.from(o.childNodes).forEach(g=>{g.id&&g.nodeType===Node.ELEMENT_NODE&&g.getAttribute(D)!==this.targetCID.toString()&&(g.setAttribute(qe,""),g.innerHTML="")}),Array.from(a.content.childNodes).forEach(g=>o.insertBefore(g,l)),l.remove(),o.outerHTML}}},Pt=class{static extract(e){let{[St]:t,[yt]:i,[wt]:s}=e;return delete e[St],delete e[yt],delete e[wt],{diff:e,title:s,reply:t||null,events:i||[]}}constructor(e,t){this.viewId=e,this.rendered={},this.mergeDiff(t)}parentViewId(){return this.viewId}toString(e){return this.recursiveToString(this.rendered,this.rendered[x],e)}recursiveToString(e,t=e[x],i){i=i?new Set(i):null;let s={buffer:"",components:t,onlyCids:i};return this.toOutputBuffer(e,null,s),s.buffer}componentCIDs(e){return Object.keys(e[x]||{}).map(t=>parseInt(t))}isComponentOnlyDiff(e){return e[x]?Object.keys(e).length===1:!1}getComponent(e,t){return e[x][t]}mergeDiff(e){let t=e[x],i={};if(delete e[x],this.rendered=this.mutableMerge(this.rendered,e),this.rendered[x]=this.rendered[x]||{},t){let s=this.rendered[x];for(let n in t)t[n]=this.cachedFindComponent(n,t[n],s,t,i);for(let n in t)s[n]=t[n];e[x]=t}}cachedFindComponent(e,t,i,s,n){if(n[e])return n[e];{let r,o,a=t[j];if(z(a)){let l;a>0?l=this.cachedFindComponent(a,s[a],i,s,n):l=i[-a],o=l[j],r=this.cloneMerge(l,t),r[j]=o}else r=t[j]!==void 0?t:this.cloneMerge(i[e]||{},t);return n[e]=r,r}}mutableMerge(e,t){return t[j]!==void 0?t:(this.doMutableMerge(e,t),e)}doMutableMerge(e,t){for(let i in t){let s=t[i],n=e[i];le(s)&&s[j]===void 0&&le(n)?this.doMutableMerge(n,s):e[i]=s}}cloneMerge(e,t){let i=ie(ie({},e),t);for(let s in i){let n=t[s],r=e[s];le(n)&&n[j]===void 0&&le(r)&&(i[s]=this.cloneMerge(r,n))}return i}componentToString(e){return this.recursiveCIDToString(this.rendered[x],e)}pruneCIDs(e){e.forEach(t=>delete this.rendered[x][t])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[j]}templateStatic(e,t){return typeof e=="number"?t[e]:e}toOutputBuffer(e,t,i){if(e[bt])return this.comprehensionToBuffer(e,t,i);let{[j]:s}=e;s=this.templateStatic(s,t),i.buffer+=s[0];for(let n=1;n<s.length;n++)this.dynamicToBuffer(e[n-1],t,i),i.buffer+=s[n]}comprehensionToBuffer(e,t,i){let{[bt]:s,[j]:n}=e;n=this.templateStatic(n,t);let r=t||e[Si];for(let o=0;o<s.length;o++){let a=s[o];i.buffer+=n[0];for(let l=1;l<n.length;l++)this.dynamicToBuffer(a[l-1],r,i),i.buffer+=n[l]}}dynamicToBuffer(e,t,i){typeof e=="number"?i.buffer+=this.recursiveCIDToString(i.components,e,i.onlyCids):le(e)?this.toOutputBuffer(e,t,i):i.buffer+=e}recursiveCIDToString(e,t,i){let s=e[t]||P(`no component for CID ${t}`,e),n=document.createElement("template");n.innerHTML=this.recursiveToString(s,e,i);let r=n.content,o=i&&!i.has(t),[a,l]=Array.from(r.childNodes).reduce(([u,g],p,h)=>p.nodeType===Node.ELEMENT_NODE?p.getAttribute(D)?[u,!0]:(p.setAttribute(D,t),p.id||(p.id=`${this.parentViewId()}-${t}-${h}`),o&&(p.setAttribute(qe,""),p.innerHTML=""),[!0,g]):p.nodeValue.trim()!==""?(P(`only HTML element tags are allowed at the root of components.
got: "${p.nodeValue.trim()}"
within:
`,n.innerHTML.trim()),p.replaceWith(this.createSpan(p.nodeValue,t)),[!0,g]):(p.remove(),[u,g]),[!1,!1]);return!a&&!l?(P(`expected at least one HTML element tag inside a component, but the component is empty:
`,n.innerHTML.trim()),this.createSpan("",t).outerHTML):(!a&&l&&P("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.",n.innerHTML.trim()),n.innerHTML)}createSpan(e,t){let i=document.createElement("span");return i.innerText=e,i.setAttribute(D,t),i}},Vi=1,de=class{static makeID(){return Vi++}static elementID(e){return e.phxHookId}constructor(e,t,i){this.__view=e,this.liveSocket=e.liveSocket,this.__callbacks=i,this.__listeners=new Set,this.__isDisconnected=!1,this.el=t,this.el.phxHookId=this.constructor.makeID();for(let s in this.__callbacks)this[s]=this.__callbacks[s]}__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(e,t={},i=function(){}){return this.__view.pushHookEvent(null,e,t,i)}pushEventTo(e,t,i={},s=function(){}){return this.__view.withinTargets(e,(n,r)=>n.pushHookEvent(r,t,i,s))}handleEvent(e,t){let i=(s,n)=>n?e:t(s.detail);return window.addEventListener(`phx:${e}`,i),this.__listeners.add(i),i}removeHandleEvent(e){let t=e(null,!0);window.removeEventListener(`phx:${t}`,e),this.__listeners.delete(e)}upload(e,t){return this.__view.dispatchUploads(e,t)}uploadTo(e,t,i){return this.__view.withinTargets(e,s=>s.dispatchUploads(t,i))}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}},Xi={exec(e,t,i,s,n){let[r,o]=n||[null,{}];(t.charAt(0)==="["?JSON.parse(t):[[r,o]]).forEach(([l,u])=>{l===r&&o.data&&(u.data=Object.assign(u.data||{},o.data)),this.filterToEls(s,u).forEach(g=>{this[`exec_${l}`](e,t,i,s,g,u)})})},isVisible(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length>0)},exec_dispatch(e,t,i,s,n,{to:r,event:o,detail:a,bubbles:l}){a=a||{},a.dispatcher=s,d.dispatchEvent(n,o,{detail:a,bubbles:l})},exec_push(e,t,i,s,n,r){if(!i.isConnected())return;let{event:o,data:a,target:l,page_loading:u,loading:g,value:p,dispatcher:h}=r,f={loading:g,value:p,target:l,page_loading:!!u},v=e==="change"&&h?h:s,m=l||v.getAttribute(i.binding("target"))||v;i.withinTargets(m,(k,E)=>{if(e==="change"){let{newCid:C,_target:c,callback:S}=r;c=c||(s instanceof HTMLInputElement?s.name:void 0),c&&(f._target=c),k.pushInput(s,E,C,o||t,f,S)}else e==="submit"?k.submitForm(s,E,o||t,f):k.pushEvent(e,s,E,o||t,a,f)})},exec_add_class(e,t,i,s,n,{names:r,transition:o,time:a}){this.addOrRemoveClasses(n,r,[],o,a,i)},exec_remove_class(e,t,i,s,n,{names:r,transition:o,time:a}){this.addOrRemoveClasses(n,[],r,o,a,i)},exec_transition(e,t,i,s,n,{time:r,transition:o}){let[a,l,u]=o,g=()=>this.addOrRemoveClasses(n,a.concat(l),[]),p=()=>this.addOrRemoveClasses(n,u,a.concat(l));i.transition(r,g,p)},exec_toggle(e,t,i,s,n,{display:r,ins:o,outs:a,time:l}){this.toggle(e,i,n,r,o,a,l)},exec_show(e,t,i,s,n,{display:r,transition:o,time:a}){this.show(e,i,n,r,o,a)},exec_hide(e,t,i,s,n,{display:r,transition:o,time:a}){this.hide(e,i,n,r,o,a)},exec_set_attr(e,t,i,s,n,{attr:[r,o]}){this.setOrRemoveAttrs(n,[[r,o]],[])},exec_remove_attr(e,t,i,s,n,{attr:r}){this.setOrRemoveAttrs(n,[],[r])},show(e,t,i,s,n,r){this.isVisible(i)||this.toggle(e,t,i,s,n,null,r)},hide(e,t,i,s,n,r){this.isVisible(i)&&this.toggle(e,t,i,s,null,n,r)},toggle(e,t,i,s,n,r,o){let[a,l,u]=n||[[],[],[]],[g,p,h]=r||[[],[],[]];if(a.length>0||g.length>0)if(this.isVisible(i)){let f=()=>{this.addOrRemoveClasses(i,p,a.concat(l).concat(u)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,g,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,h,p))})};i.dispatchEvent(new Event("phx:hide-start")),t.transition(o,f,()=>{this.addOrRemoveClasses(i,[],g.concat(h)),d.putSticky(i,"toggle",v=>v.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))})}else{if(e==="remove")return;let f=()=>{this.addOrRemoveClasses(i,l,g.concat(p).concat(h)),d.putSticky(i,"toggle",v=>v.style.display=s||"block"),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,u,l))})};i.dispatchEvent(new Event("phx:show-start")),t.transition(o,f,()=>{this.addOrRemoveClasses(i,[],a.concat(u)),i.dispatchEvent(new Event("phx:show-end"))})}else this.isVisible(i)?window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:hide-start")),d.putSticky(i,"toggle",f=>f.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:show-start")),d.putSticky(i,"toggle",f=>f.style.display=s||"block"),i.dispatchEvent(new Event("phx:show-end"))})},addOrRemoveClasses(e,t,i,s,n,r){let[o,a,l]=s||[[],[],[]];if(o.length>0){let u=()=>this.addOrRemoveClasses(e,a.concat(o),[]),g=()=>this.addOrRemoveClasses(e,t.concat(l),i.concat(o).concat(a));return r.transition(n,u,g)}window.requestAnimationFrame(()=>{let[u,g]=d.getSticky(e,"classes",[[],[]]),p=t.filter(m=>u.indexOf(m)<0&&!e.classList.contains(m)),h=i.filter(m=>g.indexOf(m)<0&&e.classList.contains(m)),f=u.filter(m=>i.indexOf(m)<0).concat(p),v=g.filter(m=>t.indexOf(m)<0).concat(h);d.putSticky(e,"classes",m=>(m.classList.remove(...v),m.classList.add(...f),[f,v]))})},setOrRemoveAttrs(e,t,i){let[s,n]=d.getSticky(e,"attrs",[[],[]]),r=t.map(([l,u])=>l).concat(i),o=s.filter(([l,u])=>!r.includes(l)).concat(t),a=n.filter(l=>!r.includes(l)).concat(i);d.putSticky(e,"attrs",l=>(a.forEach(u=>l.removeAttribute(u)),o.forEach(([u,g])=>l.setAttribute(u,g)),[o,a]))},hasAllClasses(e,t){return t.every(i=>e.classList.contains(i))},isToggledOut(e,t){return!this.isVisible(e)||this.hasAllClasses(e,t)},filterToEls(e,{to:t}){return t?d.all(document,t):[e]}},$=Xi,Pe=(e,t,i=[])=>{let s=new FormData(e),n=[];s.forEach((o,a,l)=>{o instanceof File&&n.push(a)}),n.forEach(o=>s.delete(o));let r=new URLSearchParams;for(let[o,a]of s.entries())(i.length===0||i.indexOf(o)>=0)&&r.append(o,a);for(let o in t)r.append(o,t[o]);return r.toString()},Ht=class{constructor(e,t,i,s){this.liveSocket=t,this.flash=s,this.parent=i,this.root=i?i.root:this,this.el=e,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(n){n&&n()},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(e){this.href=e}setRedirect(e){this.redirect=!0,this.href=e}isMain(){return this.el.getAttribute(Qe)!==null}connectParams(){let e=this.liveSocket.params(this.el),t=d.all(document,`[${this.binding(oi)}]`).map(i=>i.src||i.href).filter(i=>typeof i=="string");return t.length>0&&(e._track_static=t),e._mounts=this.joinCount,e}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(K)}getStatic(){let e=this.el.getAttribute(ce);return e===""?null:e}destroy(e=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 t=()=>{e();for(let i in this.viewHooks)this.destroyHook(this.viewHooks[i])};d.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",t).receive("error",t).receive("timeout",t)}setContainerClasses(...e){this.el.classList.remove(ut,Ue,pt),this.el.classList.add(...e)}showLoader(e){if(clearTimeout(this.loaderTimer),e)this.loaderTimer=setTimeout(()=>this.showLoader(),e);else{for(let t in this.viewHooks)this.viewHooks[t].__disconnected();this.setContainerClasses(Ue)}}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses(ut)}triggerReconnected(){for(let e in this.viewHooks)this.viewHooks[e].__reconnected()}log(e,t){this.liveSocket.log(this,e,t)}transition(e,t,i=function(){}){this.liveSocket.transition(e,t,i)}withinTargets(e,t){if(e instanceof HTMLElement||e instanceof SVGElement)return this.liveSocket.owner(e,i=>t(i,e));if(z(e))d.findComponentNodeList(this.el,e).length===0?P(`no component found matching phx-target of ${e}`):t(this,parseInt(e));else{let i=Array.from(document.querySelectorAll(e));i.length===0&&P(`nothing found matching the phx-target selector "${e}"`),i.forEach(s=>this.liveSocket.owner(s,n=>t(n,s)))}}applyDiff(e,t,i){this.log(e,()=>["",Re(t)]);let{diff:s,reply:n,events:r,title:o}=Pt.extract(t);return o&&d.putTitle(o),i({diff:s,reply:n,events:r}),n}onJoin(e){let{rendered:t,container:i}=e;if(i){let[s,n]=i;this.el=d.replaceRootContainer(this.el,s,n)}this.childJoins=0,this.joinPending=!0,this.flash=null,q.dropLocal(this.liveSocket.localStorage,window.location.pathname,Rt),this.applyDiff("mount",t,({diff:s,events:n})=>{this.rendered=new Pt(this.id,s);let r=this.renderContainer(null,"join");this.dropPendingRefs();let o=this.formsForRecovery(r);this.joinCount++,o.length>0?o.forEach(([a,l,u],g)=>{this.pushFormRecovery(a,u,p=>{g===o.length-1&&this.onJoinComplete(p,r,n)})}):this.onJoinComplete(e,r,n)})}dropPendingRefs(){d.all(document,`[${Y}="${this.id}"][${F}]`,e=>{e.removeAttribute(F),e.removeAttribute(Y)})}onJoinComplete({live_patch:e},t,i){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(e,t,i);d.findPhxChildrenInFragment(t,this.id).filter(n=>{let r=n.id&&this.el.querySelector(`[id="${n.id}"]`),o=r&&r.getAttribute(ce);return o&&n.setAttribute(ce,o),this.joinChild(n)}).length===0?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(e,t,i)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i)])}attachTrueDocEl(){this.el=d.byId(this.id),this.el.setAttribute(fe,this.root.id)}applyJoinPatch(e,t,i){this.attachTrueDocEl();let s=new _e(this,this.el,this.id,t,null);if(s.markPrunableContentForRemoval(),this.performPatch(s,!1),this.joinNewChildren(),d.all(this.el,`[${this.binding(oe)}], [data-phx-${oe}]`,n=>{let r=this.addHook(n);r&&r.__mounted()}),this.joinPending=!1,this.liveSocket.dispatchEvents(i),this.applyPendingUpdates(),e){let{kind:n,to:r}=e;this.liveSocket.historyPatch(r,n)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(e,t){this.liveSocket.triggerDOM("onBeforeElUpdated",[e,t]);let i=this.getHook(e),s=i&&d.isIgnored(e,this.binding(Ge));if(i&&!e.isEqualNode(t)&&!(s&&Ci(e.dataset,t.dataset)))return i.__beforeUpdate(),i}performPatch(e,t){let i=[],s=!1,n=new Set;return e.after("added",r=>{this.liveSocket.triggerDOM("onNodeAdded",[r]);let o=this.addHook(r);o&&o.__mounted()}),e.after("phxChildAdded",r=>{d.isPhxSticky(r)?this.liveSocket.joinRootViews():s=!0}),e.before("updated",(r,o)=>{this.triggerBeforeUpdateHook(r,o)&&n.add(r.id)}),e.after("updated",r=>{n.has(r.id)&&this.getHook(r).__updated()}),e.after("discarded",r=>{r.nodeType===Node.ELEMENT_NODE&&i.push(r)}),e.after("transitionsDiscarded",r=>this.afterElementsRemoved(r,t)),e.perform(),this.afterElementsRemoved(i,t),s}afterElementsRemoved(e,t){let i=[];e.forEach(s=>{let n=d.all(s,`[${D}]`),r=d.all(s,`[${this.binding(oe)}]`);n.concat(s).forEach(o=>{let a=this.componentID(o);z(a)&&i.indexOf(a)===-1&&i.push(a)}),r.concat(s).forEach(o=>{let a=this.getHook(o);a&&this.destroyHook(a)})}),t&&this.maybePushComponentsDestroyed(i)}joinNewChildren(){d.findPhxChildren(this.el,this.id).forEach(e=>this.joinChild(e))}getChildById(e){return this.root.children[this.id][e]}getDescendentByEl(e){return e.id===this.id?this:this.children[e.getAttribute(ee)][e.id]}destroyDescendent(e){for(let t in this.root.children)for(let i in this.root.children[t])if(i===e)return this.root.children[t][i].destroy()}joinChild(e){if(!this.getChildById(e.id)){let i=new Ht(e,this.liveSocket,this);return this.root.children[this.id][i.id]=i,i.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(e){this.childJoins--,this.childJoins===0&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.joinCallback(()=>{this.pendingJoinOps.forEach(([e,t])=>{e.isDestroyed()||t()}),this.pendingJoinOps=[]})}update(e,t){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&!d.isPhxSticky(this.el))return this.pendingDiffs.push({diff:e,events:t});this.rendered.mergeDiff(e);let i=!1;this.rendered.isComponentOnlyDiff(e)?this.liveSocket.time("component patch complete",()=>{d.findParentCIDs(this.el,this.rendered.componentCIDs(e)).forEach(n=>{this.componentPatch(this.rendered.getComponent(e,n),n)&&(i=!0)})}):kt(e)||this.liveSocket.time("full patch complete",()=>{let s=this.renderContainer(e,"update"),n=new _e(this,this.el,this.id,s,null);i=this.performPatch(n,!0)}),this.liveSocket.dispatchEvents(t),i&&this.joinNewChildren()}renderContainer(e,t){return this.liveSocket.time(`toString diff (${t})`,()=>{let i=this.el.tagName,s=e?this.rendered.componentCIDs(e).concat(this.pruningCIDs):null,n=this.rendered.toString(s);return`<${i}>${n}</${i}>`})}componentPatch(e,t){if(kt(e))return!1;let i=this.rendered.componentToString(t),s=new _e(this,this.el,this.id,i,t);return this.performPatch(s,!0)}getHook(e){return this.viewHooks[de.elementID(e)]}addHook(e){if(de.elementID(e)||!e.getAttribute)return;let t=e.getAttribute(`data-phx-${oe}`)||e.getAttribute(this.binding(oe));if(t&&!this.ownsElement(e))return;let i=this.liveSocket.getHookCallbacks(t);if(i){e.id||P(`no DOM ID for hook "${t}". Hooks require a unique ID on each element.`,e);let s=new de(this,e,i);return this.viewHooks[de.elementID(s.el)]=s,s}else t!==null&&P(`unknown hook found for "${t}"`,e)}destroyHook(e){e.__destroyed(),e.__cleanup__(),delete this.viewHooks[de.elementID(e.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:e,events:t})=>this.update(e,t)),this.pendingDiffs=[]}onChannel(e,t){this.liveSocket.onChannel(this.channel,e,i=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>t(i)]):this.liveSocket.requestDOMUpdate(()=>t(i))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",e=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",e,({diff:t,events:i})=>this.update(t,i))})}),this.onChannel("redirect",({to:e,flash:t})=>this.onRedirect({to:e,flash:t})),this.onChannel("live_patch",e=>this.onLivePatch(e)),this.onChannel("live_redirect",e=>this.onLiveRedirect(e)),this.channel.onError(e=>this.onError(e)),this.channel.onClose(e=>this.onClose(e))}destroyAllChildren(){for(let e in this.root.children[this.id])this.getChildById(e).destroy()}onLiveRedirect(e){let{to:t,kind:i,flash:s}=e,n=this.expandURL(t);this.liveSocket.historyRedirect(n,i,s)}onLivePatch(e){let{to:t,kind:i}=e;this.href=this.expandURL(t),this.liveSocket.historyPatch(t,i)}expandURL(e){return e.startsWith("/")?`${window.location.protocol}//${window.location.host}${e}`:e}onRedirect({to:e,flash:t}){this.liveSocket.redirect(e,t)}isDestroyed(){return this.destroyed}join(e){this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=t=>{t=t||function(){},e?e(this.joinCount,t):t()},this.liveSocket.wrapPush(this,{timeout:!1},()=>this.channel.join().receive("ok",t=>{this.isDestroyed()||this.liveSocket.requestDOMUpdate(()=>this.onJoin(t))}).receive("error",t=>!this.isDestroyed()&&this.onJoinError(t)).receive("timeout",()=>!this.isDestroyed()&&this.onJoinError({reason:"timeout"})))}onJoinError(e){if(e.reason==="unauthorized"||e.reason==="stale")return this.log("error",()=>["unauthorized live_redirect. Falling back to page request",e]),this.onRedirect({to:this.href});if((e.redirect||e.live_redirect)&&(this.joinPending=!1,this.channel.leave()),e.redirect)return this.onRedirect(e.redirect);if(e.live_redirect)return this.onLiveRedirect(e.live_redirect);this.log("error",()=>["unable to join",e]),this.liveSocket.isConnected()&&this.liveSocket.reloadWithJitter(this)}onClose(e){if(!this.isDestroyed()){if(this.liveSocket.hasPendingLink()&&e!=="leave")return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(vi)}}onError(e){this.onClose(e),this.liveSocket.isConnected()&&this.log("error",()=>["view crashed",e]),this.liveSocket.isUnloaded()||this.displayError()}displayError(){this.isMain()&&d.dispatchEvent(window,"phx:page-loading-start",{detail:{to:this.href,kind:"error"}}),this.showLoader(),this.setContainerClasses(Ue,pt)}pushWithReply(e,t,i,s=function(){}){if(!this.isConnected())return;let[n,[r],o]=e?e():[null,[],{}],a=function(){};return(o.page_loading||r&&r.getAttribute(this.binding(ct))!==null)&&(a=this.liveSocket.withPageLoading({kind:"element",target:r})),typeof i.cid!="number"&&delete i.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(t,i,bi).receive("ok",l=>{n!==null&&this.undoRefs(n);let u=g=>{l.redirect&&this.onRedirect(l.redirect),l.live_patch&&this.onLivePatch(l.live_patch),l.live_redirect&&this.onLiveRedirect(l.live_redirect),a(),s(l,g)};l.diff?this.liveSocket.requestDOMUpdate(()=>{let g=this.applyDiff("update",l.diff,({diff:p,events:h})=>{this.update(p,h)});u(g)}):u(null)}))}undoRefs(e){d.all(document,`[${Y}="${this.id}"][${F}="${e}"]`,t=>{let i=t.getAttribute(we);t.removeAttribute(F),t.removeAttribute(Y),t.getAttribute(je)!==null&&(t.readOnly=!1,t.removeAttribute(je)),i!==null&&(t.disabled=i==="true",t.removeAttribute(we)),Lt.forEach(r=>d.removeClass(t,r));let s=t.getAttribute(ke);s!==null&&(t.innerText=s,t.removeAttribute(ke));let n=d.private(t,F);if(n){let r=this.triggerBeforeUpdateHook(t,n);_e.patchEl(t,n,this.liveSocket.getActiveElement()),r&&r.__updated(),d.deletePrivate(t,F)}})}putRef(e,t,i={}){let s=this.ref++,n=this.binding(Ke);return i.loading&&(e=e.concat(d.all(document,i.loading))),e.forEach(r=>{r.classList.add(`phx-${t}-loading`),r.setAttribute(F,s),r.setAttribute(Y,this.el.id);let o=r.getAttribute(n);o!==null&&(r.getAttribute(ke)||r.setAttribute(ke,r.innerText),o!==""&&(r.innerText=o),r.setAttribute("disabled",""))}),[s,e,i]}componentID(e){let t=e.getAttribute&&e.getAttribute(D);return t?parseInt(t):null}targetComponentID(e,t,i={}){if(z(t))return t;let s=e.getAttribute(this.binding("target"));return z(s)?parseInt(s):t&&(s!==null||i.target)?this.closestComponentID(t):null}closestComponentID(e){return z(e)?e:e?J(e.closest(`[${D}]`),t=>this.ownsElement(t)&&this.componentID(t)):null}pushHookEvent(e,t,i,s){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",t,i]),!1;let[n,r,o]=this.putRef([],"hook");return this.pushWithReply(()=>[n,r,o],"event",{type:"hook",event:t,value:i,cid:this.closestComponentID(e)},(a,l)=>s(l,n)),n}extractMeta(e,t,i){let s=this.binding("value-");for(let n=0;n<e.attributes.length;n++){t||(t={});let r=e.attributes[n].name;r.startsWith(s)&&(t[r.replace(s,"")]=e.getAttribute(r))}if(e.value!==void 0&&(t||(t={}),t.value=e.value,e.tagName==="INPUT"&&It.indexOf(e.type)>=0&&!e.checked&&delete t.value),i){t||(t={});for(let n in i)t[n]=i[n]}return t}pushEvent(e,t,i,s,n,r={}){this.pushWithReply(()=>this.putRef([t],e,r),"event",{type:e,event:s,value:this.extractMeta(t,n,r.value),cid:this.targetComponentID(t,i,r)})}pushFileProgress(e,t,i,s=function(){}){this.liveSocket.withinOwners(e.form,(n,r)=>{n.pushWithReply(null,"progress",{event:e.getAttribute(n.binding(pi)),ref:e.getAttribute(Q),entry_ref:t,progress:i,cid:n.targetComponentID(e.form,r)},s)})}pushInput(e,t,i,s,n,r){let o,a=z(i)?i:this.targetComponentID(e.form,t),l=()=>this.putRef([e,e.form],"change",n),u;e.getAttribute(this.binding("change"))?u=Pe(e.form,{_target:n._target},[e.name]):u=Pe(e.form,{_target:n._target}),d.isUploadInput(e)&&e.files&&e.files.length>0&&_.trackFiles(e,Array.from(e.files)),o=_.serializeUploads(e);let g={type:"form",event:s,value:u,uploads:o,cid:a};this.pushWithReply(l,"event",g,p=>{if(d.showError(e,this.liveSocket.binding(ze)),d.isUploadInput(e)&&e.getAttribute("data-phx-auto-upload")!==null){if(_.filesAwaitingPreflight(e).length>0){let[h,f]=l();this.uploadFiles(e.form,t,h,a,v=>{r&&r(p),this.triggerAwaitingSubmit(e.form)})}}else r&&r(p)})}triggerAwaitingSubmit(e){let t=this.getScheduledSubmit(e);if(t){let[i,s,n,r]=t;this.cancelSubmit(e),r()}}getScheduledSubmit(e){return this.formSubmits.find(([t,i,s,n])=>t.isSameNode(e))}scheduleSubmit(e,t,i,s){if(this.getScheduledSubmit(e))return!0;this.formSubmits.push([e,t,i,s])}cancelSubmit(e){this.formSubmits=this.formSubmits.filter(([t,i,s])=>t.isSameNode(e)?(this.undoRefs(i),!1):!0)}pushFormSubmit(e,t,i,s,n){let r=p=>!(ue(p,`${this.binding(Ge)}=ignore`,p.form)||ue(p,"data-phx-update=ignore",p.form)),o=p=>p.hasAttribute(this.binding(Ke)),a=p=>p.tagName=="BUTTON",l=p=>["INPUT","TEXTAREA","SELECT"].includes(p.tagName),u=()=>{let p=Array.from(e.elements),h=p.filter(o),f=p.filter(a).filter(r),v=p.filter(l).filter(r);return f.forEach(m=>{m.setAttribute(we,m.disabled),m.disabled=!0}),v.forEach(m=>{m.setAttribute(je,m.readOnly),m.readOnly=!0,m.files&&(m.setAttribute(we,m.disabled),m.disabled=!0)}),e.setAttribute(this.binding(ct),""),this.putRef([e].concat(h).concat(f).concat(v),"submit",s)},g=this.targetComponentID(e,t);if(_.hasUploadsInProgress(e)){let[p,h]=u(),f=()=>this.pushFormSubmit(e,t,i,s,n);return this.scheduleSubmit(e,p,s,f)}else if(_.inputsAwaitingPreflight(e).length>0){let[p,h]=u(),f=()=>[p,h,s];this.uploadFiles(e,t,p,g,v=>{let m=Pe(e,{});this.pushWithReply(f,"event",{type:"form",event:i,value:m,cid:g},n)})}else{let p=Pe(e,{});this.pushWithReply(u,"event",{type:"form",event:i,value:p,cid:g},n)}}uploadFiles(e,t,i,s,n){let r=this.joinCount,o=_.activeFileInputs(e),a=o.length;o.forEach(l=>{let u=new _(l,this,()=>{a--,a===0&&n()});this.uploaders[l]=u;let g=u.entries().map(h=>h.toPreflightPayload()),p={ref:l.getAttribute(Q),entries:g,cid:this.targetComponentID(l.form,t)};this.log("upload",()=>["sending preflight request",p]),this.pushWithReply(null,"allow_upload",p,h=>{if(this.log("upload",()=>["got preflight response",h]),h.error){this.undoRefs(i);let[f,v]=h.error;this.log("upload",()=>[`error for entry ${f}`,v])}else{let f=v=>{this.channel.onError(()=>{this.joinCount===r&&v()})};u.initAdapterUpload(h,f,this.liveSocket)}})})}dispatchUploads(e,t){let i=d.findUploadInputs(this.el).filter(s=>s.name===e);i.length===0?P(`no live file inputs found matching the name "${e}"`):i.length>1?P(`duplicate live file inputs found matching the name "${e}"`):d.dispatchEvent(i[0],xt,{detail:{files:t}})}pushFormRecovery(e,t,i){this.liveSocket.withinOwners(e,(s,n)=>{let r=e.elements[0],o=e.getAttribute(this.binding(vt))||e.getAttribute(this.binding("change"));$.exec("change",o,s,r,["push",{_target:r.name,newCid:t,callback:i}])})}pushLinkPatch(e,t,i){let s=this.liveSocket.setPendingLink(e),n=t?()=>this.putRef([t],"click"):null,r=()=>this.liveSocket.redirect(window.location.href),o=this.pushWithReply(n,"live_patch",{url:e},a=>{this.liveSocket.requestDOMUpdate(()=>{a.link_redirect?this.liveSocket.replaceMain(e,null,i,s):(this.liveSocket.commitPendingLink(s)&&(this.href=e),this.applyPendingUpdates(),i&&i(s))})});o?o.receive("timeout",r):r()}formsForRecovery(e){if(this.joinCount===0)return[];let t=this.binding("change"),i=document.createElement("template");return i.innerHTML=e,d.all(this.el,`form[${t}]`).filter(s=>s.id&&this.ownsElement(s)).filter(s=>s.elements.length>0).filter(s=>s.getAttribute(this.binding(vt))!=="ignore").map(s=>{let n=i.content.querySelector(`form[id="${s.id}"][${t}="${s.getAttribute(t)}"]`);return n?[s,n,this.targetComponentID(n)]:[s,null,null]}).filter(([s,n,r])=>n)}maybePushComponentsDestroyed(e){let t=e.filter(i=>d.findComponentNodeList(this.el,i).length===0);t.length>0&&(this.pruningCIDs.push(...t),this.pushWithReply(null,"cids_will_destroy",{cids:t},()=>{this.pruningCIDs=this.pruningCIDs.filter(s=>t.indexOf(s)!==-1);let i=t.filter(s=>d.findComponentNodeList(this.el,s).length===0);i.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:i},s=>{this.rendered.pruneCIDs(s.cids)})}))}ownsElement(e){return e.getAttribute(ee)===this.id||J(e.closest(te),t=>t.id)===this.id}submitForm(e,t,i,s={}){d.putPrivate(e,Ot,!0);let n=this.liveSocket.binding(ze),r=Array.from(e.elements);this.liveSocket.blurActiveElement(this),this.pushFormSubmit(e,t,i,s,()=>{r.forEach(o=>d.showError(o,n)),this.liveSocket.restorePreviouslyActiveFocus()})}binding(e){return this.liveSocket.binding(e)}},Mt=class{constructor(e,t,i={}){if(this.unloaded=!1,!t||t.constructor.name==="Object")throw new Error(`
a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example:
import {Socket} from "phoenix"
import {LiveSocket} from "phoenix_live_view"
let liveSocket = new LiveSocket("/live", Socket, {...})
`);this.socket=new t(e,i),this.bindingPrefix=i.bindingPrefix||mi,this.opts=i,this.params=Be(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(Re(yi),i.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.outgoingMainEl=null,this.clickStartedAtTarget=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=Re(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||gi,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||ii,this.reloadJitterMin=i.reloadJitterMin||si,this.reloadJitterMax=i.reloadJitterMax||ni,this.failsafeJitter=i.failsafeJitter||ri,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.domCallbacks=Object.assign({onNodeAdded:Be(),onBeforeElUpdated:Be()},i.dom||{}),this.transitions=new Wi,window.addEventListener("pagehide",s=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}isProfileEnabled(){return this.sessionStorage.getItem($e)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(Ae)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(Ae)==="false"}enableDebug(){this.sessionStorage.setItem(Ae,"true")}enableProfiling(){this.sessionStorage.setItem($e,"true")}disableDebug(){this.sessionStorage.setItem(Ae,"false")}disableProfiling(){this.sessionStorage.removeItem($e)}enableLatencySim(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(Fe,e)}disableLatencySim(){this.sessionStorage.removeItem(Fe)}getLatencySim(){let e=this.sessionStorage.getItem(Fe);return e?parseInt(e):null}getSocket(){return this.socket}connect(){window.location.hostname==="localhost"&&!this.isDebugDisabled()&&this.enableDebug();let e=()=>{this.joinRootViews()?(this.bindTopLevelEvents(),this.socket.connect()):this.main&&this.socket.connect()};["complete","loaded","interactive"].indexOf(document.readyState)>=0?e():document.addEventListener("DOMContentLoaded",()=>e())}disconnect(e){clearTimeout(this.reloadWithJitterTimer),this.socket.disconnect(e)}replaceTransport(e){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(e),this.connect()}execJS(e,t,i=null){this.owner(e,s=>$.exec(i,t,s,e))}triggerDOM(e,t){this.domCallbacks[e](...t)}time(e,t){if(!this.isProfileEnabled()||!console.time)return t();console.time(e);let i=t();return console.timeEnd(e),i}log(e,t,i){if(this.viewLogger){let[s,n]=i();this.viewLogger(e,t,s,n)}else if(this.isDebugEnabled()){let[s,n]=i();Ai(e,t,s,n)}}requestDOMUpdate(e){this.transitions.after(e)}transition(e,t,i=function(){}){this.transitions.addTransition(e,t,i)}onChannel(e,t,i){e.on(t,s=>{let n=this.getLatencySim();n?(console.log(`simulating ${n}ms of latency from server to client`),setTimeout(()=>i(s),n)):i(s)})}wrapPush(e,t,i){let s=this.getLatencySim(),n=e.joinCount;if(!s)return this.isConnected()&&t.timeout?i().receive("timeout",()=>{e.joinCount===n&&!e.isDestroyed()&&this.reloadWithJitter(e,()=>{this.log(e,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):i();console.log(`simulating ${s}ms of latency from client to server`);let r={receives:[],receive(o,a){this.receives.push([o,a])}};return setTimeout(()=>{e.isDestroyed()||r.receives.reduce((o,[a,l])=>o.receive(a,l),i())},s),r}reloadWithJitter(e,t){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,s=this.reloadJitterMax,n=Math.floor(Math.random()*(s-i+1))+i,r=q.updateLocal(this.localStorage,window.location.pathname,Rt,0,o=>o+1);r>this.maxReloads&&(n=this.failsafeJitter),this.reloadWithJitterTimer=setTimeout(()=>{e.isDestroyed()||e.isConnected()||(e.destroy(),t?t():this.log(e,"join",()=>[`encountered ${r} consecutive reloads`]),r>this.maxReloads&&this.log(e,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),this.hasPendingLink()?window.location=this.pendingLink:window.location.reload())},n)}getHookCallbacks(e){return e&&e.startsWith("Phoenix.")?Pi[e.split(".")[1]]:this.hooks[e]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(e){return`${this.getBindingPrefix()}${e}`}channel(e,t){return this.socket.channel(e,t)}joinRootViews(){let e=!1;return d.all(document,`${te}:not([${ee}])`,t=>{if(!this.getRootById(t.id)){let i=this.newRootView(t);i.setHref(this.getHref()),i.join(),t.getAttribute(Qe)&&(this.main=i)}e=!0}),e}redirect(e,t){this.disconnect(),q.redirect(e,t)}replaceMain(e,t,i=null,s=this.setPendingLink(e)){this.outgoingMainEl=this.outgoingMainEl||this.main.el;let n=d.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(n,t),this.main.setRedirect(e),this.transitionRemoves(),this.main.join((r,o)=>{r===1&&this.commitPendingLink(s)&&this.requestDOMUpdate(()=>{d.findPhxSticky(document).forEach(a=>n.appendChild(a)),this.outgoingMainEl.replaceWith(n),this.outgoingMainEl=null,i&&requestAnimationFrame(i),o()})})}transitionRemoves(e){let t=this.binding("remove");e=e||d.all(document,`[${t}]`),e.forEach(i=>{document.body.contains(i)&&this.execJS(i,i.getAttribute(t),"remove")})}isPhxView(e){return e.getAttribute&&e.getAttribute(K)!==null}newRootView(e,t){let i=new Ht(e,this,null,t);return this.roots[i.id]=i,i}owner(e,t){let i=J(e.closest(te),s=>this.getViewByEl(s))||this.main;i&&t(i)}withinOwners(e,t){this.owner(e,i=>t(i,e))}getViewByEl(e){let t=e.getAttribute(fe);return J(this.getRootById(t),i=>i.getDescendentByEl(e))}getRootById(e){return this.roots[e]}destroyAllViews(){for(let e in this.roots)this.roots[e].destroy(),delete this.roots[e];this.main=null}destroyViewByEl(e){let t=this.getRootById(e.getAttribute(fe));t&&t.id===e.id?(t.destroy(),delete this.roots[t.id]):t&&t.destroyDescendent(e.id)}setActiveElement(e){if(this.activeElement===e)return;this.activeElement=e;let t=()=>{e===this.activeElement&&(this.activeElement=null),e.removeEventListener("mouseup",this),e.removeEventListener("touchend",this)};e.addEventListener("mouseup",t),e.addEventListener("touchend",t)}getActiveElement(){return document.activeElement===document.body?this.activeElement||document.activeElement:document.activeElement||document.body}dropActiveElement(e){this.prevActive&&e.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,this.socket.onClose(e=>{e&&e.code===1e3&&this.main&&this.reloadWithJitter(this.main)}),document.body.addEventListener("click",function(){}),window.addEventListener("pageshow",e=>{e.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"},(e,t,i,s,n,r)=>{let o=s.getAttribute(this.binding(fi)),a=e.key&&e.key.toLowerCase();if(o&&o.toLowerCase()!==a)return;let l=ie({key:e.key},this.eventMeta(t,e,s));$.exec(t,n,i,s,["push",{data:l}])}),this.bind({blur:"focusout",focus:"focusin"},(e,t,i,s,n,r)=>{if(!r){let o=ie({key:e.key},this.eventMeta(t,e,s));$.exec(t,n,i,s,["push",{data:o}])}}),this.bind({blur:"blur",focus:"focus"},(e,t,i,s,n,r,o)=>{if(o==="window"){let a=this.eventMeta(t,e,s);$.exec(t,r,i,s,["push",{data:a}])}}),window.addEventListener("dragover",e=>e.preventDefault()),window.addEventListener("drop",e=>{e.preventDefault();let t=J(ue(e.target,this.binding(ht)),n=>n.getAttribute(this.binding(ht))),i=t&&document.getElementById(t),s=Array.from(e.dataTransfer.files||[]);!i||i.disabled||s.length===0||!(i.files instanceof FileList)||(_.trackFiles(i,s),i.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(xt,e=>{let t=e.target;if(!d.isUploadInput(t))return;let i=Array.from(e.detail.files||[]).filter(s=>s instanceof File||s instanceof Blob);_.trackFiles(t,i),t.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(e,t,i){let s=this.metadataCallbacks[e];return s?s(t,i):{}}setPendingLink(e){return this.linkRef++,this.pendingLink=e,this.linkRef}commitPendingLink(e){return this.linkRef!==e?!1:(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(e,t){for(let i in e){let s=e[i];this.on(s,n=>{let r=this.binding(i),o=this.binding(`window-${i}`),a=n.target.getAttribute&&n.target.getAttribute(r);a?this.debounce(n.target,n,s,()=>{this.withinOwners(n.target,l=>{t(n,i,l,n.target,a,null)})}):d.all(document,`[${o}]`,l=>{let u=l.getAttribute(o);this.debounce(l,n,s,()=>{this.withinOwners(l,g=>{t(n,i,g,l,u,"window")})})})})}}bindClicks(){window.addEventListener("mousedown",e=>this.clickStartedAtTarget=e.target),this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}bindClick(e,t,i){let s=this.binding(t);window.addEventListener(e,n=>{let r=null;if(i)r=n.target.matches(`[${s}]`)?n.target:n.target.querySelector(`[${s}]`);else{let a=this.clickStartedAtTarget||n.target;r=ue(a,s),this.dispatchClickAway(n,a),this.clickStartedAtTarget=null}let o=r&&r.getAttribute(s);!o||(r.getAttribute("href")==="#"&&n.preventDefault(),this.debounce(r,n,"click",()=>{this.withinOwners(r,a=>{$.exec("click",o,a,r,["push",{data:this.eventMeta("click",n,r)}])})}))},i)}dispatchClickAway(e,t){let i=this.binding("click-away");d.all(document,`[${i}]`,s=>{s.isSameNode(t)||s.contains(t)||this.withinOwners(e.target,n=>{let r=s.getAttribute(i);$.isVisible(s)&&$.exec("click",r,n,s,["push",{data:this.eventMeta("click",e,e.target)}])})})}bindNav(){if(!q.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let e=null;window.addEventListener("scroll",t=>{clearTimeout(e),e=setTimeout(()=>{q.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:i,id:s,root:n,scroll:r}=t.state||{},o=window.location.href;this.requestDOMUpdate(()=>{this.main.isConnected()&&i==="patch"&&s===this.main.id?this.main.pushLinkPatch(o,null):this.replaceMain(o,null,()=>{n&&this.replaceRootHistory(),typeof r=="number"&&setTimeout(()=>{window.scrollTo(0,r)},0)})})},!1),window.addEventListener("click",t=>{let i=ue(t.target,Me),s=i&&i.getAttribute(Me),n=t.metaKey||t.ctrlKey||t.button===1;if(!s||!this.isConnected()||!this.main||n)return;let r=i.href,o=i.getAttribute(ai);t.preventDefault(),t.stopImmediatePropagation(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if(s==="patch")this.pushHistoryPatch(r,o,i);else if(s==="redirect")this.historyRedirect(r,o);else throw new Error(`expected ${Me} to be "patch" or "redirect", got: ${s}`)})},!1)}dispatchEvent(e,t={}){d.dispatchEvent(window,`phx:${e}`,{detail:t})}dispatchEvents(e){e.forEach(([t,i])=>this.dispatchEvent(t,i))}withPageLoading(e,t){d.dispatchEvent(window,"phx:page-loading-start",{detail:e});let i=()=>d.dispatchEvent(window,"phx:page-loading-stop",{detail:e});return t?t(i):i}pushHistoryPatch(e,t,i){this.withPageLoading({to:e,kind:"patch"},s=>{this.main.pushLinkPatch(e,i,n=>{this.historyPatch(e,t,n),s()})})}historyPatch(e,t,i=this.setPendingLink(e)){!this.commitPendingLink(i)||(q.pushState(t,{type:"patch",id:this.main.id},e),this.registerNewLocation(window.location))}historyRedirect(e,t,i){let s=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},n=>{this.replaceMain(e,i,()=>{q.pushState(t,{type:"redirect",id:this.main.id,scroll:s},e),this.registerNewLocation(window.location),n()})})}replaceRootHistory(){q.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(e){let{pathname:t,search:i}=this.currentLocation;return t+i===e.pathname+e.search?!1:(this.currentLocation=Re(e),!0)}bindForms(){let e=0;this.on("submit",t=>{let i=t.target.getAttribute(this.binding("submit"));!i||(t.preventDefault(),t.target.disabled=!0,this.withinOwners(t.target,s=>{$.exec("submit",i,s,t.target,["push",{}])}))},!1);for(let t of["change","input"])this.on(t,i=>{let s=this.binding("change"),n=i.target,r=n.getAttribute(s),o=n.form&&n.form.getAttribute(s),a=r||o;if(!a||n.type==="number"&&n.validity&&n.validity.badInput)return;let l=r?n:n.form,u=e;e++;let{at:g,type:p}=d.private(n,"prev-iteration")||{};g===u-1&&t!==p||(d.putPrivate(n,"prev-iteration",{at:u,type:t}),this.debounce(n,i,t,()=>{this.withinOwners(l,h=>{d.putPrivate(n,Dt,!0),d.isTextualInput(n)||this.setActiveElement(n),$.exec("change",a,h,n,["push",{_target:i.target.name,dispatcher:l}])})}))},!1)}debounce(e,t,i,s){if(i==="blur"||i==="focusout")return s();let n=this.binding(ci),r=this.binding(ui),o=this.defaults.debounce.toString(),a=this.defaults.throttle.toString();this.withinOwners(e,l=>{let u=()=>!l.isDestroyed()&&document.body.contains(e);d.debounce(e,t,n,o,r,a,u,()=>{s()})})}silenceEvents(e){this.silenced=!0,e(),this.silenced=!1}on(e,t){window.addEventListener(e,i=>{this.silenced||t(i)})}},Wi=class{constructor(){this.transitions=new Set,this.pendingOps=[],this.reset()}reset(){this.transitions.forEach(e=>{cancelTimeout(e),this.transitions.delete(e)}),this.flushPendingOps()}after(e){this.size()===0?e():this.pushPendingOp(e)}addTransition(e,t,i){t();let s=setTimeout(()=>{this.transitions.delete(s),i(),this.size()===0&&this.flushPendingOps()},e);this.transitions.add(s)}pushPendingOp(e){this.pendingOps.push(e)}size(){return this.transitions.size}flushPendingOps(){this.pendingOps.forEach(e=>e()),this.pendingOps=[]}};var Ut={};var qi=document.querySelector("meta[name='csrf-token']").getAttribute("content"),jt=new Mt("/live",ot,{params:{_csrf_token:qi},hooks:Ut,dom:{onBeforeElUpdated(e,t){return e.isEqualNode(t)?!1:(e.dataset.bsnclass!=null&&e.dataset.bsnclass!=""&&e.dataset.bsnclass.split(" ").forEach(s=>{t.classList.contains(s)||t.classList.add(s)}),e.dataset.bsnstyle==""&&t.setAttribute("style",e.getAttribute("style")),t)}}});window.addEventListener("phx:page-loading-start",e=>Ze.default.start());window.addEventListener("phx:page-loading-stop",e=>Ze.default.done());jt.connect();window.liveSocket=jt;})();
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
* @license MIT */