ash_admin/priv/static/assets/app.js

27 lines
105 KiB
JavaScript
Raw Normal View History

(()=>{var di=Object.create;var Ye=Object.defineProperty;var ci=Object.getOwnPropertyDescriptor;var ui=Object.getOwnPropertyNames,_e=Object.getOwnPropertySymbols,fi=Object.getPrototypeOf,Qe=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable;var St=(e,t,i)=>t in e?Ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,X=(e,t)=>{for(var i in t||(t={}))Qe.call(t,i)&&St(e,i,t[i]);if(_e)for(var i of _e(t))kt.call(t,i)&&St(e,i,t[i]);return e};var Et=(e,t)=>{var i={};for(var s in e)Qe.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(e!=null&&_e)for(var s of _e(e))t.indexOf(s)<0&&kt.call(e,s)&&(i[s]=e[s]);return i};var pi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var mi=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ui(t))!Qe.call(e,n)&&n!==i&&Ye(e,n,{get:()=>t[n],enumerable:!(s=ci(t,n))||s.enumerable});return e};var gi=(e,t,i)=>(i=e!=null?di(fi(e)):{},mi(t||!e||!e.__esModule?Ye(i,"default",{value:e,enumerable:!0}):i,e));var Pt=pi((_t,Le)=>{(function(e,t){"use strict";(function(){for(var f=0,g=["ms","moz","webkit","o"],v=0;v<g.length&&!e.requestAnimationFrame;++v)e.requestAnimationFrame=e[g[v]+"RequestAnimationFrame"],e.cancelAnimationFrame=e[g[v]+"CancelAnimationFrame"]||e[g[v]+"CancelRequestAnimationFrame"];e.requestAnimationFrame||(e.requestAnimationFrame=function(C,R){var T=new Date().getTime(),I=Math.max(0,16-(T-f)),u=e.setTimeout(function(){C(T+I)},I);return f=T+I,u}),e.cancelAnimationFrame||(e.cancelAnimationFrame=function(C){clearTimeout(C)})})();var i,s,n,r=null,o=null,a=null,l=function(f,g,v){f.addEventListener?f.addEventListener(g,v,!1):f.attachEvent?f.attachEvent("on"+g,v):f["on"+g]=v},h={autoRun:!0,barThickness:3,barColors:{0:"rgba(26, 188, 156, .9)",".25":"rgba(52, 152, 219, .9)",".50":"rgba(241, 196, 15, .9)",".75":"rgba(230, 126, 34, .9)","1.0":"rgba(211, 84, 0, .9)"},shadowBlur:10,shadowColor:"rgba(0, 0, 0, .6)",className:null},c=function(){i.width=e.innerWidth,i.height=h.barThickness*5;var f=i.getContext("2d");f.shadowBlur=h.shadowBlur,f.shadowColor=h.shadowColor;var g=f.createLinearGradient(0,0,i.width,0);for(var v in h.barColors)g.addColorStop(v,h.barColors[v]);f.lineWidth=h.barThickness,f.beginPath(),f.moveTo(0,h.barThickness/2),f.lineTo(Math.ceil(s*i.width),h.barThickness/2),f.strokeStyle=g,f.stroke()},p=function(){i=t.createElement("canvas");var f=i.style;f.position="fixed",f.top=f.left=f.right=f.margin=f.padding=0,f.zIndex=100001,f.display="none",h.className&&i.classList.add(h.className),t.body.appendChild(i),l(e,"resize",c)},m={config:function(f){for(var g in f)h.hasOwnProperty(g)&&(h[g]=f[g])},show:function(f){if(!n)if(f){if(a)return;a=setTimeout(()=>m.show(),f)}else n=!0,o!==null&&e.cancelAnimationFrame(o),i||p(),i.style.opacity=1,i.style.display="block",m.progress(0),h.autoRun&&function g(){r=e.requestAnimationFrame(g),m.progress("+"+.05*Math.pow(1-Math.sqrt(s),2))}()},progress:function(f){return typeof f=="undefined"||(typeof f=="string"&&(f=(f.indexOf("+")>=0||f.indexOf("-")>=0?s:0)+parseFloat(f)),s=f>1?1:f,c()),s},hide:function(){clearTimeout(a),a=null,n&&(n=!1,r!=null&&(e.cancelAnimationFrame(r),r=null),function f(){if(m.progress("+.1")>=1&&(i.style.opacity-=.05,i.style.opacity<=.05)){i.style.display="none",o=null;return}o=e.requestAnimationFrame(f)}())}};typeof Le=="object"&&typeof Le.exports=="object"?Le.exports=m:typeof define=="function"&&define.amd?define(function(){return m}):this.topbar=m}).call(_t,window,document)});(function(){var e=t();function t(){if(typeof window.CustomEvent=="function")return window.CustomEvent;function n(r,o){o=o||{bubbles:!1,cancelable:!1,detail:void 0};var a=document.createEvent("CustomEvent");return a.initCustomEvent(r,o.bubbles,o.cancelable,o.detail),a}return n.prototype=window.Event.prototype,n}function i(n,r){var o=document.createElement("input");return o.type="hidden",o.name=n,o.value=r,o}function s(n,r){var o=n.getAttribute("data-to"),a=i("_method",n.getAttribute("data-method")),l=i("_csrf_token",n.getAttribute("data-csrf")),h=document.createElement("form"),c=document.createElement
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,i){for(let n of this.reqs)n.abort();this.readyState=j.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:i});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent!="undefined"?this.onclose(new CloseEvent("close",s)):this.onclose(s)}ajax(e,t,i,s,n){let r,o=()=>{this.reqs.delete(r),s()};r=Re.request(e,this.endpointURL(),t,i,this.timeout,o,a=>{this.reqs.delete(r),this.isActive()&&n(a)}),this.reqs.add(r)}};var xe={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(i))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[i,s,n,r,o]=JSON.parse(e);return t({join_ref:i,ref:s,topic:n,event:r,payload:o})}},binaryEncode(e){let{join_ref:t,ref:i,event:s,topic:n,payload:r}=e,o=this.META_LENGTH+t.length+i.length+n.length+s.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),h=0;l.setUint8(h++,this.KINDS.push),l.setUint8(h++,t.length),l.setUint8(h++,i.length),l.setUint8(h++,n.length),l.setUint8(h++,s.length),Array.from(t,p=>l.setUint8(h++,p.charCodeAt(0))),Array.from(i,p=>l.setUint8(h++,p.charCodeAt(0))),Array.from(n,p=>l.setUint8(h++,p.charCodeAt(0))),Array.from(s,p=>l.setUint8(h++,p.charCodeAt(0)));var c=new Uint8Array(a.byteLength+r.byteLength);return c.set(new Uint8Array(a),0),c.set(new Uint8Array(r),a.byteLength),c.buffer},binaryDecode(e){let t=new DataView(e),i=t.getUint8(0),s=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(e,t,s);case this.KINDS.reply:return this.decodeReply(e,t,s);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,s)}},decodePush(e,t,i){let s=t.getUint8(1),n=t.getUint8(2),r=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=i.decode(e.slice(o,o+s));o=o+s;let l=i.decode(e.slice(o,o+n));o=o+n;let h=i.decode(e.slice(o,o+r));o=o+r;let c=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:l,event:h,payload:c}},decodeReply(e,t,i){let s=t.getUint8(1),n=t.getUint8(2),r=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=i.decode(e.slice(a,a+s));a=a+s;let h=i.decode(e.slice(a,a+n));a=a+n;let c=i.decode(e.slice(a,a+r));a=a+r;let p=i.decode(e.slice(a,a+o));a=a+o;let m=e.slice(a,e.byteLength),f={status:p,response:m};return{join_ref:l,ref:h,topic:c,event:q.reply,payload:f}},decodeBroadcast(e,t,i){let s=t.getUint8(1),n=t.getUint8(2),r=this.HEADER_LENGTH+2,o=i.decode(e.slice(r,r+s));r=r+s;let a=i.decode(e.slice(r,r+n));r=r+n;let l=e.slice(r,e.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},Tt=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||yi,this.transport=t.transport||fe.WebSocket||Ze,this.establishedConnections=0,this.defaultEncoder=xe.encode.bind(xe),this.defaultDecoder=xe.decode.bind(xe),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==Ze?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;ce&&ce.addEventListener&&(ce.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock)}),ce.addEventListener("pageshow",s=>{i===this.connectClock&&(i=null,this.connect())})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=ue(t.params||{}
[${t}="${i.name}"],
[${t}="${i.name.replace(/\[\]$/,"")}"]`;this.deletePrivate(i,pt),this.deletePrivate(i,Xe),this.all(document,s,n=>{n.classList.add(it)})})},showError(e,t){(e.id||e.name)&&this.all(e.form,`[${t}="${e.id}"], [${t}="${e.name}"]`,i=>{this.removeClass(i,it)})},isPhxChild(e){return e.getAttribute&&e.getAttribute(ae)},isPhxSticky(e){return e.getAttribute&&e.getAttribute(Ot)!==null},firstPhxChild(e){return this.isPhxChild(e)?e:this.all(e,`[${ae}]`)[0]},dispatchEvent(e,t,i={}){let n={bubbles:i.bubbles===void 0?!0:!!i.bubbles,cancelable:!0,detail:i.detail||{}},r=t==="click"?new MouseEvent("click",n):new CustomEvent(t,n);e.dispatchEvent(r)},cloneNode(e,t){if(typeof t=="undefined")return e.cloneNode(!0);{let i=e.cloneNode(!1);return i.innerHTML=t,i}},mergeAttrs(e,t,i={}){let s=i.exclude||[],n=i.isIgnored,r=t.attributes;for(let a=r.length-1;a>=0;a--){let l=r[a].name;s.indexOf(l)<0&&e.setAttribute(l,t.getAttribute(l))}let o=e.attributes;for(let a=o.length-1;a>=0;a--){let l=o[a].name;n?l.startsWith("data-")&&!t.hasAttribute(l)&&e.removeAttribute(l):t.hasAttribute(l)||e.removeAttribute(l)}},mergeFocusedInput(e,t){e instanceof HTMLSelectElement||F.mergeAttrs(e,t,{exclude:["value"]}),t.readOnly?e.setAttribute("readonly",!0):e.removeAttribute("readonly")},hasSelectionRange(e){return e.setSelectionRange&&(e.type==="text"||e.type==="textarea")},restoreFocus(e,t,i){if(!F.isTextualInput(e))return;let s=e.matches(":focus");e.readOnly&&e.blur(),s||e.focus(),this.hasSelectionRange(e)&&e.setSelectionRange(t,i)},isFormInput(e){return/^(?:input|select|textarea)$/i.test(e.tagName)&&e.type!=="button"},syncAttrsToProps(e){e instanceof HTMLInputElement&&si.indexOf(e.type.toLocaleLowerCase())>=0&&(e.checked=e.getAttribute("checked")!==null)},isTextualInput(e){return Ii.indexOf(e.type)>=0},isNowTriggerFormExternal(e,t){return e.getAttribute&&e.getAttribute(t)!==null},syncPendingRef(e,t,i){let s=e.getAttribute(U);if(s===null)return!0;let n=e.getAttribute(se);return F.isFormInput(e)||e.getAttribute(i)!==null?(F.isUploadInput(e)&&F.mergeAttrs(e,t,{isIgnored:!0}),F.putPrivate(e,U,t),!1):(Zt.forEach(r=>{e.classList.contains(r)&&t.classList.add(r)}),t.setAttribute(U,s),t.setAttribute(se,n),!0)},cleanChildNodes(e,t){if(F.isPhxUpdate(e,t,["append","prepend"])){let i=[];e.childNodes.forEach(s=>{s.id||(s.nodeType===Node.TEXT_NODE&&s.nodeValue.trim()===""||x(`only HTML element tags with an id are allowed inside containers with phx-update.
removing illegal node: "${(s.outerHTML||s.nodeValue).trim()}"
`),i.push(s))}),i.forEach(s=>s.remove())}},replaceRootContainer(e,t,i){let s=new Set(["id",ee,Ae,vt,ke]);if(e.tagName.toLowerCase()===t.toLowerCase())return Array.from(e.attributes).filter(n=>!s.has(n.name.toLowerCase())).forEach(n=>e.removeAttribute(n.name)),Object.keys(i).filter(n=>!s.has(n.toLowerCase())).forEach(n=>e.setAttribute(n,i[n])),e;{let n=document.createElement(t);return Object.keys(i).forEach(r=>n.setAttribute(r,i[r])),s.forEach(r=>n.setAttribute(r,e.getAttribute(r))),n.innerHTML=e.innerHTML,e.replaceWith(n),n}},getSticky(e,t,i){let s=(F.private(e,"sticky")||[]).find(([n])=>t===n);if(s){let[n,r,o]=s;return o}else return typeof i=="function"?i():i},deleteSticky(e,t){this.updatePrivate(e,"sticky",[],i=>i.filter(([s,n])=>s!==t))},putSticky(e,t,i){let s=i(e);this.updatePrivate(e,"sticky",[],n=>{let r=n.findIndex(([o])=>t===o);return r>=0?n[r]=[t,i,s]:n.push([t,i,s]),n})},applyStickyOperations(e){let t=F.private(e,"sticky");t&&t.forEach(([i,s,n])=>this.putSticky(e,i,s))}},d=F,dt=class{static isActive(e,t){let i=t._phxRef===void 0,n=e.getAttribute(ut).split(",").indexOf(P.genFileRef(t))>=0;return t.size>0&&(i||n)}static isPreflighted(e,t){return e.getAttribute(gt).split(",").indexOf(P.genFileRef(t))>=0&&this.isActive(e,t)}constructor(e,t,i){this.ref=P.genFileRef(t),this.fileEl=e,this.file=t,this.view=i,this.meta=null,this._isCancelled=!1,this._isDone=!1,this._progress=0,this._lastProgressSent=-1,this._onDone=function(){},this._onElUpdated=this.onElUpdated.bind(this),this.fileEl.addEventListener(Be,this._onElUpdated)}metadata(){return this.meta}progress(e){this._progress=Math.floor(e),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{P.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}cancel(){this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(e="failed"){this.fileEl.removeEventListener(Be,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),P.clearFiles(this.fileEl)}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(Be,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(ut).split(",").indexOf(this.ref)===-1&&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}}uploader(e){if(this.meta.uploader){let t=e[this.meta.uploader]||x(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:Wi}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||x(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}},zi=0,P=class{static genFileRef(e){let t=e._phxRef;return t!==void 0?t:(e._phxRef=(zi++).toString(),e._phxRef)}static getEntryDataURL(e,t,i){let s=this.activeFiles(e).find(n=>this.genFileRef(n)===t);i(URL.createObjectURL(s))}static hasUploadsInProgress(e){let t=0;return d.findUploadInputs(e).forEach(i=>{i.getAttribute(gt)!==i.getAttribute(Ri)&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(s=>{let n={path:e.name},r=e.getAttribute(ne);i[r]=i[r]||[],n.ref=this.genFileRef(s),n.last_modified=s.lastModified,n.name=s.name||n.ref,n.relative_path=s.webkitRelativePath,n.type=s.type,n.size=s.size,i[r].push(n)}),i}static clearFiles(e){e.value=null,e.removeAttribute(ne),d.putPrivate(e,"files",[])}static untrackFile(e,t){d.putPrivate(e,"files",d.private(e,"files").filter(i=>!Object.is(i,t)))}static trackFiles(e,t,i){if(e.getAttribute("multiple")!==null){let s=t.filter(n=>!this.activeFiles(e).find(r=>Object.is(r,n)));d.putPrivate(e,"files",this.activeFiles(e).concat(s)),e.value=null}else i&&i.files.length>0&&(e.files=i.files),d.putPrivate(e,"files",t)}static activeFileInputs(e){let t=d.findUploadInputs(e);return Array.from(t).filte
got: "${f.nodeValue.trim()}"
within:
`,n.innerHTML.trim()),f.replaceWith(this.createSpan(f.nodeValue,t)),[!0,m]):(f.remove(),[p,m]),[!1,!1]);return!h&&!c?(x(`expected at least one HTML element tag inside a component, but the component is empty:
`,n.innerHTML.trim()),[this.createSpan("",t).outerHTML,o]):!h&&c?(x("expected at least one HTML element tag directly inside a component, but only subcomponents were found. A component must render at least one HTML tag directly inside itself.",n.innerHTML.trim()),[n.innerHTML,o]):[n.innerHTML,o]}createSpan(e,t){let i=document.createElement("span");return i.innerText=e,i.setAttribute(M,t),i}},fs=1,we=class{static makeID(){return fs++}static elementID(e){return e.phxHookId}constructor(e,t,i){this.__view=e,this.liveSocket=e.liveSocket,this.__callbacks=i,this.__listeners=new Set,this.__isDisconnected=!1,this.el=t,this.el.phxHookId=this.constructor.makeID();for(let s in this.__callbacks)this[s]=this.__callbacks[s]}__mounted(){this.mounted&&this.mounted()}__updated(){this.updated&&this.updated()}__beforeUpdate(){this.beforeUpdate&&this.beforeUpdate()}__destroyed(){this.destroyed&&this.destroyed()}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected&&this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected&&this.disconnected()}pushEvent(e,t={},i=function(){}){return this.__view.pushHookEvent(this.el,null,e,t,i)}pushEventTo(e,t,i={},s=function(){}){return this.__view.withinTargets(e,(n,r)=>n.pushHookEvent(this.el,r,t,i,s))}handleEvent(e,t){let i=(s,n)=>n?e:t(s.detail);return window.addEventListener(`phx:${e}`,i),this.__listeners.add(i),i}removeHandleEvent(e){let t=e(null,!0);window.removeEventListener(`phx:${t}`,e),this.__listeners.delete(e)}upload(e,t){return this.__view.dispatchUploads(e,t)}uploadTo(e,t,i){return this.__view.withinTargets(e,s=>s.dispatchUploads(t,i))}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}},$e=null,ps={exec(e,t,i,s,n){let[r,o]=n||[null,{callback:n&&n.callback}];(t.charAt(0)==="["?JSON.parse(t):[[r,o]]).forEach(([l,h])=>{l===r&&o.data&&(h.data=Object.assign(h.data||{},o.data),h.callback=h.callback||o.callback),this.filterToEls(s,h).forEach(c=>{this[`exec_${l}`](e,t,i,s,c,h)})})},isVisible(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length>0)},exec_exec(e,t,i,s,n,[r,o]){(o?d.all(document,o):[s]).forEach(l=>{let h=l.getAttribute(r);if(!h)throw new Error(`expected ${r} to contain JS command on "${o}"`);i.liveSocket.execJS(l,h,e)})},exec_dispatch(e,t,i,s,n,{to:r,event:o,detail:a,bubbles:l}){a=a||{},a.dispatcher=s,d.dispatchEvent(n,o,{detail:a,bubbles:l})},exec_push(e,t,i,s,n,r){if(!i.isConnected())return;let{event:o,data:a,target:l,page_loading:h,loading:c,value:p,dispatcher:m,callback:f}=r,g={loading:c,value:p,target:l,page_loading:!!h},v=e==="change"&&m?m:s,C=l||v.getAttribute(i.binding("target"))||v;i.withinTargets(C,(R,T)=>{if(e==="change"){let{newCid:I,_target:u}=r;u=u||(d.isFormInput(s)?s.name:void 0),u&&(g._target=u),R.pushInput(s,T,I,o||t,g,f)}else if(e==="submit"){let{submitter:I}=r;R.submitForm(s,T,o||t,I,g,f)}else R.pushEvent(e,s,T,o||t,a,g,f)})},exec_navigate(e,t,i,s,n,{href:r,replace:o}){i.liveSocket.historyRedirect(r,o?"replace":"push")},exec_patch(e,t,i,s,n,{href:r,replace:o}){i.liveSocket.pushHistoryPatch(r,o?"replace":"push",s)},exec_focus(e,t,i,s,n){window.requestAnimationFrame(()=>le.attemptFocus(n))},exec_focus_first(e,t,i,s,n){window.requestAnimationFrame(()=>le.focusFirstInteractive(n)||le.focusFirst(n))},exec_push_focus(e,t,i,s,n){window.requestAnimationFrame(()=>$e=n||s)},exec_pop_focus(e,t,i,s,n){window.requestAnimationFrame(()=>{$e&&$e.focus(),$e=null})},exec_add_class(e,t,i,s,n,{names:r,transition:o,time:a}){this.addOrRemoveClasses(n,r,[],o,a,i)},exec_remove_class(e,t,i,s,n,{names:r,transition:o,time:a}){this.addOrRemoveClasses(n,[],r,o,a,i)},exec_transition(e,t,i,s,n,{time:r,transition:o}){this.addOrRemoveClasses(n,[],[],o,r,i)},exec_toggle(e,t,i,s,n,{display:r,ins:o,outs:a,time:l}){this.toggle(e,i,n,r,o,a,l)},exec_show(e,t,i,s,n,{display:r,transition:o,time:a}){this.show(e,i,n,r,o,a)},exec_hide(e,t,i,s,n,{display:r,transition:o,time:a}){this.hide(e,i,n,r,o,a)},exec_set_attr(e,t,i,s,n,{attr:[r,o]}){this.setOrRemoveAttrs(n,[[r,o]],[])},exec_remove_attr(e,t,i,s,n,{attr:r}){this.setOrRemoveAt
a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example:
import {Socket} from "phoenix"
import {LiveSocket} from "phoenix_live_view"
let liveSocket = new LiveSocket("/live", Socket, {...})
`);this.socket=new t(e,i),this.bindingPrefix=i.bindingPrefix||Ui,this.opts=i,this.params=ht(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(Je(ji),i.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.outgoingMainEl=null,this.clickStartedAtTarget=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=Je(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||Mi,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||Ei,this.reloadJitterMin=i.reloadJitterMin||Ci,this.reloadJitterMax=i.reloadJitterMax||Ti,this.failsafeJitter=i.failsafeJitter||_i,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.domCallbacks=Object.assign({onNodeAdded:ht(),onBeforeElUpdated:ht()},i.dom||{}),this.transitions=new ms,window.addEventListener("pagehide",s=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}isProfileEnabled(){return this.sessionStorage.getItem(ot)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(He)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(He)==="false"}enableDebug(){this.sessionStorage.setItem(He,"true")}enableProfiling(){this.sessionStorage.setItem(ot,"true")}disableDebug(){this.sessionStorage.setItem(He,"false")}disableProfiling(){this.sessionStorage.removeItem(ot)}enableLatencySim(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(at,e)}disableLatencySim(){this.sessionStorage.removeItem(at)}getLatencySim(){let e=this.sessionStorage.getItem(at);return e?parseInt(e):null}getSocket(){return this.socket}connect(){window.location.hostname==="localhost"&&!this.isDebugDisabled()&&this.enableDebug();let e=()=>{this.joinRootViews()?(this.bindTopLevelEvents(),this.socket.connect()):this.main?this.socket.connect():this.bindTopLevelEvents({dead:!0}),this.joinDeadView()};["complete","loaded","interactive"].indexOf(document.readyState)>=0?e():document.addEventListener("DOMContentLoaded",()=>e())}disconnect(e){clearTimeout(this.reloadWithJitterTimer),this.socket.disconnect(e)}replaceTransport(e){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(e),this.connect()}execJS(e,t,i=null){this.owner(e,s=>$.exec(i,t,s,e))}execJSHookPush(e,t,i,s){this.withinOwners(e,n=>{$.exec("hook",t,n,e,["push",{data:i,callback:s}])})}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[s,n]=i();this.viewLogger(e,t,s,n)}else if(this.isDebugEnabled()){let[s,n]=i();Xi(e,t,s,n)}}requestDOMUpdate(e){this.transitions.after(e)}transition(e,t,i=function(){}){this.transitions.addTransition(e,t,i)}onChannel(e,t,i){e.on(t,s=>{let n=this.getLatencySim();n?setTimeout(()=>i(s),n):i(s)})}wrapPush(e,t,i){let s=this.getLatencySim(),n=e.joinCount;if(!s)return this.isConnected()&&t.timeout?i().receive("timeout",()=>{e.joinCount===n&&!e.isDestroyed()&&this.reloadWithJitter(e,()=>{this.log(e,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):i();let r={receives:[],receive(o,a){this.receives.push([o,a])}};return setTimeout(()=>{e.isDestroyed()||r.receives.reduce((o,[a,l])=>o.receive(a,l),i())},s),r}reloadWithJitter(e,t){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,s=this.reloadJitterMax,n=Math.floor(Math.random()*(s-i+1))+i,r=V.updateLocal(this.localStorage,window.location.pathname,Qt,0,o=>o+1);r>this.maxReloads&&(n=this.failsafeJitter),this.reloadWi
/**
* @license MIT
* topbar 2.0.0, 2023-02-04
* https://buunguyen.github.io/topbar
* Copyright (c) 2021 Buu Nguyen
*/