1(()=>{var Pi=Object.create;var Dt=Object.defineProperty;var Ri=Object.getOwnPropertyDescriptor;var xi=Object.getOwnPropertyNames;var Li=Object.getPrototypeOf,Ii=Object.prototype.hasOwnProperty;var Oi=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Di=(t,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xi(e))!Ii.call(t,n)&&n!==i&&Dt(t,n,{get:()=>e[n],enumerable:!(s=Ri(e,n))||s.enumerable});return t};var Hi=(t,e,i)=>(i=t!=null?Pi(Li(t)):{},Di(e||!t||!t.__esModule?Dt(i,"default",{value:t,enumerable:!0}):i,t));var Ci=Oi((Si,nt)=>{(function(t,e){"use strict";var i,s,n,r=null,o=null,a=null,h=function(f,d,v){f.addEventListener?f.addEventListener(d,v,!1):f.attachEvent?f.attachEvent("on"+d,v):f["on"+d]=v},l={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},p=function(){i.width=t.innerWidth,i.height=l.barThickness*5;var f=i.getContext("2d");f.shadowBlur=l.shadowBlur,f.shadowColor=l.shadowColor;var d=f.createLinearGradient(0,0,i.width,0);for(var v in l.barColors)d.addColorStop(v,l.barColors[v]);f.lineWidth=l.barThickness,f.beginPath(),f.moveTo(0,l.barThickness/2),f.lineTo(Math.ceil(s*i.width),l.barThickness/2),f.strokeStyle=d,f.stroke()},m=function(){i=e.createElement("canvas");var f=i.style;f.position="fixed",f.top=f.left=f.right=f.margin=f.padding=0,f.zIndex=100001,f.display="none",l.className&&i.classList.add(l.className),h(t,"resize",p)},g={config:function(f){for(var d in f)l.hasOwnProperty(d)&&(l[d]=f[d])},show:function(f){if(!n)if(f){if(a)return;a=setTimeout(()=>g.show(),f)}else n=!0,o!==null&&t.cancelAnimationFrame(o),i||m(),i.parentElement||e.body.appendChild(i),i.style.opacity=1,i.style.display="block",g.progress(0),l.autoRun&&function d(){r=t.requestAnimationFrame(d),g.progress("+"+.05*Math.pow(1-Math.sqrt(s),2))}()},progress:function(f){return typeof f>"u"||(typeof f=="string"&&(f=(f.indexOf("+")>=0||f.indexOf("-")>=0?s:0)+parseFloat(f)),s=f>1?1:f,p()),s},hide:function(){clearTimeout(a),a=null,n&&(n=!1,r!=null&&(t.cancelAnimationFrame(r),r=null),function f(){if(g.progress("+.1")>=1&&(i.style.opacity-=.05,i.style.opacity<=.05)){i.style.display="none",o=null;return}o=t.requestAnimationFrame(f)}())}};typeof nt=="object"&&typeof nt.exports=="object"?nt.exports=g:typeof define=="function"&&define.amd?define(function(){return g}):this.topbar=g}).call(Si,window,document)});(function(){var t=e();function e(){if(typeof window.CustomEvent=="function")return window.CustomEvent;function n(r,o){o=o||{bubbles:!1,cancelable:!1,detail:void 0};var a=document.createEvent("CustomEvent");return a.initCustomEvent(r,o.bubbles,o.cancelable,o.detail),a}return n.prototype=window.Event.prototype,n}function i(n,r){var o=document.createElement("input");return o.type="hidden",o.name=n,o.value=r,o}function s(n,r){var o=n.getAttribute("data-to"),a=i("_method",n.getAttribute("data-method")),h=i("_csrf_token",n.getAttribute("data-csrf")),l=document.createElement("form"),p=document.createElement("input"),m=n.getAttribute("target");l.method=n.getAttribute("data-method")==="get"?"get":"post",l.action=o,l.style.display="none",m?l.target=m:r&&(l.target="_blank"),l.appendChild(h),l.appendChild(a),document.body.appendChild(l),p.type="submit",l.appendChild(p),p.click()}window.addEventListener("click",function(n){var r=n.target;if(!n.defaultPrevented)for(;r&&r.getAttribute;){var o=new t("phoenix.link.click",{bubbles:!0,cancelable:!0});if(!r.dispatchEvent(o))return n.preventDefault(),n.stopImmediatePropagation(),!1;if(r.getAttribute("data-method")&&r.getAttribute("data-to"))return s(r,n.metaKey||n.shiftKey),n.preventDefault(),!1;r=r.parentNode}},!1),window.addEventListener("phoenix.link.click",function(n){var r=n.target.getAttribute("data-confirm");r&&!window.confirm(r)&&n.preventDefault()},!1)})();var we=t=>typeof t=="function"?t:function(){return t},Mi=typeof self<"u"?self:null,ye=typeof window<"u"?window:null,q=Mi||ye||globalThis,Ni="2.0.0",z={connecting:0,open:1,closing:2,closed:3},$i=100,Fi=1e4,Ui=1e3,B={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},ee={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},lt={longpoll:"longpoll",websocket:"websocket"},ji={complete:4}
vendor: 15,435 bytes, lines 1-2
1,ct="base64url.bearer.phx.",Be=class{constructor(t,e,i,s){this.channel=t,this.event=e,this.payload=i||function(){return{}},this.receivedResp=null,this.timeout=s,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(t){this.timeout=t,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:t,response:e,_ref:i}){this.recHooks.filter(s=>s.status===t).forEach(s=>s.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},Ht=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Bi=class{constructor(t,e,i){this.state=B.closed,this.topic=t,this.params=we(e||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Be(this,ee.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=B.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=B.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=B.closed,this.socket.remove(this)}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=B.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new Be(this,ee.leave,we({}),this.timeout).send(),this.state=B.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(ee.reply,(s,n)=>{this.trigger(this.replyEventName(n),s)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(t){this.on(ee.close,t)}onError(t){return this.on(ee.error,e=>t(e))}on(t,e){let i=this.bindingRef++;return this.bindings.push({event:t,ref:i,callback:e}),i}off(t,e){this.bindings=this.bindings.filter(i=>!(i.event===t&&(typeof e>"u"||e===i.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,i=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let s=new Be(this,t,function(){return e},i);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=B.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(ee.close,"leave")},i=new Be(this,ee.leave,we({}),t);return i.receive("ok",()=>e()).receive("timeout",()=>e()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(t,e,i){return e}isMember(t,e,i,s){return this.topic!==t?!1:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:i,joinRef:s}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=B.joining,this.joinPush.resend(t))}trigger(t,e,i,s){let n=this.onMessage(t,e,i,s);if(e&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(o=>o.event===t);for(let o=0;o<r.length;o++)r[o].callback(n,i,s||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===B.closed}isErrored(){return this.state===B.errored}isJoined(){return this.state===B.joined}isJoining(){return this.state===B.joining}isLeaving(){return this.state===B.leaving}},Je=class{static request(t,e,i,s,n,r,o){if(q.XDomainRequest){let a=new q.XDomainRequest;return this.xdomainRequest(a,t,e,s,n,r,o)}else if(q.XMLHttpRequest){let a=new q.XMLHttpRequest;return this.xhrRequest(a,t,e,i,s,n,r,o)}else{if(q.fetch&&q.AbortController)return this.fetchRequest(t,e,i,s,n,r,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,i,s,n,r,o){let a={method:t,headers:i,body:s},h=null;if(n){h=new AbortController;let l=setTimeout(()=>h.abort(),n);a.signal=h.signal}return q.fetch(e,a).then(l=>l.text()).then(l=>this.parseJSON(l)).then(l=>o&&o(l)).catch(l=>{l.name==="AbortError"&&r?r():o&&o(null)}),h}static xdomainRequest(t,e,i,s,n,r,o){return t.timeout=n,t.open(e,i),t.onload=()=>{let a=this.parseJSON(t.responseText);o&&o(a)},r&&(t.ontimeout=r),t.onprogress=()=>{},t.send(s),t}static xhrRequest(t,e,i,s,n,r,o,a){t.open(e,i,!0),t.timeout=r;for(let[h,l]of Object.entries(s))t.setRequestHeader(h,l);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===ji.complete&&a){let h=this.parseJSON(t.responseText);a(h)}},o&&(t.ontimeout=o),t.send(n),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let i=[];for(var s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;let n=e?`${e}[${s}]`:s,r=t[s];typeof r=="object"?i.push(this.serialize(r,n)):i.push(encodeURIComponent(n)+"="+encodeURIComponent(r))}return i.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let i=t.match(/\?/)?"&":"?";return`${t}${i}${this.serialize(e)}`}},Vi=t=>{let e="",i=new Uint8Array(t),s=i.byteLength;for(let n=0;n<s;n++)e+=String.fromCharCode(i[n]);return btoa(e)},be=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(ct)&&(this.authToken=atob(e[1].slice(ct.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=z.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+lt.websocket),"$1/"+lt.longpoll)}endpointURL(){return Je.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,i){this.close(t,e,i),this.readyState=z.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===z.open||this.readyState===z.connecting}poll(){let t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:i,token:s,messages:n}=e;if(i===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=s}else i=0;switch(i){case 200:n.forEach(r=>{setTimeout(()=>this.onmessage({data:r}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=z.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${i}`)}})}send(t){typeof t!="string"&&(t=Vi(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t,e=0){this.awaitingBatchAck=!0;let i=e+$i,s=t.slice(e,i);this.ajax("POST",{"Content-Type":"application/x-ndjson"},s.join(` 2`),()=>this.onerror("timeout"),n=>{!n||n.status!==200?(this.awaitingBatchAck=!1,this.onerror(n&&n.status),this.closeAndRetry(1011,"internal server error",!1)):i<t.length?this.batchSend(t,i):this.batchBuffer.length>0?(this.batchSend(this.batchBuffer),this.batchBuffer=[]):this.awaitingBatchAck=!1})}close(t,e,i){for(let n of this.reqs)n.abort();this.readyState=z.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:i});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",s)):this.onclose(s)}ajax(t,e,i,s,n){let r,o=()=>{this.reqs.delete(r),s()};r=Je.request(t,this.endpointURL(),e,i,this.timeout,o,a=>{this.reqs.delete(r),this.isActive()&&n(a)}),this.reqs.add(r)}};var Ve={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let i=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(i))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[i,s,n,r,o]=JSON.parse(t);return e({join_ref:i,ref:s,topic:n,event:r,payload:o})}},binaryEncode(t){let{join_ref:e,ref:i,event:s,topic:n,payload:r}=t,o=new TextEncoder,a=o.encode(e),h=o.encode(i),l=o.encode(n),p=o.encode(s);this.assertFieldSize(a.byteLength,"join_ref"),this.assertFieldSize(h.byteLength,"ref"),this.assertFieldSize(l.byteLength,"topic"),this.assertFieldSize(p.byteLength,"event");let m=this.META_LENGTH+a.byteLength+h.byteLength+l.byteLength+p.byteLength,g=new ArrayBuffer(this.HEADER_LENGTH+m),f=new Uint8Array(g),d=new DataView(g),v=0;d.setUint8(v++,this.KINDS.push),d.setUint8(v++,a.byteLength),d.setUint8(v++,h.byteLength),d.setUint8(v++,l.byteLength),d.setUint8(v++,p.byteLength),f.set(a,v),v+=a.byteLength,f.set(h,v),v+=h.byteLength,f.set(l,v),v+=l.byteLength,f.set(p,v),v+=p.byteLength;var b=new Uint8Array(g.byteLength+r.byteLength);return b.set(f,0),b.set(new Uint8Array(r),g.byteLength),b.buffer},assertFieldSize(t,e){if(t>255)throw new Error(`unable to convert ${e} to binary: must be less than or equal to 255 bytes, but is ${t} bytes`)},binaryDecode(t){let e=new DataView(t),i=e.getUint8(0),s=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(t,e,s);case this.KINDS.reply:return this.decodeReply(t,e,s);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,s)}},decodePush(t,e,i){let s=e.getUint8(1),n=e.getUint8(2),r=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=i.decode(t.slice(o,o+s));o=o+s;let h=i.decode(t.slice(o,o+n));o=o+n;let l=i.decode(t.slice(o,o+r));o=o+r;let p=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:h,event:l,payload:p}},decodeReply(t,e,i){let s=e.getUint8(1),n=e.getUint8(2),r=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,h=i.decode(t.slice(a,a+s));a=a+s;let l=i.decode(t.slice(a,a+n));a=a+n;let p=i.decode(t.slice(a,a+r));a=a+r;let m=i.decode(t.slice(a,a+o));a=a+o;let g=t.slice(a,t.byteLength),f={status:m,response:g};return{join_ref:h,ref:l,topic:p,event:ee.reply,payload:f}},decodeBroadcast(t,e,i){let s=e.getUint8(1),n=e.getUint8(2),r=this.HEADER_LENGTH+2,o=i.decode(t.slice(r,r+s));r=r+s;let a=i.decode(t.slice(r,r+n));r=r+n;let h=t.slice(r,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:h}}},Mt=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||Fi,this.transport=e.transport||q.WebSocket||be,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=e.sessionStorage||q&&q.sessionStorage,this.establishedConnections=0,this.defaultEncoder=Ve.encode.bind(Ve),this.defaultDecoder=Ve.decode.bind(Ve),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.transport!==be?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;ye&&ye.addEventListener&&(ye.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock)}),ye.addEventListener("pageshow",s=>{i===this.connectClock&&(i=null,this.connect())}),ye.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.rejoinAfterMs=s=>e.rejoinAfterMs?e.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>e.reconnectAfterMs?e.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(s,n,r)=>{console.log(`${s}: ${n}`,r)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=we(e.params||{}),this.endPoint=`${t}/${lt.websocket}`,this.vsn=e.vsn||Ni,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Ht(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(()=>this.connect())},this.reconnectAfterMs),this.authToken=e.authToken&&we(e.authToken)}getLongPollTransport(){return be}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=Je.appendParams(Je.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,i){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,i)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=we(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==be?this.connectWithF
vendor: 4,272 bytes, line 2
2allback(be,this.longPollFallbackMs):this.transportConnect())}log(t,e,i){this.logger&&this.logger(t,e,i)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),i=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let s=this.onMessage(n=>{n.ref===e&&(this.off([s]),t(Date.now()-i))});return!0}transportName(t){switch(t){case be:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${ct}${btoa(this.authToken()).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let i=!1,s=!0,n,r,o=this.transportName(t),a=h=>{this.log("transport",`falling back to ${o}...`,h),this.off([n,r]),s=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,e),r=this.onError(h=>{this.log("transport","error",h),s&&!i&&(clearTimeout(this.fallbackTimer),a(h))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!s){let h=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${h}`,"true"),this.log("transport",`established ${h} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,e),this.ping(h=>{this.log("transport","connected to primary after",h),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transportName(this.transport)} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,t])=>t())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Ui,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,i){if(!this.conn)return t&&t();let s=this.conn;this.waitForBufferDone(s,()=>{e?s.close(e,i||""):s.close(),this.waitForSocketClosed(s,()=>{this.conn===s&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,i=1){if(i===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,i+1)},150*i)}waitForSocketClosed(t,e,i=1){if(i===5||t.readyState===z.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,i+1)},150*i)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{});let e=t&&t.code;this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&e!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,i])=>i(t))}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,i=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,s])=>{s(t,e,i)}),(e===this.transport||i>0)&&this.triggerChanError()}
2triggerChanError(){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(ee.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case z.connecting:return"connecting";case z.open:return"open";case z.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([i])=>t.indexOf(i)===-1)}channel(t,e={}){let i=new Bi(t,e,this);return this.channels.push(i),i}push(t){if(this.hasLogger()){let{topic:e,event:i,payload:s,ref:n,join_ref:r}=t;this.log("push",`${e} ${i} (${r}, ${n})`,s)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:i,event:s,payload:n,ref:r,join_ref:o}=e;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${n.status||""} ${i} ${s} ${r&&"("+r+")"||""}`,n);for(let a=0;a<this.channels.length;a++){let h=this.channels[a];h.isMember(i,s,n,o)&&h.trigger(s,n,r,o)}for(let a=0;a<this.stateChangeCallbacks.message.length;a++){let[,h]=this.stateChangeCallbacks.message[a];h(e)}})}leaveOpenTopic(t){let e=this.channels.find(i=>i.topic===t&&(i.isJoined()||i.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};var fi="consecutive-reloads",Ji=10,Xi=5e3,Wi=1e4,qi=3e4,pi=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading","phx-hook-loading"],dt="phx-drop-target-active",Y="data-phx-component",Te="data-phx-view",ut="data-phx-link",zi="track-static",Nt="data-phx-link-state",_e="data-phx-ref-loading",X="data-phx-ref-src",L="data-phx-ref-lock",$t="phx-pending-refs",mi="track-uploads",ie="data-phx-upload-ref",_t="data-phx-preflighted-refs",Ki="data-phx-done-refs",Xe="drop-target",bt="data-phx-active-refs",Ye="phx:live-file:updated",gi="data-phx-skip",yt="data-phx-id",Ft="data-phx-prune",Ut="phx-connected",le="phx-loading",ke="phx-error",jt="phx-client-error",Re="phx-server-error",pe="data-phx-parent-id",Pt="data-phx-main",te="data-phx-root-id",wt="viewport-top",kt="viewport-bottom",Gi="viewport-overrun-target",Yi="trigger-action",tt="phx-has-focused",Qi=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],vi=["checkbox","radio"],Ne="phx-has-submitted",Q="data-phx-session",$e=`[${Q}]`,At="data-phx-sticky",fe="data-phx-static",Et="data-phx-readonly",Se="data-phx-disabled",Bt="disable-with",it="data-phx-disable-with-restore",xe="hook",Zi="debounce",es="throttle",st="update",Qe="stream",Le="data-phx-stream",Rt="data-phx-portal",me="data-phx-teleported",he="data-phx-teleported-src",Ze="data-phx-runtime-hook",ts="data-phx-pid",is="key",K="phxPrivate",Vt="auto-recover",Jt="no-unused-field",We="phx:live-socket:debug",ft="phx:live-socket:profiling",pt="phx:live-socket:latency-sim",qe="phx:nav-history-position",ss="progress",Xt="mounted",Wt="__phoenix_reload_status__",ns=1,qt=3,rs=200,os=500,as="phx-",hs=3e4,Ie="debounce-trigger",Oe="throttled",zt="debounce-prev-key",ls={debounce:300,throttle:300},Kt=[_e,X,L],J="s",mt="r",$="c",x="k",G="kc",Gt="e",Yt="r",Qt="t",re="p",Ae="stream",cs=class{constructor(t,e,i){let{chunk_size:s,chunk_timeout:n}=e;this.liveSocket=i,this.entry=t,this.offset=0,this.chunkSize=s,this.chunkTimeout=n,this.chunkTimer=null,this.errored=!1,this.uploadChannel=i.channel(`lvu:${t.ref}`,{token:t.metadata()})}error(t){this.errored||(this.uploadChannel.leave(),this.errored=!0,this.chunkTimer!=null&&clearTimeout(this.chunkTimer),this.entry.error(t))}upload(){this.uploadChannel.onError(t=>this.error(t)),this.uploadChannel.join().receive("ok",t=>this.readNextChunk()).receive("error",({reason:t})=>this.error(t))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let t=new window.FileReader,e=this.entry.file.slice(this.offset,this.chunkSize+this.offset);t.onload=i=>{if(i.target?.error===null)this.offset+=i.target.result.byteLength,this.pushChunk(i.target.result);else return _("Read error: "+i.target?.error)},t.readAsArrayBuffer(e)}pushChunk(t){this.uploadChannel.isJoined()&&this.uploadChannel.push("chunk",t,this.chunkTimeout).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))}).receive("error",({reason:e})=>this.error(e))}},_=(t,e)=>console.error&&console.error(t,e),Zt=(t,e)=>{let i;try{i=new URL(t,window.location.href)}catch{throw new Error(`expected ${e} destination to be a valid URL, got: ${t}`)}if(i.origin!==window.location.origin)throw new Error(`cannot ${e} to "${t}" because its origin does not match the current origin "${window.location.origin}". Use window.location directly for cross-origin navigation.`)},ae=t=>{let e=typeof t;return e==="number"||e==="string"&&/^(0|[1-9]\d*)$/.test(t)};function ds(){let t=new Set,e=document.querySelectorAll("*[id]");for(let i=0,s=e.length;i<s;i++)t.has(e[i].id)?console.error(`Multiple IDs detected: ${e[i].id}. Ensure unique element ids.`):t.add(e[i].id)}function us(t){let e=new Set;Object.keys(t).forEach(i=>
2{let s=document.getElementById(i);s&&s.parentElement&&s.parentElement.getAttribute("phx-update")!=="stream"&&e.add(`The stream container with id "${s.parentElement.id}" is missing the phx-update="stream" attribute. Ensure it is set for streams to work properly.`)}),e.forEach(i=>console.error(i))}var fs=(t,e,i,s)=>{t.liveSocket.isDebugEnabled()&&console.log(`${t.id} ${e}: ${i} - `,s)},De=t=>typeof t=="function"?t:function(){return t},et=t=>JSON.parse(JSON.stringify(t)),ue=(t,e,i)=>{let s=t;do{if(s.matches(`[${e}]`)&&!("disabled"in s&&s.disabled))return s;s=s.parentElement}while(s!==null&&s.nodeType===1&&!(i&&i.isSameNode(s)||s.matches($e)));return null},Ee=t=>t!==null&&typeof t=="object"&&!(t instanceof Array),ps=(t,e)=>JSON.stringify(t)===JSON.stringify(e),ei=t=>{for(let e in t)return!1;return!0},Ce=(t,e)=>t&&e(t),ms=function(t,e,i,s){t.forEach(n=>{new cs(n,i.config,s).upload()})},gs=t=>{if(t.dataTransfer.types){for(let e=0;e<t.dataTransfer.types.length;e++)if(t.dataTransfer.types[e]==="Files")return!0}return!1},vs={canPushState(){return typeof history.pushState<"u"},dropLocal(t,e,i){return t.removeItem(this.localKey(e,i))},updateLocal(t,e,i,s,n){let r=this.getLocal(t,e,i),o=this.localKey(e,i),a=r===null?s:n(r);return t.setItem(o,JSON.stringify(a)),a},getLocal(t,e,i){return JSON.parse(t.getItem(this.localKey(e,i)))},updateCurrentState(t){this.canPushState()&&history.replaceState(t(history.state||{}),"",window.location.href)},pushState(t,e,i){if(this.canPushState()){if(i!==window.location.href){if(e.type=="redirect"&&e.scroll){let s=history.state||{};s.scroll=e.scroll,history.replaceState(s,"",window.location.href)}delete e.scroll,history[t+"State"](e,"",i||null),window.requestAnimationFrame(()=>{let s=this.getHashTargetEl(window.location.hash);s?s.scrollIntoView():e.type==="redirect"&&window.scroll(0,0)})}}else i&&this.redirect(i)},setCookie(t,e,i){let s=typeof i=="number"?` max-age=${i};`:"";document.cookie=`${t}=${e};${s} path=/`},getCookie(t){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${t}s*=s*([^;]*).*$)|^.*$`),"$1")},deleteCookie(t){document.cookie=`${t}=; max-age=-1; path=/`},redirect(t,e=null,i=s=>{window.location.href=s}){e&&this.setCookie("__phoenix_flash__",e,60),i(t)},localKey(t,e){return`${t}-${e}`},getHashTargetEl(t){let e=t.toString().substring(1);if(e!=="")return document.getElementById(e)||document.querySelector(`a[name="${e}"]`)}},U=vs,de={byId(t){return document.getElementById(t)||_(`no id found for ${t}`)},elementFromTarget(t){return t instanceof Node?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null},removeClass(t,e){t.classList.remove(e),t.classList.length===0&&t.removeAttribute("class")},all(t,e,i){if(!t)return[];let s=Array.from(t.querySelectorAll(e));return i&&s.forEach(i),s},childNodeLength(t){let e=document.createElement("template");return e.innerHTML=t,e.content.childElementCount},isUploadInput(t){return t.type==="file"&&t.getAttribute(ie)!==null},isAutoUpload(t){return t.hasAttribute("data-phx-auto-upload")},findUploadInputs(t){let e=t.id,i=this.all(document,`input[type="file"][${ie}][form="${e}"]`);return this.all(t,`input[type="file"][${ie}]`).concat(i)},findComponent(t,e,i=document){return i.querySelector(`[${Te}="${t}"][${Y}="${e}"]`)},getComponent(t,e,i=document){let s=this.findComponent(t,e,i);if(!s)throw new Error(`no component found matching viewId ${t} and cid ${e}`);return s},isPhxDestroyed(t){return!!(t.id&&de.private(t,"destroyed"))},wantsNewTab(t){let e=t.ctrlKey||t.shiftKey||t.metaKey||t.button&&t.button===1,i=t.target instanceof HTMLAnchorElement&&t.target.hasAttribute("download"),s=t.target.hasAttribute("target")&&t.target.getAttribute("target").toLowerCase()==="_blank",n=t.target.hasAttribute("target")&&!t.target.getAttribute("target").startsWith("_");return e||s||i||n},isUnloadableFormSubmit(t){return t.target&&t.target.getAttribute("method")==="dialog"||t.submitter&&t.submitter.getAttribute("formmethod")==="dialog"?!1:!t.defaultPrevented&&!this.wantsNewTab(t)},isNewPageClick(t,e){let i=t.target instanceof HTMLAnchorElement?t.target.getAttribute("href"):null,s;if(t.defaultPrevented||i===null||this.wantsNewTab(t)||i.startsWith("mailto:")||i.startsWith("tel:")||t.target.isContentEditable)return!1;try{s=new URL(i)}
2catch{try{s=new URL(i,e)}catch{return!0}}return s.host===e.host&&s.protocol===e.protocol&&s.pathname===e.pathname&&s.search===e.search?s.hash===""&&!s.href.endsWith("#"):s.protocol.startsWith("http")},markPhxChildDestroyed(t){this.isPhxChild(t)&&t.setAttribute(Q,""),this.putPrivate(t,"destroyed",!0)},findPhxChildrenInFragment(t,e){let i=document.createElement("template");return i.innerHTML=t,this.findPhxChildren(i.content,e)},isIgnored(t,e){return(t.getAttribute(e)||t.getAttribute("data-phx-update"))==="ignore"},isPhxUpdate(t,e,i){return t.getAttribute&&i.indexOf(t.getAttribute(e))>=0},findPhxSticky(t){return this.all(t,`[${At}]`)},findPhxChildren(t,e){return this.all(t,`${$e}[${pe}="${e}"]`)},findExistingParentCIDs(t,e){let i=new Set,s=new Set;return e.forEach(n=>{this.all(document,`[${Te}="${t}"][${Y}="${n}"]`).forEach(r=>{i.add(n),this.all(r,`[${Te}="${t}"][${Y}]`).map(o=>parseInt(o.getAttribute(Y))).forEach(o=>s.add(o))})}),s.forEach(n=>i.delete(n)),i},private(t,e){return t[K]&&t[K][e]},deletePrivate(t,e){t[K]&&delete t[K][e]},putPrivate(t,e,i){t[K]||(t[K]={}),t[K][e]=i},updatePrivate(t,e,i,s){let n=this.private(t,e);n===void 0?this.putPrivate(t,e,s(i)):this.putPrivate(t,e,s(n))},syncPendingAttrs(t,e){t.hasAttribute(X)&&(pi.forEach(i=>{t.classList.contains(i)&&e.classList.add(i)}),Kt.filter(i=>t.hasAttribute(i)).forEach(i=>{e.setAttribute(i,t.getAttribute(i))}))},copyPrivates(t,e){e[K]&&(t[K]=e[K])},putTitle(t){let e=document.querySelector("title");if(e){let{prefix:i,suffix:s,default:n}=e.dataset,r=typeof t!="string"||t.trim()==="";if(r&&typeof n!="string")return;let o=r?n:t;document.title=`${i||""}${o||""}${s||""}`}else document.title=t},debounce(t,e,i,s,n,r,o,a){let h=t.getAttribute(i),l=t.getAttribute(n);h===""&&(h=s),l===""&&(l=r);let p=h||l;switch(p){case null:return a();case"blur":this.incCycle(t,"debounce-blur-cycle",()=>{o()&&a()}),this.once(t,"debounce-blur")&&t.addEventListener("blur",()=>this.triggerCycle(t,"debounce-blur-cycle"));return;default:let m=parseInt(p),g=()=>l?this.deletePrivate(t,Oe):a(),f=this.incCycle(t,Ie,g);if(isNaN(m))return _(`invalid throttle/debounce value: ${p}`);if(l){let v=!1;if(e.type==="keydown"){let b=this.private(t,zt);this.putPrivate(t,zt,e.key),v=b!==e.key}if(!v&&this.private(t,Oe))return!1;{a();let b=setTimeout(()=>{o()&&this.triggerCycle(t,Ie)},m);this.putPrivate(t,Oe,b)}}else setTimeout(()=>{o()&&this.triggerCycle(t,Ie,f)},m);let d=t.form;d&&this.once(d,"bind-debounce")&&d.addEventListener("submit",()=>{Array.from(new FormData(d).entries(),([v])=>{let b=d.elements.namedItem(v),R=b instanceof RadioNodeList?b[0]:b;R&&(this.incCycle(R,Ie),this.deletePrivate(R,Oe))})}),this.once(t,"bind-debounce")&&t.addEventListener("blur",()=>{clearTimeout(this.private(t,Oe)),o()&&this.triggerCycle(t,Ie)})}},triggerCycle(t,e,i){let[s,n]=this.private(t,e);i||(i=s),i===s&&(this.incCycle(t,e),n())},once(t,e){return this.private(t,e)===!0?!1:(this.putPrivate(t,e,!0),!0)},incCycle(t,e,i=function(){}){let[s]=this.private(t,e)||[0,i];return s++,this.putPrivate(t,e,[s,i]),s},maintainPrivateHooks(t,e,i,s){t.hasAttribute&&t.hasAttribute("data-phx-hook")&&!e.hasAttribute("data-phx-hook")&&e.setAttribute("data-phx-hook",t.getAttribute("data-phx-hook")),e.hasAttribute&&(e.hasAttribute(i)||e.hasAttribute(s))&&e.setAttribute("data-phx-hook","Phoenix.InfiniteScroll")},putCustomElHook(t,e){t.isConnected?t.setAttribute("data-phx-hook",""):console.error(` 3 hook attached to non-connected DOM element 4 ensure you are calling createHook within your connectedCallback. ${t.outerHTML} 5 `),this.putPrivate(t,"custom-el-hook",e)},getCustomElHook(t){return this.private(t,"custom-el-hook")},isUsedInput(t){return t.nodeType===Node.ELEMENT_NODE&&(this.private(t,tt)||this.private(t,Ne))},resetForm(t){Array.from(t.elements).forEach(e=>{this.deletePrivate(e,tt),this.deletePrivate(e,Ne)})},isPhxChild(t){return t.getAttribute&&t.getAttribute(pe)},isPhxSticky(t){return t.getAttribute&&t.getAttribute(At)!==null},isChildOfAny(t,e){return!!e.find(i=>i.contains(t))},firstPhxChild(t){return this.isPhxChild(t)?t:this.all(t,`[${pe}]`)[0]},isPortalTemplate(t){return t.tagName==="TEMPLATE"&&t.hasAttribute(Rt)},closestViewEl(t){let e=t.closest(`[${me}],${$e}`);return e?e.hasAttribute(me)?this.byId(e.getAttribute(me)):e.hasAttribute(Q)?e:null:null},dispatchEvent(t,e,i={}){let s=!0;t.nodeName==="INPUT"&&t.type==="file"&&e==="click"&&(s=!1);let o={bubbles:i.bubbles===void 0?s:!!i.bubbles,cancelable:!0,detail:i.detail||{}},a=e==="click"?new MouseEvent("click",o):new CustomEvent(e,o);t.dispatchEvent(a)},cloneNode(t,e){if(typeof e>"u")return t.cloneNode(!0);{let i=t.cloneNode(!1);return i.innerHTML=e,i}},mergeAttrs(t,e,i={}){let s=new Set(i.exclude||[]),n=i.isIgnored,r=e.attributes;for(let a=r.length-1;a>=0;a--){let h=r[a].name;if(s.has(h)){if(h==="value"){let l=e.value??e.getAttribute(h);t.value===l&&t.setAttribute("value",e.getAttribute(h))}}else{let l=e.getAttribute(h);t.getAttribute(h)!==l&&(!n||n&&h.startsWith("data-"))&&t.setAttribute(h,l)}}let o=t.attributes;for(let a=o.length-1;a>=0;a--){let h=o[a].name;n?h.startsWith("data-")&&!e.hasAttribute(h)&&!Kt.includes(h)&&t.removeAttribute(h):e.hasAttribute(h)||t.removeAttribute(h)}},mergeFocusedInput(t,e){t instanceof HTMLSelectElement||de.mergeAttrs(t,e,{exclude:["value"]}),e.readOnly?t.setAttribute("readonly",!0):t.removeAttribute("readonly")},hasSelectionRange(t){return t.setSelectionRange&&(t.type==="text"||t.type==="textarea")},restoreFocus(t,e,i){if(t instanceof HTMLSelectElement&&t.focus(),!de.isTextualInput(t))return;
5t.matches(":focus")||t.focus(),this.hasSelectionRange(t)&&t.setSelectionRange(e,i)},isEditableInput(t){return this.isFormAssociated(t)&&!(t instanceof HTMLButtonElement)&&!(t instanceof HTMLInputElement&&t.type==="button")},isFormAssociated(t){if(!(t instanceof HTMLElement))return!1;if(t.localName){let e=customElements.get(t.localName);if(e)return e.formAssociated===!0}return t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLButtonElement},syncAttrsToProps(t){t instanceof HTMLInputElement&&vi.indexOf(t.type.toLocaleLowerCase())>=0&&(t.checked=t.getAttribute("checked")!==null)},isTextualInput(t){return Qi.indexOf(t.type)>=0},isNowTriggerFormExternal(t,e){return t.getAttribute&&t.getAttribute(e)!==null&&document.body.contains(t)},cleanChildNodes(t,e){if(de.isPhxUpdate(t,e,["append","prepend",Qe])){let i=[];t.childNodes.forEach(s=>{(!("id"in s)||!s.id)&&(!(s.nodeType===Node.TEXT_NODE&&s.nodeValue&&s.nodeValue.trim()==="")&&s.nodeType!==Node.COMMENT_NODE&&_(`only HTML element tags with an id are allowed inside containers with phx-update. 6 7removing illegal node: "${("outerHTML"in s&&s.outerHTML||s.nodeValue||"").trim()}" 8 9`),i.push(s))}
9),i.forEach(s=>s.remove())}},replaceRootContainer(t,e,i){let s=new Set(["id",Q,fe,Pt,te]);if(t.tagName.toLowerCase()===e.toLowerCase())return Array.from(t.attributes).filter(n=>!s.has(n.name.toLowerCase())).forEach(n=>t.removeAttribute(n.name)),Object.keys(i).filter(n=>!s.has(n.toLowerCase())).forEach(n=>t.setAttribute(n,i[n])),t;{let n=document.createElement(e);return Object.keys(i).forEach(r=>n.setAttribute(r,i[r])),s.forEach(r=>{let o=t.getAttribute(r);o!==null&&n.setAttribute(r,o)}),n.innerHTML=t.innerHTML,t.replaceWith(n),n}},getSticky(t,e,i){let s=(de.private(t,"sticky")||[]).find(([n])=>e===n);if(s){let[n,r,o]=s;return o}else return typeof i=="function"?i():i},deleteSticky(t,e){this.updatePrivate(t,"sticky",[],i=>i.filter(([s,n])=>s!==e))},putSticky(t,e,i){let s=i(t);this.updatePrivate(t,"sticky",[],n=>{let r=n.findIndex(([o])=>e===o);return r>=0?n[r]=[e,i,s]:n.push([e,i,s]),n})},applyStickyOperations(t){let e=de.private(t,"sticky");e&&e.forEach(([i,s,n])=>this.putSticky(t,i,s))},isLocked(t){return t.hasAttribute&&t.hasAttribute(L)},attributeIgnored(t,e){return e.some(i=>t.name==i||i==="*"||i.includes("*")&&t.name.match(i)!=null)}},c=de,He=class{static isActive(t,e){let i=e._phxRef===void 0,n=t.getAttribute(bt).split(",").indexOf(H.genFileRef(e))>=0;return e.size>0&&(i||n)}static isPreflighted(t,e){return t.getAttribute(_t).split(",").indexOf(H.genFileRef(e))>=0&&this.isActive(t,e)}static isPreflightInProgress(t){return t._preflightInProgress===!0}static markPreflightInProgress(t){t._preflightInProgress=!0}constructor(t,e,i,s){this.ref=H.genFileRef(e),this.fileEl=t,this.file=e,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(Ye,this._onElUpdated),this.autoUpload=s}metadata(){return this.meta}progress(t){this._progress=Math.floor(t),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{H.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}isCancelled(){return this._isCancelled}cancel(){this.file._preflightInProgress=!1,this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(t="failed"){this.fileEl.removeEventListener(Ye,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:t}),this.isAutoUpload()||H.clearFiles(this.fileEl)}isAutoUpload(){return this.autoUpload}onDone(t){this._onDone=()=>{this.fileEl.removeEventListener(Ye,this._onElUpdated),t()}}onElUpdated(){this.fileEl.getAttribute(bt).split(",").indexOf(this.ref)===-1&&(H.untrackFile(this.fileEl,this.file),this.cancel())}toPreflightPayload(){return{last_modified:this.file.lastModified,name:this.file.name,relative_path:this.file.webkitRelativePath,size:this.file.size,type:this.file.type,ref:this.ref,meta:typeof this.file.meta=="function"?this.file.meta():void 0}}uploader(t){if(this.meta.uploader){let e=t[this.meta.uploader]||_(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:e}}else return{name:"channel",callback:ms}}zipPostFlight(t){this.meta=t.entries[this.ref],this.meta||_(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:t})}},bs=0,H=class St{static genFileRef(e){let i=e._phxRef;return i!==void 0?i:(e._phxRef=(bs++).toString(),e._phxRef)}static getEntryDataURL(e,i){let s=this.activeFiles(e).find(n=>this.genFileRef(n)===i);return s?URL.createObjectURL(s):null}static hasUploadsInProgress(e){let i=0;return c.findUploadInputs(e).forEach(s=>{s.getAttribute(_t)!==s.getAttribute(Ki)&&i++}),i>0}static serializeUploads(e){let i=this.activeFiles(e),s={};return i.forEach(n=>{let r={path:e.name},o=e.getAttribute(ie);s[o]=s[o]||[],r.ref=this.genFileRef(n),r.last_modified=n.lastModified,r.name=n.name||r.ref,r.relative_path=n.webkitRelativePath,r.type=n.type,r.size=n.size,typeof n.meta=="function"&&(r.meta=n.meta()),s[o].push(r)}),s}static clearFiles(e){e.value=null,e.removeAttribute(ie),c.putPrivate(e,"files",[])}static untrackFile(e,i){c.putPrivate(e,"files",c.private(e,"files").filter(s=>!Object.is(s,i)))}static trackFiles(e,i,s){if(e.getAttribute("multiple")!==null){let n=i.filter(r=>!this.activeFiles(e).find(o=>Object.is(o,r)));c.updatePrivate(e,"files",[],r=>r.concat(n)),e.value=""}else s&&s.files.length>0&&(e.files=s.files),c.putPrivate(e,"files",i)}
9static activeFileInputs(e){let i=c.findUploadInputs(e);return Array.from(i).filter(s=>s.files&&this.activeFiles(s).length>0)}static activeFiles(e){return(c.private(e,"files")||[]).filter(i=>He.isActive(e,i))}static inputsAwaitingPreflight(e){let i=c.findUploadInputs(e);return Array.from(i).filter(s=>this.filesAwaitingPreflight(s).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(i=>!He.isPreflighted(e,i)&&!He.isPreflightInProgress(i))}static markPreflightInProgress(e){e.forEach(i=>He.markPreflightInProgress(i.file))}constructor(e,i,s){this.autoUpload=c.isAutoUpload(e),this.view=i,this.onComplete=s,this._entries=Array.from(St.filesAwaitingPreflight(e)||[]).map(n=>new He(e,n,i,this.autoUpload)),St.markPreflightInProgress(this._entries),this.numEntriesInProgress=this._entries.length}isAutoUpload(){return this.autoUpload}entries(){return this._entries}initAdapterUpload(e,i,s){this._entries=this._entries.map(r=>(r.isCancelled()?(this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()):(r.zipPostFlight(e),r.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()})),r));let n=this._entries.reduce((r,o)=>{if(!o.meta)return r;let{name:a,callback:h}=o.uploader(s.uploaders);return r[a]=r[a]||{callback:h,entries:[]},r[a].entries.push(o),r},{});for(let r in n){let{callback:o,entries:a}=n[r];o(a,i,e,s)}}},ys={anyOf(t,e){return e.some(i=>t instanceof i)},isFocusable(t,e=!1){return t instanceof HTMLAnchorElement&&t.rel!=="ignore"||t instanceof HTMLAreaElement&&t.href!==void 0||!("disabled"in t&&t.disabled)&&this.anyOf(t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||t instanceof HTMLIFrameElement||t instanceof HTMLElement&&t.tabIndex>=0&&t.getAttribute("aria-hidden")!=="true"||!e&&t.getAttribute("tabindex")!==null&&t.getAttribute("aria-hidden")!=="true"},attemptFocus(t,e=!1){if(this.isFocusable(t,e))try{t.focus()}catch{}return!!document.activeElement&&document.activeElement.isSameNode(t)},focusFirstInteractive(t){let e=t.firstElementChild;for(;e;){if(this.attemptFocus(e,!0)||this.focusFirstInteractive(e))return!0;e=e.nextElementSibling}return!1},focusFirst(t){let e=t.firstElementChild;for(;e;){if(this.attemptFocus(e)||this.focusFirst(e))return!0;e=e.nextElementSibling}return!1},focusLast(t){let e=t.lastElementChild;for(;e;){if(this.attemptFocus(e)||this.focusLast(e))return!0;e=e.previousElementSibling}return!1}},V=ys,bi=t=>["HTML","BODY"].indexOf(t.nodeName.toUpperCase())>=0?null:["scroll","auto"].indexOf(getComputedStyle(t).overflowY)>=0?t:bi(t.parentElement),ti=t=>t?t.scrollTop:document.documentElement.scrollTop||document.body.scrollTop,xt=t=>t?t.getBoundingClientRect().bottom:window.innerHeight||document.documentElement.clientHeight,Lt=t=>t?t.getBoundingClientRect().top:0,ws=(t,e)=>{let i=t.getBoundingClientRect();return Math.ceil(i.top)>=Lt(e)&&Math.floor(i.top)<=xt(e)},ks=(t,e)=>{let i=t.getBoundingClientRect();return Math.ceil(i.bottom)>=Lt(e)&&Math.floor(i.bottom)<=xt(e)},ii=(t,e)=>{let i=t.getBoundingClientRect();return Math.ceil(i.top)>=Lt(e)&&Math.floor(i.top)<=xt(e)},As={mounted(){this.scrollContainer=bi(this.el);let t=ti(this.scrollContainer),e=!1,i=500,s=null,n=this.throttle(i,(a,h)=>{s=()=>!0,this.liveSocket.js().push(this.el,a,{value:{id:h.id,_overran:!0},callback:()=>{s=null}})}),r=this.throttle(i,(a,h)=>{s=()=>h.scrollIntoView({block:"start"}),this.liveSocket.js().push(this.el,a,{value:{id:h.id},callback:()=>{s=null,window.requestAnimationFrame(()=>{ii(h,this.scrollContainer)||h.scrollIntoView({block:"start"})})}})}),o=this.throttle(i,(a,h)=>{s=()=>h.scrollIntoView({block:"end"}),this.liveSocket.js().push(this.el,a,{value:{id:h.id},callback:()=>{s=null,window.requestAnimationFrame(()=>{ii(h,this.scrollContainer)||h.scrollIntoView({block:"end"})})}})});this.onScroll=a=>{let h=ti(this.scrollContainer);if(s)return t=h,s();let l=this.findOverrunTarget(),p=this.el.getAttribute(this.liveSocket.binding("viewport-top")),m=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),g=this.el.lastElementChild,f=this.el.firstElementChild,d=h<t,v=h>t;d&&p&&!e&&l.top>=0?(e=!0,n(p,f)):v&&e&&l.top<=0&&(e=!1),p&&d&&f&&ws(f,this.scrollContainer)?r(p,f):m&&v&&g&&ks(g,this.scrollContainer)&&o(m,g),t=h},this.scrollContainer?this.scrollContainer.addEventListener("scroll",this.onScroll):window.addEventListener("scroll",this.onScroll)},updated(){this.scrollContainer&&!this.scrollContainer.isConnected&&(this.destroyed(),this.mounted())},destroyed(){this.scrollContainer?this.scrollContainer.removeEventListener("scroll",this.onScroll):window.removeEventListener("scroll",this.onScroll)},throttle(t,e){let i=0,s;return(...n)=>{let r=Date.now(),o=t-(r-i);o<=0||o>t?(s&&(clearTimeout(s),s=null),i=r,e(...n)):s||(s=setTimeout(()=>{i=Date.now(),s=null,e(...n)},o))}},findOverrunTarget(){let t,e=this.el.getAttribute(this.liveSocket.b
9inding(Gi));if(e){let i=document.getElementById(e);if(i)t=i.getBoundingClientRect();else throw new Error("did not find element with id "+e)}else t=this.el.getBoundingClientRect();return t}},Es={activeRefs(){return this.el.getAttribute(bt)},preflightedRefs(){return this.el.getAttribute(_t)},mounted(){this.js().ignoreAttributes(this.el,["value"]),this.preflightedWas=this.preflightedRefs()},updated(){let t=this.preflightedRefs();this.preflightedWas!==t&&(this.preflightedWas=t,t===""&&this.__view().cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=""),this.el.dispatchEvent(new CustomEvent(Ye))}},Ss={mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(ie)),this.url=H.getEntryDataURL(this.inputEl,this.ref),this.el.src=this.url},destroyed(){URL.revokeObjectURL(this.url)}},Cs={LiveFileUpload:Es,LiveImgPreview:Ss,FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",t=>{if(!t.relatedTarget||!this.el.contains(t.relatedTarget)){let e=t.target.nextElementSibling;V.attemptFocus(e)||V.focusFirst(e)}else V.focusLast(this.el)}),this.focusEnd.addEventListener("focus",t=>{if(!t.relatedTarget||!this.el.contains(t.relatedTarget)){let e=t.target.previousElementSibling;V.attemptFocus(e)||V.focusLast(e)}else V.focusFirst(this.el)}),this.el.contains(document.activeElement)||(this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&V.focusFirst(this.el))}},InfiniteScroll:As},Ts=Cs,Ct=class{static onUnlock(t,e){if(!c.isLocked(t)&&!t.closest(`[${L}]`))return e();let i=t.closest(`[${L}]`),s=i.closest(`[${L}]`).getAttribute(L);i.addEventListener(`phx:undo-lock:${s}`,()=>{e()},{once:!0})}constructor(t){this.el=t,this.loadingRef=t.hasAttribute(_e)?parseInt(t.getAttribute(_e),10):null,this.lockRef=t.hasAttribute(L)?parseInt(t.getAttribute(L),10):null}maybeUndo(t,e,i){if(!this.isWithin(t)){c.updatePrivate(this.el,$t,[],s=>(s.push(t),s));return}this.undoLocks(t,e,i),this.undoLoading(t,e),c.updatePrivate(this.el,$t,[],s=>s.filter(n=>{let r={detail:{ref:n,event:e},bubbles:!0,cancelable:!1};return this.loadingRef&&this.loadingRef>n&&this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${n}`,r)),this.lockRef&&this.lockRef>n&&this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${n}`,r)),n>t})),this.isFullyResolvedBy(t)&&this.el.removeAttribute(X)}isWithin(t){return!(this.loadingRef!==null&&this.loadingRef>t&&this.lockRef!==null&&this.lockRef>t)}undoLocks(t,e,i){if(!this.isLockUndoneBy(t))return;let s=c.private(this.el,L);s&&(i(s),c.deletePrivate(this.el,L)),this.el.removeAttribute(L);let n={detail:{ref:t,event:e},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${this.lockRef}`,n))}undoLoading(t,e){if(!this.isLoadingUndoneBy(t)){this.canUndoLoading(t)&&this.el.classList.contains("phx-submit-loading")&&this.el.classList.remove("phx-change-loading");return}if(this.canUndoLoading(t)){this.el.removeAttribute(_e);let i=this.el.getAttribute(Se),s=this.el.getAttribute(Et);s!==null&&"readOnly"in this.el&&(this.el.readOnly=s==="true",this.el.removeAttribute(Et)),i!==null&&"disabled"in this.el&&(this.el.disabled=i==="true",this.el.removeAttribute(Se));let n=this.el.getAttribute(it);n!==null&&(this.el.textContent=n,this.el.removeAttribute(it));let r={detail:{ref:t,event:e},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${this.loadingRef}`,r))}pi.forEach(i=>{(i!=="phx-submit-loading"||this.canUndoLoading(t))&&c.removeClass(this.el,i)})}isLoadingUndoneBy(t){return this.loadingRef===null?!1:this.loadingRef<=t}isLockUndoneBy(t){return this.lockRef===null?!1:this.lockRef<=t}isFullyResolvedBy(t){return(this.loadingRef===null||this.loadingRef<=t)&&(this.lockRef===null||this.lockRef<=t)}canUndoLoading(t){return this.lockRef===null||this.lockRef<=t}},_s=class{constructor(t,e,i){let s=new Set,n=new Set([...e.children].map(o=>o.id)),r=[];Array.from(t.children).forEach(o=>{if(o.id&&(s.add(o.id),n.has(o.id))){let a=o.previousElementSibling&&o.previousElementSibling.id;r.push({elementId:o.id,previousElementId:a})}}),this.containerId=e.id,this.updateType=i,this.elementsToModify=r,this.elementIdsToAdd=[...n].filter(o=>!s.has(o))}perform(){let t=c.byId(this.containerId);
9t&&(this.elementsToModify.forEach(e=>{e.previousElementId?Ce(document.getElementById(e.previousElementId),i=>{Ce(document.getElementById(e.elementId),s=>{s.previousElementSibling&&s.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",s)})}):Ce(document.getElementById(e.elementId),i=>{i.previousElementSibling==null||t.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(e=>{Ce(document.getElementById(e),i=>t.insertAdjacentElement("afterbegin",i))}))}},si=11;function Ps(t,e){var i=e.attributes,s,n,r,o,a;if(!(e.nodeType===si||t.nodeType===si)){for(var h=i.length-1;h>=0;h--)s=i[h],n=s.name,r=s.namespaceURI,o=s.value,r?(n=s.localName||n,a=t.getAttributeNS(r,n),a!==o&&(s.prefix==="xmlns"&&(n=s.name),t.setAttributeNS(r,n,o))):(a=t.getAttribute(n),a!==o&&t.setAttribute(n,o));for(var l=t.attributes,p=l.length-1;p>=0;p--)s=l[p],n=s.name,r=s.namespaceURI,r?(n=s.localName||n,e.hasAttributeNS(r,n)||t.removeAttributeNS(r,n)):e.hasAttribute(n)||t.removeAttribute(n)}}var ze,Rs="http://www.w3.org/1999/xhtml",F=typeof document>"u"?void 0:document,xs=!!F&&"content"in F.createElement("template"),Ls=!!F&&F.createRange&&"createContextualFragment"in F.createRange();function Is(t){var e=F.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}function Os(t){ze||(ze=F.createRange(),ze.selectNode(F.body));var e=ze.createContextualFragment(t);return e.childNodes[0]}function Ds(t){var e=F.createElement("body");return e.innerHTML=t,e.childNodes[0]}function Hs(t){return t=t.trim(),xs?Is(t):Ls?Os(t):Ds(t)}function Ke(t,e){var i=t.nodeName,s=e.nodeName,n,r;return i===s?!0:(n=i.charCodeAt(0),r=s.charCodeAt(0),n<=90&&r>=97?i===s.toUpperCase():r<=90&&n>=97?s===i.toUpperCase():!1)}function Ms(t,e){return!e||e===Rs?F.createElement(t):F.createElementNS(e,t)}function Ns(t,e){for(var i=t.firstChild;i;){var s=i.nextSibling;e.appendChild(i),i=s}return e}function gt(t,e,i){t[i]!==e[i]&&(t[i]=e[i],t[i]?t.setAttribute(i,""):t.removeAttribute(i))}var ni={OPTION:function(t,e){var i=t.parentNode;if(i){var s=i.nodeName.toUpperCase();s==="OPTGROUP"&&(i=i.parentNode,s=i&&i.nodeName.toUpperCase()),s==="SELECT"&&!i.hasAttribute("multiple")&&(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),i.selectedIndex=-1)}gt(t,e,"selected")},INPUT:function(t,e){gt(t,e,"checked"),gt(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var i=e.value;t.value!==i&&(t.value=i);var s=t.firstChild;if(s){var n=s.nodeValue;if(n==i||!i&&n==t.placeholder)return;s.nodeValue=i}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var i=-1,s=0,n=t.firstChild,r,o;n;)if(o=n.nodeName&&n.nodeName.toUpperCase(),o==="OPTGROUP")r=n,n=r.firstChild,n||(n=r.nextSibling,r=null);else{if(o==="OPTION"){if(n.hasAttribute("selected")){i=s;break}s++}n=n.nextSibling,!n&&r&&(n=r.nextSibling,r=null)}t.selectedIndex=i}}},Me=1,ri=11,oi=3,ai=8;function oe(){}function $s(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function Fs(t){return function(i,s,n){if(n||(n={}),typeof s=="string")if(i.nodeName==="#document"||i.nodeName==="HTML"){var r=s;s=F.createElement("html"),s.innerHTML=r}else if(i.nodeName==="BODY"){var o=s;s=F.createElement("html"),s.innerHTML=o;var a=s.querySelector("body");a&&(s=a)}else s=Hs(s);else s.nodeType===ri&&(s=s.firstElementChild);var h=n.getNodeKey||$s,l=n.onBeforeNodeAdded||oe,p=n.onNodeAdded||oe,m=n.onBeforeElUpdated||oe,g=n.onElUpdated||oe,f=n.onBeforeNodeDiscarded||oe,d=n.onNodeDiscarded||oe,v=n.onBeforeElChildrenUpdated||oe,b=n.skipFromChildren||oe,R=n.addChild||function(k,A){return k.appendChild(A)},j=n.childrenOnly===!0,w=Object.create(null),C=[];function P(k){C.push(k)}function M(k,A){if(k.nodeType===Me)for(var O=k.firstChild;O;){var S=void 0;A&&(S=h(O))?P(S):(d(O),O.firstChild&&M(O,A)),O=O.nextSibling}}function u(k,A,O){f(k)!==!1&&(A&&A.removeChild(k),d(k),M(k,O))}function y(k){if(k.nodeType===Me||k.nodeType===ri)for(var A=k.firstChild;A;){var O=h(A);O&&(w[O]=A),y(A),A=A.nextSibling}}y(i);function N(k){p(k);for(var A=k.firstChild;A;){var O=A.nextSibling,S=h(A);if(S){var T=w[S];T&&Ke(A,T)?(A.parentNode.replaceChild(T,A),D(T,A)):N(A)}else N(A);A=O}}function W(k,A,O){for(;A;){var S=A.nextSibling;(O=h(A))?P(O):u(A,k,!0),A=S}}function D(k,A,O){var S=h(A);if(S&&delete w[S],!O){var T=m(k,A);
9if(T===!1||(T instanceof HTMLElement&&(k=T,y(k)),t(k,A),g(k),v(k,A)===!1))return}k.nodeName!=="TEXTAREA"?Pe(k,A):ni.TEXTAREA(k,A)}function Pe(k,A){var O=b(k,A),S=A.firstChild,T=k.firstChild,ge,Z,ve,Ue,se;e:for(;S;){for(Ue=S.nextSibling,ge=h(S);!O&&T;){if(ve=T.nextSibling,S.isSameNode&&S.isSameNode(T)){S=Ue,T=ve;continue e}Z=h(T);var je=T.nodeType,ne=void 0;if(je===S.nodeType&&(je===Me?(ge?ge!==Z&&((se=w[ge])?ve===se?ne=!1:(k.insertBefore(se,T),Z?P(Z):u(T,k,!0),T=se,Z=h(T)):ne=!1):Z&&(ne=!1),ne=ne!==!1&&Ke(T,S),ne&&D(T,S)):(je===oi||je==ai)&&(ne=!0,T.nodeValue!==S.nodeValue&&(T.nodeValue=S.nodeValue))),ne){S=Ue,T=ve;continue e}Z?P(Z):u(T,k,!0),T=ve}if(ge&&(se=w[ge])&&Ke(se,S))O||R(k,se),D(se,S);else{var ht=l(S);ht!==!1&&(ht&&(S=ht),S.actualize&&(S=S.actualize(k.ownerDocument||F)),R(k,S),N(S))}S=Ue,T=ve}W(k,T,Z);var Ot=ni[k.nodeName];Ot&&Ot(k,A)}var I=i,Fe=I.nodeType,It=s.nodeType;if(!j){if(Fe===Me)It===Me?Ke(i,s)||(d(i),I=Ns(i,Ms(s.nodeName,s.namespaceURI))):I=s;else if(Fe===oi||Fe===ai){if(It===Fe)return I.nodeValue!==s.nodeValue&&(I.nodeValue=s.nodeValue),I;I=s}}if(I===s)d(i);else{if(s.isSameNode&&s.isSameNode(I))return;if(D(I,s,j),C)for(var ot=0,_i=C.length;ot<_i;ot++){var at=w[C[ot]];at&&u(at,at.parentNode,!1)}}return!j&&I!==i&&i.parentNode&&(I.actualize&&(I=I.actualize(i.ownerDocument||F)),i.parentNode.replaceChild(I,i)),I}}var Us=Fs(Ps),Tt=Us,Ge=class{constructor(t,e,i,s,n,r={}){this.view=t,this.liveSocket=t.liveSocket,this.container=e,this.rootID=t.root.id,this.html=i,this.streams=s,this.streamInserts={},this.streamComponentRestore={},this.targetCID=n,this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.targetContainer=n?c.getComponent(this.view.id,n):e,this.beforeUpdatedCallbacks=[],this.afterAddedCallbacks=[],this.afterUpdatedCallbacks=[],this.afterPhxChildAddedCallbacks=[],this.afterDiscardedCallbacks=[],this.afterTransitionsDiscardedCallbacks=[],this.withChildren=r.withChildren||r.undoRef!==void 0||!1,this.undoRef=r.undoRef??null}beforeUpdated(t){this.beforeUpdatedCallbacks.push(t)}afterAdded(t){this.afterAddedCallbacks.push(t)}afterUpdated(t){this.afterUpdatedCallbacks.push(t)}afterPhxChildAdded(t){this.afterPhxChildAddedCallbacks.push(t)}afterDiscarded(t){this.afterDiscardedCallbacks.push(t)}afterTransitionsDiscarded(t){this.afterTransitionsDiscardedCallbacks.push(t)}markPrunableContentForRemoval(){let t=this.liveSocket.binding(st);c.all(this.container,`[${t}=append] > *, [${t}=prepend] > *`,e=>{e.setAttribute(Ft,"")})}perform(t){let{view:e,liveSocket:i,html:s,container:n}=this,r=this.targetContainer;if(this.targetCID){let w=r.closest(`[${L}]`);if(w&&!w.isSameNode(r)){let C=c.private(w,L);
9if(C&&(r=C.querySelector(`[data-phx-component="${this.targetCID}"]`),!r))return}}let o=i.getActiveElement(),{selectionStart:a,selectionEnd:h}=o&&c.hasSelectionRange(o)?o:{},l=i.binding(st),p=i.binding(wt),m=i.binding(kt),g=i.binding(Yi),f=[],d=[],v=[],b=[],R=null,j=(w,C,P=this.withChildren)=>{let M={childrenOnly:w.getAttribute(Y)===null&&!P,getNodeKey:u=>!(u instanceof Element)||c.isPhxDestroyed(u)?null:t?u.id:c.private(u,"clientsideIdAttribute")?u.getAttribute(yt):u.id||u.getAttribute(yt),skipFromChildren:u=>u.getAttribute(l)===Qe,addChild:(u,y)=>{let{ref:N,streamAt:W}=this.getStreamInsert(y);if(N===void 0)return u.appendChild(y);if(this.setStreamRef(y,N),W===0)u.insertAdjacentElement("afterbegin",y);else if(W===-1){let D=u.lastElementChild;if(D&&!D.hasAttribute(Le)){let Pe=Array.from(u.children).find(I=>!I.hasAttribute(Le));u.insertBefore(y,Pe??null)}else u.appendChild(y)}else if(W>0){let D=Array.from(u.children)[W];u.insertBefore(y,D)}},onBeforeNodeAdded:u=>{if(!(u instanceof Element))return u;if(this.getStreamInsert(u)?.updateOnly&&!this.streamComponentRestore[u.id])return!1;c.maintainPrivateHooks(u,u,p,m);let y=u;return this.streamComponentRestore[u.id]&&(y=this.streamComponentRestore[u.id],delete this.streamComponentRestore[u.id],j(y,u,!0)),y},onNodeAdded:u=>{if(!(u instanceof Element)){f.push(u);return}this.maybeReOrderStream(u,!0),c.isPortalTemplate(u)&&b.push(()=>this.teleport(u,j)),u instanceof HTMLImageElement&&u.srcset?u.srcset=u.srcset:u instanceof HTMLVideoElement&&u.autoplay&&u.play(),c.isNowTriggerFormExternal(u,g)&&(R=u),(c.isPhxChild(u)&&e.ownsElement(u)||c.isPhxSticky(u)&&e.ownsElement(u.parentNode))&&this.trackAfterPhxChildAdded(u),u.nodeName==="SCRIPT"&&u.hasAttribute(Ze)&&this.handleRuntimeHook(u,C),f.push(u)},onNodeDiscarded:u=>this.onNodeDiscarded(u),onBeforeNodeDiscarded:u=>{if(!(u instanceof Element)||u.getAttribute(Ft)!==null)return!0;if(u.parentElement!==null&&u.id&&c.isPhxUpdate(u.parentElement,l,[Qe,"append","prepend"])||u.getAttribute(me)||this.maybePendingRemove(u)||this.skipCIDSibling(u))return!1;if(c.isPortalTemplate(u)){let y=document.getElementById(u.content.firstElementChild?.id||"");y&&(y.remove(),M.onNodeDiscarded(y),this.view.dropPortalElementId(y.id))}return!0},onElUpdated:u=>{c.isNowTriggerFormExternal(u,g)&&(R=u),d.push(u),this.maybeReOrderStream(u,!1)},onBeforeElUpdated:(u,y)=>{if(u.id&&u.isSameNode(w)&&u.id!==y.id)return M.onNodeDiscarded(u),u.replaceWith(y),M.onNodeAdded(y);c.syncPendingAttrs(u,y),c.maintainPrivateHooks(u,y,p,m),c.cleanChildNodes(y,l);let N=o&&u.isSameNode(o)&&c.isEditableInput(u),W=N&&this.isChangedSelect(u,y);if(this.skipCIDSibling(y))return this.maybeCloneLockedElement(u,N),this.copyNestedPrivateLock(u,y),this.maybeReOrderStream(u),!1;if(c.isPhxSticky(u))return[Q,fe,te].map(D=>[D,u.getAttribute(D),y.getAttribute(D)]).forEach(([D,Pe,I])=>{I&&Pe!==I&&u.setAttribute(D,I)}),!1;if(c.isIgnored(u,l)||u.form&&u.form.isSameNode(R))return this.trackBeforeUpdated(u,y),c.mergeAttrs(u,y,{isIgnored:c.isIgnored(u,l)}),d.push(u),c.applyStickyOperations(u),!1;if(u.type==="number"&&u.validity&&u.validity.badInput)return!1;if(u=this.maybeCloneLockedElement(u,N),c.isPhxChild(y)){let D=u.getAttribute(Q);return c.mergeAttrs(u,y,{exclude:[fe]}),D!==""&&u.setAttribute(Q,D),u.setAttribute(te,this.rootID),c.applyStickyOperations(u),!1}return this.copyNestedPrivateLock(u,y),c.copyPrivates(y,u),c.isPortalTemplate(y)?(b.push(()=>this.teleport(y,j)),u.content.replaceChildren(y.content.cloneNode(!0)),!1):N&&u.type!=="hidden"&&!W?(this.trackBeforeUpdated(u,y),c.mergeFocusedInput(u,y),c.syncAttrsToProps(u),d.push(u),c.applyStickyOperations(u),!1):(W&&u.blur(),c.isPhxUpdate(y,l,["append","prepend"])&&v.push(new _s(u,y,y.getAttribute(l))),c.syncAttrsToProps(y),c.applyStickyOperations(y),this.trackBeforeUpdated(u,y),u)}};Tt(w,C,M)};if(this.trackBeforeUpdated(n,n),i.time("morphdom",()=>{this.streams.forEach(([C,P,M,u])=>{P.forEach(([y,N,W,D])=>{this.streamInserts[y]={ref:C,streamAt:N,limit:W,reset:u,updateOnly:D}}),u!==void 0&&c.all(document,`[${Le}="${C}"]`,y=>{this.removeStreamChildElement(y)}),M.forEach(y=>{let N=document.getElementById(y);N&&this.removeStreamChildElement(N)})}),t&&c.all(this.container,`[${l}=${Qe}]`).filter(C=>
9this.view.ownsElement(C)).forEach(C=>{Array.from(C.children).forEach(P=>{this.removeStreamChildElement(P,!0)})}),j(r,s);let w=0;for(;b.length>0&&w<5;){let C=b.slice();b=[],C.forEach(P=>P()),w++}this.view.portalElementIds.forEach(C=>{let P=document.getElementById(C);if(P){let M=P.getAttribute(he);M&&(document.getElementById(M)||(P.remove(),this.onNodeDiscarded(P),this.view.dropPortalElementId(C)))}})}),i.isDebugEnabled()&&(ds(),us(this.streamInserts),Array.from(document.querySelectorAll("input[name=id]")).forEach(w=>{w instanceof HTMLInputElement&&w.form&&console.error(`Detected an input with name="id" inside a form! This will cause problems when patching the DOM. 10`,w)})),v.length>0&&i.time("post-morph append/prepend restoration",()=>{v.forEach(w=>w.perform())}),i.silenceEvents(()=>c.restoreFocus(o,a,h)),c.dispatchEvent(document,"phx:update"),f.forEach(w=>this.trackAfterAdded(w)),d.forEach(w=>this.trackAfterUpdated(w)),this.transitionPendingRemoves(),R){i.unload();let w=c.private(R,"submitter");if(w&&w.name&&r.contains(w)){let C=document.createElement("input");C.type="hidden";let P=w.getAttribute("form");P&&C.setAttribute("form",P),C.name=w.name,C.value=w.value,w.parentElement.insertBefore(C,w)}Object.getPrototypeOf(R).submit.call(R)}return!0}trackBeforeUpdated(t,e){this.beforeUpdatedCallbacks.forEach(i=>i(t,e))}trackAfterAdded(t){this.afterAddedCallbacks.forEach(e=>e(t))}trackAfterUpdated(t){this.afterUpdatedCallbacks.forEach(e=>e(t))}trackAfterPhxChildAdded(t){this.afterPhxChildAddedCallbacks.forEach(e=>e(t))}trackAfterDiscarded(t){this.afterDiscardedCallbacks.forEach(e=>e(t))}trackAfterTransitionsDiscarded(t){this.afterTransitionsDiscardedCallbacks.forEach(e=>e(t))}onNodeDiscarded(t){(c.isPhxChild(t)||c.isPhxSticky(t))&&this.liveSocket.destroyViewByEl(t),this.trackAfterDiscarded(t)}maybePendingRemove(t){return t.getAttribute&&t.getAttribute(this.phxRemove)!==null?(this.pendingRemoves.push(t),!0):!1}removeStreamChildElement(t,e=!1){!e&&!this.view.ownsElement(t)||(this.streamInserts[t.id]?(this.streamComponentRestore[t.id]=t,t.remove()):this.maybePendingRemove(t)||(t.remove(),this.onNodeDiscarded(t)))}getStreamInsert(t){return(t.id?this.streamInserts[t.id]:{})||{}}setStreamRef(t,e){c.putSticky(t,Le,i=>i.setAttribute(Le,e))}maybeReOrderStream(t,e=!1){let{ref:i,streamAt:s,reset:n}=this.getStreamInsert(t);if(s!==void 0&&(this.setStreamRef(t,i),!(!n&&!e)&&t.parentElement)){if(s===0)this.moveOrInsertBefore(t.parentElement,t,t.parentElement.firstElementChild);else if(s>0){let r=Array.from(t.parentElement.children),o=r.indexOf(t);if(s>=r.length-1)this.moveOrInsertBefore(t.parentElement,t,null);else{let a=r[s];o>s?this.moveOrInsertBefore(t.parentElement,t,a):this.moveOrInsertBefore(t.parentElement,t,a.nextElementSibling)}}this.maybeLimitStream(t)}}moveOrInsertBefore(t,e,i){if(typeof t.moveBefore=="function")try{t.moveBefore(e,i);return}catch{}t.insertBefore(e,i)}maybeLimitStream(t){let{limit:e}=this.getStreamInsert(t);if(e!==null){let i=Array.from(t.parentElement.children);e<0&&i.length>e*-1?i.slice(0,i.length+e).forEach(s=>this.removeStreamChildElement(s)):e>=0&&i.length>e&&i.slice(e).forEach(s=>this.removeStreamChildElement(s))}}transitionPendingRemoves(){let{pendingRemoves:t,liveSocket:e}=this;t.length>0&&e.transitionRemoves(t,this.view,()=>{t.forEach(i=>{let s=c.firstPhxChild(i);s&&e.destroyViewByEl(s),i.remove()}),this.trackAfterTransitionsDiscarded(t)})}isChangedSelect(t,e){return!(t instanceof HTMLSelectElement)||t.multiple?!1:t.options.length!==e.options.length?!0:(e.value=t.value,!t.isEqualNode(e))}skipCIDSibling(t){return t.nodeType===Node.ELEMENT_NODE&&t.hasAttribute(gi)}maybeCloneLockedElement(t,e){if(!t.hasAttribute(X))return t;let i=new Ct(t);if(!t.hasAttribute(L)||this.undoRef!==null&&i.isLockUndoneBy(this.undoRef))return t;c.applyStickyOperations(t);let s=t.hasAttribute(L)?c.private(t,L)||t.cloneNode(!0):null;return s?(c.putPrivate(t,L,s),e?t:s):t}copyNestedPrivateLock(t,e){this.undoRef===null||!c.private(e,L)||c.putPrivate(t,L,c.private(e,L))}indexOf(t,e){return Array.from(t.children).indexOf(e)}teleport(t,e){let i=t.getAttribute(Rt),s=document.querySelector(i);if(!s)throw new Error("portal target with selector "+i+" not found");let n=t.content.firstElementChild;if(this.skipCIDSibling(n))return;if(!n?.id)throw new Error("phx-portal template must have a single root element with ID!");let r=document.getElementById(n.id),o;r?(s.contains(r)||s.appendChild(r),o=r):(o=document.createElement(n.tagName),s.appendChild(o)),n.setAttribute(me,this.view.id),n.setAttribute(he,t.id),e(o,n,!0),n.removeAttribute(me),n.removeAttribute(he),this.view.pushPortalElementId(n.id)}handleRuntimeHook(t,e){let i=t.getAttribute(Ze),s=t.hasAttribute("nonce")?t.getAttribute("nonce"):null;if(t.hasAttribute("nonce")){let r=document.createElement("template");r.innerHTML=e,s=r.content.querySelector(`script[${Ze}="${CSS.escape(i)}"]`)?.getAttribute("nonce")??null}let n=document.createElement("script");n.textContent=t.textContent,c.mergeAttrs(n,t,{isIgnored:!1}),s&&(n.nonce=s),t.replaceWith(n),t=n}},js=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),Bs=new Set(["'",'"']),hi=(t,e,i)=>{let s=0,n=!1,r,o,a,h,l,p,m=t.match(/^(\s*(?:<!--.*?-->\s*)*)<([^\s\/>]+)/);if(m===null)throw new Error(`malformed html ${t}`);for(s=m[0].length,r=m[1],a=m[2],h=s,s;s<t.length&&t.charAt(s)!==">";s++)if(t.charAt(s)==="="){let d=t.slice(s-3,s)===" id";s++;let v=t.charAt(s);if(Bs.has(v)){let b=s;for(s++,s;s<t.length&&t.charAt(s)!==v;s++);if(d){l=t.slice(b+1,s);break}}}let g=t.length-1;for(n=!1;g>=r.length+a.length;){let d=t.charAt(g);if(n)d==="-"&&t.slice(g-3,g)==="<!-"?(n=!1,g-=4):g-=1;else if(d===">"&&t.slice(g-2,g)==="--")n=!0,g-=3;else{if(d===">")break;g-=1}}o=t.slice(g+1,t.length);let f=Object.keys(e).map(d=>e[d]===!0?d:`${d}="${e[d]}"`).join(" ");if(i){let d=l?` id="${l}"`:"";js.has(a)?p=`<${a}${d}${f===""?"":" "}${f}/>`:p=`<${a}${d}${f===""?"":" "}${f}></${a}>`}else{let d=t.slice(h,g+1);p=`<${a}${f===""?"":" "}${f}${d}`}return[p,r,o]},li=class{static extract(t){let{[Yt]:e,[Gt]:i,[Qt]:s}=t;return delete t[Yt],delete t[Gt],delete t[Qt],{diff:t,title:s,reply:e||null,events:i||[]}}constructor(t,e){this.viewId=t,this.rendered={},this.magicId=0,this.mergeDiff(e)}parentViewId(){return this.viewId}toString(t){let{buffer:e,streams:i}=this.recursiveToString(this.rendered,this.rendered[$],t,!0,{});return{buffer:e,streams:i}}recursiveToString(t,e=t[$],i,s,n){i=i?new Set(i):null;let r={buffer:"",components:e,onlyCids:i,streams:new Set};return this.toOutputBuffer(t,null,r,s,n),{buffer:r.buffer,streams:r.streams}}componentCIDs(t){return Object.keys(t[$]||{}).map(e=>parseInt(e))}isComponentOnlyDiff(t){return t[$]?Object.keys(t).length===1:!1}getComponent(t,e){return t[$][e]}resetRender(t){this.rendered[$][t]&&(this.rendered[$][t].reset=!0)}mergeDiff(t){let e=t[$],i={};if(delete t[$],this.rendered=this.mutableMerge(this.rendered,t),this.rendered[$]=this.rendered[$]||{},e){let s=this.rendered[$];for(let n in e)e[n]=this.cachedFindComponent(n,e[n],s,e,i);for(let n in e)s[n]=e[n];t[$]=e}}cachedFindComponent(t,e,i,s,n){if(n[t])return n[t];{let r,o,a=e[J];if(ae(a)){let h;a>0?h=this.cachedFindComponent(a,s[a],i,s,n):h=i[-a],o=h[J],r=this.cloneMerge(h,e,!0),r[J]=o}else r=e[J]!==void 0||i[t]===void 0?e:this.cloneMerge(i[t],e,!1);return n[t]=r,r}}mutableMerge(t,e){return e[J]!==void 0?e:(this.doMutableMerge(t,e),t)}
10doMutableMerge(t,e){if(e[x])this.mergeKeyed(t,e);else for(let i in e){let s=e[i],n=t[i];Ee(s)&&s[J]===void 0&&Ee(n)?this.doMutableMerge(n,s):t[i]=s}t[mt]&&(t.newRender=!0)}clone(t){return"structuredClone"in window?structuredClone(t):JSON.parse(JSON.stringify(t))}mergeKeyed(t,e){let i=this.clone(t);if(Object.entries(e[x]).forEach(([s,n])=>{if(s!==G)if(Array.isArray(n)){let[r,o]=n;t[x][s]=i[x][r],this.doMutableMerge(t[x][s],o)}else if(typeof n=="number"){let r=n;t[x][s]=i[x][r]}else typeof n=="object"&&(t[x][s]||(t[x][s]={}),this.doMutableMerge(t[x][s],n))}),e[x][G]<t[x][G])for(let s=e[x][G];s<t[x][G];s++)delete t[x][s];t[x][G]=e[x][G],e[Ae]&&(t[Ae]=e[Ae]),e[re]&&(t[re]=e[re])}cloneMerge(t,e,i){let s;if(e[x])s=this.clone(t),this.mergeKeyed(s,e);else{s={...t,...e};for(let n in s){let r=e[n],o=t[n];Ee(r)&&r[J]===void 0&&Ee(o)?s[n]=this.cloneMerge(o,r,i):r===void 0&&Ee(o)&&(s[n]=this.cloneMerge(o,{},i))}}return i?(delete s.magicId,delete s.newRender):t[mt]&&(s.newRender=!0),s}componentToString(t){let{buffer:e,streams:i}=this.recursiveCIDToString(this.rendered[$],t,null),[s,n,r]=hi(e,{});return{buffer:s,streams:i}}pruneCIDs(t){t.forEach(e=>delete this.rendered[$][e])}get(){return this.rendered}isNewFingerprint(t={}){return!!t[J]}templateStatic(t,e){return typeof t=="number"?e[t]:t}nextMagicID(){return this.magicId++,`m${this.magicId}-${this.parentViewId()}`}toOutputBuffer(t,e,i,s,n={}){if(t[x])return this.comprehensionToBuffer(t,e,i,s);t[re]&&(e=t[re],delete t[re]);let{[J]:r}=t;r=this.templateStatic(r,e),t[J]=r;let o=t[mt],a=i.buffer;o&&(i.buffer=""),s&&o&&!t.magicId&&(t.newRender=!0,t.magicId=this.nextMagicID()),i.buffer+=r[0];for(let h=1;h<r.length;h++)this.dynamicToBuffer(t[h-1],e,i,s),i.buffer+=r[h];if(o){let h=!1,l;s||t.magicId?(h=s&&!t.newRender,l={[yt]:t.magicId,...n}):l=n,h&&(l[gi]=!0);let[p,m,g]=hi(i.buffer,l,h);t.newRender=!1,i.buffer=a+m+p+g}}comprehensionToBuffer(t,e,i,s){let n=e||t[re],r=this.templateStatic(t[J],e);t[J]=r,delete t[re];for(let o=0;o<t[x][G];o++){i.buffer+=r[0];for(let a=1;a<r.length;a++)this.dynamicToBuffer(t[x][o][a-1],n,i,s),i.buffer+=r[a]}if(t[Ae]){let o=t[Ae],[a,h,l,p]=o||[null,{},[],null];o!==void 0&&(t[x][G]>0||l.length>0||p)&&(delete t[Ae],t[x]={[G]:0},i.streams.add(o))}}dynamicToBuffer(t,e,i,s){if(typeof t=="number"){let{buffer:n,streams:r}=this.recursiveCIDToString(i.components,t,i.onlyCids);i.buffer+=n,i.streams=new Set([...i.streams,...r])}else Ee(t)?this.toOutputBuffer(t,e,i,s,{}):i.buffer+=t}recursiveCIDToString(t,e,i){let s=t[e]||_(`no component for CID ${e}`,t),n={[Y]:e,[Te]:this.viewId},r=i&&!i.has(e);s.newRender=!r,s.magicId=`c${e}-${this.parentViewId()}`;let o=!s.reset,{buffer:a,streams:h}=this.recursiveToString(s,t,i,o,n);return delete s.reset,{buffer:a,streams:h}}},ci=[],di=200,Vs={exec(t,e,i,s,n,r){let[o,a]=r||[null,{callback:r&&r.callback}];(Array.isArray(i)?i:typeof i=="string"&&i.startsWith("[")?JSON.parse(i):[[o,a]]).forEach(([l,p])=>{l===o&&(p={...a,...p},p.callback=p.callback||a.callback),this.filterToEls(s.liveSocket,n,p).forEach(m=>{this[`exec_${l}`](t,e,i,s,n,m,p)})})},isVisible(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length>0)},isInViewport(t){let e=t.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth;return e.right>0&&e.bottom>0&&e.left<s&&e.top<i},exec_exec(t,e,i,s,n,r,{attr:o,to:a}){let h=r.getAttribute(o);if(!h)throw new Error(`expected ${o} to contain JS command on "${a}"`);s.liveSocket.execJS(r,h,e)},exec_dispatch(t,e,i,s,n,r,{event:o,detail:a,bubbles:h,blocking:l}){if(a=a||{},a.dispatcher=n,l){let p=new Promise((m,g)=>{a.done=m});s.liveSocket.asyncTransition(p)}c.dispatchEvent(r,o,{detail:a,bubbles:h})},exec_push(t,e,i,s,n,r,o){let{event:a,data:h,target:l,page_loading:p,loading:m,value:g,dispatcher:f,callback:d}=o,v={loading:m,value:g,target:l,page_loading:!!p,originalEvent:t},b=e==="change"&&f?f:n,R=l||b.getAttribute(s.binding("target"))||b,j=(w,C)=>{if(w.isConnected())if(e==="change"){let{newCid:P,_target:M}=o;M=M||(c.isFormAssociated(n)?n.name:void 0),M&&(v._target=M),w.pushInput(n,C,P,a||i,v,d)}else if(e==="submit"){let{submitter:P}=o;w.submitForm(n,C,a||i,P,v,d)}else w.pushEvent(e,n,C,a||i,h,v,d)};o.targetView&&o.targetCtx?j(o.targetView,o.targetCtx):s.withinTargets(R,j)},exec_navigate(t,e,i,s,n,r,{href:o,replace:a}){s.liveSocket.historyRedirect(t,o,a?"replace":"push",null,n)},exec_patch(t,e,i,s,n,r,{href:o,replace:a}){s.liveSocket.pushHistoryPatch(t,o,a?"replace":"push",n)},exec_focus(t,e,i,s,n,r){V.attemptFocus(r),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>V.attemptFocus(r))})},exec_focus_first(t,e,i,s,n,r){V.focusFirstInteractive(r)||V.focusFirst(r),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>V.focusFirstInteractive(r)||V.focusFirst(r))})},exec_push_focus(t,e,i,s,n,r){ci.push(r||n)},exec_pop_focus(t,e,i,s,n,r){let o=ci.pop();o&&(o.focus(),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>o.focus())}))},exec_add_class(t,e,i,s,n,r,{names:o,transition:a,time:h,blocking:l}){this.addOrRemoveClasses(r,o,[],a,h,s,l)},exec_remove_class(t,e,i,s,n,r,{names:o,transition:a,time:h,blocking:l}){this.addOrRemoveClasses(r,[],o,a,h,s,l)},exec_toggle_class(t,e,i,s,n,r,{names:o,transition:a,time:h,blocking:l}){this.toggleClasses(r,o,a,h,s,l)}
10,exec_toggle_attr(t,e,i,s,n,r,{attr:[o,a,h]}){this.toggleAttr(r,o,a,h)},exec_ignore_attrs(t,e,i,s,n,r,{attrs:o}){this.ignoreAttrs(r,o)},exec_transition(t,e,i,s,n,r,{time:o,transition:a,blocking:h}){this.addOrRemoveClasses(r,[],[],a,o,s,h)},exec_toggle(t,e,i,s,n,r,{display:o,ins:a,outs:h,time:l,blocking:p}){this.toggle(e,s,r,o,a,h,l,p)},exec_show(t,e,i,s,n,r,{display:o,transition:a,time:h,blocking:l}){this.show(e,s,r,o,a,h,l)},exec_hide(t,e,i,s,n,r,{display:o,transition:a,time:h,blocking:l}){this.hide(e,s,r,o,a,h,l)},exec_set_attr(t,e,i,s,n,r,{attr:[o,a]}){this.setOrRemoveAttrs(r,[[o,a]],[])},exec_remove_attr(t,e,i,s,n,r,{attr:o}){this.setOrRemoveAttrs(r,[],[o])},ignoreAttrs(t,e){c.putPrivate(t,"JS:ignore_attrs",{apply:(i,s)=>{let n=Array.from(i.attributes),r=n.map(o=>o.name);Array.from(s.attributes).filter(o=>!r.includes(o.name)).forEach(o=>{c.attributeIgnored(o,e)&&s.removeAttribute(o.name)}),n.forEach(o=>{c.attributeIgnored(o,e)&&s.setAttribute(o.name,o.value)})}})},onBeforeElUpdated(t,e){let i=c.private(t,"JS:ignore_attrs");i&&i.apply(t,e)},show(t,e,i,s,n,r,o){this.isVisible(i)||this.toggle(t,e,i,s,n,null,r,o)},hide(t,e,i,s,n,r,o){this.isVisible(i)&&this.toggle(t,e,i,s,null,n,r,o)},toggle(t,e,i,s,n,r,o,a){o=o||di;let[h,l,p]=n||[[],[],[]],[m,g,f]=r||[[],[],[]];if(h.length>0||m.length>0)if(this.isVisible(i)){let d=()=>{this.addOrRemoveClasses(i,g,h.concat(l).concat(p)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,m,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,f,g))})},v=()=>{this.addOrRemoveClasses(i,[],m.concat(f)),c.putSticky(i,"toggle",b=>b.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))};i.dispatchEvent(new Event("phx:hide-start")),a===!1?(d(),setTimeout(v,o)):e.transition(o,d,v)}else{if(t==="remove")return;let d=()=>{this.addOrRemoveClasses(i,l,m.concat(g).concat(f));let b=s||this.defaultDisplay(i);window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,h,[]),window.requestAnimationFrame(()=>{c.putSticky(i,"toggle",R=>R.style.display=b),this.addOrRemoveClasses(i,p,l)})})},v=()=>{this.addOrRemoveClasses(i,[],h.concat(p)),i.dispatchEvent(new Event("phx:show-end"))};i.dispatchEvent(new Event("phx:show-start")),a===!1?(d(),setTimeout(v,o)):e.transition(o,d,v)}else this.isVisible(i)?window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:hide-start")),c.putSticky(i,"toggle",d=>d.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:show-start"));let d=s||this.defaultDisplay(i);c.putSticky(i,"toggle",v=>v.style.display=d),i.dispatchEvent(new Event("phx:show-end"))})},toggleClasses(t,e,i,s,n,r){window.requestAnimationFrame(()=>{let[o,a]=c.getSticky(t,"classes",[[],[]]),h=e.filter(p=>o.indexOf(p)<0&&!t.classList.contains(p)),l=e.filter(p=>a.indexOf(p)<0&&t.classList.contains(p));this.addOrRemoveClasses(t,h,l,i,s,n,r)})},toggleAttr(t,e,i,s){t.hasAttribute(e)?s!==void 0?t.getAttribute(e)===i?this.setOrRemoveAttrs(t,[[e,s]],[]):this.setOrRemoveAttrs(t,[[e,i]],[]):this.setOrRemoveAttrs(t,[],[e]):this.setOrRemoveAttrs(t,[[e,i]],[])},addOrRemoveClasses(t,e,i,s,n,r,o){n=n||di;let[a,h,l]=s||[[],[],[]];if(a.length>0){let p=()=>{this.addOrRemoveClasses(t,h,[].concat(a).concat(l)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(t,l,h))})},m=()=>
10this.addOrRemoveClasses(t,e.concat(l),i.concat(a).concat(h));o===!1?(p(),setTimeout(m,n)):r.transition(n,p,m);return}window.requestAnimationFrame(()=>{let[p,m]=c.getSticky(t,"classes",[[],[]]),g=e.filter(b=>p.indexOf(b)<0&&!t.classList.contains(b)),f=i.filter(b=>m.indexOf(b)<0&&t.classList.contains(b)),d=p.filter(b=>i.indexOf(b)<0).concat(g),v=m.filter(b=>e.indexOf(b)<0).concat(f);c.putSticky(t,"classes",b=>(b.classList.remove(...v),b.classList.add(...d),[d,v]))})},setOrRemoveAttrs(t,e,i){let[s,n]=c.getSticky(t,"attrs",[[],[]]),r=e.map(([h,l])=>h).concat(i),o=s.filter(([h,l])=>!r.includes(h)).concat(e),a=n.filter(h=>!r.includes(h)).concat(i);e.some(([h,l])=>h==="id")&&c.putPrivate(t,"clientsideIdAttribute",!0),c.putSticky(t,"attrs",h=>(a.forEach(l=>h.removeAttribute(l)),o.forEach(([l,p])=>h.setAttribute(l,p)),[o,a]))},hasAllClasses(t,e){return e.every(i=>t.classList.contains(i))},isToggledOut(t,e){return!this.isVisible(t)||this.hasAllClasses(t,e)},filterToEls(t,e,{to:i}){let s=()=>{if(typeof i=="string")return document.querySelectorAll(i);if(i.closest){let n=e.closest(i.closest);return n?[n]:[]}else if(i.inner)return e.querySelectorAll(i.inner)};return i?t.jsQuerySelectorAll(e,i,s):[e]},defaultDisplay(t){return{tr:"table-row",td:"table-cell"}[t.tagName.toLowerCase()]||"block"},transitionClasses(t){if(!t)return null;let[e,i,s]=Array.isArray(t)?t:[t.split(" "),[],[]];return e=Array.isArray(e)?e:e.split(" "),i=Array.isArray(i)?i:i.split(" "),s=Array.isArray(s)?s:s.split(" "),[e,i,s]}},E=Vs,yi=(t,e)=>({exec(i,s){t.execJS(i,s,e)},show(i,s={}){let n=t.owner(i);E.show(e,n,i,s.display,E.transitionClasses(s.transition),s.time,s.blocking)},hide(i,s={}){let n=t.owner(i);E.hide(e,n,i,null,E.transitionClasses(s.transition),s.time,s.blocking)},toggle(i,s={}){let n=t.owner(i),r=E.transitionClasses(s.in),o=E.transitionClasses(s.out);E.toggle(e,n,i,s.display,r,o,s.time,s.blocking)},addClass(i,s,n={}){let r=Array.isArray(s)?s:s.split(" "),o=t.owner(i);E.addOrRemoveClasses(i,r,[],E.transitionClasses(n.transition),n.time,o,n.blocking)},removeClass(i,s,n={}){let r=Array.isArray(s)?s:s.split(" "),o=t.owner(i);E.addOrRemoveClasses(i,[],r,E.transitionClasses(n.transition),n.time,o,n.blocking)},toggleClass(i,s,n={}){let r=Array.isArray(s)?s:s.split(" "),o=t.owner(i);E.toggleClasses(i,r,E.transitionClasses(n.transition),n.time,o,n.blocking)},transition(i,s,n={}){let r=t.owner(i);E.addOrRemoveClasses(i,[],[],E.transitionClasses(s),n.time,r,n.blocking)},setAttribute(i,s,n){E.setOrRemoveAttrs(i,[[s,n]],[])},removeAttribute(i,s){E.setOrRemoveAttrs(i,[],[s])},toggleAttribute(i,s,n,r){E.toggleAttr(i,s,n,r)},push(i,s,n={}){t.withinOwners(i,r=>{let o=n.value||{};delete n.value;let a=new CustomEvent("phx:exec",{detail:{sourceElement:i}});E.exec(a,e,s,r,i,["push",{data:o,...n}])})},navigate(i,s={}){Zt(i,"navigate");let n=new CustomEvent("phx:exec");t.historyRedirect(n,i,s.replace?"replace":"push",null,null)},patch(i,s={}){Zt(i,"patch");let n=new CustomEvent("phx:exec");t.pushHistoryPatch(n,i,s.replace?"replace":"push",null)},ignoreAttributes(i,s){E.ignoreAttrs(i,Array.isArray(s)?s:[s])}}),vt="hookId",ui="deadHook",Js=1,ce=class wi{get liveSocket(){return this.__liveSocket()}static makeID(){return Js++}static elementID(e){return c.private(e,vt)}static deadHook(e){return c.private(e,ui)===!0}constructor(e,i,s){if(this.el=i,this.__attachView(e),this.__listeners=new Set,this.__isDisconnected=!1,c.putPrivate(this.el,vt,wi.makeID()),e&&e.isDead&&c.putPrivate(this.el,ui,!0),s){let n=new Set(["el","liveSocket","__view","__listeners","__isDisconnected","constructor","js","pushEvent","pushEventTo","handleEvent","removeHandleEvent","upload","uploadTo","__mounted","__updated","__beforeUpdate","__destroyed","__reconnected","__disconnected","__cleanup__"]);for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&(this[o]=s[o],n.has(o)&&console.warn(`Hook object for element #${i.id} overwrites core property '${o}'!`));["mounted","beforeUpdate","updated","destroyed","disconnected","reconnected"].forEach(o=>{s[o]&&typeof s[o]=="function"&&(this[o]=s[o])})}}__attachView(e){e?(this.__view=()=>e,this.__liveSocket=()=>e.liveSocket):(this.__view=()=>{throw new Error(`hook not yet attached to a live view: ${this.el.outerHTML}`)},this.__liveSocket=()=>{throw new Error(`hook not yet attached to a live view: ${this.el.outerHTML}`)})}mounted(){}beforeUpdate(){}updated(){}destroyed(){}disconnected(){}reconnected(){}__mounted(){this.mounted()}__updated(){this.updated()}__beforeUpdate(){this.beforeUpdate()}__destroyed(){this.destroyed(),c.deletePrivate(this.el,vt)}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected()}js(){return{...yi(this.__view().liveSocket,"hook"),exec:e=>{this.__view().liveSocket.execJS(this.el,e,"hook")}}}pushEvent(e,i,s){let n=this.__view().pushHookEvent(this.el,null,e,i||{});if(s===void 0)return n.then(({reply:r})=>r);n.then(({reply:r,ref:o})=>s(r,o)).catch(()=>{})}pushEventTo(e,i,s,n){if(n===void 0){let r=[];this.__view().withinTargets(e,(a,h)=>{r.push({view:a,targetCtx:h})});let o=r.map(({view:a,targetCtx:h})=>a.pushHookEvent(this.el,h,i,s||{}));return Promise.allSettled(o)}this.__view().withinTargets(e,(r,o)=>{r.pushHookEvent(this.el,o,i,s||{}).then(({reply:a,ref:h})=>n(a,h)).catch(()=>{})})}handleEvent(e,i){let s={event:e,callback:n=>i(n.detail)};return window.addEventListener(`phx:${e}`,s.callback),this.__listeners.add(s),s}removeHandleEvent(e){window.removeEventListener(`phx:${e.event}`,e.callback),this.__listeners.delete(e)}upload(e,i){return this.__view().dispatchUploads(null,e,i)}uploadTo(e,i,s){return this.__view().withinTargets(e,(n,r)=>
10{n.dispatchUploads(r,i,s)})}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}},Xs=(t,e)=>{let i=t.endsWith("[]"),s=i?t.slice(0,-2):t;return s=s.replace(/([^\[\]]+)(\]?$)/,`${e}$1$2`),i&&(s+="[]"),s},Ws=class ki{static closestView(e){let i=e.closest($e);return i?c.private(i,"view"):null}constructor(e,i,s,n=null,r=null){this.rendered=null,this.isDead=!1,this.liveSocket=i,this.flash=n,this.parent=s,this.root=s?s.root:this,this.el=e;let o=c.private(this.el,"view");if(o!==void 0&&o.isDead!==!0)throw _(`The DOM element for this view has already been bound to a view. 11 12 An element can only ever be associated with a single view! 13 Please ensure that you are not trying to initialize multiple LiveSockets on the same page. 14 This could happen if you're accidentally trying to render your root layout more than once. 15 Ensure that the template set on the LiveView is different than the root layout. 16 `,{view:o}),new Error("Cannot bind multiple views to the same DOM element.");c.putPrivate(this.el,"view",this),this.id=this.el.id,this.el.setAttribute(te,this.root.id),this.ref=0,this.lastAckRef=null,this.childJoins=0,this.loaderTimer=null,this.disconnectedTimer=null,this.pendingDiffs=[],this.pendingForms=new Set,this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinAttempts=0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(a){a&&a()},this.stopCallback=function(){},this.pendingJoinOps=[],this.viewHooks={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.formsForRecovery={},this.channel=this.liveSocket.channel(`lv:${this.id}`,()=>{let a=this.href&&this.expandURL(this.href);return{redirect:this.redirect?a:void 0,url:this.redirect?void 0:a||void 0,params:this.connectParams(r),session:this.getSession(),static:this.getStatic(),flash:this.flash??void 0,sticky:this.el.hasAttribute(At)}}),this.portalElementIds=new Set}setHref(e){this.href=e}setRedirect(e){this.redirect=!0,this.href=e}isMain(){return this.el.hasAttribute(Pt)}connectParams(e){let i=this.liveSocket.params(this.el),s=c.all(document,`[${this.binding(zi)}]`).map(n=>"src"in n&&n.src||"href"in n&&n.href).filter(n=>typeof n=="string");return s.length>0&&(i._track_static=s),i._mounts=this.joinCount,i._mount_attempts=this.joinAttempts,i._live_referer=e??void 0,this.joinAttempts++,i}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(Q)}getStatic(){let e=this.el.getAttribute(fe);return e===""?null:e}destroy(e=function(){}){this.destroyAllChildren(),this.destroyPortalElements(),this.destroyed=!0,c.deletePrivate(this.el,"view"),delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],this.loaderTimer!=null&&clearTimeout(this.loaderTimer);let i=()=>{e();for(let s in this.viewHooks)this.destroyHook(this.viewHooks[s])};c.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",i).receive("error",i).receive("timeout",i)}setContainerClasses(...e){this.el.classList.remove(Ut,le,ke,jt,Re),this.el.classList.add(...e)}showLoader(e){if(this.loaderTimer!=null&&clearTimeout(this.loaderTimer),e)this.loaderTimer=setTimeout(()=>this.showLoader(),e);else{for(let i in this.viewHooks)this.viewHooks[i].__disconnected();this.setContainerClasses(le)}}execAll(e){c.all(this.el,`[${e}]`,i=>this.liveSocket.execJS(i,i.getAttribute(e)))}hideLoader(){this.loaderTimer!=null&&clearTimeout(this.loaderTimer),this.disconnectedTimer!=null&&clearTimeout(this.disconnectedTimer),this.setContainerClasses(Ut),this.execAll(this.binding("connected"))}triggerReconnected(){for(let e in this.viewHooks)this.viewHooks[e].__reconnected()}log(e,i){this.liveSocket.log(this,e,i)}transition(e,i,s=function(){}){this.liveSocket.transition(e,i,s)}withinTargets(e,i,s=document){if(e instanceof HTMLElement||e instanceof SVGElement)return this.liveSocket.owner(e,n=>i(n,e));if(ae(e))c.findComponent(this.id,e,s)?i(this,typeof e=="number"?e:parseInt(e)):_(`no component found matching phx-target of ${e}`);else{let n=Array.from(s.querySelectorAll(e));n.length===0&&_(`nothing found matching the phx-target selector "${e}
16"`),n.forEach(r=>this.liveSocket.owner(r,o=>i(o,r)))}}applyDiff(e,i,s){this.log(e,()=>["",et(i)]);let{diff:n,reply:r,events:o,title:a}=li.extract(i),h=o.reduce((p,m)=>(m.length===3&&m[2]==!0?p.pre.push(m.slice(0,-1)):p.post.push(m),p),{pre:[],post:[]});this.liveSocket.dispatchEvents(h.pre);let l=()=>{s({diff:n,reply:r,events:h.post}),(typeof a=="string"||e=="mount"&&this.isMain())&&window.requestAnimationFrame(()=>c.putTitle(a))};"onDocumentPatch"in this.liveSocket.domCallbacks?this.liveSocket.triggerDOM("onDocumentPatch",[l]):l()}onJoin(e){let{rendered:i,container:s,liveview_version:n,pid:r}=e;if(s){let[o,a]=s;this.el=c.replaceRootContainer(this.el,o,a),c.putPrivate(this.el,"view",this)}this.childJoins=0,this.joinPending=!0,this.flash=null,this.root===this&&(this.formsForRecovery=this.getFormsForRecovery()),this.isMain()&&window.history.state===null&&U.pushState("replace",{type:"patch",id:this.id,position:this.liveSocket.currentHistoryPosition}),n!==this.liveSocket.version()&&console.warn(`LiveView asset version mismatch. JavaScript version ${this.liveSocket.version()} vs. server ${n}. To avoid issues, please ensure that your assets use the same version as the server.`),r&&this.el.setAttribute(ts,r),U.dropLocal(this.liveSocket.localStorage,window.location.pathname,fi),this.applyDiff("mount",i,({diff:o,events:a})=>{this.rendered=new li(this.id,o);let[h,l]=this.renderContainer(null,"join");this.dropPendingRefs(),this.joinCount++,this.joinAttempts=0,this.maybeRecoverForms(h,()=>{this.onJoinComplete(e,h,l,a)})})}dropPendingRefs(){c.all(document,`[${X}="${this.refSrc()}"]`,e=>{e.removeAttribute(_e),e.removeAttribute(X),e.removeAttribute(L)})}onJoinComplete({live_patch:e},i,s,n){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(e,i,s,n);c.findPhxChildrenInFragment(i,this.id).filter(o=>{let a=o.id&&this.el.querySelector(`[id="${o.id}"]`),h=a&&a.getAttribute(fe);return h&&o.setAttribute(fe,h),a&&a.setAttribute(te,this.root.id),this.joinChild(o)}).length===0?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,i,s,n)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(e,i,s,n)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,i,s,n)])}attachTrueDocEl(){let e=c.byId(this.id);if(!e)throw new Error("unable to find root element for view");this.el=e,c.putPrivate(this.el,"view",this),this.el.setAttribute(te,this.root.id)}execNewMounted(e=document){let i=this.binding(wt),s=this.binding(kt);this.all(e,`[${i}], [${s}]`,n=>{c.maintainPrivateHooks(n,n,i,s),this.maybeAddNewHook(n)}),this.all(e,`[${this.binding(xe)}], [data-phx-${xe}]`,n=>{this.maybeAddNewHook(n)}),this.all(e,`[${this.binding(Xt)}]`,n=>{this.maybeMounted(n)})}all(e,i,s){c.all(e,i,n=>{this.ownsElement(n)&&s(n)})}applyJoinPatch(e,i,s,n){this.joinCount>1&&this.pendingJoinOps.length&&(this.pendingJoinOps.forEach(o=>typeof o=="function"&&o()),this.pendingJoinOps=[]),this.attachTrueDocEl();let r=new Ge(this,this.el,i,s,null);if(r.markPrunableContentForRemoval(),this.performPatch(r,!1,!0),this.joinNewChildren(),this.execNewMounted(),this.joinPending=!1,this.liveSocket.dispatchEvents(n),this.applyPendingUpdates(),e){let{kind:o,to:a}=e;this.liveSocket.historyPatch(a,o)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(e,i){this.liveSocket.triggerDOM("onBeforeElUpdated",[e,i]);let s=this.getHook(e),n=s&&c.isIgnored(e,this.binding(st));if(s&&!e.isEqualNode(i)&&!(n&&ps(e.dataset,i.dataset)))return s.__beforeUpdate(),s}maybeMounted(e){let i=e.getAttribute(this.binding(Xt)),s=i&&c.private(e,"mounted");i&&!s&&(this.liveSocket.execJS(e,i),c.putPrivate(e,"mounted",!0))}maybeAddNewHook(e){let i=this.addHook(e);i&&i.__mounted()}performPatch(e,i,s=!1){let n=[],r=!1,o=new Set;return this.liveSocket.triggerDOM("onPatchStart",[e.targetContainer]),e.afterAdded(a=>{this.liveSocket.triggerDOM("onNodeAdded",[a]);let h=this.binding(wt),l=this.binding(kt);c.maintainPrivateHooks(a,a,h,l),this.maybeAddNewHook(a),a.getAttribute&&this.maybeMounted(a)}),e.afterPhxChildAdded(a=>{c.isPhxSticky(a)?this.liveSocket.joinRootViews():r=!0}),e.beforeUpdated((a,h)=>{this.triggerBeforeUpdateHook(a,h)&&o.add(a.id),E.onBeforeElUpdated(a,h)}),e.afterUpdated(a=>
16{if(o.has(a.id)){let h=this.getHook(a);h&&h.__updated()}}),e.afterDiscarded(a=>{a.nodeType===Node.ELEMENT_NODE&&n.push(a)}),e.afterTransitionsDiscarded(a=>this.afterElementsRemoved(a,i)),e.perform(s),this.afterElementsRemoved(n,i),this.liveSocket.triggerDOM("onPatchEnd",[e.targetContainer]),r}afterElementsRemoved(e,i){let s=[];e.forEach(n=>{let r=c.all(n,`[${Te}="${this.id}"][${Y}]`),o=c.all(n,`[${this.binding(xe)}], [data-phx-hook]`);r.concat(n).forEach(a=>{let h=this.componentID(a);ae(h)&&s.indexOf(h)===-1&&a.getAttribute(Te)===this.id&&s.push(h)}),o.concat(n).forEach(a=>{let h=this.getHook(a);h&&this.destroyHook(h)})}),i&&this.maybePushComponentsDestroyed(s)}joinNewChildren(){c.findPhxChildren(document,this.id).forEach(e=>this.joinChild(e))}maybeRecoverForms(e,i){let s=this.binding("change"),n=this.root.formsForRecovery,r=document.createElement("template");if(r.innerHTML=e,!r.content.firstElementChild)return;c.all(r.content,`[${Rt}]`).forEach(h=>{h instanceof HTMLTemplateElement&&r.content.firstElementChild?.appendChild(h.content.firstElementChild)});let o=r.content.firstElementChild;o.id=this.id,o.setAttribute(te,this.root.id),o.setAttribute(Q,this.getSession()),o.setAttribute(fe,this.getStatic()??""),this.parent&&o.setAttribute(pe,this.parent.id),c.putPrivate(o,"view",this);let a=c.all(r.content,"form").filter(h=>h.id&&n[h.id]).filter(h=>!this.pendingForms.has(h.id)).filter(h=>n[h.id].getAttribute(s)===h.getAttribute(s)).map(h=>[n[h.id],h]);if(a.length===0)return i();a.forEach(([h,l],p)=>{this.pendingForms.add(l.id),this.pushFormRecovery(h,l,r.content.firstElementChild,()=>{this.pendingForms.delete(l.id),p===a.length-1&&i()})})}getChildById(e){return this.root.children[this.id][e]}
16getDescendentByEl(e){return e.id===this.id?this:this.children&&this.children[e.getAttribute(pe)]?.[e.id]}destroyDescendent(e){for(let i in this.root.children)for(let s in this.root.children[i])if(s===e)return this.root.children[i][s].destroy()}joinChild(e){if(!this.getChildById(e.id)){let s=new ki(e,this.liveSocket,this);return this.root.children[this.id][s.id]=s,s.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.pendingForms.clear(),this.formsForRecovery={},this.joinCallback(()=>{this.pendingJoinOps.forEach(([e,i])=>{e.isDestroyed()||i()}),this.pendingJoinOps=[]})}update(e,i,s=!1){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&this.root.isMain())return s||this.pendingDiffs.push({diff:e,events:i}),!1;this.rendered.mergeDiff(e);let n=!1;return this.rendered.isComponentOnlyDiff(e)?this.liveSocket.time("component patch complete",()=>{c.findExistingParentCIDs(this.id,this.rendered.componentCIDs(e)).forEach(o=>{this.componentPatch(this.rendered.getComponent(e,o),o)&&(n=!0)})}):ei(e)||this.liveSocket.time("full patch complete",()=>{let[r,o]=this.renderContainer(e,"update"),a=new Ge(this,this.el,r,o,null);n=this.performPatch(a,!0)}),this.liveSocket.dispatchEvents(i),n&&this.joinNewChildren(),!0}renderContainer(e,i){return this.liveSocket.time(`toString diff (${i})`,()=>{let s=this.el.tagName,n=e?this.rendered.componentCIDs(e):null,{buffer:r,streams:o}=this.rendered.toString(n);return[`<${s}>${r}</${s}>`,o]})}componentPatch(e,i){if(ei(e))return!1;let{buffer:s,streams:n}=this.rendered.componentToString(i),r=new Ge(this,this.el,s,n,i);return this.performPatch(r,!0)}getHook(e){return this.viewHooks[ce.elementID(e)]}addHook(e){let i=ce.elementID(e);if(!(e.getAttribute&&!this.ownsElement(e)))if(i&&!this.viewHooks[i]){if(ce.deadHook(e))return;let s=c.getCustomElHook(e)||_(`no hook found for custom element: ${e.id}`);return this.viewHooks[i]=s,s.__attachView(this),s}else{if(i||!e.getAttribute)return;{let s=e.getAttribute(`data-phx-${xe}`)||e.getAttribute(this.binding(xe));if(!s)return;let n=this.liveSocket.getHookDefinition(s);if(n){if(!e.id){_(`no DOM ID for hook "${s}". Hooks require a unique ID on each element.`,e);return}let r;try{if(typeof n=="function"&&n.prototype instanceof ce)r=new n(this,e);else if(typeof n=="object"&&n!==null)r=new ce(this,e,n);else{_(`Invalid hook definition for "${s}". Expected a class extending ViewHook or an object definition.`,e);return}}catch(o){let a=o instanceof Error?o.message:String(o);_(`Failed to create hook "${s}": ${a}`,e);return}return this.viewHooks[ce.elementID(r.el)]=r,r}
16else s!==null&&_(`unknown hook found for "${s}"`,e)}}}destroyHook(e){let i=ce.elementID(e.el);e.__destroyed(),e.__cleanup__(),delete this.viewHooks[i]}applyPendingUpdates(){this.pendingDiffs=this.pendingDiffs.filter(({diff:e,events:i})=>!this.update(e,i,!0)),this.eachChild(e=>e.applyPendingUpdates())}eachChild(e){let i=this.root.children[this.id]||{};for(let s in i)e(this.getChildById(s))}onChannel(e,i){this.liveSocket.onChannel(this.channel,e,s=>{this.isJoinPending()?this.joinCount>1?this.pendingJoinOps.push(()=>i(s)):this.root.pendingJoinOps.push([this,()=>i(s)]):this.liveSocket.requestDOMUpdate(()=>i(s))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",e=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",e,({diff:i,events:s})=>this.update(i,s))})}),this.onChannel("redirect",({to:e,flash:i})=>this.onRedirect({to:e,flash:i})),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(){this.eachChild(e=>e.destroy())}onLiveRedirect(e){let{to:i,kind:s,flash:n}=e,r=this.expandURL(i),o=new CustomEvent("phx:server-navigate",{detail:{to:i,kind:s,flash:n}});this.liveSocket.historyRedirect(o,r,s,n)}onLivePatch(e){let{to:i,kind:s}=e;this.href=this.expandURL(i),this.liveSocket.historyPatch(i,s)}expandURL(e){return e.startsWith("/")?`${window.location.protocol}//${window.location.host}${e}`:e}onRedirect({to:e,flash:i,reloadToken:s}){this.liveSocket.redirect(e,i??null,s??null)}isDestroyed(){return this.destroyed}joinDead(){this.isDead=!0}join(e){this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel(),this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=i=>{i=i||function(){},e?e(this.joinCount,i):i()},this.wrapPush(()=>this.channel.join(),{ok:i=>this.liveSocket.requestDOMUpdate(()=>this.onJoin(i)),error:i=>this.onJoinError(i),timeout:()=>this.onJoinError({reason:"timeout"})})}onJoinError(e){if(e.events&&this.liveSocket.dispatchEvents(e.events),e.reason==="reload"){this.log("error",()=>[`failed mount with ${e.status}. Falling back to page reload`,e]),this.onRedirect({to:this.liveSocket.main.href,reloadToken:e.token});return}else if(e.reason==="unauthorized"||e.reason==="stale"){this.log("error",()=>["unauthorized live_redirect. Falling back to page request",e]),this.onRedirect({to:this.liveSocket.main.href,flash:this.flash});return}if((e.redirect||e.live_redirect)&&(this.joinPending=!1,this.channel.leave()),e.redirect)return this.onRedirect(e.redirect);if(e.live_redirect)return this.onLiveRedirect(e.live_redirect);if(this.log("error",()=>["unable to join",e]),this.isMain())this.displayError([le,ke,Re],{unstructuredError:e,errorKind:"server"}),this.liveSocket.isConnected()&&this.liveSocket.reloadWithJitter(this);else{this.joinAttempts>=qt&&(this.root.displayError([le,ke,Re],{unstructuredError:e,errorKind:"server"}),this.log("error",()=>[`giving up trying to mount after ${qt} tries`,e]),this.destroy());let i=c.byId(this.el.id);i?(c.mergeAttrs(i,this.el),this.displayError([le,ke,Re],{unstructuredError:e,errorKind:"server"}),this.el=i):this.destroy()}}onClose(e){if(!this.isDestroyed()){if(this.isMain()&&this.liveSocket.hasPendingLink()&&e!=="leave")return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),this.liveSocket.isUnloaded()&&this.showLoader(rs)}}onError(e){this.onClose(e),this.liveSocket.isConnected()&&this.log("error",()=>["view crashed",e]),this.liveSocket.isUnloaded()||(this.liveSocket.isConnected()?this.displayError([le,ke,Re],{unstructuredError:e,errorKind:"server"}):this.displayError([le,ke,jt],{unstructuredError:e,errorKind:"client"}))}displayError(e,i={}){this.isMain()&&c.dispatchEvent(window,"phx:page-loading-start",{detail:{to:this.href,kind:"error",...i}}),this.showLoader(),this.setContainerClasses(...e),this.delayedDisconnected()}delayedDisconnected(){this.disconnectedTimer=setTimeout(()=>{this.execAll(this.binding("disconnected"))},this.liveSocket.disconnectedTimeout)}wrapPush(e,i){let s=this.liveSocket.getLatencySim(),n=s?r=>setTimeout(()=>!this.isDestroyed()&&r(),s):r=>!this.isDestroyed()&&r();n(()=>{e().receive("ok",r=>n(()=>i.ok&&i.ok(r))).receive("error",r=>n(()=>i.error&&i.error(r))).receive("timeout",()=>n(()=>i.timeout&&i.timeout()))})}pushWithReply(e,i,s){if(!this.isConnected())return Promise.reject(new Error("no connection"));let[n,[r],o]=e?e({payload:s}):[null,[],{}],a=this.joinCount,h=function(){};return o.page_loading&&(h=this.liveSocket.withPageLoading({kind:"element",target:r})),typeof s.cid!="number"&&delete s.cid,new Promise((l,p)=>{this.wrapPush(()=>this.channel.push(i,s,hs),{ok:m=>{n!==null&&(this.lastAckRef=n);let g=f=>{m.redirect&&this.onRedirect(m.redirect),m.live_patch&&this.onLivePatch(m.live_patch),m.live_redirect&&this.onLiveRedirect(m.live_redirect),h(),l({resp:m,reply:f,ref:n})};m.diff?this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",m.diff,({diff:f,reply:d,events:v})=>{n!==null&&this.undoRefs(n,s.event),this.update(f,v),g(d)})}):(n!==null&&this.undoRefs(n,s.event),g(null))},error:m=>p(new Error(`failed with reason: ${JSON.stringify(m)}`)),timeout:()=>{p(new Error("timeout")),this.joinCount===a&&this.liveSocket.reloadWithJitter(this,()=>{this.log("timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}})})}undoRefs(e,i,s){if(!this.isConnected())return;let n=`[${X}="${this.refSrc()}"]`;s?(s=new Set(s),c.all(document,n,r=>{s&&!s.has(r)||(c.all(r,n,o=>this.undoElRef(o,e,i)),this.undoElRef(r,e,i))}
16)):c.all(document,n,r=>this.undoElRef(r,e,i))}undoElRef(e,i,s){new Ct(e).maybeUndo(i,s,r=>{let o=new Ge(this,e,r,new Set,null,{undoRef:i}),a=this.performPatch(o,!0);c.all(e,`[${X}="${this.refSrc()}"]`,h=>this.undoElRef(h,i,s)),a&&this.joinNewChildren()})}refSrc(){return this.el.id}putRef(e,i,s,n={}){let r=this.ref++,o=this.binding(Bt);if(n.loading){let a=c.all(document,n.loading).map(h=>({el:h,lock:!0,loading:!0}));e=e.concat(a)}for(let{el:a,lock:h,loading:l}of e){if(!h&&!l)throw new Error("putRef requires lock or loading");if(a.setAttribute(X,this.refSrc()),l&&a.setAttribute(_e,r.toString()),h&&a.setAttribute(L,r.toString()),!l||n.submitter&&!(a===n.submitter||a===n.form))continue;let p=new Promise(d=>{a.addEventListener(`phx:undo-lock:${r}`,()=>d(f),{once:!0})}),m=new Promise(d=>{a.addEventListener(`phx:undo-loading:${r}`,()=>d(f),{once:!0})});a.classList.add(`phx-${s}-loading`);let g=a.getAttribute(o);g!==null&&(a.getAttribute(it)||a.setAttribute(it,a.textContent||""),g!==""&&(a.textContent=g),a.setAttribute(Se,a.getAttribute(Se)||("disabled"in a?String(a.disabled):"")),a.setAttribute("disabled",""));let f={event:i,eventType:s,ref:r,isLoading:l,isLocked:h,lockElements:e.filter(({lock:d})=>d).map(({el:d})=>d),loadingElements:e.filter(({loading:d})=>d).map(({el:d})=>d),unlock:d=>{d=Array.isArray(d)?d:[d],this.undoRefs(r,i,d)},lockComplete:p,loadingComplete:m,lock:d=>new Promise(v=>{if(this.isAcked(r))return v(f);d.setAttribute(L,r),d.setAttribute(X,this.refSrc()),d.addEventListener(`phx:lock-stop:${r}`,()=>v(f),{once:!0})})};n.payload&&(f.payload=n.payload),n.target&&(f.target=n.target),n.originalEvent&&(f.originalEvent=n.originalEvent),a.dispatchEvent(new CustomEvent("phx:push",{detail:f,bubbles:!0,cancelable:!1})),i&&a.dispatchEvent(new CustomEvent(`phx:push:${i}`,{detail:f,bubbles:!0,cancelable:!1}))}return[r,e.map(({el:a})=>a),n]}isAcked(e){return this.lastAckRef!==null&&this.lastAckRef>=e}componentID(e){let i=e.getAttribute&&e.getAttribute(Y);return i?parseInt(i):null}targetComponentID(e,i,s={}){if(ae(i))return i;let n=s.target||e.getAttribute(this.binding("target"));return ae(n)?typeof n=="number"?n:parseInt(n):i&&(n!==null||s.target)?this.closestComponentID(i):null}closestComponentID(e){return ae(e)?e:e?Ce(e.closest(`[${Y}],[${he}]`),i=>{if(i.hasAttribute(Y))return this.ownsElement(i)&&this.componentID(i);if(i.hasAttribute(he)){let s=c.byId(i.getAttribute(he));return this.closestComponentID(s)}}):null}pushHookEvent(e,i,s,n){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",s,n]),Promise.reject(new Error("unable to push hook event. LiveView not connected"));let r=()=>this.putRef([{el:e,loading:!0,lock:!0}],s,"hook",{payload:n,target:i});return this.pushWithReply(r,"event",{type:"hook",event:s,value:n,cid:this.closestComponentID(i)}).then(({resp:o,reply:a,ref:h})=>({reply:a,ref:h}))}extractMeta(e,i,s){let n=this.binding("value-");for(let r=0;r<e.attributes.length;r++){i||(i={});let o=e.attributes[r].name;o.startsWith(n)&&(i[o.replace(n,"")]=e.getAttribute(o))}if(e.value!==void 0&&!(e instanceof HTMLFormElement)&&(i||(i={}),i.value=e.value,e.tagName==="INPUT"&&vi.indexOf(e.type)>=0&&!e.checked&&delete i.value),s){i||(i={});for(let r in s)i[r]=s[r]}return i}serializeForm(e,i={},s=[]){let{submitter:n}=i,r;if(n&&n.name){let g=document.createElement("input");g.type="hidden";let f=n.getAttribute("form");f&&g.setAttribute("form",f),g.name=n.name,g.value=n.value,n.parentElement.insertBefore(g,n),r=g}let o=new FormData(e),a=[];o.forEach((g,f,d)=>{g instanceof File&&a.push(f)}),a.forEach(g=>o.delete(g));let h=new URLSearchParams,{inputsUnused:l,onlyHiddenInputs:p}=Array.from(e.elements).reduce((g,f)=>{if(!c.isFormAssociated(f))return g;let{inputsUnused:d,onlyHiddenInputs:v}=g,b=f.name;if(!b)return g;d[b]===void 0&&(d[b]=!0),v[b]===void 0&&(v[b]=!0);let R=f.hasAttribute(this.binding(Jt)),j=c.private(f,tt)||c.private(f,Ne)||R,w=f.type==="hidden";return d[b]=d[b]&&!j,v[b]=v[b]&&w,g},{inputsUnused:{},onlyHiddenInputs:{}}),m=e.hasAttribute(this.binding(Jt));for(let[g,f]of o.entries())if(s.length===0||s.indexOf(g)>=0){let d=l[g],v=p[g];!m&&d&&!(n&&n.name==g)&&!v&&h.append(Xs(g,"_unused_"),""),typeof f=="string"&&h.append(g,f)}return n&&r&&n.parentElement.removeChild(r),h.toString()}pushEvent(e,i,s,n,r,o={},a){this.pushWithReply(h=>this.putRef([{el:i,loading:!0,lock:!0}],n,e,{...o,payload:h?.payload}
16),"event",{type:e,event:n,value:this.extractMeta(i,r,o.value),cid:this.targetComponentID(i,s,o)}).then(({reply:h})=>a&&a(h)).catch(h=>_("Failed to push event",h))}pushFileProgress(e,i,s,n=function(){}){this.liveSocket.withinOwners(e.form,(r,o)=>{r.pushWithReply(null,"progress",{event:e.getAttribute(r.binding(ss)),ref:e.getAttribute(ie),entry_ref:i,progress:s,cid:r.targetComponentID(e.form,o)}).then(()=>n()).catch(a=>_("Failed to push file progress",a))})}pushInput(e,i,s,n,r,o){if(!e.form)throw new Error("form events require the input to be inside a form");let a,h=ae(s)?s:this.targetComponentID(e.form,i,r),l=d=>this.putRef([{el:e,loading:!0,lock:!0},{el:e.form,loading:!0,lock:!0}],n,"change",{...r,payload:d?.payload}),p,m=this.extractMeta(e.form,{},r.value),g={};e instanceof HTMLButtonElement&&(g.submitter=e),e.getAttribute(this.binding("change"))?p=this.serializeForm(e.form,g,[e.name]):p=this.serializeForm(e.form,g),c.isUploadInput(e)&&e.files&&e.files.length>0&&H.trackFiles(e,Array.from(e.files)),a=H.serializeUploads(e);let f={type:"form",event:n,value:p,meta:{_target:r._target||"undefined",...m},uploads:a,cid:h};this.pushWithReply(l,"event",f).then(({resp:d})=>{c.isUploadInput(e)&&c.isAutoUpload(e)?Ct.onUnlock(e,()=>{if(H.filesAwaitingPreflight(e).length>0){let[v,b]=l();this.undoRefs(v,n,[e.form]),this.uploadFiles(e.form,n,i,v,h,R=>{o&&o(d),this.triggerAwaitingSubmit(e.form,n),this.undoRefs(v,n)})}}):o&&o(d)}).catch(d=>_("Failed to push input event",d))}triggerAwaitingSubmit(e,i){let s=this.getScheduledSubmit(e);if(s){let[n,r,o,a]=s;this.cancelSubmit(e,i),a()}}getScheduledSubmit(e){return this.formSubmits.find(([i,s,n,r])=>i.isSameNode(e))}scheduleSubmit(e,i,s,n){if(this.getScheduledSubmit(e))return!0;this.formSubmits.push([e,i,s,n])}cancelSubmit(e,i){this.formSubmits=this.formSubmits.filter(([s,n,r,o])=>s.isSameNode(e)?(this.undoRefs(n,i),!1):!0)}disableForm(e,i,s={}){let n=d=>!(ue(d,`${this.binding(st)}=ignore`,d.form)||ue(d,"data-phx-update=ignore",d.form)),r=d=>d.hasAttribute(this.binding(Bt)),o=d=>d.tagName=="BUTTON",a=d=>["INPUT","TEXTAREA"].includes(d.tagName),h=Array.from(e.elements),l=h.filter(r),p=h.filter(o).filter(n),m=h.filter(a).filter(n);p.forEach(d=>{d.setAttribute(Se,d.disabled.toString()),d.disabled=!0}),m.forEach(d=>{d.setAttribute(Et,d.readOnly.toString()),d.readOnly=!0,d instanceof HTMLInputElement&&d.files&&(d.setAttribute(Se,d.disabled.toString()),d.disabled=!0)});let g=l.concat(p).concat(m).map(d=>({el:d,loading:!0,lock:!0})),f=[{el:e,loading:!0,lock:!1},...g].reverse();return this.putRef(f,i,"submit",s)}pushFormSubmit(e,i,s,n,r,o){let a=l=>this.disableForm(e,s,{...r,form:e,payload:l?.payload,submitter:n});c.putPrivate(e,"submitter",n);let h=this.targetComponentID(e,i);if(H.hasUploadsInProgress(e)){let[l,p]=a(),m=()=>this.pushFormSubmit(e,i,s,n,r,o);return this.scheduleSubmit(e,l,r,m)}else if(H.inputsAwaitingPreflight(e).length>0){let[l,p]=a(),m=()=>[l,p,r];this.uploadFiles(e,s,i,l,h,g=>{if(H.inputsAwaitingPreflight(e).length>0)return this.undoRefs(l,s);let f=this.extractMeta(e,{},r.value),d=this.serializeForm(e,{submitter:n});this.pushWithReply(m,"event",{type:"form",event:s,value:d,meta:f,cid:h}).then(({resp:v})=>o(v)).catch(v=>_("Failed to push form submit",v))})}else if(!(e.hasAttribute(X)&&e.classList.contains("phx-submit-loading"))){let l=this.extractMeta(e,{},r.value),p=this.serializeForm(e,{submitter:n});this.pushWithReply(a,"event",{type:"form",event:s,value:p,meta:l,cid:h}).then(({resp:m})=>o(m)).catch(m=>_("Failed to push form submit",m))}}uploadFiles(e,i,s,n,r,o){let a=this.joinCount,h=H.activeFileInputs(e),l=h.length;h.forEach(p=>{let m=new H(p,this,()=>{l--,l===0&&o()}),g=m.entries().map(d=>d.toPreflightPayload());if(g.length===0){l--;return}let f={ref:p.getAttribute(ie),entries:g,cid:this.targetComponentID(p.form,s)};this.log("upload",()=>["sending preflight request",f]),this.pushWithReply(null,"allow_upload",f).then(({resp:d})=>{if(this.log("upload",()=>["got preflight response",d]),m.entries().forEach(v=>{d.entries&&!d.entries[v.ref]&&this.handleFailedEntryPreflight(v.ref,"failed preflight",m)}),d.error||Object.keys(d.entries).length===0)this.undoRefs(n,i),(d.error||[]).map(([b,R])=>{this.handleFailedEntryPreflight(b,R,m)});else{let v=b=>{this.channel.onError(()=>{this.joinCount===a&&b()})};m.initAdapterUpload(d,v,this.liveSocket)}}).catch(d=>_("Failed to push upload",d))})}handleFailedEntryPreflight(e,i,s){if(s.isAutoUpload()){let n=s.entries().find(r=>r.ref===e.toString());n&&n.cancel()}else s.entries().map(n=>n.cancel());this.log("upload",()=>[`error for entry ${e}`,i])}dispatchUploads(e,i,s){let n=this.targetCtxElement(e)||this.el,r=c.findUploadInput
16s(n).filter(o=>o.name===i);r.length===0?_(`no live file inputs found matching the name "${i}"`):r.length>1?_(`duplicate live file inputs found matching the name "${i}"`):c.dispatchEvent(r[0],mi,{detail:{files:s}})}targetCtxElement(e){return ae(e)?c.findComponent(this.id,e):e||null}pushFormRecovery(e,i,s,n){let r=this.binding("change"),o=i.getAttribute(this.binding("target"))||i,a=i.getAttribute(this.binding(Vt))||i.getAttribute(this.binding("change")),h=Array.from(e.elements).filter(m=>c.isFormAssociated(m)&&m.name&&!m.hasAttribute(r));if(h.length===0){n();return}h.forEach(m=>m.hasAttribute(ie)&&H.clearFiles(m));let l=h.find(m=>m.type!=="hidden")||h[0],p=0;this.withinTargets(o,(m,g)=>{let f=this.targetComponentID(i,g);p++;let d=new CustomEvent("phx:form-recovery",{detail:{sourceElement:e}});E.exec(d,"change",a,this,l,["push",{_target:l.name,targetView:m,targetCtx:g,newCid:f,callback:()=>{p--,p===0&&n()}}])},s)}pushLinkPatch(e,i,s,n){let r=this.liveSocket.setPendingLink(i),o=e.isTrusted&&e.type!=="popstate",a=s?()=>this.putRef([{el:s,loading:o,lock:!0}],null,"click"):null,h=()=>this.liveSocket.redirect(window.location.href,null,null),l=i.startsWith("/")?`${location.protocol}//${location.host}${i}`:i;this.pushWithReply(a,"live_patch",{url:l}).then(({resp:p})=>{this.liveSocket.requestDOMUpdate(()=>{if(p.link_redirect)this.liveSocket.replaceMain(i,null,n,r);else{if(p.redirect)return;this.liveSocket.commitPendingLink(r)&&(this.href=i),this.applyPendingUpdates(),n&&n(r)}})},({error:p,timeout:m})=>h())}getFormsForRecovery(){if(this.joinCount===0)return{};let e=this.binding("change");return c.all(document,`#${CSS.escape(this.id)} form[${e}], [${me}="${CSS.escape(this.id)}"] form[${e}]`).filter(i=>i instanceof HTMLFormElement).filter(i=>i.id).filter(i=>i.elements.length>0).filter(i=>i.getAttribute(this.binding(Vt))!=="ignore").map(i=>{let s=i.cloneNode(!0);Tt(s,i,{onBeforeElUpdated:(r,o)=>(c.copyPrivates(r,o),r.getAttribute("form")===i.id&&r.parentNode?(r.parentNode.removeChild(r),!1):!0)});let n=document.querySelectorAll(`[form="${CSS.escape(i.id)}"]`);return Array.from(n).forEach(r=>{let o=r.cloneNode(!0);Tt(o,r),c.copyPrivates(o,r),o.removeAttribute("form"),s.appendChild(o)}),s}).reduce((i,s)=>(i[s.id]=s,i),{})}maybePushComponentsDestroyed(e){let i=e.filter(n=>c.findComponent(this.id,n)===null),s=n=>{this.isDestroyed()||_("Failed to push components destroyed",n)};i.length>0&&(i.forEach(n=>this.rendered.resetRender(n)),this.pushWithReply(null,"cids_will_destroy",{cids:i}).then(()=>{this.liveSocket.requestDOMUpdate(()=>{let n=i.filter(r=>c.findComponent(this.id,r)===null);n.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:n}).then(({resp:r})=>{this.rendered.pruneCIDs(r.cids)}).catch(s)})}).catch(s))}ownsElement(e){let i=c.closestViewEl(e);return e.getAttribute(pe)===this.id||i&&i.id===this.id||!i&&this.isDead}submitForm(e,i,s,n,r={}){c.putPrivate(e,Ne,!0),Array.from(e.elements).forEach(a=>c.putPrivate(a,Ne,!0)),this.liveSocket.blurActiveElement(),this.pushFormSubmit(e,i,s,n,r,()=>{this.liveSocket.restorePreviouslyActiveFocus()})}binding(e){return this.liveSocket.binding(e)}pushPortalElementId(e){this.portalElementIds.add(e)}dropPortalElementId(e){this.portalElementIds.delete(e)}destroyPortalElements(){this.liveSocket.unloaded||this.portalElementIds.forEach(e=>{let i=document.getElementById(e);i&&i.remove()})}};var Ai=class{constructor(t,e,i={}){if(this.unloaded=!1,!e||e.constructor.name==="Object")throw new Error(` 17 a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example: 18 19 import {Socket} from "phoenix" 20 import {LiveSocket} from "phoenix_live_view" 21 let liveSocket = new LiveSocket("/live", Socket, {...}) 22 `);this.socket=new e(t,i),this.bindingPrefix=i.bindingPrefix||as,this.params=De(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(et(ls),i.defaults||{}),this.prevActive=null,this.silenced=!1,this.main=null,this.outgoingMainEl=null,this.clickStartedAtTarget=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=et(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||ns,this.disconnectedTimeout=i.disconnectedTimeout||os,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||Ji,this.reloadJitterMin=i.reloadJitterMin||Xi,this.reloadJitterMax=i.reloadJitterMax||Wi,this.failsafeJitter=i.failsafeJitter||qi,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.boundEventNames=new Set,this.blockPhxChangeWhileComposing=i.blockPhxChangeWhileComposing||!1,this.serverCloseRef=null,this.domCallbacks=Object.assign({jsQuerySelectorAll:null,onPatchStart:De(),onPatchEnd:De(),onNodeAdded:De(),onBeforeElUpdated:De()},i.dom||{}),this.transitions=new qs,this.currentHistoryPosition=parseInt(this.sessionStorage.getItem(qe)||"0")||0,window.addEventListener("pagehide",s=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.2.6"}isProfileEnabled(){return this.sessionStorage.getItem(ft)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(We)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(We)==="false"}enableDebug(){this.sessionStorage.setItem(We,"true")}enableProfiling(){this.sessionStorage.setItem(ft,"true")}disableDebug(){this.sessionStorage.setItem(We,"false")}disableProfiling(){this.sessionStorage.removeItem(ft)}enableLatencySim(t){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(pt,t.toString())}disableLatencySim(){this.sessionStorage.removeItem(pt)}getLatencySim(){let t=this.sessionStorage.getItem(pt);return t?parseInt(t):null}getSocket(){return this.socket}connect(){window.location.hostname==="localhost"&&!this.isDebugDisabled()&&this.enableDebug();let t=()=>{this.resetReloadStatus(),this.joinRootViews()?(this.bindTopLevelEvents(),this.socket.connect()):this.main?this.socket.connect():this.bindTopLevelEvents({dead:!0}),this.joinDeadView()};["complete","loaded","interactive"].indexOf(document.readyState)>=0?t():document.addEventListener("DOMContentLoaded",()=>t())}disconnect(t){this.reloadWithJitterTimer!=null&&clearTimeout(this.reloadWithJitterTimer),this.serverCloseRef&&(this.socket.off([this.serverCloseRef]),this.serverCloseRef=null),this.socket.disconnect(t)}replaceTransport(t){this.reloadWithJitterTimer!=null&&clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(t),this.connect()}execJS(t,e,i=null){let s=new CustomEvent("phx:exec",{detail:{sourceElement:t}});this.owner(t,n=>E.exec(s,i,e,n,t))}js(){return yi(this,"js")}unload(){this.unloaded||(this.main&&this.isConnected()&&this.log(this.main,"socket",()=>["disconnect for page nav"]),this.unloaded=!0,this.destroyAllViews(),this.disconnect())}triggerDOM(t,e){this.domCallbacks[t](...e)}time(t,e){if(!this.isProfileEnabled()||!console.time)return e();console.time(t);let i=e();return console.timeEnd(t),i}log(t,e,i){if(this.viewLogger){let[s,n]=i();this.viewLogger(t,e,s,n)}else if(this.isDebugEnabled()){let[s,n]=i();fs(t,e,s,n)}}requestDOMUpdate(t){this.transitions.after(t)}asyncTransition(t){this.transitions.addAsyncTransition(t)}
22transition(t,e,i=function(){}){this.transitions.addTransition(t,e,i)}onChannel(t,e,i){t.on(e,s=>{let n=this.getLatencySim();n?setTimeout(()=>i(s),n):i(s)})}reloadWithJitter(t,e){this.reloadWithJitterTimer!=null&&clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,s=this.reloadJitterMax,n=Math.floor(Math.random()*(s-i+1))+i,r=U.updateLocal(this.localStorage,window.location.pathname,fi,0,o=>o+1);r>=this.maxReloads&&(n=this.failsafeJitter),this.reloadWithJitterTimer=setTimeout(()=>{t.isDestroyed()||t.isConnected()||(t.destroy(),e?e():this.log(t,"join",()=>[`encountered ${r} consecutive reloads`]),r>=this.maxReloads&&this.log(t,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),this.pendingLink!==null?window.location.href=this.pendingLink:window.location.reload())},n)}getHookDefinition(t){if(t)return this.maybeInternalHook(t)||this.hooks[t]||this.maybeRuntimeHook(t)}maybeInternalHook(t){return t&&t.startsWith("Phoenix.")&&Ts[t.split(".")[1]]}maybeRuntimeHook(t){let e=document.querySelector(`script[${Ze}="${CSS.escape(t)}"]`);if(!e)return;let i=window[`phx_hook_${t}`];if(!i||typeof i!="function"){_("a runtime hook must be a function",e);return}let s=i();if(s&&(typeof s=="object"||typeof s=="function"))return s;_("runtime hook must return an object with hook callbacks or an instance of ViewHook",e)}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(t){return`${this.getBindingPrefix()}${t}`}channel(t,e){return this.socket.channel(t,e)}joinDeadView(){let t=document.body;if(t&&!this.isPhxView(t)&&!this.isPhxView(document.firstElementChild)){let e=this.newRootView(t);e.setHref(this.getHref()),e.joinDead(),this.main||(this.main=e),window.requestAnimationFrame(()=>{e.execNewMounted(),this.maybeScroll(history.state?.scroll)})}}joinRootViews(){let t=!1;return c.all(document,`${$e}:not([${pe}])`,e=>{if(!this.getRootById(e.id)){let i=this.newRootView(e);c.isPhxSticky(e)||i.setHref(this.getHref()),i.join(),e.hasAttribute(Pt)&&(this.main=i)}t=!0}),t}redirect(t,e,i){i&&U.setCookie(Wt,i,60),this.unload(),U.redirect(t,e)}replaceMain(t,e,i=null,s=this.setPendingLink(t)){if(!this.main)return;let n=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let r=c.findPhxSticky(document)||[],o=c.all(this.outgoingMainEl,`[${this.binding("remove")}]`).filter(l=>!c.isChildOfAny(l,r)),a=c.cloneNode(this.outgoingMainEl,""),h=this.main;h.showLoader(this.loaderTimeout),h.destroy(),this.main=this.newRootView(a,e,n),this.main.setRedirect(t),this.transitionRemoves(o,h),this.main.join((l,p)=>{l===1&&this.commitPendingLink(s)&&this.requestDOMUpdate(()=>{o.forEach(m=>m.remove()),r.forEach(m=>a.appendChild(m)),this.outgoingMainEl.replaceWith(a),this.outgoingMainEl=null,i&&i(s),p()})})}transitionRemoves(t,e,i){let s=this.binding("remove"),n=r=>{r.preventDefault(),r.stopImmediatePropagation()};t.forEach(r=>{for(let a of this.boundEventNames)r.addEventListener(a,n,!0);let o=new CustomEvent("phx:exec",{detail:{sourceElement:r}});E.exec(o,"remove",r.getAttribute(s),e,r)}),this.requestDOMUpdate(()=>{t.forEach(r=>{for(let o of this.boundEventNames)r.removeEventListener(o,n,!0)}),i&&i()})}isPhxView(t){return t.getAttribute&&t.getAttribute(Q)!==null}
22newRootView(t,e,i){let s=new Ws(t,this,null,e,i);return this.roots[s.id]=s,s}owner(t,e){let i,s=c.closestViewEl(t);if(s)i=c.private(s,"view");else{if(!t.isConnected)return null;i=this.main}return i&&e?e(i):i}withinOwners(t,e){this.owner(t,i=>e(i,t))}getViewByEl(t){let e=t.getAttribute(te);return Ce(this.getRootById(e),i=>i.getDescendentByEl(t))}getRootById(t){return this.roots[t]}destroyAllViews(){for(let t in this.roots)this.roots[t].destroy(),delete this.roots[t];this.main=null}destroyViewByEl(t){let e=this.getRootById(t.getAttribute(te));e&&e.id===t.id?(e.destroy(),delete this.roots[e.id]):e&&e.destroyDescendent(t.id)}getActiveElement(){return document.activeElement}dropActiveElement(t){this.prevActive&&t.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive instanceof HTMLElement&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive instanceof HTMLElement&&this.prevActive.blur()}bindTopLevelEvents({dead:t}={}){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.serverCloseRef=this.socket.onClose(e=>{if(e&&e.code===1e3&&this.main)return 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),t||this.bindNav(),this.bindClicks(),t||this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(e,i,s,n,r,o)=>
22{let a=n.getAttribute(this.binding(is)),h=e.key&&e.key.toLowerCase();if(a&&a.toLowerCase()!==h)return;let l={key:e.key,...this.eventMeta(i,e,n)};E.exec(e,i,r,s,n,["push",{data:l}])}),this.bind({blur:"focusout",focus:"focusin"},(e,i,s,n,r,o)=>{if(!o){let a={...this.eventMeta(i,e,n)};E.exec(e,i,r,s,n,["push",{data:a}])}}),this.bind({blur:"blur",focus:"focus"},(e,i,s,n,r,o)=>{if(o==="window"){let a=this.eventMeta(i,e,n);E.exec(e,i,r,s,n,["push",{data:a}])}}),this.on("dragover",e=>e.preventDefault()),this.on("dragenter",e=>{let i=e.target&&c.elementFromTarget(e.target);if(!i)return;let s=ue(i,this.binding(Xe));!s||!(s instanceof HTMLElement)||gs(e)&&this.js().addClass(s,dt)}),this.on("dragleave",e=>{let i=e.target&&c.elementFromTarget(e.target);if(!i)return;let s=ue(i,this.binding(Xe));if(!s||!(s instanceof HTMLElement))return;let n=s.getBoundingClientRect();(e.clientX<=n.left||e.clientX>=n.right||e.clientY<=n.top||e.clientY>=n.bottom)&&this.js().removeClass(s,dt)}),this.on("drop",e=>{let i=e.target&&c.elementFromTarget(e.target);if(!i)return;e.preventDefault();let s=ue(i,this.binding(Xe));if(!s||!(s instanceof HTMLElement)||(this.js().removeClass(s,dt),!e.dataTransfer))return;let n=s.getAttribute(this.binding(Xe)),r=n&&document.getElementById(n),o=Array.from(e.dataTransfer.files||[]);!r||!(r instanceof HTMLInputElement)||r.disabled||o.length===0||!(r.files instanceof FileList)||(H.trackFiles(r,o,e.dataTransfer),r.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(mi,e=>{let i=e.target&&c.elementFromTarget(e.target);if(!c.isUploadInput(i))return;let s=Array.from(e.detail.files||[]).filter(n=>n instanceof File||n instanceof Blob);H.trackFiles(i,s),i.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(t,e,i){let s=this.metadataCallbacks[t];return s?s(e,i):{}}setPendingLink(t){return this.linkRef++,this.pendingLink=t,this.resetReloadStatus(),this.linkRef}resetReloadStatus(){U.deleteCookie(Wt)}commitPendingLink(t){return this.linkRef!==t?!1:(this.pendingLink!==null&&(this.href=this.pendingLink,this.pendingLink=null),!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(t,e){for(let i in t){let s=t[i];this.on(s,n=>{let r=this.binding(i),o=this.binding(`window-${i}`),a=n.target instanceof Element&&n.target.getAttribute(r);n.target instanceof Element&&(a?this.debounce(n.target,n,s,()=>{this.withinOwners(n.target,h=>{e(n,i,h,n.target,a,null)})}):c.all(document,`[${o}]`,h=>{let l=h.getAttribute(o);this.debounce(h,n,s,()=>{this.withinOwners(h,p=>{e(n,i,p,h,l,"window")})})}))})}}bindClicks(){this.on("mousedown",t=>this.clickStartedAtTarget=t.target),this.bindClick()}bindClick(){let t=this.binding("click");window.addEventListener("click",e=>{let i=e.target&&c.elementFromTarget(e.target);if(!i)return;e.detail===0&&(this.clickStartedAtTarget=i);let s=this.clickStartedAtTarget||i;if(i=ue(i,t),this.dispatchClickAway(e,s),this.clickStartedAtTarget=null,!i)return;let n=i.getAttribute(t);if(!n){c.isNewPageClick(e,window.location)&&this.unload();return}i.getAttribute("href")==="#"&&e.preventDefault(),!i.hasAttribute(X)&&this.debounce(i,e,"click",()=>{this.withinOwners(i,r=>{E.exec(e,"click",n,r,i,["push",{data:this.eventMeta("click",e,i)}])})})},!1)}dispatchClickAway(t,e){let i=this.binding("click-away"),s=e.closest(`[${he}]`),n=s&&c.byId(s.getAttribute(he));c.all(document,`[${i}]`,r=>{let o=e;s&&!s.contains(r)&&(o=n),r.isSameNode(o)||r.contains(o)||!E.isVisible(e)||this.withinOwners(r,a=>{let h=r.getAttribute(i);E.isVisible(r)&&E.isInViewport(r)&&E.exec(t,"click",h,a,r,["push",{data:this.eventMeta("click",t,t.target)}])})})}bindNav(){if(!U.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let t=null;window.addEventListener("scroll",e=>{t!=null&&clearTimeout(t),t=setTimeout(()=>{U.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",e=>{if(!this.registerNewLocation(window.location))return;let{type:i,backType:s,id:n,scroll:r,position:o}=e.state||{},a=window.location.href,h=o>this.currentHistoryPosition,l=h?i:s||i;this.currentHistoryPosition=o||0,this.sessionStorage.setItem(qe,this.currentHistoryPosition.toString()),c.dispatchEvent(window,"phx:navigate",{detail:{href:a,patch:l==="patch",pop:!0,direction:h?"forward":"backward"}}),this.requestDOMUpdate(()=>{let p=()=>{this.maybeScroll(r)};this.main&&this.main.isConnected()&&l==="patch"&&n===this.main.id?this.main.pushLinkPatch(e,a,null,p):this.replaceMain(a,null,p)})},!1),window.addEventListener("click",e=>{let i=e.target&&c.elementFromTarget(e.target);if(!i)return;let s=ue(i,ut),n=s&&s.getAttribute(ut);if(!n||!this.isConnected()||!this.main||c.wantsNewTab(e))return;let r=s.href instanceof SVGAnimatedString?s.href.baseVal:s.href,o=s.getAttribute(Nt);if(o!=="replace"&&o!=="push")throw new Error(`expected ${Nt} to be "replace" or "push", got: ${o}`);e.preventDefault(),e.stopImmediatePropagation(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if(n==="patch")this.pushHistoryPatch(e,r,o,s);else if(n==="redirect")this.historyRedirect(e,r,o,null,s);else throw new Error(`expected ${ut} to be "patch" or "redirect", got: ${n}`);let a=s.getAttribute(this.binding("click"));a&&this.requestDOMUpdate(()=>this.execJS(s,a,"click"))})},!1)}maybeScroll(t){typeof t=="number"&&requestAnimationFrame(()=>{window.scrollTo(0,t)})}dispatchEvent(t,e={}){c.dispatchEvent(window,`phx:${t}`,{detail:e})}dispatchEvents(t){t.forEach(([e,i])=>this.dispatchEvent(e,i))}withPageLoading(t,e){c.dispatchEvent(window,"phx:page-loading-start",{detail:t});let i=()=>c.dispatchEvent(window,"phx:page-loading-stop",{detail:t});return e?e(i):i}pushHistoryPatch(t,e,i,s){if(!this.isConnected()||!(this.main&&this.main.isMain()))return U.redirect(e);this.withPageLoading({to:e,kind:"patch"},n=>{this.main.pushLinkPatch(t,e,s,r=>{this.historyPatch(e,i,r),n()})})}historyPatch(t,e,i=this.setPendingLink(t)){this.commitPendingLink(i)&&(this.currentHistoryPosition++,this.sessionStorage.setItem(qe,this.currentHistoryPosition.toString()),U.updateCurrentState(s=>({...s,backType:"patch"})),U.pushState(e,{type:"patch",id:this.main.id,position:this.currentHistoryPosition},t),c.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:t,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location))}historyRedirect(t,e,i,s,n){let r=n&&t.isTrusted&&t.type!=="popstate";if(r&&n.classList.add("phx-click-loading"),!this.isConnected()||!(this.main&&this.main.isMain()))return U.redirect(e,s);if(/^\/$|^\/[^\/]+.*$/.test(e)){let{protocol:a,host:h}=window.location;e=`${a}//${h}${e}`}let o=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},a=>{this.replaceMain(e,s,h=>{h===this.linkRef&&(this.currentHistoryPosition++,this.sessionStorage.setItem(qe,this.currentHistoryPosition.toString()),U.updateCurrentState(l=>({...l,backType:"redirect"})),U.pushState(i,{type:"redirect",id:this.main.id,scroll:o,position:this.currentHistoryPosition},e),c.dispatchEvent(window,"phx:navigate",{detail:{href:e,patch:!1,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location)),r&&n.classList.remove("phx-click-loading"),a()})})}registerNewLocation(t){let{pathname:e,search:i}=this.currentLocation;return e+i===t.pathname+t.search?!1:(this.currentLocation=et(t),!0)}bindForms(){let t=0,e=!1;this.on("submit",i=>{if(!(i.target instanceof HTMLFormElement))return;let s=i.target.getAttribute(this.binding("submit")),n=i.target.getAttribute(this.binding("change"));!e&&n&&!s&&(e=!0,i.preventDefault(),this.withinOwners(i.target,r=>{r.disableForm(i.target),window.requestAnimationFrame(()=>{c.isUnloadableFormSubmit(i)&&this.unload(),i.target.submit()})}))}),this.on("submit",i=>{if(!(i.target instanceof HTMLFormElement))return;let s=i.target.getAttribute(this.binding("submit"));if(!s){c.isUnloadableFormSubmit(i)&&this.unload();return}i.preventDefault(),i.target.disabled=!0,this.withinOwners(i.target,n=>{E.exec(i,"submit",s,n,i.target,["push",{submitter:i.submitter}])})});for(let i of["change","input"])this.on(i,s=>
22{if(!c.isFormAssociated(s.target))return;if(s instanceof CustomEvent&&s.target.form===void 0){if(s.detail&&s.detail.dispatcher)throw new Error(`dispatching a custom ${i} event is only supported on input elements inside a form`);return}let n=s.target,r=this.binding("change");if(this.blockPhxChangeWhileComposing&&s instanceof InputEvent&&s.isComposing){let f=`composition-listener-${i}`;c.private(n,f)||(c.putPrivate(n,f,!0),n.addEventListener("compositionend",()=>{n.dispatchEvent(new Event(i,{bubbles:!0})),c.deletePrivate(n,f)},{once:!0}));return}let o=n.getAttribute(r),a=n.form&&n.form.getAttribute(r),h=o||a;if(!h||n.type==="number"&&n.validity&&n.validity.badInput)return;let l=o?n:n.form,p=t;t++;let{at:m,type:g}=c.private(n,"prev-iteration")||{};m===p-1&&i==="change"&&g==="input"||(c.putPrivate(n,"prev-iteration",{at:p,type:i}),this.debounce(n,s,i,()=>{this.withinOwners(l,f=>{c.putPrivate(n,tt,!0),E.exec(s,"change",h,f,n,["push",{_target:n.name,dispatcher:l}])})}))});this.on("reset",i=>{let s=i.target;c.resetForm(s);let n=Array.from(s.elements).find(r=>"type"in r&&r.type==="reset");n&&window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(t,e,i,s){if(i==="blur"||i==="focusout")return s();let n=this.binding(Zi),r=this.binding(es),o=this.defaults.debounce.toString(),a=this.defaults.throttle.toString();this.withinOwners(t,h=>{let l=()=>!h.isDestroyed()&&document.body.contains(t);c.debounce(t,e,n,o,r,a,l,()=>{s()})})}silenceEvents(t){this.silenced=!0,t(),this.silenced=!1}on(t,e){this.boundEventNames.add(t),window.addEventListener(t,i=>{this.silenced||e(i)})}jsQuerySelectorAll(t,e,i){let s=this.domCallbacks.jsQuerySelectorAll;return s?s(t,e,i):i()}},qs=class{constructor(){this.transitions=new Set,this.promises=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(t=>{clearTimeout(t),this.transitions.delete(t)}),this.promises.clear(),this.flushPendingOps()}after(t){this.size()===0?t():this.pushPendingOp(t)}addTransition(t,e,i){e();let s=setTimeout(()=>{this.transitions.delete(s),i(),this.flushPendingOps()},t);this.transitions.add(s)}addAsyncTransition(t){this.promises.add(t),t.then(()=>{this.promises.delete(t),this.flushPendingOps()})}pushPendingOp(t){this.pendingOps.push(t)}size(){return this.transitions.size+this.promises.size}flushPendingOps(){if(this.size()>0)return;let t=this.pendingOps.shift();t&&(t(),this.flushPendingOps())}};var Ei={};var rt=Hi(Ci()),zs=document.querySelector("meta[name='csrf-token']").getAttribute("content"),Ks={mounted(){this.el.addEventListener("click",()=>{navigator.clipboard.writeText(this.el.dataset.copyText)})}},Gs={mounted(){let t=this.el.previousElementSibling,e=this.el.nextElementSibling,i=this.el.parentElement,s=!1,n=0,r=0,o=l=>{if(!s)return;let p=l.touches?l.touches[0].clientX:l.clientX,m=240,g=i.getBoundingClientRect().width-240,f=Math.min(Math.max(r+(p-n),m),g);t.style.flex=`0 0 ${f}px`},a=()=>{s=!1,document.body.style.cursor="",document.body.style.userSelect="",e&&(e.style.pointerEvents=""),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a),document.removeEventListener("touchmove",o),document.removeEventListener("touchend",a)},h=l=>{s=!0,n=l.touches?l.touches[0].clientX:l.clientX,r=t.getBoundingClientRect().width,document.body.style.cursor="col-resize",document.body.style.userSelect="none",e&&(e.style.pointerEvents="none"),document.addEventListener("mousemove",o),document.addEventListener("mouseup",a),document.addEventListener("touchmove",o),document.addEventListener("touchend",a),l.preventDefault()};this.el.addEventListener("mousedown",h),this.el.addEventListener("touchstart",h)}},Ti=new Ai("/live",Mt,{longPollFallbackMs:2500,params:{_csrf_token:zs},hooks:{...Ei,Clipboard:Ks,SplitResize:Gs}});rt.default.config({barColors:{0:"#29d"},shadowColor:"rgba(0, 0, 0, .3)"});window.addEventListener("phx:page-loading-start",t=>rt.default.show(300));window.addEventListener("phx:page-loading-stop",t=>rt.default.hide());Ti.connect();window.liveSocket=Ti;})(); 23/** 24 * @license MIT 25 * topbar 3.0.0 26 * http://buunguyen.github.io/topbar 27 * Copyright (c) 2024 Buu Nguyen 28 */
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.