System.register(["./chunk-frameworks.js","./chunk-vendor.js","./chunk-codemirror.js"],function(){"use strict";var se,ue,We,ee,ve,Ke,Ve,ze,Xe,ae,Ge,Qe,Je,Ye,Ze,et,tt,nt,G,$,it,le,_,ot,rt,st,q;return{setters:[function(R){se=R.F,ue=R.S,We=R.B,ee=R.P,ve=R.aV,Ke=R.y,Ve=R.o,ze=R.C,Xe=R.X,ae=R.aW,Ge=R.M,Qe=R.a0,Je=R.G,Ye=R.m,Ze=R.q,et=R.W,tt=R.aX,nt=R.v},function(R){G=R.o,$=R.a,it=R.k,le=R.f,_=R.a9,ot=R.aa,rt=R.g,st=R.i},function(R){q=R.default}],execute:function(){var R=Object.defineProperty,F=(n,t)=>R(n,"name",{value:t,configurable:!0});const at=new WeakMap;function lt(n){const t=n.querySelector(".js-blob-filename"),e=t.value;return e==="."||e===".."||e===".git"?!1:/\S/.test(t.value)}F(lt,"filenameValid");function ct(n){const t=n.querySelector(".js-blob-contents");return t.getAttribute("data-allow-unchanged")==="true"?!0:te(t)}F(ct,"blobContentsConsideredSubmittable");function be(n){const t=n.querySelector(".js-new-filename-field");return te(t)}F(be,"newFilenameConsideredChanged");function ye(n){return Array.from(n.querySelectorAll(".js-check-for-fork")).some(We)}F(ye,"forkIsNotOK");function ut(n){return ye(n)||!lt(n)?!1:ct(n)||be(n)}F(ut,"canSubmit");function ft(n){const t=n.querySelector(".js-blob-contents");return t.getAttribute("data-allow-unchanged")?!0:te(t)}F(ft,"trackAsBlobEdit");function mt(n){const t=n.querySelector(".js-blob-contents");return te(t)||be(n)}F(mt,"hasChanges");let Se=null;function dt(n){let t=n.getAttribute("data-github-confirm-unload");return(t==="yes"||t==="true")&&(t=""),t==null&&(t="false"),t==="no"||t==="false"?null:function(){return t}}F(dt,"extractConfirmUnload");function we(){const n=document.querySelector(".js-blob-form"),t=n.querySelector(".js-blob-submit");t instanceof HTMLButtonElement&&(t.disabled=!ut(n)),n.querySelector(".js-blob-contents-changed").value=ft(n).toString(),Se&&(mt(n)?window.onbeforeunload=Se:window.onbeforeunload=null)}F(we,"revalidateBlobForm");function ht(n){for(const t of n.querySelectorAll("input"))t.getAttribute("type")==="hidden"&&t.getAttribute("class")&&t.getAttribute("data-default-value")==null&&t.setAttribute("data-default-value",t.value)}F(ht,"setDefaultValues");function te(n){return n==null?!0:n.type==="hidden"?n.value!==n.getAttribute("data-default-value"):n.value!==n.defaultValue}F(te,"fieldConsideredChanged");function pt(n){const t=n.querySelector(".js-blob-contents"),e=n.querySelector(".js-new-filename-field"),r=n.querySelector(".js-blob-filename"),p=r.hasAttribute("data-new-file");if(r.defaultValue!=null&&r.defaultValue.length&&!p)return at.set(t,e.value)}F(pt,"setOldFilename"),G(".js-blob-form",{constructor:HTMLFormElement,initialize(n){setTimeout(()=>{ht(n),pt(n),we(),Se=dt(n),n.addEventListener("submit",function(){window.onbeforeunload=null})})}}),$("change",".js-blob-contents",function(){const n=document.querySelector(".js-blob-filename");!n||ne(n)}),se(".js-blob-filename",function(n){const t=n.currentTarget;document.querySelector(".js-blob-contents").setAttribute("data-filename",t.value),fe(t.value),ne(t)}),se(".js-breadcrumb-nav",function(n){const t=n.currentTarget;ke(t),ne(t)}),G(".js-breadcrumb-nav",{constructor:HTMLInputElement,initialize(n){ke(n),ne(n)}}),ue("keydown",".js-breadcrumb-nav",function(n){const t=n.currentTarget;if(n.key==="Backspace"&&t.selectionStart===0&&t.selectionEnd===0){const e=t.parentElement;e&&e.querySelectorAll(".separator").length!==1&&(Le(t,!0),n.preventDefault())}ne(t)});function ne(n){xt(n),gt(n),we()}F(ne,"syncFields");function ke(n){function t(){n.focus(),n.setSelectionRange(0,0)}for(F(t,"setCaret");n.value.split("/").length>1;){const r=n.value.split("/"),p=r[0],c=r.slice(1).join("/");p===""||p==="."||p===".git"?(n.value=c,window.setTimeout(t,1)):p===".."?Le(n):vt(n,p,c)}}F(ke,"watchforSegmentChanges");function fe(n){const t=je();for(const e of document.querySelectorAll(".js-template-suggestion")){const r=e.getAttribute("data-template-suggestion-pattern");if(r){const p=new RegExp(r,"i");e.classList.toggle("d-none",!p.test(t+n))}}}F(fe,"checkForTemplateSuggestion");function gt(n){let t=!0,e=n.value?`Create ${n.value}`:"Create new file";const r=n.closest("form"),p=document.querySelector(".js-blob-contents"),c=r.querySelector(".js-new-blob-commit-summary");if(!c)return;const s=document.querySelector(".js-commit-message-fallback"),o=at.get(p),g=document.querySelector(".js-new-filename-field").value;if(o)if(g!==o){const b=te(p)?"Update and rename":"Rename";if(n.value.length&&g.length){const w=o.split("/"),m=g.split("/"),x=w.length-1;for(let v=0;v .js-path-segment"))n=`${n}${t.textContent}/`;return n}F(je,"extractFilePath");function Le(n,t=!1){t||(n.value=n.value.replace("../",""));let e;const r=document.querySelector(".js-breadcrumb-container");function p(c,s=0){(s===0||c)&&(n.focus(),n.setSelectionRange(s,s))}if(F(p,"setCaret"),r.querySelectorAll(".separator").length!==1){n.previousElementSibling&&n.previousElementSibling.remove();const c=n.previousElementSibling;e=c.textContent.length,c.remove(),t&&(n.value=`${c.textContent}${n.value}`)}fe(n.value),window.setTimeout(p,1,t,e)}F(Le,"filenameNavUp");function vt(n,t,e){const r=t.trim(),p=document.querySelector(".js-breadcrumb-container");if(r.length>0){const s=p.querySelectorAll(".js-path-segment a");let o;s.length>1?o=s[s.length-1].pathname:o=p.querySelector(".js-repo-root a").pathname;const g=document.querySelector(".js-crumb-template").cloneNode(!0);g.classList.remove("js-crumb-template"),g.querySelector("a").href=o,g.querySelector("span").textContent=r;const y=document.querySelector(".js-crumb-separator").cloneNode(!0);y.classList.remove("js-crumb-separator"),n.before(g),n.before(y)}n.value=e,fe(n.value);function c(){n.focus(),n.setSelectionRange(0,0)}F(c,"setCaret"),window.setTimeout(c,1)}F(vt,"filenameNavDown"),se(".js-new-blob-commit-summary",function(n){const t=n.currentTarget;t.closest(".js-file-commit-form").querySelector(".js-too-long-error").classList.toggle("d-none",t.value.length<=50)}),G(".js-check-for-fork",function(n){const t=n.closest("form"),e=t.querySelector(".js-blob-submit");n.addEventListener("load",function(){ye(t)===!0&&(e.disabled=!0)})}),$("click",".js-citation-template",async function(n){await Ce(n)}),$("change",".js-gitignore-template input[type=radio]",async function(n){await Ce(n)});async function Ce(n){const t=n.currentTarget.closest(".js-blob-form"),e=ee(t.querySelector(".js-code-editor"));if(e==null)return;const r=n.currentTarget.getAttribute("data-template-url"),p=await fetch(r,{headers:{"X-Requested-With":"XMLHttpRequest"}});if(!p.ok)return;const c=await p.text();e.setCode(c)}F(Ce,"fetchAndInsertIntoEditor"),G(".js-file-commit-form",function(n){if(new URLSearchParams(window.location.search.slice(1)).get("start_commit")==="true"){const e=n.querySelector(".js-details-target");e&&e.click()}});var Bt=Object.defineProperty,H=(n,t)=>Bt(n,"name",{value:t,configurable:!0});const bt=["loading-preview","show-preview","no-changes-preview","error-preview"],_t=["show-code"].concat(bt);function yt(n){return n.classList.contains("show-code")?"show-code":n.classList.contains("template-editor")?"template-editor":"preview"}H(yt,"currentTab");function Te(n){const t=yt(n);for(const r of n.querySelectorAll(".js-blob-edit-tab")){const p=r.getAttribute("data-tab")===t;r.classList.toggle("selected",p),p?r.setAttribute("aria-current","true"):r.removeAttribute("aria-current")}const e={name:t};le(document.querySelector(".js-file-editor-nav"),"tab:change",e)}H(Te,"selectCurrentTab");function St(n){const t=[".md",".mkdn",".mkd",".mdown",".markdown"];for(const e of t)if(n.endsWith(e))return!0;return!1}H(St,"isMarkdown");function Q(n){return n.getAttribute("data-is-gist")==="true"}H(Q,"isGist");function wt(n,t){return(Q(n)?n:t).querySelector(".js-blob-filename")}H(wt,"getFilenameInput");function Ee(n,t,e){const r=wt(n,t);Q(n)?r.readOnly=!e:r.disabled=!e,r.style.cursor=e?"auto":"not-allowed"}H(Ee,"setFilenameEditable"),ue("keypress","input.js-blob-filename",function(n){if(n.key==="Enter"){const e=n.target.form.querySelector("select.js-code-indent-mode");e&&e.focus(),n.preventDefault()}});function Ae(n){const e=n.closest(".file-header").querySelector(".js-file-editor-nav");e.hidden=!St(n.value)}H(Ae,"setPreviewTabVisibility"),ue("keyup",".js-code-editor[data-is-gist] input.js-blob-filename",function(n){const t=n.target;Ae(t)}),$("edit:visual",".js-code-editor",function(n){const t=n.currentTarget.closest(".js-code-editor");ee(t).setCode(n.detail.value)}),G(".js-branch-name-label-container",qe),G(".js-gist-filename",{add(n){Ae(n)}});function kt(n){const t=n.currentTarget.closest(".js-code-editor");if(t.classList.contains("show-code"))return;t.querySelector(".js-blob-edit-code").removeAttribute("data-hotkey"),ie(t,"show-code"),Te(t);const e=ee(t);e?(e.refresh(),e.focus()):t.classList.contains("js-mobile-code-editor")&&t.querySelector(".js-code-textarea").focus();const r=t.closest(".js-blob-form");Ee(t,r,!0)}H(kt,"activateEditTab");function qe(){const n=document.querySelector(".js-branch-name-label-container"),t=!!document.querySelector(".js-quick-pull-choice-option[value=quick-pull]:checked");n&&(t?n.hidden=!0:n.hidden=!1)}H(qe,"setBranchNameLabel");function jt(n,t){const e=t.querySelector(".js-preview-diff-toggle");return e&&e instanceof HTMLInputElement?!e.checked:Lt(t)}H(jt,"showSimpleDiff");function Lt(n){return n.getAttribute("data-simplediff-enabled")==="true"}H(Lt,"isSimpleDiffFeatureEnabled");function Pe(n){const t=n.currentTarget.closest(".js-code-editor");if(!t.classList.contains("show-code")&&!t.classList.contains("template-editor"))return;t.querySelector(".js-blob-edit-code").setAttribute("data-hotkey","Control+P,Meta+P");const e=t.closest(".js-blob-form");return Re(t,e,!Q(t),!Q(t)&&jt(n,t))}H(Pe,"activatePreviewTab");function Ct(n){const t=n.currentTarget;if(t instanceof HTMLInputElement){const e=t.checked,r=n.currentTarget.closest(".js-code-editor"),p=r.closest(".js-blob-form");return Re(r,p,!0,!e)}}H(Ct,"toggleDiffPreview"),$("click",".js-blob-edit-code",kt),$("click",".js-blob-edit-preview",Pe),$("click",".js-preview-diff-toggle",Ct),$("codeEditor:preview",".js-code-textarea",function(n){n.currentTarget.closest(".js-code-editor").classList.contains("show-code")&&Pe(n)});function ie(n,t){n.classList.remove(..._t),n.classList.add(t);const e=n.querySelector(".preview-actions");e instanceof HTMLElement&&(e.hidden=!bt.includes(t))}H(ie,"setState");let Oe=null;async function Re(n,t,e,r){ie(n,"loading-preview"),Te(n),Ee(n,t,!1);const p=!!document.querySelector(".js-quick-pull-choice-option[value=quick-pull]:checked"),c=document.querySelector(".js-blob-preview-form"),s=ee(n);let o=null;if(s!=null)o=s.code();else if(n.classList.contains("js-mobile-code-editor"))o=n.querySelector(".js-code-textarea").value;else return;Q(n)?ve(c,{text:o}):ve(c,{code:o,commit:t.querySelector(".js-commit-oid").value,blobname:t.querySelector(".js-blob-filename").value,willcreatebranch:p.toString(),checkConflict:e.toString()}),Oe==null||Oe.abort();const{signal:g}=Oe=new AbortController;try{const y=new URL(c.action,window.location.origin);r&&y.searchParams.append("avoiddiff","true");const b=await fetch(y.toString(),{method:c.method,body:new FormData(c),signal:g});if(!b.ok)throw new Error("network error");const w=await b.text();if(!n.classList.contains("loading-preview"))return;const m=Ke(document,w);let x=Q(n)?m:m.querySelector(".data.highlight");if(x||(x=m.querySelector("#readme")),x||(x=m.querySelector(".js-preview-new-file")),x||(x=m.querySelector(".js-preview-msg")),!x&&(x=m.querySelector(".render-container"))&&x.classList.add("is-render-requested"),x){const v=n.querySelector(".js-commit-preview");v.innerHTML="",v.appendChild(x),ie(n,"show-preview")}else ie(n,"no-changes-preview")}catch{n&&ie(n,"error-preview")}}H(Re,"showPreview"),$("change",".js-quick-pull-choice-option",function(n){const t=n.currentTarget.value==="quick-pull",e=document.querySelector(".js-quick-pull-target-branch"),r=document.querySelector(".js-quick-pull-choice-value"),p=document.querySelector(".js-blob-submit");if(qe(),t){const c=document.querySelector(".js-quick-pull-new-branch-name"),s=c.getAttribute("data-generated-branch");!c.value.length&&s&&(c.value=s),c.focus(),c.select(),e.value=c.value,r.value=e.getAttribute("data-default-value")||"",p.textContent=p.getAttribute("data-pull-text")||""}else e.value=e.getAttribute("data-default-value")||"",r.value="",p.textContent=p.getAttribute("data-edit-text")||""});let De=null,oe=null;async function Tt(){const n=document.querySelector(".js-quick-pull-new-branch-name"),t=n.value,e=n.getAttribute("data-generated-branch"),r=document.querySelector(".js-quick-pull-normalization-info"),p=new FormData;p.append("ref",t);const c=n.getAttribute("data-check-url"),s=n.parentElement.querySelector(".js-data-check-url-csrf");De==null||De.abort();const{signal:o}=De=new AbortController;try{const g=await fetch(c,{mode:"same-origin",method:"POST",body:p,signal:o,headers:{Accept:"application/json","Scoped-CSRF-Token":s.value}});if(!g.ok)throw new Error("network error");const y=await g.json();if(t!==n.value)return;const b=y.normalized_ref;if(r.innerHTML=y.message_html==null?"":y.message_html,!b){const w=r.querySelector("code");w.textContent=e}oe&&(oe.value=b)}catch{if(t!==n.value)return;oe&&(oe.value=t)}}H(Tt,"updateTargetBranch");const Ut=it(Tt,200);se(".js-quick-pull-new-branch-name",function(n){const t=n.target.value;oe=document.querySelector(".js-quick-pull-target-branch"),oe.value=t,t.length&&Ut()}),$("click","[data-template-button]",function(){window.onbeforeunload=null}),_(function(n,t){(function(e){e(q)})(function(e){var r="CodeMirror-hint",p="CodeMirror-hint-active";e.showHint=function(u,l,a){if(!l)return u.showHint(a);a&&a.async&&(l.async=!0);var h={hint:l};if(a)for(var d in a)h[d]=a[d];return u.showHint(h)},e.defineExtension("showHint",function(u){u=g(this,this.getCursor("start"),u);var l=this.listSelections();if(!(l.length>1)){if(this.somethingSelected()){if(!u.hint.supportsSelection)return;for(var a=0;ai.clientHeight+1,Mt=h.getScrollInfo();if(nn>0){var Be=z.bottom-z.top,rn=P.top-(P.bottom-z.top);if(rn-Be>0)i.style.top=(N=P.top-Be-B)+"px",M=!1;else if(Be>He){i.style.height=He-5+"px",i.style.top=(N=P.bottom-z.top-B)+"px";var It=h.getCursor();l.from.ch!=It.ch&&(P=h.cursorCoords(It),i.style.left=(D=P.left-I)+"px",z=i.getBoundingClientRect())}}var _e=z.right-ge;if(_e>0&&(z.right-z.left>ge&&(i.style.width=ge-5+"px",_e-=z.right-z.left-ge),i.style.left=(D=P.left-_e-I)+"px"),on)for(var xe=i.firstChild;xe;xe=xe.nextSibling)xe.style.paddingRight=h.display.nativeBarWidth+"px";if(h.addKeyMap(this.keyMap=b(u,{moveFocus:function(W,K){a.changeActive(a.selectedHint+W,K)},setFocus:function(W){a.changeActive(W)},menuSize:function(){return a.screenAmount()},length:j.length,close:function(){u.close()},pick:function(){a.pick()},data:l})),u.options.closeOnUnfocus){var $t;h.on("blur",this.onBlur=function(){$t=setTimeout(function(){u.close()},100)}),h.on("focus",this.onFocus=function(){clearTimeout($t)})}return h.on("scroll",this.onScroll=function(){var W=h.getScrollInfo(),K=h.getWrapperElement().getBoundingClientRect(),Ht=N+Mt.top-W.top,Ue=Ht-(S.pageYOffset||(d.documentElement||d.body).scrollTop);if(M||(Ue+=i.offsetHeight),Ue<=K.top||Ue>=K.bottom)return u.close();i.style.top=Ht+"px",i.style.left=D+Mt.left-W.left+"px"}),e.on(i,"dblclick",function(W){var K=w(i,W.target||W.srcElement);K&&K.hintId!=null&&(a.changeActive(K.hintId),a.pick())}),e.on(i,"click",function(W){var K=w(i,W.target||W.srcElement);K&&K.hintId!=null&&(a.changeActive(K.hintId),u.options.completeOnSingleClick&&a.pick())}),e.on(i,"mousedown",function(){setTimeout(function(){h.focus()},20)}),this.scrollToActive(),e.signal(l,"select",j[this.selectedHint],i.childNodes[this.selectedHint]),!0}m.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var u=this.completion.cm;this.completion.options.closeOnUnfocus&&(u.off("blur",this.onBlur),u.off("focus",this.onFocus)),u.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var u=this;this.keyMap={Enter:function(){u.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(u,l){if(u>=this.data.list.length?u=l?this.data.list.length-1:0:u<0&&(u=l?0:this.data.list.length-1),this.selectedHint!=u){var a=this.hints.childNodes[this.selectedHint];a&&(a.className=a.className.replace(" "+p,"")),a=this.hints.childNodes[this.selectedHint=u],a.className+=" "+p,this.scrollToActive(),e.signal(this.data,"select",this.data.list[this.selectedHint],a)}},scrollToActive:function(){var u=this.completion.options.scrollMargin||0,l=this.hints.childNodes[Math.max(0,this.selectedHint-u)],a=this.hints.childNodes[Math.min(this.data.list.length-1,this.selectedHint+u)],h=this.hints.firstChild;l.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=a.offsetTop+a.offsetHeight-this.hints.clientHeight+h.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}};function x(u,l){if(!u.somethingSelected())return l;for(var a=[],h=0;h0?i(E):T(C+1)})}T(0)};return d.async=!0,d.supportsSelection=!0,d}else return(h=u.getHelper(u.getCursor(),"hintWords"))?function(S){return e.hint.fromList(S,{words:h})}:e.hint.anyword?function(S,i){return e.hint.anyword(S,i)}:function(){}}e.registerHelper("hint","auto",{resolve:k}),e.registerHelper("hint","fromList",function(u,l){var a=u.getCursor(),h=u.getTokenAt(a),d,S=e.Pos(a.line,h.start),i=a;h.start,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};e.defineOption("hintOptions",null)})}),_(function(n,t){(function(e){e(q)})(function(e){var r={},p=/[^\s\u00a0]/,c=e.Pos,s=e.cmpPos;function o(b){var w=b.search(p);return w==-1?0:w}e.commands.toggleComment=function(b){b.toggleComment()},e.defineExtension("toggleComment",function(b){b||(b=r);for(var w=this,m=1/0,x=this.listSelections(),v=null,k=x.length-1;k>=0;k--){var L=x[k].from(),u=x[k].to();L.line>=m||(u.line>=m&&(u=c(m,0)),m=L.line,v==null?w.uncomment(L,u,b)?v="un":(w.lineComment(L,u,b),v="line"):v=="un"?w.uncomment(L,u,b):w.lineComment(L,u,b))}});function g(b,w,m){return/\bstring\b/.test(b.getTokenTypeAt(c(w.line,0)))&&!/^[\'\"\`]/.test(m)}function y(b,w){var m=b.getMode();return m.useInnerComments===!1||!m.innerMode?m:b.getModeAt(w)}e.defineExtension("lineComment",function(b,w,m){m||(m=r);var x=this,v=y(x,b),k=x.getLine(b.line);if(!(k==null||g(x,b,k))){var L=m.lineComment||v.lineComment;if(!L){(m.blockCommentStart||v.blockCommentStart)&&(m.fullLines=!0,x.blockComment(b,w,m));return}var u=Math.min(w.ch!=0||w.line==b.line?w.line+1:w.line,x.lastLine()+1),l=m.padding==null?" ":m.padding,a=m.commentBlankLines||b.line==w.line;x.operation(function(){if(m.indent){for(var h=null,d=b.line;di.length)&&(h=i)}for(var d=b.line;du||x.operation(function(){if(m.fullLines!=!1){var a=p.test(x.getLine(u));x.replaceRange(l+L,c(u)),x.replaceRange(k+l,c(b.line,0));var h=m.blockCommentLead||v.blockCommentLead;if(h!=null)for(var d=b.line+1;d<=u;++d)(d!=u||a)&&x.replaceRange(h+l,c(d,0))}else{var S=s(x.getCursor("to"),w)==0,i=!x.somethingSelected();x.replaceRange(L,w),S&&x.setSelection(i?w:x.getCursor("from"),w),x.replaceRange(k,b)}})}}),e.defineExtension("uncomment",function(b,w,m){m||(m=r);var x=this,v=y(x,b),k=Math.min(w.ch!=0||w.line==b.line?w.line:w.line-1,x.lastLine()),L=Math.min(b.line,k),u=m.lineComment||v.lineComment,l=[],a=m.padding==null?" ":m.padding,h;e:{if(!u)break e;for(var d=L;d<=k;++d){var S=x.getLine(d),i=S.indexOf(u);if(i>-1&&!/comment/.test(x.getTokenTypeAt(c(d,i+1)))&&(i=-1),i==-1&&p.test(S)||i>-1&&p.test(S.slice(0,i)))break e;l.push(S)}if(x.operation(function(){for(var B=L;B<=k;++B){var X=l[B-L],V=X.indexOf(u),U=V+u.length;V<0||(X.slice(U,U+a.length)==a&&(U+=a.length),h=!0,x.replaceRange("",c(B,V),c(B,U)))}}),h)return!0}var f=m.blockCommentStart||v.blockCommentStart,j=m.blockCommentEnd||v.blockCommentEnd;if(!f||!j)return!1;var T=m.blockCommentLead||v.blockCommentLead,C=x.getLine(L),E=C.indexOf(f);if(E==-1)return!1;var A=k==L?C:x.getLine(k),O=A.indexOf(j,k==L?E+f.length:0),P=c(L,E+1),D=c(k,O+1);if(O==-1||!/comment/.test(x.getTokenTypeAt(P))||!/comment/.test(x.getTokenTypeAt(D))||x.getRange(P,D,` `).indexOf(j)>-1)return!1;var N=C.lastIndexOf(f,b.ch),M=N==-1?-1:C.slice(0,b.ch).indexOf(j,N+f.length);if(N!=-1&&M!=-1&&M+j.length!=b.ch)return!1;M=A.indexOf(j,w.ch);var I=A.slice(w.ch).lastIndexOf(f,M-w.ch);return N=M==-1||I==-1?-1:w.ch+I,M!=-1&&N!=-1&&N!=w.ch?!1:(x.operation(function(){x.replaceRange("",c(k,O-(a&&A.slice(O-a.length,O)==a?a.length:0)),c(k,O+j.length));var B=E+f.length;if(a&&C.slice(B,B+a.length)==a&&(B+=a.length),x.replaceRange("",c(L,E),c(L,B)),T)for(var X=L+1;X<=k;++X){var V=x.getLine(X),U=V.indexOf(T);if(!(U==-1||p.test(V.slice(0,U)))){var Z=U+T.length;a&&V.slice(Z,Z+a.length)==a&&(Z+=a.length),x.replaceRange("",c(X,U),c(X,Z))}}}),!0)})})});var Wt=_(function(n,t){(function(e){e(q)})(function(e){e.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var r=0;r-1&&c.substring(g+1,c.length);if(y)return e.findModeByExtension(y)},e.findModeByName=function(c){c=c.toLowerCase();for(var s=0;s2&&d.token&&typeof d.token!="string"){k.pending=[];for(var f=2;f-1)return e.Pass;var u=v.indent.length-1,l=m[v.state];e:for(;;){for(var a=0;a-1?b+o.length:b}var w=o.exec(g?s.slice(g):s);return w?w.index+g+(y?w[0].length:0):-1}return{startState:function(){return{outer:e.startState(r),innerActive:null,inner:null}},copyState:function(s){return{outer:e.copyState(r,s.outer),innerActive:s.innerActive,inner:s.innerActive&&e.copyState(s.innerActive.mode,s.inner)}},token:function(s,o){if(o.innerActive){var L=o.innerActive,y=s.string;if(!L.close&&s.sol())return o.innerActive=o.inner=null,this.token(s,o);var m=L.close?c(y,L.close,s.pos,L.parseDelimiters):-1;if(m==s.pos&&!L.parseDelimiters)return s.match(L.close),o.innerActive=o.inner=null,L.delimStyle&&L.delimStyle+" "+L.delimStyle+"-close";m>-1&&(s.string=y.slice(0,m));var u=L.mode.token(s,o.inner);return m>-1&&(s.string=y),m==s.pos&&L.parseDelimiters&&(o.innerActive=o.inner=null),L.innerStyle&&(u?u=u+" "+L.innerStyle:u=L.innerStyle),u}else{for(var g=1/0,y=s.string,b=0;bf);j++){var T=l.getLine(i++);d=d==null?T:d+` `+T}S=S*2,a.lastIndex=h.ch;var C=a.exec(d);if(C){var E=d.slice(0,C.index).split(` `),A=C[0].split(` `),O=h.line+E.length-1,P=E[E.length-1].length;return{from:r(O,P),to:r(O+A.length-1,A.length==1?P+A[0].length:A[A.length-1].length),match:C}}}}function y(l,a,h){for(var d,S=0;S<=l.length;){a.lastIndex=S;var i=a.exec(l);if(!i)break;var f=i.index+i[0].length;if(f>l.length-h)break;(!d||f>d.index+d[0].length)&&(d=i),S=i.index+1}return d}function b(l,a,h){a=c(a,"g");for(var d=h.line,S=h.ch,i=l.firstLine();d>=i;d--,S=-1){var f=l.getLine(d),j=y(f,a,S<0?0:f.length-S);if(j)return{from:r(d,j.index),to:r(d,j.index+j[0].length),match:j}}}function w(l,a,h){if(!s(a))return b(l,a,h);a=c(a,"gm");for(var d,S=1,i=l.getLine(h.line).length-h.ch,f=h.line,j=l.firstLine();f>=j;){for(var T=0;T=j;T++){var C=l.getLine(f--);d=d==null?C:C+` `+d}S*=2;var E=y(d,a,i);if(E){var A=d.slice(0,E.index).split(` `),O=E[0].split(` `),P=f+A.length,D=A[A.length-1].length;return{from:r(P,D),to:r(P+O.length-1,O.length==1?D+O[0].length:O[O.length-1].length),match:E}}}}var m,x;String.prototype.normalize?(m=function(l){return l.normalize("NFD").toLowerCase()},x=function(l){return l.normalize("NFD")}):(m=function(l){return l.toLowerCase()},x=function(l){return l});function v(l,a,h,d){if(l.length==a.length)return h;for(var S=0,i=h+Math.max(0,l.length-a.length);;){if(S==i)return S;var f=S+i>>1,j=d(l.slice(0,f)).length;if(j==h)return f;j>h?i=f:S=f+1}}function k(l,a,h,d){if(!a.length)return null;var S=d?m:x,i=S(a).split(/\r|\n\r?/);e:for(var f=h.line,j=h.ch,T=l.lastLine()+1-i.length;f<=T;f++,j=0){var C=l.getLine(f).slice(j),E=S(C);if(i.length==1){var A=E.indexOf(i[0]);if(A==-1)continue e;var h=v(C,E,A,S)+j;return{from:r(f,v(C,E,A,S)+j),to:r(f,v(C,E,A+i[0].length,S)+j)}}else{var O=E.length-i[0].length;if(E.slice(O)!=i[0])continue e;for(var P=1;P=T;f--,j=-1){var C=l.getLine(f);j>-1&&(C=C.slice(0,j));var E=S(C);if(i.length==1){var A=E.lastIndexOf(i[0]);if(A==-1)continue e;return{from:r(f,v(C,E,A,S)),to:r(f,v(C,E,A+i[0].length,S))}}else{var O=i[i.length-1];if(E.slice(0,O.length)!=O)continue e;for(var P=1,h=f-i.length+1;P0);)h.push({anchor:d.from(),head:d.to()});h.length&&this.setSelections(h,0)})})});_(function(n,t){(function(e){e(q,Kt,Et)})(function(e){function r(i,f){return typeof i=="string"?i=new RegExp(i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),f?"gi":"g"):i.global||(i=new RegExp(i.source,i.ignoreCase?"gi":"g")),{token:function(j){i.lastIndex=j.pos;var T=i.exec(j.string);if(T&&T.index==j.pos)return j.pos+=T[0].length||1,"searching";T?j.pos=T.index:j.skipToEnd()}}}function p(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function c(i){return i.state.search||(i.state.search=new p)}function s(i){return typeof i=="string"&&i==i.toLowerCase()}function o(i,f,j){return i.getSearchCursor(f,j,{caseFold:s(f),multiline:!0})}function g(i,f,j,T,C){i.openDialog(f,T,{value:j,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){L(i)},onKeyDown:C})}function y(i,f,j,T,C){i.openDialog?i.openDialog(f,C,{value:T,selectValueOnOpen:!0}):C(prompt(j,T))}function b(i,f,j,T){i.openConfirm?i.openConfirm(f,T):confirm(j)&&T[0]()}function w(i){return i.replace(/\\([nrt\\])/g,function(f,j){return j=="n"?` `:j=="r"?"\r":j=="t"?" ":j=="\\"?"\\":f})}function m(i){var f=i.match(/^\/(.*)\/([a-z]*)$/);if(f)try{i=new RegExp(f[1],f[2].indexOf("i")==-1?"":"i")}catch{}else i=w(i);return(typeof i=="string"?i=="":i.test(""))&&(i=/x^/),i}function x(i,f,j){f.queryText=j,f.query=m(j),i.removeOverlay(f.overlay,s(f.query)),f.overlay=r(f.query,s(f.query)),i.addOverlay(f.overlay),i.showMatchesOnScrollbar&&(f.annotate&&(f.annotate.clear(),f.annotate=null),f.annotate=i.showMatchesOnScrollbar(f.query,s(f.query)))}function v(i,f,j,T){var C=c(i);if(C.query)return k(i,f);var E=i.getSelection()||C.lastQuery;if(E instanceof RegExp&&E.source=="x^"&&(E=null),j&&i.openDialog){var A=null,O=function(P,D){e.e_stop(D),!!P&&(P!=C.queryText&&(x(i,C,P),C.posFrom=C.posTo=i.getCursor()),A&&(A.style.opacity=1),k(i,D.shiftKey,function(N,M){var I;M.line<3&&document.querySelector&&(I=i.display.wrapper.querySelector(".CodeMirror-dialog"))&&I.getBoundingClientRect().bottom-4>i.cursorCoords(M,"window").top&&((A=I).style.opacity=.4)}))};g(i,u(i),E,O,function(P,D){var N=e.keyName(P),M=i.getOption("extraKeys"),I=M&&M[N]||e.keyMap[i.getOption("keyMap")][N];I=="findNext"||I=="findPrev"||I=="findPersistentNext"||I=="findPersistentPrev"?(e.e_stop(P),x(i,c(i),D),i.execCommand(I)):(I=="find"||I=="findPersistent")&&(e.e_stop(P),O(D,P))}),T&&E&&(x(i,C,E),k(i,f))}else y(i,u(i),"Search for:",E,function(P){P&&!C.query&&i.operation(function(){x(i,C,P),C.posFrom=C.posTo=i.getCursor(),k(i,f)})})}function k(i,f,j){i.operation(function(){var T=c(i),C=o(i,T.query,f?T.posFrom:T.posTo);!C.find(f)&&(C=o(i,T.query,f?e.Pos(i.lastLine()):e.Pos(i.firstLine(),0)),!C.find(f))||(i.setSelection(C.from(),C.to()),i.scrollIntoView({from:C.from(),to:C.to()},20),T.posFrom=C.from(),T.posTo=C.to(),j&&j(C.from(),C.to()))})}function L(i){i.operation(function(){var f=c(i);f.lastQuery=f.query,!!f.query&&(f.query=f.queryText=null,i.removeOverlay(f.overlay),f.annotate&&(f.annotate.clear(),f.annotate=null))})}function u(i){return''+i.phrase("Search:")+' '+i.phrase("(Use /re/ syntax for regexp search)")+""}function l(i){return' '+i.phrase("(Use /re/ syntax for regexp search)")+""}function a(i){return''+i.phrase("With:")+' '}function h(i){return''+i.phrase("Replace?")+" "}function d(i,f,j){i.operation(function(){for(var T=o(i,f);T.findNext();)if(typeof f!="string"){var C=i.getRange(T.from(),T.to()).match(f);T.replace(j.replace(/\$(\d)/g,function(E,A){return C[A]}))}else T.replace(j)})}function S(i,f){if(!i.getOption("readOnly")){var j=i.getSelection()||c(i).lastQuery,T=''+(f?i.phrase("Replace all:"):i.phrase("Replace:"))+"";y(i,T+l(i),T,j,function(C){!C||(C=m(C),y(i,a(i),i.phrase("Replace with:"),"",function(E){if(E=w(E),f)d(i,C,E);else{L(i);var A=o(i,C,i.getCursor("from")),O=function(){var D=A.from(),N;!(N=A.findNext())&&(A=o(i,C),!(N=A.findNext())||D&&A.from().line==D.line&&A.from().ch==D.ch)||(i.setSelection(A.from(),A.to()),i.scrollIntoView({from:A.from(),to:A.to()}),b(i,h(i),i.phrase("Replace?"),[function(){P(N)},O,function(){d(i,C,E)}]))},P=function(D){A.replace(typeof C=="string"?E:E.replace(/\$(\d)/g,function(N,M){return D[M]})),O()};O()}}))})}}e.commands.find=function(i){L(i),v(i)},e.commands.findPersistent=function(i){L(i),v(i,!1,!0)},e.commands.findPersistentNext=function(i){v(i,!1,!0,!0)},e.commands.findPersistentPrev=function(i){v(i,!0,!0,!0)},e.commands.findNext=v,e.commands.findPrev=function(i){v(i,!0)},e.commands.clearSearch=L,e.commands.replace=S,e.commands.replaceAll=function(i){S(i,!0)}})}),_(function(n,t){(function(e){e(q,Et)})(function(e){function r(s,o,g,y,b){s.openDialog?s.openDialog(o,b,{value:y,selectValueOnOpen:!0}):b(prompt(g,y))}function p(s){return s.phrase("Jump to line:")+' '+s.phrase("(Use line:column or scroll% syntax)")+""}function c(s,o){var g=Number(o);return/^[-+]/.test(o)?s.getCursor().line+g:g-1}e.commands.jumpToLine=function(s){var o=s.getCursor();r(s,p(s),s.phrase("Jump to line:"),o.line+1+":"+o.ch,function(g){if(!!g){var y;if(y=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(g))s.setCursor(c(s,y[1]),Number(y[2]));else if(y=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(g)){var b=Math.round(s.lineCount()*Number(y[1])/100);/^[-+]/.test(y[1])&&(b=o.line+b+1),s.setCursor(b-1,o.ch)}else(y=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(g))&&s.setCursor(c(s,y[1]),o.ch)}})},e.keyMap.default["Alt-G"]="jumpToLine"})}),_(function(n,t){(function(e){e(q)})(function(e){var r=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,p=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,c=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(o){if(o.getOption("disableInput"))return e.Pass;for(var g=o.listSelections(),y=[],b=0;b\s*$/.test(L),h=!/>\s*$/.test(L);(a||h)&&o.replaceRange("",{line:w.line,ch:0},{line:w.line,ch:w.ch+1}),y[b]=` `}else{var d=u[1],S=u[5],i=!(c.test(u[2])||u[2].indexOf(">")>=0),f=i?parseInt(u[3],10)+1+u[4]:u[2].replace("x"," ");y[b]=` `+d+f+S,i&&s(o,w)}}o.replaceSelections(y)};function s(o,g){var y=g.line,b=0,w=0,m=r.exec(o.getLine(y)),x=m[1];do{b+=1;var v=y+b,k=o.getLine(v),L=r.exec(k);if(L){var u=L[1],l=parseInt(m[3],10)+b-w,a=parseInt(L[3],10),h=a;if(x===u&&!isNaN(a))l===a&&(h=a+1),l>a&&(h=l+1),o.replaceRange(k.replace(r,u+h+L[4]+L[5]),{line:v,ch:0},{line:v,ch:k.length});else{if(x.length>u.length||x.lengthVt(n,"name",{value:t,configurable:!0});const At=document.querySelector("link[rel=assets]"),zt=`${At instanceof HTMLLinkElement&&At.href||"/"}static/javascripts/codemirror%CONTRIB/mode/%N/%N.js?v=1`,Ne={};function qt(n,t){let e=t;return()=>{--e==0&&n()}}me(qt,"splitCallback");function Fe(n,t){const e=q.modes[n].dependencies;if(!e)return t();const r=[];for(let c=0;c{Fe(n,()=>{for(let y=0;y{n.setOption("mode",n.getOption("mode"))})}me(Ot,"autoLoadMode"),q.autoLoadMode=Ot,q.requireMode=Pt,q.defineMode("conflict",(n,t)=>{const e={startState:()=>({insideConflict:!1}),token:(r,p)=>{if(r.sol()){if(r.match(/^<<<<<<>>>>>>/))return p.insideConflict=!1,r.skipToEnd(),"conflict-marker line-background-conflict-background"}return p.insideConflict?(r.next(),"line-background-conflict-background"):(r.next(),null)},blankLine:r=>r.insideConflict?"line-background-conflict-background":null};if(t.baseMode){const r=q.getMode(n,t.baseMode);if(r.name!=="null")return q.overlayMode(r,e,!0);const p=q.findModeByMIME(t.baseMode);q.autoLoadMode(t.editor,p.mode)}return e}),q.defineMIME("application/x-conflict","conflict");var Xt=Object.defineProperty,Gt=(n,t)=>Xt(n,"name",{value:t,configurable:!0});async function Me(n){const t=n.getAttribute("data-language-detection-url");if(!t)return;const e=document.querySelector(".js-code-editor");if(!e)return;const r=btoa(encodeURIComponent(n.value)),p=new URL(t,window.location.origin),c=new URLSearchParams(p.search.slice(1));c.append("filename",r),p.search=c.toString();const s=await fetch(p.toString(),{headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/json"}});if(!s.ok){const y=new Error,b=s.statusText?` ${s.statusText}`:"";throw y.message=`HTTP ${s.status}${b}`,y}const o=await s.json();(await ae(e)).setMode(o.language)}Gt(Me,"onFilenameChange"),Ve(".js-detect-filename-language",n=>{const t=n;ze(t,Me),n.addEventListener("blur",()=>Xe(t,Me),{once:!0})});var Qt=Object.defineProperty,ce=(n,t)=>Qt(n,"name",{value:t,configurable:!0});const J=/Macintosh/.test(navigator.userAgent)?"Cmd":"Ctrl",Jt="_",Yt="**",Zt="`",en=Ye(ce(async function(){const t=new Request("/autocomplete/emojis_for_editor",{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}}),e=await fetch(t);if(e.status!==200)throw new Error(`emoji request failed with a ${e.status}`);const r=[],p=await e.json();for(const c of Object.keys(p)){const s={text:`${c}:`,render:o=>rt(st`:${c}: ${c}`,o),hint:(o,g,y)=>{if(p[c].length===2){const b=y.from||g.from,w={ch:b.ch-1,line:b.line};o.replaceRange(p[c][1],w,y.to||g.to,"complete")}else o.replaceRange(y.text,y.from||g.from,y.to||g.to,"complete")}};r.push(s)}return r},"getEmojis"));class Rt{constructor(t){if(this.hintIsOpen=!1,this.container=t,!this.container)return;this.textarea=this.container.querySelector(".js-code-textarea"),this.filename=this.textarea.getAttribute("data-filename")||"";const e=this.textarea.value,r=this.textarea.getAttribute("data-codemirror-mode");this.mergeMode=this.textarea.getAttribute("data-merge-mode")==="true";const p=this.textarea.clientHeight;this.textarea.style.display="none";const c={lineNumbers:!0,value:e,inputStyle:"contenteditable",theme:"github-light"};this.mergeMode&&(c.gutters=["CodeMirror-linenumbers","merge-gutter"]);const s=this.textarea.parentElement;this.editor=q(s,c);const o=this.textarea.getAttribute("data-hotkey-scope-id")||"code-editor";if(this.editor.getInputField().setAttribute("id",o),p!==0){const g=this.container.querySelector(".CodeMirror");g&&(g.style.height=`${p}px`)}this.setMode(r),this.setupKeyBindings(),this.setupFormBindings(),this.setupControlBindings(),this.setupScrollOnHashChange()}code(){return this.editor.getValue()}setCode(t){this.editor.setValue(t)}refresh(){this.editor.refresh()}focus(){this.editor.focus()}blur(){this.editor.getInputField().blur()}getDocument(){return this.editor.getDoc()}on(t,e){this.container.addEventListener(t,e)}off(t,e){this.container.removeEventListener(t,e)}setDocument(t){this.editor.swapDoc(t),!(t.modeOption&&typeof t.modeOption.name!="undefined")&&this.setMode(t.modeOption)}async loading(t){this.editor.setOption("readOnly",!0),await t(),window.onbeforeunload=null,this.editor.setOption("readOnly",!1)}setMode(t){let e=t;this.mergeMode&&(e={name:"conflict",baseMode:e,editor:this.editor}),e==="text/x-gfm"?this.editor.setOption("mode",{name:"gfm",gitHubSpice:!1}):this.editor.setOption("mode",e);const r=this.container.querySelector(".drag-and-drop");if(r){const p=!(e==="text/x-gfm"||e==="text/x-markdown");r.hidden=p,this.editor.setOption("dragDrop",p)}if(e&&!this.mergeMode){const p=q.findModeByMIME(e);q.autoLoadMode(this.editor,p.mode)}}setConfirmUnloadMessage(t){this.confirmUnload=function(){return t}}clearConfirmUnloadMessage(){this.confirmUnload=void 0,window.onbeforeunload=null}setupFormBindings(){const t=ce((e,r)=>{this.confirmUnload&&(window.onbeforeunload=this.confirmUnload),Ze(this.textarea,this.code()),this.isMarkdown(e)&&this.emojiComplete(e),le(this.container,"change",{editor:e,changes:r})},"changeHandler");if(this.editor.on("change",t),this.editor.on("swapDoc",t),this.confirmUnload){const e=this.textarea.closest("form");if(e==null)return;e.addEventListener("submit",()=>{window.onbeforeunload=null})}}setupControlBindings(){const t=this.container.querySelector(".js-code-indent-width"),e=this.container.querySelector(".js-code-wrap-mode"),r=this.container.querySelector(".js-code-indent-mode");this.editor.setOption("tabSize",parseInt(t.value)),this.editor.setOption("indentUnit",parseInt(t.value)),this.editor.setOption("lineWrapping",e.value==="on"),this.editor.setOption("indentWithTabs",r.value!=="space"),t.addEventListener("change",()=>{this.editor.setOption("tabSize",parseInt(t.value)),this.editor.setOption("indentUnit",parseInt(t.value))}),e.addEventListener("change",()=>{this.editor.setOption("lineWrapping",e!=null&&e.value==="on")}),r.addEventListener("change",()=>{this.editor.setOption("indentWithTabs",r.value!=="space")})}setupKeyBindings(){this.editor.addKeyMap({Enter:t=>{this.isMarkdown(t)?t.execCommand("newlineAndIndentContinueMarkdownList"):t.execCommand("newlineAndIndent")},Tab:t=>{if(t.somethingSelected()){t.indentSelection("add");return}this.container.querySelector(".js-code-indent-mode").value!=="space"?t.replaceSelection(" ","end","+input"):t.execCommand("insertSoftTab")},"Shift-Tab":t=>{t.indentSelection("subtract")},"Cmd-/":"toggleComment","Ctrl-/":"toggleComment","Shift-Cmd-P":()=>{this.blur(),le(this.textarea,"codeEditor:preview")},[`${J}-I`]:t=>this.insertMdToken(t,Jt),[`${J}-B`]:t=>this.insertMdToken(t,Yt),[`${J}-E`]:t=>this.insertMdToken(t,Zt),[`${J}-K`]:t=>this.insertMdLink(t),[`Shift-${J}-.`]:t=>this.toggleMdList(t,">"),[`Shift-${J}-7`]:t=>this.toggleMdList(t,"ol"),[`Shift-${J}-8`]:t=>this.toggleMdList(t,"-")}),Qe()||delete q.keyMap.default["Alt-G"]}setupScrollOnHashChange(){Je(()=>{const t=Dt(window.location.hash);t.length>0&&(this.focus(),this.editor.setCursor({line:t[0]-1,ch:0},{scroll:!0}))})}isMarkdown(t){const e=t.getMode().name;return e==="gfm"||e==="markdown"}insertMdToken(t,e){if(!this.isMarkdown(t))return;const r=t.getSelection();if(r)t.replaceSelection(e+r+e);else{const p=t.getCursor();t.replaceRange(e.repeat(2),p),t.setCursor({line:p.line,ch:p.ch+e.length})}}toggleMdList(t,e){if(!this.isMarkdown(t))return;const r=t.getCursor("from"),p=t.getCursor("to"),c=t.getRange({line:r.line,ch:0},p),s=new RegExp(`^${e==="ol"?"\\d+\\.":e}\\s`);if(c){const o=c.split(` `),g=o.every(y=>s.test(y));for(let y=0;y{this.hintIsOpen=!0;const p=t.getCursor(),c=t.getTokenAt(p),s=p.ch;let o=p.ch;const g=p.line;let y=c.string;for(;o-- >-1;){const b=t.getTokenAt({ch:o,line:g}).string;if(b===":")return{list:r.filter(m=>m.text.indexOf(y)!==-1),from:q.Pos(g,o),to:q.Pos(g,s)};y=b+y}return{list:[],from:q.Pos(g,0),to:q.Pos(g,s)}},{completeSingle:!1})}catch{}}isFirstCharacterOnLine(t){return t.ch===1}isPreviousCharacterSpace(t,e){const r=this.previousCharacter(t,e);return/\s/.test(r)}isTokenColon(t,e){return t.getTokenAt(e).string===":"}previousCharacter(t,e){return t.getRange({line:e.line,ch:e.ch-2},{line:e.line,ch:e.ch-1})}colonShowsEmojiPicker(t,e){return this.isFirstCharacterOnLine(e)||this.isPreviousCharacterSpace(t,e)}}ce(Rt,"CodeEditor");function de(n){if(ee(n)||n.classList.contains("js-mobile-code-editor"))return;const t=new Rt(n);let e=n.getAttribute("data-github-confirm-unload")||"";(e==="yes"||e==="true")&&(e=""),e==="no"||e==="false"||t.setConfirmUnloadMessage(e),le(n,"codeEditor:ready",{editor:t})}ce(de,"loadEditor"),(async()=>{await Ge;for(const n of document.querySelectorAll(".js-code-editor"))de(n);G(".js-code-editor",{constructor:HTMLElement,add:de})})(),document.addEventListener("pjax:end",function(){for(const n of document.querySelectorAll(".js-code-editor"))de(n)});function Dt(n){let t,e;const r=n.match(/#?(?:L|-)(\d+)/gi);if(r){const p=[];for(t=0,e=r.length;ttn(n,"name",{value:t,configurable:!0});function Ie(n){return document.querySelector(".js-resolve-conflicts-form").elements.namedItem(n)}Y(Ie,"persistenceKeyFor");const Nt=new WeakMap;function re(n){const t=Ie(n);return Nt.get(t)}Y(re,"getFileData");function Ft(n,t){Nt.set(Ie(n),t)}Y(Ft,"setFileData");async function he(n){const t=document.querySelector(".js-code-editor");if(!(t instanceof HTMLElement))return;const e=await ae(t);function r(){const s=`files[${n.getAttribute("data-filename")||""}]`,o=re(s);if(o==null)throw new Error(`Expected data for ${s} to be loaded and was not`);$e(o)}Y(r,"onChange"),e.off("change",r),e.on("change",r);const p=t.closest(".js-conflict-resolver");p!=null&&(p.classList.add("loading"),e.loading(async()=>{const c=n.getAttribute("data-filename");if(!c)return;const s=`files[${c}]`,o=document.querySelector(".js-resolve-file-form");o.elements.namedItem("filename").value=s,o.querySelector(".js-filename").textContent=decodeURIComponent(c),o.classList.toggle("is-resolved",n.classList.contains("resolved"));for(const b of n.parentNode.children)b.classList.toggle("selected",b===n);let g=re(s);if(!g){const b=await fetch(n.href,{headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/json"}});if(!b.ok){const m=new Error,x=b.statusText?` ${b.statusText}`:"";throw m.message=`HTTP ${b.status}${x}`,m}const w=await b.json();g={document:q.Doc(w.conflicted_file.data,w.conflicted_file.codemirror_mime_type),headDocument:q.Doc(w.head.data,w.head.codemirror_mime_type),baseDocument:q.Doc(w.base.data,w.base.codemirror_mime_type),conflicts:[]},$e(g),Ft(s,g)}p.classList.remove("loading"),e.setDocument(g.document),document.querySelector(".js-code-editor .js-conflict-count").textContent=new Intl.NumberFormat("en-US").format(g.conflicts.length);const y=document.querySelector(".js-code-editor .js-conflict-label");y.textContent=y.getAttribute(g.conflicts.length===1?"data-singular-string":"data-plural-string"),pe(!0)}))}Y(he,"setupResolverFor");function $e(n){let t={};n.conflicts=[],n.document.eachLine(e=>{if(!e)return;const r=n.document;if(r.setGutterMarker(e,"merge-gutter",null),!t.start&&/^<<<<<<>>>>>>/.test(e.text)&&(t.end=e),t.start){let p=".js-line";t.start===e?p=".js-start":t.middle===e?p=".js-middle":t.end===e&&(p=".js-end");const c=document.querySelector(`.js-conflict-gutters ${p}`).cloneNode(!0);r.setGutterMarker(e,"merge-gutter",c)}t.end&&(n.conflicts.push(t),t={})})}Y($e,"findAndMarkConflicts");function pe(n){const e=document.querySelector(".js-resolve-file-form").elements.namedItem("filename").value,r=re(e);if(r==null)throw new Error(`Expected data for ${e} to be loaded and was not`);const p=r.document.getCursor().line,c=r.conflicts;let s=null;for(let o=n?0:c.length-1;n?o=0;n?o++:o--){const g=c[o].middle;if(g==null)continue;const y=r.document.getLineNumber(g);if(n&&y>p||!n&&y]{7}/m.test(e.code()),o=t.querySelector("button.js-mark-resolved");o.classList.toggle("disabled",s),o.classList.toggle("tooltipped",s);const g=s?o.getAttribute("data-disabled-label"):"";g&&o.setAttribute("aria-label",g)}),G(".js-conflict-list",function(n){const t=n.querySelector(".js-conflicted-file");t instanceof HTMLAnchorElement&&he(t);const e=document.querySelector(".new-discussion-timeline");e&&(e.classList.remove("px-3"),e.classList.add("p-0"))}),$("change",".js-conflict-resolution-choice-option",function(n){const t=n.target,e=t.closest(".js-resolve-conflicts-form"),r=e.querySelector(".js-resolve-conflicts-button"),p=e.querySelector(".js-quick-pull-new-branch-name");t.value==="direct"?(r.textContent=r.getAttribute("data-update-text"),r.removeAttribute("data-disable-invalid"),r.removeAttribute("disabled"),p.setAttribute("disabled","true")):(r.textContent=r.getAttribute("data-new-branch-text"),r.setAttribute("data-disable-invalid","true"),p.removeAttribute("disabled"),nt(e))})}}}); //# sourceMappingURL=editor-d259dcb1.js.map