1
0
Fork 0
mirror of synced 2024-11-29 20:25:34 -05:00
ultimate-vim/sources_non_forked/copilot.vim/dist/agent.js

723 lines
2.3 MiB
JavaScript
Raw Normal View History

"use strict";var L3e=Object.create;var my=Object.defineProperty;var M3e=Object.getOwnPropertyDescriptor;var F3e=Object.getOwnPropertyNames;var B3e=Object.getPrototypeOf,q3e=Object.prototype.hasOwnProperty;var l=(e,t)=>my(e,"name",{value:t,configurable:!0});var _c=(e,t)=>()=>(e&&(t=e(e=0)),t);var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a$=(e,t)=>{for(var r in t)my(e,r,{get:t[r],enumerable:!0})},l$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of F3e(t))!q3e.call(e,s)&&s!==r&&my(e,s,{get:()=>t[s],enumerable:!(n=M3e(t,s))||n.enumerable});return e};var hr=(e,t,r)=>(r=e!=null?L3e(B3e(e)):{},l$(t||!e||!e.__esModule?my(r,"default",{value:e,enumerable:!0}):r,e)),c$=e=>l$(my({},"__esModule",{value:!0}),e);var f$=I(kA=>{var u$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");kA.encode=function(e){if(0<=e&&e<u$.length)return u$[e];throw new TypeError("Must be between 0 and 63: "+e)};kA.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 LA=I(DA=>{var d$=f$(),NA=5,p$=1<<NA,h$=p$-1,m$=p$;function U3e(e){return e<0?(-e<<1)+1:(e<<1)+0}l(U3e,"toVLQSigned");function j3e(e){var t=(e&1)===1,r=e>>1;return t?-r:r}l(j3e,"fromVLQSigned");DA.encode=l(function(t){var r="",n,s=U3e(t);do n=s&h$,s>>>=NA,s>0&&(n|=m$),r+=d$.encode(n);while(s>0);return r},"base64VLQ_encode");DA.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=d$.decode(t.charCodeAt(r++)),u===-1)throw new Error("Invalid base64 digit: "+t.charAt(r-1));c=!!(u&m$),u&=h$,o=o+(u<<a),a+=NA}while(c);n.value=j3e(o),n.rest=r},"base64VLQ_decode")});var M5=I(tc=>{function H3e(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(H3e,"getArg");tc.getArg=H3e;var g$=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,$3e=/^data:.+\,.+$/;function gy(e){var t=e.match(g$);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}l(gy,"urlParse");tc.urlParse=gy;function D5(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(D5,"urlGenerate");tc.urlGenerate=D5;function MA(e){var t=e,r=gy(e);if(r){if(!r.path)return e;t=r.path}for(var n=tc.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,D5(r)):t}l(MA,"normalize");tc.normalize=MA;function y$(e,t){e===""&&(e="."),t===""&&(t=".");var r=gy(t),n=gy(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),D5(r);if(r||t.match($3e))return t;if(n&&!n.host&&!n.path)return n.host=t,D5(n);var s=t.charAt(0)==="/"?t:MA(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=s,D5(n)):s}l(y$,"join");tc.join=y$;tc.isAbsolute=function(e){return e.charAt(0)==="/"||g$.test(e)};function V3e(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(V3e,"relative");tc.relative=V3e;var v$=function(){var e=Object.create(null);return!("__proto__"in e)}();function x$(e){return e}l(x$,"identity");function G3e(e){return _$(e)?"$"+e:e}l(G3e,"toSetString");tc.toSetString=v$?x$:G3e;function z3e(e){return _$(e)?e.slice(1):e}l(z3e,"fromSetString");tc.fromSetString=v$?x$:z3e;function _$(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var r=t-10;r>=0;r--)if(e.charCodeAt(r)!==36)return!1;return!0}l(_$,"isProtoString");function W3e(e,t,r){var n=L5(e.source,t.source);return n!==0||(n=e.originalLine-t.originalLine,n!==0)||(n=
at `+j$(t[c],o)),o.nextPosition=o.curPosition;return o.curPosition=o.nextPosition=null,s+a.reverse().join("")}l(x2e,"prepareStackTrace");function H$(e){var t=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack);if(t){var r=t[1],n=+t[2],s=+t[3],o=mm[r];if(!o&&_d&&_d.existsSync(r))try{o=_d.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(H$,"getErrorSource");function _2e(e){var t=H$(e),r=m2e();r&&r._handle&&r._handle.setBlocking&&r._handle.setBlocking(!0),t&&(console.error(),console.error(t)),console.error(e.stack),g2e(1)}l(_2e,"printErrorAndExit");function b2e(){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 _2e(arguments[1])}return e.apply(this,arguments)}}l(b2e,"shimEmitUncaughtException");var C2e=I1.slice(0),E2e=A1.slice(0);gm.wrapCallSite=j$;gm.getErrorSource=H$;gm.mapSourcePosition=ZA;gm.retrieveSourceMap=JA;gm.install=function(e){if(e=e||{},e.environment&&(xy=e.environment,["node","browser","auto"].indexOf(xy)===-1))throw new Error("environment "+xy+" was unknown. Available options are {auto, browser, node}");if(e.retrieveFile&&(e.overrideRetrieveFile&&(I1.length=0),I1.unshift(e.retrieveFile)),e.retrieveSourceMap&&(e.overrideRetrieveSourceMap&&(A1.length=0),A1.unshift(e.retrieveSourceMap)),e.hookRequire&&!XA()){var t=M$(YA,"module"),r=t.prototype._compile;r.__sourceMapSupport||(t.prototype._compile=function(o,a){return mm[a]=o,_y[a]=void 0,r.call(this,o,a)},t.prototype._compile.__sourceMapSupport=!0)}if(WA||(WA="emptyCacheBetweenOperations"in e?e.emptyCacheBetweenOperations:!1),F$||(F$=!0,Error.prepareStackTrace=x2e),!B$){var n="handleUncaughtExceptions"in e?e.handleUncaughtExceptions:!0;try{var s=M$(YA,"worker_threads");s.isMainThread===!1&&(n=!1)}catch{}n&&p2e()&&(B$=!0,b2e())}};gm.resetRetrieveHandlers=function(){I1.length=0,A1.length=0,I1=C2e.slice(0),A1=E2e.slice(0),JA=Ox(A1),QA=Ox(I1)}});var V$=I(()=>{$$().install()});var Ia=I((exports,module)=>{"use strict";var uo=Object.create,Ie=Object.defineProperty,co=Object.getOwnPropertyDescriptor,_o=Object.getOwnPropertyNames,mo=Object.getPrototypeOf,po=Object.prototype.hasOwnProperty,i=l((e,t)=>Ie(e,"name",{value:t,configurable:!0}),"i"),P=l((e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),"P"),fo=l((e,t)=>{for(var r in t)Ie(e,r,{get:t[r],enumerable:!0})},"fo"),In=l((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _o(t))!po.call(e,s)&&s!==r&&Ie(e,s,{get:()=>t[s],enumerable:!(n=co(t,s))||n.enumerable});return e},"In"),At=l((e,t,r)=>(r=e!=null?uo(mo(e)):{},In(t||!e||!e.__esModule?Ie(r,"default",{value:e,enumerable:!0}):r,e)),"At"),go=l(e=>In(Ie({},"__esModule",{value:!0}),e),"go"),cr=P(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}}),en=P(e=>{var t=cr(),r=5,n=1<<r,s=n-1,o=n;function a(u){return u<0?(-u<<1)+1:(u<<1)+0}l(a,"cs"),i(a,"toVLQSigned");function c(u){var f=(u&1)===1,d=u>>1;return f?-d:d}l(c,"ds"),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")}),ve=P(e=>{function t(S,R,k){if(R in S)return S[R];if(arguments.length===3)return k;throw new Error('"'+R+'" is a required argument.')}l(t,"_s"),i(t,"getArg"),e.getArg=t;var r=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,n=/^data:.+\,.+$/;function s(S){var R=S.match(r);return R?{scheme:R[1],auth:R[2],host:R[3],port:R[4],path:R[5]}:null}l(s,"Be"),i(s,"urlParse"),e.urlParse=s;function o(S){var R="";return S.scheme&&(R+=S.scheme+":"),R+="//",S.auth&&(R+=S.auth+"@"),S.host&&(R+=S.host),S.port&&(R+=":"+S.port),S.path&&(R+=S.path),R}l(o,"ye"),i(o,"urlGenerate"),e.urlGenerate=o;function a(S){var R=S,k=s(S);if(k){if(!k.path)return S;R=k.path}for(var V=e.isAbsolute(R),le=R.
at `+z(ie[Er],wt)),wt.nextPosition=wt.curPosition;return wt.curPosition=wt.nextPosition=null,mr+xr.reverse().join("")}l(de,"Hs"),i(de,"prepareStackTrace");function Ve(Q){var ie=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(Q.stack);if(ie){var Mt=ie[1],Ct=+ie[2],mr=+ie[3],wt=p[Mt];if(!wt&&s&&s.existsSync(Mt))try{wt=s.readFileSync(Mt,"utf8")}catch{wt=""}if(wt){var xr=wt.split(/(?:\r\n|\r|\n)/)[Ct-1];if(xr)return Mt+":"+Ct+`
`+xr+`
`+new Array(mr).join(" ")+"^"}}return null}l(Ve,"zr"),i(Ve,"getErrorSource");function je(Q){var ie=Ve(Q),Mt=b();Mt&&Mt._handle&&Mt._handle.setBlocking&&Mt._handle.setBlocking(!0),ie&&(console.error(),console.error(ie)),console.error(Q.stack),S(1)}l(je,"js"),i(je,"printErrorAndExit");function dr(){var Q=process.emit;process.emit=function(ie){if(ie==="uncaughtException"){var Mt=arguments[1]&&arguments[1].stack,Ct=this.listeners(ie).length>0;if(Mt&&!Ct)return je(arguments[1])}return Q.apply(this,arguments)}}l(dr,"Zs"),i(dr,"shimEmitUncaughtException");var Se=g.slice(0),ze=y.slice(0);e.wrapCallSite=z,e.getErrorSource=Ve,e.mapSourcePosition=xe,e.retrieveSourceMap=we,e.install=function(Q){if(Q=Q||{},Q.environment&&(d=Q.environment,["node","browser","auto"].indexOf(d)===-1))throw new Error("environment "+d+" was unknown. Available options are {auto, browser, node}");if(Q.retrieveFile&&(Q.overrideRetrieveFile&&(g.length=0),g.unshift(Q.retrieveFile)),Q.retrieveSourceMap&&(Q.overrideRetrieveSourceMap&&(y.length=0),y.unshift(Q.retrieveSourceMap)),Q.hookRequire&&!v()){var ie=a(t,"module"),Mt=ie.prototype._compile;Mt.__sourceMapSupport||(ie.prototype._compile=function(wt,xr){return p[xr]=wt,h[xr]=void 0,Mt.call(this,wt,xr)},ie.prototype._compile.__sourceMapSupport=!0)}if(f||(f="emptyCacheBetweenOperations"in Q?Q.emptyCacheBetweenOperations:!1),c||(c=!0,Error.prepareStackTrace=de),!u){var Ct="handleUncaughtExceptions"in Q?Q.handleUncaughtExceptions:!0;try{var mr=a(t,"worker_threads");mr.isMainThread===!1&&(Ct=!1)}catch{}Ct&&_()&&(u=!0,dr())}},e.resetRetrieveHandlers=function(){g.length=0,y.length=0,g=Se.slice(0),y=ze.slice(0),we=R(y),k=R(g)}}),qr=P(()=>{Vr().install()}),Jr=P((exports,module)=>{var Module=Module!==void 0?Module:{},TreeSitter=function(){var initPromise,document=typeof window=="object"?{currentScript:window.document.currentScript}:null;class Parser{static{l(this,"Parser")}static{i(this,"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((e,t)=>{throw t},"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(e){return Module.locateFile?Module.locateFile(e,scriptDirectory):scriptDirectory+e}l(locateFile,"locateFile"),i(locateFile,"locateFile");function logExceptionOnExit(e){e instanceof ExitStatus||err("exiting due to exception: "+e)}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((e,t)=>(e=isFileURI(e)?new URL(e):nodePath.normalize(e),fs.readFileSync(e,t?void 0:"utf8")),"read_"),readBinary=i(e=>{var t=read_(e,!0);return t.buffer||(t=new Uint8Array(t)),t},"readBinary"),readAsync=i((e,t,r)=>{e=isFileURI(e)?new URL(e):nodePath.normalize(e),fs.readFile(e,function(n,s){n?r(n):t(s.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((e,t)=>{if(keepRuntimeAlive())throw process.exitCode=e,t;logExceptionOnExit(t),process.exit(e)},"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(e=>{var t=new XMLHtt
`)[0],x,b=_.match(QUERY_WORD_REGEX)[0];switch(y){case 2:x=new RangeError(`Bad node name '${b}'`);break;case 3:x=new RangeError(`Bad field name '${b}'`);break;case 4:x=new RangeError(`Bad capture name @${b}`);break;case 5:x=new TypeError(`Bad pattern structure at offset ${v}: '${_}'...`),b="";break;default:x=new SyntaxError(`Bad syntax at offset ${v}: '${_}'...`),b=""}throw x.index=v,x.length=b.length,C._free(n),x}let o=C._ts_query_string_count(s),a=C._ts_query_capture_count(s),c=C._ts_query_pattern_count(s),u=new Array(a),f=new Array(o);for(let y=0;y<a;y++){let v=C._ts_query_capture_name_for_id(s,y,TRANSFER_BUFFER),_=getValue(TRANSFER_BUFFER,"i32");u[y]=UTF8ToString(v,_)}for(let y=0;y<o;y++){let v=C._ts_query_string_value_for_id(s,y,TRANSFER_BUFFER),_=getValue(TRANSFER_BUFFER,"i32");f[y]=UTF8ToString(v,_)}let d=new Array(c),p=new Array(c),h=new Array(c),m=new Array(c),g=new Array(c);for(let y=0;y<c;y++){let v=C._ts_query_predicates_for_pattern(s,y,TRANSFER_BUFFER),_=getValue(TRANSFER_BUFFER,"i32");m[y]=[],g[y]=[];let x=[],b=v;for(let S=0;S<_;S++){let R=getValue(b,"i32");b+=SIZE_OF_INT;let k=getValue(b,"i32");if(b+=SIZE_OF_INT,R===PREDICATE_STEP_TYPE_CAPTURE)x.push({type:"capture",name:u[k]});else if(R===PREDICATE_STEP_TYPE_STRING)x.push({type:"string",value:f[k]});else if(x.length>0){if(x[0].type!=="string")throw new Error("Predicates must begin with a literal value");let V=x[0].value,le=!0;switch(V){case"not-eq?":le=!1;case"eq?":if(x.length!==3)throw new Error("Wrong number of arguments to `#eq?` predicate. Expected 2, got "+(x.length-1));if(x[1].type!=="capture")throw new Error(`First argument of \`#eq?\` predicate must be a capture. Got "${x[1].value}"`);if(x[2].type==="capture"){let oe=x[1].name,j=x[2].name;g[y].push(function(z){let de,Ve;for(let je of z)je.name===oe&&(de=je.node),je.name===j&&(Ve=je.node);return de===void 0||Ve===void 0||de.text===Ve.text===le})}else{let oe=x[1].name,j=x[2].value;g[y].push(function(z){for(let de of z)if(de.name===oe)return de.node.text===j===le;return!0})}break;case"not-match?":le=!1;case"match?":if(x.length!==3)throw new Error(`Wrong number of arguments to \`#match?\` predicate. Expected 2, got ${x.length-1}.`);if(x[1].type!=="capture")throw new Error(`First argument of \`#match?\` predicate must be a capture. Got "${x[1].value}".`);if(x[2].type!=="string")throw new Error(`Second argument of \`#match?\` predicate must be a string. Got @${x[2].value}.`);let we=x[1].name,xe=new RegExp(x[2].value);g[y].push(function(oe){for(let j of oe)if(j.name===we)return xe.test(j.node.text)===le;return!0});break;case"set!":if(x.length<2||x.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${x.length-1}.`);if(x.some(oe=>oe.type!=="string"))throw new Error('Arguments to `#set!` predicate must be a strings.".');d[y]||(d[y]={}),d[y][x[1].value]=x[2]?x[2].value:null;break;case"is?":case"is-not?":if(x.length<2||x.length>3)throw new Error(`Wrong number of arguments to \`#${V}\` predicate. Expected 1 or 2. Got ${x.length-1}.`);if(x.some(oe=>oe.type!=="string"))throw new Error(`Arguments to \`#${V}\` predicate must be a strings.".`);let re=V==="is?"?p:h;re[y]||(re[y]={}),re[y][x[1].value]=x[2]?x[2].value:null;break;default:m[y].push({operator:V,operands:x.slice(1)})}x.length=0}}Object.freeze(d[y]),Object.freeze(p[y]),Object.freeze(h[y])}return C._free(n),new Query(INTERNAL,s,u,g,m,Object.freeze(d),Object.freeze(p),Object.freeze(h))}static load(t){let r;if(t instanceof Uint8Array)r=Promise.resolve(t);else{let s=t;if(typeof process<"u"&&process.versions&&process.versions.node){let o=require("fs");r=Promise.resolve(o.readFileSync(s))}else r=fetch(s).then(o=>o.arrayBuffer().then(a=>{if(o.ok)return new Uint8Array(a);{let c=new TextDecoder("utf-8").decode(a);throw new Error(`Language.load failed with status ${o.status}.
${c}`)}}))}let n=typeof loadSideModule=="function"?loadSideModule:loadWebAssemblyModule;return r.then(s=>n(s,{loadAsync:!0})).then(s=>{let o=Object.keys(s),a=o.find(u=>LANGUAGE_FUNCTION_REGEX.test(u)&&!u.includes("external_scanner_"));a||console.log(`Couldn't find language function in WASM file. Symbols:
${JSON.stringify(o,null,2)}`);let c=s[a]();return new Language(INTERNAL,c)})}}class Query{static{l(this,"Query")}static{i(this,"Query")}constructor(t,r,n,s,o,a,c,u){assertInternal(t),this[0]=r,this.captureNames=n,this.textPredicates=s,this.predicates=o,this.setProperties=a,this.assertedProperties=c,this.refutedProperties=u,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(t,r,n,s){r||(r=ZERO_POINT),n||(n=ZERO_POINT),s||(s={});let o=s.matchLimit;if(o===void 0)o=0;else if(typeof o!="number")throw new Error("Arguments must be numbers");marshalNode(t),C._ts_query_matches_wasm(this[0],t.tree[0],r.row,r.column,n.row,n.column,o);let a=getValue(TRANSFER_BUFFER,"i32"),c=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),u=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),f=new Array(a);this.exceededMatchLimit=!!u;let d=0,p=c;for(let h=0;h<a;h++){let m=getValue(p,"i32");p+=SIZE_OF_INT;let g=getValue(p,"i32");p+=SIZE_OF_INT;let y=new Array(g);if(p=unmarshalCaptures(this,t.tree,p,y),this.textPredicates[m].every(v=>v(y))){f[d++]={pattern:m,captures:y};let v=this.setProperties[m];v&&(f[h].setProperties=v);let _=this.assertedProperties[m];_&&(f[h].assertedProperties=_);let x=this.refutedProperties[m];x&&(f[h].refutedProperties=x)}}return f.length=d,C._free(c),f}captures(t,r,n,s){r||(r=ZERO_POINT),n||(n=ZERO_POINT),s||(s={});let o=s.matchLimit;if(o===void 0)o=0;else if(typeof o!="number")throw new Error("Arguments must be numbers");marshalNode(t),C._ts_query_captures_wasm(this[0],t.tree[0],r.row,r.column,n.row,n.column,o);let a=getValue(TRANSFER_BUFFER,"i32"),c=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),u=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),f=[];this.exceededMatchLimit=!!u;let d=[],p=c;for(let h=0;h<a;h++){let m=getValue(p,"i32");p+=SIZE_OF_INT;let g=getValue(p,"i32");p+=SIZE_OF_INT;let y=getValue(p,"i32");if(p+=SIZE_OF_INT,d.length=g,p=unmarshalCaptures(this,t.tree,p,d),this.textPredicates[m].every(v=>v(d))){let v=d[y],_=this.setProperties[m];_&&(v.setProperties=_);let x=this.assertedProperties[m];x&&(v.assertedProperties=x);let b=this.refutedProperties[m];b&&(v.refutedProperties=b),f.push(v)}}return C._free(c),f}predicatesForPattern(t){return this.predicates[t]}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(e,t,r){let n=r-t,s=e.textCallback(t,null,r);for(t+=s.length;t<r;){let o=e.textCallback(t,null,r);if(!(o&&o.length>0))break;t+=o.length,s+=o}return t>r&&(s=s.slice(0,n)),s}l(getText,"getText"),i(getText,"getText");function unmarshalCaptures(e,t,r,n){for(let s=0,o=n.length;s<o;s++){let a=getValue(r,"i32"),c=unmarshalNode(t,r+=SIZE_OF_INT);r+=SIZE_OF_NODE,n[s]={name:e.captureNames[a],node:c}}return r}l(unmarshalCaptures,"unmarshalCaptures"),i(unmarshalCaptures,"unmarshalCaptures");function assertInternal(e){if(e!==INTERNAL)throw new Error("Illegal constructor")}l(assertInternal,"assertInternal"),i(assertInternal,"assertInternal");function isPoint(e){return e&&typeof e.row=="number"&&typeof e.column=="number"}l(isPoint,"isPoint"),i(isPoint,"isPoint");function marshalNode(e){let t=TRANSFER_BUFFER;setValue(t,e.id,"i32"),t+=SIZE_OF_INT,setValue(t,e.startIndex,"i32"),t+=SIZE_OF_INT,setValue(t,e.startPosition.row,"i32"),t+=SIZE_OF_INT,setValue(t,e.startPosition.column,"i32"),t+=SIZE_OF_INT,setValue(t,e[0],"i32")}l(marshalNode,"marshalNode"),i(marshalNode,"marshalNode");function unmarshalNode(e,t=TRANSFER_BUFFER){let r=getValue(t,"i32");if(r===0)return null;let n=getValue(t+=SIZE_OF_INT,"i32"),s=getValue(t+=SIZE_OF_INT,"i32"),o=getValue(t+=SIZE_OF_INT,"i32"),a=getValue(t+=SIZE_OF_INT,"i32"),c=new Node(INTERNAL,e);return c.id=r,c.startIndex=n,c.startPosition={row:s,column:o},c[0]=a,c}l(unmarshalNode,"unmarshalNode"),i(unmarshalNode,"unmarshalNode");function marshalTreeCursor(e,t=TRANSFER_BUFFER){setValue(t+0*SIZE_OF_INT,e[0],"i32"),setValue(t+1*SIZE_OF_INT,e[1],"i32"),setValue(t+2*SIZE_OF_INT,e[2],"i32")}l(marshalTreeCursor,"marshalTreeCursor"),i(marshalTreeCursor,"marshalTreeCursor");function unmarshalTreeCursor(e){e[0]=getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),e[1]=getValue(TRANSF
`).slice(1).filter(a=>a.trim().length>0);this.bpe_ranks=yo(o,Ze(0,o.length)),wo(this.byte_encoder),this.byte_encoder.forEach((a,c,u)=>{this.byte_decoder.set(a,c)})}static{i(this,"BPETokenizer")}byteEncodeStr(e){return this.encodeStr(e).map(t=>this.byte_encoder.get(t))}mutatingConcat(e,t){for(let r=0;r<t.length;r++)e.push(t[r]);return e}bpe(e){if(this.cache.has(e))return this.cache.get(e);let t=this.byteEncodeStr(e),r=Nn(t);if(!r)return t.map(s=>this.encoder.get(s));for(;;){let s=new Map;r.forEach(p=>{let h=p.join(" "),m=this.bpe_ranks.get(h);s.set(m===void 0||isNaN(m)?1e11:m,p)});let o=Array.from(s.keys()).map(p=>Number(p)),a=s.get(Math.min(...o));if(!a||!this.bpe_ranks.has(a.join(" ")))break;let c=a[0],u=a[1],f=[],d=0;for(;d<t.length;){let p=t.indexOf(c,d);if(p===-1){this.mutatingConcat(f,t.slice(d));break}this.mutatingConcat(f,t.slice(d,p)),d=p,t[d]===c&&d<t.length-1&&t[d+1]===u?(f.push(c+u),d=d+2):(f.push(t[d]),d=d+1)}if(t=f,t.length===1)break;r=Nn(t)}let n=t.map(s=>this.encoder.get(s));return this.cache.set(e,n),n}tokenize(e){let t=[];for(let[r]of e.matchAll(this.pat)){let n=this.bpe(r);this.mutatingConcat(t,n)}return t}tokenLength(e){return this.tokenize(e).length}takeLastTokens(e,t){if(t<=0)return"";let r=4,n=1,s=Math.min(e.length,t*r),o=e.slice(-s),a=this.tokenize(o);for(;a.length<t+2&&s<e.length;)s=Math.min(e.length,s+t*n),o=e.slice(-s),a=this.tokenize(o);return a.length<t?e:(a=a.slice(-t),this.detokenize(a))}takeFirstTokens(e,t){if(t<=0)return{text:"",tokens:[]};let r=4,n=1,s=Math.min(e.length,t*r),o=e.slice(0,s),a=this.tokenize(o);for(;a.length<t+2&&s<e.length;)s=Math.min(e.length,s+t*n),o=e.slice(0,s),a=this.tokenize(o);return a.length<t?{text:e,tokens:a}:(a=a.slice(0,t),{text:this.detokenize(a),tokens:a})}takeLastLinesTokens(e,t){let r=this.takeLastTokens(e,t);if(r.length===e.length||e[e.length-r.length-1]===`
`)return r;let n=r.indexOf(`
`);return r.substring(n+1)}detokenize(e){let t=e.map(r=>this.decoder.get(r)).join("");return t=Ln(t.split("").map(r=>this.byte_decoder.get(r))),t}tokenizeStrings(e){return this.tokenize(e).map(t=>Ln(this.decoder.get(t).split("").map(r=>this.byte_decoder.get(r))))}},Dt=class{static{l(this,"Dt")}constructor(){this.hash=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t&=t&65535}return t}}static{i(this,"MockTokenizer")}tokenize(e){return this.tokenizeStrings(e).map(this.hash)}detokenize(e){return e.map(t=>t.toString()).join(" ")}tokenizeStrings(e){return e.split(/\b/)}tokenLength(e){return this.tokenizeStrings(e).length}takeLastTokens(e,t){return this.tokenizeStrings(e).slice(-t).join("")}takeFirstTokens(e,t){let r=this.tokenizeStrings(e).slice(0,t);return{text:r.join(""),tokens:r.map(this.hash)}}takeLastLinesTokens(e,t){let r=this.takeLastTokens(e,t);if(r.length===e.length||e[e.length-r.length-1]===`
`)return r;let n=r.indexOf(`
`);return r.substring(n+1)}};function Ke(e,t,r){return{type:"virtual",indentation:e,subs:t,label:r}}l(Ke,"Ke");i(Ke,"virtualNode");function Bt(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(Bt,"Bt");i(Bt,"lineNode");function Je(e){return{type:"blank",lineNumber:e,subs:[]}}l(Je,"Je");i(Je,"blankNode");function Le(e){return{type:"top",indentation:-1,subs:e??[]}}l(Le,"Le");i(Le,"topNode");function M(e){return e.type==="blank"}l(M,"M");i(M,"isBlank");function U(e){return e.type==="line"}l(U,"U");i(U,"isLine");function A(e){return e.type==="virtual"}l(A,"A");i(A,"isVirtual");function Y(e){return e.type==="top"}l(Y,"Y");i(Y,"isTop");function vo(e,t){function r(n){if(!A(n)&&!Y(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(vo,"vo");i(vo,"cutTreeAfterLine");function Eo(e){return JSON.parse(JSON.stringify(e))}l(Eo,"Eo");i(Eo,"duplicateTree");function Pn(e){return T(e,t=>{t.label=void 0},"bottomUp"),e}l(Pn,"Pn");i(Pn,"clearLabels");function Wt(e,t){return T(e,r=>{r.label=r.label?t(r.label)?void 0:r.label:void 0},"bottomUp"),e}l(Wt,"Wt");i(Wt,"clearLabelsIf");function q(e,t){switch(e.type){case"line":case"virtual":let r=e.subs.map(n=>q(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=>q(n,t)),label:e.label?t(e.label):void 0}}}l(q,"q");i(q,"mapLabels");function So(e){let t=0;function r(n){!A(n)&&!Y(n)&&(n.lineNumber=t,t++)}l(r,"n"),i(r,"visitor"),T(e,r,"topDown")}l(So,"So");i(So,"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 Mo(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(Mo,"Mo");i(Mo,"visitTreeConditionally");function Ne(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(Ne,"Ne");i(Ne,"foldTree");function ke(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:Le()}l(ke,"ke");i(ke,"rebuildTree");function Cn(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[Bt(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(Je(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(Je(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 Le(a)}l(Cn,"Cn");i(Cn,"parseRaw");function me(e,t){function r(n){if(U(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(me,"me");i(me,"labelLines");function Pe(e){function t(r){if(A(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(Pe,"Pe");i(Pe,"labelVirtualInherited");function pe(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(pe,"pe");i(pe,"buildLabelRules");function Qe(e){let t=ke(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&&U(c))c.subs.push(a),a.subs.forEach(u=>c.subs.push(u)),a.subs=[];else if(a.label==="closer"&&s!==void 0&&(U(a)||A(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?[Ke(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 Wt(e,r=>r==="newVirtual"),t}l(Qe,"Qe");i(Qe,"combineClosersAndOpeners");function Ut(e,t=M,r){return ke(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=Ke(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??d.indentation)}return u(!0),n.subs=s,n},"rebuilder"))}l(Ut,"Ut");i(Ut,"groupBlocks");function H(e){return ke(e,i(function(t){return A(t)&&t.label===void 0&&t.subs.length<=1?t.subs.length===0?void 0:t.subs[0]:(t.subs.length===1&&A(t.subs[0])&&t.subs[0].label===void 0&&(t.subs=t.subs[0].subs),t)},"rebuilder"))}l(H,"H");i(H,"flattenVirtual");var To={opener:/^[\[({]/,closer:/^[\])}]/},xo=pe(To),An={};function Xe(e,t){An[e]=t}l(Xe,"Xe");i(Xe,"registerLanguageSpecificParser");function ee(e,t){let r=Cn(e),n=An[t??""];return n?n(r):(me(r,xo),Qe(r))}l(ee,"ee");i(ee,"parseTree");var Io={package:/^package /,import:/^import /,class:/\bclass /,interface:/\binterface /,javadoc:/^\/\*\*/,comment_multi:/^\/\*[^*]/,comment_single:/^\/\//,annotation:/^@/,opener:/^[\[({]/,closer:/^[\])}]/},Lo=pe(Io);function Fn(e){let t=e;return me(t,Lo),t=Qe(t),t=H(t),Pe(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(Fn,"Fn");i(Fn,"processJava");var No={heading:/^# /,subheading:/^## /,subsubheading:/### /},ko=pe(No);function Rn(e){let t=e;if(me(t,ko),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=Ut(t),t=H(t),Pe(t),t}l(Rn,"Rn");i(Rn,"processMarkdown");function Ce(e){return" ".repeat(e.indentation)+e.sourceLine+`
`}l(Ce,"Ce");i(Ce,"deparseLine");function On(e){function t(r,n){let s="";return U(r)?s=Ce(r):M(r)&&(s=`
`),n+s}return l(t,"e"),i(t,"accumulator"),Ne(e,"",t,"topDown")}l(On,"On");i(On,"deparseTree");function Po(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:On(a)}),s=""):(U(a)&&(s+=Ce(a)),a.subs.forEach(o))}return l(o,"s"),i(o,"visit"),o(e),s!==""&&n.push({label:void 0,source:s}),n}l(Po,"Po");i(Po,"deparseAndCutTree");function Dn(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=>Dn(a,t+2)).join(`,
`),n===""?n="[]":n=`[
${n}
${r}]`;let s=(A(e)||Y(e)?" ":String(e.lineNumber).padStart(3," "))+`: ${r}`,o=e.label===void 0?"":JSON.stringify(e.label);return A(e)||Y(e)?`${s}vnode(${e.indentation}, ${o}, ${n})`:M(e)?`${s}blank(${o??""})`:`${s}lnode(${e.indentation}, ${o}, ${JSON.stringify(e.sourceLine)}, ${n})`}l(Dn,"Dn");i(Dn,"describeTree");function Bn(e,t=""){let r=e.label===void 0?"":`, ${JSON.stringify(e.label)}`,n=!M(e)&&e.subs.length>0?`[
${e.subs.map(s=>Bn(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(Bn,"Bn");i(Bn,"encodeTree");function Wn(e){if(U(e)||M(e))return e.lineNumber;for(let t of e.subs){let r=Wn(t);if(r!==void 0)return r}}l(Wn,"Wn");i(Wn,"firstLineOf");function Un(e){let t,r=e.subs.length-1;for(;r>=0&&t===void 0;)t=Un(e.subs[r]),r--;return t===void 0&&!A(e)&&!Y(e)?e.lineNumber:t}l(Un,"Un");i(Un,"lastLineOf");Xe("markdown",Rn);Xe("java",Fn);var zn={worthUp:.9,worthSibling:.88,worthDown:.8};function fe(e,t=zn){let r=q(e,n=>n?1:void 0);return T(r,n=>{if(M(n))return;let s=n.subs.reduce((o,a)=>Math.max(o,a.label??0),0);n.label=Math.max(n.label??0,s*t.worthUp)},"bottomUp"),T(r,n=>{if(M(n))return;let s=n.subs.map(c=>c.label??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"),Vn(r)}l(fe,"fe");i(fe,"fromTreeWithFocussedLines");function Vn(e){let t=Ne(e,[],(r,n)=>((r.type==="line"||r.type==="blank")&&n.push(r.type==="line"?[Ce(r).trimEnd(),r.label??0]:["",r.label??0]),n),"topDown");return new Ae(t)}l(Vn,"Vn");i(Vn,"fromTreeWithValuedLines");function zt(e,t=!0,r=!0){let n=typeof e=="string"?ee(e):ee(e.source,e.languageId);H(n);let s=q(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||=(U(o)||M(o))&&o.lineNumber==0},"topDown"),fe(s)}l(zt,"zt");i(zt,"elidableTextForSourceCode");var ge=class G${static{l(this,"t")}constructor(t,r,n=W().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")}static{i(this,"LineWithValueAndCost")}get value(){return this._value}get cost(){return this._cost}adjustValue(t){return this._value*=t,this}recost(t=r=>W().tokenLength(r+`
`)){return this._cost=t(this.text),this}copy(){return new G$(this.text,this.value,this.cost,"none")}},Ae=class z${static{l(this,"t")}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 ge(a,s))):o instanceof z$?o.lines.forEach(a=>r.push(a.copy().adjustValue(s))):"source"in o&&"languageId"in o&&zt(o).lines.forEach(a=>r.push(a.copy().adjustValue(s)))}this.lines=r}static{i(this,"ElidableText")}adjust(t){this.lines.forEach(r=>r.adjustValue(t))}recost(t=r=>W().tokenLength(r+`
`)){this.lines.forEach(r=>r.recost(t))}makePrompt(t,r="[...]",n=!0,s="removeLeastDesirable",o=W()){let a=this.lines.map(c=>c.copy());return Co(a,t,r,n,s,o)}};function Co(e,t,r,n,s,o){if(o.tokenLength(r+`
`)>t)throw new Error("maxTokens must be larger than the ellipsis length");s==="removeLeastBangForBuck"&&e.forEach(p=>p.adjustValue(1/p.cost));let a=e.reduce((p,h)=>Math.max(p,h.value),0)+1,c=e.reduce((p,h)=>Math.max(p,h.text.length),0)+1,u=r.trim(),f=e.reduce((p,h)=>p+h.cost,0),d=e.length+1;for(;f>t&&d-->=-1;){let p=e.reduce((x,b)=>b.value<x.value?b:x),h=e.indexOf(p),m=e.slice(0,h+1).reverse().find(x=>x.text.trim()!=="")??{text:""},g=n?Math.min(m.text.match(/^\s*/)?.[0].length??0,e[h-1]?.text.trim()===u?e[h-1]?.text.match(/^\s*/)?.[0].length??0:c,e[h+1]?.text.trim()===u?e[h+1]?.text.match(/^\s*/)?.[0].length??0:c):0,y=" ".repeat(g)+r,v=new ge(y,a,o.tokenLength(y+`
`),"loose");e.splice(h,1,v),e[h+1]?.text.trim()===u&&e.splice(h+1,1),e[h-1]?.text.trim()===u&&e.splice(h-1,1);let _=e.reduce((x,b)=>x+b.cost,0);_>=f&&e.every(x=>x.value===a)&&(n=!1),f=_}if(d<0)throw new Error("Infinite loop in ElidableText.makePrompt: Defensive counter < 0 in ElidableText.makePrompt with end text");return e.map(p=>p.text).join(`
`)}l(Co,"Co");i(Co,"makePrompt");function G(){}l(G,"G");i(G,"Diff");G.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,S=_&&0<=x&&x<c;if(!b&&!S){d[g]=void 0;continue}if(!b||S&&v.newPos<_.newPos?(y=Fo(_),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(Ao(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 Ao(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(Ao,"Ao");i(Ao,"buildValues");function Fo(e){return{newPos:e.newPos,components:e.components.slice(0)}}l(Fo,"Fo");i(Fo,"clonePath");var za=new G,qn=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Hn=/\S/,jn=new G;jn.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!Hn.test(e)&&!Hn.test(t)};jn.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]&&qn.test(t[r])&&qn.test(t[r+2])&&(t[r]+=t[r+2],t.splice(r+1,2),r--);return t};var Zt=new G;Zt.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 Ro(e,t,r){return Zt.diff(e,t,r)}l(Ro,"Ro");i(Ro,"diffLines");var Oo=new G;Oo.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Do=new G;Do.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function Ye(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ye=i(function(t){return typeof t},"_typeof"):Ye=i(function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},"_typeof"),Ye(e)}l(Ye,"Ye");i(Ye,"_typeof");function Vt(e){return Bo(e)||Wo(e)||Uo(e)||zo()}l(Vt,"Vt");i(Vt,"_toConsumableArray");function Bo(e){if(Array.isArray(e))return qt(e)}l(Bo
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}l(zo,"zo");i(zo,"_nonIterableSpread");var Vo=Object.prototype.toString,Fe=new G;Fe.useLongestToken=!0;Fe.tokenize=Zt.tokenize;Fe.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(Ht(e,null,null,s),s," ")};Fe.equals=function(e,t){return G.prototype.equals.call(Fe,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"))};function Ht(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(Vo.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]=Ht(e[o],t,r,n,s);return t.pop(),r.pop(),a}if(e&&e.toJSON&&(e=e.toJSON()),Ye(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]=Ht(e[u],t,r,n,u);t.pop(),r.pop()}else a=e;return a}l(Ht,"Ht");i(Ht,"canonicalize");var jt=new G;jt.tokenize=function(e){return e.slice()};jt.join=jt.removeEmpty=function(e){return e};function Zn(e,t,r,n,s,o,a){a||(a={}),typeof a.context>"u"&&(a.context=4);var c=Ro(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 S;if(!d){var R=c[_-1];d=m,p=g,R&&(h=a.context>0?u(R.lines.slice(-a.context)):[],d-=h.length,p-=h.length)}(S=h).push.apply(S,Vt(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 k;(k=h).push.apply(k,Vt(u(b)))}else{var V,le=Math.min(b.length,a.context);(V=h).push.apply(V,Vt(u(b.slice(0,le))));var we={oldStart:d,oldLines:m-d+le,newStart:p,newLines:g-p+le,lines:h};if(_>=c.length-2&&b.length<=a.context){var xe=/\n$/.test(r),re=/\n$/.test(n),oe=b.length==0&&h.length>we.oldLines;!xe&&oe&&r.length>0&&h.splice(we.oldLines,0,"\\ No newline at end of file"),(!xe&&!oe||!re)&&h.push("\\ No newline at end of file")}f.push(we),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(Zn,"Zn");i(Zn,"structuredPatch");function Ho(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=Zn("","",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=q(H(ee(e,r)),()=>!1),c=q(H(ee(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"),[fe(a),fe(c)]}l(Ho,"Ho");i(Ho,"elidableTextForDiff");var et=class{static{l(this,"et")}static{i(this,"FileSystem")}},tt={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:""},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","plaintext"],$n={html:"<!DOCTYPE html>",python:"#!/usr/bin/env python3",ruby:"#!/usr/bin/env ruby",shellscript:"#!/bin/sh",yaml:"# YAML data"};function Zo({source:e}){return e.startsWith("#!")||e.startsWith("<!DOCTYPE")}l(Zo,"Zo");i(Zo,"hasLanguageMarker");function Re(e,t){let r=tt[t];if(r){let n=r.end==""?"":" "+r.end;return`${r.start} ${e}${n}`}return""}l(Re,"Re");i(Re,"comment");function nt(e,t){if(!tt[t]||
`),n=(r?e.slice(0,-1):e).split(`
`).map(s=>Re(s,t)).join(`
`);return r?n+`
`:n}l(nt,"nt");i(nt,"commentBlockAsSingles");function Gn(e){let{languageId:t}=e;return jo.indexOf(t)===-1&&!Zo(e)?t in $n?$n[t]:Re(`Language: ${t}`,t):""}l(Gn,"Gn");i(Gn,"getLanguageMarker");function Kn(e){return e.relativePath?Re(`Path: ${e.relativePath}`,e.languageId):""}l(Kn,"Kn");i(Kn,"getPathMarker");function rt(e){return e===""||e.endsWith(`
`)?e:e+`
`}l(rt,"rt");i(rt,"newLineEnded");var $o={tokenizerName:"cl100k"};function Go(e){return{...$o,...e}}l(Go,"Go");i(Go,"cursorContextOptions");function ot(e,t={}){let r=Go(t),n=W(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(ot,"ot");i(ot,"getCursorContext");var st=class{static{l(this,"st")}constructor(){this.used=new Map,this.unused=new Map}static{i(this,"PromptBackground")}add(e){for(let[t,r]of e.used)this.used.set(t,r);for(let[t,r]of e.unused)this.unused.set(t,r)}markUsed(e){this.IsSnippet(e)&&this.used.set(e.id,this.convert(e))}undoMarkUsed(e){this.IsSnippet(e)&&this.used.delete(e.id)}markUnused(e){this.IsSnippet(e)&&this.unused.set(e.id,this.convert(e))}convert(e){return{score:e.score.toFixed(4),length:e.text.length}}IsSnippet(e){return e.kind=="SimilarFile"||e.kind=="RetrievalSnippet"}},it=class{static{l(this,"it")}constructor(){this.used=new Map,this.unused=new Map,this.usedCounts=new Map,this.unusedCounts=new Map}static{i(this,"PromptChoices")}add(e){for(let[t,r]of e.used)this.used.set(t,(this.used.get(t)||0)+r);for(let[t,r]of e.unused)this.unused.set(t,(this.unused.get(t)||0)+r);for(let[t,r]of e.usedCounts)this.usedCounts.set(t,(this.usedCounts.get(t)||0)+r);for(let[t,r]of e.unusedCounts)this.unusedCounts.set(t,(this.unusedCounts.get(t)||0)+r)}markUsed(e){this.used.set(e.kind,(this.used.get(e.kind)||0)+e.tokens),e.kind=="BeforeCursor"?this.usedCounts.set(e.kind,(this.usedCounts.get(e.kind)||0)+e.text.split(`
`).length):this.usedCounts.set(e.kind,(this.usedCounts.get(e.kind)||0)+1)}undoMarkUsed(e){this.used.set(e.kind,(this.used.get(e.kind)||0)-e.tokens),e.kind=="BeforeCursor"?this.usedCounts.set(e.kind,(this.usedCounts.get(e.kind)||0)-e.text.split(`
`).length):this.usedCounts.set(e.kind,(this.usedCounts.get(e.kind)||0)-1)}markUnused(e){this.unused.set(e.kind,(this.unused.get(e.kind)||0)+e.tokens),e.kind=="BeforeCursor"?this.unusedCounts.set(e.kind,(this.unusedCounts.get(e.kind)||0)+e.text.split(`
`).length):this.unusedCounts.set(e.kind,(this.unusedCounts.get(e.kind)||0)+1)}},Oe=class{static{l(this,"Oe")}static{i(this,"PromptOrderList")}constructor(e="default"){switch(e){default:this._rankedList=["LanguageMarker","PathMarker","RetrievalSnippet","SimilarFile","BeforeCursor"]}}get rankedList(){return this._rankedList}sortElements(e){return e.sort((t,r)=>{let n=this._rankedList.indexOf(t.kind),s=this._rankedList.indexOf(r.kind);if(n===-1||s===-1)throw`Invalid element kind: ${t.kind} or ${r.kind}, not found in prompt element ordering list`;return n===s?t.id-r.id:n-s})}},at=class extends Oe{static{l(this,"at")}static{i(this,"PromptPriorityList")}constructor(e="default"){switch(super(),e){default:this._rankedList=["BeforeCursor","SimilarFile","RetrievalSnippet","PathMarker","LanguageMarker"]}}sortElements(e){return e.sort((t,r)=>{let n=this._rankedList.indexOf(t.kind),s=this._rankedList.indexOf(r.kind);if(n===-1||s===-1)throw`Invalid element kind: ${t.kind} or ${r.kind}, not found in snippet provider priority list`;return n===s?r.id-t.id:n-s})}};function ct(e){switch(e){case"neighboring-tabs":return"SimilarFile";case"retrieval":return"RetrievalSnippet";case"path":return"PathMarker";case"language":return"LanguageMarker";default:throw new Error(`Unknown snippet provider type ${e}`)}}l(ct,"ct");i(ct,"kindForSnippetProviderType");var lt=class{static{l(this,"lt")}constructor(e){this.ranges=new Array;let t=0,r;for(let n of e)n.text.length!==0&&(r==="BeforeCursor"&&n.kind==="BeforeCursor"?this.ranges[this.ranges.length-1].end+=n.text.length:this.ranges.push({kind:n.kind,start:t,end:t+n.text.length}),r=n.kind,t+=n.text.length)}static{i(this,"PromptElementRanges")}},ut=class{static{l(this,"ut")}constructor(e,t,r,n,s){this.tokenizer=e,this.lineEndingOption=t,this.orderingList=r,this.snippetTextProcessor=n,this.priorityList=s,this.content=[],this.basePromptBackground=new st,this.baseTallyOfChoices=new it}static{i(this,"PromptWishlist")}extMarkUnused(e){this.basePromptBackground.markUnused(e),this.baseTallyOfChoices.markUnused(e)}getContent(){return[...this.content]}convertLineEndings(e){return this.lineEndingOption==="unix"&&(e=e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)),e}append(e,t,r=this.tokenizer.tokenLength(e),n=NaN){e=this.convertLineEndings(e);let s=this.content.length;return this.content.push({id:s,text:e,kind:t,tokens:r,score:n}),s}fulfill(e){let t=new st;t.add(this.basePromptBackground);let r=new it;r.add(this.baseTallyOfChoices);function n(m){t.markUsed(m),r.markUsed(m)}l(n,"o"),i(n,"markUsed");function s(m){t.undoMarkUsed(m),r.undoMarkUsed(m)}l(s,"s"),i(s,"undoMarkUsed");function o(m){t.markUnused(m),r.markUnused(m)}l(o,"a"),i(o,"markUnused"),this.priorityList.sortElements(this.content);let a,c=[],u=e;this.content.forEach(m=>{if(u>0||a===void 0){let g=m.tokens;if(u>=g)u-=g,n(m),c.push(m);else if(m.kind==="BeforeCursor"){let{summarizedElement:y,removedMaterial:v}=this.snippetTextProcessor.summarize(this.tokenizer,m,u);m=y,g=m.tokens,u-=g,m.text.length>0&&n(m),v.text.length>0&&o(v),c.push(m)}else a===void 0?a=m:o(m)}else o(m)}),this.orderingList.sortElements(c);let f=c.reduce((m,g)=>m+g.text,""),d=this.tokenizer.tokenLength(f);for(;d>e;){this.priorityList.sortElements(c);let m=c.pop();m&&(s(m),o(m),a!==void 0&&o(a),a=void 0),this.orderingList.sortElements(c),f=c.reduce((g,y)=>g+y.text,""),d=this.tokenizer.tokenLength(f)}let p=[...c];if(a!==void 0){p.push(a),this.orderingList.sortElements(p);let m=p.reduce((y,v)=>y+v.text,""),g=this.tokenizer.tokenLength(m);if(g<=e){n(a);let y=new lt(p);return{prefix:m,suffix:"",prefixLength:g,suffixLength:0,promptChoices:r,promptBackground:t,promptElementRanges:y}}else o(a)}let h=new lt(c);return{prefix:f,suffix:"",prefixLength:d,suffixLength:0,promptChoices:r,promptBackground:t,promptElementRanges:h}}},K=(e=>(e.NeighboringTabs="neighboring-tabs",e.Retrieval="retrieval",e.Language="language",e.Path="path",e))(K||{}),he=(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))(he||{}),Ko={function:"function",snippet:"snippet",variable:"variable",parameter:"parameter",method:"method",class:"class",module:"module",alias:"alias","enum member":"enum member",interface:"interface"};function Jo(e,t){let r=Ko[e.semantics],n=(e.relativePath?`Compare this ${r} from ${e.relativePath}:`:`Compare this ${r}:`)+`
`+e.snippet;return n.endsWith(`
`)||(n+=`
`),nt(n,t)}l(Jo,"Jo");i(Jo,"announceSnippet");function Jn(e){e.sort((t,r)=>r.score-t.score)}l(Jn,"Jn");i(Jn,"sortSnippetsDescending");function Qo(e,t,r){if(t==0)return[];let n=e.map(o=>({...o,kind:ct(o.provider)})),s=[];return r.rankedList.forEach(o=>{let a=n.filter(({kind:c})=>c===o);Jn(a),s.push(...a)}),s.slice(0,t)}l(Qo,"Qo");i(Qo,"selectSnippets");function Qn(e,t,r,n,s){let o=Qo(e,s,n).map(a=>{let c=Jo(a,t),u=r.tokenLength(c);return{announcedSnippet:c,provider:a.provider,score:a.score,tokens:u,relativePath:a.relativePath}});return Jn(o),o.reverse(),o}l(Qn,"Qn");i(Qn,"processSnippetsForWishlist");var Gt=class{static{l(this,"Gt")}constructor(e){this.keys=[],this.cache={},this.size=e}static{i(this,"FifoCache")}put(e,t){if(this.cache[e]=t,this.keys.length>this.size){this.keys.push(e);let r=this.keys.shift()??"";delete this.cache[r]}}get(e){return this.cache[e]}},Kt=class{static{l(this,"Kt")}static{i(this,"Tokenizer")}constructor(e){this.stopsForLanguage=ts.get(e.languageId)??es}tokenize(e){return new Set(Xo(e).filter(t=>!this.stopsForLanguage.has(t)))}},Xn=new Gt(20),dt=class{static{l(this,"dt")}static{i(this,"WindowedMatcher")}constructor(e){this.referenceDoc=e,this.tokenizer=new Kt(e)}get referenceTokens(){return this.tokenizer.tokenize(this._getCursorContextInfo(this.referenceDoc).context)}sortScoredSnippets(e,t="descending"){return t=="ascending"?e.sort((r,n)=>r.score>n.score?1:-1):t=="descending"?e.sort((r,n)=>r.score>n.score?-1:1):e}retrieveAllSnippets(e,t="descending"){let r=[];if(e.source.length===0||this.referenceTokens.size===0)return r;let n=e.source.split(`
`),s=this.id()+":"+e.source,o=Xn.get(s)??[],a=o.length==0,c=a?n.map(this.tokenizer.tokenize,this.tokenizer):[];for(let[u,[f,d]]of this.getWindowsDelineations(n).entries()){if(a){let m=new Set;c.slice(f,d).forEach(g=>g.forEach(m.add,m)),o.push(m)}let p=o[u],h=this.similarityScore(p,this.referenceTokens);r.push({score:h,startLine:f,endLine:d})}return a&&Xn.put(s,o),this.sortScoredSnippets(r,t)}async findMatches(e){let t=await this.findBestMatch(e);return t?[t]:[]}async findBestMatch(e){if(e.source.length===0||this.referenceTokens.size===0)return;let t=e.source.split(`
`),r=this.retrieveAllSnippets(e,"descending");return r.length===0||r[0].score===0?void 0:{snippet:t.slice(r[0].startLine,r[0].endLine).join(`
`),semantics:"snippet",provider:"neighboring-tabs",...r[0]}}};function Xo(e){return e.split(/[^a-zA-Z0-9]/).filter(t=>t.length>0)}l(Xo,"Xo");i(Xo,"splitIntoWords");var Yo=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"]),es=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",...Yo]),ts=new Map([]);function Yn(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(Yn,"Yn");i(Yn,"getBasicWindowDelineations");var _t=class W$ extends dt{static{l(this,"t")}constructor(t,r){super(t),this.windowLength=r}static{i(this,"FixedWindowSizeJaccardMatcher")}static{this.FACTORY=t=>({to:r=>new W$(r,t)})}id(){return"fixed:"+this.windowLength}getWindowsDelineations(t){return Yn(this.windowLength,t)}_getCursorContextInfo(t){return ot(t,{maxLineCount:this.windowLength})}similarityScore(t,r){return ns(t,r)}};function ns(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(ns,"ns");i(ns,"computeScore");var De=(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))(De||{}),rs={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}},os=1e4,ss=20;function is(e,t){return _t.FACTORY(t.snippetLength).to(e)}l(is,"is");i(is,"getMatcher");async function er(e,t,r){let n={...rs[r]},s=is(e,n);return n.numberOfSnippets===0?[]:(await t.filter(o=>o.source.length<os&&o.source.length>0).slice(0,ss).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(er,"er");i(er,"getNeighborSnippets");function tr(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(tr,"tr");i(tr,"truncateFirstLinesFirst");var mt=class{static{l(this,"mt")}static{i(this,"SnippetTextProcessor")}constructor(e="default"){switch(e){case"default":default:this.kindToFunctionMap=new Map([["BeforeCursor",tr]])}}isSummarizationAvailable(e){return this.kindToFunctionMap.has(e)}summarize(e,t,r){return this.kindToFunctionMap.get(t.kind)(e,t,r)}};function nr(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(nr,"nr");i(nr,"findEditDistanceScore");var J={text:"",tokens:[]},rr=1500,pt=50,or=5,sr=4,$t=(e=>(e.ConvertToUnix="unix",e.KeepOriginal="keep",e))($t||{}),ir=(e=>(e.None="none",e.FifteenPercent="fifteenPercent",e))(ir||{}),ar=(e=>(e.Equal="equal",e.Levenshtein="levenshteineditdistance",e))(ar||{}),lr=(e=>(e.Cursor="cursor",e.CursorTrimStart="cursortrimstart",e))(lr||{}),ft=class{static{l(this,"ft")}constructor(e,t){if(this.fs=e,this.maxPromptLength=rr,this.numberOfSnippets=sr,this.neighboringTabs="eager",this.lineEnding="unix",this.suffixPercent=0,this.suffixStartMode="cursor",this.tokenizerName="cl100k",this.suffixMatchThreshold=0,this.suffixMatchCriteria="levenshteineditdistance",this.fimSuffixLengthThreshold=0,this.promptOrderListPreset="default",this.promptPriorityPreset="default",this.snippetTextProcessingPreset="default",Object.assign(this,t),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}`);if(this.fimSuffixLengthThreshold<-1)throw new Error(`fimSuffixLengthThreshold must be at least -1, but was ${this.fimSuffixLengthThreshold}`)}static{i(this,"PromptOptions")}},ls={javascriptreact:"javascript",jsx:"javascript",typescriptreact:"typescript",jade:"pug",cshtml:"razor"};function be(e){return e=e.toLowerCase(),ls[e]??e}l(be,"be");i(be,"normalizeLanguageId");async function us(e,t,r={},n=[]){let s=new ft(e,r),o=W(s.tokenizerName),a=new mt(s.snippetTextProcessingPreset),c=new Oe(s.promptOrderListPreset),u=new at(s.promptPriorityPreset),f=!1,{source:d,offset:p}=t;if(p<0||p>d.length)throw new Error(`Offset ${p} is out of range.`);t.languageId=be(t.languageId);let h=new ut(o,s.lineEnding,c,a,u),m=n.find(x=>x.provider==="path"),g=n.find(x=>x.provider==="language");m!==void 0&&m.snippet.length>0?(h.append(m.snippet,"PathMarker"),g&&h.extMarkUnused({text:g.snippet,kind:"LanguageMarker",tokens:o.tokenLength(g.snippet),id:NaN,score:NaN})):g&&h.append(g.snippet,"LanguageMarker"),n=n.filter(x=>x.provider!=="language"&&x.provider!=="path");function y(){Qn(n,t.languageId,o,u,s.numberOfSnippets).forEach(x=>{let b=ct(x.provider);h.append(x.announcedSnippet,b,x.tokens,x.score)})}l(y,"p"),i(y,"addSnippetsNow"),y();let v=d.substring(0,p);h.append(v,"BeforeCursor");let _=d.slice(p);if(s.suffixPercent===0||_.length<=s.fimSuffixLengthThreshold)return h.fulfill(s.maxPromptLength);{let x=t.offset,b=s.maxPromptLength-or,S=Math.floor(b*(100-s.suffixPercent)/100),R=h.fulfill(S),k=b-R.prefixLength,V=d.slice(x);s.suffixStartMode==="cursortrimstart"&&(V=V.trimStart());let le=o.takeFirstTokens(V,k);return le.tokens.length<=k-3&&(S=b-le.tokens.length,R=h.fulfill(S)),s.suffixMatchCriteria==="equal"?le.tokens.length===J.tokens.length&&le.tokens.ever
(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`,Xs={python:[[`(function_definition body: (block
(expression_statement (string))? @docstring) @body) @function`],['(ERROR ("def" (identifier) (parameters))) @function']],javascript:[[vn]],typescript:[[vn]],tsx:[[vn]],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`]]},Ys='(call_expression function: ((identifier) @req (#eq? @req "require")))',Qr=`(variable_declarator value: ${Ys})`,no=`
(lexical_declaration ${Qr}+)
(variable_declaration ${Qr}+)
`,Xr=[[`(program [ ${no} ] @import)`],["(program [ (import_statement) (import_alias) ] @import)"]],ei={python:[["(module (future_import_statement) @import)"],["(module (import_statement) @import)"],["(module (import_from_statement) @import)"]],javascript:[[`(program [ ${no} ] @import)`],["(program [ (import_statement) ] @import)"]],typescript:Xr,tsx:Xr,go:[],ruby:[]},En=[["(program (export_statement) @export)"]],ti={python:[],javascript:En,typescript:En,tsx:En,go:[],ruby:[]},ni={python:[["(module (global_statement) @globalVar)"],["(module (expression_statement) @globalVar)"]],javascript:[],typescript:[],tsx:[],go:[],ruby:[]},Sn=["function","function_declaration","generator_function","generator_function_declaration","method_definition","arrow_function"],ri={python:new Set(["function_definition"]),javascript:new Set(Sn),typescript:new Set(Sn),tsx:new Set(Sn),go:new Set(["function_declaration","method_declaration"]),ruby:new Set(["method","singleton_method"])},oi={python:e=>e.type==="module"||e.type==="block"&&e.parent?.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"},Mn=new Map;async function si(e){await Lt.default.init();let t;try{t=await Yr.promises.readFile((0,eo.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 Lt.default.Language.load(t)}l(si,"si");i(si,"loadWasmLanguage");async function ro(e){let t=D(e);if(!Mn.has(t)){let r=await si(t);Mn.set(t,r)}return Mn.get(t)}l(ro,"ro");i(ro,"getLanguage");async function Me(e,t){let r=await ro(e),n=new Lt.default;n.setLanguage(r);let s=n.parse(t);return n.delete(),s}l(Me,"Me");i(Me,"parseTreeSitter");async function ii(e,t){let r=await Me(e,t),n=!r.rootNode.hasError();return r.delete(),n}l(ii,"ii");i(ii,"parsesWithoutError");function ai(e){switch(D(e)){case"python":return null;case"javascript":case"typescript":case"tsx":case"go":return"}";case"ruby":return"end"}}l(ai,"ai");i(ai,"getBlockCloseToken");function He(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(He,"He");i(He,"innerQuery");function oo(e,t){let r=Xs[D(e)];return He(r,t)}l(oo,"oo");i(oo,"queryFunctions");function li(e,t){let r=ei[D(e)];return He(r,t)}l(li,"li");i(li,"queryImports");function ui(e,t){let r=ti[D(e)];return He(r,t)}l(ui,"ui");i(ui,"queryExports");function ci(e,t){let r=ni[D(e)];return He(r,t)}l(ci,"ci");i(ci,"queryGlobalVars");var di=[`[
(class_definition (block (expression_statement (string))))
(function_definition (block (expression_statement (string))))
]`];function xn(e){return He([di],e).length==1}l(xn,"xn");i(xn,"queryPythonIsDocstring");function _i(e,t){let r=oi[D(e)];for(;t.parent;){if(r(t.parent))return t;t=t.parent}return t.parent?t:null}l(_i,"_i");i(_i,"getAncestorWithSiblingFunctions");function It(e,t){return ri[D(e)].has(t.type)}l(It,"It");i(It,"isFunction");function mi(e,t){switch(D(e)){case"python":case"go":case"ruby":return It(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&&It(e,n)}if(t.type==="expression_statement"){let r=t.namedChild(0);if(r?.type==="assignment_expression"){let n=r.namedChild(1);return n!==null&&It(e,n)}}return!1}}l(mi,"mi");i(mi,"isFunctionDefinition");function pi(e){let t=e;for(;t.previousSibling?.type==="comment";){let r=t.previousSibling;if(r.endPosition.row<t.startPosition.row-1)break;t=r}return t?.type==="comment"?t:null}l(pi,"pi");i(pi,"getFirstPrecedingComment");async function fi(e,t){let r=await Me(e,t),n=oo(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(fi,"fi");i(fi,"getFunctionPositions");var Nt=class{static{l(this,"Nt")}constructor(e,t,r){this.languageId=e,this.nodeMatch=t,this.nodeTypesWithBlockOrStmtChild=r}static{i(this,"BaseBlockParser")}async getNodeMatchAtPosition(e,t,r){let n=await Me(this.languageId,e);try{let s=n.rootNode.descendantForIndex(t);for(;s;){let o=this.nodeMatch[s.type];if(o){if(!this.nodeTypesWithBlockOrStmtChild.has(s.type))break;let a=this.nodeTypesWithBlockOrStmtChild.get(s.type);if((a==""?s.namedChildren[0]:s.childForFieldName(a))?.type==o)break}s=s.parent}return s?r(s):void 0}finally{n.delete()}}getNextBlockAtPosition(e,t,r){return this.getNodeMatchAtPosition(e,t,n=>{let s=n.children.reverse().find(o=>o.type==this.nodeMatch[n.type]);if(s){if(this.languageId=="python"&&s.parent){let o=s.parent.type==":"?s.parent.parent:s.parent,a=o?.nextSibling;for(;a&&a.type=="comment";){let c=a.startPosition.row==s.endPosition.row&&a.startPosition.column>=s.endPosition.column,u=a.startPosition.row>o.endPosition.row&&a.startPosition.column>o.startPosition.column;if(c||u)s=a,a=a.nextSibling;else break}}if(!(s.endIndex>=s.tree.rootNode.endIndex-1&&(s.hasError()||s.parent.hasError())))return r(s)}})}async isBlockBodyFinished(e,t,r){let n=(e+t).trimEnd(),s=await this.getNextBlockAtPosition(n,r,o=>o.endIndex);if(s!==void 0&&s<n.length){let o=s-e.length;return o>0?o:void 0}}getNodeStart(e,t){let r=e.trimEnd();return this.getNodeMatchAtPosition(r,t,n=>n.startIndex)}},kt=class extends Nt{static{l(this,"kt")}constructor(e,t,r,n,s){super(e,n,s),this.blockEmptyMatch=t,this.lineMatch=r}static{i(this,"RegexBasedBlockParser")}isBlockStart(e){return this.lineMatch.test(e.trimStart())}async isBlockBodyEmpty(e,t){let r=await this.getNextBlockAtPosition(e,t,n=>{n.startIndex<t&&(t=n.startIndex);let s=e.substring(t,n.endIndex).trim();return s==""||s.replace(/\s/g,"")==this.blockEmptyMatch});return r===void 0||r}async isEmptyBlockStart(e,t){return t=io(e,t),this.isBlockStart(gi(e,t))&&this.isBlockBodyEmpty(e,t)}};function gi(e,t){let r=e.lastIndexOf(`
`,t-1),n=e.indexOf(`
`,t);return n<0&&(n=e.length),e.slice(r+1,n)}l(gi,"gi");i(gi,"getLineAtOffset");function io(e,t){let r=t;for(;r>0&&/\s/.test(e.charAt(r-1));)r--;return r}l(io,"io");i(io,"rewindToNearestNonWs");function so(e,t){let r=e.startIndex,n=e.startIndex-e.startPosition.column,s=t.substring(n,r);if(/^\s*$/.test(s))return s}l(so,"so");i(so,"indent");function hi(e,t,r){if(t.startPosition.row<=e.startPosition.row)return!1;let n=so(e,r),s=so(t,r);return n!==void 0&&s!==void 0&&n.startsWith(s)}l(hi,"hi");i(hi,"outdented");var Te=class extends Nt{static{l(this,"Te")}constructor(e,t,r,n,s,o,a){super(e,t,r),this.startKeywords=n,this.blockNodeType=s,this.emptyStatementType=o,this.curlyBraceLanguage=a}static{i(this,"TreeSitterBasedBlockParser")}isBlockEmpty(e,t){let r=e.text.trim();return this.curlyBraceLanguage&&(r.startsWith("{")&&(r=r.slice(1)),r.endsWith("}")&&(r=r.slice(0,-1)),r=r.trim()),!!(r.length==0||this.languageId=="python"&&(e.parent?.type=="class_definition"||e.parent?.type=="function_definition")&&e.children.length==1&&xn(e.parent))}async isEmptyBlockStart(e,t){if(t>e.length)throw new RangeError("Invalid offset");for(let n=t;n<e.length&&e.charAt(n)!=`
`;n++)if(/\S/.test(e.charAt(n)))return!1;t=io(e,t);let r=await Me(this.languageId,e);try{let n=r.rootNode.descendantForIndex(t-1);if(n==null||this.curlyBraceLanguage&&n.type=="}")return!1;if((this.languageId=="javascript"||this.languageId=="typescript")&&n.parent&&n.parent.type=="object"&&n.parent.text.trim()=="{")return!0;if(this.languageId=="typescript"){let u=n;for(;u.parent;){if(u.type=="function_signature"||u.type=="method_signature"){let f=n.nextSibling;return f&&u.hasError()&&hi(u,f,e)?!0:!u.children.find(d=>d.type==";")&&u.endIndex<=t}u=u.parent}}let s=null,o=null,a=null,c=n;for(;c!=null;){if(c.type==this.blockNodeType){o=c;break}if(this.nodeMatch[c.type]){a=c;break}if(c.type=="ERROR"){s=c;break}c=c.parent}if(o!=null){if(!o.parent||!this.nodeMatch[o.parent.type])return!1;if(this.languageId=="python"){let u=o.previousSibling;if(u!=null&&u.hasError()&&(u.text.startsWith('"""')||u.text.startsWith("'''")))return!0}return this.isBlockEmpty(o,t)}if(s!=null){if(s.previousSibling?.type=="module"||s.previousSibling?.type=="internal_module"||s.previousSibling?.type=="def")return!0;let u=[...s.children].reverse(),f=u.find(p=>this.startKeywords.includes(p.type)),d=u.find(p=>p.type==this.blockNodeType);if(f){switch(this.languageId){case"python":{f.type=="try"&&n.type=="identifier"&&n.text.length>4&&(d=u.find(m=>m.hasError())?.children.find(m=>m.type=="block"));let p,h=0;for(let m of s.children){if(m.type==":"&&h==0){p=m;break}m.type=="("&&(h+=1),m.type==")"&&(h-=1)}if(p&&f.endIndex<=p.startIndex&&p.nextSibling){if(f.type=="def"){let m=p.nextSibling;if(m.type=='"'||m.type=="'"||m.type=="ERROR"&&(m.text=='"""'||m.text=="'''"))return!0}return!1}break}case"javascript":{let p=u.find(m=>m.type=="formal_parameters");if(f.type=="class"&&p)return!0;let h=u.find(m=>m.type=="{");if(h&&h.startIndex>f.endIndex&&h.nextSibling!=null||u.find(m=>m.type=="do")&&f.type=="while"||f.type=="=>"&&f.nextSibling&&f.nextSibling.type!="{")return!1;break}case"typescript":{let p=u.find(h=>h.type=="{");if(p&&p.startIndex>f.endIndex&&p.nextSibling!=null||u.find(h=>h.type=="do")&&f.type=="while"||f.type=="=>"&&f.nextSibling&&f.nextSibling.type!="{")return!1;break}}return d&&d.startIndex>f.endIndex?this.isBlockEmpty(d,t):!0}}if(a!=null){let u=this.nodeMatch[a.type],f=a.children.slice().reverse().find(d=>d.type==u);if(f)return this.isBlockEmpty(f,t);if(this.nodeTypesWithBlockOrStmtChild.has(a.type)){let d=this.nodeTypesWithBlockOrStmtChild.get(a.type),p=d==""?a.children[0]:a.childForFieldName(d);if(p&&p.type!=this.blockNodeType&&p.type!=this.emptyStatementType)return!1}return!0}return!1}finally{r.delete()}}},bi={python:new Te("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 Te("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","empty_statement",!0),typescript:new Te("typescript",{ambient_declaration:"statement_block",arrow_function:"statement_block",catch_c
`,Br=>"".padStart(Br," ")],yr=Er("value","any"),gr=Ar("boolean"),Rr=[...ie(fr,E,ce,We)].map(Br=>`${ye(4)}${Br}`).join(` &&${Ue}`);return`function ${se}(${yr})${gr} {${Ue}${ye(2)}return (${Ue}${Rr}${Ue}${ye(2)})
}`}l(xr,"CreateFunction");function Er(se,fr){let E=Mt.language==="typescript"?`: ${fr}`:"";return`${se}${E}`}l(Er,"CreateParameter");function Ar(se){return Mt.language==="typescript"?`: ${se}`:""}l(Ar,"CreateReturns");function br(se,fr,E){let ce=xr("check",se,fr,"value"),We=Er("value","any"),Ue=Ar("boolean"),ye=[...Mt.functions.values()],yr=[...Mt.variables.values()],gr=$s.IsString(se.$id)?`return function check(${We})${Ue} {
return ${mr(se.$id)}(value)
}`:`return ${ce}`;return[...yr,...ye,gr].join(`
`)}l(br,"Build");function Or(...se){let fr={language:"javascript"},[E,ce,We]=se.length===2&&$s.IsArray(se[1])?[se[0],se[1],fr]:se.length===2&&!$s.IsArray(se[1])?[se[0],[],se[1]]:se.length===3?[se[0],se[1],se[2]]:se.length===1?[se[0],[],fr]:[null,[],fr];if(Mt.language=We.language,Mt.variables.clear(),Mt.functions.clear(),!K0.TypeGuard.TSchema(E))throw new Uy(E);for(let Ue of ce)if(!K0.TypeGuard.TSchema(Ue))throw new Uy(Ue);return br(E,ce,We)}l(Or,"Code"),e.Code=Or;function Dr(se,fr=[]){let E=Or(se,fr,{language:"javascript"}),ce=globalThis.Function("kind","format","hash",E);function We(gr,Rr){return K0.TypeRegistry.Has(gr)?K0.TypeRegistry.Get(gr)(se,Rr):!1}l(We,"typeRegistryFunction");function Ue(gr,Rr){return K0.FormatRegistry.Has(gr)?K0.FormatRegistry.Get(gr)(Rr):!1}l(Ue,"formatRegistryFunction");function ye(gr){return pye.Hash(gr)}l(ye,"valueHashFunction");let yr=ce(We,Ue,ye);return new Y_(se,fr,yr,E)}l(Dr,"Compile"),e.Compile=Dr})(bz||(Wu.TypeCompiler=bz={}))});var jy=I(Ip=>{"use strict";var hye=Ip&&Ip.__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]}),mye=Ip&&Ip.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&hye(t,e,r)};Object.defineProperty(Ip,"__esModule",{value:!0});Ip.ValueErrorType=void 0;var gye=By();Object.defineProperty(Ip,"ValueErrorType",{enumerable:!0,get:function(){return gye.ValueErrorType}});mye(Cz(),Ip)});var Az=I((qat,Iz)=>{var X5=1e3,Q5=X5*60,J5=Q5*60,Lm=J5*24,_ye=Lm*7,bye=Lm*365.25;Iz.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Cye(e);if(r==="number"&&isFinite(e))return t.long?Tye(e):Eye(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Cye(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*bye;case"weeks":case"week":case"w":return r*_ye;case"days":case"day":case"d":return r*Lm;case"hours":case"hour":case"hrs":case"hr":case"h":return r*J5;case"minutes":case"minute":case"mins":case"min":case"m":return r*Q5;case"seconds":case"second":case"secs":case"sec":case"s":return r*X5;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}l(Cye,"parse");function Eye(e){var t=Math.abs(e);return t>=Lm?Math.round(e/Lm)+"d":t>=J5?Math.round(e/J5)+"h":t>=Q5?Math.round(e/Q5)+"m":t>=X5?Math.round(e/X5)+"s":e+"ms"}l(Eye,"fmtShort");function Tye(e){var t=Math.abs(e);return t>=Lm?t9(e,t,Lm,"day"):t>=J5?t9(e,t,J5,"hour"):t>=Q5?t9(e,t,Q5,"minute"):t>=X5?t9(e,t,X5,"second"):e+" ms"}l(Tye,"fmtLong");function t9(e,t,r,n){var s=t>=r*1.5;return Math.round(e/r)+" "+n+(s?"s":"")}l(t9,"plural")});var $R=I((jat,Rz)=>{function Sye(e){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=s,r.enabled=a,r.humanize=Az(),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 S=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(k,V)=>{if(k==="%%")return"%";S++;let le=r.formatters[V];if(typeof le=="function"){let we=v[S];k=le.call(_,we),v.splice(S,1),S--}return k}),r.formatArgs.call(_,v),(_.log||r.log).apply(_,v)}return l(y,"debug"),y.namespace=d,y.useColors=r.useColors(),y.color=r.selectColor(d),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,
`).join(`
`+o),e.push(s+"m+"+i9.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Fye()+t+" "+e[0]}l(Mye,"formatArgs");function Fye(){return Ol.inspectOpts.hideDate?"":new Date().toISOString()+" "}l(Fye,"getDate");function Bye(...e){return process.stderr.write(n9.format(...e)+`
`)}l(Bye,"log");function qye(e){e?process.env.DEBUG=e:delete process.env.DEBUG}l(qye,"save");function Uye(){return process.env.DEBUG}l(Uye,"load");function jye(e){e.inspectOpts={};let t=Object.keys(Ol.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=Ol.inspectOpts[t[r]]}l(jye,"init");i9.exports=$R()(Ol);var{formatters:Mz}=i9.exports;Mz.o=function(e){return this.inspectOpts.colors=this.useColors,n9.inspect(e,this.inspectOpts).split(`
`).map(t=>t.trim()).join(" ")};Mz.O=function(e){return this.inspectOpts.colors=this.useColors,n9.inspect(e,this.inspectOpts)}});var Mf=I((Kat,zR)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?zR.exports=Pz():zR.exports=Fz()});var JR=I((Qat,jz)=>{var Hy=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Hye=typeof AbortController=="function",s9=Hye?AbortController:class{static{l(this,"AbortController")}constructor(){this.signal=new Bz}abort(){this.signal.dispatchEvent("abort")}},$ye=typeof AbortSignal=="function",Vye=typeof s9.AbortSignal=="function",Bz=$ye?AbortSignal:Vye?s9.AbortController:class{static{l(this,"AbortSignal")}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))}},XR=new Set,WR=l((e,t)=>{let r=`LRU_CACHE_OPTION_${e}`;o9(r)&&QR(r,`${e} option`,`options.${t}`,e3)},"deprecatedOption"),KR=l((e,t)=>{let r=`LRU_CACHE_METHOD_${e}`;if(o9(r)){let{prototype:n}=e3,{get:s}=Object.getOwnPropertyDescriptor(n,e);QR(r,`${e} method`,`cache.${t}()`,s)}},"deprecatedMethod"),Gye=l((e,t)=>{let r=`LRU_CACHE_PROPERTY_${e}`;if(o9(r)){let{prototype:n}=e3,{get:s}=Object.getOwnPropertyDescriptor(n,e);QR(r,`${e} property`,`cache.${t}`,s)}},"deprecatedProperty"),qz=l((...e)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...e):console.error(...e)},"emitWarning"),o9=l(e=>!XR.has(e),"shouldWarn"),QR=l((e,t,r,n)=>{XR.add(e);let s=`The ${t} is deprecated. Please use ${r} instead.`;qz(s,"DeprecationWarning",e,n)},"warn"),Mm=l(e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),"isPosInt"),Uz=l(e=>Mm(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Z5:null:null,"getUintArray"),Z5=class extends Array{static{l(this,"ZeroArray")}constructor(t){super(t),this.fill(0)}},YR=class{static{l(this,"Stack")}constructor(t){if(t===0)return[];let r=Uz(t);this.heap=new r(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},e3=class e{static{l(this,"LRUCache")}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:S,stale:R}=t instanceof e?{}:t;if(r!==0&&!Mm(r))throw new TypeError("max option must be a nonnegative integer");let k=r?Uz(r):Array;if(!k)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 k(r),this.prev=new k(r),this.head=0,this.tail=0,this.free=new YR(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(!Mm(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!u||!!R,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Mm(s)||s===
\r
`,"getFooter"),tW=l((e,t,r)=>{let n="";return n+=`--${e}\r
`,n+=`Content-Disposition: form-data; name="${t}"`,iP(r)&&(n+=`; filename="${r.name}"\r
`,n+=`Content-Type: ${r.type||"application/octet-stream"}`),`${n}\r
\r
`},"getHeader");async function*xve(e,t){for(let[r,n]of e)yield tW(t,r,n),iP(n)?yield*n.stream():yield n,yield`\r
`;yield eW(t)}l(xve,"formDataIterator");var _ve=l((e,t)=>{let r=0;for(let[n,s]of e)r+=Buffer.byteLength(tW(t,n,s)),r+=iP(s)?s.size:Buffer.byteLength(String(s)),r+=Buffer.byteLength(`\r
`);return r+=Buffer.byteLength(eW(t)),r},"getFormDataLength"),nP=class{static{l(this,"FormDataSerializer")}constructor(t){this.fd=t,this.boundary=gve(8).toString("hex")}length(){return typeof this._length>"u"&&(this._length=_ve(this.fd,this.boundary)),this._length}contentType(){return`multipart/form-data; boundary=${this.boundary}`}stream(){return yve.from(xve(this.fd,this.boundary))}};rW.exports={isFormData:vve,FormDataSerializer:nP}});var iW=I((f0t,nW)=>{"use strict";var{AbortSignal:bve}=rP(),{Body:Cve,cloneStream:Eve,guessContentType:Tve}=u9(),{Headers:Sve}=t3(),{isPlainObject:wve}=Ap(),{isFormData:Ive,FormDataSerializer:Ave}=Gy(),Rve=20,U1=Symbol("Request internals"),m9=class e extends Cve{static{l(this,"Request")}constructor(t,r={}){let n=t instanceof e?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?Eve(n):null),c=new Sve(r.headers||n&&n.headers||{});if(Ive(a)&&!c.has("content-type")){let p=new Ave(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(wve(a))a=JSON.stringify(a),c.set("content-type","application/json");else{let p=Tve(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 bve))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[U1]={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=Rve: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[U1].method}get url(){return this[U1].parsedURL.toString()}get headers(){return this[U1].headers}get redirect(){return this[U1].redirect}get cache(){return this[U1].cache}get signal(){return this[U1].signal}clone(){return new e(this)}get init(){return this[U1].init}get[Symbol.toStringTag](){return this.constructor.name}};Object.defineProperties(m9.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},cache:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}});nW.exports={Request:m9}});var sP=I((p0t,sW)=>{"use strict";var{Body:Pve,cloneStream:Ove,guessContentType:kve}=u9(),{Headers:Nve}=t3(),{isPlainObject:Dve}=Ap(),{isFormData:Lve,FormDataSerializer:Mve}=Gy(),Bf=Symbol("Response internals"),g9=class e extends Pve{static{l(this,"Response")}constructor(t=null,r={}){let n=new Nve(r.headers),s=t;if(Lve(s)&&!n.has("content-type")){let o=new Mve(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(Dve(s))s=JSON.stringify(s),n.set("content-type","application/json");else{let o=kve(s);o&&n.set("content-type",o)}super(s),this[Bf]={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[Bf].url||""}get status(){return this[Bf].status}get statusText(){return this[Bf].statusText}get ok(){return this[Bf].status>=200&&this[Bf].status<300}get redirected(){return this[Bf].counter>0}get headers(){return this[Bf].headers}get httpVersion(){return this[Bf].httpVersion}get decoded(){return this[Bf].decoded}static redirect(t,r=302){if(![301,302,303,307,308].includes(r))t
`,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Sd.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,Sd.accessAsync(this._fileFullPath,E6e.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,Sd.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,Sd.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,Sd.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 SP(this,void 0,void 0,function(){var r,n,s;return wP(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,4,5]),[4,Sd.readFileAsync(this._fileFullPath)];case 1:return r=o.sent(),n=Hm.join(this._tempDir,new Date().getTime()+"."+this._logFileName),[4,Sd.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 Sd.writeFileAsync(this._fileFullPath,t),[7];case 5:return[2]}})})},e.prototype._fileCleanupTask=function(){return SP(this,void 0,void 0,function(){var t,r,n,s,o,a=this;return wP(this,function(c){switch(c.label){case 0:return c.trys.push([0,6,,7]),[4,Sd.readdirAsync(this._tempDir)];case 1:t=c.sent(),t=t.filter(function(u){return Hm.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=Hm.join(this._tempDir,t[n]),[4,Sd.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}();eK.exports=S6e});var m0=I((Alt,nK)=>{"use strict";var rK=tK(),w6e=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&&rK.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||rK.getInstance().warning(this.TAG+t,r)},e.enableDebug=!1,e.disableWarnings=!1,e.TAG="ApplicationInsights:",e}();nK.exports=w6e});var A9=I(I9=>{"use strict";Object.defineProperty(I9,"__esModule",{value:!0});I9.JsonConfig=void 0;var I6e=require("fs"),w9=require("path"),IP=m0(),A6e="APPLICATIONINSIGHTS_CONFIGURATION_FILE",R6e="APPLICATIONINSIGHTS_CONNECTION_STRING",iK="APPSETTING_",sK="APPINSIGHTS_INSTRUMENTATIONKEY",oK="APPINSIGHTS_INSTRUMENTATION_KEY",P6e="APPLICATION_INSIGHTS_DISABLE_EXTENDED_METRIC",O6e="APPLICATION_INSIGHTS_DISABLE_ALL_EXTENDED_METRICS",k6e="http_proxy",N6e="https_proxy",D6e="APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL",L6e="APPLICATION_INSIGHTS_NO_STATSBEAT",M6e="APPLICATION_INSIGHTS_NO_HTTP_AGENT_KEEP_ALIVE",F6e="APPLICATION_INSIGHTS_NO_PATCH_MODULES",B6e="APPLICATIONINSIGHTS_WEB_INSTRUMENTATION_ENABLED",q6e="APPLICATIONINSIGHTS_WEB_INSTRUMENTATION_CONNECTION_STRING",U6e="APPLICATIONINSIGHTS_WEB_INSTRUMENTATION_SOURCE",j6e="APPLICATIONINSIGHTS_WEB_SNIPPET_ENABLED",H6e="APPLICATIONINSIGHTS_WEB_SNIPPET_CONNECTION_STRING",$6e=function(){function e(){this.connectionString=process.env[R6e],this.instrumentationKey=process.env[sK]||process.env[iK+sK]||process.env[oK]||process.env[iK+oK],!this.connectionString&&this.instrumentationKey&&IP.warn("APPINSIGHTS_INSTRUMENTATIONKEY is in path of deprecation, please use APPLICATIONI
`).find(n=>n.includes("IOPlatformUUID"));if(!t)return"";let r=t.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(e){sTe.diag.debug(`error reading machine id: ${e}`)}return""}l(oTe,"getMachineId");S7.getMachineId=oTe});var $J=I(w7=>{"use strict";Object.defineProperty(w7,"__esModule",{value:!0});w7.getMachineId=void 0;var aTe=require("fs"),lTe=Ws();async function cTe(){let e=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let t of e)try{return(await aTe.promises.readFile(t,{encoding:"utf8"})).trim()}catch(r){lTe.diag.debug(`error reading machine id: ${r}`)}return""}l(cTe,"getMachineId");w7.getMachineId=cTe});var GJ=I(I7=>{"use strict";Object.defineProperty(I7,"__esModule",{value:!0});I7.getMachineId=void 0;var uTe=require("fs"),fTe=T7(),VJ=Ws();async function dTe(){try{return(await uTe.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(e){VJ.diag.debug(`error reading machine id: ${e}`)}try{return(await(0,fTe.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(e){VJ.diag.debug(`error reading machine id: ${e}`)}return""}l(dTe,"getMachineId");I7.getMachineId=dTe});var WJ=I(A7=>{"use strict";Object.defineProperty(A7,"__esModule",{value:!0});A7.getMachineId=void 0;var zJ=require("process"),pTe=T7(),hTe=Ws();async function mTe(){let e="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",t="%windir%\\System32\\REG.exe";zJ.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in zJ.env&&(t="%windir%\\sysnative\\cmd.exe /c "+t);try{let n=(await(0,pTe.execAsync)(`${t} ${e}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){hTe.diag.debug(`error reading machine id: ${r}`)}return""}l(mTe,"getMachineId");A7.getMachineId=mTe});var KJ=I(R7=>{"use strict";Object.defineProperty(R7,"__esModule",{value:!0});R7.getMachineId=void 0;var gTe=Ws();async function yTe(){return gTe.diag.debug("could not read machine-id: unsupported platform"),""}l(yTe,"getMachineId");R7.getMachineId=yTe});var YJ=I(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});Fp.getMachineId=void 0;var vTe=require("process"),P3;Fp.getMachineId=P3;switch(vTe.platform){case"darwin":Fp.getMachineId=P3=HJ().getMachineId;break;case"linux":Fp.getMachineId=P3=$J().getMachineId;break;case"freebsd":Fp.getMachineId=P3=GJ().getMachineId;break;case"win32":Fp.getMachineId=P3=WJ().getMachineId;break;default:Fp.getMachineId=P3=KJ().getMachineId}});var jk=I(P7=>{"use strict";Object.defineProperty(P7,"__esModule",{value:!0});P7.hostDetectorSync=void 0;var qk=jf(),xTe=lg(),XJ=require("os"),_Te=Bk(),bTe=YJ(),Uk=class{static{l(this,"HostDetectorSync")}detect(t){let r={[qk.SemanticResourceAttributes.HOST_NAME]:(0,XJ.hostname)(),[qk.SemanticResourceAttributes.HOST_ARCH]:(0,_Te.normalizeArch)((0,XJ.arch)())};return new xTe.Resource(r,this._getAsyncAttributes())}_getAsyncAttributes(){return(0,bTe.getMachineId)().then(t=>{let r={};return t&&(r[qk.SemanticResourceAttributes.HOST_ID]=t),r})}};P7.hostDetectorSync=new Uk});var QJ=I(O7=>{"use strict";Object.defineProperty(O7,"__esModule",{value:!0});O7.hostDetector=void 0;var CTe=jk(),Hk=class{static{l(this,"HostDetector")}detect(t){return Promise.resolve(CTe.hostDetectorSync.detect(t))}};O7.hostDetector=new Hk});var Vk=I(k7=>{"use strict";Object.defineProperty(k7,"__esModule",{value:!0});k7.osDetectorSync=void 0;var JJ=jf(),ETe=lg(),ZJ=require("os"),TTe=Bk(),$k=class{static{l(this,"OSDetectorSync")}detect(t){let r={[JJ.SemanticResourceAttributes.OS_TYPE]:(0,TTe.normalizeType)((0,ZJ.platform)()),[JJ.SemanticResourceAttributes.OS_VERSION]:(0,ZJ.release)()};return new ETe.Resource(r)}};k7.osDetectorSync=new $k});var eZ=I(N7=>{"use strict";Object.defineProperty(N7,"__esModule",{value:!0});N7.osDetector=void 0;var STe=Vk(),Gk=class{static{l(this,"OSDetector")}detect(t){return Promise.resolve(STe.osDetectorSync.detect(t))}};N7.osDetector=new Gk});var Wk=I(D7=>{"use strict";Object.defineProperty(D7,"__esModule",{value:!0});D7.processDetectorSync=void 0;var wTe=Ws(),Bp=jf(),ITe=lg(),ATe=require("os"),zk=class{static{l(this,"ProcessDetectorSync")}detect(t){let r={[Bp.SemanticResour
`+Ra.inspect(this)+`
`+Ra.inspect(t))):($p.ok(r,"can't remove top context"),this._set.splice(r,1))},"exit");nf.prototype.bindEmitter=l(function(t){$p.ok(t.on&&t.addListener&&t.emit,"can only bind real EEs");let r=this,n="context@"+this.name;function s(a){a&&(a[Dv]||(a[Dv]=Object.create(null)),a[Dv][n]={namespace:r,context:r.active})}l(s,"attach");function o(a){if(!(a&&a[Dv]))return a;let c=a,u=a[Dv];return Object.keys(u).forEach(function(f){let d=u[f];c=d.namespace.bind(c,d.context)}),c}l(o,"bind"),_Ie(t,s,o)},"bindEmitter");nf.prototype.fromException=l(function(t){return t[Lv]},"fromException");function pre(e){return process.namespaces[e]}l(pre,"getNamespace");function bIe(e){$p.ok(e,"namespace must be given a name."),T0&&g0(`NS-CREATING NAMESPACE (${e})`);let t=new nf(e);return t.id=Aa,c0.createHook({init(n,s,o,a){if(Aa=c0.executionAsyncId(),t.active){if(t._contexts.set(n,t.active),T0){let c=" ".repeat(t._indent<0?0:t._indent);g0(`${c}INIT [${s}] (${e}) asyncId:${n} currentUid:${Aa} triggerId:${o} active:${Ra.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} resource:${a}`)}}else if(Aa===0){let c=c0.triggerAsyncId(),u=t._contexts.get(c);if(u){if(t._contexts.set(n,u),T0){let f=" ".repeat(t._indent<0?0:t._indent);g0(`${f}INIT USING CONTEXT FROM TRIGGERID [${s}] (${e}) asyncId:${n} currentUid:${Aa} triggerId:${c} active:${Ra.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} resource:${a}`)}}else if(T0){let f=" ".repeat(t._indent<0?0:t._indent);g0(`${f}INIT MISSING CONTEXT [${s}] (${e}) asyncId:${n} currentUid:${Aa} triggerId:${c} active:${Ra.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} resource:${a}`)}}if(T0&&s==="PROMISE"){g0(Ra.inspect(a,{showHidden:!0}));let c=a.parentId,u=" ".repeat(t._indent<0?0:t._indent);g0(`${u}INIT RESOURCE-PROMISE [${s}] (${e}) parentId:${c} asyncId:${n} currentUid:${Aa} triggerId:${o} active:${Ra.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} resource:${a}`)}},before(n){Aa=c0.executionAsyncId();let s;if(s=t._contexts.get(n)||t._contexts.get(Aa),s){if(T0){let o=c0.triggerAsyncId(),a=" ".repeat(t._indent<0?0:t._indent);g0(`${a}BEFORE (${e}) asyncId:${n} currentUid:${Aa} triggerId:${o} active:${Ra.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} context:${Ra.inspect(s)}`),t._indent+=2}t.enter(s)}else if(T0){let o=c0.triggerAsyncId(),a=" ".repeat(t._indent<0?0:t._indent);g0(`${a}BEFORE MISSING CONTEXT (${e}) asyncId:${n} currentUid:${Aa} triggerId:${o} active:${Ra.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} namespace._contexts:${Ra.inspect(t._contexts,{showHidden:!0,depth:2,colors:!0})}`),t._indent+=2}},after(n){Aa=c0.executionAsyncId();let s;if(s=t._contexts.get(n)||t._contexts.get(Aa),s){if(T0){let o=c0.triggerAsyncId();t._indent-=2;let a=" ".repeat(t._indent<0?0:t._indent);g0(`${a}AFTER (${e}) asyncId:${n} currentUid:${Aa} triggerId:${o} active:${Ra.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} context:${Ra.inspect(s)}`)}t.exit(s)}else if(T0){let o=c0.triggerAsyncId();t._indent-=2;let a=" ".repeat(t._indent<0?0:t._indent);g0(`${a}AFTER MISSING CONTEXT (${e}) asyncId:${n} currentUid:${Aa} triggerId:${o} active:${Ra.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} context:${Ra.inspect(s)}`)}},destroy(n){if(Aa=c0.executionAsyncId(),T0){let s=c0.triggerAsyncId(),o=" ".repeat(t._indent<0?0:t._indent);g0(`${o}DESTROY (${e}) currentUid:${Aa} asyncId:${n} triggerId:${s} active:${Ra.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} context:${Ra.inspect(t._contexts.get(Aa))}`)}t._contexts.delete(n)}}).enable(),process.namespaces[e]=t,t}l(bIe,"createNamespace");function hre(e){let t=pre(e);$p.ok(t,`can't delete nonexistent namespace! "`+e+'"'),$p.ok(t.id,"don't assign to process.namespaces directly! "+Ra.inspect(t)),process.namespaces[e]=null}l(hre,"destroyNamespace");function CIe(){process.namespaces&&Object.keys(process.namespaces).forEach(function(e){hre(e)}),process.namespaces=Object.create(null)}l(CIe,"reset");process.namespaces={};function g0(...e){T0&&process._rawDebug(`${Ra.format(...e)}`)}l(g0,"debug2")});var vre=I((Bmt,yre)=>{"use strict";function EIe(){}l(EIe,"NextTick
`)},"FormatStackTrace")});var Ore=I((Xmt,Pre)=>{var xC=Ire();function Rre(){this.extend=new qv,this.filter=new qv,this.format=new Uv,this.version=mD().version}l(Rre,"stackChain");var yD=!1;Rre.prototype.callSite=l(function e(t){t||(t={}),yD=!0;var r={};Error.captureStackTrace(r,e);var n=r.stack;return yD=!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 Z1=new Rre;function qv(){this._modifiers=[]}l(qv,"TraceModifier");qv.prototype._modify=function(e,t){for(var r=0,n=this._modifiers.length;r<n;r++)t=this._modifiers[r](e,t);return t};qv.prototype.attach=function(e){this._modifiers.push(e)};qv.prototype.deattach=function(e){var t=this._modifiers.indexOf(e);return t===-1?!1:(this._modifiers.splice(t,1),!0)};function Uv(){this._formater=xC,this._previous=void 0}l(Uv,"StackFormater");Uv.prototype.replace=function(e){e?this._formater=e:this.restore()};Uv.prototype.restore=function(){this._formater=xC,this._previous=void 0};Uv.prototype._backup=function(){this._previous=this._formater};Uv.prototype._roolback=function(){this._previous===xC?this.replace(void 0):this.replace(this._previous),this._previous=void 0};Error.prepareStackTrace&&Z1.format.replace(Error.prepareStackTrace);var gD=!1;function Are(e,t){if(yD)return t;if(gD)return xC(e,t);var r=t.concat();r=Z1.extend._modify(e,r),r=Z1.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}),gD=!0;var n=Z1.format._formater(e,r);return gD=!1,n}l(Are,"prepareStackTrace");Object.defineProperty(Error,"prepareStackTrace",{get:function(){return Are},set:function(e){e===Are?Z1.format._roolback():(Z1.format._backup(),Z1.format.replace(e))}});function MIe(){return this.stack,this.callSite}l(MIe,"callSiteGetter");Object.defineProperty(Error.prototype,"callSite",{get:MIe,set:function(e){Object.defineProperty(this,"callSite",{value:e,writable:!0,configurable:!0})},configurable:!0});Pre.exports=Z1});var xD=I((Jmt,vD)=>{if(global._stackChain)if(global._stackChain.version===mD().version)vD.exports=global._stackChain;else throw new Error("Conflicting version of stack-chain found");else vD.exports=global._stackChain=Ore()});var kre=I((Zmt,_D)=>{"use strict";var FIe=Sre();if(global._asyncHook)if(global._asyncHook.version===pD().version)_D.exports=global._asyncHook;else throw new Error("Conflicting version of async-hook-jl found");else xD().filter.attach(function(t,r){return r.filter(function(n){let s=n.getFileName();return!(s&&s.slice(0,__dirname.length)===__dirname)})}),_D.exports=global._asyncHook=new FIe});var Bre=I((egt,Fre)=>{"use strict";var V0=require("util"),Vp=require("assert"),BIe=yC(),X3=kre(),jv="cls@contexts",Hv="error@context",Dre=[];for(let e in X3.providers)Dre[X3.providers[e]]=e;var N0=process.env.DEBUG_CLS_HOOKED,X0=-1;Fre.exports={getNamespace:Lre,createNamespace:qIe,destroyNamespace:Mre,reset:UIe,ERROR_SYMBOL:Hv};function sf(e){this.name=e,this.active=null,this._set=[],this.id=null,this._contexts=new Map}l(sf,"Namespace");sf.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 N0&&$0(" SETTING KEY:"+t+"="+r+" in ns:"+this.name+" uid:"+X0+" active:"+V0.inspect(this.active,!0)),this.active[t]=r,r},"set");sf.prototype.get=l(function(t){if(!this.active){N0&&$0(" GETTING KEY:"+t+"=undefined "+this.name+" uid:"+X0+" active:"+V0.inspect(this.active,!0));return}return N0&&$0(" GETTING KEY:"+t+"="+this.active[t]+" "+this.name+" uid:"+X0+" active:"+V0.inspect(this.active,!0)),this.active[t]},"get");sf.prototype.createContext=l(function(){N0&&$0(" CREATING Context: "+this.name+" uid:"+X0+" len:"+this._set.length+" active:"+V0.inspect(this.active,!0,2,!0));let t=Object.create(this.active?this.active:Object.prototype);return t._ns_name=this.name,t.id=X0,N0&&$0(" CREATED Context: "+this.name+" uid:"+X0+" len:"+this._set.length+" context:"+V0.inspect(t,!0,2,!0)),t},"createContext");sf.prototype.run=l(f
`+V0.inspect(this)+`
`+V0.inspect(t))):(Vp.ok(r,"can't remove top context"),this._set.splice(r,1))},"exit");sf.prototype.bindEmitter=l(function(t){Vp.ok(t.on&&t.addListener&&t.emit,"can only bind real EEs");let r=this,n="context@"+this.name;function s(a){a&&(a[jv]||(a[jv]=Object.create(null)),a[jv][n]={namespace:r,context:r.active})}l(s,"attach");function o(a){if(!(a&&a[jv]))return a;let c=a,u=a[jv];return Object.keys(u).forEach(function(f){let d=u[f];c=d.namespace.bind(c,d.context)}),c}l(o,"bind"),BIe(t,s,o)},"bindEmitter");sf.prototype.fromException=l(function(t){return t[Hv]},"fromException");function Lre(e){return process.namespaces[e]}l(Lre,"getNamespace");function qIe(e){Vp.ok(e,"namespace must be given a name."),N0&&$0("CREATING NAMESPACE "+e);let t=new sf(e);return t.id=X0,X3.addHooks({init(r,n,s,o,a){X0=r,o?(t._contexts.set(r,t._contexts.get(o)),N0&&$0("PARENTID: "+e+" uid:"+r+" parent:"+o+" provider:"+s)):t._contexts.set(X0,t.active),N0&&$0("INIT "+e+" uid:"+r+" parent:"+o+" provider:"+Dre[s]+" active:"+V0.inspect(t.active,!0))},pre(r,n){X0=r;let s=t._contexts.get(r);s?(N0&&$0(" PRE "+e+" uid:"+r+" handle:"+_C(n)+" context:"+V0.inspect(s)),t.enter(s)):N0&&$0(" PRE MISSING CONTEXT "+e+" uid:"+r+" handle:"+_C(n))},post(r,n){X0=r;let s=t._contexts.get(r);s?(N0&&$0(" POST "+e+" uid:"+r+" handle:"+_C(n)+" context:"+V0.inspect(s)),t.exit(s)):N0&&$0(" POST MISSING CONTEXT "+e+" uid:"+r+" handle:"+_C(n))},destroy(r){X0=r,N0&&$0("DESTROY "+e+" uid:"+r+" context:"+V0.inspect(t._contexts.get(X0))+" active:"+V0.inspect(t.active,!0)),t._contexts.delete(r)}}),process.namespaces[e]=t,t}l(qIe,"createNamespace");function Mre(e){let t=Lre(e);Vp.ok(t,`can't delete nonexistent namespace! "`+e+'"'),Vp.ok(t.id,"don't assign to process.namespaces directly! "+V0.inspect(t)),process.namespaces[e]=null}l(Mre,"destroyNamespace");function UIe(){process.namespaces&&Object.keys(process.namespaces).forEach(function(e){Mre(e)}),process.namespaces=Object.create(null)}l(UIe,"reset");process.namespaces={};X3._state&&!X3._state.enabled&&X3.enable();function $0(e){process.env.DEBUG&&process._rawDebug(e)}l($0,"debug2");function _C(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(_C,"getFunctionName");if(N0){bD=xD();for(Nre in bD.filter._modifiers)bD.filter.deattach(Nre)}var bD,Nre});var qre=I((rgt,CD)=>{"use strict";var jIe=sre();process&&jIe.gte(process.versions.node,"8.0.0")?CD.exports=gre():CD.exports=Bre()});var rne=I((Ps,tne)=>{Ps=tne.exports=ca;var Fa;typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?Fa=l(function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)},"debug"):Fa=l(function(){},"debug");Ps.SEMVER_SPEC_VERSION="2.0.0";var $v=256,bC=Number.MAX_SAFE_INTEGER||9007199254740991,ED=16,HIe=$v-6,Vv=Ps.re=[],Qa=Ps.safeRe=[],an=Ps.src=[],oa=0,AD="[a-zA-Z0-9-]",TD=[["\\s",1],["\\d",$v],[AD,HIe]];function IC(e){for(var t=0;t<TD.length;t++){var r=TD[t][0],n=TD[t][1];e=e.split(r+"*").join(r+"{0,"+n+"}").split(r+"+").join(r+"{1,"+n+"}")}return e}l(IC,"makeSafeRe");var Q3=oa++;an[Q3]="0|[1-9]\\d*";var J3=oa++;an[J3]="\\d+";var RD=oa++;an[RD]="\\d*[a-zA-Z-]"+AD+"*";var jre=oa++;an[jre]="("+an[Q3]+")\\.("+an[Q3]+")\\.("+an[Q3]+")";var Hre=oa++;an[Hre]="("+an[J3]+")\\.("+an[J3]+")\\.("+an[J3]+")";var SD=oa++;an[SD]="(?:"+an[Q3]+"|"+an[RD]+")";var wD=oa++;an[wD]="(?:"+an[J3]+"|"+an[RD]+")";var PD=oa++;an[PD]="(?:-("+an[SD]+"(?:\\."+an[SD]+")*))";var OD=oa++;an[OD]="(?:-?("+an[wD]+"(?:\\."+an[wD]+")*))";var ID=oa++;an[ID]=AD+"+";var zv=oa++;an[zv]="(?:\\+("+an[ID]+"(?:\\."+an[ID]+")*))";var kD=oa++,$re="v?"+an[jre]+an[PD]+"?"+an[zv]+"?";an[kD]="^"+$re+"$";var ND="[v=\\s]*"+an[Hre]+an[OD]+"?"+an[zv]+"?",DD=oa++;an[DD]="^"+ND+"$";var n2=oa++;an[n2]="((?:<|>)?=?)";var CC=oa++;an[CC]=an[J3]+"|x|X|\\*";var EC=oa++;an[EC]=an[Q3]+"|x|X|\\*";var wg=oa++;an[wg]="[v=\\s]*("+an[EC]+")(?:\\.("+an[EC]+")(?:\\.("+an[EC]+")(?:"+an[PD]+")?"+an[zv]+"
`)==t.length-1&&(t=t.substring(0,t.length-1)),r.trackTrace({message:t,severity:e.data.stderr?BC.SeverityLevel.Warning:BC.SeverityLevel.Information}))})},"subscriber");function XAe(e,t){if(e){var r=nh.find(function(n){return n==t});if(r)return;nh.length===0&&qC.channel.subscribe("console",rL,qC.trueFilter,function(n,s){var o=t.getStatsbeat();o&&o.addInstrumentation(YAe.StatsbeatInstrumentation.CONSOLE)}),nh.push(t)}else nh=nh.filter(function(n){return n!=t}),nh.length===0&&qC.channel.unsubscribe("console",rL)}l(XAe,"enable");a2.enable=XAe;function QAe(){qC.channel.unsubscribe("console",rL),nh=[]}l(QAe,"dispose");a2.dispose=QAe});var Cne=I(c2=>{"use strict";Object.defineProperty(c2,"__esModule",{value:!0});c2.dispose=c2.enable=void 0;var l2=uc(),JAe=D0(),UC=k0(),ih=[],ZAe={10:l2.SeverityLevel.Verbose,20:l2.SeverityLevel.Verbose,30:l2.SeverityLevel.Information,40:l2.SeverityLevel.Warning,50:l2.SeverityLevel.Error,60:l2.SeverityLevel.Critical},nL=l(function(e){var t=e.data.result,r=ZAe[e.data.level];ih.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 eRe(e,t){if(e){var r=ih.find(function(n){return n==t});if(r)return;ih.length===0&&UC.channel.subscribe("bunyan",nL,UC.trueFilter,function(n,s){var o=t.getStatsbeat();o&&o.addInstrumentation(JAe.StatsbeatInstrumentation.BUNYAN)}),ih.push(t)}else ih=ih.filter(function(n){return n!=t}),ih.length===0&&UC.channel.unsubscribe("bunyan",nL)}l(eRe,"enable");c2.enable=eRe;function tRe(){UC.channel.unsubscribe("bunyan",nL),ih=[]}l(tRe,"dispose");c2.dispose=tRe});var Ene=I(u2=>{"use strict";Object.defineProperty(u2,"__esModule",{value:!0});u2.dispose=u2.enable=void 0;var rRe=D0(),Fl=uc(),jC=k0(),sh=[],nRe={syslog:function(e){var t={emerg:Fl.SeverityLevel.Critical,alert:Fl.SeverityLevel.Critical,crit:Fl.SeverityLevel.Critical,error:Fl.SeverityLevel.Error,warning:Fl.SeverityLevel.Warning,notice:Fl.SeverityLevel.Information,info:Fl.SeverityLevel.Information,debug:Fl.SeverityLevel.Verbose};return t[e]===void 0?Fl.SeverityLevel.Information:t[e]},npm:function(e){var t={error:Fl.SeverityLevel.Error,warn:Fl.SeverityLevel.Warning,info:Fl.SeverityLevel.Information,verbose:Fl.SeverityLevel.Verbose,debug:Fl.SeverityLevel.Verbose,silly:Fl.SeverityLevel.Verbose};return t[e]===void 0?Fl.SeverityLevel.Information:t[e]},unknown:function(e){return Fl.SeverityLevel.Information}},iL=l(function(e){var t=e.data.message,r=nRe[e.data.levelKind](e.data.level);sh.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 iRe(e,t){if(e){var r=sh.find(function(n){return n==t});if(r)return;sh.length===0&&jC.channel.subscribe("winston",iL,jC.trueFilter,function(n,s){var o=t.getStatsbeat();o&&o.addInstrumentation(rRe.StatsbeatInstrumentation.WINSTON)}),sh.push(t)}else sh=sh.filter(function(n){return n!=t}),sh.length===0&&jC.channel.unsubscribe("winston",iL)}l(iRe,"enable");u2.enable=iRe;function sRe(){jC.channel.unsubscribe("winston",iL),sh=[]}l(sRe,"dispose");u2.dispose=sRe});var Sne=I((Egt,Tne)=>{"use strict";var oRe=tC(),aRe=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){oRe.IsInitialized&&(bne().enable(t&&r,this._client),Cne().enable(t,this._client),Ene().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}();Tne.exports=aRe});var Ine=I((Sgt,wne)=>{"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 Wne=I(($gt,zne)=>{"use strict";var Hne=require("http"),$ne=require("https"),p2=require("zlib"),qd=m0(),lf=Mne(),Vne=Fne(),Xv=D0(),Gne=aL(),HRe=jne(),$Re=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=Xv.WEB_INSTRUMENTATION_DEFAULT_SOURCE,e._aiDeprecatedUrl=Xv.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(Xv.StatsbeatFeature.WEB_SNIPPET),this._initialize()):this._isEnabled||this._statsbeat&&this._statsbeat.removeFeature(Xv.StatsbeatFeature.WEB_SNIPPET)},e.prototype.isInitialized=function(){return this._isInitialized},e.prototype._getWebSnippetIkey=function(t){var r=null;try{var n=Gne.parse(t),s=n.instrumentationkey||"";Gne.isIkeyValid(s)?(this._isIkeyValid=!0,r=s):(this._isIkeyValid=!1,qd.info("Invalid web Instrumentation connection string, web Instrumentation is not enabled."))}catch(o){qd.info("get web snippet ikey error: "+o)}return r},e.prototype._getWebInstrumentationReplacedStr=function(){var t=this._getClientWebInstrumentationConfigStr(this._clientWebInstrumentationConfig),r=Vne.getOsPrefix(),n=Vne.getResourceProvider(),s=this._webInstrumentationIkey+`",\r
`+t+` disableIkeyDeprecationMessage: true,\r
sdkExtension: "`+n+r+"d_n_",o=HRe.webSnippet.replace("INSTRUMENTATION_KEY",s);return this._clientWebInstrumentationSrc?o.replace(Xv.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,qd.info("Parse client web instrumentation error. Web Instrumentation is disabled")}return r},e.prototype._initialize=function(){this._isInitialized=!0;var t=Hne.createServer,r=$ne.createServer,n=this._isEnabled;Hne.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=lf.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){qd.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=lf.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){qd.warn("Inject snipet error: "+x)}return d.apply(c,arguments)},"wrap"),o(a,c)},"requestListener")),t(s)},$ne.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=lf.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){qd.warn("Inject snippet error: "+b)}return d.apply(u,arguments)},"wrap"),u.end=l(function(m,g,y){try{if(n&&f){var v=lf.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){qd.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=lf.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){qd.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=lf.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=lf.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){qd.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 lf.contentEncodingMethod.GZIP:var s=p2.gunzipSync(r);if(this.ValidateInjection(t,s)){var o=this.InjectWebSnippet(t,s);r=p2.gzipSync(o)}break;case lf.contentEncodingMethod.DEFLATE:var a=p2.inflateSync(r);if(this.ValidateInjection(t,a)){var c=this.InjectWebSnippet(t,a);r=p2.deflateSync(c)}break;case lf.contentEncodingMethod.BR:var u=lf.getBrotliDecompressSync(p2),f=lf.getBrotliCompressSync(p2);if(u&&f){var d=u(r);if(this.ValidateInjection(t,d)){var p=this.InjectWebSnippet(t,d);r=f(p)}break}}}catch(h){qd.info("get web injection compress buffer error: "+h)}return r},e.prototype.dispose=function(){e.INSTANCE=null,this.enable(!1),this._isInitialized=!1},e}();zne.exports=$Re});var Yne=I((cL,Kne)=>{"use strict";var VRe=cL&&cL.__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=uf(uf({},r),{Exception:s,ExceptionMessage:o,ExceptionType:a});return c},e.createQuickPulseRequestDocument=function(t){var r=e.createQuickPulseDocument(t),n=t.data.baseData,s=uf(uf({},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=uf(uf({},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=pie.TelemetryTypeStringToQuickPulseType[t.data.baseType],r=pie.TelemetryTypeStringToQuickPulseDocumentType[t.data.baseType]):kPe.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 Fg.ContextTagKeys,e}();hie.exports=DPe});var yie=I((d5t,gie)=>{"use strict";var LPe=l(function(){return(Date.now()+621355968e5)*1e4},"getTransmissionTime");gie.exports={getTransmissionTime:LPe}});var bie=I((t8,_ie)=>{"use strict";var vie=t8&&t8.__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())})},xie=t8&&t8.__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}}},MPe=require("https"),FPe=v2(),EL=m0(),BPe=yie(),TL=yl(),qPe=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"},UPe=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 vie(this,void 0,void 0,function(){return xie
`;xa.DEFAULT_CONTENT_TYPE="application/octet-stream";xa.prototype.append=function(e,t,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=WL.prototype.append.bind(this);if(typeof t=="number"&&(t=""+t),Rse.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)};xa.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)+xa.LINE_BREAK.length,!(!t||!t.path&&!(t.readable&&t.hasOwnProperty("httpVersion"))&&!(t instanceof QOe))&&(r.knownLength||this._valuesToMeasure.push(t))};xa.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)):XOe.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")};xa.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"&&zL(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("; ")+xa.LINE_BREAK)));return"--"+this.getBoundary()+xa.LINE_BREAK+o+xa.LINE_BREAK};xa.prototype._getContentDisposition=function(e,t){var r,n;return typeof t.filepath=="string"?r=VL.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e.name||e.path?r=VL.basename(t.filename||e.name||e.path):e.readable&&e.hasOwnProperty("httpVersion")&&(r=VL.basename(e.client._httpMessage.path||"")),r&&(n='filename="'+r+'"'),n};xa.prototype._getContentType=function(e,t){var r=t.contentType;return!r&&e.name&&(r=GL.lookup(e.name)),!r&&e.path&&(r=GL.lookup(e.path)),!r&&e.readable&&e.hasOwnProperty("httpVersion")&&(r=e.headers["content-type"]),!r&&(t.filepath||t.filename)&&(r=GL.lookup(t.filepath||t.filename)),!r&&typeof e=="object"&&(r=xa.DEFAULT_CONTENT_TYPE),r};xa.prototype._multiPartFooter=function(){return function(e){var t=xa.LINE_BREAK,r=this._streams.length===0;r&&(t+=this._lastBoundary()),e(t)}.bind(this)};xa.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+xa.LINE_BREAK};xa.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};xa.prototype.setBoundary=function(e){this._boundary=e};xa.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};xa.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(xa.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};xa.prototype._generateBoundary=function(){for(var e="--------------------------",t=0;t<24;t++)e+=Math.floor(Math.random()*10).toString(16);this._boundary=e};xa.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};xa.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};xa.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(YL,"isSecureEndpoint");function dE(e,t){return new dE.Agent(e,t)}l(dE,"createAgent");(function(e){class t extends eke.EventEmitter{static{l(this,"Agent")}constructor(n,s){super();let o=s;typeof n=="function"?this.callback=n:n&&(o=n),this.timeout=null,o&&typeof o.timeout=="number"&&(this.timeout=o.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:YL()?443:80}set defaultPort(n){this.explicitDefaultPort=n}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:YL()?"https:":"http:"}set protocol(n){this.explicitProtocol=n}callback(n,s,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(n,s){let o=Object.assign({},s);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=YL()),o.host==null&&(o.host="localhost"),o.port==null&&(o.port=o.secureEndpoint?443:80),o.protocol==null&&(o.protocol=o.secureEndpoint?"https:":"http:"),o.host&&o.path&&delete o.path,delete o.agent,delete o.hostname,delete o._defaultAgent,delete o.defaultPort,delete o.createConnection,n._last=!0,n.shouldKeepAlive=!1;let a=!1,c=null,u=o.timeout||this.timeout,f=l(m=>{n._hadError||(n.emit("error",m),n._hadError=!0)},"onerror"),d=l(()=>{c=null,a=!0;let m=new Error(`A "socket" was not created for HTTP request before ${u}ms`);m.code="ETIMEOUT",f(m)},"ontimeout"),p=l(m=>{a||(c!==null&&(clearTimeout(c),c=null),f(m))},"callbackError"),h=l(m=>{if(a)return;if(c!=null&&(clearTimeout(c),c=null),nke(m)){o8("Callback returned another Agent instance %o",m.constructor.name),m.addRequest(n,o);return}if(m){m.once("free",()=>{this.freeSocket(m,o)}),n.onSocket(m);return}let g=new Error(`no Duplex stream was returned to agent-base for \`${n.method} ${n.path}\``);f(g)},"onsocket");if(typeof this.callback!="function"){f(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(o8("Converting legacy callback function to promise"),this.promisifiedCallback=rke.default(this.callback)):this.promisifiedCallback=this.callback),typeof u=="number"&&u>0&&(c=setTimeout(d,u)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{o8("Resolving socket for %o request: %o",o.protocol,`${n.method} ${n.path}`),Promise.resolve(this.promisifiedCallback(n,o)).then(h,p)}catch(m){Promise.reject(m).catch(p)}}freeSocket(n,s){o8("Freeing socket %o %o",n.constructor.name,s),n.destroy()}destroy(){o8("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(dE||(dE={}));Dse.exports=dE});var Lse=I(l8=>{"use strict";var ike=l8&&l8.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(l8,"__esModule",{value:!0});var ske=ike(Mf()),a8=ske.default("https-proxy-agent:parse-proxy-response");function oke(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){a8("onclose had error %o",p)}l(c,"onclose");function u(){a8("onend")}l(u,"onend");function f(p){a(),a8("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){a8("have not received end of HTTP headers yet..."),o();return}let g=h.toString("ascii",0,h.indexOf(`\r
`)),y=+g.split(" ")[1];a8("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(oke,"parseProxyResponse");l8.default=oke});var Bse=I(Bg=>{"use strict";var ake=Bg&&Bg.__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())})},E2=Bg&&Bg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bg,"__esModule",{value:!0});var Mse=E2(require("net")),Fse=E2(require("tls")),lke=E2(require("url")),cke=E2(require("assert")),uke=E2(Mf()),fke=QL(),dke=E2(Lse()),c8=uke.default("https-proxy-agent:agent"),JL=class extends fke.Agent{static{l(this,"HttpsProxyAgent")}constructor(t){let r;if(typeof t=="string"?r=lke.default.parse(t):r=t,!r)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");c8("creating new HttpsProxyAgent instance: %o",r),super(r);let n=Object.assign({},r);this.secureProxy=r.secureProxy||mke(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 ake(this,void 0,void 0,function*(){let{proxy:n,secureProxy:s}=this,o;s?(c8("Creating `tls.Socket`: %o",n),o=Fse.default.connect(n)):(c8("Creating `net.Socket`: %o",n),o=Mse.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;hke(d,p)||(f+=`:${d}`),a.Host=f,a.Connection="close";for(let v of Object.keys(a))u+=`${v}: ${a[v]}\r
`;let h=dke.default(o);o.write(`${u}\r
`);let{statusCode:m,buffered:g}=yield h;if(m===200){if(t.once("socket",pke),r.secureEndpoint){c8("Upgrading socket connection to TLS");let v=r.servername||r.host;return Fse.default.connect(Object.assign(Object.assign({},gke(r,"host","hostname","path","port")),{socket:o,servername:v}))}return o}o.destroy();let y=new Mse.default.Socket({writable:!1});return y.readable=!0,t.once("socket",v=>{c8("replaying proxy buffer for failed request"),cke.default(v.listenerCount("data")>0),v.push(g),v.push(null)}),y})}};Bg.default=JL;function pke(e){e.resume()}l(pke,"resume");function hke(e,t){return!!(!t&&e===80||t&&e===443)}l(hke,"isDefaultPort");function mke(e){return typeof e=="string"?/^https:?$/i.test(e):!1}l(mke,"isHTTPS");function gke(e,...t){let r={},n;for(n in e)t.includes(n)||(r[n]=e[n]);return r}l(gke,"omit")});var Use=I((tM,qse)=>{"use strict";var yke=tM&&tM.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},ZL=yke(Bse());function eM(e){return new ZL.default(e)}l(eM,"createHttpsProxyAgent");(function(e){e.HttpsProxyAgent=ZL.default,e.prototype=ZL.default.prototype})(eM||(eM={}));qse.exports=eM});var jse=I(rM=>{"use strict";Object.defineProperty(rM,"__esModule",{value:!0});function vke(e,t,{signal:r}={}){return new Promise((n,s)=>{function o(){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?.addEventListener("abort",o),e.on(t,a),e.on("error",c)})}l(vke,"once");rM.default=vke});var Hse=I(qg=>{"use strict";var xke=qg&&qg.__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())})},u8=qg&&qg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qg,"__esModule",{value:!0});var _ke=u8(require("net")),bke=u8(require("tls")),nM=u8(require("url")),Cke=u8(Mf()),Eke=u8(jse()),Tke=QL(),mh=(0,Cke.default)("http-proxy-agent");function Ske(e){return typeof e=="string"?/^https:?$/i.test(e):!1}l(Ske,"isHTTPS");var iM=class extends Tke.Agent{static{l(this,"HttpProxyAgent")}constructor(t){let r;if(typeof t=="string"?r=nM.default.parse(t):r=t,!r)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");mh("Creating new HttpProxyAgent instance: %o",r),super(r);let n=Object.assign({},r);this.secureProxy=r.secureProxy||Ske(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 xke(this,void 0,void 0,function*(){let{proxy:n,secureProxy:s}=this,o=nM.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=nM.default.format(o),n.auth&&t.setHeader("Proxy-Authorization",`Basic ${Buffer.from(n.auth).toString("base64")}`);let a;if(s?(mh("Creating `tls.Socket`: %o",n),a=bke.default.connect(n)):(mh("Creating `net.Socket`: %o",n),a=_ke.default.connect(n)),t._header){let c,u;mh("Regenerating stored HTTP header string for request"),t._header=null,t._implicitHeader(),t.output&&t.output.length>0?(mh("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),mh("Output buffer: %o",t.output)):t.outputData&&t.outputData.length>0&&(mh("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),mh("Output buffer: %o",t.outputData[0].data))}return yield(0,Eke.default)(a,"connect"),a})}};qg.default=iM});var Vse=I((aM,$se)=>{"use strict";var wke=aM&&aM.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},sM=wke(Hse());function oM(e){return new sM.default(e)}l(oM,"createHttpProxyAgent");(function(e){e.HttpProxyAgent=sM.default,e.prototype=sM.default.prototype})(oM||(oM={}));$se.exports=oM});var Gse=I(mE=>{"use strict";Object.defineProperty(mE,"__esModule",{value:!0});var f8={span:Symbol.for("@azure/core-tracing span"),namespace:Symbol.for("@azure/core-tracing namespace")};function Ike(e={}){let t=new lM(e.parentContext);return e.span&&(t=t.setValue(f8.span,e.span)),e.namespace&&(t=t.setValue(f8.namespace,e.namespace)),t}l(Ike,"createTracingContext");var lM=class e{static{l(this,"TracingContextImpl")}constructor(t){this._contextMap=t instanceof e?new Map(t._contextMap):new Map}setValue(t,r){let n=new e(this);return n._contextMap.set(t,r),n}getValue(t){return this._contextMap.get(t)}deleteValue(t){let r=new e(this);return r._contextMap.delete(t),r}};function Ake(){return{end:()=>{},isRecording:()=>!1,recordException:()=>{},setAttribute:()=>{},setStatus:()=>{}}}l(Ake,"createDefaultTracingSpan");function Rke(){return{createRequestHeaders:()=>({}),parseTraceparentHeader:()=>{},startSpan:(e,t)=>({span:Ake(),tracingContext:Ike({parentContext:t.tracingContext})}),withContext(e,t,...r){return t(...r)}}}l(Rke,"createDefaultInstrumenter");var hE;function Pke(e){hE=e}l(Pke,"useInstrumenter");function pE(){return hE||(hE=Rke()),hE}l(pE,"getInstrumenter");function Oke(e){let{namespace:t,packageName:r,packageVersion:n}=e;function s(f,d,p){var h;let m=pE().startSpan(f,Object.assign(Object.assign({},p),{packageName:r,packageVersion:n,tracingContext:(h=d?.tracingOptions)===null||h===void 0?void 0:h.tracingContext})),g=m.tracingContext,y=m.span;g.getValue(f8.namespace)||(g=g.setValue(f8.namespace,t)),y.setAttribute("az.namespace",g.getValue(f8.namespace));let v=Object.assign({},d,{tracingOptions:Object.assign(Object.assign({},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 pE().withContext(f,d,...p)}l(a,"withContext");function c(f){return pE().parseTraceparentHeader(f)}l(c,"parseTraceparentHeader");function u(f){return pE().createRequestHeaders(f)}return l(u,"createRequestHeaders"),{startSpan:s,withSpan:o,withContext:a,parseTraceparentHeader:c,createRequestHeaders:u}}l(Oke,"createTracingClient");mE.createTracingClient=Oke;mE.useInstrumenter=Pke});function d8(){return gE>yE.length-16&&(zse.default.randomFillSync(yE),gE=0),yE.slice(gE,gE+=16)}var zse,yE,gE,cM=_c(()=>{zse=hr(require("crypto")),yE=new Uint8Array(256),gE=yE.length;l(d8,"rng")});var Wse,Kse=_c(()=>{Wse=/^(?:[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 kke(e){return typeof e=="string"&&Wse.test(e)}var gh,p8=_c(()=>{Kse();l(kke,"validate");gh=kke});function Nke(e,t=0){let r=(Bl[e[t+0]]+Bl[e[t+1]]+Bl[e[t+2]]+Bl[e[t+3]]+"-"+Bl[e[t+4]]+Bl[e[t+5]]+"-"+Bl[e[t+6]]+Bl[e[t+7]]+"-"+Bl[e[t+8]]+Bl[e[t+9]]+"-"+Bl[e[t+10]]+Bl[e[t+11]]+Bl[e[t+12]]+Bl[e[t+13]]+Bl[e[t+14]]+Bl[e[t+15]]).toLowerCase();if(!gh(r))throw TypeError("Stringified UUID is invalid");return r}var Bl,yh,h8=_c(()=>{p8();Bl=[];for(let e=0;e<256;++e)Bl.push((e+256).toString(16).substr(1));l(Nke,"stringify");yh=Nke});function Dke(e,t,r){let n=t&&r||0,s=t||new Array(16);e=e||{};let o=e.node||Yse,a=e.clockseq!==void 0?e.clockseq:uM;if(o==null||a==null){let h=e.random||(e.rng||d8)();o==null&&(o=Yse=[h[0]|1,h[1],h[2],h[3],h[4],h[5]]),a==null&&(a=uM=(h[6]<<8|h[7])&16383)}let c=e.msecs!==void 0?e.msecs:Date.now(),u=e.nsecs!==void 0?e.nsecs:dM+1,f=c-fM+
${kNe.sanitize(this)}`}};Yf.REQUEST_SEND_ERROR="REQUEST_SEND_ERROR";Yf.PARSE_ERROR="PARSE_ERROR";function Qoe(e){return e instanceof Yf?!0:Ud.isError(e)&&e.name==="RestError"}l(Qoe,"isRestError");var Joe="tracingPolicy";function Zoe(e={}){let t=koe(e.userAgentPrefix),r=NNe();return{name:Joe,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=DNe(r,n,t))!==null&&a!==void 0?a:{};if(!c||!u)return s(n);try{let f=await r.withContext(u,s,n);return MNe(c,f),f}catch(f){throw LNe(c,f),f}}}}l(Zoe,"tracingPolicy");function NNe(){try{return Yke.createTracingClient({namespace:"",packageName:"@azure/core-rest-pipeline",packageVersion:Ooe})}catch(e){df.warning(`Error when creating the TracingClient: ${Ud.getErrorMessage(e)}`);return}}l(NNe,"tryCreateTracingClient");function DNe(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){df.warning(`Skipping creating a tracing span due to an error: ${Ud.getErrorMessage(n)}`);return}}l(DNe,"tryCreateSpan");function LNe(e,t){try{e.setStatus({status:"error",error:Ud.isError(t)?t:void 0}),Qoe(t)&&t.statusCode&&e.setAttribute("http.status_code",t.statusCode),e.end()}catch(r){df.warning(`Skipping tracing span processing due to an error: ${Ud.getErrorMessage(r)}`)}}l(LNe,"tryProcessError");function MNe(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){df.warning(`Skipping tracing span processing due to an error: ${Ud.getErrorMessage(r)}`)}}l(MNe,"tryProcessResponse");function FNe(e){let t=Soe();return Ud.isNode&&(e.tlsOptions&&t.addPolicy(Xoe(e.tlsOptions)),t.addPolicy(zoe(e.proxyOptions)),t.addPolicy(Moe())),t.addPolicy(Hoe()),t.addPolicy(Doe(e.userAgentOptions)),t.addPolicy(Koe()),t.addPolicy(Uoe(e.retryOptions),{phase:"Retry"}),t.addPolicy(Zoe(e.userAgentOptions),{afterPhase:"Retry"}),Ud.isNode&&t.addPolicy(Roe(e.redirectOptions),{afterPhase:"Retry"}),t.addPolicy(Ioe(e.loggingOptions),{afterPhase:"Sign"}),t}l(FNe,"createPipelineFromOptions");function xE(e){return e.toLowerCase()}l(xE,"normalizeName");function*BNe(e){for(let t of e.values())yield[t.name,t.value]}l(BNe,"headerIterator");var bM=class{static{l(this,"HttpHeadersImpl")}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(xE(t),{name:t,value:String(r)})}get(t){var r;return(r=this._headersMap.get(xE(t)))===null||r===void 0?void 0:r.value}has(t){return this._headersMap.has(xE(t))}delete(t){this._headersMap.delete(xE(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 BNe(this._headersMap)}};function SM(e){return new bM(e)}l(SM,"createHttpHeaders");var qNe={};function g8(e){return e&&typeof e.pipe=="function"}l(g8,"isReadableStream");function Eoe(e){return new Promise(t=>{e.on("close",t),e.on("end",t),e.on("error",t)})}l(Eoe,"isStreamComplete");function eae(e){return e&&typeof e.byteLength=="number"}l(eae,"isArrayBuffer");var CE=class extends eNe.Transform{static{l(this,"ReportTransform")}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)}}},CM=class{static{l(this,"NodeHttpClient")}constructor(){this.cachedHttpsAgents=new WeakMap}async sendRequest(t){var r,n,s;let o=new y8.AbortController,a;if(t.abortSigna
`).join(""))}return t(e)}}}l(iDe,"ndJsonPolicy");js.RestError=Yf;js.bearerTokenAuthenticationPolicy=nDe;js.bearerTokenAuthenticationPolicyName=nae;js.createDefaultHttpClient=GNe;js.createEmptyPipeline=Soe;js.createHttpHeaders=SM;js.createPipelineFromOptions=FNe;js.createPipelineRequest=WNe;js.decompressResponsePolicy=Moe;js.decompressResponsePolicyName=Loe;js.defaultRetryPolicy=Uoe;js.exponentialRetryPolicy=YNe;js.exponentialRetryPolicyName=KNe;js.formDataPolicy=Hoe;js.formDataPolicyName=joe;js.getDefaultProxySettings=Goe;js.isRestError=Qoe;js.logPolicy=Ioe;js.logPolicyName=woe;js.ndJsonPolicy=iDe;js.ndJsonPolicyName=iae;js.proxyPolicy=zoe;js.proxyPolicyName=$oe;js.redirectPolicy=Roe;js.redirectPolicyName=Aoe;js.retryPolicy=v8;js.setClientRequestIdPolicy=Koe;js.setClientRequestIdPolicyName=Woe;js.systemErrorRetryPolicy=XNe;js.systemErrorRetryPolicyName=tae;js.throttlingRetryPolicy=QNe;js.throttlingRetryPolicyName=rae;js.tlsPolicy=Xoe;js.tlsPolicyName=Yoe;js.tracingPolicy=Zoe;js.tracingPolicyName=Joe;js.userAgentPolicy=Doe;js.userAgentPolicyName=Noe});var lae=I((x8,aae)=>{"use strict";var sDe=x8&&x8.__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())})},oDe=x8&&x8.__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}}},oae=sae(),aDe="https://monitor.azure.com//.default";function lDe(e){return null}l(lDe,"emptySendRequest");var cDe=function(){function e(t){var r=[aDe];this._azureTokenPolicy=oae.bearerTokenAuthenticationPolicy({credential:t,scopes:r})}return l(e,"AuthorizationHandler"),e.prototype.addAuthorizationHeader=function(t){return sDe(this,void 0,void 0,function(){var r,n;return oDe(this,function(s){switch(s.label){case 0:return r="authorization",n=oae.createPipelineRequest({url:"https://"}),[4,this._azureTokenPolicy.sendRequest(n,lDe)];case 1:return s.sent(),t.headers[r]=n.headers.get(r),[2]}})})},e}();aae.exports=cDe});var uae=I((m2t,cae)=>{"use strict";var uDe=m0(),fDe=yl(),dDe=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){uDe.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||fDe.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(xae.regex.test(c)){var u=new xae(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}(),xae=function(){function e(t,r){this.sizeInBytes=0,this.level=r,this.method="<no_method>",this.assembly=Qc.trim(t);var n=t.match(e.regex);n&&n.length>=5&&(this.method=Qc.trim(n[2])||this.method,this.fileName=Qc.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}();_ae.exports=_De});var bae=I(vh=>{"use strict";var bDe=vh&&vh.__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())})},CDe=vh&&vh.__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(vh,"__esModule",{value:!0});vh.FileAccessControl=void 0;var EDe=require("fs"),TDe=require("os"),I2=require("child_process"),SDe=m0(),wDe=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=EDe.existsSync(e.ICACLS_PATH)}catch{}e.OS_PROVIDES_FILE_PROTECTION||SDe.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 bDe(this,void 0,void 0,function(){var r,n;return CDe(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=I2.spawn(e.ICACLS
`)}),f.length>0&&(f=f.substring(0,f.length-1)),d=Buffer.from?Buffer.from(f):new Buffer(f),ADe.gzip(d,function(m,g){var y=g;m?(p._logWarn(Jc.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(Jc.dumpObj(o)),o[RDe.disableCollectionRequestOption]=!0;var v=+new Date,_=l(function(b){b.setEncoding("utf-8");var S="";b.on("data",function(R){S+=R}),b.on("end",function(){var R=+new Date,k=R-v;if(p._numConsecutiveFailures=0,p._isStatsbeatSender&&!p._statsbeatHasReachedIngestionAtLeastOnce&&(NDe.includes(b.statusCode)?p._statsbeatHasReachedIngestionAtLeastOnce=!0:p._statsbeatFailedToIngest()),p._statsbeat&&(b.statusCode==kDe||b.statusCode==ODe?p._statsbeat.countThrottle(xh.StatsbeatNetworkCategory.Breeze,s,b.statusCode):p._statsbeat.countRequest(xh.StatsbeatNetworkCategory.Breeze,s,k,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(xh.StatsbeatNetworkCategory.Breeze,s,b.statusCode);var V=JSON.parse(S),le=[];V.errors&&(V.errors.forEach(function(re){(re.statusCode==429||re.statusCode==500||re.statusCode==503)&&le.push(t[re.index])}),le.length>0&&p._storeToDisk(le))}catch{p._storeToDisk(t)}}if(b.statusCode===307||b.statusCode===308)if(p._numConsecutiveRedirects++,p._numConsecutiveRedirects<10){var we=b.headers.location?b.headers.location.toString():null;we&&(p._redirectedHost=we,p.send(t,r))}else{var xe={name:"Circular Redirect",message:"Error sending telemetry because of circular redirects."};p._statsbeat&&p._statsbeat.countException(xh.StatsbeatNetworkCategory.Breeze,s,xe),typeof r=="function"&&r("Error sending telemetry because of circular redirects.")}else p._numConsecutiveRedirects=0,typeof r=="function"&&r(S),p._logInfo(S),typeof p._onSuccess=="function"&&p._onSuccess(S)})},"requestCallback"),x=Jc.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(xh.StatsbeatNetworkCategory.Breeze,s,b),!p._enableDiskRetryMode||p._numConsecutiveFailures>0&&p._numConsecutiveFailures%e.MAX_CONNECTION_FAILURES_BEFORE_WARN===0){var S="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&&(S="Ingestion endpoint could not be reached "+p._numConsecutiveFailures+" consecutive times. There may be resulting telemetry loss. Most recent error:"),p._logWarn(S,Jc.dumpObj(b))}else{var S="Transient failure to reach ingestion endpoint. This batch of telemetry items will be retried. Error:";p._logInfo(S,Jc.dumpObj(b))}p._onErrorHelper(b),typeof r=="function"&&(b?(p._requestTimedOut&&(b.name="telemetry timeout",b.message="telemetry request timed out"),r(Jc.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(Jc.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||Cae.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||Cae.warn(e.TAG,t,r)},e.prototype._statsbeatFailedToIngest=function(){this._shutdownStatsbeat&&(this._failedToIngestCounter++,this._failedToIngestCounter>=3&&this._shutdownStatsbeat())},e.prototype._storeToDisk=function(t){return AE(this,void 0,void 0,function(){var r,n,s,o,a
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",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:agent":'mocha "agent/src/**/*.test.ts"',"test:extension":"tsx extension/test
`)}return n};uB.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=yue[t];if(!r){r=yue[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 UHe(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(UHe,"_encodeWithByteBuffer")});var _a=I((Wbt,Eue)=>{var _ue=Hs(),bue=xue(),Qt=Eue.exports=_ue.util=_ue.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){Qt.nextTick=process.nextTick,typeof setImmediate=="function"?Qt.setImmediate=setImmediate:Qt.setImmediate=Qt.nextTick;return}if(typeof setImmediate=="function"){Qt.setImmediate=function(){return setImmediate.apply(void 0,arguments)},Qt.nextTick=function(c){return setImmediate(c)};return}if(Qt.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=[];Qt.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=Qt.setImmediate;Qt.setImmediate=function(u){Date.now()-r>15?(r=Date.now(),o(u)):(t.push(u),t.length===1&&s.setAttribute("a",n=!n))}}Qt.nextTick=Qt.setImmediate})();Qt.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;Qt.globalScope=function(){return Qt.isNodejs?global:typeof self>"u"?window:self}();Qt.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};Qt.isArrayBuffer=function(e){return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer};Qt.isArrayBufferView=function(e){return e&&Qt.isArrayBuffer(e.buffer)&&e.byteLength!==void 0};function u6(e){if(!(e===8||e===16||e===24||e===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}l(u6,"_checkBitsParam");Qt.ByteBuffer=fB;function fB(e){if(this.data="",this.read=0,typeof e=="string")this.data=e;else if(Qt.isArrayBuffer(e)||Qt.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 fB||typeof e=="object"&&typeof e.data=="string"&&typeof e.read=="number")&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}l(fB,"ByteStringBuffer");Qt.ByteStringBuffer=fB;var jHe=4096;Qt.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>jHe&&(this.data.substr(0,1),this._constructedStringLength=0)};Qt.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};Qt.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};Qt.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))};Qt.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};Qt.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this};Qt.ByteStringBuffer.prototype.putString=function(e)
`,r=r.substr(t));return n+=r,n};Qt.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",r,n,s,o,a=0;a<e.length;)r=Dh[e.charCodeAt(a++)-43],n=Dh[e.charCodeAt(a++)-43],s=Dh[e.charCodeAt(a++)-43],o=Dh[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};Qt.encodeUtf8=function(e){return unescape(encodeURIComponent(e))};Qt.decodeUtf8=function(e){return decodeURIComponent(escape(e))};Qt.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:bue.encode,decode:bue.decode}};Qt.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)};Qt.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};Qt.binary.hex.encode=Qt.bytesToHex;Qt.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};Qt.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+=Nh.charAt(s>>2),r+=Nh.charAt((s&3)<<4|o>>4),isNaN(o)?r+="==":(r+=Nh.charAt((o&15)<<2|a>>6),r+=isNaN(a)?"=":Nh.charAt(a&63)),t&&r.length>t&&(n+=r.substr(0,t)+`\r
`,r=r.substr(t));return n+=r,n};Qt.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=Dh[e.charCodeAt(u++)-43],o=Dh[e.charCodeAt(u++)-43],a=Dh[e.charCodeAt(u++)-43],c=Dh[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)};Qt.binary.base58.encode=function(e,t){return Qt.binary.baseN.encode(e,Cue,t)};Qt.binary.base58.decode=function(e,t){return Qt.binary.baseN.decode(e,Cue,t)};Qt.text={utf8:{},utf16:{}};Qt.text.utf8.encode=function(e,t,r){e=Qt.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};Qt.text.utf8.decode=function(e){return Qt.decodeUtf8(String.fromCharCode.apply(null,e))};Qt.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};Qt.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))};Qt.deflate=function(e,t,r){if(t=Qt.decode64(e.deflate(Qt.encode64(t)).rval),r){var n=2,s=t.charCodeAt(1);s&32&&(n=6),t=t.substring(n,t.length-4)}return t};Qt.inflate=function(e,t,r){var n=e.inflate(Qt.encode64(t)).rval;return n===null?null:Qt.decode64(n)};var dB=l(function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(r===null?n=e.removeItem(t):(r=Qt.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"),pB=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(Qt.decode64(r))),r},"_getStorageObject"),$He=l(function(e,t,r,n){var s=pB(e,t);s===null&&(s={}),s[r]=n,dB(e,t,s)},"_setItem"),VHe=l(function(e,t,r){var n=pB(e,t);return n!==null&&(n=r in n?n[r]:null),n},"_getItem"),GHe=l(function(e,t,r){var n=pB(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),dB(e,t,n)}},"_removeItem"),zHe=l(function(e,t){dB(e,t,null)},"_clearItems"),pS=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");Qt.setItem=function(e,t,r,n,s){pS($He,arguments,s)};Qt.getItem=function(e,t,r,n){return pS(VHe,arguments,n)};Qt.removeItem=function(e,t,r,n){pS(GHe,arguments,n)};Qt.clearItems=function(e,t,r){pS(zHe,arguments,r)};Qt.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0};Qt.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("")};Qt.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):"")};Qt.formatSize=function(e){return e>=1073741824?e=Qt.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?e=Qt.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?e=Qt.formatNumber(e/1024,0)+" KiB":e=Qt.formatNumber(e,0)+" bytes",e};Qt.bytesFromIP=function(e){return e.indexOf(".")!==-1?Qt.bytesFromIPv4(e):e.indexOf(":")!==-1?Qt.bytesFromIPv6(e):null};Qt.bytesFromIPv4=function(e){if(e=e.split(".")
`);for(var s="",o=0;o<t*r;++o)s+=" ";switch(n+=s+"Tag: ",e.tagClass){case Ui.Class.UNIVERSAL:n+="Universal:";break;case Ui.Class.APPLICATION:n+="Application:";break;case Ui.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case Ui.Class.PRIVATE:n+="Private:";break}if(e.tagClass===Ui.Class.UNIVERSAL)switch(n+=e.type,e.type){case Ui.Type.NONE:n+=" (None)";break;case Ui.Type.BOOLEAN:n+=" (Boolean)";break;case Ui.Type.INTEGER:n+=" (Integer)";break;case Ui.Type.BITSTRING:n+=" (Bit string)";break;case Ui.Type.OCTETSTRING:n+=" (Octet string)";break;case Ui.Type.NULL:n+=" (Null)";break;case Ui.Type.OID:n+=" (Object Identifier)";break;case Ui.Type.ODESC:n+=" (Object Descriptor)";break;case Ui.Type.EXTERNAL:n+=" (External or Instance of)";break;case Ui.Type.REAL:n+=" (Real)";break;case Ui.Type.ENUMERATED:n+=" (Enumerated)";break;case Ui.Type.EMBEDDED:n+=" (Embedded PDV)";break;case Ui.Type.UTF8:n+=" (UTF8)";break;case Ui.Type.ROID:n+=" (Relative Object Identifier)";break;case Ui.Type.SEQUENCE:n+=" (Sequence)";break;case Ui.Type.SET:n+=" (Set)";break;case Ui.Type.PRINTABLESTRING:n+=" (Printable String)";break;case Ui.Type.IA5String:n+=" (IA5String (ASCII))";break;case Ui.Type.UTCTIME:n+=" (UTC time)";break;case Ui.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case Ui.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+=Ui.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===Ui.Type.OID){var u=Ui.derToOid(e.value);n+=u,f0.pki&&f0.pki.oids&&u in f0.pki.oids&&(n+=" ("+f0.pki.oids[u]+") ")}if(e.type===Ui.Type.INTEGER)try{n+=Ui.derToInteger(e.value)}catch{n+="0x"+f0.util.bytesToHex(e.value)}else if(e.type===Ui.Type.BITSTRING){if(e.value.length>1?n+="0x"+f0.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===Ui.Type.OCTETSTRING)Oue.test(e.value)||(n+="("+e.value+") "),n+="0x"+f0.util.bytesToHex(e.value);else if(e.type===Ui.Type.UTF8)try{n+=f0.util.decodeUtf8(e.value)}catch(d){if(d.message==="URI malformed")n+="0x"+f0.util.bytesToHex(e.value)+" (malformed UTF8)";else throw d}else e.type===Ui.Type.PRINTABLESTRING||e.type===Ui.Type.IA5String?n+=e.value:Oue.test(e.value)?n+="0x"+f0.util.bytesToHex(e.value):e.value.length===0?n+="[null]":n+=e.value}return n}});var Xd=I((i7t,Nue)=>{var xS=Hs();Nue.exports=xS.md=xS.md||{};xS.md.algorithms=xS.md.algorithms||{}});var s4=I((s7t,Due)=>{var a1=Hs();Xd();_a();var KHe=Due.exports=a1.hmac=a1.hmac||{};KHe.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 a1.md.algorithms)t=a1.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=a1.util.createBuffer(a);else if(a1.util.isArray(a)){var c=a;a=a1.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=a1.util.createBuffer(),n=a1.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 bS=I((o7t,Bue)=>{var Qd=Hs();Xd();_a();var Mue=Bue.exports=Qd.md5=Qd.md5||{};Qd.md.md5=Qd.md.algorithms.md5=Mue;Mue.create=function(){Fue||YHe();var e=null,t=Qd.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=Qd.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},n},n.start(),n.update=function(s,o){o==="utf8"&&(s=Qd.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),Lue(e,r,t),(t.read>2048||t.length()===0)&&t.compact(),n},n.digest=function(){var s=Qd.util.createBuffer();s.putBytes(t.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,a=o&n.blockLength-1;s.putBytes(bB.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};Lue(d,r,s);var p=Qd.util.createBuffer();return p.putInt32Le(d.h0),p.putInt32Le(d.h1),p.putInt32Le(d.h2),p.putInt32Le(d.h3),p},n};var bB=null,_S=null,p6=null,o4=null,Fue=!1;function YHe(){bB=String.fromCharCode(128),bB+=Qd.util.fillString(String.fromCharCode(0),64),_S=[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],p6=[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
`,n;if(e.procType&&(n={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},r+=CS(n)),e.contentDomain&&(n={name:"Content-Domain",values:[e.contentDomain]},r+=CS(n)),e.dekInfo&&(n={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&n.values.push(e.dekInfo.parameters),r+=CS(n)),e.headers)for(var s=0;s<e.headers.length;++s)r+=CS(e.headers[s]);return e.procType&&(r+=`\r
`),r+=ES.util.encode64(e.body,t.maxline||64)+`\r
`,r+="-----END "+e.type+`-----\r
`,r};que.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:ES.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(XHe(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 CS(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(CS,"foldHeader");function XHe(e){return e.replace(/^\s+/,"")}l(XHe,"ltrim")});var h6=I((u7t,Hue)=>{var v0=Hs();hS();gB();_a();Hue.exports=v0.des=v0.des||{};v0.des.startEncrypting=function(e,t,r,n){var s=TS({key:e,output:r,decrypt:!1,mode:n||(t===null?"ECB":"CBC")});return s.start(t),s};v0.des.createEncryptionCipher=function(e,t){return TS({key:e,output:null,decrypt:!1,mode:t})};v0.des.startDecrypting=function(e,t,r,n){var s=TS({key:e,output:r,decrypt:!0,mode:n||(t===null?"ECB":"CBC")});return s.start(t),s};v0.des.createDecryptionCipher=function(e,t){return TS({key:e,output:null,decrypt:!0,mode:t})};v0.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(n,s){return jue(r._keys,n,s,!1)},decrypt:function(n,s){return jue(r._keys,n,s,!0)}}}),r._init=!1};v0.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=v0.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=s$e(t),this._init=!0}};Jd("DES-ECB",v0.cipher.modes.ecb);Jd("DES-CBC",v0.cipher.modes.cbc);Jd("DES-CFB",v0.cipher.modes.cfb);Jd("DES-OFB",v0.cipher.modes.ofb);Jd("DES-CTR",v0.cipher.modes.ctr);Jd("3DES-ECB",v0.cipher.modes.ecb);Jd("3DES-CBC",v0.cipher.modes.cbc);Jd("3DES-CFB",v0.cipher.modes.cfb);Jd("3DES-OFB",v0.cipher.modes.ofb);Jd("3DES-CTR",v0.cipher.modes.ctr);function Jd(e,t){var r=l(function(){return new v0.des.Algorithm(e,t)},"factory");v0.cipher.registerAlgorithm(e,r)}l(Jd,"registerAlgorithm");var QHe=[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],JHe=[-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],ZHe=[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],e$e=[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],t$e=[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=Z0.util.createBuffer();y4(a,n),sp(a,e.e),sp(a,e.n);var c=Z0.util.encode64(a.bytes(),64),u=Math.floor(c.length/66)+1;o+="Public-Lines: "+u+`\r
`,o+=c;var f=Z0.util.createBuffer();sp(f,e.d),sp(f,e.p),sp(f,e.q),sp(f,e.qInv);var d;if(!t)d=Z0.util.encode64(f.bytes(),64);else{var p=f.length()+16-1;p-=p%16;var h=VS(f.bytes());h.truncate(h.length()-p+f.length()),f.putBuffer(h);var m=Z0.util.createBuffer();m.putBuffer(VS("\0\0\0\0",t)),m.putBuffer(VS("\0\0\0",t));var g=Z0.aes.createEncryptionCipher(m.truncate(8),"CBC");g.start(Z0.util.createBuffer().fillWithByte(0,16)),g.update(f.copy()),g.finish();var y=g.output;y.truncate(16),d=Z0.util.encode64(y.bytes(),64)}u=Math.floor(d.length/66)+1,o+=`\r
Private-Lines: `+u+`\r
`,o+=d;var v=VS("putty-private-key-file-mac-key",t),_=Z0.util.createBuffer();y4(_,n),y4(_,s),y4(_,r),_.putInt32(a.length()),_.putBuffer(a),_.putInt32(f.length()),_.putBuffer(f);var x=Z0.hmac.create();return x.start("sha1",v),x.update(_.bytes()),o+=`\r
Private-MAC: `+x.digest().toHex()+`\r
`,o};GS.publicKeyToOpenSSH=function(e,t){var r="ssh-rsa";t=t||"";var n=Z0.util.createBuffer();return y4(n,r),sp(n,e.e),sp(n,e.n),r+" "+Z0.util.encode64(n.bytes())+" "+t};GS.privateKeyToOpenSSH=function(e,t){return t?Z0.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):Z0.pki.privateKeyToPem(e)};GS.getPublicKeyFingerprint=function(e,t){t=t||{};var r=t.md||Z0.md.md5.create(),n="ssh-rsa",s=Z0.util.createBuffer();y4(s,n),sp(s,e.e),sp(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 sp(e,t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var n=Z0.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}l(sp,"_addBigIntegerToBuffer");function y4(e,t){e.putInt32(t.length),e.putString(t)}l(y4,"_addStringToBuffer");function VS(){for(var e=Z0.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest()}l(VS,"_sha1")});var Ode=I((aCt,Pde)=>{Pde.exports=Hs();Lh();Xfe();nd();hS();h6();hde();s4();vde();Cde();Tde();BB();SS();e5();kB();jB();Ide();$B();DB();TB();kS();xf();IB();Rde();YB();_a()});var kde=I((lCt,Cze)=>{Cze.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 Lde=I((cCt,pq)=>{var WS=Ode(),Nde=kde(),zS=pq.exports.validFormats={der:0,pem:1,txt:2,asn1:3};function Dde(e){let t=WS.pki.pemToDer(e),r=WS.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(Dde,"myASN");function Eze(e){let t=Dde(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 ${Nde.name}@${Nde.version}`,String(e)].join(`
`)}l(Eze,"txtFormat");pq.exports.transform=function(e){return function(t){try{switch(e){case zS.der:return WS.pki.pemToDer(t);case zS.pem:return t;case zS.txt:return Eze(t);case zS.asn1:return Dde(t);default:return WS.pki.certificateFromPem(t)}}catch{return}}}});var Mde=I((fCt,v4)=>{var hq=require("https"),mq=Lde();if(process.platform!=="darwin")v4.exports.all=()=>[],v4.exports.each=()=>{};else{let c=function(f,d,p){return p.indexOf(f)===d};Tze=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);hq.globalAgent.options.ca=hq.globalAgent.options.ca||[];let a=hq.globalAgent.options.ca,u=s.concat(o);u.filter(c).forEach(f=>a.push(f)),v4.exports.der2=mq.validFormats,v4.exports.all=function(f){return u.map(mq.transform(f)).filter(d=>d)},v4.exports.each=function(f,d){return typeof f=="function"&&(d=f,f=void 0),u.map(mq.transform(f)).filter(p=>p).forEach(d)}}var Tze});var Fde=I((pCt,gq)=>{function Sze(){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(Sze,"all");process.platform!=="win32"?gq.exports.all=()=>[]:gq.exports.all=Sze});var $de=I((ECt,Hde)=>{var JS=require("path").sep||"/";Hde.exports=Aze;function Aze(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=JS+JS+n),s=s.replace(/^(.+)\|/,"$1:"),JS=="\\"&&(s=s.replace(/\//g,"\\")),/^.+\:/.test(s)||(s=JS+s),n+s}l(Aze,"fileUriToPath")});var Kde=I((tw,Wde)=>{var Sq=require("fs"),ew=require("path"),Rze=$de(),ZS=ew.join,zde=ew.dirname,Vde=Sq.accessSync&&function(e){try{Sq.accessSync(e)}catch{return!1}return!0}||Sq.existsSync||ew.existsSync,Gde={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 Pze(e){typeof e=="string"?e={bindings:e}:e||(e={}),Object.keys(Gde).map(function(u){u in e||(e[u]=Gde[u])}),e.module_root||(e.module_root=zde(__filename)),ew.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=ZS.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(Pze,"bindings");Wde.exports=tw=Pze;tw.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=Rze(o)),o},"getFileName");tw.getRoot=l(function(t){for(var r=zde(t),n;;){if(r==="."&&(r=process.cwd()),Vde(ZS(r,"package.json"))||Vde(ZS(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=ZS(r,"..")}},"getRoot")});var Qde=I((wCt,Xde)=>{"use strict";function Yde(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(Yde,"validateParameter");function Oze(e,t){return Object.prototype.hasOwnProperty.call(e,t)}l(Oze,"hasOwnProperty");function kze(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];Oze(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={}),Yde(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(kze,"defineOperation");Xde.exports={defineOperation:kze,validateParameter:Yde}});var wq=I((ACt,epe)=>{"use strict";var _4=Kde()("kerberos"),x4=_4.KerberosClient,Jde=_4.KerberosServer,Vh=Qde().defineOperation,Nze=1,Dze=2,Lze=4,Mze=8,Fze=16,Bze=32,qze=64,Uze=128,jze=256,Zde=0,Hze=9,$ze=6;x4.prototype.step=Vh(x4.prototype.step,[{name:"challenge",type:"string"},{name:"callback",type:"function",required:!1}]);x4.prototype.wrap=Vh(x4.prototype.wrap,[{name:"challenge",type:"string"},{name:"options",type:"object"},{name:"callback",type:"function",required:!1}]);x4.prototype.unwrap=Vh(x4.prototype.unwrap,[{name:"challenge",type:"string"},{name:"callback",type:"function",required:!1}]);Jde.prototype.step=Vh(Jde.prototype.step,[{name:"challenge",type:"string"},{name:"callback",type:"function",required:!1}]);var Vze=Vh(_4.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}]),Gze=Vh(_4.principalDetails,[{name:"service",type:"string"},{name:"hostname",type:"string"},{name:"callback",type:"function",required:!1}]),zze=Vh(_4.initializeClient,[{name:"service",type:"string"},{name:"options",type:"object",default:{mechOID:Zde}},{name:"callback",type:"function",required:!1}]),Wze=Vh(_4.initializeServer,[{name:"service",type:"string"},{name:"callback",type:"function",required:!1}]);epe.exports={initializeClient:zze,initializeServer:Wze,principalDetails:Gze,checkPassword:Vze,GSS_C_DELEG_FLAG:Nze,GSS_C_MUTUAL_FLAG:Dze,GSS_C_REPLAY_FLAG:Lze,GSS_C_SEQUENCE_FLAG:Mze,GSS_C_CONF_FLAG:Fze,GSS_C_INTEG_FLAG:Bze,GSS_C_ANON_FLAG:qze,GSS_C_PROT_READY_FLAG:Uze,GSS_C_TRANS_FLAG:jze,GSS_C_NO_OID:Zde,GSS_MECH_OID_KRB5:Hze,GSS_MECH_OID_SPNEGO:$ze}});var tpe=I((RCt,Kze)=>{Kze.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(o1e,"dedent");N6.dedent=o1e;N6.default=o1e});var Ww=I(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 rXe(e){return e===!0||e===!1}l(rXe,"boolean");tl.boolean=rXe;function Q1e(e){return typeof e=="string"||e instanceof String}l(Q1e,"string");tl.string=Q1e;function nXe(e){return typeof e=="number"||e instanceof Number}l(nXe,"number");tl.number=nXe;function iXe(e){return e instanceof Error}l(iXe,"error");tl.error=iXe;function J1e(e){return typeof e=="function"}l(J1e,"func");tl.func=J1e;function Z1e(e){return Array.isArray(e)}l(Z1e,"array");tl.array=Z1e;function sXe(e){return Z1e(e)&&e.every(t=>Q1e(t))}l(sXe,"stringArray");tl.stringArray=sXe;function oXe(e,t){return Array.isArray(e)&&e.every(t)}l(oXe,"typedArray");tl.typedArray=oXe;function aXe(e){return e&&J1e(e.then)}l(aXe,"thenable");tl.thenable=aXe});var D4=I(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});xc.stringArray=xc.array=xc.func=xc.error=xc.number=xc.string=xc.boolean=void 0;function lXe(e){return e===!0||e===!1}l(lXe,"boolean");xc.boolean=lXe;function ehe(e){return typeof e=="string"||e instanceof String}l(ehe,"string");xc.string=ehe;function cXe(e){return typeof e=="number"||e instanceof Number}l(cXe,"number");xc.number=cXe;function uXe(e){return e instanceof Error}l(uXe,"error");xc.error=uXe;function fXe(e){return typeof e=="function"}l(fXe,"func");xc.func=fXe;function the(e){return Array.isArray(e)}l(the,"array");xc.array=the;function dXe(e){return the(e)&&e.every(t=>ehe(t))}l(dXe,"stringArray");xc.stringArray=dXe});var VU=I(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.Message=gs.NotificationType9=gs.NotificationType8=gs.NotificationType7=gs.NotificationType6=gs.NotificationType5=gs.NotificationType4=gs.NotificationType3=gs.NotificationType2=gs.NotificationType1=gs.NotificationType0=gs.NotificationType=gs.RequestType9=gs.RequestType8=gs.RequestType7=gs.RequestType6=gs.RequestType5=gs.RequestType4=gs.RequestType3=gs.RequestType2=gs.RequestType1=gs.RequestType=gs.RequestType0=gs.AbstractMessageSignature=gs.ParameterStructures=gs.ResponseError=gs.ErrorCodes=void 0;var y5=D4(),rhe;(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})(rhe=gs.ErrorCodes||(gs.ErrorCodes={}));var bU=class e extends Error{static{l(this,"ResponseError")}constructor(t,r,n){super(r),this.code=y5.number(t)?t:rhe.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,e.prototype)}toJson(){let t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),t}};gs.ResponseError=bU;var cu=class e{static{l(this,"ParameterStructures")}constructor(t){this.kind=t}static is(t){return t===e.auto||t===e.byName||t===e.byPosition}toString(){return this.kind}};gs.ParameterStructures=cu;cu.auto=new cu("auto");cu.byPosition=new cu("byPosition");cu.byName=new cu("byName");var h0=class{static{l(this,"AbstractMessageSignature")}constructor(t,r){this.method=t,this.numberOfParams=r}get parameterStructures(){return cu.auto}};gs.AbstractMessageSignature=h0;var CU=class extends h0{static{l(this,"RequestType0")}constructor(t){super(t,0)}};gs.RequestType0=CU;var EU=class extends h0{static{l(this,"RequestType")}constructor(t,r=cu.auto){super(t,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};gs.RequestType=EU;var TU=class extends h0{static{l(this,"RequestType1")}constructor(t,r=cu.auto){super(t,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};gs.RequestType1=TU;var SU=class extends h0{static{l(this,"RequestType2")}constructor(t){super(t,2)}};g
`,wXe;(function(e){function t(r){let n=r;return n&&V6.func(n.dispose)&&V6.func(n.onClose)&&V6.func(n.onError)&&V6.func(n.write)}l(t,"is"),e.is=t})(wXe=y1.MessageWriter||(y1.MessageWriter={}));var eI=class{static{l(this,"AbstractMessageWriter")}constructor(){this.errorEmitter=new lhe.Emitter,this.closeEmitter=new lhe.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: ${V6.string(t.message)?t.message:"unknown"}`)}};y1.AbstractMessageWriter=eI;var uj;(function(e){function t(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,ahe.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,ahe.default)().applicationJson.encoder}}l(t,"fromOptions"),e.fromOptions=t})(uj||(uj={}));var fj=class extends eI{static{l(this,"WriteableStreamMessageWriter")}constructor(t,r){super(),this.writable=t,this.options=uj.fromOptions(r),this.errorCount=0,this.writeSemaphore=new TXe.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(SXe,n.byteLength.toString(),che),s.push(che),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()}};y1.WriteableStreamMessageWriter=fj});var fhe=I(tI=>{"use strict";Object.defineProperty(tI,"__esModule",{value:!0});tI.AbstractMessageBuffer=void 0;var IXe=13,AXe=10,RXe=`\r
`,dj=class{static{l(this,"AbstractMessageBuffer")}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 IXe:switch(r){case 0:r=1;break;case 2:r=3;break;default:r=0}break;case AXe: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(RXe);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}};tI.AbstractMessageBuffer=dj});var vhe=I(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.createMessageConnection=hs.ConnectionOptions=hs.MessageStrategy=hs.CancellationStrategy=hs.CancellationSenderStrategy=hs.CancellationReceiverStrategy=hs.RequestCancellationReceiverStrategy=hs.IdCancellationReceiverStrategy=hs.ConnectionStrategy=hs.ConnectionError=hs.ConnectionErrors=hs.LogTraceNotification=hs.SetTraceNotification=hs.TraceFormat=hs.TraceValues=hs.Trace=hs.NullLogger=hs.ProgressType=hs.ProgressToken=void 0;var dhe=tm(),I0=D4(),Ts=VU(),phe=zU(),G6=L4(),pj=Qw(),W6;(function(e){e.type=new Ts.NotificationType("$/cancelRequest")})(W6||(W6={}));var hhe;(function(e){function t(r){return typeof r=="string"||typeof r=="number"}l(t,"is"),e.is=t})(hhe=hs.ProgressToken||(hs.ProgressToken={}));var z6;(function(e){e.type=new Ts.NotificationType("$/progress")})(z6||(z6={}));var hj=class{static{l(this,"ProgressType")}constructor(){}};hs.ProgressType=hj;var mj;(function(e){function t(r){return I0.func(r)}l(t,"is"),e.is=t})(mj||(mj={}));hs.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var qa;(function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Compact=2]="Compact",e[e.Verbose=3]="Verbose"})(qa=hs.Trace||(hs.Trace={}));var PXe;(function(e){e.Off="off",e.Messages="messages",e.Compact="compact",e.Verbose="verbose"})(PXe=hs.TraceValues||(hs.TraceValues={}));(function(e){function t(n){if(!I0.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})(qa=hs.Trace||(hs.Trace={}));var cd;(function(e){e.Text="text",e.JSON="json"})(cd=hs.TraceFormat||(hs.TraceFormat={}));(function(e){function t(r){return I0.string(r)?(r=r.toLowerCase(),r==="json"?e.JSON:e.Text):e.Text}l(t,"fromString"),e.fromString=t})(cd=hs.TraceFormat||(hs.TraceFormat={}));var mhe;(function(e){e.type=new Ts.NotificationType("$/setTrace")})(mhe=hs.SetTraceNotification||(hs.SetTraceNotification={}));var gj;(function(e){e.type=new Ts.NotificationType("$/logTrace")})(gj=hs.LogTrace
${JSON.stringify(w.error,void 0,4)}`):s.error("Received response message without id. No further error information provided.");else{let O=w.id,pr=v.get(O);if(Ue(w,pr),pr!==void 0){v.delete(O);try{if(w.error){let wr=w.error;pr.reject(new Ts.ResponseError(wr.code,wr.message,wr.data))}else if(w.result!==void 0)pr.resolve(w.result);else throw new Error("Should never happen.")}catch(wr){wr.message?s.error(`Response handler '${pr.method}' failed with message: ${wr.message}`):s.error(`Response handler '${pr.method}' failed unexpectedly.`)}}}}l(Ar,"handleResponse");function br(w){if(ze())return;let O,pr;if(w.method===W6.type.method){let wr=w.params.id;_.delete(wr),We(w);return}else{let wr=h.get(w.method);wr&&(pr=wr.handler,O=wr.type)}if(pr||p)try{if(We(w),pr)if(w.params===void 0)O!==void 0&&O.numberOfParams!==0&&O.parameterStructures!==Ts.ParameterStructures.byName&&s.error(`Notification ${w.method} defines ${O.numberOfParams} params but received none.`),pr();else if(Array.isArray(w.params)){let wr=w.params;w.method===z6.type.method&&wr.length===2&&hhe.is(wr[0])?pr({token:wr[0],value:wr[1]}):(O!==void 0&&(O.parameterStructures===Ts.ParameterStructures.byName&&s.error(`Notification ${w.method} defines parameters by name but received parameters by position`),O.numberOfParams!==w.params.length&&s.error(`Notification ${w.method} defines ${O.numberOfParams} params but received ${wr.length} arguments`)),pr(...wr))}else O!==void 0&&O.parameterStructures===Ts.ParameterStructures.byPosition&&s.error(`Notification ${w.method} defines parameters by position but received parameters by name`),pr(w.params);else p&&p(w.method,w.params)}catch(wr){wr.message?s.error(`Notification handler '${w.method}' failed with message: ${wr.message}`):s.error(`Notification handler '${w.method}' failed unexpectedly.`)}else we.fire(w)}l(br,"handleNotification");function Or(w){if(!w){s.error("Received empty message.");return}s.error(`Received message which is neither a response nor a notification message:
${JSON.stringify(w,null,4)}`);let O=w;if(I0.string(O.id)||I0.number(O.id)){let pr=O.id,wr=v.get(pr);wr&&wr.reject(new Error("The received response has neither a result nor an error property."))}}l(Or,"handleInvalidMessage");function Dr(w){if(w!=null)switch(b){case qa.Verbose:return JSON.stringify(w,null,4);case qa.Compact:return JSON.stringify(w);default:return}}l(Dr,"stringifyTrace");function se(w){if(!(b===qa.Off||!R))if(S===cd.Text){let O;(b===qa.Verbose||b===qa.Compact)&&w.params&&(O=`Params: ${Dr(w.params)}
`),R.log(`Sending request '${w.method} - (${w.id})'.`,O)}else ye("send-request",w)}l(se,"traceSendingRequest");function fr(w){if(!(b===qa.Off||!R))if(S===cd.Text){let O;(b===qa.Verbose||b===qa.Compact)&&(w.params?O=`Params: ${Dr(w.params)}
`:O=`No parameters provided.
`),R.log(`Sending notification '${w.method}'.`,O)}else ye("send-notification",w)}l(fr,"traceSendingNotification");function E(w,O,pr){if(!(b===qa.Off||!R))if(S===cd.Text){let wr;(b===qa.Verbose||b===qa.Compact)&&(w.error&&w.error.data?wr=`Error data: ${Dr(w.error.data)}
`:w.result?wr=`Result: ${Dr(w.result)}
`:w.error===void 0&&(wr=`No result returned.
`)),R.log(`Sending response '${O} - (${w.id})'. Processing request took ${Date.now()-pr}ms`,wr)}else ye("send-response",w)}l(E,"traceSendingResponse");function ce(w){if(!(b===qa.Off||!R))if(S===cd.Text){let O;(b===qa.Verbose||b===qa.Compact)&&w.params&&(O=`Params: ${Dr(w.params)}
`),R.log(`Received request '${w.method} - (${w.id})'.`,O)}else ye("receive-request",w)}l(ce,"traceReceivedRequest");function We(w){if(!(b===qa.Off||!R||w.method===gj.type.method))if(S===cd.Text){let O;(b===qa.Verbose||b===qa.Compact)&&(w.params?O=`Params: ${Dr(w.params)}
`:O=`No parameters provided.
`),R.log(`Received notification '${w.method}'.`,O)}else ye("receive-notification",w)}l(We,"traceReceivedNotification");function Ue(w,O){if(!(b===qa.Off||!R))if(S===cd.Text){let pr;if((b===qa.Verbose||b===qa.Compact)&&(w.error&&w.error.data?pr=`Error data: ${Dr(w.error.data)}
`:w.result?pr=`Result: ${Dr(w.result)}
`:w.error===void 0&&(pr=`No result returned.
`)),O){let wr=w.error?` Request failed: ${w.error.message} (${w.error.code}).`:"";R.log(`Received response '${O.method} - (${w.id})' in ${Date.now()-O.timerStart}ms.${wr}`,pr)}else R.log(`Received response ${w.id} without active response promise.`,pr)}else ye("receive-response",w)}l(Ue,"traceReceivedResponse");function ye(w,O){if(!R||b===qa.Off)return;let pr={isLSPMessage:!0,type:w,message:O,timestamp:Date.now()};R.log(pr)}l(ye,"logLSPMessage");function yr(){if(Se())throw new B4(rI.Closed,"Connection is closed.");if(ze())throw new B4(rI.Disposed,"Connection is disposed.")}l(yr,"throwIfClosedOrDisposed");function gr(){if(dr())throw new B4(rI.AlreadyListening,"Connection is already listening")}l(gr,"throwIfListening");function Rr(){if(!dr())throw new Error("Call listen() first.")}l(Rr,"throwIfNotListening");function Br(w){return w===void 0?null:w}l(Br,"undefinedToNull");function fn(w){if(w!==null)return w}l(fn,"nullToUndefined");function ki(w){return w!=null&&!Array.isArray(w)&&typeof w=="object"}l(ki,"isNamedParam");function Fi(w,O){switch(w){case Ts.ParameterStructures.auto:return ki(O)?fn(O):[Br(O)];case Ts.ParameterStructures.byName:if(!ki(O))throw new Error("Received parameters by name but param is not an object literal.");return fn(O);case Ts.ParameterStructures.byPosition:return[Br(O)];default:throw new Error(`Unknown parameter structure ${w.toString()}`)}}l(Fi,"computeSingleParam");function tn(w,O){let pr,wr=w.numberOfParams;switch(wr){case 0:pr=void 0;break;case 1:pr=Fi(w.parameterStructures,O[0]);break;default:pr=[];for(let cn=0;cn<O.length&&cn<wr;cn++)pr.push(Br(O[cn]));if(O.length<wr)for(let cn=O.length;cn<wr;cn++)pr.push(null);break}return pr}l(tn,"computeMessageParams");let Oi={sendNotification:(w,...O)=>{yr();let pr,wr;if(I0.string(w)){pr=w;let dn=O[0],yn=0,_n=Ts.ParameterStructures.auto;Ts.ParameterStructures.is(dn)&&(yn=1,_n=dn);let Ur=O.length,hn=Ur-yn;switch(hn){case 0:wr=void 0;break;case 1:wr=Fi(_n,O[yn]);break;default:if(_n===Ts.ParameterStructures.byName)throw new Error(`Received ${hn} parameters for 'by Name' notification parameter structure.`);wr=O.slice(yn,Ur).map(ln=>Br(ln));break}}else{let dn=O;pr=w.method,wr=tn(w,dn)}let cn={jsonrpc:u,method:pr,params:wr};return fr(cn),t.write(cn).catch(dn=>{throw s.error("Sending notification failed."),dn})},onNotification:(w,O)=>{yr();let pr;return I0.func(w)?p=w:O&&(I0.string(w)?(pr=w,h.set(w,{type:void 0,handler:O})):(pr=w.method,h.set(w.method,{type:w,handler:O}))),{dispose:()=>{pr!==void 0?h.delete(pr):p=void 0}}},onProgress:(w,O,pr)=>{if(m.has(O))throw new Error(`Progress handler for token ${O} already registered`);return m.set(O,pr),{dispose:()=>{m.delete(O)}}},sendProgress:(w,O,pr)=>Oi.sendNotification(z6.type,{token:O,value:pr}),onUnhandledProgress:xe.event,sendRequest:(w,...O)=>{yr(),Rr();let pr,wr,cn;if(I0.string(w)){pr=w;let Ur=O[0],hn=O[O.length-1],ln=0,Ci=Ts.ParameterStructures.auto;Ts.ParameterStructures.is(Ur)&&(ln=1,Ci=Ur);let Ii=O.length;pj.CancellationToken.is(hn)&&(Ii=Ii-1,cn=hn);let Pi=Ii-ln;switch(Pi){case 0:wr=void 0;break;case 1:wr=Fi(Ci,O[ln]);break;default:if(Ci===Ts.ParameterStructures.byName)throw new Error(`Received ${Pi} parameters for 'by Name' request parameter structure.`);wr=O.slice(ln,Ii).map(vt=>Br(vt));break}}else{let Ur=O;pr=w.method,wr=tn(w,Ur);let hn=w.numberOfParams;cn=pj.CancellationToken.is(Ur[hn])?Ur[hn]:void 0}let dn=o++,yn;cn&&(yn=cn.onCancellationRequested(()=>{let Ur=oe.sender.sendCancellation(Oi,dn);return Ur===void 0?(s.log(`Received no promise from cancellation strategy when cancelling id ${dn}`),Promise.resolve()):Ur.catch(()=>{s.log(`Sending cancellation messages for id ${dn} failed`)})}));let _n={jsonrpc:u,id:dn,method:pr,params:wr};return se(_n),typeof oe.sender.enableCancellation=="function"&&oe.sender.enableCancellation(_n),new Promise(async(Ur,hn)=>{let ln=l(Pi=>{Ur(Pi),oe.sender.cleanup(dn),yn?.dispose()},"resolveWithCleanup"),Ci=l(Pi=>{hn(Pi),oe.sender.cleanup(dn),yn?.dispose()},"rejectWithCleanup"),Ii={method:pr,timerStart:Date.now(),resolve:ln,reject:Ci};try{await t.write(_n),v.set(dn,Ii)}catch(Pi)
`,`\r
`,"\r"];var Ii;(function(L){function Ee(Et,ur,Mr,xi){return new Pi(Et,ur,Mr,xi)}l(Ee,"create"),L.create=Ee;function Be(Et){var ur=Et;return!!(vt.defined(ur)&&vt.string(ur.uri)&&(vt.undefined(ur.languageId)||vt.string(ur.languageId))&&vt.uinteger(ur.lineCount)&&vt.func(ur.getText)&&vt.func(ur.positionAt)&&vt.func(ur.offsetAt))}l(Be,"is"),L.is=Be;function X(Et,ur){for(var Mr=Et.getText(),xi=N(ur,function(Hi,$i){var Wi=Hi.range.start.line-$i.range.start.line;return Wi===0?Hi.range.start.character-$i.range.start.character:Wi}),mn=Mr.length,Ni=xi.length-1;Ni>=0;Ni--){var Di=xi[Ni],Bi=Et.offsetAt(Di.range.start),rn=Et.offsetAt(Di.range.end);if(rn<=mn)Mr=Mr.substring(0,Bi)+Di.newText+Mr.substring(rn,Mr.length);else throw new Error("Overlapping edit");mn=Bi}return Mr}l(X,"applyEdits"),L.applyEdits=X;function N(Et,ur){if(Et.length<=1)return Et;var Mr=Et.length/2|0,xi=Et.slice(0,Mr),mn=Et.slice(Mr);N(xi,ur),N(mn,ur);for(var Ni=0,Di=0,Bi=0;Ni<xi.length&&Di<mn.length;){var rn=ur(xi[Ni],mn[Di]);rn<=0?Et[Bi++]=xi[Ni++]:Et[Bi++]=mn[Di++]}for(;Ni<xi.length;)Et[Bi++]=xi[Ni++];for(;Di<mn.length;)Et[Bi++]=mn[Di++];return Et}l(N,"mergeSort")})(Ii=t.TextDocument||(t.TextDocument={}));var Pi=function(){function L(Ee,Be,X,N){this._uri=Ee,this._languageId=Be,this._version=X,this._content=N,this._lineOffsets=void 0}return l(L,"FullTextDocument"),Object.defineProperty(L.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),L.prototype.getText=function(Ee){if(Ee){var Be=this.offsetAt(Ee.start),X=this.offsetAt(Ee.end);return this._content.substring(Be,X)}return this._content},L.prototype.update=function(Ee,Be){this._content=Ee.text,this._version=Be,this._lineOffsets=void 0},L.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var Ee=[],Be=this._content,X=!0,N=0;N<Be.length;N++){X&&(Ee.push(N),X=!1);var Et=Be.charAt(N);X=Et==="\r"||Et===`
`,Et==="\r"&&N+1<Be.length&&Be.charAt(N+1)===`
`&&N++}X&&Be.length>0&&Ee.push(Be.length),this._lineOffsets=Ee}return this._lineOffsets},L.prototype.positionAt=function(Ee){Ee=Math.max(Math.min(Ee,this._content.length),0);var Be=this.getLineOffsets(),X=0,N=Be.length;if(N===0)return a.create(0,Ee);for(;X<N;){var Et=Math.floor((X+N)/2);Be[Et]>Ee?N=Et:X=Et+1}var ur=X-1;return a.create(ur,Ee-Be[ur])},L.prototype.offsetAt=function(Ee){var Be=this.getLineOffsets();if(Ee.line>=Be.length)return this._content.length;if(Ee.line<0)return 0;var X=Be[Ee.line],N=Ee.line+1<Be.length?Be[Ee.line+1]:this._content.length;return Math.max(Math.min(X+Ee.character,N),X)},Object.defineProperty(L.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),L}(),vt;(function(L){var Ee=Object.prototype.toString;function Be(rn){return typeof rn<"u"}l(Be,"defined"),L.defined=Be;function X(rn){return typeof rn>"u"}l(X,"undefined"),L.undefined=X;function N(rn){return rn===!0||rn===!1}l(N,"boolean"),L.boolean=N;function Et(rn){return Ee.call(rn)==="[object String]"}l(Et,"string"),L.string=Et;function ur(rn){return Ee.call(rn)==="[object Number]"}l(ur,"number"),L.number=ur;function Mr(rn,Hi,$i){return Ee.call(rn)==="[object Number]"&&Hi<=rn&&rn<=$i}l(Mr,"numberRange"),L.numberRange=Mr;function xi(rn){return Ee.call(rn)==="[object Number]"&&-2147483648<=rn&&rn<=2147483647}l(xi,"integer"),L.integer=xi;function mn(rn){return Ee.call(rn)==="[object Number]"&&0<=rn&&rn<=2147483647}l(mn,"uinteger"),L.uinteger=mn;function Ni(rn){return Ee.call(rn)==="[object Function]"}l(Ni,"func"),L.func=Ni;function Di(rn){return rn!==null&&typeof rn=="object"}l(Di,"objectLiteral"),L.objectLiteral=Di;function Bi(rn,Hi){return Array.isArray(rn)&&rn.every(Hi)}l(Bi,"typedArray"),L.typedArray=Bi})(vt||(vt={}))})});var A0=I(Fc=>{"use strict";Object.defineProperty(Fc,"__esModule",{value:!0});Fc.ProtocolNotificationType=Fc.ProtocolNotificationType0=Fc.ProtocolRequestType=Fc.ProtocolRequestType0=Fc.RegistrationType=Fc.MessageDirection=void 0;var U4=C5(),YXe;(function(e){e.clientToServer="clientToServer",e.serverToClient="serverToClient",e.both="both"})(YXe=Fc.MessageDirection||(Fc.MessageDirection={}));var Dj=class{static{l(this,"RegistrationType")}constructor(t){this.method=t}};Fc.RegistrationType=Dj;var Lj=class extends U4.RequestType0{static{l(this,"ProtocolRequestType0")}constructor(t){super(t)}};Fc.ProtocolRequestType0=Lj;var Mj=class extends U4.RequestType{static{l(this,"ProtocolRequestType")}constructor(t){super(t,U4.ParameterStructures.byName)}};Fc.ProtocolRequestType=Mj;var Fj=class extends U4.NotificationType0{static{l(this,"ProtocolNotificationType0")}constructor(t){super(t)}};Fc.ProtocolNotificationType0=Fj;var Bj=class extends U4.NotificationType{static{l(this,"ProtocolNotificationType")}constructor(t){super(t,U4.ParameterStructures.byName)}};Fc.ProtocolNotificationType=Bj});var cI=I(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.objectLiteral=rl.typedArray=rl.stringArray=rl.array=rl.func=rl.error=rl.number=rl.string=rl.boolean=void 0;function XXe(e){return e===!0||e===!1}l(XXe,"boolean");rl.boolean=XXe;function Rhe(e){return typeof e=="string"||e instanceof String}l(Rhe,"string");rl.string=Rhe;function QXe(e){return typeof e=="number"||e instanceof Number}l(QXe,"number");rl.number=QXe;function JXe(e){return e instanceof Error}l(JXe,"error");rl.error=JXe;function ZXe(e){return typeof e=="function"}l(ZXe,"func");rl.func=ZXe;function Phe(e){return Array.isArray(e)}l(Phe,"array");rl.array=Phe;function eQe(e){return Phe(e)&&e.every(t=>Rhe(t))}l(eQe,"stringArray");rl.stringArray=eQe;function tQe(e,t){return Array.isArray(e)&&e.every(t)}l(tQe,"typedArray");rl.typedArray=tQe;function rQe(e){return e!==null&&typeof e=="object"}l(rQe,"objectLiteral");rl.objectLiteral=rQe});var khe=I(Y6=>{"use strict";Object.defineProperty(Y6,"__esModule",{value:!0});Y6.ImplementationRequest=void 0;var Ohe=A0(),nQe;(function(e){e.method="textDocument/implementation",e.messageDirection=Ohe.MessageDirection.clientToServer,e.type=new Ohe.ProtocolRequestType(e.method)})(nQe=Y6.I
`).map(s=>s.split(" ")),n=0;return r.forEach(s=>{s.length>1&&hu.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),hu.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=hu.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>hu.stringWidth(a)&&(d+=" ".repeat(f-hu.stringWidth(a))),t[c].align&&t[c].align!=="left"&&this.wrap){let h=T2e[t[c].align];d=h(d,f),hu.stringWidth(d)<f&&(d+=" ".repeat((u||0)-hu.stringWidth(d)-1))}let p=t[c].padding||[0,0,0,0];p[Nx]&&(o+=" ".repeat(p[Nx])),o+=K$(t[c],d,"| "),o+=d,o+=K$(t[c],d," |"),p[kx]&&(o+=" ".repeat(p[kx])),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=hu.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=hu.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[S2e]||0).fill("")),s.push(...new Array(o.padding[w2e]||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[Nx]||0)+(t.padding[kx]||0)),t.border&&(r-=4),r}columnWidths(t){if(!this.wrap)return t.map(a=>a.width||hu.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,I2e(t[c])):a)}};function K$(e,t,r){return e.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?r:" ":""}l(K$,"addBorder");function I2e(e){let t=e.padding||[],r=1+(t[Nx]||0)+(t[kx]||0);return e.border?r+4:r}l(I2e,"_minWidth");function A2e(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}l(A2e,"getWindowWidth");function R2e(e,t){e=e.trim();let r=hu.stringWidth(e);return r<t?" ".repeat(t-r)+e:e}l(R2e,"alignRight");function P2e(e,t){e=e.trim();let r=hu.stringWidth(e);return r>=t?e:" ".repeat(t-r>>1)+e}l(P2e,"alignCenter");var hu;function Y$(e,t){return hu=t,new eR({width:e?.width||A2e(),wrap:e?.wrap})}l(Y$,"cliui");var X$=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function tR(e){return e.replace(X$,"")}l(tR,"stripAnsi");function Q$(e,t){let[r,n]=e.match(X$)||["",""];e=tR(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(Q$,"wrap");function rR(e){return Y$(e,{stringWidth:t=>[...t].length,stripAnsi:tR,wrap:Q$})}l(rR,"ui");var q5=require("path"),Dx=require("fs");function nR(e,t){let r=(0,q5.resolve)(".",e),n;for((0,Dx.statSync)(r).isDirectory()||(r=(0,q5.dirname)(r));;){if(n=t(r,(0,Dx.readdirSync)(r)),n)return(0,q5.resolve)(r,n);if(r=(0,q5.dirname)(n=r),n===r)break}}l(nR,"default");var pV=require("util"),hV=require("fs"),mV=require("url");var rV=require("util"),Bx=require("path");function ym(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(ym,"camelCase");function Lx(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(Lx,"decamelize");function Mx(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(Mx,"looksLikeNumber");function J$(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(J$,"tokenizeArgString");var Bu;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(Bu||(Bu={}));var Cp,Fx=class{static{l(this,"YargsParser")}constructor(t){Cp=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=J$(t),o=typeof t=="string",a=O2e(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.__||Cp.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(E){let ce=typeof E=="object"?E.key:E,We=Object.keys(E).map(function(Ue){return{boolean:"bools",string:"strings",number:"numbers"}[Ue]}).filter(Boolean).pop();We&&(v[We][ce]=!0),v.arrays[ce]=!0,v.keys.push(ce)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(E){v.bools[E]=!0,v.keys.push(E)}),[].concat(n.string||[]).filter(Boolean).forEach(function(E){v.strings[E]=!0,v.keys.push(E)}),[].concat(n.number||[]).filter(Boolean).forEach(function(E){v.numbers[E]=!0,v.keys.push(E)}),[].concat(n.count||[]).filter(Boolean).forEach(function(E){v.counts[E]=!0,v.keys.push(E)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(E){v.normalize[E]=!0,v.keys.push(E)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([E,ce])=>{typeof ce=="number"&&(v.nargs[E]=ce,v.keys.push(E))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([E,ce])=>{typeof ce=="function"&&(v.coercions[E]=ce,v.keys.push(E))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.con
`:wt=`${oe} [${r("command")}]
`,ze.div(`${wt}`)}}if(h.length>1||h.length===1&&!h[0][2]){ze.div(r("Commands:"));let wt=e.getInternalMethods().getContext(),xr=wt.commands.length?`${wt.commands.join(" ")} `:"";e.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(h=h.sort((Ar,br)=>Ar[0].localeCompare(br[0])));let Er=oe?`${oe} `:"";h.forEach(Ar=>{let br=`${Er}${xr}${Ar[0].replace(/^\$0 ?/,"")}`;ze.span({text:br,padding:[0,2,0,2],width:x(h,Se,`${oe}${xr}`)+4},{text:Ar[1]});let Or=[];Ar[2]&&Or.push(`[${r("default")}]`),Ar[3]&&Ar[3].length&&Or.push(`[${r("aliases:")} ${Ar[3].join(", ")}]`),Ar[4]&&(typeof Ar[4]=="string"?Or.push(`[${r("deprecated: %s",Ar[4])}]`):Or.push(`[${r("deprecated")}]`)),Or.length?ze.div({text:Or.join(" "),padding:[0,0,0,2],align:"right"}):ze.div()}),ze.div()}let Q=(Object.keys(je.alias)||[]).concat(Object.keys(e.parsed.newAliases)||[]);dr=dr.filter(wt=>!e.parsed.newAliases[wt]&&Q.every(xr=>(je.alias[xr]||[]).indexOf(wt)===-1));let ie=r("Options:");Ve[ie]||(Ve[ie]=[]),R(dr,je.alias,Ve,ie);let Mt=l(wt=>/^--/.test(Hx(wt)),"isLongSwitch"),Ct=Object.keys(Ve).filter(wt=>Ve[wt].length>0).map(wt=>{let xr=Ve[wt].filter(k).map(Er=>{if(Q.includes(Er))return Er;for(let Ar=0,br;(br=Q[Ar])!==void 0;Ar++)if((je.alias[br]||[]).includes(Er))return br;return Er});return{groupName:wt,normalizedKeys:xr}}).filter(({normalizedKeys:wt})=>wt.length>0).map(({groupName:wt,normalizedKeys:xr})=>{let Er=xr.reduce((Ar,br)=>(Ar[br]=[br].concat(je.alias[br]||[]).map(Or=>wt===n.getPositionalGroupName()?Or:(/^[0-9]$/.test(Or)?je.boolean.includes(br)?"-":"--":Or.length>1?"--":"-")+Or).sort((Or,Dr)=>Mt(Or)===Mt(Dr)?0:Mt(Or)?1:-1).join(", "),Ar),{});return{groupName:wt,normalizedKeys:xr,switches:Er}});if(Ct.filter(({groupName:wt})=>wt!==n.getPositionalGroupName()).some(({normalizedKeys:wt,switches:xr})=>!wt.every(Er=>Mt(xr[Er])))&&Ct.filter(({groupName:wt})=>wt!==n.getPositionalGroupName()).forEach(({normalizedKeys:wt,switches:xr})=>{wt.forEach(Er=>{Mt(xr[Er])&&(xr[Er]=z2e(xr[Er],4))})}),Ct.forEach(({groupName:wt,normalizedKeys:xr,switches:Er})=>{ze.div(wt),xr.forEach(Ar=>{let br=Er[Ar],Or=m[Ar]||"",Dr=null;Or.includes(_)&&(Or=r(Or.substring(_.length))),je.boolean.includes(Ar)&&(Dr=`[${r("boolean")}]`),je.count.includes(Ar)&&(Dr=`[${r("count")}]`),je.string.includes(Ar)&&(Dr=`[${r("string")}]`),je.normalize.includes(Ar)&&(Dr=`[${r("string")}]`),je.array.includes(Ar)&&(Dr=`[${r("array")}]`),je.number.includes(Ar)&&(Dr=`[${r("number")}]`);let se=l(ce=>typeof ce=="string"?`[${r("deprecated: %s",ce)}]`:`[${r("deprecated")}]`,"deprecatedExtra"),fr=[Ar in de?se(de[Ar]):null,Dr,Ar in j?`[${r("required")}]`:null,je.choices&&je.choices[Ar]?`[${r("choices:")} ${n.stringifiedValues(je.choices[Ar])}]`:null,V(je.default[Ar],je.defaultDescription[Ar])].filter(Boolean).join(" ");ze.span({text:Hx(br),padding:[0,2,0,2+CV(br)],width:x(Er,Se)+4},Or);let E=e.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;fr&&!E?ze.div({text:fr,padding:[0,0,0,2],align:"right"}):ze.div()}),ze.div()}),p.length&&(ze.div(r("Examples:")),p.forEach(wt=>{wt[0]=wt[0].replace(/\$0/g,oe)}),p.forEach(wt=>{wt[1]===""?ze.div({text:wt[0],padding:[0,2,0,2]}):ze.div({text:wt[0],padding:[0,2,0,2],width:x(p,Se)+4},{text:wt[1]})}),ze.div()),g.length>0){let wt=g.map(xr=>xr.replace(/\$0/g,oe)).join(`
`);ze.div(`${wt}
`)}return ze.toString().replace(/\s*$/,"")},"help");function x(re,oe,j){let z=0;return Array.isArray(re)||(re=Object.values(re).map(de=>[de])),re.forEach(de=>{z=Math.max(t.stringWidth(j?`${j} ${Hx(de[0])}`:Hx(de[0]))+CV(de[0]),z)}),oe&&(z=Math.min(z,parseInt((oe*.5).toString(),10))),z}l(x,"maxWidth");function b(){let re=e.getDemandedOptions(),oe=e.getOptions();(Object.keys(oe.alias)||[]).forEach(j=>{oe.alias[j].forEach(z=>{m[z]&&n.describe(j,m[z]),z in re&&e.demandOption(j,re[z]),oe.boolean.includes(z)&&e.boolean(j),oe.count.includes(z)&&e.count(j),oe.string.includes(z)&&e.string(j),oe.normalize.includes(z)&&e.normalize(j),oe.array.includes(z)&&e.array(j),oe.number.includes(z)&&e.number(j)})})}l(b,"normalizeAliases");let S;n.cacheHelpMessage=function(){S=this.help()},n.clearCachedHelpMessage=function(){S=void 0},n.hasCachedHelpMessage=function(){return!!S};function R(re,oe,j,z){let de=[],Ve=null;return Object.keys(j).forEach(je=>{de=de.concat(j[je])}),re.forEach(je=>{Ve=[je].concat(oe[je]),Ve.some(dr=>de.indexOf(dr)!==-1)||j[z].push(je)}),de}l(R,"addUngroupedKeys");function k(re){return e.getOptions().hiddenOptions.indexOf(re)<0||e.parsed.argv[e.getOptions().showHiddenOpt]}l(k,"filterHiddenOptions"),n.showHelp=re=>{let oe=e.getInternalMethods().getLoggerInstance();re||(re="error"),(typeof re=="function"?re:oe[re])(n.help())},n.functionDescription=re=>["(",re.name?t.Parser.decamelize(re.name,"-"):r("generated-value"),")"].join(""),n.stringifiedValues=l(function(oe,j){let z="",de=j||", ",Ve=[].concat(oe);return!oe||!Ve.length||Ve.forEach(je=>{z.length&&(z+=de),z+=JSON.stringify(je)}),z},"stringifiedValues");function V(re,oe){let j=`[${r("default:")} `;if(re===void 0&&!oe)return null;if(oe)j+=oe;else switch(typeof re){case"string":j+=`"${re}"`;break;case"object":j+=JSON.stringify(re);break;default:j+=re}return`${j}]`}l(V,"defaultString");function le(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}l(le,"windowWidth");let we=null;n.version=re=>{we=re},n.showVersion=re=>{let oe=e.getInternalMethods().getLoggerInstance();re||(re="error"),(typeof re=="function"?re:oe[re])(we)},n.reset=l(function(oe){return o=null,u=!1,f=[],d=!1,g=[],p=[],h=[],m=P1(m,j=>!oe[j]),n},"reset");let xe=[];return n.freeze=l(function(){xe.push({failMessage:o,failureOutput:u,usages:f,usageDisabled:d,epilogs:g,examples:p,commands:h,descriptions:m})},"freeze"),n.unfreeze=l(function(oe=!1){let j=xe.pop();j&&(oe?(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(EV,"usage");function mR(e){return typeof e=="object"}l(mR,"isIndentedText");function z2e(e,t){return mR(e)?{text:e.text,indentation:e.indentation+t}:{text:e,indentation:t}}l(z2e,"addIndentation");function CV(e){return mR(e)?e.indentation:0}l(CV,"getIndentation");function Hx(e){return mR(e)?e.text:e}l(Hx,"getText");var TV=`###-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-###
`,SV=`#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 gR=class{static{l(this,"Completion")}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(jx(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=R1(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(bc(this.customCompletionFunction,null,this.shim),K2e(this.customCompletionFunction)){let o=this.customCompletionFunction(n,r);return i0(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 Y2e(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.custom
${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(S=>{!AV.includes(S)&&!Object.prototype.hasOwnProperty.call(m,S)&&!Object.prototype.hasOwnProperty.call(e.getInternalMethods().getParseContext(),S)&&!o.isValidAndSomeAliasIsNotNew(S,h)&&x.push(S)}),y&&(b.commands.length>0||_.length>0||g)&&p._.slice(b.commands.length).forEach(S=>{_.includes(""+S)||x.push(""+S)}),y){let R=((v=e.getDemandedCommands()._)===null||v===void 0?void 0:v.max)||0,k=b.commands.length+R;k<p._.length&&p._.slice(k).forEach(V=>{V=String(V),!b.commands.includes(V)&&!x.includes(V)&&x.push(V)})}x.length&&t.fail(s("Unknown argument: %s","Unknown arguments: %s",x.length,x.map(S=>S.trim()?S:`"${S}"`).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=>{AV.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){Ji("<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)):(bc(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){Ji("<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=IV(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=P1(a,h=>!p[h]),u=P1(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();bc(p,void 0,r),{implied:a,conflicting:u}=p},"unfreeze"),o}l(RV,"validation");var yR=[],Ey;function Ty(e,t,r,n){Ey=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=Q2e(t,e.extends);else try{a=require.resolve(e.extends)}catch{return e}X2e(a),yR.push(a),s=o?JSON.parse(Ey.readFileSync(a,"utf8")):require(e.extends),delete e.extends,s=Ty(s,Ey.path.dirname(a),r,Ey)}return yR=[],r?PV(s,e):Object.assign({},s,e)}l(Ty,"applyExtends");function X2e(e){if(yR.indexOf(e)>-1)throw new n0(`Circular extended configurations: '${e}'.`)}l(X2e,"checkForCircularExtends");function Q2e(e,t){return Ey.path.resolve(e,t)}l(Q2e,"getPathToDefaultConfig");function PV(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]=PV(e[s],t[s]):r[s]=t[s];return r}l(PV,"mergeDeep");var Zi=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)},H0,_m,Sy,qu,mu,$x,k1,bm,Vx,Uu,Gx,ju,bd,gu,Hu,zx,$5,hl,ms,Wx,Kx,yu,Cm,V5,Em,N1,Yx,Ss,Tm,Sm,wm,As,Xx,Cd,P0;function XV(e){return(t=[],r=e.process.cwd(),n)=>{let s=new AR(t,r,n,e);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}l(XV,"YargsFactory");var OV=Symbol("copyDoubleDash"),kV=Symbol("copyDoubleDash"),vR=Symbol("deleteFromParserHintObject"),NV=Symbol("emitWarning"),DV=Symbol("freeze"),LV=Symbol("getDollarZero"),Im=Symbol("getParserConfiguration"),MV=Symbol("getUsageConfiguration"),xR=Symbol("guessLocale"),FV=Symbol("guessVersion"),BV=Symbol("parsePositionalNumbers"),_R=Symbol("pkgUp"),D1=Symbol("populateParserHintArray"),G5=Symbol("populateParserHintSingleValueDictionary"),bR=Symbol("populateParserHintArrayDictionary"),CR=Symbol("populateParserHintDictionary"),ER=Symbol("sanitizeKey"),TR=Symbol("setKey"),SR=Symbol("unfreeze"),qV=Symbol("validateAsync"),UV=Symbol("getCommandInstance"),jV=Symbol("getContext"),HV=Symbol("getHasOutput"),$V=Symbol("getLoggerInstance"),VV=Symbol("getParseContext"),GV=Symbol("getUsageInstance"),zV=Symbol("getValidationInstance"),Qx=Symbol("hasParseCallback"),WV=Symbol("isGlobalContext"),Am=Symbol("postProcess"),KV=Symbol("rebase"),wR=Symbol("reset"),wy=Symbol("runYargsP
`),void 0,"versionWarning"),ue(this,ms,"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,ms,"f").defaultDescription[t]=r.defaultDescription),r.skipValidation&&this.skipValidation(t);let o=r.describe||r.description||r.desc,a=ue(this,As,"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){Ji("[string|array] [function|boolean|object] [function]",[t,r,n],arguments.length),this[DV](),typeof t>"u"&&(t=ue(this,N1,"f")),typeof r=="object"&&(Zi(this,Cm,r,"f"),r=n),typeof r=="function"&&(Zi(this,yu,r,"f"),r=!1),r||Zi(this,N1,t,"f"),ue(this,yu,"f")&&Zi(this,Uu,!1,"f");let s=this[wy](t,!!r),o=this.parsed;return ue(this,qu,"f").setParsed(this.parsed),i0(s)?s.then(a=>(ue(this,yu,"f")&&ue(this,yu,"f").call(this,ue(this,k1,"f"),a,ue(this,hl,"f")),a)).catch(a=>{throw ue(this,yu,"f")&&ue(this,yu,"f")(a,this.parsed.argv,ue(this,hl,"f")),a}).finally(()=>{this[SR](),this.parsed=o}):(ue(this,yu,"f")&&ue(this,yu,"f").call(this,ue(this,k1,"f"),s,ue(this,hl,"f")),this[SR](),this.parsed=o,s)}parseAsync(t,r,n){let s=this.parse(t,r,n);return i0(s)?s:Promise.resolve(s)}parseSync(t,r,n){let s=this.parse(t,r,n);if(i0(s))throw new n0(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return s}parserConfiguration(t){return Ji("<object>",[t],arguments.length),Zi(this,Kx,t,"f"),this}pkgConf(t,r){Ji("<string> [string]",[t,r],arguments.length);let n=null,s=this[_R](r||ue(this,_m,"f"));return s[t]&&typeof s[t]=="object"&&(n=Ty(s[t],r||ue(this,_m,"f"),this[Im]()["deep-merge-config"]||!1,ue(this,Ss,"f")),ue(this,ms,"f").configObjects=(ue(this,ms,"f").configObjects||[]).concat(n)),this}positional(t,r){Ji("<string> <object>",[t,r],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];r=P1(r,(a,c)=>a==="type"&&!["string","number","boolean"].includes(c)?!1:n.includes(a));let s=ue(this,Sy,"f").fullCommands[ue(this,Sy,"f").fullCommands.length-1],o=s?ue(this,H0,"f").cmdToParseOptions(s):{array:[],alias:{},default:{},demand:{}};return j5(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,As,"f").getPositionalGroupName()),this.option(t,r)}recommendCommands(t=!0){return Ji("[boolean]",[t],arguments.length),Zi(this,Yx,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 Ji("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&ue(this,ms,"f").narg[t]?this:(this[G5](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,r){return Ji("[string] [string]",[t,r],arguments.length),t=t||this.$0,ue(this,$5,"f").log(ue(this,qu,"f").generateCompletionScript(t,r||ue(this,mu,"f")||"completion")),this}showHelp(t){if(Ji("[string|function]",[t],arguments.length),Zi(this,gu,!0,"f"),!ue(this,As,"f").hasCachedHelpMessage()){if(!this.parsed){let
`,"f"),Zi(this,hl,ue(this,hl,"f")+t.join(" "),"f")},error:(...t)=>{this[Qx]()||console.error(...t),Zi(this,gu,!0,"f"),ue(this,hl,"f").length&&Zi(this,hl,ue(this,hl,"f")+`
`,"f"),Zi(this,hl,ue(this,hl,"f")+t.join(" "),"f")}}}[vR](t){j5(ue(this,ms,"f")).forEach(r=>{if((s=>s==="configObjects")(r))return;let n=ue(this,ms,"f")[r];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete ue(this,As,"f").getDescriptions()[t]}[NV](t,r,n){ue(this,Vx,"f")[n]||(ue(this,Ss,"f").process.emitWarning(t,r),ue(this,Vx,"f")[n]=!0)}[DV](){ue(this,Gx,"f").push({options:ue(this,ms,"f"),configObjects:ue(this,ms,"f").configObjects.slice(0),exitProcess:ue(this,Uu,"f"),groups:ue(this,bd,"f"),strict:ue(this,Tm,"f"),strictCommands:ue(this,Sm,"f"),strictOptions:ue(this,wm,"f"),completionCommand:ue(this,mu,"f"),output:ue(this,hl,"f"),exitError:ue(this,k1,"f"),hasOutput:ue(this,gu,"f"),parsed:this.parsed,parseFn:ue(this,yu,"f"),parseContext:ue(this,Cm,"f")}),ue(this,As,"f").freeze(),ue(this,P0,"f").freeze(),ue(this,H0,"f").freeze(),ue(this,ju,"f").freeze()}[LV](){let t="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(ue(this,Ss,"f").process.argv()[0])?r=ue(this,Ss,"f").process.argv().slice(1,2):r=ue(this,Ss,"f").process.argv().slice(0,1),t=r.map(n=>{let s=this[KV](ue(this,_m,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length<n.length?s:n}).join(" ").trim(),ue(this,Ss,"f").getEnv("_")&&ue(this,Ss,"f").getProcessArgvBin()===ue(this,Ss,"f").getEnv("_")&&(t=ue(this,Ss,"f").getEnv("_").replace(`${ue(this,Ss,"f").path.dirname(ue(this,Ss,"f").process.execPath())}/`,"")),t}[Im](){return ue(this,Kx,"f")}[MV](){return ue(this,Xx,"f")}[xR](){if(!ue(this,bm,"f"))return;let t=ue(this,Ss,"f").getEnv("LC_ALL")||ue(this,Ss,"f").getEnv("LC_MESSAGES")||ue(this,Ss,"f").getEnv("LANG")||ue(this,Ss,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[FV](){return this[_R]().version||"unknown"}[BV](t){let r=t["--"]?t["--"]:t._;for(let n=0,s;(s=r[n])!==void 0;n++)ue(this,Ss,"f").Parser.looksLikeNumber(s)&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))&&(r[n]=Number(s));return t}[_R](t){let r=t||"*";if(ue(this,V5,"f")[r])return ue(this,V5,"f")[r];let n={};try{let s=t||ue(this,Ss,"f").mainFilename;!t&&ue(this,Ss,"f").path.extname(s)&&(s=ue(this,Ss,"f").path.dirname(s));let o=ue(this,Ss,"f").findUp(s,(a,c)=>{if(c.includes("package.json"))return"package.json"});bc(o,void 0,ue(this,Ss,"f")),n=JSON.parse(ue(this,Ss,"f").readFileSync(o,"utf8"))}catch{}return ue(this,V5,"f")[r]=n||{},ue(this,V5,"f")[r]}[D1](t,r){r=[].concat(r),r.forEach(n=>{n=this[ER](n),ue(this,ms,"f")[t].push(n)})}[G5](t,r,n,s){this[CR](t,r,n,s,(o,a,c)=>{ue(this,ms,"f")[o][a]=c})}[bR](t,r,n,s){this[CR](t,r,n,s,(o,a,c)=>{ue(this,ms,"f")[o][a]=(ue(this,ms,"f")[o][a]||[]).concat(c)})}[CR](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 j5(n))t(a,n[a]);else o(r,this[ER](n),s)}[ER](t){return t==="__proto__"?"___proto___":t}[TR](t,r){return this[G5](this[TR].bind(this),"key",t,r),this}[SR](){var t,r,n,s,o,a,c,u,f,d,p,h;let m=ue(this,Gx,"f").pop();bc(m,void 0,ue(this,Ss,"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){Zi(t,ms,y,"f")}}.value,configObjects:g,exitProcess:{set value(y){Zi(r,Uu,y,"f")}}.value,groups:{set value(y){Zi(n,bd,y,"f")}}.value,output:{set value(y){Zi(s,hl,y,"f")}}.value,exitError:{set value(y){Zi(o,k1,y,"f")}}.value,hasOutput:{set value(y){Zi(a,gu,y,"f")}}.value,parsed:this.parsed,strict:{set value(y){Zi(c,Tm,y,"f")}}.value,strictCommands:{set value(y){Zi(u,Sm,y,"f")}}.value,strictOptions:{set value(y){Zi(f,wm,y,"f")}}.value,completionCommand:{set value(y){Zi(d,mu,y,"f")}}.value,parseFn:{set value(y){Zi(p,yu,y,"f")}}.value,parseContext:{set value(y){Zi(h,Cm,y,"f")}}.value}=m,ue(this,ms,"f").configObjects=g,ue(this,As,"f").unfreeze(),ue(this,P0,"f").unfreeze(),ue(this,H0,"f").unfreeze(),ue(this,ju,"f").unfreeze()}[qV](t,r){return xm(r,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[UV].bind(this),getContext:this[jV].bind(this),getHasOutput:this[HV].bind(this),getLoggerInstance:this[$V].bind(this),getParseContext:this[VV].bind(this),getParserConfiguration:this[
`)){t.stacktrace=[];for(let n of r.slice(e.toString().length+1).split(/\n/).reverse()){let s=n.match(p6e),o={filename:"",function:""};s&&(o.function=s[2]?.trim()?.replace(/^[^.]{1,2}(\.|$)/,"_$1")??o.function,o.filename=s[4]?.trim()??o.filename,s[5]&&s[5]!==":0"&&(o.lineno=s[5].slice(1)),s[6]&&s[5]!==":0"&&(o.colno=s[6].slice(1)),o.in_app=!/[[<:]|(?:^|\/)node_modules\//.test(o.filename)),t.stacktrace.push(o)}}return t}l(h6e,"buildExceptionDetail");function bP(e,t){let r=e.get(Gs),n=r.getEditorInfo(),s=e.get(nc),o={"#editor":n.devName??n.name,"#editor_version":Ed({name:n.devName??n.name,version:n.version}),"#plugin":r.getEditorPluginInfo().name,"#plugin_version":Ed(r.getEditorPluginInfo()),"#session_id":e.get(C0).sessionId,"#machine_id":e.get(C0).machineId,"#architecture":E9.arch(),"#os_platform":E9.platform(),...t};return s.trackingId&&(o.user=s.trackingId,o["#tracking_id"]=s.trackingId),o}l(bP,"buildContext");function YW(e,t){let r=e.get(kl),n=e.get(Gs).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:bP(e,{"#node_version":process.versions.node}),sensitive_context:{}},o=[];s.exception_detail=[];let a=0,c=t;for(;c instanceof Error&&a<10;){let f=h6e(c);s.exception_detail.unshift(f),o.unshift([c,f]),a+=1,c=c.cause}let u=[];for(let[f,d]of o)if(d.stacktrace&&d.stacktrace.length>0){u.push(`${d.type}: ${f.code??""}`);let p=[...d.stacktrace].reverse();for(let h of p)if(h.in_app){u.push(`${h.filename}:${h.lineno}:${h.colno}`);break}u.push(`${p[0].filename}`)}else return s;return s.exception_detail.length>0&&(s.rollup_id=(0,C9.SHA256)(C9.enc.Utf16.parse(u.join(`
`))).toString()),s}l(YW,"buildPayload");var Td=class e{constructor(t){this.flags=t}static{l(this,"RuntimeMode")}static fromEnvironment(t){return new e({debug:m6e(process.argv,process.env),verboseLogging:g6e(process.env),telemetryLogging:y6e(process.env),testMode:t,recordInput:v6e(process.argv,process.env)})}};function $c(e){return e.get(Td).flags.testMode}l($c,"isRunningInTest");function o3(e){return $c(e)}l(o3,"shouldFailForDebugPurposes");function T9(e){return e.get(Td).flags.debug}l(T9,"isDebugEnabled");function QW(e){return e.get(Td).flags.verboseLogging}l(QW,"isVerboseLoggingEnabled");function m6e(e,t){return e.includes("--debug")||S9(t,"GITHUB_COPILOT_DEBUG")}l(m6e,"determineDebugFlag");function g6e(e){return S9(e,"COPILOT_AGENT_VERBOSE")}l(g6e,"determineVerboseLoggingEnabled");function y6e(e){return S9(e,"COPILOT_LOG_TELEMETRY")}l(y6e,"determineTelemetryLoggingEnabled");function v6e(e,t){return e.includes("--record")||S9(t,"GITHUB_COPILOT_RECORD")}l(v6e,"determineRecordInput");function S9(e,t){if(t in e){let r=e[t];return r==="1"||r?.toLowerCase()==="true"}return!1}l(S9,"determineEnvFlagEnabled");var Wae=hr(zae()),VE=hr(require("os")),$M=require("stream");var ILe=/^https:\/\/[^.]*\.in\.applicationinsights\.azure\.com\//,VM=yl(),ALe=VM.makeRequest.bind(VM),O2=class{constructor(t,r,n){this.namespace=r;this.client=PLe(t,n),Kae(t,this.client),t.get(ll).on("onCopilotToken",s=>{let o=s.getTokenValue("tid");o!==void 0&&OLe(o,this.client)})}static{l(this,"AzureInsightReporter")}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}`}};function RLe(e){VM.makeRequest=function(t,r,n,s,...o){if(!e.get(Fs).proxySettings)return ALe(t,r,n,s,...o);r&&r.indexOf("//")===0&&(r="https:"+r);let a=new $M.EventEmitter;a.setEncoding=()=>a;let c=new $M.EventEmitter,u;return c.write=(f,d,p)=>{u=f},c.end=()=>{if(r.includes("169.254.169.254"))return c.emit("error",new Error("UNREACH")),c;if(ILe.test(r))return c.emit("error",new Error("UNKNOWN")),c;let f=n.method,d=n.headers;return e.get(Fs).fetch(r,{method:f,headers:d,body:u}).then(p=>{p.text().then(h=>{a.emit("data",h),a.emit("end")})}).catch(p=>{c.emit("error",p)}),c},c.setTimeout=()=>c,c.abort=()=>{},s(a),c}}l(RLe,"monkeyPatchMakeRequest");function PLe(e,t){RLe(e);let r=new Wae.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,Kae(e,r),r}l(PLe,"createAppInsightsClient");function Kae(e,t){t.commonProperties=kLe(t.commonProperties,e);let r=e.get(C0);t.context.tags[t.context.keys.sessionId]=r.sessionId;let n=e.get(nc);n.trackingId&&(t.context.tags[t.context.keys.userId]=n.trackingId),t.context.tags[t.context.keys.cloudRoleInstance]="REDACTED",t.config.endpointUrl=e.get(_h).getUrl()}l(Kae,"configureReporter");function OLe(e,t){t.context.tags[t.context.keys.userId]=e}l(OLe,"updateReporterUserId");function kLe(e,t){e=e||{},e.common_os=VE.platform(),e.common_platformversion=VE.release();let r=t.get(C0);return e.common_vscodemachineid=r.machineId,e.common_vscodesessionid=r.sessionId,e.common_uikind="desktop",e.common_remotename="none",e.common_isnewappinstall="",e}l(kLe,"decorateWithCommonProperties");var Yae="7d7048df-6dd0-4048-bb23-b716c1461f8f",Xae="3fdd7f28-937a-48c8-9a21-ba337db23bd1",NLe="f0000000-0000-0000-0000-000000000000";async function k2(e,t,r){let n=e.get(M0).deactivate();if(r){let s=e.get(M0),o=new O2(e,t,Yae);s.setReporter(o);let a=new O2(e,t,Xae);s.setRestrictedReporter(a);let c=new O2(e,t,NLe);s.setFTReporter(c)}await n}l(k2,"setupTelemetryReporters");var L8=hr(require("path")),DLe=
`)){a=o.slice(c.length+1).split(/\n/);break}if(a){s.stack=s.toString();for(let c of a)if(Zae.test(c))s.stack+=`
${F8(c.replace(Zae,(u,f)=>f.replace(Jae,"/")))}`;else if(/[ (]node:|[ (]wasm:\/\/wasm\/| \(<anonymous>\)$/.test(c))s.stack+=`
${F8(c)}`;else{let u=!1;for(let{prefix:f,path:d}of n){let p=new RegExp(GE(d.replace(/[\\/]$/,""))+r0e,"gi");if(p.test(c)){s.stack+=`
${F8(c.replace(p,(h,m)=>f+m.replace(Jae,"/")))}`,u=!0;break}}if(u)continue;r?s.stack+=`
${GM(c)}`:s.stack+=`
at [redacted]:0:0`}}else r&&o&&(s.stack=GM(o));return e.cause instanceof Error&&(s.cause=WM(e.cause,t,r,n)),s}l(WM,"cloneError");function n0e(e){let t=e.message;return typeof e.path=="string"&&e.path.length>0&&(t=t.replaceAll(e.path,"<path>")),t}l(n0e,"errorMessageWithoutPath");function i0e(e,t){return WM(e,l(function(n){return GM(n0e(n))},"prepareMessage"),!0,t)}l(i0e,"prepareErrorForRestrictedTelemetry");function KM(e,t,r=!1){return WM(e,l(function(s){if(r)return zM(n0e(s));let o="[redacted]";return s.syscall&&s.code!==void 0?o=`${F8(s.syscall.toString())} ${s.code} ${o}`:s instanceof Yy&&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(KM,"redactError");function D2(e){return e===1}l(D2,"isRestricted");var BLe=["engine.prompt","engine.completion","ghostText.capturedAfterAccepted","ghostText.capturedAfterRejected"];var M0=class{static{l(this,"TelemetryReporters")}getReporter(t,r=0){return D2(r)?this.getRestrictedReporter(t):this.reporter}getRestrictedReporter(t){if(zE(t))return this.reporterRestricted;if(o3(t))return new M8}getFTReporter(t){if(a0e(t))return this.reporterFT;if(o3(t))return new M8}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])}};o0e.TypeSystem.AllowNaN=!0;var qLe=Zp.Type.Object({},{additionalProperties:Zp.Type.String()}),ULe=Zp.Type.Object({meanLogProb:Zp.Type.Optional(Zp.Type.Number()),meanAlternativeLogProb:Zp.Type.Optional(Zp.Type.Number())},{additionalProperties:Zp.Type.Number()}),jLe=new Set(["ERR_WORKER_OUT_OF_MEMORY","ENOMEM"]);function HLe(e){return jLe.has(e.code??"")||e.name==="RangeError"&&e.message==="WebAssembly.Memory(): could not allocate memory"}l(HLe,"isOomError");function $Le(e){return KW(e)?"network":HLe(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($Le,"getErrorType");var as=class e{static{l(this,"TelemetryData")}static{this.validateTelemetryProperties=YM.TypeCompiler.Compile(qLe)}static{this.validateTelemetryMeasurements=YM.TypeCompiler.Compile(ULe)}static{this.keysExemptedFromSanitization=["abexp.assignmentcontext","VSCode.ABExp.Features"]}constructor(t,r,n){this.properties=t,this.measurements=r,this.issuedTime=n}static createAndMarkAsIssued(t,r){return new e(t||{},r||{},pf())}extendedBy(t,r){let n={...this.properties,...t},s={...this.measurements,...r},o=new e(n,s,this.issuedTime);return o.displayedTime=this.displayedTime,o}markAsDisplayed(){this.displayedTime===void 0&&(this.displayedTime=pf())}async extendWithExpTelemetry(t){let{filters:r,exp:n}=await t.get(bs).getFallbackExpAndFilters();n.addToTelemetry(this),r.addToTelemetry(this)}extendWithEditorAgnosticFields(t){this.properties.editor_version=Ed(t.get(Gs).getEditorInfo()),this.properties.editor_plugin_version=Ed(t.get(Gs).getEditorPluginInfo());let r=t.get(C0);this.properties.client_machineid=r.machineId,this.properties.client_sessionid=r.sessionId,this.properties.copilot_version=`copilot/${M2(t)}`,this.properties.runtime_version=`node/${process.versions.node}`;let n=t.get(Gs);this.properties.common_extname=n.getEditorPluginInfo().name,this.properties.common_extversion=n.getEditorPluginInfo().version,this.properties.common_vscodeversion=Ed(n.getEditorInfo());let s=t.get(Fs),o=s.proxySettings;this.properties.proxy_enabled=o?"true":"false",this.properties.proxy_auth=o?.proxyAuth?"true":"false",this.properties.proxy_kerberos_spn=o?.kerberosServicePrincipal?"true":"false",this.properties.reject_unauthorized=s.rejectUnauthorized?"true":"false"}extendWithConfigProperties
`)){let a=o.stack.slice(`${o}
`.length).split(`
`);/^\s*(?:at )?(?:\w+\.)*telemetryException\b/.test(a[0])&&a.shift(),o.stack=`${o}
${a.join(`
`)}`}await e.get(xl).register(XLe(e,o,r,n,s))}l(G0,"telemetryException");async function XLe(e,t,r,n,s){let o=e.get(Gs).getEditorInfo(),a;o.root&&(a=[{prefix:`${o.name}:`,path:o.root}]);let c=KM(t,a),u=zE(e),f=$Le(t),d=f==="exception",p=as.createAndMarkAsIssued({origin:r,type:t.name,code:`${t.code??""}`,reason:c.stack||c.toString(),message:c.message,...n});if(await p.makeReadyForSending(e,0,"IncludeExp"),s?.exception_detail)for(let h of s.exception_detail)h.value&&(u?h.value=zM(h.value):h.value="[redacted]");if(s??=YW(e,KM(t,a,u)),s.context={...s.context,"#origin":r,"copilot_event.unique_id":p.properties.unique_id,"#restricted_telemetry":u?"true":"false"},s.rollup_id!=="auto"&&(p.properties.errno=s.rollup_id),s.created_at=new Date(p.issuedTime).toISOString(),u){let h=i0e(t,a),m=as.createAndMarkAsIssued({origin:r,type:t.name,code:`${t.code??""}`,reason:h.stack||h.toString(),message:h.message,...n});s.rollup_id!=="auto"&&(m.properties.errno=s.rollup_id),await m.makeReadyForSending(e,1,"IncludeExp"),m.properties.unique_id=p.properties.unique_id,p.properties.restricted_unique_id=m.properties.unique_id,d&&s0e(e,1,h,m),B8(e,1,`error.${f}`,m)}d&&(s0e(e,0,c,p),p.properties.failbot_payload=JSON.stringify(s)),B8(e,0,`error.${f}`,p)}l(XLe,"_telemetryException");async function Zc(e,t,r,n){await e.get(xl).register(QLe(e,t,r,n))}l(Zc,"telemetryError");async function QLe(e,t,r,n=0){if(D2(n)&&!zE(e))return;let s=r||as.createAndMarkAsIssued({},{});await s.makeReadyForSending(e,n,"IncludeExp"),VLe(e,n,t,s)}l(QLe,"_telemetryError");async function c0e(e,t,r,n,s){let o=as.createAndMarkAsIssued({completionTextJson:JSON.stringify(t),choiceIndex:s.toString()});if(r.logprobs)for(let[a,c]of Object.entries(r.logprobs))o.properties["logprobs_"+a]=JSON.stringify(c)??"unset";o.extendWithRequestId(n),await pn(e,"engine.completion",o,1)}l(c0e,"logEngineCompletion");async function u0e(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 pn(e,"engine.prompt",s,1)}l(u0e,"logEnginePrompt");var Vg=class{static{l(this,"ExpConfigMaker")}},ZLe="https://default.exp-tas.com",WE=class extends Vg{constructor(r="/vscode/ab"){super();this.expPath=r}static{l(this,"ExpConfigFromTAS")}async fetchExperiments(r,n){let s=r.get(Fs),o;try{o=await s.fetch(ZLe+this.expPath,{method:"GET",headers:n})}catch(f){return Lf.createFallbackConfig(r,`Error fetching ExP config: ${f}`)}if(!o.ok)return Lf.createFallbackConfig(r,`ExP responded with ${o.status}`);let a;try{a=await o.json()}catch(f){if(f instanceof SyntaxError)return G0(r,f,"fetchExperiments"),Lf.createFallbackConfig(r,"ExP responded with invalid JSON");throw f}let c=a.Configs.find(f=>f.Id==="vscode")??{Id:"vscode",Parameters:{}},u=Object.entries(c.Parameters).map(([f,d])=>f+(d?"":"cf"));return new Lf(c.Parameters,a.AssignmentContext,u.join(";"))}};var KE=class{constructor(t){this.prefix=t}static{l(this,"GranularityImplementation")}getCurrentAndUpComingValues(t){let r=this.getValue(t),n=this.getUpcomingValues(t);return[r,n]}},QM=class extends KE{static{l(this,"ConstantGranularity")}getValue(t){return this.prefix}getUpcomingValues(t){return[]}},p0e=l(e=>new QM(e),"DEFAULT_GRANULARITY"),YE=class extends KE{constructor(r,n=.5,s=new Date().setUTCHours(0,0,0,0)){super(r);this.prefix=r;this.fetchBeforeFactor=n;this.anchor=s}static{l(this,"TimeBucketGranularity")}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.getUpcomingTimePeriodBucketStrings(r),o=this.getUpcomingByCallBucketStrings();for(let a of s)for(let c of o)n.push(this.prefix+a+c);r
`);t&&this.constructionStack.push(...t.slice(1))}static{l(this,"Context")}get(t){let r=this.tryGet(t);if(r)return r;throw new Error(`No instance of ${t.name} has been registered.`)}tryGet(t){let r=this.instances.get(t);if(r)return r}set(t,r){if(this.tryGet(t))throw new Error(`An instance of ${t.name} has already been registered. Use forceSet() if you're sure it's a good idea.`);this.assertIsInstance(t,r),this.instances.set(t,r)}forceSet(t,r){this.assertIsInstance(t,r),this.instances.set(t,r)}assertIsInstance(t,r){if(!(r instanceof t)){let n=JSON.stringify(r);throw new Error(`The instance you're trying to register for ${t.name} is not an instance of it (${n}).`)}}toString(){let t=` Context created at:
`;for(let r of this.constructionStack||[])t+=` ${r}
`;return t}};var Jf=class{static{l(this,"CompletionsCache")}constructor(){this._cache=new ka(100)}get(t){return this._cache.get(t)}set(t,r){this._cache.set(t,r)}clear(){this._cache.clear()}};function G0e(e){let t;e[0]>1e-35?e[29]>1e-35?e[138]>1e-35?t=.49496579646815353:t=.47546580490346646:e[30]>1e-35?t=.4456371992737078:e[4]>3.238486181444842?e[135]>1e-35?t=.2645576817782658:e[46]>1e-35?t=.20251922126765812:t=.37359143313367105:e[7]>.9662372103242399?t=.44975631109230374:t=.4067133376207218:e[7]>.960816451500545?e[29]>1e-35?e[4]>1.7005986908310777?t=.4240336839258693:t=.35414085998710754:e[4]>3.238486181444842?t=.353882328354817:e[100]>1e-35?t=.48783079865293355:e[30]>1e-35?t=.419904106522537:t=.38599249795612806:e[4]>3.6242520361853052?e[29]>1e-35?e[7]>.5086748127709895?t=.37522628419389664:t=.3359393805000766:e[30]>1e-35?t=.3685210833144829:e[135]>1e-35?t=.22140958666091123:e[134]>1e-35?t=.38379851487275685:e[46]>1e-35?t=.1926283522107934:t=.3098162447812857:e[46]>1e-35?t=.22698331991181095:e[4]>1.4978661367769956?e[30]>1e-35?e[4]>2.138333059508028?t=.39709448374768985:t=.34711865383837703:e[134]>1e-35?t=.40608455346469957:e[135]>1e-35?t=.3084120164848763:e[48]>1e-35?t=.24193590696691425:e[51]>1e-35?t=.2087938690163009:e[4]>3.1984648276080736?t=.3529508564858481:t=.3698795818909763:t=.30210240039979064;let r;e[0]>1e-35?e[2]>2.4414009612931857?e[2]>3.676220550121792?e[7]>.9246495578512688?r=.0570428673081833:r=.019779482100154476:e[7]>.9705672697050661?r=.1023948532887641:r=.06265430080550045:e[29]>1e-35?e[5]>4.658699722134796?e[2]>1.2424533248940002?r=.12784241430585772:r=.15126156743993927:e[8]>1e-35?e[2]>.8958797346140276?r=.10624230855386699:r=-.1699142543394302:r=.10290106276456985:e[5]>3.5694334999727624?r=.09368877801612557:r=.1552615744687782:e[2]>3.3842466058243152?e[4]>3.5694334999727624?e[29]>1e-35?e[7]>.7022798213723723?r=.02282408308012389:r=-.032610792718175546:r=-.04405498437523181:e[46]>1e-35?r=-.14475563528583885:e[7]>.9159108669154322?r=.02539215399728953:e[134]>1e-35?r=.04720629593220485:e[4]>1.8688348091416842?r=-.00150052748656963:r=-.04528409340753242:e[5]>3.5694334999727624?e[4]>3.6505739029280164?e[29]>1e-35?r=.050909089229765704:e[39]>1e-35?r=-.08747827386821926:e[46]>1e-35?r=-.11300671054986217:r=-.002669293928522137:e[46]>1e-35?r=-.07873653229849684:e[39]>1e-35?r=-.06389470798465265:e[2]>.8958797346140276?e[47]>1e-35?r=-.07102696386827136:e[4]>1.8688348091416842?r=.04567768852273886:r=.016429189359442275:r=.024223384872688037:e[7]>.9569480028661056?r=.12458720561596202:r=-.006224718391409129;let n;e[29]>1e-35?e[2]>2.602003343538398?e[2]>4.166635176627655?e[7]>.8375851232899904?n=.027219239366992384:n=-.023288925509443156:e[7]>.5866799179067689?n=.05780689652787357:n=.019914206435185725:e[2]>1.2424533248940002?e[7]>.9246495578512688?n=.1091540005913688:n=.08430043254349175:e[6]>4.832297822126891?e[125]>1e-35?n=.029350728374412424:n=.1327178977041336:e[8]>1e-35?e[7]>.9793410316570949?n=-.10742256752042179:n=.10128035205992136:n=.08719230025231978:e[5]>3.772694874805912?e[39]>1e-35?n=-.07712063687837625:e[46]>1e-35?n=-.09987046122905541:e[2]>3.6242520361853052?e[134]>1e-35?n=.0549278412468898:e[155]>1e-35?n=.0628934857241284:e[47]>1e-35?n=-.14605662411148382:e[48]>1e-35?n=-.1460221669882455:n=.002073957868392086:e[2]>1e-35?e[47]>1e-35?n=-.0769198367034467:e[155]>1e-35?n=.0769122902449957:e[134]>1e-35?n=.06856131328753592:e[152]>1e-35?n=.07081107422282688:e[51]>1e-35?n=-.11095669360187602:e[91]>1e-35?n=-.08136006552659215:e[48]>1e-35?n=-.07180356044417698:e[18]>1e-35?n=-.029572927306223313:e[50]>1e-35?n=-.11419309779400831:n=.03331652781327257:n=.0015747823792064454:e[7]>.9662372103242399?n=.1203598683210537:n=.011240838199712565;let s;e[0]>1e-35?e[2]>2.4414009612931857?e[1]>1e-35?e[2]>4.03420147928485?s=.03823654007072966:e[7]>.9033253454895247?s=.09329944316059466:s=.06705865009439997:e[134]>1e-35?s=.06865805795066232:e[30]>1e-35?s=.05189058132179502:e[217]>1e-35?s=.044913757044379055:s=-.05078929160105722:e[1]>1e-35?e[6]>5.161920636569023?e[2]>1.4978661367769956?s=.10652732380394028:s=.133078
`);return t[t.length-1].length}l(z0e,"getLastLineLength");function W0e(e,t,r,n){let s=e.get(Gd),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+z0e(p));let S=p.slice(-1);jc[S]!==void 0&&(d=jc[S])}let h=0,m=0,g=p.trimEnd();if(g){h=Math.log(1+z0e(g));let S=g.slice(-1);jc[S]!==void 0&&(m=jc[S])}let y=0;if("documentLength"in t.measurements){let S=t.measurements.documentLength;y=Math.log(1+S)}let v=0;if("promptEndPos"in t.measurements){let S=t.measurements.promptEndPos;v=Math.log(1+S)}let _=0;if("promptEndPos"in t.measurements&&"documentLength"in t.measurements){let S=t.measurements.documentLength;_=(t.measurements.promptEndPos+.5)/(1+S)}let x=0;OR[t.properties.languageId]!==void 0&&(x=OR[t.properties.languageId]);let b=0;if(n){let S=new Array(221).fill(0);S[0]=o,S[1]=a,S[2]=u,S[3]=f,S[4]=h,S[5]=y,S[6]=v,S[7]=_,S[8+x]=1,S[29+d]=1,S[125+m]=1,b=G0e(S)[1]}else{let S=sz;S+=$u[0]*o,S+=$u[1]*a,S+=$u[2]*u,S+=$u[3]*f,S+=$u[4]*h,S+=$u[5]*y,S+=$u[6]*v,S+=$u[7]*_,S+=$u[8+x],S+=$u[29+d],S+=$u[125+m],b=1/(1+Math.exp(-S))}return e.get(Gd).probabilityAccept=b,b}l(W0e,"contextualFilterScore");var oB=hr(Ia()),cue=hr(Ay());var mT=class{static{l(this,"Debouncer")}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}})}};async function*gT(e,t){for await(let r of e)yield t(r)}l(gT,"asyncIterableMap");async function*K0e(e,t){for await(let r of e)await t(r)&&(yield r)}l(K0e,"asyncIterableFilter");async function*Kg(e,t){for await(let r of e){let n=await t(r);n!==void 0&&(yield n)}}l(Kg,"asyncIterableMapFilter");async function*Y0e(e){for(let t of e)yield t}l(Y0e,"asyncIterableFromArray");var Ba=class{static{l(this,"StatusReporter")}};var X0e="https://repositorypolicy.azurewebsites.net/GetPolicy/v2";var yT={isBlocked:!1,reason:"VALID_FILE"},Ch={isBlocked:!1,reason:"NO_MATCHING_POLICY"},V8={isBlocked:!0,reason:"POLICY_ERROR",message:"Copilot is disabled because we could not fetch the repository policy"};var q2=class{static{l(this,"PolicyEvaluator")}};var Pu=hr(Gi());var vT=new WeakMap;function xT(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]"&&vT.has(e))return vT.get(e);switch(vT.set(e,"~"+ ++t),o){case"[object Set]":r=Array.from(e);case"[object Array]":for(r||(r=e),n+="a";s<r.length;n+=xT(r[s++],t));break;case"[object Object]":for(n+="o",r=Object.keys(e).sort();s<r.length;n+=r[s]+xT(e[r[s++]],t));break;case"[object Map]":for(n+="o",r=Array.from(e.keys()).sort();s<r.length;n+=r[s]+xT(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 vT.set(e,n),n}l(xT,"t");function _T(e){return xT(e,0)}l(_T,"r");var dF=new WeakMap;function Q0e(e,t,r=_T(t)){let n,s,o=dF.get(e);o||(dF.set(e,o=[[],s=[],n=[]]),queueMicrotask(function(){let f,d=0;function p(h){for(;f=n[d++];f.r(h));}l(p,"o"),dF.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(Q0e,"n");var J0e=new WeakMap;function AMe(e,t,r,n=_T(r)){if(t||(t=J0e.get(e)),t||J0e.set(e,t=new Map),t.has(n))return Promise.resolve(t.get(n));let s=Q0e(e,r,n);return t.set(n,s),s.catch(()=>t.delete(n)),s}l(AMe,"n");function bT(e,t){return function(r,n){return AMe(e,t,r,n)}}l(bT,"o");var xle=hr(fle(),1);var z8=l(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var MMe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7
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 Ele(this.pattern,this.options)}parse(t){z8(t);let r=this.options;if(t==="**")return gf;if(t==="")return"";let n,s=null;(n=t.match(eFe))?s=r.dot?rFe:tFe:(n=t.match(VMe))?s=(r.nocase?r.dot?KMe:WMe:r.dot?zMe:GMe)(n[1]):(n=t.match(nFe))?s=(r.nocase?r.dot?sFe:iFe:r.dot?oFe:aFe)(n):(n=t.match(YMe))?s=r.dot?QMe:XMe:(n=t.match(JMe))&&(s=ZMe);let o=U2.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?uFe:r.dot?fFe:dFe,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"?yFe(d):d===gf?gf:d._src});return f.forEach((d,p)=>{let h=f[p+1],m=f[p-1];d!==gf||m===gf||(m===void 0?h!==void 0&&h!==gf?f[p+1]="(?:\\/|"+n+"\\/)?"+h:f[p]=n:h===void 0?f[p-1]=m+"(?:\\/|"+n+")?":h!==gf&&(f[p-1]=m+"(?:\\/|\\/"+n+"\\/)"+h,f[p+1]=gf))}),f.filter(d=>d!==gf).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 ql.defaults(t).Minimatch}};ql.AST=U2;ql.Minimatch=j2;ql.escape=gF;ql.unescape=Eh;var AF=hr(Kle());var o1=l((e,t)=>{if(AF.Value.Check(e,t))return t;let n=`Typebox schema validation failed:
${[...AF.Value.Errors(e,t)].map(s=>`${s.path} ${s.message}`).join(`
`)}`;throw new Error(n)},"assertShape");var fce=hr(require("node:path")),dce=hr(Q0());var NF=hr(Ia()),cce=hr(lce()),n6=require("path"),uce=hr(Q0());async function DF(e){let r=(await e.get(ua).getCopilotToken(e,!1)).organization_list??[];return["a5db0bcaae94032fe715fb34a5e4bce2","7184f66dfcee98cb5f08a1cb936d5225","4535c7beffc844b46bb1ed4aa04d759a"].find(s=>r.includes(s))??""}l(DF,"getUserKind");async function LF(e){return(await e.get(ua).getCopilotToken(e,!1)).getTokenValue("ft")??""}l(LF,"getFtFlag");async function MF(e){return(await e.get(ua).getCopilotToken(e,!1)).getTokenValue("rag")??""}l(MF,"getRagFlag");function FF(e){if(e===void 0||e===0)return"";let t=Ph(e);if(t==="github/github")return t;let r=KUe(e)?.toLowerCase();return r!==void 0?r:""}l(FF,"getDogFood");function Ph(e){if(e!==void 0&&e!==0&&e.hostname==="github.com")return e.owner+"/"+e.repo}l(Ph,"tryGetGitHubNWO");function KUe(e){if(e!==void 0&&e!==0&&(e.hostname.endsWith("azure.com")||e.hostname.endsWith("visualstudio.com")))return e.owner+"/"+e.repo}l(KUe,"tryGetADONWO");async function XT(e,t){let r=Xg(e,t.uri),n=Ph(r)??"",s=FF(r),o=await DF(e),a=await LF(e),c=await MF(e);return{repoNwo:n,userKind:o,dogFood:s,fileType:t.languageId,customModel:a,retrievalOrg:c}}l(XT,"getExPFilters");function Xg(e,t){let r=uce.Utils.dirname(t);return YUe(e,r)}l(Xg,"extractRepoInfoInBackground");var YUe=ZUe(BF,1e4);async function BF(e,t){if(t.scheme!=="file")return;let r=await QUe(e,t.fsPath);if(!r)return;let n=e.get(NF.FileSystem),s=(0,n6.join)(r,".git","config"),o;try{o=await n.readFileString(s)}catch{return}let a=JUe(o)??"",c=XUe(a);return c===void 0?{baseFolder:r,url:a,hostname:"",owner:"",repo:"",pathname:""}:{baseFolder:r,url:a,...c}}l(BF,"extractRepoInfo");function XUe(e){let t={};try{if(t=(0,cce.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(XUe,"parseRepoUrl");async function QUe(e,t){let r=t+"_add_to_make_longer",n=e.get(NF.FileSystem);for(;t.length>1&&t.length<r.length;){let s=(0,n6.join)(t,".git","config"),o=!1;try{await n.stat(s),o=!0}catch{o=!1}if(o)return t;r=t,t=(0,n6.dirname)(t)}}l(QUe,"getRepoBaseFolder");function JUe(e){let t=/^\s*\[\s*remote\s+"((\\\\|\\"|[^\\"])+)"/,r=/^\s*\[remote.([^"\s]+)/,n=/^\s*url\s*=\s*([^\s#;]+)/,s=/^\s*\[/,o,a,c=!1;for(let u of e.split(`
`))if(c&&o!==void 0){if(o+=u,u.endsWith("\\"))o=o.substring(0,o.length-1);else if(c=!1,a==="origin")return o}else{let f=u.match(t)??u.match(r);if(f)a=f[1];else if(u.match(s))a=void 0;else{if(o&&a!=="origin")continue;{let d=u.match(n);if(d){if(o=d[1],o.endsWith("\\"))o=o.substring(0,o.length-1),c=!0;else if(a==="origin")return o}}}}return o}l(JUe,"getRepoUrlFromConfigText");var kF=class{static{l(this,"CompletedComputation")}constructor(t){this.result=t}};function ZUe(e,t){let r=new ka(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 kF(f)),n.delete(a)}),0}}l(ZUe,"computeInBackgroundAndMemoize");async function QT(e,t,r){let n=dce.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 BF(e,r);if(!s?.url){t.set(r.fsPath,void 0);let o=fce.default.dirname(r.fsPath);t.set(o,void 0);return}return t.set(n.fsPath,s),t.set(r.fsPath,s),s}l(QT,"cachedGitRepoInfo");var qF="contentExclusion",JT=class extends q2{static{l(this,"CopilotContentRestrictions")}#e;#t=new ka(1e4);#i=new ka(1e4);#r=new ka(200);constructor(t){super(),this.#e=t}async evaluate(t){let r=t.fsPath;if(this.#t.has(r))return this.#t.get(r);try{let s=await this.#a(t);if(!s)return Ch;let o=t.fsPath.replace(s.baseFolder,"");var n=await this.evaluateFileFromRepo(o,s.url)}catch(s){return G0(this.#e,s,`${qF}.evaluate`),V8}return this.#t.set(r,n),n}async evaluateFileFromRepo(t,r){let n=await this.#n(r);if(!n)return Ch;for(let s of n)for(let o of s.paths)if(ql(t,o,{nocase:!0,matchBase:!0,nonegate:!0}))return tje(s);return yT}async refresh(){try{let t=[...this.#r.keys()];this.reset(),await Promise.all(t.map(r=>this.#s(r)))}catch(t){G0(this.#e,t,`${qF}.refresh`)}}reset(){this.#r.clear(),this.#t.clear()}async#n(t){let r=await this.#s(t.toLowerCase());if(r.length!==0)return r}#s=bT(async t=>{let r=await this.#e.get(ua).getGitHubSession(this.#e);if(!r)throw new Hc("No token found");let n=this.#e.get(F0).getContentRestrictionsUrl(r),s=new URL(n);s.searchParams.set("repos",t.join(","));let o=await this.#e.get(Fs).fetch(s.href,{method:"GET",headers:{Authorization:`token ${r.token}`}}),a=await o.json();if(!o.ok){if(o.status===404)return Array.from(t,()=>[]);throw this.#o("fetch.error",{message:a.message}),new jm(o)}return this.#o("fetch.success"),o1(oje,a).map(c=>c.rules)},this.#r);#a(t){return QT(this.#e,this.#i,t)}#o(t,r,n){pn(this.#e,`${qF}.${t}`,as.createAndMarkAsIssued(r,n))}};function tje(e){return{isBlocked:!0,reason:"FILE_BLOCKED",message:`Your ${e.source.type.toLowerCase()} '${e.source.name}' has disabled Copilot for this file`}}l(tje,"fileBlockedEvaluationResult");var rje=Pu.Type.Object({name:Pu.Type.String(),type:Pu.Type.Union([Pu.Type.Literal("Organization"),Pu.Type.Literal("Repository")])}),nje=Pu.Type.Object({paths:Pu.Type.Array(Pu.Type.String()),source:rje}),ije=Pu.Type.Array(nje),sje=Pu.Type.Object({rules:ije,last_updated_at:Pu.Type.String()}),oje=Pu.Type.Array(sje);var J0=hr(Gi());var ZT=class extends q2{constructor(r){super();this.ctx=r;this.repoUriToPolicyMap=new Map;this.ruleLoaderCache=new ka(200);this.urlToRepoInfoCache=new ka(1e4);this.requestStatus={status:"initial"};this.initialWaitMs=30*1e3;this.maxRetryCount=3;this.ruleLoader=bT(async r=>{let n=new URL(X0e),s=await this.ctx.get(ua).getGitHubToken(this.ctx);if(!s)throw new Hc("No GitHub token found");let o=this.ctx.get(C0),a=this.ctx.get(Gs),c=this.ctx.get(nc),u=this.ctx.get(Fs),f={trackingid:`${c.trackingId}`,githubtoken:`${s}`,machineid:`${o.machineId}`,sessionid:`${o.sessionId}`,extname:`${a.getEditorPluginInfo().name}`,extversion:`${a.getEditorPluginInfo().version}`},d=await u.fetch(n.href,{headers:f,method:"POST",json:{repos:r}});if(d.ok){let h=await d.json();return V2.info(this.ctx,"repositoryControl.fetch","success"),pn(this.ctx,"repositoryControl.fetch.success"),o1(fje,h).map(m=>m.rules)}V2.info(this.ctx,"repositoryControl.fetch","error"),pn(this.ctx,"repositoryControl.fetch.error");let p=new jm(d);throw G0(this.ctx,p,"repositoryContr
`);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(_ce,"cleanupIndentChoices");function bje(e,t){if(t?.logprobs?.token_logprobs)try{let r=0,n=0,s=50;for(let o=0;o<t.logprobs.token_logprobs.length-1&&s>0;o++,s--)r+=t.logprobs.token_logprobs[o],n+=1;return n>0?r/n:void 0}catch(r){Ha.exception(e,r,"Error calculating mean prob")}}l(bje,"calculateMeanLogProb");function Cje(e,t){if(t?.logprobs?.top_logprobs)try{let r=0,n=0,s=50;for(let o=0;o<t.logprobs.token_logprobs.length-1&&s>0;o++,s--){let a={...t.logprobs.top_logprobs[o]};delete a[t.logprobs.tokens[o]],r+=Math.max(...Object.values(a)),n+=1}return n>0?r/n:void 0}catch(r){Ha.exception(e,r,"Error calculating mean prob")}}l(Cje,"calculateMeanAlternativeLogProb");function W2(e,t){if($c(e))return 0;let r=parseFloat(ja(e,Ms.Temperature));return r>=0&&r<=1?r:t<=1?0:t<10?.2:t<20?.4:.8}l(W2,"getTemperatureForSamples");var nu=new Cs(1,"streamChoices"),WF=class{constructor(){this.logprobs=[];this.top_logprobs=[];this.text=[];this.tokens=[];this.text_offset=[];this.annotations=new KF}static{l(this,"APIJsonDataStreaming")}append(t){t.text&&this.text.push(t.text),t.delta?.content&&this.text.push(t.delta.content),t.logprobs&&(this.tokens.push(t.logprobs.tokens??[]),this.text_offset.push(t.logprobs.text_offset??[]),this.logprobs.push(t.logprobs.token_logprobs??[]),this.top_logprobs.push(t.logprobs.top_logprobs??[])),t.annotations&&this.annotations.update(t.annotations)}};function Eje(e){let t=e.split(`
`),r=t.pop();return[t.filter(n=>n!=""),r]}l(Eje,"splitChunk");var KF=class{constructor(){this.current={}}static{l(this,"StreamAnnotations")}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){return this.current[t]??[]}},K2=class e{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=Qg(this.response);this.stats=new YF(this.expectedNumChoices);this.solutions={}}static{l(this,"SSEProcessor")}static async create(t,r,n,s,o,a){let c=await n.body();c.setEncoding("utf8");let u=t.get(bs).fastCancellation(s);return new e(t,r,n,c,s,o??["content_filter"],u,a)}async*processSSE(t=async()=>{}){try{yield*this.processSSEInner(t)}finally{this.fastCancellation&&this.cancel(),nu.info(this.ctx,`request done: headerRequestId: [${this.requestId.headerRequestId}] model deployment ID: [${this.requestId.deploymentId}]`),nu.debug(this.ctx,`request stats: ${this.stats}`)}}async*processSSEInner(t){let r="";e:for await(let n of this.body){if(this.maybeCancel("after awaiting body chunk"))return;nu.debug(this.ctx,"chunk",n.toString());let[s,o]=Eje(r+n.toString());r=o;for(let a of s){let c=a.slice(5).trim();if(c=="[DONE]"){yield*this.finishSolutions();return}let u;try{u=JSON.parse(c)}catch{nu.error(this.ctx,"Error parsing JSON stream data",a);continue}if(u.choices===void 0){u.error!==void 0?nu.error(this.ctx,"Error in response:",u.error.message):nu.error(this.ctx,"Unexpected response with no choices or error: "+c);continue}if(this.requestId.created==0&&(this.requestId=Qg(this.response,u),this.requestId.created==0&&nu.error(this.ctx,`Request id invalid, should have "completionId" and "created": ${this.requestId}`,this.requestId)),this.allSolutionsDone()&&this.fastCancellation)break e;for(let f=0;f<u.choices.length;f++){let d=u.choices[f];nu.debug(this.ctx,"choice",d),this.stats.add(d.index),d.index in this.solutions||(this.solutions[d.index]=new WF);let p=this.solutions[d.index];if(p==null)continue;p.append(d);let h,m=d.text?.indexOf(`
`)>-1||d.delta?.content?.indexOf(`
`)>-1;if((d.finish_reason||m)&&(h=await t(p.text.join("")),this.maybeCancel("after awaiting finishedCb")))return;if(!(d.finish_reason||h!==void 0))continue;let y=d.finish_reason??"client-trimmed";if(pn(this.ctx,"completion.finishReason",this.telemetryData.extendedBy({completionChoiceFinishReason:y})),this.dropCompletionReasons.includes(d.finish_reason)?this.solutions[d.index]=null:(this.stats.markYielded(d.index),yield{solution:p,finishOffset:h,reason:d.finish_reason,requestId:this.requestId,index:d.index}),this.maybeCancel("after yielding finished choice"))return;this.solutions[d.index]=null}}}for(let[n,s]of Object.entries(this.solutions)){let o=Number(n);if(s!=null&&(this.stats.markYielded(o),yield{solution:s,finishOffset:void 0,reason:"Iteration Done",requestId:this.requestId,index:o},this.maybeCancel("after yielding after iteration done")))return}if(r.length>0)try{let n=JSON.parse(r);n.error!==void 0&&nu.error(this.ctx,`Error in response: ${n.error.message}`,n.error)}catch{nu.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){return this.cancellationToken?.isCancellationRequested?(nu.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)}};function bce(e,t,r){let n=t.solution.text.join(""),s=!1;t.finishOffset!==void 0&&(nu.debug(e,`solution ${t.index}: early finish at offset ${t.finishOffset}`),n=n.substring(0,t.finishOffset),s=!0),nu.info(e,`solution ${t.index} returned. finish reason: [${t.reason}]`),nu.debug(e,`solution ${t.index} details: finishOffset: [${t.finishOffset}] completionId: [{${t.requestId.completionId}}] created: [{${t.requestId.created}}]`);let o=QF(e,t.solution);return xce(e,n,o,t.index,t.requestId,s,r)}l(bce,"prepareSolutionForReturn");function QF(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(QF,"convertToAPIJsonData");var YF=class{constructor(t){this.choices=new Map;for(let r=0;r<t;r++)this.choices.set(r,new XF)}static{l(this,"ChunkStats")}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(", ")}},XF=class{constructor(){this.yieldedTokens=-1;this.seenTokens=0}static{l(this,"ChoiceStats")}increment(){this.seenTokens++}markYielded(){this.yieldedTokens=this.seenTokens}};var rS=new Cs(1,"fetch");function Qg(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(Qg,"getRequestId");function JF(e){let t=e.headers.get("openai-processing-ms");return t?parseInt(t,10):0}l(JF,"getProcessingTime");function Jg(e,t){let r=t.split("/").pop();return r||(rS.error(e,"Malformed engine URL: "+t),t)}l(Jg,"extractEngineName");function Tje(e){switch(e){case"ghostText":return"copilot-ghost";case"synthesize":return"copilot-panel"}}l(Tje,"uiKindToIntent");var Kd=class{static{l(this,"OpenAIFetcher")}};function Sje(e,t,r,n,s,o,a,c,u,f){let d=e.get(Ba),p=Cce.format("%s/%s",r,n);if(!a){Ha.error(e,`Failed to send request to ${p} due to missing key`);return}let h=as.createAndMarkAsIssued({endpoint:n,engineName:Jg(e,r),uiKind:c},$g(t));f&&(h=h.extendedBy(f));for(let[y,v]of Object.entries(o))y=="prompt"||y=="suffix"||(h.properties[`request.option.${y}`]=JSON.stringify(v)??"undefined");h
`),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=iS(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=iS(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=iS(n[d]);if(p!==void 0&&p<a)return p}})(),[f]=o(s,1,1);return{prev:u,current:a??0,next:f}}l(eB,"contextIndentationFromText");var Nje=!1;function Dje(e,t,r){let n=e.split(`
`),s=r!==void 0,o=r?.split(`
`).pop(),a=0;if(s&&o?.trim()!=""&&n[0].trim()!==""&&a++,!s&&Nje&&n[0].trim()===""&&a++,s||a++,n.length===a)return"continue";let c=Math.max(t.current,t.next??0);for(let u=a;u<n.length;u++){let f=n[u];u==0&&o!==void 0&&(f=o+f);let d=iS(f);if(d!==void 0&&(d<c||d===c&&!kje(f)))return n.slice(0,u).join(`
`).length}return"continue"}l(Dje,"completionCutOrContinue");function wce(e,t){return async r=>{let n=Dje(r,e,t);return n==="continue"?void 0:n}}l(wce,"indentationBlockFinished");var B0=hr(Ia());function Ice(e,t,r,n){r.markAsDisplayed();let s=n?`${t}.shownFromCache`:`${t}.shown`;pn(e,s,r)}l(Ice,"telemetryShown");function Ace(e,t,r){let n=t+".accepted",s=e.get(Gd);s.previousLabel=1,s.previousLabelTimestamp=Date.now(),pn(e,n,r)}l(Ace,"telemetryAccepted");function Rce(e,t,r){let n=t+".rejected",s=e.get(Gd);s.previousLabel=0,s.previousLabelTimestamp=Date.now(),pn(e,n,r)}l(Rce,"telemetryRejected");function ed(e,t={}){return{...t,telemetryBlob:e}}l(ed,"mkCanceledResultTelemetry");function td(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(td,"mkBasicResultTelemetry");async function Pce(e,t){if(t.type==="success")return q8(e,"ghostText.produced",t.telemetryData,{}),t.value;if(t.type!=="abortedBeforeIssued"){if(t.type==="canceled"){pn(e,"ghostText.canceled",t.telemetryData.telemetryBlob.extendedBy({reason:t.reason,cancelledNetworkRequest:t.telemetryData.cancelledNetworkRequest?"true":"false"}));return}q8(e,`ghostText.${t.type}`,{...t.telemetryData,reason:t.reason},{})}}l(Pce,"handleGhostTextResultTelemetry");var tB=new ka;function Oce(e){return[...e].sort((t,r)=>{let n=tB.get(t.uri.toString())??0;return(tB.get(r.uri.toString())??0)-n})}l(Oce,"sortByAccessTimes");var kce=l(e=>e.get(qo).onDidFocusTextDocument(t=>{t&&tB.set(t.document.uri.toString(),Date.now())}),"registerDocumentTracker");var oS=class{constructor(t){this.docManager=t}static{l(this,"OpenTabFiles")}async truncateDocs(t,r,n,s){let o=[],a=0;for(let c of t)if(!(a+c.getText().length>Q2.MAX_NEIGHBOR_AGGREGATE_LENGTH)&&(c.uri.scheme==="file"&&r.scheme==="file"&&c.uri.fsPath!==r.fsPath&&aS(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(Oce(await this.docManager.textDocuments()),t,r,n),o.set("opentabs",s.map(a=>a.uri)),{docs:s,neighborSource:o}}};function aS(e,t){return e===t}l(aS,"considerNeighborFile");var Q2=class e{static{l(this,"NeighborSource")}static{this.MAX_NEIGHBOR_AGGREGATE_LENGTH=2e5}static{this.MAX_NEIGHBOR_FILES=20}static{this.EXCLUDED_NEIGHBORS=["node_modules","dist","site-packages"]}static reset(){e.instance=void 0}static async getNeighborFiles(t,r,n){if(e.instance===void 0){let s=t.get(qo);e.instance=new oS(s)}return await e.instance.getNeighborFiles(r,n.fileType,e.MAX_NEIGHBOR_FILES)}};var Z2=hr(Ia()),$ce=require("crypto");function o6(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(o6,"editDistance");function Lje(){return new Map}l(Lje,"emptyLexDictionary");function Mje(e){let t=new Array(e.size);for(let[r,n]of e)t[n]=r;return t}l(Mje,"reverseLexDictionary");function*Fje(e){let t="",r;(c=>(c[c.Word=0]="Word",c[c.Space=1]="Space",c[c.Other=2]="Other"))(r||={});let n=0;for(let s of e){let o;/(\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&&(yield t)}l(Fje,"lexGeneratorWor
`)){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(qce,"breakUpLongLines");function Uce(e,t,r){return(n,s)=>{let o=qce(n.querySnippet,r),a=qce(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(Uce,"lineBasedSnippetMatcher");function jce(e,t){return(r,n)=>{let s=o6(r.querySnippet,n.querySnippet);return t==="relative"?s.distance<=e*Math.max(r.querySnippet.length,n.querySnippet.length):s.distance<=e}}l(jce,"editDistanceSnippetMatcher");function Uje(e,t){let r=(0,Z2.getCursorContext)(e,t);return{querySnippet:r.context,offset:e.offset,tokenLength:r.tokenLength,lineCount:r.lineCount}}l(Uje,"getRetrievalContext");var rB=class{constructor(t,r){this.uriToCache=new Map;this.matcher=t,this.maxUriCacheSize=r}static{l(this,"RetrievalCache")}hashContext(t){return(0,$ce.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 ka(this.maxUriCacheSize),this.uriToCache.set(t,o)),o.set(this.hashContext(n),{context:n,retrievalId:r,snippets:s})}};function jje(e,t,r,n,s){let o=Date.now(),a=t.get(r.uri,n),c=Date.now()-o;return Hje(e,a!==void 0,c,s),a}l(jje,"lookupCache");function Hje(e,t,r,n){pn(e,"retrieval.cacheLookup",n.extendedBy({cacheHit:t?"true":"false"},{cacheLookupElapsed:r}),0)}l(Hje,"telemetrizeCacheLookup");function $je(e,t,r,n){let s={retrievalContextTokens:r.tokenLength,retrievalLineCount:r.lineCount,cursorPos:t.offset};pn(e,"retrieval.tooShortContext",n.extendedBy({},s),0),pn(e,"retrieval.tooShortContext",n.extendedBy({file:t.uri,retrievalContext:r.querySnippet},s),1)}l($je,"telemetrizeTooShortContext");function Vje(e,t,r,n,s,o){let a={retrievalContextTokens:n.tokenLength,retrievalLineCount:n.lineCount,cursorPos:t.offset};pn(e,"retrieval.issued",o.extendedBy({retrievalId:r},a),0),pn(e,"retrieval.issued",o.extendedBy({retrievalId:r,file:t.uri,retrievalContext:n.querySnippet},a),1)}l(Vje,"telemetrizePostRetrievalRequest");function Gje(e,t,r,n){pn(e,"retrieval.response",n.extendedBy({retrievalId:t}),0)}l(Gje,"telemetrizePostRetrievalResponse");function zje(e,t,r,n){pn(e,"retrieval.error",n.extendedBy({retrievalId:t,error:JSON.stringify(r)??"unknown"}),0)}l(zje,"telemetrizePostRetrievalRequestError");function Wje(e,t,r,n,s){let o={numSnippetsFromServer:r?.results?.length||-1,numFilteredSnippets:n.length};pn(e,"retrieval.retrieved",s.extendedBy({retrievalId:t},{...o,elapsedEmbeddingNs:r?.metadata?.elapsed_embedding_ns||-1,elapsedKnnNs:r?.metadata?.elapsed_knn_ns||-1,elapsedFindSourceNs:r?.metadata?.elapsed_find_source_ns||-1}),0),pn(e,"retrieval.retrieved",s.extendedBy({retrievalId:t,snippets:JSON.stringify(n.map(a=>{let{restrictedTelemetry:c,...u}=a;return{...u,...c}}))},{...o}),1)}l(Wje,"telemetrizeProcessRetrievalResponse");function Kje(e,t,r,n,s){pn(e,"retrieval.errorProcess",s.extendedBy({retrievalId:t}),0),pn(e,"retrieval.errorProcess",s.extendedBy({retrievalId:t,body:JSON.stringify(r)??"unknown",error:JSON.stringify(n)??"unknown"}),1)}l(Kje,"telemetrizeProcessRetrievalError");function Yje(e,t,r){pn(e,"retrieval.debounced",r.extendedBy({pendingRetrievalId:t}),0)}l(Yje,"telemetrizeQueryRetrievalDebounce");function Xje(e,t,r,n){pn(e,"retrieval.cacheHit",n.extendedBy({cachedRetrievalId:t},{numSnippetsReturned:r.length}),0)}l(Xje,"telemetrizeQueryRetrievalFromCache");var a6=new Map;function Qje(e,t){return zF+`/v0/retrieval?repo=${e}&impl=${t}`}l(Qje,"retrievalRequestUrl");function Jje(e){return t=>t.relativePath===void 0?!0:!(e.uri.endsWith(t.relativePath)||t.relativePath.endsWith(e.uri))}l(Jje,"filterQuerySnippets");async function Zje(e,t,r,n,s){let o=Ea();a6.set(t.uri,{state:"pending",retrievalId:o});let a=(await e.get(ua).getCopilotToken(e)).token;Vje(e,t,o,r,n,s),s3(e,Qje(n.repoNwo,n.serverRouteImpl),a,void 0,Ea(),{query:r.querySnippet,opt
`),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(l6,"trimLastLine");async function zce(e,t,r,n,s,o,a){if((await e.get(Zf).evaluate(s,t,"UPDATE")).isBlocked)return nHe;let c=e.get(bs).suffixPercent(a),u=e.get(bs).fimSuffixLengthThreshold(a);if((c>0?t.length:r)<tHe)return rHe;let d=Date.now(),{prefix:p,suffix:h,prefixLength:m,suffixLength:g,promptChoices:y,promptBackground:v,promptElementRanges:_,neighborSource:x}=await iHe(e,t,r,n,s,o,a),[b,S]=l6(p),R=Date.now();return{type:"prompt",prompt:{prefix:b,suffix:h,prefixTokens:m,suffixTokens:g,isFimEnabled:c>0&&h.length>u,promptElementRanges:_.ranges},trailingWs:S,promptChoices:y,computeTimeMs:R-d,promptBackground:v,neighborSource:x}}l(zce,"extractPromptForSource");async function Wce(e,t,r,n){let s=await e.get(qo).getRelativePath(t);return zce(e,t.getText(),t.offsetAt(r),s,t.uri,t.languageId,n)}l(Wce,"extractPromptForDocument");function sHe(e,t){let r=e.document.languageId,n=e.document.getText();return r===t?n:(0,B0.commentBlockAsSingles)(n,t)}l(sHe,"addNeighboringCellsToPrompt");async function oHe(e,t,r,n,s){let o=r.getCells().find(a=>a.document.uri.toString()===t.uri.toString());if(o){let c=r.getCells().filter(p=>p.index<o.index&&aS(o.document.languageId,p.document.languageId)),u=c.length>0?c.map(p=>sHe(p,o.document.languageId)).join(`
`)+`
`:"",f=u+t.getText(),d=u.length+t.offsetAt(n);return zce(e,f,d,void 0,t.uri,o.document.languageId,s)}else return Wce(e,t,n,s)}l(oHe,"extractPromptForNotebook");function e4(e,t,r,n){let o=e.get(qo).findNotebook(t);return o===void 0?Wce(e,t,r,n):oHe(e,t,o,r,n)}l(e4,"extractPrompt");var Kce=2.98410452738298,Yce=-.838732736843507,Xce=1.50314646255716,Qce=-.237798634012662,cS={python:.314368072478742},Jce={"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 L9t=new Cs(1,"restraint"),aHe={link:e=>Math.exp(e)/(1+Math.exp(e)),unlink:e=>Math.log(e/(1-e))};function lHe(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(lHe,"linearInterpolation");var t4=class{static{l(this,"Regressor")}constructor(t,r,n){this.name=t,this.coefficient=r,this.transformation=n||(s=>s)}contribution(t){return this.coefficient*this.transformation(t)}},iB=class{constructor(t,r,n){this.link=aHe;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))}static{l(this,"LogisticRegression")}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 lHe(n,this.logitsToQuantiles)}},Zce=new iB(Kce,[new t4("compCharLen",Yce,e=>Math.log(1+e)),new t4("meanLogProb",Xce),new t4("meanAlternativeLogProb",Qce)].concat(Object.entries(cS).map(e=>new t4(e[0],e[1]))),Jce);function eue(e,t){let r={...t.measurements};return Object.keys(cS).forEach(n=>{r[n]=t.properties["customDimensions.languageId"]==n?1:0}),Zce.predict(e,r)}l(eue,"ghostTextScoreConfidence");function tue(e,t){let r={...t.measurements};return Object.keys(cS).forEach(n=>{r[n]=t.properties["customDimensions.languageId"]==n?1:0}),Zce.quantile(e,r)}l(tue,"ghostTextScoreQuantile");var cHe=[{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 uS(e){let t=e.slice();return t.reverse(),rue(t)||rue(t.filter(r=>r.trim().length>0))}l(uS,"isRepetitive");function rue(e){let t=uHe(e);for(let r of cHe){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(rue,"isRepeatedPattern");function uHe(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(uHe,"kmp_prefix_function");function fHe(e,t,r,n){let s="}";try{s=Yd.getBlockCloseToken(t.languageId)??"}"}catch{}return dHe({getLineText:o=>t.lineAt(o).text,getLineCount:()=>t.lineCount},r,n,s)}l(fHe,"maybeSnipCompletion");function dHe(e,t,r,n){let s=pHe(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(dHe,"maybeSnipCompletionImpl");function pHe(e){let t=e.includes(`\r
`)?`\r
`:`
`;return{lines:e.split(t),newLineCharacter:t}}l(pHe,"splitByNewLine");function hHe(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(hHe,"matchesNextLine");async function fS(e,t,r,n,s,o,a,c){if(uS(n.tokens)){let f=as.createAndMarkAsIssued();f.extendWithRequestId(n.requestId),pn(e,"repetition.detected",f,1),o.info(e,"Filtered out repetitive solution");return}let u={...n};if(hHe(t,r,u.completionText)){let f=as.createAndMarkAsIssued();f.extendWithRequestId(n.requestId),pn(e,"completion.alreadyInDocument",f),pn(e,"completion.alreadyInDocument",f.extendedBy({completionTextJson:JSON.stringify(u.completionText)}),1),o.info(e,"Filtered out solution matching next line");return}return u.completionText=mHe(u.completionText,c,a),u.completionText=fHe(e,t,r,u.completionText),u.completionText?u:void 0}l(fS,"postProcessChoice");function mHe(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 gHe(e,s)}l(mHe,"removeDifferenceOfCachedVsActualPromptSuffix");function gHe(e,t){return e.endsWith(t)?e.substring(0,e.length-t.length):e}l(gHe,"removeSuffix");function nue(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=0;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(nue,"checkSuffix");async function iue(e,t){let n;if(e.get(bs).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(bs).debounceMs(t);return n>0?n:75}l(iue,"getDebounceLimit");function sue(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=.024
`);if(n&&(s=s.filter(c=>c.trim().length>0)),Math.abs(t)>s.length||t>=s.length)return!1;t<0&&(t=s.length+t);let o=s[t];return(vHe[r]??[]).some(c=>o.includes(c))}l(aue,"hasComment");var dS=class{static{l(this,"PromptFeatures")}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=aue(t,-2,r),this.rstripSecondToLastLineHasComment=aue(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]}},sB=class{static{l(this,"MultilineModelFeatures")}constructor(t,r,n){this.language=n,this.prefixFeatures=new dS(t,n),this.suffixFeatures=new dS(r,n)}constructFeatures(){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(oue).length+1).fill(0);r[oue[this.language]??0]=1;let n=new Array(Object.keys(jc).length+1).fill(0);n[jc[this.prefixFeatures.lastChar]??0]=1;let s=new Array(Object.keys(jc).length+1).fill(0);s[jc[this.prefixFeatures.rstripLastChar]??0]=1;let o=new Array(Object.keys(jc).length+1).fill(0);o[jc[this.suffixFeatures.firstChar]??0]=1;let a=new Array(Object.keys(jc).length+1).fill(0);return a[jc[this.suffixFeatures.lstripFirstChar]??0]=1,t.concat(r,n,s,o,a)}};function xHe(e,t){return new sB(e.prefix,e.suffix,t)}l(xHe,"constructMultilineFeatures");function lue(e,t){let r=xHe(e,t).constructFeatures();return sue(r)[1]}l(lue,"requestMultilineScore");var Ja=new Cs(1,"ghostText");var c6,aB,lB;async function uue(e,t,r,n,s,o,a){Ja.debug(e,`Getting ${o} from network`),r=r.extendedBy();let c=await EHe(e,t,r),u=W2(e,c),f={stream:!0,n:c,temperature:u,extra:{language:t.languageId,next_indent:t.indentation.next??0,trim_by_indentation:x0e(t.blockMode),prompt_tokens:t.prompt.prefixTokens??0,suffix_tokens:t.prompt.suffixTokens??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:JSON.stringify(f.stop)??"unset",logit_bias:JSON.stringify(f.logit_bias??null)},h=$g(t.prompt);Object.assign(r.properties,p),Object.assign(r.measurements,h);try{let m={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(y=>setTimeout(y,t.delayMs));let g=await e.get(Kd).fetchAndStreamCompletions(e,m,r,s,n);return g.type==="failed"?{type:"failed",reason:g.reason,telemetryData:td(r)}:g.type==="canceled"?(Ja.debug(e,"Cancelled after awaiting fetchCompletions"),{type:"canceled",reason:g.reason,telemetryData:ed(r)}):a(c,d,g.getProcessingTime(),g.choices)}catch(m){if(Xu(m))return{type:"canceled",reason:"network request aborted",telemetryData:ed(r,{cancelledNetworkRequest:!0})};if(Ja.exception(e,m,"Error on ghost text request"),e.get(Qf).notifyUser(e,m),o3(e))throw m;return{type:"failed",reason:"non-abort error on ghost text request",telemetryData:td(r)}}}l(uue,"genericGetCompletionsFromNetwork");async function bHe(e,t,r,n,s){return uue(e,t,r,n,s,"completions",async(o,a,c,u)=>{let f=u[Symbol.asyncIterator](),d=await f.next();if(d.done)return Ja.debug(e,"All choices redacted"),{type:"empty",reason:"all choices redacted",telemetryData:td(r)};if(n?.isCancellationRequested)return Ja.debug(e,"Cancelled after awaiting redactedChoices iterator"),{type:"canceled",reason:"after awaiting redactedChoices iterator",telemetryData:ed(r)};let p=d.value;if(p===void 0)return Ja.debug(e,"Got undefined choice from redactedChoices iterator"),{type:"empty",reason:"got undefined choice from redactedChoices iterator",telemetryData:td(r)};mue(e,"performance",p,a,c);let h=o-1;Ja.debug(e,`Awaited first result, id: ${p.choiceIndex}`),DHe(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(bs).fastCancellation(r)&&f.next(),Ja.debug(e,`Awaited remaining results, number of results: ${y.length}`);let v=[];for(let _ of y){let x=_.value;if(x!==void 0&&(Ja.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&&pue(e,t,{multiline:t.multiline,choices:v})});return $c(e)&&await g,{type:"success",value:cB(d.value,{forceSingleLine:!1}),telemetryData:td(r),telemetryBlob:r}})}l(bHe,"getCompletionsFromNetwork");async function CHe(e,t,r,n,s){return uue(e,t,r,n,s,"all completions",async(o,a,c,u)=>{let f=[];for await(let d of u){if(n?.isCancellationRequested)return Ja.debug(e,"Cancelled after awaiting choices iterator"),{type:"canceled",reason:"after awaiting choices iterator",telemetryData:ed(r)};if(d.completionText.trimEnd()){if(f.findIndex(p=>p.completionText.trim()===d.completionText.trim())!==-1)continue;f.push(d)}}return f.length>0&&(pue(e,t,{multiline:t.multiline,choices:f}),mue(e,"cyclingPerformance",f[0],a,c)),{type:"success",value:f,telemetryData:td(r),telemetryBlob:r}})}l(CHe,"getAllCompletionsFromNetwork");function cB(e,t){let r={...e};return r.completionText=e.completionText.trimEnd(),t.forceSingleLine&&(r.completionText=r.completionText.split(`
`)[0]),r}l(cB,"makeGhostAPIChoice");async function EHe(e,t,r){let n=e.get(bs).overrideNumGhostCompletions(r);return n?t.isCycling?Math.max(0,3-n):n:v0e(t.blockMode)&&t.multiline?ja(e,Ms.InlineSuggestCount):t.isCycling?2:1}l(EHe,"getNumGhostCompletions");async function THe(e,t,r,n,s,o,a,c=!1,u=!0,f=!0,d=.5){let p=await e.get(t1).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 NHe(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(u0).position(r.line,Math.max(r.character-n.trailingWs.length,0)):m=r,{blockMode:p,requestMultiline:!0,isCyclingRequest:!1,finishedCb:s6(e,t,m)}}return{blockMode:p,requestMultiline:!1,isCyclingRequest:s,finishedCb:async m=>{}}}}}l(THe,"getGhostTextStrategy");var SHe=new mT;async function fue(e,t,r,n,s,o){let a=Ea();s=s.extendedBy({headerRequestId:a});let c=t.getText(),u=t.offsetAt(r),f=c.substring(u),d=Xg(e,t.uri),p=await XT(e,t),h=await e.get(bs).updateExPValuesAndAssignments(p,s),m=await e4(e,t,r,h);if(m.type==="copilotNotAvailable")return Ja.debug(e,"Copilot not available, due to content exclusion"),{type:"abortedBeforeIssued",reason:"Copilot not available due to content exclusion"};if(m.type==="contextTooShort")return Ja.debug(e,"Breaking, not enough context"),{type:"abortedBeforeIssued",reason:"Not enough context"};if(o?.isCancellationRequested)return Ja.info(e,"Cancelled after extractPrompt"),{type:"abortedBeforeIssued",reason:"Cancelled after extractPrompt"};let g=IHe(t,r);if(g===void 0)return Ja.debug(e,"Breaking, invalid middle of the line"),{type:"abortedBeforeIssued",reason:"Invalid middle of the line"};let y=e.get(Ba),v=e.get(u0),_=await THe(e,t,r,m,n,g,h);if(o?.isCancellationRequested)return Ja.info(e,"Cancelled after requestMultiline"),{type:"abortedBeforeIssued",reason:"Cancelled after requestMultiline"};let[x]=l6(t.getText(v.range(v.position(0,0),r))),b=wHe(e,x,m.prompt,_.requestMultiline),S=await tS(e,h),R=e.get(bs).beforeRequestWaitMs(h),k=e.get(bs).multiLogitBias(h),V={blockMode:_.blockMode,languageId:t.languageId,repoInfo:d,engineURL:S,ourRequestId:a,prefix:x,prompt:m.prompt,multiline:_.requestMultiline,indentation:sS(t,r),isCycling:n,delayMs:R,multiLogitBias:k},le=e.get(bs).debouncePredict(h),we=e.get(bs).contextualFilterEnable(h),xe=e.get(bs).contextualFilterAcceptThreshold(h),re=e.get(bs).contextualFilterEnableTree(h),oe=e.get(bs).contextualFilterExplorationTraffic(h),j=!1;(le||we)&&(j=!0);let z=await e.get(vf).detectLanguage(t),de=qHe(e,t,z,V,r,m,h,j,re);if(_.isCyclingRequest&&(b?.[0].length??0)>1||!_.isCyclingRequest&&b!==void 0)Ja.info(e,"Found inline suggestions locally");else{if(y?.setProgress(),_.isCyclingRequest){let Q=await CHe(e,V,de,o,_.finishedCb);if(Q.type==="success"){let ie=b?.[0]??[];Q.value.forEach(Mt=>{ie.findIndex(Ct=>Ct.completionText.trim()===Mt.completionText.trim())===-1&&ie.push(Mt)}),b=[ie,3]}else if(b===void 0)return y?.removeProgress(),Q}else{let Q=await iue(e,de);try{await SHe.debounce(Q)}catch{return{type:"canceled",reason:"by debouncer",telemetryData:ed(de)}}if(o?.isCancellationRequested)return Ja.info(e,"Cancelled during debounce"),{type:"canceled",reason:"during debounce",telemetryData:ed(de)};if(we&&de.measurements.contextualFilterScore&&de.measurements.contextualFilterScore<xe/100&&Math.random()<1-oe/100)return Ja.info(e,"Cancelled by contextual filter"),{type:"canceled",reason:"contextualFilterScore below threshold",telemetryData:ed(de)};let ie=await bHe(e,V,de,o,_.finishedCb);if(ie.type!=="success")return y?.removeProgress(),ie;b=[[ie.value],0]}y?.removeProgress()}if(b===void 0)return{type:"failed",reason:"internal error: choices should be defined after network call",telemetryData:td(de)};let[je,dr]=b,Se=Kg(Y0e(je),async Q=>fS(e,t,r,Q,g,Ja,m.prompt,f)),ze=[];for await(let Q of Se){let ie=g&&nue(t,r,Q);if(o?.isCancellationRequested)return Ja.info(e,"Cancelled after post processing completions"),{type:"canceled",reason:"after post processing
`).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=eue(e,o),o.measurements.quantile=tue(e,o),Ja.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(BHe,"telemetryWithAddData");function qHe(e,t,r,n,s,o,a,c,u){let f=e.get(u0),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={...$g(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((S,[R,k])=>({...S,[R]:k}),{}):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,cue.SHA256)(b).toString())]);y.properties.neighborSource=JSON.stringify(v),y.measurements.promptComputeTimeMs=o.computeTimeMs,c&&(y.measurements.contextualFilterScore=W0e(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=Jg(e,n.engineURL),y.properties.isMultiline=JSON.stringify(n.multiline),y.properties.blockMode=n.blockMode,y.properties.isCycling=JSON.stringify(n.isCycling),pn(e,"ghostText.issued",y),y}l(qHe,"telemetryIssued");function mue(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),pn(e,`ghostText.${t}`,c)}l(mue,"telemetryPerformance");var kh=class{constructor(){this.cache=new Map}static{l(this,"CertificateReaderCache")}get(t){return this.cache.get(t)}set(t,r){this.cache.set(t,r)}};var Bde=hr(require("fs")),qde=require("tls");var YS=new Cs(1,"certificates"),Gl=class{static{l(this,"RootCertificateReader")}},XS=l((e,t=process.platform)=>new yq(e.get(ll),wze(e,t),new Tq),"getRootCertificateReader"),yq=class extends Gl{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})}static{l(this,"FeatureAwareCertificateReader")}getAllRootCAs(){return this.delegate.getAllRootCAs()}};function wze(e,t){let r=e.get(kh).get(t);if(r)return r;let n=new KS(e,Ize(e,t),qde.rootCertificates),s=new KS(e,new xq),o=new vq([s,n]);return e.get(kh).set(t,o),o}l(wze,"createRealReader");function Ize(e,t){switch(t){case"linux":return new _q(e);case"darwin":return new bq(e);case"win32":return new Cq(e);default:return new Eq}}l(Ize,"createPlatformReader");var KS=class extends Gl{constructor(r,n,s=[]){super();this.ctx=r;this.delegate=n;this.fallbackCerts=s}static{l(this,"ErrorHandlingCertificateReader")}async getAllRootCAs(){try{return await this.delegate.getAllRootCAs()}catch(r){return YS.warn(this.ctx,`Failed to read root certificates: ${r}`),this.fallbackCerts}}},vq=class extends Gl{constructor(r){super();this.delegates=r}static{l(this,"CachingRootCertificateReader")}async getAllRootCAs(){return this.certificates||(this.certificates=(await Promise.all(this.delegates.map(r=>r.getAllRootCAs()))).flat()),this.certificates}},xq=class extends Gl{static{l(this,"Environm
`,{encoding:"utf8"})}async delete(t,r){let n=`${this.directory}/${t}.json`;try{let s=await op.promises.readFile(n,{encoding:"utf8"}),o=JSON.parse(s);delete o[r],await op.promises.writeFile(n,JSON.stringify(o)+`
`,{encoding:"utf8"})}catch{}}async deleteSetting(t){let r=`${this.directory}/${t}.json`;try{await op.promises.rm(r)}catch{}}async listSettings(){try{return(await op.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 op.promises.readFile(r,{encoding:"utf8"});return Object.keys(JSON.parse(n))}catch{return[]}}};function lWe(){return I6.env.XDG_CONFIG_HOME?I6.env.XDG_CONFIG_HOME+"/github-copilot":(0,hpe.platform)()==="win32"?I6.env.USERPROFILE+"\\AppData\\Local\\github-copilot":I6.env.HOME+"/.config/github-copilot"}l(lWe,"getXdgConfigPath");function mpe(){return new Nu(lWe())}l(mpe,"makeXdgPersistenceManager");function gpe(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(gpe,"errorMessageForUnsupportedNodeVersion");var nw=class extends eT{static{l(this,"AgentConfigProvider")}constructor(){super(new ZE,new Map),this.setOverridesFromEnvironment()}getOptionalConfig(t){if(!(Array.isArray(t)&&!this.isDefaultSettingOverwritten(t)))return super.getConfig(t)}setOverridesFromEnvironment(){["DebugOverrideEngine","DebugOverrideProxyUrl","DebugOverrideCapiUrl"].forEach(r=>{let n=`AGENT_${cWe(r)}`;n in process.env&&this.setConfig(Ms[r],process.env[n])})}};function cWe(e){return e.replace(/([a-z])([A-Z]+)/g,"$1_$2").toUpperCase()}l(cWe,"camelCaseToSnakeCaseAllCaps");var iw=class extends Gs{static{l(this,"AgentEditorInfo")}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"}}};var sw=hr(Ia()),ype=hr(require("path")),vpe=hr(Q0());var U0=class{constructor(t){this.ctx=t}static{l(this,"ConversationFileReader")}async getRelativePath(t){return await this.ctx.get(qo).getRelativePath(t)??ype.basename(t.uri.fsPath)}async readFile(t){let r=vpe.URI.parse(t),n=await this.readFromTextDocumentManager(r);return n.status!=="notfound"?n.status==="valid"&&n.document?.getText().length===0?{status:"notfound",message:"File is empty"}:n:await this.readFromFilesystem(r)}async readFromTextDocumentManager(t){return await this.ctx.get(qo).getTextDocumentWithValidation(t)}async readFromFilesystem(t){if(await this.fileExists(t)){if(await this.getFileSizeMB(t.fsPath)>5)return{status:"notfound",message:"File too large"};let n=await this.doReadFile(t.fsPath);if(n.length>0){if(!(await this.ctx.get(Zf).evaluate(t,n)).isBlocked){let o=this.ctx.get(Oh),a=o.create(t,"UNKNOWN",0,n),c=await this.ctx.get(vf).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(sw.FileSystem).readFileString(t)}async getFileSizeMB(t){return(await this.ctx.get(sw.FileSystem).stat(t)).size/1024/1024}async fileExists(t){try{return await this.ctx.get(sw.FileSystem).stat(t.fsPath),!0}catch{return!1}}};var Sf=class{static{l(this,"ConversationProgress")}};var b4=class{constructor(t){this.request=t;this.id=Ea();this.status="in-progress";this.skills=[];this.references=[]}static{l(this,"Turn")}},ow=class e{constructor(t,r=[],n="panel"){this.primer=t;this.turns=r;this.source=n;this._id=Ea()}static{l(this,"Conversation")}copy(){let t=JSON.parse(JSON.stringify(this.turns)),r=new e(this.primer,t,this.source);return r._id=this.id,r}get id(){return this._id}addTurn(t){this.turns.push(t)}deleteTurn(t){this.turns=this.turns.filter(r=>r.id!==t)}getLastTurn(){return this.turns[this.turns.length-1]}};function xpe(e,t,r){let n=["You are an AI programming assistant.",'When asked for your name, you must respond with "GitHub Copilot".',"Follow the user's requirements carefully & to the letter.","You must refuse to discuss your opinions or rules.","You must refuse to discuss life, exist
`),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(xpe,"chatBasePrompt");var fl=class{constructor(){this.skills=[]}static{l(this,"ConversationSkillRegistry")}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){return this.skills.find(r=>r.encoding===t)?.id}getDescriptors(){return[...this.skills]}};var Oq=class{constructor(t,r){this.conversation=t;this.capabilities=r}static{l(this,"ConversationHolder")}},p0=class{constructor(t){this.ctx=t;this.conversations=new ka(100)}static{l(this,"Conversations")}async create(t,r="panel"){let n=await this.ctx.get(Zs).getAuthRecord(this.ctx),s=this.ctx.get(Gs).getEditorInfo().readableName??this.ctx.get(Gs).getEditorInfo().name,o=uWe(process.platform),a=new ow(xpe(s,n?.user,o),[],r);return this.conversations.set(a.id,new Oq(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(fl).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}};function uWe(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(uWe,"mapPlatformToOs");function Lpe(e){return typeof e>"u"||e===null}l(Lpe,"isNothing");function fWe(e){return typeof e=="object"&&e!==null}l(fWe,"isObject");function dWe(e){return Array.isArray(e)?e:Lpe(e)?[]:[e]}l(dWe,"toArray");function pWe(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(pWe,"extend");function hWe(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}l(hWe,"repeat");function mWe(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}l(mWe,"isNegativeZero");var gWe=Lpe,yWe=fWe,vWe=dWe,xWe=hWe,_We=mWe,bWe=pWe,dl={isNothing:gWe,isObject:yWe,toArray:vWe,repeat:xWe,isNegativeZero:_We,extend:bWe};function Mpe(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(Mpe,"formatError");function R6(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=Mpe(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}l(R6,"YAMLException$1");R6.prototype=Object.create(Error.prototype);R6.prototype.constructor=R6;R6.prototype.toString=l(function(t){return this.name+": "+Mpe(this,t)},"toString");var ou=R6;function kq(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(kq,"getLine");function Nq(e,t){return dl.repeat(" ",t-e.length)+e}l(Nq,"padStart");function CWe(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=kq(e.buffer,n[a-u],s[a-u],e.position-(n[a]-n[a-u]),p),c=dl.repeat(" ",t.indent)+Nq((e.line-u+1).toString(),d)+" | "+f.str+`
`+c;for(f=kq(e.buffer,n[a],s[a],e.position,p),c+=dl.repeat(" ",t.indent)+Nq((e.line+1).toString(),d)+" | "+f.str+`
`,c+=dl.repeat("-",t.indent+d+3+f.pos)+`^
`,u=1;u<=t.linesAfter&&!(a+u>=s.length);u++)f=kq(e.buffer,n[a+u],s[a+u],e.position-(n[a]-n[a+u]),p),c+=dl.repeat(" ",t.indent)+Nq((e.line+u+1).toString(),d)+" | "+f.str+`
`;return c.replace(/\n$/,"")}l(CWe,"makeSnippet");var EWe=CWe,TWe=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],SWe=["scalar","sequence","mapping"];function wWe(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}l(wWe,"compileStyleAliases");function IWe(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(TWe.indexOf(r)===-1)throw new ou('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=wWe(t.styleAliases||null),SWe.indexOf(this.kind)===-1)throw new ou('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}l(IWe,"Type$1");var gc=IWe;function _pe(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(_pe,"compileList");function AWe(){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(AWe,"compileMap");function Lq(e){return this.extend(e)}l(Lq,"Schema$1");Lq.prototype.extend=l(function(t){var r=[],n=[];if(t instanceof gc)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 ou("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(o){if(!(o instanceof gc))throw new ou("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new ou("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 ou("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 gc))throw new ou("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(Lq.prototype);return s.implicit=(this.implicit||[]).concat(r),s.explicit=(this.explicit||[]).concat(n),s.compiledImplicit=_pe(s,"implicit"),s.compiledExplicit=_pe(s,"explicit"),s.compiledTypeMap=AWe(s.compiledImplicit,s.compiledExplicit),s},"extend");var RWe=Lq,PWe=new gc("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),OWe=new gc("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),kWe=new gc("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),NWe=new RWe({explicit:[PWe,OWe,kWe]});function DWe(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}l(DWe,"resolveYamlNull");function LWe(){return null}l(LWe,"constructYamlNull");function MWe(e){return e===null}l(MWe,"isNull");var FWe=new gc("tag:yaml.org,2002:null",{kind:"scalar",resolve:DWe,construct:LWe,predicate:MWe,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function BWe(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(BWe,"resolveYamlBoolean");function qWe(e){return e==="true"||e==="True"||e==="TRUE"}l(qWe,"constructYamlBoolean");function UWe(e){return Object.prototype.t
\r`;function uKe(e){if(e===null)return!1;var t,r,n=0,s=e.length,o=Uq;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(uKe,"resolveYamlBinary");function fKe(e){var t,r,n=e.replace(/[\r\n=]/g,""),s=n.length,o=Uq,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(fKe,"constructYamlBinary");function dKe(e){var t="",r=0,n,s,o=e.length,a=Uq;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(dKe,"representYamlBinary");function pKe(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}l(pKe,"isBinary");var hKe=new gc("tag:yaml.org,2002:binary",{kind:"scalar",resolve:uKe,construct:fKe,predicate:pKe,represent:dKe}),mKe=Object.prototype.hasOwnProperty,gKe=Object.prototype.toString;function yKe(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,gKe.call(s)!=="[object Object]")return!1;for(o in s)if(mKe.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(yKe,"resolveYamlOmap");function vKe(e){return e!==null?e:[]}l(vKe,"constructYamlOmap");var xKe=new gc("tag:yaml.org,2002:omap",{kind:"sequence",resolve:yKe,construct:vKe}),_Ke=Object.prototype.toString;function bKe(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],_Ke.call(n)!=="[object Object]"||(s=Object.keys(n),s.length!==1))return!1;o[t]=[s[0],n[s[0]]]}return!0}l(bKe,"resolveYamlPairs");function CKe(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(CKe,"constructYamlPairs");var EKe=new gc("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:bKe,construct:CKe}),TKe=Object.prototype.hasOwnProperty;function SKe(e){if(e===null)return!0;var t,r=e;for(t in r)if(TKe.call(r,t)&&r[t]!==null)return!1;return!0}l(SKe,"resolveYamlSet");function wKe(e){return e!==null?e:{}}l(wKe,"constructYamlSet");var IKe=new gc("tag:yaml.org,2002:set",{kind:"mapping",resolve:SKe,construct:wKe}),qpe=nKe.extend({implicit:[aKe,cKe],explicit:[hKe,xKe,EKe,IKe]}),Wh=Object.prototype.hasOwnProperty,aw=1,Upe=2,jpe=3,lw=4,Dq=1,AKe=2,bpe=3,RKe=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,PKe=/[\x85\u2028\u2029]/,OKe=/[,\[\]\{\}]/,Hpe=/^(?:!|!!|![a-z\-]+!)$/i,$pe=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Cpe(e){return Object.prototype.toString.call(e)}l(Cpe,"_class");function ap(e){return e===10||e===13}l(ap,"is_EOL");function d5(e){return e===9||e===32}l(d5,"is_WHITE_SPACE");function au(e){return e===9||e===32||e===10||e===13}l(au,"is_WS_OR_EOL");function E4(e){return e===44||e===91||e===93||e===123||e===125}l(E4,"is_FLOW_INDICATOR");function kKe(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}l(kKe,"fromHexCode");function NKe(e){return e===120?2:e===117?4:e===85?8:0}l(NKe,"escapedHexLen");function DKe(e){return 48<=e&&e<=57?e-48:-1}l(DKe,"fromDecimalCode");function Epe(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(Epe,"simpleEscapeSequence");function LKe(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}l(LKe,"charFromCodepoint");var Vpe=new Array(256),Gpe=new Array(256);for(f5=0;f5<256;f5++)Vpe[f5]=Epe(f5)?1:0,Gpe[f5]=Epe(f5);var f5;function MKe(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||qpe,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(MKe,"State$1");function zpe(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=EWe(r),new ou(t,r)}l(zpe,"generateError");function vs(e,t){throw zpe(e,t)}l(vs,"throwError");function cw(e,t){e.onWarning&&e.onWarning.call(null,zpe(e,t))}l(cw,"throwWarning");var Tpe={YAML:l(function(t,r,n){var s,o,a;t.version!==null&&vs(t,"duplication of %YAML directive"),n.length!==1&&vs(t,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),s===null&&vs(t,"ill-formed argument of the YAML directive"),o=parseInt(s[1],10),a=parseInt(s[2],10),o!==1&&vs(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=a<2,a!==1&&a!==2&&cw(t,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:l(function(t,r,n){var s,o;n.length!==2&&vs(t,"TAG directive accepts exactly two arguments"),s=n[0],o=n[1],Hpe.test(s)||vs(t,"ill-formed tag handle (first argument) of the TAG directive"),Wh.call(t.tagMap,s)&&vs(t,'there is a previously declared suffix for "'+s+'" tag handle'),$pe.test(o)||vs(t,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{vs(t,"tag prefix is malformed: "+o)}t.tagMap[s]=o},"handleTagDirective")};function zh(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||vs(e,"expected valid JSON character");else RKe.test(c)&&vs(e,"the stream contains non-printable characters");e.result+=c}}l(zh,"captureSegment");function Spe(e,t,r,n){var s,o,a,c;for(dl.isObject(r)||vs(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],Wh.call(t,o)||(t[o]=r[o],n[o]=!0)}l(Spe,"mergeMappings");function T4(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])&&vs(e,"nested arrays are not supported inside keys"),typeof s=="object"&&Cpe(s[f])==="[object Object]"&&(s[f]="[object Object]");if(typeof s=="object"&&Cpe(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)Spe(e,t,o[f],r);else Spe(e,t,o,r);else!e.json&&!Wh.call(r,s)&&Wh.call(t,s)&&(e.line=a||e.line,e.lineStart=c||e.lineStart,e.position=u||e.position,vs(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(T4,"storeMappingPair");function jq(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++):vs(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}l(jq,"readLineBreak");function el(e,t,r){for(var n=0,s=e.input.charCodeAt(e.position);s!==0;){for(;d5(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(ap(s))for(jq(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(Hq,"writeFoldedLines");function FKe(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),au(m)||E4(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),au(s)||r&&E4(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),au(s)||r&&E4(s))break}else if(m===35){if(n=e.input.charCodeAt(e.position-1),au(n))break}else{if(e.position===e.lineStart&&dw(e)||r&&E4(m))break;if(ap(m))if(u=e.line,f=e.lineStart,d=e.lineIndent,el(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&&(zh(e,o,a,!1),Hq(e,e.line-u),o=a=e.position,c=!1),d5(m)||(a=e.position+1),m=e.input.charCodeAt(++e.position)}return zh(e,o,a,!1),e.result?!0:(e.kind=p,e.result=h,!1)}l(FKe,"readPlainScalar");function BKe(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(zh(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 ap(r)?(zh(e,n,s,!0),Hq(e,el(e,!1,t)),n=s=e.position):e.position===e.lineStart&&dw(e)?vs(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);vs(e,"unexpected end of the stream within a single quoted scalar")}l(BKe,"readSingleQuotedScalar");function qKe(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 zh(e,r,e.position,!0),e.position++,!0;if(c===92){if(zh(e,r,e.position,!0),c=e.input.charCodeAt(++e.position),ap(c))el(e,!1,t);else if(c<256&&Vpe[c])e.result+=Gpe[c],e.position++;else if((a=NKe(c))>0){for(s=a,o=0;s>0;s--)c=e.input.charCodeAt(++e.position),(a=kKe(c))>=0?o=(o<<4)+a:vs(e,"expected hexadecimal character");e.result+=LKe(o),e.position++}else vs(e,"unknown escape sequence");r=n=e.position}else ap(c)?(zh(e,r,n,!0),Hq(e,el(e,!1,t)),r=n=e.position):e.position===e.lineStart&&dw(e)?vs(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}vs(e,"unexpected end of the stream within a double quoted scalar")}l(qKe,"readDoubleQuotedScalar");function UKe(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(el(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&&vs(e,"expected the node content, but found ','"):vs(e,"missed comma between flow collection entries"),v=y=_=null,p=h=!1,x===63&&(f=e.input.charCodeAt(e.position+1),au(f)&&(p=h=!0,e.position++,el(e,!0,t))),n=e.line,s=e.lineStart,o=e.position,S4(e,t,aw,!1,!0),v=e.tag,y=e.result,el(e,!0,t),x=e.input.charCodeAt(e.position),(h||e.line===n)&&x===58&&(p=!0,x=e.input.charCodeAt(++e.position),el(e,!0,t),S4(e,t,aw,!1,!0),_=e.result),m?T4(e,c,g,v,y,_,n,s,o):p?c.push(T4(e,null,g,v,y,_,n,s,o)):c.push(y),el(e,!0,t),x=e.input.charCodeAt(e.position),x===44?(r=!0,x=e.input.charCodeAt(++e.position)):r=!1}vs(e,"unexpected end of the stream within a flow collection")}l(UKe,"readFlowCollection");function jKe(e,t){var r,n,s=Dq,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)Dq===s?s=p===43?bpe:AKe:vs(e,"repeat of a chomping mode identifier");else if((d=DKe(p))>=0)d===0?vs(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?vs(e,"repeat of an indentation width identifier"):(c=t+d-1,a=!0);else break;if(d5(p)){do p=e.input.charCodeAt(++e.position)
`,o?1+u:u):s===Dq&&o&&(e.result+=`
`);break}for(n?d5(p)?(f=!0,e.result+=dl.repeat(`
`,o?1+u:u)):f?(f=!1,e.result+=dl.repeat(`
`,u+1)):u===0?o&&(e.result+=" "):e.result+=dl.repeat(`
`,u):e.result+=dl.repeat(`
`,o?1+u:u),o=!0,a=!0,u=0,r=e.position;!ap(p)&&p!==0;)p=e.input.charCodeAt(++e.position);zh(e,r,e.position,!1)}return!0}l(jKe,"readBlockScalar");function wpe(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,vs(e,"tab characters must not be used in indentation")),!(u!==45||(a=e.input.charCodeAt(e.position+1),!au(a))));){if(c=!0,e.position++,el(e,!0,-1)&&e.lineIndent<=t){o.push(null),u=e.input.charCodeAt(e.position);continue}if(r=e.line,S4(e,t,jpe,!1,!0),o.push(e.result),el(e,!0,-1),u=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&u!==0)vs(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(wpe,"readBlockSequence");function HKe(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,vs(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),o=e.line,(x===63||x===58)&&au(n))x===63?(v&&(T4(e,p,h,m,g,null,a,c,u),m=g=y=null),_=!0,v=!0,s=!0):v?(v=!1,s=!0):vs(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,!S4(e,r,Upe,!1,!0))break;if(e.line===o){for(x=e.input.charCodeAt(e.position);d5(x);)x=e.input.charCodeAt(++e.position);if(x===58)x=e.input.charCodeAt(++e.position),au(x)||vs(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(T4(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(_)vs(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=f,e.anchor=d,!0}else if(_)vs(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),S4(e,t,lw,!0,s)&&(v?g=e.result:y=e.result),v||(T4(e,p,h,m,g,y,a,c,u),m=g=y=null),el(e,!0,-1),x=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&x!==0)vs(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return v&&T4(e,p,h,m,g,null,a,c,u),_&&(e.tag=f,e.anchor=d,e.kind="mapping",e.result=p),_}l(HKe,"readBlockMapping");function $Ke(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&&vs(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)):vs(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!au(a);)a===33&&(n?vs(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(t-1,e.position+1),Hpe.test(s)||vs(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),OKe.test(o)&&vs(e,"tag suffix cannot contain flow indicator characters")}o&&!$pe.test(o)&&vs(e,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch{vs(e,"tag name is malformed: "+o)}return r?e.tag=o:Wh.call(e.tagMap,s)?e.tag=e.tagMap[s]+o:s==="!"?e.tag="!"+o:s==="!!"?e.tag="tag:yaml.org,2002:"+o:vs(e,'undeclared tag handle "'+s+'"'),!0}l($Ke,"readTagProperty");function VKe(e){var t,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&vs(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!au(r)&&!E4(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&vs(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 MKe(e,t),n=e.indexOf("\0");for(n!==-1&&(r.position=n,vs(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;)zKe(r);return r.documents}l(Wpe,"loadDocuments");function WKe(e,t,r){t!==null&&typeof t=="object"&&typeof r>"u"&&(r=t,t=null);var n=Wpe(e,r);if(typeof t!="function")return n;for(var s=0,o=n.length;s<o;s+=1)t(n[s])}l(WKe,"loadAll$1");function KKe(e,t){var r=Wpe(e,t);if(r.length!==0){if(r.length===1)return r[0];throw new ou("expected a single document in the stream, but found more")}}l(KKe,"load$1");var YKe=WKe,XKe=KKe,Kpe={loadAll:YKe,load:XKe},Ype=Object.prototype.toString,Xpe=Object.prototype.hasOwnProperty,$q=65279,QKe=9,P6=10,JKe=13,ZKe=32,eYe=33,tYe=34,Mq=35,rYe=37,nYe=38,iYe=39,sYe=42,Qpe=44,oYe=45,uw=58,aYe=61,lYe=62,cYe=63,uYe=64,Jpe=91,Zpe=93,fYe=96,e1e=123,dYe=124,t1e=125,yc={};yc[0]="\\0";yc[7]="\\a";yc[8]="\\b";yc[9]="\\t";yc[10]="\\n";yc[11]="\\v";yc[12]="\\f";yc[13]="\\r";yc[27]="\\e";yc[34]='\\"';yc[92]="\\\\";yc[133]="\\N";yc[160]="\\_";yc[8232]="\\L";yc[8233]="\\P";var pYe=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],hYe=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function mYe(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&&Xpe.call(u.styleAliases,c)&&(c=u.styleAliases[c]),r[a]=c;return r}l(mYe,"compileStyleMap");function gYe(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 ou("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+dl.repeat("0",n-t.length)+t}l(gYe,"encodeHex");var yYe=1,O6=2;function vYe(e){this.schema=e.schema||qpe,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=dl.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=mYe(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==='"'?O6:yYe,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(vYe,"State");function Ipe(e,t){for(var r=dl.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(Ipe,"indentString");function Fq(e,t){return`
`+dl.repeat(" ",e.indent*t)}l(Fq,"generateNextLine");function xYe(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(xYe,"testImplicitResolving");function fw(e){return e===ZKe||e===QKe}l(fw,"isWhitespace");function k6(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==$q||65536<=e&&e<=1114111}l(k6,"isPrintable");function Ape(e){return k6(e)&&e!==$q&&e!==JKe&&e!==P6}l(Ape,"isNsCharOrWhitespace");function Rpe(e,t,r){var n=Ape(e),s=n&&!fw(e);return(r?n:n&&e!==Qpe&&e!==Jpe&&e!==Zpe&&e!==e1e&&e!==t1e)&&e!==Mq&&!(t===uw&&!s)||Ape(t)&&!fw(t)&&e===Mq||t===uw&&s}l(Rpe,"isPlainSafe");function _Ye(e){return k6(e)&&e!==$q&&!fw(e)&&e!==oYe&&e!==cYe&&e!==uw&&e!==Qpe&&e!==Jpe&&e!==Zpe&&e!==e1e&&e!==t1e&&e!==Mq&&e!==nYe&&e!==sYe&&e!==eYe&&e!==dYe&&e!==aYe&&e!==lYe&&e!==iYe&&e!==tYe&&e!==rYe&&e!==uYe&&e!==fYe}l(_Ye,"isPlainSafeFirst");function bYe(e){return!fw(e)&&e!==uw}l(bYe,"isPlainSafeLast");function A6(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(A6,"codePointAt");function r1e(e){var t=/^\n* /;return t.test(e)}l(r1e,"needIndentIndicator");var n1e=1,Bq=2,i1e=3,s1e=4,C4=5;function CYe(e,t,r,n,s,o,a,c){var u,f=0,d=null,p=!1,h=!1,m=n!==-1,g=-1,y=_Ye(A6(e,0))&&bYe(A6(e,e.length-1));if(t||a)for(u=0;u<e.length;f>=65536?u+=2:u++){if(f=A6(e,u),!k6(f))return C4;y=y&&Rpe(f,d,c),d=f}else{for(u=0;u<e.length;f>=65536?u+=2:u++){if(f=A6(e,u),f===P6)p=!0,m&&(h=h||u-g-1>n&&e[g+1]!==" ",g=u);else if(!k6(f))return C4;y=y&&Rpe(f,d,c),d=f}h=h||m&&u-g-1>n&&e[g+1]!==" "}return!p&&!h?y&&!a&&!s(e)?n1e:o===O6?C4:Bq:r>9&&r1e(e)?C4:a?o===O6?C4:Bq:h?s1e:i1e}l(CYe,"chooseScalarStyle");function EYe(e,t,r,n,s){e.dump=function(){if(t.length===0)return e.quotingType===O6?'""':"''";if(!e.noCompatMode&&(pYe.indexOf(t)!==-1||hYe.test(t)))return e.quotingType===O6?'"'+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 xYe(e,f)}switch(l(u,"testAmbiguity"),CYe(t,c,e.indent,a,u,e.quotingType,e.forceQuotes&&!n,s)){case n1e:return t;case Bq:return"'"+t.replace(/'/g,"''")+"'";case i1e:return"|"+Ppe(t,e.indent)+Ope(Ipe(t,o));case s1e:return">"+Ppe(t,e.indent)+Ope(Ipe(TYe(t,a),o));case C4:return'"'+SYe(t)+'"';default:throw new ou("impossible error: invalid scalar style")}}()}l(EYe,"writeScalar");function Ppe(e,t){var r=r1e(e)?String(t):"",n=e[e.length-1]===`
`,s=n&&(e[e.length-2]===`
`||e===`
`),o=s?"+":n?"":"-";return r+o+`
`}l(Ppe,"blockHeader");function Ope(e){return e[e.length-1]===`
`?e.slice(0,-1):e}l(Ope,"dropEndingNewline");function TYe(e,t){for(var r=/(\n+)([^\n]*)/g,n=function(){var f=e.indexOf(`
`);return f=f!==-1?f:e.length,r.lastIndex=f,kpe(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!==""?`
`:"")+kpe(u,t),s=o}return n}l(TYe,"foldString");function kpe(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(kpe,"foldLine");function SYe(e){for(var t="",r=0,n,s=0;s<e.length;r>=65536?s+=2:s++)r=A6(e,s),n=yc[r],!n&&k6(r)?(t+=e[s],r>=65536&&(t+=e[s+1])):t+=n||gYe(r);return t}l(SYe,"escapeString");function wYe(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)),(f1(e,t,c,!1,!1)||typeof c>"u"&&f1(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=s,e.dump="["+n+"]"}l(wYe,"writeFlowSequence");function Npe(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)),(f1(e,t+1,u,!0,!0,!1,!0)||typeof u>"u"&&f1(e,t+1,null,!0,!0,!1,!0))&&((!n||s!=="")&&(s+=Fq(e,t)),e.dump&&P6===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=o,e.dump=s||"[]"}l(Npe,"writeBlockSequence");function IYe(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)),f1(e,t,u,!1,!1)&&(e.dump.length>1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),f1(e,t,f,!1,!1)&&(d+=e.dump,n+=d));e.tag=s,e.dump="{"+n+"}"}l(IYe,"writeFlowMapping");function AYe(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 ou("sortKeys must be a boolean or a function");for(c=0,u=a.length;c<u;c+=1)h="",(!n||s!=="")&&(h+=Fq(e,t)),f=a[c],d=r[f],e.replacer&&(d=e.replacer.call(r,f,d)),f1(e,t+1,f,!0,!0,!0)&&(p=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,p&&(e.dump&&P6===e.dump.charCodeAt(0)?h+="?":h+="? "),h+=e.dump,p&&(h+=Fq(e,t)),f1(e,t+1,d,!0,p)&&(e.dump&&P6===e.dump.charCodeAt(0)?h+=":":h+=": ",h+=e.dump,s+=h));e.tag=o,e.dump=s||"{}"}l(AYe,"writeBlockMapping");function Dpe(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,Ype.call(c.represent)==="[object Function]")n=c.represent(t,u);else if(Xpe.call(c.represent,u))n=c.represent[u](t,u);else throw new ou("!<"+c.tag+'> tag resolver accepts not "'+u+'" style');e.dump=n}return!0}return!1}l(Dpe,"detectType");function f1(e,t,r,n,s,o,a){e.tag=null,e.dump=r,Dpe(e,r,!1)||Dpe(e,r,!0);var c=Ype.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?(AYe(e,t,e.dump,s),h&&(e.dump="&ref_"+p+e.dump)):(IYe(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?Npe(e,t-1,e.dump,s):Npe(e,t,e.dump,s),h&&(e.dump="&ref_"+p+e.dump)):(wYe(e,t,e.dump),h&&(e.dump="&ref_"+p+" "+e.dump));else if(c==="[object String]")e.tag!=="?"&&EYe(e,e.dump,t,o,u);else{if(c==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new ou("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(f1,"writeNode");function RYe(e,t){var r=[],n=[],s,o;for(qq(e,r,n),s=0,o=n.length;s<o;s+=1)t.duplicates.push(r[n[s]]);t.usedDuplicates=new Array(o)}l(RYe,"getDuplicateReferences");function qq(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)qq(e[s],t,r);else for(n=Object.keys(e),s=0,o=n.length;s<o;s+=1)qq(e[n[s]],t,r)}l(qq,"inspectNode");function PY
`:""}l(PYe,"dump$1");var OYe=PYe,kYe={dump:OYe};function Vq(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(Vq,"renamed");var pTt=Kpe.load,hTt=Kpe.loadAll,Gq=kYe.dump;var mTt=Vq("safeLoad","load"),gTt=Vq("safeLoadAll","loadAll"),yTt=Vq("safeDump","dump");var p1=hr(sd()),N1e=hr(Q0());var zq=(r=>(r.Gpt35turbo="gpt-3.5-turbo",r.Gpt4="gpt-4",r))(zq||{});async function D6(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 NYe(e);return{model:"gpt-4",maxTokens:r,maxRequestTokens:n,maxResponseTokens:s,baseTokensPerMessage:3,baseTokensPerName:1,baseTokensPerCompletion:3}}}}l(D6,"getModelConfiguration");async function NYe(e){let t={repoNwo:"na",fileType:"na",userKind:"na",dogFood:"na",customModel:"na",retrievalOrg:"na"},r=e.get(bs),n=await r.updateExPValuesAndAssignments(t,as.createAndMarkAsIssued()),s=r.ideAgentChatGpt4MaxTokens(n),o=r.ideAgentChatGpt4MaxRequestTokens(n);return(s===-1||o===-1)&&([s,o]=await DYe(e)),o>=s&&(o=Math.floor(s*.8)),{maxTokens:s,maxRequestTokens:o,maxResponseTokens:s-o}}l(NYe,"getGpt4TokenConfig");async function DYe(e){return(await e.get(ua).getCopilotToken(e)).envelope?.copilot_ide_agent_chat_gpt4_small_prompt?[10240,8192]:[32768,24576]}l(DYe,"getDefaultValueForGpt4Tokens");var Dc=l(e=>D6(e,"gpt-4"),"userQuestionModelConfiguration"),L6=l(e=>D6(e,"gpt-3.5-turbo"),"metaPromptModelConfiguration"),M6=l(async e=>await D6(e,"gpt-3.5-turbo"),"followUpModelConfiguration");var pw=hr(Ia());function a1e(e,t){let r=(0,pw.getTokenizer)(pw.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(a1e,"countMessagesTokens");function p5(e){return as.createAndMarkAsIssued({messageId:e})}l(p5,"createTelemetryWithId");function w4(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(w4,"extendUserMessageTelemetryData");function l1e(e,t,r,n,s,o){return n!=null&&(o=o.extendedBy({offTopic:n.toString()})),mw(e,s,t,r,{uiKind:t},{},o).properties.messageId}l(l1e,"createUserMessageTelemetryData");function c1e(e,t,r,n,s,o,a){let c=FYe(n);return mw(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(c1e,"createModelMessageTelemetryData");function u1e(e,t,r,n,s,o,a){return mw(e,o,r,n,{source:"offTopic",turnIndex:t.turns.length.toString(),userMessageId:s,uiKind:r},{messageCharLen:n.length},a).properties.messageId}l(u1e,"createOffTopicMessageTelemetryData");function hw(e,t,r,n,s,o,a,c,u){let f=mw(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 LYe(e,r,o,f.properties.messageId,a,c),f.properties.messageId}l(hw,"createSuggestionMessageTelemetryData");function mw(e,t,r,n,s,o,a){let c=a??as.createAndMarkAsIssued(),u={messageText:n,...s};if(!("messageId"in s)&&!("messageId"in c.properties)){let h=Ea();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=MYe(r);return pn(e,`${p}.message`,f),pn(e,`${p}.messageText`,d,1),f}l(mw,"telemetryMessage");function f1e(e,t,r,n,s,o){return lp(e,o,{suggestion:r,messageId:n,suggestionId:s,uiKind:t},{},"conversation.suggestionShown")}l(f1e,"createSuggestionShownTelemetryData");function LYe(e,t,r,n,s,o){return lp(e,o,{suggestion:r,messageId:n,suggestionId:s,uiKind:t},{},"conversation.suggest
`),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(FYe,"getCodeBlocks");var F6=(s=>(s.System="system",s.User="user",s.Assistant="assistant",s.Function="function",s))(F6||{});function d1e(e,t,r,n,s,o,a,c,u){return gw(e,[t],c),{message:t,choiceIndex:n,requestId:s,modelInfo:u,blockFinished:o,finishReason:a,tokens:r.tokens,numTokens:r.tokens.length,telemetryData:c}}l(d1e,"convertToChatCompletion");var g1e=hr(Ia()),y1e=hr(sd());var Kq=hr(Ia());var Wq=hr(Ia());function I4(e,t){if(e.length==0)return new Wq.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 Wq.ElidableText(r)}l(I4,"weighElidableList");var d1=hr(Ia());function p1e(e){let t=e.split(`
`),r=[],n=!1,s=[];for(let o of t)o.startsWith("```")?(n?(r.push([(0,d1.elidableTextForSourceCode)(s.join(`
`)),1]),s=[],r.push([new d1.ElidableText([o]),1])):r.push([new d1.ElidableText([o]),1]),n=!n):n?s.push(o):r.push([new d1.ElidableText([o]),.8]);return n&&(r.push([(0,d1.elidableTextForSourceCode)(s.join(`
`)),1]),r.push([new d1.ElidableText(["```"]),1])),new d1.ElidableText(r)}l(p1e,"fromMessage");function A4(e){let t=BYe(e),r=[];for(let n=0;n<t.length;n++){let s=t[n],o=h1e(s.request),a=s.response&&s.response?.type!=="meta"?h1e(s.response):"",c=o;a!==""&&(c+=`
`+a+(t.length>1&&n!==t.length-1?`
`:"")),r.push(p1e(c))}return r.length>0?new Kq.ElidableText([[new Kq.ElidableText(["Consider the following conversation history:"]),1],[I4(r,"inverseLinear"),1]]):null}l(A4,"fromHistory");function BYe(e){return e.filter(t=>(t.status==="success"||t.status==="in-progress")&&t.request.message!="")}l(BYe,"filterTurns");function h1e(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(h1e,"formatTurnMessage");var yw=class{constructor(){this.promptType="followup";this.modelConfiguration=async t=>await M6(t)}static{l(this,"FollowUpPromptStrategy")}async suffix(){return y1e.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=A4(t.turns.slice()),n=[];return r!==null&&n.push([r,.6]),[new g1e.ElidableText(n),[]]}};var A1e=hr(sd());var w1e=hr(Ia()),I1e=hr(sd());var Rw=hr(Ia());var La=new Cs(0,"Copilot Chat");var cp=class{constructor(t,r,n){this.ctx=t;this.conversation=r;this.turn=n;this.collector=new Xq;this.skillResolver=new Yq(this)}static{l(this,"TurnContext")}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})}},vw=class extends Error{constructor(r,n){super(`Cycle detected while resolving skills: ${n.join(" -> ")} -> ${r}`);this.skillId=r;this.skillStack=n}static{l(this,"CycleError")}},Yq=class{constructor(t){this.turnContext=t;this.resolveStack=[]}static{l(this,"SkillResolver")}async resolve(t){if(this.turnContext.ctx.get(p0).getSupportedSkills(this.turnContext.conversation.id).includes(t)){this.ensureNoCycle(t);let n=this.turnContext.ctx.get(od).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 vw(t,this.resolveStack);this.resolveStack.push(t)}async newlyResolve(t){let n=this.turnContext.ctx.get(fl).getSkill(t);try{let s=await n?.resolver(this.turnContext).resolveSkill(this.turnContext);if(s)return this.turnContext.ctx.get(od).addResolvedSkill(this.turnContext.turn.id,t,s),s}catch(s){if(s instanceof vw)throw s;La.exception(this.turnContext.ctx,s,`Error while resolving skill ${t}`)}}};function Wl(e){switch(e.status){case"valid":return"included";case"invalid":return"blocked";case"notfound":return"notfound"}}l(Wl,"statusFromTextDocumentResult");var Xq=class{constructor(){this.collectibles=[]}static{l(this,"Collector")}collect(t){this.collectibles.push(t)}collectiblesForSkill(t){return this.collectibles.filter(r=>r.skillId===t)}};var _1e=hr(Ia());var x0=hr(Gi()),Kh=x0.Type.Object({start:x0.Type.Object({line:x0.Type.Number({minimum:0}),character:x0.Type.Number({minimum:0})}),end:x0.Type.Object({line:x0.Type.Number({minimum:0}),character:x0.Type.Number({minimum:0})})}),Lc=x0.Type.Object({uri:x0.Type.String(),position:x0.Type.Optional(x0.Type.Object({line:x0.Type.Number({minimum:0}),character:x0.Type.Number({minimum:0})})),visibleRange:x0.Type.Optional(Kh),selection:x0.Type.Optional(Kh),openedAt:x0.Type.Optional(x0.Type.String()),activeAt:x0.Type.Optional(x0.Type.String())}),qYe=Lc,R4=x0.Type.Union([qYe]),v1e=x0.Type.Union([x0.Type.Literal("panel"),x0.Type.Literal("inline")]);var P4=hr(Ia()),x1e=hr(sd());var UYe={start:{line:0,character:0},end:{line:0,character:0}},Yh=class{constructor(t,r=UYe,n){this.doc=t;this.selection=r;this.visibleRange=n}static{l(this,"ElidableDocument")}fromSelectedCode(){let t=(0,P4.elidableTextForSourceCode)((0,x1e.default)(this.doc.getText(this.getExpandedSelection())).trim());return this.wrapInTicks(t)}fromAllCode(){let t=this.getDocumentRange(),r=this.getExpandedSelection(),n;!this.visibleRange||!this.rangeContainedIn(this.visibleRange,this.selection)?n=r:n={start:this.getLineStart(this.visibleRange.start.line),end:this.expandLineToEnd(this.doc,this.visibleRange.end.line)};let s={start:t.start,end:n.start.line>0?this.expandLineToEnd(this.doc,n.start.line-1):t.start},o={start:n.start,end:r.start.line>0&&r.start.line>n.start.line?this.expandLineToEnd(this.doc,r.start.line-1):n.start},a={start:r.end.line<this.doc.lineCount-1&&r.end.line<n.end.line?this.getLineStart(r.end.line+1):n.end,end:n.end},c={start:n.end.line<this.doc.lineCount-1?this.getLineStart(n.end.line+1):t.end,end:t.end},u=[[s,.6],[o,.8],[r,1],[a,.4],[c,.2]],f=new P4.ElidableText(u.filter(([d,p])=>!this.isEmptyRange(d)).map(([d,p])=>[(0,P4.elidableTextForSourceCode)(this.doc.getText(d)),p]));return this.wrapInTicks(f)}hasSelection(){return!this.rangeEquals(this.getExpandedSelection(),this.getDocumentRange())&&!this.isEmptyRange(this.selection)}getDocumentRange(){return{s
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()}};var Pw=class extends Qh{constructor(){super(...arguments);this.promptType="inline-file";this.modelConfiguration=Dc}static{l(this,"InlineFilePromptStrategy")}async suffix(r){return A1e.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 may include a selection). It may involve generating code.
To generate code additions or modifications, you must mark at most one codeblock in the reply with a "<!-- file -->" comment:
<!-- file -->
\`\`\`language
code
\`\`\`
This codeblock will be inserted into the user's editor and replace the entire contents of the open 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.
Do not omit any text from the file.
The codeblock must be valid code in the language specified.
Additional code blocks can be provided to add context or additional information, but only one should be marked for application.
Briefly explain the changes made to the file before the codeblock.
User question:
${r}`.trim()}};var R1e=hr(sd());var Ow=class extends Qh{constructor(){super(...arguments);this.promptType="inline-selection";this.modelConfiguration=Dc}static{l(this,"InlineSelectionPromptStrategy")}async suffix(r){return R1e.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 a specific selection in their code. It may involve generating code.
To generate code additions or modifications to the selection, you must mark at most one codeblock in the reply with a "<!-- selection -->" comment:
<!-- selection -->
\`\`\`language
code
\`\`\`
This codeblock will be inserted into the user's editor 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.
Additional code blocks can be provided to add context or additional information, but only one should be marked for application.
Briefly explain the changes made before the codeblock.
If you do not provide a codeblock tagged with the markdown comment, the user's selection will not be replaced.
If code outside of the user's selection needs to be updated, explain the changes that the user needs to make.
User question:
${r}`.trim()}};var P1e=hr(Ia()),O1e=hr(sd());var kw=class{constructor(){this.promptType="meta";this.modelConfiguration=async t=>await L6(t)}static{l(this,"MetaPromptStrategy")}async elidablePrompt(t,r){let n=A4(t.turns.slice(0,-1)),s=[];return n!==null&&s.push([n,.6]),[new P1e.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 O1e.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()}};var Nw=class{static{l(this,"DefaultPromptStrategyFactory")}createPromptStrategy(t,r){switch(r){case"user":return new Qh(t);case"meta":return new kw;case"followup":return new yw;case"inline-file":return new Pw(t);case"inline-selection":return new Ow(t);default:throw new Error(`Unknown prompt type ${r}`)}}};function k1e(e,t,r){return t===null?`${e}
${r}`:`${e}
${t}
${r}`}l(k1e,"makePrompt");function GYe(e){let t=e.trimStart();return t=t.replace(/^\[\.\.\.\]\n?/,""),t===""?null:t}l(GYe,"processResultOfElidableText");var vc=class{constructor(t,r=new Nw){this.ctx=t;this.promptStrategyFactory=r}static{l(this,"ConversationPromptEngine")}async toPrompt(t,r,n="user"){let s=t.primer,o=t.getLastTurn().request.message,a=this.promptStrategyFactory.createPromptStrategy(this.ctx,n),c=await a.modelConfiguration(this.ctx),[u,f]=await a.elidablePrompt(t,o),d=await a.suffix(o,r),p=k1e(s,"",d),h=this.toConversationPrompt(p,f,c).tokens,m=GYe(u.makePrompt(r.maxTokens-h)),g=k1e(s,m,d);return this.toConversationPrompt(g,f,c)}toConversationPrompt(t,r,n){let s=[{role:"user",content:t}];return{messages:s,tokens:a1e(s,n),skillResolutions:r}}};var iU=class{constructor(){this.resolvedSkills={};this.resolutions=[]}static{l(this,"SkillDump")}},od=class{constructor(){this.dump=new ka(25)}static{l(this,"ConversationSkillDumper")}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 iU,this.dump.set(t,r)),r}};function sU(e){let t=e.copy();return t.turns=t.turns.filter(r=>r.status!=="in-progress"&&(r.response===void 0||r.response?.type==="model")),t}l(sU,"filterConversationTurns");function oU(e){return sU(e).getLastTurn()?.id}l(oU,"getLastTurnId");async function D1e(e,t,r){let n=sU(t),s=oU(t);if(!s)return"Nothing to dump because no request has been sent to the model yet.";let a=e.get(od).getDump(s),c=KYe(a,n.turns);Ha.debug(e,`conversation.dump
`,`
`+c);let u=await YYe(a,e);return p1.default`
${WYe(t,s)}
${zYe(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(D1e,"getConversationDump");function zYe(e){let t=e.get(Gs);return p1.default`
- IDE: \`${t.getEditorInfo().name} (${t.getEditorInfo().version})\`
- Plugin: \`${t.getEditorPluginInfo().version}\`
`}l(zYe,"getEditorInfoDumpMessage");function WYe(e,t){return p1.default`
Debug information for the last turn of the conversation.
- ConversationId: \`${e.id}\`
- MessageId: \`${t}\`
`}l(WYe,"getInfoDumpMessage");async function L1e(e,t,r){let n=e.get(p0).getSupportedSkills(t.id);for(let a of n)up.includes(a)||r.skills.push({skillId:a});for(let a of up)r.skills.push({skillId:a});let s={maxTokens:(await Dc(e)).maxRequestTokens},o=await e.get(vc).toPrompt(t,s);if(o.messages.length>0)return p1.default`
The prompt is:
\`\`\`\`
${o.messages[0].content}
\`\`\`\`
`}l(L1e,"getCurrentPrompt");async function M1e(e,t,r){let n=sU(t);if(n.turns.length===0)return;let s={maxTokens:(await Dc(e)).maxRequestTokens},o=await e.get(vc).toPrompt(n,s);if(o.messages.length>0)return p1.default`
The prompt that generated the last response is:
\`\`\`\`
${o.messages[0].content}
\`\`\`\`
`}l(M1e,"getLastPrompt");async function F1e(e,t,r,n){let s=e.get(fl),o="## Available skills",a=s.getDescriptors().filter(c=>e.get(p0).getSupportedSkills(t.id).includes(c.id));if(n&&(a=a.filter(c=>c.id===n),a.length===0))return`No skill with id ${n} available`;for(let c of a){o+=`
---
`,o+=`### ${c.id}`,o+=p1.default`
\n\n
**Description**
${c.description()}`;let u=s.getSkill(c.id),f=new cp(e,t,r),d=await u?.resolver(f).resolveSkill(f);if(d){o+=p1.default`
\n\n
**Resolution**
\`\`\`yaml
${Gq(d)}
\`\`\``;let p=await u?.processor(f).processSkill(d);if(p){let h=typeof p=="string"?p:p.makePrompt(1e3);o+=p1.default`
\n\n
**Processed value**
${h}`}else o+=`
**Unprocessable**`}else o+=`
**Unresolvable**`}return o}l(F1e,"getSkillsDump");function KYe(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 Gq(r)}l(KYe,"toSimulationFormat");async function YYe(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(qo).getTextDocument(N1e.URI.parse(o.uri)),c=a?.getText();Ha.debug(t,`conversation.dump.file
`,c),s+=`
**${o.uri}**
\`\`\`${a?.languageId}
${c}
\`\`\``}return s}l(YYe,"fileDump");var B1e=hr(Gi());var q1e=B1e.Type.String(),aU=class{constructor(t){this.turnContext=t}static{l(this,"BuildLogsSkillProcessor")}value(){return .9}async processSkill(t){return this.turnContext.collectLabel(Lw,"build logs"),`The contents of the application build logs:
\`\`\`
${t}
\`\`\``}},Lw="build-logs",Dw=class{constructor(t,r){this._resolver=t;this.encoding=r;this.id=Lw;this.type="explicit"}static{l(this,"BuildLogsSkill")}description(){return"The application build logs, which can be used to fix build or compilation errors."}resolver(){return this._resolver}processor(t){return new aU(t)}};var Jh=hr(Ia()),Du=hr(Gi());var U1e=Du.Type.Object({head:Du.Type.Optional(Du.Type.Object({name:Du.Type.String(),upstream:Du.Type.Optional(Du.Type.Object({remote:Du.Type.String(),name:Du.Type.String()}))})),isRebasing:Du.Type.Boolean(),remotes:Du.Type.Optional(Du.Type.Array(Du.Type.String()))}),lU=class{constructor(t){this.turnContext=t}static{l(this,"GitMetadataSkillProcessor")}value(){return .8}async processSkill(t){this.turnContext.collectLabel(Fw,"git repository information");let r=[];return r.push([new Jh.ElidableText(["Metadata about the current git repository:"]),1]),t.head&&t.head.name?(r.push([new Jh.ElidableText([`- Current Branch name: ${t.head.name}`]),1]),t.head.upstream&&r.push([new Jh.ElidableText([`- Upstream: ${t.head.upstream.remote+"/"+t.head.upstream.name}`]),1])):r.push([new Jh.ElidableText(["- Detached HEAD: yes"]),1]),r.push([new Jh.ElidableText([`- Is currently rebasing? ${t.isRebasing?"yes":"no"}`]),1]),t.remotes&&t.remotes.length>0&&r.push([new Jh.ElidableText([`- Remotes: ${(t.remotes??[]).join(", ")}`]),1]),new Jh.ElidableText(r)}},Fw="git-metadata",Mw=class{constructor(t,r){this._resolver=t;this.encoding=r;this.id=Fw;this.type="explicit"}static{l(this,"GitMetadataSkill")}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 lU(t)}};var h5=hr(Ia()),k4=hr(Gi());var j1e=k4.Type.Object({uri:k4.Type.String(),problems:k4.Type.Array(k4.Type.Object({message:k4.Type.String(),range:Kh}))}),cU=class{constructor(t){this.turnContext=t}static{l(this,"ProblemsInActiveDocumentSkillProcessor")}value(){return 1}async processSkill(t){let r=this.turnContext.ctx.get(U0),n=await r.readFile(t.uri);if(this.turnContext.collectFile(Zh,t.uri,Wl(n)),n.status==="valid"){let s=await r.getRelativePath(n.document);this.turnContext.collectLabel(Zh,`problems in ${s}`);let o=[];return o.push([new h5.ElidableText([`Problems and errors in the active document (\`${s}\`):`]),1]),t.problems.forEach(a=>{o.push([new h5.ElidableText([`- "${a.message}" at line ${a.range.start.line}.`+(n.document?" Excerpt from the code:":"")]),.9]);let c=a.range,u;if(c&&(this.isEmpty(c)?u=n.document.lineAt(c.start).text:u=n.document.getText(c),u)){let f=n.document.languageId;o.push([new h5.ElidableText([["```"+f,1],[(0,h5.elidableTextForSourceCode)(u),.8],["```",1]]),.9])}}),new h5.ElidableText(o)}else this.turnContext.collectLabel(Zh,"problem markers")}isEmpty(t){return t.start.line===t.end.line&&t.start.character===t.end.character}},Zh="problems-in-active-document",Bw=class{constructor(t,r){this._resolver=t;this.encoding=r;this.id=Zh;this.type="explicit"}static{l(this,"ProblemsInActiveDocumentSkill")}description(){return"List of problems and errors in the active document"}resolver(){return this._resolver}processor(t){return new cU(t)}};var H1e=hr(Ia()),N4=hr(Gi());var XYe=N4.Type.Object({uri:N4.Type.String(),sections:N4.Type.Array(Kh)}),MIt=N4.Type.Object({snippets:N4.Type.Array(XYe)}),uU=class{static{l(this,"ProjectContextSkillProcessor")}constructor(){}value(){return 1}async processSkill(t){return new H1e.ElidableText(["TODO"])}},fU=class{static{l(this,"ProjectContextSkillResolver")}constructor(){}async resolveSkill(){}},QYe="project-context",qw=class{constructor(t){this.encoding=t;this.id=QYe;this.type="explicit"}static{l(this,"ProjectContextSkill")}description(){return"Context about the project the user is working on including code snippets, documentation, and more."}resolver(t){return new fU}processor(t){return new uU}};var $1e=hr(Ia()),dU=hr(Gi());var V1e=dU.Type.Object({files:dU.Type.Array(Lc)}),JYe=3,pU=class{constructor(t){this.turnContext=t}static{l(this,"RecentFilesSkillProcessor")}value(){re
\`\`\`
${t}
\`\`\``}},$w="runtime-logs",Hw=class{constructor(t,r){this._resolver=t;this.encoding=r;this.id=$w;this.type="explicit"}static{l(this,"RuntimeLogsSkill")}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 hU(t)}};var m5=hr(Gi()),vU=hr(Q0());var h1=hr(Ia());var W1e=hr(require("fs")),Kl=require("path"),em=hr(Q0());var q6=require("path"),mU=[".test",".spec","_test","Test","_spec","_test","Tests",".Tests","Spec"],gU="test_",U6={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"}},j6=class{constructor(t,r=void 0){this.fileExists=t;this.basePath=r}static{l(this,"TestFileFinder")}async findTestFileForSourceFile(t){let r=t.fsPath,n=(0,Kl.basename)(r),s=(0,Kl.extname)(r).replace(".",""),o=U6[s]??{location:"sameFolder",prefix:gU,suffix:mU},a=[];if(o.prefix&&a.push(o.prefix+n),o.suffix)for(let f of o.suffix??[]){let d=n.replace(`.${s}`,f+"."+s);a.push(d)}let c=o.location??"sameFolder",u;c==="sameFolder"?u=(0,Kl.dirname)(r):u=this.determineTestFolder(r,c);for(let f of a){let d=q6.join(u,f);if(await this.fileExists(em.URI.parse(d)))return em.URI.file(d)}if(await this.fileExists(em.URI.file(u))){let f=q6.join(u,a[0]);return em.URI.file(f)}}async findImplFileForTestFile(t){let r=t.fsPath,n=(0,Kl.basename)(r),s=(0,Kl.extname)(r).replace(".",""),o=U6[s]??{location:"sameFolder",prefix:gU,suffix:mU},a=[];if(o.prefix&&a.push(n.substring(o.prefix.length)),o.suffix)for(let f of o.suffix??[]){let p=n.substring(0,n.length-f.length-1-s.length)+"."+s;a.push(p)}let c=o.location??"sameFolder",u="";c==="sameFolder"?u=(0,Kl.dirname)(r):u+=this.determineImplFolder(r);for(let f of a){let d=q6.join(u,f);if(await this.fileExists(em.URI.parse(d)))return em.URI.file(d)}}findExampleTestFile(t){let r=t.fsPath,n=(0,Kl.extname)(r).replace(".",""),s,o=U6[n]?.location??"sameFolder";o==="sameFolder"?s=(0,Kl.dirname)(r):s=this.determineTestFolder(r,o);let a=this.findFiles(s,`.${n}`,U6[n]);if(a.length>0)return em.URI.file(a[0])}findFiles(t,r,n){let s=this._readdir(t),o=[];for(let a of s){let c=`${t}${q6.sep}${a}`;n?.prefix&&a.startsWith(n.prefix)&&o.push(c),n?.suffix&&n?.suffix.some(u=>a.endsWith(u+r))&&o.push(c)}return o}_readdir(t){return W1e.readdirSync(t,{withFileTypes:!0}).filter(r=>r.isFile()).map(r=>r.name)}determineTestFolder(t,r){let n=this.basePath?.fsPath??"",s=(0,Kl.extname)(t).replace(".",""),o=this.getRelativeTestFolder(t,n,s,r);return[n,...o].join(q6.sep)}getRelativeTestFolder(t,r,n,s){let o=(0,Kl.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,Kl.extname)(t).replace(".",""),n=(0,Kl.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/")}}};async function yU(e){let t=e.fsPath,r=(0,Kl.basename)(t),n=(0,Kl.extname)(t),s=U6[n.replace(".","")];return s?!(s.suffix&&!s.suffix.some(a=>r.endsWith(a+n))||s.prefix&&!r.startsWith(s.prefix)):!!(mU.some(a=>r.endsWith(a+n))||r.startsWith(gU))}l(yU,"isTestFile");var Vw=class{constructor(t){this.turnContext=t}static{l(this,"PromptForTestGeneration")}async fromImplementationF
`)?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 ld.ElidableText([Y1e.default`\n\n- Test ${o}${a}${c}failed${u}The failed test is ${f}.\n`]),1]});return new ld.ElidableText(n)}appendCode(t,r,n){let s=[new ld.ElidableText([`
The code of file \`${r}\` is:
`]),.6],o=[new ld.ElidableText([["```"+n.languageId,1],[(0,ld.elidableTextForSourceCode)(n.getText()),.9],["```",1]]),.7];return new ld.ElidableText([[t,1],s,o])}},g5="test-failures",zw=class{constructor(t,r){this._resolver=t;this.encoding=r;this.id=g5;this.type="explicit"}static{l(this,"TestFailuresSkill")}description(){return"Test failures and errors of the latest test run"}resolver(){return this._resolver}processor(t){return new _U(t)}};var fge=hr(lm());var mH=require("fs"),uge=require("stream"),cm=hr(I5());var oge=hr(require("events")),age=hr(require("fs")),lge=hr(require("http")),Y4=hr(require("path")),cge=hr(require("stream"));var VI=class{constructor(t){this.port=t;this.stdoutEmitter=new oge.EventEmitter;this.server=lge.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=>{sge(n,a)});return;case"/stdout":this.stdoutEmitter.on("data",a=>{sge(n,a)});return;default:n.writeHead(404),n.end();return}n.writeHead(200,{"Content-Type":"text/html"});let s=__dirname;Y4.basename(__dirname)==="dist"&&(s=Y4.dirname(__dirname));let o;try{o=age.readFileSync(Y4.join(s,"dist","debugServer.html"))}catch(a){o=a.toString()}n.write(o),n.end()})}static{l(this,"DebugServer")}wrapStdout(t){return new cge.Writable({write:(n,s,o)=>(this.stdoutEmitter.emit("data",n),t.write(n,s,o))})}listen(){return this.server.listen(this.port),this}};function sge(e,t){e.write("data: "+t.toString().replace(/\n/g,`
data: `)+`
`)}l(sge,"writeData");var il=class e{constructor(t){this.conn=t}static{l(this,"WrappedConnection")}static from(t,r,n){let s=n,o=parseInt(process.env.GH_COPILOT_DEBUG_UI_PORT);if(!isNaN(o))try{s=new VI(o).listen().wrapStdout(n)}catch(c){new Cs(2,"agent").error(t,`Failed to start debug server on port ${o} (maybe it's in use?)`,c)}if(t.get(Td).flags.recordInput){let c=Date.now().toString(),u=`stdin${c}.log`;r.on("data",d=>{(0,mH.appendFile)(u,d,p=>{p&&console.error(p)})});let f=`stdout${c}.log`;s=Pet(s,d=>{(0,mH.appendFile)(f,d,p=>{p&&console.error(p)})})}let a=(0,cm.createConnection)(cm.ProposedFeatures.all,new cm.StreamMessageReader(r),new cm.StreamMessageWriter(s));return new e(a)}listen(){this.conn.listen()}};function Pet(e,t){return new uge.Writable({write:(n,s,o)=>(t(n.toString()),e.write(n,s,o))})}l(Pet,"wrapWritableStream");var GI=new fge.ProgressType,zI=class extends Sf{constructor(r){super();this.ctx=r}static{l(this,"AgentConversationProgress")}async begin(r,n,s){await this.ctx.get(il).conn.sendProgress(GI,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(il).conn.sendProgress(GI,s,{kind:"report",conversationId:r.id,turnId:n.id,reply:o})}async end(r,n,s,o,a,c,u){await this.ctx.get(il).conn.sendProgress(GI,s,{kind:"end",conversationId:r.id,turnId:n.id,followUps:a||[],skillResolutions:c||[],updatedDocuments:u||[],error:o})}async cancel(r,n,s,o){await this.ctx.get(il).conn.sendProgress(GI,s,{kind:"end",conversationId:r.id,turnId:n.id,followUps:[],cancellationReason:"CancelledByUser",error:o})}};var hge=hr(jy()),mge=hr(lm()),gge=hr(I5());var dge=hr(jy());var X4=class extends Error{static{l(this,"SchemaValidationError")}constructor(t){super(pge(t))}};function bn(e,t){let r=dge.TypeCompiler.Compile(e);return async(n,s,o)=>{if(!r.Check(o)){let a=pge(r.Errors(o));return[null,{code:-32602,message:a}]}return t(n,s,o)}}l(bn,"addMethodHandlerValidation");function pge(e){return`Schema validation failed with the following errors:
${Array.from(e).map(r=>`- ${r.path}: ${r.message}`).join(`
`)}`}l(pge,"createErrorMessage");var uu=class{constructor(t,r,n){this.ctx=t;this.skillId=r;this.requestType=new mge.ProtocolRequestType("conversation/context");this.typeCheck=hge.TypeCompiler.Compile(n)}static{l(this,"AgentSkillResolver")}async resolveSkill(t){let r=this.ctx.get(il).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 gge.ResponseError(c.code,c.message,c.data);La.error(this.ctx,`ResponseError while resolving skill ${this.skillId}`,u);return}s=a}catch(o){La.error(this.ctx,`Error while resolving skill ${this.skillId}`,o);return}if(s!=null){if(!this.typeCheck.Check(s))throw new X4(this.typeCheck.Errors(s));return s}}};var gH=hr(Gi());var yH=class{constructor(t,r,n=[],s=[],o=[]){this.workDoneToken=t;this.chunks=r;this.followUps=n;this.skills=s;this.references=o}static{l(this,"SyntheticTurn")}},mp=class{constructor(){this.turns=[]}static{l(this,"SyntheticTurns")}add(t,r,n=[],s=[],o=[]){this.turns.push(new yH(t,r,n,s,o))}get(t){return this.turns.find(r=>r.workDoneToken===t)}},WI=class{constructor(t,r,n){this.ctx=t;this.conversation=r;this.turn=n;this.conversationProgress=t.get(Sf)}static{l(this,"SyntheticTurnProcessor")}async process(t,r){try{let n=this.ctx.get(mp)?.get(t);await this.processWithSyntheticTurns(n,t,r)}catch(n){La.error(this.ctx,`Error processing turn ${this.turn.id}`,n);let s=n.message;this.turn.status="error",this.turn.response={message:s,type:"meta"},await this.conversationProgress.end(this.conversation,this.turn,t,{message:s,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(p0).getCapabilities(this.conversation.id),o=t.skills.filter(c=>s.skills.includes(c)),a=new cp(this.ctx,this.conversation,this.turn);for(let c of o){let f=await new uu(this.ctx,c,gH.Type.Object({value:gH.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:Ea()}));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)}};function yge(e){Oet(e),ket(e)}l(yge,"activateConversationFeature");function Oet(e){e.set(p0,new p0(e)),e.set(od,new od),e.set(vc,new vc(e)),e.set(mp,new mp),e.set(U0,new U0(e)),e.set(Sf,new zI(e))}l(Oet,"registerContextDependencies");function ket(e){let t=new fl;t.registerSkill(new qw("w")),t.registerSkill(new Cw(new uu(e,Xh,C1e),"x")),t.registerSkill(new xw(new uu(e,lu,b1e),"y")),t.registerSkill(new Ew("z")),t.registerSkill(new Uw(new uu(e,jw,V1e),"a")),t.registerSkill(new Mw(new uu(e,Fw,U1e),"b")),t.registerSkill(new Bw(new uu(e,Zh,j1e),"c")),t.registerSkill(new Hw(new uu(e,$w,z1e),"d")),t.registerSkill(new Dw(new uu(e,Lw,q1e),"e")),t.registerSkill(new Gw(new uu(e,ad,K1e),"f")),t.registerSkill(new zw(new uu(e,g5,X1e),"g")),e.set(fl,t)}l(ket,"registerSkills");var Uc=class extends ka{static{l(this,"CopilotCompletionCache")}constructor(t=100){super(t)}};var KI=class{constructor(){this._resolve=()=>{};this._reject=()=>{};this.promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}static{l(this,"Deferred")}resolve(t){this._resolve(t)}reject(t){this._reject(t)}};var _1=class{constructor(){this.capabilities=new KI}static{l(this,"CopilotCapabilitiesProvider")}setCapabilities(t){this.capabilities
Assume there is a function echo(String echo).
Write a unit test that ensures the method does not echo insults or bad words like "asshole", "idiot", "moron" and so on.
Come up with a comprehensive list of examples that cover the most used insults.
`}},Uet=new CH,EH=class{constructor(){this.id="debug.dump";this.description="Dump the conversation";this.shortDescription="Dump";this.scopes=["chat-panel"]}static{l(this,"DebugDumpPromptTemplate")}async response(t,r,n){return await D1e(t,r,n)}},jet=new EH,TH=class{constructor(){this.id="debug.tree";this.description="Jingle bells, jingle bells, jingle all the way";this.shortDescription="Christmas Tree";this.scopes=["chat-panel"]}static{l(this,"DebugChristmasTreePromptTemplate")}async requiredSkills(t){return[Xh,lu]}instructions(t,r){return"Create a function that prints a christmas tree"}},Het=new TH,SH=class{constructor(){this.id="debug.echo";this.description="Echo the user message back to the user";this.shortDescription="Echo";this.scopes=["chat-panel"]}static{l(this,"DebugEchoPromptTemplate")}async response(t,r,n){return n.request.message}},$et=new SH,wH=class{constructor(){this.id="debug.prompt";this.description="Show the prompt for the last response or generate a new one";this.shortDescription="Prompt";this.scopes=["chat-panel"]}static{l(this,"DebugPromptPromptTemplate")}async response(t,r,n){let s;return n.request.message!==""?s=await L1e(t,r,n):s=await M1e(t,r,n),s??"No prompt available"}},Vet=new wH,IH=class{constructor(){this.id="debug.skills";this.description="Resolves and displays all available skills or a single skill (id) if provided";this.shortDescription="Skills";this.scopes=["chat-panel"]}static{l(this,"DebugSkillsPromptTemplate")}async response(t,r,n,s){let o=s.length>0?s:void 0;return F1e(t,r,n,o)}},Get=new IH;function kge(){return[qet,Uet,Het,jet,$et,Vet,Get]}l(kge,"getDebugTemplates");var R5=class{constructor(t,r,n,s,o=[],a=[],c){this.id=t;this.description=r;this.shortDescription=n;this.prompt=s;this.skills=o;this.scopes=a;this.inlinePrompt=c}static{l(this,"StaticPromptTemplate")}instructions(t,r,n="panel"){let s;return n==="inline"?s=this.inlinePrompt??this.prompt:s=this.prompt,s+`
`+r}async requiredSkills(t){return this.skills}},zet=new R5("tests","Generate unit tests","Generate Tests",E1.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.
`,[ad,g5],["editor","chat-panel"]),Wet=new R5("simplify","Simplify the code","Simplify This",E1.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"],E1.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.`),Ket=new R5("fix","Fix problems and compile errors","Fix This",E1.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.`,[Zh],["editor","chat-panel"]),Yet=new R5("explain","Explain how the code works","Explain This",E1.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"]),Xet=new R5("doc","Document the current selection of code","Generate Docs",E1.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"],E1.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.)`),AH=class{constructor(){this.id="feedback";this.description="Steps to provide feedback";this.shortDescription="Feedback";this.scopes=["chat-panel"]}static{l(this,"FeedbackPromptTemplate")}async response(t,r){let n=oU(r),s=E1.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?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}
\`\`\``:s}},Qet=new AH;function hx(){return[zet,Wet,Ket,Yet,Xet,Qet,...kge()]}l(hx,"getPromptTemplates");function Nge(e){let t=hx();return!T9(e)&&!$c(e)&&(t=t.filter(r=>!r.id.startsWith("debug."))),t}l(Nge,"getUserFacingPromptTemplates");var tA=class{constructor(t,r){this.ctx=t;this.chatFetcher=r}static{l(this,"ConversationFollowUp")}async followUp(t,r,n){let s=n?{...n}:{};s.messageSource="chat.followup";let o={maxTokens:(await M6(this.ctx)).maxRequestTokens},a=await this.ctx.get(vc).toPrompt(t,o,"followup");La.debug(this.ctx,"Conversation.followup",JSON.stringify(a));let c={model:(await M6(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"?(La.error(this.ctx,"successMultiple response is unexpected for followup"),[]):(La.error(this.ctx,`Failed to fetch followups due to reason ${u.reason}`),[])}};var Z4=class{constructor(t,r,n,s,o){this.ctx=t;this.conversation=r;this.turn=n;this.chatFetcher=s;this.computeFollowup=o}static{l(this,"ChatFetchResultPostProcessor")}async postProcess(t,r,n,s,o,a,c){switch(l1e(this.ctx,c??"conversationPanel",o,t.type=="offTopic",a,s),t.type){case"success":return await this.processSuccessfulFetchResult(n,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"},{error:this.turn.response};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",{error:{message:"Oops, no response has returned.",responseIsFiltered:!1}}}}async processSuccessfulFetchResult(t,r,n,s,o){if(t&&t.length>0){let a=p5(this.turn.id);this.turn.status="success",this.turn.response={message:t,type:"model"},a.markAsDisplayed();let c=c1e(this.ctx,this.conversation,o??"conversationPanel",t,r,s,a);return{followups:this.computeFollowup?await this.computeFollowups(n,{messageId:c},s):[]}}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}}async computeFollowups(t,r,n){let a=(await new tA(this.ctx,this.chatFetcher).followUp(this.conversation,t,r)).map(c=>this.enrichFollowup(c,r,n));return La.debug(this.ctx,"Computed followups",a),a}enrichFollowup(t,r,n){let s=r??{};return s.suggestionId=Ea(),s.suggestionType="Follow-up from model",f1e(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=p5(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(),u1e(this.ctx,this.conversation,n??"conversationPanel",o,t.properties.messageId,r,s),{followups:[]}}};var Jet="Please open a file and select code for the inline chat to be available",rA=class{constructor(t,r,n,s){this.ctx=t;this.conversation=r;this.turn=n;this.chatFetcher=s;this.conversationProgress=t.get(Sf),this.chatFetcher=this.chatFetcher??new fm(t),this.postProcessor=new Z4(t,r,n,this.chatFetcher,!1)}static{l(this,"InlineTurnProcessor")}async process(t,r,n,s){try{await this.processWithModel(t,r,n,s)}catch(o){La.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,responseIsIncomp
`).map(d=>f+d).join(`
`),o=r.getText().replace(u,s),o&&La.debug(this.ctx,"Conversation.documentDiff",JSON.stringify({original:r.getText(),updated:o})),{uri:r.uri.fsPath,text:o}}}};var nA=class{constructor(t,r,n,s=!0,o){this.ctx=t;this.conversation=r;this.turn=n;this.computeFollowup=s;this.chatFetcher=o;this.conversationProgress=t.get(Sf),this.chatFetcher=this.chatFetcher??new fm(t),this.postProcessor=new Z4(t,r,n,this.chatFetcher,this.computeFollowup??!0)}static{l(this,"ModelTurnProcessor")}async process(t,r,n,s){try{await this.processWithModel(t,r,n,s)}catch(o){La.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=p5(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?.response){let p=await a.response(this.ctx,this.conversation,this.turn,c);this.turn.response={type:"meta",message:p},this.turn.status="success",await this.conversationProgress.report(this.conversation,this.turn,t,p),await this.conversationProgress.end(this.conversation,this.turn,t);return}await this.collectSkillsToUse(r,o,a);let u=await this.buildConversationPrompt(),f="";if(n?(this.turn.request.type="follow-up",f=hw(this.ctx,this.conversation,"conversationPanel",this.turn.request.message,u.tokens,n.type,n.id,s,o),o=w4(this.conversation,"conversationPanel",this.turn.request.message.length,u.tokens,n.type,n.id,o)):(o=w4(this.conversation,"conversationPanel",this.turn.request.message.length,u.tokens,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,{messageId:f,messageSource:"chat.user"});await this.conversationProgress.end(this.conversation,this.turn,t,d.error,d.followups,u.skillResolutions)}determineAndApplyTemplateUsed(){let t;if(!t&&this.turn.request.message.startsWith("/")){let n=this.getTemplateIdFromRequest(this.turn.request.message);t=hx().find(s=>s.id===n)}let r=this.getUserSpecificPartForTemplateRequest(this.turn.request.message)??"";if(t){let n=t.instructions?t.instructions(this.ctx,r):r;this.turn.request={message:n,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 O4(this.ctx,this.chatFetcher).collectTurnSkills(this.ctx,this.conversation,t,r,n);this.turn.skills=o.map(a=>({skillId:a}))}async buildConversationPrompt(){let t={maxTokens:(await Dc(this.ctx)).maxRequestTokens},r=await this.ctx.get(vc).toPrompt(this.conversation,t);return La.debug(this.ctx,"Conversation.prompt",JSON.stringify(r)),r}async fetchConversationResponse(t,r,n,s,o,a){n.onCancellationRequested(async()=>{await this.conversationProgress.cancel(this.conversation,this.turn,r)});let c=new J4(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 Dc(this.ctx)).model,messages:t,uiKind:"conversationPanel",intentParams:{intent:!0,intent_threshold:.9,intent_content:this.turn.request.message},telemetryProperties:o},f=await this.chatFetcher.fetchResponse(u,n,async d=>c.isFinishedAfterText(d));return await this.postProcessor.postProcess(f,n,c.appliedText,s,this.turn.request.message,a)}};var Zet=j0.Type.Object({request:j0.Type.String(),response:j0.Type.Optional(j0.Type.String())}),ett=j0.Type.Object({workDoneToken:j0.Type.Union([j0.Type.String(),j0.Type.Number()]),turns:j0.Type.Array(Zet,{minItems:1}),options:j0.Type.Optional(wa
`).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(Wge,"normalizeIndentCharacter");function Yge(e,t,r,n,s,o,a){let c=e.get(u0),u=n.lineAt(s),f=t.map(d=>{let p,h="";if(o&&(d.completion=Wge(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:Ea(),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(Yge,"completionsFromGhostTextResults");var OH=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),Ctt=Object.freeze({isCancellationRequested:!1,onCancellationRequested:()=>({dispose:()=>{}})}),Ett=Object.freeze({isCancellationRequested:!0,onCancellationRequested:OH}),gx=class{constructor(){this._isCancelled=!1;this.handlers=[]}static{l(this,"MutableToken")}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?OH(t,r):(this.handlers.push(t.bind(r)),{dispose:()=>{}})}dispose(){this.handlers=[]}},ry=class{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)})}static{l(this,"MergedToken")}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?OH(t,r):(this.handlers.push(t.bind(r)),{dispose:()=>{}})}},ny=class{constructor(t){this._token=void 0;this._parentListener=void 0;this._parentListener=t&&t.onCancellationRequested(this.cancel,this)}static{l(this,"CancellationTokenSource")}get token(){return this._token||(this._token=new gx),this._token}cancel(){this._token?this._token instanceof gx&&this._token.cancel():this._token=Ett}dispose(t=!1){t&&this.cancel(),this._parentListener&&this._parentListener.dispose(),this._token?this._token instanceof gx&&this._token.dispose():this._token=Ctt}};function oA(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(oA,"parseChallengeDoc");var iy=hr(Gi());var Ttt=iy.Type.Object({documents:iy.Type.Array(iy.Type.String()),options:iy.Type.Optional(iy.Type.Object({}))}),sy=class{constructor(t){this.documents=t}static{l(this,"CompletionDocuments")}};async function Stt(e,t,r){return e.forceSet(sy,new sy(r.documents)),["OK",null]}l(Stt,"handleTestingSetCompletionDocumentsChecked");var Xge=bn(Ttt,Stt);var Jge=sl.Type.Object({doc:sl.Type.Object({position:sl.Type.Object({line:sl.Type.Number({minimum:0}),character:sl.Type.Number({minimum:0})}),insertSpaces:sl.Type.Optional(sl.Type.Boolean()),tabSize:sl.Type.Optional(sl.Type.Number()),uri:sl.Type.String(),version:sl.Type.Number(),ifInserted:sl.Type.Optional(sl.Type.Object({text:sl.Type.String(),end:sl.Type.Optional(sl.Type.Object({line:sl.Type.Number({minimum:0}),character:sl.Type.Number({minimum:0})}))}))}),options:sl.Type.Optional(wa)}),Zge=new Cs(0,"getCompletions"),yx;async function e5e(e,t,r,n){let s=as.createAndMarkAsIssued();yx&&(yx.cancel(),yx.dispose()),yx=new ny;let o=new ry([t,yx.token]),a;try{a=e.get(sy)}catch{}if(a){let x=n?3:1;return[{completions:a.documents.slice(0,x).map(S=>{let{cursorLine:R,lines:k,start:V,end:le}=oA(S,r.doc.position),we=[R.slice(Math.min(V.character,r.doc.position.character))].concat(k.slice(r.doc.position.line+1)).join(`
`);return{uuid:Ea(),text:we,displayText:we,position:r.doc.position,range:{start:V,end:le},docVersion:r.doc.version}})},null]}let c=Qge.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(Ba).setInactive(u.reason),[{completions:[],cancellationReason:"CopilotNotAvailable"},null];let f=u.document;if(f.version!==r.doc.version)return wtt(e,o,f,r),[{completions:[],cancellationReason:"DocumentVersionMismatch"},null];let d=Itt(e,s,f,r.doc.position,r.doc.ifInserted);Att(e,f,d);let p=await Ott(e,f,d,n,s,o),h=await Pce(e,p);if(!h)return[{completions:[],...Ptt(p)},null];let[m,g]=h,y=Yge(e,m,g,f,d,r.doc),v=e.get(Uc);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(e5e,"handleGetCompletionsHelper");async function wtt(e,t,r,n){t.isCancellationRequested||(Rtt(e,r,n.doc.version),Zge.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(wtt,"raiseVersionMismatchIfNotCanceled");function Itt(e,t,r,n,s){let o=r.offsetAt(e.get(u0).position(n.line,n.character)),a=r.positionAt(o);if(s&&s.text.length>0&&r instanceof gp){let c=s.end??n;r.update([{range:{start:n,end:c},text:s.text}],r.version),a=r.positionAt(o+s.text.length),t.properties.completionsActive="true"}return a}l(Itt,"positionAndContentForCompleting");function Att(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}});Zge.debug(e,`Requesting completion at position ${r.line}:${r.character}, between ${JSON.stringify(n)} and ${JSON.stringify(s)}.`)}l(Att,"logCompletionLocation");async function Rtt(e,t,r){let n=as.createAndMarkAsIssued({languageId:String(t.languageId),requestedDocumentVersion:String(r),actualDocumentVersion:String(t.version)});pn(e,"getCompletions.docVersionMismatch",n)}l(Rtt,"telemetryVersionMismatch");function Ptt(e){switch(e.type){case"abortedBeforeIssued":case"canceled":return{cancellationReason:"RequestCancelled"};case"failed":return{cancellationReason:"OtherFailure"};default:return}}l(Ptt,"cancellationReason");async function Ott(e,t,r,n,s,o){try{return await fue(e,t,r,n,s,o)}catch(a){if(Xu(a))return{type:"canceled",reason:"aborted at unknown location",telemetryData:ed(s,{cancelledNetworkRequest:!0})};throw a}}l(Ott,"getGhostTextWithAbortHandling");var t5e=b0(bn(Jge,(e,t,r)=>e5e(e,t,r,!1))),r5e=b0(bn(Jge,(e,t,r)=>e5e(e,t,r,!0)));var vp=hr(Gi()),u5e=hr(Ay());var cA=hr(lm()),DH=hr(Q0());function n5e(e){switch(e){case 2:return"open copilot";default:return"unknown"}}l(n5e,"completionTypeToString");var kH=class e{constructor(t,r,n){this.prependToCompletion="";this.appendToCompletion="";this.indentation=null;this.completionType=2;this.insertPosition=t.get(u0).position(r.line,r.character),this.completionType=n}static{l(this,"CompletionContext")}static fromJSONParse(t,r){let n=t.get(u0).position(r.insertPosition.line,r.insertPosition.character),s=new e(t,n,r.completionType);return s.prependToCompletion=r.prependToCompletion,s.appendToCompletion=r.appendToCompletion,s.indentation=r.indentation,s}};function i5e(e,t,r){let n=r,s=t.lineAt(r.line);return s.isEmptyOrWhitespace||(n=s.range.end),new kH(e,n,2)}l(i5e,"completionContextForDocument");var aA=new Cs(1,"solutions");async function*ktt(e,t){for await(let r of e){let n={...r};n.completionText=t+n.completionText.trimRight(),yield n}}l(ktt,"prependChoices");var lA=class{constructor(t,r,n){this.completionContext=t;this.startPosition=r;this.solutionCountTarget=n}static{l(this,"ISolutionManager")}get savedTelemetryData(){return this._savedTelemetryData}set savedTelemetryData(t){this._savedTelemetryData=t}};function s5e(e){return e.replace(/\s+/g,"")}l(s5e,"normalizeCompletionText");async function o5e(e,t){let r=t.completionContext.
`,`\r
\r
`]);let k={prompt:y,languageId:a.languageId,repoInfo:d,ourRequestId:h,engineUrl:await tS(e,t.savedTelemetryData),count:t.solutionCountTarget,uiKind:"synthesize",postOptions:R,requestLogProbs:!0},V;switch(x){case"server":V=l(async j=>{},"finishedCb"),R.extra.force_indent=S.prev??-1,R.extra.trim_by_indentation=!0;break;case"parsingandserver":V=b?s6(e,a,t.startPosition):async j=>{},R.extra.force_indent=S.prev??-1,R.extra.trim_by_indentation=!0;break;case"parsing":default:V=b?s6(e,a,t.startPosition):async j=>{};break}e.get(Ba).setProgress();let le=t.savedTelemetryData,we=await e.get(Kd).fetchAndStreamCompletions(e,k,le.extendedBy(),V,_);if(we.type==="failed"||we.type==="canceled")return t.reportCancelled(),e.get(Ba).removeProgress(),{status:"FinishedWithError",error:`${we.type}: ${we.reason}`};let xe=we.choices;xe=ktt(xe,n),s!==null&&(xe=_ce(xe,s)),xe=Kg(xe,async j=>fS(e,a,r,j,!1,aA,g.prompt,f));let re=Kg(xe,async j=>{let z=j.completionText;if(aA.info(e,`Open Copilot completion: [${j.completionText}]`),t.completionContext.completionType===2){let Q="",ie=await Sce(e,a,r,j.completionText);if(ie)[Q]=l6(a.getText(o.range(o.position(ie.line,ie.character),r)));else{let Mt=o.position(r.line,0);Q=a.getText(o.range(Mt,r))}z=Q+z}let de=j.completionText;v.length>0&&de.startsWith(v)&&(de=de.substring(v.length));let Ve=j.meanLogProb,je=Ve!==void 0?Math.exp(Ve):0,dr=(await t.getDocument()).version,Se=le.extendedBy({choiceIndex:j.choiceIndex.toString()});return{displayText:z,meanProb:je,meanLogProb:Ve||0,completionText:de,requestId:j.requestId,choiceIndex:j.choiceIndex,prependToCompletion:n,docVersion:dr,telemetryData:Se}});return a5e(e.get(Ba),_,re[Symbol.asyncIterator]())}l(o5e,"launchSolutions");async function a5e(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:a5e(e,t,r)}}l(a5e,"generateSolutionsStream");var dm=hr(Gi());var Ntt=dm.Type.Object({text:dm.Type.String(),score:dm.Type.Number()}),Dtt=dm.Type.Object({documents:dm.Type.Array(Ntt),options:dm.Type.Optional(dm.Type.Object({}))}),oy=class{constructor(t){this.documents=t}static{l(this,"PanelCompletionDocuments")}};async function Ltt(e,t,r){return e.forceSet(oy,new oy(r.documents)),["OK",null]}l(Ltt,"handleTestingSetPanelCompletionDocumentsChecked");var l5e=bn(Dtt,Ltt);var Mtt=vp.Type.Object({doc:vp.Type.Object({position:vp.Type.Object({line:vp.Type.Number({minimum:0}),character:vp.Type.Number({minimum:0})}),uri:vp.Type.String(),version:vp.Type.Number()}),panelId:vp.Type.String(),options:vp.Type.Optional(wa)});function Ftt(e,t,r,n,s){let o=s5e(s.completionText),a=(0,u5e.SHA256)(o).toString();return e.get(Uc).set(a,{displayText:s.displayText,text:s.completionText,offset:n,uuid:a,range:r,file:DH.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(Ftt,"makeSolution");var NH=class extends lA{constructor(r,n,s,o,a){super(s,n,o);this.textDocument=r,this.cancellationToken=a}static{l(this,"AgentSolutionManager")}reportCancelled(){}getCancellationToken(){return this.cancellationToken}async getDocument(){return this.textDocument}};async function f5e(e,t,r,n,s){let o=e.get(_0),a=await s;switch(a.status){case"Solution":o.sendNotification(new cA.NotificationType("PanelSolution"),Ftt(e,t,r,n,a.solution)),await f5e(e,t,r,n,a.next);break;case"FinishedNormally":await d5e(t.panelId,o);break;case"FinishedWithError":o.sendNotification(new cA.NotificationType("PanelSolutionsDone"),{status:"Error",message:a.error,panelId:t.panelId});break}}l(f5e,"reportSolutions");async function d5e(e,t){t.sendNotification(new cA.NotificationType("PanelSolutionsDone"),{status:"OK",panelId:e})}l(d5e,"reportDone");var vx;async function Btt(e,t,r){vx&&(vx.cancel(),vx.dispose()),vx=new ny;let n=new ry([t,vx.token]),s,o
`);return a=_.slice(0,r.doc.position.line).reduce((R,k)=>R+k.length+1,0)+x.character,{status:"Solution",solution:{requestId:{headerRequestId:d,completionId:Ea(),created:0,serverExperiments:"",deploymentId:""},completionText:b,displayText:b,meanProb:y,meanLogProb:-1,choiceIndex:m,prependToCompletion:"",docVersion:r.doc.version,telemetryData:e1.createEmptyConfigForTesting()},next:h(m+1)}},"getNextSolution");o=r.doc.position,s=h(0)}else{let d=DH.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 c5e(e,r);let h=p.document;if(h.version!==r.doc.version)return new Cs(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}.`),c5e(e,r);a=h.offsetAt(e.get(u0).position(r.doc.position.line,r.doc.position.character)),o=h.positionAt(a);let m=i5e(e,h,o),g=new NH(h,o,m,c,n);s=o5e(e,g)}let f=e.get(u0).range(o,o);return setImmediate(()=>f5e(e,r,f,a,s)),[{solutionCountTarget:c},null]}l(Btt,"handleGetPanelCompletionsChecked");function c5e(e,t){return d5e(t.panelId,e.get(_0)),[{solutionCountTarget:0},null]}l(c5e,"produceEmptySolutions");var p5e=b0(bn(Mtt,Btt));var h5e=hr(Gi());var qtt=h5e.Type.Object({});async function Utt(e,t,r){return[{version:M2(e),buildType:L2(e),runtimeVersion:`node/${process.versions.node}`},null]}l(Utt,"handleGetVersionChecked");var m5e=bn(qtt,Utt);var g5e=hr(Gi());function LH(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 ay(s)}l(LH,"asReadableCert");function ay(e){return e.replace(/\s/g,"")}l(ay,"normalizeNewlines");var jtt=g5e.Type.Object({});async function Htt(e){return[{certificates:(await e.get(Gl).getAllRootCAs()).map(ay)},null]}l(Htt,"handleListCertificatesChecked");var y5e=bn(jtt,Htt);var ly=hr(Gi());var P5=class{constructor(t,r,n){this._referenceCount=0;this._isDisposed=!1;this._offset=n;let s=t.get(qo);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}}})}static{l(this,"ChangeTracker")}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)}};function v5e(e,t){return e.compType==="partial"?e.acceptedLength:t.length}l(v5e,"computeCompCharLen");function x5e(e,t){return t.compType==="partial"?e.substring(0,t.acceptedLength):e}l(x5e,"computeCompletionText");var O5=new Cs(1,"post-insertion"),b5e=[{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}],$tt=50,Vtt=1500,Gtt=.5,ztt=500,MH={triggerPostInsertionSynchroneously:!1,captureCode:!1,captureRejection:!1};async function C5e(e,t,r,n,s){let o=await e.get(qo).getTextDocument(t);if(!o)return O5.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 e4(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=eB(c,n,o.languageId),g=await wce(h,void 0)(p),y=Math.min(a.length,n+(g?g*2:ztt)),v=a.substring(n,y);return{prompt:d,capturedCode:v,terminationOffset:g??-1}}}l(C5e,"captureCode");function E5e(e,t,r,n,s){s.forEach(({completionText:c,completionTelemetryData:u}
/*! 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