Packages
ash_admin
0.13.14
1.1.0
1.0.0-rc.0
0.14.0
0.13.26
0.13.25
0.13.24
0.13.23
0.13.22
0.13.21
0.13.20
0.13.19
0.13.18
0.13.17
0.13.16
0.13.15
0.13.14
0.13.13
0.13.12
0.13.11
0.13.10
0.13.9
0.13.8
0.13.7
0.13.6
0.13.5
0.13.4
0.13.3
0.13.2
0.13.1
0.13.0
0.12.6
0.12.5
0.12.4
0.12.3
0.12.2
0.12.1
0.12.0
0.11.11
0.11.10
0.11.9
0.11.8
0.11.7
0.11.6
0.11.5
0.11.4
0.11.3
0.11.2
0.11.1
0.11.0
0.10.12
0.10.11
0.10.10
retired
0.10.10-rc.1
0.10.10-rc.0
0.10.9
0.10.8
0.10.7
0.10.6
0.10.5
0.10.4
0.10.3
0.10.2
0.10.1
0.10.0
0.9.8
0.9.7
0.9.6
0.9.5
0.9.4
0.9.3
0.9.2
0.9.1
0.9.0
0.8.1
0.8.0
0.7.1
0.7.0
0.6.2
0.6.1
0.6.0-rc.2
0.6.0-rc.1
0.6.0-rc.0
0.5.2
0.5.1-rc.0
0.5.0
0.4.5-rc.0
0.4.4
0.4.2
0.4.0
0.3.0-rc.0
0.2.22
0.2.21
0.2.20
0.2.19
0.2.18
0.2.17
0.2.16-rc.1
0.2.16-rc.0
0.2.15
0.2.14
0.2.13
0.2.12
0.2.11
0.2.10
0.2.9
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.3
0.2.1
0.1.6
0.1.5
0.1.3
0.1.2
0.1.0
A super-admin UI for Ash Framework, built with Phoenix LiveView.
Current section
Files
Jump to
Current section
Files
priv/static/assets/app-5278a18515691be5786defb2425e6b76.js
(()=>{var yi=Object.create;var nt=Object.defineProperty,ki=Object.defineProperties,Ai=Object.getOwnPropertyDescriptor,Si=Object.getOwnPropertyDescriptors,Ei=Object.getOwnPropertyNames,_t=Object.getOwnPropertySymbols,Ci=Object.getPrototypeOf,Rt=Object.prototype.hasOwnProperty,_i=Object.prototype.propertyIsEnumerable;var Tt=(e,t,i)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,J=(e,t)=>{for(var i in t||(t={}))Rt.call(t,i)&&Tt(e,i,t[i]);if(_t)for(var i of _t(t))_i.call(t,i)&&Tt(e,i,t[i]);return e},Ne=(e,t)=>ki(e,Si(t));var Ti=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ri=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ei(t))!Rt.call(e,n)&&n!==i&&nt(e,n,{get:()=>t[n],enumerable:!(s=Ai(t,n))||s.enumerable});return e};var Pi=(e,t,i)=>(i=e!=null?yi(Ci(e)):{},Ri(t||!e||!e.__esModule?nt(i,"default",{value:e,enumerable:!0}):i,e));var It=Ti((Lt,$e)=>{(function(e,t){"use strict";(function(){for(var p=0,c=["ms","moz","webkit","o"],v=0;v<c.length&&!e.requestAnimationFrame;++v)e.requestAnimationFrame=e[c[v]+"RequestAnimationFrame"],e.cancelAnimationFrame=e[c[v]+"CancelAnimationFrame"]||e[c[v]+"CancelRequestAnimationFrame"];e.requestAnimationFrame||(e.requestAnimationFrame=function(b,O){var A=new Date().getTime(),_=Math.max(0,16-(A-p)),D=e.setTimeout(function(){b(A+_)},_);return p=A+_,D}),e.cancelAnimationFrame||(e.cancelAnimationFrame=function(b){clearTimeout(b)})})();var i,s,n,r=null,o=null,a=null,l=function(p,c,v){p.addEventListener?p.addEventListener(c,v,!1):p.attachEvent?p.attachEvent("on"+c,v):p["on"+c]=v},h={autoRun:!0,barThickness:3,barColors:{0:"rgba(26, 188, 156, .9)",".25":"rgba(52, 152, 219, .9)",".50":"rgba(241, 196, 15, .9)",".75":"rgba(230, 126, 34, .9)","1.0":"rgba(211, 84, 0, .9)"},shadowBlur:10,shadowColor:"rgba(0, 0, 0, .6)",className:null},u=function(){i.width=e.innerWidth,i.height=h.barThickness*5;var p=i.getContext("2d");p.shadowBlur=h.shadowBlur,p.shadowColor=h.shadowColor;var c=p.createLinearGradient(0,0,i.width,0);for(var v in h.barColors)c.addColorStop(v,h.barColors[v]);p.lineWidth=h.barThickness,p.beginPath(),p.moveTo(0,h.barThickness/2),p.lineTo(Math.ceil(s*i.width),h.barThickness/2),p.strokeStyle=c,p.stroke()},m=function(){i=t.createElement("canvas");var p=i.style;p.position="fixed",p.top=p.left=p.right=p.margin=p.padding=0,p.zIndex=100001,p.display="none",h.className&&i.classList.add(h.className),t.body.appendChild(i),l(e,"resize",u)},g={config:function(p){for(var c in p)h.hasOwnProperty(c)&&(h[c]=p[c])},show:function(p){if(!n)if(p){if(a)return;a=setTimeout(()=>g.show(),p)}else n=!0,o!==null&&e.cancelAnimationFrame(o),i||m(),i.style.opacity=1,i.style.display="block",g.progress(0),h.autoRun&&function c(){r=e.requestAnimationFrame(c),g.progress("+"+.05*Math.pow(1-Math.sqrt(s),2))}()},progress:function(p){return typeof p=="undefined"||(typeof p=="string"&&(p=(p.indexOf("+")>=0||p.indexOf("-")>=0?s:0)+parseFloat(p)),s=p>1?1:p,u()),s},hide:function(){clearTimeout(a),a=null,n&&(n=!1,r!=null&&(e.cancelAnimationFrame(r),r=null),function p(){if(g.progress("+.1")>=1&&(i.style.opacity-=.05,i.style.opacity<=.05)){i.style.display="none",o=null;return}o=e.requestAnimationFrame(p)}())}};typeof $e=="object"&&typeof $e.exports=="object"?$e.exports=g:typeof define=="function"&&define.amd?define(function(){return g}):this.topbar=g}).call(Lt,window,document)});(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")),h=document.createElement("form"),u=document.createElement("input"),m=n.getAttribute("target");h.method=n.getAttribute("data-method")==="get"?"get":"post",h.action=o,h.style.display="none",m?h.target=m:r&&(h.target="_blank"),h.appendChild(l),h.appendChild(a),document.body.appendChild(h),u.type="submit",h.appendChild(u),u.click()}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")&&r.getAttribute("data-to"))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 Ae=e=>typeof e=="function"?e:function(){return e},xi=typeof self!="undefined"?self:null,ke=typeof window!="undefined"?window:null,ae=xi||ke||ae,Li="2.0.0",W={connecting:0,open:1,closing:2,closed:3},Ii=1e4,Oi=1e3,$={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Y={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},rt={longpoll:"longpoll",websocket:"websocket"},Di={complete:4},Fe=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})}},Pt=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))}},Hi=class{constructor(e,t,i){this.state=$.closed,this.topic=e,this.params=Ae(t||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Fe(this,Y.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Pt(()=>{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=$.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=$.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=$.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=$.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 Fe(this,Y.leave,Ae({}),this.timeout).send(),this.state=$.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Y.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(Y.close,e)}onError(e){return this.on(Y.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 Fe(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=$.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Y.close,"leave")},i=new Fe(this,Y.leave,Ae({}),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=$.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===$.closed}isErrored(){return this.state===$.errored}isJoined(){return this.state===$.joined}isJoining(){return this.state===$.joining}isLeaving(){return this.state===$.leaving}},Ue=class{static request(e,t,i,s,n,r,o){if(ae.XDomainRequest){let a=new ae.XDomainRequest;return this.xdomainRequest(a,e,t,s,n,r,o)}else{let a=new ae.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===Di.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)}`}},Ni=e=>{let t="",i=new Uint8Array(e),s=i.byteLength;for(let n=0;n<s;n++)t+=String.fromCharCode(i[n]);return btoa(t)},ye=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=W.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+rt.websocket),"$1/"+rt.longpoll)}endpointURL(){return Ue.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,i){this.close(e,t,i),this.readyState=W.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===W.open||this.readyState===W.connecting}poll(){this.ajax("GET","application/json",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=W.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){typeof e!="string"&&(e=Ni(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",e.join(`
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,i){for(let n of this.reqs)n.abort();this.readyState=W.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:i});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent!="undefined"?this.onclose(new CloseEvent("close",s)):this.onclose(s)}ajax(e,t,i,s,n){let r,o=()=>{this.reqs.delete(r),s()};r=Ue.request(e,this.endpointURL(),t,i,this.timeout,o,a=>{this.reqs.delete(r),this.isActive()&&n(a)}),this.reqs.add(r)}};var Me={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),h=0;l.setUint8(h++,this.KINDS.push),l.setUint8(h++,t.length),l.setUint8(h++,i.length),l.setUint8(h++,n.length),l.setUint8(h++,s.length),Array.from(t,m=>l.setUint8(h++,m.charCodeAt(0))),Array.from(i,m=>l.setUint8(h++,m.charCodeAt(0))),Array.from(n,m=>l.setUint8(h++,m.charCodeAt(0))),Array.from(s,m=>l.setUint8(h++,m.charCodeAt(0)));var u=new Uint8Array(a.byteLength+r.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(r),a.byteLength),u.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 h=i.decode(e.slice(o,o+r));o=o+r;let u=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:l,event:h,payload:u}},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 h=i.decode(e.slice(a,a+n));a=a+n;let u=i.decode(e.slice(a,a+r));a=a+r;let m=i.decode(e.slice(a,a+o));a=a+o;let g=e.slice(a,e.byteLength),p={status:m,response:g};return{join_ref:l,ref:h,topic:u,event:Y.reply,payload:p}},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}}},xt=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||Ii,this.transport=t.transport||ae.WebSocket||ye,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||ae&&ae.sessionStorage,this.establishedConnections=0,this.defaultEncoder=Me.encode.bind(Me),this.defaultDecoder=Me.decode.bind(Me),this.closeWasClean=!1,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==ye?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;ke&&ke.addEventListener&&(ke.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock)}),ke.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.logger&&t.debug&&(this.logger=(s,n,r)=>{console.log(`${s}: ${n}`,r)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Ae(t.params||{}),this.endPoint=`${e}/${rt.websocket}`,this.vsn=t.vsn||Li,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Pt(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return ye}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Ue.appendParams(Ue.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.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,i)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Ae(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==ye?this.connectWithFallback(ye,this.longPollFallbackMs):this.transportConnect())}log(e,t,i){this.logger&&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}transportConnect(){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=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let i=!1,s=!0,n,r,o=a=>{this.log("transport",`falling back to ${e.name}...`,a),this.off([n,r]),s=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),r=this.onError(a=>{this.log("transport","error",a),s&&!i&&(clearTimeout(this.fallbackTimer),o(a))}),this.onOpen(()=>{if(i=!0,!s)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),this.ping(a=>{this.log("transport","connected to primary after",a),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Oi,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,i){if(!this.conn)return e&&e();let s=this.connectClock;this.waitForBufferDone(()=>{s===this.connectClock&&(this.conn&&(t?this.conn.close(t,i||""):this.conn.close()),this.waitForSocketClosed(()=>{s===this.connectClock&&(this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},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===W.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(),this.clearHeartbeats(),!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(Y.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case W.connecting:return"connecting";case W.open:return"open";case W.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}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 Hi(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.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}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&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=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 et=Pi(It());var ai="consecutive-reloads",Fi=10,Mi=5e3,Ui=1e4,$i=3e4,li=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading","phx-hook-loading"],Z="data-phx-component",ot="data-phx-link",ji="track-static",Bi="data-phx-link-state",we="data-phx-ref-loading",V="data-phx-ref-src",x="data-phx-ref-lock",Ot="phx-pending-refs",hi="track-uploads",ee="data-phx-upload-ref",wt="data-phx-preflighted-refs",Ji="data-phx-done-refs",Dt="drop-target",ut="data-phx-active-refs",ze="phx:live-file:updated",di="data-phx-skip",ci="data-phx-id",Ht="data-phx-prune",Nt="phx-connected",le="phx-loading",ge="phx-error",Ft="phx-client-error",Se="phx-server-error",ue="data-phx-parent-id",yt="data-phx-main",re="data-phx-root-id",ft="viewport-top",pt="viewport-bottom",Vi="trigger-action",Ye="phx-has-focused",qi=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],ui=["checkbox","radio"],Oe="phx-has-submitted",K="data-phx-session",fe=`[${K}]`,mt="data-phx-sticky",de="data-phx-static",gt="data-phx-readonly",be="data-phx-disabled",Mt="disable-with",Qe="data-phx-disable-with-restore",Ee="hook",Wi="debounce",Xi="throttle",Ze="update",Ke="stream",Ce="data-phx-stream",zi="key",X="phxPrivate",Ut="auto-recover",je="phx:live-socket:debug",at="phx:live-socket:profiling",lt="phx:live-socket:latency-sim",Be="phx:nav-history-position",Ki="progress",$t="mounted",jt="__phoenix_reload_status__",Gi=1,Bt=3,Yi=200,Qi=500,Zi="phx-",es=3e4,_e="debounce-trigger",Te="throttled",Jt="debounce-prev-key",ts={debounce:300,throttle:300},Vt=[we,V,x],Je="d",z="s",ht="r",N="c",qt="e",Wt="r",Xt="t",is="p",zt="stream",ss=class{constructor(e,t,i){let{chunk_size:s,chunk_timeout:n}=t;this.liveSocket=i,this.entry=e,this.offset=0,this.chunkSize=s,this.chunkTimeout=n,this.chunkTimer=null,this.errored=!1,this.uploadChannel=i.channel(`lvu:${e.ref}`,{token:e.metadata()})}error(e){this.errored||(this.uploadChannel.leave(),this.errored=!0,clearTimeout(this.chunkTimer),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 R("Read error: "+i.target.error)},e.readAsArrayBuffer(t)}pushChunk(e){this.uploadChannel.isJoined()&&this.uploadChannel.push("chunk",e,this.chunkTimeout).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))}).receive("error",({reason:t})=>this.error(t))}},R=(e,t)=>console.error&&console.error(e,t),Q=e=>{let t=typeof e;return t==="number"||t==="string"&&/^(0|[1-9]\d*)$/.test(e)};function ns(){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)}function rs(e){let t=new Set;Object.keys(e).forEach(i=>{let s=document.getElementById(i);s&&s.parentElement&&s.parentElement.getAttribute("phx-update")!=="stream"&&t.add(`The stream container with id "${s.parentElement.id}" is missing the phx-update="stream" attribute. Ensure it is set for streams to work properly.`)}),t.forEach(i=>console.error(i))}var os=(e,t,i,s)=>{e.liveSocket.isDebugEnabled()&&console.log(`${e.id} ${t}: ${i} - `,s)},Re=e=>typeof e=="function"?e:function(){return e},Ge=e=>JSON.parse(JSON.stringify(e)),Ie=(e,t,i)=>{do{if(e.matches(`[${t}]`)&&!e.disabled)return e;e=e.parentElement||e.parentNode}while(e!==null&&e.nodeType===1&&!(i&&i.isSameNode(e)||e.matches(fe)));return null},ve=e=>e!==null&&typeof e=="object"&&!(e instanceof Array),as=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Kt=e=>{for(let t in e)return!1;return!0},ce=(e,t)=>e&&t(e),ls=function(e,t,i,s){e.forEach(n=>{new ss(n,i.config,s).upload()})},hs={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 s=history.state||{};s.scroll=t.scroll,history.replaceState(s,"",window.location.href)}delete t.scroll,history[e+"State"](t,"",i||null),window.requestAnimationFrame(()=>{let s=this.getHashTargetEl(window.location.hash);s?s.scrollIntoView():t.type==="redirect"&&window.scroll(0,0)})}}else this.redirect(i)},setCookie(e,t,i){let s=typeof i=="number"?` max-age=${i};`:"";document.cookie=`${e}=${t};${s} path=/`},getCookie(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${e}s*=s*([^;]*).*$)|^.*$`),"$1")},deleteCookie(e){document.cookie=`${e}=; max-age=-1; path=/`},redirect(e,t){t&&this.setCookie("__phoenix_flash__",t,60),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}"]`)}},M=hs,he={byId(e){return document.getElementById(e)||R(`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(ee)!==null},isAutoUpload(e){return e.hasAttribute("data-phx-auto-upload")},findUploadInputs(e){let t=e.id,i=this.all(document,`input[type="file"][${ee}][form="${t}"]`);return this.all(e,`input[type="file"][${ee}]`).concat(i)},findComponentNodeList(e,t){return this.filterWithinSameLiveView(this.all(e,`[${Z}="${t}"]`),e)},isPhxDestroyed(e){return!!(e.id&&he.private(e,"destroyed"))},wantsNewTab(e){let t=e.ctrlKey||e.shiftKey||e.metaKey||e.button&&e.button===1,i=e.target instanceof HTMLAnchorElement&&e.target.hasAttribute("download"),s=e.target.hasAttribute("target")&&e.target.getAttribute("target").toLowerCase()==="_blank",n=e.target.hasAttribute("target")&&!e.target.getAttribute("target").startsWith("_");return t||s||i||n},isUnloadableFormSubmit(e){return e.target&&e.target.getAttribute("method")==="dialog"||e.submitter&&e.submitter.getAttribute("formmethod")==="dialog"?!1:!e.defaultPrevented&&!this.wantsNewTab(e)},isNewPageClick(e,t){let i=e.target instanceof HTMLAnchorElement?e.target.getAttribute("href"):null,s;if(e.defaultPrevented||i===null||this.wantsNewTab(e)||i.startsWith("mailto:")||i.startsWith("tel:")||e.target.isContentEditable)return!1;try{s=new URL(i)}catch(n){try{s=new URL(i,t)}catch(r){return!0}}return s.host===t.host&&s.protocol===t.protocol&&s.pathname===t.pathname&&s.search===t.search?s.hash===""&&!s.href.endsWith("#"):s.protocol.startsWith("http")},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,`[${mt}]`)},findPhxChildren(e,t){return this.all(e,`${fe}[${ue}="${t}"]`)},findExistingParentCIDs(e,t){let i=new Set,s=new Set;return t.forEach(n=>{this.filterWithinSameLiveView(this.all(e,`[${Z}="${n}"]`),e).forEach(r=>{i.add(n),this.filterWithinSameLiveView(this.all(r,`[${Z}]`),r).map(o=>parseInt(o.getAttribute(Z))).forEach(o=>s.add(o))})}),s.forEach(n=>i.delete(n)),i},filterWithinSameLiveView(e,t){return t.querySelector(fe)?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[X]&&e[X][t]},deletePrivate(e,t){e[X]&&delete e[X][t]},putPrivate(e,t,i){e[X]||(e[X]={}),e[X][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))},syncPendingAttrs(e,t){e.hasAttribute(V)&&(li.forEach(i=>{e.classList.contains(i)&&t.classList.add(i)}),Vt.filter(i=>e.hasAttribute(i)).forEach(i=>{t.setAttribute(i,e.getAttribute(i))}))},copyPrivates(e,t){t[X]&&(e[X]=t[X])},putTitle(e){let t=document.querySelector("title");if(t){let{prefix:i,suffix:s,default:n}=t.dataset,r=typeof e!="string"||e.trim()==="";if(r&&typeof n!="string")return;let o=r?n:e;document.title=`${i||""}${o||""}${s||""}`}else document.title=e},debounce(e,t,i,s,n,r,o,a){let l=e.getAttribute(i),h=e.getAttribute(n);l===""&&(l=s),h===""&&(h=r);let u=l||h;switch(u){case null:return a();case"blur":this.incCycle(e,"debounce-blur-cycle",()=>{o()&&a()}),this.once(e,"debounce-blur")&&e.addEventListener("blur",()=>this.triggerCycle(e,"debounce-blur-cycle"));return;default:let m=parseInt(u),g=()=>h?this.deletePrivate(e,Te):a(),p=this.incCycle(e,_e,g);if(isNaN(m))return R(`invalid throttle/debounce value: ${u}`);if(h){let v=!1;if(t.type==="keydown"){let b=this.private(e,Jt);this.putPrivate(e,Jt,t.key),v=b!==t.key}if(!v&&this.private(e,Te))return!1;{a();let b=setTimeout(()=>{o()&&this.triggerCycle(e,_e)},m);this.putPrivate(e,Te,b)}}else setTimeout(()=>{o()&&this.triggerCycle(e,_e,p)},m);let c=e.form;c&&this.once(c,"bind-debounce")&&c.addEventListener("submit",()=>{Array.from(new FormData(c).entries(),([v])=>{let b=c.querySelector(`[name="${v}"]`);this.incCycle(b,_e),this.deletePrivate(b,Te)})}),this.once(e,"bind-debounce")&&e.addEventListener("blur",()=>{clearTimeout(this.private(e,Te)),this.triggerCycle(e,_e)})}},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},maintainPrivateHooks(e,t,i,s){e.hasAttribute&&e.hasAttribute("data-phx-hook")&&!t.hasAttribute("data-phx-hook")&&t.setAttribute("data-phx-hook",e.getAttribute("data-phx-hook")),t.hasAttribute&&(t.hasAttribute(i)||t.hasAttribute(s))&&t.setAttribute("data-phx-hook","Phoenix.InfiniteScroll")},putCustomElHook(e,t){e.isConnected?e.setAttribute("data-phx-hook",""):console.error(`
hook attached to non-connected DOM element
ensure you are calling createHook within your connectedCallback. ${e.outerHTML}
`),this.putPrivate(e,"custom-el-hook",t)},getCustomElHook(e){return this.private(e,"custom-el-hook")},isUsedInput(e){return e.nodeType===Node.ELEMENT_NODE&&(this.private(e,Ye)||this.private(e,Oe))},resetForm(e){Array.from(e.elements).forEach(t=>{this.deletePrivate(t,Ye),this.deletePrivate(t,Oe)})},isPhxChild(e){return e.getAttribute&&e.getAttribute(ue)},isPhxSticky(e){return e.getAttribute&&e.getAttribute(mt)!==null},isChildOfAny(e,t){return!!t.find(i=>i.contains(e))},firstPhxChild(e){return this.isPhxChild(e)?e:this.all(e,`[${ue}]`)[0]},dispatchEvent(e,t,i={}){let s=!0;e.nodeName==="INPUT"&&e.type==="file"&&t==="click"&&(s=!1);let o={bubbles:i.bubbles===void 0?s:!!i.bubbles,cancelable:!0,detail:i.detail||{}},a=t==="click"?new MouseEvent("click",o):new CustomEvent(t,o);e.dispatchEvent(a)},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=new Set(i.exclude||[]),n=i.isIgnored,r=t.attributes;for(let a=r.length-1;a>=0;a--){let l=r[a].name;if(s.has(l))l==="value"&&e.value===t.value&&e.setAttribute("value",t.getAttribute(l));else{let h=t.getAttribute(l);e.getAttribute(l)!==h&&(!n||n&&l.startsWith("data-"))&&e.setAttribute(l,h)}}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)&&!Vt.includes(l)&&e.removeAttribute(l):t.hasAttribute(l)||e.removeAttribute(l)}},mergeFocusedInput(e,t){e instanceof HTMLSelectElement||he.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(e instanceof HTMLSelectElement&&e.focus(),!he.isTextualInput(e))return;e.matches(":focus")||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&&ui.indexOf(e.type.toLocaleLowerCase())>=0&&(e.checked=e.getAttribute("checked")!==null)},isTextualInput(e){return qi.indexOf(e.type)>=0},isNowTriggerFormExternal(e,t){return e.getAttribute&&e.getAttribute(t)!==null&&document.body.contains(e)},cleanChildNodes(e,t){if(he.isPhxUpdate(e,t,["append","prepend",Ke])){let i=[];e.childNodes.forEach(s=>{s.id||(!(s.nodeType===Node.TEXT_NODE&&s.nodeValue.trim()==="")&&s.nodeType!==Node.COMMENT_NODE&&R(`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,de,yt,re]);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=(he.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=he.private(e,"sticky");t&&t.forEach(([i,s,n])=>this.putSticky(e,i,s))},isLocked(e){return e.hasAttribute&&e.hasAttribute(x)}},d=he,Pe=class{static isActive(e,t){let i=t._phxRef===void 0,n=e.getAttribute(ut).split(",").indexOf(I.genFileRef(t))>=0;return t.size>0&&(i||n)}static isPreflighted(e,t){return e.getAttribute(wt).split(",").indexOf(I.genFileRef(t))>=0&&this.isActive(e,t)}static isPreflightInProgress(e){return e._preflightInProgress===!0}static markPreflightInProgress(e){e._preflightInProgress=!0}constructor(e,t,i,s){this.ref=I.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(ze,this._onElUpdated),this.autoUpload=s}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,()=>{I.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}isCancelled(){return this._isCancelled}cancel(){this.file._preflightInProgress=!1,this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(e="failed"){this.fileEl.removeEventListener(ze,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),this.isAutoUpload()||I.clearFiles(this.fileEl)}isAutoUpload(){return this.autoUpload}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(ze,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(ut).split(",").indexOf(this.ref)===-1&&(I.untrackFile(this.fileEl,this.file),this.cancel())}toPreflightPayload(){return{last_modified:this.file.lastModified,name:this.file.name,relative_path:this.file.webkitRelativePath,size:this.file.size,type:this.file.type,ref:this.ref,meta:typeof this.file.meta=="function"?this.file.meta():void 0}}uploader(e){if(this.meta.uploader){let t=e[this.meta.uploader]||R(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:ls}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||R(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}},ds=0,I=class vt{static genFileRef(t){let i=t._phxRef;return i!==void 0?i:(t._phxRef=(ds++).toString(),t._phxRef)}static getEntryDataURL(t,i,s){let n=this.activeFiles(t).find(r=>this.genFileRef(r)===i);s(URL.createObjectURL(n))}static hasUploadsInProgress(t){let i=0;return d.findUploadInputs(t).forEach(s=>{s.getAttribute(wt)!==s.getAttribute(Ji)&&i++}),i>0}static serializeUploads(t){let i=this.activeFiles(t),s={};return i.forEach(n=>{let r={path:t.name},o=t.getAttribute(ee);s[o]=s[o]||[],r.ref=this.genFileRef(n),r.last_modified=n.lastModified,r.name=n.name||r.ref,r.relative_path=n.webkitRelativePath,r.type=n.type,r.size=n.size,typeof n.meta=="function"&&(r.meta=n.meta()),s[o].push(r)}),s}static clearFiles(t){t.value=null,t.removeAttribute(ee),d.putPrivate(t,"files",[])}static untrackFile(t,i){d.putPrivate(t,"files",d.private(t,"files").filter(s=>!Object.is(s,i)))}static trackFiles(t,i,s){if(t.getAttribute("multiple")!==null){let n=i.filter(r=>!this.activeFiles(t).find(o=>Object.is(o,r)));d.updatePrivate(t,"files",[],r=>r.concat(n)),t.value=null}else s&&s.files.length>0&&(t.files=s.files),d.putPrivate(t,"files",i)}static activeFileInputs(t){let i=d.findUploadInputs(t);return Array.from(i).filter(s=>s.files&&this.activeFiles(s).length>0)}static activeFiles(t){return(d.private(t,"files")||[]).filter(i=>Pe.isActive(t,i))}static inputsAwaitingPreflight(t){let i=d.findUploadInputs(t);return Array.from(i).filter(s=>this.filesAwaitingPreflight(s).length>0)}static filesAwaitingPreflight(t){return this.activeFiles(t).filter(i=>!Pe.isPreflighted(t,i)&&!Pe.isPreflightInProgress(i))}static markPreflightInProgress(t){t.forEach(i=>Pe.markPreflightInProgress(i.file))}constructor(t,i,s){this.autoUpload=d.isAutoUpload(t),this.view=i,this.onComplete=s,this._entries=Array.from(vt.filesAwaitingPreflight(t)||[]).map(n=>new Pe(t,n,i,this.autoUpload)),vt.markPreflightInProgress(this._entries),this.numEntriesInProgress=this._entries.length}isAutoUpload(){return this.autoUpload}entries(){return this._entries}initAdapterUpload(t,i,s){this._entries=this._entries.map(r=>(r.isCancelled()?(this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()):(r.zipPostFlight(t),r.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()})),r));let n=this._entries.reduce((r,o)=>{if(!o.meta)return r;let{name:a,callback:l}=o.uploader(s.uploaders);return r[a]=r[a]||{callback:l,entries:[]},r[a].entries.push(o),r},{});for(let r in n){let{callback:o,entries:a}=n[r];o(a,i,t,s)}}},cs={anyOf(e,t){return t.find(i=>e instanceof i)},isFocusable(e,t){return e instanceof HTMLAnchorElement&&e.rel!=="ignore"||e instanceof HTMLAreaElement&&e.href!==void 0||!e.disabled&&this.anyOf(e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||e instanceof HTMLIFrameElement||e.tabIndex>=0&&e.getAttribute("aria-hidden")!=="true"||!t&&e.getAttribute("tabindex")!==null&&e.getAttribute("aria-hidden")!=="true"},attemptFocus(e,t){if(this.isFocusable(e,t))try{e.focus()}catch(i){}return!!document.activeElement&&document.activeElement.isSameNode(e)},focusFirstInteractive(e){let t=e.firstElementChild;for(;t;){if(this.attemptFocus(t,!0)||this.focusFirstInteractive(t,!0))return!0;t=t.nextElementSibling}},focusFirst(e){let t=e.firstElementChild;for(;t;){if(this.attemptFocus(t)||this.focusFirst(t))return!0;t=t.nextElementSibling}},focusLast(e){let t=e.lastElementChild;for(;t;){if(this.attemptFocus(t)||this.focusLast(t))return!0;t=t.previousElementSibling}}},j=cs,fi={LiveFileUpload:{activeRefs(){return this.el.getAttribute(ut)},preflightedRefs(){return this.el.getAttribute(wt)},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(ze))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(ee)),I.getEntryDataURL(this.inputEl,this.ref,e=>{this.url=e,this.el.src=e})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",e=>{if(!e.relatedTarget||!this.el.contains(e.relatedTarget)){let t=e.target.nextElementSibling;j.attemptFocus(t)||j.focusFirst(t)}else j.focusLast(this.el)}),this.focusEnd.addEventListener("focus",e=>{if(!e.relatedTarget||!this.el.contains(e.relatedTarget)){let t=e.target.previousElementSibling;j.attemptFocus(t)||j.focusLast(t)}else j.focusFirst(this.el)}),this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&j.focusFirst(this.el)}}},pi=e=>["HTML","BODY"].indexOf(e.nodeName.toUpperCase())>=0?null:["scroll","auto"].indexOf(getComputedStyle(e).overflowY)>=0?e:pi(e.parentElement),Gt=e=>e?e.scrollTop:document.documentElement.scrollTop||document.body.scrollTop,kt=e=>e?e.getBoundingClientRect().bottom:window.innerHeight||document.documentElement.clientHeight,At=e=>e?e.getBoundingClientRect().top:0,us=(e,t)=>{let i=e.getBoundingClientRect();return Math.ceil(i.top)>=At(t)&&Math.ceil(i.left)>=0&&Math.floor(i.top)<=kt(t)},fs=(e,t)=>{let i=e.getBoundingClientRect();return Math.ceil(i.bottom)>=At(t)&&Math.ceil(i.left)>=0&&Math.floor(i.bottom)<=kt(t)},Yt=(e,t)=>{let i=e.getBoundingClientRect();return Math.ceil(i.top)>=At(t)&&Math.ceil(i.left)>=0&&Math.floor(i.top)<=kt(t)};fi.InfiniteScroll={mounted(){this.scrollContainer=pi(this.el);let e=Gt(this.scrollContainer),t=!1,i=500,s=null,n=this.throttle(i,(a,l)=>{s=()=>!0,this.liveSocket.execJSHookPush(this.el,a,{id:l.id,_overran:!0},()=>{s=null})}),r=this.throttle(i,(a,l)=>{s=()=>l.scrollIntoView({block:"start"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{s=null,window.requestAnimationFrame(()=>{Yt(l,this.scrollContainer)||l.scrollIntoView({block:"start"})})})}),o=this.throttle(i,(a,l)=>{s=()=>l.scrollIntoView({block:"end"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{s=null,window.requestAnimationFrame(()=>{Yt(l,this.scrollContainer)||l.scrollIntoView({block:"end"})})})});this.onScroll=a=>{let l=Gt(this.scrollContainer);if(s)return e=l,s();let h=this.el.getBoundingClientRect(),u=this.el.getAttribute(this.liveSocket.binding("viewport-top")),m=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),g=this.el.lastElementChild,p=this.el.firstElementChild,c=l<e,v=l>e;c&&u&&!t&&h.top>=0?(t=!0,n(u,p)):v&&t&&h.top<=0&&(t=!1),u&&c&&us(p,this.scrollContainer)?r(u,p):m&&v&&fs(g,this.scrollContainer)&&o(m,g),e=l},this.scrollContainer?this.scrollContainer.addEventListener("scroll",this.onScroll):window.addEventListener("scroll",this.onScroll)},destroyed(){this.scrollContainer?this.scrollContainer.removeEventListener("scroll",this.onScroll):window.removeEventListener("scroll",this.onScroll)},throttle(e,t){let i=0,s;return(...n)=>{let r=Date.now(),o=e-(r-i);o<=0||o>e?(s&&(clearTimeout(s),s=null),i=r,t(...n)):s||(s=setTimeout(()=>{i=Date.now(),s=null,t(...n)},o))}}};var ps=fi,bt=class{static onUnlock(e,t){if(!d.isLocked(e)&&!e.closest(`[${x}]`))return t();let i=e.closest(`[${x}]`),s=i.closest(`[${x}]`).getAttribute(x);i.addEventListener(`phx:undo-lock:${s}`,()=>{t()},{once:!0})}constructor(e){this.el=e,this.loadingRef=e.hasAttribute(we)?parseInt(e.getAttribute(we),10):null,this.lockRef=e.hasAttribute(x)?parseInt(e.getAttribute(x),10):null}maybeUndo(e,t,i){if(!this.isWithin(e)){d.updatePrivate(this.el,Ot,[],s=>(s.push(e),s));return}this.undoLocks(e,t,i),this.undoLoading(e,t),d.updatePrivate(this.el,Ot,[],s=>s.filter(n=>{let r={detail:{ref:n,event:t},bubbles:!0,cancelable:!1};return this.loadingRef&&this.loadingRef>n&&this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${n}`,r)),this.lockRef&&this.lockRef>n&&this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${n}`,r)),n>e})),this.isFullyResolvedBy(e)&&this.el.removeAttribute(V)}isWithin(e){return!(this.loadingRef!==null&&this.loadingRef>e&&this.lockRef!==null&&this.lockRef>e)}undoLocks(e,t,i){if(!this.isLockUndoneBy(e))return;let s=d.private(this.el,x);s&&(i(s),d.deletePrivate(this.el,x)),this.el.removeAttribute(x);let n={detail:{ref:e,event:t},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${this.lockRef}`,n))}undoLoading(e,t){if(!this.isLoadingUndoneBy(e)){this.canUndoLoading(e)&&this.el.classList.contains("phx-submit-loading")&&this.el.classList.remove("phx-change-loading");return}if(this.canUndoLoading(e)){this.el.removeAttribute(we);let i=this.el.getAttribute(be),s=this.el.getAttribute(gt);s!==null&&(this.el.readOnly=s==="true",this.el.removeAttribute(gt)),i!==null&&(this.el.disabled=i==="true",this.el.removeAttribute(be));let n=this.el.getAttribute(Qe);n!==null&&(this.el.innerText=n,this.el.removeAttribute(Qe));let r={detail:{ref:e,event:t},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${this.loadingRef}`,r))}li.forEach(i=>{(i!=="phx-submit-loading"||this.canUndoLoading(e))&&d.removeClass(this.el,i)})}isLoadingUndoneBy(e){return this.loadingRef===null?!1:this.loadingRef<=e}isLockUndoneBy(e){return this.lockRef===null?!1:this.lockRef<=e}isFullyResolvedBy(e){return(this.loadingRef===null||this.loadingRef<=e)&&(this.lockRef===null||this.lockRef<=e)}canUndoLoading(e){return this.lockRef===null||this.lockRef<=e}},ms=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?ce(document.getElementById(t.previousElementId),i=>{ce(document.getElementById(t.elementId),s=>{s.previousElementSibling&&s.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",s)})}):ce(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(t=>{ce(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))})}},Qt=11;function gs(e,t){var i=t.attributes,s,n,r,o,a;if(!(t.nodeType===Qt||e.nodeType===Qt)){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 h=e.attributes,u=h.length-1;u>=0;u--)s=h[u],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 Ve,vs="http://www.w3.org/1999/xhtml",U=typeof document=="undefined"?void 0:document,bs=!!U&&"content"in U.createElement("template"),ws=!!U&&U.createRange&&"createContextualFragment"in U.createRange();function ys(e){var t=U.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}function ks(e){Ve||(Ve=U.createRange(),Ve.selectNode(U.body));var t=Ve.createContextualFragment(e);return t.childNodes[0]}function As(e){var t=U.createElement("body");return t.innerHTML=e,t.childNodes[0]}function Ss(e){return e=e.trim(),bs?ys(e):ws?ks(e):As(e)}function qe(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 Es(e,t){return!t||t===vs?U.createElement(e):U.createElementNS(t,e)}function Cs(e,t){for(var i=e.firstChild;i;){var s=i.nextSibling;t.appendChild(i),i=s}return t}function dt(e,t,i){e[i]!==t[i]&&(e[i]=t[i],e[i]?e.setAttribute(i,""):e.removeAttribute(i))}var Zt={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)}dt(e,t,"selected")},INPUT:function(e,t){dt(e,t,"checked"),dt(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}}},xe=1,ei=11,ti=3,ii=8;function ne(){}function _s(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}function Ts(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=U.createElement("html"),s.innerHTML=r}else s=Ss(s);else s.nodeType===ei&&(s=s.firstElementChild);var o=n.getNodeKey||_s,a=n.onBeforeNodeAdded||ne,l=n.onNodeAdded||ne,h=n.onBeforeElUpdated||ne,u=n.onElUpdated||ne,m=n.onBeforeNodeDiscarded||ne,g=n.onNodeDiscarded||ne,p=n.onBeforeElChildrenUpdated||ne,c=n.skipFromChildren||ne,v=n.addChild||function(y,k){return y.appendChild(k)},b=n.childrenOnly===!0,O=Object.create(null),A=[];function _(y){A.push(y)}function D(y,k){if(y.nodeType===xe)for(var T=y.firstChild;T;){var S=void 0;k&&(S=o(T))?_(S):(g(T),T.firstChild&&D(T,k)),T=T.nextSibling}}function H(y,k,T){m(y)!==!1&&(k&&k.removeChild(y),g(y),D(y,T))}function f(y){if(y.nodeType===xe||y.nodeType===ei)for(var k=y.firstChild;k;){var T=o(k);T&&(O[T]=k),f(k),k=k.nextSibling}}f(i);function w(y){l(y);for(var k=y.firstChild;k;){var T=k.nextSibling,S=o(k);if(S){var E=O[S];E&&qe(k,E)?(k.parentNode.replaceChild(E,k),B(E,k)):w(k)}else w(k);k=T}}function q(y,k,T){for(;k;){var S=k.nextSibling;(T=o(k))?_(T):H(k,y,!0),k=S}}function B(y,k,T){var S=o(k);if(S&&delete O[S],!T){var E=h(y,k);if(E===!1||(E instanceof HTMLElement&&(y=E,f(y)),e(y,k),u(y),p(y,k)===!1))return}y.nodeName!=="TEXTAREA"?L(y,k):Zt.TEXTAREA(y,k)}function L(y,k){var T=c(y,k),S=k.firstChild,E=y.firstChild,pe,G,me,De,ie;e:for(;S;){for(De=S.nextSibling,pe=o(S);!T&&E;){if(me=E.nextSibling,S.isSameNode&&S.isSameNode(E)){S=De,E=me;continue e}G=o(E);var He=E.nodeType,se=void 0;if(He===S.nodeType&&(He===xe?(pe?pe!==G&&((ie=O[pe])?me===ie?se=!1:(y.insertBefore(ie,E),G?_(G):H(E,y,!0),E=ie,G=o(E)):se=!1):G&&(se=!1),se=se!==!1&&qe(E,S),se&&B(E,S)):(He===ti||He==ii)&&(se=!0,E.nodeValue!==S.nodeValue&&(E.nodeValue=S.nodeValue))),se){S=De,E=me;continue e}G?_(G):H(E,y,!0),E=me}if(pe&&(ie=O[pe])&&qe(ie,S))T||v(y,ie),B(ie,S);else{var st=a(S);st!==!1&&(st&&(S=st),S.actualize&&(S=S.actualize(y.ownerDocument||U)),v(y,S),w(S))}S=De,E=me}q(y,E,G);var Ct=Zt[y.nodeName];Ct&&Ct(y,k)}var P=i,F=P.nodeType,Et=s.nodeType;if(!b){if(F===xe)Et===xe?qe(i,s)||(g(i),P=Cs(i,Es(s.nodeName,s.namespaceURI))):P=s;else if(F===ti||F===ii){if(Et===F)return P.nodeValue!==s.nodeValue&&(P.nodeValue=s.nodeValue),P;P=s}}if(P===s)g(i);else{if(s.isSameNode&&s.isSameNode(P))return;if(B(P,s,b),A)for(var tt=0,wi=A.length;tt<wi;tt++){var it=O[A[tt]];it&&H(it,it.parentNode,!1)}}return!b&&P!==i&&i.parentNode&&(P.actualize&&(P=P.actualize(i.ownerDocument||U)),i.parentNode.replaceChild(P,i)),P}}var Rs=Ts(gs),mi=Rs,We=class{constructor(e,t,i,s,n,r,o={}){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=s,this.streams=n,this.streamInserts={},this.streamComponentRestore={},this.targetCID=r,this.cidPatch=Q(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.targetContainer=this.isCIDPatch()?this.targetCIDContainer(s):t,this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]},this.withChildren=o.withChildren||o.undoRef||!1,this.undoRef=o.undoRef}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(){let e=this.liveSocket.binding(Ze);d.all(this.container,`[${e}=append] > *, [${e}=prepend] > *`,t=>{t.setAttribute(Ht,"")})}perform(e){let{view:t,liveSocket:i,html:s,container:n,targetContainer:r}=this;if(this.isCIDPatch()&&!r)return;let o=i.getActiveElement(),{selectionStart:a,selectionEnd:l}=o&&d.hasSelectionRange(o)?o:{},h=i.binding(Ze),u=i.binding(ft),m=i.binding(pt),g=i.binding(Vi),p=[],c=[],v=[],b=null;function O(A,_,D=this.withChildren){let H={childrenOnly:A.getAttribute(Z)===null&&!D,getNodeKey:f=>d.isPhxDestroyed(f)?null:e?f.id:f.id||f.getAttribute&&f.getAttribute(ci),skipFromChildren:f=>f.getAttribute(h)===Ke,addChild:(f,w)=>{let{ref:q,streamAt:B}=this.getStreamInsert(w);if(q===void 0)return f.appendChild(w);if(this.setStreamRef(w,q),B===0)f.insertAdjacentElement("afterbegin",w);else if(B===-1){let L=f.lastElementChild;if(L&&!L.hasAttribute(Ce)){let P=Array.from(f.children).find(F=>!F.hasAttribute(Ce));f.insertBefore(w,P)}else f.appendChild(w)}else if(B>0){let L=Array.from(f.children)[B];f.insertBefore(w,L)}},onBeforeNodeAdded:f=>{d.maintainPrivateHooks(f,f,u,m),this.trackBefore("added",f);let w=f;return this.streamComponentRestore[f.id]&&(w=this.streamComponentRestore[f.id],delete this.streamComponentRestore[f.id],O.call(this,w,f,!0)),w},onNodeAdded:f=>{f.getAttribute&&this.maybeReOrderStream(f,!0),f instanceof HTMLImageElement&&f.srcset?f.srcset=f.srcset:f instanceof HTMLVideoElement&&f.autoplay&&f.play(),d.isNowTriggerFormExternal(f,g)&&(b=f),(d.isPhxChild(f)&&t.ownsElement(f)||d.isPhxSticky(f)&&t.ownsElement(f.parentNode))&&this.trackAfter("phxChildAdded",f),p.push(f)},onNodeDiscarded:f=>this.onNodeDiscarded(f),onBeforeNodeDiscarded:f=>f.getAttribute&&f.getAttribute(Ht)!==null?!0:!(f.parentElement!==null&&f.id&&d.isPhxUpdate(f.parentElement,h,[Ke,"append","prepend"])||this.maybePendingRemove(f)||this.skipCIDSibling(f)),onElUpdated:f=>{d.isNowTriggerFormExternal(f,g)&&(b=f),c.push(f),this.maybeReOrderStream(f,!1)},onBeforeElUpdated:(f,w)=>{if(f.id&&f.isSameNode(A)&&f.id!==w.id)return H.onNodeDiscarded(f),f.replaceWith(w),H.onNodeAdded(w);if(d.syncPendingAttrs(f,w),d.maintainPrivateHooks(f,w,u,m),d.cleanChildNodes(w,h),this.skipCIDSibling(w))return this.maybeReOrderStream(f),!1;if(d.isPhxSticky(f))return[K,de,re].map(L=>[L,f.getAttribute(L),w.getAttribute(L)]).forEach(([L,P,F])=>{F&&P!==F&&f.setAttribute(L,F)}),!1;if(d.isIgnored(f,h)||f.form&&f.form.isSameNode(b))return this.trackBefore("updated",f,w),d.mergeAttrs(f,w,{isIgnored:d.isIgnored(f,h)}),c.push(f),d.applyStickyOperations(f),!1;if(f.type==="number"&&f.validity&&f.validity.badInput)return!1;let q=o&&f.isSameNode(o)&&d.isFormInput(f),B=q&&this.isChangedSelect(f,w);if(f.hasAttribute(V)){let L=new bt(f);if(L.lockRef&&(!this.undoRef||!L.isLockUndoneBy(this.undoRef))){d.isUploadInput(f)&&(d.mergeAttrs(f,w,{isIgnored:!0}),this.trackBefore("updated",f,w),c.push(f)),d.applyStickyOperations(f);let F=f.hasAttribute(x)?d.private(f,x)||f.cloneNode(!0):null;F&&(d.putPrivate(f,x,F),q||(f=F))}}if(d.isPhxChild(w)){let L=f.getAttribute(K);return d.mergeAttrs(f,w,{exclude:[de]}),L!==""&&f.setAttribute(K,L),f.setAttribute(re,this.rootID),d.applyStickyOperations(f),!1}return this.undoRef&&d.private(w,x)&&d.putPrivate(f,x,d.private(w,x)),d.copyPrivates(w,f),q&&f.type!=="hidden"&&!B?(this.trackBefore("updated",f,w),d.mergeFocusedInput(f,w),d.syncAttrsToProps(f),c.push(f),d.applyStickyOperations(f),!1):(B&&f.blur(),d.isPhxUpdate(w,h,["append","prepend"])&&v.push(new ms(f,w,w.getAttribute(h))),d.syncAttrsToProps(w),d.applyStickyOperations(w),this.trackBefore("updated",f,w),f)}};mi(A,_,H)}if(this.trackBefore("added",n),this.trackBefore("updated",n,n),i.time("morphdom",()=>{this.streams.forEach(([A,_,D,H])=>{_.forEach(([f,w,q])=>{this.streamInserts[f]={ref:A,streamAt:w,limit:q,reset:H}}),H!==void 0&&d.all(n,`[${Ce}="${A}"]`,f=>{this.removeStreamChildElement(f)}),D.forEach(f=>{let w=n.querySelector(`[id="${f}"]`);w&&this.removeStreamChildElement(w)})}),e&&d.all(this.container,`[${h}=${Ke}]`).filter(A=>this.view.ownsElement(A)).forEach(A=>{Array.from(A.children).forEach(_=>{this.removeStreamChildElement(_,!0)})}),O.call(this,r,s)}),i.isDebugEnabled()&&(ns(),rs(this.streamInserts),Array.from(document.querySelectorAll("input[name=id]")).forEach(A=>{A.form&&console.error(`Detected an input with name="id" inside a form! This will cause problems when patching the DOM.
`,A)})),v.length>0&&i.time("post-morph append/prepend restoration",()=>{v.forEach(A=>A.perform())}),i.silenceEvents(()=>d.restoreFocus(o,a,l)),d.dispatchEvent(document,"phx:update"),p.forEach(A=>this.trackAfter("added",A)),c.forEach(A=>this.trackAfter("updated",A)),this.transitionPendingRemoves(),b){i.unload();let A=d.private(b,"submitter");if(A&&A.name&&r.contains(A)){let _=document.createElement("input");_.type="hidden";let D=A.getAttribute("form");D&&_.setAttribute("form",D),_.name=A.name,_.value=A.value,A.parentElement.insertBefore(_,A)}Object.getPrototypeOf(b).submit.call(b)}return!0}onNodeDiscarded(e){(d.isPhxChild(e)||d.isPhxSticky(e))&&this.liveSocket.destroyViewByEl(e),this.trackAfter("discarded",e)}maybePendingRemove(e){return e.getAttribute&&e.getAttribute(this.phxRemove)!==null?(this.pendingRemoves.push(e),!0):!1}removeStreamChildElement(e,t=!1){!t&&!this.view.ownsElement(e)||(this.streamInserts[e.id]?(this.streamComponentRestore[e.id]=e,e.remove()):this.maybePendingRemove(e)||(e.remove(),this.onNodeDiscarded(e)))}getStreamInsert(e){return(e.id?this.streamInserts[e.id]:{})||{}}setStreamRef(e,t){d.putSticky(e,Ce,i=>i.setAttribute(Ce,t))}maybeReOrderStream(e,t){let{ref:i,streamAt:s,reset:n}=this.getStreamInsert(e);if(s!==void 0&&(this.setStreamRef(e,i),!(!n&&!t)&&e.parentElement)){if(s===0)e.parentElement.insertBefore(e,e.parentElement.firstElementChild);else if(s>0){let r=Array.from(e.parentElement.children),o=r.indexOf(e);if(s>=r.length-1)e.parentElement.appendChild(e);else{let a=r[s];o>s?e.parentElement.insertBefore(e,a):e.parentElement.insertBefore(e,a.nextElementSibling)}}this.maybeLimitStream(e)}}maybeLimitStream(e){let{limit:t}=this.getStreamInsert(e),i=t!==null&&Array.from(e.parentElement.children);t&&t<0&&i.length>t*-1?i.slice(0,i.length+t).forEach(s=>this.removeStreamChildElement(s)):t&&t>=0&&i.length>t&&i.slice(t).forEach(s=>this.removeStreamChildElement(s))}transitionPendingRemoves(){let{pendingRemoves:e,liveSocket:t}=this;e.length>0&&t.transitionRemoves(e,()=>{e.forEach(i=>{let s=d.firstPhxChild(i);s&&t.destroyViewByEl(s),i.remove()}),this.trackAfter("transitionsDiscarded",e)})}isChangedSelect(e,t){return!(e instanceof HTMLSelectElement)||e.multiple?!1:e.options.length!==t.options.length?!0:(t.value=e.value,!e.isEqualNode(t))}isCIDPatch(){return this.cidPatch}skipCIDSibling(e){return e.nodeType===Node.ELEMENT_NODE&&e.hasAttribute(di)}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}indexOf(e,t){return Array.from(e.children).indexOf(t)}},Ps=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),xs=new Set(["'",'"']),si=(e,t,i)=>{let s=0,n=!1,r,o,a,l,h,u,m=e.match(/^(\s*(?:<!--.*?-->\s*)*)<([^\s\/>]+)/);if(m===null)throw new Error(`malformed html ${e}`);for(s=m[0].length,r=m[1],a=m[2],l=s,s;s<e.length&&e.charAt(s)!==">";s++)if(e.charAt(s)==="="){let c=e.slice(s-3,s)===" id";s++;let v=e.charAt(s);if(xs.has(v)){let b=s;for(s++,s;s<e.length&&e.charAt(s)!==v;s++);if(c){h=e.slice(b+1,s);break}}}let g=e.length-1;for(n=!1;g>=r.length+a.length;){let c=e.charAt(g);if(n)c==="-"&&e.slice(g-3,g)==="<!-"?(n=!1,g-=4):g-=1;else if(c===">"&&e.slice(g-2,g)==="--")n=!0,g-=3;else{if(c===">")break;g-=1}}o=e.slice(g+1,e.length);let p=Object.keys(t).map(c=>t[c]===!0?c:`${c}="${t[c]}"`).join(" ");if(i){let c=h?` id="${h}"`:"";Ps.has(a)?u=`<${a}${c}${p===""?"":" "}${p}/>`:u=`<${a}${c}${p===""?"":" "}${p}></${a}>`}else{let c=e.slice(l,g+1);u=`<${a}${p===""?"":" "}${p}${c}`}return[u,r,o]},ni=class{static extract(e){let{[Wt]:t,[qt]:i,[Xt]:s}=e;return delete e[Wt],delete e[qt],delete e[Xt],{diff:e,title:s,reply:t||null,events:i||[]}}constructor(e,t){this.viewId=e,this.rendered={},this.magicId=0,this.mergeDiff(t)}parentViewId(){return this.viewId}toString(e){let[t,i]=this.recursiveToString(this.rendered,this.rendered[N],e,!0,{});return[t,i]}recursiveToString(e,t=e[N],i,s,n){i=i?new Set(i):null;let r={buffer:"",components:t,onlyCids:i,streams:new Set};return this.toOutputBuffer(e,null,r,s,n),[r.buffer,r.streams]}componentCIDs(e){return Object.keys(e[N]||{}).map(t=>parseInt(t))}isComponentOnlyDiff(e){return e[N]?Object.keys(e).length===1:!1}getComponent(e,t){return e[N][t]}resetRender(e){this.rendered[N][e]&&(this.rendered[N][e].reset=!0)}mergeDiff(e){let t=e[N],i={};if(delete e[N],this.rendered=this.mutableMerge(this.rendered,e),this.rendered[N]=this.rendered[N]||{},t){let s=this.rendered[N];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[N]=t}}cachedFindComponent(e,t,i,s,n){if(n[e])return n[e];{let r,o,a=t[z];if(Q(a)){let l;a>0?l=this.cachedFindComponent(a,s[a],i,s,n):l=i[-a],o=l[z],r=this.cloneMerge(l,t,!0),r[z]=o}else r=t[z]!==void 0||i[e]===void 0?t:this.cloneMerge(i[e],t,!1);return n[e]=r,r}}mutableMerge(e,t){return t[z]!==void 0?t:(this.doMutableMerge(e,t),e)}doMutableMerge(e,t){for(let i in t){let s=t[i],n=e[i];ve(s)&&s[z]===void 0&&ve(n)?this.doMutableMerge(n,s):e[i]=s}e[ht]&&(e.newRender=!0)}cloneMerge(e,t,i){let s=J(J({},e),t);for(let n in s){let r=t[n],o=e[n];ve(r)&&r[z]===void 0&&ve(o)?s[n]=this.cloneMerge(o,r,i):r===void 0&&ve(o)&&(s[n]=this.cloneMerge(o,{},i))}return i?(delete s.magicId,delete s.newRender):e[ht]&&(s.newRender=!0),s}componentToString(e){let[t,i]=this.recursiveCIDToString(this.rendered[N],e,null),[s,n,r]=si(t,{});return[s,i]}pruneCIDs(e){e.forEach(t=>delete this.rendered[N][t])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[z]}templateStatic(e,t){return typeof e=="number"?t[e]:e}nextMagicID(){return this.magicId++,`m${this.magicId}-${this.parentViewId()}`}toOutputBuffer(e,t,i,s,n={}){if(e[Je])return this.comprehensionToBuffer(e,t,i);let{[z]:r}=e;r=this.templateStatic(r,t);let o=e[ht],a=i.buffer;o&&(i.buffer=""),s&&o&&!e.magicId&&(e.newRender=!0,e.magicId=this.nextMagicID()),i.buffer+=r[0];for(let l=1;l<r.length;l++)this.dynamicToBuffer(e[l-1],t,i,s),i.buffer+=r[l];if(o){let l=!1,h;s||e.magicId?(l=s&&!e.newRender,h=J({[ci]:e.magicId},n)):h=n,l&&(h[di]=!0);let[u,m,g]=si(i.buffer,h,l);e.newRender=!1,i.buffer=a+m+u+g}}comprehensionToBuffer(e,t,i){let{[Je]:s,[z]:n,[zt]:r}=e,[o,a,l,h]=r||[null,{},[],null];n=this.templateStatic(n,t);let u=t||e[is];for(let m=0;m<s.length;m++){let g=s[m];i.buffer+=n[0];for(let p=1;p<n.length;p++){let c=!1;this.dynamicToBuffer(g[p-1],u,i,c),i.buffer+=n[p]}}r!==void 0&&(e[Je].length>0||l.length>0||h)&&(delete e[zt],e[Je]=[],i.streams.add(r))}dynamicToBuffer(e,t,i,s){if(typeof e=="number"){let[n,r]=this.recursiveCIDToString(i.components,e,i.onlyCids);i.buffer+=n,i.streams=new Set([...i.streams,...r])}else ve(e)?this.toOutputBuffer(e,t,i,s,{}):i.buffer+=e}recursiveCIDToString(e,t,i){let s=e[t]||R(`no component for CID ${t}`,e),n={[Z]:t},r=i&&!i.has(t);s.newRender=!r,s.magicId=`c${t}-${this.parentViewId()}`;let o=!s.reset,[a,l]=this.recursiveToString(s,e,i,o,n);return delete s.reset,[a,l]}},ri=[],oi=200,Ls={exec(e,t,i,s,n,r){let[o,a]=r||[null,{callback:r&&r.callback}];(i.charAt(0)==="["?JSON.parse(i):[[o,a]]).forEach(([h,u])=>{h===o&&(u=J(J({},a),u),u.callback=u.callback||a.callback),this.filterToEls(s.liveSocket,n,u).forEach(m=>{this[`exec_${h}`](e,t,i,s,n,m,u)})})},isVisible(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length>0)},isInViewport(e){let t=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth;return t.right>0&&t.bottom>0&&t.left<s&&t.top<i},exec_exec(e,t,i,s,n,r,{attr:o,to:a}){let l=r.getAttribute(o);if(!l)throw new Error(`expected ${o} to contain JS command on "${a}"`);s.liveSocket.execJS(r,l,t)},exec_dispatch(e,t,i,s,n,r,{event:o,detail:a,bubbles:l}){a=a||{},a.dispatcher=n,d.dispatchEvent(r,o,{detail:a,bubbles:l})},exec_push(e,t,i,s,n,r,o){let{event:a,data:l,target:h,page_loading:u,loading:m,value:g,dispatcher:p,callback:c}=o,v={loading:m,value:g,target:h,page_loading:!!u},b=t==="change"&&p?p:n,O=h||b.getAttribute(s.binding("target"))||b,A=(_,D)=>{if(_.isConnected())if(t==="change"){let{newCid:H,_target:f}=o;f=f||(d.isFormInput(n)?n.name:void 0),f&&(v._target=f),_.pushInput(n,D,H,a||i,v,c)}else if(t==="submit"){let{submitter:H}=o;_.submitForm(n,D,a||i,H,v,c)}else _.pushEvent(t,n,D,a||i,l,v,c)};o.targetView&&o.targetCtx?A(o.targetView,o.targetCtx):s.withinTargets(O,A)},exec_navigate(e,t,i,s,n,r,{href:o,replace:a}){s.liveSocket.historyRedirect(e,o,a?"replace":"push",null,n)},exec_patch(e,t,i,s,n,r,{href:o,replace:a}){s.liveSocket.pushHistoryPatch(e,o,a?"replace":"push",n)},exec_focus(e,t,i,s,n,r){j.attemptFocus(r),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>j.attemptFocus(r))})},exec_focus_first(e,t,i,s,n,r){j.focusFirstInteractive(r)||j.focusFirst(r),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>j.focusFirstInteractive(r)||j.focusFirst(r))})},exec_push_focus(e,t,i,s,n,r){ri.push(r||n)},exec_pop_focus(e,t,i,s,n,r){let o=ri.pop();o&&(o.focus(),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>o.focus())}))},exec_add_class(e,t,i,s,n,r,{names:o,transition:a,time:l,blocking:h}){this.addOrRemoveClasses(r,o,[],a,l,s,h)},exec_remove_class(e,t,i,s,n,r,{names:o,transition:a,time:l,blocking:h}){this.addOrRemoveClasses(r,[],o,a,l,s,h)},exec_toggle_class(e,t,i,s,n,r,{names:o,transition:a,time:l,blocking:h}){this.toggleClasses(r,o,a,l,s,h)},exec_toggle_attr(e,t,i,s,n,r,{attr:[o,a,l]}){this.toggleAttr(r,o,a,l)},exec_transition(e,t,i,s,n,r,{time:o,transition:a,blocking:l}){this.addOrRemoveClasses(r,[],[],a,o,s,l)},exec_toggle(e,t,i,s,n,r,{display:o,ins:a,outs:l,time:h,blocking:u}){this.toggle(t,s,r,o,a,l,h,u)},exec_show(e,t,i,s,n,r,{display:o,transition:a,time:l,blocking:h}){this.show(t,s,r,o,a,l,h)},exec_hide(e,t,i,s,n,r,{display:o,transition:a,time:l,blocking:h}){this.hide(t,s,r,o,a,l,h)},exec_set_attr(e,t,i,s,n,r,{attr:[o,a]}){this.setOrRemoveAttrs(r,[[o,a]],[])},exec_remove_attr(e,t,i,s,n,r,{attr:o}){this.setOrRemoveAttrs(r,[],[o])},show(e,t,i,s,n,r,o){this.isVisible(i)||this.toggle(e,t,i,s,n,null,r,o)},hide(e,t,i,s,n,r,o){this.isVisible(i)&&this.toggle(e,t,i,s,null,n,r,o)},toggle(e,t,i,s,n,r,o,a){o=o||oi;let[l,h,u]=n||[[],[],[]],[m,g,p]=r||[[],[],[]];if(l.length>0||m.length>0)if(this.isVisible(i)){let c=()=>{this.addOrRemoveClasses(i,g,l.concat(h).concat(u)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,m,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,p,g))})},v=()=>{this.addOrRemoveClasses(i,[],m.concat(p)),d.putSticky(i,"toggle",b=>b.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))};i.dispatchEvent(new Event("phx:hide-start")),a===!1?(c(),setTimeout(v,o)):t.transition(o,c,v)}else{if(e==="remove")return;let c=()=>{this.addOrRemoveClasses(i,h,m.concat(g).concat(p));let b=s||this.defaultDisplay(i);window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,l,[]),window.requestAnimationFrame(()=>{d.putSticky(i,"toggle",O=>O.style.display=b),this.addOrRemoveClasses(i,u,h)})})},v=()=>{this.addOrRemoveClasses(i,[],l.concat(u)),i.dispatchEvent(new Event("phx:show-end"))};i.dispatchEvent(new Event("phx:show-start")),a===!1?(c(),setTimeout(v,o)):t.transition(o,c,v)}else this.isVisible(i)?window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:hide-start")),d.putSticky(i,"toggle",c=>c.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:show-start"));let c=s||this.defaultDisplay(i);d.putSticky(i,"toggle",v=>v.style.display=c),i.dispatchEvent(new Event("phx:show-end"))})},toggleClasses(e,t,i,s,n,r){window.requestAnimationFrame(()=>{let[o,a]=d.getSticky(e,"classes",[[],[]]),l=t.filter(u=>o.indexOf(u)<0&&!e.classList.contains(u)),h=t.filter(u=>a.indexOf(u)<0&&e.classList.contains(u));this.addOrRemoveClasses(e,l,h,i,s,n,r)})},toggleAttr(e,t,i,s){e.hasAttribute(t)?s!==void 0?e.getAttribute(t)===i?this.setOrRemoveAttrs(e,[[t,s]],[]):this.setOrRemoveAttrs(e,[[t,i]],[]):this.setOrRemoveAttrs(e,[],[t]):this.setOrRemoveAttrs(e,[[t,i]],[])},addOrRemoveClasses(e,t,i,s,n,r,o){n=n||oi;let[a,l,h]=s||[[],[],[]];if(a.length>0){let u=()=>{this.addOrRemoveClasses(e,l,[].concat(a).concat(h)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(e,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(e,h,l))})},m=()=>this.addOrRemoveClasses(e,t.concat(h),i.concat(a).concat(l));o===!1?(u(),setTimeout(m,n)):r.transition(n,u,m);return}window.requestAnimationFrame(()=>{let[u,m]=d.getSticky(e,"classes",[[],[]]),g=t.filter(b=>u.indexOf(b)<0&&!e.classList.contains(b)),p=i.filter(b=>m.indexOf(b)<0&&e.classList.contains(b)),c=u.filter(b=>i.indexOf(b)<0).concat(g),v=m.filter(b=>t.indexOf(b)<0).concat(p);d.putSticky(e,"classes",b=>(b.classList.remove(...v),b.classList.add(...c),[c,v]))})},setOrRemoveAttrs(e,t,i){let[s,n]=d.getSticky(e,"attrs",[[],[]]),r=t.map(([l,h])=>l).concat(i),o=s.filter(([l,h])=>!r.includes(l)).concat(t),a=n.filter(l=>!r.includes(l)).concat(i);d.putSticky(e,"attrs",l=>(a.forEach(h=>l.removeAttribute(h)),o.forEach(([h,u])=>l.setAttribute(h,u)),[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,t,{to:i}){let s=()=>{if(typeof i=="string")return document.querySelectorAll(i);if(i.closest){let n=t.closest(i.closest);return n?[n]:[]}else if(i.inner)return t.querySelectorAll(i.inner)};return i?e.jsQuerySelectorAll(t,i,s):[t]},defaultDisplay(e){return{tr:"table-row",td:"table-cell"}[e.tagName.toLowerCase()]||"block"},transitionClasses(e){if(!e)return null;let[t,i,s]=Array.isArray(e)?e:[e.split(" "),[],[]];return t=Array.isArray(t)?t:t.split(" "),i=Array.isArray(i)?i:i.split(" "),s=Array.isArray(s)?s:s.split(" "),[t,i,s]}},C=Ls,ct="hookId",Is=1,Le=class{static makeID(){return Is++}static elementID(e){return d.private(e,ct)}constructor(e,t,i){this.el=t,this.__attachView(e),this.__callbacks=i,this.__listeners=new Set,this.__isDisconnected=!1,d.putPrivate(this.el,ct,this.constructor.makeID());for(let s in this.__callbacks)this[s]=this.__callbacks[s]}__attachView(e){e?(this.__view=()=>e,this.liveSocket=e.liveSocket):(this.__view=()=>{throw new Error(`hook not yet attached to a live view: ${this.el.outerHTML}`)},this.liveSocket=null)}__mounted(){this.mounted&&this.mounted()}__updated(){this.updated&&this.updated()}__beforeUpdate(){this.beforeUpdate&&this.beforeUpdate()}__destroyed(){this.destroyed&&this.destroyed(),d.deletePrivate(this.el,ct)}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected&&this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected&&this.disconnected()}js(){let e=this;return{exec(t){e.__view().liveSocket.execJS(e.el,t,"hook")},show(t,i={}){let s=e.__view().liveSocket.owner(t);C.show("hook",s,t,i.display,i.transition,i.time,i.blocking)},hide(t,i={}){let s=e.__view().liveSocket.owner(t);C.hide("hook",s,t,null,i.transition,i.time,i.blocking)},toggle(t,i={}){let s=e.__view().liveSocket.owner(t);i.in=C.transitionClasses(i.in),i.out=C.transitionClasses(i.out),C.toggle("hook",s,t,i.display,i.in,i.out,i.time,i.blocking)},addClass(t,i,s={}){i=Array.isArray(i)?i:i.split(" ");let n=e.__view().liveSocket.owner(t);C.addOrRemoveClasses(t,i,[],s.transition,s.time,n,s.blocking)},removeClass(t,i,s={}){s.transition=C.transitionClasses(s.transition),i=Array.isArray(i)?i:i.split(" ");let n=e.__view().liveSocket.owner(t);C.addOrRemoveClasses(t,[],i,s.transition,s.time,n,s.blocking)},toggleClass(t,i,s={}){s.transition=C.transitionClasses(s.transition),i=Array.isArray(i)?i:i.split(" ");let n=e.__view().liveSocket.owner(t);C.toggleClasses(t,i,s.transition,s.time,n,s.blocking)},transition(t,i,s={}){let n=e.__view().liveSocket.owner(t);C.addOrRemoveClasses(t,[],[],C.transitionClasses(i),s.time,n,s.blocking)},setAttribute(t,i,s){C.setOrRemoveAttrs(t,[[i,s]],[])},removeAttribute(t,i){C.setOrRemoveAttrs(t,[],[i])},toggleAttribute(t,i,s,n){C.toggleAttr(t,i,s,n)}}}pushEvent(e,t={},i){return i===void 0?new Promise((s,n)=>{try{this.__view().pushHookEvent(this.el,null,e,t,(o,a)=>s(o))===!1&&n(new Error("unable to push hook event. LiveView not connected"))}catch(r){n(r)}}):this.__view().pushHookEvent(this.el,null,e,t,i)}pushEventTo(e,t,i={},s){return s===void 0?new Promise((n,r)=>{try{this.__view().withinTargets(e,(o,a)=>{o.pushHookEvent(this.el,a,t,i,(h,u)=>n(h))===!1&&r(new Error("unable to push hook event. LiveView not connected"))})}catch(o){r(o)}}):this.__view().withinTargets(e,(n,r)=>n.pushHookEvent(this.el,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(null,e,t)}uploadTo(e,t,i){return this.__view().withinTargets(e,(s,n)=>{s.dispatchUploads(n,t,i)})}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}},Os=(e,t)=>{let i=e.endsWith("[]"),s=i?e.slice(0,-2):e;return s=s.replace(/([^\[\]]+)(\]?$)/,`${t}$1$2`),i&&(s+="[]"),s},Xe=(e,t,i=[])=>{let{submitter:s}=t,n;if(s&&s.name){let u=document.createElement("input");u.type="hidden";let m=s.getAttribute("form");m&&u.setAttribute("form",m),u.name=s.name,u.value=s.value,s.parentElement.insertBefore(u,s),n=u}let r=new FormData(e),o=[];r.forEach((u,m,g)=>{u instanceof File&&o.push(m)}),o.forEach(u=>r.delete(u));let a=new URLSearchParams,{inputsUnused:l,onlyHiddenInputs:h}=Array.from(e.elements).reduce((u,m)=>{let{inputsUnused:g,onlyHiddenInputs:p}=u,c=m.name;if(!c)return u;g[c]===void 0&&(g[c]=!0),p[c]===void 0&&(p[c]=!0);let v=d.private(m,Ye)||d.private(m,Oe),b=m.type==="hidden";return g[c]=g[c]&&!v,p[c]=p[c]&&b,u},{inputsUnused:{},onlyHiddenInputs:{}});for(let[u,m]of r.entries())if(i.length===0||i.indexOf(u)>=0){let g=l[u],p=h[u];g&&!(s&&s.name==u)&&!p&&a.append(Os(u,"_unused_"),""),a.append(u,m)}return s&&n&&s.parentElement.removeChild(n),a.toString()},Ds=class gi{static closestView(t){let i=t.closest(fe);return i?d.private(i,"view"):null}constructor(t,i,s,n,r){this.isDead=!1,this.liveSocket=i,this.flash=n,this.parent=s,this.root=s?s.root:this,this.el=t,d.putPrivate(this.el,"view",this),this.id=this.el.id,this.ref=0,this.lastAckRef=null,this.childJoins=0,this.loaderTimer=null,this.disconnectedTimer=null,this.pendingDiffs=[],this.pendingForms=new Set,this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinAttempts=0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(o){o&&o()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.formsForRecovery={},this.channel=this.liveSocket.channel(`lv:${this.id}`,()=>{let o=this.href&&this.expandURL(this.href);return{redirect:this.redirect?o:void 0,url:this.redirect?void 0:o||void 0,params:this.connectParams(r),session:this.getSession(),static:this.getStatic(),flash:this.flash,sticky:this.el.hasAttribute(mt)}})}setHref(t){this.href=t}setRedirect(t){this.redirect=!0,this.href=t}isMain(){return this.el.hasAttribute(yt)}connectParams(t){let i=this.liveSocket.params(this.el),s=d.all(document,`[${this.binding(ji)}]`).map(n=>n.src||n.href).filter(n=>typeof n=="string");return s.length>0&&(i._track_static=s),i._mounts=this.joinCount,i._mount_attempts=this.joinAttempts,i._live_referer=t,this.joinAttempts++,i}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(K)}getStatic(){let t=this.el.getAttribute(de);return t===""?null:t}destroy(t=function(){}){this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);let i=()=>{t();for(let s in this.viewHooks)this.destroyHook(this.viewHooks[s])};d.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",i).receive("error",i).receive("timeout",i)}setContainerClasses(...t){this.el.classList.remove(Nt,le,ge,Ft,Se),this.el.classList.add(...t)}showLoader(t){if(clearTimeout(this.loaderTimer),t)this.loaderTimer=setTimeout(()=>this.showLoader(),t);else{for(let i in this.viewHooks)this.viewHooks[i].__disconnected();this.setContainerClasses(le)}}execAll(t){d.all(this.el,`[${t}]`,i=>this.liveSocket.execJS(i,i.getAttribute(t)))}hideLoader(){clearTimeout(this.loaderTimer),clearTimeout(this.disconnectedTimer),this.setContainerClasses(Nt),this.execAll(this.binding("connected"))}triggerReconnected(){for(let t in this.viewHooks)this.viewHooks[t].__reconnected()}log(t,i){this.liveSocket.log(this,t,i)}transition(t,i,s=function(){}){this.liveSocket.transition(t,i,s)}withinTargets(t,i,s=document,n){if(t instanceof HTMLElement||t instanceof SVGElement)return this.liveSocket.owner(t,r=>i(r,t));if(Q(t))d.findComponentNodeList(n||this.el,t).length===0?R(`no component found matching phx-target of ${t}`):i(this,parseInt(t));else{let r=Array.from(s.querySelectorAll(t));r.length===0&&R(`nothing found matching the phx-target selector "${t}"`),r.forEach(o=>this.liveSocket.owner(o,a=>i(a,o)))}}applyDiff(t,i,s){this.log(t,()=>["",Ge(i)]);let{diff:n,reply:r,events:o,title:a}=ni.extract(i);s({diff:n,reply:r,events:o}),(typeof a=="string"||t=="mount")&&window.requestAnimationFrame(()=>d.putTitle(a))}onJoin(t){let{rendered:i,container:s,liveview_version:n}=t;if(s){let[r,o]=s;this.el=d.replaceRootContainer(this.el,r,o)}this.childJoins=0,this.joinPending=!0,this.flash=null,this.root===this&&(this.formsForRecovery=this.getFormsForRecovery()),this.isMain()&&window.history.state===null&&M.pushState("replace",{type:"patch",id:this.id,position:this.liveSocket.currentHistoryPosition}),n!==this.liveSocket.version()&&console.error(`LiveView asset version mismatch. JavaScript version ${this.liveSocket.version()} vs. server ${n}. To avoid issues, please ensure that your assets use the same version as the server.`),M.dropLocal(this.liveSocket.localStorage,window.location.pathname,ai),this.applyDiff("mount",i,({diff:r,events:o})=>{this.rendered=new ni(this.id,r);let[a,l]=this.renderContainer(null,"join");this.dropPendingRefs(),this.joinCount++,this.joinAttempts=0,this.maybeRecoverForms(a,()=>{this.onJoinComplete(t,a,l,o)})})}dropPendingRefs(){d.all(document,`[${V}="${this.refSrc()}"]`,t=>{t.removeAttribute(we),t.removeAttribute(V),t.removeAttribute(x)})}onJoinComplete({live_patch:t},i,s,n){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(t,i,s,n);d.findPhxChildrenInFragment(i,this.id).filter(o=>{let a=o.id&&this.el.querySelector(`[id="${o.id}"]`),l=a&&a.getAttribute(de);return l&&o.setAttribute(de,l),a&&a.setAttribute(re,this.root.id),this.joinChild(o)}).length===0?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(t,i,s,n)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(t,i,s,n)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(t,i,s,n)])}attachTrueDocEl(){this.el=d.byId(this.id),this.el.setAttribute(re,this.root.id)}execNewMounted(t=this.el){let i=this.binding(ft),s=this.binding(pt);d.all(t,`[${i}], [${s}]`,n=>{this.ownsElement(n)&&(d.maintainPrivateHooks(n,n,i,s),this.maybeAddNewHook(n))}),d.all(t,`[${this.binding(Ee)}], [data-phx-${Ee}]`,n=>{this.ownsElement(n)&&this.maybeAddNewHook(n)}),d.all(t,`[${this.binding($t)}]`,n=>{this.ownsElement(n)&&this.maybeMounted(n)})}applyJoinPatch(t,i,s,n){this.attachTrueDocEl();let r=new We(this,this.el,this.id,i,s,null);if(r.markPrunableContentForRemoval(),this.performPatch(r,!1,!0),this.joinNewChildren(),this.execNewMounted(),this.joinPending=!1,this.liveSocket.dispatchEvents(n),this.applyPendingUpdates(),t){let{kind:o,to:a}=t;this.liveSocket.historyPatch(a,o)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(t,i){this.liveSocket.triggerDOM("onBeforeElUpdated",[t,i]);let s=this.getHook(t),n=s&&d.isIgnored(t,this.binding(Ze));if(s&&!t.isEqualNode(i)&&!(n&&as(t.dataset,i.dataset)))return s.__beforeUpdate(),s}maybeMounted(t){let i=t.getAttribute(this.binding($t)),s=i&&d.private(t,"mounted");i&&!s&&(this.liveSocket.execJS(t,i),d.putPrivate(t,"mounted",!0))}maybeAddNewHook(t){let i=this.addHook(t);i&&i.__mounted()}performPatch(t,i,s=!1){let n=[],r=!1,o=new Set;return this.liveSocket.triggerDOM("onPatchStart",[t.targetContainer]),t.after("added",a=>{this.liveSocket.triggerDOM("onNodeAdded",[a]);let l=this.binding(ft),h=this.binding(pt);d.maintainPrivateHooks(a,a,l,h),this.maybeAddNewHook(a),a.getAttribute&&this.maybeMounted(a)}),t.after("phxChildAdded",a=>{d.isPhxSticky(a)?this.liveSocket.joinRootViews():r=!0}),t.before("updated",(a,l)=>{this.triggerBeforeUpdateHook(a,l)&&o.add(a.id)}),t.after("updated",a=>{o.has(a.id)&&this.getHook(a).__updated()}),t.after("discarded",a=>{a.nodeType===Node.ELEMENT_NODE&&n.push(a)}),t.after("transitionsDiscarded",a=>this.afterElementsRemoved(a,i)),t.perform(s),this.afterElementsRemoved(n,i),this.liveSocket.triggerDOM("onPatchEnd",[t.targetContainer]),r}afterElementsRemoved(t,i){let s=[];t.forEach(n=>{let r=d.all(n,`[${Z}]`),o=d.all(n,`[${this.binding(Ee)}], [data-phx-hook]`);r.concat(n).forEach(a=>{let l=this.componentID(a);Q(l)&&s.indexOf(l)===-1&&s.push(l)}),o.concat(n).forEach(a=>{let l=this.getHook(a);l&&this.destroyHook(l)})}),i&&this.maybePushComponentsDestroyed(s)}joinNewChildren(){d.findPhxChildren(this.el,this.id).forEach(t=>this.joinChild(t))}maybeRecoverForms(t,i){let s=this.binding("change"),n=this.root.formsForRecovery,r=document.createElement("template");r.innerHTML=t;let o=r.content.firstElementChild;o.id=this.id,o.setAttribute(re,this.root.id),o.setAttribute(K,this.getSession()),o.setAttribute(de,this.getStatic()),o.setAttribute(ue,this.parent?this.parent.id:null);let a=d.all(r.content,"form").filter(l=>l.id&&n[l.id]).filter(l=>!this.pendingForms.has(l.id)).filter(l=>n[l.id].getAttribute(s)===l.getAttribute(s)).map(l=>[n[l.id],l]);if(a.length===0)return i();a.forEach(([l,h],u)=>{this.pendingForms.add(h.id),this.pushFormRecovery(l,h,r.content.firstElementChild,()=>{this.pendingForms.delete(h.id),u===a.length-1&&i()})})}getChildById(t){return this.root.children[this.id][t]}getDescendentByEl(t){var i;return t.id===this.id?this:(i=this.children[t.getAttribute(ue)])==null?void 0:i[t.id]}destroyDescendent(t){for(let i in this.root.children)for(let s in this.root.children[i])if(s===t)return this.root.children[i][s].destroy()}joinChild(t){if(!this.getChildById(t.id)){let s=new gi(t,this.liveSocket,this);return this.root.children[this.id][s.id]=s,s.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(t){this.childJoins--,this.childJoins===0&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.pendingForms.clear(),this.formsForRecovery={},this.joinCallback(()=>{this.pendingJoinOps.forEach(([t,i])=>{t.isDestroyed()||i()}),this.pendingJoinOps=[]})}update(t,i){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&this.root.isMain())return this.pendingDiffs.push({diff:t,events:i});this.rendered.mergeDiff(t);let s=!1;this.rendered.isComponentOnlyDiff(t)?this.liveSocket.time("component patch complete",()=>{d.findExistingParentCIDs(this.el,this.rendered.componentCIDs(t)).forEach(r=>{this.componentPatch(this.rendered.getComponent(t,r),r)&&(s=!0)})}):Kt(t)||this.liveSocket.time("full patch complete",()=>{let[n,r]=this.renderContainer(t,"update"),o=new We(this,this.el,this.id,n,r,null);s=this.performPatch(o,!0)}),this.liveSocket.dispatchEvents(i),s&&this.joinNewChildren()}renderContainer(t,i){return this.liveSocket.time(`toString diff (${i})`,()=>{let s=this.el.tagName,n=t?this.rendered.componentCIDs(t):null,[r,o]=this.rendered.toString(n);return[`<${s}>${r}</${s}>`,o]})}componentPatch(t,i){if(Kt(t))return!1;let[s,n]=this.rendered.componentToString(i),r=new We(this,this.el,this.id,s,n,i);return this.performPatch(r,!0)}getHook(t){return this.viewHooks[Le.elementID(t)]}addHook(t){let i=Le.elementID(t);if(!(t.getAttribute&&!this.ownsElement(t)))if(i&&!this.viewHooks[i]){let s=d.getCustomElHook(t)||R(`no hook found for custom element: ${t.id}`);return this.viewHooks[i]=s,s.__attachView(this),s}else{if(i||!t.getAttribute)return;{let s=t.getAttribute(`data-phx-${Ee}`)||t.getAttribute(this.binding(Ee)),n=this.liveSocket.getHookCallbacks(s);if(n){t.id||R(`no DOM ID for hook "${s}". Hooks require a unique ID on each element.`,t);let r=new Le(this,t,n);return this.viewHooks[Le.elementID(r.el)]=r,r}else s!==null&&R(`unknown hook found for "${s}"`,t)}}}destroyHook(t){let i=Le.elementID(t.el);t.__destroyed(),t.__cleanup__(),delete this.viewHooks[i]}applyPendingUpdates(){this.liveSocket.hasPendingLink()&&this.root.isMain()||(this.pendingDiffs.forEach(({diff:t,events:i})=>this.update(t,i)),this.pendingDiffs=[],this.eachChild(t=>t.applyPendingUpdates()))}eachChild(t){let i=this.root.children[this.id]||{};for(let s in i)t(this.getChildById(s))}onChannel(t,i){this.liveSocket.onChannel(this.channel,t,s=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>i(s)]):this.liveSocket.requestDOMUpdate(()=>i(s))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",t=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",t,({diff:i,events:s})=>this.update(i,s))})}),this.onChannel("redirect",({to:t,flash:i})=>this.onRedirect({to:t,flash:i})),this.onChannel("live_patch",t=>this.onLivePatch(t)),this.onChannel("live_redirect",t=>this.onLiveRedirect(t)),this.channel.onError(t=>this.onError(t)),this.channel.onClose(t=>this.onClose(t))}destroyAllChildren(){this.eachChild(t=>t.destroy())}onLiveRedirect(t){let{to:i,kind:s,flash:n}=t,r=this.expandURL(i),o=new CustomEvent("phx:server-navigate",{detail:{to:i,kind:s,flash:n}});this.liveSocket.historyRedirect(o,r,s,n)}onLivePatch(t){let{to:i,kind:s}=t;this.href=this.expandURL(i),this.liveSocket.historyPatch(i,s)}expandURL(t){return t.startsWith("/")?`${window.location.protocol}//${window.location.host}${t}`:t}onRedirect({to:t,flash:i,reloadToken:s}){this.liveSocket.redirect(t,i,s)}isDestroyed(){return this.destroyed}joinDead(){this.isDead=!0}joinPush(){return this.joinPush=this.joinPush||this.channel.join(),this.joinPush}join(t){this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel(),this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=i=>{i=i||function(){},t?t(this.joinCount,i):i()},this.wrapPush(()=>this.channel.join(),{ok:i=>this.liveSocket.requestDOMUpdate(()=>this.onJoin(i)),error:i=>this.onJoinError(i),timeout:()=>this.onJoinError({reason:"timeout"})})}onJoinError(t){if(t.reason==="reload"){this.log("error",()=>[`failed mount with ${t.status}. Falling back to page reload`,t]),this.onRedirect({to:this.root.href,reloadToken:t.token});return}else if(t.reason==="unauthorized"||t.reason==="stale"){this.log("error",()=>["unauthorized live_redirect. Falling back to page request",t]),this.onRedirect({to:this.root.href,flash:this.flash});return}if((t.redirect||t.live_redirect)&&(this.joinPending=!1,this.channel.leave()),t.redirect)return this.onRedirect(t.redirect);if(t.live_redirect)return this.onLiveRedirect(t.live_redirect);if(this.log("error",()=>["unable to join",t]),this.isMain())this.displayError([le,ge,Se]),this.liveSocket.isConnected()&&this.liveSocket.reloadWithJitter(this);else{this.joinAttempts>=Bt&&(this.root.displayError([le,ge,Se]),this.log("error",()=>[`giving up trying to mount after ${Bt} tries`,t]),this.destroy());let i=d.byId(this.el.id);i?(d.mergeAttrs(i,this.el),this.displayError([le,ge,Se]),this.el=i):this.destroy()}}onClose(t){if(!this.isDestroyed()){if(this.isMain()&&this.liveSocket.hasPendingLink()&&t!=="leave")return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(Yi)}}onError(t){this.onClose(t),this.liveSocket.isConnected()&&this.log("error",()=>["view crashed",t]),this.liveSocket.isUnloaded()||(this.liveSocket.isConnected()?this.displayError([le,ge,Se]):this.displayError([le,ge,Ft]))}displayError(t){this.isMain()&&d.dispatchEvent(window,"phx:page-loading-start",{detail:{to:this.href,kind:"error"}}),this.showLoader(),this.setContainerClasses(...t),this.delayedDisconnected()}delayedDisconnected(){this.disconnectedTimer=setTimeout(()=>{this.execAll(this.binding("disconnected"))},this.liveSocket.disconnectedTimeout)}wrapPush(t,i){let s=this.liveSocket.getLatencySim(),n=s?r=>setTimeout(()=>!this.isDestroyed()&&r(),s):r=>!this.isDestroyed()&&r();n(()=>{t().receive("ok",r=>n(()=>i.ok&&i.ok(r))).receive("error",r=>n(()=>i.error&&i.error(r))).receive("timeout",()=>n(()=>i.timeout&&i.timeout()))})}pushWithReply(t,i,s){if(!this.isConnected())return Promise.reject({error:"noconnection"});let[n,[r],o]=t?t():[null,[],{}],a=this.joinCount,l=function(){};return o.page_loading&&(l=this.liveSocket.withPageLoading({kind:"element",target:r})),typeof s.cid!="number"&&delete s.cid,new Promise((h,u)=>{this.wrapPush(()=>this.channel.push(i,s,es),{ok:m=>{n!==null&&(this.lastAckRef=n);let g=p=>{m.redirect&&this.onRedirect(m.redirect),m.live_patch&&this.onLivePatch(m.live_patch),m.live_redirect&&this.onLiveRedirect(m.live_redirect),l(),h({resp:m,reply:p})};m.diff?this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",m.diff,({diff:p,reply:c,events:v})=>{n!==null&&this.undoRefs(n,s.event),this.update(p,v),g(c)})}):(n!==null&&this.undoRefs(n,s.event),g(null))},error:m=>u({error:m}),timeout:()=>{u({timeout:!0}),this.joinCount===a&&this.liveSocket.reloadWithJitter(this,()=>{this.log("timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}})})}undoRefs(t,i,s){if(!this.isConnected())return;let n=`[${V}="${this.refSrc()}"]`;s?(s=new Set(s),d.all(document,n,r=>{s&&!s.has(r)||(d.all(r,n,o=>this.undoElRef(o,t,i)),this.undoElRef(r,t,i))})):d.all(document,n,r=>this.undoElRef(r,t,i))}undoElRef(t,i,s){new bt(t).maybeUndo(i,s,r=>{let o=new We(this,t,this.id,r,[],null,{undoRef:i}),a=this.performPatch(o,!0);d.all(t,`[${V}="${this.refSrc()}"]`,l=>this.undoElRef(l,i,s)),a&&this.joinNewChildren()})}refSrc(){return this.el.id}putRef(t,i,s,n={}){let r=this.ref++,o=this.binding(Mt);if(n.loading){let a=d.all(document,n.loading).map(l=>({el:l,lock:!0,loading:!0}));t=t.concat(a)}for(let{el:a,lock:l,loading:h}of t){if(!l&&!h)throw new Error("putRef requires lock or loading");if(a.setAttribute(V,this.refSrc()),h&&a.setAttribute(we,r),l&&a.setAttribute(x,r),!h||n.submitter&&!(a===n.submitter||a===n.form))continue;let u=new Promise(c=>{a.addEventListener(`phx:undo-lock:${r}`,()=>c(p),{once:!0})}),m=new Promise(c=>{a.addEventListener(`phx:undo-loading:${r}`,()=>c(p),{once:!0})});a.classList.add(`phx-${s}-loading`);let g=a.getAttribute(o);g!==null&&(a.getAttribute(Qe)||a.setAttribute(Qe,a.innerText),g!==""&&(a.innerText=g),a.setAttribute(be,a.getAttribute(be)||a.disabled),a.setAttribute("disabled",""));let p={event:i,eventType:s,ref:r,isLoading:h,isLocked:l,lockElements:t.filter(({lock:c})=>c).map(({el:c})=>c),loadingElements:t.filter(({loading:c})=>c).map(({el:c})=>c),unlock:c=>{c=Array.isArray(c)?c:[c],this.undoRefs(r,i,c)},lockComplete:u,loadingComplete:m,lock:c=>new Promise(v=>{if(this.isAcked(r))return v(p);c.setAttribute(x,r),c.setAttribute(V,this.refSrc()),c.addEventListener(`phx:lock-stop:${r}`,()=>v(p),{once:!0})})};a.dispatchEvent(new CustomEvent("phx:push",{detail:p,bubbles:!0,cancelable:!1})),i&&a.dispatchEvent(new CustomEvent(`phx:push:${i}`,{detail:p,bubbles:!0,cancelable:!1}))}return[r,t.map(({el:a})=>a),n]}isAcked(t){return this.lastAckRef!==null&&this.lastAckRef>=t}componentID(t){let i=t.getAttribute&&t.getAttribute(Z);return i?parseInt(i):null}targetComponentID(t,i,s={}){if(Q(i))return i;let n=s.target||t.getAttribute(this.binding("target"));return Q(n)?parseInt(n):i&&(n!==null||s.target)?this.closestComponentID(i):null}closestComponentID(t){return Q(t)?t:t?ce(t.closest(`[${Z}]`),i=>this.ownsElement(i)&&this.componentID(i)):null}pushHookEvent(t,i,s,n,r){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",s,n]),!1;let[o,a,l]=this.putRef([{el:t,loading:!0,lock:!0}],s,"hook");return this.pushWithReply(()=>[o,a,l],"event",{type:"hook",event:s,value:n,cid:this.closestComponentID(i)}).then(({resp:h,reply:u})=>r(u,o)),o}extractMeta(t,i,s){let n=this.binding("value-");for(let r=0;r<t.attributes.length;r++){i||(i={});let o=t.attributes[r].name;o.startsWith(n)&&(i[o.replace(n,"")]=t.getAttribute(o))}if(t.value!==void 0&&!(t instanceof HTMLFormElement)&&(i||(i={}),i.value=t.value,t.tagName==="INPUT"&&ui.indexOf(t.type)>=0&&!t.checked&&delete i.value),s){i||(i={});for(let r in s)i[r]=s[r]}return i}pushEvent(t,i,s,n,r,o={},a){this.pushWithReply(()=>this.putRef([{el:i,loading:!0,lock:!0}],n,t,o),"event",{type:t,event:n,value:this.extractMeta(i,r,o.value),cid:this.targetComponentID(i,s,o)}).then(({reply:l})=>a&&a(l)).catch(l=>R("Failed to push event",l))}pushFileProgress(t,i,s,n=function(){}){this.liveSocket.withinOwners(t.form,(r,o)=>{r.pushWithReply(null,"progress",{event:t.getAttribute(r.binding(Ki)),ref:t.getAttribute(ee),entry_ref:i,progress:s,cid:r.targetComponentID(t.form,o)}).then(({resp:a})=>n(a)).catch(a=>R("Failed to push file progress",a))})}pushInput(t,i,s,n,r,o){if(!t.form)throw new Error("form events require the input to be inside a form");let a,l=Q(s)?s:this.targetComponentID(t.form,i,r),h=()=>this.putRef([{el:t,loading:!0,lock:!0},{el:t.form,loading:!0,lock:!0}],n,"change",r),u,m=this.extractMeta(t.form,{},r.value),g={};t instanceof HTMLButtonElement&&(g.submitter=t),t.getAttribute(this.binding("change"))?u=Xe(t.form,g,[t.name]):u=Xe(t.form,g),d.isUploadInput(t)&&t.files&&t.files.length>0&&I.trackFiles(t,Array.from(t.files)),a=I.serializeUploads(t);let p={type:"form",event:n,value:u,meta:J({_target:r._target||"undefined"},m),uploads:a,cid:l};this.pushWithReply(h,"event",p).then(({resp:c})=>{d.isUploadInput(t)&&d.isAutoUpload(t)?bt.onUnlock(t,()=>{if(I.filesAwaitingPreflight(t).length>0){let[v,b]=h();this.undoRefs(v,n,[t.form]),this.uploadFiles(t.form,n,i,v,l,O=>{o&&o(c),this.triggerAwaitingSubmit(t.form,n),this.undoRefs(v,n)})}}):o&&o(c)}).catch(c=>R("Failed to push input event",c))}triggerAwaitingSubmit(t,i){let s=this.getScheduledSubmit(t);if(s){let[n,r,o,a]=s;this.cancelSubmit(t,i),a()}}getScheduledSubmit(t){return this.formSubmits.find(([i,s,n,r])=>i.isSameNode(t))}scheduleSubmit(t,i,s,n){if(this.getScheduledSubmit(t))return!0;this.formSubmits.push([t,i,s,n])}cancelSubmit(t,i){this.formSubmits=this.formSubmits.filter(([s,n,r,o])=>s.isSameNode(t)?(this.undoRefs(n,i),!1):!0)}disableForm(t,i,s={}){let n=c=>!(Ie(c,`${this.binding(Ze)}=ignore`,c.form)||Ie(c,"data-phx-update=ignore",c.form)),r=c=>c.hasAttribute(this.binding(Mt)),o=c=>c.tagName=="BUTTON",a=c=>["INPUT","TEXTAREA","SELECT"].includes(c.tagName),l=Array.from(t.elements),h=l.filter(r),u=l.filter(o).filter(n),m=l.filter(a).filter(n);u.forEach(c=>{c.setAttribute(be,c.disabled),c.disabled=!0}),m.forEach(c=>{c.setAttribute(gt,c.readOnly),c.readOnly=!0,c.files&&(c.setAttribute(be,c.disabled),c.disabled=!0)});let g=h.concat(u).concat(m).map(c=>({el:c,loading:!0,lock:!0})),p=[{el:t,loading:!0,lock:!1}].concat(g).reverse();return this.putRef(p,i,"submit",s)}pushFormSubmit(t,i,s,n,r,o){let a=()=>this.disableForm(t,s,Ne(J({},r),{form:t,submitter:n}));d.putPrivate(t,"submitter",n);let l=this.targetComponentID(t,i);if(I.hasUploadsInProgress(t)){let[h,u]=a(),m=()=>this.pushFormSubmit(t,i,s,n,r,o);return this.scheduleSubmit(t,h,r,m)}else if(I.inputsAwaitingPreflight(t).length>0){let[h,u]=a(),m=()=>[h,u,r];this.uploadFiles(t,s,i,h,l,g=>{if(I.inputsAwaitingPreflight(t).length>0)return this.undoRefs(h,s);let p=this.extractMeta(t,{},r.value),c=Xe(t,{submitter:n});this.pushWithReply(m,"event",{type:"form",event:s,value:c,meta:p,cid:l}).then(({resp:v})=>o(v)).catch(v=>R("Failed to push form submit",v))})}else if(!(t.hasAttribute(V)&&t.classList.contains("phx-submit-loading"))){let h=this.extractMeta(t,{},r.value),u=Xe(t,{submitter:n});this.pushWithReply(a,"event",{type:"form",event:s,value:u,meta:h,cid:l}).then(({resp:m})=>o(m)).catch(m=>R("Failed to push form submit",m))}}uploadFiles(t,i,s,n,r,o){let a=this.joinCount,l=I.activeFileInputs(t),h=l.length;l.forEach(u=>{let m=new I(u,this,()=>{h--,h===0&&o()}),g=m.entries().map(c=>c.toPreflightPayload());if(g.length===0){h--;return}let p={ref:u.getAttribute(ee),entries:g,cid:this.targetComponentID(u.form,s)};this.log("upload",()=>["sending preflight request",p]),this.pushWithReply(null,"allow_upload",p).then(({resp:c})=>{if(this.log("upload",()=>["got preflight response",c]),m.entries().forEach(v=>{c.entries&&!c.entries[v.ref]&&this.handleFailedEntryPreflight(v.ref,"failed preflight",m)}),c.error||Object.keys(c.entries).length===0)this.undoRefs(n,i),(c.error||[]).map(([b,O])=>{this.handleFailedEntryPreflight(b,O,m)});else{let v=b=>{this.channel.onError(()=>{this.joinCount===a&&b()})};m.initAdapterUpload(c,v,this.liveSocket)}}).catch(c=>R("Failed to push upload",c))})}handleFailedEntryPreflight(t,i,s){if(s.isAutoUpload()){let n=s.entries().find(r=>r.ref===t.toString());n&&n.cancel()}else s.entries().map(n=>n.cancel());this.log("upload",()=>[`error for entry ${t}`,i])}dispatchUploads(t,i,s){let n=this.targetCtxElement(t)||this.el,r=d.findUploadInputs(n).filter(o=>o.name===i);r.length===0?R(`no live file inputs found matching the name "${i}"`):r.length>1?R(`duplicate live file inputs found matching the name "${i}"`):d.dispatchEvent(r[0],hi,{detail:{files:s}})}targetCtxElement(t){if(Q(t)){let[i]=d.findComponentNodeList(this.el,t);return i}else return t||null}pushFormRecovery(t,i,s,n){let r=this.binding("change"),o=i.getAttribute(this.binding("target"))||i,a=i.getAttribute(this.binding(Ut))||i.getAttribute(this.binding("change")),l=Array.from(t.elements).filter(m=>d.isFormInput(m)&&m.name&&!m.hasAttribute(r));if(l.length===0){n();return}l.forEach(m=>m.hasAttribute(ee)&&I.clearFiles(m));let h=l.find(m=>m.type!=="hidden")||l[0],u=0;this.withinTargets(o,(m,g)=>{let p=this.targetComponentID(i,g);u++;let c=new CustomEvent("phx:form-recovery",{detail:{sourceElement:t}});C.exec(c,"change",a,this,h,["push",{_target:h.name,targetView:m,targetCtx:g,newCid:p,callback:()=>{u--,u===0&&n()}}])},s,s)}pushLinkPatch(t,i,s,n){let r=this.liveSocket.setPendingLink(i),o=t.isTrusted&&t.type!=="popstate",a=s?()=>this.putRef([{el:s,loading:o,lock:!0}],null,"click"):null,l=()=>this.liveSocket.redirect(window.location.href),h=i.startsWith("/")?`${location.protocol}//${location.host}${i}`:i;this.pushWithReply(a,"live_patch",{url:h}).then(({resp:u})=>{this.liveSocket.requestDOMUpdate(()=>{u.link_redirect?this.liveSocket.replaceMain(i,null,n,r):(this.liveSocket.commitPendingLink(r)&&(this.href=i),this.applyPendingUpdates(),n&&n(r))})},({error:u,timeout:m})=>l())}getFormsForRecovery(){if(this.joinCount===0)return{};let t=this.binding("change");return d.all(this.el,`form[${t}]`).filter(i=>i.id).filter(i=>i.elements.length>0).filter(i=>i.getAttribute(this.binding(Ut))!=="ignore").map(i=>{let s=i.cloneNode(!1);return d.copyPrivates(s,i),Array.from(i.elements).forEach(n=>{let r=n.cloneNode(!0);mi(r,n),d.copyPrivates(r,n),s.appendChild(r)}),s}).reduce((i,s)=>(i[s.id]=s,i),{})}maybePushComponentsDestroyed(t){let i=t.filter(s=>d.findComponentNodeList(this.el,s).length===0);i.length>0&&(i.forEach(s=>this.rendered.resetRender(s)),this.pushWithReply(null,"cids_will_destroy",{cids:i}).then(()=>{this.liveSocket.requestDOMUpdate(()=>{let s=i.filter(n=>d.findComponentNodeList(this.el,n).length===0);s.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:s}).then(({resp:n})=>{this.rendered.pruneCIDs(n.cids)}).catch(n=>R("Failed to push components destroyed",n))})}).catch(s=>R("Failed to push components destroyed",s)))}ownsElement(t){let i=t.closest(fe);return t.getAttribute(ue)===this.id||i&&i.id===this.id||!i&&this.isDead}submitForm(t,i,s,n,r={}){d.putPrivate(t,Oe,!0),Array.from(t.elements).forEach(a=>d.putPrivate(a,Oe,!0)),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(t,i,s,n,r,()=>{this.liveSocket.restorePreviouslyActiveFocus()})}binding(t){return this.liveSocket.binding(t)}};var vi=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||Zi,this.opts=i,this.params=Re(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(Ge(ts),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=Ge(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||Gi,this.disconnectedTimeout=i.disconnectedTimeout||Qi,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||Fi,this.reloadJitterMin=i.reloadJitterMin||Mi,this.reloadJitterMax=i.reloadJitterMax||Ui,this.failsafeJitter=i.failsafeJitter||$i,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.boundEventNames=new Set,this.serverCloseRef=null,this.domCallbacks=Object.assign({jsQuerySelectorAll:null,onPatchStart:Re(),onPatchEnd:Re(),onNodeAdded:Re(),onBeforeElUpdated:Re()},i.dom||{}),this.transitions=new Hs,this.currentHistoryPosition=parseInt(this.sessionStorage.getItem(Be))||0,window.addEventListener("pagehide",s=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.0.17"}isProfileEnabled(){return this.sessionStorage.getItem(at)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(je)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(je)==="false"}enableDebug(){this.sessionStorage.setItem(je,"true")}enableProfiling(){this.sessionStorage.setItem(at,"true")}disableDebug(){this.sessionStorage.setItem(je,"false")}disableProfiling(){this.sessionStorage.removeItem(at)}enableLatencySim(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(lt,e)}disableLatencySim(){this.sessionStorage.removeItem(lt)}getLatencySim(){let e=this.sessionStorage.getItem(lt);return e?parseInt(e):null}getSocket(){return this.socket}connect(){window.location.hostname==="localhost"&&!this.isDebugDisabled()&&this.enableDebug();let e=()=>{this.resetReloadStatus(),this.joinRootViews()?(this.bindTopLevelEvents(),this.socket.connect()):this.main?this.socket.connect():this.bindTopLevelEvents({dead:!0}),this.joinDeadView()};["complete","loaded","interactive"].indexOf(document.readyState)>=0?e():document.addEventListener("DOMContentLoaded",()=>e())}disconnect(e){clearTimeout(this.reloadWithJitterTimer),this.serverCloseRef&&(this.socket.off(this.serverCloseRef),this.serverCloseRef=null),this.socket.disconnect(e)}replaceTransport(e){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(e),this.connect()}execJS(e,t,i=null){let s=new CustomEvent("phx:exec",{detail:{sourceElement:e}});this.owner(e,n=>C.exec(s,i,t,n,e))}execJSHookPush(e,t,i,s){this.withinOwners(e,n=>{let r=new CustomEvent("phx:exec",{detail:{sourceElement:e}});C.exec(r,"hook",t,n,e,["push",{data:i,callback:s}])})}unload(){this.unloaded||(this.main&&this.isConnected()&&this.log(this.main,"socket",()=>["disconnect for page nav"]),this.unloaded=!0,this.destroyAllViews(),this.disconnect())}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();os(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?setTimeout(()=>i(s),n):i(s)})}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=M.updateLocal(this.localStorage,window.location.pathname,ai,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.")?ps[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)}joinDeadView(){let e=document.body;if(e&&!this.isPhxView(e)&&!this.isPhxView(document.firstElementChild)){let t=this.newRootView(e);t.setHref(this.getHref()),t.joinDead(),this.main||(this.main=t),window.requestAnimationFrame(()=>{var i;t.execNewMounted(),this.maybeScroll((i=history.state)==null?void 0:i.scroll)})}}joinRootViews(){let e=!1;return d.all(document,`${fe}:not([${ue}])`,t=>{if(!this.getRootById(t.id)){let i=this.newRootView(t);d.isPhxSticky(t)||i.setHref(this.getHref()),i.join(),t.hasAttribute(yt)&&(this.main=i)}e=!0}),e}redirect(e,t,i){i&&M.setCookie(jt,i,60),this.unload(),M.redirect(e,t)}replaceMain(e,t,i=null,s=this.setPendingLink(e)){let n=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let r=d.findPhxSticky(document)||[],o=d.all(this.outgoingMainEl,`[${this.binding("remove")}]`).filter(l=>!d.isChildOfAny(l,r)),a=d.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(a,t,n),this.main.setRedirect(e),this.transitionRemoves(o),this.main.join((l,h)=>{l===1&&this.commitPendingLink(s)&&this.requestDOMUpdate(()=>{o.forEach(u=>u.remove()),r.forEach(u=>a.appendChild(u)),this.outgoingMainEl.replaceWith(a),this.outgoingMainEl=null,i&&i(s),h()})})}transitionRemoves(e,t){let i=this.binding("remove"),s=n=>{n.preventDefault(),n.stopImmediatePropagation()};e.forEach(n=>{for(let r of this.boundEventNames)n.addEventListener(r,s,!0);this.execJS(n,n.getAttribute(i),"remove")}),this.requestDOMUpdate(()=>{e.forEach(n=>{for(let r of this.boundEventNames)n.removeEventListener(r,s,!0)}),t&&t()})}isPhxView(e){return e.getAttribute&&e.getAttribute(K)!==null}newRootView(e,t,i){let s=new Ds(e,this,null,t,i);return this.roots[s.id]=s,s}owner(e,t){let i,s=e.closest(fe);return s?i=this.getViewByEl(s):i=this.main,i&&t?t(i):i}withinOwners(e,t){this.owner(e,i=>t(i,e))}getViewByEl(e){let t=e.getAttribute(re);return ce(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(re));t&&t.id===e.id?(t.destroy(),delete this.roots[t.id]):t&&t.destroyDescendent(e.id)}getActiveElement(){return document.activeElement}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({dead:e}={}){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.serverCloseRef=this.socket.onClose(t=>{if(t&&t.code===1e3&&this.main)return this.reloadWithJitter(this.main)}),document.body.addEventListener("click",function(){}),window.addEventListener("pageshow",t=>{t.persisted&&(this.getSocket().disconnect(),this.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())},!0),e||this.bindNav(),this.bindClicks(),e||this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(t,i,s,n,r,o)=>{let a=n.getAttribute(this.binding(zi)),l=t.key&&t.key.toLowerCase();if(a&&a.toLowerCase()!==l)return;let h=J({key:t.key},this.eventMeta(i,t,n));C.exec(t,i,r,s,n,["push",{data:h}])}),this.bind({blur:"focusout",focus:"focusin"},(t,i,s,n,r,o)=>{if(!o){let a=J({key:t.key},this.eventMeta(i,t,n));C.exec(t,i,r,s,n,["push",{data:a}])}}),this.bind({blur:"blur",focus:"focus"},(t,i,s,n,r,o)=>{if(o==="window"){let a=this.eventMeta(i,t,n);C.exec(t,i,r,s,n,["push",{data:a}])}}),this.on("dragover",t=>t.preventDefault()),this.on("drop",t=>{t.preventDefault();let i=ce(Ie(t.target,this.binding(Dt)),r=>r.getAttribute(this.binding(Dt))),s=i&&document.getElementById(i),n=Array.from(t.dataTransfer.files||[]);!s||s.disabled||n.length===0||!(s.files instanceof FileList)||(I.trackFiles(s,n,t.dataTransfer),s.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(hi,t=>{let i=t.target;if(!d.isUploadInput(i))return;let s=Array.from(t.detail.files||[]).filter(n=>n instanceof File||n instanceof Blob);I.trackFiles(i,s),i.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.resetReloadStatus(),this.linkRef}resetReloadStatus(){M.deleteCookie(jt)}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 h=l.getAttribute(o);this.debounce(l,n,s,()=>{this.withinOwners(l,u=>{t(n,i,u,l,h,"window")})})})})}}bindClicks(){this.on("mousedown",e=>this.clickStartedAtTarget=e.target),this.bindClick("click","click")}bindClick(e,t){let i=this.binding(t);window.addEventListener(e,s=>{let n=null;s.detail===0&&(this.clickStartedAtTarget=s.target);let r=this.clickStartedAtTarget||s.target;n=Ie(s.target,i),this.dispatchClickAway(s,r),this.clickStartedAtTarget=null;let o=n&&n.getAttribute(i);if(!o){d.isNewPageClick(s,window.location)&&this.unload();return}n.getAttribute("href")==="#"&&s.preventDefault(),!n.hasAttribute(V)&&this.debounce(n,s,"click",()=>{this.withinOwners(n,a=>{C.exec(s,"click",o,a,n,["push",{data:this.eventMeta("click",s,n)}])})})},!1)}dispatchClickAway(e,t){let i=this.binding("click-away");d.all(document,`[${i}]`,s=>{s.isSameNode(t)||s.contains(t)||this.withinOwners(s,n=>{let r=s.getAttribute(i);C.isVisible(s)&&C.isInViewport(s)&&C.exec(e,"click",r,n,s,["push",{data:this.eventMeta("click",e,e.target)}])})})}bindNav(){if(!M.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let e=null;window.addEventListener("scroll",t=>{clearTimeout(e),e=setTimeout(()=>{M.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:i,backType:s,id:n,scroll:r,position:o}=t.state||{},a=window.location.href,l=o>this.currentHistoryPosition;i=l?i:s||i,this.currentHistoryPosition=o||0,this.sessionStorage.setItem(Be,this.currentHistoryPosition.toString()),d.dispatchEvent(window,"phx:navigate",{detail:{href:a,patch:i==="patch",pop:!0,direction:l?"forward":"backward"}}),this.requestDOMUpdate(()=>{let h=()=>{this.maybeScroll(r)};this.main.isConnected()&&i==="patch"&&n===this.main.id?this.main.pushLinkPatch(t,a,null,h):this.replaceMain(a,null,h)})},!1),window.addEventListener("click",t=>{let i=Ie(t.target,ot),s=i&&i.getAttribute(ot);if(!s||!this.isConnected()||!this.main||d.wantsNewTab(t))return;let n=i.href instanceof SVGAnimatedString?i.href.baseVal:i.href,r=i.getAttribute(Bi);t.preventDefault(),t.stopImmediatePropagation(),this.pendingLink!==n&&this.requestDOMUpdate(()=>{if(s==="patch")this.pushHistoryPatch(t,n,r,i);else if(s==="redirect")this.historyRedirect(t,n,r,null,i);else throw new Error(`expected ${ot} to be "patch" or "redirect", got: ${s}`);let o=i.getAttribute(this.binding("click"));o&&this.requestDOMUpdate(()=>this.execJS(i,o,"click"))})},!1)}maybeScroll(e){typeof e=="number"&&requestAnimationFrame(()=>{window.scrollTo(0,e)})}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,s){if(!this.isConnected()||!this.main.isMain())return M.redirect(t);this.withPageLoading({to:t,kind:"patch"},n=>{this.main.pushLinkPatch(e,t,s,r=>{this.historyPatch(t,i,r),n()})})}historyPatch(e,t,i=this.setPendingLink(e)){this.commitPendingLink(i)&&(this.currentHistoryPosition++,this.sessionStorage.setItem(Be,this.currentHistoryPosition.toString()),M.updateCurrentState(s=>Ne(J({},s),{backType:"patch"})),M.pushState(t,{type:"patch",id:this.main.id,position:this.currentHistoryPosition},e),d.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:e,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location))}historyRedirect(e,t,i,s,n){let r=n&&e.isTrusted&&e.type!=="popstate";if(r&&n.classList.add("phx-click-loading"),!this.isConnected()||!this.main.isMain())return M.redirect(t,s);if(/^\/$|^\/[^\/]+.*$/.test(t)){let{protocol:a,host:l}=window.location;t=`${a}//${l}${t}`}let o=window.scrollY;this.withPageLoading({to:t,kind:"redirect"},a=>{this.replaceMain(t,s,l=>{l===this.linkRef&&(this.currentHistoryPosition++,this.sessionStorage.setItem(Be,this.currentHistoryPosition.toString()),M.updateCurrentState(h=>Ne(J({},h),{backType:"redirect"})),M.pushState(i,{type:"redirect",id:this.main.id,scroll:o,position:this.currentHistoryPosition},t),d.dispatchEvent(window,"phx:navigate",{detail:{href:t,patch:!1,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location)),r&&n.classList.remove("phx-click-loading"),a()})})}registerNewLocation(e){let{pathname:t,search:i}=this.currentLocation;return t+i===e.pathname+e.search?!1:(this.currentLocation=Ge(e),!0)}bindForms(){let e=0,t=!1;this.on("submit",i=>{let s=i.target.getAttribute(this.binding("submit")),n=i.target.getAttribute(this.binding("change"));!t&&n&&!s&&(t=!0,i.preventDefault(),this.withinOwners(i.target,r=>{r.disableForm(i.target),window.requestAnimationFrame(()=>{d.isUnloadableFormSubmit(i)&&this.unload(),i.target.submit()})}))}),this.on("submit",i=>{let s=i.target.getAttribute(this.binding("submit"));if(!s){d.isUnloadableFormSubmit(i)&&this.unload();return}i.preventDefault(),i.target.disabled=!0,this.withinOwners(i.target,n=>{C.exec(i,"submit",s,n,i.target,["push",{submitter:i.submitter}])})});for(let i of["change","input"])this.on(i,s=>{if(s instanceof CustomEvent&&s.target.form===void 0){if(s.detail&&s.detail.dispatcher)throw new Error(`dispatching a custom ${i} event is only supported on input elements inside a form`);return}let n=this.binding("change"),r=s.target;if(s.isComposing){let p=`composition-listener-${i}`;d.private(r,p)||(d.putPrivate(r,p,!0),r.addEventListener("compositionend",()=>{r.dispatchEvent(new Event(i,{bubbles:!0})),d.deletePrivate(r,p)},{once:!0}));return}let o=r.getAttribute(n),a=r.form&&r.form.getAttribute(n),l=o||a;if(!l||r.type==="number"&&r.validity&&r.validity.badInput)return;let h=o?r:r.form,u=e;e++;let{at:m,type:g}=d.private(r,"prev-iteration")||{};m===u-1&&i==="change"&&g==="input"||(d.putPrivate(r,"prev-iteration",{at:u,type:i}),this.debounce(r,s,i,()=>{this.withinOwners(h,p=>{d.putPrivate(r,Ye,!0),C.exec(s,"change",l,p,r,["push",{_target:s.target.name,dispatcher:h}])})}))});this.on("reset",i=>{let s=i.target;d.resetForm(s);let n=Array.from(s.elements).find(r=>r.type==="reset");n&&window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(e,t,i,s){if(i==="blur"||i==="focusout")return s();let n=this.binding(Wi),r=this.binding(Xi),o=this.defaults.debounce.toString(),a=this.defaults.throttle.toString();this.withinOwners(e,l=>{let h=()=>!l.isDestroyed()&&document.body.contains(e);d.debounce(e,t,n,o,r,a,h,()=>{s()})})}silenceEvents(e){this.silenced=!0,e(),this.silenced=!1}on(e,t){this.boundEventNames.add(e),window.addEventListener(e,i=>{this.silenced||t(i)})}jsQuerySelectorAll(e,t,i){let s=this.domCallbacks.jsQuerySelectorAll;return s?s(e,t,i):i()}},Hs=class{constructor(){this.transitions=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(e=>{clearTimeout(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.flushPendingOps()},e);this.transitions.add(s)}pushPendingOp(e){this.pendingOps.push(e)}size(){return this.transitions.size}flushPendingOps(){if(this.size()>0)return;let e=this.pendingOps.shift();e&&(e(),this.flushPendingOps())}};var Ns=document.querySelector("html").getAttribute("phx-socket")||"/live",Fs=document.querySelector("meta[name='csrf-token']").getAttribute("content"),te={},bi={};te.JsonEditor={mounted(){let e=this.el.getAttribute("data-input-id"),t=this;this.editor=new JSONEditor(this.el,{onChangeText:i=>{let s=document.getElementById(e);try{JSON.parse(i),s.value=i,s.dispatchEvent(new Event("change",{bubbles:!0,target:this.el.name}))}catch(n){}},onChange:()=>{try{let i=document.getElementById(e);json=t.editor.get(),i.value=JSON.stringify(json),i.dispatchEvent(new Event("change",{bubbles:!0,target:this.el.name}))}catch(i){}},onModeChange:i=>{t.mode=i},modes:["text","tree"]},JSON.parse(document.getElementById(e).value)),bi[this.el.id]=this.editor}};te.JsonEditorSource={updated(){try{let e=bi[this.el.getAttribute("data-editor-id")];e.getMode()==="tree"?e.update(JSON.parse(this.el.value)):e.get()!==JSON.parse(this.el.value)&&e.setText(this.el.value)}catch(e){}}};te.JsonView={updated(){let e=JSON.parse(this.el.getAttribute("data-json"));this.editor=new JSONEditor(this.el,{mode:"preview"},e)},mounted(){let e=JSON.parse(this.el.getAttribute("data-json"));this.editor=new JSONEditor(this.el,{mode:"preview"},e)}};var Ms=e=>new EasyMDE({element:e,initialValue:e.getAttribute("value")});te.MarkdownEditor={mounted(){let e=this.el.getAttribute("data-target-id"),t=document.getElementById(e),i=Ms(t);i.codemirror.on("change",()=>{t.value=i.value(),t.dispatchEvent(new Event("change",{bubbles:!0}))})}};te.Actor={mounted(){this.handleEvent("set_actor",e=>{document.cookie="actor_resource="+encodeURIComponent(e.resource)+";path=/",document.cookie="actor_primary_key="+encodeURIComponent(e.primary_key)+";path=/",document.cookie="actor_action="+encodeURIComponent(e.action)+";path=/",document.cookie="actor_domain="+encodeURIComponent(e.domain)+";path=/",document.cookie="actor_tenant="+encodeURIComponent(e.tenant)+";path=/"}),this.handleEvent("clear_actor",()=>{document.cookie="actor_resource=;path=/",document.cookie="actor_primary_key=;path=/",document.cookie="actor_action=;path=/",document.cookie="actor_tenant=;path=/",document.cookie="actor_domain=;path=/",document.cookie="actor_authorizing=false;path=/",document.cookie="actor_paused=true;path=/"}),this.handleEvent("toggle_authorizing",e=>{document.cookie="actor_authorizing="+e.authorizing+";path=/"}),this.handleEvent("toggle_actor_paused",e=>{document.cookie="actor_paused="+e.actor_paused+";path=/"})}};te.Tenant={mounted(){this.handleEvent("set_tenant",e=>{document.cookie="tenant="+e.tenant+";path=/"}),this.handleEvent("clear_tenant",()=>{document.cookie="tenant=;path=/"})}};te.MaintainAttrs={attrs(){return this.el.getAttribute("data-attrs").split(", ")},beforeUpdate(){this.prevAttrs=this.attrs().map(e=>[e,this.el.getAttribute(e)])},updated(){this.prevAttrs.forEach(([e,t])=>this.el.setAttribute(e,t))}};te.Typeahead={mounted(){this.aborter=new AbortController;let e=this.aborter.signal,t=this.el.getAttribute("data-target-id"),i=document.getElementById(t);switch(this.el.tagName){case"INPUT":this.el.addEventListener("keydown",s=>{s.key==="Enter"&&s.preventDefault()},{signal:e}),this.el.addEventListener("keyup",s=>{switch(s.key){case"Enter":case"Escape":this.el.blur(),window.setTimeout(function(){i.dispatchEvent(new Event("input",{bubbles:!0}))},750);break}},{signal:e});break;case"LI":this.el.addEventListener("click",s=>{window.setTimeout(function(){i.dispatchEvent(new Event("input",{bubbles:!0}))},750)},{signal:e});break}},updated(){this.el.tagName==="INPUT"&&this.el.name.match(/suggest$/)&&this.el.value.length===0&&this.el.focus()},beforeDestroy(){this.aborter&&this.aborter.abort()}};function oe(e){var t=new RegExp(e+"=([^;]+)"),i=t.exec(document.cookie);return i!=null?decodeURIComponent(i[1]):null}var Us=()=>({_csrf_token:Fs,tenant:oe("tenant"),actor_resource:oe("actor_resource"),actor_primary_key:oe("actor_primary_key"),actor_tenant:oe("actor_tenant"),actor_action:oe("actor_action"),actor_domain:oe("actor_domain"),actor_authorizing:oe("actor_authorizing"),actor_paused:oe("actor_paused")}),St=new vi(Ns,xt,{params:Us,hooks:te,dom:{onBeforeElUpdated(e,t){e._x_dataStack&&window.Alpine.clone(e,t)}}});et.default.config({barColors:{0:"#29d"},shadowColor:"rgba(0, 0, 0, .3)"});window.addEventListener("phx:page-loading-start",e=>et.default.show(300));window.addEventListener("phx:page-loading-stop",e=>et.default.hide());St.connect();St.enableDebug();window.liveSocket=St;})();
/**
* @license MIT
* topbar 2.0.0, 2023-02-04
* https://buunguyen.github.io/topbar
* Copyright (c) 2021 Buu Nguyen
*/