phoenix_live_view 1.1.29 → 1.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/js/phoenix_live_view/hooks.js +1 -1
- package/package.json +1 -1
- package/priv/static/phoenix_live_view.cjs.js +2 -2
- package/priv/static/phoenix_live_view.cjs.js.map +2 -2
- package/priv/static/phoenix_live_view.esm.js +2 -2
- package/priv/static/phoenix_live_view.esm.js.map +2 -2
- package/priv/static/phoenix_live_view.js +2 -2
- package/priv/static/phoenix_live_view.min.js +2 -2
|
@@ -1477,7 +1477,7 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
|
|
|
1477
1477
|
}
|
|
1478
1478
|
},
|
|
1479
1479
|
updated() {
|
|
1480
|
-
if (!this.scrollContainer.isConnected) {
|
|
1480
|
+
if (this.scrollContainer && !this.scrollContainer.isConnected) {
|
|
1481
1481
|
this.destroyed();
|
|
1482
1482
|
this.mounted();
|
|
1483
1483
|
}
|
|
@@ -5992,7 +5992,7 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
|
|
|
5992
5992
|
}
|
|
5993
5993
|
// public
|
|
5994
5994
|
version() {
|
|
5995
|
-
return "1.1.
|
|
5995
|
+
return "1.1.30";
|
|
5996
5996
|
}
|
|
5997
5997
|
isProfileEnabled() {
|
|
5998
5998
|
return this.sessionStorage.getItem(PHX_LV_PROFILE) === "true";
|
|
@@ -5,7 +5,7 @@ var LiveView=(()=>{var ht=Object.defineProperty,Fi=Object.defineProperties,Ui=Ob
|
|
|
5
5
|
|
|
6
6
|
removing illegal node: "${(i.outerHTML||i.nodeValue).trim()}"
|
|
7
7
|
|
|
8
|
-
`),t.push(i))}),t.forEach(i=>i.remove())}},replaceRootContainer(s,e,t){let i=new Set(["id",K,re,De,G]);if(s.tagName.toLowerCase()===e.toLowerCase())return Array.from(s.attributes).filter(n=>!i.has(n.name.toLowerCase())).forEach(n=>s.removeAttribute(n.name)),Object.keys(t).filter(n=>!i.has(n.toLowerCase())).forEach(n=>s.setAttribute(n,t[n])),s;{let n=document.createElement(e);return Object.keys(t).forEach(r=>n.setAttribute(r,t[r])),i.forEach(r=>n.setAttribute(r,s.getAttribute(r))),n.innerHTML=s.innerHTML,s.replaceWith(n),n}},getSticky(s,e,t){let i=(Ce.private(s,"sticky")||[]).find(([n])=>e===n);if(i){let[n,r,o]=i;return o}else return typeof t=="function"?t():t},deleteSticky(s,e){this.updatePrivate(s,"sticky",[],t=>t.filter(([i,n])=>i!==e))},putSticky(s,e,t){let i=t(s);this.updatePrivate(s,"sticky",[],n=>{let r=n.findIndex(([o])=>e===o);return r>=0?n[r]=[e,t,i]:n.push([e,t,i]),n})},applyStickyOperations(s){let e=Ce.private(s,"sticky");e&&e.forEach(([t,i,n])=>this.putSticky(s,t,i))},isLocked(s){return s.hasAttribute&&s.hasAttribute(C)},attributeIgnored(s,e){return e.some(t=>s.name==t||t==="*"||t.includes("*")&&s.name.match(t)!=null)}},c=Ce;var pe=class{static isActive(e,t){let i=t._phxRef===void 0,r=e.getAttribute(Ge).split(",").indexOf(R.genFileRef(t))>=0;return t.size>0&&(i||r)}static isPreflighted(e,t){return e.getAttribute(Oe).split(",").indexOf(R.genFileRef(t))>=0&&this.isActive(e,t)}static isPreflightInProgress(e){return e._preflightInProgress===!0}static markPreflightInProgress(e){e._preflightInProgress=!0}constructor(e,t,i,n){this.ref=R.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(Le,this._onElUpdated),this.autoUpload=n}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,()=>{R.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(Le,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),this.isAutoUpload()||R.clearFiles(this.fileEl)}isAutoUpload(){return this.autoUpload}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(Le,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(Ge).split(",").indexOf(this.ref)===-1&&(R.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]||w(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:yi}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||w(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}};var Ki=0,R=class s{static genFileRef(e){let t=e._phxRef;return t!==void 0?t:(e._phxRef=(Ki++).toString(),e._phxRef)}static getEntryDataURL(e,t,i){let n=this.activeFiles(e).find(r=>this.genFileRef(r)===t);i(URL.createObjectURL(n))}static hasUploadsInProgress(e){let t=0;return c.findUploadInputs(e).forEach(i=>{i.getAttribute(Oe)!==i.getAttribute(ti)&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(n=>{let r={path:e.name},o=e.getAttribute(q);i[o]=i[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()),i[o].push(r)}),i}static clearFiles(e){e.value=null,e.removeAttribute(q),c.putPrivate(e,"files",[])}static untrackFile(e,t){c.putPrivate(e,"files",c.private(e,"files").filter(i=>!Object.is(i,t)))}static trackFiles(e,t,i){if(e.getAttribute("multiple")!==null){let n=t.filter(r=>!this.activeFiles(e).find(o=>Object.is(o,r)));c.updatePrivate(e,"files",[],r=>r.concat(n)),e.value=null}else i&&i.files.length>0&&(e.files=i.files),c.putPrivate(e,"files",t)}static activeFileInputs(e){let t=c.findUploadInputs(e);return Array.from(t).filter(i=>i.files&&this.activeFiles(i).length>0)}static activeFiles(e){return(c.private(e,"files")||[]).filter(t=>pe.isActive(e,t))}static inputsAwaitingPreflight(e){let t=c.findUploadInputs(e);return Array.from(t).filter(i=>this.filesAwaitingPreflight(i).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(t=>!pe.isPreflighted(e,t)&&!pe.isPreflightInProgress(t))}static markPreflightInProgress(e){e.forEach(t=>pe.markPreflightInProgress(t.file))}constructor(e,t,i){this.autoUpload=c.isAutoUpload(e),this.view=t,this.onComplete=i,this._entries=Array.from(s.filesAwaitingPreflight(e)||[]).map(n=>new pe(e,n,t,this.autoUpload)),s.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(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(i.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,t,e,i)}}};var qi={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&&s.getAttribute("aria-hidden")!=="true"||!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))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}}},B=qi;var wi={LiveFileUpload:{activeRefs(){return this.el.getAttribute(Ge)},preflightedRefs(){return this.el.getAttribute(Oe)},mounted(){this.js().ignoreAttributes(this.el,["value"]),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(Le))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(q)),R.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",s=>{if(!s.relatedTarget||!this.el.contains(s.relatedTarget)){let e=s.target.nextElementSibling;B.attemptFocus(e)||B.focusFirst(e)}else B.focusLast(this.el)}),this.focusEnd.addEventListener("focus",s=>{if(!s.relatedTarget||!this.el.contains(s.relatedTarget)){let e=s.target.previousElementSibling;B.attemptFocus(e)||B.focusLast(e)}else B.focusFirst(this.el)}),this.el.contains(document.activeElement)||(this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&B.focusFirst(this.el))}}},Pi=s=>["HTML","BODY"].indexOf(s.nodeName.toUpperCase())>=0?null:["scroll","auto"].indexOf(getComputedStyle(s).overflowY)>=0?s:Pi(s.parentElement),_i=s=>s?s.scrollTop:document.documentElement.scrollTop||document.body.scrollTop,Vt=s=>s?s.getBoundingClientRect().bottom:window.innerHeight||document.documentElement.clientHeight,jt=s=>s?s.getBoundingClientRect().top:0,Gi=(s,e)=>{let t=s.getBoundingClientRect();return Math.ceil(t.top)>=jt(e)&&Math.floor(t.top)<=Vt(e)},zi=(s,e)=>{let t=s.getBoundingClientRect();return Math.ceil(t.bottom)>=jt(e)&&Math.floor(t.bottom)<=Vt(e)},Si=(s,e)=>{let t=s.getBoundingClientRect();return Math.ceil(t.top)>=jt(e)&&Math.floor(t.top)<=Vt(e)};wi.InfiniteScroll={mounted(){this.scrollContainer=Pi(this.el);let s=_i(this.scrollContainer),e=!1,t=500,i=null,n=this.throttle(t,(a,l)=>{i=()=>!0,this.liveSocket.js().push(this.el,a,{value:{id:l.id,_overran:!0},callback:()=>{i=null}})}),r=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"start"}),this.liveSocket.js().push(this.el,a,{value:{id:l.id},callback:()=>{i=null,window.requestAnimationFrame(()=>{Si(l,this.scrollContainer)||l.scrollIntoView({block:"start"})})}})}),o=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"end"}),this.liveSocket.js().push(this.el,a,{value:{id:l.id},callback:()=>{i=null,window.requestAnimationFrame(()=>{Si(l,this.scrollContainer)||l.scrollIntoView({block:"end"})})}})});this.onScroll=a=>{let l=_i(this.scrollContainer);if(i)return s=l,i();let h=this.findOverrunTarget(),d=this.el.getAttribute(this.liveSocket.binding("viewport-top")),p=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),m=this.el.lastElementChild,g=this.el.firstElementChild,u=l<s,v=l>s;u&&d&&!e&&h.top>=0?(e=!0,n(d,g)):v&&e&&h.top<=0&&(e=!1),d&&u&&Gi(g,this.scrollContainer)?r(d,g):p&&v&&zi(m,this.scrollContainer)&&o(p,m),s=l},this.scrollContainer?this.scrollContainer.addEventListener("scroll",this.onScroll):window.addEventListener("scroll",this.onScroll)},updated(){this.scrollContainer.isConnected||(this.destroyed(),this.mounted())},destroyed(){this.scrollContainer?this.scrollContainer.removeEventListener("scroll",this.onScroll):window.removeEventListener("scroll",this.onScroll)},throttle(s,e){let t=0,i;return(...n)=>{let r=Date.now(),o=s-(r-t);o<=0||o>s?(i&&(clearTimeout(i),i=null),t=r,e(...n)):i||(i=setTimeout(()=>{t=Date.now(),i=null,e(...n)},o))}},findOverrunTarget(){let s,e=this.el.getAttribute(this.liveSocket.binding(ii));if(e){let t=document.getElementById(e);if(t)s=t.getBoundingClientRect();else throw new Error("did not find element with id "+e)}else s=this.el.getBoundingClientRect();return s}};var ki=wi;var ye=class{static onUnlock(e,t){if(!c.isLocked(e)&&!e.closest(`[${C}]`))return t();let i=e.closest(`[${C}]`),n=i.closest(`[${C}]`).getAttribute(C);i.addEventListener(`phx:undo-lock:${n}`,()=>{t()},{once:!0})}constructor(e){this.el=e,this.loadingRef=e.hasAttribute(ve)?parseInt(e.getAttribute(ve),10):null,this.lockRef=e.hasAttribute(C)?parseInt(e.getAttribute(C),10):null}maybeUndo(e,t,i){if(!this.isWithin(e)){c.updatePrivate(this.el,Ct,[],n=>(n.push(e),n));return}this.undoLocks(e,t,i),this.undoLoading(e,t),c.updatePrivate(this.el,Ct,[],n=>n.filter(r=>{let o={detail:{ref:r,event:t},bubbles:!0,cancelable:!1};return this.loadingRef&&this.loadingRef>r&&this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${r}`,o)),this.lockRef&&this.lockRef>r&&this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${r}`,o)),r>e})),this.isFullyResolvedBy(e)&&this.el.removeAttribute(F)}isWithin(e){return!(this.loadingRef!==null&&this.loadingRef>e&&this.lockRef!==null&&this.lockRef>e)}undoLocks(e,t,i){if(!this.isLockUndoneBy(e))return;let n=c.private(this.el,C);n&&(i(n),c.deletePrivate(this.el,C)),this.el.removeAttribute(C);let r={detail:{ref:e,event:t},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${this.lockRef}`,r))}undoLoading(e,t){if(!this.isLoadingUndoneBy(e)){this.canUndoLoading(e)&&this.el.classList.contains("phx-submit-loading")&&this.el.classList.remove("phx-change-loading");return}if(this.canUndoLoading(e)){this.el.removeAttribute(ve);let i=this.el.getAttribute(Ee),n=this.el.getAttribute(et);n!==null&&(this.el.readOnly=n==="true",this.el.removeAttribute(et)),i!==null&&(this.el.disabled=i==="true",this.el.removeAttribute(Ee));let r=this.el.getAttribute(Ne);r!==null&&(this.el.textContent=r,this.el.removeAttribute(Ne));let o={detail:{ref:e,event:t},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${this.loadingRef}`,o))}ut.forEach(i=>{(i!=="phx-submit-loading"||this.canUndoLoading(e))&&c.removeClass(this.el,i)})}isLoadingUndoneBy(e){return this.loadingRef===null?!1:this.loadingRef<=e}isLockUndoneBy(e){return this.lockRef===null?!1:this.lockRef<=e}isFullyResolvedBy(e){return(this.loadingRef===null||this.loadingRef<=e)&&(this.lockRef===null||this.lockRef<=e)}canUndoLoading(e){return this.lockRef===null||this.lockRef<=e}};var st=class{constructor(e,t,i){let n=new Set,r=new Set([...t.children].map(a=>a.id)),o=[];Array.from(e.children).forEach(a=>{if(a.id&&(n.add(a.id),r.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=[...r].filter(a=>!n.has(a))}perform(){let e=c.byId(this.containerId);e&&(this.elementsToModify.forEach(t=>{t.previousElementId?fe(document.getElementById(t.previousElementId),i=>{fe(document.getElementById(t.elementId),n=>{n.previousElementSibling&&n.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",n)})}):fe(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(t=>{fe(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))}))}};var Ti=11;function Yi(s,e){var t=e.attributes,i,n,r,o,a;if(!(e.nodeType===Ti||s.nodeType===Ti)){for(var l=t.length-1;l>=0;l--)i=t[l],n=i.name,r=i.namespaceURI,o=i.value,r?(n=i.localName||n,a=s.getAttributeNS(r,n),a!==o&&(i.prefix==="xmlns"&&(n=i.name),s.setAttributeNS(r,n,o))):(a=s.getAttribute(n),a!==o&&s.setAttribute(n,o));for(var h=s.attributes,d=h.length-1;d>=0;d--)i=h[d],n=i.name,r=i.namespaceURI,r?(n=i.localName||n,e.hasAttributeNS(r,n)||s.removeAttributeNS(r,n)):e.hasAttribute(n)||s.removeAttribute(n)}}var At,Qi="http://www.w3.org/1999/xhtml",V=typeof document=="undefined"?void 0:document,Zi=!!V&&"content"in V.createElement("template"),en=!!V&&V.createRange&&"createContextualFragment"in V.createRange();function tn(s){var e=V.createElement("template");return e.innerHTML=s,e.content.childNodes[0]}function nn(s){At||(At=V.createRange(),At.selectNode(V.body));var e=At.createContextualFragment(s);return e.childNodes[0]}function sn(s){var e=V.createElement("body");return e.innerHTML=s,e.childNodes[0]}function rn(s){return s=s.trim(),Zi?tn(s):en?nn(s):sn(s)}function _t(s,e){var t=s.nodeName,i=e.nodeName,n,r;return t===i?!0:(n=t.charCodeAt(0),r=i.charCodeAt(0),n<=90&&r>=97?t===i.toUpperCase():r<=90&&n>=97?i===t.toUpperCase():!1)}function on(s,e){return!e||e===Qi?V.createElement(s):V.createElementNS(e,s)}function an(s,e){for(var t=s.firstChild;t;){var i=t.nextSibling;e.appendChild(t),t=i}return e}function Jt(s,e,t){s[t]!==e[t]&&(s[t]=e[t],s[t]?s.setAttribute(t,""):s.removeAttribute(t))}var Ci={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)}Jt(s,e,"selected")},INPUT:function(s,e){Jt(s,e,"checked"),Jt(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 n=i.nodeValue;if(n==t||!t&&n==s.placeholder)return;i.nodeValue=t}},SELECT:function(s,e){if(!e.hasAttribute("multiple")){for(var t=-1,i=0,n=s.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")){t=i;break}i++}n=n.nextSibling,!n&&r&&(n=r.nextSibling,r=null)}s.selectedIndex=t}}},rt=1,Ri=11,xi=3,Ii=8;function Ae(){}function ln(s){if(s)return s.getAttribute&&s.getAttribute("id")||s.id}function cn(s){return function(t,i,n){if(n||(n={}),typeof i=="string")if(t.nodeName==="#document"||t.nodeName==="HTML"){var r=i;i=V.createElement("html"),i.innerHTML=r}else if(t.nodeName==="BODY"){var o=i;i=V.createElement("html"),i.innerHTML=o;var a=i.querySelector("body");a&&(i=a)}else i=rn(i);else i.nodeType===Ri&&(i=i.firstElementChild);var l=n.getNodeKey||ln,h=n.onBeforeNodeAdded||Ae,d=n.onNodeAdded||Ae,p=n.onBeforeElUpdated||Ae,m=n.onElUpdated||Ae,g=n.onBeforeNodeDiscarded||Ae,u=n.onNodeDiscarded||Ae,v=n.onBeforeElChildrenUpdated||Ae,E=n.skipFromChildren||Ae,D=n.addChild||function(y,A){return y.appendChild(A)},j=n.childrenOnly===!0,U=Object.create(null),_=[];function k(y){_.push(y)}function I(y,A){if(y.nodeType===rt)for(var O=y.firstChild;O;){var P=void 0;A&&(P=l(O))?k(P):(u(O),O.firstChild&&I(O,A)),O=O.nextSibling}}function Q(y,A,O){g(y)!==!1&&(A&&A.removeChild(y),u(y),I(y,O))}function f(y){if(y.nodeType===rt||y.nodeType===Ri)for(var A=y.firstChild;A;){var O=l(A);O&&(U[O]=A),f(A),A=A.nextSibling}}f(t);function b(y){d(y);for(var A=y.firstChild;A;){var O=A.nextSibling,P=l(A);if(P){var T=U[P];T&&_t(A,T)?(A.parentNode.replaceChild(T,A),J(T,A)):b(A)}else b(A);A=O}}function N(y,A,O){for(;A;){var P=A.nextSibling;(O=l(A))?k(O):Q(A,y,!0),A=P}}function J(y,A,O){var P=l(A);if(P&&delete U[P],!O){var T=p(y,A);if(T===!1||(T instanceof HTMLElement&&(y=T,f(y)),s(y,A),m(y),v(y,A)===!1))return}y.nodeName!=="TEXTAREA"?M(y,A):Ci.TEXTAREA(y,A)}function M(y,A){var O=E(y,A),P=A.firstChild,T=y.firstChild,xe,ae,Ie,lt,me;e:for(;P;){for(lt=P.nextSibling,xe=l(P);!O&&T;){if(Ie=T.nextSibling,P.isSameNode&&P.isSameNode(T)){P=lt,T=Ie;continue e}ae=l(T);var ct=T.nodeType,ge=void 0;if(ct===P.nodeType&&(ct===rt?(xe?xe!==ae&&((me=U[xe])?Ie===me?ge=!1:(y.insertBefore(me,T),ae?k(ae):Q(T,y,!0),T=me,ae=l(T)):ge=!1):ae&&(ge=!1),ge=ge!==!1&&_t(T,P),ge&&J(T,P)):(ct===xi||ct==Ii)&&(ge=!0,T.nodeValue!==P.nodeValue&&(T.nodeValue=P.nodeValue))),ge){P=lt,T=Ie;continue e}ae?k(ae):Q(T,y,!0),T=Ie}if(xe&&(me=U[xe])&&_t(me,P))O||D(y,me),J(me,P);else{var Tt=h(P);Tt!==!1&&(Tt&&(P=Tt),P.actualize&&(P=P.actualize(y.ownerDocument||V)),D(y,P),b(P))}P=lt,T=Ie}N(y,T,ae);var Gt=Ci[y.nodeName];Gt&&Gt(y,A)}var H=t,ne=H.nodeType,qt=i.nodeType;if(!j){if(ne===rt)qt===rt?_t(t,i)||(u(t),H=an(t,on(i.nodeName,i.namespaceURI))):H=i;else if(ne===xi||ne===Ii){if(qt===ne)return H.nodeValue!==i.nodeValue&&(H.nodeValue=i.nodeValue),H;H=i}}if(H===i)u(t);else{if(i.isSameNode&&i.isSameNode(H))return;if(J(H,i,j),_)for(var Pt=0,Mi=_.length;Pt<Mi;Pt++){var kt=U[_[Pt]];kt&&Q(kt,kt.parentNode,!1)}}return!j&&H!==t&&t.parentNode&&(H.actualize&&(H=H.actualize(t.ownerDocument||V)),t.parentNode.replaceChild(H,t)),H}}var hn=cn(Yi),ot=hn;var _e=class{constructor(e,t,i,n,r,o,a={}){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=n,this.streams=r,this.streamInserts={},this.streamComponentRestore={},this.targetCID=o,this.cidPatch=Z(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.targetContainer=this.isCIDPatch()?this.targetCIDContainer(n):t,this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]},this.withChildren=a.withChildren||a.undoRef!==void 0||!1,this.undoRef=a.undoRef}before(e,t){this.callbacks[`before${e}`].push(t)}after(e,t){this.callbacks[`after${e}`].push(t)}trackBefore(e,...t){this.callbacks[`before${e}`].forEach(i=>i(...t))}trackAfter(e,...t){this.callbacks[`after${e}`].forEach(i=>i(...t))}markPrunableContentForRemoval(){let e=this.liveSocket.binding(Fe);c.all(this.container,`[${e}=append] > *, [${e}=prepend] > *`,t=>{t.setAttribute(Rt,"")})}perform(e){let{view:t,liveSocket:i,html:n,container:r}=this,o=this.targetContainer;if(this.isCIDPatch()&&!this.targetContainer)return;if(this.isCIDPatch()){let _=o.closest(`[${C}]`);if(_&&!_.isSameNode(o)){let k=c.private(_,C);if(k&&(o=k.querySelector(`[data-phx-component="${this.targetCID}"]`),!o))return}}let a=i.getActiveElement(),{selectionStart:l,selectionEnd:h}=a&&c.hasSelectionRange(a)?a:{},d=i.binding(Fe),p=i.binding(Ye),m=i.binding(Qe),g=i.binding(ni),u=[],v=[],E=[],D=[],j=null,U=(_,k,I=this.withChildren)=>{let Q={childrenOnly:_.getAttribute(W)===null&&!I,getNodeKey:f=>c.isPhxDestroyed(f)?null:e?f.id:c.private(f,"clientsideIdAttribute")?f.getAttribute&&f.getAttribute(ze):f.id||f.getAttribute&&f.getAttribute(ze),skipFromChildren:f=>f.getAttribute(d)===Ue,addChild:(f,b)=>{let{ref:N,streamAt:J}=this.getStreamInsert(b);if(N===void 0)return f.appendChild(b);if(this.setStreamRef(b,N),J===0)f.insertAdjacentElement("afterbegin",b);else if(J===-1){let M=f.lastElementChild;if(M&&!M.hasAttribute(Xe)){let H=Array.from(f.children).find(ne=>!ne.hasAttribute(Xe));f.insertBefore(b,H)}else f.appendChild(b)}else if(J>0){let M=Array.from(f.children)[J];f.insertBefore(b,M)}},onBeforeNodeAdded:f=>{var N;if((N=this.getStreamInsert(f))!=null&&N.updateOnly&&!this.streamComponentRestore[f.id])return!1;c.maintainPrivateHooks(f,f,p,m),this.trackBefore("added",f);let b=f;return this.streamComponentRestore[f.id]&&(b=this.streamComponentRestore[f.id],delete this.streamComponentRestore[f.id],U(b,f,!0)),b},onNodeAdded:f=>{f.getAttribute&&this.maybeReOrderStream(f,!0),c.isPortalTemplate(f)&&D.push(()=>this.teleport(f,U)),f instanceof HTMLImageElement&&f.srcset?f.srcset=f.srcset:f instanceof HTMLVideoElement&&f.autoplay&&f.play(),c.isNowTriggerFormExternal(f,g)&&(j=f),(c.isPhxChild(f)&&t.ownsElement(f)||c.isPhxSticky(f)&&t.ownsElement(f.parentNode))&&this.trackAfter("phxChildAdded",f),f.nodeName==="SCRIPT"&&f.hasAttribute(Be)&&this.handleRuntimeHook(f,k),u.push(f)},onNodeDiscarded:f=>this.onNodeDiscarded(f),onBeforeNodeDiscarded:f=>{if(f.getAttribute&&f.getAttribute(Rt)!==null)return!0;if(f.parentElement!==null&&f.id&&c.isPhxUpdate(f.parentElement,d,[Ue,"append","prepend"])||f.getAttribute&&f.getAttribute(oe)||this.maybePendingRemove(f)||this.skipCIDSibling(f))return!1;if(c.isPortalTemplate(f)){let b=document.getElementById(f.content.firstElementChild.id);b&&(b.remove(),Q.onNodeDiscarded(b),this.view.dropPortalElementId(b.id))}return!0},onElUpdated:f=>{c.isNowTriggerFormExternal(f,g)&&(j=f),v.push(f),this.maybeReOrderStream(f,!1)},onBeforeElUpdated:(f,b)=>{if(f.id&&f.isSameNode(_)&&f.id!==b.id)return Q.onNodeDiscarded(f),f.replaceWith(b),Q.onNodeAdded(b);c.syncPendingAttrs(f,b),c.maintainPrivateHooks(f,b,p,m),c.cleanChildNodes(b,d);let N=a&&f.isSameNode(a)&&c.isFormInput(f),J=N&&this.isChangedSelect(f,b);if(this.skipCIDSibling(b))return this.maybeCloneLockedElement(f,N),this.copyNestedPrivateLock(f,b),this.maybeReOrderStream(f),!1;if(c.isPhxSticky(f))return[K,re,G].map(M=>[M,f.getAttribute(M),b.getAttribute(M)]).forEach(([M,H,ne])=>{ne&&H!==ne&&f.setAttribute(M,ne)}),!1;if(c.isIgnored(f,d)||f.form&&f.form.isSameNode(j))return this.trackBefore("updated",f,b),c.mergeAttrs(f,b,{isIgnored:c.isIgnored(f,d)}),v.push(f),c.applyStickyOperations(f),!1;if(f.type==="number"&&f.validity&&f.validity.badInput)return!1;if(f=this.maybeCloneLockedElement(f,N),c.isPhxChild(b)){let M=f.getAttribute(K);return c.mergeAttrs(f,b,{exclude:[re]}),M!==""&&f.setAttribute(K,M),f.setAttribute(G,this.rootID),c.applyStickyOperations(f),!1}return this.copyNestedPrivateLock(f,b),c.copyPrivates(b,f),c.isPortalTemplate(b)?(D.push(()=>this.teleport(b,U)),f.content.replaceChildren(b.content.cloneNode(!0)),!1):N&&f.type!=="hidden"&&!J?(this.trackBefore("updated",f,b),c.mergeFocusedInput(f,b),c.syncAttrsToProps(f),v.push(f),c.applyStickyOperations(f),!1):(J&&f.blur(),c.isPhxUpdate(b,d,["append","prepend"])&&E.push(new st(f,b,b.getAttribute(d))),c.syncAttrsToProps(b),c.applyStickyOperations(b),this.trackBefore("updated",f,b),f)}};ot(_,k,Q)};if(this.trackBefore("added",r),this.trackBefore("updated",r,r),i.time("morphdom",()=>{this.streams.forEach(([k,I,Q,f])=>{I.forEach(([b,N,J,M])=>{this.streamInserts[b]={ref:k,streamAt:N,limit:J,reset:f,updateOnly:M}}),f!==void 0&&c.all(document,`[${Xe}="${k}"]`,b=>{this.removeStreamChildElement(b)}),Q.forEach(b=>{let N=document.getElementById(b);N&&this.removeStreamChildElement(N)})}),e&&c.all(this.container,`[${d}=${Ue}]`).filter(k=>this.view.ownsElement(k)).forEach(k=>{Array.from(k.children).forEach(I=>{this.removeStreamChildElement(I,!0)})}),U(o,n);let _=0;for(;D.length>0&&_<5;){let k=D.slice();D=[],k.forEach(I=>I()),_++}this.view.portalElementIds.forEach(k=>{let I=document.getElementById(k);I&&(document.getElementById(I.getAttribute(ee))||(I.remove(),this.onNodeDiscarded(I),this.view.dropPortalElementId(k)))})}),i.isDebugEnabled()&&(gi(),vi(this.streamInserts),Array.from(document.querySelectorAll("input[name=id]")).forEach(_=>{_ instanceof HTMLInputElement&&_.form&&console.error(`Detected an input with name="id" inside a form! This will cause problems when patching the DOM.
|
|
8
|
+
`),t.push(i))}),t.forEach(i=>i.remove())}},replaceRootContainer(s,e,t){let i=new Set(["id",K,re,De,G]);if(s.tagName.toLowerCase()===e.toLowerCase())return Array.from(s.attributes).filter(n=>!i.has(n.name.toLowerCase())).forEach(n=>s.removeAttribute(n.name)),Object.keys(t).filter(n=>!i.has(n.toLowerCase())).forEach(n=>s.setAttribute(n,t[n])),s;{let n=document.createElement(e);return Object.keys(t).forEach(r=>n.setAttribute(r,t[r])),i.forEach(r=>n.setAttribute(r,s.getAttribute(r))),n.innerHTML=s.innerHTML,s.replaceWith(n),n}},getSticky(s,e,t){let i=(Ce.private(s,"sticky")||[]).find(([n])=>e===n);if(i){let[n,r,o]=i;return o}else return typeof t=="function"?t():t},deleteSticky(s,e){this.updatePrivate(s,"sticky",[],t=>t.filter(([i,n])=>i!==e))},putSticky(s,e,t){let i=t(s);this.updatePrivate(s,"sticky",[],n=>{let r=n.findIndex(([o])=>e===o);return r>=0?n[r]=[e,t,i]:n.push([e,t,i]),n})},applyStickyOperations(s){let e=Ce.private(s,"sticky");e&&e.forEach(([t,i,n])=>this.putSticky(s,t,i))},isLocked(s){return s.hasAttribute&&s.hasAttribute(C)},attributeIgnored(s,e){return e.some(t=>s.name==t||t==="*"||t.includes("*")&&s.name.match(t)!=null)}},c=Ce;var pe=class{static isActive(e,t){let i=t._phxRef===void 0,r=e.getAttribute(Ge).split(",").indexOf(R.genFileRef(t))>=0;return t.size>0&&(i||r)}static isPreflighted(e,t){return e.getAttribute(Oe).split(",").indexOf(R.genFileRef(t))>=0&&this.isActive(e,t)}static isPreflightInProgress(e){return e._preflightInProgress===!0}static markPreflightInProgress(e){e._preflightInProgress=!0}constructor(e,t,i,n){this.ref=R.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(Le,this._onElUpdated),this.autoUpload=n}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,()=>{R.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(Le,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),this.isAutoUpload()||R.clearFiles(this.fileEl)}isAutoUpload(){return this.autoUpload}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(Le,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(Ge).split(",").indexOf(this.ref)===-1&&(R.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]||w(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:yi}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||w(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}};var Ki=0,R=class s{static genFileRef(e){let t=e._phxRef;return t!==void 0?t:(e._phxRef=(Ki++).toString(),e._phxRef)}static getEntryDataURL(e,t,i){let n=this.activeFiles(e).find(r=>this.genFileRef(r)===t);i(URL.createObjectURL(n))}static hasUploadsInProgress(e){let t=0;return c.findUploadInputs(e).forEach(i=>{i.getAttribute(Oe)!==i.getAttribute(ti)&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(n=>{let r={path:e.name},o=e.getAttribute(q);i[o]=i[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()),i[o].push(r)}),i}static clearFiles(e){e.value=null,e.removeAttribute(q),c.putPrivate(e,"files",[])}static untrackFile(e,t){c.putPrivate(e,"files",c.private(e,"files").filter(i=>!Object.is(i,t)))}static trackFiles(e,t,i){if(e.getAttribute("multiple")!==null){let n=t.filter(r=>!this.activeFiles(e).find(o=>Object.is(o,r)));c.updatePrivate(e,"files",[],r=>r.concat(n)),e.value=null}else i&&i.files.length>0&&(e.files=i.files),c.putPrivate(e,"files",t)}static activeFileInputs(e){let t=c.findUploadInputs(e);return Array.from(t).filter(i=>i.files&&this.activeFiles(i).length>0)}static activeFiles(e){return(c.private(e,"files")||[]).filter(t=>pe.isActive(e,t))}static inputsAwaitingPreflight(e){let t=c.findUploadInputs(e);return Array.from(t).filter(i=>this.filesAwaitingPreflight(i).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(t=>!pe.isPreflighted(e,t)&&!pe.isPreflightInProgress(t))}static markPreflightInProgress(e){e.forEach(t=>pe.markPreflightInProgress(t.file))}constructor(e,t,i){this.autoUpload=c.isAutoUpload(e),this.view=t,this.onComplete=i,this._entries=Array.from(s.filesAwaitingPreflight(e)||[]).map(n=>new pe(e,n,t,this.autoUpload)),s.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(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(i.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,t,e,i)}}};var qi={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&&s.getAttribute("aria-hidden")!=="true"||!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))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}}},B=qi;var wi={LiveFileUpload:{activeRefs(){return this.el.getAttribute(Ge)},preflightedRefs(){return this.el.getAttribute(Oe)},mounted(){this.js().ignoreAttributes(this.el,["value"]),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(Le))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(q)),R.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",s=>{if(!s.relatedTarget||!this.el.contains(s.relatedTarget)){let e=s.target.nextElementSibling;B.attemptFocus(e)||B.focusFirst(e)}else B.focusLast(this.el)}),this.focusEnd.addEventListener("focus",s=>{if(!s.relatedTarget||!this.el.contains(s.relatedTarget)){let e=s.target.previousElementSibling;B.attemptFocus(e)||B.focusLast(e)}else B.focusFirst(this.el)}),this.el.contains(document.activeElement)||(this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&B.focusFirst(this.el))}}},Pi=s=>["HTML","BODY"].indexOf(s.nodeName.toUpperCase())>=0?null:["scroll","auto"].indexOf(getComputedStyle(s).overflowY)>=0?s:Pi(s.parentElement),_i=s=>s?s.scrollTop:document.documentElement.scrollTop||document.body.scrollTop,Vt=s=>s?s.getBoundingClientRect().bottom:window.innerHeight||document.documentElement.clientHeight,jt=s=>s?s.getBoundingClientRect().top:0,Gi=(s,e)=>{let t=s.getBoundingClientRect();return Math.ceil(t.top)>=jt(e)&&Math.floor(t.top)<=Vt(e)},zi=(s,e)=>{let t=s.getBoundingClientRect();return Math.ceil(t.bottom)>=jt(e)&&Math.floor(t.bottom)<=Vt(e)},Si=(s,e)=>{let t=s.getBoundingClientRect();return Math.ceil(t.top)>=jt(e)&&Math.floor(t.top)<=Vt(e)};wi.InfiniteScroll={mounted(){this.scrollContainer=Pi(this.el);let s=_i(this.scrollContainer),e=!1,t=500,i=null,n=this.throttle(t,(a,l)=>{i=()=>!0,this.liveSocket.js().push(this.el,a,{value:{id:l.id,_overran:!0},callback:()=>{i=null}})}),r=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"start"}),this.liveSocket.js().push(this.el,a,{value:{id:l.id},callback:()=>{i=null,window.requestAnimationFrame(()=>{Si(l,this.scrollContainer)||l.scrollIntoView({block:"start"})})}})}),o=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"end"}),this.liveSocket.js().push(this.el,a,{value:{id:l.id},callback:()=>{i=null,window.requestAnimationFrame(()=>{Si(l,this.scrollContainer)||l.scrollIntoView({block:"end"})})}})});this.onScroll=a=>{let l=_i(this.scrollContainer);if(i)return s=l,i();let h=this.findOverrunTarget(),d=this.el.getAttribute(this.liveSocket.binding("viewport-top")),p=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),m=this.el.lastElementChild,g=this.el.firstElementChild,u=l<s,v=l>s;u&&d&&!e&&h.top>=0?(e=!0,n(d,g)):v&&e&&h.top<=0&&(e=!1),d&&u&&Gi(g,this.scrollContainer)?r(d,g):p&&v&&zi(m,this.scrollContainer)&&o(p,m),s=l},this.scrollContainer?this.scrollContainer.addEventListener("scroll",this.onScroll):window.addEventListener("scroll",this.onScroll)},updated(){this.scrollContainer&&!this.scrollContainer.isConnected&&(this.destroyed(),this.mounted())},destroyed(){this.scrollContainer?this.scrollContainer.removeEventListener("scroll",this.onScroll):window.removeEventListener("scroll",this.onScroll)},throttle(s,e){let t=0,i;return(...n)=>{let r=Date.now(),o=s-(r-t);o<=0||o>s?(i&&(clearTimeout(i),i=null),t=r,e(...n)):i||(i=setTimeout(()=>{t=Date.now(),i=null,e(...n)},o))}},findOverrunTarget(){let s,e=this.el.getAttribute(this.liveSocket.binding(ii));if(e){let t=document.getElementById(e);if(t)s=t.getBoundingClientRect();else throw new Error("did not find element with id "+e)}else s=this.el.getBoundingClientRect();return s}};var ki=wi;var ye=class{static onUnlock(e,t){if(!c.isLocked(e)&&!e.closest(`[${C}]`))return t();let i=e.closest(`[${C}]`),n=i.closest(`[${C}]`).getAttribute(C);i.addEventListener(`phx:undo-lock:${n}`,()=>{t()},{once:!0})}constructor(e){this.el=e,this.loadingRef=e.hasAttribute(ve)?parseInt(e.getAttribute(ve),10):null,this.lockRef=e.hasAttribute(C)?parseInt(e.getAttribute(C),10):null}maybeUndo(e,t,i){if(!this.isWithin(e)){c.updatePrivate(this.el,Ct,[],n=>(n.push(e),n));return}this.undoLocks(e,t,i),this.undoLoading(e,t),c.updatePrivate(this.el,Ct,[],n=>n.filter(r=>{let o={detail:{ref:r,event:t},bubbles:!0,cancelable:!1};return this.loadingRef&&this.loadingRef>r&&this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${r}`,o)),this.lockRef&&this.lockRef>r&&this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${r}`,o)),r>e})),this.isFullyResolvedBy(e)&&this.el.removeAttribute(F)}isWithin(e){return!(this.loadingRef!==null&&this.loadingRef>e&&this.lockRef!==null&&this.lockRef>e)}undoLocks(e,t,i){if(!this.isLockUndoneBy(e))return;let n=c.private(this.el,C);n&&(i(n),c.deletePrivate(this.el,C)),this.el.removeAttribute(C);let r={detail:{ref:e,event:t},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${this.lockRef}`,r))}undoLoading(e,t){if(!this.isLoadingUndoneBy(e)){this.canUndoLoading(e)&&this.el.classList.contains("phx-submit-loading")&&this.el.classList.remove("phx-change-loading");return}if(this.canUndoLoading(e)){this.el.removeAttribute(ve);let i=this.el.getAttribute(Ee),n=this.el.getAttribute(et);n!==null&&(this.el.readOnly=n==="true",this.el.removeAttribute(et)),i!==null&&(this.el.disabled=i==="true",this.el.removeAttribute(Ee));let r=this.el.getAttribute(Ne);r!==null&&(this.el.textContent=r,this.el.removeAttribute(Ne));let o={detail:{ref:e,event:t},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${this.loadingRef}`,o))}ut.forEach(i=>{(i!=="phx-submit-loading"||this.canUndoLoading(e))&&c.removeClass(this.el,i)})}isLoadingUndoneBy(e){return this.loadingRef===null?!1:this.loadingRef<=e}isLockUndoneBy(e){return this.lockRef===null?!1:this.lockRef<=e}isFullyResolvedBy(e){return(this.loadingRef===null||this.loadingRef<=e)&&(this.lockRef===null||this.lockRef<=e)}canUndoLoading(e){return this.lockRef===null||this.lockRef<=e}};var st=class{constructor(e,t,i){let n=new Set,r=new Set([...t.children].map(a=>a.id)),o=[];Array.from(e.children).forEach(a=>{if(a.id&&(n.add(a.id),r.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=[...r].filter(a=>!n.has(a))}perform(){let e=c.byId(this.containerId);e&&(this.elementsToModify.forEach(t=>{t.previousElementId?fe(document.getElementById(t.previousElementId),i=>{fe(document.getElementById(t.elementId),n=>{n.previousElementSibling&&n.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",n)})}):fe(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(t=>{fe(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))}))}};var Ti=11;function Yi(s,e){var t=e.attributes,i,n,r,o,a;if(!(e.nodeType===Ti||s.nodeType===Ti)){for(var l=t.length-1;l>=0;l--)i=t[l],n=i.name,r=i.namespaceURI,o=i.value,r?(n=i.localName||n,a=s.getAttributeNS(r,n),a!==o&&(i.prefix==="xmlns"&&(n=i.name),s.setAttributeNS(r,n,o))):(a=s.getAttribute(n),a!==o&&s.setAttribute(n,o));for(var h=s.attributes,d=h.length-1;d>=0;d--)i=h[d],n=i.name,r=i.namespaceURI,r?(n=i.localName||n,e.hasAttributeNS(r,n)||s.removeAttributeNS(r,n)):e.hasAttribute(n)||s.removeAttribute(n)}}var At,Qi="http://www.w3.org/1999/xhtml",V=typeof document=="undefined"?void 0:document,Zi=!!V&&"content"in V.createElement("template"),en=!!V&&V.createRange&&"createContextualFragment"in V.createRange();function tn(s){var e=V.createElement("template");return e.innerHTML=s,e.content.childNodes[0]}function nn(s){At||(At=V.createRange(),At.selectNode(V.body));var e=At.createContextualFragment(s);return e.childNodes[0]}function sn(s){var e=V.createElement("body");return e.innerHTML=s,e.childNodes[0]}function rn(s){return s=s.trim(),Zi?tn(s):en?nn(s):sn(s)}function _t(s,e){var t=s.nodeName,i=e.nodeName,n,r;return t===i?!0:(n=t.charCodeAt(0),r=i.charCodeAt(0),n<=90&&r>=97?t===i.toUpperCase():r<=90&&n>=97?i===t.toUpperCase():!1)}function on(s,e){return!e||e===Qi?V.createElement(s):V.createElementNS(e,s)}function an(s,e){for(var t=s.firstChild;t;){var i=t.nextSibling;e.appendChild(t),t=i}return e}function Jt(s,e,t){s[t]!==e[t]&&(s[t]=e[t],s[t]?s.setAttribute(t,""):s.removeAttribute(t))}var Ci={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)}Jt(s,e,"selected")},INPUT:function(s,e){Jt(s,e,"checked"),Jt(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 n=i.nodeValue;if(n==t||!t&&n==s.placeholder)return;i.nodeValue=t}},SELECT:function(s,e){if(!e.hasAttribute("multiple")){for(var t=-1,i=0,n=s.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")){t=i;break}i++}n=n.nextSibling,!n&&r&&(n=r.nextSibling,r=null)}s.selectedIndex=t}}},rt=1,Ri=11,xi=3,Ii=8;function Ae(){}function ln(s){if(s)return s.getAttribute&&s.getAttribute("id")||s.id}function cn(s){return function(t,i,n){if(n||(n={}),typeof i=="string")if(t.nodeName==="#document"||t.nodeName==="HTML"){var r=i;i=V.createElement("html"),i.innerHTML=r}else if(t.nodeName==="BODY"){var o=i;i=V.createElement("html"),i.innerHTML=o;var a=i.querySelector("body");a&&(i=a)}else i=rn(i);else i.nodeType===Ri&&(i=i.firstElementChild);var l=n.getNodeKey||ln,h=n.onBeforeNodeAdded||Ae,d=n.onNodeAdded||Ae,p=n.onBeforeElUpdated||Ae,m=n.onElUpdated||Ae,g=n.onBeforeNodeDiscarded||Ae,u=n.onNodeDiscarded||Ae,v=n.onBeforeElChildrenUpdated||Ae,E=n.skipFromChildren||Ae,D=n.addChild||function(y,A){return y.appendChild(A)},j=n.childrenOnly===!0,U=Object.create(null),_=[];function k(y){_.push(y)}function I(y,A){if(y.nodeType===rt)for(var O=y.firstChild;O;){var P=void 0;A&&(P=l(O))?k(P):(u(O),O.firstChild&&I(O,A)),O=O.nextSibling}}function Q(y,A,O){g(y)!==!1&&(A&&A.removeChild(y),u(y),I(y,O))}function f(y){if(y.nodeType===rt||y.nodeType===Ri)for(var A=y.firstChild;A;){var O=l(A);O&&(U[O]=A),f(A),A=A.nextSibling}}f(t);function b(y){d(y);for(var A=y.firstChild;A;){var O=A.nextSibling,P=l(A);if(P){var T=U[P];T&&_t(A,T)?(A.parentNode.replaceChild(T,A),J(T,A)):b(A)}else b(A);A=O}}function N(y,A,O){for(;A;){var P=A.nextSibling;(O=l(A))?k(O):Q(A,y,!0),A=P}}function J(y,A,O){var P=l(A);if(P&&delete U[P],!O){var T=p(y,A);if(T===!1||(T instanceof HTMLElement&&(y=T,f(y)),s(y,A),m(y),v(y,A)===!1))return}y.nodeName!=="TEXTAREA"?M(y,A):Ci.TEXTAREA(y,A)}function M(y,A){var O=E(y,A),P=A.firstChild,T=y.firstChild,xe,ae,Ie,lt,me;e:for(;P;){for(lt=P.nextSibling,xe=l(P);!O&&T;){if(Ie=T.nextSibling,P.isSameNode&&P.isSameNode(T)){P=lt,T=Ie;continue e}ae=l(T);var ct=T.nodeType,ge=void 0;if(ct===P.nodeType&&(ct===rt?(xe?xe!==ae&&((me=U[xe])?Ie===me?ge=!1:(y.insertBefore(me,T),ae?k(ae):Q(T,y,!0),T=me,ae=l(T)):ge=!1):ae&&(ge=!1),ge=ge!==!1&&_t(T,P),ge&&J(T,P)):(ct===xi||ct==Ii)&&(ge=!0,T.nodeValue!==P.nodeValue&&(T.nodeValue=P.nodeValue))),ge){P=lt,T=Ie;continue e}ae?k(ae):Q(T,y,!0),T=Ie}if(xe&&(me=U[xe])&&_t(me,P))O||D(y,me),J(me,P);else{var Tt=h(P);Tt!==!1&&(Tt&&(P=Tt),P.actualize&&(P=P.actualize(y.ownerDocument||V)),D(y,P),b(P))}P=lt,T=Ie}N(y,T,ae);var Gt=Ci[y.nodeName];Gt&&Gt(y,A)}var H=t,ne=H.nodeType,qt=i.nodeType;if(!j){if(ne===rt)qt===rt?_t(t,i)||(u(t),H=an(t,on(i.nodeName,i.namespaceURI))):H=i;else if(ne===xi||ne===Ii){if(qt===ne)return H.nodeValue!==i.nodeValue&&(H.nodeValue=i.nodeValue),H;H=i}}if(H===i)u(t);else{if(i.isSameNode&&i.isSameNode(H))return;if(J(H,i,j),_)for(var Pt=0,Mi=_.length;Pt<Mi;Pt++){var kt=U[_[Pt]];kt&&Q(kt,kt.parentNode,!1)}}return!j&&H!==t&&t.parentNode&&(H.actualize&&(H=H.actualize(t.ownerDocument||V)),t.parentNode.replaceChild(H,t)),H}}var hn=cn(Yi),ot=hn;var _e=class{constructor(e,t,i,n,r,o,a={}){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=n,this.streams=r,this.streamInserts={},this.streamComponentRestore={},this.targetCID=o,this.cidPatch=Z(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.targetContainer=this.isCIDPatch()?this.targetCIDContainer(n):t,this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]},this.withChildren=a.withChildren||a.undoRef!==void 0||!1,this.undoRef=a.undoRef}before(e,t){this.callbacks[`before${e}`].push(t)}after(e,t){this.callbacks[`after${e}`].push(t)}trackBefore(e,...t){this.callbacks[`before${e}`].forEach(i=>i(...t))}trackAfter(e,...t){this.callbacks[`after${e}`].forEach(i=>i(...t))}markPrunableContentForRemoval(){let e=this.liveSocket.binding(Fe);c.all(this.container,`[${e}=append] > *, [${e}=prepend] > *`,t=>{t.setAttribute(Rt,"")})}perform(e){let{view:t,liveSocket:i,html:n,container:r}=this,o=this.targetContainer;if(this.isCIDPatch()&&!this.targetContainer)return;if(this.isCIDPatch()){let _=o.closest(`[${C}]`);if(_&&!_.isSameNode(o)){let k=c.private(_,C);if(k&&(o=k.querySelector(`[data-phx-component="${this.targetCID}"]`),!o))return}}let a=i.getActiveElement(),{selectionStart:l,selectionEnd:h}=a&&c.hasSelectionRange(a)?a:{},d=i.binding(Fe),p=i.binding(Ye),m=i.binding(Qe),g=i.binding(ni),u=[],v=[],E=[],D=[],j=null,U=(_,k,I=this.withChildren)=>{let Q={childrenOnly:_.getAttribute(W)===null&&!I,getNodeKey:f=>c.isPhxDestroyed(f)?null:e?f.id:c.private(f,"clientsideIdAttribute")?f.getAttribute&&f.getAttribute(ze):f.id||f.getAttribute&&f.getAttribute(ze),skipFromChildren:f=>f.getAttribute(d)===Ue,addChild:(f,b)=>{let{ref:N,streamAt:J}=this.getStreamInsert(b);if(N===void 0)return f.appendChild(b);if(this.setStreamRef(b,N),J===0)f.insertAdjacentElement("afterbegin",b);else if(J===-1){let M=f.lastElementChild;if(M&&!M.hasAttribute(Xe)){let H=Array.from(f.children).find(ne=>!ne.hasAttribute(Xe));f.insertBefore(b,H)}else f.appendChild(b)}else if(J>0){let M=Array.from(f.children)[J];f.insertBefore(b,M)}},onBeforeNodeAdded:f=>{var N;if((N=this.getStreamInsert(f))!=null&&N.updateOnly&&!this.streamComponentRestore[f.id])return!1;c.maintainPrivateHooks(f,f,p,m),this.trackBefore("added",f);let b=f;return this.streamComponentRestore[f.id]&&(b=this.streamComponentRestore[f.id],delete this.streamComponentRestore[f.id],U(b,f,!0)),b},onNodeAdded:f=>{f.getAttribute&&this.maybeReOrderStream(f,!0),c.isPortalTemplate(f)&&D.push(()=>this.teleport(f,U)),f instanceof HTMLImageElement&&f.srcset?f.srcset=f.srcset:f instanceof HTMLVideoElement&&f.autoplay&&f.play(),c.isNowTriggerFormExternal(f,g)&&(j=f),(c.isPhxChild(f)&&t.ownsElement(f)||c.isPhxSticky(f)&&t.ownsElement(f.parentNode))&&this.trackAfter("phxChildAdded",f),f.nodeName==="SCRIPT"&&f.hasAttribute(Be)&&this.handleRuntimeHook(f,k),u.push(f)},onNodeDiscarded:f=>this.onNodeDiscarded(f),onBeforeNodeDiscarded:f=>{if(f.getAttribute&&f.getAttribute(Rt)!==null)return!0;if(f.parentElement!==null&&f.id&&c.isPhxUpdate(f.parentElement,d,[Ue,"append","prepend"])||f.getAttribute&&f.getAttribute(oe)||this.maybePendingRemove(f)||this.skipCIDSibling(f))return!1;if(c.isPortalTemplate(f)){let b=document.getElementById(f.content.firstElementChild.id);b&&(b.remove(),Q.onNodeDiscarded(b),this.view.dropPortalElementId(b.id))}return!0},onElUpdated:f=>{c.isNowTriggerFormExternal(f,g)&&(j=f),v.push(f),this.maybeReOrderStream(f,!1)},onBeforeElUpdated:(f,b)=>{if(f.id&&f.isSameNode(_)&&f.id!==b.id)return Q.onNodeDiscarded(f),f.replaceWith(b),Q.onNodeAdded(b);c.syncPendingAttrs(f,b),c.maintainPrivateHooks(f,b,p,m),c.cleanChildNodes(b,d);let N=a&&f.isSameNode(a)&&c.isFormInput(f),J=N&&this.isChangedSelect(f,b);if(this.skipCIDSibling(b))return this.maybeCloneLockedElement(f,N),this.copyNestedPrivateLock(f,b),this.maybeReOrderStream(f),!1;if(c.isPhxSticky(f))return[K,re,G].map(M=>[M,f.getAttribute(M),b.getAttribute(M)]).forEach(([M,H,ne])=>{ne&&H!==ne&&f.setAttribute(M,ne)}),!1;if(c.isIgnored(f,d)||f.form&&f.form.isSameNode(j))return this.trackBefore("updated",f,b),c.mergeAttrs(f,b,{isIgnored:c.isIgnored(f,d)}),v.push(f),c.applyStickyOperations(f),!1;if(f.type==="number"&&f.validity&&f.validity.badInput)return!1;if(f=this.maybeCloneLockedElement(f,N),c.isPhxChild(b)){let M=f.getAttribute(K);return c.mergeAttrs(f,b,{exclude:[re]}),M!==""&&f.setAttribute(K,M),f.setAttribute(G,this.rootID),c.applyStickyOperations(f),!1}return this.copyNestedPrivateLock(f,b),c.copyPrivates(b,f),c.isPortalTemplate(b)?(D.push(()=>this.teleport(b,U)),f.content.replaceChildren(b.content.cloneNode(!0)),!1):N&&f.type!=="hidden"&&!J?(this.trackBefore("updated",f,b),c.mergeFocusedInput(f,b),c.syncAttrsToProps(f),v.push(f),c.applyStickyOperations(f),!1):(J&&f.blur(),c.isPhxUpdate(b,d,["append","prepend"])&&E.push(new st(f,b,b.getAttribute(d))),c.syncAttrsToProps(b),c.applyStickyOperations(b),this.trackBefore("updated",f,b),f)}};ot(_,k,Q)};if(this.trackBefore("added",r),this.trackBefore("updated",r,r),i.time("morphdom",()=>{this.streams.forEach(([k,I,Q,f])=>{I.forEach(([b,N,J,M])=>{this.streamInserts[b]={ref:k,streamAt:N,limit:J,reset:f,updateOnly:M}}),f!==void 0&&c.all(document,`[${Xe}="${k}"]`,b=>{this.removeStreamChildElement(b)}),Q.forEach(b=>{let N=document.getElementById(b);N&&this.removeStreamChildElement(N)})}),e&&c.all(this.container,`[${d}=${Ue}]`).filter(k=>this.view.ownsElement(k)).forEach(k=>{Array.from(k.children).forEach(I=>{this.removeStreamChildElement(I,!0)})}),U(o,n);let _=0;for(;D.length>0&&_<5;){let k=D.slice();D=[],k.forEach(I=>I()),_++}this.view.portalElementIds.forEach(k=>{let I=document.getElementById(k);I&&(document.getElementById(I.getAttribute(ee))||(I.remove(),this.onNodeDiscarded(I),this.view.dropPortalElementId(k)))})}),i.isDebugEnabled()&&(gi(),vi(this.streamInserts),Array.from(document.querySelectorAll("input[name=id]")).forEach(_=>{_ instanceof HTMLInputElement&&_.form&&console.error(`Detected an input with name="id" inside a form! This will cause problems when patching the DOM.
|
|
9
9
|
`,_)})),E.length>0&&i.time("post-morph append/prepend restoration",()=>{E.forEach(_=>_.perform())}),i.silenceEvents(()=>c.restoreFocus(a,l,h)),c.dispatchEvent(document,"phx:update"),u.forEach(_=>this.trackAfter("added",_)),v.forEach(_=>this.trackAfter("updated",_)),this.transitionPendingRemoves(),j){i.unload();let _=c.private(j,"submitter");if(_&&_.name&&o.contains(_)){let k=document.createElement("input");k.type="hidden";let I=_.getAttribute("form");I&&k.setAttribute("form",I),k.name=_.name,k.value=_.value,_.parentElement.insertBefore(k,_)}Object.getPrototypeOf(j).submit.call(j)}return!0}onNodeDiscarded(e){(c.isPhxChild(e)||c.isPhxSticky(e))&&this.liveSocket.destroyViewByEl(e),this.trackAfter("discarded",e)}maybePendingRemove(e){return e.getAttribute&&e.getAttribute(this.phxRemove)!==null?(this.pendingRemoves.push(e),!0):!1}removeStreamChildElement(e,t=!1){!t&&!this.view.ownsElement(e)||(this.streamInserts[e.id]?(this.streamComponentRestore[e.id]=e,e.remove()):this.maybePendingRemove(e)||(e.remove(),this.onNodeDiscarded(e)))}getStreamInsert(e){return(e.id?this.streamInserts[e.id]:{})||{}}setStreamRef(e,t){c.putSticky(e,Xe,i=>i.setAttribute(Xe,t))}maybeReOrderStream(e,t){let{ref:i,streamAt:n,reset:r}=this.getStreamInsert(e);if(n!==void 0&&(this.setStreamRef(e,i),!(!r&&!t)&&e.parentElement)){if(n===0)this.moveOrInsertBefore(e.parentElement,e,e.parentElement.firstElementChild);else if(n>0){let o=Array.from(e.parentElement.children),a=o.indexOf(e);if(n>=o.length-1)this.moveOrInsertBefore(e.parentElement,e,null);else{let l=o[n];a>n?this.moveOrInsertBefore(e.parentElement,e,l):this.moveOrInsertBefore(e.parentElement,e,l.nextElementSibling)}}this.maybeLimitStream(e)}}moveOrInsertBefore(e,t,i){if(typeof e.moveBefore=="function")try{e.moveBefore(t,i);return}catch(n){}e.insertBefore(t,i)}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(n=>this.removeStreamChildElement(n)):t&&t>=0&&i.length>t&&i.slice(t).forEach(n=>this.removeStreamChildElement(n))}transitionPendingRemoves(){let{pendingRemoves:e,liveSocket:t}=this;e.length>0&&t.transitionRemoves(e,()=>{e.forEach(i=>{let n=c.firstPhxChild(i);n&&t.destroyViewByEl(n),i.remove()}),this.trackAfter("transitionsDiscarded",e)})}isChangedSelect(e,t){return!(e instanceof HTMLSelectElement)||e.multiple?!1:e.options.length!==t.options.length?!0:(t.value=e.value,!e.isEqualNode(t))}isCIDPatch(){return this.cidPatch}skipCIDSibling(e){return e.nodeType===Node.ELEMENT_NODE&&e.hasAttribute(gt)}maybeCloneLockedElement(e,t){if(!e.hasAttribute(F))return e;let i=new ye(e);if(i.lockRef===null||this.undoRef!==void 0&&i.isLockUndoneBy(this.undoRef))return e;c.applyStickyOperations(e);let n=e.hasAttribute(C)?c.private(e,C)||e.cloneNode(!0):null;return n?(c.putPrivate(e,C,n),t?e:n):e}copyNestedPrivateLock(e,t){this.undoRef===void 0||!c.private(t,C)||c.putPrivate(e,C,c.private(t,C))}targetCIDContainer(e){if(!this.isCIDPatch())return;let[t,...i]=c.findComponentNodeList(this.view.id,this.targetCID);return i.length===0&&c.childNodeLength(e)===1?t:t&&t.parentNode}indexOf(e,t){return Array.from(e.children).indexOf(t)}teleport(e,t){let i=e.getAttribute($e),n=document.querySelector(i);if(!n)throw new Error("portal target with selector "+i+" not found");let r=e.content.firstElementChild;if(this.skipCIDSibling(r))return;if(!(r!=null&&r.id))throw new Error("phx-portal template must have a single root element with ID!");let o=document.getElementById(r.id),a;o?(n.contains(o)||n.appendChild(o),a=o):(a=document.createElement(r.tagName),n.appendChild(a)),r.setAttribute(oe,this.view.id),r.setAttribute(ee,e.id),t(a,r,!0),r.removeAttribute(oe),r.removeAttribute(ee),this.view.pushPortalElementId(r.id)}handleRuntimeHook(e,t){let i=e.getAttribute(Be),n=e.hasAttribute("nonce")?e.getAttribute("nonce"):null;if(e.hasAttribute("nonce")){let o=document.createElement("template");o.innerHTML=t,n=o.content.querySelector(`script[${Be}="${CSS.escape(i)}"]`).getAttribute("nonce")}let r=document.createElement("script");r.textContent=e.textContent,c.mergeAttrs(r,e,{isIgnored:!1}),n&&(r.nonce=n),e.replaceWith(r),e=r}};var dn=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),un=new Set(["'",'"']),Oi=(s,e,t)=>{let i=0,n=!1,r,o,a,l,h,d,p=s.match(/^(\s*(?:<!--.*?-->\s*)*)<([^\s\/>]+)/);if(p===null)throw new Error(`malformed html ${s}`);for(i=p[0].length,r=p[1],a=p[2],l=i,i;i<s.length&&s.charAt(i)!==">";i++)if(s.charAt(i)==="="){let u=s.slice(i-3,i)===" id";i++;let v=s.charAt(i);if(un.has(v)){let E=i;for(i++,i;i<s.length&&s.charAt(i)!==v;i++);if(u){h=s.slice(E+1,i);break}}}let m=s.length-1;for(n=!1;m>=r.length+a.length;){let u=s.charAt(m);if(n)u==="-"&&s.slice(m-3,m)==="<!-"?(n=!1,m-=4):m-=1;else if(u===">"&&s.slice(m-2,m)==="--")n=!0,m-=3;else{if(u===">")break;m-=1}}o=s.slice(m+1,s.length);let g=Object.keys(e).map(u=>e[u]===!0?u:`${u}="${e[u]}"`).join(" ");if(t){let u=h?` id="${h}"`:"";dn.has(a)?d=`<${a}${u}${g===""?"":" "}${g}/>`:d=`<${a}${u}${g===""?"":" "}${g}></${a}>`}else{let u=s.slice(l,m+1);d=`<${a}${g===""?"":" "}${g}${u}`}return[d,r,o]},Ke=class{static extract(e){let{[Xt]:t,[Ut]:i,[$t]:n}=e;return delete e[Xt],delete e[Ut],delete e[$t],{diff:e,title:n,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{buffer:t,streams:i}=this.recursiveToString(this.rendered,this.rendered[X],e,!0,{});return{buffer:t,streams:i}}recursiveToString(e,t=e[X],i,n,r){i=i?new Set(i):null;let o={buffer:"",components:t,onlyCids:i,streams:new Set};return this.toOutputBuffer(e,null,o,n,r),{buffer:o.buffer,streams:o.streams}}componentCIDs(e){return Object.keys(e[X]||{}).map(t=>parseInt(t))}isComponentOnlyDiff(e){return e[X]?Object.keys(e).length===1:!1}getComponent(e,t){return e[X][t]}resetRender(e){this.rendered[X][e]&&(this.rendered[X][e].reset=!0)}mergeDiff(e){let t=e[X],i={};if(delete e[X],this.rendered=this.mutableMerge(this.rendered,e),this.rendered[X]=this.rendered[X]||{},t){let n=this.rendered[X];for(let r in t)t[r]=this.cachedFindComponent(r,t[r],n,t,i);for(let r in t)n[r]=t[r];e[X]=t}}cachedFindComponent(e,t,i,n,r){if(r[e])return r[e];{let o,a,l=t[z];if(Z(l)){let h;l>0?h=this.cachedFindComponent(l,n[l],i,n,r):h=i[-l],a=h[z],o=this.cloneMerge(h,t,!0),o[z]=a}else o=t[z]!==void 0||i[e]===void 0?t:this.cloneMerge(i[e],t,!1);return r[e]=o,o}}mutableMerge(e,t){return t[z]!==void 0?t:(this.doMutableMerge(e,t),e)}doMutableMerge(e,t){if(t[x])this.mergeKeyed(e,t);else for(let i in t){let n=t[i],r=e[i];Te(n)&&n[z]===void 0&&Te(r)?this.doMutableMerge(r,n):e[i]=n}e[yt]&&(e.newRender=!0)}clone(e){return"structuredClone"in window?structuredClone(e):JSON.parse(JSON.stringify(e))}mergeKeyed(e,t){let i=this.clone(e);if(Object.entries(t[x]).forEach(([n,r])=>{if(n!==ie)if(Array.isArray(r)){let[o,a]=r;e[x][n]=i[x][o],this.doMutableMerge(e[x][n],a)}else if(typeof r=="number"){let o=r;e[x][n]=i[x][o]}else typeof r=="object"&&(e[x][n]||(e[x][n]={}),this.doMutableMerge(e[x][n],r))}),t[x][ie]<e[x][ie])for(let n=t[x][ie];n<e[x][ie];n++)delete e[x][n];e[x][ie]=t[x][ie],t[ke]&&(e[ke]=t[ke]),t[de]&&(e[de]=t[de])}cloneMerge(e,t,i){let n;if(t[x])n=this.clone(e),this.mergeKeyed(n,t);else{n=L(L({},e),t);for(let r in n){let o=t[r],a=e[r];Te(o)&&o[z]===void 0&&Te(a)?n[r]=this.cloneMerge(a,o,i):o===void 0&&Te(a)&&(n[r]=this.cloneMerge(a,{},i))}}return i?(delete n.magicId,delete n.newRender):e[yt]&&(n.newRender=!0),n}componentToString(e){let{buffer:t,streams:i}=this.recursiveCIDToString(this.rendered[X],e,null),[n,r,o]=Oi(t,{});return{buffer:n,streams:i}}pruneCIDs(e){e.forEach(t=>delete this.rendered[X][t])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[z]}templateStatic(e,t){return typeof e=="number"?t[e]:e}nextMagicID(){return this.magicId++,`m${this.magicId}-${this.parentViewId()}`}toOutputBuffer(e,t,i,n,r={}){if(e[x])return this.comprehensionToBuffer(e,t,i,n);e[de]&&(t=e[de],delete e[de]);let{[z]:o}=e;o=this.templateStatic(o,t),e[z]=o;let a=e[yt],l=i.buffer;a&&(i.buffer=""),n&&a&&!e.magicId&&(e.newRender=!0,e.magicId=this.nextMagicID()),i.buffer+=o[0];for(let h=1;h<o.length;h++)this.dynamicToBuffer(e[h-1],t,i,n),i.buffer+=o[h];if(a){let h=!1,d;n||e.magicId?(h=n&&!e.newRender,d=L({[ze]:e.magicId},r)):d=r,h&&(d[gt]=!0);let[p,m,g]=Oi(i.buffer,d,h);e.newRender=!1,i.buffer=l+m+p+g}}comprehensionToBuffer(e,t,i,n){let r=t||e[de],o=this.templateStatic(e[z],t);e[z]=o,delete e[de];for(let a=0;a<e[x][ie];a++){i.buffer+=o[0];for(let l=1;l<o.length;l++)this.dynamicToBuffer(e[x][a][l-1],r,i,n),i.buffer+=o[l]}if(e[ke]){let a=e[ke],[l,h,d,p]=a||[null,{},[],null];a!==void 0&&(e[x][ie]>0||d.length>0||p)&&(delete e[ke],e[x]={[ie]:0},i.streams.add(a))}}dynamicToBuffer(e,t,i,n){if(typeof e=="number"){let{buffer:r,streams:o}=this.recursiveCIDToString(i.components,e,i.onlyCids);i.buffer+=r,i.streams=new Set([...i.streams,...o])}else Te(e)?this.toOutputBuffer(e,t,i,n,{}):i.buffer+=e}recursiveCIDToString(e,t,i){let n=e[t]||w(`no component for CID ${t}`,e),r={[W]:t,[ce]:this.viewId},o=i&&!i.has(t);n.newRender=!o,n.magicId=`c${t}-${this.parentViewId()}`;let a=!n.reset,{buffer:l,streams:h}=this.recursiveToString(n,e,i,a,r);return delete n.reset,{buffer:l,streams:h}}};var Li=[],Hi=200,fn={exec(s,e,t,i,n,r){let[o,a]=r||[null,{callback:r&&r.callback}];(t.charAt(0)==="["?JSON.parse(t):[[o,a]]).forEach(([h,d])=>{h===o&&(d=L(L({},a),d),d.callback=d.callback||a.callback),this.filterToEls(i.liveSocket,n,d).forEach(p=>{this[`exec_${h}`](s,e,t,i,n,p,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,n,r,{attr:o,to:a}){let l=r.getAttribute(o);if(!l)throw new Error(`expected ${o} to contain JS command on "${a}"`);i.liveSocket.execJS(r,l,e)},exec_dispatch(s,e,t,i,n,r,{event:o,detail:a,bubbles:l,blocking:h}){if(a=a||{},a.dispatcher=n,h){let d=new Promise((p,m)=>{a.done=p});i.liveSocket.asyncTransition(d)}c.dispatchEvent(r,o,{detail:a,bubbles:l})},exec_push(s,e,t,i,n,r,o){let{event:a,data:l,target:h,page_loading:d,loading:p,value:m,dispatcher:g,callback:u}=o,v={loading:p,value:m,target:h,page_loading:!!d,originalEvent:s},E=e==="change"&&g?g:n,D=h||E.getAttribute(i.binding("target"))||E,j=(U,_)=>{if(U.isConnected())if(e==="change"){let{newCid:k,_target:I}=o;I=I||(c.isFormInput(n)?n.name:void 0),I&&(v._target=I),U.pushInput(n,_,k,a||t,v,u)}else if(e==="submit"){let{submitter:k}=o;U.submitForm(n,_,a||t,k,v,u)}else U.pushEvent(e,n,_,a||t,l,v,u)};o.targetView&&o.targetCtx?j(o.targetView,o.targetCtx):i.withinTargets(D,j)},exec_navigate(s,e,t,i,n,r,{href:o,replace:a}){i.liveSocket.historyRedirect(s,o,a?"replace":"push",null,n)},exec_patch(s,e,t,i,n,r,{href:o,replace:a}){i.liveSocket.pushHistoryPatch(s,o,a?"replace":"push",n)},exec_focus(s,e,t,i,n,r){B.attemptFocus(r),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>B.attemptFocus(r))})},exec_focus_first(s,e,t,i,n,r){B.focusFirstInteractive(r)||B.focusFirst(r),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>B.focusFirstInteractive(r)||B.focusFirst(r))})},exec_push_focus(s,e,t,i,n,r){Li.push(r||n)},exec_pop_focus(s,e,t,i,n,r){let o=Li.pop();o&&(o.focus(),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>o.focus())}))},exec_add_class(s,e,t,i,n,r,{names:o,transition:a,time:l,blocking:h}){this.addOrRemoveClasses(r,o,[],a,l,i,h)},exec_remove_class(s,e,t,i,n,r,{names:o,transition:a,time:l,blocking:h}){this.addOrRemoveClasses(r,[],o,a,l,i,h)},exec_toggle_class(s,e,t,i,n,r,{names:o,transition:a,time:l,blocking:h}){this.toggleClasses(r,o,a,l,i,h)},exec_toggle_attr(s,e,t,i,n,r,{attr:[o,a,l]}){this.toggleAttr(r,o,a,l)},exec_ignore_attrs(s,e,t,i,n,r,{attrs:o}){this.ignoreAttrs(r,o)},exec_transition(s,e,t,i,n,r,{time:o,transition:a,blocking:l}){this.addOrRemoveClasses(r,[],[],a,o,i,l)},exec_toggle(s,e,t,i,n,r,{display:o,ins:a,outs:l,time:h,blocking:d}){this.toggle(e,i,r,o,a,l,h,d)},exec_show(s,e,t,i,n,r,{display:o,transition:a,time:l,blocking:h}){this.show(e,i,r,o,a,l,h)},exec_hide(s,e,t,i,n,r,{display:o,transition:a,time:l,blocking:h}){this.hide(e,i,r,o,a,l,h)},exec_set_attr(s,e,t,i,n,r,{attr:[o,a]}){this.setOrRemoveAttrs(r,[[o,a]],[])},exec_remove_attr(s,e,t,i,n,r,{attr:o}){this.setOrRemoveAttrs(r,[],[o])},ignoreAttrs(s,e){c.putPrivate(s,"JS:ignore_attrs",{apply:(t,i)=>{let n=Array.from(t.attributes),r=n.map(o=>o.name);Array.from(i.attributes).filter(o=>!r.includes(o.name)).forEach(o=>{c.attributeIgnored(o,e)&&i.removeAttribute(o.name)}),n.forEach(o=>{c.attributeIgnored(o,e)&&i.setAttribute(o.name,o.value)})}})},onBeforeElUpdated(s,e){let t=c.private(s,"JS:ignore_attrs");t&&t.apply(s,e)},show(s,e,t,i,n,r,o){this.isVisible(t)||this.toggle(s,e,t,i,n,null,r,o)},hide(s,e,t,i,n,r,o){this.isVisible(t)&&this.toggle(s,e,t,i,null,n,r,o)},toggle(s,e,t,i,n,r,o,a){o=o||Hi;let[l,h,d]=n||[[],[],[]],[p,m,g]=r||[[],[],[]];if(l.length>0||p.length>0)if(this.isVisible(t)){let u=()=>{this.addOrRemoveClasses(t,m,l.concat(h).concat(d)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,p,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(t,g,m))})},v=()=>{this.addOrRemoveClasses(t,[],p.concat(g)),c.putSticky(t,"toggle",E=>E.style.display="none"),t.dispatchEvent(new Event("phx:hide-end"))};t.dispatchEvent(new Event("phx:hide-start")),a===!1?(u(),setTimeout(v,o)):e.transition(o,u,v)}else{if(s==="remove")return;let u=()=>{this.addOrRemoveClasses(t,h,p.concat(m).concat(g));let E=i||this.defaultDisplay(t);window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,l,[]),window.requestAnimationFrame(()=>{c.putSticky(t,"toggle",D=>D.style.display=E),this.addOrRemoveClasses(t,d,h)})})},v=()=>{this.addOrRemoveClasses(t,[],l.concat(d)),t.dispatchEvent(new Event("phx:show-end"))};t.dispatchEvent(new Event("phx:show-start")),a===!1?(u(),setTimeout(v,o)):e.transition(o,u,v)}else this.isVisible(t)?window.requestAnimationFrame(()=>{t.dispatchEvent(new Event("phx:hide-start")),c.putSticky(t,"toggle",u=>u.style.display="none"),t.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{t.dispatchEvent(new Event("phx:show-start"));let u=i||this.defaultDisplay(t);c.putSticky(t,"toggle",v=>v.style.display=u),t.dispatchEvent(new Event("phx:show-end"))})},toggleClasses(s,e,t,i,n,r){window.requestAnimationFrame(()=>{let[o,a]=c.getSticky(s,"classes",[[],[]]),l=e.filter(d=>o.indexOf(d)<0&&!s.classList.contains(d)),h=e.filter(d=>a.indexOf(d)<0&&s.classList.contains(d));this.addOrRemoveClasses(s,l,h,t,i,n,r)})},toggleAttr(s,e,t,i){s.hasAttribute(e)?i!==void 0?s.getAttribute(e)===t?this.setOrRemoveAttrs(s,[[e,i]],[]):this.setOrRemoveAttrs(s,[[e,t]],[]):this.setOrRemoveAttrs(s,[],[e]):this.setOrRemoveAttrs(s,[[e,t]],[])},addOrRemoveClasses(s,e,t,i,n,r,o){n=n||Hi;let[a,l,h]=i||[[],[],[]];if(a.length>0){let d=()=>{this.addOrRemoveClasses(s,l,[].concat(a).concat(h)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(s,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(s,h,l))})},p=()=>this.addOrRemoveClasses(s,e.concat(h),t.concat(a).concat(l));o===!1?(d(),setTimeout(p,n)):r.transition(n,d,p);return}window.requestAnimationFrame(()=>{let[d,p]=c.getSticky(s,"classes",[[],[]]),m=e.filter(E=>d.indexOf(E)<0&&!s.classList.contains(E)),g=t.filter(E=>p.indexOf(E)<0&&s.classList.contains(E)),u=d.filter(E=>t.indexOf(E)<0).concat(m),v=p.filter(E=>e.indexOf(E)<0).concat(g);c.putSticky(s,"classes",E=>(E.classList.remove(...v),E.classList.add(...u),[u,v]))})},setOrRemoveAttrs(s,e,t){let[i,n]=c.getSticky(s,"attrs",[[],[]]),r=e.map(([l,h])=>l).concat(t),o=i.filter(([l,h])=>!r.includes(l)).concat(e),a=n.filter(l=>!r.includes(l)).concat(t);e.some(([l,h])=>l==="id")&&c.putPrivate(s,"clientsideIdAttribute",!0),c.putSticky(s,"attrs",l=>(a.forEach(h=>l.removeAttribute(h)),o.forEach(([h,d])=>l.setAttribute(h,d)),[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,e,{to:t}){let i=()=>{if(typeof t=="string")return document.querySelectorAll(t);if(t.closest){let n=e.closest(t.closest);return n?[n]:[]}else if(t.inner)return e.querySelectorAll(t.inner)};return t?s.jsQuerySelectorAll(e,t,i):[e]},defaultDisplay(s){return{tr:"table-row",td:"table-cell"}[s.tagName.toLowerCase()]||"block"},transitionClasses(s){if(!s)return null;let[e,t,i]=Array.isArray(s)?s:[s.split(" "),[],[]];return e=Array.isArray(e)?e:e.split(" "),t=Array.isArray(t)?t:t.split(" "),i=Array.isArray(i)?i:i.split(" "),[e,t,i]}},S=fn;var St=(s,e)=>({exec(t,i){s.execJS(t,i,e)},show(t,i={}){let n=s.owner(t);S.show(e,n,t,i.display,S.transitionClasses(i.transition),i.time,i.blocking)},hide(t,i={}){let n=s.owner(t);S.hide(e,n,t,null,S.transitionClasses(i.transition),i.time,i.blocking)},toggle(t,i={}){let n=s.owner(t),r=S.transitionClasses(i.in),o=S.transitionClasses(i.out);S.toggle(e,n,t,i.display,r,o,i.time,i.blocking)},addClass(t,i,n={}){let r=Array.isArray(i)?i:i.split(" "),o=s.owner(t);S.addOrRemoveClasses(t,r,[],S.transitionClasses(n.transition),n.time,o,n.blocking)},removeClass(t,i,n={}){let r=Array.isArray(i)?i:i.split(" "),o=s.owner(t);S.addOrRemoveClasses(t,[],r,S.transitionClasses(n.transition),n.time,o,n.blocking)},toggleClass(t,i,n={}){let r=Array.isArray(i)?i:i.split(" "),o=s.owner(t);S.toggleClasses(t,r,S.transitionClasses(n.transition),n.time,o,n.blocking)},transition(t,i,n={}){let r=s.owner(t);S.addOrRemoveClasses(t,[],[],S.transitionClasses(i),n.time,r,n.blocking)},setAttribute(t,i,n){S.setOrRemoveAttrs(t,[[i,n]],[])},removeAttribute(t,i){S.setOrRemoveAttrs(t,[],[i])},toggleAttribute(t,i,n,r){S.toggleAttr(t,i,n,r)},push(t,i,n={}){s.withinOwners(t,r=>{let o=n.value||{};delete n.value;let a=new CustomEvent("phx:exec",{detail:{sourceElement:t}});S.exec(a,e,i,r,t,["push",L({data:o},n)])})},navigate(t,i={}){let n=new CustomEvent("phx:exec");s.historyRedirect(n,t,i.replace?"replace":"push",null,null)},patch(t,i={}){let n=new CustomEvent("phx:exec");s.pushHistoryPatch(n,t,i.replace?"replace":"push",null)},ignoreAttributes(t,i){S.ignoreAttrs(t,Array.isArray(i)?i:[i])}});var Wt="hookId",Di="deadHook",pn=1,Y=class s{get liveSocket(){return this.__liveSocket()}static makeID(){return pn++}static elementID(e){return c.private(e,Wt)}static deadHook(e){return c.private(e,Di)===!0}constructor(e,t,i){if(this.el=t,this.__attachView(e),this.__listeners=new Set,this.__isDisconnected=!1,c.putPrivate(this.el,Wt,s.makeID()),e&&e.isDead&&c.putPrivate(this.el,Di,!0),i){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 i)Object.prototype.hasOwnProperty.call(i,o)&&(this[o]=i[o],n.has(o)&&console.warn(`Hook object for element #${t.id} overwrites core property '${o}'!`));["mounted","beforeUpdate","updated","destroyed","disconnected","reconnected"].forEach(o=>{i[o]&&typeof i[o]=="function"&&(this[o]=i[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,Wt)}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected()}js(){return le(L({},St(this.__view().liveSocket,"hook")),{exec:e=>{this.__view().liveSocket.execJS(this.el,e,"hook")}})}pushEvent(e,t,i){let n=this.__view().pushHookEvent(this.el,null,e,t||{});if(i===void 0)return n.then(({reply:r})=>r);n.then(({reply:r,ref:o})=>i(r,o)).catch(()=>{})}pushEventTo(e,t,i,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,t,i||{}));return Promise.allSettled(o)}this.__view().withinTargets(e,(r,o)=>{r.pushHookEvent(this.el,o,t,i||{}).then(({reply:a,ref:l})=>n(a,l)).catch(()=>{})})}handleEvent(e,t){let i={event:e,callback:n=>t(n.detail)};return window.addEventListener(`phx:${e}`,i.callback),this.__listeners.add(i),i}removeHandleEvent(e){window.removeEventListener(`phx:${e.event}`,e.callback),this.__listeners.delete(e)}upload(e,t){return this.__view().dispatchUploads(null,e,t)}uploadTo(e,t,i){return this.__view().withinTargets(e,(n,r)=>{n.dispatchUploads(r,t,i)})}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}};var mn=(s,e)=>{let t=s.endsWith("[]"),i=t?s.slice(0,-2):s;return i=i.replace(/([^\[\]]+)(\]?$)/,`${e}$1$2`),t&&(i+="[]"),i},wt=(s,e,t=[])=>{let{submitter:i}=e,n;if(i&&i.name){let d=document.createElement("input");d.type="hidden";let p=i.getAttribute("form");p&&d.setAttribute("form",p),d.name=i.name,d.value=i.value,i.parentElement.insertBefore(d,i),n=d}let r=new FormData(s),o=[];r.forEach((d,p,m)=>{d instanceof File&&o.push(p)}),o.forEach(d=>r.delete(d));let a=new URLSearchParams,{inputsUnused:l,onlyHiddenInputs:h}=Array.from(s.elements).reduce((d,p)=>{let{inputsUnused:m,onlyHiddenInputs:g}=d,u=p.name;if(!u)return d;m[u]===void 0&&(m[u]=!0),g[u]===void 0&&(g[u]=!0);let v=c.private(p,we)||c.private(p,Pe),E=p.type==="hidden";return m[u]=m[u]&&!v,g[u]=g[u]&&E,d},{inputsUnused:{},onlyHiddenInputs:{}});for(let[d,p]of r.entries())if(t.length===0||t.indexOf(d)>=0){let m=l[d],g=h[d];m&&!(i&&i.name==d)&&!g&&a.append(mn(d,"_unused_"),""),typeof p=="string"&&a.append(d,p)}return i&&n&&i.parentElement.removeChild(n),a.toString()},Re=class s{static closestView(e){let t=e.closest(he);return t?c.private(t,"view"):null}constructor(e,t,i,n,r){this.isDead=!1,this.liveSocket=t,this.flash=n,this.parent=i,this.root=i?i.root:this,this.el=e;let o=c.private(this.el,"view");if(o!==void 0&&o.isDead!==!0)throw w(`The DOM element for this view has already been bound to a view.
|
|
10
10
|
|
|
11
11
|
An element can only ever be associated with a single view!
|
|
@@ -18,4 +18,4 @@ removing illegal node: "${(i.outerHTML||i.nodeValue).trim()}"
|
|
|
18
18
|
import {Socket} from "phoenix"
|
|
19
19
|
import {LiveSocket} from "phoenix_live_view"
|
|
20
20
|
let liveSocket = new LiveSocket("/live", Socket, {...})
|
|
21
|
-
`);this.socket=new t(e,i),this.bindingPrefix=i.bindingPrefix||fi,this.opts=i,this.params=Je(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(We(mi),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=We(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||hi,this.disconnectedTimeout=i.disconnectedTimeout||ui,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||10,this.reloadJitterMin=i.reloadJitterMin||5e3,this.reloadJitterMax=i.reloadJitterMax||1e4,this.failsafeJitter=i.failsafeJitter||3e4,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:Je(),onPatchEnd:Je(),onNodeAdded:Je(),onBeforeElUpdated:Je()},i.dom||{}),this.transitions=new Kt,this.currentHistoryPosition=parseInt(this.sessionStorage.getItem(it))||0,window.addEventListener("pagehide",n=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.1.29"}isProfileEnabled(){return this.sessionStorage.getItem(bt)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(tt)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(tt)==="false"}enableDebug(){this.sessionStorage.setItem(tt,"true")}enableProfiling(){this.sessionStorage.setItem(bt,"true")}disableDebug(){this.sessionStorage.setItem(tt,"false")}disableProfiling(){this.sessionStorage.removeItem(bt)}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.resetReloadStatus(),this.joinRootViews()?(this.bindTopLevelEvents(),this.socket.connect()):this.main?this.socket.connect():this.bindTopLevelEvents({dead:!0}),this.joinDeadView()};["complete","loaded","interactive"].indexOf(document.readyState)>=0?e():document.addEventListener("DOMContentLoaded",()=>e())}disconnect(e){clearTimeout(this.reloadWithJitterTimer),this.serverCloseRef&&(this.socket.off(this.serverCloseRef),this.serverCloseRef=null),this.socket.disconnect(e)}replaceTransport(e){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(e),this.connect()}execJS(e,t,i=null){let n=new CustomEvent("phx:exec",{detail:{sourceElement:e}});this.owner(e,r=>S.exec(n,i,t,r,e))}js(){return St(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(e,t){this.domCallbacks[e](...t)}time(e,t){if(!this.isProfileEnabled()||!console.time)return t();console.time(e);let i=t();return console.timeEnd(e),i}log(e,t,i){if(this.viewLogger){let[n,r]=i();this.viewLogger(e,t,n,r)}else if(this.isDebugEnabled()){let[n,r]=i();bi(e,t,n,r)}}requestDOMUpdate(e){this.transitions.after(e)}asyncTransition(e){this.transitions.addAsyncTransition(e)}transition(e,t,i=function(){}){this.transitions.addTransition(e,t,i)}onChannel(e,t,i){e.on(t,n=>{let r=this.getLatencySim();r?setTimeout(()=>i(n),r):i(n)})}reloadWithJitter(e,t){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,n=this.reloadJitterMax,r=Math.floor(Math.random()*(n-i+1))+i,o=$.updateLocal(this.localStorage,window.location.pathname,dt,0,a=>a+1);o>=this.maxReloads&&(r=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())},r)}getHookDefinition(e){if(e)return this.maybeInternalHook(e)||this.hooks[e]||this.maybeRuntimeHook(e)}maybeInternalHook(e){return e&&e.startsWith("Phoenix.")&&ki[e.split(".")[1]]}maybeRuntimeHook(e){let t=document.querySelector(`script[${Be}="${CSS.escape(e)}"]`);if(!t)return;let i=window[`phx_hook_${e}`];if(!i||typeof i!="function"){w("a runtime hook must be a function",t);return}let n=i();if(n&&(typeof n=="object"||typeof n=="function"))return n;w("runtime hook must return an object with hook callbacks or an instance of ViewHook",t)}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(e){return`${this.getBindingPrefix()}${e}`}channel(e,t){return this.socket.channel(e,t)}joinDeadView(){let e=document.body;if(e&&!this.isPhxView(e)&&!this.isPhxView(document.firstElementChild)){let t=this.newRootView(e);t.setHref(this.getHref()),t.joinDead(),this.main||(this.main=t),window.requestAnimationFrame(()=>{var i;t.execNewMounted(),this.maybeScroll((i=history.state)==null?void 0:i.scroll)})}}joinRootViews(){let e=!1;return c.all(document,`${he}:not([${se}])`,t=>{if(!this.getRootById(t.id)){let i=this.newRootView(t);c.isPhxSticky(t)||i.setHref(this.getHref()),i.join(),t.hasAttribute(De)&&(this.main=i)}e=!0}),e}redirect(e,t,i){i&&$.setCookie(Dt,i,60),this.unload(),$.redirect(e,t)}replaceMain(e,t,i=null,n=this.setPendingLink(e)){let r=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let o=c.findPhxSticky(document)||[],a=c.all(this.outgoingMainEl,`[${this.binding("remove")}]`).filter(h=>!c.isChildOfAny(h,o)),l=c.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(l,t,r),this.main.setRedirect(e),this.transitionRemoves(a),this.main.join((h,d)=>{h===1&&this.commitPendingLink(n)&&this.requestDOMUpdate(()=>{a.forEach(p=>p.remove()),o.forEach(p=>l.appendChild(p)),this.outgoingMainEl.replaceWith(l),this.outgoingMainEl=null,i&&i(n),d()})})}transitionRemoves(e,t){let i=this.binding("remove"),n=r=>{r.preventDefault(),r.stopImmediatePropagation()};e.forEach(r=>{for(let o of this.boundEventNames)r.addEventListener(o,n,!0);this.execJS(r,r.getAttribute(i),"remove")}),this.requestDOMUpdate(()=>{e.forEach(r=>{for(let o of this.boundEventNames)r.removeEventListener(o,n,!0)}),t&&t()})}isPhxView(e){return e.getAttribute&&e.getAttribute(K)!==null}newRootView(e,t,i){let n=new Re(e,this,null,t,i);return this.roots[n.id]=n,n}owner(e,t){let i,n=c.closestViewEl(e);if(n)i=this.getViewByEl(n);else{if(!e.isConnected)return null;i=this.main}return i&&t?t(i):i}withinOwners(e,t){this.owner(e,i=>t(i,e))}getViewByEl(e){let t=e.getAttribute(G);return fe(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(G));t&&t.id===e.id?(t.destroy(),delete this.roots[t.id]):t&&t.destroyDescendent(e.id)}getActiveElement(){return document.activeElement}dropActiveElement(e){this.prevActive&&e.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive instanceof HTMLElement&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive instanceof HTMLElement&&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,n,r,o,a)=>{let l=r.getAttribute(this.binding(li)),h=t.key&&t.key.toLowerCase();if(l&&l.toLowerCase()!==h)return;let d=L({key:t.key},this.eventMeta(i,t,r));S.exec(t,i,o,n,r,["push",{data:d}])}),this.bind({blur:"focusout",focus:"focusin"},(t,i,n,r,o,a)=>{if(!a){let l=L({key:t.key},this.eventMeta(i,t,r));S.exec(t,i,o,n,r,["push",{data:l}])}}),this.bind({blur:"blur",focus:"focus"},(t,i,n,r,o,a)=>{if(a==="window"){let l=this.eventMeta(i,t,r);S.exec(t,i,o,n,r,["push",{data:l}])}}),this.on("dragover",t=>t.preventDefault()),this.on("dragenter",t=>{let i=ue(t.target,this.binding(qe));!i||!(i instanceof HTMLElement)||Ai(t)&&this.js().addClass(i,ft)}),this.on("dragleave",t=>{let i=ue(t.target,this.binding(qe));if(!i||!(i instanceof HTMLElement))return;let n=i.getBoundingClientRect();(t.clientX<=n.left||t.clientX>=n.right||t.clientY<=n.top||t.clientY>=n.bottom)&&this.js().removeClass(i,ft)}),this.on("drop",t=>{t.preventDefault();let i=ue(t.target,this.binding(qe));if(!i||!(i instanceof HTMLElement))return;this.js().removeClass(i,ft);let n=i.getAttribute(this.binding(qe)),r=n&&document.getElementById(n),o=Array.from(t.dataTransfer.files||[]);!r||!(r instanceof HTMLInputElement)||r.disabled||o.length===0||!(r.files instanceof FileList)||(R.trackFiles(r,o,t.dataTransfer),r.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(mt,t=>{let i=t.target;if(!c.isUploadInput(i))return;let n=Array.from(t.detail.files||[]).filter(r=>r instanceof File||r instanceof Blob);R.trackFiles(i,n),i.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(e,t,i){let n=this.metadataCallbacks[e];return n?n(t,i):{}}setPendingLink(e){return this.linkRef++,this.pendingLink=e,this.resetReloadStatus(),this.linkRef}resetReloadStatus(){$.deleteCookie(Dt)}commitPendingLink(e){return this.linkRef!==e?!1:(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(e,t){for(let i in e){let n=e[i];this.on(n,r=>{let o=this.binding(i),a=this.binding(`window-${i}`),l=r.target.getAttribute&&r.target.getAttribute(o);l?this.debounce(r.target,r,n,()=>{this.withinOwners(r.target,h=>{t(r,i,h,r.target,l,null)})}):c.all(document,`[${a}]`,h=>{let d=h.getAttribute(a);this.debounce(h,r,n,()=>{this.withinOwners(h,p=>{t(r,i,p,h,d,"window")})})})})}}bindClicks(){this.on("mousedown",e=>this.clickStartedAtTarget=e.target),this.bindClick("click","click")}bindClick(e,t){let i=this.binding(t);window.addEventListener(e,n=>{let r=null;n.detail===0&&(this.clickStartedAtTarget=n.target);let o=this.clickStartedAtTarget||n.target;r=ue(n.target,i),this.dispatchClickAway(n,o),this.clickStartedAtTarget=null;let a=r&&r.getAttribute(i);if(!a){c.isNewPageClick(n,window.location)&&this.unload();return}r.getAttribute("href")==="#"&&n.preventDefault(),!r.hasAttribute(F)&&this.debounce(r,n,"click",()=>{this.withinOwners(r,l=>{S.exec(n,"click",a,l,r,["push",{data:this.eventMeta("click",n,r)}])})})},!1)}dispatchClickAway(e,t){let i=this.binding("click-away"),n=t.closest(`[${ee}]`),r=n&&c.byId(n.getAttribute(ee));c.all(document,`[${i}]`,o=>{let a=t;n&&!n.contains(o)&&(a=r),o.isSameNode(a)||o.contains(a)||!S.isVisible(t)||this.withinOwners(o,l=>{let h=o.getAttribute(i);S.isVisible(o)&&S.isInViewport(o)&&S.exec(e,"click",h,l,o,["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,backType:n,id:r,scroll:o,position:a}=t.state||{},l=window.location.href,h=a>this.currentHistoryPosition,d=h?i:n||i;this.currentHistoryPosition=a||0,this.sessionStorage.setItem(it,this.currentHistoryPosition.toString()),c.dispatchEvent(window,"phx:navigate",{detail:{href:l,patch:d==="patch",pop:!0,direction:h?"forward":"backward"}}),this.requestDOMUpdate(()=>{let p=()=>{this.maybeScroll(o)};this.main.isConnected()&&d==="patch"&&r===this.main.id?this.main.pushLinkPatch(t,l,null,p):this.replaceMain(l,null,p)})},!1),window.addEventListener("click",t=>{let i=ue(t.target,pt),n=i&&i.getAttribute(pt);if(!n||!this.isConnected()||!this.main||c.wantsNewTab(t))return;let r=i.href instanceof SVGAnimatedString?i.href.baseVal:i.href,o=i.getAttribute(ei);t.preventDefault(),t.stopImmediatePropagation(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if(n==="patch")this.pushHistoryPatch(t,r,o,i);else if(n==="redirect")this.historyRedirect(t,r,o,null,i);else throw new Error(`expected ${pt} to be "patch" or "redirect", got: ${n}`);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={}){c.dispatchEvent(window,`phx:${e}`,{detail:t})}dispatchEvents(e){e.forEach(([t,i])=>this.dispatchEvent(t,i))}withPageLoading(e,t){c.dispatchEvent(window,"phx:page-loading-start",{detail:e});let i=()=>c.dispatchEvent(window,"phx:page-loading-stop",{detail:e});return t?t(i):i}pushHistoryPatch(e,t,i,n){if(!this.isConnected()||!this.main.isMain())return $.redirect(t);this.withPageLoading({to:t,kind:"patch"},r=>{this.main.pushLinkPatch(e,t,n,o=>{this.historyPatch(t,i,o),r()})})}historyPatch(e,t,i=this.setPendingLink(e)){this.commitPendingLink(i)&&(this.currentHistoryPosition++,this.sessionStorage.setItem(it,this.currentHistoryPosition.toString()),$.updateCurrentState(n=>le(L({},n),{backType:"patch"})),$.pushState(t,{type:"patch",id:this.main.id,position:this.currentHistoryPosition},e),c.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:e,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location))}historyRedirect(e,t,i,n,r){let o=r&&e.isTrusted&&e.type!=="popstate";if(o&&r.classList.add("phx-click-loading"),!this.isConnected()||!this.main.isMain())return $.redirect(t,n);if(/^\/$|^\/[^\/]+.*$/.test(t)){let{protocol:l,host:h}=window.location;t=`${l}//${h}${t}`}let a=window.scrollY;this.withPageLoading({to:t,kind:"redirect"},l=>{this.replaceMain(t,n,h=>{h===this.linkRef&&(this.currentHistoryPosition++,this.sessionStorage.setItem(it,this.currentHistoryPosition.toString()),$.updateCurrentState(d=>le(L({},d),{backType:"redirect"})),$.pushState(i,{type:"redirect",id:this.main.id,scroll:a,position:this.currentHistoryPosition},t),c.dispatchEvent(window,"phx:navigate",{detail:{href:t,patch:!1,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location)),o&&r.classList.remove("phx-click-loading"),l()})})}registerNewLocation(e){let{pathname:t,search:i}=this.currentLocation;return t+i===e.pathname+e.search?!1:(this.currentLocation=We(e),!0)}bindForms(){let e=0,t=!1;this.on("submit",i=>{let n=i.target.getAttribute(this.binding("submit")),r=i.target.getAttribute(this.binding("change"));!t&&r&&!n&&(t=!0,i.preventDefault(),this.withinOwners(i.target,o=>{o.disableForm(i.target),window.requestAnimationFrame(()=>{c.isUnloadableFormSubmit(i)&&this.unload(),i.target.submit()})}))}),this.on("submit",i=>{let n=i.target.getAttribute(this.binding("submit"));if(!n){c.isUnloadableFormSubmit(i)&&this.unload();return}i.preventDefault(),i.target.disabled=!0,this.withinOwners(i.target,r=>{S.exec(i,"submit",n,r,i.target,["push",{submitter:i.submitter}])})});for(let i of["change","input"])this.on(i,n=>{if(n instanceof CustomEvent&&(n.target instanceof HTMLInputElement||n.target instanceof HTMLSelectElement||n.target instanceof HTMLTextAreaElement)&&n.target.form===void 0){if(n.detail&&n.detail.dispatcher)throw new Error(`dispatching a custom ${i} event is only supported on input elements inside a form`);return}let r=this.binding("change"),o=n.target;if(this.blockPhxChangeWhileComposing&&n.isComposing){let u=`composition-listener-${i}`;c.private(o,u)||(c.putPrivate(o,u,!0),o.addEventListener("compositionend",()=>{o.dispatchEvent(new Event(i,{bubbles:!0})),c.deletePrivate(o,u)},{once:!0}));return}let a=o.getAttribute(r),l=o.form&&o.form.getAttribute(r),h=a||l;if(!h||o.type==="number"&&o.validity&&o.validity.badInput)return;let d=a?o:o.form,p=e;e++;let{at:m,type:g}=c.private(o,"prev-iteration")||{};m===p-1&&i==="change"&&g==="input"||(c.putPrivate(o,"prev-iteration",{at:p,type:i}),this.debounce(o,n,i,()=>{this.withinOwners(d,u=>{c.putPrivate(o,we,!0),S.exec(n,"change",h,u,o,["push",{_target:n.target.name,dispatcher:d}])})}))});this.on("reset",i=>{let n=i.target;c.resetForm(n);let r=Array.from(n.elements).find(o=>o.type==="reset");r&&window.requestAnimationFrame(()=>{r.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(e,t,i,n){if(i==="blur"||i==="focusout")return n();let r=this.binding(ri),o=this.binding(oi),a=this.defaults.debounce.toString(),l=this.defaults.throttle.toString();this.withinOwners(e,h=>{let d=()=>!h.isDestroyed()&&document.body.contains(e);c.debounce(e,t,r,a,o,l,d,()=>{n()})})}silenceEvents(e){this.silenced=!0,e(),this.silenced=!1}on(e,t){this.boundEventNames.add(e),window.addEventListener(e,i=>{this.silenced||t(i)})}jsQuerySelectorAll(e,t,i){let n=this.domCallbacks.jsQuerySelectorAll;return n?n(e,t,i):i()}},Kt=class{constructor(){this.transitions=new Set,this.promises=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(e=>{clearTimeout(e),this.transitions.delete(e)}),this.promises.clear(),this.flushPendingOps()}after(e){this.size()===0?e():this.pushPendingOp(e)}addTransition(e,t,i){t();let n=setTimeout(()=>{this.transitions.delete(n),i(),this.flushPendingOps()},e);this.transitions.add(n)}addAsyncTransition(e){this.promises.add(e),e.then(()=>{this.promises.delete(e),this.flushPendingOps()})}pushPendingOp(e){this.pendingOps.push(e)}size(){return this.transitions.size+this.promises.size}flushPendingOps(){if(this.size()>0)return;let e=this.pendingOps.shift();e&&(e(),this.flushPendingOps())}};var yn=at;function An(s,e){let t=c.getCustomElHook(s);if(t)return t;s.hasAttribute("id")||w("Elements passed to createHook need to have a unique id attribute",s);let i=new Y(Re.closestView(s),s,e);return c.putCustomElHook(s,i),i}return Ji(_n);})();
|
|
21
|
+
`);this.socket=new t(e,i),this.bindingPrefix=i.bindingPrefix||fi,this.opts=i,this.params=Je(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(We(mi),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=We(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||hi,this.disconnectedTimeout=i.disconnectedTimeout||ui,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||10,this.reloadJitterMin=i.reloadJitterMin||5e3,this.reloadJitterMax=i.reloadJitterMax||1e4,this.failsafeJitter=i.failsafeJitter||3e4,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:Je(),onPatchEnd:Je(),onNodeAdded:Je(),onBeforeElUpdated:Je()},i.dom||{}),this.transitions=new Kt,this.currentHistoryPosition=parseInt(this.sessionStorage.getItem(it))||0,window.addEventListener("pagehide",n=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.1.30"}isProfileEnabled(){return this.sessionStorage.getItem(bt)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(tt)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(tt)==="false"}enableDebug(){this.sessionStorage.setItem(tt,"true")}enableProfiling(){this.sessionStorage.setItem(bt,"true")}disableDebug(){this.sessionStorage.setItem(tt,"false")}disableProfiling(){this.sessionStorage.removeItem(bt)}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.resetReloadStatus(),this.joinRootViews()?(this.bindTopLevelEvents(),this.socket.connect()):this.main?this.socket.connect():this.bindTopLevelEvents({dead:!0}),this.joinDeadView()};["complete","loaded","interactive"].indexOf(document.readyState)>=0?e():document.addEventListener("DOMContentLoaded",()=>e())}disconnect(e){clearTimeout(this.reloadWithJitterTimer),this.serverCloseRef&&(this.socket.off(this.serverCloseRef),this.serverCloseRef=null),this.socket.disconnect(e)}replaceTransport(e){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(e),this.connect()}execJS(e,t,i=null){let n=new CustomEvent("phx:exec",{detail:{sourceElement:e}});this.owner(e,r=>S.exec(n,i,t,r,e))}js(){return St(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(e,t){this.domCallbacks[e](...t)}time(e,t){if(!this.isProfileEnabled()||!console.time)return t();console.time(e);let i=t();return console.timeEnd(e),i}log(e,t,i){if(this.viewLogger){let[n,r]=i();this.viewLogger(e,t,n,r)}else if(this.isDebugEnabled()){let[n,r]=i();bi(e,t,n,r)}}requestDOMUpdate(e){this.transitions.after(e)}asyncTransition(e){this.transitions.addAsyncTransition(e)}transition(e,t,i=function(){}){this.transitions.addTransition(e,t,i)}onChannel(e,t,i){e.on(t,n=>{let r=this.getLatencySim();r?setTimeout(()=>i(n),r):i(n)})}reloadWithJitter(e,t){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,n=this.reloadJitterMax,r=Math.floor(Math.random()*(n-i+1))+i,o=$.updateLocal(this.localStorage,window.location.pathname,dt,0,a=>a+1);o>=this.maxReloads&&(r=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())},r)}getHookDefinition(e){if(e)return this.maybeInternalHook(e)||this.hooks[e]||this.maybeRuntimeHook(e)}maybeInternalHook(e){return e&&e.startsWith("Phoenix.")&&ki[e.split(".")[1]]}maybeRuntimeHook(e){let t=document.querySelector(`script[${Be}="${CSS.escape(e)}"]`);if(!t)return;let i=window[`phx_hook_${e}`];if(!i||typeof i!="function"){w("a runtime hook must be a function",t);return}let n=i();if(n&&(typeof n=="object"||typeof n=="function"))return n;w("runtime hook must return an object with hook callbacks or an instance of ViewHook",t)}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(e){return`${this.getBindingPrefix()}${e}`}channel(e,t){return this.socket.channel(e,t)}joinDeadView(){let e=document.body;if(e&&!this.isPhxView(e)&&!this.isPhxView(document.firstElementChild)){let t=this.newRootView(e);t.setHref(this.getHref()),t.joinDead(),this.main||(this.main=t),window.requestAnimationFrame(()=>{var i;t.execNewMounted(),this.maybeScroll((i=history.state)==null?void 0:i.scroll)})}}joinRootViews(){let e=!1;return c.all(document,`${he}:not([${se}])`,t=>{if(!this.getRootById(t.id)){let i=this.newRootView(t);c.isPhxSticky(t)||i.setHref(this.getHref()),i.join(),t.hasAttribute(De)&&(this.main=i)}e=!0}),e}redirect(e,t,i){i&&$.setCookie(Dt,i,60),this.unload(),$.redirect(e,t)}replaceMain(e,t,i=null,n=this.setPendingLink(e)){let r=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let o=c.findPhxSticky(document)||[],a=c.all(this.outgoingMainEl,`[${this.binding("remove")}]`).filter(h=>!c.isChildOfAny(h,o)),l=c.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(l,t,r),this.main.setRedirect(e),this.transitionRemoves(a),this.main.join((h,d)=>{h===1&&this.commitPendingLink(n)&&this.requestDOMUpdate(()=>{a.forEach(p=>p.remove()),o.forEach(p=>l.appendChild(p)),this.outgoingMainEl.replaceWith(l),this.outgoingMainEl=null,i&&i(n),d()})})}transitionRemoves(e,t){let i=this.binding("remove"),n=r=>{r.preventDefault(),r.stopImmediatePropagation()};e.forEach(r=>{for(let o of this.boundEventNames)r.addEventListener(o,n,!0);this.execJS(r,r.getAttribute(i),"remove")}),this.requestDOMUpdate(()=>{e.forEach(r=>{for(let o of this.boundEventNames)r.removeEventListener(o,n,!0)}),t&&t()})}isPhxView(e){return e.getAttribute&&e.getAttribute(K)!==null}newRootView(e,t,i){let n=new Re(e,this,null,t,i);return this.roots[n.id]=n,n}owner(e,t){let i,n=c.closestViewEl(e);if(n)i=this.getViewByEl(n);else{if(!e.isConnected)return null;i=this.main}return i&&t?t(i):i}withinOwners(e,t){this.owner(e,i=>t(i,e))}getViewByEl(e){let t=e.getAttribute(G);return fe(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(G));t&&t.id===e.id?(t.destroy(),delete this.roots[t.id]):t&&t.destroyDescendent(e.id)}getActiveElement(){return document.activeElement}dropActiveElement(e){this.prevActive&&e.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive instanceof HTMLElement&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive instanceof HTMLElement&&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,n,r,o,a)=>{let l=r.getAttribute(this.binding(li)),h=t.key&&t.key.toLowerCase();if(l&&l.toLowerCase()!==h)return;let d=L({key:t.key},this.eventMeta(i,t,r));S.exec(t,i,o,n,r,["push",{data:d}])}),this.bind({blur:"focusout",focus:"focusin"},(t,i,n,r,o,a)=>{if(!a){let l=L({key:t.key},this.eventMeta(i,t,r));S.exec(t,i,o,n,r,["push",{data:l}])}}),this.bind({blur:"blur",focus:"focus"},(t,i,n,r,o,a)=>{if(a==="window"){let l=this.eventMeta(i,t,r);S.exec(t,i,o,n,r,["push",{data:l}])}}),this.on("dragover",t=>t.preventDefault()),this.on("dragenter",t=>{let i=ue(t.target,this.binding(qe));!i||!(i instanceof HTMLElement)||Ai(t)&&this.js().addClass(i,ft)}),this.on("dragleave",t=>{let i=ue(t.target,this.binding(qe));if(!i||!(i instanceof HTMLElement))return;let n=i.getBoundingClientRect();(t.clientX<=n.left||t.clientX>=n.right||t.clientY<=n.top||t.clientY>=n.bottom)&&this.js().removeClass(i,ft)}),this.on("drop",t=>{t.preventDefault();let i=ue(t.target,this.binding(qe));if(!i||!(i instanceof HTMLElement))return;this.js().removeClass(i,ft);let n=i.getAttribute(this.binding(qe)),r=n&&document.getElementById(n),o=Array.from(t.dataTransfer.files||[]);!r||!(r instanceof HTMLInputElement)||r.disabled||o.length===0||!(r.files instanceof FileList)||(R.trackFiles(r,o,t.dataTransfer),r.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(mt,t=>{let i=t.target;if(!c.isUploadInput(i))return;let n=Array.from(t.detail.files||[]).filter(r=>r instanceof File||r instanceof Blob);R.trackFiles(i,n),i.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(e,t,i){let n=this.metadataCallbacks[e];return n?n(t,i):{}}setPendingLink(e){return this.linkRef++,this.pendingLink=e,this.resetReloadStatus(),this.linkRef}resetReloadStatus(){$.deleteCookie(Dt)}commitPendingLink(e){return this.linkRef!==e?!1:(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(e,t){for(let i in e){let n=e[i];this.on(n,r=>{let o=this.binding(i),a=this.binding(`window-${i}`),l=r.target.getAttribute&&r.target.getAttribute(o);l?this.debounce(r.target,r,n,()=>{this.withinOwners(r.target,h=>{t(r,i,h,r.target,l,null)})}):c.all(document,`[${a}]`,h=>{let d=h.getAttribute(a);this.debounce(h,r,n,()=>{this.withinOwners(h,p=>{t(r,i,p,h,d,"window")})})})})}}bindClicks(){this.on("mousedown",e=>this.clickStartedAtTarget=e.target),this.bindClick("click","click")}bindClick(e,t){let i=this.binding(t);window.addEventListener(e,n=>{let r=null;n.detail===0&&(this.clickStartedAtTarget=n.target);let o=this.clickStartedAtTarget||n.target;r=ue(n.target,i),this.dispatchClickAway(n,o),this.clickStartedAtTarget=null;let a=r&&r.getAttribute(i);if(!a){c.isNewPageClick(n,window.location)&&this.unload();return}r.getAttribute("href")==="#"&&n.preventDefault(),!r.hasAttribute(F)&&this.debounce(r,n,"click",()=>{this.withinOwners(r,l=>{S.exec(n,"click",a,l,r,["push",{data:this.eventMeta("click",n,r)}])})})},!1)}dispatchClickAway(e,t){let i=this.binding("click-away"),n=t.closest(`[${ee}]`),r=n&&c.byId(n.getAttribute(ee));c.all(document,`[${i}]`,o=>{let a=t;n&&!n.contains(o)&&(a=r),o.isSameNode(a)||o.contains(a)||!S.isVisible(t)||this.withinOwners(o,l=>{let h=o.getAttribute(i);S.isVisible(o)&&S.isInViewport(o)&&S.exec(e,"click",h,l,o,["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,backType:n,id:r,scroll:o,position:a}=t.state||{},l=window.location.href,h=a>this.currentHistoryPosition,d=h?i:n||i;this.currentHistoryPosition=a||0,this.sessionStorage.setItem(it,this.currentHistoryPosition.toString()),c.dispatchEvent(window,"phx:navigate",{detail:{href:l,patch:d==="patch",pop:!0,direction:h?"forward":"backward"}}),this.requestDOMUpdate(()=>{let p=()=>{this.maybeScroll(o)};this.main.isConnected()&&d==="patch"&&r===this.main.id?this.main.pushLinkPatch(t,l,null,p):this.replaceMain(l,null,p)})},!1),window.addEventListener("click",t=>{let i=ue(t.target,pt),n=i&&i.getAttribute(pt);if(!n||!this.isConnected()||!this.main||c.wantsNewTab(t))return;let r=i.href instanceof SVGAnimatedString?i.href.baseVal:i.href,o=i.getAttribute(ei);t.preventDefault(),t.stopImmediatePropagation(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if(n==="patch")this.pushHistoryPatch(t,r,o,i);else if(n==="redirect")this.historyRedirect(t,r,o,null,i);else throw new Error(`expected ${pt} to be "patch" or "redirect", got: ${n}`);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={}){c.dispatchEvent(window,`phx:${e}`,{detail:t})}dispatchEvents(e){e.forEach(([t,i])=>this.dispatchEvent(t,i))}withPageLoading(e,t){c.dispatchEvent(window,"phx:page-loading-start",{detail:e});let i=()=>c.dispatchEvent(window,"phx:page-loading-stop",{detail:e});return t?t(i):i}pushHistoryPatch(e,t,i,n){if(!this.isConnected()||!this.main.isMain())return $.redirect(t);this.withPageLoading({to:t,kind:"patch"},r=>{this.main.pushLinkPatch(e,t,n,o=>{this.historyPatch(t,i,o),r()})})}historyPatch(e,t,i=this.setPendingLink(e)){this.commitPendingLink(i)&&(this.currentHistoryPosition++,this.sessionStorage.setItem(it,this.currentHistoryPosition.toString()),$.updateCurrentState(n=>le(L({},n),{backType:"patch"})),$.pushState(t,{type:"patch",id:this.main.id,position:this.currentHistoryPosition},e),c.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:e,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location))}historyRedirect(e,t,i,n,r){let o=r&&e.isTrusted&&e.type!=="popstate";if(o&&r.classList.add("phx-click-loading"),!this.isConnected()||!this.main.isMain())return $.redirect(t,n);if(/^\/$|^\/[^\/]+.*$/.test(t)){let{protocol:l,host:h}=window.location;t=`${l}//${h}${t}`}let a=window.scrollY;this.withPageLoading({to:t,kind:"redirect"},l=>{this.replaceMain(t,n,h=>{h===this.linkRef&&(this.currentHistoryPosition++,this.sessionStorage.setItem(it,this.currentHistoryPosition.toString()),$.updateCurrentState(d=>le(L({},d),{backType:"redirect"})),$.pushState(i,{type:"redirect",id:this.main.id,scroll:a,position:this.currentHistoryPosition},t),c.dispatchEvent(window,"phx:navigate",{detail:{href:t,patch:!1,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location)),o&&r.classList.remove("phx-click-loading"),l()})})}registerNewLocation(e){let{pathname:t,search:i}=this.currentLocation;return t+i===e.pathname+e.search?!1:(this.currentLocation=We(e),!0)}bindForms(){let e=0,t=!1;this.on("submit",i=>{let n=i.target.getAttribute(this.binding("submit")),r=i.target.getAttribute(this.binding("change"));!t&&r&&!n&&(t=!0,i.preventDefault(),this.withinOwners(i.target,o=>{o.disableForm(i.target),window.requestAnimationFrame(()=>{c.isUnloadableFormSubmit(i)&&this.unload(),i.target.submit()})}))}),this.on("submit",i=>{let n=i.target.getAttribute(this.binding("submit"));if(!n){c.isUnloadableFormSubmit(i)&&this.unload();return}i.preventDefault(),i.target.disabled=!0,this.withinOwners(i.target,r=>{S.exec(i,"submit",n,r,i.target,["push",{submitter:i.submitter}])})});for(let i of["change","input"])this.on(i,n=>{if(n instanceof CustomEvent&&(n.target instanceof HTMLInputElement||n.target instanceof HTMLSelectElement||n.target instanceof HTMLTextAreaElement)&&n.target.form===void 0){if(n.detail&&n.detail.dispatcher)throw new Error(`dispatching a custom ${i} event is only supported on input elements inside a form`);return}let r=this.binding("change"),o=n.target;if(this.blockPhxChangeWhileComposing&&n.isComposing){let u=`composition-listener-${i}`;c.private(o,u)||(c.putPrivate(o,u,!0),o.addEventListener("compositionend",()=>{o.dispatchEvent(new Event(i,{bubbles:!0})),c.deletePrivate(o,u)},{once:!0}));return}let a=o.getAttribute(r),l=o.form&&o.form.getAttribute(r),h=a||l;if(!h||o.type==="number"&&o.validity&&o.validity.badInput)return;let d=a?o:o.form,p=e;e++;let{at:m,type:g}=c.private(o,"prev-iteration")||{};m===p-1&&i==="change"&&g==="input"||(c.putPrivate(o,"prev-iteration",{at:p,type:i}),this.debounce(o,n,i,()=>{this.withinOwners(d,u=>{c.putPrivate(o,we,!0),S.exec(n,"change",h,u,o,["push",{_target:n.target.name,dispatcher:d}])})}))});this.on("reset",i=>{let n=i.target;c.resetForm(n);let r=Array.from(n.elements).find(o=>o.type==="reset");r&&window.requestAnimationFrame(()=>{r.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(e,t,i,n){if(i==="blur"||i==="focusout")return n();let r=this.binding(ri),o=this.binding(oi),a=this.defaults.debounce.toString(),l=this.defaults.throttle.toString();this.withinOwners(e,h=>{let d=()=>!h.isDestroyed()&&document.body.contains(e);c.debounce(e,t,r,a,o,l,d,()=>{n()})})}silenceEvents(e){this.silenced=!0,e(),this.silenced=!1}on(e,t){this.boundEventNames.add(e),window.addEventListener(e,i=>{this.silenced||t(i)})}jsQuerySelectorAll(e,t,i){let n=this.domCallbacks.jsQuerySelectorAll;return n?n(e,t,i):i()}},Kt=class{constructor(){this.transitions=new Set,this.promises=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(e=>{clearTimeout(e),this.transitions.delete(e)}),this.promises.clear(),this.flushPendingOps()}after(e){this.size()===0?e():this.pushPendingOp(e)}addTransition(e,t,i){t();let n=setTimeout(()=>{this.transitions.delete(n),i(),this.flushPendingOps()},e);this.transitions.add(n)}addAsyncTransition(e){this.promises.add(e),e.then(()=>{this.promises.delete(e),this.flushPendingOps()})}pushPendingOp(e){this.pendingOps.push(e)}size(){return this.transitions.size+this.promises.size}flushPendingOps(){if(this.size()>0)return;let e=this.pendingOps.shift();e&&(e(),this.flushPendingOps())}};var yn=at;function An(s,e){let t=c.getCustomElHook(s);if(t)return t;s.hasAttribute("id")||w("Elements passed to createHook need to have a unique id attribute",s);let i=new Y(Re.closestView(s),s,e);return c.putCustomElHook(s,i),i}return Ji(_n);})();
|