@github/copilot-language-server 1.315.0 → 1.316.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -220,7 +220,7 @@ ${hZ(l)}`:i.stack+=`
220
220
  `.length).split(`
221
221
  `);/^\s*(?:at )?(?:\w+\.)*_telemetryException\b/.test(x[0]??"")&&x.shift(),/^\s*(?:at )?(?:\w+\.)*telemetryException\b/.test(x[0]??"")&&x.shift(),a.stack=`${a}
222
222
  ${x.join(`
223
- `)}`}}let l=e.get(dn).getEditorInfo(),c;l.root&&(c=[{prefix:`${l.name}:`,path:l.root}]);let u=AZ(a,c),f=nN(e),m=unt(a),h=m==="exception",p=cn.createAndMarkAsIssued({origin:n??"",type:a.name,code:`${a.code??""}`,reason:u.stack||u.toString(),message:u.message,...i});if(await p.makeReadyForSending(e,0,"IncludeExp",r),s?.exception_detail)for(let x of s.exception_detail)x.value&&(f?x.value=pZ(x.value):x.value="[redacted]");if(s??=L5e(e,AZ(a,c,f)),s.context={...s.context,"copilot_event.unique_id":p.properties.unique_id,"#restricted_telemetry":f?"true":"false"},n&&(s.context["#origin"]=n,s.transaction=n),s.rollup_id!=="auto"&&(p.properties.errno=s.rollup_id),s.created_at=new Date(p.issuedTime).toISOString(),f){let x=V5e(a,c),v=cn.createAndMarkAsIssued({origin:n??"",type:a.name,code:`${a.code??""}`,reason:x.stack||x.toString(),message:x.message,...i});s.rollup_id!=="auto"&&(v.properties.errno=s.rollup_id),await v.makeReadyForSending(e,1,"IncludeExp",r),v.properties.unique_id=p.properties.unique_id,p.properties.restricted_unique_id=v.properties.unique_id,Sw(e,1,`error.${m}`,v)}let g=s.rollup_id==="auto"?a.stack??"":s.rollup_id;h&&!e.get(Lp).isThrottled(g)&&(p.properties.failbot_payload=JSON.stringify(s)),Sw(e,0,`error.${m}`,p)}o(nCe,"_telemetryException");function Vu(e,t,r,n){let i=o(async(...s)=>{try{await t(...s)}catch(a){await nCe(e,a,Xs(),r,n)}},"wrapped");return(...s)=>e.get(Bo).register(i(...s))}o(Vu,"telemetryCatch");function bx(e,t,r,n){return e.get(Bo).register(Ant(e,t,Xs(),r?.extendedBy(),n))}o(bx,"telemetryError");async function Ant(e,t,r,n,i=0){if(yI(i)&&!nN(e))return;let s=n||cn.createAndMarkAsIssued({},{});await s.makeReadyForSending(e,i,"IncludeExp",r),fnt(e,i,t,s)}o(Ant,"_telemetryError");function iCe(e,t,r,n,i){let s=cn.createAndMarkAsIssued({completionTextJson:JSON.stringify(t),choiceIndex:i.toString()});if(r.logprobs)for(let[a,l]of Object.entries(r.logprobs))s.properties["logprobs_"+a]=JSON.stringify(l)??"unset";return s.extendWithRequestId(n),jt(e,"engine.completion",s,1)}o(iCe,"logEngineCompletion");function oCe(e,t,r){let n;t.isFimEnabled?n={promptPrefixJson:JSON.stringify(t.prefix),promptSuffixJson:JSON.stringify(t.suffix)}:n={promptJson:JSON.stringify(t.prefix)};let i=r.extendedBy(n);return jt(e,"engine.prompt",i,1)}o(oCe,"logEnginePrompt");var dd=class e{static{o(this,"ExpConfig")}constructor(t,r,n){this.variables=t,this.assignmentContext=r,this.features=n}static createFallbackConfig(t,r){return iN(t,{reason:r}),this.createEmptyConfig()}static createEmptyConfig(){return new e({},"","")}addToTelemetry(t){t.properties["VSCode.ABExp.Features"]=this.features,t.properties["abexp.assignmentcontext"]=this.assignmentContext}};d();d();d();var uCe=require("os"),sN=require("path");d();var lCe;(()=>{"use strict";var e={975:W=>{function q(H){if(typeof H!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(H))}o(q,"e");function oe(H,O){for(var V,J="",ae=0,te=-1,le=0,ce=0;ce<=H.length;++ce){if(ce<H.length)V=H.charCodeAt(ce);else{if(V===47)break;V=47}if(V===47){if(!(te===ce-1||le===1))if(te!==ce-1&&le===2){if(J.length<2||ae!==2||J.charCodeAt(J.length-1)!==46||J.charCodeAt(J.length-2)!==46){if(J.length>2){var Pe=J.lastIndexOf("/");if(Pe!==J.length-1){Pe===-1?(J="",ae=0):ae=(J=J.slice(0,Pe)).length-1-J.lastIndexOf("/"),te=ce,le=0;continue}}else if(J.length===2||J.length===1){J="",ae=0,te=ce,le=0;continue}}O&&(J.length>0?J+="/..":J="..",ae=2)}else J.length>0?J+="/"+H.slice(te+1,ce):J=H.slice(te+1,ce),ae=ce-te-1;te=ce,le=0}else V===46&&le!==-1?++le:le=-1}return J}o(oe,"r");var X={resolve:o(function(){for(var H,O="",V=!1,J=arguments.length-1;J>=-1&&!V;J--){var ae;J>=0?ae=arguments[J]:(H===void 0&&(H=process.cwd()),ae=H),q(ae),ae.length!==0&&(O=ae+"/"+O,V=ae.charCodeAt(0)===47)}return O=oe(O,!V),V?O.length>0?"/"+O:"/":O.length>0?O:"."},"resolve"),normalize:o(function(H){if(q(H),H.length===0)return".";var O=H.charCodeAt(0)===47,V=H.charCodeAt(H.length-1)===47;return(H=oe(H,!O)).length!==0||O||(H="."),H.length>0&&V&&(H+="/"),O?"/"+H:H},"normalize"),isAbsolute:o(function(H){return q(H),H.length>0&&H.charCodeAt(0)===47},"isAbsolute"),join:o(function(){if(arguments.length===0)return".";for(var H,O=0;O<arguments.length;++O){var V=arguments[O];q(V),V.length>0&&(H===void 0?H=V:H+="/"+V)}return H===void 0?".":X.normalize(H)},"join"),relative:o(function(H,O){if(q(H),q(O),H===O||(H=X.resolve(H))===(O=X.resolve(O)))return"";for(var V=1;V<H.length&&H.charCodeAt(V)===47;++V);for(var J=H.length,ae=J-V,te=1;te<O.length&&O.charCodeAt(te)===47;++te);for(var le=O.length-te,ce=ae<le?ae:le,Pe=-1,Ie=0;Ie<=ce;++Ie){if(Ie===ce){if(le>ce){if(O.charCodeAt(te+Ie)===47)return O.slice(te+Ie+1);if(Ie===0)return O.slice(te+Ie)}else ae>ce&&(H.charCodeAt(V+Ie)===47?Pe=Ie:Ie===0&&(Pe=0));break}var Fe=H.charCodeAt(V+Ie);if(Fe!==O.charCodeAt(te+Ie))break;Fe===47&&(Pe=Ie)}var Re="";for(Ie=V+Pe+1;Ie<=J;++Ie)Ie!==J&&H.charCodeAt(Ie)!==47||(Re.length===0?Re+="..":Re+="/..");return Re.length>0?Re+O.slice(te+Pe):(te+=Pe,O.charCodeAt(te)===47&&++te,O.slice(te))},"relative"),_makeLong:o(function(H){return H},"_makeLong"),dirname:o(function(H){if(q(H),H.length===0)return".";for(var O=H.charCodeAt(0),V=O===47,J=-1,ae=!0,te=H.length-1;te>=1;--te)if((O=H.charCodeAt(te))===47){if(!ae){J=te;break}}else ae=!1;return J===-1?V?"/":".":V&&J===1?"//":H.slice(0,J)},"dirname"),basename:o(function(H,O){if(O!==void 0&&typeof O!="string")throw new TypeError('"ext" argument must be a string');q(H);var V,J=0,ae=-1,te=!0;if(O!==void 0&&O.length>0&&O.length<=H.length){if(O.length===H.length&&O===H)return"";var le=O.length-1,ce=-1;for(V=H.length-1;V>=0;--V){var Pe=H.charCodeAt(V);if(Pe===47){if(!te){J=V+1;break}}else ce===-1&&(te=!1,ce=V+1),le>=0&&(Pe===O.charCodeAt(le)?--le==-1&&(ae=V):(le=-1,ae=ce))}return J===ae?ae=ce:ae===-1&&(ae=H.length),H.slice(J,ae)}for(V=H.length-1;V>=0;--V)if(H.charCodeAt(V)===47){if(!te){J=V+1;break}}else ae===-1&&(te=!1,ae=V+1);return ae===-1?"":H.slice(J,ae)},"basename"),extname:o(function(H){q(H);for(var O=-1,V=0,J=-1,ae=!0,te=0,le=H.length-1;le>=0;--le){var ce=H.charCodeAt(le);if(ce!==47)J===-1&&(ae=!1,J=le+1),ce===46?O===-1?O=le:te!==1&&(te=1):O!==-1&&(te=-1);else if(!ae){V=le+1;break}}return O===-1||J===-1||te===0||te===1&&O===J-1&&O===V+1?"":H.slice(O,J)},"extname"),format:o(function(H){if(H===null||typeof H!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof H);return function(O,V){var J=V.dir||V.root,ae=V.base||(V.name||"")+(V.ext||"");return J?J===V.root?J+ae:J+"/"+ae:ae}(0,H)},"format"),parse:o(function(H){q(H);var O={root:"",dir:"",base:"",ext:"",name:""};if(H.length===0)return O;var V,J=H.charCodeAt(0),ae=J===47;ae?(O.root="/",V=1):V=0;for(var te=-1,le=0,ce=-1,Pe=!0,Ie=H.length-1,Fe=0;Ie>=V;--Ie)if((J=H.charCodeAt(Ie))!==47)ce===-1&&(Pe=!1,ce=Ie+1),J===46?te===-1?te=Ie:Fe!==1&&(Fe=1):te!==-1&&(Fe=-1);else if(!Pe){le=Ie+1;break}return te===-1||ce===-1||Fe===0||Fe===1&&te===ce-1&&te===le+1?ce!==-1&&(O.base=O.name=le===0&&ae?H.slice(1,ce):H.slice(le,ce)):(le===0&&ae?(O.name=H.slice(1,te),O.base=H.slice(1,ce)):(O.name=H.slice(le,te),O.base=H.slice(le,ce)),O.ext=H.slice(te,ce)),le>0?O.dir=H.slice(0,le-1):ae&&(O.dir="/"),O},"parse"),sep:"/",delimiter:":",win32:null,posix:null};X.posix=X,W.exports=X}},t={};function r(W){var q=t[W];if(q!==void 0)return q.exports;var oe=t[W]={exports:{}};return e[W](oe,oe.exports,r),oe.exports}o(r,"r"),r.d=(W,q)=>{for(var oe in q)r.o(q,oe)&&!r.o(W,oe)&&Object.defineProperty(W,oe,{enumerable:!0,get:q[oe]})},r.o=(W,q)=>Object.prototype.hasOwnProperty.call(W,q),r.r=W=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(W,"__esModule",{value:!0})};var n={};let i;r.r(n),r.d(n,{URI:o(()=>h,"URI"),Utils:o(()=>re,"Utils")}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);let s=/^\w[\w\d+.-]*$/,a=/^\//,l=/^\/\//;function c(W,q){if(!W.scheme&&q)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${W.authority}", path: "${W.path}", query: "${W.query}", fragment: "${W.fragment}"}`);if(W.scheme&&!s.test(W.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(W.path){if(W.authority){if(!a.test(W.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(l.test(W.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}o(c,"a");let u="",f="/",m=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class h{static{o(this,"l")}static isUri(q){return q instanceof h||!!q&&typeof q.authority=="string"&&typeof q.fragment=="string"&&typeof q.path=="string"&&typeof q.query=="string"&&typeof q.scheme=="string"&&typeof q.fsPath=="string"&&typeof q.with=="function"&&typeof q.toString=="function"}scheme;authority;path;query;fragment;constructor(q,oe,X,H,O,V=!1){typeof q=="object"?(this.scheme=q.scheme||u,this.authority=q.authority||u,this.path=q.path||u,this.query=q.query||u,this.fragment=q.fragment||u):(this.scheme=function(J,ae){return J||ae?J:"file"}(q,V),this.authority=oe||u,this.path=function(J,ae){switch(J){case"https":case"http":case"file":ae?ae[0]!==f&&(ae=f+ae):ae=f}return ae}(this.scheme,X||u),this.query=H||u,this.fragment=O||u,c(this,V))}get fsPath(){return b(this,!1)}with(q){if(!q)return this;let{scheme:oe,authority:X,path:H,query:O,fragment:V}=q;return oe===void 0?oe=this.scheme:oe===null&&(oe=u),X===void 0?X=this.authority:X===null&&(X=u),H===void 0?H=this.path:H===null&&(H=u),O===void 0?O=this.query:O===null&&(O=u),V===void 0?V=this.fragment:V===null&&(V=u),oe===this.scheme&&X===this.authority&&H===this.path&&O===this.query&&V===this.fragment?this:new g(oe,X,H,O,V)}static parse(q,oe=!1){let X=m.exec(q);return X?new g(X[2]||u,F(X[4]||u),F(X[5]||u),F(X[7]||u),F(X[9]||u),oe):new g(u,u,u,u,u)}static file(q){let oe=u;if(i&&(q=q.replace(/\\/g,f)),q[0]===f&&q[1]===f){let X=q.indexOf(f,2);X===-1?(oe=q.substring(2),q=f):(oe=q.substring(2,X),q=q.substring(X)||f)}return new g("file",oe,q,u,u)}static from(q){let oe=new g(q.scheme,q.authority,q.path,q.query,q.fragment);return c(oe,!0),oe}toString(q=!1){return _(this,q)}toJSON(){return this}static revive(q){if(q){if(q instanceof h)return q;{let oe=new g(q);return oe._formatted=q.external,oe._fsPath=q._sep===p?q.fsPath:null,oe}}return q}}let p=i?1:void 0;class g extends h{static{o(this,"d")}_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=b(this,!1)),this._fsPath}toString(q=!1){return q?_(this,!0):(this._formatted||(this._formatted=_(this,!1)),this._formatted)}toJSON(){let q={$mid:1};return this._fsPath&&(q.fsPath=this._fsPath,q._sep=p),this._formatted&&(q.external=this._formatted),this.path&&(q.path=this.path),this.scheme&&(q.scheme=this.scheme),this.authority&&(q.authority=this.authority),this.query&&(q.query=this.query),this.fragment&&(q.fragment=this.fragment),q}}let x={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function v(W,q,oe){let X,H=-1;for(let O=0;O<W.length;O++){let V=W.charCodeAt(O);if(V>=97&&V<=122||V>=65&&V<=90||V>=48&&V<=57||V===45||V===46||V===95||V===126||q&&V===47||oe&&V===91||oe&&V===93||oe&&V===58)H!==-1&&(X+=encodeURIComponent(W.substring(H,O)),H=-1),X!==void 0&&(X+=W.charAt(O));else{X===void 0&&(X=W.substr(0,O));let J=x[V];J!==void 0?(H!==-1&&(X+=encodeURIComponent(W.substring(H,O)),H=-1),X+=J):H===-1&&(H=O)}}return H!==-1&&(X+=encodeURIComponent(W.substring(H))),X!==void 0?X:W}o(v,"m");function E(W){let q;for(let oe=0;oe<W.length;oe++){let X=W.charCodeAt(oe);X===35||X===63?(q===void 0&&(q=W.substr(0,oe)),q+=x[X]):q!==void 0&&(q+=W[oe])}return q!==void 0?q:W}o(E,"y");function b(W,q){let oe;return oe=W.authority&&W.path.length>1&&W.scheme==="file"?`//${W.authority}${W.path}`:W.path.charCodeAt(0)===47&&(W.path.charCodeAt(1)>=65&&W.path.charCodeAt(1)<=90||W.path.charCodeAt(1)>=97&&W.path.charCodeAt(1)<=122)&&W.path.charCodeAt(2)===58?q?W.path.substr(1):W.path[1].toLowerCase()+W.path.substr(2):W.path,i&&(oe=oe.replace(/\//g,"\\")),oe}o(b,"v");function _(W,q){let oe=q?E:v,X="",{scheme:H,authority:O,path:V,query:J,fragment:ae}=W;if(H&&(X+=H,X+=":"),(O||H==="file")&&(X+=f,X+=f),O){let te=O.indexOf("@");if(te!==-1){let le=O.substr(0,te);O=O.substr(te+1),te=le.lastIndexOf(":"),te===-1?X+=oe(le,!1,!1):(X+=oe(le.substr(0,te),!1,!1),X+=":",X+=oe(le.substr(te+1),!1,!0)),X+="@"}O=O.toLowerCase(),te=O.lastIndexOf(":"),te===-1?X+=oe(O,!1,!0):(X+=oe(O.substr(0,te),!1,!0),X+=O.substr(te))}if(V){if(V.length>=3&&V.charCodeAt(0)===47&&V.charCodeAt(2)===58){let te=V.charCodeAt(1);te>=65&&te<=90&&(V=`/${String.fromCharCode(te+32)}:${V.substr(3)}`)}else if(V.length>=2&&V.charCodeAt(1)===58){let te=V.charCodeAt(0);te>=65&&te<=90&&(V=`${String.fromCharCode(te+32)}:${V.substr(2)}`)}X+=oe(V,!0,!1)}return J&&(X+="?",X+=oe(J,!1,!1)),ae&&(X+="#",X+=q?ae:v(ae,!1,!1)),X}o(_,"b");function R(W){try{return decodeURIComponent(W)}catch{return W.length>3?W.substr(0,3)+R(W.substr(3)):W}}o(R,"C");let P=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function F(W){return W.match(P)?W.replace(P,q=>R(q)):W}o(F,"w");var G=r(975);let se=G.posix||G,Ae="/";var re;(function(W){W.joinPath=function(q,...oe){return q.with({path:se.join(q.path,...oe)})},W.resolvePath=function(q,...oe){let X=q.path,H=!1;X[0]!==Ae&&(X=Ae+X,H=!0);let O=se.resolve(X,...oe);return H&&O[0]===Ae&&!q.authority&&(O=O.substring(1)),q.with({path:O})},W.dirname=function(q){if(q.path.length===0||q.path===Ae)return q;let oe=se.dirname(q.path);return oe.length===1&&oe.charCodeAt(0)===46&&(oe=""),q.with({path:oe})},W.basename=function(q){return se.basename(q.path)},W.extname=function(q){return se.extname(q.path)}})(re||(re={})),lCe=n})();var{URI:Zy,Utils:oN}=lCe;function fCe(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substring(0,3)+fCe(e.substring(3)):e}}o(fCe,"decodeURIComponentGraceful");var cCe=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function PZ(e){return e.match(cCe)?e.replace(cCe,t=>fCe(t)):e}o(PZ,"percentDecode");function al(e){if(/^[A-Za-z][A-Za-z0-9+.-]+:/.test(e))throw new Error("Path must not contain a scheme");if(!e)throw new Error("Path must not be empty");return Zy.file(e).toString()}o(al,"makeFsUri");function xI(e){if(typeof e!="string"&&(e=e.uri),/^[A-Za-z]:\\/.test(e))throw new Error(`Could not parse <${e}>: Windows-style path`);try{let t=e.match(/^(?:([^:/?#]+?:)?\/\/)(\/\/.*)$/);return t?Zy.parse(t[1]+t[2],!0):Zy.parse(e,!0)}catch(t){throw new Error(`Could not parse <${e}>`,{cause:t})}}o(xI,"parseUri");function dCe(e){return xI(e),e}o(dCe,"validateUri");function nc(e){try{return xI(e).toString()}catch{return e}}o(nc,"normalizeUri");var mCe=new Set(["file","notebook","vscode-notebook","vscode-notebook-cell"]);function wl(e){let t=xI(e);if(!mCe.has(t.scheme))throw new Error(`Unsupported scheme: ${t.scheme}`);if((0,uCe.platform)()==="win32"){let r=t.path;return t.authority?r=`//${t.authority}${t.path}`:/^\/[A-Za-z]:/.test(r)&&(r=r.substring(1)),(0,sN.normalize)(r)}else{if(t.authority)throw new Error("Unsupported remote file path");return t.path}}o(wl,"fsPath");function Qo(e){try{return wl(e)}catch{return}}o(Qo,"getFsPath");function hCe(e){let t=Qo(e);if(t)return Zy.file(t).toString()}o(hCe,"getFsUri");function Ix(e,...t){let r,n=Qo(e);return n?r=al((0,sN.resolve)(n,...t)):r=oN.resolvePath(xI(e),...t.map(i=>pCe(i))).toString(),typeof e=="string"?r:{uri:r}}o(Ix,"resolveFilePath");function Po(e,...t){let r=oN.joinPath(xI(e),...t.map(pCe)).toString();return typeof e=="string"?r:{uri:r}}o(Po,"joinPath");function pCe(e){return ynt(e)?e.replaceAll("\\","/"):e}o(pCe,"pathToURIPath");function ynt(e){return/^[^/\\]*\\/.test(e)}o(ynt,"isWinPath");function Bi(e){return PZ((typeof e=="string"?e:e.uri).replace(/[#?].*$/,"").replace(/\/$/,"").replace(/^.*[/:]/,""))}o(Bi,"basename");function zu(e){let t=oN.dirname(xI(e)),r;return mCe.has(t.scheme)&&t.scheme!=="file"?r=t.with({scheme:"file",fragment:""}).toString():r=t.toString(),typeof e=="string"?r:{uri:r}}o(zu,"dirname");var $n=class{static{o(this,"NetworkConfiguration")}},aN={api:"https://api.githubcopilot.com",proxy:"https://copilot-proxy.githubusercontent.com",telemetry:"https://copilot-telemetry.githubusercontent.com","origin-tracker":"https://origin-tracker.githubusercontent.com"};function FZ(e,t,r){if(r&&Gm(e)){for(let n of r){let i=On(e,n);if(i)return i}return}for(let n of t){let i=On(e,n);if(i)return i}}o(FZ,"urlConfigOverride");function Cnt(e,t){switch(t){case"api":return FZ(e,[St.DebugOverrideCapiUrl,St.DebugOverrideCapiUrlLegacy],[St.DebugTestOverrideCapiUrl,St.DebugTestOverrideCapiUrlLegacy]);case"proxy":return FZ(e,[St.DebugOverrideProxyUrl,St.DebugOverrideProxyUrlLegacy],[St.DebugTestOverrideProxyUrl,St.DebugTestOverrideProxyUrlLegacy]);case"origin-tracker":if(!lN(e))return FZ(e,[St.DebugSnippyOverrideUrl])}}o(Cnt,"getEndpointOverrideUrl");function vI(e,t,r,...n){let i=Cnt(e,r)??(t.envelope.endpoints??aN)[r];return Po(i,...n)}o(vI,"getEndpointUrl");var Vm=class{static{o(this,"ExpConfigMaker")}},kw=class extends Vm{constructor(r="",n={}){super();this.overrideTASUrl=r;this.defaultFilters=n}static{o(this,"ExpConfigFromTAS")}async fetchExperiments(r,n){let i=r.get(Or),s=Object.keys(n).length===0?this.defaultFilters:n,a=this.overrideTASUrl.length===0?r.get($n).getExperimentationUrl():this.overrideTASUrl,l;try{l=await i.fetch(a,{method:"GET",headers:s,timeout:5e3})}catch(m){return dd.createFallbackConfig(r,`Error fetching ExP config: ${String(m)}`)}if(!l.ok)return dd.createFallbackConfig(r,`ExP responded with ${l.status}`);let c;try{c=await l.json()}catch(m){if(m instanceof SyntaxError)return xa(r,m,"fetchExperiments"),dd.createFallbackConfig(r,"ExP responded with invalid JSON");throw m}let u=c.Configs.find(m=>m.Id==="vscode")??{Id:"vscode",Parameters:{}},f=Object.entries(u.Parameters).map(([m,h])=>m+(h?"":"cf"));return new dd(u.Parameters,c.AssignmentContext,f.join(";"))}},cN=class extends Vm{static{o(this,"ExpConfigNone")}fetchExperiments(t,r){return Promise.resolve(dd.createEmptyConfig())}};d();d();var uN=class{constructor(t){this.prefix=t}static{o(this,"GranularityImplementation")}getCurrentAndUpComingValues(t){let r=this.getValue(t),n=this.getUpcomingValues(t);return[r,n]}},NZ=class extends uN{static{o(this,"ConstantGranularity")}getValue(t){return this.prefix}getUpcomingValues(t){return[]}},gCe=o(e=>new NZ(e),"DEFAULT_GRANULARITY"),fN=class extends uN{constructor(r,n=.5,i=new Date().setUTCHours(0,0,0,0)){super(r);this.prefix=r;this.fetchBeforeFactor=n;this.anchor=i}static{o(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=[],i=this.getUpcomingTimePeriodBucketStrings(r),s=this.getUpcomingByCallBucketStrings();for(let a of i)for(let l of s)n.push(this.prefix+a+l);return n}getUpcomingTimePeriodBucketStrings(r){if(this.timePeriodLengthMs===void 0)return[""];if((r.getTime()-this.anchor)%this.timePeriodLengthMs<this.fetchBeforeFactor*this.timePeriodLengthMs)return[this.getTimePeriodBucketString(r)];{let n=new Date(r.getTime()+this.timePeriodLengthMs);return[this.getTimePeriodBucketString(r),this.getTimePeriodBucketString(n)]}}getUpcomingByCallBucketStrings(){return this.numByCallBuckets===void 0?[""]:Array.from(Array(this.numByCallBuckets).keys()).map(r=>r.toString())}timeHash(r){return this.numByCallBuckets==null?0:7883*(r.getTime()%this.numByCallBuckets)%this.numByCallBuckets}dateToTimePartString(r){return this.timePeriodLengthMs==null?"":Math.floor((r.getTime()-this.anchor)/this.timePeriodLengthMs).toString()}};var ACe="X-Copilot-ClientTimeBucket",dN=class{constructor(t,r){this.specs=new Map;this.prefix=t,this.clock=r,this.defaultGranularity=gCe(t)}static{o(this,"GranularityDirectory")}selectGranularity(t){for(let[r,n]of this.specs.entries())if(t.extends(r))return n;return this.defaultGranularity}update(t,r,n){if(r=r>1?r:NaN,n=n>0?n:NaN,isNaN(r)&&isNaN(n))this.specs.delete(t);else{let i=new fN(this.prefix);isNaN(r)||i.setByCallBuckets(r),isNaN(n)||i.setTimePeriod(n*3600*1e3),this.specs.set(t,i)}}extendFilters(t){let r=this.selectGranularity(t),[n,i]=r.getCurrentAndUpComingValues(this.clock.now());return{newFilterSettings:t.withChange(ACe,n),otherFilterSettingsToPrefetch:i.map(s=>t.withChange(ACe,s))}}};d();d();d();d();d();d();function mN(e){return["a5db0bcaae94032fe715fb34a5e4bce2","7184f66dfcee98cb5f08a1cb936d5225","faef89d9169d5eacf1d8c8dde3412e37","4535c7beffc844b46bb1ed4aa04d759a"].find(r=>e.includes(r))}o(mN,"findKnownOrg");d();d();var Tx=(i=>(i[i.DEBUG=4]="DEBUG",i[i.INFO=3]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=1]="ERROR",i))(Tx||{}),Wa=class{static{o(this,"LogTarget")}},Op=class{static{o(this,"TelemetryLogSender")}},Ht=class{constructor(t){this.category=t}static{o(this,"Logger")}log(t,r,...n){t.get(Wa).logIt(t,r,this.category,...n)}debug(t,...r){this.log(t,4,...r)}info(t,...r){this.log(t,3,...r)}warn(t,...r){this.log(t,2,...r)}error(t,...r){t.get(Op).sendError(t,this.category,...r),this.errorWithoutTelemetry(t,...r)}errorWithoutTelemetry(t,...r){this.log(t,1,...r)}exception(t,r,n){if(r instanceof Error&&r.name==="Canceled"&&r.message==="Canceled")return;let i=n;n.startsWith(".")&&(i=n.substring(1),n=`${this.category}${n}`),t.get(Op).sendException(t,r,n);let s=r instanceof Error?r:new Error(`Non-error thrown: ${String(r)}`);this.log(t,1,`${i}:`,s)}},Kn=new Ht("default");d();var va=class{static{o(this,"NotificationSender")}async showWarningMessageOnlyOnce(t,r,...n){return this.showWarningMessage(r,...n)}};d();var ic=class{static{o(this,"UrlOpener")}};var xnt=["UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_SIGNATURE_FAILURE"],yCe="Your proxy connection requires a trusted certificate. Please make sure the proxy certificate and any issuers are configured correctly and trusted by your operating system.",CCe="https://gh.io/copilot-network-errors",Y0=class{constructor(){this.notifiedErrorCodes=[]}static{o(this,"UserErrorNotifier")}notifyUser(t,r){if(!(r instanceof Error))return;let n=r;n.code&&xnt.includes(n.code)&&!this.didNotifyBefore(n.code)&&(this.notifiedErrorCodes.push(n.code),this.displayCertificateErrorNotification(t,n))}async displayCertificateErrorNotification(t,r){new Ht("certificates").error(t,`${yCe} Please visit ${CCe} to learn more. Original cause:`,r);let n={title:"Learn more"};return t.get(va).showWarningMessage(yCe,n).then(i=>{if(i?.title===n.title)return t.get(ic).open(CCe)})}didNotifyBefore(t){return this.notifiedErrorCodes.indexOf(t)!==-1}};var i0=new Ht("auth"),bCe=60;function bI(e){let t=e.serverUrl?.match(/^https?:\/\//)?e.serverUrl:"",r=e.apiUrl?.match(/^https?:\/\//)?e.apiUrl:"";return t?r||=t.replace("://","://api."):r?.includes("://api.")&&(t||=r.replace("://api.","://")),(!t||!r)&&(t="https://github.com",r="https://api.github.com"),{...e,apiUrl:r,serverUrl:t}}o(bI,"fillGitHubUrls");function xCe(){return Math.floor(Date.now()/1e3)}o(xCe,"nowSeconds");async function hN(e,t){let r=cn.createAndMarkAsIssued({},{});jt(e,"auth.new_login");let n=await vnt(e,t),i=await n.json(),s=i.user_notification;if(vCe(e,s,t),n.clientError&&!n.headers.get("x-github-request-id")&&i0.error(e,`HTTP ${n.status} response does not appear to originate from GitHub. Is a proxy or firewall intercepting this request? https://gh.io/copilot-firewall`),n.status===401){let c="Failed to get copilot token due to 401 status. Please sign out and try again.";return i0.info(e,c),bx(e,"auth.unknown_401",r),{kind:"failure",reason:"HTTP401",message:c,envelope:i}}if(!n.ok||!i.token){i0.info(e,`Invalid copilot token: missing token: ${n.status} ${n.statusText}`),bx(e,"auth.invalid_token",r.extendedBy({status:n.status.toString(),status_text:n.statusText}));let c=i.error_details;return c?.notification_id!=="not_signed_up"&&vCe(e,c,t),{kind:"failure",reason:"NotAuthorized",message:"User not authorized",envelope:i,...c}}let a=i.expires_at;i.expires_at=xCe()+i.refresh_in+bCe;let l=new q1(i);return Ew(e,l),jt(e,"auth.new_token",r.extendedBy({},{adjusted_expires_at:i.expires_at,expires_at:a,current_time:xCe()})),{kind:"success",envelope:i}}o(hN,"authFromGitHubToken");async function vnt(e,t){let r=t.devOverride?.copilotTokenUrl??e.get($n).getApiUrl(t,"copilot_internal/v2/token");try{return await e.get(Or).fetch(r,{headers:{Authorization:`token ${t.accessToken}`,...Ic(e)},timeout:12e4})}catch(n){throw e.get(Y0).notifyUser(e,n),n}}o(vnt,"fetchCopilotToken");function vCe(e,t,r){t&&e.get(va).showWarningMessageOnlyOnce(t.notification_id,t.message,{title:t.title},{title:"Dismiss"}).then(async n=>{let i=n?.title===t.title,s=i||n?.title==="Dismiss";if(i){let a=e.get(dn).getEditorPluginInfo(),l=t.url.replace("{EDITOR}",encodeURIComponent(a.name+"_"+a.version));await e.get(ic).open(l)}t.notification_id&&s&&await bnt(e,t.notification_id,r)}).catch(n=>{i0.exception(e,n,"copilotToken.notification")})}o(vCe,"notifyUser");async function bnt(e,t,r){let n=r.devOverride?.notificationUrl??e.get($n).getApiUrl(r,"copilot_internal/notification"),i=await e.get(Or).fetch(n,{headers:{Authorization:`token ${r.accessToken}`,...Ic(e)},method:"POST",body:JSON.stringify({notification_id:t})});(!i||!i.ok)&&i0.error(e,`Failed to send notification result to GitHub: ${i?.status} ${i?.statusText}`)}o(bnt,"sendNotificationResultToGitHub");var q1=class{constructor(t){this.envelope=t;this.token=t.token,this.organization_list=t.organization_list,this.enterprise_list=t.enterprise_list,this.tokenMap=this.parseToken(this.token)}static{o(this,"CopilotToken")}needsRefresh(){return(this.envelope.expires_at-bCe)*1e3<Date.now()}isExpired(){return this.envelope.expires_at*1e3<Date.now()}get hasKnownOrg(){return mN(this.organization_list||[])!==void 0}parseToken(t){let r=new Map,i=(t??"").split(":")[0].split(";");for(let s of i){let[a,l]=s.split("=");r.set(a,l)}return r}getTokenValue(t){return this.tokenMap.get(t)}};d();d();d();var _Ce=Xe(ICe()),SCe=Xe(wCe()),Yu=Xe(require("os"));var EI=class{constructor(t,r,n,i=!1){this.ctx=t;this.namespace=r;this.includeAuthorizationHeader=i;this.onCopilotToken=o(t=>{this.token=t;let r=t.getTokenValue("tid");r!==void 0&&(this.tags["ai.user.id"]=r)},"onCopilotToken");this.xhrOverride={sendPOST:o((t,r)=>{if(typeof t.data!="string")throw new Error(`AppInsightsReporter only supports string payloads, received ${typeof t.data}`);let n=t.headers??{};n["Content-Type"]="application/json",this.includeAuthorizationHeader&&this.token&&(n.Authorization=`Bearer ${this.token.token}`);let i={method:"POST",headers:n,body:t.data};this.ctx.get(Or).fetch(t.urlString,i).then(s=>s.text().then(a=>{r(s.status,Object.fromEntries(s.headers),a)})).catch(s=>{Kn.errorWithoutTelemetry(this.ctx,"Error sending telemetry",s),r(0,{})})},"sendPOST")};this.client=new SCe.ApplicationInsights({instrumentationKey:n,disableAjaxTracking:!0,disableExceptionTracking:!0,disableFetchTracking:!0,disableCorrelationHeaders:!0,disableCookiesUsage:!0,autoTrackPageVisitTime:!1,emitLineDelimitedJson:!1,disableInstrumentationKeyValidation:!0,endpointUrl:t.get($n).getTelemetryUrl(),extensionConfig:{[_Ce.BreezeChannelIdentifier]:{alwaysUseXhrOverride:!0,httpXHROverride:this.xhrOverride}}}),this.tags=Ent(t),this.commonProperties=Int(t),this.#e=js(t,this.onCopilotToken)}static{o(this,"AppInsightsReporter")}#e;sendTelemetryEvent(t,r,n){r={...r,...this.commonProperties};let i=this.qualifyEventName(t);this.client.track({name:i,tags:this.tags,data:{...r,...n},baseType:"EventData",baseData:{name:i,properties:r,measurements:n}})}sendTelemetryErrorEvent(t,r,n){this.sendTelemetryEvent(this.qualifyEventName(t),r,n)}async dispose(){this.#e.dispose(),await this.client.unload(!0,void 0,200)}qualifyEventName(t){return t.startsWith(this.namespace)?t:`${this.namespace}/${t}`}};function Ent(e){let t={},r=e.get(_s);t["ai.session.id"]=r.sessionId;let n=e.get(ec);return n.trackingId&&(t["ai.user.id"]=n.trackingId),t["ai.cloud.roleInstance"]="REDACTED",t["ai.device.osVersion"]=`${Yu.type()} ${Yu.release()}`,t["ai.device.osArchitecture"]=Yu.arch(),t["ai.device.osPlatform"]=Yu.platform(),t["ai.cloud.role"]="Web",t["ai.application.ver"]=e.get(go).getVersion(),t}o(Ent,"getTags");function Int(e){let t={};t.common_os=Yu.platform(),t.common_platformversion=Yu.release(),t.common_arch=Yu.arch(),t.common_cpu=Array.from(new Set(Yu.cpus().map(n=>n.model))).join();let r=e.get(_s);return t.common_vscodemachineid=r.machineId,t.common_vscodesessionid=r.sessionId,t.common_uikind=r.uiKind,t.common_remotename=r.remoteName,t.common_isnewappinstall="",t}o(Int,"getCommonProperties");var kCe="7d7048df-6dd0-4048-bb23-b716c1461f8f",RCe="3fdd7f28-937a-48c8-9a21-ba337db23bd1",Tnt="f0000000-0000-0000-0000-000000000000",Ku=class{constructor(){this._initialized=!1}static{o(this,"TelemetryInitialization")}get isInitialized(){return this._initialized}get isEnabled(){return this._enabled??!1}async initialize(t,r,n){let i=t.get(Ds).deactivate();if(this._namespace=r,this._enabled=n,this._initialized=!0,n){let s=t.get(Ds);s.setReporter(new EI(t,r,kCe)),s.setRestrictedReporter(new EI(t,r,RCe)),s.setFTReporter(new EI(t,r,Tnt,!0))}await i}reInitialize(t){return this._initialized?this.initialize(t,this._namespace,this._enabled):Promise.reject(new Error("Cannot re-initialize telemetry that has not been initialized."))}};function Xy(e,t,r){return e.get(Ku).initialize(e,t,r)}o(Xy,"setupTelemetryReporters");var wn=class{constructor(t,r){this.authPersistence=t;this._copilotTokenManager=r;this.pendingSignIn=void 0}static{o(this,"AuthManager")}#e;#t;getCopilotTokenManager(){return this._copilotTokenManager}updateEnterpriseConfig(t,r){if(this.#t=void 0,this.authPersistence.setAuthAuthority(void 0),r?.uri?.match(/^https?:\/\//))try{this.authPersistence.setAuthAuthority(new URL(r.uri).host),this.#t=r.uri}catch(n){i0.exception(t,n,`Ignoring invalid github-enterprise.uri: <${r.uri}>`)}}async checkAndUpdateStatus(t,r){let n=r?.localChecksOnly??!1,i=await this.getSession(t);return i===void 0?(this._copilotTokenManager.resetToken(),await this._copilotTokenManager.primeToken(),{status:"NotSignedIn"}):n?{status:"MaybeOK",user:i.login}:(r?.forceRefresh&&this._copilotTokenManager.resetToken(),{status:await this.getTokenWithSignUpLimited(t,i,r?.freshSignIn??!1),user:i.login})}async getTokenWithSignUpLimited(t,r,n){try{await this._copilotTokenManager.getToken()}catch(i){if(i instanceof hd)return n&&i.result.envelope?.can_signup_for_limited&&await this.signUpLimited(t,r)?this.getTokenWithSignUpLimited(t,r,!1):i.result.reason==="HTTP401"?"NotSignedIn":i.result.reason;throw i}return"OK"}async getPersistedAuthRecord(t){return await this.authPersistence.getAuthRecord(t)}async getSession(t){let r=wnt(process.env)??this.#e;if(r)return bI(r);if(r===null)return;let n=this.#t??"https://github.com",i=await this.getPersistedAuthRecord();if(i===void 0)return;let s={serverUrl:n,apiUrl:n.replace("://","://api."),accessToken:i.oauth_token,login:i.user,githubAppId:i.githubAppId};return i.dev_override&&md(t)==="dev"&&(s.devOverride={copilotTokenUrl:i.dev_override.copilot_token_url,notificationUrl:i.dev_override.notification_url,contentRestrictionsUrl:i.dev_override.content_restrictions_url}),s}async signUpLimited(t,r){let n=t.get($n).getApiUrl(r,"copilot_internal/subscribe_limited_user");try{return(await(await t.get(Or).fetch(n,{headers:{Authorization:`token ${r.accessToken}`,...Ic(t)},method:"POST",body:JSON.stringify({restricted_telemetry:t.get(Ku).isEnabled?"enabled":"disabled",public_code_suggestions:"enabled"})})).json())?.subscribed||!1}catch(i){return i0.exception(t,i,"signUpLimited failed"),!1}}async setPersistedSession({accessToken:t,login:r,githubAppId:n}){await this.authPersistence.purgeLegacyAuthRecords(),await this.authPersistence.saveAuthRecord({oauth_token:t,user:r,githubAppId:n}),this._copilotTokenManager.resetToken()}setTransientSession(t,r=!0){this.#e=t,r&&this._copilotTokenManager.resetToken()}async deletePersistedSession(){await this.authPersistence.deleteAuthRecord(),await this.authPersistence.purgeLegacyAuthRecords(),!this.#e&&(this._copilotTokenManager.resetToken(),await this._copilotTokenManager.primeToken())}};function wnt(e){if(e.GH_COPILOT_TOKEN&&!/=/.test(e.GH_COPILOT_TOKEN))return{apiUrl:e.GH_COPILOT_API_URL,serverUrl:e.GH_COPILOT_SERVER_URL,login:"<GH_COPILOT_TOKEN-user>",accessToken:e.GH_COPILOT_TOKEN};if(e.GITHUB_COPILOT_TOKEN)return{apiUrl:e.GITHUB_COPILOT_API_URL,serverUrl:e.GITHUB_COPILOT_SERVER_URL,login:"<GITHUB_COPILOT_TOKEN-user>",accessToken:e.GITHUB_COPILOT_TOKEN};if(e.CODESPACES==="true"&&e.GITHUB_TOKEN)return{apiUrl:e.GITHUB_API_URL,serverUrl:e.GITHUB_SERVER_URL,login:e.GITHUB_USER||"<codespaces-user>",accessToken:e.GITHUB_TOKEN}}o(wnt,"getSessionFromEnv");d();var zi=class{static{o(this,"StatusReporter")}#e=0;#t="Normal";#i;#n;#r=!0;get busy(){return this.#e>0}withProgress(t){return this.#t==="Warning"&&this.forceNormal(),this.#e++===0&&this.#o(),t().finally(()=>{--this.#e===0&&this.#o()})}forceStatus(t,r,n){this.#t===t&&this.#i===r&&!n&&!this.#n&&!this.#r||(this.#t=t,this.#i=r,this.#n=n,this.#r=!1,this.#o())}forceNormal(){this.#t!=="Inactive"&&this.forceStatus("Normal")}setError(t,r){this.forceStatus("Error",t,r)}setWarning(t){this.#t!=="Error"&&this.forceStatus("Warning",t)}setInactive(t){this.#t==="Error"||this.#t==="Warning"||this.forceStatus("Inactive",t)}clearInactive(){this.#t==="Inactive"&&this.forceStatus("Normal")}#o(){let t={kind:this.#t,message:this.#i,busy:this.busy,command:this.#n};this.didChange(t)}},AN=class extends zi{static{o(this,"NoOpStatusReporter")}didChange(){}};var Xr=class{constructor(t=!1){this.primed=t}static{o(this,"CopilotTokenManager")}primeToken(){this.primed=!0;try{return this.getToken().then(()=>!0,()=>!1)}catch{return Promise.resolve(!1)}}},hd=class extends Ks{constructor(r){super(r.message??"");this.result=r}static{o(this,"TokenResultError")}},yN=class extends Xr{constructor(r,n=!1){super(n);this.ctx=r;this.token=void 0;this.tokenPromise=void 0}static{o(this,"CopilotTokenManagerFromGitHubTokenBase")}async fetchCopilotTokenEnvelope(){let r=await this.getGitHubSession();if(!r)throw new hd({reason:"NotSignedIn"});if(!r?.accessToken)throw new hd({reason:"HTTP401"});let n=await hN(this.ctx,r);if(n.kind==="failure"){if(n.message)throw new hd(n);let i=new Error(`Unexpected error getting Copilot token: ${n.reason}`);throw i.code=`CopilotToken.${n.reason}`,i}return n.envelope}async getToken(){if(!this.primed){let r=new Error("Token requested before initialization");if(BCe(this.ctx))throw r;i0.exception(this.ctx,r,".getToken")}if(!this.tokenPromise&&(!this.token||this.token?.needsRefresh())){let r=this.fetchCopilotTokenEnvelope().then(n=>{let i=new q1(n);return this.tokenPromise!==r?i:(this.token=i,this.tokenPromise=void 0,this.ctx.get(zi).forceNormal(),this.token)},n=>{if(this.tokenPromise!==r)throw n;this.tokenPromise=void 0;let i=this.ctx.get(zi);if(n instanceof hd)switch(n.result.reason){case"NotSignedIn":i.setError("You are not signed into GitHub.",{command:"github.copilot.signIn",title:"Sign In"});break;case"HTTP401":i.setError("Your GitHub token is invalid. Try signing in again.");break;case"NotAuthorized":i.setError(n.message||"No access to Copilot found.");break}else i.setWarning(String(n));throw n});this.tokenPromise=r}return this.token&&!this.token.isExpired()?this.token:await this.tokenPromise}resetToken(r){r!==void 0?(jt(this.ctx,"auth.reset_token_"+r),i0.debug(this.ctx,`Resetting copilot token on HTTP error ${r}`)):i0.debug(this.ctx,"Resetting copilot token"),this.token=void 0,this.tokenPromise=void 0}},II=class extends yN{static{o(this,"CopilotTokenManagerFromAuthManager")}async getGitHubSession(){return await this.ctx.get(wn).getSession(this.ctx)}};function _nt(e){let t=e.getCopilotIntegrationId();if(t)return t;switch(e.getEditorPluginInfo().name){case"copilot-intellij":return"jetbrains-chat";case"copilot":case"copilot-vs":return;default:return"jetbrains-chat"}}o(_nt,"getIntegrationId");function e5(e){let t={...Ic(e),"X-GitHub-Api-Version":LZ},r=_nt(e.get(dn));return r&&(t["Copilot-Integration-Id"]=r),t}o(e5,"getCapiHeaders");function TI(e,t,...r){return vI(e,t,"api",...r)}o(TI,"getCapiUrl");async function wx(e,t){let r=await e.get(Xr).getToken(),n=TI(e,r,t),i={Authorization:`Bearer ${r.token}`,...e5(e)};return await e.get(Or).fetch(new URL(n).href,{method:"GET",headers:i})}o(wx,"fetchCapiUrl");async function DCe(e,t,r){let n=await e.get(Xr).getToken(),i=TI(e,n,t),s={Authorization:`Bearer ${n.token}`,...e5(e)};return await e.get(Or).fetch(new URL(i).href,{method:"POST",headers:s,body:r})}o(DCe,"postCapiUrl");d();var PCe=10*60*1e3,di={Gpt35turbo:"gpt-3.5-turbo",Gpt4:"gpt-4",Gpt4turbo:"gpt-4-turbo",Gpt4o:"gpt-4o",Gpt4oMini:"gpt-4o-mini",O1Mini:"o1-mini",O1Ga:"o1-ga",Claude35Sonnet:"claude-3.5-sonnet",O3Mini:"o3-mini",Gemini20Flash:"gemini-2.0-flash",Gemini20Pro:"gemini-2.0-pro",Claude37Sonnet:"claude-3.7-sonnet",Claude37SonnetThought:"claude-3.7-sonnet-thought",Gpt45:"gpt-4.5",Unknown:"unknown"},FCe=new Set([di.O1Ga,di.O3Mini,di.O1Mini,di.Gemini20Pro,di.Gemini20Flash]);function ds(e){switch(e){case"edits":case"user":case"inline":return[di.Gpt4o,di.Gpt4turbo,di.Gpt4,di.O1Mini,di.O1Ga,di.Claude35Sonnet,di.O3Mini,di.Gemini20Flash,di.Claude37Sonnet,di.Claude37SonnetThought,di.Gpt45];case"meta":case"suggestions":case"synonyms":return[di.Gpt4oMini,di.Gpt35turbo]}}o(ds,"getSupportedModelFamiliesForPrompt");var vN={textEmbedding3Small:"text-embedding-3-small"},Snt=I.Object({type:I.Union([I.Literal("chat"),I.Literal("embeddings"),I.Literal("completion")]),tokenizer:I.String(),family:I.String(),object:I.String(),supports:I.Optional(I.Object({tool_calls:I.Optional(I.Boolean()),parallel_tool_calls:I.Optional(I.Boolean()),streaming:I.Optional(I.Boolean()),vision:I.Optional(I.Boolean())})),limits:I.Optional(I.Object({max_inputs:I.Optional(I.Number()),max_prompt_tokens:I.Optional(I.Number()),max_output_tokens:I.Optional(I.Number()),max_context_window_tokens:I.Optional(I.Number())}))}),knt=I.Object({id:I.String(),name:I.String(),version:I.String(),model_picker_enabled:I.Boolean(),is_chat_default:I.Optional(I.Boolean()),is_chat_fallback:I.Optional(I.Boolean()),capabilities:Snt,billing:I.Optional(I.Object({is_premium:I.Optional(I.Boolean()),multiplier:I.Optional(I.Number())})),object:I.String(),preview:I.Optional(I.Boolean()),isExperimental:I.Optional(I.Boolean()),policy:I.Optional(I.Object({state:I.String(),terms:I.String()}))}),NCe=I.Object({data:I.Array(knt)}),Ju=class{static{o(this,"ModelMetadataProvider")}},CN=class extends Ju{constructor(r){super();this.ctx=r;this._metadata=[];this._lastFetchTime=0;js(r,()=>{this._lastFetchTime=0})}static{o(this,"CapiModelMetadataProvider")}async getMetadata(){return this.shouldRefreshModels()&&await this.fetchMetadata(),this._metadata.slice()}async fetchMetadata(){let r=await wx(this.ctx,"/models");if(r.status<200||r.status>=300){if(r.status===429&&this._metadata.length>0){Kn.error(this.ctx,"Rate limited while fetching models from CAPI",{status:r.status,statusText:r.statusText});return}throw Kn.error(this.ctx,"Failed to fetch models from CAPI",{status:r.status,statusText:r.statusText}),new ix(r)}await this.processModels(r)}async fetchModel(r){let n=await wx(this.ctx,`/models/${r}`);if(!n.ok){Kn.error(this.ctx,`Failed to fetch model ${r} from CAPI`,{status:n.status,statusText:n.statusText});return}return await n.json()}async acceptModelPolicy(r){return(await DCe(this.ctx,`/models/${r}/policy`,JSON.stringify({status:"enabled"}))).ok?(await this.fetchMetadata(),!0):!1}async processModels(r){try{let n=await r.json();this._metadata=n.data,this._lastFetchTime=Date.now()}catch(n){Kn.error(this.ctx,"Failed to parse models from CAPI",{error:n})}}shouldRefreshModels(){return this._metadata.length===0||!this._lastFetchTime?!0:this.isLastFetchOlderTenMinutes()}isLastFetchOlderTenMinutes(){return Date.now()-this._lastFetchTime>PCe}},xN=class extends Ju{constructor(r,n){super();this.ctx=r;this.delegate=n;this._exp_models_cache=new Map}static{o(this,"ExpModelMetadataProvider")}async getMetadata(){let r=this.ctx.get(Cr),n=await r.updateExPValuesAndAssignments(),i=r.ideChatExpModelIds(n),s=[];if(i){let a=i?.split(",");for(let l of a){let c=await this.fetchModel(l.trim());c!==void 0&&(c.isExperimental=!0,s.push(c))}}return s.concat(await this.delegate.getMetadata())}async fetchModel(r){let n=this._exp_models_cache.get(r);if(n){let[s,a]=n;if(Date.now()-a<PCe)return s}let i=await this.delegate.fetchModel(r);if(i)return this._exp_models_cache.set(r,[i,Date.now()]),i}async acceptModelPolicy(r){return await this.delegate.acceptModelPolicy(r)}};d();function LCe(e){let t=On(e,St.UserSelectedCompletionModel);return typeof t=="string"&&t.length>0?t:null}o(LCe,"getUserSelectedModelConfiguration");d();d();var Rnt=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},MCe=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)},QZ,bN,OCe,MZ=class extends gn{static{o(this,"AssertError")}constructor(t){let r=t.First();super(r===void 0?"Invalid Value":r.message),QZ.add(this),bN.set(this,void 0),Rnt(this,bN,t,"f"),this.error=r}Errors(){return new Jy(MCe(this,QZ,"m",OCe).call(this))}};bN=new WeakMap,QZ=new WeakSet,OCe=o(function*(){this.error&&(yield this.error),yield*MCe(this,bN,"f")},"_AssertError_Iterator");function QCe(e,t,r){if(!fi(e,t,r))throw new MZ(Qp(e,t,r))}o(QCe,"AssertValue");function EN(...e){return e.length===3?QCe(e[0],e[1],e[2]):QCe(e[0],[],e[1])}o(EN,"Assert");d();d();d();function Bnt(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Yi(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Yi(e[r]);return t}o(Bnt,"FromObject");function Dnt(e){return e.map(t=>Yi(t))}o(Dnt,"FromArray");function Pnt(e){return e.slice()}o(Pnt,"FromTypedArray");function Fnt(e){return new Map(Yi([...e.entries()]))}o(Fnt,"FromMap");function Nnt(e){return new Set(Yi([...e.entries()]))}o(Nnt,"FromSet");function Lnt(e){return new Date(e.toISOString())}o(Lnt,"FromDate");function Yi(e){if(pn(e))return Dnt(e);if(t0(e))return Lnt(e);if(td(e))return Pnt(e);if(kpe(e))return Fnt(e);if(Rpe(e))return Nnt(e);if(ai(e))return Bnt(e);if(Mu(e))return e;throw new Error("ValueClone: Unable to clone value")}o(Yi,"Clone");var Zu=class extends gn{static{o(this,"ValueCreateError")}constructor(t,r){super(r),this.schema=t}};function Ki(e){return Dy(e)?e():Yi(e)}o(Ki,"FromDefault");function Qnt(e,t){return hn(e,"default")?Ki(e.default):{}}o(Qnt,"FromAny");function Mnt(e,t){return{}}o(Mnt,"FromArgument");function Ont(e,t){if(e.uniqueItems===!0&&!hn(e,"default"))throw new Zu(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!hn(e,"default"))throw new Zu(e,"Array with the contains constraint requires a default value");return"default"in e?Ki(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(r=>K0(e.items,t)):[]}o(Ont,"FromArray");function Unt(e,t){return hn(e,"default")?Ki(e.default):async function*(){}()}o(Unt,"FromAsyncIterator");function qnt(e,t){return hn(e,"default")?Ki(e.default):BigInt(0)}o(qnt,"FromBigInt");function Wnt(e,t){return hn(e,"default")?Ki(e.default):!1}o(Wnt,"FromBoolean");function Gnt(e,t){if(hn(e,"default"))return Ki(e.default);{let r=K0(e.returns,t);return typeof r=="object"&&!Array.isArray(r)?class{constructor(){for(let[n,i]of Object.entries(r)){let s=this;s[n]=i}}}:class{}}}o(Gnt,"FromConstructor");function Hnt(e,t){return hn(e,"default")?Ki(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}o(Hnt,"FromDate");function jnt(e,t){return hn(e,"default")?Ki(e.default):()=>K0(e.returns,t)}o(jnt,"FromFunction");function Vnt(e,t){let r=globalThis.Object.values(e.$defs),n=e.$defs[e.$ref];return K0(n,[...t,...r])}o(Vnt,"FromImport");function $nt(e,t){return hn(e,"default")?Ki(e.default):e.minimum!==void 0?e.minimum:0}o($nt,"FromInteger");function znt(e,t){if(hn(e,"default"))return Ki(e.default);{let r=e.allOf.reduce((n,i)=>{let s=K0(i,t);return typeof s=="object"?{...n,...s}:s},{});if(!fi(e,t,r))throw new Zu(e,"Intersect produced invalid value. Consider using a default value.");return r}}o(znt,"FromIntersect");function Ynt(e,t){return hn(e,"default")?Ki(e.default):function*(){}()}o(Ynt,"FromIterator");function Knt(e,t){return hn(e,"default")?Ki(e.default):e.const}o(Knt,"FromLiteral");function Jnt(e,t){if(hn(e,"default"))return Ki(e.default);throw new Zu(e,"Never types cannot be created. Consider using a default value.")}o(Jnt,"FromNever");function Znt(e,t){if(hn(e,"default"))return Ki(e.default);throw new Zu(e,"Not types must have a default value")}o(Znt,"FromNot");function Xnt(e,t){return hn(e,"default")?Ki(e.default):null}o(Xnt,"FromNull");function eit(e,t){return hn(e,"default")?Ki(e.default):e.minimum!==void 0?e.minimum:0}o(eit,"FromNumber");function tit(e,t){if(hn(e,"default"))return Ki(e.default);{let r=new Set(e.required),n={};for(let[i,s]of Object.entries(e.properties))r.has(i)&&(n[i]=K0(s,t));return n}}o(tit,"FromObject");function rit(e,t){return hn(e,"default")?Ki(e.default):Promise.resolve(K0(e.item,t))}o(rit,"FromPromise");function nit(e,t){let[r,n]=Object.entries(e.patternProperties)[0];if(hn(e,"default"))return Ki(e.default);if(r===Sp||r===_p)return{};{let i=r.slice(1,r.length-1).split("|"),s={};for(let a of i)s[a]=K0(n,t);return s}}o(nit,"FromRecord");function iit(e,t){return hn(e,"default")?Ki(e.default):K0($i(e,t),t)}o(iit,"FromRef");function oit(e,t){if(hn(e,"default"))return Ki(e.default);throw new Zu(e,"RegExp types cannot be created. Consider using a default value.")}o(oit,"FromRegExp");function sit(e,t){if(e.pattern!==void 0){if(hn(e,"default"))return Ki(e.default);throw new Zu(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(hn(e,"default"))return Ki(e.default);throw new Zu(e,"String types with formats must specify a default value")}else return hn(e,"default")?Ki(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}o(sit,"FromString");function ait(e,t){return hn(e,"default")?Ki(e.default):"value"in e?Symbol.for(e.value):Symbol()}o(ait,"FromSymbol");function lit(e,t){if(hn(e,"default"))return Ki(e.default);if(!QP(e))throw new Zu(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return NE(e)[0]}o(lit,"FromTemplateLiteral");function cit(e,t){if(UCe++>Ait)throw new Zu(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return hn(e,"default")?Ki(e.default):K0($i(e,t),t)}o(cit,"FromThis");function uit(e,t){return hn(e,"default")?Ki(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((r,n)=>K0(e.items[n],t))}o(uit,"FromTuple");function fit(e,t){if(hn(e,"default"))return Ki(e.default)}o(fit,"FromUndefined");function dit(e,t){if(hn(e,"default"))return Ki(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return K0(e.anyOf[0],t)}o(dit,"FromUnion");function mit(e,t){return hn(e,"default")?Ki(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}o(mit,"FromUint8Array");function hit(e,t){return hn(e,"default")?Ki(e.default):{}}o(hit,"FromUnknown");function pit(e,t){if(hn(e,"default"))return Ki(e.default)}o(pit,"FromVoid");function git(e,t){if(hn(e,"default"))return Ki(e.default);throw new Error("User defined types must specify a default value")}o(git,"FromKind");function K0(e,t){let r=El(e,t),n=e;switch(n[ot]){case"Any":return Qnt(n,r);case"Argument":return Mnt(n,r);case"Array":return Ont(n,r);case"AsyncIterator":return Unt(n,r);case"BigInt":return qnt(n,r);case"Boolean":return Wnt(n,r);case"Constructor":return Gnt(n,r);case"Date":return Hnt(n,r);case"Function":return jnt(n,r);case"Import":return Vnt(n,r);case"Integer":return $nt(n,r);case"Intersect":return znt(n,r);case"Iterator":return Ynt(n,r);case"Literal":return Knt(n,r);case"Never":return Jnt(n,r);case"Not":return Znt(n,r);case"Null":return Xnt(n,r);case"Number":return eit(n,r);case"Object":return tit(n,r);case"Promise":return rit(n,r);case"Record":return nit(n,r);case"Ref":return iit(n,r);case"RegExp":return oit(n,r);case"String":return sit(n,r);case"Symbol":return ait(n,r);case"TemplateLiteral":return lit(n,r);case"This":return cit(n,r);case"Tuple":return uit(n,r);case"Undefined":return fit(n,r);case"Union":return dit(n,r);case"Uint8Array":return mit(n,r);case"Unknown":return hit(n,r);case"Void":return pit(n,r);default:if(!r0.Has(n[ot]))throw new Zu(n,"Unknown type");return git(n,r)}}o(K0,"Visit");var Ait=512,UCe=0;function pd(...e){return UCe=0,e.length===2?K0(e[0],e[1]):K0(e[0],[])}o(pd,"Create");var IN=class extends gn{static{o(this,"ValueCastError")}constructor(t,r){super(r),this.schema=t}};function yit(e,t,r){if(e[ot]==="Object"&&typeof r=="object"&&!_1(r)){let n=e,i=Object.getOwnPropertyNames(r),s=Object.entries(n.properties),[a,l]=[1/s.length,s.length];return s.reduce((c,[u,f])=>{let m=f[ot]==="Literal"&&f.const===r[u]?l:0,h=fi(f,t,r[u])?a:0,p=i.includes(u)?a:0;return c+(m+h+p)},0)}else return fi(e,t,r)?1:0}o(yit,"ScoreUnion");function Cit(e,t,r){let n=e.anyOf.map(a=>$i(a,t)),[i,s]=[n[0],0];for(let a of n){let l=yit(a,t,r);l>s&&(i=a,s=l)}return i}o(Cit,"SelectUnion");function xit(e,t,r){if("default"in e)return typeof r=="function"?e.default:Yi(e.default);{let n=Cit(e,t,r);return Rw(n,t,r)}}o(xit,"CastUnion");function vit(e,t,r){return fi(e,t,r)?Yi(r):pd(e,t)}o(vit,"DefaultClone");function bit(e,t,r){return fi(e,t,r)?r:pd(e,t)}o(bit,"Default");function Eit(e,t,r){if(fi(e,t,r))return Yi(r);let n=pn(r)?Yi(r):pd(e,t),i=Kr(e.minItems)&&n.length<e.minItems?[...n,...Array.from({length:e.minItems-n.length},()=>null)]:n,a=(Kr(e.maxItems)&&i.length>e.maxItems?i.slice(0,e.maxItems):i).map(c=>$m(e.items,t,c));if(e.uniqueItems!==!0)return a;let l=[...new Set(a)];if(!fi(e,t,l))throw new IN(e,"Array cast produced invalid data due to uniqueItems constraint");return l}o(Eit,"FromArray");function Iit(e,t,r){if(fi(e,t,r))return pd(e,t);let n=new Set(e.returns.required||[]),i=o(function(){},"result");for(let[s,a]of Object.entries(e.returns.properties))!n.has(s)&&r.prototype[s]===void 0||(i.prototype[s]=$m(a,t,r.prototype[s]));return i}o(Iit,"FromConstructor");function Tit(e,t,r){let n=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return $m(i,[...t,...n],r)}o(Tit,"FromImport");function wit(e,t,r){let n=pd(e,t),i=ai(n)&&ai(r)?{...n,...r}:r;return fi(e,t,i)?i:pd(e,t)}o(wit,"FromIntersect");function _it(e,t,r){throw new IN(e,"Never types cannot be cast")}o(_it,"FromNever");function Sit(e,t,r){if(fi(e,t,r))return r;if(r===null||typeof r!="object")return pd(e,t);let n=new Set(e.required||[]),i={};for(let[s,a]of Object.entries(e.properties))!n.has(s)&&r[s]===void 0||(i[s]=$m(a,t,r[s]));if(typeof e.additionalProperties=="object"){let s=Object.getOwnPropertyNames(e.properties);for(let a of Object.getOwnPropertyNames(r))s.includes(a)||(i[a]=$m(e.additionalProperties,t,r[a]))}return i}o(Sit,"FromObject");function kit(e,t,r){if(fi(e,t,r))return Yi(r);if(r===null||typeof r!="object"||Array.isArray(r)||r instanceof Date)return pd(e,t);let n=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[n],s={};for(let[a,l]of Object.entries(r))s[a]=$m(i,t,l);return s}o(kit,"FromRecord");function Rit(e,t,r){return $m($i(e,t),t,r)}o(Rit,"FromRef");function Bit(e,t,r){return $m($i(e,t),t,r)}o(Bit,"FromThis");function Dit(e,t,r){return fi(e,t,r)?Yi(r):pn(r)?e.items===void 0?[]:e.items.map((n,i)=>$m(n,t,r[i])):pd(e,t)}o(Dit,"FromTuple");function Pit(e,t,r){return fi(e,t,r)?Yi(r):xit(e,t,r)}o(Pit,"FromUnion");function $m(e,t,r){let n=Mi(e.$id)?El(e,t):t,i=e;switch(e[ot]){case"Array":return Eit(i,n,r);case"Constructor":return Iit(i,n,r);case"Import":return Tit(i,n,r);case"Intersect":return wit(i,n,r);case"Never":return _it(i,n,r);case"Object":return Sit(i,n,r);case"Record":return kit(i,n,r);case"Ref":return Rit(i,n,r);case"This":return Bit(i,n,r);case"Tuple":return Dit(i,n,r);case"Union":return Pit(i,n,r);case"Date":case"Symbol":case"Uint8Array":return vit(e,t,r);default:return bit(i,n,r)}}o($m,"Visit");function Rw(...e){return e.length===3?$m(e[0],e[1],e[2]):$m(e[0],[],e[1])}o(Rw,"Cast");d();function Fit(e){return Fy(e)&&e[ot]!=="Unsafe"}o(Fit,"IsCheckable");function Nit(e,t,r){return pn(r)?r.map(n=>J0(e.items,t,n)):r}o(Nit,"FromArray");function Lit(e,t,r){let n=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return J0(i,[...t,...n],r)}o(Lit,"FromImport");function Qit(e,t,r){let n=e.unevaluatedProperties,s=e.allOf.map(l=>J0(l,t,Yi(r))).reduce((l,c)=>ai(c)?{...l,...c}:c,{});if(!ai(r)||!ai(s)||!Fy(n))return s;let a=W0(e);for(let l of Object.getOwnPropertyNames(r))a.includes(l)||fi(n,t,r[l])&&(s[l]=J0(n,t,r[l]));return s}o(Qit,"FromIntersect");function Mit(e,t,r){if(!ai(r)||pn(r))return r;let n=e.additionalProperties;for(let i of Object.getOwnPropertyNames(r)){if(hn(e.properties,i)){r[i]=J0(e.properties[i],t,r[i]);continue}if(Fy(n)&&fi(n,t,r[i])){r[i]=J0(n,t,r[i]);continue}delete r[i]}return r}o(Mit,"FromObject");function Oit(e,t,r){if(!ai(r))return r;let n=e.additionalProperties,i=Object.getOwnPropertyNames(r),[s,a]=Object.entries(e.patternProperties)[0],l=new RegExp(s);for(let c of i){if(l.test(c)){r[c]=J0(a,t,r[c]);continue}if(Fy(n)&&fi(n,t,r[c])){r[c]=J0(n,t,r[c]);continue}delete r[c]}return r}o(Oit,"FromRecord");function Uit(e,t,r){return J0($i(e,t),t,r)}o(Uit,"FromRef");function qit(e,t,r){return J0($i(e,t),t,r)}o(qit,"FromThis");function Wit(e,t,r){if(!pn(r))return r;if(ss(e.items))return[];let n=Math.min(r.length,e.items.length);for(let i=0;i<n;i++)r[i]=J0(e.items[i],t,r[i]);return r.length>n?r.slice(0,n):r}o(Wit,"FromTuple");function Git(e,t,r){for(let n of e.anyOf)if(Fit(n)&&fi(n,t,r))return J0(n,t,r);return r}o(Git,"FromUnion");function J0(e,t,r){let n=Mi(e.$id)?El(e,t):t,i=e;switch(i[ot]){case"Array":return Nit(i,n,r);case"Import":return Lit(i,n,r);case"Intersect":return Qit(i,n,r);case"Object":return Mit(i,n,r);case"Record":return Oit(i,n,r);case"Ref":return Uit(i,n,r);case"This":return qit(i,n,r);case"Tuple":return Wit(i,n,r);case"Union":return Git(i,n,r);default:return r}}o(J0,"Visit");function TN(...e){return e.length===3?J0(e[0],e[1],e[2]):J0(e[0],[],e[1])}o(TN,"Clean");d();function wN(e){return Mi(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}o(wN,"IsStringNumeric");function Hit(e){return Jl(e)||wp(e)||Kr(e)}o(Hit,"IsValueToString");function Bw(e){return e===!0||Kr(e)&&e===1||Jl(e)&&e===BigInt("1")||Mi(e)&&(e.toLowerCase()==="true"||e==="1")}o(Bw,"IsValueTrue");function Dw(e){return e===!1||Kr(e)&&(e===0||Object.is(e,-0))||Jl(e)&&e===BigInt("0")||Mi(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}o(Dw,"IsValueFalse");function jit(e){return Mi(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}o(jit,"IsTimeStringWithTimeZone");function Vit(e){return Mi(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}o(Vit,"IsTimeStringWithoutTimeZone");function $it(e){return Mi(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}o($it,"IsDateTimeStringWithTimeZone");function zit(e){return Mi(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}o(zit,"IsDateTimeStringWithoutTimeZone");function Yit(e){return Mi(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}o(Yit,"IsDateString");function Kit(e,t){let r=WCe(e);return r===t?r:e}o(Kit,"TryConvertLiteralString");function Jit(e,t){let r=GCe(e);return r===t?r:e}o(Jit,"TryConvertLiteralNumber");function Zit(e,t){let r=qCe(e);return r===t?r:e}o(Zit,"TryConvertLiteralBoolean");function Xit(e,t){return Mi(e.const)?Kit(t,e.const):Kr(e.const)?Jit(t,e.const):wp(e.const)?Zit(t,e.const):t}o(Xit,"TryConvertLiteral");function qCe(e){return Bw(e)?!0:Dw(e)?!1:e}o(qCe,"TryConvertBoolean");function eot(e){let t=o(r=>r.split(".")[0],"truncateInteger");return wN(e)?BigInt(t(e)):Kr(e)?BigInt(Math.trunc(e)):Dw(e)?BigInt(0):Bw(e)?BigInt(1):e}o(eot,"TryConvertBigInt");function WCe(e){return S1(e)&&e.description!==void 0?e.description.toString():Hit(e)?e.toString():e}o(WCe,"TryConvertString");function GCe(e){return wN(e)?parseFloat(e):Bw(e)?1:Dw(e)?0:e}o(GCe,"TryConvertNumber");function tot(e){return wN(e)?parseInt(e):Kr(e)?Math.trunc(e):Bw(e)?1:Dw(e)?0:e}o(tot,"TryConvertInteger");function rot(e){return Mi(e)&&e.toLowerCase()==="null"?null:e}o(rot,"TryConvertNull");function not(e){return Mi(e)&&e==="undefined"?void 0:e}o(not,"TryConvertUndefined");function iot(e){return t0(e)?e:Kr(e)?new Date(e):Bw(e)?new Date(1):Dw(e)?new Date(0):wN(e)?new Date(parseInt(e)):Vit(e)?new Date(`1970-01-01T${e}.000Z`):jit(e)?new Date(`1970-01-01T${e}`):zit(e)?new Date(`${e}.000Z`):$it(e)?new Date(e):Yit(e)?new Date(`${e}T00:00:00.000Z`):e}o(iot,"TryConvertDate");function oot(e,t,r){return(pn(r)?r:[r]).map(i=>zm(e.items,t,i))}o(oot,"FromArray");function sot(e,t,r){return eot(r)}o(sot,"FromBigInt");function aot(e,t,r){return qCe(r)}o(aot,"FromBoolean");function lot(e,t,r){return iot(r)}o(lot,"FromDate");function cot(e,t,r){let n=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return zm(i,[...t,...n],r)}o(cot,"FromImport");function uot(e,t,r){return tot(r)}o(uot,"FromInteger");function fot(e,t,r){return e.allOf.reduce((n,i)=>zm(i,t,n),r)}o(fot,"FromIntersect");function dot(e,t,r){return Xit(e,r)}o(dot,"FromLiteral");function mot(e,t,r){return rot(r)}o(mot,"FromNull");function hot(e,t,r){return GCe(r)}o(hot,"FromNumber");function pot(e,t,r){if(!ai(r))return r;for(let n of Object.getOwnPropertyNames(e.properties))hn(r,n)&&(r[n]=zm(e.properties[n],t,r[n]));return r}o(pot,"FromObject");function got(e,t,r){if(!ai(r))return r;let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=e.patternProperties[i];for(let[a,l]of Object.entries(r))r[a]=zm(s,t,l);return r}o(got,"FromRecord");function Aot(e,t,r){return zm($i(e,t),t,r)}o(Aot,"FromRef");function yot(e,t,r){return WCe(r)}o(yot,"FromString");function Cot(e,t,r){return Mi(r)||Kr(r)?Symbol(r):r}o(Cot,"FromSymbol");function xot(e,t,r){return zm($i(e,t),t,r)}o(xot,"FromThis");function vot(e,t,r){return pn(r)&&!ss(e.items)?r.map((i,s)=>s<e.items.length?zm(e.items[s],t,i):i):r}o(vot,"FromTuple");function bot(e,t,r){return not(r)}o(bot,"FromUndefined");function Eot(e,t,r){for(let n of e.anyOf){let i=zm(n,t,Yi(r));if(fi(n,t,i))return i}return r}o(Eot,"FromUnion");function zm(e,t,r){let n=El(e,t),i=e;switch(e[ot]){case"Array":return oot(i,n,r);case"BigInt":return sot(i,n,r);case"Boolean":return aot(i,n,r);case"Date":return lot(i,n,r);case"Import":return cot(i,n,r);case"Integer":return uot(i,n,r);case"Intersect":return fot(i,n,r);case"Literal":return dot(i,n,r);case"Null":return mot(i,n,r);case"Number":return hot(i,n,r);case"Object":return pot(i,n,r);case"Record":return got(i,n,r);case"Ref":return Aot(i,n,r);case"String":return yot(i,n,r);case"Symbol":return Cot(i,n,r);case"This":return xot(i,n,r);case"Tuple":return vot(i,n,r);case"Undefined":return bot(i,n,r);case"Union":return Eot(i,n,r);default:return r}}o(zm,"Visit");function _N(...e){return e.length===3?zm(e[0],e[1],e[2]):zm(e[0],[],e[1])}o(_N,"Convert");d();function HCe(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!fi(t,r,n))throw new hI(t,n,Qp(t,r,n).First());return O1(t,r)?pI(t,r,n):n}o(HCe,"Decode");d();function W1(e,t){let r=hn(e,"default")?e.default:void 0,n=Dy(r)?r():Yi(r);return ss(t)?n:ai(t)&&ai(n)?Object.assign(n,t):t}o(W1,"ValueOrDefault");function OZ(e){return Fy(e)&&"default"in e}o(OZ,"HasDefaultProperty");function Iot(e,t,r){if(pn(r)){for(let i=0;i<r.length;i++)r[i]=o0(e.items,t,r[i]);return r}let n=W1(e,r);if(!pn(n))return n;for(let i=0;i<n.length;i++)n[i]=o0(e.items,t,n[i]);return n}o(Iot,"FromArray");function Tot(e,t,r){return t0(r)?r:W1(e,r)}o(Tot,"FromDate");function wot(e,t,r){let n=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return o0(i,[...t,...n],r)}o(wot,"FromImport");function _ot(e,t,r){let n=W1(e,r);return e.allOf.reduce((i,s)=>{let a=o0(s,t,n);return ai(a)?{...i,...a}:a},{})}o(_ot,"FromIntersect");function Sot(e,t,r){let n=W1(e,r);if(!ai(n))return n;let i=Object.getOwnPropertyNames(e.properties);for(let s of i){let a=o0(e.properties[s],t,n[s]);ss(a)||(n[s]=o0(e.properties[s],t,n[s]))}if(!OZ(e.additionalProperties))return n;for(let s of Object.getOwnPropertyNames(n))i.includes(s)||(n[s]=o0(e.additionalProperties,t,n[s]));return n}o(Sot,"FromObject");function kot(e,t,r){let n=W1(e,r);if(!ai(n))return n;let i=e.additionalProperties,[s,a]=Object.entries(e.patternProperties)[0],l=new RegExp(s);for(let c of Object.getOwnPropertyNames(n))l.test(c)&&OZ(a)&&(n[c]=o0(a,t,n[c]));if(!OZ(i))return n;for(let c of Object.getOwnPropertyNames(n))l.test(c)||(n[c]=o0(i,t,n[c]));return n}o(kot,"FromRecord");function Rot(e,t,r){return o0($i(e,t),t,W1(e,r))}o(Rot,"FromRef");function Bot(e,t,r){return o0($i(e,t),t,r)}o(Bot,"FromThis");function Dot(e,t,r){let n=W1(e,r);if(!pn(n)||ss(e.items))return n;let[i,s]=[e.items,Math.max(e.items.length,n.length)];for(let a=0;a<s;a++)a<i.length&&(n[a]=o0(i[a],t,n[a]));return n}o(Dot,"FromTuple");function Pot(e,t,r){let n=W1(e,r);for(let i of e.anyOf){let s=o0(i,t,Yi(n));if(fi(i,t,s))return s}return n}o(Pot,"FromUnion");function o0(e,t,r){let n=El(e,t),i=e;switch(i[ot]){case"Array":return Iot(i,n,r);case"Date":return Tot(i,n,r);case"Import":return wot(i,n,r);case"Intersect":return _ot(i,n,r);case"Object":return Sot(i,n,r);case"Record":return kot(i,n,r);case"Ref":return Rot(i,n,r);case"This":return Bot(i,n,r);case"Tuple":return Dot(i,n,r);case"Union":return Pot(i,n,r);default:return W1(i,r)}}o(o0,"Visit");function SN(...e){return e.length===3?o0(e[0],e[1],e[2]):o0(e[0],[],e[1])}o(SN,"Default");d();d();var Ym={};b1(Ym,{Delete:()=>Not,Format:()=>Pw,Get:()=>Qot,Has:()=>Lot,Set:()=>Fot,ValuePointerRootDeleteError:()=>RN,ValuePointerRootSetError:()=>kN});d();var kN=class extends gn{static{o(this,"ValuePointerRootSetError")}constructor(t,r,n){super("Cannot set root value"),this.value=t,this.path=r,this.update=n}},RN=class extends gn{static{o(this,"ValuePointerRootDeleteError")}constructor(t,r){super("Cannot delete root value"),this.value=t,this.path=r}};function jCe(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}o(jCe,"Escape");function*Pw(e){if(e==="")return;let[t,r]=[0,0];for(let n=0;n<e.length;n++)e.charAt(n)==="/"?(n===0||(r=n,yield jCe(e.slice(t,r))),t=n+1):r=n;yield jCe(e.slice(t))}o(Pw,"Format");function Fot(e,t,r){if(t==="")throw new kN(e,t,r);let[n,i,s]=[null,e,""];for(let a of Pw(t))i[a]===void 0&&(i[a]={}),n=i,i=i[a],s=a;n[s]=r}o(Fot,"Set");function Not(e,t){if(t==="")throw new RN(e,t);let[r,n,i]=[null,e,""];for(let s of Pw(t)){if(n[s]===void 0||n[s]===null)return;r=n,n=n[s],i=s}if(Array.isArray(r)){let s=parseInt(i);r.splice(s,1)}else delete r[i]}o(Not,"Delete");function Lot(e,t){if(t==="")return!0;let[r,n,i]=[null,e,""];for(let s of Pw(t)){if(n[s]===void 0)return!1;r=n,n=n[s],i=s}return Object.getOwnPropertyNames(r).includes(i)}o(Lot,"Has");function Qot(e,t){if(t==="")return e;let r=e;for(let n of Pw(t)){if(r[n]===void 0)return;r=r[n]}return r}o(Qot,"Get");d();function Mot(e,t){if(!ai(t))return!1;let r=[...Object.keys(e),...Object.getOwnPropertySymbols(e)],n=[...Object.keys(t),...Object.getOwnPropertySymbols(t)];return r.length!==n.length?!1:r.every(i=>_x(e[i],t[i]))}o(Mot,"ObjectType");function Oot(e,t){return t0(t)&&e.getTime()===t.getTime()}o(Oot,"DateType");function Uot(e,t){return!pn(t)||e.length!==t.length?!1:e.every((r,n)=>_x(r,t[n]))}o(Uot,"ArrayType");function qot(e,t){return!td(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((r,n)=>_x(r,t[n]))}o(qot,"TypedArrayType");function Wot(e,t){return e===t}o(Wot,"ValueType");function _x(e,t){if(t0(e))return Oot(e,t);if(td(e))return qot(e,t);if(pn(e))return Uot(e,t);if(ai(e))return Mot(e,t);if(Mu(e))return Wot(e,t);throw new Error("ValueEquals: Unable to compare value")}o(_x,"Equal");var Got=oo({type:Ri("insert"),path:n0(),value:Mm()}),Hot=oo({type:Ri("update"),path:n0(),value:Mm()}),jot=oo({type:Ri("delete"),path:n0()}),$Ce=io([Got,Hot,jot]),BN=class extends gn{static{o(this,"ValueDiffError")}constructor(t,r){super(r),this.value=t}};function DN(e,t){return{type:"update",path:e,value:t}}o(DN,"CreateUpdate");function zCe(e,t){return{type:"insert",path:e,value:t}}o(zCe,"CreateInsert");function YCe(e){return{type:"delete",path:e}}o(YCe,"CreateDelete");function VCe(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new BN(e,"Cannot diff objects with symbols")}o(VCe,"AssertDiffable");function*Vot(e,t,r){if(VCe(t),VCe(r),!KY(r))return yield DN(e,r);let n=globalThis.Object.getOwnPropertyNames(t),i=globalThis.Object.getOwnPropertyNames(r);for(let s of i)hn(t,s)||(yield zCe(`${e}/${s}`,r[s]));for(let s of n)hn(r,s)&&(_x(t,r)||(yield*PN(`${e}/${s}`,t[s],r[s])));for(let s of n)hn(r,s)||(yield YCe(`${e}/${s}`))}o(Vot,"ObjectType");function*$ot(e,t,r){if(!pn(r))return yield DN(e,r);for(let n=0;n<Math.min(t.length,r.length);n++)yield*PN(`${e}/${n}`,t[n],r[n]);for(let n=0;n<r.length;n++)n<t.length||(yield zCe(`${e}/${n}`,r[n]));for(let n=t.length-1;n>=0;n--)n<r.length||(yield YCe(`${e}/${n}`))}o($ot,"ArrayType");function*zot(e,t,r){if(!td(r)||t.length!==r.length||globalThis.Object.getPrototypeOf(t).constructor.name!==globalThis.Object.getPrototypeOf(r).constructor.name)return yield DN(e,r);for(let n=0;n<Math.min(t.length,r.length);n++)yield*PN(`${e}/${n}`,t[n],r[n])}o(zot,"TypedArrayType");function*Yot(e,t,r){t!==r&&(yield DN(e,r))}o(Yot,"ValueType");function*PN(e,t,r){if(KY(t))return yield*Vot(e,t,r);if(pn(t))return yield*$ot(e,t,r);if(td(t))return yield*zot(e,t,r);if(Mu(t))return yield*Yot(e,t,r);throw new BN(t,"Unable to diff value")}o(PN,"Visit");function KCe(e,t){return[...PN("",e,t)]}o(KCe,"Diff");function Kot(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}o(Kot,"IsRootUpdate");function Jot(e){return e.length===0}o(Jot,"IsIdentity");function JCe(e,t){if(Kot(t))return Yi(t[0].value);if(Jot(t))return Yi(e);let r=Yi(e);for(let n of t)switch(n.type){case"insert":{Ym.Set(r,n.path,n.value);break}case"update":{Ym.Set(r,n.path,n.value);break}case"delete":{Ym.Delete(r,n.path);break}}return r}o(JCe,"Patch");d();function ZCe(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],i=O1(t,r)?AI(t,r,n):n;if(!fi(t,r,i))throw new gI(t,i,Qp(t,r,i).First());return i}o(ZCe,"Encode");d();function FN(e){return ai(e)&&!pn(e)}o(FN,"IsStandardObject");var NN=class extends gn{static{o(this,"ValueMutateError")}constructor(t){super(t)}};function Zot(e,t,r,n){if(!FN(r))Ym.Set(e,t,Yi(n));else{let i=Object.getOwnPropertyNames(r),s=Object.getOwnPropertyNames(n);for(let a of i)s.includes(a)||delete r[a];for(let a of s)i.includes(a)||(r[a]=null);for(let a of s)UZ(e,`${t}/${a}`,r[a],n[a])}}o(Zot,"ObjectType");function Xot(e,t,r,n){if(!pn(r))Ym.Set(e,t,Yi(n));else{for(let i=0;i<n.length;i++)UZ(e,`${t}/${i}`,r[i],n[i]);r.splice(n.length)}}o(Xot,"ArrayType");function est(e,t,r,n){if(td(r)&&r.length===n.length)for(let i=0;i<r.length;i++)r[i]=n[i];else Ym.Set(e,t,Yi(n))}o(est,"TypedArrayType");function tst(e,t,r,n){r!==n&&Ym.Set(e,t,n)}o(tst,"ValueType");function UZ(e,t,r,n){if(pn(n))return Xot(e,t,r,n);if(td(n))return est(e,t,r,n);if(FN(n))return Zot(e,t,r,n);if(Mu(n))return tst(e,t,r,n)}o(UZ,"Visit");function XCe(e){return td(e)||Mu(e)}o(XCe,"IsNonMutableValue");function rst(e,t){return FN(e)&&pn(t)||pn(e)&&FN(t)}o(rst,"IsMismatchedValue");function e3e(e,t){if(XCe(e)||XCe(t))throw new NN("Only object and array types can be mutated at the root level");if(rst(e,t))throw new NN("Cannot assign due type mismatch of assignable values");UZ(e,"",e,t)}o(e3e,"Mutate");d();var LN=class extends gn{static{o(this,"ParseError")}constructor(t){super(t)}},qZ;(function(e){let t=new Map([["Assert",(s,a,l)=>(EN(s,a,l),l)],["Cast",(s,a,l)=>Rw(s,a,l)],["Clean",(s,a,l)=>TN(s,a,l)],["Clone",(s,a,l)=>Yi(l)],["Convert",(s,a,l)=>_N(s,a,l)],["Decode",(s,a,l)=>O1(s,a)?pI(s,a,l):l],["Default",(s,a,l)=>SN(s,a,l)],["Encode",(s,a,l)=>O1(s,a)?AI(s,a,l):l]]);function r(s){t.delete(s)}o(r,"Delete"),e.Delete=r;function n(s,a){t.set(s,a)}o(n,"Set"),e.Set=n;function i(s){return t.get(s)}o(i,"Get"),e.Get=i})(qZ||(qZ={}));var t3e=["Clone","Clean","Default","Convert","Assert","Decode"];function nst(e,t,r,n){return e.reduce((i,s)=>{let a=qZ.Get(s);if(ss(a))throw new LN(`Unable to find Parse operation '${s}'`);return a(t,r,i)},n)}o(nst,"ParseValue");function r3e(...e){let[t,r,n,i]=e.length===4?[e[0],e[1],e[2],e[3]]:e.length===3?pn(e[0])?[e[0],e[1],[],e[2]]:[t3e,e[0],e[1],e[2]]:e.length===2?[t3e,e[0],[],e[1]]:(()=>{throw new LN("Invalid Arguments")})();return nst(t,r,n,i)}o(r3e,"Parse");d();var t5={};b1(t5,{Assert:()=>EN,Cast:()=>Rw,Check:()=>fi,Clean:()=>TN,Clone:()=>Yi,Convert:()=>_N,Create:()=>pd,Decode:()=>HCe,Default:()=>SN,Diff:()=>KCe,Edit:()=>$Ce,Encode:()=>ZCe,Equal:()=>_x,Errors:()=>Qp,Hash:()=>Ky,Mutate:()=>e3e,Parse:()=>r3e,Patch:()=>JCe,ValueErrorIterator:()=>Jy});d();var ist={capabilities:{family:"gpt-3.5-turbo",object:"model_capabilities",supports:{streaming:!0},tokenizer:"cl100k_base",type:"completion"},id:"copilot-codex",model_picker_enabled:!0,name:"GPT-3.5 Turbo",object:"model",preview:!1,version:"copilot-codex"},ost="gpt-4o-copilot",gd=class e{constructor(t,r=!0){this._ctx=t;this.onModelsFetchedCallbacks=[];this.fetchedModelData=[];this.customModels=[];this.editorPreviewFeaturesDisabled=!1;r&&js(this._ctx,n=>this.refreshAvailableModels(n))}static{o(this,"AvailableModelsManager")}async refreshAvailableModels(t){await this.refreshModels(t);for(let r of this.onModelsFetchedCallbacks)r()}addHandler(t){this.onModelsFetchedCallbacks.push(t)}getDefaultModelId(){if(this.fetchedModelData){let t=e.filterCompletionModels(this.fetchedModelData,this.editorPreviewFeaturesDisabled)[0];if(t)return t.id}return ost}parseModelsResponse(t){try{return t5.Parse(NCe,t)}catch(r){Kn.exception(this._ctx,r,"Failed to parse /models response from CAPI");return}}async refreshModels(t){let r=await this.fetchModels(t);r&&(this.fetchedModelData=r)}async fetchModels(t){return this.customModels=t.getTokenValue("cml")?.split(",")??[],this.editorPreviewFeaturesDisabled=t.getTokenValue("editor_preview_features")=="0",t.getTokenValue("fcv1")=="1"?Promise.resolve([ist]):await this.fetch()}async fetch(){let t=await wx(this._ctx,"/models");return t.ok?this.parseModelsResponse(await t.json())?.data??[]:(Kn.error(this._ctx,"Failed to fetch models from CAPI",{status:t.status,statusText:t.statusText}),null)}getGenericCompletionModels(){let t=e.filterCompletionModels(this.fetchedModelData,this.editorPreviewFeaturesDisabled);return e.mapCompletionModels(t)}static filterCompletionModels(t,r){return t.filter(n=>n.capabilities.type==="completion").filter(n=>!r||n.preview===!1||n.preview===void 0)}static filterModelsWithEditorPreviewFeatures(t,r){return t.filter(n=>!r||n.preview===!1||n.preview===void 0)}static mapCompletionModels(t){return t.map(r=>({modelId:r.id,label:r.name,preview:!!r.preview}))}getCurrentModelRequestInfo(t=void 0){let r=this.getDefaultModelId(),n=LCe(this._ctx);if(n){let l=this.getGenericCompletionModels().map(c=>c.modelId);l.includes(n)||(l.length>0&&Kn.error(this._ctx,`User selected model ${n} is not in the list of generic models: ${l.join(", ")}, falling back to default model.`),n=null),r===n&&(n=null)}let i=On(this._ctx,St.DebugOverrideEngine)||On(this._ctx,St.DebugOverrideEngineLegacy);if(i)return new r5(i,"override");let s=t?this._ctx.get(Cr).customEngine(t):"",a=t?this._ctx.get(Cr).customEngineTargetEngine(t):void 0;return n?s&&a&&n===a?new r5(s,"exp"):new r5(n,"modelpicker"):s?new r5(s,"exp"):this.customModels.length>0?new r5(this.customModels[0],"custommodel"):new r5(r,"default")}},r5=class{constructor(t,r){this.modelId=t;this.modelChoiceSource=r}static{o(this,"ModelRequestInfo")}get headers(){return{}}};function n5(e,t=void 0){let r=e.get(gd).getCurrentModelRequestInfo(t);return{headers:r.headers,modelId:r.modelId,engineChoiceSource:r.modelChoiceSource}}o(n5,"getEngineRequestInfo");d();d();var bo=class{static{o(this,"FileSystem")}};var x3e=Xe(C3e());function v3e(e){return e!==void 0&&e!==0}o(v3e,"isRepoInfo");async function b3e(e){let r=(await e.get(Xr).getToken()).organization_list??[];return mN(r)??""}o(b3e,"getUserKind");async function Fw(e,t){return(await e.get(Xr).getToken()).getTokenValue(t)??""}o(Fw,"getTokenKeyValue");function E3e(e){if(e===void 0||e===0)return"";let t=G1(e);if(t==="github/github")return t;let r=Bst(e)?.toLowerCase();return r!==void 0?r:""}o(E3e,"getDogFood");function G1(e){if(e!==void 0&&e!==0&&e.hostname==="github.com")return e.owner+"/"+e.repo}o(G1,"tryGetGitHubNWO");function Bst(e){if(e!==void 0&&e!==0&&(e.hostname.endsWith("azure.com")||e.hostname.endsWith("visualstudio.com")))return e.owner+"/"+e.repo}o(Bst,"tryGetADONWO");function i5(e,t){let r=zu(t);return Dst(e,r)}o(i5,"extractRepoInfoInBackground");var Dst=Lst(Pst,1e4);async function Pst(e,t){let r=hCe(t);if(!r)return;let n=await Fst(e,r);if(!n)return;let i=e.get(bo),s=Po(n,".git","config"),a;try{a=await i.readFileString(s)}catch{return}let l=Nst(a)??"",c=jZ(l),u={uri:n};return c===void 0?{baseFolder:u,url:l,hostname:"",owner:"",repo:"",pathname:""}:{baseFolder:u,url:l,...c}}o(Pst,"extractRepoInfo");function jZ(e){let t;try{if(t=(0,x3e.default)(e),t.resource==""||t.owner==""||t.name==""||t.pathname=="")return}catch{return}return{hostname:t.resource,owner:t.owner,repo:t.name,pathname:t.pathname}}o(jZ,"parseRepoUrl");async function Fst(e,t){let r=t+"_add_to_make_longer",n=e.get(bo);for(;t!=="file:///"&&t.length<r.length;){let i=Po(t,".git","config"),s=!1;try{await n.stat(i),s=!0}catch{s=!1}if(s)return t;r=t,t=zu(t)}}o(Fst,"getRepoBaseUri");function Nst(e){let t=/^\s*\[\s*remote\s+"((\\\\|\\"|[^\\"])+)"/,r=/^\s*\[remote.([^"\s]+)/,n=/^\s*url\s*=\s*([^\s#;]+)/,i=/^\s*\[/,s,a,l=!1;for(let c of e.split(`
223
+ `)}`}}let l=e.get(dn).getEditorInfo(),c;l.root&&(c=[{prefix:`${l.name}:`,path:l.root}]);let u=AZ(a,c),f=nN(e),m=unt(a),h=m==="exception",p=cn.createAndMarkAsIssued({origin:n??"",type:a.name,code:`${a.code??""}`,reason:u.stack||u.toString(),message:u.message,...i});if(await p.makeReadyForSending(e,0,"IncludeExp",r),s?.exception_detail)for(let x of s.exception_detail)x.value&&(f?x.value=pZ(x.value):x.value="[redacted]");if(s??=L5e(e,AZ(a,c,f)),s.context={...s.context,"copilot_event.unique_id":p.properties.unique_id,"#restricted_telemetry":f?"true":"false"},n&&(s.context["#origin"]=n,s.transaction=n),s.rollup_id!=="auto"&&(p.properties.errno=s.rollup_id),s.created_at=new Date(p.issuedTime).toISOString(),f){let x=V5e(a,c),v=cn.createAndMarkAsIssued({origin:n??"",type:a.name,code:`${a.code??""}`,reason:x.stack||x.toString(),message:x.message,...i});s.rollup_id!=="auto"&&(v.properties.errno=s.rollup_id),await v.makeReadyForSending(e,1,"IncludeExp",r),v.properties.unique_id=p.properties.unique_id,p.properties.restricted_unique_id=v.properties.unique_id,Sw(e,1,`error.${m}`,v)}let g=s.rollup_id==="auto"?a.stack??"":s.rollup_id;h&&!e.get(Lp).isThrottled(g)&&(p.properties.failbot_payload=JSON.stringify(s)),Sw(e,0,`error.${m}`,p)}o(nCe,"_telemetryException");function Vu(e,t,r,n){let i=o(async(...s)=>{try{await t(...s)}catch(a){await nCe(e,a,Xs(),r,n)}},"wrapped");return(...s)=>e.get(Bo).register(i(...s))}o(Vu,"telemetryCatch");function bx(e,t,r,n){return e.get(Bo).register(Ant(e,t,Xs(),r?.extendedBy(),n))}o(bx,"telemetryError");async function Ant(e,t,r,n,i=0){if(yI(i)&&!nN(e))return;let s=n||cn.createAndMarkAsIssued({},{});await s.makeReadyForSending(e,i,"IncludeExp",r),fnt(e,i,t,s)}o(Ant,"_telemetryError");function iCe(e,t,r,n,i){let s=cn.createAndMarkAsIssued({completionTextJson:JSON.stringify(t),choiceIndex:i.toString()});if(r.logprobs)for(let[a,l]of Object.entries(r.logprobs))s.properties["logprobs_"+a]=JSON.stringify(l)??"unset";return s.extendWithRequestId(n),jt(e,"engine.completion",s,1)}o(iCe,"logEngineCompletion");function oCe(e,t,r){let n;t.isFimEnabled?n={promptPrefixJson:JSON.stringify(t.prefix),promptSuffixJson:JSON.stringify(t.suffix)}:n={promptJson:JSON.stringify(t.prefix)};let i=r.extendedBy(n);return jt(e,"engine.prompt",i,1)}o(oCe,"logEnginePrompt");var dd=class e{static{o(this,"ExpConfig")}constructor(t,r,n){this.variables=t,this.assignmentContext=r,this.features=n}static createFallbackConfig(t,r){return iN(t,{reason:r}),this.createEmptyConfig()}static createEmptyConfig(){return new e({},"","")}addToTelemetry(t){t.properties["VSCode.ABExp.Features"]=this.features,t.properties["abexp.assignmentcontext"]=this.assignmentContext}};d();d();d();var uCe=require("os"),sN=require("path");d();var lCe;(()=>{"use strict";var e={975:W=>{function q(H){if(typeof H!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(H))}o(q,"e");function oe(H,O){for(var V,J="",ae=0,te=-1,le=0,ce=0;ce<=H.length;++ce){if(ce<H.length)V=H.charCodeAt(ce);else{if(V===47)break;V=47}if(V===47){if(!(te===ce-1||le===1))if(te!==ce-1&&le===2){if(J.length<2||ae!==2||J.charCodeAt(J.length-1)!==46||J.charCodeAt(J.length-2)!==46){if(J.length>2){var Pe=J.lastIndexOf("/");if(Pe!==J.length-1){Pe===-1?(J="",ae=0):ae=(J=J.slice(0,Pe)).length-1-J.lastIndexOf("/"),te=ce,le=0;continue}}else if(J.length===2||J.length===1){J="",ae=0,te=ce,le=0;continue}}O&&(J.length>0?J+="/..":J="..",ae=2)}else J.length>0?J+="/"+H.slice(te+1,ce):J=H.slice(te+1,ce),ae=ce-te-1;te=ce,le=0}else V===46&&le!==-1?++le:le=-1}return J}o(oe,"r");var X={resolve:o(function(){for(var H,O="",V=!1,J=arguments.length-1;J>=-1&&!V;J--){var ae;J>=0?ae=arguments[J]:(H===void 0&&(H=process.cwd()),ae=H),q(ae),ae.length!==0&&(O=ae+"/"+O,V=ae.charCodeAt(0)===47)}return O=oe(O,!V),V?O.length>0?"/"+O:"/":O.length>0?O:"."},"resolve"),normalize:o(function(H){if(q(H),H.length===0)return".";var O=H.charCodeAt(0)===47,V=H.charCodeAt(H.length-1)===47;return(H=oe(H,!O)).length!==0||O||(H="."),H.length>0&&V&&(H+="/"),O?"/"+H:H},"normalize"),isAbsolute:o(function(H){return q(H),H.length>0&&H.charCodeAt(0)===47},"isAbsolute"),join:o(function(){if(arguments.length===0)return".";for(var H,O=0;O<arguments.length;++O){var V=arguments[O];q(V),V.length>0&&(H===void 0?H=V:H+="/"+V)}return H===void 0?".":X.normalize(H)},"join"),relative:o(function(H,O){if(q(H),q(O),H===O||(H=X.resolve(H))===(O=X.resolve(O)))return"";for(var V=1;V<H.length&&H.charCodeAt(V)===47;++V);for(var J=H.length,ae=J-V,te=1;te<O.length&&O.charCodeAt(te)===47;++te);for(var le=O.length-te,ce=ae<le?ae:le,Pe=-1,Ie=0;Ie<=ce;++Ie){if(Ie===ce){if(le>ce){if(O.charCodeAt(te+Ie)===47)return O.slice(te+Ie+1);if(Ie===0)return O.slice(te+Ie)}else ae>ce&&(H.charCodeAt(V+Ie)===47?Pe=Ie:Ie===0&&(Pe=0));break}var Fe=H.charCodeAt(V+Ie);if(Fe!==O.charCodeAt(te+Ie))break;Fe===47&&(Pe=Ie)}var Re="";for(Ie=V+Pe+1;Ie<=J;++Ie)Ie!==J&&H.charCodeAt(Ie)!==47||(Re.length===0?Re+="..":Re+="/..");return Re.length>0?Re+O.slice(te+Pe):(te+=Pe,O.charCodeAt(te)===47&&++te,O.slice(te))},"relative"),_makeLong:o(function(H){return H},"_makeLong"),dirname:o(function(H){if(q(H),H.length===0)return".";for(var O=H.charCodeAt(0),V=O===47,J=-1,ae=!0,te=H.length-1;te>=1;--te)if((O=H.charCodeAt(te))===47){if(!ae){J=te;break}}else ae=!1;return J===-1?V?"/":".":V&&J===1?"//":H.slice(0,J)},"dirname"),basename:o(function(H,O){if(O!==void 0&&typeof O!="string")throw new TypeError('"ext" argument must be a string');q(H);var V,J=0,ae=-1,te=!0;if(O!==void 0&&O.length>0&&O.length<=H.length){if(O.length===H.length&&O===H)return"";var le=O.length-1,ce=-1;for(V=H.length-1;V>=0;--V){var Pe=H.charCodeAt(V);if(Pe===47){if(!te){J=V+1;break}}else ce===-1&&(te=!1,ce=V+1),le>=0&&(Pe===O.charCodeAt(le)?--le==-1&&(ae=V):(le=-1,ae=ce))}return J===ae?ae=ce:ae===-1&&(ae=H.length),H.slice(J,ae)}for(V=H.length-1;V>=0;--V)if(H.charCodeAt(V)===47){if(!te){J=V+1;break}}else ae===-1&&(te=!1,ae=V+1);return ae===-1?"":H.slice(J,ae)},"basename"),extname:o(function(H){q(H);for(var O=-1,V=0,J=-1,ae=!0,te=0,le=H.length-1;le>=0;--le){var ce=H.charCodeAt(le);if(ce!==47)J===-1&&(ae=!1,J=le+1),ce===46?O===-1?O=le:te!==1&&(te=1):O!==-1&&(te=-1);else if(!ae){V=le+1;break}}return O===-1||J===-1||te===0||te===1&&O===J-1&&O===V+1?"":H.slice(O,J)},"extname"),format:o(function(H){if(H===null||typeof H!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof H);return function(O,V){var J=V.dir||V.root,ae=V.base||(V.name||"")+(V.ext||"");return J?J===V.root?J+ae:J+"/"+ae:ae}(0,H)},"format"),parse:o(function(H){q(H);var O={root:"",dir:"",base:"",ext:"",name:""};if(H.length===0)return O;var V,J=H.charCodeAt(0),ae=J===47;ae?(O.root="/",V=1):V=0;for(var te=-1,le=0,ce=-1,Pe=!0,Ie=H.length-1,Fe=0;Ie>=V;--Ie)if((J=H.charCodeAt(Ie))!==47)ce===-1&&(Pe=!1,ce=Ie+1),J===46?te===-1?te=Ie:Fe!==1&&(Fe=1):te!==-1&&(Fe=-1);else if(!Pe){le=Ie+1;break}return te===-1||ce===-1||Fe===0||Fe===1&&te===ce-1&&te===le+1?ce!==-1&&(O.base=O.name=le===0&&ae?H.slice(1,ce):H.slice(le,ce)):(le===0&&ae?(O.name=H.slice(1,te),O.base=H.slice(1,ce)):(O.name=H.slice(le,te),O.base=H.slice(le,ce)),O.ext=H.slice(te,ce)),le>0?O.dir=H.slice(0,le-1):ae&&(O.dir="/"),O},"parse"),sep:"/",delimiter:":",win32:null,posix:null};X.posix=X,W.exports=X}},t={};function r(W){var q=t[W];if(q!==void 0)return q.exports;var oe=t[W]={exports:{}};return e[W](oe,oe.exports,r),oe.exports}o(r,"r"),r.d=(W,q)=>{for(var oe in q)r.o(q,oe)&&!r.o(W,oe)&&Object.defineProperty(W,oe,{enumerable:!0,get:q[oe]})},r.o=(W,q)=>Object.prototype.hasOwnProperty.call(W,q),r.r=W=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(W,"__esModule",{value:!0})};var n={};let i;r.r(n),r.d(n,{URI:o(()=>h,"URI"),Utils:o(()=>re,"Utils")}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);let s=/^\w[\w\d+.-]*$/,a=/^\//,l=/^\/\//;function c(W,q){if(!W.scheme&&q)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${W.authority}", path: "${W.path}", query: "${W.query}", fragment: "${W.fragment}"}`);if(W.scheme&&!s.test(W.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(W.path){if(W.authority){if(!a.test(W.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(l.test(W.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}o(c,"a");let u="",f="/",m=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class h{static{o(this,"l")}static isUri(q){return q instanceof h||!!q&&typeof q.authority=="string"&&typeof q.fragment=="string"&&typeof q.path=="string"&&typeof q.query=="string"&&typeof q.scheme=="string"&&typeof q.fsPath=="string"&&typeof q.with=="function"&&typeof q.toString=="function"}scheme;authority;path;query;fragment;constructor(q,oe,X,H,O,V=!1){typeof q=="object"?(this.scheme=q.scheme||u,this.authority=q.authority||u,this.path=q.path||u,this.query=q.query||u,this.fragment=q.fragment||u):(this.scheme=function(J,ae){return J||ae?J:"file"}(q,V),this.authority=oe||u,this.path=function(J,ae){switch(J){case"https":case"http":case"file":ae?ae[0]!==f&&(ae=f+ae):ae=f}return ae}(this.scheme,X||u),this.query=H||u,this.fragment=O||u,c(this,V))}get fsPath(){return b(this,!1)}with(q){if(!q)return this;let{scheme:oe,authority:X,path:H,query:O,fragment:V}=q;return oe===void 0?oe=this.scheme:oe===null&&(oe=u),X===void 0?X=this.authority:X===null&&(X=u),H===void 0?H=this.path:H===null&&(H=u),O===void 0?O=this.query:O===null&&(O=u),V===void 0?V=this.fragment:V===null&&(V=u),oe===this.scheme&&X===this.authority&&H===this.path&&O===this.query&&V===this.fragment?this:new g(oe,X,H,O,V)}static parse(q,oe=!1){let X=m.exec(q);return X?new g(X[2]||u,F(X[4]||u),F(X[5]||u),F(X[7]||u),F(X[9]||u),oe):new g(u,u,u,u,u)}static file(q){let oe=u;if(i&&(q=q.replace(/\\/g,f)),q[0]===f&&q[1]===f){let X=q.indexOf(f,2);X===-1?(oe=q.substring(2),q=f):(oe=q.substring(2,X),q=q.substring(X)||f)}return new g("file",oe,q,u,u)}static from(q){let oe=new g(q.scheme,q.authority,q.path,q.query,q.fragment);return c(oe,!0),oe}toString(q=!1){return _(this,q)}toJSON(){return this}static revive(q){if(q){if(q instanceof h)return q;{let oe=new g(q);return oe._formatted=q.external,oe._fsPath=q._sep===p?q.fsPath:null,oe}}return q}}let p=i?1:void 0;class g extends h{static{o(this,"d")}_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=b(this,!1)),this._fsPath}toString(q=!1){return q?_(this,!0):(this._formatted||(this._formatted=_(this,!1)),this._formatted)}toJSON(){let q={$mid:1};return this._fsPath&&(q.fsPath=this._fsPath,q._sep=p),this._formatted&&(q.external=this._formatted),this.path&&(q.path=this.path),this.scheme&&(q.scheme=this.scheme),this.authority&&(q.authority=this.authority),this.query&&(q.query=this.query),this.fragment&&(q.fragment=this.fragment),q}}let x={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function v(W,q,oe){let X,H=-1;for(let O=0;O<W.length;O++){let V=W.charCodeAt(O);if(V>=97&&V<=122||V>=65&&V<=90||V>=48&&V<=57||V===45||V===46||V===95||V===126||q&&V===47||oe&&V===91||oe&&V===93||oe&&V===58)H!==-1&&(X+=encodeURIComponent(W.substring(H,O)),H=-1),X!==void 0&&(X+=W.charAt(O));else{X===void 0&&(X=W.substr(0,O));let J=x[V];J!==void 0?(H!==-1&&(X+=encodeURIComponent(W.substring(H,O)),H=-1),X+=J):H===-1&&(H=O)}}return H!==-1&&(X+=encodeURIComponent(W.substring(H))),X!==void 0?X:W}o(v,"m");function E(W){let q;for(let oe=0;oe<W.length;oe++){let X=W.charCodeAt(oe);X===35||X===63?(q===void 0&&(q=W.substr(0,oe)),q+=x[X]):q!==void 0&&(q+=W[oe])}return q!==void 0?q:W}o(E,"y");function b(W,q){let oe;return oe=W.authority&&W.path.length>1&&W.scheme==="file"?`//${W.authority}${W.path}`:W.path.charCodeAt(0)===47&&(W.path.charCodeAt(1)>=65&&W.path.charCodeAt(1)<=90||W.path.charCodeAt(1)>=97&&W.path.charCodeAt(1)<=122)&&W.path.charCodeAt(2)===58?q?W.path.substr(1):W.path[1].toLowerCase()+W.path.substr(2):W.path,i&&(oe=oe.replace(/\//g,"\\")),oe}o(b,"v");function _(W,q){let oe=q?E:v,X="",{scheme:H,authority:O,path:V,query:J,fragment:ae}=W;if(H&&(X+=H,X+=":"),(O||H==="file")&&(X+=f,X+=f),O){let te=O.indexOf("@");if(te!==-1){let le=O.substr(0,te);O=O.substr(te+1),te=le.lastIndexOf(":"),te===-1?X+=oe(le,!1,!1):(X+=oe(le.substr(0,te),!1,!1),X+=":",X+=oe(le.substr(te+1),!1,!0)),X+="@"}O=O.toLowerCase(),te=O.lastIndexOf(":"),te===-1?X+=oe(O,!1,!0):(X+=oe(O.substr(0,te),!1,!0),X+=O.substr(te))}if(V){if(V.length>=3&&V.charCodeAt(0)===47&&V.charCodeAt(2)===58){let te=V.charCodeAt(1);te>=65&&te<=90&&(V=`/${String.fromCharCode(te+32)}:${V.substr(3)}`)}else if(V.length>=2&&V.charCodeAt(1)===58){let te=V.charCodeAt(0);te>=65&&te<=90&&(V=`${String.fromCharCode(te+32)}:${V.substr(2)}`)}X+=oe(V,!0,!1)}return J&&(X+="?",X+=oe(J,!1,!1)),ae&&(X+="#",X+=q?ae:v(ae,!1,!1)),X}o(_,"b");function R(W){try{return decodeURIComponent(W)}catch{return W.length>3?W.substr(0,3)+R(W.substr(3)):W}}o(R,"C");let P=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function F(W){return W.match(P)?W.replace(P,q=>R(q)):W}o(F,"w");var G=r(975);let se=G.posix||G,Ae="/";var re;(function(W){W.joinPath=function(q,...oe){return q.with({path:se.join(q.path,...oe)})},W.resolvePath=function(q,...oe){let X=q.path,H=!1;X[0]!==Ae&&(X=Ae+X,H=!0);let O=se.resolve(X,...oe);return H&&O[0]===Ae&&!q.authority&&(O=O.substring(1)),q.with({path:O})},W.dirname=function(q){if(q.path.length===0||q.path===Ae)return q;let oe=se.dirname(q.path);return oe.length===1&&oe.charCodeAt(0)===46&&(oe=""),q.with({path:oe})},W.basename=function(q){return se.basename(q.path)},W.extname=function(q){return se.extname(q.path)}})(re||(re={})),lCe=n})();var{URI:Zy,Utils:oN}=lCe;function fCe(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substring(0,3)+fCe(e.substring(3)):e}}o(fCe,"decodeURIComponentGraceful");var cCe=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function PZ(e){return e.match(cCe)?e.replace(cCe,t=>fCe(t)):e}o(PZ,"percentDecode");function al(e){if(/^[A-Za-z][A-Za-z0-9+.-]+:/.test(e))throw new Error("Path must not contain a scheme");if(!e)throw new Error("Path must not be empty");return Zy.file(e).toString()}o(al,"makeFsUri");function xI(e){if(typeof e!="string"&&(e=e.uri),/^[A-Za-z]:\\/.test(e))throw new Error(`Could not parse <${e}>: Windows-style path`);try{let t=e.match(/^(?:([^:/?#]+?:)?\/\/)(\/\/.*)$/);return t?Zy.parse(t[1]+t[2],!0):Zy.parse(e,!0)}catch(t){throw new Error(`Could not parse <${e}>`,{cause:t})}}o(xI,"parseUri");function dCe(e){return xI(e),e}o(dCe,"validateUri");function nc(e){try{return xI(e).toString()}catch{return e}}o(nc,"normalizeUri");var mCe=new Set(["file","notebook","vscode-notebook","vscode-notebook-cell"]);function wl(e){let t=xI(e);if(!mCe.has(t.scheme))throw new Error(`Unsupported scheme: ${t.scheme}`);if((0,uCe.platform)()==="win32"){let r=t.path;return t.authority?r=`//${t.authority}${t.path}`:/^\/[A-Za-z]:/.test(r)&&(r=r.substring(1)),(0,sN.normalize)(r)}else{if(t.authority)throw new Error("Unsupported remote file path");return t.path}}o(wl,"fsPath");function Qo(e){try{return wl(e)}catch{return}}o(Qo,"getFsPath");function hCe(e){let t=Qo(e);if(t)return Zy.file(t).toString()}o(hCe,"getFsUri");function Ix(e,...t){let r,n=Qo(e);return n?r=al((0,sN.resolve)(n,...t)):r=oN.resolvePath(xI(e),...t.map(i=>pCe(i))).toString(),typeof e=="string"?r:{uri:r}}o(Ix,"resolveFilePath");function Po(e,...t){let r=oN.joinPath(xI(e),...t.map(pCe)).toString();return typeof e=="string"?r:{uri:r}}o(Po,"joinPath");function pCe(e){return ynt(e)?e.replaceAll("\\","/"):e}o(pCe,"pathToURIPath");function ynt(e){return/^[^/\\]*\\/.test(e)}o(ynt,"isWinPath");function Bi(e){return PZ((typeof e=="string"?e:e.uri).replace(/[#?].*$/,"").replace(/\/$/,"").replace(/^.*[/:]/,""))}o(Bi,"basename");function zu(e){let t=oN.dirname(xI(e)),r;return mCe.has(t.scheme)&&t.scheme!=="file"?r=t.with({scheme:"file",fragment:""}).toString():r=t.toString(),typeof e=="string"?r:{uri:r}}o(zu,"dirname");var $n=class{static{o(this,"NetworkConfiguration")}},aN={api:"https://api.githubcopilot.com",proxy:"https://copilot-proxy.githubusercontent.com",telemetry:"https://copilot-telemetry.githubusercontent.com","origin-tracker":"https://origin-tracker.githubusercontent.com"};function FZ(e,t,r){if(r&&Gm(e)){for(let n of r){let i=On(e,n);if(i)return i}return}for(let n of t){let i=On(e,n);if(i)return i}}o(FZ,"urlConfigOverride");function Cnt(e,t){switch(t){case"api":return FZ(e,[St.DebugOverrideCapiUrl,St.DebugOverrideCapiUrlLegacy],[St.DebugTestOverrideCapiUrl,St.DebugTestOverrideCapiUrlLegacy]);case"proxy":return FZ(e,[St.DebugOverrideProxyUrl,St.DebugOverrideProxyUrlLegacy],[St.DebugTestOverrideProxyUrl,St.DebugTestOverrideProxyUrlLegacy]);case"origin-tracker":if(!lN(e))return FZ(e,[St.DebugSnippyOverrideUrl])}}o(Cnt,"getEndpointOverrideUrl");function vI(e,t,r,...n){let i=Cnt(e,r)??(t.envelope.endpoints??aN)[r];return Po(i,...n)}o(vI,"getEndpointUrl");var Vm=class{static{o(this,"ExpConfigMaker")}},kw=class extends Vm{constructor(r="",n={}){super();this.overrideTASUrl=r;this.defaultFilters=n}static{o(this,"ExpConfigFromTAS")}async fetchExperiments(r,n){let i=r.get(Or),s=Object.keys(n).length===0?this.defaultFilters:n,a=this.overrideTASUrl.length===0?r.get($n).getExperimentationUrl():this.overrideTASUrl,l;try{l=await i.fetch(a,{method:"GET",headers:s,timeout:5e3})}catch(m){return dd.createFallbackConfig(r,`Error fetching ExP config: ${String(m)}`)}if(!l.ok)return dd.createFallbackConfig(r,`ExP responded with ${l.status}`);let c;try{c=await l.json()}catch(m){if(m instanceof SyntaxError)return xa(r,m,"fetchExperiments"),dd.createFallbackConfig(r,"ExP responded with invalid JSON");throw m}let u=c.Configs.find(m=>m.Id==="vscode")??{Id:"vscode",Parameters:{}},f=Object.entries(u.Parameters).map(([m,h])=>m+(h?"":"cf"));return new dd(u.Parameters,c.AssignmentContext,f.join(";"))}},cN=class extends Vm{static{o(this,"ExpConfigNone")}fetchExperiments(t,r){return Promise.resolve(dd.createEmptyConfig())}};d();d();var uN=class{constructor(t){this.prefix=t}static{o(this,"GranularityImplementation")}getCurrentAndUpComingValues(t){let r=this.getValue(t),n=this.getUpcomingValues(t);return[r,n]}},NZ=class extends uN{static{o(this,"ConstantGranularity")}getValue(t){return this.prefix}getUpcomingValues(t){return[]}},gCe=o(e=>new NZ(e),"DEFAULT_GRANULARITY"),fN=class extends uN{constructor(r,n=.5,i=new Date().setUTCHours(0,0,0,0)){super(r);this.prefix=r;this.fetchBeforeFactor=n;this.anchor=i}static{o(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=[],i=this.getUpcomingTimePeriodBucketStrings(r),s=this.getUpcomingByCallBucketStrings();for(let a of i)for(let l of s)n.push(this.prefix+a+l);return n}getUpcomingTimePeriodBucketStrings(r){if(this.timePeriodLengthMs===void 0)return[""];if((r.getTime()-this.anchor)%this.timePeriodLengthMs<this.fetchBeforeFactor*this.timePeriodLengthMs)return[this.getTimePeriodBucketString(r)];{let n=new Date(r.getTime()+this.timePeriodLengthMs);return[this.getTimePeriodBucketString(r),this.getTimePeriodBucketString(n)]}}getUpcomingByCallBucketStrings(){return this.numByCallBuckets===void 0?[""]:Array.from(Array(this.numByCallBuckets).keys()).map(r=>r.toString())}timeHash(r){return this.numByCallBuckets==null?0:7883*(r.getTime()%this.numByCallBuckets)%this.numByCallBuckets}dateToTimePartString(r){return this.timePeriodLengthMs==null?"":Math.floor((r.getTime()-this.anchor)/this.timePeriodLengthMs).toString()}};var ACe="X-Copilot-ClientTimeBucket",dN=class{constructor(t,r){this.specs=new Map;this.prefix=t,this.clock=r,this.defaultGranularity=gCe(t)}static{o(this,"GranularityDirectory")}selectGranularity(t){for(let[r,n]of this.specs.entries())if(t.extends(r))return n;return this.defaultGranularity}update(t,r,n){if(r=r>1?r:NaN,n=n>0?n:NaN,isNaN(r)&&isNaN(n))this.specs.delete(t);else{let i=new fN(this.prefix);isNaN(r)||i.setByCallBuckets(r),isNaN(n)||i.setTimePeriod(n*3600*1e3),this.specs.set(t,i)}}extendFilters(t){let r=this.selectGranularity(t),[n,i]=r.getCurrentAndUpComingValues(this.clock.now());return{newFilterSettings:t.withChange(ACe,n),otherFilterSettingsToPrefetch:i.map(s=>t.withChange(ACe,s))}}};d();d();d();d();d();d();function mN(e){return["a5db0bcaae94032fe715fb34a5e4bce2","7184f66dfcee98cb5f08a1cb936d5225","faef89d9169d5eacf1d8c8dde3412e37","4535c7beffc844b46bb1ed4aa04d759a"].find(r=>e.includes(r))}o(mN,"findKnownOrg");d();d();var Tx=(i=>(i[i.DEBUG=4]="DEBUG",i[i.INFO=3]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=1]="ERROR",i))(Tx||{}),Wa=class{static{o(this,"LogTarget")}},Op=class{static{o(this,"TelemetryLogSender")}},Ht=class{constructor(t){this.category=t}static{o(this,"Logger")}log(t,r,...n){t.get(Wa).logIt(t,r,this.category,...n)}debug(t,...r){this.log(t,4,...r)}info(t,...r){this.log(t,3,...r)}warn(t,...r){this.log(t,2,...r)}error(t,...r){t.get(Op).sendError(t,this.category,...r),this.errorWithoutTelemetry(t,...r)}errorWithoutTelemetry(t,...r){this.log(t,1,...r)}exception(t,r,n){if(r instanceof Error&&r.name==="Canceled"&&r.message==="Canceled")return;let i=n;n.startsWith(".")&&(i=n.substring(1),n=`${this.category}${n}`),t.get(Op).sendException(t,r,n);let s=r instanceof Error?r:new Error(`Non-error thrown: ${String(r)}`);this.log(t,1,`${i}:`,s)}},Kn=new Ht("default");d();var va=class{static{o(this,"NotificationSender")}async showWarningMessageOnlyOnce(t,r,...n){return this.showWarningMessage(r,...n)}};d();var ic=class{static{o(this,"UrlOpener")}};var xnt=["UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_SIGNATURE_FAILURE"],yCe="Your proxy connection requires a trusted certificate. Please make sure the proxy certificate and any issuers are configured correctly and trusted by your operating system.",CCe="https://gh.io/copilot-network-errors",Y0=class{constructor(){this.notifiedErrorCodes=[]}static{o(this,"UserErrorNotifier")}notifyUser(t,r){if(!(r instanceof Error))return;let n=r;n.code&&xnt.includes(n.code)&&!this.didNotifyBefore(n.code)&&(this.notifiedErrorCodes.push(n.code),this.displayCertificateErrorNotification(t,n))}async displayCertificateErrorNotification(t,r){new Ht("certificates").error(t,`${yCe} Please visit ${CCe} to learn more. Original cause:`,r);let n={title:"Learn more"};return t.get(va).showWarningMessage(yCe,n).then(i=>{if(i?.title===n.title)return t.get(ic).open(CCe)})}didNotifyBefore(t){return this.notifiedErrorCodes.indexOf(t)!==-1}};var i0=new Ht("auth"),bCe=60;function bI(e){let t=e.serverUrl?.match(/^https?:\/\//)?e.serverUrl:"",r=e.apiUrl?.match(/^https?:\/\//)?e.apiUrl:"";return t?r||=t.replace("://","://api."):r?.includes("://api.")&&(t||=r.replace("://api.","://")),(!t||!r)&&(t="https://github.com",r="https://api.github.com"),{...e,apiUrl:r,serverUrl:t}}o(bI,"fillGitHubUrls");function xCe(){return Math.floor(Date.now()/1e3)}o(xCe,"nowSeconds");async function hN(e,t){let r=cn.createAndMarkAsIssued({},{});jt(e,"auth.new_login");let n=await vnt(e,t),i=await n.json(),s=i.user_notification;if(vCe(e,s,t),n.clientError&&!n.headers.get("x-github-request-id")&&i0.error(e,`HTTP ${n.status} response does not appear to originate from GitHub. Is a proxy or firewall intercepting this request? https://gh.io/copilot-firewall`),n.status===401){let c="Failed to get copilot token due to 401 status. Please sign out and try again.";return i0.info(e,c),bx(e,"auth.unknown_401",r),{kind:"failure",reason:"HTTP401",message:c,envelope:i}}if(!n.ok||!i.token){i0.info(e,`Invalid copilot token: missing token: ${n.status} ${n.statusText}`),bx(e,"auth.invalid_token",r.extendedBy({status:n.status.toString(),status_text:n.statusText}));let c=i.error_details;return c?.notification_id!=="not_signed_up"&&vCe(e,c,t),{kind:"failure",reason:"NotAuthorized",message:"User not authorized",envelope:i,...c}}let a=i.expires_at;i.expires_at=xCe()+i.refresh_in+bCe;let l=new q1(i);return Ew(e,l),jt(e,"auth.new_token",r.extendedBy({},{adjusted_expires_at:i.expires_at,expires_at:a,current_time:xCe()})),{kind:"success",envelope:i}}o(hN,"authFromGitHubToken");async function vnt(e,t){let r=t.devOverride?.copilotTokenUrl??e.get($n).getApiUrl(t,"copilot_internal/v2/token");try{return await e.get(Or).fetch(r,{headers:{Authorization:`token ${t.accessToken}`,...Ic(e)},timeout:12e4})}catch(n){throw e.get(Y0).notifyUser(e,n),n}}o(vnt,"fetchCopilotToken");function vCe(e,t,r){t&&e.get(va).showWarningMessageOnlyOnce(t.notification_id,t.message,{title:t.title},{title:"Dismiss"}).then(async n=>{let i=n?.title===t.title,s=i||n?.title==="Dismiss";if(i){let a=e.get(dn).getEditorPluginInfo(),l=t.url.replace("{EDITOR}",encodeURIComponent(a.name+"_"+a.version));await e.get(ic).open(l)}t.notification_id&&s&&await bnt(e,t.notification_id,r)}).catch(n=>{i0.exception(e,n,"copilotToken.notification")})}o(vCe,"notifyUser");async function bnt(e,t,r){let n=r.devOverride?.notificationUrl??e.get($n).getApiUrl(r,"copilot_internal/notification"),i=await e.get(Or).fetch(n,{headers:{Authorization:`token ${r.accessToken}`,...Ic(e)},method:"POST",body:JSON.stringify({notification_id:t})});(!i||!i.ok)&&i0.error(e,`Failed to send notification result to GitHub: ${i?.status} ${i?.statusText}`)}o(bnt,"sendNotificationResultToGitHub");var q1=class{constructor(t){this.envelope=t;this.token=t.token,this.organization_list=t.organization_list,this.enterprise_list=t.enterprise_list,this.tokenMap=this.parseToken(this.token)}static{o(this,"CopilotToken")}needsRefresh(){return(this.envelope.expires_at-bCe)*1e3<Date.now()}isExpired(){return this.envelope.expires_at*1e3<Date.now()}get hasKnownOrg(){return mN(this.organization_list||[])!==void 0}parseToken(t){let r=new Map,i=(t??"").split(":")[0].split(";");for(let s of i){let[a,l]=s.split("=");r.set(a,l)}return r}getTokenValue(t){return this.tokenMap.get(t)}};d();d();d();var _Ce=Xe(ICe()),SCe=Xe(wCe()),Yu=Xe(require("os"));var EI=class{constructor(t,r,n,i=!1){this.ctx=t;this.namespace=r;this.includeAuthorizationHeader=i;this.onCopilotToken=o(t=>{this.token=t;let r=t.getTokenValue("tid");r!==void 0&&(this.tags["ai.user.id"]=r)},"onCopilotToken");this.xhrOverride={sendPOST:o((t,r)=>{if(typeof t.data!="string")throw new Error(`AppInsightsReporter only supports string payloads, received ${typeof t.data}`);let n=t.headers??{};n["Content-Type"]="application/json",this.includeAuthorizationHeader&&this.token&&(n.Authorization=`Bearer ${this.token.token}`);let i={method:"POST",headers:n,body:t.data};this.ctx.get(Or).fetch(t.urlString,i).then(s=>s.text().then(a=>{r(s.status,Object.fromEntries(s.headers),a)})).catch(s=>{Kn.errorWithoutTelemetry(this.ctx,"Error sending telemetry",s),r(0,{})})},"sendPOST")};this.client=new SCe.ApplicationInsights({instrumentationKey:n,disableAjaxTracking:!0,disableExceptionTracking:!0,disableFetchTracking:!0,disableCorrelationHeaders:!0,disableCookiesUsage:!0,autoTrackPageVisitTime:!1,emitLineDelimitedJson:!1,disableInstrumentationKeyValidation:!0,endpointUrl:t.get($n).getTelemetryUrl(),extensionConfig:{[_Ce.BreezeChannelIdentifier]:{alwaysUseXhrOverride:!0,httpXHROverride:this.xhrOverride}}}),this.tags=Ent(t),this.commonProperties=Int(t),this.#e=js(t,this.onCopilotToken)}static{o(this,"AppInsightsReporter")}#e;sendTelemetryEvent(t,r,n){r={...r,...this.commonProperties};let i=this.qualifyEventName(t);this.client.track({name:i,tags:this.tags,data:{...r,...n},baseType:"EventData",baseData:{name:i,properties:r,measurements:n}})}sendTelemetryErrorEvent(t,r,n){this.sendTelemetryEvent(this.qualifyEventName(t),r,n)}async dispose(){this.#e.dispose(),await this.client.unload(!0,void 0,200)}qualifyEventName(t){return t.startsWith(this.namespace)?t:`${this.namespace}/${t}`}};function Ent(e){let t={},r=e.get(_s);t["ai.session.id"]=r.sessionId;let n=e.get(ec);return n.trackingId&&(t["ai.user.id"]=n.trackingId),t["ai.cloud.roleInstance"]="REDACTED",t["ai.device.osVersion"]=`${Yu.type()} ${Yu.release()}`,t["ai.device.osArchitecture"]=Yu.arch(),t["ai.device.osPlatform"]=Yu.platform(),t["ai.cloud.role"]="Web",t["ai.application.ver"]=e.get(go).getVersion(),t}o(Ent,"getTags");function Int(e){let t={};t.common_os=Yu.platform(),t.common_platformversion=Yu.release(),t.common_arch=Yu.arch(),t.common_cpu=Array.from(new Set(Yu.cpus().map(n=>n.model))).join();let r=e.get(_s);return t.common_vscodemachineid=r.machineId,t.common_vscodesessionid=r.sessionId,t.common_uikind=r.uiKind,t.common_remotename=r.remoteName,t.common_isnewappinstall="",t}o(Int,"getCommonProperties");var kCe="7d7048df-6dd0-4048-bb23-b716c1461f8f",RCe="3fdd7f28-937a-48c8-9a21-ba337db23bd1",Tnt="f0000000-0000-0000-0000-000000000000",Ku=class{constructor(){this._initialized=!1}static{o(this,"TelemetryInitialization")}get isInitialized(){return this._initialized}get isEnabled(){return this._enabled??!1}async initialize(t,r,n){let i=t.get(Ds).deactivate();if(this._namespace=r,this._enabled=n,this._initialized=!0,n){let s=t.get(Ds);s.setReporter(new EI(t,r,kCe)),s.setRestrictedReporter(new EI(t,r,RCe)),s.setFTReporter(new EI(t,r,Tnt,!0))}await i}reInitialize(t){return this._initialized?this.initialize(t,this._namespace,this._enabled):Promise.reject(new Error("Cannot re-initialize telemetry that has not been initialized."))}};function Xy(e,t,r){return e.get(Ku).initialize(e,t,r)}o(Xy,"setupTelemetryReporters");var wn=class{constructor(t,r){this.authPersistence=t;this._copilotTokenManager=r;this.pendingSignIn=void 0}static{o(this,"AuthManager")}#e;#t;getCopilotTokenManager(){return this._copilotTokenManager}updateEnterpriseConfig(t,r){if(this.#t=void 0,this.authPersistence.setAuthAuthority(void 0),r?.uri?.match(/^https?:\/\//))try{this.authPersistence.setAuthAuthority(new URL(r.uri).host),this.#t=r.uri}catch(n){i0.exception(t,n,`Ignoring invalid github-enterprise.uri: <${r.uri}>`)}}getConfiguredUrls(){let t=this.#t??"https://github.com";return{serverUrl:t,apiUrl:t.replace("://","://api.")}}async checkAndUpdateStatus(t,r){let n=r?.localChecksOnly??!1,i;return r?.githubAppId!==void 0?i=await this.getPersistedSession(t,r):i=await this.getSession(t),i===void 0?(this._copilotTokenManager.resetToken(),await this._copilotTokenManager.primeToken(),{status:"NotSignedIn"}):n?{status:"MaybeOK",user:i.login}:(r?.forceRefresh&&this._copilotTokenManager.resetToken(),{status:await this.getTokenWithSignUpLimited(t,i,r?.freshSignIn??!1),user:i.login})}async getTokenWithSignUpLimited(t,r,n){try{await this._copilotTokenManager.getToken()}catch(i){if(i instanceof hd)return n&&i.result.envelope?.can_signup_for_limited&&await this.signUpLimited(t,r)?this.getTokenWithSignUpLimited(t,r,!1):i.result.reason==="HTTP401"?"NotSignedIn":i.result.reason;throw i}return"OK"}async getSession(t){let r=wnt(process.env)??this.#e;if(r)return bI(r);if(r!==null)return await this.getPersistedSession(t)}async getPersistedSession(t,r){let n=await this.authPersistence.getAuthRecord(r);if(n===void 0)return;let i={...this.getConfiguredUrls(),accessToken:n.oauth_token,login:n.user,githubAppId:n.githubAppId};return n.dev_override&&md(t)==="dev"&&(i.devOverride={copilotTokenUrl:n.dev_override.copilot_token_url,notificationUrl:n.dev_override.notification_url,contentRestrictionsUrl:n.dev_override.content_restrictions_url}),i}async signUpLimited(t,r){let n=t.get($n).getApiUrl(r,"copilot_internal/subscribe_limited_user");try{return(await(await t.get(Or).fetch(n,{headers:{Authorization:`token ${r.accessToken}`,...Ic(t)},method:"POST",body:JSON.stringify({restricted_telemetry:t.get(Ku).isEnabled?"enabled":"disabled",public_code_suggestions:"enabled"})})).json())?.subscribed||!1}catch(i){return i0.exception(t,i,"signUpLimited failed"),!1}}async setPersistedSession({accessToken:t,login:r,githubAppId:n}){await this.authPersistence.purgeLegacyAuthRecords(),await this.authPersistence.saveAuthRecord({oauth_token:t,user:r,githubAppId:n}),this._copilotTokenManager.resetToken()}setTransientSession(t,r=!0){this.#e=t,r&&this._copilotTokenManager.resetToken()}async deletePersistedSession(){await this.authPersistence.deleteAuthRecord(),await this.authPersistence.purgeLegacyAuthRecords(),!this.#e&&(this._copilotTokenManager.resetToken(),await this._copilotTokenManager.primeToken())}};function wnt(e){if(e.GH_COPILOT_TOKEN&&!/=/.test(e.GH_COPILOT_TOKEN))return{apiUrl:e.GH_COPILOT_API_URL,serverUrl:e.GH_COPILOT_SERVER_URL,login:"<GH_COPILOT_TOKEN-user>",accessToken:e.GH_COPILOT_TOKEN};if(e.GITHUB_COPILOT_TOKEN)return{apiUrl:e.GITHUB_COPILOT_API_URL,serverUrl:e.GITHUB_COPILOT_SERVER_URL,login:"<GITHUB_COPILOT_TOKEN-user>",accessToken:e.GITHUB_COPILOT_TOKEN};if(e.CODESPACES==="true"&&e.GITHUB_TOKEN)return{apiUrl:e.GITHUB_API_URL,serverUrl:e.GITHUB_SERVER_URL,login:e.GITHUB_USER||"<codespaces-user>",accessToken:e.GITHUB_TOKEN}}o(wnt,"getSessionFromEnv");d();var zi=class{static{o(this,"StatusReporter")}#e=0;#t="Normal";#i;#n;#r=!0;get busy(){return this.#e>0}withProgress(t){return this.#t==="Warning"&&this.forceNormal(),this.#e++===0&&this.#o(),t().finally(()=>{--this.#e===0&&this.#o()})}forceStatus(t,r,n){this.#t===t&&this.#i===r&&!n&&!this.#n&&!this.#r||(this.#t=t,this.#i=r,this.#n=n,this.#r=!1,this.#o())}forceNormal(){this.#t!=="Inactive"&&this.forceStatus("Normal")}setError(t,r){this.forceStatus("Error",t,r)}setWarning(t){this.#t!=="Error"&&this.forceStatus("Warning",t)}setInactive(t){this.#t==="Error"||this.#t==="Warning"||this.forceStatus("Inactive",t)}clearInactive(){this.#t==="Inactive"&&this.forceStatus("Normal")}#o(){let t={kind:this.#t,message:this.#i,busy:this.busy,command:this.#n};this.didChange(t)}},AN=class extends zi{static{o(this,"NoOpStatusReporter")}didChange(){}};var Xr=class{constructor(t=!1){this.primed=t}static{o(this,"CopilotTokenManager")}primeToken(){this.primed=!0;try{return this.getToken().then(()=>!0,()=>!1)}catch{return Promise.resolve(!1)}}},hd=class extends Ks{constructor(r){super(r.message??"");this.result=r}static{o(this,"TokenResultError")}},yN=class extends Xr{constructor(r,n=!1){super(n);this.ctx=r;this.token=void 0;this.tokenPromise=void 0}static{o(this,"CopilotTokenManagerFromGitHubTokenBase")}async fetchCopilotTokenEnvelope(){let r=await this.getGitHubSession();if(!r)throw new hd({reason:"NotSignedIn"});if(!r?.accessToken)throw new hd({reason:"HTTP401"});let n=await hN(this.ctx,r);if(n.kind==="failure"){if(n.message)throw new hd(n);let i=new Error(`Unexpected error getting Copilot token: ${n.reason}`);throw i.code=`CopilotToken.${n.reason}`,i}return n.envelope}async getToken(){if(!this.primed){let r=new Error("Token requested before initialization");if(BCe(this.ctx))throw r;i0.exception(this.ctx,r,".getToken")}if(!this.tokenPromise&&(!this.token||this.token?.needsRefresh())){let r=this.fetchCopilotTokenEnvelope().then(n=>{let i=new q1(n);return this.tokenPromise!==r?i:(this.token=i,this.tokenPromise=void 0,this.ctx.get(zi).forceNormal(),this.token)},n=>{if(this.tokenPromise!==r)throw n;this.tokenPromise=void 0;let i=this.ctx.get(zi);if(n instanceof hd)switch(n.result.reason){case"NotSignedIn":i.setError("You are not signed into GitHub.",{command:"github.copilot.signIn",title:"Sign In"});break;case"HTTP401":i.setError("Your GitHub token is invalid. Try signing in again.");break;case"NotAuthorized":i.setError(n.message||"No access to Copilot found.");break}else i.setWarning(String(n));throw n});this.tokenPromise=r}return this.token&&!this.token.isExpired()?this.token:await this.tokenPromise}resetToken(r){r!==void 0?(jt(this.ctx,"auth.reset_token_"+r),i0.debug(this.ctx,`Resetting copilot token on HTTP error ${r}`)):i0.debug(this.ctx,"Resetting copilot token"),this.token=void 0,this.tokenPromise=void 0}},II=class extends yN{static{o(this,"CopilotTokenManagerFromAuthManager")}async getGitHubSession(){return await this.ctx.get(wn).getSession(this.ctx)}};function _nt(e){let t=e.getCopilotIntegrationId();if(t)return t;switch(e.getEditorPluginInfo().name){case"copilot-intellij":return"jetbrains-chat";case"copilot":case"copilot-vs":return;default:return"jetbrains-chat"}}o(_nt,"getIntegrationId");function e5(e){let t={...Ic(e),"X-GitHub-Api-Version":LZ},r=_nt(e.get(dn));return r&&(t["Copilot-Integration-Id"]=r),t}o(e5,"getCapiHeaders");function TI(e,t,...r){return vI(e,t,"api",...r)}o(TI,"getCapiUrl");async function wx(e,t){let r=await e.get(Xr).getToken(),n=TI(e,r,t),i={Authorization:`Bearer ${r.token}`,...e5(e)};return await e.get(Or).fetch(new URL(n).href,{method:"GET",headers:i})}o(wx,"fetchCapiUrl");async function DCe(e,t,r){let n=await e.get(Xr).getToken(),i=TI(e,n,t),s={Authorization:`Bearer ${n.token}`,...e5(e)};return await e.get(Or).fetch(new URL(i).href,{method:"POST",headers:s,body:r})}o(DCe,"postCapiUrl");d();var PCe=10*60*1e3,di={Gpt35turbo:"gpt-3.5-turbo",Gpt4:"gpt-4",Gpt4turbo:"gpt-4-turbo",Gpt4o:"gpt-4o",Gpt4oMini:"gpt-4o-mini",O1Mini:"o1-mini",O1Ga:"o1-ga",Claude35Sonnet:"claude-3.5-sonnet",O3Mini:"o3-mini",Gemini20Flash:"gemini-2.0-flash",Gemini20Pro:"gemini-2.0-pro",Claude37Sonnet:"claude-3.7-sonnet",Claude37SonnetThought:"claude-3.7-sonnet-thought",Gpt45:"gpt-4.5",Unknown:"unknown"},FCe=new Set([di.O1Ga,di.O3Mini,di.O1Mini,di.Gemini20Pro,di.Gemini20Flash]);function ds(e){switch(e){case"edits":case"user":case"inline":return[di.Gpt4o,di.Gpt4turbo,di.Gpt4,di.O1Mini,di.O1Ga,di.Claude35Sonnet,di.O3Mini,di.Gemini20Flash,di.Claude37Sonnet,di.Claude37SonnetThought,di.Gpt45];case"meta":case"suggestions":case"synonyms":return[di.Gpt4oMini,di.Gpt35turbo]}}o(ds,"getSupportedModelFamiliesForPrompt");var vN={textEmbedding3Small:"text-embedding-3-small"},Snt=I.Object({type:I.Union([I.Literal("chat"),I.Literal("embeddings"),I.Literal("completion")]),tokenizer:I.String(),family:I.String(),object:I.String(),supports:I.Optional(I.Object({tool_calls:I.Optional(I.Boolean()),parallel_tool_calls:I.Optional(I.Boolean()),streaming:I.Optional(I.Boolean()),vision:I.Optional(I.Boolean())})),limits:I.Optional(I.Object({max_inputs:I.Optional(I.Number()),max_prompt_tokens:I.Optional(I.Number()),max_output_tokens:I.Optional(I.Number()),max_context_window_tokens:I.Optional(I.Number())}))}),knt=I.Object({id:I.String(),name:I.String(),version:I.String(),model_picker_enabled:I.Boolean(),is_chat_default:I.Optional(I.Boolean()),is_chat_fallback:I.Optional(I.Boolean()),capabilities:Snt,billing:I.Optional(I.Object({is_premium:I.Optional(I.Boolean()),multiplier:I.Optional(I.Number())})),object:I.String(),preview:I.Optional(I.Boolean()),isExperimental:I.Optional(I.Boolean()),policy:I.Optional(I.Object({state:I.String(),terms:I.String()}))}),NCe=I.Object({data:I.Array(knt)}),Ju=class{static{o(this,"ModelMetadataProvider")}},CN=class extends Ju{constructor(r){super();this.ctx=r;this._metadata=[];this._lastFetchTime=0;js(r,()=>{this._lastFetchTime=0})}static{o(this,"CapiModelMetadataProvider")}async getMetadata(){return this.shouldRefreshModels()&&await this.fetchMetadata(),this._metadata.slice()}async fetchMetadata(){let r=await wx(this.ctx,"/models");if(r.status<200||r.status>=300){if(r.status===429&&this._metadata.length>0){Kn.error(this.ctx,"Rate limited while fetching models from CAPI",{status:r.status,statusText:r.statusText});return}throw Kn.error(this.ctx,"Failed to fetch models from CAPI",{status:r.status,statusText:r.statusText}),new ix(r)}await this.processModels(r)}async fetchModel(r){let n=await wx(this.ctx,`/models/${r}`);if(!n.ok){Kn.error(this.ctx,`Failed to fetch model ${r} from CAPI`,{status:n.status,statusText:n.statusText});return}return await n.json()}async acceptModelPolicy(r){return(await DCe(this.ctx,`/models/${r}/policy`,JSON.stringify({status:"enabled"}))).ok?(await this.fetchMetadata(),!0):!1}async processModels(r){try{let n=await r.json();this._metadata=n.data,this._lastFetchTime=Date.now()}catch(n){Kn.error(this.ctx,"Failed to parse models from CAPI",{error:n})}}shouldRefreshModels(){return this._metadata.length===0||!this._lastFetchTime?!0:this.isLastFetchOlderTenMinutes()}isLastFetchOlderTenMinutes(){return Date.now()-this._lastFetchTime>PCe}},xN=class extends Ju{constructor(r,n){super();this.ctx=r;this.delegate=n;this._exp_models_cache=new Map}static{o(this,"ExpModelMetadataProvider")}async getMetadata(){let r=this.ctx.get(Cr),n=await r.updateExPValuesAndAssignments(),i=r.ideChatExpModelIds(n),s=[];if(i){let a=i?.split(",");for(let l of a){let c=await this.fetchModel(l.trim());c!==void 0&&(c.isExperimental=!0,s.push(c))}}return s.concat(await this.delegate.getMetadata())}async fetchModel(r){let n=this._exp_models_cache.get(r);if(n){let[s,a]=n;if(Date.now()-a<PCe)return s}let i=await this.delegate.fetchModel(r);if(i)return this._exp_models_cache.set(r,[i,Date.now()]),i}async acceptModelPolicy(r){return await this.delegate.acceptModelPolicy(r)}};d();function LCe(e){let t=On(e,St.UserSelectedCompletionModel);return typeof t=="string"&&t.length>0?t:null}o(LCe,"getUserSelectedModelConfiguration");d();d();var Rnt=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},MCe=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)},QZ,bN,OCe,MZ=class extends gn{static{o(this,"AssertError")}constructor(t){let r=t.First();super(r===void 0?"Invalid Value":r.message),QZ.add(this),bN.set(this,void 0),Rnt(this,bN,t,"f"),this.error=r}Errors(){return new Jy(MCe(this,QZ,"m",OCe).call(this))}};bN=new WeakMap,QZ=new WeakSet,OCe=o(function*(){this.error&&(yield this.error),yield*MCe(this,bN,"f")},"_AssertError_Iterator");function QCe(e,t,r){if(!fi(e,t,r))throw new MZ(Qp(e,t,r))}o(QCe,"AssertValue");function EN(...e){return e.length===3?QCe(e[0],e[1],e[2]):QCe(e[0],[],e[1])}o(EN,"Assert");d();d();d();function Bnt(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Yi(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Yi(e[r]);return t}o(Bnt,"FromObject");function Dnt(e){return e.map(t=>Yi(t))}o(Dnt,"FromArray");function Pnt(e){return e.slice()}o(Pnt,"FromTypedArray");function Fnt(e){return new Map(Yi([...e.entries()]))}o(Fnt,"FromMap");function Nnt(e){return new Set(Yi([...e.entries()]))}o(Nnt,"FromSet");function Lnt(e){return new Date(e.toISOString())}o(Lnt,"FromDate");function Yi(e){if(pn(e))return Dnt(e);if(t0(e))return Lnt(e);if(td(e))return Pnt(e);if(kpe(e))return Fnt(e);if(Rpe(e))return Nnt(e);if(ai(e))return Bnt(e);if(Mu(e))return e;throw new Error("ValueClone: Unable to clone value")}o(Yi,"Clone");var Zu=class extends gn{static{o(this,"ValueCreateError")}constructor(t,r){super(r),this.schema=t}};function Ki(e){return Dy(e)?e():Yi(e)}o(Ki,"FromDefault");function Qnt(e,t){return hn(e,"default")?Ki(e.default):{}}o(Qnt,"FromAny");function Mnt(e,t){return{}}o(Mnt,"FromArgument");function Ont(e,t){if(e.uniqueItems===!0&&!hn(e,"default"))throw new Zu(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!hn(e,"default"))throw new Zu(e,"Array with the contains constraint requires a default value");return"default"in e?Ki(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(r=>K0(e.items,t)):[]}o(Ont,"FromArray");function Unt(e,t){return hn(e,"default")?Ki(e.default):async function*(){}()}o(Unt,"FromAsyncIterator");function qnt(e,t){return hn(e,"default")?Ki(e.default):BigInt(0)}o(qnt,"FromBigInt");function Wnt(e,t){return hn(e,"default")?Ki(e.default):!1}o(Wnt,"FromBoolean");function Gnt(e,t){if(hn(e,"default"))return Ki(e.default);{let r=K0(e.returns,t);return typeof r=="object"&&!Array.isArray(r)?class{constructor(){for(let[n,i]of Object.entries(r)){let s=this;s[n]=i}}}:class{}}}o(Gnt,"FromConstructor");function Hnt(e,t){return hn(e,"default")?Ki(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}o(Hnt,"FromDate");function jnt(e,t){return hn(e,"default")?Ki(e.default):()=>K0(e.returns,t)}o(jnt,"FromFunction");function Vnt(e,t){let r=globalThis.Object.values(e.$defs),n=e.$defs[e.$ref];return K0(n,[...t,...r])}o(Vnt,"FromImport");function $nt(e,t){return hn(e,"default")?Ki(e.default):e.minimum!==void 0?e.minimum:0}o($nt,"FromInteger");function znt(e,t){if(hn(e,"default"))return Ki(e.default);{let r=e.allOf.reduce((n,i)=>{let s=K0(i,t);return typeof s=="object"?{...n,...s}:s},{});if(!fi(e,t,r))throw new Zu(e,"Intersect produced invalid value. Consider using a default value.");return r}}o(znt,"FromIntersect");function Ynt(e,t){return hn(e,"default")?Ki(e.default):function*(){}()}o(Ynt,"FromIterator");function Knt(e,t){return hn(e,"default")?Ki(e.default):e.const}o(Knt,"FromLiteral");function Jnt(e,t){if(hn(e,"default"))return Ki(e.default);throw new Zu(e,"Never types cannot be created. Consider using a default value.")}o(Jnt,"FromNever");function Znt(e,t){if(hn(e,"default"))return Ki(e.default);throw new Zu(e,"Not types must have a default value")}o(Znt,"FromNot");function Xnt(e,t){return hn(e,"default")?Ki(e.default):null}o(Xnt,"FromNull");function eit(e,t){return hn(e,"default")?Ki(e.default):e.minimum!==void 0?e.minimum:0}o(eit,"FromNumber");function tit(e,t){if(hn(e,"default"))return Ki(e.default);{let r=new Set(e.required),n={};for(let[i,s]of Object.entries(e.properties))r.has(i)&&(n[i]=K0(s,t));return n}}o(tit,"FromObject");function rit(e,t){return hn(e,"default")?Ki(e.default):Promise.resolve(K0(e.item,t))}o(rit,"FromPromise");function nit(e,t){let[r,n]=Object.entries(e.patternProperties)[0];if(hn(e,"default"))return Ki(e.default);if(r===Sp||r===_p)return{};{let i=r.slice(1,r.length-1).split("|"),s={};for(let a of i)s[a]=K0(n,t);return s}}o(nit,"FromRecord");function iit(e,t){return hn(e,"default")?Ki(e.default):K0($i(e,t),t)}o(iit,"FromRef");function oit(e,t){if(hn(e,"default"))return Ki(e.default);throw new Zu(e,"RegExp types cannot be created. Consider using a default value.")}o(oit,"FromRegExp");function sit(e,t){if(e.pattern!==void 0){if(hn(e,"default"))return Ki(e.default);throw new Zu(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(hn(e,"default"))return Ki(e.default);throw new Zu(e,"String types with formats must specify a default value")}else return hn(e,"default")?Ki(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}o(sit,"FromString");function ait(e,t){return hn(e,"default")?Ki(e.default):"value"in e?Symbol.for(e.value):Symbol()}o(ait,"FromSymbol");function lit(e,t){if(hn(e,"default"))return Ki(e.default);if(!QP(e))throw new Zu(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return NE(e)[0]}o(lit,"FromTemplateLiteral");function cit(e,t){if(UCe++>Ait)throw new Zu(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return hn(e,"default")?Ki(e.default):K0($i(e,t),t)}o(cit,"FromThis");function uit(e,t){return hn(e,"default")?Ki(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((r,n)=>K0(e.items[n],t))}o(uit,"FromTuple");function fit(e,t){if(hn(e,"default"))return Ki(e.default)}o(fit,"FromUndefined");function dit(e,t){if(hn(e,"default"))return Ki(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return K0(e.anyOf[0],t)}o(dit,"FromUnion");function mit(e,t){return hn(e,"default")?Ki(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}o(mit,"FromUint8Array");function hit(e,t){return hn(e,"default")?Ki(e.default):{}}o(hit,"FromUnknown");function pit(e,t){if(hn(e,"default"))return Ki(e.default)}o(pit,"FromVoid");function git(e,t){if(hn(e,"default"))return Ki(e.default);throw new Error("User defined types must specify a default value")}o(git,"FromKind");function K0(e,t){let r=El(e,t),n=e;switch(n[ot]){case"Any":return Qnt(n,r);case"Argument":return Mnt(n,r);case"Array":return Ont(n,r);case"AsyncIterator":return Unt(n,r);case"BigInt":return qnt(n,r);case"Boolean":return Wnt(n,r);case"Constructor":return Gnt(n,r);case"Date":return Hnt(n,r);case"Function":return jnt(n,r);case"Import":return Vnt(n,r);case"Integer":return $nt(n,r);case"Intersect":return znt(n,r);case"Iterator":return Ynt(n,r);case"Literal":return Knt(n,r);case"Never":return Jnt(n,r);case"Not":return Znt(n,r);case"Null":return Xnt(n,r);case"Number":return eit(n,r);case"Object":return tit(n,r);case"Promise":return rit(n,r);case"Record":return nit(n,r);case"Ref":return iit(n,r);case"RegExp":return oit(n,r);case"String":return sit(n,r);case"Symbol":return ait(n,r);case"TemplateLiteral":return lit(n,r);case"This":return cit(n,r);case"Tuple":return uit(n,r);case"Undefined":return fit(n,r);case"Union":return dit(n,r);case"Uint8Array":return mit(n,r);case"Unknown":return hit(n,r);case"Void":return pit(n,r);default:if(!r0.Has(n[ot]))throw new Zu(n,"Unknown type");return git(n,r)}}o(K0,"Visit");var Ait=512,UCe=0;function pd(...e){return UCe=0,e.length===2?K0(e[0],e[1]):K0(e[0],[])}o(pd,"Create");var IN=class extends gn{static{o(this,"ValueCastError")}constructor(t,r){super(r),this.schema=t}};function yit(e,t,r){if(e[ot]==="Object"&&typeof r=="object"&&!_1(r)){let n=e,i=Object.getOwnPropertyNames(r),s=Object.entries(n.properties),[a,l]=[1/s.length,s.length];return s.reduce((c,[u,f])=>{let m=f[ot]==="Literal"&&f.const===r[u]?l:0,h=fi(f,t,r[u])?a:0,p=i.includes(u)?a:0;return c+(m+h+p)},0)}else return fi(e,t,r)?1:0}o(yit,"ScoreUnion");function Cit(e,t,r){let n=e.anyOf.map(a=>$i(a,t)),[i,s]=[n[0],0];for(let a of n){let l=yit(a,t,r);l>s&&(i=a,s=l)}return i}o(Cit,"SelectUnion");function xit(e,t,r){if("default"in e)return typeof r=="function"?e.default:Yi(e.default);{let n=Cit(e,t,r);return Rw(n,t,r)}}o(xit,"CastUnion");function vit(e,t,r){return fi(e,t,r)?Yi(r):pd(e,t)}o(vit,"DefaultClone");function bit(e,t,r){return fi(e,t,r)?r:pd(e,t)}o(bit,"Default");function Eit(e,t,r){if(fi(e,t,r))return Yi(r);let n=pn(r)?Yi(r):pd(e,t),i=Kr(e.minItems)&&n.length<e.minItems?[...n,...Array.from({length:e.minItems-n.length},()=>null)]:n,a=(Kr(e.maxItems)&&i.length>e.maxItems?i.slice(0,e.maxItems):i).map(c=>$m(e.items,t,c));if(e.uniqueItems!==!0)return a;let l=[...new Set(a)];if(!fi(e,t,l))throw new IN(e,"Array cast produced invalid data due to uniqueItems constraint");return l}o(Eit,"FromArray");function Iit(e,t,r){if(fi(e,t,r))return pd(e,t);let n=new Set(e.returns.required||[]),i=o(function(){},"result");for(let[s,a]of Object.entries(e.returns.properties))!n.has(s)&&r.prototype[s]===void 0||(i.prototype[s]=$m(a,t,r.prototype[s]));return i}o(Iit,"FromConstructor");function Tit(e,t,r){let n=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return $m(i,[...t,...n],r)}o(Tit,"FromImport");function wit(e,t,r){let n=pd(e,t),i=ai(n)&&ai(r)?{...n,...r}:r;return fi(e,t,i)?i:pd(e,t)}o(wit,"FromIntersect");function _it(e,t,r){throw new IN(e,"Never types cannot be cast")}o(_it,"FromNever");function Sit(e,t,r){if(fi(e,t,r))return r;if(r===null||typeof r!="object")return pd(e,t);let n=new Set(e.required||[]),i={};for(let[s,a]of Object.entries(e.properties))!n.has(s)&&r[s]===void 0||(i[s]=$m(a,t,r[s]));if(typeof e.additionalProperties=="object"){let s=Object.getOwnPropertyNames(e.properties);for(let a of Object.getOwnPropertyNames(r))s.includes(a)||(i[a]=$m(e.additionalProperties,t,r[a]))}return i}o(Sit,"FromObject");function kit(e,t,r){if(fi(e,t,r))return Yi(r);if(r===null||typeof r!="object"||Array.isArray(r)||r instanceof Date)return pd(e,t);let n=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[n],s={};for(let[a,l]of Object.entries(r))s[a]=$m(i,t,l);return s}o(kit,"FromRecord");function Rit(e,t,r){return $m($i(e,t),t,r)}o(Rit,"FromRef");function Bit(e,t,r){return $m($i(e,t),t,r)}o(Bit,"FromThis");function Dit(e,t,r){return fi(e,t,r)?Yi(r):pn(r)?e.items===void 0?[]:e.items.map((n,i)=>$m(n,t,r[i])):pd(e,t)}o(Dit,"FromTuple");function Pit(e,t,r){return fi(e,t,r)?Yi(r):xit(e,t,r)}o(Pit,"FromUnion");function $m(e,t,r){let n=Mi(e.$id)?El(e,t):t,i=e;switch(e[ot]){case"Array":return Eit(i,n,r);case"Constructor":return Iit(i,n,r);case"Import":return Tit(i,n,r);case"Intersect":return wit(i,n,r);case"Never":return _it(i,n,r);case"Object":return Sit(i,n,r);case"Record":return kit(i,n,r);case"Ref":return Rit(i,n,r);case"This":return Bit(i,n,r);case"Tuple":return Dit(i,n,r);case"Union":return Pit(i,n,r);case"Date":case"Symbol":case"Uint8Array":return vit(e,t,r);default:return bit(i,n,r)}}o($m,"Visit");function Rw(...e){return e.length===3?$m(e[0],e[1],e[2]):$m(e[0],[],e[1])}o(Rw,"Cast");d();function Fit(e){return Fy(e)&&e[ot]!=="Unsafe"}o(Fit,"IsCheckable");function Nit(e,t,r){return pn(r)?r.map(n=>J0(e.items,t,n)):r}o(Nit,"FromArray");function Lit(e,t,r){let n=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return J0(i,[...t,...n],r)}o(Lit,"FromImport");function Qit(e,t,r){let n=e.unevaluatedProperties,s=e.allOf.map(l=>J0(l,t,Yi(r))).reduce((l,c)=>ai(c)?{...l,...c}:c,{});if(!ai(r)||!ai(s)||!Fy(n))return s;let a=W0(e);for(let l of Object.getOwnPropertyNames(r))a.includes(l)||fi(n,t,r[l])&&(s[l]=J0(n,t,r[l]));return s}o(Qit,"FromIntersect");function Mit(e,t,r){if(!ai(r)||pn(r))return r;let n=e.additionalProperties;for(let i of Object.getOwnPropertyNames(r)){if(hn(e.properties,i)){r[i]=J0(e.properties[i],t,r[i]);continue}if(Fy(n)&&fi(n,t,r[i])){r[i]=J0(n,t,r[i]);continue}delete r[i]}return r}o(Mit,"FromObject");function Oit(e,t,r){if(!ai(r))return r;let n=e.additionalProperties,i=Object.getOwnPropertyNames(r),[s,a]=Object.entries(e.patternProperties)[0],l=new RegExp(s);for(let c of i){if(l.test(c)){r[c]=J0(a,t,r[c]);continue}if(Fy(n)&&fi(n,t,r[c])){r[c]=J0(n,t,r[c]);continue}delete r[c]}return r}o(Oit,"FromRecord");function Uit(e,t,r){return J0($i(e,t),t,r)}o(Uit,"FromRef");function qit(e,t,r){return J0($i(e,t),t,r)}o(qit,"FromThis");function Wit(e,t,r){if(!pn(r))return r;if(ss(e.items))return[];let n=Math.min(r.length,e.items.length);for(let i=0;i<n;i++)r[i]=J0(e.items[i],t,r[i]);return r.length>n?r.slice(0,n):r}o(Wit,"FromTuple");function Git(e,t,r){for(let n of e.anyOf)if(Fit(n)&&fi(n,t,r))return J0(n,t,r);return r}o(Git,"FromUnion");function J0(e,t,r){let n=Mi(e.$id)?El(e,t):t,i=e;switch(i[ot]){case"Array":return Nit(i,n,r);case"Import":return Lit(i,n,r);case"Intersect":return Qit(i,n,r);case"Object":return Mit(i,n,r);case"Record":return Oit(i,n,r);case"Ref":return Uit(i,n,r);case"This":return qit(i,n,r);case"Tuple":return Wit(i,n,r);case"Union":return Git(i,n,r);default:return r}}o(J0,"Visit");function TN(...e){return e.length===3?J0(e[0],e[1],e[2]):J0(e[0],[],e[1])}o(TN,"Clean");d();function wN(e){return Mi(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}o(wN,"IsStringNumeric");function Hit(e){return Jl(e)||wp(e)||Kr(e)}o(Hit,"IsValueToString");function Bw(e){return e===!0||Kr(e)&&e===1||Jl(e)&&e===BigInt("1")||Mi(e)&&(e.toLowerCase()==="true"||e==="1")}o(Bw,"IsValueTrue");function Dw(e){return e===!1||Kr(e)&&(e===0||Object.is(e,-0))||Jl(e)&&e===BigInt("0")||Mi(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}o(Dw,"IsValueFalse");function jit(e){return Mi(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}o(jit,"IsTimeStringWithTimeZone");function Vit(e){return Mi(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}o(Vit,"IsTimeStringWithoutTimeZone");function $it(e){return Mi(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}o($it,"IsDateTimeStringWithTimeZone");function zit(e){return Mi(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}o(zit,"IsDateTimeStringWithoutTimeZone");function Yit(e){return Mi(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}o(Yit,"IsDateString");function Kit(e,t){let r=WCe(e);return r===t?r:e}o(Kit,"TryConvertLiteralString");function Jit(e,t){let r=GCe(e);return r===t?r:e}o(Jit,"TryConvertLiteralNumber");function Zit(e,t){let r=qCe(e);return r===t?r:e}o(Zit,"TryConvertLiteralBoolean");function Xit(e,t){return Mi(e.const)?Kit(t,e.const):Kr(e.const)?Jit(t,e.const):wp(e.const)?Zit(t,e.const):t}o(Xit,"TryConvertLiteral");function qCe(e){return Bw(e)?!0:Dw(e)?!1:e}o(qCe,"TryConvertBoolean");function eot(e){let t=o(r=>r.split(".")[0],"truncateInteger");return wN(e)?BigInt(t(e)):Kr(e)?BigInt(Math.trunc(e)):Dw(e)?BigInt(0):Bw(e)?BigInt(1):e}o(eot,"TryConvertBigInt");function WCe(e){return S1(e)&&e.description!==void 0?e.description.toString():Hit(e)?e.toString():e}o(WCe,"TryConvertString");function GCe(e){return wN(e)?parseFloat(e):Bw(e)?1:Dw(e)?0:e}o(GCe,"TryConvertNumber");function tot(e){return wN(e)?parseInt(e):Kr(e)?Math.trunc(e):Bw(e)?1:Dw(e)?0:e}o(tot,"TryConvertInteger");function rot(e){return Mi(e)&&e.toLowerCase()==="null"?null:e}o(rot,"TryConvertNull");function not(e){return Mi(e)&&e==="undefined"?void 0:e}o(not,"TryConvertUndefined");function iot(e){return t0(e)?e:Kr(e)?new Date(e):Bw(e)?new Date(1):Dw(e)?new Date(0):wN(e)?new Date(parseInt(e)):Vit(e)?new Date(`1970-01-01T${e}.000Z`):jit(e)?new Date(`1970-01-01T${e}`):zit(e)?new Date(`${e}.000Z`):$it(e)?new Date(e):Yit(e)?new Date(`${e}T00:00:00.000Z`):e}o(iot,"TryConvertDate");function oot(e,t,r){return(pn(r)?r:[r]).map(i=>zm(e.items,t,i))}o(oot,"FromArray");function sot(e,t,r){return eot(r)}o(sot,"FromBigInt");function aot(e,t,r){return qCe(r)}o(aot,"FromBoolean");function lot(e,t,r){return iot(r)}o(lot,"FromDate");function cot(e,t,r){let n=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return zm(i,[...t,...n],r)}o(cot,"FromImport");function uot(e,t,r){return tot(r)}o(uot,"FromInteger");function fot(e,t,r){return e.allOf.reduce((n,i)=>zm(i,t,n),r)}o(fot,"FromIntersect");function dot(e,t,r){return Xit(e,r)}o(dot,"FromLiteral");function mot(e,t,r){return rot(r)}o(mot,"FromNull");function hot(e,t,r){return GCe(r)}o(hot,"FromNumber");function pot(e,t,r){if(!ai(r))return r;for(let n of Object.getOwnPropertyNames(e.properties))hn(r,n)&&(r[n]=zm(e.properties[n],t,r[n]));return r}o(pot,"FromObject");function got(e,t,r){if(!ai(r))return r;let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=e.patternProperties[i];for(let[a,l]of Object.entries(r))r[a]=zm(s,t,l);return r}o(got,"FromRecord");function Aot(e,t,r){return zm($i(e,t),t,r)}o(Aot,"FromRef");function yot(e,t,r){return WCe(r)}o(yot,"FromString");function Cot(e,t,r){return Mi(r)||Kr(r)?Symbol(r):r}o(Cot,"FromSymbol");function xot(e,t,r){return zm($i(e,t),t,r)}o(xot,"FromThis");function vot(e,t,r){return pn(r)&&!ss(e.items)?r.map((i,s)=>s<e.items.length?zm(e.items[s],t,i):i):r}o(vot,"FromTuple");function bot(e,t,r){return not(r)}o(bot,"FromUndefined");function Eot(e,t,r){for(let n of e.anyOf){let i=zm(n,t,Yi(r));if(fi(n,t,i))return i}return r}o(Eot,"FromUnion");function zm(e,t,r){let n=El(e,t),i=e;switch(e[ot]){case"Array":return oot(i,n,r);case"BigInt":return sot(i,n,r);case"Boolean":return aot(i,n,r);case"Date":return lot(i,n,r);case"Import":return cot(i,n,r);case"Integer":return uot(i,n,r);case"Intersect":return fot(i,n,r);case"Literal":return dot(i,n,r);case"Null":return mot(i,n,r);case"Number":return hot(i,n,r);case"Object":return pot(i,n,r);case"Record":return got(i,n,r);case"Ref":return Aot(i,n,r);case"String":return yot(i,n,r);case"Symbol":return Cot(i,n,r);case"This":return xot(i,n,r);case"Tuple":return vot(i,n,r);case"Undefined":return bot(i,n,r);case"Union":return Eot(i,n,r);default:return r}}o(zm,"Visit");function _N(...e){return e.length===3?zm(e[0],e[1],e[2]):zm(e[0],[],e[1])}o(_N,"Convert");d();function HCe(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!fi(t,r,n))throw new hI(t,n,Qp(t,r,n).First());return O1(t,r)?pI(t,r,n):n}o(HCe,"Decode");d();function W1(e,t){let r=hn(e,"default")?e.default:void 0,n=Dy(r)?r():Yi(r);return ss(t)?n:ai(t)&&ai(n)?Object.assign(n,t):t}o(W1,"ValueOrDefault");function OZ(e){return Fy(e)&&"default"in e}o(OZ,"HasDefaultProperty");function Iot(e,t,r){if(pn(r)){for(let i=0;i<r.length;i++)r[i]=o0(e.items,t,r[i]);return r}let n=W1(e,r);if(!pn(n))return n;for(let i=0;i<n.length;i++)n[i]=o0(e.items,t,n[i]);return n}o(Iot,"FromArray");function Tot(e,t,r){return t0(r)?r:W1(e,r)}o(Tot,"FromDate");function wot(e,t,r){let n=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return o0(i,[...t,...n],r)}o(wot,"FromImport");function _ot(e,t,r){let n=W1(e,r);return e.allOf.reduce((i,s)=>{let a=o0(s,t,n);return ai(a)?{...i,...a}:a},{})}o(_ot,"FromIntersect");function Sot(e,t,r){let n=W1(e,r);if(!ai(n))return n;let i=Object.getOwnPropertyNames(e.properties);for(let s of i){let a=o0(e.properties[s],t,n[s]);ss(a)||(n[s]=o0(e.properties[s],t,n[s]))}if(!OZ(e.additionalProperties))return n;for(let s of Object.getOwnPropertyNames(n))i.includes(s)||(n[s]=o0(e.additionalProperties,t,n[s]));return n}o(Sot,"FromObject");function kot(e,t,r){let n=W1(e,r);if(!ai(n))return n;let i=e.additionalProperties,[s,a]=Object.entries(e.patternProperties)[0],l=new RegExp(s);for(let c of Object.getOwnPropertyNames(n))l.test(c)&&OZ(a)&&(n[c]=o0(a,t,n[c]));if(!OZ(i))return n;for(let c of Object.getOwnPropertyNames(n))l.test(c)||(n[c]=o0(i,t,n[c]));return n}o(kot,"FromRecord");function Rot(e,t,r){return o0($i(e,t),t,W1(e,r))}o(Rot,"FromRef");function Bot(e,t,r){return o0($i(e,t),t,r)}o(Bot,"FromThis");function Dot(e,t,r){let n=W1(e,r);if(!pn(n)||ss(e.items))return n;let[i,s]=[e.items,Math.max(e.items.length,n.length)];for(let a=0;a<s;a++)a<i.length&&(n[a]=o0(i[a],t,n[a]));return n}o(Dot,"FromTuple");function Pot(e,t,r){let n=W1(e,r);for(let i of e.anyOf){let s=o0(i,t,Yi(n));if(fi(i,t,s))return s}return n}o(Pot,"FromUnion");function o0(e,t,r){let n=El(e,t),i=e;switch(i[ot]){case"Array":return Iot(i,n,r);case"Date":return Tot(i,n,r);case"Import":return wot(i,n,r);case"Intersect":return _ot(i,n,r);case"Object":return Sot(i,n,r);case"Record":return kot(i,n,r);case"Ref":return Rot(i,n,r);case"This":return Bot(i,n,r);case"Tuple":return Dot(i,n,r);case"Union":return Pot(i,n,r);default:return W1(i,r)}}o(o0,"Visit");function SN(...e){return e.length===3?o0(e[0],e[1],e[2]):o0(e[0],[],e[1])}o(SN,"Default");d();d();var Ym={};b1(Ym,{Delete:()=>Not,Format:()=>Pw,Get:()=>Qot,Has:()=>Lot,Set:()=>Fot,ValuePointerRootDeleteError:()=>RN,ValuePointerRootSetError:()=>kN});d();var kN=class extends gn{static{o(this,"ValuePointerRootSetError")}constructor(t,r,n){super("Cannot set root value"),this.value=t,this.path=r,this.update=n}},RN=class extends gn{static{o(this,"ValuePointerRootDeleteError")}constructor(t,r){super("Cannot delete root value"),this.value=t,this.path=r}};function jCe(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}o(jCe,"Escape");function*Pw(e){if(e==="")return;let[t,r]=[0,0];for(let n=0;n<e.length;n++)e.charAt(n)==="/"?(n===0||(r=n,yield jCe(e.slice(t,r))),t=n+1):r=n;yield jCe(e.slice(t))}o(Pw,"Format");function Fot(e,t,r){if(t==="")throw new kN(e,t,r);let[n,i,s]=[null,e,""];for(let a of Pw(t))i[a]===void 0&&(i[a]={}),n=i,i=i[a],s=a;n[s]=r}o(Fot,"Set");function Not(e,t){if(t==="")throw new RN(e,t);let[r,n,i]=[null,e,""];for(let s of Pw(t)){if(n[s]===void 0||n[s]===null)return;r=n,n=n[s],i=s}if(Array.isArray(r)){let s=parseInt(i);r.splice(s,1)}else delete r[i]}o(Not,"Delete");function Lot(e,t){if(t==="")return!0;let[r,n,i]=[null,e,""];for(let s of Pw(t)){if(n[s]===void 0)return!1;r=n,n=n[s],i=s}return Object.getOwnPropertyNames(r).includes(i)}o(Lot,"Has");function Qot(e,t){if(t==="")return e;let r=e;for(let n of Pw(t)){if(r[n]===void 0)return;r=r[n]}return r}o(Qot,"Get");d();function Mot(e,t){if(!ai(t))return!1;let r=[...Object.keys(e),...Object.getOwnPropertySymbols(e)],n=[...Object.keys(t),...Object.getOwnPropertySymbols(t)];return r.length!==n.length?!1:r.every(i=>_x(e[i],t[i]))}o(Mot,"ObjectType");function Oot(e,t){return t0(t)&&e.getTime()===t.getTime()}o(Oot,"DateType");function Uot(e,t){return!pn(t)||e.length!==t.length?!1:e.every((r,n)=>_x(r,t[n]))}o(Uot,"ArrayType");function qot(e,t){return!td(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((r,n)=>_x(r,t[n]))}o(qot,"TypedArrayType");function Wot(e,t){return e===t}o(Wot,"ValueType");function _x(e,t){if(t0(e))return Oot(e,t);if(td(e))return qot(e,t);if(pn(e))return Uot(e,t);if(ai(e))return Mot(e,t);if(Mu(e))return Wot(e,t);throw new Error("ValueEquals: Unable to compare value")}o(_x,"Equal");var Got=oo({type:Ri("insert"),path:n0(),value:Mm()}),Hot=oo({type:Ri("update"),path:n0(),value:Mm()}),jot=oo({type:Ri("delete"),path:n0()}),$Ce=io([Got,Hot,jot]),BN=class extends gn{static{o(this,"ValueDiffError")}constructor(t,r){super(r),this.value=t}};function DN(e,t){return{type:"update",path:e,value:t}}o(DN,"CreateUpdate");function zCe(e,t){return{type:"insert",path:e,value:t}}o(zCe,"CreateInsert");function YCe(e){return{type:"delete",path:e}}o(YCe,"CreateDelete");function VCe(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new BN(e,"Cannot diff objects with symbols")}o(VCe,"AssertDiffable");function*Vot(e,t,r){if(VCe(t),VCe(r),!KY(r))return yield DN(e,r);let n=globalThis.Object.getOwnPropertyNames(t),i=globalThis.Object.getOwnPropertyNames(r);for(let s of i)hn(t,s)||(yield zCe(`${e}/${s}`,r[s]));for(let s of n)hn(r,s)&&(_x(t,r)||(yield*PN(`${e}/${s}`,t[s],r[s])));for(let s of n)hn(r,s)||(yield YCe(`${e}/${s}`))}o(Vot,"ObjectType");function*$ot(e,t,r){if(!pn(r))return yield DN(e,r);for(let n=0;n<Math.min(t.length,r.length);n++)yield*PN(`${e}/${n}`,t[n],r[n]);for(let n=0;n<r.length;n++)n<t.length||(yield zCe(`${e}/${n}`,r[n]));for(let n=t.length-1;n>=0;n--)n<r.length||(yield YCe(`${e}/${n}`))}o($ot,"ArrayType");function*zot(e,t,r){if(!td(r)||t.length!==r.length||globalThis.Object.getPrototypeOf(t).constructor.name!==globalThis.Object.getPrototypeOf(r).constructor.name)return yield DN(e,r);for(let n=0;n<Math.min(t.length,r.length);n++)yield*PN(`${e}/${n}`,t[n],r[n])}o(zot,"TypedArrayType");function*Yot(e,t,r){t!==r&&(yield DN(e,r))}o(Yot,"ValueType");function*PN(e,t,r){if(KY(t))return yield*Vot(e,t,r);if(pn(t))return yield*$ot(e,t,r);if(td(t))return yield*zot(e,t,r);if(Mu(t))return yield*Yot(e,t,r);throw new BN(t,"Unable to diff value")}o(PN,"Visit");function KCe(e,t){return[...PN("",e,t)]}o(KCe,"Diff");function Kot(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}o(Kot,"IsRootUpdate");function Jot(e){return e.length===0}o(Jot,"IsIdentity");function JCe(e,t){if(Kot(t))return Yi(t[0].value);if(Jot(t))return Yi(e);let r=Yi(e);for(let n of t)switch(n.type){case"insert":{Ym.Set(r,n.path,n.value);break}case"update":{Ym.Set(r,n.path,n.value);break}case"delete":{Ym.Delete(r,n.path);break}}return r}o(JCe,"Patch");d();function ZCe(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],i=O1(t,r)?AI(t,r,n):n;if(!fi(t,r,i))throw new gI(t,i,Qp(t,r,i).First());return i}o(ZCe,"Encode");d();function FN(e){return ai(e)&&!pn(e)}o(FN,"IsStandardObject");var NN=class extends gn{static{o(this,"ValueMutateError")}constructor(t){super(t)}};function Zot(e,t,r,n){if(!FN(r))Ym.Set(e,t,Yi(n));else{let i=Object.getOwnPropertyNames(r),s=Object.getOwnPropertyNames(n);for(let a of i)s.includes(a)||delete r[a];for(let a of s)i.includes(a)||(r[a]=null);for(let a of s)UZ(e,`${t}/${a}`,r[a],n[a])}}o(Zot,"ObjectType");function Xot(e,t,r,n){if(!pn(r))Ym.Set(e,t,Yi(n));else{for(let i=0;i<n.length;i++)UZ(e,`${t}/${i}`,r[i],n[i]);r.splice(n.length)}}o(Xot,"ArrayType");function est(e,t,r,n){if(td(r)&&r.length===n.length)for(let i=0;i<r.length;i++)r[i]=n[i];else Ym.Set(e,t,Yi(n))}o(est,"TypedArrayType");function tst(e,t,r,n){r!==n&&Ym.Set(e,t,n)}o(tst,"ValueType");function UZ(e,t,r,n){if(pn(n))return Xot(e,t,r,n);if(td(n))return est(e,t,r,n);if(FN(n))return Zot(e,t,r,n);if(Mu(n))return tst(e,t,r,n)}o(UZ,"Visit");function XCe(e){return td(e)||Mu(e)}o(XCe,"IsNonMutableValue");function rst(e,t){return FN(e)&&pn(t)||pn(e)&&FN(t)}o(rst,"IsMismatchedValue");function e3e(e,t){if(XCe(e)||XCe(t))throw new NN("Only object and array types can be mutated at the root level");if(rst(e,t))throw new NN("Cannot assign due type mismatch of assignable values");UZ(e,"",e,t)}o(e3e,"Mutate");d();var LN=class extends gn{static{o(this,"ParseError")}constructor(t){super(t)}},qZ;(function(e){let t=new Map([["Assert",(s,a,l)=>(EN(s,a,l),l)],["Cast",(s,a,l)=>Rw(s,a,l)],["Clean",(s,a,l)=>TN(s,a,l)],["Clone",(s,a,l)=>Yi(l)],["Convert",(s,a,l)=>_N(s,a,l)],["Decode",(s,a,l)=>O1(s,a)?pI(s,a,l):l],["Default",(s,a,l)=>SN(s,a,l)],["Encode",(s,a,l)=>O1(s,a)?AI(s,a,l):l]]);function r(s){t.delete(s)}o(r,"Delete"),e.Delete=r;function n(s,a){t.set(s,a)}o(n,"Set"),e.Set=n;function i(s){return t.get(s)}o(i,"Get"),e.Get=i})(qZ||(qZ={}));var t3e=["Clone","Clean","Default","Convert","Assert","Decode"];function nst(e,t,r,n){return e.reduce((i,s)=>{let a=qZ.Get(s);if(ss(a))throw new LN(`Unable to find Parse operation '${s}'`);return a(t,r,i)},n)}o(nst,"ParseValue");function r3e(...e){let[t,r,n,i]=e.length===4?[e[0],e[1],e[2],e[3]]:e.length===3?pn(e[0])?[e[0],e[1],[],e[2]]:[t3e,e[0],e[1],e[2]]:e.length===2?[t3e,e[0],[],e[1]]:(()=>{throw new LN("Invalid Arguments")})();return nst(t,r,n,i)}o(r3e,"Parse");d();var t5={};b1(t5,{Assert:()=>EN,Cast:()=>Rw,Check:()=>fi,Clean:()=>TN,Clone:()=>Yi,Convert:()=>_N,Create:()=>pd,Decode:()=>HCe,Default:()=>SN,Diff:()=>KCe,Edit:()=>$Ce,Encode:()=>ZCe,Equal:()=>_x,Errors:()=>Qp,Hash:()=>Ky,Mutate:()=>e3e,Parse:()=>r3e,Patch:()=>JCe,ValueErrorIterator:()=>Jy});d();var ist={capabilities:{family:"gpt-3.5-turbo",object:"model_capabilities",supports:{streaming:!0},tokenizer:"cl100k_base",type:"completion"},id:"copilot-codex",model_picker_enabled:!0,name:"GPT-3.5 Turbo",object:"model",preview:!1,version:"copilot-codex"},ost="gpt-4o-copilot",gd=class e{constructor(t,r=!0){this._ctx=t;this.onModelsFetchedCallbacks=[];this.fetchedModelData=[];this.customModels=[];this.editorPreviewFeaturesDisabled=!1;r&&js(this._ctx,n=>this.refreshAvailableModels(n))}static{o(this,"AvailableModelsManager")}async refreshAvailableModels(t){await this.refreshModels(t);for(let r of this.onModelsFetchedCallbacks)r()}addHandler(t){this.onModelsFetchedCallbacks.push(t)}getDefaultModelId(){if(this.fetchedModelData){let t=e.filterCompletionModels(this.fetchedModelData,this.editorPreviewFeaturesDisabled)[0];if(t)return t.id}return ost}parseModelsResponse(t){try{return t5.Parse(NCe,t)}catch(r){Kn.exception(this._ctx,r,"Failed to parse /models response from CAPI");return}}async refreshModels(t){let r=await this.fetchModels(t);r&&(this.fetchedModelData=r)}async fetchModels(t){return this.customModels=t.getTokenValue("cml")?.split(",")??[],this.editorPreviewFeaturesDisabled=t.getTokenValue("editor_preview_features")=="0",t.getTokenValue("fcv1")=="1"?Promise.resolve([ist]):await this.fetch()}async fetch(){let t=await wx(this._ctx,"/models");return t.ok?this.parseModelsResponse(await t.json())?.data??[]:(Kn.error(this._ctx,"Failed to fetch models from CAPI",{status:t.status,statusText:t.statusText}),null)}getGenericCompletionModels(){let t=e.filterCompletionModels(this.fetchedModelData,this.editorPreviewFeaturesDisabled);return e.mapCompletionModels(t)}static filterCompletionModels(t,r){return t.filter(n=>n.capabilities.type==="completion").filter(n=>!r||n.preview===!1||n.preview===void 0)}static filterModelsWithEditorPreviewFeatures(t,r){return t.filter(n=>!r||n.preview===!1||n.preview===void 0)}static mapCompletionModels(t){return t.map(r=>({modelId:r.id,label:r.name,preview:!!r.preview}))}getCurrentModelRequestInfo(t=void 0){let r=this.getDefaultModelId(),n=LCe(this._ctx);if(n){let l=this.getGenericCompletionModels().map(c=>c.modelId);l.includes(n)||(l.length>0&&Kn.error(this._ctx,`User selected model ${n} is not in the list of generic models: ${l.join(", ")}, falling back to default model.`),n=null),r===n&&(n=null)}let i=On(this._ctx,St.DebugOverrideEngine)||On(this._ctx,St.DebugOverrideEngineLegacy);if(i)return new r5(i,"override");let s=t?this._ctx.get(Cr).customEngine(t):"",a=t?this._ctx.get(Cr).customEngineTargetEngine(t):void 0;return n?s&&a&&n===a?new r5(s,"exp"):new r5(n,"modelpicker"):s?new r5(s,"exp"):this.customModels.length>0?new r5(this.customModels[0],"custommodel"):new r5(r,"default")}},r5=class{constructor(t,r){this.modelId=t;this.modelChoiceSource=r}static{o(this,"ModelRequestInfo")}get headers(){return{}}};function n5(e,t=void 0){let r=e.get(gd).getCurrentModelRequestInfo(t);return{headers:r.headers,modelId:r.modelId,engineChoiceSource:r.modelChoiceSource}}o(n5,"getEngineRequestInfo");d();d();var bo=class{static{o(this,"FileSystem")}};var x3e=Xe(C3e());function v3e(e){return e!==void 0&&e!==0}o(v3e,"isRepoInfo");async function b3e(e){let r=(await e.get(Xr).getToken()).organization_list??[];return mN(r)??""}o(b3e,"getUserKind");async function Fw(e,t){return(await e.get(Xr).getToken()).getTokenValue(t)??""}o(Fw,"getTokenKeyValue");function E3e(e){if(e===void 0||e===0)return"";let t=G1(e);if(t==="github/github")return t;let r=Bst(e)?.toLowerCase();return r!==void 0?r:""}o(E3e,"getDogFood");function G1(e){if(e!==void 0&&e!==0&&e.hostname==="github.com")return e.owner+"/"+e.repo}o(G1,"tryGetGitHubNWO");function Bst(e){if(e!==void 0&&e!==0&&(e.hostname.endsWith("azure.com")||e.hostname.endsWith("visualstudio.com")))return e.owner+"/"+e.repo}o(Bst,"tryGetADONWO");function i5(e,t){let r=zu(t);return Dst(e,r)}o(i5,"extractRepoInfoInBackground");var Dst=Lst(Pst,1e4);async function Pst(e,t){let r=hCe(t);if(!r)return;let n=await Fst(e,r);if(!n)return;let i=e.get(bo),s=Po(n,".git","config"),a;try{a=await i.readFileString(s)}catch{return}let l=Nst(a)??"",c=jZ(l),u={uri:n};return c===void 0?{baseFolder:u,url:l,hostname:"",owner:"",repo:"",pathname:""}:{baseFolder:u,url:l,...c}}o(Pst,"extractRepoInfo");function jZ(e){let t;try{if(t=(0,x3e.default)(e),t.resource==""||t.owner==""||t.name==""||t.pathname=="")return}catch{return}return{hostname:t.resource,owner:t.owner,repo:t.name,pathname:t.pathname}}o(jZ,"parseRepoUrl");async function Fst(e,t){let r=t+"_add_to_make_longer",n=e.get(bo);for(;t!=="file:///"&&t.length<r.length;){let i=Po(t,".git","config"),s=!1;try{await n.stat(i),s=!0}catch{s=!1}if(s)return t;r=t,t=zu(t)}}o(Fst,"getRepoBaseUri");function Nst(e){let t=/^\s*\[\s*remote\s+"((\\\\|\\"|[^\\"])+)"/,r=/^\s*\[remote.([^"\s]+)/,n=/^\s*url\s*=\s*([^\s#;]+)/,i=/^\s*\[/,s,a,l=!1;for(let c of e.split(`
224
224
  `))if(l&&s!==void 0){if(s+=c,c.endsWith("\\"))s=s.substring(0,s.length-1);else if(l=!1,a==="origin")return s}else{let u=c.match(t)??c.match(r);if(u)a=u[1];else if(c.match(i))a=void 0;else{if(s&&a!=="origin")continue;{let f=c.match(n);if(f){if(s=f[1],s.endsWith("\\"))s=s.substring(0,s.length-1),l=!0;else if(a==="origin")return s}}}}return s}o(Nst,"getRepoUrlFromConfigText");var HZ=class{static{o(this,"CompletedComputation")}constructor(t){this.result=t}};function Lst(e,t){let r=new In(t),n=new Set;return(i,...s)=>{let a=JSON.stringify(s),l=r.get(a);if(l)return l.result;if(n.has(a))return 0;let c=e(i,...s);return n.add(a),c.then(u=>{r.set(a,new HZ(u)),n.delete(a)}),0}}o(Lst,"computeInBackgroundAndMemoize");d();d();d();d();d();d();d();var wI=class extends Error{constructor(r,n){super(r,{cause:n});this.code="CopilotPromptLoadFailure"}static{o(this,"CopilotPromptLoadFailure")}};d();var I3e=Xe(require("node:fs/promises")),QN=Xe(require("node:path"));async function MN(e){return await I3e.readFile(VZ(e))}o(MN,"readFile");function VZ(e){return QN.default.resolve(QN.default.extname(__filename)!==".ts"?__dirname:QN.default.resolve(__dirname,"../../dist"),e)}o(VZ,"locateFile");var SI=Xe(M3e());var _I=new Map;function Ao(e="cl100k_base"){let t=_I.get(e);return t!==void 0?t:_I.get("cl100k_base")}o(Ao,"getTokenizer");async function O3e(e="cl100k_base"){return await iX,Ao(e)}o(O3e,"getTokenizerAsync");async function Zst(e){if(!e.endsWith(".tiktoken.noindex"))throw new Error("File does not end with .tiktoken.noindex");let t=await MN(e),r=new Map,n=[];for(let i=0;i<t.length;i++){if(t[i]!==255||n.length===0){n.push(t[i]);continue}r.set(Uint8Array.from(n),r.size),n=[]}return r.set(Uint8Array.from(n),r.size),r}o(Zst,"parseTikTokenNoIndex");var HN=class e{constructor(t){this._tokenizer=t}static{o(this,"TTokenizer")}static async create(t){try{let r=(0,SI.createTokenizer)(await Zst(`resources/${t}.tiktoken.noindex`),(0,SI.getSpecialTokensByEncoder)(t),(0,SI.getRegexByEncoder)(t),32768);return new e(r)}catch(r){throw r instanceof Error?new wI("Could not load tokenizer",r):r}}tokenize(t){return this._tokenizer.encode(t)}detokenize(t){return this._tokenizer.decode(t)}tokenLength(t){return this.tokenize(t).length}tokenizeStrings(t){return this.tokenize(t).map(n=>this.detokenize([n]))}takeLastTokens(t,r){if(r<=0)return{text:"",tokens:[]};let n=4,i=1,s=Math.min(t.length,r*n),a=t.slice(-s),l=this.tokenize(a);for(;l.length<r+2&&s<t.length;)s=Math.min(t.length,s+r*i),a=t.slice(-s),l=this.tokenize(a);return l.length<r?{text:t,tokens:l}:(l=l.slice(-r),{text:this.detokenize(l),tokens:l})}takeFirstTokens(t,r){if(r<=0)return{text:"",tokens:[]};let n=4,i=1,s=Math.min(t.length,r*n),a=t.slice(0,s),l=this.tokenize(a);for(;l.length<r+2&&s<t.length;)s=Math.min(t.length,s+r*i),a=t.slice(0,s),l=this.tokenize(a);return l.length<r?{text:t,tokens:l}:(l=l.slice(0,r),{text:this.detokenize(l),tokens:l})}takeLastLinesTokens(t,r){let{text:n}=this.takeLastTokens(t,r);if(n.length===t.length||t[t.length-n.length-1]===`
225
225
  `)return n;let i=n.indexOf(`
226
226
  `);return n.substring(i+1)}},rX=class{constructor(){this.hash=o(t=>{let r=0;for(let n=0;n<t.length;n++){let i=t.charCodeAt(n);r=(r<<5)-r+i,r&=r&65535}return r},"hash")}static{o(this,"MockTokenizer")}tokenize(t){return this.tokenizeStrings(t).map(this.hash)}detokenize(t){return t.map(r=>r.toString()).join(" ")}tokenizeStrings(t){return t.split(/\b/)}tokenLength(t){return this.tokenizeStrings(t).length}takeLastTokens(t,r){let n=this.tokenizeStrings(t).slice(-r);return{text:n.join(""),tokens:n.map(this.hash)}}takeFirstTokens(t,r){let n=this.tokenizeStrings(t).slice(0,r);return{text:n.join(""),tokens:n.map(this.hash)}}takeLastLinesTokens(t,r){let{text:n}=this.takeLastTokens(t,r);if(n.length===t.length||t[t.length-n.length-1]===`
@@ -238,7 +238,7 @@ ${x.join(`
238
238
  `),r=t.map(u=>u.match(/^\s*/)[0].length),n=t.map(u=>u.trimLeft());function i(u){let[f,m]=s(u+1,r[u]);return[W3e(r[u],u,n[u],f),m]}o(i,"parseNode");function s(u,f){let m,h=[],p=u,g;for(;p<n.length&&(n[p]===""||r[p]>f);)if(n[p]==="")g===void 0&&(g=p),p+=1;else{if(g!==void 0){for(let x=g;x<p;x++)h.push(lX(x));g=void 0}[m,p]=i(p),h.push(m)}return g!==void 0&&(p=g),[h,p]}o(s,"parseSubs");let[a,l]=s(0,-1),c=l;for(;c<n.length&&n[c]==="";)a.push(lX(c)),c+=1;if(c<n.length)throw new Error(`Parsing did not go to end of file. Ended at ${c} out of ${n.length}`);return VN(a)}o(aat,"parseRaw");function Qw(e,t){function r(n){if(Sx(n)){let i=t.find(s=>s.matches(n.sourceLine));i&&(n.label=i.label)}}o(r,"visitor"),Pc(e,r,"bottomUp")}o(Qw,"labelLines");function zN(e){function t(r){if(kx(r)&&r.label===void 0){let n=r.subs.filter(i=>!oc(i));n.length===1&&(r.label=n[0].label)}}o(t,"visitor"),Pc(e,t,"bottomUp")}o(zN,"labelVirtualInherited");function Mw(e){return Object.keys(e).map(t=>{let r;return e[t].test?r=o(n=>e[t].test(n),"matches"):r=e[t],{matches:r,label:t}})}o(Mw,"buildLabelRules");function uX(e){let r=$N(e,o(function(n){if(n.subs.length===0||n.subs.findIndex(a=>a.label==="closer"||a.label==="opener")===-1)return n;let i=[],s;for(let a=0;a<n.subs.length;a++){let l=n.subs[a],c=n.subs[a-1];if(l.label==="opener"&&c!==void 0&&Sx(c))c.subs.push(l),l.subs.forEach(u=>c.subs.push(u)),l.subs=[];else if(l.label==="closer"&&s!==void 0&&(Sx(l)||kx(l))&&l.indentation>=s.indentation){let u=i.length-1;for(;u>0&&oc(i[u]);)u-=1;if(s.subs.push(...i.splice(u+1)),l.subs.length>0){let f=s.subs.findIndex(g=>g.label!=="newVirtual"),m=s.subs.slice(0,f),h=s.subs.slice(f),p=h.length>0?[aX(l.indentation,h,"newVirtual")]:[];s.subs=[...m,...p,l]}else s.subs.push(l)}else i.push(l),oc(l)||(s=l)}return n.subs=i,n},"rebuilder"));return G3e(e,n=>n==="newVirtual"),r}o(uX,"combineClosersAndOpeners");function H3e(e,t=oc,r){return $N(e,o(function(i){if(i.subs.length<=1)return i;let s=[],a=[],l,c=!1;function u(f=!1){if(l!==void 0&&(s.length>0||!f)){let m=aX(l,a,r);s.push(m)}else a.forEach(m=>s.push(m))}o(u,"flushBlockIntoNewSubs");for(let f=0;f<i.subs.length;f++){let m=i.subs[f],h=t(m);!h&&c&&(u(),a=[]),c=h,a.push(m),oc(m)||(l=l??m.indentation)}return u(!0),i.subs=s,i},"rebuilder"))}o(H3e,"groupBlocks");function Bx(e){return $N(e,o(function(r){return kx(r)&&r.label===void 0&&r.subs.length<=1?r.subs.length===0?void 0:r.subs[0]:(r.subs.length===1&&kx(r.subs[0])&&r.subs[0].label===void 0&&(r.subs=r.subs[0].subs),r)},"rebuilder"))}o(Bx,"flattenVirtual");var lat={opener:/^[[({]/,closer:/^[\])}]/},cat=Mw(lat),j3e={};function fX(e,t){j3e[e]=t}o(fX,"registerLanguageSpecificParser");function Ow(e,t){let r=aat(e),n=j3e[t??""];return n?n(r):(Qw(r,cat),uX(r))}o(Ow,"parseTree");function YN(e,t){let r=[],n=t.length;if(n==0)return[];if(n<e)return[[0,n]];for(let i=0;i<n-e+1;i++)r.push([i,i+e]);return r}o(YN,"getBasicWindowDelineations");var KN=class e extends kI{static{o(this,"FixedWindowSizeJaccardMatcher")}constructor(t,r){super(t),this.windowLength=r}static{this.FACTORY=o(t=>({to:o(r=>new e(r,t),"to")}),"FACTORY")}id(){return"fixed:"+this.windowLength}getWindowsDelineations(t){return YN(this.windowLength,t)}_getCursorContextInfo(t){return Lw(t,{maxLineCount:this.windowLength})}similarityScore(t,r){return uat(t,r)}};function uat(e,t){let r=new Set;return e.forEach(n=>{t.has(n)&&r.add(n)}),r.size/(e.size+t.size-r.size)}o(uat,"computeScore");d();d();var JN=Xe(V3e());var mX={python:"python",javascript:"javascript",javascriptreact:"javascript",jsx:"javascript",typescript:"typescript",typescriptreact:"tsx",go:"go",ruby:"ruby",csharp:"c_sharp",java:"java"};function Xu(e){return e in mX&&e!=="csharp"&&e!=="java"}o(Xu,"isSupportedLanguageId");function ZN(e){if(!(e in mX))throw new Error(`Unrecognized language: ${e}`);return mX[e]}o(ZN,"languageIdToWasmLanguage");var dX=new Map;async function fat(e){let t;try{t=await MN(`tree-sitter-${e}.wasm`)}catch(r){throw r instanceof Error&&"code"in r&&typeof r.code=="string"&&r.name==="Error"?new wI(`Could not load tree-sitter-${e}.wasm`,r):r}return JN.default.Language.load(t)}o(fat,"loadWasmLanguage");function dat(e){let t=ZN(e);if(!dX.has(t)){let r=fat(t);dX.set(t,r)}return dX.get(t)}o(dat,"getLanguage");var hX=class extends Error{static{o(this,"WrappedError")}constructor(t,r){super(t,{cause:r})}};async function H1(e,t){await JN.default.init({locateFile:o(s=>VZ(s),"locateFile")});let r;try{r=new JN.default}catch(s){throw s&&typeof s=="object"&&"message"in s&&typeof s.message=="string"&&s.message.includes("table index is out of bounds")?new hX(`Could not init Parse for language <${e}>`,s):s}let n=await dat(e);r.setLanguage(n);let i=r.parse(t);return r.delete(),i}o(H1,"parseTreeSitter");function $3e(e){switch(ZN(e)){case"python":return null;case"javascript":case"typescript":case"tsx":case"go":case"c_sharp":case"java":return"}";case"ruby":return"end"}}o($3e,"getBlockCloseToken");function mat(e,t){let r=[];for(let n of e){if(!n[1]){let i=t.tree.getLanguage();n[1]=i.query(n[0])}r.push(...n[1].matches(t))}return r}o(mat,"innerQuery");var hat=[`[
239
239
  (class_definition (block (expression_statement (string))))
240
240
  (function_definition (block (expression_statement (string))))
241
- ]`];function z3e(e){return mat([hat],e).length==1}o(z3e,"queryPythonIsDocstring");var XN=class e extends kI{static{o(this,"BlockTokenSubsetMatcher")}constructor(t,r){super(t),this.windowLength=r}static{this.FACTORY=o(t=>({to:o(r=>new e(r,t),"to")}),"FACTORY")}id(){return"fixed:"+this.windowLength}getWindowsDelineations(t){return YN(this.windowLength,t)}_getCursorContextInfo(t){return Lw(t,{maxLineCount:this.windowLength})}get referenceTokens(){return this.createReferenceTokensForLanguage()}async createReferenceTokensForLanguage(){return this.referenceTokensCache?this.referenceTokensCache:(this.referenceTokensCache=e.syntaxAwareSupportsLanguage(this.referenceDoc.languageId)?await this.syntaxAwareReferenceTokens():await super.referenceTokens,this.referenceTokensCache)}async syntaxAwareReferenceTokens(){let t=(await this.getEnclosingMemberStart(this.referenceDoc.source,this.referenceDoc.offset))?.startIndex,r=this.referenceDoc.offset,n=t?this.referenceDoc.source.slice(t,r):Lw(this.referenceDoc,{maxLineCount:this.windowLength}).context;return this.tokenizer.tokenize(n)}static syntaxAwareSupportsLanguage(t){switch(t){case"csharp":return!0;default:return!1}}similarityScore(t,r){return pat(t,r)}async getEnclosingMemberStart(t,r){let n;try{n=await H1(this.referenceDoc.languageId,t);let i=n.rootNode.namedDescendantForIndex(r);for(;i&&!(e.isMember(i)||e.isBlock(i));)i=i.parent??void 0;return i}finally{n?.delete()}}static isMember(t){switch(t?.type){case"method_declaration":case"property_declaration":case"field_declaration":case"constructor_declaration":return!0;default:return!1}}static isBlock(t){switch(t?.type){case"class_declaration":case"struct_declaration":case"record_declaration":case"enum_declaration":case"interface_declaration":return!0;default:return!1}}};function pat(e,t){let r=new Set;return t.forEach(n=>{e.has(n)&&r.add(n)}),r.size}o(pat,"computeScore");var gat=0,Aat=60,yat=4,Cat=1,xat=20,vat=1e4,pX={snippetLength:Aat,threshold:gat,maxTopSnippets:yat,maxCharPerFile:vat,maxNumberOfFiles:xat,maxSnippetsPerFile:Cat,useSubsetMatching:!1};var eL={snippetLength:60,threshold:0,maxTopSnippets:16,maxCharPerFile:1e5,maxNumberOfFiles:200,maxSnippetsPerFile:4};function bat(e,t){return(t.useSubsetMatching?XN.FACTORY(t.snippetLength):KN.FACTORY(t.snippetLength)).to(e)}o(bat,"getMatcher");async function Y3e(e,t,r){let n=bat(e,r);return r.maxTopSnippets===0?[]:(await t.filter(s=>s.source.length<r.maxCharPerFile&&s.source.length>0).slice(0,r.maxNumberOfFiles).reduce(async(s,a)=>(await s).concat((await n.findMatches(a,r.maxSnippetsPerFile)).map(l=>({relativePath:a.relativePath,...l}))),Promise.resolve([]))).filter(s=>s.score&&s.snippet&&s.score>r.threshold).sort((s,a)=>s.score-a.score).slice(-r.maxTopSnippets)}o(Y3e,"getSimilarSnippets");var Uw=500,qw=8192-Uw,K3e=4;var tL=10,rL=15;var Eat={javascriptreact:"javascript",jsx:"javascript",typescriptreact:"typescript",jade:"pug",cshtml:"razor",c:"cpp"};function Ww(e){return e=e.toLowerCase(),Eat[e]??e}o(Ww,"normalizeLanguageId");var gX=class{constructor(t){this.ctx=t;this.cache=new In(200)}static{o(this,"FilterSettingsToExpConfigs")}async fetchExpConfig(t){let r=this.cache.get(t.stringify());return r||(r=new AX(()=>this.ctx.get(Vm).fetchExperiments(this.ctx,t.toHeaders()),1e3*60*60),this.cache.set(t.stringify(),r)),r.run()}getCachedExpConfig(t){return this.cache.get(t.stringify())?.value()}},AX=class{constructor(t,r=1/0){this.producer=t;this.expirationMs=r}static{o(this,"Task")}async run(){return this.promise===void 0&&(this.promise=this.producer(),this.storeResult(this.promise).then(()=>{this.expirationMs<1/0&&this.promise!==void 0&&setTimeout(()=>this.promise=void 0,this.expirationMs)})),this.promise}async storeResult(t){try{this.result=await t}finally{this.result===void 0&&(this.promise=void 0)}}value(){return this.result}};function Tat(e){return"uri"in e}o(Tat,"isCompletionsFiltersInfo");var Cr=class e{constructor(t){this.ctx=t;this.staticFilters={};this.dynamicFilters={};this.dynamicFilterGroups=[];this.upcomingDynamicFilters={};this.assignments=new gX(this.ctx)}static{o(this,"Features")}static{this.upcomingDynamicFilterCheckDelayMs=20}static{this.upcomingTimeBucketMinutes=5+Math.floor(Math.random()*11)}registerStaticFilters(t){Object.assign(this.staticFilters,t)}registerDynamicFilter(t,r){this.dynamicFilters[t]=r}registerDynamicFilterGroup(t){this.dynamicFilterGroups.push(t)}getDynamicFilterValues(){let t={};for(let r of this.dynamicFilterGroups)Object.assign(t,r());for(let[r,n]of Object.entries(this.dynamicFilters))t[r]=n();return t}registerUpcomingDynamicFilter(t,r){this.upcomingDynamicFilters[t]=r}async updateExPValuesAndAssignments(t,r=cn.createAndMarkAsIssued()){if(r instanceof Mp)throw new Error("updateExPValuesAndAssignments should not be called with TelemetryWithExp");let n=t&&Tat(t)?i5(this.ctx,t.uri):void 0,i=G1(n)??"",s=E3e(n)??"",a=t?.languageId??"",l=n5(this.ctx).modelId,c=await b3e(this.ctx),u=await Fw(this.ctx,"ft"),f=await Fw(this.ctx,"ol"),m=await Fw(this.ctx,"cml"),h=await Fw(this.ctx,"tid"),p={"X-Copilot-Repository":i,"X-Copilot-FileType":a,"X-Copilot-UserKind":c,"X-Copilot-Dogfood":s,"X-Copilot-Engine":l,"X-Copilot-CustomModel":u,"X-Copilot-Orgs":f,"X-Copilot-CustomModelNames":m,"X-Copilot-CopilotTrackingId":h},g=this.getGranularityDirectory(),x=this.makeFilterSettings(p),v=g.extendFilters(x),E=await this.getExpConfig(v.newFilterSettings);g.update(x,+(E.variables.copilotbycallbuckets??NaN),+(E.variables.copilottimeperiodsizeinh??NaN));let b=g.extendFilters(x),_=b.newFilterSettings,R=await this.getExpConfig(_),P=new Promise(F=>setTimeout(F,e.upcomingDynamicFilterCheckDelayMs));for(let F of b.otherFilterSettingsToPrefetch)P=P.then(async()=>{await new Promise(G=>setTimeout(G,e.upcomingDynamicFilterCheckDelayMs)),this.getExpConfig(F)});return this.prepareForUpcomingFilters(_),new Mp(r.properties,r.measurements,r.issuedTime,{filters:_,exp:R})}getGranularityDirectory(){if(!this.granularityDirectory){let t=this.ctx.get(_s).machineId;this.granularityDirectory=new dN(t,this.ctx.get(Tp))}return this.granularityDirectory}makeFilterSettings(t){return new nx({...this.staticFilters,...this.getDynamicFilterValues(),...t})}async getExpConfig(t){try{return this.assignments.fetchExpConfig(t)}catch(r){return dd.createFallbackConfig(this.ctx,`Error fetching ExP config: ${String(r)}`)}}async prepareForUpcomingFilters(t){if(!(new Date().getMinutes()<60-e.upcomingTimeBucketMinutes))for(let[r,n]of Object.entries(this.upcomingDynamicFilters))await new Promise(i=>setTimeout(i,e.upcomingDynamicFilterCheckDelayMs)),this.getExpConfig(t.withChange(r,n()))}stringify(){let t=this.assignments.getCachedExpConfig(new nx({}));return JSON.stringify(t?.variables??{})}async getFallbackExpAndFilters(){let t=this.makeFilterSettings({}),r=await this.getExpConfig(t);return{filters:t,exp:r}}disableLogProb(t){return t.filtersAndExp.exp.variables.copilotdisablelogprob??!0}overrideBlockMode(t){return t.filtersAndExp.exp.variables.copilotoverrideblockmode||void 0}customEngine(t){return t.filtersAndExp.exp.variables.copilotcustomengine??""}customEngineTargetEngine(t){return t.filtersAndExp.exp.variables.copilotcustomenginetargetengine}suffixPercent(t){return t.filtersAndExp.exp.variables.CopilotSuffixPercent??rL}suffixMatchThreshold(t){return t.filtersAndExp.exp.variables.copilotsuffixmatchthreshold??tL}cppHeadersShutdownSwitch(t){return t.filtersAndExp.exp.variables.copilotcppheadersshutdownswitch??!1}relatedFilesVSCodeCSharp(t){return t.filtersAndExp.exp.variables.copilotrelatedfilesvscodecsharp??!1}relatedFilesVSCodeTypeScript(t){return t.filtersAndExp.exp.variables.copilotrelatedfilesvscodetypescript??!1}relatedFilesVSCode(t){return t.filtersAndExp.exp.variables.copilotrelatedfilesvscode??!1}excludeOpenTabFilesCSharp(t){return t.filtersAndExp.exp.variables.copilotexcludeopentabfilescsharp??!1}excludeOpenTabFilesCpp(t){return t.filtersAndExp.exp.variables.copilotexcludeopentabfilescpp??!1}excludeOpenTabFilesTypeScript(t){return t.filtersAndExp.exp.variables.copilotexcludeopentabfilestypescript??!1}fallbackToOpenTabFilesWithNoRelatedFiles(t){return t.filtersAndExp.exp.variables.copilotfallbacktoopentabfiles??!1}contextProviders(t){let r=t.filtersAndExp.exp.variables.copilotcontextproviders??"";return r?r.split(",").map(n=>n.trim()):[]}includeNeighboringFiles(t){return t.filtersAndExp.exp.variables.copilotincludeneighboringfiles??!1}maxPromptCompletionTokens(t){return t.filtersAndExp.exp.variables.maxpromptcompletionTokens??qw+Uw}promptOrderListPreset(t){let r=t.filtersAndExp.exp.variables.copilotpromptorderlistpreset;return"default"}promptPriorityPreset(t){switch(t.filtersAndExp.exp.variables.copilotpromptprioritypreset){case"office-exp":return"office-exp";default:return"default"}}ideChatMaxRequestTokens(t){return t.filtersAndExp.exp.variables.idechatmaxrequesttokens??-1}ideChatExpModelIds(t){return t.filtersAndExp.exp.variables.idechatexpmodelids??""}ideChatEnableProjectMetadata(t){return t.filtersAndExp.exp.variables.idechatenableprojectmetadata??!1}ideEnableCopilotEditsAgent(t){return t.filtersAndExp.exp.variables.ideenablecopiloteditsagent??!1}recentEditsInPrompt(t){return t.filtersAndExp.exp.variables.copilotrecenteditsinprompt??!1}recentEditsEditCount(t){return t.filtersAndExp.exp.variables.copilotrecenteditseditcount??5}recentEditsMaxFiles(t){return t.filtersAndExp.exp.variables.copilotrecenteditsmaxfiles??5}recentEditsContextLines(t){return t.filtersAndExp.exp.variables.copilotrecenteditscontextlines??3}recentEditsRemoveDeletedLines(t){return t.filtersAndExp.exp.variables.copilotrecenteditsremovedeletedlines??!1}recentEditsInsertionsBeforeDeletions(t){return t.filtersAndExp.exp.variables.copilotrecenteditsinsertionsbeforedeletions??!1}recentEditsAppendNoReplyMarker(t){return t.filtersAndExp.exp.variables.copilotrecenteditsappendnoreplymarker??!1}recentEditsMaxLinesBetweenEdits(t){return t.filtersAndExp.exp.variables.copilotrecenteditsmaxlinesbetweenedits??100}recentEditsActiveDocDistanceLimitFromCursor(t){return t.filtersAndExp.exp.variables.copilotrecenteditsactivedocdistancelimitfromcursor??100}recentEditsSummarizationFormat(t){return t.filtersAndExp.exp.variables.copilotrecenteditsummarizationformat??"diff"}triggerCompletionAfterAccept(t){return t.filtersAndExp.exp.variables.copilottriggercompletionafteraccept}enableAsyncCompletions(t){return t.filtersAndExp.exp.variables.copilotasynccompletions??!1}enableSpeculativeRequests(t){return t.filtersAndExp.exp.variables.copilotspeculativerequests??!1}cppContextProviderParams(t){return t.filtersAndExp.exp.variables.copilotcppContextProviderParams}disableContextualFilter(t){return t.filtersAndExp.exp.variables.copilotdisablecontextualfilter??!1}vscodeDebounceThreshold(t){return t.filtersAndExp.exp.variables.copilotvscodedebouncethreshold}enableElectronFetcher(t){return t.filtersAndExp.exp.variables.copilotelectronfetcher??!1}asyncCompletionsTimeout(t){return t.filtersAndExp.exp.variables.copilotasynccompletionstimeout??100}enablePromptContextProxyField(t){return t.filtersAndExp.exp.variables.copilotenablepromptcontextproxyfield??!1}enableProgressiveReveal(t){return t.filtersAndExp.exp.variables.copilotprogressivereveal??!1}enableMultilineAfterAccept(t){return t.filtersAndExp.exp.variables.copilotmultilineafteraccept??!1}enablePrefixCompletionsCache(t){return t.filtersAndExp.exp.variables.copilotprefixcompletionscache??!1}};var yX={};b1(yX,{activationEvents:()=>jat,badges:()=>Hat,bugs:()=>Lat,build:()=>Rat,buildType:()=>Bat,categories:()=>Wat,contributes:()=>CX,default:()=>Zat,dependencies:()=>Kat,description:()=>Sat,devDependencies:()=>Yat,displayName:()=>_at,enabledApiProposals:()=>$at,engines:()=>qat,extensionPack:()=>Uat,homepage:()=>Fat,icon:()=>Mat,keywords:()=>Gat,license:()=>Nat,main:()=>Vat,name:()=>wat,overrides:()=>Jat,preview:()=>Pat,pricing:()=>Oat,publisher:()=>Dat,qna:()=>Qat,scripts:()=>zat,version:()=>kat});var wat="copilot",_at="GitHub Copilot",Sat="Your AI pair programmer",kat="1.315.0",Rat="1548",Bat="prod",Dat="GitHub",Pat=!1,Fat="https://github.com/features/copilot?editor=vscode",Nat="https://docs.github.com/en/site-policy/github-terms/github-terms-for-additional-products-and-features",Lat={url:"https://github.com/microsoft/vscode-copilot-release/issues"},Qat="https://github.com/github-community/community/discussions/categories/copilot",Mat="assets/Copilot-App-Icon.png",Oat="Trial",Uat=["GitHub.copilot-chat"],qat={vscode:"^1.98.0",node:">=20.0.0",npm:">=9.0.0"},Wat=["AI","Chat","Programming Languages","Machine Learning"],Gat=["ai","openai","codex","pilot","snippets","documentation","autocomplete","intellisense","refactor","javascript","python","typescript","php","go","golang","ruby","c++","c#","java","kotlin","co-pilot"],Hat=[{url:"https://img.shields.io/badge/GitHub%20Copilot-Subscription%20Required-orange",href:"https://github.com/github-copilot/signup?editor=vscode",description:"Sign up for GitHub Copilot"},{url:"https://img.shields.io/github/stars/github/copilot-docs?style=social",href:"https://github.com/github/copilot-docs",description:"Star Copilot on GitHub"},{url:"https://img.shields.io/youtube/channel/views/UC7c3Kb6jYCRj4JOHHZTxKsQ?style=social",href:"https://www.youtube.com/@GitHub/search?query=copilot",description:"Check out GitHub on Youtube"},{url:"https://img.shields.io/twitter/follow/github?style=social",href:"https://twitter.com/github",description:"Follow GitHub on Twitter"}],jat=["onStartupFinished"],Vat="./dist/extension",$at=["inlineCompletionsAdditions"],CX={commands:[{command:"github.copilot.toggleStatusMenu",title:"Open Status Menu",category:"GitHub Copilot"},{command:"github.copilot.signIn",title:"Sign In",category:"GitHub Copilot",enablement:"!github.copilot.activated"},{command:"github.copilot.acceptCursorPanelSolution",title:"Accept Panel Suggestion at the Cursor",enablement:"github.copilot.panelVisible",category:"GitHub Copilot"},{command:"github.copilot.previousPanelSolution",title:"Navigate to the Previous Panel Suggestion",enablement:"github.copilot.panelVisible",category:"GitHub Copilot"},{command:"github.copilot.nextPanelSolution",title:"Navigate to the Next Panel Suggestion",enablement:"github.copilot.panelVisible",category:"GitHub Copilot"},{command:"github.copilot.generate",title:"Open Completions Panel",enablement:"github.copilot.activated",category:"GitHub Copilot"},{command:"github.copilot.completions.disable",title:"Disable Completions",enablement:"github.copilot.activated && config.editor.inlineSuggest.enabled && github.copilot.completions.enabled",category:"GitHub Copilot"},{command:"github.copilot.completions.enable",title:"Enable Completions",enablement:"github.copilot.activated && !(config.editor.inlineSuggest.enabled && github.copilot.completions.enabled)",category:"GitHub Copilot"},{command:"github.copilot.completions.toggle",title:"Toggle (Enable/Disable) Completions",enablement:"github.copilot.activated",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"},{command:"github.copilot.openModelPicker",title:"Change Completions Model",category:"GitHub Copilot"},{command:"github.copilot.sendCompletionFeedback",title:"Send Copilot Completion Feedback",category:"GitHub Copilot"}],keybindings:[{command:"github.copilot.generate",key:"ctrl+enter",mac:"ctrl+enter",when:"editorTextFocus && !commentEditorFocused"},{command:"github.copilot.acceptCursorPanelSolution",key:"ctrl+/",mac:"ctrl+/",when:"activeWebviewPanelId == 'GitHub Copilot Suggestions'"},{command:"github.copilot.previousPanelSolution",key:"alt+[",mac:"alt+[",when:"activeWebviewPanelId == 'GitHub Copilot Suggestions'"},{command:"github.copilot.nextPanelSolution",key:"alt+]",mac:"alt+]",when:"activeWebviewPanelId == 'GitHub Copilot Suggestions'"},{command:"editor.action.inlineSuggest.trigger",key:"alt+\\",when:"editorTextFocus && !editorHasSelection && !inlineSuggestionsVisible"}],configuration:[{title:"GitHub Copilot",properties:{"github.copilot.selectedCompletionModel":{type:"string",default:"",markdownDescription:'The currently selected completion model ID. To select from a list of available models, use the __"Change Completion Model"__ command or open the model picker from the Copilot menu. The value must be a valid model ID. An empty value indicates that the default model will be used.'},"github.copilot.advanced":{type:"object",title:"Advanced Settings",properties:{authProvider:{type:"string",enum:["github","github-enterprise"],enumDescriptions:["GitHub.com","GitHub Enterprise"],default:"github",description:"The GitHub identity to use for Copilot"},authPermissions:{type:"string",enum:["default","minimal"],markdownEnumDescriptions:["Default (recommended) - The default permissions enable the best that Copilot has to offer including, but not limited to, faster repo indexing and the power of the `@github` agent.","Minimal - The minimal permissions required for Copilot functionality."],default:"default",markdownDescription:"Controls what kind of permissions are asked for when signing in to Copilot. The options are\n* `default` - (strongly recommended) The default permissions enable the best that Copilot has to offer including, but not limited to, faster repo indexing and the power of the `@github` agent.\n* `minimal` - The minimal permissions are the least that Copilot needs to function. Some features may behave slower or not at all."},useLanguageServer:{type:"boolean",default:!1,description:"Experimental: Use language server"},"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:[],deprecationMessage:"Set overrideLogLevels.* to ERROR to filter out unwanted categories.",description:"Show only log categories listed in this setting. If an array is empty, show all loggers"}}},"github.copilot.enable":{type:"object",scope:"window",default:{"*":!0,plaintext:!1,markdown:!1,scminput:!1},additionalProperties:{type:"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:"This setting has no effect. Please use github.copilot.enable instead.",description:"Show inline suggestions"},"github.copilot.editor.enableAutoCompletions":{type:"boolean",scope:"language-overridable",default:!0,deprecationMessage:"This setting has no effect. Please use github.copilot.enable instead.",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"}],iconFonts:[{id:"copilot-font",src:[{path:"assets/copilot.woff",format:"woff"}]}]},zat={build:"tsx esbuild.ts",clean:"./script/build/clean.sh",compress:"tsx ./script/compressTokenizer.ts","forbid-sources-content:extension":"node script/forbid-sources-content.js --extension",generate_languages:"tsx script/generateLanguages.ts && prettier --write lib/src/language/generatedLanguages.ts",get_token:"tsx script/getToken.ts",lint:'run-p --aggregate-output "lint:*"',"lint:deps":"depcruise -c .dependency-cruiser.js .","lint:eslint":"eslint -f visualstudio --quiet --cache .","lint:prettier":"prettier --check . 2>&1","lint:types":"tsc --noEmit && tsc --noEmit -p extension/src/copilotPanel/webview",prebuild:"npm install",pretest:"npm run build","pretest:headless":"npm run build","pretest:extension":"npm run build","pretest:lsp-client":"npm run build","pretest:lib-e2e":"npm run build",prewatch:"npm run build","prewatch:esbuild":"npm run build",start:"npm run watch",test:'npm-run-all "test:extension --ignore-scripts" "test:headless --ignore-scripts" lint',"test:headless":'npm-run-all test:lib test:agent "test:lib-e2e --ignore-scripts" test:prompt "test:lsp-client --ignore-scripts" lint',"test:agent":'mocha "agent/src/**/*.test.{ts,tsx}"',"test:extension":"tsx extension/test/runTest.ts","test:lib":'mocha "lib/src/**/*.test.{ts,tsx}"',"test:lib-e2e":'mocha "lib/e2e/src/**/*.test.{ts,tsx}" --exclude "lib/e2e/src/prompt/**/*.test.ts"',"test:lib-e2e-no-ci":'mocha "lib/e2e/no-ci/**/*.test.{ts,tsx}"',"test:lib-prompt-e2e":'mocha "lib/e2e/src/prompt/prompt.test.ts"',"test:lib-prompt-e2e-perf":"INCLUDE_PERFORMANCE=true npm run test:lib-prompt-e2e","test:lsp-client":'mocha "lsp-client/test/*.test.{ts,tsx}"',"test:prompt":'mocha "prompt/test/**/*.test.{ts,tsx}"',"vscode-dts":"vscode-dts dev && mv vscode.proposed.*.ts extension/src","vscode:prepublish":'run-s "build --ignore-scripts" forbid-sources-content:extension',"vscode:uninstall":"node dist/extensionUninstalled.js",vsix:"vsce package --allow-missing-repository",watch:'run-p "watch:esbuild --ignore-scripts" "watch:types -- --preserveWatchOutput"',"watch:esbuild":"tsx esbuild.ts --watch","watch:types":"tsc --noEmit --watch"},Yat={"@datadog/datadog-ci":"^3.4.0","@github/prettier-config":"0.0.6","@limegrass/eslint-plugin-import-alias":"^1.5.1","@parcel/watcher":"^2.5.1","@types/benchmark":"^2.1.5","@types/crypto-js":"^4.2.2","@types/diff":"^7.0.2","@types/git-url-parse":"^16.0.0","@types/js-yaml":"^4.0.6","@types/kerberos":"^1.1.2","@types/mocha":"^10.0.10","@types/node":"~20.8.0","@types/semver":"^7.7.0","@types/sinon":"^17.0.4","@types/uuid":"^10.0.0","@types/vscode":"1.98.0","@types/yargs":"^17.0.24","@vscode/test-electron":"^2.5.2","@vscode/vsce":"^3.3.2","@yao-pkg/pkg":"^6.4.0",benchmark:"^2.1.4",boxen:"^8.0.1",chalk:"^5.4.1","dependency-cruiser":"^16.10.0",electron:"^28.1.4",esbuild:"^0.25.3","esbuild-plugin-copy":"^2.1.1",eslint:"^9.25.1","eslint-formatter-visualstudio":"^8.40.0","eslint-plugin-mocha":"^10.5.0",fantasticon:"^3.0.0",glob:"^11.0.2",globals:"^16.0.0","js-yaml":"^4.1.0",mocha:"^11.2.2","mocha-junit-reporter":"^2.2.1","mocha-multi-reporters":"^1.5.1","npm-run-all":"^4.1.5",prettier:"^3.5.3","prettier-plugin-organize-imports":"^4.1.0",proxy:"^2.1.1","simple-git":"^3.27.0",sinon:"^20.0.0","ts-dedent":"^2.2.0",tsx:"^4.19.4",typescript:"^5.8.3","typescript-eslint":"^8.32.0","vscode-dts":"^0.3.3"},Kat={"@adobe/helix-fetch":"github:devm33/helix-fetch#1088e599270f36632703f138d88c2100cbe468db","@github/memoize":"1.1.5","@microsoft/1ds-post-js":"^4.3.6","@microsoft/applicationinsights-web-basic":"^3.3.6","@microsoft/tiktokenizer":"^1.0.10","@modelcontextprotocol/sdk":"^1.11.0","@sinclair/typebox":"^0.34.33","@types/vscode-webview":"^1.57.4","@vscode/codicons":"^0.0.36","@vscode/prompt-tsx":"0.4.0-alpha.1","@vscode/webview-ui-toolkit":"^1.3.1","await-lock":"^2.2.2","crypto-js":"^4.2.0",diff:"^7.0.0",dldr:"^0.0.10","get-stream":"^6.0.1","git-url-parse":"^16.0.3",kerberos:"^2.2.0","mac-ca":"^3.1.1",microjob:"^0.7.0",minimatch:"^9.0.3",open:"^10.1.2","os-browserify":"^0.3.0","path-browserify":"^1.0.1",semver:"^7.7.1",shiki:"~1.15.0","source-map-support":"^0.5.21",sqlite3:"^5.1.7",uuid:"^11.1.0","vscode-languageclient":"^9.0.0","vscode-languageserver":"^9.0.0","vscode-languageserver-protocol":"^3.17","vscode-languageserver-textdocument":"~1.0.11","vscode-uri":"^3.1.0","web-tree-sitter":"^0.20.8","windows-ca-certs":"^0.1.0",yargs:"^17.7.2"},Jat={fsevents:"<0",bindings:"npm:bundled-bindings@^1.5.0"},Zat={name:wat,displayName:_at,description:Sat,version:kat,build:Rat,buildType:Bat,publisher:Dat,preview:Pat,homepage:Fat,license:Nat,bugs:Lat,qna:Qat,icon:Mat,pricing:Oat,extensionPack:Uat,engines:qat,categories:Wat,keywords:Gat,badges:Hat,activationEvents:jat,main:Vat,enabledApiProposals:$at,contributes:CX,scripts:zat,devDependencies:Yat,dependencies:Kat,overrides:Jat};var St={Enable:"enable",UserSelectedCompletionModel:"selectedCompletionModel",ShowEditorCompletions:"editor.showEditorCompletions",EnableAutoCompletions:"editor.enableAutoCompletions",DelayCompletions:"editor.delayCompletions",FilterCompletions:"editor.filterCompletions",FetchStrategy:"fetchStrategy",RelatedFilesVSCodeCSharp:"advanced.relatedFilesVSCodeCSharp",RelatedFilesVSCodeTypeScript:"advanced.relatedFilesVSCodeTypeScript",RelatedFilesVSCode:"advanced.relatedFilesVSCode",ExcludeOpenTabFilesCSharp:"advanced.excludeOpenTabFilesCSharp",ExcludeOpenTabFilesCpp:"advanced.excludeOpenTabFilesCpp",ExcludeOpenTabFilesTypeScript:"advanced.excludeOpenTabFilesTypeScript",FallbackToOpenTabFilesWithNoRelatedFiles:"advanced.fallbackToOpenTabFilesWithNoRelatedFiles",ContextProviders:"advanced.contextProviders",DebugOverrideLogLevels:"advanced.debug.overrideLogLevels",DebugFilterLogCategories:"advanced.debug.filterLogCategories",DebugSnippyOverrideUrl:"advanced.debug.codeRefOverrideUrl",DebugUseElectronFetcher:"advanced.debug.useElectronFetcher",DebugUseEditorFetcher:"advanced.debug.useEditorFetcher",UseSubsetMatching:"advanced.useSubsetMatching",EnablePromptComponents:"advanced.enablePromptComponents",ContextProviderTimeBudget:"advanced.contextProviderTimeBudget",DebugOverrideCapiUrl:"internal.capiUrl",DebugOverrideCapiUrlLegacy:"advanced.debug.overrideCapiUrl",DebugTestOverrideCapiUrl:"internal.capiTestUrl",DebugTestOverrideCapiUrlLegacy:"advanced.debug.testOverrideCapiUrl",DebugOverrideProxyUrl:"internal.completionsUrl",DebugOverrideProxyUrlLegacy:"advanced.debug.overrideProxyUrl",DebugTestOverrideProxyUrl:"internal.completionsTestUrl",DebugTestOverrideProxyUrlLegacy:"advanced.debug.testOverrideProxyUrl",DebugOverrideEngine:"internal.completionModel",DebugOverrideEngineLegacy:"advanced.debug.overrideEngine",UseAsyncCompletions:"internal.useAsyncCompletions",EnableSpeculativeRequests:"internal.enableSpeculativeRequests",EnablePrefixCache:"internal.enablePrefixCache",AlwaysRequestMultiline:"internal.alwaysRequestMultiline",TrimCompletionsAggressively:"internal.trimCompletionsAggressively",VSCodeDebounceThreshold:"internal.vscodeDebounceThreshold",RecentEditsInPrompt:"internal.recentEditsInPrompt",RecentEditsEditCount:"internal.recentEditsEditCount",RecentEditsMaxFiles:"internal.recentEditsMaxFiles",RecentEditsContextLines:"internal.recentEditsContextLines",RecentEditsRemoveDeletedLines:"internal.recentEditsRemoveDeletedLines",InsertionsBeforeDeletions:"internal.recentEditsInsertionsBeforeDeletions",RecentEditsAppendNoReplyMarker:"internal.recentEditsAppendNoReplyMarker",RecentEditsMaxLinesBetweenEdits:"internal.recentEditsMaxLinesBetweenEdits",RecentEditsActiveDocDistanceLimitFromCursor:"internal.recentEditsActiveDocDistanceLimitFromCursor",RecentEditsSummarizationFormat:"internal.recentEditsSummarizationFormat",IncludeNeighboringFiles:"internal.includeNeighboringFiles",DebugOverrideCppHeadersShutdownSwitch:"internal.cppHeadersShutdownSwitch",MultilineAfterAccept:"internal.multilineAfterAccept"};function X3e(e){return["server","parsingandserver"].includes(e)}o(X3e,"shouldDoServerTrimming");var Km=class{static{o(this,"BlockModeConfig")}},BI=class extends Km{static{o(this,"ConfigBlockModeConfig")}forLanguage(t,r,n){let i=t.get(Cr).overrideBlockMode(n);if(i)return J3e(i,r);let s=t.get(Cr).enableProgressiveReveal(n);return On(t,St.AlwaysRequestMultiline)??s?J3e("moremultiline",r):r=="ruby"?"parsing":Xu(r)?"parsingandserver":"server"}};function Xat(e){return["parsing","parsingandserver","moremultiline"].includes(e)}o(Xat,"blockModeRequiresTreeSitter");function J3e(e,t){return Xat(e)&&!Xu(t)?"server":e}o(J3e,"toApplicableBlockMode");var Wp=class{static{o(this,"ConfigProvider")}},DI=class extends Wp{static{o(this,"DefaultsOnlyConfigProvider")}getConfig(t){return tlt(t)}getOptionalConfig(t){return rlt(t)}dumpForTelemetry(){return{}}},Dx=class extends Wp{constructor(r,n){super();this.baseConfigProvider=r;this.overrides=n}static{o(this,"InMemoryConfigProvider")}getOptionalOverride(r){return this.overrides.get(r)}getConfig(r){return this.getOptionalOverride(r)??this.baseConfigProvider.getConfig(r)}getOptionalConfig(r){return this.getOptionalOverride(r)??this.baseConfigProvider.getOptionalConfig(r)}setConfig(r,n){n!==void 0?this.overrides.set(r,n):this.overrides.delete(r)}dumpForTelemetry(){let r=this.baseConfigProvider.dumpForTelemetry();for(let n of[St.ShowEditorCompletions,St.EnableAutoCompletions,St.DelayCompletions,St.FilterCompletions]){let i=this.overrides.get(n);i!==void 0&&(r[n]=JSON.stringify(i))}return r}};function elt(e){return e?.type==="object"&&"properties"in e}o(elt,"isContributesObject");function exe(e,t){let r=e,n=[];for(let i of t.split(".")){let s=[...n,i].join(".");r&&typeof r=="object"&&s in r?(r=r[s],n.length=0):n.push(i)}if(!(r===void 0||n.length>0))return r}o(exe,"getConfigKeyRecursively");function tlt(e){if(RI.has(e))return RI.get(e);throw new Error(`Missing config default value: ${j7}.${e}`)}o(tlt,"getConfigDefaultForKey");function rlt(e){return RI.get(e)}o(rlt,"getOptionalConfigDefaultForKey");var RI=new Map([[St.DebugOverrideCppHeadersShutdownSwitch,!1],[St.RelatedFilesVSCodeCSharp,!1],[St.RelatedFilesVSCodeTypeScript,!1],[St.RelatedFilesVSCode,!1],[St.ExcludeOpenTabFilesCSharp,!1],[St.ExcludeOpenTabFilesCpp,!1],[St.ExcludeOpenTabFilesTypeScript,!1],[St.FallbackToOpenTabFilesWithNoRelatedFiles,!1],[St.IncludeNeighboringFiles,!1],[St.ContextProviders,[]],[St.DebugUseEditorFetcher,null],[St.DebugUseElectronFetcher,null],[St.DebugOverrideLogLevels,{}],[St.DebugSnippyOverrideUrl,""],[St.FetchStrategy,"auto"],[St.UseSubsetMatching,null],[St.EnablePromptComponents,!1],[St.ContextProviderTimeBudget,150],[St.DebugOverrideCapiUrl,""],[St.DebugTestOverrideCapiUrl,""],[St.DebugOverrideProxyUrl,""],[St.DebugTestOverrideProxyUrl,""],[St.DebugOverrideEngine,""],[St.UseAsyncCompletions,void 0],[St.EnableSpeculativeRequests,void 0],[St.EnablePrefixCache,void 0],[St.AlwaysRequestMultiline,void 0],[St.TrimCompletionsAggressively,void 0],[St.VSCodeDebounceThreshold,void 0],[St.RecentEditsInPrompt,void 0],[St.RecentEditsEditCount,void 0],[St.RecentEditsMaxFiles,void 0],[St.RecentEditsContextLines,void 0],[St.RecentEditsRemoveDeletedLines,void 0],[St.InsertionsBeforeDeletions,void 0],[St.RecentEditsAppendNoReplyMarker,void 0],[St.RecentEditsMaxLinesBetweenEdits,void 0],[St.RecentEditsActiveDocDistanceLimitFromCursor,void 0],[St.RecentEditsSummarizationFormat,void 0],[St.MultilineAfterAccept,void 0],[St.ShowEditorCompletions,void 0],[St.DelayCompletions,void 0],[St.FilterCompletions,void 0]]);for(let e of Object.values(St)){let t=CX.configuration[0],r=[],n=`${j7}.${e}`.split(".");for(;n.length>0;){r.push(n.shift());let i=t.properties[r.join(".")];if(elt(i))r.length=0,t=i;else if(n.length==0&&i?.default!==void 0){if(RI.has(e))throw new Error(`Duplicate config default value ${j7}.${e}`);RI.set(e,i.default)}}if(!RI.has(e))throw new Error(`Missing config default value ${j7}.${e}`)}function On(e,t){return e.get(Wp).getConfig(t)}o(On,"getConfig");function sCe(e){return e.get(Wp).dumpForTelemetry()}o(sCe,"dumpForTelemetry");var go=class{constructor(){this.packageJson=yX}static{o(this,"BuildInfo")}isPreRelease(){return this.getBuildType()==="nightly"}isProduction(){return this.getBuildType()!=="dev"}getBuildType(){return this.packageJson.buildType}getVersion(){return this.packageJson.version}getDisplayVersion(){return this.getBuildType()==="dev"?`${this.getVersion()}-dev`:this.getVersion()}getBuild(){return this.packageJson.build}getName(){return this.packageJson.name}};function lN(e){return e.get(go).isProduction()}o(lN,"isProduction");function BCe(e){return e.get(go).getBuildType()==="dev"}o(BCe,"isDevBuild");function md(e){return e.get(go).getBuildType()}o(md,"getBuildType");function aCe(e){return e.get(go).getBuild()}o(aCe,"getBuild");function Ex(e){return e.get(go).getVersion()}o(Ex,"getVersion");var _s=class{constructor(t,r,n="none",i="desktop"){this.sessionId=t;this.machineId=r;this.remoteName=n;this.uiKind=i}static{o(this,"EditorSession")}};function Np({name:e,version:t}){return`${e}/${t}`}o(Np,"formatNameAndVersion");var dn=class{static{o(this,"EditorAndPluginInfo")}getCopilotIntegrationId(){}},LZ="2025-05-01";function Ic(e){let t=e.get(dn);return{"X-GitHub-Api-Version":LZ,"Editor-Version":Np(t.getEditorInfo()),"Editor-Plugin-Version":Np(t.getEditorPluginInfo()),"Copilot-Language-Server-Version":Ex(e)}}o(Ic,"editorVersionHeaders");var Z3e="Iv1.b507a08c87ecfe98",ea=class{static{o(this,"GitHubAppInfo")}findAppIdToAuthenticate(){return this.githubAppId??Z3e}fallbackAppId(){return Z3e}};d();d();d();var Px={abap:{extensions:[".abap"]},aspdotnet:{extensions:[".asax",".ascx",".ashx",".asmx",".aspx",".axd"]},bat:{extensions:[".bat",".cmd"]},bibtex:{extensions:[".bib",".bibtex"]},blade:{extensions:[".blade",".blade.php"]},BluespecSystemVerilog:{extensions:[".bsv"]},c:{extensions:[".c",".cats",".h",".h.in",".idc"]},csharp:{extensions:[".cake",".cs",".cs.pp",".csx",".linq"]},cpp:{extensions:[".c++",".cc",".cp",".cpp",".cppm",".cxx",".h",".h++",".hh",".hpp",".hxx",".idl",".inc",".inl",".ino",".ipp",".ixx",".rc",".re",".tcc",".tpp",".txx",".i"]},cobol:{extensions:[".cbl",".ccp",".cob",".cobol",".cpy"]},css:{extensions:[".css",".wxss"]},clojure:{extensions:[".bb",".boot",".cl2",".clj",".cljc",".cljs",".cljs.hl",".cljscm",".cljx",".edn",".hic"],filenames:["riemann.config"]},ql:{extensions:[".ql",".qll"]},coffeescript:{extensions:["._coffee",".cake",".cjsx",".coffee",".iced"],filenames:["Cakefile"]},cuda:{extensions:[".cu",".cuh"]},dart:{extensions:[".dart"]},dockerfile:{extensions:[".containerfile",".dockerfile"],filenames:["Containerfile","Dockerfile"]},dotenv:{extensions:[".env"],filenames:[".env",".env.ci",".env.dev",".env.development",".env.development.local",".env.example",".env.local",".env.prod",".env.production",".env.sample",".env.staging",".env.test",".env.testing"]},html:{extensions:[".ect",".ejs",".ejs.t",".jst",".hta",".htm",".html",".html.hl",".html5",".inc",".jsp",".njk",".tpl",".twig",".wxml",".xht",".xhtml",".phtml",".liquid"]},elixir:{extensions:[".ex",".exs"],filenames:["mix.lock"]},erlang:{extensions:[".app",".app.src",".erl",".es",".escript",".hrl",".xrl",".yrl"],filenames:["Emakefile","rebar.config","rebar.config.lock","rebar.lock"]},fsharp:{extensions:[".fs",".fsi",".fsx"]},go:{extensions:[".go"]},groovy:{extensions:[".gradle",".groovy",".grt",".gtpl",".gvy",".jenkinsfile"],filenames:["Jenkinsfile","Jenkinsfile"]},graphql:{extensions:[".gql",".graphql",".graphqls"]},terraform:{extensions:[".hcl",".nomad",".tf",".tfvars",".workflow"]},hlsl:{extensions:[".cginc",".fx",".fxh",".hlsl",".hlsli"]},erb:{extensions:[".erb",".erb.deface",".rhtml"]},razor:{extensions:[".cshtml",".razor"]},haml:{extensions:[".haml",".haml.deface"]},handlebars:{extensions:[".handlebars",".hbs"]},haskell:{extensions:[".hs",".hs-boot",".hsc"]},ini:{extensions:[".cfg",".cnf",".dof",".ini",".lektorproject",".prefs",".pro",".properties",".url"],filenames:[".buckconfig",".coveragerc",".flake8",".pylintrc","HOSTS","buildozer.spec","hosts","pylintrc","vlcrc"]},json:{extensions:[".4DForm",".4DProject",".JSON-tmLanguage",".avsc",".geojson",".gltf",".har",".ice",".json",".json.example",".jsonl",".mcmeta",".sarif",".tact",".tfstate",".tfstate.backup",".topojson",".webapp",".webmanifest",".yy",".yyp"],filenames:[".all-contributorsrc",".arcconfig",".auto-changelog",".c8rc",".htmlhintrc",".imgbotconfig",".nycrc",".tern-config",".tern-project",".watchmanconfig","MODULE.bazel.lock","Package.resolved","Pipfile.lock","bun.lock","composer.lock","deno.lock","flake.lock","mcmod.info"]},jsonc:{extensions:[".code-snippets",".code-workspace",".jsonc",".sublime-build",".sublime-color-scheme",".sublime-commands",".sublime-completions",".sublime-keymap",".sublime-macro",".sublime-menu",".sublime-mousemap",".sublime-project",".sublime-settings",".sublime-theme",".sublime-workspace",".sublime_metrics",".sublime_session"],filenames:[".babelrc",".devcontainer.json",".eslintrc.json",".jscsrc",".jshintrc",".jslintrc",".swcrc","api-extractor.json","argv.json","devcontainer.json","extensions.json","jsconfig.json","keybindings.json","language-configuration.json","launch.json","profiles.json","settings.json","tasks.json","tsconfig.json","tslint.json"]},java:{extensions:[".jav",".java",".jsh"]},javascript:{extensions:["._js",".bones",".cjs",".es",".es6",".frag",".gs",".jake",".javascript",".js",".jsb",".jscad",".jsfl",".jslib",".jsm",".jspre",".jss",".mjs",".njs",".pac",".sjs",".ssjs",".xsjs",".xsjslib"],filenames:["Jakefile"]},julia:{extensions:[".jl"]},kotlin:{extensions:[".kt",".ktm",".kts"]},less:{extensions:[".less"]},lua:{extensions:[".fcgi",".lua",".luau",".nse",".p8",".pd_lua",".rbxs",".rockspec",".wlua"],filenames:[".luacheckrc"]},makefile:{extensions:[".d",".mak",".make",".makefile",".mk",".mkfile"],filenames:["BSDmakefile","GNUmakefile","Kbuild","Makefile","Makefile.am","Makefile.boot","Makefile.frag","Makefile.in","Makefile.inc","Makefile.wat","makefile","makefile.sco","mkfile"]},markdown:{extensions:[".livemd",".markdown",".md",".mdown",".mdwn",".mdx",".mkd",".mkdn",".mkdown",".ronn",".scd",".workbook"],filenames:["contents.lr"]},"objective-c":{extensions:[".h",".m"]},"objective-cpp":{extensions:[".mm"]},php:{extensions:[".aw",".ctp",".fcgi",".inc",".install",".module",".php",".php3",".php4",".php5",".phps",".phpt",".theme"],filenames:[".php",".php_cs",".php_cs.dist","Phakefile"]},perl:{extensions:[".al",".cgi",".fcgi",".perl",".ph",".pl",".plx",".pm",".psgi",".t"],filenames:[".latexmkrc","Makefile.PL","Rexfile","ack","cpanfile","latexmkrc"]},powershell:{extensions:[".ps1",".psd1",".psm1"]},pug:{extensions:[".jade",".pug"]},python:{extensions:[".cgi",".codon",".fcgi",".gyp",".gypi",".lmi",".py",".py3",".pyde",".pyi",".pyp",".pyt",".pyw",".rpy",".sage",".spec",".tac",".wsgi",".xpy"],filenames:[".gclient","DEPS","SConscript","SConstruct","wscript"]},r:{extensions:[".r",".rd",".rsx"],filenames:[".Rprofile","expr-dist"]},ruby:{extensions:[".builder",".eye",".fcgi",".gemspec",".god",".jbuilder",".mspec",".pluginspec",".podspec",".prawn",".rabl",".rake",".rb",".rbi",".rbuild",".rbw",".rbx",".ru",".ruby",".spec",".thor",".watchr"],filenames:[".irbrc",".pryrc",".simplecov","Appraisals","Berksfile","Brewfile","Buildfile","Capfile","Dangerfile","Deliverfile","Fastfile","Gemfile","Guardfile","Jarfile","Mavenfile","Podfile","Puppetfile","Rakefile","Snapfile","Steepfile","Thorfile","Vagrantfile","buildfile"]},rust:{extensions:[".rs",".rs.in"]},scss:{extensions:[".scss"]},sql:{extensions:[".cql",".ddl",".inc",".mysql",".prc",".sql",".tab",".udf",".viw"]},sass:{extensions:[".sass"]},scala:{extensions:[".kojo",".sbt",".sc",".scala"]},shellscript:{extensions:[".bash",".bats",".cgi",".command",".fcgi",".fish",".ksh",".sh",".sh.in",".tmux",".tool",".trigger",".zsh",".zsh-theme"],filenames:[".bash_aliases",".bash_functions",".bash_history",".bash_logout",".bash_profile",".bashrc",".cshrc",".envrc",".flaskenv",".kshrc",".login",".profile",".tmux.conf",".zlogin",".zlogout",".zprofile",".zshenv",".zshrc","9fs","PKGBUILD","bash_aliases","bash_logout","bash_profile","bashrc","cshrc","gradlew","kshrc","login","man","profile","tmux.conf","zlogin","zlogout","zprofile","zshenv","zshrc"]},slang:{extensions:[".fxc",".hlsl",".s",".slang",".slangh",".usf",".ush",".vfx"]},slim:{extensions:[".slim"]},solidity:{extensions:[".sol"]},stylus:{extensions:[".styl"]},svelte:{extensions:[".svelte"]},swift:{extensions:[".swift"]},systemverilog:{extensions:[".sv",".svh",".vh"]},typescriptreact:{extensions:[".tsx"]},latex:{extensions:[".aux",".bbx",".cbx",".cls",".dtx",".ins",".lbx",".ltx",".mkii",".mkiv",".mkvi",".sty",".tex",".toc"]},typescript:{extensions:[".cts",".mts",".ts"]},verilog:{extensions:[".v",".veo"]},vim:{extensions:[".vba",".vim",".vimrc",".vmb"],filenames:[".exrc",".gvimrc",".nvimrc",".vimrc","_vimrc","gvimrc","nvimrc","vimrc"]},vb:{extensions:[".vb",".vbhtml",".Dsr",".bas",".cls",".ctl",".frm",".vbs"]},vue:{extensions:[".nvue",".vue"]},xml:{extensions:[".adml",".admx",".ant",".axaml",".axml",".builds",".ccproj",".ccxml",".clixml",".cproject",".cscfg",".csdef",".csl",".csproj",".ct",".depproj",".dita",".ditamap",".ditaval",".dll.config",".dotsettings",".filters",".fsproj",".fxml",".glade",".gml",".gmx",".gpx",".grxml",".gst",".hzp",".iml",".ivy",".jelly",".jsproj",".kml",".launch",".mdpolicy",".mjml",".mod",".mojo",".mxml",".natvis",".ncl",".ndproj",".nproj",".nuspec",".odd",".osm",".pkgproj",".plist",".pluginspec",".proj",".props",".ps1xml",".psc1",".pt",".pubxml",".qhelp",".rdf",".res",".resx",".rss",".sch",".scxml",".sfproj",".shproj",".srdf",".storyboard",".sublime-snippet",".svg",".sw",".targets",".tml",".typ",".ui",".urdf",".ux",".vbproj",".vcxproj",".vsixmanifest",".vssettings",".vstemplate",".vxml",".wixproj",".workflow",".wsdl",".wsf",".wxi",".wxl",".wxs",".x3d",".xacro",".xaml",".xib",".xlf",".xliff",".xmi",".xml",".xml.dist",".xmp",".xproj",".xsd",".xspec",".xul",".zcml"],filenames:[".classpath",".cproject",".project","App.config","NuGet.config","Settings.StyleCop","Web.Debug.config","Web.Release.config","Web.config","packages.config"]},xsl:{extensions:[".xsl",".xslt"]},yaml:{extensions:[".mir",".reek",".rviz",".sublime-syntax",".syntax",".yaml",".yaml-tmlanguage",".yaml.sed",".yml",".yml.mysql"],filenames:[".clang-format",".clang-tidy",".clangd",".gemrc","CITATION.cff","glide.lock","pixi.lock","yarn.lock"]},javascriptreact:{extensions:[".jsx"]},legend:{extensions:[".pure"]}};d();d();var txe=[".ejs",".erb",".haml",".hbs",".j2",".jinja",".jinja2",".liquid",".mustache",".njk",".php",".pug",".slim",".webc"],rxe={".php":[".blade"]},Gw=Object.keys(Px).flatMap(e=>Px[e].extensions);var xX=Xe(require("node:path"));var FI=class{constructor(t,r,n){this.languageId=t;this.isGuess=r;this.fileExtension=n}static{o(this,"Language")}},Hw=class{static{o(this,"LanguageDetection")}},vX=new Map,PI=new Map;for(let[e,{extensions:t,filenames:r}]of Object.entries(Px)){for(let n of t)vX.set(n,[...vX.get(n)??[],e]);for(let n of r??[])PI.set(n,[...PI.get(n)??[],e])}var bX=class extends Hw{static{o(this,"FilenameAndExensionLanguageDetection")}detectLanguage(t){let r=Bi(t.uri),n=xX.extname(r).toLowerCase(),i=this.extensionWithoutTemplateLanguage(r,n),s=this.detectLanguageId(r,i),a=this.computeFullyQualifiedExtension(n,i);return s?new FI(s.languageId,s.isGuess,a):new FI(t.languageId,!0,a)}extensionWithoutTemplateLanguage(t,r){if(txe.includes(r)){let n=t.substring(0,t.lastIndexOf(".")),i=xX.extname(n).toLowerCase();if(i.length>0&&Gw.includes(i)&&this.isExtensionValidForTemplateLanguage(r,i))return i}return r}isExtensionValidForTemplateLanguage(t,r){let n=rxe[t];return!n||n.includes(r)}detectLanguageId(t,r){if(PI.has(t))return{languageId:PI.get(t)[0],isGuess:!1};let n=vX.get(r)??[];if(n.length>0)return{languageId:n[0],isGuess:n.length>1};for(;t.includes(".");)if(t=t.replace(/\.[^.]*$/,""),PI.has(t))return{languageId:PI.get(t)[0],isGuess:!1}}computeFullyQualifiedExtension(t,r){return t!==r?r+t:t}},EX=class extends Hw{constructor(r){super();this.delegate=r}static{o(this,"GroupingLanguageDetection")}detectLanguage(r){let n=this.delegate.detectLanguage(r),i=n.languageId;return i==="c"||i==="cpp"?new FI("cpp",n.isGuess,n.fileExtension):n}},IX=class extends Hw{constructor(r){super();this.delegate=r}static{o(this,"ClientProvidedLanguageDetection")}detectLanguage(r){return r.uri.startsWith("untitled:")||r.uri.startsWith("vscode-notebook-cell:")?new FI(r.languageId,!0,""):this.delegate.detectLanguage(r)}},nlt=new EX(new IX(new bX));function NI({uri:e,languageId:t}){let r=nlt.detectLanguage({uri:e,languageId:"UNKNOWN"});return r.languageId==="UNKNOWN"?t:r.languageId}o(NI,"detectLanguage");d();d();d();d();function j1(e){if(e.isCancellationRequested)throw new nL}o(j1,"throwIfCancellationRequested");function jw(e){return e instanceof nL?!0:e instanceof Error&&e.name===TX&&e.message===TX}o(jw,"isCancellationError");var nL=class extends Error{static{o(this,"CancellationError")}constructor(){super(TX),this.name=this.message}},TX="Canceled",iL=class{constructor(){this.items=[]}static{o(this,"Stack")}push(t){this.items.push(t)}pop(){return this.items.pop()}peek(){return this.items[this.items.length-1]}tryPeek(){return this.items.length>0}toArray(){return this.items}};function Fx(e){switch(e){case 0:case 2:case 7:case 8:case 11:case 12:case 13:case 14:return!0;default:return!1}}o(Fx,"isTypeDefinition");var Ad=class e{static{o(this,"TextRange")}static{this.empty=new e(0,0)}constructor(t,r){this.start=t,this.length=r}static fromBounds(t,r){return new e(t,r-t)}get end(){return this.start+this.length}contains(t){return this.start<=t&&this.end>=t}containsRange(t){return this.start<=t.start&&this.end>=t.end}equals(t){return this.start===t.start&&this.length===t.length}getText(t){return t.slice(this.start,this.end)}getTextWithIndentation(t,r){let n=[],i=this.start;for(i=ixe(t,t.length,i),nxe(n,r);i<this.end;)t[i]!=="\r"&&t[i]!==`
241
+ ]`];function z3e(e){return mat([hat],e).length==1}o(z3e,"queryPythonIsDocstring");var XN=class e extends kI{static{o(this,"BlockTokenSubsetMatcher")}constructor(t,r){super(t),this.windowLength=r}static{this.FACTORY=o(t=>({to:o(r=>new e(r,t),"to")}),"FACTORY")}id(){return"fixed:"+this.windowLength}getWindowsDelineations(t){return YN(this.windowLength,t)}_getCursorContextInfo(t){return Lw(t,{maxLineCount:this.windowLength})}get referenceTokens(){return this.createReferenceTokensForLanguage()}async createReferenceTokensForLanguage(){return this.referenceTokensCache?this.referenceTokensCache:(this.referenceTokensCache=e.syntaxAwareSupportsLanguage(this.referenceDoc.languageId)?await this.syntaxAwareReferenceTokens():await super.referenceTokens,this.referenceTokensCache)}async syntaxAwareReferenceTokens(){let t=(await this.getEnclosingMemberStart(this.referenceDoc.source,this.referenceDoc.offset))?.startIndex,r=this.referenceDoc.offset,n=t?this.referenceDoc.source.slice(t,r):Lw(this.referenceDoc,{maxLineCount:this.windowLength}).context;return this.tokenizer.tokenize(n)}static syntaxAwareSupportsLanguage(t){switch(t){case"csharp":return!0;default:return!1}}similarityScore(t,r){return pat(t,r)}async getEnclosingMemberStart(t,r){let n;try{n=await H1(this.referenceDoc.languageId,t);let i=n.rootNode.namedDescendantForIndex(r);for(;i&&!(e.isMember(i)||e.isBlock(i));)i=i.parent??void 0;return i}finally{n?.delete()}}static isMember(t){switch(t?.type){case"method_declaration":case"property_declaration":case"field_declaration":case"constructor_declaration":return!0;default:return!1}}static isBlock(t){switch(t?.type){case"class_declaration":case"struct_declaration":case"record_declaration":case"enum_declaration":case"interface_declaration":return!0;default:return!1}}};function pat(e,t){let r=new Set;return t.forEach(n=>{e.has(n)&&r.add(n)}),r.size}o(pat,"computeScore");var gat=0,Aat=60,yat=4,Cat=1,xat=20,vat=1e4,pX={snippetLength:Aat,threshold:gat,maxTopSnippets:yat,maxCharPerFile:vat,maxNumberOfFiles:xat,maxSnippetsPerFile:Cat,useSubsetMatching:!1};var eL={snippetLength:60,threshold:0,maxTopSnippets:16,maxCharPerFile:1e5,maxNumberOfFiles:200,maxSnippetsPerFile:4};function bat(e,t){return(t.useSubsetMatching?XN.FACTORY(t.snippetLength):KN.FACTORY(t.snippetLength)).to(e)}o(bat,"getMatcher");async function Y3e(e,t,r){let n=bat(e,r);return r.maxTopSnippets===0?[]:(await t.filter(s=>s.source.length<r.maxCharPerFile&&s.source.length>0).slice(0,r.maxNumberOfFiles).reduce(async(s,a)=>(await s).concat((await n.findMatches(a,r.maxSnippetsPerFile)).map(l=>({relativePath:a.relativePath,...l}))),Promise.resolve([]))).filter(s=>s.score&&s.snippet&&s.score>r.threshold).sort((s,a)=>s.score-a.score).slice(-r.maxTopSnippets)}o(Y3e,"getSimilarSnippets");var Uw=500,qw=8192-Uw,K3e=4;var tL=10,rL=15;var Eat={javascriptreact:"javascript",jsx:"javascript",typescriptreact:"typescript",jade:"pug",cshtml:"razor",c:"cpp"};function Ww(e){return e=e.toLowerCase(),Eat[e]??e}o(Ww,"normalizeLanguageId");var gX=class{constructor(t){this.ctx=t;this.cache=new In(200)}static{o(this,"FilterSettingsToExpConfigs")}async fetchExpConfig(t){let r=this.cache.get(t.stringify());return r||(r=new AX(()=>this.ctx.get(Vm).fetchExperiments(this.ctx,t.toHeaders()),1e3*60*60),this.cache.set(t.stringify(),r)),r.run()}getCachedExpConfig(t){return this.cache.get(t.stringify())?.value()}},AX=class{constructor(t,r=1/0){this.producer=t;this.expirationMs=r}static{o(this,"Task")}async run(){return this.promise===void 0&&(this.promise=this.producer(),this.storeResult(this.promise).then(()=>{this.expirationMs<1/0&&this.promise!==void 0&&setTimeout(()=>this.promise=void 0,this.expirationMs)})),this.promise}async storeResult(t){try{this.result=await t}finally{this.result===void 0&&(this.promise=void 0)}}value(){return this.result}};function Tat(e){return"uri"in e}o(Tat,"isCompletionsFiltersInfo");var Cr=class e{constructor(t){this.ctx=t;this.staticFilters={};this.dynamicFilters={};this.dynamicFilterGroups=[];this.upcomingDynamicFilters={};this.assignments=new gX(this.ctx)}static{o(this,"Features")}static{this.upcomingDynamicFilterCheckDelayMs=20}static{this.upcomingTimeBucketMinutes=5+Math.floor(Math.random()*11)}registerStaticFilters(t){Object.assign(this.staticFilters,t)}registerDynamicFilter(t,r){this.dynamicFilters[t]=r}registerDynamicFilterGroup(t){this.dynamicFilterGroups.push(t)}getDynamicFilterValues(){let t={};for(let r of this.dynamicFilterGroups)Object.assign(t,r());for(let[r,n]of Object.entries(this.dynamicFilters))t[r]=n();return t}registerUpcomingDynamicFilter(t,r){this.upcomingDynamicFilters[t]=r}async updateExPValuesAndAssignments(t,r=cn.createAndMarkAsIssued()){if(r instanceof Mp)throw new Error("updateExPValuesAndAssignments should not be called with TelemetryWithExp");let n=t&&Tat(t)?i5(this.ctx,t.uri):void 0,i=G1(n)??"",s=E3e(n)??"",a=t?.languageId??"",l=n5(this.ctx).modelId,c=await b3e(this.ctx),u=await Fw(this.ctx,"ft"),f=await Fw(this.ctx,"ol"),m=await Fw(this.ctx,"cml"),h=await Fw(this.ctx,"tid"),p={"X-Copilot-Repository":i,"X-Copilot-FileType":a,"X-Copilot-UserKind":c,"X-Copilot-Dogfood":s,"X-Copilot-Engine":l,"X-Copilot-CustomModel":u,"X-Copilot-Orgs":f,"X-Copilot-CustomModelNames":m,"X-Copilot-CopilotTrackingId":h},g=this.getGranularityDirectory(),x=this.makeFilterSettings(p),v=g.extendFilters(x),E=await this.getExpConfig(v.newFilterSettings);g.update(x,+(E.variables.copilotbycallbuckets??NaN),+(E.variables.copilottimeperiodsizeinh??NaN));let b=g.extendFilters(x),_=b.newFilterSettings,R=await this.getExpConfig(_),P=new Promise(F=>setTimeout(F,e.upcomingDynamicFilterCheckDelayMs));for(let F of b.otherFilterSettingsToPrefetch)P=P.then(async()=>{await new Promise(G=>setTimeout(G,e.upcomingDynamicFilterCheckDelayMs)),this.getExpConfig(F)});return this.prepareForUpcomingFilters(_),new Mp(r.properties,r.measurements,r.issuedTime,{filters:_,exp:R})}getGranularityDirectory(){if(!this.granularityDirectory){let t=this.ctx.get(_s).machineId;this.granularityDirectory=new dN(t,this.ctx.get(Tp))}return this.granularityDirectory}makeFilterSettings(t){return new nx({...this.staticFilters,...this.getDynamicFilterValues(),...t})}async getExpConfig(t){try{return this.assignments.fetchExpConfig(t)}catch(r){return dd.createFallbackConfig(this.ctx,`Error fetching ExP config: ${String(r)}`)}}async prepareForUpcomingFilters(t){if(!(new Date().getMinutes()<60-e.upcomingTimeBucketMinutes))for(let[r,n]of Object.entries(this.upcomingDynamicFilters))await new Promise(i=>setTimeout(i,e.upcomingDynamicFilterCheckDelayMs)),this.getExpConfig(t.withChange(r,n()))}stringify(){let t=this.assignments.getCachedExpConfig(new nx({}));return JSON.stringify(t?.variables??{})}async getFallbackExpAndFilters(){let t=this.makeFilterSettings({}),r=await this.getExpConfig(t);return{filters:t,exp:r}}disableLogProb(t){return t.filtersAndExp.exp.variables.copilotdisablelogprob??!0}overrideBlockMode(t){return t.filtersAndExp.exp.variables.copilotoverrideblockmode||void 0}customEngine(t){return t.filtersAndExp.exp.variables.copilotcustomengine??""}customEngineTargetEngine(t){return t.filtersAndExp.exp.variables.copilotcustomenginetargetengine}suffixPercent(t){return t.filtersAndExp.exp.variables.CopilotSuffixPercent??rL}suffixMatchThreshold(t){return t.filtersAndExp.exp.variables.copilotsuffixmatchthreshold??tL}cppHeadersShutdownSwitch(t){return t.filtersAndExp.exp.variables.copilotcppheadersshutdownswitch??!1}relatedFilesVSCodeCSharp(t){return t.filtersAndExp.exp.variables.copilotrelatedfilesvscodecsharp??!1}relatedFilesVSCodeTypeScript(t){return t.filtersAndExp.exp.variables.copilotrelatedfilesvscodetypescript??!1}relatedFilesVSCode(t){return t.filtersAndExp.exp.variables.copilotrelatedfilesvscode??!1}excludeOpenTabFilesCSharp(t){return t.filtersAndExp.exp.variables.copilotexcludeopentabfilescsharp??!1}excludeOpenTabFilesCpp(t){return t.filtersAndExp.exp.variables.copilotexcludeopentabfilescpp??!1}excludeOpenTabFilesTypeScript(t){return t.filtersAndExp.exp.variables.copilotexcludeopentabfilestypescript??!1}fallbackToOpenTabFilesWithNoRelatedFiles(t){return t.filtersAndExp.exp.variables.copilotfallbacktoopentabfiles??!1}contextProviders(t){let r=t.filtersAndExp.exp.variables.copilotcontextproviders??"";return r?r.split(",").map(n=>n.trim()):[]}includeNeighboringFiles(t){return t.filtersAndExp.exp.variables.copilotincludeneighboringfiles??!1}maxPromptCompletionTokens(t){return t.filtersAndExp.exp.variables.maxpromptcompletionTokens??qw+Uw}promptOrderListPreset(t){let r=t.filtersAndExp.exp.variables.copilotpromptorderlistpreset;return"default"}promptPriorityPreset(t){switch(t.filtersAndExp.exp.variables.copilotpromptprioritypreset){case"office-exp":return"office-exp";default:return"default"}}ideChatMaxRequestTokens(t){return t.filtersAndExp.exp.variables.idechatmaxrequesttokens??-1}ideChatExpModelIds(t){return t.filtersAndExp.exp.variables.idechatexpmodelids??""}ideChatEnableProjectMetadata(t){return t.filtersAndExp.exp.variables.idechatenableprojectmetadata??!1}ideEnableCopilotEditsAgent(t){return t.filtersAndExp.exp.variables.ideenablecopiloteditsagent??!1}recentEditsInPrompt(t){return t.filtersAndExp.exp.variables.copilotrecenteditsinprompt??!1}recentEditsEditCount(t){return t.filtersAndExp.exp.variables.copilotrecenteditseditcount??5}recentEditsMaxFiles(t){return t.filtersAndExp.exp.variables.copilotrecenteditsmaxfiles??5}recentEditsContextLines(t){return t.filtersAndExp.exp.variables.copilotrecenteditscontextlines??3}recentEditsRemoveDeletedLines(t){return t.filtersAndExp.exp.variables.copilotrecenteditsremovedeletedlines??!1}recentEditsInsertionsBeforeDeletions(t){return t.filtersAndExp.exp.variables.copilotrecenteditsinsertionsbeforedeletions??!1}recentEditsAppendNoReplyMarker(t){return t.filtersAndExp.exp.variables.copilotrecenteditsappendnoreplymarker??!1}recentEditsMaxLinesBetweenEdits(t){return t.filtersAndExp.exp.variables.copilotrecenteditsmaxlinesbetweenedits??100}recentEditsActiveDocDistanceLimitFromCursor(t){return t.filtersAndExp.exp.variables.copilotrecenteditsactivedocdistancelimitfromcursor??100}recentEditsSummarizationFormat(t){return t.filtersAndExp.exp.variables.copilotrecenteditsummarizationformat??"diff"}triggerCompletionAfterAccept(t){return t.filtersAndExp.exp.variables.copilottriggercompletionafteraccept}enableAsyncCompletions(t){return t.filtersAndExp.exp.variables.copilotasynccompletions??!1}enableSpeculativeRequests(t){return t.filtersAndExp.exp.variables.copilotspeculativerequests??!1}cppContextProviderParams(t){return t.filtersAndExp.exp.variables.copilotcppContextProviderParams}disableContextualFilter(t){return t.filtersAndExp.exp.variables.copilotdisablecontextualfilter??!1}vscodeDebounceThreshold(t){return t.filtersAndExp.exp.variables.copilotvscodedebouncethreshold}enableElectronFetcher(t){return t.filtersAndExp.exp.variables.copilotelectronfetcher??!1}asyncCompletionsTimeout(t){return t.filtersAndExp.exp.variables.copilotasynccompletionstimeout??100}enablePromptContextProxyField(t){return t.filtersAndExp.exp.variables.copilotenablepromptcontextproxyfield??!1}enableProgressiveReveal(t){return t.filtersAndExp.exp.variables.copilotprogressivereveal??!1}enableMultilineAfterAccept(t){return t.filtersAndExp.exp.variables.copilotmultilineafteraccept??!1}enablePrefixCompletionsCache(t){return t.filtersAndExp.exp.variables.copilotprefixcompletionscache??!1}};var yX={};b1(yX,{activationEvents:()=>jat,badges:()=>Hat,bugs:()=>Lat,build:()=>Rat,buildType:()=>Bat,categories:()=>Wat,contributes:()=>CX,default:()=>Zat,dependencies:()=>Kat,description:()=>Sat,devDependencies:()=>Yat,displayName:()=>_at,enabledApiProposals:()=>$at,engines:()=>qat,extensionPack:()=>Uat,homepage:()=>Fat,icon:()=>Mat,keywords:()=>Gat,license:()=>Nat,main:()=>Vat,name:()=>wat,overrides:()=>Jat,preview:()=>Pat,pricing:()=>Oat,publisher:()=>Dat,qna:()=>Qat,scripts:()=>zat,version:()=>kat});var wat="copilot",_at="GitHub Copilot",Sat="Your AI pair programmer",kat="1.316.0",Rat="1549",Bat="prod",Dat="GitHub",Pat=!1,Fat="https://github.com/features/copilot?editor=vscode",Nat="https://docs.github.com/en/site-policy/github-terms/github-terms-for-additional-products-and-features",Lat={url:"https://github.com/microsoft/vscode-copilot-release/issues"},Qat="https://github.com/github-community/community/discussions/categories/copilot",Mat="assets/Copilot-App-Icon.png",Oat="Trial",Uat=["GitHub.copilot-chat"],qat={vscode:"^1.98.0",node:">=20.0.0",npm:">=9.0.0"},Wat=["AI","Chat","Programming Languages","Machine Learning"],Gat=["ai","openai","codex","pilot","snippets","documentation","autocomplete","intellisense","refactor","javascript","python","typescript","php","go","golang","ruby","c++","c#","java","kotlin","co-pilot"],Hat=[{url:"https://img.shields.io/badge/GitHub%20Copilot-Subscription%20Required-orange",href:"https://github.com/github-copilot/signup?editor=vscode",description:"Sign up for GitHub Copilot"},{url:"https://img.shields.io/github/stars/github/copilot-docs?style=social",href:"https://github.com/github/copilot-docs",description:"Star Copilot on GitHub"},{url:"https://img.shields.io/youtube/channel/views/UC7c3Kb6jYCRj4JOHHZTxKsQ?style=social",href:"https://www.youtube.com/@GitHub/search?query=copilot",description:"Check out GitHub on Youtube"},{url:"https://img.shields.io/twitter/follow/github?style=social",href:"https://twitter.com/github",description:"Follow GitHub on Twitter"}],jat=["onStartupFinished"],Vat="./dist/extension",$at=["inlineCompletionsAdditions"],CX={commands:[{command:"github.copilot.toggleStatusMenu",title:"Open Status Menu",category:"GitHub Copilot"},{command:"github.copilot.signIn",title:"Sign In",category:"GitHub Copilot",enablement:"!github.copilot.activated"},{command:"github.copilot.acceptCursorPanelSolution",title:"Accept Panel Suggestion at the Cursor",enablement:"github.copilot.panelVisible",category:"GitHub Copilot"},{command:"github.copilot.previousPanelSolution",title:"Navigate to the Previous Panel Suggestion",enablement:"github.copilot.panelVisible",category:"GitHub Copilot"},{command:"github.copilot.nextPanelSolution",title:"Navigate to the Next Panel Suggestion",enablement:"github.copilot.panelVisible",category:"GitHub Copilot"},{command:"github.copilot.generate",title:"Open Completions Panel",enablement:"github.copilot.activated",category:"GitHub Copilot"},{command:"github.copilot.completions.disable",title:"Disable Completions",enablement:"github.copilot.activated && config.editor.inlineSuggest.enabled && github.copilot.completions.enabled",category:"GitHub Copilot"},{command:"github.copilot.completions.enable",title:"Enable Completions",enablement:"github.copilot.activated && !(config.editor.inlineSuggest.enabled && github.copilot.completions.enabled)",category:"GitHub Copilot"},{command:"github.copilot.completions.toggle",title:"Toggle (Enable/Disable) Completions",enablement:"github.copilot.activated",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"},{command:"github.copilot.openModelPicker",title:"Change Completions Model",category:"GitHub Copilot"},{command:"github.copilot.sendCompletionFeedback",title:"Send Copilot Completion Feedback",category:"GitHub Copilot"}],keybindings:[{command:"github.copilot.generate",key:"ctrl+enter",mac:"ctrl+enter",when:"editorTextFocus && !commentEditorFocused"},{command:"github.copilot.acceptCursorPanelSolution",key:"ctrl+/",mac:"ctrl+/",when:"activeWebviewPanelId == 'GitHub Copilot Suggestions'"},{command:"github.copilot.previousPanelSolution",key:"alt+[",mac:"alt+[",when:"activeWebviewPanelId == 'GitHub Copilot Suggestions'"},{command:"github.copilot.nextPanelSolution",key:"alt+]",mac:"alt+]",when:"activeWebviewPanelId == 'GitHub Copilot Suggestions'"},{command:"editor.action.inlineSuggest.trigger",key:"alt+\\",when:"editorTextFocus && !editorHasSelection && !inlineSuggestionsVisible"}],configuration:[{title:"GitHub Copilot",properties:{"github.copilot.selectedCompletionModel":{type:"string",default:"",markdownDescription:'The currently selected completion model ID. To select from a list of available models, use the __"Change Completion Model"__ command or open the model picker from the Copilot menu. The value must be a valid model ID. An empty value indicates that the default model will be used.'},"github.copilot.advanced":{type:"object",title:"Advanced Settings",properties:{authProvider:{type:"string",enum:["github","github-enterprise"],enumDescriptions:["GitHub.com","GitHub Enterprise"],default:"github",description:"The GitHub identity to use for Copilot"},authPermissions:{type:"string",enum:["default","minimal"],markdownEnumDescriptions:["Default (recommended) - The default permissions enable the best that Copilot has to offer including, but not limited to, faster repo indexing and the power of the `@github` agent.","Minimal - The minimal permissions required for Copilot functionality."],default:"default",markdownDescription:"Controls what kind of permissions are asked for when signing in to Copilot. The options are\n* `default` - (strongly recommended) The default permissions enable the best that Copilot has to offer including, but not limited to, faster repo indexing and the power of the `@github` agent.\n* `minimal` - The minimal permissions are the least that Copilot needs to function. Some features may behave slower or not at all."},useLanguageServer:{type:"boolean",default:!1,description:"Experimental: Use language server"},"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:[],deprecationMessage:"Set overrideLogLevels.* to ERROR to filter out unwanted categories.",description:"Show only log categories listed in this setting. If an array is empty, show all loggers"}}},"github.copilot.enable":{type:"object",scope:"window",default:{"*":!0,plaintext:!1,markdown:!1,scminput:!1},additionalProperties:{type:"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:"This setting has no effect. Please use github.copilot.enable instead.",description:"Show inline suggestions"},"github.copilot.editor.enableAutoCompletions":{type:"boolean",scope:"language-overridable",default:!0,deprecationMessage:"This setting has no effect. Please use github.copilot.enable instead.",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"}],iconFonts:[{id:"copilot-font",src:[{path:"assets/copilot.woff",format:"woff"}]}]},zat={build:"tsx esbuild.ts",clean:"./script/build/clean.sh",compress:"tsx ./script/compressTokenizer.ts","forbid-sources-content:extension":"node script/forbid-sources-content.js --extension",generate_languages:"tsx script/generateLanguages.ts && prettier --write lib/src/language/generatedLanguages.ts",get_token:"tsx script/getToken.ts",lint:'run-p --aggregate-output "lint:*"',"lint:deps":"depcruise -c .dependency-cruiser.js .","lint:eslint":"eslint -f visualstudio --quiet --cache .","lint:prettier":"prettier --check . 2>&1","lint:types":"tsc --noEmit && tsc --noEmit -p extension/src/copilotPanel/webview",prebuild:"npm install",pretest:"npm run build","pretest:headless":"npm run build","pretest:extension":"npm run build","pretest:lsp-client":"npm run build","pretest:lib-e2e":"npm run build",prewatch:"npm run build","prewatch:esbuild":"npm run build",start:"npm run watch",test:'npm-run-all "test:extension --ignore-scripts" "test:headless --ignore-scripts" lint',"test:headless":'npm-run-all test:lib test:agent "test:lib-e2e --ignore-scripts" test:prompt "test:lsp-client --ignore-scripts" lint',"test:agent":'mocha "agent/src/**/*.test.{ts,tsx}"',"test:extension":"tsx extension/test/runTest.ts","test:lib":'mocha "lib/src/**/*.test.{ts,tsx}"',"test:lib-e2e":'mocha "lib/e2e/src/**/*.test.{ts,tsx}" --exclude "lib/e2e/src/prompt/**/*.test.ts"',"test:lib-e2e-no-ci":'mocha "lib/e2e/no-ci/**/*.test.{ts,tsx}"',"test:lib-prompt-e2e":'mocha "lib/e2e/src/prompt/prompt.test.ts"',"test:lib-prompt-e2e-perf":"INCLUDE_PERFORMANCE=true npm run test:lib-prompt-e2e","test:lsp-client":'mocha "lsp-client/test/*.test.{ts,tsx}"',"test:prompt":'mocha "prompt/test/**/*.test.{ts,tsx}"',"vscode-dts":"vscode-dts dev && mv vscode.proposed.*.ts extension/src","vscode:prepublish":'run-s "build --ignore-scripts" forbid-sources-content:extension',"vscode:uninstall":"node dist/extensionUninstalled.js",vsix:"vsce package --allow-missing-repository",watch:'run-p "watch:esbuild --ignore-scripts" "watch:types -- --preserveWatchOutput"',"watch:esbuild":"tsx esbuild.ts --watch","watch:types":"tsc --noEmit --watch"},Yat={"@datadog/datadog-ci":"^3.4.0","@github/prettier-config":"0.0.6","@limegrass/eslint-plugin-import-alias":"^1.5.1","@parcel/watcher":"^2.5.1","@types/benchmark":"^2.1.5","@types/crypto-js":"^4.2.2","@types/diff":"^7.0.2","@types/git-url-parse":"^16.0.0","@types/js-yaml":"^4.0.6","@types/kerberos":"^1.1.2","@types/mocha":"^10.0.10","@types/node":"~20.8.0","@types/semver":"^7.7.0","@types/sinon":"^17.0.4","@types/uuid":"^10.0.0","@types/vscode":"1.98.0","@types/yargs":"^17.0.24","@vscode/test-electron":"^2.5.2","@vscode/vsce":"^3.3.2","@yao-pkg/pkg":"^6.4.0",benchmark:"^2.1.4",boxen:"^8.0.1",chalk:"^5.4.1","dependency-cruiser":"^16.10.0",electron:"^28.1.4",esbuild:"^0.25.3","esbuild-plugin-copy":"^2.1.1",eslint:"^9.25.1","eslint-formatter-visualstudio":"^8.40.0","eslint-plugin-mocha":"^10.5.0",fantasticon:"^3.0.0",glob:"^11.0.2",globals:"^16.0.0","js-yaml":"^4.1.0",mocha:"^11.2.2","mocha-junit-reporter":"^2.2.1","mocha-multi-reporters":"^1.5.1","npm-run-all":"^4.1.5",prettier:"^3.5.3","prettier-plugin-organize-imports":"^4.1.0",proxy:"^2.1.1","simple-git":"^3.27.0",sinon:"^20.0.0","ts-dedent":"^2.2.0",tsx:"^4.19.4",typescript:"^5.8.3","typescript-eslint":"^8.32.0","vscode-dts":"^0.3.3"},Kat={"@adobe/helix-fetch":"github:devm33/helix-fetch#1088e599270f36632703f138d88c2100cbe468db","@github/memoize":"1.1.5","@microsoft/1ds-post-js":"^4.3.6","@microsoft/applicationinsights-web-basic":"^3.3.6","@microsoft/tiktokenizer":"^1.0.10","@modelcontextprotocol/sdk":"^1.11.0","@sinclair/typebox":"^0.34.33","@types/vscode-webview":"^1.57.4","@vscode/codicons":"^0.0.36","@vscode/prompt-tsx":"0.4.0-alpha.1","@vscode/webview-ui-toolkit":"^1.3.1","await-lock":"^2.2.2","crypto-js":"^4.2.0",diff:"^7.0.0",dldr:"^0.0.10","get-stream":"^6.0.1","git-url-parse":"^16.0.3",kerberos:"^2.2.0","mac-ca":"^3.1.1",microjob:"^0.7.0",minimatch:"^9.0.3",open:"^10.1.2","os-browserify":"^0.3.0","path-browserify":"^1.0.1",semver:"^7.7.1",shiki:"~1.15.0","source-map-support":"^0.5.21",sqlite3:"^5.1.7",uuid:"^11.1.0","vscode-languageclient":"^9.0.0","vscode-languageserver":"^9.0.0","vscode-languageserver-protocol":"^3.17","vscode-languageserver-textdocument":"~1.0.11","vscode-uri":"^3.1.0","web-tree-sitter":"^0.20.8","windows-ca-certs":"^0.1.0",yargs:"^17.7.2"},Jat={fsevents:"<0",bindings:"npm:bundled-bindings@^1.5.0"},Zat={name:wat,displayName:_at,description:Sat,version:kat,build:Rat,buildType:Bat,publisher:Dat,preview:Pat,homepage:Fat,license:Nat,bugs:Lat,qna:Qat,icon:Mat,pricing:Oat,extensionPack:Uat,engines:qat,categories:Wat,keywords:Gat,badges:Hat,activationEvents:jat,main:Vat,enabledApiProposals:$at,contributes:CX,scripts:zat,devDependencies:Yat,dependencies:Kat,overrides:Jat};var St={Enable:"enable",UserSelectedCompletionModel:"selectedCompletionModel",ShowEditorCompletions:"editor.showEditorCompletions",EnableAutoCompletions:"editor.enableAutoCompletions",DelayCompletions:"editor.delayCompletions",FilterCompletions:"editor.filterCompletions",FetchStrategy:"fetchStrategy",RelatedFilesVSCodeCSharp:"advanced.relatedFilesVSCodeCSharp",RelatedFilesVSCodeTypeScript:"advanced.relatedFilesVSCodeTypeScript",RelatedFilesVSCode:"advanced.relatedFilesVSCode",ExcludeOpenTabFilesCSharp:"advanced.excludeOpenTabFilesCSharp",ExcludeOpenTabFilesCpp:"advanced.excludeOpenTabFilesCpp",ExcludeOpenTabFilesTypeScript:"advanced.excludeOpenTabFilesTypeScript",FallbackToOpenTabFilesWithNoRelatedFiles:"advanced.fallbackToOpenTabFilesWithNoRelatedFiles",ContextProviders:"advanced.contextProviders",DebugOverrideLogLevels:"advanced.debug.overrideLogLevels",DebugFilterLogCategories:"advanced.debug.filterLogCategories",DebugSnippyOverrideUrl:"advanced.debug.codeRefOverrideUrl",DebugUseElectronFetcher:"advanced.debug.useElectronFetcher",DebugUseEditorFetcher:"advanced.debug.useEditorFetcher",UseSubsetMatching:"advanced.useSubsetMatching",EnablePromptComponents:"advanced.enablePromptComponents",ContextProviderTimeBudget:"advanced.contextProviderTimeBudget",DebugOverrideCapiUrl:"internal.capiUrl",DebugOverrideCapiUrlLegacy:"advanced.debug.overrideCapiUrl",DebugTestOverrideCapiUrl:"internal.capiTestUrl",DebugTestOverrideCapiUrlLegacy:"advanced.debug.testOverrideCapiUrl",DebugOverrideProxyUrl:"internal.completionsUrl",DebugOverrideProxyUrlLegacy:"advanced.debug.overrideProxyUrl",DebugTestOverrideProxyUrl:"internal.completionsTestUrl",DebugTestOverrideProxyUrlLegacy:"advanced.debug.testOverrideProxyUrl",DebugOverrideEngine:"internal.completionModel",DebugOverrideEngineLegacy:"advanced.debug.overrideEngine",UseAsyncCompletions:"internal.useAsyncCompletions",EnableSpeculativeRequests:"internal.enableSpeculativeRequests",EnablePrefixCache:"internal.enablePrefixCache",AlwaysRequestMultiline:"internal.alwaysRequestMultiline",TrimCompletionsAggressively:"internal.trimCompletionsAggressively",VSCodeDebounceThreshold:"internal.vscodeDebounceThreshold",RecentEditsInPrompt:"internal.recentEditsInPrompt",RecentEditsEditCount:"internal.recentEditsEditCount",RecentEditsMaxFiles:"internal.recentEditsMaxFiles",RecentEditsContextLines:"internal.recentEditsContextLines",RecentEditsRemoveDeletedLines:"internal.recentEditsRemoveDeletedLines",InsertionsBeforeDeletions:"internal.recentEditsInsertionsBeforeDeletions",RecentEditsAppendNoReplyMarker:"internal.recentEditsAppendNoReplyMarker",RecentEditsMaxLinesBetweenEdits:"internal.recentEditsMaxLinesBetweenEdits",RecentEditsActiveDocDistanceLimitFromCursor:"internal.recentEditsActiveDocDistanceLimitFromCursor",RecentEditsSummarizationFormat:"internal.recentEditsSummarizationFormat",IncludeNeighboringFiles:"internal.includeNeighboringFiles",DebugOverrideCppHeadersShutdownSwitch:"internal.cppHeadersShutdownSwitch",MultilineAfterAccept:"internal.multilineAfterAccept"};function X3e(e){return["server","parsingandserver"].includes(e)}o(X3e,"shouldDoServerTrimming");var Km=class{static{o(this,"BlockModeConfig")}},BI=class extends Km{static{o(this,"ConfigBlockModeConfig")}forLanguage(t,r,n){let i=t.get(Cr).overrideBlockMode(n);if(i)return J3e(i,r);let s=t.get(Cr).enableProgressiveReveal(n);return On(t,St.AlwaysRequestMultiline)??s?J3e("moremultiline",r):r=="ruby"?"parsing":Xu(r)?"parsingandserver":"server"}};function Xat(e){return["parsing","parsingandserver","moremultiline"].includes(e)}o(Xat,"blockModeRequiresTreeSitter");function J3e(e,t){return Xat(e)&&!Xu(t)?"server":e}o(J3e,"toApplicableBlockMode");var Wp=class{static{o(this,"ConfigProvider")}},DI=class extends Wp{static{o(this,"DefaultsOnlyConfigProvider")}getConfig(t){return tlt(t)}getOptionalConfig(t){return rlt(t)}dumpForTelemetry(){return{}}},Dx=class extends Wp{constructor(r,n){super();this.baseConfigProvider=r;this.overrides=n}static{o(this,"InMemoryConfigProvider")}getOptionalOverride(r){return this.overrides.get(r)}getConfig(r){return this.getOptionalOverride(r)??this.baseConfigProvider.getConfig(r)}getOptionalConfig(r){return this.getOptionalOverride(r)??this.baseConfigProvider.getOptionalConfig(r)}setConfig(r,n){n!==void 0?this.overrides.set(r,n):this.overrides.delete(r)}dumpForTelemetry(){let r=this.baseConfigProvider.dumpForTelemetry();for(let n of[St.ShowEditorCompletions,St.EnableAutoCompletions,St.DelayCompletions,St.FilterCompletions]){let i=this.overrides.get(n);i!==void 0&&(r[n]=JSON.stringify(i))}return r}};function elt(e){return e?.type==="object"&&"properties"in e}o(elt,"isContributesObject");function exe(e,t){let r=e,n=[];for(let i of t.split(".")){let s=[...n,i].join(".");r&&typeof r=="object"&&s in r?(r=r[s],n.length=0):n.push(i)}if(!(r===void 0||n.length>0))return r}o(exe,"getConfigKeyRecursively");function tlt(e){if(RI.has(e))return RI.get(e);throw new Error(`Missing config default value: ${j7}.${e}`)}o(tlt,"getConfigDefaultForKey");function rlt(e){return RI.get(e)}o(rlt,"getOptionalConfigDefaultForKey");var RI=new Map([[St.DebugOverrideCppHeadersShutdownSwitch,!1],[St.RelatedFilesVSCodeCSharp,!1],[St.RelatedFilesVSCodeTypeScript,!1],[St.RelatedFilesVSCode,!1],[St.ExcludeOpenTabFilesCSharp,!1],[St.ExcludeOpenTabFilesCpp,!1],[St.ExcludeOpenTabFilesTypeScript,!1],[St.FallbackToOpenTabFilesWithNoRelatedFiles,!1],[St.IncludeNeighboringFiles,!1],[St.ContextProviders,[]],[St.DebugUseEditorFetcher,null],[St.DebugUseElectronFetcher,null],[St.DebugOverrideLogLevels,{}],[St.DebugSnippyOverrideUrl,""],[St.FetchStrategy,"auto"],[St.UseSubsetMatching,null],[St.EnablePromptComponents,!1],[St.ContextProviderTimeBudget,150],[St.DebugOverrideCapiUrl,""],[St.DebugTestOverrideCapiUrl,""],[St.DebugOverrideProxyUrl,""],[St.DebugTestOverrideProxyUrl,""],[St.DebugOverrideEngine,""],[St.UseAsyncCompletions,void 0],[St.EnableSpeculativeRequests,void 0],[St.EnablePrefixCache,void 0],[St.AlwaysRequestMultiline,void 0],[St.TrimCompletionsAggressively,void 0],[St.VSCodeDebounceThreshold,void 0],[St.RecentEditsInPrompt,void 0],[St.RecentEditsEditCount,void 0],[St.RecentEditsMaxFiles,void 0],[St.RecentEditsContextLines,void 0],[St.RecentEditsRemoveDeletedLines,void 0],[St.InsertionsBeforeDeletions,void 0],[St.RecentEditsAppendNoReplyMarker,void 0],[St.RecentEditsMaxLinesBetweenEdits,void 0],[St.RecentEditsActiveDocDistanceLimitFromCursor,void 0],[St.RecentEditsSummarizationFormat,void 0],[St.MultilineAfterAccept,void 0],[St.ShowEditorCompletions,void 0],[St.DelayCompletions,void 0],[St.FilterCompletions,void 0]]);for(let e of Object.values(St)){let t=CX.configuration[0],r=[],n=`${j7}.${e}`.split(".");for(;n.length>0;){r.push(n.shift());let i=t.properties[r.join(".")];if(elt(i))r.length=0,t=i;else if(n.length==0&&i?.default!==void 0){if(RI.has(e))throw new Error(`Duplicate config default value ${j7}.${e}`);RI.set(e,i.default)}}if(!RI.has(e))throw new Error(`Missing config default value ${j7}.${e}`)}function On(e,t){return e.get(Wp).getConfig(t)}o(On,"getConfig");function sCe(e){return e.get(Wp).dumpForTelemetry()}o(sCe,"dumpForTelemetry");var go=class{constructor(){this.packageJson=yX}static{o(this,"BuildInfo")}isPreRelease(){return this.getBuildType()==="nightly"}isProduction(){return this.getBuildType()!=="dev"}getBuildType(){return this.packageJson.buildType}getVersion(){return this.packageJson.version}getDisplayVersion(){return this.getBuildType()==="dev"?`${this.getVersion()}-dev`:this.getVersion()}getBuild(){return this.packageJson.build}getName(){return this.packageJson.name}};function lN(e){return e.get(go).isProduction()}o(lN,"isProduction");function BCe(e){return e.get(go).getBuildType()==="dev"}o(BCe,"isDevBuild");function md(e){return e.get(go).getBuildType()}o(md,"getBuildType");function aCe(e){return e.get(go).getBuild()}o(aCe,"getBuild");function Ex(e){return e.get(go).getVersion()}o(Ex,"getVersion");var _s=class{constructor(t,r,n="none",i="desktop"){this.sessionId=t;this.machineId=r;this.remoteName=n;this.uiKind=i}static{o(this,"EditorSession")}};function Np({name:e,version:t}){return`${e}/${t}`}o(Np,"formatNameAndVersion");var dn=class{static{o(this,"EditorAndPluginInfo")}getCopilotIntegrationId(){}},LZ="2025-05-01";function Ic(e){let t=e.get(dn);return{"X-GitHub-Api-Version":LZ,"Editor-Version":Np(t.getEditorInfo()),"Editor-Plugin-Version":Np(t.getEditorPluginInfo()),"Copilot-Language-Server-Version":Ex(e)}}o(Ic,"editorVersionHeaders");var Z3e="Iv1.b507a08c87ecfe98",ea=class{static{o(this,"GitHubAppInfo")}findAppIdToAuthenticate(){return this.githubAppId??Z3e}fallbackAppId(){return Z3e}};d();d();d();var Px={abap:{extensions:[".abap"]},aspdotnet:{extensions:[".asax",".ascx",".ashx",".asmx",".aspx",".axd"]},bat:{extensions:[".bat",".cmd"]},bibtex:{extensions:[".bib",".bibtex"]},blade:{extensions:[".blade",".blade.php"]},BluespecSystemVerilog:{extensions:[".bsv"]},c:{extensions:[".c",".cats",".h",".h.in",".idc"]},csharp:{extensions:[".cake",".cs",".cs.pp",".csx",".linq"]},cpp:{extensions:[".c++",".cc",".cp",".cpp",".cppm",".cxx",".h",".h++",".hh",".hpp",".hxx",".idl",".inc",".inl",".ino",".ipp",".ixx",".rc",".re",".tcc",".tpp",".txx",".i"]},cobol:{extensions:[".cbl",".ccp",".cob",".cobol",".cpy"]},css:{extensions:[".css",".wxss"]},clojure:{extensions:[".bb",".boot",".cl2",".clj",".cljc",".cljs",".cljs.hl",".cljscm",".cljx",".edn",".hic"],filenames:["riemann.config"]},ql:{extensions:[".ql",".qll"]},coffeescript:{extensions:["._coffee",".cake",".cjsx",".coffee",".iced"],filenames:["Cakefile"]},cuda:{extensions:[".cu",".cuh"]},dart:{extensions:[".dart"]},dockerfile:{extensions:[".containerfile",".dockerfile"],filenames:["Containerfile","Dockerfile"]},dotenv:{extensions:[".env"],filenames:[".env",".env.ci",".env.dev",".env.development",".env.development.local",".env.example",".env.local",".env.prod",".env.production",".env.sample",".env.staging",".env.test",".env.testing"]},html:{extensions:[".ect",".ejs",".ejs.t",".jst",".hta",".htm",".html",".html.hl",".html5",".inc",".jsp",".njk",".tpl",".twig",".wxml",".xht",".xhtml",".phtml",".liquid"]},elixir:{extensions:[".ex",".exs"],filenames:["mix.lock"]},erlang:{extensions:[".app",".app.src",".erl",".es",".escript",".hrl",".xrl",".yrl"],filenames:["Emakefile","rebar.config","rebar.config.lock","rebar.lock"]},fsharp:{extensions:[".fs",".fsi",".fsx"]},go:{extensions:[".go"]},groovy:{extensions:[".gradle",".groovy",".grt",".gtpl",".gvy",".jenkinsfile"],filenames:["Jenkinsfile","Jenkinsfile"]},graphql:{extensions:[".gql",".graphql",".graphqls"]},terraform:{extensions:[".hcl",".nomad",".tf",".tfvars",".workflow"]},hlsl:{extensions:[".cginc",".fx",".fxh",".hlsl",".hlsli"]},erb:{extensions:[".erb",".erb.deface",".rhtml"]},razor:{extensions:[".cshtml",".razor"]},haml:{extensions:[".haml",".haml.deface"]},handlebars:{extensions:[".handlebars",".hbs"]},haskell:{extensions:[".hs",".hs-boot",".hsc"]},ini:{extensions:[".cfg",".cnf",".dof",".ini",".lektorproject",".prefs",".pro",".properties",".url"],filenames:[".buckconfig",".coveragerc",".flake8",".pylintrc","HOSTS","buildozer.spec","hosts","pylintrc","vlcrc"]},json:{extensions:[".4DForm",".4DProject",".JSON-tmLanguage",".avsc",".geojson",".gltf",".har",".ice",".json",".json.example",".jsonl",".mcmeta",".sarif",".tact",".tfstate",".tfstate.backup",".topojson",".webapp",".webmanifest",".yy",".yyp"],filenames:[".all-contributorsrc",".arcconfig",".auto-changelog",".c8rc",".htmlhintrc",".imgbotconfig",".nycrc",".tern-config",".tern-project",".watchmanconfig","MODULE.bazel.lock","Package.resolved","Pipfile.lock","bun.lock","composer.lock","deno.lock","flake.lock","mcmod.info"]},jsonc:{extensions:[".code-snippets",".code-workspace",".jsonc",".sublime-build",".sublime-color-scheme",".sublime-commands",".sublime-completions",".sublime-keymap",".sublime-macro",".sublime-menu",".sublime-mousemap",".sublime-project",".sublime-settings",".sublime-theme",".sublime-workspace",".sublime_metrics",".sublime_session"],filenames:[".babelrc",".devcontainer.json",".eslintrc.json",".jscsrc",".jshintrc",".jslintrc",".swcrc","api-extractor.json","argv.json","devcontainer.json","extensions.json","jsconfig.json","keybindings.json","language-configuration.json","launch.json","profiles.json","settings.json","tasks.json","tsconfig.json","tslint.json"]},java:{extensions:[".jav",".java",".jsh"]},javascript:{extensions:["._js",".bones",".cjs",".es",".es6",".frag",".gs",".jake",".javascript",".js",".jsb",".jscad",".jsfl",".jslib",".jsm",".jspre",".jss",".mjs",".njs",".pac",".sjs",".ssjs",".xsjs",".xsjslib"],filenames:["Jakefile"]},julia:{extensions:[".jl"]},kotlin:{extensions:[".kt",".ktm",".kts"]},less:{extensions:[".less"]},lua:{extensions:[".fcgi",".lua",".luau",".nse",".p8",".pd_lua",".rbxs",".rockspec",".wlua"],filenames:[".luacheckrc"]},makefile:{extensions:[".d",".mak",".make",".makefile",".mk",".mkfile"],filenames:["BSDmakefile","GNUmakefile","Kbuild","Makefile","Makefile.am","Makefile.boot","Makefile.frag","Makefile.in","Makefile.inc","Makefile.wat","makefile","makefile.sco","mkfile"]},markdown:{extensions:[".livemd",".markdown",".md",".mdown",".mdwn",".mdx",".mkd",".mkdn",".mkdown",".ronn",".scd",".workbook"],filenames:["contents.lr"]},"objective-c":{extensions:[".h",".m"]},"objective-cpp":{extensions:[".mm"]},php:{extensions:[".aw",".ctp",".fcgi",".inc",".install",".module",".php",".php3",".php4",".php5",".phps",".phpt",".theme"],filenames:[".php",".php_cs",".php_cs.dist","Phakefile"]},perl:{extensions:[".al",".cgi",".fcgi",".perl",".ph",".pl",".plx",".pm",".psgi",".t"],filenames:[".latexmkrc","Makefile.PL","Rexfile","ack","cpanfile","latexmkrc"]},powershell:{extensions:[".ps1",".psd1",".psm1"]},pug:{extensions:[".jade",".pug"]},python:{extensions:[".cgi",".codon",".fcgi",".gyp",".gypi",".lmi",".py",".py3",".pyde",".pyi",".pyp",".pyt",".pyw",".rpy",".sage",".spec",".tac",".wsgi",".xpy"],filenames:[".gclient","DEPS","SConscript","SConstruct","wscript"]},r:{extensions:[".r",".rd",".rsx"],filenames:[".Rprofile","expr-dist"]},ruby:{extensions:[".builder",".eye",".fcgi",".gemspec",".god",".jbuilder",".mspec",".pluginspec",".podspec",".prawn",".rabl",".rake",".rb",".rbi",".rbuild",".rbw",".rbx",".ru",".ruby",".spec",".thor",".watchr"],filenames:[".irbrc",".pryrc",".simplecov","Appraisals","Berksfile","Brewfile","Buildfile","Capfile","Dangerfile","Deliverfile","Fastfile","Gemfile","Guardfile","Jarfile","Mavenfile","Podfile","Puppetfile","Rakefile","Snapfile","Steepfile","Thorfile","Vagrantfile","buildfile"]},rust:{extensions:[".rs",".rs.in"]},scss:{extensions:[".scss"]},sql:{extensions:[".cql",".ddl",".inc",".mysql",".prc",".sql",".tab",".udf",".viw"]},sass:{extensions:[".sass"]},scala:{extensions:[".kojo",".sbt",".sc",".scala"]},shellscript:{extensions:[".bash",".bats",".cgi",".command",".fcgi",".fish",".ksh",".sh",".sh.in",".tmux",".tool",".trigger",".zsh",".zsh-theme"],filenames:[".bash_aliases",".bash_functions",".bash_history",".bash_logout",".bash_profile",".bashrc",".cshrc",".envrc",".flaskenv",".kshrc",".login",".profile",".tmux.conf",".zlogin",".zlogout",".zprofile",".zshenv",".zshrc","9fs","PKGBUILD","bash_aliases","bash_logout","bash_profile","bashrc","cshrc","gradlew","kshrc","login","man","profile","tmux.conf","zlogin","zlogout","zprofile","zshenv","zshrc"]},slang:{extensions:[".fxc",".hlsl",".s",".slang",".slangh",".usf",".ush",".vfx"]},slim:{extensions:[".slim"]},solidity:{extensions:[".sol"]},stylus:{extensions:[".styl"]},svelte:{extensions:[".svelte"]},swift:{extensions:[".swift"]},systemverilog:{extensions:[".sv",".svh",".vh"]},typescriptreact:{extensions:[".tsx"]},latex:{extensions:[".aux",".bbx",".cbx",".cls",".dtx",".ins",".lbx",".ltx",".mkii",".mkiv",".mkvi",".sty",".tex",".toc"]},typescript:{extensions:[".cts",".mts",".ts"]},verilog:{extensions:[".v",".veo"]},vim:{extensions:[".vba",".vim",".vimrc",".vmb"],filenames:[".exrc",".gvimrc",".nvimrc",".vimrc","_vimrc","gvimrc","nvimrc","vimrc"]},vb:{extensions:[".vb",".vbhtml",".Dsr",".bas",".cls",".ctl",".frm",".vbs"]},vue:{extensions:[".nvue",".vue"]},xml:{extensions:[".adml",".admx",".ant",".axaml",".axml",".builds",".ccproj",".ccxml",".clixml",".cproject",".cscfg",".csdef",".csl",".csproj",".ct",".depproj",".dita",".ditamap",".ditaval",".dll.config",".dotsettings",".filters",".fsproj",".fxml",".glade",".gml",".gmx",".gpx",".grxml",".gst",".hzp",".iml",".ivy",".jelly",".jsproj",".kml",".launch",".mdpolicy",".mjml",".mod",".mojo",".mxml",".natvis",".ncl",".ndproj",".nproj",".nuspec",".odd",".osm",".pkgproj",".plist",".pluginspec",".proj",".props",".ps1xml",".psc1",".pt",".pubxml",".qhelp",".rdf",".res",".resx",".rss",".sch",".scxml",".sfproj",".shproj",".srdf",".storyboard",".sublime-snippet",".svg",".sw",".targets",".tml",".typ",".ui",".urdf",".ux",".vbproj",".vcxproj",".vsixmanifest",".vssettings",".vstemplate",".vxml",".wixproj",".workflow",".wsdl",".wsf",".wxi",".wxl",".wxs",".x3d",".xacro",".xaml",".xib",".xlf",".xliff",".xmi",".xml",".xml.dist",".xmp",".xproj",".xsd",".xspec",".xul",".zcml"],filenames:[".classpath",".cproject",".project","App.config","NuGet.config","Settings.StyleCop","Web.Debug.config","Web.Release.config","Web.config","packages.config"]},xsl:{extensions:[".xsl",".xslt"]},yaml:{extensions:[".mir",".reek",".rviz",".sublime-syntax",".syntax",".yaml",".yaml-tmlanguage",".yaml.sed",".yml",".yml.mysql"],filenames:[".clang-format",".clang-tidy",".clangd",".gemrc","CITATION.cff","glide.lock","pixi.lock","yarn.lock"]},javascriptreact:{extensions:[".jsx"]},legend:{extensions:[".pure"]}};d();d();var txe=[".ejs",".erb",".haml",".hbs",".j2",".jinja",".jinja2",".liquid",".mustache",".njk",".php",".pug",".slim",".webc"],rxe={".php":[".blade"]},Gw=Object.keys(Px).flatMap(e=>Px[e].extensions);var xX=Xe(require("node:path"));var FI=class{constructor(t,r,n){this.languageId=t;this.isGuess=r;this.fileExtension=n}static{o(this,"Language")}},Hw=class{static{o(this,"LanguageDetection")}},vX=new Map,PI=new Map;for(let[e,{extensions:t,filenames:r}]of Object.entries(Px)){for(let n of t)vX.set(n,[...vX.get(n)??[],e]);for(let n of r??[])PI.set(n,[...PI.get(n)??[],e])}var bX=class extends Hw{static{o(this,"FilenameAndExensionLanguageDetection")}detectLanguage(t){let r=Bi(t.uri),n=xX.extname(r).toLowerCase(),i=this.extensionWithoutTemplateLanguage(r,n),s=this.detectLanguageId(r,i),a=this.computeFullyQualifiedExtension(n,i);return s?new FI(s.languageId,s.isGuess,a):new FI(t.languageId,!0,a)}extensionWithoutTemplateLanguage(t,r){if(txe.includes(r)){let n=t.substring(0,t.lastIndexOf(".")),i=xX.extname(n).toLowerCase();if(i.length>0&&Gw.includes(i)&&this.isExtensionValidForTemplateLanguage(r,i))return i}return r}isExtensionValidForTemplateLanguage(t,r){let n=rxe[t];return!n||n.includes(r)}detectLanguageId(t,r){if(PI.has(t))return{languageId:PI.get(t)[0],isGuess:!1};let n=vX.get(r)??[];if(n.length>0)return{languageId:n[0],isGuess:n.length>1};for(;t.includes(".");)if(t=t.replace(/\.[^.]*$/,""),PI.has(t))return{languageId:PI.get(t)[0],isGuess:!1}}computeFullyQualifiedExtension(t,r){return t!==r?r+t:t}},EX=class extends Hw{constructor(r){super();this.delegate=r}static{o(this,"GroupingLanguageDetection")}detectLanguage(r){let n=this.delegate.detectLanguage(r),i=n.languageId;return i==="c"||i==="cpp"?new FI("cpp",n.isGuess,n.fileExtension):n}},IX=class extends Hw{constructor(r){super();this.delegate=r}static{o(this,"ClientProvidedLanguageDetection")}detectLanguage(r){return r.uri.startsWith("untitled:")||r.uri.startsWith("vscode-notebook-cell:")?new FI(r.languageId,!0,""):this.delegate.detectLanguage(r)}},nlt=new EX(new IX(new bX));function NI({uri:e,languageId:t}){let r=nlt.detectLanguage({uri:e,languageId:"UNKNOWN"});return r.languageId==="UNKNOWN"?t:r.languageId}o(NI,"detectLanguage");d();d();d();d();function j1(e){if(e.isCancellationRequested)throw new nL}o(j1,"throwIfCancellationRequested");function jw(e){return e instanceof nL?!0:e instanceof Error&&e.name===TX&&e.message===TX}o(jw,"isCancellationError");var nL=class extends Error{static{o(this,"CancellationError")}constructor(){super(TX),this.name=this.message}},TX="Canceled",iL=class{constructor(){this.items=[]}static{o(this,"Stack")}push(t){this.items.push(t)}pop(){return this.items.pop()}peek(){return this.items[this.items.length-1]}tryPeek(){return this.items.length>0}toArray(){return this.items}};function Fx(e){switch(e){case 0:case 2:case 7:case 8:case 11:case 12:case 13:case 14:return!0;default:return!1}}o(Fx,"isTypeDefinition");var Ad=class e{static{o(this,"TextRange")}static{this.empty=new e(0,0)}constructor(t,r){this.start=t,this.length=r}static fromBounds(t,r){return new e(t,r-t)}get end(){return this.start+this.length}contains(t){return this.start<=t&&this.end>=t}containsRange(t){return this.start<=t.start&&this.end>=t.end}equals(t){return this.start===t.start&&this.length===t.length}getText(t){return t.slice(this.start,this.end)}getTextWithIndentation(t,r){let n=[],i=this.start;for(i=ixe(t,t.length,i),nxe(n,r);i<this.end;)t[i]!=="\r"&&t[i]!==`
242
242
  `?n.push(t[i++]):t[i]==="\r"&&i<t.length&&t[i+1]!==`
243
243
  `||t[i]===`
244
244
  `?(n.push(`
@@ -512,7 +512,7 @@ ${g.join(`
512
512
  `;h.forEach(g=>{p+=g}),t.fail(p)}},"implications");let c={};s.conflicts=o(function(m,h){Pr("<string|object> [array|string]",[m,h],arguments.length),typeof m=="object"?Object.keys(m).forEach(p=>{s.conflicts(p,m[p])}):(e.global(m),c[m]||(c[m]=[]),Array.isArray(h)?h.forEach(p=>s.conflicts(m,p)):c[m].push(h))},"conflicts"),s.getConflicting=()=>c,s.conflicting=o(function(m){Object.keys(m).forEach(h=>{c[h]&&c[h].forEach(p=>{p&&m[h]!==void 0&&m[p]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",h,p))})}),e.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(c).forEach(h=>{c[h].forEach(p=>{p&&m[r.Parser.camelCase(h)]!==void 0&&m[r.Parser.camelCase(p)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",h,p))})})},"conflictingFn"),s.recommendCommands=o(function(m,h){h=h.sort((v,E)=>E.length-v.length);let g=null,x=1/0;for(let v=0,E;(E=h[v])!==void 0;v++){let b=lve(m,E);b<=3&&b<x&&(x=b,g=E)}g&&t.fail(n("Did you mean %s?",g))},"recommendCommands"),s.reset=o(function(m){return a=f5(a,h=>!m[h]),c=f5(c,h=>!m[h]),s},"reset");let u=[];return s.freeze=o(function(){u.push({implied:a,conflicting:c})},"freeze"),s.unfreeze=o(function(){let m=u.pop();l0(m,void 0,r),{implied:a,conflicting:c}=m},"unfreeze"),s}o(uve,"validation");d();var Ree=[],u_;function bQ(e,t,r,n){u_=n;let i={};if(Object.prototype.hasOwnProperty.call(e,"extends")){if(typeof e.extends!="string")return i;let s=/\.json|\..*rc$/.test(e.extends),a=null;if(s)a=E0t(t,e.extends);else try{a=require.resolve(e.extends)}catch{return e}b0t(a),Ree.push(a),i=s?JSON.parse(u_.readFileSync(a,"utf8")):require(e.extends),delete e.extends,i=bQ(i,u_.path.dirname(a),r,u_)}return Ree=[],r?fve(i,e):Object.assign({},i,e)}o(bQ,"applyExtends");function b0t(e){if(Ree.indexOf(e)>-1)throw new ms(`Circular extended configurations: '${e}'.`)}o(b0t,"checkForCircularExtends");function E0t(e,t){return u_.path.resolve(e,t)}o(E0t,"getPathToDefaultConfig");function fve(e,t){let r={};function n(i){return i&&typeof i=="object"&&!Array.isArray(i)}o(n,"isObject"),Object.assign(r,e);for(let i of Object.keys(t))n(t[i])&&n(r[i])?r[i]=fve(e[i],t[i]):r[i]=t[i];return r}o(fve,"mergeDeep");var Nr=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},he=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)},ba,Gx,f_,Td,nf,EQ,m5,Hx,IQ,wd,TQ,_d,Gp,of,Sd,wQ,zI,Sl,zr,_Q,SQ,sf,jx,YI,Vx,h5,kQ,Dn,$x,zx,Yx,Un,RQ,Hp,ta;function Bve(e){return(t=[],r=e.process.cwd(),n)=>{let i=new qee(t,r,n,e);return Object.defineProperty(i,"argv",{get:o(()=>i.parse(),"get"),enumerable:!0}),i.help(),i.version(),i}}o(Bve,"YargsFactory");var dve=Symbol("copyDoubleDash"),mve=Symbol("copyDoubleDash"),Bee=Symbol("deleteFromParserHintObject"),hve=Symbol("emitWarning"),pve=Symbol("freeze"),gve=Symbol("getDollarZero"),Kx=Symbol("getParserConfiguration"),Ave=Symbol("getUsageConfiguration"),Dee=Symbol("guessLocale"),yve=Symbol("guessVersion"),Cve=Symbol("parsePositionalNumbers"),Pee=Symbol("pkgUp"),p5=Symbol("populateParserHintArray"),KI=Symbol("populateParserHintSingleValueDictionary"),Fee=Symbol("populateParserHintArrayDictionary"),Nee=Symbol("populateParserHintDictionary"),Lee=Symbol("sanitizeKey"),Qee=Symbol("setKey"),Mee=Symbol("unfreeze"),xve=Symbol("validateAsync"),vve=Symbol("getCommandInstance"),bve=Symbol("getContext"),Eve=Symbol("getHasOutput"),Ive=Symbol("getLoggerInstance"),Tve=Symbol("getParseContext"),wve=Symbol("getUsageInstance"),_ve=Symbol("getValidationInstance"),BQ=Symbol("hasParseCallback"),Sve=Symbol("isGlobalContext"),Jx=Symbol("postProcess"),kve=Symbol("rebase"),Oee=Symbol("reset"),d_=Symbol("runYargsParserAndExecuteCommands"),Uee=Symbol("runValidation"),Rve=Symbol("setHasOutput"),Zx=Symbol("kTrackManuallySetKeys"),qee=class{static{o(this,"YargsInstance")}constructor(t=[],r,n,i){this.customScriptName=!1,this.parsed=!1,ba.set(this,void 0),Gx.set(this,void 0),f_.set(this,{commands:[],fullCommands:[]}),Td.set(this,null),nf.set(this,null),EQ.set(this,"show-hidden"),m5.set(this,null),Hx.set(this,!0),IQ.set(this,{}),wd.set(this,!0),TQ.set(this,[]),_d.set(this,void 0),Gp.set(this,{}),of.set(this,!1),Sd.set(this,null),wQ.set(this,!0),zI.set(this,void 0),Sl.set(this,""),zr.set(this,void 0),_Q.set(this,void 0),SQ.set(this,{}),sf.set(this,null),jx.set(this,null),YI.set(this,{}),Vx.set(this,{}),h5.set(this,void 0),kQ.set(this,!1),Dn.set(this,void 0),$x.set(this,!1),zx.set(this,!1),Yx.set(this,!1),Un.set(this,void 0),RQ.set(this,{}),Hp.set(this,null),ta.set(this,void 0),Nr(this,Dn,i,"f"),Nr(this,h5,t,"f"),Nr(this,Gx,r,"f"),Nr(this,_Q,n,"f"),Nr(this,_d,new CQ(this),"f"),this.$0=this[gve](),this[Oee](),Nr(this,ba,he(this,ba,"f"),"f"),Nr(this,Un,he(this,Un,"f"),"f"),Nr(this,ta,he(this,ta,"f"),"f"),Nr(this,zr,he(this,zr,"f"),"f"),he(this,zr,"f").showHiddenOpt=he(this,EQ,"f"),Nr(this,zI,this[mve](),"f")}addHelpOpt(t,r){let n="help";return Pr("[string|boolean] [string]",[t,r],arguments.length),he(this,Sd,"f")&&(this[Bee](he(this,Sd,"f")),Nr(this,Sd,null,"f")),t===!1&&r===void 0?this:(Nr(this,Sd,typeof t=="string"?t:n,"f"),this.boolean(he(this,Sd,"f")),this.describe(he(this,Sd,"f"),r||he(this,Un,"f").deferY18nLookup("Show help")),this)}help(t,r){return this.addHelpOpt(t,r)}addShowHiddenOpt(t,r){if(Pr("[string|boolean] [string]",[t,r],arguments.length),t===!1&&r===void 0)return this;let n=typeof t=="string"?t:he(this,EQ,"f");return this.boolean(n),this.describe(n,r||he(this,Un,"f").deferY18nLookup("Show hidden options")),he(this,zr,"f").showHiddenOpt=n,this}showHidden(t,r){return this.addShowHiddenOpt(t,r)}alias(t,r){return Pr("<object|string|array> [string|array]",[t,r],arguments.length),this[Fee](this.alias.bind(this),"alias",t,r),this}array(t){return Pr("<array|string>",[t],arguments.length),this[p5]("array",t),this[Zx](t),this}boolean(t){return Pr("<array|string>",[t],arguments.length),this[p5]("boolean",t),this[Zx](t),this}check(t,r){return Pr("<function> [boolean]",[t,r],arguments.length),this.middleware((n,i)=>Wx(()=>t(n,i.getOptions()),s=>(s?(typeof s=="string"||s instanceof Error)&&he(this,Un,"f").fail(s.toString(),s):he(this,Un,"f").fail(he(this,Dn,"f").y18n.__("Argument check failed: %s",t.toString())),n),s=>(he(this,Un,"f").fail(s.message?s.message:s.toString(),s),n)),!1,r),this}choices(t,r){return Pr("<object|string|array> [string|array]",[t,r],arguments.length),this[Fee](this.choices.bind(this),"choices",t,r),this}coerce(t,r){if(Pr("<object|string|array> [function]",[t,r],arguments.length),Array.isArray(t)){if(!r)throw new ms("coerce callback must be provided");for(let n of t)this.coerce(n,r);return this}else if(typeof t=="object"){for(let n of Object.keys(t))this.coerce(n,t[n]);return this}if(!r)throw new ms("coerce callback must be provided");return he(this,zr,"f").key[t]=!0,he(this,_d,"f").addCoerceMiddleware((n,i)=>{let s;return Object.prototype.hasOwnProperty.call(n,t)?Wx(()=>(s=i.getAliases(),r(n[t])),l=>{n[t]=l;let c=i.getInternalMethods().getParserConfiguration()["strip-aliased"];if(s[t]&&c!==!0)for(let u of s[t])n[u]=l;return n},l=>{throw new ms(l.message)}):n},t),this}conflicts(t,r){return Pr("<string|object> [string|array]",[t,r],arguments.length),he(this,ta,"f").conflicts(t,r),this}config(t="config",r,n){return Pr("[object|string] [string|function] [function]",[t,r,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=bQ(t,he(this,Gx,"f"),this[Kx]()["deep-merge-config"]||!1,he(this,Dn,"f")),he(this,zr,"f").configObjects=(he(this,zr,"f").configObjects||[]).concat(t),this):(typeof r=="function"&&(n=r,r=void 0),this.describe(t,r||he(this,Un,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(i=>{he(this,zr,"f").config[i]=n||!0}),this)}completion(t,r,n){return Pr("[string] [string|boolean|function] [function]",[t,r,n],arguments.length),typeof r=="function"&&(n=r,r=void 0),Nr(this,nf,t||he(this,nf,"f")||"completion","f"),!r&&r!==!1&&(r="generate completion script"),this.command(he(this,nf,"f"),r),n&&he(this,Td,"f").registerFunction(n),this}command(t,r,n,i,s,a){return Pr("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,r,n,i,s,a],arguments.length),he(this,ba,"f").addHandler(t,r,n,i,s,a),this}commands(t,r,n,i,s,a){return this.command(t,r,n,i,s,a)}commandDir(t,r){Pr("<string> [object]",[t,r],arguments.length);let n=he(this,_Q,"f")||he(this,Dn,"f").require;return he(this,ba,"f").addDirectory(t,n,he(this,Dn,"f").getCallerFile(),r),this}count(t){return Pr("<array|string>",[t],arguments.length),this[p5]("count",t),this[Zx](t),this}default(t,r,n){return Pr("<object|string|array> [*] [string]",[t,r,n],arguments.length),n&&(Tee(t,he(this,Dn,"f")),he(this,zr,"f").defaultDescription[t]=n),typeof r=="function"&&(Tee(t,he(this,Dn,"f")),he(this,zr,"f").defaultDescription[t]||(he(this,zr,"f").defaultDescription[t]=he(this,Un,"f").functionDescription(r)),r=r.call()),this[KI](this.default.bind(this),"default",t,r),this}defaults(t,r,n){return this.default(t,r,n)}demandCommand(t=1,r,n,i){return Pr("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,r,n,i],arguments.length),typeof r!="number"&&(n=r,r=1/0),this.global("_",!1),he(this,zr,"f").demandedCommands._={min:t,max:r,minMsg:n,maxMsg:i},this}demand(t,r,n){return Array.isArray(r)?(r.forEach(i=>{l0(n,!0,he(this,Dn,"f")),this.demandOption(i,n)}),r=1/0):typeof r!="number"&&(n=r,r=1/0),typeof t=="number"?(l0(n,!0,he(this,Dn,"f")),this.demandCommand(t,r,n,n)):Array.isArray(t)?t.forEach(i=>{l0(n,!0,he(this,Dn,"f")),this.demandOption(i,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,r){return Pr("<object|string|array> [string]",[t,r],arguments.length),this[KI](this.demandOption.bind(this),"demandedOptions",t,r),this}deprecateOption(t,r){return Pr("<string> [string|boolean]",[t,r],arguments.length),he(this,zr,"f").deprecatedOptions[t]=r,this}describe(t,r){return Pr("<object|string|array> [string]",[t,r],arguments.length),this[Qee](t,!0),he(this,Un,"f").describe(t,r),this}detectLocale(t){return Pr("<boolean>",[t],arguments.length),Nr(this,Hx,t,"f"),this}env(t){return Pr("[string|boolean]",[t],arguments.length),t===!1?delete he(this,zr,"f").envPrefix:he(this,zr,"f").envPrefix=t||"",this}epilogue(t){return Pr("<string>",[t],arguments.length),he(this,Un,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,r){return Pr("<string|array> [string]",[t,r],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):he(this,Un,"f").example(t,r),this}exit(t,r){Nr(this,of,!0,"f"),Nr(this,m5,r,"f"),he(this,wd,"f")&&he(this,Dn,"f").process.exit(t)}exitProcess(t=!0){return Pr("[boolean]",[t],arguments.length),Nr(this,wd,t,"f"),this}fail(t){if(Pr("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new ms("Invalid first argument. Expected function or boolean 'false'");return he(this,Un,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,r){return Pr("<array> [function]",[t,r],arguments.length),r?he(this,Td,"f").getCompletion(t,r):new Promise((n,i)=>{he(this,Td,"f").getCompletion(t,(s,a)=>{s?i(s):n(a)})})}getDemandedOptions(){return Pr([],0),he(this,zr,"f").demandedOptions}getDemandedCommands(){return Pr([],0),he(this,zr,"f").demandedCommands}getDeprecatedOptions(){return Pr([],0),he(this,zr,"f").deprecatedOptions}getDetectLocale(){return he(this,Hx,"f")}getExitProcess(){return he(this,wd,"f")}getGroups(){return Object.assign({},he(this,Gp,"f"),he(this,Vx,"f"))}getHelp(){if(Nr(this,of,!0,"f"),!he(this,Un,"f").hasCachedHelpMessage()){if(!this.parsed){let r=this[d_](he(this,h5,"f"),void 0,void 0,0,!0);if(hs(r))return r.then(()=>he(this,Un,"f").help())}let t=he(this,ba,"f").runDefaultBuilderOn(this);if(hs(t))return t.then(()=>he(this,Un,"f").help())}return Promise.resolve(he(this,Un,"f").help())}getOptions(){return he(this,zr,"f")}getStrict(){return he(this,$x,"f")}getStrictCommands(){return he(this,zx,"f")}getStrictOptions(){return he(this,Yx,"f")}global(t,r){return Pr("<string|array> [boolean]",[t,r],arguments.length),t=[].concat(t),r!==!1?he(this,zr,"f").local=he(this,zr,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{he(this,zr,"f").local.includes(n)||he(this,zr,"f").local.push(n)}),this}group(t,r){Pr("<string|array> <string>",[t,r],arguments.length);let n=he(this,Vx,"f")[r]||he(this,Gp,"f")[r];he(this,Vx,"f")[r]&&delete he(this,Vx,"f")[r];let i={};return he(this,Gp,"f")[r]=(n||[]).concat(t).filter(s=>i[s]?!1:i[s]=!0),this}hide(t){return Pr("<string>",[t],arguments.length),he(this,zr,"f").hiddenOptions.push(t),this}implies(t,r){return Pr("<string|object> [number|string|array]",[t,r],arguments.length),he(this,ta,"f").implies(t,r),this}locale(t){return Pr("[string]",[t],arguments.length),t===void 0?(this[Dee](),he(this,Dn,"f").y18n.getLocale()):(Nr(this,Hx,!1,"f"),he(this,Dn,"f").y18n.setLocale(t),this)}middleware(t,r,n){return he(this,_d,"f").addMiddleware(t,!!r,n)}nargs(t,r){return Pr("<string|object|array> [number]",[t,r],arguments.length),this[KI](this.nargs.bind(this),"narg",t,r),this}normalize(t){return Pr("<array|string>",[t],arguments.length),this[p5]("normalize",t),this}number(t){return Pr("<array|string>",[t],arguments.length),this[p5]("number",t),this[Zx](t),this}option(t,r){if(Pr("<string|object> [object]",[t,r],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof r!="object"&&(r={}),this[Zx](t),he(this,Hp,"f")&&(t==="version"||r?.alias==="version")&&this[hve](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
513
513
  `),void 0,"versionWarning"),he(this,zr,"f").key[t]=!0,r.alias&&this.alias(t,r.alias);let n=r.deprecate||r.deprecated;n&&this.deprecateOption(t,n);let i=r.demand||r.required||r.require;i&&this.demand(t,i),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&&(he(this,zr,"f").defaultDescription[t]=r.defaultDescription),r.skipValidation&&this.skipValidation(t);let s=r.describe||r.description||r.desc,a=he(this,Un,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(a,t)||typeof s=="string")&&this.describe(t,s),r.hidden&&this.hide(t),r.requiresArg&&this.requiresArg(t)}return this}options(t,r){return this.option(t,r)}parse(t,r,n){Pr("[string|array] [function|boolean|object] [function]",[t,r,n],arguments.length),this[pve](),typeof t>"u"&&(t=he(this,h5,"f")),typeof r=="object"&&(Nr(this,jx,r,"f"),r=n),typeof r=="function"&&(Nr(this,sf,r,"f"),r=!1),r||Nr(this,h5,t,"f"),he(this,sf,"f")&&Nr(this,wd,!1,"f");let i=this[d_](t,!!r),s=this.parsed;return he(this,Td,"f").setParsed(this.parsed),hs(i)?i.then(a=>(he(this,sf,"f")&&he(this,sf,"f").call(this,he(this,m5,"f"),a,he(this,Sl,"f")),a)).catch(a=>{throw he(this,sf,"f")&&he(this,sf,"f")(a,this.parsed.argv,he(this,Sl,"f")),a}).finally(()=>{this[Mee](),this.parsed=s}):(he(this,sf,"f")&&he(this,sf,"f").call(this,he(this,m5,"f"),i,he(this,Sl,"f")),this[Mee](),this.parsed=s,i)}parseAsync(t,r,n){let i=this.parse(t,r,n);return hs(i)?i:Promise.resolve(i)}parseSync(t,r,n){let i=this.parse(t,r,n);if(hs(i))throw new ms(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return i}parserConfiguration(t){return Pr("<object>",[t],arguments.length),Nr(this,SQ,t,"f"),this}pkgConf(t,r){Pr("<string> [string]",[t,r],arguments.length);let n=null,i=this[Pee](r||he(this,Gx,"f"));return i[t]&&typeof i[t]=="object"&&(n=bQ(i[t],r||he(this,Gx,"f"),this[Kx]()["deep-merge-config"]||!1,he(this,Dn,"f")),he(this,zr,"f").configObjects=(he(this,zr,"f").configObjects||[]).concat(n)),this}positional(t,r){Pr("<string> <object>",[t,r],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];r=f5(r,(a,l)=>a==="type"&&!["string","number","boolean"].includes(l)?!1:n.includes(a));let i=he(this,f_,"f").fullCommands[he(this,f_,"f").fullCommands.length-1],s=i?he(this,ba,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return VI(s).forEach(a=>{let l=s[a];Array.isArray(l)?l.indexOf(t)!==-1&&(r[a]=!0):l[t]&&!(a in r)&&(r[a]=l[t])}),this.group(t,he(this,Un,"f").getPositionalGroupName()),this.option(t,r)}recommendCommands(t=!0){return Pr("[boolean]",[t],arguments.length),Nr(this,kQ,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 Pr("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&he(this,zr,"f").narg[t]?this:(this[KI](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,r){return Pr("[string] [string]",[t,r],arguments.length),t=t||this.$0,he(this,zI,"f").log(he(this,Td,"f").generateCompletionScript(t,r||he(this,nf,"f")||"completion")),this}showHelp(t){if(Pr("[string|function]",[t],arguments.length),Nr(this,of,!0,"f"),!he(this,Un,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[d_](he(this,h5,"f"),void 0,void 0,0,!0);if(hs(n))return n.then(()=>{he(this,Un,"f").showHelp(t)}),this}let r=he(this,ba,"f").runDefaultBuilderOn(this);if(hs(r))return r.then(()=>{he(this,Un,"f").showHelp(t)}),this}return he(this,Un,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,r){return Pr("[boolean|string] [string]",[t,r],arguments.length),he(this,Un,"f").showHelpOnFail(t,r),this}showVersion(t){return Pr("[string|function]",[t],arguments.length),he(this,Un,"f").showVersion(t),this}skipValidation(t){return Pr("<array|string>",[t],arguments.length),this[p5]("skipValidation",t),this}strict(t){return Pr("[boolean]",[t],arguments.length),Nr(this,$x,t!==!1,"f"),this}strictCommands(t){return Pr("[boolean]",[t],arguments.length),Nr(this,zx,t!==!1,"f"),this}strictOptions(t){return Pr("[boolean]",[t],arguments.length),Nr(this,Yx,t!==!1,"f"),this}string(t){return Pr("<array|string>",[t],arguments.length),this[p5]("string",t),this[Zx](t),this}terminalWidth(){return Pr([],0),he(this,Dn,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return Pr("<object>",[t],arguments.length),Nr(this,Hx,!1,"f"),he(this,Dn,"f").y18n.updateLocale(t),this}usage(t,r,n,i){if(Pr("<string|null|undefined> [string|boolean] [function|object] [function]",[t,r,n,i],arguments.length),r!==void 0){if(l0(t,null,he(this,Dn,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,r,n,i);throw new ms(".usage() description must start with $0 if being used as alias for .command()")}else return he(this,Un,"f").usage(t),this}usageConfiguration(t){return Pr("<object>",[t],arguments.length),Nr(this,RQ,t,"f"),this}version(t,r,n){let i="version";if(Pr("[boolean|string] [string] [string]",[t,r,n],arguments.length),he(this,Hp,"f")&&(this[Bee](he(this,Hp,"f")),he(this,Un,"f").version(void 0),Nr(this,Hp,null,"f")),arguments.length===0)n=this[yve](),t=i;else if(arguments.length===1){if(t===!1)return this;n=t,t=i}else arguments.length===2&&(n=r,r=void 0);return Nr(this,Hp,typeof t=="string"?t:i,"f"),r=r||he(this,Un,"f").deferY18nLookup("Show version number"),he(this,Un,"f").version(n||void 0),this.boolean(he(this,Hp,"f")),this.describe(he(this,Hp,"f"),r),this}wrap(t){return Pr("<number|null|undefined>",[t],arguments.length),he(this,Un,"f").wrap(t),this}[(ba=new WeakMap,Gx=new WeakMap,f_=new WeakMap,Td=new WeakMap,nf=new WeakMap,EQ=new WeakMap,m5=new WeakMap,Hx=new WeakMap,IQ=new WeakMap,wd=new WeakMap,TQ=new WeakMap,_d=new WeakMap,Gp=new WeakMap,of=new WeakMap,Sd=new WeakMap,wQ=new WeakMap,zI=new WeakMap,Sl=new WeakMap,zr=new WeakMap,_Q=new WeakMap,SQ=new WeakMap,sf=new WeakMap,jx=new WeakMap,YI=new WeakMap,Vx=new WeakMap,h5=new WeakMap,kQ=new WeakMap,Dn=new WeakMap,$x=new WeakMap,zx=new WeakMap,Yx=new WeakMap,Un=new WeakMap,RQ=new WeakMap,Hp=new WeakMap,ta=new WeakMap,dve)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[mve](){return{log:o((...t)=>{this[BQ]()||console.log(...t),Nr(this,of,!0,"f"),he(this,Sl,"f").length&&Nr(this,Sl,he(this,Sl,"f")+`
514
514
  `,"f"),Nr(this,Sl,he(this,Sl,"f")+t.join(" "),"f")},"log"),error:o((...t)=>{this[BQ]()||console.error(...t),Nr(this,of,!0,"f"),he(this,Sl,"f").length&&Nr(this,Sl,he(this,Sl,"f")+`
515
- `,"f"),Nr(this,Sl,he(this,Sl,"f")+t.join(" "),"f")},"error")}}[Bee](t){VI(he(this,zr,"f")).forEach(r=>{if((i=>i==="configObjects")(r))return;let n=he(this,zr,"f")[r];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete he(this,Un,"f").getDescriptions()[t]}[hve](t,r,n){he(this,IQ,"f")[n]||(he(this,Dn,"f").process.emitWarning(t,r),he(this,IQ,"f")[n]=!0)}[pve](){he(this,TQ,"f").push({options:he(this,zr,"f"),configObjects:he(this,zr,"f").configObjects.slice(0),exitProcess:he(this,wd,"f"),groups:he(this,Gp,"f"),strict:he(this,$x,"f"),strictCommands:he(this,zx,"f"),strictOptions:he(this,Yx,"f"),completionCommand:he(this,nf,"f"),output:he(this,Sl,"f"),exitError:he(this,m5,"f"),hasOutput:he(this,of,"f"),parsed:this.parsed,parseFn:he(this,sf,"f"),parseContext:he(this,jx,"f")}),he(this,Un,"f").freeze(),he(this,ta,"f").freeze(),he(this,ba,"f").freeze(),he(this,_d,"f").freeze()}[gve](){let t="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(he(this,Dn,"f").process.argv()[0])?r=he(this,Dn,"f").process.argv().slice(1,2):r=he(this,Dn,"f").process.argv().slice(0,1),t=r.map(n=>{let i=this[kve](he(this,Gx,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),he(this,Dn,"f").getEnv("_")&&he(this,Dn,"f").getProcessArgvBin()===he(this,Dn,"f").getEnv("_")&&(t=he(this,Dn,"f").getEnv("_").replace(`${he(this,Dn,"f").path.dirname(he(this,Dn,"f").process.execPath())}/`,"")),t}[Kx](){return he(this,SQ,"f")}[Ave](){return he(this,RQ,"f")}[Dee](){if(!he(this,Hx,"f"))return;let t=he(this,Dn,"f").getEnv("LC_ALL")||he(this,Dn,"f").getEnv("LC_MESSAGES")||he(this,Dn,"f").getEnv("LANG")||he(this,Dn,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[yve](){return this[Pee]().version||"unknown"}[Cve](t){let r=t["--"]?t["--"]:t._;for(let n=0,i;(i=r[n])!==void 0;n++)he(this,Dn,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(r[n]=Number(i));return t}[Pee](t){let r=t||"*";if(he(this,YI,"f")[r])return he(this,YI,"f")[r];let n={};try{let i=t||he(this,Dn,"f").mainFilename;!t&&he(this,Dn,"f").path.extname(i)&&(i=he(this,Dn,"f").path.dirname(i));let s=he(this,Dn,"f").findUp(i,(a,l)=>{if(l.includes("package.json"))return"package.json"});l0(s,void 0,he(this,Dn,"f")),n=JSON.parse(he(this,Dn,"f").readFileSync(s,"utf8"))}catch{}return he(this,YI,"f")[r]=n||{},he(this,YI,"f")[r]}[p5](t,r){r=[].concat(r),r.forEach(n=>{n=this[Lee](n),he(this,zr,"f")[t].push(n)})}[KI](t,r,n,i){this[Nee](t,r,n,i,(s,a,l)=>{he(this,zr,"f")[s][a]=l})}[Fee](t,r,n,i){this[Nee](t,r,n,i,(s,a,l)=>{he(this,zr,"f")[s][a]=(he(this,zr,"f")[s][a]||[]).concat(l)})}[Nee](t,r,n,i,s){if(Array.isArray(n))n.forEach(a=>{t(a,i)});else if((a=>typeof a=="object")(n))for(let a of VI(n))t(a,n[a]);else s(r,this[Lee](n),i)}[Lee](t){return t==="__proto__"?"___proto___":t}[Qee](t,r){return this[KI](this[Qee].bind(this),"key",t,r),this}[Mee](){var t,r,n,i,s,a,l,c,u,f,m,h;let p=he(this,TQ,"f").pop();l0(p,void 0,he(this,Dn,"f"));let g;t=this,r=this,n=this,i=this,s=this,a=this,l=this,c=this,u=this,f=this,m=this,h=this,{options:{set value(x){Nr(t,zr,x,"f")}}.value,configObjects:g,exitProcess:{set value(x){Nr(r,wd,x,"f")}}.value,groups:{set value(x){Nr(n,Gp,x,"f")}}.value,output:{set value(x){Nr(i,Sl,x,"f")}}.value,exitError:{set value(x){Nr(s,m5,x,"f")}}.value,hasOutput:{set value(x){Nr(a,of,x,"f")}}.value,parsed:this.parsed,strict:{set value(x){Nr(l,$x,x,"f")}}.value,strictCommands:{set value(x){Nr(c,zx,x,"f")}}.value,strictOptions:{set value(x){Nr(u,Yx,x,"f")}}.value,completionCommand:{set value(x){Nr(f,nf,x,"f")}}.value,parseFn:{set value(x){Nr(m,sf,x,"f")}}.value,parseContext:{set value(x){Nr(h,jx,x,"f")}}.value}=p,he(this,zr,"f").configObjects=g,he(this,Un,"f").unfreeze(),he(this,ta,"f").unfreeze(),he(this,ba,"f").unfreeze(),he(this,_d,"f").unfreeze()}[xve](t,r){return Wx(r,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[vve].bind(this),getContext:this[bve].bind(this),getHasOutput:this[Eve].bind(this),getLoggerInstance:this[Ive].bind(this),getParseContext:this[Tve].bind(this),getParserConfiguration:this[Kx].bind(this),getUsageConfiguration:this[Ave].bind(this),getUsageInstance:this[wve].bind(this),getValidationInstance:this[_ve].bind(this),hasParseCallback:this[BQ].bind(this),isGlobalContext:this[Sve].bind(this),postProcess:this[Jx].bind(this),reset:this[Oee].bind(this),runValidation:this[Uee].bind(this),runYargsParserAndExecuteCommands:this[d_].bind(this),setHasOutput:this[Rve].bind(this)}}[vve](){return he(this,ba,"f")}[bve](){return he(this,f_,"f")}[Eve](){return he(this,of,"f")}[Ive](){return he(this,zI,"f")}[Tve](){return he(this,jx,"f")||{}}[wve](){return he(this,Un,"f")}[_ve](){return he(this,ta,"f")}[BQ](){return!!he(this,sf,"f")}[Sve](){return he(this,wQ,"f")}[Jx](t,r,n,i){return n||hs(t)||(r||(t=this[dve](t)),(this[Kx]()["parse-positional-numbers"]||this[Kx]()["parse-positional-numbers"]===void 0)&&(t=this[Cve](t)),i&&(t=qx(t,this,he(this,_d,"f").getMiddleware(),!1))),t}[Oee](t={}){Nr(this,zr,he(this,zr,"f")||{},"f");let r={};r.local=he(this,zr,"f").local||[],r.configObjects=he(this,zr,"f").configObjects||[];let n={};r.local.forEach(a=>{n[a]=!0,(t[a]||[]).forEach(l=>{n[l]=!0})}),Object.assign(he(this,Vx,"f"),Object.keys(he(this,Gp,"f")).reduce((a,l)=>{let c=he(this,Gp,"f")[l].filter(u=>!(u in n));return c.length>0&&(a[l]=c),a},{})),Nr(this,Gp,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(a=>{r[a]=(he(this,zr,"f")[a]||[]).filter(l=>!n[l])}),s.forEach(a=>{r[a]=f5(he(this,zr,"f")[a],l=>!n[l])}),r.envPrefix=he(this,zr,"f").envPrefix,Nr(this,zr,r,"f"),Nr(this,Un,he(this,Un,"f")?he(this,Un,"f").reset(n):ive(this,he(this,Dn,"f")),"f"),Nr(this,ta,he(this,ta,"f")?he(this,ta,"f").reset(n):uve(this,he(this,Un,"f"),he(this,Dn,"f")),"f"),Nr(this,ba,he(this,ba,"f")?he(this,ba,"f").reset():tve(he(this,Un,"f"),he(this,ta,"f"),he(this,_d,"f"),he(this,Dn,"f")),"f"),he(this,Td,"f")||Nr(this,Td,ave(this,he(this,Un,"f"),he(this,ba,"f"),he(this,Dn,"f")),"f"),he(this,_d,"f").reset(),Nr(this,nf,null,"f"),Nr(this,Sl,"","f"),Nr(this,m5,null,"f"),Nr(this,of,!1,"f"),this.parsed=!1,this}[kve](t,r){return he(this,Dn,"f").path.relative(t,r)}[d_](t,r,n,i=0,s=!1){let a=!!n||s;t=t||he(this,h5,"f"),he(this,zr,"f").__=he(this,Dn,"f").y18n.__,he(this,zr,"f").configuration=this[Kx]();let l=!!he(this,zr,"f").configuration["populate--"],c=Object.assign({},he(this,zr,"f").configuration,{"populate--":!0}),u=he(this,Dn,"f").Parser.detailed(t,Object.assign({},he(this,zr,"f"),{configuration:{"parse-positional-numbers":!1,...c}})),f=Object.assign(u.argv,he(this,jx,"f")),m,h=u.aliases,p=!1,g=!1;Object.keys(f).forEach(x=>{x===he(this,Sd,"f")&&f[x]?p=!0:x===he(this,Hp,"f")&&f[x]&&(g=!0)}),f.$0=this.$0,this.parsed=u,i===0&&he(this,Un,"f").clearCachedHelpMessage();try{if(this[Dee](),r)return this[Jx](f,l,!!n,!1);he(this,Sd,"f")&&[he(this,Sd,"f")].concat(h[he(this,Sd,"f")]||[]).filter(_=>_.length>1).includes(""+f._[f._.length-1])&&(f._.pop(),p=!0),Nr(this,wQ,!1,"f");let x=he(this,ba,"f").getCommands(),v=he(this,Td,"f").completionKey in f,E=p||v||s;if(f._.length){if(x.length){let b;for(let _=i||0,R;f._[_]!==void 0;_++)if(R=String(f._[_]),x.includes(R)&&R!==he(this,nf,"f")){let P=he(this,ba,"f").runCommand(R,this,u,_+1,s,p||g||s);return this[Jx](P,l,!!n,!1)}else if(!b&&R!==he(this,nf,"f")){b=R;break}!he(this,ba,"f").hasDefaultCommand()&&he(this,kQ,"f")&&b&&!E&&he(this,ta,"f").recommendCommands(b,x)}he(this,nf,"f")&&f._.includes(he(this,nf,"f"))&&!v&&(he(this,wd,"f")&&d5(!0),this.showCompletionScript(),this.exit(0))}if(he(this,ba,"f").hasDefaultCommand()&&!E){let b=he(this,ba,"f").runCommand(null,this,u,0,s,p||g||s);return this[Jx](b,l,!!n,!1)}if(v){he(this,wd,"f")&&d5(!0),t=[].concat(t);let b=t.slice(t.indexOf(`--${he(this,Td,"f").completionKey}`)+1);return he(this,Td,"f").getCompletion(b,(_,R)=>{if(_)throw new ms(_.message);(R||[]).forEach(P=>{he(this,zI,"f").log(P)}),this.exit(0)}),this[Jx](f,!l,!!n,!1)}if(he(this,of,"f")||(p?(he(this,wd,"f")&&d5(!0),a=!0,this.showHelp("log"),this.exit(0)):g&&(he(this,wd,"f")&&d5(!0),a=!0,he(this,Un,"f").showVersion("log"),this.exit(0))),!a&&he(this,zr,"f").skipValidation.length>0&&(a=Object.keys(f).some(b=>he(this,zr,"f").skipValidation.indexOf(b)>=0&&f[b]===!0)),!a){if(u.error)throw new ms(u.error.message);if(!v){let b=this[Uee](h,{},u.error);n||(m=qx(f,this,he(this,_d,"f").getMiddleware(),!0)),m=this[xve](b,m??f),hs(m)&&!n&&(m=m.then(()=>qx(f,this,he(this,_d,"f").getMiddleware(),!1)))}}}catch(x){if(x instanceof ms)he(this,Un,"f").fail(x.message,x);else throw x}return this[Jx](m??f,l,!!n,!0)}[Uee](t,r,n,i){let s={...this.getDemandedOptions()};return a=>{if(n)throw new ms(n.message);he(this,ta,"f").nonOptionCount(a),he(this,ta,"f").requiredArguments(a,s);let l=!1;he(this,zx,"f")&&(l=he(this,ta,"f").unknownCommands(a)),he(this,$x,"f")&&!l?he(this,ta,"f").unknownArguments(a,t,r,!!i):he(this,Yx,"f")&&he(this,ta,"f").unknownArguments(a,t,{},!1,!1),he(this,ta,"f").limitedChoices(a),he(this,ta,"f").implications(a),he(this,ta,"f").conflicting(a)}}[Rve](){Nr(this,of,!0,"f")}[Zx](t){if(typeof t=="string")he(this,zr,"f").key[t]=!0;else for(let r of t)he(this,zr,"f").key[r]=!0}};function rve(e){return!!e&&typeof e.getInternalMethods=="function"}o(rve,"isYargsInstance");var I0t=Bve(K4e),Dve=I0t;d();d();var m_="apps",DQ="hosts",h_=class{constructor(t,r){this.ctx=t;this.persistenceManager=r}static{o(this,"AuthPersistence")}#e;setAuthAuthority(t){this.#e=t}async getAuthRecord(t){let r=this.getAuthAuthority(),n=await this.persistenceManager.read(m_,this.authRecordKey(this.ctx,r,t));return!t&&!n&&(n=await this.persistenceManager.read(m_,this.authRecordKey(this.ctx,r,this.ctx.get(ea).fallbackAppId()))),n||await this.legacyAuthRecordMaybe(r)}async legacyAuthRecordMaybe(t){let r=await this.persistenceManager.read(DQ,t);if(r){let n=this.ctx.get(ea).fallbackAppId();return{...r,githubAppId:n}}}async saveAuthRecord(t){let r=this.getAuthAuthority(),n=this.ctx.get(ea).findAppIdToAuthenticate();await this.persistenceManager.update(m_,this.authRecordKey(this.ctx,r,t.githubAppId),t);let i=this.ctx.get(ea).fallbackAppId();n===i&&await this.persistenceManager.delete(DQ,r)}async deleteAuthRecord(){let t=this.getAuthAuthority(),r=await this.getAuthRecord();if(r){let n=this.ctx.get(ea).fallbackAppId();r.githubAppId===n&&await this.persistenceManager.delete(DQ,t),await this.persistenceManager.delete(m_,this.authRecordKey(this.ctx,t)),await this.persistenceManager.delete(m_,this.authRecordKey(this.ctx,t,n))}}async purgeLegacyAuthRecords(){await this.persistenceManager.deleteSetting(DQ)}authRecordKey(t,r,n){let i=n??t.get(ea).findAppIdToAuthenticate();return`${r}:${i}`}getAuthAuthority(){return this.#e??"github.com"}};d();d();var PQ={AuthNotifyShown:"auth.auth_notify_shown",AuthNotifyDismissed:"auth.auth_notify_dismissed",NewGitHubLogin:"auth.new_github_login",GitHubLoginSuccess:"auth.github_login_success"};function Pve(e,t){let r=cn.createAndMarkAsIssued({authSource:t});return jt(e,PQ.AuthNotifyShown,r)}o(Pve,"telemetryAuthNotifyShown");function Fve(e){return jt(e,PQ.AuthNotifyDismissed)}o(Fve,"telemetryAuthNotifyDismissed");function FQ(e,t,r){let n=cn.createAndMarkAsIssued({authSource:t,authType:r});return jt(e,PQ.NewGitHubLogin,n)}o(FQ,"telemetryNewGitHubLogin");function NQ(e,t){let r=cn.createAndMarkAsIssued({authType:t});return jt(e,PQ.GitHubLoginSuccess,r)}o(NQ,"telemetryGitHubLoginSuccess");async function T0t(e,t){FQ(e,"unknown","deviceFlow");let r={method:"POST",headers:{Accept:"application/json",...Ic(e)},json:{client_id:t},timeout:30*1e3},n;try{n=await e.get(Or).fetch(e.get($n).getDeviceFlowStartUrl(),r)}catch(i){throw i instanceof Error&&Y7(i)?new Ks(`Could not log in with device flow on ${e.get($n).getAuthAuthority()}: ${i.message}`):i}if(!n.ok)throw new Ks(`Could not log in with device flow on ${e.get($n).getAuthAuthority()}: HTTP ${n.status}`);return await n.json()}o(T0t,"requestDeviceFlowStage1");async function w0t(e,t,r){let n={method:"POST",headers:{Accept:"application/json",...Ic(e)},json:{client_id:r,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"},timeout:3e4};return await(await e.get(Or).fetch(e.get($n).getDeviceFlowCompletionUrl(),n)).json()}o(w0t,"requestDeviceFlowStage2");async function _0t(e,t){return NQ(e,"deviceFlow"),await(await e.get(Or).fetch(e.get($n).getUserInfoUrl(),{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"}})).json()}o(_0t,"requestUserInfo");var Xx=class{static{o(this,"GitHubDeviceFlow")}async getToken(t,r){try{return await this.getTokenUnguarded(t,r)}catch(n){throw t.get(Y0).notifyUser(t,n),n}}async getTokenUnguarded(t,r){let n=await T0t(t,r),i=(async()=>{let s=n.expires_in,a;for(;s>0;){let l=await w0t(t,n.device_code,r);if(s-=n.interval,await new Promise(c=>setTimeout(c,1e3*n.interval)),a=l.access_token,a)return{login:(await _0t(t,a)).login,accessToken:a}}throw new Ks("Timed out waiting for login to complete")})();return{...n,waitForAuth:i}}};d();var af=class{static{o(this,"CitationManager")}},LQ=class extends af{static{o(this,"NoOpCitationManager")}async handleIPCodeCitation(t,r){}};d();d();d();var S0t={didChangeFeatureFlags:!1,fetch:!1,ipCodeCitation:!1,redirectedTelemetry:!1,related:!1,token:!1,watchedFiles:!1},Go=class{constructor(){this.capabilities={...S0t}}static{o(this,"CopilotCapabilitiesProvider")}setCapabilities(t){let r;for(r in t){let n=t[r];n!==void 0&&(this.capabilities[r]=n)}}getCapabilities(){return this.capabilities}};d();var Wee=class extends Error{constructor(r){super(`No instance of ${r.name} has been registered`);this.ctor=r;this.name="UnregisteredContextError",this.code=r.name}static{o(this,"UnregisteredContextError")}},JI=class{constructor(){this.instances=new Map}static{o(this,"Context")}get(t){let r=this.tryGet(t);if(r)return r;throw new Wee(t)}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}).`)}}};d();d();d();var QQ=class e{static{o(this,"FullTextDocument")}constructor(t,r,n,i){this._uri=t,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let r=this.offsetAt(t.start),n=this.offsetAt(t.end);return this._content.substring(r,n)}return this._content}update(t,r){for(let n of t)if(e.isIncremental(n)){let i=Qve(n.range),s=this.offsetAt(i.start),a=this.offsetAt(i.end);this._content=this._content.substring(0,s)+n.text+this._content.substring(a,this._content.length);let l=Math.max(i.start.line,0),c=Math.max(i.end.line,0),u=this._lineOffsets,f=Nve(n.text,!1,s);if(c-l===f.length)for(let h=0,p=f.length;h<p;h++)u[h+l+1]=f[h];else f.length<1e4?u.splice(l+1,c-l,...f):this._lineOffsets=u=u.slice(0,l+1).concat(f,u.slice(c+1));let m=n.text.length-(a-s);if(m!==0)for(let h=l+1+f.length,p=u.length;h<p;h++)u[h]=u[h]+m}else if(e.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=r}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=Nve(this._content,!0)),this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return{line:0,character:t};for(;n<i;){let a=Math.floor((n+i)/2);r[a]>t?i=a:n=a+1}let s=n-1;return t=this.ensureBeforeEOL(t,r[s]),{line:s,character:t-r[s]}}offsetAt(t){let r=this.getLineOffsets();if(t.line>=r.length)return this._content.length;if(t.line<0)return 0;let n=r[t.line];if(t.character<=0)return n;let i=t.line+1<r.length?r[t.line+1]:this._content.length,s=Math.min(n+t.character,i);return this.ensureBeforeEOL(s,n)}ensureBeforeEOL(t,r){for(;t>r&&Lve(this._content.charCodeAt(t-1));)t--;return t}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let r=t;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(t){let r=t;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},g5;(function(e){function t(i,s,a,l){return new QQ(i,s,a,l)}o(t,"create"),e.create=t;function r(i,s,a){if(i instanceof QQ)return i.update(s,a),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}o(r,"update"),e.update=r;function n(i,s){let a=i.getText(),l=Gee(s.map(k0t),(f,m)=>{let h=f.range.start.line-m.range.start.line;return h===0?f.range.start.character-m.range.start.character:h}),c=0,u=[];for(let f of l){let m=i.offsetAt(f.range.start);if(m<c)throw new Error("Overlapping edit");m>c&&u.push(a.substring(c,m)),f.newText.length&&u.push(f.newText),c=i.offsetAt(f.range.end)}return u.push(a.substr(c)),u.join("")}o(n,"applyEdits"),e.applyEdits=n})(g5||(g5={}));function Gee(e,t){if(e.length<=1)return e;let r=e.length/2|0,n=e.slice(0,r),i=e.slice(r);Gee(n,t),Gee(i,t);let s=0,a=0,l=0;for(;s<n.length&&a<i.length;)t(n[s],i[a])<=0?e[l++]=n[s++]:e[l++]=i[a++];for(;s<n.length;)e[l++]=n[s++];for(;a<i.length;)e[l++]=i[a++];return e}o(Gee,"mergeSort");function Nve(e,t,r=0){let n=t?[r]:[];for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);Lve(s)&&(s===13&&i+1<e.length&&e.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}o(Nve,"computeLineOffsets");function Lve(e){return e===13||e===10}o(Lve,"isEOL");function Qve(e){let t=e.start,r=e.end;return t.line>r.line||t.line===r.line&&t.character>r.character?{start:r,end:t}:e}o(Qve,"getWellformedRange");function k0t(e){let t=Qve(e.range);return t!==e.range?{newText:e.newText,range:t}:e}o(k0t,"getWellformedEdit");d();var Mve;(function(e){function t(r){return typeof r=="string"}o(t,"is"),e.is=t})(Mve||(Mve={}));var Hee;(function(e){function t(r){return typeof r=="string"}o(t,"is"),e.is=t})(Hee||(Hee={}));var Ove;(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}o(t,"is"),e.is=t})(Ove||(Ove={}));var MQ;(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}o(t,"is"),e.is=t})(MQ||(MQ={}));var Lc;(function(e){function t(n,i){return n===Number.MAX_VALUE&&(n=MQ.MAX_VALUE),i===Number.MAX_VALUE&&(i=MQ.MAX_VALUE),{line:n,character:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Je.uinteger(i.line)&&Je.uinteger(i.character)}o(r,"is"),e.is=r})(Lc||(Lc={}));var Jo;(function(e){function t(n,i,s,a){if(Je.uinteger(n)&&Je.uinteger(i)&&Je.uinteger(s)&&Je.uinteger(a))return{start:Lc.create(n,i),end:Lc.create(s,a)};if(Lc.is(n)&&Lc.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${s}, ${a}]`)}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Lc.is(i.start)&&Lc.is(i.end)}o(r,"is"),e.is=r})(Jo||(Jo={}));var OQ;(function(e){function t(n,i){return{uri:n,range:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Jo.is(i.range)&&(Je.string(i.uri)||Je.undefined(i.uri))}o(r,"is"),e.is=r})(OQ||(OQ={}));var Uve;(function(e){function t(n,i,s,a){return{targetUri:n,targetRange:i,targetSelectionRange:s,originSelectionRange:a}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Jo.is(i.targetRange)&&Je.string(i.targetUri)&&Jo.is(i.targetSelectionRange)&&(Jo.is(i.originSelectionRange)||Je.undefined(i.originSelectionRange))}o(r,"is"),e.is=r})(Uve||(Uve={}));var jee;(function(e){function t(n,i,s,a){return{red:n,green:i,blue:s,alpha:a}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Je.numberRange(i.red,0,1)&&Je.numberRange(i.green,0,1)&&Je.numberRange(i.blue,0,1)&&Je.numberRange(i.alpha,0,1)}o(r,"is"),e.is=r})(jee||(jee={}));var qve;(function(e){function t(n,i){return{range:n,color:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Jo.is(i.range)&&jee.is(i.color)}o(r,"is"),e.is=r})(qve||(qve={}));var Wve;(function(e){function t(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Je.string(i.label)&&(Je.undefined(i.textEdit)||XI.is(i))&&(Je.undefined(i.additionalTextEdits)||Je.typedArray(i.additionalTextEdits,XI.is))}o(r,"is"),e.is=r})(Wve||(Wve={}));var Gve;(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(Gve||(Gve={}));var Hve;(function(e){function t(n,i,s,a,l,c){let u={startLine:n,endLine:i};return Je.defined(s)&&(u.startCharacter=s),Je.defined(a)&&(u.endCharacter=a),Je.defined(l)&&(u.kind=l),Je.defined(c)&&(u.collapsedText=c),u}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Je.uinteger(i.startLine)&&Je.uinteger(i.startLine)&&(Je.undefined(i.startCharacter)||Je.uinteger(i.startCharacter))&&(Je.undefined(i.endCharacter)||Je.uinteger(i.endCharacter))&&(Je.undefined(i.kind)||Je.string(i.kind))}o(r,"is"),e.is=r})(Hve||(Hve={}));var Vee;(function(e){function t(n,i){return{location:n,message:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&OQ.is(i.location)&&Je.string(i.message)}o(r,"is"),e.is=r})(Vee||(Vee={}));var jve;(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(jve||(jve={}));var Vve;(function(e){e.Unnecessary=1,e.Deprecated=2})(Vve||(Vve={}));var $ve;(function(e){function t(r){let n=r;return Je.objectLiteral(n)&&Je.string(n.href)}o(t,"is"),e.is=t})($ve||($ve={}));var UQ;(function(e){function t(n,i,s,a,l,c){let u={range:n,message:i};return Je.defined(s)&&(u.severity=s),Je.defined(a)&&(u.code=a),Je.defined(l)&&(u.source=l),Je.defined(c)&&(u.relatedInformation=c),u}o(t,"create"),e.create=t;function r(n){var i;let s=n;return Je.defined(s)&&Jo.is(s.range)&&Je.string(s.message)&&(Je.number(s.severity)||Je.undefined(s.severity))&&(Je.integer(s.code)||Je.string(s.code)||Je.undefined(s.code))&&(Je.undefined(s.codeDescription)||Je.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(Je.string(s.source)||Je.undefined(s.source))&&(Je.undefined(s.relatedInformation)||Je.typedArray(s.relatedInformation,Vee.is))}o(r,"is"),e.is=r})(UQ||(UQ={}));var ZI;(function(e){function t(n,i,...s){let a={title:n,command:i};return Je.defined(s)&&s.length>0&&(a.arguments=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.string(i.title)&&Je.string(i.command)}o(r,"is"),e.is=r})(ZI||(ZI={}));var XI;(function(e){function t(s,a){return{range:s,newText:a}}o(t,"replace"),e.replace=t;function r(s,a){return{range:{start:s,end:s},newText:a}}o(r,"insert"),e.insert=r;function n(s){return{range:s,newText:""}}o(n,"del"),e.del=n;function i(s){let a=s;return Je.objectLiteral(a)&&Je.string(a.newText)&&Jo.is(a.range)}o(i,"is"),e.is=i})(XI||(XI={}));var $ee;(function(e){function t(n,i,s){let a={label:n};return i!==void 0&&(a.needsConfirmation=i),s!==void 0&&(a.description=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Je.string(i.label)&&(Je.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(Je.string(i.description)||i.description===void 0)}o(r,"is"),e.is=r})($ee||($ee={}));var e8;(function(e){function t(r){let n=r;return Je.string(n)}o(t,"is"),e.is=t})(e8||(e8={}));var zve;(function(e){function t(s,a,l){return{range:s,newText:a,annotationId:l}}o(t,"replace"),e.replace=t;function r(s,a,l){return{range:{start:s,end:s},newText:a,annotationId:l}}o(r,"insert"),e.insert=r;function n(s,a){return{range:s,newText:"",annotationId:a}}o(n,"del"),e.del=n;function i(s){let a=s;return XI.is(a)&&($ee.is(a.annotationId)||e8.is(a.annotationId))}o(i,"is"),e.is=i})(zve||(zve={}));var zee;(function(e){function t(n,i){return{textDocument:n,edits:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Xee.is(i.textDocument)&&Array.isArray(i.edits)}o(r,"is"),e.is=r})(zee||(zee={}));var Yee;(function(e){function t(n,i,s){let a={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return i&&i.kind==="create"&&Je.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||Je.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||Je.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||e8.is(i.annotationId))}o(r,"is"),e.is=r})(Yee||(Yee={}));var Kee;(function(e){function t(n,i,s,a){let l={kind:"rename",oldUri:n,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(l.options=s),a!==void 0&&(l.annotationId=a),l}o(t,"create"),e.create=t;function r(n){let i=n;return i&&i.kind==="rename"&&Je.string(i.oldUri)&&Je.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||Je.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||Je.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||e8.is(i.annotationId))}o(r,"is"),e.is=r})(Kee||(Kee={}));var Jee;(function(e){function t(n,i,s){let a={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return i&&i.kind==="delete"&&Je.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||Je.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||Je.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||e8.is(i.annotationId))}o(r,"is"),e.is=r})(Jee||(Jee={}));var Zee;(function(e){function t(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>Je.string(i.kind)?Yee.is(i)||Kee.is(i)||Jee.is(i):zee.is(i)))}o(t,"is"),e.is=t})(Zee||(Zee={}));var Yve;(function(e){function t(n){return{uri:n}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.string(i.uri)}o(r,"is"),e.is=r})(Yve||(Yve={}));var Kve;(function(e){function t(n,i){return{uri:n,version:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.string(i.uri)&&Je.integer(i.version)}o(r,"is"),e.is=r})(Kve||(Kve={}));var Xee;(function(e){function t(n,i){return{uri:n,version:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.string(i.uri)&&(i.version===null||Je.integer(i.version))}o(r,"is"),e.is=r})(Xee||(Xee={}));var Jve;(function(e){function t(n,i,s,a){return{uri:n,languageId:i,version:s,text:a}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.string(i.uri)&&Je.string(i.languageId)&&Je.integer(i.version)&&Je.string(i.text)}o(r,"is"),e.is=r})(Jve||(Jve={}));var ete;(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(r){let n=r;return n===e.PlainText||n===e.Markdown}o(t,"is"),e.is=t})(ete||(ete={}));var p_;(function(e){function t(r){let n=r;return Je.objectLiteral(r)&&ete.is(n.kind)&&Je.string(n.value)}o(t,"is"),e.is=t})(p_||(p_={}));var Zve;(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(Zve||(Zve={}));var Xve;(function(e){e.PlainText=1,e.Snippet=2})(Xve||(Xve={}));var ebe;(function(e){e.Deprecated=1})(ebe||(ebe={}));var tbe;(function(e){function t(n,i,s){return{newText:n,insert:i,replace:s}}o(t,"create"),e.create=t;function r(n){let i=n;return i&&Je.string(i.newText)&&Jo.is(i.insert)&&Jo.is(i.replace)}o(r,"is"),e.is=r})(tbe||(tbe={}));var rbe;(function(e){e.asIs=1,e.adjustIndentation=2})(rbe||(rbe={}));var nbe;(function(e){function t(r){let n=r;return n&&(Je.string(n.detail)||n.detail===void 0)&&(Je.string(n.description)||n.description===void 0)}o(t,"is"),e.is=t})(nbe||(nbe={}));var ibe;(function(e){function t(r){return{label:r}}o(t,"create"),e.create=t})(ibe||(ibe={}));var obe;(function(e){function t(r,n){return{items:r||[],isIncomplete:!!n}}o(t,"create"),e.create=t})(obe||(obe={}));var qQ;(function(e){function t(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}o(t,"fromPlainText"),e.fromPlainText=t;function r(n){let i=n;return Je.string(i)||Je.objectLiteral(i)&&Je.string(i.language)&&Je.string(i.value)}o(r,"is"),e.is=r})(qQ||(qQ={}));var sbe;(function(e){function t(r){let n=r;return!!n&&Je.objectLiteral(n)&&(p_.is(n.contents)||qQ.is(n.contents)||Je.typedArray(n.contents,qQ.is))&&(r.range===void 0||Jo.is(r.range))}o(t,"is"),e.is=t})(sbe||(sbe={}));var abe;(function(e){function t(r,n){return n?{label:r,documentation:n}:{label:r}}o(t,"create"),e.create=t})(abe||(abe={}));var lbe;(function(e){function t(r,n,...i){let s={label:r};return Je.defined(n)&&(s.documentation=n),Je.defined(i)?s.parameters=i:s.parameters=[],s}o(t,"create"),e.create=t})(lbe||(lbe={}));var cbe;(function(e){e.Text=1,e.Read=2,e.Write=3})(cbe||(cbe={}));var ube;(function(e){function t(r,n){let i={range:r};return Je.number(n)&&(i.kind=n),i}o(t,"create"),e.create=t})(ube||(ube={}));var fbe;(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(fbe||(fbe={}));var dbe;(function(e){e.Deprecated=1})(dbe||(dbe={}));var mbe;(function(e){function t(r,n,i,s,a){let l={name:r,kind:n,location:{uri:s,range:i}};return a&&(l.containerName=a),l}o(t,"create"),e.create=t})(mbe||(mbe={}));var hbe;(function(e){function t(r,n,i,s){return s!==void 0?{name:r,kind:n,location:{uri:i,range:s}}:{name:r,kind:n,location:{uri:i}}}o(t,"create"),e.create=t})(hbe||(hbe={}));var pbe;(function(e){function t(n,i,s,a,l,c){let u={name:n,detail:i,kind:s,range:a,selectionRange:l};return c!==void 0&&(u.children=c),u}o(t,"create"),e.create=t;function r(n){let i=n;return i&&Je.string(i.name)&&Je.number(i.kind)&&Jo.is(i.range)&&Jo.is(i.selectionRange)&&(i.detail===void 0||Je.string(i.detail))&&(i.deprecated===void 0||Je.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}o(r,"is"),e.is=r})(pbe||(pbe={}));var gbe;(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll"})(gbe||(gbe={}));var WQ;(function(e){e.Invoked=1,e.Automatic=2})(WQ||(WQ={}));var Abe;(function(e){function t(n,i,s){let a={diagnostics:n};return i!=null&&(a.only=i),s!=null&&(a.triggerKind=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.typedArray(i.diagnostics,UQ.is)&&(i.only===void 0||Je.typedArray(i.only,Je.string))&&(i.triggerKind===void 0||i.triggerKind===WQ.Invoked||i.triggerKind===WQ.Automatic)}o(r,"is"),e.is=r})(Abe||(Abe={}));var ybe;(function(e){function t(n,i,s){let a={title:n},l=!0;return typeof i=="string"?(l=!1,a.kind=i):ZI.is(i)?a.command=i:a.edit=i,l&&s!==void 0&&(a.kind=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return i&&Je.string(i.title)&&(i.diagnostics===void 0||Je.typedArray(i.diagnostics,UQ.is))&&(i.kind===void 0||Je.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||ZI.is(i.command))&&(i.isPreferred===void 0||Je.boolean(i.isPreferred))&&(i.edit===void 0||Zee.is(i.edit))}o(r,"is"),e.is=r})(ybe||(ybe={}));var Cbe;(function(e){function t(n,i){let s={range:n};return Je.defined(i)&&(s.data=i),s}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Jo.is(i.range)&&(Je.undefined(i.command)||ZI.is(i.command))}o(r,"is"),e.is=r})(Cbe||(Cbe={}));var xbe;(function(e){function t(n,i){return{tabSize:n,insertSpaces:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.uinteger(i.tabSize)&&Je.boolean(i.insertSpaces)}o(r,"is"),e.is=r})(xbe||(xbe={}));var vbe;(function(e){function t(n,i,s){return{range:n,target:i,data:s}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Jo.is(i.range)&&(Je.undefined(i.target)||Je.string(i.target))}o(r,"is"),e.is=r})(vbe||(vbe={}));var bbe;(function(e){function t(n,i){return{range:n,parent:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Jo.is(i.range)&&(i.parent===void 0||e.is(i.parent))}o(r,"is"),e.is=r})(bbe||(bbe={}));var Ebe;(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator"})(Ebe||(Ebe={}));var Ibe;(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(Ibe||(Ibe={}));var Tbe;(function(e){function t(r){let n=r;return Je.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}o(t,"is"),e.is=t})(Tbe||(Tbe={}));var wbe;(function(e){function t(n,i){return{range:n,text:i}}o(t,"create"),e.create=t;function r(n){let i=n;return i!=null&&Jo.is(i.range)&&Je.string(i.text)}o(r,"is"),e.is=r})(wbe||(wbe={}));var _be;(function(e){function t(n,i,s){return{range:n,variableName:i,caseSensitiveLookup:s}}o(t,"create"),e.create=t;function r(n){let i=n;return i!=null&&Jo.is(i.range)&&Je.boolean(i.caseSensitiveLookup)&&(Je.string(i.variableName)||i.variableName===void 0)}o(r,"is"),e.is=r})(_be||(_be={}));var Sbe;(function(e){function t(n,i){return{range:n,expression:i}}o(t,"create"),e.create=t;function r(n){let i=n;return i!=null&&Jo.is(i.range)&&(Je.string(i.expression)||i.expression===void 0)}o(r,"is"),e.is=r})(Sbe||(Sbe={}));var kbe;(function(e){function t(n,i){return{frameId:n,stoppedLocation:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Jo.is(n.stoppedLocation)}o(r,"is"),e.is=r})(kbe||(kbe={}));var tte;(function(e){e.Type=1,e.Parameter=2;function t(r){return r===1||r===2}o(t,"is"),e.is=t})(tte||(tte={}));var rte;(function(e){function t(n){return{value:n}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&(i.tooltip===void 0||Je.string(i.tooltip)||p_.is(i.tooltip))&&(i.location===void 0||OQ.is(i.location))&&(i.command===void 0||ZI.is(i.command))}o(r,"is"),e.is=r})(rte||(rte={}));var Rbe;(function(e){function t(n,i,s){let a={position:n,label:i};return s!==void 0&&(a.kind=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Lc.is(i.position)&&(Je.string(i.label)||Je.typedArray(i.label,rte.is))&&(i.kind===void 0||tte.is(i.kind))&&i.textEdits===void 0||Je.typedArray(i.textEdits,XI.is)&&(i.tooltip===void 0||Je.string(i.tooltip)||p_.is(i.tooltip))&&(i.paddingLeft===void 0||Je.boolean(i.paddingLeft))&&(i.paddingRight===void 0||Je.boolean(i.paddingRight))}o(r,"is"),e.is=r})(Rbe||(Rbe={}));var Bbe;(function(e){function t(r){return{kind:"snippet",value:r}}o(t,"createSnippet"),e.createSnippet=t})(Bbe||(Bbe={}));var Dbe;(function(e){function t(r,n,i,s){return{insertText:r,filterText:n,range:i,command:s}}o(t,"create"),e.create=t})(Dbe||(Dbe={}));var Pbe;(function(e){function t(r){return{items:r}}o(t,"create"),e.create=t})(Pbe||(Pbe={}));var Fbe;(function(e){e.Invoked=0,e.Automatic=1})(Fbe||(Fbe={}));var Nbe;(function(e){function t(r,n){return{range:r,text:n}}o(t,"create"),e.create=t})(Nbe||(Nbe={}));var Lbe;(function(e){function t(r,n){return{triggerKind:r,selectedCompletionInfo:n}}o(t,"create"),e.create=t})(Lbe||(Lbe={}));var Qbe;(function(e){function t(r){let n=r;return Je.objectLiteral(n)&&Hee.is(n.uri)&&Je.string(n.name)}o(t,"is"),e.is=t})(Qbe||(Qbe={}));var Mbe;(function(e){function t(s,a,l,c){return new nte(s,a,l,c)}o(t,"create"),e.create=t;function r(s){let a=s;return!!(Je.defined(a)&&Je.string(a.uri)&&(Je.undefined(a.languageId)||Je.string(a.languageId))&&Je.uinteger(a.lineCount)&&Je.func(a.getText)&&Je.func(a.positionAt)&&Je.func(a.offsetAt))}o(r,"is"),e.is=r;function n(s,a){let l=s.getText(),c=i(a,(f,m)=>{let h=f.range.start.line-m.range.start.line;return h===0?f.range.start.character-m.range.start.character:h}),u=l.length;for(let f=c.length-1;f>=0;f--){let m=c[f],h=s.offsetAt(m.range.start),p=s.offsetAt(m.range.end);if(p<=u)l=l.substring(0,h)+m.newText+l.substring(p,l.length);else throw new Error("Overlapping edit");u=h}return l}o(n,"applyEdits"),e.applyEdits=n;function i(s,a){if(s.length<=1)return s;let l=s.length/2|0,c=s.slice(0,l),u=s.slice(l);i(c,a),i(u,a);let f=0,m=0,h=0;for(;f<c.length&&m<u.length;)a(c[f],u[m])<=0?s[h++]=c[f++]:s[h++]=u[m++];for(;f<c.length;)s[h++]=c[f++];for(;m<u.length;)s[h++]=u[m++];return s}o(i,"mergeSort")})(Mbe||(Mbe={}));var nte=class{static{o(this,"FullTextDocument")}constructor(t,r,n,i){this._uri=t,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let r=this.offsetAt(t.start),n=this.offsetAt(t.end);return this._content.substring(r,n)}return this._content}update(t,r){this._content=t.text,this._version=r,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let t=[],r=this._content,n=!0;for(let i=0;i<r.length;i++){n&&(t.push(i),n=!1);let s=r.charAt(i);n=s==="\r"||s===`
515
+ `,"f"),Nr(this,Sl,he(this,Sl,"f")+t.join(" "),"f")},"error")}}[Bee](t){VI(he(this,zr,"f")).forEach(r=>{if((i=>i==="configObjects")(r))return;let n=he(this,zr,"f")[r];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete he(this,Un,"f").getDescriptions()[t]}[hve](t,r,n){he(this,IQ,"f")[n]||(he(this,Dn,"f").process.emitWarning(t,r),he(this,IQ,"f")[n]=!0)}[pve](){he(this,TQ,"f").push({options:he(this,zr,"f"),configObjects:he(this,zr,"f").configObjects.slice(0),exitProcess:he(this,wd,"f"),groups:he(this,Gp,"f"),strict:he(this,$x,"f"),strictCommands:he(this,zx,"f"),strictOptions:he(this,Yx,"f"),completionCommand:he(this,nf,"f"),output:he(this,Sl,"f"),exitError:he(this,m5,"f"),hasOutput:he(this,of,"f"),parsed:this.parsed,parseFn:he(this,sf,"f"),parseContext:he(this,jx,"f")}),he(this,Un,"f").freeze(),he(this,ta,"f").freeze(),he(this,ba,"f").freeze(),he(this,_d,"f").freeze()}[gve](){let t="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(he(this,Dn,"f").process.argv()[0])?r=he(this,Dn,"f").process.argv().slice(1,2):r=he(this,Dn,"f").process.argv().slice(0,1),t=r.map(n=>{let i=this[kve](he(this,Gx,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),he(this,Dn,"f").getEnv("_")&&he(this,Dn,"f").getProcessArgvBin()===he(this,Dn,"f").getEnv("_")&&(t=he(this,Dn,"f").getEnv("_").replace(`${he(this,Dn,"f").path.dirname(he(this,Dn,"f").process.execPath())}/`,"")),t}[Kx](){return he(this,SQ,"f")}[Ave](){return he(this,RQ,"f")}[Dee](){if(!he(this,Hx,"f"))return;let t=he(this,Dn,"f").getEnv("LC_ALL")||he(this,Dn,"f").getEnv("LC_MESSAGES")||he(this,Dn,"f").getEnv("LANG")||he(this,Dn,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[yve](){return this[Pee]().version||"unknown"}[Cve](t){let r=t["--"]?t["--"]:t._;for(let n=0,i;(i=r[n])!==void 0;n++)he(this,Dn,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(r[n]=Number(i));return t}[Pee](t){let r=t||"*";if(he(this,YI,"f")[r])return he(this,YI,"f")[r];let n={};try{let i=t||he(this,Dn,"f").mainFilename;!t&&he(this,Dn,"f").path.extname(i)&&(i=he(this,Dn,"f").path.dirname(i));let s=he(this,Dn,"f").findUp(i,(a,l)=>{if(l.includes("package.json"))return"package.json"});l0(s,void 0,he(this,Dn,"f")),n=JSON.parse(he(this,Dn,"f").readFileSync(s,"utf8"))}catch{}return he(this,YI,"f")[r]=n||{},he(this,YI,"f")[r]}[p5](t,r){r=[].concat(r),r.forEach(n=>{n=this[Lee](n),he(this,zr,"f")[t].push(n)})}[KI](t,r,n,i){this[Nee](t,r,n,i,(s,a,l)=>{he(this,zr,"f")[s][a]=l})}[Fee](t,r,n,i){this[Nee](t,r,n,i,(s,a,l)=>{he(this,zr,"f")[s][a]=(he(this,zr,"f")[s][a]||[]).concat(l)})}[Nee](t,r,n,i,s){if(Array.isArray(n))n.forEach(a=>{t(a,i)});else if((a=>typeof a=="object")(n))for(let a of VI(n))t(a,n[a]);else s(r,this[Lee](n),i)}[Lee](t){return t==="__proto__"?"___proto___":t}[Qee](t,r){return this[KI](this[Qee].bind(this),"key",t,r),this}[Mee](){var t,r,n,i,s,a,l,c,u,f,m,h;let p=he(this,TQ,"f").pop();l0(p,void 0,he(this,Dn,"f"));let g;t=this,r=this,n=this,i=this,s=this,a=this,l=this,c=this,u=this,f=this,m=this,h=this,{options:{set value(x){Nr(t,zr,x,"f")}}.value,configObjects:g,exitProcess:{set value(x){Nr(r,wd,x,"f")}}.value,groups:{set value(x){Nr(n,Gp,x,"f")}}.value,output:{set value(x){Nr(i,Sl,x,"f")}}.value,exitError:{set value(x){Nr(s,m5,x,"f")}}.value,hasOutput:{set value(x){Nr(a,of,x,"f")}}.value,parsed:this.parsed,strict:{set value(x){Nr(l,$x,x,"f")}}.value,strictCommands:{set value(x){Nr(c,zx,x,"f")}}.value,strictOptions:{set value(x){Nr(u,Yx,x,"f")}}.value,completionCommand:{set value(x){Nr(f,nf,x,"f")}}.value,parseFn:{set value(x){Nr(m,sf,x,"f")}}.value,parseContext:{set value(x){Nr(h,jx,x,"f")}}.value}=p,he(this,zr,"f").configObjects=g,he(this,Un,"f").unfreeze(),he(this,ta,"f").unfreeze(),he(this,ba,"f").unfreeze(),he(this,_d,"f").unfreeze()}[xve](t,r){return Wx(r,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[vve].bind(this),getContext:this[bve].bind(this),getHasOutput:this[Eve].bind(this),getLoggerInstance:this[Ive].bind(this),getParseContext:this[Tve].bind(this),getParserConfiguration:this[Kx].bind(this),getUsageConfiguration:this[Ave].bind(this),getUsageInstance:this[wve].bind(this),getValidationInstance:this[_ve].bind(this),hasParseCallback:this[BQ].bind(this),isGlobalContext:this[Sve].bind(this),postProcess:this[Jx].bind(this),reset:this[Oee].bind(this),runValidation:this[Uee].bind(this),runYargsParserAndExecuteCommands:this[d_].bind(this),setHasOutput:this[Rve].bind(this)}}[vve](){return he(this,ba,"f")}[bve](){return he(this,f_,"f")}[Eve](){return he(this,of,"f")}[Ive](){return he(this,zI,"f")}[Tve](){return he(this,jx,"f")||{}}[wve](){return he(this,Un,"f")}[_ve](){return he(this,ta,"f")}[BQ](){return!!he(this,sf,"f")}[Sve](){return he(this,wQ,"f")}[Jx](t,r,n,i){return n||hs(t)||(r||(t=this[dve](t)),(this[Kx]()["parse-positional-numbers"]||this[Kx]()["parse-positional-numbers"]===void 0)&&(t=this[Cve](t)),i&&(t=qx(t,this,he(this,_d,"f").getMiddleware(),!1))),t}[Oee](t={}){Nr(this,zr,he(this,zr,"f")||{},"f");let r={};r.local=he(this,zr,"f").local||[],r.configObjects=he(this,zr,"f").configObjects||[];let n={};r.local.forEach(a=>{n[a]=!0,(t[a]||[]).forEach(l=>{n[l]=!0})}),Object.assign(he(this,Vx,"f"),Object.keys(he(this,Gp,"f")).reduce((a,l)=>{let c=he(this,Gp,"f")[l].filter(u=>!(u in n));return c.length>0&&(a[l]=c),a},{})),Nr(this,Gp,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(a=>{r[a]=(he(this,zr,"f")[a]||[]).filter(l=>!n[l])}),s.forEach(a=>{r[a]=f5(he(this,zr,"f")[a],l=>!n[l])}),r.envPrefix=he(this,zr,"f").envPrefix,Nr(this,zr,r,"f"),Nr(this,Un,he(this,Un,"f")?he(this,Un,"f").reset(n):ive(this,he(this,Dn,"f")),"f"),Nr(this,ta,he(this,ta,"f")?he(this,ta,"f").reset(n):uve(this,he(this,Un,"f"),he(this,Dn,"f")),"f"),Nr(this,ba,he(this,ba,"f")?he(this,ba,"f").reset():tve(he(this,Un,"f"),he(this,ta,"f"),he(this,_d,"f"),he(this,Dn,"f")),"f"),he(this,Td,"f")||Nr(this,Td,ave(this,he(this,Un,"f"),he(this,ba,"f"),he(this,Dn,"f")),"f"),he(this,_d,"f").reset(),Nr(this,nf,null,"f"),Nr(this,Sl,"","f"),Nr(this,m5,null,"f"),Nr(this,of,!1,"f"),this.parsed=!1,this}[kve](t,r){return he(this,Dn,"f").path.relative(t,r)}[d_](t,r,n,i=0,s=!1){let a=!!n||s;t=t||he(this,h5,"f"),he(this,zr,"f").__=he(this,Dn,"f").y18n.__,he(this,zr,"f").configuration=this[Kx]();let l=!!he(this,zr,"f").configuration["populate--"],c=Object.assign({},he(this,zr,"f").configuration,{"populate--":!0}),u=he(this,Dn,"f").Parser.detailed(t,Object.assign({},he(this,zr,"f"),{configuration:{"parse-positional-numbers":!1,...c}})),f=Object.assign(u.argv,he(this,jx,"f")),m,h=u.aliases,p=!1,g=!1;Object.keys(f).forEach(x=>{x===he(this,Sd,"f")&&f[x]?p=!0:x===he(this,Hp,"f")&&f[x]&&(g=!0)}),f.$0=this.$0,this.parsed=u,i===0&&he(this,Un,"f").clearCachedHelpMessage();try{if(this[Dee](),r)return this[Jx](f,l,!!n,!1);he(this,Sd,"f")&&[he(this,Sd,"f")].concat(h[he(this,Sd,"f")]||[]).filter(_=>_.length>1).includes(""+f._[f._.length-1])&&(f._.pop(),p=!0),Nr(this,wQ,!1,"f");let x=he(this,ba,"f").getCommands(),v=he(this,Td,"f").completionKey in f,E=p||v||s;if(f._.length){if(x.length){let b;for(let _=i||0,R;f._[_]!==void 0;_++)if(R=String(f._[_]),x.includes(R)&&R!==he(this,nf,"f")){let P=he(this,ba,"f").runCommand(R,this,u,_+1,s,p||g||s);return this[Jx](P,l,!!n,!1)}else if(!b&&R!==he(this,nf,"f")){b=R;break}!he(this,ba,"f").hasDefaultCommand()&&he(this,kQ,"f")&&b&&!E&&he(this,ta,"f").recommendCommands(b,x)}he(this,nf,"f")&&f._.includes(he(this,nf,"f"))&&!v&&(he(this,wd,"f")&&d5(!0),this.showCompletionScript(),this.exit(0))}if(he(this,ba,"f").hasDefaultCommand()&&!E){let b=he(this,ba,"f").runCommand(null,this,u,0,s,p||g||s);return this[Jx](b,l,!!n,!1)}if(v){he(this,wd,"f")&&d5(!0),t=[].concat(t);let b=t.slice(t.indexOf(`--${he(this,Td,"f").completionKey}`)+1);return he(this,Td,"f").getCompletion(b,(_,R)=>{if(_)throw new ms(_.message);(R||[]).forEach(P=>{he(this,zI,"f").log(P)}),this.exit(0)}),this[Jx](f,!l,!!n,!1)}if(he(this,of,"f")||(p?(he(this,wd,"f")&&d5(!0),a=!0,this.showHelp("log"),this.exit(0)):g&&(he(this,wd,"f")&&d5(!0),a=!0,he(this,Un,"f").showVersion("log"),this.exit(0))),!a&&he(this,zr,"f").skipValidation.length>0&&(a=Object.keys(f).some(b=>he(this,zr,"f").skipValidation.indexOf(b)>=0&&f[b]===!0)),!a){if(u.error)throw new ms(u.error.message);if(!v){let b=this[Uee](h,{},u.error);n||(m=qx(f,this,he(this,_d,"f").getMiddleware(),!0)),m=this[xve](b,m??f),hs(m)&&!n&&(m=m.then(()=>qx(f,this,he(this,_d,"f").getMiddleware(),!1)))}}}catch(x){if(x instanceof ms)he(this,Un,"f").fail(x.message,x);else throw x}return this[Jx](m??f,l,!!n,!0)}[Uee](t,r,n,i){let s={...this.getDemandedOptions()};return a=>{if(n)throw new ms(n.message);he(this,ta,"f").nonOptionCount(a),he(this,ta,"f").requiredArguments(a,s);let l=!1;he(this,zx,"f")&&(l=he(this,ta,"f").unknownCommands(a)),he(this,$x,"f")&&!l?he(this,ta,"f").unknownArguments(a,t,r,!!i):he(this,Yx,"f")&&he(this,ta,"f").unknownArguments(a,t,{},!1,!1),he(this,ta,"f").limitedChoices(a),he(this,ta,"f").implications(a),he(this,ta,"f").conflicting(a)}}[Rve](){Nr(this,of,!0,"f")}[Zx](t){if(typeof t=="string")he(this,zr,"f").key[t]=!0;else for(let r of t)he(this,zr,"f").key[r]=!0}};function rve(e){return!!e&&typeof e.getInternalMethods=="function"}o(rve,"isYargsInstance");var I0t=Bve(K4e),Dve=I0t;d();d();var m_="apps",DQ="hosts",h_=class{constructor(t,r){this.ctx=t;this.persistenceManager=r}static{o(this,"AuthPersistence")}#e;setAuthAuthority(t){this.#e=t}async getAuthRecord({githubAppId:t}={}){let r=this.getAuthAuthority(),n=await this.persistenceManager.read(m_,this.authRecordKey(this.ctx,r,t));return!t&&!n&&(n=await this.persistenceManager.read(m_,this.authRecordKey(this.ctx,r,this.ctx.get(ea).fallbackAppId()))),n||await this.legacyAuthRecordMaybe(r)}async legacyAuthRecordMaybe(t){let r=await this.persistenceManager.read(DQ,t);if(r){let n=this.ctx.get(ea).fallbackAppId();return{...r,githubAppId:n}}}async saveAuthRecord(t){let r=this.getAuthAuthority(),n=this.ctx.get(ea).findAppIdToAuthenticate();await this.persistenceManager.update(m_,this.authRecordKey(this.ctx,r,t.githubAppId),t);let i=this.ctx.get(ea).fallbackAppId();n===i&&await this.persistenceManager.delete(DQ,r)}async deleteAuthRecord(){let t=this.getAuthAuthority(),r=await this.getAuthRecord();if(r){let n=this.ctx.get(ea).fallbackAppId();r.githubAppId===n&&await this.persistenceManager.delete(DQ,t),await this.persistenceManager.delete(m_,this.authRecordKey(this.ctx,t)),await this.persistenceManager.delete(m_,this.authRecordKey(this.ctx,t,n))}}async purgeLegacyAuthRecords(){await this.persistenceManager.deleteSetting(DQ)}authRecordKey(t,r,n){let i=n??t.get(ea).findAppIdToAuthenticate();return`${r}:${i}`}getAuthAuthority(){return this.#e??"github.com"}};d();d();var PQ={AuthNotifyShown:"auth.auth_notify_shown",AuthNotifyDismissed:"auth.auth_notify_dismissed",NewGitHubLogin:"auth.new_github_login",GitHubLoginSuccess:"auth.github_login_success"};function Pve(e,t){let r=cn.createAndMarkAsIssued({authSource:t});return jt(e,PQ.AuthNotifyShown,r)}o(Pve,"telemetryAuthNotifyShown");function Fve(e){return jt(e,PQ.AuthNotifyDismissed)}o(Fve,"telemetryAuthNotifyDismissed");function FQ(e,t,r){let n=cn.createAndMarkAsIssued({authSource:t,authType:r});return jt(e,PQ.NewGitHubLogin,n)}o(FQ,"telemetryNewGitHubLogin");function NQ(e,t){let r=cn.createAndMarkAsIssued({authType:t});return jt(e,PQ.GitHubLoginSuccess,r)}o(NQ,"telemetryGitHubLoginSuccess");async function T0t(e,t){FQ(e,"unknown","deviceFlow");let r={method:"POST",headers:{Accept:"application/json",...Ic(e)},json:{client_id:t},timeout:30*1e3},n;try{n=await e.get(Or).fetch(e.get($n).getDeviceFlowStartUrl(),r)}catch(i){throw i instanceof Error&&Y7(i)?new Ks(`Could not log in with device flow on ${e.get($n).getAuthAuthority()}: ${i.message}`):i}if(!n.ok)throw new Ks(`Could not log in with device flow on ${e.get($n).getAuthAuthority()}: HTTP ${n.status}`);return await n.json()}o(T0t,"requestDeviceFlowStage1");async function w0t(e,t,r){let n={method:"POST",headers:{Accept:"application/json",...Ic(e)},json:{client_id:r,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"},timeout:3e4};return await(await e.get(Or).fetch(e.get($n).getDeviceFlowCompletionUrl(),n)).json()}o(w0t,"requestDeviceFlowStage2");async function _0t(e,t){return NQ(e,"deviceFlow"),await(await e.get(Or).fetch(e.get($n).getUserInfoUrl(),{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"}})).json()}o(_0t,"requestUserInfo");var Xx=class{static{o(this,"GitHubDeviceFlow")}async getToken(t,r){try{return await this.getTokenUnguarded(t,r)}catch(n){throw t.get(Y0).notifyUser(t,n),n}}async getTokenUnguarded(t,r){let n=await T0t(t,r),i=(async()=>{let s=n.expires_in,a;for(;s>0;){let l=await w0t(t,n.device_code,r);if(s-=n.interval,await new Promise(c=>setTimeout(c,1e3*n.interval)),a=l.access_token,a)return{login:(await _0t(t,a)).login,accessToken:a}}throw new Ks("Timed out waiting for login to complete")})();return{...n,waitForAuth:i}}};d();var af=class{static{o(this,"CitationManager")}},LQ=class extends af{static{o(this,"NoOpCitationManager")}async handleIPCodeCitation(t,r){}};d();d();d();var S0t={didChangeFeatureFlags:!1,fetch:!1,ipCodeCitation:!1,redirectedTelemetry:!1,related:!1,token:!1,watchedFiles:!1},Go=class{constructor(){this.capabilities={...S0t}}static{o(this,"CopilotCapabilitiesProvider")}setCapabilities(t){let r;for(r in t){let n=t[r];n!==void 0&&(this.capabilities[r]=n)}}getCapabilities(){return this.capabilities}};d();var Wee=class extends Error{constructor(r){super(`No instance of ${r.name} has been registered`);this.ctor=r;this.name="UnregisteredContextError",this.code=r.name}static{o(this,"UnregisteredContextError")}},JI=class{constructor(){this.instances=new Map}static{o(this,"Context")}get(t){let r=this.tryGet(t);if(r)return r;throw new Wee(t)}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}).`)}}};d();d();d();var QQ=class e{static{o(this,"FullTextDocument")}constructor(t,r,n,i){this._uri=t,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let r=this.offsetAt(t.start),n=this.offsetAt(t.end);return this._content.substring(r,n)}return this._content}update(t,r){for(let n of t)if(e.isIncremental(n)){let i=Qve(n.range),s=this.offsetAt(i.start),a=this.offsetAt(i.end);this._content=this._content.substring(0,s)+n.text+this._content.substring(a,this._content.length);let l=Math.max(i.start.line,0),c=Math.max(i.end.line,0),u=this._lineOffsets,f=Nve(n.text,!1,s);if(c-l===f.length)for(let h=0,p=f.length;h<p;h++)u[h+l+1]=f[h];else f.length<1e4?u.splice(l+1,c-l,...f):this._lineOffsets=u=u.slice(0,l+1).concat(f,u.slice(c+1));let m=n.text.length-(a-s);if(m!==0)for(let h=l+1+f.length,p=u.length;h<p;h++)u[h]=u[h]+m}else if(e.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=r}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=Nve(this._content,!0)),this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return{line:0,character:t};for(;n<i;){let a=Math.floor((n+i)/2);r[a]>t?i=a:n=a+1}let s=n-1;return t=this.ensureBeforeEOL(t,r[s]),{line:s,character:t-r[s]}}offsetAt(t){let r=this.getLineOffsets();if(t.line>=r.length)return this._content.length;if(t.line<0)return 0;let n=r[t.line];if(t.character<=0)return n;let i=t.line+1<r.length?r[t.line+1]:this._content.length,s=Math.min(n+t.character,i);return this.ensureBeforeEOL(s,n)}ensureBeforeEOL(t,r){for(;t>r&&Lve(this._content.charCodeAt(t-1));)t--;return t}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let r=t;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(t){let r=t;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},g5;(function(e){function t(i,s,a,l){return new QQ(i,s,a,l)}o(t,"create"),e.create=t;function r(i,s,a){if(i instanceof QQ)return i.update(s,a),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}o(r,"update"),e.update=r;function n(i,s){let a=i.getText(),l=Gee(s.map(k0t),(f,m)=>{let h=f.range.start.line-m.range.start.line;return h===0?f.range.start.character-m.range.start.character:h}),c=0,u=[];for(let f of l){let m=i.offsetAt(f.range.start);if(m<c)throw new Error("Overlapping edit");m>c&&u.push(a.substring(c,m)),f.newText.length&&u.push(f.newText),c=i.offsetAt(f.range.end)}return u.push(a.substr(c)),u.join("")}o(n,"applyEdits"),e.applyEdits=n})(g5||(g5={}));function Gee(e,t){if(e.length<=1)return e;let r=e.length/2|0,n=e.slice(0,r),i=e.slice(r);Gee(n,t),Gee(i,t);let s=0,a=0,l=0;for(;s<n.length&&a<i.length;)t(n[s],i[a])<=0?e[l++]=n[s++]:e[l++]=i[a++];for(;s<n.length;)e[l++]=n[s++];for(;a<i.length;)e[l++]=i[a++];return e}o(Gee,"mergeSort");function Nve(e,t,r=0){let n=t?[r]:[];for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);Lve(s)&&(s===13&&i+1<e.length&&e.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}o(Nve,"computeLineOffsets");function Lve(e){return e===13||e===10}o(Lve,"isEOL");function Qve(e){let t=e.start,r=e.end;return t.line>r.line||t.line===r.line&&t.character>r.character?{start:r,end:t}:e}o(Qve,"getWellformedRange");function k0t(e){let t=Qve(e.range);return t!==e.range?{newText:e.newText,range:t}:e}o(k0t,"getWellformedEdit");d();var Mve;(function(e){function t(r){return typeof r=="string"}o(t,"is"),e.is=t})(Mve||(Mve={}));var Hee;(function(e){function t(r){return typeof r=="string"}o(t,"is"),e.is=t})(Hee||(Hee={}));var Ove;(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}o(t,"is"),e.is=t})(Ove||(Ove={}));var MQ;(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}o(t,"is"),e.is=t})(MQ||(MQ={}));var Lc;(function(e){function t(n,i){return n===Number.MAX_VALUE&&(n=MQ.MAX_VALUE),i===Number.MAX_VALUE&&(i=MQ.MAX_VALUE),{line:n,character:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Je.uinteger(i.line)&&Je.uinteger(i.character)}o(r,"is"),e.is=r})(Lc||(Lc={}));var Jo;(function(e){function t(n,i,s,a){if(Je.uinteger(n)&&Je.uinteger(i)&&Je.uinteger(s)&&Je.uinteger(a))return{start:Lc.create(n,i),end:Lc.create(s,a)};if(Lc.is(n)&&Lc.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${s}, ${a}]`)}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Lc.is(i.start)&&Lc.is(i.end)}o(r,"is"),e.is=r})(Jo||(Jo={}));var OQ;(function(e){function t(n,i){return{uri:n,range:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Jo.is(i.range)&&(Je.string(i.uri)||Je.undefined(i.uri))}o(r,"is"),e.is=r})(OQ||(OQ={}));var Uve;(function(e){function t(n,i,s,a){return{targetUri:n,targetRange:i,targetSelectionRange:s,originSelectionRange:a}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Jo.is(i.targetRange)&&Je.string(i.targetUri)&&Jo.is(i.targetSelectionRange)&&(Jo.is(i.originSelectionRange)||Je.undefined(i.originSelectionRange))}o(r,"is"),e.is=r})(Uve||(Uve={}));var jee;(function(e){function t(n,i,s,a){return{red:n,green:i,blue:s,alpha:a}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Je.numberRange(i.red,0,1)&&Je.numberRange(i.green,0,1)&&Je.numberRange(i.blue,0,1)&&Je.numberRange(i.alpha,0,1)}o(r,"is"),e.is=r})(jee||(jee={}));var qve;(function(e){function t(n,i){return{range:n,color:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Jo.is(i.range)&&jee.is(i.color)}o(r,"is"),e.is=r})(qve||(qve={}));var Wve;(function(e){function t(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Je.string(i.label)&&(Je.undefined(i.textEdit)||XI.is(i))&&(Je.undefined(i.additionalTextEdits)||Je.typedArray(i.additionalTextEdits,XI.is))}o(r,"is"),e.is=r})(Wve||(Wve={}));var Gve;(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(Gve||(Gve={}));var Hve;(function(e){function t(n,i,s,a,l,c){let u={startLine:n,endLine:i};return Je.defined(s)&&(u.startCharacter=s),Je.defined(a)&&(u.endCharacter=a),Je.defined(l)&&(u.kind=l),Je.defined(c)&&(u.collapsedText=c),u}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Je.uinteger(i.startLine)&&Je.uinteger(i.startLine)&&(Je.undefined(i.startCharacter)||Je.uinteger(i.startCharacter))&&(Je.undefined(i.endCharacter)||Je.uinteger(i.endCharacter))&&(Je.undefined(i.kind)||Je.string(i.kind))}o(r,"is"),e.is=r})(Hve||(Hve={}));var Vee;(function(e){function t(n,i){return{location:n,message:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&OQ.is(i.location)&&Je.string(i.message)}o(r,"is"),e.is=r})(Vee||(Vee={}));var jve;(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(jve||(jve={}));var Vve;(function(e){e.Unnecessary=1,e.Deprecated=2})(Vve||(Vve={}));var $ve;(function(e){function t(r){let n=r;return Je.objectLiteral(n)&&Je.string(n.href)}o(t,"is"),e.is=t})($ve||($ve={}));var UQ;(function(e){function t(n,i,s,a,l,c){let u={range:n,message:i};return Je.defined(s)&&(u.severity=s),Je.defined(a)&&(u.code=a),Je.defined(l)&&(u.source=l),Je.defined(c)&&(u.relatedInformation=c),u}o(t,"create"),e.create=t;function r(n){var i;let s=n;return Je.defined(s)&&Jo.is(s.range)&&Je.string(s.message)&&(Je.number(s.severity)||Je.undefined(s.severity))&&(Je.integer(s.code)||Je.string(s.code)||Je.undefined(s.code))&&(Je.undefined(s.codeDescription)||Je.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(Je.string(s.source)||Je.undefined(s.source))&&(Je.undefined(s.relatedInformation)||Je.typedArray(s.relatedInformation,Vee.is))}o(r,"is"),e.is=r})(UQ||(UQ={}));var ZI;(function(e){function t(n,i,...s){let a={title:n,command:i};return Je.defined(s)&&s.length>0&&(a.arguments=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.string(i.title)&&Je.string(i.command)}o(r,"is"),e.is=r})(ZI||(ZI={}));var XI;(function(e){function t(s,a){return{range:s,newText:a}}o(t,"replace"),e.replace=t;function r(s,a){return{range:{start:s,end:s},newText:a}}o(r,"insert"),e.insert=r;function n(s){return{range:s,newText:""}}o(n,"del"),e.del=n;function i(s){let a=s;return Je.objectLiteral(a)&&Je.string(a.newText)&&Jo.is(a.range)}o(i,"is"),e.is=i})(XI||(XI={}));var $ee;(function(e){function t(n,i,s){let a={label:n};return i!==void 0&&(a.needsConfirmation=i),s!==void 0&&(a.description=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Je.string(i.label)&&(Je.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(Je.string(i.description)||i.description===void 0)}o(r,"is"),e.is=r})($ee||($ee={}));var e8;(function(e){function t(r){let n=r;return Je.string(n)}o(t,"is"),e.is=t})(e8||(e8={}));var zve;(function(e){function t(s,a,l){return{range:s,newText:a,annotationId:l}}o(t,"replace"),e.replace=t;function r(s,a,l){return{range:{start:s,end:s},newText:a,annotationId:l}}o(r,"insert"),e.insert=r;function n(s,a){return{range:s,newText:"",annotationId:a}}o(n,"del"),e.del=n;function i(s){let a=s;return XI.is(a)&&($ee.is(a.annotationId)||e8.is(a.annotationId))}o(i,"is"),e.is=i})(zve||(zve={}));var zee;(function(e){function t(n,i){return{textDocument:n,edits:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Xee.is(i.textDocument)&&Array.isArray(i.edits)}o(r,"is"),e.is=r})(zee||(zee={}));var Yee;(function(e){function t(n,i,s){let a={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return i&&i.kind==="create"&&Je.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||Je.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||Je.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||e8.is(i.annotationId))}o(r,"is"),e.is=r})(Yee||(Yee={}));var Kee;(function(e){function t(n,i,s,a){let l={kind:"rename",oldUri:n,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(l.options=s),a!==void 0&&(l.annotationId=a),l}o(t,"create"),e.create=t;function r(n){let i=n;return i&&i.kind==="rename"&&Je.string(i.oldUri)&&Je.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||Je.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||Je.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||e8.is(i.annotationId))}o(r,"is"),e.is=r})(Kee||(Kee={}));var Jee;(function(e){function t(n,i,s){let a={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return i&&i.kind==="delete"&&Je.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||Je.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||Je.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||e8.is(i.annotationId))}o(r,"is"),e.is=r})(Jee||(Jee={}));var Zee;(function(e){function t(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>Je.string(i.kind)?Yee.is(i)||Kee.is(i)||Jee.is(i):zee.is(i)))}o(t,"is"),e.is=t})(Zee||(Zee={}));var Yve;(function(e){function t(n){return{uri:n}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.string(i.uri)}o(r,"is"),e.is=r})(Yve||(Yve={}));var Kve;(function(e){function t(n,i){return{uri:n,version:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.string(i.uri)&&Je.integer(i.version)}o(r,"is"),e.is=r})(Kve||(Kve={}));var Xee;(function(e){function t(n,i){return{uri:n,version:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.string(i.uri)&&(i.version===null||Je.integer(i.version))}o(r,"is"),e.is=r})(Xee||(Xee={}));var Jve;(function(e){function t(n,i,s,a){return{uri:n,languageId:i,version:s,text:a}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.string(i.uri)&&Je.string(i.languageId)&&Je.integer(i.version)&&Je.string(i.text)}o(r,"is"),e.is=r})(Jve||(Jve={}));var ete;(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(r){let n=r;return n===e.PlainText||n===e.Markdown}o(t,"is"),e.is=t})(ete||(ete={}));var p_;(function(e){function t(r){let n=r;return Je.objectLiteral(r)&&ete.is(n.kind)&&Je.string(n.value)}o(t,"is"),e.is=t})(p_||(p_={}));var Zve;(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(Zve||(Zve={}));var Xve;(function(e){e.PlainText=1,e.Snippet=2})(Xve||(Xve={}));var ebe;(function(e){e.Deprecated=1})(ebe||(ebe={}));var tbe;(function(e){function t(n,i,s){return{newText:n,insert:i,replace:s}}o(t,"create"),e.create=t;function r(n){let i=n;return i&&Je.string(i.newText)&&Jo.is(i.insert)&&Jo.is(i.replace)}o(r,"is"),e.is=r})(tbe||(tbe={}));var rbe;(function(e){e.asIs=1,e.adjustIndentation=2})(rbe||(rbe={}));var nbe;(function(e){function t(r){let n=r;return n&&(Je.string(n.detail)||n.detail===void 0)&&(Je.string(n.description)||n.description===void 0)}o(t,"is"),e.is=t})(nbe||(nbe={}));var ibe;(function(e){function t(r){return{label:r}}o(t,"create"),e.create=t})(ibe||(ibe={}));var obe;(function(e){function t(r,n){return{items:r||[],isIncomplete:!!n}}o(t,"create"),e.create=t})(obe||(obe={}));var qQ;(function(e){function t(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}o(t,"fromPlainText"),e.fromPlainText=t;function r(n){let i=n;return Je.string(i)||Je.objectLiteral(i)&&Je.string(i.language)&&Je.string(i.value)}o(r,"is"),e.is=r})(qQ||(qQ={}));var sbe;(function(e){function t(r){let n=r;return!!n&&Je.objectLiteral(n)&&(p_.is(n.contents)||qQ.is(n.contents)||Je.typedArray(n.contents,qQ.is))&&(r.range===void 0||Jo.is(r.range))}o(t,"is"),e.is=t})(sbe||(sbe={}));var abe;(function(e){function t(r,n){return n?{label:r,documentation:n}:{label:r}}o(t,"create"),e.create=t})(abe||(abe={}));var lbe;(function(e){function t(r,n,...i){let s={label:r};return Je.defined(n)&&(s.documentation=n),Je.defined(i)?s.parameters=i:s.parameters=[],s}o(t,"create"),e.create=t})(lbe||(lbe={}));var cbe;(function(e){e.Text=1,e.Read=2,e.Write=3})(cbe||(cbe={}));var ube;(function(e){function t(r,n){let i={range:r};return Je.number(n)&&(i.kind=n),i}o(t,"create"),e.create=t})(ube||(ube={}));var fbe;(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(fbe||(fbe={}));var dbe;(function(e){e.Deprecated=1})(dbe||(dbe={}));var mbe;(function(e){function t(r,n,i,s,a){let l={name:r,kind:n,location:{uri:s,range:i}};return a&&(l.containerName=a),l}o(t,"create"),e.create=t})(mbe||(mbe={}));var hbe;(function(e){function t(r,n,i,s){return s!==void 0?{name:r,kind:n,location:{uri:i,range:s}}:{name:r,kind:n,location:{uri:i}}}o(t,"create"),e.create=t})(hbe||(hbe={}));var pbe;(function(e){function t(n,i,s,a,l,c){let u={name:n,detail:i,kind:s,range:a,selectionRange:l};return c!==void 0&&(u.children=c),u}o(t,"create"),e.create=t;function r(n){let i=n;return i&&Je.string(i.name)&&Je.number(i.kind)&&Jo.is(i.range)&&Jo.is(i.selectionRange)&&(i.detail===void 0||Je.string(i.detail))&&(i.deprecated===void 0||Je.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}o(r,"is"),e.is=r})(pbe||(pbe={}));var gbe;(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll"})(gbe||(gbe={}));var WQ;(function(e){e.Invoked=1,e.Automatic=2})(WQ||(WQ={}));var Abe;(function(e){function t(n,i,s){let a={diagnostics:n};return i!=null&&(a.only=i),s!=null&&(a.triggerKind=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.typedArray(i.diagnostics,UQ.is)&&(i.only===void 0||Je.typedArray(i.only,Je.string))&&(i.triggerKind===void 0||i.triggerKind===WQ.Invoked||i.triggerKind===WQ.Automatic)}o(r,"is"),e.is=r})(Abe||(Abe={}));var ybe;(function(e){function t(n,i,s){let a={title:n},l=!0;return typeof i=="string"?(l=!1,a.kind=i):ZI.is(i)?a.command=i:a.edit=i,l&&s!==void 0&&(a.kind=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return i&&Je.string(i.title)&&(i.diagnostics===void 0||Je.typedArray(i.diagnostics,UQ.is))&&(i.kind===void 0||Je.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||ZI.is(i.command))&&(i.isPreferred===void 0||Je.boolean(i.isPreferred))&&(i.edit===void 0||Zee.is(i.edit))}o(r,"is"),e.is=r})(ybe||(ybe={}));var Cbe;(function(e){function t(n,i){let s={range:n};return Je.defined(i)&&(s.data=i),s}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Jo.is(i.range)&&(Je.undefined(i.command)||ZI.is(i.command))}o(r,"is"),e.is=r})(Cbe||(Cbe={}));var xbe;(function(e){function t(n,i){return{tabSize:n,insertSpaces:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Je.uinteger(i.tabSize)&&Je.boolean(i.insertSpaces)}o(r,"is"),e.is=r})(xbe||(xbe={}));var vbe;(function(e){function t(n,i,s){return{range:n,target:i,data:s}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Jo.is(i.range)&&(Je.undefined(i.target)||Je.string(i.target))}o(r,"is"),e.is=r})(vbe||(vbe={}));var bbe;(function(e){function t(n,i){return{range:n,parent:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Jo.is(i.range)&&(i.parent===void 0||e.is(i.parent))}o(r,"is"),e.is=r})(bbe||(bbe={}));var Ebe;(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator"})(Ebe||(Ebe={}));var Ibe;(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(Ibe||(Ibe={}));var Tbe;(function(e){function t(r){let n=r;return Je.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}o(t,"is"),e.is=t})(Tbe||(Tbe={}));var wbe;(function(e){function t(n,i){return{range:n,text:i}}o(t,"create"),e.create=t;function r(n){let i=n;return i!=null&&Jo.is(i.range)&&Je.string(i.text)}o(r,"is"),e.is=r})(wbe||(wbe={}));var _be;(function(e){function t(n,i,s){return{range:n,variableName:i,caseSensitiveLookup:s}}o(t,"create"),e.create=t;function r(n){let i=n;return i!=null&&Jo.is(i.range)&&Je.boolean(i.caseSensitiveLookup)&&(Je.string(i.variableName)||i.variableName===void 0)}o(r,"is"),e.is=r})(_be||(_be={}));var Sbe;(function(e){function t(n,i){return{range:n,expression:i}}o(t,"create"),e.create=t;function r(n){let i=n;return i!=null&&Jo.is(i.range)&&(Je.string(i.expression)||i.expression===void 0)}o(r,"is"),e.is=r})(Sbe||(Sbe={}));var kbe;(function(e){function t(n,i){return{frameId:n,stoppedLocation:i}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.defined(i)&&Jo.is(n.stoppedLocation)}o(r,"is"),e.is=r})(kbe||(kbe={}));var tte;(function(e){e.Type=1,e.Parameter=2;function t(r){return r===1||r===2}o(t,"is"),e.is=t})(tte||(tte={}));var rte;(function(e){function t(n){return{value:n}}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&(i.tooltip===void 0||Je.string(i.tooltip)||p_.is(i.tooltip))&&(i.location===void 0||OQ.is(i.location))&&(i.command===void 0||ZI.is(i.command))}o(r,"is"),e.is=r})(rte||(rte={}));var Rbe;(function(e){function t(n,i,s){let a={position:n,label:i};return s!==void 0&&(a.kind=s),a}o(t,"create"),e.create=t;function r(n){let i=n;return Je.objectLiteral(i)&&Lc.is(i.position)&&(Je.string(i.label)||Je.typedArray(i.label,rte.is))&&(i.kind===void 0||tte.is(i.kind))&&i.textEdits===void 0||Je.typedArray(i.textEdits,XI.is)&&(i.tooltip===void 0||Je.string(i.tooltip)||p_.is(i.tooltip))&&(i.paddingLeft===void 0||Je.boolean(i.paddingLeft))&&(i.paddingRight===void 0||Je.boolean(i.paddingRight))}o(r,"is"),e.is=r})(Rbe||(Rbe={}));var Bbe;(function(e){function t(r){return{kind:"snippet",value:r}}o(t,"createSnippet"),e.createSnippet=t})(Bbe||(Bbe={}));var Dbe;(function(e){function t(r,n,i,s){return{insertText:r,filterText:n,range:i,command:s}}o(t,"create"),e.create=t})(Dbe||(Dbe={}));var Pbe;(function(e){function t(r){return{items:r}}o(t,"create"),e.create=t})(Pbe||(Pbe={}));var Fbe;(function(e){e.Invoked=0,e.Automatic=1})(Fbe||(Fbe={}));var Nbe;(function(e){function t(r,n){return{range:r,text:n}}o(t,"create"),e.create=t})(Nbe||(Nbe={}));var Lbe;(function(e){function t(r,n){return{triggerKind:r,selectedCompletionInfo:n}}o(t,"create"),e.create=t})(Lbe||(Lbe={}));var Qbe;(function(e){function t(r){let n=r;return Je.objectLiteral(n)&&Hee.is(n.uri)&&Je.string(n.name)}o(t,"is"),e.is=t})(Qbe||(Qbe={}));var Mbe;(function(e){function t(s,a,l,c){return new nte(s,a,l,c)}o(t,"create"),e.create=t;function r(s){let a=s;return!!(Je.defined(a)&&Je.string(a.uri)&&(Je.undefined(a.languageId)||Je.string(a.languageId))&&Je.uinteger(a.lineCount)&&Je.func(a.getText)&&Je.func(a.positionAt)&&Je.func(a.offsetAt))}o(r,"is"),e.is=r;function n(s,a){let l=s.getText(),c=i(a,(f,m)=>{let h=f.range.start.line-m.range.start.line;return h===0?f.range.start.character-m.range.start.character:h}),u=l.length;for(let f=c.length-1;f>=0;f--){let m=c[f],h=s.offsetAt(m.range.start),p=s.offsetAt(m.range.end);if(p<=u)l=l.substring(0,h)+m.newText+l.substring(p,l.length);else throw new Error("Overlapping edit");u=h}return l}o(n,"applyEdits"),e.applyEdits=n;function i(s,a){if(s.length<=1)return s;let l=s.length/2|0,c=s.slice(0,l),u=s.slice(l);i(c,a),i(u,a);let f=0,m=0,h=0;for(;f<c.length&&m<u.length;)a(c[f],u[m])<=0?s[h++]=c[f++]:s[h++]=u[m++];for(;f<c.length;)s[h++]=c[f++];for(;m<u.length;)s[h++]=u[m++];return s}o(i,"mergeSort")})(Mbe||(Mbe={}));var nte=class{static{o(this,"FullTextDocument")}constructor(t,r,n,i){this._uri=t,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let r=this.offsetAt(t.start),n=this.offsetAt(t.end);return this._content.substring(r,n)}return this._content}update(t,r){this._content=t.text,this._version=r,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let t=[],r=this._content,n=!0;for(let i=0;i<r.length;i++){n&&(t.push(i),n=!1);let s=r.charAt(i);n=s==="\r"||s===`
516
516
  `,s==="\r"&&i+1<r.length&&r.charAt(i+1)===`
517
517
  `&&i++}n&&r.length>0&&t.push(r.length),this._lineOffsets=t}return this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return Lc.create(0,t);for(;n<i;){let a=Math.floor((n+i)/2);r[a]>t?i=a:n=a+1}let s=n-1;return Lc.create(s,t-r[s])}offsetAt(t){let r=this.getLineOffsets();if(t.line>=r.length)return this._content.length;if(t.line<0)return 0;let n=r[t.line],i=t.line+1<r.length?r[t.line+1]:this._content.length;return Math.max(Math.min(n+t.character,i),n)}get lineCount(){return this.getLineOffsets().length}},Je;(function(e){let t=Object.prototype.toString;function r(p){return typeof p<"u"}o(r,"defined"),e.defined=r;function n(p){return typeof p>"u"}o(n,"undefined"),e.undefined=n;function i(p){return p===!0||p===!1}o(i,"boolean"),e.boolean=i;function s(p){return t.call(p)==="[object String]"}o(s,"string"),e.string=s;function a(p){return t.call(p)==="[object Number]"}o(a,"number"),e.number=a;function l(p,g,x){return t.call(p)==="[object Number]"&&g<=p&&p<=x}o(l,"numberRange"),e.numberRange=l;function c(p){return t.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}o(c,"integer"),e.integer=c;function u(p){return t.call(p)==="[object Number]"&&0<=p&&p<=2147483647}o(u,"uinteger"),e.uinteger=u;function f(p){return t.call(p)==="[object Function]"}o(f,"func"),e.func=f;function m(p){return p!==null&&typeof p=="object"}o(m,"objectLiteral"),e.objectLiteral=m;function h(p,g){return Array.isArray(p)&&p.every(g)}o(h,"typedArray"),e.typedArray=h})(Je||(Je={}));var Fo=class{static{o(this,"LocationFactory")}static{this.range=Jo.create.bind(Jo)}static{this.position=Lc.create.bind(Lc)}};function t8({textDocument:e,position:t},r){let n=e.offsetAt(t);for(let{range:i,newText:s}of r){let a=e.getText(i),l=e.offsetAt(i.end);e=e.applyEdits([{range:i,newText:s}]),!(n<e.offsetAt(i.start))&&(n<l&&(n=l),n+=s.length-a.length)}return{textDocument:e,position:e.positionAt(n)}}o(t8,"applyEdits");function GQ(e,t,r){return t8({textDocument:e,position:t},r)}o(GQ,"applyEditsWithPosition");var z1=class e{constructor(t,r,n,i=[]){this.uri=t;this._textDocument=r;this.detectedLanguageId=n;this.appliedEdits=i}static{o(this,"CopilotTextDocument")}static withChanges(t,r,n){let i=g5.create(t.clientUri,t.clientLanguageId,n,t.getText());return g5.update(i,r,n),new e(t.uri,i,t.detectedLanguageId)}applyEdits(t){let r=g5.create(this.clientUri,this.clientLanguageId,this.version,this.getText());return g5.update(r,t.map(n=>({text:n.newText,range:n.range})),this.version),new e(this.uri,r,this.detectedLanguageId,[...this.appliedEdits,...t])}static create(t,r,n,i,s=NI({uri:t,languageId:r})){return new e(nc(t),g5.create(t,r,n,i),s)}get clientUri(){return this._textDocument.uri}get clientLanguageId(){return this._textDocument.languageId}get languageId(){return this._textDocument.languageId}get version(){return this._textDocument.version}get lineCount(){return this._textDocument.lineCount}getText(t){return this._textDocument.getText(t)}positionAt(t){return this._textDocument.positionAt(t)}offsetAt(t){return this._textDocument.offsetAt(t)}lineAt(t){let r=typeof t=="number"?t:t.line;if(r<0||r>=this.lineCount)throw new RangeError("Illegal value for lineNumber");let n=Jo.create(r,0,r+1,0),i=this.getText(n).replace(/\r\n$|\r$|\n$/g,""),s=Jo.create(Lc.create(r,0),Lc.create(r,i.length)),a=i.trim().length===0;return{text:i,range:s,isEmptyOrWhitespace:a}}};d();d();d();d();var g_={isBlocked:!1,reason:"VALID_FILE"},HQ={isBlocked:!1,reason:"NO_MATCHING_POLICY"},Obe={isBlocked:!0,reason:"POLICY_ERROR",message:"Copilot is disabled because we could not fetch the repository policy"},e4={all:"all",repo:"repo"},Y1=new Ht("contentExclusion");d();d();var jQ=class{static{o(this,"PolicyEvaluator")}};d();d();d();var Ube=new Ht("repository"),t4=class e{constructor(){this.data={}}static{o(this,"GitConfigData")}getKeys(){return Object.keys(this.data)}getEntries(){return Object.entries(this.data)}get(t){let r=this.getAll(t);return r?r[r.length-1]:void 0}getAll(t){return this.data[this.normalizeKey(t)]}add(t,r){t in this.data||(this.data[t]=[]),this.data[t].push(r)}getSectionValues(t,r){let n=`${t}.`.toLowerCase(),i=`.${r}`.toLowerCase();return Object.keys(this.data).filter(s=>s.startsWith(n)&&s.endsWith(i)).map(s=>s.slice(n.length,-i.length))}concat(t){return this.getEntries().concat(t.getEntries()).reduce((r,[n,i])=>(i.forEach(s=>r.add(n,s)),r),new e)}normalizeKey(t){let r=t.split(".");return r[0]=r[0].toLowerCase(),r[r.length-1]=r[r.length-1].toLowerCase(),r.join(".")}},nh=class{static{o(this,"GitConfigLoader")}},VQ=class extends nh{constructor(r){super();this.loaders=r}static{o(this,"GitFallbackConfigLoader")}async getConfig(r,n){for(let i of this.loaders){let s=await i.getConfig(r,n);if(s)return s}}};d();var qbe=require("os");var $Q=class{constructor(t){this.url=t;this.isUrl()?this.parseUrl():this.tryParseSSHString()||(this._scheme="file")}static{o(this,"GitRemoteUrl")}get scheme(){return this._scheme}get authority(){return this._authority}get hostname(){return this._hostname}get path(){return this._path}isInvalid(){return this._error!==void 0}isRemote(){return this.scheme!=="file"&&this.hostname!==void 0}isGitHub(){return this.isRemote()&&/(?:^|\.)(?:github\.com|ghe\.com)$/i.test(this.hostname??"")}isADO(){return this.isRemote()&&/(?:^|\.)(?:visualstudio\.com|azure\.com)$/i.test(this.hostname??"")}getUrlForApi(){if(!this.isRemote())return null;if(this.isUrl()&&!this.isInvalid())return Zy.from({scheme:this.scheme,authority:this.authority.replace(/^[^@]+@/,""),path:this.path}).toString();if(this.scheme=="ssh"&&this.isADO()){let t=this.url.indexOf(":");return this.url.substring(0,t+1)+this.path}return this.url}isUrl(){return/[A-Za-z0-9][A-Za-z0-9]+:\/\//.test(this.url)}parseUrl(){let t;try{t=Zy.parse(this.url)}catch(r){this._error=r;return}this._scheme=t.scheme,this.setAuthority(t.authority),this.setPath(t.path)}setAuthority(t){this._authority=t;let r=t.replace(/^[^@]+@/,"").replace(/:\d*$/,"");r&&(this._hostname=r)}tryParseSSHString(){let t=/^(?<host>[^:/\\[]*(?:\[[^/\\\]]*\])?):/.exec(this.url);if(t&&((0,qbe.platform)()!=="win32"||(t.groups?.host?.length??0)>1)){let r=t.groups?.host??"";return this._scheme="ssh",this.setAuthority(r),this.setPath(this.url.substring(r.length+1)),!0}return!1}setPath(t){if(this.isADO())try{this._path=decodeURIComponent(t);return}catch{}this._path=t}};var zQ=class{static{o(this,"GitRemoteResolver")}async resolveRemote(t,r){let n=await t.get(nh).getConfig(t,r);if(!n)return;let i=this.getRemotes(n),s=i.filter(a=>a.url.isGitHub());if(s.length)return s.find(a=>a.name==="origin")?.url??s[0].url;if(i.length)return i.find(a=>a.name==="origin")?.url??i[0].url}getRemotes(t){let r=this.getInsteadOfRules(t);return t.getSectionValues("remote","url").map(n=>({name:n,url:new $Q(this.applyInsteadOfRules(r,t.get(`remote.${n}.url`)??""))})).filter(n=>n.url.isRemote())}applyInsteadOfRules(t,r){for(let n of t)if(r.startsWith(n.insteadOf))return n.base+r.slice(n.insteadOf.length);return r}getInsteadOfRules(t){return t.getSectionValues("url","insteadof").map(r=>({base:r,insteadOf:t.get(`url.${r}.insteadof`)})).sort((r,n)=>n.base.length-r.base.length)}};var R0t=100,ite=class{constructor(t,r){this.baseFolder=t;this.remote=r;this.setNWO()}static{o(this,"GitRepository")}get tenant(){return this._tenant}get owner(){return this._owner}get name(){return this._name}get adoOrganization(){return this._adoOrganization}isGitHub(){return this.remote?.isGitHub()??!1}isADO(){return this.remote?.isADO()??!1}setNWO(){let t=this.remote?.path?.replace(/^\//,"").split("/");if(this.isGitHub()){this._owner=t?.[0],this._name=t?.[1]?.replace(/\.git$/,"");let r=/^(?<tenant>[^.]+)\.ghe\.com$/.exec(this.remote?.hostname??"");r&&(this._tenant=r.groups?.tenant)}else if(this.isADO()&&t?.length===4){if(this.remote?.scheme==="ssh"){this._adoOrganization=t?.[1],this._owner=t?.[2],this._name=t?.[3];return}let r=/(?:(?<org>[^.]+)\.)?visualstudio\.com$/.exec(this.remote?.hostname??"");r?(this._adoOrganization=r.groups?.org,this._owner=t?.[1],this._name=t?.[3]):(this._adoOrganization=t?.[0],this._owner=t?.[1],this._name=t?.[3])}}},K1=class e{constructor(t){this.ctx=t;this.remoteResolver=new zQ;this.cache=new In(R0t)}static{o(this,"RepositoryManager")}async getRepo({uri:t}){let r,n=[];do{if(this.cache.has(t.toString())){let s=this.cache.get(t);return this.updateCache(n,s),s}n.push(t.toString());let i=await this.tryGetRepoForFolder(t);if(i)return this.updateCache(n,i),i;r=t,t=zu(t)}while(t!==r);this.updateCache(n,void 0)}updateCache(t,r){t.forEach(n=>this.cache.set(n,r))}async tryGetRepoForFolder(t){return await this.isBaseRepoFolder(t)?new ite(typeof t=="string"?{uri:t}:t,await this.repoUrl(t)):void 0}async isBaseRepoFolder(t){return await e.getRepoConfigLocation(this.ctx,t)!==void 0}async repoUrl(t){return await this.remoteResolver.resolveRemote(this.ctx,t)}static async getRepoConfigLocation(t,r){try{let n=t.get(bo),i=Po(r,".git");if((await n.stat(i)).type&1)return await this.getConfigLocationForGitfile(n,r,i);let a=Po(i,"config");return await n.stat(a),a}catch{return}}static async getConfigLocationForGitfile(t,r,n){let s=(await t.readFileString(n)).match(/^gitdir:\s+(.+)$/m);if(!s)return;let a=Ix(r,s[1]),l=Po(a,"config");if(await this.tryStat(t,l)!==void 0)return l;let c=Po(a,"config.worktree");if(await this.tryStat(t,c)!==void 0)return c;let u=Po(a,"commondir");a=Ix(a,(await t.readFileString(u)).trimEnd());let f=Po(a,"config");return await t.stat(f),f}static async tryStat(t,r){try{return await t.stat(r)}catch{return}}};d();var Wbe=o((e,t)=>{if(t5.Check(e,t))return t;let r=`Typebox schema validation failed:
518
518
  ${[...t5.Errors(e,t)].map(n=>`${n.path} ${n.message}`).join(`
@@ -706,7 +706,7 @@ ${n}${r}
706
706
  `){e.readImmediate(1),t?.push(`
707
707
  `);break}}}o(FPe,"pipeOneLine");function LPe(e){if(e.startsWith(`${Ak} `))return"";let t=e.indexOf(`
708
708
  ${Ak} `);return t===-1?"":e.substring(0,t)+`
709
- `}o(LPe,"parseOverallDescription");d();d();var bW=class extends Error{static{o(this,"EditConversationNotFoundException")}constructor(t){super(t),this.name="EditConversationNotFoundException"}};var D6t=new Ht("CopilotEditsConversations"),Za=class{constructor(t){this.editConversations=new In(50);this.ctx=t}static{o(this,"EditConversations")}create(t="panel",r){let n=new yW([],t,r);return this.editConversations.set(n.id,n),n}destroy(t){this.editConversations.delete(t)!==!0&&D6t.warn(this.ctx,`Edit code conversation ${t} does not exist`)}addTurn(t,r){return this.get(t).addTurn(r),r}deleteTurn(t,r){this.get(t).deleteTurn(r)}get(t){return this.getEditConversation(t)}getEditConversation(t){let r=this.editConversations.get(t);if(!r)throw new bW(`Conversation with id ${t} does not exist`);return r}getAll(){return Array.from(this.editConversations.values())}findByTurnId(t){let r=this.getAll();for(let n of r)if(n.hasTurn(t))return n}};d();d();var ci=class{static{o(this,"ModelConfigurationProvider")}},IW=class extends ci{constructor(r){super();this.ctx=r}static{o(this,"DefaultModelConfigurationProvider")}async getBestChatModelConfig(r,n){let i=[];for(let s of r){let a=await this.getFirstMatchingChatModelConfiguration(s,n);a&&i.push(a)}if(i.length>0){let s=i.find(a=>a.isExperimental);return s||i[0]}throw Jr.error(this.ctx,`No model configuration found for families: ${r.join(", ")}. Available models: ${JSON.stringify(await this.ctx.get(Ju).getMetadata())}`),new Error("No model configuration found")}async getFirstMatchingModelMetadata(r){let n=await this.ctx.get(Ju).getMetadata(),i=P6t(n,r);if(i.length>0)return i[0]}async getFirstMatchingChatModelConfiguration(r,n){let i=await this.getFirstMatchingModelMetadata({family:r,type:"chat",supports:n});if(i!==void 0)return r===di.Gpt35turbo||r===di.Gpt4oMini?{modelId:i.id,uiName:i.name,modelFamily:r,maxRequestTokens:Bae(6144,i),maxResponseTokens:EW(2048,i),baseTokensPerMessage:3,baseTokensPerName:1,baseTokensPerCompletion:3,tokenizer:i.capabilities.tokenizer,isExperimental:i.isExperimental??!1,stream:i.capabilities.supports?.streaming??!1,toolCalls:i.capabilities.supports?.tool_calls??!1}:r===di.Gpt4||r===di.Gpt4turbo?{modelId:i.id,uiName:i.name,modelFamily:r,maxRequestTokens:Bae(10240,i),maxResponseTokens:EW(4096,i),baseTokensPerMessage:3,baseTokensPerName:1,baseTokensPerCompletion:3,tokenizer:i.capabilities.tokenizer,isExperimental:i.isExperimental??!1,stream:i.capabilities.supports?.streaming??!1,toolCalls:i.capabilities.supports?.tool_calls??!1}:r.includes("claude")?{modelId:i.id,uiName:i.name,modelFamily:r,maxRequestTokens:await QPe(this.ctx,i),maxResponseTokens:EW(8192,i),baseTokensPerMessage:3,baseTokensPerName:1,baseTokensPerCompletion:3,tokenizer:i.capabilities.tokenizer,isExperimental:i.isExperimental??!1,stream:i.capabilities.supports?.streaming??!1,toolCalls:i.capabilities.supports?.tool_calls??!1}:{modelId:i.id,uiName:i.name,modelFamily:r,maxRequestTokens:await QPe(this.ctx,i),maxResponseTokens:EW(4096,i),baseTokensPerMessage:3,baseTokensPerName:1,baseTokensPerCompletion:3,tokenizer:i.capabilities.tokenizer,isExperimental:i.isExperimental??!1,stream:i.capabilities.supports?.streaming??!1,toolCalls:i.capabilities.supports?.tool_calls??!1}}async getFirstMatchingEmbeddingModelConfiguration(r){let n=await this.getFirstMatchingModelMetadata({family:r,type:"embeddings"});if(n!==void 0)switch(r){case vN.textEmbedding3Small:return{modelId:n.id,modelFamily:r,maxBatchSize:n.capabilities.limits?.max_inputs??16,maxTokens:8191,tokenizer:"cl100k_base"}}}};async function QPe(e,t){let r=e.get(Cr),n=await r.updateExPValuesAndAssignments(),i=r.ideChatMaxRequestTokens(n);return i===-1&&(i=16384),Bae(i,t)}o(QPe,"getExpRequestTokens");function Bae(e,t){return t.capabilities.limits?.max_prompt_tokens?Math.min(e,t.capabilities.limits.max_prompt_tokens):e}o(Bae,"getRequestTokens");function EW(e,t){return t.capabilities.limits?.max_output_tokens?Math.min(e,t.capabilities.limits.max_output_tokens):e}o(EW,"getResponseTokens");function P6t(e,t){return e.filter(r=>r.capabilities.type!==t.type||r.capabilities.family!==t.family?!1:r.capabilities.supports===void 0||t.supports===void 0?!0:Object.keys(t.supports).every(n=>t.supports?.[n]===r.capabilities.supports?.[n]))}o(P6t,"filterModelsByCapabilities");var Eh=class{static{o(this,"ModelPickerUtils")}static async getModelConfiguration(t,r,n){return t.get(ci).getBestChatModelConfig(n?[n]:ds(r))}static transformMessages(t,r){return r===di.O1Ga||r===di.O1Mini?t.map(n=>n.role!=="user"?{role:"user",content:n.content}:n):t}};var kA=class{constructor(t,r){this.chatFetcher=r;this.ctx=t,this.chatFetcher=this.chatFetcher??new ka(t)}static{o(this,"CopilotEditsService")}async createOrContinueEditConversation(t,r){try{await this.reportBegin(t);let n=await this.getEditCodeResult(t,r),i=CW.processResult(t,n);await this.parseAndSendProgressBack(t,i,r),t.currentTurn.response={message:i,type:"model"},t.currentTurn.status="success",await this.reportEnd(t)}catch(n){if(n instanceof hC)await this.reportEnd(t,{message:Yy});else if(n instanceof v0)await this.reportEnd(t,n.editConversationError);else{let i=n instanceof Error?n.message:String(n);t.currentTurn.status="error",t.currentTurn.response={message:i,type:"meta"},await this.reportEnd(t,{message:i})}}return[]}async getEditCodeResult(t,r){await this.abortIfCancelled(t,r);let n=await this.buildEditCodePromptMessages(t),i=await this.ctx.get(Cr).updateExPValuesAndAssignments();await this.abortIfCancelled(t,r);let s=await Eh.getModelConfiguration(this.ctx,"edits",t.userSelectedModel),a=Eh.transformMessages(n,s.modelFamily);return await this.abortIfCancelled(t,r),await this.chatFetcher.fetchResponse({modelConfiguration:s,messages:a,uiKind:"editsPanel",intentParams:{intent:!0},temperature:.1,llmInteraction:t.toLlmInteraction()},r,i)}async buildEditCodePromptMessages(t){let r=t.currentTurn,n=await Eh.getModelConfiguration(this.ctx,"edits",t.userSelectedModel),i=t.editConversation.getTurns(),s=i.length>1?i.slice(0,-1):[];return await new xW({userMessage:r.request.message,workspaceFolder:r.workspaceFolder,workingSet:r.workingSet,userLanguage:t.editConversation.getUserLanguage(),textDocumentProvider:new vg(this.ctx),modelName:n.uiName,history:s}).render()}async abortIfCancelled(t,r){if(r.isCancellationRequested)throw t.currentTurn.status="cancelled",t.currentTurn.response={message:Yy,type:"user"},new hC;this.ctx.get(Za).get(t.editConversationId)}async parseAndSendProgressBack(t,r,n){try{let i=PPe(r),s=new V6(this.ctx),a=o(async u=>SA.pathToUri(t,u),"createUri"),l=[],c=LPe(r);c&&await this.ctx.get(fc).reportTurn(t,{fileGenerationStatus:"overall-description-generated",editDescription:c}),await this.abortIfCancelled(t,n);for await(let u of NPe(i,a))l.push(s.mapCode(u,n,async f=>{await this.ctx.get(fc).reportTurn(t,f)}));await Promise.all(l),l.length===0&&await this.reportNoCodeBlocks(t,r)}catch(i){if(i instanceof pC||i instanceof B8)t.currentTurn.status="error",t.currentTurn.response={message:i.message,type:"meta"},await this.reportEnd(t,{message:i.message});else if(i instanceof hC)t.currentTurn.status="cancelled",t.currentTurn.response={message:Yy,type:"user"},await this.reportEnd(t,{message:Yy});else throw i}}async reportNoCodeBlocks(t,r){await this.ctx.get(fc).reportTurn(t,{fileGenerationStatus:"no-code-blocks-found",rawResponse:r})}async reportBegin(t){await this.ctx.get(fc).reportTurn(t,{fileGenerationStatus:"edit-conversation-begin"})}async reportEnd(t,r){await this.ctx.get(fc).reportTurn(t,{fileGenerationStatus:"edit-conversation-end",error:r})}};d();var OPe="github.com",MPe=`https://${OPe}`,z6=class extends $n{constructor(r,n=MPe,i=process.env){super();this.env=i;this.validateBaseUrl(r,n)&&this.recalculateUrlDefaults(n),js(r,s=>this.onCopilotToken(r,s))}static{o(this,"DefaultNetworkConfiguration")}onCopilotToken(r,n){this.updateServiceEndpoints(r,n.envelope.endpoints)}getLastKnownEndpointUrl(r,n){return this.join((this.lastEndpoints??aN)[r],n)}isGitHubEnterprise(){return this.isEnterprise}getAuthAuthority(){return this.baseUrlObject.host}getAPIUrl(r){return this.join(this.apiUrl,r)}getApiUrl(r,n){return this.join(r.apiUrl,n)}getLoginReachabilityUrl(){return this.loginReachabilityUrl}getDeviceFlowStartUrl(){return this.deviceFlowStartUrl}getDeviceFlowCompletionUrl(){return this.deviceFlowCompletionUrl}getUserInfoUrl(){return this.userInfoUrl}getTelemetryUrl(r){return this.join(this.telemetryUrl,r)}setTelemetryUrlForTesting(r){this.telemetryUrl=r}getExperimentationUrl(r){return this.join(this.experimentationUrl,r)}validateBaseUrl(r,n){return this.isPermittedUrl(r,n)?!0:(r.get(va).showWarningMessage(`Ignoring invalid or unsupported authentication URL "${n}".`),!1)}updateBaseUrl(r,n){n||=MPe;let i=this.baseUrlObject;this.validateBaseUrl(r,n)&&this.withTelemetryReInitialization(r,()=>{this.recalculateUrlDefaults(n),i.href!==this.baseUrlObject.href&&r.get(Xr).resetToken()})}updateBaseUrlFromTokenEndpoint(r,n){try{let i=new URL(n);i.hostname.startsWith("api.")?this.updateBaseUrl(r,`https://${i.hostname.substring(4)}`):this.updateBaseUrl(r)}catch{this.updateBaseUrl(r)}}updateServiceEndpoints(r,n){this.lastEndpoints=n,n&&this.isPermittedUrl(r,n.telemetry)&&this.withTelemetryReInitialization(r,()=>{this.telemetryUrl=this.join(n.telemetry,"telemetry"),this.experimentationUrl=this.join(n.telemetry,"telemetry")})}withTelemetryReInitialization(r,n){let i=this.telemetryUrl;if(n(),i===this.telemetryUrl)return;let s=r.get(Ku);s.isInitialized&&s.reInitialize(r)}recalculateUrlDefaults(r){let n=this.parseUrls(r);this.baseUrlObject=n.base;let i=n.api;this.isEnterprise=this.baseUrlObject.host!==OPe,this.apiUrl=i.href,this.loginReachabilityUrl=this.join(this.baseUrlObject.href,"/login/device"),this.deviceFlowStartUrl=this.join(this.baseUrlObject.href,"/login/device/code"),this.deviceFlowCompletionUrl=this.join(this.baseUrlObject.href,"/login/oauth/access_token"),this.userInfoUrl=this.join(i.href,"/user"),this.telemetryUrl=this.join(this.isEnterprise?this.prefixWith("copilot-telemetry-service.",this.baseUrlObject).href:aN.telemetry,"/telemetry"),this.experimentationUrl=this.telemetryUrl}parseUrls(r){if(this.env.CODESPACES==="true"&&this.env.GITHUB_TOKEN&&this.env.GITHUB_SERVER_URL&&this.env.GITHUB_API_URL&&!this.env.GITHUB_COPILOT_TOKEN&&!this.env.GH_COPILOT_TOKEN)try{return{base:new URL(this.env.GITHUB_SERVER_URL),api:new URL(this.env.GITHUB_API_URL)}}catch{}let n=new URL(r),i=this.prefixWith("api.",n);return{base:n,api:i}}isPermittedUrl(r,n){return this.isValidUrl(n)&&this.hasSupportedProtocol(r,n)}isValidUrl(r){try{if(r)return new URL(r),!0}catch{}return!1}hasSupportedProtocol(r,n){let i=new URL(n).protocol;return i==="https:"||!lN(r)&&i==="http:"}join(r,n){return n?new URL(n,r).href:r}prefixWith(r,n){return new URL(`${n.protocol}//${r}${n.host}`)}};d();var pen=new Ht("exp");function UPe(e){let t=e.get(Cr);t.registerStaticFilters(L6t(e)),t.registerDynamicFilter("X-Copilot-OverrideEngine",()=>On(e,St.DebugOverrideEngine)||On(e,St.DebugOverrideEngineLegacy)),t.registerDynamicFilter("X-VSCode-ExtensionName",()=>e.get(dn).getEditorPluginInfo().name),t.registerDynamicFilter("X-VSCode-ExtensionVersion",()=>Dae(!e.get(go).isProduction()&&e.get(dn).getEditorPluginInfo().name==="copilot"?"1.999.0":e.get(dn).getEditorPluginInfo().version)),t.registerDynamicFilter("X-VSCode-ExtensionRelease",()=>F6t(e)),t.registerDynamicFilter("X-VSCode-Build",()=>e.get(dn).getEditorInfo().name),t.registerDynamicFilter("X-VSCode-AppVersion",()=>Dae(e.get(dn).getEditorInfo().version)),t.registerDynamicFilter("X-VSCode-TargetPopulation",()=>N6t(e)),t.registerDynamicFilterGroup(()=>{let r={};for(let n of e.get(dn).getRelatedPluginInfo()){let i=ed+n.name.replace(/[^A-Za-z]/g,"").toLowerCase();if(!Object.values($7).includes(i)){iN(e,{reason:`A filter could not be registered for the unrecognized related plugin "${n.name}".`});continue}r[i]=Dae(n.version)}return r})}o(UPe,"setupExperimentationService");function F6t(e){let t=e.get(dn).getEditorPluginInfo();return t.name==="copilot"&&md(e)==="nightly"||t.name==="copilot-intellij"&&t.version.endsWith("nightly")?"nightly":"stable"}o(F6t,"getPluginRelease");function N6t(e){let t=e.get(dn).getEditorInfo();return t.name==="vscode"&&t.version.endsWith("-insider")?"insider":"public"}o(N6t,"getTargetPopulation");function L6t(e){return Q6t(e)}o(L6t,"createAllFilters");function Q6t(e){let t=e.get(_s);return{"X-MSEdge-ClientId":t.machineId,"X-Copilot-ClientVersion":Ex(e)}}o(Q6t,"createDefaultFilters");function Dae(e){return e.split("-")[0]}o(Dae,"trimVersionSuffix");d();d();d();var bg=new Ht("CopilotMCP");d();d();d();d();var eo;(function(e){e.assertEqual=i=>i;function t(i){}o(t,"assertIs"),e.assertIs=t;function r(i){throw new Error}o(r,"assertNever"),e.assertNever=r,e.arrayToEnum=i=>{let s={};for(let a of i)s[a]=a;return s},e.getValidEnumValues=i=>{let s=e.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),a={};for(let l of s)a[l]=i[l];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},e.find=(i,s)=>{for(let a of i)if(s(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}o(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(eo||(eo={}));var Fae;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Fae||(Fae={}));var kr=eo.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),BA=o(e=>{switch(typeof e){case"undefined":return kr.undefined;case"string":return kr.string;case"number":return isNaN(e)?kr.nan:kr.number;case"boolean":return kr.boolean;case"function":return kr.function;case"bigint":return kr.bigint;case"symbol":return kr.symbol;case"object":return Array.isArray(e)?kr.array:e===null?kr.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?kr.promise:typeof Map<"u"&&e instanceof Map?kr.map:typeof Set<"u"&&e instanceof Set?kr.set:typeof Date<"u"&&e instanceof Date?kr.date:kr.object;default:return kr.unknown}},"getParsedType"),Gt=eo.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),M6t=o(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),wf=class e extends Error{static{o(this,"ZodError")}get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(s){return s.message},n={_errors:[]},i=o(s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let l=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(r(a))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}},"processError");return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,eo.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};wf.create=e=>new wf(e);var J6=o((e,t)=>{let r;switch(e.code){case Gt.invalid_type:e.received===kr.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Gt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,eo.jsonStringifyReplacer)}`;break;case Gt.unrecognized_keys:r=`Unrecognized key(s) in object: ${eo.joinValues(e.keys,", ")}`;break;case Gt.invalid_union:r="Invalid input";break;case Gt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${eo.joinValues(e.options)}`;break;case Gt.invalid_enum_value:r=`Invalid enum value. Expected ${eo.joinValues(e.options)}, received '${e.received}'`;break;case Gt.invalid_arguments:r="Invalid function arguments";break;case Gt.invalid_return_type:r="Invalid function return type";break;case Gt.invalid_date:r="Invalid date";break;case Gt.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:eo.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Gt.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case Gt.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case Gt.custom:r="Invalid input";break;case Gt.invalid_intersection_types:r="Intersection results could not be merged";break;case Gt.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Gt.not_finite:r="Number must be finite";break;default:r=t.defaultError,eo.assertNever(e)}return{message:r}},"errorMap"),HPe=J6;function O6t(e){HPe=e}o(O6t,"setErrorMap");function TW(){return HPe}o(TW,"getErrorMap");var wW=o(e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,s=[...r,...i.path||[]],a={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let l="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)l=u(a,{data:t,defaultError:l}).message;return{...i,path:s,message:l}},"makeIssue"),U6t=[];function xr(e,t){let r=TW(),n=wW({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===J6?void 0:J6].filter(i=>!!i)});e.common.issues.push(n)}o(xr,"addIssueToContext");var qc=class e{static{o(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return Fn;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let s=await i.key,a=await i.value;n.push({key:s,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return Fn;s.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[s.value]=a.value)}return{status:t.value,value:n}}},Fn=Object.freeze({status:"aborted"}),K6=o(e=>({status:"dirty",value:e}),"DIRTY"),b0=o(e=>({status:"valid",value:e}),"OK"),Nae=o(e=>e.status==="aborted","isAborted"),Lae=o(e=>e.status==="dirty","isDirty"),ev=o(e=>e.status==="valid","isValid"),xk=o(e=>typeof Promise<"u"&&e instanceof Promise,"isAsync");function _W(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)}o(_W,"__classPrivateFieldGet");function jPe(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r}o(jPe,"__classPrivateFieldSet");var Gr;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Gr||(Gr={}));var yk,Ck,Zd=class{static{o(this,"ParseInputLazyPath")}constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},qPe=o((e,t)=>{if(ev(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new wf(e.common.issues);return this._error=r,this._error}}},"handleResult");function Jn(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:o((a,l)=>{var c,u;let{message:f}=e;return a.code==="invalid_enum_value"?{message:f??l.defaultError}:typeof l.data>"u"?{message:(c=f??n)!==null&&c!==void 0?c:l.defaultError}:a.code!=="invalid_type"?{message:l.defaultError}:{message:(u=f??r)!==null&&u!==void 0?u:l.defaultError}},"customMap"),description:i}}o(Jn,"processCreateParams");var Zn=class{static{o(this,"ZodType")}get description(){return this._def.description}_getType(t){return BA(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:BA(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new qc,ctx:{common:t.parent.common,data:t.data,parsedType:BA(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(xk(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;let i={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:BA(t)},s=this._parseSync({data:t,path:i.path,parent:i});return qPe(i,s)}"~validate"(t){var r,n;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:BA(t)};if(!this["~standard"].async)try{let s=this._parseSync({data:t,path:[],parent:i});return ev(s)?{value:s.value}:{issues:i.common.issues}}catch(s){!((n=(r=s?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:i}).then(s=>ev(s)?{value:s.value}:{issues:i.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:BA(t)},i=this._parse({data:t,path:n.path,parent:n}),s=await(xk(i)?i:Promise.resolve(i));return qPe(n,s)}refine(t,r){let n=o(i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r,"getIssueProperties");return this._refinement((i,s)=>{let a=t(i),l=o(()=>s.addIssue({code:Gt.custom,...n(i)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(l(),!1)):a?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new _f({schema:this,typeName:Sn.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:o(r=>this["~validate"](r),"validate")}}optional(){return Jd.create(this,this._def)}nullable(){return Ig.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return PA.create(this)}promise(){return CC.create(this,this._def)}or(t){return av.create([this,t],this._def)}and(t){return lv.create(this,t,this._def)}transform(t){return new _f({...Jn(this._def),schema:this,typeName:Sn.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new mv({...Jn(this._def),innerType:this,defaultValue:r,typeName:Sn.ZodDefault})}brand(){return new vk({typeName:Sn.ZodBranded,type:this,...Jn(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new hv({...Jn(this._def),innerType:this,catchValue:r,typeName:Sn.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return bk.create(this,t)}readonly(){return pv.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},q6t=/^c[^\s-]{8,}$/i,W6t=/^[0-9a-z]+$/,G6t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,H6t=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,j6t=/^[a-z0-9_-]{21}$/i,V6t=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$6t=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,z6t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Y6t="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Pae,K6t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,J6t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Z6t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,X6t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,e9t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,t9t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,VPe="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",r9t=new RegExp(`^${VPe}$`);function $Pe(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}o($Pe,"timeRegexSource");function n9t(e){return new RegExp(`^${$Pe(e)}$`)}o(n9t,"timeRegex");function zPe(e){let t=`${VPe}T${$Pe(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}o(zPe,"datetimeRegex");function i9t(e,t){return!!((t==="v4"||!t)&&K6t.test(e)||(t==="v6"||!t)&&Z6t.test(e))}o(i9t,"isValidIP");function o9t(e,t){if(!V6t.test(e))return!1;try{let[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||!i.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}o(o9t,"isValidJWT");function s9t(e,t){return!!((t==="v4"||!t)&&J6t.test(e)||(t==="v6"||!t)&&X6t.test(e))}o(s9t,"isValidCidr");var AC=class e extends Zn{static{o(this,"ZodString")}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==kr.string){let s=this._getOrReturnCtx(t);return xr(s,{code:Gt.invalid_type,expected:kr.string,received:s.parsedType}),Fn}let n=new qc,i;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let a=t.data.length>s.value,l=t.data.length<s.value;(a||l)&&(i=this._getOrReturnCtx(t,i),a?xr(i,{code:Gt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&xr(i,{code:Gt.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")z6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"email",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Pae||(Pae=new RegExp(Y6t,"u")),Pae.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"emoji",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")H6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"uuid",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")j6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"nanoid",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")q6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"cuid",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")W6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"cuid2",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")G6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"ulid",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),xr(i,{validation:"url",code:Gt.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"regex",code:Gt.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?zPe(s).test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?r9t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?n9t(s).test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?$6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"duration",code:Gt.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?i9t(t.data,s.version)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"ip",code:Gt.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?o9t(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"jwt",code:Gt.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?s9t(t.data,s.version)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"cidr",code:Gt.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?e9t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"base64",code:Gt.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?t9t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"base64url",code:Gt.invalid_string,message:s.message}),n.dirty()):eo.assertNever(s);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:Gt.invalid_string,...Gr.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Gr.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Gr.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Gr.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Gr.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Gr.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Gr.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Gr.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Gr.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Gr.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Gr.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Gr.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Gr.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Gr.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(r=t?.offset)!==null&&r!==void 0?r:!1,local:(n=t?.local)!==null&&n!==void 0?n:!1,...Gr.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Gr.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Gr.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Gr.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Gr.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Gr.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Gr.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Gr.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Gr.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Gr.errToObj(r)})}nonempty(t){return this.min(1,Gr.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};AC.create=e=>{var t;return new AC({checks:[],typeName:Sn.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Jn(e)})};function a9t(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,s=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}o(a9t,"floatSafeRemainder");var tv=class e extends Zn{static{o(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==kr.number){let s=this._getOrReturnCtx(t);return xr(s,{code:Gt.invalid_type,expected:kr.number,received:s.parsedType}),Fn}let n,i=new qc;for(let s of this._def.checks)s.kind==="int"?eo.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?a9t(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.not_finite,message:s.message}),i.dirty()):eo.assertNever(s);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Gr.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Gr.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Gr.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Gr.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Gr.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Gr.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Gr.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Gr.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Gr.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Gr.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Gr.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Gr.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Gr.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Gr.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&eo.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};tv.create=e=>new tv({checks:[],typeName:Sn.ZodNumber,coerce:e?.coerce||!1,...Jn(e)});var rv=class e extends Zn{static{o(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==kr.bigint)return this._getInvalidInput(t);let n,i=new qc;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):eo.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return xr(r,{code:Gt.invalid_type,expected:kr.bigint,received:r.parsedType}),Fn}gte(t,r){return this.setLimit("min",t,!0,Gr.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Gr.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Gr.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Gr.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Gr.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Gr.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Gr.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Gr.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Gr.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Gr.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};rv.create=e=>{var t;return new rv({checks:[],typeName:Sn.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Jn(e)})};var nv=class extends Zn{static{o(this,"ZodBoolean")}_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==kr.boolean){let n=this._getOrReturnCtx(t);return xr(n,{code:Gt.invalid_type,expected:kr.boolean,received:n.parsedType}),Fn}return b0(t.data)}};nv.create=e=>new nv({typeName:Sn.ZodBoolean,coerce:e?.coerce||!1,...Jn(e)});var iv=class e extends Zn{static{o(this,"ZodDate")}_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==kr.date){let s=this._getOrReturnCtx(t);return xr(s,{code:Gt.invalid_type,expected:kr.date,received:s.parsedType}),Fn}if(isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return xr(s,{code:Gt.invalid_date}),Fn}let n=new qc,i;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):eo.assertNever(s);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Gr.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Gr.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};iv.create=e=>new iv({checks:[],coerce:e?.coerce||!1,typeName:Sn.ZodDate,...Jn(e)});var Z6=class extends Zn{static{o(this,"ZodSymbol")}_parse(t){if(this._getType(t)!==kr.symbol){let n=this._getOrReturnCtx(t);return xr(n,{code:Gt.invalid_type,expected:kr.symbol,received:n.parsedType}),Fn}return b0(t.data)}};Z6.create=e=>new Z6({typeName:Sn.ZodSymbol,...Jn(e)});var ov=class extends Zn{static{o(this,"ZodUndefined")}_parse(t){if(this._getType(t)!==kr.undefined){let n=this._getOrReturnCtx(t);return xr(n,{code:Gt.invalid_type,expected:kr.undefined,received:n.parsedType}),Fn}return b0(t.data)}};ov.create=e=>new ov({typeName:Sn.ZodUndefined,...Jn(e)});var sv=class extends Zn{static{o(this,"ZodNull")}_parse(t){if(this._getType(t)!==kr.null){let n=this._getOrReturnCtx(t);return xr(n,{code:Gt.invalid_type,expected:kr.null,received:n.parsedType}),Fn}return b0(t.data)}};sv.create=e=>new sv({typeName:Sn.ZodNull,...Jn(e)});var yC=class extends Zn{static{o(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(t){return b0(t.data)}};yC.create=e=>new yC({typeName:Sn.ZodAny,...Jn(e)});var DA=class extends Zn{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(t){return b0(t.data)}};DA.create=e=>new DA({typeName:Sn.ZodUnknown,...Jn(e)});var Ih=class extends Zn{static{o(this,"ZodNever")}_parse(t){let r=this._getOrReturnCtx(t);return xr(r,{code:Gt.invalid_type,expected:kr.never,received:r.parsedType}),Fn}};Ih.create=e=>new Ih({typeName:Sn.ZodNever,...Jn(e)});var X6=class extends Zn{static{o(this,"ZodVoid")}_parse(t){if(this._getType(t)!==kr.undefined){let n=this._getOrReturnCtx(t);return xr(n,{code:Gt.invalid_type,expected:kr.void,received:n.parsedType}),Fn}return b0(t.data)}};X6.create=e=>new X6({typeName:Sn.ZodVoid,...Jn(e)});var PA=class e extends Zn{static{o(this,"ZodArray")}_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==kr.array)return xr(r,{code:Gt.invalid_type,expected:kr.array,received:r.parsedType}),Fn;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,l=r.data.length<i.exactLength.value;(a||l)&&(xr(r,{code:a?Gt.too_big:Gt.too_small,minimum:l?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(xr(r,{code:Gt.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(xr(r,{code:Gt.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,l)=>i.type._parseAsync(new Zd(r,a,r.path,l)))).then(a=>qc.mergeArray(n,a));let s=[...r.data].map((a,l)=>i.type._parseSync(new Zd(r,a,r.path,l)));return qc.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:Gr.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:Gr.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:Gr.toString(r)}})}nonempty(t){return this.min(1,t)}};PA.create=(e,t)=>new PA({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Sn.ZodArray,...Jn(t)});function Y6(e){if(e instanceof Cu){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Jd.create(Y6(n))}return new Cu({...e._def,shape:o(()=>t,"shape")})}else return e instanceof PA?new PA({...e._def,type:Y6(e.element)}):e instanceof Jd?Jd.create(Y6(e.unwrap())):e instanceof Ig?Ig.create(Y6(e.unwrap())):e instanceof Eg?Eg.create(e.items.map(t=>Y6(t))):e}o(Y6,"deepPartialify");var Cu=class e extends Zn{static{o(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=eo.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==kr.object){let u=this._getOrReturnCtx(t);return xr(u,{code:Gt.invalid_type,expected:kr.object,received:u.parsedType}),Fn}let{status:n,ctx:i}=this._processInputParams(t),{shape:s,keys:a}=this._getCached(),l=[];if(!(this._def.catchall instanceof Ih&&this._def.unknownKeys==="strip"))for(let u in i.data)a.includes(u)||l.push(u);let c=[];for(let u of a){let f=s[u],m=i.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new Zd(i,m,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Ih){let u=this._def.unknownKeys;if(u==="passthrough")for(let f of l)c.push({key:{status:"valid",value:f},value:{status:"valid",value:i.data[f]}});else if(u==="strict")l.length>0&&(xr(i,{code:Gt.unrecognized_keys,keys:l}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let f of l){let m=i.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new Zd(i,m,i.path,f)),alwaysSet:f in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let f of c){let m=await f.key,h=await f.value;u.push({key:m,value:h,alwaysSet:f.alwaysSet})}return u}).then(u=>qc.mergeObjectSync(n,u)):qc.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return Gr.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:o((r,n)=>{var i,s,a,l;let c=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(l=Gr.errToObj(t).message)!==null&&l!==void 0?l:c}:{message:c}},"errorMap")}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:o(()=>({...this._def.shape(),...t}),"shape")})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:o(()=>({...this._def.shape(),...t._def.shape()}),"shape"),typeName:Sn.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};return eo.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new e({...this._def,shape:o(()=>r,"shape")})}omit(t){let r={};return eo.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new e({...this._def,shape:o(()=>r,"shape")})}deepPartial(){return Y6(this)}partial(t){let r={};return eo.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}),new e({...this._def,shape:o(()=>r,"shape")})}required(t){let r={};return eo.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Jd;)s=s._def.innerType;r[n]=s}}),new e({...this._def,shape:o(()=>r,"shape")})}keyof(){return YPe(eo.objectKeys(this.shape))}};Cu.create=(e,t)=>new Cu({shape:o(()=>e,"shape"),unknownKeys:"strip",catchall:Ih.create(),typeName:Sn.ZodObject,...Jn(t)});Cu.strictCreate=(e,t)=>new Cu({shape:o(()=>e,"shape"),unknownKeys:"strict",catchall:Ih.create(),typeName:Sn.ZodObject,...Jn(t)});Cu.lazycreate=(e,t)=>new Cu({shape:e,unknownKeys:"strip",catchall:Ih.create(),typeName:Sn.ZodObject,...Jn(t)});var av=class extends Zn{static{o(this,"ZodUnion")}_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(s){for(let l of s)if(l.result.status==="valid")return l.result;for(let l of s)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;let a=s.map(l=>new wf(l.ctx.common.issues));return xr(r,{code:Gt.invalid_union,unionErrors:a}),Fn}if(o(i,"handleResults"),r.common.async)return Promise.all(n.map(async s=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let s,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},f=c._parseSync({data:r.data,path:r.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let l=a.map(c=>new wf(c));return xr(r,{code:Gt.invalid_union,unionErrors:l}),Fn}}get options(){return this._def.options}};av.create=(e,t)=>new av({options:e,typeName:Sn.ZodUnion,...Jn(t)});var RA=o(e=>e instanceof cv?RA(e.schema):e instanceof _f?RA(e.innerType()):e instanceof uv?[e.value]:e instanceof fv?e.options:e instanceof dv?eo.objectValues(e.enum):e instanceof mv?RA(e._def.innerType):e instanceof ov?[void 0]:e instanceof sv?[null]:e instanceof Jd?[void 0,...RA(e.unwrap())]:e instanceof Ig?[null,...RA(e.unwrap())]:e instanceof vk||e instanceof pv?RA(e.unwrap()):e instanceof hv?RA(e._def.innerType):[],"getDiscriminator"),SW=class e extends Zn{static{o(this,"ZodDiscriminatedUnion")}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==kr.object)return xr(r,{code:Gt.invalid_type,expected:kr.object,received:r.parsedType}),Fn;let n=this.discriminator,i=r.data[n],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(xr(r,{code:Gt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Fn)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let s of r){let a=RA(s.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let l of a){if(i.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);i.set(l,s)}}return new e({typeName:Sn.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...Jn(n)})}};function Qae(e,t){let r=BA(e),n=BA(t);if(e===t)return{valid:!0,data:e};if(r===kr.object&&n===kr.object){let i=eo.objectKeys(t),s=eo.objectKeys(e).filter(l=>i.indexOf(l)!==-1),a={...e,...t};for(let l of s){let c=Qae(e[l],t[l]);if(!c.valid)return{valid:!1};a[l]=c.data}return{valid:!0,data:a}}else if(r===kr.array&&n===kr.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let s=0;s<e.length;s++){let a=e[s],l=t[s],c=Qae(a,l);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===kr.date&&n===kr.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}o(Qae,"mergeValues");var lv=class extends Zn{static{o(this,"ZodIntersection")}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=o((s,a)=>{if(Nae(s)||Nae(a))return Fn;let l=Qae(s.value,a.value);return l.valid?((Lae(s)||Lae(a))&&r.dirty(),{status:r.value,value:l.data}):(xr(n,{code:Gt.invalid_intersection_types}),Fn)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};lv.create=(e,t,r)=>new lv({left:e,right:t,typeName:Sn.ZodIntersection,...Jn(r)});var Eg=class e extends Zn{static{o(this,"ZodTuple")}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==kr.array)return xr(n,{code:Gt.invalid_type,expected:kr.array,received:n.parsedType}),Fn;if(n.data.length<this._def.items.length)return xr(n,{code:Gt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Fn;!this._def.rest&&n.data.length>this._def.items.length&&(xr(n,{code:Gt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((a,l)=>{let c=this._def.items[l]||this._def.rest;return c?c._parse(new Zd(n,a,n.path,l)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>qc.mergeArray(r,a)):qc.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Eg.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Eg({items:e,typeName:Sn.ZodTuple,rest:null,...Jn(t)})};var kW=class e extends Zn{static{o(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==kr.object)return xr(n,{code:Gt.invalid_type,expected:kr.object,received:n.parsedType}),Fn;let i=[],s=this._def.keyType,a=this._def.valueType;for(let l in n.data)i.push({key:s._parse(new Zd(n,l,n.path,l)),value:a._parse(new Zd(n,n.data[l],n.path,l)),alwaysSet:l in n.data});return n.common.async?qc.mergeObjectAsync(r,i):qc.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Zn?new e({keyType:t,valueType:r,typeName:Sn.ZodRecord,...Jn(n)}):new e({keyType:AC.create(),valueType:t,typeName:Sn.ZodRecord,...Jn(r)})}},e9=class extends Zn{static{o(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==kr.map)return xr(n,{code:Gt.invalid_type,expected:kr.map,received:n.parsedType}),Fn;let i=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([l,c],u)=>({key:i._parse(new Zd(n,l,n.path,[u,"key"])),value:s._parse(new Zd(n,c,n.path,[u,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return Fn;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),l.set(u.value,f.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let c of a){let u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return Fn;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),l.set(u.value,f.value)}return{status:r.value,value:l}}}};e9.create=(e,t,r)=>new e9({valueType:t,keyType:e,typeName:Sn.ZodMap,...Jn(r)});var t9=class e extends Zn{static{o(this,"ZodSet")}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==kr.set)return xr(n,{code:Gt.invalid_type,expected:kr.set,received:n.parsedType}),Fn;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(xr(n,{code:Gt.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(xr(n,{code:Gt.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function a(c){let u=new Set;for(let f of c){if(f.status==="aborted")return Fn;f.status==="dirty"&&r.dirty(),u.add(f.value)}return{status:r.value,value:u}}o(a,"finalizeSet");let l=[...n.data.values()].map((c,u)=>s._parse(new Zd(n,c,n.path,u)));return n.common.async?Promise.all(l).then(c=>a(c)):a(l)}min(t,r){return new e({...this._def,minSize:{value:t,message:Gr.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:Gr.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};t9.create=(e,t)=>new t9({valueType:e,minSize:null,maxSize:null,typeName:Sn.ZodSet,...Jn(t)});var RW=class e extends Zn{static{o(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==kr.function)return xr(r,{code:Gt.invalid_type,expected:kr.function,received:r.parsedType}),Fn;function n(l,c){return wW({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,TW(),J6].filter(u=>!!u),issueData:{code:Gt.invalid_arguments,argumentsError:c}})}o(n,"makeArgsIssue");function i(l,c){return wW({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,TW(),J6].filter(u=>!!u),issueData:{code:Gt.invalid_return_type,returnTypeError:c}})}o(i,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof CC){let l=this;return b0(async function(...c){let u=new wf([]),f=await l._def.args.parseAsync(c,s).catch(p=>{throw u.addIssue(n(c,p)),u}),m=await Reflect.apply(a,this,f);return await l._def.returns._def.type.parseAsync(m,s).catch(p=>{throw u.addIssue(i(m,p)),u})})}else{let l=this;return b0(function(...c){let u=l._def.args.safeParse(c,s);if(!u.success)throw new wf([n(c,u.error)]);let f=Reflect.apply(a,this,u.data),m=l._def.returns.safeParse(f,s);if(!m.success)throw new wf([i(f,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Eg.create(t).rest(DA.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Eg.create([]).rest(DA.create()),returns:r||DA.create(),typeName:Sn.ZodFunction,...Jn(n)})}},cv=class extends Zn{static{o(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};cv.create=(e,t)=>new cv({getter:e,typeName:Sn.ZodLazy,...Jn(t)});var uv=class extends Zn{static{o(this,"ZodLiteral")}_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return xr(r,{received:r.data,code:Gt.invalid_literal,expected:this._def.value}),Fn}return{status:"valid",value:t.data}}get value(){return this._def.value}};uv.create=(e,t)=>new uv({value:e,typeName:Sn.ZodLiteral,...Jn(t)});function YPe(e,t){return new fv({values:e,typeName:Sn.ZodEnum,...Jn(t)})}o(YPe,"createZodEnum");var fv=class e extends Zn{static{o(this,"ZodEnum")}constructor(){super(...arguments),yk.set(this,void 0)}_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return xr(r,{expected:eo.joinValues(n),received:r.parsedType,code:Gt.invalid_type}),Fn}if(_W(this,yk,"f")||jPe(this,yk,new Set(this._def.values),"f"),!_W(this,yk,"f").has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return xr(r,{received:r.data,code:Gt.invalid_enum_value,options:n}),Fn}return b0(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};yk=new WeakMap;fv.create=YPe;var dv=class extends Zn{static{o(this,"ZodNativeEnum")}constructor(){super(...arguments),Ck.set(this,void 0)}_parse(t){let r=eo.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==kr.string&&n.parsedType!==kr.number){let i=eo.objectValues(r);return xr(n,{expected:eo.joinValues(i),received:n.parsedType,code:Gt.invalid_type}),Fn}if(_W(this,Ck,"f")||jPe(this,Ck,new Set(eo.getValidEnumValues(this._def.values)),"f"),!_W(this,Ck,"f").has(t.data)){let i=eo.objectValues(r);return xr(n,{received:n.data,code:Gt.invalid_enum_value,options:i}),Fn}return b0(t.data)}get enum(){return this._def.values}};Ck=new WeakMap;dv.create=(e,t)=>new dv({values:e,typeName:Sn.ZodNativeEnum,...Jn(t)});var CC=class extends Zn{static{o(this,"ZodPromise")}unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==kr.promise&&r.common.async===!1)return xr(r,{code:Gt.invalid_type,expected:kr.promise,received:r.parsedType}),Fn;let n=r.parsedType===kr.promise?r.data:Promise.resolve(r.data);return b0(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};CC.create=(e,t)=>new CC({type:e,typeName:Sn.ZodPromise,...Jn(t)});var _f=class extends Zn{static{o(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Sn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o(a=>{xr(n,a),a.fatal?r.abort():r.dirty()},"addIssue"),get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let a=i.transform(n.data,s);if(n.common.async)return Promise.resolve(a).then(async l=>{if(r.value==="aborted")return Fn;let c=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return c.status==="aborted"?Fn:c.status==="dirty"||r.value==="dirty"?K6(c.value):c});{if(r.value==="aborted")return Fn;let l=this._def.schema._parseSync({data:a,path:n.path,parent:n});return l.status==="aborted"?Fn:l.status==="dirty"||r.value==="dirty"?K6(l.value):l}}if(i.type==="refinement"){let a=o(l=>{let c=i.refinement(l,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l},"executeRefinement");if(n.common.async===!1){let l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?Fn:(l.status==="dirty"&&r.dirty(),a(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?Fn:(l.status==="dirty"&&r.dirty(),a(l.value).then(()=>({status:r.value,value:l.value}))))}if(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ev(a))return a;let l=i.transform(a.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>ev(a)?Promise.resolve(i.transform(a.value,s)).then(l=>({status:r.value,value:l})):a);eo.assertNever(i)}};_f.create=(e,t,r)=>new _f({schema:e,typeName:Sn.ZodEffects,effect:t,...Jn(r)});_f.createWithPreprocess=(e,t,r)=>new _f({schema:t,effect:{type:"preprocess",transform:e},typeName:Sn.ZodEffects,...Jn(r)});var Jd=class extends Zn{static{o(this,"ZodOptional")}_parse(t){return this._getType(t)===kr.undefined?b0(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Jd.create=(e,t)=>new Jd({innerType:e,typeName:Sn.ZodOptional,...Jn(t)});var Ig=class extends Zn{static{o(this,"ZodNullable")}_parse(t){return this._getType(t)===kr.null?b0(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ig.create=(e,t)=>new Ig({innerType:e,typeName:Sn.ZodNullable,...Jn(t)});var mv=class extends Zn{static{o(this,"ZodDefault")}_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===kr.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};mv.create=(e,t)=>new mv({innerType:e,typeName:Sn.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Jn(t)});var hv=class extends Zn{static{o(this,"ZodCatch")}_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return xk(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new wf(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new wf(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};hv.create=(e,t)=>new hv({innerType:e,typeName:Sn.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Jn(t)});var r9=class extends Zn{static{o(this,"ZodNaN")}_parse(t){if(this._getType(t)!==kr.nan){let n=this._getOrReturnCtx(t);return xr(n,{code:Gt.invalid_type,expected:kr.nan,received:n.parsedType}),Fn}return{status:"valid",value:t.data}}};r9.create=e=>new r9({typeName:Sn.ZodNaN,...Jn(e)});var l9t=Symbol("zod_brand"),vk=class extends Zn{static{o(this,"ZodBranded")}_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},bk=class e extends Zn{static{o(this,"ZodPipeline")}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return o(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Fn:s.status==="dirty"?(r.dirty(),K6(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Fn:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:Sn.ZodPipeline})}},pv=class extends Zn{static{o(this,"ZodReadonly")}_parse(t){let r=this._def.innerType._parse(t),n=o(i=>(ev(i)&&(i.value=Object.freeze(i.value)),i),"freeze");return xk(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};pv.create=(e,t)=>new pv({innerType:e,typeName:Sn.ZodReadonly,...Jn(t)});function WPe(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}o(WPe,"cleanParams");function KPe(e,t={},r){return e?yC.create().superRefine((n,i)=>{var s,a;let l=e(n);if(l instanceof Promise)return l.then(c=>{var u,f;if(!c){let m=WPe(t,n),h=(f=(u=m.fatal)!==null&&u!==void 0?u:r)!==null&&f!==void 0?f:!0;i.addIssue({code:"custom",...m,fatal:h})}});if(!l){let c=WPe(t,n),u=(a=(s=c.fatal)!==null&&s!==void 0?s:r)!==null&&a!==void 0?a:!0;i.addIssue({code:"custom",...c,fatal:u})}}):yC.create()}o(KPe,"custom");var c9t={object:Cu.lazycreate},Sn;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Sn||(Sn={}));var u9t=o((e,t={message:`Input not instance of ${e.name}`})=>KPe(r=>r instanceof e,t),"instanceOfType"),JPe=AC.create,ZPe=tv.create,f9t=r9.create,d9t=rv.create,XPe=nv.create,m9t=iv.create,h9t=Z6.create,p9t=ov.create,g9t=sv.create,A9t=yC.create,y9t=DA.create,C9t=Ih.create,x9t=X6.create,v9t=PA.create,b9t=Cu.create,E9t=Cu.strictCreate,I9t=av.create,T9t=SW.create,w9t=lv.create,_9t=Eg.create,S9t=kW.create,k9t=e9.create,R9t=t9.create,B9t=RW.create,D9t=cv.create,P9t=uv.create,F9t=fv.create,N9t=dv.create,L9t=CC.create,GPe=_f.create,Q9t=Jd.create,M9t=Ig.create,O9t=_f.createWithPreprocess,U9t=bk.create,q9t=o(()=>JPe().optional(),"ostring"),W9t=o(()=>ZPe().optional(),"onumber"),G9t=o(()=>XPe().optional(),"oboolean"),H9t={string:o(e=>AC.create({...e,coerce:!0}),"string"),number:o(e=>tv.create({...e,coerce:!0}),"number"),boolean:o(e=>nv.create({...e,coerce:!0}),"boolean"),bigint:o(e=>rv.create({...e,coerce:!0}),"bigint"),date:o(e=>iv.create({...e,coerce:!0}),"date")},j9t=Fn,xe=Object.freeze({__proto__:null,defaultErrorMap:J6,setErrorMap:O6t,getErrorMap:TW,makeIssue:wW,EMPTY_PATH:U6t,addIssueToContext:xr,ParseStatus:qc,INVALID:Fn,DIRTY:K6,OK:b0,isAborted:Nae,isDirty:Lae,isValid:ev,isAsync:xk,get util(){return eo},get objectUtil(){return Fae},ZodParsedType:kr,getParsedType:BA,ZodType:Zn,datetimeRegex:zPe,ZodString:AC,ZodNumber:tv,ZodBigInt:rv,ZodBoolean:nv,ZodDate:iv,ZodSymbol:Z6,ZodUndefined:ov,ZodNull:sv,ZodAny:yC,ZodUnknown:DA,ZodNever:Ih,ZodVoid:X6,ZodArray:PA,ZodObject:Cu,ZodUnion:av,ZodDiscriminatedUnion:SW,ZodIntersection:lv,ZodTuple:Eg,ZodRecord:kW,ZodMap:e9,ZodSet:t9,ZodFunction:RW,ZodLazy:cv,ZodLiteral:uv,ZodEnum:fv,ZodNativeEnum:dv,ZodPromise:CC,ZodEffects:_f,ZodTransformer:_f,ZodOptional:Jd,ZodNullable:Ig,ZodDefault:mv,ZodCatch:hv,ZodNaN:r9,BRAND:l9t,ZodBranded:vk,ZodPipeline:bk,ZodReadonly:pv,custom:KPe,Schema:Zn,ZodSchema:Zn,late:c9t,get ZodFirstPartyTypeKind(){return Sn},coerce:H9t,any:A9t,array:v9t,bigint:d9t,boolean:XPe,date:m9t,discriminatedUnion:T9t,effect:GPe,enum:F9t,function:B9t,instanceof:u9t,intersection:w9t,lazy:D9t,literal:P9t,map:k9t,nan:f9t,nativeEnum:N9t,never:C9t,null:g9t,nullable:M9t,number:ZPe,object:b9t,oboolean:G9t,onumber:W9t,optional:Q9t,ostring:q9t,pipeline:U9t,preprocess:O9t,promise:L9t,record:S9t,set:R9t,strictObject:E9t,string:JPe,symbol:h9t,transformer:GPe,tuple:_9t,undefined:p9t,union:I9t,unknown:y9t,void:x9t,NEVER:j9t,ZodIssueCode:Gt,quotelessJson:M6t,ZodError:wf});var Mae="2025-03-26",eFe=[Mae,"2024-11-05","2024-10-07"],BW="2.0",tFe=xe.union([xe.string(),xe.number().int()]),rFe=xe.string(),V9t=xe.object({progressToken:xe.optional(tFe)}).passthrough(),Th=xe.object({_meta:xe.optional(V9t)}).passthrough(),Sf=xe.object({method:xe.string(),params:xe.optional(Th)}),Ek=xe.object({_meta:xe.optional(xe.object({}).passthrough())}).passthrough(),Tg=xe.object({method:xe.string(),params:xe.optional(Ek)}),wh=xe.object({_meta:xe.optional(xe.object({}).passthrough())}).passthrough(),DW=xe.union([xe.string(),xe.number().int()]),nFe=xe.object({jsonrpc:xe.literal(BW),id:DW}).merge(Sf).strict(),iFe=o(e=>nFe.safeParse(e).success,"isJSONRPCRequest"),oFe=xe.object({jsonrpc:xe.literal(BW)}).merge(Tg).strict(),sFe=o(e=>oFe.safeParse(e).success,"isJSONRPCNotification"),aFe=xe.object({jsonrpc:xe.literal(BW),id:DW,result:wh}).strict(),Oae=o(e=>aFe.safeParse(e).success,"isJSONRPCResponse"),xC;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"})(xC||(xC={}));var lFe=xe.object({jsonrpc:xe.literal(BW),id:DW,error:xe.object({code:xe.number().int(),message:xe.string(),data:xe.optional(xe.unknown())})}).strict(),cFe=o(e=>lFe.safeParse(e).success,"isJSONRPCError"),uFe=xe.union([nFe,oFe,aFe,lFe]),Av=wh.strict(),PW=Tg.extend({method:xe.literal("notifications/cancelled"),params:Ek.extend({requestId:DW,reason:xe.string().optional()})}),fFe=xe.object({name:xe.string(),version:xe.string()}).passthrough(),$9t=xe.object({experimental:xe.optional(xe.object({}).passthrough()),sampling:xe.optional(xe.object({}).passthrough()),roots:xe.optional(xe.object({listChanged:xe.optional(xe.boolean())}).passthrough())}).passthrough(),z9t=Sf.extend({method:xe.literal("initialize"),params:Th.extend({protocolVersion:xe.string(),capabilities:$9t,clientInfo:fFe})});var Y9t=xe.object({experimental:xe.optional(xe.object({}).passthrough()),logging:xe.optional(xe.object({}).passthrough()),completions:xe.optional(xe.object({}).passthrough()),prompts:xe.optional(xe.object({listChanged:xe.optional(xe.boolean())}).passthrough()),resources:xe.optional(xe.object({subscribe:xe.optional(xe.boolean()),listChanged:xe.optional(xe.boolean())}).passthrough()),tools:xe.optional(xe.object({listChanged:xe.optional(xe.boolean())}).passthrough())}).passthrough(),Uae=wh.extend({protocolVersion:xe.string(),capabilities:Y9t,serverInfo:fFe,instructions:xe.optional(xe.string())}),K9t=Tg.extend({method:xe.literal("notifications/initialized")});var FW=Sf.extend({method:xe.literal("ping")}),J9t=xe.object({progress:xe.number(),total:xe.optional(xe.number())}).passthrough(),NW=Tg.extend({method:xe.literal("notifications/progress"),params:Ek.merge(J9t).extend({progressToken:tFe})}),LW=Sf.extend({params:Th.extend({cursor:xe.optional(rFe)}).optional()}),QW=wh.extend({nextCursor:xe.optional(rFe)}),dFe=xe.object({uri:xe.string(),mimeType:xe.optional(xe.string())}).passthrough(),mFe=dFe.extend({text:xe.string()}),hFe=dFe.extend({blob:xe.string().base64()}),Z9t=xe.object({uri:xe.string(),name:xe.string(),description:xe.optional(xe.string()),mimeType:xe.optional(xe.string())}).passthrough(),X9t=xe.object({uriTemplate:xe.string(),name:xe.string(),description:xe.optional(xe.string()),mimeType:xe.optional(xe.string())}).passthrough(),eTt=LW.extend({method:xe.literal("resources/list")}),qae=QW.extend({resources:xe.array(Z9t)}),tTt=LW.extend({method:xe.literal("resources/templates/list")}),Wae=QW.extend({resourceTemplates:xe.array(X9t)}),rTt=Sf.extend({method:xe.literal("resources/read"),params:Th.extend({uri:xe.string()})}),Gae=wh.extend({contents:xe.array(xe.union([mFe,hFe]))}),nTt=Tg.extend({method:xe.literal("notifications/resources/list_changed")}),iTt=Sf.extend({method:xe.literal("resources/subscribe"),params:Th.extend({uri:xe.string()})}),oTt=Sf.extend({method:xe.literal("resources/unsubscribe"),params:Th.extend({uri:xe.string()})}),sTt=Tg.extend({method:xe.literal("notifications/resources/updated"),params:Ek.extend({uri:xe.string()})}),aTt=xe.object({name:xe.string(),description:xe.optional(xe.string()),required:xe.optional(xe.boolean())}).passthrough(),lTt=xe.object({name:xe.string(),description:xe.optional(xe.string()),arguments:xe.optional(xe.array(aTt))}).passthrough(),cTt=LW.extend({method:xe.literal("prompts/list")}),Hae=QW.extend({prompts:xe.array(lTt)}),uTt=Sf.extend({method:xe.literal("prompts/get"),params:Th.extend({name:xe.string(),arguments:xe.optional(xe.record(xe.string()))})}),MW=xe.object({type:xe.literal("text"),text:xe.string()}).passthrough(),OW=xe.object({type:xe.literal("image"),data:xe.string().base64(),mimeType:xe.string()}).passthrough(),UW=xe.object({type:xe.literal("audio"),data:xe.string().base64(),mimeType:xe.string()}).passthrough(),pFe=xe.object({type:xe.literal("resource"),resource:xe.union([mFe,hFe])}).passthrough(),fTt=xe.object({role:xe.enum(["user","assistant"]),content:xe.union([MW,OW,UW,pFe])}).passthrough(),jae=wh.extend({description:xe.optional(xe.string()),messages:xe.array(fTt)}),dTt=Tg.extend({method:xe.literal("notifications/prompts/list_changed")}),mTt=xe.object({title:xe.optional(xe.string()),readOnlyHint:xe.optional(xe.boolean()),destructiveHint:xe.optional(xe.boolean()),idempotentHint:xe.optional(xe.boolean()),openWorldHint:xe.optional(xe.boolean())}).passthrough(),hTt=xe.object({name:xe.string(),description:xe.optional(xe.string()),inputSchema:xe.object({type:xe.literal("object"),properties:xe.optional(xe.object({}).passthrough())}).passthrough(),annotations:xe.optional(mTt)}).passthrough(),pTt=LW.extend({method:xe.literal("tools/list")}),Vae=QW.extend({tools:xe.array(hTt)}),qW=wh.extend({content:xe.array(xe.union([MW,OW,UW,pFe])),isError:xe.boolean().default(!1).optional()}),wen=qW.or(wh.extend({toolResult:xe.unknown()})),gTt=Sf.extend({method:xe.literal("tools/call"),params:Th.extend({name:xe.string(),arguments:xe.optional(xe.record(xe.unknown()))})}),ATt=Tg.extend({method:xe.literal("notifications/tools/list_changed")}),gFe=xe.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),yTt=Sf.extend({method:xe.literal("logging/setLevel"),params:Th.extend({level:gFe})}),CTt=Tg.extend({method:xe.literal("notifications/message"),params:Ek.extend({level:gFe,logger:xe.optional(xe.string()),data:xe.unknown()})}),xTt=xe.object({name:xe.string().optional()}).passthrough(),vTt=xe.object({hints:xe.optional(xe.array(xTt)),costPriority:xe.optional(xe.number().min(0).max(1)),speedPriority:xe.optional(xe.number().min(0).max(1)),intelligencePriority:xe.optional(xe.number().min(0).max(1))}).passthrough(),bTt=xe.object({role:xe.enum(["user","assistant"]),content:xe.union([MW,OW,UW])}).passthrough(),ETt=Sf.extend({method:xe.literal("sampling/createMessage"),params:Th.extend({messages:xe.array(bTt),systemPrompt:xe.optional(xe.string()),includeContext:xe.optional(xe.enum(["none","thisServer","allServers"])),temperature:xe.optional(xe.number()),maxTokens:xe.number().int(),stopSequences:xe.optional(xe.array(xe.string())),metadata:xe.optional(xe.object({}).passthrough()),modelPreferences:xe.optional(vTt)})}),ITt=wh.extend({model:xe.string(),stopReason:xe.optional(xe.enum(["endTurn","stopSequence","maxTokens"]).or(xe.string())),role:xe.enum(["user","assistant"]),content:xe.discriminatedUnion("type",[MW,OW,UW])}),TTt=xe.object({type:xe.literal("ref/resource"),uri:xe.string()}).passthrough(),wTt=xe.object({type:xe.literal("ref/prompt"),name:xe.string()}).passthrough(),_Tt=Sf.extend({method:xe.literal("completion/complete"),params:Th.extend({ref:xe.union([wTt,TTt]),argument:xe.object({name:xe.string(),value:xe.string()}).passthrough()})}),$ae=wh.extend({completion:xe.object({values:xe.array(xe.string()).max(100),total:xe.optional(xe.number().int()),hasMore:xe.optional(xe.boolean())}).passthrough()}),STt=xe.object({uri:xe.string().startsWith("file://"),name:xe.optional(xe.string())}).passthrough(),kTt=Sf.extend({method:xe.literal("roots/list")}),RTt=wh.extend({roots:xe.array(STt)}),BTt=Tg.extend({method:xe.literal("notifications/roots/list_changed")}),_en=xe.union([FW,z9t,_Tt,yTt,uTt,cTt,eTt,tTt,rTt,iTt,oTt,gTt,pTt]),Sen=xe.union([PW,NW,K9t,BTt]),ken=xe.union([Av,ITt,RTt]),Ren=xe.union([FW,ETt,kTt]),Ben=xe.union([PW,NW,CTt,sTt,nTt,ATt,dTt]),Den=xe.union([Av,Uae,$ae,jae,Hae,qae,Wae,Gae,qW,Vae]),gv=class extends Error{static{o(this,"McpError")}constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}};var DTt=6e4,WW=class{static{o(this,"Protocol")}constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(PW,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(NW,r=>{this._onprogress(r)}),this.setRequestHandler(FW,r=>({}))}_setupTimeout(t,r,n,i,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new gv(xC.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=r=>{this._onerror(r)},this._transport.onmessage=(r,n)=>{Oae(r)||cFe(r)?this._onresponse(r):iFe(r)?this._onrequest(r,n):sFe(r)?this._onnotification(r):this._onerror(new Error(`Unknown message type: ${JSON.stringify(r)}`))},await this._transport.start()}_onclose(){var t;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(t=this.onclose)===null||t===void 0||t.call(this);let n=new gv(xC.ConnectionClosed,"Connection closed");for(let i of r.values())i(n)}_onerror(t){var r;(r=this.onerror)===null||r===void 0||r.call(this,t)}_onnotification(t){var r;let n=(r=this._notificationHandlers.get(t.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(t,r){var n,i,s,a;let l=(n=this._requestHandlers.get(t.method))!==null&&n!==void 0?n:this.fallbackRequestHandler;if(l===void 0){(i=this._transport)===null||i===void 0||i.send({jsonrpc:"2.0",id:t.id,error:{code:xC.MethodNotFound,message:"Method not found"}}).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}let c=new AbortController;this._requestHandlerAbortControllers.set(t.id,c);let u={signal:c.signal,sessionId:(s=this._transport)===null||s===void 0?void 0:s.sessionId,_meta:(a=t.params)===null||a===void 0?void 0:a._meta,sendNotification:o(f=>this.notification(f,{relatedRequestId:t.id}),"sendNotification"),sendRequest:o((f,m,h)=>this.request(f,m,{...h,relatedRequestId:t.id}),"sendRequest"),authInfo:r?.authInfo,requestId:t.id};Promise.resolve().then(()=>l(t,u)).then(f=>{var m;if(!c.signal.aborted)return(m=this._transport)===null||m===void 0?void 0:m.send({result:f,jsonrpc:"2.0",id:t.id})},f=>{var m,h;if(!c.signal.aborted)return(m=this._transport)===null||m===void 0?void 0:m.send({jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(f.code)?f.code:xC.InternalError,message:(h=f.message)!==null&&h!==void 0?h:"Internal error"}})}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,i=Number(r),s=this._progressHandlers.get(i);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(i),l=this._timeoutInfo.get(i);if(l&&a&&l.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){a(c);return}s(n)}_onresponse(t){let r=Number(t.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),Oae(t))n(t);else{let i=new gv(t.error.code,t.error.message,t.error.data);n(i)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)===null||t===void 0?void 0:t.close())}request(t,r,n){let{relatedRequestId:i,resumptionToken:s,onresumptiontoken:a}=n??{};return new Promise((l,c)=>{var u,f,m,h,p;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(t.method),(f=n?.signal)===null||f===void 0||f.throwIfAborted();let g=this._requestMessageId++,x={...t,jsonrpc:"2.0",id:g};n?.onprogress&&(this._progressHandlers.set(g,n.onprogress),x.params={...t.params,_meta:{progressToken:g}});let v=o(_=>{var R;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(R=this._transport)===null||R===void 0||R.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(_)}},{relatedRequestId:i,resumptionToken:s,onresumptiontoken:a}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`))),c(_)},"cancel");this._responseHandlers.set(g,_=>{var R;if(!(!((R=n?.signal)===null||R===void 0)&&R.aborted)){if(_ instanceof Error)return c(_);try{let P=r.parse(_.result);l(P)}catch(P){c(P)}}}),(m=n?.signal)===null||m===void 0||m.addEventListener("abort",()=>{var _;v((_=n?.signal)===null||_===void 0?void 0:_.reason)});let E=(h=n?.timeout)!==null&&h!==void 0?h:DTt,b=o(()=>v(new gv(xC.RequestTimeout,"Request timed out",{timeout:E})),"timeoutHandler");this._setupTimeout(g,E,n?.maxTotalTimeout,b,(p=n?.resetTimeoutOnProgress)!==null&&p!==void 0?p:!1),this._transport.send(x,{relatedRequestId:i,resumptionToken:s,onresumptiontoken:a}).catch(_=>{this._cleanupTimeout(g),c(_)})})}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n={...t,jsonrpc:"2.0"};await this._transport.send(n,r)}setRequestHandler(t,r){let n=t.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,s)=>Promise.resolve(r(t.parse(i),s)))}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){this._notificationHandlers.set(t.shape.method.value,n=>Promise.resolve(r(t.parse(n))))}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function AFe(e,t){return Object.entries(t).reduce((r,[n,i])=>(i&&typeof i=="object"?r[n]=r[n]?{...r[n],...i}:i:r[n]=i,r),{...e})}o(AFe,"mergeCapabilities");var GW=class extends WW{static{o(this,"Client")}constructor(t,r){var n;super(r),this._clientInfo=t,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{}}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=AFe(this._capabilities,t)}assertCapability(t,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[t]))throw new Error(`Server does not support ${t} (required for ${r})`)}async connect(t,r){if(await super.connect(t),t.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:Mae,capabilities:this._capabilities,clientInfo:this._clientInfo}},Uae,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!eFe.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){var r,n,i,s,a;switch(t){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.tools))throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.completions))throw new Error(`Server does not support completions (required for ${t})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(t){var r;switch(t){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"ping":break}}async ping(t){return this.request({method:"ping"},Av,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},$ae,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},Av,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},jae,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},Hae,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},qae,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},Wae,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},Gae,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},Av,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},Av,r)}async callTool(t,r=qW,n){return this.request({method:"tools/call",params:t},r,n)}async listTools(t,r){return this.request({method:"tools/list",params:t},Vae,r)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};d();var aNe=Xe(oNe(),1),Ik=Xe(require("node:process"),1),lNe=require("node:stream");d();var jW=class{static{o(this,"ReadBuffer")}append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
709
+ `}o(LPe,"parseOverallDescription");d();d();var bW=class extends Error{static{o(this,"EditConversationNotFoundException")}constructor(t){super(t),this.name="EditConversationNotFoundException"}};var D6t=new Ht("CopilotEditsConversations"),Za=class{constructor(t){this.editConversations=new In(50);this.ctx=t}static{o(this,"EditConversations")}create(t="panel",r){let n=new yW([],t,r);return this.editConversations.set(n.id,n),n}destroy(t){this.editConversations.delete(t)!==!0&&D6t.warn(this.ctx,`Edit code conversation ${t} does not exist`)}addTurn(t,r){return this.get(t).addTurn(r),r}deleteTurn(t,r){this.get(t).deleteTurn(r)}get(t){return this.getEditConversation(t)}getEditConversation(t){let r=this.editConversations.get(t);if(!r)throw new bW(`Conversation with id ${t} does not exist`);return r}getAll(){return Array.from(this.editConversations.values())}findByTurnId(t){let r=this.getAll();for(let n of r)if(n.hasTurn(t))return n}};d();d();var ci=class{static{o(this,"ModelConfigurationProvider")}},IW=class extends ci{constructor(r){super();this.ctx=r}static{o(this,"DefaultModelConfigurationProvider")}async getBestChatModelConfig(r,n){let i=[];for(let s of r){let a=await this.getFirstMatchingChatModelConfiguration(s,n);a&&i.push(a)}if(i.length>0){let s=i.find(a=>a.isExperimental);return s||i[0]}throw Jr.error(this.ctx,`No model configuration found for families: ${r.join(", ")}. Available models: ${JSON.stringify(await this.ctx.get(Ju).getMetadata())}`),new Error("No model configuration found")}async getFirstMatchingModelMetadata(r){let n=await this.ctx.get(Ju).getMetadata(),i=P6t(n,r);if(i.length>0)return i[0]}async getFirstMatchingChatModelConfiguration(r,n){let i=await this.getFirstMatchingModelMetadata({family:r,type:"chat",supports:n});if(i!==void 0)return r===di.Gpt35turbo||r===di.Gpt4oMini?{modelId:i.id,uiName:i.name,modelFamily:r,maxRequestTokens:Bae(6144,i),maxResponseTokens:EW(2048,i),baseTokensPerMessage:3,baseTokensPerName:1,baseTokensPerCompletion:3,tokenizer:i.capabilities.tokenizer,isExperimental:i.isExperimental??!1,stream:i.capabilities.supports?.streaming??!1,toolCalls:i.capabilities.supports?.tool_calls??!1}:r===di.Gpt4||r===di.Gpt4turbo?{modelId:i.id,uiName:i.name,modelFamily:r,maxRequestTokens:Bae(10240,i),maxResponseTokens:EW(4096,i),baseTokensPerMessage:3,baseTokensPerName:1,baseTokensPerCompletion:3,tokenizer:i.capabilities.tokenizer,isExperimental:i.isExperimental??!1,stream:i.capabilities.supports?.streaming??!1,toolCalls:i.capabilities.supports?.tool_calls??!1}:r.includes("claude")?{modelId:i.id,uiName:i.name,modelFamily:r,maxRequestTokens:await QPe(this.ctx,i),maxResponseTokens:EW(8192,i),baseTokensPerMessage:3,baseTokensPerName:1,baseTokensPerCompletion:3,tokenizer:i.capabilities.tokenizer,isExperimental:i.isExperimental??!1,stream:i.capabilities.supports?.streaming??!1,toolCalls:i.capabilities.supports?.tool_calls??!1}:{modelId:i.id,uiName:i.name,modelFamily:r,maxRequestTokens:await QPe(this.ctx,i),maxResponseTokens:EW(4096,i),baseTokensPerMessage:3,baseTokensPerName:1,baseTokensPerCompletion:3,tokenizer:i.capabilities.tokenizer,isExperimental:i.isExperimental??!1,stream:i.capabilities.supports?.streaming??!1,toolCalls:i.capabilities.supports?.tool_calls??!1}}async getFirstMatchingEmbeddingModelConfiguration(r){let n=await this.getFirstMatchingModelMetadata({family:r,type:"embeddings"});if(n!==void 0)switch(r){case vN.textEmbedding3Small:return{modelId:n.id,modelFamily:r,maxBatchSize:n.capabilities.limits?.max_inputs??16,maxTokens:8191,tokenizer:"cl100k_base"}}}};async function QPe(e,t){let r=e.get(Cr),n=await r.updateExPValuesAndAssignments(),i=r.ideChatMaxRequestTokens(n);return i===-1&&(i=16384),Bae(i,t)}o(QPe,"getExpRequestTokens");function Bae(e,t){return t.capabilities.limits?.max_prompt_tokens?Math.min(e,t.capabilities.limits.max_prompt_tokens):e}o(Bae,"getRequestTokens");function EW(e,t){return t.capabilities.limits?.max_output_tokens?Math.min(e,t.capabilities.limits.max_output_tokens):e}o(EW,"getResponseTokens");function P6t(e,t){return e.filter(r=>r.capabilities.type!==t.type||r.capabilities.family!==t.family?!1:r.capabilities.supports===void 0||t.supports===void 0?!0:Object.keys(t.supports).every(n=>t.supports?.[n]===r.capabilities.supports?.[n]))}o(P6t,"filterModelsByCapabilities");var Eh=class{static{o(this,"ModelPickerUtils")}static async getModelConfiguration(t,r,n){return t.get(ci).getBestChatModelConfig(n?[n]:ds(r))}static transformMessages(t,r){return r===di.O1Ga||r===di.O1Mini?t.map(n=>n.role!=="user"?{role:"user",content:n.content}:n):t}};var kA=class{constructor(t,r){this.chatFetcher=r;this.ctx=t,this.chatFetcher=this.chatFetcher??new ka(t)}static{o(this,"CopilotEditsService")}async createOrContinueEditConversation(t,r){try{await this.reportBegin(t);let n=await this.getEditCodeResult(t,r),i=CW.processResult(t,n);await this.parseAndSendProgressBack(t,i,r),t.currentTurn.response={message:i,type:"model"},t.currentTurn.status="success",await this.reportEnd(t)}catch(n){if(n instanceof hC)await this.reportEnd(t,{message:Yy});else if(n instanceof v0)await this.reportEnd(t,n.editConversationError);else{let i=n instanceof Error?n.message:String(n);t.currentTurn.status="error",t.currentTurn.response={message:i,type:"meta"},await this.reportEnd(t,{message:i})}}return[]}async getEditCodeResult(t,r){await this.abortIfCancelled(t,r);let n=await this.buildEditCodePromptMessages(t),i=await this.ctx.get(Cr).updateExPValuesAndAssignments();await this.abortIfCancelled(t,r);let s=await Eh.getModelConfiguration(this.ctx,"edits",t.userSelectedModel),a=Eh.transformMessages(n,s.modelFamily);return await this.abortIfCancelled(t,r),await this.chatFetcher.fetchResponse({modelConfiguration:s,messages:a,uiKind:"editsPanel",intentParams:{intent:!0},temperature:.1,llmInteraction:t.toLlmInteraction()},r,i)}async buildEditCodePromptMessages(t){let r=t.currentTurn,n=await Eh.getModelConfiguration(this.ctx,"edits",t.userSelectedModel),i=t.editConversation.getTurns(),s=i.length>1?i.slice(0,-1):[];return await new xW({userMessage:r.request.message,workspaceFolder:r.workspaceFolder,workingSet:r.workingSet,userLanguage:t.editConversation.getUserLanguage(),textDocumentProvider:new vg(this.ctx),modelName:n.uiName,history:s}).render()}async abortIfCancelled(t,r){if(r.isCancellationRequested)throw t.currentTurn.status="cancelled",t.currentTurn.response={message:Yy,type:"user"},new hC;this.ctx.get(Za).get(t.editConversationId)}async parseAndSendProgressBack(t,r,n){try{let i=PPe(r),s=new V6(this.ctx),a=o(async u=>SA.pathToUri(t,u),"createUri"),l=[],c=LPe(r);c&&await this.ctx.get(fc).reportTurn(t,{fileGenerationStatus:"overall-description-generated",editDescription:c}),await this.abortIfCancelled(t,n);for await(let u of NPe(i,a))l.push(s.mapCode(u,n,async f=>{await this.ctx.get(fc).reportTurn(t,f)}));await Promise.all(l),l.length===0&&await this.reportNoCodeBlocks(t,r)}catch(i){if(i instanceof pC||i instanceof B8)t.currentTurn.status="error",t.currentTurn.response={message:i.message,type:"meta"},await this.reportEnd(t,{message:i.message});else if(i instanceof hC)t.currentTurn.status="cancelled",t.currentTurn.response={message:Yy,type:"user"},await this.reportEnd(t,{message:Yy});else throw i}}async reportNoCodeBlocks(t,r){await this.ctx.get(fc).reportTurn(t,{fileGenerationStatus:"no-code-blocks-found",rawResponse:r})}async reportBegin(t){await this.ctx.get(fc).reportTurn(t,{fileGenerationStatus:"edit-conversation-begin"})}async reportEnd(t,r){await this.ctx.get(fc).reportTurn(t,{fileGenerationStatus:"edit-conversation-end",error:r})}};d();var OPe="github.com",MPe=`https://${OPe}`,z6=class extends $n{constructor(r,n=MPe,i=process.env){super();this.env=i;this.validateBaseUrl(r,n)&&this.recalculateUrlDefaults(n),js(r,s=>this.onCopilotToken(r,s))}static{o(this,"DefaultNetworkConfiguration")}onCopilotToken(r,n){this.updateServiceEndpoints(r,n.envelope.endpoints)}getLastKnownEndpointUrl(r,n){return this.join((this.lastEndpoints??aN)[r],n)}getAuthAuthority(){return this.baseUrlObject.host}getAPIUrl(r){return this.join(this.apiUrl,r)}getApiUrl(r,n){return this.join(r.apiUrl,n)}getLoginReachabilityUrl(){return this.loginReachabilityUrl}getDeviceFlowStartUrl(){return this.deviceFlowStartUrl}getDeviceFlowCompletionUrl(){return this.deviceFlowCompletionUrl}getUserInfoUrl(){return this.userInfoUrl}getTelemetryUrl(r){return this.join(this.telemetryUrl,r)}setTelemetryUrlForTesting(r){this.telemetryUrl=r}getExperimentationUrl(r){return this.join(this.experimentationUrl,r)}validateBaseUrl(r,n){return this.isPermittedUrl(r,n)?!0:(r.get(va).showWarningMessage(`Ignoring invalid or unsupported authentication URL "${n}".`),!1)}updateBaseUrl(r,n){n||=MPe;let i=this.baseUrlObject;this.validateBaseUrl(r,n)&&this.withTelemetryReInitialization(r,()=>{this.recalculateUrlDefaults(n),i.href!==this.baseUrlObject.href&&r.get(Xr).resetToken()})}updateBaseUrlFromTokenEndpoint(r,n){try{let i=new URL(n);i.hostname.startsWith("api.")?this.updateBaseUrl(r,`https://${i.hostname.substring(4)}`):this.updateBaseUrl(r)}catch{this.updateBaseUrl(r)}}updateServiceEndpoints(r,n){this.lastEndpoints=n,n&&this.isPermittedUrl(r,n.telemetry)&&this.withTelemetryReInitialization(r,()=>{this.telemetryUrl=this.join(n.telemetry,"telemetry"),this.experimentationUrl=this.join(n.telemetry,"telemetry")})}withTelemetryReInitialization(r,n){let i=this.telemetryUrl;if(n(),i===this.telemetryUrl)return;let s=r.get(Ku);s.isInitialized&&s.reInitialize(r)}recalculateUrlDefaults(r){let n=this.parseUrls(r);this.baseUrlObject=n.base;let i=n.api,s=this.baseUrlObject.host!==OPe;this.apiUrl=i.href,this.loginReachabilityUrl=this.join(this.baseUrlObject.href,"/login/device"),this.deviceFlowStartUrl=this.join(this.baseUrlObject.href,"/login/device/code"),this.deviceFlowCompletionUrl=this.join(this.baseUrlObject.href,"/login/oauth/access_token"),this.userInfoUrl=this.join(i.href,"/user"),this.telemetryUrl=this.join(s?this.prefixWith("copilot-telemetry-service.",this.baseUrlObject).href:aN.telemetry,"/telemetry"),this.experimentationUrl=this.telemetryUrl}parseUrls(r){if(this.env.CODESPACES==="true"&&this.env.GITHUB_TOKEN&&this.env.GITHUB_SERVER_URL&&this.env.GITHUB_API_URL&&!this.env.GITHUB_COPILOT_TOKEN&&!this.env.GH_COPILOT_TOKEN)try{return{base:new URL(this.env.GITHUB_SERVER_URL),api:new URL(this.env.GITHUB_API_URL)}}catch{}let n=new URL(r),i=this.prefixWith("api.",n);return{base:n,api:i}}isPermittedUrl(r,n){return this.isValidUrl(n)&&this.hasSupportedProtocol(r,n)}isValidUrl(r){try{if(r)return new URL(r),!0}catch{}return!1}hasSupportedProtocol(r,n){let i=new URL(n).protocol;return i==="https:"||!lN(r)&&i==="http:"}join(r,n){return n?new URL(n,r).href:r}prefixWith(r,n){return new URL(`${n.protocol}//${r}${n.host}`)}};d();var pen=new Ht("exp");function UPe(e){let t=e.get(Cr);t.registerStaticFilters(L6t(e)),t.registerDynamicFilter("X-Copilot-OverrideEngine",()=>On(e,St.DebugOverrideEngine)||On(e,St.DebugOverrideEngineLegacy)),t.registerDynamicFilter("X-VSCode-ExtensionName",()=>e.get(dn).getEditorPluginInfo().name),t.registerDynamicFilter("X-VSCode-ExtensionVersion",()=>Dae(!e.get(go).isProduction()&&e.get(dn).getEditorPluginInfo().name==="copilot"?"1.999.0":e.get(dn).getEditorPluginInfo().version)),t.registerDynamicFilter("X-VSCode-ExtensionRelease",()=>F6t(e)),t.registerDynamicFilter("X-VSCode-Build",()=>e.get(dn).getEditorInfo().name),t.registerDynamicFilter("X-VSCode-AppVersion",()=>Dae(e.get(dn).getEditorInfo().version)),t.registerDynamicFilter("X-VSCode-TargetPopulation",()=>N6t(e)),t.registerDynamicFilterGroup(()=>{let r={};for(let n of e.get(dn).getRelatedPluginInfo()){let i=ed+n.name.replace(/[^A-Za-z]/g,"").toLowerCase();if(!Object.values($7).includes(i)){iN(e,{reason:`A filter could not be registered for the unrecognized related plugin "${n.name}".`});continue}r[i]=Dae(n.version)}return r})}o(UPe,"setupExperimentationService");function F6t(e){let t=e.get(dn).getEditorPluginInfo();return t.name==="copilot"&&md(e)==="nightly"||t.name==="copilot-intellij"&&t.version.endsWith("nightly")?"nightly":"stable"}o(F6t,"getPluginRelease");function N6t(e){let t=e.get(dn).getEditorInfo();return t.name==="vscode"&&t.version.endsWith("-insider")?"insider":"public"}o(N6t,"getTargetPopulation");function L6t(e){return Q6t(e)}o(L6t,"createAllFilters");function Q6t(e){let t=e.get(_s);return{"X-MSEdge-ClientId":t.machineId,"X-Copilot-ClientVersion":Ex(e)}}o(Q6t,"createDefaultFilters");function Dae(e){return e.split("-")[0]}o(Dae,"trimVersionSuffix");d();d();d();var bg=new Ht("CopilotMCP");d();d();d();d();var eo;(function(e){e.assertEqual=i=>i;function t(i){}o(t,"assertIs"),e.assertIs=t;function r(i){throw new Error}o(r,"assertNever"),e.assertNever=r,e.arrayToEnum=i=>{let s={};for(let a of i)s[a]=a;return s},e.getValidEnumValues=i=>{let s=e.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),a={};for(let l of s)a[l]=i[l];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},e.find=(i,s)=>{for(let a of i)if(s(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}o(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(eo||(eo={}));var Fae;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Fae||(Fae={}));var kr=eo.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),BA=o(e=>{switch(typeof e){case"undefined":return kr.undefined;case"string":return kr.string;case"number":return isNaN(e)?kr.nan:kr.number;case"boolean":return kr.boolean;case"function":return kr.function;case"bigint":return kr.bigint;case"symbol":return kr.symbol;case"object":return Array.isArray(e)?kr.array:e===null?kr.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?kr.promise:typeof Map<"u"&&e instanceof Map?kr.map:typeof Set<"u"&&e instanceof Set?kr.set:typeof Date<"u"&&e instanceof Date?kr.date:kr.object;default:return kr.unknown}},"getParsedType"),Gt=eo.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),M6t=o(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),wf=class e extends Error{static{o(this,"ZodError")}get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(s){return s.message},n={_errors:[]},i=o(s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let l=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(r(a))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}},"processError");return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,eo.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};wf.create=e=>new wf(e);var J6=o((e,t)=>{let r;switch(e.code){case Gt.invalid_type:e.received===kr.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Gt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,eo.jsonStringifyReplacer)}`;break;case Gt.unrecognized_keys:r=`Unrecognized key(s) in object: ${eo.joinValues(e.keys,", ")}`;break;case Gt.invalid_union:r="Invalid input";break;case Gt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${eo.joinValues(e.options)}`;break;case Gt.invalid_enum_value:r=`Invalid enum value. Expected ${eo.joinValues(e.options)}, received '${e.received}'`;break;case Gt.invalid_arguments:r="Invalid function arguments";break;case Gt.invalid_return_type:r="Invalid function return type";break;case Gt.invalid_date:r="Invalid date";break;case Gt.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:eo.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Gt.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case Gt.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case Gt.custom:r="Invalid input";break;case Gt.invalid_intersection_types:r="Intersection results could not be merged";break;case Gt.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Gt.not_finite:r="Number must be finite";break;default:r=t.defaultError,eo.assertNever(e)}return{message:r}},"errorMap"),HPe=J6;function O6t(e){HPe=e}o(O6t,"setErrorMap");function TW(){return HPe}o(TW,"getErrorMap");var wW=o(e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,s=[...r,...i.path||[]],a={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let l="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)l=u(a,{data:t,defaultError:l}).message;return{...i,path:s,message:l}},"makeIssue"),U6t=[];function xr(e,t){let r=TW(),n=wW({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===J6?void 0:J6].filter(i=>!!i)});e.common.issues.push(n)}o(xr,"addIssueToContext");var qc=class e{static{o(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return Fn;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let s=await i.key,a=await i.value;n.push({key:s,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return Fn;s.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[s.value]=a.value)}return{status:t.value,value:n}}},Fn=Object.freeze({status:"aborted"}),K6=o(e=>({status:"dirty",value:e}),"DIRTY"),b0=o(e=>({status:"valid",value:e}),"OK"),Nae=o(e=>e.status==="aborted","isAborted"),Lae=o(e=>e.status==="dirty","isDirty"),ev=o(e=>e.status==="valid","isValid"),xk=o(e=>typeof Promise<"u"&&e instanceof Promise,"isAsync");function _W(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)}o(_W,"__classPrivateFieldGet");function jPe(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r}o(jPe,"__classPrivateFieldSet");var Gr;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Gr||(Gr={}));var yk,Ck,Zd=class{static{o(this,"ParseInputLazyPath")}constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},qPe=o((e,t)=>{if(ev(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new wf(e.common.issues);return this._error=r,this._error}}},"handleResult");function Jn(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:o((a,l)=>{var c,u;let{message:f}=e;return a.code==="invalid_enum_value"?{message:f??l.defaultError}:typeof l.data>"u"?{message:(c=f??n)!==null&&c!==void 0?c:l.defaultError}:a.code!=="invalid_type"?{message:l.defaultError}:{message:(u=f??r)!==null&&u!==void 0?u:l.defaultError}},"customMap"),description:i}}o(Jn,"processCreateParams");var Zn=class{static{o(this,"ZodType")}get description(){return this._def.description}_getType(t){return BA(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:BA(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new qc,ctx:{common:t.parent.common,data:t.data,parsedType:BA(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(xk(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;let i={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:BA(t)},s=this._parseSync({data:t,path:i.path,parent:i});return qPe(i,s)}"~validate"(t){var r,n;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:BA(t)};if(!this["~standard"].async)try{let s=this._parseSync({data:t,path:[],parent:i});return ev(s)?{value:s.value}:{issues:i.common.issues}}catch(s){!((n=(r=s?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:i}).then(s=>ev(s)?{value:s.value}:{issues:i.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:BA(t)},i=this._parse({data:t,path:n.path,parent:n}),s=await(xk(i)?i:Promise.resolve(i));return qPe(n,s)}refine(t,r){let n=o(i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r,"getIssueProperties");return this._refinement((i,s)=>{let a=t(i),l=o(()=>s.addIssue({code:Gt.custom,...n(i)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(l(),!1)):a?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new _f({schema:this,typeName:Sn.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:o(r=>this["~validate"](r),"validate")}}optional(){return Jd.create(this,this._def)}nullable(){return Ig.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return PA.create(this)}promise(){return CC.create(this,this._def)}or(t){return av.create([this,t],this._def)}and(t){return lv.create(this,t,this._def)}transform(t){return new _f({...Jn(this._def),schema:this,typeName:Sn.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new mv({...Jn(this._def),innerType:this,defaultValue:r,typeName:Sn.ZodDefault})}brand(){return new vk({typeName:Sn.ZodBranded,type:this,...Jn(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new hv({...Jn(this._def),innerType:this,catchValue:r,typeName:Sn.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return bk.create(this,t)}readonly(){return pv.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},q6t=/^c[^\s-]{8,}$/i,W6t=/^[0-9a-z]+$/,G6t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,H6t=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,j6t=/^[a-z0-9_-]{21}$/i,V6t=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$6t=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,z6t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Y6t="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Pae,K6t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,J6t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Z6t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,X6t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,e9t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,t9t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,VPe="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",r9t=new RegExp(`^${VPe}$`);function $Pe(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}o($Pe,"timeRegexSource");function n9t(e){return new RegExp(`^${$Pe(e)}$`)}o(n9t,"timeRegex");function zPe(e){let t=`${VPe}T${$Pe(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}o(zPe,"datetimeRegex");function i9t(e,t){return!!((t==="v4"||!t)&&K6t.test(e)||(t==="v6"||!t)&&Z6t.test(e))}o(i9t,"isValidIP");function o9t(e,t){if(!V6t.test(e))return!1;try{let[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||!i.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}o(o9t,"isValidJWT");function s9t(e,t){return!!((t==="v4"||!t)&&J6t.test(e)||(t==="v6"||!t)&&X6t.test(e))}o(s9t,"isValidCidr");var AC=class e extends Zn{static{o(this,"ZodString")}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==kr.string){let s=this._getOrReturnCtx(t);return xr(s,{code:Gt.invalid_type,expected:kr.string,received:s.parsedType}),Fn}let n=new qc,i;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let a=t.data.length>s.value,l=t.data.length<s.value;(a||l)&&(i=this._getOrReturnCtx(t,i),a?xr(i,{code:Gt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&xr(i,{code:Gt.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")z6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"email",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Pae||(Pae=new RegExp(Y6t,"u")),Pae.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"emoji",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")H6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"uuid",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")j6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"nanoid",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")q6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"cuid",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")W6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"cuid2",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")G6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"ulid",code:Gt.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),xr(i,{validation:"url",code:Gt.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"regex",code:Gt.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?zPe(s).test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?r9t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?n9t(s).test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?$6t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"duration",code:Gt.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?i9t(t.data,s.version)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"ip",code:Gt.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?o9t(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"jwt",code:Gt.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?s9t(t.data,s.version)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"cidr",code:Gt.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?e9t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"base64",code:Gt.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?t9t.test(t.data)||(i=this._getOrReturnCtx(t,i),xr(i,{validation:"base64url",code:Gt.invalid_string,message:s.message}),n.dirty()):eo.assertNever(s);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:Gt.invalid_string,...Gr.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Gr.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Gr.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Gr.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Gr.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Gr.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Gr.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Gr.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Gr.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Gr.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Gr.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Gr.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Gr.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Gr.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(r=t?.offset)!==null&&r!==void 0?r:!1,local:(n=t?.local)!==null&&n!==void 0?n:!1,...Gr.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Gr.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Gr.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Gr.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Gr.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Gr.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Gr.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Gr.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Gr.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Gr.errToObj(r)})}nonempty(t){return this.min(1,Gr.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};AC.create=e=>{var t;return new AC({checks:[],typeName:Sn.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Jn(e)})};function a9t(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,s=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}o(a9t,"floatSafeRemainder");var tv=class e extends Zn{static{o(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==kr.number){let s=this._getOrReturnCtx(t);return xr(s,{code:Gt.invalid_type,expected:kr.number,received:s.parsedType}),Fn}let n,i=new qc;for(let s of this._def.checks)s.kind==="int"?eo.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?a9t(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.not_finite,message:s.message}),i.dirty()):eo.assertNever(s);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Gr.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Gr.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Gr.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Gr.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Gr.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Gr.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Gr.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Gr.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Gr.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Gr.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Gr.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Gr.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Gr.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Gr.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&eo.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};tv.create=e=>new tv({checks:[],typeName:Sn.ZodNumber,coerce:e?.coerce||!1,...Jn(e)});var rv=class e extends Zn{static{o(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==kr.bigint)return this._getInvalidInput(t);let n,i=new qc;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),xr(n,{code:Gt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):eo.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return xr(r,{code:Gt.invalid_type,expected:kr.bigint,received:r.parsedType}),Fn}gte(t,r){return this.setLimit("min",t,!0,Gr.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Gr.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Gr.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Gr.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Gr.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Gr.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Gr.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Gr.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Gr.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Gr.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};rv.create=e=>{var t;return new rv({checks:[],typeName:Sn.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Jn(e)})};var nv=class extends Zn{static{o(this,"ZodBoolean")}_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==kr.boolean){let n=this._getOrReturnCtx(t);return xr(n,{code:Gt.invalid_type,expected:kr.boolean,received:n.parsedType}),Fn}return b0(t.data)}};nv.create=e=>new nv({typeName:Sn.ZodBoolean,coerce:e?.coerce||!1,...Jn(e)});var iv=class e extends Zn{static{o(this,"ZodDate")}_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==kr.date){let s=this._getOrReturnCtx(t);return xr(s,{code:Gt.invalid_type,expected:kr.date,received:s.parsedType}),Fn}if(isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return xr(s,{code:Gt.invalid_date}),Fn}let n=new qc,i;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),xr(i,{code:Gt.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):eo.assertNever(s);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Gr.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Gr.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};iv.create=e=>new iv({checks:[],coerce:e?.coerce||!1,typeName:Sn.ZodDate,...Jn(e)});var Z6=class extends Zn{static{o(this,"ZodSymbol")}_parse(t){if(this._getType(t)!==kr.symbol){let n=this._getOrReturnCtx(t);return xr(n,{code:Gt.invalid_type,expected:kr.symbol,received:n.parsedType}),Fn}return b0(t.data)}};Z6.create=e=>new Z6({typeName:Sn.ZodSymbol,...Jn(e)});var ov=class extends Zn{static{o(this,"ZodUndefined")}_parse(t){if(this._getType(t)!==kr.undefined){let n=this._getOrReturnCtx(t);return xr(n,{code:Gt.invalid_type,expected:kr.undefined,received:n.parsedType}),Fn}return b0(t.data)}};ov.create=e=>new ov({typeName:Sn.ZodUndefined,...Jn(e)});var sv=class extends Zn{static{o(this,"ZodNull")}_parse(t){if(this._getType(t)!==kr.null){let n=this._getOrReturnCtx(t);return xr(n,{code:Gt.invalid_type,expected:kr.null,received:n.parsedType}),Fn}return b0(t.data)}};sv.create=e=>new sv({typeName:Sn.ZodNull,...Jn(e)});var yC=class extends Zn{static{o(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(t){return b0(t.data)}};yC.create=e=>new yC({typeName:Sn.ZodAny,...Jn(e)});var DA=class extends Zn{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(t){return b0(t.data)}};DA.create=e=>new DA({typeName:Sn.ZodUnknown,...Jn(e)});var Ih=class extends Zn{static{o(this,"ZodNever")}_parse(t){let r=this._getOrReturnCtx(t);return xr(r,{code:Gt.invalid_type,expected:kr.never,received:r.parsedType}),Fn}};Ih.create=e=>new Ih({typeName:Sn.ZodNever,...Jn(e)});var X6=class extends Zn{static{o(this,"ZodVoid")}_parse(t){if(this._getType(t)!==kr.undefined){let n=this._getOrReturnCtx(t);return xr(n,{code:Gt.invalid_type,expected:kr.void,received:n.parsedType}),Fn}return b0(t.data)}};X6.create=e=>new X6({typeName:Sn.ZodVoid,...Jn(e)});var PA=class e extends Zn{static{o(this,"ZodArray")}_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==kr.array)return xr(r,{code:Gt.invalid_type,expected:kr.array,received:r.parsedType}),Fn;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,l=r.data.length<i.exactLength.value;(a||l)&&(xr(r,{code:a?Gt.too_big:Gt.too_small,minimum:l?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(xr(r,{code:Gt.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(xr(r,{code:Gt.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,l)=>i.type._parseAsync(new Zd(r,a,r.path,l)))).then(a=>qc.mergeArray(n,a));let s=[...r.data].map((a,l)=>i.type._parseSync(new Zd(r,a,r.path,l)));return qc.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:Gr.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:Gr.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:Gr.toString(r)}})}nonempty(t){return this.min(1,t)}};PA.create=(e,t)=>new PA({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Sn.ZodArray,...Jn(t)});function Y6(e){if(e instanceof Cu){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Jd.create(Y6(n))}return new Cu({...e._def,shape:o(()=>t,"shape")})}else return e instanceof PA?new PA({...e._def,type:Y6(e.element)}):e instanceof Jd?Jd.create(Y6(e.unwrap())):e instanceof Ig?Ig.create(Y6(e.unwrap())):e instanceof Eg?Eg.create(e.items.map(t=>Y6(t))):e}o(Y6,"deepPartialify");var Cu=class e extends Zn{static{o(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=eo.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==kr.object){let u=this._getOrReturnCtx(t);return xr(u,{code:Gt.invalid_type,expected:kr.object,received:u.parsedType}),Fn}let{status:n,ctx:i}=this._processInputParams(t),{shape:s,keys:a}=this._getCached(),l=[];if(!(this._def.catchall instanceof Ih&&this._def.unknownKeys==="strip"))for(let u in i.data)a.includes(u)||l.push(u);let c=[];for(let u of a){let f=s[u],m=i.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new Zd(i,m,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Ih){let u=this._def.unknownKeys;if(u==="passthrough")for(let f of l)c.push({key:{status:"valid",value:f},value:{status:"valid",value:i.data[f]}});else if(u==="strict")l.length>0&&(xr(i,{code:Gt.unrecognized_keys,keys:l}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let f of l){let m=i.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new Zd(i,m,i.path,f)),alwaysSet:f in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let f of c){let m=await f.key,h=await f.value;u.push({key:m,value:h,alwaysSet:f.alwaysSet})}return u}).then(u=>qc.mergeObjectSync(n,u)):qc.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return Gr.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:o((r,n)=>{var i,s,a,l;let c=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(l=Gr.errToObj(t).message)!==null&&l!==void 0?l:c}:{message:c}},"errorMap")}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:o(()=>({...this._def.shape(),...t}),"shape")})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:o(()=>({...this._def.shape(),...t._def.shape()}),"shape"),typeName:Sn.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};return eo.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new e({...this._def,shape:o(()=>r,"shape")})}omit(t){let r={};return eo.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new e({...this._def,shape:o(()=>r,"shape")})}deepPartial(){return Y6(this)}partial(t){let r={};return eo.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}),new e({...this._def,shape:o(()=>r,"shape")})}required(t){let r={};return eo.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Jd;)s=s._def.innerType;r[n]=s}}),new e({...this._def,shape:o(()=>r,"shape")})}keyof(){return YPe(eo.objectKeys(this.shape))}};Cu.create=(e,t)=>new Cu({shape:o(()=>e,"shape"),unknownKeys:"strip",catchall:Ih.create(),typeName:Sn.ZodObject,...Jn(t)});Cu.strictCreate=(e,t)=>new Cu({shape:o(()=>e,"shape"),unknownKeys:"strict",catchall:Ih.create(),typeName:Sn.ZodObject,...Jn(t)});Cu.lazycreate=(e,t)=>new Cu({shape:e,unknownKeys:"strip",catchall:Ih.create(),typeName:Sn.ZodObject,...Jn(t)});var av=class extends Zn{static{o(this,"ZodUnion")}_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(s){for(let l of s)if(l.result.status==="valid")return l.result;for(let l of s)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;let a=s.map(l=>new wf(l.ctx.common.issues));return xr(r,{code:Gt.invalid_union,unionErrors:a}),Fn}if(o(i,"handleResults"),r.common.async)return Promise.all(n.map(async s=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let s,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},f=c._parseSync({data:r.data,path:r.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let l=a.map(c=>new wf(c));return xr(r,{code:Gt.invalid_union,unionErrors:l}),Fn}}get options(){return this._def.options}};av.create=(e,t)=>new av({options:e,typeName:Sn.ZodUnion,...Jn(t)});var RA=o(e=>e instanceof cv?RA(e.schema):e instanceof _f?RA(e.innerType()):e instanceof uv?[e.value]:e instanceof fv?e.options:e instanceof dv?eo.objectValues(e.enum):e instanceof mv?RA(e._def.innerType):e instanceof ov?[void 0]:e instanceof sv?[null]:e instanceof Jd?[void 0,...RA(e.unwrap())]:e instanceof Ig?[null,...RA(e.unwrap())]:e instanceof vk||e instanceof pv?RA(e.unwrap()):e instanceof hv?RA(e._def.innerType):[],"getDiscriminator"),SW=class e extends Zn{static{o(this,"ZodDiscriminatedUnion")}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==kr.object)return xr(r,{code:Gt.invalid_type,expected:kr.object,received:r.parsedType}),Fn;let n=this.discriminator,i=r.data[n],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(xr(r,{code:Gt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Fn)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let s of r){let a=RA(s.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let l of a){if(i.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);i.set(l,s)}}return new e({typeName:Sn.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...Jn(n)})}};function Qae(e,t){let r=BA(e),n=BA(t);if(e===t)return{valid:!0,data:e};if(r===kr.object&&n===kr.object){let i=eo.objectKeys(t),s=eo.objectKeys(e).filter(l=>i.indexOf(l)!==-1),a={...e,...t};for(let l of s){let c=Qae(e[l],t[l]);if(!c.valid)return{valid:!1};a[l]=c.data}return{valid:!0,data:a}}else if(r===kr.array&&n===kr.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let s=0;s<e.length;s++){let a=e[s],l=t[s],c=Qae(a,l);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===kr.date&&n===kr.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}o(Qae,"mergeValues");var lv=class extends Zn{static{o(this,"ZodIntersection")}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=o((s,a)=>{if(Nae(s)||Nae(a))return Fn;let l=Qae(s.value,a.value);return l.valid?((Lae(s)||Lae(a))&&r.dirty(),{status:r.value,value:l.data}):(xr(n,{code:Gt.invalid_intersection_types}),Fn)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};lv.create=(e,t,r)=>new lv({left:e,right:t,typeName:Sn.ZodIntersection,...Jn(r)});var Eg=class e extends Zn{static{o(this,"ZodTuple")}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==kr.array)return xr(n,{code:Gt.invalid_type,expected:kr.array,received:n.parsedType}),Fn;if(n.data.length<this._def.items.length)return xr(n,{code:Gt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Fn;!this._def.rest&&n.data.length>this._def.items.length&&(xr(n,{code:Gt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((a,l)=>{let c=this._def.items[l]||this._def.rest;return c?c._parse(new Zd(n,a,n.path,l)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>qc.mergeArray(r,a)):qc.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Eg.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Eg({items:e,typeName:Sn.ZodTuple,rest:null,...Jn(t)})};var kW=class e extends Zn{static{o(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==kr.object)return xr(n,{code:Gt.invalid_type,expected:kr.object,received:n.parsedType}),Fn;let i=[],s=this._def.keyType,a=this._def.valueType;for(let l in n.data)i.push({key:s._parse(new Zd(n,l,n.path,l)),value:a._parse(new Zd(n,n.data[l],n.path,l)),alwaysSet:l in n.data});return n.common.async?qc.mergeObjectAsync(r,i):qc.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Zn?new e({keyType:t,valueType:r,typeName:Sn.ZodRecord,...Jn(n)}):new e({keyType:AC.create(),valueType:t,typeName:Sn.ZodRecord,...Jn(r)})}},e9=class extends Zn{static{o(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==kr.map)return xr(n,{code:Gt.invalid_type,expected:kr.map,received:n.parsedType}),Fn;let i=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([l,c],u)=>({key:i._parse(new Zd(n,l,n.path,[u,"key"])),value:s._parse(new Zd(n,c,n.path,[u,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return Fn;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),l.set(u.value,f.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let c of a){let u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return Fn;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),l.set(u.value,f.value)}return{status:r.value,value:l}}}};e9.create=(e,t,r)=>new e9({valueType:t,keyType:e,typeName:Sn.ZodMap,...Jn(r)});var t9=class e extends Zn{static{o(this,"ZodSet")}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==kr.set)return xr(n,{code:Gt.invalid_type,expected:kr.set,received:n.parsedType}),Fn;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(xr(n,{code:Gt.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(xr(n,{code:Gt.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function a(c){let u=new Set;for(let f of c){if(f.status==="aborted")return Fn;f.status==="dirty"&&r.dirty(),u.add(f.value)}return{status:r.value,value:u}}o(a,"finalizeSet");let l=[...n.data.values()].map((c,u)=>s._parse(new Zd(n,c,n.path,u)));return n.common.async?Promise.all(l).then(c=>a(c)):a(l)}min(t,r){return new e({...this._def,minSize:{value:t,message:Gr.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:Gr.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};t9.create=(e,t)=>new t9({valueType:e,minSize:null,maxSize:null,typeName:Sn.ZodSet,...Jn(t)});var RW=class e extends Zn{static{o(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==kr.function)return xr(r,{code:Gt.invalid_type,expected:kr.function,received:r.parsedType}),Fn;function n(l,c){return wW({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,TW(),J6].filter(u=>!!u),issueData:{code:Gt.invalid_arguments,argumentsError:c}})}o(n,"makeArgsIssue");function i(l,c){return wW({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,TW(),J6].filter(u=>!!u),issueData:{code:Gt.invalid_return_type,returnTypeError:c}})}o(i,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof CC){let l=this;return b0(async function(...c){let u=new wf([]),f=await l._def.args.parseAsync(c,s).catch(p=>{throw u.addIssue(n(c,p)),u}),m=await Reflect.apply(a,this,f);return await l._def.returns._def.type.parseAsync(m,s).catch(p=>{throw u.addIssue(i(m,p)),u})})}else{let l=this;return b0(function(...c){let u=l._def.args.safeParse(c,s);if(!u.success)throw new wf([n(c,u.error)]);let f=Reflect.apply(a,this,u.data),m=l._def.returns.safeParse(f,s);if(!m.success)throw new wf([i(f,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Eg.create(t).rest(DA.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Eg.create([]).rest(DA.create()),returns:r||DA.create(),typeName:Sn.ZodFunction,...Jn(n)})}},cv=class extends Zn{static{o(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};cv.create=(e,t)=>new cv({getter:e,typeName:Sn.ZodLazy,...Jn(t)});var uv=class extends Zn{static{o(this,"ZodLiteral")}_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return xr(r,{received:r.data,code:Gt.invalid_literal,expected:this._def.value}),Fn}return{status:"valid",value:t.data}}get value(){return this._def.value}};uv.create=(e,t)=>new uv({value:e,typeName:Sn.ZodLiteral,...Jn(t)});function YPe(e,t){return new fv({values:e,typeName:Sn.ZodEnum,...Jn(t)})}o(YPe,"createZodEnum");var fv=class e extends Zn{static{o(this,"ZodEnum")}constructor(){super(...arguments),yk.set(this,void 0)}_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return xr(r,{expected:eo.joinValues(n),received:r.parsedType,code:Gt.invalid_type}),Fn}if(_W(this,yk,"f")||jPe(this,yk,new Set(this._def.values),"f"),!_W(this,yk,"f").has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return xr(r,{received:r.data,code:Gt.invalid_enum_value,options:n}),Fn}return b0(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};yk=new WeakMap;fv.create=YPe;var dv=class extends Zn{static{o(this,"ZodNativeEnum")}constructor(){super(...arguments),Ck.set(this,void 0)}_parse(t){let r=eo.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==kr.string&&n.parsedType!==kr.number){let i=eo.objectValues(r);return xr(n,{expected:eo.joinValues(i),received:n.parsedType,code:Gt.invalid_type}),Fn}if(_W(this,Ck,"f")||jPe(this,Ck,new Set(eo.getValidEnumValues(this._def.values)),"f"),!_W(this,Ck,"f").has(t.data)){let i=eo.objectValues(r);return xr(n,{received:n.data,code:Gt.invalid_enum_value,options:i}),Fn}return b0(t.data)}get enum(){return this._def.values}};Ck=new WeakMap;dv.create=(e,t)=>new dv({values:e,typeName:Sn.ZodNativeEnum,...Jn(t)});var CC=class extends Zn{static{o(this,"ZodPromise")}unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==kr.promise&&r.common.async===!1)return xr(r,{code:Gt.invalid_type,expected:kr.promise,received:r.parsedType}),Fn;let n=r.parsedType===kr.promise?r.data:Promise.resolve(r.data);return b0(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};CC.create=(e,t)=>new CC({type:e,typeName:Sn.ZodPromise,...Jn(t)});var _f=class extends Zn{static{o(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Sn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o(a=>{xr(n,a),a.fatal?r.abort():r.dirty()},"addIssue"),get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let a=i.transform(n.data,s);if(n.common.async)return Promise.resolve(a).then(async l=>{if(r.value==="aborted")return Fn;let c=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return c.status==="aborted"?Fn:c.status==="dirty"||r.value==="dirty"?K6(c.value):c});{if(r.value==="aborted")return Fn;let l=this._def.schema._parseSync({data:a,path:n.path,parent:n});return l.status==="aborted"?Fn:l.status==="dirty"||r.value==="dirty"?K6(l.value):l}}if(i.type==="refinement"){let a=o(l=>{let c=i.refinement(l,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l},"executeRefinement");if(n.common.async===!1){let l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?Fn:(l.status==="dirty"&&r.dirty(),a(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?Fn:(l.status==="dirty"&&r.dirty(),a(l.value).then(()=>({status:r.value,value:l.value}))))}if(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ev(a))return a;let l=i.transform(a.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>ev(a)?Promise.resolve(i.transform(a.value,s)).then(l=>({status:r.value,value:l})):a);eo.assertNever(i)}};_f.create=(e,t,r)=>new _f({schema:e,typeName:Sn.ZodEffects,effect:t,...Jn(r)});_f.createWithPreprocess=(e,t,r)=>new _f({schema:t,effect:{type:"preprocess",transform:e},typeName:Sn.ZodEffects,...Jn(r)});var Jd=class extends Zn{static{o(this,"ZodOptional")}_parse(t){return this._getType(t)===kr.undefined?b0(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Jd.create=(e,t)=>new Jd({innerType:e,typeName:Sn.ZodOptional,...Jn(t)});var Ig=class extends Zn{static{o(this,"ZodNullable")}_parse(t){return this._getType(t)===kr.null?b0(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ig.create=(e,t)=>new Ig({innerType:e,typeName:Sn.ZodNullable,...Jn(t)});var mv=class extends Zn{static{o(this,"ZodDefault")}_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===kr.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};mv.create=(e,t)=>new mv({innerType:e,typeName:Sn.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Jn(t)});var hv=class extends Zn{static{o(this,"ZodCatch")}_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return xk(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new wf(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new wf(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};hv.create=(e,t)=>new hv({innerType:e,typeName:Sn.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Jn(t)});var r9=class extends Zn{static{o(this,"ZodNaN")}_parse(t){if(this._getType(t)!==kr.nan){let n=this._getOrReturnCtx(t);return xr(n,{code:Gt.invalid_type,expected:kr.nan,received:n.parsedType}),Fn}return{status:"valid",value:t.data}}};r9.create=e=>new r9({typeName:Sn.ZodNaN,...Jn(e)});var l9t=Symbol("zod_brand"),vk=class extends Zn{static{o(this,"ZodBranded")}_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},bk=class e extends Zn{static{o(this,"ZodPipeline")}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return o(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Fn:s.status==="dirty"?(r.dirty(),K6(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Fn:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:Sn.ZodPipeline})}},pv=class extends Zn{static{o(this,"ZodReadonly")}_parse(t){let r=this._def.innerType._parse(t),n=o(i=>(ev(i)&&(i.value=Object.freeze(i.value)),i),"freeze");return xk(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};pv.create=(e,t)=>new pv({innerType:e,typeName:Sn.ZodReadonly,...Jn(t)});function WPe(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}o(WPe,"cleanParams");function KPe(e,t={},r){return e?yC.create().superRefine((n,i)=>{var s,a;let l=e(n);if(l instanceof Promise)return l.then(c=>{var u,f;if(!c){let m=WPe(t,n),h=(f=(u=m.fatal)!==null&&u!==void 0?u:r)!==null&&f!==void 0?f:!0;i.addIssue({code:"custom",...m,fatal:h})}});if(!l){let c=WPe(t,n),u=(a=(s=c.fatal)!==null&&s!==void 0?s:r)!==null&&a!==void 0?a:!0;i.addIssue({code:"custom",...c,fatal:u})}}):yC.create()}o(KPe,"custom");var c9t={object:Cu.lazycreate},Sn;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Sn||(Sn={}));var u9t=o((e,t={message:`Input not instance of ${e.name}`})=>KPe(r=>r instanceof e,t),"instanceOfType"),JPe=AC.create,ZPe=tv.create,f9t=r9.create,d9t=rv.create,XPe=nv.create,m9t=iv.create,h9t=Z6.create,p9t=ov.create,g9t=sv.create,A9t=yC.create,y9t=DA.create,C9t=Ih.create,x9t=X6.create,v9t=PA.create,b9t=Cu.create,E9t=Cu.strictCreate,I9t=av.create,T9t=SW.create,w9t=lv.create,_9t=Eg.create,S9t=kW.create,k9t=e9.create,R9t=t9.create,B9t=RW.create,D9t=cv.create,P9t=uv.create,F9t=fv.create,N9t=dv.create,L9t=CC.create,GPe=_f.create,Q9t=Jd.create,M9t=Ig.create,O9t=_f.createWithPreprocess,U9t=bk.create,q9t=o(()=>JPe().optional(),"ostring"),W9t=o(()=>ZPe().optional(),"onumber"),G9t=o(()=>XPe().optional(),"oboolean"),H9t={string:o(e=>AC.create({...e,coerce:!0}),"string"),number:o(e=>tv.create({...e,coerce:!0}),"number"),boolean:o(e=>nv.create({...e,coerce:!0}),"boolean"),bigint:o(e=>rv.create({...e,coerce:!0}),"bigint"),date:o(e=>iv.create({...e,coerce:!0}),"date")},j9t=Fn,xe=Object.freeze({__proto__:null,defaultErrorMap:J6,setErrorMap:O6t,getErrorMap:TW,makeIssue:wW,EMPTY_PATH:U6t,addIssueToContext:xr,ParseStatus:qc,INVALID:Fn,DIRTY:K6,OK:b0,isAborted:Nae,isDirty:Lae,isValid:ev,isAsync:xk,get util(){return eo},get objectUtil(){return Fae},ZodParsedType:kr,getParsedType:BA,ZodType:Zn,datetimeRegex:zPe,ZodString:AC,ZodNumber:tv,ZodBigInt:rv,ZodBoolean:nv,ZodDate:iv,ZodSymbol:Z6,ZodUndefined:ov,ZodNull:sv,ZodAny:yC,ZodUnknown:DA,ZodNever:Ih,ZodVoid:X6,ZodArray:PA,ZodObject:Cu,ZodUnion:av,ZodDiscriminatedUnion:SW,ZodIntersection:lv,ZodTuple:Eg,ZodRecord:kW,ZodMap:e9,ZodSet:t9,ZodFunction:RW,ZodLazy:cv,ZodLiteral:uv,ZodEnum:fv,ZodNativeEnum:dv,ZodPromise:CC,ZodEffects:_f,ZodTransformer:_f,ZodOptional:Jd,ZodNullable:Ig,ZodDefault:mv,ZodCatch:hv,ZodNaN:r9,BRAND:l9t,ZodBranded:vk,ZodPipeline:bk,ZodReadonly:pv,custom:KPe,Schema:Zn,ZodSchema:Zn,late:c9t,get ZodFirstPartyTypeKind(){return Sn},coerce:H9t,any:A9t,array:v9t,bigint:d9t,boolean:XPe,date:m9t,discriminatedUnion:T9t,effect:GPe,enum:F9t,function:B9t,instanceof:u9t,intersection:w9t,lazy:D9t,literal:P9t,map:k9t,nan:f9t,nativeEnum:N9t,never:C9t,null:g9t,nullable:M9t,number:ZPe,object:b9t,oboolean:G9t,onumber:W9t,optional:Q9t,ostring:q9t,pipeline:U9t,preprocess:O9t,promise:L9t,record:S9t,set:R9t,strictObject:E9t,string:JPe,symbol:h9t,transformer:GPe,tuple:_9t,undefined:p9t,union:I9t,unknown:y9t,void:x9t,NEVER:j9t,ZodIssueCode:Gt,quotelessJson:M6t,ZodError:wf});var Mae="2025-03-26",eFe=[Mae,"2024-11-05","2024-10-07"],BW="2.0",tFe=xe.union([xe.string(),xe.number().int()]),rFe=xe.string(),V9t=xe.object({progressToken:xe.optional(tFe)}).passthrough(),Th=xe.object({_meta:xe.optional(V9t)}).passthrough(),Sf=xe.object({method:xe.string(),params:xe.optional(Th)}),Ek=xe.object({_meta:xe.optional(xe.object({}).passthrough())}).passthrough(),Tg=xe.object({method:xe.string(),params:xe.optional(Ek)}),wh=xe.object({_meta:xe.optional(xe.object({}).passthrough())}).passthrough(),DW=xe.union([xe.string(),xe.number().int()]),nFe=xe.object({jsonrpc:xe.literal(BW),id:DW}).merge(Sf).strict(),iFe=o(e=>nFe.safeParse(e).success,"isJSONRPCRequest"),oFe=xe.object({jsonrpc:xe.literal(BW)}).merge(Tg).strict(),sFe=o(e=>oFe.safeParse(e).success,"isJSONRPCNotification"),aFe=xe.object({jsonrpc:xe.literal(BW),id:DW,result:wh}).strict(),Oae=o(e=>aFe.safeParse(e).success,"isJSONRPCResponse"),xC;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"})(xC||(xC={}));var lFe=xe.object({jsonrpc:xe.literal(BW),id:DW,error:xe.object({code:xe.number().int(),message:xe.string(),data:xe.optional(xe.unknown())})}).strict(),cFe=o(e=>lFe.safeParse(e).success,"isJSONRPCError"),uFe=xe.union([nFe,oFe,aFe,lFe]),Av=wh.strict(),PW=Tg.extend({method:xe.literal("notifications/cancelled"),params:Ek.extend({requestId:DW,reason:xe.string().optional()})}),fFe=xe.object({name:xe.string(),version:xe.string()}).passthrough(),$9t=xe.object({experimental:xe.optional(xe.object({}).passthrough()),sampling:xe.optional(xe.object({}).passthrough()),roots:xe.optional(xe.object({listChanged:xe.optional(xe.boolean())}).passthrough())}).passthrough(),z9t=Sf.extend({method:xe.literal("initialize"),params:Th.extend({protocolVersion:xe.string(),capabilities:$9t,clientInfo:fFe})});var Y9t=xe.object({experimental:xe.optional(xe.object({}).passthrough()),logging:xe.optional(xe.object({}).passthrough()),completions:xe.optional(xe.object({}).passthrough()),prompts:xe.optional(xe.object({listChanged:xe.optional(xe.boolean())}).passthrough()),resources:xe.optional(xe.object({subscribe:xe.optional(xe.boolean()),listChanged:xe.optional(xe.boolean())}).passthrough()),tools:xe.optional(xe.object({listChanged:xe.optional(xe.boolean())}).passthrough())}).passthrough(),Uae=wh.extend({protocolVersion:xe.string(),capabilities:Y9t,serverInfo:fFe,instructions:xe.optional(xe.string())}),K9t=Tg.extend({method:xe.literal("notifications/initialized")});var FW=Sf.extend({method:xe.literal("ping")}),J9t=xe.object({progress:xe.number(),total:xe.optional(xe.number())}).passthrough(),NW=Tg.extend({method:xe.literal("notifications/progress"),params:Ek.merge(J9t).extend({progressToken:tFe})}),LW=Sf.extend({params:Th.extend({cursor:xe.optional(rFe)}).optional()}),QW=wh.extend({nextCursor:xe.optional(rFe)}),dFe=xe.object({uri:xe.string(),mimeType:xe.optional(xe.string())}).passthrough(),mFe=dFe.extend({text:xe.string()}),hFe=dFe.extend({blob:xe.string().base64()}),Z9t=xe.object({uri:xe.string(),name:xe.string(),description:xe.optional(xe.string()),mimeType:xe.optional(xe.string())}).passthrough(),X9t=xe.object({uriTemplate:xe.string(),name:xe.string(),description:xe.optional(xe.string()),mimeType:xe.optional(xe.string())}).passthrough(),eTt=LW.extend({method:xe.literal("resources/list")}),qae=QW.extend({resources:xe.array(Z9t)}),tTt=LW.extend({method:xe.literal("resources/templates/list")}),Wae=QW.extend({resourceTemplates:xe.array(X9t)}),rTt=Sf.extend({method:xe.literal("resources/read"),params:Th.extend({uri:xe.string()})}),Gae=wh.extend({contents:xe.array(xe.union([mFe,hFe]))}),nTt=Tg.extend({method:xe.literal("notifications/resources/list_changed")}),iTt=Sf.extend({method:xe.literal("resources/subscribe"),params:Th.extend({uri:xe.string()})}),oTt=Sf.extend({method:xe.literal("resources/unsubscribe"),params:Th.extend({uri:xe.string()})}),sTt=Tg.extend({method:xe.literal("notifications/resources/updated"),params:Ek.extend({uri:xe.string()})}),aTt=xe.object({name:xe.string(),description:xe.optional(xe.string()),required:xe.optional(xe.boolean())}).passthrough(),lTt=xe.object({name:xe.string(),description:xe.optional(xe.string()),arguments:xe.optional(xe.array(aTt))}).passthrough(),cTt=LW.extend({method:xe.literal("prompts/list")}),Hae=QW.extend({prompts:xe.array(lTt)}),uTt=Sf.extend({method:xe.literal("prompts/get"),params:Th.extend({name:xe.string(),arguments:xe.optional(xe.record(xe.string()))})}),MW=xe.object({type:xe.literal("text"),text:xe.string()}).passthrough(),OW=xe.object({type:xe.literal("image"),data:xe.string().base64(),mimeType:xe.string()}).passthrough(),UW=xe.object({type:xe.literal("audio"),data:xe.string().base64(),mimeType:xe.string()}).passthrough(),pFe=xe.object({type:xe.literal("resource"),resource:xe.union([mFe,hFe])}).passthrough(),fTt=xe.object({role:xe.enum(["user","assistant"]),content:xe.union([MW,OW,UW,pFe])}).passthrough(),jae=wh.extend({description:xe.optional(xe.string()),messages:xe.array(fTt)}),dTt=Tg.extend({method:xe.literal("notifications/prompts/list_changed")}),mTt=xe.object({title:xe.optional(xe.string()),readOnlyHint:xe.optional(xe.boolean()),destructiveHint:xe.optional(xe.boolean()),idempotentHint:xe.optional(xe.boolean()),openWorldHint:xe.optional(xe.boolean())}).passthrough(),hTt=xe.object({name:xe.string(),description:xe.optional(xe.string()),inputSchema:xe.object({type:xe.literal("object"),properties:xe.optional(xe.object({}).passthrough())}).passthrough(),annotations:xe.optional(mTt)}).passthrough(),pTt=LW.extend({method:xe.literal("tools/list")}),Vae=QW.extend({tools:xe.array(hTt)}),qW=wh.extend({content:xe.array(xe.union([MW,OW,UW,pFe])),isError:xe.boolean().default(!1).optional()}),wen=qW.or(wh.extend({toolResult:xe.unknown()})),gTt=Sf.extend({method:xe.literal("tools/call"),params:Th.extend({name:xe.string(),arguments:xe.optional(xe.record(xe.unknown()))})}),ATt=Tg.extend({method:xe.literal("notifications/tools/list_changed")}),gFe=xe.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),yTt=Sf.extend({method:xe.literal("logging/setLevel"),params:Th.extend({level:gFe})}),CTt=Tg.extend({method:xe.literal("notifications/message"),params:Ek.extend({level:gFe,logger:xe.optional(xe.string()),data:xe.unknown()})}),xTt=xe.object({name:xe.string().optional()}).passthrough(),vTt=xe.object({hints:xe.optional(xe.array(xTt)),costPriority:xe.optional(xe.number().min(0).max(1)),speedPriority:xe.optional(xe.number().min(0).max(1)),intelligencePriority:xe.optional(xe.number().min(0).max(1))}).passthrough(),bTt=xe.object({role:xe.enum(["user","assistant"]),content:xe.union([MW,OW,UW])}).passthrough(),ETt=Sf.extend({method:xe.literal("sampling/createMessage"),params:Th.extend({messages:xe.array(bTt),systemPrompt:xe.optional(xe.string()),includeContext:xe.optional(xe.enum(["none","thisServer","allServers"])),temperature:xe.optional(xe.number()),maxTokens:xe.number().int(),stopSequences:xe.optional(xe.array(xe.string())),metadata:xe.optional(xe.object({}).passthrough()),modelPreferences:xe.optional(vTt)})}),ITt=wh.extend({model:xe.string(),stopReason:xe.optional(xe.enum(["endTurn","stopSequence","maxTokens"]).or(xe.string())),role:xe.enum(["user","assistant"]),content:xe.discriminatedUnion("type",[MW,OW,UW])}),TTt=xe.object({type:xe.literal("ref/resource"),uri:xe.string()}).passthrough(),wTt=xe.object({type:xe.literal("ref/prompt"),name:xe.string()}).passthrough(),_Tt=Sf.extend({method:xe.literal("completion/complete"),params:Th.extend({ref:xe.union([wTt,TTt]),argument:xe.object({name:xe.string(),value:xe.string()}).passthrough()})}),$ae=wh.extend({completion:xe.object({values:xe.array(xe.string()).max(100),total:xe.optional(xe.number().int()),hasMore:xe.optional(xe.boolean())}).passthrough()}),STt=xe.object({uri:xe.string().startsWith("file://"),name:xe.optional(xe.string())}).passthrough(),kTt=Sf.extend({method:xe.literal("roots/list")}),RTt=wh.extend({roots:xe.array(STt)}),BTt=Tg.extend({method:xe.literal("notifications/roots/list_changed")}),_en=xe.union([FW,z9t,_Tt,yTt,uTt,cTt,eTt,tTt,rTt,iTt,oTt,gTt,pTt]),Sen=xe.union([PW,NW,K9t,BTt]),ken=xe.union([Av,ITt,RTt]),Ren=xe.union([FW,ETt,kTt]),Ben=xe.union([PW,NW,CTt,sTt,nTt,ATt,dTt]),Den=xe.union([Av,Uae,$ae,jae,Hae,qae,Wae,Gae,qW,Vae]),gv=class extends Error{static{o(this,"McpError")}constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}};var DTt=6e4,WW=class{static{o(this,"Protocol")}constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(PW,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(NW,r=>{this._onprogress(r)}),this.setRequestHandler(FW,r=>({}))}_setupTimeout(t,r,n,i,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new gv(xC.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=r=>{this._onerror(r)},this._transport.onmessage=(r,n)=>{Oae(r)||cFe(r)?this._onresponse(r):iFe(r)?this._onrequest(r,n):sFe(r)?this._onnotification(r):this._onerror(new Error(`Unknown message type: ${JSON.stringify(r)}`))},await this._transport.start()}_onclose(){var t;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(t=this.onclose)===null||t===void 0||t.call(this);let n=new gv(xC.ConnectionClosed,"Connection closed");for(let i of r.values())i(n)}_onerror(t){var r;(r=this.onerror)===null||r===void 0||r.call(this,t)}_onnotification(t){var r;let n=(r=this._notificationHandlers.get(t.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(t,r){var n,i,s,a;let l=(n=this._requestHandlers.get(t.method))!==null&&n!==void 0?n:this.fallbackRequestHandler;if(l===void 0){(i=this._transport)===null||i===void 0||i.send({jsonrpc:"2.0",id:t.id,error:{code:xC.MethodNotFound,message:"Method not found"}}).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}let c=new AbortController;this._requestHandlerAbortControllers.set(t.id,c);let u={signal:c.signal,sessionId:(s=this._transport)===null||s===void 0?void 0:s.sessionId,_meta:(a=t.params)===null||a===void 0?void 0:a._meta,sendNotification:o(f=>this.notification(f,{relatedRequestId:t.id}),"sendNotification"),sendRequest:o((f,m,h)=>this.request(f,m,{...h,relatedRequestId:t.id}),"sendRequest"),authInfo:r?.authInfo,requestId:t.id};Promise.resolve().then(()=>l(t,u)).then(f=>{var m;if(!c.signal.aborted)return(m=this._transport)===null||m===void 0?void 0:m.send({result:f,jsonrpc:"2.0",id:t.id})},f=>{var m,h;if(!c.signal.aborted)return(m=this._transport)===null||m===void 0?void 0:m.send({jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(f.code)?f.code:xC.InternalError,message:(h=f.message)!==null&&h!==void 0?h:"Internal error"}})}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,i=Number(r),s=this._progressHandlers.get(i);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(i),l=this._timeoutInfo.get(i);if(l&&a&&l.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){a(c);return}s(n)}_onresponse(t){let r=Number(t.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),Oae(t))n(t);else{let i=new gv(t.error.code,t.error.message,t.error.data);n(i)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)===null||t===void 0?void 0:t.close())}request(t,r,n){let{relatedRequestId:i,resumptionToken:s,onresumptiontoken:a}=n??{};return new Promise((l,c)=>{var u,f,m,h,p;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(t.method),(f=n?.signal)===null||f===void 0||f.throwIfAborted();let g=this._requestMessageId++,x={...t,jsonrpc:"2.0",id:g};n?.onprogress&&(this._progressHandlers.set(g,n.onprogress),x.params={...t.params,_meta:{progressToken:g}});let v=o(_=>{var R;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(R=this._transport)===null||R===void 0||R.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(_)}},{relatedRequestId:i,resumptionToken:s,onresumptiontoken:a}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`))),c(_)},"cancel");this._responseHandlers.set(g,_=>{var R;if(!(!((R=n?.signal)===null||R===void 0)&&R.aborted)){if(_ instanceof Error)return c(_);try{let P=r.parse(_.result);l(P)}catch(P){c(P)}}}),(m=n?.signal)===null||m===void 0||m.addEventListener("abort",()=>{var _;v((_=n?.signal)===null||_===void 0?void 0:_.reason)});let E=(h=n?.timeout)!==null&&h!==void 0?h:DTt,b=o(()=>v(new gv(xC.RequestTimeout,"Request timed out",{timeout:E})),"timeoutHandler");this._setupTimeout(g,E,n?.maxTotalTimeout,b,(p=n?.resetTimeoutOnProgress)!==null&&p!==void 0?p:!1),this._transport.send(x,{relatedRequestId:i,resumptionToken:s,onresumptiontoken:a}).catch(_=>{this._cleanupTimeout(g),c(_)})})}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n={...t,jsonrpc:"2.0"};await this._transport.send(n,r)}setRequestHandler(t,r){let n=t.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,s)=>Promise.resolve(r(t.parse(i),s)))}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){this._notificationHandlers.set(t.shape.method.value,n=>Promise.resolve(r(t.parse(n))))}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function AFe(e,t){return Object.entries(t).reduce((r,[n,i])=>(i&&typeof i=="object"?r[n]=r[n]?{...r[n],...i}:i:r[n]=i,r),{...e})}o(AFe,"mergeCapabilities");var GW=class extends WW{static{o(this,"Client")}constructor(t,r){var n;super(r),this._clientInfo=t,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{}}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=AFe(this._capabilities,t)}assertCapability(t,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[t]))throw new Error(`Server does not support ${t} (required for ${r})`)}async connect(t,r){if(await super.connect(t),t.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:Mae,capabilities:this._capabilities,clientInfo:this._clientInfo}},Uae,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!eFe.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){var r,n,i,s,a;switch(t){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.tools))throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.completions))throw new Error(`Server does not support completions (required for ${t})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(t){var r;switch(t){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"ping":break}}async ping(t){return this.request({method:"ping"},Av,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},$ae,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},Av,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},jae,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},Hae,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},qae,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},Wae,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},Gae,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},Av,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},Av,r)}async callTool(t,r=qW,n){return this.request({method:"tools/call",params:t},r,n)}async listTools(t,r){return this.request({method:"tools/list",params:t},Vae,r)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};d();var aNe=Xe(oNe(),1),Ik=Xe(require("node:process"),1),lNe=require("node:stream");d();var jW=class{static{o(this,"ReadBuffer")}append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
710
710
  `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),o7t(r)}clear(){this._buffer=void 0}};function o7t(e){return uFe.parse(JSON.parse(e))}o(o7t,"deserializeMessage");function sNe(e){return JSON.stringify(e)+`
711
711
  `}o(sNe,"serializeMessage");var s7t=Ik.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function a7t(){let e={};for(let t of s7t){let r=Ik.default.env[t];r!==void 0&&(r.startsWith("()")||(e[t]=r))}return e}o(a7t,"getDefaultEnvironment");var VW=class{static{o(this,"StdioClientTransport")}constructor(t){this._abortController=new AbortController,this._readBuffer=new jW,this._stderrStream=null,this._serverParams=t,(t.stderr==="pipe"||t.stderr==="overlapped")&&(this._stderrStream=new lNe.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,r)=>{var n,i,s,a,l,c;this._process=(0,aNe.default)(this._serverParams.command,(n=this._serverParams.args)!==null&&n!==void 0?n:[],{env:(i=this._serverParams.env)!==null&&i!==void 0?i:a7t(),stdio:["pipe","pipe",(s=this._serverParams.stderr)!==null&&s!==void 0?s:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:Ik.default.platform==="win32"&&l7t(),cwd:this._serverParams.cwd}),this._process.on("error",u=>{var f,m;if(u.name==="AbortError"){(f=this.onclose)===null||f===void 0||f.call(this);return}r(u),(m=this.onerror)===null||m===void 0||m.call(this,u)}),this._process.on("spawn",()=>{t()}),this._process.on("close",u=>{var f;this._process=void 0,(f=this.onclose)===null||f===void 0||f.call(this)}),(a=this._process.stdin)===null||a===void 0||a.on("error",u=>{var f;(f=this.onerror)===null||f===void 0||f.call(this,u)}),(l=this._process.stdout)===null||l===void 0||l.on("data",u=>{this._readBuffer.append(u),this.processReadBuffer()}),(c=this._process.stdout)===null||c===void 0||c.on("error",u=>{var f;(f=this.onerror)===null||f===void 0||f.call(this,u)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var t,r;return this._stderrStream?this._stderrStream:(r=(t=this._process)===null||t===void 0?void 0:t.stderr)!==null&&r!==void 0?r:null}processReadBuffer(){for(var t,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(t=this.onmessage)===null||t===void 0||t.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(t){return new Promise(r=>{var n;if(!(!((n=this._process)===null||n===void 0)&&n.stdin))throw new Error("Not connected");let i=sNe(t);this._process.stdin.write(i)?r():this._process.stdin.once("drain",r)})}};function l7t(){return"type"in Ik.default}o(l7t,"isElectron");var $W=class{constructor(t,r,n){this.transport=null;this.ctx=t,this.mcp=new GW({name:r,version:n})}static{o(this,"MCPStdioServer")}async connect(t){this.transport=new VW(t);try{await this.mcp.connect(this.transport)}catch(r){throw bg.error(this.ctx,"Connection failed:",r),r}}async getToolsList(){let t=[];return this.transport&&(t=(await this.mcp.listTools()).tools.map(n=>({name:n.name,description:n.description,inputSchema:{...n.inputSchema||{},properties:n.inputSchema?.properties||{},type:n.inputSchema?.type||"object"}}))),t}async callTool(t,r){try{let n=await this.mcp.callTool({name:t,arguments:r});return n&&typeof n=="object"?n.content?JSON.stringify(n.content):(bg.error(this.ctx,`Error calling tool ${t}: `+JSON.stringify(n)),`Error calling tool ${t}: `+JSON.stringify(n)):(bg.error(this.ctx,`Error calling tool ${t}: `+String(n)),`Error calling tool ${t}: `+String(n))}catch(n){return bg.error(this.ctx,`Error calling tool ${t}:`,n),"Error calling tool "+t+": "+(n||{message:"Unknown error"})?.message}}async cleanup(){this.transport&&await this.mcp.close()}};d();d();var fl=class extends Error{static{o(this,"CanceledError")}constructor(){super("Canceled"),this.name="Canceled"}};d();var zW=class{constructor(){this._tools=new Map}static{o(this,"ToolRegistry")}registerTool(t){this._tools.set(t.id,t)}unregisterTool(t){return this._tools.delete(t)}getTool(t){return this._tools.get(t)}listTools(){return Array.from(this._tools.values())}};d();d();d();d();var bC={id:"copilot",displayName:"Copilot Language Server",description:"Copilot Language Server tool provider",isFirstPartyTool:!0},wg={id:"copilot-editor",displayName:"Editor",description:"Editor tool provider",isFirstPartyTool:!0},nle=class{static{o(this,"LanguageModelTool")}constructor(t){this.type=t.type,this.toolProvider=t.toolProvider,this.name=t.name,this.displayName=t.displayName??this.name,this.description=t.description,this.displayDescription=t.displayDescription??this.description,this.inputSchema=t.inputSchema,this.id=`${this.toolProvider.id}.${this.name}`,this.nameForModel=this.toolProvider.isFirstPartyTool?this.name:`${this.toolProvider.id}_${this.name}`}},vC=class extends nle{static{o(this,"BaseLanguageModelTool")}constructor(t){super(t)}},uo=class{static{o(this,"LanguageModelTextPart")}constructor(t){this.value=t}},o9=class{static{o(this,"LanguageModelPromptTsxPart")}constructor(t){this.value=t}};var fo=class{static{o(this,"LanguageModelToolResult")}constructor(t,r){this.status=r,this.content=t}},cNe=I.Object({content:I.Array(I.Union([I.Object({value:I.String()}),I.Object({value:I.Unknown()})])),status:I.Optional(I.Union([I.Literal("success"),I.Literal("error"),I.Literal("cancelled")]))}),YW=(r=>(r.Accept="accept",r.Dismiss="dismiss",r))(YW||{}),uNe=I.Object({result:I.Enum(YW)});var Xd=class extends vC{static{o(this,"ClsLanguageModelTool")}constructor(t){super({...t,toolProvider:bC,type:"shared"})}};d();var c7t=new Map([["copilot_semanticSearch","semantic_search"],["copilot_readFile","read_file"],["copilot_listDir","list_dir"],["copilot_getErrors","get_errors"],["copilot_runInTerminal","run_in_terminal"],["copilot_insertEdit","insert_edit_into_file"],["copilot_createFile","create_file"],["copilot_replaceString","replace_string_in_file"],["copilot_updateUserPreferences","update_user_preferences"],["copilot_fileSearch","file_search"],["copilot_findTextInFiles","grep_search"]]),u7t=new Map;for(let[e,t]of c7t)u7t.set(t,e);d();function s9(e){return`[${Bi(e)}](${e})`}o(s9,"formatUriForFileWidget");function _g(e){let t=f7t(e);if(!t)throw new Error(`Invalid input path: ${e}. Be sure to use an absolute path.`);return t}o(_g,"resolvePathInput");function f7t(e){if(e.startsWith("/")||dNe()&&m7t(e)||dNe()&&e.startsWith("\\\\"))return al(e)}o(f7t,"resolveFsUri");function dNe(){return process.platform==="win32"}o(dNe,"isWindows");function d7t(e){return e>=65&&e<=90||e>=97&&e<=122}o(d7t,"isWindowsDriveLetter");function m7t(e){return d7t(e.charCodeAt(0))&&e.charCodeAt(1)===58}o(m7t,"hasDriveLetter");function KW(e){let t="";return e.length>0&&(t=e.map(r=>r instanceof uo?r.value:(r instanceof o9,"")).join(`
712
712
  `)),t===""?"(empty)":t}o(KW,"parseToolResultToString");var JW=class extends Xd{static{o(this,"EditFileTool")}constructor(){super({name:"insert_edit_into_file",displayName:"Edit File",description:`Edit a file in the workspace. Use this tool once per file that needs to be modified, even if there are multiple changes for a file. Generate the "explanation" property first.
@@ -1431,7 +1431,7 @@ Respond in the following locale: ${e}`),r.join(`
1431
1431
  `),""),e.recentCommits.length>0&&r.push("# RECENT REPOSITORY COMMITS (For reference only, do not copy!):",e.recentCommits.map(n=>`- ${n}`).join(`
1432
1432
  `),""),r.push("# CODE CHANGES:",e.changes.join(`
1433
1433
  `),"","<reminder>","Now generate a commit message that describes the CODE CHANGES.","DO NOT COPY commits from RECENT COMMITS, but use them as reference for the commit style.","ONLY return a single markdown code block, NO OTHER PROSE!","```text","commit message goes here","```","</reminder>"),t&&r.push("<custom-instructions>",t,"</custom-instructions>"),r.join(`
1434
- `)}o(xLt,"buildUserMessage");async function vLt(e,t,r){if(r.changes.length===0)return[null,{code:rn.InvalidRequest,message:"No changes provided"}];let n=new ka(e),i=await e.get(ci).getBestChatModelConfig([di.Gpt4oMini,di.Gpt4o,di.Gpt4]),s=[{uri:r.workspaceFolder?r.workspaceFolder:al(process.cwd())}],a=await O9.getInstructions(e,s,{includeCodeGenerationInstructions:!1,includeCommitMessageGenerationInstructions:!0,customIntroduction:"When generating the commit message, please use the following custom instructions provided by the user."}),l=e.get(Wi),c=l.create({skills:[Ug]}),u=new UC({message:"",type:"user"});await l.addTurn(c.id,u);let f=H9({workDoneToken:Ir()});await e.get(bs).begin(c,u,f);let p=(await new $C(e,c,u,t).skillResolver.resolve(Ug))?.head?.name,g=[{role:"system",content:await CLt(r.userLanguage,p)},{role:"user",content:xLt(r,a)}],x=await e.get(Cr).updateExPValuesAndAssignments(),v=await n.fetchResponse({modelConfiguration:i,messages:g,uiKind:"conversationPanel",intentParams:{intent:!0},llmInteraction:wu.user("git-commit",Ir())},t,x);if(v.type!=="success")return[null,{code:rn.InternalError,message:"Failed to generate commit message"}];let E=v.value.match(/```text\n([\s\S]*?)\n```/);return[{commitMessage:E?E[1].trim():v.value.trim()},null]}o(vLt,"handleGitCommitGenerateChecked");var YWe=wo(at(yLt,vLt));d();var JWe=oZ.type,OR;function KWe(e){return{title:"Completion Accepted",command:mR,arguments:[e]}}o(KWe,"makeCommand");async function bLt(e,t,r){OR&&(OR.cancel(),OR.dispose());let n=r.context.triggerKind===1;OR=new Hn.CancellationTokenSource;let i=OR.token,s=new _u([t,i]);r.contextItems&&Y9(e,r.contextItems,r.data);let a=TV(e,r.position,r.textDocument.uri,n);if(a)return[{items:a.map(p=>({command:KWe(Ir()),...p}))},null];let l=await qh(e,r.textDocument,s),c=r.position,u=await IV(e,l,c,s,{isCycling:n,selectedCompletionInfo:r.context.selectedCompletionInfo,formattingOptions:r.formattingOptions,data:r.data});if(!u)return t.isCancellationRequested?[null,{code:rn.RequestCancelled,message:"Request was canceled"}]:i.isCancellationRequested?[null,{code:rn.ServerCancelled,message:"Request was superseded by a new request"}]:[{items:[]},null];let f=e.get(ts);for(let h of u)f.set(h.uuid,{...h,triggerCategory:"ghostText"});return[{items:u.map(h=>({command:KWe(h.uuid),insertText:h.insertText,range:h.range}))},null]}o(bLt,"handleChecked");var ZWe=at(CM,(e,t,r)=>bLt(e,t,r));d();var XWe=lZ.type,UR;async function ILt(e,t,r){UR&&(UR.cancel(),UR.dispose());let n=r.context.triggerKind===1;UR=new Hn.CancellationTokenSource;let i=UR.token,s=new _u([t,i]);r.contextItems&&Y9(e,r.contextItems);let a=await qh(e,r.textDocument,s),l=await sfe(e,a,r.position,s,{promptOnly:!0,isCycling:n,selectedCompletionInfo:r.context.selectedCompletionInfo,formattingOptions:r.formattingOptions,data:r.data});if(l.type!=="promptOnly")throw new Error(`Unexpected result type ${l.type}`);return[{prompt:l.prompt},null]}o(ILt,"handleChecked");var eGe=at(CM,(e,t,r)=>ILt(e,t,r));d();d();function ufe(e){let t=e.indexOf("-----BEGIN CERTIFICATE-----")+27,r=e.indexOf("-----END CERTIFICATE-----"),n=30,i=e.substring(t,t+n)+"..."+e.substring(r-n,r-1);return J9(i)}o(ufe,"asReadableCert");function J9(e){return e.replace(/\s/g,"")}o(J9,"normalizeNewlines");var wLt=I.Object({});async function _Lt(e){return[{certificates:(await e.get(Ja).getAllRootCAs()).map(J9)},null]}o(_Lt,"handleListCertificatesChecked");var tGe=at(wLt,_Lt);d();async function SLt(e,t,r){let n=e.get(Nh);if(r.textDocument.version===void 0)throw new Error("textDocument.version is undefined");let i=nc(r.textDocument.uri);e.get(zp).onUserPositionChange(i,new yo(r.position.line,r.position.character));let s=await n.handleNextEditRequest(i,r.textDocument.version,t);return s?[{edits:s.map(l=>({text:l.edit.text,textDocument:l.edit.textDocument,range:l.edit.range,command:{title:"Accept inline edit",command:mR,arguments:[l.id]}}))},null]:[{edits:[]},null]}o(SLt,"handleChecked");var rGe=at(R5e,SLt);d();var kLt=I.Object({uuid:I.String({minLength:1}),acceptedLength:I.Optional(I.Number({minimum:1}))});function RLt(e,t,r){let n=e.get(ts),i=n.get(r.uuid);if(i){n.delete(r.uuid);let s=BLt(r,i);A4(e,i.triggerCategory,i.insertText,i.offset,i.uri,i.telemetry,s,i.copilotAnnotations)}return["OK",null]}o(RLt,"notifyAcceptedChecked");function BLt(e,t){return e.acceptedLength===void 0?{compType:"full"}:e.acceptedLength<t.insertText.length?{compType:"partial",acceptedLength:e.acceptedLength}:{compType:"full"}}o(BLt,"getSuggestionStatus");var nGe=at(kLt,RLt);d();var DLt=I.Object({uuids:I.Array(I.String())});function PLt(e,t,r){let n=e.get(ts),i=r.uuids.flatMap(s=>n.get(s)??[]);if(i.length>0){let s=i[0];for(let l of r.uuids)n.delete(l);let a=i.map(l=>({completionText:l.displayText,completionTelemetryData:l.telemetry}));kO(e,"ghostText",s.offset,s.uri,a),e.get(m0).resetState()}return["OK",null]}o(PLt,"notifyRejectedChecked");var iGe=at(DLt,PLt);d();var FLt=I.Object({uuid:I.String({minLength:1})});function NLt(e,t,r){let i=e.get(ts).get(r.uuid);return i&&dM(e,i.triggerCategory,i),["OK",null]}o(NLt,"notifyShownChecked");var oGe=at(FLt,NLt);d();var LLt=iIe;function QLt(e,t,r){let n=e.get(cl),i={unregistered:[],registered:[]};return r.providers.forEach(s=>{try{let a=new z9(e,s.id,s.selector);n.registerContextProvider(a),i.registered.push(s.id)}catch{i.unregistered.push(s.id)}}),[i,null]}o(QLt,"registerContextProviders");var sGe=at(LLt,QLt);d();d();var aGe=require("net");function ffe(e){return e.HTTPS_PROXY||e.https_proxy||e.HTTP_PROXY||e.http_proxy}o(ffe,"getProxyFromEnvironment");function MLt(e){return e.NODE_TLS_REJECT_UNAUTHORIZED!=="0"}o(MLt,"getRejectUnauthorizedFromEnvironment");var lGe=I.Object({proxy:I.Optional(I.String()),proxyStrictSSL:I.Optional(I.Boolean()),proxyAuthorization:I.Optional(I.String()),proxyKerberosServicePrincipal:I.Optional(I.String())});function cGe(e){let r={proxy:ffe(e),proxyStrictSSL:MLt(e)},n=e.GH_COPILOT_KERBEROS_SERVICE_PRINCIPAL??e.GITHUB_COPILOT_KERBEROS_SERVICE_PRINCIPAL??e.AGENT_KERBEROS_SERVICE_PRINCIPAL;return n&&(r.proxyKerberosServicePrincipal=n),r}o(cGe,"getHttpSettingsFromEnvironment");function qR(e){(0,aGe.isIPv6)(e)?e="https://["+e+"]":/:\/\//.test(e)||(e=`https://${e}`);let{hostname:t,port:r,username:n,password:i}=new URL(e);return{host:t,port:OLt(r),proxyAuth:ULt(n,i)}}o(qR,"proxySettingFromUrl");function OLt(e){if(!e)return 80;let t=Number(e);if(isNaN(t))throw new TypeError("Invalid proxy port");return t}o(OLt,"parsePort");function ULt(e,t){return!e||!t?"":`${decodeURIComponent(e)}:${decodeURIComponent(t)}`}o(ULt,"getAuth");d();var mfe=I.Object({host:I.String(),port:I.Number(),username:I.Optional(I.String()),password:I.Optional(I.String()),rejectUnauthorized:I.Optional(I.Boolean())}),qLt=I.Object({uri:I.Optional(I.String())}),WLt=I.Object({showEditorCompletions:I.Optional(I.Boolean()),enableAutoCompletions:I.Optional(I.Boolean()),delayCompletions:I.Optional(I.Boolean()),filterCompletions:I.Optional(I.Boolean())}),fGe=I.Object({github:I.Optional(I.Object({copilot:I.Optional(I.Object({}))})),"github-enterprise":I.Optional(qLt),http:I.Optional(lGe),telemetry:I.Optional(I.Object({telemetryLevel:I.Optional(I.String())}))}),hfe=Object.keys(fGe.properties).filter(e=>e!=="github"),GLt=I.Intersect([fGe,WLt]),pfe=I.Object({url:I.Optional(I.String())}),HLt=I.Object({settings:I.Optional(I.Union([I.Object({}),I.Array(I.Unknown(),{maxItems:0})])),networkProxy:I.Optional(mfe),authProvider:I.Optional(pfe)}),uGe=us.Compile(HLt),dfe=us.Compile(GLt);async function dGe(e,t){if(!uGe.Check(t))throw new mc(uGe.Errors(t));let r=Array.isArray(t.settings)?{}:t.settings;r&&await gfe(e,r),t.networkProxy!==void 0&&wV(e,t.networkProxy),t.authProvider&&e.get($n).updateBaseUrl(e,t.authProvider.url),await WR(e,r)}o(dGe,"notifyChangeConfiguration");async function gfe(e,t){for(let i of dfe.Errors(t)){let s=i.path.split("/")?.[1];_0.warn(e,`Invalid ${i.path.slice(1).replace(/\//g,".")} setting:`,i.message),delete t[s]}if(!dfe.Check(t))throw new mc(dfe.Errors(t));let r=e.get(Ff);r.setConfig(St.ShowEditorCompletions,t.showEditorCompletions),r.setConfig(St.DelayCompletions,t.delayCompletions),r.setConfig(St.EnableAutoCompletions,t.enableAutoCompletions),r.setConfig(St.FilterCompletions,t.filterCompletions),t.http&&Afe(e,t.http);let n=t["github-enterprise"];n&&(e.get($n).updateBaseUrl(e,n.uri),e.get(wn).updateEnterpriseConfig(e,n)),t.github?.copilot&&await jLt(e,t.github.copilot)}o(gfe,"applySettingsToConfiguration");async function jLt(e,t){let r=e.get(Ff);for(let n of Object.values(St)){let i=exe(t,n);r.setConfig(n,i)}t.mcp?await VLt(e,t.mcp):await $Lt(e)}o(jLt,"applyCopilotConfiguration");function Afe(e,t){let r=e.get(Ff),n=e.get(Or);if(t.proxy===void 0&&(t=cGe(r.env)),n.rejectUnauthorized=t?.proxyStrictSSL,!t.proxy){n.proxySettings=void 0;return}try{n.proxySettings=qR(t.proxy),t.proxyAuthorization&&(n.proxySettings.proxyAuth=t.proxyAuthorization),t.proxyKerberosServicePrincipal&&(n.proxySettings.kerberosServicePrincipal=t.proxyKerberosServicePrincipal)}catch(i){if(!(i instanceof TypeError))throw i;_0.warn(e,"Invalid proxy URL",t.proxy,i),n.proxySettings=void 0}}o(Afe,"applyHttpConfiguration");function wV(e,t){if(!t){e.get(Or).proxySettings=void 0,e.get(Or).rejectUnauthorized=void 0;return}let r;t.username&&(t.password?r=t.username+":"+t.password:r=t.username),e.get(Or).proxySettings={host:t.host,port:t.port,proxyAuth:r},e.get(Or).rejectUnauthorized=t.rejectUnauthorized??!0}o(wV,"applyNetworkProxyConfiguration");async function VLt(e,t){try{let r=JSON.parse(t);await e.get(kg).updateMCPServers(r)}catch(r){_0.error(e,"Failed to apply MCP configuration",r)}}o(VLt,"applyMCPConfiguration");async function $Lt(e){await e.get(kg).updateMCPServers({})}o($Lt,"removeMCPConfiguration");async function WR(e,t){if(!e.get(Go).getCapabilities().redirectedTelemetry){let r=(t?.telemetry?.telemetryLevel??"all")==="all";await Xy(e,"agent",r)}await e.get(Xr).primeToken()}o(WR,"initializePostConfigurationDependencies");var mGe=I.Object({name:I.String(),version:I.String(),readableName:I.Optional(I.String())}),zLt=I.Object({editorInfo:mGe,editorPluginInfo:mGe,editorConfiguration:I.Optional(I.Object({})),networkProxy:I.Optional(mfe),authProvider:I.Optional(pfe),redirectTelemetry:I.Optional(I.Boolean()),options:I.Optional(I.Object({}))});async function YLt(e,t,r){e.get(dn).setEditorAndPluginInfo(r.editorPluginInfo,r.editorInfo),wH(e,["setEditorInfo is deprecated. Use initializationOptions for editorInfo and editorPluginInfo","and workspace/didChangeConfiguration for editorConfiguration."]),r.editorConfiguration&&await gfe(e,r.editorConfiguration);let n=e.get(Or),i=e.get(Ff).env,s=ffe(i);if(r.editorInfo.name==="VisualStudio"){if(s)n.proxySettings=qR(s);else if(r.networkProxy){wV(e,r.networkProxy);let a=i.GH_COPILOT_KERBEROS_SERVICE_PRINCIPAL??i.GITHUB_COPILOT_KERBEROS_SERVICE_PRINCIPAL??i.AGENT_KERBEROS_SERVICE_PRINCIPAL;n.proxySettings&&a&&(n.proxySettings.kerberosServicePrincipal??=a)}}else r.networkProxy?wV(e,r.networkProxy):s&&(n.proxySettings=qR(s));return r.authProvider&&e.get($n).updateBaseUrl(e,r.authProvider.url),await WR(e,r.editorConfiguration),["OK",null]}o(YLt,"handleSetEditorInfoChecked");var hGe=at(zLt,YLt);d();var KLt=I.Object({options:I.Optional(I.Object({}))});async function JLt(e,t,r){let n=e.get(wn).pendingSignIn?.status;if(n===void 0)return[null,{code:rn.InvalidRequest,message:"No pending sign in"}];let i;try{return i=await n,[i,null]}catch(s){return[null,{code:rn.DeviceFlowFailed,message:String(s)}]}finally{e.get(wn).pendingSignIn=void 0}}o(JLt,"handleSignInConfirmChecked");var pGe=at(KLt,JLt);d();var ZLt=I.Object({options:I.Optional(I.Object({})),githubAppId:I.Optional(I.String())});async function XLt(e,t,r){try{let n=await e.get(wn).checkAndUpdateStatus(e,{githubAppId:r.githubAppId});if(n.status==="OK")return[{status:"AlreadySignedIn",user:n.user},null];let i=r.githubAppId??e.get(ea).findAppIdToAuthenticate(),s=await e.get(Xx).getToken(e,i),a=s.waitForAuth.then(async l=>(e.get(ea).githubAppId=i,await e.get(wn).setPersistedSession({...l,githubAppId:i}),await e.get(wn).checkAndUpdateStatus(e,{freshSignIn:!0})));return e.get(wn).pendingSignIn={verificationUri:s.verification_uri,status:a},[{status:"PromptUserDeviceFlow",userCode:s.user_code,verificationUri:s.verification_uri,expiresIn:s.expires_in,interval:s.interval,command:{command:MH,title:"Sign in with GitHub",arguments:[]}},null]}catch(n){if(!(n instanceof Ks))throw n;return[null,{code:rn.DeviceFlowFailed,message:n.message}]}}o(XLt,"handleSignInInitiateChecked");var yfe=at(ZLt,XLt);d();var eQt=I.Object({githubToken:I.String({minLength:1}),user:I.String({minLength:1}),githubAppId:I.Optional(I.String({minLength:1}))});async function tQt(e,t,r){let n=r.githubToken,i=r.user,s=r.githubAppId;return await e.get(wn).setPersistedSession({accessToken:n,login:i,githubAppId:s}),[await e.get(wn).checkAndUpdateStatus(e),null]}o(tQt,"handleSignInWithGithubTokenChecked");var gGe=at(eQt,tQt);d();var rQt=I.Object({options:I.Optional(I.Object({}))});async function nQt(e,t,r){return await e.get(wn).deletePersistedSession(),[await e.get(wn).checkAndUpdateStatus(e),null]}o(nQt,"handleSignOutChecked");var AGe=at(rQt,nQt);d();var iQt=I.Object({});function oQt(e,t,r){return Fve(e),["OK",null]}o(oQt,"handleTelemetryAuthNotifyDismissedChecked");var yGe=at(iQt,oQt);d();var sQt=I.Object({authSource:I.Union([I.Literal("toast"),I.Literal("goldbar"),I.Literal("menu")])});function aQt(e,t,r){return Pve(e,r.authSource),["OK",null]}o(aQt,"handleTelemetryAuthNotifyShownChecked");var CGe=at(sQt,aQt);d();var lQt=I.Object({authType:I.Union([I.Literal("editorAuth"),I.Literal("deviceFlow")])});function cQt(e,t,r){return NQ(e,r.authType),["OK",null]}o(cQt,"handleTelemetryGitHubLoginSuccessChecked");var xGe=at(lQt,cQt);d();var uQt=I.Object({authSource:I.Union([I.Literal("toast"),I.Literal("goldbar"),I.Literal("menu")]),authType:I.Union([I.Literal("editorAuth"),I.Literal("deviceFlow")])});function fQt(e,t,r){return FQ(e,r.authSource,r.authType),["OK",null]}o(fQt,"handleTelemetryNewGitHubLoginChecked");var vGe=at(uQt,fQt);d();var dQt=I.Object({transaction:I.Optional(I.String()),stacktrace:I.Optional(I.String()),properties:I.Optional(I.Record(I.String(),I.String())),platform:I.Optional(I.String()),exception_detail:I.Optional(I.Array(I.Object({type:I.Optional(I.String()),value:I.Optional(I.String()),stacktrace:I.Optional(I.Array(I.Object({filename:I.Optional(I.String()),lineno:I.Optional(I.Union([I.String(),I.Integer()])),colno:I.Optional(I.Union([I.String(),I.Integer()])),function:I.Optional(I.String()),in_app:I.Optional(I.Boolean())})))})))}),Cfe=class extends Error{constructor(r,n){super(r);this.code=n;this.name="AgentEditorError"}static{o(this,"AgentEditorError")}};function mQt(e,t,r){let n=e.get(go),i=e.get(dn).getEditorPluginInfo(),s=r.properties||{},a;r.platform&&r.exception_detail&&Ng.has(i.name)&&(a=Object.assign({rollup_id:"auto",context:dZ(e),sensitive_context:{},deployed_to:n.getBuildType(),platform:r.platform,exception_detail:r.exception_detail},Ng.get(i.name)),r.transaction&&(a.transaction=r.transaction),n.getBuildType()!=="dev"&&(a.release=`${a.app}@${i.version}`));let l=new Cfe(r.stacktrace??"N/A",i.name);return l.stack=void 0,xa(e,l,void 0,s,a),["OK",null]}o(mQt,"handleTelemetryExceptionChecked");var bGe=at(dQt,mQt);d();d();d();d();d();d();var EGe=Xe(require("tls"));var _V=class{static{o(this,"RootCertificateConfigurator")}#e;constructor(t){this._certificateReader=t.get(Ja)}async enhanceProxySettings(t){let r=await this.getCertificates();return{...t,ca:r}}async getCertificates(){let t=await this._certificateReader.getAllRootCAs();if(t.length!==0)return t}async createSecureContext(){let t=await this._certificateReader.getAllRootCAs(),n=EGe.createSecureContext({_vscodeAdditionalCaCerts:t}),i=n.context;for(let s of t)i.addCACert(s);return{secureContext:n,certs:t}}async applyToRequestOptions(t){this.#e??=this.createSecureContext();let r=await this.#e;t.secureContext=r.secureContext,t.ca=r.certs,t.cert=r.certs}};d();var oT=Xe(MHe(),1),ROn={ALPN_HTTP2:oT.default.ALPN_HTTP2,ALPN_HTTP2C:oT.default.ALPN_HTTP2C,ALPN_HTTP1_1:oT.default.ALPN_HTTP1_1,ALPN_HTTP1_0:oT.default.ALPN_HTTP1_0},{fetch:BOn,context:OHe,reset:DOn,noCache:POn,h1:FOn,keepAlive:NOn,h1NoCache:LOn,keepAliveNoCache:QOn,cacheStats:MOn,clearCache:OOn,offPush:UOn,onPush:qOn,createUrl:WOn,timeoutSignal:GOn,Body:HOn,Headers:UHe,Request:jOn,Response:VOn,AbortController:zV,AbortError:YV,AbortSignal:qHe,FetchBaseError:$On,FetchError:zOn,ALPN_HTTP2:YOn,ALPN_HTTP2C:KOn,ALPN_HTTP1_1:JOn,ALPN_HTTP1_0:ZOn}=oT.default;var sT=class extends Or{constructor(r){super();this.ctx=r;this.name="HelixFetcher";this.createSocketFactory=o((r,n)=>async i=>{i.rejectUnauthorized=n,i.timeout=r.connectionTimeoutInMs,await this.certificateConfigurator.applyToRequestOptions(i);let s=await this.certificateConfigurator.enhanceProxySettings(r);return await this.proxySocketFactory.createSocket(i,s)},"createSocketFactory");this.fetchApi=this.createFetchApi(r),this.certificateConfigurator=new _V(r),this.proxySocketFactory=r.get(Cg)}static{o(this,"HelixFetcher")}set proxySettings(r){this._proxySettings=r,this.fetchApi=this.createFetchApi(this.ctx)}get proxySettings(){return this._proxySettings}set rejectUnauthorized(r){super.rejectUnauthorized=r,this.fetchApi=this.createFetchApi(this.ctx)}get rejectUnauthorized(){return super.rejectUnauthorized}createFetchApi(r){let n=r.get(go);return super.rejectUnauthorized===!1&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0"),OHe({userAgent:`GithubCopilot/${n.getVersion()}`,socketFactory:this._proxySettings?this.createSocketFactory(this._proxySettings,super.rejectUnauthorized):void 0,rejectUnauthorized:super.rejectUnauthorized})}async fetch(r,n){let i=n.signal,s=!1;if(n.timeout){let u=this.makeAbortController();setTimeout(()=>{u.abort(),s=!0},n.timeout),n.signal?.addEventListener("abort",()=>u.abort()),n.signal?.aborted&&u.abort(),i=u.signal}let a={...n,body:n.body?n.body:n.json,signal:i};await this.certificateConfigurator.applyToRequestOptions(a);let l=await this.certificateConfigurator.getCertificates();this.fetchApi.setCA(l);let c=await this.fetchApi.fetch(r,a).catch(u=>{throw s?new z7(`Request to <${r}> timed out after ${n.timeout}ms`,u):u});return new By(c.status,c.statusText,c.headers,()=>c.text(),()=>c.body)}disconnectAll(){return this.fetchApi.reset()}makeAbortController(){return new zV}};d();d();var KR=require("fs");var aT=class extends bo{static{o(this,"LocalFileSystem")}async readFileString(t){return(await KR.promises.readFile(wl(t))).toString()}async stat(t){let{targetStat:r,lstat:n,stat:i}=await this.statWithLink(wl(t));return{ctime:r.ctimeMs,mtime:r.mtimeMs,size:r.size,type:this.getFileType(r,n,i)}}async readDirectory(t){let r=wl(t),n=await KR.promises.readdir(r,{withFileTypes:!0}),i=[];for(let s of n)i.push([s.name,s.isFile()?1:2]);return i}async statWithLink(t){let r=await KR.promises.lstat(t);if(r.isSymbolicLink())try{let n=await KR.promises.stat(t);return{lstat:r,stat:n,targetStat:n}}catch{}return{lstat:r,targetStat:r}}getFileType(t,r,n){let i=0;return t.isFile()&&(i=1),t.isDirectory()&&(i=2),r.isSymbolicLink()&&n&&(i|=64),i}};d();var KV=class extends Uh{constructor(r=[]){super();this._agents=r}static{o(this,"TestRemoteAgentRegistry")}agents(){return this._agents}};d();var JV=class extends Xa{constructor(){super(...arguments);this.prompts=[];this.fetchResults=[];this.diffs=[]}static{o(this,"TestConversationInspector")}shouldInspect(){return!0}inspectPrompt(r){this.shouldInspect()&&this.prompts.push(r)}inspectFetchResult(r){this.shouldInspect()&&this.fetchResults.push(r)}documentDiff(r){this.shouldInspect()&&this.diffs.push(r)}};d();var Zfe=class extends Ja{constructor(r){super();this.certificates=r}static{o(this,"TestCertificateReader")}getAllRootCAs(){return this.certificates}},GHe=o(e=>new Zfe(e),"createTestCertificateReader");function tde(e,t,r){let n=new Xfe;n.set("x-github-request-id","1");for(let[i,s]of Object.entries(r||{}))n.set(i,s);return new By(e,"status text",n,()=>Promise.resolve(t??""),()=>null)}o(tde,"createFakeResponse");function HHe(e,t,r){let n;return typeof t=="string"?n=t:n=JSON.stringify(t),tde(e,n,Object.assign({"content-type":"application/json"},r))}o(HHe,"createFakeJsonResponse");var JR=class extends Or{constructor(){super(...arguments);this.name="FakeFetcher"}static{o(this,"FakeFetcher")}disconnectAll(){throw new Error("Method not implemented.")}makeAbortController(){return new ede}};var ZV=class extends JR{static{o(this,"NoFetchFetcher")}fetch(t,r){throw new Error("NoFetchFetcher does not support fetching")}};var Xfe=class{constructor(){this.headers=new Map}static{o(this,"FakeHeaders")}append(t,r){this.headers.set(t.toLowerCase(),r)}delete(t){this.headers.delete(t.toLowerCase())}get(t){return this.headers.get(t.toLowerCase())??null}has(t){return this.headers.has(t.toLowerCase())}set(t,r){this.headers.set(t.toLowerCase(),r)}entries(){return this.headers.entries()}keys(){return this.headers.keys()}values(){return this.headers.values()}[Symbol.iterator](){return this.headers.entries()}},ede=class{constructor(){this.signal={aborted:!1,addEventListener:o(()=>{},"addEventListener"),removeEventListener:o(()=>{},"removeEventListener")}}static{o(this,"FakeAbortController")}abort(){this.signal.aborted=!0}};d();function iUt(e){return{modelId:"gpt-3.5-turbo",modelFamily:e,uiName:"Test GPT",maxRequestTokens:6144,maxResponseTokens:2048,baseTokensPerMessage:3,baseTokensPerName:1,baseTokensPerCompletion:3,tokenizer:"cl100k_base",isExperimental:!1,stream:!0,toolCalls:!0}}o(iUt,"fakeChatModelConfiguration");function oUt(e){return{modelId:"embedding-test",modelFamily:e,maxBatchSize:1,maxTokens:50,tokenizer:"cl100k_base"}}o(oUt,"fakeEmbeddingModelConfiguration");var XV=class extends ci{static{o(this,"TestModelConfigurationProvider")}getBestChatModelConfig(t){let r=t[0];return Promise.resolve(iUt(r))}getFirstMatchingEmbeddingModelConfiguration(t){return Promise.resolve(oUt(t))}};d();var e$=class extends ic{constructor(){super(...arguments);this.openedUrls=[];this.opened=new o8}static{o(this,"TestUrlOpener")}open(r){return this.openedUrls.push(r),this.opened.resolve(),Promise.resolve()}},t$=class extends va{constructor(){super();this.sentMessages=[];this.warningPromises=[]}static{o(this,"TestNotificationSender")}performDismiss(){this.actionToPerform="DISMISS"}performAction(r){this.actionToPerform=r}showWarningMessage(r,...n){this.sentMessages.push(r);let i;if(this.actionToPerform)if(this.actionToPerform==="DISMISS")i=Promise.resolve(void 0);else{let s=n.find(a=>a.title===this.actionToPerform);i=s?Promise.resolve(s):Promise.resolve(void 0)}else i=n?Promise.resolve(n[0]):Promise.resolve(void 0);return this.warningPromises.push(i),i}async waitForWarningMessages(){await Promise.all(this.warningPromises)}};d();function jHe(e,t,r,n){return z1.create(dCe(e),t,r,n,t)}o(jHe,"createTextDocument");var rde=class extends Hr{constructor(r){super(r);this._openTextDocuments=[];this._notebookDocuments=new Map;this._workspaceFolders=[];this._focusSubscribers=[];this._changeSubscribers=[];this._openSubscribers=[];this._closeSubscribers=[];this.onDidFocusTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._focusSubscribers.push(s),{dispose:o(()=>{this._focusSubscribers=this._focusSubscribers.filter(a=>a!==s)},"dispose")}},"onDidFocusTextDocument");this.onDidChangeTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._changeSubscribers.push(s),{dispose:o(()=>{this._changeSubscribers=this._changeSubscribers.filter(a=>a!==s)},"dispose")}},"onDidChangeTextDocument");this.onDidOpenTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._openSubscribers.push(s),{dispose:o(()=>{this._openSubscribers=this._openSubscribers.filter(a=>a!==s)},"dispose")}},"onDidOpenTextDocument");this.onDidCloseTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._closeSubscribers.push(s),{dispose:o(()=>{this._closeSubscribers=this._closeSubscribers.filter(a=>a!==s)},"dispose")}},"onDidCloseTextDocument")}static{o(this,"SimpleTestTextDocumentManager")}init(r){this._workspaceFolders=r.map(n=>({uri:n.uri,name:n.name??Bi(n.uri)}))}async readTextDocumentFromDisk(r){return super.readTextDocumentFromDisk(r)}getTextDocumentsUnsafe(){return this._openTextDocuments}setTextDocument(r,n,i){let s=jHe(r,n,0,i);return this._openTextDocuments.push(s),s}updateTextDocument(r,n){let i=this._openTextDocuments.findIndex(a=>a.uri===r.toString());if(i<0)throw new Error("Document not found");let s=this._openTextDocuments[i];this._openTextDocuments[i]=jHe(r,s.clientLanguageId,s.version+1,n)}setNotebookDocument(r,n){this._notebookDocuments.set(r.uri.replace(/#.*/,""),n)}findNotebook({uri:r}){return this._notebookDocuments.get(r.replace(/#.*/,""))}getWorkspaceFolders(){return this._workspaceFolders}emitEvent(r){switch(r.eventName){case"focus":this._focusSubscribers.forEach(n=>n(r.args));break;case"change":this._changeSubscribers.forEach(n=>n(r.args));break;case"open":this._openSubscribers.forEach(n=>n(r.args));break;case"close":this._closeSubscribers.forEach(n=>n(r.args));break}}},r$=class extends rde{constructor(r){super(r);this.contents=new Map}static{o(this,"TestTextDocumentManager")}readTextDocumentFromDisk(r){return Promise.resolve(this.contents.get(r))}setDiskContents(r,n){this.contents.set(r,n)}};var nde=class extends Wa{static{o(this,"NullLog")}logIt(...t){}};function sUt(e){let t=new JI;return t.set(Wp,e),t.set(Dx,e),t.set(go,new go),t.set(fd,new fd({debug:!1,verboseLogging:!1,testMode:!0,simulation:!1})),t.set(Ja,GHe([])),t.set(Cg,fW(t)),t.set(Tp,new Tp),t.set(Vm,new cN),t.set(cf,new cf),t.set(Fp,new Fp),t.set(Lp,new Lp),t.set(ec,new ec(t,"tid=test",!0)),t.set(Ds,new Ds),t.set(va,new t$),t.set(ic,new e$),t.set(Op,new D8),t.set(Wa,new nde),t.set(Y0,new Y0),t.set(_s,new _s("test-session","test-machine")),t.set($n,new z6(t)),t.set(Ku,new Ku),Xy(t,"copilot-test",!0),t.set(Cr,new Cr(t)),t.set(oh,new oh),t.set(lf,new lf),t.set(Km,new BI),t.set(Xr,new XC("tid=test")),t.set(zi,new AN),t.set(Bo,new Bo),t.set(ch,IO(t)),t.set(m0,new m0),t.set(Nd,new Nd),t.set(cA,cA.default),t.set(Tf,new Tf),t.set(gd,new gd(t,!1)),t.set(ea,new ea),t.set(Pn,new Pn(t)),t.set(af,new LQ),t.set(kl,new kl),t.set(cl,yO(t,async(r,n,i)=>n.find(s=>s==="*")?1:n.find(s=>typeof s!="string"&&s.language===i.languageId)?10:0)),aUt(t),t.set(ih,new ih(t)),t.set(Go,new Go),t}o(sUt,"_createBaselineContext");function aUt(e){e.set(Wi,new Wi(e)),e.set(bs,new bs(e)),e.set(pc,new pc(e)),e.set(el,new el),e.set(Gl,new Gl),e.set(Xa,new JV),e.set(om,new om(e,[])),e.set(ci,new XV),e.set(Uh,new KV),e.set(Mg,new Mg(e)),e.set(qC,new qC),e.set(ua,new ua(e)),e.set(hc,new hc),e.set(Lf,new Lf)}o(aUt,"registerConversation");function VHe(){let e=sUt(new Dx(new DI,new Map));return e.set(Or,new ZV),e.set(dn,new ide),e.set(Hr,new r$(e)),e.set(bo,new aT),e.set(Qc,new Qc(e)),e.set(Za,new Za(e)),e.set(fc,new pW(e)),CH(e),e}o(VHe,"createLibTestingContext");var ide=class extends dn{constructor(r={name:"lib-tests-plugin",version:"2"},n={name:"lib-tests-editor",version:"1"},i=[{name:"lib-tests-related-plugin",version:"3"}]){super();this.editorPluginInfo=r;this.editorInfo=n;this.relatedPluginInfo=i}static{o(this,"LibTestsEditorInfo")}getEditorInfo(){return this.editorInfo}getEditorPluginInfo(){return this.editorPluginInfo}getRelatedPluginInfo(){return this.relatedPluginInfo}};var zHe=Xe(require("fs"));var $He=`${process.env.HOME}/.copilot-testing-gh-token`,n$,i$;async function YHe(e){e.forceSet(Xr,new XC(await lUt()))}o(YHe,"setTestingCopilotTokenManager");var lUt=o(async()=>{if(process.env.GH_COPILOT_IDE_TOKEN)return process.env.GH_COPILOT_IDE_TOKEN;let e=process.env.GH_COPILOT_TOKEN??"";if(/=/.test(e))return e;if(i$)return i$;let t=e||process.env.GITHUB_COPILOT_TOKEN||await cUt(),r=VHe(),n=new sT(r);return r.forceSet(Or,n),i$=hN(r,{...bI({}),accessToken:t}).then(i=>{if(i.kind==="success")return i.envelope.token;throw new Ks('Could not fetch testing Copilot token. Try running "npm run get_token" again?')}),i$},"getCopilotToken");async function cUt(){try{n$??=(await zHe.promises.readFile($He)).toString().trim()}catch{n$??=process.env.GITHUB_TOKEN??""}if(!n$)throw new Error(`Tests: either GH_COPILOT_IDE_TOKEN, GH_COPILOT_TOKEN, or GITHUB_TOKEN must be set, or there must be a GitHub token from an app with access to Copilot in ${$He}. Run "npm run get_token" to get one.`);return n$}o(cUt,"getTestingGitHubToken");function KHe(e){return new q1({token:`test token ${Ir()}`,refresh_in:0,expires_at:0,...e})}o(KHe,"createTestCopilotToken");var ode=class extends Xr{constructor(r){super();this.copilotToken=r;this.wasReset=!1;this.ghSession=JHe()}static{o(this,"FakeCopilotTokenManagerFromCopilotToken")}async getGitHubSession(){return Promise.resolve(this.ghSession)}getToken(){return Promise.resolve(this.copilotToken)}resetToken(){this.wasReset=!0}checkCopilotToken(){return Promise.resolve({status:"OK"})}},o$=class extends ode{static{o(this,"TestCopilotTokenManager")}constructor(t){super(KHe(t))}},XC=class extends o${static{o(this,"FixedCopilotTokenManager")}constructor(t){super({token:t})}};function JHe(e={}){return bI({accessToken:Ir(),...e})}o(JHe,"testGitHubSession");var s$=class extends wn{static{o(this,"NotAuthManager")}constructor(){super(null,null)}getPersistedAuthRecord(){return Promise.resolve(void 0)}checkAndUpdateStatus(){return Promise.resolve({status:"NotSignedIn"})}},lT=class extends wn{constructor(r=new XC("tid=valid-copilot-token"),n=""){super(null,r);this.githubAppId=n}static{o(this,"AlwaysAuthManager")}getPersistedAuthRecord(){return Promise.resolve({user:"user",oauth_token:"",githubAppId:this.githubAppId})}};var uUt=I.Object({options:I.Optional(I.Object({}))});async function fUt(e,t,r){return e.forceSet(wn,new lT),e.get(Xr).resetToken(),e.get(zi).forceNormal(),await new Promise(n=>setTimeout(n,0)),["OK",null]}o(fUt,"handleTestingAlwaysAuthChecked");var ZHe=at(uUt,fUt);d();var dUt=I.Object({messages:I.Array(I.Object({role:I.Enum(Ml),content:I.String(),name:I.Optional(I.String())})),modelFamily:I.Optional(I.Enum(di)),stop:I.Optional(I.Array(I.String())),conversationOptions:I.Optional(I.Object({maxResponseTokens:I.Optional(I.Number()),temperature:I.Optional(I.Number())}))});async function mUt(e,t,r){let n=new ka(e),i=await e.get(ci).getBestChatModelConfig([r.modelFamily??di.Gpt35turbo]),s=await __(e,"","");return[await n.fetchResponse({modelConfiguration:i,messages:r.messages,uiKind:"conversationIntegrationTest",stop:r.stop,intentParams:{intent:!0},llmInteraction:wu.user("test",Ir())},t,s),null]}o(mUt,"handleChatMLChecked");var XHe=wo(at(dUt,mUt));d();d();var eje=require("crypto"),tje=require("http"),rje=require("stream"),nje=require("util"),uT=Xe(eh());var hUt=9e4,pUt=new uT.ProtocolRequestType("copilot/fetch"),gUt=new uT.ProtocolRequestType("copilot/fetchCancel"),AUt=new uT.ProgressType,yUt=new uT.ProtocolRequestType("copilot/fetchDisconnectAll"),$g=class extends Error{static{o(this,"EditorFetcherError")}constructor(t){super(t),this.name="EditorFetcherError"}},cT=class extends Or{constructor(r){super();this.ctx=r;this.name="EditorFetcher";this.userAgent=`GithubCopilot/${r.get(go).getVersion()}`}static{o(this,"EditorFetcher")}disconnectAll(){return this.ctx.get(jr).connection.sendRequest(yUt,{})}makeAbortController(){return new zV}async fetch(r,n){n.headers||={},n.headers["user-agent"]=this.userAgent;let{signal:i}=n,s=this.ctx.get(jr).connection,a=(0,eje.randomUUID)(),l=new Hn.CancellationTokenSource,c=new rje.PassThrough,u=o(()=>{s.sendRequest(gUt,{workDoneToken:a})},"sendCancelRequest"),f=o(()=>{c.emit("error",new YV("EditorFetch request aborted")),c.end()},"destroyBodyStream");if(i){if(!(i instanceof qHe))throw new $g("EditorFetcher received unexpected abort signal");if(i.aborted)throw new YV("EditorFetcher signal aborted before fetch");i.addEventListener("abort",u)}s.onProgress(AUt,a,h=>{h.kind==="end"?(i?.removeEventListener("abort",u),i?.removeEventListener("abort",f),h.error&&c.emit("error",new $g(h.error)),c.end()):h.kind==="report"&&c.write(h.chunk)});let m=await new Promise((h,p)=>{let g=setTimeout(()=>{p(new $g("Request timed out from lsp server"))},n.timeout??hUt),x=o(()=>{p(new YV("EditorFetcher request aborted"))},"rejectIfAborted");i?.addEventListener("abort",x),s.sendRequest(pUt,xUt(r,a,n),l.token).then(h).catch(v=>{let E="EditorFetcher request failed";v&&typeof v=="object"&&"message"in v&&(E+=`: ${String(v.message)}`),v&&typeof v=="object"&&"data"in v&&(E+=`: ${(0,nje.inspect)(v.data)}`),p(new $g(E))}).finally(()=>{i?.removeEventListener("abort",x),clearTimeout(g)})});if(!m.status)throw new $g("EditorFetcher received invalid response");return i?.addEventListener("abort",f),new By(m.status,tje.STATUS_CODES[m.status]??"",new UHe(m.headers),()=>CUt(c),()=>c)}};function CUt(e){return new Promise((t,r)=>{let n="";e.on("error",r),e.on("end",()=>t(n)),e.on("data",i=>n+=String(i))})}o(CUt,"consumeStream");function xUt(e,t,r){let{timeout:n,method:i}=r,s=r.headers??{},a=r.json?JSON.stringify(r.json):r.body;return r.json&&(s["content-type"]="application/json"),{url:e,headers:s,body:a,timeout:n,method:i,workDoneToken:t}}o(xUt,"convertOptionsToParams");var vUt=I.Object({url:I.String(),headers:I.Optional(I.Record(I.String(),I.String())),body:I.Optional(I.String()),timeout:I.Optional(I.Number()),method:I.Optional(I.Union([I.Literal("GET"),I.Literal("POST")])),cancelBeforeRequest:I.Optional(I.Boolean()),cancelAfterRequest:I.Optional(I.Boolean()),cancelAfterFirstChunk:I.Optional(I.Boolean())});async function bUt(e,t,r){let n=new cT(e),i=n.makeAbortController(),s=i.signal,{url:a,cancelBeforeRequest:l,cancelAfterRequest:c,cancelAfterFirstChunk:u,...f}=r;l&&i.abort();let m=n.fetch(a,{signal:s,...f});c&&i.abort();let h;try{h=await m}catch(x){return[{error:`Fetch stream error: ${x instanceof $g?x.message:String(x)}`},null]}let{status:p}=h,g=Object.fromEntries(Array.from(h.headers));try{if(u){let v=h.body();for await(let E of v){let b=E.toString();return i.abort(),[{status:p,headers:g,body:b},null]}}let x=await h.text();return[{status:p,headers:g,body:x},null]}catch(x){return[{error:`Fetch stream error: ${x instanceof $g?x.message:String(x)}`},null]}}o(bUt,"handleTestingFetchChecked");var ije=at(vUt,bUt);d();var EUt=I.Object({});async function IUt(e,t,r){return await e.get(Bo).flush(),["OK",null]}o(IUt,"handleTestingFlushPromiseQueueChecked");var oje=at(EUt,IUt);d();var TUt=I.Object({filePath:I.String(),code:I.String(),offset:I.Number(),languageId:I.String(),timeout:I.Optional(I.Number()),waitForContext:I.Optional(I.Boolean())});async function wUt(e,t,r){try{await e.get(Fg).start();let n=e.get(Fv),i=r.timeout??1e3,s=Date.now(),a=[],l=!0;for(;l;)try{a=await n.indexClient.getContext(r.filePath,r.code,r.offset,r.languageId,t)}catch{}finally{l=(r.waitForContext??!1)&&a.length==0&&Date.now()-s<i}return[{initialized:!0,context:a},null]}catch{return[{initialized:!1,context:[]},null]}}o(wUt,"handleTestingGetContextChecked");var sje=at(TUt,wUt);d();var _Ut=I.Object({uri:I.String()});async function SUt(e,t,r){let i=await e.get(Hr).getTextDocument(r);return[{uri:r.uri,languageId:i?.clientLanguageId??"unknown",version:i?.version??-1,text:i?.getText()??""},null]}o(SUt,"handleGetDocumentChecked");var aje=at(_Ut,SUt);d();d();d();var a$=Xe(require("assert"));var c2=class{constructor(){this.events=[];this.errors=[]}static{o(this,"TelemetrySpy")}sendTelemetryEvent(t,r={},n={}){this.events.push({name:t,properties:r,measurements:n})}sendTelemetryErrorEvent(t,r={},n={},i){this.errors.push({name:t,properties:r,measurements:n,errorProps:i})}sendTelemetryException(t,r={},n={}){this.events.push({name:"error.exception",properties:{message:t.message,...r},measurements:n})}dispose(){return Promise.resolve()}get hasEvent(){return this.events.length>0}get hasError(){return this.errors.length>0}get exceptions(){return this.events.filter(t=>t.name==="error.exception")}get hasException(){return this.exceptions.length>0}get firstEvent(){return this.events[0]}get firstError(){return this.errors[0]}get firstException(){return this.exceptions[0]}eventsMatching(t){return this.events.filter(t)}eventByName(t){let r=this.events.filter(n=>n.name===t);return a$.strictEqual(r.length,1,`Expected exactly one event with name ${t}`),r[0]}errorsMatching(t){return this.errors.filter(t)}exceptionsMatching(t){return this.exceptions.filter(t)}assertHasProperty(t){a$.ok(this.eventsMatching(r=>r.name!=="ghostText.produced").every(r=>t(r.properties)))}};var fT=class extends Bo{static{o(this,"TestPromiseQueue")}async awaitPromises(){await Promise.all(this.promises)}};var kUt=I.Object({});async function RUt(e,t,r){let n=e.get(Ds),i=n.getReporter(e),s=n.getRestrictedReporter(e);if(!(i instanceof c2)||!(s instanceof c2||s===void 0))return[null,{code:rn.InternalError,message:"Telemetry is not being captured. You must first call testing/setTelemetryCapture."}];let a=e.get(Bo);return a instanceof fT&&await a.awaitPromises(),[{standard:{events:i.events,errors:i.errors},restricted:{events:s?.events||[],errors:s?.errors||[]}},null]}o(RUt,"handleTestingGetTelemetryChecked");var lje=at(kUt,RUt);d();var BUt=I.Object({options:I.Optional(I.Object({}))});async function DUt(e,t,r){e.forceSet(wn,new s$),e.get(Xr).resetToken();try{await e.get(Xr).getToken()}catch{}return await new Promise(n=>setTimeout(n,0)),["OK",null]}o(DUt,"handleTestingNeverAuthChecked");var cje=at(BUt,DUt);d();d();var sde=class extends JR{static{o(this,"ExpConfigFetcher")}constructor(t){super(),this.fullConfig={Features:[],Flights:{},Configs:[{Id:"vscode",Parameters:t.Parameters}],ParameterGroups:[],AssignmentContext:t.AssignmentContext}}fetch(t,r){return t.endsWith("telemetry")?Promise.resolve(HHe(200,this.fullConfig)):Promise.resolve(tde(404,""))}},l$=class extends sde{constructor(r,n){super(r);this.delegate=n}static{o(this,"ExpConfigFetcherWithDelegate")}fetch(r,n){return r.endsWith("telemetry")?super.fetch(r,n):this.delegate.fetch(r,n)}makeAbortController(){return this.delegate.makeAbortController()}};var PUt=I.Object({expFlags:I.Record(I.String(),I.Union([I.String(),I.Number(),I.Boolean()]))});function FUt(e,t,r){if(r.expFlags){let n={AssignmentContext:"assignmentcontext",Parameters:{...r.expFlags}};e.forceSet(Or,new l$(n,e.get(Or)))}return["OK",null]}o(FUt,"handleTestingOverrideExpFlagsChecked");var uje=at(PUt,FUt);d();var NUt=I.Object({rules:dte});function LUt(e,t,r){let n=e.get(Qc);return n?(n.setTestingRules(r.rules),["OK",null]):[null,{code:rn.InternalError,message:"Could not set content exclusion rules"}]}o(LUt,"handleTestingSetContentExclusionRulesChecked");var fje=at(NUt,LUt);d();var QUt=I.Object({workDoneToken:I.Union([I.String(),I.Number()]),chunks:I.Array(I.String()),followUp:I.Optional(I.String()),suggestedTitle:I.Optional(I.String()),skills:I.Optional(I.Array(I.String())),references:I.Optional(I.Array(W9)),options:I.Optional(I.Object({}))});function MUt(e,t,r){return e.get(t2).add(r.workDoneToken,r.chunks,r.followUp,r.suggestedTitle,r.skills,r.references),["OK",null]}o(MUt,"handleTestingSetSyntheticTurnsChecked");var dje=at(QUt,MUt);d();var OUt=I.Object({telemetryCapture:I.Boolean()});async function UUt(e,t,r){return r.telemetryCapture?(await Xy(e,"agent",!1),e.get(Ds).setReporter(new c2),e.get(Ds).setRestrictedReporter(new c2),e.forceSet(Bo,new fT)):(await Xy(e,"agent",!0),e.forceSet(Bo,new Bo)),["OK",null]}o(UUt,"handleTestingSetTelemetryCaptureChecked");var mje=at(OUt,UUt);d();var qUt=I.Object({});async function WUt(e,t,r){let n=e.get(va),i=e.get(Wa);return await n.showWarningMessage("This is a test message",{title:"Some Action"}).then(a=>s(3,"response from message request",a?.title)).catch(a=>s(1,"error sending show message request",a)),["OK",null];function s(a,l,c){return i.logIt(e,a,"triggerShowMessage",`${l} (${String(c)})`)}o(s,"sendNotification")}o(WUt,"handleTriggerShowMessageChecked");var hje=at(qUt,WUt);d();var GUt=I.Object({options:I.Optional(I.Object({})),githubAppId:I.Optional(I.String())});async function HUt(e,t,r){return await YHe(e),e.forceSet(wn,new lT(e.get(Xr),r.githubAppId)),["OK",null]}o(HUt,"handleTestingUseTestingTokenChecked");var pje=at(GUt,HUt);d();var jUt=I.Object({});async function VUt(e,t,r){return await new R9().uninstall(e),["OK",null]}o(VUt,"handleUninstallChecked");var gje=at(jUt,VUt);d();var $Ut=oIe;function zUt(e,t,r){let n=e.get(cl),i={unregistered:[],notUnregistered:[]};return r.providers.forEach(s=>{try{n.unregisterContextProvider(s.id),i.unregistered.push(s.id)}catch{i.notUnregistered.push(s.id)}}),[i,null]}o(zUt,"unregisterContextProviders");var Aje=at($Ut,zUt);d();var ade=Xe(require("os"));var YUt=I.Object({expectedCertificate:I.String()});async function KUt(e,t,r){let i=(await uW(e).getAllRootCAs()).map(J9),s=J9(r.expectedCertificate);return i.includes(s)?[{status:!0,message:"Certificate verified"},null]:[{status:!1,message:`expected certificate not found - Expected to find certificate ${ufe(s)}. Only found those installed on the system:${ade.EOL}${i.map(a=>"- "+ufe(a)).join(ade.EOL)}`},null]}o(KUt,"handleVerifyCertificateChecked");var yje=at(YUt,KUt);d();var JUt=I.Object({});async function ZUt(){return[{status:!!await new hk().load()},null]}o(ZUt,"handleVerifyKerberosChecked");var Cje=at(JUt,ZUt);d();var XUt=I.Object({source:I.String(),version:I.Number(),uri:I.String()});async function eqt(e,t,r){let i=await e.get(Hr).getTextDocument(r);return i?i.getText()!==r.source?[{status:!1,message:`Source mismatch: [State] ${i.getText()} !== [Request] ${r.source}`},null]:i.version!==r.version?[{status:!1,message:`Version mismatch: [State] ${i.version} !== [Request] ${r.version}`},null]:[{status:!0,message:""},null]:[{status:!1,message:`Document not found: <${r.uri}>`},null]}o(eqt,"handleVerifyStateChecked");var xje=at(XUt,eqt);d();var tqt=I.Object({});function rqt(e,t,r){return[e.get(Hr).getWorkspaceFolders().map(i=>{let s=new URL(i.uri),a=decodeURIComponent(s.pathname);return{...i,path:a}}),null]}o(rqt,"handleVerifyWorkspaceStateChecked");var vje=at(tqt,rqt);var Xv=class{constructor(t){this.handlers=t}static{o(this,"MethodHandlers")}};function bje(){let e=new Map;return e.set(JWe.method,ZWe),e.set(XWe.method,eGe),e.set("getCompletions",GWe),e.set("getCompletionsCycling",HWe),e.set("getPanelCompletions",$We),e.set(_We.method,SWe),e.set("getVersion",zWe),e.set("setEditorInfo",hGe),e.set("checkStatus",LOe),e.set("checkFileStatus",NOe),e.set("signInInitiate",yfe),e.set("signIn",yfe),e.set("signInConfirm",pGe),e.set("signInWithGithubToken",gGe),e.set("signOut",AGe),e.set("notifyShown",oGe),e.set("notifyAccepted",nGe),e.set("notifyRejected",iGe),e.set("telemetry/exception",bGe),e.set("telemetry/authNotifyDismissed",yGe),e.set("telemetry/authNotifyShown",CGe),e.set("telemetry/gitHubLoginSuccess",xGe),e.set("telemetry/newGitHubLogin",vGe),e.set("textDocument/copilotInlineEdit",rGe),e.set("testing/overrideExpFlags",uje),e.set("testing/alwaysAuth",ZHe),e.set("testing/neverAuth",cje),e.set("testing/useTestingToken",pje),e.set("testing/setCompletionDocuments",OWe),e.set("testing/setPanelCompletionDocuments",TWe),e.set("testing/triggerShowMessageRequest",hje),e.set("testing/getTelemetry",lje),e.set("testing/setTelemetryCapture",mje),e.set("testing/flushPromiseQueue",oje),e.set("testing/getDocument",aje),e.set("testing/chatml",XHe),e.set("testing/setSyntheticTurns",dje),e.set("testing/fetch",ije),e.set("testing/setContentExclusionRules",fje),e.set("testing/setCopilotEditsResponse",hWe),e.set("testing/getContext",sje),e.set("uninstall",gje),e.set("debug/diagnostics",DWe),e.set("debug/listCertificates",tGe),e.set("debug/verifyState",xje),e.set("debug/verifyCertificate",yje),e.set("debug/verifyKerberos",Cje),e.set("debug/verifyWorkspaceState",vje),e.set("context/registerProviders",sGe),e.set("context/unregisterProviders",Aje),e.set("conversation/preconditions",aWe),e.set("conversation/persistence",iWe),e.set("conversation/create",rWe),e.set("conversation/turn",fWe),e.set("conversation/turnDelete",dWe),e.set("conversation/destroy",nWe),e.set("conversation/rating",lWe),e.set("conversation/copyCode",Wqe),e.set("conversation/insertCode",Gqe),e.set("conversation/templates",uWe),e.set("conversation/agents",qqe),e.set("conversation/registerTools",cWe),e.set("copilot/models",xWe),e.set("copilot/setModelPolicy",vWe),e.set("copilot/codeReview",mWe),e.set("git/commitGenerate",YWe),e.set("editConversation/create",pWe),e.set("editConversation/turn",AWe),e.set("editConversation/turnDelete",yWe),e.set("editConversation/destroy",gWe),e.set("mcp/getTools",CWe),new Xv(e)}o(bje,"getAllMethods");d();d();d();var Eje=Xe(eh());var zg=class{constructor(t){this.ctx=t}static{o(this,"AbstractNotification")}get type(){return new Eje.NotificationType(this.name)}};var lde=class extends zg{constructor(){super(...arguments);this.name=tZ.method;this.params=y5e}static{o(this,"DidChangeAuthNotificationHandler")}handle(r){let n=this.ctx.get(wn);r?.handle&&r?.accessToken?n.setTransientSession({accessToken:r.accessToken,login:r.handle,githubAppId:r.githubAppId}):n.setTransientSession(null)}},Ije=[lde];d();var cde=class extends zg{constructor(){super(...arguments);this.name=sZ.method;this.params=w5e}static{o(this,"DidShowCompletionNotificationHandler")}handle(r){let n=r.item.command.arguments[0],s=this.ctx.get(ts).get(n);s&&B6e(this.ctx,s)}},ude=class extends zg{constructor(){super(...arguments);this.name=cZ.method;this.params=B5e}static{o(this,"DidShowInlineEditNotificationHandler")}async handle(r){let n=r.item.command.arguments[0];await this.ctx.get(Nh).handleShown(n)}},fde=class extends zg{constructor(){super(...arguments);this.name=aZ.method;this.params=_5e}static{o(this,"DidPartiallyAcceptCompletionNotificationHandler")}handle(r){let n=r.item.command.arguments[0],i=r.acceptedLength,s=this.ctx.get(ts),a=s.get(n);a&&(s.delete(n),i>=a.insertText.length?RO(this.ctx,a):D6e(this.ctx,a,i))}},Tje=[cde,ude,fde];d();var c$=class extends zg{constructor(){super(...arguments);this.name="window/workDoneProgress/cancel";this.params=I.Object({token:I.Union([I.String(),I.Number()])})}static{o(this,"WorkDoneProgressCancelNotification")}handle(r){this.ctx.get(k0).cancel(r.token)}};var nqt=[...Ije,...Tje,c$];function wje(e,t){for(let r of nqt){let n=new r(e),i=us.Compile(n.params);t.onNotification(n.type,Vu(e,async s=>{$A(s),i.Check(s)?await n.handle(s):_0.error(e,`Notification ${n.name}:`,new mc(i.Errors(s)))},`Notification ${n.name}`))}}o(wje,"registerNotifications");d();var Sje=Xe(require("events")),u$=Xe(_l());var _je=new Ht("AgentTextDocumentConfiguration"),dde=class{constructor(t){this.ctx=t;this.emitter=new Sje.default}static{o(this,"AgentTextDocumentsConfiguration")}create(t,r,n,i){try{return z1.create(t,r,n,i)}catch(s){throw _je.exception(this.ctx,s,".create"),s}}update(t,r,n){try{let i=[];for(let a of r)if(u$.TextDocumentContentChangeEvent.isIncremental(a)){let l={range:a.range,rangeOffset:t.offsetAt(a.range.start),rangeLength:t.offsetAt(a.range.end)-t.offsetAt(a.range.start),text:a.text};i.push(l)}let s={document:{uri:t.uri,version:n},contentChanges:i};return this.emitter.emit("change",s),z1.withChanges(t,r,n)}catch(i){throw _je.exception(this.ctx,i,".update"),i}}},e3=class extends Hr{constructor(r){super(r);this._documents=new Map;this.workspaceFolders=[];this.onDidChangeTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._textDocumentConfiguration.emitter.on("change",s),{dispose:o(()=>{this._textDocumentConfiguration.emitter.removeListener("change",s)},"dispose")}},"onDidChangeTextDocument");this.onDidOpenTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._textDocumentConfiguration.emitter.on("open",s),{dispose:o(()=>{this._textDocumentConfiguration.emitter.removeListener("open",s)},"dispose")}},"onDidOpenTextDocument");this.onDidCloseTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._textDocumentConfiguration.emitter.on("close",s),{dispose:o(()=>{this._textDocumentConfiguration.emitter.removeListener("close",s)},"dispose")}},"onDidCloseTextDocument");this.onDidFocusTextDocument=o((r,n,i)=>this.connection.onNotification(iZ.type,s=>{let a=("textDocument"in s?s.textDocument:s)??{};r.call(n,"uri"in a?{document:a}:void 0)}),"onDidFocusTextDocument");this._textDocumentConfiguration=new dde(r),this._notebookDocuments=new u$.NotebookDocuments(this._textDocumentConfiguration)}static{o(this,"AgentTextDocumentManager")}get connection(){return this.ctx.get(jr).connection}init(r){this.connection.onDidOpenTextDocument(n=>{let i=n.textDocument,s=this._textDocumentConfiguration.create(i.uri,i.languageId,i.version,i.text);this._documents.set(nc(i.uri),s),this._textDocumentConfiguration.emitter.emit("open",{document:{...i,uri:s.uri}})}),this.connection.onDidChangeTextDocument(n=>{let i=n.textDocument,s=n.contentChanges,{version:a}=i;if(a==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let l=nc(i.uri),c=this._documents.get(l);c!==void 0&&(c=this._textDocumentConfiguration.update(c,s,a),this._documents.set(l,c))}),this.connection.onDidCloseTextDocument(n=>{let i=nc(n.textDocument.uri);this._documents.delete(i),this._textDocumentConfiguration.emitter.emit("close",{document:{uri:i}})}),this._notebookDocuments.listen(this.connection),this.workspaceFolders.length=0,this.workspaceFolders.push(...r)}didChangeWorkspaceFolders(r){r.added.forEach(n=>this.registerWorkspaceFolder(n)),r.removed.forEach(n=>this.unregisterWorkspaceFolder(n))}unregisterWorkspaceFolder(r){let n=this.workspaceFolders.findIndex(i=>i.uri===r.uri);n>=0&&this.workspaceFolders.splice(n,1)}registerWorkspaceFolder(r){this.workspaceFolders.push(r)}getTextDocumentsUnsafe(){return[...this._documents.values()]}getTextDocumentUnsafe(r){return this._documents.get(nc(r.uri))}getWorkspaceFolders(){return this.workspaceFolders}findNotebook(r){let n=this._notebookDocuments.findNotebookDocumentForCell(r.uri);if(n)return{getCells:o(()=>n.cells.map((i,s)=>this.wrapCell(i,s)).filter(i=>!!i),"getCells"),getCellFor:o(({uri:i})=>{let s=n.cells.findIndex(a=>a.document===i);return s!==-1?this.wrapCell(n.cells[s],s):void 0},"getCellFor")}}wrapCell(r,n){let i=this._notebookDocuments.getCellTextDocument(r);if(i)return{kind:r.kind,metadata:r.metadata??{},index:n,document:i}}};var kje=us.Compile(E5e);function $A(e){if(e!==null){if(Array.isArray(e))for(let t=0;t<e.length;t++)e[t]=$A(e[t]);else if(typeof e=="object"){let t=e;for(let r in t)t[r]===null?delete t[r]:t[r]=$A(t[r])}return e}}o($A,"purgeNulls");var jr=class{constructor(t,r){this.ctx=t;this.connection=r;this.initialized=!1;this.#i=this.ctx.get(Wa)}static{o(this,"Service")}#e;#t;#i;get clientCapabilities(){return this.#t}listen(){let t=this.ctx,r=this.connection;r.onRequest(this.messageHandler.bind(this)),wje(t,r);let n={name:"GitHub Copilot Language Server",version:t.get(go).getDisplayVersion(),nodeVersion:process.versions.node},i,s=o(async c=>{try{if(i&&c&&typeof c=="object"&&!("settings"in c)){let u=await r.workspace.getConfiguration(["github.copilot",...hfe].map(m=>({section:m}))),f={github:{copilot:u.shift()}};for(let m of hfe)f[m]=u.shift();c.settings=f}return dGe(t,$A(c))}catch(u){_0.exception(t,u,"didChangeConfiguration")}},"didChangeConfiguration");function a(c){try{t.get(e3).didChangeWorkspaceFolders(c),t.get(Tf).emit(c)}catch(u){_0.exception(t,u,"didChangeWorkspaceFolders")}}o(a,"didChangeWorkspaceFolders"),this.connection.onNotification("vs/didAddWorkspaceFolder",({name:c,uri:u})=>a({added:[{uri:u,name:c??u}],removed:[]})),this.connection.onNotification("vs/didRemoveWorkspaceFolder",({name:c,uri:u})=>a({added:[],removed:[{uri:u,name:c??u}]})),r.onInitialize(async c=>{if(this.initialized)throw new Error("initialize request sent after initialized notification");this.#t=c.capabilities;let u=c.capabilities.copilot,f=$A(c.initializationOptions);if(f){if(!kje.Check(f))throw new mc(kje.Errors(f));let g=f,x=t.get(dn);g.editorPluginInfo?x.setEditorAndPluginInfo({version:"unknown",...g.editorPluginInfo},g.editorInfo&&{version:"unknown",...g.editorInfo},g.relatedPluginInfo??[]):_0.warn(t,"editorInfo and editorPluginInfo will soon be required in initializationOptions. This will replace setEditorInfo."),g.copilotIntegrationId&&x.setCopilotIntegrationId(g.copilotIntegrationId),g.githubAppId&&(t.get(ea).githubAppId=g.githubAppId),g.copilotCapabilities&&(u=g.copilotCapabilities)}let m=c.capabilities.workspace?.workspaceFolders??!1;t.get(e3).init(c.workspaceFolders??[]),U8e(this.ctx),t.get(Tf).emit({added:c.workspaceFolders??[],removed:[]}),i=c.capabilities.workspace?.configuration,u&&(t.get(Go).setCapabilities(u),"openURL"in u&&wH(t,["The openURL Copilot capability has been removed in favor of window/showDocument."]));let p=o(async()=>{this.initialized||(this.initialized=!0,_0.info(t,`${n.name} ${n.version} initialized`),m&&r.workspace.onDidChangeWorkspaceFolders(a),i?await s({}):await WR(t),this.installationTelemetryTimer=setTimeout(()=>{new R9().startup(t).catch(()=>{})},1e3),t.get(zA).emit(),await e6e(t))},"onInitialized");return r.onInitialized(Vu(t,p,"onInitialized")),t.get(Lh).init(),u?.token&&t.get(wn).setTransientSession(null),u?.redirectedTelemetry&&await POe(t),Rje.lt(process.versions.node,"20.8.0")&&_0.warn(t,`Node.js ${process.versions.node} support is deprecated. Please upgrade to Node.js 20.8 or newer.`),{capabilities:{textDocumentSync:{openClose:!0,change:jh.TextDocumentSyncKind.Incremental},notebookDocumentSync:{notebookSelector:[{notebook:"*"}]},workspace:{workspaceFolders:{supported:m,changeNotifications:m}},executeCommandProvider:{commands:wOe(t,r)},inlineCompletionProvider:{}},serverInfo:n}}),r.onShutdown(async()=>{await(this.#e??=this.deactivate())}),r.onExit(()=>void this.onExit()),r.onDidChangeConfiguration(Vu(t,s,"onDidChangeConfiguration")),r.listen();let l=new UH;this.ctx.forceSet(Wa,l)}async messageHandler(t,r,n){let i=this.ctx.get(Xv).handlers.get(t);if(!i)return new jh.ResponseError(rn.MethodNotFound,`Method not found: ${t}`);if(!this.initialized)return new jh.ResponseError(rn.ServerNotInitialized,"Agent service not initialized.");if(this.#e)return new jh.ResponseError(rn.InvalidRequest,"Agent service shut down.");if(t!=="setEditorInfo"&&!kOe(this.ctx.get(dn)))throw new jh.ResponseError(rn.ServerNotInitialized,"editorInfo and editorPluginInfo not set in initializationOptions");Array.isArray(r)&&(r=r[0]),$A(r);try{let[s,a]=await i(this.ctx,n,r);return a?new jh.ResponseError(a.code,a.message,a.data):s}catch(s){if(n.isCancellationRequested)return new jh.ResponseError(rn.RequestCancelled,"Request was canceled");if(s instanceof Ks)return new jh.ResponseError(rn.NoCopilotToken,`Not authenticated: ${s.message}`);throw s instanceof jh.ResponseError||_0.exception(this.ctx,s,`Request ${t}`),s}}async onExit(){try{this.ctx.get(_h).dispose()}catch(t){_0.exception(this.ctx,t,"failed to dispose ripgrep process manager")}this.ctx.forceSet(Wa,this.#i),await(this.#e??=this.deactivate())}async deactivate(){let t=this.ctx;clearTimeout(this.installationTelemetryTimer),Hre(t),await Promise.race([new Promise(r=>setTimeout(r,100)),t.get(Bo).flush()]),await Promise.race([new Promise(r=>setTimeout(r,1800)),t.get(Ds).deactivate()])}dispose(){clearTimeout(this.installationTelemetryTimer),this.connection.dispose()}},_0=new Ht("lsp");var f$=class e extends p4{constructor(r){super(r);this.reportedUnknownProviders=new Set}static{o(this,"AgentRelatedFilesProvider")}get service(){return this.context.get(jr)}static mapProviderNameToNeighboringFileType(r){let n="CSharpCopilotCompletionContextProvider",i="CSharpRoslynCompletionRelatedContextProvider",s="CppCopilotCompletionContextProvider",a="CppCopilotCompletionSemanticCodeContextProvider";switch(r){case n:return"related/csharp";case i:return"related/csharproslyn";case s:return"related/cpp";case a:return"related/cppsemanticcodecontext";default:return"related/other"}}convert(r){let n={entries:[],traits:r.traits};for(let i of r.entries){let s={type:e.mapProviderNameToNeighboringFileType(i.providerName),uris:i.uris};n.entries.push(s),s.type==="related/other"&&!this.reportedUnknownProviders.has(i.providerName)&&(this.reportedUnknownProviders.add(i.providerName),ll.warn(this.context,`unknown providerName ${i.providerName}`))}return n}async getRelatedFilesResponse(r,n,i){ll.debug(this.context,`Fetching related files for ${r.uri}`);let s=this.context.get(Go).getCapabilities().related??!1;if(e.relatedCapabilityTelemetry(this.context,n,s),!s)return ll.debug(this.context,"`copilot/related` not supported"),W8e;try{let a=await this.service.connection.sendRequest(uZ.type,{textDocument:{uri:r.uri},data:r.data,telemetry:{properties:n.properties,measurements:n.measurements}},i);return this.convert(a)}catch(a){ll.exception(this.context,a,".copilotRelated");return}}static{this.telemetrySent=!1}static relatedCapabilityTelemetry(r,n,i){try{if(!i||e.telemetrySent)return;e.telemetrySent=!0,jt(r,"copilotRelated.hasRelatedCapability",n)}catch(s){ll.exception(r,s,"copilotRelated")}}};d();var Bje=Xe(_l());var mde=new Ht("copilotTokenManager"),hde=class e extends II{static{o(this,"AgentClientCopilotTokenManager")}static{this.RequestType=new Bje.ProtocolRequestType("copilot/token")}constructor(t,r=!1){super(t,r)}async fetchCopilotTokenEnvelope(){let t=this.ctx.get(jr).connection;try{this.didChangeToken??=t.onNotification("copilot/didChangeToken",()=>{this.resetToken()});let r=await t.sendRequest(e.RequestType,{force:!1});if(!r?.envelope)throw mde.debug(this.ctx,"Envelope missing from copilot/token response"),new hd({reason:"NotSignedIn",message:"Editor did not return a token"});let{accessToken:n,handle:i,githubAppId:s,envelope:a,tokenEndpoint:l}=r;mde.debug(this.ctx,"Retrieved envelope from copilot/token");let c=new q1(a);if(c.isExpired())throw new Ks("Expired token in copilot/token response");if(i&&n){let u;if(l!==void 0){try{u=new URL(l).origin}catch{mde.warn(this.ctx,`Invalid token endpoint URL <${l}>`)}this.ctx.get($n).updateBaseUrlFromTokenEndpoint(this.ctx,l)}this.ctx.get(wn).setTransientSession({accessToken:n,login:i,githubAppId:s,apiUrl:u},!1)}else if(!await this.getGitHubSession())throw new hd({reason:"NotSignedIn"});return Ew(this.ctx,c),a}catch(r){throw r instanceof Error?new Ks(r.message,r):r}}},ZR=class extends Xr{constructor(r,n=new II(r,!0)){super();this.ctx=r;this.fallback=n;this.client=new hde(r,!0)}static{o(this,"AgentCopilotTokenManager")}canGetToken(){return this.ctx.get(Go).getCapabilities().token??!1}getDelegate(){return this.canGetToken()?this.client:this.fallback}resetToken(r){this.getDelegate().resetToken(r)}async getToken(){return this.getDelegate().getToken()}async getGitHubSession(){return this.fallback.getGitHubSession()}};d();var iqt=new Ht("Public Code References"),d$=class extends af{static{o(this,"CLSCitationManager")}async handleIPCodeCitation(t,r){let n=r.location?.start.line!==void 0?r.location.start.line+1:"-",i=r.location?.start.character!==void 0?r.location.start.character+1:"-",s=(r.matchingText??"").replace(/[\r\n]/g," ");iqt.info(t,`Text found matching public code in ${r.inDocumentUri} [Ln ${n}, Col ${i}] near ${s}...:`+r.details.map((a,l)=>`
1434
+ `)}o(xLt,"buildUserMessage");async function vLt(e,t,r){if(r.changes.length===0)return[null,{code:rn.InvalidRequest,message:"No changes provided"}];let n=new ka(e),i=await e.get(ci).getBestChatModelConfig([di.Gpt4oMini,di.Gpt4o,di.Gpt4]),s=[{uri:r.workspaceFolder?r.workspaceFolder:al(process.cwd())}],a=await O9.getInstructions(e,s,{includeCodeGenerationInstructions:!1,includeCommitMessageGenerationInstructions:!0,customIntroduction:"When generating the commit message, please use the following custom instructions provided by the user."}),l=e.get(Wi),c=l.create({skills:[Ug]}),u=new UC({message:"",type:"user"});await l.addTurn(c.id,u);let f=H9({workDoneToken:Ir()});await e.get(bs).begin(c,u,f);let p=(await new $C(e,c,u,t).skillResolver.resolve(Ug))?.head?.name,g=[{role:"system",content:await CLt(r.userLanguage,p)},{role:"user",content:xLt(r,a)}],x=await e.get(Cr).updateExPValuesAndAssignments(),v=await n.fetchResponse({modelConfiguration:i,messages:g,uiKind:"conversationPanel",intentParams:{intent:!0},llmInteraction:wu.user("git-commit",Ir())},t,x);if(v.type!=="success")return[null,{code:rn.InternalError,message:"Failed to generate commit message"}];let E=v.value.match(/```text\n([\s\S]*?)\n```/);return[{commitMessage:E?E[1].trim():v.value.trim()},null]}o(vLt,"handleGitCommitGenerateChecked");var YWe=wo(at(yLt,vLt));d();var JWe=oZ.type,OR;function KWe(e){return{title:"Completion Accepted",command:mR,arguments:[e]}}o(KWe,"makeCommand");async function bLt(e,t,r){OR&&(OR.cancel(),OR.dispose());let n=r.context.triggerKind===1;OR=new Hn.CancellationTokenSource;let i=OR.token,s=new _u([t,i]);r.contextItems&&Y9(e,r.contextItems,r.data);let a=TV(e,r.position,r.textDocument.uri,n);if(a)return[{items:a.map(p=>({command:KWe(Ir()),...p}))},null];let l=await qh(e,r.textDocument,s),c=r.position,u=await IV(e,l,c,s,{isCycling:n,selectedCompletionInfo:r.context.selectedCompletionInfo,formattingOptions:r.formattingOptions,data:r.data});if(!u)return t.isCancellationRequested?[null,{code:rn.RequestCancelled,message:"Request was canceled"}]:i.isCancellationRequested?[null,{code:rn.ServerCancelled,message:"Request was superseded by a new request"}]:[{items:[]},null];let f=e.get(ts);for(let h of u)f.set(h.uuid,{...h,triggerCategory:"ghostText"});return[{items:u.map(h=>({command:KWe(h.uuid),insertText:h.insertText,range:h.range}))},null]}o(bLt,"handleChecked");var ZWe=at(CM,(e,t,r)=>bLt(e,t,r));d();var XWe=lZ.type,UR;async function ILt(e,t,r){UR&&(UR.cancel(),UR.dispose());let n=r.context.triggerKind===1;UR=new Hn.CancellationTokenSource;let i=UR.token,s=new _u([t,i]);r.contextItems&&Y9(e,r.contextItems);let a=await qh(e,r.textDocument,s),l=await sfe(e,a,r.position,s,{promptOnly:!0,isCycling:n,selectedCompletionInfo:r.context.selectedCompletionInfo,formattingOptions:r.formattingOptions,data:r.data});if(l.type!=="promptOnly")throw new Error(`Unexpected result type ${l.type}`);return[{prompt:l.prompt},null]}o(ILt,"handleChecked");var eGe=at(CM,(e,t,r)=>ILt(e,t,r));d();d();function ufe(e){let t=e.indexOf("-----BEGIN CERTIFICATE-----")+27,r=e.indexOf("-----END CERTIFICATE-----"),n=30,i=e.substring(t,t+n)+"..."+e.substring(r-n,r-1);return J9(i)}o(ufe,"asReadableCert");function J9(e){return e.replace(/\s/g,"")}o(J9,"normalizeNewlines");var wLt=I.Object({});async function _Lt(e){return[{certificates:(await e.get(Ja).getAllRootCAs()).map(J9)},null]}o(_Lt,"handleListCertificatesChecked");var tGe=at(wLt,_Lt);d();async function SLt(e,t,r){let n=e.get(Nh);if(r.textDocument.version===void 0)throw new Error("textDocument.version is undefined");let i=nc(r.textDocument.uri);e.get(zp).onUserPositionChange(i,new yo(r.position.line,r.position.character));let s=await n.handleNextEditRequest(i,r.textDocument.version,t);return s?[{edits:s.map(l=>({text:l.edit.text,textDocument:l.edit.textDocument,range:l.edit.range,command:{title:"Accept inline edit",command:mR,arguments:[l.id]}}))},null]:[{edits:[]},null]}o(SLt,"handleChecked");var rGe=at(R5e,SLt);d();var kLt=I.Object({uuid:I.String({minLength:1}),acceptedLength:I.Optional(I.Number({minimum:1}))});function RLt(e,t,r){let n=e.get(ts),i=n.get(r.uuid);if(i){n.delete(r.uuid);let s=BLt(r,i);A4(e,i.triggerCategory,i.insertText,i.offset,i.uri,i.telemetry,s,i.copilotAnnotations)}return["OK",null]}o(RLt,"notifyAcceptedChecked");function BLt(e,t){return e.acceptedLength===void 0?{compType:"full"}:e.acceptedLength<t.insertText.length?{compType:"partial",acceptedLength:e.acceptedLength}:{compType:"full"}}o(BLt,"getSuggestionStatus");var nGe=at(kLt,RLt);d();var DLt=I.Object({uuids:I.Array(I.String())});function PLt(e,t,r){let n=e.get(ts),i=r.uuids.flatMap(s=>n.get(s)??[]);if(i.length>0){let s=i[0];for(let l of r.uuids)n.delete(l);let a=i.map(l=>({completionText:l.displayText,completionTelemetryData:l.telemetry}));kO(e,"ghostText",s.offset,s.uri,a),e.get(m0).resetState()}return["OK",null]}o(PLt,"notifyRejectedChecked");var iGe=at(DLt,PLt);d();var FLt=I.Object({uuid:I.String({minLength:1})});function NLt(e,t,r){let i=e.get(ts).get(r.uuid);return i&&dM(e,i.triggerCategory,i),["OK",null]}o(NLt,"notifyShownChecked");var oGe=at(FLt,NLt);d();var LLt=iIe;function QLt(e,t,r){let n=e.get(cl),i={unregistered:[],registered:[]};return r.providers.forEach(s=>{try{let a=new z9(e,s.id,s.selector);n.registerContextProvider(a),i.registered.push(s.id)}catch{i.unregistered.push(s.id)}}),[i,null]}o(QLt,"registerContextProviders");var sGe=at(LLt,QLt);d();d();var aGe=require("net");function ffe(e){return e.HTTPS_PROXY||e.https_proxy||e.HTTP_PROXY||e.http_proxy}o(ffe,"getProxyFromEnvironment");function MLt(e){return e.NODE_TLS_REJECT_UNAUTHORIZED!=="0"}o(MLt,"getRejectUnauthorizedFromEnvironment");var lGe=I.Object({proxy:I.Optional(I.String()),proxyStrictSSL:I.Optional(I.Boolean()),proxyAuthorization:I.Optional(I.String()),proxyKerberosServicePrincipal:I.Optional(I.String())});function cGe(e){let r={proxy:ffe(e),proxyStrictSSL:MLt(e)},n=e.GH_COPILOT_KERBEROS_SERVICE_PRINCIPAL??e.GITHUB_COPILOT_KERBEROS_SERVICE_PRINCIPAL??e.AGENT_KERBEROS_SERVICE_PRINCIPAL;return n&&(r.proxyKerberosServicePrincipal=n),r}o(cGe,"getHttpSettingsFromEnvironment");function qR(e){(0,aGe.isIPv6)(e)?e="https://["+e+"]":/:\/\//.test(e)||(e=`https://${e}`);let{hostname:t,port:r,username:n,password:i}=new URL(e);return{host:t,port:OLt(r),proxyAuth:ULt(n,i)}}o(qR,"proxySettingFromUrl");function OLt(e){if(!e)return 80;let t=Number(e);if(isNaN(t))throw new TypeError("Invalid proxy port");return t}o(OLt,"parsePort");function ULt(e,t){return!e||!t?"":`${decodeURIComponent(e)}:${decodeURIComponent(t)}`}o(ULt,"getAuth");d();var mfe=I.Object({host:I.String(),port:I.Number(),username:I.Optional(I.String()),password:I.Optional(I.String()),rejectUnauthorized:I.Optional(I.Boolean())}),qLt=I.Object({uri:I.Optional(I.String())}),WLt=I.Object({showEditorCompletions:I.Optional(I.Boolean()),enableAutoCompletions:I.Optional(I.Boolean()),delayCompletions:I.Optional(I.Boolean()),filterCompletions:I.Optional(I.Boolean())}),fGe=I.Object({github:I.Optional(I.Object({copilot:I.Optional(I.Object({}))})),"github-enterprise":I.Optional(qLt),http:I.Optional(lGe),telemetry:I.Optional(I.Object({telemetryLevel:I.Optional(I.String())}))}),hfe=Object.keys(fGe.properties).filter(e=>e!=="github"),GLt=I.Intersect([fGe,WLt]),pfe=I.Object({url:I.Optional(I.String())}),HLt=I.Object({settings:I.Optional(I.Union([I.Object({}),I.Array(I.Unknown(),{maxItems:0})])),networkProxy:I.Optional(mfe),authProvider:I.Optional(pfe)}),uGe=us.Compile(HLt),dfe=us.Compile(GLt);async function dGe(e,t){if(!uGe.Check(t))throw new mc(uGe.Errors(t));let r=Array.isArray(t.settings)?{}:t.settings;r&&await gfe(e,r),t.networkProxy!==void 0&&wV(e,t.networkProxy),t.authProvider&&e.get($n).updateBaseUrl(e,t.authProvider.url),await WR(e,r)}o(dGe,"notifyChangeConfiguration");async function gfe(e,t){for(let i of dfe.Errors(t)){let s=i.path.split("/")?.[1];_0.warn(e,`Invalid ${i.path.slice(1).replace(/\//g,".")} setting:`,i.message),delete t[s]}if(!dfe.Check(t))throw new mc(dfe.Errors(t));let r=e.get(Ff);r.setConfig(St.ShowEditorCompletions,t.showEditorCompletions),r.setConfig(St.DelayCompletions,t.delayCompletions),r.setConfig(St.EnableAutoCompletions,t.enableAutoCompletions),r.setConfig(St.FilterCompletions,t.filterCompletions),t.http&&Afe(e,t.http);let n=t["github-enterprise"];n&&(e.get($n).updateBaseUrl(e,n.uri),e.get(wn).updateEnterpriseConfig(e,n)),t.github?.copilot&&await jLt(e,t.github.copilot)}o(gfe,"applySettingsToConfiguration");async function jLt(e,t){let r=e.get(Ff);for(let n of Object.values(St)){let i=exe(t,n);r.setConfig(n,i)}t.mcp?await VLt(e,t.mcp):await $Lt(e)}o(jLt,"applyCopilotConfiguration");function Afe(e,t){let r=e.get(Ff),n=e.get(Or);if(t.proxy===void 0&&(t=cGe(r.env)),n.rejectUnauthorized=t?.proxyStrictSSL,!t.proxy){n.proxySettings=void 0;return}try{n.proxySettings=qR(t.proxy),t.proxyAuthorization&&(n.proxySettings.proxyAuth=t.proxyAuthorization),t.proxyKerberosServicePrincipal&&(n.proxySettings.kerberosServicePrincipal=t.proxyKerberosServicePrincipal)}catch(i){if(!(i instanceof TypeError))throw i;_0.warn(e,"Invalid proxy URL",t.proxy,i),n.proxySettings=void 0}}o(Afe,"applyHttpConfiguration");function wV(e,t){if(!t){e.get(Or).proxySettings=void 0,e.get(Or).rejectUnauthorized=void 0;return}let r;t.username&&(t.password?r=t.username+":"+t.password:r=t.username),e.get(Or).proxySettings={host:t.host,port:t.port,proxyAuth:r},e.get(Or).rejectUnauthorized=t.rejectUnauthorized??!0}o(wV,"applyNetworkProxyConfiguration");async function VLt(e,t){try{let r=JSON.parse(t);await e.get(kg).updateMCPServers(r)}catch(r){_0.error(e,"Failed to apply MCP configuration",r)}}o(VLt,"applyMCPConfiguration");async function $Lt(e){await e.get(kg).updateMCPServers({})}o($Lt,"removeMCPConfiguration");async function WR(e,t){if(!e.get(Go).getCapabilities().redirectedTelemetry){let r=(t?.telemetry?.telemetryLevel??"all")==="all";await Xy(e,"agent",r)}await e.get(Xr).primeToken()}o(WR,"initializePostConfigurationDependencies");var mGe=I.Object({name:I.String(),version:I.String(),readableName:I.Optional(I.String())}),zLt=I.Object({editorInfo:mGe,editorPluginInfo:mGe,editorConfiguration:I.Optional(I.Object({})),networkProxy:I.Optional(mfe),authProvider:I.Optional(pfe),redirectTelemetry:I.Optional(I.Boolean()),options:I.Optional(I.Object({}))});async function YLt(e,t,r){e.get(dn).setEditorAndPluginInfo(r.editorPluginInfo,r.editorInfo),wH(e,["setEditorInfo is deprecated. Use initializationOptions for editorInfo and editorPluginInfo","and workspace/didChangeConfiguration for editorConfiguration."]),r.editorConfiguration&&await gfe(e,r.editorConfiguration);let n=e.get(Or),i=e.get(Ff).env,s=ffe(i);if(r.editorInfo.name==="VisualStudio"){if(s)n.proxySettings=qR(s);else if(r.networkProxy){wV(e,r.networkProxy);let a=i.GH_COPILOT_KERBEROS_SERVICE_PRINCIPAL??i.GITHUB_COPILOT_KERBEROS_SERVICE_PRINCIPAL??i.AGENT_KERBEROS_SERVICE_PRINCIPAL;n.proxySettings&&a&&(n.proxySettings.kerberosServicePrincipal??=a)}}else r.networkProxy?wV(e,r.networkProxy):s&&(n.proxySettings=qR(s));return r.authProvider&&e.get($n).updateBaseUrl(e,r.authProvider.url),await WR(e,r.editorConfiguration),["OK",null]}o(YLt,"handleSetEditorInfoChecked");var hGe=at(zLt,YLt);d();var KLt=I.Object({options:I.Optional(I.Object({}))});async function JLt(e,t,r){let n=e.get(wn).pendingSignIn?.status;if(n===void 0)return[null,{code:rn.InvalidRequest,message:"No pending sign in"}];let i;try{return i=await n,[i,null]}catch(s){return[null,{code:rn.DeviceFlowFailed,message:String(s)}]}finally{e.get(wn).pendingSignIn=void 0}}o(JLt,"handleSignInConfirmChecked");var pGe=at(KLt,JLt);d();var ZLt=I.Object({options:I.Optional(I.Object({})),githubAppId:I.Optional(I.String())});async function XLt(e,t,r){try{let n=await e.get(wn).checkAndUpdateStatus(e,{githubAppId:r.githubAppId});if(n.status==="OK")return[{status:"AlreadySignedIn",user:n.user},null];let i=r.githubAppId??e.get(ea).findAppIdToAuthenticate(),s=await e.get(Xx).getToken(e,i),a=s.waitForAuth.then(async l=>(e.get(ea).githubAppId=i,await e.get(wn).setPersistedSession({...l,githubAppId:i}),await e.get(wn).checkAndUpdateStatus(e,{freshSignIn:!0})));return e.get(wn).pendingSignIn={verificationUri:s.verification_uri,status:a},[{status:"PromptUserDeviceFlow",userCode:s.user_code,verificationUri:s.verification_uri,expiresIn:s.expires_in,interval:s.interval,command:{command:MH,title:"Sign in with GitHub",arguments:[]}},null]}catch(n){if(!(n instanceof Ks))throw n;return[null,{code:rn.DeviceFlowFailed,message:n.message}]}}o(XLt,"handleSignInInitiateChecked");var yfe=at(ZLt,XLt);d();var eQt=I.Object({githubToken:I.String({minLength:1}),user:I.String({minLength:1}),githubAppId:I.Optional(I.String({minLength:1}))});async function tQt(e,t,r){let n=r.githubToken,i=r.user,s=r.githubAppId;return await e.get(wn).setPersistedSession({accessToken:n,login:i,githubAppId:s}),[await e.get(wn).checkAndUpdateStatus(e),null]}o(tQt,"handleSignInWithGithubTokenChecked");var gGe=at(eQt,tQt);d();var rQt=I.Object({options:I.Optional(I.Object({}))});async function nQt(e,t,r){return await e.get(wn).deletePersistedSession(),[await e.get(wn).checkAndUpdateStatus(e),null]}o(nQt,"handleSignOutChecked");var AGe=at(rQt,nQt);d();var iQt=I.Object({});function oQt(e,t,r){return Fve(e),["OK",null]}o(oQt,"handleTelemetryAuthNotifyDismissedChecked");var yGe=at(iQt,oQt);d();var sQt=I.Object({authSource:I.Union([I.Literal("toast"),I.Literal("goldbar"),I.Literal("menu")])});function aQt(e,t,r){return Pve(e,r.authSource),["OK",null]}o(aQt,"handleTelemetryAuthNotifyShownChecked");var CGe=at(sQt,aQt);d();var lQt=I.Object({authType:I.Union([I.Literal("editorAuth"),I.Literal("deviceFlow")])});function cQt(e,t,r){return NQ(e,r.authType),["OK",null]}o(cQt,"handleTelemetryGitHubLoginSuccessChecked");var xGe=at(lQt,cQt);d();var uQt=I.Object({authSource:I.Union([I.Literal("toast"),I.Literal("goldbar"),I.Literal("menu")]),authType:I.Union([I.Literal("editorAuth"),I.Literal("deviceFlow")])});function fQt(e,t,r){return FQ(e,r.authSource,r.authType),["OK",null]}o(fQt,"handleTelemetryNewGitHubLoginChecked");var vGe=at(uQt,fQt);d();var dQt=I.Object({transaction:I.Optional(I.String()),stacktrace:I.Optional(I.String()),properties:I.Optional(I.Record(I.String(),I.String())),platform:I.Optional(I.String()),exception_detail:I.Optional(I.Array(I.Object({type:I.Optional(I.String()),value:I.Optional(I.String()),stacktrace:I.Optional(I.Array(I.Object({filename:I.Optional(I.String()),lineno:I.Optional(I.Union([I.String(),I.Integer()])),colno:I.Optional(I.Union([I.String(),I.Integer()])),function:I.Optional(I.String()),in_app:I.Optional(I.Boolean())})))})))}),Cfe=class extends Error{constructor(r,n){super(r);this.code=n;this.name="AgentEditorError"}static{o(this,"AgentEditorError")}};function mQt(e,t,r){let n=e.get(go),i=e.get(dn).getEditorPluginInfo(),s=r.properties||{},a;r.platform&&r.exception_detail&&Ng.has(i.name)&&(a=Object.assign({rollup_id:"auto",context:dZ(e),sensitive_context:{},deployed_to:n.getBuildType(),platform:r.platform,exception_detail:r.exception_detail},Ng.get(i.name)),r.transaction&&(a.transaction=r.transaction),n.getBuildType()!=="dev"&&(a.release=`${a.app}@${i.version}`));let l=new Cfe(r.stacktrace??"N/A",i.name);return l.stack=void 0,xa(e,l,void 0,s,a),["OK",null]}o(mQt,"handleTelemetryExceptionChecked");var bGe=at(dQt,mQt);d();d();d();d();d();d();var EGe=Xe(require("tls"));var _V=class{static{o(this,"RootCertificateConfigurator")}#e;constructor(t){this._certificateReader=t.get(Ja)}async enhanceProxySettings(t){let r=await this.getCertificates();return{...t,ca:r}}async getCertificates(){let t=await this._certificateReader.getAllRootCAs();if(t.length!==0)return t}async createSecureContext(){let t=await this._certificateReader.getAllRootCAs(),n=EGe.createSecureContext({_vscodeAdditionalCaCerts:t}),i=n.context;for(let s of t)i.addCACert(s);return{secureContext:n,certs:t}}async applyToRequestOptions(t){this.#e??=this.createSecureContext();let r=await this.#e;t.secureContext=r.secureContext,t.ca=r.certs,t.cert=r.certs}};d();var oT=Xe(MHe(),1),ROn={ALPN_HTTP2:oT.default.ALPN_HTTP2,ALPN_HTTP2C:oT.default.ALPN_HTTP2C,ALPN_HTTP1_1:oT.default.ALPN_HTTP1_1,ALPN_HTTP1_0:oT.default.ALPN_HTTP1_0},{fetch:BOn,context:OHe,reset:DOn,noCache:POn,h1:FOn,keepAlive:NOn,h1NoCache:LOn,keepAliveNoCache:QOn,cacheStats:MOn,clearCache:OOn,offPush:UOn,onPush:qOn,createUrl:WOn,timeoutSignal:GOn,Body:HOn,Headers:UHe,Request:jOn,Response:VOn,AbortController:zV,AbortError:YV,AbortSignal:qHe,FetchBaseError:$On,FetchError:zOn,ALPN_HTTP2:YOn,ALPN_HTTP2C:KOn,ALPN_HTTP1_1:JOn,ALPN_HTTP1_0:ZOn}=oT.default;var sT=class extends Or{constructor(r){super();this.ctx=r;this.name="HelixFetcher";this.createSocketFactory=o((r,n)=>async i=>{i.rejectUnauthorized=n,i.timeout=r.connectionTimeoutInMs,await this.certificateConfigurator.applyToRequestOptions(i);let s=await this.certificateConfigurator.enhanceProxySettings(r);return await this.proxySocketFactory.createSocket(i,s)},"createSocketFactory");this.fetchApi=this.createFetchApi(r),this.certificateConfigurator=new _V(r),this.proxySocketFactory=r.get(Cg)}static{o(this,"HelixFetcher")}set proxySettings(r){this._proxySettings=r,this.fetchApi=this.createFetchApi(this.ctx)}get proxySettings(){return this._proxySettings}set rejectUnauthorized(r){super.rejectUnauthorized=r,this.fetchApi=this.createFetchApi(this.ctx)}get rejectUnauthorized(){return super.rejectUnauthorized}createFetchApi(r){let n=r.get(go);return super.rejectUnauthorized===!1&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0"),OHe({userAgent:`GithubCopilot/${n.getVersion()}`,socketFactory:this._proxySettings?this.createSocketFactory(this._proxySettings,super.rejectUnauthorized):void 0,rejectUnauthorized:super.rejectUnauthorized})}async fetch(r,n){let i=n.signal,s=!1;if(n.timeout){let u=this.makeAbortController();setTimeout(()=>{u.abort(),s=!0},n.timeout),n.signal?.addEventListener("abort",()=>u.abort()),n.signal?.aborted&&u.abort(),i=u.signal}let a={...n,body:n.body?n.body:n.json,signal:i};await this.certificateConfigurator.applyToRequestOptions(a);let l=await this.certificateConfigurator.getCertificates();this.fetchApi.setCA(l);let c=await this.fetchApi.fetch(r,a).catch(u=>{throw s?new z7(`Request to <${r}> timed out after ${n.timeout}ms`,u):u});return new By(c.status,c.statusText,c.headers,()=>c.text(),()=>c.body)}disconnectAll(){return this.fetchApi.reset()}makeAbortController(){return new zV}};d();d();var KR=require("fs");var aT=class extends bo{static{o(this,"LocalFileSystem")}async readFileString(t){return(await KR.promises.readFile(wl(t))).toString()}async stat(t){let{targetStat:r,lstat:n,stat:i}=await this.statWithLink(wl(t));return{ctime:r.ctimeMs,mtime:r.mtimeMs,size:r.size,type:this.getFileType(r,n,i)}}async readDirectory(t){let r=wl(t),n=await KR.promises.readdir(r,{withFileTypes:!0}),i=[];for(let s of n)i.push([s.name,s.isFile()?1:2]);return i}async statWithLink(t){let r=await KR.promises.lstat(t);if(r.isSymbolicLink())try{let n=await KR.promises.stat(t);return{lstat:r,stat:n,targetStat:n}}catch{}return{lstat:r,targetStat:r}}getFileType(t,r,n){let i=0;return t.isFile()&&(i=1),t.isDirectory()&&(i=2),r.isSymbolicLink()&&n&&(i|=64),i}};d();var KV=class extends Uh{constructor(r=[]){super();this._agents=r}static{o(this,"TestRemoteAgentRegistry")}agents(){return this._agents}};d();var JV=class extends Xa{constructor(){super(...arguments);this.prompts=[];this.fetchResults=[];this.diffs=[]}static{o(this,"TestConversationInspector")}shouldInspect(){return!0}inspectPrompt(r){this.shouldInspect()&&this.prompts.push(r)}inspectFetchResult(r){this.shouldInspect()&&this.fetchResults.push(r)}documentDiff(r){this.shouldInspect()&&this.diffs.push(r)}};d();var Zfe=class extends Ja{constructor(r){super();this.certificates=r}static{o(this,"TestCertificateReader")}getAllRootCAs(){return this.certificates}},GHe=o(e=>new Zfe(e),"createTestCertificateReader");function tde(e,t,r){let n=new Xfe;n.set("x-github-request-id","1");for(let[i,s]of Object.entries(r||{}))n.set(i,s);return new By(e,"status text",n,()=>Promise.resolve(t??""),()=>null)}o(tde,"createFakeResponse");function HHe(e,t,r){let n;return typeof t=="string"?n=t:n=JSON.stringify(t),tde(e,n,Object.assign({"content-type":"application/json"},r))}o(HHe,"createFakeJsonResponse");var JR=class extends Or{constructor(){super(...arguments);this.name="FakeFetcher"}static{o(this,"FakeFetcher")}disconnectAll(){throw new Error("Method not implemented.")}makeAbortController(){return new ede}};var ZV=class extends JR{static{o(this,"NoFetchFetcher")}fetch(t,r){throw new Error("NoFetchFetcher does not support fetching")}};var Xfe=class{constructor(){this.headers=new Map}static{o(this,"FakeHeaders")}append(t,r){this.headers.set(t.toLowerCase(),r)}delete(t){this.headers.delete(t.toLowerCase())}get(t){return this.headers.get(t.toLowerCase())??null}has(t){return this.headers.has(t.toLowerCase())}set(t,r){this.headers.set(t.toLowerCase(),r)}entries(){return this.headers.entries()}keys(){return this.headers.keys()}values(){return this.headers.values()}[Symbol.iterator](){return this.headers.entries()}},ede=class{constructor(){this.signal={aborted:!1,addEventListener:o(()=>{},"addEventListener"),removeEventListener:o(()=>{},"removeEventListener")}}static{o(this,"FakeAbortController")}abort(){this.signal.aborted=!0}};d();function iUt(e){return{modelId:"gpt-3.5-turbo",modelFamily:e,uiName:"Test GPT",maxRequestTokens:6144,maxResponseTokens:2048,baseTokensPerMessage:3,baseTokensPerName:1,baseTokensPerCompletion:3,tokenizer:"cl100k_base",isExperimental:!1,stream:!0,toolCalls:!0}}o(iUt,"fakeChatModelConfiguration");function oUt(e){return{modelId:"embedding-test",modelFamily:e,maxBatchSize:1,maxTokens:50,tokenizer:"cl100k_base"}}o(oUt,"fakeEmbeddingModelConfiguration");var XV=class extends ci{static{o(this,"TestModelConfigurationProvider")}getBestChatModelConfig(t){let r=t[0];return Promise.resolve(iUt(r))}getFirstMatchingEmbeddingModelConfiguration(t){return Promise.resolve(oUt(t))}};d();var e$=class extends ic{constructor(){super(...arguments);this.openedUrls=[];this.opened=new o8}static{o(this,"TestUrlOpener")}open(r){return this.openedUrls.push(r),this.opened.resolve(),Promise.resolve()}},t$=class extends va{constructor(){super();this.sentMessages=[];this.warningPromises=[]}static{o(this,"TestNotificationSender")}performDismiss(){this.actionToPerform="DISMISS"}performAction(r){this.actionToPerform=r}showWarningMessage(r,...n){this.sentMessages.push(r);let i;if(this.actionToPerform)if(this.actionToPerform==="DISMISS")i=Promise.resolve(void 0);else{let s=n.find(a=>a.title===this.actionToPerform);i=s?Promise.resolve(s):Promise.resolve(void 0)}else i=n?Promise.resolve(n[0]):Promise.resolve(void 0);return this.warningPromises.push(i),i}async waitForWarningMessages(){await Promise.all(this.warningPromises)}};d();function jHe(e,t,r,n){return z1.create(dCe(e),t,r,n,t)}o(jHe,"createTextDocument");var rde=class extends Hr{constructor(r){super(r);this._openTextDocuments=[];this._notebookDocuments=new Map;this._workspaceFolders=[];this._focusSubscribers=[];this._changeSubscribers=[];this._openSubscribers=[];this._closeSubscribers=[];this.onDidFocusTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._focusSubscribers.push(s),{dispose:o(()=>{this._focusSubscribers=this._focusSubscribers.filter(a=>a!==s)},"dispose")}},"onDidFocusTextDocument");this.onDidChangeTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._changeSubscribers.push(s),{dispose:o(()=>{this._changeSubscribers=this._changeSubscribers.filter(a=>a!==s)},"dispose")}},"onDidChangeTextDocument");this.onDidOpenTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._openSubscribers.push(s),{dispose:o(()=>{this._openSubscribers=this._openSubscribers.filter(a=>a!==s)},"dispose")}},"onDidOpenTextDocument");this.onDidCloseTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._closeSubscribers.push(s),{dispose:o(()=>{this._closeSubscribers=this._closeSubscribers.filter(a=>a!==s)},"dispose")}},"onDidCloseTextDocument")}static{o(this,"SimpleTestTextDocumentManager")}init(r){this._workspaceFolders=r.map(n=>({uri:n.uri,name:n.name??Bi(n.uri)}))}async readTextDocumentFromDisk(r){return super.readTextDocumentFromDisk(r)}getTextDocumentsUnsafe(){return this._openTextDocuments}setTextDocument(r,n,i){let s=jHe(r,n,0,i);return this._openTextDocuments.push(s),s}updateTextDocument(r,n){let i=this._openTextDocuments.findIndex(a=>a.uri===r.toString());if(i<0)throw new Error("Document not found");let s=this._openTextDocuments[i];this._openTextDocuments[i]=jHe(r,s.clientLanguageId,s.version+1,n)}setNotebookDocument(r,n){this._notebookDocuments.set(r.uri.replace(/#.*/,""),n)}findNotebook({uri:r}){return this._notebookDocuments.get(r.replace(/#.*/,""))}getWorkspaceFolders(){return this._workspaceFolders}emitEvent(r){switch(r.eventName){case"focus":this._focusSubscribers.forEach(n=>n(r.args));break;case"change":this._changeSubscribers.forEach(n=>n(r.args));break;case"open":this._openSubscribers.forEach(n=>n(r.args));break;case"close":this._closeSubscribers.forEach(n=>n(r.args));break}}},r$=class extends rde{constructor(r){super(r);this.contents=new Map}static{o(this,"TestTextDocumentManager")}readTextDocumentFromDisk(r){return Promise.resolve(this.contents.get(r))}setDiskContents(r,n){this.contents.set(r,n)}};var nde=class extends Wa{static{o(this,"NullLog")}logIt(...t){}};function sUt(e){let t=new JI;return t.set(Wp,e),t.set(Dx,e),t.set(go,new go),t.set(fd,new fd({debug:!1,verboseLogging:!1,testMode:!0,simulation:!1})),t.set(Ja,GHe([])),t.set(Cg,fW(t)),t.set(Tp,new Tp),t.set(Vm,new cN),t.set(cf,new cf),t.set(Fp,new Fp),t.set(Lp,new Lp),t.set(ec,new ec(t,"tid=test",!0)),t.set(Ds,new Ds),t.set(va,new t$),t.set(ic,new e$),t.set(Op,new D8),t.set(Wa,new nde),t.set(Y0,new Y0),t.set(_s,new _s("test-session","test-machine")),t.set($n,new z6(t)),t.set(Ku,new Ku),Xy(t,"copilot-test",!0),t.set(Cr,new Cr(t)),t.set(oh,new oh),t.set(lf,new lf),t.set(Km,new BI),t.set(Xr,new XC("tid=test")),t.set(zi,new AN),t.set(Bo,new Bo),t.set(ch,IO(t)),t.set(m0,new m0),t.set(Nd,new Nd),t.set(cA,cA.default),t.set(Tf,new Tf),t.set(gd,new gd(t,!1)),t.set(ea,new ea),t.set(Pn,new Pn(t)),t.set(af,new LQ),t.set(kl,new kl),t.set(cl,yO(t,async(r,n,i)=>n.find(s=>s==="*")?1:n.find(s=>typeof s!="string"&&s.language===i.languageId)?10:0)),aUt(t),t.set(ih,new ih(t)),t.set(Go,new Go),t}o(sUt,"_createBaselineContext");function aUt(e){e.set(Wi,new Wi(e)),e.set(bs,new bs(e)),e.set(pc,new pc(e)),e.set(el,new el),e.set(Gl,new Gl),e.set(Xa,new JV),e.set(om,new om(e,[])),e.set(ci,new XV),e.set(Uh,new KV),e.set(Mg,new Mg(e)),e.set(qC,new qC),e.set(ua,new ua(e)),e.set(hc,new hc),e.set(Lf,new Lf)}o(aUt,"registerConversation");function VHe(){let e=sUt(new Dx(new DI,new Map));return e.set(Or,new ZV),e.set(dn,new ide),e.set(Hr,new r$(e)),e.set(bo,new aT),e.set(Qc,new Qc(e)),e.set(Za,new Za(e)),e.set(fc,new pW(e)),CH(e),e}o(VHe,"createLibTestingContext");var ide=class extends dn{constructor(r={name:"lib-tests-plugin",version:"2"},n={name:"lib-tests-editor",version:"1"},i=[{name:"lib-tests-related-plugin",version:"3"}]){super();this.editorPluginInfo=r;this.editorInfo=n;this.relatedPluginInfo=i}static{o(this,"LibTestsEditorInfo")}getEditorInfo(){return this.editorInfo}getEditorPluginInfo(){return this.editorPluginInfo}getRelatedPluginInfo(){return this.relatedPluginInfo}};var zHe=Xe(require("fs"));var $He=`${process.env.HOME}/.copilot-testing-gh-token`,n$,i$;async function YHe(e){e.forceSet(Xr,new XC(await lUt()))}o(YHe,"setTestingCopilotTokenManager");var lUt=o(async()=>{if(process.env.GH_COPILOT_IDE_TOKEN)return process.env.GH_COPILOT_IDE_TOKEN;let e=process.env.GH_COPILOT_TOKEN??"";if(/=/.test(e))return e;if(i$)return i$;let t=e||process.env.GITHUB_COPILOT_TOKEN||await cUt(),r=VHe(),n=new sT(r);return r.forceSet(Or,n),i$=hN(r,{...bI({}),accessToken:t}).then(i=>{if(i.kind==="success")return i.envelope.token;throw new Ks('Could not fetch testing Copilot token. Try running "npm run get_token" again?')}),i$},"getCopilotToken");async function cUt(){try{n$??=(await zHe.promises.readFile($He)).toString().trim()}catch{n$??=process.env.GITHUB_TOKEN??""}if(!n$)throw new Error(`Tests: either GH_COPILOT_IDE_TOKEN, GH_COPILOT_TOKEN, or GITHUB_TOKEN must be set, or there must be a GitHub token from an app with access to Copilot in ${$He}. Run "npm run get_token" to get one.`);return n$}o(cUt,"getTestingGitHubToken");function KHe(e){return new q1({token:`test token ${Ir()}`,refresh_in:0,expires_at:0,...e})}o(KHe,"createTestCopilotToken");var ode=class extends Xr{constructor(r){super();this.copilotToken=r;this.wasReset=!1;this.ghSession=JHe()}static{o(this,"FakeCopilotTokenManagerFromCopilotToken")}async getGitHubSession(){return Promise.resolve(this.ghSession)}getToken(){return Promise.resolve(this.copilotToken)}resetToken(){this.wasReset=!0}checkCopilotToken(){return Promise.resolve({status:"OK"})}},o$=class extends ode{static{o(this,"TestCopilotTokenManager")}constructor(t){super(KHe(t))}},XC=class extends o${static{o(this,"FixedCopilotTokenManager")}constructor(t){super({token:t})}};function JHe(e={}){return bI({accessToken:Ir(),...e})}o(JHe,"testGitHubSession");var s$=class extends wn{static{o(this,"NotAuthManager")}constructor(){super(null,null)}getPersistedSession(){return Promise.resolve(void 0)}checkAndUpdateStatus(){return Promise.resolve({status:"NotSignedIn"})}},lT=class extends wn{constructor(r=new XC("tid=valid-copilot-token"),n=""){super(null,r);this.githubAppId=n}static{o(this,"AlwaysAuthManager")}getPersistedSession(){return Promise.resolve({login:"user",accessToken:"",githubAppId:this.githubAppId,...this.getConfiguredUrls()})}};var uUt=I.Object({options:I.Optional(I.Object({}))});async function fUt(e,t,r){return e.forceSet(wn,new lT),e.get(Xr).resetToken(),e.get(zi).forceNormal(),await new Promise(n=>setTimeout(n,0)),["OK",null]}o(fUt,"handleTestingAlwaysAuthChecked");var ZHe=at(uUt,fUt);d();var dUt=I.Object({messages:I.Array(I.Object({role:I.Enum(Ml),content:I.String(),name:I.Optional(I.String())})),modelFamily:I.Optional(I.Enum(di)),stop:I.Optional(I.Array(I.String())),conversationOptions:I.Optional(I.Object({maxResponseTokens:I.Optional(I.Number()),temperature:I.Optional(I.Number())}))});async function mUt(e,t,r){let n=new ka(e),i=await e.get(ci).getBestChatModelConfig([r.modelFamily??di.Gpt35turbo]),s=await __(e,"","");return[await n.fetchResponse({modelConfiguration:i,messages:r.messages,uiKind:"conversationIntegrationTest",stop:r.stop,intentParams:{intent:!0},llmInteraction:wu.user("test",Ir())},t,s),null]}o(mUt,"handleChatMLChecked");var XHe=wo(at(dUt,mUt));d();d();var eje=require("crypto"),tje=require("http"),rje=require("stream"),nje=require("util"),uT=Xe(eh());var hUt=9e4,pUt=new uT.ProtocolRequestType("copilot/fetch"),gUt=new uT.ProtocolRequestType("copilot/fetchCancel"),AUt=new uT.ProgressType,yUt=new uT.ProtocolRequestType("copilot/fetchDisconnectAll"),$g=class extends Error{static{o(this,"EditorFetcherError")}constructor(t){super(t),this.name="EditorFetcherError"}},cT=class extends Or{constructor(r){super();this.ctx=r;this.name="EditorFetcher";this.userAgent=`GithubCopilot/${r.get(go).getVersion()}`}static{o(this,"EditorFetcher")}disconnectAll(){return this.ctx.get(jr).connection.sendRequest(yUt,{})}makeAbortController(){return new zV}async fetch(r,n){n.headers||={},n.headers["user-agent"]=this.userAgent;let{signal:i}=n,s=this.ctx.get(jr).connection,a=(0,eje.randomUUID)(),l=new Hn.CancellationTokenSource,c=new rje.PassThrough,u=o(()=>{s.sendRequest(gUt,{workDoneToken:a})},"sendCancelRequest"),f=o(()=>{c.emit("error",new YV("EditorFetch request aborted")),c.end()},"destroyBodyStream");if(i){if(!(i instanceof qHe))throw new $g("EditorFetcher received unexpected abort signal");if(i.aborted)throw new YV("EditorFetcher signal aborted before fetch");i.addEventListener("abort",u)}s.onProgress(AUt,a,h=>{h.kind==="end"?(i?.removeEventListener("abort",u),i?.removeEventListener("abort",f),h.error&&c.emit("error",new $g(h.error)),c.end()):h.kind==="report"&&c.write(h.chunk)});let m=await new Promise((h,p)=>{let g=setTimeout(()=>{p(new $g("Request timed out from lsp server"))},n.timeout??hUt),x=o(()=>{p(new YV("EditorFetcher request aborted"))},"rejectIfAborted");i?.addEventListener("abort",x),s.sendRequest(pUt,xUt(r,a,n),l.token).then(h).catch(v=>{let E="EditorFetcher request failed";v&&typeof v=="object"&&"message"in v&&(E+=`: ${String(v.message)}`),v&&typeof v=="object"&&"data"in v&&(E+=`: ${(0,nje.inspect)(v.data)}`),p(new $g(E))}).finally(()=>{i?.removeEventListener("abort",x),clearTimeout(g)})});if(!m.status)throw new $g("EditorFetcher received invalid response");return i?.addEventListener("abort",f),new By(m.status,tje.STATUS_CODES[m.status]??"",new UHe(m.headers),()=>CUt(c),()=>c)}};function CUt(e){return new Promise((t,r)=>{let n="";e.on("error",r),e.on("end",()=>t(n)),e.on("data",i=>n+=String(i))})}o(CUt,"consumeStream");function xUt(e,t,r){let{timeout:n,method:i}=r,s=r.headers??{},a=r.json?JSON.stringify(r.json):r.body;return r.json&&(s["content-type"]="application/json"),{url:e,headers:s,body:a,timeout:n,method:i,workDoneToken:t}}o(xUt,"convertOptionsToParams");var vUt=I.Object({url:I.String(),headers:I.Optional(I.Record(I.String(),I.String())),body:I.Optional(I.String()),timeout:I.Optional(I.Number()),method:I.Optional(I.Union([I.Literal("GET"),I.Literal("POST")])),cancelBeforeRequest:I.Optional(I.Boolean()),cancelAfterRequest:I.Optional(I.Boolean()),cancelAfterFirstChunk:I.Optional(I.Boolean())});async function bUt(e,t,r){let n=new cT(e),i=n.makeAbortController(),s=i.signal,{url:a,cancelBeforeRequest:l,cancelAfterRequest:c,cancelAfterFirstChunk:u,...f}=r;l&&i.abort();let m=n.fetch(a,{signal:s,...f});c&&i.abort();let h;try{h=await m}catch(x){return[{error:`Fetch stream error: ${x instanceof $g?x.message:String(x)}`},null]}let{status:p}=h,g=Object.fromEntries(Array.from(h.headers));try{if(u){let v=h.body();for await(let E of v){let b=E.toString();return i.abort(),[{status:p,headers:g,body:b},null]}}let x=await h.text();return[{status:p,headers:g,body:x},null]}catch(x){return[{error:`Fetch stream error: ${x instanceof $g?x.message:String(x)}`},null]}}o(bUt,"handleTestingFetchChecked");var ije=at(vUt,bUt);d();var EUt=I.Object({});async function IUt(e,t,r){return await e.get(Bo).flush(),["OK",null]}o(IUt,"handleTestingFlushPromiseQueueChecked");var oje=at(EUt,IUt);d();var TUt=I.Object({filePath:I.String(),code:I.String(),offset:I.Number(),languageId:I.String(),timeout:I.Optional(I.Number()),waitForContext:I.Optional(I.Boolean())});async function wUt(e,t,r){try{await e.get(Fg).start();let n=e.get(Fv),i=r.timeout??1e3,s=Date.now(),a=[],l=!0;for(;l;)try{a=await n.indexClient.getContext(r.filePath,r.code,r.offset,r.languageId,t)}catch{}finally{l=(r.waitForContext??!1)&&a.length==0&&Date.now()-s<i}return[{initialized:!0,context:a},null]}catch{return[{initialized:!1,context:[]},null]}}o(wUt,"handleTestingGetContextChecked");var sje=at(TUt,wUt);d();var _Ut=I.Object({uri:I.String()});async function SUt(e,t,r){let i=await e.get(Hr).getTextDocument(r);return[{uri:r.uri,languageId:i?.clientLanguageId??"unknown",version:i?.version??-1,text:i?.getText()??""},null]}o(SUt,"handleGetDocumentChecked");var aje=at(_Ut,SUt);d();d();d();var a$=Xe(require("assert"));var c2=class{constructor(){this.events=[];this.errors=[]}static{o(this,"TelemetrySpy")}sendTelemetryEvent(t,r={},n={}){this.events.push({name:t,properties:r,measurements:n})}sendTelemetryErrorEvent(t,r={},n={},i){this.errors.push({name:t,properties:r,measurements:n,errorProps:i})}sendTelemetryException(t,r={},n={}){this.events.push({name:"error.exception",properties:{message:t.message,...r},measurements:n})}dispose(){return Promise.resolve()}get hasEvent(){return this.events.length>0}get hasError(){return this.errors.length>0}get exceptions(){return this.events.filter(t=>t.name==="error.exception")}get hasException(){return this.exceptions.length>0}get firstEvent(){return this.events[0]}get firstError(){return this.errors[0]}get firstException(){return this.exceptions[0]}eventsMatching(t){return this.events.filter(t)}eventByName(t){let r=this.events.filter(n=>n.name===t);return a$.strictEqual(r.length,1,`Expected exactly one event with name ${t}`),r[0]}errorsMatching(t){return this.errors.filter(t)}exceptionsMatching(t){return this.exceptions.filter(t)}assertHasProperty(t){a$.ok(this.eventsMatching(r=>r.name!=="ghostText.produced").every(r=>t(r.properties)))}};var fT=class extends Bo{static{o(this,"TestPromiseQueue")}async awaitPromises(){await Promise.all(this.promises)}};var kUt=I.Object({});async function RUt(e,t,r){let n=e.get(Ds),i=n.getReporter(e),s=n.getRestrictedReporter(e);if(!(i instanceof c2)||!(s instanceof c2||s===void 0))return[null,{code:rn.InternalError,message:"Telemetry is not being captured. You must first call testing/setTelemetryCapture."}];let a=e.get(Bo);return a instanceof fT&&await a.awaitPromises(),[{standard:{events:i.events,errors:i.errors},restricted:{events:s?.events||[],errors:s?.errors||[]}},null]}o(RUt,"handleTestingGetTelemetryChecked");var lje=at(kUt,RUt);d();var BUt=I.Object({options:I.Optional(I.Object({}))});async function DUt(e,t,r){e.forceSet(wn,new s$),e.get(Xr).resetToken();try{await e.get(Xr).getToken()}catch{}return await new Promise(n=>setTimeout(n,0)),["OK",null]}o(DUt,"handleTestingNeverAuthChecked");var cje=at(BUt,DUt);d();d();var sde=class extends JR{static{o(this,"ExpConfigFetcher")}constructor(t){super(),this.fullConfig={Features:[],Flights:{},Configs:[{Id:"vscode",Parameters:t.Parameters}],ParameterGroups:[],AssignmentContext:t.AssignmentContext}}fetch(t,r){return t.endsWith("telemetry")?Promise.resolve(HHe(200,this.fullConfig)):Promise.resolve(tde(404,""))}},l$=class extends sde{constructor(r,n){super(r);this.delegate=n}static{o(this,"ExpConfigFetcherWithDelegate")}fetch(r,n){return r.endsWith("telemetry")?super.fetch(r,n):this.delegate.fetch(r,n)}makeAbortController(){return this.delegate.makeAbortController()}};var PUt=I.Object({expFlags:I.Record(I.String(),I.Union([I.String(),I.Number(),I.Boolean()]))});function FUt(e,t,r){if(r.expFlags){let n={AssignmentContext:"assignmentcontext",Parameters:{...r.expFlags}};e.forceSet(Or,new l$(n,e.get(Or)))}return["OK",null]}o(FUt,"handleTestingOverrideExpFlagsChecked");var uje=at(PUt,FUt);d();var NUt=I.Object({rules:dte});function LUt(e,t,r){let n=e.get(Qc);return n?(n.setTestingRules(r.rules),["OK",null]):[null,{code:rn.InternalError,message:"Could not set content exclusion rules"}]}o(LUt,"handleTestingSetContentExclusionRulesChecked");var fje=at(NUt,LUt);d();var QUt=I.Object({workDoneToken:I.Union([I.String(),I.Number()]),chunks:I.Array(I.String()),followUp:I.Optional(I.String()),suggestedTitle:I.Optional(I.String()),skills:I.Optional(I.Array(I.String())),references:I.Optional(I.Array(W9)),options:I.Optional(I.Object({}))});function MUt(e,t,r){return e.get(t2).add(r.workDoneToken,r.chunks,r.followUp,r.suggestedTitle,r.skills,r.references),["OK",null]}o(MUt,"handleTestingSetSyntheticTurnsChecked");var dje=at(QUt,MUt);d();var OUt=I.Object({telemetryCapture:I.Boolean()});async function UUt(e,t,r){return r.telemetryCapture?(await Xy(e,"agent",!1),e.get(Ds).setReporter(new c2),e.get(Ds).setRestrictedReporter(new c2),e.forceSet(Bo,new fT)):(await Xy(e,"agent",!0),e.forceSet(Bo,new Bo)),["OK",null]}o(UUt,"handleTestingSetTelemetryCaptureChecked");var mje=at(OUt,UUt);d();var qUt=I.Object({});async function WUt(e,t,r){let n=e.get(va),i=e.get(Wa);return await n.showWarningMessage("This is a test message",{title:"Some Action"}).then(a=>s(3,"response from message request",a?.title)).catch(a=>s(1,"error sending show message request",a)),["OK",null];function s(a,l,c){return i.logIt(e,a,"triggerShowMessage",`${l} (${String(c)})`)}o(s,"sendNotification")}o(WUt,"handleTriggerShowMessageChecked");var hje=at(qUt,WUt);d();var GUt=I.Object({options:I.Optional(I.Object({})),githubAppId:I.Optional(I.String())});async function HUt(e,t,r){return await YHe(e),e.forceSet(wn,new lT(e.get(Xr),r.githubAppId)),["OK",null]}o(HUt,"handleTestingUseTestingTokenChecked");var pje=at(GUt,HUt);d();var jUt=I.Object({});async function VUt(e,t,r){return await new R9().uninstall(e),["OK",null]}o(VUt,"handleUninstallChecked");var gje=at(jUt,VUt);d();var $Ut=oIe;function zUt(e,t,r){let n=e.get(cl),i={unregistered:[],notUnregistered:[]};return r.providers.forEach(s=>{try{n.unregisterContextProvider(s.id),i.unregistered.push(s.id)}catch{i.notUnregistered.push(s.id)}}),[i,null]}o(zUt,"unregisterContextProviders");var Aje=at($Ut,zUt);d();var ade=Xe(require("os"));var YUt=I.Object({expectedCertificate:I.String()});async function KUt(e,t,r){let i=(await uW(e).getAllRootCAs()).map(J9),s=J9(r.expectedCertificate);return i.includes(s)?[{status:!0,message:"Certificate verified"},null]:[{status:!1,message:`expected certificate not found - Expected to find certificate ${ufe(s)}. Only found those installed on the system:${ade.EOL}${i.map(a=>"- "+ufe(a)).join(ade.EOL)}`},null]}o(KUt,"handleVerifyCertificateChecked");var yje=at(YUt,KUt);d();var JUt=I.Object({});async function ZUt(){return[{status:!!await new hk().load()},null]}o(ZUt,"handleVerifyKerberosChecked");var Cje=at(JUt,ZUt);d();var XUt=I.Object({source:I.String(),version:I.Number(),uri:I.String()});async function eqt(e,t,r){let i=await e.get(Hr).getTextDocument(r);return i?i.getText()!==r.source?[{status:!1,message:`Source mismatch: [State] ${i.getText()} !== [Request] ${r.source}`},null]:i.version!==r.version?[{status:!1,message:`Version mismatch: [State] ${i.version} !== [Request] ${r.version}`},null]:[{status:!0,message:""},null]:[{status:!1,message:`Document not found: <${r.uri}>`},null]}o(eqt,"handleVerifyStateChecked");var xje=at(XUt,eqt);d();var tqt=I.Object({});function rqt(e,t,r){return[e.get(Hr).getWorkspaceFolders().map(i=>{let s=new URL(i.uri),a=decodeURIComponent(s.pathname);return{...i,path:a}}),null]}o(rqt,"handleVerifyWorkspaceStateChecked");var vje=at(tqt,rqt);var Xv=class{constructor(t){this.handlers=t}static{o(this,"MethodHandlers")}};function bje(){let e=new Map;return e.set(JWe.method,ZWe),e.set(XWe.method,eGe),e.set("getCompletions",GWe),e.set("getCompletionsCycling",HWe),e.set("getPanelCompletions",$We),e.set(_We.method,SWe),e.set("getVersion",zWe),e.set("setEditorInfo",hGe),e.set("checkStatus",LOe),e.set("checkFileStatus",NOe),e.set("signInInitiate",yfe),e.set("signIn",yfe),e.set("signInConfirm",pGe),e.set("signInWithGithubToken",gGe),e.set("signOut",AGe),e.set("notifyShown",oGe),e.set("notifyAccepted",nGe),e.set("notifyRejected",iGe),e.set("telemetry/exception",bGe),e.set("telemetry/authNotifyDismissed",yGe),e.set("telemetry/authNotifyShown",CGe),e.set("telemetry/gitHubLoginSuccess",xGe),e.set("telemetry/newGitHubLogin",vGe),e.set("textDocument/copilotInlineEdit",rGe),e.set("testing/overrideExpFlags",uje),e.set("testing/alwaysAuth",ZHe),e.set("testing/neverAuth",cje),e.set("testing/useTestingToken",pje),e.set("testing/setCompletionDocuments",OWe),e.set("testing/setPanelCompletionDocuments",TWe),e.set("testing/triggerShowMessageRequest",hje),e.set("testing/getTelemetry",lje),e.set("testing/setTelemetryCapture",mje),e.set("testing/flushPromiseQueue",oje),e.set("testing/getDocument",aje),e.set("testing/chatml",XHe),e.set("testing/setSyntheticTurns",dje),e.set("testing/fetch",ije),e.set("testing/setContentExclusionRules",fje),e.set("testing/setCopilotEditsResponse",hWe),e.set("testing/getContext",sje),e.set("uninstall",gje),e.set("debug/diagnostics",DWe),e.set("debug/listCertificates",tGe),e.set("debug/verifyState",xje),e.set("debug/verifyCertificate",yje),e.set("debug/verifyKerberos",Cje),e.set("debug/verifyWorkspaceState",vje),e.set("context/registerProviders",sGe),e.set("context/unregisterProviders",Aje),e.set("conversation/preconditions",aWe),e.set("conversation/persistence",iWe),e.set("conversation/create",rWe),e.set("conversation/turn",fWe),e.set("conversation/turnDelete",dWe),e.set("conversation/destroy",nWe),e.set("conversation/rating",lWe),e.set("conversation/copyCode",Wqe),e.set("conversation/insertCode",Gqe),e.set("conversation/templates",uWe),e.set("conversation/agents",qqe),e.set("conversation/registerTools",cWe),e.set("copilot/models",xWe),e.set("copilot/setModelPolicy",vWe),e.set("copilot/codeReview",mWe),e.set("git/commitGenerate",YWe),e.set("editConversation/create",pWe),e.set("editConversation/turn",AWe),e.set("editConversation/turnDelete",yWe),e.set("editConversation/destroy",gWe),e.set("mcp/getTools",CWe),new Xv(e)}o(bje,"getAllMethods");d();d();d();var Eje=Xe(eh());var zg=class{constructor(t){this.ctx=t}static{o(this,"AbstractNotification")}get type(){return new Eje.NotificationType(this.name)}};var lde=class extends zg{constructor(){super(...arguments);this.name=tZ.method;this.params=y5e}static{o(this,"DidChangeAuthNotificationHandler")}handle(r){let n=this.ctx.get(wn);r?.handle&&r?.accessToken?n.setTransientSession({accessToken:r.accessToken,login:r.handle,githubAppId:r.githubAppId}):n.setTransientSession(null)}},Ije=[lde];d();var cde=class extends zg{constructor(){super(...arguments);this.name=sZ.method;this.params=w5e}static{o(this,"DidShowCompletionNotificationHandler")}handle(r){let n=r.item.command.arguments[0],s=this.ctx.get(ts).get(n);s&&B6e(this.ctx,s)}},ude=class extends zg{constructor(){super(...arguments);this.name=cZ.method;this.params=B5e}static{o(this,"DidShowInlineEditNotificationHandler")}async handle(r){let n=r.item.command.arguments[0];await this.ctx.get(Nh).handleShown(n)}},fde=class extends zg{constructor(){super(...arguments);this.name=aZ.method;this.params=_5e}static{o(this,"DidPartiallyAcceptCompletionNotificationHandler")}handle(r){let n=r.item.command.arguments[0],i=r.acceptedLength,s=this.ctx.get(ts),a=s.get(n);a&&(s.delete(n),i>=a.insertText.length?RO(this.ctx,a):D6e(this.ctx,a,i))}},Tje=[cde,ude,fde];d();var c$=class extends zg{constructor(){super(...arguments);this.name="window/workDoneProgress/cancel";this.params=I.Object({token:I.Union([I.String(),I.Number()])})}static{o(this,"WorkDoneProgressCancelNotification")}handle(r){this.ctx.get(k0).cancel(r.token)}};var nqt=[...Ije,...Tje,c$];function wje(e,t){for(let r of nqt){let n=new r(e),i=us.Compile(n.params);t.onNotification(n.type,Vu(e,async s=>{$A(s),i.Check(s)?await n.handle(s):_0.error(e,`Notification ${n.name}:`,new mc(i.Errors(s)))},`Notification ${n.name}`))}}o(wje,"registerNotifications");d();var Sje=Xe(require("events")),u$=Xe(_l());var _je=new Ht("AgentTextDocumentConfiguration"),dde=class{constructor(t){this.ctx=t;this.emitter=new Sje.default}static{o(this,"AgentTextDocumentsConfiguration")}create(t,r,n,i){try{return z1.create(t,r,n,i)}catch(s){throw _je.exception(this.ctx,s,".create"),s}}update(t,r,n){try{let i=[];for(let a of r)if(u$.TextDocumentContentChangeEvent.isIncremental(a)){let l={range:a.range,rangeOffset:t.offsetAt(a.range.start),rangeLength:t.offsetAt(a.range.end)-t.offsetAt(a.range.start),text:a.text};i.push(l)}let s={document:{uri:t.uri,version:n},contentChanges:i};return this.emitter.emit("change",s),z1.withChanges(t,r,n)}catch(i){throw _je.exception(this.ctx,i,".update"),i}}},e3=class extends Hr{constructor(r){super(r);this._documents=new Map;this.workspaceFolders=[];this.onDidChangeTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._textDocumentConfiguration.emitter.on("change",s),{dispose:o(()=>{this._textDocumentConfiguration.emitter.removeListener("change",s)},"dispose")}},"onDidChangeTextDocument");this.onDidOpenTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._textDocumentConfiguration.emitter.on("open",s),{dispose:o(()=>{this._textDocumentConfiguration.emitter.removeListener("open",s)},"dispose")}},"onDidOpenTextDocument");this.onDidCloseTextDocument=o((r,n,i)=>{let s=r.bind(n);return this._textDocumentConfiguration.emitter.on("close",s),{dispose:o(()=>{this._textDocumentConfiguration.emitter.removeListener("close",s)},"dispose")}},"onDidCloseTextDocument");this.onDidFocusTextDocument=o((r,n,i)=>this.connection.onNotification(iZ.type,s=>{let a=("textDocument"in s?s.textDocument:s)??{};r.call(n,"uri"in a?{document:a}:void 0)}),"onDidFocusTextDocument");this._textDocumentConfiguration=new dde(r),this._notebookDocuments=new u$.NotebookDocuments(this._textDocumentConfiguration)}static{o(this,"AgentTextDocumentManager")}get connection(){return this.ctx.get(jr).connection}init(r){this.connection.onDidOpenTextDocument(n=>{let i=n.textDocument,s=this._textDocumentConfiguration.create(i.uri,i.languageId,i.version,i.text);this._documents.set(nc(i.uri),s),this._textDocumentConfiguration.emitter.emit("open",{document:{...i,uri:s.uri}})}),this.connection.onDidChangeTextDocument(n=>{let i=n.textDocument,s=n.contentChanges,{version:a}=i;if(a==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let l=nc(i.uri),c=this._documents.get(l);c!==void 0&&(c=this._textDocumentConfiguration.update(c,s,a),this._documents.set(l,c))}),this.connection.onDidCloseTextDocument(n=>{let i=nc(n.textDocument.uri);this._documents.delete(i),this._textDocumentConfiguration.emitter.emit("close",{document:{uri:i}})}),this._notebookDocuments.listen(this.connection),this.workspaceFolders.length=0,this.workspaceFolders.push(...r)}didChangeWorkspaceFolders(r){r.added.forEach(n=>this.registerWorkspaceFolder(n)),r.removed.forEach(n=>this.unregisterWorkspaceFolder(n))}unregisterWorkspaceFolder(r){let n=this.workspaceFolders.findIndex(i=>i.uri===r.uri);n>=0&&this.workspaceFolders.splice(n,1)}registerWorkspaceFolder(r){this.workspaceFolders.push(r)}getTextDocumentsUnsafe(){return[...this._documents.values()]}getTextDocumentUnsafe(r){return this._documents.get(nc(r.uri))}getWorkspaceFolders(){return this.workspaceFolders}findNotebook(r){let n=this._notebookDocuments.findNotebookDocumentForCell(r.uri);if(n)return{getCells:o(()=>n.cells.map((i,s)=>this.wrapCell(i,s)).filter(i=>!!i),"getCells"),getCellFor:o(({uri:i})=>{let s=n.cells.findIndex(a=>a.document===i);return s!==-1?this.wrapCell(n.cells[s],s):void 0},"getCellFor")}}wrapCell(r,n){let i=this._notebookDocuments.getCellTextDocument(r);if(i)return{kind:r.kind,metadata:r.metadata??{},index:n,document:i}}};var kje=us.Compile(E5e);function $A(e){if(e!==null){if(Array.isArray(e))for(let t=0;t<e.length;t++)e[t]=$A(e[t]);else if(typeof e=="object"){let t=e;for(let r in t)t[r]===null?delete t[r]:t[r]=$A(t[r])}return e}}o($A,"purgeNulls");var jr=class{constructor(t,r){this.ctx=t;this.connection=r;this.initialized=!1;this.#i=this.ctx.get(Wa)}static{o(this,"Service")}#e;#t;#i;get clientCapabilities(){return this.#t}listen(){let t=this.ctx,r=this.connection;r.onRequest(this.messageHandler.bind(this)),wje(t,r);let n={name:"GitHub Copilot Language Server",version:t.get(go).getDisplayVersion(),nodeVersion:process.versions.node},i,s=o(async c=>{try{if(i&&c&&typeof c=="object"&&!("settings"in c)){let u=await r.workspace.getConfiguration(["github.copilot",...hfe].map(m=>({section:m}))),f={github:{copilot:u.shift()}};for(let m of hfe)f[m]=u.shift();c.settings=f}return dGe(t,$A(c))}catch(u){_0.exception(t,u,"didChangeConfiguration")}},"didChangeConfiguration");function a(c){try{t.get(e3).didChangeWorkspaceFolders(c),t.get(Tf).emit(c)}catch(u){_0.exception(t,u,"didChangeWorkspaceFolders")}}o(a,"didChangeWorkspaceFolders"),this.connection.onNotification("vs/didAddWorkspaceFolder",({name:c,uri:u})=>a({added:[{uri:u,name:c??u}],removed:[]})),this.connection.onNotification("vs/didRemoveWorkspaceFolder",({name:c,uri:u})=>a({added:[],removed:[{uri:u,name:c??u}]})),r.onInitialize(async c=>{if(this.initialized)throw new Error("initialize request sent after initialized notification");this.#t=c.capabilities;let u=c.capabilities.copilot,f=$A(c.initializationOptions);if(f){if(!kje.Check(f))throw new mc(kje.Errors(f));let g=f,x=t.get(dn);g.editorPluginInfo?x.setEditorAndPluginInfo({version:"unknown",...g.editorPluginInfo},g.editorInfo&&{version:"unknown",...g.editorInfo},g.relatedPluginInfo??[]):_0.warn(t,"editorInfo and editorPluginInfo will soon be required in initializationOptions. This will replace setEditorInfo."),g.copilotIntegrationId&&x.setCopilotIntegrationId(g.copilotIntegrationId),g.githubAppId&&(t.get(ea).githubAppId=g.githubAppId),g.copilotCapabilities&&(u=g.copilotCapabilities)}let m=c.capabilities.workspace?.workspaceFolders??!1;t.get(e3).init(c.workspaceFolders??[]),U8e(this.ctx),t.get(Tf).emit({added:c.workspaceFolders??[],removed:[]}),i=c.capabilities.workspace?.configuration,u&&(t.get(Go).setCapabilities(u),"openURL"in u&&wH(t,["The openURL Copilot capability has been removed in favor of window/showDocument."]));let p=o(async()=>{this.initialized||(this.initialized=!0,_0.info(t,`${n.name} ${n.version} initialized`),m&&r.workspace.onDidChangeWorkspaceFolders(a),i?await s({}):await WR(t),this.installationTelemetryTimer=setTimeout(()=>{new R9().startup(t).catch(()=>{})},1e3),t.get(zA).emit(),await e6e(t))},"onInitialized");return r.onInitialized(Vu(t,p,"onInitialized")),t.get(Lh).init(),u?.token&&t.get(wn).setTransientSession(null),u?.redirectedTelemetry&&await POe(t),Rje.lt(process.versions.node,"20.8.0")&&_0.warn(t,`Node.js ${process.versions.node} support is deprecated. Please upgrade to Node.js 20.8 or newer.`),{capabilities:{textDocumentSync:{openClose:!0,change:jh.TextDocumentSyncKind.Incremental},notebookDocumentSync:{notebookSelector:[{notebook:"*"}]},workspace:{workspaceFolders:{supported:m,changeNotifications:m}},executeCommandProvider:{commands:wOe(t,r)},inlineCompletionProvider:{}},serverInfo:n}}),r.onShutdown(async()=>{await(this.#e??=this.deactivate())}),r.onExit(()=>void this.onExit()),r.onDidChangeConfiguration(Vu(t,s,"onDidChangeConfiguration")),r.listen();let l=new UH;this.ctx.forceSet(Wa,l)}async messageHandler(t,r,n){let i=this.ctx.get(Xv).handlers.get(t);if(!i)return new jh.ResponseError(rn.MethodNotFound,`Method not found: ${t}`);if(!this.initialized)return new jh.ResponseError(rn.ServerNotInitialized,"Agent service not initialized.");if(this.#e)return new jh.ResponseError(rn.InvalidRequest,"Agent service shut down.");if(t!=="setEditorInfo"&&!kOe(this.ctx.get(dn)))throw new jh.ResponseError(rn.ServerNotInitialized,"editorInfo and editorPluginInfo not set in initializationOptions");Array.isArray(r)&&(r=r[0]),$A(r);try{let[s,a]=await i(this.ctx,n,r);return a?new jh.ResponseError(a.code,a.message,a.data):s}catch(s){if(n.isCancellationRequested)return new jh.ResponseError(rn.RequestCancelled,"Request was canceled");if(s instanceof Ks)return new jh.ResponseError(rn.NoCopilotToken,`Not authenticated: ${s.message}`);throw s instanceof jh.ResponseError||_0.exception(this.ctx,s,`Request ${t}`),s}}async onExit(){try{this.ctx.get(_h).dispose()}catch(t){_0.exception(this.ctx,t,"failed to dispose ripgrep process manager")}this.ctx.forceSet(Wa,this.#i),await(this.#e??=this.deactivate())}async deactivate(){let t=this.ctx;clearTimeout(this.installationTelemetryTimer),Hre(t),await Promise.race([new Promise(r=>setTimeout(r,100)),t.get(Bo).flush()]),await Promise.race([new Promise(r=>setTimeout(r,1800)),t.get(Ds).deactivate()])}dispose(){clearTimeout(this.installationTelemetryTimer),this.connection.dispose()}},_0=new Ht("lsp");var f$=class e extends p4{constructor(r){super(r);this.reportedUnknownProviders=new Set}static{o(this,"AgentRelatedFilesProvider")}get service(){return this.context.get(jr)}static mapProviderNameToNeighboringFileType(r){let n="CSharpCopilotCompletionContextProvider",i="CSharpRoslynCompletionRelatedContextProvider",s="CppCopilotCompletionContextProvider",a="CppCopilotCompletionSemanticCodeContextProvider";switch(r){case n:return"related/csharp";case i:return"related/csharproslyn";case s:return"related/cpp";case a:return"related/cppsemanticcodecontext";default:return"related/other"}}convert(r){let n={entries:[],traits:r.traits};for(let i of r.entries){let s={type:e.mapProviderNameToNeighboringFileType(i.providerName),uris:i.uris};n.entries.push(s),s.type==="related/other"&&!this.reportedUnknownProviders.has(i.providerName)&&(this.reportedUnknownProviders.add(i.providerName),ll.warn(this.context,`unknown providerName ${i.providerName}`))}return n}async getRelatedFilesResponse(r,n,i){ll.debug(this.context,`Fetching related files for ${r.uri}`);let s=this.context.get(Go).getCapabilities().related??!1;if(e.relatedCapabilityTelemetry(this.context,n,s),!s)return ll.debug(this.context,"`copilot/related` not supported"),W8e;try{let a=await this.service.connection.sendRequest(uZ.type,{textDocument:{uri:r.uri},data:r.data,telemetry:{properties:n.properties,measurements:n.measurements}},i);return this.convert(a)}catch(a){ll.exception(this.context,a,".copilotRelated");return}}static{this.telemetrySent=!1}static relatedCapabilityTelemetry(r,n,i){try{if(!i||e.telemetrySent)return;e.telemetrySent=!0,jt(r,"copilotRelated.hasRelatedCapability",n)}catch(s){ll.exception(r,s,"copilotRelated")}}};d();var Bje=Xe(_l());var mde=new Ht("copilotTokenManager"),hde=class e extends II{static{o(this,"AgentClientCopilotTokenManager")}static{this.RequestType=new Bje.ProtocolRequestType("copilot/token")}constructor(t,r=!1){super(t,r)}async fetchCopilotTokenEnvelope(){let t=this.ctx.get(jr).connection;try{this.didChangeToken??=t.onNotification("copilot/didChangeToken",()=>{this.resetToken()});let r=await t.sendRequest(e.RequestType,{force:!1});if(!r?.envelope)throw mde.debug(this.ctx,"Envelope missing from copilot/token response"),new hd({reason:"NotSignedIn",message:"Editor did not return a token"});let{accessToken:n,handle:i,githubAppId:s,envelope:a,tokenEndpoint:l}=r;mde.debug(this.ctx,"Retrieved envelope from copilot/token");let c=new q1(a);if(c.isExpired())throw new Ks("Expired token in copilot/token response");if(i&&n){let u;if(l!==void 0){try{u=new URL(l).origin}catch{mde.warn(this.ctx,`Invalid token endpoint URL <${l}>`)}this.ctx.get($n).updateBaseUrlFromTokenEndpoint(this.ctx,l)}this.ctx.get(wn).setTransientSession({accessToken:n,login:i,githubAppId:s,apiUrl:u},!1)}else if(!await this.getGitHubSession())throw new hd({reason:"NotSignedIn"});return Ew(this.ctx,c),a}catch(r){throw r instanceof Error?new Ks(r.message,r):r}}},ZR=class extends Xr{constructor(r,n=new II(r,!0)){super();this.ctx=r;this.fallback=n;this.client=new hde(r,!0)}static{o(this,"AgentCopilotTokenManager")}canGetToken(){return this.ctx.get(Go).getCapabilities().token??!1}getDelegate(){return this.canGetToken()?this.client:this.fallback}resetToken(r){this.getDelegate().resetToken(r)}async getToken(){return this.getDelegate().getToken()}async getGitHubSession(){return this.fallback.getGitHubSession()}};d();var iqt=new Ht("Public Code References"),d$=class extends af{static{o(this,"CLSCitationManager")}async handleIPCodeCitation(t,r){let n=r.location?.start.line!==void 0?r.location.start.line+1:"-",i=r.location?.start.character!==void 0?r.location.start.character+1:"-",s=(r.matchingText??"").replace(/[\r\n]/g," ");iqt.info(t,`Text found matching public code in ${r.inDocumentUri} [Ln ${n}, Col ${i}] near ${s}...:`+r.details.map((a,l)=>`
1435
1435
  ${l+1}) [${a.license}] ${a.url}`).join("")),!(r.version===void 0||r.location===void 0)&&t.get(Go).getCapabilities().ipCodeCitation===!0&&await t.get(jr).connection.sendNotification(rZ.type,{uri:r.inDocumentUri,version:r.version,range:r.location,matchingText:r.matchingText??"",citations:r.details})}};d();d();function Dje(e){oqt(e)}o(Dje,"activateExtensibilityPlatformFeature");function oqt(e){e.set(Uh,new nV(e)),e.set(Mg,new Mg(e))}o(oqt,"registerContextDependencies");d();var Pje=I.String(),pde=class{constructor(t){this.turnContext=t}static{o(this,"BuildLogsSkillProcessor")}value(){return .9}processSkill(t){return this.turnContext.collectLabel(h$,"build logs"),`The contents of the application build logs:
1436
1436
  \`\`\`
1437
1437
  ${t}