diff --git a/static/assets/app.js b/static/assets/app.js index 9799c3f51..466c0f81a 100644 --- a/static/assets/app.js +++ b/static/assets/app.js @@ -13,7 +13,7 @@ removing illegal node: "${(n.outerHTML||n.nodeValue).trim()}" import {Socket} from "phoenix" import {LiveSocket} from "phoenix_live_view" let liveSocket = new LiveSocket("/live", Socket, {...}) - `);this.socket=new e(t,i),this.bindingPrefix=i.bindingPrefix||LD,this.opts=i,this.params=vc(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(Dh(DD),i.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.outgoingMainEl=null,this.clickStartedAtTarget=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=Dh(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||$D,this.disconnectedTimeout=i.disconnectedTimeout||RD,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||yD,this.reloadJitterMin=i.reloadJitterMin||xD,this.reloadJitterMax=i.reloadJitterMax||vD,this.failsafeJitter=i.failsafeJitter||wD,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.boundEventNames=new Set,this.serverCloseRef=null,this.domCallbacks=Object.assign({jsQuerySelectorAll:null,onPatchStart:vc(),onPatchEnd:vc(),onNodeAdded:vc(),onBeforeElUpdated:vc()},i.dom||{}),this.transitions=new b8,this.currentHistoryPosition=parseInt(this.sessionStorage.getItem(_h))||0,window.addEventListener("pagehide",n=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.0.7"}isProfileEnabled(){return this.sessionStorage.getItem(Dg)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(Qh)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(Qh)==="false"}enableDebug(){this.sessionStorage.setItem(Qh,"true")}enableProfiling(){this.sessionStorage.setItem(Dg,"true")}disableDebug(){this.sessionStorage.setItem(Qh,"false")}disableProfiling(){this.sessionStorage.removeItem(Dg)}enableLatencySim(t){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(zg,t)}disableLatencySim(){this.sessionStorage.removeItem(zg)}getLatencySim(){let t=this.sessionStorage.getItem(zg);return t?parseInt(t):null}getSocket(){return this.socket}connect(){window.location.hostname==="localhost"&&!this.isDebugDisabled()&&this.enableDebug();let t=()=>{this.resetReloadStatus(),this.joinRootViews()?(this.bindTopLevelEvents(),this.socket.connect()):this.main?this.socket.connect():this.bindTopLevelEvents({dead:!0}),this.joinDeadView()};["complete","loaded","interactive"].indexOf(document.readyState)>=0?t():document.addEventListener("DOMContentLoaded",()=>t())}disconnect(t){clearTimeout(this.reloadWithJitterTimer),this.serverCloseRef&&(this.socket.off(this.serverCloseRef),this.serverCloseRef=null),this.socket.disconnect(t)}replaceTransport(t){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(t),this.connect()}execJS(t,e,i=null){let n=new CustomEvent("phx:exec",{detail:{sourceElement:t}});this.owner(t,r=>bt.exec(n,i,e,r,t))}execJSHookPush(t,e,i,n){this.withinOwners(t,r=>{let o=new CustomEvent("phx:exec",{detail:{sourceElement:t}});bt.exec(o,"hook",e,r,t,["push",{data:i,callback:n}])})}unload(){this.unloaded||(this.main&&this.isConnected()&&this.log(this.main,"socket",()=>["disconnect for page nav"]),this.unloaded=!0,this.destroyAllViews(),this.disconnect())}triggerDOM(t,e){this.domCallbacks[t](...e)}time(t,e){if(!this.isProfileEnabled()||!console.time)return e();console.time(t);let i=e();return console.timeEnd(t),i}log(t,e,i){if(this.viewLogger){let[n,r]=i();this.viewLogger(t,e,n,r)}else if(this.isDebugEnabled()){let[n,r]=i();qD(t,e,n,r)}}requestDOMUpdate(t){this.transitions.after(t)}transition(t,e,i=function(){}){this.transitions.addTransition(t,e,i)}onChannel(t,e,i){t.on(e,n=>{let r=this.getLatencySim();r?setTimeout(()=>i(n),r):i(n)})}reloadWithJitter(t,e){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,n=this.reloadJitterMax,r=Math.floor(Math.random()*(n-i+1))+i,o=zi.updateLocal(this.localStorage,window.location.pathname,VS,0,s=>s+1);o>=this.maxReloads&&(r=this.failsafeJitter),this.reloadWithJitterTimer=setTimeout(()=>{t.isDestroyed()||t.isConnected()||(t.destroy(),e?e():this.log(t,"join",()=>[`encountered ${o} consecutive reloads`]),o>=this.maxReloads&&this.log(t,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),this.hasPendingLink()?window.location=this.pendingLink:window.location.reload())},r)}getHookCallbacks(t){return t&&t.startsWith("Phoenix.")?HD[t.split(".")[1]]:this.hooks[t]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(t){return`${this.getBindingPrefix()}${t}`}channel(t,e){return this.socket.channel(t,e)}joinDeadView(){let t=document.body;if(t&&!this.isPhxView(t)&&!this.isPhxView(document.firstElementChild)){let e=this.newRootView(t);e.setHref(this.getHref()),e.joinDead(),this.main||(this.main=e),window.requestAnimationFrame(()=>{var i;e.execNewMounted(),this.maybeScroll((i=history.state)==null?void 0:i.scroll)})}}joinRootViews(){let t=!1;return G.all(document,`${ws}:not([${vs}])`,e=>{if(!this.getRootById(e.id)){let i=this.newRootView(e);G.isPhxSticky(e)||i.setHref(this.getHref()),i.join(),e.hasAttribute(Yg)&&(this.main=i)}t=!0}),t}redirect(t,e,i){i&&zi.setCookie(SS,i,60),this.unload(),zi.redirect(t,e)}replaceMain(t,e,i=null,n=this.setPendingLink(t)){let r=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let o=G.findPhxSticky(document)||[],s=G.all(this.outgoingMainEl,`[${this.binding("remove")}]`).filter(l=>!G.isChildOfAny(l,o)),a=G.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(a,e,r),this.main.setRedirect(t),this.transitionRemoves(s),this.main.join((l,c)=>{l===1&&this.commitPendingLink(n)&&this.requestDOMUpdate(()=>{s.forEach(u=>u.remove()),o.forEach(u=>a.appendChild(u)),this.outgoingMainEl.replaceWith(a),this.outgoingMainEl=null,i&&i(n),c()})})}transitionRemoves(t,e){let i=this.binding("remove"),n=r=>{r.preventDefault(),r.stopImmediatePropagation()};t.forEach(r=>{for(let o of this.boundEventNames)r.addEventListener(o,n,!0);this.execJS(r,r.getAttribute(i),"remove")}),this.requestDOMUpdate(()=>{t.forEach(r=>{for(let o of this.boundEventNames)r.removeEventListener(o,n,!0)}),e&&e()})}isPhxView(t){return t.getAttribute&&t.getAttribute(or)!==null}newRootView(t,e,i){let n=new g8(t,this,null,e,i);return this.roots[n.id]=n,n}owner(t,e){let i=So(t.closest(ws),n=>this.getViewByEl(n))||this.main;return i&&e?e(i):i}withinOwners(t,e){this.owner(t,i=>e(i,t))}getViewByEl(t){let e=t.getAttribute(To);return So(this.getRootById(e),i=>i.getDescendentByEl(t))}getRootById(t){return this.roots[t]}destroyAllViews(){for(let t in this.roots)this.roots[t].destroy(),delete this.roots[t];this.main=null}destroyViewByEl(t){let e=this.getRootById(t.getAttribute(To));e&&e.id===t.id?(e.destroy(),delete this.roots[e.id]):e&&e.destroyDescendent(t.id)}getActiveElement(){return document.activeElement}dropActiveElement(t){this.prevActive&&t.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive.blur()}bindTopLevelEvents({dead:t}={}){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.serverCloseRef=this.socket.onClose(e=>{if(e&&e.code===1e3&&this.main)return this.reloadWithJitter(this.main)}),document.body.addEventListener("click",function(){}),window.addEventListener("pageshow",e=>{e.persisted&&(this.getSocket().disconnect(),this.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())},!0),t||this.bindNav(),this.bindClicks(),t||this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(e,i,n,r,o,s)=>{let a=r.getAttribute(this.binding(_D)),l=e.key&&e.key.toLowerCase();if(a&&a.toLowerCase()!==l)return;let c=F({key:e.key},this.eventMeta(i,e,r));bt.exec(e,i,o,n,r,["push",{data:c}])}),this.bind({blur:"focusout",focus:"focusin"},(e,i,n,r,o,s)=>{if(!s){let a=F({key:e.key},this.eventMeta(i,e,r));bt.exec(e,i,o,n,r,["push",{data:a}])}}),this.bind({blur:"blur",focus:"focus"},(e,i,n,r,o,s)=>{if(s==="window"){let a=this.eventMeta(i,e,r);bt.exec(e,i,o,n,r,["push",{data:a}])}}),this.on("dragover",e=>e.preventDefault()),this.on("drop",e=>{e.preventDefault();let i=So(Tc(e.target,this.binding(mS)),o=>o.getAttribute(this.binding(mS))),n=i&&document.getElementById(i),r=Array.from(e.dataTransfer.files||[]);!n||n.disabled||r.length===0||!(n.files instanceof FileList)||(Jt.trackFiles(n,r,e.dataTransfer),n.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(BS,e=>{let i=e.target;if(!G.isUploadInput(i))return;let n=Array.from(e.detail.files||[]).filter(r=>r instanceof File||r instanceof Blob);Jt.trackFiles(i,n),i.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(t,e,i){let n=this.metadataCallbacks[t];return n?n(e,i):{}}setPendingLink(t){return this.linkRef++,this.pendingLink=t,this.resetReloadStatus(),this.linkRef}resetReloadStatus(){zi.deleteCookie(SS)}commitPendingLink(t){return this.linkRef!==t?!1:(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(t,e){for(let i in t){let n=t[i];this.on(n,r=>{let o=this.binding(i),s=this.binding(`window-${i}`),a=r.target.getAttribute&&r.target.getAttribute(o);a?this.debounce(r.target,r,n,()=>{this.withinOwners(r.target,l=>{e(r,i,l,r.target,a,null)})}):G.all(document,`[${s}]`,l=>{let c=l.getAttribute(s);this.debounce(l,r,n,()=>{this.withinOwners(l,u=>{e(r,i,u,l,c,"window")})})})})}}bindClicks(){this.on("mousedown",t=>this.clickStartedAtTarget=t.target),this.bindClick("click","click")}bindClick(t,e){let i=this.binding(e);window.addEventListener(t,n=>{let r=null;n.detail===0&&(this.clickStartedAtTarget=n.target);let o=this.clickStartedAtTarget||n.target;r=Tc(n.target,i),this.dispatchClickAway(n,o),this.clickStartedAtTarget=null;let s=r&&r.getAttribute(i);if(!s){G.isNewPageClick(n,window.location)&&this.unload();return}r.getAttribute("href")==="#"&&n.preventDefault(),!r.hasAttribute(pn)&&this.debounce(r,n,"click",()=>{this.withinOwners(r,a=>{bt.exec(n,"click",s,a,r,["push",{data:this.eventMeta("click",n,r)}])})})},!1)}dispatchClickAway(t,e){let i=this.binding("click-away");G.all(document,`[${i}]`,n=>{n.isSameNode(e)||n.contains(e)||this.withinOwners(n,r=>{let o=n.getAttribute(i);bt.isVisible(n)&&bt.isInViewport(n)&&bt.exec(t,"click",o,r,n,["push",{data:this.eventMeta("click",t,t.target)}])})})}bindNav(){if(!zi.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let t=null;window.addEventListener("scroll",e=>{clearTimeout(t),t=setTimeout(()=>{zi.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",e=>{if(!this.registerNewLocation(window.location))return;let{type:i,backType:n,id:r,scroll:o,position:s}=e.state||{},a=window.location.href,l=s>this.currentHistoryPosition;i=l?i:n||i,this.currentHistoryPosition=s||0,this.sessionStorage.setItem(_h,this.currentHistoryPosition.toString()),G.dispatchEvent(window,"phx:navigate",{detail:{href:a,patch:i==="patch",pop:!0,direction:l?"forward":"backward"}}),this.requestDOMUpdate(()=>{let c=()=>{this.maybeScroll(o)};this.main.isConnected()&&i==="patch"&&r===this.main.id?this.main.pushLinkPatch(e,a,null,c):this.replaceMain(a,null,c)})},!1),window.addEventListener("click",e=>{let i=Tc(e.target,Lg),n=i&&i.getAttribute(Lg);if(!n||!this.isConnected()||!this.main||G.wantsNewTab(e))return;let r=i.href instanceof SVGAnimatedString?i.href.baseVal:i.href,o=i.getAttribute(SD);e.preventDefault(),e.stopImmediatePropagation(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if(n==="patch")this.pushHistoryPatch(e,r,o,i);else if(n==="redirect")this.historyRedirect(e,r,o,null,i);else throw new Error(`expected ${Lg} to be "patch" or "redirect", got: ${n}`);let s=i.getAttribute(this.binding("click"));s&&this.requestDOMUpdate(()=>this.execJS(i,s,"click"))})},!1)}maybeScroll(t){typeof t=="number"&&requestAnimationFrame(()=>{window.scrollTo(0,t)})}dispatchEvent(t,e={}){G.dispatchEvent(window,`phx:${t}`,{detail:e})}dispatchEvents(t){t.forEach(([e,i])=>this.dispatchEvent(e,i))}withPageLoading(t,e){G.dispatchEvent(window,"phx:page-loading-start",{detail:t});let i=()=>G.dispatchEvent(window,"phx:page-loading-stop",{detail:t});return e?e(i):i}pushHistoryPatch(t,e,i,n){if(!this.isConnected()||!this.main.isMain())return zi.redirect(e);this.withPageLoading({to:e,kind:"patch"},r=>{this.main.pushLinkPatch(t,e,n,o=>{this.historyPatch(e,i,o),r()})})}historyPatch(t,e,i=this.setPendingLink(t)){this.commitPendingLink(i)&&(this.currentHistoryPosition++,this.sessionStorage.setItem(_h,this.currentHistoryPosition.toString()),zi.updateCurrentState(n=>Ee(F({},n),{backType:"patch"})),zi.pushState(e,{type:"patch",id:this.main.id,position:this.currentHistoryPosition},t),G.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:t,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location))}historyRedirect(t,e,i,n,r){let o=r&&t.isTrusted&&t.type!=="popstate";if(o&&r.classList.add("phx-click-loading"),!this.isConnected()||!this.main.isMain())return zi.redirect(e,n);if(/^\/$|^\/[^\/]+.*$/.test(e)){let{protocol:a,host:l}=window.location;e=`${a}//${l}${e}`}let s=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},a=>{this.replaceMain(e,n,l=>{l===this.linkRef&&(this.currentHistoryPosition++,this.sessionStorage.setItem(_h,this.currentHistoryPosition.toString()),zi.updateCurrentState(c=>Ee(F({},c),{backType:"redirect"})),zi.pushState(i,{type:"redirect",id:this.main.id,scroll:s,position:this.currentHistoryPosition},e),G.dispatchEvent(window,"phx:navigate",{detail:{href:e,patch:!1,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location)),o&&r.classList.remove("phx-click-loading"),a()})})}registerNewLocation(t){let{pathname:e,search:i}=this.currentLocation;return e+i===t.pathname+t.search?!1:(this.currentLocation=Dh(t),!0)}bindForms(){let t=0,e=!1;this.on("submit",i=>{let n=i.target.getAttribute(this.binding("submit")),r=i.target.getAttribute(this.binding("change"));!e&&r&&!n&&(e=!0,i.preventDefault(),this.withinOwners(i.target,o=>{o.disableForm(i.target),window.requestAnimationFrame(()=>{G.isUnloadableFormSubmit(i)&&this.unload(),i.target.submit()})}))}),this.on("submit",i=>{let n=i.target.getAttribute(this.binding("submit"));if(!n){G.isUnloadableFormSubmit(i)&&this.unload();return}i.preventDefault(),i.target.disabled=!0,this.withinOwners(i.target,r=>{bt.exec(i,"submit",n,r,i.target,["push",{submitter:i.submitter}])})});for(let i of["change","input"])this.on(i,n=>{if(n instanceof CustomEvent&&n.target.form===void 0){if(n.detail&&n.detail.dispatcher)throw new Error(`dispatching a custom ${i} event is only supported on input elements inside a form`);return}let r=this.binding("change"),o=n.target;if(n.isComposing){let O=`composition-listener-${i}`;G.private(o,O)||(G.putPrivate(o,O,!0),o.addEventListener("compositionend",()=>{o.dispatchEvent(new Event(i,{bubbles:!0})),G.deletePrivate(o,O)},{once:!0}));return}let s=o.getAttribute(r),a=o.form&&o.form.getAttribute(r),l=s||a;if(!l||o.type==="number"&&o.validity&&o.validity.badInput)return;let c=s?o:o.form,u=t;t++;let{at:f,type:d}=G.private(o,"prev-iteration")||{};f===u-1&&i==="change"&&d==="input"||(G.putPrivate(o,"prev-iteration",{at:u,type:i}),this.debounce(o,n,i,()=>{this.withinOwners(c,O=>{G.putPrivate(o,zh,!0),bt.exec(n,"change",l,O,o,["push",{_target:n.target.name,dispatcher:c}])})}))});this.on("reset",i=>{let n=i.target;G.resetForm(n);let r=Array.from(n.elements).find(o=>o.type==="reset");r&&window.requestAnimationFrame(()=>{r.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(t,e,i,n){if(i==="blur"||i==="focusout")return n();let r=this.binding(PD),o=this.binding(QD),s=this.defaults.debounce.toString(),a=this.defaults.throttle.toString();this.withinOwners(t,l=>{let c=()=>!l.isDestroyed()&&document.body.contains(t);G.debounce(t,e,r,s,o,a,c,()=>{n()})})}silenceEvents(t){this.silenced=!0,t(),this.silenced=!1}on(t,e){this.boundEventNames.add(t),window.addEventListener(t,i=>{this.silenced||e(i)})}jsQuerySelectorAll(t,e,i){let n=this.domCallbacks.jsQuerySelectorAll;return n?n(t,e,i):i()}},b8=class{constructor(){this.transitions=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(t=>{clearTimeout(t),this.transitions.delete(t)}),this.flushPendingOps()}after(t){this.size()===0?t():this.pushPendingOp(t)}addTransition(t,e,i){e();let n=setTimeout(()=>{this.transitions.delete(n),i(),this.flushPendingOps()},t);this.transitions.add(n)}pushPendingOp(t){this.pendingOps.push(t)}size(){return this.transitions.size}flushPendingOps(){if(this.size()>0)return;let t=this.pendingOps.shift();t&&(t(),this.flushPendingOps())}};var tT="livebook:";function ks(t){try{let e=localStorage.getItem(tT+t);if(e)return JSON.parse(e)}catch(e){console.error(`Failed to load from local storage, reason: ${e.message}`)}}function za(t,e){try{let i=JSON.stringify(e);localStorage.setItem(tT+t,i)}catch(i){console.error(`Failed to write to local storage, reason: ${i.message}`)}}var iT="app_auth_token:";function nT(t,e){za(iT+t,e)}function rT(){let t=window.location.pathname;if(t.startsWith("/apps/")){let e=t.split("/")[2],i=ks(iT+e);if(i)return i}return null}var y8={mounted(){this.handleEvent("persist_app_auth",({slug:t,token:e})=>{nT(t,e),this.pushEvent("app_auth_persisted")})}},oT=y8;function Ot(t,e){let i={};for(let n of e){let r=`data-p-${n}`;if(!t.hasAttribute(r))throw new Error(`Missing attribute "${r}" on element <${t.tagName}:${t.id}>`);let o=t.getAttribute(r);i[x8(n)]=JSON.parse(o)}return i}function x8(t){let[e,...i]=t.split("-");return[e,...i.map(n=>n.charAt(0).toUpperCase()+n.slice(1))].join("")}function sT(t,e,i){let r=new ArrayBuffer(44+t.byteLength),o=new DataView(r),s=t.byteLength/4,a=4,l=e*a,c=i*l,u=s*l,f=0;function d(w){o.setUint32(f,w,!1),f+=4}function O(w){o.setUint32(f,w,!0),f+=4}function m(w){o.setUint16(f,w,!0),f+=2}function x(w){o.setFloat32(f,w,!0),f+=4}d(1380533830),O(36+u),d(1463899717),d(1718449184),O(16),m(3),m(e),O(i),O(c),m(l),m(a*8),d(1684108385),O(u);let v=new Float32Array(t);for(let w=0;w{this.inputEl.click()}),this.inputEl.addEventListener("change",t=>{let[e]=t.target.files;e&&this.loadFile(e)}),this.el.addEventListener("dragover",t=>{t.stopPropagation(),t.preventDefault(),t.dataTransfer.dropEffect="copy"}),this.el.addEventListener("drop",t=>{t.stopPropagation(),t.preventDefault();let[e]=t.dataTransfer.files;e&&!this.isRecording()&&this.loadFile(e)}),this.el.addEventListener("dragenter",t=>{this.el.classList.add(...Gg)}),this.el.addEventListener("dragleave",t=>{this.el.contains(t.relatedTarget)||this.el.classList.remove(...Gg)}),this.el.addEventListener("drop",t=>{this.el.classList.remove(...Gg)}),this.recordButton.addEventListener("click",t=>{this.startRecording()}),this.stopButton.addEventListener("click",t=>{this.stopRecording()}),this.cancelButton.addEventListener("click",t=>{this.stopRecording(!1)})},updated(){this.props=this.getProps(),this.audioEl.src=this.props.audioUrl},getProps(){return Ot(this.el,["id","phx-target","sampling-rate","endianness","format","audio-url"])},startRecording(){this.audioEl.classList.add("hidden"),this.uploadButton.classList.add("hidden"),this.recordButton.classList.add("hidden"),this.stopButton.classList.remove("hidden"),this.cancelButton.classList.remove("hidden"),this.audioChunks=[],navigator.mediaDevices.getUserMedia({audio:!0}).then(t=>{this.mediaRecorder=new MediaRecorder(t),this.mediaRecorder.addEventListener("dataavailable",e=>{this.audioChunks.push(e.data)}),this.mediaRecorder.start()})},stopRecording(t=!0){this.audioEl.classList.remove("hidden"),this.uploadButton.classList.remove("hidden"),this.recordButton.classList.remove("hidden"),this.stopButton.classList.add("hidden"),this.cancelButton.classList.add("hidden"),t&&this.mediaRecorder.addEventListener("stop",e=>{new Blob(this.audioChunks).arrayBuffer().then(n=>{this.loadEncodedAudio(n)})}),this.mediaRecorder.stop()},isRecording(){return this.mediaRecorder&&this.mediaRecorder.state==="recording"},loadFile(t){let e=new FileReader;e.onload=i=>{this.loadEncodedAudio(i.target.result)},e.readAsArrayBuffer(t)},loadEncodedAudio(t){this.pushEventTo(this.props.phxTarget,"decoding",{}),new AudioContext({sampleRate:this.props.samplingRate}).decodeAudioData(t,i=>{let n=w8(i);this.pushAudio(n)})},pushAudio(t){let e={num_channels:t.numChannels,sampling_rate:t.samplingRate},i=this.encodeAudio(t),n=new Blob([i]);n.meta=()=>e,this.uploadTo(this.props.phxTarget,"file",[n])},encodeAudio(t){if(this.props.format==="pcm_f32")return k8(t.data,this.props.endianness);if(this.props.format==="wav")return sT(t.data,t.numChannels,t.samplingRate)}};function w8(t){let e=t.numberOfChannels,i=t.sampleRate,n=t.length,r=4*e*n,o=new ArrayBuffer(r),s=new Float32Array(o);for(let a=0;a=0;l--)n=i[l],r=n.name,o=n.namespaceURI,s=n.value,o?(r=n.localName||r,a=t.getAttributeNS(o,r),a!==s&&(n.prefix==="xmlns"&&(r=n.name),t.setAttributeNS(o,r,s))):(a=t.getAttribute(r),a!==s&&t.setAttribute(r,s));for(var c=t.attributes,u=c.length-1;u>=0;u--)n=c[u],r=n.name,o=n.namespaceURI,o?(r=n.localName||r,e.hasAttributeNS(o,r)||t.removeAttributeNS(o,r)):e.hasAttribute(r)||t.removeAttribute(r)}}var Nh,E8="http://www.w3.org/1999/xhtml",Ni=typeof document=="undefined"?void 0:document,C8=!!Ni&&"content"in Ni.createElement("template"),P8=!!Ni&&Ni.createRange&&"createContextualFragment"in Ni.createRange();function Q8(t){var e=Ni.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}function _8(t){Nh||(Nh=Ni.createRange(),Nh.selectNode(Ni.body));var e=Nh.createContextualFragment(t);return e.childNodes[0]}function A8(t){var e=Ni.createElement("body");return e.innerHTML=t,e.childNodes[0]}function $8(t){return t=t.trim(),C8?Q8(t):P8?_8(t):A8(t)}function qh(t,e){var i=t.nodeName,n=e.nodeName,r,o;return i===n?!0:(r=i.charCodeAt(0),o=n.charCodeAt(0),r<=90&&o>=97?i===n.toUpperCase():o<=90&&r>=97?n===i.toUpperCase():!1)}function X8(t,e){return!e||e===E8?Ni.createElement(t):Ni.createElementNS(e,t)}function R8(t,e){for(var i=t.firstChild;i;){var n=i.nextSibling;e.appendChild(i),i=n}return e}function Kg(t,e,i){t[i]!==e[i]&&(t[i]=e[i],t[i]?t.setAttribute(i,""):t.removeAttribute(i))}var fT={OPTION:function(t,e){var i=t.parentNode;if(i){var n=i.nodeName.toUpperCase();n==="OPTGROUP"&&(i=i.parentNode,n=i&&i.nodeName.toUpperCase()),n==="SELECT"&&!i.hasAttribute("multiple")&&(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),i.selectedIndex=-1)}Kg(t,e,"selected")},INPUT:function(t,e){Kg(t,e,"checked"),Kg(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var i=e.value;t.value!==i&&(t.value=i);var n=t.firstChild;if(n){var r=n.nodeValue;if(r==i||!i&&r==t.placeholder)return;n.nodeValue=i}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var i=-1,n=0,r=t.firstChild,o,s;r;)if(s=r.nodeName&&r.nodeName.toUpperCase(),s==="OPTGROUP")o=r,r=o.firstChild;else{if(s==="OPTION"){if(r.hasAttribute("selected")){i=n;break}n++}r=r.nextSibling,!r&&o&&(r=o.nextSibling,o=null)}t.selectedIndex=i}}},Pc=1,hT=11,dT=3,OT=8;function Eo(){}function L8(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function I8(t){return function(i,n,r){if(r||(r={}),typeof n=="string")if(i.nodeName==="#document"||i.nodeName==="HTML"||i.nodeName==="BODY"){var o=n;n=Ni.createElement("html"),n.innerHTML=o}else n=$8(n);else n.nodeType===hT&&(n=n.firstElementChild);var s=r.getNodeKey||L8,a=r.onBeforeNodeAdded||Eo,l=r.onNodeAdded||Eo,c=r.onBeforeElUpdated||Eo,u=r.onElUpdated||Eo,f=r.onBeforeNodeDiscarded||Eo,d=r.onNodeDiscarded||Eo,O=r.onBeforeElChildrenUpdated||Eo,m=r.skipFromChildren||Eo,x=r.addChild||function(j,ue){return j.appendChild(ue)},v=r.childrenOnly===!0,w=Object.create(null),T=[];function A(j){T.push(j)}function L(j,ue){if(j.nodeType===Pc)for(var Z=j.firstChild;Z;){var P=void 0;ue&&(P=s(Z))?A(P):(d(Z),Z.firstChild&&L(Z,ue)),Z=Z.nextSibling}}function D(j,ue,Z){f(j)!==!1&&(ue&&ue.removeChild(j),d(j),L(j,Z))}function C(j){if(j.nodeType===Pc||j.nodeType===hT)for(var ue=j.firstChild;ue;){var Z=s(ue);Z&&(w[Z]=ue),C(ue),ue=ue.nextSibling}}C(i);function N(j){l(j);for(var ue=j.firstChild;ue;){var Z=ue.nextSibling,P=s(ue);if(P){var W=w[P];W&&qh(ue,W)?(ue.parentNode.replaceChild(W,ue),H(W,ue)):N(ue)}else N(ue);ue=Z}}function le(j,ue,Z){for(;ue;){var P=ue.nextSibling;(Z=s(ue))?A(Z):D(ue,j,!0),ue=P}}function H(j,ue,Z){var P=s(ue);if(P&&delete w[P],!Z){var W=c(j,ue);if(W===!1||(W instanceof HTMLElement&&(j=W,C(j)),t(j,ue),u(j),O(j,ue)===!1))return}j.nodeName!=="TEXTAREA"?M(j,ue):fT.TEXTAREA(j,ue)}function M(j,ue){var Z=m(j,ue),P=ue.firstChild,W=j.firstChild,oe,I,Ne,We,Ve;e:for(;P;){for(We=P.nextSibling,oe=s(P);!Z&&W;){if(Ne=W.nextSibling,P.isSameNode&&P.isSameNode(W)){P=We,W=Ne;continue e}I=s(W);var Et=W.nodeType,Xe=void 0;if(Et===P.nodeType&&(Et===Pc?(oe?oe!==I&&((Ve=w[oe])?Ne===Ve?Xe=!1:(j.insertBefore(Ve,W),I?A(I):D(W,j,!0),W=Ve,I=s(W)):Xe=!1):I&&(Xe=!1),Xe=Xe!==!1&&qh(W,P),Xe&&H(W,P)):(Et===dT||Et==OT)&&(Xe=!0,W.nodeValue!==P.nodeValue&&(W.nodeValue=P.nodeValue))),Xe){P=We,W=Ne;continue e}I?A(I):D(W,j,!0),W=Ne}if(oe&&(Ve=w[oe])&&qh(Ve,P))Z||x(j,Ve),H(Ve,P);else{var Rt=a(P);Rt!==!1&&(Rt&&(P=Rt),P.actualize&&(P=P.actualize(j.ownerDocument||Ni)),x(j,P),N(P))}P=We,W=Ne}le(j,W,I);var Lt=fT[j.nodeName];Lt&&Lt(j,ue)}var ie=i,ne=ie.nodeType,re=n.nodeType;if(!v){if(ne===Pc)re===Pc?qh(i,n)||(d(i),ie=R8(i,X8(n.nodeName,n.namespaceURI))):ie=n;else if(ne===dT||ne===OT){if(re===ne)return ie.nodeValue!==n.nodeValue&&(ie.nodeValue=n.nodeValue),ie;ie=n}}if(ie===n)d(i);else{if(n.isSameNode&&n.isSameNode(ie))return;if(H(ie,n,v),T)for(var de=0,pe=T.length;des.length,l;a&&s.push(r);try{l=t.apply(this,s)}catch(c){let u=c;if(a&&i)throw u;return r(u)}a||(l instanceof Promise?l.then(o,r):l instanceof Error?r(l):o(l))}function r(s,...a){i||(i=!0,e(s,...a))}function o(s){r(null,s)}}function t0(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?ET(t.position):"start"in t||"end"in t?ET(t):"line"in t||"column"in t?e0(t):""}function e0(t){return CT(t&&t.line)+":"+CT(t&&t.column)}function ET(t){return e0(t&&t.start)+"-"+e0(t&&t.end)}function CT(t){return t&&typeof t=="number"?t:1}var Zt=class extends Error{constructor(e,i,n){super(),typeof i=="string"&&(n=i,i=void 0);let r="",o={},s=!1;if(i&&("line"in i&&"column"in i?o={place:i}:"start"in i&&"end"in i?o={place:i}:"type"in i?o={ancestors:[i],place:i.position}:o=F({},i)),typeof e=="string"?r=e:!o.cause&&e&&(s=!0,r=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof n=="string"){let l=n.indexOf(":");l===-1?o.ruleId=n:(o.source=n.slice(0,l),o.ruleId=n.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){let l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}let a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=a?a.line:void 0,this.name=t0(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}};Zt.prototype.file="";Zt.prototype.name="";Zt.prototype.reason="";Zt.prototype.message="";Zt.prototype.stack="";Zt.prototype.column=void 0;Zt.prototype.line=void 0;Zt.prototype.ancestors=void 0;Zt.prototype.cause=void 0;Zt.prototype.fatal=void 0;Zt.prototype.place=void 0;Zt.prototype.ruleId=void 0;Zt.prototype.source=void 0;var Dn={basename:U8,dirname:M8,extname:N8,join:q8,sep:"/"};function U8(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');_c(t);let i=0,n=-1,r=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;r--;)if(t.codePointAt(r)===47){if(o){i=r+1;break}}else n<0&&(o=!0,n=r+1);return n<0?"":t.slice(i,n)}if(e===t)return"";let s=-1,a=e.length-1;for(;r--;)if(t.codePointAt(r)===47){if(o){i=r+1;break}}else s<0&&(o=!0,s=r+1),a>-1&&(t.codePointAt(r)===e.codePointAt(a--)?a<0&&(n=r):(a=-1,n=s));return i===n?n=s:n<0&&(n=t.length),t.slice(i,n)}function M8(t){if(_c(t),t.length===0)return".";let e=-1,i=t.length,n;for(;--i;)if(t.codePointAt(i)===47){if(n){e=i;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function N8(t){_c(t);let e=t.length,i=-1,n=0,r=-1,o=0,s;for(;e--;){let a=t.codePointAt(e);if(a===47){if(s){n=e+1;break}continue}i<0&&(s=!0,i=e+1),a===46?r<0?r=e:o!==1&&(o=1):r>-1&&(o=-1)}return r<0||i<0||o===0||o===1&&r===i-1&&r===n+1?"":t.slice(r,i)}function q8(...t){let e=-1,i;for(;++e0&&t.codePointAt(t.length-1)===47&&(i+="/"),e?"/"+i:i}function W8(t,e){let i="",n=0,r=-1,o=0,s=-1,a,l;for(;++s<=t.length;){if(s2){if(l=i.lastIndexOf("/"),l!==i.length-1){l<0?(i="",n=0):(i=i.slice(0,l),n=i.length-1-i.lastIndexOf("/")),r=s,o=0;continue}}else if(i.length>0){i="",n=0,r=s,o=0;continue}}e&&(i=i.length>0?i+"/..":"..",n=2)}else i.length>0?i+="/"+t.slice(r+1,s):i=t.slice(r+1,s),n=s-r-1;r=s,o=0}else a===46&&o>-1?o++:o=-1}return i}function _c(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}var PT={cwd:V8};function V8(){return"/"}function Ua(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function QT(t){if(typeof t=="string")t=new URL(t);else if(!Ua(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Z8(t)}function Z8(t){if(t.hostname!==""){let n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}let e=t.pathname,i=-1;for(;++i0){let[O,...m]=u,x=n[d][1];Qc(x)&&Qc(O)&&(O=(0,Vh.default)(!0,x,O)),n[d]=[c,O,...m]}}}},Zh=new l0().freeze();function o0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function s0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function a0(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function $T(t){if(!Qc(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function XT(t,e,i){if(!i)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Wh(t){return F8(t)?t:new Co(t)}function F8(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function H8(t){return typeof t=="string"||G8(t)}function G8(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var K8={};function c0(t,e){let i=e||K8,n=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,r=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return LT(t,n,r)}function LT(t,e,i){if(J8(t)){if("value"in t)return t.type==="html"&&!i?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return RT(t.children,e,i)}return Array.isArray(t)?RT(t,e,i):""}function RT(t,e,i){let n=[],r=-1;for(;++rr?0:r+e:e=e>r?r:e,i=i>0?i:0,n.length<1e4)s=Array.from(n),s.unshift(e,i),t.splice(...s);else for(i&&t.splice(e,i);o0?(ai(t,t.length,0,e),t):e}var DT={}.hasOwnProperty;function zT(t){let e={},i=-1;for(;++i13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"\uFFFD":String.fromCharCode(i)}function _r(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var iz=Po(new RegExp("\\p{P}","u")),en=Po(/[A-Za-z]/),Pi=Po(/[\dA-Za-z]/),UT=Po(/[#-'*+\--9=?A-Z^-~]/);function Ac(t){return t!==null&&(t<32||t===127)}var $c=Po(/\d/),MT=Po(/[\dA-Fa-f]/),u0=Po(/[!-/:-@[-`{-~]/);function Te(t){return t!==null&&t<-2}function jt(t){return t!==null&&(t<0||t===32)}function Le(t){return t===-2||t===-1||t===32}function NT(t){return u0(t)||iz(t)}var qT=Po(/\s/);function Po(t){return e;function e(i){return i!==null&&i>-1&&t.test(String.fromCharCode(i))}}function Ie(t,e,i,n){let r=n?n-1:Number.POSITIVE_INFINITY,o=0;return s;function s(l){return Le(l)?(t.enter(i),a(l)):e(l)}function a(l){return Le(l)&&o++s))return;let N=e.events.length,le=N,H,M;for(;le--;)if(e.events[le][0]==="exit"&&e.events[le][1].type==="chunkFlow"){if(H){M=e.events[le][1].end;break}H=!0}for(w(n),C=N;CA;){let D=i[L];e.containerState=D[1],D[0].exit.call(e,t)}i.length=A}function T(){r.write([null]),o=void 0,r=void 0,e.containerState._closeFlow=void 0}}function oz(t,e,i){return Ie(t,t.attempt(this.parser.constructs.document,e,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function f0(t){if(t===null||jt(t)||qT(t))return 1;if(NT(t))return 2}function Na(t,e,i){let n=[],r=-1;for(;++r1&&t[i][1].end.offset-t[i][1].start.offset>1?2:1;let f=Object.assign({},t[n][1].end),d=Object.assign({},t[i][1].start);ZT(f,-l),ZT(d,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},t[n][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[i][1].start),end:d},o={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[n][1].end),end:Object.assign({},t[i][1].start)},r={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},a.end)},t[n][1].end=Object.assign({},s.start),t[i][1].start=Object.assign({},a.end),c=[],t[n][1].end.offset-t[n][1].start.offset&&(c=Ci(c,[["enter",t[n][1],e],["exit",t[n][1],e]])),c=Ci(c,[["enter",r,e],["enter",s,e],["exit",s,e],["enter",o,e]]),c=Ci(c,Na(e.parser.constructs.insideSpan.null,t.slice(n+1,i),e)),c=Ci(c,[["exit",o,e],["enter",a,e],["exit",a,e],["exit",r,e]]),t[i][1].end.offset-t[i][1].start.offset?(u=2,c=Ci(c,[["enter",t[i][1],e],["exit",t[i][1],e]])):u=0,ai(t,n-1,i-n+3,c),i=n+c.length-u-2;break}}for(i=-1;++i0&&Le(C)?Ie(t,T,"linePrefix",o+1)(C):T(C)}function T(C){return C===null||Te(C)?t.check(BT,x,L)(C):(t.enter("codeFlowValue"),A(C))}function A(C){return C===null||Te(C)?(t.exit("codeFlowValue"),T(C)):(t.consume(C),A)}function L(C){return t.exit("codeFenced"),e(C)}function D(C,N,le){let H=0;return M;function M(pe){return C.enter("lineEnding"),C.consume(pe),C.exit("lineEnding"),ie}function ie(pe){return C.enter("codeFencedFence"),Le(pe)?Ie(C,ne,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(pe):ne(pe)}function ne(pe){return pe===a?(C.enter("codeFencedFenceSequence"),re(pe)):le(pe)}function re(pe){return pe===a?(H++,C.consume(pe),re):H>=s?(C.exit("codeFencedFenceSequence"),Le(pe)?Ie(C,de,"whitespace")(pe):de(pe)):le(pe)}function de(pe){return pe===null||Te(pe)?(C.exit("codeFencedFence"),N(pe)):le(pe)}}}function mz(t,e,i){let n=this;return r;function r(s){return s===null?i(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o)}function o(s){return n.parser.lazy[n.now().line]?i(s):e(s)}}var Rc={name:"codeIndented",tokenize:bz},gz={tokenize:yz,partial:!0};function bz(t,e,i){let n=this;return r;function r(c){return t.enter("codeIndented"),Ie(t,o,"linePrefix",5)(c)}function o(c){let u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):i(c)}function s(c){return c===null?l(c):Te(c)?t.attempt(gz,s,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||Te(c)?(t.exit("codeFlowValue"),s(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function yz(t,e,i){let n=this;return r;function r(s){return n.parser.lazy[n.now().line]?i(s):Te(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r):Ie(t,o,"linePrefix",5)(s)}function o(s){let a=n.events[n.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):Te(s)?r(s):i(s)}}var d0={name:"codeText",tokenize:wz,resolve:xz,previous:vz};function xz(t){let e=t.length-4,i=3,n,r;if((t[i][1].type==="lineEnding"||t[i][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=i;++n=4?e(s):t.interrupt(n.parser.constructs.flow,i,e)(s)}}function Jh(t,e,i,n,r,o,s,a,l){let c=l||Number.POSITIVE_INFINITY,u=0;return f;function f(w){return w===60?(t.enter(n),t.enter(r),t.enter(o),t.consume(w),t.exit(o),d):w===null||w===32||w===41||Ac(w)?i(w):(t.enter(n),t.enter(s),t.enter(a),t.enter("chunkString",{contentType:"string"}),x(w))}function d(w){return w===62?(t.enter(o),t.consume(w),t.exit(o),t.exit(r),t.exit(n),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),O(w))}function O(w){return w===62?(t.exit("chunkString"),t.exit(a),d(w)):w===null||w===60||Te(w)?i(w):(t.consume(w),w===92?m:O)}function m(w){return w===60||w===62||w===92?(t.consume(w),O):O(w)}function x(w){return!u&&(w===null||w===41||jt(w))?(t.exit("chunkString"),t.exit(a),t.exit(s),t.exit(n),e(w)):u999||O===null||O===91||O===93&&!l||O===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?i(O):O===93?(t.exit(o),t.enter(r),t.consume(O),t.exit(r),t.exit(n),e):Te(O)?(t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),f(O))}function f(O){return O===null||O===91||O===93||Te(O)||a++>999?(t.exit("chunkString"),u(O)):(t.consume(O),l||(l=!Le(O)),O===92?d:f)}function d(O){return O===91||O===92||O===93?(t.consume(O),a++,f):f(O)}}function td(t,e,i,n,r,o){let s;return a;function a(d){return d===34||d===39||d===40?(t.enter(n),t.enter(r),t.consume(d),t.exit(r),s=d===40?41:d,l):i(d)}function l(d){return d===s?(t.enter(r),t.consume(d),t.exit(r),t.exit(n),e):(t.enter(o),c(d))}function c(d){return d===s?(t.exit(o),l(s)):d===null?i(d):Te(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),Ie(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(d))}function u(d){return d===s||d===null||Te(d)?(t.exit("chunkString"),c(d)):(t.consume(d),d===92?f:u)}function f(d){return d===s||d===92?(t.consume(d),u):u(d)}}function Ss(t,e){let i;return n;function n(r){return Te(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),i=!0,n):Le(r)?Ie(t,n,i?"linePrefix":"lineSuffix")(r):e(r)}}var p0={name:"definition",tokenize:Qz},Pz={tokenize:_z,partial:!0};function Qz(t,e,i){let n=this,r;return o;function o(O){return t.enter("definition"),s(O)}function s(O){return ed.call(n,t,a,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(O)}function a(O){return r=_r(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),O===58?(t.enter("definitionMarker"),t.consume(O),t.exit("definitionMarker"),l):i(O)}function l(O){return jt(O)?Ss(t,c)(O):c(O)}function c(O){return Jh(t,u,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(O)}function u(O){return t.attempt(Pz,f,f)(O)}function f(O){return Le(O)?Ie(t,d,"whitespace")(O):d(O)}function d(O){return O===null||Te(O)?(t.exit("definition"),n.parser.defined.push(r),e(O)):i(O)}}function _z(t,e,i){return n;function n(a){return jt(a)?Ss(t,r)(a):i(a)}function r(a){return td(t,o,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Le(a)?Ie(t,s,"whitespace")(a):s(a)}function s(a){return a===null||Te(a)?e(a):i(a)}}var m0={name:"hardBreakEscape",tokenize:Az};function Az(t,e,i){return n;function n(o){return t.enter("hardBreakEscape"),t.consume(o),r}function r(o){return Te(o)?(t.exit("hardBreakEscape"),e(o)):i(o)}}var g0={name:"headingAtx",tokenize:Xz,resolve:$z};function $z(t,e){let i=t.length-2,n=3,r,o;return t[n][1].type==="whitespace"&&(n+=2),i-2>n&&t[i][1].type==="whitespace"&&(i-=2),t[i][1].type==="atxHeadingSequence"&&(n===i-1||i-4>n&&t[i-2][1].type==="whitespace")&&(i-=n+1===i?2:4),i>n&&(r={type:"atxHeadingText",start:t[n][1].start,end:t[i][1].end},o={type:"chunkText",start:t[n][1].start,end:t[i][1].end,contentType:"text"},ai(t,n,i-n+1,[["enter",r,e],["enter",o,e],["exit",o,e],["exit",r,e]])),t}function Xz(t,e,i){let n=0;return r;function r(u){return t.enter("atxHeading"),o(u)}function o(u){return t.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&n++<6?(t.consume(u),s):u===null||jt(u)?(t.exit("atxHeadingSequence"),a(u)):i(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||Te(u)?(t.exit("atxHeading"),e(u)):Le(u)?Ie(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||jt(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}var YT=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],b0=["pre","script","style","textarea"];var y0={name:"htmlFlow",tokenize:Dz,resolveTo:Iz,concrete:!0},Rz={tokenize:Uz,partial:!0},Lz={tokenize:zz,partial:!0};function Iz(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Dz(t,e,i){let n=this,r,o,s,a,l;return c;function c(I){return u(I)}function u(I){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(I),f}function f(I){return I===33?(t.consume(I),d):I===47?(t.consume(I),o=!0,x):I===63?(t.consume(I),r=3,n.interrupt?e:P):en(I)?(t.consume(I),s=String.fromCharCode(I),v):i(I)}function d(I){return I===45?(t.consume(I),r=2,O):I===91?(t.consume(I),r=5,a=0,m):en(I)?(t.consume(I),r=4,n.interrupt?e:P):i(I)}function O(I){return I===45?(t.consume(I),n.interrupt?e:P):i(I)}function m(I){let Ne="CDATA[";return I===Ne.charCodeAt(a++)?(t.consume(I),a===Ne.length?n.interrupt?e:ne:m):i(I)}function x(I){return en(I)?(t.consume(I),s=String.fromCharCode(I),v):i(I)}function v(I){if(I===null||I===47||I===62||jt(I)){let Ne=I===47,We=s.toLowerCase();return!Ne&&!o&&b0.includes(We)?(r=1,n.interrupt?e(I):ne(I)):YT.includes(s.toLowerCase())?(r=6,Ne?(t.consume(I),w):n.interrupt?e(I):ne(I)):(r=7,n.interrupt&&!n.parser.lazy[n.now().line]?i(I):o?T(I):A(I))}return I===45||Pi(I)?(t.consume(I),s+=String.fromCharCode(I),v):i(I)}function w(I){return I===62?(t.consume(I),n.interrupt?e:ne):i(I)}function T(I){return Le(I)?(t.consume(I),T):M(I)}function A(I){return I===47?(t.consume(I),M):I===58||I===95||en(I)?(t.consume(I),L):Le(I)?(t.consume(I),A):M(I)}function L(I){return I===45||I===46||I===58||I===95||Pi(I)?(t.consume(I),L):D(I)}function D(I){return I===61?(t.consume(I),C):Le(I)?(t.consume(I),D):A(I)}function C(I){return I===null||I===60||I===61||I===62||I===96?i(I):I===34||I===39?(t.consume(I),l=I,N):Le(I)?(t.consume(I),C):le(I)}function N(I){return I===l?(t.consume(I),l=null,H):I===null||Te(I)?i(I):(t.consume(I),N)}function le(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||jt(I)?D(I):(t.consume(I),le)}function H(I){return I===47||I===62||Le(I)?A(I):i(I)}function M(I){return I===62?(t.consume(I),ie):i(I)}function ie(I){return I===null||Te(I)?ne(I):Le(I)?(t.consume(I),ie):i(I)}function ne(I){return I===45&&r===2?(t.consume(I),ve):I===60&&r===1?(t.consume(I),j):I===62&&r===4?(t.consume(I),W):I===63&&r===3?(t.consume(I),P):I===93&&r===5?(t.consume(I),Z):Te(I)&&(r===6||r===7)?(t.exit("htmlFlowData"),t.check(Rz,oe,re)(I)):I===null||Te(I)?(t.exit("htmlFlowData"),re(I)):(t.consume(I),ne)}function re(I){return t.check(Lz,de,oe)(I)}function de(I){return t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),pe}function pe(I){return I===null||Te(I)?re(I):(t.enter("htmlFlowData"),ne(I))}function ve(I){return I===45?(t.consume(I),P):ne(I)}function j(I){return I===47?(t.consume(I),s="",ue):ne(I)}function ue(I){if(I===62){let Ne=s.toLowerCase();return b0.includes(Ne)?(t.consume(I),W):ne(I)}return en(I)&&s.length<8?(t.consume(I),s+=String.fromCharCode(I),ue):ne(I)}function Z(I){return I===93?(t.consume(I),P):ne(I)}function P(I){return I===62?(t.consume(I),W):I===45&&r===2?(t.consume(I),P):ne(I)}function W(I){return I===null||Te(I)?(t.exit("htmlFlowData"),oe(I)):(t.consume(I),W)}function oe(I){return t.exit("htmlFlow"),e(I)}}function zz(t,e,i){let n=this;return r;function r(s){return Te(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o):i(s)}function o(s){return n.parser.lazy[n.now().line]?i(s):e(s)}}function Uz(t,e,i){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),t.attempt(Qo,e,i)}}var x0={name:"htmlText",tokenize:Mz};function Mz(t,e,i){let n=this,r,o,s;return a;function a(P){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(P),l}function l(P){return P===33?(t.consume(P),c):P===47?(t.consume(P),D):P===63?(t.consume(P),A):en(P)?(t.consume(P),le):i(P)}function c(P){return P===45?(t.consume(P),u):P===91?(t.consume(P),o=0,m):en(P)?(t.consume(P),T):i(P)}function u(P){return P===45?(t.consume(P),O):i(P)}function f(P){return P===null?i(P):P===45?(t.consume(P),d):Te(P)?(s=f,j(P)):(t.consume(P),f)}function d(P){return P===45?(t.consume(P),O):f(P)}function O(P){return P===62?ve(P):P===45?d(P):f(P)}function m(P){let W="CDATA[";return P===W.charCodeAt(o++)?(t.consume(P),o===W.length?x:m):i(P)}function x(P){return P===null?i(P):P===93?(t.consume(P),v):Te(P)?(s=x,j(P)):(t.consume(P),x)}function v(P){return P===93?(t.consume(P),w):x(P)}function w(P){return P===62?ve(P):P===93?(t.consume(P),w):x(P)}function T(P){return P===null||P===62?ve(P):Te(P)?(s=T,j(P)):(t.consume(P),T)}function A(P){return P===null?i(P):P===63?(t.consume(P),L):Te(P)?(s=A,j(P)):(t.consume(P),A)}function L(P){return P===62?ve(P):A(P)}function D(P){return en(P)?(t.consume(P),C):i(P)}function C(P){return P===45||Pi(P)?(t.consume(P),C):N(P)}function N(P){return Te(P)?(s=N,j(P)):Le(P)?(t.consume(P),N):ve(P)}function le(P){return P===45||Pi(P)?(t.consume(P),le):P===47||P===62||jt(P)?H(P):i(P)}function H(P){return P===47?(t.consume(P),ve):P===58||P===95||en(P)?(t.consume(P),M):Te(P)?(s=H,j(P)):Le(P)?(t.consume(P),H):ve(P)}function M(P){return P===45||P===46||P===58||P===95||Pi(P)?(t.consume(P),M):ie(P)}function ie(P){return P===61?(t.consume(P),ne):Te(P)?(s=ie,j(P)):Le(P)?(t.consume(P),ie):H(P)}function ne(P){return P===null||P===60||P===61||P===62||P===96?i(P):P===34||P===39?(t.consume(P),r=P,re):Te(P)?(s=ne,j(P)):Le(P)?(t.consume(P),ne):(t.consume(P),de)}function re(P){return P===r?(t.consume(P),r=void 0,pe):P===null?i(P):Te(P)?(s=re,j(P)):(t.consume(P),re)}function de(P){return P===null||P===34||P===39||P===60||P===61||P===96?i(P):P===47||P===62||jt(P)?H(P):(t.consume(P),de)}function pe(P){return P===47||P===62||jt(P)?H(P):i(P)}function ve(P){return P===62?(t.consume(P),t.exit("htmlTextData"),t.exit("htmlText"),e):i(P)}function j(P){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),ue}function ue(P){return Le(P)?Ie(t,Z,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):Z(P)}function Z(P){return t.enter("htmlTextData"),s(P)}}var Ts={name:"labelEnd",tokenize:Zz,resolveTo:Vz,resolveAll:Wz},Nz={tokenize:Bz},qz={tokenize:Yz},jz={tokenize:Fz};function Wz(t){let e=-1;for(;++e=3&&(c===null||Te(c))?(t.exit("thematicBreak"),e(c)):i(c)}function l(c){return c===r?(t.consume(c),n++,l):(t.exit("thematicBreakSequence"),Le(c)?Ie(t,a,"whitespace")(c):a(c))}}var gi={name:"list",tokenize:iU,continuation:{tokenize:nU},exit:oU},eU={tokenize:sU,partial:!0},tU={tokenize:rU,partial:!0};function iU(t,e,i){let n=this,r=n.events[n.events.length-1],o=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,s=0;return a;function a(O){let m=n.containerState.type||(O===42||O===43||O===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||O===n.containerState.marker:$c(O)){if(n.containerState.type||(n.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),O===42||O===45?t.check(Es,i,c)(O):c(O);if(!n.interrupt||O===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(O)}return i(O)}function l(O){return $c(O)&&++s<10?(t.consume(O),l):(!n.interrupt||s<2)&&(n.containerState.marker?O===n.containerState.marker:O===41||O===46)?(t.exit("listItemValue"),c(O)):i(O)}function c(O){return t.enter("listItemMarker"),t.consume(O),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||O,t.check(Qo,n.interrupt?i:u,t.attempt(eU,d,f))}function u(O){return n.containerState.initialBlankLine=!0,o++,d(O)}function f(O){return Le(O)?(t.enter("listItemPrefixWhitespace"),t.consume(O),t.exit("listItemPrefixWhitespace"),d):i(O)}function d(O){return n.containerState.size=o+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(O)}}function nU(t,e,i){let n=this;return n.containerState._closeFlow=void 0,t.check(Qo,r,o);function r(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Ie(t,e,"listItemIndent",n.containerState.size+1)(a)}function o(a){return n.containerState.furtherBlankLines||!Le(a)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,s(a)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(tU,e,s)(a))}function s(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Ie(t,t.attempt(gi,e,i),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function rU(t,e,i){let n=this;return Ie(t,r,"listItemIndent",n.containerState.size+1);function r(o){let s=n.events[n.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===n.containerState.size?e(o):i(o)}}function oU(t){t.exit(this.containerState.type)}function sU(t,e,i){let n=this;return Ie(t,r,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(o){let s=n.events[n.events.length-1];return!Le(o)&&s&&s[1].type==="listItemPrefixWhitespace"?e(o):i(o)}}var id={name:"setextUnderline",tokenize:lU,resolveTo:aU};function aU(t,e){let i=t.length,n,r,o;for(;i--;)if(t[i][0]==="enter"){if(t[i][1].type==="content"){n=i;break}t[i][1].type==="paragraph"&&(r=i)}else t[i][1].type==="content"&&t.splice(i,1),!o&&t[i][1].type==="definition"&&(o=i);let s={type:"setextHeading",start:Object.assign({},t[r][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[r][1].type="setextHeadingText",o?(t.splice(r,0,["enter",s,e]),t.splice(o+1,0,["exit",t[n][1],e]),t[n][1].end=Object.assign({},t[o][1].end)):t[n][1]=s,t.push(["exit",s,e]),t}function lU(t,e,i){let n=this,r;return o;function o(c){let u=n.events.length,f;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){f=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||f)?(t.enter("setextHeadingLine"),r=c,s(c)):i(c)}function s(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===r?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Le(c)?Ie(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Te(c)?(t.exit("setextHeadingLine"),e(c)):i(c)}}var FT={tokenize:cU};function cU(t){let e=this,i=t.attempt(Qo,n,t.attempt(this.parser.constructs.flowInitial,r,Ie(t,t.attempt(this.parser.constructs.flow,r,t.attempt(O0,r)),"linePrefix")));return i;function n(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,i}function r(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,i}}var HT={resolveAll:e3()},GT=JT("string"),KT=JT("text");function JT(t){return{tokenize:e,resolveAll:e3(t==="text"?uU:void 0)};function e(i){let n=this,r=this.parser.constructs[t],o=i.attempt(r,s,a);return s;function s(u){return c(u)?o(u):a(u)}function a(u){if(u===null){i.consume(u);return}return i.enter("data"),i.consume(u),l}function l(u){return c(u)?(i.exit("data"),o(u)):(i.consume(u),l)}function c(u){if(u===null)return!0;let f=r[u],d=-1;if(f)for(;++d-1){let a=s[0];typeof a=="string"?s[0]=a.slice(n):s.shift()}o>0&&s.push(t[r].slice(0,o))}return s}function hU(t,e){let i=-1,n=[],r;for(;++i{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.0.9"}isProfileEnabled(){return this.sessionStorage.getItem(Dg)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(Qh)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(Qh)==="false"}enableDebug(){this.sessionStorage.setItem(Qh,"true")}enableProfiling(){this.sessionStorage.setItem(Dg,"true")}disableDebug(){this.sessionStorage.setItem(Qh,"false")}disableProfiling(){this.sessionStorage.removeItem(Dg)}enableLatencySim(t){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(zg,t)}disableLatencySim(){this.sessionStorage.removeItem(zg)}getLatencySim(){let t=this.sessionStorage.getItem(zg);return t?parseInt(t):null}getSocket(){return this.socket}connect(){window.location.hostname==="localhost"&&!this.isDebugDisabled()&&this.enableDebug();let t=()=>{this.resetReloadStatus(),this.joinRootViews()?(this.bindTopLevelEvents(),this.socket.connect()):this.main?this.socket.connect():this.bindTopLevelEvents({dead:!0}),this.joinDeadView()};["complete","loaded","interactive"].indexOf(document.readyState)>=0?t():document.addEventListener("DOMContentLoaded",()=>t())}disconnect(t){clearTimeout(this.reloadWithJitterTimer),this.serverCloseRef&&(this.socket.off(this.serverCloseRef),this.serverCloseRef=null),this.socket.disconnect(t)}replaceTransport(t){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(t),this.connect()}execJS(t,e,i=null){let n=new CustomEvent("phx:exec",{detail:{sourceElement:t}});this.owner(t,r=>bt.exec(n,i,e,r,t))}execJSHookPush(t,e,i,n){this.withinOwners(t,r=>{let o=new CustomEvent("phx:exec",{detail:{sourceElement:t}});bt.exec(o,"hook",e,r,t,["push",{data:i,callback:n}])})}unload(){this.unloaded||(this.main&&this.isConnected()&&this.log(this.main,"socket",()=>["disconnect for page nav"]),this.unloaded=!0,this.destroyAllViews(),this.disconnect())}triggerDOM(t,e){this.domCallbacks[t](...e)}time(t,e){if(!this.isProfileEnabled()||!console.time)return e();console.time(t);let i=e();return console.timeEnd(t),i}log(t,e,i){if(this.viewLogger){let[n,r]=i();this.viewLogger(t,e,n,r)}else if(this.isDebugEnabled()){let[n,r]=i();qD(t,e,n,r)}}requestDOMUpdate(t){this.transitions.after(t)}transition(t,e,i=function(){}){this.transitions.addTransition(t,e,i)}onChannel(t,e,i){t.on(e,n=>{let r=this.getLatencySim();r?setTimeout(()=>i(n),r):i(n)})}reloadWithJitter(t,e){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,n=this.reloadJitterMax,r=Math.floor(Math.random()*(n-i+1))+i,o=zi.updateLocal(this.localStorage,window.location.pathname,VS,0,s=>s+1);o>=this.maxReloads&&(r=this.failsafeJitter),this.reloadWithJitterTimer=setTimeout(()=>{t.isDestroyed()||t.isConnected()||(t.destroy(),e?e():this.log(t,"join",()=>[`encountered ${o} consecutive reloads`]),o>=this.maxReloads&&this.log(t,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),this.hasPendingLink()?window.location=this.pendingLink:window.location.reload())},r)}getHookCallbacks(t){return t&&t.startsWith("Phoenix.")?HD[t.split(".")[1]]:this.hooks[t]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(t){return`${this.getBindingPrefix()}${t}`}channel(t,e){return this.socket.channel(t,e)}joinDeadView(){let t=document.body;if(t&&!this.isPhxView(t)&&!this.isPhxView(document.firstElementChild)){let e=this.newRootView(t);e.setHref(this.getHref()),e.joinDead(),this.main||(this.main=e),window.requestAnimationFrame(()=>{var i;e.execNewMounted(),this.maybeScroll((i=history.state)==null?void 0:i.scroll)})}}joinRootViews(){let t=!1;return G.all(document,`${ws}:not([${vs}])`,e=>{if(!this.getRootById(e.id)){let i=this.newRootView(e);G.isPhxSticky(e)||i.setHref(this.getHref()),i.join(),e.hasAttribute(Yg)&&(this.main=i)}t=!0}),t}redirect(t,e,i){i&&zi.setCookie(SS,i,60),this.unload(),zi.redirect(t,e)}replaceMain(t,e,i=null,n=this.setPendingLink(t)){let r=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let o=G.findPhxSticky(document)||[],s=G.all(this.outgoingMainEl,`[${this.binding("remove")}]`).filter(l=>!G.isChildOfAny(l,o)),a=G.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(a,e,r),this.main.setRedirect(t),this.transitionRemoves(s),this.main.join((l,c)=>{l===1&&this.commitPendingLink(n)&&this.requestDOMUpdate(()=>{s.forEach(u=>u.remove()),o.forEach(u=>a.appendChild(u)),this.outgoingMainEl.replaceWith(a),this.outgoingMainEl=null,i&&i(n),c()})})}transitionRemoves(t,e){let i=this.binding("remove"),n=r=>{r.preventDefault(),r.stopImmediatePropagation()};t.forEach(r=>{for(let o of this.boundEventNames)r.addEventListener(o,n,!0);this.execJS(r,r.getAttribute(i),"remove")}),this.requestDOMUpdate(()=>{t.forEach(r=>{for(let o of this.boundEventNames)r.removeEventListener(o,n,!0)}),e&&e()})}isPhxView(t){return t.getAttribute&&t.getAttribute(or)!==null}newRootView(t,e,i){let n=new g8(t,this,null,e,i);return this.roots[n.id]=n,n}owner(t,e){let i=So(t.closest(ws),n=>this.getViewByEl(n))||this.main;return i&&e?e(i):i}withinOwners(t,e){this.owner(t,i=>e(i,t))}getViewByEl(t){let e=t.getAttribute(To);return So(this.getRootById(e),i=>i.getDescendentByEl(t))}getRootById(t){return this.roots[t]}destroyAllViews(){for(let t in this.roots)this.roots[t].destroy(),delete this.roots[t];this.main=null}destroyViewByEl(t){let e=this.getRootById(t.getAttribute(To));e&&e.id===t.id?(e.destroy(),delete this.roots[e.id]):e&&e.destroyDescendent(t.id)}getActiveElement(){return document.activeElement}dropActiveElement(t){this.prevActive&&t.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive.blur()}bindTopLevelEvents({dead:t}={}){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.serverCloseRef=this.socket.onClose(e=>{if(e&&e.code===1e3&&this.main)return this.reloadWithJitter(this.main)}),document.body.addEventListener("click",function(){}),window.addEventListener("pageshow",e=>{e.persisted&&(this.getSocket().disconnect(),this.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())},!0),t||this.bindNav(),this.bindClicks(),t||this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(e,i,n,r,o,s)=>{let a=r.getAttribute(this.binding(_D)),l=e.key&&e.key.toLowerCase();if(a&&a.toLowerCase()!==l)return;let c=F({key:e.key},this.eventMeta(i,e,r));bt.exec(e,i,o,n,r,["push",{data:c}])}),this.bind({blur:"focusout",focus:"focusin"},(e,i,n,r,o,s)=>{if(!s){let a=F({key:e.key},this.eventMeta(i,e,r));bt.exec(e,i,o,n,r,["push",{data:a}])}}),this.bind({blur:"blur",focus:"focus"},(e,i,n,r,o,s)=>{if(s==="window"){let a=this.eventMeta(i,e,r);bt.exec(e,i,o,n,r,["push",{data:a}])}}),this.on("dragover",e=>e.preventDefault()),this.on("drop",e=>{e.preventDefault();let i=So(Tc(e.target,this.binding(mS)),o=>o.getAttribute(this.binding(mS))),n=i&&document.getElementById(i),r=Array.from(e.dataTransfer.files||[]);!n||n.disabled||r.length===0||!(n.files instanceof FileList)||(Jt.trackFiles(n,r,e.dataTransfer),n.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(BS,e=>{let i=e.target;if(!G.isUploadInput(i))return;let n=Array.from(e.detail.files||[]).filter(r=>r instanceof File||r instanceof Blob);Jt.trackFiles(i,n),i.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(t,e,i){let n=this.metadataCallbacks[t];return n?n(e,i):{}}setPendingLink(t){return this.linkRef++,this.pendingLink=t,this.resetReloadStatus(),this.linkRef}resetReloadStatus(){zi.deleteCookie(SS)}commitPendingLink(t){return this.linkRef!==t?!1:(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(t,e){for(let i in t){let n=t[i];this.on(n,r=>{let o=this.binding(i),s=this.binding(`window-${i}`),a=r.target.getAttribute&&r.target.getAttribute(o);a?this.debounce(r.target,r,n,()=>{this.withinOwners(r.target,l=>{e(r,i,l,r.target,a,null)})}):G.all(document,`[${s}]`,l=>{let c=l.getAttribute(s);this.debounce(l,r,n,()=>{this.withinOwners(l,u=>{e(r,i,u,l,c,"window")})})})})}}bindClicks(){this.on("mousedown",t=>this.clickStartedAtTarget=t.target),this.bindClick("click","click")}bindClick(t,e){let i=this.binding(e);window.addEventListener(t,n=>{let r=null;n.detail===0&&(this.clickStartedAtTarget=n.target);let o=this.clickStartedAtTarget||n.target;r=Tc(n.target,i),this.dispatchClickAway(n,o),this.clickStartedAtTarget=null;let s=r&&r.getAttribute(i);if(!s){G.isNewPageClick(n,window.location)&&this.unload();return}r.getAttribute("href")==="#"&&n.preventDefault(),!r.hasAttribute(pn)&&this.debounce(r,n,"click",()=>{this.withinOwners(r,a=>{bt.exec(n,"click",s,a,r,["push",{data:this.eventMeta("click",n,r)}])})})},!1)}dispatchClickAway(t,e){let i=this.binding("click-away");G.all(document,`[${i}]`,n=>{n.isSameNode(e)||n.contains(e)||this.withinOwners(n,r=>{let o=n.getAttribute(i);bt.isVisible(n)&&bt.isInViewport(n)&&bt.exec(t,"click",o,r,n,["push",{data:this.eventMeta("click",t,t.target)}])})})}bindNav(){if(!zi.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let t=null;window.addEventListener("scroll",e=>{clearTimeout(t),t=setTimeout(()=>{zi.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",e=>{if(!this.registerNewLocation(window.location))return;let{type:i,backType:n,id:r,scroll:o,position:s}=e.state||{},a=window.location.href,l=s>this.currentHistoryPosition;i=l?i:n||i,this.currentHistoryPosition=s||0,this.sessionStorage.setItem(_h,this.currentHistoryPosition.toString()),G.dispatchEvent(window,"phx:navigate",{detail:{href:a,patch:i==="patch",pop:!0,direction:l?"forward":"backward"}}),this.requestDOMUpdate(()=>{let c=()=>{this.maybeScroll(o)};this.main.isConnected()&&i==="patch"&&r===this.main.id?this.main.pushLinkPatch(e,a,null,c):this.replaceMain(a,null,c)})},!1),window.addEventListener("click",e=>{let i=Tc(e.target,Lg),n=i&&i.getAttribute(Lg);if(!n||!this.isConnected()||!this.main||G.wantsNewTab(e))return;let r=i.href instanceof SVGAnimatedString?i.href.baseVal:i.href,o=i.getAttribute(SD);e.preventDefault(),e.stopImmediatePropagation(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if(n==="patch")this.pushHistoryPatch(e,r,o,i);else if(n==="redirect")this.historyRedirect(e,r,o,null,i);else throw new Error(`expected ${Lg} to be "patch" or "redirect", got: ${n}`);let s=i.getAttribute(this.binding("click"));s&&this.requestDOMUpdate(()=>this.execJS(i,s,"click"))})},!1)}maybeScroll(t){typeof t=="number"&&requestAnimationFrame(()=>{window.scrollTo(0,t)})}dispatchEvent(t,e={}){G.dispatchEvent(window,`phx:${t}`,{detail:e})}dispatchEvents(t){t.forEach(([e,i])=>this.dispatchEvent(e,i))}withPageLoading(t,e){G.dispatchEvent(window,"phx:page-loading-start",{detail:t});let i=()=>G.dispatchEvent(window,"phx:page-loading-stop",{detail:t});return e?e(i):i}pushHistoryPatch(t,e,i,n){if(!this.isConnected()||!this.main.isMain())return zi.redirect(e);this.withPageLoading({to:e,kind:"patch"},r=>{this.main.pushLinkPatch(t,e,n,o=>{this.historyPatch(e,i,o),r()})})}historyPatch(t,e,i=this.setPendingLink(t)){this.commitPendingLink(i)&&(this.currentHistoryPosition++,this.sessionStorage.setItem(_h,this.currentHistoryPosition.toString()),zi.updateCurrentState(n=>Ee(F({},n),{backType:"patch"})),zi.pushState(e,{type:"patch",id:this.main.id,position:this.currentHistoryPosition},t),G.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:t,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location))}historyRedirect(t,e,i,n,r){let o=r&&t.isTrusted&&t.type!=="popstate";if(o&&r.classList.add("phx-click-loading"),!this.isConnected()||!this.main.isMain())return zi.redirect(e,n);if(/^\/$|^\/[^\/]+.*$/.test(e)){let{protocol:a,host:l}=window.location;e=`${a}//${l}${e}`}let s=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},a=>{this.replaceMain(e,n,l=>{l===this.linkRef&&(this.currentHistoryPosition++,this.sessionStorage.setItem(_h,this.currentHistoryPosition.toString()),zi.updateCurrentState(c=>Ee(F({},c),{backType:"redirect"})),zi.pushState(i,{type:"redirect",id:this.main.id,scroll:s,position:this.currentHistoryPosition},e),G.dispatchEvent(window,"phx:navigate",{detail:{href:e,patch:!1,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location)),o&&r.classList.remove("phx-click-loading"),a()})})}registerNewLocation(t){let{pathname:e,search:i}=this.currentLocation;return e+i===t.pathname+t.search?!1:(this.currentLocation=Dh(t),!0)}bindForms(){let t=0,e=!1;this.on("submit",i=>{let n=i.target.getAttribute(this.binding("submit")),r=i.target.getAttribute(this.binding("change"));!e&&r&&!n&&(e=!0,i.preventDefault(),this.withinOwners(i.target,o=>{o.disableForm(i.target),window.requestAnimationFrame(()=>{G.isUnloadableFormSubmit(i)&&this.unload(),i.target.submit()})}))}),this.on("submit",i=>{let n=i.target.getAttribute(this.binding("submit"));if(!n){G.isUnloadableFormSubmit(i)&&this.unload();return}i.preventDefault(),i.target.disabled=!0,this.withinOwners(i.target,r=>{bt.exec(i,"submit",n,r,i.target,["push",{submitter:i.submitter}])})});for(let i of["change","input"])this.on(i,n=>{if(n instanceof CustomEvent&&n.target.form===void 0){if(n.detail&&n.detail.dispatcher)throw new Error(`dispatching a custom ${i} event is only supported on input elements inside a form`);return}let r=this.binding("change"),o=n.target;if(n.isComposing){let O=`composition-listener-${i}`;G.private(o,O)||(G.putPrivate(o,O,!0),o.addEventListener("compositionend",()=>{o.dispatchEvent(new Event(i,{bubbles:!0})),G.deletePrivate(o,O)},{once:!0}));return}let s=o.getAttribute(r),a=o.form&&o.form.getAttribute(r),l=s||a;if(!l||o.type==="number"&&o.validity&&o.validity.badInput)return;let c=s?o:o.form,u=t;t++;let{at:f,type:d}=G.private(o,"prev-iteration")||{};f===u-1&&i==="change"&&d==="input"||(G.putPrivate(o,"prev-iteration",{at:u,type:i}),this.debounce(o,n,i,()=>{this.withinOwners(c,O=>{G.putPrivate(o,zh,!0),bt.exec(n,"change",l,O,o,["push",{_target:n.target.name,dispatcher:c}])})}))});this.on("reset",i=>{let n=i.target;G.resetForm(n);let r=Array.from(n.elements).find(o=>o.type==="reset");r&&window.requestAnimationFrame(()=>{r.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(t,e,i,n){if(i==="blur"||i==="focusout")return n();let r=this.binding(PD),o=this.binding(QD),s=this.defaults.debounce.toString(),a=this.defaults.throttle.toString();this.withinOwners(t,l=>{let c=()=>!l.isDestroyed()&&document.body.contains(t);G.debounce(t,e,r,s,o,a,c,()=>{n()})})}silenceEvents(t){this.silenced=!0,t(),this.silenced=!1}on(t,e){this.boundEventNames.add(t),window.addEventListener(t,i=>{this.silenced||e(i)})}jsQuerySelectorAll(t,e,i){let n=this.domCallbacks.jsQuerySelectorAll;return n?n(t,e,i):i()}},b8=class{constructor(){this.transitions=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(t=>{clearTimeout(t),this.transitions.delete(t)}),this.flushPendingOps()}after(t){this.size()===0?t():this.pushPendingOp(t)}addTransition(t,e,i){e();let n=setTimeout(()=>{this.transitions.delete(n),i(),this.flushPendingOps()},t);this.transitions.add(n)}pushPendingOp(t){this.pendingOps.push(t)}size(){return this.transitions.size}flushPendingOps(){if(this.size()>0)return;let t=this.pendingOps.shift();t&&(t(),this.flushPendingOps())}};var tT="livebook:";function ks(t){try{let e=localStorage.getItem(tT+t);if(e)return JSON.parse(e)}catch(e){console.error(`Failed to load from local storage, reason: ${e.message}`)}}function za(t,e){try{let i=JSON.stringify(e);localStorage.setItem(tT+t,i)}catch(i){console.error(`Failed to write to local storage, reason: ${i.message}`)}}var iT="app_auth_token:";function nT(t,e){za(iT+t,e)}function rT(){let t=window.location.pathname;if(t.startsWith("/apps/")){let e=t.split("/")[2],i=ks(iT+e);if(i)return i}return null}var y8={mounted(){this.handleEvent("persist_app_auth",({slug:t,token:e})=>{nT(t,e),this.pushEvent("app_auth_persisted")})}},oT=y8;function Ot(t,e){let i={};for(let n of e){let r=`data-p-${n}`;if(!t.hasAttribute(r))throw new Error(`Missing attribute "${r}" on element <${t.tagName}:${t.id}>`);let o=t.getAttribute(r);i[x8(n)]=JSON.parse(o)}return i}function x8(t){let[e,...i]=t.split("-");return[e,...i.map(n=>n.charAt(0).toUpperCase()+n.slice(1))].join("")}function sT(t,e,i){let r=new ArrayBuffer(44+t.byteLength),o=new DataView(r),s=t.byteLength/4,a=4,l=e*a,c=i*l,u=s*l,f=0;function d(w){o.setUint32(f,w,!1),f+=4}function O(w){o.setUint32(f,w,!0),f+=4}function m(w){o.setUint16(f,w,!0),f+=2}function x(w){o.setFloat32(f,w,!0),f+=4}d(1380533830),O(36+u),d(1463899717),d(1718449184),O(16),m(3),m(e),O(i),O(c),m(l),m(a*8),d(1684108385),O(u);let v=new Float32Array(t);for(let w=0;w{this.inputEl.click()}),this.inputEl.addEventListener("change",t=>{let[e]=t.target.files;e&&this.loadFile(e)}),this.el.addEventListener("dragover",t=>{t.stopPropagation(),t.preventDefault(),t.dataTransfer.dropEffect="copy"}),this.el.addEventListener("drop",t=>{t.stopPropagation(),t.preventDefault();let[e]=t.dataTransfer.files;e&&!this.isRecording()&&this.loadFile(e)}),this.el.addEventListener("dragenter",t=>{this.el.classList.add(...Gg)}),this.el.addEventListener("dragleave",t=>{this.el.contains(t.relatedTarget)||this.el.classList.remove(...Gg)}),this.el.addEventListener("drop",t=>{this.el.classList.remove(...Gg)}),this.recordButton.addEventListener("click",t=>{this.startRecording()}),this.stopButton.addEventListener("click",t=>{this.stopRecording()}),this.cancelButton.addEventListener("click",t=>{this.stopRecording(!1)})},updated(){this.props=this.getProps(),this.audioEl.src=this.props.audioUrl},getProps(){return Ot(this.el,["id","phx-target","sampling-rate","endianness","format","audio-url"])},startRecording(){this.audioEl.classList.add("hidden"),this.uploadButton.classList.add("hidden"),this.recordButton.classList.add("hidden"),this.stopButton.classList.remove("hidden"),this.cancelButton.classList.remove("hidden"),this.audioChunks=[],navigator.mediaDevices.getUserMedia({audio:!0}).then(t=>{this.mediaRecorder=new MediaRecorder(t),this.mediaRecorder.addEventListener("dataavailable",e=>{this.audioChunks.push(e.data)}),this.mediaRecorder.start()})},stopRecording(t=!0){this.audioEl.classList.remove("hidden"),this.uploadButton.classList.remove("hidden"),this.recordButton.classList.remove("hidden"),this.stopButton.classList.add("hidden"),this.cancelButton.classList.add("hidden"),t&&this.mediaRecorder.addEventListener("stop",e=>{new Blob(this.audioChunks).arrayBuffer().then(n=>{this.loadEncodedAudio(n)})}),this.mediaRecorder.stop()},isRecording(){return this.mediaRecorder&&this.mediaRecorder.state==="recording"},loadFile(t){let e=new FileReader;e.onload=i=>{this.loadEncodedAudio(i.target.result)},e.readAsArrayBuffer(t)},loadEncodedAudio(t){this.pushEventTo(this.props.phxTarget,"decoding",{}),new AudioContext({sampleRate:this.props.samplingRate}).decodeAudioData(t,i=>{let n=w8(i);this.pushAudio(n)})},pushAudio(t){let e={num_channels:t.numChannels,sampling_rate:t.samplingRate},i=this.encodeAudio(t),n=new Blob([i]);n.meta=()=>e,this.uploadTo(this.props.phxTarget,"file",[n])},encodeAudio(t){if(this.props.format==="pcm_f32")return k8(t.data,this.props.endianness);if(this.props.format==="wav")return sT(t.data,t.numChannels,t.samplingRate)}};function w8(t){let e=t.numberOfChannels,i=t.sampleRate,n=t.length,r=4*e*n,o=new ArrayBuffer(r),s=new Float32Array(o);for(let a=0;a=0;l--)n=i[l],r=n.name,o=n.namespaceURI,s=n.value,o?(r=n.localName||r,a=t.getAttributeNS(o,r),a!==s&&(n.prefix==="xmlns"&&(r=n.name),t.setAttributeNS(o,r,s))):(a=t.getAttribute(r),a!==s&&t.setAttribute(r,s));for(var c=t.attributes,u=c.length-1;u>=0;u--)n=c[u],r=n.name,o=n.namespaceURI,o?(r=n.localName||r,e.hasAttributeNS(o,r)||t.removeAttributeNS(o,r)):e.hasAttribute(r)||t.removeAttribute(r)}}var Nh,E8="http://www.w3.org/1999/xhtml",Ni=typeof document=="undefined"?void 0:document,C8=!!Ni&&"content"in Ni.createElement("template"),P8=!!Ni&&Ni.createRange&&"createContextualFragment"in Ni.createRange();function Q8(t){var e=Ni.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}function _8(t){Nh||(Nh=Ni.createRange(),Nh.selectNode(Ni.body));var e=Nh.createContextualFragment(t);return e.childNodes[0]}function A8(t){var e=Ni.createElement("body");return e.innerHTML=t,e.childNodes[0]}function $8(t){return t=t.trim(),C8?Q8(t):P8?_8(t):A8(t)}function qh(t,e){var i=t.nodeName,n=e.nodeName,r,o;return i===n?!0:(r=i.charCodeAt(0),o=n.charCodeAt(0),r<=90&&o>=97?i===n.toUpperCase():o<=90&&r>=97?n===i.toUpperCase():!1)}function X8(t,e){return!e||e===E8?Ni.createElement(t):Ni.createElementNS(e,t)}function R8(t,e){for(var i=t.firstChild;i;){var n=i.nextSibling;e.appendChild(i),i=n}return e}function Kg(t,e,i){t[i]!==e[i]&&(t[i]=e[i],t[i]?t.setAttribute(i,""):t.removeAttribute(i))}var fT={OPTION:function(t,e){var i=t.parentNode;if(i){var n=i.nodeName.toUpperCase();n==="OPTGROUP"&&(i=i.parentNode,n=i&&i.nodeName.toUpperCase()),n==="SELECT"&&!i.hasAttribute("multiple")&&(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),i.selectedIndex=-1)}Kg(t,e,"selected")},INPUT:function(t,e){Kg(t,e,"checked"),Kg(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var i=e.value;t.value!==i&&(t.value=i);var n=t.firstChild;if(n){var r=n.nodeValue;if(r==i||!i&&r==t.placeholder)return;n.nodeValue=i}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var i=-1,n=0,r=t.firstChild,o,s;r;)if(s=r.nodeName&&r.nodeName.toUpperCase(),s==="OPTGROUP")o=r,r=o.firstChild;else{if(s==="OPTION"){if(r.hasAttribute("selected")){i=n;break}n++}r=r.nextSibling,!r&&o&&(r=o.nextSibling,o=null)}t.selectedIndex=i}}},Pc=1,hT=11,dT=3,OT=8;function Eo(){}function L8(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function I8(t){return function(i,n,r){if(r||(r={}),typeof n=="string")if(i.nodeName==="#document"||i.nodeName==="HTML"||i.nodeName==="BODY"){var o=n;n=Ni.createElement("html"),n.innerHTML=o}else n=$8(n);else n.nodeType===hT&&(n=n.firstElementChild);var s=r.getNodeKey||L8,a=r.onBeforeNodeAdded||Eo,l=r.onNodeAdded||Eo,c=r.onBeforeElUpdated||Eo,u=r.onElUpdated||Eo,f=r.onBeforeNodeDiscarded||Eo,d=r.onNodeDiscarded||Eo,O=r.onBeforeElChildrenUpdated||Eo,m=r.skipFromChildren||Eo,x=r.addChild||function(j,ue){return j.appendChild(ue)},v=r.childrenOnly===!0,w=Object.create(null),T=[];function A(j){T.push(j)}function L(j,ue){if(j.nodeType===Pc)for(var Z=j.firstChild;Z;){var P=void 0;ue&&(P=s(Z))?A(P):(d(Z),Z.firstChild&&L(Z,ue)),Z=Z.nextSibling}}function D(j,ue,Z){f(j)!==!1&&(ue&&ue.removeChild(j),d(j),L(j,Z))}function C(j){if(j.nodeType===Pc||j.nodeType===hT)for(var ue=j.firstChild;ue;){var Z=s(ue);Z&&(w[Z]=ue),C(ue),ue=ue.nextSibling}}C(i);function N(j){l(j);for(var ue=j.firstChild;ue;){var Z=ue.nextSibling,P=s(ue);if(P){var W=w[P];W&&qh(ue,W)?(ue.parentNode.replaceChild(W,ue),H(W,ue)):N(ue)}else N(ue);ue=Z}}function le(j,ue,Z){for(;ue;){var P=ue.nextSibling;(Z=s(ue))?A(Z):D(ue,j,!0),ue=P}}function H(j,ue,Z){var P=s(ue);if(P&&delete w[P],!Z){var W=c(j,ue);if(W===!1||(W instanceof HTMLElement&&(j=W,C(j)),t(j,ue),u(j),O(j,ue)===!1))return}j.nodeName!=="TEXTAREA"?M(j,ue):fT.TEXTAREA(j,ue)}function M(j,ue){var Z=m(j,ue),P=ue.firstChild,W=j.firstChild,oe,I,Ne,We,Ve;e:for(;P;){for(We=P.nextSibling,oe=s(P);!Z&&W;){if(Ne=W.nextSibling,P.isSameNode&&P.isSameNode(W)){P=We,W=Ne;continue e}I=s(W);var Et=W.nodeType,Xe=void 0;if(Et===P.nodeType&&(Et===Pc?(oe?oe!==I&&((Ve=w[oe])?Ne===Ve?Xe=!1:(j.insertBefore(Ve,W),I?A(I):D(W,j,!0),W=Ve,I=s(W)):Xe=!1):I&&(Xe=!1),Xe=Xe!==!1&&qh(W,P),Xe&&H(W,P)):(Et===dT||Et==OT)&&(Xe=!0,W.nodeValue!==P.nodeValue&&(W.nodeValue=P.nodeValue))),Xe){P=We,W=Ne;continue e}I?A(I):D(W,j,!0),W=Ne}if(oe&&(Ve=w[oe])&&qh(Ve,P))Z||x(j,Ve),H(Ve,P);else{var Rt=a(P);Rt!==!1&&(Rt&&(P=Rt),P.actualize&&(P=P.actualize(j.ownerDocument||Ni)),x(j,P),N(P))}P=We,W=Ne}le(j,W,I);var Lt=fT[j.nodeName];Lt&&Lt(j,ue)}var ie=i,ne=ie.nodeType,re=n.nodeType;if(!v){if(ne===Pc)re===Pc?qh(i,n)||(d(i),ie=R8(i,X8(n.nodeName,n.namespaceURI))):ie=n;else if(ne===dT||ne===OT){if(re===ne)return ie.nodeValue!==n.nodeValue&&(ie.nodeValue=n.nodeValue),ie;ie=n}}if(ie===n)d(i);else{if(n.isSameNode&&n.isSameNode(ie))return;if(H(ie,n,v),T)for(var de=0,pe=T.length;des.length,l;a&&s.push(r);try{l=t.apply(this,s)}catch(c){let u=c;if(a&&i)throw u;return r(u)}a||(l instanceof Promise?l.then(o,r):l instanceof Error?r(l):o(l))}function r(s,...a){i||(i=!0,e(s,...a))}function o(s){r(null,s)}}function t0(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?ET(t.position):"start"in t||"end"in t?ET(t):"line"in t||"column"in t?e0(t):""}function e0(t){return CT(t&&t.line)+":"+CT(t&&t.column)}function ET(t){return e0(t&&t.start)+"-"+e0(t&&t.end)}function CT(t){return t&&typeof t=="number"?t:1}var Zt=class extends Error{constructor(e,i,n){super(),typeof i=="string"&&(n=i,i=void 0);let r="",o={},s=!1;if(i&&("line"in i&&"column"in i?o={place:i}:"start"in i&&"end"in i?o={place:i}:"type"in i?o={ancestors:[i],place:i.position}:o=F({},i)),typeof e=="string"?r=e:!o.cause&&e&&(s=!0,r=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof n=="string"){let l=n.indexOf(":");l===-1?o.ruleId=n:(o.source=n.slice(0,l),o.ruleId=n.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){let l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}let a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=a?a.line:void 0,this.name=t0(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}};Zt.prototype.file="";Zt.prototype.name="";Zt.prototype.reason="";Zt.prototype.message="";Zt.prototype.stack="";Zt.prototype.column=void 0;Zt.prototype.line=void 0;Zt.prototype.ancestors=void 0;Zt.prototype.cause=void 0;Zt.prototype.fatal=void 0;Zt.prototype.place=void 0;Zt.prototype.ruleId=void 0;Zt.prototype.source=void 0;var Dn={basename:U8,dirname:M8,extname:N8,join:q8,sep:"/"};function U8(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');_c(t);let i=0,n=-1,r=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;r--;)if(t.codePointAt(r)===47){if(o){i=r+1;break}}else n<0&&(o=!0,n=r+1);return n<0?"":t.slice(i,n)}if(e===t)return"";let s=-1,a=e.length-1;for(;r--;)if(t.codePointAt(r)===47){if(o){i=r+1;break}}else s<0&&(o=!0,s=r+1),a>-1&&(t.codePointAt(r)===e.codePointAt(a--)?a<0&&(n=r):(a=-1,n=s));return i===n?n=s:n<0&&(n=t.length),t.slice(i,n)}function M8(t){if(_c(t),t.length===0)return".";let e=-1,i=t.length,n;for(;--i;)if(t.codePointAt(i)===47){if(n){e=i;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function N8(t){_c(t);let e=t.length,i=-1,n=0,r=-1,o=0,s;for(;e--;){let a=t.codePointAt(e);if(a===47){if(s){n=e+1;break}continue}i<0&&(s=!0,i=e+1),a===46?r<0?r=e:o!==1&&(o=1):r>-1&&(o=-1)}return r<0||i<0||o===0||o===1&&r===i-1&&r===n+1?"":t.slice(r,i)}function q8(...t){let e=-1,i;for(;++e0&&t.codePointAt(t.length-1)===47&&(i+="/"),e?"/"+i:i}function W8(t,e){let i="",n=0,r=-1,o=0,s=-1,a,l;for(;++s<=t.length;){if(s2){if(l=i.lastIndexOf("/"),l!==i.length-1){l<0?(i="",n=0):(i=i.slice(0,l),n=i.length-1-i.lastIndexOf("/")),r=s,o=0;continue}}else if(i.length>0){i="",n=0,r=s,o=0;continue}}e&&(i=i.length>0?i+"/..":"..",n=2)}else i.length>0?i+="/"+t.slice(r+1,s):i=t.slice(r+1,s),n=s-r-1;r=s,o=0}else a===46&&o>-1?o++:o=-1}return i}function _c(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}var PT={cwd:V8};function V8(){return"/"}function Ua(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function QT(t){if(typeof t=="string")t=new URL(t);else if(!Ua(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Z8(t)}function Z8(t){if(t.hostname!==""){let n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}let e=t.pathname,i=-1;for(;++i0){let[O,...m]=u,x=n[d][1];Qc(x)&&Qc(O)&&(O=(0,Vh.default)(!0,x,O)),n[d]=[c,O,...m]}}}},Zh=new l0().freeze();function o0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function s0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function a0(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function $T(t){if(!Qc(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function XT(t,e,i){if(!i)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Wh(t){return F8(t)?t:new Co(t)}function F8(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function H8(t){return typeof t=="string"||G8(t)}function G8(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var K8={};function c0(t,e){let i=e||K8,n=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,r=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return LT(t,n,r)}function LT(t,e,i){if(J8(t)){if("value"in t)return t.type==="html"&&!i?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return RT(t.children,e,i)}return Array.isArray(t)?RT(t,e,i):""}function RT(t,e,i){let n=[],r=-1;for(;++rr?0:r+e:e=e>r?r:e,i=i>0?i:0,n.length<1e4)s=Array.from(n),s.unshift(e,i),t.splice(...s);else for(i&&t.splice(e,i);o0?(ai(t,t.length,0,e),t):e}var DT={}.hasOwnProperty;function zT(t){let e={},i=-1;for(;++i13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"\uFFFD":String.fromCharCode(i)}function _r(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var iz=Po(new RegExp("\\p{P}","u")),en=Po(/[A-Za-z]/),Pi=Po(/[\dA-Za-z]/),UT=Po(/[#-'*+\--9=?A-Z^-~]/);function Ac(t){return t!==null&&(t<32||t===127)}var $c=Po(/\d/),MT=Po(/[\dA-Fa-f]/),u0=Po(/[!-/:-@[-`{-~]/);function Te(t){return t!==null&&t<-2}function jt(t){return t!==null&&(t<0||t===32)}function Le(t){return t===-2||t===-1||t===32}function NT(t){return u0(t)||iz(t)}var qT=Po(/\s/);function Po(t){return e;function e(i){return i!==null&&i>-1&&t.test(String.fromCharCode(i))}}function Ie(t,e,i,n){let r=n?n-1:Number.POSITIVE_INFINITY,o=0;return s;function s(l){return Le(l)?(t.enter(i),a(l)):e(l)}function a(l){return Le(l)&&o++s))return;let N=e.events.length,le=N,H,M;for(;le--;)if(e.events[le][0]==="exit"&&e.events[le][1].type==="chunkFlow"){if(H){M=e.events[le][1].end;break}H=!0}for(w(n),C=N;CA;){let D=i[L];e.containerState=D[1],D[0].exit.call(e,t)}i.length=A}function T(){r.write([null]),o=void 0,r=void 0,e.containerState._closeFlow=void 0}}function oz(t,e,i){return Ie(t,t.attempt(this.parser.constructs.document,e,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function f0(t){if(t===null||jt(t)||qT(t))return 1;if(NT(t))return 2}function Na(t,e,i){let n=[],r=-1;for(;++r1&&t[i][1].end.offset-t[i][1].start.offset>1?2:1;let f=Object.assign({},t[n][1].end),d=Object.assign({},t[i][1].start);ZT(f,-l),ZT(d,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},t[n][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[i][1].start),end:d},o={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[n][1].end),end:Object.assign({},t[i][1].start)},r={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},a.end)},t[n][1].end=Object.assign({},s.start),t[i][1].start=Object.assign({},a.end),c=[],t[n][1].end.offset-t[n][1].start.offset&&(c=Ci(c,[["enter",t[n][1],e],["exit",t[n][1],e]])),c=Ci(c,[["enter",r,e],["enter",s,e],["exit",s,e],["enter",o,e]]),c=Ci(c,Na(e.parser.constructs.insideSpan.null,t.slice(n+1,i),e)),c=Ci(c,[["exit",o,e],["enter",a,e],["exit",a,e],["exit",r,e]]),t[i][1].end.offset-t[i][1].start.offset?(u=2,c=Ci(c,[["enter",t[i][1],e],["exit",t[i][1],e]])):u=0,ai(t,n-1,i-n+3,c),i=n+c.length-u-2;break}}for(i=-1;++i0&&Le(C)?Ie(t,T,"linePrefix",o+1)(C):T(C)}function T(C){return C===null||Te(C)?t.check(BT,x,L)(C):(t.enter("codeFlowValue"),A(C))}function A(C){return C===null||Te(C)?(t.exit("codeFlowValue"),T(C)):(t.consume(C),A)}function L(C){return t.exit("codeFenced"),e(C)}function D(C,N,le){let H=0;return M;function M(pe){return C.enter("lineEnding"),C.consume(pe),C.exit("lineEnding"),ie}function ie(pe){return C.enter("codeFencedFence"),Le(pe)?Ie(C,ne,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(pe):ne(pe)}function ne(pe){return pe===a?(C.enter("codeFencedFenceSequence"),re(pe)):le(pe)}function re(pe){return pe===a?(H++,C.consume(pe),re):H>=s?(C.exit("codeFencedFenceSequence"),Le(pe)?Ie(C,de,"whitespace")(pe):de(pe)):le(pe)}function de(pe){return pe===null||Te(pe)?(C.exit("codeFencedFence"),N(pe)):le(pe)}}}function mz(t,e,i){let n=this;return r;function r(s){return s===null?i(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o)}function o(s){return n.parser.lazy[n.now().line]?i(s):e(s)}}var Rc={name:"codeIndented",tokenize:bz},gz={tokenize:yz,partial:!0};function bz(t,e,i){let n=this;return r;function r(c){return t.enter("codeIndented"),Ie(t,o,"linePrefix",5)(c)}function o(c){let u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):i(c)}function s(c){return c===null?l(c):Te(c)?t.attempt(gz,s,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||Te(c)?(t.exit("codeFlowValue"),s(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function yz(t,e,i){let n=this;return r;function r(s){return n.parser.lazy[n.now().line]?i(s):Te(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r):Ie(t,o,"linePrefix",5)(s)}function o(s){let a=n.events[n.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):Te(s)?r(s):i(s)}}var d0={name:"codeText",tokenize:wz,resolve:xz,previous:vz};function xz(t){let e=t.length-4,i=3,n,r;if((t[i][1].type==="lineEnding"||t[i][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=i;++n=4?e(s):t.interrupt(n.parser.constructs.flow,i,e)(s)}}function Jh(t,e,i,n,r,o,s,a,l){let c=l||Number.POSITIVE_INFINITY,u=0;return f;function f(w){return w===60?(t.enter(n),t.enter(r),t.enter(o),t.consume(w),t.exit(o),d):w===null||w===32||w===41||Ac(w)?i(w):(t.enter(n),t.enter(s),t.enter(a),t.enter("chunkString",{contentType:"string"}),x(w))}function d(w){return w===62?(t.enter(o),t.consume(w),t.exit(o),t.exit(r),t.exit(n),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),O(w))}function O(w){return w===62?(t.exit("chunkString"),t.exit(a),d(w)):w===null||w===60||Te(w)?i(w):(t.consume(w),w===92?m:O)}function m(w){return w===60||w===62||w===92?(t.consume(w),O):O(w)}function x(w){return!u&&(w===null||w===41||jt(w))?(t.exit("chunkString"),t.exit(a),t.exit(s),t.exit(n),e(w)):u999||O===null||O===91||O===93&&!l||O===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?i(O):O===93?(t.exit(o),t.enter(r),t.consume(O),t.exit(r),t.exit(n),e):Te(O)?(t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),f(O))}function f(O){return O===null||O===91||O===93||Te(O)||a++>999?(t.exit("chunkString"),u(O)):(t.consume(O),l||(l=!Le(O)),O===92?d:f)}function d(O){return O===91||O===92||O===93?(t.consume(O),a++,f):f(O)}}function td(t,e,i,n,r,o){let s;return a;function a(d){return d===34||d===39||d===40?(t.enter(n),t.enter(r),t.consume(d),t.exit(r),s=d===40?41:d,l):i(d)}function l(d){return d===s?(t.enter(r),t.consume(d),t.exit(r),t.exit(n),e):(t.enter(o),c(d))}function c(d){return d===s?(t.exit(o),l(s)):d===null?i(d):Te(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),Ie(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(d))}function u(d){return d===s||d===null||Te(d)?(t.exit("chunkString"),c(d)):(t.consume(d),d===92?f:u)}function f(d){return d===s||d===92?(t.consume(d),u):u(d)}}function Ss(t,e){let i;return n;function n(r){return Te(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),i=!0,n):Le(r)?Ie(t,n,i?"linePrefix":"lineSuffix")(r):e(r)}}var p0={name:"definition",tokenize:Qz},Pz={tokenize:_z,partial:!0};function Qz(t,e,i){let n=this,r;return o;function o(O){return t.enter("definition"),s(O)}function s(O){return ed.call(n,t,a,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(O)}function a(O){return r=_r(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),O===58?(t.enter("definitionMarker"),t.consume(O),t.exit("definitionMarker"),l):i(O)}function l(O){return jt(O)?Ss(t,c)(O):c(O)}function c(O){return Jh(t,u,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(O)}function u(O){return t.attempt(Pz,f,f)(O)}function f(O){return Le(O)?Ie(t,d,"whitespace")(O):d(O)}function d(O){return O===null||Te(O)?(t.exit("definition"),n.parser.defined.push(r),e(O)):i(O)}}function _z(t,e,i){return n;function n(a){return jt(a)?Ss(t,r)(a):i(a)}function r(a){return td(t,o,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Le(a)?Ie(t,s,"whitespace")(a):s(a)}function s(a){return a===null||Te(a)?e(a):i(a)}}var m0={name:"hardBreakEscape",tokenize:Az};function Az(t,e,i){return n;function n(o){return t.enter("hardBreakEscape"),t.consume(o),r}function r(o){return Te(o)?(t.exit("hardBreakEscape"),e(o)):i(o)}}var g0={name:"headingAtx",tokenize:Xz,resolve:$z};function $z(t,e){let i=t.length-2,n=3,r,o;return t[n][1].type==="whitespace"&&(n+=2),i-2>n&&t[i][1].type==="whitespace"&&(i-=2),t[i][1].type==="atxHeadingSequence"&&(n===i-1||i-4>n&&t[i-2][1].type==="whitespace")&&(i-=n+1===i?2:4),i>n&&(r={type:"atxHeadingText",start:t[n][1].start,end:t[i][1].end},o={type:"chunkText",start:t[n][1].start,end:t[i][1].end,contentType:"text"},ai(t,n,i-n+1,[["enter",r,e],["enter",o,e],["exit",o,e],["exit",r,e]])),t}function Xz(t,e,i){let n=0;return r;function r(u){return t.enter("atxHeading"),o(u)}function o(u){return t.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&n++<6?(t.consume(u),s):u===null||jt(u)?(t.exit("atxHeadingSequence"),a(u)):i(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||Te(u)?(t.exit("atxHeading"),e(u)):Le(u)?Ie(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||jt(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}var YT=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],b0=["pre","script","style","textarea"];var y0={name:"htmlFlow",tokenize:Dz,resolveTo:Iz,concrete:!0},Rz={tokenize:Uz,partial:!0},Lz={tokenize:zz,partial:!0};function Iz(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Dz(t,e,i){let n=this,r,o,s,a,l;return c;function c(I){return u(I)}function u(I){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(I),f}function f(I){return I===33?(t.consume(I),d):I===47?(t.consume(I),o=!0,x):I===63?(t.consume(I),r=3,n.interrupt?e:P):en(I)?(t.consume(I),s=String.fromCharCode(I),v):i(I)}function d(I){return I===45?(t.consume(I),r=2,O):I===91?(t.consume(I),r=5,a=0,m):en(I)?(t.consume(I),r=4,n.interrupt?e:P):i(I)}function O(I){return I===45?(t.consume(I),n.interrupt?e:P):i(I)}function m(I){let Ne="CDATA[";return I===Ne.charCodeAt(a++)?(t.consume(I),a===Ne.length?n.interrupt?e:ne:m):i(I)}function x(I){return en(I)?(t.consume(I),s=String.fromCharCode(I),v):i(I)}function v(I){if(I===null||I===47||I===62||jt(I)){let Ne=I===47,We=s.toLowerCase();return!Ne&&!o&&b0.includes(We)?(r=1,n.interrupt?e(I):ne(I)):YT.includes(s.toLowerCase())?(r=6,Ne?(t.consume(I),w):n.interrupt?e(I):ne(I)):(r=7,n.interrupt&&!n.parser.lazy[n.now().line]?i(I):o?T(I):A(I))}return I===45||Pi(I)?(t.consume(I),s+=String.fromCharCode(I),v):i(I)}function w(I){return I===62?(t.consume(I),n.interrupt?e:ne):i(I)}function T(I){return Le(I)?(t.consume(I),T):M(I)}function A(I){return I===47?(t.consume(I),M):I===58||I===95||en(I)?(t.consume(I),L):Le(I)?(t.consume(I),A):M(I)}function L(I){return I===45||I===46||I===58||I===95||Pi(I)?(t.consume(I),L):D(I)}function D(I){return I===61?(t.consume(I),C):Le(I)?(t.consume(I),D):A(I)}function C(I){return I===null||I===60||I===61||I===62||I===96?i(I):I===34||I===39?(t.consume(I),l=I,N):Le(I)?(t.consume(I),C):le(I)}function N(I){return I===l?(t.consume(I),l=null,H):I===null||Te(I)?i(I):(t.consume(I),N)}function le(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||jt(I)?D(I):(t.consume(I),le)}function H(I){return I===47||I===62||Le(I)?A(I):i(I)}function M(I){return I===62?(t.consume(I),ie):i(I)}function ie(I){return I===null||Te(I)?ne(I):Le(I)?(t.consume(I),ie):i(I)}function ne(I){return I===45&&r===2?(t.consume(I),ve):I===60&&r===1?(t.consume(I),j):I===62&&r===4?(t.consume(I),W):I===63&&r===3?(t.consume(I),P):I===93&&r===5?(t.consume(I),Z):Te(I)&&(r===6||r===7)?(t.exit("htmlFlowData"),t.check(Rz,oe,re)(I)):I===null||Te(I)?(t.exit("htmlFlowData"),re(I)):(t.consume(I),ne)}function re(I){return t.check(Lz,de,oe)(I)}function de(I){return t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),pe}function pe(I){return I===null||Te(I)?re(I):(t.enter("htmlFlowData"),ne(I))}function ve(I){return I===45?(t.consume(I),P):ne(I)}function j(I){return I===47?(t.consume(I),s="",ue):ne(I)}function ue(I){if(I===62){let Ne=s.toLowerCase();return b0.includes(Ne)?(t.consume(I),W):ne(I)}return en(I)&&s.length<8?(t.consume(I),s+=String.fromCharCode(I),ue):ne(I)}function Z(I){return I===93?(t.consume(I),P):ne(I)}function P(I){return I===62?(t.consume(I),W):I===45&&r===2?(t.consume(I),P):ne(I)}function W(I){return I===null||Te(I)?(t.exit("htmlFlowData"),oe(I)):(t.consume(I),W)}function oe(I){return t.exit("htmlFlow"),e(I)}}function zz(t,e,i){let n=this;return r;function r(s){return Te(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o):i(s)}function o(s){return n.parser.lazy[n.now().line]?i(s):e(s)}}function Uz(t,e,i){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),t.attempt(Qo,e,i)}}var x0={name:"htmlText",tokenize:Mz};function Mz(t,e,i){let n=this,r,o,s;return a;function a(P){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(P),l}function l(P){return P===33?(t.consume(P),c):P===47?(t.consume(P),D):P===63?(t.consume(P),A):en(P)?(t.consume(P),le):i(P)}function c(P){return P===45?(t.consume(P),u):P===91?(t.consume(P),o=0,m):en(P)?(t.consume(P),T):i(P)}function u(P){return P===45?(t.consume(P),O):i(P)}function f(P){return P===null?i(P):P===45?(t.consume(P),d):Te(P)?(s=f,j(P)):(t.consume(P),f)}function d(P){return P===45?(t.consume(P),O):f(P)}function O(P){return P===62?ve(P):P===45?d(P):f(P)}function m(P){let W="CDATA[";return P===W.charCodeAt(o++)?(t.consume(P),o===W.length?x:m):i(P)}function x(P){return P===null?i(P):P===93?(t.consume(P),v):Te(P)?(s=x,j(P)):(t.consume(P),x)}function v(P){return P===93?(t.consume(P),w):x(P)}function w(P){return P===62?ve(P):P===93?(t.consume(P),w):x(P)}function T(P){return P===null||P===62?ve(P):Te(P)?(s=T,j(P)):(t.consume(P),T)}function A(P){return P===null?i(P):P===63?(t.consume(P),L):Te(P)?(s=A,j(P)):(t.consume(P),A)}function L(P){return P===62?ve(P):A(P)}function D(P){return en(P)?(t.consume(P),C):i(P)}function C(P){return P===45||Pi(P)?(t.consume(P),C):N(P)}function N(P){return Te(P)?(s=N,j(P)):Le(P)?(t.consume(P),N):ve(P)}function le(P){return P===45||Pi(P)?(t.consume(P),le):P===47||P===62||jt(P)?H(P):i(P)}function H(P){return P===47?(t.consume(P),ve):P===58||P===95||en(P)?(t.consume(P),M):Te(P)?(s=H,j(P)):Le(P)?(t.consume(P),H):ve(P)}function M(P){return P===45||P===46||P===58||P===95||Pi(P)?(t.consume(P),M):ie(P)}function ie(P){return P===61?(t.consume(P),ne):Te(P)?(s=ie,j(P)):Le(P)?(t.consume(P),ie):H(P)}function ne(P){return P===null||P===60||P===61||P===62||P===96?i(P):P===34||P===39?(t.consume(P),r=P,re):Te(P)?(s=ne,j(P)):Le(P)?(t.consume(P),ne):(t.consume(P),de)}function re(P){return P===r?(t.consume(P),r=void 0,pe):P===null?i(P):Te(P)?(s=re,j(P)):(t.consume(P),re)}function de(P){return P===null||P===34||P===39||P===60||P===61||P===96?i(P):P===47||P===62||jt(P)?H(P):(t.consume(P),de)}function pe(P){return P===47||P===62||jt(P)?H(P):i(P)}function ve(P){return P===62?(t.consume(P),t.exit("htmlTextData"),t.exit("htmlText"),e):i(P)}function j(P){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),ue}function ue(P){return Le(P)?Ie(t,Z,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):Z(P)}function Z(P){return t.enter("htmlTextData"),s(P)}}var Ts={name:"labelEnd",tokenize:Zz,resolveTo:Vz,resolveAll:Wz},Nz={tokenize:Bz},qz={tokenize:Yz},jz={tokenize:Fz};function Wz(t){let e=-1;for(;++e=3&&(c===null||Te(c))?(t.exit("thematicBreak"),e(c)):i(c)}function l(c){return c===r?(t.consume(c),n++,l):(t.exit("thematicBreakSequence"),Le(c)?Ie(t,a,"whitespace")(c):a(c))}}var gi={name:"list",tokenize:iU,continuation:{tokenize:nU},exit:oU},eU={tokenize:sU,partial:!0},tU={tokenize:rU,partial:!0};function iU(t,e,i){let n=this,r=n.events[n.events.length-1],o=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,s=0;return a;function a(O){let m=n.containerState.type||(O===42||O===43||O===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||O===n.containerState.marker:$c(O)){if(n.containerState.type||(n.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),O===42||O===45?t.check(Es,i,c)(O):c(O);if(!n.interrupt||O===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(O)}return i(O)}function l(O){return $c(O)&&++s<10?(t.consume(O),l):(!n.interrupt||s<2)&&(n.containerState.marker?O===n.containerState.marker:O===41||O===46)?(t.exit("listItemValue"),c(O)):i(O)}function c(O){return t.enter("listItemMarker"),t.consume(O),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||O,t.check(Qo,n.interrupt?i:u,t.attempt(eU,d,f))}function u(O){return n.containerState.initialBlankLine=!0,o++,d(O)}function f(O){return Le(O)?(t.enter("listItemPrefixWhitespace"),t.consume(O),t.exit("listItemPrefixWhitespace"),d):i(O)}function d(O){return n.containerState.size=o+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(O)}}function nU(t,e,i){let n=this;return n.containerState._closeFlow=void 0,t.check(Qo,r,o);function r(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Ie(t,e,"listItemIndent",n.containerState.size+1)(a)}function o(a){return n.containerState.furtherBlankLines||!Le(a)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,s(a)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(tU,e,s)(a))}function s(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Ie(t,t.attempt(gi,e,i),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function rU(t,e,i){let n=this;return Ie(t,r,"listItemIndent",n.containerState.size+1);function r(o){let s=n.events[n.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===n.containerState.size?e(o):i(o)}}function oU(t){t.exit(this.containerState.type)}function sU(t,e,i){let n=this;return Ie(t,r,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(o){let s=n.events[n.events.length-1];return!Le(o)&&s&&s[1].type==="listItemPrefixWhitespace"?e(o):i(o)}}var id={name:"setextUnderline",tokenize:lU,resolveTo:aU};function aU(t,e){let i=t.length,n,r,o;for(;i--;)if(t[i][0]==="enter"){if(t[i][1].type==="content"){n=i;break}t[i][1].type==="paragraph"&&(r=i)}else t[i][1].type==="content"&&t.splice(i,1),!o&&t[i][1].type==="definition"&&(o=i);let s={type:"setextHeading",start:Object.assign({},t[r][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[r][1].type="setextHeadingText",o?(t.splice(r,0,["enter",s,e]),t.splice(o+1,0,["exit",t[n][1],e]),t[n][1].end=Object.assign({},t[o][1].end)):t[n][1]=s,t.push(["exit",s,e]),t}function lU(t,e,i){let n=this,r;return o;function o(c){let u=n.events.length,f;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){f=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||f)?(t.enter("setextHeadingLine"),r=c,s(c)):i(c)}function s(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===r?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Le(c)?Ie(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Te(c)?(t.exit("setextHeadingLine"),e(c)):i(c)}}var FT={tokenize:cU};function cU(t){let e=this,i=t.attempt(Qo,n,t.attempt(this.parser.constructs.flowInitial,r,Ie(t,t.attempt(this.parser.constructs.flow,r,t.attempt(O0,r)),"linePrefix")));return i;function n(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,i}function r(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,i}}var HT={resolveAll:e3()},GT=JT("string"),KT=JT("text");function JT(t){return{tokenize:e,resolveAll:e3(t==="text"?uU:void 0)};function e(i){let n=this,r=this.parser.constructs[t],o=i.attempt(r,s,a);return s;function s(u){return c(u)?o(u):a(u)}function a(u){if(u===null){i.consume(u);return}return i.enter("data"),i.consume(u),l}function l(u){return c(u)?(i.exit("data"),o(u)):(i.consume(u),l)}function c(u){if(u===null)return!0;let f=r[u],d=-1;if(f)for(;++d-1){let a=s[0];typeof a=="string"?s[0]=a.slice(n):s.shift()}o>0&&s.push(t[r].slice(0,o))}return s}function hU(t,e){let i=-1,n=[],r;for(;++ixU,contentInitial:()=>OU,disable:()=>vU,document:()=>dU,flow:()=>mU,flowInitial:()=>pU,insideSpan:()=>yU,string:()=>gU,text:()=>bU});var dU={42:gi,43:gi,45:gi,48:gi,49:gi,50:gi,51:gi,52:gi,53:gi,54:gi,55:gi,56:gi,57:gi,62:Yh},OU={91:p0},pU={[-2]:Rc,[-1]:Rc,32:Rc},mU={35:g0,42:Es,45:[id,Es],60:y0,61:id,95:Es,96:Gh,126:Gh},gU={38:Hh,92:Fh},bU={[-5]:Lc,[-4]:Lc,[-3]:Lc,33:v0,38:Hh,42:Xc,60:[h0,x0],91:w0,92:[m0,Fh],93:Ts,95:Xc,96:d0},yU={null:[Xc,HT]},xU={null:[42,95]},vU={null:[]};function S0(t){let i=zT([k0,...(t||{}).extensions||[]]),n={defined:[],lazy:{},constructs:i,content:r(jT),document:r(VT),flow:r(FT),string:r(GT),text:r(KT)};return n;function r(o){return s;function s(a){return t3(n,o,a)}}}function T0(t){for(;!Kh(t););return t}var i3=/[\0\t\n\r]/g;function E0(){let t=1,e="",i=!0,n;return r;function r(o,s,a){let l=[],c,u,f,d,O;for(o=e+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),f=0,e="",i&&(o.charCodeAt(0)===65279&&f++,i=void 0);f0){let Gi=Ce.tokenStack[Ce.tokenStack.length-1];(Gi[1]||s3).call(Ce,void 0,Gi[0])}for(ye.position={start:_o(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:_o(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e-1&&t.test(String.fromCharCode(i))}}function Q0(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var sr=function(t){if(t==null)return AU;if(typeof t=="function")return rd(t);if(typeof t=="object")return Array.isArray(t)?PU(t):QU(t);if(typeof t=="string")return _U(t);throw new Error("Expected function, string, or object as test")};function PU(t){let e=[],i=-1;for(;++i":""))+")"})}return d;function d(){let O=f3,m,x,v;if((!e||o(l,c,u[u.length-1]||void 0))&&(O=XU(i(l,u)),O[0]===Cs))return O;if("children"in l&&l.children){let w=l;if(w.children&&O[0]!==Wa)for(x=(n?w.children.length:-1)+s,v=u.concat(w);x>-1&&x0?{type:"text",value:C}:void 0),C===!1?d.lastIndex=L+1:(m!==L&&T.push({type:"text",value:c.value.slice(m,L)}),Array.isArray(C)?T.push(...C):C&&T.push(C),m=L+A[0].length,w=!0),!d.global)break;A=d.exec(c.value)}return w?(m?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let i=e[0],n=i.indexOf(")"),r=ja(t,"("),o=ja(t,")");for(;n!==-1&&r>o;)t+=i.slice(0,n+1),i=i.slice(n+1),n=i.indexOf(")"),o++;return[t,i]}function h3(t,e){let i=t.input.charCodeAt(t.index-1);return(t.index===0||u3(i)||c3(i))&&(!e||i!==47)}function I0(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}d3.peek=t9;function D0(){return{enter:{gfmFootnoteDefinition:BU,gfmFootnoteDefinitionLabelString:YU,gfmFootnoteCall:GU,gfmFootnoteCallString:KU},exit:{gfmFootnoteDefinition:HU,gfmFootnoteDefinitionLabelString:FU,gfmFootnoteCall:e9,gfmFootnoteCallString:JU}}}function z0(){return{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:i9,footnoteReference:d3}}}function BU(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function YU(){this.buffer()}function FU(t){let e=this.resume(),i=this.stack[this.stack.length-1];i.type,i.label=e,i.identifier=I0(this.sliceSerialize(t)).toLowerCase()}function HU(t){this.exit(t)}function GU(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function KU(){this.buffer()}function JU(t){let e=this.resume(),i=this.stack[this.stack.length-1];i.type,i.label=e,i.identifier=I0(this.sliceSerialize(t)).toLowerCase()}function e9(t){this.exit(t)}function d3(t,e,i,n){let r=i.createTracker(n),o=r.move("[^"),s=i.enter("footnoteReference"),a=i.enter("reference");return o+=r.move(i.safe(i.associationId(t),Ee(F({},r.current()),{before:o,after:"]"}))),a(),s(),o+=r.move("]"),o}function t9(){return"["}function i9(t,e,i,n){let r=i.createTracker(n),o=r.move("[^"),s=i.enter("footnoteDefinition"),a=i.enter("label");return o+=r.move(i.safe(i.associationId(t),Ee(F({},r.current()),{before:o,after:"]"}))),a(),o+=r.move("]:"+(t.children&&t.children.length>0?" ":"")),r.shift(4),o+=r.move(i.indentLines(i.containerFlow(t,r.current()),n9)),s(),o}function n9(t,e,i){return e===0?t:(i?"":" ")+t}var r9=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];O3.peek=a9;function U0(){return{canContainEols:["delete"],enter:{strikethrough:o9},exit:{strikethrough:s9}}}function M0(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:r9}],handlers:{delete:O3}}}function o9(t){this.enter({type:"delete",children:[]},t)}function s9(t){this.exit(t)}function O3(t,e,i,n){let r=i.createTracker(n),o=i.enter("strikethrough"),s=r.move("~~");return s+=i.containerPhrasing(t,Ee(F({},r.current()),{before:s,after:"~"})),s+=r.move("~~"),o(),s}function a9(){return"~"}function m3(t,e={}){let i=(e.align||[]).concat(),n=e.stringLength||c9,r=[],o=[],s=[],a=[],l=0,c=-1;for(;++cl&&(l=t[c].length);++va[v])&&(a[v]=T)}m.push(w)}o[c]=m,s[c]=x}let u=-1;if(typeof i=="object"&&"length"in i)for(;++ua[u]&&(a[u]=w),d[u]=w),f[u]=T}o.splice(1,0,f),s.splice(1,0,d),c=-1;let O=[];for(;++c "),o.shift(2);let s=i.indentLines(i.containerFlow(t,o.current()),u9);return r(),s}function u9(t,e,i){return">"+(i?"":" ")+t}function x3(t,e){return y3(t,e.inConstruct,!0)&&!y3(t,e.notInConstruct,!1)}function y3(t,e,i){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return i;let n=-1;for(;++n