self.System=self.System||(()=>{const e={},t={},n=e=>e.replace(/^.\/(\w+)-[a-f0-9]{8,}.js$/,"./$1.js"),s=window.customElements?Promise.resolve():new Promise((e,t)=>{const n=document.getElementById("js-conditional-compat");if(!(n instanceof HTMLScriptElement))return t(new Error("unable to load compat.js"));const s=setTimeout(()=>{t(new Error("timed out loading compat.js"))},1e4);n.onload=()=>{clearTimeout(s),e()},n.onerror=()=>{clearTimeout(s),t(new Error("network error loading compat.js"))},n.src=n.getAttribute("data-src")||"",n.removeAttribute("data-src")}),o={register(r,i){const a=n(`./${((document.currentScript||{}).src||"").split("?").shift().split("/").pop()}`),c={},l=i((e,t)=>t?c[e]=t:Object.assign(c,e),o),u=r.map((e,t)=>o.import(n(e)).then(l.setters[t]));u.unshift(s),e[a]=Promise.all(u).then(()=>(l.execute(),c)).catch(e=>{throw e.message=`evaluating module ${a}: ${e.message}`,e}),t[a]&&(t[a](e[a]),delete t[a])},import:n=>e[n]||(e[n]=new Promise((e,s)=>{const o=setTimeout(()=>{s(new Error(`could not resolve ${n}`))},1e4);t[n]=t=>{clearTimeout(o),e(t)}}))};return o})(),System.register(["./frameworks.js","./vendor.js"],(function(){"use strict";var e,t,n,s,o,r,i,a,c,l,u,d,m,f,p,g,h,b,v,w,j,y,E,L,T,k,M,S,A,x,H,C,q,I,_,$,D,N,B,P,R,F,O,U,W,z,V,K,Y,J,X,G,Q,Z,ee,te,ne,se,oe,re,ie,ae,ce,le,ue,de,me,fe,pe,ge,he,be,ve,we,je,ye,Ee,Le,Te,ke,Me,Se,Ae,xe,He,Ce,qe,Ie,_e,$e,De,Ne,Be,Pe,Re,Fe,Oe,Ue,We,ze,Ve,Ke,Ye,Je,Xe,Ge,Qe,Ze,et,tt,nt,st,ot,rt,it,at,ct,lt,ut,dt,mt,ft,pt,gt,ht,bt,vt,wt;return{setters:[function(ft){e=ft.n,t=ft.q,n=ft.a,s=ft.p,o=ft.v,r=ft.i,i=ft.w,a=ft.x,c=ft.u,l=ft.y,u=ft.z,d=ft.b,m=ft.I,f=ft.A,p=ft.c,g=ft.B,h=ft.g,b=ft.C,v=ft.D,w=ft.E,j=ft.e,y=ft.o,E=ft.j,L=ft.r,T=ft.F,k=ft.G,M=ft.H,S=ft.J,A=ft.h,x=ft.K,H=ft.S,C=ft.l,q=ft.s,I=ft.L,_=ft.M,$=ft.d,D=ft.N,N=ft.k,B=ft.R,P=ft.O,R=ft.P,F=ft.f,O=ft.Q,U=ft.T,W=ft.U,z=ft.V,V=ft.W,K=ft.X,Y=ft.Y,J=ft.Z,X=ft._,G=ft.$,Q=ft.a0,Z=ft.a1,ee=ft.a2,te=ft.a3,ne=ft.a4,se=ft.a5,oe=ft.a6,re=ft.a7,ie=ft.a8,ae=ft.a9,ce=ft.aa,le=ft.ab,ue=ft.ac,de=ft.ad,me=ft.ae,fe=ft.af,pe=ft.ag,ge=ft.ah,he=ft.ai,be=ft.aj,ve=ft.ak,we=ft.m,je=ft.t,ft.al,ye=ft.am,Ee=ft.an,Le=ft.ao,Te=ft.ap,ke=ft.aq,Me=ft.ar,Se=ft.as,Ae=ft.at,xe=ft.au,He=ft.av,Ce=ft.aw,qe=ft.ax,Ie=ft.ay,_e=ft.az,$e=ft.aA,De=ft.aB,Ne=ft.aC,Be=ft.aD,Pe=ft.aE,Re=ft.aF,Fe=ft.aG,Oe=ft.aH,Ue=ft.aI,We=ft.aJ,ze=ft.aK,Ve=ft.aL,Ke=ft.aM,Ye=ft.aN,Je=ft.aO,Xe=ft.aP,Ge=ft.aQ,Qe=ft.aR,Ze=ft.aS,et=ft.aT,tt=ft.aU,nt=ft.aV,st=ft.aW,ot=ft.aX,rt=ft.aY,it=ft.aZ,at=ft.a_,ct=ft.a$,lt=ft.b0,ut=ft.b1,dt=ft.b2,mt=ft.b3},function(e){ft=e.o,pt=e.a,gt=e.d,ht=e.f,bt=e.t,vt=e.r,wt=e.h}],execute:function(){window.requestIdleCallback=window.requestIdleCallback||function(e){var t=Date.now();return setTimeout((function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})}),1)},window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)};e((function(e,t){var n,s;n=window,s=document,e.exports={polyfill:function(){if(!("scrollBehavior"in s.documentElement.style&&!0!==n.__forceSmoothScrollPolyfill__)){var e,t=n.HTMLElement||n.Element,o=(e=n.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(e)?1:0),r={scroll:n.scroll||n.scrollTo,scrollBy:n.scrollBy,elementScroll:t.prototype.scroll||a,scrollIntoView:t.prototype.scrollIntoView},i=n.performance&&n.performance.now?n.performance.now.bind(n.performance):Date.now;n.scroll=n.scrollTo=function(){void 0!==arguments[0]&&(!0!==c(arguments[0])?p.call(n,s.body,void 0!==arguments[0].left?~~arguments[0].left:n.scrollX||n.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:n.scrollY||n.pageYOffset):r.scroll.call(n,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:n.scrollX||n.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:n.scrollY||n.pageYOffset))},n.scrollBy=function(){void 0!==arguments[0]&&(c(arguments[0])?r.scrollBy.call(n,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):p.call(n,s.body,~~arguments[0].left+(n.scrollX||n.pageXOffset),~~arguments[0].top+(n.scrollY||n.pageYOffset)))},t.prototype.scroll=t.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0!==c(arguments[0])){var e=arguments[0].left,t=arguments[0].top;p.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)}else{if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value couldn't be converted");r.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}},t.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==c(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):r.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},t.prototype.scrollIntoView=function(){if(!0!==c(arguments[0])){var e=m(this),t=e.getBoundingClientRect(),o=this.getBoundingClientRect();e!==s.body?(p.call(this,e,e.scrollLeft+o.left-t.left,e.scrollTop+o.top-t.top),"fixed"!==n.getComputedStyle(e).position&&n.scrollBy({left:t.left,top:t.top,behavior:"smooth"})):n.scrollBy({left:o.left,top:o.top,behavior:"smooth"})}else r.scrollIntoView.call(this,void 0===arguments[0]||arguments[0])}}function a(e,t){this.scrollLeft=e,this.scrollTop=t}function c(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function l(e,t){return"Y"===t?e.clientHeight+o1?1:a,t=.5*(1-Math.cos(Math.PI*r)),s=e.startX+(e.x-e.startX)*t,o=e.startY+(e.y-e.startY)*t,e.method.call(e.scrollable,s,o),s===e.x&&o===e.y||n.requestAnimationFrame(f.bind(n,e))}function p(e,t,o){var c,l,u,d,m=i();e===s.body?(c=n,l=n.scrollX||n.pageXOffset,u=n.scrollY||n.pageYOffset,d=r.scroll):(c=e,l=e.scrollLeft,u=e.scrollTop,d=a),f({scrollable:c,method:d,startTime:m,startX:l,startY:u,x:t,y:o})}}}})).polyfill;function jt(e){const t=[];for(const n of document.cookie.split(";")){const[s,o]=n.trim().split("=");e===s&&void 0!==o&&t.push({key:s,value:o})}return t}function yt(e,t,n=null,s=!1){let o=document.domain;if(null==o)throw new Error("Unable to get document domain");o.endsWith(".github.com")&&(o="github.com");const r="https:"===location.protocol?"; secure":"",i=n?`; expires=${n}`:"";!1===s&&(o=`.${o}`),document.cookie=`${e}=${t}; path=/; domain=${o}${i}${r}`}function Et(e,t=!1){let n=document.domain;if(null==n)throw new Error("Unable to get document domain");n.endsWith(".github.com")&&(n="github.com");const s=(new Date).getTime(),o=new Date(s-1).toUTCString(),r="https:"===location.protocol?"; secure":"",i=`; expires=${o}`;!1===t&&(n=`.${n}`),document.cookie=`${e}=''; path=/; domain=${n}${i}${r}`}function Lt(e){if(!window._octo)return;const n=Math.floor((new Date).getTime()/1e3);e.timestamp=n;if(document.head&&document.head.querySelector('meta[name="octolytics-event-url"]')){const n=t(document.head,'meta[name="octolytics-event-url"]',HTMLMetaElement).content,s=JSON.stringify(e);navigator.sendBeacon&&navigator.sendBeacon(n,s)}}function Tt(){let e="";const t=jt("_octo"),n=[];for(const s of t){const t=s.value.split(".");if("GH1"===t.shift()&&t.length>1){const s=(t.shift()||"").split("-");1===s.length&&(s[1]="1");const o=[Number(s[0]),Number(s[1])];e=t.join("."),n.push([o,e])}}return e="",n.length>0&&(e=String(n.sort().reverse()[0][1])),e}function kt(e){const t=document.querySelectorAll(e);if(t.length>0)return t[t.length-1]}function Mt(){return`${window.location.protocol}//${window.location.host}${function(){const e=kt("meta[name=analytics-location]");return e instanceof HTMLMetaElement?e.content:window.location.pathname}()+function(){let e="";kt("meta[name=analytics-location-query-strip]")||(e=window.location.search);const t=kt("meta[name=analytics-location-params]");t instanceof HTMLMetaElement&&(e+=(e?"&":"?")+t.content);for(const s of n(document,"meta[name=analytics-param-rename]",HTMLMetaElement)){const t=s.content.split(":",2);e=e.replace(new RegExp(`(^|[?&])${t[0]}($|=)`,"g"),`$1${t[1]}$2`)}return e}()}`}window.getSelection&&!function(){const e=document.createElement("div");return e.style.cssText="-ms-user-select: element; user-select: contain;","element"===e.style.getPropertyValue("-ms-user-select")||"contain"===e.style.getPropertyValue("-ms-user-select")||"contain"===e.style.getPropertyValue("user-select")}()&&document.addEventListener("click",(function(e){if(!(e.target instanceof Element))return;const t=e.target.closest(".user-select-contain");if(!t)return;const n=window.getSelection();if(!n.rangeCount)return;const s=n.getRangeAt(0).commonAncestorContainer;t.contains(s)||n.selectAllChildren(t)})),window.Element&&!Element.prototype.toggleAttribute&&(Element.prototype.toggleAttribute=function(e,t){var n=!!t,s=2===arguments.length&&!t;return null!==this.getAttribute(e)?!!n||(this.removeAttribute(e),!1):!s&&(this.setAttribute(e,""),!0)}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,"flatMap",{writable:!0,configurable:!0,value(e,t){return Array.prototype.reduce.call(this,(n,s,o,r)=>{const i=e.call(t,s,o,r);return Array.isArray(i)?n.concat(i):(n.push(i),n)},[])}}),ft("click","[data-octo-click]",(function(e){if(!window._octo)return;const t=e.currentTarget,n=t instanceof HTMLElement&&t.getAttribute("data-octo-click")||"",s={};s.event_type=n;const o={},r={},i={};let a=[];t instanceof HTMLElement&&t.hasAttribute("data-octo-dimensions")&&(a=(t.getAttribute("data-octo-dimensions")||"").split(","));const c=document.head?document.head.querySelectorAll('meta[name^="octolytics-"]'):[];for(const u of c)if(u instanceof HTMLMetaElement)if(u.name.startsWith("octolytics-dimension-")){o[u.name.replace(/^octolytics-dimension-/,"")]=u.content}else if(u.name.startsWith("octolytics-measure-")){r[u.name.replace(/^octolytics-measure-/,"")]=u.content}else if(u.name.startsWith("octolytics-context-")){i[u.name.replace(/^octolytics-context-/,"")]=u.content}else if(u.name.startsWith("octolytics-actor-")){o[u.name.replace(/^octolytics-/,"").replace(/-/g,"_")]=u.content}else if(u.name.startsWith("octolytics-")){s[u.name.replace(/^octolytics-/,"").replace(/-/g,"_")]=u.content}const l=document.querySelector("meta[name=visitor-payload]");if(l instanceof HTMLMetaElement){const e=JSON.parse(atob(l.content));Object.assign(o,e)}if(t instanceof HTMLElement&&t.hasAttribute("data-ga-click")){const e=(t.getAttribute("data-ga-click")||"").split(",").map(e=>e.trim());o.category=e[0],o.action=e[1]}for(const u of a){const e=u.split(":"),t=e.shift();t&&(o[t]=e.join(":"))}s.dimensions=o,s.measures=r,s.context=i,Lt(s)}));let St=!1,At=0;function xt(e,t={}){Ht(qt(e,t))}function Ht(e){const t=o(document,"browser-errors-url");var n;t&&(e.error&&e.error.stack&&(n=e.error.stack,It.test(n))?St=!0:(At++,window.fetch(t,{method:"post",body:JSON.stringify(e)}).catch((function(){}))))}const Ct=(new Date).getTime();function qt(e,t={}){let n;if(e){let s="";const o=e;if(e.stack){const{framesToPop:t}=o;s=function(e,t=0){if(0===t)return e;let n=e.split("\n");null!=t&&(n=n.slice(t));return n.join("\n")}(function(e){const t=e.split("\n");return function(e){return e.length>=2&&_t.test(e[0])&&$t.test(e[1])}(t)?(t.shift(),t.join("\n")):e}(e.stack),t)}else{let{fileName:e,lineNumber:n,columnNumber:r}=o;null==e&&(e=String(t.filename)),null==n&&(n=t.lineno||0),null==r&&(r=t.colno||0),s=`${e}:${n}:${r}`}n={message:e.message,name:e.name,stack:s}}return Object.assign({error:n,filename:"",lineno:0,colno:0,sanitizedUrl:Mt()||window.location.href,readyState:document.readyState,referrer:document.referrer,timeSinceLoad:Math.round((new Date).getTime()-Ct),user:Dt()||void 0},t)}const It=/(chrome|moz|safari)-extension:\/\//;const _t=/^\S/,$t=/^\s+at /;function Dt(){const e=o(document,"user-login");if(e)return e;const t=Tt();return t?`anonymous-${t}`:null}let Nt=!1;function Bt(){return!Nt&&!St&&At<10&&"function"==typeof Blob&&"undefined"!=typeof customElements&&"undefined"!=typeof Intl&&"undefined"!=typeof MutationObserver&&"undefined"!=typeof URLSearchParams&&!s(document)}function Pt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,{start:n=!0,middle:s=!0,once:o=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var r,i=0,a=!1,c=function c(){for(var l=arguments.length,u=new Array(l),d=0;d{Nt=!1}),window.addEventListener("pagehide",()=>{Nt=!0}),window.addEventListener("error",(function(e){Bt()&&Ht(function(e){const{message:t,filename:n,lineno:s,colno:o,error:r}=e;return qt(r,{message:t,filename:n,lineno:s,colno:o})}(e))})),window.addEventListener("unhandledrejection",(function(e){Bt()&&e.promise&&e.promise.catch(e=>{e&&e.response instanceof Response||xt(e,{})})})),"#b00m"===window.location.hash&&setTimeout(()=>{throw new Error("b00m")});const Rt=new WeakMap;class AutoCheckElement extends HTMLElement{connectedCallback(){const e=this.input;if(!e)return;const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,{start:n=!1,middle:s=!1,once:o=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Pt(e,t,{start:n,middle:s,once:o})}(Ot.bind(null,this),300),n={check:t,controller:null};Rt.set(this,n),e.addEventListener("input",Ft),e.addEventListener("input",t),e.autocomplete="off",e.spellcheck=!1}disconnectedCallback(){const e=this.input;if(!e)return;const t=Rt.get(this);t&&(Rt.delete(this),e.removeEventListener("input",Ft),e.removeEventListener("input",t.check),e.setCustomValidity(""))}attributeChangedCallback(e){if("required"===e){const e=this.input;if(!e)return;e.required=this.required}}static get observedAttributes(){return["required"]}get input(){const e=this.querySelector("input");return e instanceof HTMLInputElement?e:null}get src(){const e=this.getAttribute("src");if(!e)return"";const t=this.ownerDocument.createElement("a");return t.href=e,t.href}set src(e){this.setAttribute("src",e)}get csrf(){const e=this.querySelector("[data-csrf]");return this.getAttribute("csrf")||e instanceof HTMLInputElement&&e.value||""}set csrf(e){this.setAttribute("csrf",e)}get required(){return this.hasAttribute("required")}set required(e){e?this.setAttribute("required",""):this.removeAttribute("required")}}function Ft(e){const t=e.currentTarget;if(!(t instanceof HTMLInputElement))return;const n=t.closest("auto-check");if(!(n instanceof AutoCheckElement))return;const s=n.src,o=n.csrf,r=Rt.get(n);if(!s||!o||!r)return;let i="Verifyingโ€ฆ";t.dispatchEvent(new CustomEvent("auto-check-start",{bubbles:!0,detail:{setValidity:e=>i=e}})),n.required&&t.setCustomValidity(i)}async function Ot(e){const t=e.input;if(!t)return;const n=e.src,s=e.csrf,o=Rt.get(e);if(!n||!s||!o)return void(e.required&&t.setCustomValidity(""));if(!t.value.trim())return void(e.required&&t.setCustomValidity(""));const r=new FormData;r.append("authenticity_token",s),r.append("value",t.value),t.dispatchEvent(new CustomEvent("auto-check-send",{bubbles:!0,detail:{body:r}})),o.controller?o.controller.abort():e.dispatchEvent(new CustomEvent("loadstart")),o.controller="AbortController"in window?new AbortController:{signal:null,abort(){}};try{const s=await async function(e,t,n){try{const s=await fetch(t,n);return e.dispatchEvent(new CustomEvent("load")),e.dispatchEvent(new CustomEvent("loadend")),s}catch(s){throw"AbortError"!==s.name&&(e.dispatchEvent(new CustomEvent("error")),e.dispatchEvent(new CustomEvent("loadend"))),s}}(e,n,{credentials:"same-origin",signal:o.controller.signal,method:"POST",body:r});200===s.status?function(e,t,n){n&&t.setCustomValidity("");t.dispatchEvent(new CustomEvent("auto-check-success",{bubbles:!0,detail:{response:e.clone()}}))}(s,t,e.required):function(e,t,n){let s="Validation failed";t.dispatchEvent(new CustomEvent("auto-check-error",{bubbles:!0,detail:{response:e.clone(),setValidity:e=>s=e}})),n&&t.setCustomValidity(s)}(s,t,e.required),o.controller=null,t.dispatchEvent(new CustomEvent("auto-check-complete",{bubbles:!0}))}catch(i){"AbortError"!==i.name&&(o.controller=null,t.dispatchEvent(new CustomEvent("auto-check-complete",{bubbles:!0})))}}function Ut(e){if("clipboard"in navigator)return navigator.clipboard.writeText(e.textContent);const t=getSelection();if(null==t)return Promise.reject(new Error);t.removeAllRanges();const n=document.createRange();return n.selectNodeContents(e),t.addRange(n),document.execCommand("copy"),t.removeAllRanges(),Promise.resolve()}function Wt(e){if("clipboard"in navigator)return navigator.clipboard.writeText(e);const t=document.body;if(!t)return Promise.reject(new Error);const n=function(e){const t=document.createElement("pre");return t.style.width="1px",t.style.height="1px",t.style.position="fixed",t.style.top="5px",t.textContent=e,t}(e);return t.appendChild(n),Ut(n),t.removeChild(n),Promise.resolve()}function zt(e){const t=e.getAttribute("for"),n=e.getAttribute("value");function s(){e.dispatchEvent(new CustomEvent("clipboard-copy",{bubbles:!0}))}if(n)Wt(n).then(s);else if(t){const n=e.ownerDocument.getElementById(t);n&&(o=n,o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement?"hidden"===o.type?Wt(o.value):function(e){if("clipboard"in navigator)return navigator.clipboard.writeText(e.value);e.select(),document.execCommand("copy");const t=getSelection();return null!=t&&t.removeAllRanges(),Promise.resolve()}(o):o instanceof HTMLAnchorElement&&o.hasAttribute("href")?Wt(o.href):Ut(o)).then(s)}var o}function Vt(e){const t=e.currentTarget;t instanceof HTMLElement&&zt(t)}function Kt(e){if(" "===e.key||"Enter"===e.key){const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),zt(t))}}function Yt(e){e.currentTarget.addEventListener("keydown",Kt)}function Jt(e){e.currentTarget.removeEventListener("keydown",Kt)}window.customElements.get("auto-check")||(window.AutoCheckElement=AutoCheckElement,window.customElements.define("auto-check",AutoCheckElement));class ClipboardCopyElement extends HTMLElement{constructor(){super(),this.addEventListener("click",Vt),this.addEventListener("focus",Yt),this.addEventListener("blur",Jt)}connectedCallback(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button")}get value(){return this.getAttribute("value")||""}set value(e){this.setAttribute("value",e)}}window.customElements.get("clipboard-copy")||(window.ClipboardCopyElement=ClipboardCopyElement,window.customElements.define("clipboard-copy",ClipboardCopyElement));class DetailsMenuElement extends HTMLElement{constructor(){super()}get preload(){return this.hasAttribute("preload")}set preload(e){e?this.setAttribute("preload",""):this.removeAttribute("preload")}get src(){return this.getAttribute("src")||""}set src(e){this.setAttribute("src",e)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","menu");const e=this.parentElement;if(!e)return;const t=e.querySelector("summary");t&&(t.setAttribute("aria-haspopup","menu"),t.hasAttribute("role")||t.setAttribute("role","button"));const n=[Qt(e,"compositionstart",e=>ln(this,e)),Qt(e,"compositionend",e=>ln(this,e)),Qt(e,"click",t=>on(e,this,t)),Qt(e,"change",t=>on(e,this,t)),Qt(e,"keydown",t=>function(e,t,n){if(!(n instanceof KeyboardEvent))return;if(e.querySelector("details[open]"))return;const s=Xt.get(t);if(!s||s.isComposing)return;const o=n.target instanceof Element&&"SUMMARY"===n.target.tagName;switch(n.key){case"Escape":e.hasAttribute("open")&&(cn(e),n.preventDefault(),n.stopPropagation());break;case"ArrowDown":{o&&!e.hasAttribute("open")&&e.setAttribute("open","");const t=nn(e,!0);t&&t.focus(),n.preventDefault()}break;case"ArrowUp":{o&&!e.hasAttribute("open")&&e.setAttribute("open","");const t=nn(e,!1);t&&t.focus(),n.preventDefault()}break;case"n":if(sn&&n.ctrlKey){const t=nn(e,!0);t&&t.focus(),n.preventDefault()}break;case"p":if(sn&&n.ctrlKey){const t=nn(e,!1);t&&t.focus(),n.preventDefault()}break;case" ":case"Enter":{const t=document.activeElement;t&&an(t)&&t.closest("details")===e&&(n.preventDefault(),n.stopPropagation(),t.click())}}}(e,this,t)),Qt(e,"toggle",()=>Zt(e,this),{once:!0}),Qt(e,"toggle",()=>function(e){if(!e.hasAttribute("open"))return;for(const t of document.querySelectorAll("details[open] > details-menu")){const n=t.closest("details");n&&n!==e&&!n.contains(e)&&n.removeAttribute("open")}}(e)),this.preload?Qt(e,"mouseover",()=>Zt(e,this),{once:!0}):Gt,...en(e)];Xt.set(this,{subscriptions:n,loaded:!1,isComposing:!1})}disconnectedCallback(){const e=Xt.get(this);if(e){Xt.delete(this);for(const t of e.subscriptions)t.unsubscribe()}}}const Xt=new WeakMap,Gt={unsubscribe(){}};function Qt(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return e.addEventListener(t,n,s),{unsubscribe:()=>{e.removeEventListener(t,n,s)}}}function Zt(e,t){const n=t.getAttribute("src");if(!n)return;const s=Xt.get(t);if(!s)return;if(s.loaded)return;s.loaded=!0;const o=t.querySelector("include-fragment");o&&!o.hasAttribute("src")&&(o.addEventListener("loadend",()=>tn(e)),o.setAttribute("src",n))}function en(e){let t=!1;return[Qt(e,"mousedown",()=>t=!0),Qt(e,"keydown",()=>t=!1),Qt(e,"toggle",()=>{e.hasAttribute("open")&&(tn(e)||t||function(e){const t=document.activeElement;if(t&&an(t)&&e.contains(t))return;const n=nn(e,!0);n&&n.focus()}(e))})]}function tn(e){if(!e.hasAttribute("open"))return!1;const t=e.querySelector("[autofocus]");return!!t&&(t.focus(),!0)}function nn(e,t){const n=Array.from(e.querySelectorAll('[role^="menuitem"]:not([hidden]):not([disabled]):not([aria-disabled="true"])')),s=document.activeElement,o=n.indexOf(s),r=t?n[o+1]:n[o-1],i=t?n[0]:n[n.length-1];return r||i}const sn=navigator.userAgent.match(/Macintosh/);function on(e,t,n){const s=n.target;if(s instanceof Element&&s.closest("details")===e)if("click"===n.type){const t=s.closest('[role="menuitem"], [role="menuitemradio"]'),n=t&&"LABEL"===t.tagName&&t.querySelector("input");t&&!n&&rn(t,e)}else if("change"===n.type){const t=s.closest('[role="menuitemradio"], [role="menuitemcheckbox"]');t&&rn(t,e)}}function rn(e,t){if(e.hasAttribute("disabled")||"true"===e.getAttribute("aria-disabled"))return;const n=e.closest("details-menu");n&&n.dispatchEvent(new CustomEvent("details-menu-select",{cancelable:!0,detail:{relatedTarget:e}}))&&(!function(e,t){const n=t.querySelector("[data-menu-button]");if(!n)return;const s=function(e){if(!e)return null;const t=e.hasAttribute("data-menu-button-text")?e:e.querySelector("[data-menu-button-text]");return t?t.getAttribute("data-menu-button-text")||t.textContent:null}(e);if(s)n.textContent=s;else{const t=function(e){if(!e)return null;const t=e.hasAttribute("data-menu-button-contents")?e:e.querySelector("[data-menu-button-contents]");return t?t.innerHTML:null}(e);t&&(n.innerHTML=t)}}(e,t),function(e,t){for(const n of t.querySelectorAll('[role="menuitemradio"], [role="menuitemcheckbox"]')){const t=n.querySelector('input[type="radio"], input[type="checkbox"]');let s=n===e;t instanceof HTMLInputElement&&(s=t.indeterminate?"mixed":t.checked),n.setAttribute("aria-checked",s.toString())}}(e,t),"menuitemcheckbox"!==e.getAttribute("role")&&cn(t),n.dispatchEvent(new CustomEvent("details-menu-selected",{detail:{relatedTarget:e}})))}function an(e){const t=e.getAttribute("role");return"menuitem"===t||"menuitemcheckbox"===t||"menuitemradio"===t}function cn(e){if(!e.hasAttribute("open"))return;e.removeAttribute("open");const t=e.querySelector("summary");t&&t.focus()}function ln(e,t){const n=Xt.get(e);n&&(n.isComposing="compositionstart"===t.type)}window.customElements.get("details-menu")||(window.DetailsMenuElement=DetailsMenuElement,window.customElements.define("details-menu",DetailsMenuElement));class un{constructor(e,t){this.file=e,this.directory=t,this.state="pending",this.id=null,this.href=null,this.name=null,this.percent=0}static traverse(e,t){return function(e,t){if(t&&function(e){return e.items&&Array.from(e.items).some(e=>{const t=e.webkitGetAsEntry&&e.webkitGetAsEntry();return t&&t.isDirectory})}(e))return async function e(t,n){const s=[];for(const o of dn(n))if(o.isDirectory)s.push(...await e(o.fullPath,await fn(o)));else{const e=await mn(o);s.push(new un(e,t))}return s}("",function(e){return Array.from(e.items).map(e=>e.webkitGetAsEntry())}(e));return Promise.resolve(dn(Array.from(e.files)).map(e=>new un(e)))}(e,t)}static from(e){const t=[];for(const n of e)if(n instanceof File)t.push(new un(n));else{if(!(n instanceof un))throw new Error("Unexpected type");t.push(n)}return t}get fullPath(){return this.directory?`${this.directory}/${this.file.name}`:this.file.name}isImage(){return["image/gif","image/png","image/jpg","image/jpeg"].indexOf(this.file.type)>-1}saving(e){if("pending"!==this.state&&"saving"!==this.state)throw new Error(`Unexpected transition from ${this.state} to saving`);this.state="saving",this.percent=e}saved(e){var t,n,s,o,r,i;if("pending"!==this.state&&"saving"!==this.state)throw new Error(`Unexpected transition from ${this.state} to saved`);this.state="saved",this.id=null!=(n=null===(t=e)||void 0===t?void 0:t.id)?n:null,this.href=null!=(o=null===(s=e)||void 0===s?void 0:s.href)?o:null,this.name=null!=(i=null===(r=e)||void 0===r?void 0:r.name)?i:null}isPending(){return"pending"===this.state}isSaving(){return"saving"===this.state}isSaved(){return"saved"===this.state}}function dn(e){return Array.from(e).filter(e=>!function(e){return e.name.startsWith(".")}(e))}function mn(e){return new Promise((function(t,n){e.file(t,n)}))}function fn(e){return new Promise((function(t,n){const s=[],o=e.createReader(),r=()=>{o.readEntries(e=>{e.length>0?(s.push(...e),r()):t(s)},n)};r()}))}class FileAttachmentElement extends HTMLElement{constructor(){super(),this.addEventListener("dragenter",hn),this.addEventListener("dragover",hn),this.addEventListener("dragleave",bn),this.addEventListener("drop",vn),this.addEventListener("paste",jn),this.addEventListener("change",yn)}get directory(){return this.hasAttribute("directory")}set directory(e){e?this.setAttribute("directory",""):this.removeAttribute("directory")}async attach(e){const t=e instanceof DataTransfer?await un.traverse(e,this.directory):un.from(e);this.dispatchEvent(new CustomEvent("file-attachment-accept",{bubbles:!0,cancelable:!0,detail:{attachments:t}}))&&t.length&&this.dispatchEvent(new CustomEvent("file-attachment-accepted",{bubbles:!0,detail:{attachments:t}}))}}function pn(e){return Array.from(e.types).indexOf("Files")>=0}window.customElements.get("file-attachment")||(window.FileAttachmentElement=FileAttachmentElement,window.customElements.define("file-attachment",FileAttachmentElement));let gn=null;function hn(e){const t=e.currentTarget;gn&&clearTimeout(gn),gn=window.setTimeout(()=>t.removeAttribute("hover"),200);const n=e.dataTransfer;n&&pn(n)&&(n.dropEffect="copy",t.setAttribute("hover",""),e.stopPropagation(),e.preventDefault())}function bn(e){e.dataTransfer&&(e.dataTransfer.dropEffect="none"),e.currentTarget.removeAttribute("hover"),e.stopPropagation(),e.preventDefault()}function vn(e){const t=e.currentTarget;if(!(t instanceof FileAttachmentElement))return;t.removeAttribute("hover");const n=e.dataTransfer;n&&pn(n)&&(t.attach(n),e.stopPropagation(),e.preventDefault())}const wn=/^image\/(gif|png|jpeg)$/;function jn(e){if(!e.clipboardData)return;if(!e.clipboardData.items)return;const t=e.currentTarget;if(!(t instanceof FileAttachmentElement))return;const n=function(e){for(const t of e)if(wn.test(t.type))return t.getAsFile();return null}(e.clipboardData.items);if(!n)return;const s=[n];t.attach(s),e.preventDefault()}function yn(e){const t=e.currentTarget;if(!(t instanceof FileAttachmentElement))return;const n=e.target;if(!(n instanceof HTMLInputElement))return;const s=t.getAttribute("input");if(!s||n.id!==s)return;const o=n.files;o&&0!==o.length&&(t.attach(o),n.value="")}window.customElements.get("file-attachment")||(window.FileAttachmentElement=FileAttachmentElement,window.customElements.define("file-attachment",FileAttachmentElement));const En=new Set(["๐Ÿ‘‹","๐Ÿคš","๐Ÿ–๏ธ","โœ‹","๐Ÿ––","๐Ÿ‘Œ","๐Ÿค","โœŒ๏ธ","๐Ÿคž","๐ŸคŸ","๐Ÿค˜","๐Ÿค™","๐Ÿ‘ˆ","๐Ÿ‘‰","๐Ÿ‘†","๐Ÿ–•","๐Ÿ‘‡","โ˜๏ธ","๐Ÿ‘","๐Ÿ‘Ž","โœŠ","๐Ÿ‘Š","๐Ÿค›","๐Ÿคœ","๐Ÿ‘","๐Ÿ™Œ","๐Ÿ‘","๐Ÿคฒ","๐Ÿ™","โœ๏ธ","๐Ÿ’…","๐Ÿคณ","๐Ÿ’ช","๐Ÿฆต","๐Ÿฆถ","๐Ÿ‘‚","๐Ÿฆป","๐Ÿ‘ƒ","๐Ÿ‘ถ","๐Ÿง’","๐Ÿ‘ฆ","๐Ÿ‘ง","๐Ÿง‘","๐Ÿ‘ฑ","๐Ÿ‘จ","๐Ÿง”","๐Ÿ‘ฑโ€โ™‚๏ธ","๐Ÿ‘จโ€๐Ÿฆฐ","๐Ÿ‘จโ€๐Ÿฆฑ","๐Ÿ‘จโ€๐Ÿฆณ","๐Ÿ‘จโ€๐Ÿฆฒ","๐Ÿ‘ฉ","๐Ÿ‘ฑโ€โ™€๏ธ","๐Ÿ‘ฉโ€๐Ÿฆฐ","๐Ÿ‘ฉโ€๐Ÿฆฑ","๐Ÿ‘ฉโ€๐Ÿฆณ","๐Ÿ‘ฉโ€๐Ÿฆฒ","๐Ÿง“","๐Ÿ‘ด","๐Ÿ‘ต","๐Ÿ™","๐Ÿ™โ€โ™‚๏ธ","๐Ÿ™โ€โ™€๏ธ","๐Ÿ™Ž","๐Ÿ™Žโ€โ™‚๏ธ","๐Ÿ™Žโ€โ™€๏ธ","๐Ÿ™…","๐Ÿ™…โ€โ™‚๏ธ","๐Ÿ™…โ€โ™€๏ธ","๐Ÿ™†","๐Ÿ™†โ€โ™‚๏ธ","๐Ÿ™†โ€โ™€๏ธ","๐Ÿ’","๐Ÿ’โ€โ™‚๏ธ","๐Ÿ’โ€โ™€๏ธ","๐Ÿ™‹","๐Ÿ™‹โ€โ™‚๏ธ","๐Ÿ™‹โ€โ™€๏ธ","๐Ÿง","๐Ÿงโ€โ™‚๏ธ","๐Ÿงโ€โ™€๏ธ","๐Ÿ™‡","๐Ÿ™‡โ€โ™‚๏ธ","๐Ÿ™‡โ€โ™€๏ธ","๐Ÿคฆ","๐Ÿคฆโ€โ™‚๏ธ","๐Ÿคฆโ€โ™€๏ธ","๐Ÿคท","๐Ÿคทโ€โ™‚๏ธ","๐Ÿคทโ€โ™€๏ธ","๐Ÿ‘จโ€โš•๏ธ","๐Ÿ‘ฉโ€โš•๏ธ","๐Ÿ‘จโ€๐ŸŽ“","๐Ÿ‘ฉโ€๐ŸŽ“","๐Ÿ‘จโ€๐Ÿซ","๐Ÿ‘ฉโ€๐Ÿซ","๐Ÿ‘จโ€โš–๏ธ","๐Ÿ‘ฉโ€โš–๏ธ","๐Ÿ‘จโ€๐ŸŒพ","๐Ÿ‘ฉโ€๐ŸŒพ","๐Ÿ‘จโ€๐Ÿณ","๐Ÿ‘ฉโ€๐Ÿณ","๐Ÿ‘จโ€๐Ÿ”ง","๐Ÿ‘ฉโ€๐Ÿ”ง","๐Ÿ‘จโ€๐Ÿญ","๐Ÿ‘ฉโ€๐Ÿญ","๐Ÿ‘จโ€๐Ÿ’ผ","๐Ÿ‘ฉโ€๐Ÿ’ผ","๐Ÿ‘จโ€๐Ÿ”ฌ","๐Ÿ‘ฉโ€๐Ÿ”ฌ","๐Ÿ‘จโ€๐Ÿ’ป","๐Ÿ‘ฉโ€๐Ÿ’ป","๐Ÿ‘จโ€๐ŸŽค","๐Ÿ‘ฉโ€๐ŸŽค","๐Ÿ‘จโ€๐ŸŽจ","๐Ÿ‘ฉโ€๐ŸŽจ","๐Ÿ‘จโ€โœˆ๏ธ","๐Ÿ‘ฉโ€โœˆ๏ธ","๐Ÿ‘จโ€๐Ÿš€","๐Ÿ‘ฉโ€๐Ÿš€","๐Ÿ‘จโ€๐Ÿš’","๐Ÿ‘ฉโ€๐Ÿš’","๐Ÿ‘ฎ","๐Ÿ‘ฎโ€โ™‚๏ธ","๐Ÿ‘ฎโ€โ™€๏ธ","๐Ÿ•ต๏ธ","๐Ÿ•ต๏ธโ€โ™‚๏ธ","๐Ÿ•ต๏ธโ€โ™€๏ธ","๐Ÿ’‚","๐Ÿ’‚โ€โ™‚๏ธ","๐Ÿ’‚โ€โ™€๏ธ","๐Ÿ‘ท","๐Ÿ‘ทโ€โ™‚๏ธ","๐Ÿ‘ทโ€โ™€๏ธ","๐Ÿคด","๐Ÿ‘ธ","๐Ÿ‘ณ","๐Ÿ‘ณโ€โ™‚๏ธ","๐Ÿ‘ณโ€โ™€๏ธ","๐Ÿ‘ฒ","๐Ÿง•","๐Ÿคต","๐Ÿ‘ฐ","๐Ÿคฐ","๐Ÿคฑ","๐Ÿ‘ผ","๐ŸŽ…","๐Ÿคถ","๐Ÿฆธ","๐Ÿฆธโ€โ™‚๏ธ","๐Ÿฆธโ€โ™€๏ธ","๐Ÿฆน","๐Ÿฆนโ€โ™‚๏ธ","๐Ÿฆนโ€โ™€๏ธ","๐Ÿง™","๐Ÿง™โ€โ™‚๏ธ","๐Ÿง™โ€โ™€๏ธ","๐Ÿงš","๐Ÿงšโ€โ™‚๏ธ","๐Ÿงšโ€โ™€๏ธ","๐Ÿง›","๐Ÿง›โ€โ™‚๏ธ","๐Ÿง›โ€โ™€๏ธ","๐Ÿงœ","๐Ÿงœโ€โ™‚๏ธ","๐Ÿงœโ€โ™€๏ธ","๐Ÿง","๐Ÿงโ€โ™‚๏ธ","๐Ÿงโ€โ™€๏ธ","๐Ÿ’†","๐Ÿ’†โ€โ™‚๏ธ","๐Ÿ’†โ€โ™€๏ธ","๐Ÿ’‡","๐Ÿ’‡โ€โ™‚๏ธ","๐Ÿ’‡โ€โ™€๏ธ","๐Ÿšถ","๐Ÿšถโ€โ™‚๏ธ","๐Ÿšถโ€โ™€๏ธ","๐Ÿง","๐Ÿงโ€โ™‚๏ธ","๐Ÿงโ€โ™€๏ธ","๐ŸงŽ","๐ŸงŽโ€โ™‚๏ธ","๐ŸงŽโ€โ™€๏ธ","๐Ÿ‘จโ€๐Ÿฆฏ","๐Ÿ‘ฉโ€๐Ÿฆฏ","๐Ÿ‘จโ€๐Ÿฆผ","๐Ÿ‘ฉโ€๐Ÿฆผ","๐Ÿ‘จโ€๐Ÿฆฝ","๐Ÿ‘ฉโ€๐Ÿฆฝ","๐Ÿƒ","๐Ÿƒโ€โ™‚๏ธ","๐Ÿƒโ€โ™€๏ธ","๐Ÿ’ƒ","๐Ÿ•บ","๐Ÿ•ด๏ธ","๐Ÿง–","๐Ÿง–โ€โ™‚๏ธ","๐Ÿง–โ€โ™€๏ธ","๐Ÿง—","๐Ÿง—โ€โ™‚๏ธ","๐Ÿง—โ€โ™€๏ธ","๐Ÿ‡","๐Ÿ‚","๐ŸŒ๏ธ","๐ŸŒ๏ธโ€โ™‚๏ธ","๐ŸŒ๏ธโ€โ™€๏ธ","๐Ÿ„","๐Ÿ„โ€โ™‚๏ธ","๐Ÿ„โ€โ™€๏ธ","๐Ÿšฃ","๐Ÿšฃโ€โ™‚๏ธ","๐Ÿšฃโ€โ™€๏ธ","๐ŸŠ","๐ŸŠโ€โ™‚๏ธ","๐ŸŠโ€โ™€๏ธ","โ›น๏ธ","โ›น๏ธโ€โ™‚๏ธ","โ›น๏ธโ€โ™€๏ธ","๐Ÿ‹๏ธ","๐Ÿ‹๏ธโ€โ™‚๏ธ","๐Ÿ‹๏ธโ€โ™€๏ธ","๐Ÿšด","๐Ÿšดโ€โ™‚๏ธ","๐Ÿšดโ€โ™€๏ธ","๐Ÿšต","๐Ÿšตโ€โ™‚๏ธ","๐Ÿšตโ€โ™€๏ธ","๐Ÿคธ","๐Ÿคธโ€โ™‚๏ธ","๐Ÿคธโ€โ™€๏ธ","๐Ÿคฝ","๐Ÿคฝโ€โ™‚๏ธ","๐Ÿคฝโ€โ™€๏ธ","๐Ÿคพ","๐Ÿคพโ€โ™‚๏ธ","๐Ÿคพโ€โ™€๏ธ","๐Ÿคน","๐Ÿคนโ€โ™‚๏ธ","๐Ÿคนโ€โ™€๏ธ","๐Ÿง˜","๐Ÿง˜โ€โ™‚๏ธ","๐Ÿง˜โ€โ™€๏ธ","๐Ÿ›€","๐Ÿ›Œ","๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘","๐Ÿ‘ญ","๐Ÿ‘ซ","๐Ÿ‘ฌ"]);function Ln(e){return En.has(e)}function Tn(e){return[...e].filter(e=>!Mn(e.codePointAt(0))).join("")}function kn(e,t){const n=[...e].map(e=>e.codePointAt(0));return n[1]&&(Mn(n[1])||65039===n[1])?n[1]=t:n.splice(1,0,t),String.fromCodePoint(...n)}function Mn(e){return e>=127995&&e<=127999}function Sn(e){switch(e){case 1:return 127995;case 2:return 127996;case 3:return 127997;case 4:return 127998;case 5:return 127999;default:return null}}class GEmojiElement extends HTMLElement{get image(){return this.firstElementChild instanceof HTMLImageElement?this.firstElementChild:null}get tone(){return(this.getAttribute("tone")||"").split(" ").map(e=>{const t=parseInt(e,10);return t>=0&&t<=5?t:0}).join(" ")}set tone(e){this.setAttribute("tone",e)}connectedCallback(){if(null===this.image&&!function(){const e=/\bWindows NT 6.1\b/.test(navigator.userAgent),t=/\bWindows NT 6.2\b/.test(navigator.userAgent),n=/\bWindows NT 6.3\b/.test(navigator.userAgent),s=/\bFreeBSD\b/.test(navigator.userAgent),o=/\bLinux\b/.test(navigator.userAgent);return!(e||t||n||o||s)}()){this.textContent="";const e=function(e){const t=document.createElement("img");return t.className="emoji",t.alt=e.getAttribute("alias")||"",t.height=20,t.width=20,t}(this);e.src=this.getAttribute("fallback-src")||"",this.appendChild(e)}this.hasAttribute("tone")&&An(this)}static get observedAttributes(){return["tone"]}attributeChangedCallback(e){switch(e){case"tone":An(this)}}}function An(e){if(e.image)return;const t=e.tone.split(" ").map(e=>parseInt(e,10));if(0===t.length)e.textContent=Tn(e.textContent);else if(1===t.length){const n=t[0];e.textContent=0===n?Tn(e.textContent):function(e,t){const n=Tn(e);if(!Ln(n))return e;const s=Sn(t);return s?n.split("โ€").map(e=>Ln(e)?kn(e,s):e).join("โ€"):e}(e.textContent,n)}else e.textContent=function(e,t){const n=Tn(e);if(!Ln(n))return e;const s=t.map(e=>Sn(e));return n.split("โ€").map(e=>{if(!Ln(e))return e;const t=s.shift();return t?kn(e,t):e}).join("โ€")}(e.textContent,t)}window.customElements.get("g-emoji")||(window.GEmojiElement=GEmojiElement,window.customElements.define("g-emoji",GEmojiElement));const xn=document.createElement("template");xn.innerHTML='\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n';const Hn=new WeakMap,Cn=new WeakMap,qn=new WeakMap;function In(e){const t=e.currentTarget;if(!(t instanceof ImageCropElement))return;const{box:n,image:s}=qn.get(t)||{};let o=0,r=0;if("keydown"===e.type)"ArrowUp"===e.key?r=-1:"ArrowDown"===e.key?r=1:"ArrowLeft"===e.key?o=-1:"ArrowRight"===e.key&&(o=1);else if(Cn.has(t)&&e instanceof MouseEvent){const n=Cn.get(t);if(!n)return;o=e.pageX-n.dragStartX,r=e.pageY-n.dragStartY}if(0!==o||0!==r){const e=Math.min(Math.max(0,n.offsetLeft+o),s.width-n.offsetWidth),i=Math.min(Math.max(0,n.offsetTop+r),s.height-n.offsetHeight);n.style.left="".concat(e,"px"),n.style.top="".concat(i,"px"),Rn(t,{x:e,y:i,width:n.offsetWidth,height:n.offsetHeight})}e instanceof MouseEvent&&Cn.set(t,{dragStartX:e.pageX,dragStartY:e.pageY})}function _n(e){const t=e.target;if(!(t instanceof HTMLElement))return;const n=t.closest("image-crop");if(!(n instanceof ImageCropElement))return;const{box:s}=qn.get(n)||{},o=n.getBoundingClientRect();let r,i,a;if(e.key){if("Escape"===e.key)return Bn(n);if("-"===e.key&&(a=-10),"="===e.key&&(a=10),!a)return;r=s.offsetWidth+a,i=s.offsetHeight+a,Hn.set(n,{startX:s.offsetLeft,startY:s.offsetTop})}else if(e instanceof MouseEvent){const t=Hn.get(n);if(!t)return;r=e.pageX-t.startX-o.left-window.pageXOffset,i=e.pageY-t.startY-o.top-window.pageYOffset}r&&i&&Dn(n,r,i,!(e instanceof KeyboardEvent))}function $n(e){const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.closest("image-crop");if(!(n instanceof ImageCropElement))return;const{box:s}=qn.get(n)||{},o=e.target;if(o instanceof HTMLElement)if(o.hasAttribute("data-direction")){const t=o.getAttribute("data-direction");n.addEventListener("mousemove",_n),["nw","se"].indexOf(t)>=0&&n.classList.add("nwse"),["ne","sw"].indexOf(t)>=0&&n.classList.add("nesw"),Hn.set(n,{startX:s.offsetLeft+(["se","ne"].indexOf(t)>=0?0:s.offsetWidth),startY:s.offsetTop+(["se","sw"].indexOf(t)>=0?0:s.offsetHeight)}),_n(e)}else n.addEventListener("mousemove",In)}function Dn(e,t,n){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=Math.max(Math.abs(t),Math.abs(n),10);const r=Hn.get(e);if(!r)return;const{box:i,image:a}=qn.get(e)||{};o=Math.min(o,n>0?a.height-r.startY:r.startY,t>0?a.width-r.startX:r.startX);const c=s?Math.round(Math.max(0,t>0?r.startX:r.startX-o)):i.offsetLeft,l=s?Math.round(Math.max(0,n>0?r.startY:r.startY-o)):i.offsetTop;i.style.left="".concat(c,"px"),i.style.top="".concat(l,"px"),i.style.width="".concat(o,"px"),i.style.height="".concat(o,"px"),Rn(e,{x:c,y:l,width:o,height:o})}function Nn(e){const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.closest("image-crop");n instanceof ImageCropElement&&(n.loaded=!0,Bn(n))}function Bn(e){const{image:t}=qn.get(e)||{},n=Math.round(t.clientWidth>t.clientHeight?t.clientHeight:t.clientWidth);Hn.set(e,{startX:(t.clientWidth-n)/2,startY:(t.clientHeight-n)/2}),Dn(e,n,n)}function Pn(e){const t=e.currentTarget;t instanceof ImageCropElement&&(Cn.delete(t),t.classList.remove("nwse","nesw"),t.removeEventListener("mousemove",_n),t.removeEventListener("mousemove",In))}function Rn(e,t){const{image:n}=qn.get(e)||{},s=n.naturalWidth/n.width;for(const o in t){const n=Math.round(t[o]*s);t[o]=n;const r=e.querySelector("[data-image-crop-input='".concat(o,"']"));r instanceof HTMLInputElement&&(r.value=n.toString())}e.dispatchEvent(new CustomEvent("image-crop-change",{bubbles:!0,detail:t}))}class ImageCropElement extends HTMLElement{connectedCallback(){if(qn.has(this))return;this.appendChild(document.importNode(xn.content,!0));const e=this.querySelector("[data-crop-box]");if(!(e instanceof HTMLElement))return;const t=this.querySelector("img");t instanceof HTMLImageElement&&(qn.set(this,{box:e,image:t}),t.addEventListener("load",Nn),this.addEventListener("mouseleave",Pn),this.addEventListener("mouseup",Pn),e.addEventListener("mousedown",$n),this.addEventListener("keydown",In),this.addEventListener("keydown",_n),this.src&&(t.src=this.src))}static get observedAttributes(){return["src"]}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get loaded(){return this.hasAttribute("loaded")}set loaded(e){e?this.setAttribute("loaded",""):this.removeAttribute("loaded")}attributeChangedCallback(e,t,n){const{image:s}=qn.get(this)||{};"src"===e&&(this.loaded=!1,s&&(s.src=n))}}function Fn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}window.customElements.get("image-crop")||(window.ImageCropElement=ImageCropElement,window.customElements.define("image-crop",ImageCropElement));const On=new WeakMap;class MarkdownButtonElement extends HTMLElement{constructor(){super();const e=()=>{const e=On.get(this);e&&Zn(this,e)};var t;this.addEventListener("keydown",(t=e,function(e){" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),t(e))})),this.addEventListener("click",e)}connectedCallback(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button")}click(){const e=On.get(this);e&&Zn(this,e)}}class MarkdownHeaderButtonElement extends MarkdownButtonElement{constructor(){super();const e=parseInt(this.getAttribute("level")||3,10);if(e<1||e>6)return;const t="".concat("#".repeat(e)," ");On.set(this,{prefix:t})}}window.customElements.get("md-header")||(window.MarkdownHeaderButtonElement=MarkdownHeaderButtonElement,window.customElements.define("md-header",MarkdownHeaderButtonElement));class MarkdownBoldButtonElement extends MarkdownButtonElement{constructor(){super(),On.set(this,{prefix:"**",suffix:"**",trimFirst:!0})}connectedCallback(){super.connectedCallback(),this.setAttribute("hotkey","b")}}window.customElements.get("md-bold")||(window.MarkdownBoldButtonElement=MarkdownBoldButtonElement,window.customElements.define("md-bold",MarkdownBoldButtonElement));class MarkdownItalicButtonElement extends MarkdownButtonElement{constructor(){super(),On.set(this,{prefix:"_",suffix:"_",trimFirst:!0})}connectedCallback(){super.connectedCallback(),this.setAttribute("hotkey","i")}}window.customElements.get("md-italic")||(window.MarkdownItalicButtonElement=MarkdownItalicButtonElement,window.customElements.define("md-italic",MarkdownItalicButtonElement));class MarkdownQuoteButtonElement extends MarkdownButtonElement{constructor(){super(),On.set(this,{prefix:"> ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-quote")||(window.MarkdownQuoteButtonElement=MarkdownQuoteButtonElement,window.customElements.define("md-quote",MarkdownQuoteButtonElement));class MarkdownCodeButtonElement extends MarkdownButtonElement{constructor(){super(),On.set(this,{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"})}}window.customElements.get("md-code")||(window.MarkdownCodeButtonElement=MarkdownCodeButtonElement,window.customElements.define("md-code",MarkdownCodeButtonElement));class MarkdownLinkButtonElement extends MarkdownButtonElement{constructor(){super(),On.set(this,{prefix:"[",suffix:"](url)",replaceNext:"url",scanFor:"https?://"})}connectedCallback(){super.connectedCallback(),this.setAttribute("hotkey","k")}}window.customElements.get("md-link")||(window.MarkdownLinkButtonElement=MarkdownLinkButtonElement,window.customElements.define("md-link",MarkdownLinkButtonElement));class MarkdownImageButtonElement extends MarkdownButtonElement{constructor(){super(),On.set(this,{prefix:"![",suffix:"](url)",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-image")||(window.MarkdownImageButtonElement=MarkdownImageButtonElement,window.customElements.define("md-image",MarkdownImageButtonElement));class MarkdownUnorderedListButtonElement extends MarkdownButtonElement{constructor(){super(),On.set(this,{prefix:"- ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-unordered-list")||(window.MarkdownUnorderedListButtonElement=MarkdownUnorderedListButtonElement,window.customElements.define("md-unordered-list",MarkdownUnorderedListButtonElement));class MarkdownOrderedListButtonElement extends MarkdownButtonElement{constructor(){super(),On.set(this,{prefix:"1. ",multiline:!0,orderedList:!0})}}window.customElements.get("md-ordered-list")||(window.MarkdownOrderedListButtonElement=MarkdownOrderedListButtonElement,window.customElements.define("md-ordered-list",MarkdownOrderedListButtonElement));class MarkdownTaskListButtonElement extends MarkdownButtonElement{constructor(){super(),On.set(this,{prefix:"- [ ] ",multiline:!0,surroundWithNewlines:!0})}connectedCallback(){super.connectedCallback(),this.setAttribute("hotkey","L")}}window.customElements.get("md-task-list")||(window.MarkdownTaskListButtonElement=MarkdownTaskListButtonElement,window.customElements.define("md-task-list",MarkdownTaskListButtonElement));class MarkdownMentionButtonElement extends MarkdownButtonElement{constructor(){super(),On.set(this,{prefix:"@",prefixSpace:!0})}}window.customElements.get("md-mention")||(window.MarkdownMentionButtonElement=MarkdownMentionButtonElement,window.customElements.define("md-mention",MarkdownMentionButtonElement));class MarkdownRefButtonElement extends MarkdownButtonElement{constructor(){super(),On.set(this,{prefix:"#",prefixSpace:!0})}}window.customElements.get("md-ref")||(window.MarkdownRefButtonElement=MarkdownRefButtonElement,window.customElements.define("md-ref",MarkdownRefButtonElement));const Un=navigator.userAgent.match(/Macintosh/)?"Meta":"Control";class MarkdownToolbarElement extends HTMLElement{constructor(){super()}connectedCallback(){const e=zn.bind(null,this);this.field&&(this.field.addEventListener("keydown",e),Wn.set(this,e))}disconnectedCallback(){const e=Wn.get(this);e&&this.field&&(this.field.removeEventListener("keydown",e),Wn.delete(this))}get field(){const e=this.getAttribute("for");if(!e)return;const t=document.getElementById(e);return t instanceof HTMLTextAreaElement?t:null}}const Wn=new WeakMap;function zn(e,t){if(t.metaKey&&"Meta"===Un||t.ctrlKey&&"Control"===Un){const n=e.querySelector('[hotkey="'.concat(t.key,'"]'));n&&(n.click(),t.preventDefault())}}function Vn(e){return e.trim().split("\n").length>1}function Kn(e,t){return Array(t+1).join(e)}function Yn(e,t){let n=t;for(;e[n]&&null!=e[n-1]&&!e[n-1].match(/\s/);)n--;return n}function Jn(e,t,n){let s=t;const o=n?/\n/:/\s/;for(;e[s]&&!e[s].match(o);)s++;return s}window.customElements.get("markdown-toolbar")||(window.MarkdownToolbarElement=MarkdownToolbarElement,window.customElements.define("markdown-toolbar",MarkdownToolbarElement));let Xn=null;function Gn(e,t){const n=e.value.slice(e.selectionStart,e.selectionEnd);let s;s=t.orderedList?function(e){const t=/^\d+\.\s+/,n=e.selectionStart===e.selectionEnd;let s,o,r,i,a=e.value.slice(e.selectionStart,e.selectionEnd),c=a,l=a.split("\n");if(n){const t=e.value.slice(0,e.selectionStart).split(/\n/);r=e.selectionStart-t[t.length-1].length,i=Jn(e.value,e.selectionStart,!0),c=e.value.slice(r,i)}const u=c.split("\n");if(u.every(e=>t.test(e))){if(l=u.map(e=>e.replace(t,"")),a=l.join("\n"),n&&r&&i){const t=u[0].length-l[0].length;o=s=e.selectionStart-t,e.selectionStart=r,e.selectionEnd=i}}else{l=function(){let e,t,n;const s=[];for(n=e=0,t=l.length;ee.startsWith(n)&&e.endsWith(s)))r=c.map(e=>e.slice(n.length,e.length-s.length)).join("\n"),a=i+r.length;else if(r=c.map(e=>n+e+s).join("\n"),o){const{newlinesToAppend:t,newlinesToPrepend:n}=Qn(e);i+=t.length,a=i+r.length,r=t+r+n}return{text:r,selectionStart:i,selectionEnd:a}}(e,t):function(e,t){let n,s;const{prefix:o,suffix:r,blockPrefix:i,blockSuffix:a,replaceNext:c,prefixSpace:l,scanFor:u,surroundWithNewlines:d}=t,m=e.selectionStart,f=e.selectionEnd;let p=e.value.slice(e.selectionStart,e.selectionEnd),g=Vn(p)&&i.length>0?"".concat(i,"\n"):o,h=Vn(p)&&a.length>0?"\n".concat(a):r;if(l){const t=e.value[e.selectionStart-1];0===e.selectionStart||null==t||t.match(/\s/)||(g=" ".concat(g))}p=function(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.selectionStart===e.selectionEnd)e.selectionStart=Yn(e.value,e.selectionStart),e.selectionEnd=Jn(e.value,e.selectionEnd,s);else{const s=e.selectionStart-t.length,o=e.selectionEnd+n.length,r=e.value.slice(s,e.selectionStart)===t,i=e.value.slice(e.selectionEnd,o)===n;r&&i&&(e.selectionStart=s,e.selectionEnd=o)}return e.value.slice(e.selectionStart,e.selectionEnd)}(e,g,h,t.multiline);let b=e.selectionStart,v=e.selectionEnd;const w=c.length>0&&h.indexOf(c)>-1&&p.length>0;if(d){const t=Qn(e);n=t.newlinesToAppend,s=t.newlinesToPrepend,g=n+o,h+=s}if(p.startsWith(g)&&p.endsWith(h)){const e=p.slice(g.length,p.length-h.length);if(m===f){let t=m-g.length;t=Math.max(t,b),t=Math.min(t,b+e.length),b=v=t}else v=b+e.length;return{text:e,selectionStart:b,selectionEnd:v}}if(w){if(u.length>0&&p.match(u)){h=h.replace(c,p);const e=g+h;return b=v=b+g.length,{text:e,selectionStart:b,selectionEnd:v}}{const e=g+p+h;return b=b+g.length+p.length+h.indexOf(c),v=b+c.length,{text:e,selectionStart:b,selectionEnd:v}}}{let e=g+p+h;b=m+g.length,v=f+g.length;const n=p.match(/^\s*|\s*$/g);if(t.trimFirst&&n){const t=n[0]||"",s=n[1]||"";e=t+g+p.trim()+h+s,b+=t.length,v-=s.length}return{text:e,selectionStart:b,selectionEnd:v}}}(e,t),function(e,t){let{text:n,selectionStart:s,selectionEnd:o}=t;const r=e.selectionStart,i=e.value.slice(0,r),a=e.value.slice(e.selectionEnd);if(null===Xn||!0===Xn){e.contentEditable="true";try{Xn=document.execCommand("insertText",!1,n)}catch(c){Xn=!1}e.contentEditable="false"}if(Xn&&!e.value.slice(0,e.selectionStart).endsWith(n)&&(Xn=!1),!Xn){try{document.execCommand("ms-beginUndoUnit")}catch(l){}e.value=i+n+a;try{document.execCommand("ms-endUndoUnit")}catch(l){}e.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0}))}null!=s&&null!=o?e.setSelectionRange(s,o):e.setSelectionRange(r,e.selectionEnd)}(e,s)}function Qn(e){const t=e.value.slice(0,e.selectionStart),n=e.value.slice(e.selectionEnd),s=t.match(/\n*$/),o=n.match(/^\n*/),r=s?s[0].length:0,i=o?o[0].length:0;let a,c;return t.match(/\S/)&&r<2&&(a=Kn("\n",2-r)),n.match(/\S/)&&i<2&&(c=Kn("\n",2-i)),null==a&&(a=""),null==c&&(c=""),{newlinesToAppend:a,newlinesToPrepend:c}}function Zn(e,t){const n=e.closest("markdown-toolbar");if(!(n instanceof MarkdownToolbarElement))return;const s=function(e){for(var t=1;t{const t=e.target;if(!(t instanceof HTMLElement))return;if("tab"!==t.getAttribute("role")&&!t.closest('[role="tablist"]'))return;const n=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]')),s=n.indexOf(n.find(e=>e.matches('[aria-selected="true"]')));if("ArrowRight"===e.code){let e=s+1;e>=n.length&&(e=0),es(this,e)}else if("ArrowLeft"===e.code){let e=s-1;e<0&&(e=n.length-1),es(this,e)}else"Home"===e.code?(es(this,0),e.preventDefault()):"End"===e.code&&(es(this,n.length-1),e.preventDefault())}),this.addEventListener("click",e=>{const t=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]'));if(!(e.target instanceof Element))return;const n=e.target.closest('[role="tab"]');n&&n.closest('[role="tablist"]')&&es(this,t.indexOf(n))})}}function es(e,t){const n=e.querySelectorAll('[role="tablist"] [role="tab"]'),s=e.querySelectorAll('[role="tabpanel"]'),o=n[t],r=s[t];if(!!e.dispatchEvent(new CustomEvent("tab-container-change",{bubbles:!0,cancelable:!0,detail:{relatedTarget:r}}))){for(const e of n)e.setAttribute("aria-selected","false"),e.setAttribute("tabindex","-1");for(const e of s)e.hidden=!0,e.setAttribute("tabindex","0");o.setAttribute("aria-selected","true"),o.removeAttribute("tabindex"),o.focus(),r.hidden=!1,e.dispatchEvent(new CustomEvent("tab-container-changed",{bubbles:!0,detail:{relatedTarget:r}}))}}window.customElements.get("tab-container")||(window.TabContainerElement=TabContainerElement,window.customElements.define("tab-container",TabContainerElement));const ts=/\s|\(|\[/;function ns(e,t,n){const s=e.lastIndexOf(t,n-1);if(-1===s)return;if(e.lastIndexOf(" ",n-1)>s)return;const o=e[s-1];return!o||ts.test(o)?{word:e.substring(s+t.length,n),position:s+t.length}:void 0}const ss=["position:absolute;","overflow:auto;","word-wrap:break-word;","top:0px;","left:-9999px;"],os=["box-sizing","font-family","font-size","font-style","font-variant","font-weight","height","letter-spacing","line-height","max-height","min-height","padding-bottom","padding-left","padding-right","padding-top","border-bottom","border-left","border-right","border-top","text-decoration","text-indent","text-transform","width","word-spacing"],rs=new WeakMap;function is(e,t){const n=e.nodeName.toLowerCase();if("textarea"!==n&&"input"!==n)throw new Error("expected textField to a textarea or input");let s=rs.get(e);if(s&&s.parentElement===e.parentElement)s.innerHTML="";else{s=document.createElement("div"),rs.set(e,s);const t=window.getComputedStyle(e),o=ss.slice(0);"textarea"===n?o.push("white-space:pre-wrap;"):o.push("white-space:nowrap;");for(let e=0,n=os.length;e1&&void 0!==arguments[1]?arguments[1]:e.selectionEnd;const{mirror:n,marker:s}=is(e,t),o=n.getBoundingClientRect(),r=s.getBoundingClientRect();return setTimeout(()=>{n.remove()},5e3),{top:r.top-o.top,left:r.left-o.left}}(this.input,e.position);t.style.top="".concat(n,"px"),t.style.left="".concat(s,"px"),r(this.input,t),t.addEventListener("combobox-commit",this.oncommit),t.addEventListener("mousedown",this.onmousedown),i(this.input,t),a(this.input,t)}deactivate(){const e=this.menu;e&&(this.menu=null,e.removeEventListener("combobox-commit",this.oncommit),e.removeEventListener("mousedown",this.onmousedown),c(this.input,e),this.input.removeAttribute("aria-owns"),e.remove())}onCommit(e){let{target:t}=e;const n=t;if(!(n instanceof HTMLElement))return;const s=this.match;if(!s)return;const o=this.input.value.substring(0,s.position-s.key.length),r=this.input.value.substring(s.position+s.text.length),i={item:n,key:s.key,value:null};if(!this.expander.dispatchEvent(new CustomEvent("text-expander-value",{cancelable:!0,detail:i})))return;if(!i.value)return;const a="".concat(i.value," ");this.input.value=o+a+r,this.deactivate(),this.input.focus();const c=o.length+a.length;this.input.selectionStart=c,this.input.selectionEnd=c}onBlur(){this.interactingWithList?this.interactingWithList=!1:this.deactivate()}onPaste(){this.justPasted=!0}async onInput(){if(this.justPasted)return void(this.justPasted=!1);const e=this.findMatch();if(e){this.match=e;const t=await this.notifyProviders(e);if(!this.match)return;t?this.activate(e,t):this.deactivate()}else this.match=null,this.deactivate()}findMatch(){const e=this.input.selectionEnd,t=this.input.value;for(const n of this.expander.keys){const s=ns(t,n,e);if(s)return{text:s.word,key:n,position:s.position}}}async notifyProviders(e){const t=[];if(this.expander.dispatchEvent(new CustomEvent("text-expander-change",{cancelable:!0,detail:{provide:e=>t.push(e),text:e.text,key:e.key}})))return(await Promise.all(t)).filter(e=>e.matched).map(e=>e.fragment)[0]}onMousedown(){this.interactingWithList=!0}onKeydown(e){"Escape"===e.key&&(this.deactivate(),e.stopImmediatePropagation(),e.preventDefault())}}class TextExpanderElement extends HTMLElement{get keys(){const e=this.getAttribute("keys");return e?e.split(" "):[]}connectedCallback(){const e=this.querySelector('input[type="text"], textarea');if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return;const t=new cs(this,e);as.set(this,t)}disconnectedCallback(){const e=as.get(this);e&&(e.destroy(),as.delete(this))}}window.customElements.get("text-expander")||(window.TextExpanderElement=TextExpanderElement,window.customElements.define("text-expander",TextExpanderElement));const ls=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],us=["January","February","March","April","May","June","July","August","September","October","November","December"];function ds(e){return"0".concat(e).slice(-2)}function ms(e,t){const n=e.getDay(),s=e.getDate(),o=e.getMonth(),r=e.getFullYear(),i=e.getHours(),a=e.getMinutes(),c=e.getSeconds();return t.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g,(function(t){let l;switch(t[1]){case"%":return"%";case"a":return ls[n].slice(0,3);case"A":return ls[n];case"b":return us[o].slice(0,3);case"B":return us[o];case"c":return e.toString();case"d":return ds(s);case"e":return String(s);case"H":return ds(i);case"I":return ds(ms(e,"%l"));case"l":return String(0===i||12===i?12:(i+12)%12);case"m":return ds(o+1);case"M":return ds(a);case"p":return i>11?"PM":"AM";case"P":return i>11?"pm":"am";case"S":return ds(c);case"w":return String(n);case"y":return ds(r%100);case"Y":return String(r);case"Z":return l=e.toString().match(/\((\w+)\)$/),l?l[1]:"";case"z":return l=e.toString().match(/\w([+-]\d\d\d\d) /),l?l[1]:""}return""}))}function fs(e){let t;return function(){if(t)return t;if("Intl"in window)try{return t=new Intl.DateTimeFormat(void 0,e),t}catch(n){if(!(n instanceof RangeError))throw n}}}let ps=null;const gs=fs({day:"numeric",month:"short"});function hs(){if(null!==ps)return ps;const e=gs();if(e){const t=e.format(new Date(0));return ps=!!t.match(/^\d/),ps}return!1}let bs=null;const vs=fs({day:"numeric",month:"short",year:"numeric"});function ws(e){const t=e.closest("[lang]");return t instanceof HTMLElement&&t.lang?t.lang:"default"}const js=new WeakMap;class ExtendedTimeElement extends HTMLElement{static get observedAttributes(){return["datetime","day","format","lang","hour","minute","month","second","title","weekday","year"]}connectedCallback(){const e=this.getFormattedTitle();e&&!this.hasAttribute("title")&&this.setAttribute("title",e);const t=this.getFormattedDate();t&&(this.textContent=t)}attributeChangedCallback(e,t,n){const s=this.getFormattedTitle();if("datetime"===e){const e=Date.parse(n);isNaN(e)?js.delete(this):js.set(this,new Date(e))}const o=this.getFormattedTitle(),r=this.getAttribute("title");"title"===e||!o||r&&r!==s||this.setAttribute("title",o);const i=this.getFormattedDate();i&&(this.textContent=i)}get date(){return js.get(this)}getFormattedTitle(){const e=this.date;if(!e)return;const t=ys();if(t)return t.format(e);try{return e.toLocaleString()}catch(n){if(n instanceof RangeError)return e.toString();throw n}}getFormattedDate(){}}const ys=fs({day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),Es=new WeakMap;class LocalTimeElement extends ExtendedTimeElement{attributeChangedCallback(e,t,n){"hour"!==e&&"minute"!==e&&"second"!==e&&"time-zone-name"!==e||Es.delete(this),super.attributeChangedCallback(e,t,n)}getFormattedDate(){const e=this.date;if(!e)return;const t=function(e,t){const n={weekday:{short:"%a",long:"%A"},day:{numeric:"%e","2-digit":"%d"},month:{short:"%b",long:"%B"},year:{numeric:"%Y","2-digit":"%y"}};let s=hs()?"weekday day month year":"weekday month day, year";for(const o in n){const t=n[o][e.getAttribute(o)];s=s.replace(o,t||"")}return s=s.replace(/(\s,)|(,\s$)/,""),ms(t,s).replace(/\s+/," ").trim()}(this,e)||"",n=function(e,t){const n={},s=e.getAttribute("hour");"numeric"!==s&&"2-digit"!==s||(n.hour=s);const o=e.getAttribute("minute");"numeric"!==o&&"2-digit"!==o||(n.minute=o);const r=e.getAttribute("second");"numeric"!==r&&"2-digit"!==r||(n.second=r);const i=e.getAttribute("time-zone-name");"short"!==i&&"long"!==i||(n.timeZoneName=i);if(0===Object.keys(n).length)return;let a=Es.get(e);a||(a=fs(n),Es.set(e,a));const c=a();if(c)return c.format(t);{const e=n.second?"%H:%M:%S":"%H:%M";return ms(t,e)}}(this,e)||"";return"".concat(t," ").concat(n).trim()}}window.customElements.get("local-time")||(window.LocalTimeElement=LocalTimeElement,window.customElements.define("local-time",LocalTimeElement));class Ls{constructor(e,t){this.date=e,this.locale=t}toString(){const e=this.timeElapsed();if(e)return e;{const e=this.timeAhead();return e||"on ".concat(this.formatDate())}}timeElapsed(){const e=(new Date).getTime()-this.date.getTime(),t=Math.round(e/1e3),n=Math.round(t/60),s=Math.round(n/60),o=Math.round(s/24);return e>=0&&o<30?this.timeAgoFromMs(e):null}timeAhead(){const e=this.date.getTime()-(new Date).getTime(),t=Math.round(e/1e3),n=Math.round(t/60),s=Math.round(n/60),o=Math.round(s/24);return e>=0&&o<30?this.timeUntil():null}timeAgo(){const e=(new Date).getTime()-this.date.getTime();return this.timeAgoFromMs(e)}timeAgoFromMs(e){const t=Math.round(e/1e3),n=Math.round(t/60),s=Math.round(n/60),o=Math.round(s/24),r=Math.round(o/30),i=Math.round(r/12);return e<0?Ts(this.locale,0,"second"):t<10?Ts(this.locale,0,"second"):t<45?Ts(this.locale,-t,"second"):t<90?Ts(this.locale,-n,"minute"):n<45?Ts(this.locale,-n,"minute"):n<90?Ts(this.locale,-s,"hour"):s<24?Ts(this.locale,-s,"hour"):s<36?Ts(this.locale,-o,"day"):o<30?Ts(this.locale,-o,"day"):r<18?Ts(this.locale,-r,"month"):Ts(this.locale,-i,"year")}microTimeAgo(){const e=(new Date).getTime()-this.date.getTime(),t=Math.round(e/1e3),n=Math.round(t/60),s=Math.round(n/60),o=Math.round(s/24),r=Math.round(o/30),i=Math.round(r/12);return n<1?"1m":n<60?"".concat(n,"m"):s<24?"".concat(s,"h"):o<365?"".concat(o,"d"):"".concat(i,"y")}timeUntil(){const e=this.date.getTime()-(new Date).getTime();return this.timeUntilFromMs(e)}timeUntilFromMs(e){const t=Math.round(e/1e3),n=Math.round(t/60),s=Math.round(n/60),o=Math.round(s/24),r=Math.round(o/30),i=Math.round(r/12);return r>=18?Ts(this.locale,i,"year"):r>=12?Ts(this.locale,i,"year"):o>=45?Ts(this.locale,r,"month"):o>=30?Ts(this.locale,r,"month"):s>=36?Ts(this.locale,o,"day"):s>=24?Ts(this.locale,o,"day"):n>=90?Ts(this.locale,s,"hour"):n>=45?Ts(this.locale,s,"hour"):t>=90?Ts(this.locale,n,"minute"):t>=45?Ts(this.locale,n,"minute"):Ts(this.locale,t>=10?t:0,"second")}microTimeUntil(){const e=this.date.getTime()-(new Date).getTime(),t=Math.round(e/1e3),n=Math.round(t/60),s=Math.round(n/60),o=Math.round(s/24),r=Math.round(o/30),i=Math.round(r/12);return o>=365?"".concat(i,"y"):s>=24?"".concat(o,"d"):n>=60?"".concat(s,"h"):n>1?"".concat(n,"m"):"1m"}formatDate(){let e=hs()?"%e %b":"%b %e";var t;return t=this.date,(new Date).getUTCFullYear()!==t.getUTCFullYear()&&(e+=function(){if(null!==bs)return bs;const e=vs();if(e){const t=e.format(new Date(0));return bs=!!t.match(/\d,/),bs}return!0}()?", %Y":" %Y"),ms(this.date,e)}formatTime(){const e=ks();return e?e.format(this.date):ms(this.date,"%l:%M%P")}}function Ts(e,t,n){const s=function(e,t){if("Intl"in window&&"RelativeTimeFormat"in window.Intl)try{return new Intl.RelativeTimeFormat(e,t)}catch(n){if(!(n instanceof RangeError))throw n}}(e,{numeric:"auto"});return s?s.format(t,n):function(e,t){if(0===e)switch(t){case"year":case"quarter":case"month":case"week":return"this ".concat(t);case"day":return"today";case"hour":case"minute":return"in 0 ".concat(t,"s");case"second":return"now"}else if(1===e)switch(t){case"year":case"quarter":case"month":case"week":return"next ".concat(t);case"day":return"tomorrow";case"hour":case"minute":case"second":return"in 1 ".concat(t)}else if(-1===e)switch(t){case"year":case"quarter":case"month":case"week":return"last ".concat(t);case"day":return"yesterday";case"hour":case"minute":case"second":return"1 ".concat(t," ago")}else if(e>1)switch(t){case"year":case"quarter":case"month":case"week":case"day":case"hour":case"minute":case"second":return"in ".concat(e," ").concat(t,"s")}else if(e<-1)switch(t){case"year":case"quarter":case"month":case"week":case"day":case"hour":case"minute":case"second":return"".concat(-e," ").concat(t,"s ago")}throw new RangeError("Invalid unit argument for format() '".concat(t,"'"))}(t,n)}const ks=fs({hour:"numeric",minute:"2-digit"});class RelativeTimeElement extends ExtendedTimeElement{getFormattedDate(){const e=this.date;if(e)return new Ls(e,ws(this)).toString()}connectedCallback(){Ms.push(this),Ss||(As(),Ss=setInterval(As,6e4)),super.connectedCallback()}disconnectedCallback(){const e=Ms.indexOf(this);-1!==e&&Ms.splice(e,1),Ms.length||Ss&&(clearInterval(Ss),Ss=null)}}const Ms=[];let Ss;function As(){let e,t,n;for(t=0,n=Ms.length;tsetTimeout(e,t)),this.fetch(e,1.5*t)):n}}function xs(e){return e instanceof KeyboardEvent&&("ArrowDown"===e.key||"ArrowUp"===e.key)}function Hs(e){const t=p(e,"label");t.hasAttribute("data-role")||t.setAttribute("data-role",h(t,"role")),t.setAttribute("role",h(t,"data-role")),e.removeAttribute("role")}window.customElements.get("poll-include-fragment")||(window.PollIncludeFragmentElement=PollIncludeFragmentElement,window.customElements.define("poll-include-fragment",PollIncludeFragmentElement)),navigator.userAgent.match(/Firefox/)&&(pt('details-menu label[tabindex][role^="menuitem"]',e=>{const t=e.querySelector("input");if(!t)return;const n=e.classList.contains("select-menu-item"),s=t.classList.contains("d-none"),o=n||s||t.hidden;n&&t.classList.add("d-block"),s&&t.classList.remove("d-none"),o&&(t.classList.add("sr-only"),t.hidden=!1),e.removeAttribute("tabindex")}),ft("focus",'details-menu label[role="menuitemradio"] input, details-menu label[role="menuitemcheckbox"] input',e=>{const t=p(e.currentTarget,"label");t.classList.contains("select-menu-item")&&t.classList.add("navigation-focus"),t.classList.contains("SelectMenu-item")&&t.classList.add("hx_menuitem--focus"),t.classList.contains("dropdown-item")&&t.classList.add("hx_menuitem--focus"),e.currentTarget.addEventListener("blur",()=>{t.classList.contains("select-menu-item")&&t.classList.remove("navigation-focus"),t.classList.contains("SelectMenu-item")&&t.classList.remove("hx_menuitem--focus"),t.classList.contains("dropdown-item")&&t.classList.remove("hx_menuitem--focus")},{once:!0})},{capture:!0}),f("keydown",'details-menu label[role="menuitemradio"] input, details-menu label[role="menuitemcheckbox"] input',(async function(e){if(xs(e))e.currentTarget instanceof Element&&function(e){const t=p(e,"label");t.hasAttribute("data-role")||t.setAttribute("data-role",h(t,"role"));e.setAttribute("role",h(t,"data-role")),t.removeAttribute("role")}(e.currentTarget);else if("Enter"===e.key){const t=e.currentTarget;e.preventDefault(),await g(),t instanceof HTMLInputElement&&t.click()}})),ft("blur",'details-menu label input[role="menuitemradio"], details-menu label input[role="menuitemcheckbox"]',e=>{Hs(e.currentTarget)},{capture:!0}),f("keyup",'details-menu label[role="menuitemradio"] input, details-menu label[role="menuitemcheckbox"] input',e=>{xs(e)&&e.currentTarget instanceof Element&&Hs(e.currentTarget)}));function Cs(e){return e.toUpperCase()===e}function qs(e,t,n,s){for(var o=e.length,r=t.length,i=e.toLowerCase(),a=t.toLowerCase(),c=function(e){for(var t,n=e.length,s=new Array(n),o="/",r=0;r1024)return-1/0;var o=new Array(n),r=new Array(n);return qs(e,t,o,r),r[n-1][s-1]},positions:function(e,t){var n=e.length,s=t.length,o=new Array(n);if(!n||!s)return o;if(n===s){for(var r=0;r1024)return o;var i=new Array(n),a=new Array(n);qs(e,t,i,a);for(var c=!1,l=(r=n-1,s-1);r>=0;r--)for(;l>=0;l--)if(i[r][l]!==-1/0&&(c||i[r][l]===a[r][l])){c=r&&l&&a[r][l]===i[r-1][l-1]+1,o[r]=l--;break}return o},hasMatch:function(e,t){e=e.toLowerCase(),t=t.toLowerCase();for(var n=e.length,s=0,o=0;s{if(!_s(e,t))return-1/0;const s=Is.score(e,t);return s{e.innerHTML="";let s=0;for(const o of Is.positions(t,n)){""!==n.slice(s,o)&&e.appendChild(document.createTextNode(n.slice(s,o))),s=o+1;const t=document.createElement("mark");t.textContent=n[o],e.appendChild(t)}e.appendChild(document.createTextNode(n.slice(s)))},Ns=new WeakMap,Bs=new WeakMap,Ps=new WeakMap,Rs=e=>{if(!Ps.has(e)&&e instanceof HTMLElement){const t=(e.getAttribute("data-value")||e.textContent||"").trim();return Ps.set(e,t),t}return Ps.get(e)||""};class FuzzyListElement extends HTMLElement{connectedCallback(){const e=this.querySelector("ul");if(!e)return;const t=new Set(e.querySelectorAll("li")),n=this.querySelector("input");n instanceof HTMLInputElement&&n.addEventListener("input",()=>{this.value=n.value});const s=new MutationObserver(e=>{let n=!1;for(const s of e)if("childList"===s.type&&s.addedNodes.length)for(const e of s.addedNodes)if(e instanceof HTMLLIElement&&!t.has(e)){const s=Rs(e);n=n||_s(this.value,s),t.add(e)}n&&this.sort()});s.observe(e,{childList:!0});const o={handler:s,items:t,lazyItems:new Map,timer:null};Bs.set(this,o)}disconnectedCallback(){const e=Bs.get(this);e&&(e.handler.disconnect(),Bs.delete(this))}addLazyItems(e,t){const n=Bs.get(this);if(!n)return;const{lazyItems:s}=n,{value:o}=this;let r=!1;for(const i of e)s.set(i,t),r=r||o&&_s(o,i);r&&this.sort()}sort(){const e=Ns.get(this);e&&(e.aborted=!0);const t={aborted:!1};Ns.set(this,t);const{minScore:n,markSelector:s,maxMatches:o,value:r}=this,i=Bs.get(this);if(!i)return;if(!this.dispatchEvent(new CustomEvent("fuzzy-list-will-sort",{cancelable:!0,detail:r})))return;const{items:a,lazyItems:c}=i,l=this.hasAttribute("mark-selector"),u=this.querySelector("ul");if(!u)return;const d=[];if(r){for(const e of a){const t=Rs(e),s=$s(r,t,n);s!==-1/0&&d.push({item:e,score:s})}for(const[e,t]of c){const s=$s(r,e,n);s!==-1/0&&d.push({text:e,render:t,score:s})}d.sort((e,t)=>t.score-e.score).splice(o)}else{let e=d.length;for(const t of a){if(e>=o)break;d.push({item:t,score:1}),e+=1}for(const[t,n]of c){if(e>=o)break;d.push({text:t,render:n,score:1}),e+=1}}requestAnimationFrame(()=>{if(t.aborted)return;const e=u.querySelector('input[type="radio"]:checked');u.innerHTML="";let n=0;const o=()=>{if(t.aborted)return;const i=Math.min(d.length,n+100),m=document.createDocumentFragment();for(let e=n;e0),this.dispatchEvent(new CustomEvent("fuzzy-list-sorted",{detail:d.length}))}};o()})}get value(){return this.getAttribute("value")||""}set value(e){this.setAttribute("value",e)}get markSelector(){return this.getAttribute("mark-selector")||""}set markSelector(e){e?this.setAttribute("mark-selector",!0===e?"":e):this.removeAttribute("mark-selector")}get minScore(){return Number(this.getAttribute("min-score")||0)}set minScore(e){Number.isNaN(e)||this.setAttribute("min-score",String(e))}get maxMatches(){return Number(this.getAttribute("max-matches")||1/0)}set maxMatches(e){Number.isNaN(e)||this.setAttribute("max-matches",String(e))}static get observedAttributes(){return["value","mark-selector","min-score","max-matches"]}attributeChangedCallback(e,t,n){if(t===n)return;const s=Bs.get(this);s&&(s.timer&&clearTimeout(s.timer),s.timer=setTimeout(()=>this.sort(),100))}}window.customElements.get("fuzzy-list")||(window.FuzzyListElement=FuzzyListElement,window.customElements.define("fuzzy-list",FuzzyListElement));const Fs=new WeakMap;function Os(e){if(Fs.get(e))return;const n=e.querySelector("filter-input");if(!n)return;const s=t(n,"input",HTMLInputElement),o=document.getElementById(h(n,"aria-owns"));if(!o)return;const c=b(v(s,"keydown",(function(t){if(!(t instanceof KeyboardEvent))return;if(s.closest("details")!==e)return;"Tab"===t.key&&(t.stopPropagation(),t.stopImmediatePropagation())})),v(o,"combobox-commit",t=>function(e,t,n){const s=e.target;if(!(s instanceof HTMLElement))return;if(!(s instanceof HTMLLabelElement)||s.control instanceof HTMLInputElement&&"radio"===s.control.type){t.removeAttribute("open");const e=t.querySelector("summary");e&&e.focus()}w(n,"");const o=t.querySelector("[data-menu-button]");if(!o)return;const r=(s.querySelector("[data-menu-button-text]")||s).textContent;o.textContent=r}(t,e,s)),v(n,"filter-input-updated",(function(){const e=o.querySelector("[data-filter-new-item]");if(!e)return;const t=e.querySelector('[role="option"]');if(!t)return;t.hidden=e.hidden})),v(n,"filter-input-updated",()=>{i(s,o),a(s,o,1)}));Fs.set(e,c),r(s,o)}function Us(){const e=n(document,"input[type=text].js-advanced-search-prefix",HTMLInputElement),s=n(document,"select.js-advanced-search-prefix",HTMLSelectElement),o=n(document,".js-advanced-search-prefix:checked",HTMLInputElement),r=[...zs(e),...zs(s),...zs(o)],i=r.reduce((e,t)=>(t.value&&t.type&&e[t.type]++,e),{Repositories:0,Users:0,Code:0,Issues:0}),a=r.reduce((e,t)=>`${e} ${function({prefix:e,value:t}){return""===e?"":t?`${e}${t}`:""}(t)}`.trim(),""),c=t(document,".js-advanced-search-input",HTMLInputElement).value;t(document,".js-type-value",HTMLInputElement).value=function(e){let t=new URLSearchParams(window.location.search).get("type")||"Repositories",n=0;for(const s in e)e[s]>n&&(n=e[s],t=s);return t}(i),t(document,".js-search-query",HTMLInputElement).value=`${c} ${a}`.trim();const l=t(document,".js-advanced-query");l.innerHTML="",l.textContent=a;const u=document.createElement("span");u.textContent=c.trim(),l.prepend(u," ")}function Ws(e){return-1!==e.search(/\s/g)?`"${e}"`:e}function zs(e){return e.map(e=>{const t=e.value.trim(),n=h(e,"data-search-prefix"),s=e.getAttribute("data-search-type");return""===n?{prefix:n,value:t,type:s}:-1!==t.search(/,/g)&&"location"!==n?t.split(/,/).map(e=>({prefix:n,value:Ws(e.trim()),type:s})):{prefix:n,value:Ws(t),type:s}}).flatMap(e=>e)}function Vs(e,t){const n=e.querySelector(".js-app-logo-with-bgcolor");n instanceof HTMLElement&&(n.style.backgroundColor=`#${t}`)}function Ks(){return n(document,".js-selected-repository-field",HTMLInputElement)}function Ys(){const e=t(document,"#repository-menu-list"),s=Array.from(Ks()).map(e=>e.value);let o=!1;for(const t of n(e,"[role=menuitem]",HTMLButtonElement)){const e=s.includes(t.value);o||e||(o=!0),t.hidden=e}const r=e.querySelector(".js-no-repository-found");r instanceof HTMLElement&&(r.hidden=o)}function Js(){const e=!t(document,".js-select-repositories-radio",HTMLInputElement).checked||Ks().length>0,n=document.querySelector(".js-integrations-install-form-submit");n&&n instanceof HTMLButtonElement&&(n.disabled=!e)}function Xs(){const e=Ks().length,n=t(document,".js-integration-total-repos");n.hidden=0===e,n.textContent=`Selected ${e} ${T(e,"repository")}.`}function Gs(e,t){const n=e.nextElementSibling;return n instanceof HTMLElement?n.classList.contains(t)?n:Gs(n,t):null}function Qs(e,n){e.style.visibility=n?"hidden":"";const s=h(e,"data-tab-item");t(document,`[data-menu-item=${s}]`).hidden=!n}function Zs(e,n){let s=!1;const o=t(e,".js-responsive-underlinenav-overflow");for(const t of n){const n=k(t,e);n&&(s=e.offsetWidth-(n.left+t.offsetWidth)<=o.offsetWidth,Qs(t,s))}o.hidden=!s}function eo(e){to(function(e){return(e.getAttribute("aria-label")||e.innerText||"").trim()}(e))}function to(e){const n=t(document,".js-global-screen-reader-notice");n.textContent="",n.textContent=e}ft("toggle","details[data-filter-menu-enabled]",(function(e){const n=e.target;n.hasAttribute("open")?Os(n):function(e){const n=e.querySelector("filter-input");if(!n)return;const s=t(n,"input",HTMLInputElement),o=document.getElementById(h(n,"aria-owns"));if(!o)return;const r=Fs.get(e);if(!r)return;c(s,o),r.unsubscribe(),Fs.delete(e)}(n)}),{capture:!0}),pt("details[data-filter-menu-enabled][data-deferred-details-content-url]",e=>{t(e,"include-fragment").addEventListener("load",()=>Os(e))}),j(".js-advanced-search-prefix",(function(){Us()})),ft("change",".js-advanced-search-prefix",Us),y(".js-advanced-search-input",(function(e){const t=p(e,".js-advanced-search-label");t.classList.add("focus"),e.addEventListener("blur",()=>t.classList.remove("focus"),{once:!0})})),pt(".js-advanced-search-input",(function(){Us()})),E(".js-app-bgcolor-form",(async function(e,t){const n=e.querySelector(".js-app-bgcolor-save-notice");if(!n)return;let s;try{s=await t.html()}catch(o){n.classList.remove("visible")}s&&(n.classList.add("visible"),setTimeout(()=>n.classList.remove("visible"),1500))})),j(".js-app-bgcolor-input",(function(e){const t=e.target;if(!(t instanceof HTMLInputElement))return;const n=p(t,"form",HTMLFormElement),s=t.value.replace(/^#/,"");if(s.length<1)return t.classList.remove("text-red"),void Vs(n,t.defaultValue);t.checkValidity()?(t.classList.remove("text-red"),Vs(n,s),n.classList.contains("js-app-bgcolor-form")&>(()=>function(e,t){t.checkValidity()&&L(e)}(n,t),400)()):(t.classList.add("text-red"),Vs(n,t.defaultValue))})),pt(".js-apps-install-select-repositories-container remote-input",e=>{e.addEventListener("remote-input-success",Ys),e.addEventListener("remote-input-error",Ys)}),ft("details-menu-selected",".js-apps-install-select-repositories-menu",(function(e){const n=e.detail.relatedTarget,s=t(document,".js-integrations-install-repo-picked"),o=t(n,"template",HTMLTemplateElement).content.cloneNode(!0);s.prepend(o),t(document,".js-min-repository-error").hidden=!0,t(document,".js-max-repository-warning").hidden=!function(){const e=document.querySelector(".js-integrations-install-form");if(e instanceof HTMLFormElement){const t=+(e.getAttribute("data-max-repos")||0);return t>0&&Ks().length>=t}}(),Xs(),Js(),Ys()}),{capture:!0}),ft("change",".js-integrations-install-form",Js),ft("click",".js-repository-picker-remove",(function(e){p(e.currentTarget,".js-repository-picker-result").remove(),t(document,".js-min-repository-error").hidden=Ks().length>0,Xs(),Js(),Ys()})),ft("change",".js-installation-repositories-radio",(function(){const e=t(document,".js-select-repositories-radio",HTMLInputElement);t(document,".js-integrations-install-repo-selection").classList.toggle("has-removed-contents",!e.checked)})),ft("click",".js-banner .js-next",(function(e){const n=p(e.currentTarget,".js-banner"),s=t(n,".js-dismiss"),o=t(n,".js-next",HTMLButtonElement),r=t(n,".js-page.d-block"),i=Gs(r,"js-page");i&&(r.classList.remove("d-block"),r.classList.add("d-none"),i.classList.remove("d-none"),i.classList.add("d-block"),Gs(i,"js-page")||(o.classList.add("d-none"),s.classList.remove("d-none")))})),pt(".js-banner",(function(e){const n=t(e,".js-dismiss");if(e.querySelectorAll(".js-page").length>0){const s=t(e,".js-next",HTMLButtonElement),o=t(e,".js-page.d-block",HTMLDivElement);o&&!Gs(o,"js-page")?n.classList.remove("d-none"):s.classList.remove("d-none")}else n.classList.remove("d-none")})),pt(".js-responsive-underlinenav",{constructor:HTMLElement,initialize(e){const t=n(e,".js-responsive-underlinenav-item");Zs(e,t),window.addEventListener("resize",(function(){Zs(e,t)}),{passive:!0})}}),ft("deprecatedAjaxSend","[data-remote]",(function(e){e.currentTarget===e.target&&(e.defaultPrevented||e.currentTarget.classList.add("loading"))})),ft("deprecatedAjaxComplete","[data-remote]",(function(e){e.currentTarget===e.target&&e.currentTarget.classList.remove("loading")})),E("form.js-ajax-pagination, .js-ajax-pagination form",(async function(e,t){const n=p(e,".js-ajax-pagination");let s;try{s=await t.html()}catch(o){if(o.response&&404===o.response.status)return void n.remove();throw o}n.replaceWith(s.html),ht(e,"page:loaded")}));const no=["input[pattern]","input[required]","textarea[required]","input[data-required-change]","textarea[data-required-change]"].join(",");y(no,e=>{let t=e.checkValidity();function n(){const n=e.checkValidity();n!==t&&e.form&&oo(e.form),t=n}e.addEventListener("input",n),e.addEventListener("blur",(function t(){e.removeEventListener("input",n),e.removeEventListener("blur",t)}))});const so=new WeakMap;function oo(e){const t=e.checkValidity();for(const s of n(e,"button[data-disable-invalid]",HTMLButtonElement))s.disabled=!t}pt("button[data-disable-invalid]",{constructor:HTMLButtonElement,initialize(e){const t=e.form;t&&(!function(e){so.get(e)||(e.addEventListener("change",()=>oo(e)),so.set(e,!0))}(t),e.disabled=!t.checkValidity())}}),pt("input[data-required-change], textarea[data-required-change]",(function(e){const t="radio"===e.type&&e.form?M(e.form,e.name,RadioNodeList).value:null;function n(n){const s=e.form;if(n&&"radio"===e.type&&s&&t)for(const o of M(s,e.name,RadioNodeList))o instanceof HTMLInputElement&&o.setCustomValidity(e.value===t?"unchanged":"");else e.setCustomValidity(e.value===(t||e.defaultValue)?"unchanged":"")}e.addEventListener("input",n),e.addEventListener("change",n),n(),e.form&&oo(e.form)})),document.addEventListener("reset",(function(e){if(e.target instanceof HTMLFormElement){const t=e.target;setTimeout(()=>oo(t))}}));const ro=new WeakMap;function io(e,t){t.classList.remove("is-loading","successed","errored","warn"),e.classList.remove("is-autocheck-loading","is-autocheck-successful","is-autocheck-errored");const n=t.querySelector("p.note");if(n){const e=ro.get(n);e&&(n.innerHTML=e)}const s=t.querySelector("dd.error");s&&s.remove();const o=t.querySelector("dd.warning");o&&o.remove()}function ao(e){const t=e.closest("form");if(!t)return;const n=t.querySelector(".js-auto-complete-button");n instanceof HTMLButtonElement&&(n.disabled=!e.value)}pt("auto-check",(function(e){const n=t(e,"input",HTMLInputElement),s=n.closest("dl.form-group")||e,o=n.form;let r=null;n.hasAttribute("aria-describedby")||(r=`input-check-${(1e4*Math.random()).toFixed(0)}`,n.setAttribute("aria-describedby",r));const i=s.querySelector("p.note");i&&(!i.id&&r&&(i.id=r),ro.set(i,i.innerHTML)),e.addEventListener("loadstart",()=>{io(n,s),s.classList.add("is-loading"),n.classList.add("is-autocheck-loading"),oo(o)}),e.addEventListener("loadend",()=>{s.classList.remove("is-loading"),n.classList.remove("is-autocheck-loading")}),n.addEventListener("auto-check-success",async e=>{n.classList.add("is-autocheck-successful"),s.classList.add("successed"),oo(o);const{response:t}=e.detail;if(!t)return;const a=await t.text();if(a)if(i instanceof HTMLElement)i.innerHTML=a,eo(i);else{const e=document.createElement("dd");r&&(e.id=r),e.classList.add("warning"),e.innerHTML=a,s.append(e),s.classList.add("warn"),eo(e)}else to("Auto check succeeded")}),n.addEventListener("auto-check-error",async e=>{n.classList.add("is-autocheck-errored"),s.classList.add("errored"),oo(o);const{response:t}=e.detail;if(!t)return;const a=await t.text();if(i instanceof HTMLElement)i.innerHTML=a||"Something went wrong",eo(i);else{const e=document.createElement("dd");r&&(e.id=r),e.classList.add("error"),e.innerHTML=a||"Something went wrong",s.append(e),eo(e)}}),n.addEventListener("input",()=>{n.value||io(n,s)}),o.addEventListener("reset",()=>{io(n,s)})})),pt("auto-complete",(function(e){e.addEventListener("loadstart",()=>e.classList.add("is-auto-complete-loading")),e.addEventListener("loadend",()=>e.classList.remove("is-auto-complete-loading"))})),pt("auto-complete",{constructor:S,initialize:ao}),ft("auto-complete-change","auto-complete",(function(e){ao(e.currentTarget)}));const co=new H;function lo(e){const t=e.target;if(!(t instanceof HTMLInputElement||t instanceof HTMLSelectElement))return;const n=t.form;L(n)}E("[data-autosearch-results-container]",(async function(e,t){e.classList.add("is-sending");try{const n=await co.push(t.html()),s=e.getAttribute("data-autosearch-results-container"),o=s?document.getElementById(s):null;o&&(o.innerHTML="",o.appendChild(n.html)),A(null,"",`?${x(e)}`)}finally{e.classList.remove("is-sending")}})),y("input[data-autoselect], textarea[data-autoselect]",(async function(e){await g(),e.select()})),ft("change","form[data-autosubmit]",(function(e){const t=e.currentTarget;L(t)})),ft("change","input[data-autosubmit], select[data-autosubmit]",lo);const uo=gt(lo,300);function mo(e){e.preventDefault(),e.stopPropagation()}function fo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],s=!0,o=!1,r=void 0;try{for(var i,a=e[Symbol.iterator]();!(s=(i=a.next()).done)&&(n.push(i.value),!t||n.length!==t);s=!0);}catch(c){o=!0,r=c}finally{try{s||null==a.return||a.return()}finally{if(o)throw r}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}pt("input[data-throttled-autosubmit]",{subscribe:e=>v(e,"input",uo)}),pt("a.btn.disabled",{subscribe:e=>v(e,"click",mo)}),(async()=>{await C;const e=function(e){try{return JSON.parse(window.localStorage.getItem(e)||"{}")}catch(t){return{}}}("bundle-urls")||{},t=function(){const e={};for(const t of document.getElementsByTagName("script")){const n=t.src.match(/\/([\w-]+)-[0-9a-f]{32,}\.js$/);n&&(e[`${n[1]}.js`]=t.src)}for(const t of document.getElementsByTagName("link")){const n=t.href.match(/\/([\w-]+)-[0-9a-f]{32,}\.css$/);n&&(e[`${n[1]}.css`]=t.href)}return e}();!function(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch(n){}}("bundle-urls",t);const n=Object.keys(t).filter(n=>{const s=t[n];return e[n]!==s});n.length&&q({downloadedBundles:n})})(),pt(".js-check-all-container",{subscribe:function(e){var t=!1,n=null;function s(e,t,n){var s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t instanceof HTMLInputElement&&(t.indeterminate=s,t.checked!==n&&(t.checked=n,setTimeout((function(){var n=new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{relatedTarget:e}});t.dispatchEvent(n)}))))}function o(o){var r=o.target;r instanceof Element&&(r.hasAttribute("data-check-all")?function(t){if(t instanceof CustomEvent&&t.detail){var o=t.detail.relatedTarget;if(o&&o.hasAttribute("data-check-all-item"))return}var r=t.target;if(!(r instanceof HTMLInputElement))return;n=null;var a=!0,c=!1,l=void 0;try{for(var u,d=e.querySelectorAll("[data-check-all-item]")[Symbol.iterator]();!(a=(u=d.next()).done);a=!0){var m=u.value;s(r,m,r.checked)}}catch(f){c=!0,l=f}finally{try{a||null==d.return||d.return()}finally{if(c)throw l}}i()}(o):r.hasAttribute("data-check-all-item")&&function(o){if(o instanceof CustomEvent&&o.detail){var r=o.detail.relatedTarget;if(r&&(r.hasAttribute("data-check-all")||r.hasAttribute("data-check-all-item")))return}var a=o.target;if(!(a instanceof HTMLInputElement))return;var c=Array.from(e.querySelectorAll("[data-check-all-item]"));if(t&&n){var l=fo([c.indexOf(n),c.indexOf(a)].sort(),2),u=l[0],d=l[1],m=!0,f=!1,p=void 0;try{for(var g,h=c.slice(u,+d+1||9e9)[Symbol.iterator]();!(m=(g=h.next()).done);m=!0){var b=g.value;s(a,b,a.checked)}}catch(y){f=!0,p=y}finally{try{m||null==h.return||h.return()}finally{if(f)throw p}}}t=!1,n=a;var v=e.querySelector("[data-check-all]");if(v){var w=c.length,j=c.filter((function(e){return e instanceof HTMLInputElement&&e.checked})).length;s(a,v,j===w,w>j&&j>0)}i()}(o))}function r(e){e.target instanceof Element&&e.target.hasAttribute("data-check-all-item")&&(t=e.shiftKey)}function i(){var t=e.querySelector("[data-check-all-count]");if(t){var n=e.querySelectorAll("[data-check-all-item]:checked").length;t.textContent=n.toString()}}return e.addEventListener("mousedown",r),e.addEventListener("change",o),{unsubscribe:function(){e.removeEventListener("mousedown",r),e.removeEventListener("change",o)}}}});function po(e){const t=e.querySelector(".js-clipboard-clippy-icon"),n=e.querySelector(".js-clipboard-check-icon");e.classList.toggle("ClipboardButton--success"),t&&t.classList.toggle("d-none"),n&&n.classList.toggle("d-none")}function go(e,t){const n=e.closest(".js-write-bucket");n&&n.classList.toggle("focused",t)}function ho(e){const t=e.currentTarget;t instanceof Element&&go(t,!1)}function bo(e){const n=p(e,".js-previewable-comment-form"),s=e.classList.contains("js-preview-tab");if(s){const e=t(n,".js-write-bucket");t(n,".js-preview-body").style.minHeight=`${e.clientHeight}px`}n.classList.toggle("preview-selected",s),n.classList.toggle("write-selected",!s);const o=t(n,'.tabnav-tab.selected, .tabnav-tab[aria-selected="true"]');o.setAttribute("aria-selected","false"),o.classList.remove("selected"),e.classList.add("selected"),e.setAttribute("aria-selected","true");const r=t(n,".js-write-tab");return s?r.setAttribute("data-hotkey","Control+P,Meta+P"):r.removeAttribute("data-hotkey"),n}ft("clipboard-copy","[data-copy-feedback]",e=>{const t=e.currentTarget,n=h(t,"data-copy-feedback"),s=t.getAttribute("aria-label"),o=t.getAttribute("data-tooltip-direction")||"s";t.setAttribute("aria-label",n),t.classList.add("tooltipped",`tooltipped-${o}`),t instanceof HTMLElement&&(eo(t),setTimeout(()=>{s?t.setAttribute("aria-label",s):t.removeAttribute("aria-label"),t.classList.remove("tooltipped",`tooltipped-${o}`)},2e3))}),ft("clipboard-copy",".js-clipboard-copy",(function({currentTarget:e}){e instanceof HTMLElement&&(po(e),setTimeout(po,2e3,e))})),E(".js-new-comment-form",(async function(e,t){let s;!function(e){const t=e.querySelector(".js-comment-form-error");t instanceof HTMLElement&&(t.hidden=!0)}(e);try{s=await t.json()}catch(i){!function(e,t){let n="You can't comment at this time";if(t.response&&422===t.response.status){const e=t.response.json;e.errors&&(n+=` โ€” your comment ${e.errors.join(", ")}`)}n+=". ";const s=e.querySelector(".js-comment-form-error");s instanceof HTMLElement&&(s.textContent=n,s.hidden=!1)}(e,i)}if(!s)return;e.reset();for(const a of n(e,".js-resettable-field",HTMLInputElement))w(a,a.getAttribute("data-reset-value")||"");const o=e.querySelector(".js-write-tab");o instanceof HTMLElement&&o.click();const r=s.json.updateContent;for(const n in r){const e=r[n],t=document.querySelector(n);t instanceof HTMLElement?I(t,e):console.warn(`couldn't find ${n} for immediate update`)}})),pt(".js-comment-and-button",{constructor:HTMLButtonElement,initialize(e){const n=t(e.form,".js-comment-field"),s=e.querySelector(".js-form-action-text"),o=s||e,r=o.textContent;let i=!1;function a(t){const n=t.currentTarget.value.trim();n!==i&&(i=n,o.textContent=n?h(e,"data-comment-text"):r)}return{add(){n.addEventListener("input",a),n.addEventListener("change",a)},remove(){n.removeEventListener("input",a),n.removeEventListener("change",a)}}}}),ft("click",".js-comment-edit-button",(function(e){const n=p(e.currentTarget,".js-comment");n.classList.add("is-comment-editing"),t(n,".js-write-tab").click();const s=t(n,".js-comment-field");s.focus(),ht(s,"change");const o=e.currentTarget.closest(".js-dropdown-details");o&&o.removeAttribute("open")})),ft("click",".js-comment-hide-button",(function(e){const t=p(e.currentTarget,".js-comment").querySelector(".js-minimize-comment");t&&t.classList.remove("d-none");const n=e.currentTarget.closest(".js-dropdown-details");n&&n.removeAttribute("open")})),ft("click",".js-comment-hide-minimize-form",(function(e){p(e.currentTarget,".js-minimize-comment").classList.add("d-none")})),ft("click",".js-comment-cancel-button",(function(e){const t=p(e.currentTarget,"form",HTMLFormElement),n=h(e.currentTarget,"data-confirm-text");if(_(t)&&!confirm(n))return!1;for(const o of t.querySelectorAll("input, textarea")){const e=o;e.value=e.defaultValue}const s=e.currentTarget.closest(".js-comment");s&&s.classList.remove("is-comment-editing")})),E(".js-comment-delete, .js-comment .js-comment-update, .js-issue-update, .js-comment-minimize, .js-comment-unminimize",(function(e,t,n){const s=p(e,".js-comment");s.classList.add("is-comment-loading");const o=s.getAttribute("data-body-version");o&&n.headers.set("X-Body-Version",o)})),E(".js-comment .js-comment-update",(async function(e,t){let n;const s=p(e,".js-comment"),o=s.querySelector(".js-comment-update-error");o instanceof HTMLElement&&(o.hidden=!0);try{n=await t.json()}catch(l){if(422!==l.response.status)throw l;{const e=JSON.parse(l.response.text);if(e.errors)return void(o instanceof HTMLElement&&(o.textContent=`There was an error posting your comment: ${e.errors.join(", ")}`,o.hidden=!1))}}if(!n)return;const r=n.json,i=s.querySelector(".js-comment-body");i&&r.body&&(i.innerHTML=r.body),s.setAttribute("data-body-version",r.newBodyVersion);const a=s.querySelector(".js-body-version");a instanceof HTMLInputElement&&(a.value=r.newBodyVersion);for(const u of s.querySelectorAll("input, textarea")){const e=u;e.defaultValue=e.value}s.classList.remove("is-comment-stale","is-comment-editing");const c=s.querySelector(".js-comment-edit-history");if(c){const e=await $(document,r.editUrl);c.innerHTML="",c.append(e)}})),E(".js-comment .js-comment-delete, .js-comment .js-comment-update, .js-comment-minimize, .js-comment-unminimize",(async function(e,t){const n=p(e,".js-comment");try{await t.text()}catch(s){if(422!==s.response.status)throw s;{let e;try{e=JSON.parse(s.response.text)}catch(o){}e&&e.stale&&n.classList.add("is-comment-stale")}}n.classList.remove("is-comment-loading")})),E(".js-comment-delete",(async function(e,t){await t.json();let n=e.closest(".js-comment-delete-container");n||(n=e.closest(".js-comment-container")||e.closest(".js-line-comments"),n&&1!==n.querySelectorAll(".js-comment").length&&(n=p(e,".js-comment"))),n.remove()})),E(".js-issue-update",(async function(e,n){const s=p(e,".js-details-container");s.classList.remove("open");const o=(await n.json()).json;if(null!=o.issue_title){t(s,".js-issue-title").textContent=o.issue_title;const e=s.closest(".js-issues-results");if(e){if(e.querySelector(".js-merge-pr.is-merging")){const t=e.querySelector(".js-merge-pull-request textarea");t instanceof HTMLTextAreaElement&&t.value===t.defaultValue&&(t.value=t.defaultValue=o.issue_title)}else if(e.querySelector(".js-merge-pr.is-squashing")){const t=e.querySelector(".js-merge-pull-request .js-merge-title");t instanceof HTMLInputElement&&t.value===t.defaultValue&&(t.value=t.defaultValue=o.default_squash_commit_title)}const t=e.querySelector("button[value=merge]");t&&t.setAttribute("data-input-message-value",o.issue_title);const n=e.querySelector("button[value=squash]");n&&n.setAttribute("data-input-title-value",o.default_squash_commit_title)}}document.title=o.page_title;for(const t of e.elements)(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.defaultValue=t.value)})),E(".js-comment-minimize",(async function(e,t){await t.json();const n=p(e,".js-comment").querySelector(".js-minimize-comment");n&&n.classList.add("d-none");const s=p(e,".unminimized-comment");s.classList.add("d-none"),s.classList.remove("js-comment");const o=p(e,".js-minimizable-comment-group").querySelector(".minimized-comment");o&&o.classList.remove("d-none"),o&&o.classList.add("js-comment")})),E(".js-comment-unminimize",(async function(e,t){await t.json();const n=p(e,".js-minimizable-comment-group"),s=n.querySelector(".unminimized-comment");s&&s.classList.remove("d-none"),s&&s.classList.add("js-comment");const o=n.querySelector(".minimized-comment");o&&o.classList.add("d-none"),o&&o.classList.remove("js-comment")})),ft("details-menu-select",".js-comment-edit-history-menu",e=>{const t=e.detail.relatedTarget.getAttribute("data-edit-history-url");if(!t)return;e.preventDefault();const n=$(document,t);D({content:n,dialogClass:"Box-overlay--wide"})},{capture:!0}),y(".js-comment-field",(function(e){go(e,!0),e.addEventListener("blur",ho,{once:!0})})),ft("click",".js-write-tab",(function(e){const n=e.currentTarget,s=p(n,".js-previewable-comment-form");if(s instanceof TabContainerElement)return;const o=bo(n);setTimeout(()=>{t(o,".js-comment-field").focus()});const r=s.querySelector("markdown-toolbar");r instanceof HTMLElement&&(r.hidden=!1)})),ft("click",".js-preview-tab",(function(e){const t=e.currentTarget,n=p(t,".js-previewable-comment-form");if(n instanceof TabContainerElement)return;const s=bo(t);setTimeout(()=>{Eo(s)});const o=n.querySelector("markdown-toolbar");o instanceof HTMLElement&&(o.hidden=!0),e.stopPropagation(),e.preventDefault()})),ft("tab-container-change",".js-previewable-comment-form",(function(e){const n=e.detail.relatedTarget.classList.contains("js-preview-panel"),s=e.currentTarget,o=t(s,".js-write-tab");if(n){const e=t(s,".js-write-bucket");t(s,".js-preview-body").style.minHeight=`${e.clientHeight}px`,o.setAttribute("data-hotkey","Control+P,Meta+P"),Eo(s);const n=s.querySelector("markdown-toolbar");n instanceof HTMLElement&&(n.hidden=!0)}else{o.removeAttribute("data-hotkey"),setTimeout(()=>t(s,".js-comment-field").focus(),0);const e=s.querySelector("markdown-toolbar");e instanceof HTMLElement&&(e.hidden=!1)}s.classList.toggle("preview-selected",n),s.classList.toggle("write-selected",!n)})),ft("preview:render",".js-previewable-comment-form",(function(e){const n=bo(t(e.target,".js-preview-tab"));setTimeout(()=>{Eo(n);const e=n.querySelector("markdown-toolbar");e instanceof HTMLElement&&(e.hidden=!0)})}));const vo=new H,wo=new WeakMap;let jo=!1;async function yo(e,t,n,s,o,r,i,a,c,l,u){const d={};d.text=t;const m=function(e){const t=e.querySelector(".js-data-preview-url-csrf"),n=p(e,"form",HTMLFormElement).elements.namedItem("authenticity_token");return t instanceof HTMLInputElement?t.value:n instanceof HTMLInputElement?n.value:null}(e);m&&(d.authenticity_token=m),n&&(d.path=n),s&&(d.line_number=s),o&&(d.start_line_number=o),r&&(d.side=r),i&&(d.start_side=i),a&&(d.start_commit_oid=a),c&&(d.end_commit_oid=c),l&&(d.base_commit_oid=l),u&&(d.comment_id=u);const f={url:h(e,"data-preview-url"),data:d};ht(e,"preview:setup",f);const g=JSON.stringify(f),[b,v]=wo.get(e)||[];if(b===g)return v;jo=!1;const w=vo.push(function(e){const t=new FormData;for(const n in e.data){const s=e.data[n];null!=s&&t.append(n,s)}return N(e.url,{method:"post",body:t})}(f));wo.set(e,[g,w]);const j=await w;return jo=!0,j}async function Eo(e){const n=t(e,".js-comment-field",HTMLTextAreaElement),s=t(e,".comment-body"),o=e.querySelector(".js-path"),r=e.querySelector(".js-line-number"),i=e.querySelector(".js-start-line-number"),a=e.querySelector(".js-side"),c=e.querySelector(".js-start-side"),l=e.querySelector(".js-start-commit-oid"),u=e.querySelector(".js-end-commit-oid"),d=e.querySelector(".js-base-commit-oid"),m=e.querySelector(".js-comment-id"),f=o instanceof HTMLInputElement?o.value:null,p=r instanceof HTMLInputElement?r.value:null,g=i instanceof HTMLInputElement?i.value:null,h=a instanceof HTMLInputElement?a.value:null,b=c instanceof HTMLInputElement?c.value:null,v=l instanceof HTMLInputElement?l.value:null,w=u instanceof HTMLInputElement?u.value:null,j=d instanceof HTMLInputElement?d.value:null,y=m instanceof HTMLInputElement?m.value:null;jo||(s.innerHTML="

Loading preview…

");try{const t=await yo(e,n.value,f,p,g,h,b,v,w,j,y);s.innerHTML=t||"

Nothing to preview

"}catch(E){s.innerHTML="

Error rendering preview

"}}pt(".js-preview-tab",(function(e){let n,s,o,r,i,a,c,l,u,d,m;e.addEventListener("mouseenter",()=>{!async function(){if(!n){n=p(e,".js-previewable-comment-form"),s=t(n,".js-comment-field",HTMLTextAreaElement);const f=n.querySelector(".js-path"),g=n.querySelector(".js-line-number"),h=n.querySelector(".js-start-line-number"),b=n.querySelector(".js-side"),v=n.querySelector(".js-start-side"),w=n.querySelector(".js-start-commit-oid"),j=n.querySelector(".js-end-commit-oid"),y=n.querySelector(".js-base-commit-oid"),E=n.querySelector(".js-comment-id");o=f instanceof HTMLInputElement?f.value:null,r=g instanceof HTMLInputElement?g.value:null,i=h instanceof HTMLInputElement?h.value:null,a=b instanceof HTMLInputElement?b.value:null,c=v instanceof HTMLInputElement?v.value:null,l=w instanceof HTMLInputElement?w.value:null,u=j instanceof HTMLInputElement?j.value:null,d=y instanceof HTMLInputElement?y.value:null,m=E instanceof HTMLInputElement?E.value:null}try{await yo(n,s.value,o,r,i,a,c,l,u,d,m)}catch(f){}}()})})),f("keydown",".js-comment-field",(function(e){const n=e,s=n.target;if((n.ctrlKey||n.metaKey)&&"P"===n.key){const e=p(s,".js-previewable-comment-form");e.classList.contains("write-selected")&&(e instanceof TabContainerElement?t(e,".js-preview-tab").click():(s.blur(),e.dispatchEvent(new CustomEvent("preview:render",{bubbles:!0,cancelable:!1}))),n.preventDefault(),n.stopImmediatePropagation())}}));const Lo=/^(\+1|-1|:\+1?|:-1?)$/;function To(e){const t=e.target,n=t.value,s=p(t,".js-reaction-suggestion");if(s)if((e=>{let t=!1;for(const n of e.split("\n")){const e=n.trim();if(e&&!e.startsWith(">")){if(t&&!1===Lo.test(e))return!1;!t&&Lo.test(e)&&(t=!0)}}return t})(n)){s.classList.remove("hide-reaction-suggestion"),s.classList.add("reaction-suggestion");const e=h(s,"data-reaction-markup");s.setAttribute("data-reaction-suggestion-message",e)}else ko(s)}function ko(e){e.classList.remove("reaction-suggestion"),e.classList.add("hide-reaction-suggestion"),e.removeAttribute("data-reaction-suggestion-message")}async function Mo({currentTarget:e}){const t=e,n=t.hasAttribute("open");ht(t,n?"menu:activate":"menu:deactivate"),await g(),ht(t,n?"menu:activated":"menu:deactivated")}ft("focusout","#new_comment_field",(function(e){const t=e.currentTarget;ko(p(t,".js-reaction-suggestion"))})),ft("focusin","#new_comment_field",(function(e){To(e)})),f("keyup","#new_comment_field",(function(e){To(e)})),pt("details.select-menu details-menu include-fragment",(function(e){const t=e.closest("details");t&&(e.addEventListener("loadstart",(function(){t.classList.add("is-loading"),t.classList.remove("has-error")})),e.addEventListener("error",(function(){t.classList.add("has-error")})),e.addEventListener("loadend",(function(){t.classList.remove("is-loading");const e=t.querySelector(".js-filterable-field");e&&ht(e,"filterable:change")})))})),pt("details details-menu .js-filterable-field",{constructor:HTMLInputElement,add(e){const t=p(e,"details");t.addEventListener("toggle",(function(){t.hasAttribute("open")||(e.value="",ht(e,"filterable:change"))}))}}),pt("details-menu[role=menu] [role=menu]",e=>{const t=e.closest("details-menu[role]");t&&t!==e&&t.removeAttribute("role")}),pt("details details-menu remote-input input",{constructor:HTMLInputElement,add(e){const t=p(e,"details");t.addEventListener("toggle",(function(){t.hasAttribute("open")||(e.value="")}))}}),pt("form details-menu",e=>{const t=p(e,"form");t.addEventListener("reset",()=>{setTimeout(()=>function(e){const t=e.querySelectorAll("details-menu [role=menuitemradio] input[type=radio]:checked");for(const n of t)ht(n,"change")}(t),0)})}),f("keypress","details-menu .js-filterable-field, details-menu filter-input input",e=>{if(e instanceof KeyboardEvent&&"Enter"===e.key){const t=e.currentTarget,n=p(t,"details-menu").querySelector('[role^="menuitem"]:not([hidden])');n instanceof HTMLElement&&n.click(),e.preventDefault()}}),ft("details-menu-selected","details-menu",e=>{const t=e.currentTarget.querySelector(".js-filterable-field");t instanceof HTMLInputElement&&t.value&&t.focus()},{capture:!0}),ft("details-menu-selected","[data-menu-input]",e=>{if(!(e.target instanceof Element))return;const t=h(e.target,"data-menu-input"),n=document.getElementById(t);(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement)&&(n.value=e.detail.relatedTarget.value)},{capture:!0}),pt("details-menu remote-input",{constructor:B,initialize(e){const t=document.getElementById(e.getAttribute("aria-owns")||"");if(!t)return;let n=null;e.addEventListener("load",()=>{n=document.activeElement&&t.contains(document.activeElement)&&document.activeElement.id?document.activeElement.id:null}),e.addEventListener("loadend",()=>{if(n){const s=t.querySelector(`#${n}`)||t.querySelector('[role^="menu"]');s instanceof HTMLElement?s.focus():e.input&&e.input.focus()}})}}),ft("details-menu-selected","details-menu[data-menu-max-options]",e=>{const s=+h(e.currentTarget,"data-menu-max-options")===e.currentTarget.querySelectorAll('[role="menuitemcheckbox"][aria-checked="true"]').length;t(e.currentTarget,"[data-menu-max-options-warning]").hidden=!s;for(const t of n(e.currentTarget,'[role="menuitemcheckbox"] input',HTMLInputElement))t.disabled=s&&!t.checked},{capture:!0}),pt("details > details-menu",{subscribe(e){const t=p(e,"details");return v(t,"toggle",Mo)}});const So=new WeakMap,Ao=["input[type=submit][data-disable-with]","button[data-disable-with]"].join(", ");function xo(e,t){e instanceof HTMLInputElement?e.value=t:e.innerHTML=t}function Ho(e){for(const t of e.querySelectorAll(Ao)){const n=So.get(t);null!=n&&(xo(t,n),t.hasAttribute("data-disable-invalid")&&!e.checkValidity()||(t.disabled=!1),So.delete(t))}}ft("submit","form",(function(e){for(const n of e.currentTarget.querySelectorAll(Ao)){So.set(n,(t=n)instanceof HTMLInputElement?t.value||"Submit":t.innerHTML||"");const e=n.getAttribute("data-disable-with");e&&xo(n,e),n.disabled=!0}var t}),{capture:!0}),ft("deprecatedAjaxComplete","form",(function({currentTarget:e,target:t}){e===t&&Ho(e)})),P(Ho);const Co={OS:"Meta",Win:"Meta",Windows:"Meta",Scroll:"ScrollLock",SpaceBar:" ",Left:"ArrowLeft",Right:"ArrowRight",Down:"ArrowDown",Up:"ArrowUp",Del:"Delete",Esc:"Escape"};const qo=Object.getOwnPropertyDescriptor(KeyboardEvent.prototype,"key");if(qo){let e=e=>qo.get.apply(e);/Macintosh.*Safari/.test(navigator.userAgent)&&(e=e=>function(e,t){return t&&/^[a-z]$/.test(e)?e.toUpperCase():e}(qo.get.apply(e),e.shiftKey)),Object.defineProperty(KeyboardEvent.prototype,"key",{enumerable:!0,configurable:!0,get(){return t=e(this),Co[t]||t;var t}})}pt(".js-feature-preview-indicator-container",e=>{!async function(e){const t=h(e,"data-feature-preview-indicator-src"),s=await d(t),o=await s.json(),r=n(e,".js-feature-preview-indicator");for(const n of r)o.show_indicator&&(n.hidden=!1)}(e)}),ft("click","[data-feature-preview-trigger-url]",async e=>{const t=e.currentTarget,s=h(t,"data-feature-preview-trigger-url"),o=await D({content:$(document,s),dialogClass:"feature-preview-dialog"}),r=h(t,"data-feature-preview-close-details"),i=h(t,"data-feature-preview-close-hmac");o.addEventListener("dialog:remove",()=>{q({hydroEventPayload:r,hydroEventHmac:i},!0)});const a=n(document,".js-feature-preview-indicator");for(const n of a)n.hidden=!0}),E(".js-feature-preview-unenroll",async(e,n)=>{await n.text();const s=t(e,".js-feature-preview-slug",HTMLInputElement).value;ht(e,`feature-preview-unenroll:${s}`)}),E(".js-feature-preview-enroll",async(e,n)=>{await n.text();const s=t(e,".js-feature-preview-slug",HTMLInputElement).value;ht(e,`feature-preview-enroll:${s}`)});class Io{constructor(e,t){this.attachment=e,this.policy=t}async process(e){const t=new Headers(this.policy.header||{}),n=new XMLHttpRequest;n.open("POST",this.policy.upload_url,!0);for(const[s,o]of t)n.setRequestHeader(s,o);n.onloadstart=()=>{e.attachmentUploadDidStart(this.attachment,this.policy)},n.upload.onprogress=t=>{if(t.lengthComputable){const n=Math.round(t.loaded/t.total*100);e.attachmentUploadDidProgress(this.attachment,n)}},await function(e,t){return new Promise((n,s)=>{e.onload=()=>n(e),e.onerror=s,e.send(t)})}(n,function(e,t){const n=new FormData;t.same_origin&&n.append("authenticity_token",t.upload_authenticity_token);for(const s in t.form)n.append(s,t.form[s]);return n.append("file",e.file),n}(this.attachment,this.policy)),204===n.status?(_o(this.policy),e.attachmentUploadDidComplete(this.attachment,this.policy,{})):201===n.status?(_o(this.policy),e.attachmentUploadDidComplete(this.attachment,this.policy,JSON.parse(n.responseText))):e.attachmentUploadDidError(this.attachment,{status:n.status,body:n.responseText})}}function _o(e){const t="string"==typeof e.asset_upload_url?e.asset_upload_url:null,n="string"==typeof e.asset_upload_authenticity_token?e.asset_upload_authenticity_token:null;if(!t||!n)return;const s=new FormData;s.append("authenticity_token",n),fetch(t,{method:"PUT",body:s,credentials:"same-origin",headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}})}async function $o(e,t){const n=function(e,t){return{attachmentUploadDidStart(n,s){n.saving(0),Po(t,"is-uploading"),ht(t,"upload:start",{batch:e,attachment:n,policy:s})},attachmentUploadDidProgress(n,s){n.saving(s),ht(t,"upload:progress",{batch:e,attachment:n})},attachmentUploadDidComplete(n,s,o){n.saved(function(e,t){const n=(null==e.id?null:String(e.id))||(null==t.asset.id?null:String(t.asset.id)),s=("string"==typeof e.href?e.href:null)||("string"==typeof t.asset.href?t.asset.href:null);return{id:n,href:s,name:t.asset.name}}(o,s)),ht(t,"upload:complete",{batch:e,attachment:n}),Po(t,"is-default")},attachmentUploadDidError(n,s){ht(t,"upload:error",{batch:e,attachment:n});const o=No(s);Po(t,o)}}}(e,t);for(const o of e.attachments){const r=await Do(e,o,t);if(!r)return;try{const e=new Io(o,r);await e.process(n)}catch(s){return ht(t,"upload:error",{batch:e,attachment:o}),void Po(t,"is-failed")}}}async function Do(e,n,s){const o=function(e,n){const s=t(n,".js-data-upload-policy-url-csrf",HTMLInputElement).value,o=n.getAttribute("data-upload-repository-id"),r=e.file,i=new FormData;i.append("name",r.name),i.append("size",String(r.size)),i.append("content_type",r.type),i.append("authenticity_token",s),o&&i.append("repository_id",o);e.directory&&i.append("directory",e.directory);return i}(n,s),r=[];ht(s,"upload:setup",{batch:e,attachment:n,form:o,preprocess:r});try{await Promise.all(r);const t=await fetch(function(e,t){return new Request(h(t,"data-upload-policy-url"),{method:"POST",body:e,credentials:"same-origin",headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}})}(o,s));if(t.ok)return await t.json();ht(s,"upload:invalid",{batch:e,attachment:n});const i=await t.text();Po(s,No({status:t.status,body:i},n.file))}catch(i){ht(s,"upload:invalid",{batch:e,attachment:n}),Po(s,"is-failed")}return null}function No(e,t){if(400===e.status)return"is-bad-file";if(422!==e.status)return"is-failed";const n=JSON.parse(e.body);if(!n||!n.errors)return"is-failed";for(const s of n.errors)switch(s.field){case"size":{const e=t?t.size:null;return null!=e&&0===e?"is-empty":"is-too-big"}case"file_count":return"is-too-many";case"width":case"height":return"is-bad-dimensions";case"name":return"already_exists"===s.code?"is-duplicate-filename":"is-bad-file";case"content_type":return"is-bad-file";case"uploader_id":return"is-bad-permissions";case"repository_id":return"is-repository-required";case"format":return"is-bad-format"}return"is-failed"}const Bo=["is-default","is-uploading","is-bad-file","is-duplicate-filename","is-too-big","is-too-many","is-hidden-file","is-failed","is-bad-dimensions","is-empty","is-bad-permissions","is-repository-required","is-bad-format"];function Po(e,t){e.classList.remove(...Bo),e.classList.add(t)}class Ro{constructor(e){this.attachments=e,this.size=this.attachments.length,this.total=Fo(this.attachments,e=>e.file.size)}percent(){const e=Fo(this.attachments,e=>e.file.size*e.percent/100);return Math.round(e/this.total*100)}uploaded(){return Fo(this.attachments,e=>e.isSaved()?1:0)}isFinished(){return this.attachments.every(e=>e.isSaved())}}function Fo(e,t){return e.reduce((e,n)=>e+t(n),0)}pt("file-attachment[hover]",{add(e){e.classList.add("dragover")},remove(e){e.classList.remove("dragover")}}),ft("file-attachment-accept","file-attachment",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/behaviors/file-attachment.ts:18");const{attachments:t}=e.detail;0===t.length&&(Po(e.currentTarget,"is-hidden-file"),e.preventDefault())})),ft("file-attachment-accepted","file-attachment",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/behaviors/file-attachment.ts:27");const{attachments:t}=e.detail;$o(new Ro(t),e.currentTarget)}));let Oo=0;function Uo(e){return Array.from(e.types).indexOf("Files")>=0}function Wo(e){const t=e.dataTransfer;t&&Uo(t)&&e.preventDefault()}function zo(e){const t=e.dataTransfer;t&&Uo(t)&&e.preventDefault()}function Vo({currentTarget:e}){if(!(e instanceof Element))throw new Error("invariant: app/assets/modules/github/behaviors/file-attachment.ts:73");Po(t(e,"file-attachment"),"is-default")}function Ko(e,t){let n=Xo(e,t);if(n&&-1===t.indexOf("/")){n+=Xo(e.substring(e.lastIndexOf("/")+1),t)}return n}function Yo(e){const t=e.toLowerCase().split("");let n="";for(let s=0;s"),o=!0):o&&(r.push(""),o=!1),r.push(t))}e.innerHTML=r.join("")}else{const t=e.innerHTML.trim(),n=t.replace(/<\/?mark>/g,"");t!==n&&(e.innerHTML=n)}}function Xo(e,t){let n=e;if(n===t)return 1;const s=n.length;let o=0,r=0;for(let l=0;l-1?c:Math.max(i,a);if(-1===u)return 0;o+=.1,n[u]===e&&(o+=.1),0===u&&(o+=.8,0===l&&(r=1))," "===n.charAt(u-1)&&(o+=.8),n=n.substring(u+1,s)}const i=t.length,a=o/i;let c=(a*(i/s)+a)/2;return r&&c+.1<1&&(c+=.1),c}pt("file-attachment",{add(e){0==Oo++&&(document.addEventListener("drop",Wo),document.addEventListener("dragover",zo));const t=e.closest("form");t&&t.addEventListener("reset",Vo)},remove(e){0==--Oo&&(document.removeEventListener("drop",Wo),document.removeEventListener("dragover",zo));const t=e.closest("form");t&&t.removeEventListener("reset",Vo)}});const Go=new WeakMap,Qo=new WeakMap,Zo=new WeakMap;function er(e,t,n={}){if(!e)return 0;const s=t.toLowerCase(),o=null!=n.text?n.text:nr,r=n.limit,i=n.score;let a=Go.get(e);const c=e.querySelector('input[type="radio"]:checked'),l=Array.from(e.children);a||(a=Array.from(e.children),Go.set(e,a));for(const g of l)e.removeChild(g),g instanceof HTMLElement&&(g.style.display="");const u=document.createDocumentFragment();let d=0,m=0;if(s){const e=Array.from(a);for(const n of e){null==Qo.get(n)&&Qo.set(n,o(n));const e=i?i(Qo.get(n)||"",s,n):Ko(Qo.get(n)||"",s);Zo.set(n,String(e))}e.sort(tr);const t=Yo(s);for(const o of e)(null==r||d0&&(m++,!0===n.mark&&(Jo(o),Jo(o,s,t)),u.appendChild(o)),d++}else for(const g of a)(null==r||d0));return m}function tr(e,t){const n=parseFloat(Zo.get(e)),s=parseFloat(Zo.get(t)),o=Qo.get(e)||"",r=Qo.get(t)||"";return n>s?-1:nr?1:0}function nr(e){if(e.hasAttribute("data-filter-value")){return(e.getAttribute("data-filter-value")||"").toLowerCase().trim()}return e.textContent.toLowerCase().trim()}function sr(e){return(e.textContent||"").toLowerCase().trim()}function or(e,t){const n=e.innerHTML;if(t){const s=new RegExp(t,"i");e.innerHTML=n.replace(s,"$&")}else{const t=n.replace(/<\/?mark>/g,"");n!==t&&(e.innerHTML=t)}}function rr(e){return(e.querySelector("[data-filterable-item-text]")||e).textContent.toLowerCase().trim()}function ir(e,t){const n=e.innerHTML;if(t){const s=new RegExp(t,"i");e.innerHTML=n.replace(s,"$&")}else{const t=n.replace(/<\/?mark>/g,"");n!==t&&(e.innerHTML=t)}}const ar=new WeakMap;async function cr(e,s,o){const r=ar.get(e)||await async function(e){await R();const t=await F(h(e,"data-filterable-src"));return ar.set(e,t),t}(e);if(null==r)throw new Error("invariant: app/assets/modules/github/substring-memory-filter-list.ts:22");const i=o.limit,a=t(e,"template",HTMLTemplateElement),c={};for(const t of n(e,"input[type=hidden]",HTMLInputElement))c[`${t.name}${t.value}`]=t;let l=a.nextElementSibling;for(;l;){const e=l;l=e.nextElementSibling,e instanceof HTMLElement&&("true"===e.getAttribute("aria-checked")||e.classList.contains("select-menu-divider"))?e.hidden=!0:e.remove()}let u=0,d=document.createDocumentFragment();const m=e.querySelector(".js-divider-suggestions"),f=e.querySelector(".js-divider-rest");function p(e){const n=!(null!=i&&u>=i)&&function(e){return`${e.login} ${e.name}`.toLowerCase().trim()}(e).indexOf(s)>=0;if(n||e.selected){const s=function(e,n,s){if(null!=e.element)return e.element;const o=n.content.cloneNode(!0),r=t(o,"input[type=checkbox]",HTMLInputElement);e.type&&(r.name=`reviewer_${e.type}_ids[]`);r.value=e.id;const i=`${r.name}${e.id}`;let a=e.selected;s[i]&&(a=!0,s[i].remove(),delete s[i]);const c=t(o,"[role^=menuitem]");a&&(c.setAttribute("aria-checked","true"),r.checked=!0);e.disabled&&c.setAttribute("aria-disabled","true");const l=o.querySelector(".js-username");l&&(l.textContent=e.login);const u=o.querySelector(".js-description");u&&(u.textContent=e.name);const d=o.querySelector(".js-extended-description");d&&(e.description?d.textContent=e.description:d.remove());return t(o,".js-avatar",HTMLImageElement).src=e.avatar,e.element=c,e.element}(e,a,c);s.hidden=!n,n&&u++,d.appendChild(s)}}if(m&&r.suggestions){for(const e of r.suggestions)p(e);d.childNodes.length&&(m.after(d),m.hidden=0===u,d=document.createDocumentFragment())}const g=u;for(const t of r.users)p(t);return e.append(d),f&&(f.hidden=u===g||0===g),u}async function lr(e,t){const n=e.hasAttribute("data-filterable-highlight"),s=parseInt(e.getAttribute("data-filterable-limit"),10)||null;let o=0;switch(e.getAttribute("data-filterable-type")){case"fuzzy":o=er(e,t,{mark:n,limit:s});break;case"substring":o=function(e,t,n={}){let s;if(!e)return;const o=t.toLowerCase(),r=null!=n.text?n.text:rr,i=n.limit,a=Array.from(e.children).filter(e=>!e.classList.contains("select-menu-no-results"));!0===n.mark?s=ir:"function"==typeof n.mark&&(s=n.mark);let c=0;for(const l of a)-1!==r(l).indexOf(o)?null!=i&&c>=i?(l.style.display="none",l.hidden=!0):(c++,l.style.display="",l.hidden=!1,s&&(s(l),s(l,o))):(l.style.display="none",l.hidden=!0);return c}(e,t,{mark:n,limit:s})||0;break;case"substring-memory":o=await cr(e,t,{limit:s});break;default:o=function(e,t,n={}){let s;if(!e)return;const o=t.toLowerCase(),r=null!=n.text?n.text:sr,i=n.limit;!0===n.mark?s=or:"function"==typeof n.mark&&(s=n.mark);let a=0;for(const c of e.children)c instanceof HTMLElement&&(0===r(c).indexOf(o)?null!=i&&a>=i?(c.style.display="none",c.hidden=!0):(a++,c.style.display="",c.hidden=!1,s&&(s(c),s(c,o))):(c.style.display="none",c.hidden=!0));return a}(e,t,{mark:n,limit:s})||0}to(`${o} results found.`),e.classList.toggle("filterable-active",t.length>0),e.classList.toggle("filterable-empty",0===o)}pt(".js-filterable-field",{constructor:HTMLInputElement,initialize(e){e.autocomplete||(e.autocomplete="off");let t=e.value;async function n(e){t!==e.value&&(t=e.value,await g(),ht(e,"filterable:change"))}async function s(){t=e.value,await g(),ht(e,"filterable:change")}return{add(e){e.addEventListener("focus",s),O(e,n),document.activeElement===e&&s()},remove(e){e.removeEventListener("focus",s),U(e,n)}}}}),ft("filterable:change",".js-filterable-field",(async function(e){const t=e.currentTarget;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/behaviors/filterable.ts:83");const n=t.value.trim().toLowerCase(),s=document.querySelectorAll(`[data-filterable-for="${t.id}"]`);for(const o of s){await lr(o,n);const e=new CustomEvent("filterable:change",{bubbles:!0,cancelable:!1,detail:{inputField:t}});o.dispatchEvent(e)}})),ft("filterable:change","details-menu .select-menu-list",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/behaviors/filterable.ts:128");const n=e.currentTarget,s=n.querySelector(".js-new-item-form");s&&function(e,n,s){const o=s.length>0&&!function(e,t){for(const n of e.querySelectorAll("[data-menu-button-text]")){if(n.textContent.toLowerCase().trim()===t.toLowerCase())return!0}return!1}(e,s);if(e.classList.toggle("is-showing-new-item-form",o),!o)return;t(n,".js-new-item-name").textContent=s;const r=n.querySelector(".js-new-item-value");(r instanceof HTMLInputElement||r instanceof HTMLButtonElement)&&(r.value=s)}(n,s,e.detail.inputField.value)})),pt("tab-container .select-menu-list .filterable-empty, details-menu .select-menu-list .filterable-empty",{add(e){p(e,".select-menu-list").classList.add("filterable-empty")},remove(e){p(e,".select-menu-list").classList.remove("filterable-empty")}}),ft("click",".js-flash-close",(function(e){const t=e.currentTarget.closest(".flash-messages");e.currentTarget.closest(".flash").remove(),t&&!t.querySelector(".flash")&&t.remove()}));const ur=new WeakMap;function dr(e){e instanceof CustomEvent&&to(`${e.detail} results found.`)}function mr(e,t){const n=e.currentTarget;if(n instanceof Element){for(const e of n.querySelectorAll("[data-show-on-error]"))e instanceof HTMLElement&&(e.hidden=!t);for(const e of n.querySelectorAll("[data-hide-on-error]"))e instanceof HTMLElement&&(e.hidden=t)}}function fr(e){mr(e,!1)}function pr(e){mr(e,!0)}document.addEventListener("focus",(function(e){const t=e.target;t instanceof Element&&!ur.get(t)&&(ht(t,"focusin:delay"),ur.set(t,!0))}),{capture:!0}),document.addEventListener("blur",(function(e){setTimeout((function(){const t=e.target;t instanceof Element&&t!==document.activeElement&&(ht(t,"focusout:delay"),ur.delete(t))}),200)}),{capture:!0}),pt("fuzzy-list",{constructor:FuzzyListElement,subscribe:e=>v(e,"fuzzy-list-sorted",dr)}),ft("filter-input-updated","filter-input",e=>{if(!(e instanceof CustomEvent))return;const{count:t,total:n}=e.detail;to(`Found ${t} out of ${n} ${T(n,"item")}`)}),ft("toggle","details",e=>{e.target instanceof HTMLElement&&function(e){const t=e.querySelector("filter-input");t instanceof W&&!e.hasAttribute("open")&&t.reset()}(e.target)},{capture:!0}),ft("tab-container-changed","tab-container",e=>{if(!(e instanceof CustomEvent))return;if(!(e.target instanceof HTMLElement))return;const{relatedTarget:t}=e.detail,n=e.target.querySelector("filter-input");n instanceof W&&n.setAttribute("aria-owns",t.id)},{capture:!0}),E(".js-immediate-updates",(async function(e,t){let n;try{n=(await t.json()).json.updateContent}catch(s){s.response.json&&(n=s.response.json.updateContent)}if(n)for(const o in n){const e=n[o],t=document.querySelector(o);t instanceof HTMLElement&&I(t,e)}})),pt("include-fragment, poll-include-fragment",{subscribe:e=>b(v(e,"error",pr),v(e,"loadstart",fr))}),ft("click","include-fragment button[data-retry-button]",({currentTarget:e})=>{const t=p(e,"include-fragment",window.IncludeFragmentElement),n=t.src;t.src="",t.src=n}),pt("[data-indeterminate]",{constructor:HTMLInputElement,initialize(e){e.indeterminate=!0}}),E(".js-notice-dismiss",(async function(e,t){await t.text(),p(e,".js-notice").remove()}));class PasswordStrengthElement extends HTMLElement{connectedCallback(){this.addEventListener("input",gr)}disconnectedCallback(){this.removeEventListener("input",gr)}}function gr(e){const n=e.currentTarget;if(!(n instanceof PasswordStrengthElement))return;const s=e.target;if(!(s instanceof HTMLInputElement))return;const o=function(e,t){const n={valid:!1,hasMinimumCharacterCount:e.length>=t.minimumCharacterCount,hasMinimumPassphraseLength:e.length>=t.passphraseLength,hasLowerCase:/[a-z]/.test(e),hasNumber:/\d/.test(e)};return n.valid=n.hasMinimumPassphraseLength||n.hasMinimumCharacterCount&&n.hasLowerCase&&n.hasNumber,n}(s.value,{minimumCharacterCount:Number(h(n,"minimum-character-count")),passphraseLength:Number(h(n,"passphrase-length"))});if(o.valid){s.setCustomValidity("");const e=n.querySelector("dl.form-group");e&&(e.classList.remove("errored"),e.classList.add("successed"))}else s.setCustomValidity(h(n,"invalid-message"));!function(e,n){const s=t(e,"[data-more-than-n-chars]"),o=t(e,"[data-min-chars]"),r=t(e,"[data-number-requirement]"),i=t(e,"[data-letter-requirement]"),a=h(e,"error-class").split(" ").filter(e=>e.length>0),c=h(e,"pass-class").split(" ").filter(e=>e.length>0);for(const t of[s,o,r,i])t.classList.remove(...a,...c);if(n.hasMinimumPassphraseLength)s.classList.add(...c);else if(n.valid)o.classList.add(...c),r.classList.add(...c),i.classList.add(...c);else{const e=n.hasMinimumCharacterCount?c:a,t=n.hasNumber?c:a,l=n.hasLowerCase?c:a;s.classList.add(...a),o.classList.add(...e),r.classList.add(...t),i.classList.add(...l)}}(n,o)}function hr(e){return null==e.getAttribute("data-pjax-preserve-scroll")&&0}function br(e){let t=e;for(;t;){const e=t.getAttribute("data-pjax");if(e&&"true"!==e)return document.querySelector(e);t=t.parentElement&&t.parentElement.closest("[data-pjax]")}return e.closest("[data-pjax-container]")}window.customElements.get("password-strength")||(window.PasswordStrengthElement=PasswordStrengthElement,window.customElements.define("password-strength",PasswordStrengthElement)),ft("click",".js-permalink-shortcut",(function(e){const t=e.currentTarget;try{A(null,"",t.href+window.location.hash)}catch(n){window.location.href=t.href+window.location.hash}e.preventDefault()})),ft("click","[data-pjax] a, a[data-pjax]",(function(e){if(!(e instanceof MouseEvent))throw new Error("invariant: app/assets/modules/github/behaviors/pjax.ts:48");const t=e.currentTarget;if(t instanceof HTMLAnchorElement){if(null!=t.getAttribute("data-skip-pjax"))return;if(null!=t.getAttribute("data-remote"))return;const n=br(t);n&&z(e,{container:n,scrollTo:hr(t)})}})),ft("submit","form[data-pjax]",(function(e){if(!(e instanceof Event))throw new Error("invariant: app/assets/modules/github/behaviors/pjax.ts:67");const t=e.target,n=br(t);n&&V(e,{container:n,scrollTo:hr(t)})})),ft("change","select[data-pjax]",(function(e){const t=e.currentTarget;if(!(t instanceof HTMLSelectElement))throw new Error("invariant: app/assets/modules/github/behaviors/pjax.ts:79");const n=br(t);n&&K({url:t.value,container:n})})),async function(){await Y;const e=document.querySelector(".js-pjax-loader-bar");if(!e)return;const t=e.firstElementChild;if(!(t instanceof HTMLElement))return;let n=0,s=null,o=null;function r(e){t instanceof HTMLElement&&(0===e&&(null==o&&(o=getComputedStyle(t).transition),t.style.transition="none"),n=e,t.style.width=`${n}%`,0===e&&(t.clientWidth,t.style.transition=o||""))}function i(){0===n&&(n=12),r(Math.min(n+3,95)),s=window.setTimeout(i,500)}document.addEventListener("pjax:start",(function(){r(0),e&&e.classList.add("is-loading"),s=window.setTimeout(i,0)})),document.addEventListener("pjax:end",(function(){s&&clearTimeout(s),r(100),e&&e.classList.remove("is-loading")}))}();let vr=null;function wr(e,t){return e.split("/",3).join("/")===t.split("/",3).join("/")}"getEntriesByName"in window.performance&&(document.addEventListener("pjax:start",(function(e){e instanceof CustomEvent&&e.detail&&e.detail.url&&(window.performance.mark("pjax_start"),vr=e.detail.url)})),document.addEventListener("pjax:end",(async function(){if(await g(),!window.performance.getEntriesByName("pjax_start").length)return;window.performance.mark("pjax_end"),window.performance.measure("last_pjax_request","pjax_start","pjax_end");const e=window.performance.getEntriesByName("last_pjax_request").pop(),t=e?e.duration:null;t&&(vr&&q({requestUrl:vr,pjaxDuration:Math.round(t)}),window.performance.clearMarks("pjax_start"),window.performance.clearMarks("pjax_end"),window.performance.clearMeasures("last_pjax_request"))}))),document.addEventListener("pjax:click",(function(e){if(window.onbeforeunload)return e.preventDefault()})),ft("pjax:click","#js-repo-pjax-container a[href]",(function(e){const t=e.currentTarget.pathname;wr(t,location.pathname)?function(e){const t=e.split("/")[3];return["commit","commits","community","issues","packages","projects","releases","security","tags","wiki"].includes(t)&&wr(e,location.pathname)}(t)&&e.preventDefault():e.preventDefault()})),ft("pjax:click",".js-comment-body",(function(e){const t=e.target;t instanceof HTMLAnchorElement&&"files"===t.pathname.split("/")[3]&&e.preventDefault()}));const jr={};function yr(e){const t=e.target;if(!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement))throw new Error("invariant: app/assets/modules/github/behaviors/quick-submit.ts:14");if((e.ctrlKey||e.metaKey)&&"Enter"===e.key){const n=t.form;if(!(n instanceof HTMLFormElement))throw new Error("invariant: app/assets/modules/github/behaviors/quick-submit.ts:17");const s=n.querySelector("input[type=submit], button[type=submit]");if(e.shiftKey){const e=n.querySelector(".js-quick-submit-alternative");(e instanceof HTMLInputElement||e instanceof HTMLButtonElement)&&!e.disabled&&L(n,e)}else(s instanceof HTMLInputElement||s instanceof HTMLButtonElement)&&s.disabled||L(n);e.preventDefault()}}function Er(e){if(null===e.parentNode||!(e.parentNode instanceof HTMLElement))throw new Error;for(var t=e.parentNode.children,n=0;n{await Y,jr[document.location.pathname]=Array.from(document.querySelectorAll("head [data-pjax-transient]"))})(),document.addEventListener("pjax:beforeReplace",(function(e){const t=e.detail.contents||[];for(let n=0;n/g,">")}var kr={INPUT:function(e){return e instanceof HTMLInputElement&&e.checked?"[x] ":"[ ] "},CODE:function(e){var t=e.textContent;return e.parentNode&&"PRE"===e.parentNode.nodeName?(e.textContent="```\n".concat(t.replace(/\n+$/,""),"\n```\n\n"),e):t.indexOf("`")>=0?"`` ".concat(t," ``"):"`".concat(t,"`")},STRONG:function(e){return"**".concat(e.textContent,"**")},EM:function(e){return"_".concat(e.textContent,"_")},DEL:function(e){return"~".concat(e.textContent,"~")},BLOCKQUOTE:function(e){var t=e.textContent.trim().replace(/^/gm,"> "),n=document.createElement("pre");return n.textContent="".concat(t,"\n\n"),n},A:function(e){var t=e.textContent,n=e.getAttribute("href");return/^https?:/.test(t)&&t===n?t:n?"[".concat(t,"](").concat(n,")"):t},IMG:function(e){var t=e.getAttribute("alt")||"",n=e.getAttribute("src");if(!n)throw new Error;var s=e.hasAttribute("width")?' width="'.concat(Tr(e.getAttribute("width")||""),'"'):"",o=e.hasAttribute("height")?' height="'.concat(Tr(e.getAttribute("height")||""),'"'):"";return s||o?''.concat(Tr(t),''):"![".concat(t,"](").concat(n,")")},LI:function(e){var t=e.parentNode;if(!t)throw new Error;var n,s,o,r="";if(s=(n=e).childNodes[0],o=n.childNodes[1],!(s&&n.childNodes.length<3)||("OL"!==s.nodeName&&"UL"!==s.nodeName||o&&(o.nodeType!==Node.TEXT_NODE||o.textContent.trim())))if("OL"===t.nodeName)if(Lr>0&&!t.previousSibling){var i=Er(e)+Lr+1;r="".concat(i,"\\. ")}else r="".concat(Er(e)+1,". ");else r="* ";var a=r.replace(/\S/g," "),c=e.textContent.trim().replace(/^/gm,a),l=document.createElement("pre");return l.textContent=c.replace(a,r),l},OL:function(e){var t=document.createElement("li");return t.appendChild(document.createElement("br")),e.append(t),e},H1:function(e){var t=parseInt(e.nodeName.slice(1));return e.prepend("".concat(Array(t+1).join("#")," ")),e},UL:function(e){return e}};kr.UL=kr.OL;for(var Mr=2;Mr<=6;++Mr)kr["H".concat(Mr)]=kr.H1;function Sr(e){for(var t=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT,(function(e){return e.nodeName in kr&&!function(e){return e instanceof HTMLAnchorElement&&1===e.childNodes.length&&e.childNodes[0]instanceof HTMLImageElement&&e.childNodes[0].src===e.href}(e)&&(function(e){return"IMG"===e.nodeName||null!=e.firstChild}(e)||function(e){return"INPUT"===e.nodeName&&e instanceof HTMLInputElement&&"checkbox"===e.type}(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP})),n=[],s=t.nextNode();s;)s instanceof HTMLElement&&n.push(s),s=t.nextNode();n.reverse();for(var o=0;o "),"\n\n");t.value&&(n="".concat(t.value,"\n\n").concat(n));t.value=n,t.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1})),t.focus(),t.selectionStart=t.value.length,t.scrollTop=t.scrollHeight}(o,r),!0)}function Nr(e,t,n){var s=e.trim();if(s){var o=t.startContainer;if(o&&(o.nodeType!==Node.ELEMENT_NODE&&(o=o.parentNode),o instanceof Element)){var r=Ir(o);if(r){var i=Ar.get(r);if(i){if(i.quoteMarkdown&&!Hr)try{var a=function(e,t){var n=e.startContainer;if(!(n&&n.parentNode&&n.parentNode instanceof HTMLElement))throw new Error("the range must start within an HTMLElement");var s=n.parentNode,o=e.cloneContents();if(t){var r=o.querySelector(t);r&&(o=document.createDocumentFragment()).appendChild(r)}Lr=0;var i=s.closest("li");if(s.closest("pre")){var a=document.createElement("pre");a.appendChild(o),(o=document.createDocumentFragment()).appendChild(a)}else if(i&&i.parentNode&&("OL"===i.parentNode.nodeName&&(Lr=Er(i)),!o.querySelector("li"))){var c=document.createElement("li");if(!i.parentNode)throw new Error;var l=document.createElement(i.parentNode.nodeName);c.appendChild(o),l.appendChild(c),(o=document.createDocumentFragment()).appendChild(l)}return o}(t,i.scopeSelector);r.dispatchEvent(new CustomEvent("quote-selection-markdown",{bubbles:!0,cancelable:!1,detail:{fragment:a,range:t,unwrap:n}})),Sr(a),s=function(e){var t=document.body;if(!t)return"";var n=document.createElement("div");n.appendChild(e),n.style.cssText="position:absolute;left:-9999px;",t.appendChild(n);var s="";try{var o=window.getSelection(),r=document.createRange();r.selectNodeContents(n),o.removeAllRanges(),o.addRange(r),s=o.toString(),o.removeAllRanges(),r.detach()}finally{t.removeChild(n)}return s}(a).replace(/^\n+/,"").replace(/\s+$/,"")}catch(c){setTimeout((function(){throw c}))}return{selectionText:s,container:r}}}}}}function Br(e){var t=e.nodeName.toLowerCase(),n=(e.getAttribute("type")||"").toLowerCase();return"select"===t||"textarea"===t||"input"===t&&"submit"!==n&&"reset"!==n||e.isContentEditable}function Pr(e){return"DIV"===e.nodeName&&e.classList.contains("highlight")}pt(".js-quote-selection-container",{subscribe:e=>Cr(e,{quoteMarkdown:e.hasAttribute("data-quote-markdown"),scopeSelector:e.getAttribute("data-quote-markdown")||"",copyMarkdown:!1})}),document.addEventListener("quote-selection-markdown",(function(e){const t=e.detail,{fragment:n,range:s,unwrap:o}=t,r=s.startContainer.parentElement,i=r&&r.closest("pre");if(i instanceof HTMLElement&&!o){const e=i.parentElement;if(e&&Pr(e)){const t=document.createElement("div");t.className=e.className,t.appendChild(n),n.appendChild(t)}}!function(e){const t=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT,(function(e){return e.nodeName in Rr&&function(e){return"IMG"===e.nodeName||null!=e.firstChild}(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP})),n=[];let s=t.nextNode();for(;s;)s instanceof HTMLElement&&n.push(s),s=t.nextNode();n.reverse();for(const o of n)o.replaceWith(Rr[o.nodeName](o))}(n)}));const Rr={PRE(e){const t=e.parentElement;if(t&&Pr(t)){const n=t.className.match(/highlight-source-(\S+)/),s=n?n[1]:"",o=(e.textContent||"").replace(/\n+$/,"");e.textContent=`\`\`\`${s}\n${o}\n\`\`\``,e.append("\n\n")}return e},A(e){const t=e.textContent||"";return e.classList.contains("user-mention")||e.classList.contains("team-mention")?t:e.classList.contains("issue-link")&&/^#\d+$/.test(t)?t:e},IMG(e){const t=e.getAttribute("alt");return t&&e.classList.contains("emoji")?t:e},DIV(e){if(e.classList.contains("js-suggested-changes-blob"))e.remove();else if(e.classList.contains("blob-wrapper-embedded")){const n=e.parentElement;if(!n)throw new Error("invariant: app/assets/modules/github/behaviors/quote-selection.ts:77");const s=t(n,"a[href]",HTMLAnchorElement),o=document.createElement("p");o.textContent=s.href,n.replaceWith(o)}return e}};let Fr,Or;function Ur(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],s=!0,o=!1,r=void 0;try{for(var i,a=e[Symbol.iterator]();!(s=(i=a.next()).done)&&(n.push(i.value),!t||n.length!==t);s=!0);}catch(c){o=!0,r=c}finally{try{s||null==a.return||a.return()}finally{if(o)throw r}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}ft("click",".js-comment-quote-reply",(function({currentTarget:e}){const n=p(e,".js-comment"),s=t(n,".js-comment-body");if(Or&&"Range"===Or.type&&s.contains(Or.anchorNode))Dr(Or.text,Or.range);else{const e=window.getSelection();e.removeAllRanges(),e.selectAllChildren(s),Dr(e.toString(),e.getRangeAt(0))}})),document.addEventListener("selectionchange",gt((function(){const e=window.getSelection();let t;try{t=e.getRangeAt(0)}catch(n){return void(Fr=null)}Fr={type:e.type,anchorNode:e.anchorNode,text:e.toString(),range:t}}),100)),document.addEventListener("toggle",(function(e){const t=e.target;if(!(t instanceof Element&&t.hasAttribute("open")))return;Or=Fr;const n=t.querySelector(".js-comment-quote-reply.d-none");if(!n)return;const s=Ir(t);s&&(s.querySelector(".js-inline-comment-form-container")||_r(s))&&n.classList.remove("d-none")}),{capture:!0}),pt(".has-removed-contents",(function(){let e;return{add(t){e=Array.from(t.childNodes);for(const s of e)t.removeChild(s);const n=t.closest("form");n&&ht(n,"change")},remove(t){for(const s of e)t.appendChild(s);const n=t.closest("form");n&&ht(n,"change")}}})),E("form[data-replace-remote-form]",(async function(e,t){e.classList.remove("is-error"),e.classList.add("is-loading");try{const n=await t.html();(e.closest("[data-replace-remote-form-target]")||e).replaceWith(n.html)}catch(n){e.classList.remove("is-loading"),e.classList.add("is-error")}}));var Wr=null;function zr(e){return e.id&&e.value!==e.defaultValue&&e.form!==Wr}function Vr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.selector,s=void 0===n?".js-session-resumable":n,o=t.keyPrefix,r=void 0===o?"session-resume:":o,i="".concat(r).concat(e),a=[],c=!0,l=!1,u=void 0;try{for(var d,m=document.querySelectorAll(s)[Symbol.iterator]();!(c=(d=m.next()).done);c=!0){var f=d.value;(f instanceof HTMLInputElement||f instanceof HTMLTextAreaElement)&&a.push(f)}}catch(g){l=!0,u=g}finally{try{c||null==m.return||m.return()}finally{if(l)throw u}}var p=a.filter((function(e){return zr(e)})).map((function(e){return[e.id,e.value]}));if(p.length)try{sessionStorage.setItem(i,JSON.stringify(p))}catch(h){}}function Kr(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=n.keyPrefix,o=void 0===s?"session-resume:":s,r="".concat(o).concat(e);try{t=sessionStorage.getItem(r)}catch(b){}if(t){try{sessionStorage.removeItem(r)}catch(b){}var i=[],a=!0,c=!1,l=void 0;try{for(var u,d=JSON.parse(t)[Symbol.iterator]();!(a=(u=d.next()).done);a=!0){var m=Ur(u.value,2),f=m[0],p=m[1],g=new CustomEvent("session:resume",{bubbles:!0,cancelable:!0,detail:{targetId:f,targetValue:p}});if(document.dispatchEvent(g)){var h=document.getElementById(f);h&&(h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement)&&h.value===h.defaultValue&&(h.value=p,i.push(h))}}}catch(v){c=!0,l=v}finally{try{a||null==d.return||d.return()}finally{if(c)throw l}}setTimeout((function(){for(var e=0,t=i;e{const t=e.target;if(!(t instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/behaviors/tag-input.ts:59");t.matches(".js-remove")?this.removeTag(e):this.onFocus()}),this.input.addEventListener("focus",this.onFocus.bind(this)),this.input.addEventListener("blur",this.onBlur.bind(this)),this.input.addEventListener("keydown",this.onKeyDown.bind(this)),this.form.addEventListener("submit",this.onSubmit.bind(this)),this.autoComplete.addEventListener("auto-complete-change",()=>{this.selectTag(this.autoComplete.value)})}onFocus(){this.inputWrap.classList.add("focus"),this.input!==document.activeElement&&this.input.focus()}onBlur(){this.inputWrap.classList.remove("focus"),this.autoComplete.open||this.onSubmit()}onSubmit(){this.input.value&&(this.selectTag(this.input.value),this.autoComplete.open=!1)}onKeyDown(e){switch(J(e)){case"Backspace":this.onBackspace();break;case"Enter":case"Tab":this.taggifyValueWhenSuggesterHidden(e);break;case",":case" ":this.taggifyValue(e)}}taggifyValueWhenSuggesterHidden(e){!this.autoComplete.open&&this.input.value&&(e.preventDefault(),this.selectTag(this.input.value))}taggifyValue(e){this.input.value&&(e.preventDefault(),this.selectTag(this.input.value),this.autoComplete.open=!1)}selectTag(e){const t=this.normalizeTag(e),n=this.selectedTags();t&&n.indexOf(t)<0&&(this.selections.appendChild(this.templateTag(t)),this.input.value="",ht(this.form,"tags:changed"))}removeTag(e){const t=e.target;if(!(t instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/behaviors/tag-input.ts:141");e.preventDefault(),p(t,".js-tag-input-tag").remove(),ht(this.form,"tags:changed")}templateTag(e){const n=this.tagTemplate.cloneNode(!0);return t(n,"input",HTMLInputElement).value=e,t(n,".js-placeholder-tag-name").replaceWith(e),n.classList.remove("d-none","js-template"),n}normalizeTag(e){return e.toLowerCase().trim().replace(/[\s,']+/g,"-")}onBackspace(){if(!this.input.value){const e=this.selections.querySelector("li:last-child .js-remove");e instanceof HTMLElement&&e.click()}}selectedTags(){const e=n(this.selections,"input",HTMLInputElement);return Array.from(e).map(e=>e.value).filter(e=>e.length>0)}}async function Xr(e){const t=e.currentTarget;if(!(t instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/behaviors/team-members.ts:8");if(function(e){return!!e.getAttribute("data-hovercard-url")&&!!e.closest("[data-team-hovercards-enabled]")}(t))return void t.classList.remove("tooltipped");const n=t.getAttribute("data-url");if(!n)return;const s=F(n),o=h(t,"data-id"),r=document.querySelectorAll(`.js-team-mention[data-id='${o}']`);for(const a of r)a.removeAttribute("data-url");try{const e=await s;0===e.total?e.members.push("This team has no members"):e.total>e.members.length&&e.members.push(`${e.total-e.members.length} more`),Gr(r,function(e){if("ListFormat"in Intl){return(new Intl.ListFormat).format(e)}if(0===e.length)return"";if(1===e.length)return e[0];if(2===e.length)return e.join(" and ");{const t=e[e.length-1];return e.slice(0,-1).concat(`and ${t}`).join(", ")}}(e.members))}catch(i){const e=i.response?i.response.status:500;Gr(r,h(t,404===e?"data-permission-text":"data-error-text"))}}function Gr(e,t){for(const n of e)n instanceof HTMLElement&&(n.setAttribute("aria-label",t),n.classList.add("tooltipped","tooltipped-s","tooltipped-multiline"))}pt(".js-tag-input-container",{constructor:HTMLElement,initialize(e){new Jr({container:e,inputWrap:t(e,".js-tag-input-wrapper"),input:t(e,'input[type="text"], input:not([type])',HTMLInputElement),selections:t(e,".js-tag-input-selected-tags"),tagTemplate:t(e,".js-template"),autoComplete:t(e,"auto-complete",S)}).setup()}}),pt(".js-team-mention",(function(e){e.addEventListener("mouseenter",Xr)}));let Qr=0;const Zr="IntersectionObserver"in window?new IntersectionObserver((function(e){for(const t of e)t.isIntersecting&&ei(t.target)}),{root:null,rootMargin:"0px",threshold:1}):{observe(e){},unobserve(e){}};function ei(e){e.classList.remove("js-unread-item","unread-item")}pt(".js-unread-item",{constructor:HTMLElement,add(e){Qr++,Zr.observe(e)},remove(e){Qr--,Zr.unobserve(e),0===Qr&&function(){if(!document.hasFocus())return;const e=document.querySelector(".js-timeline-marker-form");e&&e instanceof HTMLFormElement&&L(e)}()}}),ft("socket:message",".js-discussion",(function(e){if(e.currentTarget===e.target)for(const t of document.querySelectorAll(".js-unread-item"))ei(t)}));let ti=0;const ni=/^\(\d+\)\s+/;function si(){const e=ti?`(${ti}) `:"";document.title.match(ni)?document.title=document.title.replace(ni,e):document.title=`${e}${document.title}`}function oi(){if(document.querySelector(":target"))return;const e=X(location.hash).toLowerCase(),t=G(document,`user-content-${e}`);t&&t.scrollIntoView()}function ri(e){if(!(e.target instanceof Element))throw new Error("invariant: app/assets/modules/github/behaviors/will-transition-once.ts:21");e.target.classList.remove("will-transition-once")}pt(".js-unread-item",{add(){ti++,si()},remove(){ti--,si()}}),window.addEventListener("hashchange",oi),document.addEventListener("pjax:success",oi),async function(){await Y,oi()}(),ft("click","a[href]",(function(e){const{currentTarget:t}=e;t instanceof HTMLAnchorElement&&t.href===location.href&&location.hash.length>1&&setTimeout((function(){e.defaultPrevented||oi()}))})),pt(".will-transition-once",{constructor:HTMLElement,subscribe:e=>v(e,"transitionend",ri)});const ii=new H;async function ai(e){const t=e.getAttribute("data-item-name")||"items",s=e.value,o=parseInt(e.getAttribute("data-item-minimum"))||0,r=parseInt(e.getAttribute("data-item-maximum"))||300,i=parseInt(e.getAttribute("data-item-count"))||0,a=Math.max(o,parseInt(s)||0),c=a>r,l=document.querySelector(".js-downgrade-button");l instanceof HTMLButtonElement&&(l.disabled=a===i);const u=new URL(h(e,"data-url"),window.location.origin),d=new URLSearchParams(u.search.slice(1));d.append(t,a.toString()),document.querySelector(".js-transform-user")&&d.append("transform_user","1"),u.search=d.toString();const m=await ii.push(F(u.toString())),f=document.querySelector(".js-contact-us");f&&f.classList.toggle("d-none",!c);const p=document.querySelector(".js-payment-summary");p&&p.classList.toggle("d-none",c);const g=document.querySelector(".js-submit-billing");g instanceof HTMLElement&&(g.hidden=c);const b=document.querySelector(".js-billing-section");b&&b.classList.toggle("has-removed-contents",m.free||m.is_enterprise_cloud_trial);const v=document.querySelector(".js-upgrade-info");v&&v.classList.toggle("d-none",a<=0);const w=document.querySelector(".js-downgrade-info");w&&w.classList.toggle("d-none",a>=0);const j=document.querySelector(".js-extra-seats-line-item");j&&j.classList.toggle("d-none",m.no_additional_seats),document.querySelector(".js-seat-field")&&function(e){for(const t of n(document,".js-seat-field",HTMLInputElement))t.value=e}(s);const y=document.querySelector(".js-minimum-seats-disclaimer");y&&(y.classList.toggle("tooltipped",5===m.seats),y.classList.toggle("tooltipped-nw",5===m.seats));const E=m.selectors;for(const n in E)for(const e of document.querySelectorAll(n))e.innerHTML=E[n];A(Z(),"",m.url)}ft("click",".js-org-signup-duration-change",e=>{if(e.preventDefault(),!(e instanceof MouseEvent))throw new Error("invariant: app/assets/modules/github/billing/addons.ts:14");const t=e.currentTarget,s=h(t,"data-plan-duration");!function(e){const t="year"===e?"month":"year";for(const s of n(document,".js-plan-duration-text"))s.innerHTML=e;for(const s of n(document,".unstyled-available-plan-duration-adjective"))s.innerHTML=`${e}ly`;for(const s of n(document,".js-org-signup-duration-change"))s.setAttribute("data-plan-duration",t)}(s),function(e){for(const t of n(document,".js-seat-field",HTMLInputElement)){const n=new URL(h(t,"data-url"),window.location.origin),s=new URLSearchParams(n.search.slice(1));s.delete("plan_duration"),s.append("plan_duration",e),n.search=s.toString(),t.setAttribute("data-url",n.toString())}}(s);for(const o of n(document,".js-seat-field",HTMLInputElement))ai(o);!function(){for(const e of n(document,".js-unit-price"))e.hidden=!e.hidden}()}),pt(".js-addon-purchase-field",{constructor:HTMLInputElement,add(e){Q(e)&&ai(e),O(e,(function(){ai(e)}))}}),pt(".js-addon-downgrade-field",{constructor:HTMLInputElement,add(e){Q(e)&&ai(e),e.addEventListener("change",(function(){ai(e)}))}}),ft("details-menu-selected",".js-organization-container",(function(e){const t=document.querySelector(".js-addon-purchase-field"),n=e.target.querySelector("input:checked");if(t instanceof HTMLInputElement&&n instanceof HTMLInputElement){const e=n.getAttribute("data-upgrade-url");e&&(t.setAttribute("data-url",e),t.value="0",ai(t))}}),{capture:!0}),pt(".js-repo-health",(function(e){const n=p(e,"form",HTMLFormElement),s=t(n,".js-comment-field",HTMLTextAreaElement),o=t(n,".js-repo-name",HTMLInputElement);function r(){!async function(e,n,s){const o=t(document,".js-repo-health-check",HTMLFormElement);t(o,".js-repo-health-name",HTMLInputElement).value=s,e.classList.remove("d-none"),e.classList.add("is-loading"),n.setCustomValidity("checking"),ht(n,"change");const r=await $(document,o.action,{method:"POST",body:new FormData(o)}),i=t(e,".js-repo-health-results");i.innerHTML="",i.appendChild(r),e.classList.remove("is-loading"),n.setCustomValidity(""),ht(n,"change")}(e,s,o.value)}"hidden"===o.type?s.addEventListener("focus",r):o.addEventListener("change",r)})),E(".js-audit-log-export-form",(async function(e,n){const s=t(document,".js-audit-log-exporting"),o=t(document,".js-audit-log-export-menu");function r(e){o.hidden=e,s.hidden=!e}let i;r(!0);try{i=await n.json()}catch(c){return r(!1),void ee()}const a=i.json;try{await te(a.job_url)}catch(c){return r(!1),void ee()}r(!1),window.location=a.export_url}));const ci=new H;function li(e){const t=document.querySelector(".js-membership-tabs");if(t){const n=e.querySelectorAll(".js-bulk-actions-toggle:checked");t.classList.toggle("d-none",n.length>0)}}function ui(){return t(document,".js-business-saml-provider-settings-form",HTMLFormElement)}function di(){return ui().querySelector(".js-business-saml-form-inputs")}function mi(e){e&&e.classList.remove("d-none")}function fi(){return"1"===t(document,".js-business-saml-currently-enabled",HTMLInputElement).value&&!t(document,".js-business-enable-saml",HTMLInputElement).checked}function pi(){return t(document,".is-submit-button-value",HTMLInputElement)}function gi(){ui().submit()}function hi(){const e=document.querySelector(".js-business-enable-saml");e&&e instanceof HTMLInputElement&&(e.checked=!0,mi(di()))}function bi(){const e="0"===t(document,".js-business-two-factor-currently-enabled",HTMLInputElement).value;return t(document,".js-business-enable-two-factor",HTMLInputElement).checked&&e}if(ft("change",".js-bulk-actions-toggle",(function(e){const t=e.currentTarget,n=p(t,".js-bulk-actions-container");ht(n,"bulk-actions:update")})),ft("bulk-actions:update",".js-bulk-actions-container",gt((async function(e){const s=e.target;if(!(s instanceof HTMLElement))return;const o=t(s,".js-bulk-actions"),r=!!s.querySelector(".js-bulk-actions-toggle:checked"),i=await ci.push(N(function(e){const t=new URL(h(e,"data-bulk-actions-url"),window.location.origin),s=new URLSearchParams(t.search.slice(1)),o=e.getAttribute("data-bulk-actions-parameter"),r=n(e,".js-bulk-actions-toggle:checked",HTMLInputElement);if(o){const e=r.map(e=>h(p(e,".js-bulk-actions-item"),"data-bulk-actions-id")).sort();for(const t of e)s.append(`${o}[]`,t)}else for(const n of r.sort((e,t)=>e.value>t.value?1:-1))s.append(n.name,n.value);return t.search=s.toString(),t.toString()}(s)));r?(li(s),o.innerHTML=i):(o.innerHTML=i,li(s)),ht(s,"bulk-actions:updated")}),100)),ft("click",".js-preview-sign-in-message",(function(e){const n=t(document,"#custom_messages_sign_in_message",HTMLTextAreaElement).value;t(document,"#sign_in_message",HTMLInputElement).value=n;const s=e.currentTarget;if(!(s instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/businesses.ts:11");if(!s.form)throw new Error("invariant: app/assets/modules/github/businesses.ts:12");s.form.submit()})),ft("click",".js-preview-sign-out-message",(function(e){const n=t(document,"#custom_messages_sign_out_message",HTMLTextAreaElement).value;t(document,"#sign_out_message",HTMLInputElement).value=n;const s=e.currentTarget;if(!(s instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/businesses.ts:19");if(!s.form)throw new Error("invariant: app/assets/modules/github/businesses.ts:20");s.form.submit()})),ft("click",".js-preview-auth-provider-name",(function(e){const n=t(document,"#custom_messages_auth_provider_name",HTMLInputElement).value;t(document,"#auth_provider_name",HTMLInputElement).value=n;const s=e.currentTarget;if(!(s instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/businesses.ts:27");if(!s.form)throw new Error("invariant: app/assets/modules/github/businesses.ts:28");L(s.form)})),ft("click",".js-preview-suspended-message",(function(e){const n=t(document,"#custom_messages_suspended_message",HTMLTextAreaElement).value;t(document,"#suspended_message",HTMLInputElement).value=n;const s=e.currentTarget;if(!(s instanceof HTMLButtonElement&&s.form))throw new Error("invariant: app/assets/modules/github/businesses.ts:35");s.form.submit()})),ft("click",".js-admin-settings-policy-input",(function({currentTarget:e}){if(!(e instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/businesses.ts:39");const n=e.form;if(!(n instanceof HTMLFormElement))throw new Error("invariant: app/assets/modules/github/businesses.ts:41");const s=t(n,'[aria-checked="true"]',HTMLButtonElement);L(n,s)})),ft("click",".js-business-enable-saml",(function(e){if(!(e.currentTarget instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/businesses.ts:101");var t;e.currentTarget.checked?mi(di()):(t=di())&&t.classList.add("d-none")})),ft("click",".js-business-saml-submit",(function(e){e.preventDefault();const t=e.currentTarget;if(!(t instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/businesses.ts:119");L(ui(),t)})),ft("submit",".js-business-saml-provider-settings-form",(function(e){e.preventDefault(),"test_settings"===pi().name?gi():"save_settings"===pi().name&&(fi()?async function(){(await D({content:t(document,"#disable-saml-confirmation",HTMLTemplateElement).content.cloneNode(!0)})).addEventListener("dialog:remove",hi)}():gi())})),ft("click",".js-enable-enable-saml-provider-button",(function(){const e=t(document,".js-enable-saml-provider-button",HTMLButtonElement),n=t(document,".js-enable-saml-provider-instruction",HTMLElement);e.disabled=!1,n.hidden=!0})),ft("click",".js-suggested-org",(function(e){if(!(e.currentTarget instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/businesses.ts:163");if("true"===e.currentTarget.getAttribute("aria-disabled"))return;const n=p(e.currentTarget,"form"),s=t(e.currentTarget,".js-suggested-org-details-source");t(n,".js-suggested-org-details-target").innerHTML=s.innerHTML})),ft("change",".js-invite-business-org-auto-complete",(function(e){const n=e.currentTarget;if(!(n instanceof S))throw new Error("invariant: app/assets/modules/github/businesses.ts:175");const s=p(n,"form"),o=t(s,".js-suggested-org-details-target");n.value||(o.innerHTML="")})),ft("click",".js-business-two-factor-submit-button",(function(e){bi()||e.preventDefault()})),ft("change",".js-repo-types-allowed-radio",()=>{const e=n(document,".js-repo-type-creation-checkbox",HTMLInputElement),t=n(document,".js-repo-type-creation-label",HTMLElement);for(const n of e)n.disabled=!1;for(const n of t)n.classList.remove("text-gray-light")}),ft("change",".js-repo-types-disallowed-radio",()=>{const e=n(document,".js-repo-type-creation-checkbox",HTMLInputElement),t=n(document,".js-repo-type-creation-label",HTMLElement);for(const n of e)n.disabled=!0,n.checked=!1;for(const n of t)n.classList.add("text-gray-light")}),ft("change",".js-provisioning-enabled-checkbox",()=>{if("0"===t(document,'[name="business_saml_provider_provisioning_enabled_previously"]',HTMLInputElement).value)return;const e=t(document,".js-provisioning-enabled-checkbox",HTMLInputElement),s=n(document,".js-disable-when-user-provisioning-disabled-checkbox",HTMLInputElement);if(e.checked)for(const n of s){const e=t(document,`[name='${n.id}_previously']`,HTMLInputElement);p(n,".js-deprovisioning-checkbox",HTMLElement).classList.remove("checkbox-disabled"),n.removeAttribute("disabled"),"1"===e.value?n.checked=!0:n.removeAttribute("checked")}else for(const t of s)t.setAttribute("disabled","disabled"),t.checked=!1,p(t,".js-deprovisioning-checkbox",HTMLElement).classList.add("checkbox-disabled")}),top!==window){alert("For security reasons, framing is not allowed.");try{top.location.replace(document.location.href)}catch(oh){}}let vi,wi=!1;function ji(){vi=document.activeElement,document.body&&document.body.classList.toggle("intent-mouse",wi)}function yi(e){return e.hasAttribute("data-maxlength")?parseInt(e.getAttribute("data-maxlength")||""):e.maxLength}function Ei(e){const n=yi(e);!function(e,n,s){const o=s.closest(".js-characters-remaining-container");if(!o)return;const r=t(o,".js-characters-remaining"),i=String(r.getAttribute("data-suffix")),a=n-ne(e);a<=20?(r.textContent=`${a} ${i}`,r.classList.toggle("text-red",a<=5),r.hidden=!1):r.hidden=!0}(e.value,n,e)}function Li(e){const n=e.querySelectorAll(".js-characters-remaining-container");for(const s of n){Ei(t(s,".js-characters-remaining-field",HTMLInputElement))}}document.addEventListener("mousedown",(function(){wi=!0,vi===document.activeElement&&ji()}),{capture:!0}),document.addEventListener("keydown",(function(){wi=!1}),{capture:!0}),document.addEventListener("focusin",ji,{capture:!0}),y(".js-characters-remaining-field",(function(e){function t(){(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&Ei(e)}t(),e.addEventListener("input",t),e.addEventListener("blur",()=>{e.removeEventListener("input",t)},{once:!0})}));const Ti={}.hasOwnProperty,ki={host:"collector.githubapp.com",type:"page_view",dimensions:{},measures:{},context:{},actor:{},image:new Image,performance:{},expectedPerformanceTimingKeys:["connectEnd","connectStart","domComplete","domContentLoadedEventEnd","domContentLoadedEventStart","domInteractive","domLoading","domainLookupEnd","domainLookupStart","fetchStart","loadEventEnd","loadEventStart","navigationStart","redirectEnd","redirectStart","requestStart","responseEnd","responseStart","secureConnectionStart","unloadEventEnd","unloadEventStart"],recordPageView(){return this.applyMetaTags(),null!=this.app&&(null==this.host?(console&&console.warn&&console.warn("Host not set, you are doing something wrong"),!1):(this.image.src=this._src(),this._clearPerformance(),!0))},setHost(e){this.host=e},setApp(e){this.app=e},setDimensions(e){this.dimensions=e},addDimensions(e){let t;null==this.dimensions&&(this.dimensions={});const n=[];for(t in e){if(!Ti.call(e,t))continue;const s=e[t];n.push(this.dimensions[t]=s)}return n},setMeasures(e){this.measures=e},addMeasures(e){let t;null==this.measures&&(this.measures={});const n=[];for(t in e){if(!Ti.call(e,t))continue;const s=e[t];n.push(this.measures[t]=s)}return n},setContext(e){this.context=e},addContext(e){let t;null==this.context&&(this.context={});const n=[];for(t in e){if(!Ti.call(e,t))continue;const s=e[t];n.push(this.context[t]=s)}return n},setActor(e){this.actor=e},push(e){return this.applyCall(e)},enablePerformance(){this.performance=this._performanceTiming()},_recordSrc(e,t,n,s){return`//${this.host}/${this.app}/${e}?${this._queryString(t,n,s)}`},_src(){return`//${this.host}/${this.app}/${this.type}?${this._queryString()}`},_queryString(e,t,n){let s,o;const r=this._params(),i=[];for(s in r)o=r[s],i.push(`dimensions[${s}]=${o}`);return i.push(this._encodeObject("dimensions",Object.assign({},this.dimensions,e))),i.push(this._encodeObject("measures",Object.assign({},this.measures,t))),null!=this.performance&&i.push(this._encodeObject("measures",{performance_timing:String(this.performance)})),i.push(this._encodeObject("context",Object.assign({},this.context,n))),i.push(this._actor()),i.push(this._encodeObject("dimensions",{cid:this._clientId()})),i.join("&")},_clearPerformance(){this.performance=null},_performanceTiming(){if(null==window.performance||null==window.performance.timing||null==window.performance.timing.navigationStart)return null;const e=this.expectedPerformanceTimingKeys.reduce((e,t)=>{const n=window.performance.timing[t];return e[t]="number"==typeof n?n:0,e},{}),t=[],n=e.navigationStart;for(const s in e){const o=e[s],r=0===o?null:o-n;t.push(r)}return`1-${t.join("-")}`},_params(){return{page:this._encode(this._page()),title:this._encode(this._title()),referrer:this._encode(this._referrer()),user_agent:this._encode(this._agent()),screen_resolution:this._encode(this._screenResolution()),pixel_ratio:this._encode(this._pixelRatio()),browser_resolution:this._encode(this._browserResolution()),tz_seconds:this._encode(this._tzSeconds()),timestamp:(new Date).getTime()}},_page(){try{const e=document.querySelector("meta[name=octolytics-location]");return e instanceof HTMLMetaElement?document.location.origin+e.content:document.location.href}catch(e){}},_title(){try{return document.title}catch(e){}},_referrer(){let e="";try{e=window.top.document.referrer}catch(t){if(window.parent)try{e=window.parent.document.referrer}catch(t){}}return""===e&&(e=document.referrer),e},_agent(){try{return navigator.userAgent}catch(e){}},_screenResolution(){try{return`${screen.width}x${screen.height}`}catch(e){return"unknown"}},_pixelRatio:()=>window.devicePixelRatio,_browserResolution(){let e=0,t=0;try{return"number"==typeof window.innerWidth?(t=window.innerWidth,e=window.innerHeight):null!=document.documentElement&&null!=document.documentElement.clientWidth?(t=document.documentElement.clientWidth,e=document.documentElement.clientHeight):null!=document.body&&null!=document.body.clientWidth&&(t=document.body.clientWidth,e=document.body.clientHeight),`${t}x${e}`}catch(n){return"unknown"}},_tzSeconds(){try{return-60*(new Date).getTimezoneOffset()}catch(e){return""}},_encodeObject(e,t){const n=[];if(Array.isArray(t))for(const s of t)n.push(this._encodeObject(`${e}[]`,s));else if("object"==typeof t)for(const s in t)n.push(this._encodeObject(`${e}[${s}]`,t[s]));else n.push(`${e}=${this._encode(t)}`);return n.join("&")},_actor(){let e,t,n;const s=[],o=this.actor;for(t in o){const r=o[t],i=`dimensions[actor_${t}]`;if(Array.isArray(r))for(e=0,n=r.length;enull!=e?window.encodeURIComponent(e):"",applyQueuedCalls(e){const t=[];for(const n of e)t.push(this.applyCall(n));return t},applyCall(e){const t=e[0],n=e.slice(1);return"function"==typeof this[t]?this[t](...n):console&&console.warn&&console.warn(`${t} is not a valid method`)},applyMetaTags(){const e=this.loadMetaTags();return e.host&&this.setHost(e.host),e.app&&this.setApp(e.app),this._objectIsEmpty(e.actor)||this.setActor(e.actor),this.addDimensions(e.dimensions),this.addMeasures(e.measures),this.addContext(e.context)},loadMetaTags(){let e,t;const n={dimensions:{},measures:{},context:{},actor:{}},s=document.getElementsByTagName("meta");for(e=0,t=s.length;et.length?1:e.localeCompare(t)}function xi(e,t){const n=e.getBoundingClientRect();return(t.getBoundingClientRect().width-n.width)/2}function Hi(e,t){const n=e.querySelector("svg");if(!n)return;const s=n.querySelector(".js-highlight-blob"),o=Math.floor(e.clientWidth),r=Math.max(o,250),i=r,a=n.querySelector(".js-highlight-label-top"),c=n.querySelector(".js-highlight-label-bottom"),l=n.querySelector(".js-highlight-label-right"),u=n.querySelector(".js-highlight-label-left"),d=n.querySelector(".js-highlight-percent-top"),m=n.querySelector(".js-highlight-percent-bottom"),f=n.querySelector(".js-highlight-percent-right"),p=n.querySelector(".js-highlight-percent-left"),g=n.querySelector(".js-highlight-x-axis"),h=n.querySelector(".js-highlight-y-axis"),b=n.querySelector(".js-highlight-top-ellipse"),v=n.querySelector(".js-highlight-right-ellipse"),w=n.querySelector(".js-highlight-bottom-ellipse"),j=n.querySelector(".js-highlight-left-ellipse"),y=e.querySelector(".js-activity-overview-graph-spinner"),E=n.querySelector("g");if(!E)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:59");if(!s)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:60");if(!a)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:61");if(!c)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:62");if(!l)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:63");if(!u)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:64");if(!d)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:65");if(!m)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:66");if(!f)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:67");if(!p)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:68");if(!g)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:69");if(!h)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:70");if(!b)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:71");if(!v)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:72");if(!w)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:73");if(!j)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:74");if(!y)throw new Error("invariant: app/assets/modules/github/contributions-spider-graph.ts:75");E.removeAttribute("transform"),n.classList.remove("d-none"),n.classList.add("d-block"),y.classList.remove("d-block"),y.classList.add("d-none"),a.innerHTML="",l.innerHTML="",c.innerHTML="",u.innerHTML="",d.innerHTML=" ",f.innerHTML=" ",m.innerHTML=" ",p.innerHTML=" ";const L=Object.keys(t.percentages).sort(Ai),[T,k]=L.slice(0,2).sort(),[M,S]=L.slice(2,4).sort(),A=t.percentages[M],x=t.percentages[k],H=t.percentages[S],C=t.percentages[T];let q=null;const I=(e,n)=>{const s=t.percentages[e];if(s>0)return q=n,`${s}%`},_=I(M,d);_&&(d.textContent=_);const $=I(k,f);$&&(f.textContent=$);const D=I(S,m);D&&(m.textContent=D);const N=I(T,p);N&&(p.textContent=N);const B=r/2,P=r/2;a.appendChild(document.createTextNode(M)),a.setAttribute("dx",B.toString()),c.appendChild(document.createTextNode(S)),c.setAttribute("dx",P.toString()),d.setAttribute("dx",B.toString()),m.setAttribute("dx",P.toString());const R=a.getBoundingClientRect().height;let F=0;q&&(F=q.getBoundingClientRect().height);let O=i/2+R/4,U=i/2+R/4;C>0&&(O=O+F/2+2.5),x>0&&(U=U+F/2+2.5),u.appendChild(document.createTextNode(T)),u.setAttribute("dy",O.toString()),l.appendChild(document.createTextNode(k)),l.setAttribute("dy",U.toString());const W=O-R,z=U-R;p.setAttribute("dy",W.toString()),f.setAttribute("dy",z.toString());let V=A/100,K=H/100,Y=C/100,J=x/100;const X=Math.max(V,K,Y,J),G=e=>1*e/X+0;V=G(V),K=G(K),Y=G(Y),J=G(J);const Q=function(e){let t=0;for(const n of e){const e=n.getBoundingClientRect();e.width>t&&(t=e.width)}return t}([u,l,a,c])+10,Z=Math.max(Q,R),ee=r/2,te=i/2,ne=ee,se=Z,oe=ee,re=i-Z,ie=Z,ae=te,ce=r-Z,le=te,ue=ee-ie,de=te-se;let me=se+(1-V)*de,fe=Math.max(re-(1-K)*de,te),pe=ie+(1-Y)*ue,ge=ce-(1-J)*ue;g.setAttribute("x1",ie.toString()),g.setAttribute("y1",te.toString()),g.setAttribute("x2",ce.toString()),g.setAttribute("y2",te.toString()),h.setAttribute("x1",ee.toString()),h.setAttribute("y1",se.toString()),h.setAttribute("x2",ee.toString()),h.setAttribute("y2",re.toString()),me+4te&&(fe-=4),pe+4ee&&(ge-=4);const he=se-10,be=ce+10;let ve=re+10+8;H>0&&(ve+=F);const we=ie-12;a.setAttribute("dy",he.toString()),l.setAttribute("dx",be.toString()),c.setAttribute("dy",ve.toString()),u.setAttribute("dx",we.toString());const je=we-xi(p,u),ye=be+xi(f,l);p.setAttribute("dx",je.toString()),f.setAttribute("dx",ye.toString());const Ee=he-R,Le=ve-R;d.setAttribute("dy",Ee.toString()),m.setAttribute("dy",Le.toString());0===A?b.classList.add("d-none"):(b.setAttribute("cx",ne.toString()),b.setAttribute("cy",(me-2).toString())),0===x?v.classList.add("d-none"):(v.setAttribute("cx",(ge+2).toString()),v.setAttribute("cy",le.toString())),0===H?w.classList.add("d-none"):(w.setAttribute("cx",oe.toString()),w.setAttribute("cy",(fe+2).toString())),0===C?j.classList.add("d-none"):(j.setAttribute("cx",(pe-2).toString()),j.setAttribute("cy",ae.toString()));const Te=E.getBoundingClientRect(),ke=n.getBoundingClientRect(),Me=0-(Te.top-ke.top),Se=0-(Te.left-ke.left);E.setAttribute("transform",`translate(${Se}, ${Me})`);const Ae=Math.ceil(Te.width),xe=Math.ceil(Te.height);n.setAttribute("width",Ae.toString()),n.setAttribute("height",xe.toString());const He=`M${ne},${me} ${[[ge,le],[oe,fe],[pe,ae]].map(e=>`L${e[0]},${e[1]}`).join(" ")} z`;A+x+H+C!==0&&s.setAttribute("d",He)}document.addEventListener("keydown",e=>{if("Escape"!==e.key)return;if(e.target!==document.body)return;const t=document.querySelector(".js-targetable-element:target");t&&se(t,()=>{window.location.hash="",window.history.replaceState(null,"",window.location.pathname+window.location.search)})}),document.addEventListener("click",e=>{const t=document.querySelector(".js-targetable-element:target");t&&(e.target instanceof HTMLAnchorElement||e.target instanceof HTMLElement&&(t.contains(e.target)||se(t,()=>{window.location.hash="",window.history.replaceState(null,"",window.location.pathname+window.location.search)})))}),y(".js-template-form-input",(function(e){if(!(e instanceof HTMLInputElement))return;const t=Mi(e);function n(){e instanceof HTMLInputElement&&Si(e,t)}function s(e){for(const n of t)n.classList.toggle("CommunityTemplate-highlight--focus",e)}s(!0),e.addEventListener("input",n),e.addEventListener("blur",(function t(){s(!1),e.removeEventListener("input",n),e.removeEventListener("blur",t)}))})),ft("click",".js-template-highlight",(function(e){(function(e){const n=h(e,"data-fieldname");return t(document,`input[data-fieldname="${n}"]`,HTMLInputElement)})(e.currentTarget).focus()})),pt(".js-templates",(function(){for(const e of n(document,".js-template-form-input",HTMLInputElement)){Si(e,Mi(e))}})),pt(".js-activity-overview-graph-container",e=>{!async function(e){await C;const t=h(e,"data-percentages"),n={percentages:JSON.parse(t)};if(Hi(e,n),"true"===e.getAttribute("data-responsive-graph")){const t=bt(Hi.bind(null,e,n),100)}}(e)}),ft("submit","form.js-post-recovery-token",(function(e){const n=e.currentTarget;n instanceof HTMLFormElement&&(e.preventDefault(),async function(e){const n=t(document,".js-delegated-account-recovery-submit",HTMLButtonElement),s=t(document,".js-create-recovery-token-form",HTMLFormElement);e.classList.remove("failed"),e.classList.add("loading"),n.disabled=!0;try{const t=await oe(s),n=await t.json();re(e,{token:n.token,state:n.state_url}),e.submit()}catch(o){e.classList.remove("loading"),e.classList.add("failed"),n.disabled=!1}}(n))})),pt("form.js-recovery-provider-auto-redirect",{constructor:HTMLFormElement,initialize:function(e){e.submit()}}),ft("click",".js-sub-dependencies",(async function({currentTarget:e}){const t=e,n=t.getAttribute("data-loaded"),s=t.querySelector(".js-expanded"),o=t.querySelector(".js-collapsed"),r=t.closest(".js-details-container");if(s&&s.classList.toggle("d-none"),o&&o.classList.toggle("d-none"),r&&r.classList.toggle("bg-gray-light"),!n){t.setAttribute("data-loaded","true");const e=h(t,"data-sub-dependency-url"),n=t.closest(".js-dependency"),s=await $(document,e);n&&n.after(s)}}));let Ci=null;function qi({currentTarget:e}){const t=e;if(!t.hasAttribute("open"))return;const n=t.querySelector("[autofocus]");n instanceof HTMLElement&&n.focus()}function Ii({currentTarget:e}){const t=e;t.hasAttribute("open")?(Ci&&Ci!==t&&Ci.removeAttribute("open"),Ci=t):t===Ci&&(Ci=null)}function _i({currentTarget:e}){if(!(e instanceof Element))return;const n=p(e,"details"),s=h(n,"data-deferred-details-content-url");n.removeAttribute("data-deferred-details-content-url"),t(n,"include-fragment, poll-include-fragment",m).src=s}function $i(e){return Array.from(e.types).indexOf("Files")>=0}document.addEventListener("keydown",(function(e){!e.defaultPrevented&&"Escape"===e.key&&Ci&&Ci.removeAttribute("open")})),pt(".js-dropdown-details",{subscribe:e=>b(v(e,"toggle",Ii),v(e,"toggle",qi))}),pt("[data-deferred-details-content-url]:not([data-details-no-preload-on-hover])",{subscribe:e=>{const n=t(e,"summary");return v(n,"mouseenter",_i)}}),pt("[data-deferred-details-content-url]",{subscribe:e=>v(e,"toggle",_i)}),ft("click","[data-toggle-for]",(function(e){const t=e.currentTarget.getAttribute("data-toggle-for")||"",n=document.getElementById(t);n&&(n.hasAttribute("open")?n.removeAttribute("open"):n.setAttribute("open","open"))})),ie((function({target:e}){if(!e||e.closest("summary"))return;let t=e.parentElement;for(;t;)t=t.closest("details"),t&&(t.hasAttribute("open")||t.setAttribute("open",""),t=t.parentElement)})),pt(".js-document-dropzone",{constructor:HTMLElement,add(e){const t=document.body;if(!t)throw new Error("invariant: app/assets/modules/github/document-dropzone.ts:9");t.addEventListener("dragstart",Fi),t.addEventListener("dragend",Oi),t.addEventListener("dragenter",Ni),t.addEventListener("dragover",Ni),t.addEventListener("dragleave",Bi),e.addEventListener("drop",Pi)},remove(e){const t=document.body;if(!t)throw new Error("invariant: app/assets/modules/github/document-dropzone.ts:19");t.removeEventListener("dragstart",Fi),t.removeEventListener("dragend",Oi),t.removeEventListener("dragenter",Ni),t.removeEventListener("dragover",Ni),t.removeEventListener("dragleave",Bi),e.removeEventListener("drop",Pi)}});let Di=null;function Ni(e){if(Ri)return;const t=e.currentTarget;if(!(t instanceof Element))throw new Error("invariant: app/assets/modules/github/document-dropzone.ts:38");Di&&clearTimeout(Di),Di=setTimeout(()=>t.classList.remove("dragover"),200);const n=e.dataTransfer;n&&$i(n)&&(n.dropEffect="copy",t.classList.add("dragover"),e.stopPropagation(),e.preventDefault())}function Bi(e){if(e.target instanceof Element&&e.target.classList.contains("js-document-dropzone")){if(!(e.currentTarget instanceof Element))throw new Error("invariant: app/assets/modules/github/document-dropzone.ts:56");e.currentTarget.classList.remove("dragover")}}function Pi(e){const t=document.body;if(!t)throw new Error("invariant: app/assets/modules/github/document-dropzone.ts:62");const n=e.currentTarget;if(!(n instanceof Element))throw new Error("invariant: app/assets/modules/github/document-dropzone.ts:64");n.classList.remove("dragover"),t.classList.remove("dragover");const s=e.dataTransfer;s&&$i(s)&&(ht(n,"document:drop",{transfer:s}),e.stopPropagation(),e.preventDefault())}let Ri=!1;function Fi(){Ri=!0}function Oi(){Ri=!1}async function Ui(e){const t=e.getAttribute("data-url")||"";if(await async function(e){const t=e;if(!t)return!1;try{return(await F(t)).has_gravatar}catch(n){return!1}}(t)){const t=e.getAttribute("data-gravatar-text");null!=t&&(e.textContent=t)}}function Wi(e){const t=zi();if(!t)return;Vi(e,t);const n=function(e,t){const n=function(e,t){const n=/^(diff-[0-9a-f]{32})(?:[L|R]\d+)?$/.exec(t);if(!n)return;const s=n[1],o=e.querySelector(`a[name='${s}']`);if(!o)return;const r=o.nextElementSibling;if(r&&!r.querySelector(".js-diff-load-container"))return;return r}(e,t);if(n)return n;return function(e,t){const n=/^(?:r|commitcomment-)(\d+)$/.exec(t);if(!n)return;const s=n[1],o=e.querySelector(`#diff-with-comment-${s}`);if(!o)return;return o.closest(".js-file")}(e,t)}(e,t);n&&(ae(n),Ki(n))}function zi(){return window.location.hash.slice(1)}function Vi(e,t){const n=G(e.ownerDocument,t);n&&e.contains(n)&&ae(n)}function Ki(e){const n=t(e,".js-diff-entry-loader",m),s=t(e,".js-diff-placeholder",Element),o=t(e,"button.js-diff-load",HTMLButtonElement),r=t(e,".js-button-text");s.setAttribute("fill","url('#animated-diff-gradient')"),r.textContent=o.getAttribute("data-disable-with")||"",o.disabled=!0;const i=new URL(n.getAttribute("data-fragment-url")||"",window.location.origin);return n.src=i.toString(),n.data}function Yi(e,t){return n(document,".js-details-container.open.Details--on").filter(n=>n.getAttribute(e)===t)}function Ji(e,n,s,o,r){const i=t(document,".js-file-filter"),a=new URL(window.location.href,window.location.origin);if(!e&&!o){if(n)return;return a.search="",A(ce(),"",a.toString())}const c=t(i,".js-file-filter-form",HTMLFormElement),l=new FormData(c),u=s.filter(e=>!l.getAll("file-filters[]").includes(e)),d=r.filter(e=>!l.getAll("owned-by[]").includes(e));for(const t of u)l.append("file-filters[]",t);for(const t of d)l.append("owned-by[]",t);const m=new URLSearchParams(l);m.has("file-filters[]")&&""!==m.toString()||m.set("file-filters[]",""),n&&m.set("w","1"),a.search=m.toString(),A(ce(),"",a.toString())}function Xi(e){var s;s=e,t(document,".js-file-filter-text",HTMLElement).classList.toggle("text-blue",s),function(e){const t=document.querySelector(".js-reset-filters"),n=document.querySelector(".js-commits-filtered");null==t||n||(t.hidden=!e)}(e),function(){const e=Zi(),t=aa();for(const o of e)if(t){const e="0"===h(o,"data-non-deleted-files-count");o.disabled=e}else o.disabled=!1;const n=document.querySelector(".js-deleted-files-container"),s=ea();if(s&&n){const t=function(e){const t=e.find(e=>e.checked&&"0"!==h(e,"data-deleted-files-count"));return Boolean(t)}(e);n.classList.toggle("text-gray",!t),s.disabled=!t}}(),function(){const e=ra(),n=t(document,".js-file-filter-select-all-container",HTMLElement),s=h(n,e?"data-select-all-markup":"data-all-selected-markup");n.textContent=s,n.classList.toggle("text-gray",!e),n.classList.toggle("text-blue",e)}(),function(){const e=document.querySelector(".js-deleted-files-container");if(e){const t=aa()?"data-show-deleted-markup":"data-hide-deleted-markup",n=h(e,t);e.textContent=n}}(),function(){const e=n(document,".js-file-type-count");for(const t of e){const e=aa()?"data-non-deleted-file-count-markup":"data-all-file-count-markup",n=t.getAttribute(e);n&&(t.textContent=n)}}(),Ji(e,ia(),Qi(),sa(),oa())}function Gi(e){!function(){const e=ea(),t=Qi(),s=n(document,".js-file"),o=oa(),r=ta();for(const n of s){let s=!0;const i=n.getAttribute("data-file-type");if(i&&(s=t.includes(i)),r&&s){n.hasAttribute("data-file-user-viewed")&&(s=!r.checked)}if(o.length>0&&s){const e=(n.getAttribute("data-codeowners")||"").split(",");s=e.filter(e=>o.includes(e)).length>0}if(e&&e.checked&&s){"true"===n.getAttribute("data-file-deleted")&&(s=!1)}ca(n,s)}}(),Xi(e)}function Qi(){return Zi().filter(e=>e.checked).map(e=>e.value)}function Zi(){return n(document,".js-diff-file-type-option",HTMLInputElement)}function ea(){const e=document.querySelector(".js-deleted-files-toggle");if(e instanceof HTMLInputElement)return e}function ta(){const e=document.querySelector(".js-viewed-files-toggle");if(e instanceof HTMLInputElement)return e}function na(){return ra()||aa()||sa()}function sa(){return oa().length>0}function oa(){return n(document,".js-diff-owner-option",HTMLInputElement).filter(e=>e.checked).map(e=>e.value)}function ra(){return Qi().length!==Zi().length}function ia(){return new URLSearchParams(window.location.search).has("w")}function aa(){const e=ea();return!!e&&e.checked}function ca(e,t){const n=p(e,".js-file.js-details-container");n.classList.toggle("open",t),n.classList.toggle("Details--on",t)}function la(e){const t=Zi();for(const n of t)n.checked=e}function ua(){le(document)&&ue(document)}ft("click",".js-anon-download-zip-link",(function(e){const n=e.currentTarget,s=p(n,".js-get-repo-modal"),o=t(s,".js-modal-downloading");s.classList.add("is-downloading"),o.hidden=!1})),ft("toggle",".js-anon-get-repo-select-menu",(function(e){const n=e.target;n instanceof HTMLElement&&(t(n,".js-modal-downloading").hidden=n.hasAttribute("open"))}),{capture:!0}),pt(".js-detect-gravatar",(function(e){Ui(e)})),pt(".js-diff-progressive-container",(function(e){Wi(e);const t=e.querySelector(".js-diff-progressive-loader");t&&t.addEventListener("load",(function(){Wi(e)}))})),pt(".js-diff-load-container",(function(e){const t=e.querySelector(".js-diff-entry-loader");t&&t.addEventListener("load",(function(){p(e,".js-file").classList.remove("hide-file-notes-toggle");const t=zi();t&&Vi(e,t)}))})),ft("click",".js-diff-load",(function(e){if(e.target.classList.contains("js-ignore-this"))return;Ki(p(e.currentTarget,".js-diff-load-container"))})),ft("click",".js-rendered, .js-source",(function(e){const t=e.currentTarget;t.classList.contains("selected")?e.preventDefault():(function(e){const t=p(e,".js-file-header"),n=e.classList.contains("js-rendered"),s=e.classList.contains("js-source"),o=h(t,"data-short-path"),r=h(t,"data-anchor"),i=new URL(window.location.href,window.location.origin),a=new URLSearchParams(i.search.slice(1));i.hash=r,n?a.set("short_path",o):s&&a.delete("short_path");i.search=a.toString(),A(null,"",i.toString())}(t),function(e){for(const t of document.querySelectorAll(".js-rendered, .js-source"))t.classList.remove("selected"),t.removeAttribute("aria-current");e.classList.add("selected"),e.setAttribute("aria-current","true")}(t))})),E(".js-prose-diff-toggle-form",(async function(e,n){const s=p(e,".js-details-container"),o=t(s,".js-file-content"),r=await n.html();for(;o.lastChild;)o.removeChild(o.lastChild);o.append(r.html),s.classList.toggle("display-rich-diff"),s.classList.toggle("show-inline-notes")})),ft("change",".js-diff-style-toggle input",(function(e){if(!(e.target instanceof Element))return;const t=p(e.target,".js-diff-settings");for(const s of n(t,".js-diff-style-toggle label"))s.classList.toggle("selected")})),ft("click",".js-toc-retry",(function(e){if(!(e.target instanceof Element))return;const n=p(e.target,".select-menu"),s=t(n,"include-fragment"),o=h(s,"src");s.setAttribute("src",""),s.setAttribute("src",o)})),ft("change",".js-diff-file-type-option",(function(){Gi(na())})),ft("change",".js-diff-owner-option",(function(){Gi(sa())})),ft("click",".js-file-filter-select-all",(function(){ra()&&(la(!0),Gi(na()))})),ft("change",".js-deleted-files-toggle",(function(){Gi(na())})),ft("change",".js-viewed-files-toggle",(function(){Gi(na())})),pt(".js-file-filter",(function(){na()?Xi(!0):Ji(!1,ia(),Qi(),sa(),oa())})),ft("click",".js-file-header .js-details-target",(function({currentTarget:e}){if(!document.querySelector(".js-file-filter"))return;const t=p(e,".js-details-container"),s=function(e){const t=h(e,"data-file-type"),s=Yi("data-file-type",t),o=n(document,".js-diff-file-type-option",HTMLInputElement).find(e=>e.value===t);if(!o)return!1;const r=o.checked!==s.length>0;return r&&(o.checked=s.length>0),r}(t),o=ea();let r=!1;o&&(r=function(e,t){let n=!1;if("true"===h(e,"data-file-deleted")){const e=Yi("data-file-deleted","true");n=t.checked!==(0===e.length),n&&(t.checked=0===e.length)}return n}(t,o));const i=ta();let a=!1;i&&(a=function(e,t){let n=!1;if("true"===e.getAttribute("data-file-user-viewed")){const e=Yi("data-file-user-viewed","true");n=t.checked!==(0===e.length),n&&(t.checked=0===e.length)}return n}(t,i)),(s||r||a)&&Xi(na())})),ie(ua),ft("click",'a[href^="#"]',(function(e){const{currentTarget:t}=e;t instanceof HTMLAnchorElement&&setTimeout(ua,0)})),E(".js-form-toggle-target",(async function(e,n){await n.text();const s=p(e,".js-form-toggle-container");t(s,".js-form-toggle-target[hidden]").hidden=!1,e.hidden=!0}));class da{constructor(e){this.name=e.getAttribute("data-theme-name")||"",this.slug=e.getAttribute("data-theme-slug")||"",this.gem=e.getAttribute("data-theme-gem")||"",this.selected=e.classList.contains("selected"),this.baseHref=e.getAttribute("href")||""}}class ma{constructor(){this.pagePreview=t(document,"#page-preview"),this.contextLoader=t(document,".theme-picker-spinner"),this.fullPicker=t(document,".theme-picker-thumbs"),this.miniPicker=t(document,".theme-picker-controls"),this.scrollBackwardsLink=t(document,".theme-toggle-full-left",HTMLButtonElement),this.scrollForwardsLink=t(document,".theme-toggle-full-right",HTMLButtonElement),this.themeLinksContainer=t(this.fullPicker,".js-theme-selector"),this.themeLinks=n(this.themeLinksContainer,".theme-selector-thumbnail"),this.themes=this.themeLinks.map(e=>{const t=new da(e);return t.selected&&(this.selectedTheme=t),t}),this.scrolledPage=0,this.selectedTheme=this.selectedTheme||this.themes[0],this.pagePreview.addEventListener("load",()=>this.onPagePreviewLoad()),this.scrollBackwardsLink.addEventListener("click",()=>this.scrollThemeLinksContainer(-1)),this.scrollForwardsLink.addEventListener("click",()=>this.scrollThemeLinksContainer(1)),t(document,".theme-picker-prev").addEventListener("click",e=>this.onThemeNavPrevClick(e)),t(document,".theme-picker-next").addEventListener("click",e=>this.onThemeNavNextClick(e));for(const t of this.themeLinks)t.addEventListener("click",e=>this.onThemeLinkClick(e));t(document,".theme-picker-view-toggle").addEventListener("click",e=>this.onHideClick(e));const e=document.querySelector("#page-edit");e&&e.addEventListener("click",e=>this.onEditClick(e)),t(document,"#page-publish").addEventListener("click",e=>this.onPublishClick(e)),this.theme(this.selectedTheme),this.updateScrollLinks()}onPagePreviewLoad(){this.contextLoader.classList.remove("visible")}onThemeNavPrevClick(e){this.theme(this.prevTheme()),e.preventDefault()}onThemeNavNextClick(e){this.theme(this.nextTheme()),e.preventDefault()}onThemeLinkClick(e){this.theme(this.themeForLink(e.currentTarget)),e.preventDefault()}onHideClick({currentTarget:e}){if(!(e instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/generated-pages-theme-picker.ts:68");this.fullPicker.classList.toggle("d-none"),this.miniPicker.classList.toggle("d-none"),this.scrollToTheme(this.theme(),!1),e.classList.toggle("open")}onEditClick(e){L(t(document,"#page-edit-form",HTMLFormElement)),e.preventDefault()}onPublishClick(e){const n=t(document,"#page-publish-form",HTMLFormElement),s=this.theme();s&&(t(document,'input[name="page[theme_slug]"]',HTMLInputElement).value=s.slug),L(n),e.preventDefault()}scrollThemeLinksContainer(e){this.scrollToTheme(this.themes[e<0?0:6]),this.updateScrollLinks()}updateScrollLinks(){const e=0===this.scrolledPage;this.scrollBackwardsLink.disabled=e,this.scrollBackwardsLink.classList.toggle("disabled",e),this.scrollForwardsLink.disabled=!e,this.scrollForwardsLink.classList.toggle("disabled",!e)}selectedThemeIndex(){return this.themes.indexOf(this.selectedTheme)}prevTheme(){let e=(this.selectedThemeIndex()-1)%this.themes.length;return e<0&&(e+=this.themes.length),this.themes[e]}nextTheme(){return this.themes[(this.selectedThemeIndex()+1)%this.themes.length]}themeForLink(e){return this.themes[this.themeLinks.indexOf(e)]}linkForTheme(e){return this.themeLinks[this.themes.indexOf(e)]}scrollToTheme(e,t=!0){this.scrolledPage=Math.floor(this.themes.indexOf(e)/6);let n=0;if(this.scrolledPage>0){const e=this.linkForTheme(this.themes[6*this.scrolledPage]);n=e.offsetLeft}const s=this.themeLinksContainer,o=n-s.scrollLeft;if(t&&0!==o){const e=150;!function(e){new Promise(t=>{let n=performance.now();!function s(){window.requestAnimationFrame(o=>{!1!==e(o-n)?(n=o,s()):t()})}()})}(t=>{if(t<0)return;const r=s.scrollLeft;return s.scrollLeft=Math[n-r>0?"min":"max"](r+o*(t/e),n),r!==s.scrollLeft&&void 0})}else s.scrollLeft=n}theme(e){if(!e)return this.selectedTheme;this.selectedTheme=e,this.showPreviewFor(e);for(const t of this.themeLinks)t.classList.remove("selected");this.linkForTheme(e).classList.add("selected"),this.scrollToTheme(e),t(this.miniPicker,".js-theme-name").textContent=e.name}showPreviewFor(e){if(this.contextLoader.classList.add("visible"),e.gem)this.pagePreview.setAttribute("src",e.baseHref);else{const n=t(this.fullPicker,"form",HTMLFormElement);t(document,'input[name="theme_slug"]',HTMLInputElement).value=e.slug,L(n)}}}function fa(){return/Windows/.test(navigator.userAgent)?"windows":/Macintosh/.test(navigator.userAgent)?"mac":null}function pa(e){const t=h(e,"data-platforms").split(","),n=fa();return Boolean(n&&t.includes(n))}function ga(){const e=document.querySelector(".js-get-repo-modal");if(e){e.classList.remove("is-downloading");for(const t of e.querySelectorAll(".js-modal-download-mac, .js-modal-download-windows, .js-modal-download-xcode, .js-modal-download-visual-studio"))t.classList.remove("d-block"),t.classList.add("d-none")}}function ha(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function ba(e,t){try{sessionStorage.setItem(e,t)}catch(n){}}function va(e){try{sessionStorage.removeItem(e)}catch(t){}}function wa(){me(Mt()),fe(kt("meta[name=analytics-location]")?"(masked)":document.title);const e=document.querySelector("meta[name=analytics-ec-payload]");e instanceof HTMLMetaElement&&ja(e.content);const t=ha("ga-deferred");t&&(ja(t),va("ga-deferred"));for(const s of n(document,"meta.js-ga-set",HTMLMetaElement))pe(s.name,s.content)}function ja(e){if(e)for(const t of JSON.parse(e))window.ga.apply(null,t)}function ya(){for(const e of document.querySelectorAll("meta[name=analytics-virtual-pageview]"))e instanceof HTMLMetaElement&&ge(e.content,{title:""});ge()}function Ea(e){const[t,n,s,o]=e.trim().split(/\s*,\s*/);return o?{category:t,action:n,label:s,value:Number(o)}:{category:t,action:n,label:s}}pt("#theme-picker-wrap",(function(){new ma})),ft("click",".email-hidden-toggle",(function(e){const t=e.currentTarget.nextElementSibling;t instanceof HTMLElement&&(t.style.display="",t.classList.toggle("expanded"),e.preventDefault())})),ft("click",".js-git-clone-help-container .js-git-clone-help-switcher",(function(e){const n=e.currentTarget,s=p(n,".js-git-clone-help-container"),o=n.getAttribute("data-url")||"";if(t(s,".js-git-clone-help-field",HTMLInputElement).value=o,n.matches(".js-git-protocol-clone-url"))for(const t of s.querySelectorAll(".js-git-clone-help-text"))t.textContent=o;const r=s.querySelector(".js-clone-url-button.selected");r&&r.classList.remove("selected"),p(n,".js-clone-url-button").classList.add("selected")})),ft("click",".js-get-repo",(function(e){const t=e.currentTarget.getAttribute("data-open-app")||fa();t&&function(e,t){let n;switch(e.classList.add("is-downloading"),t){case"mac":n=e.querySelector(".js-modal-download-mac");break;case"windows":n=e.querySelector(".js-modal-download-windows");break;case"xcode":n=e.querySelector(".js-modal-download-xcode");break;case"visual-studio":n=e.querySelector(".js-modal-download-visual-studio")}n&&(n.classList.remove("d-none"),n.classList.add("d-block"))}(p(e.currentTarget,".js-get-repo-modal"),t)})),ft("toggle",".js-get-repo-select-menu",ga,{capture:!0}),ft("click",".js-get-repo-modal-download-back",ga),pt(".js-remove-unless-platform",(function(e){pa(e)||e.remove()})),pt(".js-show-for-platform",{constructor:HTMLElement,add(e){pa(e)&&(e.hidden=!1)}}),pt(".js-hide-for-platform",{constructor:HTMLElement,add(e){pa(e)&&(e.hidden=!0)}}),de("octolyticsPlugin",(function(e){const t=e.get("sendHitTask");e.set("sendHitTask",(function(e){if(t(e),"event"===e.get("hitType")&&window._octo){const t=`//${window._octo.host}/collect`,n=new Blob([e.get("hitPayload")],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon&&navigator.sendBeacon(t,n)}}))}));const La=document.querySelector("meta[name=google-analytics]");La instanceof HTMLMetaElement&&(he(La.content,"auto"),be("octolyticsPlugin"),be("ec"),wa()),async function(){await Y,ya()}(),document.addEventListener("pjax:complete",()=>{setTimeout(()=>{wa(),ya()},20)},!1),pt("[data-ga-load]",(function(e){const t=Ea(e.getAttribute("data-ga-load")||"");t.interactive=!1,ve(t)})),pt("meta[name=analytics-event]",{constructor:HTMLMetaElement,initialize(e){const t=Ea(e.content);t.interactive=!1,ve(t)}}),ft("click","[data-ga-click]",(function(e){ja(e.currentTarget.getAttribute("data-ga-ec")||"");const t=Ea(e.currentTarget.getAttribute("data-ga-click")||"");ve(t)}),{capture:!0}),ft("click","[data-ga-deferred]",(function(e){ba("ga-deferred",e.currentTarget.getAttribute("data-ga-deferred")||"")}),{capture:!0}),ft("change","[data-ga-change]",(function(e){ja(e.currentTarget.getAttribute("data-ga-ec")||"");const t=Ea(e.currentTarget.getAttribute("data-ga-change")||"");ve(t)}),{capture:!0}),ft("click",".js-skip-to-content",(function(e){const t=document.getElementById("start-of-content");if(t){const e=t.nextElementSibling;e instanceof HTMLElement&&(e.setAttribute("tabindex","-1"),e.focus())}e.preventDefault()}));const Ta="ontouchstart"in document;for(const e of document.querySelectorAll(".HeaderMenu-details"))e.addEventListener("toggle",Ma),Ta||(e.addEventListener("mouseover",Sa),e.addEventListener("mouseleave",Sa));let ka=!1;function Ma(e){if(!ka){ka=!0;for(const t of document.querySelectorAll(".HeaderMenu-details"))t!==e.currentTarget&&t.removeAttribute("open");setTimeout(()=>ka=!1)}}function Sa(e){const{currentTarget:t}=e;t instanceof HTMLElement&&window.innerWidth>1012&&("mouseover"===e.type&&e instanceof MouseEvent?e.target instanceof Node&&e.relatedTarget instanceof Node&&t.contains(e.target)&&!t.contains(e.relatedTarget)&&t.setAttribute("open",""):t.removeAttribute("open"))}ft("click",".js-video-play, .js-video-close",(function(e){e.preventDefault();const n=e.currentTarget,s=n.classList.contains("js-video-play"),o=p(n,".js-video-container"),r=t(o,".js-video-iframe",HTMLIFrameElement),i=document.querySelector(".js-video-bg");s?r.src=r.getAttribute("data-src")||"":r.removeAttribute("src"),o.classList.toggle("is-expanded",s),null!=i&&i.classList.toggle("is-expanded",s),function(e,t=0){const n=e.getBoundingClientRect(),s=n.top-t,o=n.bottom-window.innerHeight+t;s<0?window.scrollBy(0,s):o>0&&window.scrollBy(0,o)}(r,20)}));const Aa=document.querySelector(".js-hovercard-content"),xa=we($);let Ha,Ca,qa=null,Ia=0;function _a(e){return"Popover-message--"+e}function $a(){Aa instanceof HTMLElement&&(Aa.style.display="none",Aa.children[0].innerHTML="",qa=null,Ha=null)}function Da(e){if(!(Aa instanceof HTMLElement))throw new Error("invariant violation, cardContentContainer is not HTMLElement");const{width:t,height:n}=Aa.getBoundingClientRect(),{left:s,top:o,height:r,width:i}=function(e){const t=e.getClientRects();let n=t[0];for(const s of t)if(s.leftIa){n=s;break}return n}(e),a=o>n;if(e.classList.contains("js-hovercard-left")){const e=o+r/2;return{containerTop:a?e-n+17+8:e-17-8,containerLeft:s-t-12,contentClassSuffix:a?"right-bottom":"right-top"}}{const e=window.innerWidth-s>t,c=s+i/2;return{containerTop:a?o-n-12:o+r+12,containerLeft:e?c-24:c-t+24,contentClassSuffix:a?e?"bottom-left":"bottom-right":e?"top-left":"top-right"}}}function Na(e,t){if(!(Aa instanceof HTMLElement))return;const n=Aa.children[0];n.innerHTML="";const s=document.createElement("div");for(const o of e.children)s.appendChild(o.cloneNode(!0));n.appendChild(s),function(e,t){if(!(Aa instanceof HTMLElement))return;Aa.style.visibility="hidden",Aa.style.display="block",t.classList.remove(_a("bottom-left"),_a("bottom-right"),_a("right-top"),_a("right-bottom"),_a("top-left"),_a("top-right"));const{containerTop:n,containerLeft:s,contentClassSuffix:o}=Da(e);t.classList.add(_a(o)),Aa.style.top=`${n+window.pageYOffset}px`,Aa.style.left=`${s+window.pageXOffset}px`,function(e,t){const n=e.getAttribute("data-hovercard-z-index-override");t.style.zIndex=n||"100"}(e,Aa),Aa.style.visibility=""}(t,n),function(e){setTimeout(()=>{if(document.body&&document.body.contains(e)){const t=e.querySelector("[data-hovercard-tracking]");if(t){const e=t.getAttribute("data-hovercard-tracking");if(e){const t={event_type:"user-hovercard-load"};t.dimensions=JSON.parse(e),Lt(t)}}const n=e.querySelector("[data-hydro-view]");n instanceof HTMLElement&&je(n)}},500)}(s),Aa.style.display="block"}function Ba(e){const t=e.getAttribute("data-hovercard-url");if(t){const n=function(e){const t=e.closest("[data-hovercard-subject-tag]");if(t)return t.getAttribute("data-hovercard-subject-tag");const n=document.head&&document.head.querySelector('meta[name="hovercard-subject-tag"]');return n?n.getAttribute("content"):null}(e);if(n){const e=new URL(t,window.location.origin),s=new URLSearchParams(e.search.slice(1));return s.append("subject",n),s.append("current_path",window.location.pathname+window.location.search),e.search=s.toString(),e.toString()}return t}return""}function Pa(e){!async function(e,t){const n=e.currentTarget;if(e instanceof MouseEvent&&(Ia=e.clientX),!(n instanceof Element))return;if(Ha===n)return;if(n.closest(".js-hovercard-content"))return;if(!function(e){const t=e.getAttribute("data-hovercard-type");return"pull_request"===t||"issue"===t?!!e.closest("[data-issue-and-pr-hovercards-enabled]"):"team"===t?!!e.closest("[data-team-hovercards-enabled]"):"repository"===t?!!e.closest("[data-repository-hovercards-enabled]"):"commit"===t?!!e.closest("[data-commit-hovercards-enabled]"):"project"===t?!!e.closest("[data-project-hovercards-enabled]"):"contributors"===t?!!e.closest("[data-contributors-hovercards-enabled]"):"discussion"!==t||!!e.closest("[data-discussion-hovercards-enabled]")}(n))return;$a(),Ha=n,qa=document.activeElement;const s=Ba(n);let o;try{const e=new Promise(e=>window.setTimeout(e,t,0));o=await xa(document,s),await e}catch(r){const e=r.response;if(e&&404===e.status){const e="Hovercard is unavailable";n.setAttribute("aria-label",e),n.classList.add("tooltipped","tooltipped-ne")}else if(e&&410===e.status){const t=await e.clone().json();n.setAttribute("aria-label",t.message),n.classList.add("tooltipped","tooltipped-ne")}return}n===Ha&&(Na(o,n),e instanceof KeyboardEvent&&Aa instanceof HTMLElement&&Aa.focus())}(e,250)}function Ra(e){if(Ha){if(e instanceof MouseEvent&&e.relatedTarget instanceof HTMLElement){const t=e.relatedTarget;if(t.closest(".js-hovercard-content")||t.closest("[data-hovercard-url]"))return}else e instanceof KeyboardEvent&&qa instanceof HTMLElement&&qa.focus();$a()}}function Fa(e){const t=Ha;Ca=window.setTimeout(()=>{Ha===t&&Ra(e)},100)}function Oa(e){if(e instanceof KeyboardEvent)switch(e.key){case"Escape":Ra(e)}}function Ua(){Ca&&clearTimeout(Ca)}function Wa(){return t(document,"input.js-edit-integration-setup-url",HTMLInputElement)}function za(){return t(document,".js-help-text-for-redirect-on-update")}function Va(e){e&&((function(){const e=p(Wa(),".form-group");return t(e,".js-setup-url-hint")}()).textContent=e)}function Ka(){const e=document.getElementById("js-update-integration-permissions");e&&e.removeAttribute("disabled")}function Ya(){return function(){const e=n(document,'[id^=integration_permission_]:checked:not([data-permission="none"])',HTMLInputElement);return Array.from(e,e=>e.getAttribute("data-resource"))}().map(e=>function(e){if(e)return n(document,`.js-integration-hook-event[data-resource~="${e}"]:checked`,HTMLInputElement)}(e)).reduce((e,t)=>e.concat(t,[]),[])}function Ja(e=!1){const s=t(document,".js-integration-permissions-selector [id=integration_permission_metadata_read]",HTMLInputElement),o=p(s,".js-list-group-item");e&&w(s,!0),t(o,".js-mandatory-label").hidden=!e;for(const t of n(o,"input",HTMLInputElement))t!==s&&(t.disabled=e)}function Xa(){const e=t(document,".js-content-references input",HTMLInputElement),n=t(document,".js-content-references template",HTMLTemplateElement),s=t(document,".js-content-references-domain-list"),o=e.value;if(!o)return;const r=n.content.cloneNode(!0);r instanceof DocumentFragment&&(t(r,"input",HTMLInputElement).value=o,t(r,".js-content-references-domain-url").textContent=o,e.value="",s.appendChild(r),p(s,".Box").hidden=!1,Ka())}Aa&&(pt("[data-hovercard-url]",{subscribe:e=>b(v(e,"mouseover",Pa),v(e,"mouseleave",Fa),v(e,"keyup",Oa))}),pt("[data-hovercard-url]",{remove(e){Ha===e&&$a()}}),pt(".js-hovercard-content",{subscribe:e=>b(v(e,"mouseover",Ua),v(e,"mouseleave",Ra),v(e,"keyup",Oa))}),pt(".js-hovercard-include-fragment",{constructor:HTMLTemplateElement,add(e){Ha&&Na(e.content,Ha)}}),ft("menu:activated","details",$a),window.addEventListener("statechange",$a)),pt(".js-scrollnav-listener",(function(e){window.addEventListener("scroll",(function(){!function(e){const n=t(e,".js-scrollnav").getBoundingClientRect().height;for(const t of e.querySelectorAll(".js-section")){const s=t.getBoundingClientRect(),o=n>=s.top,r=n<=s.top+s.height;if(o&&r){const n=e.querySelector(`.js-scrollnav-item[href="#${t.id}"]`);if(n&&!n.classList.contains("selected")){for(const t of e.querySelectorAll(".js-scrollnav-item"))t.classList.remove("selected");n.classList.add("selected")}}}}(e)}),{passive:!0})})),ft("change",".js-edit-integration-request-oauth-on-install",(function(e){const t=e.target;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/integrations/edit.ts:22");const n=Wa();if(t.checked){n.disabled=!0,n.placeholder=n.getAttribute("data-hint-unavailable-when-install")||"",Va(n.getAttribute("data-hint-same-as-callback-url")||"");const e=za();e.textContent=e.getAttribute("data-hint-redirect-on-update-callback-url")||""}else{n.disabled=!1,n.placeholder="",n.value=n.getAttribute("data-setup-url")||"",Va(n.getAttribute("data-hint-setup-url")||"");const e=za();e.textContent=e.getAttribute("data-hint-redirect-on-update-setup-url")||""}})),ft("change",".js-integration-permissions-selector [id^=integration_permission_]",(function({currentTarget:e}){const s=e.getAttribute("data-permission"),o=e.getAttribute("data-resource")||"",r=n(document,`.js-integration-hook-event[data-resource~="${o}"]`,HTMLInputElement),i=n(document,".js-integration-single-file-resource",HTMLInputElement),a=n(document,`.js-dropdown-container[data-resource~="${o}"]`);if(Ka(),"none"!==s){const t=n(document,`.js-integration-hook-event-permission-error[data-resource~='${o}']`);for(const e of t)e.classList.add("d-none");const s=n(document,".js-integration-single-file-permission-error");for(const e of s)e.classList.add("d-none");for(const e of r)e.readOnly=!1;for(const e of i)e.readOnly=!1;p(e,".js-list-group-item").classList.remove("disabled");for(const e of a)e.classList.remove("d-none")}else{for(const e of r)c=e,Ya().includes(c)||(e.readOnly=!0,e.checked=!1,p(e,".js-dropdown-container").classList.add("anim-fade-in","d-none"));if(p(e,".js-list-group-item").classList.add("disabled"),"single_file"===o)for(const e of i)e.readOnly=!0,e.value="";else"content_references"===o&&(t(document,`.js-dropdown-container[data-resource~='${o}']`).classList.add("anim-fade-in","d-none"),"none"===s&&(t(document,".js-content-references-domain-list").innerHTML=""))}var c})),ft("change",".js-integration-permissions-selector [id^=integration_permission_][data-resource-parent^=repository]",(function({currentTarget:e}){const t=e.getAttribute("data-permission");"metadata"!==(e.getAttribute("data-resource")||"")&&("none"!==t?Ja(!0):function(){let e=!0;const t=document.querySelectorAll(".js-integration-permissions-selector [id^=integration_permission_][data-resource-parent=repository]:checked");for(const n of t){const t=n.getAttribute("data-permission")||"none";if("metadata"!==(n.getAttribute("data-resource")||"")&&"none"!==t){e=!1;break}}return e}()&&Ja())})),ft("change",".js-integration-permissions-selector [name^=integration]",Ka),ft("click",".js-integration-permissions-selector .js-integration-hook-event",(function(e){const n=e.currentTarget;if(!(n instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/integrations.ts:171");if(n.readOnly){const s=p(n,".js-send-events");t(s,".js-integration-hook-event-permission-error").classList.remove("d-none"),e.preventDefault()}})),ft("click",".js-integration-permissions-selector .js-integration-single-file-resource",(function(e){const n=e.currentTarget;if(!(n instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/integrations.ts:182");if(n.readOnly){const s=p(n,".js-single-file");t(s,".js-integration-single-file-permission-error").classList.remove("d-none"),e.preventDefault()}})),f("keydown",".js-content-references input",(function(e){e instanceof KeyboardEvent&&"Enter"===e.key&&(e.preventDefault(),Xa())})),ft("click",".js-content-references .js-domain-add",Xa),ft("click",".js-content-references .js-close",(function(e){if(!(e.target instanceof Element))return;const t=p(e.target,"li"),s=t.parentElement;s&&(s.removeChild(t),0===n(s,"li").length&&(p(s,".Box").hidden=!0),Ka())})),E(".js-issue-boost-form",(async function(e,n){const s=t(e,".js-issue-boost-error");let o;s.hidden=!0;try{o=await n.html()}catch(r){s.hidden=!1;const n=t(e,".js-issue-boost-value"),o=h(n,"data-original-boost-value");return void(n.textContent=o)}p(e,".js-issue-boost-container").replaceWith(o.html)}));let Ga=null;function Qa(e,t,n){return e>n?n:e{switch(t){case 404:return e.getAttribute("data-permission-text");default:return e.getAttribute("data-error-text")}})()||"")}}function ec(e,t){for(const n of e)n instanceof HTMLElement&&(tc(n)||n.classList.add("tooltipped","tooltipped-ne"),n.setAttribute("aria-label",t))}function tc(e){return!!e.getAttribute("data-hovercard-url")&&!!e.closest("[data-issue-and-pr-hovercards-enabled]")}ft("click",".js-issue-boost-button",(function(e){const n=e.currentTarget;if(!(n instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/issues/issue-boosts.ts:36");e.preventDefault();const s=n.form;if(!s)throw new Error("invariant: app/assets/modules/github/issues/issue-boosts.ts:39");const o=t(s,".js-issue-boost-value"),r=parseInt(h(o,"data-original-boost-value"),10),i=parseInt(n.value,10),a=parseInt(h(s,"data-min-modifier"),10),c=parseInt(h(s,"data-max-modifier"),10),l=parseInt(h(s,"data-min-value"),10),u=parseInt(h(s,"data-max-value"),10),d=t(s,".js-issue-boost-modifier",HTMLInputElement),m=Qa(parseInt(d.value,10)+i,a,c),f=Qa(r+m,l,u);o.textContent=f.toString(),Ga&&clearTimeout(Ga),d.value=m.toString(),n.disabled=f===u&&i>0||f===l&&i<0,Ga=window.setTimeout(()=>{Ga=null,L(s)},400)})),ft("click",".js-new-issue-boost-button",(function(e){const n=e.currentTarget;if(!(n instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/issues/issue-boosts.ts:65");const s=p(n,".js-new-issue-boost-container"),o=parseInt(h(s,"data-min"),10),r=parseInt(h(s,"data-max"),10),i=parseInt(n.value,10),a=t(s,".js-issue-boost-value",HTMLInputElement),c=Qa(parseInt(a.value,10)+i,o,r),l=c===r,u=c===o;if(t(s,".js-issue-boost-value-display").textContent=c.toString(),a.value=c.toString(),n.disabled=l&&i>0||u&&i<0,i<0){t(s,".js-new-issue-increase-boost-button",HTMLButtonElement).disabled=l}else{t(s,".js-new-issue-decrease-boost-button",HTMLButtonElement).disabled=u}})),pt(".js-issue-link",{subscribe:e=>v(e,"mouseenter",Za)});var nc=e((function(e,t){!function(n,s){var o=function(){var e=null,t={};r("monochrome",null,[[0,0],[100,0]]),r("red",[-26,18],[[20,100],[30,92],[40,89],[50,85],[60,78],[70,70],[80,60],[90,55],[100,50]]),r("orange",[19,46],[[20,100],[30,93],[40,88],[50,86],[60,85],[70,70],[100,70]]),r("yellow",[47,62],[[25,100],[40,94],[50,89],[60,86],[70,84],[80,82],[90,80],[100,75]]),r("green",[63,178],[[30,100],[40,90],[50,85],[60,81],[70,74],[80,64],[90,50],[100,40]]),r("blue",[179,257],[[20,100],[30,86],[40,80],[50,74],[60,60],[70,52],[80,44],[90,39],[100,35]]),r("purple",[258,282],[[20,100],[30,87],[40,79],[50,70],[60,65],[70,59],[80,52],[90,45],[100,42]]),r("pink",[283,334],[[20,100],[30,90],[40,86],[60,84],[80,80],[90,75],[100,73]]);var n=function(r){if(void 0!==(r=r||{}).seed&&null!==r.seed&&r.seed===parseInt(r.seed,10))e=r.seed;else if("string"==typeof r.seed)e=function(e){for(var t=0,n=0;n!==e.length&&!(t>=Number.MAX_SAFE_INTEGER);n++)t+=e.charCodeAt(n);return t}(r.seed);else{if(void 0!==r.seed&&null!==r.seed)throw new TypeError("The seed value must be an integer or string");e=null}var c,l;if(null!==r.count&&void 0!==r.count){var u=r.count,d=[];for(r.count=null;u>d.length;)e&&r.seed&&(r.seed+=1),d.push(n(r));return r.count=u,d}return function(e,t){switch(t.format){case"hsvArray":return e;case"hslArray":return a(e);case"hsl":var n=a(e);return"hsl("+n[0]+", "+n[1]+"%, "+n[2]+"%)";case"hsla":var s=a(e),o=t.alpha||Math.random();return"hsla("+s[0]+", "+s[1]+"%, "+s[2]+"%, "+o+")";case"rgbArray":return i(e);case"rgb":return"rgb("+i(e).join(", ")+")";case"rgba":var r=i(e);o=t.alpha||Math.random();return"rgba("+r.join(", ")+", "+o+")";default:return function(e){var t=i(e);function n(e){var t=e.toString(16);return 1==t.length?"0"+t:t}return"#"+n(t[0])+n(t[1])+n(t[2])}(e)}}([c=function(e){var n=o(function(e){if("number"==typeof parseInt(e)){var n=parseInt(e);if(n<360&&n>0)return[n,n]}if("string"==typeof e)if(t[e]){var s=t[e];if(s.hueRange)return s.hueRange}else if(e.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)){var o=function(e){e=3===(e=e.replace(/^#/,"")).length?e.replace(/(.)/g,"$1$1"):e;var t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,s=parseInt(e.substr(4,2),16)/255,o=Math.max(t,n,s),r=o-Math.min(t,n,s),i=o?r/o:0;switch(o){case t:return[(n-s)/r%6*60||0,i,o];case n:return[60*((s-t)/r+2)||0,i,o];case s:return[60*((t-n)/r+4)||0,i,o]}}(e)[0];return[o,o]}return[0,360]}(e.hue));n<0&&(n=360+n);return n}(r),l=function(e,t){if("monochrome"===t.hue)return 0;if("random"===t.luminosity)return o([0,100]);var n=function(e){return s(e).saturationRange}(e),r=n[0],i=n[1];switch(t.luminosity){case"bright":r=55;break;case"dark":r=i-10;break;case"light":i=55}return o([r,i])}(c,r),function(e,t,n){var r=function(e,t){for(var n=s(e).lowerBounds,o=0;o=r&&t<=a){var l=(c-i)/(a-r);return l*t+(i-l*r)}}return 0}(e,t),i=100;switch(n.luminosity){case"dark":i=r+20;break;case"light":r=(i+r)/2;break;case"random":r=0,i=100}return o([r,i])}(c,l,r)],r)};function s(e){for(var n in e>=334&&e<=360&&(e-=360),t){var s=t[n];if(s.hueRange&&e>=s.hueRange[0]&&e<=s.hueRange[1])return t[n]}return"Color not found"}function o(t){if(null===e)return Math.floor(t[0]+Math.random()*(t[1]+1-t[0]));var n=t[1]||1,s=t[0]||0,o=(e=(9301*e+49297)%233280)/233280;return Math.floor(s+o*(n-s))}function r(e,n,s){var o=s[0][0],r=s[s.length-1][0],i=s[s.length-1][1],a=s[0][1];t[e]={hueRange:n,lowerBounds:s,saturationRange:[o,r],brightnessRange:[i,a]}}function i(e){var t=e[0];0===t&&(t=1),360===t&&(t=359),t/=360;var n=e[1]/100,s=e[2]/100,o=Math.floor(6*t),r=6*t-o,i=s*(1-n),a=s*(1-r*n),c=s*(1-(1-r)*n),l=256,u=256,d=256;switch(o){case 0:l=s,u=c,d=i;break;case 1:l=a,u=s,d=i;break;case 2:l=i,u=s,d=c;break;case 3:l=i,u=a,d=s;break;case 4:l=c,u=i,d=s;break;case 5:l=s,u=i,d=a}return[Math.floor(255*l),Math.floor(255*u),Math.floor(255*d)]}function a(e){var t=e[0],n=e[1]/100,s=e[2]/100,o=(2-n)*s;return[t,Math.round(n*s/(o<1?o:2-o)*1e4)/100,o/2*100]}return n}();e&&e.exports&&(t=e.exports=o),t.randomColor=o}()}));nc.randomColor;function sc(e,t){const n=function(e){const t="string"==typeof e?parseInt(e.replace("#",""),16):e;return+((299*(t>>16&255)+587*(t>>8&255)+114*(255&t))/1e3/255).toFixed(2)}(t);null!=n&&(n<.6?(e.classList.remove("text-gray-dark"),e.classList.add("text-white")):(e.classList.remove("text-white"),e.classList.add("text-gray-dark")))}function oc(e,t){let n=t;"#"!==n.charAt(0)&&(n=`#${n}`),e.style.backgroundColor=n;const s=e.querySelector(".js-new-label-color-icon");s&&sc(s,t)}function rc(e,n){e.blur();const s=p(e,"form");t(s,".js-new-label-color-input",HTMLInputElement).value=n,oc(t(s,".js-new-label-color",HTMLButtonElement),n)}function ic(e,t,n){const s=t.querySelector(e);s&&(n?function(e,t){p(e,".js-label-error-container").classList.add("errored"),e.textContent=t,e.hidden=!1}(s,n[0]):function(e){p(e,".js-label-error-container").classList.remove("errored"),e.hidden=!0}(s))}function ac(e,t){ic(".js-label-name-error",e,t.name),ic(".js-label-description-error",e,t.description),ic(".js-label-color-error",e,t.color)}function cc(e){ic(".js-label-name-error",e,null),ic(".js-label-description-error",e,null),ic(".js-label-color-error",e,null)}async function lc(e){const n=e.closest(".js-label-preview-container");if(!n)return;const s=p(e,".js-label-form",HTMLFormElement),o=s.querySelector(".js-new-label-error"),r=s.getAttribute("data-label-id"),i=t(n,".js-label-preview",HTMLElement),a=function(e,n){let s=t(e,".js-new-label-name-input",HTMLInputElement).value.trim();return s.length<1&&(s=h(n,"data-default-name")),s}(s,i),c=function(e){const n=t(e,".js-new-label-color-input",HTMLInputElement);return n.checkValidity()?n.value.trim().replace(/^#/,""):"ededed"}(s),l=function(e){let t=null;const n=e.querySelector(".js-new-label-description-input");return n instanceof HTMLInputElement&&n.value.trim().length>0&&(t=n.value.trim()),t}(s),u=function(e,t,n,s,o){const r=new URL(`${e}${encodeURIComponent(t)}`,window.location.origin),i=new URLSearchParams(r.search.slice(1));return i.append("color",n),s&&i.append("description",s),o&&i.append("id",o),r.search=i.toString(),r.toString()}(h(i,"data-url-template"),a,c,l,r);if(n.hasAttribute("data-last-preview-url")){if(u===h(n,"data-last-preview-url"))return}let d;try{d=await $(document,u)}catch(m){const e=await m.response.json();return ac(s,e),void(o&&(o.textContent=e.message,o.hidden=!1))}o&&(o.textContent="",o.hidden=!0),cc(s),i.innerHTML="",i.appendChild(d),n.setAttribute("data-last-preview-url",u)}function uc(e,t){p(e,".js-details-container").classList.toggle("is-empty",t)}function dc(e){const n=t(document,".js-labels-count"),s=Ee(n.textContent)+e;n.textContent=Le(s);const o=t(document,".js-labels-label");return Te(s,o),s}function mc(e){const n=e.querySelector(".js-new-label-name-input");if(!n)return;if(!(n instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:311");const s=t(e,".js-new-label-color-input",HTMLInputElement);let o=nc();if(s.value.length>0)for(;s.value===o;)o=nc();s.value=o;const r=t(e,".js-new-label-color",HTMLButtonElement);oc(r,o);const i=t(document,".js-new-label-name").textContent;w(n,i),Ei(n),lc(r)}j(".js-label-filter-field",(function(e){const t=e.target;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:191");const n=p(t,"details-menu").querySelector(".js-new-label-name");if(!n)return;const s=t.value.trim();n.textContent=s})),ft("filterable:change",".js-filterable-issue-labels",(function(e){const t=p(e.currentTarget,"details-menu"),s=t.querySelector(".js-add-label-button");if(!s)return;if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:207");const o=e.detail.inputField.value.trim().toLowerCase(),r=n(t,'input[name="issue[labels][]"]').some(e=>(e.getAttribute("data-label-name")||"").toLowerCase()===o);s.hidden=0===o.length||r})),y(".js-new-label-color-input",(function(e){const n=p(e,"form"),s=t(n,".js-new-label-swatches");s.hidden=!1,e.addEventListener("blur",(function(){s.hidden=!0}),{once:!0})})),j(".js-new-label-color-input",(function(e){const n=e.target;if(!(n instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:230");let s=n.value.trim();if(!(s.length<1))if(0!==s.indexOf("#")&&(s=`#${s}`,n.value=s),n.checkValidity()){n.classList.remove("text-red");const e=p(n,"form");oc(t(e,".js-new-label-color",HTMLButtonElement),s)}else n.classList.add("text-red")})),f("keyup",".js-new-label-color-input",(function(e){const n=e.target;if(!(n instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:252");let s=n.value.trim();if(0!==s.indexOf("#")&&(s=`#${s}`,n.value=s),n.checkValidity()){const e=p(n,"form");oc(t(e,".js-new-label-color",HTMLButtonElement),s)}ht(n,"change",!1),cc(p(n,"form",HTMLFormElement))})),f("keyup",".js-new-label-description-input",(function(e){const t=e.target;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:269");const n=t.form;if(!n)throw new Error("invariant: app/assets/modules/github/issues/labels.ts:271");cc(n)})),f("keyup",".js-new-label-color-input",(function(e){const t=e.target;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:276");const n=t.form;if(!n)throw new Error("invariant: app/assets/modules/github/issues/labels.ts:278");cc(n)})),ft("click",".js-new-label-color",(function(e){const t=e.currentTarget;if(!(t instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:285");rc(t,nc()),lc(t)})),ft("mousedown",".js-new-label-color-swatch",(function(e){const t=e.currentTarget;if(!(t instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:292");rc(t,h(t,"data-color")),lc(t),p(t,".js-new-label-swatches").hidden=!0})),ft("toggle",".js-new-label-modal",(function(e){e.target.hasAttribute("open")&&mc(e.target)}),{capture:!0}),E(".js-new-label-modal-form",(async function(e,n){const s=t(e,".js-new-label-error");let o;try{o=await n.html()}catch(c){const e=c.response.json;s.textContent=e.message,s.hidden=!1}if(!o)return;s.hidden=!0,t(document,".js-new-label-modal").removeAttribute("open");const r=t(document,".js-filterable-issue-labels"),i=o.html.querySelector("input");r.prepend(o.html),i&&i.dispatchEvent(new Event("change",{bubbles:!0}));const a=t(document,".js-label-filter-field",HTMLInputElement);a.value=a.defaultValue,a.focus()})),ft("click",".js-edit-label-cancel",(function(e){const n=p(e.target,"form",HTMLFormElement);cc(n),n.reset();const s=t(n,".js-new-label-color-input",HTMLInputElement),o=s.value;t(n,".js-new-label-color",HTMLButtonElement).style.backgroundColor=o,Li(n),lc(s);const r=e.currentTarget.closest(".js-labels-list-item");if(r){t(r,".js-update-label",HTMLElement).classList.add("d-none");const e=r.querySelector(".js-label-preview");if(e){e.classList.add("d-none"),t(r,".js-label-link",HTMLElement).classList.remove("d-none")}const n=r.querySelectorAll(".js-hide-on-label-edit.d-none");for(const t of n)t.classList.remove("d-none")}})),E(".js-update-label",(async function(e,t){let n;try{n=await t.html()}catch(s){return void ac(e,s.response.json)}cc(e),p(e,".js-labels-list-item").replaceWith(n.html)})),E(".js-create-label",(async function(e,n){let s;try{s=await n.html()}catch(r){return void ac(e,r.response.json)}e.reset(),cc(e),t(document,".js-label-list").prepend(s.html),dc(1),uc(e,!1),rc(t(e,".js-new-label-color",HTMLButtonElement),nc()),lc(t(e,".js-new-label-name-input",HTMLInputElement)),Li(e);const o=e.closest(".js-details-container");o instanceof HTMLElement&&ye(o)})),ft("click",".js-details-target-new-label",(function(){const e=t(document,".js-create-label");t(e,".js-new-label-name-input",HTMLInputElement).focus()})),ft("click",".js-edit-label",(function(e){const s=p(e.currentTarget,".js-labels-list-item"),o=t(s,".js-update-label",HTMLElement);o.classList.remove("d-none"),t(o,".js-new-label-name-input",HTMLInputElement).focus();const r=s.querySelector(".js-label-preview");if(r){r.classList.remove("d-none"),t(s,".js-label-link",HTMLElement).classList.add("d-none")}const i=n(s,".js-hide-on-label-edit",HTMLElement);for(const t of i)t.classList.add("d-none")})),E(".js-delete-label",(async function(e,n){const s=p(e,".js-labels-list-item");t(s,".js-label-delete-spinner").hidden=!1,await n.text(),uc(e,0===dc(-1)),s.remove()}));const fc=gt((function(e){const t=e.target;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:171");lc(t)}),500);function pc(){const e=t(document,".js-reveal-custom-thread-settings",HTMLInputElement).checked,n=!document.querySelector(".js-custom-thread-notification-option:checked"),s=t(document,".js-custom-thread-settings"),o=t(document,"[data-custom-option-required-text]",HTMLInputElement),r=e&&n?h(o,"data-custom-option-required-text"):"";o.setCustomValidity(r),s.hidden=!e}function gc(e){e instanceof HTMLFormElement?L(e):bc(e)}function hc({currentTarget:e}){if(!(e instanceof Element))throw new Error("invariant: app/assets/modules/github/issues/sidebar.ts:19");const t=e.closest(".js-issue-sidebar-form")||e.querySelector(".js-issue-sidebar-form");if(!t)throw new Error("invariant: app/assets/modules/github/issues/sidebar.ts:21");gc(t)}async function bc(e,n="post",s){const o=function(e){const t=p(e,"form",HTMLFormElement),n=Se(t),s=new FormData;for(const[o,r]of n)e.contains(vc(t,o,r))&&s.append(o,r);return s}(e);s&&o.append(s.name,s.value);const r=h(e,"data-url");if(!r)return;const i=t(e,".js-data-url-csrf",HTMLInputElement),a=await N(Me(r,i.value,{method:n,body:o}));!function(e,t){e.replaceWith(Ae(document,t))}(p(e,".js-discussion-sidebar-item"),a)}function vc(e,t,n){for(const s of e.elements)if((s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||s instanceof HTMLButtonElement)&&s.name===t&&s.value===n)return s;return null}ft("suggester:complete",".js-new-label-name-input",fc),j(".js-new-label-name-input",fc),j(".js-new-label-description-input",fc),j(".js-new-label-color-input",fc),f("keypress",".js-new-label-name-input",(function(e){const t=e.target;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:480");const n=parseInt(t.getAttribute("data-maxlength"));ne(t.value)>=n&&e.preventDefault()})),ft("click",".js-issues-label-select-menu-item",(function(e){if(!(e instanceof MouseEvent))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:488");e.altKey&&(e.preventDefault(),e.stopPropagation(),window.location=h(e.currentTarget,"data-excluded-url"))})),f("keydown",".js-issues-label-select-menu-item",(function(e){if(!(e instanceof KeyboardEvent))throw new Error("invariant: app/assets/modules/github/issues/labels.ts:497");if("Enter"!==e.key)return;if(!e.altKey)return;const t=e.currentTarget;e.preventDefault(),e.stopPropagation(),t instanceof HTMLAnchorElement&&(window.location=h(t,"data-excluded-url"))})),ft("click",".js-open-label-creation-modal",(async function(e){e.stopImmediatePropagation(),mc(await D({content:t(document,".js-label-creation-template",HTMLTemplateElement).content.cloneNode(!0),detailsClass:"js-new-label-modal"}))}),{capture:!0}),ie((function({newURL:e}){const t=e.match(/\/issues#issue\/(\d+)$/);if(t){const n=t[1];window.location.href=e.replace(/\/?#issue\/.+/,`/${n}`)}})),ie((function({newURL:e}){const t=e.match(/\/issues#issue\/(\d+)\/comment\/(\d+)$/);if(t){const n=t[1],s=t[2];window.location.href=e.replace(/\/?#issue\/.+/,`/${n}#issuecomment-${s}`)}})),pt(".js-issue-row .js-issues-list-check:checked",{add(e){p(e,".js-issue-row").classList.add("selected")},remove(e){p(e,".js-issue-row").classList.remove("selected")}}),ft("navigation:keydown",".js-issue-row",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/issues/list.ts:23");"x"===e.detail.hotkey&&(!function(e){const t=e.querySelector(".js-issues-list-check");t instanceof HTMLInputElement&&w(t,!t.checked)}(e.currentTarget),e.preventDefault(),e.stopPropagation())})),y("#js-issues-search",(function(e){if(!(e instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/issues/list.ts:34");e.value=e.value})),ft("details-menu-select",".js-saved-reply-menu",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/issues/replies.ts:9");if(!(e.target instanceof Element))return;const n=(t(e.detail.relatedTarget,".js-saved-reply-body").textContent||"").trim(),s=p(e.target,".js-previewable-comment-form"),o=t(s,"textarea.js-comment-field",HTMLTextAreaElement);ke(o,n),setTimeout(()=>o.focus(),0)}),{capture:!0}),f("keydown",".js-saved-reply-shortcut-comment-field",(function(e){if("Control+."===J(e)){if(!(e.target instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/issues/replies.ts:21");const n=p(e.target,".js-previewable-comment-form");t(n,".js-saved-reply-container").setAttribute("open",""),e.preventDefault(),ve({category:"Markdown Toolbar",action:"shortcut",label:"saved reply"})}})),f("keydown",".js-saved-reply-filter-input",(function(e){if(/^Control\+[1-9]$/.test(J(e))){if(!(e instanceof KeyboardEvent))throw new Error("invariant: app/assets/modules/github/issues/replies.ts:35");if(!(e.target instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/issues/replies.ts:36");const t=p(e.target,".js-saved-reply-container").querySelectorAll('[role="menuitem"]'),n=Number(e.key),s=t[n-1];s instanceof HTMLElement&&(s.click(),e.preventDefault(),ve({category:"Saved Replies",action:"shortcut",label:`saved reply number ${n}`}))}})),ft("change",".js-thread-notification-setting",pc),ft("change",".js-custom-thread-notification-option",pc),ft("reset",".js-custom-thread-settings-form",pc),ft("details-menu-selected",".js-discussion-sidebar-menu",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/issues/sidebar.ts:26");const t=e.detail.relatedTarget,s=e.currentTarget,o=p(t,".js-issue-sidebar-form"),r=s.hasAttribute("data-multiple");if(t.hasAttribute("data-clear-assignees")){const e=n(s,'input[name="issue[user_assignee_ids][]"]:checked',HTMLInputElement);for(const t of e)t.disabled=!1,t.checked=!1;gc(o)}else r?p(s,"details").addEventListener("toggle",hc,{once:!0}):gc(o)}),{capture:!0}),E(".js-issue-sidebar-form",(async function(e,t){const n=await t.html();if(!(e.parentNode instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/issues/sidebar.ts:52");p(e,".js-discussion-sidebar-item").replaceWith(n.html)})),ft("click","div.js-issue-sidebar-form .js-suggested-reviewer",(function(e){const t=e.currentTarget;if(!(t instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/issues/sidebar.ts:58");bc(p(t,".js-issue-sidebar-form"),"post",{name:t.name,value:t.value}),e.preventDefault()})),ft("click","div.js-issue-sidebar-form .js-issue-assign-self",(function(e){const t=e.currentTarget;if(!(t instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/issues/sidebar.ts:66");bc(p(t,".js-issue-sidebar-form"),"post",{name:t.name,value:t.value}),e.preventDefault()})),ft("click",".js-issue-unassign-self",(function(e){bc(p(e.currentTarget,".js-issue-sidebar-form"),"delete"),e.preventDefault()})),E(".js-pages-preview-toggle-form",(async function(e,n){const s=await n.json();t(e,"button.btn").textContent=s.json.new_button_value})),ft("change",".js-project-menu-checkbox",(function(e){const t=e.currentTarget;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/issues/sidebar.ts:104");const s=p(t,".js-project-menu-container");for(const o of n(s,".js-project-menu-checkbox",HTMLInputElement))if(o!==t&&o.name===t.name){o.checked=t.checked;const e=o.closest(".js-navigation-item");e&&e.classList.toggle("selected",t.checked);const n=o.closest("label[aria-checked]");n&&n.setAttribute("aria-checked",t.checked.toString())}})),ft("click","div.js-project-column-menu-container .js-project-column-menu-item button",(async function(e){const n=e.currentTarget;!function(e){const n=p(e,".js-project-column-menu-dropdown"),s=t(n,".js-project-column-menu-summary"),o=h(e,"data-column-name");s.textContent=o}(n);const s=h(n,"data-url");if(!(n.parentElement instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/issues/sidebar.ts:127");const o=t(n.parentElement,".js-data-url-csrf",HTMLInputElement),r=h(n,"data-card-id"),i=new FormData;i.append("card_id",r),i.append("use_automation_prioritization","true"),e.preventDefault(),await d(Me(s,o.value,{method:"put",body:i}));const a=document.activeElement,c=p(n,".js-project-column-menu-dropdown");if(a&&c.contains(a))try{a.blur()}catch(oh){}})),ft("click",".js-prompt-dismiss",(function(e){p(e.currentTarget,".js-prompt").remove()})),E(".js-new-issue-form",(async function(e,n){xe(t(document,".js-logbook-toast").innerHTML);const s=await n.json();s.json.toast?xe(s.json.toast):s.json.url&&(e.reset(),window.location=s.json.url)}));const wc=new WeakMap,jc=new WeakMap;ft("change",".js-issues-list-check",(function(){const e=!!document.querySelector(".js-issues-list-check:checked");t(document,"#js-issues-toolbar").classList.toggle("triage-mode",e);for(const t of document.querySelectorAll(".js-issue-triage-menu"))wc.set(t,!0)})),ft("toggle",".js-issue-triage-menu",(function(e){const s=e.currentTarget;if(!(s instanceof Element))throw new Error("invariant: app/assets/modules/github/issues/triage.ts:26");s.hasAttribute("open")?function(e){if(!wc.has(e))return;const s=t(document,".js-triage-loader-template",HTMLTemplateElement),o=t(e,".js-triage-deferred-content");o.innerHTML="",o.append(s.content.cloneNode(!0));const r=function(e,t){const n=new URL(e,window.location.origin),s=new URLSearchParams(n.search);for(const[o,r]of t)s.append(o,r);return n.search=s.toString(),n.toString()}(h(e,"data-url"),n(document,".js-issues-list-check:checked",HTMLInputElement).map(e=>[e.name,e.value]));t(o,"include-fragment").setAttribute("src",r),wc.delete(e)}(s):async function(e){const n=t(e,"form",HTMLFormElement);if(!jc.has(n))return;!function(e,n){const s=p(e,".js-issues-toolbar-triage");t(s,".js-issue-triage-spinner").hidden=!n,t(s,".js-issue-triage-error").hidden=!0}(e,!0);try{const e=await F(n.action,{method:n.method,body:new FormData(n)});jc.delete(n),await te(e.job.url,{headers:{accept:"application/json"}}),K({url:window.location.href,container:t(document,"#js-repo-pjax-container"),replace:!0})}catch(s){!function(e,n){const s=p(e,".js-issues-toolbar-triage");t(s,".js-issue-triage-spinner").hidden=!0,t(s,".js-issue-triage-error").hidden=!n}(e,!0)}}(s)}),{capture:!0}),ft("details-menu-selected",".js-issue-triage-menu details-menu",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/issues/triage.ts:78");const n=e.detail.relatedTarget,s=p(n,"form",HTMLFormElement),o=function(e){const t="true"===e.getAttribute("aria-checked"),n=e.getAttribute("name")||e.getAttribute("data-name"),s=e.getAttribute("value")||e.getAttribute("data-value");if(!n||!s)throw new Error("invariant: app/assets/modules/github/issues/triage.ts:97");const o=document.createElement("input");switch(o.type="hidden",o.name=n,e.getAttribute("role")){case"menuitem":case"menuitemradio":o.value=s;break;case"menuitemcheckbox":o.value=t?s:"0"}return o}(n),r=t(s,".js-issues-triage-fields"),i=r.querySelector(`[name='${o.name}']`);i?i.replaceWith(o):r.append(o);jc.set(s,!0)}),{capture:!0}),E(".js-undo-issue-event-form",async(e,t)=>{await t.text();const n=h(e,"action");e.remove();const s=document.querySelectorAll(`.js-undo-issue-event-form[action="${n}"]`);for(let o=0;o{i.appendChild(function(e,n,s,o){const r=e.cloneNode(!0);if(!(r instanceof HTMLElement))throw new Error("invariant: el instanceof HTMLElement");r.id=`jump-to-suggestion-${n.type.toLowerCase()}-${n.databaseId}`;const i=t(r,".js-jump-to-suggestion-path",HTMLAnchorElement);i.href=n.path,i.setAttribute("data-target-type",n.type),i.setAttribute("data-target-id",`${n.databaseId}`),i.setAttribute("data-client-rank",`${o}`),i.setAttribute("data-server-rank",`${n.rank}`);const a=t(r,".js-jump-to-suggestion-name");switch(a.textContent=n.name,a.setAttribute("aria-label",n.name),Jo(a,s.replace(/\s/g,"")),n.type){case"Team":{const e=t(r,".js-jump-to-suggestion-avatar",HTMLImageElement);e.alt=n.name,e.src=n.avatarUrl?n.avatarUrl:"",e.classList.remove("d-none");break}case"Project":Rc(r,".js-jump-to-octicon-project");break;case"Repository":Rc(r,".js-jump-to-octicon-repo")}return t(r,".js-jump-to-badge-jump").classList.remove("d-none"),r}(r,e,n,s))}),Pc(i))}function Pc(e){const s=t(document,".js-jump-to-suggestions-results-container");for(const t of n(s,".js-jump-to-suggestion")){if(!t.parentNode)throw new Error("invariant: oldResult.parentNode");t.parentNode.removeChild(t)}s.appendChild(e)}function Rc(e,n){const s=t(e,".js-jump-to-octicon"),o=t(s,n,SVGElement);s.classList.remove("d-none"),o.classList.remove("d-none")}function Fc(e,n,s,o){const r=e.cloneNode(!0);if(!(r instanceof HTMLElement))throw new Error("invariant: el instanceof HTMLElement");r.id=`jump-to-suggestion-search-${o?"scoped":"global"}`;const i=t(r,".js-jump-to-suggestion-path",HTMLAnchorElement);i.href=s,i.setAttribute("data-target-type","Search");const a=t(r,".js-jump-to-suggestion-name");a.textContent=n,a.setAttribute("aria-label",n),Rc(r,".js-jump-to-octicon-search");const c=t(r,".js-jump-to-badge-search");return c.classList.remove("d-none"),o?t(c,".js-jump-to-badge-search-text-default").classList.remove("d-none"):t(c,".js-jump-to-badge-search-text-global").classList.remove("d-none"),r}function Oc(e){const n=t(document,".js-jump-to-suggestions-container"),s=t(n,e).firstElementChild;if(!(s instanceof HTMLElement))throw new Error("invariant: template");return s}const Uc=new WeakMap,Wc=new WeakMap;function zc(e,t,n){const s=t.toLowerCase(),o=n.text,r=n.score;let i=e;if(s){i=[];for(const t of e){null==Uc.get(t)&&Uc.set(t,o(t));const e=r?r(Uc.get(t)||"",s,t):Ko(Uc.get(t)||"",s);Wc.set(t,e),e>0&&i.push(t)}i.sort(Vc)}return null!=n.limit?i.slice(0,n.limit):i}function Vc(e,t){const n=parseFloat(Wc.get(e)),s=parseFloat(Wc.get(t)),o=Uc.get(e)||"",r=Uc.get(t)||"";return n>s?-1:nr?1:0}const Kc=.6,Yc=.4;function Jc(e,t,n){const s=t.get(e)||0,o=n.get(e)||0;return s*Kc+o*Yc}function Xc(e){const t=[...Object.keys(e)].reduce((t,n)=>t+e[n].visitCount,0);return new Map(Object.keys(e).map(n=>[n,e[n].visitCount/t]))}function Gc(e){const t=[...Object.keys(e)].sort((t,n)=>e[t].lastVisitedAt-e[n].lastVisitedAt),n=t.length;return new Map(t.map((e,t)=>[e,(t+1)/n]))}function Qc(e){return!!(e?e.closest(".js-jump-to-field"):document.querySelector(".js-jump-to-field"))}function Zc(e,t){const n=e.value.trim(),s=function(e,t=null){const n=t||kc(),s=Xc(n),o=Gc(n);return e.map(e=>({suggestion:e,score:Jc(e.pageKey,s,o)})).sort((e,t)=>t.score-e.score).map(e=>e.suggestion)}(function(e,t,n){const s=e.replace(/\s/g,""),o=t.filter(e=>e.path!==n);return s?zc(o,s,{text:e=>e.name}):o}(n,t,window.location.pathname)),o=s.slice(0,7);_c({measures:{result_count:s.length,display_count:o.length,filter_count:t.length-s.length},context:{query:n,display_set:o.map(e=>[e.type,e.databaseId])}}),Bc(e,n,o),Ic("menu-activation")||Ic("query")}const el=/^\/orgs\/([a-z0-9-]+)\/teams\/([\w-]+)/,tl=[/^\/([^/]+)\/([^/]+)\/?$/,/^\/([^/]+)\/([^/]+)\/blob/,/^\/([^/]+)\/([^/]+)\/tree/,/^\/([^/]+)\/([^/]+)\/issues/,/^\/([^/]+)\/([^/]+)\/pulls?/,/^\/([^/]+)\/([^/]+)\/pulse/],nl=[["organization",/^\/orgs\/([a-z0-9-]+)\/projects\/([0-9-]+)/],["repository",/^\/([^/]+)\/([^/]+)\/projects\/([0-9-]+)/]];function sl(e){return Object.keys(e).length<=100?e:function(e){const t=Xc(e),n=Gc(e);return Object.keys(e).map(e=>({pageKey:e,score:Jc(e,t,n)})).sort((e,t)=>t.score-e.score).map(e=>e.pageKey)}(e).slice(0,50).reduce((t,n)=>(t[n]=e[n],t),{})}function ol(e,t){const n=kc(t),s=Math.floor(Date.now()/1e3),o=n[e]||{lastVisitedAt:s,visitCount:0};o.visitCount+=1,o.lastVisitedAt=s,n[e]=o,Tc(sl(n),t)}const rl=()=>{const e="test-storage-availability";try{return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),window.localStorage}catch(t){return null}};let il,al;async function cl(e){const t=function(e){const t=h(e,"data-jump-to-suggestions-path");return window.location.origin+t}(e),n=function(){const e=new FormData;for(const t of Object.keys(kc()))e.append("variables[pageViews][]",t);return e}(),s=Gs(e,"js-data-jump-to-suggestions-path-csrf");if(!(s instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/jump-to.ts:51");try{return function(e){if("errors"in e.data)return[];if(e.data.errors)return[];let t=1;const n=[];for(const s of e.data.suggestions.nodes)null!=s&&(s.rank=t++,s.pageKey=Mc(s),"Team"===s.type&&(s.name=`@${s.name}`),n.push(s));return n}(await F(Me(t,s.value,{method:"POST",body:n})))}catch(o){return[]}}async function ll(e){const t=e;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/jump-to.ts:62");!function(e){e.classList.add("js-navigation-enable"),e.classList.add("jump-to-field-active")}(t),$c(t),il||(il=cl(t)),Nc(t),ul(t),Zc(t,await il)}function ul(e){const n=e.value.trim(),s=t(document,".js-jump-to-suggestions-results-container");n?Ce(s):qe(s)}pt(".js-jump-to-field",{constructor:HTMLInputElement,add(e){try{!function(e,t=rl()){if(!t)return;const n=e.match(el);if(n)return void ol(Sc(n[1],n[2]),t);let s,o;for(let r=0,i=nl.length;r{!function(e){e.classList.remove("js-navigation-enable"),e.classList.remove("jump-to-field-active")}(e),Dc()},200)})),ft("focusin",".js-jump-to",(function(){clearTimeout(al),$c(t(document,".js-jump-to-field",HTMLInputElement))})),ft("click",".js-jump-to-suggestion-path",(function(e){const n=e.currentTarget;if(!(n instanceof HTMLAnchorElement))throw new Error("invariant: app/assets/modules/github/jump-to.ts:124");if("Search"===n.getAttribute("data-target-type")){const e=t(document,".js-jump-to-field",HTMLInputElement);n.href=function(e,t){const n=new URL(t,window.location.origin),s=new URLSearchParams(n.search.slice(1));return s.get("q")&&s.set("q",e),s.get("unscoped_q")&&s.set("unscoped_q",e),n.search=s.toString(),n.toString()}(e.value.trim(),n.href)}qc(n)})),ft("submit",".js-site-search-form",(function(e){if(!Qc())return;const t=e.target;t.getAttribute("data-scoped-search-url")&&_c({scope_type:t.getAttribute("data-scope-type"),scope_id:t.getAttribute("data-scope-id")}),Ic("search")}));let dl=0,ml=null;const fl=["ArrowUp","ArrowUp","ArrowDown","ArrowDown","ArrowLeft","ArrowRight","ArrowLeft","ArrowRight","b","a","Enter"];function pl(e){dl=e,function(e){let t=document.getElementById("konami-overlay");t||(t=document.createElement("div"),t.id="konami-overlay",t.classList.add("konami-overlay"),document&&document.body&&document.body.appendChild(t));if(!t)return;t.style.background=`rgba(0,0,0,${e+.24})`;const n=50*(1+e),s=(e,t)=>e+Math.round(Math.random()*(t-e));for(let o=0;ot&&t.prepend(o),r),setTimeout(()=>o.parentNode&&o.parentNode.removeChild(o),r+s(100,500))}}(dl/fl.length);const t=n(document,".js-konami-key");for(const n of t)n.classList.remove("active"),n.classList.remove("inactive"),n.classList.remove("complete"),n.classList.remove("down");const s=t.slice(0,dl),o=t.slice(dl,dl+1),r=t.slice(dl+2);for(const n of s)n.classList.add("complete");for(const n of o)n.classList.add("active");for(const n of r)n.classList.add("inactive")}function gl(e){if(!(e.target instanceof Node&&Ie(e.target)||dl>=fl.length||(fl.includes(J(e))&&(e.preventDefault(),e.stopPropagation()),J(e)!==fl[dl]))){const e=document.querySelectorAll(".js-konami-key")[dl];e&&e.classList.add("down")}}function hl(e){if(!(e.target instanceof Node&&Ie(e.target)||dl>=fl.length)){if(J(e)===fl[dl])pl(dl+1),dl===fl.length-1&&function(){const e=document.querySelector(".js-konami-success");e&&e.removeAttribute("hidden")}(),dl===fl.length&&function(){const e=document.querySelector(".js-konami-form");if(!(e instanceof HTMLFormElement))throw new Error("invariant: app/assets/modules/github/konami/konami.ts:128");L(e)}();else{if(!fl.includes(J(e)))return;pl(0)}e.preventDefault(),e.stopPropagation()}}function bl(){ml=null,document.removeEventListener("keydown",gl),document.removeEventListener("keyup",hl);const e=document.getElementById("konami-overlay");e&&e.parentNode&&e.parentNode.removeChild(e)}function vl(e){const n=e.currentTarget;if(!(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement))return;const s=parseInt(n.getAttribute("data-input-max-length")||"",10),o=parseInt(n.getAttribute("data-warning-length")||"",10)||5,r=n.value.replace(/(\r\n|\n|\r)/g,"\r\n");let i=s-r.length;if(i<=0){let e=r.substr(0,s);e.endsWith("\r")?(e=e.substr(0,s-1),i=1):i=0,n.value=e}const a=h(n,"data-warning-text"),c=p(n,".js-length-limited-input-container"),l=t(c,".js-length-limited-input-warning");i<=o?(l.textContent=a.replace(new RegExp("{{remaining}}","g"),`${i}`),l.classList.remove("d-none")):(l.textContent="",l.classList.add("d-none"))}function wl(e){const n=e.currentTarget;if(!(n instanceof HTMLElement))return;const s=t(n,".js-milestone-edit-cancel"),o=s.getAttribute("data-confirm-changes");o&&(_(n)?s.setAttribute("data-confirm",o):s.removeAttribute("data-confirm"))}function jl(e,t,n){const s=e.getAttribute("data-direction"),o=yl(t).indexOf(t);"up"===s&&t.previousElementSibling?t.previousElementSibling.insertAdjacentElement("beforebegin",t):"down"===s&&t.nextElementSibling&&t.nextElementSibling.insertAdjacentElement("afterend",t);const r=yl(t).indexOf(t);e.focus(),n({oldIndex:o,newIndex:r,item:t})}function yl(e){const t=e.parentElement;return Array.from(t.children)}ft("click",".js-konami",(async function(e){if(e.preventDefault(),ml)return;if(pl(5),document.addEventListener("keydown",gl),document.addEventListener("keyup",hl),!(e.target instanceof HTMLElement))return;const t=`/site/konami?return_to=${e.target.getAttribute("data-return-to")||""}`;ml=await D({content:$(document,t),dialogClass:"kb-konami-dialog container-xl"}),pl(dl),ml.addEventListener("dialog:remove",bl,{once:!0})})),ft("click",".js-details-target-new-label",(function({target:e}){if(!(e instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/labels/maintainer-label-prompt.ts:7");const n=Gs(e,"Popover");if(n){const e=t(n,"form",HTMLFormElement);L(e)}})),pt(".js-length-limited-input",{add(e){e.addEventListener("input",vl),e.addEventListener("change",vl)},remove(e){e.removeEventListener("input",vl),e.removeEventListener("change",vl)}}),pt("link[rel=prefetch-viewed]",{initialize(){window.requestIdleCallback(()=>{fetch(location.href,{method:"HEAD",credentials:"same-origin",headers:{Purpose:"prefetch-viewed"}})})}}),ft("click",".js-manage-requests-tabs-item",(function({currentTarget:e}){const n=p(e,".js-manage-memberships-container");t(n,".js-manage-invitations-tabs-item").classList.remove("selected"),e.classList.add("selected");const s=t(n,".js-manage-invitations-list"),o=t(n,".js-manage-requests-list");s.classList.add("d-none"),o.classList.remove("d-none")})),ft("click",".js-manage-invitations-tabs-item",(function({currentTarget:e}){const n=p(e,".js-manage-memberships-container");t(n,".js-manage-requests-tabs-item").classList.remove("selected"),e.classList.add("selected");const s=t(n,".js-manage-requests-list"),o=t(n,".js-manage-invitations-list");s.classList.add("d-none"),o.classList.remove("d-none")})),ft("change",".js-milestone-edit-form",wl),ft("click",".js-milestone-edit-form",wl);const El=new WeakMap,Ll=new WeakMap;ft("socket:message",".js-milestone-issues",(async function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/milestone-dragging.ts:29");const n=e.currentTarget,s=e.detail.data,o=t(n,".js-milestone-issues-container");if(Ll.has(o))return void Ll.delete(o);await R();const r=document.querySelector(".js-client-uid");r instanceof HTMLInputElement&&r.value===s.client_uid||async function(e){if($e(e))return;const t=h(e,"data-url"),n=await $(document,t);De(document,()=>{e.replaceWith(n)})}(n)})),E(".js-milestone-sort-form",(async function(e,n){const s=(await n.json()).json,o=t(e,".js-milestone-reorder-feedback");o.textContent="",s.error?t(e,".js-milestone-changed").classList.remove("d-none"):(t(e,".js-timestamp",HTMLInputElement).value=s.updated_at,o.textContent=o.getAttribute("data-success-text")||"")}));const Tl=gt((function(e){const{newIndex:n,item:s}=e,o=p(s,".js-milestone-issues-container"),r=s.getAttribute("data-id")||"",i=function(e,t){return e.querySelectorAll(".js-draggable-issue")[t]}(o,n-1),a=i&&i.getAttribute("data-id"),c=p(o,".js-milestone-sort-form",HTMLFormElement);t(c,".js-item-id",HTMLInputElement).value=r,t(c,".js-prev-id",HTMLInputElement).value=a||"",ve({category:"Milestone",action:"reorder",label:"string"==typeof e.trackingLabel?e.trackingLabel:"drag-and-drop"}),Ll.set(o,!0),L(c)}),200);function kl(e,t){Tl({item:t,newIndex:Array.from(e.querySelectorAll(".js-draggable-issue")).indexOf(t),trackingLabel:"keyboard-shortcut"}),Ne(p(t,".js-navigation-container"),t)}async function Ml(e){if(await function(e){return new Promise((function(t){function n(){e.hasFocus()&&(t(),e.removeEventListener("visibilitychange",n),window.removeEventListener("focus",n),window.removeEventListener("blur",n))}e.addEventListener("visibilitychange",n),window.addEventListener("focus",n),window.addEventListener("blur",n),n()}))}(document),await new Promise(e=>setTimeout(e,1e3)),!(e instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/oauth.ts:9");e instanceof HTMLButtonElement&&(e.disabled=!1)}function Sl(e){const t=p(e,".js-org-insights-hero-container");for(const s of n(t,"[role=tab]"))s.setAttribute("aria-selected",(s===e).toString());for(const s of n(t,"[role=tabpanel]"))s.hidden=e.id!==s.getAttribute("aria-labelledby");for(const s of n(document,".js-org-insights-period-selector-link",HTMLAnchorElement))s.hash=e.hash}ft("click",".js-draggable-issue .js-sortable-button",(function({currentTarget:e}){if(!(e instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/milestone-dragging.ts:92");jl(e,p(e,".js-draggable-issue"),Tl)})),ft("navigation:keydown",".js-draggable-issues-container .js-draggable-issue",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/milestone-dragging.ts:97");const t=e.currentTarget,n=p(t,".js-draggable-issues-container");if("J"===e.detail.hotkey){const s=t.nextElementSibling;s&&(s.after(t),kl(n,t),e.preventDefault(),e.stopPropagation())}else if("K"===e.detail.hotkey){const s=t.previousElementSibling;s&&(s.before(t),kl(n,t),e.preventDefault(),e.stopPropagation())}})),pt(".js-draggable-issues-container",{add:function(e){if(El.has(e))return;const t=_e.create(e,{animation:150,item:".js-draggable-issue",handle:".js-drag-handle",onUpdate:Tl,chosenClass:"is-dragging"});El.set(e,t)},remove:function(e){const t=El.get(e);t&&t.destroy()}}),ft("submit",".js-mobile-preference-form",({currentTarget:e})=>{t(e,".js-mobile-preference-anchor-field",HTMLInputElement).value=window.location.hash.substr(1)}),pt("#js-oauth-authorize-btn",e=>{Ml(e)}),async function(){await C,window._octo&&(window._octo.push(["enablePerformance"]),window._octo.push(["recordPageView"]))}(),pt(".js-octo-ga-id",e=>{window.ga(t=>{t&&e.setAttribute("content",t.get("clientId"))})}),pt(".js-octo-ga-id-input",e=>{window.ga(t=>{t&&e.setAttribute("value",t.get("clientId"))})}),document.addEventListener("pjax:complete",(function(){window._octo&&window._octo.push(["recordPageView"])})),ft("change",".js-two-factor-needs-enforced",(function({currentTarget:e}){if(!(e instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/orgs/2fa.ts:33");t(document,".js-confirm-2fa-modal").classList.toggle("d-none",!e.checked),t(document,".js-2fa-save-button").classList.toggle("d-none",e.checked)})),pt(".js-two-factor-enforcement-poller",(function(e){e.addEventListener("load",(function(){window.location.reload()}))})),ft("click",".js-org-insights-hero-container [role=tab]",({currentTarget:e})=>{e instanceof HTMLAnchorElement&&Sl(e)}),ie(()=>{const e=document.querySelector(".js-org-insights-hero-container");if(!e)return;const t=e.querySelector(`[href='${document.location.hash||"#insights-prs"}']`);t instanceof HTMLAnchorElement&&Sl(t)});const Al=new H,xl=()=>n(document,".js-invitations-team-suggestions-pagination > a",HTMLAnchorElement);function Hl(){const e=document.querySelector(".js-org-reinstate-forms"),t=document.querySelectorAll(".js-org-reinstate-option:checked");if(!e||1!==t.length)return;const n=h(t[0],"data-form"),s=e.getElementsByClassName("js-togglable-form");for(const r of s)r.classList.add("d-none");const o=document.getElementById(n);if(!o)throw new Error("invariant: app/assets/modules/github/orgs/invitations.ts:88");o.classList.remove("d-none")}function Cl(){const e=document.querySelector(".js-seats");if(!e)return _l();const t=h(e,"data-filled-seats");return parseInt(t)+_l()}function ql(){(function(){if(_l()<=0)return Il(".js-plan-no-change",!0),Il(".js-plan-changes",!0),!0;return!1})()||(function(){const e=document.querySelector(".js-filled-seats"),t=Cl();e&&null!==t&&(e.textContent=t.toString())}(),function(){const e=document.querySelector(".js-seats-remaining");if(e instanceof HTMLElement){e.hidden=!0;const n=$l()-Cl(),s=t(document,".js-seats-remaining-zero"),o=t(document,".js-seats-remaining-singular"),r=t(document,".js-seats-remaining-plural");if(s.hidden=0!==n,o.hidden=1!==n,n>1){t(document,".js-seats-remaining-update-target").textContent=String(n)}r.hidden=n<=1}}(),function(){const e=document.querySelector(".js-max-seats-warning");e instanceof HTMLElement&&(e.hidden=!Dl())}(),function(){const e=Cl();return $l(){const t=new URLSearchParams(window.location.search),s=new Set(t.getAll("team_ids[]")),o=n(document,e,HTMLInputElement);for(const n of o)n.checked?s.add(n.value):s.delete(n.value);return[...s]})(".js-invitation-toggle-team");for(const t of xl()){const n=t.getAttribute("href");if(n){const s=new URL(n,window.location.origin),o=new URLSearchParams(s.search.slice(1));o.delete("team_ids[]");for(const t of e)o.append("team_ids[]",t);s.search=o.toString(),t.setAttribute("href",s.toString())}}t(document,'[name="team_ids"]',HTMLInputElement).value=e.join(",")})),ft("click",".js-invitation-radio-role",(async function(){const e=(()=>{let e="";const t=n(document,".js-invitation-radio-role",HTMLInputElement);for(const n of t)n.checked&&(e=n.value);return e})();for(const t of xl()){const n=t.getAttribute("href");if(n){const s=new URL(n,window.location.origin),o=new URLSearchParams(s.search.slice(1));o.set("role",e),s.search=o.toString(),t.setAttribute("href",s.toString())}}})),ft("change",".js-org-reinstate-option",Hl),pt(".js-org-reinstate-forms",Hl),pt(".js-member-suggestion",(function(){const e=n(document,".js-badge").map(e=>t(e,"input",HTMLInputElement).value);if(0!==e.length)for(const t of n(document,".js-member-suggestion",HTMLLIElement)){const n=h(t,"data-autocomplete-value");if(e.includes(n)){t.classList.add("disabled"),t.setAttribute("aria-disabled","true");const e=t.querySelector(".js-non-member-warning-reason"),n=t.querySelector(".js-non-member-warning-action");if(e&&n)for(const t of[e,n])t.textContent=h(t,"data-markup"),t instanceof HTMLElement&&(t.hidden=!1)}}})),ft("combobox-commit",".js-badge-container .js-new-org-members-complete-results",e=>{const s=t(document,".js-badge-input",HTMLInputElement),o=t(document,".js-badges"),r=e.target;if(!(r instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/orgs/invitations.ts:121");const i=n(r,".js-badge-template",HTMLTemplateElement),a=n(document,".js-badge").map(e=>t(e,"input",HTMLInputElement).value);for(const n of i){const e=n.cloneNode(!0);if(!(e instanceof HTMLTemplateElement))throw new Error("invariant: app/assets/modules/github/orgs/invitations.ts:128");const s=e.content,r=t(s,"input",HTMLInputElement).value;a.includes(r)||o.append(s)}ql(),function(e){const t=e.currentTarget;if(t instanceof Element&&t.hasAttribute("data-ga-event")){const e=t.getAttribute("data-ga-event-category"),n=t.getAttribute("data-ga-event-action"),s=t.getAttribute("data-ga-event-label");window.ga("send","event",e,n,s)}const n=e.target;if(!(n instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/orgs/invitations.ts:434");Be(n)}(e),s.value="",s.setAttribute("placeholder","")}),ft("click",".js-badge-search-container .js-badge",e=>{const t=e.currentTarget;if(!(t instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/orgs/invitations.ts:145");"true"===h(t,"aria-pressed")?t.setAttribute("aria-pressed","false"):t.setAttribute("aria-pressed","true")}),ft("click",".js-badge-search-container",e=>{const n=e.currentTarget;if(!(n instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/orgs/invitations.ts:158");t(n,"input",HTMLInputElement).focus()}),ft("click",".js-badge-container .js-member-suggestion",()=>{t(document,".js-badge-input",HTMLInputElement).focus()}),f("keydown",".js-badge-search-container .js-badge-input",e=>{const t=e.target;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/orgs/invitations.ts:168");if(!(e instanceof KeyboardEvent))throw new Error("invariant: app/assets/modules/github/orgs/invitations.ts:169");const s=p(t,".js-badge-search-container"),o=n(s,'.js-badges .js-badge[aria-pressed="true"]'),r=s.getAttribute("data-allow-plan-increase"),i="Backspace"!==e.key||""!==t.value;if(!r&&Dl()&&i)e.preventDefault();else if(!i){if(0!==o.length)for(const e of o)e.remove(),Pl(e);else{const e=n(s,".js-badges .js-badge");if(0===e.length)return;const t=e[e.length-1];t.remove(),Pl(t)}ql()}}),ft("combobox-commit",".js-single-badge-container .js-new-org-members-complete-results",e=>{const s=e.target;if(!s)return;if(!(s instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/orgs/invitations.ts:336");const o=p(s,".js-single-badge-auto-complete"),r=p(s,".js-single-badge-container"),i=t(r,".js-single-badge-input",HTMLInputElement),a=t(r,".js-single-badge-search-container"),c=n(s,".js-badge-template",HTMLTemplateElement);for(const t of c){i.value="",i.setAttribute("placeholder",""),a.hidden=!0;const e=t.cloneNode(!0);if(!(e instanceof HTMLTemplateElement))throw new Error("invariant: app/assets/modules/github/orgs/invitations.ts:350");const n=e.content;r.append(n)}if(ql(),o.nextElementSibling){const e=o.nextElementSibling.querySelector(".js-single-badge-input");e instanceof HTMLInputElement&&e.select()}Bl()}),ft("click",".js-single-badge-remove",e=>{const t=p(e.currentTarget,".js-badge");t instanceof HTMLButtonElement&&Nl(t),ql(),Bl()}),ft("click",".js-invite-more-users",(function(){const e=n(document,".js-single-badge-auto-complete");if(0===e.length)return;const s=t(document,".js-multi-input-invites-container"),o=e[e.length-1].cloneNode(!0);if(!(o instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/orgs/invitations.ts:389");const r=o.getAttribute("data-single-invite-input-index");if(!r)return;const i=`${parseInt(r)+1}`,a=`new-org-members-complete-results-${i}`;o.setAttribute("aria-owns",a),o.setAttribute("data-single-invite-input-index",i),t(o,".js-new-org-members-complete-results").setAttribute("id",a);const c=o.querySelector(".js-badge");c instanceof HTMLButtonElement&&Nl(c),s.append(o),Bl()})),ft("click",".js-private-repo-creation-allowed",(function(e){const n=e.currentTarget;if(n instanceof HTMLInputElement){const e="true"===n.getAttribute("data-private-only-policy-allowed"),s=t(document,".js-public-repo-creation-allowed",HTMLInputElement),o=t(document,".js-public-disabled-doc-link");e||(n.checked?(s.disabled=!0,s.checked=!0,o.hidden=!1):(s.disabled=!1,o.hidden=!0))}})),ft("click",".js-membership-tab",(function(e){const n=h(e.currentTarget,"data-membership"),s=t(document,".js-member-filter-field",HTMLInputElement),o=s.value,r=new RegExp("membership:[a-z-]+"),i=o.toString().trim().replace(r,"");s.value=`${i} ${n}`.replace(/\s\s/," ").trim(),s.focus(),ht(s,"input"),t(document,".js-membership-tabs").classList.remove("selected"),e.currentTarget.classList.add("selected")})),ft("click",".js-member-search-filter",(function(e){e.preventDefault();const n=h(e.currentTarget,"data-filter"),s=p(e.currentTarget,"[data-filter-on]"),o=h(s,"data-filter-on"),r=t(document,".js-member-filter-field",HTMLInputElement),i=r.value,a=new RegExp(`${o}:(?:[a-z]|_)+`),c=i.toString().trim().replace(a,"");r.value=`${c} ${n}`.replace(/\s\s/," ").trim(),r.focus(),ht(r,"input")})),ft("submit",".js-needs-interstitial .js-approve-membership-request",(function(e){const n=e.currentTarget;if(!(n instanceof HTMLFormElement))throw new Error("invariant: app/assets/modules/github/orgs/members.ts:46");const s=h(t(n,"[data-member-name]"),"data-member-name"),o=h(n,"data-action-type"),r=p(n,".js-add-members-container");e.preventDefault(),Rl(r,s,o,null)})),ft("submit",".js-needs-interstitial.js-add-team-member-form",(function(e){const n=e.currentTarget;if(!(n instanceof HTMLFormElement))throw new Error("invariant: app/assets/modules/github/orgs/members.ts:55");const s=M(n,"member");if(!s.value)return;const o=h(n,"data-action-type"),r=t(document,".js-add-members-container");e.preventDefault();const i=n.getAttribute("data-return-to");Rl(r,s.value,o,i)})),pt("#add-team-member",(function(e){const n=t(e,"details-dialog"),s=n.innerHTML;e.addEventListener("toggle",(function({currentTarget:e}){if(!(e instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/orgs/members.ts:91");e.hasAttribute("open")||(n.innerHTML=s)}))})),E(".js-add-org-member-form",(async function(e,n){const s=t(document,".js-member-list");e.classList.add("is-sending");const o=document.querySelector(".flash-messages");let r;o&&o.remove();try{r=await n.json()}catch(c){if(!c.response&&!c.response.json)return;return void s.insertAdjacentHTML("beforebegin",c.response.json.message_html||"")}e.classList.remove("is-sending"),t(e,"auto-complete",S).value="";const i=t(Ae(document,r.json.list_item_html),"*"),a=i.getAttribute("data-login");if(a)for(const t of s.children)if(t.getAttribute("data-login")===a){t.remove();break}s.prepend(i)})),ft("auto-check-success",".js-new-organization-name",(function(e){const t=e.target;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/orgs/new.ts:10");for(const o of n(document,".js-enterprise-trial-link",HTMLAnchorElement))Ol(o,t.value);const s=p(t,"dd").querySelector(".js-field-hint-name");s&&(s.textContent=t.value)})),j(".js-company-name-input",(function(e){const t=e.target;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/orgs/new.ts:38");const n=t.form;if(!n)throw new Error("invariant: app/assets/modules/github/orgs/new.ts:40");const s=n.querySelectorAll(".js-company-name-text");if(0===s.length)return;const o=n.querySelector(".js-corp-tos-link"),r=n.querySelector(".js-tos-link");r&&(r.classList.add("d-none"),r.setAttribute("aria-hidden","true"),o&&(o.classList.remove("d-none"),o.setAttribute("aria-hidden","false")));for(const i of s)if(t.value){if(i.hasAttribute("data-wording")){const e=h(i,"data-wording");i.textContent=` ${e} ${t.value}`}else i.textContent=t.value}else i.textContent=""})),pt(".js-company-owned:not(:checked)",{constructor:HTMLInputElement,add(e){const n=e.form;if(!n)throw new Error("invariant: app/assets/modules/github/orgs/new.ts:81");const s=t(n,".js-company-name-input",HTMLInputElement),o=t(document,".js-company-name-text"),r=t(document,".js-corp-tos-link"),i=t(document,".js-tos-link");e.getAttribute("data-optional")&&s.removeAttribute("required"),w(s,""),i.classList.remove("d-none"),i.setAttribute("aria-hidden","false"),r.classList.add("d-none"),r.setAttribute("aria-hidden","true"),o.textContent=""}}),pt(".js-company-owned:checked",{constructor:HTMLInputElement,add(e){const t=e.form;if(!t)throw new Error("invariant: app/assets/modules/github/orgs/new.ts:104");const n=t.querySelector(".js-company-name-input");n&&(n.setAttribute("required",""),ht(n,"focus"),ht(n,"input"))}}),pt(".js-company-owned-autoselect",{constructor:HTMLInputElement,add(e){const n=e;function s(){if(n.checked&&n.form){const e=t(n.form,".js-company-owned",HTMLInputElement);w(e,!0)}}n.addEventListener("change",s),s()}}),E(".js-org-list-item .js-org-remove-item",(async function(e,t){p(e,".js-org-list-item").classList.add("d-none");try{await t.text()}catch(oh){p(e,".js-org-list-item").classList.remove("d-none");const n=e.getAttribute("data-error-message");if(n)return void alert(n)}p(e,".js-org-list-item").remove()})),ft("click",".js-plan-choice",e=>{const t=document.querySelector(".SignUpContinueActions"),s=e.target.value;Ul(s),null!=t&&t.classList.remove("has-removed-contents");const o=!(s&&"business_plus"===s);for(const r of n(document,".js-enterprise-choice",HTMLInputElement))r.disabled=o}),ft("click",".js-enterprise-choice",e=>{const t=document.querySelector(".js-billing-section"),n=document.querySelector(".SignUpContinueActions"),s=document.querySelector(".js-enterprise-contact"),o=document.querySelector(".js-enterprise-trial-link"),r=e.target.value,i=[t,n];if(s&&s.classList.toggle("has-removed-contents","server"!==r),o&&o.classList.toggle("has-removed-contents","server"===r),"cloud-trial"===r)t&&t.classList.add("has-removed-contents");else for(const a of i)null!=a&&a.classList.toggle("has-removed-contents","cloud"!==r);Ul("business_plus")}),ft("change",".js-enterprise-trial-industry",(function(e){if(!(e instanceof Event))throw new Error("invariant: app/assets/modules/github/orgs/new.ts:227");const t=e.target;if(!(t instanceof HTMLSelectElement))throw new Error("invariant: app/assets/modules/github/orgs/new.ts:229");const n=t.value,s=document.querySelector(".js-enterprise-trial-other-industry-field");s&&(s.hidden=n!==h(s,"data-trigger-option-value"))})),pt(".js-enterprise-trial-ga-id",{constructor:HTMLInputElement,initialize(e){const t=h(e,"data-field");window.ga((function(n){n&&w(e,n.get(t))}))}}),E(".js-onboarding-checklist-form, .js-onboarding-checklist-mark-as-complete",(async function(e,t,n){const s=p(e,".js-org-onboarding-checklist"),o=s.getAttribute("data-layout"),r=n.body;null!==r&&(r.append("from_onboarding_checklist","true"),null!==o&&r.append("layout",o));const i=await t.html();s.replaceWith(i.html)})),E(".js-select-repo-permission",(async function(e,n){const s=t(e,".js-permission-success"),o=t(e,".js-permission-error");let r;s.hidden=!0,o.hidden=!0,e.classList.add("is-loading");try{r=await n.json()}catch(oh){return e.classList.remove("is-loading"),void(o.hidden=!1)}e.classList.remove("is-loading"),s.hidden=!1;const i=e.closest(".js-org-repo");if(i){const e=r.json;i.classList.toggle("with-higher-access",e.members_with_higher_access)}})),E(".js-per-seat-invite-field, .js-per-seat-invite .js-org-remove-item",(async function(e,n){!function(e){for(const t in e.selectors){const n=e.selectors[t],s=document.querySelector(t);n&&s&&(s.textContent=n)}const n=100===e.filled_seats_percent;t(document,".js-need-more-seats").classList.toggle("d-none",!n),t(document,".js-add-org-member-form").classList.toggle("d-none",n)}((await n.json()).json)})),ft("click",".js-org-enable-saml",(function(e){if(!(e.currentTarget instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/orgs/security.ts:93");var t;e.currentTarget.checked?Yl(Vl()):(t=Vl())&&t.classList.add("d-none")})),ft("click",".js-saml-submit",(function(e){e.preventDefault();const t=e.currentTarget;if(!(t instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/orgs/security.ts:111");L(zl(),t)})),ft("click",".js-org-saml-confirm-enforce-button",(function(){Kl().value="true",L(zl())})),ft("submit",".js-saml-provider-settings-form",(function(e){e.preventDefault(),"test_settings"===Xl().name?Ql():"save_settings"===Xl().name&&(Jl()?async function(){(await D({content:t(document,"#disable-saml-confirmation",HTMLTemplateElement).content.cloneNode(!0)})).addEventListener("dialog:remove",Zl)}():Gl()?D({content:t(document,"#enforce-saml-confirmation",HTMLTemplateElement).content.cloneNode(!0)}):Ql())})),ft("click",".js-team-remove-user",(function(e){e.preventDefault();for(const t of document.querySelectorAll(".js-team-add-user-form"))t.classList.remove("d-none");t(document,".js-team-add-user-name").focus(),p(e.currentTarget,"li").remove()})),ft("click",".js-team-add-user-button",(function(e){e.preventDefault(),async function(e){const s=p(e,".js-team-add-user-form"),o=t(s,".js-team-add-user-name",HTMLInputElement),r=o.value;o.value="";const i=t(document,".js-team-user-logins");for(const t of i.querySelectorAll("li"))if(t.getAttribute("data-login")===r)return;if(!(await Pe("low")))return;const a=new URL(s.getAttribute("data-template-url")||"",window.location.origin),c=new URLSearchParams(a.search.slice(1));c.append("member",r),a.search=c.toString(),o.focus();const l=await $(document,a.toString());i.appendChild(l);for(const t of n(document,".js-login-field",HTMLInputElement))t.disabled=!1;s.classList.add("d-none")}(e.currentTarget)})),ft("click",".js-rename-owners-team-next-btn",(function(){const e=t(document,".js-rename-owners-team-about-content");e.hidden=!e.hidden;const n=t(document,".js-rename-owners-team-rename-form");n.hidden=!n.hidden})),ft("auto-complete-change",".js-add-child-team-completer",(async function({target:e}){if(!(e instanceof S))throw new Error("invariant: app/assets/modules/github/orgs/team-add-child.ts:11");if(!(e instanceof S))return;if(!e.value)return;const n=p(e,".js-add-team-container");eu(n,!0);const s=p(e,".js-add-child-team-form"),o=h(s,"data-change-parent-summary-path"),r=await $(document,o);t(s,".js-add-team-search").hidden=!0,t(s,".js-add-team-warning").append(r),eu(n,!1)})),ft("submit",".js-add-child-team-form",(function(e){const n=e.currentTarget,{value:s}=t(n,".js-add-child-team-completer",S);s||e.preventDefault()})),ft("details-dialog-close",".js-add-team-dialog",(function(e){const n=e.currentTarget,s=t(n,".js-add-team-container");t(n,".js-add-team-search").hidden=!1,t(n,".js-add-team-warning").innerHTML="",eu(s,!1)})),ft("click",".js-expandable-team-breadcrumbs .js-team-breadcrumb-trigger",(async function(e){const t=e.target;if(!(t instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/orgs/team-breadcrumbs.ts:7");const n=p(t,".js-expandable-team-breadcrumbs");n.classList.add("is-loading");try{await Re(n)}catch(oh){}n.classList.remove("is-loading")}));class tu{constructor(e,t,n){this.diffId=e,this.side=t,this.lineNumber=n,this.element=G(document,this.anchor())}sideForCommenting(){return this.element&&this.element.classList.contains("blob-num-context")?"right":{R:"right",L:"left"}[this.side]}isContext(){return!!this.element&&this.element.classList.contains("blob-num-context")}anchor(){return`${this.diffId}${this.anchorSuffix()}`}anchorSuffix(){return`${this.side}${this.lineNumber}`}is(e){return this.diffId===e.diffId&&this.side===e.side&&this.lineNumber===e.lineNumber}}class nu{constructor(e,t,n,s,o){this.elements=new Set,this.isParsed=!1,this.isSplit=!1,this._rows=new Set,this._isAcrossHunks=!1,this._isContextOnly=!0,this._includesExpandedLine=!1,this.diffId=e,this.diffTable=document.querySelector(`.js-diff-table[data-diff-anchor="${e}"]`),this.diffTable&&(this.isSplit=this.diffTable.classList.contains("js-file-diff-split")),this.start=new tu(e,t,n),this.end=new tu(e,s,o),this.lineCount=0,this.parse()}anchor(){const e=[];return e.push(this.start.anchor()),this.start.is(this.end)||e.push(this.end.anchorSuffix()),e.join("-")}parse(){if(!this.diffTable)return;let e=this.unify(this.diffTable.querySelectorAll(".js-linkable-line-number"));e=this.filterInRange(e),this.lineCount=e.length,this.elements=this.expandRelatedElements(e),this.isParsed=!0}unify(e){if(!this.isSplit)return Array.from(e);const t=[];let n=[],s=[];for(const o of e)o.classList.contains("blob-num-addition")?n.push(o):o.classList.contains("blob-num-deletion")?s.push(o):(t.push(...s,...n,o),n=[],s=[]);return t.push(...s,...n),t}filterInRange(e){if(!this.start.element||!this.end.element)return[];let t=e.indexOf(this.start.element),n=e.indexOf(this.end.element);if(t>n){[t,n]=[n,t];const[e,s]=[this.end,this.start];this.start=e,this.end=s}return e.slice(t,n+1)}isContextOnly(){return this.isParsed||this.parse(),this._isContextOnly}isAcrossHunks(){return this.isParsed||this.parse(),this._isAcrossHunks}includesExpandedLine(){return this.isParsed||this.parse(),this._includesExpandedLine}rows(){return this.isParsed||this.parse(),this._rows}expandRelatedElements(e){const t=this.isSplit,n=e[0],s=e[e.length-1];if(n&&s){const e=n.closest("[data-hunk]"),t=s.closest("[data-hunk]");if(e&&t){e.getAttribute("data-hunk")!==t.getAttribute("data-hunk")&&(this._isAcrossHunks=!0)}}return e.reduce((e,n)=>{!this._includesExpandedLine&&n.closest(".blob-expanded")&&(this._includesExpandedLine=!0);const s=n.parentElement;s instanceof HTMLElement&&this._rows.add(s);const o=n.classList.contains("blob-num-deletion")||n.classList.contains("blob-num-addition");if(o&&(this._isContextOnly=!1),!s)return e;if(t&&o){return Array.from(s.children).indexOf(n)<2?e.add(s.children[0]).add(s.children[1]):e.add(s.children[2]).add(s.children[3])}for(const t of Array.from(s.children))e.add(t);return e},new Set)}}function su(e){const t=e.match(/^#?(diff-[a-f0-9]+)(L|R)(\d+)(?:-(L|R)(\d+))?$/i);if(null!=t&&6===t.length)return t;const n=e.match(/^#?(discussion-diff-[0-9]+)(L|R)(\d+)(?:-(L|R)(\d+))?$/i);return null!=n&&6===n.length?n:null}let ou=null,ru=null,iu=!1,au=null;function cu(){return!!document.querySelector(".js-new-multi-line-comment-interaction-enabled")}function lu(){return ou}function uu(e){return!!e.closest(".js-multi-line-comments-enabled")}function du(e,t){if(!uu(e))return!1;const{start:{lineNumber:n},end:{lineNumber:s}}=t;return(n!==s||!t.isContextOnly())&&(!t.isAcrossHunks()&&!t.includesExpandedLine())}function mu(e){return p(e,".js-diff-table").classList.contains("is-selecting")}function fu(){ju(),window.history.replaceState(null,null,"#"),yu()}function pu(e,t){ju();let n=e.id;if(t){const t=su(n);if(!t)return;const s=t[1],o=t[2],r=t[3];if(ou&&ou.diffId===s){if(o===ou.start.side&&r{document.addEventListener("click",hu,{once:!0})},0)}function ju(e){const t=e||document.querySelector(".js-add-line-comment[data-start_side]");t&&(t.removeAttribute("data-start_side"),t.removeAttribute("data-start_position"),t.removeAttribute("data-start_line"),t.removeAttribute("data-startiscontext"),t.removeAttribute("data-endiscontext"))}function yu(){if(ou){for(const e of ou.elements)e.classList.remove("selected-line","selected-line-top","selected-line-bottom","selected-line-left","selected-line-right");ou=null}const e=su(window.location.hash);if(!e)return;const t=e[1],n=e[2],s=e[3],o=e[4]||n,r=e[5]||s;ou=new nu(t,n,+s,o,+r);const i=Array.from(ou.elements)[0];i&&(p(i,".js-diff-table").classList.contains("file-diff-split")?function(){if(!ou)return;for(const r of ou.elements)r.classList.add("selected-line");const e=[],t=[],n=[],s=[];for(const r of ou.rows()){const[o,i,a,c]=r.children;e.push(o),t.push(i),n.push(a),s.push(c)}function o(e){for(const[t,n]of e.entries()){if(n.classList.contains("empty-cell"))continue;const s=e[t-1];s&&s.classList.contains("selected-line")||n.classList.add("selected-line-top");const o=e[t+1];o&&o.classList.contains("selected-line")||n.classList.add("selected-line-bottom")}}o(e),o(t),o(n),o(s);for(const[r,i]of t.entries())s[r].classList.contains("selected-line")||i.classList.add("selected-line-right");for(const[r,i]of n.entries())t[r].classList.contains("selected-line")||i.classList.add("selected-line-left")}():function(){if(!ou)return;for(const s of ou.elements)s.classList.add("selected-line");const e=Array.from(ou.rows()),t=e[0];for(const s of t.children)s.classList.add("selected-line-top");const n=e[e.length-1];for(const s of n.children)s.classList.add("selected-line-bottom")}())}function Eu(e){const n=t(e,".js-inline-comment-form-container");n.classList.add("open"),t(n,".js-write-tab").click(),t(n,".js-comment-field").focus(),ht(n,"inlinecomment:focus")}function Lu(e){e.reset(),ju();const t=p(e,".js-inline-comment-form-container");t.classList.remove("open"),ht(t,"inlinecomment:collapse")}function Tu(e){const n=e.closest(".js-teams-write-a-post");return n?function(e){const n=t(e,".js-team-discussions-post-compose");n.classList.contains("d-none")||(n.classList.add("d-none"),t(e,".js-post-placeholder").classList.remove("d-none"),e.classList.remove("active")),t(e,".js-comment-form-error").classList.add("d-none")}(n):e.closest(".js-teams-reply-to-post")?function(e){if(!(e instanceof HTMLFormElement))throw new Error("invariant: app/assets/modules/github/orgs/team-discussions.ts:30");Lu(e)}(e):void 0}function ku(e){const t=e.closest(".js-teams-reply-to-post"),n=t&&t.querySelector(".js-comment-form-error");n&&n.classList.add("d-none")}function Mu(e,t){e.textContent=(parseInt(e.textContent)+t).toString()}function Su(e,n){if(e.classList.add("d-none"),!e.parentElement)throw new Error("invariant: app/assets/modules/github/orgs/team-discussions.ts:180");t(e.parentElement,n).classList.remove("d-none")}ft("mousedown",".js-add-line-comment",(function(e){const t=e.target.parentElement;if(!t)return;if(!uu(e.target))return;const n=gu(t);if(!n)return;const s=p(e.target,".js-diff-table");vu(s),au=n,iu=!0,e.target.addEventListener("mouseup",(function(){wu(s),au=null,iu=!1}),{once:!0}),ou&&ou.lineCount>1&&e.preventDefault()})),ft("mousedown",".js-linkable-line-number",(function(e){if(!(e instanceof MouseEvent))return;if(0!==e.button)return;const t=e.target;if(!(t instanceof Element))return;const n=p(t,".js-diff-table");n.classList.add("is-selecting"),vu(n),document.addEventListener("mouseup",(function(){p(t,".js-diff-table").classList.remove("is-selecting"),wu(n)}),{once:!0}),pu(t,e instanceof MouseEvent&&e.shiftKey),e.preventDefault()})),ie(yu),pt(".blob-expanded",yu),pt(".js-diff-progressive-loader",(function(e){e.addEventListener("load",yu)})),pt(".js-diff-entry-loader",(function(e){e.addEventListener("load",yu)})),ft("click",".js-toggle-inline-comment-form",(function(e){Eu(p(e.currentTarget,".js-line-comments"))})),ft("quote-selection",".js-line-comments",(function(e){Eu(e.currentTarget)})),f("keydown",".js-inline-comment-form-container form .js-comment-field",(function(e){const t=e.target;if(!(t instanceof HTMLTextAreaElement))throw new Error("invariant: app/assets/modules/github/behaviors/inline-comment.ts:33");if(!t.classList.contains("js-navigation-enable")&&"Escape"===e.key&&0===t.value.length){Lu(p(t,"form",HTMLFormElement)),e.preventDefault()}})),ft("click",".js-hide-inline-comment-form",(function(e){const t=p(e.currentTarget,"form",HTMLFormElement),n=p(e.currentTarget,".js-inline-comment-form-container").querySelector(".js-multi-line-preview");n&&(n.hidden=!0),!_(t)||confirm(h(e.target,"data-confirm-cancel-text"))?Lu(t):e.preventDefault()})),ft("click",".js-team-discussions-team-description-toggle",(function(){t(document,".js-team-discussions-team-description").classList.toggle("d-none"),t(document,".js-team-discussions-team-description-form").classList.toggle("d-none")})),ft("click",".js-team-discussions-post-toggle",(function(e){const n=p(e.target,".js-teams-write-a-post");n.classList.contains("active")||(n.classList.add("active"),t(n,".js-team-discussions-post-compose").classList.remove("d-none"),t(n,".js-post-placeholder").classList.add("d-none"),t(n,".js-title-field").focus())})),ft("click",".js-hide-post-form",(function(e){const t=p(e.target,".js-new-comment-form",HTMLFormElement);!_(t)||confirm(h(e.target,"data-confirm-cancel-text"))?Tu(e.target):e.preventDefault()})),ft("click",".js-hide-inline-comment-form",(function(e){ku(e.target)})),E(".js-new-comment-form",(async function(e,t){await t.text(),Tu(e),ku(e)})),E(".js-team-discussions-team-description-form",(async function(e,n){try{await n.text()}catch(oh){}const s=t(document,".js-team-discussions-team-description"),o=t(s,".description"),r=t(document,".js-team-discussions-team-description-field",HTMLTextAreaElement);s.classList.toggle("d-none"),e.classList.toggle("d-none"),r.value.trim()?(o.textContent=r.value,r.defaultValue=r.value):(o.textContent="This team has no description",r.defaultValue="")})),E(".js-comment-pin",(async function(e,n){const s=t(e,"button[type=submit]");s.blur(),await n.text();const o=t(e,".js-pinned-discussion-input",HTMLInputElement),r=document.querySelector("#pinned_posts_counter"),i=h(s,"aria-label"),a=h(s,"data-alternate-aria-label");s.setAttribute("data-alternate-aria-label",i),s.setAttribute("aria-label",a),s.classList.toggle("pinned");const c=s.classList.contains("pinned");if(r){Mu(r,c?1:-1);const t=p(r,".js-pinned-post-tab");if(!c&&t.classList.contains("selected")){!function(e){e.addEventListener("transitionend",(function(t){"opacity"===t.propertyName&&e.remove()}),{once:!0}),e.classList.add("fade-out")}(p(e,".js-comment-delete-container"))}}o.value=c?"0":"1"})),E(".js-comment-delete",(async function(e,t){await t.text();const n=e.closest(".discussion-post"),s=n&&n.querySelector(".js-comment-pin button[type=submit]");if(s&&s.classList.contains("pinned")){const e=document.querySelector("#pinned_posts_counter");e&&Mu(e,-1)}})),ft("quote-selection",".js-discussion-post",(function(e){const n=t(e.target,".js-inline-comment-form-container");n.classList.add("open"),t(n,".js-write-tab").click(),t(n,".js-comment-field").focus()})),E(".js-comment-subscribe",(async function(e,t){await t.text(),Su(e,".js-comment-unsubscribe")})),E(".js-comment-unsubscribe",(async function(e,t){await t.text(),Su(e,".js-comment-subscribe")})),E(".js-discussion-post-update",(async function(e,t){const n=e.closest(".js-comment");if(!n)return;const s=n.querySelector(".js-comment-title");if(!s)return;const o=await t.json();s.textContent=o.json.title})),async function(){await C;const e=document.querySelector(".js-show-discussion .js-mark-notification-form");e instanceof HTMLFormElement&&L(e)}();let Au=!1;function xu(e){t(document,".js-selected-group-mappings-container").hidden=e}function Hu(e){const n=p(e,"form",HTMLFormElement),s=n.querySelector(".js-selected-team-id"),o=s instanceof HTMLInputElement&&s.value,r=t(n,".js-team-privacy-closed"),i=t(n,".js-team-privacy-secret"),a=t(r,"input",HTMLInputElement),c=t(i,"input",HTMLInputElement);i.classList.toggle("text-gray",!!o),c.disabled=!!o,o&&(a.checked=!0)}function Cu(e){const s=t(e,".js-team-member-summary");t(s,".js-team-member-summary-text").textContent=function(e){const t=n(e,"input.js-team-member:checked",HTMLInputElement);return 0===t.length?null:t.length<=3?t.map(e=>h(e,"data-team-member-text")).join(", "):`${t.length} members selected`}(e)||h(s,"data-default-label")}function qu(e,t){const n=e.value;e.value=t.textContent||"",t.textContent=n}ft("click",".js-open-child-team",(function(e){if(Au)return;Au=!0;const t=e.currentTarget.getAttribute("data-parent-team-slug");if(!t)return;const n=document.querySelectorAll(`.js-child-team[data-parent-team-slug="${t}"]`),s=p(e.currentTarget,".js-team-row");if(s.classList.contains("is-open"))e.currentTarget.setAttribute("aria-expanded","false"),function(e,t){(function e(t){for(const n of t){const t=h(n,"data-team-slug"),s=document.querySelectorAll(`.js-child-team[data-parent-team-slug="${t}"]`);e(s),n.classList.remove("is-open"),n.classList.add("d-none")}})(t),e.classList.remove("is-open"),Au=!1}(s,n);else{e.currentTarget.setAttribute("aria-expanded","true"),async function(e,t,n){if(t.length){for(const e of t)e.classList.remove("d-none");e.classList.add("is-open"),Au=!1}else{const t=await $(document,n);e.after(t),e.classList.add("is-open"),Au=!1}}(s,n,h(e.currentTarget,"data-child-team-url"))}})),ft("click",".js-show-more-child-teams",(async function(e){if(Au)return;Au=!0;const t=e.currentTarget,n=p(t,".js-team-row"),s=h(t,"data-child-team-url"),o=n.parentNode,r=await $(document,s);n.before(r),o&&o.removeChild(n),Au=!1})),j(".js-team-ldap-group-field",(function(e){const t=e.currentTarget;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/orgs/team-import.ts:9");p(t,".form-group").classList.remove("errored")})),ft("auto-complete-change",".js-import-ldap-group-completer",(function({target:e}){if(!(e instanceof S))throw new Error("invariant: app/assets/modules/github/orgs/team-import.ts:13");const n=p(e,".js-ldap-group-adder"),s=t(e,".js-team-ldap-group-field",HTMLInputElement),o=t(n,".js-team-ldap-dn-field",HTMLInputElement);if(o.value="",e.value){const{dn:t,cn:n}=JSON.parse(e.value);s.value=n,o.value=t}})),E(".js-ldap-group-adder",(async function(e,n,s){s.headers.set("X-Context","import");const o=p(e,".js-ldap-import-groups-container");let r;try{r=await n.html()}catch(oh){return void(oh.response&&t(e,".form-group").classList.add("errored"))}const i=document.querySelector(".js-import-form-actions");o.classList.remove("is-empty"),t(o,".js-ldap-imported-groups").prepend(r.html),e.reset(),t(e,".js-team-ldap-group-field").focus(),i&&i.classList.remove("d-none")})),ft("submit",".js-team-remove-group",(function(e){p(e.currentTarget,".js-team").classList.add("is-removing"),t(document,".js-team-ldap-group-field").focus()})),E(".js-team-remove-group",(async function(e,n){try{await n.text()}catch(s){return void p(e,".js-team").classList.remove("is-removing")}p(e,".js-team").remove(),document.querySelector(".js-team:not(.is-removing)")||(t(document,".js-ldap-import-groups-container").classList.add("is-empty"),t(document,".js-import-form-actions").classList.add("d-none"))})),ft("click",".js-edit-team",(function(e){const n=p(e.currentTarget,".js-team");n.classList.contains("is-removing")||(n.classList.add("is-editing"),t(n,".js-team-name-field").focus())})),ft("click",".js-cancel-team-edit",(function(e){const n=p(e.currentTarget,".js-team"),s=t(n,".js-team-form",HTMLFormElement);n.classList.remove("is-editing"),s.reset()})),E(".js-team-form",(async function(e,t,n){n.headers.set("X-Context","import");const s=await t.html();p(e,".js-team").replaceWith(s.html)})),ft("details-menu-selected",".js-team-group-mapping-menu",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/orgs/team-external.ts:13");const n=e.detail.relatedTarget,s=h(n,"data-id"),o=h(n,"data-name"),r=h(n,"data-description"),i=t(document,".js-team-group-mapping-template",HTMLTemplateElement),a=document.importNode(i.content,!0),c=t(a,".js-group-mapping-hidden-name",HTMLInputElement),l=t(a,".js-group-mapping-hidden-description",HTMLInputElement);c.name=c.name.replace("{GROUP_ID}",s),l.name=l.name.replace("{GROUP_ID}",s),c.value=o,l.value=r,t(a,".js-group-mapping-name").textContent=o,t(a,".js-group-mapping-desc").textContent=r;const u=t(document,".js-selected-group-mappings");(function(e,t){return null!=t.querySelector(`input[name="team[group_mappings][${e}][name]"]`)})(s,u)||(u.append(a),xu(!1))}),{capture:!0}),ft("click",".js-remove-group-mapping",(function(e){p(e.currentTarget,".js-group-mapping-container").remove(),!!document.querySelector(".js-selected-group-mappings .js-group-mapping-container")||xu(!0)})),pt(".js-team-group-mapping-menu",(function(e){const n=t(e,"remote-input"),s=document.getElementById(h(n,"aria-owns"));s&&n.addEventListener("error",(function(){s.classList.add("is-error")}))})),ft("click",".js-team-search-filter",(function(e){e.preventDefault();const n=h(e.currentTarget,"data-filter"),s=p(e.currentTarget,"[data-filter-on]"),o=h(s,"data-filter-on"),r=t(document,".js-team-search-field",HTMLInputElement),i=new RegExp(`${o}:[a-z]+`),a=r.value.trim().replace(i,"");r.value=`${a} ${n}`.replace(/\s\s/," "),r.focus(),ht(r,"input")})),pt(".js-select-team-menu",(function(e){Hu(e)})),ft("details-menu-selected",".js-select-team-menu",(function(e){const n=e.target;if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/orgs/team-new.ts:35");const s=e.detail.relatedTarget;if(!(s instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/orgs/team-new.ts:37");t(n,".js-selected-team-id",HTMLInputElement).value=s.value,t(n,".js-already-selected-team-name",HTMLInputElement).value=h(s,"data-team-name"),Hu(n)}),{capture:!0}),ft("click",".js-create-team-button",(function(e){const n=p(e.currentTarget,"form"),s=n.querySelector(".js-already-selected-team-name");if(!(s instanceof HTMLInputElement))return;const o=n.querySelector(".js-original-team-visibility"),r=n.querySelector(".js-team-privacy-secret");if(!r)return;const i=t(r,"input",HTMLInputElement),a=function(e){return e.value!==e.getAttribute("data-original-team-name")}(s),c=function(e,t){return null!=e&&t.checked&&!["","SECRET"].includes(e.getAttribute("data-original-team-visibility"))}(o,i);if(a||c){e.preventDefault();const t=h(n,"data-important-changes-summary-url"),o=new URL(t,window.location.origin),r=new URLSearchParams(o.search.slice(1));r.append("parent_team",s.value),c&&r.append("visibility_changed",c.toString()),a&&r.append("parent_changed",a.toString()),o.search=r.toString(),D({content:$(document,o.toString()),dialogClass:"p-3"})}})),ft("click",".js-confirm-edit-team",(function(){t(document,".js-org-team-form",HTMLFormElement).submit()})),ft("auto-complete-change",".js-team-project-completer",(function({target:e}){if(!(e instanceof S))throw new Error("invariant: app/assets/modules/github/orgs/team-projects.ts:6");const n=p(e,"form",HTMLFormElement),s=M(n,"project_id"),o=t(n,".js-team-project-complete-field",HTMLInputElement);if(e.value){const{name:t,id:n}=JSON.parse(e.value);s.value=n,o.value=t}else s.value=""})),ft("details-menu-selected",".js-team-member-menu",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/orgs/team-review-request-delegation-exclusion.ts:23");Cu(p(e.currentTarget,".js-team-member-picker"))}),{capture:!0}),pt(".js-team-member-summary",(function(e){Cu(p(e,".js-team-member-picker"))})),pt(".js-org-transform-poller",(function(e){const t=e.getAttribute("data-redirect-url")||"";e.addEventListener("load",(function(){window.location.href=t}))})),pt(".js-transform-notice",{constructor:HTMLElement,add(e){const t=jt("org_transform_notice");for(const n of t){const t=document.createElement("span");try{t.textContent=atob(decodeURIComponent(n.value)),Et(n.key),e.appendChild(t),e.hidden=!1}catch(oh){}return}}}),ft("click","#load-readme",(function(e){const n=t(document,"#gollum-editor-body",HTMLTextAreaElement),s=t(document,"#editor-body-buffer"),o=t(document,"#undo-load-readme"),r=s.textContent,i=h(e.currentTarget,"data-readme-name");if(qu(n,s),!(e.currentTarget instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/pages-composer.ts:11");e.currentTarget instanceof HTMLButtonElement&&(e.currentTarget.disabled=!0,e.currentTarget.textContent=`${i} loaded`,o.classList.remove("d-none"),n.addEventListener("input",(function e(){n.value!==r&&(o.classList.add("d-none"),n.removeEventListener("input",e))})))})),ft("click","#undo-load-readme",(function(e){qu(t(document,"#gollum-editor-body",HTMLTextAreaElement),t(document,"#editor-body-buffer"));const n=t(document,"#load-readme",HTMLButtonElement),s=h(n,"data-readme-name");n.disabled=!1,n.textContent=`Load ${s}`,e.currentTarget.classList.add("d-none")}));let Iu=!1;function _u(e,t){return document.querySelector(`#${e}LC${t}`)}function $u({blobRange:e,anchorPrefix:t}){if(0!==document.querySelectorAll(".js-file-line").length&&(function(){for(const e of document.querySelectorAll(".js-file-line.highlighted"))e.classList.remove("highlighted");for(const e of document.querySelectorAll(".js-file-line .highlighted")){const t=p(e,".js-file-line");e.replaceWith(...e.childNodes),t.normalize()}}(),e))if(null===e.start.column||null===e.end.column)for(let n=e.start.line;n<=e.end.line;n+=1){const e=_u(t,n);e&&e.classList.add("highlighted")}else if(e.start.line===e.end.line&&null!=e.start.column&&null!=e.end.column){const n=We(e,e=>_u(t,e));if(n){const e=document.createElement("span");e.classList.add("highlighted"),ze(n,e)}}}function Du(){const e=Fe(window.location.hash);$u(e),function(){const e=document.querySelector(".js-file-line-actions");if(!e)return;const t=document.querySelectorAll(".js-file-line.highlighted"),n=t[0];if(n){!function(e){const t=[];for(const s of e)t.push(s.textContent);const n=document.getElementById("js-copy-lines");if(n instanceof ClipboardCopyElement){n.textContent=`Copy ${T(e.length,"line")}`,n.value=t.join("\n");const s=`Blob, copyLines, numLines:${e.length.toString()}`;n.setAttribute("data-ga-click",s)}}(t),function(e){const t=document.getElementById("js-view-git-blame");if(!t)return;t.setAttribute("data-ga-click",`Blob, viewGitBlame, numLines:${e.toString()}`)}(t.length);const s=function(e){const t=document.querySelector(".js-permalink-shortcut");if(t instanceof HTMLAnchorElement){const n=`${t.href}${window.location.hash}`,s=document.getElementById("js-copy-permalink");if(s instanceof ClipboardCopyElement){s.value=n;const t=`Blob, copyPermalink, numLines:${e.toString()}`;s.setAttribute("data-ga-click",t)}return n}}(t.length);s&&function(e,t){const n=document.getElementById("js-new-issue");if(n instanceof HTMLAnchorElement){if(!n.href)return;const s=new URL(n.href,window.location.origin),o=new URLSearchParams(s.search.slice(1));o.set("permalink",e),s.search=o.toString(),n.href=s.toString(),n.setAttribute("data-ga-click",`Blob, newIssue, numLines:${t.toString()}`)}}(s,t.length),e.style.top=`${n.offsetTop-2}px`,e.classList.remove("d-none")}else e.classList.add("d-none")}();const{blobRange:t,anchorPrefix:n}=e,s=t&&_u(n,t.start.line);if(!Iu&&s){s.scrollIntoView(),p(s,".blob-wrapper, .js-blob-wrapper").scrollLeft=0}Iu=!1}function Nu(e){Ve(e),ae(e)}async function Bu(e,t){let n;if(t){const s="R"===t.slice(-1)?"data-right-range":"data-left-range",o=e.getAttribute(s)||"";n=t+parseInt(o.split("-")[0],10)}else n=e.hash.slice(1);const s=h(e,"data-url"),o=new URL(s,window.location.origin),r=new URLSearchParams(o.search.slice(1));r.append("anchor",n),o.search=r.toString();const i=await $(document,o.toString()),a=p(e,".js-expandable-line"),c=function(e,t){const n=e.nextElementSibling;return n instanceof HTMLElement&&n.matches(t)?n:null}(a,".file-diff-line");c?se(c,()=>{a.replaceWith(i)}):a.replaceWith(i)}function Pu(e,t,s,o){const r=parseInt(s,10),i=parseInt(o||"",10);return n(e,".js-expand",HTMLAnchorElement).filter(e=>{const n="R"===t?"data-right-range":"data-left-range",s=(e.getAttribute(n)||"").split("-"),o=parseInt(s[0],10),a=parseInt(s[1],10);return o<=r&&r<=a||(r<=o&&a<=i||o<=i&&i<=a)})}ie((function(){if(document.querySelector(".js-file-line-container")){setTimeout(Du,0);const e=window.location.hash;for(const t of document.querySelectorAll(".js-update-url-with-hash"))if(t instanceof HTMLAnchorElement)t.hash=e;else if(t instanceof HTMLFormElement){const n=new URL(t.action,window.location.origin);n.hash=e,t.action=n.toString()}}})),ft("click",".js-line-number",(function(e){if(!(e instanceof MouseEvent))throw new Error("invariant: expected click event to be MouseEvent -- app/assets/modules/github/pages/blob/lines.ts:165");const t=Fe(e.currentTarget.id),{blobRange:n}=t;if(!n)throw new Error("invariant: expected line number clicks to match range -- app/assets/modules/github/pages/blob/lines.ts:168");const s=Oe(window.location.hash);s&&e.shiftKey&&(t.blobRange={start:s.start,end:n.end}),function(e){const t=window.scrollY;Iu=!0,e(),window.scrollTo(0,t)}(()=>{window.location.hash=Ue(t)})})),ft("submit",".js-jump-to-line-form",(function(e){const n=t(e.currentTarget,".js-jump-to-line-field",HTMLInputElement).value.replace(/[^\d-]/g,"").split("-").map(e=>parseInt(e,10)).filter(e=>e>0).sort((e,t)=>e-t);n.length&&(window.location.hash=`L${n.join("-L")}`),e.preventDefault()})),j(".js-csv-filter-field",(function(e){if(!(e.target instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/pages/blob/csv.ts:4");const t=e.target.value.toLowerCase();for(const n of document.querySelectorAll(".js-csv-data tbody tr"))n instanceof HTMLElement&&n.textContent&&(n.hidden=!!t&&!n.textContent.toLowerCase().includes(t))})),ft("navigation:keydown",".js-commits-list-item",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/pages/commits.ts:6");e.target instanceof Element&&"c"===e.detail.hotkey&&t(e.target,".js-navigation-open").click()})),ie((function(){const e=function(e){if(!e)return;const t=su(e);if(!t)return;const n=t[1],s=t[2],o=t[3],r=t[5];return{anchor:n,side:s,line:o,lastLine:r,hashFragment:n+s+o,partialHashFragment:n+s}}(window.location.hash);e&&(G(document,e.hashFragment)&&!e.lastLine||async function e(t,n){const{anchor:s,side:o,line:r,lastLine:i,hashFragment:a,partialHashFragment:c}=t,l=G(document,s);if(!l)return;const u=l.nextElementSibling;if(!u)return;const d=Pu(u,o,r,i);if(!d.length){const e=G(document,a);if(e)return void Nu(e);const t=u.querySelector(".js-diff-load-container");if(!t)return;try{await Ki(t);const e=G(document,a);e instanceof HTMLElement&&Nu(e)}catch(oh){Nu(u)}return}await function(e,t){return Promise.all(e.map(e=>Bu(e,t)))}(d,c);const m=G(document,a);Pu(u,o,r,i).length?e(t,n):m?Nu(m):n<1&&e(t,n+1)}(e,0))})),ft("click",".js-expand",(function(e){if(e.preventDefault(),!(e.currentTarget instanceof HTMLAnchorElement))throw new Error("invariant: app/assets/modules/github/pages/diffs/expander.ts:104");Bu(e.currentTarget)}));const Ru=new RegExp("```suggestion(?:.*)\n","i"),Fu=new RegExp("```(\n|$)");function Ou(e,t){const n=e.slice(0,t).split("\n");return e.split("\n")[n.length-1]}function Uu(e){const t=/^(\s+)/.exec(e);return t&&t[0]||""}function Wu(e,t,n=0){const s=t.substring(n,t.length),o=e.exec(s);return o?o.index+n:-1}function zu(e,t){const n=[];let s=0,o=-1;for(;(o=Wu(Ru,e,s))>-1;){s=o+"```suggestion".length;const t=Wu(Fu,e,s);if(-1===t)return!1;s=t+"```".length,n.push([o,t])}return n.some(e=>t>e[0]&&tfunction(e){const n=p(e,".js-review-state-classes").querySelectorAll("[data-pending-batched-suggestion]").length;for(const t of document.querySelectorAll(".js-pending-batched-suggested-changes-count"))t.textContent=String(n);const s=t(document,".js-reenable-add-to-batch").textContent;for(const t of document.querySelectorAll("[data-batched-suggestion-reenable-sibling]"))t.removeAttribute("data-batched-suggestion-reenable-sibling"),t.removeAttribute("disabled"),t.setAttribute("aria-label",s);if(n>0){e.hidden=!1;const n=t(e,".js-batched-suggested-changes-toggle");n.classList.add("anim-pulse-in"),n.addEventListener("animationend",()=>n.classList.remove("anim-pulse-in"),{once:!0});for(const e of document.querySelectorAll(".js-apply-single-suggestion"))e.classList.add("d-none");for(const e of document.querySelectorAll(".js-batched-suggested-changes-add")){const n=p(e,".js-suggested-change-form-container");if("true"===n.getAttribute("data-pending-batched-suggestion")||"true"===n.getAttribute("data-comment-pending")||"true"===n.getAttribute("data-outdated-comment")?e.classList.add("d-none"):e.classList.remove("d-none"),"true"===e.getAttribute("data-batched-suggestion-disabled-by-sibling")){e.removeAttribute("data-batched-suggestion-disabled-by-sibling"),e.setAttribute("disabled","disabled");const n=t(document,".js-one-suggestion-per-line").textContent;e.setAttribute("aria-label",n)}}for(const e of document.querySelectorAll(".js-batched-suggested-changes-remove")){"true"===p(e,".js-suggested-change-form-container").getAttribute("data-pending-batched-suggestion")?e.classList.remove("d-none"):e.classList.add("d-none")}for(const e of document.querySelectorAll(".js-focus-commit-suggestions-form-button")){const n=p(e,".js-suggested-change-form-container"),s="true"===n.getAttribute("data-comment-pending"),o="true"===n.getAttribute("data-outdated-comment"),r="true"===n.getAttribute("data-resolved-comment"),i=p(e,".js-inline-comments-container"),a="left"===t(i,'input[name="side"]',HTMLInputElement).value;s||o||r||a?e.classList.add("d-none"):e.classList.remove("d-none")}for(const e of document.querySelectorAll(".pending-batched-suggestion-label")){"true"===p(e,".js-suggested-change-form-container").getAttribute("data-pending-batched-suggestion")?e.classList.remove("d-none"):e.classList.add("d-none")}}else{e.hidden=!0;for(const e of document.querySelectorAll(".js-apply-single-suggestion"))e.classList.remove("d-none");for(const e of document.querySelectorAll(".js-batched-suggested-changes-add"))e.classList.remove("d-none");for(const e of document.querySelectorAll(".js-batched-suggested-changes-remove"))e.classList.add("d-none");for(const e of document.querySelectorAll(".js-focus-commit-suggestions-form-button"))e.classList.add("d-none");for(const e of document.querySelectorAll(".pending-batched-suggestion-label"))e.classList.add("d-none")}}(e))}function ld(e,n){const s=t(e,"input[name=commit_title]",HTMLInputElement),o=t(e,"textarea[name=commit_message]",HTMLTextAreaElement);let r=s.value.trim();""===r&&(r=s.defaultValue);const i=o.value.trim();""!==i&&(r=`${r}\n\n${i}\n`),s.disabled=!0,o.disabled=!0;const a=document.createElement("input");a.setAttribute("type","hidden"),a.setAttribute("name","message"),a.value=r,e.appendChild(a);const c=document.createElement("input");c.setAttribute("type","hidden"),c.setAttribute("name","changes"),c.value=JSON.stringify(n),e.appendChild(c)}function ud(e,t){const n=e.nextElementSibling;return n&&n.matches(t)?n:null}function dd(e){const t=e.querySelector(".js-toggle-file-notes");t instanceof HTMLInputElement&&w(t,!0)}function md(){for(const e of document.querySelectorAll(".file .js-inline-comments-container")){const t=e.querySelectorAll(".js-comments-holder > *").length>0,n=e.querySelector(".js-inline-comment-form-container"),s=!!n&&n.classList.contains("open");t||s||e.remove()}}function fd(e){const n=t(document,e).firstElementChild;if(!n)throw new Error("invariant: app/assets/modules/github/pages/diffs/line-comments.ts:184");const s=n.cloneNode(!0),o=s.querySelector("textarea");return o instanceof HTMLTextAreaElement&&(o.value=""),s}async function pd(e){const t=e.querySelector(".js-suggestion-button-placeholder");if(!t)return;const n=t.getAttribute("data-src-base");if(!n)return;const s=new URL(n,window.location.origin),o=t.closest(".js-inline-comment-form")||t.closest(".js-comment-update");if(!(o instanceof HTMLFormElement))return;const r=function(e,t){const n=new URLSearchParams(e.search.slice(1)),s=t.elements.namedItem("in_reply_to")||t.elements.namedItem("comment_id");if(s instanceof HTMLInputElement&&s.value)return n.append("comment_id",s.value),n;const o=t.elements.namedItem("path"),r=t.elements.namedItem("start_side"),i=t.elements.namedItem("start_line"),a=t.elements.namedItem("side"),c=t.elements.namedItem("line"),l=t.elements.namedItem("start_commit_oid"),u=t.elements.namedItem("end_commit_oid"),d=t.elements.namedItem("base_commit_oid");return o instanceof HTMLInputElement&&r instanceof HTMLInputElement&&i instanceof HTMLInputElement&&a instanceof HTMLInputElement&&c instanceof HTMLInputElement&&l instanceof HTMLInputElement&&u instanceof HTMLInputElement&&d instanceof HTMLInputElement?(n.append("path",o.value),n.append("start_side",r.value),n.append("start_line",i.value),n.append("end_side",a.value),n.append("end_line",c.value),n.append("start_commit_oid",l.value),n.append("end_commit_oid",u.value),n.append("base_commit_oid",d.value),n):null}(s,o);if(!r)return;s.search=r.toString();const i=await $(document,s.toString());t.innerHTML="",t.appendChild(i)}function gd(e,t,n,s){if(e.classList.remove("bg-green-light","bg-red-light"),!s)return"right"===n?(e.classList.add("color-green-6"),void(e.textContent=`+${t}`)):"left"===n?(e.classList.add("text-red"),void(e.textContent=`-${t}`)):void(e.textContent=String(t));e.textContent=t}ft("click",".js-suggested-change-toolbar-item",(function(e){const t=e.currentTarget;t instanceof HTMLButtonElement&&!t.disabled&&nd(t)})),ft("click",".js-refresh-after-suggestion",(function(){window.location.reload()})),pt(".js-inline-comments-container",{add(e){ad(e)}}),pt(".js-preview-body .js-apply-changes",{add(e){const n=e.closest(".js-suggested-changes-container");if(!n)return e.remove();const s=t(document,Gu).textContent,o=t(document,Xu).textContent,r=p(e,".js-suggested-changes-blob");if(""!==n.getAttribute("data-thread-side")){if("left"===n.getAttribute("data-thread-side"))return id(o,r),e.remove()}else{const n=p(e,".js-inline-comment-form"),s=t(n,'input[name="side"]',HTMLInputElement);if(!n||!s)return e.remove();if(n&&"left"===s.value)return id(o,r),e.remove()}const i=e.previousElementSibling;if(!i)throw new Error("invariant: app/assets/modules/github/pulls/suggested-changes.ts:145");const a=i.querySelector(".js-blob-code-deletion"),c=i.querySelectorAll(".js-blob-code-addition");return a&&0!==c.length?a.textContent===Array.from(c).map(e=>e.textContent).join("\n")?(id(s,r),e.remove()):void e.remove():void 0}}),pt(".js-comment-body .js-apply-changes",{add(e){const s=e.closest(".js-suggested-changes-container");if(!s)return e.remove();const o=s.querySelector(".js-suggested-changes-template");if(!(o instanceof HTMLTemplateElement))return e.remove();const r=o.content.cloneNode(!0),i=t(r,".js-disabled-apply-suggestion-button");let a;try{a=t(r,".js-batched-suggested-changes-add")}catch(v){if("QueryError"!==v.name)throw v}if(n(document,".js-suggested-changes-files-tab").length){const e=t(document,Vu).textContent;a&&(a.removeAttribute("disabled"),a.setAttribute("aria-label",e))}const c=t(document,".js-pull-header-details"),l=c&&"true"===c.getAttribute("data-pull-is-open"),u=e.closest(".js-resolvable-timeline-thread-container"),d="true"===o.getAttribute("data-comment-pending"),m=s.classList.contains("js-selection-contains-deletions"),f=s.classList.contains("js-multi-line-suggestions-disabled");if(u&&"true"===u.getAttribute("data-resolved")){const n=t(document,Zu).textContent,s=r.querySelector("details");return s&&s.remove(),rd(i,n),a&&(a.setAttribute("disabled","disabled"),a.setAttribute("aria-label",n)),e.replaceWith(r)}if(!l){const n=t(document,Yu).textContent;return rd(i,n),a&&(a.setAttribute("disabled","disabled"),a.setAttribute("aria-label",n)),e.replaceWith(r)}if(d){const n=t(document,ed).textContent;return t(r,"details").remove(),rd(i,n),a&&(a.setAttribute("disabled","disabled"),a.setAttribute("aria-label",n)),e.replaceWith(r)}if(m){const n=t(document,Xu).textContent;return t(r,"details").remove(),rd(i,n),a&&(a.setAttribute("disabled","disabled"),a.setAttribute("aria-label",n)),e.replaceWith(r)}if(f){const n=t(document,td).textContent;return t(r,"details").remove(),rd(i,n),a&&(a.setAttribute("disabled","disabled"),a.setAttribute("aria-label",n)),e.replaceWith(r)}const p=document.querySelector(".js-suggested-changes-subset-files"),g="true"===o.getAttribute("data-outdated-comment");if(p||g){let n;return p?n=t(document,Ju).textContent:g&&(n=t(document,Qu).textContent),t(r,"details").remove(),rd(i,n),a&&(a.setAttribute("disabled","disabled"),a.setAttribute("aria-label",n)),e.replaceWith(r)}const h=t(r,".js-single-suggested-change-form"),b=e.closest(".js-suggested-changes-blob");if(b){const e=b.querySelector(".js-blob-code-deletion"),n=b.querySelectorAll(".js-blob-code-addition");if(!e)return;const s=e.textContent,o=Array.from(n).map(e=>e.textContent);if(o.length>0&&s===o.join("\n")){const e=t(document,Ku).textContent;t(r,"details").remove(),rd(i,e),a&&(a.setAttribute("disabled","disabled"),a.setAttribute("aria-label",e))}else for(const t of o){const e=document.createElement("input");e.setAttribute("type","hidden"),e.setAttribute("name","value[]"),e.value=t,h.appendChild(e)}}e.replaceWith(r)}}),pt(".js-pull-header-details",{add(e){const n="true"===e.getAttribute("data-pull-is-open"),s=document.querySelector(".js-suggested-changes-template");if(n||!(s instanceof HTMLTemplateElement))return;const o=s.content,r=t(document,Yu).textContent;sd(o,r),od(r)}}),pt(".js-suggested-changes-subset-files",{add(){const e=document.querySelector(".js-suggested-changes-template");if(!(e instanceof HTMLTemplateElement))return;const n=e.content,s=t(document,Ju).textContent;sd(n,s),od(s)}}),ft("click",".js-apply-suggestion-button",(async function(e){const n=e.currentTarget.parentElement;if(n){const e=t(n,".js-suggestion-commit-title");setTimeout(()=>e.focus(),1)}})),ft("click",".js-dismiss-suggested-change-onboarding-notice",(async function(e){const n=h(e.currentTarget,"data-url");if(!(e.currentTarget.parentElement instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/pulls/suggested-changes.ts:339");const s=t(e.currentTarget.parentElement,".js-data-url-csrf",HTMLInputElement),o=new FormData;o.append("notice","suggested_changes_onboarding_prompt"),await N(Me(n,s.value,{method:"post",body:o}));const r=document.querySelectorAll(".js-suggested-change-onboarding-notice");for(const t of r)t.remove()})),f("keypress",".js-comment-field",(function(e){if("Enter"===e.key){const t=e.target;if(!(t instanceof HTMLTextAreaElement))throw new Error("invariant: app/assets/modules/github/pulls/suggested-changes.ts:355");(function(e){const t=e.selectionStart;if(!zu(e.value,t))return!1;const n=e.value,s=Ou(n,t);if(null===s)return!1;const o=`\n${Uu(s)}`,r=n.substr(0,t)+o+n.substr(t);w(e,r);const i=t+o.length;return e.setSelectionRange(i,i),!0})(t)&&e.preventDefault()}})),f("keypress",".js-suggestion-commit-message",(function(e){const t=e.currentTarget;if(!(t instanceof HTMLTextAreaElement))throw new Error("invariant: app/assets/modules/github/pulls/suggested-changes.ts:363");"Enter"===e.key&&t.setAttribute("rows","3")})),ft("click",".js-batched-suggested-changes-add",(function(e){const t=e.target,n=p(t,".js-suggested-change-form-container");if("true"===n.getAttribute("data-comment-pending")||"true"===n.getAttribute("data-outdated-comment")||"true"===t.getAttribute("data-batched-suggestion-disabled-by-sibling"))return;n.setAttribute("data-pending-batched-suggestion","true");const s=p(t,".js-inline-comments-container");for(const o of s.querySelectorAll(".js-batched-suggested-changes-add"))o.setAttribute("data-batched-suggestion-disabled-by-sibling","true");t.removeAttribute("data-batched-suggestion-disabled-by-sibling"),cd()})),ft("click",".js-batched-suggested-changes-remove",(function(e){p(e.currentTarget,".js-suggested-change-form-container").removeAttribute("data-pending-batched-suggestion");const t=p(e.currentTarget,".js-inline-comments-container");for(const n of t.querySelectorAll(".js-batched-suggested-changes-add"))n.setAttribute("data-batched-suggestion-reenable-sibling","true");cd()})),ft("click",".js-focus-commit-suggestions-form-button",(function(e){e.preventDefault(),window.location.href="#clear-commit-suggestions",window.location.href="#commit-suggestions"})),ft("click",".js-dismiss-batched-suggested-changes-onboarding-notice",(async function(e){const n=h(e.currentTarget,"data-url");if(!(e.currentTarget.parentElement instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/pulls/suggested-changes.ts:509");const s=t(e.currentTarget.parentElement,".js-data-url-csrf",HTMLInputElement),o=new FormData;o.append("notice","batched_suggested_changes_onboarding_prompt"),await N(Me(n,s.value,{method:"post",body:o}));for(const t of document.querySelectorAll(".js-batched-suggested-change-onboarding-notice"))t.remove()})),ft("click",".js-single-suggested-change-form .js-suggested-changes-submit",(function(e){try{const s=e.currentTarget,o=p(s,".js-single-suggested-change-form",HTMLFormElement),r=n(o,'input[name="value[]"]',HTMLInputElement).map(e=>e.value);ld(o,[{commentId:t(o,"input[name=comment_id]",HTMLInputElement).value,path:t(o,"input[name=path]",HTMLInputElement).value,suggestion:r}])}catch(oh){xt(oh)}})),E(".js-single-suggested-change-form",(async function(e,n){const s=p(e,".js-suggested-change-form-container"),o=p(e,"details"),r=t(s,".js-suggestion-applied"),i=p(e,".js-suggested-changes-contents"),a=t(i,".js-error-message-placeholder");try{await n.json(),r.classList.remove("d-none"),t(s,".js-batched-suggested-changes-add").classList.add("d-none"),o.remove(),window.location.reload()}catch(c){if("QueryError"!==c.name){const n=c.response.json&&c.response.json.error,r=t(a,".js-error-message");a.hidden=!1,r.textContent=n,s.prepend(a);const i=p(e,".js-suggested-change-form-container");t(i,".js-batched-suggested-changes-add").classList.add("d-none"),o.remove()}}})),ft("click",".js-suggestion-batch-submit",(function(e){const s=p(e.currentTarget,".js-batched-suggested-changes-form",HTMLFormElement),o=[];try{for(const e of document.querySelectorAll("[data-pending-batched-suggestion]")){const s=t(e,".js-single-suggested-change-form",HTMLFormElement),r=n(s,'input[name="value[]"]',HTMLInputElement).map(e=>e.value);o.push({commentId:t(s,"input[name=comment_id]",HTMLInputElement).value,path:t(s,"input[name=path]",HTMLInputElement).value,suggestion:r})}ld(s,o)}catch(oh){xt(oh)}})),E(".js-batched-suggested-changes-form",(async function(e,n){try{await n.json(),p(e,".js-batched-suggested-changes-container",HTMLElement).hidden=!0,window.location.reload()}catch(s){const n=s.response.json&&s.response.json.error,o=p(e,".js-batched-suggested-changes-container"),r=t(o,".js-error-message-container");t(r,".js-error-message").textContent=n,r.hidden=!1}})),pt(".js-files-tab-stale",{add(){const e=document.querySelector(".js-batched-suggested-changes-container");e&&setTimeout(()=>{e.hidden=!0})}}),ft("click",".js-add-single-line-comment",(function(e){const n=e.currentTarget;if(!(n instanceof Element))throw new Error("invariant: app/assets/modules/github/pages/diffs/line-comments.ts:18");dd(p(n,".file"));const s=function(e){const n=p(e,"tr"),s=ud(n,".js-inline-comments-container");if(s instanceof Element){const e=t(n,"button.js-add-line-comment"),o=Array.from(s.querySelectorAll(".js-inline-comment-form")).pop();return o instanceof HTMLFormElement&&bd(o,e),s}}(n)||function(e){const t=p(e,"tr"),n=fd("#js-inline-comments-single-container-template"),s=n.querySelector(".js-inline-comment-form");s instanceof HTMLFormElement&&bd(s,e);return t.after(n),n}(n);Eu(Array.from(s.querySelectorAll(".js-line-comments")).pop())})),ft("click",".js-add-split-line-comment",(function(e){const t=e.currentTarget;dd(p(t,".file"));const n=p(t,"tr"),s="addition"===t.getAttribute("data-type")?"js-addition":"js-deletion",o=function(e,t,n){const s=e.querySelector(`.js-line-comments.${t}`);if(s){const e=Array.from(s.querySelectorAll(".js-inline-comment-form")).pop();if(!(e instanceof HTMLFormElement))throw new Error("invariant: app/assets/modules/github/pages/diffs/line-comments.ts:275");return bd(e,n),s}const o=fd("#js-inline-comments-split-form-container-template");o.classList.add(t);const r=o.querySelector(".js-inline-comment-form");r instanceof HTMLFormElement&&bd(r,n);const i=e.querySelectorAll(`.${t}`);i[i.length-1].after(o);for(const a of i)a.remove();return o}(function(e){let t=ud(e,".js-inline-comments-container");return t||(t=fd("#js-inline-comments-split-container-template"),e.after(t),t)}(n),s,t);Eu(Array.from(o.querySelectorAll(".js-line-comments")).pop())})),E(".js-inline-comment-form",(async function(e,n){let s;try{s=await n.json()}catch(c){if(c.response){let n;try{n=c.response.json}catch(l){}if(n)return void function(e,n){const s=t(e,".js-comment-form-error");let o;o=n.errors?Array.isArray(n.errors)?n.errors.join(", "):n.errors:"There was an error posting your comment.";s.textContent=o,s.style.display="block",s.classList.remove("d-none")}(e,n)}throw c}const o=s.json,r=o.inline_comment,i=e.closest(".js-line-comments");if(r){if(!i)throw new Error("invariant: app/assets/modules/github/pages/diffs/line-comments.ts:96");t(i,".js-comments-holder").append(Ae(document,r))}const a=o.inline_comment_thread;if(a){if(!i)throw new Error("invariant: app/assets/modules/github/pages/diffs/line-comments.ts:102");i.replaceWith(Ae(document,a))}Lu(e)})),document.addEventListener("session:resume",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/pages/diffs/line-comments.ts:155");!function(e){const[t,n]=e.match(/^new_inline_comment_(?:discussion|diff)_(?:[\w-]+)_(\d+)_(\d+)$/)||[];if(!t)return;const s=document.querySelector(`.js-inline-comment-form input[name='in_reply_to'][value='${n}']`);if(!s)return;const o=s.closest(".js-line-comments");o&&Eu(o)}(e.detail.targetId),function(e){const[t,n]=e.match(/^new_inline_comment_diff_(?:[\w-]+)_(\d+)$/)||[];if(!t)return;const s=document.querySelector(`.js-add-line-comment[data-anchor='${t}'][data-position='${n}']`);s&&s.click()}(e.detail.targetId)})),pt(".js-comment",{remove:md}),ft("inlinecomment:focus",".js-inline-comment-form-container",(function(e){if(!(e.target instanceof Element))throw new Error("invariant: app/assets/modules/github/pages/diffs/line-comments.ts:195");const t=e.target.querySelector(".js-suggested-changes-container");t&&pd(t)})),pt(".js-suggested-changes-container.is-comment-editing",e=>{pd(e)}),document.addEventListener("inlinecomment:collapse",()=>{md()});const hd={R:"right",L:"left"};function bd(e,n){const s=["type","path","position","line","side","original-line"];cu()||(s.push("start_line"),s.push("start_position"),s.push("start_side"));for(const t of s){const s=e.elements.namedItem(t);if(s instanceof HTMLInputElement){const e=n.getAttribute(`data-${t}`)||"";s.value=e}}if(cu())!function(e,n){const s=lu();if(!s)return;if(s.end.is(s.start))return;if(!du(n,s))return void fu();const{start:{side:o,lineNumber:r},end:{side:i,lineNumber:a}}=s,c=Number(n.getAttribute("data-line")),l=n.getAttribute("data-side");if(c!==a||!s.end.isContext()&&l!==hd[i])return void fu();const u=hd[o],d=e.elements.namedItem("start_line"),m=e.elements.namedItem("start_side"),f=e.elements.namedItem("line"),g=e.elements.namedItem("side"),h=e.elements.namedItem("preview_start_side"),b=e.elements.namedItem("preview_side");if(d instanceof HTMLInputElement&&m instanceof HTMLInputElement&&f instanceof HTMLInputElement&&g instanceof HTMLInputElement&&h instanceof HTMLInputElement&&b instanceof HTMLInputElement){d.value=String(r),m.value=u,m.value=h.value=m.value,b.value=g.value;const n=d.value,o=m.value,i=f.value,a=g.value,c=p(e,".js-inline-comment-form-container");if(n&&i){const e=t(c,".js-multi-line-preview"),r=t(e,".js-multi-line-preview-start"),l=t(e,".js-multi-line-preview-end"),u=s.start.isContext(),d=s.end.isContext();gd(r,n,o,u),gd(l,i,a,d),e.hidden=!1,c.classList.add("is-multiline")}else t(c,".js-multi-line-preview").hidden=!0,c.classList.remove("is-multiline");ad(c)}}(e,n);else{const s=e.elements.namedItem("start_line"),o=e.elements.namedItem("start_side"),r=e.elements.namedItem("line"),i=e.elements.namedItem("side"),a=e.elements.namedItem("preview_start_side"),c=e.elements.namedItem("preview_side");if(s instanceof HTMLInputElement&&o instanceof HTMLInputElement&&r instanceof HTMLInputElement&&i instanceof HTMLInputElement&&a instanceof HTMLInputElement&&c instanceof HTMLInputElement){a.value=o.value,c.value=i.value;const l=s.value,u=o.value,d=r.value,m=i.value,f=p(e,".js-inline-comment-form-container");if(l&&d){const e=t(f,".js-multi-line-preview"),s=t(e,".js-multi-line-preview-start"),o=t(e,".js-multi-line-preview-end"),r="true"===n.getAttribute("data-startiscontext"),i="true"===n.getAttribute("data-endiscontext");gd(s,l,u,r),gd(o,d,m,i),e.hidden=!1,f.classList.add("is-multiline")}else t(f,".js-multi-line-preview").hidden=!0,f.classList.remove("is-multiline");ad(f)}}const o=n.getAttribute("data-position")||"",r=n.getAttribute("data-anchor")||"",i=t(e,".js-comment-field"),a=i.id.replace(/^r\d+ /,"").replace("${anchor}",r).replace("${position}",o);for(const t of e.querySelectorAll(`[for="${i.id}"]`))t.setAttribute("for",a);i.id=a}function vd(e){return Math.floor(e/2)}function wd(e,t){const n=e.parentElement;if(!n)return;const s=n.children;let o;if(4===s.length)for(let r=0,i=s.length;r0&&n===s)}function Ed(e){const t=n(document,".js-hook-event-checkbox",HTMLInputElement);for(const n of t)n.checked=n.matches(e)}pt(".diff-table",(function(e){let t=null;function n(e){if(!(e instanceof MouseEvent))throw new Error("invariant: app/assets/modules/github/pages/diffs/line-highlight.ts:35");t&&wd(t,!1),t=null}function s(e){if(!(e instanceof MouseEvent))throw new Error("invariant: app/assets/modules/github/pages/diffs/line-highlight.ts:42");t&&wd(t,!1),e.target instanceof HTMLElement&&(t=e.target.closest("td.blob-code"),t&&wd(t,!0))}return{add:function(){e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",n),e.addEventListener("mouseover",s)},remove:function(){e.removeEventListener("mouseenter",n),e.removeEventListener("mouseleave",n),e.removeEventListener("mouseover",s)}}})),ft("click",".js-rich-diff.collapsed .js-expandable",(function(e){if(!(e.target instanceof Element))return;e.preventDefault();const t=e.target.closest(".js-rich-diff");if(!t)throw new Error("invariant: app/assets/modules/github/pages/diffs/prose-diff.ts:8");t.classList.remove("collapsed")})),ft("click",".js-show-rich-diff",(function(e){const t=e.currentTarget.closest(".js-warn-no-visible-changes");if(!t)return;t.classList.add("d-none");const n=t.parentElement;if(!n)throw new Error("invariant: app/assets/modules/github/pages/diffs/prose-diff.ts:18");const s=n.querySelector(".js-no-rich-changes");s&&s.classList.remove("d-none")})),pt("meta[name=diff-view]",{add:jd,remove:jd}),pt(".js-file-diff-split",{add:jd,remove:jd}),pt(".js-compare-tab.selected",{add:jd,remove:jd}),pt(".wants-full-width-container",{add:jd,remove:jd}),ft("change",".js-toggle-file-notes",(function(e){const t=e.currentTarget;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/pages/diffs/toggle-file-notes.ts:11");p(t,".file").classList.toggle("show-inline-notes",t.checked)})),ft("click",".js-toggle-all-file-notes",(function(e){const t=n(document,".js-toggle-file-notes",HTMLInputElement),s=t.some(e=>e.checked);for(const n of t)w(n,!s);e.preventDefault()})),pt(".js-inline-comments-container",(function(e){let t;const n=e.closest(".file");if(n){return{add:t=function(){const e=null!=n.querySelector(".js-inline-comments-container");n.classList.toggle("has-inline-notes",e)},remove:t}}})),ft("change",".js-toggle-file-check-annotations",(function(e){const t=e.currentTarget;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/pages/diffs/toggle-check-annotations.ts:9");const n=p(t,".file").querySelectorAll(".js-inline-annotations");for(const s of n)s instanceof HTMLElement&&(s.hidden=!t.checked)})),pt("td.js-line-comments.is-collapsed",{add:yd,remove:yd}),pt(".js-hook-url-field",{constructor:HTMLInputElement,add(e){function t(){const t=e.form;if(!t)throw new Error("invariant: app/assets/modules/github/pages/hooks.ts:14");if(!t)return;let n;try{n=new URL(e.value)}catch(oh){}const s=t.querySelector(".js-invalid-url-notice");s instanceof HTMLElement&&(s.hidden=!!(""===e.value||n&&/^https?:/.test(n.protocol)));const o=t.querySelector(".js-insecure-url-notice");o instanceof HTMLElement&&n&&e.value&&(o.hidden=/^https:$/.test(n.protocol));const r=t.querySelector(".js-ssl-hook-fields");r instanceof HTMLElement&&(r.hidden=!(n&&"https:"===n.protocol))}O(e,t),t()}}),ft("change",".js-hook-event-choice",(function(e){const n=e.currentTarget;if(!(n instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/pages/hooks.ts:50");const s=n.checked&&"custom"===n.value,o=n.closest(".js-hook-events-field");if(o&&o.classList.toggle("is-custom",s),n.checked)if(s){t(document,".js-hook-wildcard-event",HTMLInputElement).checked=!1}else"push"===n.value?Ed('[value="push"]'):"all"===n.value&&Ed(".js-hook-wildcard-event")})),ft("details:toggled",".js-hook-secret",(function(e){const n=e.currentTarget,s=t(n,"input[type=password]",HTMLInputElement);n.classList.contains("open")&&s.focus()})),ft("click",".js-hook-deliveries-pagination-button",(async function(e){const t=e.currentTarget;if(!(t instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/pages/hooks.ts:79");t.disabled=!0;const n=t.parentElement;if(!n)throw new Error("invariant: app/assets/modules/github/pages/hooks.ts:82");const s=h(t,"data-url");n.before(await $(document,s)),n.remove()})),E(".js-redeliver-hook-form",(async function(e,n){let s;try{s=await n.html()}catch(a){if(!e.parentElement)throw new Error("invariant: app/assets/modules/github/pages/hooks.ts:94");return void e.classList.add("failed")}const o=e.getAttribute("data-delivery-guid")||"",r=t(document,`.js-hook-delivery-container[data-delivery-guid="${o}"]`),i=r.parentElement;if(!i)throw new Error("invariant: app/assets/modules/github/pages/hooks.ts:101");r.replaceWith(s.html),t(i,"poll-include-fragment").addEventListener("load",(function(){const e=t(i,".js-hook-delivery-container"),n=t(i,".js-item-status"),s=e.getAttribute("data-status-class");n.classList.remove("success","pending","failure"),s&&n.classList.add(s);const o=i.querySelector(".js-item-status-tooltip"),r=e.getAttribute("data-status-message");o&&r&&o.setAttribute("aria-label",r)}))})),E(".js-test-hook-form",(async function(e,n){const s=t(document,".js-test-hook-message");s.classList.remove("error","success");try{await n.text()}catch(o){s.classList.add("error");const e=t(s,".js-test-hook-message-errors");if(null!=o.response){const t=await o.response.json();e.textContent=t.errors}else e.textContent=e.getAttribute("data-network-error-message")||"";return}s.classList.add("success")})),E(".js-toggler-container .js-set-approval-state",(async function(e,t){const n=p(e,".js-toggler-container");n.classList.add("loading");const s=await t.json();"approved"===s.json.approval_state?n.classList.add("on"):"denied"===s.json.approval_state&&(n.classList.add("revoked"),n.classList.remove("on")),n.classList.remove("loading")})),E(".js-request-access-approval-form",(async function(e,n){await n.text();const s=h(e,"data-container-id");t(document,`#${s}`).classList.add("on")})),ft("details-menu-selected",".js-select-plan-menu",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/pages/plan.ts:4");const t=e.detail.relatedTarget,n=document.querySelectorAll(".js-plan-card-section");for(const i of n)i instanceof HTMLElement&&(i.hidden=!0);const s=e.currentTarget.querySelectorAll("[role^=menuitem]"),o=Array.from(s).indexOf(t),r=Array.from(n)[o];r instanceof HTMLElement&&(r.hidden=!1)}),{capture:!0});const Ld=function(){const e=new Uint32Array(256);for(let t=256;t--;){let n=t;for(let e=8;e--;)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n}return function(t){let n=-1;for(let s=0;s>>8^e[255&n^t.charCodeAt(s)];return(-1^n)>>>0}}();function Td(e,t,n){const s=Ea(e),o=kd(t,n);return s.label?s.label+=`;${o}`:s.label=o,[s.category,s.action,s.label,s.value].join(", ")}function kd(e,t){return`experimentv2:${e};group:${t}`}pt(".js-experiment-variant",{constructor:HTMLElement,add(e){const t=h(e,"data-experiment"),s=h(e,"data-experiment-group"),o=Sd(t);if(o&&o===s){for(const s of n(e,"[data-if-experiment-enabled-ga-load]"))s.setAttribute("data-ga-load",Td(h(s,"data-if-experiment-enabled-ga-load"),t,o));e.hidden=!1}else if(!o&&e.getAttribute("data-experiment-default")){for(const t of n(e,"[data-if-experiment-enabled-ga-load]"))t.setAttribute("data-ga-load",h(t,"data-if-experiment-enabled-ga-load"));e.hidden=!1}else e.remove()}}),pt(".js-add-experiment-labels-to-ga-click",(function(e){const t=p(e,".js-experiment-variant"),n=h(t,"data-experiment");if(Sd(n)){const s=h(t,"data-experiment-group"),o=h(e,"data-ga-click");o&&e.setAttribute("data-ga-click",Td(o,n,s))}})),pt(".js-add-experiment-labels-to-value",{constructor:HTMLInputElement,add(e){const t=p(e,".js-experiment-variant"),n=h(t,"data-experiment");if(Sd(n)){const s=h(t,"data-experiment-group");e.value+=kd(n,s)}}});const Md={};function Sd(e){if(Md[e])return Md[e].variant;try{const t=function(e){const t=document.querySelector(`meta[name=experiment-${e}]`);if(!(t instanceof HTMLMetaElement))return null;const n=new URLSearchParams(window.location.search).get("experiment_group");if(""===n){return JSON.parse(atob(t.content)).default}if(n)return n;const s=(new Date).toISOString();let o=function(e){const t=jt(`experiment:${e}`);for(const n of t)try{return JSON.parse(atob(n.value))}catch(oh){}return null}(e);const r=Tt();if(!o||!o.rollOutPlacement){const t=Ld(`${r}-${e}-experiment-enrollment`);o={version:"1",rollOutPlacement:t/4294967295*100,subgroup:null,createdAt:s,updatedAt:s}}let i=o.subgroup;if(!i){o.updatedAt=s;const n=JSON.parse(atob(t.content));if(i=n.default,o.rollOutPlacement<=n.roll_out_percent){const t=Ld(`${r}-${e}-experiment-participant`)/4294967295*100;for(const e of n.groups)t>=e.min&&tv(e,"input",xd)}),ft("submit",".js-signup-form-submit",(function(e){const n=e.currentTarget,s=t(n,".js-signup-source",HTMLInputElement),o=Sd("homepage_signup_flow");(!o&&!s.value.includes(";experiment")||o&&s.value.includes(o))&&ve({category:"Signup",action:"Submit",label:s.value})})),pt(".js-octocaptcha-parent",(function(e){if(!(e instanceof HTMLFormElement))throw new Error("invariant: app/assets/modules/github/pages/signup.ts:80");const n=t(e,".js-octocaptcha-spinner"),s=t(e,".js-octocaptcha-success"),o=t(e,".js-octocaptcha-token",HTMLInputElement),r=t(e,".js-octocaptcha-form-submit",HTMLButtonElement),i=t(e,".js-octocaptcha-frame-container"),a=t(e,".js-octocaptcha-frame"),c=o.getAttribute("data-octocaptcha-url");let l="true"===e.getAttribute("data-redirect-after-solved"),u=!1;const d=()=>{u||(u=!0,n.classList.add("d-none"),s.classList.remove("d-none"),f())},m=()=>{if(u)return;const t=document.createElement("input");t.type="hidden",t.id="error_loading_captcha",t.name="error_loading_captcha",t.value="1",l=!1,e.appendChild(t),d()},f=()=>{if(!(e instanceof HTMLFormElement))throw new Error("invariant: app/assets/modules/github/pages/signup.ts:127");e.checkValidity()&&(r.disabled=!1,l&&r.click())};setTimeout(m,2e4),a.addEventListener("error",m),window.addEventListener("message",e=>{if(e.origin!==c)return;const t=e.data&&e.data.event;"captcha-loaded"===t?u||(u=!0,n.classList.add("d-none"),i.classList.remove("v-hidden","zero-height")):"captcha-complete"===t?(o.value=e.data.sessionToken,(()=>{const e=i.getAttribute("data-ga-event-category");e&&ve({category:e,action:"success",label:"captcha verified"})})(),f()):"captcha-suppressed"===t&&d()})})),pt(".js-survey-answer-choice:checked",{add(e){const n=p(e,".js-answer"),s=t(n,".js-answer-choice");s&&(s.classList.remove("border-black-fade","bg-gray-light"),s.classList.add("border-blue","bg-white"))},remove(e){const n=p(e,".js-answer"),s=t(n,".js-answer-choice");s&&(s.classList.remove("border-blue","bg-white"),s.classList.add("border-black-fade","bg-gray-light"))}}),pt(".js-allow-multiple:checked",{constructor:HTMLInputElement,add(e){const t=parseInt(e.getAttribute("data-max-choices")||""),s=p(e,".js-question"),o=n(s,".js-allow-multiple",HTMLInputElement);if(o.filter(e=>!0===e.checked).length>=t)for(const n of o)!1===n.checked&&(n.disabled=!0)},remove(e){const t=p(e,".js-question");for(const s of n(t,".js-allow-multiple",HTMLInputElement))s.disabled=!1}}),f("keyup",".js-password-with-confirmation",()=>{""!==t(document,".js-password-confirm",HTMLInputElement).value&&Hd()}),f("keyup",".js-password-confirm",Hd);let qd=null;function Id(e){const{item:t,oldIndex:n}=e,{parentNode:s}=t;if(!(s instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/pinned-issue-reordering.ts:13");qd=s.children[n+1]}async function _d(e){const{oldIndex:n,newIndex:s,item:o}=e;if(n===s)return;const r=p(o,".js-pinned-issues-reorder-form",HTMLFormElement),i=p(r,".js-pinned-issues-reorder-container"),a=t(i,".js-pinned-issues-spinner");a.style.display="inline-block",Cd.option("disabled",!0);try{await N(r.action,{method:r.method,body:new FormData(r)}),a.style.display="none",Cd.option("disabled",!1)}catch(oh){const t=o.parentNode;if(!t)throw new Error("invariant: app/assets/modules/github/pinned-issue-reordering.ts:36");qd?t.insertBefore(o,qd):t.appendChild(o)}}pt(".js-pinned-issues-reorder-list",(function(e){Cd=_e.create(e,{animation:150,item:".js-pinned-issue-list-item",handle:".js-pinned-issue-reorder",onUpdate:_d,onStart:Id,chosenClass:"is-dragging"})})),ft("submit",".js-pinned-issues-reorder-form",(function(e){e.preventDefault()})),ft("click",".js-pinned-issue-list-item .js-sortable-button",(function({currentTarget:e}){if(!(e instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/pinned-issue-reordering.ts:59");jl(e,p(e,".js-pinned-issue-list-item"),_d)}));let $d=null;ft("pjax:click",".js-pjax-capture-input",(function(){$d=function(e){const t=e.createElement("textarea");return t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",e.body.appendChild(t),t.focus(),()=>(t.blur(),t.remove(),t.value)}(document)})),ft("pjax:end","#js-repo-pjax-container",(function(){if($d){const e=$d(),t=document.querySelector(".js-pjax-restore-captured-input");t instanceof HTMLInputElement&&e&&w(t,e),$d=null}})),ft("pjax:click",".js-pjax-history-navigate",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/pjax/history-navigate.ts:11");e.currentTarget instanceof HTMLAnchorElement&&(e.currentTarget.href===Ke()?(history.back(),e.detail.relatedEvent.preventDefault(),e.preventDefault()):e.currentTarget.href===Ye()&&(history.forward(),e.detail.relatedEvent.preventDefault(),e.preventDefault()))})),pt("link[rel=pjax-prefetch]",{constructor:HTMLLinkElement,initialize(e){const t=Je(e,{headers:{Purpose:"prefetch"}});Xe(e,t)}});class PreciseTimeAgoElement extends RelativeTimeElement{connectedCallback(){Dd.push(this),Nd||(Bd(),Nd=window.setInterval(Bd,1e3))}disconnectedCallback(){const e=Dd.indexOf(this);-1!==e&&Dd.splice(e,1),Dd.length||(window.clearInterval(Nd),Nd=void 0)}getFormattedDate(){const e=this.date;if(!e)return;if(!(e instanceof Date))throw new Error("invariant: app/assets/modules/github/precise-time-ago-element.ts:35");const t=(new Date).getTime()-e.getTime(),n=Math.floor(t/1e3),s=Math.floor(n/60),o=Math.floor(s/60),r=Math.floor(o/24),i=n-60*s,a=s-60*o;return s<1?`${n}s`:o<1?`${s}m ${i}s`:r<1?`${o}h ${a}m ${i}s`:`${r}d ${o-24*r}h ${a}m ${i}s`}}const Dd=[];let Nd;function Bd(){for(const e of Dd)e.textContent=e.getFormattedDate()||""}window.customElements.get("precise-time-ago")||(window.PreciseTimeAgoElement=PreciseTimeAgoElement,window.customElements.define("precise-time-ago",PreciseTimeAgoElement)),pt("body.js-print-popup",()=>{window.print(),setTimeout(window.close,1e3)}),ft("click",".js-new-user-contrib-example",(async function(e){const n=t(document,".js-calendar-graph");if(n.classList.contains("sample-graph"))return;n.classList.add("sample-graph");const s=h(e.currentTarget,"data-url");let o;try{o=await N(s)}catch(oh){return void n.classList.remove("sample-graph")}const r=document.createElement("div");r.innerHTML=o;const i=n.querySelector(".js-calendar-graph-svg");if(!i)throw new Error("invariant: app/assets/modules/github/profile/calendar-sample.ts:23");i.replaceWith(r.children[0])}));let Pd=null;function Rd(){const e=t(document,".js-calendar-graph"),n=h(e,"data-url");return new URL(n,window.location.origin)}function Fd(e){const t=e.target;t.matches("rect.day")&&(Od(),function(e){const t=document.body;if(!t)throw new Error("invariant: app/assets/modules/github/profile/contributions.ts:67");const n=h(e,"data-date"),s=function(e,t){const n=`${Ud[t.getUTCMonth()].slice(0,3)} ${t.getUTCDate()}, ${t.getUTCFullYear()}`,s=0===e?"No":Le(e),o=document.createElement("div");o.classList.add("svg-tip","svg-tip-one-line"),o.style.pointerEvents="none";const r=document.createElement("strong");return r.textContent=`${s} ${T(e,"contribution")}`,o.append(r,` on ${n}`),o}(parseInt(e.getAttribute("data-count")||""),Qd(n));t.appendChild(s);const o=e.getBoundingClientRect(),r=o.left+window.pageXOffset-s.offsetWidth/2+o.width/2,i=o.bottom+window.pageYOffset-s.offsetHeight-2*o.height;s.style.top=`${i}px`,s.style.left=`${r}px`}(t))}function Od(){const e=document.querySelector(".svg-tip");e&&e.remove()}pt(".js-calendar-graph-svg",(function(e){const t=p(e,".js-calendar-graph");t.addEventListener("mouseover",Fd),t.addEventListener("mouseout",Od);const n=t.getAttribute("data-from");n&&(Pd=Qd(n))})),ft("click",".js-calendar-graph rect.day",(function(e){const t=e.currentTarget,n=p(t,".js-calendar-graph"),s=h(n,"data-org"),o=h(t,"data-date");t.classList.contains("active")?tm(em()):function(e,t,n){let s,o;if(Pd&&t){const t=Pd.getTime(),n=26784e5,r=t-n,i=t+n;[s,o]=e>Pd?[Pd,e]:[e,Pd],s=new Date(Math.max(s.getTime(),r)),o=new Date(Math.min(o.getTime(),i)),Pd=null}else Pd=o=s=e;Kd(s,o);const r=Rd(),i=zd(r.search.slice(1),{from:s,to:o,org:n});i.append("tab","overview"),r.search=i.toString(),Wd(r.toString())}(Qd(o),e.shiftKey,s)}));const Ud=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];async function Wd(e){const t=document.getElementById("js-contribution-activity");if(!t)return;t.classList.add("loading");const n=await $(document,e);t.classList.remove("loading"),t.innerHTML="",t.append(n)}function zd(e,t){const n=new URLSearchParams(e);n.delete("from"),n.delete("to"),n.delete("org");let s=t.fromStr;t.from&&(s=Gd(t.from)),s&&n.append("from",s);let o=t.toStr;t.to&&(o=Gd(t.to)),o&&n.append("to",o);const r=t.org;return r&&n.append("org",r),n}async function Vd(e,n,s){const o=t(document,".js-calendar-graph"),r=h(o,"data-graph-url"),i=new URL(r,window.location.origin),a=zd(i.search.slice(1),{from:e,to:n,org:s});i.search=a.toString();const c=await $(document,i.toString());t(document,".js-yearly-contributions").replaceWith(c)}function Kd(e,n){const s=t(document,".js-calendar-graph"),o=s.querySelectorAll("rect.day");for(const t of o)t.classList.remove("active");if(s.classList.remove("days-selected"),e||n){s.classList.add("days-selected");for(const e of o)r(e)&&e.classList.add("active")}function r(t){const s=Qd(t.getAttribute("data-date")||"").getTime();return e&&n?e.getTime()<=s&&s<=n.getTime():e?s===e.getTime():void 0}}function Yd(){const e=t(document,".js-calendar-graph").querySelectorAll("rect.active"),n=e[0],s=e[e.length-1],o=n&&h(n,"data-date"),r=s&&h(s,"data-date");return o&&r?{first:o,last:r}:null}function Jd(){const e=Yd()||function(){const e=new URLSearchParams(window.location.search.slice(1)),t=e.get("from"),n=e.get("to");return t&&n?{first:t,last:n}:null}()||function(){const e=new URL(em(),window.location.origin),t=new URLSearchParams(e.search.slice(1)),n=t.get("from"),s=t.get("to");return n&&s?{first:n,last:s}:null}();if(!e)throw new Error("invariant: app/assets/modules/github/profile/contributions.ts:189");return e}function Xd(e){return`0${e}`.slice(-2)}function Gd(e){return`${e.getUTCFullYear()}-${Xd(e.getUTCMonth()+1)}-${Xd(e.getUTCDate())}`}function Qd(e){const[t,n,s]=e.split("-").map(e=>parseInt(e,10));return new Date(Date.UTC(t,n-1,s))}async function Zd(e){const n=Yd(),s=function(){const e=t(document,".js-calendar-graph");return{first:h(e,"data-from"),last:h(e,"data-to")}}(),o=new Date(s.first),r=new Date(s.last);if(await Vd(o,r,e),n){Kd(new Date(n.first),new Date(n.last))}}function em(){return t(document,".js-profile-timeline-year-list .js-year-link.selected",HTMLAnchorElement).href||""}function tm(e){const t=new URL(e,window.location.origin).search,n=new URLSearchParams(t.slice(1)),s=n.get("org"),o=n.get("from"),r=n.get("to");if(!o||!r)throw new Error("invariant: app/assets/modules/github/profile/contributions.ts:311");const i=new Date(o),a=new Date(r);Vd(i,a,s);const c=Rd(),l=zd(c.search.slice(1),{from:i,to:a,org:s});l.append("tab","overview"),c.search=l.toString(),Wd(c.toString())}function nm(e){const t=e.closest(".js-details-container");t&&t.classList.add("open");const n=e.getBoundingClientRect(),s=window.scrollY+n.top-62-10;window.scrollTo(0,s)}function sm(e){t(document,".js-profile-editable-area").hidden=e,t(document,".js-profile-editable-form").hidden=!e,t(document,".js-profile-editable-error").textContent=""}ft("click",".js-org-filter-link",(function(e){e.stopPropagation(),e.preventDefault();const t=e.currentTarget;if(!(t instanceof HTMLAnchorElement))throw new Error("invariant: app/assets/modules/github/profile/contributions.ts:256");const n=p(t,".js-org-filter-links-container").querySelector(".js-org-filter-link.selected"),s=new URL(t.href,window.location.origin),o=new URLSearchParams(s.search.slice(1)),r=o.get("org"),i=Jd(),a=new Date(i.first),c=new Date(i.last);n&&n.classList.remove("selected"),t!==n&&t.classList.add("selected"),Zd(r);const l=Rd(),u={org:r,from:null,to:null};o.has("from")&&(u.from=a),o.has("to")&&(u.to=c);const d=zd(l.search.slice(1),u);l.search=d.toString(),Wd(l.toString()),async function(e,t){const n=document.getElementById("year-list-container");if(!n)return;t.append("year_list","1"),e.search=t.toString();const s=await $(document,e.toString());n.innerHTML="",n.append(s)}(l,d),Ge(null,"",l.toString())})),ft("click",".js-year-link",(function(e){e.stopPropagation(),e.preventDefault();const n=e.currentTarget;if(!(n instanceof HTMLAnchorElement))throw new Error("invariant: app/assets/modules/github/profile/contributions.ts:292");const s=p(n,"ul");t(s,".js-year-link.selected").classList.remove("selected"),n.classList.add("selected"),tm(n.href),Ge(null,"",n.href)})),function(){const e=window.location.hash;if(!e||e.indexOf("#event-")<0)return;const t=e.slice(1,e.length),n=document.getElementById(t);n&&nm(n)}(),window.addEventListener("hashchange",(function(e){const t=e.newURL||window.location.href,n=t.slice(t.indexOf("#")+1,t.length),s=document.getElementById(n);s&&(e.stopPropagation(),nm(s))})),E(".js-show-more-timeline-form",(async function(e,n){await n.text();const s=document.querySelector(".js-show-more-timeline-form");if(s){const n=h(s,"data-year"),o=t(document,".js-year-link.selected"),r=t(document,`#year-link-${n}`);if(o.classList.remove("selected"),r.classList.add("selected"),n!==e.getAttribute("data-year")){const e=h(s,"data-from"),t=new Date(e),n=h(s,"data-to");Vd(t,new Date(n),s.getAttribute("data-org"))}}document.title=e.getAttribute("data-title")||"",Ge(null,"",e.getAttribute("data-url")||"")}));let om=null;ft("click",".js-profile-editable-edit-button",(function(){!function(){const e=t(document,".js-user-profile-bio").textContent;"string"==typeof e&&(t(document,".js-user-profile-bio-edit",HTMLTextAreaElement).value=e)}(),sm(!0)})),ft("click",".js-profile-editable-cancel",(function(){sm(!1)})),ft("change",".js-profile-editable-pro-badge",(function(e){if(!(e.target instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/profile/inline-editable-profile.ts:30");om={preference:e.target.checked}})),E(".js-profile-editable-form",async(e,n)=>{let s;try{s=await n.html()}catch(o){if(422===o.response.status){t(document,".js-profile-editable-error").textContent=o.response.json.message}return}if(function(e){t(document,".js-profile-editable-area").replaceWith(e)}(s.html),sm(!1),om){t(document,".js-pro-badge").classList.toggle("d-none",!om.preference)}});const rm=new WeakMap;async function im(e){const n=t(document,".js-pinned-items-selection-form");if(e){if((rm.get(n)||0)>100)return}const s=n.querySelector(".js-more-pinnable-items-button");if(!(s instanceof HTMLButtonElement))return;if(s.textContent=h(s,"data-disable-with"),s.disabled=!0,e){const e=rm.get(n)||0;rm.set(n,e+1)}const o=h(s,"data-url"),r=await $(document,o);t(n,".js-more-pinnable-items-replace-target").replaceWith(r),am(),cm()}function am(){ht(t(document,".js-pinned-items-filter-input"),"change")}async function cm(){const e=t(document,".js-pinned-items-selection-form");await g();const s=n(e,".js-pinnable-checkbox",HTMLInputElement),o=s.filter(e=>e.checked).length,r=parseInt(e.getAttribute("data-max-repo-count")||"",10);for(const t of s)t.disabled=o===r&&!t.checked;!function(e,n){const s=t(document,".js-remaining-pinned-items-count"),o=h(s,"data-remaining-label"),r=n-e;s.textContent=`${r} ${o}`,s.classList.toggle("text-red",r<1)}(o,r)}pt(".js-more-pinnable-items-button",(function(){(function(){const e=document.querySelector(".js-pinned-items-filter-input");return e instanceof HTMLInputElement&&(document.activeElement===e||e.defaultValue.trim().length>0)})()&&im(!0)})),ft("click",".js-more-pinnable-items-button",(function(){im(!1)})),ft("filter-input-start",".js-pinned-items-filter",e=>{const t=e.currentTarget;if(!(t instanceof W))throw new Error("invariant: app/assets/modules/github/profile/pinned-items.ts:96");t.filter=function(){const e=n(document,".js-pinned-items-type-filter:checked",HTMLInputElement).map(e=>e.value);return(t,n,s)=>{const o=s.toLowerCase().trim();if(t.querySelector("input:checked"))return{match:!0};const r=!o||n.toLowerCase().indexOf(o.toLowerCase())>-1,i=t.getAttribute("data-pinnable-type"),a=!(e.length>0&&i)||e.includes(i);return{match:r&&a}}}()}),y(".js-pinned-items-filter-input",(function(){im(!0)})),ft("change",".js-pinned-items-type-filter",am),ft("change",".js-pinned-items-type-filter",(function(){const e=n(document,".js-pinned-items-type-filter:checked",HTMLInputElement);for(const t of e)t.disabled=1===e.length})),ft("change",".js-pinned-items-selection-form",cm),ft("reset",".js-pinned-items-selection-form",cm),pt(".js-pinned-items-selection-form",am);let lm=null,um=null;function dm(e){const{item:t,oldIndex:n}=e,{parentNode:s}=t;if(!(s instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/profile/pinned-item-reordering.ts:13");um=s.children[n+1]}async function mm(e){const{oldIndex:n,newIndex:s,item:o}=e;if(n===s)return;const r=p(o,".js-pinned-items-reorder-form",HTMLFormElement),i=p(r,".js-pinned-items-reorder-container"),a=t(i,".js-pinned-items-spinner"),c=t(i,".js-pinned-items-reorder-message");c.textContent="",a.style.display="inline-block",lm.option("disabled",!0);try{await N(r.action,{method:r.method,body:new FormData(r)}),c.textContent=c.getAttribute("data-success-text")||"",a.style.display="none",lm.option("disabled",!1)}catch(oh){c.textContent=c.getAttribute("data-error-text")||"",a.style.display="none";const t=o.parentNode;if(!t)throw new Error("invariant: app/assets/modules/github/profile/pinned-item-reordering.ts:41");um?t.insertBefore(o,um):t.appendChild(o)}}function fm(e,t){t>0?e.textContent=function(e){return e>999?`${(e/1e3).toFixed(1)}k`:e.toLocaleString()}(t):e.remove()}pt(".js-pinned-items-reorder-list",(function(e){lm=_e.create(e,{animation:150,item:".js-pinned-item-list-item",handle:".js-pinned-item-reorder",onUpdate:mm,onStart:dm,chosenClass:"is-dragging"})})),ft("submit",".js-pinned-items-reorder-form",(function(e){e.preventDefault()})),ft("click",".js-pinned-item-list-item .js-sortable-button",(function({currentTarget:e}){if(!(e instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/profile/pinned-item-reordering.ts:64");jl(e,p(e,".js-pinned-item-list-item"),mm)})),pt(".js-user-profile-sticky-fields.is-stuck",(function(){const e=t(document,".js-user-profile-sticky-bar");return{add(){e.classList.add("is-stuck")},remove(){e.classList.remove("is-stuck")}}})),pt(".js-user-profile-follow-button.is-stuck",(function(){const e=t(document,".js-user-profile-sticky-bar");return{add(){e.classList.add("is-follow-stuck")},remove(){e.classList.remove("is-follow-stuck")}}})),pt(".js-user-profile-following-toggle .js-toggler-container.on",(function(){return{add(){const e=document.querySelector(".js-user-profile-following-mini-toggle .js-toggler-container");e&&e.classList.add("on")},remove(){const e=document.querySelector(".js-user-profile-following-mini-toggle .js-toggler-container");e&&e.classList.remove("on")}}})),pt(".js-user-profile-following-mini-toggle .js-toggler-container.on",(function(){const e=t(document,".js-user-profile-following-toggle .js-toggler-container");return{add(){e.classList.add("on")},remove(){e.classList.remove("on")}}})),pt(".js-profile-tab-count-container",(function(e){!async function(e){const t=new URL(h(e,"data-url"),window.location.origin),n=new URLSearchParams(t.search.slice(1)),s=e.querySelector(".js-profile-repository-count"),o=e.querySelector(".js-profile-project-count"),r=e.querySelector(".js-profile-package-count"),i=e.querySelector(".js-profile-team-count"),a=e.querySelector(".js-profile-member-count");s&&n.append("repo","1"),o&&n.append("project","1"),r&&n.append("package","1"),i&&n.append("team","1"),a&&n.append("member","1"),t.search=n.toString();const c=await d(t.toString()),l=(await c.json()).data;s&&l.repositories&&fm(s,l.repositories.totalCount),o&&l.projects&&fm(o,l.projects.totalCount),r&&l.registryPackages&&fm(r,l.registryPackages.totalCount),i&&l.teams&&fm(i,l.teams.totalCount),a&&l.members&&fm(a,l.members.totalCount)}(e)}));const pm=document.querySelector("meta[name=js-proxy-site-detection-payload]"),gm=document.querySelector("meta[name=expected-hostname]");if(pm instanceof HTMLMetaElement&&gm instanceof HTMLMetaElement&&s(document)){const e={url:window.location.href,expectedHostname:gm.content,documentHostname:document.location.hostname,proxyPayload:pm.content},t=new Error,n={};n.$__=btoa(JSON.stringify(e)),xt(t,n)}function hm(e,t,n){const s=Array.from(e.querySelectorAll('[role="menuitem"]'));let o=s.indexOf(t),r=s.indexOf(n);if(-1===o)throw new Error("Couldn't find startIndex in container");if(-1===r)throw new Error("Couldn't find endItem in container");bm(e),s[r].classList.add("is-last-in-range"),o>r&&([o,r]=[r,o]);for(const i of s.slice(o,r+1))i.classList.add("is-range-selected")}function bm(e){for(const t of e.querySelectorAll('[role="menuitem"]'))t.classList.remove("is-range-selected","is-last-in-range")}let vm;function wm(e){const t=document.querySelector("head .js-site-favicon");t instanceof HTMLLinkElement&&(null==vm&&(vm=t.href),t.href=e)}ft("details-menu-select",".js-pull-base-branch-menu",(function(){const e=t(document,".js-change-base-template",HTMLTemplateElement).content.cloneNode(!0);e instanceof DocumentFragment&&D({content:e})}),{capture:!0}),pt(".js-diffbar-commits-menu .js-diffbar-commits-list",{subscribe:function(e){const n=p(e,"details-menu");let s=!1;function o(e){s=e.shiftKey,s&&e.preventDefault()}function r(n){if(!s)return;if(n.preventDefault(),!(n instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/pulls/commits-range-selection.ts:69");const o=n.detail.relatedTarget;if(!(o instanceof Element))throw new Error("invariant: app/assets/modules/github/pulls/commits-range-selection.ts:71");if(o.classList.contains("is-range-selected")){n.stopPropagation();const s=e.querySelectorAll(".is-range-selected"),o=s[0],r=s[s.length-1],i=h(e,"data-range-url"),a=o.getAttribute("data-parent-commit"),c=h(r,"data-commit"),l=a&&c?`${a}..${c}`:c,u=i.replace("$range",l);K({url:u,container:t(document,"#js-repo-pjax-container")})}else n.stopImmediatePropagation(),async function(e,t){function n(n){if(!(n.target instanceof Element))throw new Error("invariant: app/assets/modules/github/pulls/commits-range-selection.ts:36");hm(e,t,p(n.target,'[role="menuitem"]'))}hm(e,t,t),e.addEventListener("mouseover",n),await new Promise(e=>window.addEventListener("keyup",e,{once:!0})),e.removeEventListener("mouseover",n),bm(e)}(e,o)}return e.addEventListener("click",o,{capture:!0}),n.addEventListener("details-menu-select",r),{unsubscribe:()=>{e.removeEventListener("click",o,{capture:!0}),n.removeEventListener("details-menu-select",r)}}}}),ft("toggle",".js-diffbar-commits-menu",(function(e){const t=e.currentTarget;if(!t.hasAttribute("open"))return;const n=t.querySelector(".in-range");n&&n.focus()}),{capture:!0}),ft("click",".js-compare-tab",(function(e){for(const t of document.querySelectorAll(".js-compare-tab.selected"))t.classList.remove("selected");e.currentTarget.classList.add("selected");for(const t of document.querySelectorAll("#commits_bucket, #files_bucket, #commit_comments_bucket"))t.classList.add("d-none");const n=e.currentTarget.hash;t(document,n).classList.remove("d-none"),e.preventDefault()})),ie((function({target:e}){if(!(e instanceof HTMLElement))return;const n=e.closest("#commits_bucket, #files_bucket, #commit_comments_bucket");n&&n instanceof HTMLElement&&!Q(n)&&t(document,`.js-compare-tab[href="#${n.id}"]`).click()})),ft("click",".js-toggle-range-editor-cross-repo",(function(){t(document,".js-range-editor").classList.toggle("is-cross-repo")})),ft("pjax:click",".js-range-editor",(function(e){const t=document.querySelector(".js-compare-pr");if(t&&t.classList.contains("open")){const t=e.detail.options,n=new URL(t.url,window.location.origin);n.search.match(/expand=1/)||(n.search+=`${n.search?"&":""}expand=1`,t.url=n.toString())}})),pt(".js-compare-pr.open",{add(){document.body.classList.add("is-pr-composer-expanded")},remove(){document.body.classList.remove("is-pr-composer-expanded")}}),ft("change",".js-collab-checkbox",(function({currentTarget:e}){const n=e.form;for(const t of n.querySelectorAll(".errored"))t.classList.remove("errored");const s=p(e,".js-collab-option"),o=t(s,".js-status-indicator");o.classList.remove("status-indicator-success","status-indicator-failed"),o.classList.add("status-indicator-loading")})),E(".js-collab-form",(async function(e,n){try{await n.text()}catch(s){for(const n of e.querySelectorAll(".status-indicator-loading")){n.classList.remove("status-indicator-loading"),n.classList.add("status-indicator-failed");const e=p(n,".js-collab-option");e.classList.add("errored");const s=t(e,".js-collab-checkbox",HTMLInputElement);s.checked=!s.checked}for(const t of e.querySelectorAll(".status-indicator-success"))t.classList.remove("status-indicator-success");return}for(const t of e.querySelectorAll(".errored"))t.classList.remove("errored");for(const t of e.querySelectorAll(".status-indicator-loading"))t.classList.remove("status-indicator-loading"),t.classList.add("status-indicator-success")})),ft("details-menu-selected",".js-pull-request-menu",(function(e){const n=t(document,".js-pull-request-button"),s=t(e.detail.relatedTarget,"span[data-menu-button-text]").textContent;n.textContent=s,n.focus()}),{capture:!0}),pt(".js-timeline-item > .js-commit-group",{constructor:HTMLElement,add(e){if(e.querySelector(".js-commit-group-header"))return;const n=e.closest(".js-timeline-item");if(!(n instanceof HTMLElement))return;let s=n.previousElementSibling;s instanceof HTMLElement&&(s.classList.contains("js-timeline-item")||(s=s.previousElementSibling,s instanceof HTMLElement))&&s.querySelector(".js-commit-group")&&function(e,n){const s=t(e,".js-commit-group-commits"),o=n.querySelectorAll(".js-commit-group-commits > .js-commit");for(const t of o)t.classList.toggle("py-3"),s.appendChild(t);const r=e.querySelector(".js-commit-group-count");r instanceof HTMLElement&&(r.textContent=`${s.querySelectorAll(".js-commit").length}`),n.remove()}(s,n)}}),pt("[data-favicon-override]",{add(e){const t=h(e,"data-favicon-override");setTimeout(()=>wm(t))},remove(){null!=vm&&wm(vm)}}),ft("click",".js-file-header .js-details-target",(function(e){if(!(e instanceof MouseEvent&&e.altKey&&e.currentTarget instanceof HTMLElement)){const t=p(e.currentTarget,".js-file");return void(t.getBoundingClientRect().top<0&&ae(t))}const{currentTarget:t}=e,n=p(t,".js-details-container");n.addEventListener("details:toggled",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/pulls/file-collapsing.ts:23");const{open:t}=e.detail;se(n,()=>{for(const e of document.querySelectorAll(".js-file.js-details-container"))e!==n&&(e.classList.toggle("open",t),e.classList.toggle("Details--on",t))}),function(e){if(!document.querySelector(".js-file-filter"))return;la(e);const t=ea();t&&(t.checked=!e),Xi(na())}(t)}),{once:!0})})),ie(()=>{const e=window.location.hash.slice(1);if(!e)return;const t=document.getElementsByName(e)[0];if(!t)return;const n=t.nextElementSibling;n&&n.matches(".js-file.js-details-container")&&(n.classList.add("open"),n.classList.add("Details--on"))}),pt(".js-file-header-dropdown",{subscribe:e=>v(e,"toggle",(function({currentTarget:e}){if(!(e instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/pulls/file-collapsing.ts:56");const t=e,n=t.hasAttribute("open"),s=p(t,".js-file-header");if(!(s instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/pulls/file-collapsing.ts:60");s.classList.toggle("has-open-dropdown",n)}))}),ft("click",".js-fork-cleanup-select-item",(function({currentTarget:e}){const s=p(e,".js-fork-cleanup-select-menu");for(const t of n(s,".js-fork-cleanup-select-item"))t.classList.remove("selected");e.classList.add("selected");const o=p(s,".js-fork-cleanup-button-group"),r=e.getAttribute("data-toggles-button");"branch"===r?(t(o,".js-fork-cleanup-branch-button").classList.remove("d-none"),t(o,".js-fork-cleanup-fork-button").classList.add("d-none")):"fork"===r&&(t(o,".js-fork-cleanup-branch-button").classList.add("d-none"),t(o,".js-fork-cleanup-fork-button").classList.remove("d-none"))}));const jm=["work in progress","draft","wip"];f("keyup",".js-keyword-listener",(function(e){const t=e.currentTarget.value.trim().toLowerCase(),n=document.querySelector(".js-upgrade-popover");if(n instanceof HTMLElement)for(const s of jm)if(t.includes(s)){n.hidden=!1;break}})),ft("details:toggled",".js-pull-merging",(function({currentTarget:e}){const t=n(e,".js-merge-pull-request"),s=t.some(Q);for(const n of t)n.classList.toggle("is-dirty",s)})),ft("click",".js-merge-box-try-again",(async function({currentTarget:e}){const n=t(p(e,".js-pull-merging"),".js-tryable-again",HTMLFormElement);ht(n,"submit")})),document.addEventListener("session:resume",(function(e){const t=document.getElementById(e.detail.targetId);if(t){const e=t.closest(".js-merge-pull-request");if(e){const t=e.closest(".js-details-container");t&&t.classList.add("open")}}})),ft("change",".js-merge-button-toggle",(function({currentTarget:e}){const t=p(e,".js-merge-pr"),s=!e.checked;for(const o of n(t,".js-merge-commit-button",HTMLButtonElement))o.disabled=s})),ft("details-menu-selected",".js-merge-method-menu",(function(e){const s=e.detail.relatedTarget,o=p(s,".js-merge-pr"),r=t(o,".js-merge-pull-request",HTMLFormElement),i=t(o,".js-merge-method-menu-button"),a=i.getAttribute("data-merge-button-class");i.classList.toggle("btn-danger",s.hasAttribute("data-merge-commit-warning")),a&&i.classList.toggle(a,!s.hasAttribute("data-unsafe-rebase"));const c=t(o,".js-merge-title",HTMLInputElement),l=t(o,".js-merge-message",HTMLTextAreaElement);c.defaultValue===c.value&&(c.defaultValue=c.value=h(s,"data-input-title-value"));l.defaultValue===l.value&&(l.defaultValue=l.value=h(s,"data-input-message-value"));o.classList.toggle("is-merging","merge"===s.value),o.classList.toggle("is-squashing","squash"===s.value),o.classList.toggle("is-rebasing","rebase"===s.value);const u=r.classList.contains("js-admin-override-merge")&&"merge"===s.value||r.classList.contains("js-admin-override-squash")&&"squash"===s.value||r.classList.contains("js-admin-override-rebase")&&"rebase"===s.value,d=n(o,".js-admin-override");for(const t of d)t.hidden=!u;const m=u&&!t(o,".js-merge-button-toggle",HTMLInputElement).checked,f=n(o,".js-merge-pull-request .js-merge-commit-button",HTMLButtonElement);for(const t of f)t.type=s.value===t.value?"submit":"button",t.disabled=m;r.classList.toggle("text-red",u);const g=p(o,".js-pull-merging"),b=new URL(h(g,"data-url"),window.location.origin),v=new URLSearchParams(b.search);v.set("merge_type",s.value),b.search=v.toString(),g.setAttribute("data-url",b.toString())}),{capture:!0}),ft("details:toggled",".js-merge-pr",(function(e){const t=e.currentTarget.querySelector(".js-merge-message");t&&ht(t,"change")})),pt(".branch-action-item.js-details-container.open",{add(e){for(const t of e.querySelectorAll(".js-merge-review-section"))t.setAttribute("open","")},remove(e){for(const t of e.querySelectorAll(".js-merge-review-section"))t.removeAttribute("open")}}),ft("toggle",".js-details-container .js-merge-review-section",(function({currentTarget:e}){const t=p(e,".js-details-container"),n=t.querySelectorAll(".js-merge-review-section").length,s=t.querySelectorAll(".js-merge-review-section[open]").length,o=s===n;0===s?ye(t,!1):o&&ye(t,!0)}),{capture:!0}),pt("poll-include-fragment[data-to-be-polled]",{constructor:m,add(e){function t(){e.src=h(e,"data-to-be-polled"),e.removeAttribute("data-to-be-polled")}document.hidden?document.addEventListener("visibilitychange",t,{once:!0}):t()}});let ym=!1;function Em(){const e=document.querySelectorAll(".pull-request-ref-restore");for(let t=0;tfunction(e){const n=p(e,".js-review-state-classes"),s=n.querySelectorAll(".js-pending-review-comment").length,o=t(document,".js-review-changes");n.classList.toggle("is-review-pending",s>0);for(const t of document.querySelectorAll(".js-pending-review-comment-count"))t.textContent=String(s);for(const t of document.querySelectorAll(".js-pending-comment-count-type"))t instanceof HTMLElement&&Te(s,t);if(s>0){o.textContent=o.getAttribute("data-pending-message")||"";const n=t(e,".js-reviews-toggle");n.classList.add("anim-pulse-in"),n.addEventListener("animationend",()=>n.classList.remove("anim-pulse-in"),{once:!0})}else o.textContent=o.getAttribute("data-message")||""}(e))}function km(e){return e.getAttribute("ratio").split("/")}function Mm(e){if(e){const[t,n]=km(e),s=parseInt(t)/parseInt(n),o=e.querySelector(".js-review-progress"),r=e.querySelector(".js-review-count");o instanceof HTMLElement&&r&&(o.style.width=`${100*s}%`,r.textContent=`${t} / ${n}`)}}document.addEventListener("keydown",(function(e){"Alt"===e.key&&(ym=!0)})),document.addEventListener("keyup",(function(e){"Alt"===e.key&&(ym=!1)})),ft("click",".js-toggle-outdated-comments",(function(e){if(!((e instanceof MouseEvent&&e.altKey||ym)&&e.currentTarget instanceof HTMLElement))return;const t=e.currentTarget,n=p(t,"details");function s(){const e=n.hasAttribute("open");for(const n of document.querySelectorAll(".js-toggle-outdated-comments"))if(n!==t){p(n,"details").toggleAttribute("open",e)}}setTimeout(()=>{se(t,s)})})),pt(".pull-request-ref-restore",{add:Em,remove:Em}),pt("#js-pull-restorable",{add:Lm,remove:Lm}),E(".js-inline-comment-form",(async function(e,t){await t.text(),Tm()})),E(".js-pending-review-comment .js-comment-delete",(async function(e,t){await t.text(),Tm()})),E(".js-resolvable-timeline-thread-form",(async function(e,t){try{const n=await t.html();p(e,".js-resolvable-timeline-thread-container").replaceWith(n.html)}catch(n){ee()}})),ft("click",".js-resolvable-thread-toggler",(function(e){if(!(e.target instanceof HTMLElement))return;const n=p(e.target,".js-resolvable-timeline-thread-container");p(e.target,".js-resolvable-thread-toggler-container").classList.toggle("border-bottom"),t(n,".js-resolvable-thread-contents").classList.toggle("d-none");for(const t of n.querySelectorAll(".js-resolvable-thread-toggler"))t.classList.toggle("d-none")})),E(".js-toggle-user-reviewed-file-form",(async function(e,n){const s=p(e,".js-details-container"),o=!!s.querySelector(".js-reviewed-file"),r=s.classList.contains("open"),i=s.querySelector(".js-file-header"),a=!!i&&60===i.getBoundingClientRect().top;(!o&&r||o&&!r)&&(ye(s),a&&ae(s));const c=t(e,".js-reviewed-toggle");o?(c.classList.remove("bg-blue-2","border-blue-light"),c.classList.add("text-gray","border-gray-dark")):(c.classList.remove("text-gray","border-gray-dark"),c.classList.add("bg-blue-2","border-blue-light")),t(c,".js-reviewed-checkbox",HTMLInputElement).disabled=!0;const l=document.querySelector("progress-bar");l instanceof ProgressBarElement&&(o?l.decrement():l.increment());const u=await n.html(),d=e.closest(".js-replace-file-header-review");d&&(d.replaceWith(u.html),s.hasAttribute("data-file-user-viewed")?s.removeAttribute("data-file-user-viewed"):s.setAttribute("data-file-user-viewed","true"))}));class ProgressBarElement extends HTMLElement{static get observedAttributes(){return["ratio"]}attributeChangedCallback(e){"ratio"===e&&Mm(this)}connectedCallback(){Mm(this)}increment(){const[e,t]=km(this),n=Math.min(parseInt(e)+1,parseInt(t));this.setAttribute("ratio",`${n}/${t}`)}decrement(){const[e,t]=km(this),n=Math.min(parseInt(e)-1,parseInt(t));this.setAttribute("ratio",`${n}/${t}`)}}function Sm(e){const n=e.target,s=h(n,"data-reaction-label"),o=p(n,".js-add-reaction-popover"),r=t(o,".js-reaction-description");r.hasAttribute("data-default-text")||r.setAttribute("data-default-text",r.textContent||""),r.textContent=s}function Am(e){const n=p(e.target,".js-add-reaction-popover"),s=t(n,".js-reaction-description"),o=s.getAttribute("data-default-text");o&&(s.textContent=o)}function xm(e,t){e&&e.postMessage&&e.postMessage(JSON.stringify(t),"*")}window.customElements.get("progress-bar")||(window.ProgressBarElement=ProgressBarElement,window.customElements.define("progress-bar",ProgressBarElement)),document.addEventListener("pjax:end",(function(){for(const e of document.querySelectorAll(".js-pull-refresh-on-pjax"))ht(e,"socket:message",{})})),pt(".js-multi-line-callout",(function(e){const t=document.querySelector(".js-linkable-line-number");if(!t)return;if(p(t,".js-diff-table").offsetHeight<343)return;const n=t.closest("tr");if(!n)return;const s=n.lastElementChild;s&&(e.remove(),s.prepend(e),e.removeAttribute("hidden"))})),ft("submit",".js-multi-line-callout",(function(e){if(!(e.target instanceof Element))return;p(e.target,".js-multi-line-callout").hidden=!0})),ft("click",".js-dismiss-multi-line-suggestion-onboarding-notice",(async function(e){const n=h(e.currentTarget,"data-url"),s=t(e.currentTarget.parentElement,".js-data-url-csrf",HTMLInputElement),o=new FormData;o.append("notice","multi_line_suggestions"),await N(Me(n,s.value,{method:"post",body:o}));const r=document.querySelectorAll(".js-multi-line-suggestion-onboarding-notice");for(const t of r)t.remove()})),pt(".js-updating-pull-request-commits-count",{add(e){const t=e.textContent,s=n(document,".js-updateable-pull-request-commits-count");for(const n of s)n.textContent=t}}),(async()=>{if(await Y,window.performance&&window.performance.navigation&&window.performance.navigation.type===window.performance.navigation.TYPE_RELOAD){const e=document.getElementById("js-report-pull-request-refresh");e&&je(e)}})(),E(".js-pick-reaction",(async function(e,n){const s=await n.json(),o=p(e,".js-comment"),r=t(o,".js-reactions-container"),i=t(o,".js-comment-header-reaction-button"),a=Ae(document,s.json.reactions_container.trim()),c=Ae(document,s.json.comment_header_reaction_button.trim());r.replaceWith(a),i.replaceWith(c),o.classList.remove("is-reacting")})),ft("toggle",".js-reaction-popover-container",(function(e){const t=e.currentTarget.hasAttribute("open");for(const s of n(e.target,".js-reaction-option-item"))t?(s.addEventListener("mouseenter",Sm),s.addEventListener("mouseleave",Am)):(s.removeEventListener("mouseenter",Sm),s.removeEventListener("mouseleave",Am));p(e.target,".js-comment").classList.toggle("is-reacting",t)}),{capture:!0});const Hm="render:hook:message",Cm="render:hook:afterready",qm=["is-render-pending","is-render-ready","is-render-loading","is-render-loaded"],Im=new WeakMap;function _m(e){if(null==e)return;const t=Im.get(e);null!=t&&(t.load=t.hello=null,t.helloTimer&&(clearTimeout(t.helloTimer),t.helloTimer=null),t.loadTimer&&(clearTimeout(t.loadTimer),t.loadTimer=null))}function $m(e){if(null!=e)return e.classList.remove(...qm),e.classList.add("is-render-failed"),_m(e)}function Dm(){return!0}function Nm(e,t=Dm){return function(){if(Q(e)&&!e.classList.contains("is-render-ready")&&!e.classList.contains("is-render-failed")&&!e.classList.contains("is-render-failed-fatally")&&(!t||t()))return $m(e)}}pt(".js-render-target",{constructor:HTMLElement,initialize:function(e){const t=Im.get(e);null!=t&&t.load||(_m(e),function(e){if(Im.get(e))return;const t={load:null,hello:null,helloTimer:null,loadTimer:null};t.load=Date.now(),t.helloTimer=window.setTimeout(Nm(e,(function(){return!t.hello})),1e4),t.loadTimer=window.setTimeout(Nm(e),45e3),Im.set(e,t)}(e),e.classList.add("is-render-automatic"),e.classList.add("is-render-requested"))}}),window.addEventListener("message",(function(e){const t=e.data;if(!t)return;const n=function(e){if("string"==typeof e)try{return JSON.parse(e)}catch(t){return}}(t)||t;if("string"!=typeof n.type&&"render"!==n.type)return;const s=n.type;if("string"!=typeof n.identity)return;const o=n.identity;if("string"!=typeof n.body)return;const r=n.body,i=function(e){return Array.from(document.querySelectorAll(".js-render-target")).filter(t=>!e||t.getAttribute("data-identity")===e)[0]}(o);i&&e.origin===i.getAttribute("data-host")&&function(e,t,n,s,o){switch(s){case"hello":{(Im.get(e)||{untimed:!0}).hello=Date.now();const t={type:"render:cmd",body:{cmd:"ack",ack:!0}},n={type:"render:cmd",body:{cmd:"branding",branding:!1}},s=function(e){const t=e.querySelector("iframe");return t instanceof HTMLIFrameElement?t.contentWindow:null}(e);if(xm(s,t),xm(s,n),e.classList.contains("is-local")&&s&&"function"==typeof s.postMessage){const t=s,n=e.closest(".js-code-editor"),o=n instanceof HTMLElement?Qe(n):null;if(o){let e=null;const n=(n,s)=>{if(function(e){return e&&"setValue"===e.origin}(s))return;const r=o.code();r!==e&&(e=r,xm(t,{type:"render:data",body:r}))};o.editor.on("change",n),n()}}}break;case"error":return $m(e);case"error:fatal":return $m(e),e.classList.add("is-render-failed-fatal");case"error:invalid":return $m(e),e.classList.add("is-render-failed-invalid");case"loading":return e.classList.remove(...qm),e.classList.add("is-render-loading");case"loaded":return e.classList.remove(...qm),e.classList.add("is-render-loaded");case"ready":e.classList.remove(...qm),e.classList.add("is-render-ready"),o&&"number"==typeof o.height&&(e.style.height=`${o.height}px`),ht(e,Cm,{container:e,payload:o});break;case"resize":o&&"number"==typeof o.height&&(e.style.height=`${o.height}px`);break;case"data":ht(e,"edit:visual",o);break;default:ht(e,Hm,{type:t,body:s,payload:o})}}(i,s,0,r,null!=n.payload?n.payload:void 0)}));let Bm=null;const Pm=new H;function Rm(e){const n=e.form;if(!n)throw new Error("invariant: app/assets/modules/github/repositories/branches.ts:34");const s=p(n,".js-branches"),o=s.querySelectorAll(".js-branches-subnav .js-subnav-item"),r=s.querySelector(".js-branches-subnav .js-subnav-item.selected"),i=t(s,".js-branches-subnav .js-branches-all"),a=n.getAttribute("data-results-container");Bm||(Bm=r);const c=e.value.trim().length>0,l=function(e){const t=e.form;if(!t)throw new Error("invariant: app/assets/modules/github/repositories/branches.ts:18");if(e.value.trim()){const n=new URL(t.action,window.location.origin),s=new URLSearchParams(n.search.slice(1)),o=t.elements.namedItem("utf8");return o instanceof HTMLInputElement&&s.append("utf8",o.value),s.append("query",e.value),n.search=s.toString(),n.toString()}return h(t,"data-reset-url")}(e);function u(){s.classList.remove("is-loading")}Pm.push($(document,l)).then((function(e){A(null,"",l);const t=a?document.getElementById(a):null;t&&(t.innerHTML="",t.appendChild(e))})).then(u,u),s.classList.toggle("is-search-mode",c),s.classList.add("is-loading");for(const t of o)t.classList.remove("selected");c?i.classList.add("selected"):Bm&&(Bm.classList.add("selected"),Bm=null)}pt(".js-branch-search-field",{constructor:HTMLInputElement,initialize(e){O(e,Rm)},subscribe:e=>v(e,"keyup",(function(t){if(!(t instanceof KeyboardEvent))throw new Error("invariant: app/assets/modules/github/repositories/branches.ts:86");"Escape"===J(t)&&(!function(e){const t=e.value.trim();e.value="",t&&Rm(e)}(e),e.blur())}))}),ft("submit",".js-branch-search",e=>e.preventDefault()),ft("click",".js-clear-branch-search",(function(e){const n=e.currentTarget;if(!(n instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/repositories/branches.ts:99");if(!n.form)throw new Error("invariant: app/assets/modules/github/repositories/branches.ts:100");const s=t(n.form,".js-branch-search-field",HTMLInputElement);s.focus(),s.value="",ht(s,"input")})),E(".js-branch-destroy, .js-branch-restore",(async function(e,n){t(e,"button[type=submit]").blur();const s=function(e){const t=p(e,".js-branch-row").getAttribute("data-branch-name"),n=p(e,".js-branches").querySelectorAll(".js-branch-row");return Array.from(n).filter(e=>e.getAttribute("data-branch-name")===t)}(e);for(const t of s){const e=t.querySelector(".js-branch-delete-target"),n=t.querySelector(".js-loading-spinner");n&&(n.hidden=!1),e&&(e.hidden=!0)}let o=!1;try{await n.text()}catch(r){o=!0,location.reload()}finally{for(const e of s){const t=e.querySelector(".js-branch-delete-target"),n=e.querySelector(".js-loading-spinner");t&&(t.hidden=!1),n&&(n.hidden=!0)}}if(!o){const t=e.classList.contains("js-branch-destroy");for(const e of s)e.classList.toggle("Details--on",t)}})),ft("socket:message",".repository-import",(function(e){const t=e.detail.data;t.redirect_to&&(document.location.href=t.redirect_to,e.stopImmediatePropagation())})),ft("change","input.js-repository-import-lfs-opt",(function({currentTarget:e}){const n=parseInt(e.getAttribute("data-percent-used")||""),s=p(e,".js-repository-import-lfs-container"),o=e.getAttribute("data-used")||"";t(s,".js-repository-import-lfs-warn").classList.toggle("d-none",!(n>100)),t(s,".js-usage-bar").classList.toggle("exceeded",n>=100),t(s,".js-usage-bar").setAttribute("aria-label",`${n}%`),t(s,".js-repository-import-lfs-progress").style.width=`${n}%`,t(s,"span.js-usage-text").textContent=o})),E(".js-repository-import-author-form",(async function(e,t){const n=await t.html();p(e,".js-repository-import-author").replaceWith(n.html)})),ft("click",".js-repository-import-projects-cancel-button",(function(){const e=t(document,".js-repository-import-projects-cancel-form",HTMLFormElement);L(e)}));let Fm=!1;function Om(){const e=t(document,".js-repo-name");ht(e,"input");const n=t(document,'.js-owner-container [aria-checked="true"]'),s="false"!==n.getAttribute("data-org-allow-public-repos"),o=t(document,".js-privacy-toggle[value=public]",HTMLInputElement);Um(s,o,document.querySelector(".js-privacy-toggle-label-public"),document.querySelector(".js-public-description"),document.querySelector(".js-public-restricted-by-policy-description"));const r=function(e,t){let n=!1;const s=document.querySelectorAll(".js-new-repo-internal-visibility");for(const o of s){o.hidden=!0;const e=o.querySelector(".js-privacy-toggle[value=internal]");e instanceof HTMLInputElement&&e.checked&&(n=!0)}if(e){const s=document.querySelector(`#new-repo-internal-visibility-${e}`);if(s){s.hidden=!1;const e=s.querySelector(".js-privacy-toggle-label-internal"),o=s.querySelector(".js-internal-description"),r=s.querySelector(".js-internal-restricted-by-policy-description"),i=s.querySelector(".js-privacy-toggle[value=internal]");if(i instanceof HTMLInputElement)return"false"===t.getAttribute("data-org-allow-internal-repos")?(i.disabled=!0,e&&e.classList.add("text-gray-light"),o&&(o.hidden=!0),r&&(r.hidden=!1)):(n&&(i.checked=!0,ht(i,"change")),i.disabled=!1,e&&e.classList.remove("text-gray-light"),o&&(o.hidden=!1),r&&(r.hidden=!0)),i}}return null}(n.getAttribute("data-business-id"),n),i="false"!==n.getAttribute("data-org-allow-private-repos"),a=t(document,".js-privacy-toggle[value=private]",HTMLInputElement),c=document.querySelector(".js-privacy-toggle-label-private"),l=document.querySelector(".js-private-description"),u=document.querySelector(".js-private-restricted-by-policy-description");Um(i,a,c,l,u),function(){const e=document.querySelectorAll('.js-org-upgrade-link:not([hidden=""]');for(const t of e)t.hidden=!0}();const d="false"!==n.getAttribute("data-org-private-restricted-by-plan"),m=document.querySelector(".js-upgrade-private-description"),f="false"!==n.getAttribute("data-org-show-upgrade"),p=n.getAttribute("data-org-name"),g=p?document.querySelector(`a[data-upgrade-link="${p}"]`):null,h=document.querySelector(".js-ask-owner-message");i||!d?(m&&(m.hidden=!0),g&&(g.hidden=!0),h&&(h.hidden=!0)):(u&&(u.hidden=d),m&&(m.hidden=!1),g&&(g.hidden=!f),h&&(h.hidden=f));const b="true"===n.getAttribute("data-org-show-trade-controls"),v="true"===n.getAttribute("data-user-show-trade-controls"),w=document.querySelector(".js-trade-controls-description"),j=document.querySelector(".js-individual-trade-controls-description");(v||b&&!i)&&(a.disabled=!0,l&&(l.hidden=!0),u&&(u.hidden=!0),m&&(m.hidden=!0),g&&(g.hidden=!0),h&&(h.hidden=!0)),v?(w&&(w.hidden=!0),j&&(j.hidden=!1)):!i&&b&&w&&(w.hidden=!1),function(e,t,n,s){let o=null;"private"!==e.getAttribute("data-default")||s.disabled?"internal"===e.getAttribute("data-default")&&n&&!n.disabled?o=n:t.disabled?n&&!n.disabled&&(o=n):o=t:o=s;if(!o)return;const r=t.disabled&&t.checked||s.disabled&&s.checked||n&&n.disabled&&n.checked,i=!(t.checked||n&&n.checked||s.checked);!1!==Fm&&!0!==r&&!0!==i||(o.checked=!0,ht(o,"change"))}(n,o,r,a),function(e){for(const s of document.querySelectorAll(".js-with-permission-fields"))s.hidden=!e;for(const s of document.querySelectorAll(".js-without-permission-fields"))s.hidden=e;const t=document.querySelector(".errored"),n=document.querySelector("dl.warn");t&&(t.hidden=!e);n&&(n.hidden=!e)}("yes"===n.getAttribute("data-permission")),function(){const e=document.querySelector("#js-upgrade-container");if(!e)return;const n=t(document,"#js-payment-methods-form");e.firstElementChild&&n.appendChild(e.firstElementChild);const s=t(document,"input[name=owner]:checked",HTMLInputElement).value,o=n.querySelector(`.js-upgrade[data-login="${s}"]`);o&&e.appendChild(o)}(),Wm();const y=document.querySelector(".js-quick-install-container");if(y){const e=t(y,".js-quick-install-divider");e.hidden=!0;const n=t(document,"input[name=owner]:checked",HTMLInputElement).parentElement;if(n){const s=n.querySelector(".js-quick-install-list-template");if(s instanceof HTMLTemplateElement){const n=t(y,".js-account-apps");n.innerHTML="",n.append(s.content.cloneNode(!0)),s.children.length>0&&(e.hidden=!1)}}}}function Um(e,t,n,s,o){e?(t.disabled=!1,n&&n.classList.remove("text-gray-light"),s&&(s.hidden=!1),o&&(o.hidden=!0)):(t.disabled=!0,n&&n.classList.add("text-gray-light"),s&&(s.hidden=!0),o&&(o.hidden=!1))}function Wm(e){const t=document.querySelector("#js-upgrade-container");if(!t)return;const n=t.querySelector(".js-billing-section"),s=t.querySelector(".js-confirm-upgrade-checkbox");let o=e?e.target:null;if(o||(o=document.querySelector(".js-privacy-toggle:checked")),!(o instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/repositories/new.ts:238");if("false"===o.value){if(t.hidden=!1,n&&n.classList.remove("has-removed-contents"),s){if(!(s instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/repositories/new.ts:244");s.checked=!0}}else if(t.hidden=!0,n&&n.classList.add("has-removed-contents"),s){if(!(s instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/repositories/new.ts:253");s.checked=!1}zm()}function zm(){const e=t(document,".js-repo-form"),n=t(e,".js-repo-name"),s=e.querySelector(".js-repo-url");let o=!s||!s.classList.contains("is-autocheck-errored");o&&n&&(o=n.classList.contains("is-autocheck-successful"),"private"===t(document,".js-privacy-toggle:checked",HTMLInputElement).value&&(o=o&&function(){const e=document.querySelector("#js-upgrade-container");if(!e)return!0;if(e.querySelector(".js-ofac-sanction-notice"))return!1;const t=e.querySelector(".js-confirm-upgrade-checkbox");if(t instanceof HTMLInputElement&&!t.checked)return!1;const n=e.querySelector(".js-zuora-billing-info");if(n&&n.classList.contains("d-none"))return!1;return!0}())),t(e,"button[type=submit]",HTMLButtonElement).disabled=!o}async function Vm(e){const n=e.form;t(n,"#release_draft",HTMLInputElement).value="1",Ym(e,"saving");try{const t=await F(n.action,{method:n.method,body:new FormData(n)});return Ym(e,"saved"),setTimeout(Ym,5e3,e,"default"),ht(n,"release:saved",{release:t}),t}catch(s){throw Ym(e,"failed"),s}}function Km(e){const n=p(e,".js-releases-marketplace-publish-container"),s=t(n,".js-releases-marketplace-publish-preview");e.checked?s.classList.remove("d-none"):s.classList.add("d-none")}function Ym(e,t){for(const n of e.querySelectorAll(".js-save-draft-button-state"))n.hidden=n.getAttribute("data-state")!==t;e.disabled="saving"===t}function Jm(e){const t=document.querySelector(".js-release-target-wrapper");if(null!=t){switch(e){case"valid":t.classList.add("d-none");break;case"loading":break;default:t.classList.remove("d-none")}for(const t of document.querySelectorAll(".js-tag-status-message"))t.hidden=t.getAttribute("data-state")!==e}}pt("#js-upgrade-container .js-zuora-billing-info:not(.d-none)",zm),pt(".page-new-repo",(function(){const e=document.querySelector("#js-upgrade-container");e&&(e.hidden=!0),Om();const t=document.querySelector(".js-owner-select");t&&t.focus()})),ft("click",".js-reponame-suggestion",(function(e){const n=t(document,".js-repo-name",HTMLInputElement);n.value=e.currentTarget.textContent,ht(n,"input",!1)})),ft("click",".js-privacy-toggle",(function(){Fm=!0})),ft("change",".js-privacy-toggle",Wm),ft("details-menu-selected",".js-owner-container",Om,{capture:!0}),ft("change","#js-upgrade-container input",zm),j("#js-upgrade-container input",zm),ft("auto-check-send",".js-repo-name-auto-check",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/repositories/new.ts:334");const n=e.currentTarget.form;if(!n)throw new Error("invariant: app/assets/modules/github/repositories/new.ts:337");const s=t(n,"input[name=owner]:checked",HTMLInputElement).value;e.detail.body.append("owner",s)})),ft("auto-check-complete","#repository_name",(function(){zm()})),j(".js-repo-url",(function(e){const n=e.target;if(!(n instanceof HTMLInputElement))return;const s=n.closest(".form-group");if(!(s instanceof HTMLDListElement))return;const o=t(document,".js-insecure-url-warning"),r=t(document,".js-svn-url-error"),i=t(document,".js-git-url-error"),a=n.value.toLowerCase();o.hidden=!a.startsWith("http://"),r.hidden=!a.startsWith("svn://"),i.hidden=!a.startsWith("git://"),a.startsWith("svn://")||a.startsWith("git://")?(n.classList.add("is-autocheck-errored"),s.classList.add("errored")):(n.classList.remove("is-autocheck-errored"),s.classList.remove("errored")),zm()})),ft("click",".js-packages-learn-more-dismiss",(function(){const e=t(document,".js-packages-popover-form",HTMLFormElement);L(e)})),ft("tab-container-changed",".js-branches-tags-tabs",(async function(e){if(!(e instanceof CustomEvent))return;const t=e.detail.relatedTarget,n=e.currentTarget;if(!n)return;let s,o;for(const i of n.querySelectorAll("[data-controls-ref-menu-id]")){if(!(i instanceof W||i instanceof B))return;const e=h(i,"data-controls-ref-menu-id"),n=t.id===e;i.hidden=!n,n?o=i:s||(s=i.input?i.input.value:"")}const r=o&&o.input;r&&(o&&void 0!==s&&(r.value=s),r.focus())})),pt(".js-pulse-contribution-data",e=>{!async function(e){const n=e.getAttribute("data-pulse-diffstat-summary-url");let s;try{n&&(s=await async function(e){return $(document,e)}(n),function(e,t){t.innerHTML="",t.appendChild(e)}(s,e))}catch(o){const n=t(e,".js-blankslate-loading"),s=t(e,".js-blankslate-error");n.classList.add("d-none"),s.classList.remove("d-none")}}(e)}),ft("change",".js-releases-marketplace-publish-field",(function(e){Km(e.currentTarget)})),pt(".js-releases-marketplace-publish-field",(function(e){Km(e)})),ft("click",".js-save-draft",(function(e){const t=e.currentTarget;if(!(t instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/repositories/releases.ts:49");Vm(t),e.preventDefault()})),ft("click",".js-timeline-tags-expander",(function(e){const t=e.currentTarget;p(t,".js-timeline-tags").classList.remove("is-collapsed")})),ft("release:saved",".js-release-form",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/repositories/releases.ts:67");const n=e.detail.release,s=e.currentTarget,o=s.getAttribute("data-repo-url"),r=n.update_url||Qm("tag",o,n.tag_name);if(s.setAttribute("action",r),n.update_authenticity_token){s.querySelector("input[name=authenticity_token]").value=n.update_authenticity_token}const i=n.edit_url||Qm("edit",o,n.tag_name);A(Z(),document.title,i);const a=document.querySelector("#delete_release_confirm form");if(a){const e=n.delete_url||Qm("tag",o,n.tag_name);if(a.setAttribute("action",e),n.delete_authenticity_token){t(a,"input[name=authenticity_token]",HTMLInputElement).value=n.delete_authenticity_token}}const c=s.querySelector("#release_id");if(!c.value){c.value=n.id;const e=document.createElement("input");e.type="hidden",e.name="_method",e.value="put",s.appendChild(e)}})),ft("click",".js-publish-release",(function(){t(document,"#release_draft",HTMLInputElement).value="0"}));const Xm=new WeakMap;async function Gm(e){if(!e.value)return;if(e.value===Xm.get(e))return;Jm("loading"),Xm.set(e,e.value);const n=h(e,"data-url"),s=new URL(n,window.location.origin),o=new URLSearchParams(s.search.slice(1));o.append("tag_name",e.value),s.search=o.toString();try{const n=await F(s.toString());"duplicate"===n.status&&parseInt(e.getAttribute("data-existing-id"))===parseInt(n.release_id)?Jm("valid"):(t(document,".js-release-tag .js-edit-release-link").setAttribute("href",n.url),Jm(n.status))}catch(oh){Jm("invalid")}}function Qm(e,t,n){return`${t}/releases/${e}/${n}`}function Zm(e){const t=p(e,"form",HTMLFormElement).querySelector(".js-previewable-comment-form");if(!t)return;let s=t.getAttribute("data-base-preview-url");s||(s=String(t.getAttribute("data-preview-url")),t.setAttribute("data-base-preview-url",s));const o=n(e,'input[name="release[tag_name]"], input[name="release[target_commitish]"]:checked',HTMLInputElement),r=new URL(s,window.location.origin),i=new URLSearchParams(r.search.slice(1));for(const n of o)n.value&&i.append(n.name,n.value);r.search=i.toString(),t.setAttribute("data-preview-url",r.toString())}function ef(e){return!!e.value&&e.value!==e.defaultValue}async function tf(e){t(document,".js-cooper-enter-prompt").hidden=!e}pt("input.js-release-tag-field",{constructor:HTMLInputElement,initialize(e){Gm(e),e.addEventListener("blur",(function(){Gm(e)}))}}),ft("change",".js-release-tag",(function(e){Zm(e.currentTarget)})),pt(".js-release-form .js-previewable-comment-form",(function(e){Zm(t(p(e,"form"),".js-release-tag"))})),pt(".js-cooper-query",{constructor:HTMLInputElement,add(e){e.selectionStart=e.selectionEnd=e.value.length,tf(ef(e)),e.addEventListener("focus",e=>{const t=e.currentTarget;if(!(t instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/repositories/code-search.ts:16");tf(ef(t))}),e.addEventListener("blur",()=>{tf(!1)})}}),ft("submit",".js-cooper-form",()=>{const e=t(document,".js-cooper-query",HTMLInputElement),n=t(document,".js-cooper-results"),s=t(document,".js-cooper-shimmer-cards"),o=t(s,".js-cooper-label-placeholder"),r=t(o,"span",HTMLSpanElement),i=t(o,"h3",HTMLHeadingElement),a=t(i,"span",HTMLSpanElement);n.hidden=!0,s.hidden=!1,r.hidden=!0,i.hidden=!1,a.textContent=e.value}),f("keyup",".js-cooper-query",e=>{const n=e.currentTarget;if(!(n instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/repositories/code-search.ts:44");if("Escape"===e.key){const s=n.form;if(!(s instanceof HTMLFormElement))throw new Error("invariant: app/assets/modules/github/repositories/code-search.ts:47");const o=s.getAttribute("data-esc-to");o&&K({url:o,container:t(document,"#js-repo-pjax-container")}),e.preventDefault()}else tf(ef(n))}),ft("change",".js-discussion-type-toggle",(function(e){const t=e.currentTarget,s=p(t,"form");!function(e,t){let s,o;e.checked?(s=n(t,".js-discussion-type-off"),o=n(t,".js-discussion-type-on")):(s=n(t,".js-discussion-type-on"),o=n(t,".js-discussion-type-off"));for(const n of s)n.hidden=!0;for(const n of o)n.hidden=!1}(t,s),function(e,t){const n=e.getAttribute("data-submit-confirm");if(!n)return;const s=t.querySelector(".js-discussion-form-submit");s&&(e.checked?s.removeAttribute("data-confirm"):s.setAttribute("data-confirm",n))}(t,s)})),f("keydown",".js-tree-finder-field",e=>{"Escape"===e.key&&(e.preventDefault(),history.back())});function nf(e,n){if(Qc(e))return;const s=t(document,".js-site-search-form",HTMLFormElement);let o,r;t(document,".js-site-search").classList.toggle("scoped-search",n),n?(o=h(s,"data-scoped-search-url"),r=h(e,"data-scoped-placeholder")):(o=h(s,"data-unscoped-search-url"),r=h(e,"data-unscoped-placeholder")),s.setAttribute("action",o),e.setAttribute("placeholder",r)}function sf(e){if(!(e.currentTarget instanceof Element))throw new Error("invariant: app/assets/modules/github/search/results.ts:12");const t=e.currentTarget.querySelector(".js-search-result-feedback");t&&t.classList.add("show")}function of(e){if(!(e.currentTarget instanceof Element))throw new Error("invariant: app/assets/modules/github/search/results.ts:20");const t=e.currentTarget.querySelector(".js-search-result-feedback");t&&t.classList.remove("show")}function rf(e){const s=e.currentTarget;if(!(s instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/search/results.ts:30");s.classList.add("text-gray-dark"),s.classList.remove("link-gray");const o=p(s,".js-search-result-feedback");for(const t of n(o,".js-search-rating",HTMLButtonElement))t.disabled=!0;t(o,".js-search-feedback-form").classList.add("show")}function af(){const e=document.body;if(!e)throw new Error("invariant: app/assets/modules/github/sessions/two-factor.ts:10");e.classList.add("is-sending"),e.classList.remove("is-sent","is-not-sent")}function cf(){const e=document.body;if(!e)throw new Error("invariant: app/assets/modules/github/sessions/two-factor.ts:16");e.classList.add("is-sent"),e.classList.remove("is-sending")}function lf(e){const n=document.body;if(!n)throw new Error("invariant: app/assets/modules/github/sessions/two-factor.ts:27");e&&(t(document,".js-sms-error").textContent=e),n.classList.add("is-not-sent"),n.classList.remove("is-sending")}function uf(e){const n=t(document,".js-stale-session-flash"),s=t(n,".js-stale-session-flash-signed-in"),o=t(n,".js-stale-session-flash-signed-out");n.hidden=!1,s.hidden="false"===e,o.hidden="true"===e,window.addEventListener("popstate",(function(e){e.state&&null!=e.state.container&&location.reload()})),document.addEventListener("submit",(function(e){e.preventDefault()}))}let df;if(pt(".js-tree-finder",e=>{const n=t(e,".js-tree-finder-field",HTMLInputElement),s=t(e,".js-tree-browser-results");s.childElementCount>0||((async e=>{if(!(e instanceof FuzzyListElement))return;const n=h(e,"data-url"),s=t(e,".js-tree-browser-result-template",HTMLTemplateElement),{paths:o}=await F(n);e.addLazyItems(o,e=>{const n=s.content.cloneNode(!0).firstElementChild;if(!n)throw new Error("invariant: app/assets/modules/github/repositories/tree-finder.ts:23");const o=t(n,".js-tree-browser-result-anchor",HTMLAnchorElement),r=t(o,".js-tree-browser-result-path"),i=new URL(o.href,window.location.origin);return i.pathname=`${i.pathname}/${encodeURI(e)}`,o.href=String(i),r.textContent=e,n}),e.sort()})(e),r(n,s),e.addEventListener("fuzzy-list-will-sort",()=>{i(n,s)}),e.addEventListener("fuzzy-list-sorted",()=>{a(n,s)}))}),ft("details-menu-selected",".js-advisory-menu",(function(e){const t=e.detail.relatedTarget,s=h(t,"data-advisory-info-show"),o=n(document,".js-show-if-publishing, .js-show-if-requesting-cve");for(const n of o)n.hidden=!n.classList.contains(s)}),{capture:!0}),pt(".js-codesearch-nav",(function(e){const t=e.querySelector(".selected");if(!(t instanceof HTMLElement))return;const n=t.offsetLeft,s=t.offsetWidth,o=n+s,r=window.innerWidth;(o-e.scrollLeft>r||ob(v(e,"mouseover",sf),v(e,"mouseleave",of))}),pt(".js-search-rating",{subscribe:e=>v(e,"click",rf)}),ft("click",".js-segmented-nav-button",(function(e){e.preventDefault();const s=e.currentTarget,o=h(s,"data-selected-tab"),r=p(s,".js-segmented-nav"),i=r.parentElement;if(!i)throw new Error("invariant: app/assets/modules/github/segmented-nav.ts:10");for(const t of n(r,".js-segmented-nav-button"))t.classList.remove("selected");s.classList.add("selected");for(const t of n(i,".js-selected-nav-tab"))t.parentElement===i&&t.classList.remove("active");t(document,`.${o}`).classList.add("active")})),E(".js-send-auth-code",async(e,t)=>{let n;af();try{n=await t.text()}catch(s){lf(s.response.text)}n&&cf()}),ft("click",".js-send-two-factor-code",(async function(e){const n=e.currentTarget;if(!(n instanceof HTMLButtonElement))throw new Error("invariant: app/assets/modules/github/sessions/two-factor.ts:52");const s=n.form;if(!s)throw new Error("invariant: app/assets/modules/github/sessions/two-factor.ts:54");const o=`${t(s,".js-country-code-select",HTMLSelectElement).value} ${t(s,".js-sms-number",HTMLInputElement).value}`;if(af(),!(n.parentElement instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/sessions/two-factor.ts:59");const r=t(n.parentElement,".js-data-url-csrf",HTMLInputElement),i=new FormData;i.append("number",o);try{const e=h(n,"data-url");await d(Me(e,r.value,{method:"post",body:i})),cf();for(const t of s.querySelectorAll(".js-2fa-enable"))(t instanceof HTMLInputElement||t instanceof HTMLButtonElement)&&(t.disabled=!1);t(s,".js-2fa-otp").focus()}catch(a){if(a.response){lf(await a.response.text())}for(const e of s.querySelectorAll(".js-2fa-enable"))(e instanceof HTMLInputElement||e instanceof HTMLButtonElement)&&(e.disabled=!0)}})),ft("click",".js-enable-enable-two-factor-auth-button",(function(){const e=t(document,".js-enable-two-factor-auth-button",HTMLButtonElement);e.disabled=!1,e.removeAttribute("aria-label"),e.classList.remove("tooltipped")})),pt(".js-two-factor-sms-fallback-button",(function(e){e.addEventListener("toggle",(function(e){const n=e.currentTarget;if(!(n instanceof Element))throw new Error("invariant: app/assets/modules/github/sessions/two-factor.ts:99");for(const t of n.querySelectorAll(".flash"))t instanceof HTMLElement&&(t.hidden=!0);t(n,".js-configure-sms-fallback").hidden=!1,t(n,".js-verify-sms-fallback").hidden=!0}))})),E(".js-two-factor-set-sms-fallback",async(e,n)=>{let s;try{s=await n.text()}catch(o){const n=t(e,".js-configure-sms-fallback"),s=t(e,".js-verify-sms-fallback"),r=n.hidden?s:n,i=t(r,".flash");switch(o.response.status){case 422:case 429:i.textContent=o.response.text,i.hidden=!1}}if(s)switch(s.status){case 200:case 201:window.location.reload();break;case 202:t(e,".js-configure-sms-fallback").hidden=!0,t(e,".js-verify-sms-fallback").hidden=!1,t(e,".js-fallback-otp").focus()}}),"function"==typeof BroadcastChannel)try{df=new BroadcastChannel("stale-session"),df.onmessage=e=>{"string"==typeof e.data&&uf(e.data)}}catch(rh){}if(!df){let e=!1;df={postMessage(t){e=!0;try{window.localStorage.setItem("logged-in",t)}finally{e=!1}}},window.addEventListener("storage",(function(t){if(!e&&t.storageArea===window.localStorage&&"logged-in"===t.key)try{"true"!==t.newValue&&"false"!==t.newValue||uf(t.newValue)}finally{window.localStorage.removeItem(t.key)}}))}const mf=document.querySelector(".js-stale-session-flash[data-signedin]");if(mf){const e=mf.getAttribute("data-signedin")||"";df.postMessage(e)}function ff(e){if(!(e instanceof HTMLInputElement))return;const t=e.closest(".checkable-input-container");if(!t)return;const n=t.querySelector(".js-checkable-input-target");n&&(t.classList.toggle("checked",e.checked),n instanceof HTMLElement&&(n.hidden=!e.checked))}document.addEventListener("pjax:end",(function(){const e=document.querySelector('meta[name="selected-link"]'),t=e&&e.getAttribute("value");if(t)for(const n of document.querySelectorAll(".js-sidenav-container-pjax .js-selected-navigation-item")){const e=(n.getAttribute("data-selected-links")||"").split(" ").indexOf(t)>=0;n.classList.toggle("selected",e)}})),pt(".js-contact-javascript-flag",{constructor:HTMLInputElement,add(e){e.value="true"}}),ft("click",".js-launch-sales-chat",(function(e){const t=window.screenX,n=window.screenY,s=440,o=500,r=[`width=${s}`,`height=${o}`,"location=no","resizable=yes","scrollbars=yes",`left=${window.innerWidth+t-(s+16)}`,`top=${window.innerHeight+n-(o-64)}`],i=window.location.pathname.split("/").filter((function(e){return""!==e})).slice(-1)[0];window.open(`https://sales-chat.github.com/${i}`,"Sales_Chat",r.join(",")),e.preventDefault()})),pt(".js-checkable-input-trigger",ff),ft("change",".js-checkable-input-trigger",e=>ff(e.target));const pf=["notification_referrer_id","notifications_before","notifications_after","notifications_query"];function gf(e,t=null){return e.has("notification_referrer_id")?(function(e,t){const n=hf(t);if(!n)return;const s={pathname:n};for(const o of pf){const t=e.get(o);t&&(s[o]=t)}ba("notification_shelf",JSON.stringify(s))}(e,t),function(e){for(const t of pf)e.delete(t);return e}(e)):null}function hf(e){const t=(e=e||window.location.pathname).match(/^(\/[^/]+\/[^/]+\/pull\/[^/]+)/);return t?t[0]:null}async function bf(e){try{await e.text()}catch(t){}}ft("socket:message",".js-notification-indicator",(function(e){const n=e.currentTarget,s=e.detail.data;n.setAttribute("aria-label",s.aria_label),n.setAttribute("data-ga-click",s.ga_click),(n.querySelector(".js-indicator-modifier")||t(n,"span")).setAttribute("class",s.span_class)})),async function(){E(".js-notification-shelf .js-notification-action form",(async function(e,n){if(e.hasAttribute("data-redirect-to-inbox-on-submit")){await bf(n);const e=t(document,".js-notifications-back-to-inbox",HTMLAnchorElement);e&&e.click()}else Ze(e,e),await bf(n)}))}(),function(){const e=function(){const e=gf(new URLSearchParams(window.location.search));if(e){const t=new URL(window.location.href,window.location.origin);return t.search=e.toString(),t.toString()}}();e&&A(null,"",e)}(),pt(".js-notification-shelf-include-fragment",(function(e){if(!(e instanceof m))return;const t=function(e=null){const t=hf(e);if(!t)return va("notification_shelf"),null;try{const e=ha("notification_shelf");if(!e)return null;const n=JSON.parse(e);if(!n||!n.pathname)throw new Error("Must have a pathname");if(n.pathname!==t)throw new Error("Stored pathname does not match current pathname.");const s={};for(const t of pf)s[t]=n[t];return s}catch(oh){return va("notification_shelf"),null}}();if(!t)return;const n=e.getAttribute("data-base-src");if(!n)return;const s=new URL(n,window.location.origin),o=new URLSearchParams(s.search);for(const[r,i]of Object.entries(t))"string"==typeof i&&o.set(r,i);s.search=o.toString(),e.setAttribute("src",s.toString())}));let vf=!1;async function wf(){if(vf)return;vf=!0;const e={contexts:t(document,"meta[name=github-keyboard-shortcuts]",HTMLMetaElement).content},n=`/site/keyboard_shortcuts?${new URLSearchParams(e).toString()}`;(await D({content:$(document,n),dialogClass:"hx_Box--overlay--wide container-xl"})).addEventListener("dialog:remove",(function(){vf=!1}),{once:!0})}ft("click",".js-keyboard-shortcuts",wf),document.addEventListener("keydown",e=>{e.target instanceof Node&&Ie(e.target)||"?"===J(e)&&wf()}),pt(".js-modifier-key",{constructor:HTMLElement,add(e){if(/Macintosh/.test(navigator.userAgent)){let t=e.textContent;t&&(t=t.replace(/ctrl/,"โŒ˜"),t=t.replace(/alt/,"โŒฅ"),e.textContent=t)}}}),pt(".js-modifier-label-key",{add(e){if(/Macintosh/.test(navigator.userAgent)){let t=h(e,"aria-label");t=t.replace(/ctrl\+/,"cmd-"),t=t.replace(/alt\+/,"option-"),e.setAttribute("aria-label",t)}}}),pt(".js-site-status-container",{initialize(e){!async function(e){const n=o(document,"site-status-api-url"),s=await window.fetch(n),r=await s.json(),i=r.status.indicator;if("none"!==i&&e instanceof HTMLElement){t(e,".js-site-status-message").textContent=r.status.description,t(e,".js-site-status-time").setAttribute("datetime",r.page.updated_at);const n="minor"===i?"flash-warn":"flash-error";t(e,".flash").classList.add(n),e.hidden=!1}}(e)}});const jf=[{sectionName:"actions-events",percent:95},{sectionName:"actions-workflow",percent:100},{sectionName:"actions-workflow-logs",percent:100},{sectionName:"actions-templates",percent:100},{sectionName:"security-vulnerability",percent:60},{sectionName:"security-workspace",percent:70},{sectionName:"security-alerts-graph",percent:60},{sectionName:"security-alerts",percent:60},{sectionName:"security-dependabot",percent:50},{sectionName:"security-patches-graph",percent:70},{sectionName:"security-token-scanning",percent:70},{sectionName:"security-lgtm",percent:60},{sectionName:"mobile-notification",percent:90},{sectionName:"mobile",percent:50},{sectionName:"hide-notification",percent:50},{sectionName:"mobile-triage",percent:50},{sectionName:"mobile-work",percent:50},{sectionName:"mobile-contribute",percent:50},{sectionName:"mobile-nightmode",percent:70},{sectionName:"mobile-beta",percent:50},{sectionName:"enterprise-nav",percent:0},{sectionName:"insights-dashboard",percent:70}];function yf(e){e.map(({sectionName:e,percent:t})=>{!function(e,t,s,o){const r=window.innerHeight||document.documentElement&&document.documentElement.clientHeight;e.map(e=>{const i=n(document,`.${t}`),a=e.getBoundingClientRect().top,c=e.getBoundingClientRect().bottom,l=Math.round(a/r*100),u=Math.round(c/r*100);l<=o?e.classList.contains(t)?e.classList.add(s):i.map(e=>e.classList.add(s)):(e.classList.remove(s),e.classList.contains(t)||i.map(e=>e.classList.remove(s))),c<=u&&(e.classList.remove(s),e.classList.contains(t)||i.map(e=>e.classList.remove(s)))})}(n(document,`.section-${e}`),`target-${e}`,`animate-${e}`,t)})}function Ef(e){const t=function(e){return n(document,".js-pricing-plan-card").indexOf(e)}(e);return Array.from(n(document,".js-pricing-plan-tab"))[t]}let Lf;function Tf(){const e=window.innerWidth/2;let n=t(document,".js-pricing-plan-card"),s=window.innerWidth;for(const t of Lf){const o=t.getBoundingClientRect().left+t.getBoundingClientRect().width/2,r=Math.abs(e-o);o>0&&oyf(jf),!1),window.addEventListener("resize",()=>yf(jf),!1),window.addEventListener("load",()=>yf(jf),!1),ft("click",".js-pricing-plan-tab",(function(e){const s=e.currentTarget;if(!(s instanceof HTMLElement))return;t(document,".pricing-plan-tab-active").classList.remove("pricing-plan-tab-active"),s.classList.add("pricing-plan-tab-active");const o=function(e){const t=function(e){return n(document,".js-pricing-plan-tab").indexOf(e)}(e);return Array.from(n(document,".js-pricing-plan-card"))[t]}(s),r=o.offsetLeft-(window.innerWidth-o.clientWidth)/2;t(document,".js-pricing-plans-container").scrollTo({top:0,left:r,behavior:"smooth"})})),pt(".js-pricing-plans-container",()=>{t(document,".js-pricing-plans-container").addEventListener("wheel",Tf,{capture:!1,passive:!0}),"ontouchstart"in window&&t(document,".js-pricing-plans-container").addEventListener("scroll",Tf,{capture:!1,passive:!0})}),pt(".js-pricing-plans-container .js-pricing-plan-card",()=>{Lf=n(document,".js-pricing-plans-container .js-pricing-plan-card")}),pt(".js-pricing-plans-header-container",e=>{const t=Sd("pricing_page_gh1");"gh1_pricing_column_v1"!==t&&"gh1_pricing_column_v2"!==t||e.classList.add("pricing-plans-container-wide")}),ft("click",".js-pricing-learn-more-gh1",(function(){for(const e of n(document,".js-pricing-github-one-container"))e.classList.remove("pricing-github-one-container-hidden");for(const e of n(document,".js-pricing-learn-more-container"))e.classList.add("pricing-learn-more-container-collapsed");for(const e of n(document,".js-pricing-github-one-details"))e.classList.remove("pricing-github-one-details-collapsed")})),pt(".js-pricing-testimonial-logo",()=>{for(const e of n(document,".js-pricing-testimonial-logo"))e.addEventListener("mouseenter",kf)}),ft("click",".js-pricing-testimonial-logo",e=>{kf(e)}),ft("click",".js-toggle-pricing-details",e=>{e.stopPropagation();const n=p(e.currentTarget,".js-pricing-matrix-row");t(n,".js-pricing-matrix-details").classList.toggle("pricing-matrix-details-visible"),t(n,".js-pricing-expand-arrow").classList.toggle("pricing-expand-arrow-open")});const Sf=new WeakMap;pt(".js-insights-hero-block",{add(e){Sf.set(e,setTimeout((function s(){const o=n(document,".js-insights-hero-chart"),r=t(document,".js-insights-hero-chart.js-show"),i=o.indexOf(r)+1,a=o[i===o.length?0:i];for(const e of o)e.classList.toggle("js-show",a===e);Sf.set(e,setTimeout(s,4e3))}),4e3))},remove(e){const t=Sf.get(e);clearTimeout(t)}}),y(".js-skip-password-autofill",e=>{e instanceof HTMLInputElement&&(e.type="password")}),ft("click",".js-smoothscroll-anchor",(function(e){const t=e.currentTarget;if(!(t instanceof HTMLAnchorElement))return;const n=et(document,t.hash);n&&(n.scrollIntoView({behavior:"smooth"}),e.preventDefault())}));const Af={},xf={},Hf={};let Cf=null,qf=0,If=null;const _f=[];function $f(e){const t=Date.now();let n=Af[e]||0;const s=Hf[e];s&&(n=Math.max(n,s[1])),n>0&&t-n<36e5||(_f.push(e),Af[e]=t)}function Df(e){for(const t of _f)e.send(`subscribe:${t}`);_f.length=0}function Nf(){try{return Cf=function(){const e=document.head&&document.head.querySelector("link[rel=web-socket]");if(!(e instanceof HTMLLinkElement))return null;let t;try{t=new WebSocket(e.href)}catch(o){if(o.name&&"SecurityError"!==o.name)throw new Error(`error opening WebSocket: ${o.message} (${o.name})`);return null}function n(){clearTimeout(s),qf=0,Df(t)}t.addEventListener("open",n);const s=setTimeout((function(){t.removeEventListener("open",n),t.close(),t===Cf&&(Cf=null)}),4e3);return t.addEventListener("close",Bf),t.addEventListener("message",(function(e){const[t,n]=JSON.parse(String(e.data));if(!t||!n)return;const s=xf[t]||[];for(const o of s)ht(o,"socket:message",{data:n,name:t});Hf[t]=[n,Date.now()]})),t}(),Cf}catch(e){throw Cf=null,e}}function Bf(e){if(!1===navigator.onLine||null==document.querySelector(".js-socket-channel"))return;let t=Cf,n=1e3;if(e instanceof CloseEvent&&(n=e.code),e.target instanceof WebSocket&&(t=e.target),qf>=5||1008===n||1011===n)return window.removeEventListener("online",Bf),void(t&&(t.removeEventListener("close",Bf),t.close(1e3,"give-up-reconnects"),t===Cf&&(Cf=null)));let s=0;1012===n||1013===n?s=100:qf>0&&(s=1e3*Math.pow(2,qf)),qf+=1,If&&clearTimeout(If),If=window.setTimeout(Nf,s)}function Pf(e){const t=e.getAttribute("data-channel");return t?t.split(/\s+/):[]}function Rf(e,t){let{wait:n}=e;return null!=n&&(n-=t,n<=0&&(n=null)),n===e.wait?e:Object.assign({},e,{wait:n})}function Ff(e,t,n){const s=e.getBoundingClientRect().height,o=t.getBoundingClientRect(),r=n.getBoundingClientRect();let i=r.top;i+o.height+10>=s&&(i=Math.max(s-o.height-10,0));let a=r.right;null!=n.closest(".js-build-status-to-the-left")&&(a=Math.max(r.left-o.width-10,0)),t.style.top=`${i}px`,t.style.left=`${a}px`,t.style.right="auto"}async function Of(e){const n=e.querySelector(".js-dropdown-details"),s=e.querySelector(".js-status-dropdown-menu")||e.closest(".js-status-dropdown-menu");if(!(s instanceof HTMLElement))return;const o=t(s,".js-status-loader"),r=t(s,".js-status-loading"),i=t(s,".js-status-error"),a=h(o,"data-contents-url");let c;r.classList.remove("d-none"),i.classList.add("d-none");try{await R(),c=await $(document,a)}catch(l){r.classList.add("d-none"),i.classList.remove("d-none")}if(c){o.replaceWith(c),t(s,".js-details-container").classList.add("open");const e=document.body;e&&n&&s.classList.contains("js-append-menu-to-body")&&Ff(e,s,n)}}function Uf({currentTarget:e}){if(!(e instanceof Element))throw new Error("invariant: app/assets/modules/github/statuses.ts:100");Of(e)}async function Wf(e){const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.getAttribute("data-sudo-required");n&&(e.stopPropagation(),e.preventDefault(),await Pe(n)&&(t.removeAttribute("data-sudo-required"),t instanceof HTMLFormElement?L(t):t.click()))}window.WebSocket&&(pt(".js-socket-channel[data-channel]",{add:function(e){const t=Cf||Nf();if(t){for(const t of Pf(e))$f(t),null==xf[t]&&(xf[t]=[]),xf[t].push(e);t.readyState===WebSocket.OPEN&&Df(t)}},remove:function(e){for(const t of Pf(e)){const n=xf[t];if(n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}}}),window.addEventListener("online",Bf),window.addEventListener("offline",(function(){Cf&&Cf.close(1e3,"navigator-offline")}))),document.addEventListener("pjax:popstate",(function(e){if(!(e instanceof CustomEvent))return;const t=e.target;if(!(t instanceof Element))return;const n=e.detail.cachedAt;n&&setTimeout(()=>{const e=Date.now();for(const s of t.querySelectorAll(".js-socket-channel[data-channel]"))for(const t of Pf(s)){if(!(t in Hf))continue;const[o,r]=Hf[t];r{Of(e)}),pt(".js-build-status",{add(e){e.addEventListener("mouseenter",Uf,{once:!0})},remove(e){e.removeEventListener("mouseenter",Uf)}}),ft("click","button[data-sudo-required], summary[data-sudo-required]",Wf),pt("form[data-sudo-required]",{constructor:HTMLFormElement,subscribe:e=>v(e,"submit",Wf)});const zf={"actor:":"ul.js-user-suggestions","user:":"ul.js-user-suggestions","operation:":"ul.js-operation-suggestions","org:":"ul.js-org-suggestions","action:":"ul.js-action-suggestions","repo:":"ul.js-repo-suggestions","country:":"ul.js-country-suggestions"};function Vf(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/suggesters/audit-log-suggester.ts:21");const{key:t,item:n}=e.detail;if(!Yf(t))return;const s=h(n,"data-value");e.detail.value=`${t}${s}`}function Kf(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/suggesters/audit-log-suggester.ts:29");const{key:t,provide:n}=e.detail;if(!Yf(t))return;const s=e.target;if(!(s instanceof Element))throw new Error("invariant: app/assets/modules/github/suggesters/audit-log-suggester.ts:34");n(async function(e,t,n){const s=(await Jf(e)).querySelector(function(e){const t=zf[e];if(!t)throw new Error(`Unknown audit log expander key: ${e}`);return t}(t));if(!(s instanceof HTMLElement))return{matched:!1};const o=er(s,n,{limit:5});return{fragment:s.cloneNode(!0),matched:o>0}}(h(s,"data-audit-url"),t,e.detail.text))}function Yf(e){return Object.getOwnPropertyNames(zf).includes(e)}pt("text-expander[data-audit-url]",{subscribe:e=>b(v(e,"text-expander-change",Kf),v(e,"text-expander-value",Vf))});const Jf=we((async function(e){const t=await $(document,e),n=document.createElement("div");return n.append(t),n}));const Xf={};function Gf(e){const t=e.getAttribute("data-emoji-name")||"";return Xf[t]=` ${function(e){return(e.getAttribute("data-text")||"").trim().toLowerCase()}(e).replace(/_/g," ")}`,t}function Qf(e,t){const n=Xf[e].indexOf(t);return n>-1?1e3-n:0}function Zf(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/suggesters/emoji-suggester.ts:53");":"===e.detail.key&&(e.detail.value=function(e){if(e.hasAttribute("data-use-colon-emoji"))return e.getAttribute("data-value");const t=e.firstElementChild;return t&&"G-EMOJI"===t.tagName&&!t.firstElementChild?t.textContent:e.getAttribute("data-value")}(e.detail.item))}function ep(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/suggesters/emoji-suggester.ts:59");const{key:t,provide:n}=e.detail;if(":"!==t)return;const s=e.target;if(!(s instanceof Element))throw new Error("invariant: app/assets/modules/github/suggesters/emoji-suggester.ts:64");n(async function(e,t){const n=await tp(e),s=function(e,t){return er(t,` ${e.toLowerCase().replace(/_/g," ")}`,{limit:5,text:Gf,score:Qf})}(t,n);return{fragment:n,matched:s>0}}(h(s,"data-emoji-url"),e.detail.text))}pt("text-expander[data-emoji-url]",{subscribe:e=>b(v(e,"text-expander-change",ep),v(e,"text-expander-value",Zf))});const tp=we((async function(e){const t=(await $(document,e)).firstElementChild;if(!(t instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/suggesters/emoji-suggester.ts:76");return t}));function np(e,t,n){const s=new RegExp(`\\b${o=e,o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`);var o;const r=/^\d+$/.test(e)?e=>function(e,t){const n=e.search(t);return n>-1?1e3-n:0}(e,s):t=>Ko(t,e),i=zc(n,e,{limit:5,text:e=>`${e.number} ${e.title.trim().toLowerCase()}`,score:r});return function(e,t){const n=e=>wt`
  • #${e.number} ${e.title}
  • `;vt((s=e,wt`
      ${s.map(n)}
    `),t);var s}(i,t),i.length}function sp(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/suggesters/issue-suggester.ts:56");if("#"!==e.detail.key)return;const t=h(e.detail.item,"data-value");e.detail.value=`#${t}`}function op(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/suggesters/issue-suggester.ts:63");const{key:t,provide:n}=e.detail;if("#"!==t)return;const s=e.target;if(!(s instanceof Element))throw new Error("invariant: app/assets/modules/github/suggesters/issue-suggester.ts:68");n(async function(e,t){const n=await rp(e),s=document.createElement("div"),o=np(t,s,n),r=s.firstElementChild;if(!(r instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/suggesters/issue-suggester.ts:77");return{fragment:r,matched:o>0}}(h(s,"data-issue-url"),e.detail.text))}pt("text-expander[data-issue-url]",{subscribe:e=>b(v(e,"text-expander-change",op),v(e,"text-expander-value",sp))});const rp=we(F);function ip(e,t,n){const s=zc(n,e,{limit:5,score:ap(e).score,text:e=>e.description?`${e.name} ${e.description}`.trim().toLowerCase():`${e.login} ${e.name}`.trim().toLowerCase()});return function(e,t){const n=e=>{const t="user"===e.type?e.login:e.name,n="user"===e.type?e.name:e.description;return wt`
  • ${t} ${n}
  • `};vt((s=e,wt`
      ${s.map(n)}
    `),t);var s}(s,t),s.length}function ap(e){let t;if(e){const n=e.toLowerCase().split("");t=function(t){if(!t)return 0;const s=function(e,t){let n,s,o,r;const i=function(e,t){let n=0;const s=[];for(;(n=e.indexOf(t,n))>-1;)s.push(n++);return s}(e,t[0]);if(0===i.length)return null;if(1===t.length)return[i[0],1,[]];for(r=null,s=0,o=i.length;s2;return{score:t}}function cp(e,t,n){let s=n;const o=[];for(let r=1;r0}}(h(s,"data-mention-url"),e.detail.text))}pt("text-expander[data-mention-url]",{subscribe:e=>b(v(e,"text-expander-change",up),v(e,"text-expander-value",lp))});const dp=we(F);function mp(e,n){const s=p(e,".js-survey-question-form"),o=t(s,"input.js-survey-other-text",HTMLInputElement);s.classList.toggle("is-other-selected",n),o.hidden=!n,n?(o.required=!0,o.focus()):o.required=!1,ht(o,"change")}function fp(e,t=e.length){let n=0,s=0;for(let o=0;o=128&&t<=2047?n+=2:t>=2048&&t<=65535&&(n+=3),s=t}return n}function pp(e){return e>=55296&&e<=56319}function gp(e){return e>=56320&&e<=57343}ft("change","select.js-survey-select",(function(e){const t=e.currentTarget;mp(t,t.options[t.selectedIndex].classList.contains("js-survey-option-other"))})),ft("change","input.js-survey-radio",(function({currentTarget:e}){mp(e,e.classList.contains("js-survey-radio-other"))})),ft("change","input.js-survey-contact-checkbox",(function(e){const n=e.currentTarget,s=p(n,".js-survey-question-form"),o=t(s,".js-survey-contact-checkbox-hidden");n.checked?o.setAttribute("disabled","true"):o.removeAttribute("disabled")})),ft("click",".js-tagsearch-nav-item",e=>{p(e.currentTarget,".js-tagsearch-popover-content").scrollTop=0}),pt(".js-file-line-container, .js-code-block-container",{constructor:HTMLElement,subscribe(e){const n=document.querySelector(".js-tagsearch-popover");if(!(n instanceof HTMLElement))return{unsubscribe(){}};const s=t(n,".js-tagsearch-popover-content"),o=new WeakMap,r=new WeakMap;let i;async function a(t){const s=function(e,t,n){let s,o;if(document.caretPositionFromPoint){const e=document.caretPositionFromPoint(t,n);e&&(s=e.offsetNode,o=e.offset)}else if(document.caretRangeFromPoint){const e=document.caretRangeFromPoint(t,n);e&&(s=e.startContainer,o=e.startOffset)}if(!s||"number"!=typeof o||s.nodeType!==Node.TEXT_NODE)return;const r=s.textContent;if(!r)return null;const i=function(e,t,n){let s;for(;s=t.exec(e);){const e=s.index+s[0].length;if(s.index0}function wp(){return document.querySelectorAll(".js-template-form.is-loading").length>0?"loading":document.querySelectorAll(".js-template-form.is-errored").length>0?"error":"ok"}function jp(){const e=t(document,".js-commit-templates-form",HTMLFormElement),n=t(e,".js-blob-submit",HTMLButtonElement),s=t(document,".js-template-commit-form-error-message"),o=t(document,".js-template-commit-form-loading-message");switch(wp()){case"loading":s.classList.add("d-none"),o.classList.remove("d-none"),e.setAttribute("disabled","disabled"),n.setAttribute("disabled","disabled");break;case"error":s.classList.remove("d-none"),o.classList.add("d-none"),e.setAttribute("disabled","disabled"),n.setAttribute("disabled","disabled");break;default:s.classList.add("d-none"),o.classList.add("d-none"),e.removeAttribute("disabled"),n.removeAttribute("disabled")}}async function yp(e){e.classList.add("is-loading"),jp();const s=t(e,'[name="filename"]',HTMLInputElement).value,o={};for(const u of n(document,".js-template-form",HTMLFormElement)){const e=t(u,'[name="filename"]',HTMLInputElement).value;o[e]={};for(const[t,n]of Se(u))o[e][t]=n}const r=new FormData(e);r.append("current",s),r.append("templates",JSON.stringify(o));const i=await F(e.action,{method:"POST",body:r}),a=Ae(document,i.html);p(e,".js-template-preview").replaceWith(a);const c=t(document,".js-hidden-template-fields"),l=c.querySelector(`[data-filename="${i.filename}"]`);if(l instanceof HTMLInputElement)l.value=i.markdown;else{const e=document.createElement("input");e.type="hidden",e.name=`templates[][${i.filename}]`,e.setAttribute("data-filename",i.filename),e.value=i.markdown,c.append(e)}e.classList.remove("is-loading"),jp()}function Ep(){for(const e of n(document,".js-template-form",HTMLFormElement))yp(e)}function Lp(e){if(function(e){let t;try{t=new URL(e.url)}catch(n){return!0}return t.host!==window.location.host}(e)||function(e){return/[?&]_pjax=/.test(e.url)}(e))return;const t=function(){const e=document.querySelector(".js-timeline-marker");return null!=e?e.getAttribute("data-last-modified"):null}();t&&e.headers.set("X-Timeline-Last-Modified",t)}function Tp(e){!function(e){const t=e.closest("details, .js-details-container");if(!t)return;if(!(t instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/timeline/progressive.ts:71");"DETAILS"===t.nodeName?t.setAttribute("open","open"):tt(t)||ye(t)}(e);const t=e.querySelector(`[href='#${e.id}']`);t&&t.click()}function kp(){return window.location.hash.slice(1)}pt(".js-template-form .js-issue-labels",{add(e){const n=e.closest(".js-issue-template-labels-container");if(!n)return;const s=t(n,".js-issue-template-labels",HTMLInputElement);s.value="";for(const t of e.children){const e=t.getAttribute("data-name");e&&!s.value.includes(e)&&(""===s.value?s.value=e:s.value=`${s.value}, ${e}`)}}}),pt(".js-template-form .js-issue-assignees",{add(e){const n=e.closest(".js-issue-template-assignees-container");if(!(n instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/template-editor.ts:85");const s=t(n,".js-issue-template-assignees",HTMLInputElement);s.value="";for(const t of e.children){const e=t.querySelector("span");if(e){const t=e.getAttribute("data-assignee-name");t&&!s.value.includes(t)&&(""===s.value?s.value=t:s.value=`${s.value}, ${t}`)}}}}),ft("change",".js-quick-pull-choice-option",(function(e){if(!vp())return;const n=e.currentTarget;if(!(n instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/template-editor.ts:109");t(document,".js-quick-pull-new-branch-name").toggleAttribute("required","quick-pull"===n.value)})),j(".js-quick-pull-new-branch-name",(function(e){if(!vp())return;const n=e.target;if(!(n instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/template-editor.ts:118");const s=n.value;t(document,".js-quick-pull-target-branch",HTMLInputElement).value=s,s.length&&bp()})),j(".js-synced-template-input",(function(e){const s=e.target;if(!(s instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/template-editor.ts:128");const o=s.getAttribute("data-sync");if(!o)return;const r=p(s,".js-sync-container"),i=n(r,`[data-sync-with="${o}"]`),a=s.value;if(""!==a.trim()){for(const e of i)e.textContent=s.value;if("name"===o){t(r,".js-sync-filename",HTMLInputElement).value=`${a.replace(/[^\w]/g,"-")}.md`.toLowerCase()}}else for(const t of i){const e=t.getAttribute("data-sync-blank");e&&(t.innerHTML=`${e}`)}})),ft("submit",".js-template-form",(function(e){e.preventDefault();const t=e.currentTarget;if(!(t instanceof HTMLFormElement))throw new Error("invariant: app/assets/modules/github/template-editor.ts:250");yp(t)})),ft("click",".js-toggle-template-commit",(function(){const e=t(document,".js-template-commit-pane");e.classList.toggle("d-none"),e.classList.contains("d-none")||Ep()})),ft("submit",".js-commit-templates-form",(function(e){"ok"!==wp()&&e.preventDefault(),jp()})),ft("click",".js-refresh-template-content",(async function(e){const n=e.currentTarget,s=p(n,".js-template-form"),o=t(s,".js-template-content-preview");o.innerHTML='Loading preview...';const r=t(s,".js-template-content-textarea",HTMLTextAreaElement).value,i=n.getAttribute("data-markdown-preview-url");if(!i)return;if(!(n.parentElement instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/template-editor.ts:278");const a=t(n.parentElement,".js-data-markdown-preview-url-csrf",HTMLInputElement),c=new FormData;c.append("markdown",r);const l=await N(Me(i,a.value,{method:"POST",body:c}));o.innerHTML=l})),ft("click",".js-custom-template-toggle",e=>{const n=e.target,s=p(n,".js-template-preview"),o=!s.classList.contains("expand-preview");if(function(){const e=document.querySelectorAll(".js-template-preview");for(const t of e)t.classList.remove("expand-preview")}(),o)s.classList.add("expand-preview"),s.scrollIntoView({behavior:"smooth",block:"start"});else{yp(t(s,".js-template-form",HTMLFormElement))}}),ft("click",".js-remove-template-button",(function(e){const n=p(e.target,".js-template-preview"),s=h(n,"data-filename"),o=t(document,".js-hidden-template-fields"),r=t(document,".js-toggle-template-commit",HTMLButtonElement),i=o.querySelector(`[data-filename="${s}"]`);i&&i.remove(),r.disabled=!1,n.remove(),Ep()})),ft("click",".js-edit-custom-field-header",(function(e){p(e.target,".js-custom-field-header").classList.toggle("section-focus"),t(document,".js-toggle-template-commit",HTMLButtonElement).disabled=!1})),ft("details-menu-selected",".js-add-template",(function(e){const n=t(document,".js-templates-container"),s=t(document,".js-toggle-template-commit",HTMLButtonElement);if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/template-editor.ts:326");const o=e.detail.relatedTarget.getAttribute("data-source");if(!o)return;s.disabled=!1;const r=t(document,`#${o}`);n.insertAdjacentHTML("beforeend",r.innerHTML)}),{capture:!0}),ft("change",".js-template-repository-choice",(function(e){const s=e.target,o=s.checked&&""!==s.value,r=s.form;t(r,".js-repository-auto-init-options").classList.toggle("has-removed-contents",o);const i=n(r,".js-template-repository-setting"),a=n(r,".js-template-repository-name-display");if(o){const e=p(s,".js-template-repository-choice-container"),n=t(e,".js-template-repository-name"),o=h(s,"data-owner"),i=r.querySelector(`.js-repository-owner-choice[value="${o}"]`);if(i instanceof HTMLInputElement)i.checked=!0,ht(i,"change");else{const e=t(r,".js-repository-owner-choice.js-repository-owner-is-viewer",HTMLInputElement);e.checked=!0,ht(e,"change")}for(const t of a)t.textContent=n.textContent}else for(const t of a)t.textContent="";for(const t of i)t.hidden=!o})),pt(".js-discussion",(function(){let e=new WeakSet;function t(){e=new WeakSet(document.querySelectorAll(".js-timeline-item"))}t(),document.addEventListener("pjax:end",t),pt(".js-timeline-item",t=>{t instanceof HTMLElement&&(e.has(t)||eo(t))})})),E(".js-needs-timeline-marker-header",(function(e,t,n){Lp(n)})),ft("deprecatedAjaxSend","[data-remote]",(function(e){const{request:t}=e.detail;Lp(t)})),ie((function({target:e}){const t=kp();t&&!e&&async function(e){const t=document.getElementById("js-timeline-progressive-loader");if(!t)return;const n=t.getAttribute("data-timeline-item-src");if(!n)return;const s=new URL(n,window.location.origin),o=new URLSearchParams(s.search.slice(1));let r;o.append("anchor",e),s.search=o.toString();try{r=await $(document,s.toString())}catch(l){return}const i=r.querySelector(".js-timeline-item");if(!i)return;const a=i.getAttribute("data-gid");if(!a)return;const c=document.querySelector(`.js-timeline-item[data-gid='${a}']`);if(c){c.replaceWith(i);const t=document.getElementById(e);t&&Tp(t)}else{const t=document.getElementById("js-progressive-timeline-item-container");t&&t.replaceWith(r);const n=document.getElementById(e);n&&Tp(n)}}(t)})),pt(".js-timeline-progressive-focus-container",(function(e){const t=kp();if(!t)return;const n=document.getElementById(t);n&&e.contains(n)&&Tp(n)}));function Mp(){const e={};e.crossBrowserLoadEvent=Date.now();const t=window.performance&&window.performance.timing;if(t)e.connectEnd=t.connectEnd,e.connectStart=t.connectStart,e.domComplete=t.domComplete,e.domContentLoadedEventEnd=t.domContentLoadedEventEnd,e.domContentLoadedEventStart=t.domContentLoadedEventStart,e.domInteractive=t.domInteractive,e.domLoading=t.domLoading,e.domainLookupEnd=t.domainLookupEnd,e.domainLookupStart=t.domainLookupStart,e.fetchStart=t.fetchStart,e.loadEventEnd=t.loadEventEnd,e.loadEventStart=t.loadEventStart,e.navigationStart=t.navigationStart,e.redirectEnd=t.redirectEnd,e.redirectStart=t.redirectStart,e.requestStart=t.requestStart,e.responseEnd=t.responseEnd,e.responseStart=t.responseStart,e.secureConnectionStart=t.secureConnectionStart,e.unloadEventEnd=t.unloadEventEnd,e.unloadEventStart=t.unloadEventStart;else{const t=function(){const e=ha("navigationStart");if(e)return parseInt(e,10)}();null!=t&&(e.simulatedNavigationStart=t)}const n=function(){if(window.performance&&"timeOrigin"in window.performance&&window.performance.getEntriesByType){const e=window.performance.getEntriesByType("paint");if(e.length){const t=e.find(e=>"first-paint"===e.name);if(t)return Math.round((performance.timeOrigin+t.startTime)/1e6)}}}();return null!=n&&(e.chromeFirstPaintTime=n),e}function Sp(e){const n=p(e,".js-topic-save-notice-container"),s=t(n,".js-repo-topics-save-notice");s.classList.remove("d-none"),s.classList.add("d-inline-block","anim-fade-in"),setTimeout(()=>{s.classList.remove("d-inline-block"),s.classList.add("d-none")},1900)}function Ap(e){const n=t(e,".js-topic-suggestions-box");n.querySelector(".js-topic-suggestion")||n.remove()}async function xp(e){const t=e.querySelector(".js-topic-suggestions-container");if(!t)return;const n=h(t,"data-url"),s=await $(document,n);t.innerHTML="",t.appendChild(s)}function Hp(){return t(document,".js-use-security-key",HTMLButtonElement)}function Cp(e,n){for(const t of document.querySelectorAll(".js-u2f-message"))t instanceof HTMLElement&&(t.hidden=!0);if(t(document,e).hidden=!1,n){const e=Hp();e.textContent=h(e,"data-retry-message")}}function qp(){return t(document,".js-u2f-auth-form",HTMLFormElement)}async function Ip(){try{Cp(".js-webauthn-auth-waiting",!1);const e=JSON.parse(h(qp(),"data-webauthn-sign-request")),n=await rt(e);Cp(".js-webauthn-auth-success",!1),Hp().disabled=!0,function(e){const n=qp();t(n,".js-u2f-auth-response",HTMLInputElement).value=JSON.stringify(e),L(n)}(n)}catch(e){!function(e,t){Cp(t,!0),it.report(e)}(new Error(e),".js-webauthn-auth-error")}}if(window.performance&&window.performance.timing||window.addEventListener("pagehide",(function(){ba("navigationStart",Date.now().toString())})),async function(){await C,await new Promise(e=>setTimeout(e));const e=function(){const e=[],t=window.performance;if(t&&t.getEntriesByType)for(const n of t.getEntriesByType("resource")){const t={};e.push(t),"string"==typeof n.name&&(t.name=n.name),"string"==typeof n.entryType&&(t.entryType=n.entryType),"number"==typeof n.startTime&&(t.startTime=n.startTime),"number"==typeof n.duration&&(t.duration=n.duration)}return e}();e.length&&q({resourceTimings:e});const t=function(){const e=[],t=window.performance;if(t&&t.getEntriesByType)for(const s of t.getEntriesByType("navigation")){const t={};e.push(t),"string"==typeof s.entryType&&(t.entryType=s.entryType),"number"==typeof s.startTime&&(t.startTime=s.startTime),"number"==typeof s.duration&&(t.duration=s.duration)}const n=Mp();return n&&0===e.length&&e.push({name:location.href,entryType:"navigation",startTime:0,duration:n.loadEventEnd-n.navigationStart,initiatorType:"navigation",nextHopProtocol:"http/1.1",type:"navigate",redirectStart:n.redirectStart,redirectEnd:n.redirectEnd,fetchStart:n.fetchStart,domainLookupStart:n.domainLookupStart,domainLookupEnd:n.domainLookupEnd,connectStart:n.connectStart,connectEnd:n.connectEnd,secureConnectionStart:n.secureConnectionStart,requestStart:n.requestStart,responseStart:n.responseStart,responseEnd:n.responseEnd,unloadEventStart:n.unloadEventStart,unloadEventEnd:n.unloadEventEnd,domInteractive:n.domInteractive,domContentLoadedEventStart:n.domContentLoadedEventStart,domContentLoadedEventEnd:n.domContentLoadedEventEnd,domComplete:n.domComplete,loadEventStart:n.loadEventStart,loadEventEnd:n.loadEventEnd}),e}();t.length&&q({navigationTimings:t})}(),ft("click",".js-toggler-container .js-toggler-target",(function(e){if(0!==e.button)return;const t=e.currentTarget.closest(".js-toggler-container");t&&t.classList.toggle("on")})),E(".js-toggler-container",async(e,t)=>{e.classList.remove("success","error"),e.classList.add("loading");try{await t.text(),e.classList.add("success")}catch(n){e.classList.add("error")}finally{e.classList.remove("loading")}}),E(".js-accept-topic-form",(async function(e,n){await n.html();const s=p(e,".js-topic-form-area"),o=p(e,".js-topic-suggestion"),r=t(s,".js-template"),i=t(s,".js-tag-input-selected-tags"),a=r.cloneNode(!0),c=t(o,'input[name="input[name]"]',HTMLInputElement).value;t(a,"input",HTMLInputElement).value=c,t(a,".js-placeholder-tag-name").replaceWith(c),a.classList.remove("d-none","js-template"),i.appendChild(a),o.remove(),xp(s),Ap(s),Sp(e)})),ft("click",".js-repo-topics-form-done",(function(){!async function(){const e=t(document,".js-topics-list-container"),n=h(e,"data-url"),s=await $(document,n);e.innerHTML="",e.appendChild(s)}()})),E(".js-decline-topic-form",(async function(e,t){await t.html(),Sp(e);const n=p(e,".js-topic-form-area");p(e,".js-topic-suggestion").remove(),xp(n),Ap(n)})),E(".js-repo-topics-edit-form",(async function(e,s){const o=p(e,".js-topic-form-area");o.classList.remove("errored"),t(o,".js-topic-error").textContent="";for(const t of o.querySelectorAll(".js-tag-input-tag.invalid-topic"))t.classList.remove("invalid-topic");try{await s.json(),Sp(e),xp(o)}catch(r){const s=r.response.json;if(s.message&&(o.classList.add("errored"),t(o,".js-topic-error").textContent=s.message),s.invalidTopics){const t=n(e,".js-topic-input",HTMLInputElement);for(const e of s.invalidTopics)for(const n of t)if(n.value===e){p(n,".js-tag-input-tag").classList.add("invalid-topic")}}}})),ft("tags:changed",".js-repo-topics-edit-form",(function(e){const t=e.target;L(t)})),ft("click",".js-reveal-hidden-topics",(function(e){const t=e.target,n=p(t,".js-hidden-topics-container").querySelector(".js-hidden-topics");n&&(n.classList.remove("d-none"),t.remove())})),ft("click",".js-hide-content-attachment",(function(e){e.preventDefault(),function(e){const n=p(e,".js-content-attachment"),s=p(e,"[data-unfurl-hide-url]"),o=h(s,"data-unfurl-hide-url"),r=t(s,".js-data-unfurl-hide-url-csrf",HTMLInputElement),i=h(e,"data-id"),a=new XMLHttpRequest;a.onload=function(){a.status>=200&&a.status<300&&n.remove()},a.open("POST",o);const c=new FormData;c.append("id",i),c.append("authenticity_token",r.value),a.send(c)}(e.currentTarget)})),pt(".js-content-attachment .max--md",(function(e){const n=t(e,".markdown-body");var s;(n.clientHeight<188||""===((s=n).textContent||"").trim()&&1===(s.querySelectorAll("img")||[]).length)&&(e.classList.remove("max--md"),t(e,".Details-content--closed").hidden=!0,t(e,".Details-content--open").hidden=!0)})),window.requestIdleCallback(()=>{const e=function(){if("Intl"in window)try{return(new window.Intl.DateTimeFormat).resolvedOptions().timeZone}catch(oh){if(!(oh instanceof RangeError))throw oh}}();if(e){const t="https:"===location.protocol?"secure":"";document.cookie=`tz=${encodeURIComponent(e)}; path=/; ${t}`}}),pt(".js-webauthn-support",{constructor:HTMLInputElement,add:function(e){w(e,nt())}}),pt(".js-webauthn-iuvpaa-support",{constructor:HTMLInputElement,add:function(e){!async function(){w(e,await st())}()}}),pt(".js-u2f-auth-form-body",(function(e){if(!e)return;const t=ot();if(e.classList.toggle("unavailable",!t),t){const e=Hp();e.hidden=!1,e.classList.contains("js-webauthn-autofocus")&&e.focus()}})),ft("click",".js-use-security-key",(function(e){!function(e){e&&e.preventDefault(),ot()&&Ip()}(e)})),it.report=function(e){xt(e)},ft("click",".js-signup-prompt-button",(function(e){const t=p(e.currentTarget,".js-signup-prompt"),n=h(t,"data-prompt");try{const e=window.localStorage.getItem("dismissed_prompts"),s=e?e.split(","):[];s.includes(n)||s.push(n),window.localStorage.setItem("dismissed_prompts",s.join(",")),t.hidden=!0}catch(rh){}})),pt(".js-signup-prompt",{constructor:HTMLElement,add(e){const t=h(e,"data-prompt");try{const n=window.localStorage.getItem("dismissed_prompts");e.hidden=!!n&&n.split(",").includes(t)}catch(rh){}}}),He("PAGE_STALE_CHECK")){window.addEventListener("beforeunload",(function(){if(Object.keys(at).length>0){const e=history.state||{};e.staleRecords=at,A(e,"",location.href)}}));try{!async function(){if(history.state&&history.state.staleRecords){await Y;for(const e in history.state.staleRecords)for(const t of document.querySelectorAll(`.js-updatable-content [data-url='${e}'], .js-updatable-content[data-url='${e}']`)){const n=history.state.staleRecords[e];t instanceof HTMLElement&&I(t,n,!0)}A(null,"",location.href)}}()}catch(rh){}}ft("socket:message",".js-updatable-content",(function(e){const{gid:t,wait:n}=e.detail.data||{},s=e.target;let o;if(t&&s.getAttribute("data-gid")===t?o=e.target:t?o=s.querySelector(`[data-url][data-gid="${t}"]`):e.currentTarget===s&&(o=s),!(o instanceof HTMLElement))return;const r=Re.bind(null,o);null==n?r("live-update"):setTimeout(r,n,"delayed-live-update")})),ft("upload:setup",".js-upload-avatar-image",(function(e){const{form:t}=e.detail,n=e.currentTarget.getAttribute("data-alambic-organization"),s=e.currentTarget.getAttribute("data-alambic-owner-type"),o=e.currentTarget.getAttribute("data-alambic-owner-id");n&&t.append("organization_id",n),s&&t.append("owner_type",s),o&&t.append("owner_id",o)})),ft("upload:complete",".js-upload-avatar-image",(function(e){const{attachment:t}=e.detail,n=`/settings/avatars/${t.id}`;D({content:$(document,n)})}));class _p{constructor(e){this.dataview=new DataView(e),this.pos=0}static fromFile(e){return new Promise((function(t,n){const s=new FileReader;s.onload=function(){if(!(s.result instanceof ArrayBuffer))throw new Error("invariant: app/assets/modules/github/png-scanner.ts:35");t(new _p(s.result))},s.onerror=function(){n(s.error)},s.readAsArrayBuffer(e)}))}advance(e){this.pos+=e}readInt(e){const t=this,n=function(){switch(e){case 1:return t.dataview.getUint8(t.pos);case 2:return t.dataview.getUint16(t.pos);case 4:return t.dataview.getUint32(t.pos);default:throw new Error("bytes parameter must be 1, 2 or 4")}}();return this.advance(e),n}readChar(){return this.readInt(1)}readShort(){return this.readInt(2)}readLong(){return this.readInt(4)}readString(e){const t=[];for(let n=0;n=0}(t))return;if(!Rp(t))return;const n=Fp(t);if(!n.some(Up))return;e.stopPropagation(),e.preventDefault();const s=e.currentTarget;s instanceof HTMLTextAreaElement&&$p(s,n.map(Pp).join(""))}function Np(e){const t=e.dataTransfer;t&&(t.dropEffect="link")}function Bp(e){const t=e.clipboardData;if(!t||!Rp(t))return;const n=Fp(t);if(!n.some(Up))return;e.stopPropagation(),e.preventDefault();const s=e.currentTarget;s instanceof HTMLTextAreaElement&&$p(s,n.map(Pp).join(""))}function Pp(e){return Up(e)?`\n![](${e})\n`:e}function Rp(e){return Array.from(e.types).indexOf("text/uri-list")>=0}function Fp(e){return(e.getData("text/uri-list")||"").split("\r\n")}const Op=/\.(gif|png|jpe?g)$/i;function Up(e){return Op.test(e)}function Wp(e){const t=e.dataTransfer;if(!t)return;if(function(e){return Array.from(e.types).indexOf("Files")>=0}(t))return;const n=Jp(t);if(!n)return;e.stopPropagation(),e.preventDefault();const s=e.currentTarget;s instanceof HTMLTextAreaElement&&$p(s,Yp(n))}function zp(e){const t=e.dataTransfer;t&&(t.dropEffect="copy")}function Vp(e){if(!e.clipboardData)return;const t=Jp(e.clipboardData);if(!t)return;e.stopPropagation(),e.preventDefault();const n=e.currentTarget;n instanceof HTMLTextAreaElement&&$p(n,Yp(t))}function Kp(e){return e.textContent.trim().replace(/\|/g,"\\|").replace(/\n/g," ")||"ย "}function Yp(e){const t=Array.from(e.querySelectorAll("tr")),n=(s=t.shift(),Array.from(s.querySelectorAll("td, th")).map(Kp));var s;const o=n.map(()=>"--");return`\n${`${n.join(" | ")}\n${o.join(" | ")}\n`}${t.map(e=>Array.from(e.querySelectorAll("td")).map(Kp).join(" | ")).join("\n")}\n\n`}function Jp(e){if(-1===Array.from(e.types).indexOf("text/html"))return;const t=e.getData("text/html");if(!/=0}(t))return;const n=e.currentTarget;if(!(n instanceof HTMLTextAreaElement))return;const s=t.getData("text/x-gfm");s&&(e.stopPropagation(),e.preventDefault(),$p(n,s))}function Gp(e){return`${e.isImage()?"!":""}[Uploading ${e.file.name}โ€ฆ]()`}pt(".js-paste-markdown",{subscribe:function(e){return function(e){e.addEventListener("dragover",zp),e.addEventListener("drop",Wp),e.addEventListener("paste",Vp)}(e),function(e){e.addEventListener("dragover",Np),e.addEventListener("drop",Dp),e.addEventListener("paste",Bp)}(e),function(e){e.addEventListener("paste",Xp)}(e),{unsubscribe:()=>{!function(e){e.removeEventListener("dragover",zp),e.removeEventListener("drop",Wp),e.removeEventListener("paste",Vp)}(e),function(e){e.removeEventListener("dragover",Np),e.removeEventListener("drop",Dp),e.removeEventListener("paste",Bp)}(e),function(e){e.removeEventListener("paste",Xp)}(e)}}}});function Qp(e){const n=p(e,"form",HTMLFormElement);return t(n,"#release_id",HTMLInputElement).value}ft("upload:setup",".js-upload-markdown-image",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/markdown.ts:40");const n=t(e.currentTarget,".js-comment-field",HTMLTextAreaElement);n.setCustomValidity("uploading"),ke(n,`${Gp(e.detail.attachment)}\n`)})),ft("upload:complete",".js-upload-markdown-image",(async function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/markdown.ts:46");const{attachment:n}=e.detail,s=e.currentTarget,o=t(s,".js-comment-field",HTMLTextAreaElement),r=Gp(n);function i(e){let t=`[${n.file.name}](${n.href})`;if(n.isImage()){const s=function(e){return e.replace(/[[\]\\"<>&]/g,".").replace(/\.{2,}/g,".").replace(/^\.|\.$/gi,"")}(n.file.name).replace(/\.[^.]+$/,"").replace(/\./g," "),o=n.href;if(e&&144===e.ppi){t=`${s}`}else t=`![${s}](${o})`}o.setCustomValidity(""),ct(o,r,t)}try{i(await async function(e){if("image/png"!==e.type)return null;const t=e.slice(0,10240,e.type),n=await _p.fromFile(t),s={width:0,height:0,ppi:1};return n.scan((function(e){switch(e){case"IHDR":return s.width=this.readLong(),s.height=this.readLong(),!0;case"pHYs":{const e=this.readLong(),t=this.readLong();let n;return 1===this.readChar()&&(n=.0254),n&&(s.ppi=Math.round((e+t)/2*n)),!1}case"IDAT":return!1}return!0})),s}(n.file))}catch(a){i(),setTimeout((function(){throw a}))}})),ft("upload:error",".js-upload-markdown-image",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/markdown.ts:79");const n=t(e.currentTarget,".js-comment-field",HTMLTextAreaElement),s=Gp(e.detail.attachment);n.setCustomValidity(""),ct(n,s,"")})),ft("upload:invalid",".js-upload-markdown-image",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/markdown.ts:86");const n=t(e.currentTarget,".js-comment-field",HTMLTextAreaElement),s=Gp(e.detail.attachment);n.setCustomValidity(""),ct(n,s,"")})),ft("upload:setup",".js-upload-marketplace-listing-screenshot",(function(e){const{form:t}=e.detail,n=e.currentTarget.getAttribute("data-marketplace-listing-id");n&&t.append("marketplace_listing_id",n)})),ft("upload:complete",".js-upload-marketplace-listing-screenshot",(async function(e){const n=h(e.currentTarget,"data-screenshots-url"),s=t(document,".js-marketplace-listing-screenshots-container"),o=await $(document,n);s.innerHTML="",s.appendChild(o)})),ft("upload:setup",".js-upload-marketplace-listing-hero-card-background",(function(e){const{form:t}=e.detail,n=e.currentTarget.getAttribute("data-marketplace-listing-id");n&&t.append("marketplace_listing_id",n)})),ft("upload:complete",".js-upload-marketplace-listing-hero-card-background",(function(e){const{attachment:n}=e.detail;t(document,".js-marketplace-listing-hero-card-background-id",HTMLInputElement).value=n.id,t(document,".js-hero-listing-container").style.backgroundImage=`url(${n.href})`})),ft("click",".js-release-remove-file",(function(e){const n=p(e.currentTarget,".js-release-file");n.classList.add("delete"),t(n,"input.destroy",HTMLInputElement).value="true"})),ft("click",".js-release-undo-remove-file",(function(e){const n=p(e.currentTarget,".js-release-file");n.classList.remove("delete"),t(n,"input.destroy",HTMLInputElement).value=""}));let Zp=null;function eg(e,t){t.append("release_id",Qp(e));const s=n(document,".js-releases-field .js-release-file.delete .id",HTMLInputElement);if(s.length){const e=s.map(e=>e.value);t.append("deletion_candidates",e.join(","))}}ft("release:saved",".js-release-form",(function(e){const n=e.currentTarget;Zp=null;let s=!1;for(const t of n.querySelectorAll(".js-releases-field .js-release-file"))t.classList.contains("delete")?t.remove():t.classList.contains("js-template")||(s=!0);const o=t(n,".js-releases-field");o.classList.toggle("not-populated",!s),o.classList.toggle("is-populated",s)})),ft("upload:setup",".js-upload-release-file",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/release-file.ts:47");const{form:n,preprocess:s}=e.detail,o=e.currentTarget;if(Qp(o))return void eg(o,n);if(!Zp){const e=t(document,".js-save-draft",HTMLButtonElement);Zp=Vm(e)}const r=eg.bind(null,o,n);s.push(Zp.then(r))})),ft("upload:start",".js-upload-release-file",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/release-file.ts:65");const s=e.detail.policy;t(e.currentTarget,".js-upload-meter").classList.remove("d-none");const o=s.asset.replaced_asset;if(o)for(const t of n(document,".js-releases-field .js-release-file .id",HTMLInputElement))Number(t.value)===o&&p(t,".js-release-file").remove()})),ft("upload:complete",".js-upload-release-file",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/release-file.ts:80");const{attachment:n}=e.detail,s=t(document,".js-releases-field"),o=t(s,".js-template").cloneNode(!0);o.classList.remove("d-none","js-template"),t(o,"input.id",HTMLInputElement).value=n.id;const r=n.name||n.href.split("/").pop();for(const t of o.querySelectorAll(".js-release-asset-filename"))t instanceof HTMLInputElement?t.value=r:t.textContent=r;const i=`(${(n.file.size/1048576).toFixed(2)} MB)`;t(o,".js-release-asset-filesize").textContent=i,s.appendChild(o),s.classList.remove("not-populated"),s.classList.add("is-populated"),t(e.currentTarget,".js-upload-meter").classList.add("d-none")})),ft("upload:progress",".js-upload-release-file",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/release-file.ts:106");const{attachment:n}=e.detail;t(e.currentTarget,".js-upload-meter").style.width=`${n.percent}%`})),ft("upload:setup",".js-upload-repository-image",(function(){t(document,".js-remove-repository-image-button").hidden=!0})),ft("upload:complete",".js-upload-repository-image",(function(e){const{attachment:n}=e.detail;t(document,".js-repository-image-id",HTMLInputElement).value=n.id,t(document,".js-remove-repository-image-button").hidden=!1,t(document,".js-repository-image-container").style.backgroundImage=`url(${n.href})`}));let tg=null;const ng=new WeakMap;function sg(e){e.classList.remove("is-progress-bar");const n=p(e,".js-upload-manifest-file-container");t(n,".js-upload-progress").classList.remove("active"),t(n,".js-upload-meter-text .js-upload-meter-filename").textContent=""}function og(e){sg(e.currentTarget)}function rg(e){return t(e,'[role="tablist"] [role="tab"][aria-selected="true"]')}function ig(e){const t=n(e,'[role="tablist"] [role="tab"]'),s=rg(e);return n(e,'[role="tabpanel"]',HTMLElement)[Array.from(t).indexOf(s)]}function ag(e){const n=e.querySelector(".js-emoji-picker-filter"),s=t(e,".js-emoji-picker-filter-tab-button"),o=t(e,".js-emoji-picker-all-emoji");n instanceof HTMLInputElement&&(n.value=""),o.setAttribute("value",""),s.hidden=!0}function cg(e){e.classList.add("selected-emoji")}function lg(e){if(!(e.target instanceof HTMLElement))return;const t=e.target.closest(".js-emoji-picker");if(t&&t instanceof HTMLElement&&!t.hidden)switch(e.key){case"ArrowRight":case"ArrowLeft":case"ArrowUp":case"ArrowDown":e.preventDefault(),function(e,t){const n=ig(e),s=Array.from(n.querySelectorAll(".js-emoji-button")),o=n.querySelector(".selected-emoji.js-emoji-button"),r=function(e){let t,n=0;const s=e[0].getBoundingClientRect().top;for(const o of e){if(t=o.getBoundingClientRect(),s0&&o%t==0&&(s+=1,n.push([])),n[s].push(r)}return n}(s,r);let a=0,c=0;if(o){const e=function(e,t){let n=0,s=0,o=[],r=-1;for(let i=0;i-1){s=r;break}n+=1}return{row:n,col:s}}(i,o);switch(a=e.row,c=e.col,o.classList.remove("selected-emoji"),t){case"ArrowRight":c+=1;break;case"ArrowDown":a+=1;break;case"ArrowLeft":c-=1;break;case"ArrowUp":a-=1}}const l=i.length-1,u=c>i[l].length-1,d=a===l;a<0?(a=l,u&&(a-=1)):(a>l||d&&u&&"ArrowDown"===t)&&(a=0);const m=i[a].length-1;c<0?c=m:c>m&&(c=0);const f=i[a][c];cg(f),f.focus()}(t,e.key)}}function ug(e){e.hidden=!0,document.removeEventListener("keydown",lg)}function dg(e){document.addEventListener("click",t=>{if(t.target instanceof HTMLElement){t.target.closest(".js-emoji-picker")!==e&&ug(e)}});const n=t(e,".js-emoji-picker-all-emoji"),s=t(e,".js-emoji-picker-no-results"),o=t(e,".js-emoji-picker-results-header");n.addEventListener("fuzzy-list-sorted",e=>{const t=Number(e.detail)>0;s.hidden=t,n.hidden=!t,o.hidden=!t});const r=e.querySelector(".js-emoji-picker-filter");r instanceof HTMLInputElement&&r.addEventListener("input",()=>function(e){const n=p(e,".js-emoji-picker"),s=rg(n),o=t(n,".js-emoji-picker-filter-tab-button",HTMLButtonElement);if(t(n,".js-emoji-picker-all-emoji").setAttribute("value",e.value),s.classList.contains("js-emoji-picker-filter-tab-button")||s.classList.add("emoji-picker-prior-selected-tab-button"),e.value){o.hidden=!1,"true"===o.getAttribute("aria-selected")||(o.click(),e.focus())}else{o.hidden=!0;const e=n.querySelector(".emoji-picker-prior-selected-tab-button");e instanceof HTMLButtonElement&&e.click()}}(r))}function mg(e){return t(e,".js-user-status-details").hasAttribute("open")}function fg(e){const n=e.querySelector(".js-emoji-picker");n instanceof HTMLElement&&(!function(e){const n=t(e,".js-original-emoji-category"),s=t(e,".js-original-emoji-category-tab",HTMLElement),o=rg(e),r=ig(e),i=e.querySelector(".js-originally-selected-emoji");if(i){const t=e.querySelector(".selected-emoji");t&&t.classList.remove("selected-emoji"),i.classList.add("selected-emoji")}o.removeAttribute("aria-selected"),n.setAttribute("aria-selected","true"),r.hidden=!0,s.hidden=!1}(n),ag(n),ug(n))}function pg(e){const n=t(e,".js-user-status-original-emoji"),s=t(e,".js-user-status-custom-emoji"),o=t(e,".js-user-status-no-emoji-icon");s.innerHTML=n.innerHTML,o.hidden=s.hasChildNodes()}function gg(e,t){pg(e),function(e,t){const n=e.querySelector(".js-user-status-emoji-picker");if(!(n instanceof window.IncludeFragmentElement))return;const s=h(n,"data-url");if(t){const e=new URL(s,window.location.origin),t=new URLSearchParams(e.search.slice(1));t.append("show_picker","1"),e.search=t.toString()}n.setAttribute("src",s.toString())}(e,t),function(e){const t=e.querySelector(".js-user-status-org-picker");if(!(t instanceof window.IncludeFragmentElement))return;const n=h(t,"data-url");t.src=n.toString()}(e)}function hg(e){const n=t(e,".js-user-status-suggestions"),s=t(e,".js-user-status-message-field",HTMLInputElement).value.trim().length>0;n.classList.toggle("collapsed",s),n.setAttribute("aria-expanded",s.toString())}function bg(e,n){mg(e)?function(e){const n=t(e,".js-user-status-message-field",HTMLInputElement);pg(e),fg(e),n.value=n.defaultValue,Li(e)}(e):gg(e,n),yg(e)}function vg(e,n){t(e,".js-user-status-custom-emoji").innerHTML=n.innerHTML,t(e,".js-user-status-no-emoji-icon").hidden=!0}function wg(e,n){t(e,".js-user-status-emoji-field",HTMLInputElement).value=n.value}function jg(e,t){if("Escape"===J(t)){const t=e.closest(".js-user-status-container");if(!(t instanceof HTMLElement))return;e.value=e.defaultValue,bg(t,!1)}}function yg(e){const n=t(e,".js-user-status-submit",HTMLButtonElement),s=t(e,".js-clear-user-status-button",HTMLButtonElement),o=t(e,".js-user-status-message-field",HTMLInputElement),r=t(e,".js-user-status-emoji-field",HTMLInputElement),i=o.value.trim(),a=r.value.trim();let c=!1,l=!1;var u;yi(u=o)-ne(u.value)<0&&(c=!0),i.length<1&&a.length<1&&(c=!0,s.classList.contains("js-user-status-exists")||(l=!0)),n.disabled=c,s.disabled=l}function Eg(e){return p(e,".js-user-status-container")}function Lg(e,t){if(mg(e))return;const n=e.querySelectorAll(".js-toggle-user-status-edit.Details-content--closed");for(const s of n)s.classList.toggle("text-blue",t),s.classList.toggle("link-gray-dark",!t)}function Tg(e){if(!(e.target instanceof Element))return;Lg(p(e.target,".js-user-status-container"),!0)}function kg(e){if(!(e.target instanceof Element))return;Lg(p(e.target,".js-user-status-container"),!1)}function Mg(e){const t=e.currentTarget;_(t)?function(e){const t=e.getAttribute("data-warn-unsaved-changes")||"Changes you made may not be saved.";window.onbeforeunload=function(e){return e.returnValue=t,t}}(t):Sg()}function Sg(){window.onbeforeunload=null}function Ag({currentTarget:e}){e.hasAttribute("open")||Sg()}function xg(e){const t=e.currentTarget;if(!t.closest("details[open]"))return;let s=!0;const o=n(t,"form[data-warn-unsaved-changes]",HTMLFormElement);for(const n of o)if(_(n)){const e=h(n,"data-warn-unsaved-changes");s=confirm(e);break}s||e.preventDefault()}function Hg(e,t,n){const s=e[n];let o={position_in_list:n,number_of_related_issues:e.length,title_length:t.length};return s.repository.isPrivate||(o=Object.assign({},o,{title_string_at_time_of_click:t,id_of_clicked_result:s.databaseId,results_shown_at_time_of_click:e.map(e=>e.databaseId)})),o}ft("file-attachment-accept",".js-upload-manifest-file",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/upload-manifest-file.ts:34");const{attachments:t}=e.detail,n=parseInt(e.currentTarget.getAttribute("data-directory-upload-max-files")||"",10);t.length>n&&(e.preventDefault(),e.currentTarget.classList.add("is-too-many"))})),ft("document:drop",".js-upload-manifest-tree-view",(async function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/upload-manifest-file.ts:43");const{transfer:n}=e.detail,s=e.currentTarget,o=await un.traverse(n,!0),r=t(document,"#js-repo-pjax-container");r.addEventListener("pjax:success",()=>{t(r,".js-upload-manifest-file",FileAttachmentElement).attach(o)},{once:!0});const i=h(s,"data-drop-url");K({url:i,container:r})})),ft("upload:setup",".js-upload-manifest-file",(async function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/upload-manifest-file.ts:56");const{batch:n,form:s,preprocess:o}=e.detail,r=e.currentTarget;function i(){s.append("upload_manifest_id",ng.get(r))}if(function(e,n){const s=p(e,".js-upload-manifest-file-container"),o=t(s,".js-upload-progress");o.classList.add("active"),e.classList.add("is-progress-bar");const r=t(o,".js-upload-meter-text");t(r,".js-upload-meter-range-start").textContent=String(n.uploaded()+1),t(r,".js-upload-meter-range-end").textContent=String(n.size)}(r,n),ng.get(r))return void i();if(tg)return void o.push(tg.then(i));const a=p(r,".js-upload-manifest-file-container").querySelector(".js-upload-manifest-form");tg=F(a.action,{method:a.method,body:new FormData(a)});const[c,l]=function(){let e,t;const n=new Promise((n,s)=>{e=n,t=s});if(!e)throw new Error("invariant: app/assets/modules/github/upload/upload-manifest-file.ts:103");if(!t)throw new Error("invariant: app/assets/modules/github/upload/upload-manifest-file.ts:104");return[n,e,t]}();o.push(c.then(i));const u=await tg,d=t(document,".js-manifest-commit-form",HTMLFormElement).elements.namedItem("manifest_id");if(!(d instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/upload/upload-manifest-file.ts:88");d.value=u.upload_manifest.id,ng.set(r,u.upload_manifest.id),tg=null,l()})),ft("upload:start",".js-upload-manifest-file",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/upload-manifest-file.ts:108");const{attachment:n,batch:s}=e.detail,o=p(e.currentTarget,".js-upload-manifest-file-container"),r=t(o,".js-upload-progress"),i=t(r,".js-upload-meter-text");t(i,".js-upload-meter-range-start").textContent=s.uploaded()+1,t(i,".js-upload-meter-filename").textContent=n.fullPath})),ft("upload:complete",".js-upload-manifest-file",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/upload-manifest-file.ts:119");const{attachment:n,batch:s}=e.detail,o=t(document,".js-manifest-commit-file-template",HTMLTableElement).rows[0].cloneNode(!0);t(o,".name").textContent=n.fullPath;const r=n.id,i=t(o,".js-remove-manifest-file-form",HTMLFormElement).elements.namedItem("file_id");if(!(i instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/upload/upload-manifest-file.ts:129");i.value=r;const a=t(document,".js-manifest-file-list");a.classList.remove("d-none"),e.currentTarget.classList.add("is-file-list"),t(document,".js-upload-progress").classList.add("is-file-list"),t(a,".js-manifest-file-list-root").appendChild(o),s.isFinished()&&sg(e.currentTarget)})),ft("upload:progress",".js-upload-manifest-file",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/upload/upload-manifest-file.ts:144");const{batch:n}=e.detail,s=p(e.currentTarget,".js-upload-manifest-file-container");t(s,".js-upload-meter").style.width=`${n.percent()}%`})),ft("upload:error",".js-upload-manifest-file",og),ft("upload:invalid",".js-upload-manifest-file",og),E(".js-remove-manifest-file-form",(async function(e,n){await n.html();const s=p(e,".js-manifest-file-list-root");if(p(e,".js-manifest-file-entry").remove(),!s.hasChildNodes()){p(s,".js-manifest-file-list").classList.add("d-none"),t(document,".js-upload-manifest-file").classList.remove("is-file-list"),t(document,".js-upload-progress").classList.remove("is-file-list")}})),pt(".js-manifest-ready-check",{initialize(e){!async function(e){const n=h(e,"data-redirect-url");try{await te(h(e,"data-poll-url")),window.location=n}catch(oh){t(document,".js-manifest-ready-check").classList.add("d-none"),t(document,".js-manifest-ready-check-failed").classList.remove("d-none")}}(e)}}),ft("upload:setup",".js-upload-enterprise-installation-user-accounts-upload",(function(e){const{form:t}=e.detail,n=e.currentTarget.getAttribute("data-business-id");n&&t.append("business_id",n);const s=e.currentTarget.getAttribute("data-enterprise-installation-id");s&&t.append("enterprise_installation_id",s)})),ft("upload:complete",".js-upload-enterprise-installation-user-accounts-upload",(function(e){const{attachment:n}=e.detail,s=t(e.currentTarget,".js-enterprise-installation-user-accounts-upload-id",HTMLInputElement);s.value=n.id;const o=t(e.currentTarget,".js-enterprise-installation-id",HTMLInputElement),r=e.currentTarget.getAttribute("data-enterprise-installation-id");r&&(o.value=r);const i=s.form;i&&i.submit()})),ft("click",".js-user-status-expire-button",(function(e){const n=e.currentTarget;n instanceof HTMLButtonElement&&function(e,n){const s=t(e,".js-user-status-expiration-interval-selected"),o=t(e,".js-user-status-expire-drop-down"),r=t(e,".js-user-status-expiration-date-input",HTMLInputElement);s.textContent=n.title,r.value=n.value,o.removeAttribute("open")}(Eg(n),n)})),ft("click",".js-toggle-user-status-edit",(function(e){if(!(e.currentTarget instanceof HTMLElement))return;const t=Eg(e.currentTarget);e.target instanceof HTMLElement&&bg(t,!!e.target.closest(".js-toggle-user-status-emoji-picker"))})),ft("click",".js-toggle-user-status-emoji-picker",(function(e){if(!(e.currentTarget instanceof HTMLElement))return;const t=Eg(e.currentTarget).querySelector(".js-emoji-picker");t instanceof HTMLElement&&t.hidden&&setTimeout(()=>function(e){const t=e.querySelector(".js-emoji-picker-filter"),n=!e.hidden;e.hidden=n,n?(t instanceof HTMLInputElement&&(t.value=""),document.removeEventListener("keydown",lg)):(t instanceof HTMLInputElement&&t.focus(),document.addEventListener("keydown",lg))}(t),50)})),ft("click",".js-emoji-button",(function(e){const n=e.currentTarget;n instanceof HTMLButtonElement&&function(e){const n=p(e,".js-user-status-container"),s=t(n,".js-emoji-picker");wg(n,e),function(e){const t=e.querySelector(".selected-emoji");t&&t.classList.remove("selected-emoji")}(n),cg(e),vg(n,e),yg(n),ug(s)}(n)})),ft("click",".js-user-status-emoji-tab",(function(e){const t=e.currentTarget;t instanceof HTMLElement&&function(e){const t=p(e,".js-emoji-picker"),n=t.querySelector(".js-emoji-picker-filter");ag(t),!t.hidden&&n instanceof HTMLInputElement&&n.focus()}(t)})),y(".js-user-status-message-field",(function(e){hg(Eg(e))})),f("keyup",".js-user-status-message-field",e=>{const t=e.target;t instanceof HTMLInputElement&&e instanceof KeyboardEvent&&jg(t,e)}),f("keyup",".js-emoji-picker-filter",e=>{const t=e.target;t instanceof HTMLInputElement&&e instanceof KeyboardEvent&&jg(t,e)}),ft("click",".js-clear-user-status-button",(function(e){const n=e.currentTarget;n instanceof HTMLButtonElement&&function(e){e.hidden=!0,t(e,".js-user-status-emoji-field",HTMLInputElement).value="",t(e,".js-user-status-no-emoji-icon").hidden=!1,t(e,".js-user-status-custom-emoji").innerHTML="";const n=t(e,".js-user-status-message-field",HTMLInputElement);n.value="",n.classList.contains("js-characters-remaining-field")&&Ei(n);const s=e.querySelector(".selected-emoji.js-emoji-button");s&&s.classList.remove("selected-emoji"),t(e,".js-user-status-limited-availability-checkbox",HTMLInputElement).checked=!1;const o=e.querySelector(".js-user-status-expiration-date-input");o&&o instanceof HTMLInputElement&&(o.value=""),yg(e),hg(e);const r=t(e,".js-user-status-form",HTMLFormElement);L(r)}(p(n,".js-user-status-container"))})),ft("click",".js-predefined-user-status",(function(e){const n=e.currentTarget;n instanceof HTMLButtonElement&&function(e){const n=p(e,".js-user-status-container"),s=t(e,".js-predefined-user-status-emoji"),o=t(e,".js-predefined-user-status-message"),r=t(n,".js-user-status-message-field",HTMLInputElement);r.value=(o.textContent||"").trim(),vg(n,s),wg(n,e),yg(n),hg(n),r.classList.contains("js-characters-remaining-field")&&Ei(r)}(n)})),j(".js-user-status-message-field",(function(e){const t=e.target;if(!(t instanceof HTMLElement))return;const n=p(t,".js-user-status-form");yg(n),hg(n)})),ft("click",".js-user-status-org-button",(function(e){const n=e.currentTarget;n instanceof HTMLButtonElement&&function(e){const n=p(e,".js-user-status-container"),s=t(n,".js-user-status-org-id-field",HTMLInputElement),o=t(n,".js-user-status-org-details"),r=t(n,".js-user-status-selected-org"),i=t(e,".js-user-status-org-display"),a=t(n,".js-user-status-org-message"),c=e.value,l=""!==c,u=t(n,".js-user-status-message-field",HTMLInputElement),d=n.querySelector(".js-user-status-org-button.selected");let m="";d&&d.classList.remove("selected"),e.classList.add("selected"),s.value=c,r.innerHTML="";const f=i.cloneNode(!0);if(f instanceof HTMLElement&&(f.hidden=!1),r.appendChild(f),o.removeAttribute("open"),l){const t=h(a,"data-prefix"),n=h(a,"data-suffix"),s=h(e,"data-org");a.textContent=`${t}${s}${n}`,a.hidden=!1;const o=new URL(h(u,"data-org-url"),window.location.origin),r=new URLSearchParams(o.search.slice(1));r.append("global_id",c),o.search=r.toString(),m=o.toString()}else a.textContent=h(a,"data-none"),a.hidden=!0,m=h(u,"data-no-org-url");p(u,"text-expander").setAttribute("data-mention-url",m)}(n)})),ft("change",".js-user-status-limited-availability-checkbox",(function(e){const n=e.target;if(!(n instanceof HTMLInputElement))return;const s=p(n,".js-user-status-form"),o=n.checked,r=h(n,"data-default-message"),i=t(s,".js-user-status-message-field",HTMLInputElement);o&&i.value.length<1?i.value=r:o||i.value!==r||(i.value=""),yg(s),hg(s)})),E(".js-user-status-form",(async function(e,n){const s=t(e,".js-user-status-form-group");let o;s.classList.remove("errored");try{o=await n.html()}catch(c){return void s.classList.add("errored")}const r=p(e,".js-user-status-container"),i=o.html.querySelector(".js-user-status-container");r.replaceWith(o.html);const a=document.querySelectorAll(".js-user-status-container");for(const t of a)if(i!==t){const e=t.closest(".js-user-status-context");if(e){const n=h(e,"data-url"),s=await $(document,n);t.replaceWith(s)}}})),pt(".js-toggle-user-status-edit",(function(e){e.addEventListener("mouseenter",Tg),e.addEventListener("mouseleave",kg)})),pt(".js-emoji-picker",e=>{if(!(e instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/user-status-submit.ts:62");dg(e)}),pt("[data-warn-unsaved-changes]",{add(e){e.addEventListener("input",Mg),e.addEventListener("change",Mg),e.addEventListener("submit",Sg);const t=e.closest("details-dialog");t&&(p(t,"details").addEventListener("toggle",Ag),t.addEventListener("details-dialog-close",xg))},remove(e){e.removeEventListener("input",Mg),e.removeEventListener("change",Mg),e.removeEventListener("submit",Sg);const t=e.closest("details-dialog");t&&(p(t,"details").removeEventListener("toggle",Ag),t.removeEventListener("details-dialog-close",xg),Sg())}});let Cg;async function qg(e){const n=e.value;if(Cg=n,!n)return[];!function(e){const n=t(document,".js-related-issues-spinner");"true"===e.getAttribute("data-user-has-opted-in")&&(n.hidden=!1)}(e);const s=h(e,"data-related-issues-path");if(!(e.parentElement instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/related-issues.ts:88");const o=t(e.parentElement,".js-data-related-issues-path-csrf",HTMLInputElement),r=await F(Me(s,o.value,{method:"POST",body:Bg(n,e.getAttribute("data-repository-id"))}));return Pg(),r.data.errors?[]:r.data.repository.similarIssues.nodes}function Ig(e,n){if(0===n.length)return Pg(),_g(),void(t(document,".js-related-issues-suggestions-results-wrapper").hidden=!0);t(document,".js-number-of-related-issues",HTMLInputElement).value=`${n.length}`,function(e){const n=t(document,".js-related-issues-suggestions-results-container");n.innerHTML="",n.appendChild(e),function(){if(ha("related-issues-hidden"))return;Ng(!0),$g(!0),t(document,".js-related-issues-results-display").setAttribute("open","")}(),t(document,".js-related-issues-suggestions-results-wrapper").hidden=!1}(function(e,n){const s=t(document,".js-related-issues-suggestions-template",HTMLTemplateElement),o=document.createDocumentFragment();for(let t=0;t{Ig(e,await qg(e))},{wait:500}),ft("change",".js-related-issues-search",async()=>{e.value!==Cg&&Ig(e,await qg(e))})}}),ft("submit","form#new_issue",e=>{e.defaultPrevented||va("related-issues-hidden")}),ft("click",".js-toggle-related-results",()=>{Ng(),$g(),t(document,".js-related-issues-results-display").hasAttribute("open")?ba("related-issues-hidden","true"):(va("related-issues-hidden"),window.localStorage.removeItem("related-issues-hidden"))}),ft("navigation:keydown",".js-issue-title-input-container",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/related-issues.ts:52");const n=document.querySelector(".js-issue-title-input-container .js-navigation-item.navigation-focus"),s=t(document,".js-related-issues-results-display").hasAttribute("open");switch(e.detail.hotkey){case"Enter":if(!n){const t=p(e.currentTarget,"form",HTMLFormElement),n=t.querySelector("input[type=submit], button[type=submit]");n&&!n.disabled&&L(t)}break;case"Escape":s&&t(document,".js-hide-related-results").click()}})),f("keydown",".js-related-issues-search",(function(e){document.querySelector(".js-issue-title-input-container .js-navigation-item.navigation-focus")||yr(e)}));let Dg=!1;function Ng(e){let n;n=void 0===e?!t(document,".js-related-issues-results-display").hasAttribute("open"):!!e,!Dg&&n?(qe(t(document,".js-related-issues-suggestions-results-container")),t(document,".js-related-issues-search").classList.add("js-navigation-enable")):(lt(t(document,".js-related-issues-suggestions-results-container")),t(document,".js-related-issues-search").classList.remove("js-navigation-enable"))}function Bg(e,t){if(!t)throw new Error("invariant: app/assets/modules/github/related-issues.ts:206");const n=new FormData;return n.append("variables[query]",e),n.append("variables[repository_id]",t),n}function Pg(){const e=document.querySelector(".js-related-issues-spinner");e&&(e.hidden=!0)}function Rg(e,n,s){const o=e.content.cloneNode(!0);"OPEN"===n.state?Fg(o,".js-related-issues-octicon-issue-opened"):Fg(o,".js-related-issues-octicon-issue-closed");const r=t(o,".js-related-issue-suggestion-link",HTMLAnchorElement);if(r.href=n.url,r.setAttribute("data-hydro-client-context",JSON.stringify(s)),t(o,".js-related-issue-suggestion-title",HTMLElement).textContent=n.title,t(o,".js-related-issue-number",HTMLElement).textContent=`#${n.number}`,t(o,".js-related-issue-opened-at",HTMLElement).setAttribute("datetime",n.createdAt),n.author){const e=t(o,".js-related-issue-author",HTMLElement);e.textContent=`${n.author.login}`,e.hidden=!1}return t(o,".js-related-issue-updated-at",HTMLElement).setAttribute("datetime",n.updatedAt),t(o,".js-related-issue-suggestion-comment-count").textContent=n.comments.totalCount,o}function Fg(e,n){const s=t(e,".js-related-issue-octicon"),o=t(s,n,SVGElement);s.classList.remove("d-none"),o.classList.remove("d-none")}ft("compositionstart",".js-related-issues-search",()=>{Ng(!1),Dg=!0}),ft("compositionend",".js-related-issues-search",()=>{Dg=!1,Ng()});const Og=new WeakMap;function Ug(e,t,n){const s=e[n];let o={position_in_list:n,number_of_similar_issues:e.length,title_length:t.length};return s.repository.isPrivate||(o=Object.assign({},o,{title_string_at_time_of_click:t,id_of_clicked_result:s.databaseId,results_shown_at_time_of_click:e.map(e=>e.databaseId)})),o}let Wg;async function zg(e){const n=e.value;if(Wg=n,!n)return[];Kg(),function(){const e=t(document,".js-similar-issues-spinner");e&&(e.hidden=!1)}();const s=h(e,"data-similar-issues-path");if(!(e.parentElement instanceof HTMLElement))throw new Error("invariant: app/assets/modules/github/similar-issues.ts:88");const o=t(e.parentElement,".js-data-similar-issues-path-csrf",HTMLInputElement),r=await F(Me(s,o.value,{method:"POST",body:Gg(n,e.getAttribute("data-repository-id"))}));return Qg(),r.data.errors?[]:r.data.repository.similarIssues.nodes}function Vg(e,n){if(0===n.length)return Yg(),void Kg();t(document,".js-number-of-similar-issues",HTMLInputElement).value=`${n.length}`,function(e){const n=t(document,".js-similar-issues-suggestions-results-container");n.innerHTML="",n.appendChild(e)}(function(e,n){const s=t(document,".js-similar-issues-suggestions-template",HTMLTemplateElement),o=document.createDocumentFragment();for(let t=0;t{const n=p(e,"details-dialog"),s=t(document,`#${h(e,"data-for-textarea")}`,HTMLTextAreaElement),o=Og.get(n)||0,r=t(n,"#js-dialog-link-href",HTMLInputElement).value,i=`[${t(n,"#js-dialog-link-text",HTMLInputElement).value}](${r}) `,a=s.value.slice(0,o),c=s.value.slice(o);s.value=a+i+c,s.focus(),s.selectionStart=s.selectionEnd=o+i.length}),E(".js-repository-advisory-title-update",(async function(e,t){p(e,".js-details-container").classList.remove("open");const n=(await t.json()).json;document.title=n.page_title;for(const s of e.elements)(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement)&&(s.defaultValue=s.value)})),E(".js-add-repository-advisory-collaborator",(async function(e,t){t.html(),e.reset()})),pt(".js-similar-issues-search",{constructor:HTMLInputElement,add(e){O(e,async()=>{Vg(e,await zg(e))},{wait:500})}}),ft("change",".js-similar-issues-search",async({currentTarget:e})=>{if(!(e instanceof HTMLInputElement))throw new Error("invariant: app/assets/modules/github/similar-issues.ts:26");e.value!==Wg&&Vg(e,await zg(e))}),ft("click",".js-show-similar-issues",()=>{t(document,".js-similar-issues-suggestions-results-wrapper").hasAttribute("hidden")?t(document,".js-similar-issues-suggestions-results-wrapper").hidden=!1:Yg()}),ft("click",".js-hide-similar-issues",()=>{Yg()}),ft("navigation:keydown",".js-issue-title-input-container",(function(e){if(!(e instanceof CustomEvent))throw new Error("invariant: app/assets/modules/github/similar-issues.ts:47");const n=document.querySelector(".js-similar-issues-suggestions-results-wrapper");if(!n)return;const s=document.querySelector(".js-issue-title-input-container .js-navigation-item.navigation-focus"),o=n.hasAttribute("hidden");switch(e.detail.hotkey){case"Enter":if(!s){const t=p(e.currentTarget,"form",HTMLFormElement),n=t.querySelector("input[type=submit], button[type=submit]");n&&!n.disabled&&L(t)}break;case"Escape":o&&t(document,".js-hide-similar-issues").click()}})),f("keydown",".js-similar-issues-search",(function(e){document.querySelector(".js-issue-title-input-container .js-navigation-item.navigation-focus")||yr(e)}));let Jg=!1;function Xg(e){const n=document.querySelector(".js-similar-issues-suggestions-results-wrapper");if(!n)return;let s;s=void 0===e?!n.hasAttribute("hidden"):!!e,!Jg&&s?(qe(t(document,".js-similar-issues-suggestions-results-container")),t(document,".js-similar-issues-search").classList.add("js-navigation-enable")):(lt(t(document,".js-similar-issues-suggestions-results-container")),t(document,".js-similar-issues-search").classList.remove("js-navigation-enable"))}function Gg(e,t){if(!t)throw new Error("invariant: app/assets/modules/github/similar-issues.ts:187");const n=new FormData;return n.append("variables[query]",e),n.append("variables[repository_id]",t),n}function Qg(){const e=document.querySelector(".js-similar-issues-spinner");e&&(e.hidden=!0)}function Zg(e,n,s){const o=e.content.cloneNode(!0);"OPEN"===n.state?eh(o,".js-similar-issues-octicon-issue-opened"):eh(o,".js-similar-issues-octicon-issue-closed");const r=t(o,".js-similar-issue-suggestion-link",HTMLAnchorElement);if(r.href=n.url,r.setAttribute("data-hydro-client-context",JSON.stringify(s)),t(o,".js-similar-issue-suggestion-title",HTMLElement).textContent=n.title,t(o,".js-similar-issue-number",HTMLElement).textContent=`#${n.number}`,t(o,".js-similar-issue-opened-at",HTMLElement).setAttribute("datetime",n.createdAt),n.author){const e=t(o,".js-similar-issue-author",HTMLElement);e.textContent=`${n.author.login}`,e.hidden=!1}return t(o,".js-similar-issue-updated-at",HTMLElement).setAttribute("datetime",n.updatedAt),t(o,".js-similar-issue-suggestion-comment-count").textContent=n.comments.totalCount,o}function eh(e,n){const s=t(e,".js-similar-issue-octicon");t(s,n,SVGElement).removeAttribute("hidden")}ft("compositionstart",".js-similar-issues-search",()=>{Xg(!1),Jg=!0}),ft("compositionend",".js-similar-issues-search",()=>{Jg=!1,Xg()});let th=!1;function nh(e){const n=document.importNode(e.content,!0),s=t(document,"#js-flash-container");for(const t of s.children)s.removeChild(t);s.appendChild(n)}function sh(){for(const e of document.querySelectorAll(".js-selected-check-run"))e.remove();t(document,".js-zen-blankslate").hidden=!1,th=!0}E(".js-check-suite-rerequest-form",(async function(e,n){p(e,"details").removeAttribute("open");const s=document.querySelector("#js-selected-check-run");if(null!==s){const n="true"===t(e,"input[name=only_failed_check_runs]",HTMLInputElement).value,o="true"===h(s,"data-failed");n&&!o||sh()}try{await n.text(),nh(t(document,"#js-check-suite-rerequest-form-success",HTMLTemplateElement))}catch(o){throw nh(t(document,"#js-check-suite-rerequest-form-error",HTMLTemplateElement)),o}})),E(".js-check-run-rerequest-form",(async function(e,n){th=!0,t(document,"#js-selected-check-run").contains(e)&&sh();try{await n.text(),nh(t(e,".js-check-run-rerequest-form-success",HTMLTemplateElement))}catch(s){throw nh(t(e,".js-check-run-rerequest-form-error",HTMLTemplateElement)),s}})),pt(".js-latest-run-link",{constructor:HTMLElement,add(e){th&&e.click()}}),ft("toggle",".js-check-suites-sidebar-wrapper",({currentTarget:e})=>{t(e,"summary").hidden=!0;const s=e.hasAttribute("open");for(const t of n(document,".js-check-suite-focus-link",HTMLAnchorElement)){const e=new URLSearchParams(t.search.slice(1));s?e.delete("check_suite_focus"):e.set("check_suite_focus","true"),t.search=`?${e.toString()}`}},{capture:!0}),ft("click",".js-timeout-flash-close",(function(e){e.target instanceof HTMLElement&&(p(e.target,".js-interactive-component-timeout").hidden=!0)})),ft("click",".js-interactive-component-button",(function(e){const t=e.target;if(t instanceof HTMLButtonElement){const e=t.querySelector(".js-loading-spinner");e instanceof HTMLElement&&(e.hidden=!1)}})),E(".js-interactive-component-form",(async function(e,s){const o=t(e,".js-interactive-component-timeout"),r=p(e,".js-component-container");if(o){o.hidden=!0;const t=n(r,".js-interactive-component-button",HTMLButtonElement);for(const e of t)e.disabled=!0;const s=parseInt(h(e,"data-timeout"));setTimeout(()=>{if(o){o.hidden=!1;const e=n(r,".js-interactive-component-button[disabled]",HTMLButtonElement);for(const t of e){t.disabled=!1;const e=t.querySelector(".loading-spinner");e instanceof HTMLElement&&(e.hidden=!0)}}},s)}await s.text()})),ft("click",["form button:not([type])","form button[type=submit]","form input[type=submit]"].join(", "),(function(e){const t=e.currentTarget;t.form&&!e.defaultPrevented&&ut(t)})),E("form[data-remote]",(function(e,t,n){"json"===e.getAttribute("data-type")&&n.headers.set("Accept","application/json"),ht(e,"deprecatedAjaxSend",{request:n}),t.text().catch(e=>{if(e.response)return e.response;throw e}).then(t=>{t.status<300?ht(e,"deprecatedAjaxSuccess"):ht(e,"deprecatedAjaxError",{error:t.statusText,status:t.status,text:t.text})},t=>{ht(e,"deprecatedAjaxError",{error:t.message,status:0,text:null})}).then(()=>{ht(e,"deprecatedAjaxComplete")})})),ft("deprecatedAjaxComplete","form",(function({currentTarget:e}){const t=dt(e);t&&t.remove()})),P(e=>{const t=dt(e);t&&t.remove()}),mt(R)}}})); //# sourceMappingURL=github-bootstrap-bdd51374.js.map