or --> TEXT)\n if (morphedNodeType === ELEMENT_NODE) {\n if (toNodeType === ELEMENT_NODE) {\n if (!compareNodeNames(fromNode, toNode)) {\n onNodeDiscarded(fromNode);\n morphedNode = moveChildren(fromNode, createElementNS(toNode.nodeName, toNode.namespaceURI));\n }\n } else {\n // Going from an element node to a text node\n morphedNode = toNode;\n }\n } else if (morphedNodeType === TEXT_NODE || morphedNodeType === COMMENT_NODE) { // Text or comment node\n if (toNodeType === morphedNodeType) {\n if (morphedNode.nodeValue !== toNode.nodeValue) {\n morphedNode.nodeValue = toNode.nodeValue;\n }\n\n return morphedNode;\n } else {\n // Text node to something else\n morphedNode = toNode;\n }\n }\n }\n\n if (morphedNode === toNode) {\n // The \"to node\" was not compatible with the \"from node\" so we had to\n // toss out the \"from node\" and use the \"to node\"\n onNodeDiscarded(fromNode);\n } else {\n if (toNode.isSameNode && toNode.isSameNode(morphedNode)) {\n return;\n }\n\n morphEl(morphedNode, toNode, childrenOnly);\n\n // We now need to loop over any keyed nodes that might need to be\n // removed. We only do the removal if we know that the keyed node\n // never found a match. When a keyed node is matched up we remove\n // it out of fromNodesLookup and we use fromNodesLookup to determine\n // if a keyed node has been matched up or not\n if (keyedRemovalList) {\n for (var i=0, len=keyedRemovalList.length; i {\n if(activeElement && activeElement.isSameNode(fromEl) && DOM.isFormInput(fromEl)){\n DOM.mergeFocusedInput(fromEl, toEl)\n return false\n }\n }\n })\n }\n\n constructor(view, container, id, html, streams, targetCID){\n this.view = view\n this.liveSocket = view.liveSocket\n this.container = container\n this.id = id\n this.rootID = view.root.id\n this.html = html\n this.streams = streams\n this.streamInserts = {}\n this.targetCID = targetCID\n this.cidPatch = isCid(this.targetCID)\n this.pendingRemoves = []\n this.phxRemove = this.liveSocket.binding(\"remove\")\n this.callbacks = {\n beforeadded: [], beforeupdated: [], beforephxChildAdded: [],\n afteradded: [], afterupdated: [], afterdiscarded: [], afterphxChildAdded: [],\n aftertransitionsDiscarded: []\n }\n }\n\n before(kind, callback){ this.callbacks[`before${kind}`].push(callback) }\n after(kind, callback){ this.callbacks[`after${kind}`].push(callback) }\n\n trackBefore(kind, ...args){\n this.callbacks[`before${kind}`].forEach(callback => callback(...args))\n }\n\n trackAfter(kind, ...args){\n this.callbacks[`after${kind}`].forEach(callback => callback(...args))\n }\n\n markPrunableContentForRemoval(){\n let phxUpdate = this.liveSocket.binding(PHX_UPDATE)\n DOM.all(this.container, `[${phxUpdate}=${PHX_STREAM}]`, el => el.innerHTML = \"\")\n DOM.all(this.container, `[${phxUpdate}=append] > *, [${phxUpdate}=prepend] > *`, el => {\n el.setAttribute(PHX_PRUNE, \"\")\n })\n }\n\n perform(){\n let {view, liveSocket, container, html} = this\n let targetContainer = this.isCIDPatch() ? this.targetCIDContainer(html) : container\n if(this.isCIDPatch() && !targetContainer){ return }\n\n let focused = liveSocket.getActiveElement()\n let {selectionStart, selectionEnd} = focused && DOM.hasSelectionRange(focused) ? focused : {}\n let phxUpdate = liveSocket.binding(PHX_UPDATE)\n let phxFeedbackFor = liveSocket.binding(PHX_FEEDBACK_FOR)\n let disableWith = liveSocket.binding(PHX_DISABLE_WITH)\n let phxViewportTop = liveSocket.binding(PHX_VIEWPORT_TOP)\n let phxViewportBottom = liveSocket.binding(PHX_VIEWPORT_BOTTOM)\n let phxTriggerExternal = liveSocket.binding(PHX_TRIGGER_ACTION)\n let added = []\n let trackedInputs = []\n let updates = []\n let appendPrependUpdates = []\n\n let externalFormTriggered = null\n\n let diffHTML = liveSocket.time(\"premorph container prep\", () => {\n return this.buildDiffHTML(container, html, phxUpdate, targetContainer)\n })\n\n this.trackBefore(\"added\", container)\n this.trackBefore(\"updated\", container, container)\n\n liveSocket.time(\"morphdom\", () => {\n this.streams.forEach(([ref, inserts, deleteIds, reset]) => {\n Object.entries(inserts).forEach(([key, [streamAt, limit]]) => {\n this.streamInserts[key] = {ref, streamAt, limit}\n })\n if(reset !== undefined){\n DOM.all(container, `[${PHX_STREAM_REF}=\"${ref}\"]`, child => {\n if(!inserts[child.id]){\n this.removeStreamChildElement(child)\n }\n })\n }\n deleteIds.forEach(id => {\n let child = container.querySelector(`[id=\"${id}\"]`)\n if(child){ this.removeStreamChildElement(child) }\n })\n })\n\n morphdom(targetContainer, diffHTML, {\n childrenOnly: targetContainer.getAttribute(PHX_COMPONENT) === null,\n getNodeKey: (node) => {\n return DOM.isPhxDestroyed(node) ? null : node.id\n },\n // skip indexing from children when container is stream\n skipFromChildren: (from) => { return from.getAttribute(phxUpdate) === PHX_STREAM },\n // tell morphdom how to add a child\n addChild: (parent, child) => {\n let {ref, streamAt, limit} = this.getStreamInsert(child)\n if(ref === undefined) { return parent.appendChild(child) }\n\n DOM.putSticky(child, PHX_STREAM_REF, el => el.setAttribute(PHX_STREAM_REF, ref))\n\n // streaming\n if(streamAt === 0){\n parent.insertAdjacentElement(\"afterbegin\", child)\n } else if(streamAt === -1){\n parent.appendChild(child)\n } else if(streamAt > 0){\n let sibling = Array.from(parent.children)[streamAt]\n parent.insertBefore(child, sibling)\n }\n let children = limit !== null && Array.from(parent.children)\n let childrenToRemove = []\n if(limit && limit < 0 && children.length > limit * -1){\n childrenToRemove = children.slice(0, children.length + limit)\n } else if(limit && limit >= 0 && children.length > limit){\n childrenToRemove = children.slice(limit)\n }\n childrenToRemove.forEach(removeChild => {\n // do not remove child as part of limit if we are re-adding it\n if(!this.streamInserts[removeChild.id]){\n this.removeStreamChildElement(removeChild)\n }\n })\n },\n onBeforeNodeAdded: (el) => {\n DOM.maybeAddPrivateHooks(el, phxViewportTop, phxViewportBottom)\n this.trackBefore(\"added\", el)\n return el\n },\n onNodeAdded: (el) => {\n if(el.getAttribute){ this.maybeReOrderStream(el) }\n\n // hack to fix Safari handling of img srcset and video tags\n if(el instanceof HTMLImageElement && el.srcset){\n el.srcset = el.srcset\n } else if(el instanceof HTMLVideoElement && el.autoplay){\n el.play()\n }\n if(DOM.isNowTriggerFormExternal(el, phxTriggerExternal)){\n externalFormTriggered = el\n }\n\n if(el.getAttribute && el.getAttribute(\"name\") && DOM.isFormInput(el)){\n trackedInputs.push(el)\n }\n // nested view handling\n if((DOM.isPhxChild(el) && view.ownsElement(el)) || DOM.isPhxSticky(el) && view.ownsElement(el.parentNode)){\n this.trackAfter(\"phxChildAdded\", el)\n }\n added.push(el)\n },\n onNodeDiscarded: (el) => this.onNodeDiscarded(el),\n onBeforeNodeDiscarded: (el) => {\n if(el.getAttribute && el.getAttribute(PHX_PRUNE) !== null){ return true }\n if(el.parentElement !== null && el.id &&\n DOM.isPhxUpdate(el.parentElement, phxUpdate, [PHX_STREAM, \"append\", \"prepend\"])){\n return false\n }\n if(this.maybePendingRemove(el)){ return false }\n if(this.skipCIDSibling(el)){ return false }\n\n return true\n },\n onElUpdated: (el) => {\n if(DOM.isNowTriggerFormExternal(el, phxTriggerExternal)){\n externalFormTriggered = el\n }\n updates.push(el)\n this.maybeReOrderStream(el)\n },\n onBeforeElUpdated: (fromEl, toEl) => {\n DOM.maybeAddPrivateHooks(toEl, phxViewportTop, phxViewportBottom)\n DOM.cleanChildNodes(toEl, phxUpdate)\n if(this.skipCIDSibling(toEl)){ return false }\n if(DOM.isPhxSticky(fromEl)){ return false }\n if(DOM.isIgnored(fromEl, phxUpdate) || (fromEl.form && fromEl.form.isSameNode(externalFormTriggered))){\n this.trackBefore(\"updated\", fromEl, toEl)\n DOM.mergeAttrs(fromEl, toEl, {isIgnored: true})\n updates.push(fromEl)\n DOM.applyStickyOperations(fromEl)\n return false\n }\n if(fromEl.type === \"number\" && (fromEl.validity && fromEl.validity.badInput)){ return false }\n if(!DOM.syncPendingRef(fromEl, toEl, disableWith)){\n if(DOM.isUploadInput(fromEl)){\n this.trackBefore(\"updated\", fromEl, toEl)\n updates.push(fromEl)\n }\n DOM.applyStickyOperations(fromEl)\n return false\n }\n\n // nested view handling\n if(DOM.isPhxChild(toEl)){\n let prevSession = fromEl.getAttribute(PHX_SESSION)\n DOM.mergeAttrs(fromEl, toEl, {exclude: [PHX_STATIC]})\n if(prevSession !== \"\"){ fromEl.setAttribute(PHX_SESSION, prevSession) }\n fromEl.setAttribute(PHX_ROOT_ID, this.rootID)\n DOM.applyStickyOperations(fromEl)\n return false\n }\n\n // input handling\n DOM.copyPrivates(toEl, fromEl)\n\n let isFocusedFormEl = focused && fromEl.isSameNode(focused) && DOM.isFormInput(fromEl)\n if(isFocusedFormEl && fromEl.type !== \"hidden\"){\n this.trackBefore(\"updated\", fromEl, toEl)\n DOM.mergeFocusedInput(fromEl, toEl)\n DOM.syncAttrsToProps(fromEl)\n updates.push(fromEl)\n DOM.applyStickyOperations(fromEl)\n trackedInputs.push(fromEl)\n return false\n } else {\n if(DOM.isPhxUpdate(toEl, phxUpdate, [\"append\", \"prepend\"])){\n appendPrependUpdates.push(new DOMPostMorphRestorer(fromEl, toEl, toEl.getAttribute(phxUpdate)))\n }\n\n DOM.syncAttrsToProps(toEl)\n DOM.applyStickyOperations(toEl)\n if(toEl.getAttribute(\"name\") && DOM.isFormInput(toEl)){\n trackedInputs.push(toEl)\n }\n this.trackBefore(\"updated\", fromEl, toEl)\n return true\n }\n }\n })\n })\n\n if(liveSocket.isDebugEnabled()){ detectDuplicateIds() }\n\n if(appendPrependUpdates.length > 0){\n liveSocket.time(\"post-morph append/prepend restoration\", () => {\n appendPrependUpdates.forEach(update => update.perform())\n })\n }\n\n trackedInputs.forEach(input => {\n DOM.maybeHideFeedback(targetContainer, input, phxFeedbackFor)\n })\n\n liveSocket.silenceEvents(() => DOM.restoreFocus(focused, selectionStart, selectionEnd))\n DOM.dispatchEvent(document, \"phx:update\")\n added.forEach(el => this.trackAfter(\"added\", el))\n updates.forEach(el => this.trackAfter(\"updated\", el))\n\n this.transitionPendingRemoves()\n\n if(externalFormTriggered){\n liveSocket.unload()\n externalFormTriggered.submit()\n }\n return true\n }\n\n onNodeDiscarded(el){\n // nested view handling\n if(DOM.isPhxChild(el) || DOM.isPhxSticky(el)){ this.liveSocket.destroyViewByEl(el) }\n this.trackAfter(\"discarded\", el)\n }\n\n maybePendingRemove(node){\n if(node.getAttribute && node.getAttribute(this.phxRemove) !== null){\n this.pendingRemoves.push(node)\n return true\n } else {\n return false\n }\n }\n\n removeStreamChildElement(child){\n if(!this.maybePendingRemove(child)){\n child.remove()\n this.onNodeDiscarded(child)\n }\n }\n\n getStreamInsert(el){\n let insert = el.id ? this.streamInserts[el.id] : {}\n return insert || {}\n }\n\n maybeReOrderStream(el){\n let {ref, streamAt, limit} = this.getStreamInsert(el)\n if(streamAt === undefined){ return }\n\n // we need to the PHX_STREAM_REF here as well as addChild is invoked only for parents\n DOM.putSticky(el, PHX_STREAM_REF, el => el.setAttribute(PHX_STREAM_REF, ref))\n\n if(streamAt === 0){\n el.parentElement.insertBefore(el, el.parentElement.firstElementChild)\n } else if(streamAt > 0){\n let children = Array.from(el.parentElement.children)\n let oldIndex = children.indexOf(el)\n if(streamAt >= children.length - 1){\n el.parentElement.appendChild(el)\n } else {\n let sibling = children[streamAt]\n if(oldIndex > streamAt){\n el.parentElement.insertBefore(el, sibling)\n } else {\n el.parentElement.insertBefore(el, sibling.nextElementSibling)\n }\n }\n }\n }\n\n transitionPendingRemoves(){\n let {pendingRemoves, liveSocket} = this\n if(pendingRemoves.length > 0){\n liveSocket.transitionRemoves(pendingRemoves)\n liveSocket.requestDOMUpdate(() => {\n pendingRemoves.forEach(el => {\n let child = DOM.firstPhxChild(el)\n if(child){ liveSocket.destroyViewByEl(child) }\n el.remove()\n })\n this.trackAfter(\"transitionsDiscarded\", pendingRemoves)\n })\n }\n }\n\n isCIDPatch(){ return this.cidPatch }\n\n skipCIDSibling(el){\n return el.nodeType === Node.ELEMENT_NODE && el.getAttribute(PHX_SKIP) !== null\n }\n\n targetCIDContainer(html){\n if(!this.isCIDPatch()){ return }\n let [first, ...rest] = DOM.findComponentNodeList(this.container, this.targetCID)\n if(rest.length === 0 && DOM.childNodeLength(html) === 1){\n return first\n } else {\n return first && first.parentNode\n }\n }\n\n // builds HTML for morphdom patch\n // - for full patches of LiveView or a component with a single\n // root node, simply returns the HTML\n // - for patches of a component with multiple root nodes, the\n // parent node becomes the target container and non-component\n // siblings are marked as skip.\n buildDiffHTML(container, html, phxUpdate, targetContainer){\n let isCIDPatch = this.isCIDPatch()\n let isCIDWithSingleRoot = isCIDPatch && targetContainer.getAttribute(PHX_COMPONENT) === this.targetCID.toString()\n if(!isCIDPatch || isCIDWithSingleRoot){\n return html\n } else {\n // component patch with multiple CID roots\n let diffContainer = null\n let template = document.createElement(\"template\")\n diffContainer = DOM.cloneNode(targetContainer)\n let [firstComponent, ...rest] = DOM.findComponentNodeList(diffContainer, this.targetCID)\n template.innerHTML = html\n rest.forEach(el => el.remove())\n Array.from(diffContainer.childNodes).forEach(child => {\n // we can only skip trackable nodes with an ID\n if(child.id && child.nodeType === Node.ELEMENT_NODE && child.getAttribute(PHX_COMPONENT) !== this.targetCID.toString()){\n child.setAttribute(PHX_SKIP, \"\")\n child.innerHTML = \"\"\n }\n })\n Array.from(template.content.childNodes).forEach(el => diffContainer.insertBefore(el, firstComponent))\n firstComponent.remove()\n return diffContainer.outerHTML\n }\n }\n\n indexOf(parent, child){ return Array.from(parent.children).indexOf(child) }\n}\n", "import {\n COMPONENTS,\n DYNAMICS,\n TEMPLATES,\n EVENTS,\n PHX_COMPONENT,\n PHX_SKIP,\n REPLY,\n STATIC,\n TITLE,\n STREAM,\n} from \"./constants\"\n\nimport {\n isObject,\n logError,\n isCid,\n} from \"./utils\"\n\nexport default class Rendered {\n static extract(diff){\n let {[REPLY]: reply, [EVENTS]: events, [TITLE]: title} = diff\n delete diff[REPLY]\n delete diff[EVENTS]\n delete diff[TITLE]\n return {diff, title, reply: reply || null, events: events || []}\n }\n\n constructor(viewId, rendered){\n this.viewId = viewId\n this.rendered = {}\n this.mergeDiff(rendered)\n }\n\n parentViewId(){ return this.viewId }\n\n toString(onlyCids){\n let [str, streams] = this.recursiveToString(this.rendered, this.rendered[COMPONENTS], onlyCids)\n return [str, streams]\n }\n\n recursiveToString(rendered, components = rendered[COMPONENTS], onlyCids){\n onlyCids = onlyCids ? new Set(onlyCids) : null\n let output = {buffer: \"\", components: components, onlyCids: onlyCids, streams: new Set()}\n this.toOutputBuffer(rendered, null, output)\n return [output.buffer, output.streams]\n }\n\n componentCIDs(diff){ return Object.keys(diff[COMPONENTS] || {}).map(i => parseInt(i)) }\n\n isComponentOnlyDiff(diff){\n if(!diff[COMPONENTS]){ return false }\n return Object.keys(diff).length === 1\n }\n\n getComponent(diff, cid){ return diff[COMPONENTS][cid] }\n\n mergeDiff(diff){\n let newc = diff[COMPONENTS]\n let cache = {}\n delete diff[COMPONENTS]\n this.rendered = this.mutableMerge(this.rendered, diff)\n this.rendered[COMPONENTS] = this.rendered[COMPONENTS] || {}\n\n if(newc){\n let oldc = this.rendered[COMPONENTS]\n\n for(let cid in newc){\n newc[cid] = this.cachedFindComponent(cid, newc[cid], oldc, newc, cache)\n }\n\n for(let cid in newc){ oldc[cid] = newc[cid] }\n diff[COMPONENTS] = newc\n }\n }\n\n cachedFindComponent(cid, cdiff, oldc, newc, cache){\n if(cache[cid]){\n return cache[cid]\n } else {\n let ndiff, stat, scid = cdiff[STATIC]\n\n if(isCid(scid)){\n let tdiff\n\n if(scid > 0){\n tdiff = this.cachedFindComponent(scid, newc[scid], oldc, newc, cache)\n } else {\n tdiff = oldc[-scid]\n }\n\n stat = tdiff[STATIC]\n ndiff = this.cloneMerge(tdiff, cdiff)\n ndiff[STATIC] = stat\n } else {\n ndiff = cdiff[STATIC] !== undefined ? cdiff : this.cloneMerge(oldc[cid] || {}, cdiff)\n }\n\n cache[cid] = ndiff\n return ndiff\n }\n }\n\n mutableMerge(target, source){\n if(source[STATIC] !== undefined){\n return source\n } else {\n this.doMutableMerge(target, source)\n return target\n }\n }\n\n doMutableMerge(target, source){\n for(let key in source){\n let val = source[key]\n let targetVal = target[key]\n let isObjVal = isObject(val)\n if(isObjVal && val[STATIC] === undefined && isObject(targetVal)){\n this.doMutableMerge(targetVal, val)\n } else {\n target[key] = val\n }\n }\n }\n\n cloneMerge(target, source){\n let merged = {...target, ...source}\n for(let key in merged){\n let val = source[key]\n let targetVal = target[key]\n if(isObject(val) && val[STATIC] === undefined && isObject(targetVal)){\n merged[key] = this.cloneMerge(targetVal, val)\n }\n }\n return merged\n }\n\n componentToString(cid){\n let [str, streams] = this.recursiveCIDToString(this.rendered[COMPONENTS], cid)\n return [str, streams]\n }\n\n pruneCIDs(cids){\n cids.forEach(cid => delete this.rendered[COMPONENTS][cid])\n }\n\n // private\n\n get(){ return this.rendered }\n\n isNewFingerprint(diff = {}){ return !!diff[STATIC] }\n\n templateStatic(part, templates){\n if(typeof (part) === \"number\") {\n return templates[part]\n } else {\n return part\n }\n }\n\n toOutputBuffer(rendered, templates, output){\n if(rendered[DYNAMICS]){ return this.comprehensionToBuffer(rendered, templates, output) }\n let {[STATIC]: statics} = rendered\n statics = this.templateStatic(statics, templates)\n\n output.buffer += statics[0]\n for(let i = 1; i < statics.length; i++){\n this.dynamicToBuffer(rendered[i - 1], templates, output)\n output.buffer += statics[i]\n }\n }\n\n comprehensionToBuffer(rendered, templates, output){\n let {[DYNAMICS]: dynamics, [STATIC]: statics, [STREAM]: stream} = rendered\n let [_ref, _inserts, deleteIds, reset] = stream || [null, {}, [], null]\n statics = this.templateStatic(statics, templates)\n let compTemplates = templates || rendered[TEMPLATES]\n for(let d = 0; d < dynamics.length; d++){\n let dynamic = dynamics[d]\n output.buffer += statics[0]\n for(let i = 1; i < statics.length; i++){\n this.dynamicToBuffer(dynamic[i - 1], compTemplates, output)\n output.buffer += statics[i]\n }\n }\n\n if(stream !== undefined && (rendered[DYNAMICS].length > 0 || deleteIds.length > 0 || reset)){\n delete rendered[STREAM]\n rendered[DYNAMICS] = []\n output.streams.add(stream)\n }\n }\n\n dynamicToBuffer(rendered, templates, output){\n if(typeof (rendered) === \"number\"){\n let [str, streams] = this.recursiveCIDToString(output.components, rendered, output.onlyCids)\n output.buffer += str\n output.streams = new Set([...output.streams, ...streams])\n } else if(isObject(rendered)){\n this.toOutputBuffer(rendered, templates, output)\n } else {\n output.buffer += rendered\n }\n }\n\n recursiveCIDToString(components, cid, onlyCids){\n let component = components[cid] || logError(`no component for CID ${cid}`, components)\n let template = document.createElement(\"template\")\n let [html, streams] = this.recursiveToString(component, components, onlyCids)\n template.innerHTML = html\n let container = template.content\n let skip = onlyCids && !onlyCids.has(cid)\n\n let [hasChildNodes, hasChildComponents] =\n Array.from(container.childNodes).reduce(([hasNodes, hasComponents], child, i) => {\n if(child.nodeType === Node.ELEMENT_NODE){\n if(child.getAttribute(PHX_COMPONENT)){\n return [hasNodes, true]\n }\n child.setAttribute(PHX_COMPONENT, cid)\n if(!child.id){ child.id = `${this.parentViewId()}-${cid}-${i}` }\n if(skip){\n child.setAttribute(PHX_SKIP, \"\")\n child.innerHTML = \"\"\n }\n return [true, hasComponents]\n } else {\n if(child.nodeValue.trim() !== \"\"){\n logError(\"only HTML element tags are allowed at the root of components.\\n\\n\" +\n `got: \"${child.nodeValue.trim()}\"\\n\\n` +\n \"within:\\n\", template.innerHTML.trim())\n child.replaceWith(this.createSpan(child.nodeValue, cid))\n return [true, hasComponents]\n } else {\n child.remove()\n return [hasNodes, hasComponents]\n }\n }\n }, [false, false])\n\n if(!hasChildNodes && !hasChildComponents){\n logError(\"expected at least one HTML element tag inside a component, but the component is empty:\\n\",\n template.innerHTML.trim())\n return [this.createSpan(\"\", cid).outerHTML, streams]\n } else if(!hasChildNodes && hasChildComponents){\n logError(\"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 template.innerHTML.trim())\n return [template.innerHTML, streams]\n } else {\n return [template.innerHTML, streams]\n }\n }\n\n createSpan(text, cid){\n let span = document.createElement(\"span\")\n span.innerText = text\n span.setAttribute(PHX_COMPONENT, cid)\n return span\n }\n}\n", "let viewHookID = 1\nexport default class ViewHook {\n static makeID(){ return viewHookID++ }\n static elementID(el){ return el.phxHookId }\n\n constructor(view, el, callbacks){\n this.__view = view\n this.liveSocket = view.liveSocket\n this.__callbacks = callbacks\n this.__listeners = new Set()\n this.__isDisconnected = false\n this.el = el\n this.el.phxHookId = this.constructor.makeID()\n for(let key in this.__callbacks){ this[key] = this.__callbacks[key] }\n }\n\n __mounted(){ this.mounted && this.mounted() }\n __updated(){ this.updated && this.updated() }\n __beforeUpdate(){ this.beforeUpdate && this.beforeUpdate() }\n __destroyed(){ this.destroyed && this.destroyed() }\n __reconnected(){\n if(this.__isDisconnected){\n this.__isDisconnected = false\n this.reconnected && this.reconnected()\n }\n }\n __disconnected(){\n this.__isDisconnected = true\n this.disconnected && this.disconnected()\n }\n\n pushEvent(event, payload = {}, onReply = function (){ }){\n return this.__view.pushHookEvent(this.el, null, event, payload, onReply)\n }\n\n pushEventTo(phxTarget, event, payload = {}, onReply = function (){ }){\n return this.__view.withinTargets(phxTarget, (view, targetCtx) => {\n return view.pushHookEvent(this.el, targetCtx, event, payload, onReply)\n })\n }\n\n handleEvent(event, callback){\n let callbackRef = (customEvent, bypass) => bypass ? event : callback(customEvent.detail)\n window.addEventListener(`phx:${event}`, callbackRef)\n this.__listeners.add(callbackRef)\n return callbackRef\n }\n\n removeHandleEvent(callbackRef){\n let event = callbackRef(null, true)\n window.removeEventListener(`phx:${event}`, callbackRef)\n this.__listeners.delete(callbackRef)\n }\n\n upload(name, files){\n return this.__view.dispatchUploads(name, files)\n }\n\n uploadTo(phxTarget, name, files){\n return this.__view.withinTargets(phxTarget, view => view.dispatchUploads(name, files))\n }\n\n __cleanup__(){\n this.__listeners.forEach(callbackRef => this.removeHandleEvent(callbackRef))\n }\n}\n", "import DOM from \"./dom\"\nimport ARIA from \"./aria\"\n\nlet focusStack = null\n\nlet JS = {\n exec(eventType, phxEvent, view, sourceEl, defaults){\n let [defaultKind, defaultArgs] = defaults || [null, {callback: defaults && defaults.callback}]\n let commands = phxEvent.charAt(0) === \"[\" ?\n JSON.parse(phxEvent) : [[defaultKind, defaultArgs]]\n\n\n\n commands.forEach(([kind, args]) => {\n if(kind === defaultKind && defaultArgs.data){\n args.data = Object.assign(args.data || {}, defaultArgs.data)\n args.callback = args.callback || defaultArgs.callback\n }\n this.filterToEls(sourceEl, args).forEach(el => {\n this[`exec_${kind}`](eventType, phxEvent, view, sourceEl, el, args)\n })\n })\n },\n\n isVisible(el){\n return !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length > 0)\n },\n\n // private\n\n // commands\n\n exec_exec(eventType, phxEvent, view, sourceEl, el, [attr, to]){\n let nodes = to ? DOM.all(document, to) : [sourceEl]\n nodes.forEach(node => {\n let encodedJS = node.getAttribute(attr)\n if(!encodedJS){ throw new Error(`expected ${attr} to contain JS command on \"${to}\"`) }\n view.liveSocket.execJS(node, encodedJS, eventType)\n })\n },\n\n exec_dispatch(eventType, phxEvent, view, sourceEl, el, {to, event, detail, bubbles}){\n detail = detail || {}\n detail.dispatcher = sourceEl\n DOM.dispatchEvent(el, event, {detail, bubbles})\n },\n\n exec_push(eventType, phxEvent, view, sourceEl, el, args){\n if(!view.isConnected()){ return }\n\n let {event, data, target, page_loading, loading, value, dispatcher, callback} = args\n let pushOpts = {loading, value, target, page_loading: !!page_loading}\n let targetSrc = eventType === \"change\" && dispatcher ? dispatcher : sourceEl\n let phxTarget = target || targetSrc.getAttribute(view.binding(\"target\")) || targetSrc\n view.withinTargets(phxTarget, (targetView, targetCtx) => {\n if(eventType === \"change\"){\n let {newCid, _target} = args\n _target = _target || (DOM.isFormInput(sourceEl) ? sourceEl.name : undefined)\n if(_target){ pushOpts._target = _target }\n targetView.pushInput(sourceEl, targetCtx, newCid, event || phxEvent, pushOpts, callback)\n } else if(eventType === \"submit\"){\n let {submitter} = args\n targetView.submitForm(sourceEl, targetCtx, event || phxEvent, submitter, pushOpts, callback)\n } else {\n targetView.pushEvent(eventType, sourceEl, targetCtx, event || phxEvent, data, pushOpts, callback)\n }\n })\n },\n\n exec_navigate(eventType, phxEvent, view, sourceEl, el, {href, replace}){\n view.liveSocket.historyRedirect(href, replace ? \"replace\" : \"push\")\n },\n\n exec_patch(eventType, phxEvent, view, sourceEl, el, {href, replace}){\n view.liveSocket.pushHistoryPatch(href, replace ? \"replace\" : \"push\", sourceEl)\n },\n\n exec_focus(eventType, phxEvent, view, sourceEl, el){\n window.requestAnimationFrame(() => ARIA.attemptFocus(el))\n },\n\n exec_focus_first(eventType, phxEvent, view, sourceEl, el){\n window.requestAnimationFrame(() => ARIA.focusFirstInteractive(el) || ARIA.focusFirst(el))\n },\n\n exec_push_focus(eventType, phxEvent, view, sourceEl, el){\n window.requestAnimationFrame(() => focusStack = el || sourceEl)\n },\n\n exec_pop_focus(eventType, phxEvent, view, sourceEl, el){\n window.requestAnimationFrame(() => {\n if(focusStack){ focusStack.focus() }\n focusStack = null\n })\n },\n\n exec_add_class(eventType, phxEvent, view, sourceEl, el, {names, transition, time}){\n this.addOrRemoveClasses(el, names, [], transition, time, view)\n },\n\n exec_remove_class(eventType, phxEvent, view, sourceEl, el, {names, transition, time}){\n this.addOrRemoveClasses(el, [], names, transition, time, view)\n },\n\n exec_transition(eventType, phxEvent, view, sourceEl, el, {time, transition}){\n this.addOrRemoveClasses(el, [], [], transition, time, view)\n },\n\n exec_toggle(eventType, phxEvent, view, sourceEl, el, {display, ins, outs, time}){\n this.toggle(eventType, view, el, display, ins, outs, time)\n },\n\n exec_show(eventType, phxEvent, view, sourceEl, el, {display, transition, time}){\n this.show(eventType, view, el, display, transition, time)\n },\n\n exec_hide(eventType, phxEvent, view, sourceEl, el, {display, transition, time}){\n this.hide(eventType, view, el, display, transition, time)\n },\n\n exec_set_attr(eventType, phxEvent, view, sourceEl, el, {attr: [attr, val]}){\n this.setOrRemoveAttrs(el, [[attr, val]], [])\n },\n\n exec_remove_attr(eventType, phxEvent, view, sourceEl, el, {attr}){\n this.setOrRemoveAttrs(el, [], [attr])\n },\n\n // utils for commands\n\n show(eventType, view, el, display, transition, time){\n if(!this.isVisible(el)){\n this.toggle(eventType, view, el, display, transition, null, time)\n }\n },\n\n hide(eventType, view, el, display, transition, time){\n if(this.isVisible(el)){\n this.toggle(eventType, view, el, display, null, transition, time)\n }\n },\n\n toggle(eventType, view, el, display, ins, outs, time){\n let [inClasses, inStartClasses, inEndClasses] = ins || [[], [], []]\n let [outClasses, outStartClasses, outEndClasses] = outs || [[], [], []]\n if(inClasses.length > 0 || outClasses.length > 0){\n if(this.isVisible(el)){\n let onStart = () => {\n this.addOrRemoveClasses(el, outStartClasses, inClasses.concat(inStartClasses).concat(inEndClasses))\n window.requestAnimationFrame(() => {\n this.addOrRemoveClasses(el, outClasses, [])\n window.requestAnimationFrame(() => this.addOrRemoveClasses(el, outEndClasses, outStartClasses))\n })\n }\n el.dispatchEvent(new Event(\"phx:hide-start\"))\n view.transition(time, onStart, () => {\n this.addOrRemoveClasses(el, [], outClasses.concat(outEndClasses))\n DOM.putSticky(el, \"toggle\", currentEl => currentEl.style.display = \"none\")\n el.dispatchEvent(new Event(\"phx:hide-end\"))\n })\n } else {\n if(eventType === \"remove\"){ return }\n let onStart = () => {\n this.addOrRemoveClasses(el, inStartClasses, outClasses.concat(outStartClasses).concat(outEndClasses))\n let stickyDisplay = display || this.defaultDisplay(el)\n DOM.putSticky(el, \"toggle\", currentEl => currentEl.style.display = stickyDisplay)\n window.requestAnimationFrame(() => {\n this.addOrRemoveClasses(el, inClasses, [])\n window.requestAnimationFrame(() => this.addOrRemoveClasses(el, inEndClasses, inStartClasses))\n })\n }\n el.dispatchEvent(new Event(\"phx:show-start\"))\n view.transition(time, onStart, () => {\n this.addOrRemoveClasses(el, [], inClasses.concat(inEndClasses))\n el.dispatchEvent(new Event(\"phx:show-end\"))\n })\n }\n } else {\n if(this.isVisible(el)){\n window.requestAnimationFrame(() => {\n el.dispatchEvent(new Event(\"phx:hide-start\"))\n DOM.putSticky(el, \"toggle\", currentEl => currentEl.style.display = \"none\")\n el.dispatchEvent(new Event(\"phx:hide-end\"))\n })\n } else {\n window.requestAnimationFrame(() => {\n el.dispatchEvent(new Event(\"phx:show-start\"))\n let stickyDisplay = display || this.defaultDisplay(el)\n DOM.putSticky(el, \"toggle\", currentEl => currentEl.style.display = stickyDisplay)\n el.dispatchEvent(new Event(\"phx:show-end\"))\n })\n }\n }\n },\n\n addOrRemoveClasses(el, adds, removes, transition, time, view){\n let [transition_run, transition_start, transition_end] = transition || [[], [], []]\n if(transition_run.length > 0){\n let onStart = () => this.addOrRemoveClasses(el, transition_start.concat(transition_run), [])\n let onDone = () => this.addOrRemoveClasses(el, adds.concat(transition_end), removes.concat(transition_run).concat(transition_start))\n return view.transition(time, onStart, onDone)\n }\n window.requestAnimationFrame(() => {\n let [prevAdds, prevRemoves] = DOM.getSticky(el, \"classes\", [[], []])\n let keepAdds = adds.filter(name => prevAdds.indexOf(name) < 0 && !el.classList.contains(name))\n let keepRemoves = removes.filter(name => prevRemoves.indexOf(name) < 0 && el.classList.contains(name))\n let newAdds = prevAdds.filter(name => removes.indexOf(name) < 0).concat(keepAdds)\n let newRemoves = prevRemoves.filter(name => adds.indexOf(name) < 0).concat(keepRemoves)\n\n DOM.putSticky(el, \"classes\", currentEl => {\n currentEl.classList.remove(...newRemoves)\n currentEl.classList.add(...newAdds)\n return [newAdds, newRemoves]\n })\n })\n },\n\n setOrRemoveAttrs(el, sets, removes){\n let [prevSets, prevRemoves] = DOM.getSticky(el, \"attrs\", [[], []])\n\n let alteredAttrs = sets.map(([attr, _val]) => attr).concat(removes);\n let newSets = prevSets.filter(([attr, _val]) => !alteredAttrs.includes(attr)).concat(sets);\n let newRemoves = prevRemoves.filter((attr) => !alteredAttrs.includes(attr)).concat(removes);\n\n DOM.putSticky(el, \"attrs\", currentEl => {\n newRemoves.forEach(attr => currentEl.removeAttribute(attr))\n newSets.forEach(([attr, val]) => currentEl.setAttribute(attr, val))\n return [newSets, newRemoves]\n })\n },\n\n hasAllClasses(el, classes){ return classes.every(name => el.classList.contains(name)) },\n\n isToggledOut(el, outClasses){\n return !this.isVisible(el) || this.hasAllClasses(el, outClasses)\n },\n\n filterToEls(sourceEl, {to}){\n return to ? DOM.all(document, to) : [sourceEl]\n },\n\n defaultDisplay(el){\n return {tr: \"table-row\", td: \"table-cell\"}[el.tagName.toLowerCase()] || \"block\"\n }\n}\n\nexport default JS\n", "import {\n BEFORE_UNLOAD_LOADER_TIMEOUT,\n CHECKABLE_INPUTS,\n CONSECUTIVE_RELOADS,\n PHX_AUTO_RECOVER,\n PHX_COMPONENT,\n PHX_CONNECTED_CLASS,\n PHX_DISABLE_WITH,\n PHX_DISABLE_WITH_RESTORE,\n PHX_DISABLED,\n PHX_LOADING_CLASS,\n PHX_EVENT_CLASSES,\n PHX_ERROR_CLASS,\n PHX_CLIENT_ERROR_CLASS,\n PHX_SERVER_ERROR_CLASS,\n PHX_FEEDBACK_FOR,\n PHX_HAS_SUBMITTED,\n PHX_HOOK,\n PHX_PAGE_LOADING,\n PHX_PARENT_ID,\n PHX_PROGRESS,\n PHX_READONLY,\n PHX_REF,\n PHX_REF_SRC,\n PHX_ROOT_ID,\n PHX_SESSION,\n PHX_STATIC,\n PHX_TRACK_STATIC,\n PHX_TRACK_UPLOADS,\n PHX_UPDATE,\n PHX_UPLOAD_REF,\n PHX_VIEW_SELECTOR,\n PHX_MAIN,\n PHX_MOUNTED,\n PUSH_TIMEOUT,\n PHX_VIEWPORT_TOP,\n PHX_VIEWPORT_BOTTOM,\n} from \"./constants\"\n\nimport {\n clone,\n closestPhxBinding,\n isEmpty,\n isEqualObj,\n logError,\n maybe,\n isCid,\n} from \"./utils\"\n\nimport Browser from \"./browser\"\nimport DOM from \"./dom\"\nimport DOMPatch from \"./dom_patch\"\nimport LiveUploader from \"./live_uploader\"\nimport Rendered from \"./rendered\"\nimport ViewHook from \"./view_hook\"\nimport JS from \"./js\"\n\nlet serializeForm = (form, metadata, onlyNames = []) => {\n let {submitter, ...meta} = metadata\n\n // TODO: Replace with `new FormData(form, submitter)` when supported by latest browsers,\n // and mention `formdata-submitter-polyfill` in the docs.\n let formData = new FormData(form)\n\n // TODO: Remove when FormData constructor supports the submitter argument.\n if(submitter && submitter.hasAttribute(\"name\") && submitter.form && submitter.form === form){\n formData.append(submitter.name, submitter.value)\n }\n\n let toRemove = []\n\n formData.forEach((val, key, _index) => {\n if(val instanceof File){ toRemove.push(key) }\n })\n\n // Cleanup after building fileData\n toRemove.forEach(key => formData.delete(key))\n\n let params = new URLSearchParams()\n for(let [key, val] of formData.entries()){\n if(onlyNames.length === 0 || onlyNames.indexOf(key) >= 0){\n params.append(key, val)\n }\n }\n for(let metaKey in meta){ params.append(metaKey, meta[metaKey]) }\n\n return params.toString()\n}\n\nexport default class View {\n constructor(el, liveSocket, parentView, flash, liveReferer){\n this.isDead = false\n this.liveSocket = liveSocket\n this.flash = flash\n this.parent = parentView\n this.root = parentView ? parentView.root : this\n this.el = el\n this.id = this.el.id\n this.ref = 0\n this.childJoins = 0\n this.loaderTimer = null\n this.pendingDiffs = []\n this.pruningCIDs = []\n this.redirect = false\n this.href = null\n this.joinCount = this.parent ? this.parent.joinCount - 1 : 0\n this.joinPending = true\n this.destroyed = false\n this.joinCallback = function(onDone){ onDone && onDone() }\n this.stopCallback = function(){ }\n this.pendingJoinOps = this.parent ? null : []\n this.viewHooks = {}\n this.uploaders = {}\n this.formSubmits = []\n this.children = this.parent ? null : {}\n this.root.children[this.id] = {}\n this.channel = this.liveSocket.channel(`lv:${this.id}`, () => {\n return {\n redirect: this.redirect ? this.href : undefined,\n url: this.redirect ? undefined : this.href || undefined,\n params: this.connectParams(liveReferer),\n session: this.getSession(),\n static: this.getStatic(),\n flash: this.flash,\n }\n })\n }\n\n setHref(href){ this.href = href }\n\n setRedirect(href){\n this.redirect = true\n this.href = href\n }\n\n isMain(){ return this.el.hasAttribute(PHX_MAIN) }\n\n connectParams(liveReferer){\n let params = this.liveSocket.params(this.el)\n let manifest =\n DOM.all(document, `[${this.binding(PHX_TRACK_STATIC)}]`)\n .map(node => node.src || node.href).filter(url => typeof (url) === \"string\")\n\n if(manifest.length > 0){ params[\"_track_static\"] = manifest }\n params[\"_mounts\"] = this.joinCount\n params[\"_live_referer\"] = liveReferer\n\n return params\n }\n\n isConnected(){ return this.channel.canPush() }\n\n getSession(){ return this.el.getAttribute(PHX_SESSION) }\n\n getStatic(){\n let val = this.el.getAttribute(PHX_STATIC)\n return val === \"\" ? null : val\n }\n\n destroy(callback = function (){ }){\n this.destroyAllChildren()\n this.destroyed = true\n delete this.root.children[this.id]\n if(this.parent){ delete this.root.children[this.parent.id][this.id] }\n clearTimeout(this.loaderTimer)\n let onFinished = () => {\n callback()\n for(let id in this.viewHooks){\n this.destroyHook(this.viewHooks[id])\n }\n }\n\n DOM.markPhxChildDestroyed(this.el)\n\n this.log(\"destroyed\", () => [\"the child has been removed from the parent\"])\n this.channel.leave()\n .receive(\"ok\", onFinished)\n .receive(\"error\", onFinished)\n .receive(\"timeout\", onFinished)\n }\n\n setContainerClasses(...classes){\n this.el.classList.remove(\n PHX_CONNECTED_CLASS,\n PHX_LOADING_CLASS,\n PHX_ERROR_CLASS,\n PHX_CLIENT_ERROR_CLASS,\n PHX_SERVER_ERROR_CLASS\n )\n this.el.classList.add(...classes)\n }\n\n showLoader(timeout){\n clearTimeout(this.loaderTimer)\n if(timeout){\n this.loaderTimer = setTimeout(() => this.showLoader(), timeout)\n } else {\n for(let id in this.viewHooks){ this.viewHooks[id].__disconnected() }\n this.setContainerClasses(PHX_LOADING_CLASS)\n }\n }\n\n execAll(binding){\n DOM.all(this.el, `[${binding}]`, el => this.liveSocket.execJS(el, el.getAttribute(binding)))\n }\n\n hideLoader(){\n clearTimeout(this.loaderTimer)\n this.setContainerClasses(PHX_CONNECTED_CLASS)\n this.execAll(this.binding(\"connected\"))\n }\n\n triggerReconnected(){\n for(let id in this.viewHooks){ this.viewHooks[id].__reconnected() }\n }\n\n log(kind, msgCallback){\n this.liveSocket.log(this, kind, msgCallback)\n }\n\n transition(time, onStart, onDone = function(){}){\n this.liveSocket.transition(time, onStart, onDone)\n }\n\n withinTargets(phxTarget, callback){\n if(phxTarget instanceof HTMLElement || phxTarget instanceof SVGElement){\n return this.liveSocket.owner(phxTarget, view => callback(view, phxTarget))\n }\n\n if(isCid(phxTarget)){\n let targets = DOM.findComponentNodeList(this.el, phxTarget)\n if(targets.length === 0){\n logError(`no component found matching phx-target of ${phxTarget}`)\n } else {\n callback(this, parseInt(phxTarget))\n }\n } else {\n let targets = Array.from(document.querySelectorAll(phxTarget))\n if(targets.length === 0){ logError(`nothing found matching the phx-target selector \"${phxTarget}\"`) }\n targets.forEach(target => this.liveSocket.owner(target, view => callback(view, target)))\n }\n }\n\n applyDiff(type, rawDiff, callback){\n this.log(type, () => [\"\", clone(rawDiff)])\n let {diff, reply, events, title} = Rendered.extract(rawDiff)\n callback({diff, reply, events})\n if(title){ window.requestAnimationFrame(() => DOM.putTitle(title)) }\n }\n\n onJoin(resp){\n let {rendered, container} = resp\n if(container){\n let [tag, attrs] = container\n this.el = DOM.replaceRootContainer(this.el, tag, attrs)\n }\n this.childJoins = 0\n this.joinPending = true\n this.flash = null\n\n Browser.dropLocal(this.liveSocket.localStorage, window.location.pathname, CONSECUTIVE_RELOADS)\n this.applyDiff(\"mount\", rendered, ({diff, events}) => {\n this.rendered = new Rendered(this.id, diff)\n let [html, streams] = this.renderContainer(null, \"join\")\n this.dropPendingRefs()\n let forms = this.formsForRecovery(html)\n this.joinCount++\n\n if(forms.length > 0){\n forms.forEach(([form, newForm, newCid], i) => {\n this.pushFormRecovery(form, newCid, resp => {\n if(i === forms.length - 1){\n this.onJoinComplete(resp, html, streams, events)\n }\n })\n })\n } else {\n this.onJoinComplete(resp, html, streams, events)\n }\n })\n }\n\n dropPendingRefs(){\n DOM.all(document, `[${PHX_REF_SRC}=\"${this.id}\"][${PHX_REF}]`, el => {\n el.removeAttribute(PHX_REF)\n el.removeAttribute(PHX_REF_SRC)\n })\n }\n\n onJoinComplete({live_patch}, html, streams, events){\n // In order to provide a better experience, we want to join\n // all LiveViews first and only then apply their patches.\n if(this.joinCount > 1 || (this.parent && !this.parent.isJoinPending())){\n return this.applyJoinPatch(live_patch, html, streams, events)\n }\n\n // One downside of this approach is that we need to find phxChildren\n // in the html fragment, instead of directly on the DOM. The fragment\n // also does not include PHX_STATIC, so we need to copy it over from\n // the DOM.\n let newChildren = DOM.findPhxChildrenInFragment(html, this.id).filter(toEl => {\n let fromEl = toEl.id && this.el.querySelector(`[id=\"${toEl.id}\"]`)\n let phxStatic = fromEl && fromEl.getAttribute(PHX_STATIC)\n if(phxStatic){ toEl.setAttribute(PHX_STATIC, phxStatic) }\n return this.joinChild(toEl)\n })\n\n if(newChildren.length === 0){\n if(this.parent){\n this.root.pendingJoinOps.push([this, () => this.applyJoinPatch(live_patch, html, streams, events)])\n this.parent.ackJoin(this)\n } else {\n this.onAllChildJoinsComplete()\n this.applyJoinPatch(live_patch, html, streams, events)\n }\n } else {\n this.root.pendingJoinOps.push([this, () => this.applyJoinPatch(live_patch, html, streams, events)])\n }\n }\n\n attachTrueDocEl(){\n this.el = DOM.byId(this.id)\n this.el.setAttribute(PHX_ROOT_ID, this.root.id)\n }\n\n execNewMounted(){\n let phxViewportTop = this.binding(PHX_VIEWPORT_TOP)\n let phxViewportBottom = this.binding(PHX_VIEWPORT_BOTTOM)\n DOM.all(this.el, `[${phxViewportTop}], [${phxViewportBottom}]`, hookEl => {\n DOM.maybeAddPrivateHooks(hookEl, phxViewportTop, phxViewportBottom)\n this.maybeAddNewHook(hookEl)\n })\n DOM.all(this.el, `[${this.binding(PHX_HOOK)}], [data-phx-${PHX_HOOK}]`, hookEl => {\n this.maybeAddNewHook(hookEl)\n })\n DOM.all(this.el, `[${this.binding(PHX_MOUNTED)}]`, el => this.maybeMounted(el))\n }\n\n applyJoinPatch(live_patch, html, streams, events){\n this.attachTrueDocEl()\n let patch = new DOMPatch(this, this.el, this.id, html, streams, null)\n patch.markPrunableContentForRemoval()\n this.performPatch(patch, false)\n this.joinNewChildren()\n this.execNewMounted()\n\n this.joinPending = false\n this.liveSocket.dispatchEvents(events)\n this.applyPendingUpdates()\n\n if(live_patch){\n let {kind, to} = live_patch\n this.liveSocket.historyPatch(to, kind)\n }\n this.hideLoader()\n if(this.joinCount > 1){ this.triggerReconnected() }\n this.stopCallback()\n }\n\n triggerBeforeUpdateHook(fromEl, toEl){\n this.liveSocket.triggerDOM(\"onBeforeElUpdated\", [fromEl, toEl])\n let hook = this.getHook(fromEl)\n let isIgnored = hook && DOM.isIgnored(fromEl, this.binding(PHX_UPDATE))\n if(hook && !fromEl.isEqualNode(toEl) && !(isIgnored && isEqualObj(fromEl.dataset, toEl.dataset))){\n hook.__beforeUpdate()\n return hook\n }\n }\n\n maybeMounted(el){\n let phxMounted = el.getAttribute(this.binding(PHX_MOUNTED))\n let hasBeenInvoked = phxMounted && DOM.private(el, \"mounted\")\n if(phxMounted && !hasBeenInvoked){\n this.liveSocket.execJS(el, phxMounted)\n DOM.putPrivate(el, \"mounted\", true)\n }\n }\n\n maybeAddNewHook(el, force){\n let newHook = this.addHook(el)\n if(newHook){ newHook.__mounted() }\n }\n\n performPatch(patch, pruneCids){\n let removedEls = []\n let phxChildrenAdded = false\n let updatedHookIds = new Set()\n\n patch.after(\"added\", el => {\n this.liveSocket.triggerDOM(\"onNodeAdded\", [el])\n this.maybeAddNewHook(el)\n if(el.getAttribute){ this.maybeMounted(el) }\n })\n\n patch.after(\"phxChildAdded\", el => {\n if(DOM.isPhxSticky(el)){\n this.liveSocket.joinRootViews()\n } else {\n phxChildrenAdded = true\n }\n })\n\n patch.before(\"updated\", (fromEl, toEl) => {\n let hook = this.triggerBeforeUpdateHook(fromEl, toEl)\n if(hook){ updatedHookIds.add(fromEl.id) }\n })\n\n patch.after(\"updated\", el => {\n if(updatedHookIds.has(el.id)){ this.getHook(el).__updated() }\n })\n\n patch.after(\"discarded\", (el) => {\n if(el.nodeType === Node.ELEMENT_NODE){ removedEls.push(el) }\n })\n\n patch.after(\"transitionsDiscarded\", els => this.afterElementsRemoved(els, pruneCids))\n patch.perform()\n this.afterElementsRemoved(removedEls, pruneCids)\n\n return phxChildrenAdded\n }\n\n afterElementsRemoved(elements, pruneCids){\n let destroyedCIDs = []\n elements.forEach(parent => {\n let components = DOM.all(parent, `[${PHX_COMPONENT}]`)\n let hooks = DOM.all(parent, `[${this.binding(PHX_HOOK)}]`)\n components.concat(parent).forEach(el => {\n let cid = this.componentID(el)\n if(isCid(cid) && destroyedCIDs.indexOf(cid) === -1){ destroyedCIDs.push(cid) }\n })\n hooks.concat(parent).forEach(hookEl => {\n let hook = this.getHook(hookEl)\n hook && this.destroyHook(hook)\n })\n })\n // We should not pruneCids on joins. Otherwise, in case of\n // rejoins, we may notify cids that no longer belong to the\n // current LiveView to be removed.\n if(pruneCids){\n this.maybePushComponentsDestroyed(destroyedCIDs)\n }\n }\n\n joinNewChildren(){\n DOM.findPhxChildren(this.el, this.id).forEach(el => this.joinChild(el))\n }\n\n getChildById(id){ return this.root.children[this.id][id] }\n\n getDescendentByEl(el){\n if(el.id === this.id){\n return this\n } else {\n return this.children[el.getAttribute(PHX_PARENT_ID)][el.id]\n }\n }\n\n destroyDescendent(id){\n for(let parentId in this.root.children){\n for(let childId in this.root.children[parentId]){\n if(childId === id){ return this.root.children[parentId][childId].destroy() }\n }\n }\n }\n\n joinChild(el){\n let child = this.getChildById(el.id)\n if(!child){\n let view = new View(el, this.liveSocket, this)\n this.root.children[this.id][view.id] = view\n view.join()\n this.childJoins++\n return true\n }\n }\n\n isJoinPending(){ return this.joinPending }\n\n ackJoin(_child){\n this.childJoins--\n\n if(this.childJoins === 0){\n if(this.parent){\n this.parent.ackJoin(this)\n } else {\n this.onAllChildJoinsComplete()\n }\n }\n }\n\n onAllChildJoinsComplete(){\n this.joinCallback(() => {\n this.pendingJoinOps.forEach(([view, op]) => {\n if(!view.isDestroyed()){ op() }\n })\n this.pendingJoinOps = []\n })\n }\n\n update(diff, events){\n if(this.isJoinPending() || (this.liveSocket.hasPendingLink() && this.root.isMain())){\n return this.pendingDiffs.push({diff, events})\n }\n\n this.rendered.mergeDiff(diff)\n let phxChildrenAdded = false\n\n // When the diff only contains component diffs, then walk components\n // and patch only the parent component containers found in the diff.\n // Otherwise, patch entire LV container.\n if(this.rendered.isComponentOnlyDiff(diff)){\n this.liveSocket.time(\"component patch complete\", () => {\n let parentCids = DOM.findParentCIDs(this.el, this.rendered.componentCIDs(diff))\n parentCids.forEach(parentCID => {\n if(this.componentPatch(this.rendered.getComponent(diff, parentCID), parentCID)){ phxChildrenAdded = true }\n })\n })\n } else if(!isEmpty(diff)){\n this.liveSocket.time(\"full patch complete\", () => {\n let [html, streams] = this.renderContainer(diff, \"update\")\n let patch = new DOMPatch(this, this.el, this.id, html, streams, null)\n phxChildrenAdded = this.performPatch(patch, true)\n })\n }\n\n this.liveSocket.dispatchEvents(events)\n if(phxChildrenAdded){ this.joinNewChildren() }\n }\n\n renderContainer(diff, kind){\n return this.liveSocket.time(`toString diff (${kind})`, () => {\n let tag = this.el.tagName\n // Don't skip any component in the diff nor any marked as pruned\n // (as they may have been added back)\n let cids = diff ? this.rendered.componentCIDs(diff).concat(this.pruningCIDs) : null\n let [html, streams] = this.rendered.toString(cids)\n return [`<${tag}>${html}${tag}>`, streams]\n })\n }\n\n componentPatch(diff, cid){\n if(isEmpty(diff)) return false\n let [html, streams] = this.rendered.componentToString(cid)\n let patch = new DOMPatch(this, this.el, this.id, html, streams, cid)\n let childrenAdded = this.performPatch(patch, true)\n return childrenAdded\n }\n\n getHook(el){ return this.viewHooks[ViewHook.elementID(el)] }\n\n addHook(el){\n if(ViewHook.elementID(el) || !el.getAttribute){ return }\n let hookName = el.getAttribute(`data-phx-${PHX_HOOK}`) || el.getAttribute(this.binding(PHX_HOOK))\n if(hookName && !this.ownsElement(el)){ return }\n let callbacks = this.liveSocket.getHookCallbacks(hookName)\n\n if(callbacks){\n if(!el.id){ logError(`no DOM ID for hook \"${hookName}\". Hooks require a unique ID on each element.`, el) }\n let hook = new ViewHook(this, el, callbacks)\n this.viewHooks[ViewHook.elementID(hook.el)] = hook\n return hook\n } else if(hookName !== null){\n logError(`unknown hook found for \"${hookName}\"`, el)\n }\n }\n\n destroyHook(hook){\n hook.__destroyed()\n hook.__cleanup__()\n delete this.viewHooks[ViewHook.elementID(hook.el)]\n }\n\n applyPendingUpdates(){\n this.pendingDiffs.forEach(({diff, events}) => this.update(diff, events))\n this.pendingDiffs = []\n this.eachChild(child => child.applyPendingUpdates())\n }\n\n eachChild(callback){\n let children = this.root.children[this.id] || {}\n for(let id in children){ callback(this.getChildById(id)) }\n }\n\n onChannel(event, cb){\n this.liveSocket.onChannel(this.channel, event, resp => {\n if(this.isJoinPending()){\n this.root.pendingJoinOps.push([this, () => cb(resp)])\n } else {\n this.liveSocket.requestDOMUpdate(() => cb(resp))\n }\n })\n }\n\n bindChannel(){\n // The diff event should be handled by the regular update operations.\n // All other operations are queued to be applied only after join.\n this.liveSocket.onChannel(this.channel, \"diff\", (rawDiff) => {\n this.liveSocket.requestDOMUpdate(() => {\n this.applyDiff(\"update\", rawDiff, ({diff, events}) => this.update(diff, events))\n })\n })\n this.onChannel(\"redirect\", ({to, flash}) => this.onRedirect({to, flash}))\n this.onChannel(\"live_patch\", (redir) => this.onLivePatch(redir))\n this.onChannel(\"live_redirect\", (redir) => this.onLiveRedirect(redir))\n this.channel.onError(reason => this.onError(reason))\n this.channel.onClose(reason => this.onClose(reason))\n }\n\n destroyAllChildren(){ this.eachChild(child => child.destroy()) }\n\n onLiveRedirect(redir){\n let {to, kind, flash} = redir\n let url = this.expandURL(to)\n this.liveSocket.historyRedirect(url, kind, flash)\n }\n\n onLivePatch(redir){\n let {to, kind} = redir\n this.href = this.expandURL(to)\n this.liveSocket.historyPatch(to, kind)\n }\n\n expandURL(to){\n return to.startsWith(\"/\") ? `${window.location.protocol}//${window.location.host}${to}` : to\n }\n\n onRedirect({to, flash}){ this.liveSocket.redirect(to, flash) }\n\n isDestroyed(){ return this.destroyed }\n\n joinDead(){ this.isDead = true }\n\n join(callback){\n this.showLoader(this.liveSocket.loaderTimeout)\n this.bindChannel()\n if(this.isMain()){\n this.stopCallback = this.liveSocket.withPageLoading({to: this.href, kind: \"initial\"})\n }\n this.joinCallback = (onDone) => {\n onDone = onDone || function(){}\n callback ? callback(this.joinCount, onDone) : onDone()\n }\n this.liveSocket.wrapPush(this, {timeout: false}, () => {\n return this.channel.join()\n .receive(\"ok\", data => {\n if(!this.isDestroyed()){\n this.liveSocket.requestDOMUpdate(() => this.onJoin(data))\n }\n })\n .receive(\"error\", resp => !this.isDestroyed() && this.onJoinError(resp))\n .receive(\"timeout\", () => !this.isDestroyed() && this.onJoinError({reason: \"timeout\"}))\n })\n }\n\n onJoinError(resp){\n if(resp.reason === \"reload\"){\n this.log(\"error\", () => [`failed mount with ${resp.status}. Falling back to page request`, resp])\n return this.onRedirect({to: this.href})\n } else if(resp.reason === \"unauthorized\" || resp.reason === \"stale\"){\n this.log(\"error\", () => [\"unauthorized live_redirect. Falling back to page request\", resp])\n return this.onRedirect({to: this.href})\n }\n if(resp.redirect || resp.live_redirect){\n this.joinPending = false\n this.channel.leave()\n }\n if(resp.redirect){ return this.onRedirect(resp.redirect) }\n if(resp.live_redirect){ return this.onLiveRedirect(resp.live_redirect) }\n this.displayError([PHX_LOADING_CLASS, PHX_ERROR_CLASS, PHX_SERVER_ERROR_CLASS])\n this.log(\"error\", () => [\"unable to join\", resp])\n if(this.liveSocket.isConnected()){ this.liveSocket.reloadWithJitter(this) }\n }\n\n onClose(reason){\n if(this.isDestroyed()){ return }\n if(this.liveSocket.hasPendingLink() && reason !== \"leave\"){\n return this.liveSocket.reloadWithJitter(this)\n }\n this.destroyAllChildren()\n this.liveSocket.dropActiveElement(this)\n // document.activeElement can be null in Internet Explorer 11\n if(document.activeElement){ document.activeElement.blur() }\n if(this.liveSocket.isUnloaded()){\n this.showLoader(BEFORE_UNLOAD_LOADER_TIMEOUT)\n }\n }\n\n onError(reason){\n this.onClose(reason)\n if(this.liveSocket.isConnected()){ this.log(\"error\", () => [\"view crashed\", reason]) }\n if(!this.liveSocket.isUnloaded()){\n if(this.liveSocket.isConnected()){\n this.displayError([PHX_LOADING_CLASS, PHX_ERROR_CLASS, PHX_SERVER_ERROR_CLASS])\n } else {\n this.displayError([PHX_LOADING_CLASS, PHX_ERROR_CLASS, PHX_CLIENT_ERROR_CLASS])\n }\n }\n }\n\n displayError(classes){\n if(this.isMain()){ DOM.dispatchEvent(window, \"phx:page-loading-start\", {detail: {to: this.href, kind: \"error\"}}) }\n this.showLoader()\n this.setContainerClasses(...classes)\n this.execAll(this.binding(\"disconnected\"))\n }\n\n pushWithReply(refGenerator, event, payload, onReply = function (){ }){\n if(!this.isConnected()){ return }\n\n let [ref, [el], opts] = refGenerator ? refGenerator() : [null, [], {}]\n let onLoadingDone = function(){ }\n if(opts.page_loading || (el && (el.getAttribute(this.binding(PHX_PAGE_LOADING)) !== null))){\n onLoadingDone = this.liveSocket.withPageLoading({kind: \"element\", target: el})\n }\n\n if(typeof (payload.cid) !== \"number\"){ delete payload.cid }\n return (\n this.liveSocket.wrapPush(this, {timeout: true}, () => {\n return this.channel.push(event, payload, PUSH_TIMEOUT).receive(\"ok\", resp => {\n let finish = (hookReply) => {\n if(resp.redirect){ this.onRedirect(resp.redirect) }\n if(resp.live_patch){ this.onLivePatch(resp.live_patch) }\n if(resp.live_redirect){ this.onLiveRedirect(resp.live_redirect) }\n onLoadingDone()\n onReply(resp, hookReply)\n }\n if(resp.diff){\n this.liveSocket.requestDOMUpdate(() => {\n this.applyDiff(\"update\", resp.diff, ({diff, reply, events}) => {\n if(ref !== null){ this.undoRefs(ref) }\n this.update(diff, events)\n finish(reply)\n })\n })\n } else {\n if(ref !== null){ this.undoRefs(ref) }\n finish(null)\n }\n })\n })\n )\n }\n\n undoRefs(ref){\n if(!this.isConnected()){ return } // exit if external form triggered\n\n DOM.all(document, `[${PHX_REF_SRC}=\"${this.id}\"][${PHX_REF}=\"${ref}\"]`, el => {\n let disabledVal = el.getAttribute(PHX_DISABLED)\n // remove refs\n el.removeAttribute(PHX_REF)\n el.removeAttribute(PHX_REF_SRC)\n // restore inputs\n if(el.getAttribute(PHX_READONLY) !== null){\n el.readOnly = false\n el.removeAttribute(PHX_READONLY)\n }\n if(disabledVal !== null){\n el.disabled = disabledVal === \"true\" ? true : false\n el.removeAttribute(PHX_DISABLED)\n }\n // remove classes\n PHX_EVENT_CLASSES.forEach(className => DOM.removeClass(el, className))\n // restore disables\n let disableRestore = el.getAttribute(PHX_DISABLE_WITH_RESTORE)\n if(disableRestore !== null){\n el.innerText = disableRestore\n el.removeAttribute(PHX_DISABLE_WITH_RESTORE)\n }\n let toEl = DOM.private(el, PHX_REF)\n if(toEl){\n let hook = this.triggerBeforeUpdateHook(el, toEl)\n DOMPatch.patchEl(el, toEl, this.liveSocket.getActiveElement())\n if(hook){ hook.__updated() }\n DOM.deletePrivate(el, PHX_REF)\n }\n })\n }\n\n putRef(elements, event, opts = {}){\n let newRef = this.ref++\n let disableWith = this.binding(PHX_DISABLE_WITH)\n if(opts.loading){ elements = elements.concat(DOM.all(document, opts.loading))}\n\n elements.forEach(el => {\n el.classList.add(`phx-${event}-loading`)\n el.setAttribute(PHX_REF, newRef)\n el.setAttribute(PHX_REF_SRC, this.el.id)\n let disableText = el.getAttribute(disableWith)\n if(disableText !== null){\n if(!el.getAttribute(PHX_DISABLE_WITH_RESTORE)){\n el.setAttribute(PHX_DISABLE_WITH_RESTORE, el.innerText)\n }\n if(disableText !== \"\"){ el.innerText = disableText }\n el.setAttribute(\"disabled\", \"\")\n }\n })\n return [newRef, elements, opts]\n }\n\n componentID(el){\n let cid = el.getAttribute && el.getAttribute(PHX_COMPONENT)\n return cid ? parseInt(cid) : null\n }\n\n targetComponentID(target, targetCtx, opts = {}){\n if(isCid(targetCtx)){ return targetCtx }\n\n let cidOrSelector = target.getAttribute(this.binding(\"target\"))\n if(isCid(cidOrSelector)){\n return parseInt(cidOrSelector)\n } else if(targetCtx && (cidOrSelector !== null || opts.target)){\n return this.closestComponentID(targetCtx)\n } else {\n return null\n }\n }\n\n closestComponentID(targetCtx){\n if(isCid(targetCtx)){\n return targetCtx\n } else if(targetCtx){\n return maybe(targetCtx.closest(`[${PHX_COMPONENT}]`), el => this.ownsElement(el) && this.componentID(el))\n } else {\n return null\n }\n }\n\n pushHookEvent(el, targetCtx, event, payload, onReply){\n if(!this.isConnected()){\n this.log(\"hook\", () => [\"unable to push hook event. LiveView not connected\", event, payload])\n return false\n }\n let [ref, els, opts] = this.putRef([el], \"hook\")\n this.pushWithReply(() => [ref, els, opts], \"event\", {\n type: \"hook\",\n event: event,\n value: payload,\n cid: this.closestComponentID(targetCtx)\n }, (resp, reply) => onReply(reply, ref))\n\n return ref\n }\n\n extractMeta(el, meta, value){\n let prefix = this.binding(\"value-\")\n for(let i = 0; i < el.attributes.length; i++){\n if(!meta){ meta = {} }\n let name = el.attributes[i].name\n if(name.startsWith(prefix)){ meta[name.replace(prefix, \"\")] = el.getAttribute(name) }\n }\n if(el.value !== undefined && !(el instanceof HTMLFormElement)){\n if(!meta){ meta = {} }\n meta.value = el.value\n\n if(el.tagName === \"INPUT\" && CHECKABLE_INPUTS.indexOf(el.type) >= 0 && !el.checked){\n delete meta.value\n }\n }\n if(value){\n if(!meta){ meta = {} }\n for(let key in value){ meta[key] = value[key] }\n }\n return meta\n }\n\n\n pushEvent(type, el, targetCtx, phxEvent, meta, opts = {}, onReply){\n this.pushWithReply(() => this.putRef([el], type, opts), \"event\", {\n type: type,\n event: phxEvent,\n value: this.extractMeta(el, meta, opts.value),\n cid: this.targetComponentID(el, targetCtx, opts)\n }, (resp, reply) => onReply && onReply(reply))\n }\n\n pushFileProgress(fileEl, entryRef, progress, onReply = function (){ }){\n this.liveSocket.withinOwners(fileEl.form, (view, targetCtx) => {\n view.pushWithReply(null, \"progress\", {\n event: fileEl.getAttribute(view.binding(PHX_PROGRESS)),\n ref: fileEl.getAttribute(PHX_UPLOAD_REF),\n entry_ref: entryRef,\n progress: progress,\n cid: view.targetComponentID(fileEl.form, targetCtx)\n }, onReply)\n })\n }\n\n pushInput(inputEl, targetCtx, forceCid, phxEvent, opts, callback){\n let uploads\n let cid = isCid(forceCid) ? forceCid : this.targetComponentID(inputEl.form, targetCtx)\n let refGenerator = () => this.putRef([inputEl, inputEl.form], \"change\", opts)\n let formData\n let meta = this.extractMeta(inputEl.form)\n if(inputEl.getAttribute(this.binding(\"change\"))){\n formData = serializeForm(inputEl.form, {_target: opts._target, ...meta}, [inputEl.name])\n } else {\n formData = serializeForm(inputEl.form, {_target: opts._target, ...meta})\n }\n if(DOM.isUploadInput(inputEl) && inputEl.files && inputEl.files.length > 0){\n LiveUploader.trackFiles(inputEl, Array.from(inputEl.files))\n }\n uploads = LiveUploader.serializeUploads(inputEl)\n\n let event = {\n type: \"form\",\n event: phxEvent,\n value: formData,\n uploads: uploads,\n cid: cid\n }\n this.pushWithReply(refGenerator, \"event\", event, resp => {\n DOM.showError(inputEl, this.liveSocket.binding(PHX_FEEDBACK_FOR))\n if(DOM.isUploadInput(inputEl) && DOM.isAutoUpload(inputEl)){\n if(LiveUploader.filesAwaitingPreflight(inputEl).length > 0){\n let [ref, _els] = refGenerator()\n this.uploadFiles(inputEl.form, targetCtx, ref, cid, (_uploads) => {\n callback && callback(resp)\n this.triggerAwaitingSubmit(inputEl.form)\n })\n }\n } else {\n callback && callback(resp)\n }\n })\n }\n\n triggerAwaitingSubmit(formEl){\n let awaitingSubmit = this.getScheduledSubmit(formEl)\n if(awaitingSubmit){\n let [_el, _ref, _opts, callback] = awaitingSubmit\n this.cancelSubmit(formEl)\n callback()\n }\n }\n\n getScheduledSubmit(formEl){\n return this.formSubmits.find(([el, _ref, _opts, _callback]) => el.isSameNode(formEl))\n }\n\n scheduleSubmit(formEl, ref, opts, callback){\n if(this.getScheduledSubmit(formEl)){ return true }\n this.formSubmits.push([formEl, ref, opts, callback])\n }\n\n cancelSubmit(formEl){\n this.formSubmits = this.formSubmits.filter(([el, ref, _callback]) => {\n if(el.isSameNode(formEl)){\n this.undoRefs(ref)\n return false\n } else {\n return true\n }\n })\n }\n\n disableForm(formEl, opts = {}){\n let filterIgnored = el => {\n let userIgnored = closestPhxBinding(el, `${this.binding(PHX_UPDATE)}=ignore`, el.form)\n return !(userIgnored || closestPhxBinding(el, \"data-phx-update=ignore\", el.form))\n }\n let filterDisables = el => {\n return el.hasAttribute(this.binding(PHX_DISABLE_WITH))\n }\n let filterButton = el => el.tagName == \"BUTTON\"\n\n let filterInput = el => [\"INPUT\", \"TEXTAREA\", \"SELECT\"].includes(el.tagName)\n\n let formElements = Array.from(formEl.elements)\n let disables = formElements.filter(filterDisables)\n let buttons = formElements.filter(filterButton).filter(filterIgnored)\n let inputs = formElements.filter(filterInput).filter(filterIgnored)\n\n buttons.forEach(button => {\n button.setAttribute(PHX_DISABLED, button.disabled)\n button.disabled = true\n })\n inputs.forEach(input => {\n input.setAttribute(PHX_READONLY, input.readOnly)\n input.readOnly = true\n if(input.files){\n input.setAttribute(PHX_DISABLED, input.disabled)\n input.disabled = true\n }\n })\n formEl.setAttribute(this.binding(PHX_PAGE_LOADING), \"\")\n return this.putRef([formEl].concat(disables).concat(buttons).concat(inputs), \"submit\", opts)\n }\n\n pushFormSubmit(formEl, targetCtx, phxEvent, submitter, opts, onReply){\n let refGenerator = () => this.disableForm(formEl, opts)\n let cid = this.targetComponentID(formEl, targetCtx)\n if(LiveUploader.hasUploadsInProgress(formEl)){\n let [ref, _els] = refGenerator()\n let push = () => this.pushFormSubmit(formEl, submitter, targetCtx, phxEvent, opts, onReply)\n return this.scheduleSubmit(formEl, ref, opts, push)\n } else if(LiveUploader.inputsAwaitingPreflight(formEl).length > 0){\n let [ref, els] = refGenerator()\n let proxyRefGen = () => [ref, els, opts]\n this.uploadFiles(formEl, targetCtx, ref, cid, (_uploads) => {\n let meta = this.extractMeta(formEl)\n let formData = serializeForm(formEl, {submitter, ...meta})\n this.pushWithReply(proxyRefGen, \"event\", {\n type: \"form\",\n event: phxEvent,\n value: formData,\n cid: cid\n }, onReply)\n })\n } else if(!(formEl.hasAttribute(PHX_REF) && formEl.classList.contains(\"phx-submit-loading\"))){\n let meta = this.extractMeta(formEl)\n let formData = serializeForm(formEl, {submitter, ...meta})\n this.pushWithReply(refGenerator, \"event\", {\n type: \"form\",\n event: phxEvent,\n value: formData,\n cid: cid\n }, onReply)\n }\n }\n\n uploadFiles(formEl, targetCtx, ref, cid, onComplete){\n let joinCountAtUpload = this.joinCount\n let inputEls = LiveUploader.activeFileInputs(formEl)\n let numFileInputsInProgress = inputEls.length\n\n // get each file input\n inputEls.forEach(inputEl => {\n let uploader = new LiveUploader(inputEl, this, () => {\n numFileInputsInProgress--\n if(numFileInputsInProgress === 0){ onComplete() }\n });\n\n this.uploaders[inputEl] = uploader\n let entries = uploader.entries().map(entry => entry.toPreflightPayload())\n\n let payload = {\n ref: inputEl.getAttribute(PHX_UPLOAD_REF),\n entries: entries,\n cid: this.targetComponentID(inputEl.form, targetCtx)\n }\n\n this.log(\"upload\", () => [\"sending preflight request\", payload])\n\n this.pushWithReply(null, \"allow_upload\", payload, resp => {\n this.log(\"upload\", () => [\"got preflight response\", resp])\n if(resp.error){\n this.undoRefs(ref)\n let [entry_ref, reason] = resp.error\n this.log(\"upload\", () => [`error for entry ${entry_ref}`, reason])\n } else {\n let onError = (callback) => {\n this.channel.onError(() => {\n if(this.joinCount === joinCountAtUpload){ callback() }\n })\n }\n uploader.initAdapterUpload(resp, onError, this.liveSocket)\n }\n })\n })\n }\n\n dispatchUploads(name, filesOrBlobs){\n let inputs = DOM.findUploadInputs(this.el).filter(el => el.name === name)\n if(inputs.length === 0){ logError(`no live file inputs found matching the name \"${name}\"`) }\n else if(inputs.length > 1){ logError(`duplicate live file inputs found matching the name \"${name}\"`) }\n else { DOM.dispatchEvent(inputs[0], PHX_TRACK_UPLOADS, {detail: {files: filesOrBlobs}}) }\n }\n\n pushFormRecovery(form, newCid, callback){\n this.liveSocket.withinOwners(form, (view, targetCtx) => {\n let phxChange = this.binding(\"change\")\n let inputs = Array.from(form.elements).filter(el => DOM.isFormInput(el) && el.name && !el.hasAttribute(phxChange))\n if(inputs.length === 0){ return }\n\n let input = inputs.find(el => el.type !== \"hidden\") || inputs[0]\n let phxEvent = form.getAttribute(this.binding(PHX_AUTO_RECOVER)) || form.getAttribute(this.binding(\"change\"))\n JS.exec(\"change\", phxEvent, view, input, [\"push\", {_target: input.name, newCid: newCid, callback: callback}])\n })\n }\n\n pushLinkPatch(href, targetEl, callback){\n let linkRef = this.liveSocket.setPendingLink(href)\n let refGen = targetEl ? () => this.putRef([targetEl], \"click\") : null\n let fallback = () => this.liveSocket.redirect(window.location.href)\n let url = href.startsWith(\"/\") ? `${location.protocol}//${location.host}${href}` : href\n\n let push = this.pushWithReply(refGen, \"live_patch\", {url}, resp => {\n this.liveSocket.requestDOMUpdate(() => {\n if(resp.link_redirect){\n this.liveSocket.replaceMain(href, null, callback, linkRef)\n } else {\n if(this.liveSocket.commitPendingLink(linkRef)){\n this.href = href\n }\n this.applyPendingUpdates()\n callback && callback(linkRef)\n }\n })\n })\n\n if(push){\n push.receive(\"timeout\", fallback)\n } else {\n fallback()\n }\n }\n\n formsForRecovery(html){\n if(this.joinCount === 0){ return [] }\n\n let phxChange = this.binding(\"change\")\n let template = document.createElement(\"template\")\n template.innerHTML = html\n\n return (\n DOM.all(this.el, `form[${phxChange}]`)\n .filter(form => form.id && this.ownsElement(form))\n .filter(form => form.elements.length > 0)\n .filter(form => form.getAttribute(this.binding(PHX_AUTO_RECOVER)) !== \"ignore\")\n .map(form => {\n // attribute given via JS module needs to be escaped as it contains the symbols []\",\n // which result in an invalid css selector otherwise.\n const phxChangeValue = form.getAttribute(phxChange).replaceAll(/([\\[\\]\"])/g, '\\\\$1')\n let newForm = template.content.querySelector(`form[id=\"${form.id}\"][${phxChange}=\"${phxChangeValue}\"]`)\n if(newForm){\n return [form, newForm, this.targetComponentID(newForm)]\n } else {\n return [form, form, this.targetComponentID(form)]\n }\n })\n .filter(([form, newForm, newCid]) => newForm)\n )\n }\n\n maybePushComponentsDestroyed(destroyedCIDs){\n let willDestroyCIDs = destroyedCIDs.filter(cid => {\n return DOM.findComponentNodeList(this.el, cid).length === 0\n })\n if(willDestroyCIDs.length > 0){\n this.pruningCIDs.push(...willDestroyCIDs)\n\n this.pushWithReply(null, \"cids_will_destroy\", {cids: willDestroyCIDs}, () => {\n // The cids are either back on the page or they will be fully removed,\n // so we can remove them from the pruningCIDs.\n this.pruningCIDs = this.pruningCIDs.filter(cid => willDestroyCIDs.indexOf(cid) !== -1)\n\n // See if any of the cids we wanted to destroy were added back,\n // if they were added back, we don't actually destroy them.\n let completelyDestroyCIDs = willDestroyCIDs.filter(cid => {\n return DOM.findComponentNodeList(this.el, cid).length === 0\n })\n\n if(completelyDestroyCIDs.length > 0){\n this.pushWithReply(null, \"cids_destroyed\", {cids: completelyDestroyCIDs}, (resp) => {\n this.rendered.pruneCIDs(resp.cids)\n })\n }\n })\n }\n }\n\n ownsElement(el){\n let parentViewEl = el.closest(PHX_VIEW_SELECTOR)\n return el.getAttribute(PHX_PARENT_ID) === this.id ||\n (parentViewEl && parentViewEl.id === this.id) ||\n (!parentViewEl && this.isDead)\n }\n\n submitForm(form, targetCtx, phxEvent, submitter, opts = {}){\n DOM.putPrivate(form, PHX_HAS_SUBMITTED, true)\n let phxFeedback = this.liveSocket.binding(PHX_FEEDBACK_FOR)\n let inputs = Array.from(form.elements)\n inputs.forEach(input => DOM.putPrivate(input, PHX_HAS_SUBMITTED, true))\n this.liveSocket.blurActiveElement(this)\n this.pushFormSubmit(form, targetCtx, phxEvent, submitter, opts, () => {\n inputs.forEach(input => DOM.showError(input, phxFeedback))\n this.liveSocket.restorePreviouslyActiveFocus()\n })\n }\n\n binding(kind){ return this.liveSocket.binding(kind) }\n}\n", "/** Initializes the LiveSocket\n *\n *\n * @param {string} endPoint - The string WebSocket endpoint, ie, `\"wss://example.com/live\"`,\n * `\"/live\"` (inherited host & protocol)\n * @param {Phoenix.Socket} socket - the required Phoenix Socket class imported from \"phoenix\". For example:\n *\n * import {Socket} from \"phoenix\"\n * import {LiveSocket} from \"phoenix_live_view\"\n * let liveSocket = new LiveSocket(\"/live\", Socket, {...})\n *\n * @param {Object} [opts] - Optional configuration. Outside of keys listed below, all\n * configuration is passed directly to the Phoenix Socket constructor.\n * @param {Object} [opts.defaults] - The optional defaults to use for various bindings,\n * such as `phx-debounce`. Supports the following keys:\n *\n * - debounce - the millisecond phx-debounce time. Defaults 300\n * - throttle - the millisecond phx-throttle time. Defaults 300\n *\n * @param {Function} [opts.params] - The optional function for passing connect params.\n * The function receives the element associated with a given LiveView. For example:\n *\n * (el) => {view: el.getAttribute(\"data-my-view-name\", token: window.myToken}\n *\n * @param {string} [opts.bindingPrefix] - The optional prefix to use for all phx DOM annotations.\n * Defaults to \"phx-\".\n * @param {Object} [opts.hooks] - The optional object for referencing LiveView hook callbacks.\n * @param {Object} [opts.uploaders] - The optional object for referencing LiveView uploader callbacks.\n * @param {integer} [opts.loaderTimeout] - The optional delay in milliseconds to wait before apply\n * loading states.\n * @param {integer} [opts.maxReloads] - The maximum reloads before entering failsafe mode.\n * @param {integer} [opts.reloadJitterMin] - The minimum time between normal reload attempts.\n * @param {integer} [opts.reloadJitterMax] - The maximum time between normal reload attempts.\n * @param {integer} [opts.failsafeJitter] - The time between reload attempts in failsafe mode.\n * @param {Function} [opts.viewLogger] - The optional function to log debug information. For example:\n *\n * (view, kind, msg, obj) => console.log(`${view.id} ${kind}: ${msg} - `, obj)\n *\n * @param {Object} [opts.metadata] - The optional object mapping event names to functions for\n * populating event metadata. For example:\n *\n * metadata: {\n * click: (e, el) => {\n * return {\n * ctrlKey: e.ctrlKey,\n * metaKey: e.metaKey,\n * detail: e.detail || 1,\n * }\n * },\n * keydown: (e, el) => {\n * return {\n * key: e.key,\n * ctrlKey: e.ctrlKey,\n * metaKey: e.metaKey,\n * shiftKey: e.shiftKey\n * }\n * }\n * }\n * @param {Object} [opts.sessionStorage] - An optional Storage compatible object\n * Useful when LiveView won't have access to `sessionStorage`. For example, This could\n * happen if a site loads a cross-domain LiveView in an iframe. Example usage:\n *\n * class InMemoryStorage {\n * constructor() { this.storage = {} }\n * getItem(keyName) { return this.storage[keyName] || null }\n * removeItem(keyName) { delete this.storage[keyName] }\n * setItem(keyName, keyValue) { this.storage[keyName] = keyValue }\n * }\n *\n * @param {Object} [opts.localStorage] - An optional Storage compatible object\n * Useful for when LiveView won't have access to `localStorage`.\n * See `opts.sessionStorage` for examples.\n*/\n\nimport {\n BINDING_PREFIX,\n CONSECUTIVE_RELOADS,\n DEFAULTS,\n FAILSAFE_JITTER,\n LOADER_TIMEOUT,\n MAX_RELOADS,\n PHX_DEBOUNCE,\n PHX_DROP_TARGET,\n PHX_HAS_FOCUSED,\n PHX_KEY,\n PHX_LINK_STATE,\n PHX_LIVE_LINK,\n PHX_LV_DEBUG,\n PHX_LV_LATENCY_SIM,\n PHX_LV_PROFILE,\n PHX_MAIN,\n PHX_PARENT_ID,\n PHX_VIEW_SELECTOR,\n PHX_ROOT_ID,\n PHX_THROTTLE,\n PHX_TRACK_UPLOADS,\n PHX_SESSION,\n PHX_FEEDBACK_FOR,\n RELOAD_JITTER_MIN,\n RELOAD_JITTER_MAX,\n PHX_REF,\n} from \"./constants\"\n\nimport {\n clone,\n closestPhxBinding,\n closure,\n debug,\n isObject,\n maybe\n} from \"./utils\"\n\nimport Browser from \"./browser\"\nimport DOM from \"./dom\"\nimport Hooks from \"./hooks\"\nimport LiveUploader from \"./live_uploader\"\nimport View from \"./view\"\nimport JS from \"./js\"\n\nexport default class LiveSocket {\n constructor(url, phxSocket, opts = {}){\n this.unloaded = false\n if(!phxSocket || phxSocket.constructor.name === \"Object\"){\n throw new Error(`\n a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example:\n\n import {Socket} from \"phoenix\"\n import {LiveSocket} from \"phoenix_live_view\"\n let liveSocket = new LiveSocket(\"/live\", Socket, {...})\n `)\n }\n this.socket = new phxSocket(url, opts)\n this.bindingPrefix = opts.bindingPrefix || BINDING_PREFIX\n this.opts = opts\n this.params = closure(opts.params || {})\n this.viewLogger = opts.viewLogger\n this.metadataCallbacks = opts.metadata || {}\n this.defaults = Object.assign(clone(DEFAULTS), opts.defaults || {})\n this.activeElement = null\n this.prevActive = null\n this.silenced = false\n this.main = null\n this.outgoingMainEl = null\n this.clickStartedAtTarget = null\n this.linkRef = 1\n this.roots = {}\n this.href = window.location.href\n this.pendingLink = null\n this.currentLocation = clone(window.location)\n this.hooks = opts.hooks || {}\n this.uploaders = opts.uploaders || {}\n this.loaderTimeout = opts.loaderTimeout || LOADER_TIMEOUT\n this.reloadWithJitterTimer = null\n this.maxReloads = opts.maxReloads || MAX_RELOADS\n this.reloadJitterMin = opts.reloadJitterMin || RELOAD_JITTER_MIN\n this.reloadJitterMax = opts.reloadJitterMax || RELOAD_JITTER_MAX\n this.failsafeJitter = opts.failsafeJitter || FAILSAFE_JITTER\n this.localStorage = opts.localStorage || window.localStorage\n this.sessionStorage = opts.sessionStorage || window.sessionStorage\n this.boundTopLevelEvents = false\n this.domCallbacks = Object.assign({onNodeAdded: closure(), onBeforeElUpdated: closure()}, opts.dom || {})\n this.transitions = new TransitionSet()\n window.addEventListener(\"pagehide\", _e => {\n this.unloaded = true\n })\n this.socket.onOpen(() => {\n if(this.isUnloaded()){\n // reload page if being restored from back/forward cache and browser does not emit \"pageshow\"\n window.location.reload()\n }\n })\n }\n\n // public\n\n isProfileEnabled(){ return this.sessionStorage.getItem(PHX_LV_PROFILE) === \"true\" }\n\n isDebugEnabled(){ return this.sessionStorage.getItem(PHX_LV_DEBUG) === \"true\" }\n\n isDebugDisabled(){ return this.sessionStorage.getItem(PHX_LV_DEBUG) === \"false\" }\n\n enableDebug(){ this.sessionStorage.setItem(PHX_LV_DEBUG, \"true\") }\n\n enableProfiling(){ this.sessionStorage.setItem(PHX_LV_PROFILE, \"true\") }\n\n disableDebug(){ this.sessionStorage.setItem(PHX_LV_DEBUG, \"false\") }\n\n disableProfiling(){ this.sessionStorage.removeItem(PHX_LV_PROFILE) }\n\n enableLatencySim(upperBoundMs){\n this.enableDebug()\n console.log(\"latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable\")\n this.sessionStorage.setItem(PHX_LV_LATENCY_SIM, upperBoundMs)\n }\n\n disableLatencySim(){ this.sessionStorage.removeItem(PHX_LV_LATENCY_SIM) }\n\n getLatencySim(){\n let str = this.sessionStorage.getItem(PHX_LV_LATENCY_SIM)\n return str ? parseInt(str) : null\n }\n\n getSocket(){ return this.socket }\n\n connect(){\n // enable debug by default if on localhost and not explicitly disabled\n if(window.location.hostname === \"localhost\" && !this.isDebugDisabled()){ this.enableDebug() }\n let doConnect = () => {\n if(this.joinRootViews()){\n this.bindTopLevelEvents()\n this.socket.connect()\n } else if(this.main){\n this.socket.connect()\n } else {\n this.bindTopLevelEvents({dead: true})\n }\n this.joinDeadView()\n }\n if([\"complete\", \"loaded\", \"interactive\"].indexOf(document.readyState) >= 0){\n doConnect()\n } else {\n document.addEventListener(\"DOMContentLoaded\", () => doConnect())\n }\n }\n\n disconnect(callback){\n clearTimeout(this.reloadWithJitterTimer)\n this.socket.disconnect(callback)\n }\n\n replaceTransport(transport){\n clearTimeout(this.reloadWithJitterTimer)\n this.socket.replaceTransport(transport)\n this.connect()\n }\n\n execJS(el, encodedJS, eventType = null){\n this.owner(el, view => JS.exec(eventType, encodedJS, view, el))\n }\n\n // private\n\n execJSHookPush(el, phxEvent, data, callback){\n this.withinOwners(el, view => {\n JS.exec(\"hook\", phxEvent, view, el, [\"push\", {data, callback}])\n })\n }\n\n unload(){\n if(this.unloaded){ return }\n if(this.main && this.isConnected()){ this.log(this.main, \"socket\", () => [\"disconnect for page nav\"]) }\n this.unloaded = true\n this.destroyAllViews()\n this.disconnect()\n }\n\n triggerDOM(kind, args){ this.domCallbacks[kind](...args) }\n\n time(name, func){\n if(!this.isProfileEnabled() || !console.time){ return func() }\n console.time(name)\n let result = func()\n console.timeEnd(name)\n return result\n }\n\n log(view, kind, msgCallback){\n if(this.viewLogger){\n let [msg, obj] = msgCallback()\n this.viewLogger(view, kind, msg, obj)\n } else if(this.isDebugEnabled()){\n let [msg, obj] = msgCallback()\n debug(view, kind, msg, obj)\n }\n }\n\n requestDOMUpdate(callback){\n this.transitions.after(callback)\n }\n\n transition(time, onStart, onDone = function(){}){\n this.transitions.addTransition(time, onStart, onDone)\n }\n\n onChannel(channel, event, cb){\n channel.on(event, data => {\n let latency = this.getLatencySim()\n if(!latency){\n cb(data)\n } else {\n setTimeout(() => cb(data), latency)\n }\n })\n }\n\n wrapPush(view, opts, push){\n let latency = this.getLatencySim()\n let oldJoinCount = view.joinCount\n if(!latency){\n if(this.isConnected() && opts.timeout){\n return push().receive(\"timeout\", () => {\n if(view.joinCount === oldJoinCount && !view.isDestroyed()){\n this.reloadWithJitter(view, () => {\n this.log(view, \"timeout\", () => [\"received timeout while communicating with server. Falling back to hard refresh for recovery\"])\n })\n }\n })\n } else {\n return push()\n }\n }\n\n let fakePush = {\n receives: [],\n receive(kind, cb){ this.receives.push([kind, cb]) }\n }\n setTimeout(() => {\n if(view.isDestroyed()){ return }\n fakePush.receives.reduce((acc, [kind, cb]) => acc.receive(kind, cb), push())\n }, latency)\n return fakePush\n }\n\n reloadWithJitter(view, log){\n clearTimeout(this.reloadWithJitterTimer)\n this.disconnect()\n let minMs = this.reloadJitterMin\n let maxMs = this.reloadJitterMax\n let afterMs = Math.floor(Math.random() * (maxMs - minMs + 1)) + minMs\n let tries = Browser.updateLocal(this.localStorage, window.location.pathname, CONSECUTIVE_RELOADS, 0, count => count + 1)\n if(tries > this.maxReloads){\n afterMs = this.failsafeJitter\n }\n this.reloadWithJitterTimer = setTimeout(() => {\n // if view has recovered, such as transport replaced, then cancel\n if(view.isDestroyed() || view.isConnected()){ return }\n view.destroy()\n log ? log() : this.log(view, \"join\", () => [`encountered ${tries} consecutive reloads`])\n if(tries > this.maxReloads){\n this.log(view, \"join\", () => [`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`])\n }\n if(this.hasPendingLink()){\n window.location = this.pendingLink\n } else {\n window.location.reload()\n }\n }, afterMs)\n }\n\n getHookCallbacks(name){\n return name && name.startsWith(\"Phoenix.\") ? Hooks[name.split(\".\")[1]] : this.hooks[name]\n }\n\n isUnloaded(){ return this.unloaded }\n\n isConnected(){ return this.socket.isConnected() }\n\n getBindingPrefix(){ return this.bindingPrefix }\n\n binding(kind){ return `${this.getBindingPrefix()}${kind}` }\n\n channel(topic, params){ return this.socket.channel(topic, params) }\n\n joinDeadView(){\n let body = document.body\n if(body && !this.isPhxView(body) && !this.isPhxView(document.firstElementChild)){\n let view = this.newRootView(body)\n view.setHref(this.getHref())\n view.joinDead()\n if(!this.main){ this.main = view }\n window.requestAnimationFrame(() => view.execNewMounted())\n }\n }\n\n joinRootViews(){\n let rootsFound = false\n DOM.all(document, `${PHX_VIEW_SELECTOR}:not([${PHX_PARENT_ID}])`, rootEl => {\n if(!this.getRootById(rootEl.id)){\n let view = this.newRootView(rootEl)\n view.setHref(this.getHref())\n view.join()\n if(rootEl.hasAttribute(PHX_MAIN)){ this.main = view }\n }\n rootsFound = true\n })\n return rootsFound\n }\n\n redirect(to, flash){\n this.unload()\n Browser.redirect(to, flash)\n }\n\n replaceMain(href, flash, callback = null, linkRef = this.setPendingLink(href)){\n let liveReferer = this.currentLocation.href\n this.outgoingMainEl = this.outgoingMainEl || this.main.el\n let newMainEl = DOM.cloneNode(this.outgoingMainEl, \"\")\n this.main.showLoader(this.loaderTimeout)\n this.main.destroy()\n\n this.main = this.newRootView(newMainEl, flash, liveReferer)\n this.main.setRedirect(href)\n this.transitionRemoves()\n this.main.join((joinCount, onDone) => {\n if(joinCount === 1 && this.commitPendingLink(linkRef)){\n this.requestDOMUpdate(() => {\n DOM.findPhxSticky(document).forEach(el => newMainEl.appendChild(el))\n this.outgoingMainEl.replaceWith(newMainEl)\n this.outgoingMainEl = null\n callback && requestAnimationFrame(() => callback(linkRef))\n onDone()\n })\n }\n })\n }\n\n transitionRemoves(elements){\n let removeAttr = this.binding(\"remove\")\n elements = elements || DOM.all(document, `[${removeAttr}]`)\n elements.forEach(el => {\n this.execJS(el, el.getAttribute(removeAttr), \"remove\")\n })\n }\n\n isPhxView(el){ return el.getAttribute && el.getAttribute(PHX_SESSION) !== null }\n\n newRootView(el, flash, liveReferer){\n let view = new View(el, this, null, flash, liveReferer)\n this.roots[view.id] = view\n return view\n }\n\n owner(childEl, callback){\n let view = maybe(childEl.closest(PHX_VIEW_SELECTOR), el => this.getViewByEl(el)) || this.main\n if(view){ callback(view) }\n }\n\n withinOwners(childEl, callback){\n this.owner(childEl, view => callback(view, childEl))\n }\n\n getViewByEl(el){\n let rootId = el.getAttribute(PHX_ROOT_ID)\n return maybe(this.getRootById(rootId), root => root.getDescendentByEl(el))\n }\n\n getRootById(id){ return this.roots[id] }\n\n destroyAllViews(){\n for(let id in this.roots){\n this.roots[id].destroy()\n delete this.roots[id]\n }\n this.main = null\n }\n\n destroyViewByEl(el){\n let root = this.getRootById(el.getAttribute(PHX_ROOT_ID))\n if(root && root.id === el.id){\n root.destroy()\n delete this.roots[root.id]\n } else if(root){\n root.destroyDescendent(el.id)\n }\n }\n\n setActiveElement(target){\n if(this.activeElement === target){ return }\n this.activeElement = target\n let cancel = () => {\n if(target === this.activeElement){ this.activeElement = null }\n target.removeEventListener(\"mouseup\", this)\n target.removeEventListener(\"touchend\", this)\n }\n target.addEventListener(\"mouseup\", cancel)\n target.addEventListener(\"touchend\", cancel)\n }\n\n getActiveElement(){\n if(document.activeElement === document.body){\n return this.activeElement || document.activeElement\n } else {\n // document.activeElement can be null in Internet Explorer 11\n return document.activeElement || document.body\n }\n }\n\n dropActiveElement(view){\n if(this.prevActive && view.ownsElement(this.prevActive)){\n this.prevActive = null\n }\n }\n\n restorePreviouslyActiveFocus(){\n if(this.prevActive && this.prevActive !== document.body){\n this.prevActive.focus()\n }\n }\n\n blurActiveElement(){\n this.prevActive = this.getActiveElement()\n if(this.prevActive !== document.body){ this.prevActive.blur() }\n }\n\n bindTopLevelEvents({dead} = {}){\n if(this.boundTopLevelEvents){ return }\n\n this.boundTopLevelEvents = true\n // enter failsafe reload if server has gone away intentionally, such as \"disconnect\" broadcast\n this.socket.onClose(event => {\n // failsafe reload if normal closure and we still have a main LV\n if(event && event.code === 1000 && this.main){ return this.reloadWithJitter(this.main) }\n })\n document.body.addEventListener(\"click\", function (){ }) // ensure all click events bubble for mobile Safari\n window.addEventListener(\"pageshow\", e => {\n if(e.persisted){ // reload page if being restored from back/forward cache\n this.getSocket().disconnect()\n this.withPageLoading({to: window.location.href, kind: \"redirect\"})\n window.location.reload()\n }\n }, true)\n if(!dead){ this.bindNav() }\n this.bindClicks()\n if(!dead){ this.bindForms() }\n this.bind({keyup: \"keyup\", keydown: \"keydown\"}, (e, type, view, targetEl, phxEvent, eventTarget) => {\n let matchKey = targetEl.getAttribute(this.binding(PHX_KEY))\n let pressedKey = e.key && e.key.toLowerCase() // chrome clicked autocompletes send a keydown without key\n if(matchKey && matchKey.toLowerCase() !== pressedKey){ return }\n\n let data = {key: e.key, ...this.eventMeta(type, e, targetEl)}\n JS.exec(type, phxEvent, view, targetEl, [\"push\", {data}])\n })\n this.bind({blur: \"focusout\", focus: \"focusin\"}, (e, type, view, targetEl, phxEvent, eventTarget) => {\n if(!eventTarget){\n let data = {key: e.key, ...this.eventMeta(type, e, targetEl)}\n JS.exec(type, phxEvent, view, targetEl, [\"push\", {data}])\n }\n })\n this.bind({blur: \"blur\", focus: \"focus\"}, (e, type, view, targetEl, targetCtx, phxEvent, phxTarget) => {\n // blur and focus are triggered on document and window. Discard one to avoid dups\n if(phxTarget === \"window\"){\n let data = this.eventMeta(type, e, targetEl)\n JS.exec(type, phxEvent, view, targetEl, [\"push\", {data}])\n }\n })\n window.addEventListener(\"dragover\", e => e.preventDefault())\n window.addEventListener(\"drop\", e => {\n e.preventDefault()\n let dropTargetId = maybe(closestPhxBinding(e.target, this.binding(PHX_DROP_TARGET)), trueTarget => {\n return trueTarget.getAttribute(this.binding(PHX_DROP_TARGET))\n })\n let dropTarget = dropTargetId && document.getElementById(dropTargetId)\n let files = Array.from(e.dataTransfer.files || [])\n if(!dropTarget || dropTarget.disabled || files.length === 0 || !(dropTarget.files instanceof FileList)){ return }\n\n LiveUploader.trackFiles(dropTarget, files, e.dataTransfer)\n dropTarget.dispatchEvent(new Event(\"input\", {bubbles: true}))\n })\n this.on(PHX_TRACK_UPLOADS, e => {\n let uploadTarget = e.target\n if(!DOM.isUploadInput(uploadTarget)){ return }\n let files = Array.from(e.detail.files || []).filter(f => f instanceof File || f instanceof Blob)\n LiveUploader.trackFiles(uploadTarget, files)\n uploadTarget.dispatchEvent(new Event(\"input\", {bubbles: true}))\n })\n }\n\n eventMeta(eventName, e, targetEl){\n let callback = this.metadataCallbacks[eventName]\n return callback ? callback(e, targetEl) : {}\n }\n\n setPendingLink(href){\n this.linkRef++\n this.pendingLink = href\n return this.linkRef\n }\n\n commitPendingLink(linkRef){\n if(this.linkRef !== linkRef){\n return false\n } else {\n this.href = this.pendingLink\n this.pendingLink = null\n return true\n }\n }\n\n getHref(){ return this.href }\n\n hasPendingLink(){ return !!this.pendingLink }\n\n bind(events, callback){\n for(let event in events){\n let browserEventName = events[event]\n\n this.on(browserEventName, e => {\n let binding = this.binding(event)\n let windowBinding = this.binding(`window-${event}`)\n let targetPhxEvent = e.target.getAttribute && e.target.getAttribute(binding)\n if(targetPhxEvent){\n this.debounce(e.target, e, browserEventName, () => {\n this.withinOwners(e.target, view => {\n callback(e, event, view, e.target, targetPhxEvent, null)\n })\n })\n } else {\n DOM.all(document, `[${windowBinding}]`, el => {\n let phxEvent = el.getAttribute(windowBinding)\n this.debounce(el, e, browserEventName, () => {\n this.withinOwners(el, view => {\n callback(e, event, view, el, phxEvent, \"window\")\n })\n })\n })\n }\n })\n }\n }\n\n bindClicks(){\n window.addEventListener(\"click\", e => this.clickStartedAtTarget = e.target)\n this.bindClick(\"click\", \"click\", false)\n this.bindClick(\"mousedown\", \"capture-click\", true)\n }\n\n bindClick(eventName, bindingName, capture){\n let click = this.binding(bindingName)\n window.addEventListener(eventName, e => {\n let target = null\n if(capture){\n target = e.target.matches(`[${click}]`) ? e.target : e.target.querySelector(`[${click}]`)\n } else {\n let clickStartedAtTarget = this.clickStartedAtTarget || e.target\n target = closestPhxBinding(clickStartedAtTarget, click)\n this.dispatchClickAway(e, clickStartedAtTarget)\n this.clickStartedAtTarget = null\n }\n let phxEvent = target && target.getAttribute(click)\n if(!phxEvent){\n if(!capture && DOM.isNewPageClick(e, window.location)){ this.unload() }\n return\n }\n\n if(target.getAttribute(\"href\") === \"#\"){ e.preventDefault() }\n\n // noop if we are in the middle of awaiting an ack for this el already\n if(target.hasAttribute(PHX_REF)){ return }\n\n this.debounce(target, e, \"click\", () => {\n this.withinOwners(target, view => {\n JS.exec(\"click\", phxEvent, view, target, [\"push\", {data: this.eventMeta(\"click\", e, target)}])\n })\n })\n }, capture)\n }\n\n dispatchClickAway(e, clickStartedAt){\n let phxClickAway = this.binding(\"click-away\")\n DOM.all(document, `[${phxClickAway}]`, el => {\n if(!(el.isSameNode(clickStartedAt) || el.contains(clickStartedAt))){\n this.withinOwners(e.target, view => {\n let phxEvent = el.getAttribute(phxClickAway)\n if(JS.isVisible(el)){\n JS.exec(\"click\", phxEvent, view, el, [\"push\", {data: this.eventMeta(\"click\", e, e.target)}])\n }\n })\n }\n })\n }\n\n bindNav(){\n if(!Browser.canPushState()){ return }\n if(history.scrollRestoration){ history.scrollRestoration = \"manual\" }\n let scrollTimer = null\n window.addEventListener(\"scroll\", _e => {\n clearTimeout(scrollTimer)\n scrollTimer = setTimeout(() => {\n Browser.updateCurrentState(state => Object.assign(state, {scroll: window.scrollY}))\n }, 100)\n })\n window.addEventListener(\"popstate\", event => {\n if(!this.registerNewLocation(window.location)){ return }\n let {type, id, root, scroll} = event.state || {}\n let href = window.location.href\n\n DOM.dispatchEvent(window, \"phx:navigate\", {detail: {href, patch: type === \"patch\", pop: true}})\n this.requestDOMUpdate(() => {\n if(this.main.isConnected() && (type === \"patch\" && id === this.main.id)){\n this.main.pushLinkPatch(href, null, () => {\n this.maybeScroll(scroll)\n })\n } else {\n this.replaceMain(href, null, () => {\n if(root){ this.replaceRootHistory() }\n this.maybeScroll(scroll)\n })\n }\n })\n }, false)\n window.addEventListener(\"click\", e => {\n let target = closestPhxBinding(e.target, PHX_LIVE_LINK)\n let type = target && target.getAttribute(PHX_LIVE_LINK)\n if(!type || !this.isConnected() || !this.main || DOM.wantsNewTab(e)){ return }\n\n let href = target.href\n let linkState = target.getAttribute(PHX_LINK_STATE)\n e.preventDefault()\n e.stopImmediatePropagation() // do not bubble click to regular phx-click bindings\n if(this.pendingLink === href){ return }\n\n this.requestDOMUpdate(() => {\n if(type === \"patch\"){\n this.pushHistoryPatch(href, linkState, target)\n } else if(type === \"redirect\"){\n this.historyRedirect(href, linkState)\n } else {\n throw new Error(`expected ${PHX_LIVE_LINK} to be \"patch\" or \"redirect\", got: ${type}`)\n }\n let phxClick = target.getAttribute(this.binding(\"click\"))\n if(phxClick){\n this.requestDOMUpdate(() => this.execJS(target, phxClick, \"click\"))\n }\n })\n }, false)\n }\n\n maybeScroll(scroll) {\n if(typeof(scroll) === \"number\"){\n requestAnimationFrame(() => {\n window.scrollTo(0, scroll)\n }) // the body needs to render before we scroll.\n }\n }\n\n dispatchEvent(event, payload = {}){\n DOM.dispatchEvent(window, `phx:${event}`, {detail: payload})\n }\n\n dispatchEvents(events){\n events.forEach(([event, payload]) => this.dispatchEvent(event, payload))\n }\n\n withPageLoading(info, callback){\n DOM.dispatchEvent(window, \"phx:page-loading-start\", {detail: info})\n let done = () => DOM.dispatchEvent(window, \"phx:page-loading-stop\", {detail: info})\n return callback ? callback(done) : done\n }\n\n pushHistoryPatch(href, linkState, targetEl){\n if(!this.isConnected()){ return Browser.redirect(href) }\n\n this.withPageLoading({to: href, kind: \"patch\"}, done => {\n this.main.pushLinkPatch(href, targetEl, linkRef => {\n this.historyPatch(href, linkState, linkRef)\n done()\n })\n })\n }\n\n historyPatch(href, linkState, linkRef = this.setPendingLink(href)){\n if(!this.commitPendingLink(linkRef)){ return }\n\n Browser.pushState(linkState, {type: \"patch\", id: this.main.id}, href)\n DOM.dispatchEvent(window, \"phx:navigate\", {detail: {patch: true, href, pop: false}})\n this.registerNewLocation(window.location)\n }\n\n historyRedirect(href, linkState, flash){\n // convert to full href if only path prefix\n if(!this.isConnected()){ return Browser.redirect(href, flash) }\n if(/^\\/$|^\\/[^\\/]+.*$/.test(href)){\n let {protocol, host} = window.location\n href = `${protocol}//${host}${href}`\n }\n let scroll = window.scrollY\n this.withPageLoading({to: href, kind: \"redirect\"}, done => {\n this.replaceMain(href, flash, (linkRef) => {\n if(linkRef === this.linkRef){\n Browser.pushState(linkState, {type: \"redirect\", id: this.main.id, scroll: scroll}, href)\n DOM.dispatchEvent(window, \"phx:navigate\", {detail: {href, patch: false, pop: false}})\n this.registerNewLocation(window.location)\n }\n done()\n })\n })\n }\n\n replaceRootHistory(){\n Browser.pushState(\"replace\", {root: true, type: \"patch\", id: this.main.id})\n }\n\n registerNewLocation(newLocation){\n let {pathname, search} = this.currentLocation\n if(pathname + search === newLocation.pathname + newLocation.search){\n return false\n } else {\n this.currentLocation = clone(newLocation)\n return true\n }\n }\n\n bindForms(){\n let iterations = 0\n let externalFormSubmitted = false\n\n // disable forms on submit that track phx-change but perform external submit\n this.on(\"submit\", e => {\n let phxSubmit = e.target.getAttribute(this.binding(\"submit\"))\n let phxChange = e.target.getAttribute(this.binding(\"change\"))\n if(!externalFormSubmitted && phxChange && !phxSubmit){\n externalFormSubmitted = true\n e.preventDefault()\n this.withinOwners(e.target, view => {\n view.disableForm(e.target)\n // safari needs next tick\n window.requestAnimationFrame(() => {\n if(DOM.isUnloadableFormSubmit(e)){ this.unload() }\n e.target.submit()\n })\n })\n }\n }, true)\n\n this.on(\"submit\", e => {\n let phxEvent = e.target.getAttribute(this.binding(\"submit\"))\n if(!phxEvent){\n if(DOM.isUnloadableFormSubmit(e)){ this.unload() }\n return\n }\n e.preventDefault()\n e.target.disabled = true\n this.withinOwners(e.target, view => {\n JS.exec(\"submit\", phxEvent, view, e.target, [\"push\", {submitter: e.submitter}])\n })\n }, false)\n\n for(let type of [\"change\", \"input\"]){\n this.on(type, e => {\n let phxChange = this.binding(\"change\")\n let input = e.target\n let inputEvent = input.getAttribute(phxChange)\n let formEvent = input.form && input.form.getAttribute(phxChange)\n let phxEvent = inputEvent || formEvent\n if(!phxEvent){ return }\n if(input.type === \"number\" && input.validity && input.validity.badInput){ return }\n\n let dispatcher = inputEvent ? input : input.form\n let currentIterations = iterations\n iterations++\n let {at: at, type: lastType} = DOM.private(input, \"prev-iteration\") || {}\n // Browsers should always fire at least one \"input\" event before every \"change\"\n // Ignore \"change\" events, unless there was no prior \"input\" event.\n // This could happen if user code triggers a \"change\" event, or if the browser is non-conforming.\n if(at === currentIterations - 1 && type === \"change\" && lastType === \"input\"){ return }\n\n DOM.putPrivate(input, \"prev-iteration\", {at: currentIterations, type: type})\n\n this.debounce(input, e, type, () => {\n this.withinOwners(dispatcher, view => {\n DOM.putPrivate(input, PHX_HAS_FOCUSED, true)\n if(!DOM.isTextualInput(input)){\n this.setActiveElement(input)\n }\n JS.exec(\"change\", phxEvent, view, input, [\"push\", {_target: e.target.name, dispatcher: dispatcher}])\n })\n })\n }, false)\n }\n this.on(\"reset\", (e) => {\n let form = e.target\n DOM.resetForm(form, this.binding(PHX_FEEDBACK_FOR))\n let input = Array.from(form.elements).find(el => el.type === \"reset\")\n // wait until next tick to get updated input value\n window.requestAnimationFrame(() => {\n input.dispatchEvent(new Event(\"input\", {bubbles: true, cancelable: false}))\n })\n })\n }\n\n debounce(el, event, eventType, callback){\n if(eventType === \"blur\" || eventType === \"focusout\"){ return callback() }\n\n let phxDebounce = this.binding(PHX_DEBOUNCE)\n let phxThrottle = this.binding(PHX_THROTTLE)\n let defaultDebounce = this.defaults.debounce.toString()\n let defaultThrottle = this.defaults.throttle.toString()\n\n this.withinOwners(el, view => {\n let asyncFilter = () => !view.isDestroyed() && document.body.contains(el)\n DOM.debounce(el, event, phxDebounce, defaultDebounce, phxThrottle, defaultThrottle, asyncFilter, () => {\n callback()\n })\n })\n }\n\n silenceEvents(callback){\n this.silenced = true\n callback()\n this.silenced = false\n }\n\n on(event, callback){\n window.addEventListener(event, e => {\n if(!this.silenced){ callback(e) }\n })\n }\n}\n\nclass TransitionSet {\n constructor(){\n this.transitions = new Set()\n this.pendingOps = []\n }\n\n reset(){\n this.transitions.forEach(timer => {\n clearTimeout(timer)\n this.transitions.delete(timer)\n })\n this.flushPendingOps()\n }\n\n after(callback){\n if(this.size() === 0){\n callback()\n } else {\n this.pushPendingOp(callback)\n }\n }\n\n addTransition(time, onStart, onDone){\n onStart()\n let timer = setTimeout(() => {\n this.transitions.delete(timer)\n onDone()\n this.flushPendingOps()\n }, time)\n this.transitions.add(timer)\n }\n\n pushPendingOp(op){ this.pendingOps.push(op) }\n\n size(){ return this.transitions.size }\n\n flushPendingOps(){\n if(this.size() > 0){ return }\n let op = this.pendingOps.shift()\n if(op){\n op()\n this.flushPendingOps()\n }\n }\n}\n"],
+ "mappings": ";AAAO,IAAM,sBAAsB;AAC5B,IAAM,cAAc;AACpB,IAAM,oBAAoB;AAC1B,IAAM,oBAAoB;AAC1B,IAAM,kBAAkB;AACxB,IAAM,oBAAoB;AAAA,EAC/B;AAAA,EAAqB;AAAA,EAAsB;AAAA,EAC3C;AAAA,EAAuB;AAAA,EAAqB;AAAA,EAAoB;AAAA;AAE3D,IAAM,gBAAgB;AACtB,IAAM,gBAAgB;AACtB,IAAM,mBAAmB;AACzB,IAAM,iBAAiB;AACvB,IAAM,UAAU;AAChB,IAAM,cAAc;AACpB,IAAM,oBAAoB;AAC1B,IAAM,iBAAiB;AACvB,IAAM,uBAAuB;AAC7B,IAAM,gBAAgB;AACtB,IAAM,kBAAkB;AACxB,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAC9B,IAAM,WAAW;AACjB,IAAM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ACA,QAAI,QAAQ,WAAW,MAAM;AAC3B,WAAK,YAAY,OAAO;AACxB;AACA,WAAK;AAAA,OACJ;AACH,SAAK,YAAY,IAAI;AAAA;AAAA,EAGvB,cAAc,IAAG;AAAE,SAAK,WAAW,KAAK;AAAA;AAAA,EAExC,OAAM;AAAE,WAAO,KAAK,YAAY;AAAA;AAAA,EAEhC,kBAAiB;AACf,QAAG,KAAK,SAAS,GAAE;AAAE;AAAA;AACrB,QAAI,KAAK,KAAK,WAAW;AACzB,QAAG,IAAG;AACJ;AACA,WAAK;AAAA;AAAA;AAAA;",
"names": []
}
diff --git a/priv/static/phoenix_live_view.js b/priv/static/phoenix_live_view.js
index a4ac69d1c6..a213bdde1e 100644
--- a/priv/static/phoenix_live_view.js
+++ b/priv/static/phoenix_live_view.js
@@ -333,6 +333,9 @@ var LiveView = (() => {
isUploadInput(el) {
return el.type === "file" && el.getAttribute(PHX_UPLOAD_REF) !== null;
},
+ isAutoUpload(inputEl) {
+ return inputEl.hasAttribute("data-phx-auto-upload");
+ },
findUploadInputs(node) {
return this.all(node, `input[type="file"][${PHX_UPLOAD_REF}]`);
},
@@ -822,7 +825,9 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
error(reason = "failed") {
this.fileEl.removeEventListener(PHX_LIVE_FILE_UPDATED, this._onElUpdated);
this.view.pushFileProgress(this.fileEl, this.ref, { error: reason });
- LiveUploader.clearFiles(this.fileEl);
+ if (!dom_default.isAutoUpload(this.fileEl)) {
+ LiveUploader.clearFiles(this.fileEl);
+ }
}
onDone(callback) {
this._onDone = () => {
@@ -3434,7 +3439,7 @@ within:
};
this.pushWithReply(refGenerator, "event", event, (resp) => {
dom_default.showError(inputEl, this.liveSocket.binding(PHX_FEEDBACK_FOR));
- if (dom_default.isUploadInput(inputEl) && inputEl.getAttribute("data-phx-auto-upload") !== null) {
+ if (dom_default.isUploadInput(inputEl) && dom_default.isAutoUpload(inputEl)) {
if (LiveUploader.filesAwaitingPreflight(inputEl).length > 0) {
let [ref, _els] = refGenerator();
this.uploadFiles(inputEl.form, targetCtx, ref, cid, (_uploads) => {
diff --git a/priv/static/phoenix_live_view.min.js b/priv/static/phoenix_live_view.min.js
index a23d9981c2..6a0b646fa0 100644
--- a/priv/static/phoenix_live_view.min.js
+++ b/priv/static/phoenix_live_view.min.js
@@ -1,16 +1,16 @@
-var LiveView=(()=>{var ct=Object.defineProperty;var Xe=Object.getOwnPropertySymbols;var Rt=Object.prototype.hasOwnProperty,Lt=Object.prototype.propertyIsEnumerable;var Dt=(r,e,t)=>e in r?ct(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,V=(r,e)=>{for(var t in e||(e={}))Rt.call(e,t)&&Dt(r,t,e[t]);if(Xe)for(var t of Xe(e))Lt.call(e,t)&&Dt(r,t,e[t]);return r};var gi=r=>ct(r,"__esModule",{value:!0});var Ot=(r,e)=>{var t={};for(var i in r)Rt.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&Xe)for(var i of Xe(r))e.indexOf(i)<0&&Lt.call(r,i)&&(t[i]=r[i]);return t};var vi=(r,e)=>{gi(r);for(var t in e)ct(r,t,{get:e[t],enumerable:!0})};var Fi={};vi(Fi,{LiveSocket:()=>at});var $e="consecutive-reloads",Ht=10,Nt=5e3,Ft=1e4,Mt=3e4,Be=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading"],k="data-phx-component",Ve="data-phx-link",Ut="track-static",Xt="data-phx-link-state",R="data-phx-ref",Q="data-phx-ref-src",Je="track-uploads",J="data-phx-upload-ref",fe="data-phx-preflighted-refs",$t="data-phx-done-refs",ut="drop-target",xe="data-phx-active-refs",pe="phx:live-file:updated",Te="data-phx-skip",ft="data-phx-prune",pt="page-loading",mt="phx-connected",me="phx-loading",je="phx-no-feedback",ke="phx-error",gt="phx-client-error",We="phx-server-error",Z="data-phx-parent-id",ge="data-phx-main",ee="data-phx-root-id",qe="viewport-top",Ke="viewport-bottom",Bt="trigger-action",le="feedback-for",Ce="phx-has-focused",Vt=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],Ge=["checkbox","radio"],ve="phx-has-submitted",M="data-phx-session",G=`[${M}]`,vt="data-phx-sticky",se="data-phx-static",ze="data-phx-readonly",Ie="data-phx-disabled",Re="disable-with",Le="data-phx-disable-with-restore",be="hook",Jt="debounce",jt="throttle",Ee="update",Ye="stream",_e="data-phx-stream",Wt="key",j="phxPrivate",bt="auto-recover",De="phx:live-socket:debug",Qe="phx:live-socket:profiling",Ze="phx:live-socket:latency-sim",qt="progress",Et="mounted",Kt=1,Gt=200,zt="phx-",Yt=3e4;var Ae="debounce-trigger",Oe="throttled",_t="debounce-prev-key",Qt={debounce:300,throttle:300},He="d",W="s",D="c",At="e",St="r",wt="t",Zt="p",yt="stream";var et=class{constructor(e,t,i){this.liveSocket=i,this.entry=e,this.offset=0,this.chunkSize=t,this.chunkTimer=null,this.errored=!1,this.uploadChannel=i.channel(`lvu:${e.ref}`,{token:e.metadata()})}error(e){this.errored||(this.errored=!0,clearTimeout(this.chunkTimer),this.entry.error(e))}upload(){this.uploadChannel.onError(e=>this.error(e)),this.uploadChannel.join().receive("ok",e=>this.readNextChunk()).receive("error",e=>this.error(e))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let e=new window.FileReader,t=this.entry.file.slice(this.offset,this.chunkSize+this.offset);e.onload=i=>{if(i.target.error===null)this.offset+=i.target.result.byteLength,this.pushChunk(i.target.result);else return T("Read error: "+i.target.error)},e.readAsArrayBuffer(t)}pushChunk(e){!this.uploadChannel.isJoined()||this.uploadChannel.push("chunk",e).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))}).receive("error",({reason:t})=>this.error(t))}};var T=(r,e)=>console.error&&console.error(r,e),q=r=>{let e=typeof r;return e==="number"||e==="string"&&/^(0|[1-9]\d*)$/.test(r)};function ei(){let r=new Set,e=document.querySelectorAll("*[id]");for(let t=0,i=e.length;t{r.liveSocket.isDebugEnabled()&&console.log(`${r.id} ${e}: ${t} - `,i)},tt=r=>typeof r=="function"?r:function(){return r},Se=r=>JSON.parse(JSON.stringify(r)),he=(r,e,t)=>{do{if(r.matches(`[${e}]`)&&!r.disabled)return r;r=r.parentElement||r.parentNode}while(r!==null&&r.nodeType===1&&!(t&&t.isSameNode(r)||r.matches(G)));return null},we=r=>r!==null&&typeof r=="object"&&!(r instanceof Array),ii=(r,e)=>JSON.stringify(r)===JSON.stringify(e),Pt=r=>{for(let e in r)return!1;return!0},K=(r,e)=>r&&e(r),ri=function(r,e,t,i){r.forEach(s=>{new et(s,t.config.chunk_size,i).upload()})};var si={canPushState(){return typeof history.pushState!="undefined"},dropLocal(r,e,t){return r.removeItem(this.localKey(e,t))},updateLocal(r,e,t,i,s){let n=this.getLocal(r,e,t),o=this.localKey(e,t),a=n===null?i:s(n);return r.setItem(o,JSON.stringify(a)),a},getLocal(r,e,t){return JSON.parse(r.getItem(this.localKey(e,t)))},updateCurrentState(r){!this.canPushState()||history.replaceState(r(history.state||{}),"",window.location.href)},pushState(r,e,t){if(this.canPushState()){if(t!==window.location.href){if(e.type=="redirect"&&e.scroll){let s=history.state||{};s.scroll=e.scroll,history.replaceState(s,"",window.location.href)}delete e.scroll,history[r+"State"](e,"",t||null);let i=this.getHashTargetEl(window.location.hash);i?i.scrollIntoView():e.type==="redirect"&&window.scroll(0,0)}}else this.redirect(t)},setCookie(r,e){document.cookie=`${r}=${e}`},getCookie(r){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${r}s*=s*([^;]*).*$)|^.*$`),"$1")},redirect(r,e){e&&si.setCookie("__phoenix_flash__",e+"; max-age=60000; path=/"),window.location=r},localKey(r,e){return`${r}-${e}`},getHashTargetEl(r){let e=r.toString().substring(1);if(e!=="")return document.getElementById(e)||document.querySelector(`a[name="${e}"]`)}},U=si;var X={byId(r){return document.getElementById(r)||T(`no id found for ${r}`)},removeClass(r,e){r.classList.remove(e),r.classList.length===0&&r.removeAttribute("class")},all(r,e,t){if(!r)return[];let i=Array.from(r.querySelectorAll(e));return t?i.forEach(t):i},childNodeLength(r){let e=document.createElement("template");return e.innerHTML=r,e.content.childElementCount},isUploadInput(r){return r.type==="file"&&r.getAttribute(J)!==null},findUploadInputs(r){return this.all(r,`input[type="file"][${J}]`)},findComponentNodeList(r,e){return this.filterWithinSameLiveView(this.all(r,`[${k}="${e}"]`),r)},isPhxDestroyed(r){return!!(r.id&&X.private(r,"destroyed"))},wantsNewTab(r){let e=r.ctrlKey||r.shiftKey||r.metaKey||r.button&&r.button===1,t=r.target instanceof HTMLAnchorElement&&r.target.hasAttribute("download"),i=r.target.hasAttribute("target")&&r.target.getAttribute("target").toLowerCase()==="_blank";return e||i||t},isUnloadableFormSubmit(r){return!r.defaultPrevented&&!this.wantsNewTab(r)},isNewPageClick(r,e){let t=r.target instanceof HTMLAnchorElement?r.target.getAttribute("href"):null,i;if(r.defaultPrevented||t===null||this.wantsNewTab(r)||t.startsWith("mailto:")||t.startsWith("tel:"))return!1;try{i=new URL(t)}catch(s){try{i=new URL(t,e)}catch(n){return!0}}return i.host===e.host&&i.protocol===e.protocol&&i.pathname===e.pathname&&i.search===e.search?i.hash===""&&!i.href.endsWith("#"):i.protocol.startsWith("http")},markPhxChildDestroyed(r){this.isPhxChild(r)&&r.setAttribute(M,""),this.putPrivate(r,"destroyed",!0)},findPhxChildrenInFragment(r,e){let t=document.createElement("template");return t.innerHTML=r,this.findPhxChildren(t.content,e)},isIgnored(r,e){return(r.getAttribute(e)||r.getAttribute("data-phx-update"))==="ignore"},isPhxUpdate(r,e,t){return r.getAttribute&&t.indexOf(r.getAttribute(e))>=0},findPhxSticky(r){return this.all(r,`[${vt}]`)},findPhxChildren(r,e){return this.all(r,`${G}[${Z}="${e}"]`)},findParentCIDs(r,e){let t=new Set(e),i=e.reduce((s,n)=>{let o=`[${k}="${n}"] [${k}]`;return this.filterWithinSameLiveView(this.all(r,o),r).map(a=>parseInt(a.getAttribute(k))).forEach(a=>s.delete(a)),s},t);return i.size===0?new Set(e):i},filterWithinSameLiveView(r,e){return e.querySelector(G)?r.filter(t=>this.withinSameLiveView(t,e)):r},withinSameLiveView(r,e){for(;r=r.parentNode;){if(r.isSameNode(e))return!0;if(r.getAttribute(M)!==null)return!1}},private(r,e){return r[j]&&r[j][e]},deletePrivate(r,e){r[j]&&delete r[j][e]},putPrivate(r,e,t){r[j]||(r[j]={}),r[j][e]=t},updatePrivate(r,e,t,i){let s=this.private(r,e);s===void 0?this.putPrivate(r,e,i(t)):this.putPrivate(r,e,i(s))},copyPrivates(r,e){e[j]&&(r[j]=e[j])},putTitle(r){let e=document.querySelector("title");if(e){let{prefix:t,suffix:i}=e.dataset;document.title=`${t||""}${r}${i||""}`}else document.title=r},debounce(r,e,t,i,s,n,o,a){let l=r.getAttribute(t),d=r.getAttribute(s);l===""&&(l=i),d===""&&(d=n);let u=l||d;switch(u){case null:return a();case"blur":this.once(r,"debounce-blur")&&r.addEventListener("blur",()=>a());return;default:let f=parseInt(u),g=()=>d?this.deletePrivate(r,Oe):a(),m=this.incCycle(r,Ae,g);if(isNaN(f))return T(`invalid throttle/debounce value: ${u}`);if(d){let E=!1;if(e.type==="keydown"){let C=this.private(r,_t);this.putPrivate(r,_t,e.key),E=C!==e.key}if(!E&&this.private(r,Oe))return!1;a(),this.putPrivate(r,Oe,!0),setTimeout(()=>{o()&&this.triggerCycle(r,Ae)},f)}else setTimeout(()=>{o()&&this.triggerCycle(r,Ae,m)},f);let p=r.form;p&&this.once(p,"bind-debounce")&&p.addEventListener("submit",()=>{Array.from(new FormData(p).entries(),([E])=>{let C=p.querySelector(`[name="${E}"]`);this.incCycle(C,Ae),this.deletePrivate(C,Oe)})}),this.once(r,"bind-debounce")&&r.addEventListener("blur",()=>this.triggerCycle(r,Ae))}},triggerCycle(r,e,t){let[i,s]=this.private(r,e);t||(t=i),t===i&&(this.incCycle(r,e),s())},once(r,e){return this.private(r,e)===!0?!1:(this.putPrivate(r,e,!0),!0)},incCycle(r,e,t=function(){}){let[i]=this.private(r,e)||[0,t];return i++,this.putPrivate(r,e,[i,t]),i},maybeAddPrivateHooks(r,e,t){r.hasAttribute&&(r.hasAttribute(e)||r.hasAttribute(t))&&r.setAttribute("data-phx-hook","Phoenix.InfiniteScroll")},maybeHideFeedback(r,e,t){if(!(this.private(e,Ce)||this.private(e,ve))){let i=[e.name];e.name.endsWith("[]")&&i.push(e.name.slice(0,-2));let s=i.map(n=>`[${t}="${n}"]`).join(", ");X.all(r,s,n=>n.classList.add(je))}},resetForm(r,e){Array.from(r.elements).forEach(t=>{let i=`[${e}="${t.id}"],
+var LiveView=(()=>{var ct=Object.defineProperty;var Xe=Object.getOwnPropertySymbols;var Rt=Object.prototype.hasOwnProperty,Lt=Object.prototype.propertyIsEnumerable;var Dt=(r,e,t)=>e in r?ct(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,V=(r,e)=>{for(var t in e||(e={}))Rt.call(e,t)&&Dt(r,t,e[t]);if(Xe)for(var t of Xe(e))Lt.call(e,t)&&Dt(r,t,e[t]);return r};var gi=r=>ct(r,"__esModule",{value:!0});var Ot=(r,e)=>{var t={};for(var i in r)Rt.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&Xe)for(var i of Xe(r))e.indexOf(i)<0&&Lt.call(r,i)&&(t[i]=r[i]);return t};var vi=(r,e)=>{gi(r);for(var t in e)ct(r,t,{get:e[t],enumerable:!0})};var Fi={};vi(Fi,{LiveSocket:()=>at});var $e="consecutive-reloads",Ht=10,Nt=5e3,Ft=1e4,Mt=3e4,Be=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading"],k="data-phx-component",Ve="data-phx-link",Ut="track-static",Xt="data-phx-link-state",R="data-phx-ref",Q="data-phx-ref-src",Je="track-uploads",J="data-phx-upload-ref",fe="data-phx-preflighted-refs",$t="data-phx-done-refs",ut="drop-target",xe="data-phx-active-refs",pe="phx:live-file:updated",Te="data-phx-skip",ft="data-phx-prune",pt="page-loading",mt="phx-connected",me="phx-loading",je="phx-no-feedback",ke="phx-error",gt="phx-client-error",We="phx-server-error",Z="data-phx-parent-id",ge="data-phx-main",ee="data-phx-root-id",qe="viewport-top",Ke="viewport-bottom",Bt="trigger-action",le="feedback-for",Ce="phx-has-focused",Vt=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],Ge=["checkbox","radio"],ve="phx-has-submitted",M="data-phx-session",G=`[${M}]`,vt="data-phx-sticky",se="data-phx-static",ze="data-phx-readonly",Ie="data-phx-disabled",Re="disable-with",Le="data-phx-disable-with-restore",be="hook",Jt="debounce",jt="throttle",Ee="update",Ye="stream",_e="data-phx-stream",Wt="key",j="phxPrivate",bt="auto-recover",De="phx:live-socket:debug",Qe="phx:live-socket:profiling",Ze="phx:live-socket:latency-sim",qt="progress",Et="mounted",Kt=1,Gt=200,zt="phx-",Yt=3e4;var Ae="debounce-trigger",Oe="throttled",_t="debounce-prev-key",Qt={debounce:300,throttle:300},He="d",W="s",D="c",At="e",St="r",wt="t",Zt="p",yt="stream";var et=class{constructor(e,t,i){this.liveSocket=i,this.entry=e,this.offset=0,this.chunkSize=t,this.chunkTimer=null,this.errored=!1,this.uploadChannel=i.channel(`lvu:${e.ref}`,{token:e.metadata()})}error(e){this.errored||(this.errored=!0,clearTimeout(this.chunkTimer),this.entry.error(e))}upload(){this.uploadChannel.onError(e=>this.error(e)),this.uploadChannel.join().receive("ok",e=>this.readNextChunk()).receive("error",e=>this.error(e))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let e=new window.FileReader,t=this.entry.file.slice(this.offset,this.chunkSize+this.offset);e.onload=i=>{if(i.target.error===null)this.offset+=i.target.result.byteLength,this.pushChunk(i.target.result);else return T("Read error: "+i.target.error)},e.readAsArrayBuffer(t)}pushChunk(e){!this.uploadChannel.isJoined()||this.uploadChannel.push("chunk",e).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))}).receive("error",({reason:t})=>this.error(t))}};var T=(r,e)=>console.error&&console.error(r,e),q=r=>{let e=typeof r;return e==="number"||e==="string"&&/^(0|[1-9]\d*)$/.test(r)};function ei(){let r=new Set,e=document.querySelectorAll("*[id]");for(let t=0,i=e.length;t{r.liveSocket.isDebugEnabled()&&console.log(`${r.id} ${e}: ${t} - `,i)},tt=r=>typeof r=="function"?r:function(){return r},Se=r=>JSON.parse(JSON.stringify(r)),he=(r,e,t)=>{do{if(r.matches(`[${e}]`)&&!r.disabled)return r;r=r.parentElement||r.parentNode}while(r!==null&&r.nodeType===1&&!(t&&t.isSameNode(r)||r.matches(G)));return null},we=r=>r!==null&&typeof r=="object"&&!(r instanceof Array),ii=(r,e)=>JSON.stringify(r)===JSON.stringify(e),Pt=r=>{for(let e in r)return!1;return!0},K=(r,e)=>r&&e(r),ri=function(r,e,t,i){r.forEach(s=>{new et(s,t.config.chunk_size,i).upload()})};var si={canPushState(){return typeof history.pushState!="undefined"},dropLocal(r,e,t){return r.removeItem(this.localKey(e,t))},updateLocal(r,e,t,i,s){let n=this.getLocal(r,e,t),o=this.localKey(e,t),a=n===null?i:s(n);return r.setItem(o,JSON.stringify(a)),a},getLocal(r,e,t){return JSON.parse(r.getItem(this.localKey(e,t)))},updateCurrentState(r){!this.canPushState()||history.replaceState(r(history.state||{}),"",window.location.href)},pushState(r,e,t){if(this.canPushState()){if(t!==window.location.href){if(e.type=="redirect"&&e.scroll){let s=history.state||{};s.scroll=e.scroll,history.replaceState(s,"",window.location.href)}delete e.scroll,history[r+"State"](e,"",t||null);let i=this.getHashTargetEl(window.location.hash);i?i.scrollIntoView():e.type==="redirect"&&window.scroll(0,0)}}else this.redirect(t)},setCookie(r,e){document.cookie=`${r}=${e}`},getCookie(r){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${r}s*=s*([^;]*).*$)|^.*$`),"$1")},redirect(r,e){e&&si.setCookie("__phoenix_flash__",e+"; max-age=60000; path=/"),window.location=r},localKey(r,e){return`${r}-${e}`},getHashTargetEl(r){let e=r.toString().substring(1);if(e!=="")return document.getElementById(e)||document.querySelector(`a[name="${e}"]`)}},U=si;var X={byId(r){return document.getElementById(r)||T(`no id found for ${r}`)},removeClass(r,e){r.classList.remove(e),r.classList.length===0&&r.removeAttribute("class")},all(r,e,t){if(!r)return[];let i=Array.from(r.querySelectorAll(e));return t?i.forEach(t):i},childNodeLength(r){let e=document.createElement("template");return e.innerHTML=r,e.content.childElementCount},isUploadInput(r){return r.type==="file"&&r.getAttribute(J)!==null},isAutoUpload(r){return r.hasAttribute("data-phx-auto-upload")},findUploadInputs(r){return this.all(r,`input[type="file"][${J}]`)},findComponentNodeList(r,e){return this.filterWithinSameLiveView(this.all(r,`[${k}="${e}"]`),r)},isPhxDestroyed(r){return!!(r.id&&X.private(r,"destroyed"))},wantsNewTab(r){let e=r.ctrlKey||r.shiftKey||r.metaKey||r.button&&r.button===1,t=r.target instanceof HTMLAnchorElement&&r.target.hasAttribute("download"),i=r.target.hasAttribute("target")&&r.target.getAttribute("target").toLowerCase()==="_blank";return e||i||t},isUnloadableFormSubmit(r){return!r.defaultPrevented&&!this.wantsNewTab(r)},isNewPageClick(r,e){let t=r.target instanceof HTMLAnchorElement?r.target.getAttribute("href"):null,i;if(r.defaultPrevented||t===null||this.wantsNewTab(r)||t.startsWith("mailto:")||t.startsWith("tel:"))return!1;try{i=new URL(t)}catch(s){try{i=new URL(t,e)}catch(n){return!0}}return i.host===e.host&&i.protocol===e.protocol&&i.pathname===e.pathname&&i.search===e.search?i.hash===""&&!i.href.endsWith("#"):i.protocol.startsWith("http")},markPhxChildDestroyed(r){this.isPhxChild(r)&&r.setAttribute(M,""),this.putPrivate(r,"destroyed",!0)},findPhxChildrenInFragment(r,e){let t=document.createElement("template");return t.innerHTML=r,this.findPhxChildren(t.content,e)},isIgnored(r,e){return(r.getAttribute(e)||r.getAttribute("data-phx-update"))==="ignore"},isPhxUpdate(r,e,t){return r.getAttribute&&t.indexOf(r.getAttribute(e))>=0},findPhxSticky(r){return this.all(r,`[${vt}]`)},findPhxChildren(r,e){return this.all(r,`${G}[${Z}="${e}"]`)},findParentCIDs(r,e){let t=new Set(e),i=e.reduce((s,n)=>{let o=`[${k}="${n}"] [${k}]`;return this.filterWithinSameLiveView(this.all(r,o),r).map(a=>parseInt(a.getAttribute(k))).forEach(a=>s.delete(a)),s},t);return i.size===0?new Set(e):i},filterWithinSameLiveView(r,e){return e.querySelector(G)?r.filter(t=>this.withinSameLiveView(t,e)):r},withinSameLiveView(r,e){for(;r=r.parentNode;){if(r.isSameNode(e))return!0;if(r.getAttribute(M)!==null)return!1}},private(r,e){return r[j]&&r[j][e]},deletePrivate(r,e){r[j]&&delete r[j][e]},putPrivate(r,e,t){r[j]||(r[j]={}),r[j][e]=t},updatePrivate(r,e,t,i){let s=this.private(r,e);s===void 0?this.putPrivate(r,e,i(t)):this.putPrivate(r,e,i(s))},copyPrivates(r,e){e[j]&&(r[j]=e[j])},putTitle(r){let e=document.querySelector("title");if(e){let{prefix:t,suffix:i}=e.dataset;document.title=`${t||""}${r}${i||""}`}else document.title=r},debounce(r,e,t,i,s,n,o,a){let l=r.getAttribute(t),d=r.getAttribute(s);l===""&&(l=i),d===""&&(d=n);let u=l||d;switch(u){case null:return a();case"blur":this.once(r,"debounce-blur")&&r.addEventListener("blur",()=>a());return;default:let f=parseInt(u),g=()=>d?this.deletePrivate(r,Oe):a(),m=this.incCycle(r,Ae,g);if(isNaN(f))return T(`invalid throttle/debounce value: ${u}`);if(d){let E=!1;if(e.type==="keydown"){let C=this.private(r,_t);this.putPrivate(r,_t,e.key),E=C!==e.key}if(!E&&this.private(r,Oe))return!1;a(),this.putPrivate(r,Oe,!0),setTimeout(()=>{o()&&this.triggerCycle(r,Ae)},f)}else setTimeout(()=>{o()&&this.triggerCycle(r,Ae,m)},f);let p=r.form;p&&this.once(p,"bind-debounce")&&p.addEventListener("submit",()=>{Array.from(new FormData(p).entries(),([E])=>{let C=p.querySelector(`[name="${E}"]`);this.incCycle(C,Ae),this.deletePrivate(C,Oe)})}),this.once(r,"bind-debounce")&&r.addEventListener("blur",()=>this.triggerCycle(r,Ae))}},triggerCycle(r,e,t){let[i,s]=this.private(r,e);t||(t=i),t===i&&(this.incCycle(r,e),s())},once(r,e){return this.private(r,e)===!0?!1:(this.putPrivate(r,e,!0),!0)},incCycle(r,e,t=function(){}){let[i]=this.private(r,e)||[0,t];return i++,this.putPrivate(r,e,[i,t]),i},maybeAddPrivateHooks(r,e,t){r.hasAttribute&&(r.hasAttribute(e)||r.hasAttribute(t))&&r.setAttribute("data-phx-hook","Phoenix.InfiniteScroll")},maybeHideFeedback(r,e,t){if(!(this.private(e,Ce)||this.private(e,ve))){let i=[e.name];e.name.endsWith("[]")&&i.push(e.name.slice(0,-2));let s=i.map(n=>`[${t}="${n}"]`).join(", ");X.all(r,s,n=>n.classList.add(je))}},resetForm(r,e){Array.from(r.elements).forEach(t=>{let i=`[${e}="${t.id}"],
[${e}="${t.name}"],
[${e}="${t.name.replace(/\[\]$/,"")}"]`;this.deletePrivate(t,Ce),this.deletePrivate(t,ve),this.all(document,i,s=>{s.classList.add(je)})})},showError(r,e){(r.id||r.name)&&this.all(r.form,`[${e}="${r.id}"], [${e}="${r.name}"]`,t=>{this.removeClass(t,je)})},isPhxChild(r){return r.getAttribute&&r.getAttribute(Z)},isPhxSticky(r){return r.getAttribute&&r.getAttribute(vt)!==null},firstPhxChild(r){return this.isPhxChild(r)?r:this.all(r,`[${Z}]`)[0]},dispatchEvent(r,e,t={}){let s={bubbles:t.bubbles===void 0?!0:!!t.bubbles,cancelable:!0,detail:t.detail||{}},n=e==="click"?new MouseEvent("click",s):new CustomEvent(e,s);r.dispatchEvent(n)},cloneNode(r,e){if(typeof e=="undefined")return r.cloneNode(!0);{let t=r.cloneNode(!1);return t.innerHTML=e,t}},mergeAttrs(r,e,t={}){let i=t.exclude||[],s=t.isIgnored,n=e.attributes;for(let a=n.length-1;a>=0;a--){let l=n[a].name;i.indexOf(l)<0&&r.setAttribute(l,e.getAttribute(l))}let o=r.attributes;for(let a=o.length-1;a>=0;a--){let l=o[a].name;s?l.startsWith("data-")&&!e.hasAttribute(l)&&r.removeAttribute(l):e.hasAttribute(l)||r.removeAttribute(l)}},mergeFocusedInput(r,e){r instanceof HTMLSelectElement||X.mergeAttrs(r,e,{exclude:["value"]}),e.readOnly?r.setAttribute("readonly",!0):r.removeAttribute("readonly")},hasSelectionRange(r){return r.setSelectionRange&&(r.type==="text"||r.type==="textarea")},restoreFocus(r,e,t){if(!X.isTextualInput(r))return;let i=r.matches(":focus");r.readOnly&&r.blur(),i||r.focus(),this.hasSelectionRange(r)&&r.setSelectionRange(e,t)},isFormInput(r){return/^(?:input|select|textarea)$/i.test(r.tagName)&&r.type!=="button"},syncAttrsToProps(r){r instanceof HTMLInputElement&&Ge.indexOf(r.type.toLocaleLowerCase())>=0&&(r.checked=r.getAttribute("checked")!==null)},isTextualInput(r){return Vt.indexOf(r.type)>=0},isNowTriggerFormExternal(r,e){return r.getAttribute&&r.getAttribute(e)!==null},syncPendingRef(r,e,t){let i=r.getAttribute(R);if(i===null)return!0;let s=r.getAttribute(Q);return X.isFormInput(r)||r.getAttribute(t)!==null?(X.isUploadInput(r)&&X.mergeAttrs(r,e,{isIgnored:!0}),X.putPrivate(r,R,e),!1):(Be.forEach(n=>{r.classList.contains(n)&&e.classList.add(n)}),e.setAttribute(R,i),e.setAttribute(Q,s),!0)},cleanChildNodes(r,e){if(X.isPhxUpdate(r,e,["append","prepend"])){let t=[];r.childNodes.forEach(i=>{i.id||(i.nodeType===Node.TEXT_NODE&&i.nodeValue.trim()===""||T(`only HTML element tags with an id are allowed inside containers with phx-update.
removing illegal node: "${(i.outerHTML||i.nodeValue).trim()}"
-`),t.push(i))}),t.forEach(i=>i.remove())}},replaceRootContainer(r,e,t){let i=new Set(["id",M,se,ge,ee]);if(r.tagName.toLowerCase()===e.toLowerCase())return Array.from(r.attributes).filter(s=>!i.has(s.name.toLowerCase())).forEach(s=>r.removeAttribute(s.name)),Object.keys(t).filter(s=>!i.has(s.toLowerCase())).forEach(s=>r.setAttribute(s,t[s])),r;{let s=document.createElement(e);return Object.keys(t).forEach(n=>s.setAttribute(n,t[n])),i.forEach(n=>s.setAttribute(n,r.getAttribute(n))),s.innerHTML=r.innerHTML,r.replaceWith(s),s}},getSticky(r,e,t){let i=(X.private(r,"sticky")||[]).find(([s])=>e===s);if(i){let[s,n,o]=i;return o}else return typeof t=="function"?t():t},deleteSticky(r,e){this.updatePrivate(r,"sticky",[],t=>t.filter(([i,s])=>i!==e))},putSticky(r,e,t){let i=t(r);this.updatePrivate(r,"sticky",[],s=>{let n=s.findIndex(([o])=>e===o);return n>=0?s[n]=[e,t,i]:s.push([e,t,i]),s})},applyStickyOperations(r){let e=X.private(r,"sticky");!e||e.forEach(([t,i,s])=>this.putSticky(r,t,i))}},h=X;var ye=class{static isActive(e,t){let i=t._phxRef===void 0,n=e.getAttribute(xe).split(",").indexOf(w.genFileRef(t))>=0;return t.size>0&&(i||n)}static isPreflighted(e,t){return e.getAttribute(fe).split(",").indexOf(w.genFileRef(t))>=0&&this.isActive(e,t)}constructor(e,t,i){this.ref=w.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(pe,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,()=>{w.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(pe,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),w.clearFiles(this.fileEl)}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(pe,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(xe).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]||T(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:ri}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||T(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}};var bi=0,w=class{static genFileRef(e){let t=e._phxRef;return t!==void 0?t:(e._phxRef=(bi++).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 h.findUploadInputs(e).forEach(i=>{i.getAttribute(fe)!==i.getAttribute($t)&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(s=>{let n={path:e.name},o=e.getAttribute(J);i[o]=i[o]||[],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[o].push(n)}),i}static clearFiles(e){e.value=null,e.removeAttribute(J),h.putPrivate(e,"files",[])}static untrackFile(e,t){h.putPrivate(e,"files",h.private(e,"files").filter(i=>!Object.is(i,t)))}static trackFiles(e,t,i){if(e.getAttribute("multiple")!==null){let s=t.filter(n=>!this.activeFiles(e).find(o=>Object.is(o,n)));h.putPrivate(e,"files",this.activeFiles(e).concat(s)),e.value=null}else i&&i.files.length>0&&(e.files=i.files),h.putPrivate(e,"files",t)}static activeFileInputs(e){let t=h.findUploadInputs(e);return Array.from(t).filter(i=>i.files&&this.activeFiles(i).length>0)}static activeFiles(e){return(h.private(e,"files")||[]).filter(t=>ye.isActive(e,t))}static inputsAwaitingPreflight(e){let t=h.findUploadInputs(e);return Array.from(t).filter(i=>this.filesAwaitingPreflight(i).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(t=>!ye.isPreflighted(e,t))}constructor(e,t,i){this.view=t,this.onComplete=i,this._entries=Array.from(w.filesAwaitingPreflight(e)||[]).map(s=>new ye(e,s,t)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(e,t,i){this._entries=this._entries.map(n=>(n.zipPostFlight(e),n.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()}),n));let s=this._entries.reduce((n,o)=>{let{name:a,callback:l}=o.uploader(i.uploaders);return n[a]=n[a]||{callback:l,entries:[]},n[a].entries.push(o),n},{});for(let n in s){let{callback:o,entries:a}=s[n];o(a,t,e,i)}}};var Ei={focusMain(){let r=document.querySelector("main h1, main, h1");if(r){let e=r.tabIndex;r.tabIndex=-1,r.focus(),r.tabIndex=e}},anyOf(r,e){return e.find(t=>r instanceof t)},isFocusable(r,e){return r instanceof HTMLAnchorElement&&r.rel!=="ignore"||r instanceof HTMLAreaElement&&r.href!==void 0||!r.disabled&&this.anyOf(r,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||r instanceof HTMLIFrameElement||r.tabIndex>0||!e&&r.tabIndex===0&&r.getAttribute("tabindex")!==null&&r.getAttribute("aria-hidden")!=="true"},attemptFocus(r,e){if(this.isFocusable(r,e))try{r.focus()}catch(t){}return!!document.activeElement&&document.activeElement.isSameNode(r)},focusFirstInteractive(r){let e=r.firstElementChild;for(;e;){if(this.attemptFocus(e,!0)||this.focusFirstInteractive(e,!0))return!0;e=e.nextElementSibling}},focusFirst(r){let e=r.firstElementChild;for(;e;){if(this.attemptFocus(e)||this.focusFirst(e))return!0;e=e.nextElementSibling}},focusLast(r){let e=r.lastElementChild;for(;e;){if(this.attemptFocus(e)||this.focusLast(e))return!0;e=e.previousElementSibling}}},ne=Ei;var ni={LiveFileUpload:{activeRefs(){return this.el.getAttribute(xe)},preflightedRefs(){return this.el.getAttribute(fe)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let r=this.preflightedRefs();this.preflightedWas!==r&&(this.preflightedWas=r,r===""&&this.__view.cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(pe))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(J)),w.getEntryDataURL(this.inputEl,this.ref,r=>{this.url=r,this.el.src=r})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",()=>ne.focusLast(this.el)),this.focusEnd.addEventListener("focus",()=>ne.focusFirst(this.el)),this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&ne.focusFirst(this.el)}}},oi=()=>document.documentElement.scrollTop||document.body.scrollTop,xt=()=>window.innerHeight||document.documentElement.clientHeight,_i=r=>{let e=r.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.top<=xt()},Ai=r=>{let e=r.getBoundingClientRect();return e.right>=0&&e.left>=0&&e.bottom<=xt()},ai=r=>{let e=r.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.top<=xt()};ni.InfiniteScroll={mounted(){let r=oi(),e=!1,t=500,i=null,s=this.throttle(t,(a,l)=>{i=()=>!0,this.liveSocket.execJSHookPush(this.el,a,{id:l.id,_overran:!0},()=>{i=null})}),n=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"start"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{i=null,ai(l)||l.scrollIntoView({block:"start"})})}),o=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"end"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{i=null,ai(l)||l.scrollIntoView({block:"end"})})});this.onScroll=a=>{let l=oi();if(i)return r=l,i();let d=this.el.getBoundingClientRect(),u=this.el.getAttribute(this.liveSocket.binding("viewport-top")),f=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),g=this.el.lastElementChild,m=this.el.firstElementChild,p=lr;p&&u&&!e&&d.top>=0?(e=!0,s(u,m)):E&&e&&d.top<=0&&(e=!1),u&&p&&_i(m)?n(u,m):f&&E&&Ai(g)&&o(f,g),r=l},window.addEventListener("scroll",this.onScroll)},destroyed(){window.removeEventListener("scroll",this.onScroll)},throttle(r,e){let t=0,i;return(...s)=>{let n=Date.now(),o=r-(n-t);o<=0||o>r?(i&&(clearTimeout(i),i=null),t=n,e(...s)):i||(i=setTimeout(()=>{t=Date.now(),i=null,e(...s)},o))}}};var li=ni;var it=class{constructor(e,t,i){let s=new Set,n=new Set([...t.children].map(a=>a.id)),o=[];Array.from(e.children).forEach(a=>{if(a.id&&(s.add(a.id),n.has(a.id))){let l=a.previousElementSibling&&a.previousElementSibling.id;o.push({elementId:a.id,previousElementId:l})}}),this.containerId=t.id,this.updateType=i,this.elementsToModify=o,this.elementIdsToAdd=[...n].filter(a=>!s.has(a))}perform(){let e=h.byId(this.containerId);this.elementsToModify.forEach(t=>{t.previousElementId?K(document.getElementById(t.previousElementId),i=>{K(document.getElementById(t.elementId),s=>{s.previousElementSibling&&s.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",s)})}):K(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(t=>{K(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))})}};var hi=11;function Si(r,e){var t=e.attributes,i,s,n,o,a;if(!(e.nodeType===hi||r.nodeType===hi)){for(var l=t.length-1;l>=0;l--)i=t[l],s=i.name,n=i.namespaceURI,o=i.value,n?(s=i.localName||s,a=r.getAttributeNS(n,s),a!==o&&(i.prefix==="xmlns"&&(s=i.name),r.setAttributeNS(n,s,o))):(a=r.getAttribute(s),a!==o&&r.setAttribute(s,o));for(var d=r.attributes,u=d.length-1;u>=0;u--)i=d[u],s=i.name,n=i.namespaceURI,n?(s=i.localName||s,e.hasAttributeNS(n,s)||r.removeAttributeNS(n,s)):e.hasAttribute(s)||r.removeAttribute(s)}}var rt,wi="http://www.w3.org/1999/xhtml",O=typeof document=="undefined"?void 0:document,yi=!!O&&"content"in O.createElement("template"),Pi=!!O&&O.createRange&&"createContextualFragment"in O.createRange();function xi(r){var e=O.createElement("template");return e.innerHTML=r,e.content.childNodes[0]}function Ti(r){rt||(rt=O.createRange(),rt.selectNode(O.body));var e=rt.createContextualFragment(r);return e.childNodes[0]}function ki(r){var e=O.createElement("body");return e.innerHTML=r,e.childNodes[0]}function Ci(r){return r=r.trim(),yi?xi(r):Pi?Ti(r):ki(r)}function st(r,e){var t=r.nodeName,i=e.nodeName,s,n;return t===i?!0:(s=t.charCodeAt(0),n=i.charCodeAt(0),s<=90&&n>=97?t===i.toUpperCase():n<=90&&s>=97?i===t.toUpperCase():!1)}function Ii(r,e){return!e||e===wi?O.createElement(r):O.createElementNS(e,r)}function Ri(r,e){for(var t=r.firstChild;t;){var i=t.nextSibling;e.appendChild(t),t=i}return e}function Tt(r,e,t){r[t]!==e[t]&&(r[t]=e[t],r[t]?r.setAttribute(t,""):r.removeAttribute(t))}var di={OPTION:function(r,e){var t=r.parentNode;if(t){var i=t.nodeName.toUpperCase();i==="OPTGROUP"&&(t=t.parentNode,i=t&&t.nodeName.toUpperCase()),i==="SELECT"&&!t.hasAttribute("multiple")&&(r.hasAttribute("selected")&&!e.selected&&(r.setAttribute("selected","selected"),r.removeAttribute("selected")),t.selectedIndex=-1)}Tt(r,e,"selected")},INPUT:function(r,e){Tt(r,e,"checked"),Tt(r,e,"disabled"),r.value!==e.value&&(r.value=e.value),e.hasAttribute("value")||r.removeAttribute("value")},TEXTAREA:function(r,e){var t=e.value;r.value!==t&&(r.value=t);var i=r.firstChild;if(i){var s=i.nodeValue;if(s==t||!t&&s==r.placeholder)return;i.nodeValue=t}},SELECT:function(r,e){if(!e.hasAttribute("multiple")){for(var t=-1,i=0,s=r.firstChild,n,o;s;)if(o=s.nodeName&&s.nodeName.toUpperCase(),o==="OPTGROUP")n=s,s=n.firstChild;else{if(o==="OPTION"){if(s.hasAttribute("selected")){t=i;break}i++}s=s.nextSibling,!s&&n&&(s=n.nextSibling,n=null)}r.selectedIndex=t}}},Ne=1,ci=11,ui=3,fi=8;function oe(){}function Li(r){if(r)return r.getAttribute&&r.getAttribute("id")||r.id}function Di(r){return function(t,i,s){if(s||(s={}),typeof i=="string")if(t.nodeName==="#document"||t.nodeName==="HTML"||t.nodeName==="BODY"){var n=i;i=O.createElement("html"),i.innerHTML=n}else i=Ci(i);else i.nodeType===ci&&(i=i.firstElementChild);var o=s.getNodeKey||Li,a=s.onBeforeNodeAdded||oe,l=s.onNodeAdded||oe,d=s.onBeforeElUpdated||oe,u=s.onElUpdated||oe,f=s.onBeforeNodeDiscarded||oe,g=s.onNodeDiscarded||oe,m=s.onBeforeElChildrenUpdated||oe,p=s.skipFromChildren||oe,E=s.addChild||function(b,v){return b.appendChild(v)},C=s.childrenOnly===!0,I=Object.create(null),N=[];function L(b){N.push(b)}function z(b,v){if(b.nodeType===Ne)for(var P=b.firstChild;P;){var A=void 0;v&&(A=o(P))?L(A):(g(P),P.firstChild&&z(P,v)),P=P.nextSibling}}function c(b,v,P){f(b)!==!1&&(v&&v.removeChild(b),g(b),z(b,P))}function _(b){if(b.nodeType===Ne||b.nodeType===ci)for(var v=b.firstChild;v;){var P=o(v);P&&(I[P]=v),_(v),v=v.nextSibling}}_(t);function Y(b){l(b);for(var v=b.firstChild;v;){var P=v.nextSibling,A=o(v);if(A){var S=I[A];S&&st(v,S)?(v.parentNode.replaceChild(S,v),x(S,v)):Y(v)}else Y(v);v=P}}function $(b,v,P){for(;v;){var A=v.nextSibling;(P=o(v))?L(P):c(v,b,!0),v=A}}function x(b,v,P){var A=o(v);A&&delete I[A],!(!P&&(d(b,v)===!1||(r(b,v),u(b),m(b,v)===!1)))&&(b.nodeName!=="TEXTAREA"?F(b,v):di.TEXTAREA(b,v))}function F(b,v){var P=p(b),A=v.firstChild,S=b.firstChild,ce,te,ue,Me,ie;e:for(;A;){for(Me=A.nextSibling,ce=o(A);!P&&S;){if(ue=S.nextSibling,A.isSameNode&&A.isSameNode(S)){A=Me,S=ue;continue e}te=o(S);var Ue=S.nodeType,re=void 0;if(Ue===A.nodeType&&(Ue===Ne?(ce?ce!==te&&((ie=I[ce])?ue===ie?re=!1:(b.insertBefore(ie,S),te?L(te):c(S,b,!0),S=ie):re=!1):te&&(re=!1),re=re!==!1&&st(S,A),re&&x(S,A)):(Ue===ui||Ue==fi)&&(re=!0,S.nodeValue!==A.nodeValue&&(S.nodeValue=A.nodeValue))),re){A=Me,S=ue;continue e}te?L(te):c(S,b,!0),S=ue}if(ce&&(ie=I[ce])&&st(ie,A))P||E(b,ie),x(ie,A);else{var dt=a(A);dt!==!1&&(dt&&(A=dt),A.actualize&&(A=A.actualize(b.ownerDocument||O)),E(b,A),Y(A))}A=Me,S=ue}$(b,S,te);var It=di[b.nodeName];It&&It(b,v)}var y=t,B=y.nodeType,Ct=i.nodeType;if(!C){if(B===Ne)Ct===Ne?st(t,i)||(g(t),y=Ri(t,Ii(i.nodeName,i.namespaceURI))):y=i;else if(B===ui||B===fi){if(Ct===B)return y.nodeValue!==i.nodeValue&&(y.nodeValue=i.nodeValue),y;y=i}}if(y===i)g(t);else{if(i.isSameNode&&i.isSameNode(y))return;if(x(y,i,C),N)for(var lt=0,mi=N.length;lt{if(i&&i.isSameNode(s)&&h.isFormInput(s))return h.mergeFocusedInput(s,n),!1}})}constructor(e,t,i,s,n,o){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=s,this.streams=n,this.streamInserts={},this.targetCID=o,this.cidPatch=q(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(e,t){this.callbacks[`before${e}`].push(t)}after(e,t){this.callbacks[`after${e}`].push(t)}trackBefore(e,...t){this.callbacks[`before${e}`].forEach(i=>i(...t))}trackAfter(e,...t){this.callbacks[`after${e}`].forEach(i=>i(...t))}markPrunableContentForRemoval(){let e=this.liveSocket.binding(Ee);h.all(this.container,`[${e}=${Ye}]`,t=>t.innerHTML=""),h.all(this.container,`[${e}=append] > *, [${e}=prepend] > *`,t=>{t.setAttribute(ft,"")})}perform(){let{view:e,liveSocket:t,container:i,html:s}=this,n=this.isCIDPatch()?this.targetCIDContainer(s):i;if(this.isCIDPatch()&&!n)return;let o=t.getActiveElement(),{selectionStart:a,selectionEnd:l}=o&&h.hasSelectionRange(o)?o:{},d=t.binding(Ee),u=t.binding(le),f=t.binding(Re),g=t.binding(qe),m=t.binding(Ke),p=t.binding(Bt),E=[],C=[],I=[],N=[],L=null,z=t.time("premorph container prep",()=>this.buildDiffHTML(i,s,d,n));return this.trackBefore("added",i),this.trackBefore("updated",i,i),t.time("morphdom",()=>{this.streams.forEach(([c,_,Y,$])=>{Object.entries(_).forEach(([x,[F,y]])=>{this.streamInserts[x]={ref:c,streamAt:F,limit:y}}),$!==void 0&&h.all(i,`[${_e}="${c}"]`,x=>{_[x.id]||this.removeStreamChildElement(x)}),Y.forEach(x=>{let F=i.querySelector(`[id="${x}"]`);F&&this.removeStreamChildElement(F)})}),kt(n,z,{childrenOnly:n.getAttribute(k)===null,getNodeKey:c=>h.isPhxDestroyed(c)?null:c.id,skipFromChildren:c=>c.getAttribute(d)===Ye,addChild:(c,_)=>{let{ref:Y,streamAt:$,limit:x}=this.getStreamInsert(_);if(Y===void 0)return c.appendChild(_);if(h.putSticky(_,_e,B=>B.setAttribute(_e,Y)),$===0)c.insertAdjacentElement("afterbegin",_);else if($===-1)c.appendChild(_);else if($>0){let B=Array.from(c.children)[$];c.insertBefore(_,B)}let F=x!==null&&Array.from(c.children),y=[];x&&x<0&&F.length>x*-1?y=F.slice(0,F.length+x):x&&x>=0&&F.length>x&&(y=F.slice(x)),y.forEach(B=>{this.streamInserts[B.id]||this.removeStreamChildElement(B)})},onBeforeNodeAdded:c=>(h.maybeAddPrivateHooks(c,g,m),this.trackBefore("added",c),c),onNodeAdded:c=>{c.getAttribute&&this.maybeReOrderStream(c),c instanceof HTMLImageElement&&c.srcset?c.srcset=c.srcset:c instanceof HTMLVideoElement&&c.autoplay&&c.play(),h.isNowTriggerFormExternal(c,p)&&(L=c),c.getAttribute&&c.getAttribute("name")&&h.isFormInput(c)&&C.push(c),(h.isPhxChild(c)&&e.ownsElement(c)||h.isPhxSticky(c)&&e.ownsElement(c.parentNode))&&this.trackAfter("phxChildAdded",c),E.push(c)},onNodeDiscarded:c=>this.onNodeDiscarded(c),onBeforeNodeDiscarded:c=>c.getAttribute&&c.getAttribute(ft)!==null?!0:!(c.parentElement!==null&&c.id&&h.isPhxUpdate(c.parentElement,d,[Ye,"append","prepend"])||this.maybePendingRemove(c)||this.skipCIDSibling(c)),onElUpdated:c=>{h.isNowTriggerFormExternal(c,p)&&(L=c),I.push(c),this.maybeReOrderStream(c)},onBeforeElUpdated:(c,_)=>{if(h.maybeAddPrivateHooks(_,g,m),h.cleanChildNodes(_,d),this.skipCIDSibling(_)||h.isPhxSticky(c))return!1;if(h.isIgnored(c,d)||c.form&&c.form.isSameNode(L))return this.trackBefore("updated",c,_),h.mergeAttrs(c,_,{isIgnored:!0}),I.push(c),h.applyStickyOperations(c),!1;if(c.type==="number"&&c.validity&&c.validity.badInput)return!1;if(!h.syncPendingRef(c,_,f))return h.isUploadInput(c)&&(this.trackBefore("updated",c,_),I.push(c)),h.applyStickyOperations(c),!1;if(h.isPhxChild(_)){let $=c.getAttribute(M);return h.mergeAttrs(c,_,{exclude:[se]}),$!==""&&c.setAttribute(M,$),c.setAttribute(ee,this.rootID),h.applyStickyOperations(c),!1}return h.copyPrivates(_,c),o&&c.isSameNode(o)&&h.isFormInput(c)&&c.type!=="hidden"?(this.trackBefore("updated",c,_),h.mergeFocusedInput(c,_),h.syncAttrsToProps(c),I.push(c),h.applyStickyOperations(c),C.push(c),!1):(h.isPhxUpdate(_,d,["append","prepend"])&&N.push(new it(c,_,_.getAttribute(d))),h.syncAttrsToProps(_),h.applyStickyOperations(_),_.getAttribute("name")&&h.isFormInput(_)&&C.push(_),this.trackBefore("updated",c,_),!0)}})}),t.isDebugEnabled()&&ei(),N.length>0&&t.time("post-morph append/prepend restoration",()=>{N.forEach(c=>c.perform())}),C.forEach(c=>{h.maybeHideFeedback(n,c,u)}),t.silenceEvents(()=>h.restoreFocus(o,a,l)),h.dispatchEvent(document,"phx:update"),E.forEach(c=>this.trackAfter("added",c)),I.forEach(c=>this.trackAfter("updated",c)),this.transitionPendingRemoves(),L&&(t.unload(),L.submit()),!0}onNodeDiscarded(e){(h.isPhxChild(e)||h.isPhxSticky(e))&&this.liveSocket.destroyViewByEl(e),this.trackAfter("discarded",e)}maybePendingRemove(e){return e.getAttribute&&e.getAttribute(this.phxRemove)!==null?(this.pendingRemoves.push(e),!0):!1}removeStreamChildElement(e){this.maybePendingRemove(e)||(e.remove(),this.onNodeDiscarded(e))}getStreamInsert(e){return(e.id?this.streamInserts[e.id]:{})||{}}maybeReOrderStream(e){let{ref:t,streamAt:i,limit:s}=this.getStreamInsert(e);if(i!==void 0){if(h.putSticky(e,_e,n=>n.setAttribute(_e,t)),i===0)e.parentElement.insertBefore(e,e.parentElement.firstElementChild);else if(i>0){let n=Array.from(e.parentElement.children),o=n.indexOf(e);if(i>=n.length-1)e.parentElement.appendChild(e);else{let a=n[i];o>i?e.parentElement.insertBefore(e,a):e.parentElement.insertBefore(e,a.nextElementSibling)}}}}transitionPendingRemoves(){let{pendingRemoves:e,liveSocket:t}=this;e.length>0&&(t.transitionRemoves(e),t.requestDOMUpdate(()=>{e.forEach(i=>{let s=h.firstPhxChild(i);s&&t.destroyViewByEl(s),i.remove()}),this.trackAfter("transitionsDiscarded",e)}))}isCIDPatch(){return this.cidPatch}skipCIDSibling(e){return e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(Te)!==null}targetCIDContainer(e){if(!this.isCIDPatch())return;let[t,...i]=h.findComponentNodeList(this.container,this.targetCID);return i.length===0&&h.childNodeLength(e)===1?t:t&&t.parentNode}buildDiffHTML(e,t,i,s){let n=this.isCIDPatch(),o=n&&s.getAttribute(k)===this.targetCID.toString();if(!n||o)return t;{let a=null,l=document.createElement("template");a=h.cloneNode(s);let[d,...u]=h.findComponentNodeList(a,this.targetCID);return l.innerHTML=t,u.forEach(f=>f.remove()),Array.from(a.childNodes).forEach(f=>{f.id&&f.nodeType===Node.ELEMENT_NODE&&f.getAttribute(k)!==this.targetCID.toString()&&(f.setAttribute(Te,""),f.innerHTML="")}),Array.from(l.content.childNodes).forEach(f=>a.insertBefore(f,d)),d.remove(),a.outerHTML}}indexOf(e,t){return Array.from(e.children).indexOf(t)}};var Fe=class{static extract(e){let{[St]:t,[At]:i,[wt]:s}=e;return delete e[St],delete e[At],delete e[wt],{diff:e,title:s,reply:t||null,events:i||[]}}constructor(e,t){this.viewId=e,this.rendered={},this.mergeDiff(t)}parentViewId(){return this.viewId}toString(e){let[t,i]=this.recursiveToString(this.rendered,this.rendered[D],e);return[t,i]}recursiveToString(e,t=e[D],i){i=i?new Set(i):null;let s={buffer:"",components:t,onlyCids:i,streams:new Set};return this.toOutputBuffer(e,null,s),[s.buffer,s.streams]}componentCIDs(e){return Object.keys(e[D]||{}).map(t=>parseInt(t))}isComponentOnlyDiff(e){return e[D]?Object.keys(e).length===1:!1}getComponent(e,t){return e[D][t]}mergeDiff(e){let t=e[D],i={};if(delete e[D],this.rendered=this.mutableMerge(this.rendered,e),this.rendered[D]=this.rendered[D]||{},t){let s=this.rendered[D];for(let n in t)t[n]=this.cachedFindComponent(n,t[n],s,t,i);for(let n in t)s[n]=t[n];e[D]=t}}cachedFindComponent(e,t,i,s,n){if(n[e])return n[e];{let o,a,l=t[W];if(q(l)){let d;l>0?d=this.cachedFindComponent(l,s[l],i,s,n):d=i[-l],a=d[W],o=this.cloneMerge(d,t),o[W]=a}else o=t[W]!==void 0?t:this.cloneMerge(i[e]||{},t);return n[e]=o,o}}mutableMerge(e,t){return t[W]!==void 0?t:(this.doMutableMerge(e,t),e)}doMutableMerge(e,t){for(let i in t){let s=t[i],n=e[i];we(s)&&s[W]===void 0&&we(n)?this.doMutableMerge(n,s):e[i]=s}}cloneMerge(e,t){let i=V(V({},e),t);for(let s in i){let n=t[s],o=e[s];we(n)&&n[W]===void 0&&we(o)&&(i[s]=this.cloneMerge(o,n))}return i}componentToString(e){let[t,i]=this.recursiveCIDToString(this.rendered[D],e);return[t,i]}pruneCIDs(e){e.forEach(t=>delete this.rendered[D][t])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[W]}templateStatic(e,t){return typeof e=="number"?t[e]:e}toOutputBuffer(e,t,i){if(e[He])return this.comprehensionToBuffer(e,t,i);let{[W]:s}=e;s=this.templateStatic(s,t),i.buffer+=s[0];for(let n=1;n0||d.length>0||u)&&(delete e[yt],e[He]=[],i.streams.add(o))}dynamicToBuffer(e,t,i){if(typeof e=="number"){let[s,n]=this.recursiveCIDToString(i.components,e,i.onlyCids);i.buffer+=s,i.streams=new Set([...i.streams,...n])}else we(e)?this.toOutputBuffer(e,t,i):i.buffer+=e}recursiveCIDToString(e,t,i){let s=e[t]||T(`no component for CID ${t}`,e),n=document.createElement("template"),[o,a]=this.recursiveToString(s,e,i);n.innerHTML=o;let l=n.content,d=i&&!i.has(t),[u,f]=Array.from(l.childNodes).reduce(([g,m],p,E)=>p.nodeType===Node.ELEMENT_NODE?p.getAttribute(k)?[g,!0]:(p.setAttribute(k,t),p.id||(p.id=`${this.parentViewId()}-${t}-${E}`),d&&(p.setAttribute(Te,""),p.innerHTML=""),[!0,m]):p.nodeValue.trim()!==""?(T(`only HTML element tags are allowed at the root of components.
+`),t.push(i))}),t.forEach(i=>i.remove())}},replaceRootContainer(r,e,t){let i=new Set(["id",M,se,ge,ee]);if(r.tagName.toLowerCase()===e.toLowerCase())return Array.from(r.attributes).filter(s=>!i.has(s.name.toLowerCase())).forEach(s=>r.removeAttribute(s.name)),Object.keys(t).filter(s=>!i.has(s.toLowerCase())).forEach(s=>r.setAttribute(s,t[s])),r;{let s=document.createElement(e);return Object.keys(t).forEach(n=>s.setAttribute(n,t[n])),i.forEach(n=>s.setAttribute(n,r.getAttribute(n))),s.innerHTML=r.innerHTML,r.replaceWith(s),s}},getSticky(r,e,t){let i=(X.private(r,"sticky")||[]).find(([s])=>e===s);if(i){let[s,n,o]=i;return o}else return typeof t=="function"?t():t},deleteSticky(r,e){this.updatePrivate(r,"sticky",[],t=>t.filter(([i,s])=>i!==e))},putSticky(r,e,t){let i=t(r);this.updatePrivate(r,"sticky",[],s=>{let n=s.findIndex(([o])=>e===o);return n>=0?s[n]=[e,t,i]:s.push([e,t,i]),s})},applyStickyOperations(r){let e=X.private(r,"sticky");!e||e.forEach(([t,i,s])=>this.putSticky(r,t,i))}},h=X;var ye=class{static isActive(e,t){let i=t._phxRef===void 0,n=e.getAttribute(xe).split(",").indexOf(w.genFileRef(t))>=0;return t.size>0&&(i||n)}static isPreflighted(e,t){return e.getAttribute(fe).split(",").indexOf(w.genFileRef(t))>=0&&this.isActive(e,t)}constructor(e,t,i){this.ref=w.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(pe,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,()=>{w.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(pe,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),h.isAutoUpload(this.fileEl)||w.clearFiles(this.fileEl)}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(pe,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(xe).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]||T(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:ri}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||T(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}};var bi=0,w=class{static genFileRef(e){let t=e._phxRef;return t!==void 0?t:(e._phxRef=(bi++).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 h.findUploadInputs(e).forEach(i=>{i.getAttribute(fe)!==i.getAttribute($t)&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(s=>{let n={path:e.name},o=e.getAttribute(J);i[o]=i[o]||[],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[o].push(n)}),i}static clearFiles(e){e.value=null,e.removeAttribute(J),h.putPrivate(e,"files",[])}static untrackFile(e,t){h.putPrivate(e,"files",h.private(e,"files").filter(i=>!Object.is(i,t)))}static trackFiles(e,t,i){if(e.getAttribute("multiple")!==null){let s=t.filter(n=>!this.activeFiles(e).find(o=>Object.is(o,n)));h.putPrivate(e,"files",this.activeFiles(e).concat(s)),e.value=null}else i&&i.files.length>0&&(e.files=i.files),h.putPrivate(e,"files",t)}static activeFileInputs(e){let t=h.findUploadInputs(e);return Array.from(t).filter(i=>i.files&&this.activeFiles(i).length>0)}static activeFiles(e){return(h.private(e,"files")||[]).filter(t=>ye.isActive(e,t))}static inputsAwaitingPreflight(e){let t=h.findUploadInputs(e);return Array.from(t).filter(i=>this.filesAwaitingPreflight(i).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(t=>!ye.isPreflighted(e,t))}constructor(e,t,i){this.view=t,this.onComplete=i,this._entries=Array.from(w.filesAwaitingPreflight(e)||[]).map(s=>new ye(e,s,t)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(e,t,i){this._entries=this._entries.map(n=>(n.zipPostFlight(e),n.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()}),n));let s=this._entries.reduce((n,o)=>{let{name:a,callback:l}=o.uploader(i.uploaders);return n[a]=n[a]||{callback:l,entries:[]},n[a].entries.push(o),n},{});for(let n in s){let{callback:o,entries:a}=s[n];o(a,t,e,i)}}};var Ei={focusMain(){let r=document.querySelector("main h1, main, h1");if(r){let e=r.tabIndex;r.tabIndex=-1,r.focus(),r.tabIndex=e}},anyOf(r,e){return e.find(t=>r instanceof t)},isFocusable(r,e){return r instanceof HTMLAnchorElement&&r.rel!=="ignore"||r instanceof HTMLAreaElement&&r.href!==void 0||!r.disabled&&this.anyOf(r,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||r instanceof HTMLIFrameElement||r.tabIndex>0||!e&&r.tabIndex===0&&r.getAttribute("tabindex")!==null&&r.getAttribute("aria-hidden")!=="true"},attemptFocus(r,e){if(this.isFocusable(r,e))try{r.focus()}catch(t){}return!!document.activeElement&&document.activeElement.isSameNode(r)},focusFirstInteractive(r){let e=r.firstElementChild;for(;e;){if(this.attemptFocus(e,!0)||this.focusFirstInteractive(e,!0))return!0;e=e.nextElementSibling}},focusFirst(r){let e=r.firstElementChild;for(;e;){if(this.attemptFocus(e)||this.focusFirst(e))return!0;e=e.nextElementSibling}},focusLast(r){let e=r.lastElementChild;for(;e;){if(this.attemptFocus(e)||this.focusLast(e))return!0;e=e.previousElementSibling}}},ne=Ei;var ni={LiveFileUpload:{activeRefs(){return this.el.getAttribute(xe)},preflightedRefs(){return this.el.getAttribute(fe)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let r=this.preflightedRefs();this.preflightedWas!==r&&(this.preflightedWas=r,r===""&&this.__view.cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(pe))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(J)),w.getEntryDataURL(this.inputEl,this.ref,r=>{this.url=r,this.el.src=r})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",()=>ne.focusLast(this.el)),this.focusEnd.addEventListener("focus",()=>ne.focusFirst(this.el)),this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&ne.focusFirst(this.el)}}},oi=()=>document.documentElement.scrollTop||document.body.scrollTop,xt=()=>window.innerHeight||document.documentElement.clientHeight,_i=r=>{let e=r.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.top<=xt()},Ai=r=>{let e=r.getBoundingClientRect();return e.right>=0&&e.left>=0&&e.bottom<=xt()},ai=r=>{let e=r.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.top<=xt()};ni.InfiniteScroll={mounted(){let r=oi(),e=!1,t=500,i=null,s=this.throttle(t,(a,l)=>{i=()=>!0,this.liveSocket.execJSHookPush(this.el,a,{id:l.id,_overran:!0},()=>{i=null})}),n=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"start"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{i=null,ai(l)||l.scrollIntoView({block:"start"})})}),o=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"end"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{i=null,ai(l)||l.scrollIntoView({block:"end"})})});this.onScroll=a=>{let l=oi();if(i)return r=l,i();let d=this.el.getBoundingClientRect(),u=this.el.getAttribute(this.liveSocket.binding("viewport-top")),f=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),g=this.el.lastElementChild,m=this.el.firstElementChild,p=lr;p&&u&&!e&&d.top>=0?(e=!0,s(u,m)):E&&e&&d.top<=0&&(e=!1),u&&p&&_i(m)?n(u,m):f&&E&&Ai(g)&&o(f,g),r=l},window.addEventListener("scroll",this.onScroll)},destroyed(){window.removeEventListener("scroll",this.onScroll)},throttle(r,e){let t=0,i;return(...s)=>{let n=Date.now(),o=r-(n-t);o<=0||o>r?(i&&(clearTimeout(i),i=null),t=n,e(...s)):i||(i=setTimeout(()=>{t=Date.now(),i=null,e(...s)},o))}}};var li=ni;var it=class{constructor(e,t,i){let s=new Set,n=new Set([...t.children].map(a=>a.id)),o=[];Array.from(e.children).forEach(a=>{if(a.id&&(s.add(a.id),n.has(a.id))){let l=a.previousElementSibling&&a.previousElementSibling.id;o.push({elementId:a.id,previousElementId:l})}}),this.containerId=t.id,this.updateType=i,this.elementsToModify=o,this.elementIdsToAdd=[...n].filter(a=>!s.has(a))}perform(){let e=h.byId(this.containerId);this.elementsToModify.forEach(t=>{t.previousElementId?K(document.getElementById(t.previousElementId),i=>{K(document.getElementById(t.elementId),s=>{s.previousElementSibling&&s.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",s)})}):K(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(t=>{K(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))})}};var hi=11;function Si(r,e){var t=e.attributes,i,s,n,o,a;if(!(e.nodeType===hi||r.nodeType===hi)){for(var l=t.length-1;l>=0;l--)i=t[l],s=i.name,n=i.namespaceURI,o=i.value,n?(s=i.localName||s,a=r.getAttributeNS(n,s),a!==o&&(i.prefix==="xmlns"&&(s=i.name),r.setAttributeNS(n,s,o))):(a=r.getAttribute(s),a!==o&&r.setAttribute(s,o));for(var d=r.attributes,u=d.length-1;u>=0;u--)i=d[u],s=i.name,n=i.namespaceURI,n?(s=i.localName||s,e.hasAttributeNS(n,s)||r.removeAttributeNS(n,s)):e.hasAttribute(s)||r.removeAttribute(s)}}var rt,wi="http://www.w3.org/1999/xhtml",O=typeof document=="undefined"?void 0:document,yi=!!O&&"content"in O.createElement("template"),Pi=!!O&&O.createRange&&"createContextualFragment"in O.createRange();function xi(r){var e=O.createElement("template");return e.innerHTML=r,e.content.childNodes[0]}function Ti(r){rt||(rt=O.createRange(),rt.selectNode(O.body));var e=rt.createContextualFragment(r);return e.childNodes[0]}function ki(r){var e=O.createElement("body");return e.innerHTML=r,e.childNodes[0]}function Ci(r){return r=r.trim(),yi?xi(r):Pi?Ti(r):ki(r)}function st(r,e){var t=r.nodeName,i=e.nodeName,s,n;return t===i?!0:(s=t.charCodeAt(0),n=i.charCodeAt(0),s<=90&&n>=97?t===i.toUpperCase():n<=90&&s>=97?i===t.toUpperCase():!1)}function Ii(r,e){return!e||e===wi?O.createElement(r):O.createElementNS(e,r)}function Ri(r,e){for(var t=r.firstChild;t;){var i=t.nextSibling;e.appendChild(t),t=i}return e}function Tt(r,e,t){r[t]!==e[t]&&(r[t]=e[t],r[t]?r.setAttribute(t,""):r.removeAttribute(t))}var di={OPTION:function(r,e){var t=r.parentNode;if(t){var i=t.nodeName.toUpperCase();i==="OPTGROUP"&&(t=t.parentNode,i=t&&t.nodeName.toUpperCase()),i==="SELECT"&&!t.hasAttribute("multiple")&&(r.hasAttribute("selected")&&!e.selected&&(r.setAttribute("selected","selected"),r.removeAttribute("selected")),t.selectedIndex=-1)}Tt(r,e,"selected")},INPUT:function(r,e){Tt(r,e,"checked"),Tt(r,e,"disabled"),r.value!==e.value&&(r.value=e.value),e.hasAttribute("value")||r.removeAttribute("value")},TEXTAREA:function(r,e){var t=e.value;r.value!==t&&(r.value=t);var i=r.firstChild;if(i){var s=i.nodeValue;if(s==t||!t&&s==r.placeholder)return;i.nodeValue=t}},SELECT:function(r,e){if(!e.hasAttribute("multiple")){for(var t=-1,i=0,s=r.firstChild,n,o;s;)if(o=s.nodeName&&s.nodeName.toUpperCase(),o==="OPTGROUP")n=s,s=n.firstChild;else{if(o==="OPTION"){if(s.hasAttribute("selected")){t=i;break}i++}s=s.nextSibling,!s&&n&&(s=n.nextSibling,n=null)}r.selectedIndex=t}}},Ne=1,ci=11,ui=3,fi=8;function oe(){}function Li(r){if(r)return r.getAttribute&&r.getAttribute("id")||r.id}function Di(r){return function(t,i,s){if(s||(s={}),typeof i=="string")if(t.nodeName==="#document"||t.nodeName==="HTML"||t.nodeName==="BODY"){var n=i;i=O.createElement("html"),i.innerHTML=n}else i=Ci(i);else i.nodeType===ci&&(i=i.firstElementChild);var o=s.getNodeKey||Li,a=s.onBeforeNodeAdded||oe,l=s.onNodeAdded||oe,d=s.onBeforeElUpdated||oe,u=s.onElUpdated||oe,f=s.onBeforeNodeDiscarded||oe,g=s.onNodeDiscarded||oe,m=s.onBeforeElChildrenUpdated||oe,p=s.skipFromChildren||oe,E=s.addChild||function(b,v){return b.appendChild(v)},C=s.childrenOnly===!0,I=Object.create(null),N=[];function L(b){N.push(b)}function z(b,v){if(b.nodeType===Ne)for(var P=b.firstChild;P;){var A=void 0;v&&(A=o(P))?L(A):(g(P),P.firstChild&&z(P,v)),P=P.nextSibling}}function c(b,v,P){f(b)!==!1&&(v&&v.removeChild(b),g(b),z(b,P))}function _(b){if(b.nodeType===Ne||b.nodeType===ci)for(var v=b.firstChild;v;){var P=o(v);P&&(I[P]=v),_(v),v=v.nextSibling}}_(t);function Y(b){l(b);for(var v=b.firstChild;v;){var P=v.nextSibling,A=o(v);if(A){var S=I[A];S&&st(v,S)?(v.parentNode.replaceChild(S,v),x(S,v)):Y(v)}else Y(v);v=P}}function $(b,v,P){for(;v;){var A=v.nextSibling;(P=o(v))?L(P):c(v,b,!0),v=A}}function x(b,v,P){var A=o(v);A&&delete I[A],!(!P&&(d(b,v)===!1||(r(b,v),u(b),m(b,v)===!1)))&&(b.nodeName!=="TEXTAREA"?F(b,v):di.TEXTAREA(b,v))}function F(b,v){var P=p(b),A=v.firstChild,S=b.firstChild,ce,te,ue,Me,ie;e:for(;A;){for(Me=A.nextSibling,ce=o(A);!P&&S;){if(ue=S.nextSibling,A.isSameNode&&A.isSameNode(S)){A=Me,S=ue;continue e}te=o(S);var Ue=S.nodeType,re=void 0;if(Ue===A.nodeType&&(Ue===Ne?(ce?ce!==te&&((ie=I[ce])?ue===ie?re=!1:(b.insertBefore(ie,S),te?L(te):c(S,b,!0),S=ie):re=!1):te&&(re=!1),re=re!==!1&&st(S,A),re&&x(S,A)):(Ue===ui||Ue==fi)&&(re=!0,S.nodeValue!==A.nodeValue&&(S.nodeValue=A.nodeValue))),re){A=Me,S=ue;continue e}te?L(te):c(S,b,!0),S=ue}if(ce&&(ie=I[ce])&&st(ie,A))P||E(b,ie),x(ie,A);else{var dt=a(A);dt!==!1&&(dt&&(A=dt),A.actualize&&(A=A.actualize(b.ownerDocument||O)),E(b,A),Y(A))}A=Me,S=ue}$(b,S,te);var It=di[b.nodeName];It&&It(b,v)}var y=t,B=y.nodeType,Ct=i.nodeType;if(!C){if(B===Ne)Ct===Ne?st(t,i)||(g(t),y=Ri(t,Ii(i.nodeName,i.namespaceURI))):y=i;else if(B===ui||B===fi){if(Ct===B)return y.nodeValue!==i.nodeValue&&(y.nodeValue=i.nodeValue),y;y=i}}if(y===i)g(t);else{if(i.isSameNode&&i.isSameNode(y))return;if(x(y,i,C),N)for(var lt=0,mi=N.length;lt{if(i&&i.isSameNode(s)&&h.isFormInput(s))return h.mergeFocusedInput(s,n),!1}})}constructor(e,t,i,s,n,o){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=s,this.streams=n,this.streamInserts={},this.targetCID=o,this.cidPatch=q(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(e,t){this.callbacks[`before${e}`].push(t)}after(e,t){this.callbacks[`after${e}`].push(t)}trackBefore(e,...t){this.callbacks[`before${e}`].forEach(i=>i(...t))}trackAfter(e,...t){this.callbacks[`after${e}`].forEach(i=>i(...t))}markPrunableContentForRemoval(){let e=this.liveSocket.binding(Ee);h.all(this.container,`[${e}=${Ye}]`,t=>t.innerHTML=""),h.all(this.container,`[${e}=append] > *, [${e}=prepend] > *`,t=>{t.setAttribute(ft,"")})}perform(){let{view:e,liveSocket:t,container:i,html:s}=this,n=this.isCIDPatch()?this.targetCIDContainer(s):i;if(this.isCIDPatch()&&!n)return;let o=t.getActiveElement(),{selectionStart:a,selectionEnd:l}=o&&h.hasSelectionRange(o)?o:{},d=t.binding(Ee),u=t.binding(le),f=t.binding(Re),g=t.binding(qe),m=t.binding(Ke),p=t.binding(Bt),E=[],C=[],I=[],N=[],L=null,z=t.time("premorph container prep",()=>this.buildDiffHTML(i,s,d,n));return this.trackBefore("added",i),this.trackBefore("updated",i,i),t.time("morphdom",()=>{this.streams.forEach(([c,_,Y,$])=>{Object.entries(_).forEach(([x,[F,y]])=>{this.streamInserts[x]={ref:c,streamAt:F,limit:y}}),$!==void 0&&h.all(i,`[${_e}="${c}"]`,x=>{_[x.id]||this.removeStreamChildElement(x)}),Y.forEach(x=>{let F=i.querySelector(`[id="${x}"]`);F&&this.removeStreamChildElement(F)})}),kt(n,z,{childrenOnly:n.getAttribute(k)===null,getNodeKey:c=>h.isPhxDestroyed(c)?null:c.id,skipFromChildren:c=>c.getAttribute(d)===Ye,addChild:(c,_)=>{let{ref:Y,streamAt:$,limit:x}=this.getStreamInsert(_);if(Y===void 0)return c.appendChild(_);if(h.putSticky(_,_e,B=>B.setAttribute(_e,Y)),$===0)c.insertAdjacentElement("afterbegin",_);else if($===-1)c.appendChild(_);else if($>0){let B=Array.from(c.children)[$];c.insertBefore(_,B)}let F=x!==null&&Array.from(c.children),y=[];x&&x<0&&F.length>x*-1?y=F.slice(0,F.length+x):x&&x>=0&&F.length>x&&(y=F.slice(x)),y.forEach(B=>{this.streamInserts[B.id]||this.removeStreamChildElement(B)})},onBeforeNodeAdded:c=>(h.maybeAddPrivateHooks(c,g,m),this.trackBefore("added",c),c),onNodeAdded:c=>{c.getAttribute&&this.maybeReOrderStream(c),c instanceof HTMLImageElement&&c.srcset?c.srcset=c.srcset:c instanceof HTMLVideoElement&&c.autoplay&&c.play(),h.isNowTriggerFormExternal(c,p)&&(L=c),c.getAttribute&&c.getAttribute("name")&&h.isFormInput(c)&&C.push(c),(h.isPhxChild(c)&&e.ownsElement(c)||h.isPhxSticky(c)&&e.ownsElement(c.parentNode))&&this.trackAfter("phxChildAdded",c),E.push(c)},onNodeDiscarded:c=>this.onNodeDiscarded(c),onBeforeNodeDiscarded:c=>c.getAttribute&&c.getAttribute(ft)!==null?!0:!(c.parentElement!==null&&c.id&&h.isPhxUpdate(c.parentElement,d,[Ye,"append","prepend"])||this.maybePendingRemove(c)||this.skipCIDSibling(c)),onElUpdated:c=>{h.isNowTriggerFormExternal(c,p)&&(L=c),I.push(c),this.maybeReOrderStream(c)},onBeforeElUpdated:(c,_)=>{if(h.maybeAddPrivateHooks(_,g,m),h.cleanChildNodes(_,d),this.skipCIDSibling(_)||h.isPhxSticky(c))return!1;if(h.isIgnored(c,d)||c.form&&c.form.isSameNode(L))return this.trackBefore("updated",c,_),h.mergeAttrs(c,_,{isIgnored:!0}),I.push(c),h.applyStickyOperations(c),!1;if(c.type==="number"&&c.validity&&c.validity.badInput)return!1;if(!h.syncPendingRef(c,_,f))return h.isUploadInput(c)&&(this.trackBefore("updated",c,_),I.push(c)),h.applyStickyOperations(c),!1;if(h.isPhxChild(_)){let $=c.getAttribute(M);return h.mergeAttrs(c,_,{exclude:[se]}),$!==""&&c.setAttribute(M,$),c.setAttribute(ee,this.rootID),h.applyStickyOperations(c),!1}return h.copyPrivates(_,c),o&&c.isSameNode(o)&&h.isFormInput(c)&&c.type!=="hidden"?(this.trackBefore("updated",c,_),h.mergeFocusedInput(c,_),h.syncAttrsToProps(c),I.push(c),h.applyStickyOperations(c),C.push(c),!1):(h.isPhxUpdate(_,d,["append","prepend"])&&N.push(new it(c,_,_.getAttribute(d))),h.syncAttrsToProps(_),h.applyStickyOperations(_),_.getAttribute("name")&&h.isFormInput(_)&&C.push(_),this.trackBefore("updated",c,_),!0)}})}),t.isDebugEnabled()&&ei(),N.length>0&&t.time("post-morph append/prepend restoration",()=>{N.forEach(c=>c.perform())}),C.forEach(c=>{h.maybeHideFeedback(n,c,u)}),t.silenceEvents(()=>h.restoreFocus(o,a,l)),h.dispatchEvent(document,"phx:update"),E.forEach(c=>this.trackAfter("added",c)),I.forEach(c=>this.trackAfter("updated",c)),this.transitionPendingRemoves(),L&&(t.unload(),L.submit()),!0}onNodeDiscarded(e){(h.isPhxChild(e)||h.isPhxSticky(e))&&this.liveSocket.destroyViewByEl(e),this.trackAfter("discarded",e)}maybePendingRemove(e){return e.getAttribute&&e.getAttribute(this.phxRemove)!==null?(this.pendingRemoves.push(e),!0):!1}removeStreamChildElement(e){this.maybePendingRemove(e)||(e.remove(),this.onNodeDiscarded(e))}getStreamInsert(e){return(e.id?this.streamInserts[e.id]:{})||{}}maybeReOrderStream(e){let{ref:t,streamAt:i,limit:s}=this.getStreamInsert(e);if(i!==void 0){if(h.putSticky(e,_e,n=>n.setAttribute(_e,t)),i===0)e.parentElement.insertBefore(e,e.parentElement.firstElementChild);else if(i>0){let n=Array.from(e.parentElement.children),o=n.indexOf(e);if(i>=n.length-1)e.parentElement.appendChild(e);else{let a=n[i];o>i?e.parentElement.insertBefore(e,a):e.parentElement.insertBefore(e,a.nextElementSibling)}}}}transitionPendingRemoves(){let{pendingRemoves:e,liveSocket:t}=this;e.length>0&&(t.transitionRemoves(e),t.requestDOMUpdate(()=>{e.forEach(i=>{let s=h.firstPhxChild(i);s&&t.destroyViewByEl(s),i.remove()}),this.trackAfter("transitionsDiscarded",e)}))}isCIDPatch(){return this.cidPatch}skipCIDSibling(e){return e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(Te)!==null}targetCIDContainer(e){if(!this.isCIDPatch())return;let[t,...i]=h.findComponentNodeList(this.container,this.targetCID);return i.length===0&&h.childNodeLength(e)===1?t:t&&t.parentNode}buildDiffHTML(e,t,i,s){let n=this.isCIDPatch(),o=n&&s.getAttribute(k)===this.targetCID.toString();if(!n||o)return t;{let a=null,l=document.createElement("template");a=h.cloneNode(s);let[d,...u]=h.findComponentNodeList(a,this.targetCID);return l.innerHTML=t,u.forEach(f=>f.remove()),Array.from(a.childNodes).forEach(f=>{f.id&&f.nodeType===Node.ELEMENT_NODE&&f.getAttribute(k)!==this.targetCID.toString()&&(f.setAttribute(Te,""),f.innerHTML="")}),Array.from(l.content.childNodes).forEach(f=>a.insertBefore(f,d)),d.remove(),a.outerHTML}}indexOf(e,t){return Array.from(e.children).indexOf(t)}};var Fe=class{static extract(e){let{[St]:t,[At]:i,[wt]:s}=e;return delete e[St],delete e[At],delete e[wt],{diff:e,title:s,reply:t||null,events:i||[]}}constructor(e,t){this.viewId=e,this.rendered={},this.mergeDiff(t)}parentViewId(){return this.viewId}toString(e){let[t,i]=this.recursiveToString(this.rendered,this.rendered[D],e);return[t,i]}recursiveToString(e,t=e[D],i){i=i?new Set(i):null;let s={buffer:"",components:t,onlyCids:i,streams:new Set};return this.toOutputBuffer(e,null,s),[s.buffer,s.streams]}componentCIDs(e){return Object.keys(e[D]||{}).map(t=>parseInt(t))}isComponentOnlyDiff(e){return e[D]?Object.keys(e).length===1:!1}getComponent(e,t){return e[D][t]}mergeDiff(e){let t=e[D],i={};if(delete e[D],this.rendered=this.mutableMerge(this.rendered,e),this.rendered[D]=this.rendered[D]||{},t){let s=this.rendered[D];for(let n in t)t[n]=this.cachedFindComponent(n,t[n],s,t,i);for(let n in t)s[n]=t[n];e[D]=t}}cachedFindComponent(e,t,i,s,n){if(n[e])return n[e];{let o,a,l=t[W];if(q(l)){let d;l>0?d=this.cachedFindComponent(l,s[l],i,s,n):d=i[-l],a=d[W],o=this.cloneMerge(d,t),o[W]=a}else o=t[W]!==void 0?t:this.cloneMerge(i[e]||{},t);return n[e]=o,o}}mutableMerge(e,t){return t[W]!==void 0?t:(this.doMutableMerge(e,t),e)}doMutableMerge(e,t){for(let i in t){let s=t[i],n=e[i];we(s)&&s[W]===void 0&&we(n)?this.doMutableMerge(n,s):e[i]=s}}cloneMerge(e,t){let i=V(V({},e),t);for(let s in i){let n=t[s],o=e[s];we(n)&&n[W]===void 0&&we(o)&&(i[s]=this.cloneMerge(o,n))}return i}componentToString(e){let[t,i]=this.recursiveCIDToString(this.rendered[D],e);return[t,i]}pruneCIDs(e){e.forEach(t=>delete this.rendered[D][t])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[W]}templateStatic(e,t){return typeof e=="number"?t[e]:e}toOutputBuffer(e,t,i){if(e[He])return this.comprehensionToBuffer(e,t,i);let{[W]:s}=e;s=this.templateStatic(s,t),i.buffer+=s[0];for(let n=1;n0||d.length>0||u)&&(delete e[yt],e[He]=[],i.streams.add(o))}dynamicToBuffer(e,t,i){if(typeof e=="number"){let[s,n]=this.recursiveCIDToString(i.components,e,i.onlyCids);i.buffer+=s,i.streams=new Set([...i.streams,...n])}else we(e)?this.toOutputBuffer(e,t,i):i.buffer+=e}recursiveCIDToString(e,t,i){let s=e[t]||T(`no component for CID ${t}`,e),n=document.createElement("template"),[o,a]=this.recursiveToString(s,e,i);n.innerHTML=o;let l=n.content,d=i&&!i.has(t),[u,f]=Array.from(l.childNodes).reduce(([g,m],p,E)=>p.nodeType===Node.ELEMENT_NODE?p.getAttribute(k)?[g,!0]:(p.setAttribute(k,t),p.id||(p.id=`${this.parentViewId()}-${t}-${E}`),d&&(p.setAttribute(Te,""),p.innerHTML=""),[!0,m]):p.nodeValue.trim()!==""?(T(`only HTML element tags are allowed at the root of components.
got: "${p.nodeValue.trim()}"
within:
`,n.innerHTML.trim()),p.replaceWith(this.createSpan(p.nodeValue,t)),[!0,m]):(p.remove(),[g,m]),[!1,!1]);return!u&&!f?(T(`expected at least one HTML element tag inside a component, but the component is empty:
-`,n.innerHTML.trim()),[this.createSpan("",t).outerHTML,a]):!u&&f?(T("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,a]):[n.innerHTML,a]}createSpan(e,t){let i=document.createElement("span");return i.innerText=e,i.setAttribute(k,t),i}};var Hi=1,ae=class{static makeID(){return Hi++}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,o)=>n.pushHookEvent(this.el,o,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))}};var nt=null,Ni={exec(r,e,t,i,s){let[n,o]=s||[null,{callback:s&&s.callback}];(e.charAt(0)==="["?JSON.parse(e):[[n,o]]).forEach(([l,d])=>{l===n&&o.data&&(d.data=Object.assign(d.data||{},o.data),d.callback=d.callback||o.callback),this.filterToEls(i,d).forEach(u=>{this[`exec_${l}`](r,e,t,i,u,d)})})},isVisible(r){return!!(r.offsetWidth||r.offsetHeight||r.getClientRects().length>0)},exec_exec(r,e,t,i,s,[n,o]){(o?h.all(document,o):[i]).forEach(l=>{let d=l.getAttribute(n);if(!d)throw new Error(`expected ${n} to contain JS command on "${o}"`);t.liveSocket.execJS(l,d,r)})},exec_dispatch(r,e,t,i,s,{to:n,event:o,detail:a,bubbles:l}){a=a||{},a.dispatcher=i,h.dispatchEvent(s,o,{detail:a,bubbles:l})},exec_push(r,e,t,i,s,n){if(!t.isConnected())return;let{event:o,data:a,target:l,page_loading:d,loading:u,value:f,dispatcher:g,callback:m}=n,p={loading:u,value:f,target:l,page_loading:!!d},E=r==="change"&&g?g:i,C=l||E.getAttribute(t.binding("target"))||E;t.withinTargets(C,(I,N)=>{if(r==="change"){let{newCid:L,_target:z}=n;z=z||(h.isFormInput(i)?i.name:void 0),z&&(p._target=z),I.pushInput(i,N,L,o||e,p,m)}else if(r==="submit"){let{submitter:L}=n;I.submitForm(i,N,o||e,L,p,m)}else I.pushEvent(r,i,N,o||e,a,p,m)})},exec_navigate(r,e,t,i,s,{href:n,replace:o}){t.liveSocket.historyRedirect(n,o?"replace":"push")},exec_patch(r,e,t,i,s,{href:n,replace:o}){t.liveSocket.pushHistoryPatch(n,o?"replace":"push",i)},exec_focus(r,e,t,i,s){window.requestAnimationFrame(()=>ne.attemptFocus(s))},exec_focus_first(r,e,t,i,s){window.requestAnimationFrame(()=>ne.focusFirstInteractive(s)||ne.focusFirst(s))},exec_push_focus(r,e,t,i,s){window.requestAnimationFrame(()=>nt=s||i)},exec_pop_focus(r,e,t,i,s){window.requestAnimationFrame(()=>{nt&&nt.focus(),nt=null})},exec_add_class(r,e,t,i,s,{names:n,transition:o,time:a}){this.addOrRemoveClasses(s,n,[],o,a,t)},exec_remove_class(r,e,t,i,s,{names:n,transition:o,time:a}){this.addOrRemoveClasses(s,[],n,o,a,t)},exec_transition(r,e,t,i,s,{time:n,transition:o}){this.addOrRemoveClasses(s,[],[],o,n,t)},exec_toggle(r,e,t,i,s,{display:n,ins:o,outs:a,time:l}){this.toggle(r,t,s,n,o,a,l)},exec_show(r,e,t,i,s,{display:n,transition:o,time:a}){this.show(r,t,s,n,o,a)},exec_hide(r,e,t,i,s,{display:n,transition:o,time:a}){this.hide(r,t,s,n,o,a)},exec_set_attr(r,e,t,i,s,{attr:[n,o]}){this.setOrRemoveAttrs(s,[[n,o]],[])},exec_remove_attr(r,e,t,i,s,{attr:n}){this.setOrRemoveAttrs(s,[],[n])},show(r,e,t,i,s,n){this.isVisible(t)||this.toggle(r,e,t,i,s,null,n)},hide(r,e,t,i,s,n){this.isVisible(t)&&this.toggle(r,e,t,i,null,s,n)},toggle(r,e,t,i,s,n,o){let[a,l,d]=s||[[],[],[]],[u,f,g]=n||[[],[],[]];if(a.length>0||u.length>0)if(this.isVisible(t)){let m=()=>{this.addOrRemoveClasses(t,f,a.concat(l).concat(d)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,u,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(t,g,f))})};t.dispatchEvent(new Event("phx:hide-start")),e.transition(o,m,()=>{this.addOrRemoveClasses(t,[],u.concat(g)),h.putSticky(t,"toggle",p=>p.style.display="none"),t.dispatchEvent(new Event("phx:hide-end"))})}else{if(r==="remove")return;let m=()=>{this.addOrRemoveClasses(t,l,u.concat(f).concat(g));let p=i||this.defaultDisplay(t);h.putSticky(t,"toggle",E=>E.style.display=p),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(t,d,l))})};t.dispatchEvent(new Event("phx:show-start")),e.transition(o,m,()=>{this.addOrRemoveClasses(t,[],a.concat(d)),t.dispatchEvent(new Event("phx:show-end"))})}else this.isVisible(t)?window.requestAnimationFrame(()=>{t.dispatchEvent(new Event("phx:hide-start")),h.putSticky(t,"toggle",m=>m.style.display="none"),t.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{t.dispatchEvent(new Event("phx:show-start"));let m=i||this.defaultDisplay(t);h.putSticky(t,"toggle",p=>p.style.display=m),t.dispatchEvent(new Event("phx:show-end"))})},addOrRemoveClasses(r,e,t,i,s,n){let[o,a,l]=i||[[],[],[]];if(o.length>0){let d=()=>this.addOrRemoveClasses(r,a.concat(o),[]),u=()=>this.addOrRemoveClasses(r,e.concat(l),t.concat(o).concat(a));return n.transition(s,d,u)}window.requestAnimationFrame(()=>{let[d,u]=h.getSticky(r,"classes",[[],[]]),f=e.filter(E=>d.indexOf(E)<0&&!r.classList.contains(E)),g=t.filter(E=>u.indexOf(E)<0&&r.classList.contains(E)),m=d.filter(E=>t.indexOf(E)<0).concat(f),p=u.filter(E=>e.indexOf(E)<0).concat(g);h.putSticky(r,"classes",E=>(E.classList.remove(...p),E.classList.add(...m),[m,p]))})},setOrRemoveAttrs(r,e,t){let[i,s]=h.getSticky(r,"attrs",[[],[]]),n=e.map(([l,d])=>l).concat(t),o=i.filter(([l,d])=>!n.includes(l)).concat(e),a=s.filter(l=>!n.includes(l)).concat(t);h.putSticky(r,"attrs",l=>(a.forEach(d=>l.removeAttribute(d)),o.forEach(([d,u])=>l.setAttribute(d,u)),[o,a]))},hasAllClasses(r,e){return e.every(t=>r.classList.contains(t))},isToggledOut(r,e){return!this.isVisible(r)||this.hasAllClasses(r,e)},filterToEls(r,{to:e}){return e?h.all(document,e):[r]},defaultDisplay(r){return{tr:"table-row",td:"table-cell"}[r.tagName.toLowerCase()]||"block"}},H=Ni;var ot=(r,e,t=[])=>{let l=e,{submitter:i}=l,s=Ot(l,["submitter"]),n=new FormData(r);i&&i.hasAttribute("name")&&i.form&&i.form===r&&n.append(i.name,i.value);let o=[];n.forEach((d,u,f)=>{d instanceof File&&o.push(u)}),o.forEach(d=>n.delete(d));let a=new URLSearchParams;for(let[d,u]of n.entries())(t.length===0||t.indexOf(d)>=0)&&a.append(d,u);for(let d in s)a.append(d,s[d]);return a.toString()},Pe=class{constructor(e,t,i,s,n){this.isDead=!1,this.liveSocket=t,this.flash=s,this.parent=i,this.root=i?i.root:this,this.el=e,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.pruningCIDs=[],this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(o){o&&o()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.uploaders={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.channel=this.liveSocket.channel(`lv:${this.id}`,()=>({redirect:this.redirect?this.href:void 0,url:this.redirect?void 0:this.href||void 0,params:this.connectParams(n),session:this.getSession(),static:this.getStatic(),flash:this.flash}))}setHref(e){this.href=e}setRedirect(e){this.redirect=!0,this.href=e}isMain(){return this.el.hasAttribute(ge)}connectParams(e){let t=this.liveSocket.params(this.el),i=h.all(document,`[${this.binding(Ut)}]`).map(s=>s.src||s.href).filter(s=>typeof s=="string");return i.length>0&&(t._track_static=i),t._mounts=this.joinCount,t._live_referer=e,t}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(M)}getStatic(){let e=this.el.getAttribute(se);return e===""?null:e}destroy(e=function(){}){this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);let t=()=>{e();for(let i in this.viewHooks)this.destroyHook(this.viewHooks[i])};h.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",t).receive("error",t).receive("timeout",t)}setContainerClasses(...e){this.el.classList.remove(mt,me,ke,gt,We),this.el.classList.add(...e)}showLoader(e){if(clearTimeout(this.loaderTimer),e)this.loaderTimer=setTimeout(()=>this.showLoader(),e);else{for(let t in this.viewHooks)this.viewHooks[t].__disconnected();this.setContainerClasses(me)}}execAll(e){h.all(this.el,`[${e}]`,t=>this.liveSocket.execJS(t,t.getAttribute(e)))}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses(mt),this.execAll(this.binding("connected"))}triggerReconnected(){for(let e in this.viewHooks)this.viewHooks[e].__reconnected()}log(e,t){this.liveSocket.log(this,e,t)}transition(e,t,i=function(){}){this.liveSocket.transition(e,t,i)}withinTargets(e,t){if(e instanceof HTMLElement||e instanceof SVGElement)return this.liveSocket.owner(e,i=>t(i,e));if(q(e))h.findComponentNodeList(this.el,e).length===0?T(`no component found matching phx-target of ${e}`):t(this,parseInt(e));else{let i=Array.from(document.querySelectorAll(e));i.length===0&&T(`nothing found matching the phx-target selector "${e}"`),i.forEach(s=>this.liveSocket.owner(s,n=>t(n,s)))}}applyDiff(e,t,i){this.log(e,()=>["",Se(t)]);let{diff:s,reply:n,events:o,title:a}=Fe.extract(t);i({diff:s,reply:n,events:o}),a&&window.requestAnimationFrame(()=>h.putTitle(a))}onJoin(e){let{rendered:t,container:i}=e;if(i){let[s,n]=i;this.el=h.replaceRootContainer(this.el,s,n)}this.childJoins=0,this.joinPending=!0,this.flash=null,U.dropLocal(this.liveSocket.localStorage,window.location.pathname,$e),this.applyDiff("mount",t,({diff:s,events:n})=>{this.rendered=new Fe(this.id,s);let[o,a]=this.renderContainer(null,"join");this.dropPendingRefs();let l=this.formsForRecovery(o);this.joinCount++,l.length>0?l.forEach(([d,u,f],g)=>{this.pushFormRecovery(d,f,m=>{g===l.length-1&&this.onJoinComplete(m,o,a,n)})}):this.onJoinComplete(e,o,a,n)})}dropPendingRefs(){h.all(document,`[${Q}="${this.id}"][${R}]`,e=>{e.removeAttribute(R),e.removeAttribute(Q)})}onJoinComplete({live_patch:e},t,i,s){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(e,t,i,s);h.findPhxChildrenInFragment(t,this.id).filter(o=>{let a=o.id&&this.el.querySelector(`[id="${o.id}"]`),l=a&&a.getAttribute(se);return l&&o.setAttribute(se,l),this.joinChild(o)}).length===0?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i,s)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(e,t,i,s)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i,s)])}attachTrueDocEl(){this.el=h.byId(this.id),this.el.setAttribute(ee,this.root.id)}execNewMounted(){let e=this.binding(qe),t=this.binding(Ke);h.all(this.el,`[${e}], [${t}]`,i=>{h.maybeAddPrivateHooks(i,e,t),this.maybeAddNewHook(i)}),h.all(this.el,`[${this.binding(be)}], [data-phx-${be}]`,i=>{this.maybeAddNewHook(i)}),h.all(this.el,`[${this.binding(Et)}]`,i=>this.maybeMounted(i))}applyJoinPatch(e,t,i,s){this.attachTrueDocEl();let n=new de(this,this.el,this.id,t,i,null);if(n.markPrunableContentForRemoval(),this.performPatch(n,!1),this.joinNewChildren(),this.execNewMounted(),this.joinPending=!1,this.liveSocket.dispatchEvents(s),this.applyPendingUpdates(),e){let{kind:o,to:a}=e;this.liveSocket.historyPatch(a,o)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(e,t){this.liveSocket.triggerDOM("onBeforeElUpdated",[e,t]);let i=this.getHook(e),s=i&&h.isIgnored(e,this.binding(Ee));if(i&&!e.isEqualNode(t)&&!(s&&ii(e.dataset,t.dataset)))return i.__beforeUpdate(),i}maybeMounted(e){let t=e.getAttribute(this.binding(Et)),i=t&&h.private(e,"mounted");t&&!i&&(this.liveSocket.execJS(e,t),h.putPrivate(e,"mounted",!0))}maybeAddNewHook(e,t){let i=this.addHook(e);i&&i.__mounted()}performPatch(e,t){let i=[],s=!1,n=new Set;return e.after("added",o=>{this.liveSocket.triggerDOM("onNodeAdded",[o]),this.maybeAddNewHook(o),o.getAttribute&&this.maybeMounted(o)}),e.after("phxChildAdded",o=>{h.isPhxSticky(o)?this.liveSocket.joinRootViews():s=!0}),e.before("updated",(o,a)=>{this.triggerBeforeUpdateHook(o,a)&&n.add(o.id)}),e.after("updated",o=>{n.has(o.id)&&this.getHook(o).__updated()}),e.after("discarded",o=>{o.nodeType===Node.ELEMENT_NODE&&i.push(o)}),e.after("transitionsDiscarded",o=>this.afterElementsRemoved(o,t)),e.perform(),this.afterElementsRemoved(i,t),s}afterElementsRemoved(e,t){let i=[];e.forEach(s=>{let n=h.all(s,`[${k}]`),o=h.all(s,`[${this.binding(be)}]`);n.concat(s).forEach(a=>{let l=this.componentID(a);q(l)&&i.indexOf(l)===-1&&i.push(l)}),o.concat(s).forEach(a=>{let l=this.getHook(a);l&&this.destroyHook(l)})}),t&&this.maybePushComponentsDestroyed(i)}joinNewChildren(){h.findPhxChildren(this.el,this.id).forEach(e=>this.joinChild(e))}getChildById(e){return this.root.children[this.id][e]}getDescendentByEl(e){return e.id===this.id?this:this.children[e.getAttribute(Z)][e.id]}destroyDescendent(e){for(let t in this.root.children)for(let i in this.root.children[t])if(i===e)return this.root.children[t][i].destroy()}joinChild(e){if(!this.getChildById(e.id)){let i=new Pe(e,this.liveSocket,this);return this.root.children[this.id][i.id]=i,i.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(e){this.childJoins--,this.childJoins===0&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.joinCallback(()=>{this.pendingJoinOps.forEach(([e,t])=>{e.isDestroyed()||t()}),this.pendingJoinOps=[]})}update(e,t){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&this.root.isMain())return this.pendingDiffs.push({diff:e,events:t});this.rendered.mergeDiff(e);let i=!1;this.rendered.isComponentOnlyDiff(e)?this.liveSocket.time("component patch complete",()=>{h.findParentCIDs(this.el,this.rendered.componentCIDs(e)).forEach(n=>{this.componentPatch(this.rendered.getComponent(e,n),n)&&(i=!0)})}):Pt(e)||this.liveSocket.time("full patch complete",()=>{let[s,n]=this.renderContainer(e,"update"),o=new de(this,this.el,this.id,s,n,null);i=this.performPatch(o,!0)}),this.liveSocket.dispatchEvents(t),i&&this.joinNewChildren()}renderContainer(e,t){return this.liveSocket.time(`toString diff (${t})`,()=>{let i=this.el.tagName,s=e?this.rendered.componentCIDs(e).concat(this.pruningCIDs):null,[n,o]=this.rendered.toString(s);return[`<${i}>${n}${i}>`,o]})}componentPatch(e,t){if(Pt(e))return!1;let[i,s]=this.rendered.componentToString(t),n=new de(this,this.el,this.id,i,s,t);return this.performPatch(n,!0)}getHook(e){return this.viewHooks[ae.elementID(e)]}addHook(e){if(ae.elementID(e)||!e.getAttribute)return;let t=e.getAttribute(`data-phx-${be}`)||e.getAttribute(this.binding(be));if(t&&!this.ownsElement(e))return;let i=this.liveSocket.getHookCallbacks(t);if(i){e.id||T(`no DOM ID for hook "${t}". Hooks require a unique ID on each element.`,e);let s=new ae(this,e,i);return this.viewHooks[ae.elementID(s.el)]=s,s}else t!==null&&T(`unknown hook found for "${t}"`,e)}destroyHook(e){e.__destroyed(),e.__cleanup__(),delete this.viewHooks[ae.elementID(e.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:e,events:t})=>this.update(e,t)),this.pendingDiffs=[],this.eachChild(e=>e.applyPendingUpdates())}eachChild(e){let t=this.root.children[this.id]||{};for(let i in t)e(this.getChildById(i))}onChannel(e,t){this.liveSocket.onChannel(this.channel,e,i=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>t(i)]):this.liveSocket.requestDOMUpdate(()=>t(i))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",e=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",e,({diff:t,events:i})=>this.update(t,i))})}),this.onChannel("redirect",({to:e,flash:t})=>this.onRedirect({to:e,flash:t})),this.onChannel("live_patch",e=>this.onLivePatch(e)),this.onChannel("live_redirect",e=>this.onLiveRedirect(e)),this.channel.onError(e=>this.onError(e)),this.channel.onClose(e=>this.onClose(e))}destroyAllChildren(){this.eachChild(e=>e.destroy())}onLiveRedirect(e){let{to:t,kind:i,flash:s}=e,n=this.expandURL(t);this.liveSocket.historyRedirect(n,i,s)}onLivePatch(e){let{to:t,kind:i}=e;this.href=this.expandURL(t),this.liveSocket.historyPatch(t,i)}expandURL(e){return e.startsWith("/")?`${window.location.protocol}//${window.location.host}${e}`:e}onRedirect({to:e,flash:t}){this.liveSocket.redirect(e,t)}isDestroyed(){return this.destroyed}joinDead(){this.isDead=!0}join(e){this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel(),this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=t=>{t=t||function(){},e?e(this.joinCount,t):t()},this.liveSocket.wrapPush(this,{timeout:!1},()=>this.channel.join().receive("ok",t=>{this.isDestroyed()||this.liveSocket.requestDOMUpdate(()=>this.onJoin(t))}).receive("error",t=>!this.isDestroyed()&&this.onJoinError(t)).receive("timeout",()=>!this.isDestroyed()&&this.onJoinError({reason:"timeout"})))}onJoinError(e){if(e.reason==="reload")return this.log("error",()=>[`failed mount with ${e.status}. Falling back to page request`,e]),this.onRedirect({to:this.href});if(e.reason==="unauthorized"||e.reason==="stale")return this.log("error",()=>["unauthorized live_redirect. Falling back to page request",e]),this.onRedirect({to:this.href});if((e.redirect||e.live_redirect)&&(this.joinPending=!1,this.channel.leave()),e.redirect)return this.onRedirect(e.redirect);if(e.live_redirect)return this.onLiveRedirect(e.live_redirect);this.displayError([me,ke,We]),this.log("error",()=>["unable to join",e]),this.liveSocket.isConnected()&&this.liveSocket.reloadWithJitter(this)}onClose(e){if(!this.isDestroyed()){if(this.liveSocket.hasPendingLink()&&e!=="leave")return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(Gt)}}onError(e){this.onClose(e),this.liveSocket.isConnected()&&this.log("error",()=>["view crashed",e]),this.liveSocket.isUnloaded()||(this.liveSocket.isConnected()?this.displayError([me,ke,We]):this.displayError([me,ke,gt]))}displayError(e){this.isMain()&&h.dispatchEvent(window,"phx:page-loading-start",{detail:{to:this.href,kind:"error"}}),this.showLoader(),this.setContainerClasses(...e),this.execAll(this.binding("disconnected"))}pushWithReply(e,t,i,s=function(){}){if(!this.isConnected())return;let[n,[o],a]=e?e():[null,[],{}],l=function(){};return(a.page_loading||o&&o.getAttribute(this.binding(pt))!==null)&&(l=this.liveSocket.withPageLoading({kind:"element",target:o})),typeof i.cid!="number"&&delete i.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(t,i,Yt).receive("ok",d=>{let u=f=>{d.redirect&&this.onRedirect(d.redirect),d.live_patch&&this.onLivePatch(d.live_patch),d.live_redirect&&this.onLiveRedirect(d.live_redirect),l(),s(d,f)};d.diff?this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",d.diff,({diff:f,reply:g,events:m})=>{n!==null&&this.undoRefs(n),this.update(f,m),u(g)})}):(n!==null&&this.undoRefs(n),u(null))}))}undoRefs(e){!this.isConnected()||h.all(document,`[${Q}="${this.id}"][${R}="${e}"]`,t=>{let i=t.getAttribute(Ie);t.removeAttribute(R),t.removeAttribute(Q),t.getAttribute(ze)!==null&&(t.readOnly=!1,t.removeAttribute(ze)),i!==null&&(t.disabled=i==="true",t.removeAttribute(Ie)),Be.forEach(o=>h.removeClass(t,o));let s=t.getAttribute(Le);s!==null&&(t.innerText=s,t.removeAttribute(Le));let n=h.private(t,R);if(n){let o=this.triggerBeforeUpdateHook(t,n);de.patchEl(t,n,this.liveSocket.getActiveElement()),o&&o.__updated(),h.deletePrivate(t,R)}})}putRef(e,t,i={}){let s=this.ref++,n=this.binding(Re);return i.loading&&(e=e.concat(h.all(document,i.loading))),e.forEach(o=>{o.classList.add(`phx-${t}-loading`),o.setAttribute(R,s),o.setAttribute(Q,this.el.id);let a=o.getAttribute(n);a!==null&&(o.getAttribute(Le)||o.setAttribute(Le,o.innerText),a!==""&&(o.innerText=a),o.setAttribute("disabled",""))}),[s,e,i]}componentID(e){let t=e.getAttribute&&e.getAttribute(k);return t?parseInt(t):null}targetComponentID(e,t,i={}){if(q(t))return t;let s=e.getAttribute(this.binding("target"));return q(s)?parseInt(s):t&&(s!==null||i.target)?this.closestComponentID(t):null}closestComponentID(e){return q(e)?e:e?K(e.closest(`[${k}]`),t=>this.ownsElement(t)&&this.componentID(t)):null}pushHookEvent(e,t,i,s,n){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",i,s]),!1;let[o,a,l]=this.putRef([e],"hook");return this.pushWithReply(()=>[o,a,l],"event",{type:"hook",event:i,value:s,cid:this.closestComponentID(t)},(d,u)=>n(u,o)),o}extractMeta(e,t,i){let s=this.binding("value-");for(let n=0;n=0&&!e.checked&&delete t.value),i){t||(t={});for(let n in i)t[n]=i[n]}return t}pushEvent(e,t,i,s,n,o={},a){this.pushWithReply(()=>this.putRef([t],e,o),"event",{type:e,event:s,value:this.extractMeta(t,n,o.value),cid:this.targetComponentID(t,i,o)},(l,d)=>a&&a(d))}pushFileProgress(e,t,i,s=function(){}){this.liveSocket.withinOwners(e.form,(n,o)=>{n.pushWithReply(null,"progress",{event:e.getAttribute(n.binding(qt)),ref:e.getAttribute(J),entry_ref:t,progress:i,cid:n.targetComponentID(e.form,o)},s)})}pushInput(e,t,i,s,n,o){let a,l=q(i)?i:this.targetComponentID(e.form,t),d=()=>this.putRef([e,e.form],"change",n),u,f=this.extractMeta(e.form);e.getAttribute(this.binding("change"))?u=ot(e.form,V({_target:n._target},f),[e.name]):u=ot(e.form,V({_target:n._target},f)),h.isUploadInput(e)&&e.files&&e.files.length>0&&w.trackFiles(e,Array.from(e.files)),a=w.serializeUploads(e);let g={type:"form",event:s,value:u,uploads:a,cid:l};this.pushWithReply(d,"event",g,m=>{if(h.showError(e,this.liveSocket.binding(le)),h.isUploadInput(e)&&e.getAttribute("data-phx-auto-upload")!==null){if(w.filesAwaitingPreflight(e).length>0){let[p,E]=d();this.uploadFiles(e.form,t,p,l,C=>{o&&o(m),this.triggerAwaitingSubmit(e.form)})}}else o&&o(m)})}triggerAwaitingSubmit(e){let t=this.getScheduledSubmit(e);if(t){let[i,s,n,o]=t;this.cancelSubmit(e),o()}}getScheduledSubmit(e){return this.formSubmits.find(([t,i,s,n])=>t.isSameNode(e))}scheduleSubmit(e,t,i,s){if(this.getScheduledSubmit(e))return!0;this.formSubmits.push([e,t,i,s])}cancelSubmit(e){this.formSubmits=this.formSubmits.filter(([t,i,s])=>t.isSameNode(e)?(this.undoRefs(i),!1):!0)}disableForm(e,t={}){let i=f=>!(he(f,`${this.binding(Ee)}=ignore`,f.form)||he(f,"data-phx-update=ignore",f.form)),s=f=>f.hasAttribute(this.binding(Re)),n=f=>f.tagName=="BUTTON",o=f=>["INPUT","TEXTAREA","SELECT"].includes(f.tagName),a=Array.from(e.elements),l=a.filter(s),d=a.filter(n).filter(i),u=a.filter(o).filter(i);return d.forEach(f=>{f.setAttribute(Ie,f.disabled),f.disabled=!0}),u.forEach(f=>{f.setAttribute(ze,f.readOnly),f.readOnly=!0,f.files&&(f.setAttribute(Ie,f.disabled),f.disabled=!0)}),e.setAttribute(this.binding(pt),""),this.putRef([e].concat(l).concat(d).concat(u),"submit",t)}pushFormSubmit(e,t,i,s,n,o){let a=()=>this.disableForm(e,n),l=this.targetComponentID(e,t);if(w.hasUploadsInProgress(e)){let[d,u]=a(),f=()=>this.pushFormSubmit(e,s,t,i,n,o);return this.scheduleSubmit(e,d,n,f)}else if(w.inputsAwaitingPreflight(e).length>0){let[d,u]=a(),f=()=>[d,u,n];this.uploadFiles(e,t,d,l,g=>{let m=this.extractMeta(e),p=ot(e,V({submitter:s},m));this.pushWithReply(f,"event",{type:"form",event:i,value:p,cid:l},o)})}else if(!(e.hasAttribute(R)&&e.classList.contains("phx-submit-loading"))){let d=this.extractMeta(e),u=ot(e,V({submitter:s},d));this.pushWithReply(a,"event",{type:"form",event:i,value:u,cid:l},o)}}uploadFiles(e,t,i,s,n){let o=this.joinCount,a=w.activeFileInputs(e),l=a.length;a.forEach(d=>{let u=new w(d,this,()=>{l--,l===0&&n()});this.uploaders[d]=u;let f=u.entries().map(m=>m.toPreflightPayload()),g={ref:d.getAttribute(J),entries:f,cid:this.targetComponentID(d.form,t)};this.log("upload",()=>["sending preflight request",g]),this.pushWithReply(null,"allow_upload",g,m=>{if(this.log("upload",()=>["got preflight response",m]),m.error){this.undoRefs(i);let[p,E]=m.error;this.log("upload",()=>[`error for entry ${p}`,E])}else{let p=E=>{this.channel.onError(()=>{this.joinCount===o&&E()})};u.initAdapterUpload(m,p,this.liveSocket)}})})}dispatchUploads(e,t){let i=h.findUploadInputs(this.el).filter(s=>s.name===e);i.length===0?T(`no live file inputs found matching the name "${e}"`):i.length>1?T(`duplicate live file inputs found matching the name "${e}"`):h.dispatchEvent(i[0],Je,{detail:{files:t}})}pushFormRecovery(e,t,i){this.liveSocket.withinOwners(e,(s,n)=>{let o=this.binding("change"),a=Array.from(e.elements).filter(u=>h.isFormInput(u)&&u.name&&!u.hasAttribute(o));if(a.length===0)return;let l=a.find(u=>u.type!=="hidden")||a[0],d=e.getAttribute(this.binding(bt))||e.getAttribute(this.binding("change"));H.exec("change",d,s,l,["push",{_target:l.name,newCid:t,callback:i}])})}pushLinkPatch(e,t,i){let s=this.liveSocket.setPendingLink(e),n=t?()=>this.putRef([t],"click"):null,o=()=>this.liveSocket.redirect(window.location.href),a=e.startsWith("/")?`${location.protocol}//${location.host}${e}`:e,l=this.pushWithReply(n,"live_patch",{url:a},d=>{this.liveSocket.requestDOMUpdate(()=>{d.link_redirect?this.liveSocket.replaceMain(e,null,i,s):(this.liveSocket.commitPendingLink(s)&&(this.href=e),this.applyPendingUpdates(),i&&i(s))})});l?l.receive("timeout",o):o()}formsForRecovery(e){if(this.joinCount===0)return[];let t=this.binding("change"),i=document.createElement("template");return i.innerHTML=e,h.all(this.el,`form[${t}]`).filter(s=>s.id&&this.ownsElement(s)).filter(s=>s.elements.length>0).filter(s=>s.getAttribute(this.binding(bt))!=="ignore").map(s=>{let n=s.getAttribute(t).replaceAll(/([\[\]"])/g,"\\$1"),o=i.content.querySelector(`form[id="${s.id}"][${t}="${n}"]`);return o?[s,o,this.targetComponentID(o)]:[s,s,this.targetComponentID(s)]}).filter(([s,n,o])=>n)}maybePushComponentsDestroyed(e){let t=e.filter(i=>h.findComponentNodeList(this.el,i).length===0);t.length>0&&(this.pruningCIDs.push(...t),this.pushWithReply(null,"cids_will_destroy",{cids:t},()=>{this.pruningCIDs=this.pruningCIDs.filter(s=>t.indexOf(s)!==-1);let i=t.filter(s=>h.findComponentNodeList(this.el,s).length===0);i.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:i},s=>{this.rendered.pruneCIDs(s.cids)})}))}ownsElement(e){let t=e.closest(G);return e.getAttribute(Z)===this.id||t&&t.id===this.id||!t&&this.isDead}submitForm(e,t,i,s,n={}){h.putPrivate(e,ve,!0);let o=this.liveSocket.binding(le),a=Array.from(e.elements);a.forEach(l=>h.putPrivate(l,ve,!0)),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(e,t,i,s,n,()=>{a.forEach(l=>h.showError(l,o)),this.liveSocket.restorePreviouslyActiveFocus()})}binding(e){return this.liveSocket.binding(e)}};var at=class{constructor(e,t,i={}){if(this.unloaded=!1,!t||t.constructor.name==="Object")throw new Error(`
+`,n.innerHTML.trim()),[this.createSpan("",t).outerHTML,a]):!u&&f?(T("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,a]):[n.innerHTML,a]}createSpan(e,t){let i=document.createElement("span");return i.innerText=e,i.setAttribute(k,t),i}};var Hi=1,ae=class{static makeID(){return Hi++}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,o)=>n.pushHookEvent(this.el,o,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))}};var nt=null,Ni={exec(r,e,t,i,s){let[n,o]=s||[null,{callback:s&&s.callback}];(e.charAt(0)==="["?JSON.parse(e):[[n,o]]).forEach(([l,d])=>{l===n&&o.data&&(d.data=Object.assign(d.data||{},o.data),d.callback=d.callback||o.callback),this.filterToEls(i,d).forEach(u=>{this[`exec_${l}`](r,e,t,i,u,d)})})},isVisible(r){return!!(r.offsetWidth||r.offsetHeight||r.getClientRects().length>0)},exec_exec(r,e,t,i,s,[n,o]){(o?h.all(document,o):[i]).forEach(l=>{let d=l.getAttribute(n);if(!d)throw new Error(`expected ${n} to contain JS command on "${o}"`);t.liveSocket.execJS(l,d,r)})},exec_dispatch(r,e,t,i,s,{to:n,event:o,detail:a,bubbles:l}){a=a||{},a.dispatcher=i,h.dispatchEvent(s,o,{detail:a,bubbles:l})},exec_push(r,e,t,i,s,n){if(!t.isConnected())return;let{event:o,data:a,target:l,page_loading:d,loading:u,value:f,dispatcher:g,callback:m}=n,p={loading:u,value:f,target:l,page_loading:!!d},E=r==="change"&&g?g:i,C=l||E.getAttribute(t.binding("target"))||E;t.withinTargets(C,(I,N)=>{if(r==="change"){let{newCid:L,_target:z}=n;z=z||(h.isFormInput(i)?i.name:void 0),z&&(p._target=z),I.pushInput(i,N,L,o||e,p,m)}else if(r==="submit"){let{submitter:L}=n;I.submitForm(i,N,o||e,L,p,m)}else I.pushEvent(r,i,N,o||e,a,p,m)})},exec_navigate(r,e,t,i,s,{href:n,replace:o}){t.liveSocket.historyRedirect(n,o?"replace":"push")},exec_patch(r,e,t,i,s,{href:n,replace:o}){t.liveSocket.pushHistoryPatch(n,o?"replace":"push",i)},exec_focus(r,e,t,i,s){window.requestAnimationFrame(()=>ne.attemptFocus(s))},exec_focus_first(r,e,t,i,s){window.requestAnimationFrame(()=>ne.focusFirstInteractive(s)||ne.focusFirst(s))},exec_push_focus(r,e,t,i,s){window.requestAnimationFrame(()=>nt=s||i)},exec_pop_focus(r,e,t,i,s){window.requestAnimationFrame(()=>{nt&&nt.focus(),nt=null})},exec_add_class(r,e,t,i,s,{names:n,transition:o,time:a}){this.addOrRemoveClasses(s,n,[],o,a,t)},exec_remove_class(r,e,t,i,s,{names:n,transition:o,time:a}){this.addOrRemoveClasses(s,[],n,o,a,t)},exec_transition(r,e,t,i,s,{time:n,transition:o}){this.addOrRemoveClasses(s,[],[],o,n,t)},exec_toggle(r,e,t,i,s,{display:n,ins:o,outs:a,time:l}){this.toggle(r,t,s,n,o,a,l)},exec_show(r,e,t,i,s,{display:n,transition:o,time:a}){this.show(r,t,s,n,o,a)},exec_hide(r,e,t,i,s,{display:n,transition:o,time:a}){this.hide(r,t,s,n,o,a)},exec_set_attr(r,e,t,i,s,{attr:[n,o]}){this.setOrRemoveAttrs(s,[[n,o]],[])},exec_remove_attr(r,e,t,i,s,{attr:n}){this.setOrRemoveAttrs(s,[],[n])},show(r,e,t,i,s,n){this.isVisible(t)||this.toggle(r,e,t,i,s,null,n)},hide(r,e,t,i,s,n){this.isVisible(t)&&this.toggle(r,e,t,i,null,s,n)},toggle(r,e,t,i,s,n,o){let[a,l,d]=s||[[],[],[]],[u,f,g]=n||[[],[],[]];if(a.length>0||u.length>0)if(this.isVisible(t)){let m=()=>{this.addOrRemoveClasses(t,f,a.concat(l).concat(d)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,u,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(t,g,f))})};t.dispatchEvent(new Event("phx:hide-start")),e.transition(o,m,()=>{this.addOrRemoveClasses(t,[],u.concat(g)),h.putSticky(t,"toggle",p=>p.style.display="none"),t.dispatchEvent(new Event("phx:hide-end"))})}else{if(r==="remove")return;let m=()=>{this.addOrRemoveClasses(t,l,u.concat(f).concat(g));let p=i||this.defaultDisplay(t);h.putSticky(t,"toggle",E=>E.style.display=p),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(t,d,l))})};t.dispatchEvent(new Event("phx:show-start")),e.transition(o,m,()=>{this.addOrRemoveClasses(t,[],a.concat(d)),t.dispatchEvent(new Event("phx:show-end"))})}else this.isVisible(t)?window.requestAnimationFrame(()=>{t.dispatchEvent(new Event("phx:hide-start")),h.putSticky(t,"toggle",m=>m.style.display="none"),t.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{t.dispatchEvent(new Event("phx:show-start"));let m=i||this.defaultDisplay(t);h.putSticky(t,"toggle",p=>p.style.display=m),t.dispatchEvent(new Event("phx:show-end"))})},addOrRemoveClasses(r,e,t,i,s,n){let[o,a,l]=i||[[],[],[]];if(o.length>0){let d=()=>this.addOrRemoveClasses(r,a.concat(o),[]),u=()=>this.addOrRemoveClasses(r,e.concat(l),t.concat(o).concat(a));return n.transition(s,d,u)}window.requestAnimationFrame(()=>{let[d,u]=h.getSticky(r,"classes",[[],[]]),f=e.filter(E=>d.indexOf(E)<0&&!r.classList.contains(E)),g=t.filter(E=>u.indexOf(E)<0&&r.classList.contains(E)),m=d.filter(E=>t.indexOf(E)<0).concat(f),p=u.filter(E=>e.indexOf(E)<0).concat(g);h.putSticky(r,"classes",E=>(E.classList.remove(...p),E.classList.add(...m),[m,p]))})},setOrRemoveAttrs(r,e,t){let[i,s]=h.getSticky(r,"attrs",[[],[]]),n=e.map(([l,d])=>l).concat(t),o=i.filter(([l,d])=>!n.includes(l)).concat(e),a=s.filter(l=>!n.includes(l)).concat(t);h.putSticky(r,"attrs",l=>(a.forEach(d=>l.removeAttribute(d)),o.forEach(([d,u])=>l.setAttribute(d,u)),[o,a]))},hasAllClasses(r,e){return e.every(t=>r.classList.contains(t))},isToggledOut(r,e){return!this.isVisible(r)||this.hasAllClasses(r,e)},filterToEls(r,{to:e}){return e?h.all(document,e):[r]},defaultDisplay(r){return{tr:"table-row",td:"table-cell"}[r.tagName.toLowerCase()]||"block"}},H=Ni;var ot=(r,e,t=[])=>{let l=e,{submitter:i}=l,s=Ot(l,["submitter"]),n=new FormData(r);i&&i.hasAttribute("name")&&i.form&&i.form===r&&n.append(i.name,i.value);let o=[];n.forEach((d,u,f)=>{d instanceof File&&o.push(u)}),o.forEach(d=>n.delete(d));let a=new URLSearchParams;for(let[d,u]of n.entries())(t.length===0||t.indexOf(d)>=0)&&a.append(d,u);for(let d in s)a.append(d,s[d]);return a.toString()},Pe=class{constructor(e,t,i,s,n){this.isDead=!1,this.liveSocket=t,this.flash=s,this.parent=i,this.root=i?i.root:this,this.el=e,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.pruningCIDs=[],this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(o){o&&o()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.uploaders={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.channel=this.liveSocket.channel(`lv:${this.id}`,()=>({redirect:this.redirect?this.href:void 0,url:this.redirect?void 0:this.href||void 0,params:this.connectParams(n),session:this.getSession(),static:this.getStatic(),flash:this.flash}))}setHref(e){this.href=e}setRedirect(e){this.redirect=!0,this.href=e}isMain(){return this.el.hasAttribute(ge)}connectParams(e){let t=this.liveSocket.params(this.el),i=h.all(document,`[${this.binding(Ut)}]`).map(s=>s.src||s.href).filter(s=>typeof s=="string");return i.length>0&&(t._track_static=i),t._mounts=this.joinCount,t._live_referer=e,t}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(M)}getStatic(){let e=this.el.getAttribute(se);return e===""?null:e}destroy(e=function(){}){this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);let t=()=>{e();for(let i in this.viewHooks)this.destroyHook(this.viewHooks[i])};h.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",t).receive("error",t).receive("timeout",t)}setContainerClasses(...e){this.el.classList.remove(mt,me,ke,gt,We),this.el.classList.add(...e)}showLoader(e){if(clearTimeout(this.loaderTimer),e)this.loaderTimer=setTimeout(()=>this.showLoader(),e);else{for(let t in this.viewHooks)this.viewHooks[t].__disconnected();this.setContainerClasses(me)}}execAll(e){h.all(this.el,`[${e}]`,t=>this.liveSocket.execJS(t,t.getAttribute(e)))}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses(mt),this.execAll(this.binding("connected"))}triggerReconnected(){for(let e in this.viewHooks)this.viewHooks[e].__reconnected()}log(e,t){this.liveSocket.log(this,e,t)}transition(e,t,i=function(){}){this.liveSocket.transition(e,t,i)}withinTargets(e,t){if(e instanceof HTMLElement||e instanceof SVGElement)return this.liveSocket.owner(e,i=>t(i,e));if(q(e))h.findComponentNodeList(this.el,e).length===0?T(`no component found matching phx-target of ${e}`):t(this,parseInt(e));else{let i=Array.from(document.querySelectorAll(e));i.length===0&&T(`nothing found matching the phx-target selector "${e}"`),i.forEach(s=>this.liveSocket.owner(s,n=>t(n,s)))}}applyDiff(e,t,i){this.log(e,()=>["",Se(t)]);let{diff:s,reply:n,events:o,title:a}=Fe.extract(t);i({diff:s,reply:n,events:o}),a&&window.requestAnimationFrame(()=>h.putTitle(a))}onJoin(e){let{rendered:t,container:i}=e;if(i){let[s,n]=i;this.el=h.replaceRootContainer(this.el,s,n)}this.childJoins=0,this.joinPending=!0,this.flash=null,U.dropLocal(this.liveSocket.localStorage,window.location.pathname,$e),this.applyDiff("mount",t,({diff:s,events:n})=>{this.rendered=new Fe(this.id,s);let[o,a]=this.renderContainer(null,"join");this.dropPendingRefs();let l=this.formsForRecovery(o);this.joinCount++,l.length>0?l.forEach(([d,u,f],g)=>{this.pushFormRecovery(d,f,m=>{g===l.length-1&&this.onJoinComplete(m,o,a,n)})}):this.onJoinComplete(e,o,a,n)})}dropPendingRefs(){h.all(document,`[${Q}="${this.id}"][${R}]`,e=>{e.removeAttribute(R),e.removeAttribute(Q)})}onJoinComplete({live_patch:e},t,i,s){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(e,t,i,s);h.findPhxChildrenInFragment(t,this.id).filter(o=>{let a=o.id&&this.el.querySelector(`[id="${o.id}"]`),l=a&&a.getAttribute(se);return l&&o.setAttribute(se,l),this.joinChild(o)}).length===0?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i,s)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(e,t,i,s)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i,s)])}attachTrueDocEl(){this.el=h.byId(this.id),this.el.setAttribute(ee,this.root.id)}execNewMounted(){let e=this.binding(qe),t=this.binding(Ke);h.all(this.el,`[${e}], [${t}]`,i=>{h.maybeAddPrivateHooks(i,e,t),this.maybeAddNewHook(i)}),h.all(this.el,`[${this.binding(be)}], [data-phx-${be}]`,i=>{this.maybeAddNewHook(i)}),h.all(this.el,`[${this.binding(Et)}]`,i=>this.maybeMounted(i))}applyJoinPatch(e,t,i,s){this.attachTrueDocEl();let n=new de(this,this.el,this.id,t,i,null);if(n.markPrunableContentForRemoval(),this.performPatch(n,!1),this.joinNewChildren(),this.execNewMounted(),this.joinPending=!1,this.liveSocket.dispatchEvents(s),this.applyPendingUpdates(),e){let{kind:o,to:a}=e;this.liveSocket.historyPatch(a,o)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(e,t){this.liveSocket.triggerDOM("onBeforeElUpdated",[e,t]);let i=this.getHook(e),s=i&&h.isIgnored(e,this.binding(Ee));if(i&&!e.isEqualNode(t)&&!(s&&ii(e.dataset,t.dataset)))return i.__beforeUpdate(),i}maybeMounted(e){let t=e.getAttribute(this.binding(Et)),i=t&&h.private(e,"mounted");t&&!i&&(this.liveSocket.execJS(e,t),h.putPrivate(e,"mounted",!0))}maybeAddNewHook(e,t){let i=this.addHook(e);i&&i.__mounted()}performPatch(e,t){let i=[],s=!1,n=new Set;return e.after("added",o=>{this.liveSocket.triggerDOM("onNodeAdded",[o]),this.maybeAddNewHook(o),o.getAttribute&&this.maybeMounted(o)}),e.after("phxChildAdded",o=>{h.isPhxSticky(o)?this.liveSocket.joinRootViews():s=!0}),e.before("updated",(o,a)=>{this.triggerBeforeUpdateHook(o,a)&&n.add(o.id)}),e.after("updated",o=>{n.has(o.id)&&this.getHook(o).__updated()}),e.after("discarded",o=>{o.nodeType===Node.ELEMENT_NODE&&i.push(o)}),e.after("transitionsDiscarded",o=>this.afterElementsRemoved(o,t)),e.perform(),this.afterElementsRemoved(i,t),s}afterElementsRemoved(e,t){let i=[];e.forEach(s=>{let n=h.all(s,`[${k}]`),o=h.all(s,`[${this.binding(be)}]`);n.concat(s).forEach(a=>{let l=this.componentID(a);q(l)&&i.indexOf(l)===-1&&i.push(l)}),o.concat(s).forEach(a=>{let l=this.getHook(a);l&&this.destroyHook(l)})}),t&&this.maybePushComponentsDestroyed(i)}joinNewChildren(){h.findPhxChildren(this.el,this.id).forEach(e=>this.joinChild(e))}getChildById(e){return this.root.children[this.id][e]}getDescendentByEl(e){return e.id===this.id?this:this.children[e.getAttribute(Z)][e.id]}destroyDescendent(e){for(let t in this.root.children)for(let i in this.root.children[t])if(i===e)return this.root.children[t][i].destroy()}joinChild(e){if(!this.getChildById(e.id)){let i=new Pe(e,this.liveSocket,this);return this.root.children[this.id][i.id]=i,i.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(e){this.childJoins--,this.childJoins===0&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.joinCallback(()=>{this.pendingJoinOps.forEach(([e,t])=>{e.isDestroyed()||t()}),this.pendingJoinOps=[]})}update(e,t){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&this.root.isMain())return this.pendingDiffs.push({diff:e,events:t});this.rendered.mergeDiff(e);let i=!1;this.rendered.isComponentOnlyDiff(e)?this.liveSocket.time("component patch complete",()=>{h.findParentCIDs(this.el,this.rendered.componentCIDs(e)).forEach(n=>{this.componentPatch(this.rendered.getComponent(e,n),n)&&(i=!0)})}):Pt(e)||this.liveSocket.time("full patch complete",()=>{let[s,n]=this.renderContainer(e,"update"),o=new de(this,this.el,this.id,s,n,null);i=this.performPatch(o,!0)}),this.liveSocket.dispatchEvents(t),i&&this.joinNewChildren()}renderContainer(e,t){return this.liveSocket.time(`toString diff (${t})`,()=>{let i=this.el.tagName,s=e?this.rendered.componentCIDs(e).concat(this.pruningCIDs):null,[n,o]=this.rendered.toString(s);return[`<${i}>${n}${i}>`,o]})}componentPatch(e,t){if(Pt(e))return!1;let[i,s]=this.rendered.componentToString(t),n=new de(this,this.el,this.id,i,s,t);return this.performPatch(n,!0)}getHook(e){return this.viewHooks[ae.elementID(e)]}addHook(e){if(ae.elementID(e)||!e.getAttribute)return;let t=e.getAttribute(`data-phx-${be}`)||e.getAttribute(this.binding(be));if(t&&!this.ownsElement(e))return;let i=this.liveSocket.getHookCallbacks(t);if(i){e.id||T(`no DOM ID for hook "${t}". Hooks require a unique ID on each element.`,e);let s=new ae(this,e,i);return this.viewHooks[ae.elementID(s.el)]=s,s}else t!==null&&T(`unknown hook found for "${t}"`,e)}destroyHook(e){e.__destroyed(),e.__cleanup__(),delete this.viewHooks[ae.elementID(e.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:e,events:t})=>this.update(e,t)),this.pendingDiffs=[],this.eachChild(e=>e.applyPendingUpdates())}eachChild(e){let t=this.root.children[this.id]||{};for(let i in t)e(this.getChildById(i))}onChannel(e,t){this.liveSocket.onChannel(this.channel,e,i=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>t(i)]):this.liveSocket.requestDOMUpdate(()=>t(i))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",e=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",e,({diff:t,events:i})=>this.update(t,i))})}),this.onChannel("redirect",({to:e,flash:t})=>this.onRedirect({to:e,flash:t})),this.onChannel("live_patch",e=>this.onLivePatch(e)),this.onChannel("live_redirect",e=>this.onLiveRedirect(e)),this.channel.onError(e=>this.onError(e)),this.channel.onClose(e=>this.onClose(e))}destroyAllChildren(){this.eachChild(e=>e.destroy())}onLiveRedirect(e){let{to:t,kind:i,flash:s}=e,n=this.expandURL(t);this.liveSocket.historyRedirect(n,i,s)}onLivePatch(e){let{to:t,kind:i}=e;this.href=this.expandURL(t),this.liveSocket.historyPatch(t,i)}expandURL(e){return e.startsWith("/")?`${window.location.protocol}//${window.location.host}${e}`:e}onRedirect({to:e,flash:t}){this.liveSocket.redirect(e,t)}isDestroyed(){return this.destroyed}joinDead(){this.isDead=!0}join(e){this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel(),this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=t=>{t=t||function(){},e?e(this.joinCount,t):t()},this.liveSocket.wrapPush(this,{timeout:!1},()=>this.channel.join().receive("ok",t=>{this.isDestroyed()||this.liveSocket.requestDOMUpdate(()=>this.onJoin(t))}).receive("error",t=>!this.isDestroyed()&&this.onJoinError(t)).receive("timeout",()=>!this.isDestroyed()&&this.onJoinError({reason:"timeout"})))}onJoinError(e){if(e.reason==="reload")return this.log("error",()=>[`failed mount with ${e.status}. Falling back to page request`,e]),this.onRedirect({to:this.href});if(e.reason==="unauthorized"||e.reason==="stale")return this.log("error",()=>["unauthorized live_redirect. Falling back to page request",e]),this.onRedirect({to:this.href});if((e.redirect||e.live_redirect)&&(this.joinPending=!1,this.channel.leave()),e.redirect)return this.onRedirect(e.redirect);if(e.live_redirect)return this.onLiveRedirect(e.live_redirect);this.displayError([me,ke,We]),this.log("error",()=>["unable to join",e]),this.liveSocket.isConnected()&&this.liveSocket.reloadWithJitter(this)}onClose(e){if(!this.isDestroyed()){if(this.liveSocket.hasPendingLink()&&e!=="leave")return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(Gt)}}onError(e){this.onClose(e),this.liveSocket.isConnected()&&this.log("error",()=>["view crashed",e]),this.liveSocket.isUnloaded()||(this.liveSocket.isConnected()?this.displayError([me,ke,We]):this.displayError([me,ke,gt]))}displayError(e){this.isMain()&&h.dispatchEvent(window,"phx:page-loading-start",{detail:{to:this.href,kind:"error"}}),this.showLoader(),this.setContainerClasses(...e),this.execAll(this.binding("disconnected"))}pushWithReply(e,t,i,s=function(){}){if(!this.isConnected())return;let[n,[o],a]=e?e():[null,[],{}],l=function(){};return(a.page_loading||o&&o.getAttribute(this.binding(pt))!==null)&&(l=this.liveSocket.withPageLoading({kind:"element",target:o})),typeof i.cid!="number"&&delete i.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(t,i,Yt).receive("ok",d=>{let u=f=>{d.redirect&&this.onRedirect(d.redirect),d.live_patch&&this.onLivePatch(d.live_patch),d.live_redirect&&this.onLiveRedirect(d.live_redirect),l(),s(d,f)};d.diff?this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",d.diff,({diff:f,reply:g,events:m})=>{n!==null&&this.undoRefs(n),this.update(f,m),u(g)})}):(n!==null&&this.undoRefs(n),u(null))}))}undoRefs(e){!this.isConnected()||h.all(document,`[${Q}="${this.id}"][${R}="${e}"]`,t=>{let i=t.getAttribute(Ie);t.removeAttribute(R),t.removeAttribute(Q),t.getAttribute(ze)!==null&&(t.readOnly=!1,t.removeAttribute(ze)),i!==null&&(t.disabled=i==="true",t.removeAttribute(Ie)),Be.forEach(o=>h.removeClass(t,o));let s=t.getAttribute(Le);s!==null&&(t.innerText=s,t.removeAttribute(Le));let n=h.private(t,R);if(n){let o=this.triggerBeforeUpdateHook(t,n);de.patchEl(t,n,this.liveSocket.getActiveElement()),o&&o.__updated(),h.deletePrivate(t,R)}})}putRef(e,t,i={}){let s=this.ref++,n=this.binding(Re);return i.loading&&(e=e.concat(h.all(document,i.loading))),e.forEach(o=>{o.classList.add(`phx-${t}-loading`),o.setAttribute(R,s),o.setAttribute(Q,this.el.id);let a=o.getAttribute(n);a!==null&&(o.getAttribute(Le)||o.setAttribute(Le,o.innerText),a!==""&&(o.innerText=a),o.setAttribute("disabled",""))}),[s,e,i]}componentID(e){let t=e.getAttribute&&e.getAttribute(k);return t?parseInt(t):null}targetComponentID(e,t,i={}){if(q(t))return t;let s=e.getAttribute(this.binding("target"));return q(s)?parseInt(s):t&&(s!==null||i.target)?this.closestComponentID(t):null}closestComponentID(e){return q(e)?e:e?K(e.closest(`[${k}]`),t=>this.ownsElement(t)&&this.componentID(t)):null}pushHookEvent(e,t,i,s,n){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",i,s]),!1;let[o,a,l]=this.putRef([e],"hook");return this.pushWithReply(()=>[o,a,l],"event",{type:"hook",event:i,value:s,cid:this.closestComponentID(t)},(d,u)=>n(u,o)),o}extractMeta(e,t,i){let s=this.binding("value-");for(let n=0;n=0&&!e.checked&&delete t.value),i){t||(t={});for(let n in i)t[n]=i[n]}return t}pushEvent(e,t,i,s,n,o={},a){this.pushWithReply(()=>this.putRef([t],e,o),"event",{type:e,event:s,value:this.extractMeta(t,n,o.value),cid:this.targetComponentID(t,i,o)},(l,d)=>a&&a(d))}pushFileProgress(e,t,i,s=function(){}){this.liveSocket.withinOwners(e.form,(n,o)=>{n.pushWithReply(null,"progress",{event:e.getAttribute(n.binding(qt)),ref:e.getAttribute(J),entry_ref:t,progress:i,cid:n.targetComponentID(e.form,o)},s)})}pushInput(e,t,i,s,n,o){let a,l=q(i)?i:this.targetComponentID(e.form,t),d=()=>this.putRef([e,e.form],"change",n),u,f=this.extractMeta(e.form);e.getAttribute(this.binding("change"))?u=ot(e.form,V({_target:n._target},f),[e.name]):u=ot(e.form,V({_target:n._target},f)),h.isUploadInput(e)&&e.files&&e.files.length>0&&w.trackFiles(e,Array.from(e.files)),a=w.serializeUploads(e);let g={type:"form",event:s,value:u,uploads:a,cid:l};this.pushWithReply(d,"event",g,m=>{if(h.showError(e,this.liveSocket.binding(le)),h.isUploadInput(e)&&h.isAutoUpload(e)){if(w.filesAwaitingPreflight(e).length>0){let[p,E]=d();this.uploadFiles(e.form,t,p,l,C=>{o&&o(m),this.triggerAwaitingSubmit(e.form)})}}else o&&o(m)})}triggerAwaitingSubmit(e){let t=this.getScheduledSubmit(e);if(t){let[i,s,n,o]=t;this.cancelSubmit(e),o()}}getScheduledSubmit(e){return this.formSubmits.find(([t,i,s,n])=>t.isSameNode(e))}scheduleSubmit(e,t,i,s){if(this.getScheduledSubmit(e))return!0;this.formSubmits.push([e,t,i,s])}cancelSubmit(e){this.formSubmits=this.formSubmits.filter(([t,i,s])=>t.isSameNode(e)?(this.undoRefs(i),!1):!0)}disableForm(e,t={}){let i=f=>!(he(f,`${this.binding(Ee)}=ignore`,f.form)||he(f,"data-phx-update=ignore",f.form)),s=f=>f.hasAttribute(this.binding(Re)),n=f=>f.tagName=="BUTTON",o=f=>["INPUT","TEXTAREA","SELECT"].includes(f.tagName),a=Array.from(e.elements),l=a.filter(s),d=a.filter(n).filter(i),u=a.filter(o).filter(i);return d.forEach(f=>{f.setAttribute(Ie,f.disabled),f.disabled=!0}),u.forEach(f=>{f.setAttribute(ze,f.readOnly),f.readOnly=!0,f.files&&(f.setAttribute(Ie,f.disabled),f.disabled=!0)}),e.setAttribute(this.binding(pt),""),this.putRef([e].concat(l).concat(d).concat(u),"submit",t)}pushFormSubmit(e,t,i,s,n,o){let a=()=>this.disableForm(e,n),l=this.targetComponentID(e,t);if(w.hasUploadsInProgress(e)){let[d,u]=a(),f=()=>this.pushFormSubmit(e,s,t,i,n,o);return this.scheduleSubmit(e,d,n,f)}else if(w.inputsAwaitingPreflight(e).length>0){let[d,u]=a(),f=()=>[d,u,n];this.uploadFiles(e,t,d,l,g=>{let m=this.extractMeta(e),p=ot(e,V({submitter:s},m));this.pushWithReply(f,"event",{type:"form",event:i,value:p,cid:l},o)})}else if(!(e.hasAttribute(R)&&e.classList.contains("phx-submit-loading"))){let d=this.extractMeta(e),u=ot(e,V({submitter:s},d));this.pushWithReply(a,"event",{type:"form",event:i,value:u,cid:l},o)}}uploadFiles(e,t,i,s,n){let o=this.joinCount,a=w.activeFileInputs(e),l=a.length;a.forEach(d=>{let u=new w(d,this,()=>{l--,l===0&&n()});this.uploaders[d]=u;let f=u.entries().map(m=>m.toPreflightPayload()),g={ref:d.getAttribute(J),entries:f,cid:this.targetComponentID(d.form,t)};this.log("upload",()=>["sending preflight request",g]),this.pushWithReply(null,"allow_upload",g,m=>{if(this.log("upload",()=>["got preflight response",m]),m.error){this.undoRefs(i);let[p,E]=m.error;this.log("upload",()=>[`error for entry ${p}`,E])}else{let p=E=>{this.channel.onError(()=>{this.joinCount===o&&E()})};u.initAdapterUpload(m,p,this.liveSocket)}})})}dispatchUploads(e,t){let i=h.findUploadInputs(this.el).filter(s=>s.name===e);i.length===0?T(`no live file inputs found matching the name "${e}"`):i.length>1?T(`duplicate live file inputs found matching the name "${e}"`):h.dispatchEvent(i[0],Je,{detail:{files:t}})}pushFormRecovery(e,t,i){this.liveSocket.withinOwners(e,(s,n)=>{let o=this.binding("change"),a=Array.from(e.elements).filter(u=>h.isFormInput(u)&&u.name&&!u.hasAttribute(o));if(a.length===0)return;let l=a.find(u=>u.type!=="hidden")||a[0],d=e.getAttribute(this.binding(bt))||e.getAttribute(this.binding("change"));H.exec("change",d,s,l,["push",{_target:l.name,newCid:t,callback:i}])})}pushLinkPatch(e,t,i){let s=this.liveSocket.setPendingLink(e),n=t?()=>this.putRef([t],"click"):null,o=()=>this.liveSocket.redirect(window.location.href),a=e.startsWith("/")?`${location.protocol}//${location.host}${e}`:e,l=this.pushWithReply(n,"live_patch",{url:a},d=>{this.liveSocket.requestDOMUpdate(()=>{d.link_redirect?this.liveSocket.replaceMain(e,null,i,s):(this.liveSocket.commitPendingLink(s)&&(this.href=e),this.applyPendingUpdates(),i&&i(s))})});l?l.receive("timeout",o):o()}formsForRecovery(e){if(this.joinCount===0)return[];let t=this.binding("change"),i=document.createElement("template");return i.innerHTML=e,h.all(this.el,`form[${t}]`).filter(s=>s.id&&this.ownsElement(s)).filter(s=>s.elements.length>0).filter(s=>s.getAttribute(this.binding(bt))!=="ignore").map(s=>{let n=s.getAttribute(t).replaceAll(/([\[\]"])/g,"\\$1"),o=i.content.querySelector(`form[id="${s.id}"][${t}="${n}"]`);return o?[s,o,this.targetComponentID(o)]:[s,s,this.targetComponentID(s)]}).filter(([s,n,o])=>n)}maybePushComponentsDestroyed(e){let t=e.filter(i=>h.findComponentNodeList(this.el,i).length===0);t.length>0&&(this.pruningCIDs.push(...t),this.pushWithReply(null,"cids_will_destroy",{cids:t},()=>{this.pruningCIDs=this.pruningCIDs.filter(s=>t.indexOf(s)!==-1);let i=t.filter(s=>h.findComponentNodeList(this.el,s).length===0);i.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:i},s=>{this.rendered.pruneCIDs(s.cids)})}))}ownsElement(e){let t=e.closest(G);return e.getAttribute(Z)===this.id||t&&t.id===this.id||!t&&this.isDead}submitForm(e,t,i,s,n={}){h.putPrivate(e,ve,!0);let o=this.liveSocket.binding(le),a=Array.from(e.elements);a.forEach(l=>h.putPrivate(l,ve,!0)),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(e,t,i,s,n,()=>{a.forEach(l=>h.showError(l,o)),this.liveSocket.restorePreviouslyActiveFocus()})}binding(e){return this.liveSocket.binding(e)}};var at=class{constructor(e,t,i={}){if(this.unloaded=!1,!t||t.constructor.name==="Object")throw new Error(`
a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example:
import {Socket} from "phoenix"
diff --git a/test/phoenix_live_view/upload/channel_test.exs b/test/phoenix_live_view/upload/channel_test.exs
index 4458a756f0..3f1eed834e 100644
--- a/test/phoenix_live_view/upload/channel_test.exs
+++ b/test/phoenix_live_view/upload/channel_test.exs
@@ -347,6 +347,47 @@ defmodule Phoenix.LiveView.UploadChannelTest do
assert {:error, [[_ref, :too_large]]} = render_upload(avatar, "foo.jpeg")
end
+ @tag allow: [max_entries: 1, chunk_size: 20, accept: :any, auto_upload: true]
+ test "render_upload too many files with auto_upload", %{lv: lv} do
+ avatar =
+ file_input(lv, "form", :avatar, [
+ %{name: "foo1.jpeg", content: "bytes"},
+ %{name: "foo2.jpeg", content: "bytes"}
+ ])
+
+ html =
+ lv
+ |> form("form", user: %{})
+ |> render_change(avatar)
+
+ assert html =~ "config_error::too_many_files"
+ assert html =~ "foo1.jpeg:0%"
+ assert html =~ "foo2.jpeg:0%"
+
+ assert render_upload(avatar, "foo1.jpeg") =~ "foo1.jpeg:100%"
+ assert {:error, :not_allowed} = render_upload(avatar, "foo2.jpeg")
+ end
+
+ @tag allow: [
+ max_entries: 1,
+ chunk_size: 20,
+ accept: :any,
+ max_file_size: 1,
+ auto_upload: true
+ ]
+ test "render_upload invalid with auto_upload", %{lv: lv} do
+ avatar = file_input(lv, "form", :avatar, [%{name: "foo.jpeg", content: "overmax"}])
+
+ html = lv
+ |> form("form", user: %{})
+ |> render_change(avatar)
+
+ assert html =~ "entry_error::too_large"
+ assert html =~ "foo.jpeg:0%"
+
+ assert {:error, [[_ref, :too_large]]} = render_upload(avatar, "foo.jpeg")
+ end
+
@tag allow: [max_entries: 1, chunk_size: 20, accept: :any]
test "render_change success with upload", %{lv: lv} do
avatar = file_input(lv, "form", :avatar, [%{name: "foo.jpeg", content: "ok"}])
diff --git a/test/phoenix_live_view/upload/config_test.exs b/test/phoenix_live_view/upload/config_test.exs
index 7cf2adefc8..81eb2ebb9c 100644
--- a/test/phoenix_live_view/upload/config_test.exs
+++ b/test/phoenix_live_view/upload/config_test.exs
@@ -167,9 +167,14 @@ defmodule Phoenix.LiveView.UploadConfigTest do
socket = LiveView.allow_upload(build_socket(), :avatar, accept: :any)
{:ok, socket} =
- LiveView.Upload.put_entries(socket, socket.assigns.uploads.avatar, [
- build_client_entry(:avatar, %{"size" => 1024})
- ], nil)
+ LiveView.Upload.put_entries(
+ socket,
+ socket.assigns.uploads.avatar,
+ [
+ build_client_entry(:avatar, %{"size" => 1024})
+ ],
+ nil
+ )
assert_raise RuntimeError, ~r/unable to disallow_upload/, fn ->
LiveView.disallow_upload(socket, :avatar)
@@ -297,17 +302,16 @@ defmodule Phoenix.LiveView.UploadConfigTest do
%UploadEntry{client_name: "photo.JPEG"}
] = config.entries
+ assert {:ok, config} =
+ UploadConfig.put_entries(socket.assigns.uploads.audio, [
+ build_client_entry(:audio, %{"name" => "audio.wav", "type" => "audio/wav"}),
+ build_client_entry(:audio, %{"name" => "audio.WAV", "type" => "audio/wav"})
+ ])
- assert {:ok, config} =
- UploadConfig.put_entries(socket.assigns.uploads.audio, [
- build_client_entry(:audio, %{"name" => "audio.wav", "type" => "audio/wav"}),
- build_client_entry(:audio, %{"name" => "audio.WAV", "type" => "audio/wav"})
- ])
-
- assert [
- %UploadEntry{client_name: "audio.wav"},
- %UploadEntry{client_name: "audio.WAV"}
- ] = config.entries
+ assert [
+ %UploadEntry{client_name: "audio.wav"},
+ %UploadEntry{client_name: "audio.WAV"}
+ ] = config.entries
hero_config = socket.assigns.uploads.hero
entry = build_client_entry(:avatar, %{"name" => "file.gif"})
diff --git a/test/phoenix_live_view/upload/external_test.exs b/test/phoenix_live_view/upload/external_test.exs
index 6ac780be78..b03265c00c 100644
--- a/test/phoenix_live_view/upload/external_test.exs
+++ b/test/phoenix_live_view/upload/external_test.exs
@@ -84,6 +84,47 @@ defmodule Phoenix.LiveView.UploadExternalTest do
assert render(lv) =~ "preflight:#{UploadLive.inspect_html_safe("foo2.jpeg")}"
end
+ @tag allow: [max_entries: 1, chunk_size: 20, accept: :any, external: :preflight]
+ test "external with too many entries", %{lv: lv} do
+ avatar =
+ file_input(lv, "form", :avatar, [
+ %{name: "foo1.jpeg", content: String.duplicate("ok", 100)},
+ %{name: "foo2.jpeg", content: String.duplicate("ok", 100)}
+ ])
+
+ assert lv
+ |> form("form", user: %{})
+ |> render_change(avatar) =~ "foo1.jpeg:0%"
+
+ assert {:error, [[_ref, :too_many_files]]} = render_upload(avatar, "foo1.jpeg", 1)
+ end
+
+ @tag allow: [
+ max_entries: 1,
+ chunk_size: 20,
+ auto_upload: true,
+ accept: :any,
+ external: :preflight
+ ]
+ test "external auto upload with too many entries", %{lv: lv} do
+ avatar =
+ file_input(lv, "form", :avatar, [
+ %{name: "foo1.jpeg", content: String.duplicate("ok", 100)},
+ %{name: "foo2.jpeg", content: String.duplicate("ok", 100)}
+ ])
+
+ html =
+ lv
+ |> form("form", user: %{})
+ |> render_change(avatar)
+
+ assert html =~ "foo1.jpeg:0%"
+ assert html =~ "foo2.jpeg:0%"
+
+ assert render_upload(avatar, "foo1.jpeg", 1) =~ "foo1.jpeg:1%"
+ assert {:error, :not_allowed} = render_upload(avatar, "foo2.jpeg", 1)
+ end
+
def bad_preflight(%LiveView.UploadEntry{} = _entry, socket), do: {:ok, %{}, socket}
@tag allow: [max_entries: 1, chunk_size: 20, accept: :any, external: :bad_preflight]
@@ -92,8 +133,8 @@ defmodule Phoenix.LiveView.UploadExternalTest do
file_input(lv, "form", :avatar, [%{name: "foo.jpeg", content: String.duplicate("ok", 100)}])
assert UploadLive.exits_with(lv, avatar, ArgumentError, fn ->
- render_upload(avatar, "foo.jpeg", 1) =~ "foo.jpeg:1%"
- end) =~ "external uploader metadata requires an :uploader key."
+ render_upload(avatar, "foo.jpeg", 1) =~ "foo.jpeg:1%"
+ end) =~ "external uploader metadata requires an :uploader key."
end
def error_preflight(%LiveView.UploadEntry{} = entry, socket) do
@@ -117,10 +158,31 @@ defmodule Phoenix.LiveView.UploadExternalTest do
assert render(lv) =~ "bad name"
end
+ @tag allow: [
+ max_entries: 2,
+ chunk_size: 20,
+ auto_upload: true,
+ accept: :any,
+ external: :error_preflight
+ ]
+ test "preflight with auto_upload with error return", %{lv: lv} do
+ avatar =
+ file_input(lv, "form", :avatar, [
+ %{name: "foo.jpeg", content: String.duplicate("ok", 100)},
+ %{name: "bad.jpeg", content: String.duplicate("ok", 100)}
+ ])
+
+ assert {:error, [[_, %{reason: "bad name"}]]} = render_upload(avatar, "bad.jpeg", 1)
+ html = render_upload(avatar, "foo.jpeg", 1)
+ assert html =~ "foo.jpeg:1%"
+ assert html =~ "bad.jpeg:0%"
+ end
+
@tag allow: [max_entries: 2, chunk_size: 20, accept: :any, external: :preflight]
test "consume_uploaded_entries", %{lv: lv} do
upload_complete = "foo.jpeg:100%"
parent = self()
+
avatar =
file_input(lv, "form", :avatar, [%{name: "foo.jpeg", content: String.duplicate("ok", 100)}])
@@ -130,6 +192,7 @@ defmodule Phoenix.LiveView.UploadExternalTest do
Phoenix.LiveView.consume_uploaded_entries(socket, :avatar, fn meta, entry ->
{:ok, send(parent, {:consume, meta, entry.client_name})}
end)
+
{:reply, :ok, socket}
end)
@@ -141,6 +204,7 @@ defmodule Phoenix.LiveView.UploadExternalTest do
test "consume_uploaded_entry", %{lv: lv} do
upload_complete = "foo.jpeg:100%"
parent = self()
+
avatar =
file_input(lv, "form", :avatar, [%{name: "foo.jpeg", content: String.duplicate("ok", 100)}])
@@ -148,9 +212,11 @@ defmodule Phoenix.LiveView.UploadExternalTest do
run(lv, fn socket ->
{[entry], []} = Phoenix.LiveView.uploaded_entries(socket, :avatar)
+
Phoenix.LiveView.consume_uploaded_entry(socket, entry, fn meta ->
{:ok, send(parent, {:individual_consume, meta, entry.client_name})}
end)
+
{:reply, :ok, socket}
end)
@@ -158,7 +224,13 @@ defmodule Phoenix.LiveView.UploadExternalTest do
refute render(lv) =~ upload_complete
end
- @tag allow: [max_entries: 5, chunk_size: 20, accept: :any, external: :preflight, progress: :consume]
+ @tag allow: [
+ max_entries: 5,
+ chunk_size: 20,
+ accept: :any,
+ external: :preflight,
+ progress: :consume
+ ]
test "consume_uploaded_entry/3 maintains entries state after drop", %{lv: lv} do
parent = self()