dotfiles/.vim/pack/plugins/opt/vim-copilot/dist/agent.js

778 lines
2.3 MiB
JavaScript
Raw Normal View History

"use strict";var z7e=Object.create;var O3=Object.defineProperty;var W7e=Object.getOwnPropertyDescriptor;var K7e=Object.getOwnPropertyNames;var Y7e=Object.getPrototypeOf,X7e=Object.prototype.hasOwnProperty;var Q7e=(e,t,r)=>t in e?O3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var l=(e,t)=>O3(e,"name",{value:t,configurable:!0});var Vc=(e,t)=>()=>(e&&(t=e(e=0)),t);var w=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),oee=(e,t)=>{for(var r in t)O3(e,r,{get:t[r],enumerable:!0})},aee=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of K7e(t))!X7e.call(e,s)&&s!==r&&O3(e,s,{get:()=>t[s],enumerable:!(n=W7e(t,s))||n.enumerable});return e};var Sr=(e,t,r)=>(r=e!=null?z7e(Y7e(e)):{},aee(t||!e||!e.__esModule?O3(r,"default",{value:e,enumerable:!0}):r,e)),lee=e=>aee(O3({},"__esModule",{value:!0}),e);var fl=(e,t,r)=>(Q7e(e,typeof t!="symbol"?t+"":t,r),r),IO=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var zr=(e,t,r)=>(IO(e,t,"read from private field"),r?r.call(e):t.get(e)),ja=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Ya=(e,t,r,n)=>(IO(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var Tc=(e,t,r)=>(IO(e,t,"access private method"),r);var uee=w(AO=>{var cee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");AO.encode=function(e){if(0<=e&&e<cee.length)return cee[e];throw new TypeError("Must be between 0 and 63: "+e)};AO.decode=function(e){var t=65,r=90,n=97,s=122,o=48,a=57,c=43,u=47,f=26,d=52;return t<=e&&e<=r?e-t:n<=e&&e<=s?e-n+f:o<=e&&e<=a?e-o+d:e==c?62:e==u?63:-1}});var OO=w(PO=>{var fee=uee(),RO=5,dee=1<<RO,pee=dee-1,hee=dee;function J7e(e){return e<0?(-e<<1)+1:(e<<1)+0}l(J7e,"toVLQSigned");function Z7e(e){var t=(e&1)===1,r=e>>1;return t?-r:r}l(Z7e,"fromVLQSigned");PO.encode=l(function(t){var r="",n,s=J7e(t);do n=s&pee,s>>>=RO,s>0&&(n|=hee),r+=fee.encode(n);while(s>0);return r},"base64VLQ_encode");PO.decode=l(function(t,r,n){var s=t.length,o=0,a=0,c,u;do{if(r>=s)throw new Error("Expected more digits in base 64 VLQ value.");if(u=fee.decode(t.charCodeAt(r++)),u===-1)throw new Error("Invalid base64 digit: "+t.charAt(r-1));c=!!(u&hee),u&=pee,o=o+(u<<a),a+=RO}while(c);n.value=Z7e(o),n.rest=r},"base64VLQ_decode")});var D3=w(Ec=>{function eCe(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}l(eCe,"getArg");Ec.getArg=eCe;var mee=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,tCe=/^data:.+\,.+$/;function n8(e){var t=e.match(mee);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}l(n8,"urlParse");Ec.urlParse=n8;function k3(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}l(k3,"urlGenerate");Ec.urlGenerate=k3;function kO(e){var t=e,r=n8(e);if(r){if(!r.path)return e;t=r.path}for(var n=Ec.isAbsolute(t),s=t.split(/\/+/),o,a=0,c=s.length-1;c>=0;c--)o=s[c],o==="."?s.splice(c,1):o===".."?a++:a>0&&(o===""?(s.splice(c+1,a),a=0):(s.splice(c,2),a--));return t=s.join("/"),t===""&&(t=n?"/":"."),r?(r.path=t,k3(r)):t}l(kO,"normalize");Ec.normalize=kO;function gee(e,t){e===""&&(e="."),t===""&&(t=".");var r=n8(t),n=n8(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),k3(r);if(r||t.match(tCe))return t;if(n&&!n.host&&!n.path)return n.host=t,k3(n);var s=t.charAt(0)==="/"?t:kO(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=s,k3(n)):s}l(gee,"join");Ec.join=gee;Ec.isAbsolute=function(e){return e.charAt(0)==="/"||mee.test(e)};function rCe(e,t){e===""&&(e="."),e=e.replace(/\/$/,"");for(var r=0;t.indexOf(e+"/")!==0;){var n=e.lastIndexOf("/");if(n<0||(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/)))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}l(rCe,"relative");Ec.relative=rCe;var yee=function(){var e=Object.create(null);return!("__proto__"in e)}();function vee(e){return e}l(vee,"identity");function nCe(e){return xee(e)?"$"+e:e}l(nCe,"toSetString");Ec.toSetString=yee?vee
at `+Uee(t[c],o)),o.nextPosition=o.curPosition;return o.curPosition=o.nextPosition=null,s+a.reverse().join("")}l(OCe,"prepareStackTrace");function jee(e){var t=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack);if(t){var r=t[1],n=+t[2],s=+t[3],o=ag[r];if(!o&&Zd&&Zd.existsSync(r))try{o=Zd.readFileSync(r,"utf8")}catch{o=""}if(o){var a=o.split(/(?:\r\n|\r|\n)/)[n-1];if(a)return r+":"+n+`
`+a+`
`+new Array(s).join(" ")+"^"}}return null}l(jee,"getErrorSource");function kCe(e){var t=jee(e),r=ICe();r&&r._handle&&r._handle.setBlocking&&r._handle.setBlocking(!0),t&&(console.error(),console.error(t)),console.error(e.stack),ACe(1)}l(kCe,"printErrorAndExit");function NCe(){var e=process.emit;process.emit=function(t){if(t==="uncaughtException"){var r=arguments[1]&&arguments[1].stack,n=this.listeners(t).length>0;if(r&&!n)return kCe(arguments[1])}return e.apply(this,arguments)}}l(NCe,"shimEmitUncaughtException");var DCe=gh.slice(0),LCe=yh.slice(0);lg.wrapCallSite=Uee;lg.getErrorSource=jee;lg.mapSourcePosition=YO;lg.retrieveSourceMap=KO;lg.install=function(e){if(e=e||{},e.environment&&(o8=e.environment,["node","browser","auto"].indexOf(o8)===-1))throw new Error("environment "+o8+" was unknown. Available options are {auto, browser, node}");if(e.retrieveFile&&(e.overrideRetrieveFile&&(gh.length=0),gh.unshift(e.retrieveFile)),e.retrieveSourceMap&&(e.overrideRetrieveSourceMap&&(yh.length=0),yh.unshift(e.retrieveSourceMap)),e.hookRequire&&!zO()){var t=Lee(GO,"module"),r=t.prototype._compile;r.__sourceMapSupport||(t.prototype._compile=function(o,a){return ag[a]=o,a8[a]=void 0,r.call(this,o,a)},t.prototype._compile.__sourceMapSupport=!0)}if($O||($O="emptyCacheBetweenOperations"in e?e.emptyCacheBetweenOperations:!1),Mee||(Mee=!0,Error.prepareStackTrace=OCe),!Fee){var n="handleUncaughtExceptions"in e?e.handleUncaughtExceptions:!0;try{var s=Lee(GO,"worker_threads");s.isMainThread===!1&&(n=!1)}catch{}n&&SCe()&&(Fee=!0,NCe())}};lg.resetRetrieveHandlers=function(){gh.length=0,yh.length=0,gh=DCe.slice(0),yh=LCe.slice(0),KO=k_(yh),WO=k_(gh)}});var $ee=w(()=>{Hee().install()});var La=w((exports,module)=>{"use strict";var fo=Object.create,Le=Object.defineProperty,go=Object.getOwnPropertyDescriptor,ho=Object.getOwnPropertyNames,bo=Object.getPrototypeOf,yo=Object.prototype.hasOwnProperty,i=l((e,t)=>Le(e,"name",{value:t,configurable:!0}),"i"),N=l((e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),"N"),wo=l((e,t)=>{for(var r in t)Le(e,r,{get:t[r],enumerable:!0})},"wo"),Nn=l((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ho(t))!yo.call(e,s)&&s!==r&&Le(e,s,{get:()=>t[s],enumerable:!(n=go(t,s))||n.enumerable});return e},"Nn"),Ft=l((e,t,r)=>(r=e!=null?fo(bo(e)):{},Nn(t||!e||!e.__esModule?Le(r,"default",{value:e,enumerable:!0}):r,e)),"Ft"),vo=l(e=>Nn(Le({},"__esModule",{value:!0}),e),"vo"),fr=N(e=>{var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");e.encode=function(r){if(0<=r&&r<t.length)return t[r];throw new TypeError("Must be between 0 and 63: "+r)},e.decode=function(r){var n=65,s=90,o=97,a=122,c=48,u=57,f=43,d=47,p=26,h=52;return n<=r&&r<=s?r-n:o<=r&&r<=a?r-o+p:c<=r&&r<=u?r-c+h:r==f?62:r==d?63:-1}}),nn=N(e=>{var t=fr(),r=5,n=1<<r,s=n-1,o=n;function a(u){return u<0?(-u<<1)+1:(u<<1)+0}l(a,"bs"),i(a,"toVLQSigned");function c(u){var f=(u&1)===1,d=u>>1;return f?-d:d}l(c,"ys"),i(c,"fromVLQSigned"),e.encode=i(function(u){var f="",d,p=a(u);do d=p&s,p>>>=r,p>0&&(d|=o),f+=t.encode(d);while(p>0);return f},"base64VLQ_encode"),e.decode=i(function(u,f,d){var p=u.length,h=0,m=0,g,y;do{if(f>=p)throw new Error("Expected more digits in base 64 VLQ value.");if(y=t.decode(u.charCodeAt(f++)),y===-1)throw new Error("Invalid base64 digit: "+u.charAt(f-1));g=!!(y&o),y&=s,h=h+(y<<m),m+=r}while(g);d.value=c(h),d.rest=f},"base64VLQ_decode")}),we=N(e=>{function t(E,S,I){if(S in E)return E[S];if(arguments.length===3)return I;throw new Error('"'+S+'" is a required argument.')}l(t,"ws"),i(t,"getArg"),e.getArg=t;var r=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,n=/^data:.+\,.+$/;function s(E){var S=E.match(r);return S?{scheme:S[1],auth:S[2],host:S[3],port:S[4],path:S[5]}:null}l(s,"Ve"),i(s,"urlParse"),e.urlParse=s;function o(E){var S="";return E.scheme&&(S+=E.scheme+":"),S+="//",E.auth&&(S+=E.auth+"@"),E.host&&(S+=E.host),E.port&&(S+=":"+E.port),E.path&&(S+=E.path),S}l(o,"be"),i(o,"urlGenerate"),e.urlGenerate=o;function a(E){var S=E,I=s(E);if(I){if(!I.path)return E;S=I.path}for(var H=e.isAbsol
at `+Z(ae[se],Tt)),Tt.nextPosition=Tt.curPosition;return Tt.curPosition=Tt.nextPosition=null,Pr+Ar.reverse().join("")}l(Te,"Qs"),i(Te,"prepareStackTrace");function vt(ie){var ae=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(ie.stack);if(ae){var gr=ae[1],hr=+ae[2],Pr=+ae[3],Tt=p[gr];if(!Tt&&s&&s.existsSync(gr))try{Tt=s.readFileSync(gr,"utf8")}catch{Tt=""}if(Tt){var Ar=Tt.split(/(?:\r\n|\r|\n)/)[hr-1];if(Ar)return gr+":"+hr+`
`+Ar+`
`+new Array(Pr).join(" ")+"^"}}return null}l(vt,"Zr"),i(vt,"getErrorSource");function Ze(ie){var ae=vt(ie),gr=b();gr&&gr._handle&&gr._handle.setBlocking&&gr._handle.setBlocking(!0),ae&&(console.error(),console.error(ae)),console.error(ie.stack),E(1)}l(Ze,"Xs"),i(Ze,"printErrorAndExit");function At(){var ie=process.emit;process.emit=function(ae){if(ae==="uncaughtException"){var gr=arguments[1]&&arguments[1].stack,hr=this.listeners(ae).length>0;if(gr&&!hr)return Ze(arguments[1])}return ie.apply(this,arguments)}}l(At,"Ys"),i(At,"shimEmitUncaughtException");var Ie=g.slice(0),Ve=y.slice(0);e.wrapCallSite=Z,e.getErrorSource=vt,e.mapSourcePosition=Se,e.retrieveSourceMap=be,e.install=function(ie){if(ie=ie||{},ie.environment&&(d=ie.environment,["node","browser","auto"].indexOf(d)===-1))throw new Error("environment "+d+" was unknown. Available options are {auto, browser, node}");if(ie.retrieveFile&&(ie.overrideRetrieveFile&&(g.length=0),g.unshift(ie.retrieveFile)),ie.retrieveSourceMap&&(ie.overrideRetrieveSourceMap&&(y.length=0),y.unshift(ie.retrieveSourceMap)),ie.hookRequire&&!v()){var ae=a(t,"module"),gr=ae.prototype._compile;gr.__sourceMapSupport||(ae.prototype._compile=function(Tt,Ar){return p[Ar]=Tt,h[Ar]=void 0,gr.call(this,Tt,Ar)},ae.prototype._compile.__sourceMapSupport=!0)}if(f||(f="emptyCacheBetweenOperations"in ie?ie.emptyCacheBetweenOperations:!1),c||(c=!0,Error.prepareStackTrace=Te),!u){var hr="handleUncaughtExceptions"in ie?ie.handleUncaughtExceptions:!0;try{var Pr=a(t,"worker_threads");Pr.isMainThread===!1&&(hr=!1)}catch{}hr&&_()&&(u=!0,At())}},e.resetRetrieveHandlers=function(){g.length=0,y.length=0,g=Ie.slice(0),y=Ve.slice(0),be=S(y),I=S(g)}}),Gr=N(()=>{$r().install()}),to=N((exports,module)=>{var Module=Module!==void 0?Module:{},TreeSitter=function(){var initPromise,document=typeof window=="object"?{currentScript:window.document.currentScript}:null;let _Parser=class _Parser{constructor(){this.initialize()}initialize(){throw new Error("cannot construct a Parser before calling `init()`")}static init(moduleOptions){return initPromise||(Module=Object.assign({},Module,moduleOptions),initPromise=new Promise(resolveInitPromise=>{var moduleOverrides=Object.assign({},Module),arguments_=[],thisProgram="./this.program",quit_=i((a,c)=>{throw c},"quit_"),ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof importScripts=="function",ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",scriptDirectory="",read_,readAsync,readBinary,setWindowTitle;function locateFile(a){return Module.locateFile?Module.locateFile(a,scriptDirectory):scriptDirectory+a}l(locateFile,"locateFile"),i(locateFile,"locateFile");function logExceptionOnExit(a){a instanceof ExitStatus||err("exiting due to exception: "+a)}if(l(logExceptionOnExit,"logExceptionOnExit"),i(logExceptionOnExit,"logExceptionOnExit"),ENVIRONMENT_IS_NODE){var fs=require("fs"),nodePath=require("path");scriptDirectory=ENVIRONMENT_IS_WORKER?nodePath.dirname(scriptDirectory)+"/":__dirname+"/",read_=i((a,c)=>(a=isFileURI(a)?new URL(a):nodePath.normalize(a),fs.readFileSync(a,c?void 0:"utf8")),"read_"),readBinary=i(a=>{var c=read_(a,!0);return c.buffer||(c=new Uint8Array(c)),c},"readBinary"),readAsync=i((a,c,u)=>{a=isFileURI(a)?new URL(a):nodePath.normalize(a),fs.readFile(a,function(f,d){f?u(f):c(d.buffer)})},"readAsync"),process.argv.length>1&&(thisProgram=process.argv[1].replace(/\\/g,"/")),arguments_=process.argv.slice(2),typeof module<"u"&&(module.exports=Module),quit_=i((a,c)=>{if(keepRuntimeAlive())throw process.exitCode=a,c;logExceptionOnExit(c),process.exit(a)},"quit_"),Module.inspect=function(){return"[Emscripten Module object]"}}else(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&(ENVIRONMENT_IS_WORKER?scriptDirectory=self.location.href:document!==void 0&&document.currentScript&&(scriptDirectory=document.currentScript.src),scriptDirectory=scriptDirectory.indexOf("blob:")!==0?scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1):"",read_=i(a=>{var c=new XMLHttpRequest;retur
`)[0],K,be=H.match(QUERY_WORD_REGEX)[0];switch(S){case 2:K=new RangeError(`Bad node name '${be}'`);break;case 3:K=new RangeError(`Bad field name '${be}'`);break;case 4:K=new RangeError(`Bad capture name @${be}`);break;case 5:K=new TypeError(`Bad pattern structure at offset ${I}: '${H}'...`),be="";break;default:K=new SyntaxError(`Bad syntax at offset ${I}: '${H}'...`),be=""}throw K.index=I,K.length=be.length,C._free(f),K}let p=C._ts_query_string_count(d),h=C._ts_query_capture_count(d),m=C._ts_query_pattern_count(d),g=new Array(h),y=new Array(p);for(let S=0;S<h;S++){let I=C._ts_query_capture_name_for_id(d,S,TRANSFER_BUFFER),H=getValue(TRANSFER_BUFFER,"i32");g[S]=UTF8ToString(I,H)}for(let S=0;S<p;S++){let I=C._ts_query_string_value_for_id(d,S,TRANSFER_BUFFER),H=getValue(TRANSFER_BUFFER,"i32");y[S]=UTF8ToString(I,H)}let v=new Array(m),_=new Array(m),x=new Array(m),b=new Array(m),E=new Array(m);for(let S=0;S<m;S++){let I=C._ts_query_predicates_for_pattern(d,S,TRANSFER_BUFFER),H=getValue(TRANSFER_BUFFER,"i32");b[S]=[],E[S]=[];let K=[],be=I;for(let Se=0;Se<H;Se++){let ne=getValue(be,"i32");be+=SIZE_OF_INT;let ye=getValue(be,"i32");if(be+=SIZE_OF_INT,ne===PREDICATE_STEP_TYPE_CAPTURE)K.push({type:"capture",name:g[ye]});else if(ne===PREDICATE_STEP_TYPE_STRING)K.push({type:"string",value:y[ye]});else if(K.length>0){if(K[0].type!=="string")throw new Error("Predicates must begin with a literal value");let J=K[0].value,Z=!0;switch(J){case"not-eq?":Z=!1;case"eq?":if(K.length!==3)throw new Error("Wrong number of arguments to `#eq?` predicate. Expected 2, got "+(K.length-1));if(K[1].type!=="capture")throw new Error(`First argument of \`#eq?\` predicate must be a capture. Got "${K[1].value}"`);if(K[2].type==="capture"){let At=K[1].name,Ie=K[2].name;E[S].push(function(Ve){let ie,ae;for(let gr of Ve)gr.name===At&&(ie=gr.node),gr.name===Ie&&(ae=gr.node);return ie===void 0||ae===void 0||ie.text===ae.text===Z})}else{let At=K[1].name,Ie=K[2].value;E[S].push(function(Ve){for(let ie of Ve)if(ie.name===At)return ie.node.text===Ie===Z;return!0})}break;case"not-match?":Z=!1;case"match?":if(K.length!==3)throw new Error(`Wrong number of arguments to \`#match?\` predicate. Expected 2, got ${K.length-1}.`);if(K[1].type!=="capture")throw new Error(`First argument of \`#match?\` predicate must be a capture. Got "${K[1].value}".`);if(K[2].type!=="string")throw new Error(`Second argument of \`#match?\` predicate must be a string. Got @${K[2].value}.`);let Te=K[1].name,vt=new RegExp(K[2].value);E[S].push(function(At){for(let Ie of At)if(Ie.name===Te)return vt.test(Ie.node.text)===Z;return!0});break;case"set!":if(K.length<2||K.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${K.length-1}.`);if(K.some(At=>At.type!=="string"))throw new Error('Arguments to `#set!` predicate must be a strings.".');v[S]||(v[S]={}),v[S][K[1].value]=K[2]?K[2].value:null;break;case"is?":case"is-not?":if(K.length<2||K.length>3)throw new Error(`Wrong number of arguments to \`#${J}\` predicate. Expected 1 or 2. Got ${K.length-1}.`);if(K.some(At=>At.type!=="string"))throw new Error(`Arguments to \`#${J}\` predicate must be a strings.".`);let Ze=J==="is?"?_:x;Ze[S]||(Ze[S]={}),Ze[S][K[1].value]=K[2]?K[2].value:null;break;default:b[S].push({operator:J,operands:K.slice(1)})}K.length=0}}Object.freeze(v[S]),Object.freeze(_[S]),Object.freeze(x[S])}return C._free(f),new Query(INTERNAL,d,g,E,b,Object.freeze(v),Object.freeze(_),Object.freeze(x))}static load(c){let u;if(c instanceof Uint8Array)u=Promise.resolve(c);else{let d=c;if(typeof process<"u"&&process.versions&&process.versions.node){let p=require("fs");u=Promise.resolve(p.readFileSync(d))}else u=fetch(d).then(p=>p.arrayBuffer().then(h=>{if(p.ok)return new Uint8Array(h);{let m=new TextDecoder("utf-8").decode(h);throw new Error(`Language.load failed with status ${p.status}.
${m}`)}}))}let f=typeof loadSideModule=="function"?loadSideModule:loadWebAssemblyModule;return u.then(d=>f(d,{loadAsync:!0})).then(d=>{let p=Object.keys(d),h=p.find(g=>LANGUAGE_FUNCTION_REGEX.test(g)&&!g.includes("external_scanner_"));h||console.log(`Couldn't find language function in WASM file. Symbols:
${JSON.stringify(p,null,2)}`);let m=d[h]();return new s(INTERNAL,m)})}};l(s,"Language"),i(s,"Language");let Language=s,o=class o{constructor(c,u,f,d,p,h,m,g){assertInternal(c),this[0]=u,this.captureNames=f,this.textPredicates=d,this.predicates=p,this.setProperties=h,this.assertedProperties=m,this.refutedProperties=g,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(c,u,f,d){u||(u=ZERO_POINT),f||(f=ZERO_POINT),d||(d={});let p=d.matchLimit;if(p===void 0)p=0;else if(typeof p!="number")throw new Error("Arguments must be numbers");marshalNode(c),C._ts_query_matches_wasm(this[0],c.tree[0],u.row,u.column,f.row,f.column,p);let h=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),g=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),y=new Array(h);this.exceededMatchLimit=!!g;let v=0,_=m;for(let x=0;x<h;x++){let b=getValue(_,"i32");_+=SIZE_OF_INT;let E=getValue(_,"i32");_+=SIZE_OF_INT;let S=new Array(E);if(_=unmarshalCaptures(this,c.tree,_,S),this.textPredicates[b].every(I=>I(S))){y[v++]={pattern:b,captures:S};let I=this.setProperties[b];I&&(y[x].setProperties=I);let H=this.assertedProperties[b];H&&(y[x].assertedProperties=H);let K=this.refutedProperties[b];K&&(y[x].refutedProperties=K)}}return y.length=v,C._free(m),y}captures(c,u,f,d){u||(u=ZERO_POINT),f||(f=ZERO_POINT),d||(d={});let p=d.matchLimit;if(p===void 0)p=0;else if(typeof p!="number")throw new Error("Arguments must be numbers");marshalNode(c),C._ts_query_captures_wasm(this[0],c.tree[0],u.row,u.column,f.row,f.column,p);let h=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),g=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),y=[];this.exceededMatchLimit=!!g;let v=[],_=m;for(let x=0;x<h;x++){let b=getValue(_,"i32");_+=SIZE_OF_INT;let E=getValue(_,"i32");_+=SIZE_OF_INT;let S=getValue(_,"i32");if(_+=SIZE_OF_INT,v.length=E,_=unmarshalCaptures(this,c.tree,_,v),this.textPredicates[b].every(I=>I(v))){let I=v[S],H=this.setProperties[b];H&&(I.setProperties=H);let K=this.assertedProperties[b];K&&(I.assertedProperties=K);let be=this.refutedProperties[b];be&&(I.refutedProperties=be),y.push(I)}}return C._free(m),y}predicatesForPattern(c){return this.predicates[c]}didExceedMatchLimit(){return this.exceededMatchLimit}};l(o,"Query"),i(o,"Query");let Query=o;function getText(a,c,u){let f=u-c,d=a.textCallback(c,null,u);for(c+=d.length;c<u;){let p=a.textCallback(c,null,u);if(!(p&&p.length>0))break;c+=p.length,d+=p}return c>u&&(d=d.slice(0,f)),d}l(getText,"getText"),i(getText,"getText");function unmarshalCaptures(a,c,u,f){for(let d=0,p=f.length;d<p;d++){let h=getValue(u,"i32"),m=unmarshalNode(c,u+=SIZE_OF_INT);u+=SIZE_OF_NODE,f[d]={name:a.captureNames[h],node:m}}return u}l(unmarshalCaptures,"unmarshalCaptures"),i(unmarshalCaptures,"unmarshalCaptures");function assertInternal(a){if(a!==INTERNAL)throw new Error("Illegal constructor")}l(assertInternal,"assertInternal"),i(assertInternal,"assertInternal");function isPoint(a){return a&&typeof a.row=="number"&&typeof a.column=="number"}l(isPoint,"isPoint"),i(isPoint,"isPoint");function marshalNode(a){let c=TRANSFER_BUFFER;setValue(c,a.id,"i32"),c+=SIZE_OF_INT,setValue(c,a.startIndex,"i32"),c+=SIZE_OF_INT,setValue(c,a.startPosition.row,"i32"),c+=SIZE_OF_INT,setValue(c,a.startPosition.column,"i32"),c+=SIZE_OF_INT,setValue(c,a[0],"i32")}l(marshalNode,"marshalNode"),i(marshalNode,"marshalNode");function unmarshalNode(a,c=TRANSFER_BUFFER){let u=getValue(c,"i32");if(u===0)return null;let f=getValue(c+=SIZE_OF_INT,"i32"),d=getValue(c+=SIZE_OF_INT,"i32"),p=getValue(c+=SIZE_OF_INT,"i32"),h=getValue(c+=SIZE_OF_INT,"i32"),m=new Node(INTERNAL,a);return m.id=u,m.startIndex=f,m.startPosition={row:d,column:p},m[0]=h,m}l(unmarshalNode,"unmarshalNode"),i(unmarshalNode,"unmarshalNode");function marshalTreeCursor(a,c=TRANSFER_BUFFER){setValue(c+0*SIZE_OF_INT,a[0],"i32"),setValue(c+1*SIZE_OF_INT,a[1],"i32"),setValue(c+2*SIZE_OF_INT,a[2],"i32")}l(marshalTreeCursor,"marshalTreeCursor"),i(marshalTreeCursor,"marshalTreeCursor");function unmarshalTreeCursor(a){a[0]=getValue(TRANSFER_BUFFER+0*SIZE
`).slice(1).filter(c=>c.trim().length>0);this.bpe_ranks=Mo(a,Je(0,a.length)),To(this.byte_encoder),this.byte_encoder.forEach((c,u,f)=>{this.byte_decoder.set(c,u)})}byteEncodeStr(t){return this.encodeStr(t).map(r=>this.byte_encoder.get(r))}mutatingConcat(t,r){for(let n=0;n<r.length;n++)t.push(r[n]);return t}bpe(t){if(this.cache.has(t))return this.cache.get(t);let r=this.byteEncodeStr(t),n=Pn(r);if(!n)return r.map(o=>this.encoder.get(o));for(;;){let o=new Map;n.forEach(h=>{let m=h.join(" "),g=this.bpe_ranks.get(m);o.set(g===void 0||isNaN(g)?1e11:g,h)});let a=Array.from(o.keys()).map(h=>Number(h)),c=o.get(Math.min(...a));if(!c||!this.bpe_ranks.has(c.join(" ")))break;let u=c[0],f=c[1],d=[],p=0;for(;p<r.length;){let h=r.indexOf(u,p);if(h===-1){this.mutatingConcat(d,r.slice(p));break}this.mutatingConcat(d,r.slice(p,h)),p=h,r[p]===u&&p<r.length-1&&r[p+1]===f?(d.push(u+f),p=p+2):(d.push(r[p]),p=p+1)}if(r=d,r.length===1)break;n=Pn(r)}let s=r.map(o=>this.encoder.get(o));return this.cache.set(t,s),s}tokenize(t){let r=[];for(let[n]of t.matchAll(this.pat)){let s=this.bpe(n);this.mutatingConcat(r,s)}return r}tokenLength(t){return this.tokenize(t).length}takeLastTokens(t,r){if(r<=0)return"";let n=4,s=1,o=Math.min(t.length,r*n),a=t.slice(-o),c=this.tokenize(a);for(;c.length<r+2&&o<t.length;)o=Math.min(t.length,o+r*s),a=t.slice(-o),c=this.tokenize(a);return c.length<r?t:(c=c.slice(-r),this.detokenize(c))}takeFirstTokens(t,r){if(r<=0)return{text:"",tokens:[]};let n=4,s=1,o=Math.min(t.length,r*n),a=t.slice(0,o),c=this.tokenize(a);for(;c.length<r+2&&o<t.length;)o=Math.min(t.length,o+r*s),a=t.slice(0,o),c=this.tokenize(a);return c.length<r?{text:t,tokens:c}:(c=c.slice(0,r),{text:this.detokenize(c),tokens:c})}takeLastLinesTokens(t,r){let n=this.takeLastTokens(t,r);if(n.length===t.length||t[t.length-n.length-1]===`
`)return n;let s=n.indexOf(`
`);return n.substring(s+1)}detokenize(t){let r=t.map(n=>this.decoder.get(n)).join("");return r=kn(r.split("").map(n=>this.byte_decoder.get(n))),r}tokenizeStrings(t){return this.tokenize(t).map(r=>kn(this.decoder.get(r).split("").map(n=>this.byte_decoder.get(n))))}},l(F3,"Dt"),i(F3,"BPETokenizer"),F3),B3,Bt=(B3=class{constructor(){this.hash=t=>{let r=0;for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);r=(r<<5)-r+s,r&=r&65535}return r}}tokenize(t){return this.tokenizeStrings(t).map(this.hash)}detokenize(t){return t.map(r=>r.toString()).join(" ")}tokenizeStrings(t){return t.split(/\b/)}tokenLength(t){return this.tokenizeStrings(t).length}takeLastTokens(t,r){return this.tokenizeStrings(t).slice(-r).join("")}takeFirstTokens(t,r){let n=this.tokenizeStrings(t).slice(0,r);return{text:n.join(""),tokens:n.map(this.hash)}}takeLastLinesTokens(t,r){let n=this.takeLastTokens(t,r);if(n.length===t.length||t[t.length-n.length-1]===`
`)return n;let s=n.indexOf(`
`);return n.substring(s+1)}},l(B3,"Bt"),i(B3,"MockTokenizer"),B3);function Ye(e,t,r){return{type:"virtual",indentation:e,subs:t,label:r}}l(Ye,"Ye");i(Ye,"virtualNode");function Wt(e,t,r,n,s){if(r==="")throw new Error("Cannot create a line node with an empty source line");return{type:"line",indentation:e,lineNumber:t,sourceLine:r,subs:n,label:s}}l(Wt,"Wt");i(Wt,"lineNode");function et(e){return{type:"blank",lineNumber:e,subs:[]}}l(et,"et");i(et,"blankNode");function Ne(e){return{type:"top",indentation:-1,subs:e!=null?e:[]}}l(Ne,"Ne");i(Ne,"topNode");function M(e){return e.type==="blank"}l(M,"M");i(M,"isBlank");function B(e){return e.type==="line"}l(B,"B");i(B,"isLine");function P(e){return e.type==="virtual"}l(P,"P");i(P,"isVirtual");function Q(e){return e.type==="top"}l(Q,"Q");i(Q,"isTop");function Io(e,t){function r(n){if(!P(n)&&!Q(n)&&n.lineNumber===t)return n.subs=[],!0;for(let s=0;s<n.subs.length;s++)if(r(n.subs[s]))return n.subs=n.subs.slice(0,s+1),!0;return!1}l(r,"n"),i(r,"cut"),r(e)}l(Io,"Io");i(Io,"cutTreeAfterLine");function xo(e){return JSON.parse(JSON.stringify(e))}l(xo,"xo");i(xo,"duplicateTree");function An(e){return T(e,t=>{t.label=void 0},"bottomUp"),e}l(An,"An");i(An,"clearLabels");function Ut(e,t){return T(e,r=>{r.label=r.label?t(r.label)?void 0:r.label:void 0},"bottomUp"),e}l(Ut,"Ut");i(Ut,"clearLabelsIf");function U(e,t){switch(e.type){case"line":case"virtual":let r=e.subs.map(n=>U(n,t));return{...e,subs:r,label:e.label?t(e.label):void 0};case"blank":return{...e,label:e.label?t(e.label):void 0};case"top":return{...e,subs:e.subs.map(n=>U(n,t)),label:e.label?t(e.label):void 0}}}l(U,"U");i(U,"mapLabels");function Lo(e){let t=0;function r(n){!P(n)&&!Q(n)&&(n.lineNumber=t,t++)}l(r,"n"),i(r,"visitor"),T(e,r,"topDown")}l(Lo,"Lo");i(Lo,"resetLineNumbers");function T(e,t,r){function n(s){r==="topDown"&&t(s),s.subs.forEach(o=>{n(o)}),r==="bottomUp"&&t(s)}l(n,"r"),i(n,"_visit"),n(e)}l(T,"T");i(T,"visitTree");function No(e,t,r){function n(s){if(r==="topDown"&&!t(s))return!1;let o=!0;return s.subs.forEach(a=>{o=o&&n(a)}),r==="bottomUp"&&(o=o&&t(s)),o}l(n,"r"),i(n,"_visit"),n(e)}l(No,"No");i(No,"visitTreeConditionally");function ke(e,t,r,n){let s=t;function o(a){s=r(a,s)}return l(o,"s"),i(o,"visitor"),T(e,o,n),s}l(ke,"ke");i(ke,"foldTree");function Pe(e,t,r){let n=i(o=>{if(r!==void 0&&r(o))return o;{let a=o.subs.map(n).filter(c=>c!==void 0);return o.subs=a,t(o)}},"rebuild"),s=n(e);return s!==void 0?s:Ne()}l(Pe,"Pe");i(Pe,"rebuildTree");function Fn(e){let t=e.split(`
`),r=t.map(f=>f.match(/^\s*/)[0].length),n=t.map(f=>f.trimLeft());function s(f){let[d,p]=o(f+1,r[f]);return[Wt(r[f],f,n[f],d),p]}l(s,"o"),i(s,"parseNode");function o(f,d){let p,h=[],m=f,g;for(;m<n.length&&(n[m]===""||r[m]>d);)if(n[m]==="")g===void 0&&(g=m),m+=1;else{if(g!==void 0){for(let y=g;y<m;y++)h.push(et(y));g=void 0}[p,m]=s(m),h.push(p)}return g!==void 0&&(m=g),[h,m]}l(o,"s"),i(o,"parseSubs");let[a,c]=o(0,-1),u=c;for(;u<n.length&&n[u]==="";)a.push(et(u)),u+=1;if(u<n.length)throw new Error(`Parsing did not go to end of file. Ended at ${u} out of ${n.length}`);return Ne(a)}l(Fn,"Fn");i(Fn,"parseRaw");function _e(e,t){function r(n){if(B(n)){let s=t.find(o=>o.matches(n.sourceLine));s&&(n.label=s.label)}}l(r,"n"),i(r,"visitor"),T(e,r,"bottomUp")}l(_e,"_e");i(_e,"labelLines");function Ce(e){function t(r){if(P(r)&&r.label===void 0){let n=r.subs.filter(s=>!M(s));n.length===1&&(r.label=n[0].label)}}l(t,"e"),i(t,"visitor"),T(e,t,"bottomUp")}l(Ce,"Ce");i(Ce,"labelVirtualInherited");function me(e){return Object.keys(e).map(t=>{let r;return e[t].test?r=i(n=>e[t].test(n),"matches"):r=e[t],{matches:r,label:t}})}l(me,"me");i(me,"buildLabelRules");function tt(e){let t=Pe(e,i(function(r){if(r.subs.length===0||r.subs.findIndex(o=>o.label==="closer"||o.label==="opener")===-1)return r;let n=[],s;for(let o=0;o<r.subs.length;o++){let a=r.subs[o],c=r.subs[o-1];if(a.label==="opener"&&c!==void 0&&B(c))c.subs.push(a),a.subs.forEach(u=>c.subs.push(u)),a.subs=[];else if(a.label==="closer"&&s!==void 0&&(B(a)||P(a))&&a.indentation>=s.indentation){let u=n.length-1;for(;u>0&&M(n[u]);)u-=1;if(s.subs.push(...n.splice(u+1)),a.subs.length>0){let f=s.subs.findIndex(m=>m.label!=="newVirtual"),d=s.subs.slice(0,f),p=s.subs.slice(f),h=p.length>0?[Ye(a.indentation,p,"newVirtual")]:[];s.subs=[...d,...h,a]}else s.subs.push(a)}else n.push(a),M(a)||(s=a)}return r.subs=n,r},"rebuilder"));return Ut(e,r=>r==="newVirtual"),t}l(tt,"tt");i(tt,"combineClosersAndOpeners");function zt(e,t=M,r){return Pe(e,i(function(n){if(n.subs.length<=1)return n;let s=[],o=[],a,c=!1;function u(f=!1){if(a!==void 0&&(s.length>0||!f)){let d=Ye(a,o,r);s.push(d)}else o.forEach(d=>s.push(d))}l(u,"c"),i(u,"flushBlockIntoNewSubs");for(let f=0;f<n.subs.length;f++){let d=n.subs[f],p=t(d);!p&&c&&(u(),o=[]),c=p,o.push(d),M(d)||(a=a!=null?a:d.indentation)}return u(!0),n.subs=s,n},"rebuilder"))}l(zt,"zt");i(zt,"groupBlocks");function z(e){return Pe(e,i(function(t){return P(t)&&t.label===void 0&&t.subs.length<=1?t.subs.length===0?void 0:t.subs[0]:(t.subs.length===1&&P(t.subs[0])&&t.subs[0].label===void 0&&(t.subs=t.subs[0].subs),t)},"rebuilder"))}l(z,"z");i(z,"flattenVirtual");var ko={opener:/^[\[({]/,closer:/^[\])}]/},Po=me(ko),Rn={};function nt(e,t){Rn[e]=t}l(nt,"nt");i(nt,"registerLanguageSpecificParser");function X(e,t){let r=Fn(e),n=Rn[t!=null?t:""];return n?n(r):(_e(r,Po),tt(r))}l(X,"X");i(X,"parseTree");var Co={package:/^package /,import:/^import /,class:/\bclass /,interface:/\binterface /,javadoc:/^\/\*\*/,comment_multi:/^\/\*[^*]/,comment_single:/^\/\//,annotation:/^@/,opener:/^[\[({]/,closer:/^[\])}]/},Ao=me(Co);function On(e){let t=e;return _e(t,Ao),t=tt(t),t=z(t),Ce(t),T(t,r=>{if(r.label==="class"||r.label==="interface")for(let n of r.subs)!M(n)&&(n.label===void 0||n.label==="annotation")&&(n.label="member")},"bottomUp"),t}l(On,"On");i(On,"processJava");var Fo={heading:/^# /,subheading:/^## /,subsubheading:/### /},Ro=me(Fo);function Dn(e){let t=e;if(_e(t,Ro),M(t))return t;function r(o){if(o.label==="heading")return 1;if(o.label==="subheading")return 2;if(o.label==="subsubheading")return 3}l(r,"n"),i(r,"headingLevel");let n=[t],s=[...t.subs];t.subs=[];for(let o of s){let a=r(o);if(a===void 0||M(o))n[n.length-1].subs.push(o);else{for(;n.length<a;)n.push(n[n.length-1]);for(n[a-1].subs.push(o),n[a]=o;n.length>a+1;)n.pop()}}return t=zt(t),t=z(t),Ce(t),t}l(Dn,"Dn");i(Dn,"processMarkdown");function Ae(e){return" ".repeat(e.indentation)+e.sourceLine+`
`}l(Ae,"Ae");i(Ae,"deparseLine");function Bn(e){function t(r,n){let s="";return B(r)?s=Ae(r):M(r)&&(s=`
`),n+s}return l(t,"e"),i(t,"accumulator"),ke(e,"",t,"topDown")}l(Bn,"Bn");i(Bn,"deparseTree");function Oo(e,t){let r=new Set(t),n=[],s="";function o(a){a.label!==void 0&&r.has(a.label)?(s!==""&&n.push({label:void 0,source:s}),n.push({label:a.label,source:Bn(a)}),s=""):(B(a)&&(s+=Ae(a)),a.subs.forEach(o))}return l(o,"s"),i(o,"visit"),o(e),s!==""&&n.push({label:void 0,source:s}),n}l(Oo,"Oo");i(Oo,"deparseAndCutTree");function Wn(e,t=0){let r=" ".repeat(t);if(e===void 0)return"UNDEFINED NODE";let n;e.subs===void 0?n="UNDEFINED SUBS":n=e.subs.map(a=>Wn(a,t+2)).join(`,
`),n===""?n="[]":n=`[
${n}
${r}]`;let s=(P(e)||Q(e)?" ":String(e.lineNumber).padStart(3," "))+`: ${r}`,o=e.label===void 0?"":JSON.stringify(e.label);return P(e)||Q(e)?`${s}vnode(${e.indentation}, ${o}, ${n})`:M(e)?`${s}blank(${o!=null?o:""})`:`${s}lnode(${e.indentation}, ${o}, ${JSON.stringify(e.sourceLine)}, ${n})`}l(Wn,"Wn");i(Wn,"describeTree");function Un(e,t=""){let r=e.label===void 0?"":`, ${JSON.stringify(e.label)}`,n=!M(e)&&e.subs.length>0?`[
${e.subs.map(s=>Un(s,t+" ")).join(`,
`)}
${t}]`:"[]";switch(e.type){case"blank":return`${t}blankNode(${e.lineNumber}${r})`;case"top":return`topNode(${n}${r})`;case"virtual":return`${t}virtualNode(${e.indentation}, ${n}${r})`;case"line":return`${t}lineNode(${e.indentation}, ${e.lineNumber}, "${e.sourceLine}", ${n}${r})`}}l(Un,"Un");i(Un,"encodeTree");function zn(e){if(B(e)||M(e))return e.lineNumber;for(let t of e.subs){let r=zn(t);if(r!==void 0)return r}}l(zn,"zn");i(zn,"firstLineOf");function Vn(e){let t,r=e.subs.length-1;for(;r>=0&&t===void 0;)t=Vn(e.subs[r]),r--;return t===void 0&&!P(e)&&!Q(e)?e.lineNumber:t}l(Vn,"Vn");i(Vn,"lastLineOf");nt("markdown",Dn);nt("java",On);var qn={worthUp:.9,worthSibling:.88,worthDown:.8};function pe(e,t=qn){let r=U(e,n=>n?1:void 0);return T(r,n=>{var o;if(M(n))return;let s=n.subs.reduce((a,c)=>{var u;return Math.max(a,(u=c.label)!=null?u:0)},0);n.label=Math.max((o=n.label)!=null?o:0,s*t.worthUp)},"bottomUp"),T(r,n=>{if(M(n))return;let s=n.subs.map(c=>{var u;return(u=c.label)!=null?u:0}),o=[...s];for(let c=0;c<s.length;c++)s[c]!==0&&(o=o.map((u,f)=>Math.max(u,Math.pow(t.worthSibling,Math.abs(c-f))*s[c])));let a=n.label;a!==void 0&&(o=o.map(c=>Math.max(c,t.worthDown*a))),n.subs.forEach((c,u)=>c.label=o[u])},"topDown"),Hn(r)}l(pe,"pe");i(pe,"fromTreeWithFocussedLines");function Hn(e){let t=ke(e,[],(r,n)=>{var s,o;return(r.type==="line"||r.type==="blank")&&n.push(r.type==="line"?[Ae(r).trimEnd(),(s=r.label)!=null?s:0]:["",(o=r.label)!=null?o:0]),n},"topDown");return new Fe(t)}l(Hn,"Hn");i(Hn,"fromTreeWithValuedLines");function Vt(e,t=!0,r=!0){let n=typeof e=="string"?X(e):X(e.source,e.languageId);z(n);let s=U(n,o=>t&&o!=="closer");return T(s,o=>{o.label===void 0&&(o.label=t&&o.label!==!1)},"topDown"),t&&T(s,o=>{if(o.label){let a=!1;for(let c of[...o.subs].reverse())c.label&&!a?a=!0:c.label=!1}else for(let a of o.subs)a.label=!1;o.subs.length>0&&(o.label=!1)},"topDown"),r&&T(s,o=>{o.label||(o.label=(B(o)||M(o))&&o.lineNumber==0)},"topDown"),pe(s)}l(Vt,"Vt");i(Vt,"elidableTextForSourceCode");var cg,fe=(cg=class{constructor(t,r,n=D().tokenLength(t+`
`),s="strict"){if(this.text=t,this._value=r,this._cost=n,t.includes(`
`)&&s!=="none")throw new Error("LineWithValueAndCost: text contains newline");if(r<0&&s!=="none")throw new Error("LineWithValueAndCost: value is negative");if(n<0&&s!=="none")throw new Error("LineWithValueAndCost: cost is negative");if(s=="strict"&&r>1)throw new Error("Value should normally be between 0 and 1 -- set validation to `loose` to ignore this error")}get value(){return this._value}get cost(){return this._cost}adjustValue(t){return this._value*=t,this}recost(t=r=>D().tokenLength(r+`
`)){return this._cost=t(this.text),this}copy(){return new cg(this.text,this.value,this.cost,"none")}},l(cg,"t"),i(cg,"LineWithValueAndCost"),cg),ug,Fe=(ug=class{constructor(t){this.lines=[];let r=[];for(let n of t){let s=Array.isArray(n)?n[1]:1,o=Array.isArray(n)?n[0]:n;typeof o=="string"?o.split(`
`).forEach(a=>r.push(new fe(a,s))):o instanceof ug?o.lines.forEach(a=>r.push(a.copy().adjustValue(s))):"source"in o&&"languageId"in o&&Vt(o).lines.forEach(a=>r.push(a.copy().adjustValue(s)))}this.lines=r}adjust(t){this.lines.forEach(r=>r.adjustValue(t))}recost(t=r=>D().tokenLength(r+`
`)){this.lines.forEach(r=>r.recost(t))}makePrompt(t,r="[...]",n=!0,s="removeLeastDesirable",o=D()){let a=this.lines.map(c=>c.copy());return Do(a,t,r,n,s,o)}},l(ug,"t"),i(ug,"ElidableText"),ug);function Do(e,t,r,n,s,o){var p,h,m,g,y,v,_,x,b,E,S,I,H;if(o.tokenLength(r+`
`)>t)throw new Error("maxTokens must be larger than the ellipsis length");s==="removeLeastBangForBuck"&&e.forEach(K=>K.adjustValue(1/K.cost));let a=e.reduce((K,be)=>Math.max(K,be.value),0)+1,c=e.reduce((K,be)=>Math.max(K,be.text.length),0)+1,u=r.trim(),f=e.reduce((K,be)=>K+be.cost,0),d=e.length+1;for(;f>t&&d-->=-1;){let K=e.reduce((Te,vt)=>vt.value<Te.value?vt:Te),be=e.indexOf(K),Se=(p=e.slice(0,be+1).reverse().find(Te=>Te.text.trim()!==""))!=null?p:{text:""},ne=n?Math.min((m=(h=Se.text.match(/^\s*/))==null?void 0:h[0].length)!=null?m:0,((g=e[be-1])==null?void 0:g.text.trim())===u?(_=(v=(y=e[be-1])==null?void 0:y.text.match(/^\s*/))==null?void 0:v[0].length)!=null?_:0:c,((x=e[be+1])==null?void 0:x.text.trim())===u?(S=(E=(b=e[be+1])==null?void 0:b.text.match(/^\s*/))==null?void 0:E[0].length)!=null?S:0:c):0,ye=" ".repeat(ne)+r,J=new fe(ye,a,o.tokenLength(ye+`
`),"loose");e.splice(be,1,J),((I=e[be+1])==null?void 0:I.text.trim())===u&&e.splice(be+1,1),((H=e[be-1])==null?void 0:H.text.trim())===u&&e.splice(be-1,1);let Z=e.reduce((Te,vt)=>Te+vt.cost,0);Z>=f&&e.every(Te=>Te.value===a)&&(n=!1),f=Z}if(d<0)throw new Error("Infinite loop in ElidableText.makePrompt: Defensive counter < 0 in ElidableText.makePrompt with end text");return e.map(K=>K.text).join(`
`)}l(Do,"Do");i(Do,"makePrompt");function $(){}l($,"$");i($,"Diff");$.prototype={diff:i(function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=r.callback;typeof r=="function"&&(n=r,r={}),this.options=r;var s=this;function o(g){return n?(setTimeout(function(){n(void 0,g)},0),!0):g}l(o,"a"),i(o,"done"),e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var a=t.length,c=e.length,u=1,f=a+c;r.maxEditLength&&(f=Math.min(f,r.maxEditLength));var d=[{newPos:-1,components:[]}],p=this.extractCommon(d[0],t,e,0);if(d[0].newPos+1>=a&&p+1>=c)return o([{value:this.join(t),count:t.length}]);function h(){for(var g=-1*u;g<=u;g+=2){var y=void 0,v=d[g-1],_=d[g+1],x=(_?_.newPos:0)-g;v&&(d[g-1]=void 0);var b=v&&v.newPos+1<a,E=_&&0<=x&&x<c;if(!b&&!E){d[g]=void 0;continue}if(!b||E&&v.newPos<_.newPos?(y=Wo(_),s.pushComponent(y.components,void 0,!0)):(y=v,y.newPos++,s.pushComponent(y.components,!0,void 0)),x=s.extractCommon(y,t,e,g),y.newPos+1>=a&&x+1>=c)return o(Bo(s,y.components,t,e,s.useLongestToken));d[g]=y}u++}if(l(h,"f"),i(h,"execEditLength"),n)i(l(function g(){setTimeout(function(){if(u>f)return n();h()||g()},0)},"p"),"exec")();else for(;u<=f;){var m=h();if(m)return m}},"diff"),pushComponent:i(function(e,t,r){var n=e[e.length-1];n&&n.added===t&&n.removed===r?e[e.length-1]={count:n.count+1,added:t,removed:r}:e.push({count:1,added:t,removed:r})},"pushComponent"),extractCommon:i(function(e,t,r,n){for(var s=t.length,o=r.length,a=e.newPos,c=a-n,u=0;a+1<s&&c+1<o&&this.equals(t[a+1],r[c+1]);)a++,c++,u++;return u&&e.components.push({count:u}),e.newPos=a,c},"extractCommon"),equals:i(function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},"equals"),removeEmpty:i(function(e){for(var t=[],r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t},"removeEmpty"),castInput:i(function(e){return e},"castInput"),tokenize:i(function(e){return e.split("")},"tokenize"),join:i(function(e){return e.join("")},"join")};function Bo(e,t,r,n,s){for(var o=0,a=t.length,c=0,u=0;o<a;o++){var f=t[o];if(f.removed){if(f.value=e.join(n.slice(u,u+f.count)),u+=f.count,o&&t[o-1].added){var d=t[o-1];t[o-1]=t[o],t[o]=d}}else{if(!f.added&&s){var p=r.slice(c,c+f.count);p=p.map(function(m,g){var y=n[u+g];return y.length>m.length?y:m}),f.value=e.join(p)}else f.value=e.join(r.slice(c,c+f.count));c+=f.count,f.added||(u+=f.count)}}var h=t[a-1];return a>1&&typeof h.value=="string"&&(h.added||h.removed)&&e.equals("",h.value)&&(t[a-2].value+=h.value,t.pop()),t}l(Bo,"Bo");i(Bo,"buildValues");function Wo(e){return{newPos:e.newPos,components:e.components.slice(0)}}l(Wo,"Wo");i(Wo,"clonePath");var Ga=new $,jn=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Zn=/\S/,$n=new $;$n.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!Zn.test(e)&&!Zn.test(t)};$n.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),r=0;r<t.length-1;r++)!t[r+1]&&t[r+2]&&jn.test(t[r])&&jn.test(t[r+2])&&(t[r]+=t[r+2],t.splice(r+1,2),r--);return t};var $t=new $;$t.tokenize=function(e){var t=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(var n=0;n<r.length;n++){var s=r[n];n%2&&!this.options.newlineIsToken?t[t.length-1]+=s:(this.options.ignoreWhitespace&&(s=s.trim()),t.push(s))}return t};function Uo(e,t,r){return $t.diff(e,t,r)}l(Uo,"Uo");i(Uo,"diffLines");var zo=new $;zo.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Vo=new $;Vo.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function rt(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?rt=i(function(t){return typeof t},"_typeof"):rt=i(function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},"_typeof"),rt(e)}l(rt,"rt");i(rt,"_typeof");function qt(e){return qo(e)||Ho(e)||jo(e)||Zo()}l(qt,"qt");i(qt,"_toConsumableArray");function qo(e){if(Array.isArray(e))return Ht(e)}l(qo
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}l(Zo,"Zo");i(Zo,"_nonIterableSpread");var $o=Object.prototype.toString,Re=new $;Re.useLongestToken=!0;Re.tokenize=$t.tokenize;Re.castInput=function(e){var t=this.options,r=t.undefinedReplacement,n=t.stringifyReplacer,s=n===void 0?function(o,a){return typeof a>"u"?r:a}:n;return typeof e=="string"?e:JSON.stringify(jt(e,null,null,s),s," ")};Re.equals=function(e,t){return $.prototype.equals.call(Re,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"))};function jt(e,t,r,n,s){t=t||[],r=r||[],n&&(e=n(s,e));var o;for(o=0;o<t.length;o+=1)if(t[o]===e)return r[o];var a;if($o.call(e)==="[object Array]"){for(t.push(e),a=new Array(e.length),r.push(a),o=0;o<e.length;o+=1)a[o]=jt(e[o],t,r,n,s);return t.pop(),r.pop(),a}if(e&&e.toJSON&&(e=e.toJSON()),rt(e)==="object"&&e!==null){t.push(e),a={},r.push(a);var c=[],u;for(u in e)e.hasOwnProperty(u)&&c.push(u);for(c.sort(),o=0;o<c.length;o+=1)u=c[o],a[u]=jt(e[u],t,r,n,u);t.pop(),r.pop()}else a=e;return a}l(jt,"jt");i(jt,"canonicalize");var Zt=new $;Zt.tokenize=function(e){return e.slice()};Zt.join=Zt.removeEmpty=function(e){return e};function Gn(e,t,r,n,s,o,a){a||(a={}),typeof a.context>"u"&&(a.context=4);var c=Uo(r,n,a);if(!c)return;c.push({value:"",lines:[]});function u(_){return _.map(function(x){return" "+x})}l(u,"u"),i(u,"contextLines");for(var f=[],d=0,p=0,h=[],m=1,g=1,y=i(function(_){var x=c[_],b=x.lines||x.value.replace(/\n$/,"").split(`
`);if(x.lines=b,x.added||x.removed){var E;if(!d){var S=c[_-1];d=m,p=g,S&&(h=a.context>0?u(S.lines.slice(-a.context)):[],d-=h.length,p-=h.length)}(E=h).push.apply(E,qt(b.map(function(J){return(x.added?"+":"-")+J}))),x.added?g+=b.length:m+=b.length}else{if(d)if(b.length<=a.context*2&&_<c.length-2){var I;(I=h).push.apply(I,qt(u(b)))}else{var H,K=Math.min(b.length,a.context);(H=h).push.apply(H,qt(u(b.slice(0,K))));var be={oldStart:d,oldLines:m-d+K,newStart:p,newLines:g-p+K,lines:h};if(_>=c.length-2&&b.length<=a.context){var Se=/\n$/.test(r),ne=/\n$/.test(n),ye=b.length==0&&h.length>be.oldLines;!Se&&ye&&r.length>0&&h.splice(be.oldLines,0,"\\ No newline at end of file"),(!Se&&!ye||!ne)&&h.push("\\ No newline at end of file")}f.push(be),d=0,p=0,h=[]}m+=b.length,g+=b.length}},"_loop"),v=0;v<c.length;v++)y(v);return{oldFileName:e,newFileName:t,oldHeader:s,newHeader:o,hunks:f}}l(Gn,"Gn");i(Gn,"structuredPatch");function Ko(e,t){let r=typeof e=="string"?typeof t=="string"?void 0:t.languageId:typeof t=="string"||e.languageId===t.languageId?e.languageId:void 0;e=typeof e=="string"?e:e.source,t=typeof t=="string"?t:t.source;let n=Gn("","",e,t),s=new Set,o=new Set;for(let u of n.hunks){for(let f=u.oldStart;f<u.oldStart+u.oldLines;f++)s.add(f);for(let f=u.newStart;f<u.newStart+u.newLines;f++)o.add(f)}let a=U(z(X(e,r)),()=>!1),c=U(z(X(t,r)),()=>!1);return T(a,u=>{(u.type==="line"||u.type==="blank")&&s.has(u.lineNumber)&&(u.label=!0)},"topDown"),T(c,u=>{(u.type==="line"||u.type==="blank")&&o.has(u.lineNumber)&&(u.label=!0)},"topDown"),[pe(a),pe(c)]}l(Ko,"Ko");i(Ko,"elidableTextForDiff");var Gt=require("fs"),q3,Oe=(q3=class{},l(q3,"Oe"),i(q3,"FileSystem"),q3),U3,De=(U3=class extends Oe{getFsPath(t){if(t.scheme!=="file")throw new Error(`Unsupported scheme: ${t.scheme}`);return t.fsPath}async readFileString(t){return(await Gt.promises.readFile(this.getFsPath(t))).toString()}async stat(t){let r=await Gt.promises.stat(this.getFsPath(t));return{ctime:r.ctimeMs,mtime:r.mtimeMs,size:r.size}}},l(U3,"De"),i(U3,"LocalFileSystem"),U3),il=new De,ot={abap:{start:'"',end:""},aspdotnet:{start:"<%--",end:"--%>"},bat:{start:"REM",end:""},bibtex:{start:"%",end:""},blade:{start:"#",end:""},BluespecSystemVerilog:{start:"//",end:""},c:{start:"//",end:""},clojure:{start:";",end:""},coffeescript:{start:"//",end:""},cpp:{start:"//",end:""},csharp:{start:"//",end:""},css:{start:"/*",end:"*/"},cuda:{start:"//",end:""},dart:{start:"//",end:""},dockerfile:{start:"#",end:""},dotenv:{start:"#",end:""},elixir:{start:"#",end:""},erb:{start:"<%#",end:"%>"},erlang:{start:"%",end:""},fsharp:{start:"//",end:""},go:{start:"//",end:""},groovy:{start:"//",end:""},haml:{start:"-#",end:""},handlebars:{start:"{{!",end:"}}"},haskell:{start:"--",end:""},hlsl:{start:"//",end:""},html:{start:"<!--",end:"-->"},ini:{start:";",end:""},java:{start:"//",end:""},javascript:{start:"//",end:""},javascriptreact:{start:"//",end:""},jsonc:{start:"//",end:""},jsx:{start:"//",end:""},julia:{start:"#",end:""},kotlin:{start:"//",end:""},latex:{start:"%",end:""},less:{start:"//",end:""},lua:{start:"--",end:""},makefile:{start:"#",end:""},markdown:{start:"[]: #",end:""},"objective-c":{start:"//",end:""},"objective-cpp":{start:"//",end:""},perl:{start:"#",end:""},php:{start:"//",end:""},powershell:{start:"#",end:""},pug:{start:"//",end:""},python:{start:"#",end:""},ql:{start:"//",end:""},r:{start:"#",end:""},razor:{start:"<!--",end:"-->"},ruby:{start:"#",end:""},rust:{start:"//",end:""},sass:{start:"//",end:""},scala:{start:"//",end:""},scss:{start:"//",end:""},shellscript:{start:"#",end:""},slim:{start:"/",end:""},solidity:{start:"//",end:""},sql:{start:"--",end:""},stylus:{start:"//",end:""},svelte:{start:"<!--",end:"-->"},swift:{start:"//",end:""},systemverilog:{start:"//",end:""},terraform:{start:"#",end:""},tex:{start:"%",end:""},typescript:{start:"//",end:""},typescriptreact:{start:"//",end:""},vb:{start:"'",end:""},verilog:{start:"//",end:""},"vue-html":{start:"<!--",end:"-->"},vue:{start:"//",end:""},xml:{start:"<!--",end:"-->"},xsl:{start:"<!--",end:"-->"},yaml:{start:"#",end:""}},Jo=["php","
`),s=(n?e.slice(0,-1):e).split(`
`).map(o=>Be(o,t,r)).join(`
`);return n?s+`
`:s}l(ge,"ge");i(ge,"commentBlockAsSingles");function Jn(e,t){let{languageId:r}=e;return Jo.indexOf(r)===-1&&!Qo(e)?r in Kn?Kn[r]:Be(`Language: ${r}`,r,t):""}l(Jn,"Jn");i(Jn,"getLanguageMarker");function Qn(e,t){return e.relativePath?Be(`Path: ${e.relativePath}`,e.languageId,t):""}l(Qn,"Qn");i(Qn,"getPathMarker");function he(e){return e===""||e.endsWith(`
`)?e:e+`
`}l(he,"he");i(he,"newLineEnded");var Xo={tokenizerName:"cl100k"};function Yo(e){return{...Xo,...e}}l(Yo,"Yo");i(Yo,"cursorContextOptions");function st(e,t={}){let r=Yo(t),n=D(r.tokenizerName);if(r.maxLineCount!==void 0&&r.maxLineCount<0)throw new Error("maxLineCount must be non-negative if defined");if(r.maxTokenLength!==void 0&&r.maxTokenLength<0)throw new Error("maxTokenLength must be non-negative if defined");if(r.maxLineCount===0||r.maxTokenLength===0)return{context:"",lineCount:0,tokenLength:0,tokenizerName:r.tokenizerName};let s=e.source.slice(0,e.offset);return r.maxLineCount!==void 0&&(s=s.split(`
`).slice(-r.maxLineCount).join(`
`)),r.maxTokenLength!==void 0&&(s=n.takeLastLinesTokens(s,r.maxTokenLength)),{context:s,lineCount:s.split(`
`).length,tokenLength:n.tokenLength(s),tokenizerName:r.tokenizerName}}l(st,"st");i(st,"getCursorContext");function Xn(e,t){if(e.length===0||t.length===0)return{score:e.length+t.length};let r=Array.from({length:e.length}).map(()=>Array.from({length:t.length}).map(()=>0));for(let n=0;n<e.length;n++)r[n][0]=n;for(let n=0;n<t.length;n++)r[0][n]=n;for(let n=0;n<t.length;n++)for(let s=0;s<e.length;s++)r[s][n]=Math.min((s==0?n:r[s-1][n])+1,(n==0?s:r[s][n-1])+1,(s==0||n==0?Math.max(s,n):r[s-1][n-1])+(e[s]==t[n]?0:1));return{score:r[e.length-1][t.length-1]}}l(Xn,"Xn");i(Xn,"findEditDistanceScore");var We=50,es=5,j3,it=(j3=class{constructor(){this.used=new Map,this.unused=new Map}add(t){for(let[r,n]of t.used)this.used.set(r,n);for(let[r,n]of t.unused)this.unused.set(r,n)}markUsed(t){this.IsSnippet(t)&&this.used.set(t.id,this.convert(t))}undoMarkUsed(t){this.IsSnippet(t)&&this.used.delete(t.id)}markUnused(t){this.IsSnippet(t)&&this.unused.set(t.id,this.convert(t))}convert(t){return{score:t.score.toFixed(4),length:t.text.length}}IsSnippet(t){return t.kind=="SimilarFile"||t.kind=="RetrievalSnippet"||t.kind=="TooltipSignature"}},l(j3,"it"),i(j3,"PromptBackground"),j3),H3,at=(H3=class{constructor(){this.used=new Map,this.unused=new Map,this.usedCounts=new Map,this.unusedCounts=new Map}add(t){for(let[r,n]of t.used)this.used.set(r,(this.used.get(r)||0)+n);for(let[r,n]of t.unused)this.unused.set(r,(this.unused.get(r)||0)+n);for(let[r,n]of t.usedCounts)this.usedCounts.set(r,(this.usedCounts.get(r)||0)+n);for(let[r,n]of t.unusedCounts)this.unusedCounts.set(r,(this.unusedCounts.get(r)||0)+n)}markUsed(t){this.used.set(t.kind,(this.used.get(t.kind)||0)+t.tokens),t.kind=="BeforeCursor"?this.usedCounts.set(t.kind,(this.usedCounts.get(t.kind)||0)+t.text.split(`
`).length):this.usedCounts.set(t.kind,(this.usedCounts.get(t.kind)||0)+1)}undoMarkUsed(t){this.used.set(t.kind,(this.used.get(t.kind)||0)-t.tokens),t.kind=="BeforeCursor"?this.usedCounts.set(t.kind,(this.usedCounts.get(t.kind)||0)-t.text.split(`
`).length):this.usedCounts.set(t.kind,(this.usedCounts.get(t.kind)||0)-1)}markUnused(t){this.unused.set(t.kind,(this.unused.get(t.kind)||0)+t.tokens),t.kind=="BeforeCursor"?this.unusedCounts.set(t.kind,(this.unusedCounts.get(t.kind)||0)+t.text.split(`
`).length):this.unusedCounts.set(t.kind,(this.unusedCounts.get(t.kind)||0)+1)}},l(H3,"at"),i(H3,"PromptChoices"),H3),$3,Ue=($3=class{constructor(t="default"){switch(t){default:this._rankedList=["LanguageMarker","PathMarker","RetrievalSnippet","SimilarFile","BeforeCursor","TooltipSignature"]}}get rankedList(){return this._rankedList}sortElements(t){return t.sort((r,n)=>{let s=this._rankedList.indexOf(r.kind),o=this._rankedList.indexOf(n.kind);if(s===-1||o===-1)throw`Invalid element kind: ${r.kind} or ${n.kind}, not found in prompt element ordering list`;return s===o?r.id-n.id:s-o})}},l($3,"Ue"),i($3,"PromptOrderList"),$3),V3,lt=(V3=class extends Ue{constructor(t="default"){switch(super(),t){default:this._rankedList=["TooltipSignature","BeforeCursor","SimilarFile","RetrievalSnippet","PathMarker","LanguageMarker"]}}sortElements(t){return t.sort((r,n)=>{let s=this._rankedList.indexOf(r.kind),o=this._rankedList.indexOf(n.kind);if(s===-1||o===-1)throw`Invalid element kind: ${r.kind} or ${n.kind}, not found in snippet provider priority list`;return s===o?n.id-r.id:s-o})}},l(V3,"lt"),i(V3,"PromptPriorityList"),V3);function dt(e){switch(e){case"neighboring-tabs":return"SimilarFile";case"retrieval":return"RetrievalSnippet";case"path":return"PathMarker";case"language":return"LanguageMarker";case"tooltip-signature":return"TooltipSignature";default:throw new Error(`Unknown snippet provider type ${e}`)}}l(dt,"dt");i(dt,"kindForSnippetProviderType");var G3,ut=(G3=class{constructor(t){this.ranges=new Array;let r=0,n;for(let s of t)s.text.length!==0&&(n==="BeforeCursor"&&s.kind==="BeforeCursor"?this.ranges[this.ranges.length-1].end+=s.text.length:this.ranges.push({kind:s.kind,start:r,end:r+s.text.length}),n=s.kind,r+=s.text.length)}},l(G3,"ut"),i(G3,"PromptElementRanges"),G3),z3,ct=(z3=class{constructor(t,r,n,s,o){this.tokenizer=t,this.lineEndingOption=r,this.orderingList=n,this.snippetTextProcessor=s,this.priorityList=o,this.content=[],this.basePromptBackground=new it,this.baseTallyOfChoices=new at}extMarkUnused(t){this.basePromptBackground.markUnused(t),this.baseTallyOfChoices.markUnused(t)}getContent(){return[...this.content]}convertLineEndings(t){return this.lineEndingOption==="unix"&&(t=t.replace(/\r\n/g,`
`).replace(/\r/g,`
`)),t}maxPrefixTokenLength(){return this.content.reduce((t,r)=>t+=r.tokens,0)}append(t,r,n=this.tokenizer.tokenLength(t),s=NaN){t=this.convertLineEndings(t);let o=this.content.length;return this.content.push({id:o,text:t,kind:r,tokens:n,score:s}),o}fulfillPrefix(t){let r=new it;r.add(this.basePromptBackground);let n=new at;n.add(this.baseTallyOfChoices);function s(g){r.markUsed(g),n.markUsed(g)}l(s,"o"),i(s,"markUsed");function o(g){r.undoMarkUsed(g),n.undoMarkUsed(g)}l(o,"s"),i(o,"undoMarkUsed");function a(g){r.markUnused(g),n.markUnused(g)}l(a,"a"),i(a,"markUnused"),this.priorityList.sortElements(this.content);let c,u=[],f=t;this.content.forEach(g=>{if(f>0||c===void 0){let y=g.tokens;if(f>=y)f-=y,s(g),u.push(g);else if(g.kind==="BeforeCursor"){let{summarizedElement:v,removedMaterial:_}=this.snippetTextProcessor.summarize(this.tokenizer,g,f);g=v,y=g.tokens,f-=y,g.text.length>0&&s(g),_.text.length>0&&a(_),u.push(g)}else c===void 0?c=g:a(g)}else a(g)}),this.orderingList.sortElements(u);let d=u.reduce((g,y)=>g+y.text,""),p=this.tokenizer.tokenLength(d);for(;p>t;){this.priorityList.sortElements(u);let g=u.pop();g&&(o(g),a(g),c!==void 0&&a(c),c=void 0),this.orderingList.sortElements(u),d=u.reduce((y,v)=>y+v.text,""),p=this.tokenizer.tokenLength(d)}let h=[...u];if(c!==void 0){h.push(c),this.orderingList.sortElements(h);let g=h.reduce((v,_)=>v+_.text,""),y=this.tokenizer.tokenLength(g);if(y<=t){s(c);let v=new ut(h);return{prefix:g,suffix:"",prefixLength:y,suffixLength:0,promptChoices:n,promptBackground:r,promptElementRanges:v}}else a(c)}let m=new ut(u);return{prefix:d,suffix:"",prefixLength:p,suffixLength:0,promptChoices:n,promptBackground:r,promptElementRanges:m}}fulfill(t,r,n){var h;if(r.suffixPercent===0||t.length===0)return{promptInfo:this.fulfillPrefix(r.maxPromptLength),newCachedSuffix:n};let s=r.maxPromptLength-es,o=Math.floor(s*(100-r.suffixPercent)/100),a=s-o,c=t.trimStart();if(s>We&&a<We)throw new Error(`Suffix budget is smaller than MAX_EDIT_DISTANCE_LENGTH: ${a} < ${We}
`);let u=this.tokenizer.takeFirstTokens(c,We),f=!1;u.tokens.length>0&&r.suffixMatchThreshold>0&&100*((h=Xn(u.tokens,n.tokens.slice(0,We)))==null?void 0:h.score)<r.suffixMatchThreshold*u.tokens.length&&(f=!0);let d;if(f)o=s-n.tokens.length,d=n;else{let m=this.maxPrefixTokenLength(),g=this.tokenizer.tokenLength(c);m<o?(o=m,a=s-o):g<a&&(o=s-g,a=g),d=this.tokenizer.takeFirstTokens(c,a)}let p=this.fulfillPrefix(o);return p.suffix=d.text,p.suffixLength=d.tokens.length,{promptInfo:p,newCachedSuffix:d}}},l(z3,"ct"),i(z3,"PromptWishlist"),z3),V=(e=>(e.NeighboringTabs="neighboring-tabs",e.Retrieval="retrieval",e.Language="language",e.Path="path",e.TooltipSignature="tooltip-signature",e))(V||{}),oe=(e=>(e.Function="function",e.Snippet="snippet",e.Variable="variable",e.Parameter="parameter",e.Method="method",e.Class="class",e.Module="module",e.Alias="alias",e.Enum="enum member",e.Interface="interface",e))(oe||{}),ts={function:"function",snippet:"snippet",variable:"variable",parameter:"parameter",method:"method",class:"class",module:"module",alias:"alias","enum member":"enum member",interface:"interface"};function ns(e,t,r){let n=ts[e.semantics],s=(e.relativePath?`Compare this ${n} from ${e.relativePath}:`:`Compare this ${n}:`)+`
`+e.snippet;return s.endsWith(`
`)||(s+=`
`),ge(s,t,r)}l(ns,"ns");i(ns,"announceSnippet");function Yn(e){e.sort((t,r)=>r.score-t.score)}l(Yn,"Yn");i(Yn,"sortSnippetsDescending");function rs(e,t,r){if(t==0)return[];let n=e.map(o=>({...o,kind:dt(o.provider)})),s=[];return r.rankedList.forEach(o=>{let a=n.filter(({kind:c})=>c===o);Yn(a),s.push(...a)}),s.slice(0,t)}l(rs,"rs");i(rs,"selectSnippets");function er(e,t,r,n,s,o){let a=rs(e,o,n).map(c=>{let u=ns(c,t,s),f=r.tokenLength(u);return{announcedSnippet:u,provider:c.provider,score:c.score,tokens:f,relativePath:c.relativePath}});return Yn(a),a.reverse(),a}l(er,"er");i(er,"processSnippetsForWishlist");var W3,Jt=(W3=class{constructor(t){this.keys=[],this.cache={},this.size=t}put(t,r){var n;if(this.cache[t]=r,this.keys.length>this.size){this.keys.push(t);let s=(n=this.keys.shift())!=null?n:"";delete this.cache[s]}}get(t){return this.cache[t]}},l(W3,"Jt"),i(W3,"FifoCache"),W3),K3,Qt=(K3=class{constructor(t){var r;this.stopsForLanguage=(r=as.get(t.languageId))!=null?r:is}tokenize(t){return new Set(os(t).filter(r=>!this.stopsForLanguage.has(r)))}},l(K3,"Qt"),i(K3,"Tokenizer"),K3),tr=new Jt(20),Y3,_t=(Y3=class{constructor(t){this.referenceDoc=t,this.tokenizer=new Qt(t)}get referenceTokens(){return this.tokenizer.tokenize(this._getCursorContextInfo(this.referenceDoc).context)}sortScoredSnippets(t,r="descending"){return r=="ascending"?t.sort((n,s)=>n.score>s.score?1:-1):r=="descending"?t.sort((n,s)=>n.score>s.score?-1:1):t}retrieveAllSnippets(t,r="descending"){var f;let n=[];if(t.source.length===0||this.referenceTokens.size===0)return n;let s=t.source.split(`
`),o=this.id()+":"+t.source,a=(f=tr.get(o))!=null?f:[],c=a.length==0,u=c?s.map(this.tokenizer.tokenize,this.tokenizer):[];for(let[d,[p,h]]of this.getWindowsDelineations(s).entries()){if(c){let y=new Set;u.slice(p,h).forEach(v=>v.forEach(y.add,y)),a.push(y)}let m=a[d],g=this.similarityScore(m,this.referenceTokens);n.push({score:g,startLine:p,endLine:h})}return c&&tr.put(o,a),this.sortScoredSnippets(n,r)}async findMatches(t){let r=await this.findBestMatch(t);return r?[r]:[]}async findBestMatch(t){if(t.source.length===0||this.referenceTokens.size===0)return;let r=t.source.split(`
`),n=this.retrieveAllSnippets(t,"descending");return n.length===0||n[0].score===0?void 0:{snippet:r.slice(n[0].startLine,n[0].endLine).join(`
`),semantics:"snippet",provider:"neighboring-tabs",...n[0]}}},l(Y3,"_t"),i(Y3,"WindowedMatcher"),Y3);function os(e){return e.split(/[^a-zA-Z0-9]/).filter(t=>t.length>0)}l(os,"os");i(os,"splitIntoWords");var ss=new Set(["we","our","you","it","its","they","them","their","this","that","these","those","is","are","was","were","be","been","being","have","has","had","having","do","does","did","doing","can","don","t","s","will","would","should","what","which","who","when","where","why","how","a","an","the","and","or","not","no","but","because","as","until","again","further","then","once","here","there","all","any","both","each","few","more","most","other","some","such","above","below","to","during","before","after","of","at","by","about","between","into","through","from","up","down","in","out","on","off","over","under","only","own","same","so","than","too","very","just","now"]),is=new Set(["if","then","else","for","while","with","def","function","return","TODO","import","try","catch","raise","finally","repeat","switch","case","match","assert","continue","break","const","class","enum","struct","static","new","super","this","var",...ss]),as=new Map([]);function nr(e,t){let r=[],n=t.length;if(n==0)return[];if(n<e)return[[0,n]];for(let s=0;s<n-e+1;s++)r.push([s,s+e]);return r}l(nr,"nr");i(nr,"getBasicWindowDelineations");var vh,mt=(vh=class extends _t{constructor(t,r){super(t),this.windowLength=r}id(){return"fixed:"+this.windowLength}getWindowsDelineations(t){return nr(this.windowLength,t)}_getCursorContextInfo(t){return st(t,{maxLineCount:this.windowLength})}similarityScore(t,r){return ls(t,r)}},l(vh,"t"),i(vh,"FixedWindowSizeJaccardMatcher"),vh.FACTORY=t=>({to:r=>new vh(r,t)}),vh);function ls(e,t){let r=new Set;return e.forEach(n=>{t.has(n)&&r.add(n)}),r.size/(e.size+t.size-r.size)}l(ls,"ls");i(ls,"computeScore");var ze=(e=>(e.None="none",e.Conservative="conservative",e.Medium="medium",e.Eager="eager",e.EagerButLittle="eagerButLittle",e.EagerButMedium="eagerButMedium",e.EagerButMuch="eagerButMuch",e.RetrievalComparable="retrievalComparable",e))(ze||{}),us={none:{snippetLength:1,threshold:-1,numberOfSnippets:0},conservative:{snippetLength:10,threshold:.3,numberOfSnippets:1},medium:{snippetLength:20,threshold:.1,numberOfSnippets:2},eager:{snippetLength:60,threshold:0,numberOfSnippets:4},eagerButLittle:{snippetLength:10,threshold:0,numberOfSnippets:1},eagerButMedium:{snippetLength:20,threshold:0,numberOfSnippets:4},eagerButMuch:{snippetLength:60,threshold:0,numberOfSnippets:6},retrievalComparable:{snippetLength:30,threshold:0,numberOfSnippets:4}},cs=1e4,ds=20;function _s(e,t){return mt.FACTORY(t.snippetLength).to(e)}l(_s,"_s");i(_s,"getMatcher");async function rr(e,t,r){let n={...us[r]},s=_s(e,n);return n.numberOfSnippets===0?[]:(await t.filter(o=>o.source.length<cs&&o.source.length>0).slice(0,ds).reduce(async(o,a)=>(await o).concat((await s.findMatches(a)).map(c=>({relativePath:a.relativePath,...c}))),Promise.resolve([]))).filter(o=>o.score&&o.snippet&&o.score>n.threshold).sort((o,a)=>o.score-a.score).slice(-n.numberOfSnippets)}l(rr,"rr");i(rr,"getNeighborSnippets");function or(e,t,r){if(!r)throw new Error("targetTokenBudget must be specified for the truncateFirstLinesFirst summarizer");let n=t.text.split(`
`);for(let g=0;g<n.length-1;g++)n[g]+=`
`;let s=[];n.forEach((g,y)=>{g===`
`&&s.length>0&&!s[s.length-1].endsWith(`
`)?s[s.length-1]+=`
`:s.push(g)});let o=s.map(g=>e.tokenLength(g)),a=1,c=0;for(;a<=o.length;a++){let g=o.at(-a);if(g){if(g+c>r){a--;break}c+=g}}let u=s.slice(-a).join(""),f=e.tokenLength(u),d=s.slice(0,-a).join(""),p=e.tokenLength(d),h={id:t.id,kind:t.kind,text:u,tokens:f,score:t.score},m={id:t.id,kind:t.kind,text:d,tokens:p,score:t.score};return{summarizedElement:h,removedMaterial:m}}l(or,"or");i(or,"truncateFirstLinesFirst");var X3,pt=(X3=class{constructor(t="default"){switch(t){case"default":default:this.kindToFunctionMap=new Map([["BeforeCursor",or]])}}isSummarizationAvailable(t){return this.kindToFunctionMap.has(t)}summarize(t,r,n){return this.kindToFunctionMap.get(r.kind)(t,r,n)}},l(X3,"pt"),i(X3,"SnippetTextProcessor"),X3),ps=/(\.|\->|::)\w+$/;function sr(e,t){let r=`Use ${e}`;return ge(r,t)}l(sr,"sr");i(sr,"announceTooltipSignatureSnippet");function ir(e){let t=e.source.substring(0,e.offset);return ps.test(t)}l(ir,"ir");i(ir,"endsWithAttributesOrMethod");function ar(e,t){let r=e.lastIndexOf(`
`)+1,n=e.substring(0,r),s=e.substring(r);return t.snippet=t.snippet+s,[n,t]}l(ar,"ar");i(ar,"transferLastLineToTooltipSignature");var lr={text:"",tokens:[]},ur=1500,cr=4,dr=150,Kt=(e=>(e.ConvertToUnix="unix",e.KeepOriginal="keep",e))(Kt||{}),_r=(e=>(e.None="none",e.FifteenPercent="fifteenPercent",e))(_r||{}),mr=(e=>(e.Equal="equal",e.Levenshtein="levenshteineditdistance",e))(mr||{}),Q3,ft=(Q3=class{constructor(t,r){if(this.fs=t,this.maxPromptLength=ur,this.numberOfSnippets=cr,this.neighboringTabs="eager",this.lineEnding="unix",this.suffixPercent=0,this.tokenizerName="cl100k",this.suffixMatchThreshold=0,this.promptOrderListPreset="default",this.promptPriorityPreset="default",this.snippetTextProcessingPreset="default",this.defaultCommentMarker=void 0,Object.assign(this,r),this.suffixPercent<0||this.suffixPercent>100)throw new Error(`suffixPercent must be between 0 and 100, but was ${this.suffixPercent}`);if(this.suffixMatchThreshold<0||this.suffixMatchThreshold>100)throw new Error(`suffixMatchThreshold must be at between 0 and 100, but was ${this.suffixMatchThreshold}`)}},l(Q3,"ft"),i(Q3,"PromptOptions"),Q3),gs={javascriptreact:"javascript",jsx:"javascript",typescriptreact:"typescript",jade:"pug",cshtml:"razor"};function Y(e){var t;return e=e.toLowerCase(),(t=gs[e])!=null?t:e}l(Y,"Y");i(Y,"normalizeLanguageId");async function hs(e,t,r={},n=[]){let s=new ft(e,r),o=D(s.tokenizerName),a=new pt(s.snippetTextProcessingPreset),c=new Ue(s.promptOrderListPreset),u=new lt(s.promptPriorityPreset),{source:f,offset:d}=t;if(d<0||d>f.length)throw new Error(`Offset ${d} is out of range.`);t.languageId=Y(t.languageId);let p=new ct(o,s.lineEnding,c,a,u),h=n.find(E=>E.provider==="path"),m=n.find(E=>E.provider==="language"),g=n.find(E=>E.provider==="tooltip-signature");h!==void 0&&h.snippet.length>0?(p.append(h.snippet,"PathMarker"),m&&p.extMarkUnused({text:m.snippet,kind:"LanguageMarker",tokens:o.tokenLength(m.snippet),id:NaN,score:NaN})):m&&p.append(m.snippet,"LanguageMarker"),n=n.filter(E=>E.provider!=="language"&&E.provider!=="path"&&E.provider!=="tooltip-signature");function y(){er(n,t.languageId,o,u,r.defaultCommentMarker,s.numberOfSnippets).forEach(E=>{let S=dt(E.provider);p.append(E.announcedSnippet,S,E.tokens,E.score)})}l(y,"p"),i(y,"addSnippetsNow"),y();let v=f.substring(0,d);g!==void 0&&o.tokenLength(g.snippet)<=dr?([v,g]=ar(v,g),p.append(g.snippet,"TooltipSignature")):g!==void 0&&p.extMarkUnused({text:g.snippet,kind:"TooltipSignature",tokens:o.tokenLength(g.snippet),id:NaN,score:NaN}),p.append(v,"BeforeCursor");let _=f.slice(d),{promptInfo:x,newCachedSuffix:b}=p.fulfill(_,s,lr);return lr=b,x}l(hs,"hs");i(hs,"getPrompt");var J3,ee=(J3=class extends Error{constructor(t){super(t),this.name="ProviderTimeoutError"}},l(J3,"ee"),i(J3,"ProviderTimeoutError"),J3),Z3,q=(Z3=class{constructor(t){this.api=t}getSnippets(t,r){return new Promise((n,s)=>{r.aborted&&s({error:new ee("provider aborted"),providerType:this.type}),r.addEventListener("abort",()=>{s({error:new ee(`max runtime exceeded: ${Xt} ms`),providerType:this.type})},{once:!0});let o=performance.now();this.buildSnippets(t).then(a=>{let c=performance.now();n({snippets:a,providerType:this.type,runtime:c-o})}).catch(a=>{s({error:a,providerType:this.type})})})}},l(Z3,"q"),i(Z3,"SnippetProvider"),Z3),e2,gt=(e2=class extends q{constructor(){super(...arguments),this.type="language"}async buildSnippets(t){let{currentFile:r,options:n}=t;return r.languageId=Y(r.languageId),[{provider:this.type,semantics:"snippet",snippet:he(Jn(r,n.defaultCommentMarker)),relativePath:r.relativePath,startLine:0,endLine:0,score:0}]}},l(e2,"gt"),i(e2,"LanguageSnippetProvider"),e2),t2,ht=(t2=class extends q{constructor(){super(...arguments),this.type="neighboring-tabs"}async buildSnippets(t){let{currentFile:r,neighborFiles:n,options:s}=t;return s&&n&&n.length&&s.neighboringTabs!=="none"?await this.api.getNeighborSnippets(r,n,s.neighboringTabs):[]}},l(t2,"ht"),i(t2,"NeighborFilesProvider"),t2),r2,bt=(r2=class extends q{constructor(){super(...arguments),this.type="path"}async buildSnippets(t){let{currentFile:r,opti
(function body: (statement_block) @body)
(function_declaration body: (statement_block) @body)
(generator_function body: (statement_block) @body)
(generator_function_declaration body: (statement_block) @body)
(method_definition body: (statement_block) @body)
(arrow_function body: (statement_block) @body)
] @function`,si={python:[[`(function_definition body: (block
(expression_statement (string))? @docstring) @body) @function`],['(ERROR ("def" (identifier) (parameters))) @function']],javascript:[[En]],typescript:[[En]],tsx:[[En]],go:[[`[
(function_declaration body: (block) @body)
(method_declaration body: (block) @body)
] @function`]],ruby:[[`[
(method name: (_) parameters: (method_parameters)? @params [(_)+ "end"] @body)
(singleton_method name: (_) parameters: (method_parameters)? @params [(_)+ "end"] @body)
] @function`]]},ii='(call_expression function: ((identifier) @req (#eq? @req "require")))',no=`(variable_declarator value: ${ii})`,ao=`
(lexical_declaration ${no}+)
(variable_declaration ${no}+)
`,ro=[[`(program [ ${ao} ] @import)`],["(program [ (import_statement) (import_alias) ] @import)"]],ai={python:[["(module (future_import_statement) @import)"],["(module (import_statement) @import)"],["(module (import_from_statement) @import)"]],javascript:[[`(program [ ${ao} ] @import)`],["(program [ (import_statement) ] @import)"]],typescript:ro,tsx:ro,go:[],ruby:[]},Mn=[["(program (export_statement) @export)"]],li={python:[],javascript:Mn,typescript:Mn,tsx:Mn,go:[],ruby:[]},ui={python:[["(module (global_statement) @globalVar)"],["(module (expression_statement) @globalVar)"]],javascript:[],typescript:[],tsx:[],go:[],ruby:[]},Tn=["function","function_declaration","generator_function","generator_function_declaration","method_definition","arrow_function"],ci={python:new Set(["function_definition"]),javascript:new Set(Tn),typescript:new Set(Tn),tsx:new Set(Tn),go:new Set(["function_declaration","method_declaration"]),ruby:new Set(["method","singleton_method"])},di={python:e=>{var t;return e.type==="module"||e.type==="block"&&((t=e.parent)==null?void 0:t.type)==="class_definition"},javascript:e=>e.type==="program"||e.type==="class_body",typescript:e=>e.type==="program"||e.type==="class_body",tsx:e=>e.type==="program"||e.type==="class_body",go:e=>e.type==="source_file",ruby:e=>e.type==="program"||e.type==="class"},In=new Map;async function _i(e){await Nt.default.init();let t;try{t=await oo.promises.readFile((0,so.resolve)(__dirname,"..","dist",`tree-sitter-${e}.wasm`))}catch(r){if(typeof r.code=="string"&&r instanceof Error&&r.name==="Error"){let n=new Error(`Could not load tree-sitter-${e}.wasm`);throw n.code="CopilotPromptLoadFailure",n.cause=r,n}throw r}return Nt.default.Language.load(t)}l(_i,"_i");i(_i,"loadWasmLanguage");async function lo(e){let t=R(e);if(!In.has(t)){let r=await _i(t);In.set(t,r)}return In.get(t)}l(lo,"lo");i(lo,"getLanguage");async function Ee(e,t){let r=await lo(e),n=new Nt.default;n.setLanguage(r);let s=n.parse(t);return n.delete(),s}l(Ee,"Ee");i(Ee,"parseTreeSitter");async function mi(e,t){let r=await Ee(e,t),n=!r.rootNode.hasError();return r.delete(),n}l(mi,"mi");i(mi,"parsesWithoutError");function pi(e){switch(R(e)){case"python":return null;case"javascript":case"typescript":case"tsx":case"go":return"}";case"ruby":return"end"}}l(pi,"pi");i(pi,"getBlockCloseToken");function Ge(e,t){let r=[];for(let n of e){if(!n[1]){let s=t.tree.getLanguage();n[1]=s.query(n[0])}r.push(...n[1].matches(t))}return r}l(Ge,"Ge");i(Ge,"innerQuery");function uo(e,t){let r=si[R(e)];return Ge(r,t)}l(uo,"uo");i(uo,"queryFunctions");function fi(e,t){let r=ai[R(e)];return Ge(r,t)}l(fi,"fi");i(fi,"queryImports");function gi(e,t){let r=li[R(e)];return Ge(r,t)}l(gi,"gi");i(gi,"queryExports");function hi(e,t){let r=ui[R(e)];return Ge(r,t)}l(hi,"hi");i(hi,"queryGlobalVars");var bi=[`[
(class_definition (block (expression_statement (string))))
(function_definition (block (expression_statement (string))))
]`];function Ln(e){return Ge([bi],e).length==1}l(Ln,"Ln");i(Ln,"queryPythonIsDocstring");function yi(e,t){let r=di[R(e)];for(;t.parent;){if(r(t.parent))return t;t=t.parent}return t.parent?t:null}l(yi,"yi");i(yi,"getAncestorWithSiblingFunctions");function Lt(e,t){return ci[R(e)].has(t.type)}l(Lt,"Lt");i(Lt,"isFunction");function wi(e,t){switch(R(e)){case"python":case"go":case"ruby":return Lt(e,t);case"javascript":case"typescript":case"tsx":if(t.type==="function_declaration"||t.type==="generator_function_declaration"||t.type==="method_definition")return!0;if(t.type==="lexical_declaration"||t.type==="variable_declaration"){if(t.namedChildCount>1)return!1;let r=t.namedChild(0);if(r==null)return!1;let n=r.namedChild(1);return n!==null&&Lt(e,n)}if(t.type==="expression_statement"){let r=t.namedChild(0);if((r==null?void 0:r.type)==="assignment_expression"){let n=r.namedChild(1);return n!==null&&Lt(e,n)}}return!1}}l(wi,"wi");i(wi,"isFunctionDefinition");function vi(e){var r;let t=e;for(;((r=t.previousSibling)==null?void 0:r.type)==="comment";){let n=t.previousSibling;if(n.endPosition.row<t.startPosition.row-1)break;t=n}return(t==null?void 0:t.type)==="comment"?t:null}l(vi,"vi");i(vi,"getFirstPrecedingComment");async function Si(e,t){let r=await Ee(e,t),n=uo(e,r.rootNode).map(s=>{let o=s.captures.find(a=>a.name==="function").node;return{startIndex:o.startIndex,endIndex:o.endIndex}});return r.delete(),n}l(Si,"Si");i(Si,"getFunctionPositions");var o2,kt=(o2=class{constructor(t,r,n){this.languageId=t,this.nodeMatch=r,this.nodeTypesWithBlockOrStmtChild=n}async getNodeMatchAtPosition(t,r,n){var o;let s=await Ee(this.languageId,t);try{let a=s.rootNode.descendantForIndex(r);for(;a;){let c=this.nodeMatch[a.type];if(c){if(!this.nodeTypesWithBlockOrStmtChild.has(a.type))break;let u=this.nodeTypesWithBlockOrStmtChild.get(a.type);if(((o=u==""?a.namedChildren[0]:a.childForFieldName(u))==null?void 0:o.type)==c)break}a=a.parent}return a?n(a):void 0}finally{s.delete()}}getNextBlockAtPosition(t,r,n){return this.getNodeMatchAtPosition(t,r,s=>{let o=s.children.reverse().find(a=>a.type==this.nodeMatch[s.type]);if(o){if(this.languageId=="python"&&o.parent){let a=o.parent.type==":"?o.parent.parent:o.parent,c=a==null?void 0:a.nextSibling;for(;c&&c.type=="comment";){let u=c.startPosition.row==o.endPosition.row&&c.startPosition.column>=o.endPosition.column,f=c.startPosition.row>a.endPosition.row&&c.startPosition.column>a.startPosition.column;if(u||f)o=c,c=c.nextSibling;else break}}if(!(o.endIndex>=o.tree.rootNode.endIndex-1&&(o.hasError()||o.parent.hasError())))return n(o)}})}async isBlockBodyFinished(t,r,n){let s=(t+r).trimEnd(),o=await this.getNextBlockAtPosition(s,n,a=>a.endIndex);if(o!==void 0&&o<s.length){let a=o-t.length;return a>0?a:void 0}}getNodeStart(t,r){let n=t.trimEnd();return this.getNodeMatchAtPosition(n,r,s=>s.startIndex)}},l(o2,"kt"),i(o2,"BaseBlockParser"),o2),a2,Pt=(a2=class extends kt{constructor(t,r,n,s,o){super(t,s,o),this.blockEmptyMatch=r,this.lineMatch=n}isBlockStart(t){return this.lineMatch.test(t.trimStart())}async isBlockBodyEmpty(t,r){let n=await this.getNextBlockAtPosition(t,r,s=>{s.startIndex<r&&(r=s.startIndex);let o=t.substring(r,s.endIndex).trim();return o==""||o.replace(/\s/g,"")==this.blockEmptyMatch});return n===void 0||n}async isEmptyBlockStart(t,r){return r=_o(t,r),this.isBlockStart(Ei(t,r))&&this.isBlockBodyEmpty(t,r)}},l(a2,"Pt"),i(a2,"RegexBasedBlockParser"),a2);function Ei(e,t){let r=e.lastIndexOf(`
`,t-1),n=e.indexOf(`
`,t);return n<0&&(n=e.length),e.slice(r+1,n)}l(Ei,"Ei");i(Ei,"getLineAtOffset");function _o(e,t){let r=t;for(;r>0&&/\s/.test(e.charAt(r-1));)r--;return r}l(_o,"_o");i(_o,"rewindToNearestNonWs");function co(e,t){let r=e.startIndex,n=e.startIndex-e.startPosition.column,s=t.substring(n,r);if(/^\s*$/.test(s))return s}l(co,"co");i(co,"indent");function Mi(e,t,r){if(t.startPosition.row<=e.startPosition.row)return!1;let n=co(e,r),s=co(t,r);return n!==void 0&&s!==void 0&&n.startsWith(s)}l(Mi,"Mi");i(Mi,"outdented");var l2,Me=(l2=class extends kt{constructor(t,r,n,s,o,a,c){super(t,r,n),this.startKeywords=s,this.blockNodeType=o,this.emptyStatementType=a,this.curlyBraceLanguage=c}isBlockEmpty(t,r){var s,o;let n=t.text.trim();return this.curlyBraceLanguage&&(n.startsWith("{")&&(n=n.slice(1)),n.endsWith("}")&&(n=n.slice(0,-1)),n=n.trim()),!!(n.length==0||this.languageId=="python"&&(((s=t.parent)==null?void 0:s.type)=="class_definition"||((o=t.parent)==null?void 0:o.type)=="function_definition")&&t.children.length==1&&Ln(t.parent))}async isEmptyBlockStart(t,r){var s,o,a,c;if(r>t.length)throw new RangeError("Invalid offset");for(let u=r;u<t.length&&t.charAt(u)!=`
`;u++)if(/\S/.test(t.charAt(u)))return!1;r=_o(t,r);let n=await Ee(this.languageId,t);try{let u=n.rootNode.descendantForIndex(r-1);if(u==null||this.curlyBraceLanguage&&u.type=="}")return!1;if((this.languageId=="javascript"||this.languageId=="typescript")&&u.parent&&u.parent.type=="object"&&u.parent.text.trim()=="{")return!0;if(this.languageId=="typescript"){let m=u;for(;m.parent;){if(m.type=="function_signature"||m.type=="method_signature"){let g=u.nextSibling;return g&&m.hasError()&&Mi(m,g,t)?!0:!m.children.find(y=>y.type==";")&&m.endIndex<=r}m=m.parent}}let f=null,d=null,p=null,h=u;for(;h!=null;){if(h.type==this.blockNodeType){d=h;break}if(this.nodeMatch[h.type]){p=h;break}if(h.type=="ERROR"){f=h;break}h=h.parent}if(d!=null){if(!d.parent||!this.nodeMatch[d.parent.type])return!1;if(this.languageId=="python"){let m=d.previousSibling;if(m!=null&&m.hasError()&&(m.text.startsWith('"""')||m.text.startsWith("'''")))return!0}return this.isBlockEmpty(d,r)}if(f!=null){if(((s=f.previousSibling)==null?void 0:s.type)=="module"||((o=f.previousSibling)==null?void 0:o.type)=="internal_module"||((a=f.previousSibling)==null?void 0:a.type)=="def")return!0;let m=[...f.children].reverse(),g=m.find(v=>this.startKeywords.includes(v.type)),y=m.find(v=>v.type==this.blockNodeType);if(g){switch(this.languageId){case"python":{g.type=="try"&&u.type=="identifier"&&u.text.length>4&&(y=(c=m.find(x=>x.hasError()))==null?void 0:c.children.find(x=>x.type=="block"));let v,_=0;for(let x of f.children){if(x.type==":"&&_==0){v=x;break}x.type=="("&&(_+=1),x.type==")"&&(_-=1)}if(v&&g.endIndex<=v.startIndex&&v.nextSibling){if(g.type=="def"){let x=v.nextSibling;if(x.type=='"'||x.type=="'"||x.type=="ERROR"&&(x.text=='"""'||x.text=="'''"))return!0}return!1}break}case"javascript":{let v=m.find(x=>x.type=="formal_parameters");if(g.type=="class"&&v)return!0;let _=m.find(x=>x.type=="{");if(_&&_.startIndex>g.endIndex&&_.nextSibling!=null||m.find(x=>x.type=="do")&&g.type=="while"||g.type=="=>"&&g.nextSibling&&g.nextSibling.type!="{")return!1;break}case"typescript":{let v=m.find(_=>_.type=="{");if(v&&v.startIndex>g.endIndex&&v.nextSibling!=null||m.find(_=>_.type=="do")&&g.type=="while"||g.type=="=>"&&g.nextSibling&&g.nextSibling.type!="{")return!1;break}}return y&&y.startIndex>g.endIndex?this.isBlockEmpty(y,r):!0}}if(p!=null){let m=this.nodeMatch[p.type],g=p.children.slice().reverse().find(y=>y.type==m);if(g)return this.isBlockEmpty(g,r);if(this.nodeTypesWithBlockOrStmtChild.has(p.type)){let y=this.nodeTypesWithBlockOrStmtChild.get(p.type),v=y==""?p.children[0]:p.childForFieldName(y);if(v&&v.type!=this.blockNodeType&&v.type!=this.emptyStatementType)return!1}return!0}return!1}finally{n.delete()}}},l(l2,"Me"),i(l2,"TreeSitterBasedBlockParser"),l2),Ti={python:new Me("python",{class_definition:"block",elif_clause:"block",else_clause:"block",except_clause:"block",finally_clause:"block",for_statement:"block",function_definition:"block",if_statement:"block",try_statement:"block",while_statement:"block",with_statement:"block"},new Map,["def","class","if","elif","else","for","while","try","except","finally","with"],"block",null,!1),javascript:new Me("javascript",{arrow_function:"statement_block",catch_clause:"statement_block",do_statement:"statement_block",else_clause:"statement_block",finally_clause:"statement_block",for_in_statement:"statement_block",for_statement:"statement_block",function:"statement_block",function_declaration:"statement_block",generator_function:"statement_block",generator_function_declaration:"statement_block",if_statement:"statement_block",method_definition:"statement_block",try_statement:"statement_block",while_statement:"statement_block",with_statement:"statement_block",class:"class_body",class_declaration:"class_body"},new Map([["arrow_function","body"],["do_statement","body"],["else_clause",""],["for_in_statement","body"],["for_statement","body"],["if_statement","consequence"],["while_statement","body"],["with_statement","body"]]),["=>","try","catch","finally","do","for","if","else","while","with","function","function*","class"],"statement_block","emp
`,wt=>"".padStart(wt," ")],le=gr("value","any"),He=hr("boolean"),L=[...Ze(yr,ve,Er,Tr)].map(wt=>`${Ur(4)}${wt}`).join(` &&${wr}`);return`function ${se}(${le})${He} {${wr}${Ur(2)}return (${wr}${L}${wr}${Ur(2)})
}`}l(ae,"CreateFunction");function gr(se,yr){let ve=At.language==="typescript"?`: ${yr}`:"";return`${se}${ve}`}l(gr,"CreateParameter");function hr(se){return At.language==="typescript"?`: ${se}`:""}l(hr,"CreateReturns");function Pr(se,yr,ve){let Er=ae("check",se,yr,"value"),Tr=gr("value","any"),wr=hr("boolean"),Ur=[...At.functions.values()],le=[...At.variables.values()],He=(0,sa.IsString)(se.$id)?`return function check(${Tr})${wr} {
return ${Ve(se.$id)}(value)
}`:`return ${Er}`;return[...le,...Ur,He].join(`
`)}l(Pr,"Build");function Tt(...se){let yr={language:"javascript"},[ve,Er,Tr]=se.length===2&&(0,sa.IsArray)(se[1])?[se[0],se[1],yr]:se.length===2&&!(0,sa.IsArray)(se[1])?[se[0],[],se[1]]:se.length===3?[se[0],se[1],se[2]]:se.length===1?[se[0],[],yr]:[null,[],yr];if(At.language=Tr.language,At.variables.clear(),At.functions.clear(),At.instances.clear(),!G0.TypeGuard.TSchema(ve))throw new E8(ve);for(let wr of Er)if(!G0.TypeGuard.TSchema(wr))throw new E8(wr);return Pr(ve,Er,Tr)}l(Tt,"Code"),e.Code=Tt;function Ar(se,yr=[]){let ve=Tt(se,yr,{language:"javascript"}),Er=globalThis.Function("kind","format","hash",ve),Tr=new Map(At.instances);function wr(L,wt,je){if(!G0.TypeRegistry.Has(L)||!Tr.has(wt))return!1;let Nr=G0.TypeRegistry.Get(L),Mr=Tr.get(wt);return Nr(Mr,je)}l(wr,"typeRegistryFunction");function Ur(L,wt){return G0.FormatRegistry.Has(L)?G0.FormatRegistry.Get(L)(wt):!1}l(Ur,"formatRegistryFunction");function le(L){return(0,aSe.Hash)(L)}l(le,"hashFunction");let He=Er(wr,Ur,le);return new f7(se,yr,He,ve)}l(Ar,"Compile"),e.Compile=Ar})(Cne||(xf.TypeCompiler=Cne={}))});var S8=w(ud=>{"use strict";var lSe=ud&&ud.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),cSe=ud&&ud.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&lSe(t,e,r)};Object.defineProperty(ud,"__esModule",{value:!0});ud.ValueErrorIterator=ud.ValueErrorType=void 0;var Ene=o7();Object.defineProperty(ud,"ValueErrorType",{enumerable:!0,get:function(){return Ene.ValueErrorType}});Object.defineProperty(ud,"ValueErrorIterator",{enumerable:!0,get:function(){return Ene.ValueErrorIterator}});cSe(Tne(),ud)});var Pne=w((pgt,Rne)=>{var A2=1e3,R2=A2*60,P2=R2*60,Rg=P2*24,pSe=Rg*7,hSe=Rg*365.25;Rne.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return mSe(e);if(r==="number"&&isFinite(e))return t.long?ySe(e):gSe(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function mSe(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*hSe;case"weeks":case"week":case"w":return r*pSe;case"days":case"day":case"d":return r*Rg;case"hours":case"hour":case"hrs":case"hr":case"h":return r*P2;case"minutes":case"minute":case"mins":case"min":case"m":return r*R2;case"seconds":case"second":case"secs":case"sec":case"s":return r*A2;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}l(mSe,"parse");function gSe(e){var t=Math.abs(e);return t>=Rg?Math.round(e/Rg)+"d":t>=P2?Math.round(e/P2)+"h":t>=R2?Math.round(e/R2)+"m":t>=A2?Math.round(e/A2)+"s":e+"ms"}l(gSe,"fmtShort");function ySe(e){var t=Math.abs(e);return t>=Rg?v7(e,t,Rg,"day"):t>=P2?v7(e,t,P2,"hour"):t>=R2?v7(e,t,R2,"minute"):t>=A2?v7(e,t,A2,"second"):e+" ms"}l(ySe,"fmtLong");function v7(e,t,r,n){var s=t>=r*1.5;return Math.round(e/r)+" "+n+(s?"s":"")}l(v7,"plural")});var AN=w((mgt,One)=>{function vSe(e){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=s,r.enabled=a,r.humanize=Pne(),r.destroy=f,Object.keys(e).forEach(d=>{r[d]=e[d]}),r.names=[],r.skips=[],r.formatters={};function t(d){let p=0;for(let h=0;h<d.length;h++)p=(p<<5)-p+d.charCodeAt(h),p|=0;return r.colors[Math.abs(p)%r.colors.length]}l(t,"selectColor"),r.selectColor=t;function r(d){let p,h=null,m,g;function y(...v){if(!y.enabled)return;let _=y,x=Number(new Date),b=x-(p||x);_.diff=b,_.prev=p,_.curr=x,p=x,v[0]=r.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let E=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(I,H)=>{if(I==="%%")return"%";E++;let K=r.formatters[H];if(typeof K=="function"){let be=v[E];I=K.call(_,be),v.splice(E,1),E--}retu
`).join(`
`+o),e.push(s+"m+"+b7.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=PSe()+t+" "+e[0]}l(RSe,"formatArgs");function PSe(){return Zl.inspectOpts.hideDate?"":new Date().toISOString()+" "}l(PSe,"getDate");function OSe(...e){return process.stderr.write(_7.format(...e)+`
`)}l(OSe,"log");function kSe(e){e?process.env.DEBUG=e:delete process.env.DEBUG}l(kSe,"save");function NSe(){return process.env.DEBUG}l(NSe,"load");function DSe(e){e.inspectOpts={};let t=Object.keys(Zl.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=Zl.inspectOpts[t[r]]}l(DSe,"init");b7.exports=AN()(Zl);var{formatters:Bne}=b7.exports;Bne.o=function(e){return this.inspectOpts.colors=this.useColors,_7.inspect(e,this.inspectOpts).split(`
`).map(t=>t.trim()).join(" ")};Bne.O=function(e){return this.inspectOpts.colors=this.useColors,_7.inspect(e,this.inspectOpts)}});var dd=w((Cgt,ON)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?ON.exports=kne():ON.exports=qne()});var qN=w((Tgt,$ne)=>{var w8=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,LSe=typeof AbortController=="function",A8,C7=LSe?AbortController:(A8=class{constructor(){this.signal=new Une}abort(){this.signal.dispatchEvent("abort")}},l(A8,"AbortController"),A8),MSe=typeof AbortSignal=="function",FSe=typeof C7.AbortSignal=="function",R8,Une=MSe?AbortSignal:FSe?C7.AbortController:(R8=class{constructor(){this.aborted=!1,this._listeners=[]}dispatchEvent(t){if(t==="abort"){this.aborted=!0;let r={type:t,target:this};this.onabort(r),this._listeners.forEach(n=>n(r),this)}}onabort(){}addEventListener(t,r){t==="abort"&&this._listeners.push(r)}removeEventListener(t,r){t==="abort"&&(this._listeners=this._listeners.filter(n=>n!==r))}},l(R8,"AbortSignal"),R8),LN=new Set,kN=l((e,t)=>{let r=`LRU_CACHE_OPTION_${e}`;T7(r)&&MN(r,`${e} option`,`options.${t}`,k2)},"deprecatedOption"),NN=l((e,t)=>{let r=`LRU_CACHE_METHOD_${e}`;if(T7(r)){let{prototype:n}=k2,{get:s}=Object.getOwnPropertyDescriptor(n,e);MN(r,`${e} method`,`cache.${t}()`,s)}},"deprecatedMethod"),BSe=l((e,t)=>{let r=`LRU_CACHE_PROPERTY_${e}`;if(T7(r)){let{prototype:n}=k2,{get:s}=Object.getOwnPropertyDescriptor(n,e);MN(r,`${e} property`,`cache.${t}`,s)}},"deprecatedProperty"),jne=l((...e)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...e):console.error(...e)},"emitWarning"),T7=l(e=>!LN.has(e),"shouldWarn"),MN=l((e,t,r,n)=>{LN.add(e);let s=`The ${t} is deprecated. Please use ${r} instead.`;jne(s,"DeprecationWarning",e,n)},"warn"),Pg=l(e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),"isPosInt"),Hne=l(e=>Pg(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?O2:null:null,"getUintArray"),FN=class FN extends Array{constructor(t){super(t),this.fill(0)}};l(FN,"ZeroArray");var O2=FN,BN=class BN{constructor(t){if(t===0)return[];let r=Hne(t);this.heap=new r(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}};l(BN,"Stack");var DN=BN,I8=class I8{constructor(t={}){let{max:r=0,ttl:n,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:c,allowStale:u,dispose:f,disposeAfter:d,noDisposeOnSet:p,noUpdateTTL:h,maxSize:m=0,sizeCalculation:g,fetchMethod:y,fetchContext:v,noDeleteOnFetchRejection:_,noDeleteOnStaleGet:x}=t,{length:b,maxAge:E,stale:S}=t instanceof I8?{}:t;if(r!==0&&!Pg(r))throw new TypeError("max option must be a nonnegative integer");let I=r?Hne(r):Array;if(!I)throw new Error("invalid max value: "+r);if(this.max=r,this.maxSize=m,this.sizeCalculation=g||b,this.sizeCalculation){if(!this.maxSize)throw new TypeError("cannot set sizeCalculation without setting maxSize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=y||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=v,!this.fetchMethod&&v!==void 0)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(r).fill(null),this.valList=new Array(r).fill(null),this.next=new I(r),this.prev=new I(r),this.head=0,this.tail=0,this.free=new DN(r),this.initialFill=1,this.size=0,typeof f=="function"&&(this.dispose=f),typeof d=="function"?(this.disposeAfter=d,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!p,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!_,this.maxSize!==0){if(!Pg(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!u||!!S,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Pg(s)||s===0
\r
`,"getFooter"),nie=l((e,t,r)=>{let n="";return n+=`--${e}\r
`,n+=`Content-Disposition: form-data; name="${t}"`,JN(r)&&(n+=`; filename="${r.name}"\r
`,n+=`Content-Type: ${r.type||"application/octet-stream"}`),`${n}\r
\r
`},"getHeader");async function*dwe(e,t){for(let[r,n]of e)yield nie(t,r,n),JN(n)?yield*n.stream():yield n,yield`\r
`;yield rie(t)}l(dwe,"formDataIterator");var pwe=l((e,t)=>{let r=0;for(let[n,s]of e)r+=Buffer.byteLength(nie(t,n,s)),r+=JN(s)?s.size:Buffer.byteLength(String(s)),r+=Buffer.byteLength(`\r
`);return r+=Buffer.byteLength(rie(t)),r},"getFormDataLength"),ZN=class ZN{constructor(t){this.fd=t,this.boundary=cwe(8).toString("hex")}length(){return typeof this._length>"u"&&(this._length=pwe(this.fd,this.boundary)),this._length}contentType(){return`multipart/form-data; boundary=${this.boundary}`}stream(){return uwe.from(dwe(this.fd,this.boundary))}};l(ZN,"FormDataSerializer");var QN=ZN;iie.exports={isFormData:fwe,FormDataSerializer:QN}});var oie=w((Fgt,sie)=>{"use strict";var{AbortSignal:hwe}=XN(),{Body:mwe,cloneStream:gwe,guessContentType:ywe}=I7(),{Headers:vwe}=N2(),{isPlainObject:xwe}=p1(),{isFormData:_we,FormDataSerializer:bwe}=k8(),Cwe=20,Ph=Symbol("Request internals"),N8=class N8 extends mwe{constructor(t,r={}){let n=t instanceof N8?t:null,s=n?new URL(n.url):new URL(t),o=r.method||n&&n.method||"GET";if(o=o.toUpperCase(),(r.body!=null||n&&n.body!==null)&&["GET","HEAD"].includes(o))throw new TypeError("Request with GET/HEAD method cannot have body");let a=r.body||(n&&n.body?gwe(n):null),c=new vwe(r.headers||n&&n.headers||{});if(_we(a)&&!c.has("content-type")){let p=new bwe(a);a=p.stream(),c.set("content-type",p.contentType()),!c.has("transfer-encoding")&&!c.has("content-length")&&c.set("content-length",p.length())}if(!c.has("content-type"))if(xwe(a))a=JSON.stringify(a),c.set("content-type","application/json");else{let p=ywe(a);p&&c.set("content-type",p)}super(a);let u=n?n.signal:null;if("signal"in r&&(u=r.signal),u&&!(u instanceof hwe))throw new TypeError("signal needs to be an instance of AbortSignal");let f=r.redirect||n&&n.redirect||"follow";if(!["follow","error","manual"].includes(f))throw new TypeError(`'${f}' is not a valid redirect option`);let d=r.cache||n&&n.cache||"default";if(!["default","no-store","reload","no-cache","force-cache","only-if-cached"].includes(d))throw new TypeError(`'${d}' is not a valid cache option`);this[Ph]={init:{...r},method:o,redirect:f,cache:d,headers:c,parsedURL:s,signal:u},r.follow===void 0?!n||n.follow===void 0?this.follow=Cwe:this.follow=n.follow:this.follow=r.follow,this.counter=r.counter||n&&n.counter||0,r.compress===void 0?!n||n.compress===void 0?this.compress=!0:this.compress=n.compress:this.compress=r.compress,r.decode===void 0?!n||n.decode===void 0?this.decode=!0:this.decode=n.decode:this.decode=r.decode}get method(){return this[Ph].method}get url(){return this[Ph].parsedURL.toString()}get headers(){return this[Ph].headers}get redirect(){return this[Ph].redirect}get cache(){return this[Ph].cache}get signal(){return this[Ph].signal}clone(){return new N8(this)}get init(){return this[Ph].init}get[Symbol.toStringTag](){return this.constructor.name}};l(N8,"Request");var N7=N8;Object.defineProperties(N7.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},cache:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}});sie.exports={Request:N7}});var eD=w((qgt,aie)=>{"use strict";var{Body:Twe,cloneStream:Ewe,guessContentType:Swe}=I7(),{Headers:wwe}=N2(),{isPlainObject:Iwe}=p1(),{isFormData:Awe,FormDataSerializer:Rwe}=k8(),hd=Symbol("Response internals"),D8=class D8 extends Twe{constructor(t=null,r={}){let n=new wwe(r.headers),s=t;if(Awe(s)&&!n.has("content-type")){let o=new Rwe(s);s=o.stream(),n.set("content-type",o.contentType()),!n.has("transfer-encoding")&&!n.has("content-length")&&n.set("content-length",o.length())}if(s!==null&&!n.has("content-type"))if(Iwe(s))s=JSON.stringify(s),n.set("content-type","application/json");else{let o=Swe(s);o&&n.set("content-type",o)}super(s),this[hd]={url:r.url,status:r.status||200,statusText:r.statusText||"",headers:n,httpVersion:r.httpVersion,decoded:r.decoded,counter:r.counter}}get url(){return this[hd].url||""}get status(){return this[hd].status}get statusText(){return this[hd].statusText}get ok(){return this[hd].status>=200&&this[hd].status<300}get redirected(){return this[hd].counter>0}get headers(){return this[hd].headers}get httpVersion(){return this[hd].httpVersion}get decoded(){return this[hd].decoded}static redirect(t,r=302){if(![301,302,303,307,308].includes(r))throw new Ra
`,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,sp.confirmDirExists(this._tempDir)];case 2:return u.sent(),[3,4];case 3:return n=u.sent(),console.log(this.TAG,"Failed to create directory for log file: "+(n&&n.message)),[2];case 4:return u.trys.push([4,6,,11]),[4,sp.accessAsync(this._fileFullPath,gAe.constants.F_OK)];case 5:return u.sent(),[3,11];case 6:s=u.sent(),u.label=7;case 7:return u.trys.push([7,9,,10]),[4,sp.appendFileAsync(this._fileFullPath,r)];case 8:return u.sent(),[2];case 9:return o=u.sent(),console.log(this.TAG,"Failed to put log into file: "+(s&&s.message)),[2];case 10:return[3,11];case 11:return u.trys.push([11,17,,18]),[4,sp.getShallowFileSize(this._fileFullPath)];case 12:return a=u.sent(),a>this.maxSizeBytes?[4,this._createBackupFile(r)]:[3,14];case 13:return u.sent(),[3,16];case 14:return[4,sp.appendFileAsync(this._fileFullPath,r)];case 15:u.sent(),u.label=16;case 16:return[3,18];case 17:return c=u.sent(),console.log(this.TAG,"Failed to create backup file: "+(c&&c.message)),[3,18];case 18:return[2]}})})},e.prototype._createBackupFile=function(t){return PD(this,void 0,void 0,function(){var r,n,s;return OD(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,4,5]),[4,sp.readFileAsync(this._fileFullPath)];case 1:return r=o.sent(),n=Lg.join(this._tempDir,new Date().getTime()+"."+this._logFileName),[4,sp.writeFileAsync(n,r)];case 2:return o.sent(),[3,5];case 3:return s=o.sent(),console.log("Failed to generate backup log file",s),[3,5];case 4:return sp.writeFileAsync(this._fileFullPath,t),[7];case 5:return[2]}})})},e.prototype._fileCleanupTask=function(){return PD(this,void 0,void 0,function(){var t,r,n,s,o,a=this;return OD(this,function(c){switch(c.label){case 0:return c.trys.push([0,6,,7]),[4,sp.readdirAsync(this._tempDir)];case 1:t=c.sent(),t=t.filter(function(u){return Lg.basename(u).indexOf(a._backUpNameFormat)>-1}),t.sort(function(u,f){var d=new Date(parseInt(u.split(a._backUpNameFormat)[0])),p=new Date(parseInt(f.split(a._backUpNameFormat)[0]));if(d<p)return-1;if(d>=p)return 1}),r=t.length,n=0,c.label=2;case 2:return n<r-this.maxHistory?(s=Lg.join(this._tempDir,t[n]),[4,sp.unlinkAsync(s)]):[3,5];case 3:c.sent(),c.label=4;case 4:return n++,[3,2];case 5:return[3,7];case 6:return o=c.sent(),console.log(this.TAG,"Failed to cleanup log files: "+(o&&o.message)),[3,7];case 7:return[2]}})})},e._fileCleanupTimer=null,e}();tse.exports=vAe});var I0=w((Q5t,ise)=>{"use strict";var nse=rse(),xAe=function(){function e(){}return l(e,"Logging"),e.info=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.enableDebug&&nse.getInstance().info(this.TAG+t,r)},e.warn=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.disableWarnings||nse.getInstance().warning(this.TAG+t,r)},e.enableDebug=!1,e.disableWarnings=!1,e.TAG="ApplicationInsights:",e}();ise.exports=xAe});var Y7=w(K7=>{"use strict";Object.defineProperty(K7,"__esModule",{value:!0});K7.JsonConfig=void 0;var _Ae=require("fs"),W7=require("path"),kD=I0(),bAe="APPLICATIONINSIGHTS_CONFIGURATION_FILE",CAe="APPLICATIONINSIGHTS_CONNECTION_STRING",sse="APPSETTING_",ose="APPINSIGHTS_INSTRUMENTATIONKEY",ase="APPINSIGHTS_INSTRUMENTATION_KEY",TAe="APPLICATION_INSIGHTS_DISABLE_EXTENDED_METRIC",EAe="APPLICATION_INSIGHTS_DISABLE_ALL_EXTENDED_METRICS",SAe="http_proxy",wAe="https_proxy",IAe="APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL",AAe="APPLICATION_INSIGHTS_NO_STATSBEAT",RAe="APPLICATION_INSIGHTS_NO_HTTP_AGENT_KEEP_ALIVE",PAe="APPLICATION_INSIGHTS_NO_PATCH_MODULES",OAe="APPLICATIONINSIGHTS_WEB_INSTRUMENTATION_ENABLED",kAe="APPLICATIONINSIGHTS_WEB_INSTRUMENTATION_CONNECTION_STRING",NAe="APPLICATIONINSIGHTS_WEB_INSTRUMENTATION_SOURCE",DAe="APPLICATIONINSIGHTS_WEB_SNIPPET_ENABLED",LAe="APPLICATIONINSIGHTS_WEB_SNIPPET_CONNECTION_STRING",MAe=function(){function e(){this.connectionString=process.env[CAe],this.instrumentationKey=process.env[ose]||process.env[sse+ose]||process.env[ase]||process.env[sse+ase],!this.connectionString&&this.instrumentationKey&&kD.warn("APPINSIGHTS_INSTRUMENTATIONKEY is in path of deprecation, please
`).find(n=>n.includes("IOPlatformUUID"));if(!t)return"";let r=t.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(e){JLe.diag.debug(`error reading machine id: ${e}`)}return""}l(ZLe,"getMachineId");eE.getMachineId=ZLe});var Vle=w(tE=>{"use strict";Object.defineProperty(tE,"__esModule",{value:!0});tE.getMachineId=void 0;var eMe=require("fs"),tMe=ca();async function rMe(){let e=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let t of e)try{return(await eMe.promises.readFile(t,{encoding:"utf8"})).trim()}catch(r){tMe.diag.debug(`error reading machine id: ${r}`)}return""}l(rMe,"getMachineId");tE.getMachineId=rMe});var zle=w(rE=>{"use strict";Object.defineProperty(rE,"__esModule",{value:!0});rE.getMachineId=void 0;var nMe=require("fs"),iMe=ZT(),Gle=ca();async function sMe(){try{return(await nMe.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(e){Gle.diag.debug(`error reading machine id: ${e}`)}try{return(await(0,iMe.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(e){Gle.diag.debug(`error reading machine id: ${e}`)}return""}l(sMe,"getMachineId");rE.getMachineId=sMe});var Kle=w(nE=>{"use strict";Object.defineProperty(nE,"__esModule",{value:!0});nE.getMachineId=void 0;var Wle=require("process"),oMe=ZT(),aMe=ca();async function lMe(){let e="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",t="%windir%\\System32\\REG.exe";Wle.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in Wle.env&&(t="%windir%\\sysnative\\cmd.exe /c "+t);try{let n=(await(0,oMe.execAsync)(`${t} ${e}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){aMe.diag.debug(`error reading machine id: ${r}`)}return""}l(lMe,"getMachineId");nE.getMachineId=lMe});var Yle=w(iE=>{"use strict";Object.defineProperty(iE,"__esModule",{value:!0});iE.getMachineId=void 0;var cMe=ca();async function uMe(){return cMe.diag.debug("could not read machine-id: unsupported platform"),""}l(uMe,"getMachineId");iE.getMachineId=uMe});var Xle=w(E1=>{"use strict";Object.defineProperty(E1,"__esModule",{value:!0});E1.getMachineId=void 0;var fMe=require("process"),f4;E1.getMachineId=f4;switch(fMe.platform){case"darwin":E1.getMachineId=f4=$le().getMachineId;break;case"linux":E1.getMachineId=f4=Vle().getMachineId;break;case"freebsd":E1.getMachineId=f4=zle().getMachineId;break;case"win32":E1.getMachineId=f4=Kle().getMachineId;break;default:E1.getMachineId=f4=Yle().getMachineId}});var DF=w(sE=>{"use strict";Object.defineProperty(sE,"__esModule",{value:!0});sE.hostDetectorSync=void 0;var OF=yd(),dMe=r5(),Qle=require("os"),pMe=PF(),hMe=Xle(),NF=class NF{detect(t){let r={[OF.SemanticResourceAttributes.HOST_NAME]:(0,Qle.hostname)(),[OF.SemanticResourceAttributes.HOST_ARCH]:(0,pMe.normalizeArch)((0,Qle.arch)())};return new dMe.Resource(r,this._getAsyncAttributes())}_getAsyncAttributes(){return(0,hMe.getMachineId)().then(t=>{let r={};return t&&(r[OF.SemanticResourceAttributes.HOST_ID]=t),r})}};l(NF,"HostDetectorSync");var kF=NF;sE.hostDetectorSync=new kF});var Jle=w(oE=>{"use strict";Object.defineProperty(oE,"__esModule",{value:!0});oE.hostDetector=void 0;var mMe=DF(),MF=class MF{detect(t){return Promise.resolve(mMe.hostDetectorSync.detect(t))}};l(MF,"HostDetector");var LF=MF;oE.hostDetector=new LF});var qF=w(aE=>{"use strict";Object.defineProperty(aE,"__esModule",{value:!0});aE.osDetectorSync=void 0;var Zle=yd(),gMe=r5(),ece=require("os"),yMe=PF(),BF=class BF{detect(t){let r={[Zle.SemanticResourceAttributes.OS_TYPE]:(0,yMe.normalizeType)((0,ece.platform)()),[Zle.SemanticResourceAttributes.OS_VERSION]:(0,ece.release)()};return new gMe.Resource(r)}};l(BF,"OSDetectorSync");var FF=BF;aE.osDetectorSync=new FF});var tce=w(lE=>{"use strict";Object.defineProperty(lE,"__esModule",{value:!0});lE.osDetector=void 0;var vMe=qF(),jF=class jF{detect(t){return Promise.resolve(vMe.osDetectorSync.detect(t))}};l(jF,"OSDetector");var UF=jF;lE.osDetector=new UF});var VF=w(cE=>{"use strict";Object.defineProperty(cE,"__esModule",{value:!0});cE.processDetectorSync=void 0;var xMe=ca(),S1=yd(),_Me=r5(),bMe=require("os"),$F=class $F{detect(t){let r={[S1.Sema
`+$a.inspect(this)+`
`+$a.inspect(t))):(P1.ok(r,"can't remove top context"),this._set.splice(r,1))},"exit");Pf.prototype.bindEmitter=l(function(t){P1.ok(t.on&&t.addListener&&t.emit,"can only bind real EEs");let r=this,n="context@"+this.name;function s(a){a&&(a[w6]||(a[w6]=Object.create(null)),a[w6][n]={namespace:r,context:r.active})}l(s,"attach");function o(a){if(!(a&&a[w6]))return a;let c=a,u=a[w6];return Object.keys(u).forEach(function(f){let d=u[f];c=d.namespace.bind(c,d.context)}),c}l(o,"bind"),pqe(t,s,o)},"bindEmitter");Pf.prototype.fromException=l(function(t){return t[I6]},"fromException");function hde(e){return process.namespaces[e]}l(hde,"getNamespace");function hqe(e){P1.ok(e,"namespace must be given a name."),F0&&A0(`NS-CREATING NAMESPACE (${e})`);let t=new Pf(e);return t.id=Ha,b0.createHook({init(n,s,o,a){if(Ha=b0.executionAsyncId(),t.active){if(t._contexts.set(n,t.active),F0){let c=" ".repeat(t._indent<0?0:t._indent);A0(`${c}INIT [${s}] (${e}) asyncId:${n} currentUid:${Ha} triggerId:${o} active:${$a.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} resource:${a}`)}}else if(Ha===0){let c=b0.triggerAsyncId(),u=t._contexts.get(c);if(u){if(t._contexts.set(n,u),F0){let f=" ".repeat(t._indent<0?0:t._indent);A0(`${f}INIT USING CONTEXT FROM TRIGGERID [${s}] (${e}) asyncId:${n} currentUid:${Ha} triggerId:${c} active:${$a.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} resource:${a}`)}}else if(F0){let f=" ".repeat(t._indent<0?0:t._indent);A0(`${f}INIT MISSING CONTEXT [${s}] (${e}) asyncId:${n} currentUid:${Ha} triggerId:${c} active:${$a.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} resource:${a}`)}}if(F0&&s==="PROMISE"){A0($a.inspect(a,{showHidden:!0}));let c=a.parentId,u=" ".repeat(t._indent<0?0:t._indent);A0(`${u}INIT RESOURCE-PROMISE [${s}] (${e}) parentId:${c} asyncId:${n} currentUid:${Ha} triggerId:${o} active:${$a.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} resource:${a}`)}},before(n){Ha=b0.executionAsyncId();let s;if(s=t._contexts.get(n)||t._contexts.get(Ha),s){if(F0){let o=b0.triggerAsyncId(),a=" ".repeat(t._indent<0?0:t._indent);A0(`${a}BEFORE (${e}) asyncId:${n} currentUid:${Ha} triggerId:${o} active:${$a.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} context:${$a.inspect(s)}`),t._indent+=2}t.enter(s)}else if(F0){let o=b0.triggerAsyncId(),a=" ".repeat(t._indent<0?0:t._indent);A0(`${a}BEFORE MISSING CONTEXT (${e}) asyncId:${n} currentUid:${Ha} triggerId:${o} active:${$a.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} namespace._contexts:${$a.inspect(t._contexts,{showHidden:!0,depth:2,colors:!0})}`),t._indent+=2}},after(n){Ha=b0.executionAsyncId();let s;if(s=t._contexts.get(n)||t._contexts.get(Ha),s){if(F0){let o=b0.triggerAsyncId();t._indent-=2;let a=" ".repeat(t._indent<0?0:t._indent);A0(`${a}AFTER (${e}) asyncId:${n} currentUid:${Ha} triggerId:${o} active:${$a.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} context:${$a.inspect(s)}`)}t.exit(s)}else if(F0){let o=b0.triggerAsyncId();t._indent-=2;let a=" ".repeat(t._indent<0?0:t._indent);A0(`${a}AFTER MISSING CONTEXT (${e}) asyncId:${n} currentUid:${Ha} triggerId:${o} active:${$a.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} context:${$a.inspect(s)}`)}},destroy(n){if(Ha=b0.executionAsyncId(),F0){let s=b0.triggerAsyncId(),o=" ".repeat(t._indent<0?0:t._indent);A0(`${o}DESTROY (${e}) currentUid:${Ha} asyncId:${n} triggerId:${s} active:${$a.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} context:${$a.inspect(t._contexts.get(Ha))}`)}t._contexts.delete(n)}}).enable(),process.namespaces[e]=t,t}l(hqe,"createNamespace");function mde(e){let t=hde(e);P1.ok(t,`can't delete nonexistent namespace! "`+e+'"'),P1.ok(t.id,"don't assign to process.namespaces directly! "+$a.inspect(t)),process.namespaces[e]=null}l(mde,"destroyNamespace");function mqe(){process.namespaces&&Object.keys(process.namespaces).forEach(function(e){mde(e)}),process.namespaces=Object.create(null)}l(mqe,"reset");process.namespaces={};function A0(...e){F0&&process._rawDebug(`${$a.format(...e)}`)}l(A0,"debug2")});var xde=w((o9t,vde)=>{"use strict";function gqe(){}l(gqe,"NextTick
`)},"FormatStackTrace")});var kde=w((v9t,Ode)=>{var KE=Ade();function Pde(){this.extend=new O6,this.filter=new O6,this.format=new k6,this.version=Tq().version}l(Pde,"stackChain");var Sq=!1;Pde.prototype.callSite=l(function e(t){t||(t={}),Sq=!0;var r={};Error.captureStackTrace(r,e);var n=r.stack;return Sq=!1,n=n.slice(t.slice||0),t.extend&&(n=this.extend._modify(r,n)),t.filter&&(n=this.filter._modify(r,n)),n},"collectCallSites");var $h=new Pde;function O6(){this._modifiers=[]}l(O6,"TraceModifier");O6.prototype._modify=function(e,t){for(var r=0,n=this._modifiers.length;r<n;r++)t=this._modifiers[r](e,t);return t};O6.prototype.attach=function(e){this._modifiers.push(e)};O6.prototype.deattach=function(e){var t=this._modifiers.indexOf(e);return t===-1?!1:(this._modifiers.splice(t,1),!0)};function k6(){this._formater=KE,this._previous=void 0}l(k6,"StackFormater");k6.prototype.replace=function(e){e?this._formater=e:this.restore()};k6.prototype.restore=function(){this._formater=KE,this._previous=void 0};k6.prototype._backup=function(){this._previous=this._formater};k6.prototype._roolback=function(){this._previous===KE?this.replace(void 0):this.replace(this._previous),this._previous=void 0};Error.prepareStackTrace&&$h.format.replace(Error.prepareStackTrace);var Eq=!1;function Rde(e,t){if(Sq)return t;if(Eq)return KE(e,t);var r=t.concat();r=$h.extend._modify(e,r),r=$h.filter._modify(e,r),r=r.slice(0,Error.stackTraceLimit),Object.isExtensible(e)&&Object.getOwnPropertyDescriptor(e,"callSite")===void 0&&(e.callSite={original:t,mutated:r}),Eq=!0;var n=$h.format._formater(e,r);return Eq=!1,n}l(Rde,"prepareStackTrace");Object.defineProperty(Error,"prepareStackTrace",{get:function(){return Rde},set:function(e){e===Rde?$h.format._roolback():($h.format._backup(),$h.format.replace(e))}});function Rqe(){return this.stack,this.callSite}l(Rqe,"callSiteGetter");Object.defineProperty(Error.prototype,"callSite",{get:Rqe,set:function(e){Object.defineProperty(this,"callSite",{value:e,writable:!0,configurable:!0})},configurable:!0});Ode.exports=$h});var Iq=w((_9t,wq)=>{if(global._stackChain)if(global._stackChain.version===Tq().version)wq.exports=global._stackChain;else throw new Error("Conflicting version of stack-chain found");else wq.exports=global._stackChain=kde()});var Nde=w((b9t,Aq)=>{"use strict";var Pqe=wde();if(global._asyncHook)if(global._asyncHook.version===bq().version)Aq.exports=global._asyncHook;else throw new Error("Conflicting version of async-hook-jl found");else Iq().filter.attach(function(t,r){return r.filter(function(n){let s=n.getFileName();return!(s&&s.slice(0,__dirname.length)===__dirname)})}),Aq.exports=global._asyncHook=new Pqe});var qde=w((C9t,Bde)=>{"use strict";var ol=require("util"),O1=require("assert"),Oqe=zE(),O4=Nde(),N6="cls@contexts",D6="error@context",Lde=[];for(let e in O4.providers)Lde[O4.providers[e]]=e;var W0=process.env.DEBUG_CLS_HOOKED,yl=-1;Bde.exports={getNamespace:Mde,createNamespace:kqe,destroyNamespace:Fde,reset:Nqe,ERROR_SYMBOL:D6};function Of(e){this.name=e,this.active=null,this._set=[],this.id=null,this._contexts=new Map}l(Of,"Namespace");Of.prototype.set=l(function(t,r){if(!this.active)throw new Error("No context available. ns.run() or ns.bind() must be called first.");return W0&&sl(" SETTING KEY:"+t+"="+r+" in ns:"+this.name+" uid:"+yl+" active:"+ol.inspect(this.active,!0)),this.active[t]=r,r},"set");Of.prototype.get=l(function(t){if(!this.active){W0&&sl(" GETTING KEY:"+t+"=undefined "+this.name+" uid:"+yl+" active:"+ol.inspect(this.active,!0));return}return W0&&sl(" GETTING KEY:"+t+"="+this.active[t]+" "+this.name+" uid:"+yl+" active:"+ol.inspect(this.active,!0)),this.active[t]},"get");Of.prototype.createContext=l(function(){W0&&sl(" CREATING Context: "+this.name+" uid:"+yl+" len:"+this._set.length+" active:"+ol.inspect(this.active,!0,2,!0));let t=Object.create(this.active?this.active:Object.prototype);return t._ns_name=this.name,t.id=yl,W0&&sl(" CREATED Context: "+this.name+" uid:"+yl+" len:"+this._set.length+" context:"+ol.inspect(t,!0,2,!0)),t},"createContext");Of.prototype.run=l(f
`+ol.inspect(this)+`
`+ol.inspect(t))):(O1.ok(r,"can't remove top context"),this._set.splice(r,1))},"exit");Of.prototype.bindEmitter=l(function(t){O1.ok(t.on&&t.addListener&&t.emit,"can only bind real EEs");let r=this,n="context@"+this.name;function s(a){a&&(a[N6]||(a[N6]=Object.create(null)),a[N6][n]={namespace:r,context:r.active})}l(s,"attach");function o(a){if(!(a&&a[N6]))return a;let c=a,u=a[N6];return Object.keys(u).forEach(function(f){let d=u[f];c=d.namespace.bind(c,d.context)}),c}l(o,"bind"),Oqe(t,s,o)},"bindEmitter");Of.prototype.fromException=l(function(t){return t[D6]},"fromException");function Mde(e){return process.namespaces[e]}l(Mde,"getNamespace");function kqe(e){O1.ok(e,"namespace must be given a name."),W0&&sl("CREATING NAMESPACE "+e);let t=new Of(e);return t.id=yl,O4.addHooks({init(r,n,s,o,a){yl=r,o?(t._contexts.set(r,t._contexts.get(o)),W0&&sl("PARENTID: "+e+" uid:"+r+" parent:"+o+" provider:"+s)):t._contexts.set(yl,t.active),W0&&sl("INIT "+e+" uid:"+r+" parent:"+o+" provider:"+Lde[s]+" active:"+ol.inspect(t.active,!0))},pre(r,n){yl=r;let s=t._contexts.get(r);s?(W0&&sl(" PRE "+e+" uid:"+r+" handle:"+YE(n)+" context:"+ol.inspect(s)),t.enter(s)):W0&&sl(" PRE MISSING CONTEXT "+e+" uid:"+r+" handle:"+YE(n))},post(r,n){yl=r;let s=t._contexts.get(r);s?(W0&&sl(" POST "+e+" uid:"+r+" handle:"+YE(n)+" context:"+ol.inspect(s)),t.exit(s)):W0&&sl(" POST MISSING CONTEXT "+e+" uid:"+r+" handle:"+YE(n))},destroy(r){yl=r,W0&&sl("DESTROY "+e+" uid:"+r+" context:"+ol.inspect(t._contexts.get(yl))+" active:"+ol.inspect(t.active,!0)),t._contexts.delete(r)}}),process.namespaces[e]=t,t}l(kqe,"createNamespace");function Fde(e){let t=Mde(e);O1.ok(t,`can't delete nonexistent namespace! "`+e+'"'),O1.ok(t.id,"don't assign to process.namespaces directly! "+ol.inspect(t)),process.namespaces[e]=null}l(Fde,"destroyNamespace");function Nqe(){process.namespaces&&Object.keys(process.namespaces).forEach(function(e){Fde(e)}),process.namespaces=Object.create(null)}l(Nqe,"reset");process.namespaces={};O4._state&&!O4._state.enabled&&O4.enable();function sl(e){process.env.DEBUG&&process._rawDebug(e)}l(sl,"debug2");function YE(e){if(!e)return e;if(typeof e=="function")return e.name?e.name:(e.toString().trim().match(/^function\s*([^\s(]+)/)||[])[1];if(e.constructor&&e.constructor.name)return e.constructor.name}l(YE,"getFunctionName");if(W0){Rq=Iq();for(Dde in Rq.filter._modifiers)Rq.filter.deattach(Dde)}var Rq,Dde});var Ude=w((E9t,Pq)=>{"use strict";var Dqe=ode();process&&Dqe.gte(process.versions.node,"8.0.0")?Pq.exports=yde():Pq.exports=qde()});var npe=w((Vs,rpe)=>{Vs=rpe.exports=Ea;var Qa;typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?Qa=l(function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)},"debug"):Qa=l(function(){},"debug");Vs.SEMVER_SPEC_VERSION="2.0.0";var L6=256,XE=Number.MAX_SAFE_INTEGER||9007199254740991,Oq=16,Lqe=L6-6,M6=Vs.re=[],c0=Vs.safeRe=[],un=Vs.src=[],va=0,Mq="[a-zA-Z0-9-]",kq=[["\\s",1],["\\d",L6],[Mq,Lqe]];function rS(e){for(var t=0;t<kq.length;t++){var r=kq[t][0],n=kq[t][1];e=e.split(r+"*").join(r+"{0,"+n+"}").split(r+"+").join(r+"{1,"+n+"}")}return e}l(rS,"makeSafeRe");var k4=va++;un[k4]="0|[1-9]\\d*";var N4=va++;un[N4]="\\d+";var Fq=va++;un[Fq]="\\d*[a-zA-Z-]"+Mq+"*";var Hde=va++;un[Hde]="("+un[k4]+")\\.("+un[k4]+")\\.("+un[k4]+")";var $de=va++;un[$de]="("+un[N4]+")\\.("+un[N4]+")\\.("+un[N4]+")";var Nq=va++;un[Nq]="(?:"+un[k4]+"|"+un[Fq]+")";var Dq=va++;un[Dq]="(?:"+un[N4]+"|"+un[Fq]+")";var Bq=va++;un[Bq]="(?:-("+un[Nq]+"(?:\\."+un[Nq]+")*))";var qq=va++;un[qq]="(?:-?("+un[Dq]+"(?:\\."+un[Dq]+")*))";var Lq=va++;un[Lq]=Mq+"+";var B6=va++;un[B6]="(?:\\+("+un[Lq]+"(?:\\."+un[Lq]+")*))";var Uq=va++,Vde="v?"+un[Hde]+un[Bq]+"?"+un[B6]+"?";un[Uq]="^"+Vde+"$";var jq="[v=\\s]*"+un[$de]+un[qq]+"?"+un[B6]+"?",Hq=va++;un[Hq]="^"+jq+"$";var B4=va++;un[B4]="((?:<|>)?=?)";var QE=va++;un[QE]=un[N4]+"|x|X|\\*";var JE=va++;un[JE]=un[k4]+"|x|X|\\*";var b5=va++;un[b5]="[v=\\s]*("+un[JE]+")(?:\\.("+un[JE]+")(?:\\.("+un[JE]+")(?:"+un[Bq]+")?"+un[B6]+"
`)==t.length-1&&(t=t.substring(0,t.length-1)),r.trackTrace({message:t,severity:e.data.stderr?pS.SeverityLevel.Warning:pS.SeverityLevel.Information}))})},"subscriber");function $Ue(e,t){if(e){var r=Wh.find(function(n){return n==t});if(r)return;Wh.length===0&&hS.channel.subscribe("console",uU,hS.trueFilter,function(n,s){var o=t.getStatsbeat();o&&o.addInstrumentation(HUe.StatsbeatInstrumentation.CONSOLE)}),Wh.push(t)}else Wh=Wh.filter(function(n){return n!=t}),Wh.length===0&&hS.channel.unsubscribe("console",uU)}l($Ue,"enable");H4.enable=$Ue;function VUe(){hS.channel.unsubscribe("console",uU),Wh=[]}l(VUe,"dispose");H4.dispose=VUe});var Tpe=w(V4=>{"use strict";Object.defineProperty(V4,"__esModule",{value:!0});V4.dispose=V4.enable=void 0;var $4=Dc(),GUe=K0(),mS=z0(),Kh=[],zUe={10:$4.SeverityLevel.Verbose,20:$4.SeverityLevel.Verbose,30:$4.SeverityLevel.Information,40:$4.SeverityLevel.Warning,50:$4.SeverityLevel.Error,60:$4.SeverityLevel.Critical},fU=l(function(e){var t=e.data.result,r=zUe[e.data.level];Kh.forEach(function(n){try{var s=JSON.parse(t);if(s.err){var o=new Error(s.err.message);if(o.name=s.err.name,o.stack=s.err.stack,n.config.enableLoggerErrorToTrace){n.trackTrace({message:t,severity:r});return}n.trackException({exception:o});return}}catch{}n.trackTrace({message:t,severity:r})})},"subscriber");function WUe(e,t){if(e){var r=Kh.find(function(n){return n==t});if(r)return;Kh.length===0&&mS.channel.subscribe("bunyan",fU,mS.trueFilter,function(n,s){var o=t.getStatsbeat();o&&o.addInstrumentation(GUe.StatsbeatInstrumentation.BUNYAN)}),Kh.push(t)}else Kh=Kh.filter(function(n){return n!=t}),Kh.length===0&&mS.channel.unsubscribe("bunyan",fU)}l(WUe,"enable");V4.enable=WUe;function KUe(){mS.channel.unsubscribe("bunyan",fU),Kh=[]}l(KUe,"dispose");V4.dispose=KUe});var Epe=w(G4=>{"use strict";Object.defineProperty(G4,"__esModule",{value:!0});G4.dispose=G4.enable=void 0;var YUe=K0(),sc=Dc(),gS=z0(),Yh=[],XUe={syslog:function(e){var t={emerg:sc.SeverityLevel.Critical,alert:sc.SeverityLevel.Critical,crit:sc.SeverityLevel.Critical,error:sc.SeverityLevel.Error,warning:sc.SeverityLevel.Warning,notice:sc.SeverityLevel.Information,info:sc.SeverityLevel.Information,debug:sc.SeverityLevel.Verbose};return t[e]===void 0?sc.SeverityLevel.Information:t[e]},npm:function(e){var t={error:sc.SeverityLevel.Error,warn:sc.SeverityLevel.Warning,info:sc.SeverityLevel.Information,verbose:sc.SeverityLevel.Verbose,debug:sc.SeverityLevel.Verbose,silly:sc.SeverityLevel.Verbose};return t[e]===void 0?sc.SeverityLevel.Information:t[e]},unknown:function(e){return sc.SeverityLevel.Information}},dU=l(function(e){var t=e.data.message,r=XUe[e.data.levelKind](e.data.level);Yh.forEach(function(n){t instanceof Error&&!n.config.enableLoggerErrorToTrace?n.trackException({exception:t,properties:e.data.meta}):t instanceof Error?n.trackTrace({message:t.toString(),severity:r,properties:e.data.meta}):n.trackTrace({message:t,severity:r,properties:e.data.meta})})},"subscriber");function QUe(e,t){if(e){var r=Yh.find(function(n){return n==t});if(r)return;Yh.length===0&&gS.channel.subscribe("winston",dU,gS.trueFilter,function(n,s){var o=t.getStatsbeat();o&&o.addInstrumentation(YUe.StatsbeatInstrumentation.WINSTON)}),Yh.push(t)}else Yh=Yh.filter(function(n){return n!=t}),Yh.length===0&&gS.channel.unsubscribe("winston",dU)}l(QUe,"enable");G4.enable=QUe;function JUe(){gS.channel.unsubscribe("winston",dU),Yh=[]}l(JUe,"dispose");G4.dispose=JUe});var wpe=w((V9t,Spe)=>{"use strict";var ZUe=PE(),eje=function(){function e(t){if(e.INSTANCE)throw new Error("Console logging adapter tracking should be configured from the applicationInsights object");this._client=t,e.INSTANCE=this}return l(e,"AutoCollectConsole"),e.prototype.enable=function(t,r){ZUe.IsInitialized&&(Cpe().enable(t&&r,this._client),Tpe().enable(t,this._client),Epe().enable(t,this._client))},e.prototype.isInitialized=function(){return this._isInitialized},e.prototype.dispose=function(){e.INSTANCE=null,this.enable(!1,!1)},e._methodNames=["debug","info","log","warn","error"],e}();Spe.exports=eje});var Ape=w((z9t,Ipe)=>{"use strict";
src: "https://js.monitor.azure.com/scripts/b/ai.2.min.js", // The SDK URL Source\r
// name: "appInsights", // Global SDK Instance name defaults to "appInsights" when not supplied\r
// ld: 0, // Defines the load delay (in ms) before attempting to load the sdk. -1 = block page load and add to head. (default) = 0ms load after timeout,\r
// useXhr: 1, // Use XHR instead of fetch to report failures (if available),\r
// crossOrigin: "anonymous", // When supplied this will add the provided value as the cross origin attribute on the script tag\r
// onInit: null, // Once the application insights instance has loaded and initialized this callback function will be called with 1 argument -- the sdk instance (DO NOT ADD anything to the sdk.queue -- As they won't get called)\r
cfg: { // Application Insights Configuration\r
instrumentationKey: "INSTRUMENTATION_KEY"\r
}});`;e.webSnippet=t,Object.defineProperty(e,"__esModule",{value:!0})})});var Kpe=w((u_t,Wpe)=>{"use strict";var $pe=require("http"),Vpe=require("https"),K4=require("zlib"),xp=I0(),Df=Fpe(),Gpe=Bpe(),H6=K0(),zpe=mU(),Lje=Hpe(),Mje=function(){function e(t){var r;if(this._isIkeyValid=!0,e.INSTANCE)throw new Error("Web snippet injection should be configured from the applicationInsights object");e.INSTANCE=this,e._aiUrl=H6.WEB_INSTRUMENTATION_DEFAULT_SOURCE,e._aiDeprecatedUrl=H6.WEB_INSTRUMENTATION_DEPRECATED_SOURCE;var n=this._getWebSnippetIkey((r=t.config)===null||r===void 0?void 0:r.webInstrumentationConnectionString);this._webInstrumentationIkey=n||t.config.instrumentationKey,this._clientWebInstrumentationConfig=t.config.webInstrumentationConfig,this._clientWebInstrumentationSrc=t.config.webInstrumentationSrc,this._statsbeat=t.getStatsbeat()}return l(e,"WebSnippet"),e.prototype.enable=function(t,r){this._isEnabled=t,this._webInstrumentationIkey=this._getWebSnippetIkey(r)||this._webInstrumentationIkey,e._snippet=this._getWebInstrumentationReplacedStr(),this._isEnabled&&!this._isInitialized&&this._isIkeyValid?(this._statsbeat&&this._statsbeat.addFeature(H6.StatsbeatFeature.WEB_SNIPPET),this._initialize()):this._isEnabled||this._statsbeat&&this._statsbeat.removeFeature(H6.StatsbeatFeature.WEB_SNIPPET)},e.prototype.isInitialized=function(){return this._isInitialized},e.prototype._getWebSnippetIkey=function(t){var r=null;try{var n=zpe.parse(t),s=n.instrumentationkey||"";zpe.isIkeyValid(s)?(this._isIkeyValid=!0,r=s):(this._isIkeyValid=!1,xp.info("Invalid web Instrumentation connection string, web Instrumentation is not enabled."))}catch(o){xp.info("get web snippet ikey error: "+o)}return r},e.prototype._getWebInstrumentationReplacedStr=function(){var t=this._getClientWebInstrumentationConfigStr(this._clientWebInstrumentationConfig),r=Gpe.getOsPrefix(),n=Gpe.getResourceProvider(),s=this._webInstrumentationIkey+`",\r
`+t+` disableIkeyDeprecationMessage: true,\r
sdkExtension: "`+n+r+"d_n_",o=Lje.webSnippet.replace("INSTRUMENTATION_KEY",s);return this._clientWebInstrumentationSrc?o.replace(H6.WEB_INSTRUMENTATION_DEFAULT_SOURCE+".2.min.js",this._clientWebInstrumentationSrc):o},e.prototype._getClientWebInstrumentationConfigStr=function(t){var r="";try{t!=null&&t.length>0&&t.forEach(function(n){var s=n.name;if(s!==void 0){var o=n.value,a="";switch(typeof o){case"function":break;case"object":break;case"string":a=" "+s+': "'+o+`",\r
`,r+=a;break;default:a=" "+s+": "+o+`,\r
`,r+=a;break}}})}catch{this._isEnabled=!1,xp.info("Parse client web instrumentation error. Web Instrumentation is disabled")}return r},e.prototype._initialize=function(){this._isInitialized=!0;var t=$pe.createServer,r=Vpe.createServer,n=this._isEnabled;$pe.createServer=function(s){var o=s;return o&&(s=l(function(a,c){var u=c.write,f=a.method=="GET";c.write=l(function(h,m,g){try{if(n&&f){var y=Df.getContentEncodingFromHeaders(c),v=void 0;if(typeof m=="string"&&(v=m),y==null)e.INSTANCE.ValidateInjection(c,h)&&(arguments[0]=e.INSTANCE.InjectWebSnippet(c,h,void 0,v));else if(y.length){var _=y[0];arguments[0]=e.INSTANCE.InjectWebSnippet(c,h,_)}}}catch(x){xp.warn("Inject snippet error: "+x)}return u.apply(c,arguments)},"wrap");var d=c.end;return c.end=l(function(h,m,g){if(n&&f)try{if(n&&f){var y=Df.getContentEncodingFromHeaders(c),v=void 0;if(typeof m=="string"&&(v=m),y==null)e.INSTANCE.ValidateInjection(c,h)&&(arguments[0]=e.INSTANCE.InjectWebSnippet(c,h,void 0,v));else if(y.length){var _=y[0];arguments[0]=e.INSTANCE.InjectWebSnippet(c,h,_)}}}catch(x){xp.warn("Inject snipet error: "+x)}return d.apply(c,arguments)},"wrap"),o(a,c)},"requestListener")),t(s)},Vpe.createServer=function(s,o){var a=o;if(a)return o=l(function(c,u){var f=c.method=="GET",d=u.write,p=u.end;return u.write=l(function(m,g,y){try{if(n&&f){var v=Df.getContentEncodingFromHeaders(u),_=void 0;if(typeof g=="string"&&(_=g),v==null)e.INSTANCE.ValidateInjection(u,m)&&(arguments[0]=this.InjectWebSnippet(u,m,void 0,_));else if(v.length){var x=v[0];arguments[0]=e.INSTANCE.InjectWebSnippet(u,m,x)}}}catch(b){xp.warn("Inject snippet error: "+b)}return d.apply(u,arguments)},"wrap"),u.end=l(function(m,g,y){try{if(n&&f){var v=Df.getContentEncodingFromHeaders(u),_=void 0;if(typeof g=="string"&&(_=g),v==null)e.INSTANCE.ValidateInjection(u,m)&&(arguments[0]=e.INSTANCE.InjectWebSnippet(u,m,void 0,_));else if(v.length){var x=v[0];arguments[0]=e.INSTANCE.InjectWebSnippet(u,m,x)}}}catch(b){xp.warn("Inject snippet error: "+b)}return p.apply(u,arguments)},"wrap"),a(c,u)},"httpsRequestListener"),r(s,o)}},e.prototype.ValidateInjection=function(t,r){try{if(!t||!r||t.statusCode!=200)return!1;var n=Df.isContentTypeHeaderHtml(t);if(!n)return!1;var s=r.slice().toString();if(s.indexOf("<head>")>=0&&s.indexOf("</head>")>=0&&s.indexOf(e._aiUrl)<0&&s.indexOf(e._aiDeprecatedUrl)<0)return!0}catch(o){xp.info("validate injections error: "+o)}return!1},e.prototype.InjectWebSnippet=function(t,r,n,s){try{var o=!!n;if(o)t.removeHeader("Content-Length"),r=this._getInjectedCompressBuffer(t,r,n),t.setHeader("Content-Length",r.length);else{var a=r.toString(),c=a.indexOf("</head>");if(c<0)return r;var u=Df.insertSnippetByIndex(c,a,e._snippet);if(typeof r=="string")t.removeHeader("Content-Length"),r=u,t.setHeader("Content-Length",Buffer.byteLength(r));else if(Buffer.isBuffer(r)){var f=s||"utf8",d=Df.isBufferType(r,f);if(d){t.removeHeader("Content-Length");var p=Buffer.from(u).toString(f);r=Buffer.from(p,f),t.setHeader("Content-Length",r.length)}}}}catch(h){xp.warn("Failed to inject web snippet and change content-lenght headers. Exception:"+h)}return r},e.prototype._getInjectedCompressBuffer=function(t,r,n){try{switch(n){case Df.contentEncodingMethod.GZIP:var s=K4.gunzipSync(r);if(this.ValidateInjection(t,s)){var o=this.InjectWebSnippet(t,s);r=K4.gzipSync(o)}break;case Df.contentEncodingMethod.DEFLATE:var a=K4.inflateSync(r);if(this.ValidateInjection(t,a)){var c=this.InjectWebSnippet(t,a);r=K4.deflateSync(c)}break;case Df.contentEncodingMethod.BR:var u=Df.getBrotliDecompressSync(K4),f=Df.getBrotliCompressSync(K4);if(u&&f){var d=u(r);if(this.ValidateInjection(t,d)){var p=this.InjectWebSnippet(t,d);r=f(p)}break}}}catch(h){xp.info("get web injection compress buffer error: "+h)}return r},e.prototype.dispose=function(){e.INSTANCE=null,this.enable(!1),this._isInitialized=!1},e}();Wpe.exports=Mje});var Xpe=w((yU,Ype)=>{"use strict";var Fje=yU&&yU.__extends||function(){var e=l(function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var o in s)Obj
`}):n[0].stack&&n[0].stack.length>0&&(s=n[0].stack),o=n[0].message,a=n[0].typeName);var c=Mf(Mf({},r),{Exception:s,ExceptionMessage:o,ExceptionType:a});return c},e.createQuickPulseRequestDocument=function(t){var r=e.createQuickPulseDocument(t),n=t.data.baseData,s=Mf(Mf({},r),{Name:n.name,Success:n.success,Duration:n.duration,ResponseCode:n.responseCode,OperationName:n.name});return s},e.createQuickPulseDependencyDocument=function(t){var r=e.createQuickPulseDocument(t),n=t.data.baseData,s=Mf(Mf({},r),{Name:n.name,Target:n.target,Success:n.success,Duration:n.duration,ResultCode:n.resultCode,CommandName:n.data,OperationName:r.OperationId,DependencyTypeName:n.type});return s},e.createQuickPulseDocument=function(t){var r,n,s,o;t.data.baseType?(n=h1e.TelemetryTypeStringToQuickPulseType[t.data.baseType],r=h1e.TelemetryTypeStringToQuickPulseDocumentType[t.data.baseType]):SHe.warn("Document type invalid; not sending live metric document",t.data.baseType),s=t.tags[e.keys.operationId],o=e.aggregateProperties(t);var a={DocumentType:r,__type:n,OperationId:s,Version:"1.0",Properties:o};return a},e.aggregateProperties=function(t){var r=[],n=t.data.baseData.measurements||{};for(var s in n)if(n.hasOwnProperty(s)){var o=n[s],a={key:s,value:o};r.push(a)}var c=t.data.baseData.properties||{};for(var s in c)if(c.hasOwnProperty(s)){var o=c[s],a={key:s,value:o};r.push(a)}return r},e.keys=new k5.ContextTagKeys,e}();m1e.exports=IHe});var v1e=w((N_t,y1e)=>{"use strict";var AHe=l(function(){return(Date.now()+621355968e5)*1e4},"getTransmissionTime");y1e.exports={getTransmissionTime:AHe}});var C1e=w((W6,b1e)=>{"use strict";var x1e=W6&&W6.__awaiter||function(e,t,r,n){function s(o){return o instanceof r?o:new r(function(a){a(o)})}return l(s,"adopt"),new(r||(r=Promise))(function(o,a){function c(d){try{f(n.next(d))}catch(p){a(p)}}l(c,"fulfilled");function u(d){try{f(n.throw(d))}catch(p){a(p)}}l(u,"rejected");function f(d){d.done?o(d.value):s(d.value).then(c,u)}l(f,"step"),f((n=n.apply(e,t||[])).next())})},_1e=W6&&W6.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(f){return function(d){return u([f,d])}}function u(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,s&&(o=f[0]&2?s.return:f[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,f[1])).done)return o;switch(s=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,s=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){r.label=f[1];break}if(f[0]===6&&r.label<o[1]){r.label=o[1],o=f;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(f);break}o[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(d){f=[6,d],s=0}finally{n=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},RHe=require("https"),PHe=Z4(),OU=I0(),OHe=v1e(),kU=Bl(),kHe=require("url"),Ff={method:"POST",time:"x-ms-qps-transmission-time",pollingIntervalHint:"x-ms-qps-service-polling-interval-hint",endpointRedirect:"x-ms-qps-service-endpoint-redirect-v2",instanceName:"x-ms-qps-instance-name",streamId:"x-ms-qps-stream-id",machineName:"x-ms-qps-machine-name",roleName:"x-ms-qps-role-name",streamid:"x-ms-qps-stream-id",invariantVersion:"x-ms-qps-invariant-version",subscribed:"x-ms-qps-subscribed"},NHe=function(){function e(t,r){this._config=t,this._consecutiveErrors=0,this._getAuthorizationHandler=r}return l(e,"QuickPulseSender"),e.prototype.ping=function(t,r,n){var s=[{name:Ff.streamId,value:t.StreamId},{name:Ff.machineName,value:t.MachineName},{name:Ff.roleName,value:t.RoleName},{name:Ff.instanceName,value:t.Instance},{name:Ff.invariantVersion,value:t.InvariantVersion.toString()}];this._submitData(t,r,n,"ping",s)},e.prototype.post=function(t,r,n){return x1e(this,void 0,void 0,function(){return _1e
`;ka.DEFAULT_CONTENT_TYPE="application/octet-stream";ka.prototype.append=function(e,t,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=nj.prototype.append.bind(this);if(typeof t=="number"&&(t=""+t),Phe.isArray(t)){this._error(new Error("Arrays are not supported."));return}var s=this._multiPartHeader(e,t,r),o=this._multiPartFooter();n(s),n(t),n(o),this._trackLength(s,t,r)};ka.prototype._trackLength=function(e,t,r){var n=0;r.knownLength!=null?n+=+r.knownLength:Buffer.isBuffer(t)?n=t.length:typeof t=="string"&&(n=Buffer.byteLength(t)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(e)+ka.LINE_BREAK.length,!(!t||!t.path&&!(t.readable&&t.hasOwnProperty("httpVersion"))&&!(t instanceof V$e))&&(r.knownLength||this._valuesToMeasure.push(t))};ka.prototype._lengthRetriever=function(e,t){e.hasOwnProperty("fd")?e.end!=null&&e.end!=1/0&&e.start!=null?t(null,e.end+1-(e.start?e.start:0)):$$e.stat(e.path,function(r,n){var s;if(r){t(r);return}s=n.size-(e.start?e.start:0),t(null,s)}):e.hasOwnProperty("httpVersion")?t(null,+e.headers["content-length"]):e.hasOwnProperty("httpModule")?(e.on("response",function(r){e.pause(),t(null,+r.headers["content-length"])}),e.resume()):t("Unknown stream")};ka.prototype._multiPartHeader=function(e,t,r){if(typeof r.header=="string")return r.header;var n=this._getContentDisposition(t,r),s=this._getContentType(t,r),o="",a={"Content-Disposition":["form-data",'name="'+e+'"'].concat(n||[]),"Content-Type":[].concat(s||[])};typeof r.header=="object"&&rj(a,r.header);var c;for(var u in a)a.hasOwnProperty(u)&&(c=a[u],c!=null&&(Array.isArray(c)||(c=[c]),c.length&&(o+=u+": "+c.join("; ")+ka.LINE_BREAK)));return"--"+this.getBoundary()+ka.LINE_BREAK+o+ka.LINE_BREAK};ka.prototype._getContentDisposition=function(e,t){var r,n;return typeof t.filepath=="string"?r=ej.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e.name||e.path?r=ej.basename(t.filename||e.name||e.path):e.readable&&e.hasOwnProperty("httpVersion")&&(r=ej.basename(e.client._httpMessage.path||"")),r&&(n='filename="'+r+'"'),n};ka.prototype._getContentType=function(e,t){var r=t.contentType;return!r&&e.name&&(r=tj.lookup(e.name)),!r&&e.path&&(r=tj.lookup(e.path)),!r&&e.readable&&e.hasOwnProperty("httpVersion")&&(r=e.headers["content-type"]),!r&&(t.filepath||t.filename)&&(r=tj.lookup(t.filepath||t.filename)),!r&&typeof e=="object"&&(r=ka.DEFAULT_CONTENT_TYPE),r};ka.prototype._multiPartFooter=function(){return function(e){var t=ka.LINE_BREAK,r=this._streams.length===0;r&&(t+=this._lastBoundary()),e(t)}.bind(this)};ka.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+ka.LINE_BREAK};ka.prototype.getHeaders=function(e){var t,r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)e.hasOwnProperty(t)&&(r[t.toLowerCase()]=e[t]);return r};ka.prototype.setBoundary=function(e){this._boundary=e};ka.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};ka.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),r=0,n=this._streams.length;r<n;r++)typeof this._streams[r]!="function"&&(Buffer.isBuffer(this._streams[r])?e=Buffer.concat([e,this._streams[r]]):e=Buffer.concat([e,Buffer.from(this._streams[r])]),(typeof this._streams[r]!="string"||this._streams[r].substring(2,t.length+2)!==t)&&(e=Buffer.concat([e,Buffer.from(ka.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};ka.prototype._generateBoundary=function(){for(var e="--------------------------",t=0;t<24;t++)e+=Math.floor(Math.random()*10).toString(16);this._boundary=e};ka.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e};ka.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};ka.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;if(this._streams.length&&(t+=this._lastBoundary().length),!this._valuesToMeasur
`).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}l(sj,"isSecureEndpoint");function $S(e,t){return new $S.Agent(e,t)}l($S,"createAgent");(function(e){let r=class r extends W$e.EventEmitter{constructor(s,o){super();let a=o;typeof s=="function"?this.callback=s:s&&(a=s),this.timeout=null,a&&typeof a.timeout=="number"&&(this.timeout=a.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=1/0,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return typeof this.explicitDefaultPort=="number"?this.explicitDefaultPort:sj()?443:80}set defaultPort(s){this.explicitDefaultPort=s}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:sj()?"https:":"http:"}set protocol(s){this.explicitProtocol=s}callback(s,o,a){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(s,o){let a=Object.assign({},o);typeof a.secureEndpoint!="boolean"&&(a.secureEndpoint=sj()),a.host==null&&(a.host="localhost"),a.port==null&&(a.port=a.secureEndpoint?443:80),a.protocol==null&&(a.protocol=a.secureEndpoint?"https:":"http:"),a.host&&a.path&&delete a.path,delete a.agent,delete a.hostname,delete a._defaultAgent,delete a.defaultPort,delete a.createConnection,s._last=!0,s.shouldKeepAlive=!1;let c=!1,u=null,f=a.timeout||this.timeout,d=l(g=>{s._hadError||(s.emit("error",g),s._hadError=!0)},"onerror"),p=l(()=>{u=null,c=!0;let g=new Error(`A "socket" was not created for HTTP request before ${f}ms`);g.code="ETIMEOUT",d(g)},"ontimeout"),h=l(g=>{c||(u!==null&&(clearTimeout(u),u=null),d(g))},"callbackError"),m=l(g=>{if(c)return;if(u!=null&&(clearTimeout(u),u=null),X$e(g)){J6("Callback returned another Agent instance %o",g.constructor.name),g.addRequest(s,a);return}if(g){g.once("free",()=>{this.freeSocket(g,a)}),s.onSocket(g);return}let y=new Error(`no Duplex stream was returned to agent-base for \`${s.method} ${s.path}\``);d(y)},"onsocket");if(typeof this.callback!="function"){d(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(J6("Converting legacy callback function to promise"),this.promisifiedCallback=Y$e.default(this.callback)):this.promisifiedCallback=this.callback),typeof f=="number"&&f>0&&(u=setTimeout(p,f)),"port"in a&&typeof a.port!="number"&&(a.port=Number(a.port));try{J6("Resolving socket for %o request: %o",a.protocol,`${s.method} ${s.path}`),Promise.resolve(this.promisifiedCallback(s,a)).then(m,h)}catch(g){Promise.reject(g).catch(h)}}freeSocket(s,o){J6("Freeing socket %o %o",s.constructor.name,o),s.destroy()}destroy(){J6("Destroying agent %o",this.constructor.name)}};l(r,"Agent");let t=r;e.Agent=t,e.prototype=e.Agent.prototype})($S||($S={}));Lhe.exports=$S});var Mhe=w(ex=>{"use strict";var Q$e=ex&&ex.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ex,"__esModule",{value:!0});var J$e=Q$e(dd()),Z6=J$e.default("https-proxy-agent:parse-proxy-response");function Z$e(e){return new Promise((t,r)=>{let n=0,s=[];function o(){let p=e.read();p?d(p):e.once("readable",o)}l(o,"read");function a(){e.removeListener("end",u),e.removeListener("error",f),e.removeListener("close",c),e.removeListener("readable",o)}l(a,"cleanup");function c(p){Z6("onclose had error %o",p)}l(c,"onclose");function u(){Z6("onend")}l(u,"onend");function f(p){a(),Z6("onerror %o",p),r(p)}l(f,"onerror");function d(p){s.push(p),n+=p.length;let h=Buffer.concat(s,n);if(h.indexOf(`\r
\r
`)===-1){Z6("have not received end of HTTP headers yet..."),o();return}let g=h.toString("ascii",0,h.indexOf(`\r
`)),y=+g.split(" ")[1];Z6("got proxy server response: %o",g),t({statusCode:y,buffered:h})}l(d,"ondata"),e.on("error",f),e.on("close",c),e.on("end",u),o()})}l(Z$e,"parseProxyResponse");ex.default=Z$e});var qhe=w(N5=>{"use strict";var eVe=N5&&N5.__awaiter||function(e,t,r,n){function s(o){return o instanceof r?o:new r(function(a){a(o)})}return l(s,"adopt"),new(r||(r=Promise))(function(o,a){function c(d){try{f(n.next(d))}catch(p){a(p)}}l(c,"fulfilled");function u(d){try{f(n.throw(d))}catch(p){a(p)}}l(u,"rejected");function f(d){d.done?o(d.value):s(d.value).then(c,u)}l(f,"step"),f((n=n.apply(e,t||[])).next())})},iy=N5&&N5.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(N5,"__esModule",{value:!0});var Fhe=iy(require("net")),Bhe=iy(require("tls")),tVe=iy(require("url")),rVe=iy(require("assert")),nVe=iy(dd()),iVe=aj(),sVe=iy(Mhe()),tx=nVe.default("https-proxy-agent:agent"),cj=class cj extends iVe.Agent{constructor(t){let r;if(typeof t=="string"?r=tVe.default.parse(t):r=t,!r)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");tx("creating new HttpsProxyAgent instance: %o",r),super(r);let n=Object.assign({},r);this.secureProxy=r.secureProxy||lVe(n.protocol),n.host=n.hostname||n.host,typeof n.port=="string"&&(n.port=parseInt(n.port,10)),!n.port&&n.host&&(n.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in n)&&(n.ALPNProtocols=["http 1.1"]),n.host&&n.path&&(delete n.path,delete n.pathname),this.proxy=n}callback(t,r){return eVe(this,void 0,void 0,function*(){let{proxy:n,secureProxy:s}=this,o;s?(tx("Creating `tls.Socket`: %o",n),o=Bhe.default.connect(n)):(tx("Creating `net.Socket`: %o",n),o=Fhe.default.connect(n));let a=Object.assign({},n.headers),u=`CONNECT ${`${r.host}:${r.port}`} HTTP/1.1\r
`;n.auth&&(a["Proxy-Authorization"]=`Basic ${Buffer.from(n.auth).toString("base64")}`);let{host:f,port:d,secureEndpoint:p}=r;aVe(d,p)||(f+=`:${d}`),a.Host=f,a.Connection="close";for(let v of Object.keys(a))u+=`${v}: ${a[v]}\r
`;let h=sVe.default(o);o.write(`${u}\r
`);let{statusCode:m,buffered:g}=yield h;if(m===200){if(t.once("socket",oVe),r.secureEndpoint){tx("Upgrading socket connection to TLS");let v=r.servername||r.host;return Bhe.default.connect(Object.assign(Object.assign({},cVe(r,"host","hostname","path","port")),{socket:o,servername:v}))}return o}o.destroy();let y=new Fhe.default.Socket({writable:!1});return y.readable=!0,t.once("socket",v=>{tx("replaying proxy buffer for failed request"),rVe.default(v.listenerCount("data")>0),v.push(g),v.push(null)}),y})}};l(cj,"HttpsProxyAgent");var lj=cj;N5.default=lj;function oVe(e){e.resume()}l(oVe,"resume");function aVe(e,t){return!!(!t&&e===80||t&&e===443)}l(aVe,"isDefaultPort");function lVe(e){return typeof e=="string"?/^https:?$/i.test(e):!1}l(lVe,"isHTTPS");function cVe(e,...t){let r={},n;for(n in e)t.includes(n)||(r[n]=e[n]);return r}l(cVe,"omit")});var jhe=w((dj,Uhe)=>{"use strict";var uVe=dj&&dj.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},uj=uVe(qhe());function fj(e){return new uj.default(e)}l(fj,"createHttpsProxyAgent");(function(e){e.HttpsProxyAgent=uj.default,e.prototype=uj.default.prototype})(fj||(fj={}));Uhe.exports=fj});var Hhe=w(pj=>{"use strict";Object.defineProperty(pj,"__esModule",{value:!0});function fVe(e,t,{signal:r}={}){return new Promise((n,s)=>{function o(){r==null||r.removeEventListener("abort",o),e.removeListener(t,a),e.removeListener("error",c)}l(o,"cleanup");function a(...u){o(),n(u)}l(a,"onEvent");function c(u){o(),s(u)}l(c,"onError"),r==null||r.addEventListener("abort",o),e.on(t,a),e.on("error",c)})}l(fVe,"once");pj.default=fVe});var $he=w(D5=>{"use strict";var dVe=D5&&D5.__awaiter||function(e,t,r,n){function s(o){return o instanceof r?o:new r(function(a){a(o)})}return l(s,"adopt"),new(r||(r=Promise))(function(o,a){function c(d){try{f(n.next(d))}catch(p){a(p)}}l(c,"fulfilled");function u(d){try{f(n.throw(d))}catch(p){a(p)}}l(u,"rejected");function f(d){d.done?o(d.value):s(d.value).then(c,u)}l(f,"step"),f((n=n.apply(e,t||[])).next())})},rx=D5&&D5.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(D5,"__esModule",{value:!0});var pVe=rx(require("net")),hVe=rx(require("tls")),hj=rx(require("url")),mVe=rx(dd()),gVe=rx(Hhe()),yVe=aj(),sm=(0,mVe.default)("http-proxy-agent");function vVe(e){return typeof e=="string"?/^https:?$/i.test(e):!1}l(vVe,"isHTTPS");var gj=class gj extends yVe.Agent{constructor(t){let r;if(typeof t=="string"?r=hj.default.parse(t):r=t,!r)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");sm("Creating new HttpProxyAgent instance: %o",r),super(r);let n=Object.assign({},r);this.secureProxy=r.secureProxy||vVe(n.protocol),n.host=n.hostname||n.host,typeof n.port=="string"&&(n.port=parseInt(n.port,10)),!n.port&&n.host&&(n.port=this.secureProxy?443:80),n.host&&n.path&&(delete n.path,delete n.pathname),this.proxy=n}callback(t,r){return dVe(this,void 0,void 0,function*(){let{proxy:n,secureProxy:s}=this,o=hj.default.parse(t.path);o.protocol||(o.protocol="http:"),o.hostname||(o.hostname=r.hostname||r.host||null),o.port==null&&typeof r.port&&(o.port=String(r.port)),o.port==="80"&&(o.port=""),t.path=hj.default.format(o),n.auth&&t.setHeader("Proxy-Authorization",`Basic ${Buffer.from(n.auth).toString("base64")}`);let a;if(s?(sm("Creating `tls.Socket`: %o",n),a=hVe.default.connect(n)):(sm("Creating `net.Socket`: %o",n),a=pVe.default.connect(n)),t._header){let c,u;sm("Regenerating stored HTTP header string for request"),t._header=null,t._implicitHeader(),t.output&&t.output.length>0?(sm("Patching connection write() output buffer with updated header"),c=t.output[0],u=c.indexOf(`\r
\r
`)+4,t.output[0]=t._header+c.substring(u),sm("Output buffer: %o",t.output)):t.outputData&&t.outputData.length>0&&(sm("Patching connection write() output buffer with updated header"),c=t.outputData[0].data,u=c.indexOf(`\r
\r
`)+4,t.outputData[0].data=t._header+c.substring(u),sm("Output buffer: %o",t.outputData[0].data))}return yield(0,gVe.default)(a,"connect"),a})}};l(gj,"HttpProxyAgent");var mj=gj;D5.default=mj});var Ghe=w((xj,Vhe)=>{"use strict";var xVe=xj&&xj.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},yj=xVe($he());function vj(e){return new yj.default(e)}l(vj,"createHttpProxyAgent");(function(e){e.HttpProxyAgent=yj.default,e.prototype=yj.default.prototype})(vj||(vj={}));Vhe.exports=vj});var zhe=w(zS=>{"use strict";Object.defineProperty(zS,"__esModule",{value:!0});var nx={span:Symbol.for("@azure/core-tracing span"),namespace:Symbol.for("@azure/core-tracing namespace")};function _Ve(e={}){let t=new _j(e.parentContext);return e.span&&(t=t.setValue(nx.span,e.span)),e.namespace&&(t=t.setValue(nx.namespace,e.namespace)),t}l(_Ve,"createTracingContext");var sy=class sy{constructor(t){this._contextMap=t instanceof sy?new Map(t._contextMap):new Map}setValue(t,r){let n=new sy(this);return n._contextMap.set(t,r),n}getValue(t){return this._contextMap.get(t)}deleteValue(t){let r=new sy(this);return r._contextMap.delete(t),r}};l(sy,"TracingContextImpl");var _j=sy;function bVe(){return{end:()=>{},isRecording:()=>!1,recordException:()=>{},setAttribute:()=>{},setStatus:()=>{}}}l(bVe,"createDefaultTracingSpan");function CVe(){return{createRequestHeaders:()=>({}),parseTraceparentHeader:()=>{},startSpan:(e,t)=>({span:bVe(),tracingContext:_Ve({parentContext:t.tracingContext})}),withContext(e,t,...r){return t(...r)}}}l(CVe,"createDefaultInstrumenter");var GS;function TVe(e){GS=e}l(TVe,"useInstrumenter");function VS(){return GS||(GS=CVe()),GS}l(VS,"getInstrumenter");function EVe(e){let{namespace:t,packageName:r,packageVersion:n}=e;function s(f,d,p){var h;let m=VS().startSpan(f,Object.assign(Object.assign({},p),{packageName:r,packageVersion:n,tracingContext:(h=d==null?void 0:d.tracingOptions)===null||h===void 0?void 0:h.tracingContext})),g=m.tracingContext,y=m.span;g.getValue(nx.namespace)||(g=g.setValue(nx.namespace,t)),y.setAttribute("az.namespace",g.getValue(nx.namespace));let v=Object.assign({},d,{tracingOptions:Object.assign(Object.assign({},d==null?void 0:d.tracingOptions),{tracingContext:g})});return{span:y,updatedOptions:v}}l(s,"startSpan");async function o(f,d,p,h){let{span:m,updatedOptions:g}=s(f,d,h);try{let y=await a(g.tracingOptions.tracingContext,()=>Promise.resolve(p(g,m)));return m.setStatus({status:"success"}),y}catch(y){throw m.setStatus({status:"error",error:y}),y}finally{m.end()}}l(o,"withSpan");function a(f,d,...p){return VS().withContext(f,d,...p)}l(a,"withContext");function c(f){return VS().parseTraceparentHeader(f)}l(c,"parseTraceparentHeader");function u(f){return VS().createRequestHeaders(f)}return l(u,"createRequestHeaders"),{startSpan:s,withSpan:o,withContext:a,parseTraceparentHeader:c,createRequestHeaders:u}}l(EVe,"createTracingClient");zS.createTracingClient=EVe;zS.useInstrumenter=TVe});function ix(){return WS>KS.length-16&&(Whe.default.randomFillSync(KS),WS=0),KS.slice(WS,WS+=16)}var Whe,KS,WS,bj=Vc(()=>{Whe=Sr(require("crypto")),KS=new Uint8Array(256),WS=KS.length;l(ix,"rng")});var Khe,Yhe=Vc(()=>{Khe=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function SVe(e){return typeof e=="string"&&Khe.test(e)}var om,sx=Vc(()=>{Yhe();l(SVe,"validate");om=SVe});function wVe(e,t=0){let r=(oc[e[t+0]]+oc[e[t+1]]+oc[e[t+2]]+oc[e[t+3]]+"-"+oc[e[t+4]]+oc[e[t+5]]+"-"+oc[e[t+6]]+oc[e[t+7]]+"-"+oc[e[t+8]]+oc[e[t+9]]+"-"+oc[e[t+10]]+oc[e[t+11]]+oc[e[t+12]]+oc[e[t+13]]+oc[e[t+14]]+oc[e[t+15]]).toLowerCase();if(!om(r))throw TypeError("Stringified UUID is invalid");return r}var oc,am,ox=Vc(()=>{sx();oc=[];for(let e=0;e<256;++e)oc.push((e+256).toString(16).substr(1));l(wVe,"stringify");am=wVe});function IVe(e,t,r){let n=t&&r||0,s=t||new Array(16);e=e||{};let o=e.node||Xhe,a=e.clockseq!==void 0?e.clockseq:Cj;if(o==null||a==null){let h=e.random||(e.rng||ix)();o==null&&(o=Xhe=[h[0]|1,h[1],h[2],h[3],h[4],h[5]]),a==null&&(a=Cj=(h[6]<<8|h[7])&16383)}let c=e.msecs!=
${SGe.sanitize(this)}`}};l(ew,"RestError");var Sd=ew;Sd.REQUEST_SEND_ERROR="REQUEST_SEND_ERROR";Sd.PARSE_ERROR="PARSE_ERROR";function Jme(e){return e instanceof Sd?!0:_p.isError(e)&&e.name==="RestError"}l(Jme,"isRestError");var Zme="tracingPolicy";function ege(e={}){let t=Nme(e.userAgentPrefix),r=wGe();return{name:Zme,async sendRequest(n,s){var o,a;if(!r||!(!((o=n.tracingOptions)===null||o===void 0)&&o.tracingContext))return s(n);let{span:c,tracingContext:u}=(a=IGe(r,n,t))!==null&&a!==void 0?a:{};if(!c||!u)return s(n);try{let f=await r.withContext(u,s,n);return RGe(c,f),f}catch(f){throw AGe(c,f),f}}}}l(ege,"tracingPolicy");function wGe(){try{return HVe.createTracingClient({namespace:"",packageName:"@azure/core-rest-pipeline",packageVersion:kme})}catch(e){Bf.warning(`Error when creating the TracingClient: ${_p.getErrorMessage(e)}`);return}}l(wGe,"tryCreateTracingClient");function IGe(e,t,r){try{let{span:n,updatedOptions:s}=e.startSpan(`HTTP ${t.method}`,{tracingOptions:t.tracingOptions},{spanKind:"client",spanAttributes:{"http.method":t.method,"http.url":t.url,requestId:t.requestId}});if(!n.isRecording()){n.end();return}r&&n.setAttribute("http.user_agent",r);let o=e.createRequestHeaders(s.tracingOptions.tracingContext);for(let[a,c]of Object.entries(o))t.headers.set(a,c);return{span:n,tracingContext:s.tracingOptions.tracingContext}}catch(n){Bf.warning(`Skipping creating a tracing span due to an error: ${_p.getErrorMessage(n)}`);return}}l(IGe,"tryCreateSpan");function AGe(e,t){try{e.setStatus({status:"error",error:_p.isError(t)?t:void 0}),Jme(t)&&t.statusCode&&e.setAttribute("http.status_code",t.statusCode),e.end()}catch(r){Bf.warning(`Skipping tracing span processing due to an error: ${_p.getErrorMessage(r)}`)}}l(AGe,"tryProcessError");function RGe(e,t){try{e.setAttribute("http.status_code",t.status);let r=t.headers.get("x-ms-request-id");r&&e.setAttribute("serviceRequestId",r),e.setStatus({status:"success"}),e.end()}catch(r){Bf.warning(`Skipping tracing span processing due to an error: ${_p.getErrorMessage(r)}`)}}l(RGe,"tryProcessResponse");function PGe(e){let t=wme();return _p.isNode&&(e.tlsOptions&&t.addPolicy(Qme(e.tlsOptions)),t.addPolicy(Wme(e.proxyOptions)),t.addPolicy(Fme())),t.addPolicy($me()),t.addPolicy(Lme(e.userAgentOptions)),t.addPolicy(Yme()),t.addPolicy(jme(e.retryOptions),{phase:"Retry"}),t.addPolicy(ege(e.userAgentOptions),{afterPhase:"Retry"}),_p.isNode&&t.addPolicy(Pme(e.redirectOptions),{afterPhase:"Retry"}),t.addPolicy(Ame(e.loggingOptions),{afterPhase:"Sign"}),t}l(PGe,"createPipelineFromOptions");function XS(e){return e.toLowerCase()}l(XS,"normalizeName");function*OGe(e){for(let t of e.values())yield[t.name,t.value]}l(OGe,"headerIterator");var qj=class qj{constructor(t){if(this._headersMap=new Map,t)for(let r of Object.keys(t))this.set(r,t[r])}set(t,r){this._headersMap.set(XS(t),{name:t,value:String(r)})}get(t){var r;return(r=this._headersMap.get(XS(t)))===null||r===void 0?void 0:r.value}has(t){return this._headersMap.has(XS(t))}delete(t){this._headersMap.delete(XS(t))}toJSON(t={}){let r={};if(t.preserveCase)for(let n of this._headersMap.values())r[n.name]=n.value;else for(let[n,s]of this._headersMap)r[n]=s.value;return r}toString(){return JSON.stringify(this.toJSON({preserveCase:!0}))}[Symbol.iterator](){return OGe(this._headersMap)}};l(qj,"HttpHeadersImpl");var Nj=qj;function Fj(e){return new Nj(e)}l(Fj,"createHttpHeaders");var kGe={};function lx(e){return e&&typeof e.pipe=="function"}l(lx,"isReadableStream");function Eme(e){return new Promise(t=>{e.on("close",t),e.on("end",t),e.on("error",t)})}l(Eme,"isStreamComplete");function tge(e){return e&&typeof e.byteLength=="number"}l(tge,"isArrayBuffer");var Uj=class Uj extends WVe.Transform{constructor(t){super(),this.loadedBytes=0,this.progressCallback=t}_transform(t,r,n){this.push(t),this.loadedBytes+=t.length;try{this.progressCallback({loadedBytes:this.loadedBytes}),n()}catch(s){n(s)}}};l(Uj,"ReportTransform");var ZS=Uj,jj=class jj{constructor(){this.cachedHttpsAgents=new WeakMap}async sendRequest(t){var r,n,s;let o=new cx.AbortController,a;if(t.abo
`).join(""))}return t(e)}}}l(QGe,"ndJsonPolicy");na.RestError=Sd;na.bearerTokenAuthenticationPolicy=XGe;na.bearerTokenAuthenticationPolicyName=ige;na.createDefaultHttpClient=BGe;na.createEmptyPipeline=wme;na.createHttpHeaders=Fj;na.createPipelineFromOptions=PGe;na.createPipelineRequest=UGe;na.decompressResponsePolicy=Fme;na.decompressResponsePolicyName=Mme;na.defaultRetryPolicy=jme;na.exponentialRetryPolicy=HGe;na.exponentialRetryPolicyName=jGe;na.formDataPolicy=$me;na.formDataPolicyName=Hme;na.getDefaultProxySettings=zme;na.isRestError=Jme;na.logPolicy=Ame;na.logPolicyName=Ime;na.ndJsonPolicy=QGe;na.ndJsonPolicyName=sge;na.proxyPolicy=Wme;na.proxyPolicyName=Vme;na.redirectPolicy=Pme;na.redirectPolicyName=Rme;na.retryPolicy=fx;na.setClientRequestIdPolicy=Yme;na.setClientRequestIdPolicyName=Kme;na.systemErrorRetryPolicy=$Ge;na.systemErrorRetryPolicyName=rge;na.throttlingRetryPolicy=VGe;na.throttlingRetryPolicyName=nge;na.tlsPolicy=Qme;na.tlsPolicyName=Xme;na.tracingPolicy=ege;na.tracingPolicyName=Zme;na.userAgentPolicy=Lme;na.userAgentPolicyName=Dme});var cge=w((dx,lge)=>{"use strict";var JGe=dx&&dx.__awaiter||function(e,t,r,n){function s(o){return o instanceof r?o:new r(function(a){a(o)})}return l(s,"adopt"),new(r||(r=Promise))(function(o,a){function c(d){try{f(n.next(d))}catch(p){a(p)}}l(c,"fulfilled");function u(d){try{f(n.throw(d))}catch(p){a(p)}}l(u,"rejected");function f(d){d.done?o(d.value):s(d.value).then(c,u)}l(f,"step"),f((n=n.apply(e,t||[])).next())})},ZGe=dx&&dx.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(f){return function(d){return u([f,d])}}function u(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,s&&(o=f[0]&2?s.return:f[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,f[1])).done)return o;switch(s=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,s=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){r.label=f[1];break}if(f[0]===6&&r.label<o[1]){r.label=o[1],o=f;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(f);break}o[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(d){f=[6,d],s=0}finally{n=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},age=oge(),eze="https://monitor.azure.com//.default";function tze(e){return null}l(tze,"emptySendRequest");var rze=function(){function e(t){var r=[eze];this._azureTokenPolicy=age.bearerTokenAuthenticationPolicy({credential:t,scopes:r})}return l(e,"AuthorizationHandler"),e.prototype.addAuthorizationHeader=function(t){return JGe(this,void 0,void 0,function(){var r,n;return ZGe(this,function(s){switch(s.label){case 0:return r="authorization",n=age.createPipelineRequest({url:"https://"}),[4,this._azureTokenPolicy.sendRequest(n,tze)];case 1:return s.sent(),t.headers[r]=n.headers.get(r),[2]}})})},e}();lge.exports=rze});var fge=w((M7t,uge)=>{"use strict";var nze=I0(),ize=Bl(),sze=function(){function e(t,r,n,s){this._buffer=[],this._lastSend=0,this._isDisabled=t,this._getBatchSize=r,this._getBatchIntervalMs=n,this._sender=s}return l(e,"Channel"),e.prototype.setUseDiskRetryCaching=function(t,r,n){this._sender.setDiskRetryMode(t,r,n)},e.prototype.send=function(t){var r=this;if(!this._isDisabled()){if(!t){nze.warn("Cannot send null/undefined telemetry");return}if(this._buffer.push(t),this._buffer.length>=this._getBatchSize()){this.triggerSend(!1);return}!this._timeoutHandle&&this._buffer.length>0&&(this._timeoutHandle=setTimeout(function(){r._timeoutHandle=null,r.triggerSend(!1)},this._getBatchIntervalMs()))}},e.prototype.triggerSend=function(t,r){var n=this._buffer.length<1;n||(t||ize.isNodeExit?(this._sender.saveOnCrash(this._buffer),typeof r=="function"&&r("data saved on crash")):this._sender.send(this._
`);r=[];for(var s=0,o=0,a=0;a<=n.length;a++){var c=n[a];if(_ge.regex.test(c)){var u=new _ge(n[a],s++);o+=u.sizeInBytes,r.push(u)}}var f=32*1024;if(o>f)for(var d=0,p=r.length-1,h=0,m=d,g=p;d<p;){var y=r[d].sizeInBytes,v=r[p].sizeInBytes;if(h+=y+v,h>f){var _=g-m+1;r.splice(m,_);break}m=d,g=p,d++,p--}}return r},e}(),_ge=function(){function e(t,r){this.sizeInBytes=0,this.level=r,this.method="<no_method>",this.assembly=Tu.trim(t);var n=t.match(e.regex);n&&n.length>=5&&(this.method=Tu.trim(n[2])||this.method,this.fileName=Tu.trim(n[4])||"<no_filename>",this.line=parseInt(n[5])||0),this.sizeInBytes+=this.method.length,this.sizeInBytes+=this.fileName.length,this.sizeInBytes+=this.assembly.length,this.sizeInBytes+=e.baseSize,this.sizeInBytes+=this.level.toString().length,this.sizeInBytes+=this.line.toString().length}return l(e,"_StackFrame"),e.regex=/^(\s+at)?(.*?)(\@|\s\(|\s)([^\(\n]+):(\d+):(\d+)(\)?)$/,e.baseSize=58,e}();bge.exports=pze});var Cge=w(lm=>{"use strict";var hze=lm&&lm.__awaiter||function(e,t,r,n){function s(o){return o instanceof r?o:new r(function(a){a(o)})}return l(s,"adopt"),new(r||(r=Promise))(function(o,a){function c(d){try{f(n.next(d))}catch(p){a(p)}}l(c,"fulfilled");function u(d){try{f(n.throw(d))}catch(p){a(p)}}l(u,"rejected");function f(d){d.done?o(d.value):s(d.value).then(c,u)}l(f,"step"),f((n=n.apply(e,t||[])).next())})},mze=lm&&lm.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(f){return function(d){return u([f,d])}}function u(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,s&&(o=f[0]&2?s.return:f[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,f[1])).done)return o;switch(s=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,s=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){r.label=f[1];break}if(f[0]===6&&r.label<o[1]){r.label=o[1],o=f;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(f);break}o[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(d){f=[6,d],s=0}finally{n=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(lm,"__esModule",{value:!0});lm.FileAccessControl=void 0;var gze=require("fs"),yze=require("os"),cy=require("child_process"),vze=I0(),xze=function(){function e(){}return l(e,"FileAccessControl"),e.checkFileProtection=function(){if(!e.OS_PROVIDES_FILE_PROTECTION&&!e.OS_FILE_PROTECTION_CHECKED)if(e.OS_FILE_PROTECTION_CHECKED=!0,e.USE_ICACLS){try{e.OS_PROVIDES_FILE_PROTECTION=gze.existsSync(e.ICACLS_PATH)}catch{}e.OS_PROVIDES_FILE_PROTECTION||vze.warn(e.TAG,"Could not find ICACLS in expected location! This is necessary to use disk retry mode on Windows.")}else e.OS_PROVIDES_FILE_PROTECTION=!0},e.applyACLRules=function(t){return hze(this,void 0,void 0,function(){var r,n;return mze(this,function(s){switch(s.label){case 0:if(!e.USE_ICACLS)return[3,7];if(e.ACLED_DIRECTORIES[t]!==void 0)return[3,6];e.ACLED_DIRECTORIES[t]=!1,s.label=1;case 1:return s.trys.push([1,4,,5]),[4,this._getACLIdentity()];case 2:return r=s.sent(),[4,this._runICACLS(this._getACLArguments(t,r))];case 3:return s.sent(),e.ACLED_DIRECTORIES[t]=!0,[3,5];case 4:throw n=s.sent(),e.ACLED_DIRECTORIES[t]=!1,n;case 5:return[3,7];case 6:if(!e.ACLED_DIRECTORIES[t])throw new Error("Setting ACL restrictions did not succeed (cached result)");s.label=7;case 7:return[2]}})})},e.applyACLRulesSync=function(t){if(e.USE_ICACLS){if(e.ACLED_DIRECTORIES[t]===void 0){this._runICACLSSync(this._getACLArguments(t,this._getACLIdentitySync())),e.ACLED_DIRECTORIES[t]=!0;return}else if(!e.ACLED_DIRECTORIES[t])throw new Error("Setting ACL restrictions did not succeed (cached result)")}},e._runICACLS=function(t){return new Promise(function(r,n){var s=cy.spawn(e.ICACLS
`)}),f.length>0&&(f=f.substring(0,f.length-1)),d=Buffer.from?Buffer.from(f):new Buffer(f),bze.gzip(d,function(m,g){var y=g;m?(p._logWarn(Eu.dumpObj(m)),y=d,o.headers["Content-Length"]=d.length.toString()):(o.headers["Content-Encoding"]="gzip",o.headers["Content-Length"]=g.length.toString()),p._logInfo(Eu.dumpObj(o)),o[Cze.disableCollectionRequestOption]=!0;var v=+new Date,_=l(function(b){b.setEncoding("utf-8");var E="";b.on("data",function(S){E+=S}),b.on("end",function(){var S=+new Date,I=S-v;if(p._numConsecutiveFailures=0,p._isStatsbeatSender&&!p._statsbeatHasReachedIngestionAtLeastOnce&&(wze.includes(b.statusCode)?p._statsbeatHasReachedIngestionAtLeastOnce=!0:p._statsbeatFailedToIngest()),p._statsbeat&&(b.statusCode==Sze||b.statusCode==Eze?p._statsbeat.countThrottle(cm.StatsbeatNetworkCategory.Breeze,s,b.statusCode):p._statsbeat.countRequest(cm.StatsbeatNetworkCategory.Breeze,s,I,b.statusCode===200,b.statusCode)),p._enableDiskRetryMode){if(b.statusCode===200)p._resendTimer||(p._resendTimer=setTimeout(function(){p._resendTimer=null,p._sendFirstFileOnDisk()},p._resendInterval),p._resendTimer.unref());else if(p._isRetriable(b.statusCode))try{p._statsbeat&&p._statsbeat.countRetry(cm.StatsbeatNetworkCategory.Breeze,s,b.statusCode);var H=JSON.parse(E),K=[];H.errors&&(H.errors.forEach(function(ne){(ne.statusCode==429||ne.statusCode==500||ne.statusCode==503)&&K.push(t[ne.index])}),K.length>0&&p._storeToDisk(K))}catch{p._storeToDisk(t)}}if(b.statusCode===307||b.statusCode===308)if(p._numConsecutiveRedirects++,p._numConsecutiveRedirects<10){var be=b.headers.location?b.headers.location.toString():null;be&&(p._redirectedHost=be,p.send(t,r))}else{var Se={name:"Circular Redirect",message:"Error sending telemetry because of circular redirects."};p._statsbeat&&p._statsbeat.countException(cm.StatsbeatNetworkCategory.Breeze,s,Se),typeof r=="function"&&r("Error sending telemetry because of circular redirects.")}else p._numConsecutiveRedirects=0,typeof r=="function"&&r(E),p._logInfo(E),typeof p._onSuccess=="function"&&p._onSuccess(E)})},"requestCallback"),x=Eu.makeRequest(p._config,n,o,_);x.setTimeout(e.HTTP_TIMEOUT,function(){p._requestTimedOut=!0,x.abort()}),x.on("error",function(b){if(p._isStatsbeatSender&&!p._statsbeatHasReachedIngestionAtLeastOnce&&p._statsbeatFailedToIngest(),p._numConsecutiveFailures++,p._statsbeat&&p._statsbeat.countException(cm.StatsbeatNetworkCategory.Breeze,s,b),!p._enableDiskRetryMode||p._numConsecutiveFailures>0&&p._numConsecutiveFailures%e.MAX_CONNECTION_FAILURES_BEFORE_WARN===0){var E="Ingestion endpoint could not be reached. This batch of telemetry items has been lost. Use Disk Retry Caching to enable resending of failed telemetry. Error:";p._enableDiskRetryMode&&(E="Ingestion endpoint could not be reached "+p._numConsecutiveFailures+" consecutive times. There may be resulting telemetry loss. Most recent error:"),p._logWarn(E,Eu.dumpObj(b))}else{var E="Transient failure to reach ingestion endpoint. This batch of telemetry items will be retried. Error:";p._logInfo(E,Eu.dumpObj(b))}p._onErrorHelper(b),typeof r=="function"&&(b?(p._requestTimedOut&&(b.name="telemetry timeout",b.message="telemetry request timed out"),r(Eu.dumpObj(b))):r("Error sending telemetry")),p._enableDiskRetryMode&&p._storeToDisk(t)}),x.write(y),x.end()}),h.label=5;case 5:return[2]}})})},e.prototype.saveOnCrash=function(t){this._enableDiskRetryMode&&this._storeToDiskSync(Eu.stringify(t))},e.prototype._isRetriable=function(t){return t===206||t===401||t===403||t===408||t===429||t===500||t===502||t===503||t===504},e.prototype._logInfo=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this._isStatsbeatSender||Tge.info(e.TAG,t,r)},e.prototype._logWarn=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this._isStatsbeatSender||Tge.warn(e.TAG,t,r)},e.prototype._statsbeatFailedToIngest=function(){this._shutdownStatsbeat&&(this._failedToIngestCounter++,this._failedToIngestCounter>=3&&this._shutdownStatsbeat())},e.prototype._storeToDisk=function(t){return ow(this,void 0,void 0,function(){var r,n,s,o,a,c,u
Double-check to use the right GitHub account. You can also sign in later using the account menu.
[Sign In](command:github.copilot.signIn)`,when:"!github.copilot.activated",completionEvents:["onContext:github.copilot.activated"],media:{image:"assets/walkthrough/sign-in.svg",altText:"Sign in to GitHub via Copilot's notification or VS Code's account menu"}},{id:"copilot.firstsuggest",title:"AI-powered suggestions",description:`Copilot suggests lines of code **as you type** and multiple lines for **function signatures**.
**Prompts in comments** make suggestions specific to your desired outcome, logic and steps.`,media:{svg:"assets/walkthrough/ai-powered-suggestions.svg",altText:"Different types of suggestions visualized"}},{id:"copilot.chat",title:"Chat with Copilot",description:"Ask Copilot general programming questions in the chat view. Copilot can also fix problems, scaffold tests, or refactor your code. Type ``/`` to view all available chat commands.\n[Chat with Copilot](command:workbench.panel.chat.view.copilot.focus)",when:"!github.copilot.interactiveSession.disabled",media:{svg:"assets/walkthrough/copilot-chat.svg",altText:"Copilot Chat view in the sidebar"}},{id:"copilot.realfiles.openrecent",title:"Code as context",description:`The **more specific context** you provide Copilot, the **better** suggestions get! Context is not just current code and comments, but other open files.
[Try Copilot in Your Code](command:workbench.action.openRecent)`,when:"workspaceFolderCount == 0",media:{svg:"assets/walkthrough/code-as-context.svg",altText:"An editor with code being suggested by Copilot in gray text"}},{id:"copilot.realfiles.quickopen",title:"Code as context",description:`The **more context** you give Copilot, the **better** suggestions get! Context is not just the current code, but other open files.
[Try Copilot in Your Code](command:workbench.action.quickOpen)`,when:"workspaceFolderCount != 0",media:{svg:"assets/walkthrough/code-as-context.svg",altText:"An editor with code being suggested by Copilot in gray text"}},{id:"copilot.iterate",title:"You are in control",description:`Just as you would review a colleague's code, you should always assess, analyze, and validate AI-generated code.
If the first suggestion doesn't work, Copilot can generate more options. You can edit the Copilot settings and keyboard shortcuts to personalize your experience.
[Edit keyboard shortcuts](command:workbench.action.openGlobalKeybindings?%5B%22copilot%22%5D)
[Personalize settings](command:workbench.action.openSettings?%5B%22copilot%22%5D)`,media:{image:"assets/walkthrough/you-are-in-control.svg",altText:"An editor with a toolbar widget overlay showing arrows for navigating multiple suggestions from Copilot"}},{id:"copilot.creativity",title:"Powered by your creativity",description:`Pair up with AI to outline your idea in a comment, then generate the implementation, and then test suites. Or, work backwards from example output!
Copilot will keep surprising you as you challenge it.
[Prompts, tips, and use cases](https://github.blog/2023-06-20-how-to-write-better-prompts-for-github-copilot/)`,media:{svg:"assets/walkthrough/powered-by-your-creativity.svg",altText:"Metrics showing how much Copilot increases productivity for developers. The metrics read: 74% focus on more satisfying work. 88% feel more productive. 96% are faster with more repetitive tasks."}}]}],commands:[{command:"github.copilot.acceptCursorPanelSolution",title:"Accept panel suggestion at the cursor",category:"GitHub Copilot"},{command:"github.copilot.signIn",title:"Sign In",category:"GitHub Copilot",enablement:"!github.copilot.activated"},{command:"github.copilot.previousPanelSolution",title:"Navigate to the previous panel suggestion",category:"GitHub Copilot"},{command:"github.copilot.nextPanelSolution",title:"Navigate to the next panel suggestion",category:"GitHub Copilot"},{command:"github.copilot.generate",title:"Open Completions Panel",category:"GitHub Copilot"},{command:"github.copilot.toggleCopilot",title:"Enable/Disable Copilot completions",category:"GitHub Copilot"},{command:"github.copilot.sendFeedback",title:"Send Feedback",category:"GitHub Copilot"},{command:"github.copilot.collectDiagnostics",title:"Collect Diagnostics",category:"GitHub Copilot"},{command:"github.copilot.openLogs",title:"Open Logs",category:"GitHub Copilot"}],keybindings:[{command:"github.copilot.generate",key:"ctrl+enter",mac:"ctrl+enter",when:"editorTextFocus && github.copilot.activated && !inInteractiveInput && !interactiveEditorFocused"},{command:"github.copilot.acceptCursorPanelSolution",key:"ctrl+/",mac:"ctrl+/",when:"github.copilot.activated && github.copilot.panelVisible"},{command:"github.copilot.previousPanelSolution",key:"alt+[",mac:"alt+[",when:"github.copilot.activated && github.copilot.panelVisible"},{command:"github.copilot.nextPanelSolution",key:"alt+]",mac:"alt+]",when:"github.copilot.activated && github.copilot.panelVisible"},{command:"editor.action.inlineSuggest.trigger",key:"alt+\\",when:"editorTextFocus && !editorHasSelection && config.github.copilot.inlineSuggest.enable && !inlineSuggestionsVisible"}],menus:{"editor/inlineCompletions/actions":[{command:"github.copilot.generate",when:"github.copilot.activated"}],commandPalette:[{command:"github.copilot.generate",when:"github.copilot.activated"},{command:"github.copilot.toggleCopilot",when:"github.copilot.activated"},{command:"github.copilot.sendFeedback",when:"github.copilot.activated"},{command:"github.copilot.collectDiagnostics"}]},configuration:[{title:"Copilot",properties:{"github.copilot.advanced":{type:"object",title:"Advanced Settings",properties:{secret_key:{type:"string",default:"",description:"Secret API key"},length:{type:"integer",default:500,description:"Length of code to generate in tokens"},temperature:{type:"string",default:"",description:"Override sampling temperature (range 0.0 - 1.0)"},top_p:{type:"number",default:1,description:"Top probability mass to consider"},stops:{type:"object",default:{"*":[`
`],python:[`
def `,`
class `,`
if `,`
#`]},description:"Configure per-language stop sequences"},indentationMode:{type:"object",default:{python:!1,javascript:!1,javascriptreact:!1,jsx:!1,typescript:!1,typescriptreact:!1,go:!1,ruby:!1,"*":!0},markdownDescription:"Enable or disable indentation block termination for specified [languages](https://code.visualstudio.com/docs/languages/identifiers). Set to 'clientandserver' to run both parser-based and indent-based termination."},inlineSuggestCount:{type:"integer",default:3,description:"Number of inline suggestions to fetch"},listCount:{type:"integer",default:10,description:"Number of solutions to list in Open GitHub Copilot"},authProvider:{type:"string",enum:["github","github-enterprise"],enumDescriptions:["GitHub.com","GitHub Enterprise"],default:"github",description:"The GitHub identity to use for Copilot"},"debug.showScores":{type:"boolean",default:!1,description:"Show scores in sorted solutions"},"debug.overrideEngine":{type:"string",default:"",description:"Override engine name"},"debug.overrideProxyUrl":{type:"string",default:"",description:"Override GitHub authentication proxy full URL"},"debug.testOverrideProxyUrl":{type:"string",default:"",description:"Override GitHub authentication proxy URL when running tests"},"debug.overrideCapiUrl":{type:"string",default:"",description:"Override GitHub Copilot API full URL"},"debug.testOverrideCapiUrl":{type:"string",default:"",description:"Override GitHub Copilot API URL when running tests"},"debug.filterLogCategories":{type:"array",default:[],description:"Show only log categories listed in this setting. If an array is empty, show all loggers"}}},"github.copilot.enable":{type:"object",default:{"*":!0,plaintext:!1,markdown:!1,scminput:!1},additionalProperties:"boolean",markdownDescription:"Enable or disable Copilot completions for specified [languages](https://code.visualstudio.com/docs/languages/identifiers)"},"github.copilot.inlineSuggest.enable":{type:"boolean",default:!0,deprecationMessage:"Deprecated: Please use github.copilot.editor.enableAutoCompletions instead.",description:"Show inline suggestions"},"github.copilot.editor.enableAutoCompletions":{type:"boolean",scope:"language-overridable",default:!0,description:"Automatically show inline completions"}}}],configurationDefaults:{"editor.tokenColorCustomizations":{"[*Light*]":{textMateRules:[{scope:"ref.matchtext",settings:{foreground:"#000"}}]},"[*Dark*]":{textMateRules:[{scope:"ref.matchtext",settings:{foreground:"#fff"}}]}}},languages:[{id:"code-referencing"}],grammars:[{language:"code-referencing",scopeName:"text.ref",path:"./syntaxes/ref.tmGrammar.json"}],icons:{"copilot-logo":{description:"GitHub Copilot icon",default:{fontPath:"assets/copilot.woff",fontCharacter:"\\0041"}},"copilot-warning":{description:"GitHub Copilot icon",default:{fontPath:"assets/copilot.woff",fontCharacter:"\\0042"}},"copilot-notconnected":{description:"GitHub Copilot icon",default:{fontPath:"assets/copilot.woff",fontCharacter:"\\0043"}},"copilot-chat":{description:"GitHub Copilot chat icon",default:{fontPath:"assets/copilot.woff",fontCharacter:"\\F101"}}},iconFonts:[{id:"copilot-font",src:[{path:"assets/copilot.woff",format:"woff"}]}]},scripts:{build:"run-s build:prompt build:root","build:prompt":"npm -C prompt run build","build:root":"tsx .esbuild.ts",clean:"./script/build/clean.sh","forbid-sources-content:extension":"node script/forbid-sources-content.js --extension",generate_languages:"ts-node script/generateLanguages.ts && prettier --write lib/src/language/generatedLanguages.ts",get_token:"ts-node script/getToken.ts",lint:"npm-run-all lint:*","lint:deps":"depcruise -c .dependency-cruiser.js .","lint:eslint":"eslint . --cache","lint:prettier":"prettier --check .","lint:types":"tsc --noEmit","lint:types-webview":"tsc --noEmit -p extension/src/copilotPanel/webview",prebuild:"./script/build/clean-deprecated-modules.sh && npm install",pretest:"npm run build","pretest:extension":"npm run build","pretest:lsp-client":"npm run build",prewatch:"npm run build",start:"npm run watch",test:'npm-run-all "test:* --ignore-scripts" lint',"test:ag
`)}return n};mG.decode=function(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');var r=w4e[t];if(!r){r=w4e[t]=[];for(var n=0;n<t.length;++n)r[t.charCodeAt(n)]=n}e=e.replace(/\s/g,"");for(var s=t.length,o=t.charAt(0),a=[0],n=0;n<e.length;n++){var c=r[e.charCodeAt(n)];if(c===void 0)return;for(var u=0,f=c;u<a.length;++u)f+=a[u]*s,a[u]=f&255,f>>=8;for(;f>0;)a.push(f&255),f>>=8}for(var d=0;e[d]===o&&d<e.length-1;++d)a.push(0);return typeof Buffer<"u"?Buffer.from(a.reverse()):new Uint8Array(a.reverse())};function vZe(e,t){var r=0,n=t.length,s=t.charAt(0),o=[0];for(r=0;r<e.length();++r){for(var a=0,c=e.at(r);a<o.length;++a)c+=o[a]<<8,o[a]=c%n,c=c/n|0;for(;c>0;)o.push(c%n),c=c/n|0}var u="";for(r=0;e.at(r)===0&&r<e.length()-1;++r)u+=s;for(r=o.length-1;r>=0;--r)u+=t[o[r]];return u}l(vZe,"_encodeWithByteBuffer")});var Na=w((pOt,k4e)=>{var R4e=ia(),P4e=A4e(),xr=k4e.exports=R4e.util=R4e.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){xr.nextTick=process.nextTick,typeof setImmediate=="function"?xr.setImmediate=setImmediate:xr.setImmediate=xr.nextTick;return}if(typeof setImmediate=="function"){xr.setImmediate=function(){return setImmediate.apply(void 0,arguments)},xr.nextTick=function(c){return setImmediate(c)};return}if(xr.setImmediate=function(c){setTimeout(c,0)},typeof window<"u"&&typeof window.postMessage=="function"){let c=function(u){if(u.source===window&&u.data===e){u.stopPropagation();var f=t.slice();t.length=0,f.forEach(function(d){d()})}};var a=c;l(c,"handler");var e="forge.setImmediate",t=[];xr.setImmediate=function(u){t.push(u),t.length===1&&window.postMessage(e,"*")},window.addEventListener("message",c,!0)}if(typeof MutationObserver<"u"){var r=Date.now(),n=!0,s=document.createElement("div"),t=[];new MutationObserver(function(){var u=t.slice();t.length=0,u.forEach(function(f){f()})}).observe(s,{attributes:!0});var o=xr.setImmediate;xr.setImmediate=function(u){Date.now()-r>15?(r=Date.now(),o(u)):(t.push(u),t.length===1&&s.setAttribute("a",n=!n))}}xr.nextTick=xr.setImmediate})();xr.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;xr.globalScope=function(){return xr.isNodejs?global:typeof self>"u"?window:self}();xr.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};xr.isArrayBuffer=function(e){return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer};xr.isArrayBufferView=function(e){return e&&xr.isArrayBuffer(e.buffer)&&e.byteLength!==void 0};function o9(e){if(!(e===8||e===16||e===24||e===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}l(o9,"_checkBitsParam");xr.ByteBuffer=gG;function gG(e){if(this.data="",this.read=0,typeof e=="string")this.data=e;else if(xr.isArrayBuffer(e)||xr.isArrayBufferView(e))if(typeof Buffer<"u"&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch{for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof gG||typeof e=="object"&&typeof e.data=="string"&&typeof e.read=="number")&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}l(gG,"ByteStringBuffer");xr.ByteStringBuffer=gG;var xZe=4096;xr.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>xZe&&(this.data.substr(0,1),this._constructedStringLength=0)};xr.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};xr.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};xr.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))};xr.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)t&1&&(r+=e),t>>>=1,t>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this};xr.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this};xr.ByteStringBuffer.prototype.putString=function(e)
`,r=r.substr(t));return n+=r,n};xr.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",r,n,s,o,a=0;a<e.length;)r=Tm[e.charCodeAt(a++)-43],n=Tm[e.charCodeAt(a++)-43],s=Tm[e.charCodeAt(a++)-43],o=Tm[e.charCodeAt(a++)-43],t+=String.fromCharCode(r<<2|n>>4),s!==64&&(t+=String.fromCharCode((n&15)<<4|s>>2),o!==64&&(t+=String.fromCharCode((s&3)<<6|o)));return t};xr.encodeUtf8=function(e){return unescape(encodeURIComponent(e))};xr.decodeUtf8=function(e){return decodeURIComponent(escape(e))};xr.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:P4e.encode,decode:P4e.decode}};xr.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)};xr.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var s=r,o=0;o<e.length;++o)n[s++]=e.charCodeAt(o);return t?s-r:n};xr.binary.hex.encode=xr.bytesToHex;xr.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2))),r=r||0;var s=0,o=r;for(e.length&1&&(s=1,n[o++]=parseInt(e[0],16));s<e.length;s+=2)n[o++]=parseInt(e.substr(s,2),16);return t?o-r:n};xr.binary.base64.encode=function(e,t){for(var r="",n="",s,o,a,c=0;c<e.byteLength;)s=e[c++],o=e[c++],a=e[c++],r+=Cm.charAt(s>>2),r+=Cm.charAt((s&3)<<4|o>>4),isNaN(o)?r+="==":(r+=Cm.charAt((o&15)<<2|a>>6),r+=isNaN(a)?"=":Cm.charAt(a&63)),t&&r.length>t&&(n+=r.substr(0,t)+`\r
`,r=r.substr(t));return n+=r,n};xr.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/4)*3)),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var s,o,a,c,u=0,f=r;u<e.length;)s=Tm[e.charCodeAt(u++)-43],o=Tm[e.charCodeAt(u++)-43],a=Tm[e.charCodeAt(u++)-43],c=Tm[e.charCodeAt(u++)-43],n[f++]=s<<2|o>>4,a!==64&&(n[f++]=(o&15)<<4|a>>2,c!==64&&(n[f++]=(a&3)<<6|c));return t?f-r:n.subarray(0,f)};xr.binary.base58.encode=function(e,t){return xr.binary.baseN.encode(e,O4e,t)};xr.binary.base58.decode=function(e,t){return xr.binary.baseN.decode(e,O4e,t)};xr.text={utf8:{},utf16:{}};xr.text.utf8.encode=function(e,t,r){e=xr.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var s=r,o=0;o<e.length;++o)n[s++]=e.charCodeAt(o);return t?s-r:n};xr.text.utf8.decode=function(e){return xr.decodeUtf8(String.fromCharCode.apply(null,e))};xr.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length*2));var s=new Uint16Array(n.buffer);r=r||0;for(var o=r,a=r,c=0;c<e.length;++c)s[a++]=e.charCodeAt(c),o+=2;return t?o-r:n};xr.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))};xr.deflate=function(e,t,r){if(t=xr.decode64(e.deflate(xr.encode64(t)).rval),r){var n=2,s=t.charCodeAt(1);s&32&&(n=6),t=t.substring(n,t.length-4)}return t};xr.inflate=function(e,t,r){var n=e.inflate(xr.encode64(t)).rval;return n===null?null:xr.decode64(n)};var yG=l(function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(r===null?n=e.removeItem(t):(r=xr.encode64(JSON.stringify(r)),n=e.setItem(t,r)),typeof n<"u"&&n.rval!==!0){var s=new Error(n.error.message);throw s.id=n.error.id,s.name=n.error.name,s}},"_setStorageObject"),vG=l(function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(r.rval===null){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return r!==null&&(r=JSON.parse(xr.decode64(r))),r},"_getStorageObject"),bZe=l(function(e,t,r,n){var s=vG(e,t);s===null&&(s={}),s[r]=n,yG(e,t,s)},"_setItem"),CZe=l(function(e,t,r){var n=vG(e,t);return n!==null&&(n=r in n?n[r]:null),n},"_getItem"),TZe=l(function(e,t,r){var n=vG(e,t);if(n!==null&&r in n){delete n[r];var s=!0;for(var o in n){s=!1;break}s&&(n=null),yG(e,t,n)}},"_removeItem"),EZe=l(function(e,t){yG(e,t,null)},"_clearItems"),ZI=l(function(e,t,r){var n=null;typeof r>"u"&&(r=["web","flash"]);var s,o=!1,a=null;for(var c in r){s=r[c];try{if(s==="flash"||s==="both"){if(t[0]===null)throw new Error("Flash local storage not available.");n=e.apply(this,t),o=s==="flash"}(s==="web"||s==="both")&&(t[0]=localStorage,n=e.apply(this,t),o=!0)}catch(u){a=u}if(o)break}if(!o)throw a;return n},"_callStorageFunction");xr.setItem=function(e,t,r,n,s){ZI(bZe,arguments,s)};xr.getItem=function(e,t,r,n){return ZI(CZe,arguments,n)};xr.removeItem=function(e,t,r,n){ZI(TZe,arguments,n)};xr.clearItems=function(e,t,r){ZI(EZe,arguments,r)};xr.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0};xr.format=function(e){for(var t=/%./g,r,n,s=0,o=[],a=0;r=t.exec(e);){n=e.substring(a,t.lastIndex-2),n.length>0&&o.push(n),a=t.lastIndex;var c=r[0][1];switch(c){case"s":case"o":s<arguments.length?o.push(arguments[s+++1]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+c+"?>")}}return o.push(e.substring(a)),o.join("")};xr.formatNumber=function(e,t,r,n){var s=e,o=isNaN(t=Math.abs(t))?2:t,a=r===void 0?",":r,c=n===void 0?".":n,u=s<0?"-":"",f=parseInt(s=Math.abs(+s||0).toFixed(o),10)+"",d=f.length>3?f.length%3:0;return u+(d?f.substr(0,d)+c:"")+f.substr(d).replace(/(\d{3})(?=\d)/g,"$1"+c)+(o?a+Math.abs(s-f).toFixed(o).slice(2):"")};xr.formatSize=function(e){return e>=1073741824?e=xr.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?e=xr.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?e=xr.formatNumber(e/1024,0)+" KiB":e=xr.formatNumber(e,0)+" bytes",e};xr.bytesFromIP=function(e){return e.indexOf(".")!==-1?xr.bytesFromIPv4(e):e.indexOf(":")!==-1?xr.bytesFromIPv6(e):null};xr.bytesFromIPv4=function(e){if(e=e.split(".")
`);for(var s="",o=0;o<t*r;++o)s+=" ";switch(n+=s+"Tag: ",e.tagClass){case zi.Class.UNIVERSAL:n+="Universal:";break;case zi.Class.APPLICATION:n+="Application:";break;case zi.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case zi.Class.PRIVATE:n+="Private:";break}if(e.tagClass===zi.Class.UNIVERSAL)switch(n+=e.type,e.type){case zi.Type.NONE:n+=" (None)";break;case zi.Type.BOOLEAN:n+=" (Boolean)";break;case zi.Type.INTEGER:n+=" (Integer)";break;case zi.Type.BITSTRING:n+=" (Bit string)";break;case zi.Type.OCTETSTRING:n+=" (Octet string)";break;case zi.Type.NULL:n+=" (Null)";break;case zi.Type.OID:n+=" (Object Identifier)";break;case zi.Type.ODESC:n+=" (Object Descriptor)";break;case zi.Type.EXTERNAL:n+=" (External or Instance of)";break;case zi.Type.REAL:n+=" (Real)";break;case zi.Type.ENUMERATED:n+=" (Enumerated)";break;case zi.Type.EMBEDDED:n+=" (Embedded PDV)";break;case zi.Type.UTF8:n+=" (UTF8)";break;case zi.Type.ROID:n+=" (Relative Object Identifier)";break;case zi.Type.SEQUENCE:n+=" (Sequence)";break;case zi.Type.SET:n+=" (Set)";break;case zi.Type.PRINTABLESTRING:n+=" (Printable String)";break;case zi.Type.IA5String:n+=" (IA5String (ASCII))";break;case zi.Type.UTCTIME:n+=" (UTC time)";break;case zi.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case zi.Type.BMPSTRING:n+=" (BMP String)";break}else n+=e.type;if(n+=`
`,n+=s+"Constructed: "+e.constructed+`
`,e.composed){for(var a=0,c="",o=0;o<e.value.length;++o)e.value[o]!==void 0&&(a+=1,c+=zi.prettyPrint(e.value[o],t+1,r),o+1<e.value.length&&(c+=","));n+=s+"Sub values: "+a+c}else{if(n+=s+"Value: ",e.type===zi.Type.OID){var u=zi.derToOid(e.value);n+=u,T0.pki&&T0.pki.oids&&u in T0.pki.oids&&(n+=" ("+T0.pki.oids[u]+") ")}if(e.type===zi.Type.INTEGER)try{n+=zi.derToInteger(e.value)}catch{n+="0x"+T0.util.bytesToHex(e.value)}else if(e.type===zi.Type.BITSTRING){if(e.value.length>1?n+="0x"+T0.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var f=e.value.charCodeAt(0);f==1?n+=" (1 unused bit shown)":f>1&&(n+=" ("+f+" unused bits shown)")}}else if(e.type===zi.Type.OCTETSTRING)U4e.test(e.value)||(n+="("+e.value+") "),n+="0x"+T0.util.bytesToHex(e.value);else if(e.type===zi.Type.UTF8)try{n+=T0.util.decodeUtf8(e.value)}catch(d){if(d.message==="URI malformed")n+="0x"+T0.util.bytesToHex(e.value)+" (malformed UTF8)";else throw d}else e.type===zi.Type.PRINTABLESTRING||e.type===zi.Type.IA5String?n+=e.value:U4e.test(e.value)?n+="0x"+T0.util.bytesToHex(e.value):e.value.length===0?n+="[null]":n+=e.value}return n}});var Op=w((EOt,H4e)=>{var sA=ia();H4e.exports=sA.md=sA.md||{};sA.md.algorithms=sA.md.algorithms||{}});var zy=w((SOt,$4e)=>{var J1=ia();Op();Na();var wZe=$4e.exports=J1.hmac=J1.hmac||{};wZe.create=function(){var e=null,t=null,r=null,n=null,s={};return s.start=function(o,a){if(o!==null)if(typeof o=="string")if(o=o.toLowerCase(),o in J1.md.algorithms)t=J1.md.algorithms[o].create();else throw new Error('Unknown hash algorithm "'+o+'"');else t=o;if(a===null)a=e;else{if(typeof a=="string")a=J1.util.createBuffer(a);else if(J1.util.isArray(a)){var c=a;a=J1.util.createBuffer();for(var u=0;u<c.length;++u)a.putByte(c[u])}var f=a.length();f>t.blockLength&&(t.start(),t.update(a.bytes()),a=t.digest()),r=J1.util.createBuffer(),n=J1.util.createBuffer(),f=a.length();for(var u=0;u<f;++u){var c=a.at(u);r.putByte(54^c),n.putByte(92^c)}if(f<t.blockLength)for(var c=t.blockLength-f,u=0;u<c;++u)r.putByte(54),n.putByte(92);e=a,r=r.bytes(),n=n.bytes()}t.start(),t.update(r)},s.update=function(o){t.update(o)},s.getMac=function(){var o=t.digest().bytes();return t.start(),t.update(n),t.update(o),t.digest()},s.digest=s.getMac,s}});var aA=w((wOt,W4e)=>{var kp=ia();Op();Na();var G4e=W4e.exports=kp.md5=kp.md5||{};kp.md.md5=kp.md.algorithms.md5=G4e;G4e.create=function(){z4e||IZe();var e=null,t=kp.util.createBuffer(),r=new Array(16),n={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var s=n.messageLengthSize/4,o=0;o<s;++o)n.fullMessageLength.push(0);return t=kp.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},n},n.start(),n.update=function(s,o){o==="utf8"&&(s=kp.util.encodeUtf8(s));var a=s.length;n.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var c=n.fullMessageLength.length-1;c>=0;--c)n.fullMessageLength[c]+=a[1],a[1]=a[0]+(n.fullMessageLength[c]/4294967296>>>0),n.fullMessageLength[c]=n.fullMessageLength[c]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(s),V4e(e,r,t),(t.read>2048||t.length()===0)&&t.compact(),n},n.digest=function(){var s=kp.util.createBuffer();s.putBytes(t.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,a=o&n.blockLength-1;s.putBytes(wG.substr(0,n.blockLength-a));for(var c,u=0,f=n.fullMessageLength.length-1;f>=0;--f)c=n.fullMessageLength[f]*8+u,u=c/4294967296>>>0,s.putInt32Le(c>>>0);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};V4e(d,r,s);var p=kp.util.createBuffer();return p.putInt32Le(d.h0),p.putInt32Le(d.h1),p.putInt32Le(d.h2),p.putInt32Le(d.h3),p},n};var wG=null,oA=null,c9=null,Wy=null,z4e=!1;function IZe(){wG="\x80",wG+=kp.util.fillString("\0",64),oA=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c9=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,
`,n;if(e.procType&&(n={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},r+=lA(n)),e.contentDomain&&(n={name:"Content-Domain",values:[e.contentDomain]},r+=lA(n)),e.dekInfo&&(n={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&n.values.push(e.dekInfo.parameters),r+=lA(n)),e.headers)for(var s=0;s<e.headers.length;++s)r+=lA(e.headers[s]);return e.procType&&(r+=`\r
`),r+=cA.util.encode64(e.body,t.maxline||64)+`\r
`,r+="-----END "+e.type+`-----\r
`,r};K4e.decode=function(e){for(var t=[],r=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,n=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,s=/\r?\n/,o;o=r.exec(e),!!o;){var a=o[1];a==="NEW CERTIFICATE REQUEST"&&(a="CERTIFICATE REQUEST");var c={type:a,procType:null,contentDomain:null,dekInfo:null,headers:[],body:cA.util.decode64(o[3])};if(t.push(c),!!o[2]){for(var u=o[2].split(s),f=0;o&&f<u.length;){for(var d=u[f].replace(/\s+$/,""),p=f+1;p<u.length;++p){var h=u[p];if(!/\s/.test(h[0]))break;d+=h,f=p}if(o=d.match(n),o){for(var m={name:o[1],values:[]},g=o[2].split(","),y=0;y<g.length;++y)m.values.push(AZe(g[y]));if(c.procType)if(!c.contentDomain&&m.name==="Content-Domain")c.contentDomain=g[0]||"";else if(!c.dekInfo&&m.name==="DEK-Info"){if(m.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');c.dekInfo={algorithm:g[0],parameters:g[1]||null}}else c.headers.push(m);else{if(m.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(m.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');c.procType={version:g[0],type:g[1]}}}++f}if(c.procType==="ENCRYPTED"&&!c.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(t.length===0)throw new Error("Invalid PEM formatted message.");return t};function lA(e){for(var t=e.name+": ",r=[],n=l(function(u,f){return" "+f},"insertSpace"),s=0;s<e.values.length;++s)r.push(e.values[s].replace(/^(\S+\r\n)/,n));t+=r.join(",")+`\r
`;for(var o=0,a=-1,s=0;s<t.length;++s,++o)if(o>65&&a!==-1){var c=t[a];c===","?(++a,t=t.substr(0,a)+`\r
`+t.substr(a)):t=t.substr(0,a)+`\r
`+c+t.substr(a+1),o=s-a-1,a=-1,++s}else(t[s]===" "||t[s]===" "||t[s]===",")&&(a=s);return t}l(lA,"foldHeader");function AZe(e){return e.replace(/^\s+/,"")}l(AZe,"ltrim")});var u9=w((POt,Q4e)=>{var O0=ia();eA();bG();Na();Q4e.exports=O0.des=O0.des||{};O0.des.startEncrypting=function(e,t,r,n){var s=uA({key:e,output:r,decrypt:!1,mode:n||(t===null?"ECB":"CBC")});return s.start(t),s};O0.des.createEncryptionCipher=function(e,t){return uA({key:e,output:null,decrypt:!1,mode:t})};O0.des.startDecrypting=function(e,t,r,n){var s=uA({key:e,output:r,decrypt:!0,mode:n||(t===null?"ECB":"CBC")});return s.start(t),s};O0.des.createDecryptionCipher=function(e,t){return uA({key:e,output:null,decrypt:!0,mode:t})};O0.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(n,s){return X4e(r._keys,n,s,!1)},decrypt:function(n,s){return X4e(r._keys,n,s,!0)}}}),r._init=!1};O0.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=O0.util.createBuffer(e.key);if(this.name.indexOf("3DES")===0&&t.length()!==24)throw new Error("Invalid Triple-DES key size: "+t.length()*8);this._keys=FZe(t),this._init=!0}};Np("DES-ECB",O0.cipher.modes.ecb);Np("DES-CBC",O0.cipher.modes.cbc);Np("DES-CFB",O0.cipher.modes.cfb);Np("DES-OFB",O0.cipher.modes.ofb);Np("DES-CTR",O0.cipher.modes.ctr);Np("3DES-ECB",O0.cipher.modes.ecb);Np("3DES-CBC",O0.cipher.modes.cbc);Np("3DES-CFB",O0.cipher.modes.cfb);Np("3DES-OFB",O0.cipher.modes.ofb);Np("3DES-CTR",O0.cipher.modes.ctr);function Np(e,t){var r=l(function(){return new O0.des.Algorithm(e,t)},"factory");O0.cipher.registerAlgorithm(e,r)}l(Np,"registerAlgorithm");var RZe=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],PZe=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],OZe=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],kZe=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],NZe=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,10
`;o+="Encryption: "+s+`\r
`,o+="Comment: "+r+`\r
`;var a=bl.util.createBuffer();iv(a,n),Up(a,e.e),Up(a,e.n);var c=bl.util.encode64(a.bytes(),64),u=Math.floor(c.length/66)+1;o+="Public-Lines: "+u+`\r
`,o+=c;var f=bl.util.createBuffer();Up(f,e.d),Up(f,e.p),Up(f,e.q),Up(f,e.qInv);var d;if(!t)d=bl.util.encode64(f.bytes(),64);else{var p=f.length()+16-1;p-=p%16;var h=RA(f.bytes());h.truncate(h.length()-p+f.length()),f.putBuffer(h);var m=bl.util.createBuffer();m.putBuffer(RA("\0\0\0\0",t)),m.putBuffer(RA("\0\0\0",t));var g=bl.aes.createEncryptionCipher(m.truncate(8),"CBC");g.start(bl.util.createBuffer().fillWithByte(0,16)),g.update(f.copy()),g.finish();var y=g.output;y.truncate(16),d=bl.util.encode64(y.bytes(),64)}u=Math.floor(d.length/66)+1,o+=`\r
Private-Lines: `+u+`\r
`,o+=d;var v=RA("putty-private-key-file-mac-key",t),_=bl.util.createBuffer();iv(_,n),iv(_,s),iv(_,r),_.putInt32(a.length()),_.putBuffer(a),_.putInt32(f.length()),_.putBuffer(f);var x=bl.hmac.create();return x.start("sha1",v),x.update(_.bytes()),o+=`\r
Private-MAC: `+x.digest().toHex()+`\r
`,o};PA.publicKeyToOpenSSH=function(e,t){var r="ssh-rsa";t=t||"";var n=bl.util.createBuffer();return iv(n,r),Up(n,e.e),Up(n,e.n),r+" "+bl.util.encode64(n.bytes())+" "+t};PA.privateKeyToOpenSSH=function(e,t){return t?bl.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):bl.pki.privateKeyToPem(e)};PA.getPublicKeyFingerprint=function(e,t){t=t||{};var r=t.md||bl.md.md5.create(),n="ssh-rsa",s=bl.util.createBuffer();iv(s,n),Up(s,e.e),Up(s,e.n),r.start(),r.update(s.getBytes());var o=r.digest();if(t.encoding==="hex"){var a=o.toHex();return t.delimiter?a.match(/.{2}/g).join(t.delimiter):a}else{if(t.encoding==="binary")return o.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return o};function Up(e,t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var n=bl.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}l(Up,"_addBigIntegerToBuffer");function iv(e,t){e.putInt32(t.length),e.putString(t)}l(iv,"_addStringToBuffer");function RA(){for(var e=bl.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest()}l(RA,"_sha1")});var Uve=w((Ikt,qve)=>{qve.exports=ia();Em();sve();Ld();eA();u9();Tve();zy();Ive();Ove();Nve();$G();fA();Z5();FG();zG();Mve();KG();qG();RG();vA();Wf();kG();Bve();ez();Na()});var jve=w((Akt,rnt)=>{rnt.exports={name:"@roamhq/mac-ca",version:"1.0.7",description:"Get Mac OS Root certificates",main:"index.js",repository:{type:"git",url:"https://github.com/WonderInventions/mac-ca.git"},scripts:{test:'echo "Error: no test specified" && exit 1',lint:"eslint ."},license:"BSD-3-Clause",dependencies:{"node-forge":"^1.3.1"},devDependencies:{eslint:"^8.22.0"}}});var Vve=w((Rkt,vz)=>{var kA=Uve(),Hve=jve(),OA=vz.exports.validFormats={der:0,pem:1,txt:2,asn1:3};function $ve(e){let t=kA.pki.pemToDer(e),r=kA.asn1,n=r.fromDer(t.data.toString("binary")).value[0].value,s=n[0],o=s.tagClass===r.Class.CONTEXT_SPECIFIC&&s.type===0&&s.constructed,a=n.slice(o);return{serial:a[0],issuer:a[2],valid:a[3],subject:a[4]}}l($ve,"myASN");function nnt(e){let t=$ve(e),r=new Date,n=t.subject.value.map(a=>a.value[0].value[1].value).join("/"),s=t.valid.value.map(a=>a.value).join(" - "),o=r.toTimeString().replace(/\s*\(.*\)\s*/,"");return[`Subject ${n}`,`Valid ${s}`,`Saved ${r.toLocaleDateString()} ${o} by ${Hve.name}@${Hve.version}`,String(e)].join(`
`)}l(nnt,"txtFormat");vz.exports.transform=function(e){return function(t){try{switch(e){case OA.der:return kA.pki.pemToDer(t);case OA.pem:return t;case OA.txt:return nnt(t);case OA.asn1:return $ve(t);default:return kA.pki.certificateFromPem(t)}}catch{return}}}});var Gve=w((Okt,sv)=>{var xz=require("https"),_z=Vve();if(process.platform!=="darwin")sv.exports.all=()=>[],sv.exports.each=()=>{};else{let c=function(f,d,p){return p.indexOf(f)===d};int=c,l(c,"duplicated");let e=require("child_process"),t=/(?=-----BEGIN\sCERTIFICATE-----)/g,r="/System/Library/Keychains/SystemRootCertificates.keychain",n=["find-certificate","-a","-p"],s=e.spawnSync("/usr/bin/security",n).stdout.toString().split(t),o=e.spawnSync("/usr/bin/security",n.concat(r)).stdout.toString().split(t);xz.globalAgent.options.ca=xz.globalAgent.options.ca||[];let a=xz.globalAgent.options.ca,u=s.concat(o);u.filter(c).forEach(f=>a.push(f)),sv.exports.der2=_z.validFormats,sv.exports.all=function(f){return u.map(_z.transform(f)).filter(d=>d)},sv.exports.each=function(f,d){return typeof f=="function"&&(d=f,f=void 0),u.map(_z.transform(f)).filter(p=>p).forEach(d)}}var int});var zve=w((Nkt,bz)=>{function snt(){let{X509Certificate:e}=require("crypto"),{join:t}=require("path");var r=typeof __webpack_require__=="function"?__non_webpack_require__:require;let n=r(t(__dirname,"crypt32.node")),s=[],o=new n.Crypt32;try{let a;for(;a=o.next();){let c=new e(a);s.push(c.toString())}}finally{o.done()}return Array.from(new Set(s))}l(snt,"all");process.platform!=="win32"?bz.exports.all=()=>[]:bz.exports.all=snt});var Jve=w(($kt,Qve)=>{var FA=require("path").sep||"/";Qve.exports=lnt;function lnt(e){if(typeof e!="string"||e.length<=7||e.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var t=decodeURI(e.substring(7)),r=t.indexOf("/"),n=t.substring(0,r),s=t.substring(r+1);return n=="localhost"&&(n=""),n&&(n=FA+FA+n),s=s.replace(/^(.+)\|/,"$1:"),FA=="\\"&&(s=s.replace(/\//g,"\\")),/^.+\:/.test(s)||(s=FA+s),n+s}l(lnt,"fileUriToPath")});var n8e=w((UA,r8e)=>{var jz=require("fs"),qA=require("path"),cnt=Jve(),BA=qA.join,t8e=qA.dirname,Zve=jz.accessSync&&function(e){try{jz.accessSync(e)}catch{return!1}return!0}||jz.existsSync||qA.existsSync,e8e={arrow:process.env.NODE_BINDINGS_ARROW||" \u2192 ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","compiled","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function unt(e){typeof e=="string"?e={bindings:e}:e||(e={}),Object.keys(e8e).map(function(u){u in e||(e[u]=e8e[u])}),e.module_root||(e.module_root=t8e(__filename)),qA.extname(e.bindings)!=".node"&&(e.bindings+=".node");for(var t=typeof __webpack_require__=="function"?__non_webpack_require__:require,r=[],n=0,s=e.try.length,o,a,c;n<s;n++){o=BA.apply(null,e.try[n].map(function(u){return e[u]||u})),r.push(o);try{return a=e.path?t.resolve(o):t(o),e.path||(a.path=o),a}catch(u){if(u.code!=="MODULE_NOT_FOUND"&&u.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(u.message))throw u}}throw c=new Error(`Could not locate the bindings file. Tried:
`+r.map(function(u){return e.arrow+u}).join(`
`)),c.tries=r,c}l(unt,"bindings");r8e.exports=UA=unt;UA.getFileName=l(function(t){var r=Error.prepareStackTrace,n=Error.stackTraceLimit,s={},o;Error.stackTraceLimit=10,Error.prepareStackTrace=function(c,u){for(var f=0,d=u.length;f<d;f++)if(o=u[f].getFileName(),o!==__filename)if(t){if(o!==t)return}else return},Error.captureStackTrace(s),new Error(s.stack),Error.prepareStackTrace=r,Error.stackTraceLimit=n;var a="file://";return o.indexOf(a)===0&&(o=cnt(o)),o},"getFileName");UA.getRoot=l(function(t){for(var r=t8e(t),n;;){if(r==="."&&(r=process.cwd()),Zve(BA(r,"package.json"))||Zve(BA(r,"node_modules")))return r;if(n===r)throw new Error('Could not find module root given file: "'+t+'". Do you have a `package.json` file? ');n=r,r=BA(r,"..")}},"getRoot")});var o8e=w((zkt,s8e)=>{"use strict";function i8e(e,t,r){let n=t[r];if(e==null&&n.required===!1)return;if(e==null)throw new TypeError(`Required parameter \`${n.name}\` missing`);let s=typeof e;if(n.type&&s!==n.type){if(n.required===!1&&t.slice(r).some(o=>o.type===s))return!1;throw new TypeError(`Invalid type for parameter \`${n.name}\`, expected \`${n.type}\` but found \`${typeof e}\``)}return!0}l(i8e,"validateParameter");function fnt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}l(fnt,"hasOwnProperty");function dnt(e,t){return function(){let r=Array.prototype.slice.call(arguments),n=[];for(let o=0,a=0;o<t.length;++o,++a){let c=t[o],u=r[a];fnt(c,"default")&&u==null&&(u=c.default),c.type==="object"&&c.default!=null&&(u=Object.assign({},c.default,u)),c.name==="options"&&(typeof u=="function"||u==null)&&(u={}),i8e(u,t,o)?n.push(u):a--}if(typeof arguments[arguments.length-1]!="function")return new Promise((o,a)=>{n.push((c,u)=>{if(c)return a(c);o(u)}),e.apply(this,n)});e.apply(this,n)}}l(dnt,"defineOperation");s8e.exports={defineOperation:dnt,validateParameter:i8e}});var Hz=w((Kkt,c8e)=>{"use strict";var av=n8e()("kerberos"),ov=av.KerberosClient,a8e=av.KerberosServer,Nm=o8e().defineOperation,pnt=1,hnt=2,mnt=4,gnt=8,ynt=16,vnt=32,xnt=64,_nt=128,bnt=256,l8e=0,Cnt=9,Tnt=6;ov.prototype.step=Nm(ov.prototype.step,[{name:"challenge",type:"string"},{name:"callback",type:"function",required:!1}]);ov.prototype.wrap=Nm(ov.prototype.wrap,[{name:"challenge",type:"string"},{name:"options",type:"object"},{name:"callback",type:"function",required:!1}]);ov.prototype.unwrap=Nm(ov.prototype.unwrap,[{name:"challenge",type:"string"},{name:"callback",type:"function",required:!1}]);a8e.prototype.step=Nm(a8e.prototype.step,[{name:"challenge",type:"string"},{name:"callback",type:"function",required:!1}]);var Ent=Nm(av.checkPassword,[{name:"username",type:"string"},{name:"password",type:"string"},{name:"service",type:"string"},{name:"defaultRealm",type:"string",required:!1},{name:"callback",type:"function",required:!1}]),Snt=Nm(av.principalDetails,[{name:"service",type:"string"},{name:"hostname",type:"string"},{name:"callback",type:"function",required:!1}]),wnt=Nm(av.initializeClient,[{name:"service",type:"string"},{name:"options",type:"object",default:{mechOID:l8e}},{name:"callback",type:"function",required:!1}]),Int=Nm(av.initializeServer,[{name:"service",type:"string"},{name:"callback",type:"function",required:!1}]);c8e.exports={initializeClient:wnt,initializeServer:Int,principalDetails:Snt,checkPassword:Ent,GSS_C_DELEG_FLAG:pnt,GSS_C_MUTUAL_FLAG:hnt,GSS_C_REPLAY_FLAG:mnt,GSS_C_SEQUENCE_FLAG:gnt,GSS_C_CONF_FLAG:ynt,GSS_C_INTEG_FLAG:vnt,GSS_C_ANON_FLAG:xnt,GSS_C_PROT_READY_FLAG:_nt,GSS_C_TRANS_FLAG:bnt,GSS_C_NO_OID:l8e,GSS_MECH_OID_KRB5:Cnt,GSS_MECH_OID_SPNEGO:Tnt}});var u8e=w((Ykt,Ant)=>{Ant.exports={name:"kerberos",version:"2.0.1",description:"Kerberos library for Node.js",main:"lib/index.js",files:["lib","src","binding.gyp","HISTORY.md","README.md"],repository:{type:"git",url:"https://github.com/mongodb-js/kerberos.git"},keywords:["kerberos","security","authentication"],author:{name:"The MongoDB NodeJS Team",email:"dbx-node@mongodb.com"},bugs:{url:"https://jira.mongodb.org/projects/NODE/issues/"},dependencies:{bindings:"^1.5.0","node-addon-api":"^4.3.0","prebuild-install":"7.1.1"},devDependenc
[ ]{`+Math.min.apply(Math,s)+"}","g");n=n.map(function(c){return c.replace(o,`
`)})}n[0]=n[0].replace(/^\r?\n/,"");var a=n[0];return t.forEach(function(c,u){var f=a.match(/(?:^|\n)( *)$/),d=f?f[1]:"",p=c;typeof c=="string"&&c.includes(`
`)&&(p=String(c).split(`
`).map(function(h,m){return m===0?h:""+d+h}).join(`
`)),a+=p+n[u+1]}),a}l(m6e,"dedent");R9.dedent=m6e;R9.default=m6e});var DR=w(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.thenable=Tl.typedArray=Tl.stringArray=Tl.array=Tl.func=Tl.error=Tl.number=Tl.string=Tl.boolean=void 0;function Uot(e){return e===!0||e===!1}l(Uot,"boolean");Tl.boolean=Uot;function sxe(e){return typeof e=="string"||e instanceof String}l(sxe,"string");Tl.string=sxe;function jot(e){return typeof e=="number"||e instanceof Number}l(jot,"number");Tl.number=jot;function Hot(e){return e instanceof Error}l(Hot,"error");Tl.error=Hot;function oxe(e){return typeof e=="function"}l(oxe,"func");Tl.func=oxe;function axe(e){return Array.isArray(e)}l(axe,"array");Tl.array=axe;function $ot(e){return axe(e)&&e.every(t=>sxe(t))}l($ot,"stringArray");Tl.stringArray=$ot;function Vot(e,t){return Array.isArray(e)&&e.every(t)}l(Vot,"typedArray");Tl.typedArray=Vot;function Got(e){return e&&oxe(e.then)}l(Got,"thenable");Tl.thenable=Got});var _v=w($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.stringArray=$c.array=$c.func=$c.error=$c.number=$c.string=$c.boolean=void 0;function zot(e){return e===!0||e===!1}l(zot,"boolean");$c.boolean=zot;function lxe(e){return typeof e=="string"||e instanceof String}l(lxe,"string");$c.string=lxe;function Wot(e){return typeof e=="number"||e instanceof Number}l(Wot,"number");$c.number=Wot;function Kot(e){return e instanceof Error}l(Kot,"error");$c.error=Kot;function Yot(e){return typeof e=="function"}l(Yot,"func");$c.func=Yot;function cxe(e){return Array.isArray(e)}l(cxe,"array");$c.array=cxe;function Xot(e){return cxe(e)&&e.every(t=>lxe(t))}l(Xot,"stringArray");$c.stringArray=Xot});var UY=w(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.Message=Os.NotificationType9=Os.NotificationType8=Os.NotificationType7=Os.NotificationType6=Os.NotificationType5=Os.NotificationType4=Os.NotificationType3=Os.NotificationType2=Os.NotificationType1=Os.NotificationType0=Os.NotificationType=Os.RequestType9=Os.RequestType8=Os.RequestType7=Os.RequestType6=Os.RequestType5=Os.RequestType4=Os.RequestType3=Os.RequestType2=Os.RequestType1=Os.RequestType=Os.RequestType0=Os.AbstractMessageSignature=Os.ParameterStructures=Os.ResponseError=Os.ErrorCodes=void 0;var m3=_v(),uxe;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3})(uxe=Os.ErrorCodes||(Os.ErrorCodes={}));var LR=class LR extends Error{constructor(t,r,n){super(r),this.code=m3.number(t)?t:uxe.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,LR.prototype)}toJson(){let t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),t}};l(LR,"ResponseError");var KK=LR;Os.ResponseError=KK;var bv=class bv{constructor(t){this.kind=t}static is(t){return t===bv.auto||t===bv.byName||t===bv.byPosition}toString(){return this.kind}};l(bv,"ParameterStructures");var Lu=bv;Os.ParameterStructures=Lu;Lu.auto=new Lu("auto");Lu.byPosition=new Lu("byPosition");Lu.byName=new Lu("byName");var yY=class yY{constructor(t,r){this.method=t,this.numberOfParams=r}get parameterStructures(){return Lu.auto}};l(yY,"AbstractMessageSignature");var w0=yY;Os.AbstractMessageSignature=w0;var vY=class vY extends w0{constructor(t){super(t,0)}};l(vY,"RequestType0");var YK=vY;Os.RequestType0=YK;var xY=class xY extends w0{constructor(t,r=Lu.auto){super(t,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};l(xY,"RequestType");var XK=xY;Os.RequestType=XK;var _Y=class _Y extends w0{constructor(t,r=Lu.auto){super(t,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};l(_Y,"RequestType1");var QK=_Y;Os.RequestType1=QK;var bY=class bY extends w0{constructor(t){super(t,2)}};l(bY
`,uat;(function(e){function t(r){let n=r;return n&&j9.func(n.dispose)&&j9.func(n.onClose)&&j9.func(n.onError)&&j9.func(n.write)}l(t,"is"),e.is=t})(uat=ah.MessageWriter||(ah.MessageWriter={}));var _X=class _X{constructor(){this.errorEmitter=new gxe.Emitter,this.closeEmitter=new gxe.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t,r,n){this.errorEmitter.fire([this.asError(t),r,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(t){return t instanceof Error?t:new Error(`Writer received error. Reason: ${j9.string(t.message)?t.message:"unknown"}`)}};l(_X,"AbstractMessageWriter");var $R=_X;ah.AbstractMessageWriter=$R;var vX;(function(e){function t(r){var n,s;return r===void 0||typeof r=="string"?{charset:r!=null?r:"utf-8",contentTypeEncoder:(0,mxe.default)().applicationJson.encoder}:{charset:(n=r.charset)!=null?n:"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:(s=r.contentTypeEncoder)!=null?s:(0,mxe.default)().applicationJson.encoder}}l(t,"fromOptions"),e.fromOptions=t})(vX||(vX={}));var bX=class bX extends $R{constructor(t,r){super(),this.writable=t,this.options=vX.fromOptions(r),this.errorCount=0,this.writeSemaphore=new lat.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(t){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(t,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let s=[];return s.push(cat,n.byteLength.toString(),yxe),s.push(yxe),this.doWrite(t,s,n)},n=>{throw this.fireError(n),n}))}async doWrite(t,r,n){try{return await this.writable.write(r.join(""),"ascii"),this.writable.write(n)}catch(s){return this.handleError(s,t),Promise.reject(s)}}handleError(t,r){this.errorCount++,this.fireError(t,r,this.errorCount)}end(){this.writable.end()}};l(bX,"WriteableStreamMessageWriter");var xX=bX;ah.WriteableStreamMessageWriter=xX});var xxe=w(VR=>{"use strict";Object.defineProperty(VR,"__esModule",{value:!0});VR.AbstractMessageBuffer=void 0;var fat=13,dat=10,pat=`\r
`,TX=class TX{constructor(t="utf-8"){this._encoding=t,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(t){let r=typeof t=="string"?this.fromString(t,this._encoding):t;this._chunks.push(r),this._totalLength+=r.byteLength}tryReadHeaders(t=!1){if(this._chunks.length===0)return;let r=0,n=0,s=0,o=0;e:for(;n<this._chunks.length;){let f=this._chunks[n];for(s=0;s<f.length;){switch(f[s]){case fat:switch(r){case 0:r=1;break;case 2:r=3;break;default:r=0}break;case dat:switch(r){case 1:r=2;break;case 3:r=4,s++;break e;default:r=0}break;default:r=0}s++}o+=f.byteLength,n++}if(r!==4)return;let a=this._read(o+s),c=new Map,u=this.toString(a,"ascii").split(pat);if(u.length<2)return c;for(let f=0;f<u.length-2;f++){let d=u[f],p=d.indexOf(":");if(p===-1)throw new Error("Message header must separate key and value using :");let h=d.substr(0,p),m=d.substr(p+1).trim();c.set(t?h.toLowerCase():h,m)}return c}tryReadBody(t){if(!(this._totalLength<t))return this._read(t)}get numberOfBytes(){return this._totalLength}_read(t){if(t===0)return this.emptyBuffer();if(t>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let o=this._chunks[0];return this._chunks.shift(),this._totalLength-=t,this.asNative(o)}if(this._chunks[0].byteLength>t){let o=this._chunks[0],a=this.asNative(o,t);return this._chunks[0]=o.slice(t),this._totalLength-=t,a}let r=this.allocNative(t),n=0,s=0;for(;t>0;){let o=this._chunks[s];if(o.byteLength>t){let a=o.slice(0,t);r.set(a,n),n+=t,this._chunks[s]=o.slice(t),this._totalLength-=t,t-=t}else r.set(o,n),n+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,t-=o.byteLength}return r}};l(TX,"AbstractMessageBuffer");var CX=TX;VR.AbstractMessageBuffer=CX});var wxe=w(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.createMessageConnection=Rs.ConnectionOptions=Rs.MessageStrategy=Rs.CancellationStrategy=Rs.CancellationSenderStrategy=Rs.CancellationReceiverStrategy=Rs.RequestCancellationReceiverStrategy=Rs.IdCancellationReceiverStrategy=Rs.ConnectionStrategy=Rs.ConnectionError=Rs.ConnectionErrors=Rs.LogTraceNotification=Rs.SetTraceNotification=Rs.TraceFormat=Rs.TraceValues=Rs.Trace=Rs.NullLogger=Rs.ProgressType=Rs.ProgressToken=void 0;var _xe=Gm(),U0=_v(),qs=UY(),bxe=VY(),H9=Cv(),EX=UR(),V9;(function(e){e.type=new qs.NotificationType("$/cancelRequest")})(V9||(V9={}));var Cxe;(function(e){function t(r){return typeof r=="string"||typeof r=="number"}l(t,"is"),e.is=t})(Cxe=Rs.ProgressToken||(Rs.ProgressToken={}));var $9;(function(e){e.type=new qs.NotificationType("$/progress")})($9||($9={}));var NX=class NX{constructor(){}};l(NX,"ProgressType");var SX=NX;Rs.ProgressType=SX;var wX;(function(e){function t(r){return U0.func(r)}l(t,"is"),e.is=t})(wX||(wX={}));Rs.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var e0;(function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Compact=2]="Compact",e[e.Verbose=3]="Verbose"})(e0=Rs.Trace||(Rs.Trace={}));var hat;(function(e){e.Off="off",e.Messages="messages",e.Compact="compact",e.Verbose="verbose"})(hat=Rs.TraceValues||(Rs.TraceValues={}));(function(e){function t(n){if(!U0.string(n))return e.Off;switch(n=n.toLowerCase(),n){case"off":return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose;default:return e.Off}}l(t,"fromString"),e.fromString=t;function r(n){switch(n){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}l(r,"toString"),e.toString=r})(e0=Rs.Trace||(Rs.Trace={}));var Hd;(function(e){e.Text="text",e.JSON="json"})(Hd=Rs.TraceFormat||(Rs.TraceFormat={}));(function(e){function t(r){return U0.string(r)?(r=r.toLowerCase(),r==="json"?e.JSON:e.Text):e.Text}l(t,"fromString"),e.fromString=t})(Hd=Rs.TraceFormat||(Rs.TraceFormat={}));var Txe;(function(e){e.type=new qs.NotificationType("$/setTrace")})(Txe=Rs.SetTraceNotification||(Rs.SetTraceNotification={}));var IX;(function(e){e.type=new qs.NotificationType("$/logTrace")})(IX=Rs.
${JSON.stringify(xe.error,void 0,4)}`):s.error("Received response message without id. No further error information provided.");else{let A=xe.id,O=v.get(A);if(wt(xe,O),O!==void 0){v.delete(A);try{if(xe.error){let Ir=xe.error;O.reject(new qs.ResponseError(Ir.code,Ir.message,Ir.data))}else if(xe.result!==void 0)O.resolve(xe.result);else throw new Error("Should never happen.")}catch(Ir){Ir.message?s.error(`Response handler '${O.method}' failed with message: ${Ir.message}`):s.error(`Response handler '${O.method}' failed unexpectedly.`)}}}}l(yr,"handleResponse");function ve(xe){if(Ve())return;let A,O;if(xe.method===V9.type.method){let Ir=xe.params.id;_.delete(Ir),L(xe);return}else{let Ir=h.get(xe.method);Ir&&(O=Ir.handler,A=Ir.type)}if(O||p)try{if(L(xe),O)if(xe.params===void 0)A!==void 0&&A.numberOfParams!==0&&A.parameterStructures!==qs.ParameterStructures.byName&&s.error(`Notification ${xe.method} defines ${A.numberOfParams} params but received none.`),O();else if(Array.isArray(xe.params)){let Ir=xe.params;xe.method===$9.type.method&&Ir.length===2&&Cxe.is(Ir[0])?O({token:Ir[0],value:Ir[1]}):(A!==void 0&&(A.parameterStructures===qs.ParameterStructures.byName&&s.error(`Notification ${xe.method} defines parameters by name but received parameters by position`),A.numberOfParams!==xe.params.length&&s.error(`Notification ${xe.method} defines ${A.numberOfParams} params but received ${Ir.length} arguments`)),O(...Ir))}else A!==void 0&&A.parameterStructures===qs.ParameterStructures.byPosition&&s.error(`Notification ${xe.method} defines parameters by position but received parameters by name`),O(xe.params);else p&&p(xe.method,xe.params)}catch(Ir){Ir.message?s.error(`Notification handler '${xe.method}' failed with message: ${Ir.message}`):s.error(`Notification handler '${xe.method}' failed unexpectedly.`)}else be.fire(xe)}l(ve,"handleNotification");function Er(xe){if(!xe){s.error("Received empty message.");return}s.error(`Received message which is neither a response nor a notification message:
${JSON.stringify(xe,null,4)}`);let A=xe;if(U0.string(A.id)||U0.number(A.id)){let O=A.id,Ir=v.get(O);Ir&&Ir.reject(new Error("The received response has neither a result nor an error property."))}}l(Er,"handleInvalidMessage");function Tr(xe){if(xe!=null)switch(b){case e0.Verbose:return JSON.stringify(xe,null,4);case e0.Compact:return JSON.stringify(xe);default:return}}l(Tr,"stringifyTrace");function wr(xe){if(!(b===e0.Off||!S))if(E===Hd.Text){let A;(b===e0.Verbose||b===e0.Compact)&&xe.params&&(A=`Params: ${Tr(xe.params)}
`),S.log(`Sending request '${xe.method} - (${xe.id})'.`,A)}else je("send-request",xe)}l(wr,"traceSendingRequest");function Ur(xe){if(!(b===e0.Off||!S))if(E===Hd.Text){let A;(b===e0.Verbose||b===e0.Compact)&&(xe.params?A=`Params: ${Tr(xe.params)}
`:A=`No parameters provided.
`),S.log(`Sending notification '${xe.method}'.`,A)}else je("send-notification",xe)}l(Ur,"traceSendingNotification");function le(xe,A,O){if(!(b===e0.Off||!S))if(E===Hd.Text){let Ir;(b===e0.Verbose||b===e0.Compact)&&(xe.error&&xe.error.data?Ir=`Error data: ${Tr(xe.error.data)}
`:xe.result?Ir=`Result: ${Tr(xe.result)}
`:xe.error===void 0&&(Ir=`No result returned.
`)),S.log(`Sending response '${A} - (${xe.id})'. Processing request took ${Date.now()-O}ms`,Ir)}else je("send-response",xe)}l(le,"traceSendingResponse");function He(xe){if(!(b===e0.Off||!S))if(E===Hd.Text){let A;(b===e0.Verbose||b===e0.Compact)&&xe.params&&(A=`Params: ${Tr(xe.params)}
`),S.log(`Received request '${xe.method} - (${xe.id})'.`,A)}else je("receive-request",xe)}l(He,"traceReceivedRequest");function L(xe){if(!(b===e0.Off||!S||xe.method===IX.type.method))if(E===Hd.Text){let A;(b===e0.Verbose||b===e0.Compact)&&(xe.params?A=`Params: ${Tr(xe.params)}
`:A=`No parameters provided.
`),S.log(`Received notification '${xe.method}'.`,A)}else je("receive-notification",xe)}l(L,"traceReceivedNotification");function wt(xe,A){if(!(b===e0.Off||!S))if(E===Hd.Text){let O;if((b===e0.Verbose||b===e0.Compact)&&(xe.error&&xe.error.data?O=`Error data: ${Tr(xe.error.data)}
`:xe.result?O=`Result: ${Tr(xe.result)}
`:xe.error===void 0&&(O=`No result returned.
`)),A){let Ir=xe.error?` Request failed: ${xe.error.message} (${xe.error.code}).`:"";S.log(`Received response '${A.method} - (${xe.id})' in ${Date.now()-A.timerStart}ms.${Ir}`,O)}else S.log(`Received response ${xe.id} without active response promise.`,O)}else je("receive-response",xe)}l(wt,"traceReceivedResponse");function je(xe,A){if(!S||b===e0.Off)return;let O={isLSPMessage:!0,type:xe,message:A,timestamp:Date.now()};S.log(O)}l(je,"logLSPMessage");function Nr(){if(Ie())throw new Sv(GR.Closed,"Connection is closed.");if(Ve())throw new Sv(GR.Disposed,"Connection is disposed.")}l(Nr,"throwIfClosedOrDisposed");function Mr(){if(At())throw new Sv(GR.AlreadyListening,"Connection is already listening")}l(Mr,"throwIfListening");function Br(){if(!At())throw new Error("Call listen() first.")}l(Br,"throwIfNotListening");function fn(xe){return xe===void 0?null:xe}l(fn,"undefinedToNull");function gn(xe){if(xe!==null)return xe}l(gn,"nullToUndefined");function Fi(xe){return xe!=null&&!Array.isArray(xe)&&typeof xe=="object"}l(Fi,"isNamedParam");function $i(xe,A){switch(xe){case qs.ParameterStructures.auto:return Fi(A)?gn(A):[fn(A)];case qs.ParameterStructures.byName:if(!Fi(A))throw new Error("Received parameters by name but param is not an object literal.");return gn(A);case qs.ParameterStructures.byPosition:return[fn(A)];default:throw new Error(`Unknown parameter structure ${xe.toString()}`)}}l($i,"computeSingleParam");function Vi(xe,A){let O,Ir=xe.numberOfParams;switch(Ir){case 0:O=void 0;break;case 1:O=$i(xe.parameterStructures,A[0]);break;default:O=[];for(let Zr=0;Zr<A.length&&Zr<Ir;Zr++)O.push(fn(A[Zr]));if(A.length<Ir)for(let Zr=A.length;Zr<Ir;Zr++)O.push(null);break}return O}l(Vi,"computeMessageParams");let en={sendNotification:(xe,...A)=>{Nr();let O,Ir;if(U0.string(xe)){O=xe;let dn=A[0],yn=0,wn=qs.ParameterStructures.auto;qs.ParameterStructures.is(dn)&&(yn=1,wn=dn);let Ai=A.length,sn=Ai-yn;switch(sn){case 0:Ir=void 0;break;case 1:Ir=$i(wn,A[yn]);break;default:if(wn===qs.ParameterStructures.byName)throw new Error(`Received ${sn} parameters for 'by Name' notification parameter structure.`);Ir=A.slice(yn,Ai).map(ei=>fn(ei));break}}else{let dn=A;O=xe.method,Ir=Vi(xe,dn)}let Zr={jsonrpc:u,method:O,params:Ir};return Ur(Zr),t.write(Zr).catch(dn=>{throw s.error("Sending notification failed."),dn})},onNotification:(xe,A)=>{Nr();let O;return U0.func(xe)?p=xe:A&&(U0.string(xe)?(O=xe,h.set(xe,{type:void 0,handler:A})):(O=xe.method,h.set(xe.method,{type:xe,handler:A}))),{dispose:()=>{O!==void 0?h.delete(O):p=void 0}}},onProgress:(xe,A,O)=>{if(m.has(A))throw new Error(`Progress handler for token ${A} already registered`);return m.set(A,O),{dispose:()=>{m.delete(A)}}},sendProgress:(xe,A,O)=>en.sendNotification($9.type,{token:A,value:O}),onUnhandledProgress:Se.event,sendRequest:(xe,...A)=>{Nr(),Br();let O,Ir,Zr;if(U0.string(xe)){O=xe;let Ai=A[0],sn=A[A.length-1],ei=0,hn=qs.ParameterStructures.auto;qs.ParameterStructures.is(Ai)&&(ei=1,hn=Ai);let ti=A.length;EX.CancellationToken.is(sn)&&(ti=ti-1,Zr=sn);let Ri=ti-ei;switch(Ri){case 0:Ir=void 0;break;case 1:Ir=$i(hn,A[ei]);break;default:if(hn===qs.ParameterStructures.byName)throw new Error(`Received ${Ri} parameters for 'by Name' request parameter structure.`);Ir=A.slice(ei,ti).map(Mt=>fn(Mt));break}}else{let Ai=A;O=xe.method,Ir=Vi(xe,Ai);let sn=xe.numberOfParams;Zr=EX.CancellationToken.is(Ai[sn])?Ai[sn]:void 0}let dn=o++,yn;Zr&&(yn=Zr.onCancellationRequested(()=>{let Ai=ye.sender.sendCancellation(en,dn);return Ai===void 0?(s.log(`Received no promise from cancellation strategy when cancelling id ${dn}`),Promise.resolve()):Ai.catch(()=>{s.log(`Sending cancellation messages for id ${dn} failed`)})}));let wn={jsonrpc:u,id:dn,method:O,params:Ir};return wr(wn),typeof ye.sender.enableCancellation=="function"&&ye.sender.enableCancellation(wn),new Promise(async(Ai,sn)=>{let ei=l(Ri=>{Ai(Ri),ye.sender.cleanup(dn),yn==null||yn.dispose()},"resolveWithCleanup"),hn=l(Ri=>{sn(Ri),ye.sender.cleanup(dn),yn==null||yn.dispose()},"rejectWithCleanup"),ti={method:O,timerStart:Date.now(),resolve:ei,reject:hn};try{await
`,`\r
`,"\r"];var ti;(function(F){function qe(Yt,br,Vr,Ci){return new Ri(Yt,br,Vr,Ci)}l(qe,"create"),F.create=qe;function Ke(Yt){var br=Yt;return!!(Mt.defined(br)&&Mt.string(br.uri)&&(Mt.undefined(br.languageId)||Mt.string(br.languageId))&&Mt.uinteger(br.lineCount)&&Mt.func(br.getText)&&Mt.func(br.positionAt)&&Mt.func(br.offsetAt))}l(Ke,"is"),F.is=Ke;function re(Yt,br){for(var Vr=Yt.getText(),Ci=k(br,function(Xi,Ji){var ms=Xi.range.start.line-Ji.range.start.line;return ms===0?Xi.range.start.character-Ji.range.start.character:ms}),vn=Vr.length,Bi=Ci.length-1;Bi>=0;Bi--){var qi=Ci[Bi],Gi=Yt.offsetAt(qi.range.start),on=Yt.offsetAt(qi.range.end);if(on<=vn)Vr=Vr.substring(0,Gi)+qi.newText+Vr.substring(on,Vr.length);else throw new Error("Overlapping edit");vn=Gi}return Vr}l(re,"applyEdits"),F.applyEdits=re;function k(Yt,br){if(Yt.length<=1)return Yt;var Vr=Yt.length/2|0,Ci=Yt.slice(0,Vr),vn=Yt.slice(Vr);k(Ci,br),k(vn,br);for(var Bi=0,qi=0,Gi=0;Bi<Ci.length&&qi<vn.length;){var on=br(Ci[Bi],vn[qi]);on<=0?Yt[Gi++]=Ci[Bi++]:Yt[Gi++]=vn[qi++]}for(;Bi<Ci.length;)Yt[Gi++]=Ci[Bi++];for(;qi<vn.length;)Yt[Gi++]=vn[qi++];return Yt}l(k,"mergeSort")})(ti=t.TextDocument||(t.TextDocument={}));var Ri=function(){function F(qe,Ke,re,k){this._uri=qe,this._languageId=Ke,this._version=re,this._content=k,this._lineOffsets=void 0}return l(F,"FullTextDocument"),Object.defineProperty(F.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),F.prototype.getText=function(qe){if(qe){var Ke=this.offsetAt(qe.start),re=this.offsetAt(qe.end);return this._content.substring(Ke,re)}return this._content},F.prototype.update=function(qe,Ke){this._content=qe.text,this._version=Ke,this._lineOffsets=void 0},F.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var qe=[],Ke=this._content,re=!0,k=0;k<Ke.length;k++){re&&(qe.push(k),re=!1);var Yt=Ke.charAt(k);re=Yt==="\r"||Yt===`
`,Yt==="\r"&&k+1<Ke.length&&Ke.charAt(k+1)===`
`&&k++}re&&Ke.length>0&&qe.push(Ke.length),this._lineOffsets=qe}return this._lineOffsets},F.prototype.positionAt=function(qe){qe=Math.max(Math.min(qe,this._content.length),0);var Ke=this.getLineOffsets(),re=0,k=Ke.length;if(k===0)return a.create(0,qe);for(;re<k;){var Yt=Math.floor((re+k)/2);Ke[Yt]>qe?k=Yt:re=Yt+1}var br=re-1;return a.create(br,qe-Ke[br])},F.prototype.offsetAt=function(qe){var Ke=this.getLineOffsets();if(qe.line>=Ke.length)return this._content.length;if(qe.line<0)return 0;var re=Ke[qe.line],k=qe.line+1<Ke.length?Ke[qe.line+1]:this._content.length;return Math.max(Math.min(re+qe.character,k),re)},Object.defineProperty(F.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),F}(),Mt;(function(F){var qe=Object.prototype.toString;function Ke(on){return typeof on<"u"}l(Ke,"defined"),F.defined=Ke;function re(on){return typeof on>"u"}l(re,"undefined"),F.undefined=re;function k(on){return on===!0||on===!1}l(k,"boolean"),F.boolean=k;function Yt(on){return qe.call(on)==="[object String]"}l(Yt,"string"),F.string=Yt;function br(on){return qe.call(on)==="[object Number]"}l(br,"number"),F.number=br;function Vr(on,Xi,Ji){return qe.call(on)==="[object Number]"&&Xi<=on&&on<=Ji}l(Vr,"numberRange"),F.numberRange=Vr;function Ci(on){return qe.call(on)==="[object Number]"&&-2147483648<=on&&on<=2147483647}l(Ci,"integer"),F.integer=Ci;function vn(on){return qe.call(on)==="[object Number]"&&0<=on&&on<=2147483647}l(vn,"uinteger"),F.uinteger=vn;function Bi(on){return qe.call(on)==="[object Function]"}l(Bi,"func"),F.func=Bi;function qi(on){return on!==null&&typeof on=="object"}l(qi,"objectLiteral"),F.objectLiteral=qi;function Gi(on,Xi){return Array.isArray(on)&&on.every(Xi)}l(Gi,"typedArray"),F.typedArray=Gi})(Mt||(Mt={}))})});var j0=w(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.ProtocolNotificationType=au.ProtocolNotificationType0=au.ProtocolRequestType=au.ProtocolRequestType0=au.RegistrationType=au.MessageDirection=void 0;var Iv=_3(),Nat;(function(e){e.clientToServer="clientToServer",e.serverToClient="serverToClient",e.both="both"})(Nat=au.MessageDirection||(au.MessageDirection={}));var aQ=class aQ{constructor(t){this.method=t}};l(aQ,"RegistrationType");var rQ=aQ;au.RegistrationType=rQ;var lQ=class lQ extends Iv.RequestType0{constructor(t){super(t)}};l(lQ,"ProtocolRequestType0");var nQ=lQ;au.ProtocolRequestType0=nQ;var cQ=class cQ extends Iv.RequestType{constructor(t){super(t,Iv.ParameterStructures.byName)}};l(cQ,"ProtocolRequestType");var iQ=cQ;au.ProtocolRequestType=iQ;var uQ=class uQ extends Iv.NotificationType0{constructor(t){super(t)}};l(uQ,"ProtocolNotificationType0");var sQ=uQ;au.ProtocolNotificationType0=sQ;var fQ=class fQ extends Iv.NotificationType{constructor(t){super(t,Iv.ParameterStructures.byName)}};l(fQ,"ProtocolNotificationType");var oQ=fQ;au.ProtocolNotificationType=oQ});var eP=w(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.objectLiteral=El.typedArray=El.stringArray=El.array=El.func=El.error=El.number=El.string=El.boolean=void 0;function Dat(e){return e===!0||e===!1}l(Dat,"boolean");El.boolean=Dat;function Fxe(e){return typeof e=="string"||e instanceof String}l(Fxe,"string");El.string=Fxe;function Lat(e){return typeof e=="number"||e instanceof Number}l(Lat,"number");El.number=Lat;function Mat(e){return e instanceof Error}l(Mat,"error");El.error=Mat;function Fat(e){return typeof e=="function"}l(Fat,"func");El.func=Fat;function Bxe(e){return Array.isArray(e)}l(Bxe,"array");El.array=Bxe;function Bat(e){return Bxe(e)&&e.every(t=>Fxe(t))}l(Bat,"stringArray");El.stringArray=Bat;function qat(e,t){return Array.isArray(e)&&e.every(t)}l(qat,"typedArray");El.typedArray=qat;function Uat(e){return e!==null&&typeof e=="object"}l(Uat,"objectLiteral");El.objectLiteral=Uat});var Uxe=w(z9=>{"use strict";Object.defineProperty(z9,"__esModule",{value:!0});z9.ImplementationRequest=void 0;var qxe=j0(),jat;(function(e){e.method="textDocument/implementation",e.messageDirection=qxe.MessageDirection.clientToServer,e.type=new qxe.Protocol
`).map(s=>s.split(" ")),n=0;return r.forEach(s=>{s.length>1&&Uu.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),Uu.stringWidth(s[0])))}),r.forEach(s=>{this.div(...s.map((o,a)=>({text:o.trim(),padding:this.measurePadding(o),width:a===0&&s.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){let r=Uu.stripAnsi(t);return[0,r.match(/\s*$/)[0].length,0,r.match(/^\s*/)[0].length]}toString(){let t=[];return this.rows.forEach(r=>{this.rowToString(r,t)}),t.filter(r=>!r.hidden).map(r=>r.text).join(`
`)}rowToString(t,r){return this.rasterize(t).forEach((n,s)=>{let o="";n.forEach((a,c)=>{let{width:u}=t[c],f=this.negatePadding(t[c]),d=a;if(f>Uu.stringWidth(a)&&(d+=" ".repeat(f-Uu.stringWidth(a))),t[c].align&&t[c].align!=="left"&&this.wrap){let h=MCe[t[c].align];d=h(d,f),Uu.stringWidth(d)<f&&(d+=" ".repeat((u||0)-Uu.stringWidth(d)-1))}let p=t[c].padding||[0,0,0,0];p[D_]&&(o+=" ".repeat(p[D_])),o+=Vee(t[c],d,"| "),o+=d,o+=Vee(t[c],d," |"),p[N_]&&(o+=" ".repeat(p[N_])),s===0&&r.length>0&&(o=this.renderInline(o,r[r.length-1]))}),r.push({text:o.replace(/ +$/,""),span:t.span})}),r}renderInline(t,r){let n=t.match(/^ */),s=n?n[0].length:0,o=r.text,a=Uu.stringWidth(o.trimRight());return r.span?this.wrap?s<a?t:(r.hidden=!0,o.trimRight()+" ".repeat(s-a)+t.trimLeft()):(r.hidden=!0,o+t):t}rasterize(t){let r=[],n=this.columnWidths(t),s;return t.forEach((o,a)=>{o.width=n[a],this.wrap?s=Uu.wrap(o.text,this.negatePadding(o),{hard:!0}).split(`
`):s=o.text.split(`
`),o.border&&(s.unshift("."+"-".repeat(this.negatePadding(o)+2)+"."),s.push("'"+"-".repeat(this.negatePadding(o)+2)+"'")),o.padding&&(s.unshift(...new Array(o.padding[FCe]||0).fill("")),s.push(...new Array(o.padding[BCe]||0).fill(""))),s.forEach((c,u)=>{r[u]||r.push([]);let f=r[u];for(let d=0;d<a;d++)f[d]===void 0&&f.push("");f.push(c)})}),r}negatePadding(t){let r=t.width||0;return t.padding&&(r-=(t.padding[D_]||0)+(t.padding[N_]||0)),t.border&&(r-=4),r}columnWidths(t){if(!this.wrap)return t.map(a=>a.width||Uu.stringWidth(a.text));let r=t.length,n=this.width,s=t.map(a=>{if(a.width)return r--,n-=a.width,a.width}),o=r?Math.floor(n/r):0;return s.map((a,c)=>a===void 0?Math.max(o,qCe(t[c])):a)}};l(QO,"UI");var XO=QO;function Vee(e,t,r){return e.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?r:" ":""}l(Vee,"addBorder");function qCe(e){let t=e.padding||[],r=1+(t[D_]||0)+(t[N_]||0);return e.border?r+4:r}l(qCe,"_minWidth");function UCe(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}l(UCe,"getWindowWidth");function jCe(e,t){e=e.trim();let r=Uu.stringWidth(e);return r<t?" ".repeat(t-r)+e:e}l(jCe,"alignRight");function HCe(e,t){e=e.trim();let r=Uu.stringWidth(e);return r>=t?e:" ".repeat(t-r>>1)+e}l(HCe,"alignCenter");var Uu;function Gee(e,t){return Uu=t,new XO({width:(e==null?void 0:e.width)||UCe(),wrap:e==null?void 0:e.wrap})}l(Gee,"cliui");var zee=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function JO(e){return e.replace(zee,"")}l(JO,"stripAnsi");function Wee(e,t){let[r,n]=e.match(zee)||["",""];e=JO(e);let s="";for(let o=0;o<e.length;o++)o!==0&&o%t===0&&(s+=`
`),s+=e.charAt(o);return r&&n&&(s=`${r}${s}${n}`),s}l(Wee,"wrap");function ZO(e){return Gee(e,{stringWidth:t=>[...t].length,stripAnsi:JO,wrap:Wee})}l(ZO,"ui");var c2=require("path"),L_=require("fs");function ek(e,t){let r=(0,c2.resolve)(".",e),n;for((0,L_.statSync)(r).isDirectory()||(r=(0,c2.dirname)(r));;){if(n=t(r,(0,L_.readdirSync)(r)),n)return(0,c2.resolve)(r,n);if(r=(0,c2.dirname)(n=r),n===r)break}}l(ek,"default");var cte=require("util"),ute=require("fs"),fte=require("url");var Jee=require("util"),q_=require("path");function fg(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let r="",n=!1,s=e.match(/^-+/);for(let o=s?s[0].length:0;o<e.length;o++){let a=e.charAt(o);n&&(n=!1,a=a.toUpperCase()),o!==0&&(a==="-"||a==="_")?n=!0:a!=="-"&&a!=="_"&&(r+=a)}return r}}l(fg,"camelCase");function M_(e,t){let r=e.toLowerCase();t=t||"-";let n="";for(let s=0;s<e.length;s++){let o=r.charAt(s),a=e.charAt(s);o!==a&&s>0?n+=`${t}${r.charAt(s)}`:n+=a}return n}l(M_,"decamelize");function F_(e){return e==null?!1:typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^0[^.]/.test(e)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}l(F_,"looksLikeNumber");function Kee(e){if(Array.isArray(e))return e.map(a=>typeof a!="string"?a+"":a);e=e.trim();let t=0,r=null,n=null,s=null,o=[];for(let a=0;a<e.length;a++){if(r=n,n=e.charAt(a),n===" "&&!s){r!==" "&&t++;continue}n===s?s=null:(n==="'"||n==='"')&&!s&&(s=n),o[t]||(o[t]=""),o[t]+=n}return o}l(Kee,"tokenizeArgString");var ff;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(ff||(ff={}));var o1,rk=class rk{constructor(t){o1=t}parse(t,r){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},r),s=Kee(t),o=typeof t=="string",a=$Ce(Object.assign(Object.create(null),n.alias)),c=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),u=Object.assign(Object.create(null),n.default),f=n.configObjects||[],d=n.envPrefix,p=c["populate--"],h=p?"--":"_",m=Object.create(null),g=Object.create(null),y=n.__||o1.format,v={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},_=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,x=new RegExp("^--"+c["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(le){let He=typeof le=="object"?le.key:le,L=Object.keys(le).map(function(wt){return{boolean:"bools",string:"strings",number:"numbers"}[wt]}).filter(Boolean).pop();L&&(v[L][He]=!0),v.arrays[He]=!0,v.keys.push(He)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(le){v.bools[le]=!0,v.keys.push(le)}),[].concat(n.string||[]).filter(Boolean).forEach(function(le){v.strings[le]=!0,v.keys.push(le)}),[].concat(n.number||[]).filter(Boolean).forEach(function(le){v.numbers[le]=!0,v.keys.push(le)}),[].concat(n.count||[]).filter(Boolean).forEach(function(le){v.counts[le]=!0,v.keys.push(le)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(le){v.normalize[le]=!0,v.keys.push(le)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([le,He])=>{typeof He=="number"&&(v.nargs[le]=He,v.keys.push(le))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([le,He])=>{typeof He=="function"&&(v.coercions[le]=He,v.keys.push(le))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeo
`:Tt=`${ye} [${r("command")}]
`,Ve.div(`${Tt}`)}}if(h.length>1||h.length===1&&!h[0][2]){Ve.div(r("Commands:"));let Tt=e.getInternalMethods().getContext(),Ar=Tt.commands.length?`${Tt.commands.join(" ")} `:"";e.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(h=h.sort((yr,ve)=>yr[0].localeCompare(ve[0])));let se=ye?`${ye} `:"";h.forEach(yr=>{let ve=`${se}${Ar}${yr[0].replace(/^\$0 ?/,"")}`;Ve.span({text:ve,padding:[0,2,0,2],width:x(h,Ie,`${ye}${Ar}`)+4},{text:yr[1]});let Er=[];yr[2]&&Er.push(`[${r("default")}]`),yr[3]&&yr[3].length&&Er.push(`[${r("aliases:")} ${yr[3].join(", ")}]`),yr[4]&&(typeof yr[4]=="string"?Er.push(`[${r("deprecated: %s",yr[4])}]`):Er.push(`[${r("deprecated")}]`)),Er.length?Ve.div({text:Er.join(" "),padding:[0,0,0,2],align:"right"}):Ve.div()}),Ve.div()}let ie=(Object.keys(Ze.alias)||[]).concat(Object.keys(e.parsed.newAliases)||[]);At=At.filter(Tt=>!e.parsed.newAliases[Tt]&&ie.every(Ar=>(Ze.alias[Ar]||[]).indexOf(Tt)===-1));let ae=r("Options:");vt[ae]||(vt[ae]=[]),S(At,Ze.alias,vt,ae);let gr=l(Tt=>/^--/.test(V_(Tt)),"isLongSwitch"),hr=Object.keys(vt).filter(Tt=>vt[Tt].length>0).map(Tt=>{let Ar=vt[Tt].filter(I).map(se=>{if(ie.includes(se))return se;for(let yr=0,ve;(ve=ie[yr])!==void 0;yr++)if((Ze.alias[ve]||[]).includes(se))return ve;return se});return{groupName:Tt,normalizedKeys:Ar}}).filter(({normalizedKeys:Tt})=>Tt.length>0).map(({groupName:Tt,normalizedKeys:Ar})=>{let se=Ar.reduce((yr,ve)=>(yr[ve]=[ve].concat(Ze.alias[ve]||[]).map(Er=>Tt===n.getPositionalGroupName()?Er:(/^[0-9]$/.test(Er)?Ze.boolean.includes(ve)?"-":"--":Er.length>1?"--":"-")+Er).sort((Er,Tr)=>gr(Er)===gr(Tr)?0:gr(Er)?1:-1).join(", "),yr),{});return{groupName:Tt,normalizedKeys:Ar,switches:se}});if(hr.filter(({groupName:Tt})=>Tt!==n.getPositionalGroupName()).some(({normalizedKeys:Tt,switches:Ar})=>!Tt.every(se=>gr(Ar[se])))&&hr.filter(({groupName:Tt})=>Tt!==n.getPositionalGroupName()).forEach(({normalizedKeys:Tt,switches:Ar})=>{Tt.forEach(se=>{gr(Ar[se])&&(Ar[se]=iTe(Ar[se],4))})}),hr.forEach(({groupName:Tt,normalizedKeys:Ar,switches:se})=>{Ve.div(Tt),Ar.forEach(yr=>{let ve=se[yr],Er=m[yr]||"",Tr=null;Er.includes(_)&&(Er=r(Er.substring(_.length))),Ze.boolean.includes(yr)&&(Tr=`[${r("boolean")}]`),Ze.count.includes(yr)&&(Tr=`[${r("count")}]`),Ze.string.includes(yr)&&(Tr=`[${r("string")}]`),Ze.normalize.includes(yr)&&(Tr=`[${r("string")}]`),Ze.array.includes(yr)&&(Tr=`[${r("array")}]`),Ze.number.includes(yr)&&(Tr=`[${r("number")}]`);let wr=l(He=>typeof He=="string"?`[${r("deprecated: %s",He)}]`:`[${r("deprecated")}]`,"deprecatedExtra"),Ur=[yr in Te?wr(Te[yr]):null,Tr,yr in J?`[${r("required")}]`:null,Ze.choices&&Ze.choices[yr]?`[${r("choices:")} ${n.stringifiedValues(Ze.choices[yr])}]`:null,H(Ze.default[yr],Ze.defaultDescription[yr])].filter(Boolean).join(" ");Ve.span({text:V_(ve),padding:[0,2,0,2+vte(ve)],width:x(se,Ie)+4},Er);let le=e.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;Ur&&!le?Ve.div({text:Ur,padding:[0,0,0,2],align:"right"}):Ve.div()}),Ve.div()}),p.length&&(Ve.div(r("Examples:")),p.forEach(Tt=>{Tt[0]=Tt[0].replace(/\$0/g,ye)}),p.forEach(Tt=>{Tt[1]===""?Ve.div({text:Tt[0],padding:[0,2,0,2]}):Ve.div({text:Tt[0],padding:[0,2,0,2],width:x(p,Ie)+4},{text:Tt[1]})}),Ve.div()),g.length>0){let Tt=g.map(Ar=>Ar.replace(/\$0/g,ye)).join(`
`);Ve.div(`${Tt}
`)}return Ve.toString().replace(/\s*$/,"")},"help");function x(ne,ye,J){let Z=0;return Array.isArray(ne)||(ne=Object.values(ne).map(Te=>[Te])),ne.forEach(Te=>{Z=Math.max(t.stringWidth(J?`${J} ${V_(Te[0])}`:V_(Te[0]))+vte(Te[0]),Z)}),ye&&(Z=Math.min(Z,parseInt((ye*.5).toString(),10))),Z}l(x,"maxWidth");function b(){let ne=e.getDemandedOptions(),ye=e.getOptions();(Object.keys(ye.alias)||[]).forEach(J=>{ye.alias[J].forEach(Z=>{m[Z]&&n.describe(J,m[Z]),Z in ne&&e.demandOption(J,ne[Z]),ye.boolean.includes(Z)&&e.boolean(J),ye.count.includes(Z)&&e.count(J),ye.string.includes(Z)&&e.string(J),ye.normalize.includes(Z)&&e.normalize(J),ye.array.includes(Z)&&e.array(J),ye.number.includes(Z)&&e.number(J)})})}l(b,"normalizeAliases");let E;n.cacheHelpMessage=function(){E=this.help()},n.clearCachedHelpMessage=function(){E=void 0},n.hasCachedHelpMessage=function(){return!!E};function S(ne,ye,J,Z){let Te=[],vt=null;return Object.keys(J).forEach(Ze=>{Te=Te.concat(J[Ze])}),ne.forEach(Ze=>{vt=[Ze].concat(ye[Ze]),vt.some(At=>Te.indexOf(At)!==-1)||J[Z].push(Ze)}),Te}l(S,"addUngroupedKeys");function I(ne){return e.getOptions().hiddenOptions.indexOf(ne)<0||e.parsed.argv[e.getOptions().showHiddenOpt]}l(I,"filterHiddenOptions"),n.showHelp=ne=>{let ye=e.getInternalMethods().getLoggerInstance();ne||(ne="error"),(typeof ne=="function"?ne:ye[ne])(n.help())},n.functionDescription=ne=>["(",ne.name?t.Parser.decamelize(ne.name,"-"):r("generated-value"),")"].join(""),n.stringifiedValues=l(function(ye,J){let Z="",Te=J||", ",vt=[].concat(ye);return!ye||!vt.length||vt.forEach(Ze=>{Z.length&&(Z+=Te),Z+=JSON.stringify(Ze)}),Z},"stringifiedValues");function H(ne,ye){let J=`[${r("default:")} `;if(ne===void 0&&!ye)return null;if(ye)J+=ye;else switch(typeof ne){case"string":J+=`"${ne}"`;break;case"object":J+=JSON.stringify(ne);break;default:J+=ne}return`${J}]`}l(H,"defaultString");function K(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}l(K,"windowWidth");let be=null;n.version=ne=>{be=ne},n.showVersion=ne=>{let ye=e.getInternalMethods().getLoggerInstance();ne||(ne="error"),(typeof ne=="function"?ne:ye[ne])(be)},n.reset=l(function(ye){return o=null,u=!1,f=[],d=!1,g=[],p=[],h=[],m=_h(m,J=>!ye[J]),n},"reset");let Se=[];return n.freeze=l(function(){Se.push({failMessage:o,failureOutput:u,usages:f,usageDisabled:d,epilogs:g,examples:p,commands:h,descriptions:m})},"freeze"),n.unfreeze=l(function(ye=!1){let J=Se.pop();J&&(ye?(m={...J.descriptions,...m},h=[...J.commands,...h],f=[...J.usages,...f],p=[...J.examples,...p],g=[...J.epilogs,...g]):{failMessage:o,failureOutput:u,usages:f,usageDisabled:d,epilogs:g,examples:p,commands:h,descriptions:m}=J)},"unfreeze"),n}l(xte,"usage");function gk(e){return typeof e=="object"}l(gk,"isIndentedText");function iTe(e,t){return gk(e)?{text:e.text,indentation:e.indentation+t}:{text:e,indentation:t}}l(iTe,"addIndentation");function vte(e){return gk(e)?e.indentation:0}l(vte,"getIndentation");function V_(e){return gk(e)?e.text:e}l(V_,"getText");var _te=`###-begin-{{app_name}}-completions-###
#
# yargs command completion script
#
# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
#
_{{app_name}}_yargs_completions()
{
local cur_word args type_list
cur_word="\${COMP_WORDS[COMP_CWORD]}"
args=("\${COMP_WORDS[@]}")
# ask yargs to generate completions.
type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
# if no match was found, fall back to filename completion
if [ \${#COMPREPLY[@]} -eq 0 ]; then
COMPREPLY=()
fi
return 0
}
complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
###-end-{{app_name}}-completions-###
`,bte=`#compdef {{app_name}}
###-begin-{{app_name}}-completions-###
#
# yargs command completion script
#
# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
#
_{{app_name}}_yargs_completions()
{
local reply
local si=$IFS
IFS=$'
' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
IFS=$si
_describe 'values' reply
}
compdef _{{app_name}}_yargs_completions {{app_name}}
###-end-{{app_name}}-completions-###
`;var vk=class vk{constructor(t,r,n,s){var o,a,c;this.yargs=t,this.usage=r,this.command=n,this.shim=s,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(c=((o=this.shim.getEnv("SHELL"))===null||o===void 0?void 0:o.includes("zsh"))||((a=this.shim.getEnv("ZSH_NAME"))===null||a===void 0?void 0:a.includes("zsh")))!==null&&c!==void 0?c:!1}defaultCompletion(t,r,n,s){let o=this.command.getCommandHandlers();for(let c=0,u=t.length;c<u;++c)if(o[t[c]]&&o[t[c]].builder){let f=o[t[c]].builder;if($_(f)){this.indexAfterLastReset=c+1;let d=this.yargs.getInternalMethods().reset();return f(d,!0),d.argv}}let a=[];this.commandCompletions(a,t,n),this.optionCompletions(a,t,r,n),this.choicesFromOptionsCompletions(a,t,r,n),this.choicesFromPositionalsCompletions(a,t,r,n),s(null,a)}commandCompletions(t,r,n){let s=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&s[s.length-1]!==n&&!this.previousArgHasChoices(r)&&this.usage.getCommands().forEach(o=>{let a=xh(o[0]).cmd;if(r.indexOf(a)===-1)if(!this.zshShell)t.push(a);else{let c=o[1]||"";t.push(a.replace(/:/g,"\\:")+":"+c)}})}optionCompletions(t,r,n,s){if((s.match(/^-/)||s===""&&t.length===0)&&!this.previousArgHasChoices(r)){let o=this.yargs.getOptions(),a=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(o.key).forEach(c=>{let u=!!o.configuration["boolean-negation"]&&o.boolean.includes(c);!a.includes(c)&&!o.hiddenOptions.includes(c)&&!this.argsContainKey(r,c,u)&&this.completeOptionKey(c,t,s,u&&!!o.default[c])})}}choicesFromOptionsCompletions(t,r,n,s){if(this.previousArgHasChoices(r)){let o=this.getPreviousArgChoices(r);o&&o.length>0&&t.push(...o.map(a=>a.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(t,r,n,s){if(s===""&&t.length>0&&this.previousArgHasChoices(r))return;let o=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],a=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),c=o[n._.length-a-1];if(!c)return;let u=this.yargs.getOptions().choices[c]||[];for(let f of u)f.startsWith(s)&&t.push(f.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let r=t[t.length-1],n="";if(!r.startsWith("-")&&t.length>1&&(n=r,r=t[t.length-2]),!r.startsWith("-"))return;let s=r.replace(/^-+/,""),o=this.yargs.getOptions(),a=[s,...this.yargs.getAliases()[s]||[]],c;for(let u of a)if(Object.prototype.hasOwnProperty.call(o.key,u)&&Array.isArray(o.choices[u])){c=o.choices[u];break}if(c)return c.filter(u=>!n||u.startsWith(n))}previousArgHasChoices(t){let r=this.getPreviousArgChoices(t);return r!==void 0&&r.length>0}argsContainKey(t,r,n){let s=l(o=>t.indexOf((/^[^0-9]$/.test(o)?"-":"--")+o)!==-1,"argsContains");if(s(r)||n&&s(`no-${r}`))return!0;if(this.aliases){for(let o of this.aliases[r])if(s(o))return!0}return!1}completeOptionKey(t,r,n,s){var o,a,c,u;let f=t;if(this.zshShell){let m=this.usage.getDescriptions(),g=(a=(o=this===null||this===void 0?void 0:this.aliases)===null||o===void 0?void 0:o[t])===null||a===void 0?void 0:a.find(_=>{let x=m[_];return typeof x=="string"&&x.length>0}),y=g?m[g]:void 0,v=(u=(c=m[t])!==null&&c!==void 0?c:y)!==null&&u!==void 0?u:"";f=`${t.replace(/:/g,"\\:")}:${v.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let d=l(m=>/^--/.test(m),"startsByTwoDashes"),p=l(m=>/^[^0-9]$/.test(m),"isShortOption"),h=!d(n)&&p(t)?"-":"--";r.push(h+f),s&&r.push(h+"no-"+f)}customCompletion(t,r,n,s){if(Gc(this.customCompletionFunction,null,this.shim),oTe(this.customCompletionFunction)){let o=this.customCompletionFunction(n,r);return g0(o)?o.then(a=>{this.shim.process.nextTick(()=>{s(null,a)})}).catch(a=>{this.shim.process.nextTick(()=>{s(a,void 0)})}):s(null,o)}else return aTe(this.customCompletionFunction)?this.customCompletionFunction(n,r,(o=s)=>this.defaultCompletion(t,r,n,o),o=>{s(null,o)}):this.customCompletionFunction(n,r,o=>{s(null,o)})}getCompletion(t,r){let n=t.length?t[t.length-1]:"",s=this.yargs.parse(t,!0),o=this.customCompletionFunction?a=>this.customCompletion(t,a,n,r):a=>th
${g.join(`
`)}`:"";t.fail(s("Missing required argument: %s","Missing required arguments: %s",Object.keys(m).length,Object.keys(m).join(", ")+y))}},"requiredArguments"),o.unknownArguments=l(function(p,h,m,g,y=!0){var v;let _=e.getInternalMethods().getCommandInstance().getCommands(),x=[],b=e.getInternalMethods().getContext();if(Object.keys(p).forEach(E=>{!Ete.includes(E)&&!Object.prototype.hasOwnProperty.call(m,E)&&!Object.prototype.hasOwnProperty.call(e.getInternalMethods().getParseContext(),E)&&!o.isValidAndSomeAliasIsNotNew(E,h)&&x.push(E)}),y&&(b.commands.length>0||_.length>0||g)&&p._.slice(b.commands.length).forEach(E=>{_.includes(""+E)||x.push(""+E)}),y){let S=((v=e.getDemandedCommands()._)===null||v===void 0?void 0:v.max)||0,I=b.commands.length+S;I<p._.length&&p._.slice(I).forEach(H=>{H=String(H),!b.commands.includes(H)&&!x.includes(H)&&x.push(H)})}x.length&&t.fail(s("Unknown argument: %s","Unknown arguments: %s",x.length,x.map(E=>E.trim()?E:`"${E}"`).join(", ")))},"unknownArguments"),o.unknownCommands=l(function(p){let h=e.getInternalMethods().getCommandInstance().getCommands(),m=[],g=e.getInternalMethods().getContext();return(g.commands.length>0||h.length>0)&&p._.slice(g.commands.length).forEach(y=>{h.includes(""+y)||m.push(""+y)}),m.length>0?(t.fail(s("Unknown command: %s","Unknown commands: %s",m.length,m.join(", "))),!0):!1},"unknownCommands"),o.isValidAndSomeAliasIsNotNew=l(function(p,h){if(!Object.prototype.hasOwnProperty.call(h,p))return!1;let m=e.parsed.newAliases;return[p,...h[p]].some(g=>!Object.prototype.hasOwnProperty.call(m,g)||!m[p])},"isValidAndSomeAliasIsNotNew"),o.limitedChoices=l(function(p){let h=e.getOptions(),m={};if(!Object.keys(h.choices).length)return;Object.keys(p).forEach(v=>{Ete.indexOf(v)===-1&&Object.prototype.hasOwnProperty.call(h.choices,v)&&[].concat(p[v]).forEach(_=>{h.choices[v].indexOf(_)===-1&&_!==void 0&&(m[v]=(m[v]||[]).concat(_))})});let g=Object.keys(m);if(!g.length)return;let y=n("Invalid values:");g.forEach(v=>{y+=`
${n("Argument: %s, Given: %s, Choices: %s",v,t.stringifiedValues(m[v]),t.stringifiedValues(h.choices[v]))}`}),t.fail(y)},"limitedChoices");let a={};o.implies=l(function(p,h){Cs("<string|object> [array|number|string]",[p,h],arguments.length),typeof p=="object"?Object.keys(p).forEach(m=>{o.implies(m,p[m])}):(e.global(p),a[p]||(a[p]=[]),Array.isArray(h)?h.forEach(m=>o.implies(p,m)):(Gc(h,void 0,r),a[p].push(h)))},"implies"),o.getImplied=l(function(){return a},"getImplied");function c(d,p){let h=Number(p);return p=isNaN(h)?p:h,typeof p=="number"?p=d._.length>=p:p.match(/^--no-.+/)?(p=p.match(/^--no-(.+)/)[1],p=!Object.prototype.hasOwnProperty.call(d,p)):p=Object.prototype.hasOwnProperty.call(d,p),p}l(c,"keyExists"),o.implications=l(function(p){let h=[];if(Object.keys(a).forEach(m=>{let g=m;(a[m]||[]).forEach(y=>{let v=g,_=y;v=c(p,v),y=c(p,y),v&&!y&&h.push(` ${g} -> ${_}`)})}),h.length){let m=`${n("Implications failed:")}
`;h.forEach(g=>{m+=g}),t.fail(m)}},"implications");let u={};o.conflicts=l(function(p,h){Cs("<string|object> [array|string]",[p,h],arguments.length),typeof p=="object"?Object.keys(p).forEach(m=>{o.conflicts(m,p[m])}):(e.global(p),u[p]||(u[p]=[]),Array.isArray(h)?h.forEach(m=>o.conflicts(p,m)):u[p].push(h))},"conflicts"),o.getConflicting=()=>u,o.conflicting=l(function(p){Object.keys(p).forEach(h=>{u[h]&&u[h].forEach(m=>{m&&p[h]!==void 0&&p[m]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",h,m))})}),e.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(u).forEach(h=>{u[h].forEach(m=>{m&&p[r.Parser.camelCase(h)]!==void 0&&p[r.Parser.camelCase(m)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",h,m))})})},"conflictingFn"),o.recommendCommands=l(function(p,h){h=h.sort((v,_)=>_.length-v.length);let g=null,y=1/0;for(let v=0,_;(_=h[v])!==void 0;v++){let x=Tte(p,_);x<=3&&x<y&&(y=x,g=_)}g&&t.fail(n("Did you mean %s?",g))},"recommendCommands"),o.reset=l(function(p){return a=_h(a,h=>!p[h]),u=_h(u,h=>!p[h]),o},"reset");let f=[];return o.freeze=l(function(){f.push({implied:a,conflicting:u})},"freeze"),o.unfreeze=l(function(){let p=f.pop();Gc(p,void 0,r),{implied:a,conflicting:u}=p},"unfreeze"),o}l(Ste,"validation");var xk=[],u8;function f8(e,t,r,n){u8=n;let s={};if(Object.prototype.hasOwnProperty.call(e,"extends")){if(typeof e.extends!="string")return s;let o=/\.json|\..*rc$/.test(e.extends),a=null;if(o)a=cTe(t,e.extends);else try{a=require.resolve(e.extends)}catch{return e}lTe(a),xk.push(a),s=o?JSON.parse(u8.readFileSync(a,"utf8")):require(e.extends),delete e.extends,s=f8(s,u8.path.dirname(a),r,u8)}return xk=[],r?wte(s,e):Object.assign({},s,e)}l(f8,"applyExtends");function lTe(e){if(xk.indexOf(e)>-1)throw new m0(`Circular extended configurations: '${e}'.`)}l(lTe,"checkForCircularExtends");function cTe(e,t){return u8.path.resolve(e,t)}l(cTe,"getPathToDefaultConfig");function wte(e,t){let r={};function n(s){return s&&typeof s=="object"&&!Array.isArray(s)}l(n,"isObject"),Object.assign(r,e);for(let s of Object.keys(t))n(t[s])&&n(r[s])?r[s]=wte(e[s],t[s]):r[s]=t[s];return r}l(wte,"mergeDeep");var Ts=function(e,t,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(e,r):s?s.value=r:t.set(e,r),r},ue=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},nl,hg,d8,df,ju,G_,Ch,mg,z_,pf,W_,hf,ep,Hu,mf,K_,p2,Ll,Ps,Y_,X_,$u,gg,h2,yg,Th,Q_,Us,vg,xg,_g,Hs,J_,tp,V0;function zte(e){return(t=[],r=e.process.cwd(),n)=>{let s=new Pk(t,r,n,e);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}l(zte,"YargsFactory");var Ite=Symbol("copyDoubleDash"),Ate=Symbol("copyDoubleDash"),_k=Symbol("deleteFromParserHintObject"),Rte=Symbol("emitWarning"),Pte=Symbol("freeze"),Ote=Symbol("getDollarZero"),bg=Symbol("getParserConfiguration"),kte=Symbol("getUsageConfiguration"),bk=Symbol("guessLocale"),Nte=Symbol("guessVersion"),Dte=Symbol("parsePositionalNumbers"),Ck=Symbol("pkgUp"),Eh=Symbol("populateParserHintArray"),m2=Symbol("populateParserHintSingleValueDictionary"),Tk=Symbol("populateParserHintArrayDictionary"),Ek=Symbol("populateParserHintDictionary"),Sk=Symbol("sanitizeKey"),wk=Symbol("setKey"),Ik=Symbol("unfreeze"),Lte=Symbol("validateAsync"),Mte=Symbol("getCommandInstance"),Fte=Symbol("getContext"),Bte=Symbol("getHasOutput"),qte=Symbol("getLoggerInstance"),Ute=Symbol("getParseContext"),jte=Symbol("getUsageInstance"),Hte=Symbol("getValidationInstance"),Z_=Symbol("hasParseCallback"),$te=Symbol("isGlobalContext"),Cg=Symbol("postProcess"),Vte=Symbol("rebase"),Ak=Symbol("re
`),void 0,"versionWarning"),ue(this,Ps,"f").key[t]=!0,r.alias&&this.alias(t,r.alias);let n=r.deprecate||r.deprecated;n&&this.deprecateOption(t,n);let s=r.demand||r.required||r.require;s&&this.demand(t,s),r.demandOption&&this.demandOption(t,typeof r.demandOption=="string"?r.demandOption:void 0),r.conflicts&&this.conflicts(t,r.conflicts),"default"in r&&this.default(t,r.default),r.implies!==void 0&&this.implies(t,r.implies),r.nargs!==void 0&&this.nargs(t,r.nargs),r.config&&this.config(t,r.configParser),r.normalize&&this.normalize(t),r.choices&&this.choices(t,r.choices),r.coerce&&this.coerce(t,r.coerce),r.group&&this.group(t,r.group),(r.boolean||r.type==="boolean")&&(this.boolean(t),r.alias&&this.boolean(r.alias)),(r.array||r.type==="array")&&(this.array(t),r.alias&&this.array(r.alias)),(r.number||r.type==="number")&&(this.number(t),r.alias&&this.number(r.alias)),(r.string||r.type==="string")&&(this.string(t),r.alias&&this.string(r.alias)),(r.count||r.type==="count")&&this.count(t),typeof r.global=="boolean"&&this.global(t,r.global),r.defaultDescription&&(ue(this,Ps,"f").defaultDescription[t]=r.defaultDescription),r.skipValidation&&this.skipValidation(t);let o=r.describe||r.description||r.desc,a=ue(this,Hs,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(a,t)||typeof o=="string")&&this.describe(t,o),r.hidden&&this.hide(t),r.requiresArg&&this.requiresArg(t)}return this}options(t,r){return this.option(t,r)}parse(t,r,n){Cs("[string|array] [function|boolean|object] [function]",[t,r,n],arguments.length),this[Pte](),typeof t>"u"&&(t=ue(this,Th,"f")),typeof r=="object"&&(Ts(this,gg,r,"f"),r=n),typeof r=="function"&&(Ts(this,$u,r,"f"),r=!1),r||Ts(this,Th,t,"f"),ue(this,$u,"f")&&Ts(this,pf,!1,"f");let s=this[p8](t,!!r),o=this.parsed;return ue(this,df,"f").setParsed(this.parsed),g0(s)?s.then(a=>(ue(this,$u,"f")&&ue(this,$u,"f").call(this,ue(this,Ch,"f"),a,ue(this,Ll,"f")),a)).catch(a=>{throw ue(this,$u,"f")&&ue(this,$u,"f")(a,this.parsed.argv,ue(this,Ll,"f")),a}).finally(()=>{this[Ik](),this.parsed=o}):(ue(this,$u,"f")&&ue(this,$u,"f").call(this,ue(this,Ch,"f"),s,ue(this,Ll,"f")),this[Ik](),this.parsed=o,s)}parseAsync(t,r,n){let s=this.parse(t,r,n);return g0(s)?s:Promise.resolve(s)}parseSync(t,r,n){let s=this.parse(t,r,n);if(g0(s))throw new m0(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return s}parserConfiguration(t){return Cs("<object>",[t],arguments.length),Ts(this,X_,t,"f"),this}pkgConf(t,r){Cs("<string> [string]",[t,r],arguments.length);let n=null,s=this[Ck](r||ue(this,hg,"f"));return s[t]&&typeof s[t]=="object"&&(n=f8(s[t],r||ue(this,hg,"f"),this[bg]()["deep-merge-config"]||!1,ue(this,Us,"f")),ue(this,Ps,"f").configObjects=(ue(this,Ps,"f").configObjects||[]).concat(n)),this}positional(t,r){Cs("<string> <object>",[t,r],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];r=_h(r,(a,c)=>a==="type"&&!["string","number","boolean"].includes(c)?!1:n.includes(a));let s=ue(this,d8,"f").fullCommands[ue(this,d8,"f").fullCommands.length-1],o=s?ue(this,nl,"f").cmdToParseOptions(s):{array:[],alias:{},default:{},demand:{}};return f2(o).forEach(a=>{let c=o[a];Array.isArray(c)?c.indexOf(t)!==-1&&(r[a]=!0):c[t]&&!(a in r)&&(r[a]=c[t])}),this.group(t,ue(this,Hs,"f").getPositionalGroupName()),this.option(t,r)}recommendCommands(t=!0){return Cs("[boolean]",[t],arguments.length),Ts(this,Q_,t,"f"),this}required(t,r,n){return this.demand(t,r,n)}require(t,r,n){return this.demand(t,r,n)}requiresArg(t){return Cs("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&ue(this,Ps,"f").narg[t]?this:(this[m2](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,r){return Cs("[string] [string]",[t,r],arguments.length),t=t||this.$0,ue(this,p2,"f").log(ue(this,df,"f").generateCompletionScript(t,r||ue(this,ju,"f")||"completion")),this}showHelp(t){if(Cs("[string|function]",[t],arguments.length),Ts(this,Hu,!0,"f"),!ue(this,Hs,"f").hasCachedHelpMessage()){if(!this.parsed){le
`,"f"),Ts(this,Ll,ue(this,Ll,"f")+t.join(" "),"f")},error:(...t)=>{this[Z_]()||console.error(...t),Ts(this,Hu,!0,"f"),ue(this,Ll,"f").length&&Ts(this,Ll,ue(this,Ll,"f")+`
`,"f"),Ts(this,Ll,ue(this,Ll,"f")+t.join(" "),"f")}}}[_k](t){f2(ue(this,Ps,"f")).forEach(r=>{if((s=>s==="configObjects")(r))return;let n=ue(this,Ps,"f")[r];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete ue(this,Hs,"f").getDescriptions()[t]}[Rte](t,r,n){ue(this,z_,"f")[n]||(ue(this,Us,"f").process.emitWarning(t,r),ue(this,z_,"f")[n]=!0)}[Pte](){ue(this,W_,"f").push({options:ue(this,Ps,"f"),configObjects:ue(this,Ps,"f").configObjects.slice(0),exitProcess:ue(this,pf,"f"),groups:ue(this,ep,"f"),strict:ue(this,vg,"f"),strictCommands:ue(this,xg,"f"),strictOptions:ue(this,_g,"f"),completionCommand:ue(this,ju,"f"),output:ue(this,Ll,"f"),exitError:ue(this,Ch,"f"),hasOutput:ue(this,Hu,"f"),parsed:this.parsed,parseFn:ue(this,$u,"f"),parseContext:ue(this,gg,"f")}),ue(this,Hs,"f").freeze(),ue(this,V0,"f").freeze(),ue(this,nl,"f").freeze(),ue(this,hf,"f").freeze()}[Ote](){let t="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(ue(this,Us,"f").process.argv()[0])?r=ue(this,Us,"f").process.argv().slice(1,2):r=ue(this,Us,"f").process.argv().slice(0,1),t=r.map(n=>{let s=this[Vte](ue(this,hg,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length<n.length?s:n}).join(" ").trim(),ue(this,Us,"f").getEnv("_")&&ue(this,Us,"f").getProcessArgvBin()===ue(this,Us,"f").getEnv("_")&&(t=ue(this,Us,"f").getEnv("_").replace(`${ue(this,Us,"f").path.dirname(ue(this,Us,"f").process.execPath())}/`,"")),t}[bg](){return ue(this,X_,"f")}[kte](){return ue(this,J_,"f")}[bk](){if(!ue(this,mg,"f"))return;let t=ue(this,Us,"f").getEnv("LC_ALL")||ue(this,Us,"f").getEnv("LC_MESSAGES")||ue(this,Us,"f").getEnv("LANG")||ue(this,Us,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Nte](){return this[Ck]().version||"unknown"}[Dte](t){let r=t["--"]?t["--"]:t._;for(let n=0,s;(s=r[n])!==void 0;n++)ue(this,Us,"f").Parser.looksLikeNumber(s)&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))&&(r[n]=Number(s));return t}[Ck](t){let r=t||"*";if(ue(this,h2,"f")[r])return ue(this,h2,"f")[r];let n={};try{let s=t||ue(this,Us,"f").mainFilename;!t&&ue(this,Us,"f").path.extname(s)&&(s=ue(this,Us,"f").path.dirname(s));let o=ue(this,Us,"f").findUp(s,(a,c)=>{if(c.includes("package.json"))return"package.json"});Gc(o,void 0,ue(this,Us,"f")),n=JSON.parse(ue(this,Us,"f").readFileSync(o,"utf8"))}catch{}return ue(this,h2,"f")[r]=n||{},ue(this,h2,"f")[r]}[Eh](t,r){r=[].concat(r),r.forEach(n=>{n=this[Sk](n),ue(this,Ps,"f")[t].push(n)})}[m2](t,r,n,s){this[Ek](t,r,n,s,(o,a,c)=>{ue(this,Ps,"f")[o][a]=c})}[Tk](t,r,n,s){this[Ek](t,r,n,s,(o,a,c)=>{ue(this,Ps,"f")[o][a]=(ue(this,Ps,"f")[o][a]||[]).concat(c)})}[Ek](t,r,n,s,o){if(Array.isArray(n))n.forEach(a=>{t(a,s)});else if((a=>typeof a=="object")(n))for(let a of f2(n))t(a,n[a]);else o(r,this[Sk](n),s)}[Sk](t){return t==="__proto__"?"___proto___":t}[wk](t,r){return this[m2](this[wk].bind(this),"key",t,r),this}[Ik](){var t,r,n,s,o,a,c,u,f,d,p,h;let m=ue(this,W_,"f").pop();Gc(m,void 0,ue(this,Us,"f"));let g;t=this,r=this,n=this,s=this,o=this,a=this,c=this,u=this,f=this,d=this,p=this,h=this,{options:{set value(y){Ts(t,Ps,y,"f")}}.value,configObjects:g,exitProcess:{set value(y){Ts(r,pf,y,"f")}}.value,groups:{set value(y){Ts(n,ep,y,"f")}}.value,output:{set value(y){Ts(s,Ll,y,"f")}}.value,exitError:{set value(y){Ts(o,Ch,y,"f")}}.value,hasOutput:{set value(y){Ts(a,Hu,y,"f")}}.value,parsed:this.parsed,strict:{set value(y){Ts(c,vg,y,"f")}}.value,strictCommands:{set value(y){Ts(u,xg,y,"f")}}.value,strictOptions:{set value(y){Ts(f,_g,y,"f")}}.value,completionCommand:{set value(y){Ts(d,ju,y,"f")}}.value,parseFn:{set value(y){Ts(p,$u,y,"f")}}.value,parseContext:{set value(y){Ts(h,gg,y,"f")}}.value}=m,ue(this,Ps,"f").configObjects=g,ue(this,Hs,"f").unfreeze(),ue(this,V0,"f").unfreeze(),ue(this,nl,"f").unfreeze(),ue(this,hf,"f").unfreeze()}[Lte](t,r){return pg(r,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Mte].bind(this),getContext:this[Fte].bind(this),getHasOutput:this[Bte].bind(this),getLoggerInstance:this[qte].bind(this),getParseContext:this[Ute].bind(this),getParserConfig
`)){t.stacktrace=[];for(let f of r.slice(e.toString().length+1).split(/\n/).reverse()){let d=f.match(oAe),p={filename:"",function:""};d&&(p.function=(a=(o=(s=d[2])==null?void 0:s.trim())==null?void 0:o.replace(/^[^.]{1,2}(\.|$)/,"_$1"))!=null?a:p.function,p.filename=(u=(c=d[4])==null?void 0:c.trim())!=null?u:p.filename,d[5]&&d[5]!==":0"&&(p.lineno=d[5].slice(1)),d[6]&&d[5]!==":0"&&(p.colno=d[6].slice(1)),p.in_app=!/[[<:]|(?:^|\/)node_modules\//.test(p.filename)),t.stacktrace.push(p)}}return t}l(aAe,"buildExceptionDetail");function wD(e,t){var a,c;let r=e.get(oa),n=r.getEditorInfo(),s=e.get(Ic),o={"#editor":(a=n.devName)!=null?a:n.name,"#editor_version":np({name:(c=n.devName)!=null?c:n.name,version:n.version}),"#plugin":r.getEditorPluginInfo().name,"#plugin_version":np(r.getEditorPluginInfo()),"#session_id":e.get(L0).sessionId,"#machine_id":e.get(L0).machineId,"#architecture":$7.arch(),"#os_platform":$7.platform(),...t};return s.trackingId&&(o.user=s.trackingId,o["#tracking_id"]=s.trackingId),o}l(wD,"buildContext");function Xie(e,t){var f;let r=e.get(ec),n=e.get(oa).getEditorInfo(),s={app:"copilot-client",rollup_id:"auto",platform:"node",release:r.getBuildType()!=="dev"?`copilot-client@${r.getVersion()}`:void 0,deployed_to:r.getBuildType(),catalog_service:n.name==="vscode"?"CopilotCompletionsVSCode":"CopilotIDEAgent",context:wD(e,{"#node_version":process.versions.node}),sensitive_context:{}},o=[];s.exception_detail=[];let a=0,c=t;for(;c instanceof Error&&a<10;){let d=aAe(c);s.exception_detail.unshift(d),o.unshift([c,d]),a+=1,c=c.cause}let u=[];for(let[d,p]of o)if(p.stacktrace&&p.stacktrace.length>0){u.push(`${p.type}: ${(f=d.code)!=null?f:""}`);let h=[...p.stacktrace].reverse();for(let m of h)if(m.in_app){u.push(`${m.filename}:${m.lineno}:${m.colno}`);break}u.push(`${h[0].filename}`)}else return s;return s.exception_detail.length>0&&(s.rollup_id=(0,H7.SHA256)(H7.enc.Utf16.parse(u.join(`
`))).toString()),s}l(Xie,"buildPayload");var V7=class V7{constructor(t){this.flags=t}static fromEnvironment(t){return new V7({debug:lAe(process.argv,process.env),verboseLogging:cAe(process.env),telemetryLogging:uAe(process.env),testMode:t,recordInput:fAe(process.argv,process.env)})}};l(V7,"RuntimeMode");var ip=V7;function mu(e){return e.get(ip).flags.testMode}l(mu,"isRunningInTest");function U2(e){return mu(e)}l(U2,"shouldFailForDebugPurposes");function G7(e){return e.get(ip).flags.debug}l(G7,"isDebugEnabled");function Jie(e){return e.get(ip).flags.verboseLogging}l(Jie,"isVerboseLoggingEnabled");function lAe(e,t){return e.includes("--debug")||z7(t,"GITHUB_COPILOT_DEBUG")}l(lAe,"determineDebugFlag");function cAe(e){return z7(e,"COPILOT_AGENT_VERBOSE")}l(cAe,"determineVerboseLoggingEnabled");function uAe(e){return z7(e,"COPILOT_LOG_TELEMETRY")}l(uAe,"determineTelemetryLoggingEnabled");function fAe(e,t){return e.includes("--record")||z7(t,"GITHUB_COPILOT_RECORD")}l(fAe,"determineRecordInput");function z7(e,t){if(t in e){let r=e[t];return r==="1"||(r==null?void 0:r.toLowerCase())==="true"}return!1}l(z7,"determineEnvFlagEnabled");var Kge=Sr(Wge()),Tw=Sr(require("os")),oH=require("stream");var _We=/^https:\/\/[^.]*\.in\.applicationinsights\.azure\.com\//,aH=Bl(),bWe=aH.makeRequest.bind(aH),lH=class lH{constructor(t,r,n){this.namespace=r;this.client=TWe(t,n),Yge(t,this.client),t.get(ml).on("onCopilotToken",s=>{let o=s.getTokenValue("tid");o!==void 0&&EWe(o,this.client)})}sendTelemetryEvent(t,r,n){this.client.trackEvent({name:this.qualifyEventName(t),properties:r,measurements:n})}sendTelemetryErrorEvent(t,r,n){this.sendTelemetryEvent(this.qualifyEventName(t),r,n)}sendTelemetryException(t,r,n){this.client.trackException({exception:t,properties:r,measurements:n})}dispose(){return new Promise(t=>{this.client.flush({callback:r=>{t(void 0)}})})}qualifyEventName(t){return t.startsWith(this.namespace)?t:`${this.namespace}/${t}`}};l(lH,"AzureInsightReporter");var py=lH,cH=class cH{constructor(t){this.clients=[];t.get(ml).on("onCopilotToken",(r,n)=>{this.token=r,this.envelope=n,this.configureDeferredClients()})}get hasCredential(){return this.token&&this.envelope}async getToken(){return this.hasCredential?{token:this.token.token,expiresOnTimestamp:this.envelope.expires_at}:null}configureClientWhenLoggedIn(t){this.hasCredential?this.configureClient(t):this.deferConfiguration(t)}configureClient(t){t.config.aadTokenCredential=this}deferConfiguration(t){this.clients.push(t)}configureDeferredClients(){for(;this.clients.length>0;)this.configureClient(this.clients.pop())}};l(cH,"TelemetryTokenCredential");var hy=cH,uH=class uH extends py{constructor(t,r,n){super(t,r,n),t.get(hy).configureClientWhenLoggedIn(this.client)}};l(uH,"FineTuningReporter");var Cw=uH;function CWe(e){aH.makeRequest=function(t,r,n,s,...o){let a=r.includes("//169.254.169.254/");if(!e.get(Ks).proxySettings&&!a)return bWe(t,r,n,s,...o);r&&r.indexOf("//")===0&&(r="https:"+r);let c=new oH.EventEmitter;c.setEncoding=()=>c;let u=new oH.EventEmitter,f;return u.write=(d,p,h)=>{f=d},u.end=()=>{if(a)return u.emit("error",new Error("UNREACH")),u;if(_We.test(r))return u.emit("error",new Error("UNKNOWN")),u;let d=n.method,p=n.headers;return e.get(Ks).fetch(r,{method:d,headers:p,body:f}).then(h=>{h.text().then(m=>{c.emit("data",m),c.emit("end")})}).catch(h=>{u.emit("error",h)}),u},u.setTimeout=()=>u,u.abort=()=>{},s(c),u}}l(CWe,"monkeyPatchMakeRequest");function TWe(e,t){CWe(e);let r=new Kge.TelemetryClient(t);return r.config.enableAutoCollectRequests=!1,r.config.enableAutoCollectPerformance=!1,r.config.enableAutoCollectExceptions=!1,r.config.enableAutoCollectConsole=!1,r.config.enableAutoCollectDependencies=!1,r.config.noDiagnosticChannel=!0,Yge(e,r),r}l(TWe,"createAppInsightsClient");function Yge(e,t){t.commonProperties=SWe(t.commonProperties,e);let r=e.get(L0);t.context.tags[t.context.keys.sessionId]=r.sessionId;let n=e.get(Ic);n.trackingId&&(t.context.tags[t.context.keys.userId]=n.trackingId),t.context.tags[t.context.keys.cloudRoleInstance]="REDACTED",t.config.endpointUrl=e.get(um).
`)){a=o.slice(u.length+1).split(/\n/);break}if(a){s.stack=s.toString();for(let u of a)if(e5e.test(u))s.stack+=`
${Px(u.replace(e5e,(f,d)=>d.replace(Zge,"/")))}`;else if(/[ (]node:|[ (]wasm:\/\/wasm\/| \(<anonymous>\)$/.test(u))s.stack+=`
${Px(u)}`;else{let f=!1;for(let{prefix:d,path:p}of n){let h=new RegExp(Ew(p.replace(/[\\/]$/,""))+n5e,"gi");if(h.test(u)){s.stack+=`
${Px(u.replace(h,(m,g)=>d+g.replace(Zge,"/")))}`,f=!0;break}}if(f)continue;r?s.stack+=`
${mH(u)}`:s.stack+=`
at [redacted]:0:0`}}else r&&o&&(s.stack=mH(o));return e.cause instanceof Error&&(s.cause=yH(e.cause,t,r,n)),s}l(yH,"cloneError");function i5e(e){let t=e.message;return typeof e.path=="string"&&e.path.length>0&&(t=t.replaceAll(e.path,"<path>")),t}l(i5e,"errorMessageWithoutPath");function s5e(e,t){return yH(e,l(function(n){return mH(i5e(n))},"prepareMessage"),!0,t)}l(s5e,"prepareErrorForRestrictedTelemetry");function vH(e,t,r=!1){return yH(e,l(function(s){if(r)return gH(i5e(s));let o="[redacted]";return s.syscall&&s.code!==void 0?o=`${Px(s.syscall.toString())} ${s.code} ${o}`:s instanceof q8&&s.erroredSysCall&&s.code!==void 0?o=`${s.erroredSysCall} ${s.code} ${o}`:s.code!==void 0&&(o=`${s.code} ${o}`),o},"prepareMessage"),!1,t)}l(vH,"redactError");function yy(e){return e===1}l(yy,"isRestricted");var OWe=["engine.prompt","engine.completion","ghostText.capturedAfterAccepted","ghostText.capturedAfterRejected"];var bH=class bH{getReporter(t,r=0){return yy(r)?this.getRestrictedReporter(t):this.reporter}getRestrictedReporter(t){if(Sw(t))return this.reporterRestricted;if(U2(t))return new Rx}getFTReporter(t){if(l5e(t))return this.reporterFT;if(U2(t))return new Rx}setReporter(t){this.reporter=t}setRestrictedReporter(t){this.reporterRestricted=t}setFTReporter(t){this.reporterFT=t}async deactivate(){let t=Promise.resolve();this.reporter&&(t=this.reporter.dispose(),this.reporter=void 0);let r=Promise.resolve();this.reporterRestricted&&(r=this.reporterRestricted.dispose(),this.reporterRestricted=void 0);let n=Promise.resolve();this.reporterFT&&(n=this.reporterFT.dispose(),this.reporterFT=void 0),await Promise.all([t,r,n])}};l(bH,"TelemetryReporters");var X0=bH;a5e.TypeSystemPolicy.AllowNaN=!0;var kWe=U1.Type.Object({},{additionalProperties:U1.Type.String()}),NWe=U1.Type.Object({meanLogProb:U1.Type.Optional(U1.Type.Number()),meanAlternativeLogProb:U1.Type.Optional(U1.Type.Number())},{additionalProperties:U1.Type.Number()}),DWe=new Set(["ERR_WORKER_OUT_OF_MEMORY","ENOMEM"]);function LWe(e){var t;return DWe.has((t=e.code)!=null?t:"")||e.name==="RangeError"&&e.message==="WebAssembly.Memory(): could not allocate memory"}l(LWe,"isOomError");function MWe(e){return Yie(e)?"network":LWe(e)||e.code==="EMFILE"||e.code==="ENFILE"||e.syscall==="uv_cwd"&&(e.code==="ENOENT"||e.code=="EIO")||e.code==="CopilotPromptLoadFailure"||`${e.code}`.startsWith("CopilotPromptWorkerExit")?"local":"exception"}l(MWe,"getErrorType");var Pl=class Pl{constructor(t,r,n){this.properties=t,this.measurements=r,this.issuedTime=n}static createAndMarkAsIssued(t,r){return new Pl(t||{},r||{},qf())}extendedBy(t,r){let n={...this.properties,...t},s={...this.measurements,...r},o=new Pl(n,s,this.issuedTime);return o.displayedTime=this.displayedTime,o}markAsDisplayed(){this.displayedTime===void 0&&(this.displayedTime=qf())}async extendWithExpTelemetry(t){let{filters:r,exp:n}=await t.get(zs).getFallbackExpAndFilters();n.addToTelemetry(this),r.addToTelemetry(this)}extendWithEditorAgnosticFields(t){this.properties.editor_version=np(t.get(oa).getEditorInfo()),this.properties.editor_plugin_version=np(t.get(oa).getEditorPluginInfo());let r=t.get(L0);this.properties.client_machineid=r.machineId,this.properties.client_sessionid=r.sessionId,this.properties.copilot_version=`copilot/${xy(t)}`,this.properties.runtime_version=`node/${process.versions.node}`;let n=t.get(oa);this.properties.common_extname=n.getEditorPluginInfo().name,this.properties.common_extversion=n.getEditorPluginInfo().version,this.properties.common_vscodeversion=np(n.getEditorInfo());let s=t.get(Ks),o=s.proxySettings;this.properties.proxy_enabled=o?"true":"false",this.properties.proxy_auth=o!=null&&o.proxyAuth?"true":"false",this.properties.proxy_kerberos_spn=o!=null&&o.kerberosServicePrincipal?"true":"false",this.properties.reject_unauthorized=s.rejectUnauthorized?"true":"false"}extendWithConfigProperties(t){let r=d5e(t);r["copilot.build"]=p5e(t),r["copilot.buildType"]=vy(t);let n=t.get(Ic);n.trackingId&&(r["copilot.trackingId"]=n.trackingId),n.organizationsList&&(r.organizations_list=n.organizationsList),n.enterprise
`)){let c=o.stack.slice(`${o}
`.length).split(`
`);/^\s*(?:at )?(?:\w+\.)*telemetryException\b/.test(c[0])&&c.shift(),o.stack=`${o}
${c.join(`
`)}`}await e.get(Ul).register($We(e,o,r,n,s))}l(al,"telemetryException");async function $We(e,t,r,n,s){var h,m;let o=e.get(oa).getEditorInfo(),a;o.root&&(a=[{prefix:`${o.name}:`,path:o.root}]);let c=vH(t,a),u=Sw(e),f=MWe(t),d=f==="exception",p=Es.createAndMarkAsIssued({origin:r!=null?r:"",type:t.name,code:`${(h=t.code)!=null?h:""}`,reason:c.stack||c.toString(),message:c.message,...n});if(await p.makeReadyForSending(e,0,"IncludeExp"),s!=null&&s.exception_detail)for(let g of s.exception_detail)g.value&&(u?g.value=gH(g.value):g.value="[redacted]");if(s!=null||(s=Xie(e,vH(t,a,u))),s.context={...s.context,"copilot_event.unique_id":p.properties.unique_id,"#restricted_telemetry":u?"true":"false"},r&&(s.context["#origin"]=r,s.transaction=r),s.rollup_id!=="auto"&&(p.properties.errno=s.rollup_id),s.created_at=new Date(p.issuedTime).toISOString(),u){let g=s5e(t,a),y=Es.createAndMarkAsIssued({origin:r!=null?r:"",type:t.name,code:`${(m=t.code)!=null?m:""}`,reason:g.stack||g.toString(),message:g.message,...n});s.rollup_id!=="auto"&&(y.properties.errno=s.rollup_id),await y.makeReadyForSending(e,1,"IncludeExp"),y.properties.unique_id=p.properties.unique_id,p.properties.restricted_unique_id=y.properties.unique_id,d&&o5e(e,1,g,y),kx(e,1,`error.${f}`,y)}d&&(o5e(e,0,c,p),p.properties.failbot_payload=JSON.stringify(s)),kx(e,0,`error.${f}`,p)}l($We,"_telemetryException");async function Su(e,t,r,n){await e.get(Ul).register(VWe(e,t,r,n))}l(Su,"telemetryError");async function VWe(e,t,r,n=0){if(yy(n)&&!Sw(e))return;let s=r||Es.createAndMarkAsIssued({},{});await s.makeReadyForSending(e,n,"IncludeExp"),FWe(e,n,t,s)}l(VWe,"_telemetryError");async function u5e(e,t,r,n,s){var a;let o=Es.createAndMarkAsIssued({completionTextJson:JSON.stringify(t),choiceIndex:s.toString()});if(r.logprobs)for(let[c,u]of Object.entries(r.logprobs))o.properties["logprobs_"+c]=(a=JSON.stringify(u))!=null?a:"unset";o.extendWithRequestId(n),await mn(e,"engine.completion",o,1)}l(u5e,"logEngineCompletion");async function f5e(e,t,r){let n;t.isFimEnabled?n={promptPrefixJson:JSON.stringify(t.prefix),promptSuffixJson:JSON.stringify(t.suffix),promptElementRanges:JSON.stringify(t.promptElementRanges)}:n={promptJson:JSON.stringify(t.prefix),promptElementRanges:JSON.stringify(t.promptElementRanges)};let s=r.extendedBy(n);await mn(e,"engine.prompt",s,1)}l(f5e,"logEnginePrompt");var EH=class EH{};l(EH,"ExpConfigMaker");var q5=EH,zWe="https://default.exp-tas.com",SH=class SH extends q5{constructor(r="/vscode/ab"){super();this.expPath=r}async fetchExperiments(r,n){var f;let s=r.get(Ks),o;try{o=await s.fetch(zWe+this.expPath,{method:"GET",headers:n})}catch(d){return fd.createFallbackConfig(r,`Error fetching ExP config: ${d}`)}if(!o.ok)return fd.createFallbackConfig(r,`ExP responded with ${o.status}`);let a;try{a=await o.json()}catch(d){if(d instanceof SyntaxError)return al(r,d,"fetchExperiments"),fd.createFallbackConfig(r,"ExP responded with invalid JSON");throw d}let c=(f=a.Configs.find(d=>d.Id==="vscode"))!=null?f:{Id:"vscode",Parameters:{}},u=Object.entries(c.Parameters).map(([d,p])=>d+(p?"":"cf"));return new fd(c.Parameters,a.AssignmentContext,u.join(";"))}};l(SH,"ExpConfigFromTAS");var ww=SH;var IH=class IH{constructor(t){this.prefix=t}getCurrentAndUpComingValues(t){let r=this.getValue(t),n=this.getUpcomingValues(t);return[r,n]}};l(IH,"GranularityImplementation");var Iw=IH,AH=class AH extends Iw{getValue(t){return this.prefix}getUpcomingValues(t){return[]}};l(AH,"ConstantGranularity");var wH=AH,h5e=l(e=>new wH(e),"DEFAULT_GRANULARITY"),RH=class RH extends Iw{constructor(r,n=.5,s=new Date().setUTCHours(0,0,0,0)){super(r);this.prefix=r;this.fetchBeforeFactor=n;this.anchor=s}setTimePeriod(r){isNaN(r)?this.timePeriodLengthMs=void 0:this.timePeriodLengthMs=r}setByCallBuckets(r){isNaN(r)?this.numByCallBuckets=void 0:this.numByCallBuckets=r}getValue(r){return this.prefix+this.getTimePeriodBucketString(r)+(this.numByCallBuckets?this.timeHash(r):"")}getTimePeriodBucketString(r){return this.timePeriodLengthMs?this.dateToTimePartString(r):""}getUpcomingValues(r){let n=[],s=this.getUpcomingTimePe
`);return t[t.length-1].length}l(W5e,"getLastLineLength");function K5e(e,t,r,n){let s=e.get(Sp),o=s.previousLabel,a=0;"afterCursorWhitespace"in t.properties&&t.properties.afterCursorWhitespace==="true"&&(a=1);let c=(Date.now()-s.previousLabelTimestamp)/1e3,u=Math.log(1+c),f=0,d=0,p=r.prefix;if(p){f=Math.log(1+W5e(p));let E=p.slice(-1);fu[E]!==void 0&&(d=fu[E])}let h=0,m=0,g=p.trimEnd();if(g){h=Math.log(1+W5e(g));let E=g.slice(-1);fu[E]!==void 0&&(m=fu[E])}let y=0;if("documentLength"in t.measurements){let E=t.measurements.documentLength;y=Math.log(1+E)}let v=0;if("promptEndPos"in t.measurements){let E=t.measurements.promptEndPos;v=Math.log(1+E)}let _=0;if("promptEndPos"in t.measurements&&"documentLength"in t.measurements){let E=t.measurements.documentLength;_=(t.measurements.promptEndPos+.5)/(1+E)}let x=0;Mk[t.properties.languageId]!==void 0&&(x=Mk[t.properties.languageId]);let b=0;if(n){let E=new Array(221).fill(0);E[0]=o,E[1]=a,E[2]=u,E[3]=f,E[4]=h,E[5]=y,E[6]=v,E[7]=_,E[8+x]=1,E[29+d]=1,E[125+m]=1,b=z5e(E)[1]}else{let E=tne;E+=gf[0]*o,E+=gf[1]*a,E+=gf[2]*u,E+=gf[3]*f,E+=gf[4]*h,E+=gf[5]*y,E+=gf[6]*v,E+=gf[7]*_,E+=gf[8+x],E+=gf[29+d],E+=gf[125+m],b=1/(1+Math.exp(-E))}return e.get(Sp).probabilityAccept=b,b}l(K5e,"contextualFilterScore");var uG=Sr(La()),v4e=Sr(m8());var b$=class b${async debounce(t){return this.state&&(clearTimeout(this.state.timer),this.state.reject(),this.state=void 0),new Promise((r,n)=>{this.state={timer:setTimeout(()=>r(),t),reject:n}})}};l(b$,"Debouncer");var Kw=b$;async function*Yw(e,t){for await(let r of e)yield t(r)}l(Yw,"asyncIterableMap");async function*Y5e(e,t){for await(let r of e)await t(r)&&(yield r)}l(Y5e,"asyncIterableFilter");async function*$5(e,t){for await(let r of e){let n=await t(r);n!==void 0&&(yield n)}}l($5,"asyncIterableMapFilter");async function*X5e(e){for(let t of e)yield t}l(X5e,"asyncIterableFromArray");var C$=class C${};l(C$,"StatusReporter");var Ja=C$;var Q5e="https://repositorypolicy.azurewebsites.net/GetPolicy/v2";var Xw={isBlocked:!1,reason:"VALID_FILE"},dm={isBlocked:!1,reason:"NO_MATCHING_POLICY"},Bx={isBlocked:!0,reason:"POLICY_ERROR",message:"Copilot is disabled because we could not fetch the repository policy"};var T$=class T${};l(T$,"PolicyEvaluator");var Cy=T$;var rf=Sr(Wi());var Qw=new WeakMap;function Jw(e,t){if(e==null||typeof e!="object")return String(e);let r,n="",s=0,o=Object.prototype.toString.call(e);if(o!=="[object RegExp]"&&o!=="[object Date]"&&Qw.has(e))return Qw.get(e);switch(Qw.set(e,"~"+ ++t),o){case"[object Set]":r=Array.from(e);case"[object Array]":for(r||(r=e),n+="a";s<r.length;n+=Jw(r[s++],t));break;case"[object Object]":for(n+="o",r=Object.keys(e).sort();s<r.length;n+=r[s]+Jw(e[r[s++]],t));break;case"[object Map]":for(n+="o",r=Array.from(e.keys()).sort();s<r.length;n+=r[s]+Jw(e.get(r[s++]),t));break;case"[object Date]":return"d"+ +e;case"[object RegExp]":return"r"+e.source+e.flags;default:throw new Error(`Unsupported value ${e}`)}return Qw.set(e,n),n}l(Jw,"t");function Zw(e){return Jw(e,0)}l(Zw,"r");var E$=new WeakMap;function J5e(e,t,r=Zw(t)){let n,s,o=E$.get(e);o||(E$.set(e,o=[[],s=[],n=[]]),queueMicrotask(function(){let f,d=0;function p(h){for(;f=n[d++];f.r(h));}l(p,"o"),E$.delete(e),e(s).then(function(h){if(h.length!==n.length)return p(new Error("loader value length mismatch"));for(;f=h[d++],d<=h.length;f instanceof Error?n[d-1].r(f):n[d-1].s(f));},p)}));let a=o[0].indexOf(r);if(~a)return o[2][a].p;let c=o[0].push(r)-1,u=o[2][c]={};return o[1][c]=t,u.p=new Promise(function(f,d){u.s=f,u.r=d})}l(J5e,"n");var Z5e=new WeakMap;function bKe(e,t,r,n=Zw(r)){if(t||(t=Z5e.get(e)),t||Z5e.set(e,t=new Map),t.has(n))return Promise.resolve(t.get(n));let s=J5e(e,r,n);return t.set(n,s),s.catch(()=>t.delete(n)),s}l(bKe,"n");function eI(e,t){return function(r,n){return bKe(e,t,r,n)}}l(eI,"o");var C3e=Sr(d3e(),1);var Ux=l(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var RKe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]"
globstar while`,t,h,r,m,g),this.matchOne(t.slice(h),r.slice(m),n))return this.debug("globstar found match!",h,u,g),!0;if(g==="."||g===".."||!s.dot&&g.charAt(0)==="."){this.debug("dot detected!",t,h,r,m);break}this.debug("globstar swallow a segment, and continue"),h++}return!!(n&&(this.debug(`
>>> no match, partial?`,t,h,r,m),h===u))}let y;if(typeof d=="string"?(y=p===d,this.debug("string match",d,p,y)):(y=d.test(p),this.debug("pattern match",d,p,y)),!y)return!1}if(a===u&&c===f)return!0;if(a===u)return n;if(c===f)return a===u-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return w3e(this.pattern,this.options)}parse(t){Ux(t);let r=this.options;if(t==="**")return $f;if(t==="")return"";let n,s=null;(n=t.match(WKe))?s=r.dot?YKe:KKe:(n=t.match(FKe))?s=(r.nocase?r.dot?jKe:UKe:r.dot?qKe:BKe)(n[1]):(n=t.match(XKe))?s=(r.nocase?r.dot?JKe:QKe:r.dot?ZKe:eYe)(n):(n=t.match(HKe))?s=r.dot?VKe:$Ke:(n=t.match(GKe))&&(s=zKe);let o=Ey.fromGlob(t,this.options).toMMPattern();return s?Object.assign(o,{test:s}):o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?nYe:r.dot?iYe:sYe,s=new Set(r.nocase?["i"]:[]),o=t.map(u=>{let f=u.map(d=>{if(d instanceof RegExp)for(let p of d.flags.split(""))s.add(p);return typeof d=="string"?uYe(d):d===$f?$f:d._src});return f.forEach((d,p)=>{let h=f[p+1],m=f[p-1];d!==$f||m===$f||(m===void 0?h!==void 0&&h!==$f?f[p+1]="(?:\\/|"+n+"\\/)?"+h:f[p]=n:h===void 0?f[p-1]=m+"(?:\\/|"+n+")?":h!==$f&&(f[p-1]=m+"(?:\\/|\\/"+n+"\\/)"+h,f[p+1]=$f))}),f.filter(d=>d!==$f).join("/")}).join("|"),[a,c]=t.length>1?["(?:",")"]:["",""];o="^"+a+o+c+"$",this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...s].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let o=this.set;this.debug(this.pattern,"set",o);let a=s[s.length-1];if(!a)for(let c=s.length-2;!a&&c>=0;c--)a=s[c];for(let c=0;c<o.length;c++){let u=o[c],f=s;if(n.matchBase&&u.length===1&&(f=[a]),this.matchOne(f,u,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return lc.defaults(t).Minimatch}};l(P$,"Minimatch");var Sy=P$;lc.AST=Ey;lc.Minimatch=Sy;lc.escape=R$;lc.unescape=pm;var iV=Sr(e2e());var Y1=l((e,t)=>{if(iV.Value.Check(e,t))return t;let n=`Typebox schema validation failed:
${[...iV.Value.Errors(e,t)].map(s=>`${s.path} ${s.message}`).join(`
`)}`;throw new Error(n)},"assertShape");var g2e=Sr(require("path")),y2e=Sr(vl());var cV=Sr(La()),m2e=Sr(h2e()),Kx=require("path"),Yx=Sr(vl());async function uV(e){var s,o;let r=(s=(await e.get(Sa).getCopilotToken(e,!1)).organization_list)!=null?s:[];return(o=["a5db0bcaae94032fe715fb34a5e4bce2","7184f66dfcee98cb5f08a1cb936d5225","4535c7beffc844b46bb1ed4aa04d759a"].find(a=>r.includes(a)))!=null?o:""}l(uV,"getUserKind");async function fV(e){var r;return(r=(await e.get(Sa).getCopilotToken(e,!1)).getTokenValue("ft"))!=null?r:""}l(fV,"getFtFlag");async function dV(e){var r;return(r=(await e.get(Sa).getCopilotToken(e,!1)).getTokenValue("rag"))!=null?r:""}l(dV,"getRagFlag");function pV(e){var n;if(e===void 0||e===0)return"";let t=_m(e);if(t==="github/github")return t;let r=(n=IQe(e))==null?void 0:n.toLowerCase();return r!==void 0?r:""}l(pV,"getDogFood");function _m(e){if(e!==void 0&&e!==0&&e.hostname==="github.com")return e.owner+"/"+e.repo}l(_m,"tryGetGitHubNWO");function IQe(e){if(e!==void 0&&e!==0&&(e.hostname.endsWith("azure.com")||e.hostname.endsWith("visualstudio.com")))return e.owner+"/"+e.repo}l(IQe,"tryGetADONWO");async function PI(e,t){var f;let r=W5(e,t.uri),n=(f=_m(r))!=null?f:"",s=pV(r),o=await uV(e),a=await fV(e),c=await dV(e);return{repoNwo:n,userKind:o,dogFood:s,fileType:t.languageId,customModel:a,retrievalOrg:c}}l(PI,"getExPFilters");function W5(e,t){let r=Yx.Utils.dirname(t);return AQe(e,r)}l(W5,"extractRepoInfoInBackground");var AQe=kQe(hV,1e4);async function hV(e,t){var u;if(t.scheme!=="file")return;let r=await PQe(e,t.fsPath);if(!r)return;let n=e.get(cV.FileSystem),s=(0,Kx.join)(r,".git","config"),o;try{o=await n.readFileString(Yx.URI.file(s))}catch{return}let a=(u=OQe(o))!=null?u:"",c=RQe(a);return c===void 0?{baseFolder:r,url:a,hostname:"",owner:"",repo:"",pathname:""}:{baseFolder:r,url:a,...c}}l(hV,"extractRepoInfo");function RQe(e){let t={};try{if(t=(0,m2e.default)(e),t.host==""||t.owner==""||t.name==""||t.pathname=="")return}catch{return}return{hostname:t.host,owner:t.owner,repo:t.name,pathname:t.pathname}}l(RQe,"parseRepoUrl");async function PQe(e,t){let r=t+"_add_to_make_longer",n=e.get(cV.FileSystem);for(;t.length>1&&t.length<r.length;){let s=(0,Kx.join)(t,".git","config"),o=!1;try{await n.stat(Yx.URI.file(s)),o=!0}catch{o=!1}if(o)return t;r=t,t=(0,Kx.dirname)(t)}}l(PQe,"getRepoBaseFolder");function OQe(e){var u;let t=/^\s*\[\s*remote\s+"((\\\\|\\"|[^\\"])+)"/,r=/^\s*\[remote.([^"\s]+)/,n=/^\s*url\s*=\s*([^\s#;]+)/,s=/^\s*\[/,o,a,c=!1;for(let f of e.split(`
`))if(c&&o!==void 0){if(o+=f,f.endsWith("\\"))o=o.substring(0,o.length-1);else if(c=!1,a==="origin")return o}else{let d=(u=f.match(t))!=null?u:f.match(r);if(d)a=d[1];else if(f.match(s))a=void 0;else{if(o&&a!=="origin")continue;{let p=f.match(n);if(p){if(o=p[1],o.endsWith("\\"))o=o.substring(0,o.length-1),c=!0;else if(a==="origin")return o}}}}return o}l(OQe,"getRepoUrlFromConfigText");var mV=class mV{constructor(t){this.result=t}};l(mV,"CompletedComputation");var lV=mV;function kQe(e,t){let r=new za(t),n=new Set;return(s,...o)=>{let a=JSON.stringify(o),c=r.get(a);if(c)return c.result;if(n.has(a))return 0;let u=e(s,...o);return n.add(a),u.then(f=>{r.set(a,new lV(f)),n.delete(a)}),0}}l(kQe,"computeInBackgroundAndMemoize");async function OI(e,t,r){let n=y2e.Utils.dirname(r);if(t.has(r.fsPath))return t.get(r.fsPath);if(t.has(n.fsPath))return t.get(n.fsPath);let s=await hV(e,r);if(!(s!=null&&s.url)){t.set(r.fsPath,void 0);let o=g2e.default.dirname(r.fsPath);t.set(o,void 0);return}return t.set(n.fsPath,s),t.set(r.fsPath,s),s}l(OI,"cachedGitRepoInfo");var gV="contentExclusion",zf,K5,NI,Ry,DI,v2e,Xx,LI,x2e,Qx,yV,vV=class vV extends Cy{constructor(r){super();ja(this,DI);ja(this,LI);ja(this,Qx);ja(this,zf,void 0);ja(this,K5,new za(1e4));ja(this,NI,new za(1e4));ja(this,Ry,new za(200));ja(this,Xx,eI(async r=>{let n=await zr(this,zf).get(Sa).getGitHubSession(zr(this,zf));if(!n)throw new hu("No token found");let s=zr(this,zf).get(Q0).getContentRestrictionsUrl(n),o=new URL(s);o.searchParams.set("repos",r.join(","));let a=await zr(this,zf).get(Ks).fetch(o.href,{method:"GET",headers:{Authorization:`token ${n.token}`}}),c=await a.json();if(!a.ok){if(a.status===404)return Array.from(r,()=>[]);throw Tc(this,Qx,yV).call(this,"fetch.error",{message:c.message}),new Dg(a)}return Tc(this,Qx,yV).call(this,"fetch.success"),Y1(qQe,c).map(u=>u.rules)},zr(this,Ry)));Ya(this,zf,r)}async evaluate(r){let n=r.fsPath;if(zr(this,K5).has(n))return zr(this,K5).get(n);try{let o=await Tc(this,LI,x2e).call(this,r);if(!o)return dm;let a=r.fsPath.replace(o.baseFolder,"");var s=await this.evaluateFileFromRepo(a,o.url)}catch(o){return al(zr(this,zf),o,`${gV}.evaluate`),Bx}return zr(this,K5).set(n,s),s}async evaluateFileFromRepo(r,n){let s=await Tc(this,DI,v2e).call(this,n);if(!s)return dm;for(let o of s)for(let a of o.paths)if(lc(r,a,{nocase:!0,matchBase:!0,nonegate:!0}))return DQe(o);return Xw}async refresh(){try{let r=[...zr(this,Ry).keys()];this.reset(),await Promise.all(r.map(n=>zr(this,Xx).call(this,n)))}catch(r){al(zr(this,zf),r,`${gV}.refresh`)}}reset(){zr(this,Ry).clear(),zr(this,K5).clear()}};zf=new WeakMap,K5=new WeakMap,NI=new WeakMap,Ry=new WeakMap,DI=new WeakSet,v2e=l(async function(r){let n=await zr(this,Xx).call(this,r.toLowerCase());if(n.length!==0)return n},"#rulesForRepo"),Xx=new WeakMap,LI=new WeakSet,x2e=l(function(r){return OI(zr(this,zf),zr(this,NI),r)},"#getGitRepo"),Qx=new WeakSet,yV=l(function(r,n,s){mn(zr(this,zf),`${gV}.${r}`,Es.createAndMarkAsIssued(n,s))},"#telemetry"),l(vV,"CopilotContentRestrictions");var kI=vV;function DQe(e){return{isBlocked:!0,reason:"FILE_BLOCKED",message:`Your ${e.source.type.toLowerCase()} '${e.source.name}' has disabled Copilot for this file`}}l(DQe,"fileBlockedEvaluationResult");var LQe=rf.Type.Object({name:rf.Type.String(),type:rf.Type.Union([rf.Type.Literal("Organization"),rf.Type.Literal("Repository")])}),MQe=rf.Type.Object({paths:rf.Type.Array(rf.Type.String()),source:LQe}),FQe=rf.Type.Array(MQe),BQe=rf.Type.Object({rules:FQe,last_updated_at:rf.Type.String()}),qQe=rf.Type.Array(BQe);var _l=Sr(Wi());var _V=class _V extends Cy{constructor(r){super();this.ctx=r;this.repoUriToPolicyMap=new Map;this.ruleLoaderCache=new za(200);this.urlToRepoInfoCache=new za(1e4);this.requestStatus={status:"initial"};this.initialWaitMs=30*1e3;this.maxRetryCount=3;this.ruleLoader=eI(async r=>{let n=new URL(Q5e),s=await this.ctx.get(Sa).getGitHubToken(this.ctx);if(!s)throw new hu("No GitHub token found");let o=this.ctx.get(L0),a=this.ctx.get(oa),c=this.ctx.get(Ic),u=this.ctx.get(Ks),f={trackingid:`${c.trackingId}`,githubtoken:`${s
`);for(let o=0;o<s.length;++o){let a=s[o].trimLeft();a===""?s[o]=a:s[o]=t+a}n.completionText=s.join(`
`),yield n}}l(R2e,"cleanupIndentChoices");function ZQe(e,t){var r;if((r=t==null?void 0:t.logprobs)!=null&&r.token_logprobs)try{let n=0,s=0,o=50;for(let a=0;a<t.logprobs.token_logprobs.length-1&&o>0;a++,o--)n+=t.logprobs.token_logprobs[a],s+=1;return s>0?n/s:void 0}catch(n){n0.exception(e,n,"Error calculating mean prob")}}l(ZQe,"calculateMeanLogProb");function eJe(e,t){var r;if((r=t==null?void 0:t.logprobs)!=null&&r.top_logprobs)try{let n=0,s=0,o=50;for(let a=0;a<t.logprobs.token_logprobs.length-1&&o>0;a++,o--){let c={...t.logprobs.top_logprobs[a]};delete c[t.logprobs.tokens[a]],n+=Math.max(...Object.values(c)),s+=1}return s>0?n/s:void 0}catch(n){n0.exception(e,n,"Error calculating mean prob")}}l(eJe,"calculateMeanAlternativeLogProb");function Ny(e,t){if(mu(e))return 0;let r=parseFloat(r0(e,Zs.Temperature));return r>=0&&r<=1?r:t<=1?0:t<10?.2:t<20?.4:.8}l(Ny,"getTemperatureForSamples");var Pu=new Fs(1,"streamChoices"),$V=class $V{constructor(){this.logprobs=[];this.top_logprobs=[];this.text=[];this.tokens=[];this.text_offset=[];this.annotations=new qV}append(t){var r,n,s,o,a,c;t.text&&this.text.push(t.text),(r=t.delta)!=null&&r.content&&this.text.push(t.delta.content),t.logprobs&&(this.tokens.push((n=t.logprobs.tokens)!=null?n:[]),this.text_offset.push((s=t.logprobs.text_offset)!=null?s:[]),this.logprobs.push((o=t.logprobs.token_logprobs)!=null?o:[]),this.top_logprobs.push((a=t.logprobs.top_logprobs)!=null?a:[])),t.annotations&&this.annotations.update(t.annotations),(c=t.delta)!=null&&c.annotations&&this.annotations.update(t.delta.annotations)}};l($V,"APIJsonDataStreaming");var BV=$V;function tJe(e){let t=e.split(`
`),r=t.pop();return[t.filter(n=>n!=""),r]}l(tJe,"splitChunk");var VV=class VV{constructor(){this.current={}}update(t){Object.entries(t).forEach(([r,n])=>{n.forEach(s=>this.update_namespace(r,s))})}update_namespace(t,r){this.current[t]||(this.current[t]=[]);let n=this.current[t],s=n.findIndex(o=>o.id===r.id);s>=0?n[s]=r:n.push(r)}for(t){var r;return(r=this.current[t])!=null?r:[]}};l(VV,"StreamAnnotations");var qV=VV,HI=class HI{constructor(t,r,n,s,o,a,c,u){this.ctx=t;this.expectedNumChoices=r;this.response=n;this.body=s;this.telemetryData=o;this.dropCompletionReasons=a;this.fastCancellation=c;this.cancellationToken=u;this.requestId=X5(this.response);this.stats=new UV(this.expectedNumChoices);this.solutions={}}static async create(t,r,n,s,o,a){let c=await n.body();c.setEncoding("utf8");let u=t.get(zs).fastCancellation(s);return new HI(t,r,n,c,s,o!=null?o:["content_filter"],u,a)}async*processSSE(t=async()=>{}){try{yield*this.processSSEInner(t)}finally{this.fastCancellation&&this.cancel(),Pu.info(this.ctx,`request done: headerRequestId: [${this.requestId.headerRequestId}] model deployment ID: [${this.requestId.deploymentId}]`),Pu.debug(this.ctx,`request stats: ${this.stats}`)}}async*processSSEInner(t){var n,s,o,a;let r="";e:for await(let c of this.body){if(this.maybeCancel("after awaiting body chunk"))return;Pu.debug(this.ctx,"chunk",c.toString());let[u,f]=tJe(r+c.toString());r=f;for(let d of u){let p=d.slice(5).trim();if(p=="[DONE]"){yield*this.finishSolutions();return}let h;try{h=JSON.parse(p)}catch{Pu.error(this.ctx,"Error parsing JSON stream data",d);continue}if(h.choices===void 0){h.error!==void 0?Pu.error(this.ctx,"Error in response:",h.error.message):Pu.error(this.ctx,"Unexpected response with no choices or error: "+p);continue}if(this.requestId.created==0&&(this.requestId=X5(this.response,h),this.requestId.created==0&&Pu.error(this.ctx,`Request id invalid, should have "completionId" and "created": ${this.requestId}`,this.requestId)),this.allSolutionsDone()&&this.fastCancellation)break e;for(let m=0;m<h.choices.length;m++){let g=h.choices[m];Pu.debug(this.ctx,"choice",g),this.stats.add(g.index),g.index in this.solutions||(this.solutions[g.index]=new BV);let y=this.solutions[g.index];if(y==null)continue;y.append(g);let v,_=((n=g.text)==null?void 0:n.indexOf(`
`))>-1||((o=(s=g.delta)==null?void 0:s.content)==null?void 0:o.indexOf(`
`))>-1;if((g.finish_reason||_)&&(v=await t(y.text.join("")),this.maybeCancel("after awaiting finishedCb")))return;if(!(g.finish_reason||v!==void 0))continue;let b=(a=g.finish_reason)!=null?a:"client-trimmed";if(mn(this.ctx,"completion.finishReason",this.telemetryData.extendedBy({completionChoiceFinishReason:b})),this.dropCompletionReasons.includes(g.finish_reason)?this.solutions[g.index]=null:(this.stats.markYielded(g.index),yield{solution:y,finishOffset:v,reason:g.finish_reason,requestId:this.requestId,index:g.index}),this.maybeCancel("after yielding finished choice"))return;this.solutions[g.index]=null}}}for(let[c,u]of Object.entries(this.solutions)){let f=Number(c);if(u!=null&&(this.stats.markYielded(f),yield{solution:u,finishOffset:void 0,reason:"Iteration Done",requestId:this.requestId,index:f},this.maybeCancel("after yielding after iteration done")))return}if(r.length>0)try{let c=JSON.parse(r);c.error!==void 0&&Pu.error(this.ctx,`Error in response: ${c.error.message}`,c.error)}catch{Pu.error(this.ctx,`Error parsing extraData: ${r}`)}}async*finishSolutions(){for(let[t,r]of Object.entries(this.solutions)){let n=Number(t);if(r!=null&&(this.stats.markYielded(n),yield{solution:r,finishOffset:void 0,reason:"DONE",requestId:this.requestId,index:n},this.maybeCancel("after yielding on DONE")))return}}maybeCancel(t){var r;return(r=this.cancellationToken)!=null&&r.isCancellationRequested?(Pu.debug(this.ctx,"Cancelled: "+t),this.cancel(),!0):!1}cancel(){this.body.destroy()}allSolutionsDone(){let t=Object.values(this.solutions);return t.length==this.expectedNumChoices&&t.every(r=>r==null)}};l(HI,"SSEProcessor");var Dy=HI;function P2e(e,t,r){let n=t.solution.text.join(""),s=!1;t.finishOffset!==void 0&&(Pu.debug(e,`solution ${t.index}: early finish at offset ${t.finishOffset}`),n=n.substring(0,t.finishOffset),s=!0),Pu.info(e,`solution ${t.index} returned. finish reason: [${t.reason}]`),Pu.debug(e,`solution ${t.index} details: finishOffset: [${t.finishOffset}] completionId: [{${t.requestId.completionId}}] created: [{${t.requestId.created}}]`);let o=HV(e,t.solution);return A2e(e,n,o,t.index,t.requestId,s,r)}l(P2e,"prepareSolutionForReturn");function HV(e,t){let n={text:t.text.join(""),tokens:t.text};if(t.logprobs.length===0)return n;let s=t.logprobs.reduce((u,f)=>u.concat(f),[]),o=t.top_logprobs.reduce((u,f)=>u.concat(f),[]),a=t.text_offset.reduce((u,f)=>u.concat(f),[]),c=t.tokens.reduce((u,f)=>u.concat(f),[]);return{...n,logprobs:{token_logprobs:s,top_logprobs:o,text_offset:a,tokens:c}}}l(HV,"convertToAPIJsonData");var GV=class GV{constructor(t){this.choices=new Map;for(let r=0;r<t;r++)this.choices.set(r,new jV)}add(t){this.choices.get(t).increment()}markYielded(t){this.choices.get(t).markYielded()}toString(){return Array.from(this.choices.entries()).map(([t,r])=>`${t}: ${r.yieldedTokens} -> ${r.seenTokens}`).join(", ")}};l(GV,"ChunkStats");var UV=GV,zV=class zV{constructor(){this.yieldedTokens=-1;this.seenTokens=0}increment(){this.seenTokens++}markYielded(){this.yieldedTokens=this.seenTokens}};l(zV,"ChoiceStats");var jV=zV;var $I=new Fs(1,"fetch");function X5(e,t){return{headerRequestId:e.headers.get("x-request-id")||"",completionId:t&&t.id?t.id:"",created:t&&t.created?t.created:0,serverExperiments:e.headers.get("X-Copilot-Experiment")||"",deploymentId:e.headers.get("azureml-model-deployment")||""}}l(X5,"getRequestId");function WV(e){let t=e.headers.get("openai-processing-ms");return t?parseInt(t,10):0}l(WV,"getProcessingTime");function Q5(e,t){let r=t.split("/").pop();return r||($I.error(e,"Malformed engine URL: "+t),t)}l(Q5,"extractEngineName");function rJe(e){switch(e){case"ghostText":return"copilot-ghost";case"synthesize":return"copilot-panel"}}l(rJe,"uiKindToIntent");var KV=class KV{};l(KV,"OpenAIFetcher");var Rp=KV;function nJe(e,t,r,n,s,o,a,c,u,f){var y;let d=e.get(Ja),p=O2e.format("%s/%s",r,n);if(!a){n0.error(e,`Failed to send request to ${p} due to missing key`);return}let h=Es.createAndMarkAsIssued({endpoint:n,engineName:Q5(e,r),uiKind:c},B5(t));f&&(h=h.extendedBy(f));for(let[v,_]of Object.entries(o))v=="prompt"||v=="s
`),s=e.slice(t).split(`
`);function o(d,p,h){let m=p,g,y;for(;g===void 0&&m>=0&&m<d.length;)g=GI(d[m]),y=m,m+=h;if(r==="python"&&h===-1){m++;let v=d[m].trim();if(v.endsWith('"""')){if(!(v.startsWith('"""')&&v!=='"""'))for(m--;m>=0&&!d[m].trim().startsWith('"""');)m--;if(m>=0)for(g=void 0,m--;g===void 0&&m>=0;)g=GI(d[m]),y=m,m--}}return[g,y]}l(o,"seekNonBlank");let[a,c]=o(n,n.length-1,-1),u=(()=>{if(!(a===void 0||c===void 0))for(let d=c-1;d>=0;d--){let p=GI(n[d]);if(p!==void 0&&p<a)return p}})(),[f]=o(s,1,1);return{prev:u,current:a!=null?a:0,next:f}}l(JV,"contextIndentationFromText");var fJe=!1;function dJe(e,t,r){var u;let n=e.split(`
`),s=r!==void 0,o=r==null?void 0:r.split(`
`).pop(),a=0;if(s&&(o==null?void 0:o.trim())!=""&&n[0].trim()!==""&&a++,!s&&fJe&&n[0].trim()===""&&a++,s||a++,n.length===a)return"continue";let c=Math.max(t.current,(u=t.next)!=null?u:0);for(let f=a;f<n.length;f++){let d=n[f];f==0&&o!==void 0&&(d=o+d);let p=GI(d);if(p!==void 0&&(p<c||p===c&&!uJe(d)))return n.slice(0,f).join(`
`).length}return"continue"}l(dJe,"completionCutOrContinue");function L2e(e,t){return async r=>{let n=dJe(r,e,t);return n==="continue"?void 0:n}}l(L2e,"indentationBlockFinished");var J0=Sr(La());function M2e(e,t,r,n){r.markAsDisplayed();let s=n?`${t}.shownFromCache`:`${t}.shown`;mn(e,s,r)}l(M2e,"telemetryShown");function F2e(e,t,r){let n=t+".accepted",s=e.get(Sp);s.previousLabel=1,s.previousLabelTimestamp=Date.now(),mn(e,n,r)}l(F2e,"telemetryAccepted");function B2e(e,t,r){let n=t+".rejected",s=e.get(Sp);s.previousLabel=0,s.previousLabelTimestamp=Date.now(),mn(e,n,r)}l(B2e,"telemetryRejected");function Od(e,t={}){return{...t,telemetryBlob:e}}l(Od,"mkCanceledResultTelemetry");function kd(e){let t={headerRequestId:e.properties.headerRequestId,copilot_trackingId:e.properties.copilot_trackingId};return e.properties.sku!==void 0&&(t.sku=e.properties.sku),e.properties.organizations_list!==void 0&&(t.organizations_list=e.properties.organizations_list),e.properties.enterprise_list!==void 0&&(t.enterprise_list=e.properties.enterprise_list),t}l(kd,"mkBasicResultTelemetry");async function q2e(e,t){if(t.type==="success")return Nx(e,"ghostText.produced",t.telemetryData,{}),t.value;if(t.type!=="abortedBeforeIssued"){if(t.type==="canceled"){mn(e,"ghostText.canceled",t.telemetryData.telemetryBlob.extendedBy({reason:t.reason,cancelledNetworkRequest:t.telemetryData.cancelledNetworkRequest?"true":"false"}));return}Nx(e,`ghostText.${t.type}`,{...t.telemetryData,reason:t.reason},{})}}l(q2e,"handleGhostTextResultTelemetry");var ZV=new za;function U2e(e){return[...e].sort((t,r)=>{var o,a;let n=(o=ZV.get(t.uri.toString()))!=null?o:0;return((a=ZV.get(r.uri.toString()))!=null?a:0)-n})}l(U2e,"sortByAccessTimes");var j2e=l(e=>e.get(Go).onDidFocusTextDocument(t=>{t&&ZV.set(t.document.uri.toString(),Date.now())}),"registerDocumentTracker");var eG=class eG{constructor(t){this.docManager=t}async truncateDocs(t,r,n,s){let o=[],a=0;for(let c of t)if(!(a+c.getText().length>Fy.MAX_NEIGHBOR_AGGREGATE_LENGTH)&&(c.uri.scheme==="file"&&r.scheme==="file"&&c.uri.fsPath!==r.fsPath&&KI(n,c.languageId)&&(o.push({uri:c.uri.toString(),relativePath:await this.docManager.getRelativePath(c),languageId:c.languageId,source:c.getText()}),a+=c.getText().length),o.length>=s))break;return o}async getNeighborFiles(t,r,n){let s=[],o=new Map;return s=await this.truncateDocs(U2e(await this.docManager.textDocuments()),t,r,n),o.set("opentabs",s.map(a=>a.uri)),{docs:s,neighborSource:o}}};l(eG,"OpenTabFiles");var WI=eG;function KI(e,t){return e===t}l(KI,"considerNeighborFile");var Nd=class Nd{static reset(){Nd.instance=void 0}static async getNeighborFiles(t,r,n){if(Nd.instance===void 0){let s=t.get(Go);Nd.instance=new WI(s)}return await Nd.instance.getNeighborFiles(r,n.fileType,Nd.MAX_NEIGHBOR_FILES)}};l(Nd,"NeighborSource"),Nd.MAX_NEIGHBOR_AGGREGATE_LENGTH=2e5,Nd.MAX_NEIGHBOR_FILES=20,Nd.EXCLUDED_NEIGHBORS=["node_modules","dist","site-packages"];var Fy=Nd;var Uy=Sr(La()),J2e=require("crypto");function t9(e,t,r=(n,s)=>n===s?0:1){if(t.length===0||e.length===0)return{distance:t.length,startOffset:0,endOffset:0};let n=new Array(t.length+1).fill(0),s=new Array(t.length+1).fill(0),o=new Array(e.length+1).fill(0),a=new Array(e.length+1).fill(0),c=t[0];for(let f=0;f<e.length+1;f++)f===0?n[f]=1:n[f]=r(e[f-1],c,f-1,0),s[f]=f>0?f-1:0;for(let f=1;f<t.length;f++){let d=o;o=n,n=d,d=a,a=s,s=d,c=t[f],n[0]=f+1;for(let p=1;p<e.length+1;p++){let h=1+o[p],m=1+n[p-1],g=r(e[p-1],c,p-1,f)+o[p-1];n[p]=Math.min(m,h,g),n[p]===g?s[p]=a[p-1]:n[p]===h?s[p]=a[p]:s[p]=s[p-1]}}let u=0;for(let f=0;f<e.length+1;f++)n[f]<n[u]&&(u=f);return{distance:n[u],startOffset:s[u],endOffset:u}}l(t9,"editDistance");function pJe(){return new Map}l(pJe,"emptyLexDictionary");function hJe(e){let t=new Array(e.size);for(let[r,n]of e)t[n]=r;return t}l(hJe,"reverseLexDictionary");function*mJe(e){let t="",r;(c=>(c[c.Word=0]="Word",c[c.Space=1]="Space",c[c.Other=2]="Other"))(r||(r={}));let n=0;for(let s of e){let o;new RegExp("(\\p{L}|\\p{Nd}|_)","u").test(s)?o=0:s===" "?o=1:o=2,o===n&&o!==2?t+=s:(t.length>0&&(yield t),t=s,n=o)}t.length>0
`)){if(n.length<=t){r.add(n);continue}let s=0;for(;s<n.length;)r.add(n.substring(s,s+t)),s+=t}return r}l(K2e,"breakUpLongLines");function Y2e(e,t,r){return(n,s)=>{let o=K2e(n.querySnippet,r),a=K2e(s.querySnippet,r),c=new Set([...o].filter(u=>a.has(u)));return t==="relative"?1-c.size/(o.size+a.size-c.size)<=e:Math.max(o.size,a.size)-c.size<=e}}l(Y2e,"lineBasedSnippetMatcher");function X2e(e,t){return(r,n)=>{let s=t9(r.querySnippet,n.querySnippet);return t==="relative"?s.distance<=e*Math.max(r.querySnippet.length,n.querySnippet.length):s.distance<=e}}l(X2e,"editDistanceSnippetMatcher");function vJe(e,t){let r=(0,Uy.getCursorContext)(e,t);return{querySnippet:r.context,offset:e.offset,tokenLength:r.tokenLength,lineCount:r.lineCount}}l(vJe,"getRetrievalContext");var nG=class nG{constructor(t,r){this.uriToCache=new Map;this.matcher=t,this.maxUriCacheSize=r}hashContext(t){return(0,J2e.createHash)("sha1").update(t.querySnippet).digest("hex")}get(t,r){let n=this.uriToCache.get(t);if(n!==void 0)for(let s of n.keys()){let{context:o,retrievalId:a,snippets:c}=n.get(s);if(this.matcher(r,o))return{retrievalId:a,snippets:c}}}put(t,r,n,s){let o=this.uriToCache.get(t);o===void 0&&(o=new za(this.maxUriCacheSize),this.uriToCache.set(t,o)),o.set(this.hashContext(n),{context:n,retrievalId:r,snippets:s})}};l(nG,"RetrievalCache");var tG=nG;function xJe(e,t,r,n,s){let o=Date.now(),a=t.get(r.uri,n),c=Date.now()-o;return _Je(e,a!==void 0,c,s),a}l(xJe,"lookupCache");function _Je(e,t,r,n){mn(e,"retrieval.cacheLookup",n.extendedBy({cacheHit:t?"true":"false"},{cacheLookupElapsed:r}),0)}l(_Je,"telemetrizeCacheLookup");function bJe(e,t,r,n){let s={retrievalContextTokens:r.tokenLength,retrievalLineCount:r.lineCount,cursorPos:t.offset};mn(e,"retrieval.tooShortContext",n.extendedBy({},s),0),mn(e,"retrieval.tooShortContext",n.extendedBy({file:t.uri,retrievalContext:r.querySnippet},s),1)}l(bJe,"telemetrizeTooShortContext");function CJe(e,t,r,n,s,o){let a={retrievalContextTokens:n.tokenLength,retrievalLineCount:n.lineCount,cursorPos:t.offset};mn(e,"retrieval.issued",o.extendedBy({retrievalId:r},a),0),mn(e,"retrieval.issued",o.extendedBy({retrievalId:r,file:t.uri,retrievalContext:n.querySnippet},a),1)}l(CJe,"telemetrizePostRetrievalRequest");function TJe(e,t,r,n){mn(e,"retrieval.response",n.extendedBy({retrievalId:t}),0)}l(TJe,"telemetrizePostRetrievalResponse");function EJe(e,t,r,n){var s;mn(e,"retrieval.error",n.extendedBy({retrievalId:t,error:(s=JSON.stringify(r))!=null?s:"unknown"}),0)}l(EJe,"telemetrizePostRetrievalRequestError");function SJe(e,t,r,n,s){var a,c,u,f;let o={numSnippetsFromServer:((a=r==null?void 0:r.results)==null?void 0:a.length)||-1,numFilteredSnippets:n.length};mn(e,"retrieval.retrieved",s.extendedBy({retrievalId:t},{...o,elapsedEmbeddingNs:((c=r==null?void 0:r.metadata)==null?void 0:c.elapsed_embedding_ns)||-1,elapsedKnnNs:((u=r==null?void 0:r.metadata)==null?void 0:u.elapsed_knn_ns)||-1,elapsedFindSourceNs:((f=r==null?void 0:r.metadata)==null?void 0:f.elapsed_find_source_ns)||-1}),0),mn(e,"retrieval.retrieved",s.extendedBy({retrievalId:t,snippets:JSON.stringify(n.map(d=>{let{restrictedTelemetry:p,...h}=d;return{...h,...p}}))},{...o}),1)}l(SJe,"telemetrizeProcessRetrievalResponse");function wJe(e,t,r,n,s){var o,a;mn(e,"retrieval.errorProcess",s.extendedBy({retrievalId:t}),0),mn(e,"retrieval.errorProcess",s.extendedBy({retrievalId:t,body:(o=JSON.stringify(r))!=null?o:"unknown",error:(a=JSON.stringify(n))!=null?a:"unknown"}),1)}l(wJe,"telemetrizeProcessRetrievalError");function IJe(e,t,r){mn(e,"retrieval.debounced",r.extendedBy({pendingRetrievalId:t}),0)}l(IJe,"telemetrizeQueryRetrievalDebounce");function AJe(e,t,r,n){mn(e,"retrieval.cacheHit",n.extendedBy({cachedRetrievalId:t},{numSnippetsReturned:r.length}),0)}l(AJe,"telemetrizeQueryRetrievalFromCache");var r9=new Map;function RJe(e,t){return MV+`/v0/retrieval?repo=${e}&impl=${t}`}l(RJe,"retrievalRequestUrl");function PJe(e){return t=>t.relativePath===void 0?!0:!(e.uri.endsWith(t.relativePath)||t.relativePath.endsWith(e.uri))}l(PJe,"filterQuerySnippets");async function OJe(e,t,r,n,s){l
`),r=t[t.length-1],n=r.length-r.trimRight().length,s=e.slice(0,e.length-n),o=e.slice(s.length);return[r.length==n?s:e,o]}l(n9,"trimLastLine");async function t4e(e,t,r,n,s,o,a,c){if((await e.get(Pd).evaluate(s,t,"UPDATE")).isBlocked)return LJe;let u=e.get(zs).suffixPercent(a);if((u>0?t.length:r)<NJe)return DJe;let d=Date.now(),{prefix:p,suffix:h,prefixLength:m,suffixLength:g,promptChoices:y,promptBackground:v,promptElementRanges:_,neighborSource:x}=await MJe(e,t,r,n,s,o,a,c),[b,E]=n9(p),S=Date.now();return{type:"prompt",prompt:{prefix:b,suffix:h,prefixTokens:m,suffixTokens:g,isFimEnabled:u>0&&h.length>0,promptElementRanges:_.ranges},trailingWs:E,promptChoices:y,computeTimeMs:S-d,promptBackground:v,neighborSource:x}}l(t4e,"extractPromptForSource");async function r4e(e,t,r,n,s){let o=await e.get(Go).getRelativePath(t);return t4e(e,t.getText(),t.offsetAt(r),o,t.uri,t.languageId,n,s)}l(r4e,"extractPromptForDocument");function FJe(e,t,r){let n=e.document.languageId,s=e.document.getText();return n===t?s:(0,J0.commentBlockAsSingles)(s,t,r)}l(FJe,"addNeighboringCellsToPrompt");async function BJe(e,t,r,n,s,o){let a=r.getCells().find(c=>c.document.uri.toString()===t.uri.toString());if(a){let u=r.getCells().filter(m=>m.index<a.index&&KI(a.document.languageId,m.document.languageId)),f=e.get(zs).defaultCommentMarker(s),d=u.length>0?u.map(m=>FJe(m,a.document.languageId,f)).join(`
`)+`
`:"",p=d+t.getText(),h=d.length+t.offsetAt(n);return t4e(e,p,h,void 0,t.uri,a.document.languageId,s,o)}else return r4e(e,t,n,s,o)}l(BJe,"extractPromptForNotebook");function jy(e,t,r,n,s){let a=e.get(Go).findNotebook(t);return a===void 0?r4e(e,t,r,n,s):BJe(e,t,a,r,n,s)}l(jy,"extractPrompt");var n4e=2.98410452738298,i4e=-.838732736843507,s4e=1.50314646255716,o4e=-.237798634012662,YI={python:.314368072478742},a4e={"0.01":.225800751784931,"0.02":.290204307767402,"0.03":.333153496466045,"0.05":.404516749849559,"0.1":.513216040545626,"0.2":.626904979128674,"0.3":.694880719658273,"0.4":.743100684947291,"0.5":.782524520571946,"0.6":.816856186092243,"0.7":.84922977716585,"0.8":.883694877241999,"0.9":.921859050950077,"0.95":.944571268106974,"0.99":.969535563141733};var ZRt=new Fs(1,"restraint"),qJe={link:e=>Math.exp(e)/(1+Math.exp(e)),unlink:e=>Math.log(e/(1-e))};function UJe(e,t){let r=Math.min(...Array.from(t.keys()).filter(a=>a>=e)),n=Math.max(...Array.from(t.keys()).filter(a=>a<e)),s=t.get(r),o=t.get(n);return o+(s-o)*(e-n)/(r-n)}l(UJe,"linearInterpolation");var sG=class sG{constructor(t,r,n){this.name=t,this.coefficient=r,this.transformation=n||(s=>s)}contribution(t){return this.coefficient*this.transformation(t)}};l(sG,"Regressor");var Hy=sG,oG=class oG{constructor(t,r,n){this.link=qJe;if(this.intercept=t,this.coefficients=r,this.logitsToQuantiles=new Map,this.logitsToQuantiles.set(0,0),this.logitsToQuantiles.set(1,1),n)for(let s in n)this.logitsToQuantiles.set(n[s],Number(s))}predict(t,r){let n=this.intercept;for(let s of this.coefficients){let o=r[s.name];if(o===void 0)return NaN;n+=s.contribution(o)}return this.link.link(n)}quantile(t,r){let n=this.predict(t,r);return UJe(n,this.logitsToQuantiles)}};l(oG,"LogisticRegression");var iG=oG,l4e=new iG(n4e,[new Hy("compCharLen",i4e,e=>Math.log(1+e)),new Hy("meanLogProb",s4e),new Hy("meanAlternativeLogProb",o4e)].concat(Object.entries(YI).map(e=>new Hy(e[0],e[1]))),a4e);function c4e(e,t){let r={...t.measurements};return Object.keys(YI).forEach(n=>{r[n]=t.properties["customDimensions.languageId"]==n?1:0}),l4e.predict(e,r)}l(c4e,"ghostTextScoreConfidence");function u4e(e,t){let r={...t.measurements};return Object.keys(YI).forEach(n=>{r[n]=t.properties["customDimensions.languageId"]==n?1:0}),l4e.quantile(e,r)}l(u4e,"ghostTextScoreQuantile");var jJe=[{max_token_sequence_length:1,last_tokens_to_consider:10},{max_token_sequence_length:10,last_tokens_to_consider:30},{max_token_sequence_length:20,last_tokens_to_consider:45},{max_token_sequence_length:30,last_tokens_to_consider:60}];function XI(e){let t=e.slice();return t.reverse(),f4e(t)||f4e(t.filter(r=>r.trim().length>0))}l(XI,"isRepetitive");function f4e(e){let t=HJe(e);for(let r of jJe){if(e.length<r.last_tokens_to_consider)continue;if(r.last_tokens_to_consider-1-t[r.last_tokens_to_consider-1]<=r.max_token_sequence_length)return!0}return!1}l(f4e,"isRepeatedPattern");function HJe(e){let t=Array(e.length).fill(0);t[0]=-1;let r=-1;for(let n=1;n<e.length;n++){for(;r>=0&&e[r+1]!==e[n];)r=t[r];e[r+1]===e[n]&&r++,t[n]=r}return t}l(HJe,"kmp_prefix_function");function $Je(e,t,r,n){var o;let s="}";try{s=(o=Pp.getBlockCloseToken(t.languageId))!=null?o:"}"}catch{}return VJe({getLineText:a=>t.lineAt(a).text,getLineCount:()=>t.lineCount},r,n,s)}l($Je,"maybeSnipCompletion");function VJe(e,t,r,n){let s=GJe(r),o=s.lines;if(o.length===1)return r;for(let a=1;a<o.length;a++){let c=!0,u=0,f=0;for(let d=0;d+a+f<o.length;d++){let p;do{let y=t.line+1+d+u;if(p=y>=e.getLineCount()?void 0:e.getLineText(y),p!==void 0&&p.trim()==="")u++;else break}while(!0);let h,m;do if(h=a+d+f,m=h>=o.length?void 0:o[h],m!==void 0&&m.trim()==="")f++;else break;while(!0);let g=h===o.length-1;if(!m||!(p&&m.trim()===n&&(g?p.startsWith(m):p===m))){c=!1;break}}if(c)return o.slice(0,a).join(s.newLineCharacter)}return r}l(VJe,"maybeSnipCompletionImpl");function GJe(e){let t=e.includes(`\r
`)?`\r
`:`
`;return{lines:e.split(t),newLineCharacter:t}}l(GJe,"splitByNewLine");function zJe(e,t,r){let n="",s=t.line+1;for(;n===""&&s<e.lineCount;){if(n=e.lineAt(s).text.trim(),n===r.trim())return!0;s++}return!1}l(zJe,"matchesNextLine");async function QI(e,t,r,n,s,o,a,c){if(XI(n.tokens)){let f=Es.createAndMarkAsIssued();f.extendWithRequestId(n.requestId),mn(e,"repetition.detected",f,1),o.info(e,"Filtered out repetitive solution");return}let u={...n};if(zJe(t,r,u.completionText)){let f=Es.createAndMarkAsIssued();f.extendWithRequestId(n.requestId),mn(e,"completion.alreadyInDocument",f),mn(e,"completion.alreadyInDocument",f.extendedBy({completionTextJson:JSON.stringify(u.completionText)}),1),o.info(e,"Filtered out solution matching next line");return}return u.completionText=WJe(u.completionText,c,a),u.completionText=$Je(e,t,r,u.completionText),u.completionText?u:void 0}l(QI,"postProcessChoice");function WJe(e,t,r){t=t.trim();let n=t.indexOf(r.suffix);if(n<=0)return e;let s=t.substring(0,n).trim();return KJe(e,s)}l(WJe,"removeDifferenceOfCachedVsActualPromptSuffix");function KJe(e,t){return e.endsWith(t)?e.substring(0,e.length-t.length):e}l(KJe,"removeSuffix");function d4e(e,t,r){let s=e.lineAt(t.line).text.substring(t.character);if(s.length>0){if(r.completionText.indexOf(s)!==-1)return!0;{let o=-1;for(let a of s){let c=r.completionText.indexOf(a,o+1);if(c>o)o=c;else{o=-1;break}}return o!==-1}}return!1}l(d4e,"checkSuffix");async function p4e(e,t){let n;if(e.get(zs).debouncePredict(t)&&t.measurements.contextualFilterScore){let o=t.measurements.contextualFilterScore,a=25,c=250,u=.3475,f=7;n=a+c/(1+Math.pow(o/u,f))}else n=e.get(zs).debounceMs(t);return n>0?n:75}l(p4e,"getDebounceLimit");function h4e(e){let t;e[13]>1e-35?e[3]>1.5000000000000002?e[8]>427.50000000000006?e[9]>13.500000000000002?e[121]>1e-35?t=-.3793786744885956:e[149]>1e-35?t=-.34717430705356905:t=-.26126834451035963:t=-.2431318366096852:e[5]>888.5000000000001?t=-.20600463586387135:t=-.2568037008471491:e[308]>1e-35?t=-.2363064824497454:e[8]>370.50000000000006?t=-.37470755210284723:t=-.321978453730494:e[3]>24.500000000000004?e[23]>1e-35?e[131]>1e-35?t=-.26259136509758885:t=-.3096719634039438:e[4]>30.500000000000004?e[9]>18.500000000000004?t=-.34254903852890883:e[2]>98.50000000000001?t=-.41585250791146294:t=-.3673574858887241:e[9]>6.500000000000001?t=-.31688079287876225:e[31]>1e-35?t=-.29110977864003823:e[308]>1e-35?t=-.3201411739040839:t=-.36874023066055506:e[8]>691.5000000000001?e[82]>1e-35?t=-.41318393149040566:e[133]>1e-35?t=-.3741272613525161:e[32]>1e-35?t=-.4112378041027121:e[227]>1e-35?t=-.37726615155719356:e[10]>3.5000000000000004?t=-.3164502293560397:t=-.2930071546509045:e[9]>13.500000000000002?t=-.277366858539218:e[308]>1e-35?e[4]>10.500000000000002?t=-.30975610686807187:e[4]>1.5000000000000002?t=-.2549142136728043:t=-.3271325650785176:e[127]>1e-35?e[0]>1937.5000000000002?t=-.2533046188098832:t=-.325520883579:t=-.331628896481776;let r;e[13]>1e-35?e[3]>1.5000000000000002?e[8]>546.5000000000001?e[9]>13.500000000000002?r=.031231253521808708:r=.05380836288014532:e[5]>423.00000000000006?e[8]>114.50000000000001?r=.06751619128429062:r=.09625089153176467:r=.027268163053989804:e[308]>1e-35?r=.060174483556283756:r=-.049062854038919135:e[3]>24.500000000000004?e[23]>1e-35?e[4]>63.50000000000001?r=-.03969241799174589:r=.01086816842550381:e[31]>1e-35?r=-.003284694817583201:e[9]>6.500000000000001?e[4]>30.500000000000004?r=-.04224490699947552:r=-.011834162944360616:e[308]>1e-35?e[32]>1e-35?r=-.13448447971850278:r=-.019569456707046823:e[19]>1e-35?e[9]>1.5000000000000002?r=-.07256260662659254:e[4]>60.50000000000001?r=-.08227503453609311:r=-.020596416747563847:r=-.07396549241564149:e[8]>691.5000000000001?e[82]>1e-35?r=-.10046536995362734:e[133]>1e-35?r=-.06407649822752297:e[225]>1e-35?r=.08035785003303324:e[92]>1e-35?r=.018901360933204676:e[20]>1e-35?r=.05252546973665552:e[8]>2592.5000000000005?r=-.040543705016462955:r=-.011236043818320725:e[9]>17.500000000000004?r=.025560632674895334:e[308]>1e-35?e[0]>1847.5000000000002?r=.03527165701669741:r=-.0071847350825815035:e[127]>1e-35?r=.02
`);if(n&&(s=s.filter(u=>u.trim().length>0)),Math.abs(t)>s.length||t>=s.length)return!1;t<0&&(t=s.length+t);let o=s[t];return((c=XJe[r])!=null?c:[]).some(u=>o.includes(u))}l(g4e,"hasComment");var lG=class lG{constructor(t,r){let[n,s]=this.firstAndLast(t),o=this.firstAndLast(t.trimEnd());this.language=r,this.length=t.length,this.firstLineLength=n.length,this.lastLineLength=s.length,this.lastLineRstripLength=s.trimEnd().length,this.lastLineStripLength=s.trim().length,this.rstripLength=t.trimEnd().length,this.stripLength=t.trim().length,this.rstripLastLineLength=o[1].length,this.rstripLastLineStripLength=o[1].trim().length,this.secondToLastLineHasComment=g4e(t,-2,r),this.rstripSecondToLastLineHasComment=g4e(t.trimEnd(),-2,r),this.prefixEndsWithNewline=t.endsWith(`
`),this.lastChar=t.slice(-1),this.rstripLastChar=t.trimEnd().slice(-1),this.firstChar=t[0],this.lstripFirstChar=t.trimStart().slice(0,1)}firstAndLast(t){let r=t.split(`
`),n=r.length,s=r[0],o=r[n-1];return o==""&&n>1&&(o=r[n-2]),[s,o]}};l(lG,"PromptFeatures");var JI=lG,cG=class cG{constructor(t,r,n){this.language=n,this.prefixFeatures=new JI(t,n),this.suffixFeatures=new JI(r,n)}constructFeatures(){var c,u,f,d,p;let t=new Array(14).fill(0);t[0]=this.prefixFeatures.length,t[1]=this.prefixFeatures.firstLineLength,t[2]=this.prefixFeatures.lastLineLength,t[3]=this.prefixFeatures.lastLineRstripLength,t[4]=this.prefixFeatures.lastLineStripLength,t[5]=this.prefixFeatures.rstripLength,t[6]=this.prefixFeatures.rstripLastLineLength,t[7]=this.prefixFeatures.rstripLastLineStripLength,t[8]=this.suffixFeatures.length,t[9]=this.suffixFeatures.firstLineLength,t[10]=this.suffixFeatures.lastLineLength,t[11]=this.prefixFeatures.secondToLastLineHasComment?1:0,t[12]=this.prefixFeatures.rstripSecondToLastLineHasComment?1:0,t[13]=this.prefixFeatures.prefixEndsWithNewline?1:0;let r=new Array(Object.keys(m4e).length+1).fill(0);r[(c=m4e[this.language])!=null?c:0]=1;let n=new Array(Object.keys(fu).length+1).fill(0);n[(u=fu[this.prefixFeatures.lastChar])!=null?u:0]=1;let s=new Array(Object.keys(fu).length+1).fill(0);s[(f=fu[this.prefixFeatures.rstripLastChar])!=null?f:0]=1;let o=new Array(Object.keys(fu).length+1).fill(0);o[(d=fu[this.suffixFeatures.firstChar])!=null?d:0]=1;let a=new Array(Object.keys(fu).length+1).fill(0);return a[(p=fu[this.suffixFeatures.lstripFirstChar])!=null?p:0]=1,t.concat(r,n,s,o,a)}};l(cG,"MultilineModelFeatures");var aG=cG;function QJe(e,t){return new aG(e.prefix,e.suffix,t)}l(QJe,"constructMultilineFeatures");function y4e(e,t){let r=QJe(e,t).constructFeatures();return h4e(r)[1]}l(y4e,"requestMultilineScore");var u0=new Fs(1,"ghostText");var i9,fG,dG;async function x4e(e,t,r,n,s,o,a){var m,g,y,v,_;u0.debug(e,`Getting ${o} from network`),r=r.extendedBy();let c=await tZe(e,t,r),u=Ny(e,c),f={stream:!0,n:c,temperature:u,extra:{language:t.languageId,next_indent:(m=t.indentation.next)!=null?m:0,trim_by_indentation:_5e(t.blockMode),prompt_tokens:(g=t.prompt.prefixTokens)!=null?g:0,suffix_tokens:(y=t.prompt.suffixTokens)!=null?y:0}};t.multiline||(f.stop=[`
`]),t.multiline&&t.multiLogitBias&&(f.logit_bias={50256:-100});let d=Date.now(),p={endpoint:"completions",uiKind:"ghostText",isCycling:JSON.stringify(t.isCycling),temperature:JSON.stringify(u),n:JSON.stringify(c),stop:(v=JSON.stringify(f.stop))!=null?v:"unset",logit_bias:JSON.stringify((_=f.logit_bias)!=null?_:null)},h=B5(t.prompt);Object.assign(r.properties,p),Object.assign(r.measurements,h);try{let x={prompt:t.prompt,languageId:t.languageId,repoInfo:t.repoInfo,ourRequestId:t.ourRequestId,engineUrl:t.engineURL,count:c,uiKind:"ghostText",postOptions:f};t.delayMs>0&&await new Promise(E=>setTimeout(E,t.delayMs));let b=await e.get(Rp).fetchAndStreamCompletions(e,x,r,s,n);return b.type==="failed"?{type:"failed",reason:b.reason,telemetryData:kd(r)}:b.type==="canceled"?(u0.debug(e,"Cancelled after awaiting fetchCompletions"),{type:"canceled",reason:b.reason,telemetryData:Od(r)}):a(c,d,b.getProcessingTime(),b.choices)}catch(x){if(Cf(x))return{type:"canceled",reason:"network request aborted",telemetryData:Od(r,{cancelledNetworkRequest:!0})};if(u0.exception(e,x,"Error on ghost text request"),e.get(Id).notifyUser(e,x),U2(e))throw x;return{type:"failed",reason:"non-abort error on ghost text request",telemetryData:kd(r)}}}l(x4e,"genericGetCompletionsFromNetwork");async function ZJe(e,t,r,n,s){return x4e(e,t,r,n,s,"completions",async(o,a,c,u)=>{let f=u[Symbol.asyncIterator](),d=await f.next();if(d.done)return u0.debug(e,"All choices redacted"),{type:"empty",reason:"all choices redacted",telemetryData:kd(r)};if(n!=null&&n.isCancellationRequested)return u0.debug(e,"Cancelled after awaiting redactedChoices iterator"),{type:"canceled",reason:"after awaiting redactedChoices iterator",telemetryData:Od(r)};let p=d.value;if(p===void 0)return u0.debug(e,"Got undefined choice from redactedChoices iterator"),{type:"empty",reason:"got undefined choice from redactedChoices iterator",telemetryData:kd(r)};E4e(e,"performance",p,a,c);let h=o-1;u0.debug(e,`Awaited first result, id: ${p.choiceIndex}`),dZe(e,t,{multiline:t.multiline,choices:[p]});let m=[];for(let y=0;y<h;y++)m.push(f.next());let g=Promise.all(m).then(async y=>{e.get(zs).fastCancellation(r)&&f.next(),u0.debug(e,`Awaited remaining results, number of results: ${y.length}`);let v=[];for(let _ of y){let x=_.value;if(x!==void 0&&(u0.info(e,`GhostText later completion: [${x.completionText}]`),x.completionText.trimEnd())){if(v.findIndex(b=>b.completionText.trim()===x.completionText.trim())!==-1||x.completionText.trim()===p.completionText.trim())continue;v.push(x)}}v.length>0&&C4e(e,t,{multiline:t.multiline,choices:v})});return mu(e)&&await g,{type:"success",value:pG(d.value,{forceSingleLine:!1}),telemetryData:kd(r),telemetryBlob:r}})}l(ZJe,"getCompletionsFromNetwork");async function eZe(e,t,r,n,s){return x4e(e,t,r,n,s,"all completions",async(o,a,c,u)=>{let f=[];for await(let d of u){if(n!=null&&n.isCancellationRequested)return u0.debug(e,"Cancelled after awaiting choices iterator"),{type:"canceled",reason:"after awaiting choices iterator",telemetryData:Od(r)};if(d.completionText.trimEnd()){if(f.findIndex(p=>p.completionText.trim()===d.completionText.trim())!==-1)continue;f.push(d)}}return f.length>0&&(C4e(e,t,{multiline:t.multiline,choices:f}),E4e(e,"cyclingPerformance",f[0],a,c)),{type:"success",value:f,telemetryData:kd(r),telemetryBlob:r}})}l(eZe,"getAllCompletionsFromNetwork");function pG(e,t){let r={...e};return r.completionText=e.completionText.trimEnd(),t.forceSingleLine&&(r.completionText=r.completionText.split(`
`)[0]),r}l(pG,"makeGhostAPIChoice");async function tZe(e,t,r){let n=e.get(zs).overrideNumGhostCompletions(r);return n?t.isCycling?Math.max(0,3-n):n:x5e(t.blockMode)&&t.multiline?r0(e,Zs.InlineSuggestCount):t.isCycling?2:1}l(tZe,"getNumGhostCompletions");async function rZe(e,t,r,n,s,o,a,c=!1,u=!0,f=!0,d=.5){let p=await e.get($1).forLanguage(e,t.languageId,a);switch(p){case"server":return{blockMode:"server",requestMultiline:!0,isCyclingRequest:s,finishedCb:async h=>{}};case"parsing":case"parsingandserver":default:{if(await fZe(e,t,r,o,a,n,c,u,f,d)){let m;return n.trailingWs.length>0&&!n.prompt.prefix.endsWith(n.trailingWs)?m=e.get(C0).position(r.line,Math.max(r.character-n.trailingWs.length,0)):m=r,{blockMode:p,requestMultiline:!0,isCyclingRequest:!1,finishedCb:e9(e,t,m)}}return{blockMode:p,requestMultiline:!1,isCyclingRequest:s,finishedCb:async m=>{}}}}}l(rZe,"getGhostTextStrategy");var nZe=new Kw;async function _4e(e,t,r,n,s,o,a){var hr,Pr;let c=Ma();s=s.extendedBy({headerRequestId:c});let u=t.getText(),f=t.offsetAt(r),d=u.substring(f),p=W5(e,t.uri),h=await PI(e,t),m=e.get(zs),g=await m.updateExPValuesAndAssignments(h,s),y=m.useLanguageDetection(g),v=await e.get(Ru).detectLanguage(t);y&&(t=new UI(t,v.languageId));let _=await jy(e,t,r,g,a);if(_.type==="copilotNotAvailable")return u0.debug(e,"Copilot not available, due to content exclusion"),{type:"abortedBeforeIssued",reason:"Copilot not available due to content exclusion"};if(_.type==="contextTooShort")return u0.debug(e,"Breaking, not enough context"),{type:"abortedBeforeIssued",reason:"Not enough context"};if(o!=null&&o.isCancellationRequested)return u0.info(e,"Cancelled after extractPrompt"),{type:"abortedBeforeIssued",reason:"Cancelled after extractPrompt"};let x=sZe(t,r);if(x===void 0)return u0.debug(e,"Breaking, invalid middle of the line"),{type:"abortedBeforeIssued",reason:"Invalid middle of the line"};let b=e.get(Ja),E=e.get(C0),S=await rZe(e,t,r,_,n,x,g);if(o!=null&&o.isCancellationRequested)return u0.info(e,"Cancelled after requestMultiline"),{type:"abortedBeforeIssued",reason:"Cancelled after requestMultiline"};let[I]=n9(t.getText(E.range(E.position(0,0),r))),H=iZe(e,I,_.prompt,S.requestMultiline),K=await jI(e,g),be=m.beforeRequestWaitMs(g),Se=m.multiLogitBias(g),ne={blockMode:S.blockMode,languageId:t.languageId,repoInfo:p,engineURL:K,ourRequestId:c,prefix:I,prompt:_.prompt,multiline:S.requestMultiline,indentation:zI(t,r),isCycling:n,delayMs:be,multiLogitBias:Se},ye=m.debouncePredict(g),J=m.contextualFilterEnable(g),Z=m.contextualFilterAcceptThreshold(g),Te=m.contextualFilterEnableTree(g),vt=m.contextualFilterExplorationTraffic(g),Ze=!1;(ye||J)&&(Ze=!0);let At=yZe(e,t,v,ne,r,_,g,Ze,Te);if(S.isCyclingRequest&&((hr=H==null?void 0:H[0].length)!=null?hr:0)>1||!S.isCyclingRequest&&H!==void 0)u0.info(e,"Found inline suggestions locally");else{if(b==null||b.setProgress(),S.isCyclingRequest){let Tt=await eZe(e,ne,At,o,S.finishedCb);if(Tt.type==="success"){let Ar=(Pr=H==null?void 0:H[0])!=null?Pr:[];Tt.value.forEach(se=>{Ar.findIndex(yr=>yr.completionText.trim()===se.completionText.trim())===-1&&Ar.push(se)}),H=[Ar,3]}else if(H===void 0)return b==null||b.removeProgress(),Tt}else{let Tt=await p4e(e,At);try{await nZe.debounce(Tt)}catch{return{type:"canceled",reason:"by debouncer",telemetryData:Od(At)}}if(o!=null&&o.isCancellationRequested)return u0.info(e,"Cancelled during debounce"),{type:"canceled",reason:"during debounce",telemetryData:Od(At)};if(J&&At.measurements.contextualFilterScore&&At.measurements.contextualFilterScore<Z/100&&Math.random()<1-vt/100)return u0.info(e,"Cancelled by contextual filter"),{type:"canceled",reason:"contextualFilterScore below threshold",telemetryData:Od(At)};let Ar=await ZJe(e,ne,At,o,S.finishedCb);if(Ar.type!=="success")return b==null||b.removeProgress(),Ar;H=[[Ar.value],0]}b==null||b.removeProgress()}if(H===void 0)return{type:"failed",reason:"internal error: choices should be defined after network call",telemetryData:kd(At)};let[Ve,ie]=H,ae=$5(X5e(Ve),async Tt=>QI(e,t,r,Tt,x,u0,_.prompt,d)),gr=[];for await(let Tt of ae){let Ar=x&&d4e(
`).length};t.meanLogProb&&(s.meanLogProb=t.meanLogProb),t.meanAlternativeLogProb&&(s.meanAlternativeLogProb=t.meanAlternativeLogProb);let o=t.telemetryData.extendedBy(n,s);return o.extendWithRequestId(r),o.measurements.confidence=c4e(e,o),o.measurements.quantile=u4e(e,o),u0.debug(e,`Extended telemetry for ${t.telemetryData.properties.headerRequestId} with retention confidence ${o.measurements.confidence} (expected as good or better than about ${o.measurements.quantile} of all suggestions)`),o}l(gZe,"telemetryWithAddData");function yZe(e,t,r,n,s,o,a,c,u){let f=e.get(C0),d=t.lineAt(s.line),p=t.getText(f.range(d.range.start,s)),h=t.getText(f.range(s,d.range.end)),m={languageId:t.languageId,beforeCursorWhitespace:JSON.stringify(p.trim()===""),afterCursorWhitespace:JSON.stringify(h.trim()==="")};t.languageId!==r.languageId&&(m.detectedLanguageId=r.languageId,m.fileExtension=r.fileExtension);let g={...B5(o.prompt),promptEndPos:t.offsetAt(s),documentLength:t.getText().length,delayMs:n.delayMs},y=a.extendedBy(m,g);y.properties.promptChoices=JSON.stringify(o.promptChoices,(x,b)=>b instanceof Map?Array.from(b.entries()).reduce((E,[S,I])=>({...E,[S]:I}),{}):b),y.properties.promptBackground=JSON.stringify(o.promptBackground,(x,b)=>b instanceof Map?Array.from(b.values()):b);let v=Array.from(o.neighborSource.entries()).map(x=>[x[0],x[1].map(b=>(0,v4e.SHA256)(b).toString())]);y.properties.neighborSource=JSON.stringify(v),y.measurements.promptComputeTimeMs=o.computeTimeMs,c&&(y.measurements.contextualFilterScore=K5e(e,y,o.prompt,u));let _=n.repoInfo;return y.properties.gitRepoInformation=_===void 0?"unavailable":_===0?"pending":"available",_!==void 0&&_!==0&&(y.properties.gitRepoUrl=_.url,y.properties.gitRepoHost=_.hostname,y.properties.gitRepoOwner=_.owner,y.properties.gitRepoName=_.repo,y.properties.gitRepoPath=_.pathname),y.properties.engineName=Q5(e,n.engineURL),y.properties.isMultiline=JSON.stringify(n.multiline),y.properties.blockMode=n.blockMode,y.properties.isCycling=JSON.stringify(n.isCycling),mn(e,"ghostText.issued",y),y}l(yZe,"telemetryIssued");function E4e(e,t,r,n,s){let o=Date.now()-n,a=o-s,c=r.telemetryData.extendedBy({},{completionCharLen:r.completionText.length,requestTimeMs:o,processingTimeMs:s,deltaMs:a,meanLogProb:r.meanLogProb||NaN,meanAlternativeLogProb:r.meanAlternativeLogProb||NaN,numTokens:r.numTokens});c.extendWithRequestId(r.requestId),mn(e,`ghostText.${t}`,c)}l(E4e,"telemetryPerformance");var hG=class hG{constructor(){this.cache=new Map}get(t){return this.cache.get(t)}set(t,r){this.cache.set(t,r)}};l(hG,"CertificateReaderCache");var bm=hG;var Wve=Sr(require("fs")),Kve=require("tls");var DA=new Fs(1,"certificates"),Pz=class Pz{};l(Pz,"RootCertificateReader");var pc=Pz,LA=l((e,t=process.platform)=>new Cz(e.get(ml),ont(e,t),new Rz),"getRootCertificateReader"),Oz=class Oz extends pc{constructor(r,n,s){super();this.realReader=n;this.noopReader=s;this.delegate=n,r.on("onCopilotToken",o=>{this.delegate=o.getTokenValue("ssc")==="1"?this.realReader:this.noopReader})}getAllRootCAs(){return this.delegate.getAllRootCAs()}};l(Oz,"FeatureAwareCertificateReader");var Cz=Oz;function ont(e,t){let r=e.get(bm).get(t);if(r)return r;let n=new NA(e,ant(e,t),Kve.rootCertificates),s=new NA(e,new Ez),o=new Tz([s,n]);return e.get(bm).set(t,o),o}l(ont,"createRealReader");function ant(e,t){switch(t){case"linux":return new Sz(e);case"darwin":return new wz(e);case"win32":return new Iz(e);default:return new Az}}l(ant,"createPlatformReader");var kz=class kz extends pc{constructor(r,n,s=[]){super();this.ctx=r;this.delegate=n;this.fallbackCerts=s}async getAllRootCAs(){try{return await this.delegate.getAllRootCAs()}catch(r){return DA.warn(this.ctx,`Failed to read root certificates: ${r}`),this.fallbackCerts}}};l(kz,"ErrorHandlingCertificateReader");var NA=kz,Nz=class Nz extends pc{constructor(r){super();this.delegates=r}async getAllRootCAs(){return this.certificates||(this.certificates=(await Promise.all(this.delegates.map(r=>r.getAllRootCAs()))).flat()),this.certificates}};l(Nz,"CachingRootCertificateReader");var Tz=Nz,Dz=class Dz extends pc{
`,{encoding:"utf8"})}async delete(t,r){let n=`${this.directory}/${t}.json`;try{let s=await jp.promises.readFile(n,{encoding:"utf8"}),o=JSON.parse(s);delete o[r],await jp.promises.writeFile(n,JSON.stringify(o)+`
`,{encoding:"utf8"})}catch{}}async deleteSetting(t){let r=`${this.directory}/${t}.json`;try{await jp.promises.rm(r)}catch{}}async listSettings(){try{return(await jp.promises.readdir(this.directory)).filter(r=>r.endsWith(".json")).map(r=>r.slice(0,-5))}catch{return[]}}async listKeys(t){let r=`${this.directory}/${t}.json`;try{let n=await jp.promises.readFile(r,{encoding:"utf8"});return Object.keys(JSON.parse(n))}catch{return[]}}};l(rW,"PersistenceManager");var of=rW;function Hnt(){return T9.env.XDG_CONFIG_HOME?T9.env.XDG_CONFIG_HOME+"/github-copilot":(0,T8e.platform)()==="win32"?T9.env.USERPROFILE+"\\AppData\\Local\\github-copilot":T9.env.HOME+"/.config/github-copilot"}l(Hnt,"getXdgConfigPath");function E8e(){return new of(Hnt())}l(E8e,"makeXdgPersistenceManager");function S8e(e=process.versions.node){let[t,r,n]=e.split(".").map(s=>parseInt(s,10));if(t<16||t===16&&r<14||t==17&&r<3)return`Node.js 18.x is required to run GitHub Copilot but found ${e}`}l(S8e,"errorMessageForUnsupportedNodeVersion");var nW=class nW extends Nw{constructor(){super(new kw,new Map),this.setOverridesFromEnvironment()}getOptionalConfig(t){if(!(Array.isArray(t)&&!this.isDefaultSettingOverwritten(t)))return super.getConfig(t)}setOverridesFromEnvironment(){["DebugOverrideEngine","DebugOverrideProxyUrl","DebugOverrideCapiUrl","KerberosServicePrincipal"].forEach(r=>{let n=`AGENT_${$nt(r)}`;n in process.env&&this.setConfig(Zs[r],process.env[n])})}};l(nW,"AgentConfigProvider");var HA=nW;function $nt(e){return e.replace(/([a-z])([A-Z]+)/g,"$1_$2").toUpperCase()}l($nt,"camelCaseToSnakeCaseAllCaps");var iW=class iW extends oa{setEditorAndPluginInfo(r,n){this._editorInfo=r,this._editorPluginInfo=n}getEditorInfo(){return this._editorInfo?this._editorInfo:{name:"unknown-editor",version:"0"}}getEditorPluginInfo(){return this._editorPluginInfo?this._editorPluginInfo:{name:"unknown-editor-plugin",version:"0"}}};l(iW,"AgentEditorInfo");var $A=iW;var sW=class sW{contributeHeaderValues(t,r){t.startsWith(FV)&&(r["X-GitHub-Api-Version"]="2023-07-07")}};l(sW,"CapiVersionHeaderContributor");var VA=sW;var GA=Sr(La()),w8e=Sr(require("path")),I8e=Sr(vl());var oW=class oW{constructor(t){this.ctx=t}async getRelativePath(t){var n;return(n=await this.ctx.get(Go).getRelativePath(t))!=null?n:w8e.basename(t.uri.fsPath)}async readFile(t){var s;let r=I8e.URI.parse(t),n=await this.readFromTextDocumentManager(r);return n.status!=="notfound"?n.status==="valid"&&((s=n.document)==null?void 0:s.getText().length)===0?{status:"notfound",message:"File is empty"}:n:await this.readFromFilesystem(r)}async readFromTextDocumentManager(t){return await this.ctx.get(Go).getTextDocumentWithValidation(t)}async readFromFilesystem(t){if(await this.fileExists(t)){if(await this.getFileSizeMB(t)>1)return{status:"notfound",message:"File too large"};let n=await this.doReadFile(t);if(n.length>0){if(!(await this.ctx.get(Pd).evaluate(t,n)).isBlocked){let o=this.ctx.get(Q1),a=o.create(t,"UNKNOWN",0,n),c=await this.ctx.get(Ru).detectLanguage(a);return{status:"valid",document:o.create(t,c.languageId,0,n)}}return{status:"invalid",reason:"blocked"}}}return{status:"notfound",message:"File not found"}}async doReadFile(t){return await this.ctx.get(GA.FileSystem).readFileString(t)}async getFileSizeMB(t){return(await this.ctx.get(GA.FileSystem).stat(t)).size/1024/1024}async fileExists(t){try{return await this.ctx.get(GA.FileSystem).stat(t),!0}catch{return!1}}};l(oW,"ConversationFileReader");var el=oW;var aW=class aW{};l(aW,"ConversationProgress");var Zf=aW;var lW=class lW{constructor(t){this.request=t;this.id=Ma();this.timestamp=Date.now();this.status="in-progress";this.skills=[];this.references=[];this.annotations=[]}};l(lW,"Turn");var lv=lW,WA=class WA{constructor(t,r=[],n="panel"){this.primer=t;this.turns=r;this.source=n;this._id=Ma();this._timestamp=Date.now()}copy(){let t=JSON.parse(JSON.stringify(this.turns)),r=new WA(this.primer,t,this.source);return r._id=this.id,r._timestamp=this.timestamp,r}get id(){return this._id}get timestamp(){return this._timestamp}addTurn(t){this.turns.push(t)}deleteTurn(t){this.turns=thi
`),s=["The active document is the source code the user is looking at right now.","You have read access to the code in the active document, files the user has recently worked with and open tabs. You are able to retrieve, read and use this code to answer questions.","You cannot retrieve code that is outside of the current project.","You can only give one reply for each conversation turn."].join(`
`),o=e?`The user works in an IDE called ${e} which can be used to edit code, run and debug the user's application as well as executing tests.`:"",a=r?`The user is using ${r} as their operating system.`:"",c=t?`The user is logged in as ${t} on GitHub.`:"";return[n,a,c,o,s].filter(u=>u&&u!="").join(`
`)}l(A8e,"chatBasePrompt");var cW=class cW{constructor(){this.skills=[]}registerSkill(t){if(this.getSkill(t.id))throw new Error(`Skill with id '${t.id}' already registered`);if(this.getSkillIdFromEncoding(t.encoding))throw new Error(`Skill with encoding '${t.encoding}' already registered`);if(t.encoding.length!==1||!/[a-z]/.test(t.encoding))throw new Error(`Skill '${t.id}' encoding should be a single lowercase letter`);this.skills.push(t)}getSkill(t){return this.skills.find(r=>r.id===t)}getSkillIdFromEncoding(t){var r;return(r=this.skills.find(n=>n.encoding===t))==null?void 0:r.id}getDescriptors(){return[...this.skills]}};l(cW,"ConversationSkillRegistry");var kl=cW;var fW=class fW{constructor(t,r){this.conversation=t;this.capabilities=r}};l(fW,"ConversationHolder");var uW=fW,dW=class dW{constructor(t){this.ctx=t;this.conversations=new za(100)}async create(t,r="panel"){var c;let n=await this.ctx.get(ua).getAuthRecord(this.ctx),s=(c=this.ctx.get(oa).getEditorInfo().readableName)!=null?c:this.ctx.get(oa).getEditorInfo().name,o=Vnt(process.platform),a=new zA(A8e(s,n==null?void 0:n.user,o),[],r);return this.conversations.set(a.id,new uW(a,t)),a}destroy(t){this.conversations.delete(t)}addTurn(t,r,n){let s=this.get(t);return n&&n.length>0&&(r.references=n),s.addTurn(r),r}deleteTurn(t,r){this.get(t).deleteTurn(r)}get(t){return this.getHolder(t).conversation}getCapabilities(t){return this.getHolder(t).capabilities}getSupportedSkills(t){let r=this.ctx.get(kl).getDescriptors().filter(s=>s.type==="implicit").map(s=>s.id),n=this.getCapabilities(t).skills;return[...r,...n]}filterSupportedSkills(t,r){let n=this.getSupportedSkills(t);return r.filter(s=>n.includes(s))}getHolder(t){let r=this.conversations.get(t);if(!r)throw new Error(`Conversation with id ${t} does not exist`);return r}};l(dW,"Conversations");var S0=dW;function Vnt(e){switch(e){case"darwin":return"macOS";case"win32":return"Windows";case"linux":return"Linux";case"freebsd":return"FreeBSD";case"openbsd":return"OpenBSD";case"sunos":return"SunOS";case"aix":return"AIX";default:return}}l(Vnt,"mapPlatformToOs");function V8e(e){return typeof e>"u"||e===null}l(V8e,"isNothing");function Gnt(e){return typeof e=="object"&&e!==null}l(Gnt,"isObject");function znt(e){return Array.isArray(e)?e:V8e(e)?[]:[e]}l(znt,"toArray");function Wnt(e,t){var r,n,s,o;if(t)for(o=Object.keys(t),r=0,n=o.length;r<n;r+=1)s=o[r],e[s]=t[s];return e}l(Wnt,"extend");function Knt(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}l(Knt,"repeat");function Ynt(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}l(Ynt,"isNegativeZero");var Xnt=V8e,Qnt=Gnt,Jnt=znt,Znt=Knt,eit=Ynt,tit=Wnt,Nl={isNothing:Xnt,isObject:Qnt,toArray:Jnt,repeat:Znt,isNegativeZero:eit,extend:tit};function G8e(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+=`
`+e.mark.snippet),n+" "+r):n}l(G8e,"formatError");function S9(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=G8e(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}l(S9,"YAMLException$1");S9.prototype=Object.create(Error.prototype);S9.prototype.constructor=S9;S9.prototype.toString=l(function(t){return this.name+": "+G8e(this,t)},"toString");var Nu=S9;function pW(e,t,r,n,s){var o="",a="",c=Math.floor(s/2)-1;return n-t>c&&(o=" ... ",t=n-c+o.length),r-n>c&&(a=" ...",r=n+c-a.length),{str:o+e.slice(t,r).replace(/\t/g,"\u2192")+a,pos:n-t+o.length}}l(pW,"getLine");function hW(e,t){return Nl.repeat(" ",t-e.length)+e}l(hW,"padStart");function rit(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],s=[],o,a=-1;o=r.exec(e.buffer);)s.push(o.index),n.push(o.index+o[0].length),e.position<=o.index&&a<0&&(a=n.length-2);a<0&&(a=n.length-1);var c="",u,f,d=Math.min(e.line+t.linesAfter,s.length).toString().length,p=t.maxLength-(t.indent+d+3);for(u=1;u<=t.linesBefore&&!(a-u<0);u++)f=pW(e.buffer,n[a-u],s[a-u],e.position-(n[a]-n[a-u]),p),c=Nl.repeat(" ",t.indent)+hW((e.line-u+1).toString(),d)+" | "+f.str+`
`+c;for(f=pW(e.buffer,n[a],s[a],e.position,p),c+=Nl.repeat(" ",t.indent)+hW((e.line+1).toString(),d)+" | "+f.str+`
`,c+=Nl.repeat("-",t.indent+d+3+f.pos)+`^
`,u=1;u<=t.linesAfter&&!(a+u>=s.length);u++)f=pW(e.buffer,n[a+u],s[a+u],e.position-(n[a]-n[a+u]),p),c+=Nl.repeat(" ",t.indent)+hW((e.line+u+1).toString(),d)+" | "+f.str+`
`;return c.replace(/\n$/,"")}l(rit,"makeSnippet");var nit=rit,iit=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],sit=["scalar","sequence","mapping"];function oit(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}l(oit,"compileStyleAliases");function ait(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(iit.indexOf(r)===-1)throw new Nu('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=oit(t.styleAliases||null),sit.indexOf(this.kind)===-1)throw new Nu('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}l(ait,"Type$1");var Uc=ait;function R8e(e,t){var r=[];return e[t].forEach(function(n){var s=r.length;r.forEach(function(o,a){o.tag===n.tag&&o.kind===n.kind&&o.multi===n.multi&&(s=a)}),r[s]=n}),r}l(R8e,"compileList");function lit(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,r;function n(s){s.multi?(e.multi[s.kind].push(s),e.multi.fallback.push(s)):e[s.kind][s.tag]=e.fallback[s.tag]=s}for(l(n,"collectType"),t=0,r=arguments.length;t<r;t+=1)arguments[t].forEach(n);return e}l(lit,"compileMap");function gW(e){return this.extend(e)}l(gW,"Schema$1");gW.prototype.extend=l(function(t){var r=[],n=[];if(t instanceof Uc)n.push(t);else if(Array.isArray(t))n=n.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(r=r.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit));else throw new Nu("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(o){if(!(o instanceof Uc))throw new Nu("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new Nu("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(o.multi)throw new Nu("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(o){if(!(o instanceof Uc))throw new Nu("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(gW.prototype);return s.implicit=(this.implicit||[]).concat(r),s.explicit=(this.explicit||[]).concat(n),s.compiledImplicit=R8e(s,"implicit"),s.compiledExplicit=R8e(s,"explicit"),s.compiledTypeMap=lit(s.compiledImplicit,s.compiledExplicit),s},"extend");var cit=gW,uit=new Uc("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),fit=new Uc("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),dit=new Uc("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),pit=new cit({explicit:[uit,fit,dit]});function hit(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}l(hit,"resolveYamlNull");function mit(){return null}l(mit,"constructYamlNull");function git(e){return e===null}l(git,"isNull");var yit=new Uc("tag:yaml.org,2002:null",{kind:"scalar",resolve:hit,construct:mit,predicate:git,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function vit(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}l(vit,"resolveYamlBoolean");function xit(e){return e==="true"||e==="True"||e==="TRUE"}l(xit,"constructYamlBoolean");function _it(e){return Object.prototype.t
\r`;function Vit(e){if(e===null)return!1;var t,r,n=0,s=e.length,o=bW;for(r=0;r<s;r++)if(t=o.indexOf(e.charAt(r)),!(t>64)){if(t<0)return!1;n+=6}return n%8===0}l(Vit,"resolveYamlBinary");function Git(e){var t,r,n=e.replace(/[\r\n=]/g,""),s=n.length,o=bW,a=0,c=[];for(t=0;t<s;t++)t%4===0&&t&&(c.push(a>>16&255),c.push(a>>8&255),c.push(a&255)),a=a<<6|o.indexOf(n.charAt(t));return r=s%4*6,r===0?(c.push(a>>16&255),c.push(a>>8&255),c.push(a&255)):r===18?(c.push(a>>10&255),c.push(a>>2&255)):r===12&&c.push(a>>4&255),new Uint8Array(c)}l(Git,"constructYamlBinary");function zit(e){var t="",r=0,n,s,o=e.length,a=bW;for(n=0;n<o;n++)n%3===0&&n&&(t+=a[r>>18&63],t+=a[r>>12&63],t+=a[r>>6&63],t+=a[r&63]),r=(r<<8)+e[n];return s=o%3,s===0?(t+=a[r>>18&63],t+=a[r>>12&63],t+=a[r>>6&63],t+=a[r&63]):s===2?(t+=a[r>>10&63],t+=a[r>>4&63],t+=a[r<<2&63],t+=a[64]):s===1&&(t+=a[r>>2&63],t+=a[r<<4&63],t+=a[64],t+=a[64]),t}l(zit,"representYamlBinary");function Wit(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}l(Wit,"isBinary");var Kit=new Uc("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Vit,construct:Git,predicate:Wit,represent:zit}),Yit=Object.prototype.hasOwnProperty,Xit=Object.prototype.toString;function Qit(e){if(e===null)return!0;var t=[],r,n,s,o,a,c=e;for(r=0,n=c.length;r<n;r+=1){if(s=c[r],a=!1,Xit.call(s)!=="[object Object]")return!1;for(o in s)if(Yit.call(s,o))if(!a)a=!0;else return!1;if(!a)return!1;if(t.indexOf(o)===-1)t.push(o);else return!1}return!0}l(Qit,"resolveYamlOmap");function Jit(e){return e!==null?e:[]}l(Jit,"constructYamlOmap");var Zit=new Uc("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Qit,construct:Jit}),est=Object.prototype.toString;function tst(e){if(e===null)return!0;var t,r,n,s,o,a=e;for(o=new Array(a.length),t=0,r=a.length;t<r;t+=1){if(n=a[t],est.call(n)!=="[object Object]"||(s=Object.keys(n),s.length!==1))return!1;o[t]=[s[0],n[s[0]]]}return!0}l(tst,"resolveYamlPairs");function rst(e){if(e===null)return[];var t,r,n,s,o,a=e;for(o=new Array(a.length),t=0,r=a.length;t<r;t+=1)n=a[t],s=Object.keys(n),o[t]=[s[0],n[s[0]]];return o}l(rst,"constructYamlPairs");var nst=new Uc("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:tst,construct:rst}),ist=Object.prototype.hasOwnProperty;function sst(e){if(e===null)return!0;var t,r=e;for(t in r)if(ist.call(r,t)&&r[t]!==null)return!1;return!0}l(sst,"resolveYamlSet");function ost(e){return e!==null?e:{}}l(ost,"constructYamlSet");var ast=new Uc("tag:yaml.org,2002:set",{kind:"mapping",resolve:sst,construct:ost}),K8e=Fit.extend({implicit:[jit,$it],explicit:[Kit,Zit,nst,ast]}),Mm=Object.prototype.hasOwnProperty,KA=1,Y8e=2,X8e=3,YA=4,mW=1,lst=2,P8e=3,cst=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ust=/[\x85\u2028\u2029]/,fst=/[,\[\]\{\}]/,Q8e=/^(?:!|!!|![a-z\-]+!)$/i,J8e=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function O8e(e){return Object.prototype.toString.call(e)}l(O8e,"_class");function Hp(e){return e===10||e===13}l(Hp,"is_EOL");function f3(e){return e===9||e===32}l(f3,"is_WHITE_SPACE");function Du(e){return e===9||e===32||e===10||e===13}l(Du,"is_WS_OR_EOL");function uv(e){return e===44||e===91||e===93||e===123||e===125}l(uv,"is_FLOW_INDICATOR");function dst(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}l(dst,"fromHexCode");function pst(e){return e===120?2:e===117?4:e===85?8:0}l(pst,"escapedHexLen");function hst(e){return 48<=e&&e<=57?e-48:-1}l(hst,"fromDecimalCode");function k8e(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}l(k8e,"simpleEscapeSequence");function mst(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}l(mst,"charFromCodepoint");var Z8e=new Array(256),e6e=new Array(256);for(u3=0;u3<256;u3++)Z8e[u3]=k8e(u3)?1:0,e6e[u3]=k8e(u3);var u3;function gst(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||K8e,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}l(gst,"State$1");function t6e(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=nit(r),new Nu(t,r)}l(t6e,"generateError");function Ns(e,t){throw t6e(e,t)}l(Ns,"throwError");function XA(e,t){e.onWarning&&e.onWarning.call(null,t6e(e,t))}l(XA,"throwWarning");var N8e={YAML:l(function(t,r,n){var s,o,a;t.version!==null&&Ns(t,"duplication of %YAML directive"),n.length!==1&&Ns(t,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),s===null&&Ns(t,"ill-formed argument of the YAML directive"),o=parseInt(s[1],10),a=parseInt(s[2],10),o!==1&&Ns(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=a<2,a!==1&&a!==2&&XA(t,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:l(function(t,r,n){var s,o;n.length!==2&&Ns(t,"TAG directive accepts exactly two arguments"),s=n[0],o=n[1],Q8e.test(s)||Ns(t,"ill-formed tag handle (first argument) of the TAG directive"),Mm.call(t.tagMap,s)&&Ns(t,'there is a previously declared suffix for "'+s+'" tag handle'),J8e.test(o)||Ns(t,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{Ns(t,"tag prefix is malformed: "+o)}t.tagMap[s]=o},"handleTagDirective")};function Lm(e,t,r,n){var s,o,a,c;if(t<r){if(c=e.input.slice(t,r),n)for(s=0,o=c.length;s<o;s+=1)a=c.charCodeAt(s),a===9||32<=a&&a<=1114111||Ns(e,"expected valid JSON character");else cst.test(c)&&Ns(e,"the stream contains non-printable characters");e.result+=c}}l(Lm,"captureSegment");function D8e(e,t,r,n){var s,o,a,c;for(Nl.isObject(r)||Ns(e,"cannot merge mappings; the provided source object is unacceptable"),s=Object.keys(r),a=0,c=s.length;a<c;a+=1)o=s[a],Mm.call(t,o)||(t[o]=r[o],n[o]=!0)}l(D8e,"mergeMappings");function fv(e,t,r,n,s,o,a,c,u){var f,d;if(Array.isArray(s))for(s=Array.prototype.slice.call(s),f=0,d=s.length;f<d;f+=1)Array.isArray(s[f])&&Ns(e,"nested arrays are not supported inside keys"),typeof s=="object"&&O8e(s[f])==="[object Object]"&&(s[f]="[object Object]");if(typeof s=="object"&&O8e(s)==="[object Object]"&&(s="[object Object]"),s=String(s),t===null&&(t={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(o))for(f=0,d=o.length;f<d;f+=1)D8e(e,t,o[f],r);else D8e(e,t,o,r);else!e.json&&!Mm.call(r,s)&&Mm.call(t,s)&&(e.line=a||e.line,e.lineStart=c||e.lineStart,e.position=u||e.position,Ns(e,"duplicated mapping key")),s==="__proto__"?Object.defineProperty(t,s,{configurable:!0,enumerable:!0,writable:!0,value:o}):t[s]=o,delete r[s];return t}l(fv,"storeMappingPair");function CW(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):Ns(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}l(CW,"readLineBreak");function Cl(e,t,r){for(var n=0,s=e.input.charCodeAt(e.position);s!==0;){for(;f3(s);)s===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),s=e.input.charCodeAt(++e.position);if(t&&s===35)do s=e.input.charCodeAt(++e.position);while(s!==10&&s!==13&&s!==0);if(Hp(s))for(CW(e),s=e.input.charCodeAt(e.position),n++,e.lineIndent=0;s===32;)e.lineIndent++,s=e.input.charCodeAt(++e.position);else break}r
`,t-1))}l(TW,"writeFoldedLines");function yst(e,t,r){var n,s,o,a,c,u,f,d,p=e.kind,h=e.result,m;if(m=e.input.charCodeAt(e.position),Du(m)||uv(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96||(m===63||m===45)&&(s=e.input.charCodeAt(e.position+1),Du(s)||r&&uv(s)))return!1;for(e.kind="scalar",e.result="",o=a=e.position,c=!1;m!==0;){if(m===58){if(s=e.input.charCodeAt(e.position+1),Du(s)||r&&uv(s))break}else if(m===35){if(n=e.input.charCodeAt(e.position-1),Du(n))break}else{if(e.position===e.lineStart&&ZA(e)||r&&uv(m))break;if(Hp(m))if(u=e.line,f=e.lineStart,d=e.lineIndent,Cl(e,!1,-1),e.lineIndent>=t){c=!0,m=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=u,e.lineStart=f,e.lineIndent=d;break}}c&&(Lm(e,o,a,!1),TW(e,e.line-u),o=a=e.position,c=!1),f3(m)||(a=e.position+1),m=e.input.charCodeAt(++e.position)}return Lm(e,o,a,!1),e.result?!0:(e.kind=p,e.result=h,!1)}l(yst,"readPlainScalar");function vst(e,t){var r,n,s;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=s=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(Lm(e,n,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)n=e.position,e.position++,s=e.position;else return!0;else Hp(r)?(Lm(e,n,s,!0),TW(e,Cl(e,!1,t)),n=s=e.position):e.position===e.lineStart&&ZA(e)?Ns(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);Ns(e,"unexpected end of the stream within a single quoted scalar")}l(vst,"readSingleQuotedScalar");function xst(e,t){var r,n,s,o,a,c;if(c=e.input.charCodeAt(e.position),c!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;(c=e.input.charCodeAt(e.position))!==0;){if(c===34)return Lm(e,r,e.position,!0),e.position++,!0;if(c===92){if(Lm(e,r,e.position,!0),c=e.input.charCodeAt(++e.position),Hp(c))Cl(e,!1,t);else if(c<256&&Z8e[c])e.result+=e6e[c],e.position++;else if((a=pst(c))>0){for(s=a,o=0;s>0;s--)c=e.input.charCodeAt(++e.position),(a=dst(c))>=0?o=(o<<4)+a:Ns(e,"expected hexadecimal character");e.result+=mst(o),e.position++}else Ns(e,"unknown escape sequence");r=n=e.position}else Hp(c)?(Lm(e,r,n,!0),TW(e,Cl(e,!1,t)),r=n=e.position):e.position===e.lineStart&&ZA(e)?Ns(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}Ns(e,"unexpected end of the stream within a double quoted scalar")}l(xst,"readDoubleQuotedScalar");function _st(e,t){var r=!0,n,s,o,a=e.tag,c,u=e.anchor,f,d,p,h,m,g=Object.create(null),y,v,_,x;if(x=e.input.charCodeAt(e.position),x===91)d=93,m=!1,c=[];else if(x===123)d=125,m=!0,c={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),x=e.input.charCodeAt(++e.position);x!==0;){if(Cl(e,!0,t),x=e.input.charCodeAt(e.position),x===d)return e.position++,e.tag=a,e.anchor=u,e.kind=m?"mapping":"sequence",e.result=c,!0;r?x===44&&Ns(e,"expected the node content, but found ','"):Ns(e,"missed comma between flow collection entries"),v=y=_=null,p=h=!1,x===63&&(f=e.input.charCodeAt(e.position+1),Du(f)&&(p=h=!0,e.position++,Cl(e,!0,t))),n=e.line,s=e.lineStart,o=e.position,dv(e,t,KA,!1,!0),v=e.tag,y=e.result,Cl(e,!0,t),x=e.input.charCodeAt(e.position),(h||e.line===n)&&x===58&&(p=!0,x=e.input.charCodeAt(++e.position),Cl(e,!0,t),dv(e,t,KA,!1,!0),_=e.result),m?fv(e,c,g,v,y,_,n,s,o):p?c.push(fv(e,null,g,v,y,_,n,s,o)):c.push(y),Cl(e,!0,t),x=e.input.charCodeAt(e.position),x===44?(r=!0,x=e.input.charCodeAt(++e.position)):r=!1}Ns(e,"unexpected end of the stream within a flow collection")}l(_st,"readFlowCollection");function bst(e,t){var r,n,s=mW,o=!1,a=!1,c=t,u=0,f=!1,d,p;if(p=e.input.charCodeAt(e.position),p===124)n=!1;else if(p===62)n=!0;else return!1;for(e.kind="scalar",e.result="";p!==0;)if(p=e.input.charCodeAt(++e.position),p===43||p===45)mW===s?s=p===43?P8e:lst:Ns(e,"repeat of a chomping mode identifier");else if((d=hst(p))>=0)d===0?Ns(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?Ns(e,"repeat of an indentation width identifier"):(c=t+d-1,a=!0);else break;if(f3(p)){do p=e.input.charCodeAt(++e.position)
`,o?1+u:u):s===mW&&o&&(e.result+=`
`);break}for(n?f3(p)?(f=!0,e.result+=Nl.repeat(`
`,o?1+u:u)):f?(f=!1,e.result+=Nl.repeat(`
`,u+1)):u===0?o&&(e.result+=" "):e.result+=Nl.repeat(`
`,u):e.result+=Nl.repeat(`
`,o?1+u:u),o=!0,a=!0,u=0,r=e.position;!Hp(p)&&p!==0;)p=e.input.charCodeAt(++e.position);Lm(e,r,e.position,!1)}return!0}l(bst,"readBlockScalar");function L8e(e,t){var r,n=e.tag,s=e.anchor,o=[],a,c=!1,u;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),u=e.input.charCodeAt(e.position);u!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Ns(e,"tab characters must not be used in indentation")),!(u!==45||(a=e.input.charCodeAt(e.position+1),!Du(a))));){if(c=!0,e.position++,Cl(e,!0,-1)&&e.lineIndent<=t){o.push(null),u=e.input.charCodeAt(e.position);continue}if(r=e.line,dv(e,t,X8e,!1,!0),o.push(e.result),Cl(e,!0,-1),u=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&u!==0)Ns(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return c?(e.tag=n,e.anchor=s,e.kind="sequence",e.result=o,!0):!1}l(L8e,"readBlockSequence");function Cst(e,t,r){var n,s,o,a,c,u,f=e.tag,d=e.anchor,p={},h=Object.create(null),m=null,g=null,y=null,v=!1,_=!1,x;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=p),x=e.input.charCodeAt(e.position);x!==0;){if(!v&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Ns(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),o=e.line,(x===63||x===58)&&Du(n))x===63?(v&&(fv(e,p,h,m,g,null,a,c,u),m=g=y=null),_=!0,v=!0,s=!0):v?(v=!1,s=!0):Ns(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,x=n;else{if(a=e.line,c=e.lineStart,u=e.position,!dv(e,r,Y8e,!1,!0))break;if(e.line===o){for(x=e.input.charCodeAt(e.position);f3(x);)x=e.input.charCodeAt(++e.position);if(x===58)x=e.input.charCodeAt(++e.position),Du(x)||Ns(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(fv(e,p,h,m,g,null,a,c,u),m=g=y=null),_=!0,v=!1,s=!1,m=e.tag,g=e.result;else if(_)Ns(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=f,e.anchor=d,!0}else if(_)Ns(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=f,e.anchor=d,!0}if((e.line===o||e.lineIndent>t)&&(v&&(a=e.line,c=e.lineStart,u=e.position),dv(e,t,YA,!0,s)&&(v?g=e.result:y=e.result),v||(fv(e,p,h,m,g,y,a,c,u),m=g=y=null),Cl(e,!0,-1),x=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&x!==0)Ns(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return v&&fv(e,p,h,m,g,null,a,c,u),_&&(e.tag=f,e.anchor=d,e.kind="mapping",e.result=p),_}l(Cst,"readBlockMapping");function Tst(e){var t,r=!1,n=!1,s,o,a;if(a=e.input.charCodeAt(e.position),a!==33)return!1;if(e.tag!==null&&Ns(e,"duplication of a tag property"),a=e.input.charCodeAt(++e.position),a===60?(r=!0,a=e.input.charCodeAt(++e.position)):a===33?(n=!0,s="!!",a=e.input.charCodeAt(++e.position)):s="!",t=e.position,r){do a=e.input.charCodeAt(++e.position);while(a!==0&&a!==62);e.position<e.length?(o=e.input.slice(t,e.position),a=e.input.charCodeAt(++e.position)):Ns(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!Du(a);)a===33&&(n?Ns(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(t-1,e.position+1),Q8e.test(s)||Ns(e,"named tag handle cannot contain such characters"),n=!0,t=e.position+1)),a=e.input.charCodeAt(++e.position);o=e.input.slice(t,e.position),fst.test(o)&&Ns(e,"tag suffix cannot contain flow indicator characters")}o&&!J8e.test(o)&&Ns(e,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch{Ns(e,"tag name is malformed: "+o)}return r?e.tag=o:Mm.call(e.tagMap,s)?e.tag=e.tagMap[s]+o:s==="!"?e.tag="!"+o:s==="!!"?e.tag="tag:yaml.org,2002:"+o:Ns(e,'undeclared tag handle "'+s+'"'),!0}l(Tst,"readTagProperty");function Est(e){var t,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&Ns(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!Du(r)&&!uv(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&Ns(e,"name of an anchor node must contain at least one character"),e.anchor=e.input
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new gst(e,t),n=e.indexOf("\0");for(n!==-1&&(r.position=n,Ns(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)wst(r);return r.documents}l(r6e,"loadDocuments");function Ist(e,t,r){t!==null&&typeof t=="object"&&typeof r>"u"&&(r=t,t=null);var n=r6e(e,r);if(typeof t!="function")return n;for(var s=0,o=n.length;s<o;s+=1)t(n[s])}l(Ist,"loadAll$1");function Ast(e,t){var r=r6e(e,t);if(r.length!==0){if(r.length===1)return r[0];throw new Nu("expected a single document in the stream, but found more")}}l(Ast,"load$1");var Rst=Ist,Pst=Ast,n6e={loadAll:Rst,load:Pst},i6e=Object.prototype.toString,s6e=Object.prototype.hasOwnProperty,EW=65279,Ost=9,w9=10,kst=13,Nst=32,Dst=33,Lst=34,yW=35,Mst=37,Fst=38,Bst=39,qst=42,o6e=44,Ust=45,QA=58,jst=61,Hst=62,$st=63,Vst=64,a6e=91,l6e=93,Gst=96,c6e=123,zst=124,u6e=125,jc={};jc[0]="\\0";jc[7]="\\a";jc[8]="\\b";jc[9]="\\t";jc[10]="\\n";jc[11]="\\v";jc[12]="\\f";jc[13]="\\r";jc[27]="\\e";jc[34]='\\"';jc[92]="\\\\";jc[133]="\\N";jc[160]="\\_";jc[8232]="\\L";jc[8233]="\\P";var Wst=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Kst=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Yst(e,t){var r,n,s,o,a,c,u;if(t===null)return{};for(r={},n=Object.keys(t),s=0,o=n.length;s<o;s+=1)a=n[s],c=String(t[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),u=e.compiledTypeMap.fallback[a],u&&s6e.call(u.styleAliases,c)&&(c=u.styleAliases[c]),r[a]=c;return r}l(Yst,"compileStyleMap");function Xst(e){var t,r,n;if(t=e.toString(16).toUpperCase(),e<=255)r="x",n=2;else if(e<=65535)r="u",n=4;else if(e<=4294967295)r="U",n=8;else throw new Nu("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Nl.repeat("0",n-t.length)+t}l(Xst,"encodeHex");var Qst=1,I9=2;function Jst(e){this.schema=e.schema||K8e,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Nl.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=Yst(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?I9:Qst,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}l(Jst,"State");function M8e(e,t){for(var r=Nl.repeat(" ",t),n=0,s=-1,o="",a,c=e.length;n<c;)s=e.indexOf(`
`,n),s===-1?(a=e.slice(n),n=c):(a=e.slice(n,s+1),n=s+1),a.length&&a!==`
`&&(o+=r),o+=a;return o}l(M8e,"indentString");function vW(e,t){return`
`+Nl.repeat(" ",e.indent*t)}l(vW,"generateNextLine");function Zst(e,t){var r,n,s;for(r=0,n=e.implicitTypes.length;r<n;r+=1)if(s=e.implicitTypes[r],s.resolve(t))return!0;return!1}l(Zst,"testImplicitResolving");function JA(e){return e===Nst||e===Ost}l(JA,"isWhitespace");function A9(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==EW||65536<=e&&e<=1114111}l(A9,"isPrintable");function F8e(e){return A9(e)&&e!==EW&&e!==kst&&e!==w9}l(F8e,"isNsCharOrWhitespace");function B8e(e,t,r){var n=F8e(e),s=n&&!JA(e);return(r?n:n&&e!==o6e&&e!==a6e&&e!==l6e&&e!==c6e&&e!==u6e)&&e!==yW&&!(t===QA&&!s)||F8e(t)&&!JA(t)&&e===yW||t===QA&&s}l(B8e,"isPlainSafe");function eot(e){return A9(e)&&e!==EW&&!JA(e)&&e!==Ust&&e!==$st&&e!==QA&&e!==o6e&&e!==a6e&&e!==l6e&&e!==c6e&&e!==u6e&&e!==yW&&e!==Fst&&e!==qst&&e!==Dst&&e!==zst&&e!==jst&&e!==Hst&&e!==Bst&&e!==Lst&&e!==Mst&&e!==Vst&&e!==Gst}l(eot,"isPlainSafeFirst");function tot(e){return!JA(e)&&e!==QA}l(tot,"isPlainSafeLast");function E9(e,t){var r=e.charCodeAt(t),n;return r>=55296&&r<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}l(E9,"codePointAt");function f6e(e){var t=/^\n* /;return t.test(e)}l(f6e,"needIndentIndicator");var d6e=1,xW=2,p6e=3,h6e=4,cv=5;function rot(e,t,r,n,s,o,a,c){var u,f=0,d=null,p=!1,h=!1,m=n!==-1,g=-1,y=eot(E9(e,0))&&tot(E9(e,e.length-1));if(t||a)for(u=0;u<e.length;f>=65536?u+=2:u++){if(f=E9(e,u),!A9(f))return cv;y=y&&B8e(f,d,c),d=f}else{for(u=0;u<e.length;f>=65536?u+=2:u++){if(f=E9(e,u),f===w9)p=!0,m&&(h=h||u-g-1>n&&e[g+1]!==" ",g=u);else if(!A9(f))return cv;y=y&&B8e(f,d,c),d=f}h=h||m&&u-g-1>n&&e[g+1]!==" "}return!p&&!h?y&&!a&&!s(e)?d6e:o===I9?cv:xW:r>9&&f6e(e)?cv:a?o===I9?cv:xW:h?h6e:p6e}l(rot,"chooseScalarStyle");function not(e,t,r,n,s){e.dump=function(){if(t.length===0)return e.quotingType===I9?'""':"''";if(!e.noCompatMode&&(Wst.indexOf(t)!==-1||Kst.test(t)))return e.quotingType===I9?'"'+t+'"':"'"+t+"'";var o=e.indent*Math.max(1,r),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),c=n||e.flowLevel>-1&&r>=e.flowLevel;function u(f){return Zst(e,f)}switch(l(u,"testAmbiguity"),rot(t,c,e.indent,a,u,e.quotingType,e.forceQuotes&&!n,s)){case d6e:return t;case xW:return"'"+t.replace(/'/g,"''")+"'";case p6e:return"|"+q8e(t,e.indent)+U8e(M8e(t,o));case h6e:return">"+q8e(t,e.indent)+U8e(M8e(iot(t,a),o));case cv:return'"'+sot(t)+'"';default:throw new Nu("impossible error: invalid scalar style")}}()}l(not,"writeScalar");function q8e(e,t){var r=f6e(e)?String(t):"",n=e[e.length-1]===`
`,s=n&&(e[e.length-2]===`
`||e===`
`),o=s?"+":n?"":"-";return r+o+`
`}l(q8e,"blockHeader");function U8e(e){return e[e.length-1]===`
`?e.slice(0,-1):e}l(U8e,"dropEndingNewline");function iot(e,t){for(var r=/(\n+)([^\n]*)/g,n=function(){var f=e.indexOf(`
`);return f=f!==-1?f:e.length,r.lastIndex=f,j8e(e.slice(0,f),t)}(),s=e[0]===`
`||e[0]===" ",o,a;a=r.exec(e);){var c=a[1],u=a[2];o=u[0]===" ",n+=c+(!s&&!o&&u!==""?`
`:"")+j8e(u,t),s=o}return n}l(iot,"foldString");function j8e(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,n,s=0,o,a=0,c=0,u="";n=r.exec(e);)c=n.index,c-s>t&&(o=a>s?a:c,u+=`
`+e.slice(s,o),s=o+1),a=c;return u+=`
`,e.length-s>t&&a>s?u+=e.slice(s,a)+`
`+e.slice(a+1):u+=e.slice(s),u.slice(1)}l(j8e,"foldLine");function sot(e){for(var t="",r=0,n,s=0;s<e.length;r>=65536?s+=2:s++)r=E9(e,s),n=jc[r],!n&&A9(r)?(t+=e[s],r>=65536&&(t+=e[s+1])):t+=n||Xst(r);return t}l(sot,"escapeString");function oot(e,t,r){var n="",s=e.tag,o,a,c;for(o=0,a=r.length;o<a;o+=1)c=r[o],e.replacer&&(c=e.replacer.call(r,String(o),c)),(rh(e,t,c,!1,!1)||typeof c>"u"&&rh(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=s,e.dump="["+n+"]"}l(oot,"writeFlowSequence");function H8e(e,t,r,n){var s="",o=e.tag,a,c,u;for(a=0,c=r.length;a<c;a+=1)u=r[a],e.replacer&&(u=e.replacer.call(r,String(a),u)),(rh(e,t+1,u,!0,!0,!1,!0)||typeof u>"u"&&rh(e,t+1,null,!0,!0,!1,!0))&&((!n||s!=="")&&(s+=vW(e,t)),e.dump&&w9===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=o,e.dump=s||"[]"}l(H8e,"writeBlockSequence");function aot(e,t,r){var n="",s=e.tag,o=Object.keys(r),a,c,u,f,d;for(a=0,c=o.length;a<c;a+=1)d="",n!==""&&(d+=", "),e.condenseFlow&&(d+='"'),u=o[a],f=r[u],e.replacer&&(f=e.replacer.call(r,u,f)),rh(e,t,u,!1,!1)&&(e.dump.length>1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),rh(e,t,f,!1,!1)&&(d+=e.dump,n+=d));e.tag=s,e.dump="{"+n+"}"}l(aot,"writeFlowMapping");function lot(e,t,r,n){var s="",o=e.tag,a=Object.keys(r),c,u,f,d,p,h;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new Nu("sortKeys must be a boolean or a function");for(c=0,u=a.length;c<u;c+=1)h="",(!n||s!=="")&&(h+=vW(e,t)),f=a[c],d=r[f],e.replacer&&(d=e.replacer.call(r,f,d)),rh(e,t+1,f,!0,!0,!0)&&(p=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,p&&(e.dump&&w9===e.dump.charCodeAt(0)?h+="?":h+="? "),h+=e.dump,p&&(h+=vW(e,t)),rh(e,t+1,d,!0,p)&&(e.dump&&w9===e.dump.charCodeAt(0)?h+=":":h+=": ",h+=e.dump,s+=h));e.tag=o,e.dump=s||"{}"}l(lot,"writeBlockMapping");function $8e(e,t,r){var n,s,o,a,c,u;for(s=r?e.explicitTypes:e.implicitTypes,o=0,a=s.length;o<a;o+=1)if(c=s[o],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof t=="object"&&t instanceof c.instanceOf)&&(!c.predicate||c.predicate(t))){if(r?c.multi&&c.representName?e.tag=c.representName(t):e.tag=c.tag:e.tag="?",c.represent){if(u=e.styleMap[c.tag]||c.defaultStyle,i6e.call(c.represent)==="[object Function]")n=c.represent(t,u);else if(s6e.call(c.represent,u))n=c.represent[u](t,u);else throw new Nu("!<"+c.tag+'> tag resolver accepts not "'+u+'" style');e.dump=n}return!0}return!1}l($8e,"detectType");function rh(e,t,r,n,s,o,a){e.tag=null,e.dump=r,$8e(e,r,!1)||$8e(e,r,!0);var c=i6e.call(e.dump),u=n,f;n&&(n=e.flowLevel<0||e.flowLevel>t);var d=c==="[object Object]"||c==="[object Array]",p,h;if(d&&(p=e.duplicates.indexOf(r),h=p!==-1),(e.tag!==null&&e.tag!=="?"||h||e.indent!==2&&t>0)&&(s=!1),h&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(d&&h&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),c==="[object Object]")n&&Object.keys(e.dump).length!==0?(lot(e,t,e.dump,s),h&&(e.dump="&ref_"+p+e.dump)):(aot(e,t,e.dump),h&&(e.dump="&ref_"+p+" "+e.dump));else if(c==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!a&&t>0?H8e(e,t-1,e.dump,s):H8e(e,t,e.dump,s),h&&(e.dump="&ref_"+p+e.dump)):(oot(e,t,e.dump),h&&(e.dump="&ref_"+p+" "+e.dump));else if(c==="[object String]")e.tag!=="?"&&not(e,e.dump,t,o,u);else{if(c==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Nu("unacceptable kind of an object to dump "+c)}e.tag!==null&&e.tag!=="?"&&(f=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?f="!"+f:f.slice(0,18)==="tag:yaml.org,2002:"?f="!!"+f.slice(18):f="!<"+f+">",e.dump=f+" "+e.dump)}return!0}l(rh,"writeNode");function cot(e,t){var r=[],n=[],s,o;for(_W(e,r,n),s=0,o=n.length;s<o;s+=1)t.duplicates.push(r[n[s]]);t.usedDuplicates=new Array(o)}l(cot,"getDuplicateReferences");function _W(e,t,r){var n,s,o;if(e!==null&&typeof e=="object")if(s=t.indexOf(e),s!==-1)r.indexOf(s)===-1&&r.push(s);else if(t.push(e),Array.isArray(e))for(s=0,o=e.length;s<o;s+=1)_W(e[s],t,r);else for(n=Object.keys(e),s=0,o=n.length;s<o;s+=1)_W(e[n[s]],t,r)}l(_W,"inspectNode");function uo
`:""}l(uot,"dump$1");var fot=uot,dot={dump:fot};function SW(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}l(SW,"renamed");var FDt=n6e.load,BDt=n6e.loadAll,wW=dot.dump;var qDt=SW("safeLoad","load"),UDt=SW("safeLoadAll","loadAll"),jDt=SW("safeDump","dump");var ih=Sr(Fd()),H6e=Sr(vl());var IW=(r=>(r.Gpt35turbo="gpt-3.5-turbo",r.Gpt4="gpt-4",r))(IW||{});async function P9(e,t){switch(t){case"gpt-3.5-turbo":return{model:"gpt-3.5-turbo",maxTokens:8192,maxRequestTokens:6144,maxResponseTokens:2048,baseTokensPerMessage:4,baseTokensPerName:-1,baseTokensPerCompletion:3};case"gpt-4":{let{maxTokens:r,maxRequestTokens:n,maxResponseTokens:s}=await pot(e);return{model:"gpt-4",maxTokens:r,maxRequestTokens:n,maxResponseTokens:s,baseTokensPerMessage:3,baseTokensPerName:1,baseTokensPerCompletion:3}}}}l(P9,"getModelConfiguration");async function pot(e){let t={repoNwo:"na",fileType:"na",userKind:"na",dogFood:"na",customModel:"na",retrievalOrg:"na"},r=e.get(zs),n=await r.updateExPValuesAndAssignments(t,Es.createAndMarkAsIssued()),s=r.ideAgentChatGpt4MaxTokens(n),o=r.ideAgentChatGpt4MaxRequestTokens(n);return(s===-1||o===-1)&&([s,o]=await hot(e)),o>=s&&(o=Math.floor(s*.8)),{maxTokens:s,maxRequestTokens:o,maxResponseTokens:s-o}}l(pot,"getGpt4TokenConfig");async function hot(e){var r;return(r=(await e.get(Sa).getCopilotToken(e)).envelope)!=null&&r.copilot_ide_agent_chat_gpt4_small_prompt?[10240,8192]:[16348,10240]}l(hot,"getDefaultValueForGpt4Tokens");var cl=l(e=>P9(e,"gpt-4"),"userQuestionModelConfiguration"),O9=l(e=>P9(e,"gpt-3.5-turbo"),"metaPromptModelConfiguration"),k9=l(async e=>await P9(e,"gpt-3.5-turbo"),"followUpModelConfiguration");var eR=Sr(La());function g6e(e,t){let r=(0,eR.getTokenizer)(eR.TokenizerName.cl100k),n=0;for(let s of e){n+=t.baseTokensPerMessage;for(let[o,a]of Object.entries(s))n+=r.tokenize(a).length,o==="name"&&(n+=t.baseTokensPerName)}return n+=t.baseTokensPerCompletion,n}l(g6e,"countMessagesTokens");function d3(e){return Es.createAndMarkAsIssued({messageId:e})}l(d3,"createTelemetryWithId");function pv(e,t,r,n,s,o,a){let c=e.turns[e.turns.length-1].skills.map(d=>d.skillId).sort(),u={source:"user",turnIndex:(e.turns.length-1).toString(),uiKind:t,skillIds:c.join(",")},f={promptTokenLen:n,messageCharLen:r};return s&&(u.suggestion=s),o&&(u.suggestionId=o),a=a.extendedBy(u,f),a}l(pv,"extendUserMessageTelemetryData");function y6e(e,t,r,n,s,o){return n!=null&&(o=o.extendedBy({offTopic:n.toString()})),rR(e,s,t,r,{uiKind:t},{},o).properties.messageId}l(y6e,"createUserMessageTelemetryData");function v6e(e,t,r,n,s,o,a){let c=yot(n);return rR(e,o,r,n,{source:"model",turnIndex:t.turns.length.toString(),headerRequestId:s,uiKind:r,codeBlockLanguages:JSON.stringify({...c})},{messageCharLen:n.length,numCodeBlocks:c.length},a).properties.messageId}l(v6e,"createModelMessageTelemetryData");function x6e(e,t,r,n,s,o,a){return rR(e,o,r,n,{source:"offTopic",turnIndex:t.turns.length.toString(),userMessageId:s,uiKind:r},{messageCharLen:n.length},a).properties.messageId}l(x6e,"createOffTopicMessageTelemetryData");function tR(e,t,r,n,s,o,a,c,u){let f=rR(e,c,r,n,{source:"suggestion",suggestion:o,turnIndex:(t.turns.length-1).toString(),uiKind:r,suggestionId:a},{promptTokenLen:s,messageCharLen:n.length},u);return mot(e,r,o,f.properties.messageId,a,c),f.properties.messageId}l(tR,"createSuggestionMessageTelemetryData");function rR(e,t,r,n,s,o,a){let c=a!=null?a:Es.createAndMarkAsIssued(),u={messageText:n,...s};if(!("messageId"in s)&&!("messageId"in c.properties)){let h=Ma();s.messageId=h,u.messageId=h}t&&(s.languageId=t.languageId,o.documentLength=t.getText().length);let f=c.extendedBy(s,o),d=c.extendedBy(u),p=got(r);return mn(e,`${p}.message`,f),mn(e,`${p}.messageText`,d,1),f}l(rR,"telemetryMessage");function _6e(e,t,r,n,s,o){return $p(e,o,{suggestion:r,messageId:n,suggestionId:s,uiKind:t},{},"conversation.suggestionShown")}l(_6e,"createSuggestionShownTelemetryData");function mot(e,t,r,n,s,o){return $p(e,o,{suggestion:r,messageId:n,suggestionId:s,uiKind:t}
`),r=[],n=[];for(let s=0;s<t.length;s++){let o=t[s];o.startsWith("```")&&(n.length>0&&o==="```"?r.push(n.pop()):n.length===0&&n.push(o.substring(3)))}return r}l(yot,"getCodeBlocks");var N9=(s=>(s.System="system",s.User="user",s.Assistant="assistant",s.Function="function",s))(N9||{});function b6e(e,t,r,n,s,o,a,c,u,f){return nR(e,[t],c),{message:t,choiceIndex:n,requestId:s,modelInfo:u,blockFinished:o,finishReason:a,tokens:r.tokens,numTokens:r.tokens.length,telemetryData:c,annotations:f}}l(b6e,"convertToChatCompletion");var E6e=Sr(La()),S6e=Sr(Fd());var RW=Sr(La());var AW=Sr(La());function Fm(e,t){if(e.length==0)return new AW.ElidableText([]);let r=e.map((n,s)=>{let o;switch(t){case"linear":o=1-s/e.length;break;case"inverseLinear":o=(s+1)/e.length;break;case"positional":o=1/(s+1);break;case"inversePositional":o=1/(e.length-s);break;default:throw new Error("Unknown weight strategy: "+t)}return Array.isArray(n)&&n.length==2&&(o*=n[1],n=n[0]),[n,o]});return new AW.ElidableText(r)}l(Fm,"weighElidableList");var nh=Sr(La());function C6e(e){let t=e.split(`
`),r=[],n=!1,s=[];for(let o of t)o.startsWith("```")?(n?(r.push([(0,nh.elidableTextForSourceCode)(s.join(`
`)),1]),s=[],r.push([new nh.ElidableText([o]),1])):r.push([new nh.ElidableText([o]),1]),n=!n):n?s.push(o):r.push([new nh.ElidableText([o]),.8]);return n&&(r.push([(0,nh.elidableTextForSourceCode)(s.join(`
`)),1]),r.push([new nh.ElidableText(["```"]),1])),new nh.ElidableText(r)}l(C6e,"fromMessage");function hv(e){var n;let t=_ot(e),r=[];for(let s=0;s<t.length;s++){let o=t[s],a=T6e(o.request),c=o.response&&((n=o.response)==null?void 0:n.type)!=="meta"?T6e(o.response):"",u=a;c!==""&&(u+=`
`+c+(t.length>1&&s!==t.length-1?`
`:"")),r.push(C6e(u))}return r.length>0?new RW.ElidableText([[new RW.ElidableText(["Consider the following conversation history:"]),1],[Fm(r,"inverseLinear"),1]]):null}l(hv,"fromHistory");var vot=5,xot=2*60*60*1e3;function _ot(e){let t=Date.now()-xot;return e.filter(n=>(n.status==="success"||n.status==="in-progress")&&n.request.message!="").filter(n=>n.timestamp>=t).reverse().slice(0,vot).reverse()}l(_ot,"filterTurns");function T6e(e){let t;switch(e.type){case"user":case"template":t="User";break;case"model":t="GitHub Copilot";break;default:t=e.type}let r=e.message.startsWith("```")?`
`:" ";return`${t}:${r}${e.message}`}l(T6e,"formatTurnMessage");var OW=class OW{constructor(){this.promptType="followup";this.modelConfiguration=l(async t=>await k9(t),"modelConfiguration")}async suffix(){return S6e.default`
Write a short one-sentence question that the user can ask as a follow up to continue the current conversation.
The question must be phrased as a question asked by the user, not by Copilot.
The question must be relevant to the conversation context.
The question must not be offensive or inappropriate.
The question must not appear in the conversation history.
Reply with only the text of the question and nothing else.`.trim()}async elidablePrompt(t){let r=hv(t.turns.slice()),n=[];return r!==null&&n.push([r,.6]),[new E6e.ElidableText(n),[]]}};l(OW,"FollowUpPromptStrategy");var iR=OW;var M6e=Sr(Fd());var D6e=Sr(La()),L6e=Sr(Fd());var mR=Sr(La());var Ba=new Fs(0,"Copilot Chat");var DW=class DW{constructor(t,r,n,s){this.ctx=t;this.conversation=r;this.turn=n;this.cancelationToken=s;this.collector=new NW;this.skillResolver=new kW(this)}collectFile(t,r,n){this.collector.collectibles.push({type:"file",skillId:t,uri:r,status:n})}collectLabel(t,r){this.collector.collectibles.push({type:"label",skillId:t,label:r})}isFileIncluded(t){return this.collector.collectibles.some(r=>r.type==="file"&&r.status==="included"&&r.uri===t)}};l(DW,"TurnContext");var Vp=DW,LW=class LW extends Error{constructor(r,n){super(`Cycle detected while resolving skills: ${n.join(" -> ")} -> ${r}`);this.skillId=r;this.skillStack=n}};l(LW,"CycleError");var sR=LW,MW=class MW{constructor(t){this.turnContext=t;this.resolveStack=[]}async resolve(t){if(this.turnContext.ctx.get(S0).getSupportedSkills(this.turnContext.conversation.id).includes(t)){this.ensureNoCycle(t);let n=this.turnContext.ctx.get(Bd).getResolvedSkill(this.turnContext.turn.id,t);if(n)return this.resolveStack.pop(),n;let s=await this.newlyResolve(t);return this.resolveStack.pop(),s}}ensureNoCycle(t){if(this.resolveStack.includes(t))throw new sR(t,this.resolveStack);this.resolveStack.push(t)}async newlyResolve(t){let n=this.turnContext.ctx.get(kl).getSkill(t);try{let s=await(n==null?void 0:n.resolver(this.turnContext).resolveSkill(this.turnContext));if(s)return this.turnContext.ctx.get(Bd).addResolvedSkill(this.turnContext.turn.id,t,s),s}catch(s){if(s instanceof sR)throw s;Ba.exception(this.turnContext.ctx,s,`Error while resolving skill ${t}`)}}};l(MW,"SkillResolver");var kW=MW;function mc(e){switch(e.status){case"valid":return"included";case"invalid":return"blocked";case"notfound":return"notfound"}}l(mc,"statusFromTextDocumentResult");var FW=class FW{constructor(){this.collectibles=[]}collect(t){this.collectibles.push(t)}collectiblesForSkill(t){return this.collectibles.filter(r=>r.skillId===t)}};l(FW,"Collector");var NW=FW;var I6e=Sr(require("util"));var BW=new Fs(1,"streamMessages");function w6e(e,t,r){var c;let n=t.solution.text.join(""),s=!1;t.finishOffset!==void 0&&(BW.debug(e,`message ${t.index}: early finish at offset ${t.finishOffset}`),n=n.substring(0,t.finishOffset),s=!0),BW.info(e,`message ${t.index} returned. finish reason: [${t.reason}]`),BW.debug(e,`message ${t.index} details: finishOffset: [${t.finishOffset}] completionId: [{${t.requestId.completionId}}] created: [{${t.requestId.created}}]`);let o=HV(e,t.solution),a={role:"assistant",content:n};return b6e(e,a,o,t.index,t.requestId,s,(c=t.reason)!=null?c:"",r,void 0,bot(t.solution.annotations))}l(w6e,"prepareChatCompletionForReturn");function bot(e){let t=[],r=e.for("CodeVulnerability").map(n=>({...n,type:"code_vulnerability"}));return t.push(...r),t}l(bot,"mapAnnotations");var qW=new Fs(1,"chat fetch");var UW=class UW{async fetchAndStreamChat(t,r,n,s,o,a){let c=t.get(Ja),u="completions",f=await this.fetchWithParameters(t,u,r,o,a);if(f==="not-sent")return{type:"canceled",reason:"before fetch request"};if(o!=null&&o.isCancellationRequested){let y=await f.body();try{y.destroy()}catch(v){n0.exception(t,v,"Error destroying stream")}return{type:"canceled",reason:"after fetch request"}}if(f===void 0){let y=this.createTelemetryData(u,t,r);return c.setWarning(),y.properties.error="Response was undefined",mn(t,"request.shownWarning",y),{type:"failed",reason:"fetch response was undefined",code:-1}}if(f.status!==200){let y=this.createTelemetryData(u,t,r);return this.handleError(t,c,y,f)}let d=await t.get(zs).getFallbackExpAndFilters(),p=new j1(n.properties,n.measurements,n.issuedTime,d),m=(await Dy.create(t,r.count,f,p,[],o)).processSSE(s);return{type:"success",chatCompletions:Yw(m,async y=>w6e(t,y,n)),getProcessingTime:()=>WV(f)}}createTelemetryData(t,r,n){return Es.createAndMarkAsIssued({e
Use the above information, including the additional context and conversation history (if available) to answer the user's question below.
Prioritize the context given in the user's question.
When generating code, think step-by-step - describe your plan for what to build in pseudocode, written out in great detail. Then output the code in a single code block. Minimize any other prose.
When generating classes, use a separate code block for each class.
Keep your answers short and impersonal.
Use Markdown formatting in your answers.
You must enclose file names and paths in single backticks. Never use single or double quotes for file names or paths.
Make sure to include the programming language name at the start of every code block.
Avoid wrapping the whole response in triple backticks.
Only use triple backticks codeblocks for code.
Do not repeat the user's code excerpt when answering.
Do not prefix your answer with "GitHub Copilot".
Do not start your answer with a programming language name.
Dot not include follow up questions or suggestions for next turns.
User question:
${t}`.trim()}};l(rK,"UserPromptStrategy");var Wp=rK;var nK=class nK extends Wp{constructor(){super(...arguments);this.promptType="inline-fallback";this.modelConfiguration=cl}async suffix(r){return M6e.default`
Use the above information, including the additional context and conversation history (if available) to answer the user's question below.
Prioritize the context given in the user's question.
Keep your answers short and impersonal.
Use Markdown formatting in your answers.
You must enclose file names and paths in single backticks. Never use single or double quotes for file names or paths.
Make sure to include the programming language name at the start of every code block.
Only use triple backticks codeblocks for code.
Do not repeat the user's code excerpt when answering.
Do not prefix your answer with "GitHub Copilot".
Do not start your answer with a programming language name.
Dot not include follow up questions or suggestions for next turns.
The user is editing an open file in their editor, and is using Copilot in inline mode to get help with their code.
The user is asking a question about this code, which also includes a code selection.
The question may involve generating or modifying code.
Code generation/additions/modification instructions:
- Briefly explain the changes the user will need to make in words.
- Generate two codeblocks for each change the user needs to make:
- The first codeblocks shows the user the original code they need to change. Prefix this codeblock with a "<!-- original -->" comment
- The second codeblock shows the user the modified code they need to change it to. Prefix this codeblock with a "<!-- modified -->" comment
- The user must be able to apply the second codeblock by directly replacing the first codeblock.
- The original codeblock must not change the user's code in any way.
- You must not add code to the original codeblock that is not in the user's code.
- The modified codeblock must be valid code in the language specified.
- You must not omit any text.
- Here's an example of what the codeblocks should look like:
Here's the original code:
<!-- original -->
\`\`\`language
original code
\`\`\`
Here's the modified code:
<!-- modified -->
\`\`\`language
modified code
\`\`\`
- Ensure the comments are placed before the codeblocks.
User question:
${r}`.trim()}};l(nK,"InlineFallbackPromptStrategy");var gR=nK;var F6e=Sr(Fd());var iK=class iK extends Wp{constructor(){super(...arguments);this.promptType="inline-file";this.modelConfiguration=cl}async suffix(r){return F6e.default`
Use the above information, including the additional context and conversation history (if available) to answer the user's question below.
Prioritize the context given in the user's question.
Keep your answers short and impersonal.
Use Markdown formatting in your answers.
You must enclose file names and paths in single backticks. Never use single or double quotes for file names or paths.
Make sure to include the programming language name at the start of every code block.
Only use triple backticks codeblocks for code.
Do not repeat the user's code excerpt when answering.
Do not prefix your answer with "GitHub Copilot".
Do not start your answer with a programming language name.
Dot not include follow up questions or suggestions for next turns.
The user is editing an open file in their editor, and is using Copilot in inline mode to get help with their code.
The user is asking a question about this code, which also includes a code selection.
The question may involve generating or modifying code.
Code generation/additions/modification instructions:
- Briefly explain the changes the user will need to make.
- Add untagged codeblocks previewing the changes the user will need to make.
- Generate a final codeblock that the user can copy and replace the entire contents of the file.
- The user must be able to apply the codeblock to their code without any modifications by directly replacing the content of the open file.
- The codeblock must be valid code in the language specified.
- You must not omit any text from the file.
- Prefix this codeblock with a "<!-- file -->" comment:
Here's the final version of the code:
<!-- file -->
\`\`\`language
code
\`\`\`
- Ensure the comment is placed before the codeblock.
User question:
${r}`.trim()}};l(iK,"InlineFilePromptStrategy");var yR=iK;var B6e=Sr(Fd());var sK=class sK extends Wp{constructor(){super(...arguments);this.promptType="inline-selection";this.modelConfiguration=cl}async suffix(r){return B6e.default`
Use the above information, including the additional context and conversation history (if available) to answer the user's question below.
Prioritize the context given in the user's question.
Keep your answers short and impersonal.
Use Markdown formatting in your answers.
You must enclose file names and paths in single backticks. Never use single or double quotes for file names or paths.
Make sure to include the programming language name at the start of every code block.
Only use triple backticks codeblocks for code.
Do not repeat the user's code excerpt when answering.
Do not prefix your answer with "GitHub Copilot".
Do not start your answer with a programming language name.
Dot not include follow up questions or suggestions for next turns.
The user is editing an open file in their editor, and is using Copilot in inline mode to get help with their code.
The user is asking a question about this code, which also includes a code selection.
The question may involve generating or modifying code.
Code generation/additions/modification instructions:
- Briefly explain the changes the user will need to make.
- Generate a single codeblock that the user can insert at the location of their selection.
- The user must be able to apply the codeblock to their code without any modifications by directly replacing the selection.
- The codeblock must be valid code in the language specified. You must not omit any text.
- You must not omit any text from the file.
- Prefix this codeblock with a "<!-- selection -->" comment:
Here's how to update the current selection:
<!-- selection -->
\`\`\`language
code
\`\`\`
- Ensure the comment is placed before the codeblock.
User question:
${r}`.trim()}};l(sK,"InlineSelectionPromptStrategy");var vR=sK;var q6e=Sr(La()),U6e=Sr(Fd());var oK=class oK{constructor(){this.promptType="meta";this.modelConfiguration=l(async t=>await O9(t),"modelConfiguration")}async elidablePrompt(t,r){let n=hv(t.turns.slice(0,-1)),s=[];return n!==null&&s.push([n,.6]),[new q6e.ElidableText(s),[]]}async suffix(t,r){if(!r.supportedSkillDescriptors)throw new Error("Supported skills must be provided for meta prompts");return this.buildMetaPrompt(t,r.supportedSkillDescriptors)}buildMetaPrompt(t,r){let n=[...r].slice(0,4).map(s=>s.encoding).join(",");return U6e.default`
Your task is to determine which context would be most relevant for you to answer the users question.
Provide your answer in order of highest to lowest priority as a comma-separated list of context ids without extra information.
You must not come up with new context ids.
If none of the context is relevant, respond "None". End the list with a ;
List of available context:
${r.map(s=>`Context Id: ${s.encoding}
Context Description: ${s.description?s.description():s.id}
`).join(`
`)}
Example Response:
${n};
Now list the best (with a maximum of four) context ids for the user's question:
${t}`.trim()}};l(oK,"MetaPromptStrategy");var xR=oK;var aK=class aK{createPromptStrategy(t,r){let n;switch(r){case"user":return new Wp(t);case"meta":return new xR;case"followup":return new iR;case"inline-file":return new yR(t);case"inline-selection":return new vR(t);case"inline-fallback":return new gR(t);default:throw n=r,new Error(`Unknown prompt type ${n}`)}}};l(aK,"DefaultPromptStrategyFactory");var _R=aK;function j6e(e,t,r){return t===null?`${e}
${r}`:`${e}
${t}
${r}`}l(j6e,"makePrompt");function Rot(e){let t=e.trimStart();return t=t.replace(/^\[\.\.\.\]\n?/,""),t===""?null:t}l(Rot,"processResultOfElidableText");var lK=class lK{constructor(t,r=new _R){this.ctx=t;this.promptStrategyFactory=r}async toPrompt(t,r,n,s="user"){let o=t.primer,a=t.getLastTurn().request.message,c=this.promptStrategyFactory.createPromptStrategy(this.ctx,s),u=await c.modelConfiguration(this.ctx),[f,d]=await c.elidablePrompt(t,a,n),p=await c.suffix(a,r,n),h=j6e(o,"",p),m=this.toConversationPrompt(h,d,u).tokens,g=Rot(f.makePrompt(r.maxTokens-m)),y=j6e(o,g,p);return this.toConversationPrompt(y,d,u)}toConversationPrompt(t,r,n){let s=[{role:"user",content:t}];return{messages:s,tokens:g6e(s,n),skillResolutions:r}}};l(lK,"ConversationPromptEngine");var Hc=lK;var dK=class dK{constructor(){this.resolvedSkills={};this.resolutions=[]}};l(dK,"SkillDump");var cK=dK,pK=class pK{constructor(){this.dump=new za(25)}addResolvedSkill(t,r,n){let s=this.getDump(t);s.resolvedSkills[r]=n}getResolvedSkill(t,r){return this.getDump(t).resolvedSkills[r]}addResolution(t,r){this.getDump(t).resolutions.push(r)}getDump(t){let r=this.dump.get(t);return r||(r=new cK,this.dump.set(t,r)),r}};l(pK,"ConversationSkillDumper");var Bd=pK;function uK(e){let t=e.copy();return t.turns=t.turns.filter(r=>{var n;return r.status!=="in-progress"&&(r.response===void 0||((n=r.response)==null?void 0:n.type)==="model")}),t}l(uK,"filterConversationTurns");function fK(e){var r;return(r=uK(e).getLastTurn())==null?void 0:r.id}l(fK,"getLastTurnId");async function $6e(e,t,r){let n=uK(t),s=fK(t);if(!s)return"Nothing to dump because no request has been sent to the model yet.";let a=e.get(Bd).getDump(s),c=kot(a,n.turns);n0.debug(e,`conversation.dump
`,`
`+c);let u=await Not(a,e);return ih.default`
${Oot(t,s)}
${Pot(e)}
The following code can be copied into a chat simulation \`yml\` file. This response has not polluted the conversation history and did not cause any model roundtrip.
\`\`\`yaml
${c}
\`\`\`${u?`
${u}`:""}
`}l($6e,"getConversationDump");function Pot(e){let t=e.get(oa);return ih.default`
- IDE: \`${t.getEditorInfo().name} (${t.getEditorInfo().version})\`
- Plugin: \`${t.getEditorPluginInfo().version}\`
`}l(Pot,"getEditorInfoDumpMessage");function Oot(e,t){return ih.default`
Debug information for the last turn of the conversation.
- ConversationId: \`${e.id}\`
- MessageId: \`${t}\`
`}l(Oot,"getInfoDumpMessage");async function V6e(e,t,r,n){let s=e.get(S0).getSupportedSkills(t.id);for(let c of s)zp.includes(c)||r.skills.push({skillId:c});for(let c of zp)r.skills.push({skillId:c});let o={maxTokens:(await cl(e)).maxRequestTokens},a=await e.get(Hc).toPrompt(t,o,n);if(a.messages.length>0)return ih.default`
The prompt is:
\`\`\`\`
${a.messages[0].content}
\`\`\`\`
`}l(V6e,"getCurrentPrompt");async function G6e(e,t,r,n){let s=uK(t);if(s.turns.length===0)return;let o={maxTokens:(await cl(e)).maxRequestTokens},a=await e.get(Hc).toPrompt(s,o,n);if(a.messages.length>0)return ih.default`
The prompt that generated the last response is:
\`\`\`\`
${a.messages[0].content}
\`\`\`\`
`}l(G6e,"getLastPrompt");async function z6e(e,t,r,n,s){let o=e.get(kl),a="## Available skills",c=o.getDescriptors().filter(u=>e.get(S0).getSupportedSkills(t.id).includes(u.id));if(s&&(c=c.filter(u=>u.id===s),c.length===0))return`No skill with id ${s} available`;for(let u of c){a+=`
---
`,a+=`### ${u.id}`,a+=ih.default`
\n\n
**Description**
${u.description()}`;let f=o.getSkill(u.id),d=new Vp(e,t,r,n),p=await(f==null?void 0:f.resolver(d).resolveSkill(d));if(p){a+=ih.default`
\n\n
**Resolution**
\`\`\`yaml
${wW(p)}
\`\`\``;let h=await(f==null?void 0:f.processor(d).processSkill(p));if(h){let m=typeof h=="string"?h:h.makePrompt(1e3);a+=ih.default`
\n\n
**Processed value**
${m}`}else a+=`
**Unprocessable**`}else a+=`
**Unresolvable**`}return a}l(z6e,"getSkillsDump");function kot(e,t){let r={state:{skills:e.resolvedSkills},turns:t.map((n,s)=>{let o={request:n.request.message};return n.response&&(o.response=n.response.message),o})};return wW(r)}l(kot,"toSimulationFormat");async function Not(e,t){let r=e.resolutions.map(o=>o.files).flat(),n=r.filter((o,a)=>o&&r.indexOf(o)===a),s;for(let o of n)if(o&&o.status==="included"){s||(s=`The following files have been used:
`);let a=await t.get(Go).getTextDocument(H6e.URI.parse(o.uri)),c=a==null?void 0:a.getText();n0.debug(t,`conversation.dump.file
`,c),s+=`
**${o.uri}**
\`\`\`${a==null?void 0:a.languageId}
${c}
\`\`\``}return s}l(Not,"fileDump");var W6e=Sr(Wi());var K6e=W6e.Type.String(),mK=class mK{constructor(t){this.turnContext=t}value(){return .9}async processSkill(t){return this.turnContext.collectLabel(CR,"build logs"),`The contents of the application build logs:
\`\`\`
${t}
\`\`\``}};l(mK,"BuildLogsSkillProcessor");var hK=mK,CR="build-logs",gK=class gK{constructor(t,r){this._resolver=t;this.encoding=r;this.id=CR;this.type="explicit"}description(){return"The application build logs, which can be used to fix build or compilation errors."}resolver(){return this._resolver}processor(t){return new hK(t)}};l(gK,"BuildLogsSkill");var bR=gK;var jm=Sr(La()),af=Sr(Wi());var Y6e=af.Type.Object({head:af.Type.Optional(af.Type.Object({name:af.Type.String(),upstream:af.Type.Optional(af.Type.Object({remote:af.Type.String(),name:af.Type.String()}))})),isRebasing:af.Type.Boolean(),remotes:af.Type.Optional(af.Type.Array(af.Type.String()))}),vK=class vK{constructor(t){this.turnContext=t}value(){return .8}async processSkill(t){var n;this.turnContext.collectLabel(ER,"git repository information");let r=[];return r.push([new jm.ElidableText(["Metadata about the current git repository:"]),1]),t.head&&t.head.name?(r.push([new jm.ElidableText([`- Current Branch name: ${t.head.name}`]),1]),t.head.upstream&&r.push([new jm.ElidableText([`- Upstream: ${t.head.upstream.remote+"/"+t.head.upstream.name}`]),1])):r.push([new jm.ElidableText(["- Detached HEAD: yes"]),1]),r.push([new jm.ElidableText([`- Is currently rebasing? ${t.isRebasing?"yes":"no"}`]),1]),t.remotes&&t.remotes.length>0&&r.push([new jm.ElidableText([`- Remotes: ${((n=t.remotes)!=null?n:[]).join(", ")}`]),1]),new jm.ElidableText(r)}};l(vK,"GitMetadataSkillProcessor");var yK=vK,ER="git-metadata",xK=class xK{constructor(t,r){this._resolver=t;this.encoding=r;this.id=ER;this.type="explicit"}description(){return"Metadata about the current git repository, useful for questions about branch management and git related commands"}resolver(){return this._resolver}processor(t){return new yK(t)}};l(xK,"GitMetadataSkill");var TR=xK;var Hm=Sr(La()),vv=Sr(Wi());var X6e=vv.Type.Object({uri:vv.Type.String(),problems:vv.Type.Array(vv.Type.Object({message:vv.Type.String(),range:Bm}))}),bK=class bK{constructor(t){this.turnContext=t}value(){return 1}async processSkill(t){let r=this.turnContext.ctx.get(el),n=await r.readFile(t.uri);if(this.turnContext.collectFile($m,t.uri,mc(n)),n.status==="valid"){let s=await r.getRelativePath(n.document);this.turnContext.collectLabel($m,`problems in ${s}`);let o=this.getElidableProblems(t,n,s);return await this.preElideDocuments(o)}else this.turnContext.collectLabel($m,"problem markers")}getElidableProblems(t,r,n){let s=[];return s.push(new Hm.ElidableText([`Problems and errors in the active document (\`${n}\`):`])),s.push(...this.createElidableProblems(t,r)),Fm(s,"linear")}createElidableProblems(t,r){return t.problems.map(n=>{let s=[];s.push(new Hm.ElidableText([`- "${n.message}" at line ${n.range.start.line}.`+(r.document?" Excerpt from the code:":"")]));let o=n.range,a;if(o&&(this.isEmpty(o)?a=r.document.lineAt(o.start).text:a=r.document.getText(o),a)){let c=r.document.languageId;s.push(new Hm.ElidableText([["```"+c,1],[(0,Hm.elidableTextForSourceCode)(a),.8],["```",1]]))}return new Hm.ElidableText(s)})}isEmpty(t){return t.start.line===t.end.line&&t.start.character===t.end.character}async preElideDocuments(t){let r=(await cl(this.turnContext.ctx)).maxRequestTokens,n=t.makePrompt(Math.floor(r*.1));return new Hm.ElidableText([n])}};l(bK,"ProblemsInActiveDocumentSkillProcessor");var _K=bK,$m="problems-in-active-document",CK=class CK{constructor(t,r){this._resolver=t;this.encoding=r;this.id=$m;this.type="explicit"}description(){return"List of problems and errors in the active document"}resolver(){return this._resolver}processor(t){return new _K(t)}};l(CK,"ProblemsInActiveDocumentSkill");var SR=CK;var Q6e=Sr(La()),xv=Sr(Wi());var Dot=xv.Type.Object({uri:xv.Type.String(),sections:xv.Type.Array(Bm)}),mBt=xv.Type.Object({snippets:xv.Type.Array(Dot)}),SK=class SK{constructor(){}value(){return 1}async processSkill(t){return new Q6e.ElidableText(["TODO"])}};l(SK,"ProjectContextSkillProcessor");var TK=SK,wK=class wK{constructor(){}async resolveSkill(){}};l(wK,"ProjectContextSkillResolver");var EK=wK,Lot="project-context",IK=class IK{constructor(t){this.encod
\`\`\`
${t}
\`\`\``}};l(DK,"RuntimeLogsSkillProcessor");var NK=DK,PR="runtime-logs",LK=class LK{constructor(t,r){this._resolver=t;this.encoding=r;this.id=PR;this.type="explicit"}description(){return"The application runtime or debug logs, which are used to view output logs from the console. This is useful for debugging and troubleshooting runtime issues."}resolver(){return this._resolver}processor(t){return new NK(t)}};l(LK,"RuntimeLogsSkill");var RR=LK;var p3=Sr(Wi()),jK=Sr(vl());var qd=Sr(La());var txe=Sr(require("fs")),gc=require("path"),Vm=Sr(vl());var M9=require("path"),MK=[".test",".spec","_test","Test","_spec","_test","Tests",".Tests","Spec"],FK="test_",F9={js:{suffix:[".test",".spec"],location:"sameFolder"},ts:{suffix:[".test",".spec"],location:"sameFolder"},go:{suffix:["_test"],location:"sameFolder"},java:{suffix:["Test"],location:"testFolder"},php:{suffix:["Test"],location:"testFolder"},dart:{suffix:["_test"],location:"testFolder"},cs:{suffix:["Test"],location:"testFolder"},rb:{suffix:["_test","_spec"],location:"testFolder"},py:{prefix:"test_",location:"testFolder"},ps1:{suffix:[".Tests"],location:"testFolder"}},qK=class qK{constructor(t,r=void 0){this.fileExists=t;this.basePath=r}async findTestFileForSourceFile(t){var f,d,p;let r=t.fsPath,n=(0,gc.basename)(r),s=(0,gc.extname)(r).replace(".",""),o=(f=F9[s])!=null?f:{location:"sameFolder",prefix:FK,suffix:MK},a=[];if(o.prefix&&a.push(o.prefix+n),o.suffix)for(let h of(d=o.suffix)!=null?d:[]){let m=n.replace(`.${s}`,h+"."+s);a.push(m)}let c=(p=o.location)!=null?p:"sameFolder",u;c==="sameFolder"?u=(0,gc.dirname)(r):u=this.determineTestFolder(r,c);for(let h of a){let m=M9.join(u,h);if(await this.fileExists(Vm.URI.parse(m)))return Vm.URI.file(m)}if(await this.fileExists(Vm.URI.file(u))){let h=M9.join(u,a[0]);return Vm.URI.file(h)}}async findImplFileForTestFile(t){var f,d,p;let r=t.fsPath,n=(0,gc.basename)(r),s=(0,gc.extname)(r).replace(".",""),o=(f=F9[s])!=null?f:{location:"sameFolder",prefix:FK,suffix:MK},a=[];if(o.prefix&&a.push(n.substring(o.prefix.length)),o.suffix)for(let h of(d=o.suffix)!=null?d:[]){let g=n.substring(0,n.length-h.length-1-s.length)+"."+s;a.push(g)}let c=(p=o.location)!=null?p:"sameFolder",u="";c==="sameFolder"?u=(0,gc.dirname)(r):u+=this.determineImplFolder(r);for(let h of a){let m=M9.join(u,h);if(await this.fileExists(Vm.URI.parse(m)))return Vm.URI.file(m)}}findExampleTestFile(t){var c,u;let r=t.fsPath,n=(0,gc.extname)(r).replace(".",""),s,o=(u=(c=F9[n])==null?void 0:c.location)!=null?u:"sameFolder";o==="sameFolder"?s=(0,gc.dirname)(r):s=this.determineTestFolder(r,o);let a=this.findFiles(s,`.${n}`,F9[n]);if(a.length>0)return Vm.URI.file(a[0])}findFiles(t,r,n){let s=this._readdir(t),o=[];for(let a of s){let c=`${t}${M9.sep}${a}`;n!=null&&n.prefix&&a.startsWith(n.prefix)&&o.push(c),n!=null&&n.suffix&&(n!=null&&n.suffix.some(u=>a.endsWith(u+r)))&&o.push(c)}return o}_readdir(t){return txe.readdirSync(t,{withFileTypes:!0}).filter(r=>r.isFile()).map(r=>r.name)}determineTestFolder(t,r){var a,c;let n=(c=(a=this.basePath)==null?void 0:a.fsPath)!=null?c:"",s=(0,gc.extname)(t).replace(".",""),o=this.getRelativeTestFolder(t,n,s,r);return[n,...o].join(M9.sep)}getRelativeTestFolder(t,r,n,s){let o=(0,gc.dirname)(t).replace(r,"");switch(n){case"php":case"dart":case"py":return["tests"];case"ps1":return["Tests"];case"rb":return["test",o];case"cs":return[o.replace("src","src/tests")];case"java":case"scala":case"kt":return[o.replace("src/main","src/test")];default:return s==="testFolder"?[o.replace("src","test")]:[o]}}determineImplFolder(t){let r=(0,gc.extname)(t).replace(".",""),n=(0,gc.dirname)(t);switch(r){case"php":case"dart":case"py":return n.replace("tests","src");case"ps1":return n.replace("Tests","src");case"rb":return n.replace("test","");case"cs":return n.replace("src/tests","src");case"java":case"scala":case"kt":return n.replace("src/test","src/main");default:return n.replace("test/","src/")}}};l(qK,"TestFileFinder");var B9=qK;async function BK(e){let t=e.fsPath,r=(0,gc.basename)(t),n=(0,gc.extname)(t),s=F9[n.replace(".","")];return s?!(s.suffix&&!s.suffix.some(a=
`)?u+="\n```\n"+s.failureReason+"\n```\n":u+=` \`${s.failureReason}\`. `);let f=`${s.testLocation.start.line==s.testLocation.end.line?"on line "+s.testLocation.start.line:"between lines "+s.testLocation.start.line+" and "+s.testLocation.end.line}`;return[new jd.ElidableText([nxe.default`\n\n- Test ${o}${a}${c}failed${u}The failed test is ${f}.\n`]),1]});return new jd.ElidableText(n)}appendCode(t,r,n){let s=[new jd.ElidableText([`
The code of file \`${r}\` is:
`]),.6],o=[new jd.ElidableText([["```"+n.languageId,1],[(0,jd.elidableTextForSourceCode)(n.getText()),.9],["```",1]]),.7];return new jd.ElidableText([[t,1],s,o])}};l(zK,"TestFailuresSkillProcessor");var GK=zK,h3="test-failures",WK=class WK{constructor(t,r){this._resolver=t;this.encoding=r;this.id=h3;this.type="explicit"}description(){return"Test failures and errors of the latest test run"}resolver(){return this._resolver}processor(t){return new GK(t)}};l(WK,"TestFailuresSkill");var NR=WK;var x_e=Sr(Jm());var cJ=require("fs"),v_e=require("stream"),eg=Sr(Zm());var h_e=Sr(require("events")),m_e=Sr(require("fs")),g_e=Sr(require("http")),Fv=Sr(require("path")),y_e=Sr(require("stream"));var lJ=class lJ{constructor(t){this.port=t;this.stdoutEmitter=new h_e.EventEmitter;this.server=g_e.createServer((r,n)=>{if(r.headers.accept&&r.headers.accept=="text/event-stream")switch(n.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),r.url){case"/stdin":process.stdin.on("data",a=>{p_e(n,a)});return;case"/stdout":this.stdoutEmitter.on("data",a=>{p_e(n,a)});return;default:n.writeHead(404),n.end();return}n.writeHead(200,{"Content-Type":"text/html"});let s=__dirname;Fv.basename(__dirname)==="dist"&&(s=Fv.dirname(__dirname));let o;try{o=m_e.readFileSync(Fv.join(s,"dist","debugServer.html"))}catch(a){o=a.toString()}n.write(o),n.end()})}wrapStdout(t){return new y_e.Writable({write:(n,s,o)=>(this.stdoutEmitter.emit("data",n),t.write(n,s,o))})}listen(){return this.server.listen(this.port),this}};l(lJ,"DebugServer");var LP=lJ;function p_e(e,t){e.write("data: "+t.toString().replace(/\n/g,`
data: `)+`
`)}l(p_e,"writeData");var MP=class MP{constructor(t){this.conn=t}static from(t,r,n){let s=n,o=parseInt(process.env.GH_COPILOT_DEBUG_UI_PORT);if(!isNaN(o))try{s=new LP(o).listen().wrapStdout(n)}catch(c){new Fs(2,"agent").error(t,`Failed to start debug server on port ${o} (maybe it's in use?)`,c)}if(t.get(ip).flags.recordInput){let c=Date.now().toString(),u=`stdin${c}.log`;r.on("data",d=>{(0,cJ.appendFile)(u,d,p=>{p&&console.error(p)})});let f=`stdout${c}.log`;s=put(s,d=>{(0,cJ.appendFile)(f,d,p=>{p&&console.error(p)})})}let a=(0,eg.createConnection)(eg.ProposedFeatures.all,new eg.StreamMessageReader(r),new eg.StreamMessageWriter(s));return new MP(a)}listen(){this.conn.listen()}};l(MP,"WrappedConnection");var $0=MP;function put(e,t){return new v_e.Writable({write:(n,s,o)=>(t(n.toString()),e.write(n,s,o))})}l(put,"wrapWritableStream");var FP=new x_e.ProgressType,uJ=class uJ extends Zf{constructor(r){super();this.ctx=r}async begin(r,n,s){await this.ctx.get($0).conn.sendProgress(FP,s,{kind:"begin",title:`Conversation ${r.id} Turn ${n.id}`,conversationId:r.id,turnId:n.id})}async report(r,n,s,o){await this.ctx.get($0).conn.sendProgress(FP,s,{kind:"report",conversationId:r.id,turnId:n.id,reply:o})}async end(r,n,s,o,a,c,u,f){await this.ctx.get($0).conn.sendProgress(FP,s,{kind:"end",conversationId:r.id,turnId:n.id,followUps:a||[],skillResolutions:u||[],updatedDocuments:f||[],annotations:c||[],error:o})}async cancel(r,n,s,o){await this.ctx.get($0).conn.sendProgress(FP,s,{kind:"end",conversationId:r.id,turnId:n.id,followUps:[],cancellationReason:"CancelledByUser",error:o})}};l(uJ,"AgentConversationProgress");var BP=uJ;var C_e=Sr(S8()),T_e=Sr(Jm()),E_e=Sr(Zm());var __e=Sr(S8());var fJ=class fJ extends Error{constructor(t){super(b_e(t))}};l(fJ,"SchemaValidationError");var Bv=fJ;function bn(e,t){let r=__e.TypeCompiler.Compile(e);return async(n,s,o)=>{if(!r.Check(o)){let a=b_e(r.Errors(o));return[null,{code:-32602,message:a}]}return t(n,s,o)}}l(bn,"addMethodHandlerValidation");function b_e(e){return`Schema validation failed with the following errors:
${Array.from(e).map(r=>`- ${r.path}: ${r.message}`).join(`
`)}`}l(b_e,"createErrorMessage");var dJ=class dJ{constructor(t,r,n){this.ctx=t;this.skillId=r;this.requestType=new T_e.ProtocolRequestType("conversation/context");this.typeCheck=C_e.TypeCompiler.Compile(n)}async resolveSkill(t){let r=this.ctx.get($0).conn,n={conversationId:t.conversation.id,turnId:t.turn.id,skillId:this.skillId},s;try{let o=await r.sendRequest(this.requestType,n),[a,c]=o;if(c){let u=new E_e.ResponseError(c.code,c.message,c.data);Ba.error(this.ctx,`ResponseError while resolving skill ${this.skillId}`,u);return}s=a}catch(o){Ba.error(this.ctx,`Error while resolving skill ${this.skillId}`,o);return}if(s!=null){if(!this.typeCheck.Check(s))throw new Bv(this.typeCheck.Errors(s));return s}}};l(dJ,"AgentSkillResolver");var Mu=dJ;var pJ=Sr(Wi());var mJ=class mJ{constructor(t,r,n=[],s=[],o=[]){this.workDoneToken=t;this.chunks=r;this.followUps=n;this.skills=s;this.references=o}};l(mJ,"SyntheticTurn");var hJ=mJ,gJ=class gJ{constructor(){this.turns=[]}add(t,r,n=[],s=[],o=[]){this.turns.push(new hJ(t,r,n,s,o))}get(t){return this.turns.find(r=>r.workDoneToken===t)}};l(gJ,"SyntheticTurns");var Jp=gJ,yJ=class yJ{constructor(t,r,n){this.ctx=t;this.conversation=r;this.turn=n;this.conversationProgress=t.get(Zf)}async process(t,r){var n;try{let s=(n=this.ctx.get(Jp))==null?void 0:n.get(t);await this.processWithSyntheticTurns(s,t,r)}catch(s){Ba.error(this.ctx,`Error processing turn ${this.turn.id}`,s);let o=s.message;this.turn.status="error",this.turn.response={message:o,type:"meta"},await this.conversationProgress.end(this.conversation,this.turn,t,{message:o,responseIsIncomplete:!0})}}async processWithSyntheticTurns(t,r,n){await this.conversationProgress.begin(this.conversation,this.turn,r),await this.resolveSyntheticSkill(t,r,n),await this.processSyntheticChunks(t,r,n),await this.endSyntheticProgress(t,r,n),this.turn.response={type:"model",message:t.chunks.join("")},this.turn.status=n.isCancellationRequested?"cancelled":"success"}async resolveSyntheticSkill(t,r,n){let s=this.ctx.get(S0).getCapabilities(this.conversation.id),o=t.skills.filter(c=>s.skills.includes(c)),a=new Vp(this.ctx,this.conversation,this.turn,n);for(let c of o){let f=await new Mu(this.ctx,c,pJ.Type.Object({value:pJ.Type.String()})).resolveSkill(a);f&&!n.isCancellationRequested&&await this.conversationProgress.report(this.conversation,this.turn,r,f.value)}}async processSyntheticChunks(t,r,n){for(let s of t.chunks)n.isCancellationRequested||await this.conversationProgress.report(this.conversation,this.turn,r,s)}async endSyntheticProgress(t,r,n){let s=t.followUps.map(o=>({message:o,type:"follow-up",id:Ma()}));n.isCancellationRequested?await this.conversationProgress.cancel(this.conversation,this.turn,r):await this.conversationProgress.end(this.conversation,this.turn,r,void 0,s,[],void 0,this.conversation.source==="inline"?[{uri:"fakeUpdatedDoc.ts",text:"fake"}]:void 0)}};l(yJ,"SyntheticTurnProcessor");var qP=yJ;function S_e(e){hut(e),mut(e)}l(S_e,"activateConversationFeature");function hut(e){e.set(S0,new S0(e)),e.set(Bd,new Bd),e.set(Hc,new Hc(e)),e.set(Jp,new Jp),e.set(el,new el(e)),e.set(Zf,new BP(e)),e.get(v1).add(new VA)}l(hut,"registerContextDependencies");function mut(e){let t=new kl;t.registerSkill(new wR("w")),t.registerSkill(new uR(new Mu(e,Um,k6e),"x")),t.registerSkill(new aR(new Mu(e,Gp,O6e),"y")),t.registerSkill(new fR("z")),t.registerSkill(new IR(new Mu(e,AR,J6e),"a")),t.registerSkill(new TR(new Mu(e,ER,Y6e),"b")),t.registerSkill(new SR(new Mu(e,$m,X6e),"c")),t.registerSkill(new RR(new Mu(e,PR,exe),"d")),t.registerSkill(new bR(new Mu(e,CR,K6e),"e")),t.registerSkill(new kR(new Mu(e,Ud,rxe),"f")),t.registerSkill(new NR(new Mu(e,h3,ixe),"g")),e.set(kl,t)}l(mut,"registerSkills");var vJ=class vJ extends za{constructor(t=100){super(t)}};l(vJ,"CopilotCompletionCache");var uu=vJ;var xJ=class xJ{constructor(){this._resolve=l(()=>{},"_resolve");this._reject=l(()=>{},"_reject");this.promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}resolve(t){this._resolve(t)}reject(t){this._reject(t)}};l(xJ,"Deferred");var UP=xJ;var _J=class _J{constructor(){t
`+r}async requiredSkills(t){return this.skills}};l(YJ,"StaticPromptTemplate");var w3=YJ,Put=new w3("tests","Generate unit tests","Generate Tests",ph.default`
Write a set of unit tests for the code above, or for the selected code if provided.
Provide tests for the functionality of the code and not the implementation details.
The tests should test the happy path as well as the edge cases.
Choose self explanatory names for the tests that describe the tested behavior. Do not start the test names with "test".
Think about the different scenarios that could happen and test them.
Do reply with the tests only and do not explain them further.
Do reply with new or modified tests only and not with the complete test class or suite.
Follow the same test style as in existing tests if they exist.
You must not create inline comments like "Arrange, Act, Assert", unless existing tests use inline comments as well.
If existing tests use any mocking or stubbing libraries, use the same libraries before writing your own test doubles.
`,[Ud,h3],["editor","chat-panel"]),Out=new w3("simplify","Simplify the code","Simplify This",ph.default`
Provide a simplified version of the code above.
Do not change the behavior of the code.
The code should still be readable and easy to understand.
Do not reply with the original code but only a simplified version.
Do only reply with one code snippet that contains the complete simplified code and explain what you have simplified after.`,[],["editor","chat-panel"],ph.default`
Provide a simplified version of the code above.
Do not change the behavior of the code.
The code should still be readable and easy to understand.
Do not reply with the original code but only a simplified version.`),kut=new w3("fix","Fix problems and compile errors","Fix This",ph.default`
Fix the provided errors and problems.
Do not invent new problems.
The fixed code should still be readable and easy to understand.
If there are no problems provided do reply that you can't detect any problems and the user should describe more precisely what he wants to be fixed.
Group problems if they are related and can be fixed by the same change.
Present a group as a single problem with a simple description that does not repeat the single problems but explains the whole group of problems in a few words.
Explain each group of problems without repeating the detailed error message.
Show how the error can be fixed by providing a code snippet that displays the code before and after it has been fixed after each group.
Shorten fully qualified class names to the simple class name and full file paths to the file names only.
When enumerating the groups, start with the word "Problem" followed by the number and a quick summary of the problem. Format this headline bold.
At last provide a completely fixed version of the code if the fixes required multiple code changes.`,[$m],["editor","chat-panel"]),Nut=new w3("explain","Explain how the code works","Explain This",ph.default`
Write an explanation for the code above as paragraphs of text.
Include excerpts of code snippets to underline your explanation.
Do not repeat the complete code.
The explanation should be easy to understand for a developer who is familiar with the programming language used but not familiar with the code.`,[],["editor","chat-panel"]),Dut=new w3("doc","Document the current selection of code","Generate Docs",ph.default`
Write documentation for the selected code.
The reply should be a codeblock containing the original code with the documentation added as comments.
Use the most appropriate documentation style for the programming language used (e.g. JSDoc for JavaScript, docstrings for Python etc.)`,[],["editor","chat-panel"],ph.default`
Add documentation for the selected code.
Use the most appropriate documentation style for the programming language used (e.g. JSDoc for JavaScript, docstrings for Python etc.)`),XJ=class XJ{constructor(){this.id="feedback";this.description="Steps to provide feedback";this.shortDescription="Feedback";this.scopes=["chat-panel"]}async response(t,r){let n=fK(r),s=ph.default`
You can provide direct feedback by pressing the thumbs up/down buttons on a single message.
In case you want to share more details, please click [here](https://gh.io/copilot-chat-jb-feedback) to share your feedback.
`;return n?new t1(s+`
In order to help us understand your feedback better, you can include the following identifier in your feedback: by doing so, you are granting us permission to access the telemetry data associated with your feedback.
\`\`\`yaml
${r.id}/${n}
\`\`\``):new t1(s)}};l(XJ,"FeedbackPromptTemplate");var WJ=XJ,Lut=new WJ;function p_(){return[Put,Out,kut,Nut,Dut,Lut,...q_e()]}l(p_,"getPromptTemplates");function U_e(e){let t=p_();return!G7(e)&&!mu(e)&&(t=t.filter(r=>!r.id.startsWith("debug."))),t}l(U_e,"getUserFacingPromptTemplates");var QJ=class QJ{constructor(t,r){this.ctx=t;this.chatFetcher=r}async followUp(t,r,n){let s=n?{...n}:{};s.messageSource="chat.followup";let o={maxTokens:(await k9(this.ctx)).maxRequestTokens},a=await this.ctx.get(Hc).toPrompt(t,o,r,"followup");Ba.debug(this.ctx,"Conversation.followup",JSON.stringify(a));let c={model:(await k9(this.ctx)).model,messages:a.messages,uiKind:"conversationPanel",telemetryProperties:s},u=await this.chatFetcher.fetchResponse(c,r);if(u.type==="success"){let f=[];return u.value&&f.push(u.value.trim()),f}else return u.type==="successMultiple"?(Ba.error(this.ctx,"successMultiple response is unexpected for followup"),[]):(Ba.error(this.ctx,`Failed to fetch followups due to reason ${u.reason}`),[])}};l(QJ,"ConversationFollowUp");var WP=QJ;var JJ=class JJ{constructor(t,r,n,s,o){this.ctx=t;this.conversation=r;this.turn=n;this.chatFetcher=s;this.computeFollowup=o}async postProcess(t,r,n,s,o,a,c){var u,f;switch(y6e(this.ctx,c!=null?c:"conversationPanel",o,t.type=="offTopic",a,s),t.type){case"success":return this.turn.annotations=(u=t.annotations)!=null?u:[],await this.processSuccessfulFetchResult(n,(f=t.annotations)!=null?f:[],t.requestId,r,a,c);case"offTopic":return await this.processOffTopicFetchResult(s,a,c);case"canceled":return this.turn.status="cancelled",this.turn.response={message:"Cancelled",type:"user"},{error:this.turn.response};case"failed":return this.turn.status="error",this.turn.response={message:t.reason,type:"server"},Ba.debug(this.ctx,"Conversation.fetchError",JSON.stringify({code:t.code,reason:t.reason,requestId:t.requestId})),{error:{message:this.translateErrorMessage(t.code)}};case"filtered":return this.turn.status="filtered",{error:{message:"Oops, your response got filtered. Vote down if you think this shouldn't have happened.",responseIsFiltered:!0}};case"length":return this.turn.status="error",{error:{message:"Oops, the response got too long. Try to reformulate your question.",responseIsIncomplete:!0}};case"successMultiple":case"unknown":return this.turn.status="error",Ba.debug(this.ctx,"Conversation.fetchError",JSON.stringify({requestId:t.requestId})),{error:{message:"Oops, no response has returned.",responseIsFiltered:!1}}}}async processSuccessfulFetchResult(t,r,n,s,o,a){if(t&&t.length>0){let c=d3(this.turn.id);this.turn.status="success",this.turn.response={message:t,type:"model"},c.markAsDisplayed();let u=v6e(this.ctx,this.conversation,a!=null?a:"conversationPanel",t,n,o,c);return{followups:this.computeFollowup?await this.computeFollowups(s,{messageId:u},o):[],annotations:r}}return this.turn.status="error",this.turn.response={message:"The model returned successful but did not contain any response text.",type:"meta"},{error:this.turn.response}}translateErrorMessage(t){switch(t){case 466:return"Oops, your plugin is out of date. Please update it.";case 401:return"Oops, you are not authorized. Please sign in.";case 429:return"Oops, there was a problem with your request. Please try again.";default:return"Sorry, an error occurred while generating a response."}}async computeFollowups(t,r,n){let a=(await new WP(this.ctx,this.chatFetcher).followUp(this.conversation,t,r)).map(c=>this.enrichFollowup(c,r,n));return Ba.debug(this.ctx,"Computed followups",a),a}enrichFollowup(t,r,n){let s=r!=null?r:{};return s.suggestionId=Ma(),s.suggestionType="Follow-up from model",_6e(this.ctx,"conversationPanel",s.suggestionType,s.messageId,s.suggestionId,n),{message:t,id:s.suggestionId,type:s.suggestionType}}async processOffTopicFetchResult(t,r,n){let s=d3(this.turn.id),o="Sorry, but I can only assist with programming related questions.";return this.turn.response={message:o,type:"offtopic-detection"},this.turn.status="off-topic",s.markAsDisplayed(),x6e(this.ctx,this.conversation,n!=null?n:"conversationPanel",o,t.properties.
`),y=h.split(`
`).map(E=>E.trim());if(!y.length)continue;let v=[];if(g.forEach((E,S)=>{g.slice(S,S+y.length).map(I=>I.trim()).join(`
`)===y.join(`
`)&&v.push(S)}),v.length!==1)continue;let _=v[0],x=(c=(a=g[_].match(/^\s*/))==null?void 0:a[0])!=null?c:"",b=m.split(`
`).map(E=>x+E).join(`
`);g.splice(_,y.length,b),o=!0,s=g.join(`
`)}}else{let p=/<!-- (?<mode>file|selection) -->\n```[\w]*?\n(?<codeblock>[\s\S]*?)\n```/gs.exec(t);if(p){let h=p.groups.codeblock,m=n.getText(r.range),g=(f=(u=m.match(/^\s*/))==null?void 0:u[0])!=null?f:"";h=h.split(`
`).map(y=>g+y).join(`
`),o=!0,s=n.getText().replace(m,h)}}if(s&&o)return Ba.debug(this.ctx,"Conversation.documentDiff",JSON.stringify({original:r.document.getText(),updated:s})),{uri:n.uri.fsPath,text:s}}};l(ZJ,"InlineTurnProcessor");var KP=ZJ;var eZ=class eZ{constructor(t,r,n,s=!0,o){this.ctx=t;this.conversation=r;this.turn=n;this.computeFollowup=s;this.chatFetcher=o;var a,c;this.conversationProgress=t.get(Zf),this.chatFetcher=(a=this.chatFetcher)!=null?a:new rg(t),this.postProcessor=new jv(t,r,n,this.chatFetcher,(c=this.computeFollowup)!=null?c:!0)}async process(t,r,n,s){try{await this.processWithModel(t,r,n,s)}catch(o){Ba.error(this.ctx,`Error processing turn ${this.turn.id}`,o);let a=o.message;this.turn.status="error",this.turn.response={message:a,type:"meta"},await this.conversationProgress.end(this.conversation,this.turn,t,{message:a,responseIsIncomplete:!0})}}async processWithModel(t,r,n,s){await this.conversationProgress.begin(this.conversation,this.turn,t);let o=d3(this.turn.id);if(o.markAsDisplayed(),r.isCancellationRequested){this.turn.status="cancelled",await this.conversationProgress.cancel(this.conversation,this.turn,t);return}let[a,c]=this.determineAndApplyTemplateUsed();if(a!=null&&a.response){let p=await a.response(this.ctx,this.conversation,this.turn,c,r);this.turn.response={type:"meta",message:p.message},this.turn.status=p.isFiltered?"filtered":"success",p.isFiltered||p.isIncomplete?(await this.conversationProgress.report(this.conversation,this.turn,t,"Sure, I can definitely do that!"),await this.conversationProgress.end(this.conversation,this.turn,t,{message:p.message,responseIsIncomplete:p.isIncomplete,responseIsFiltered:p.isFiltered})):(await this.conversationProgress.report(this.conversation,this.turn,t,p.message),await this.conversationProgress.end(this.conversation,this.turn,t));return}await this.collectSkillsToUse(r,o,a);let u=await this.buildConversationPrompt(r),f="";if(n?(this.turn.request.type="follow-up",f=tR(this.ctx,this.conversation,"conversationPanel",this.turn.request.message,u.tokens,n.type,n.id,s,o),o=pv(this.conversation,"conversationPanel",this.turn.request.message.length,u.tokens,n.type,n.id,o)):(o=pv(this.conversation,"conversationPanel",this.turn.request.message.length,u.tokens,a==null?void 0:a.id,void 0,o),f=o.properties.messageId),r.isCancellationRequested){this.turn.status="cancelled",await this.conversationProgress.cancel(this.conversation,this.turn,t);return}let d=await this.fetchConversationResponse(u.messages,t,r,o,s,{messageId:f,messageSource:"chat.user"});await this.conversationProgress.end(this.conversation,this.turn,t,d.error,d.followups,d.annotations,u.skillResolutions)}determineAndApplyTemplateUsed(){var n;let t;if(!t&&this.turn.request.message.startsWith("/")){let s=this.getTemplateIdFromRequest(this.turn.request.message);t=p_().find(o=>o.id===s)}let r=(n=this.getUserSpecificPartForTemplateRequest(this.turn.request.message))!=null?n:"";if(t){let s=t.instructions?t.instructions(this.ctx,r):r;this.turn.request={message:s,type:"template"}}return[t,r]}getTemplateIdFromRequest(t){let r=t.indexOf(" ");return t.substring(1,r===-1?t.length:r)}getUserSpecificPartForTemplateRequest(t){let r=t.indexOf(" ");if(r!==-1)return t.substring(r+1)}async collectSkillsToUse(t,r,n){let o=await new yv(this.ctx,this.chatFetcher).collectTurnSkills(this.ctx,this.conversation,t,r,n);this.turn.skills=o.map(a=>({skillId:a}))}async buildConversationPrompt(t){let r={maxTokens:(await cl(this.ctx)).maxRequestTokens},n=await this.ctx.get(Hc).toPrompt(this.conversation,r,t);return Ba.debug(this.ctx,"Conversation.prompt",JSON.stringify(n)),n}async fetchConversationResponse(t,r,n,s,o,a){n.onCancellationRequested(async()=>{await this.conversationProgress.cancel(this.conversation,this.turn,r)});let c=new Uv(d=>{this.conversationProgress.report(this.conversation,this.turn,r,d).then(),this.turn.response||(this.turn.response={message:d,type:"model"}),this.turn.response.message+=d}),u={model:(await cl(this.ctx)).model,messages:t,uiKind:"conversationPanel",intentParams:{intent:!0,intent_threshold:.9,intent_content:this.turn.requ
`).map(f=>{let d=f.replace(u,""),p=f.length-d.length;return c(p)+d}).join(`
`)}l(n,"replace");let s;if(e.tabSize===void 0||typeof e.tabSize=="string"?s=4:s=e.tabSize,e.insertSpaces===!1){let o=l(a=>n(a," ",c=>" ".repeat(Math.floor(c/s))+" ".repeat(c%s)),"r");t.displayText=o(t.displayText),t.completionText=o(t.completionText)}else if(e.insertSpaces===!0){let o=l(a=>n(a," ",c=>" ".repeat(c*s)),"r");if(t.displayText=o(t.displayText),t.completionText=o(t.completionText),r){let a=l(c=>{let u=c.length-c.trimLeft().length,f=u%s;if(f!==0&&u>0){let d=" ".repeat(f);return n(c,d,p=>" ".repeat((Math.floor(p/s)+1)*s))}else return c},"re");t.displayText=a(t.displayText),t.completionText=a(t.completionText)}}return t}l(ebe,"normalizeIndentCharacter");function rbe(e,t,r,n,s,o,a){let c=e.get(C0),u=n.lineAt(s),f=t.map(d=>{let p,h="";if(o&&(d.completion=ebe(o,d.completion,u.isEmptyOrWhitespace)),d.completion.displayNeedsWsOffset&&u.isEmptyOrWhitespace)p=c.range(c.position(s.line,0),s),h=d.completion.completionText;else if(u.isEmptyOrWhitespace&&d.completion.completionText.startsWith(u.text))p=c.range(c.position(s.line,0),s),h=d.completion.completionText;else{let g=n.getWordRangeAtPosition(s);if(d.isMiddleOfTheLine){let y=n.lineAt(s),v=c.range(c.position(s.line,0),s),_=n.getText(v);p=d.coversSuffix?y.range:v,h=_+d.completion.displayText}else if(g){let y=n.getText(g);p=c.range(g.start,s),h=y+d.completion.completionText}else{let y=c.range(c.position(s.line,0),s),v=n.getText(y);p=y,h=v+d.completion.displayText}}return{uuid:Ma(),text:h,range:p,file:n.uri,index:d.completion.completionIndex,telemetry:d.telemetry,displayText:d.completion.displayText,position:s,offset:n.offsetAt(s),resultType:r}});if(r===2&&a!==void 0){let d=f.find(p=>p.index===a);if(d){let p=f.filter(h=>h.index!==a);f=[d,...p]}}return f}l(rbe,"completionsFromGhostTextResults");var nZ=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),oft=Object.freeze({isCancellationRequested:!1,onCancellationRequested:()=>({dispose:()=>{}})}),aft=Object.freeze({isCancellationRequested:!0,onCancellationRequested:nZ}),iZ=class iZ{constructor(){this._isCancelled=!1;this.handlers=[]}cancel(){this._isCancelled||(this._isCancelled=!0,this.handlers.forEach(t=>t(void 0)))}get isCancellationRequested(){return this._isCancelled}onCancellationRequested(t,r,n){return this._isCancelled?nZ(t,r):(this.handlers.push(t.bind(r)),{dispose:()=>{}})}dispose(){this.handlers=[]}};l(iZ,"MutableToken");var m_=iZ,sZ=class sZ{constructor(t){this.tokens=[];this.handlers=[];this._isCancelled=!1;this.tokens=t,this._isCancelled=t.some(r=>r.isCancellationRequested),t.forEach(r=>{r.onCancellationRequested(this.cancel,this)})}cancel(){this._isCancelled||(this._isCancelled=!0,this.handlers.forEach(t=>t(void 0)))}dispose(){this.tokens=[]}get isCancellationRequested(){return this.tokens.some(t=>t.isCancellationRequested)}onCancellationRequested(t,r,n){return this._isCancelled?nZ(t,r):(this.handlers.push(t.bind(r)),{dispose:()=>{}})}};l(sZ,"MergedToken");var Vv=sZ,oZ=class oZ{constructor(t){this._token=void 0;this._parentListener=void 0;this._parentListener=t&&t.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new m_),this._token}cancel(){this._token?this._token instanceof m_&&this._token.cancel():this._token=aft}dispose(t=!1){t&&this.cancel(),this._parentListener&&this._parentListener.dispose(),this._token?this._token instanceof m_&&this._token.dispose():this._token=oft}};l(oZ,"CancellationTokenSource");var ng=oZ;function JP(e,t){let r=e.split(`
`),n=t,s=t,o=r[t.line],a=o.indexOf("%");a!==-1&&(o=o.substring(0,a)+o.substring(a+1),n={line:t.line,character:a});let c=o.indexOf("^");if(c!==-1){let u=o.indexOf("^",c+1);if(u===-1)throw new Error("Challenge document must contain zero or two ^ characters.");o=o.substring(0,c)+o.substring(c+1,u)+o.substring(u+1),n={line:t.line,character:t.character},s={line:t.line,character:t.character+u-c-1}}return{cursorLine:o,lines:r,start:n,end:s}}l(JP,"parseChallengeDoc");var Gv=Sr(Wi());var lft=Gv.Type.Object({documents:Gv.Type.Array(Gv.Type.String()),options:Gv.Type.Optional(Gv.Type.Object({}))}),aZ=class aZ{constructor(t){this.documents=t}};l(aZ,"CompletionDocuments");var zv=aZ;async function cft(e,t,r){return e.forceSet(zv,new zv(r.documents)),["OK",null]}l(cft,"handleTestingSetCompletionDocumentsChecked");var nbe=bn(lft,cft);var sbe=rl.Type.Object({doc:rl.Type.Object({position:rl.Type.Object({line:rl.Type.Number({minimum:0}),character:rl.Type.Number({minimum:0})}),insertSpaces:rl.Type.Optional(rl.Type.Boolean()),tabSize:rl.Type.Optional(rl.Type.Number()),uri:rl.Type.String(),version:rl.Type.Number(),ifInserted:rl.Type.Optional(rl.Type.Object({text:rl.Type.String(),end:rl.Type.Optional(rl.Type.Object({line:rl.Type.Number({minimum:0}),character:rl.Type.Number({minimum:0})})),tooltipSignature:rl.Type.Optional(rl.Type.String())}))}),options:rl.Type.Optional(Ua)}),obe=new Fs(0,"getCompletions"),g_;async function abe(e,t,r,n){let s=Es.createAndMarkAsIssued();g_&&(g_.cancel(),g_.dispose()),g_=new ng;let o=new Vv([t,g_.token]),a;try{a=e.get(zv)}catch{}if(a){let x=n?3:1;return[{completions:a.documents.slice(0,x).map(E=>{let{cursorLine:S,lines:I,start:H,end:K}=JP(E,r.doc.position),be=[S.slice(Math.min(H.character,r.doc.position.character))].concat(I.slice(r.doc.position.line+1)).join(`
`);return{uuid:Ma(),text:be,displayText:be,position:r.doc.position,range:{start:H,end:K},docVersion:r.doc.version}})},null]}let c=ibe.URI.parse(r.doc.uri),u=await Fu(e,c);if(u.status==="notfound")return[null,{code:-32602,message:u.message}];if(u.status==="invalid")return e.get(Ja).setInactive(u.reason),[{completions:[],cancellationReason:"CopilotNotAvailable"},null];let f=u.document;if(f.version!==r.doc.version)return uft(e,o,f,r),[{completions:[],cancellationReason:"DocumentVersionMismatch"},null];let d=fft(e,s,f,r.doc.position,r.doc.ifInserted);dft(e,f,d);let p=await mft(e,f,d,n,s,o,r.doc.ifInserted),h=await q2e(e,p);if(!h)return[{completions:[],...hft(p)},null];let[m,g]=h,y=rbe(e,m,g,f,d,r.doc),v=e.get(uu);for(let x of y)v.set(x.uuid,{...x,triggerCategory:"ghostText"});return[{completions:y.map(x=>({uuid:x.uuid,text:x.text,range:x.range,displayText:x.displayText,position:x.position,docVersion:f.version}))},null]}l(abe,"handleGetCompletionsHelper");async function uft(e,t,r,n){t.isCancellationRequested||(pft(e,r,n.doc.version),obe.debug(e,`Producing empty completions due to document version mismatch. Completions requested for document version ${n.doc.version} but document version was ${r.version}.`))}l(uft,"raiseVersionMismatchIfNotCanceled");function fft(e,t,r,n,s){var c;let o=r.offsetAt(e.get(C0).position(n.line,n.character)),a=r.positionAt(o);if(s&&s.text.length>0&&r instanceof Zp){let u=(c=s.end)!=null?c:n;r.update([{range:{start:n,end:u},text:s.text}],r.version),a=r.positionAt(o+s.text.length),t.properties.completionsActive="true"}return a}l(fft,"positionAndContentForCompleting");function dft(e,t,r){let n=t.getText({start:{line:Math.max(r.line-1,0),character:0},end:r}),s=t.getText({start:r,end:{line:Math.min(r.line+2,t.lineCount-1),character:t.lineCount-1>r.line?0:r.character}});obe.debug(e,`Requesting completion at position ${r.line}:${r.character}, between ${JSON.stringify(n)} and ${JSON.stringify(s)}.`)}l(dft,"logCompletionLocation");async function pft(e,t,r){let n=Es.createAndMarkAsIssued({languageId:String(t.languageId),requestedDocumentVersion:String(r),actualDocumentVersion:String(t.version)});mn(e,"getCompletions.docVersionMismatch",n)}l(pft,"telemetryVersionMismatch");function hft(e){switch(e.type){case"abortedBeforeIssued":case"canceled":return{cancellationReason:"RequestCancelled"};case"failed":return{cancellationReason:"OtherFailure"};default:return}}l(hft,"cancellationReason");async function mft(e,t,r,n,s,o,a){try{return await _4e(e,t,r,n,s,o,a)}catch(c){if(Cf(c))return{type:"canceled",reason:"aborted at unknown location",telemetryData:Od(s,{cancelledNetworkRequest:!0})};throw c}}l(mft,"getGhostTextWithAbortHandling");var lbe=D0(bn(sbe,(e,t,r)=>abe(e,t,r,!1))),cbe=D0(bn(sbe,(e,t,r)=>abe(e,t,r,!0)));var r1=Sr(Wi()),ybe=Sr(m8());var rO=Sr(Jm()),dZ=Sr(vl());function ube(e){switch(e){case 2:return"open copilot";default:return"unknown"}}l(ube,"completionTypeToString");var ZP=class ZP{constructor(t,r,n){this.prependToCompletion="";this.appendToCompletion="";this.indentation=null;this.completionType=2;this.insertPosition=t.get(C0).position(r.line,r.character),this.completionType=n}static fromJSONParse(t,r){let n=t.get(C0).position(r.insertPosition.line,r.insertPosition.character),s=new ZP(t,n,r.completionType);return s.prependToCompletion=r.prependToCompletion,s.appendToCompletion=r.appendToCompletion,s.indentation=r.indentation,s}};l(ZP,"CompletionContext");var lZ=ZP;function fbe(e,t,r){let n=r,s=t.lineAt(r.line);return s.isEmptyOrWhitespace||(n=s.range.end),new lZ(e,n,2)}l(fbe,"completionContextForDocument");var eO=new Fs(1,"solutions");async function*gft(e,t){for await(let r of e){let n={...r};n.completionText=t+n.completionText.trimRight(),yield n}}l(gft,"prependChoices");var cZ=class cZ{constructor(t,r,n){this.completionContext=t;this.startPosition=r;this.solutionCountTarget=n}get savedTelemetryData(){return this._savedTelemetryData}set savedTelemetryData(t){this._savedTelemetryData=t}};l(cZ,"ISolutionManager");var tO=cZ;function dbe(e){return e.replace(/\s+/g,"")}l(dbe,"normalizeCompletionText");async
`,`\r
\r
`]);let I={prompt:y,languageId:a.languageId,repoInfo:d,ourRequestId:h,engineUrl:await jI(e,t.savedTelemetryData),count:t.solutionCountTarget,uiKind:"synthesize",postOptions:S,requestLogProbs:!0},H;switch(x){case"server":H=l(async At=>{},"finishedCb"),S.extra.force_indent=(vt=E.prev)!=null?vt:-1,S.extra.trim_by_indentation=!0;break;case"parsingandserver":H=b?e9(e,a,t.startPosition):async At=>{},S.extra.force_indent=(Ze=E.prev)!=null?Ze:-1,S.extra.trim_by_indentation=!0;break;case"parsing":default:H=b?e9(e,a,t.startPosition):async At=>{};break}e.get(Ja).setProgress();let K=t.savedTelemetryData,be=await e.get(Rp).fetchAndStreamCompletions(e,I,K.extendedBy(),H,_);if(be.type==="failed"||be.type==="canceled")return t.reportCancelled(),e.get(Ja).removeProgress(),{status:"FinishedWithError",error:`${be.type}: ${be.reason}`};let Se=be.choices;Se=gft(Se,n),s!==null&&(Se=R2e(Se,s)),Se=$5(Se,async At=>QI(e,a,r,At,!1,eO,g.prompt,f));let ne=$5(Se,async At=>{let Ie=At.completionText;if(eO.info(e,`Open Copilot completion: [${At.completionText}]`),t.completionContext.completionType===2){let Tt="",Ar=await D2e(e,a,r,At.completionText);if(Ar)[Tt]=n9(a.getText(o.range(o.position(Ar.line,Ar.character),r)));else{let se=o.position(r.line,0);Tt=a.getText(o.range(se,r))}Ie=Tt+Ie}let Ve=At.completionText;v.length>0&&Ve.startsWith(v)&&(Ve=Ve.substring(v.length));let ie=At.meanLogProb,ae=ie!==void 0?Math.exp(ie):0,gr=(await t.getDocument()).version,hr=K.extendedBy({choiceIndex:At.choiceIndex.toString()});return{displayText:Ie,meanProb:ae,meanLogProb:ie||0,completionText:Ve,requestId:At.requestId,choiceIndex:At.choiceIndex,prependToCompletion:n,docVersion:gr,telemetryData:hr}});return hbe(e.get(Ja),_,ne[Symbol.asyncIterator]())}l(pbe,"launchSolutions");async function hbe(e,t,r){if(t.isCancellationRequested)return e.removeProgress(),{status:"FinishedWithError",error:"Cancelled"};let n=await r.next();return n.done===!0?(e.removeProgress(),{status:"FinishedNormally"}):{status:"Solution",solution:n.value,next:hbe(e,t,r)}}l(hbe,"generateSolutionsStream");var ig=Sr(Wi());var yft=ig.Type.Object({text:ig.Type.String(),score:ig.Type.Number()}),vft=ig.Type.Object({documents:ig.Type.Array(yft),options:ig.Type.Optional(ig.Type.Object({}))}),uZ=class uZ{constructor(t){this.documents=t}};l(uZ,"PanelCompletionDocuments");var Wv=uZ;async function xft(e,t,r){return e.forceSet(Wv,new Wv(r.documents)),["OK",null]}l(xft,"handleTestingSetPanelCompletionDocumentsChecked");var mbe=bn(vft,xft);var _ft=r1.Type.Object({doc:r1.Type.Object({position:r1.Type.Object({line:r1.Type.Number({minimum:0}),character:r1.Type.Number({minimum:0})}),uri:r1.Type.String(),version:r1.Type.Number()}),panelId:r1.Type.String(),options:r1.Type.Optional(Ua)});function bft(e,t,r,n,s){let o=dbe(s.completionText),a=(0,ybe.SHA256)(o).toString();return e.get(uu).set(a,{displayText:s.displayText,text:s.completionText,offset:n,uuid:a,range:r,file:dZ.URI.parse(t.doc.uri),telemetry:s.telemetryData,index:s.choiceIndex,position:t.doc.position,resultType:0,triggerCategory:"solution"}),{panelId:t.panelId,range:r,completionText:s.completionText,displayText:s.displayText,score:s.meanProb,solutionId:a,docVersion:s.docVersion}}l(bft,"makeSolution");var pZ=class pZ extends tO{constructor(r,n,s,o,a){super(s,n,o);this.textDocument=r,this.cancellationToken=a}reportCancelled(){}getCancellationToken(){return this.cancellationToken}async getDocument(){return this.textDocument}};l(pZ,"AgentSolutionManager");var fZ=pZ;async function vbe(e,t,r,n,s){let o=e.get(N0),a=await s;switch(a.status){case"Solution":o.sendNotification(new rO.NotificationType("PanelSolution"),bft(e,t,r,n,a.solution)),await vbe(e,t,r,n,a.next);break;case"FinishedNormally":await xbe(t.panelId,o);break;case"FinishedWithError":o.sendNotification(new rO.NotificationType("PanelSolutionsDone"),{status:"Error",message:a.error,panelId:t.panelId});break}}l(vbe,"reportSolutions");async function xbe(e,t){t.sendNotification(new rO.NotificationType("PanelSolutionsDone"),{status:"OK",panelId:e})}l(xbe,"reportDone");var y_;async function Cft(e,t,r){y_&&(y_.cancel(),y
`);return a=_.slice(0,r.doc.position.line).reduce((S,I)=>S+I.length+1,0)+x.character,{status:"Solution",solution:{requestId:{headerRequestId:d,completionId:Ma(),created:0,serverExperiments:"",deploymentId:""},completionText:b,displayText:b,meanProb:y,meanLogProb:-1,choiceIndex:m,prependToCompletion:"",docVersion:r.doc.version,telemetryData:j1.createEmptyConfigForTesting()},next:h(m+1)}},"getNextSolution");o=r.doc.position,s=h(0)}else{let d=dZ.URI.parse(r.doc.uri),p=await Fu(e,d);if(p.status==="notfound")return[null,{code:-32602,message:p.message}];if(p.status==="invalid")return gbe(e,r);let h=p.document;if(h.version!==r.doc.version)return new Fs(0,"getPanelCompletions").debug(e,`Producing empty solutions due to document version mismatch. Panel completions requested for document version ${r.doc.version} but document version was ${h.version}.`),gbe(e,r);a=h.offsetAt(e.get(C0).position(r.doc.position.line,r.doc.position.character)),o=h.positionAt(a);let m=fbe(e,h,o),g=new fZ(h,o,m,c,n);s=pbe(e,g)}let f=e.get(C0).range(o,o);return setImmediate(()=>vbe(e,r,f,a,s)),[{solutionCountTarget:c},null]}l(Cft,"handleGetPanelCompletionsChecked");function gbe(e,t){return xbe(t.panelId,e.get(N0)),[{solutionCountTarget:0},null]}l(gbe,"produceEmptySolutions");var _be=D0(bn(_ft,Cft));var bbe=Sr(Wi());var Tft=bbe.Type.Object({});async function Eft(e,t,r){return[{version:xy(e),buildType:vy(e),runtimeVersion:`node/${process.versions.node}`},null]}l(Eft,"handleGetVersionChecked");var Cbe=bn(Tft,Eft);var Tbe=Sr(Wi());function hZ(e){let t=e.indexOf("-----BEGIN CERTIFICATE-----")+27,r=e.indexOf("-----END CERTIFICATE-----"),n=30,s=e.substring(t,t+n)+"..."+e.substring(r-n,r-1);return Kv(s)}l(hZ,"asReadableCert");function Kv(e){return e.replace(/\s/g,"")}l(Kv,"normalizeNewlines");var Sft=Tbe.Type.Object({});async function wft(e){return[{certificates:(await e.get(pc).getAllRootCAs()).map(Kv)},null]}l(wft,"handleListCertificatesChecked");var Ebe=bn(Sft,wft);var Yv=Sr(Wi());var mZ=class mZ{constructor(t,r,n){this._referenceCount=0;this._isDisposed=!1;this._offset=n;let s=t.get(Go);this._tracker=s.onDidChangeTextDocument(async o=>{if(o.document.uri.toString()===r.toString()){for(let a of o.contentChanges)if(a.rangeOffset+a.rangeLength<=this.offset){let c=a.text.length-a.rangeLength;this._offset=this._offset+c}}})}get offset(){return this._offset}push(t,r){if(this._isDisposed)throw new Error("Unable to push new actions to a disposed ChangeTracker");this._referenceCount++,setTimeout(()=>{t(),this._referenceCount--,this._referenceCount===0&&(this._tracker.dispose(),this._isDisposed=!0)},r)}};l(mZ,"ChangeTracker");var I3=mZ;function Sbe(e,t){return e.compType==="partial"?e.acceptedLength:t.length}l(Sbe,"computeCompCharLen");function wbe(e,t){return t.compType==="partial"?e.substring(0,t.acceptedLength):e}l(wbe,"computeCompletionText");var A3=new Fs(1,"post-insertion"),Abe=[{seconds:15,captureCode:!1,captureRejection:!1},{seconds:30,captureCode:!0,captureRejection:!0},{seconds:120,captureCode:!1,captureRejection:!1},{seconds:300,captureCode:!1,captureRejection:!1},{seconds:600,captureCode:!1,captureRejection:!1}],Ift=50,Aft=1500,Rft=.5,Pft=500,gZ={triggerPostInsertionSynchroneously:!1,captureCode:!1,captureRejection:!1};async function Rbe(e,t,r,n,s){let o=await e.get(Go).getTextDocument(t);if(!o)return A3.info(e,`Could not get document for ${t.fsPath}. Maybe it was closed by the editor.`),{prompt:{prefix:"",suffix:"",isFimEnabled:!1,promptElementRanges:[]},capturedCode:"",terminationOffset:0};let a=o.getText(),c=a.substring(0,n),u=o.positionAt(n),f=await jy(e,o,u,r),d=f.type==="prompt"?f.prompt:{prefix:c,suffix:"",isFimEnabled:!1,promptElementRanges:[]};if(d.isFimEnabled&&s!==void 0){let p=a.substring(n,s);return d.suffix=a.substring(s),{prompt:d,capturedCode:p,terminationOffset:0}}else{let p=a.substring(n),h=JV(c,n,o.languageId),g=await L2e(h,void 0)(p),y=Math.min(a.length,n+(g?g*2:Pft)),v=a.substring(n,y);return{prompt:d,capturedCode:v,terminationOffset:g!=null?g:-1}}}l(Rbe,"captureCode");function Pbe(e,t,r,n,s){s.forEach(({completionText:c,completionTelem
/*! Bundled license information:
crypto-js/ripemd160.js:
(** @preserve
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*)
crypto-js/mode-ctr-gladman.js:
(** @preserve
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*)
@microsoft/applicationinsights-web-snippet/dist/node/applicationinsights-web-snippet.js:
(*!
* Application Insights JavaScript SDK - Web Snippet, 1.0.1
* Copyright (c) Microsoft and contributors. All rights reserved.
*)
mime-db/index.js:
(*!
* mime-db
* Copyright(c) 2014 Jonathan Ong
* MIT Licensed
*)
mime-types/index.js:
(*!
* mime-types
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*)
git-url-parse/lib/index.js:
(*!
* buildToken
* Builds OAuth token prefix (helper function)
*
* @name buildToken
* @function
* @param {GitUrl} obj The parsed Git url object.
* @return {String} token prefix
*)
yargs-parser/build/lib/string-utils.js:
(**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*)
yargs-parser/build/lib/tokenize-arg-string.js:
(**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*)
yargs-parser/build/lib/yargs-parser-types.js:
(**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*)
yargs-parser/build/lib/yargs-parser.js:
(**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*)
yargs-parser/build/lib/index.js:
(**
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
* CJS and ESM environments.
*
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*)
js-yaml/dist/js-yaml.mjs:
(*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
*/
//# sourceMappingURL=agent.js.map