Packages
phoenix_live_view
1.0.0-rc.2
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.2.0-rc.3
1.2.0-rc.2
1.2.0-rc.1
1.2.0-rc.0
1.1.32
1.1.31
1.1.30
1.1.29
1.1.28
1.1.27
1.1.26
1.1.25
1.1.24
1.1.23
1.1.22
1.1.21
1.1.20
1.1.19
1.1.18
1.1.17
1.1.16
1.1.15
1.1.14
1.1.13
1.1.12
1.1.11
1.1.10
1.1.9
1.1.8
1.1.7
1.1.6
retired
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.1.0-rc.4
1.1.0-rc.3
1.1.0-rc.2
1.1.0-rc.1
1.1.0-rc.0
1.0.18
1.0.17
1.0.16
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.9
1.0.8
retired
1.0.7
1.0.6
retired
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-rc.9
1.0.0-rc.8
1.0.0-rc.7
1.0.0-rc.6
1.0.0-rc.5
1.0.0-rc.4
1.0.0-rc.3
1.0.0-rc.2
1.0.0-rc.1
1.0.0-rc.0
0.20.17
0.20.16
0.20.15
0.20.14
0.20.13
0.20.12
0.20.11
0.20.10
0.20.9
0.20.8
0.20.7
0.20.6
0.20.5
0.20.4
0.20.3
0.20.2
0.20.1
0.20.0
0.19.5
0.19.4
0.19.3
0.19.2
0.19.1
0.19.0
0.18.18
0.18.17
0.18.16
0.18.15
0.18.14
0.18.13
0.18.12
0.18.11
0.18.10
0.18.9
0.18.8
0.18.7
0.18.6
0.18.5
0.18.4
0.18.3
0.18.2
0.18.1
0.18.0
0.17.14
0.17.13
0.17.12
0.17.11
0.17.10
0.17.9
0.17.8
0.17.7
0.17.6
0.17.5
0.17.4
0.17.3
0.17.2
0.17.1
0.17.0
0.16.4
0.16.3
0.16.2
0.16.1
0.16.0
0.15.7
0.15.6
0.15.5
0.15.4
0.15.3
0.15.2
0.15.1
0.15.0
0.14.8
0.14.7
0.14.6
0.14.5
0.14.4
0.14.3
0.14.2
0.14.1
0.14.0
0.13.3
0.13.2
0.13.1
0.13.0
0.12.1
0.12.0
0.11.1
0.11.0
0.10.0
0.9.0
0.8.1
0.8.0
0.7.1
0.7.0
0.6.0
0.6.0-dev
0.5.2
0.5.1
0.5.0
0.4.1
0.4.0
0.3.1
0.3.0
0.2.1
0.2.0
0.1.1
0.1.0
Rich, real-time user experiences with server-rendered HTML
Current section
Files
Jump to
Current section
Files
priv/static/phoenix_live_view.min.js
var LiveView=(()=>{var ct=Object.defineProperty,_i=Object.defineProperties;var wi=Object.getOwnPropertyDescriptors;var $e=Object.getOwnPropertySymbols;var It=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable;var Lt=(s,e,t)=>e in s?ct(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,N=(s,e)=>{for(var t in e||(e={}))It.call(e,t)&&Lt(s,t,e[t]);if($e)for(var t of $e(e))Ot.call(e,t)&&Lt(s,t,e[t]);return s},Dt=(s,e)=>_i(s,wi(e)),Pi=s=>ct(s,"__esModule",{value:!0});var Ht=(s,e)=>{var t={};for(var i in s)It.call(s,i)&&e.indexOf(i)<0&&(t[i]=s[i]);if(s!=null&&$e)for(var i of $e(s))e.indexOf(i)<0&&Ot.call(s,i)&&(t[i]=s[i]);return t};var yi=(s,e)=>{Pi(s);for(var t in e)ct(s,t,{get:e[t],enumerable:!0})};var Ki={};yi(Ki,{LiveSocket:()=>at,isUsedInput:()=>Ai});var Be="consecutive-reloads",Nt=10,Ft=5e3,Ut=1e4,Mt=3e4,Ve=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading","phx-hook-loading"],F="data-phx-component",Je="data-phx-link",Xt="track-static",$t="data-phx-link-state",T="data-phx-ref",z="data-phx-ref-src",je="track-uploads",U="data-phx-upload-ref",be="data-phx-preflighted-refs",Bt="data-phx-done-refs",ut="drop-target",Te="data-phx-active-refs",Ae="phx:live-file:updated",We="data-phx-skip",qe="data-phx-id",ft="data-phx-prune",pt="page-loading",mt="phx-connected",Ee="phx-loading",Re="phx-error",gt="phx-client-error",Ke="phx-server-error",Y="data-phx-parent-id",Se="data-phx-main",M="data-phx-root-id",Ie="viewport-top",Oe="viewport-bottom",Vt="trigger-action",le="phx-has-focused",Jt=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],Ge=["checkbox","radio"],he="phx-has-submitted",D="data-phx-session",Q=`[${D}]`,vt="data-phx-sticky",Z="data-phx-static",ze="data-phx-readonly",de="data-phx-disabled",Le="disable-with",De="data-phx-disable-with-restore",_e="hook",jt="debounce",Wt="throttle",we="update",Ye="stream",Qe="data-phx-stream",qt="key",j="phxPrivate",bt="auto-recover",He="phx:live-socket:debug",Ze="phx:live-socket:profiling",et="phx:live-socket:latency-sim",Kt="progress",At="mounted",Gt=1,zt=200,Yt="phx-",Qt=3e4;var Pe="debounce-trigger",ye="throttled",Et="debounce-prev-key",Zt={debounce:300,throttle:300},Ne="d",W="s",tt="r",R="c",St="e",_t="r",wt="t",ei="p",Pt="stream";var it=class{constructor(e,t,i){this.liveSocket=i,this.entry=e,this.offset=0,this.chunkSize=t,this.chunkTimer=null,this.errored=!1,this.uploadChannel=i.channel(`lvu:${e.ref}`,{token:e.metadata()})}error(e){this.errored||(this.uploadChannel.leave(),this.errored=!0,clearTimeout(this.chunkTimer),this.entry.error(e))}upload(){this.uploadChannel.onError(e=>this.error(e)),this.uploadChannel.join().receive("ok",e=>this.readNextChunk()).receive("error",e=>this.error(e))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let e=new window.FileReader,t=this.entry.file.slice(this.offset,this.chunkSize+this.offset);e.onload=i=>{if(i.target.error===null)this.offset+=i.target.result.byteLength,this.pushChunk(i.target.result);else return k("Read error: "+i.target.error)},e.readAsArrayBuffer(t)}pushChunk(e){!this.uploadChannel.isJoined()||this.uploadChannel.push("chunk",e).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))}).receive("error",({reason:t})=>this.error(t))}};var k=(s,e)=>console.error&&console.error(s,e),X=s=>{let e=typeof s;return e==="number"||e==="string"&&/^(0|[1-9]\d*)$/.test(s)};function ti(){let s=new Set,e=document.querySelectorAll("*[id]");for(let t=0,i=e.length;t<i;t++)s.has(e[t].id)?console.error(`Multiple IDs detected: ${e[t].id}. Ensure unique element ids.`):s.add(e[t].id)}var ii=(s,e,t,i)=>{s.liveSocket.isDebugEnabled()&&console.log(`${s.id} ${e}: ${t} - `,i)},xe=s=>typeof s=="function"?s:function(){return s},Ce=s=>JSON.parse(JSON.stringify(s)),ce=(s,e,t)=>{do{if(s.matches(`[${e}]`)&&!s.disabled)return s;s=s.parentElement||s.parentNode}while(s!==null&&s.nodeType===1&&!(t&&t.isSameNode(s)||s.matches(Q)));return null},ue=s=>s!==null&&typeof s=="object"&&!(s instanceof Array),si=(s,e)=>JSON.stringify(s)===JSON.stringify(e),yt=s=>{for(let e in s)return!1;return!0},q=(s,e)=>s&&e(s),ri=function(s,e,t,i){s.forEach(r=>{new it(r,t.config.chunk_size,i).upload()})};var ni={canPushState(){return typeof history.pushState!="undefined"},dropLocal(s,e,t){return s.removeItem(this.localKey(e,t))},updateLocal(s,e,t,i,r){let n=this.getLocal(s,e,t),o=this.localKey(e,t),a=n===null?i:r(n);return s.setItem(o,JSON.stringify(a)),a},getLocal(s,e,t){return JSON.parse(s.getItem(this.localKey(e,t)))},updateCurrentState(s){!this.canPushState()||history.replaceState(s(history.state||{}),"",window.location.href)},pushState(s,e,t){if(this.canPushState()){if(t!==window.location.href){if(e.type=="redirect"&&e.scroll){let r=history.state||{};r.scroll=e.scroll,history.replaceState(r,"",window.location.href)}delete e.scroll,history[s+"State"](e,"",t||null);let i=this.getHashTargetEl(window.location.hash);i?i.scrollIntoView():e.type==="redirect"&&window.scroll(0,0)}}else this.redirect(t)},setCookie(s,e){document.cookie=`${s}=${e}`},getCookie(s){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${s}s*=s*([^;]*).*$)|^.*$`),"$1")},redirect(s,e){e&&ni.setCookie("__phoenix_flash__",e+"; max-age=60000; path=/"),window.location=s},localKey(s,e){return`${s}-${e}`},getHashTargetEl(s){let e=s.toString().substring(1);if(e!=="")return document.getElementById(e)||document.querySelector(`a[name="${e}"]`)}},$=ni;var xi={focusMain(){let s=document.querySelector("main h1, main, h1");if(s){let e=s.tabIndex;s.tabIndex=-1,s.focus(),s.tabIndex=e}},anyOf(s,e){return e.find(t=>s instanceof t)},isFocusable(s,e){return s instanceof HTMLAnchorElement&&s.rel!=="ignore"||s instanceof HTMLAreaElement&&s.href!==void 0||!s.disabled&&this.anyOf(s,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||s instanceof HTMLIFrameElement||s.tabIndex>0||!e&&s.getAttribute("tabindex")!==null&&s.getAttribute("aria-hidden")!=="true"},attemptFocus(s,e){if(this.isFocusable(s,e))try{s.focus()}catch(t){}return!!document.activeElement&&document.activeElement.isSameNode(s)},focusFirstInteractive(s){let e=s.firstElementChild;for(;e;){if(this.attemptFocus(e,!0)||this.focusFirstInteractive(e,!0))return!0;e=e.nextElementSibling}},focusFirst(s){let e=s.firstElementChild;for(;e;){if(this.attemptFocus(e)||this.focusFirst(e))return!0;e=e.nextElementSibling}},focusLast(s){let e=s.lastElementChild;for(;e;){if(this.attemptFocus(e)||this.focusLast(e))return!0;e=e.previousElementSibling}}},re=xi;var oi=[],ai=200,Ci={exec(s,e,t,i,r){let[n,o]=r||[null,{callback:r&&r.callback}];(e.charAt(0)==="["?JSON.parse(e):[[n,o]]).forEach(([l,d])=>{l===n&&o.data&&(d.data=Object.assign(d.data||{},o.data),d.callback=d.callback||o.callback),this.filterToEls(i,d).forEach(f=>{this[`exec_${l}`](s,e,t,i,f,d)})})},isVisible(s){return!!(s.offsetWidth||s.offsetHeight||s.getClientRects().length>0)},isInViewport(s){let e=s.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth;return e.right>0&&e.bottom>0&&e.left<i&&e.top<t},exec_exec(s,e,t,i,r,{attr:n,to:o}){(o?h.all(document,o):[i]).forEach(l=>{let d=l.getAttribute(n);if(!d)throw new Error(`expected ${n} to contain JS command on "${o}"`);t.liveSocket.execJS(l,d,s)})},exec_dispatch(s,e,t,i,r,{to:n,event:o,detail:a,bubbles:l}){a=a||{},a.dispatcher=i,h.dispatchEvent(r,o,{detail:a,bubbles:l})},exec_push(s,e,t,i,r,n){let{event:o,data:a,target:l,page_loading:d,loading:f,value:c,dispatcher:m,callback:g}=n,p={loading:f,value:c,target:l,page_loading:!!d},v=s==="change"&&m?m:i,_=l||v.getAttribute(t.binding("target"))||v;t.withinTargets(_,(I,O)=>{if(!!I.isConnected())if(s==="change"){let{newCid:V,_target:y}=n;y=y||(h.isFormInput(i)?i.name:void 0),y&&(p._target=y),I.pushInput(i,O,V,o||e,p,g)}else if(s==="submit"){let{submitter:V}=n;I.submitForm(i,O,o||e,V,p,g)}else I.pushEvent(s,i,O,o||e,a,p,g)})},exec_navigate(s,e,t,i,r,{href:n,replace:o}){t.liveSocket.historyRedirect(n,o?"replace":"push")},exec_patch(s,e,t,i,r,{href:n,replace:o}){t.liveSocket.pushHistoryPatch(n,o?"replace":"push",i)},exec_focus(s,e,t,i,r){window.requestAnimationFrame(()=>re.attemptFocus(r))},exec_focus_first(s,e,t,i,r){window.requestAnimationFrame(()=>re.focusFirstInteractive(r)||re.focusFirst(r))},exec_push_focus(s,e,t,i,r){window.requestAnimationFrame(()=>oi.push(r||i))},exec_pop_focus(s,e,t,i,r){window.requestAnimationFrame(()=>{let n=oi.pop();n&&n.focus()})},exec_add_class(s,e,t,i,r,{names:n,transition:o,time:a}){this.addOrRemoveClasses(r,n,[],o,a,t)},exec_remove_class(s,e,t,i,r,{names:n,transition:o,time:a}){this.addOrRemoveClasses(r,[],n,o,a,t)},exec_toggle_class(s,e,t,i,r,{to:n,names:o,transition:a,time:l}){this.toggleClasses(r,o,a,l,t)},exec_toggle_attr(s,e,t,i,r,{attr:[n,o,a]}){r.hasAttribute(n)?a!==void 0?r.getAttribute(n)===o?this.setOrRemoveAttrs(r,[[n,a]],[]):this.setOrRemoveAttrs(r,[[n,o]],[]):this.setOrRemoveAttrs(r,[],[n]):this.setOrRemoveAttrs(r,[[n,o]],[])},exec_transition(s,e,t,i,r,{time:n,transition:o}){this.addOrRemoveClasses(r,[],[],o,n,t)},exec_toggle(s,e,t,i,r,{display:n,ins:o,outs:a,time:l}){this.toggle(s,t,r,n,o,a,l)},exec_show(s,e,t,i,r,{display:n,transition:o,time:a}){this.show(s,t,r,n,o,a)},exec_hide(s,e,t,i,r,{display:n,transition:o,time:a}){this.hide(s,t,r,n,o,a)},exec_set_attr(s,e,t,i,r,{attr:[n,o]}){this.setOrRemoveAttrs(r,[[n,o]],[])},exec_remove_attr(s,e,t,i,r,{attr:n}){this.setOrRemoveAttrs(r,[],[n])},show(s,e,t,i,r,n){this.isVisible(t)||this.toggle(s,e,t,i,r,null,n)},hide(s,e,t,i,r,n){this.isVisible(t)&&this.toggle(s,e,t,i,null,r,n)},toggle(s,e,t,i,r,n,o){o=o||ai;let[a,l,d]=r||[[],[],[]],[f,c,m]=n||[[],[],[]];if(a.length>0||f.length>0)if(this.isVisible(t)){let g=()=>{this.addOrRemoveClasses(t,c,a.concat(l).concat(d)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,f,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(t,m,c))})};t.dispatchEvent(new Event("phx:hide-start")),e.transition(o,g,()=>{this.addOrRemoveClasses(t,[],f.concat(m)),h.putSticky(t,"toggle",p=>p.style.display="none"),t.dispatchEvent(new Event("phx:hide-end"))})}else{if(s==="remove")return;let g=()=>{this.addOrRemoveClasses(t,l,f.concat(c).concat(m));let p=i||this.defaultDisplay(t);h.putSticky(t,"toggle",v=>v.style.display=p),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(t,d,l))})};t.dispatchEvent(new Event("phx:show-start")),e.transition(o,g,()=>{this.addOrRemoveClasses(t,[],a.concat(d)),t.dispatchEvent(new Event("phx:show-end"))})}else this.isVisible(t)?window.requestAnimationFrame(()=>{t.dispatchEvent(new Event("phx:hide-start")),h.putSticky(t,"toggle",g=>g.style.display="none"),t.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{t.dispatchEvent(new Event("phx:show-start"));let g=i||this.defaultDisplay(t);h.putSticky(t,"toggle",p=>p.style.display=g),t.dispatchEvent(new Event("phx:show-end"))})},toggleClasses(s,e,t,i,r){window.requestAnimationFrame(()=>{let[n,o]=h.getSticky(s,"classes",[[],[]]),a=e.filter(d=>n.indexOf(d)<0&&!s.classList.contains(d)),l=e.filter(d=>o.indexOf(d)<0&&s.classList.contains(d));this.addOrRemoveClasses(s,a,l,t,i,r)})},addOrRemoveClasses(s,e,t,i,r,n){r=r||ai;let[o,a,l]=i||[[],[],[]];if(o.length>0){let d=()=>{this.addOrRemoveClasses(s,a,[].concat(o).concat(l)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(s,o,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(s,l,a))})},f=()=>this.addOrRemoveClasses(s,e.concat(l),t.concat(o).concat(a));return n.transition(r,d,f)}window.requestAnimationFrame(()=>{let[d,f]=h.getSticky(s,"classes",[[],[]]),c=e.filter(v=>d.indexOf(v)<0&&!s.classList.contains(v)),m=t.filter(v=>f.indexOf(v)<0&&s.classList.contains(v)),g=d.filter(v=>t.indexOf(v)<0).concat(c),p=f.filter(v=>e.indexOf(v)<0).concat(m);h.putSticky(s,"classes",v=>(v.classList.remove(...p),v.classList.add(...g),[g,p]))})},setOrRemoveAttrs(s,e,t){let[i,r]=h.getSticky(s,"attrs",[[],[]]),n=e.map(([l,d])=>l).concat(t),o=i.filter(([l,d])=>!n.includes(l)).concat(e),a=r.filter(l=>!n.includes(l)).concat(t);h.putSticky(s,"attrs",l=>(a.forEach(d=>l.removeAttribute(d)),o.forEach(([d,f])=>l.setAttribute(d,f)),[o,a]))},hasAllClasses(s,e){return e.every(t=>s.classList.contains(t))},isToggledOut(s,e){return!this.isVisible(s)||this.hasAllClasses(s,e)},filterToEls(s,{to:e}){return e?h.all(document,e):[s]},defaultDisplay(s){return{tr:"table-row",td:"table-cell"}[s.tagName.toLowerCase()]||"block"}},B=Ci;var K={byId(s){return document.getElementById(s)||k(`no id found for ${s}`)},removeClass(s,e){s.classList.remove(e),s.classList.length===0&&s.removeAttribute("class")},all(s,e,t){if(!s)return[];let i=Array.from(s.querySelectorAll(e));return t?i.forEach(t):i},childNodeLength(s){let e=document.createElement("template");return e.innerHTML=s,e.content.childElementCount},isUploadInput(s){return s.type==="file"&&s.getAttribute(U)!==null},isAutoUpload(s){return s.hasAttribute("data-phx-auto-upload")},findUploadInputs(s){let e=s.id,t=this.all(document,`input[type="file"][${U}][form="${e}"]`);return this.all(s,`input[type="file"][${U}]`).concat(t)},findComponentNodeList(s,e){return this.filterWithinSameLiveView(this.all(s,`[${F}="${e}"]`),s)},isPhxDestroyed(s){return!!(s.id&&K.private(s,"destroyed"))},wantsNewTab(s){let e=s.ctrlKey||s.shiftKey||s.metaKey||s.button&&s.button===1,t=s.target instanceof HTMLAnchorElement&&s.target.hasAttribute("download"),i=s.target.hasAttribute("target")&&s.target.getAttribute("target").toLowerCase()==="_blank",r=s.target.hasAttribute("target")&&!s.target.getAttribute("target").startsWith("_");return e||i||t||r},isUnloadableFormSubmit(s){return s.target&&s.target.getAttribute("method")==="dialog"||s.submitter&&s.submitter.getAttribute("formmethod")==="dialog"?!1:!s.defaultPrevented&&!this.wantsNewTab(s)},isNewPageClick(s,e){let t=s.target instanceof HTMLAnchorElement?s.target.getAttribute("href"):null,i;if(s.defaultPrevented||t===null||this.wantsNewTab(s)||t.startsWith("mailto:")||t.startsWith("tel:")||s.target.isContentEditable)return!1;try{i=new URL(t)}catch(r){try{i=new URL(t,e)}catch(n){return!0}}return i.host===e.host&&i.protocol===e.protocol&&i.pathname===e.pathname&&i.search===e.search?i.hash===""&&!i.href.endsWith("#"):i.protocol.startsWith("http")},markPhxChildDestroyed(s){this.isPhxChild(s)&&s.setAttribute(D,""),this.putPrivate(s,"destroyed",!0)},findPhxChildrenInFragment(s,e){let t=document.createElement("template");return t.innerHTML=s,this.findPhxChildren(t.content,e)},isIgnored(s,e){return(s.getAttribute(e)||s.getAttribute("data-phx-update"))==="ignore"},isPhxUpdate(s,e,t){return s.getAttribute&&t.indexOf(s.getAttribute(e))>=0},findPhxSticky(s){return this.all(s,`[${vt}]`)},findPhxChildren(s,e){return this.all(s,`${Q}[${Y}="${e}"]`)},findExistingParentCIDs(s,e){let t=new Set,i=new Set;return e.forEach(r=>{this.filterWithinSameLiveView(this.all(s,`[${F}="${r}"]`),s).forEach(n=>{t.add(r),this.all(n,`[${F}]`).map(o=>parseInt(o.getAttribute(F))).forEach(o=>i.add(o))})}),i.forEach(r=>t.delete(r)),t},filterWithinSameLiveView(s,e){return e.querySelector(Q)?s.filter(t=>this.withinSameLiveView(t,e)):s},withinSameLiveView(s,e){for(;s=s.parentNode;){if(s.isSameNode(e))return!0;if(s.getAttribute(D)!==null)return!1}},private(s,e){return s[j]&&s[j][e]},deletePrivate(s,e){s[j]&&delete s[j][e]},putPrivate(s,e,t){s[j]||(s[j]={}),s[j][e]=t},updatePrivate(s,e,t,i){let r=this.private(s,e);r===void 0?this.putPrivate(s,e,i(t)):this.putPrivate(s,e,i(r))},copyPrivates(s,e){e[j]&&(s[j]=e[j])},putTitle(s){let e=document.querySelector("title");if(e){let{prefix:t,suffix:i}=e.dataset;document.title=`${t||""}${s}${i||""}`}else document.title=s},debounce(s,e,t,i,r,n,o,a){let l=s.getAttribute(t),d=s.getAttribute(r);l===""&&(l=i),d===""&&(d=n);let f=l||d;switch(f){case null:return a();case"blur":this.once(s,"debounce-blur")&&s.addEventListener("blur",()=>{o()&&a()});return;default:let c=parseInt(f),m=()=>d?this.deletePrivate(s,ye):a(),g=this.incCycle(s,Pe,m);if(isNaN(c))return k(`invalid throttle/debounce value: ${f}`);if(d){let v=!1;if(e.type==="keydown"){let _=this.private(s,Et);this.putPrivate(s,Et,e.key),v=_!==e.key}if(!v&&this.private(s,ye))return!1;{a();let _=setTimeout(()=>{o()&&this.triggerCycle(s,Pe)},c);this.putPrivate(s,ye,_)}}else setTimeout(()=>{o()&&this.triggerCycle(s,Pe,g)},c);let p=s.form;p&&this.once(p,"bind-debounce")&&p.addEventListener("submit",()=>{Array.from(new FormData(p).entries(),([v])=>{let _=p.querySelector(`[name="${v}"]`);this.incCycle(_,Pe),this.deletePrivate(_,ye)})}),this.once(s,"bind-debounce")&&s.addEventListener("blur",()=>{clearTimeout(this.private(s,ye)),this.triggerCycle(s,Pe)})}},triggerCycle(s,e,t){let[i,r]=this.private(s,e);t||(t=i),t===i&&(this.incCycle(s,e),r())},once(s,e){return this.private(s,e)===!0?!1:(this.putPrivate(s,e,!0),!0)},incCycle(s,e,t=function(){}){let[i]=this.private(s,e)||[0,t];return i++,this.putPrivate(s,e,[i,t]),i},maybeAddPrivateHooks(s,e,t){s.hasAttribute&&(s.hasAttribute(e)||s.hasAttribute(t))&&s.setAttribute("data-phx-hook","Phoenix.InfiniteScroll")},isUsedInput(s){return s.nodeType===Node.ELEMENT_NODE&&(this.private(s,le)||this.private(s,he))},resetForm(s){Array.from(s.elements).forEach(e=>{this.deletePrivate(e,le),this.deletePrivate(e,he)})},isPhxChild(s){return s.getAttribute&&s.getAttribute(Y)},isPhxSticky(s){return s.getAttribute&&s.getAttribute(vt)!==null},isChildOfAny(s,e){return!!e.find(t=>t.contains(s))},firstPhxChild(s){return this.isPhxChild(s)?s:this.all(s,`[${Y}]`)[0]},dispatchEvent(s,e,t={}){let i=!0;s.nodeName==="INPUT"&&s.type==="file"&&e==="click"&&(i=!1);let o={bubbles:t.bubbles===void 0?i:!!t.bubbles,cancelable:!0,detail:t.detail||{}},a=e==="click"?new MouseEvent("click",o):new CustomEvent(e,o);s.dispatchEvent(a)},cloneNode(s,e){if(typeof e=="undefined")return s.cloneNode(!0);{let t=s.cloneNode(!1);return t.innerHTML=e,t}},mergeAttrs(s,e,t={}){let i=new Set(t.exclude||[]),r=t.isIgnored,n=e.attributes;for(let a=n.length-1;a>=0;a--){let l=n[a].name;if(i.has(l))l==="value"&&s.value===e.value&&s.setAttribute("value",e.getAttribute(l));else{let d=e.getAttribute(l);s.getAttribute(l)!==d&&(!r||r&&l.startsWith("data-"))&&s.setAttribute(l,d)}}let o=s.attributes;for(let a=o.length-1;a>=0;a--){let l=o[a].name;r?l.startsWith("data-")&&!e.hasAttribute(l)&&![T,z].includes(l)&&s.removeAttribute(l):e.hasAttribute(l)||s.removeAttribute(l)}},mergeFocusedInput(s,e){s instanceof HTMLSelectElement||K.mergeAttrs(s,e,{exclude:["value"]}),e.readOnly?s.setAttribute("readonly",!0):s.removeAttribute("readonly")},hasSelectionRange(s){return s.setSelectionRange&&(s.type==="text"||s.type==="textarea")},restoreFocus(s,e,t){if(s instanceof HTMLSelectElement&&s.focus(),!K.isTextualInput(s))return;s.matches(":focus")||s.focus(),this.hasSelectionRange(s)&&s.setSelectionRange(e,t)},isFormInput(s){return/^(?:input|select|textarea)$/i.test(s.tagName)&&s.type!=="button"},syncAttrsToProps(s){s instanceof HTMLInputElement&&Ge.indexOf(s.type.toLocaleLowerCase())>=0&&(s.checked=s.getAttribute("checked")!==null)},isTextualInput(s){return Jt.indexOf(s.type)>=0},isNowTriggerFormExternal(s,e){return s.getAttribute&&s.getAttribute(e)!==null},syncPendingRef(s,e,t){let i=s.getAttribute(T);if(i===null)return!0;let r=s.getAttribute(z);return K.isFormInput(s)||s.getAttribute(t)!==null?(K.isUploadInput(s)&&K.mergeAttrs(s,e,{isIgnored:!0}),K.putPrivate(s,T,e),!1):(Ve.forEach(n=>{s.classList.contains(n)&&e.classList.add(n)}),e.setAttribute(T,i),e.setAttribute(z,r),!0)},cleanChildNodes(s,e){if(K.isPhxUpdate(s,e,["append","prepend"])){let t=[];s.childNodes.forEach(i=>{i.id||(!(i.nodeType===Node.TEXT_NODE&&i.nodeValue.trim()==="")&&i.nodeType!==Node.COMMENT_NODE&&k(`only HTML element tags with an id are allowed inside containers with phx-update.
removing illegal node: "${(i.outerHTML||i.nodeValue).trim()}"
`),t.push(i))}),t.forEach(i=>i.remove())}},replaceRootContainer(s,e,t){let i=new Set(["id",D,Z,Se,M]);if(s.tagName.toLowerCase()===e.toLowerCase())return Array.from(s.attributes).filter(r=>!i.has(r.name.toLowerCase())).forEach(r=>s.removeAttribute(r.name)),Object.keys(t).filter(r=>!i.has(r.toLowerCase())).forEach(r=>s.setAttribute(r,t[r])),s;{let r=document.createElement(e);return Object.keys(t).forEach(n=>r.setAttribute(n,t[n])),i.forEach(n=>r.setAttribute(n,s.getAttribute(n))),r.innerHTML=s.innerHTML,s.replaceWith(r),r}},getSticky(s,e,t){let i=(K.private(s,"sticky")||[]).find(([r])=>e===r);if(i){let[r,n,o]=i;return o}else return typeof t=="function"?t():t},deleteSticky(s,e){this.updatePrivate(s,"sticky",[],t=>t.filter(([i,r])=>i!==e))},putSticky(s,e,t){let i=t(s);this.updatePrivate(s,"sticky",[],r=>{let n=r.findIndex(([o])=>e===o);return n>=0?r[n]=[e,t,i]:r.push([e,t,i]),r})},applyStickyOperations(s){let e=K.private(s,"sticky");!e||e.forEach(([t,i,r])=>this.putSticky(s,t,i))}},h=K;var ne=class{static isActive(e,t){let i=t._phxRef===void 0,n=e.getAttribute(Te).split(",").indexOf(P.genFileRef(t))>=0;return t.size>0&&(i||n)}static isPreflighted(e,t){return e.getAttribute(be).split(",").indexOf(P.genFileRef(t))>=0&&this.isActive(e,t)}static isPreflightInProgress(e){return e._preflightInProgress===!0}static markPreflightInProgress(e){e._preflightInProgress=!0}constructor(e,t,i,r){this.ref=P.genFileRef(t),this.fileEl=e,this.file=t,this.view=i,this.meta=null,this._isCancelled=!1,this._isDone=!1,this._progress=0,this._lastProgressSent=-1,this._onDone=function(){},this._onElUpdated=this.onElUpdated.bind(this),this.fileEl.addEventListener(Ae,this._onElUpdated),this.autoUpload=r}metadata(){return this.meta}progress(e){this._progress=Math.floor(e),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{P.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}isCancelled(){return this._isCancelled}cancel(){this.file._preflightInProgress=!1,this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(e="failed"){this.fileEl.removeEventListener(Ae,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),this.isAutoUpload()||P.clearFiles(this.fileEl)}isAutoUpload(){return this.autoUpload}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(Ae,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(Te).split(",").indexOf(this.ref)===-1&&(P.untrackFile(this.fileEl,this.file),this.cancel())}toPreflightPayload(){return{last_modified:this.file.lastModified,name:this.file.name,relative_path:this.file.webkitRelativePath,size:this.file.size,type:this.file.type,ref:this.ref,meta:typeof this.file.meta=="function"?this.file.meta():void 0}}uploader(e){if(this.meta.uploader){let t=e[this.meta.uploader]||k(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:ri}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||k(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}};var ki=0,P=class{static genFileRef(e){let t=e._phxRef;return t!==void 0?t:(e._phxRef=(ki++).toString(),e._phxRef)}static getEntryDataURL(e,t,i){let r=this.activeFiles(e).find(n=>this.genFileRef(n)===t);i(URL.createObjectURL(r))}static hasUploadsInProgress(e){let t=0;return h.findUploadInputs(e).forEach(i=>{i.getAttribute(be)!==i.getAttribute(Bt)&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(r=>{let n={path:e.name},o=e.getAttribute(U);i[o]=i[o]||[],n.ref=this.genFileRef(r),n.last_modified=r.lastModified,n.name=r.name||n.ref,n.relative_path=r.webkitRelativePath,n.type=r.type,n.size=r.size,typeof r.meta=="function"&&(n.meta=r.meta()),i[o].push(n)}),i}static clearFiles(e){e.value=null,e.removeAttribute(U),h.putPrivate(e,"files",[])}static untrackFile(e,t){h.putPrivate(e,"files",h.private(e,"files").filter(i=>!Object.is(i,t)))}static trackFiles(e,t,i){if(e.getAttribute("multiple")!==null){let r=t.filter(n=>!this.activeFiles(e).find(o=>Object.is(o,n)));h.updatePrivate(e,"files",[],n=>n.concat(r)),e.value=null}else i&&i.files.length>0&&(e.files=i.files),h.putPrivate(e,"files",t)}static activeFileInputs(e){let t=h.findUploadInputs(e);return Array.from(t).filter(i=>i.files&&this.activeFiles(i).length>0)}static activeFiles(e){return(h.private(e,"files")||[]).filter(t=>ne.isActive(e,t))}static inputsAwaitingPreflight(e){let t=h.findUploadInputs(e);return Array.from(t).filter(i=>this.filesAwaitingPreflight(i).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(t=>!ne.isPreflighted(e,t)&&!ne.isPreflightInProgress(t))}static markPreflightInProgress(e){e.forEach(t=>ne.markPreflightInProgress(t.file))}constructor(e,t,i){this.autoUpload=h.isAutoUpload(e),this.view=t,this.onComplete=i,this._entries=Array.from(P.filesAwaitingPreflight(e)||[]).map(r=>new ne(e,r,t,this.autoUpload)),P.markPreflightInProgress(this._entries),this.numEntriesInProgress=this._entries.length}isAutoUpload(){return this.autoUpload}entries(){return this._entries}initAdapterUpload(e,t,i){this._entries=this._entries.map(n=>(n.isCancelled()?(this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()):(n.zipPostFlight(e),n.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()})),n));let r=this._entries.reduce((n,o)=>{if(!o.meta)return n;let{name:a,callback:l}=o.uploader(i.uploaders);return n[a]=n[a]||{callback:l,entries:[]},n[a].entries.push(o),n},{});for(let n in r){let{callback:o,entries:a}=r[n];o(a,t,e,i)}}};var li={LiveFileUpload:{activeRefs(){return this.el.getAttribute(Te)},preflightedRefs(){return this.el.getAttribute(be)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let s=this.preflightedRefs();this.preflightedWas!==s&&(this.preflightedWas=s,s===""&&this.__view.cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(Ae))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(U)),P.getEntryDataURL(this.inputEl,this.ref,s=>{this.url=s,this.el.src=s})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",()=>re.focusLast(this.el)),this.focusEnd.addEventListener("focus",()=>re.focusFirst(this.el)),this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&re.focusFirst(this.el)}}},hi=s=>["HTML","BODY"].indexOf(s.nodeName.toUpperCase())>=0?null:["scroll","auto"].indexOf(getComputedStyle(s).overflowY)>=0?s:hi(s.parentElement),di=s=>s?s.scrollTop:document.documentElement.scrollTop||document.body.scrollTop,xt=s=>s?s.getBoundingClientRect().bottom:window.innerHeight||document.documentElement.clientHeight,Ct=s=>s?s.getBoundingClientRect().top:0,Ti=(s,e)=>{let t=s.getBoundingClientRect();return t.top>=Ct(e)&&t.left>=0&&t.top<=xt(e)},Ri=(s,e)=>{let t=s.getBoundingClientRect();return t.right>=Ct(e)&&t.left>=0&&t.bottom<=xt(e)},ci=(s,e)=>{let t=s.getBoundingClientRect();return t.top>=Ct(e)&&t.left>=0&&t.top<=xt(e)};li.InfiniteScroll={mounted(){this.scrollContainer=hi(this.el);let s=di(this.scrollContainer),e=!1,t=500,i=null,r=this.throttle(t,(a,l)=>{i=()=>!0,this.liveSocket.execJSHookPush(this.el,a,{id:l.id,_overran:!0},()=>{i=null})}),n=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"start"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{i=null,window.requestAnimationFrame(()=>{ci(l,this.scrollContainer)||l.scrollIntoView({block:"start"})})})}),o=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"end"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{i=null,window.requestAnimationFrame(()=>{ci(l,this.scrollContainer)||l.scrollIntoView({block:"end"})})})});this.onScroll=a=>{let l=di(this.scrollContainer);if(i)return s=l,i();let d=this.el.getBoundingClientRect(),f=this.el.getAttribute(this.liveSocket.binding("viewport-top")),c=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),m=this.el.lastElementChild,g=this.el.firstElementChild,p=l<s,v=l>s;p&&f&&!e&&d.top>=0?(e=!0,r(f,g)):v&&e&&d.top<=0&&(e=!1),f&&p&&Ti(g,this.scrollContainer)?n(f,g):c&&v&&Ri(m,this.scrollContainer)&&o(c,m),s=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(s,e){let t=0,i;return(...r)=>{let n=Date.now(),o=s-(n-t);o<=0||o>s?(i&&(clearTimeout(i),i=null),t=n,e(...r)):i||(i=setTimeout(()=>{t=Date.now(),i=null,e(...r)},o))}}};var ui=li;var st=class{constructor(e,t,i){let r=new Set,n=new Set([...t.children].map(a=>a.id)),o=[];Array.from(e.children).forEach(a=>{if(a.id&&(r.add(a.id),n.has(a.id))){let l=a.previousElementSibling&&a.previousElementSibling.id;o.push({elementId:a.id,previousElementId:l})}}),this.containerId=t.id,this.updateType=i,this.elementsToModify=o,this.elementIdsToAdd=[...n].filter(a=>!r.has(a))}perform(){let e=h.byId(this.containerId);this.elementsToModify.forEach(t=>{t.previousElementId?q(document.getElementById(t.previousElementId),i=>{q(document.getElementById(t.elementId),r=>{r.previousElementSibling&&r.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",r)})}):q(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(t=>{q(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))})}};var fi=11;function Ii(s,e){var t=e.attributes,i,r,n,o,a;if(!(e.nodeType===fi||s.nodeType===fi)){for(var l=t.length-1;l>=0;l--)i=t[l],r=i.name,n=i.namespaceURI,o=i.value,n?(r=i.localName||r,a=s.getAttributeNS(n,r),a!==o&&(i.prefix==="xmlns"&&(r=i.name),s.setAttributeNS(n,r,o))):(a=s.getAttribute(r),a!==o&&s.setAttribute(r,o));for(var d=s.attributes,f=d.length-1;f>=0;f--)i=d[f],r=i.name,n=i.namespaceURI,n?(r=i.localName||r,e.hasAttributeNS(n,r)||s.removeAttributeNS(n,r)):e.hasAttribute(r)||s.removeAttribute(r)}}var rt,Oi="http://www.w3.org/1999/xhtml",H=typeof document=="undefined"?void 0:document,Li=!!H&&"content"in H.createElement("template"),Di=!!H&&H.createRange&&"createContextualFragment"in H.createRange();function Hi(s){var e=H.createElement("template");return e.innerHTML=s,e.content.childNodes[0]}function Ni(s){rt||(rt=H.createRange(),rt.selectNode(H.body));var e=rt.createContextualFragment(s);return e.childNodes[0]}function Fi(s){var e=H.createElement("body");return e.innerHTML=s,e.childNodes[0]}function Ui(s){return s=s.trim(),Li?Hi(s):Di?Ni(s):Fi(s)}function nt(s,e){var t=s.nodeName,i=e.nodeName,r,n;return t===i?!0:(r=t.charCodeAt(0),n=i.charCodeAt(0),r<=90&&n>=97?t===i.toUpperCase():n<=90&&r>=97?i===t.toUpperCase():!1)}function Mi(s,e){return!e||e===Oi?H.createElement(s):H.createElementNS(e,s)}function Xi(s,e){for(var t=s.firstChild;t;){var i=t.nextSibling;e.appendChild(t),t=i}return e}function kt(s,e,t){s[t]!==e[t]&&(s[t]=e[t],s[t]?s.setAttribute(t,""):s.removeAttribute(t))}var pi={OPTION:function(s,e){var t=s.parentNode;if(t){var i=t.nodeName.toUpperCase();i==="OPTGROUP"&&(t=t.parentNode,i=t&&t.nodeName.toUpperCase()),i==="SELECT"&&!t.hasAttribute("multiple")&&(s.hasAttribute("selected")&&!e.selected&&(s.setAttribute("selected","selected"),s.removeAttribute("selected")),t.selectedIndex=-1)}kt(s,e,"selected")},INPUT:function(s,e){kt(s,e,"checked"),kt(s,e,"disabled"),s.value!==e.value&&(s.value=e.value),e.hasAttribute("value")||s.removeAttribute("value")},TEXTAREA:function(s,e){var t=e.value;s.value!==t&&(s.value=t);var i=s.firstChild;if(i){var r=i.nodeValue;if(r==t||!t&&r==s.placeholder)return;i.nodeValue=t}},SELECT:function(s,e){if(!e.hasAttribute("multiple")){for(var t=-1,i=0,r=s.firstChild,n,o;r;)if(o=r.nodeName&&r.nodeName.toUpperCase(),o==="OPTGROUP")n=r,r=n.firstChild;else{if(o==="OPTION"){if(r.hasAttribute("selected")){t=i;break}i++}r=r.nextSibling,!r&&n&&(r=n.nextSibling,n=null)}s.selectedIndex=t}}},Fe=1,mi=11,gi=3,vi=8;function oe(){}function $i(s){if(s)return s.getAttribute&&s.getAttribute("id")||s.id}function Bi(s){return function(t,i,r){if(r||(r={}),typeof i=="string")if(t.nodeName==="#document"||t.nodeName==="HTML"||t.nodeName==="BODY"){var n=i;i=H.createElement("html"),i.innerHTML=n}else i=Ui(i);else i.nodeType===mi&&(i=i.firstElementChild);var o=r.getNodeKey||$i,a=r.onBeforeNodeAdded||oe,l=r.onNodeAdded||oe,d=r.onBeforeElUpdated||oe,f=r.onElUpdated||oe,c=r.onBeforeNodeDiscarded||oe,m=r.onNodeDiscarded||oe,g=r.onBeforeElChildrenUpdated||oe,p=r.skipFromChildren||oe,v=r.addChild||function(A,b){return A.appendChild(b)},_=r.childrenOnly===!0,I=Object.create(null),O=[];function V(A){O.push(A)}function y(A,b){if(A.nodeType===Fe)for(var C=A.firstChild;C;){var S=void 0;b&&(S=o(C))?V(S):(m(C),C.firstChild&&y(C,b)),C=C.nextSibling}}function G(A,b,C){c(A)!==!1&&(b&&b.removeChild(A),m(A),y(A,C))}function te(A){if(A.nodeType===Fe||A.nodeType===mi)for(var b=A.firstChild;b;){var C=o(b);C&&(I[C]=b),te(b),b=b.nextSibling}}te(t);function u(A){l(A);for(var b=A.firstChild;b;){var C=b.nextSibling,S=o(b);if(S){var x=I[S];x&&nt(b,x)?(b.parentNode.replaceChild(x,b),L(x,b)):u(b)}else u(b);b=C}}function E(A,b,C){for(;b;){var S=b.nextSibling;(C=o(b))?V(C):G(b,A,!0),b=S}}function L(A,b,C){var S=o(b);S&&delete I[S],!(!C&&(d(A,b)===!1||(s(A,b),f(A),g(A,b)===!1)))&&(A.nodeName!=="TEXTAREA"?J(A,b):pi.TEXTAREA(A,b))}function J(A,b){var C=p(A,b),S=b.firstChild,x=A.firstChild,ge,ee,ve,Me,ie;e:for(;S;){for(Me=S.nextSibling,ge=o(S);!C&&x;){if(ve=x.nextSibling,S.isSameNode&&S.isSameNode(x)){S=Me,x=ve;continue e}ee=o(x);var Xe=x.nodeType,se=void 0;if(Xe===S.nodeType&&(Xe===Fe?(ge?ge!==ee&&((ie=I[ge])?ve===ie?se=!1:(A.insertBefore(ie,x),ee?V(ee):G(x,A,!0),x=ie,ee=o(x)):se=!1):ee&&(se=!1),se=se!==!1&&nt(x,S),se&&L(x,S)):(Xe===gi||Xe==vi)&&(se=!0,x.nodeValue!==S.nodeValue&&(x.nodeValue=S.nodeValue))),se){S=Me,x=ve;continue e}ee?V(ee):G(x,A,!0),x=ve}if(ge&&(ie=I[ge])&&nt(ie,S))C||v(A,ie),L(ie,S);else{var dt=a(S);dt!==!1&&(dt&&(S=dt),S.actualize&&(S=S.actualize(A.ownerDocument||H)),v(A,S),u(S))}S=Me,x=ve}E(A,x,ee);var Rt=pi[A.nodeName];Rt&&Rt(A,b)}var w=t,pe=w.nodeType,me=i.nodeType;if(!_){if(pe===Fe)me===Fe?nt(t,i)||(m(t),w=Xi(t,Mi(i.nodeName,i.namespaceURI))):w=i;else if(pe===gi||pe===vi){if(me===pe)return w.nodeValue!==i.nodeValue&&(w.nodeValue=i.nodeValue),w;w=i}}if(w===i)m(t);else{if(i.isSameNode&&i.isSameNode(w))return;if(L(w,i,_),O)for(var lt=0,Si=O.length;lt<Si;lt++){var ht=I[O[lt]];ht&&G(ht,ht.parentNode,!1)}}return!_&&w!==t&&t.parentNode&&(w.actualize&&(w=w.actualize(t.ownerDocument||H)),t.parentNode.replaceChild(w,t)),w}}var Vi=Bi(Ii),Tt=Vi;var fe=class{static patchEl(e,t,i){Tt(e,t,{childrenOnly:!1,onBeforeElUpdated:(r,n)=>{if(i&&i.isSameNode(r)&&h.isFormInput(r))return h.mergeFocusedInput(r,n),!1}})}constructor(e,t,i,r,n,o){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=r,this.streams=n,this.streamInserts={},this.streamComponentRestore={},this.targetCID=o,this.cidPatch=X(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.targetContainer=this.isCIDPatch()?this.targetCIDContainer(r):t,this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(e,t){this.callbacks[`before${e}`].push(t)}after(e,t){this.callbacks[`after${e}`].push(t)}trackBefore(e,...t){this.callbacks[`before${e}`].forEach(i=>i(...t))}trackAfter(e,...t){this.callbacks[`after${e}`].forEach(i=>i(...t))}markPrunableContentForRemoval(){let e=this.liveSocket.binding(we);h.all(this.container,`[${e}=append] > *, [${e}=prepend] > *`,t=>{t.setAttribute(ft,"")})}perform(e){let{view:t,liveSocket:i,html:r,container:n,targetContainer:o}=this;if(this.isCIDPatch()&&!o)return;let a=i.getActiveElement(),{selectionStart:l,selectionEnd:d}=a&&h.hasSelectionRange(a)?a:{},f=i.binding(we),c=i.binding(Le),m=i.binding(Ie),g=i.binding(Oe),p=i.binding(Vt),v=[],_=[],I=[],O=null;function V(y,G,te=!1){Tt(y,G,{childrenOnly:y.getAttribute(F)===null&&!te,getNodeKey:u=>h.isPhxDestroyed(u)?null:e?u.id:u.id||u.getAttribute&&u.getAttribute(qe),skipFromChildren:u=>u.getAttribute(f)===Ye,addChild:(u,E)=>{let{ref:L,streamAt:J}=this.getStreamInsert(E);if(L===void 0)return u.appendChild(E);if(this.setStreamRef(E,L),J===0)u.insertAdjacentElement("afterbegin",E);else if(J===-1)u.appendChild(E);else if(J>0){let w=Array.from(u.children)[J];u.insertBefore(E,w)}},onBeforeNodeAdded:u=>{h.maybeAddPrivateHooks(u,m,g),this.trackBefore("added",u);let E=u;return!e&&this.streamComponentRestore[u.id]&&(E=this.streamComponentRestore[u.id],delete this.streamComponentRestore[u.id],V.call(this,E,u,!0)),E},onNodeAdded:u=>{u.getAttribute&&this.maybeReOrderStream(u,!0),u instanceof HTMLImageElement&&u.srcset?u.srcset=u.srcset:u instanceof HTMLVideoElement&&u.autoplay&&u.play(),h.isNowTriggerFormExternal(u,p)&&(O=u),(h.isPhxChild(u)&&t.ownsElement(u)||h.isPhxSticky(u)&&t.ownsElement(u.parentNode))&&this.trackAfter("phxChildAdded",u),v.push(u)},onNodeDiscarded:u=>this.onNodeDiscarded(u),onBeforeNodeDiscarded:u=>u.getAttribute&&u.getAttribute(ft)!==null?!0:!(u.parentElement!==null&&u.id&&h.isPhxUpdate(u.parentElement,f,[Ye,"append","prepend"])||this.maybePendingRemove(u)||this.skipCIDSibling(u)),onElUpdated:u=>{h.isNowTriggerFormExternal(u,p)&&(O=u),_.push(u),this.maybeReOrderStream(u,!1)},onBeforeElUpdated:(u,E)=>{if(h.maybeAddPrivateHooks(E,m,g),h.cleanChildNodes(E,f),this.skipCIDSibling(E))return this.maybeReOrderStream(u),!1;if(h.isPhxSticky(u))return[D,Z,M].map(w=>[w,u.getAttribute(w),E.getAttribute(w)]).forEach(([w,pe,me])=>{me&&pe!==me&&u.setAttribute(w,me)}),!1;if(h.isIgnored(u,f)||u.form&&u.form.isSameNode(O))return this.trackBefore("updated",u,E),h.mergeAttrs(u,E,{isIgnored:h.isIgnored(u,f)}),_.push(u),h.applyStickyOperations(u),!1;if(u.type==="number"&&u.validity&&u.validity.badInput)return!1;if(!h.syncPendingRef(u,E,c))return h.isUploadInput(u)&&(this.trackBefore("updated",u,E),_.push(u)),h.applyStickyOperations(u),!1;if(h.isPhxChild(E)){let w=u.getAttribute(D);return h.mergeAttrs(u,E,{exclude:[Z]}),w!==""&&u.setAttribute(D,w),u.setAttribute(M,this.rootID),h.applyStickyOperations(u),!1}h.copyPrivates(E,u);let L=a&&u.isSameNode(a)&&h.isFormInput(u),J=L&&this.isChangedSelect(u,E);return L&&u.type!=="hidden"&&!J?(this.trackBefore("updated",u,E),h.mergeFocusedInput(u,E),h.syncAttrsToProps(u),_.push(u),h.applyStickyOperations(u),!1):(J&&u.blur(),h.isPhxUpdate(E,f,["append","prepend"])&&I.push(new st(u,E,E.getAttribute(f))),h.syncAttrsToProps(E),h.applyStickyOperations(E),this.trackBefore("updated",u,E),!0)}})}return this.trackBefore("added",n),this.trackBefore("updated",n,n),i.time("morphdom",()=>{this.streams.forEach(([y,G,te,u])=>{G.forEach(([E,L,J])=>{this.streamInserts[E]={ref:y,streamAt:L,limit:J,reset:u}}),u!==void 0&&h.all(n,`[${Qe}="${y}"]`,E=>{this.removeStreamChildElement(E)}),te.forEach(E=>{let L=n.querySelector(`[id="${E}"]`);L&&this.removeStreamChildElement(L)})}),e&&h.all(this.container,`[${f}=${Ye}]`,y=>{this.liveSocket.owner(y,G=>{G===this.view&&Array.from(y.children).forEach(te=>{this.removeStreamChildElement(te)})})}),V.call(this,o,r)}),i.isDebugEnabled()&&(ti(),Array.from(document.querySelectorAll("input[name=id]")).forEach(y=>{y.form&&console.error(`Detected an input with name="id" inside a form! This will cause problems when patching the DOM.
`,y)})),I.length>0&&i.time("post-morph append/prepend restoration",()=>{I.forEach(y=>y.perform())}),i.silenceEvents(()=>h.restoreFocus(a,l,d)),h.dispatchEvent(document,"phx:update"),v.forEach(y=>this.trackAfter("added",y)),_.forEach(y=>this.trackAfter("updated",y)),this.transitionPendingRemoves(),O&&(i.unload(),Object.getPrototypeOf(O).submit.call(O)),!0}onNodeDiscarded(e){(h.isPhxChild(e)||h.isPhxSticky(e))&&this.liveSocket.destroyViewByEl(e),this.trackAfter("discarded",e)}maybePendingRemove(e){return e.getAttribute&&e.getAttribute(this.phxRemove)!==null?(this.pendingRemoves.push(e),!0):!1}removeStreamChildElement(e){this.streamInserts[e.id]?(this.streamComponentRestore[e.id]=e,e.remove()):this.maybePendingRemove(e)||(e.remove(),this.onNodeDiscarded(e))}getStreamInsert(e){return(e.id?this.streamInserts[e.id]:{})||{}}setStreamRef(e,t){h.putSticky(e,Qe,i=>i.setAttribute(Qe,t))}maybeReOrderStream(e,t){let{ref:i,streamAt:r,reset:n}=this.getStreamInsert(e);if(r!==void 0&&(this.setStreamRef(e,i),!(!n&&!t)&&!!e.parentElement)){if(r===0)e.parentElement.insertBefore(e,e.parentElement.firstElementChild);else if(r>0){let o=Array.from(e.parentElement.children),a=o.indexOf(e);if(r>=o.length-1)e.parentElement.appendChild(e);else{let l=o[r];a>r?e.parentElement.insertBefore(e,l):e.parentElement.insertBefore(e,l.nextElementSibling)}}this.maybeLimitStream(e)}}maybeLimitStream(e){let{limit:t}=this.getStreamInsert(e),i=t!==null&&Array.from(e.parentElement.children);t&&t<0&&i.length>t*-1?i.slice(0,i.length+t).forEach(r=>this.removeStreamChildElement(r)):t&&t>=0&&i.length>t&&i.slice(t).forEach(r=>this.removeStreamChildElement(r))}transitionPendingRemoves(){let{pendingRemoves:e,liveSocket:t}=this;e.length>0&&(t.transitionRemoves(e),t.requestDOMUpdate(()=>{e.forEach(i=>{let r=h.firstPhxChild(i);r&&t.destroyViewByEl(r),i.remove()}),this.trackAfter("transitionsDiscarded",e)}))}isChangedSelect(e,t){if(!(e instanceof HTMLSelectElement)||e.multiple)return!1;if(e.options.length!==t.options.length)return!0;let i=e.selectedOptions[0],r=t.selectedOptions[0];return i&&i.hasAttribute("selected")&&r.setAttribute("selected",i.getAttribute("selected")),!e.isEqualNode(t)}isCIDPatch(){return this.cidPatch}skipCIDSibling(e){return e.nodeType===Node.ELEMENT_NODE&&e.hasAttribute(We)}targetCIDContainer(e){if(!this.isCIDPatch())return;let[t,...i]=h.findComponentNodeList(this.container,this.targetCID);return i.length===0&&h.childNodeLength(e)===1?t:t&&t.parentNode}indexOf(e,t){return Array.from(e.children).indexOf(t)}};var Ji=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),ji=new Set(["'",'"']),bi=(s,e,t)=>{let i=0,r=!1,n,o,a,l,d,f,c=s.match(/^(\s*(?:<!--.*?-->\s*)*)<([^\s\/>]+)/);if(c===null)throw new Error(`malformed html ${s}`);for(i=c[0].length,n=c[1],a=c[2],l=i,i;i<s.length&&s.charAt(i)!==">";i++)if(s.charAt(i)==="="){let p=s.slice(i-3,i)===" id";i++;let v=s.charAt(i);if(ji.has(v)){let _=i;for(i++,i;i<s.length&&s.charAt(i)!==v;i++);if(p){d=s.slice(_+1,i);break}}}let m=s.length-1;for(r=!1;m>=n.length+a.length;){let p=s.charAt(m);if(r)p==="-"&&s.slice(m-3,m)==="<!-"?(r=!1,m-=4):m-=1;else if(p===">"&&s.slice(m-2,m)==="--")r=!0,m-=3;else{if(p===">")break;m-=1}}o=s.slice(m+1,s.length);let g=Object.keys(e).map(p=>e[p]===!0?p:`${p}="${e[p]}"`).join(" ");if(t){let p=d?` id="${d}"`:"";Ji.has(a)?f=`<${a}${p}${g===""?"":" "}${g}/>`:f=`<${a}${p}${g===""?"":" "}${g}></${a}>`}else{let p=s.slice(l,m+1);f=`<${a}${g===""?"":" "}${g}${p}`}return[f,n,o]},Ue=class{static extract(e){let{[_t]:t,[St]:i,[wt]:r}=e;return delete e[_t],delete e[St],delete e[wt],{diff:e,title:r,reply:t||null,events:i||[]}}constructor(e,t){this.viewId=e,this.rendered={},this.magicId=0,this.mergeDiff(t)}parentViewId(){return this.viewId}toString(e){let[t,i]=this.recursiveToString(this.rendered,this.rendered[R],e,!0,{});return[t,i]}recursiveToString(e,t=e[R],i,r,n){i=i?new Set(i):null;let o={buffer:"",components:t,onlyCids:i,streams:new Set};return this.toOutputBuffer(e,null,o,r,n),[o.buffer,o.streams]}componentCIDs(e){return Object.keys(e[R]||{}).map(t=>parseInt(t))}isComponentOnlyDiff(e){return e[R]?Object.keys(e).length===1:!1}getComponent(e,t){return e[R][t]}resetRender(e){this.rendered[R][e]&&(this.rendered[R][e].reset=!0)}mergeDiff(e){let t=e[R],i={};if(delete e[R],this.rendered=this.mutableMerge(this.rendered,e),this.rendered[R]=this.rendered[R]||{},t){let r=this.rendered[R];for(let n in t)t[n]=this.cachedFindComponent(n,t[n],r,t,i);for(let n in t)r[n]=t[n];e[R]=t}}cachedFindComponent(e,t,i,r,n){if(n[e])return n[e];{let o,a,l=t[W];if(X(l)){let d;l>0?d=this.cachedFindComponent(l,r[l],i,r,n):d=i[-l],a=d[W],o=this.cloneMerge(d,t,!0),o[W]=a}else o=t[W]!==void 0||i[e]===void 0?t:this.cloneMerge(i[e],t,!1);return n[e]=o,o}}mutableMerge(e,t){return t[W]!==void 0?t:(this.doMutableMerge(e,t),e)}doMutableMerge(e,t){for(let i in t){let r=t[i],n=e[i];ue(r)&&r[W]===void 0&&ue(n)?this.doMutableMerge(n,r):e[i]=r}e[tt]&&(e.newRender=!0)}cloneMerge(e,t,i){let r=N(N({},e),t);for(let n in r){let o=t[n],a=e[n];ue(o)&&o[W]===void 0&&ue(a)?r[n]=this.cloneMerge(a,o,i):o===void 0&&ue(a)&&(r[n]=this.cloneMerge(a,{},i))}return i?(delete r.magicId,delete r.newRender):e[tt]&&(r.newRender=!0),r}componentToString(e){let[t,i]=this.recursiveCIDToString(this.rendered[R],e,null),[r,n,o]=bi(t,{});return[r,i]}pruneCIDs(e){e.forEach(t=>delete this.rendered[R][t])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[W]}templateStatic(e,t){return typeof e=="number"?t[e]:e}nextMagicID(){return this.magicId++,`m${this.magicId}-${this.parentViewId()}`}toOutputBuffer(e,t,i,r,n={}){if(e[Ne])return this.comprehensionToBuffer(e,t,i);let{[W]:o}=e;o=this.templateStatic(o,t);let a=e[tt],l=i.buffer;a&&(i.buffer=""),r&&a&&!e.magicId&&(e.newRender=!0,e.magicId=this.nextMagicID()),i.buffer+=o[0];for(let d=1;d<o.length;d++)this.dynamicToBuffer(e[d-1],t,i,r),i.buffer+=o[d];if(a){let d=!1,f;r||e.magicId?(d=r&&!e.newRender,f=N({[qe]:e.magicId},n)):f=n,d&&(f[We]=!0);let[c,m,g]=bi(i.buffer,f,d);e.newRender=!1,i.buffer=l+m+c+g}}comprehensionToBuffer(e,t,i){let{[Ne]:r,[W]:n,[Pt]:o}=e,[a,l,d,f]=o||[null,{},[],null];n=this.templateStatic(n,t);let c=t||e[ei];for(let m=0;m<r.length;m++){let g=r[m];i.buffer+=n[0];for(let p=1;p<n.length;p++){let v=!1;this.dynamicToBuffer(g[p-1],c,i,v),i.buffer+=n[p]}}o!==void 0&&(e[Ne].length>0||d.length>0||f)&&(delete e[Pt],e[Ne]=[],i.streams.add(o))}dynamicToBuffer(e,t,i,r){if(typeof e=="number"){let[n,o]=this.recursiveCIDToString(i.components,e,i.onlyCids);i.buffer+=n,i.streams=new Set([...i.streams,...o])}else ue(e)?this.toOutputBuffer(e,t,i,r,{}):i.buffer+=e}recursiveCIDToString(e,t,i){let r=e[t]||k(`no component for CID ${t}`,e),n={[F]:t},o=i&&!i.has(t);r.newRender=!o,r.magicId=`c${t}-${this.parentViewId()}`;let a=!r.reset,[l,d]=this.recursiveToString(r,e,i,a,n);return delete r.reset,[l,d]}};var Wi=1,ae=class{static makeID(){return Wi++}static elementID(e){return e.phxHookId}constructor(e,t,i){this.__view=e,this.liveSocket=e.liveSocket,this.__callbacks=i,this.__listeners=new Set,this.__isDisconnected=!1,this.el=t,this.el.phxHookId=this.constructor.makeID();for(let r in this.__callbacks)this[r]=this.__callbacks[r]}__mounted(){this.mounted&&this.mounted()}__updated(){this.updated&&this.updated()}__beforeUpdate(){this.beforeUpdate&&this.beforeUpdate()}__destroyed(){this.destroyed&&this.destroyed()}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected&&this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected&&this.disconnected()}pushEvent(e,t={},i=function(){}){return this.__view.pushHookEvent(this.el,null,e,t,i)}pushEventTo(e,t,i={},r=function(){}){return this.__view.withinTargets(e,(n,o)=>n.pushHookEvent(this.el,o,t,i,r))}handleEvent(e,t){let i=(r,n)=>n?e:t(r.detail);return window.addEventListener(`phx:${e}`,i),this.__listeners.add(i),i}removeHandleEvent(e){let t=e(null,!0);window.removeEventListener(`phx:${t}`,e),this.__listeners.delete(e)}upload(e,t){return this.__view.dispatchUploads(null,e,t)}uploadTo(e,t,i){return this.__view.withinTargets(e,(r,n)=>{r.dispatchUploads(n,t,i)})}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}};var qi=(s,e)=>{let t=s.endsWith("[]"),i=t?s.slice(0,-2):s;return i=i.replace(/([^\[\]]+)(\]?$)/,`${e}$1$2`),t&&(i+="[]"),i},ot=(s,e,t=[])=>{let f=e,{submitter:i}=f,r=Ht(f,["submitter"]),n;if(i&&i.name){let c=document.createElement("input");c.type="hidden";let m=i.getAttribute("form");m&&c.setAttribute("form",m),c.name=i.name,c.value=i.value,i.parentElement.insertBefore(c,i),n=c}let o=new FormData(s),a=[];o.forEach((c,m,g)=>{c instanceof File&&a.push(m)}),a.forEach(c=>o.delete(c));let l=new URLSearchParams,d=Array.from(s.elements);for(let[c,m]of o.entries())if(t.length===0||t.indexOf(c)>=0){let g=d.filter(_=>_.name===c),p=!g.some(_=>h.private(_,le)||h.private(_,he)),v=g.every(_=>_.type==="hidden");p&&!(i&&i.name==c)&&!v&&l.append(qi(c,"_unused_"),""),l.append(c,m)}i&&n&&i.parentElement.removeChild(n);for(let c in r)l.append(c,r[c]);return l.toString()},ke=class{constructor(e,t,i,r,n){this.isDead=!1,this.liveSocket=t,this.flash=r,this.parent=i,this.root=i?i.root:this,this.el=e,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.pendingForms=new Set,this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(o){o&&o()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.formsForRecovery={},this.channel=this.liveSocket.channel(`lv:${this.id}`,()=>{let o=this.href&&this.expandURL(this.href);return{redirect:this.redirect?o:void 0,url:this.redirect?void 0:o||void 0,params:this.connectParams(n),session:this.getSession(),static:this.getStatic(),flash:this.flash}})}setHref(e){this.href=e}setRedirect(e){this.redirect=!0,this.href=e}isMain(){return this.el.hasAttribute(Se)}connectParams(e){let t=this.liveSocket.params(this.el),i=h.all(document,`[${this.binding(Xt)}]`).map(r=>r.src||r.href).filter(r=>typeof r=="string");return i.length>0&&(t._track_static=i),t._mounts=this.joinCount,t._live_referer=e,t}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(D)}getStatic(){let e=this.el.getAttribute(Z);return e===""?null:e}destroy(e=function(){}){this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);let t=()=>{e();for(let i in this.viewHooks)this.destroyHook(this.viewHooks[i])};h.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",t).receive("error",t).receive("timeout",t)}setContainerClasses(...e){this.el.classList.remove(mt,Ee,Re,gt,Ke),this.el.classList.add(...e)}showLoader(e){if(clearTimeout(this.loaderTimer),e)this.loaderTimer=setTimeout(()=>this.showLoader(),e);else{for(let t in this.viewHooks)this.viewHooks[t].__disconnected();this.setContainerClasses(Ee)}}execAll(e){h.all(this.el,`[${e}]`,t=>this.liveSocket.execJS(t,t.getAttribute(e)))}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses(mt),this.execAll(this.binding("connected"))}triggerReconnected(){for(let e in this.viewHooks)this.viewHooks[e].__reconnected()}log(e,t){this.liveSocket.log(this,e,t)}transition(e,t,i=function(){}){this.liveSocket.transition(e,t,i)}withinTargets(e,t,i=document,r){if(e instanceof HTMLElement||e instanceof SVGElement)return this.liveSocket.owner(e,n=>t(n,e));if(X(e))h.findComponentNodeList(r||this.el,e).length===0?k(`no component found matching phx-target of ${e}`):t(this,parseInt(e));else{let n=Array.from(i.querySelectorAll(e));n.length===0&&k(`nothing found matching the phx-target selector "${e}"`),n.forEach(o=>this.liveSocket.owner(o,a=>t(a,o)))}}applyDiff(e,t,i){this.log(e,()=>["",Ce(t)]);let{diff:r,reply:n,events:o,title:a}=Ue.extract(t);i({diff:r,reply:n,events:o}),typeof a=="string"&&window.requestAnimationFrame(()=>h.putTitle(a))}onJoin(e){let{rendered:t,container:i,liveview_version:r}=e;if(i){let[n,o]=i;this.el=h.replaceRootContainer(this.el,n,o)}this.childJoins=0,this.joinPending=!0,this.flash=null,this.root===this&&(this.formsForRecovery=this.getFormsForRecovery()),r!==this.liveSocket.version()&&console.error(`LiveView asset version mismatch. JavaScript version ${this.liveSocket.version()} vs. server ${r}. To avoid issues, please ensure that your assets use the same version as the server.`),$.dropLocal(this.liveSocket.localStorage,window.location.pathname,Be),this.applyDiff("mount",t,({diff:n,events:o})=>{this.rendered=new Ue(this.id,n);let[a,l]=this.renderContainer(null,"join");this.dropPendingRefs(),this.joinCount++,this.maybeRecoverForms(a,()=>{this.onJoinComplete(e,a,l,o)})})}dropPendingRefs(){h.all(document,`[${z}="${this.id}"][${T}]`,e=>{e.removeAttribute(T),e.removeAttribute(z)})}onJoinComplete({live_patch:e},t,i,r){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(e,t,i,r);h.findPhxChildrenInFragment(t,this.id).filter(o=>{let a=o.id&&this.el.querySelector(`[id="${o.id}"]`),l=a&&a.getAttribute(Z);return l&&o.setAttribute(Z,l),a&&a.setAttribute(M,this.root.id),this.joinChild(o)}).length===0?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i,r)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(e,t,i,r)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i,r)])}attachTrueDocEl(){this.el=h.byId(this.id),this.el.setAttribute(M,this.root.id)}execNewMounted(){let e=this.binding(Ie),t=this.binding(Oe);h.all(this.el,`[${e}], [${t}]`,i=>{this.ownsElement(i)&&(h.maybeAddPrivateHooks(i,e,t),this.maybeAddNewHook(i))}),h.all(this.el,`[${this.binding(_e)}], [data-phx-${_e}]`,i=>{this.ownsElement(i)&&this.maybeAddNewHook(i)}),h.all(this.el,`[${this.binding(At)}]`,i=>{this.ownsElement(i)&&this.maybeMounted(i)})}applyJoinPatch(e,t,i,r){this.attachTrueDocEl();let n=new fe(this,this.el,this.id,t,i,null);if(n.markPrunableContentForRemoval(),this.performPatch(n,!1,!0),this.joinNewChildren(),this.execNewMounted(),this.joinPending=!1,this.liveSocket.dispatchEvents(r),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,t){this.liveSocket.triggerDOM("onBeforeElUpdated",[e,t]);let i=this.getHook(e),r=i&&h.isIgnored(e,this.binding(we));if(i&&!e.isEqualNode(t)&&!(r&&si(e.dataset,t.dataset)))return i.__beforeUpdate(),i}maybeMounted(e){let t=e.getAttribute(this.binding(At)),i=t&&h.private(e,"mounted");t&&!i&&(this.liveSocket.execJS(e,t),h.putPrivate(e,"mounted",!0))}maybeAddNewHook(e,t){let i=this.addHook(e);i&&i.__mounted()}performPatch(e,t,i=!1){let r=[],n=!1,o=new Set;return this.liveSocket.triggerDOM("onPatchStart",[e.targetContainer]),e.after("added",a=>{this.liveSocket.triggerDOM("onNodeAdded",[a]);let l=this.binding(Ie),d=this.binding(Oe);h.maybeAddPrivateHooks(a,l,d),this.maybeAddNewHook(a),a.getAttribute&&this.maybeMounted(a)}),e.after("phxChildAdded",a=>{h.isPhxSticky(a)?this.liveSocket.joinRootViews():n=!0}),e.before("updated",(a,l)=>{this.triggerBeforeUpdateHook(a,l)&&o.add(a.id)}),e.after("updated",a=>{o.has(a.id)&&this.getHook(a).__updated()}),e.after("discarded",a=>{a.nodeType===Node.ELEMENT_NODE&&r.push(a)}),e.after("transitionsDiscarded",a=>this.afterElementsRemoved(a,t)),e.perform(i),this.afterElementsRemoved(r,t),this.liveSocket.triggerDOM("onPatchEnd",[e.targetContainer]),n}afterElementsRemoved(e,t){let i=[];e.forEach(r=>{let n=h.all(r,`[${F}]`),o=h.all(r,`[${this.binding(_e)}]`);n.concat(r).forEach(a=>{let l=this.componentID(a);X(l)&&i.indexOf(l)===-1&&i.push(l)}),o.concat(r).forEach(a=>{let l=this.getHook(a);l&&this.destroyHook(l)})}),t&&this.maybePushComponentsDestroyed(i)}joinNewChildren(){h.findPhxChildren(this.el,this.id).forEach(e=>this.joinChild(e))}maybeRecoverForms(e,t){let i=this.binding("change"),r=this.root.formsForRecovery,n=document.createElement("template");n.innerHTML=e;let o=n.content.firstElementChild;o.id=this.id,o.setAttribute(M,this.root.id),o.setAttribute(D,this.getSession()),o.setAttribute(Z,this.getStatic()),o.setAttribute(Y,this.parent?this.parent.id:null);let a=h.all(n.content,"form").filter(l=>l.id&&r[l.id]).filter(l=>!this.pendingForms.has(l.id)).filter(l=>r[l.id].getAttribute(i)===l.getAttribute(i)).map(l=>[r[l.id],l]);if(a.length===0)return t();a.forEach(([l,d],f)=>{this.pendingForms.add(d.id),this.pushFormRecovery(l,d,n.content,()=>{this.pendingForms.delete(d.id),f===a.length-1&&t()})})}getChildById(e){return this.root.children[this.id][e]}getDescendentByEl(e){return e.id===this.id?this:this.children[e.getAttribute(Y)][e.id]}destroyDescendent(e){for(let t in this.root.children)for(let i in this.root.children[t])if(i===e)return this.root.children[t][i].destroy()}joinChild(e){if(!this.getChildById(e.id)){let i=new ke(e,this.liveSocket,this);return this.root.children[this.id][i.id]=i,i.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(e){this.childJoins--,this.childJoins===0&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.pendingForms.clear(),this.formsForRecovery={},this.joinCallback(()=>{this.pendingJoinOps.forEach(([e,t])=>{e.isDestroyed()||t()}),this.pendingJoinOps=[]})}update(e,t){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&this.root.isMain())return this.pendingDiffs.push({diff:e,events:t});this.rendered.mergeDiff(e);let i=!1;this.rendered.isComponentOnlyDiff(e)?this.liveSocket.time("component patch complete",()=>{h.findExistingParentCIDs(this.el,this.rendered.componentCIDs(e)).forEach(n=>{this.componentPatch(this.rendered.getComponent(e,n),n)&&(i=!0)})}):yt(e)||this.liveSocket.time("full patch complete",()=>{let[r,n]=this.renderContainer(e,"update"),o=new fe(this,this.el,this.id,r,n,null);i=this.performPatch(o,!0)}),this.liveSocket.dispatchEvents(t),i&&this.joinNewChildren()}renderContainer(e,t){return this.liveSocket.time(`toString diff (${t})`,()=>{let i=this.el.tagName,r=e?this.rendered.componentCIDs(e):null,[n,o]=this.rendered.toString(r);return[`<${i}>${n}</${i}>`,o]})}componentPatch(e,t){if(yt(e))return!1;let[i,r]=this.rendered.componentToString(t),n=new fe(this,this.el,this.id,i,r,t);return this.performPatch(n,!0)}getHook(e){return this.viewHooks[ae.elementID(e)]}addHook(e){if(ae.elementID(e)||!e.getAttribute)return;let t=e.getAttribute(`data-phx-${_e}`)||e.getAttribute(this.binding(_e));if(t&&!this.ownsElement(e))return;let i=this.liveSocket.getHookCallbacks(t);if(i){e.id||k(`no DOM ID for hook "${t}". Hooks require a unique ID on each element.`,e);let r=new ae(this,e,i);return this.viewHooks[ae.elementID(r.el)]=r,r}else t!==null&&k(`unknown hook found for "${t}"`,e)}destroyHook(e){e.__destroyed(),e.__cleanup__(),delete this.viewHooks[ae.elementID(e.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:e,events:t})=>this.update(e,t)),this.pendingDiffs=[],this.eachChild(e=>e.applyPendingUpdates())}eachChild(e){let t=this.root.children[this.id]||{};for(let i in t)e(this.getChildById(i))}onChannel(e,t){this.liveSocket.onChannel(this.channel,e,i=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>t(i)]):this.liveSocket.requestDOMUpdate(()=>t(i))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",e=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",e,({diff:t,events:i})=>this.update(t,i))})}),this.onChannel("redirect",({to:e,flash:t})=>this.onRedirect({to:e,flash:t})),this.onChannel("live_patch",e=>this.onLivePatch(e)),this.onChannel("live_redirect",e=>this.onLiveRedirect(e)),this.channel.onError(e=>this.onError(e)),this.channel.onClose(e=>this.onClose(e))}destroyAllChildren(){this.eachChild(e=>e.destroy())}onLiveRedirect(e){let{to:t,kind:i,flash:r}=e,n=this.expandURL(t);this.liveSocket.historyRedirect(n,i,r)}onLivePatch(e){let{to:t,kind:i}=e;this.href=this.expandURL(t),this.liveSocket.historyPatch(t,i)}expandURL(e){return e.startsWith("/")?`${window.location.protocol}//${window.location.host}${e}`:e}onRedirect({to:e,flash:t}){this.liveSocket.redirect(e,t)}isDestroyed(){return this.destroyed}joinDead(){this.isDead=!0}join(e){this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel(),this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=t=>{t=t||function(){},e?e(this.joinCount,t):t()},this.liveSocket.wrapPush(this,{timeout:!1},()=>this.channel.join().receive("ok",t=>{this.isDestroyed()||this.liveSocket.requestDOMUpdate(()=>this.onJoin(t))}).receive("error",t=>!this.isDestroyed()&&this.onJoinError(t)).receive("timeout",()=>!this.isDestroyed()&&this.onJoinError({reason:"timeout"})))}onJoinError(e){if(e.reason==="reload"){this.log("error",()=>[`failed mount with ${e.status}. Falling back to page request`,e]),this.isMain()&&this.onRedirect({to:this.href});return}else if(e.reason==="unauthorized"||e.reason==="stale"){this.log("error",()=>["unauthorized live_redirect. Falling back to page request",e]),this.isMain()&&this.onRedirect({to:this.href});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);this.displayError([Ee,Re,Ke]),this.log("error",()=>["unable to join",e]),this.liveSocket.isConnected()&&this.liveSocket.reloadWithJitter(this)}onClose(e){if(!this.isDestroyed()){if(this.liveSocket.hasPendingLink()&&e!=="leave")return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(zt)}}onError(e){this.onClose(e),this.liveSocket.isConnected()&&this.log("error",()=>["view crashed",e]),this.liveSocket.isUnloaded()||(this.liveSocket.isConnected()?this.displayError([Ee,Re,Ke]):this.displayError([Ee,Re,gt]))}displayError(e){this.isMain()&&h.dispatchEvent(window,"phx:page-loading-start",{detail:{to:this.href,kind:"error"}}),this.showLoader(),this.setContainerClasses(...e),this.execAll(this.binding("disconnected"))}pushWithReply(e,t,i,r=function(){}){if(!this.isConnected())return;let[n,[o],a]=e?e():[null,[],{}],l=function(){};return(a.page_loading||o&&o.getAttribute(this.binding(pt))!==null)&&(l=this.liveSocket.withPageLoading({kind:"element",target:o})),typeof i.cid!="number"&&delete i.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(t,i,Qt).receive("ok",d=>{let f=c=>{d.redirect&&this.onRedirect(d.redirect),d.live_patch&&this.onLivePatch(d.live_patch),d.live_redirect&&this.onLiveRedirect(d.live_redirect),l(),r(d,c)};d.diff?this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",d.diff,({diff:c,reply:m,events:g})=>{n!==null&&this.undoRefs(n),this.update(c,g),f(m)})}):(n!==null&&this.undoRefs(n),f(null))}))}undoRefs(e,t){t=t?new Set(t):null,!!this.isConnected()&&h.all(document,`[${z}="${this.id}"][${T}="${e}"]`,i=>{if(t&&!t.has(i))return;i.dispatchEvent(new CustomEvent("phx:unlock",{bubbles:!0,cancelable:!1}));let r=i.getAttribute(de),n=i.getAttribute(ze);i.removeAttribute(T),i.removeAttribute(z),n!==null&&(i.readOnly=n==="true",i.removeAttribute(ze)),r!==null&&(i.disabled=r==="true",i.removeAttribute(de)),Ve.forEach(l=>h.removeClass(i,l));let o=i.getAttribute(De);o!==null&&(i.innerText=o,i.removeAttribute(De));let a=h.private(i,T);if(a){let l=this.triggerBeforeUpdateHook(i,a);fe.patchEl(i,a,this.liveSocket.getActiveElement()),l&&l.__updated(),h.deletePrivate(i,T)}})}putRef(e,t,i={}){let r=this.ref++,n=this.binding(Le);i.loading&&(e=e.concat(h.all(document,i.loading)));for(let o of e){if(o.setAttribute(T,r),o.setAttribute(z,this.el.id),i.submitter&&!(o===i.submitter||o===i.form))continue;o.classList.add(`phx-${t}-loading`),o.dispatchEvent(new CustomEvent(`phx:${t}-loading`,{bubbles:!0,cancelable:!1}));let a=o.getAttribute(n);a!==null&&(o.getAttribute(De)||o.setAttribute(De,o.innerText),a!==""&&(o.innerText=a),o.setAttribute(de,o.getAttribute(de)||o.disabled),o.setAttribute("disabled",""))}return[r,e,i]}componentID(e){let t=e.getAttribute&&e.getAttribute(F);return t?parseInt(t):null}targetComponentID(e,t,i={}){if(X(t))return t;let r=i.target||e.getAttribute(this.binding("target"));return X(r)?parseInt(r):t&&(r!==null||i.target)?this.closestComponentID(t):null}closestComponentID(e){return X(e)?e:e?q(e.closest(`[${F}]`),t=>this.ownsElement(t)&&this.componentID(t)):null}pushHookEvent(e,t,i,r,n){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",i,r]),!1;let[o,a,l]=this.putRef([e],"hook");return this.pushWithReply(()=>[o,a,l],"event",{type:"hook",event:i,value:r,cid:this.closestComponentID(t)},(d,f)=>n(f,o)),o}extractMeta(e,t,i){let r=this.binding("value-");for(let n=0;n<e.attributes.length;n++){t||(t={});let o=e.attributes[n].name;o.startsWith(r)&&(t[o.replace(r,"")]=e.getAttribute(o))}if(e.value!==void 0&&!(e instanceof HTMLFormElement)&&(t||(t={}),t.value=e.value,e.tagName==="INPUT"&&Ge.indexOf(e.type)>=0&&!e.checked&&delete t.value),i){t||(t={});for(let n in i)t[n]=i[n]}return t}pushEvent(e,t,i,r,n,o={},a){this.pushWithReply(()=>this.putRef([t],e,o),"event",{type:e,event:r,value:this.extractMeta(t,n,o.value),cid:this.targetComponentID(t,i,o)},(l,d)=>a&&a(d))}pushFileProgress(e,t,i,r=function(){}){this.liveSocket.withinOwners(e.form,(n,o)=>{n.pushWithReply(null,"progress",{event:e.getAttribute(n.binding(Kt)),ref:e.getAttribute(U),entry_ref:t,progress:i,cid:n.targetComponentID(e.form,o)},r)})}pushInput(e,t,i,r,n,o){let a,l=X(i)?i:this.targetComponentID(e.form,t,n),d=()=>this.putRef([e,e.form],"change",n),f,c=this.extractMeta(e.form);e instanceof HTMLButtonElement&&(c.submitter=e),e.getAttribute(this.binding("change"))?f=ot(e.form,N({_target:n._target},c),[e.name]):f=ot(e.form,N({_target:n._target},c)),h.isUploadInput(e)&&e.files&&e.files.length>0&&P.trackFiles(e,Array.from(e.files)),a=P.serializeUploads(e);let m={type:"form",event:r,value:f,uploads:a,cid:l};this.pushWithReply(d,"event",m,g=>{if(h.isUploadInput(e)&&h.isAutoUpload(e)){if(P.filesAwaitingPreflight(e).length>0){let[p,v]=d();this.undoRefs(p,[e.form]),this.uploadFiles(e.form,t,p,l,_=>{o&&o(g),this.triggerAwaitingSubmit(e.form),this.undoRefs(p)})}}else o&&o(g)})}triggerAwaitingSubmit(e){let t=this.getScheduledSubmit(e);if(t){let[i,r,n,o]=t;this.cancelSubmit(e),o()}}getScheduledSubmit(e){return this.formSubmits.find(([t,i,r,n])=>t.isSameNode(e))}scheduleSubmit(e,t,i,r){if(this.getScheduledSubmit(e))return!0;this.formSubmits.push([e,t,i,r])}cancelSubmit(e){this.formSubmits=this.formSubmits.filter(([t,i,r])=>t.isSameNode(e)?(this.undoRefs(i),!1):!0)}disableForm(e,t={}){let i=c=>!(ce(c,`${this.binding(we)}=ignore`,c.form)||ce(c,"data-phx-update=ignore",c.form)),r=c=>c.hasAttribute(this.binding(Le)),n=c=>c.tagName=="BUTTON",o=c=>["INPUT","TEXTAREA","SELECT"].includes(c.tagName),a=Array.from(e.elements),l=a.filter(r),d=a.filter(n).filter(i),f=a.filter(o).filter(i);return d.forEach(c=>{c.setAttribute(de,c.disabled),c.disabled=!0}),f.forEach(c=>{c.setAttribute(ze,c.readOnly),c.readOnly=!0,c.files&&(c.setAttribute(de,c.disabled),c.disabled=!0)}),e.setAttribute(this.binding(pt),""),this.putRef([e].concat(l).concat(d).concat(f),"submit",t)}pushFormSubmit(e,t,i,r,n,o){let a=()=>this.disableForm(e,Dt(N({},n),{form:e,submitter:r})),l=this.targetComponentID(e,t);if(P.hasUploadsInProgress(e)){let[d,f]=a(),c=()=>this.pushFormSubmit(e,t,i,r,n,o);return this.scheduleSubmit(e,d,n,c)}else if(P.inputsAwaitingPreflight(e).length>0){let[d,f]=a(),c=()=>[d,f,n];this.uploadFiles(e,t,d,l,m=>{if(P.inputsAwaitingPreflight(e).length>0)return this.undoRefs(d);let g=this.extractMeta(e),p=ot(e,N({submitter:r},g));this.pushWithReply(c,"event",{type:"form",event:i,value:p,cid:l},o)})}else if(!(e.hasAttribute(T)&&e.classList.contains("phx-submit-loading"))){let d=this.extractMeta(e),f=ot(e,N({submitter:r},d));this.pushWithReply(a,"event",{type:"form",event:i,value:f,cid:l},o)}}uploadFiles(e,t,i,r,n){let o=this.joinCount,a=P.activeFileInputs(e),l=a.length;a.forEach(d=>{let f=new P(d,this,()=>{l--,l===0&&n()}),c=f.entries().map(g=>g.toPreflightPayload());if(c.length===0){l--;return}let m={ref:d.getAttribute(U),entries:c,cid:this.targetComponentID(d.form,t)};this.log("upload",()=>["sending preflight request",m]),this.pushWithReply(null,"allow_upload",m,g=>{if(this.log("upload",()=>["got preflight response",g]),f.entries().forEach(p=>{g.entries&&!g.entries[p.ref]&&this.handleFailedEntryPreflight(p.ref,"failed preflight",f)}),g.error||Object.keys(g.entries).length===0)this.undoRefs(i),(g.error||[]).map(([v,_])=>{this.handleFailedEntryPreflight(v,_,f)});else{let p=v=>{this.channel.onError(()=>{this.joinCount===o&&v()})};f.initAdapterUpload(g,p,this.liveSocket)}})})}handleFailedEntryPreflight(e,t,i){if(i.isAutoUpload()){let r=i.entries().find(n=>n.ref===e.toString());r&&r.cancel()}else i.entries().map(r=>r.cancel());this.log("upload",()=>[`error for entry ${e}`,t])}dispatchUploads(e,t,i){let r=this.targetCtxElement(e)||this.el,n=h.findUploadInputs(r).filter(o=>o.name===t);n.length===0?k(`no live file inputs found matching the name "${t}"`):n.length>1?k(`duplicate live file inputs found matching the name "${t}"`):h.dispatchEvent(n[0],je,{detail:{files:i}})}targetCtxElement(e){if(X(e)){let[t]=h.findComponentNodeList(this.el,e);return t}else return e||null}pushFormRecovery(e,t,i,r){let n=this.binding("change"),o=t.getAttribute(this.binding("target"))||t,a=t.getAttribute(this.binding(bt))||t.getAttribute(this.binding("change")),l=Array.from(e.elements).filter(c=>h.isFormInput(c)&&c.name&&!c.hasAttribute(n));if(l.length===0)return;l.forEach(c=>c.hasAttribute(U)&&P.clearFiles(c));let d=l.find(c=>c.type!=="hidden")||l[0],f=0;this.withinTargets(o,(c,m)=>{let g=this.targetComponentID(t,m);f++,c.pushInput(d,m,g,a,{_target:d.name},()=>{f--,f===0&&r()})},i,i)}pushLinkPatch(e,t,i){let r=this.liveSocket.setPendingLink(e),n=t?()=>this.putRef([t],"click"):null,o=()=>this.liveSocket.redirect(window.location.href),a=e.startsWith("/")?`${location.protocol}//${location.host}${e}`:e,l=this.pushWithReply(n,"live_patch",{url:a},d=>{this.liveSocket.requestDOMUpdate(()=>{d.link_redirect?this.liveSocket.replaceMain(e,null,i,r):(this.liveSocket.commitPendingLink(r)&&(this.href=e),this.applyPendingUpdates(),i&&i(r))})});l?l.receive("timeout",o):o()}getFormsForRecovery(){if(this.joinCount===0)return{};let e=this.binding("change");return h.all(this.el,`form[${e}]`).filter(t=>t.id).filter(t=>t.elements.length>0).filter(t=>t.getAttribute(this.binding(bt))!=="ignore").map(t=>t.cloneNode(!0)).reduce((t,i)=>(t[i.id]=i,t),{})}maybePushComponentsDestroyed(e){let t=e.filter(i=>h.findComponentNodeList(this.el,i).length===0);t.length>0&&(t.forEach(i=>this.rendered.resetRender(i)),this.pushWithReply(null,"cids_will_destroy",{cids:t},()=>{this.liveSocket.requestDOMUpdate(()=>{let i=t.filter(r=>h.findComponentNodeList(this.el,r).length===0);i.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:i},r=>{this.rendered.pruneCIDs(r.cids)})})}))}ownsElement(e){let t=e.closest(Q);return e.getAttribute(Y)===this.id||t&&t.id===this.id||!t&&this.isDead}submitForm(e,t,i,r,n={}){h.putPrivate(e,he,!0),Array.from(e.elements).forEach(a=>h.putPrivate(a,he,!0)),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(e,t,i,r,n,()=>{this.liveSocket.restorePreviouslyActiveFocus()})}binding(e){return this.liveSocket.binding(e)}};var Ai=s=>h.isUsedInput(s),at=class{constructor(e,t,i={}){if(this.unloaded=!1,!t||t.constructor.name==="Object")throw new Error(`
a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example:
import {Socket} from "phoenix"
import {LiveSocket} from "phoenix_live_view"
let liveSocket = new LiveSocket("/live", Socket, {...})
`);this.socket=new t(e,i),this.bindingPrefix=i.bindingPrefix||Yt,this.opts=i,this.params=xe(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(Ce(Zt),i.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.outgoingMainEl=null,this.clickStartedAtTarget=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=Ce(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||Gt,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||Nt,this.reloadJitterMin=i.reloadJitterMin||Ft,this.reloadJitterMax=i.reloadJitterMax||Ut,this.failsafeJitter=i.failsafeJitter||Mt,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.serverCloseRef=null,this.domCallbacks=Object.assign({onPatchStart:xe(),onPatchEnd:xe(),onNodeAdded:xe(),onBeforeElUpdated:xe()},i.dom||{}),this.transitions=new Ei,window.addEventListener("pagehide",r=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.0.0-rc.2"}isProfileEnabled(){return this.sessionStorage.getItem(Ze)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(He)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(He)==="false"}enableDebug(){this.sessionStorage.setItem(He,"true")}enableProfiling(){this.sessionStorage.setItem(Ze,"true")}disableDebug(){this.sessionStorage.setItem(He,"false")}disableProfiling(){this.sessionStorage.removeItem(Ze)}enableLatencySim(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(et,e)}disableLatencySim(){this.sessionStorage.removeItem(et)}getLatencySim(){let e=this.sessionStorage.getItem(et);return e?parseInt(e):null}getSocket(){return this.socket}connect(){window.location.hostname==="localhost"&&!this.isDebugDisabled()&&this.enableDebug();let e=()=>{this.joinRootViews()?(this.bindTopLevelEvents(),this.socket.connect()):this.main?this.socket.connect():this.bindTopLevelEvents({dead:!0}),this.joinDeadView()};["complete","loaded","interactive"].indexOf(document.readyState)>=0?e():document.addEventListener("DOMContentLoaded",()=>e())}disconnect(e){clearTimeout(this.reloadWithJitterTimer),this.serverCloseRef&&(this.socket.off(this.serverCloseRef),this.serverCloseRef=null),this.socket.disconnect(e)}replaceTransport(e){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(e),this.connect()}execJS(e,t,i=null){this.owner(e,r=>B.exec(i,t,r,e))}execJSHookPush(e,t,i,r){this.withinOwners(e,n=>{B.exec("hook",t,n,e,["push",{data:i,callback:r}])})}unload(){this.unloaded||(this.main&&this.isConnected()&&this.log(this.main,"socket",()=>["disconnect for page nav"]),this.unloaded=!0,this.destroyAllViews(),this.disconnect())}triggerDOM(e,t){this.domCallbacks[e](...t)}time(e,t){if(!this.isProfileEnabled()||!console.time)return t();console.time(e);let i=t();return console.timeEnd(e),i}log(e,t,i){if(this.viewLogger){let[r,n]=i();this.viewLogger(e,t,r,n)}else if(this.isDebugEnabled()){let[r,n]=i();ii(e,t,r,n)}}requestDOMUpdate(e){this.transitions.after(e)}transition(e,t,i=function(){}){this.transitions.addTransition(e,t,i)}onChannel(e,t,i){e.on(t,r=>{let n=this.getLatencySim();n?setTimeout(()=>i(r),n):i(r)})}wrapPush(e,t,i){let r=this.getLatencySim(),n=e.joinCount;if(!r)return this.isConnected()&&t.timeout?i().receive("timeout",()=>{e.joinCount===n&&!e.isDestroyed()&&this.reloadWithJitter(e,()=>{this.log(e,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):i();let o={receives:[],receive(a,l){this.receives.push([a,l])}};return setTimeout(()=>{e.isDestroyed()||o.receives.reduce((a,[l,d])=>a.receive(l,d),i())},r),o}reloadWithJitter(e,t){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,r=this.reloadJitterMax,n=Math.floor(Math.random()*(r-i+1))+i,o=$.updateLocal(this.localStorage,window.location.pathname,Be,0,a=>a+1);o>this.maxReloads&&(n=this.failsafeJitter),this.reloadWithJitterTimer=setTimeout(()=>{e.isDestroyed()||e.isConnected()||(e.destroy(),t?t():this.log(e,"join",()=>[`encountered ${o} consecutive reloads`]),o>this.maxReloads&&this.log(e,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),this.hasPendingLink()?window.location=this.pendingLink:window.location.reload())},n)}getHookCallbacks(e){return e&&e.startsWith("Phoenix.")?ui[e.split(".")[1]]:this.hooks[e]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(e){return`${this.getBindingPrefix()}${e}`}channel(e,t){return this.socket.channel(e,t)}joinDeadView(){let e=document.body;if(e&&!this.isPhxView(e)&&!this.isPhxView(document.firstElementChild)){let t=this.newRootView(e);t.setHref(this.getHref()),t.joinDead(),this.main||(this.main=t),window.requestAnimationFrame(()=>t.execNewMounted())}}joinRootViews(){let e=!1;return h.all(document,`${Q}:not([${Y}])`,t=>{if(!this.getRootById(t.id)){let i=this.newRootView(t);i.setHref(this.getHref()),i.join(),t.hasAttribute(Se)&&(this.main=i)}e=!0}),e}redirect(e,t){this.unload(),$.redirect(e,t)}replaceMain(e,t,i=null,r=this.setPendingLink(e)){let n=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let o=h.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(o,t,n),this.main.setRedirect(e),this.transitionRemoves(null,!0),this.main.join((a,l)=>{a===1&&this.commitPendingLink(r)&&this.requestDOMUpdate(()=>{h.findPhxSticky(document).forEach(d=>o.appendChild(d)),this.outgoingMainEl.replaceWith(o),this.outgoingMainEl=null,i&&i(r),l()})})}transitionRemoves(e,t){let i=this.binding("remove");if(e=e||h.all(document,`[${i}]`),t){let r=h.findPhxSticky(document)||[];e=e.filter(n=>!h.isChildOfAny(n,r))}e.forEach(r=>{this.execJS(r,r.getAttribute(i),"remove")})}isPhxView(e){return e.getAttribute&&e.getAttribute(D)!==null}newRootView(e,t,i){let r=new ke(e,this,null,t,i);return this.roots[r.id]=r,r}owner(e,t){let i=q(e.closest(Q),r=>this.getViewByEl(r))||this.main;i&&t(i)}withinOwners(e,t){this.owner(e,i=>t(i,e))}getViewByEl(e){let t=e.getAttribute(M);return q(this.getRootById(t),i=>i.getDescendentByEl(e))}getRootById(e){return this.roots[e]}destroyAllViews(){for(let e in this.roots)this.roots[e].destroy(),delete this.roots[e];this.main=null}destroyViewByEl(e){let t=this.getRootById(e.getAttribute(M));t&&t.id===e.id?(t.destroy(),delete this.roots[t.id]):t&&t.destroyDescendent(e.id)}setActiveElement(e){if(this.activeElement===e)return;this.activeElement=e;let t=()=>{e===this.activeElement&&(this.activeElement=null),e.removeEventListener("mouseup",this),e.removeEventListener("touchend",this)};e.addEventListener("mouseup",t),e.addEventListener("touchend",t)}getActiveElement(){return document.activeElement===document.body?this.activeElement||document.activeElement:document.activeElement||document.body}dropActiveElement(e){this.prevActive&&e.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive.blur()}bindTopLevelEvents({dead:e}={}){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.serverCloseRef=this.socket.onClose(t=>{if(t&&t.code===1e3&&this.main)return this.reloadWithJitter(this.main)}),document.body.addEventListener("click",function(){}),window.addEventListener("pageshow",t=>{t.persisted&&(this.getSocket().disconnect(),this.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())},!0),e||this.bindNav(),this.bindClicks(),e||this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(t,i,r,n,o,a)=>{let l=n.getAttribute(this.binding(qt)),d=t.key&&t.key.toLowerCase();if(l&&l.toLowerCase()!==d)return;let f=N({key:t.key},this.eventMeta(i,t,n));B.exec(i,o,r,n,["push",{data:f}])}),this.bind({blur:"focusout",focus:"focusin"},(t,i,r,n,o,a)=>{if(!a){let l=N({key:t.key},this.eventMeta(i,t,n));B.exec(i,o,r,n,["push",{data:l}])}}),this.bind({blur:"blur",focus:"focus"},(t,i,r,n,o,a)=>{if(a==="window"){let l=this.eventMeta(i,t,n);B.exec(i,o,r,n,["push",{data:l}])}}),window.addEventListener("dragover",t=>t.preventDefault()),window.addEventListener("drop",t=>{t.preventDefault();let i=q(ce(t.target,this.binding(ut)),o=>o.getAttribute(this.binding(ut))),r=i&&document.getElementById(i),n=Array.from(t.dataTransfer.files||[]);!r||r.disabled||n.length===0||!(r.files instanceof FileList)||(P.trackFiles(r,n,t.dataTransfer),r.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(je,t=>{let i=t.target;if(!h.isUploadInput(i))return;let r=Array.from(t.detail.files||[]).filter(n=>n instanceof File||n instanceof Blob);P.trackFiles(i,r),i.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(e,t,i){let r=this.metadataCallbacks[e];return r?r(t,i):{}}setPendingLink(e){return this.linkRef++,this.pendingLink=e,this.linkRef}commitPendingLink(e){return this.linkRef!==e?!1:(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(e,t){for(let i in e){let r=e[i];this.on(r,n=>{let o=this.binding(i),a=this.binding(`window-${i}`),l=n.target.getAttribute&&n.target.getAttribute(o);l?this.debounce(n.target,n,r,()=>{this.withinOwners(n.target,d=>{t(n,i,d,n.target,l,null)})}):h.all(document,`[${a}]`,d=>{let f=d.getAttribute(a);this.debounce(d,n,r,()=>{this.withinOwners(d,c=>{t(n,i,c,d,f,"window")})})})})}}bindClicks(){window.addEventListener("mousedown",e=>this.clickStartedAtTarget=e.target),this.bindClick("click","click")}bindClick(e,t){let i=this.binding(t);window.addEventListener(e,r=>{let n=null;r.detail===0&&(this.clickStartedAtTarget=r.target);let o=this.clickStartedAtTarget||r.target;n=ce(o,i),this.dispatchClickAway(r,o),this.clickStartedAtTarget=null;let a=n&&n.getAttribute(i);if(!a){h.isNewPageClick(r,window.location)&&this.unload();return}n.getAttribute("href")==="#"&&r.preventDefault(),!n.hasAttribute(T)&&this.debounce(n,r,"click",()=>{this.withinOwners(n,l=>{B.exec("click",a,l,n,["push",{data:this.eventMeta("click",r,n)}])})})},!1)}dispatchClickAway(e,t){let i=this.binding("click-away");h.all(document,`[${i}]`,r=>{r.isSameNode(t)||r.contains(t)||this.withinOwners(r,n=>{let o=r.getAttribute(i);B.isVisible(r)&&B.isInViewport(r)&&B.exec("click",o,n,r,["push",{data:this.eventMeta("click",e,e.target)}])})})}bindNav(){if(!$.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let e=null;window.addEventListener("scroll",t=>{clearTimeout(e),e=setTimeout(()=>{$.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:i,id:r,root:n,scroll:o}=t.state||{},a=window.location.href;h.dispatchEvent(window,"phx:navigate",{detail:{href:a,patch:i==="patch",pop:!0}}),this.requestDOMUpdate(()=>{this.main.isConnected()&&i==="patch"&&r===this.main.id?this.main.pushLinkPatch(a,null,()=>{this.maybeScroll(o)}):this.replaceMain(a,null,()=>{n&&this.replaceRootHistory(),this.maybeScroll(o)})})},!1),window.addEventListener("click",t=>{let i=ce(t.target,Je),r=i&&i.getAttribute(Je);if(!r||!this.isConnected()||!this.main||h.wantsNewTab(t))return;let n=i.href instanceof SVGAnimatedString?i.href.baseVal:i.href,o=i.getAttribute($t);t.preventDefault(),t.stopImmediatePropagation(),this.pendingLink!==n&&this.requestDOMUpdate(()=>{if(r==="patch")this.pushHistoryPatch(n,o,i);else if(r==="redirect")this.historyRedirect(n,o);else throw new Error(`expected ${Je} to be "patch" or "redirect", got: ${r}`);let a=i.getAttribute(this.binding("click"));a&&this.requestDOMUpdate(()=>this.execJS(i,a,"click"))})},!1)}maybeScroll(e){typeof e=="number"&&requestAnimationFrame(()=>{window.scrollTo(0,e)})}dispatchEvent(e,t={}){h.dispatchEvent(window,`phx:${e}`,{detail:t})}dispatchEvents(e){e.forEach(([t,i])=>this.dispatchEvent(t,i))}withPageLoading(e,t){h.dispatchEvent(window,"phx:page-loading-start",{detail:e});let i=()=>h.dispatchEvent(window,"phx:page-loading-stop",{detail:e});return t?t(i):i}pushHistoryPatch(e,t,i){if(!this.isConnected()||!this.main.isMain())return $.redirect(e);this.withPageLoading({to:e,kind:"patch"},r=>{this.main.pushLinkPatch(e,i,n=>{this.historyPatch(e,t,n),r()})})}historyPatch(e,t,i=this.setPendingLink(e)){!this.commitPendingLink(i)||($.pushState(t,{type:"patch",id:this.main.id},e),h.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:e,pop:!1}}),this.registerNewLocation(window.location))}historyRedirect(e,t,i){if(!this.isConnected()||!this.main.isMain())return $.redirect(e,i);if(/^\/$|^\/[^\/]+.*$/.test(e)){let{protocol:n,host:o}=window.location;e=`${n}//${o}${e}`}let r=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},n=>{this.replaceMain(e,i,o=>{o===this.linkRef&&($.pushState(t,{type:"redirect",id:this.main.id,scroll:r},e),h.dispatchEvent(window,"phx:navigate",{detail:{href:e,patch:!1,pop:!1}}),this.registerNewLocation(window.location)),n()})})}replaceRootHistory(){$.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(e){let{pathname:t,search:i}=this.currentLocation;return t+i===e.pathname+e.search?!1:(this.currentLocation=Ce(e),!0)}bindForms(){let e=0,t=!1;this.on("submit",i=>{let r=i.target.getAttribute(this.binding("submit")),n=i.target.getAttribute(this.binding("change"));!t&&n&&!r&&(t=!0,i.preventDefault(),this.withinOwners(i.target,o=>{o.disableForm(i.target),window.requestAnimationFrame(()=>{h.isUnloadableFormSubmit(i)&&this.unload(),i.target.submit()})}))},!0),this.on("submit",i=>{let r=i.target.getAttribute(this.binding("submit"));if(!r){h.isUnloadableFormSubmit(i)&&this.unload();return}i.preventDefault(),i.target.disabled=!0,this.withinOwners(i.target,n=>{B.exec("submit",r,n,i.target,["push",{submitter:i.submitter}])})},!1);for(let i of["change","input"])this.on(i,r=>{let n=this.binding("change"),o=r.target,a=o.getAttribute(n),l=o.form&&o.form.getAttribute(n),d=a||l;if(!d||o.type==="number"&&o.validity&&o.validity.badInput)return;let f=a?o:o.form,c=e;e++;let{at:m,type:g}=h.private(o,"prev-iteration")||{};m===c-1&&i==="change"&&g==="input"||(h.putPrivate(o,"prev-iteration",{at:c,type:i}),this.debounce(o,r,i,()=>{this.withinOwners(f,p=>{h.putPrivate(o,le,!0),h.isTextualInput(o)||this.setActiveElement(o),B.exec("change",d,p,o,["push",{_target:r.target.name,dispatcher:f}])})}))},!1);this.on("reset",i=>{let r=i.target;h.resetForm(r);let n=Array.from(r.elements).find(o=>o.type==="reset");n&&window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(e,t,i,r){if(i==="blur"||i==="focusout")return r();let n=this.binding(jt),o=this.binding(Wt),a=this.defaults.debounce.toString(),l=this.defaults.throttle.toString();this.withinOwners(e,d=>{let f=()=>!d.isDestroyed()&&document.body.contains(e);h.debounce(e,t,n,a,o,l,f,()=>{r()})})}silenceEvents(e){this.silenced=!0,e(),this.silenced=!1}on(e,t){window.addEventListener(e,i=>{this.silenced||t(i)})}},Ei=class{constructor(){this.transitions=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(e=>{clearTimeout(e),this.transitions.delete(e)}),this.flushPendingOps()}after(e){this.size()===0?e():this.pushPendingOp(e)}addTransition(e,t,i){t();let r=setTimeout(()=>{this.transitions.delete(r),i(),this.flushPendingOps()},e);this.transitions.add(r)}pushPendingOp(e){this.pendingOps.push(e)}size(){return this.transitions.size}flushPendingOps(){if(this.size()>0)return;let e=this.pendingOps.shift();e&&(e(),this.flushPendingOps())}};return Ki;})();