1(()=>{var Li=Object.create;var $t=Object.defineProperty;var Ii=Object.getOwnPropertyDescriptor;var Oi=Object.getOwnPropertyNames;var Di=Object.getPrototypeOf,Hi=Object.prototype.hasOwnProperty;var Mi=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Ni=(t,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Oi(e))!Hi.call(t,n)&&n!==i&&$t(t,n,{get:()=>e[n],enumerable:!(s=Ii(e,n))||s.enumerable});return t};var $i=(t,e,i)=>(i=t!=null?Li(Di(t)):{},Ni(e||!t||!t.__esModule?$t(i,"default",{value:t,enumerable:!0}):i,t));var Pi=Mi((_i,ot)=>{(function(t,e){"use strict";var i,s,n,r=null,o=null,a=null,l=function(u,d,g){u.addEventListener?u.addEventListener(d,g,!1):u.attachEvent?u.attachEvent("on"+d,g):u["on"+d]=g},h={autoRun:!0,barThickness:3,barColors:{0:"rgba(26, 188, 156, .9)",".25":"rgba(52, 152, 219, .9)",".50":"rgba(241, 196, 15, .9)",".75":"rgba(230, 126, 34, .9)","1.0":"rgba(211, 84, 0, .9)"},shadowBlur:10,shadowColor:"rgba(0, 0, 0, .6)",className:null},f=function(){i.width=t.innerWidth,i.height=h.barThickness*5;var u=i.getContext("2d");u.shadowBlur=h.shadowBlur,u.shadowColor=h.shadowColor;var d=u.createLinearGradient(0,0,i.width,0);for(var g in h.barColors)d.addColorStop(g,h.barColors[g]);u.lineWidth=h.barThickness,u.beginPath(),u.moveTo(0,h.barThickness/2),u.lineTo(Math.ceil(s*i.width),h.barThickness/2),u.strokeStyle=d,u.stroke()},m=function(){i=e.createElement("canvas");var u=i.style;u.position="fixed",u.top=u.left=u.right=u.margin=u.padding=0,u.zIndex=100001,u.display="none",h.className&&i.classList.add(h.className),l(t,"resize",f)},v={config:function(u){for(var d in u)h.hasOwnProperty(d)&&(h[d]=u[d])},show:function(u){if(!n)if(u){if(a)return;a=setTimeout(()=>v.show(),u)}else n=!0,o!==null&&t.cancelAnimationFrame(o),i||m(),i.parentElement||e.body.appendChild(i),i.style.opacity=1,i.style.display="block",v.progress(0),h.autoRun&&function d(){r=t.requestAnimationFrame(d),v.progress("+"+.05*Math.pow(1-Math.sqrt(s),2))}()},progress:function(u){return typeof u>"u"||(typeof u=="string"&&(u=(u.indexOf("+")>=0||u.indexOf("-")>=0?s:0)+parseFloat(u)),s=u>1?1:u,f()),s},hide:function(){clearTimeout(a),a=null,n&&(n=!1,r!=null&&(t.cancelAnimationFrame(r),r=null),function u(){if(v.progress("+.1")>=1&&(i.style.opacity-=.05,i.style.opacity<=.05)){i.style.display="none",o=null;return}o=t.requestAnimationFrame(u)}())}};typeof ot=="object"&&typeof ot.exports=="object"?ot.exports=v:typeof define=="function"&&define.amd?define(function(){return v}):this.topbar=v}).call(_i,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")),l=i("_csrf_token",n.getAttribute("data-csrf")),h=document.createElement("form"),f=document.createElement("input"),m=n.getAttribute("target");h.method=n.getAttribute("data-method")==="get"?"get":"post",h.action=o,h.style.display="none",m?h.target=m:r&&(h.target="_blank"),h.appendChild(l),h.appendChild(a),document.body.appendChild(h),f.type="submit",h.appendChild(f),f.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 xe=t=>typeof t=="function"?t:function(){return t},Ui=typeof self<"u"?self:null,ke=typeof window<"u"?window:null,z=Ui||ke||globalThis,Fi="2.0.0",K={connecting:0,open:1,closing:2,closed:3},ji=1e4,Bi=1e3,V={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},te={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},dt={longpoll:"longpoll",websocket:"websocket"},Vi={complete:4},ut="base64url.bearer.phx.",Ve=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.recHo
vendor: 5,605 bytes, line 1
1oks=[],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})}},Ut=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))}},Ji=class{constructor(t,e,i){this.state=V.closed,this.topic=t,this.params=xe(e||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Ve(this,te.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Ut(()=>{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=V.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=V.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=V.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=V.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 Ve(this,te.leave,xe({}),this.timeout).send(),this.state=V.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(te.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(te.close,t)}onError(t){return this.on(te.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 Ve(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=V.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(te.close,"leave")},i=new Ve(this,te.leave,xe({}),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=V.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===V.closed}isErrored(){return this.state===V.errored}isJoined(){return this.state===V.joined}isJoining(){return this.state===V.joining}isLeaving(){return this.state===V.leaving}},qe=class{static request(t,e,i,s,n,r,o){if(z.XDomainRequest){let a=new z.XDomainRequest;return this.xdomainRequest(a,t,e,s,n,r,o)}else if(z.XMLHttpRequest){let a=new z.XMLHttpRequest;return this.xhrRequest(a,t,e,i,s,n,r,o)}else{if(z.fetch&&z.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},l=null;
vendor: 2,751 bytes, line 1
1if(n){l=new AbortController;let h=setTimeout(()=>l.abort(),n);a.signal=l.signal}return z.fetch(e,a).then(h=>h.text()).then(h=>this.parseJSON(h)).then(h=>o&&o(h)).catch(h=>{h.name==="AbortError"&&r?r():o&&o(null)}),l}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[l,h]of Object.entries(s))t.setRequestHeader(l,h);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===Vi.complete&&a){let l=this.parseJSON(t.responseText);a(l)}},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)}`}},qi=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)},we=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(ut)&&(this.authToken=atob(e[1].slice(ut.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=K.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+dt.websocket),"$1/"+dt.longpoll)}endpointURL(){return qe.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,i){this.close(t,e,i),this.readyState=K.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===K.open||this.readyState===K.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=K.open,this.onopen({}),this.poll();break;
vendor: 5,047 bytes, lines 1-2
1case 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=qi(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){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(` 2`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,i){for(let n of this.reqs)n.abort();this.readyState=K.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=qe.request(t,this.endpointURL(),e,i,this.timeout,o,a=>{this.reqs.delete(r),this.isActive()&&n(a)}),this.reqs.add(r)}};var Je={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=this.META_LENGTH+e.length+i.length+n.length+s.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),h=0;l.setUint8(h++,this.KINDS.push),l.setUint8(h++,e.length),l.setUint8(h++,i.length),l.setUint8(h++,n.length),l.setUint8(h++,s.length),Array.from(e,m=>l.setUint8(h++,m.charCodeAt(0))),Array.from(i,m=>l.setUint8(h++,m.charCodeAt(0))),Array.from(n,m=>l.setUint8(h++,m.charCodeAt(0))),Array.from(s,m=>l.setUint8(h++,m.charCodeAt(0)));var f=new Uint8Array(a.byteLength+r.byteLength);return f.set(new Uint8Array(a),0),f.set(new Uint8Array(r),a.byteLength),f.buffer},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 l=i.decode(t.slice(o,o+n));o=o+n;let h=i.decode(t.slice(o,o+r));o=o+r;let f=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:l,event:h,payload:f}},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,l=i.decode(t.slice(a,a+s));a=a+s;let h=i.decode(t.slice(a,a+n));a=a+n;let f=i.decode(t.slice(a,a+r));a=a+r;let m=i.decode(t.slice(a,a+o));a=a+o;let v=t.slice(a,t.byteLength),u={status:m,response:v};return{join_ref:l,ref:h,topic:f,event:te.reply,payload:u}},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 l=t.slice(r,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},Ft=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||ji,this.transport=e.transport||z.WebSocket||we,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=e.sessionStorage||z&&z.sessionStorage,this.establishedConnections=0,this.defaultEncoder=Je.encode.bind(Je),this.defaultDecoder=Je.decode.bind(Je),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.transport!==we?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;ke&&ke.addEventListener&&(ke.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock)}),ke.addEventListener("pageshow",s=>{i===this.connectClock&&(i=null,this.connect())}),ke.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)=>
vendor: 5,656 bytes, line 2
2{console.log(`${s}: ${n}`,r)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=xe(e.params||{}),this.endPoint=`${t}/${dt.websocket}`,this.vsn=e.vsn||Fi,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Ut(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(()=>this.connect())},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return we}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=qe.appendParams(qe.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=xe(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==we?this.connectWithFallback(we,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 we:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${ut}${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=l=>{this.log("transport",`falling back to ${o}...`,l),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(l=>{this.log("transport","error",l),s&&!i&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!s){let l=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,e),this.ping(l=>{this.log("transport","connected to primary after",l),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(),Bi,"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===K.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",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(te.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case K.connecting:return"connecting";case K.open:return"open";case K.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 Ji(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 l=this.channels[a];l.isMember(i,s,n,o)&&l.trigger(s,n,r,o)}for(let a=0;a<this.stateChangeCallbacks.message.length;a++){let[,l]=this.stateChangeCallbacks.message[a];l(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 pi="consecutive-reloads",Xi=10,Wi=5e3,zi=1e4,Ki=3e4,mi=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading","phx-hook-loading"],ft="phx-drop-target-active",Q="data-phx-component",_e="data-phx-view",pt="data-phx-link",Gi="track-static",Yi="data-phx-link-state",Pe="data-phx-ref-loading",W="data-phx-ref-src",$="data-phx-ref-lock",jt="phx-pending-refs",gi="track-uploads",se="data-phx-upload-ref",Pt="data-phx-preflighted-refs",Qi="data-phx-done-refs",Xe="drop-target",wt="data-phx-active-refs",Ze="phx:live-file:updated",vi="data-phx-skip",bi="data-phx-id",Bt="data-phx-prune",Vt="phx-connected",ce="phx-loading",Ae="phx-error",Jt="phx-client-error",Re="phx-server-error",me="data-phx-parent-id",xt="data-phx-main",le="data-phx-root-id",kt="viewport-top",At="viewport-bottom",Zi="viewport-overrun-target",es="trigger-action",st="phx-has-focused",ts=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],yi=["checkbox","radio"],$e="phx-has-submitted",Z="data-phx-session",Ue=`[${Z}]`,Et="data-phx-sticky",pe="data-phx-static",St="data-phx-readonly",Ce="data-phx-disabled",qt="disable-with",nt="data-phx-disable-with-restore",Le="hook",is="debounce",ss="throttle",rt="update",et="stream",Ie="data-phx-stream",Rt="data-phx-portal",ge="data-phx-teleported",he="data-phx-teleported-src",tt="data-phx-runtime-hook",ns="data-phx-pid",rs="key",G="phxPrivate",Xt="auto-recover",We="phx:live-socket:debug",mt="phx:live-socket:profiling",gt="phx:live-socket:latency-sim",ze="phx:nav-history-position",os="progress",Wt="mounted",zt="__phoenix_reload_status__",as=1,Kt=3,ls=200,hs=500,cs="phx-",ds=3e4,Oe="debounce-trigger",De="throttled",Gt="debounce-prev-key",us={debounce:300,throttle:300},Yt=[Pe,W,$],X="s",vt="r",F="c",M="k",Y="kc",Qt="e",Zt="r",ei="t",oe="p",Ee="stream",fs=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,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",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 D("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))}},D=(t,e)=>console.error&&console.error(t,e),ie=t=>{let e=typeof t;return e==="number"||e==="string"&&/^(0|[1-9]\d*)$/.test(t)};function ps(){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 ms(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 gs=(t,e,i,s)=>{t.liveSocket.isDebugEnabled()&&console.log(`${t.id} ${e}: ${i} - `,s)},He=t=>typeof t=="function"?t:function(){return t},it=t=>JSON.parse(JSON.stringify(t)),fe=(t,e,i)=>{do{if(t.matches(`[${e}]`)&&!t.disabled)return t;t=t.parentElement||t.parentNode}while(t!==null&&t.nodeType===1&&!(i&&i.isSameNode(t)||t.matches(Ue)));return null},Se=t=>t!==null&&typeof t=="object"&&!(t instanceof Array),vs=(t,e)=>JSON.stringify(t)===JSON.stringify(e),ti=t=>{for(let e in t)return!1;return!0},Te=(t,e)=>t&&e(t),bs=function(t,e,i,s){t.forEach(n=>{new fs(n,i.config,s).upload()})},ys=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},ws={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 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,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}"]`)}},B=ws,ue={byId(t){return document.getElementById(t)||D(`no id found for ${t}`)},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(se)!==null},isAutoUpload(t){return t.hasAttribute("data-phx-auto-upload")},findUploadInputs(t){let e=t.id,i=this.all(document,`input[type="file"][${se}][form="${e}"]`);return this.all(t,`input[type="file"][${se}]`).concat(i)},findComponentNodeList(t,e,i=document){return this.all(i,`[${_e}="${t}"][${Q}="${e}"]`)},isPhxDestroyed(t){return!!(t.id&&ue.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)}catch{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(Z,""),this.putPrivate(t,"de
2stroyed",!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,`[${Et}]`)},findPhxChildren(t,e){return this.all(t,`${Ue}[${me}="${e}"]`)},findExistingParentCIDs(t,e){let i=new Set,s=new Set;return e.forEach(n=>{this.all(document,`[${_e}="${t}"][${Q}="${n}"]`).forEach(r=>{i.add(n),this.all(r,`[${_e}="${t}"][${Q}]`).map(o=>parseInt(o.getAttribute(Q))).forEach(o=>s.add(o))})}),s.forEach(n=>i.delete(n)),i},private(t,e){return t[G]&&t[G][e]},deletePrivate(t,e){t[G]&&delete t[G][e]},putPrivate(t,e,i){t[G]||(t[G]={}),t[G][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(W)&&(mi.forEach(i=>{t.classList.contains(i)&&e.classList.add(i)}),Yt.filter(i=>t.hasAttribute(i)).forEach(i=>{e.setAttribute(i,t.getAttribute(i))}))},copyPrivates(t,e){e[G]&&(t[G]=e[G])},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 l=t.getAttribute(i),h=t.getAttribute(n);l===""&&(l=s),h===""&&(h=r);let f=l||h;switch(f){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(f),v=()=>h?this.deletePrivate(t,De):a(),u=this.incCycle(t,Oe,v);if(isNaN(m))return D(`invalid throttle/debounce value: ${f}`);if(h){let g=!1;if(e.type==="keydown"){let y=this.private(t,Gt);this.putPrivate(t,Gt,e.key),g=y!==e.key}if(!g&&this.private(t,De))return!1;{a();let y=setTimeout(()=>{o()&&this.triggerCycle(t,Oe)},m);this.putPrivate(t,De,y)}}else setTimeout(()=>{o()&&this.triggerCycle(t,Oe,u)},m);let d=t.form;d&&this.once(d,"bind-debounce")&&d.addEventListener("submit",()=>{Array.from(new FormData(d).entries(),([g])=>{let y=d.elements.namedItem(g),C=y instanceof RadioNodeList?y[0]:y;C&&(this.incCycle(C,Oe),this.deletePrivate(C,De))})}),this.once(t,"bind-debounce")&&t.addEventListener("blur",()=>{clearTimeout(this.private(t,De)),this.triggerCycle(t,Oe)})}},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,st)||this.private(t,$e))},resetForm(t){Array.from(t.elements).forEach(e=>{this.deletePrivate(e,st),this.deletePrivate(e,$e)})},isPhxChild(t){return t.getAttribute&&t.getAttribute(me)},isPhxSticky(t){return t.getAttribute&&t.getAttribute(Et)!==null},isChildOfAny(t,e){return!!e.find(i=>i.contains(t))},firstPhxChild(t){return this.isPhxChild(t)?t:this.all(t,`[${me}]`)[0]},isPortalTemplate(t){return t.tagName==="TEMPLATE"&&t.hasAttribute(Rt)},closestViewEl(t){let e=t.closest(`[${ge}],${Ue}`);return e?e.hasAttribute(ge)?this.byId(e.getAttribute(ge)):e.hasAttribute(Z)?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 l=r[a].name;if(s.has(l)){if(l==="value"){let h=e.value??e.getAttribute(l);t.value===h&&t.setAttribute("value",e.getAttribute(l))}}else{let h=e.getAttribute(l);t.getAttribute(l)!==h&&(!n||n&&l.startsWith("data-"))&&t.setAttribute(l,h)}}let o=t.attributes;for(let a=o.length-1;a>=0;a--){let l=o[a].name;n?l.startsWith("data-")&&!e.hasAttribute(l)&&!Yt.includes(l)&&t.removeAttribute(l):e.hasAttribute(l)||t.removeAttribute(l)}},mergeFocusedInput(t,e){t instanceof HTMLSelectElement||ue.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(),!ue.isTextualInput(t))return;
5t.matches(":focus")||t.focus(),this.hasSelectionRange(t)&&t.setSelectionRange(e,i)},isFormInput(t){return t.localName&&customElements.get(t.localName)?customElements.get(t.localName).formAssociated:/^(?:input|select|textarea)$/i.test(t.tagName)&&t.type!=="button"},syncAttrsToProps(t){t instanceof HTMLInputElement&&yi.indexOf(t.type.toLocaleLowerCase())>=0&&(t.checked=t.getAttribute("checked")!==null)},isTextualInput(t){return ts.indexOf(t.type)>=0},isNowTriggerFormExternal(t,e){return t.getAttribute&&t.getAttribute(e)!==null&&document.body.contains(t)},cleanChildNodes(t,e){if(ue.isPhxUpdate(t,e,["append","prepend",et])){let i=[];t.childNodes.forEach(s=>{s.id||(!(s.nodeType===Node.TEXT_NODE&&s.nodeValue.trim()==="")&&s.nodeType!==Node.COMMENT_NODE&&D(`only HTML element tags with an id are allowed inside containers with phx-update. 6 7removing illegal node: "${(s.outerHTML||s.nodeValue).trim()}" 8 9`),i.push(s))}),i.forEach(s=>s.remove())}},replaceRootContainer(t,e,i){let s=new Set(["id",Z,pe,xt,le]);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);
9return Object.keys(i).forEach(r=>n.setAttribute(r,i[r])),s.forEach(r=>n.setAttribute(r,t.getAttribute(r))),n.innerHTML=t.innerHTML,t.replaceWith(n),n}},getSticky(t,e,i){let s=(ue.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=ue.private(t,"sticky");e&&e.forEach(([i,s,n])=>this.putSticky(t,i,s))},isLocked(t){return t.hasAttribute&&t.hasAttribute($)},attributeIgnored(t,e){return e.some(i=>t.name==i||i==="*"||i.includes("*")&&t.name.match(i)!=null)}},c=ue,Me=class{static isActive(t,e){let i=e._phxRef===void 0,n=t.getAttribute(wt).split(",").indexOf(U.genFileRef(e))>=0;return e.size>0&&(i||n)}static isPreflighted(t,e){return t.getAttribute(Pt).split(",").indexOf(U.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=U.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(Ze,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,()=>{U.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(Ze,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:t}),this.isAutoUpload()||U.clearFiles(this.fileEl)}isAutoUpload(){return this.autoUpload}onDone(t){this._onDone=()=>{this.fileEl.removeEventListener(Ze,this._onElUpdated),t()}}onElUpdated(){this.fileEl.getAttribute(wt).split(",").indexOf(this.ref)===-1&&(U.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]||D(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:e}}else return{name:"channel",callback:bs}}zipPostFlight(t){this.meta=t.entries[this.ref],this.meta||D(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:t})}},ks=0,U=class Ct{static genFileRef(e){let i=e._phxRef;return i!==void 0?i:(e._phxRef=(ks++).toString(),e._phxRef)}static getEntryDataURL(e,i,s){let n=this.activeFiles(e).find(r=>this.genFileRef(r)===i);s(URL.createObjectURL(n))}static hasUploadsInProgress(e){let i=0;return c.findUploadInputs(e).forEach(s=>{s.getAttribute(Pt)!==s.getAttribute(Qi)&&i++}),i>0}static serializeUploads(e){let i=this.activeFiles(e),s={};return i.forEach(n=>{let r={path:e.name},o=e.getAttribute(se);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(se),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=null}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=>Me.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=>!Me.isPreflighted(e,i)&&!Me.isPreflightInProgress(i))}static markPreflightInProgress(e){e.forEach(i=>Me.markPreflightInProgress(i.file))}constructor(e,i,s){this.autoUpload=c.isAutoUpload(e),this.view=i,this.onComplete=s,this._entries=Array.from(Ct.filesAwaitingPreflight(e)||[]).map(n=>new Me(e,n,i,this.autoUpload)),Ct.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:l}=o.uploader(s.uploaders);return r[a]=r[a]||{callback:l,entries:[]},r[a].entries.push(o),r},{});for(let r in n){let{callback:o,entries:a}=n[r];o(a,i,e,s)}}},As={anyOf(t,e){return e.find(i=>t instanceof i)},isFocusable(t,e){return t instanceof HTMLAnchorElement&&t.rel!=="ignore"||t instanceof HTMLAreaElement&&t.href!==void 0||!t.disabled&&this.anyOf(t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||t instanceof HTMLIFrameElement||t.tabIndex>=0&&t.getAttribute("aria-hidden")!=="true"||!e&&t.getAttribute("tabindex")!==null&&t.getAttribute("aria-hidden")!=="true"},attemptFocus(t,e){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}},focusFirst(t){let e=t.firstElementChild;for(;e;){if(this.attemptFocus(e)||this.focusFirst(e))return!0;e=e.nextElementSibling}},focusLast(t){let e=t.lastElementChild;for(;e;){if(this.attemptFocus(e)||this.focusLast(e))return!0;e=e.previousElementSibling}}},J=As,wi={LiveFileUpload:{activeRefs(){return this.el.getAttribute(wt)},preflightedRefs(){return this.el.getAttribute(Pt)},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=null),this.el.dispatchEvent(new CustomEvent(Ze))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(se)),U.getEntryDataURL(this.inputEl,this.ref,t=>{this.url=t,this.el.src=t})},destroyed(){URL.revokeObjectURL(this.url)}},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;J.attemptFocus(e)||J.focusFirst(e)}else J.focusLast(this.el)}),this.focusEnd.addEventListener("focus",t=>{if(!t.relatedTarget||!this.el.contains(t.relatedTarget)){let e=t.target.previousElementSibling;J.attemptFocus(e)||J.focusLast(e)}else J.focusFirst(this.el)}),this.el.contains(document.activeElement)||(this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&J.focusFirst(this.el))}}},ki=t=>["HTML","BODY"].indexOf(t.nodeName.toUpperCase())>=0?null:["scroll","auto"].indexOf(getComputedStyle(t).overflowY)>=0?t:ki(t.parentElement),ii=t=>t?t.scrollTop:document.documentElement.scrollTop||document.body.scrollTop,Lt=t=>t?t.getBoundingClientRect().bottom:window.innerHeight||document.documentElement.clientHeight,It=t=>t?t.getBoundingClientRect().top:0,Es=(t,e)=>{let i=t.getBoundingClientRect();return Math.ceil(i.top)>=It(e)&&Math.ceil(i.left)>=0&&Math.floor(i.top)<=Lt(e)},Ss=(t,e)=>{let i=t.getBoundingClientRect();return Math.ceil(i.bottom)>=It(e)&&Math.ceil(i.left)>=0&&Math.floor(i.bottom)<=Lt(e)},si=(t,e)=>{let i=t.getBoundingClientRect();return Math.ceil(i.top)>=It(e)&&Math.ceil(i.left)>=0&&Math.floor(i.top)<=Lt(e)};wi.InfiniteScroll={mounted(){this.scrollContainer=ki(this.el);let t=ii(this.scrollContainer),e=!1,i=500,s=null,n=this.throttle(i,(a,l)=>{s=()=>!0,this.liveSocket.js().push(this.el,a,{value:{id:l.id,_overran:!0},callback:()=>{s=null}})}),r=this.throttle(i,(a,l)=>{s=()=>l.scrollIntoView({block:"start"}),this.liveSocket.js().push(this.el,a,{value:{id:l.id},callback:()=>{s=null,window.requestAnimationFrame(()=>{si(l,this.scrollContainer)||l.scrollIntoView({block:"start"})})}})}),o=this.throttle(i,(a,l)=>{s=()=>l.scrollIntoView({block:"end"}),this.liveSocket.js().push(this.el,a,{value:{id:l.id},callback:()=>{s=null,window.requestAnimationFrame(()=>{si(l,this.scrollContainer)||l.scrollIntoView({block:"end"})})}})});this.onScroll=a=>{let l=ii(this.scrollContainer);if(s)return t=l,s();let h=this.findOverrunTarget(),f=this.el.getAttribute(this.liveSocket.b
9inding("viewport-top")),m=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),v=this.el.lastElementChild,u=this.el.firstElementChild,d=l<t,g=l>t;d&&f&&!e&&h.top>=0?(e=!0,n(f,u)):g&&e&&h.top<=0&&(e=!1),f&&d&&Es(u,this.scrollContainer)?r(f,u):m&&g&&Ss(v,this.scrollContainer)&&o(m,v),t=l},this.scrollContainer?this.scrollContainer.addEventListener("scroll",this.onScroll):window.addEventListener("scroll",this.onScroll)},destroyed(){this.scrollContainer?this.scrollContainer.removeEventListener("scroll",this.onScroll):window.removeEventListener("scroll",this.onScroll)},throttle(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.binding(Zi));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}};var Cs=wi,Tt=class{static onUnlock(t,e){if(!c.isLocked(t)&&!t.closest(`[${$}]`))return e();let i=t.closest(`[${$}]`),s=i.closest(`[${$}]`).getAttribute($);i.addEventListener(`phx:undo-lock:${s}`,()=>{e()},{once:!0})}constructor(t){this.el=t,this.loadingRef=t.hasAttribute(Pe)?parseInt(t.getAttribute(Pe),10):null,this.lockRef=t.hasAttribute($)?parseInt(t.getAttribute($),10):null}maybeUndo(t,e,i){if(!this.isWithin(t)){c.updatePrivate(this.el,jt,[],s=>(s.push(t),s));return}this.undoLocks(t,e,i),this.undoLoading(t,e),c.updatePrivate(this.el,jt,[],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(W)}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,$);s&&(i(s),c.deletePrivate(this.el,$)),this.el.removeAttribute($);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(Pe);let i=this.el.getAttribute(Ce),s=this.el.getAttribute(St);s!==null&&(this.el.readOnly=s==="true",this.el.removeAttribute(St)),i!==null&&(this.el.disabled=i==="true",this.el.removeAttribute(Ce));let n=this.el.getAttribute(nt);n!==null&&(this.el.textContent=n,this.el.removeAttribute(nt));let r={detail:{ref:t,event:e},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${this.loadingRef}`,r))}mi.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}},Ts=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);t&&(this.elementsToModify.forEach(e=>{e.previousElementId?Te(document.getElementById(e.previousElementId),i=>{Te(document.getElementById(e.elementId),s=>{s.previousElementSibling&&s.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",s)})}):Te(document.getElementById(e.elementId),i=>{i.previousElementSibling==null||t.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEac
vendor: 4,894 bytes, line 9
9h(e=>{Te(document.getElementById(e),i=>t.insertAdjacentElement("afterbegin",i))}))}},ni=11;function _s(t,e){var i=e.attributes,s,n,r,o,a;if(!(e.nodeType===ni||t.nodeType===ni)){for(var l=i.length-1;l>=0;l--)s=i[l],n=s.name,r=s.namespaceURI,o=s.value,r?(n=s.localName||n,a=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 h=t.attributes,f=h.length-1;f>=0;f--)s=h[f],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 Ke,Ps="http://www.w3.org/1999/xhtml",j=typeof document>"u"?void 0:document,xs=!!j&&"content"in j.createElement("template"),Rs=!!j&&j.createRange&&"createContextualFragment"in j.createRange();function Ls(t){var e=j.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}function Is(t){Ke||(Ke=j.createRange(),Ke.selectNode(j.body));var e=Ke.createContextualFragment(t);return e.childNodes[0]}function Os(t){var e=j.createElement("body");return e.innerHTML=t,e.childNodes[0]}function Ds(t){return t=t.trim(),xs?Ls(t):Rs?Is(t):Os(t)}function Ge(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 Hs(t,e){return!e||e===Ps?j.createElement(t):j.createElementNS(e,t)}function Ms(t,e){for(var i=t.firstChild;i;){var s=i.nextSibling;e.appendChild(i),i=s}return e}function bt(t,e,i){t[i]!==e[i]&&(t[i]=e[i],t[i]?t.setAttribute(i,""):t.removeAttribute(i))}var ri={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)}bt(t,e,"selected")},INPUT:function(t,e){bt(t,e,"checked"),bt(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}}},Ne=1,oi=11,ai=3,li=8;function ae(){}function Ns(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function $s(t){return function(i,s,n){if(n||(n={}),typeof s=="string")if(i.nodeName==="#document"||i.nodeName==="HTML"){var r=s;s=j.createElement("html"),s.innerHTML=r}else if(i.nodeName==="BODY"){var o=s;s=j.createElement("html"),s.innerHTML=o;var a=s.querySelector("body");a&&(s=a)}else s=Ds(s);else s.nodeType===oi&&(s=s.firstElementChild);var l=n.getNodeKey||Ns,h=n.onBeforeNodeAdded||ae,f=n.onNodeAdded||ae,m=n.onBeforeElUpdated||ae,v=n.onElUpdated||ae,u=n.onBeforeNodeDiscarded||ae,d=n.onNodeDiscarded||ae,g=n.onBeforeElChildrenUpdated||ae,y=n.skipFromChildren||ae,C=n.addChild||function(E,S){return E.appendChild(S)},x=n.childrenOnly===!0,w=Object.create(null),A=[];function k(E){A.push(E)}function P(E,S){if(E.nodeType===Ne)for(var N=E.firstChild;N;){var T=void 0;S&&(T=l(N))?k(T):(d(N),N.firstChild&&P(N,S)),N=N.nextSibling}}function p(E,S,N){u(E)!==!1&&(S&&S.removeChild(E),d(E),P(E,N))}function b(E){if(E.nodeType===Ne||E.nodeType===oi)for(var S=E.firstChild;S;){var N=l(S);N&&(w[N]=S),b(S),S=S.nextSibling}}b(i);function H(E){f(E);for(var S=E.firstChild;S;){var N=S.nextSibling,T=l(S);if(T){var R=w[T];R&&Ge(S,R)?(S.parentNode.replaceChild(R,S),I(R,S)):H(S)}else H(S);S=N}}function q(E,S,N){for(;S;){var T=S.nextSibling;(N=l(S))?k(N):p(S,E,!0),S=T}}function I(E,S,N){var T=l(S);if(T&&delete w[T],!N){var R=m(E,S);if(R===!1||(R instanceof HTMLElement&&(E=R,b(E)),t(E,S),v(E),g(E,S)===!1))return}E.nodeName!=="TEXTAREA"?ve(E,S):ri.TEXTAREA(E,S)}function ve(E,S){var N=y(E,S),T=S.firstChild,R=E.firstChild,be,ee,ye,je,ne;e:for(;T;){for(je=T.nextSibling,be=l(T);!N&&R;){if(ye=R.nextSibling,T.isSameNode&&T.isSameNode(R)){T=je,R=ye;continue e}ee=l(R);var Be=R.nodeType,re=void 0;if(Be===T.nodeType&&(Be===Ne?(be?be!==ee&&((ne=w[be])?ye===ne?re=!1:(E.insertBefore(ne,R),ee?k(ee):p(R,E,!0),R=ne,ee=l(R)):re=!1):ee&&(re=!1),re=re!==!1&&Ge(R,T),re&&I(R,T)):(Be===ai||Be==li)&&(re=!0,R.nodeValue!==T.nodeValue&&(R.nodeValue=T.nodeValue))),re){T=je,R=ye;continue e}ee?k(ee):p(R,E,!0),R=ye}if(be&&(ne=w[be])&&Ge(ne,T))N||C(E,ne),I(ne,T);else{var ct=h(T);ct!==!1&&(ct&&(T=ct),T.actualize&&(T=T.actualize(E.ownerDocument||j)),C(E,T),H(T))}T=je,R=ye}q(E,R,ee);var Nt=ri[E.nodeName];Nt&&Nt(E,S)}var O=i,Fe=O.nodeType,Mt=s.nodeType;
9if(!x){if(Fe===Ne)Mt===Ne?Ge(i,s)||(d(i),O=Ms(i,Hs(s.nodeName,s.namespaceURI))):O=s;else if(Fe===ai||Fe===li){if(Mt===Fe)return O.nodeValue!==s.nodeValue&&(O.nodeValue=s.nodeValue),O;O=s}}if(O===s)d(i);else{if(s.isSameNode&&s.isSameNode(O))return;if(I(O,s,x),A)for(var lt=0,Ri=A.length;lt<Ri;lt++){var ht=w[A[lt]];ht&&p(ht,ht.parentNode,!1)}}return!x&&O!==i&&i.parentNode&&(O.actualize&&(O=O.actualize(i.ownerDocument||j)),i.parentNode.replaceChild(O,i)),O}}var Us=$s(_s),_t=Us,Ye=class{constructor(t,e,i,s,n,r,o={}){this.view=t,this.liveSocket=t.liveSocket,this.container=e,this.id=i,this.rootID=t.root.id,this.html=s,this.streams=n,this.streamInserts={},this.streamComponentRestore={},this.targetCID=r,this.cidPatch=ie(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.targetContainer=this.isCIDPatch()?this.targetCIDContainer(s):e,this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]},this.withChildren=o.withChildren||o.undoRef||!1,this.undoRef=o.undoRef}before(t,e){this.callbacks[`before${t}`].push(e)}after(t,e){this.callbacks[`after${t}`].push(e)}trackBefore(t,...e){this.callbacks[`before${t}`].forEach(i=>i(...e))}trackAfter(t,...e){this.callbacks[`after${t}`].forEach(i=>i(...e))}markPrunableContentForRemoval(){let t=this.liveSocket.binding(rt);c.all(this.container,`[${t}=append] > *, [${t}=prepend] > *`,e=>{e.setAttribute(Bt,"")})}perform(t){let{view:e,liveSocket:i,html:s,container:n}=this,r=this.targetContainer;if(this.isCIDPatch()&&!this.targetContainer)return;if(this.isCIDPatch()){let w=r.closest(`[${$}]`);if(w&&!w.isSameNode(r)){let A=c.private(w,$);
9A&&(r=A.querySelector(`[data-phx-component="${this.targetCID}"]`))}}let o=i.getActiveElement(),{selectionStart:a,selectionEnd:l}=o&&c.hasSelectionRange(o)?o:{},h=i.binding(rt),f=i.binding(kt),m=i.binding(At),v=i.binding(es),u=[],d=[],g=[],y=[],C=null,x=(w,A,k=this.withChildren)=>{let P={childrenOnly:w.getAttribute(Q)===null&&!k,getNodeKey:p=>c.isPhxDestroyed(p)?null:t?p.id:p.id||p.getAttribute&&p.getAttribute(bi),skipFromChildren:p=>p.getAttribute(h)===et,addChild:(p,b)=>{let{ref:H,streamAt:q}=this.getStreamInsert(b);if(H===void 0)return p.appendChild(b);if(this.setStreamRef(b,H),q===0)p.insertAdjacentElement("afterbegin",b);else if(q===-1){let I=p.lastElementChild;if(I&&!I.hasAttribute(Ie)){let ve=Array.from(p.children).find(O=>!O.hasAttribute(Ie));p.insertBefore(b,ve)}else p.appendChild(b)}else if(q>0){let I=Array.from(p.children)[q];p.insertBefore(b,I)}},onBeforeNodeAdded:p=>{if(this.getStreamInsert(p)?.updateOnly&&!this.streamComponentRestore[p.id])return!1;c.maintainPrivateHooks(p,p,f,m),this.trackBefore("added",p);let b=p;return this.streamComponentRestore[p.id]&&(b=this.streamComponentRestore[p.id],delete this.streamComponentRestore[p.id],x(b,p,!0)),b},onNodeAdded:p=>{p.getAttribute&&this.maybeReOrderStream(p,!0),c.isPortalTemplate(p)&&y.push(()=>this.teleport(p,x)),p instanceof HTMLImageElement&&p.srcset?p.srcset=p.srcset:p instanceof HTMLVideoElement&&p.autoplay&&p.play(),c.isNowTriggerFormExternal(p,v)&&(C=p),(c.isPhxChild(p)&&e.ownsElement(p)||c.isPhxSticky(p)&&e.ownsElement(p.parentNode))&&this.trackAfter("phxChildAdded",p),p.nodeName==="SCRIPT"&&p.hasAttribute(tt)&&this.handleRuntimeHook(p,A),u.push(p)},onNodeDiscarded:p=>this.onNodeDiscarded(p),onBeforeNodeDiscarded:p=>{if(p.getAttribute&&p.getAttribute(Bt)!==null)return!0;if(p.parentElement!==null&&p.id&&c.isPhxUpdate(p.parentElement,h,[et,"append","prepend"])||p.getAttribute&&p.getAttribute(ge)||this.maybePendingRemove(p)||this.skipCIDSibling(p))return!1;if(c.isPortalTemplate(p)){let b=document.getElementById(p.content.firstElementChild.id);b&&(b.remove(),P.onNodeDiscarded(b),this.view.dropPortalElementId(b.id))}return!0},onElUpdated:p=>{c.isNowTriggerFormExternal(p,v)&&(C=p),d.push(p),this.maybeReOrderStream(p,!1)},onBeforeElUpdated:(p,b)=>{if(p.id&&p.isSameNode(w)&&p.id!==b.id)return P.onNodeDiscarded(p),p.replaceWith(b),P.onNodeAdded(b);if(c.syncPendingAttrs(p,b),c.maintainPrivateHooks(p,b,f,m),c.cleanChildNodes(b,h),this.skipCIDSibling(b))return this.maybeReOrderStream(p),!1;if(c.isPhxSticky(p))return[Z,pe,le].map(I=>[I,p.getAttribute(I),b.getAttribute(I)]).forEach(([I,ve,O])=>{O&&ve!==O&&p.setAttribute(I,O)}),!1;if(c.isIgnored(p,h)||p.form&&p.form.isSameNode(C))return this.trackBefore("updated",p,b),c.mergeAttrs(p,b,{isIgnored:c.isIgnored(p,h)}),d.push(p),c.applyStickyOperations(p),!1;if(p.type==="number"&&p.validity&&p.validity.badInput)return!1;let H=o&&p.isSameNode(o)&&c.isFormInput(p),q=H&&this.isChangedSelect(p,b);if(p.hasAttribute(W)){let I=new Tt(p);if(I.lockRef&&(!this.undoRef||!I.isLockUndoneBy(this.undoRef))){c.applyStickyOperations(p);let O=p.hasAttribute($)?c.private(p,$)||p.cloneNode(!0):null;O&&(c.putPrivate(p,$,O),H||(p=O))}}if(c.isPhxChild(b)){let I=p.getAttribute(Z);return c.mergeAttrs(p,b,{exclude:[pe]}),I!==""&&p.setAttribute(Z,I),p.setAttribute(le,this.rootID),c.applyStickyOperations(p),!1}return this.undoRef&&c.private(b,$)&&c.putPrivate(p,$,c.private(b,$)),c.copyPrivates(b,p),c.isPortalTemplate(b)?(y.push(()=>this.teleport(b,x)),p.content.replaceChildren(b.content.cloneNode(!0)),!1):H&&p.type!=="hidden"&&!q?(this.trackBefore("updated",p,b),c.mergeFocusedInput(p,b),c.syncAttrsToProps(p),d.push(p),c.applyStickyOperations(p),!1):(q&&p.blur(),c.isPhxUpdate(b,h,["append","prepend"])&&g.push(new Ts(p,b,b.getAttribute(h))),c.syncAttrsToProps(b),c.applyStickyOperations(b),this.trackBefore("updated",p,b),p)}};_t(w,A,P)};if(this.trackBefore("added",n),this.trackBefore("updated",n,n),i.time("morphdom",()=>{this.streams.forEach(([A,k,P,p])=>{k.forEach(([b,H,q,I])=>{this.streamInserts[b]={ref:A,streamAt:H,limit:q,reset:p,updateOnly:I}}),p!==void 0&&c.all(document,`[${Ie}="${A}"]`,b=>{this.removeStreamChildElement(b)}),P.forEach(b=>{let H=document.getElementById(b);H&&this.removeStreamChildElement(H)})}),t&&c.all(this.container,`[${h}=${et}]`).filter(A=>
9this.view.ownsElement(A)).forEach(A=>{Array.from(A.children).forEach(k=>{this.removeStreamChildElement(k,!0)})}),x(r,s);let w=0;for(;y.length>0&&w<5;){let A=y.slice();y=[],A.forEach(k=>k()),w++}this.view.portalElementIds.forEach(A=>{let k=document.getElementById(A);k&&(document.getElementById(k.getAttribute(he))||(k.remove(),this.onNodeDiscarded(k),this.view.dropPortalElementId(A)))})}),i.isDebugEnabled()&&(ps(),ms(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)})),g.length>0&&i.time("post-morph append/prepend restoration",()=>{g.forEach(w=>w.perform())}),i.silenceEvents(()=>c.restoreFocus(o,a,l)),c.dispatchEvent(document,"phx:update"),u.forEach(w=>this.trackAfter("added",w)),d.forEach(w=>this.trackAfter("updated",w)),this.transitionPendingRemoves(),C){i.unload();let w=c.private(C,"submitter");if(w&&w.name&&r.contains(w)){let A=document.createElement("input");A.type="hidden";let k=w.getAttribute("form");k&&A.setAttribute("form",k),A.name=w.name,A.value=w.value,w.parentElement.insertBefore(A,w)}Object.getPrototypeOf(C).submit.call(C)}return!0}onNodeDiscarded(t){(c.isPhxChild(t)||c.isPhxSticky(t))&&this.liveSocket.destroyViewByEl(t),this.trackAfter("discarded",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,Ie,i=>i.setAttribute(Ie,e))}maybeReOrderStream(t,e){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)t.parentElement.insertBefore(t,t.parentElement.firstElementChild);else if(s>0){let r=Array.from(t.parentElement.children),o=r.indexOf(t);if(s>=r.length-1)t.parentElement.appendChild(t);else{let a=r[s];o>s?t.parentElement.insertBefore(t,a):t.parentElement.insertBefore(t,a.nextElementSibling)}}this.maybeLimitStream(t)}}maybeLimitStream(t){let{limit:e}=this.getStreamInsert(t),i=e!==null&&Array.from(t.parentElement.children);e&&e<0&&i.length>e*-1?i.slice(0,i.length+e).forEach(s=>this.removeStreamChildElement(s)):e&&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,()=>{t.forEach(i=>{let s=c.firstPhxChild(i);s&&e.destroyViewByEl(s),i.remove()}),this.trackAfter("transitionsDiscarded",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))}isCIDPatch(){return this.cidPatch}skipCIDSibling(t){return t.nodeType===Node.ELEMENT_NODE&&t.hasAttribute(vi)}targetCIDContainer(t){if(!this.isCIDPatch())return;let[e,...i]=c.findComponentNodeList(this.view.id,this.targetCID);return i.length===0&&c.childNodeLength(t)===1?e:e&&e.parentNode}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(ge,this.view.id),n.setAttribute(he,t.id),e(o,n,!0),n.removeAttribute(ge),n.removeAttribute(he),this.view.pushPortalElementId(n.id)}handleRuntimeHook(t,e){let i=t.getAttribute(tt),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[${tt}="${CSS.escape(i)}"]`).getAttribute("nonce")}let n=document.createElement("script");n.textContent=t.textContent,c.mergeAttrs(n,t,{isIgnored:!1}),s&&(n.nonce=s),t.replaceWith(n),t=n}},Fs=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),js=new Set(["'",'"']),hi=(t,e,i)=>{let s=0,n=!1,r,o,a,l,h,f,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],l=s,s;s<t.length&&t.charAt(s)!==">";s++)if(t.charAt(s)==="="){let d=t.slice(s-3,s)===" id";s++;let g=t.charAt(s);if(js.has(g)){let y=s;for(s++,s;s<t.length&&t.charAt(s)!==g;s++);if(d){h=t.slice(y+1,s);break}}}let v=t.length-1;for(n=!1;v>=r.length+a.length;){let d=t.charAt(v);if(n)d==="-"&&t.slice(v-3,v)==="<!-"?(n=!1,v-=4):v-=1;else if(d===">"&&t.slice(v-2,v)==="--")n=!0,v-=3;else{if(d===">")break;v-=1}}o=t.slice(v+1,t.length);let u=Object.keys(e).map(d=>e[d]===!0?d:`${d}="${e[d]}"`).join(" ");if(i){let d=h?` id="${h}"`:"";Fs.has(a)?f=`<${a}${d}${u===""?"":" "}${u}/>`:f=`<${a}${d}${u===""?"":" "}${u}></${a}>`}else{let d=t.slice(l,v+1);f=`<${a}${u===""?"":" "}${u}${d}`}return[f,r,o]},ci=class{static extract(t){let{[Zt]:e,[Qt]:i,[ei]:s}=t;return delete t[Zt],delete t[Qt],delete t[ei],{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[F],t,!0,{});return{buffer:e,streams:i}}recursiveToString(t,e=t[F],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[F]||{}).map(e=>parseInt(e))}isComponentOnlyDiff(t){return t[F]?Object.keys(t).length===1:!1}getComponent(t,e){return t[F][e]}resetRender(t){this.rendered[F][t]&&(this.rendered[F][t].reset=!0)}mergeDiff(t){let e=t[F],i={};if(delete t[F],this.rendered=this.mutableMerge(this.rendered,t),this.rendered[F]=this.rendered[F]||{},e){let s=this.rendered[F];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[F]=e}}cachedFindComponent(t,e,i,s,n){if(n[t])return n[t];{let r,o,a=e[X];if(ie(a)){let l;a>0?l=this.cachedFindComponent(a,s[a],i,s,n):l=i[-a],o=l[X],r=this.cloneMerge(l,e,!0),r[X]=o}else r=e[X]!==void 0||i[t]===void 0?e:this.cloneMerge(i[t],e,!1);return n[t]=r,r}}mutableMerge(t,e){return e[X]!==void 0?e:(this.doMutableMerge(t,e),t)}
10doMutableMerge(t,e){if(e[M])this.mergeKeyed(t,e);else for(let i in e){let s=e[i],n=t[i];Se(s)&&s[X]===void 0&&Se(n)?this.doMutableMerge(n,s):t[i]=s}t[vt]&&(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[M]).forEach(([s,n])=>{if(s!==Y)if(Array.isArray(n)){let[r,o]=n;t[M][s]=i[M][r],this.doMutableMerge(t[M][s],o)}else if(typeof n=="number"){let r=n;t[M][s]=i[M][r]}else typeof n=="object"&&(t[M][s]||(t[M][s]={}),this.doMutableMerge(t[M][s],n))}),e[M][Y]<t[M][Y])for(let s=e[M][Y];s<t[M][Y];s++)delete t[M][s];t[M][Y]=e[M][Y],e[Ee]&&(t[Ee]=e[Ee]),e[oe]&&(t[oe]=e[oe])}cloneMerge(t,e,i){let s;if(e[M])s=this.clone(t),this.mergeKeyed(s,e);else{s={...t,...e};for(let n in s){let r=e[n],o=t[n];Se(r)&&r[X]===void 0&&Se(o)?s[n]=this.cloneMerge(o,r,i):r===void 0&&Se(o)&&(s[n]=this.cloneMerge(o,{},i))}}return i?(delete s.magicId,delete s.newRender):t[vt]&&(s.newRender=!0),s}componentToString(t){let{buffer:e,streams:i}=this.recursiveCIDToString(this.rendered[F],t,null),[s,n,r]=hi(e,{});return{buffer:s,streams:i}}pruneCIDs(t){t.forEach(e=>delete this.rendered[F][e])}get(){return this.rendered}isNewFingerprint(t={}){return!!t[X]}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[M])return this.comprehensionToBuffer(t,e,i,s);t[oe]&&(e=t[oe],delete t[oe]);let{[X]:r}=t;r=this.templateStatic(r,e),t[X]=r;let o=t[vt],a=i.buffer;o&&(i.buffer=""),s&&o&&!t.magicId&&(t.newRender=!0,t.magicId=this.nextMagicID()),i.buffer+=r[0];for(let l=1;l<r.length;l++)this.dynamicToBuffer(t[l-1],e,i,s),i.buffer+=r[l];if(o){let l=!1,h;s||t.magicId?(l=s&&!t.newRender,h={[bi]:t.magicId,...n}):h=n,l&&(h[vi]=!0);let[f,m,v]=hi(i.buffer,h,l);t.newRender=!1,i.buffer=a+m+f+v}}comprehensionToBuffer(t,e,i,s){let n=e||t[oe],r=this.templateStatic(t[X],e);t[X]=r,delete t[oe];for(let o=0;o<t[M][Y];o++){i.buffer+=r[0];for(let a=1;a<r.length;a++)this.dynamicToBuffer(t[M][o][a-1],n,i,s),i.buffer+=r[a]}if(t[Ee]){let o=t[Ee],[a,l,h,f]=o||[null,{},[],null];o!==void 0&&(t[M][Y]>0||h.length>0||f)&&(delete t[Ee],t[M]={[Y]: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 Se(t)?this.toOutputBuffer(t,e,i,s,{}):i.buffer+=t}recursiveCIDToString(t,e,i){let s=t[e]||D(`no component for CID ${e}`,t),n={[Q]:e,[_e]:this.viewId},r=i&&!i.has(e);s.newRender=!r,s.magicId=`c${e}-${this.parentViewId()}`;let o=!s.reset,{buffer:a,streams:l}=this.recursiveToString(s,t,i,o,n);return delete s.reset,{buffer:a,streams:l}}},di=[],ui=200,Bs={exec(t,e,i,s,n,r){let[o,a]=r||[null,{callback:r&&r.callback}];(i.charAt(0)==="["?JSON.parse(i):[[o,a]]).forEach(([h,f])=>{h===o&&(f={...a,...f},f.callback=f.callback||a.callback),this.filterToEls(s.liveSocket,n,f).forEach(m=>{this[`exec_${h}`](t,e,i,s,n,m,f)})})},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 l=r.getAttribute(o);if(!l)throw new Error(`expected ${o} to contain JS command on "${a}"`);s.liveSocket.execJS(r,l,e)},exec_dispatch(t,e,i,s,n,r,{event:o,detail:a,bubbles:l,blocking:h}){if(a=a||{},a.dispatcher=n,h){let f=new Promise((m,v)=>{a.done=m});s.liveSocket.asyncTransition(f)}c.dispatchEvent(r,o,{detail:a,bubbles:l})},exec_push(t,e,i,s,n,r,o){let{event:a,data:l,target:h,page_loading:f,loading:m,value:v,dispatcher:u,callback:d}=o,g={loading:m,value:v,target:h,page_loading:!!f,originalEvent:t},y=e==="change"&&u?u:n,C=h||y.getAttribute(s.binding("target"))||y,x=(w,A)=>{if(w.isConnected())if(e==="change"){let{newCid:k,_target:P}=o;P=P||(c.isFormInput(n)?n.name:void 0),P&&(g._target=P),w.pushInput(n,A,k,a||i,g,d)}else if(e==="submit"){let{submitter:k}=o;w.submitForm(n,A,a||i,k,g,d)}else w.pushEvent(e,n,A,a||i,l,g,d)};o.targetView&&o.targetCtx?x(o.targetView,o.targetCtx):s.withinTargets(C,x)},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){J.attemptFocus(r),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>J.attemptFocus(r))})},exec_focus_first(t,e,i,s,n,r){J.focusFirstInteractive(r)||J.focusFirst(r),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>
10J.focusFirstInteractive(r)||J.focusFirst(r))})},exec_push_focus(t,e,i,s,n,r){di.push(r||n)},exec_pop_focus(t,e,i,s,n,r){let o=di.pop();o&&(o.focus(),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>o.focus())}))},exec_add_class(t,e,i,s,n,r,{names:o,transition:a,time:l,blocking:h}){this.addOrRemoveClasses(r,o,[],a,l,s,h)},exec_remove_class(t,e,i,s,n,r,{names:o,transition:a,time:l,blocking:h}){this.addOrRemoveClasses(r,[],o,a,l,s,h)},exec_toggle_class(t,e,i,s,n,r,{names:o,transition:a,time:l,blocking:h}){this.toggleClasses(r,o,a,l,s,h)},exec_toggle_attr(t,e,i,s,n,r,{attr:[o,a,l]}){this.toggleAttr(r,o,a,l)},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:l}){this.addOrRemoveClasses(r,[],[],a,o,s,l)},exec_toggle(t,e,i,s,n,r,{display:o,ins:a,outs:l,time:h,blocking:f}){this.toggle(e,s,r,o,a,l,h,f)},exec_show(t,e,i,s,n,r,{display:o,transition:a,time:l,blocking:h}){this.show(e,s,r,o,a,l,h)},exec_hide(t,e,i,s,n,r,{display:o,transition:a,time:l,blocking:h}){this.hide(e,s,r,o,a,l,h)},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||ui;let[l,h,f]=n||[[],[],[]],[m,v,u]=r||[[],[],[]];if(l.length>0||m.length>0)if(this.isVisible(i)){let d=()=>{this.addOrRemoveClasses(i,v,l.concat(h).concat(f)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,m,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,u,v))})},g=()=>{this.addOrRemoveClasses(i,[],m.concat(u)),c.putSticky(i,"toggle",y=>y.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))};i.dispatchEvent(new Event("phx:hide-start")),a===!1?(d(),setTimeout(g,o)):e.transition(o,d,g)}else{if(t==="remove")return;let d=()=>{this.addOrRemoveClasses(i,h,m.concat(v).concat(u));let y=s||this.defaultDisplay(i);window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,l,[]),window.requestAnimationFrame(()=>{c.putSticky(i,"toggle",C=>C.style.display=y),this.addOrRemoveClasses(i,f,h)})})},g=()=>{this.addOrRemoveClasses(i,[],l.concat(f)),i.dispatchEvent(new Event("phx:show-end"))};i.dispatchEvent(new Event("phx:show-start")),a===!1?(d(),setTimeout(g,o)):e.transition(o,d,g)}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",g=>g.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",[[],[]]),l=e.filter(f=>o.indexOf(f)<0&&!t.classList.contains(f)),h=e.filter(f=>a.indexOf(f)<0&&t.classList.contains(f));this.addOrRemoveClasses(t,l,h,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||ui;let[a,l,h]=s||[[],[],[]];if(a.length>0){let f=()=>{this.addOrRemoveClasses(t,l,[].concat(a).concat(h)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(t,h,l))})},m=()=>this.addOrRemoveClasses(t,e.concat(h),i.concat(a).concat(l));o===!1?(f(),setTimeout(m,n)):r.transition(n,f,m);return}window.requestAnimationFrame(()=>{let[f,m]=c.getSticky(t,"classes",[[],[]]),v=e.filter(y=>f.indexOf(y)<0&&!t.classList.contains(y)),u=i.filter(y=>m.indexOf(y)<0&&t.classList.contains(y)),d=f.filter(y=>i.indexOf(y)<0).concat(v),g=m.filter(y=>e.indexOf(y)<0).concat(u);c.putSticky(t,"classes",y=>(y.classList.remove(...g),y.classList.add(...d),[d,g]))})},setOrRemoveAttrs(t,e,i){let[s,n]=c.getSticky(t,"attrs",[[],[]]),r=e.map(([l,h])=>l).concat(i),o=s.filter(([l,h])=>!r.includes(l)).concat(e),a=n.filter(l=>!r.includes(l)).concat(i);c.putSticky(t,"attrs",l=>
10(a.forEach(h=>l.removeAttribute(h)),o.forEach(([h,f])=>l.setAttribute(h,f)),[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]}},_=Bs,Ai=(t,e)=>({exec(i,s){t.execJS(i,s,e)},show(i,s={}){let n=t.owner(i);_.show(e,n,i,s.display,_.transitionClasses(s.transition),s.time,s.blocking)},hide(i,s={}){let n=t.owner(i);_.hide(e,n,i,null,_.transitionClasses(s.transition),s.time,s.blocking)},toggle(i,s={}){let n=t.owner(i),r=_.transitionClasses(s.in),o=_.transitionClasses(s.out);_.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);_.addOrRemoveClasses(i,r,[],_.transitionClasses(n.transition),n.time,o,n.blocking)},removeClass(i,s,n={}){let r=Array.isArray(s)?s:s.split(" "),o=t.owner(i);_.addOrRemoveClasses(i,[],r,_.transitionClasses(n.transition),n.time,o,n.blocking)},toggleClass(i,s,n={}){let r=Array.isArray(s)?s:s.split(" "),o=t.owner(i);_.toggleClasses(i,r,_.transitionClasses(n.transition),n.time,o,n.blocking)},transition(i,s,n={}){let r=t.owner(i);_.addOrRemoveClasses(i,[],[],_.transitionClasses(s),n.time,r,n.blocking)},setAttribute(i,s,n){_.setOrRemoveAttrs(i,[[s,n]],[])},removeAttribute(i,s){_.setOrRemoveAttrs(i,[],[s])},toggleAttribute(i,s,n,r){_.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}});_.exec(a,e,s,r,i,["push",{data:o,...n}])})},navigate(i,s={}){let n=new CustomEvent("phx:exec");t.historyRedirect(n,i,s.replace?"replace":"push",null,null)},patch(i,s={}){let n=new CustomEvent("phx:exec");t.pushHistoryPatch(n,i,s.replace?"replace":"push",null)},ignoreAttributes(i,s){_.ignoreAttrs(i,Array.isArray(s)?s:[s])}}),yt="hookId",fi="deadHook",Vs=1,de=class Ei{get liveSocket(){return this.__liveSocket()}static makeID(){return Vs++}static elementID(e){return c.private(e,yt)}static deadHook(e){return c.private(e,fi)===!0}constructor(e,i,s){if(this.el=i,this.__attachView(e),this.__listeners=new Set,this.__isDisconnected=!1,c.putPrivate(this.el,yt,Ei.makeID()),e&&e.isDead&&c.putPrivate(this.el,fi,!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,yt)}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected()}js(){return{...Ai(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,l)=>{r.push({view:a,targetCtx:l})});let o=r.map(({view:a,targetCtx:l})=>a.pushHookEvent(this.el,l,i,s||{}));return Promise.allSettled(o)}this.__view().withinTargets(e,(r,o)=>{r.pushHookEvent(this.el,o,i,s||{}).then(({reply:a,ref:l})=>n(a,l)).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))}},Js=(t,e)=>{let i=t.endsWith("[]"),s=i?t.slice(0,-2):t;return s=s.replace(/([^\[\]]+)(\]?$)/,`${e}$1$2`),i&&(s+="[]"),s},Qe=(t,e,i=[])=>{let{submitter:s}=e,n;if(s&&s.name){let f=document.createElement("input");f.type="hidden";let m=s.getAttribute("form");m&&f.setAttribute("form",m),f.name=s.name,f.value=s.value,s.parentElement.insertBefore(f,s),n=f}let r=new FormData(t),o=[];r.forEach((f,m,v)=>{f instanceof File&&o.push(m)}),o.forEach(f=>r.delete(f));let a=new URLSearchParams,{inputsUnused:l,onlyHiddenInputs:h}=Array.from(t.elements).reduce((f,m)=>{let{inputsUnused:v,onlyHiddenInputs:u}=f,d=m.name;if(!d)return f;v[d]===void 0&&(v[d]=!0),u[d]===void 0&&(u[d]=!0);let g=c.private(m,st)||c.private(m,$e),y=m.type==="hidden";return v[d]=v[d]&&!g,u[d]=u[d]&&y,f},{inputsUnused:{},onlyHiddenInputs:{}});for(let[f,m]of r.entries())if(i.length===0||i.indexOf(f)>=0){let v=l[f],u=h[f];v&&!(s&&s.name==f)&&!u&&a.append(Js(f,"_unused_"),""),typeof m=="string"&&a.append(f,m)}return s&&n&&s.parentElement.removeChild(n),a.toString()},qs=class Si{static closestView(e){let i=e.closest(Ue);return i?c.private(i,"view"):null}constructor(e,i,s,n,r){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 D(`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.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,sticky:this.el.hasAttribute(Et)}}),this.portalElementIds=new Set}setHref(e){this.href=e}setRedirect(e){this.redirect=!0,this.href=e}isMain(){return this.el.hasAttribute(xt)}connectParams(e){let i=this.liveSocket.params(this.el),s=c.all(document,`[${this.binding(Gi)}]`).map(n=>n.src||n.href).filter(n=>typeof n=="string");return s.length>0&&(i._track_static=s),i._mounts=this.joinCount,i._mount_attempts=this.joinAttempts,i._live_referer=e,this.joinAttempts++,i}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(Z)}getStatic(){let e=this.el.getAttribute(pe);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],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(Vt,ce,Ae,Jt,Re),this.el.classList.add(...e)}showLoader(e){if(clearTimeout(this.loaderTimer),e)this.loaderTimer=setTimeout(()=>this.showLoader(),e);else{for(let i in this.viewHooks)this.viewHooks[i].__disconnected();this.setContainerClasses(ce)}}execAll(e){c.all(this.el,`[${e}]`,i=>this.liveSocket.execJS(i,i.getAttribute(e)))}hideLoader(){clearTimeout(this.loaderTimer),clearTimeout(this.disconnectedTimer),this.setContainerClasses(Vt),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(ie(e))c.findComponentNodeList(this.id,e,s).length===0?D(`no component found matching phx-target of ${e}`):i(this,parseInt(e));else{let n=Array.from(s.querySelectorAll(e));n.length===0&&D(`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,()=>["",it(i)]);let{diff:n,reply:r,events:o,title:a}=ci.extract(i),l=o.reduce((f,m)=>(m.length===3&&m[2]==!0?f.pre.push(m.slice(0,-1)):f.post.push(m),f),{pre:[],post:[]});this.liveSocket.dispatchEvents(l.pre);let h=()=>{s({diff:n,reply:r,events:l.post}),(typeof a=="string"||e=="mount"&&this.isMain())&&window.requestAnimationFrame(()=>c.putTitle(a))};"onDocumentPatch"in this.liveSocket.domCallbacks?this.liveSocket.triggerDOM("onDocumentPatch",[h]):h()}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)}this.childJoins=0,this.joinPending=!0,this.flash=null,this.root===this&&(this.formsForRecovery=this.getFormsForRecovery()),this.isMain()&&window.history.state===null&&B.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(ns,r),B.dropLocal(this.liveSocket.localStorage,window.location.pathname,pi),this.applyDiff("mount",i,({diff:o,events:a})=>{this.rendered=new ci(this.id,o);let[l,h]=this.renderContainer(null,"join");this.dropPendingRefs(),this.joinCount++,this.joinAttempts=0,this.maybeRecoverForms(l,()=>{this.onJoinComplete(e,l,h,a)})})}dropPendingRefs(){c.all(document,`[${W}="${this.refSrc()}"]`,e=>{e.removeAttribute(Pe),e.removeAttribute(W),e.removeAttribute($)})}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}"]`),l=a&&a.getAttribute(pe);return l&&o.setAttribute(pe,l),a&&a.setAttribute(le,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(){this.el=c.byId(this.id),this.el.setAttribute(le,this.root.id)}execNewMounted(e=document){let i=this.binding(kt),s=this.binding(At);this.all(e,`[${i}], [${s}]`,n=>{c.maintainPrivateHooks(n,n,i,s),this.maybeAddNewHook(n)}),this.all(e,`[${this.binding(Le)}], [data-phx-${Le}]`,n=>{this.maybeAddNewHook(n)}),this.all(e,`[${this.binding(Wt)}]`,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 Ye(this,this.el,this.id,i,s,null);if(r.markPrunableContentForRemoval(),this.performPatch(r,!1,!0),this.joinNewChildren(),this.execNewMounted(),this.joinPending=!1,this.liveSocket.dispatchEvents(n),this.applyPendingUpdates(),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(rt));if(s&&!e.isEqualNode(i)&&!(n&&vs(e.dataset,i.dataset)))return s.__beforeUpdate(),s}maybeMounted(e){let i=e.getAttribute(this.binding(Wt)),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.after("added",a=>{this.liveSocket.triggerDOM("onNodeAdded",[a]);let l=this.binding(kt),h=this.binding(At);c.maintainPrivateHooks(a,a,l,h),this.maybeAddNewHook(a),a.getAttribute&&this.maybeMounted(a)}),e.after("phxChildAdded",a=>{c.isPhxSticky(a)?this.liveSocket.joinRootViews():r=!0}),e.before("updated",(a,l)=>{this.triggerBeforeUpdateHook(a,l)&&o.add(a.id),_.onBeforeElUpdated(a,l)}),e.after("updated",a=>{o.has(a.id)&&this.getHook(a).__updated()}),e.after("discarded",a=>{a.nodeType===Node.ELEMENT_NODE&&n.push(a)}),e.after("transitionsDiscarded",a=>
16this.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,`[${_e}="${this.id}"][${Q}]`),o=c.all(n,`[${this.binding(Le)}], [data-phx-hook]`);r.concat(n).forEach(a=>{let l=this.componentID(a);ie(l)&&s.indexOf(l)===-1&&a.getAttribute(_e)===this.id&&s.push(l)}),o.concat(n).forEach(a=>{let l=this.getHook(a);l&&this.destroyHook(l)})}),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");r.innerHTML=e,c.all(r.content,`[${Rt}]`).forEach(l=>{r.content.firstElementChild.appendChild(l.content.firstElementChild)});let o=r.content.firstElementChild;o.id=this.id,o.setAttribute(le,this.root.id),o.setAttribute(Z,this.getSession()),o.setAttribute(pe,this.getStatic()),o.setAttribute(me,this.parent?this.parent.id:null);let a=c.all(r.content,"form").filter(l=>l.id&&n[l.id]).filter(l=>!this.pendingForms.has(l.id)).filter(l=>n[l.id].getAttribute(s)===l.getAttribute(s)).map(l=>[n[l.id],l]);if(a.length===0)return i();a.forEach(([l,h],f)=>{this.pendingForms.add(h.id),this.pushFormRecovery(l,h,r.content.firstElementChild,()=>{this.pendingForms.delete(h.id),f===a.length-1&&i()})})}getChildById(e){return this.root.children[this.id][e]}
16getDescendentByEl(e){return e.id===this.id?this:this.children[e.getAttribute(me)]?.[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 Si(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)})}):ti(e)||this.liveSocket.time("full patch complete",()=>{let[r,o]=this.renderContainer(e,"update"),a=new Ye(this,this.el,this.id,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(ti(e))return!1;let{buffer:s,streams:n}=this.rendered.componentToString(i),r=new Ye(this,this.el,this.id,s,n,i);return this.performPatch(r,!0)}getHook(e){return this.viewHooks[de.elementID(e)]}addHook(e){let i=de.elementID(e);if(!(e.getAttribute&&!this.ownsElement(e)))if(i&&!this.viewHooks[i]){if(de.deadHook(e))return;let s=c.getCustomElHook(e)||D(`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-${Le}`)||e.getAttribute(this.binding(Le));if(!s)return;let n=this.liveSocket.getHookDefinition(s);if(n){if(!e.id){D(`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 de)r=new n(this,e);else if(typeof n=="object"&&n!==null)r=new de(this,e,n);else{D(`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);D(`Failed to create hook "${s}": ${a}`,e);return}return this.viewHooks[de.elementID(r.el)]=r,r}
16else s!==null&&D(`unknown hook found for "${s}"`,e)}}}destroyHook(e){let i=de.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,s)}isDestroyed(){return this.destroyed}joinDead(){this.isDead=!0}joinPush(){return this.joinPush=this.joinPush||this.channel.join(),this.joinPush}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.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([ce,Ae,Re],{unstructuredError:e,errorKind:"server"}),this.liveSocket.isConnected()&&this.liveSocket.reloadWithJitter(this);else{this.joinAttempts>=Kt&&(this.root.displayError([ce,Ae,Re],{unstructuredError:e,errorKind:"server"}),this.log("error",()=>[`giving up trying to mount after ${Kt} tries`,e]),this.destroy());let i=c.byId(this.el.id);i?(c.mergeAttrs(i,this.el),this.displayError([ce,Ae,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(ls)}}onError(e){this.onClose(e),this.liveSocket.isConnected()&&this.log("error",()=>["view crashed",e]),this.liveSocket.isUnloaded()||(this.liveSocket.isConnected()?this.displayError([ce,Ae,Re],{unstructuredError:e,errorKind:"server"}):this.displayError([ce,Ae,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,l=function(){};return o.page_loading&&(l=this.liveSocket.withPageLoading({kind:"element",target:r})),typeof s.cid!="number"&&delete s.cid,new Promise((h,f)=>{this.wrapPush(()=>this.channel.push(i,s,ds),{ok:m=>{n!==null&&(this.lastAckRef=n);let v=u=>{m.redirect&&this.onRedirect(m.redirect),m.live_patch&&this.onLivePatch(m.live_patch),m.live_redirect&&this.onLiveRedirect(m.live_redirect),l(),h({resp:m,reply:u,ref:n})};m.diff?this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",m.diff,({diff:u,reply:d,events:g})=>{n!==null&&this.undoRefs(n,s.event),this.update(u,g),v(d)})}):(n!==null&&this.undoRefs(n,s.event),v(null))},error:m=>f(new Error(`failed with reason: ${JSON.stringify(m)}`)),timeout:()=>{f(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=`[${W}="${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 Tt(e).maybeUndo(i,s,r=>{let o=new Ye(this,e,this.id,r,[],null,{undoRef:i}),a=this.performPatch(o,!0);c.all(e,`[${W}="${this.refSrc()}"]`,l=>this.undoElRef(l,i,s)),a&&this.joinNewChildren()})}refSrc(){return this.el.id}putRef(e,i,s,n={}){let r=this.ref++,o=this.binding(qt);if(n.loading){let a=c.all(document,n.loading).map(l=>({el:l,lock:!0,loading:!0}));e=e.concat(a)}for(let{el:a,lock:l,loading:h}of e){if(!l&&!h)throw new Error("putRef requires lock or loading");if(a.setAttribute(W,this.refSrc()),h&&a.setAttribute(Pe,r),l&&a.setAttribute($,r),!h||n.submitter&&!(a===n.submitter||a===n.form))continue;let f=new Promise(d=>{a.addEventListener(`phx:undo-lock:${r}`,()=>d(u),{once:!0})}),m=new Promise(d=>{a.addEventListener(`phx:undo-loading:${r}`,()=>d(u),{once:!0})});a.classList.add(`phx-${s}-loading`);let v=a.getAttribute(o);v!==null&&(a.getAttribute(nt)||a.setAttribute(nt,a.textContent),v!==""&&(a.textContent=v),a.setAttribute(Ce,a.getAttribute(Ce)||a.disabled),a.setAttribute("disabled",""));let u={event:i,eventType:s,ref:r,isLoading:h,isLocked:l,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:f,loadingComplete:m,lock:d=>new Promise(g=>{if(this.isAcked(r))return g(u);d.setAttribute($,r),d.setAttribute(W,this.refSrc()),d.addEventListener(`phx:lock-stop:${r}`,()=>g(u),{once:!0})})};n.payload&&(u.payload=n.payload),n.target&&(u.target=n.target),n.originalEvent&&(u.originalEvent=n.originalEvent),a.dispatchEvent(new CustomEvent("phx:push",{detail:u,bubbles:!0,cancelable:!1})),i&&a.dispatchEvent(new CustomEvent(`phx:push:${i}`,{detail:u,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(Q);return i?parseInt(i):null}targetComponentID(e,i,s={}){if(ie(i))return i;let n=s.target||e.getAttribute(this.binding("target"));return ie(n)?parseInt(n):i&&(n!==null||s.target)?this.closestComponentID(i):null}closestComponentID(e){return ie(e)?e:e?Te(e.closest(`[${Q}],[${he}]`),i=>{if(i.hasAttribute(Q))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:l})=>({reply:a,ref:l}))}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"&&yi.indexOf(e.type)>=0&&!e.checked&&delete i.value),s){i||(i={});for(let r in s)i[r]=s[r]}return i}pushEvent(e,i,s,n,r,o={},a){this.pushWithReply(l=>this.putRef([{el:i,loading:!0,lock:!0}],n,e,{...o,payload:l?.payload}),"event",{type:e,event:n,value:this.extractMeta(i,r,o.value),cid:this.targetComponentID(i,s,o)}).then(({reply:l})=>a&&a(l)).catch(l=>D("Failed to push event",l))}pushFileProgress(e,i,s,n=function(){}){this.liveSocket.withinOwners(e.form,(r,o)=>{r.pushWithReply(null,"progress",{event:e.getAttribute(r.binding(os)),ref:e.getAttribute(se),entry_ref:i,progress:s,cid:r.targetComponentID(e.form,o)}).then(()=>n()).catch(a=>D("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,l=ie(s)?s:this.targetComponentID(e.form,i,r),h=d=>this.putRef([{el:e,loading:!0,lock:!0},{el:e.form,loading:!0,lock:!0}],n,"change",{...r,payload:d?.payload}),f,m=this.extractMeta(e.form,{},r.value),v={};e instanceof HTMLButtonElement&&(v.submitter=e),e.getAttribute(this.binding("change"))?f=Qe(e.form,v,[e.name]):f=Qe(e.form,v),c.isUploadInput(e)&&e.files&&e.files.length>0&&U.trackFiles(e,Array.from(e.files)),a=U.serializeUploads(e);let u={type:"form",event:n,value:f,meta:{_target:r._target||"undefined",...m},uploads:a,cid:l};this.pushWithReply(h,"event",u).then(({resp:d})=>{c.isUploadInput(e)&&c.isAutoUpload(e)?Tt.onUnlock(e,()=>{if(U.filesAwaitingPreflight(e).length>0){let[g,y]=h();this.undoRefs(g,n,[e.form]),this.uploadFiles(e.form,n,i,g,l,C=>{o&&o(d),this.triggerAwaitingSubmit(e.form,n),this.undoRefs(g,n)})}}):o&&o(d)}).catch(d=>D("Failed to push input event",d))}triggerAwaitingSubmit(e,i){let s=this.getScheduledSubmit(e);
16if(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=>!(fe(d,`${this.binding(rt)}=ignore`,d.form)||fe(d,"data-phx-update=ignore",d.form)),r=d=>d.hasAttribute(this.binding(qt)),o=d=>d.tagName=="BUTTON",a=d=>["INPUT","TEXTAREA","SELECT"].includes(d.tagName),l=Array.from(e.elements),h=l.filter(r),f=l.filter(o).filter(n),m=l.filter(a).filter(n);f.forEach(d=>{d.setAttribute(Ce,d.disabled),d.disabled=!0}),m.forEach(d=>{d.setAttribute(St,d.readOnly),d.readOnly=!0,d.files&&(d.setAttribute(Ce,d.disabled),d.disabled=!0)});let v=h.concat(f).concat(m).map(d=>({el:d,loading:!0,lock:!0})),u=[{el:e,loading:!0,lock:!1}].concat(v).reverse();return this.putRef(u,i,"submit",s)}pushFormSubmit(e,i,s,n,r,o){let a=h=>this.disableForm(e,s,{...r,form:e,payload:h?.payload,submitter:n});c.putPrivate(e,"submitter",n);let l=this.targetComponentID(e,i);if(U.hasUploadsInProgress(e)){let[h,f]=a(),m=()=>this.pushFormSubmit(e,i,s,n,r,o);return this.scheduleSubmit(e,h,r,m)}else if(U.inputsAwaitingPreflight(e).length>0){let[h,f]=a(),m=()=>[h,f,r];this.uploadFiles(e,s,i,h,l,v=>{if(U.inputsAwaitingPreflight(e).length>0)return this.undoRefs(h,s);let u=this.extractMeta(e,{},r.value),d=Qe(e,{submitter:n});this.pushWithReply(m,"event",{type:"form",event:s,value:d,meta:u,cid:l}).then(({resp:g})=>o(g)).catch(g=>D("Failed to push form submit",g))})}else if(!(e.hasAttribute(W)&&e.classList.contains("phx-submit-loading"))){let h=this.extractMeta(e,{},r.value),f=Qe(e,{submitter:n});this.pushWithReply(a,"event",{type:"form",event:s,value:f,meta:h,cid:l}).then(({resp:m})=>o(m)).catch(m=>D("Failed to push form submit",m))}}uploadFiles(e,i,s,n,r,o){let a=this.joinCount,l=U.activeFileInputs(e),h=l.length;l.forEach(f=>{let m=new U(f,this,()=>{h--,h===0&&o()}),v=m.entries().map(d=>d.toPreflightPayload());if(v.length===0){h--;return}let u={ref:f.getAttribute(se),entries:v,cid:this.targetComponentID(f.form,s)};this.log("upload",()=>["sending preflight request",u]),this.pushWithReply(null,"allow_upload",u).then(({resp:d})=>{if(this.log("upload",()=>["got preflight response",d]),m.entries().forEach(g=>{d.entries&&!d.entries[g.ref]&&this.handleFailedEntryPreflight(g.ref,"failed preflight",m)}),d.error||Object.keys(d.entries).length===0)this.undoRefs(n,i),(d.error||[]).map(([y,C])=>{this.handleFailedEntryPreflight(y,C,m)});else{let g=y=>{this.channel.onError(()=>{this.joinCount===a&&y()})};m.initAdapterUpload(d,g,this.liveSocket)}}).catch(d=>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.findUploadInputs(n).filter(o=>o.name===i);r.length===0?D(`no live file inputs found matching the name "${i}"`):r.length>1?D(`duplicate live file inputs found matching the name "${i}"`):c.dispatchEvent(r[0],gi,{detail:{files:s}})}targetCtxElement(e){if(ie(e)){let[i]=c.findComponentNodeList(this.id,e);return i}else return e||null}pushFormRecovery(e,i,s,n){let r=this.binding("change"),o=i.getAttribute(this.binding("target"))||i,a=i.getAttribute(this.binding(Xt))||i.getAttribute(this.binding("change")),l=Array.from(e.elements).filter(m=>c.isFormInput(m)&&m.name&&!m.hasAttribute(r));if(l.length===0){n();return}l.forEach(m=>m.hasAttribute(se)&&U.clearFiles(m));let h=l.find(m=>m.type!=="hidden")||l[0],f=0;this.withinTargets(o,(m,v)=>{let u=this.targetComponentID(i,v);f++;let d=new CustomEvent("phx:form-recovery",{detail:{sourceElement:e}});_.exec(d,"change",a,this,h,["push",{_target:h.name,targetView:m,targetCtx:v,newCid:u,callback:()=>{f--,f===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,l=()=>this.liveSocket.redirect(window.location.href),h=i.startsWith("/")?`${location.protocol}//${location.host}${i}`:i;this.pushWithReply(a,"live_patch",{url:h}).then(({resp:f})=>{this.liveSocket.requestDOMUpdate(()=>{if(f.link_redirect)this.liveSocket.replaceMain(i,null,n,r);else{if(f.redirect)return;this.liveSocket.commitPendingLink(r)&&(this.href=i),this.applyPendingUpdates(),n&&n(r)}})},({error:f,timeout:m})=>l())}getFormsForRecovery(){if(this.joinCount===0)return{};let e=this.binding("change");
16return c.all(document,`#${CSS.escape(this.id)} form[${e}], [${ge}="${CSS.escape(this.id)}"] form[${e}]`).filter(i=>i.id).filter(i=>i.elements.length>0).filter(i=>i.getAttribute(this.binding(Xt))!=="ignore").map(i=>{let s=i.cloneNode(!0);_t(s,i,{onBeforeElUpdated:(r,o)=>(c.copyPrivates(r,o),r.getAttribute("form")===i.id?(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);_t(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.findComponentNodeList(this.id,n).length===0),s=n=>{this.isDestroyed()||D("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.findComponentNodeList(this.id,r).length===0);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(me)===this.id||i&&i.id===this.id||!i&&this.isDead}submitForm(e,i,s,n,r={}){c.putPrivate(e,$e,!0),Array.from(e.elements).forEach(a=>c.putPrivate(a,$e,!0)),this.liveSocket.blurActiveElement(this),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 Xs=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||cs,this.opts=i,this.params=He(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(it(us),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=it(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||as,this.disconnectedTimeout=i.disconnectedTimeout||hs,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||Xi,this.reloadJitterMin=i.reloadJitterMin||Wi,this.reloadJitterMax=i.reloadJitterMax||zi,this.failsafeJitter=i.failsafeJitter||Ki,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:He(),onPatchEnd:He(),onNodeAdded:He(),onBeforeElUpdated:He()},i.dom||{}),this.transitions=new Ws,this.currentHistoryPosition=parseInt(this.sessionStorage.getItem(ze))||0,window.addEventListener("pagehide",s=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.1.27"}isProfileEnabled(){return this.sessionStorage.getItem(mt)==="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(mt,"true")}disableDebug(){this.sessionStorage.setItem(We,"false")}disableProfiling(){this.sessionStorage.removeItem(mt)}enableLatencySim(t){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(gt,t)}disableLatencySim(){this.sessionStorage.removeItem(gt)}getLatencySim(){let t=this.sessionStorage.getItem(gt);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){clearTimeout(this.reloadWithJitterTimer),this.serverCloseRef&&(this.socket.off(this.serverCloseRef),this.serverCloseRef=null),this.socket.disconnect(t)}replaceTransport(t){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=>_.exec(s,i,e,n,t))}js(){return Ai(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();gs(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){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,s=this.reloadJitterMax,n=Math.floor(Math.random()*(s-i+1))+i,r=B.updateLocal(this.localStorage,window.location.pathname,pi,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.hasPendingLink()?window.location=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.")&&Cs[t.split(".")[1]]}maybeRuntimeHook(t){let e=document.querySelector(`script[${tt}="${CSS.escape(t)}"]`);if(!e)return;let i=window[`phx_hook_${t}`];if(!i||typeof i!="function"){D("a runtime hook must be a function",e);return}let s=i();if(s&&(typeof s=="object"||typeof s=="function"))return s;D("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,`${Ue}:not([${me}])`,e=>{if(!this.getRootById(e.id)){let i=this.newRootView(e);c.isPhxSticky(e)||i.setHref(this.getHref()),i.join(),e.hasAttribute(xt)&&(this.main=i)}t=!0}),t}redirect(t,e,i){i&&B.setCookie(zt,i,60),this.unload(),B.redirect(t,e)}replaceMain(t,e,i=null,s=this.setPendingLink(t)){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,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(a,e,n),this.main.setRedirect(t),this.transitionRemoves(o),this.main.join((l,h)=>{l===1&&this.commitPendingLink(s)&&this.requestDOMUpdate(()=>{o.forEach(f=>f.remove()),r.forEach(f=>a.appendChild(f)),this.outgoingMainEl.replaceWith(a),this.outgoingMainEl=null,i&&i(s),h()})})}transitionRemoves(t,e){let i=this.binding("remove"),s=n=>{n.preventDefault(),n.stopImmediatePropagation()};t.forEach(n=>{for(let r of this.boundEventNames)n.addEventListener(r,s,!0);this.execJS(n,n.getAttribute(i),"remove")}),this.requestDOMUpdate(()=>{t.forEach(n=>{for(let r of this.boundEventNames)n.removeEventListener(r,s,!0)}),e&&e()})}isPhxView(t){return t.getAttribute&&t.getAttribute(Z)!==null}
22newRootView(t,e,i){let s=new qs(t,this,null,e,i);return this.roots[s.id]=s,s}owner(t,e){let i,s=c.closestViewEl(t);if(s)i=this.getViewByEl(s);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(le);return Te(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(le));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)=>{let a=n.getAttribute(this.binding(rs)),l=e.key&&e.key.toLowerCase();if(a&&a.toLowerCase()!==l)return;let h={key:e.key,...this.eventMeta(i,e,n)};_.exec(e,i,r,s,n,["push",{data:h}])}),this.bind({blur:"focusout",focus:"focusin"},(e,i,s,n,r,o)=>{if(!o){let a={key:e.key,...this.eventMeta(i,e,n)};_.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);_.exec(e,i,r,s,n,["push",{data:a}])}}),this.on("dragover",e=>e.preventDefault()),this.on("dragenter",e=>{let i=fe(e.target,this.binding(Xe));!i||!(i instanceof HTMLElement)||ys(e)&&this.js().addClass(i,ft)}),this.on("dragleave",e=>{let i=fe(e.target,this.binding(Xe));if(!i||!(i instanceof HTMLElement))return;let s=i.getBoundingClientRect();(e.clientX<=s.left||e.clientX>=s.right||e.clientY<=s.top||e.clientY>=s.bottom)&&this.js().removeClass(i,ft)}),this.on("drop",e=>{e.preventDefault();let i=fe(e.target,this.binding(Xe));if(!i||!(i instanceof HTMLElement))return;this.js().removeClass(i,ft);let s=i.getAttribute(this.binding(Xe)),n=s&&document.getElementById(s),r=Array.from(e.dataTransfer.files||[]);!n||!(n instanceof HTMLInputElement)||n.disabled||r.length===0||!(n.files instanceof FileList)||(U.trackFiles(n,r,e.dataTransfer),n.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(gi,e=>{let i=e.target;if(!c.isUploadInput(i))return;let s=Array.from(e.detail.files||[]).filter(n=>n instanceof File||n instanceof Blob);U.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(){B.deleteCookie(zt)}commitPendingLink(t){return this.linkRef!==t?!1:(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.getAttribute&&n.target.getAttribute(r);a?this.debounce(n.target,n,s,()=>{this.withinOwners(n.target,l=>{e(n,i,l,n.target,a,null)})}):c.all(document,`[${o}]`,l=>{let h=l.getAttribute(o);this.debounce(l,n,s,()=>{this.withinOwners(l,f=>{e(n,i,f,l,h,"window")})})})})}}bindClicks(){this.on("mousedown",t=>this.clickStartedAtTarget=t.target),this.bindClick("click","click")}bindClick(t,e){let i=this.binding(e);window.addEventListener(t,s=>{let n=null;s.detail===0&&(this.clickStartedAtTarget=s.target);let r=this.clickStartedAtTarget||s.target;
22n=fe(s.target,i),this.dispatchClickAway(s,r),this.clickStartedAtTarget=null;let o=n&&n.getAttribute(i);if(!o){c.isNewPageClick(s,window.location)&&this.unload();return}n.getAttribute("href")==="#"&&s.preventDefault(),!n.hasAttribute(W)&&this.debounce(n,s,"click",()=>{this.withinOwners(n,a=>{_.exec(s,"click",o,a,n,["push",{data:this.eventMeta("click",s,n)}])})})},!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)||!_.isVisible(e)||this.withinOwners(r,a=>{let l=r.getAttribute(i);_.isVisible(r)&&_.isInViewport(r)&&_.exec(t,"click",l,a,r,["push",{data:this.eventMeta("click",t,t.target)}])})})}bindNav(){if(!B.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let t=null;window.addEventListener("scroll",e=>{clearTimeout(t),t=setTimeout(()=>{B.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,l=o>this.currentHistoryPosition,h=l?i:s||i;this.currentHistoryPosition=o||0,this.sessionStorage.setItem(ze,this.currentHistoryPosition.toString()),c.dispatchEvent(window,"phx:navigate",{detail:{href:a,patch:h==="patch",pop:!0,direction:l?"forward":"backward"}}),this.requestDOMUpdate(()=>{let f=()=>{this.maybeScroll(r)};this.main.isConnected()&&h==="patch"&&n===this.main.id?this.main.pushLinkPatch(e,a,null,f):this.replaceMain(a,null,f)})},!1),window.addEventListener("click",e=>{let i=fe(e.target,pt),s=i&&i.getAttribute(pt);if(!s||!this.isConnected()||!this.main||c.wantsNewTab(e))return;let n=i.href instanceof SVGAnimatedString?i.href.baseVal:i.href,r=i.getAttribute(Yi);e.preventDefault(),e.stopImmediatePropagation(),this.pendingLink!==n&&this.requestDOMUpdate(()=>{if(s==="patch")this.pushHistoryPatch(e,n,r,i);else if(s==="redirect")this.historyRedirect(e,n,r,null,i);else throw new Error(`expected ${pt} to be "patch" or "redirect", got: ${s}`);let o=i.getAttribute(this.binding("click"));o&&this.requestDOMUpdate(()=>this.execJS(i,o,"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.isMain())return B.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(ze,this.currentHistoryPosition.toString()),B.updateCurrentState(s=>({...s,backType:"patch"})),B.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.isMain())return B.redirect(e,s);if(/^\/$|^\/[^\/]+.*$/.test(e)){let{protocol:a,host:l}=window.location;e=`${a}//${l}${e}`}let o=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},a=>{this.replaceMain(e,s,l=>{l===this.linkRef&&(this.currentHistoryPosition++,this.sessionStorage.setItem(ze,this.currentHistoryPosition.toString()),B.updateCurrentState(h=>({...h,backType:"redirect"})),B.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=it(t),!0)}bindForms(){let t=0,e=!1;this.on("submit",i=>{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=>{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=>{_.exec(i,"submit",s,n,i.target,["push",{submitter:i.submitter}])})});for(let i of["change","input"])this.on(i,s=>
22{if(s instanceof CustomEvent&&(s.target instanceof HTMLInputElement||s.target instanceof HTMLSelectElement||s.target instanceof HTMLTextAreaElement)&&s.target.form===void 0){if(s.detail&&s.detail.dispatcher)throw new Error(`dispatching a custom ${i} event is only supported on input elements inside a form`);return}let n=this.binding("change"),r=s.target;if(this.blockPhxChangeWhileComposing&&s.isComposing){let u=`composition-listener-${i}`;c.private(r,u)||(c.putPrivate(r,u,!0),r.addEventListener("compositionend",()=>{r.dispatchEvent(new Event(i,{bubbles:!0})),c.deletePrivate(r,u)},{once:!0}));return}let o=r.getAttribute(n),a=r.form&&r.form.getAttribute(n),l=o||a;if(!l||r.type==="number"&&r.validity&&r.validity.badInput)return;let h=o?r:r.form,f=t;t++;let{at:m,type:v}=c.private(r,"prev-iteration")||{};m===f-1&&i==="change"&&v==="input"||(c.putPrivate(r,"prev-iteration",{at:f,type:i}),this.debounce(r,s,i,()=>{this.withinOwners(h,u=>{c.putPrivate(r,st,!0),_.exec(s,"change",l,u,r,["push",{_target:s.target.name,dispatcher:h}])})}))});this.on("reset",i=>{let s=i.target;c.resetForm(s);let n=Array.from(s.elements).find(r=>r.type==="reset");n&&window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(t,e,i,s){if(i==="blur"||i==="focusout")return s();let n=this.binding(is),r=this.binding(ss),o=this.defaults.debounce.toString(),a=this.defaults.throttle.toString();this.withinOwners(t,l=>{let h=()=>!l.isDestroyed()&&document.body.contains(t);c.debounce(t,e,n,o,r,a,h,()=>{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()}},Ws=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())}},Ci=Xs;var Ti={};var at=$i(Pi()),zs={mounted(){let t=JSON.parse(this.el.dataset.geometry),e=JSON.parse(this.el.dataset.center),i=L.map(this.el,{scrollWheelZoom:!0,zoomControl:!0}).setView([e.lat,e.lng],18);if(L.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",{attribution:"Esri",maxZoom:20}).addTo(i),L.tileLayer("https://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}",{maxZoom:20}).addTo(i),t&&t.coordinates){let s=t.coordinates[0].map(r=>[r[1],r[0]]),n=L.polygon(s,{color:"#2563eb",weight:3,fillColor:"#2563eb",fillOpacity:.1,dashArray:null}).addTo(i);i.fitBounds(n.getBounds().pad(.3))}}};function Dt(){let t=document.getElementById("address-search");if(!t||t.dataset.initialized)return;t.dataset.initialized="true";let e=t.querySelector('input[name="q"]'),i=t.querySelector("[data-dropdown]");if(!e||!i)return;let s=null,n="";e.addEventListener("input",r=>{let o=r.target.value.trim();if(n=o,clearTimeout(s),o.length<3){i.classList.add("hidden"),i.innerHTML="";return}s=setTimeout(()=>{fetch(`/api/search?q=${encodeURIComponent(o)}`).then(a=>a.json()).then(a=>{if(n===o){if(a.results.length===0){i.innerHTML='<div class="px-4 py-3 text-[12px] text-black/40">No results found</div>',i.classList.remove("hidden");return}i.innerHTML=a.results.map(l=>{let h=[l.city,l.county?l.county+" County":""].filter(Boolean).join(", ");return`<a href="/parcel/${l.object_id}" 23 class="block px-4 py-2.5 hover:bg-black/[0.03] border-b border-black/5 last:border-0 cursor-pointer transition-colors"> 24 <div class="text-[13px] font-medium text-black">${Ot(l.address)}</div> 25 <div class="text-[10px] text-black/45 mt-0.5">${Ot(h)}${l.apn?" \xB7 APN "+Ot(l.apn):""}</div> 26 </a>`}).join(""),i.classList.remove("hidden")}}).catch(()=>i.classList.add("hidden"))},250)}),document.addEventListener("click",r=>{t.contains(r.target)||i.classList.add("hidden")}),e.addEventListener("keydown",r=>{if(r.key==="Escape"&&i.classList.add("hidden"),r.key==="ArrowDown"||r.key==="ArrowUp"){r.preventDefault();let o=i.querySelectorAll("a");if(!o.length)return;let a=i.querySelector("a:focus"),l=Array.from(o).indexOf(a);l=r.key==="ArrowDown"?Math.min(l+1,o.length-1):Math.max(l-1,0),o[l].focus()}if(r.key==="Enter"){let o=i.querySelector("a:focus");o&&(r.preventDefault(),o.click())}})}function Ot(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):""}document.addEventListener("DOMContentLoaded",Dt);document.addEventListener("phx:page-loading-stop",()=>setTimeout(Dt,100));document.readyState!=="loading"&&Dt();function Ht(){let t=document.getElementById("city-search-container");if(!t||t.dataset.initialized)return;t.dataset.initialized="true";let e=t.querySelector("#city-search-input"),i=t.querySelector("#city-search-btn"),s=t.querySelector("#city-search-dropdown"),n=t.querySelector("#city-search-status");if(!e||!s)return;let r,o=-1,a=[],l=null,h={south:24.5,west:-125,north:49.5,east:-66.5};async function f(){try{let u=await google.maps.importLibrary("places");
26l=new u.AutocompleteSessionToken,e.addEventListener("input",function(){let d=e.value.trim();if(clearTimeout(r),o=-1,d.length<3){s.classList.add("hidden"),s.innerHTML="";return}r=setTimeout(async function(){try{let y=(await u.AutocompleteSuggestion.fetchAutocompleteSuggestions({input:d,includedRegionCodes:["us"],includedPrimaryTypes:["street_address","subpremise","premise"],locationBias:new google.maps.LatLngBounds({lat:h.south,lng:h.west},{lat:h.north,lng:h.east}),sessionToken:l})).suggestions||[];if(!y.length){s.innerHTML='<div style="padding:10px 16px;font-size:12px;color:#999">No addresses found</div>',s.classList.remove("hidden");return}a=y,s.innerHTML=y.map((C,x)=>{let w=C.placePrediction;return`<div class="ac-item" data-idx="${x}" style="padding:10px 16px;border-bottom:1px solid #f0f0f0;cursor:pointer" onmouseover="this.style.background='#f5f5f5'" onmouseout="this.style.background='white'"><div style="font-size:13px;font-weight:500;color:#000">${w.mainText?.text||""}</div><div style="font-size:10px;color:#888;margin-top:2px">${w.secondaryText?.text||""}</div></div>`}).join(""),s.classList.remove("hidden"),s.querySelectorAll(".ac-item").forEach(C=>{C.addEventListener("click",()=>m(parseInt(C.dataset.idx)))})}catch(g){console.warn("City search error:",g)}},200)})}catch(u){console.warn("Google Places init error:",u)}}async function m(u){let d=a[u];if(d?.placePrediction){v("Looking up parcel\u2026"),s.classList.add("hidden");try{let g=d.placePrediction.toPlace();await g.fetchFields({fields:["formattedAddress","addressComponents","location"]});let y=null,C="",x="",w="";(g.addressComponents||[]).forEach(k=>{k.types?.includes("administrative_area_level_1")&&(y=k.shortText),k.types?.includes("street_number")&&(C=k.longText||k.shortText||""),k.types?.includes("route")&&(x=k.longText||k.shortText||""),k.types?.includes("locality")&&(w=k.longText||k.shortText||"")});let A=(C+" "+x).trim();if(e.value=(g.formattedAddress||"").replace(/, USA$/,""),l=new google.maps.places.AutocompleteSessionToken,!y||!["CA","FL","TX"].includes(y)){v("LotCheck currently covers CA, FL, and TX. More states coming soon.");return}if(["TX","FL"].includes(y)&&g.location){let P=await(await fetch(`/api/search?lat=${g.location.lat()}&lng=${g.location.lng()}&state=${y}`)).json();if(P.results?.length>0){window.location.href="/parcel/"+P.results[0].object_id;return}v("No parcel found. Try a different address.");return}if(A&&w){let P=await(await fetch(`/api/search?street=${encodeURIComponent(A)}&city=${encodeURIComponent(w)}`)).json();if(P.results?.length>0){window.location.href="/parcel/"+P.results[0].object_id;return}}if(A){let P=await(await fetch(`/api/search?q=${encodeURIComponent(A)}`)).json();if(P.results?.length>0){window.location.href="/parcel/"+P.results[0].object_id;return}}v("No parcel found. Try a different address.")}catch{v("Search error. Please try again.")}}}function v(u){n.textContent=u,n.classList.remove("hidden"),setTimeout(()=>n.classList.add("hidden"),4e3)}e.addEventListener("keydown",u=>{let d=s.querySelectorAll(".ac-item");if(u.key==="Escape"){s.classList.add("hidden"),o=-1;return}if(u.key==="ArrowDown"||u.key==="ArrowUp"){if(u.preventDefault(),!d.length)return;o=u.key==="ArrowDown"?Math.min(o+1,d.length-1):Math.max(o-1,0),d.forEach((g,y)=>{g.style.background=y===o?"#f0f0f0":"white"});return}u.key==="Enter"&&(u.preventDefault(),o>=0&&a[o]?m(o):a.length>0&&m(0))}),i&&i.addEventListener("click",()=>{a.length>0&&m(o>=0?o:0)}),document.addEventListener("click",u=>{t.contains(u.target)||s.classList.add("hidden")}),window.google?.maps&&f()}document.addEventListener("DOMContentLoaded",Ht);document.addEventListener("phx:page-loading-stop",()=>setTimeout(Ht,100));document.readyState!=="loading"&&Ht();var Ks={mounted(){let t=this.el,e=document.createElement("script");e.src="/assets/js/editor.js",e.onload=()=>{window.__EDITOR_3D_HOOK__&&(window.__EDITOR_3D_HOOK__.mounted.call(this),this._editorHook=window.__EDITOR_3D_HOOK__)},document.head.appendChild(e)},updated(){this._editorHook?.updated.call(this)},destroyed(){this._editorHook?.destroyed.call(this)}},Gs={mounted(){this.init()},updated(){this._initialized||this.init()},destroyed(){this._initialized=!1},init(){let t=this.el,e=t.querySelector("#search-input"),i=t.querySelector("#search-btn"),s=t.querySelector("#search-dropdown"),n=t.querySelector("#search-status");if(!e||!s)return;this._initialized=!0;let r,o=-1,a=[],l=null,h={south:24.5,west:-125,north:49.5,east:-66.5};async function f(){try{let u=await google.maps.importLibrary("places"),d=u.AutocompleteSuggestion,g=u.AutocompleteSessionToken;return l=new g,e.addEventListener("input",function(){let y=e.value.trim();if(clearTimeout(r),o=-1,y.length<3){s.classList.add("hidden"),s.innerHTML="";return}r=setTimeout(async function(){try{let x=(await d.fetchAutocompleteSuggestions({input:y,includedReg
26ionCodes:["us"],includedPrimaryTypes:["street_address","subpremise","premise"],locationBias:new google.maps.LatLngBounds({lat:h.south,lng:h.west},{lat:h.north,lng:h.east}),sessionToken:l})).suggestions||[];if(x.length===0){s.innerHTML='<div style="padding:12px;font-size:13px;color:#999">No addresses found</div>',s.classList.remove("hidden");return}a=x,s.innerHTML=x.map(function(w,A){let k=w.placePrediction,P=k.mainText?k.mainText.text:"",p=k.secondaryText?k.secondaryText.text:"";return'<div class="ac-item" data-idx="'+A+`" style="display:block;padding:10px 16px;border-bottom:1px solid #f0f0f0;cursor:pointer" onmouseover="this.style.background='#f5f5f5'" onmouseout="this.style.background='white'"><div style="font-size:14px;font-weight:500;color:#000">`+P+'</div><div style="font-size:11px;color:#888;margin-top:2px">'+p+"</div></div>"}).join(""),s.classList.remove("hidden"),s.querySelectorAll(".ac-item").forEach(function(w){w.addEventListener("click",function(){m(parseInt(w.dataset.idx))})})}catch(C){console.warn("Google autocomplete error:",C)}},200)}),!0}catch(u){return console.warn("Google init error:",u),!1}}async function m(u){let d=a[u];if(!(!d||!d.placePrediction)){v("Looking up parcel\u2026"),s.classList.add("hidden");try{let g=d.placePrediction.toPlace();await g.fetchFields({fields:["formattedAddress","addressComponents","location"]});let y=["CA","TX","FL"],C=["CA","FL","TX"],x=null;if((g.addressComponents||[]).forEach(function(b){b.types&&b.types.indexOf("administrative_area_level_1")!==-1&&(x=b.shortText)}),!x||C.indexOf(x)===-1){v("LotCheck currently covers CA, FL, and TX. More states coming soon.");return}if(y.indexOf(x)===-1){v("Parcel search for "+x+" is coming soon.");return}l=new google.maps.places.AutocompleteSessionToken;let w="",A="",k="";(g.addressComponents||[]).forEach(function(b){b.types.indexOf("street_number")!==-1&&(w=b.longText||b.shortText||""),b.types.indexOf("route")!==-1&&(A=b.longText||b.shortText||""),b.types.indexOf("locality")!==-1&&(k=b.longText||b.shortText||"")});let P=(w+" "+A).trim(),p=(g.formattedAddress||"").replace(/, USA$/,"");if(e.value=p,(x==="TX"||x==="FL")&&g.location){let b=g.location.lat(),H=g.location.lng(),I=await(await fetch("/api/search?lat="+b+"&lng="+H+"&state="+x)).json();if(I.results&&I.results.length>0){window.location.href="/parcel/"+I.results[0].object_id;return}v("No parcel found for this "+x+" address. Try a different address.");return}if(P&&k){let H=await(await fetch("/api/search?street="+encodeURIComponent(P)+"&city="+encodeURIComponent(k))).json();if(H.results&&H.results.length>0){window.location.href="/parcel/"+H.results[0].object_id;return}}if(P){let H=await(await fetch("/api/search?q="+encodeURIComponent(P))).json();if(H.results&&H.results.length>0){window.location.href="/parcel/"+H.results[0].object_id;return}}v("No parcel found for this address. Try a different address.")}catch{v("Search error. Please try again.")}}}function v(u){n.textContent=u,n.classList.remove("hidden"),setTimeout(function(){n.classList.add("hidden")},4e3)}e.addEventListener("keydown",function(u){let d=s.querySelectorAll(".ac-item");if(u.key==="Escape"){s.classList.add("hidden"),o=-1;return}if(u.key==="ArrowDown"||u.key==="ArrowUp"){if(u.preventDefault(),!d.length)return;o=u.key==="ArrowDown"?Math.min(o+1,d.length-1):Math.max(o-1,0),d.forEach(function(g,y){g.style.background=y===o?"#f0f0f0":"white"});return}u.key==="Enter"&&(u.preventDefault(),o>=0&&a[o]?m(o):a.length>0&&m(0))}),i&&i.addEventListener("click",function(){a.length>0&&m(o>=0?o:0)}),t.querySelectorAll(".search-example").forEach(function(u){u.addEventListener("click",function(){e.value=u.dataset.query,e.dispatchEvent(new Event("input"))})}),document.addEventListener("click",function(u){t.contains(u.target)||s.classList.add("hidden")}),window.google&&window.google.maps&&f()}},Ys=document.querySelector("meta[name='csrf-token']").getAttribute("content"),xi=new Ci("/live",Ft,{longPollFallbackMs:2500,params:{_csrf_token:Ys},hooks:{...Ti,ParcelMap:zs,Editor3D:Ks,GooglePlacesSearch:Gs}});at.default.config({barColors:{0:"#29d"},shadowColor:"rgba(0, 0, 0, .3)"});window.addEventListener("phx:page-loading-start",t=>at.default.show(300));window.addEventListener("phx:page-loading-stop",t=>at.default.hide());xi.connect();window.liveSocket=xi;})(); 27/** 28 * @license MIT 29 * topbar 3.0.0 30 * http://buunguyen.github.io/topbar 31 * Copyright (c) 2024 Buu Nguyen 32 */
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.