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