@opensumi/cli-engine 3.9.1-next-1747791726.0 → 3.9.1-next-1747836538.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.
Files changed (2) hide show
  1. package/lib/browser/browser.js +22 -22
  2. package/package.json +10 -10
@@ -31587,19 +31587,19 @@ and limitations under the License.
31587
31587
  `)[0];let c,y=f.match(QUERY_WORD_REGEX)[0];switch(u){case 2:c=new RangeError(`Bad node name '${y}'`);break;case 3:c=new RangeError(`Bad field name '${y}'`);break;case 4:c=new RangeError(`Bad capture name @${y}`);break;case 5:c=new TypeError(`Bad pattern structure at offset ${E}: '${f}'...`),y="";break;default:c=new SyntaxError(`Bad syntax at offset ${E}: '${f}'...`),y=""}throw c.index=E,c.length=y.length,C._free(n),c}const o=C._ts_query_string_count(r),a=C._ts_query_capture_count(r),p=C._ts_query_pattern_count(r),v=new Array(a),m=new Array(o);for(let u=0;u<a;u++){const d=C._ts_query_capture_name_for_id(r,u,TRANSFER_BUFFER),E=getValue(TRANSFER_BUFFER,"i32");v[u]=UTF8ToString(d,E)}for(let u=0;u<o;u++){const d=C._ts_query_string_value_for_id(r,u,TRANSFER_BUFFER),E=getValue(TRANSFER_BUFFER,"i32");m[u]=UTF8ToString(d,E)}const _=new Array(p),s=new Array(p),g=new Array(p),l=new Array(p),h=new Array(p);for(let u=0;u<p;u++){const d=C._ts_query_predicates_for_pattern(r,u,TRANSFER_BUFFER),E=getValue(TRANSFER_BUFFER,"i32");l[u]=[],h[u]=[];const f=[];let c=d;for(let y=0;y<E;y++){const b=getValue(c,"i32");c+=SIZE_OF_INT;const A=getValue(c,"i32");if(c+=SIZE_OF_INT,b===PREDICATE_STEP_TYPE_CAPTURE)f.push({type:"capture",name:v[A]});else if(b===PREDICATE_STEP_TYPE_STRING)f.push({type:"string",value:m[A]});else if(f.length>0){if(f[0].type!=="string")throw new Error("Predicates must begin with a literal value");const S=f[0].value;let D,I=!0,w=!0;switch(S){case"any-not-eq?":case"not-eq?":I=!1;case"any-eq?":case"eq?":if(f.length!==3)throw new Error(`Wrong number of arguments to \`#${S}\` predicate. Expected 2, got ${f.length-1}`);if(f[1].type!=="capture")throw new Error(`First argument of \`#${S}\` predicate must be a capture. Got "${f[1].value}"`);if(w=!S.startsWith("any-"),f[2].type==="capture"){const O=f[1].name,M=f[2].name;h[u].push(k=>{const F=[],L=[];for(const U of k)U.name===O&&F.push(U.node),U.name===M&&L.push(U.node);const B=(U,W,j)=>j?U.text===W.text:U.text!==W.text;return w?F.every(U=>L.some(W=>B(U,W,I))):F.some(U=>L.some(W=>B(U,W,I)))})}else{D=f[1].name;const O=f[2].value,M=F=>F.text===O,k=F=>F.text!==O;h[u].push(F=>{const L=[];for(const U of F)U.name===D&&L.push(U.node);const B=I?M:k;return w?L.every(B):L.some(B)})}break;case"any-not-match?":case"not-match?":I=!1;case"any-match?":case"match?":if(f.length!==3)throw new Error(`Wrong number of arguments to \`#${S}\` predicate. Expected 2, got ${f.length-1}.`);if(f[1].type!=="capture")throw new Error(`First argument of \`#${S}\` predicate must be a capture. Got "${f[1].value}".`);if(f[2].type!=="string")throw new Error(`Second argument of \`#${S}\` predicate must be a string. Got @${f[2].value}.`);D=f[1].name;const T=new RegExp(f[2].value);w=!S.startsWith("any-"),h[u].push(O=>{const M=[];for(const F of O)F.name===D&&M.push(F.node.text);const k=(F,L)=>L?T.test(F):!T.test(F);return M.length===0?!I:w?M.every(F=>k(F,I)):M.some(F=>k(F,I))});break;case"set!":if(f.length<2||f.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${f.length-1}.`);if(f.some(O=>O.type!=="string"))throw new Error('Arguments to `#set!` predicate must be a strings.".');_[u]||(_[u]={}),_[u][f[1].value]=f[2]?f[2].value:null;break;case"is?":case"is-not?":if(f.length<2||f.length>3)throw new Error(`Wrong number of arguments to \`#${S}\` predicate. Expected 1 or 2. Got ${f.length-1}.`);if(f.some(O=>O.type!=="string"))throw new Error(`Arguments to \`#${S}\` predicate must be a strings.".`);const R=S==="is?"?s:g;R[u]||(R[u]={}),R[u][f[1].value]=f[2]?f[2].value:null;break;case"not-any-of?":I=!1;case"any-of?":if(f.length<2)throw new Error(`Wrong number of arguments to \`#${S}\` predicate. Expected at least 1. Got ${f.length-1}.`);if(f[1].type!=="capture")throw new Error(`First argument of \`#${S}\` predicate must be a capture. Got "${f[1].value}".`);for(let O=2;O<f.length;O++)if(f[O].type!=="string")throw new Error(`Arguments to \`#${S}\` predicate must be a strings.".`);D=f[1].name;const P=f.slice(2).map(O=>O.value);h[u].push(O=>{const M=[];for(const k of O)k.name===D&&M.push(k.node.text);return M.length===0?!I:M.every(k=>P.includes(k))===I});break;default:l[u].push({operator:S,operands:f.slice(1)})}f.length=0}}Object.freeze(_[u]),Object.freeze(s[u]),Object.freeze(g[u])}return C._free(n),new Query(INTERNAL,r,v,h,l,Object.freeze(_),Object.freeze(s),Object.freeze(g))}static load(t){let e;if(t instanceof Uint8Array)e=Promise.resolve(t);else{const n=t;if(typeof process<"u"&&process.versions&&process.versions.node){const r=__webpack_require__(83078);e=Promise.resolve(r.readFileSync(n))}else e=fetch(n).then(r=>r.arrayBuffer().then(o=>{if(r.ok)return new Uint8Array(o);{const a=new TextDecoder("utf-8").decode(o);throw new Error(`Language.load failed with status ${r.status}.
31588
31588
 
31589
31589
  ${a}`)}}))}return e.then(n=>loadWebAssemblyModule(n,{loadAsync:!0})).then(n=>{const r=Object.keys(n),o=r.find(p=>LANGUAGE_FUNCTION_REGEX.test(p)&&!p.includes("external_scanner_"));o||console.log(`Couldn't find language function in WASM file. Symbols:
31590
- ${JSON.stringify(r,null,2)}`);const a=n[o]();return new Language(INTERNAL,a)})}}class LookaheadIterable{constructor(t,e,n){assertInternal(t),this[0]=e,this.language=n}get currentTypeId(){return C._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){C._ts_lookahead_iterator_delete(this[0]),this[0]=0}resetState(t){return C._ts_lookahead_iterator_reset_state(this[0],t)}reset(t,e){return!!C._ts_lookahead_iterator_reset(this[0],t[0],e)&&(this.language=t,!0)}[Symbol.iterator](){const t=this;return{next:()=>C._ts_lookahead_iterator_next(t[0])?{done:!1,value:t.currentType}:{done:!0,value:""}}}}class Query{constructor(t,e,n,r,o,a,p,v){assertInternal(t),this[0]=e,this.captureNames=n,this.textPredicates=r,this.predicates=o,this.setProperties=a,this.assertedProperties=p,this.refutedProperties=v,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(t,{startPosition:e=ZERO_POINT,endPosition:n=ZERO_POINT,startIndex:r=0,endIndex:o=0,matchLimit:a=4294967295,maxStartDepth:p=4294967295}={}){if(typeof a!="number")throw new Error("Arguments must be numbers");marshalNode(t),C._ts_query_matches_wasm(this[0],t.tree[0],e.row,e.column,n.row,n.column,r,o,a,p);const v=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),_=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),s=new Array(v);this.exceededMatchLimit=!!_;let g=0,l=m;for(let h=0;h<v;h++){const u=getValue(l,"i32");l+=SIZE_OF_INT;const d=getValue(l,"i32");l+=SIZE_OF_INT;const E=new Array(d);if(l=unmarshalCaptures(this,t.tree,l,E),this.textPredicates[u].every(f=>f(E))){s[g]={pattern:u,captures:E};const f=this.setProperties[u];f&&(s[g].setProperties=f);const c=this.assertedProperties[u];c&&(s[g].assertedProperties=c);const y=this.refutedProperties[u];y&&(s[g].refutedProperties=y),g++}}return s.length=g,C._free(m),s}captures(t,{startPosition:e=ZERO_POINT,endPosition:n=ZERO_POINT,startIndex:r=0,endIndex:o=0,matchLimit:a=4294967295,maxStartDepth:p=4294967295}={}){if(typeof a!="number")throw new Error("Arguments must be numbers");marshalNode(t),C._ts_query_captures_wasm(this[0],t.tree[0],e.row,e.column,n.row,n.column,r,o,a,p);const v=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),_=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),s=[];this.exceededMatchLimit=!!_;const g=[];let l=m;for(let h=0;h<v;h++){const u=getValue(l,"i32");l+=SIZE_OF_INT;const d=getValue(l,"i32");l+=SIZE_OF_INT;const E=getValue(l,"i32");if(l+=SIZE_OF_INT,g.length=d,l=unmarshalCaptures(this,t.tree,l,g),this.textPredicates[u].every(f=>f(g))){const f=g[E],c=this.setProperties[u];c&&(f.setProperties=c);const y=this.assertedProperties[u];y&&(f.assertedProperties=y);const b=this.refutedProperties[u];b&&(f.refutedProperties=b),s.push(f)}}return C._free(m),s}predicatesForPattern(t){return this.predicates[t]}disableCapture(t){const e=lengthBytesUTF8(t),n=C._malloc(e+1);stringToUTF8(t,n,e+1),C._ts_query_disable_capture(this[0],n,e),C._free(n)}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(x,t,e){const n=e-t;let r=x.textCallback(t,null,e);for(t+=r.length;t<e;){const o=x.textCallback(t,null,e);if(!(o&&o.length>0))break;t+=o.length,r+=o}return t>e&&(r=r.slice(0,n)),r}function unmarshalCaptures(x,t,e,n){for(let r=0,o=n.length;r<o;r++){const a=getValue(e,"i32"),p=unmarshalNode(t,e+=SIZE_OF_INT);e+=SIZE_OF_NODE,n[r]={name:x.captureNames[a],node:p}}return e}function assertInternal(x){if(x!==INTERNAL)throw new Error("Illegal constructor")}function isPoint(x){return x&&typeof x.row=="number"&&typeof x.column=="number"}function marshalNode(x){let t=TRANSFER_BUFFER;setValue(t,x.id,"i32"),t+=SIZE_OF_INT,setValue(t,x.startIndex,"i32"),t+=SIZE_OF_INT,setValue(t,x.startPosition.row,"i32"),t+=SIZE_OF_INT,setValue(t,x.startPosition.column,"i32"),t+=SIZE_OF_INT,setValue(t,x[0],"i32")}function unmarshalNode(x,t=TRANSFER_BUFFER){const e=getValue(t,"i32");if(e===0)return null;const n=getValue(t+=SIZE_OF_INT,"i32"),r=getValue(t+=SIZE_OF_INT,"i32"),o=getValue(t+=SIZE_OF_INT,"i32"),a=getValue(t+=SIZE_OF_INT,"i32"),p=new Node(INTERNAL,x);return p.id=e,p.startIndex=n,p.startPosition={row:r,column:o},p[0]=a,p}function marshalTreeCursor(x,t=TRANSFER_BUFFER){setValue(t+0*SIZE_OF_INT,x[0],"i32"),setValue(t+1*SIZE_OF_INT,x[1],"i32"),setValue(t+2*SIZE_OF_INT,x[2],"i32"),setValue(t+3*SIZE_OF_INT,x[3],"i32")}function unmarshalTreeCursor(x){x[0]=getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),x[1]=getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),x[2]=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),x[3]=getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(x,t){setValue(x,t.row,"i32"),setValue(x+SIZE_OF_INT,t.column,"i32")}function unmarshalPoint(x){return{row:getValue(x,"i32")>>>0,column:getValue(x+SIZE_OF_INT,"i32")>>>0}}function marshalRange(x,t){marshalPoint(x,t.startPosition),marshalPoint(x+=SIZE_OF_POINT,t.endPosition),setValue(x+=SIZE_OF_POINT,t.startIndex,"i32"),setValue(x+=SIZE_OF_INT,t.endIndex,"i32"),x+=SIZE_OF_INT}function unmarshalRange(x){const t={};return t.startPosition=unmarshalPoint(x),x+=SIZE_OF_POINT,t.endPosition=unmarshalPoint(x),x+=SIZE_OF_POINT,t.startIndex=getValue(x,"i32")>>>0,x+=SIZE_OF_INT,t.endIndex=getValue(x,"i32")>>>0,t}function marshalEdit(x){let t=TRANSFER_BUFFER;marshalPoint(t,x.startPosition),t+=SIZE_OF_POINT,marshalPoint(t,x.oldEndPosition),t+=SIZE_OF_POINT,marshalPoint(t,x.newEndPosition),t+=SIZE_OF_POINT,setValue(t,x.startIndex,"i32"),t+=SIZE_OF_INT,setValue(t,x.oldEndIndex,"i32"),t+=SIZE_OF_INT,setValue(t,x.newEndIndex,"i32"),t+=SIZE_OF_INT}for(const x of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype,x,{value:ParserImpl.prototype[x],enumerable:!1,writable:!1});Parser.Language=Language,Module.onRuntimeInitialized=()=>{ParserImpl.init(),resolveInitPromise()}}))}}return Parser}();module.exports=TreeSitter},52730:(x,t,e)=>{"use strict";var n=e(80705),r=e(14834),o=e(28498),a=e(79818),p=e(69336),v=a("Object.prototype.toString"),m=e(51913)(),_=typeof globalThis>"u"?e.g:globalThis,s=r(),g=a("String.prototype.slice"),l=Object.getPrototypeOf,h=a("Array.prototype.indexOf",!0)||function(c,y){for(var b=0;b<c.length;b+=1)if(c[b]===y)return b;return-1},u={__proto__:null};m&&p&&l?n(s,function(f){var c=new _[f];if(Symbol.toStringTag in c){var y=l(c),b=p(y,Symbol.toStringTag);if(!b){var A=l(y);b=p(A,Symbol.toStringTag)}u["$"+f]=o(b.get)}}):n(s,function(f){var c=new _[f],y=c.slice||c.set;y&&(u["$"+f]=o(y))});var d=function(c){var y=!1;return n(u,function(b,A){if(!y)try{"$"+b(c)===A&&(y=g(A,1))}catch{}}),y},E=function(c){var y=!1;return n(u,function(b,A){if(!y)try{b(c),y=g(A,1)}catch{}}),y};x.exports=function(c){if(!c||typeof c!="object")return!1;if(!m){var y=g(v(c),8,-1);return h(s,y)>-1?y:y!=="Object"?!1:E(c)}return p?d(c):null}},97442:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ZodError=t.quotelessJson=t.ZodIssueCode=void 0;const n=e(94705);t.ZodIssueCode=n.util.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"]);const r=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:");t.quotelessJson=r;class o extends Error{get errors(){return this.issues}constructor(p){super(),this.issues=[],this.addIssue=m=>{this.issues=[...this.issues,m]},this.addIssues=(m=[])=>{this.issues=[...this.issues,...m]};const v=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,v):this.__proto__=v,this.name="ZodError",this.issues=p}format(p){const v=p||function(s){return s.message},m={_errors:[]},_=s=>{for(const g of s.issues)if(g.code==="invalid_union")g.unionErrors.map(_);else if(g.code==="invalid_return_type")_(g.returnTypeError);else if(g.code==="invalid_arguments")_(g.argumentsError);else if(g.path.length===0)m._errors.push(v(g));else{let l=m,h=0;for(;h<g.path.length;){const u=g.path[h];h===g.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(v(g))):l[u]=l[u]||{_errors:[]},l=l[u],h++}}};return _(this),m}static assert(p){if(!(p instanceof o))throw new Error(`Not a ZodError: ${p}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,n.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(p=v=>v.message){const v={},m=[];for(const _ of this.issues)_.path.length>0?(v[_.path[0]]=v[_.path[0]]||[],v[_.path[0]].push(p(_))):m.push(p(_));return{formErrors:m,fieldErrors:v}}get formErrors(){return this.flatten()}}t.ZodError=o,o.create=a=>new o(a)},30548:function(x,t,e){"use strict";var n=this&&this.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorMap=t.setErrorMap=t.defaultErrorMap=void 0;const r=n(e(28412));t.defaultErrorMap=r.default;let o=r.default;function a(v){o=v}t.setErrorMap=a;function p(){return o}t.getErrorMap=p},86340:function(x,t,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(o,a,p,v){v===void 0&&(v=p);var m=Object.getOwnPropertyDescriptor(a,p);(!m||("get"in m?!a.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return a[p]}}),Object.defineProperty(o,v,m)}:function(o,a,p,v){v===void 0&&(v=p),o[v]=a[p]}),r=this&&this.__exportStar||function(o,a){for(var p in o)p!=="default"&&!Object.prototype.hasOwnProperty.call(a,p)&&n(a,o,p)};Object.defineProperty(t,"__esModule",{value:!0}),r(e(30548),t),r(e(66258),t),r(e(29201),t),r(e(94705),t),r(e(75226),t),r(e(97442),t)},15759:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errorUtil=void 0;var e;(function(n){n.errToObj=r=>typeof r=="string"?{message:r}:r||{},n.toString=r=>typeof r=="string"?r:r?.message})(e||(t.errorUtil=e={}))},66258:function(x,t,e){"use strict";var n=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=t.isValid=t.isDirty=t.isAborted=t.OK=t.DIRTY=t.INVALID=t.ParseStatus=t.addIssueToContext=t.EMPTY_PATH=t.makeIssue=void 0;const r=e(30548),o=n(e(28412)),a=u=>{const{data:d,path:E,errorMaps:f,issueData:c}=u,y=[...E,...c.path||[]],b={...c,path:y};if(c.message!==void 0)return{...c,path:y,message:c.message};let A="";const S=f.filter(D=>!!D).slice().reverse();for(const D of S)A=D(b,{data:d,defaultError:A}).message;return{...c,path:y,message:A}};t.makeIssue=a,t.EMPTY_PATH=[];function p(u,d){const E=(0,r.getErrorMap)(),f=(0,t.makeIssue)({issueData:d,data:u.data,path:u.path,errorMaps:[u.common.contextualErrorMap,u.schemaErrorMap,E,E===o.default?void 0:o.default].filter(c=>!!c)});u.common.issues.push(f)}t.addIssueToContext=p;class v{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(d,E){const f=[];for(const c of E){if(c.status==="aborted")return t.INVALID;c.status==="dirty"&&d.dirty(),f.push(c.value)}return{status:d.value,value:f}}static async mergeObjectAsync(d,E){const f=[];for(const c of E){const y=await c.key,b=await c.value;f.push({key:y,value:b})}return v.mergeObjectSync(d,f)}static mergeObjectSync(d,E){const f={};for(const c of E){const{key:y,value:b}=c;if(y.status==="aborted"||b.status==="aborted")return t.INVALID;y.status==="dirty"&&d.dirty(),b.status==="dirty"&&d.dirty(),y.value!=="__proto__"&&(typeof b.value<"u"||c.alwaysSet)&&(f[y.value]=b.value)}return{status:d.value,value:f}}}t.ParseStatus=v,t.INVALID=Object.freeze({status:"aborted"});const m=u=>({status:"dirty",value:u});t.DIRTY=m;const _=u=>({status:"valid",value:u});t.OK=_;const s=u=>u.status==="aborted";t.isAborted=s;const g=u=>u.status==="dirty";t.isDirty=g;const l=u=>u.status==="valid";t.isValid=l;const h=u=>typeof Promise<"u"&&u instanceof Promise;t.isAsync=h},29201:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},94705:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getParsedType=t.ZodParsedType=t.objectUtil=t.util=void 0;var e;(function(o){o.assertEqual=m=>m;function a(m){}o.assertIs=a;function p(m){throw new Error}o.assertNever=p,o.arrayToEnum=m=>{const _={};for(const s of m)_[s]=s;return _},o.getValidEnumValues=m=>{const _=o.objectKeys(m).filter(g=>typeof m[m[g]]!="number"),s={};for(const g of _)s[g]=m[g];return o.objectValues(s)},o.objectValues=m=>o.objectKeys(m).map(function(_){return m[_]}),o.objectKeys=typeof Object.keys=="function"?m=>Object.keys(m):m=>{const _=[];for(const s in m)Object.prototype.hasOwnProperty.call(m,s)&&_.push(s);return _},o.find=(m,_)=>{for(const s of m)if(_(s))return s},o.isInteger=typeof Number.isInteger=="function"?m=>Number.isInteger(m):m=>typeof m=="number"&&isFinite(m)&&Math.floor(m)===m;function v(m,_=" | "){return m.map(s=>typeof s=="string"?`'${s}'`:s).join(_)}o.joinValues=v,o.jsonStringifyReplacer=(m,_)=>typeof _=="bigint"?_.toString():_})(e||(t.util=e={}));var n;(function(o){o.mergeShapes=(a,p)=>({...a,...p})})(n||(t.objectUtil=n={})),t.ZodParsedType=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);const r=o=>{switch(typeof o){case"undefined":return t.ZodParsedType.undefined;case"string":return t.ZodParsedType.string;case"number":return isNaN(o)?t.ZodParsedType.nan:t.ZodParsedType.number;case"boolean":return t.ZodParsedType.boolean;case"function":return t.ZodParsedType.function;case"bigint":return t.ZodParsedType.bigint;case"symbol":return t.ZodParsedType.symbol;case"object":return Array.isArray(o)?t.ZodParsedType.array:o===null?t.ZodParsedType.null:o.then&&typeof o.then=="function"&&o.catch&&typeof o.catch=="function"?t.ZodParsedType.promise:typeof Map<"u"&&o instanceof Map?t.ZodParsedType.map:typeof Set<"u"&&o instanceof Set?t.ZodParsedType.set:typeof Date<"u"&&o instanceof Date?t.ZodParsedType.date:t.ZodParsedType.object;default:return t.ZodParsedType.unknown}};t.getParsedType=r},75995:function(x,t,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(v,m,_,s){s===void 0&&(s=_);var g=Object.getOwnPropertyDescriptor(m,_);(!g||("get"in g?!m.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return m[_]}}),Object.defineProperty(v,s,g)}:function(v,m,_,s){s===void 0&&(s=_),v[s]=m[_]}),r=this&&this.__setModuleDefault||(Object.create?function(v,m){Object.defineProperty(v,"default",{enumerable:!0,value:m})}:function(v,m){v.default=m}),o=this&&this.__importStar||function(v){if(v&&v.__esModule)return v;var m={};if(v!=null)for(var _ in v)_!=="default"&&Object.prototype.hasOwnProperty.call(v,_)&&n(m,v,_);return r(m,v),m},a=this&&this.__exportStar||function(v,m){for(var _ in v)_!=="default"&&!Object.prototype.hasOwnProperty.call(m,_)&&n(m,v,_)};Object.defineProperty(t,"__esModule",{value:!0}),t.z=void 0;const p=o(e(86340));t.z=p,a(e(86340),t),t.default=p},28412:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(94705),r=e(97442),o=(a,p)=>{let v;switch(a.code){case r.ZodIssueCode.invalid_type:a.received===n.ZodParsedType.undefined?v="Required":v=`Expected ${a.expected}, received ${a.received}`;break;case r.ZodIssueCode.invalid_literal:v=`Invalid literal value, expected ${JSON.stringify(a.expected,n.util.jsonStringifyReplacer)}`;break;case r.ZodIssueCode.unrecognized_keys:v=`Unrecognized key(s) in object: ${n.util.joinValues(a.keys,", ")}`;break;case r.ZodIssueCode.invalid_union:v="Invalid input";break;case r.ZodIssueCode.invalid_union_discriminator:v=`Invalid discriminator value. Expected ${n.util.joinValues(a.options)}`;break;case r.ZodIssueCode.invalid_enum_value:v=`Invalid enum value. Expected ${n.util.joinValues(a.options)}, received '${a.received}'`;break;case r.ZodIssueCode.invalid_arguments:v="Invalid function arguments";break;case r.ZodIssueCode.invalid_return_type:v="Invalid function return type";break;case r.ZodIssueCode.invalid_date:v="Invalid date";break;case r.ZodIssueCode.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(v=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(v=`${v} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?v=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?v=`Invalid input: must end with "${a.validation.endsWith}"`:n.util.assertNever(a.validation):a.validation!=="regex"?v=`Invalid ${a.validation}`:v="Invalid";break;case r.ZodIssueCode.too_small:a.type==="array"?v=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?v=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?v=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?v=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:v="Invalid input";break;case r.ZodIssueCode.too_big:a.type==="array"?v=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?v=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?v=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?v=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?v=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:v="Invalid input";break;case r.ZodIssueCode.custom:v="Invalid input";break;case r.ZodIssueCode.invalid_intersection_types:v="Intersection results could not be merged";break;case r.ZodIssueCode.not_multiple_of:v=`Number must be a multiple of ${a.multipleOf}`;break;case r.ZodIssueCode.not_finite:v="Number must be finite";break;default:v=p.defaultError,n.util.assertNever(a)}return{message:v}};t.default=o},75226:function(x,t,e){"use strict";var n=this&&this.__classPrivateFieldGet||function(qt,nt,Ft,Jt){if(Ft==="a"&&!Jt)throw new TypeError("Private accessor was defined without a getter");if(typeof nt=="function"?qt!==nt||!Jt:!nt.has(qt))throw new TypeError("Cannot read private member from an object whose class did not declare it");return Ft==="m"?Jt:Ft==="a"?Jt.call(qt):Jt?Jt.value:nt.get(qt)},r=this&&this.__classPrivateFieldSet||function(qt,nt,Ft,Jt,Dn){if(Jt==="m")throw new TypeError("Private method is not writable");if(Jt==="a"&&!Dn)throw new TypeError("Private accessor was defined without a setter");if(typeof nt=="function"?qt!==nt||!Dn:!nt.has(qt))throw new TypeError("Cannot write private member to an object whose class did not declare it");return Jt==="a"?Dn.call(qt,Ft):Dn?Dn.value=Ft:nt.set(qt,Ft),Ft},o,a;Object.defineProperty(t,"__esModule",{value:!0}),t.boolean=t.bigint=t.array=t.any=t.coerce=t.ZodFirstPartyTypeKind=t.late=t.ZodSchema=t.Schema=t.custom=t.ZodReadonly=t.ZodPipeline=t.ZodBranded=t.BRAND=t.ZodNaN=t.ZodCatch=t.ZodDefault=t.ZodNullable=t.ZodOptional=t.ZodTransformer=t.ZodEffects=t.ZodPromise=t.ZodNativeEnum=t.ZodEnum=t.ZodLiteral=t.ZodLazy=t.ZodFunction=t.ZodSet=t.ZodMap=t.ZodRecord=t.ZodTuple=t.ZodIntersection=t.ZodDiscriminatedUnion=t.ZodUnion=t.ZodObject=t.ZodArray=t.ZodVoid=t.ZodNever=t.ZodUnknown=t.ZodAny=t.ZodNull=t.ZodUndefined=t.ZodSymbol=t.ZodDate=t.ZodBoolean=t.ZodBigInt=t.ZodNumber=t.ZodString=t.datetimeRegex=t.ZodType=void 0,t.NEVER=t.void=t.unknown=t.union=t.undefined=t.tuple=t.transformer=t.symbol=t.string=t.strictObject=t.set=t.record=t.promise=t.preprocess=t.pipeline=t.ostring=t.optional=t.onumber=t.oboolean=t.object=t.number=t.nullable=t.null=t.never=t.nativeEnum=t.nan=t.map=t.literal=t.lazy=t.intersection=t.instanceof=t.function=t.enum=t.effect=t.discriminatedUnion=t.date=void 0;const p=e(30548),v=e(15759),m=e(66258),_=e(94705),s=e(97442);class g{constructor(nt,Ft,Jt,Dn){this._cachedPath=[],this.parent=nt,this.data=Ft,this._path=Jt,this._key=Dn}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}}const l=(qt,nt)=>{if((0,m.isValid)(nt))return{success:!0,data:nt.value};if(!qt.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const Ft=new s.ZodError(qt.common.issues);return this._error=Ft,this._error}}};function h(qt){if(!qt)return{};const{errorMap:nt,invalid_type_error:Ft,required_error:Jt,description:Dn}=qt;if(nt&&(Ft||Jt))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return nt?{errorMap:nt,description:Dn}:{errorMap:(Bi,Mi)=>{var Xi,vi;const{message:Qi}=qt;return Bi.code==="invalid_enum_value"?{message:Qi??Mi.defaultError}:typeof Mi.data>"u"?{message:(Xi=Qi??Jt)!==null&&Xi!==void 0?Xi:Mi.defaultError}:Bi.code!=="invalid_type"?{message:Mi.defaultError}:{message:(vi=Qi??Ft)!==null&&vi!==void 0?vi:Mi.defaultError}},description:Dn}}class u{get description(){return this._def.description}_getType(nt){return(0,_.getParsedType)(nt.data)}_getOrReturnCtx(nt,Ft){return Ft||{common:nt.parent.common,data:nt.data,parsedType:(0,_.getParsedType)(nt.data),schemaErrorMap:this._def.errorMap,path:nt.path,parent:nt.parent}}_processInputParams(nt){return{status:new m.ParseStatus,ctx:{common:nt.parent.common,data:nt.data,parsedType:(0,_.getParsedType)(nt.data),schemaErrorMap:this._def.errorMap,path:nt.path,parent:nt.parent}}}_parseSync(nt){const Ft=this._parse(nt);if((0,m.isAsync)(Ft))throw new Error("Synchronous parse encountered promise.");return Ft}_parseAsync(nt){const Ft=this._parse(nt);return Promise.resolve(Ft)}parse(nt,Ft){const Jt=this.safeParse(nt,Ft);if(Jt.success)return Jt.data;throw Jt.error}safeParse(nt,Ft){var Jt;const Dn={common:{issues:[],async:(Jt=Ft?.async)!==null&&Jt!==void 0?Jt:!1,contextualErrorMap:Ft?.errorMap},path:Ft?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:nt,parsedType:(0,_.getParsedType)(nt)},Fn=this._parseSync({data:nt,path:Dn.path,parent:Dn});return l(Dn,Fn)}"~validate"(nt){var Ft,Jt;const Dn={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:nt,parsedType:(0,_.getParsedType)(nt)};if(!this["~standard"].async)try{const Fn=this._parseSync({data:nt,path:[],parent:Dn});return(0,m.isValid)(Fn)?{value:Fn.value}:{issues:Dn.common.issues}}catch(Fn){!((Jt=(Ft=Fn?.message)===null||Ft===void 0?void 0:Ft.toLowerCase())===null||Jt===void 0)&&Jt.includes("encountered")&&(this["~standard"].async=!0),Dn.common={issues:[],async:!0}}return this._parseAsync({data:nt,path:[],parent:Dn}).then(Fn=>(0,m.isValid)(Fn)?{value:Fn.value}:{issues:Dn.common.issues})}async parseAsync(nt,Ft){const Jt=await this.safeParseAsync(nt,Ft);if(Jt.success)return Jt.data;throw Jt.error}async safeParseAsync(nt,Ft){const Jt={common:{issues:[],contextualErrorMap:Ft?.errorMap,async:!0},path:Ft?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:nt,parsedType:(0,_.getParsedType)(nt)},Dn=this._parse({data:nt,path:Jt.path,parent:Jt}),Fn=await((0,m.isAsync)(Dn)?Dn:Promise.resolve(Dn));return l(Jt,Fn)}refine(nt,Ft){const Jt=Dn=>typeof Ft=="string"||typeof Ft>"u"?{message:Ft}:typeof Ft=="function"?Ft(Dn):Ft;return this._refinement((Dn,Fn)=>{const Bi=nt(Dn),Mi=()=>Fn.addIssue({code:s.ZodIssueCode.custom,...Jt(Dn)});return typeof Promise<"u"&&Bi instanceof Promise?Bi.then(Xi=>Xi?!0:(Mi(),!1)):Bi?!0:(Mi(),!1)})}refinement(nt,Ft){return this._refinement((Jt,Dn)=>nt(Jt)?!0:(Dn.addIssue(typeof Ft=="function"?Ft(Jt,Dn):Ft),!1))}_refinement(nt){return new Ye({schema:this,typeName:At.ZodEffects,effect:{type:"refinement",refinement:nt}})}superRefine(nt){return this._refinement(nt)}constructor(nt){this.spa=this.safeParseAsync,this._def=nt,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:Ft=>this["~validate"](Ft)}}optional(){return Ke.create(this,this._def)}nullable(){return mt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ee.create(this)}promise(){return Ue.create(this,this._def)}or(nt){return fe.create([this,nt],this._def)}and(nt){return Pe.create(this,nt,this._def)}transform(nt){return new Ye({...h(this._def),schema:this,typeName:At.ZodEffects,effect:{type:"transform",transform:nt}})}default(nt){const Ft=typeof nt=="function"?nt:()=>nt;return new _t({...h(this._def),innerType:this,defaultValue:Ft,typeName:At.ZodDefault})}brand(){return new wt({typeName:At.ZodBranded,type:this,...h(this._def)})}catch(nt){const Ft=typeof nt=="function"?nt:()=>nt;return new Mt({...h(this._def),innerType:this,catchValue:Ft,typeName:At.ZodCatch})}describe(nt){const Ft=this.constructor;return new Ft({...this._def,description:nt})}pipe(nt){return st.create(this,nt)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}t.ZodType=u,t.Schema=u,t.ZodSchema=u;const d=/^c[^\s-]{8,}$/i,E=/^[0-9a-z]+$/,f=/^[0-9A-HJKMNP-TV-Z]{26}$/i,c=/^[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,y=/^[a-z0-9_-]{21}$/i,b=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,A=/^[-+]?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)?)??$/,S=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,D="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let I;const w=/^(?:(?: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])$/,T=/^(?:(?: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])$/,R=/^(([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]))$/,P=/^(([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])$/,O=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,M=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,k="((\\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])))",F=new RegExp(`^${k}$`);function L(qt){let nt="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return qt.precision?nt=`${nt}\\.\\d{${qt.precision}}`:qt.precision==null&&(nt=`${nt}(\\.\\d+)?`),nt}function B(qt){return new RegExp(`^${L(qt)}$`)}function U(qt){let nt=`${k}T${L(qt)}`;const Ft=[];return Ft.push(qt.local?"Z?":"Z"),qt.offset&&Ft.push("([+-]\\d{2}:?\\d{2})"),nt=`${nt}(${Ft.join("|")})`,new RegExp(`^${nt}$`)}t.datetimeRegex=U;function W(qt,nt){return!!((nt==="v4"||!nt)&&w.test(qt)||(nt==="v6"||!nt)&&R.test(qt))}function j(qt,nt){if(!b.test(qt))return!1;try{const[Ft]=qt.split("."),Jt=Ft.replace(/-/g,"+").replace(/_/g,"/").padEnd(Ft.length+(4-Ft.length%4)%4,"="),Dn=JSON.parse(atob(Jt));return!(typeof Dn!="object"||Dn===null||!Dn.typ||!Dn.alg||nt&&Dn.alg!==nt)}catch{return!1}}function Q(qt,nt){return!!((nt==="v4"||!nt)&&T.test(qt)||(nt==="v6"||!nt)&&P.test(qt))}class G extends u{_parse(nt){if(this._def.coerce&&(nt.data=String(nt.data)),this._getType(nt)!==_.ZodParsedType.string){const Fn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Fn,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.string,received:Fn.parsedType}),m.INVALID}const Jt=new m.ParseStatus;let Dn;for(const Fn of this._def.checks)if(Fn.kind==="min")nt.data.length<Fn.value&&(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.too_small,minimum:Fn.value,type:"string",inclusive:!0,exact:!1,message:Fn.message}),Jt.dirty());else if(Fn.kind==="max")nt.data.length>Fn.value&&(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.too_big,maximum:Fn.value,type:"string",inclusive:!0,exact:!1,message:Fn.message}),Jt.dirty());else if(Fn.kind==="length"){const Bi=nt.data.length>Fn.value,Mi=nt.data.length<Fn.value;(Bi||Mi)&&(Dn=this._getOrReturnCtx(nt,Dn),Bi?(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.too_big,maximum:Fn.value,type:"string",inclusive:!0,exact:!0,message:Fn.message}):Mi&&(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.too_small,minimum:Fn.value,type:"string",inclusive:!0,exact:!0,message:Fn.message}),Jt.dirty())}else if(Fn.kind==="email")S.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"email",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="emoji")I||(I=new RegExp(D,"u")),I.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"emoji",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="uuid")c.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"uuid",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="nanoid")y.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"nanoid",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="cuid")d.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"cuid",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="cuid2")E.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"cuid2",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="ulid")f.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"ulid",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="url")try{new URL(nt.data)}catch{Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"url",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()}else Fn.kind==="regex"?(Fn.regex.lastIndex=0,Fn.regex.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"regex",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty())):Fn.kind==="trim"?nt.data=nt.data.trim():Fn.kind==="includes"?nt.data.includes(Fn.value,Fn.position)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.invalid_string,validation:{includes:Fn.value,position:Fn.position},message:Fn.message}),Jt.dirty()):Fn.kind==="toLowerCase"?nt.data=nt.data.toLowerCase():Fn.kind==="toUpperCase"?nt.data=nt.data.toUpperCase():Fn.kind==="startsWith"?nt.data.startsWith(Fn.value)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.invalid_string,validation:{startsWith:Fn.value},message:Fn.message}),Jt.dirty()):Fn.kind==="endsWith"?nt.data.endsWith(Fn.value)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.invalid_string,validation:{endsWith:Fn.value},message:Fn.message}),Jt.dirty()):Fn.kind==="datetime"?U(Fn).test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.invalid_string,validation:"datetime",message:Fn.message}),Jt.dirty()):Fn.kind==="date"?F.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.invalid_string,validation:"date",message:Fn.message}),Jt.dirty()):Fn.kind==="time"?B(Fn).test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.invalid_string,validation:"time",message:Fn.message}),Jt.dirty()):Fn.kind==="duration"?A.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"duration",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()):Fn.kind==="ip"?W(nt.data,Fn.version)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"ip",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()):Fn.kind==="jwt"?j(nt.data,Fn.alg)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"jwt",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()):Fn.kind==="cidr"?Q(nt.data,Fn.version)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"cidr",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()):Fn.kind==="base64"?O.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"base64",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()):Fn.kind==="base64url"?M.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"base64url",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()):_.util.assertNever(Fn);return{status:Jt.value,value:nt.data}}_regex(nt,Ft,Jt){return this.refinement(Dn=>nt.test(Dn),{validation:Ft,code:s.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(Jt)})}_addCheck(nt){return new G({...this._def,checks:[...this._def.checks,nt]})}email(nt){return this._addCheck({kind:"email",...v.errorUtil.errToObj(nt)})}url(nt){return this._addCheck({kind:"url",...v.errorUtil.errToObj(nt)})}emoji(nt){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(nt)})}uuid(nt){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(nt)})}nanoid(nt){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(nt)})}cuid(nt){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(nt)})}cuid2(nt){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(nt)})}ulid(nt){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(nt)})}base64(nt){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(nt)})}base64url(nt){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(nt)})}jwt(nt){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(nt)})}ip(nt){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(nt)})}cidr(nt){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(nt)})}datetime(nt){var Ft,Jt;return typeof nt=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:nt}):this._addCheck({kind:"datetime",precision:typeof nt?.precision>"u"?null:nt?.precision,offset:(Ft=nt?.offset)!==null&&Ft!==void 0?Ft:!1,local:(Jt=nt?.local)!==null&&Jt!==void 0?Jt:!1,...v.errorUtil.errToObj(nt?.message)})}date(nt){return this._addCheck({kind:"date",message:nt})}time(nt){return typeof nt=="string"?this._addCheck({kind:"time",precision:null,message:nt}):this._addCheck({kind:"time",precision:typeof nt?.precision>"u"?null:nt?.precision,...v.errorUtil.errToObj(nt?.message)})}duration(nt){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(nt)})}regex(nt,Ft){return this._addCheck({kind:"regex",regex:nt,...v.errorUtil.errToObj(Ft)})}includes(nt,Ft){return this._addCheck({kind:"includes",value:nt,position:Ft?.position,...v.errorUtil.errToObj(Ft?.message)})}startsWith(nt,Ft){return this._addCheck({kind:"startsWith",value:nt,...v.errorUtil.errToObj(Ft)})}endsWith(nt,Ft){return this._addCheck({kind:"endsWith",value:nt,...v.errorUtil.errToObj(Ft)})}min(nt,Ft){return this._addCheck({kind:"min",value:nt,...v.errorUtil.errToObj(Ft)})}max(nt,Ft){return this._addCheck({kind:"max",value:nt,...v.errorUtil.errToObj(Ft)})}length(nt,Ft){return this._addCheck({kind:"length",value:nt,...v.errorUtil.errToObj(Ft)})}nonempty(nt){return this.min(1,v.errorUtil.errToObj(nt))}trim(){return new G({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new G({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new G({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(nt=>nt.kind==="datetime")}get isDate(){return!!this._def.checks.find(nt=>nt.kind==="date")}get isTime(){return!!this._def.checks.find(nt=>nt.kind==="time")}get isDuration(){return!!this._def.checks.find(nt=>nt.kind==="duration")}get isEmail(){return!!this._def.checks.find(nt=>nt.kind==="email")}get isURL(){return!!this._def.checks.find(nt=>nt.kind==="url")}get isEmoji(){return!!this._def.checks.find(nt=>nt.kind==="emoji")}get isUUID(){return!!this._def.checks.find(nt=>nt.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(nt=>nt.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(nt=>nt.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(nt=>nt.kind==="cuid2")}get isULID(){return!!this._def.checks.find(nt=>nt.kind==="ulid")}get isIP(){return!!this._def.checks.find(nt=>nt.kind==="ip")}get isCIDR(){return!!this._def.checks.find(nt=>nt.kind==="cidr")}get isBase64(){return!!this._def.checks.find(nt=>nt.kind==="base64")}get isBase64url(){return!!this._def.checks.find(nt=>nt.kind==="base64url")}get minLength(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="min"&&(nt===null||Ft.value>nt)&&(nt=Ft.value);return nt}get maxLength(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="max"&&(nt===null||Ft.value<nt)&&(nt=Ft.value);return nt}}t.ZodString=G,G.create=qt=>{var nt;return new G({checks:[],typeName:At.ZodString,coerce:(nt=qt?.coerce)!==null&&nt!==void 0?nt:!1,...h(qt)})};function Z(qt,nt){const Ft=(qt.toString().split(".")[1]||"").length,Jt=(nt.toString().split(".")[1]||"").length,Dn=Ft>Jt?Ft:Jt,Fn=parseInt(qt.toFixed(Dn).replace(".","")),Bi=parseInt(nt.toFixed(Dn).replace(".",""));return Fn%Bi/Math.pow(10,Dn)}class $ extends u{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(nt){if(this._def.coerce&&(nt.data=Number(nt.data)),this._getType(nt)!==_.ZodParsedType.number){const Fn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Fn,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.number,received:Fn.parsedType}),m.INVALID}let Jt;const Dn=new m.ParseStatus;for(const Fn of this._def.checks)Fn.kind==="int"?_.util.isInteger(nt.data)||(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:Fn.message}),Dn.dirty()):Fn.kind==="min"?(Fn.inclusive?nt.data<Fn.value:nt.data<=Fn.value)&&(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_small,minimum:Fn.value,type:"number",inclusive:Fn.inclusive,exact:!1,message:Fn.message}),Dn.dirty()):Fn.kind==="max"?(Fn.inclusive?nt.data>Fn.value:nt.data>=Fn.value)&&(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_big,maximum:Fn.value,type:"number",inclusive:Fn.inclusive,exact:!1,message:Fn.message}),Dn.dirty()):Fn.kind==="multipleOf"?Z(nt.data,Fn.value)!==0&&(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.not_multiple_of,multipleOf:Fn.value,message:Fn.message}),Dn.dirty()):Fn.kind==="finite"?Number.isFinite(nt.data)||(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.not_finite,message:Fn.message}),Dn.dirty()):_.util.assertNever(Fn);return{status:Dn.value,value:nt.data}}gte(nt,Ft){return this.setLimit("min",nt,!0,v.errorUtil.toString(Ft))}gt(nt,Ft){return this.setLimit("min",nt,!1,v.errorUtil.toString(Ft))}lte(nt,Ft){return this.setLimit("max",nt,!0,v.errorUtil.toString(Ft))}lt(nt,Ft){return this.setLimit("max",nt,!1,v.errorUtil.toString(Ft))}setLimit(nt,Ft,Jt,Dn){return new $({...this._def,checks:[...this._def.checks,{kind:nt,value:Ft,inclusive:Jt,message:v.errorUtil.toString(Dn)}]})}_addCheck(nt){return new $({...this._def,checks:[...this._def.checks,nt]})}int(nt){return this._addCheck({kind:"int",message:v.errorUtil.toString(nt)})}positive(nt){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(nt)})}negative(nt){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(nt)})}nonpositive(nt){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(nt)})}nonnegative(nt){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(nt)})}multipleOf(nt,Ft){return this._addCheck({kind:"multipleOf",value:nt,message:v.errorUtil.toString(Ft)})}finite(nt){return this._addCheck({kind:"finite",message:v.errorUtil.toString(nt)})}safe(nt){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(nt)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.toString(nt)})}get minValue(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="min"&&(nt===null||Ft.value>nt)&&(nt=Ft.value);return nt}get maxValue(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="max"&&(nt===null||Ft.value<nt)&&(nt=Ft.value);return nt}get isInt(){return!!this._def.checks.find(nt=>nt.kind==="int"||nt.kind==="multipleOf"&&_.util.isInteger(nt.value))}get isFinite(){let nt=null,Ft=null;for(const Jt of this._def.checks){if(Jt.kind==="finite"||Jt.kind==="int"||Jt.kind==="multipleOf")return!0;Jt.kind==="min"?(Ft===null||Jt.value>Ft)&&(Ft=Jt.value):Jt.kind==="max"&&(nt===null||Jt.value<nt)&&(nt=Jt.value)}return Number.isFinite(Ft)&&Number.isFinite(nt)}}t.ZodNumber=$,$.create=qt=>new $({checks:[],typeName:At.ZodNumber,coerce:qt?.coerce||!1,...h(qt)});class V extends u{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(nt){if(this._def.coerce)try{nt.data=BigInt(nt.data)}catch{return this._getInvalidInput(nt)}if(this._getType(nt)!==_.ZodParsedType.bigint)return this._getInvalidInput(nt);let Jt;const Dn=new m.ParseStatus;for(const Fn of this._def.checks)Fn.kind==="min"?(Fn.inclusive?nt.data<Fn.value:nt.data<=Fn.value)&&(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_small,type:"bigint",minimum:Fn.value,inclusive:Fn.inclusive,message:Fn.message}),Dn.dirty()):Fn.kind==="max"?(Fn.inclusive?nt.data>Fn.value:nt.data>=Fn.value)&&(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_big,type:"bigint",maximum:Fn.value,inclusive:Fn.inclusive,message:Fn.message}),Dn.dirty()):Fn.kind==="multipleOf"?nt.data%Fn.value!==BigInt(0)&&(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.not_multiple_of,multipleOf:Fn.value,message:Fn.message}),Dn.dirty()):_.util.assertNever(Fn);return{status:Dn.value,value:nt.data}}_getInvalidInput(nt){const Ft=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.bigint,received:Ft.parsedType}),m.INVALID}gte(nt,Ft){return this.setLimit("min",nt,!0,v.errorUtil.toString(Ft))}gt(nt,Ft){return this.setLimit("min",nt,!1,v.errorUtil.toString(Ft))}lte(nt,Ft){return this.setLimit("max",nt,!0,v.errorUtil.toString(Ft))}lt(nt,Ft){return this.setLimit("max",nt,!1,v.errorUtil.toString(Ft))}setLimit(nt,Ft,Jt,Dn){return new V({...this._def,checks:[...this._def.checks,{kind:nt,value:Ft,inclusive:Jt,message:v.errorUtil.toString(Dn)}]})}_addCheck(nt){return new V({...this._def,checks:[...this._def.checks,nt]})}positive(nt){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(nt)})}negative(nt){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(nt)})}nonpositive(nt){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(nt)})}nonnegative(nt){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(nt)})}multipleOf(nt,Ft){return this._addCheck({kind:"multipleOf",value:nt,message:v.errorUtil.toString(Ft)})}get minValue(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="min"&&(nt===null||Ft.value>nt)&&(nt=Ft.value);return nt}get maxValue(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="max"&&(nt===null||Ft.value<nt)&&(nt=Ft.value);return nt}}t.ZodBigInt=V,V.create=qt=>{var nt;return new V({checks:[],typeName:At.ZodBigInt,coerce:(nt=qt?.coerce)!==null&&nt!==void 0?nt:!1,...h(qt)})};class H extends u{_parse(nt){if(this._def.coerce&&(nt.data=!!nt.data),this._getType(nt)!==_.ZodParsedType.boolean){const Jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.boolean,received:Jt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodBoolean=H,H.create=qt=>new H({typeName:At.ZodBoolean,coerce:qt?.coerce||!1,...h(qt)});class K extends u{_parse(nt){if(this._def.coerce&&(nt.data=new Date(nt.data)),this._getType(nt)!==_.ZodParsedType.date){const Fn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Fn,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.date,received:Fn.parsedType}),m.INVALID}if(isNaN(nt.data.getTime())){const Fn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Fn,{code:s.ZodIssueCode.invalid_date}),m.INVALID}const Jt=new m.ParseStatus;let Dn;for(const Fn of this._def.checks)Fn.kind==="min"?nt.data.getTime()<Fn.value&&(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.too_small,message:Fn.message,inclusive:!0,exact:!1,minimum:Fn.value,type:"date"}),Jt.dirty()):Fn.kind==="max"?nt.data.getTime()>Fn.value&&(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.too_big,message:Fn.message,inclusive:!0,exact:!1,maximum:Fn.value,type:"date"}),Jt.dirty()):_.util.assertNever(Fn);return{status:Jt.value,value:new Date(nt.data.getTime())}}_addCheck(nt){return new K({...this._def,checks:[...this._def.checks,nt]})}min(nt,Ft){return this._addCheck({kind:"min",value:nt.getTime(),message:v.errorUtil.toString(Ft)})}max(nt,Ft){return this._addCheck({kind:"max",value:nt.getTime(),message:v.errorUtil.toString(Ft)})}get minDate(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="min"&&(nt===null||Ft.value>nt)&&(nt=Ft.value);return nt!=null?new Date(nt):null}get maxDate(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="max"&&(nt===null||Ft.value<nt)&&(nt=Ft.value);return nt!=null?new Date(nt):null}}t.ZodDate=K,K.create=qt=>new K({checks:[],coerce:qt?.coerce||!1,typeName:At.ZodDate,...h(qt)});class Y extends u{_parse(nt){if(this._getType(nt)!==_.ZodParsedType.symbol){const Jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.symbol,received:Jt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodSymbol=Y,Y.create=qt=>new Y({typeName:At.ZodSymbol,...h(qt)});class X extends u{_parse(nt){if(this._getType(nt)!==_.ZodParsedType.undefined){const Jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.undefined,received:Jt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodUndefined=X,X.create=qt=>new X({typeName:At.ZodUndefined,...h(qt)});class oe extends u{_parse(nt){if(this._getType(nt)!==_.ZodParsedType.null){const Jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.null,received:Jt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodNull=oe,oe.create=qt=>new oe({typeName:At.ZodNull,...h(qt)});class ie extends u{constructor(){super(...arguments),this._any=!0}_parse(nt){return(0,m.OK)(nt.data)}}t.ZodAny=ie,ie.create=qt=>new ie({typeName:At.ZodAny,...h(qt)});class he extends u{constructor(){super(...arguments),this._unknown=!0}_parse(nt){return(0,m.OK)(nt.data)}}t.ZodUnknown=he,he.create=qt=>new he({typeName:At.ZodUnknown,...h(qt)});class me extends u{_parse(nt){const Ft=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.never,received:Ft.parsedType}),m.INVALID}}t.ZodNever=me,me.create=qt=>new me({typeName:At.ZodNever,...h(qt)});class q extends u{_parse(nt){if(this._getType(nt)!==_.ZodParsedType.undefined){const Jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.void,received:Jt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodVoid=q,q.create=qt=>new q({typeName:At.ZodVoid,...h(qt)});class Ee extends u{_parse(nt){const{ctx:Ft,status:Jt}=this._processInputParams(nt),Dn=this._def;if(Ft.parsedType!==_.ZodParsedType.array)return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.array,received:Ft.parsedType}),m.INVALID;if(Dn.exactLength!==null){const Bi=Ft.data.length>Dn.exactLength.value,Mi=Ft.data.length<Dn.exactLength.value;(Bi||Mi)&&((0,m.addIssueToContext)(Ft,{code:Bi?s.ZodIssueCode.too_big:s.ZodIssueCode.too_small,minimum:Mi?Dn.exactLength.value:void 0,maximum:Bi?Dn.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:Dn.exactLength.message}),Jt.dirty())}if(Dn.minLength!==null&&Ft.data.length<Dn.minLength.value&&((0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.too_small,minimum:Dn.minLength.value,type:"array",inclusive:!0,exact:!1,message:Dn.minLength.message}),Jt.dirty()),Dn.maxLength!==null&&Ft.data.length>Dn.maxLength.value&&((0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.too_big,maximum:Dn.maxLength.value,type:"array",inclusive:!0,exact:!1,message:Dn.maxLength.message}),Jt.dirty()),Ft.common.async)return Promise.all([...Ft.data].map((Bi,Mi)=>Dn.type._parseAsync(new g(Ft,Bi,Ft.path,Mi)))).then(Bi=>m.ParseStatus.mergeArray(Jt,Bi));const Fn=[...Ft.data].map((Bi,Mi)=>Dn.type._parseSync(new g(Ft,Bi,Ft.path,Mi)));return m.ParseStatus.mergeArray(Jt,Fn)}get element(){return this._def.type}min(nt,Ft){return new Ee({...this._def,minLength:{value:nt,message:v.errorUtil.toString(Ft)}})}max(nt,Ft){return new Ee({...this._def,maxLength:{value:nt,message:v.errorUtil.toString(Ft)}})}length(nt,Ft){return new Ee({...this._def,exactLength:{value:nt,message:v.errorUtil.toString(Ft)}})}nonempty(nt){return this.min(1,nt)}}t.ZodArray=Ee,Ee.create=(qt,nt)=>new Ee({type:qt,minLength:null,maxLength:null,exactLength:null,typeName:At.ZodArray,...h(nt)});function ue(qt){if(qt instanceof te){const nt={};for(const Ft in qt.shape){const Jt=qt.shape[Ft];nt[Ft]=Ke.create(ue(Jt))}return new te({...qt._def,shape:()=>nt})}else return qt instanceof Ee?new Ee({...qt._def,type:ue(qt.element)}):qt instanceof Ke?Ke.create(ue(qt.unwrap())):qt instanceof mt?mt.create(ue(qt.unwrap())):qt instanceof we?we.create(qt.items.map(nt=>ue(nt))):qt}class te extends u{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const nt=this._def.shape(),Ft=_.util.objectKeys(nt);return this._cached={shape:nt,keys:Ft}}_parse(nt){if(this._getType(nt)!==_.ZodParsedType.object){const vi=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(vi,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:vi.parsedType}),m.INVALID}const{status:Jt,ctx:Dn}=this._processInputParams(nt),{shape:Fn,keys:Bi}=this._getCached(),Mi=[];if(!(this._def.catchall instanceof me&&this._def.unknownKeys==="strip"))for(const vi in Dn.data)Bi.includes(vi)||Mi.push(vi);const Xi=[];for(const vi of Bi){const Qi=Fn[vi],qi=Dn.data[vi];Xi.push({key:{status:"valid",value:vi},value:Qi._parse(new g(Dn,qi,Dn.path,vi)),alwaysSet:vi in Dn.data})}if(this._def.catchall instanceof me){const vi=this._def.unknownKeys;if(vi==="passthrough")for(const Qi of Mi)Xi.push({key:{status:"valid",value:Qi},value:{status:"valid",value:Dn.data[Qi]}});else if(vi==="strict")Mi.length>0&&((0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.unrecognized_keys,keys:Mi}),Jt.dirty());else if(vi!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const vi=this._def.catchall;for(const Qi of Mi){const qi=Dn.data[Qi];Xi.push({key:{status:"valid",value:Qi},value:vi._parse(new g(Dn,qi,Dn.path,Qi)),alwaysSet:Qi in Dn.data})}}return Dn.common.async?Promise.resolve().then(async()=>{const vi=[];for(const Qi of Xi){const qi=await Qi.key,lo=await Qi.value;vi.push({key:qi,value:lo,alwaysSet:Qi.alwaysSet})}return vi}).then(vi=>m.ParseStatus.mergeObjectSync(Jt,vi)):m.ParseStatus.mergeObjectSync(Jt,Xi)}get shape(){return this._def.shape()}strict(nt){return v.errorUtil.errToObj,new te({...this._def,unknownKeys:"strict",...nt!==void 0?{errorMap:(Ft,Jt)=>{var Dn,Fn,Bi,Mi;const Xi=(Bi=(Fn=(Dn=this._def).errorMap)===null||Fn===void 0?void 0:Fn.call(Dn,Ft,Jt).message)!==null&&Bi!==void 0?Bi:Jt.defaultError;return Ft.code==="unrecognized_keys"?{message:(Mi=v.errorUtil.errToObj(nt).message)!==null&&Mi!==void 0?Mi:Xi}:{message:Xi}}}:{}})}strip(){return new te({...this._def,unknownKeys:"strip"})}passthrough(){return new te({...this._def,unknownKeys:"passthrough"})}extend(nt){return new te({...this._def,shape:()=>({...this._def.shape(),...nt})})}merge(nt){return new te({unknownKeys:nt._def.unknownKeys,catchall:nt._def.catchall,shape:()=>({...this._def.shape(),...nt._def.shape()}),typeName:At.ZodObject})}setKey(nt,Ft){return this.augment({[nt]:Ft})}catchall(nt){return new te({...this._def,catchall:nt})}pick(nt){const Ft={};return _.util.objectKeys(nt).forEach(Jt=>{nt[Jt]&&this.shape[Jt]&&(Ft[Jt]=this.shape[Jt])}),new te({...this._def,shape:()=>Ft})}omit(nt){const Ft={};return _.util.objectKeys(this.shape).forEach(Jt=>{nt[Jt]||(Ft[Jt]=this.shape[Jt])}),new te({...this._def,shape:()=>Ft})}deepPartial(){return ue(this)}partial(nt){const Ft={};return _.util.objectKeys(this.shape).forEach(Jt=>{const Dn=this.shape[Jt];nt&&!nt[Jt]?Ft[Jt]=Dn:Ft[Jt]=Dn.optional()}),new te({...this._def,shape:()=>Ft})}required(nt){const Ft={};return _.util.objectKeys(this.shape).forEach(Jt=>{if(nt&&!nt[Jt])Ft[Jt]=this.shape[Jt];else{let Fn=this.shape[Jt];for(;Fn instanceof Ke;)Fn=Fn._def.innerType;Ft[Jt]=Fn}}),new te({...this._def,shape:()=>Ft})}keyof(){return ge(_.util.objectKeys(this.shape))}}t.ZodObject=te,te.create=(qt,nt)=>new te({shape:()=>qt,unknownKeys:"strip",catchall:me.create(),typeName:At.ZodObject,...h(nt)}),te.strictCreate=(qt,nt)=>new te({shape:()=>qt,unknownKeys:"strict",catchall:me.create(),typeName:At.ZodObject,...h(nt)}),te.lazycreate=(qt,nt)=>new te({shape:qt,unknownKeys:"strip",catchall:me.create(),typeName:At.ZodObject,...h(nt)});class fe extends u{_parse(nt){const{ctx:Ft}=this._processInputParams(nt),Jt=this._def.options;function Dn(Fn){for(const Mi of Fn)if(Mi.result.status==="valid")return Mi.result;for(const Mi of Fn)if(Mi.result.status==="dirty")return Ft.common.issues.push(...Mi.ctx.common.issues),Mi.result;const Bi=Fn.map(Mi=>new s.ZodError(Mi.ctx.common.issues));return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_union,unionErrors:Bi}),m.INVALID}if(Ft.common.async)return Promise.all(Jt.map(async Fn=>{const Bi={...Ft,common:{...Ft.common,issues:[]},parent:null};return{result:await Fn._parseAsync({data:Ft.data,path:Ft.path,parent:Bi}),ctx:Bi}})).then(Dn);{let Fn;const Bi=[];for(const Xi of Jt){const vi={...Ft,common:{...Ft.common,issues:[]},parent:null},Qi=Xi._parseSync({data:Ft.data,path:Ft.path,parent:vi});if(Qi.status==="valid")return Qi;Qi.status==="dirty"&&!Fn&&(Fn={result:Qi,ctx:vi}),vi.common.issues.length&&Bi.push(vi.common.issues)}if(Fn)return Ft.common.issues.push(...Fn.ctx.common.issues),Fn.result;const Mi=Bi.map(Xi=>new s.ZodError(Xi));return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_union,unionErrors:Mi}),m.INVALID}}get options(){return this._def.options}}t.ZodUnion=fe,fe.create=(qt,nt)=>new fe({options:qt,typeName:At.ZodUnion,...h(nt)});const Ie=qt=>qt instanceof pe?Ie(qt.schema):qt instanceof Ye?Ie(qt.innerType()):qt instanceof re?[qt.value]:qt instanceof De?qt.options:qt instanceof Ae?_.util.objectValues(qt.enum):qt instanceof _t?Ie(qt._def.innerType):qt instanceof X?[void 0]:qt instanceof oe?[null]:qt instanceof Ke?[void 0,...Ie(qt.unwrap())]:qt instanceof mt?[null,...Ie(qt.unwrap())]:qt instanceof wt||qt instanceof rt?Ie(qt.unwrap()):qt instanceof Mt?Ie(qt._def.innerType):[];class Me extends u{_parse(nt){const{ctx:Ft}=this._processInputParams(nt);if(Ft.parsedType!==_.ZodParsedType.object)return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:Ft.parsedType}),m.INVALID;const Jt=this.discriminator,Dn=Ft.data[Jt],Fn=this.optionsMap.get(Dn);return Fn?Ft.common.async?Fn._parseAsync({data:Ft.data,path:Ft.path,parent:Ft}):Fn._parseSync({data:Ft.data,path:Ft.path,parent:Ft}):((0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Jt]}),m.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(nt,Ft,Jt){const Dn=new Map;for(const Fn of Ft){const Bi=Ie(Fn.shape[nt]);if(!Bi.length)throw new Error(`A discriminator value for key \`${nt}\` could not be extracted from all schema options`);for(const Mi of Bi){if(Dn.has(Mi))throw new Error(`Discriminator property ${String(nt)} has duplicate value ${String(Mi)}`);Dn.set(Mi,Fn)}}return new Me({typeName:At.ZodDiscriminatedUnion,discriminator:nt,options:Ft,optionsMap:Dn,...h(Jt)})}}t.ZodDiscriminatedUnion=Me;function Be(qt,nt){const Ft=(0,_.getParsedType)(qt),Jt=(0,_.getParsedType)(nt);if(qt===nt)return{valid:!0,data:qt};if(Ft===_.ZodParsedType.object&&Jt===_.ZodParsedType.object){const Dn=_.util.objectKeys(nt),Fn=_.util.objectKeys(qt).filter(Mi=>Dn.indexOf(Mi)!==-1),Bi={...qt,...nt};for(const Mi of Fn){const Xi=Be(qt[Mi],nt[Mi]);if(!Xi.valid)return{valid:!1};Bi[Mi]=Xi.data}return{valid:!0,data:Bi}}else if(Ft===_.ZodParsedType.array&&Jt===_.ZodParsedType.array){if(qt.length!==nt.length)return{valid:!1};const Dn=[];for(let Fn=0;Fn<qt.length;Fn++){const Bi=qt[Fn],Mi=nt[Fn],Xi=Be(Bi,Mi);if(!Xi.valid)return{valid:!1};Dn.push(Xi.data)}return{valid:!0,data:Dn}}else return Ft===_.ZodParsedType.date&&Jt===_.ZodParsedType.date&&+qt==+nt?{valid:!0,data:qt}:{valid:!1}}class Pe extends u{_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt),Dn=(Fn,Bi)=>{if((0,m.isAborted)(Fn)||(0,m.isAborted)(Bi))return m.INVALID;const Mi=Be(Fn.value,Bi.value);return Mi.valid?(((0,m.isDirty)(Fn)||(0,m.isDirty)(Bi))&&Ft.dirty(),{status:Ft.value,value:Mi.data}):((0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_intersection_types}),m.INVALID)};return Jt.common.async?Promise.all([this._def.left._parseAsync({data:Jt.data,path:Jt.path,parent:Jt}),this._def.right._parseAsync({data:Jt.data,path:Jt.path,parent:Jt})]).then(([Fn,Bi])=>Dn(Fn,Bi)):Dn(this._def.left._parseSync({data:Jt.data,path:Jt.path,parent:Jt}),this._def.right._parseSync({data:Jt.data,path:Jt.path,parent:Jt}))}}t.ZodIntersection=Pe,Pe.create=(qt,nt,Ft)=>new Pe({left:qt,right:nt,typeName:At.ZodIntersection,...h(Ft)});class we extends u{_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt);if(Jt.parsedType!==_.ZodParsedType.array)return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.array,received:Jt.parsedType}),m.INVALID;if(Jt.data.length<this._def.items.length)return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m.INVALID;!this._def.rest&&Jt.data.length>this._def.items.length&&((0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ft.dirty());const Fn=[...Jt.data].map((Bi,Mi)=>{const Xi=this._def.items[Mi]||this._def.rest;return Xi?Xi._parse(new g(Jt,Bi,Jt.path,Mi)):null}).filter(Bi=>!!Bi);return Jt.common.async?Promise.all(Fn).then(Bi=>m.ParseStatus.mergeArray(Ft,Bi)):m.ParseStatus.mergeArray(Ft,Fn)}get items(){return this._def.items}rest(nt){return new we({...this._def,rest:nt})}}t.ZodTuple=we,we.create=(qt,nt)=>{if(!Array.isArray(qt))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new we({items:qt,typeName:At.ZodTuple,rest:null,...h(nt)})};class _e extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt);if(Jt.parsedType!==_.ZodParsedType.object)return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:Jt.parsedType}),m.INVALID;const Dn=[],Fn=this._def.keyType,Bi=this._def.valueType;for(const Mi in Jt.data)Dn.push({key:Fn._parse(new g(Jt,Mi,Jt.path,Mi)),value:Bi._parse(new g(Jt,Jt.data[Mi],Jt.path,Mi)),alwaysSet:Mi in Jt.data});return Jt.common.async?m.ParseStatus.mergeObjectAsync(Ft,Dn):m.ParseStatus.mergeObjectSync(Ft,Dn)}get element(){return this._def.valueType}static create(nt,Ft,Jt){return Ft instanceof u?new _e({keyType:nt,valueType:Ft,typeName:At.ZodRecord,...h(Jt)}):new _e({keyType:G.create(),valueType:nt,typeName:At.ZodRecord,...h(Ft)})}}t.ZodRecord=_e;class Ne extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt);if(Jt.parsedType!==_.ZodParsedType.map)return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.map,received:Jt.parsedType}),m.INVALID;const Dn=this._def.keyType,Fn=this._def.valueType,Bi=[...Jt.data.entries()].map(([Mi,Xi],vi)=>({key:Dn._parse(new g(Jt,Mi,Jt.path,[vi,"key"])),value:Fn._parse(new g(Jt,Xi,Jt.path,[vi,"value"]))}));if(Jt.common.async){const Mi=new Map;return Promise.resolve().then(async()=>{for(const Xi of Bi){const vi=await Xi.key,Qi=await Xi.value;if(vi.status==="aborted"||Qi.status==="aborted")return m.INVALID;(vi.status==="dirty"||Qi.status==="dirty")&&Ft.dirty(),Mi.set(vi.value,Qi.value)}return{status:Ft.value,value:Mi}})}else{const Mi=new Map;for(const Xi of Bi){const vi=Xi.key,Qi=Xi.value;if(vi.status==="aborted"||Qi.status==="aborted")return m.INVALID;(vi.status==="dirty"||Qi.status==="dirty")&&Ft.dirty(),Mi.set(vi.value,Qi.value)}return{status:Ft.value,value:Mi}}}}t.ZodMap=Ne,Ne.create=(qt,nt,Ft)=>new Ne({valueType:nt,keyType:qt,typeName:At.ZodMap,...h(Ft)});class Te extends u{_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt);if(Jt.parsedType!==_.ZodParsedType.set)return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.set,received:Jt.parsedType}),m.INVALID;const Dn=this._def;Dn.minSize!==null&&Jt.data.size<Dn.minSize.value&&((0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_small,minimum:Dn.minSize.value,type:"set",inclusive:!0,exact:!1,message:Dn.minSize.message}),Ft.dirty()),Dn.maxSize!==null&&Jt.data.size>Dn.maxSize.value&&((0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_big,maximum:Dn.maxSize.value,type:"set",inclusive:!0,exact:!1,message:Dn.maxSize.message}),Ft.dirty());const Fn=this._def.valueType;function Bi(Xi){const vi=new Set;for(const Qi of Xi){if(Qi.status==="aborted")return m.INVALID;Qi.status==="dirty"&&Ft.dirty(),vi.add(Qi.value)}return{status:Ft.value,value:vi}}const Mi=[...Jt.data.values()].map((Xi,vi)=>Fn._parse(new g(Jt,Xi,Jt.path,vi)));return Jt.common.async?Promise.all(Mi).then(Xi=>Bi(Xi)):Bi(Mi)}min(nt,Ft){return new Te({...this._def,minSize:{value:nt,message:v.errorUtil.toString(Ft)}})}max(nt,Ft){return new Te({...this._def,maxSize:{value:nt,message:v.errorUtil.toString(Ft)}})}size(nt,Ft){return this.min(nt,Ft).max(nt,Ft)}nonempty(nt){return this.min(1,nt)}}t.ZodSet=Te,Te.create=(qt,nt)=>new Te({valueType:qt,minSize:null,maxSize:null,typeName:At.ZodSet,...h(nt)});class We extends u{constructor(){super(...arguments),this.validate=this.implement}_parse(nt){const{ctx:Ft}=this._processInputParams(nt);if(Ft.parsedType!==_.ZodParsedType.function)return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.function,received:Ft.parsedType}),m.INVALID;function Jt(Mi,Xi){return(0,m.makeIssue)({data:Mi,path:Ft.path,errorMaps:[Ft.common.contextualErrorMap,Ft.schemaErrorMap,(0,p.getErrorMap)(),p.defaultErrorMap].filter(vi=>!!vi),issueData:{code:s.ZodIssueCode.invalid_arguments,argumentsError:Xi}})}function Dn(Mi,Xi){return(0,m.makeIssue)({data:Mi,path:Ft.path,errorMaps:[Ft.common.contextualErrorMap,Ft.schemaErrorMap,(0,p.getErrorMap)(),p.defaultErrorMap].filter(vi=>!!vi),issueData:{code:s.ZodIssueCode.invalid_return_type,returnTypeError:Xi}})}const Fn={errorMap:Ft.common.contextualErrorMap},Bi=Ft.data;if(this._def.returns instanceof Ue){const Mi=this;return(0,m.OK)(async function(...Xi){const vi=new s.ZodError([]),Qi=await Mi._def.args.parseAsync(Xi,Fn).catch(yo=>{throw vi.addIssue(Jt(Xi,yo)),vi}),qi=await Reflect.apply(Bi,this,Qi);return await Mi._def.returns._def.type.parseAsync(qi,Fn).catch(yo=>{throw vi.addIssue(Dn(qi,yo)),vi})})}else{const Mi=this;return(0,m.OK)(function(...Xi){const vi=Mi._def.args.safeParse(Xi,Fn);if(!vi.success)throw new s.ZodError([Jt(Xi,vi.error)]);const Qi=Reflect.apply(Bi,this,vi.data),qi=Mi._def.returns.safeParse(Qi,Fn);if(!qi.success)throw new s.ZodError([Dn(Qi,qi.error)]);return qi.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...nt){return new We({...this._def,args:we.create(nt).rest(he.create())})}returns(nt){return new We({...this._def,returns:nt})}implement(nt){return this.parse(nt)}strictImplement(nt){return this.parse(nt)}static create(nt,Ft,Jt){return new We({args:nt||we.create([]).rest(he.create()),returns:Ft||he.create(),typeName:At.ZodFunction,...h(Jt)})}}t.ZodFunction=We;class pe extends u{get schema(){return this._def.getter()}_parse(nt){const{ctx:Ft}=this._processInputParams(nt);return this._def.getter()._parse({data:Ft.data,path:Ft.path,parent:Ft})}}t.ZodLazy=pe,pe.create=(qt,nt)=>new pe({getter:qt,typeName:At.ZodLazy,...h(nt)});class re extends u{_parse(nt){if(nt.data!==this._def.value){const Ft=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Ft,{received:Ft.data,code:s.ZodIssueCode.invalid_literal,expected:this._def.value}),m.INVALID}return{status:"valid",value:nt.data}}get value(){return this._def.value}}t.ZodLiteral=re,re.create=(qt,nt)=>new re({value:qt,typeName:At.ZodLiteral,...h(nt)});function ge(qt,nt){return new De({values:qt,typeName:At.ZodEnum,...h(nt)})}class De extends u{constructor(){super(...arguments),o.set(this,void 0)}_parse(nt){if(typeof nt.data!="string"){const Ft=this._getOrReturnCtx(nt),Jt=this._def.values;return(0,m.addIssueToContext)(Ft,{expected:_.util.joinValues(Jt),received:Ft.parsedType,code:s.ZodIssueCode.invalid_type}),m.INVALID}if(n(this,o,"f")||r(this,o,new Set(this._def.values),"f"),!n(this,o,"f").has(nt.data)){const Ft=this._getOrReturnCtx(nt),Jt=this._def.values;return(0,m.addIssueToContext)(Ft,{received:Ft.data,code:s.ZodIssueCode.invalid_enum_value,options:Jt}),m.INVALID}return(0,m.OK)(nt.data)}get options(){return this._def.values}get enum(){const nt={};for(const Ft of this._def.values)nt[Ft]=Ft;return nt}get Values(){const nt={};for(const Ft of this._def.values)nt[Ft]=Ft;return nt}get Enum(){const nt={};for(const Ft of this._def.values)nt[Ft]=Ft;return nt}extract(nt,Ft=this._def){return De.create(nt,{...this._def,...Ft})}exclude(nt,Ft=this._def){return De.create(this.options.filter(Jt=>!nt.includes(Jt)),{...this._def,...Ft})}}t.ZodEnum=De,o=new WeakMap,De.create=ge;class Ae extends u{constructor(){super(...arguments),a.set(this,void 0)}_parse(nt){const Ft=_.util.getValidEnumValues(this._def.values),Jt=this._getOrReturnCtx(nt);if(Jt.parsedType!==_.ZodParsedType.string&&Jt.parsedType!==_.ZodParsedType.number){const Dn=_.util.objectValues(Ft);return(0,m.addIssueToContext)(Jt,{expected:_.util.joinValues(Dn),received:Jt.parsedType,code:s.ZodIssueCode.invalid_type}),m.INVALID}if(n(this,a,"f")||r(this,a,new Set(_.util.getValidEnumValues(this._def.values)),"f"),!n(this,a,"f").has(nt.data)){const Dn=_.util.objectValues(Ft);return(0,m.addIssueToContext)(Jt,{received:Jt.data,code:s.ZodIssueCode.invalid_enum_value,options:Dn}),m.INVALID}return(0,m.OK)(nt.data)}get enum(){return this._def.values}}t.ZodNativeEnum=Ae,a=new WeakMap,Ae.create=(qt,nt)=>new Ae({values:qt,typeName:At.ZodNativeEnum,...h(nt)});class Ue extends u{unwrap(){return this._def.type}_parse(nt){const{ctx:Ft}=this._processInputParams(nt);if(Ft.parsedType!==_.ZodParsedType.promise&&Ft.common.async===!1)return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.promise,received:Ft.parsedType}),m.INVALID;const Jt=Ft.parsedType===_.ZodParsedType.promise?Ft.data:Promise.resolve(Ft.data);return(0,m.OK)(Jt.then(Dn=>this._def.type.parseAsync(Dn,{path:Ft.path,errorMap:Ft.common.contextualErrorMap})))}}t.ZodPromise=Ue,Ue.create=(qt,nt)=>new Ue({type:qt,typeName:At.ZodPromise,...h(nt)});class Ye extends u{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===At.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt),Dn=this._def.effect||null,Fn={addIssue:Bi=>{(0,m.addIssueToContext)(Jt,Bi),Bi.fatal?Ft.abort():Ft.dirty()},get path(){return Jt.path}};if(Fn.addIssue=Fn.addIssue.bind(Fn),Dn.type==="preprocess"){const Bi=Dn.transform(Jt.data,Fn);if(Jt.common.async)return Promise.resolve(Bi).then(async Mi=>{if(Ft.value==="aborted")return m.INVALID;const Xi=await this._def.schema._parseAsync({data:Mi,path:Jt.path,parent:Jt});return Xi.status==="aborted"?m.INVALID:Xi.status==="dirty"||Ft.value==="dirty"?(0,m.DIRTY)(Xi.value):Xi});{if(Ft.value==="aborted")return m.INVALID;const Mi=this._def.schema._parseSync({data:Bi,path:Jt.path,parent:Jt});return Mi.status==="aborted"?m.INVALID:Mi.status==="dirty"||Ft.value==="dirty"?(0,m.DIRTY)(Mi.value):Mi}}if(Dn.type==="refinement"){const Bi=Mi=>{const Xi=Dn.refinement(Mi,Fn);if(Jt.common.async)return Promise.resolve(Xi);if(Xi instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Mi};if(Jt.common.async===!1){const Mi=this._def.schema._parseSync({data:Jt.data,path:Jt.path,parent:Jt});return Mi.status==="aborted"?m.INVALID:(Mi.status==="dirty"&&Ft.dirty(),Bi(Mi.value),{status:Ft.value,value:Mi.value})}else return this._def.schema._parseAsync({data:Jt.data,path:Jt.path,parent:Jt}).then(Mi=>Mi.status==="aborted"?m.INVALID:(Mi.status==="dirty"&&Ft.dirty(),Bi(Mi.value).then(()=>({status:Ft.value,value:Mi.value}))))}if(Dn.type==="transform")if(Jt.common.async===!1){const Bi=this._def.schema._parseSync({data:Jt.data,path:Jt.path,parent:Jt});if(!(0,m.isValid)(Bi))return Bi;const Mi=Dn.transform(Bi.value,Fn);if(Mi instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Ft.value,value:Mi}}else return this._def.schema._parseAsync({data:Jt.data,path:Jt.path,parent:Jt}).then(Bi=>(0,m.isValid)(Bi)?Promise.resolve(Dn.transform(Bi.value,Fn)).then(Mi=>({status:Ft.value,value:Mi})):Bi);_.util.assertNever(Dn)}}t.ZodEffects=Ye,t.ZodTransformer=Ye,Ye.create=(qt,nt,Ft)=>new Ye({schema:qt,typeName:At.ZodEffects,effect:nt,...h(Ft)}),Ye.createWithPreprocess=(qt,nt,Ft)=>new Ye({schema:nt,effect:{type:"preprocess",transform:qt},typeName:At.ZodEffects,...h(Ft)});class Ke extends u{_parse(nt){return this._getType(nt)===_.ZodParsedType.undefined?(0,m.OK)(void 0):this._def.innerType._parse(nt)}unwrap(){return this._def.innerType}}t.ZodOptional=Ke,Ke.create=(qt,nt)=>new Ke({innerType:qt,typeName:At.ZodOptional,...h(nt)});class mt extends u{_parse(nt){return this._getType(nt)===_.ZodParsedType.null?(0,m.OK)(null):this._def.innerType._parse(nt)}unwrap(){return this._def.innerType}}t.ZodNullable=mt,mt.create=(qt,nt)=>new mt({innerType:qt,typeName:At.ZodNullable,...h(nt)});class _t extends u{_parse(nt){const{ctx:Ft}=this._processInputParams(nt);let Jt=Ft.data;return Ft.parsedType===_.ZodParsedType.undefined&&(Jt=this._def.defaultValue()),this._def.innerType._parse({data:Jt,path:Ft.path,parent:Ft})}removeDefault(){return this._def.innerType}}t.ZodDefault=_t,_t.create=(qt,nt)=>new _t({innerType:qt,typeName:At.ZodDefault,defaultValue:typeof nt.default=="function"?nt.default:()=>nt.default,...h(nt)});class Mt extends u{_parse(nt){const{ctx:Ft}=this._processInputParams(nt),Jt={...Ft,common:{...Ft.common,issues:[]}},Dn=this._def.innerType._parse({data:Jt.data,path:Jt.path,parent:{...Jt}});return(0,m.isAsync)(Dn)?Dn.then(Fn=>({status:"valid",value:Fn.status==="valid"?Fn.value:this._def.catchValue({get error(){return new s.ZodError(Jt.common.issues)},input:Jt.data})})):{status:"valid",value:Dn.status==="valid"?Dn.value:this._def.catchValue({get error(){return new s.ZodError(Jt.common.issues)},input:Jt.data})}}removeCatch(){return this._def.innerType}}t.ZodCatch=Mt,Mt.create=(qt,nt)=>new Mt({innerType:qt,typeName:At.ZodCatch,catchValue:typeof nt.catch=="function"?nt.catch:()=>nt.catch,...h(nt)});class ct extends u{_parse(nt){if(this._getType(nt)!==_.ZodParsedType.nan){const Jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.nan,received:Jt.parsedType}),m.INVALID}return{status:"valid",value:nt.data}}}t.ZodNaN=ct,ct.create=qt=>new ct({typeName:At.ZodNaN,...h(qt)}),t.BRAND=Symbol("zod_brand");class wt extends u{_parse(nt){const{ctx:Ft}=this._processInputParams(nt),Jt=Ft.data;return this._def.type._parse({data:Jt,path:Ft.path,parent:Ft})}unwrap(){return this._def.type}}t.ZodBranded=wt;class st extends u{_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt);if(Jt.common.async)return(async()=>{const Fn=await this._def.in._parseAsync({data:Jt.data,path:Jt.path,parent:Jt});return Fn.status==="aborted"?m.INVALID:Fn.status==="dirty"?(Ft.dirty(),(0,m.DIRTY)(Fn.value)):this._def.out._parseAsync({data:Fn.value,path:Jt.path,parent:Jt})})();{const Dn=this._def.in._parseSync({data:Jt.data,path:Jt.path,parent:Jt});return Dn.status==="aborted"?m.INVALID:Dn.status==="dirty"?(Ft.dirty(),{status:"dirty",value:Dn.value}):this._def.out._parseSync({data:Dn.value,path:Jt.path,parent:Jt})}}static create(nt,Ft){return new st({in:nt,out:Ft,typeName:At.ZodPipeline})}}t.ZodPipeline=st;class rt extends u{_parse(nt){const Ft=this._def.innerType._parse(nt),Jt=Dn=>((0,m.isValid)(Dn)&&(Dn.value=Object.freeze(Dn.value)),Dn);return(0,m.isAsync)(Ft)?Ft.then(Dn=>Jt(Dn)):Jt(Ft)}unwrap(){return this._def.innerType}}t.ZodReadonly=rt,rt.create=(qt,nt)=>new rt({innerType:qt,typeName:At.ZodReadonly,...h(nt)});function lt(qt,nt={},Ft){return qt?ie.create().superRefine((Jt,Dn)=>{var Fn,Bi;if(!qt(Jt)){const Mi=typeof nt=="function"?nt(Jt):typeof nt=="string"?{message:nt}:nt,Xi=(Bi=(Fn=Mi.fatal)!==null&&Fn!==void 0?Fn:Ft)!==null&&Bi!==void 0?Bi:!0,vi=typeof Mi=="string"?{message:Mi}:Mi;Dn.addIssue({code:"custom",...vi,fatal:Xi})}}):ie.create()}t.custom=lt,t.late={object:te.lazycreate};var At;(function(qt){qt.ZodString="ZodString",qt.ZodNumber="ZodNumber",qt.ZodNaN="ZodNaN",qt.ZodBigInt="ZodBigInt",qt.ZodBoolean="ZodBoolean",qt.ZodDate="ZodDate",qt.ZodSymbol="ZodSymbol",qt.ZodUndefined="ZodUndefined",qt.ZodNull="ZodNull",qt.ZodAny="ZodAny",qt.ZodUnknown="ZodUnknown",qt.ZodNever="ZodNever",qt.ZodVoid="ZodVoid",qt.ZodArray="ZodArray",qt.ZodObject="ZodObject",qt.ZodUnion="ZodUnion",qt.ZodDiscriminatedUnion="ZodDiscriminatedUnion",qt.ZodIntersection="ZodIntersection",qt.ZodTuple="ZodTuple",qt.ZodRecord="ZodRecord",qt.ZodMap="ZodMap",qt.ZodSet="ZodSet",qt.ZodFunction="ZodFunction",qt.ZodLazy="ZodLazy",qt.ZodLiteral="ZodLiteral",qt.ZodEnum="ZodEnum",qt.ZodEffects="ZodEffects",qt.ZodNativeEnum="ZodNativeEnum",qt.ZodOptional="ZodOptional",qt.ZodNullable="ZodNullable",qt.ZodDefault="ZodDefault",qt.ZodCatch="ZodCatch",qt.ZodPromise="ZodPromise",qt.ZodBranded="ZodBranded",qt.ZodPipeline="ZodPipeline",qt.ZodReadonly="ZodReadonly"})(At||(t.ZodFirstPartyTypeKind=At={}));class jt{constructor(...nt){}}const _n=(qt,nt={message:`Input not instance of ${qt.name}`})=>lt(Ft=>Ft instanceof qt,nt);t.instanceof=_n;const In=G.create;t.string=In;const ci=$.create;t.number=ci;const xn=ct.create;t.nan=xn;const dn=V.create;t.bigint=dn;const jn=H.create;t.boolean=jn;const sn=K.create;t.date=sn;const at=Y.create;t.symbol=at;const $e=X.create;t.undefined=$e;const Oe=oe.create;t.null=Oe;const Le=ie.create;t.any=Le;const ze=he.create;t.unknown=ze;const St=me.create;t.never=St;const $t=q.create;t.void=$t;const On=Ee.create;t.array=On;const Bn=te.create;t.object=Bn;const ui=te.strictCreate;t.strictObject=ui;const li=fe.create;t.union=li;const Ni=Me.create;t.discriminatedUnion=Ni;const Rn=Pe.create;t.intersection=Rn;const Cn=we.create;t.tuple=Cn;const $n=_e.create;t.record=$n;const Si=Ne.create;t.map=Si;const Ui=Te.create;t.set=Ui;const bi=We.create;t.function=bi;const un=pe.create;t.lazy=un;const Vn=re.create;t.literal=Vn;const Xt=De.create;t.enum=Xt;const Qe=Ae.create;t.nativeEnum=Qe;const vt=Ue.create;t.promise=vt;const pt=Ye.create;t.effect=pt,t.transformer=pt;const gt=Ke.create;t.optional=gt;const nn=mt.create;t.nullable=nn;const Gt=Ye.createWithPreprocess;t.preprocess=Gt;const Kt=st.create;t.pipeline=Kt;const vn=()=>In().optional();t.ostring=vn;const Hn=()=>ci().optional();t.onumber=Hn;const Jn=()=>jn().optional();t.oboolean=Jn,t.coerce={string:qt=>G.create({...qt,coerce:!0}),number:qt=>$.create({...qt,coerce:!0}),boolean:qt=>H.create({...qt,coerce:!0}),bigint:qt=>V.create({...qt,coerce:!0}),date:qt=>K.create({...qt,coerce:!0})},t.NEVER=m.INVALID},79682:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChromeDevtoolsContribution=void 0;const r=e(85608),o=e(76003),a=e(41869),p=e(65265),v=e(98295),m=e(27654);let _=n=class extends a.Disposable{constructor(){super(...arguments),this.lantencyHandler=g=>{const{command:l}=g.detail;l===p.DevtoolsLantencyCommand.Start?this.interval||this.startRTTInterval():l===p.DevtoolsLantencyCommand.Stop&&this.interval&&(clearInterval(this.interval),this.interval=void 0)}}initialize(){var g;this.appConfig.devtools&&(window.addEventListener(p.EDevtoolsEvent.Latency,this.lantencyHandler),this.addDispose(a.Disposable.create(()=>{window.removeEventListener(p.EDevtoolsEvent.Latency,this.lantencyHandler),this.interval&&(clearInterval(this.interval),this.interval=void 0)})),!((g=window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__)===null||g===void 0)&&g.captureRPC&&(this.interval||this.startRTTInterval()))}startRTTInterval(){this.interval=setInterval(async()=>{const g=Date.now();await this.rttService.measure();const l=Date.now()-g;window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.captureRPC&&(window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.latency=l)},n.INTERVAL)}};t.ChromeDevtoolsContribution=_,_.INTERVAL=1e3,r.__decorate([(0,o.Autowired)(a.AppConfig),r.__metadata("design:type",Object)],_.prototype,"appConfig",void 0),r.__decorate([(0,o.Autowired)(m.ConnectionRTTBrowserServiceToken),r.__metadata("design:type",m.ConnectionRTTBrowserService)],_.prototype,"rttService",void 0),t.ChromeDevtoolsContribution=_=n=r.__decorate([(0,v.Domain)(a.ClientAppContribution)],_)},72915:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionRTTContribution=void 0;const r=e(85608),o=e(76003),a=e(26542),p=e(92323),v=e(98295),m=e(27654),_={id:"connection.start.rtt",label:"%connection.start.rtt%",category:"%command.category.developerTools%"},s={id:"connection.stop.rtt",label:"%connection.stop.rtt%",category:"%command.category.developerTools%"},g={alignment:a.StatusBarAlignment.LEFT,priority:1/0-1};let l=n=class{registerCommands(u){u.registerCommand(_,{execute:()=>{this.interval||this.startRTTInterval()}}),u.registerCommand(s,{execute:()=>{this.interval&&(clearInterval(this.interval),this.statusBar&&(this.statusBar.dispose(),this.statusBar=void 0))}})}startRTTInterval(){this.interval=setInterval(async()=>{const u=Date.now();await this.rttService.measure();const E={text:`${Date.now()-u}ms`};if(this.statusBar)this.statusBar.update({...E,...g});else{const f=this.statusBarService.addElement("connection-rtt",{...E,...g});this.statusBar=f}},n.INTERVAL)}};t.ConnectionRTTContribution=l,l.INTERVAL=1e3,r.__decorate([(0,o.Autowired)(a.IStatusBarService),r.__metadata("design:type",Object)],l.prototype,"statusBarService",void 0),r.__decorate([(0,o.Autowired)(m.ConnectionRTTBrowserServiceToken),r.__metadata("design:type",m.ConnectionRTTBrowserService)],l.prototype,"rttService",void 0),t.ConnectionRTTContribution=l=n=r.__decorate([(0,v.Domain)(p.CommandContribution)],l)},27654:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionRTTBrowserService=t.ConnectionRTTBrowserServiceToken=void 0;const n=e(85608),r=e(76003),o=e(69452);t.ConnectionRTTBrowserServiceToken=Symbol("ConnectionRTTBrowserService");let a=class{async measure(){await this.connectionBackService.$measure()}};t.ConnectionRTTBrowserService=a,n.__decorate([(0,r.Autowired)(o.ConnectionBackServicePath),n.__metadata("design:type",Object)],a.prototype,"connectionBackService",void 0),t.ConnectionRTTBrowserService=a=n.__decorate([(0,r.Injectable)()],a)},17631:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDropContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(43718),p=e(69452);let v=class extends a.WithEventBus{onDidDropFile(_){this.dropService.onDidDropFile(_)}};t.FileDropContribution=v,n.__decorate([(0,r.Autowired)(p.IFileDropFrontendServiceToken),n.__metadata("design:type",Object)],v.prototype,"dropService",void 0),n.__decorate([(0,a.OnEvent)(a.FileTreeDropEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[a.FileTreeDropEvent]),n.__metadata("design:returntype",void 0)],v.prototype,"onDidDropFile",null),t.FileDropContribution=v=n.__decorate([(0,r.Injectable)(),(0,o.Domain)(o.ClientAppContribution)],v)},22874:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDropService=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(26542),p=e(43718),v=e(42933),{Path:m}=p.path,_=e(69452);let s=class extends p.WithEventBus{constructor(){super(...arguments),this.pending=new Set}onDidUploadFileStart(l){this.pending.add(l),this.createOrUpdateStatusBar()}onDidUploadFileEnd(l){this.pending.delete(l),this.createOrUpdateStatusBar()}createOrUpdateStatusBar(l){if(this.pending.size===0){this.uploadStatus&&(this.uploadStatus.dispose(),this.uploadStatus=void 0);return}const h="sumi-upload-file-status",u=(0,o.formatLocalize)("workbench.uploadingFiles",this.pending.size,l||"0 MB"),d={text:u,alignment:a.StatusBarAlignment.RIGHT,tooltip:u,iconClass:"kaitian-icon kticon-cloud-server"};this.uploadStatus?this.uploadStatus.update({id:h,...d}):this.uploadStatus=this.statusBarService.addElement(h,d)}onDidDropFile(l){var h;const{payload:{event:u,targetDir:d}}=l;if(!d||!(!((h=u.dataTransfer)===null||h===void 0)&&h.files)||u.dataTransfer.files.length===0)return;const E=u.dataTransfer.items;let f=0;const c=Date.now(),y=b=>{f+=b;const A=Date.now(),D=`${(f/((A-c)/1e3)/1024/1024).toFixed(2)} MB`;this.createOrUpdateStatusBar(D)};for(const b of E){const A=b.webkitGetAsEntry();this.processFilesEntry(d,A,y)}}async processFilesEntry(l,h,u){if(h.isFile)this.processFileEntry(h,l,u);else{const d=p.Uri.file(new m(l).join(h.fullPath).toString()).toString();await this.fs.createFolder(d),this.processDirEntry(h,l,u)}}toBinaryString(l){let h;const u=l.length;let d="";for(h=0;h<u;h+=1)d+=String.fromCharCode(l[h]);return d}async doUploadFile(l,h,u){var d;const E=new m(h).join(l.name).toString();this.onDidUploadFileStart(E.toString()),await this.fs.createFile(p.Uri.file(E.toString()).toString()),await this.dropService.$ensureFileExist(l.name,h);const f=l.stream().getReader();let c=await f.read();for(;!c.done;)await this.dropService.$writeStream(this.toBinaryString(c.value),l.name,h,c.done),u((d=c.value)===null||d===void 0?void 0:d.byteLength),c=await f.read();c.done&&this.onDidUploadFileEnd(E.toString())}processFileEntry(l,h,u){l.file(d=>{const E=new File([d],l.fullPath,{type:l.type});this.doUploadFile(E,h,u)},()=>{})}processDirEntry(l,h,u){l.createReader().readEntries(E=>{E.forEach(async f=>{this.processFilesEntry(h,f,u)})},()=>{})}};t.FileDropService=s,n.__decorate([(0,r.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],s.prototype,"fs",void 0),n.__decorate([(0,r.Autowired)(_.FileDropServicePath),n.__metadata("design:type",Object)],s.prototype,"dropService",void 0),n.__decorate([(0,r.Autowired)(a.IStatusBarService),n.__metadata("design:type",Object)],s.prototype,"statusBarService",void 0),t.FileDropService=s=n.__decorate([(0,r.Injectable)()],s)},79240:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSearchContribution=t.FileSearchQuickCommandHandler=t.matchLineReg=t.quickGoToSymbol=t.quickFileOpen=void 0,t.getValidateInput=y;const n=e(85608),r=n.__importDefault(e(39050)),o=e(76003),a=e(41869),p=e(26542),v=e(43718),m=e(98295),_=e(54414),s=e(17459),g=e(84660),l=n.__importStar(e(20868)),h=e(97821),u=e(80490),d=e(51500),E=e(30981),f=200;t.quickFileOpen={id:"workbench.action.quickOpen",category:"File",label:"Open File..."},t.quickGoToSymbol={id:"workbench.action.gotoSymbol",category:"File",label:"Open File Symbol..."},t.matchLineReg=/^([^:#(]*)[:#(]?L?(\d+)?[:,]?(\d+)?\)?/;function c(I=""){const w=I.match(t.matchLineReg)||[];if(w.length<2)return;const T={line:Number(w[2]||0),start:Number(w[3]||0)};return new l.Range(T.line,T.start,T.line,T.start)}function y(I){return I.replace(t.matchLineReg,"$1")}let b=class extends h.QuickOpenBaseAction{constructor(){super({id:"file-search:splitToRight",tooltip:(0,a.localize)("quickOpen.openOnTheRightSide"),class:(0,a.getIcon)("embed")})}async run(w){await this.commandService.executeCommand(a.EDITOR_COMMANDS.OPEN_RESOURCE.id,w.getUri(),{preview:!1,split:_.EditorGroupSplitAction.Right,range:c(this.injector.get(S).currentLookFor),focus:!0})}};n.__decorate([(0,o.Autowired)(a.CommandService),n.__metadata("design:type",Object)],b.prototype,"commandService",void 0),n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],b.prototype,"injector",void 0),b=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],b);let A=class{hasActions(){return!0}getActions(){return[this.fileSearchActionLeftRight]}getValidateInput(w){return y(w)}};n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",b)],A.prototype,"fileSearchActionLeftRight",void 0),A=n.__decorate([(0,o.Injectable)()],A);let S=class{constructor(){this.cancelIndicator=new v.CancellationTokenSource,this.default=!0,this.prefix="...",this.description=(0,a.localize)("file-search.command.fileOpen.description"),this.prevEditorState={},this.currentLookFor=""}getModel(){return{onType:async(w,T)=>{this.cancelIndicator.cancel(),this.cancelIndicator=new v.CancellationTokenSource;const R=this.cancelIndicator.token,P=new Set;let O=[];w=w.trim().replace(/\s/g,""),this.currentLookFor=w;const M=y(w),k=this.reporterService.time(v.REPORT_NAME.QUICK_OPEN_MEASURE),F=await this.getRecentlyItems(P,M,R);if(w&&(this.logger.debug("lookFor",w,M),O=await this.getFindOutItems(P,M,R)),R.isCancellationRequested)return;const L=F.concat(O);T(L,L.length?this.fileSearchActionProvider:void 0),k.timeEnd(w.indexOf("@")>-1?"file-symbol":"file",{lookFor:w,stat:{recently:F.length,find:O.length}})}}}getOptions(){return{placeholder:(0,a.localize)("file-search.command.fileOpen.placeholder"),fuzzyMatchLabel:{enableSeparateSubstringMatching:!0},showItemsWithoutHighlight:!0,fuzzyMatchDescription:{enableSeparateSubstringMatching:!0},getPlaceholderItem:w=>new a.QuickOpenItem({label:(0,a.localize)(w.indexOf("@")>-1?"search.fileSymbolResults.notfound":"search.fileResults.notfound"),run:()=>!1})}}onClose(w){w&&this.prevEditorState.uri&&(this.workbenchEditorService.open(this.prevEditorState.uri,{range:this.prevEditorState.range}),this.prevEditorState={}),this.prevSelected=void 0,this.cancelIndicator.cancel()}onToggle(){this.cancelIndicator.cancel()}trySaveEditorState(){var w;if(this.workbenchEditorService.currentResource){let T={startColumn:1,startLineNumber:1,endColumn:1,endLineNumber:1};const R=(w=this.workbenchEditorService.currentEditor)===null||w===void 0?void 0:w.getSelections();if(R){const{selectionStartLineNumber:P,selectionStartColumn:O,positionLineNumber:M,positionColumn:k}=R[0];T=new l.Range(P,O,M,k)}this.prevEditorState={uri:this.workbenchEditorService.currentResource.uri,range:T}}}async getFindOutItems(w,T,R){var P;let O;if(T.indexOf("@")>-1){this.trySaveEditorState(),O=[];const[M,k]=T.split("@");let F;if(this.prevSelected)F=this.prevSelected.withoutFragment();else if(M){const L=await this.getQueryFiles(M,w,R);L.length&&(F=L[0].getUri())}else F=(P=this.workbenchEditorService.currentResource)===null||P===void 0?void 0:P.uri;if(F){const L=await this.documentSymbolStore.getDocumentSymbolAsync(F)||[],B=[];this.flattenSymbols({children:L},B),O=B.filter(W=>{const j=(0,E.matchesFuzzy)(k,W.name,!0)||[];return j&&(W.labelHighlights=j),j&&j.length}).map((W,j)=>{var Q;return new a.QuickOpenItem({uri:F,label:W.name,iconClass:(0,a.getSymbolIcon)(W.kind),description:(Q=W.parent)===null||Q===void 0?void 0:Q.name,labelHighlights:W.labelHighlights,groupLabel:j===0?(0,a.formatLocalize)("search.fileSymbolResults",B.length):"",showBorder:!1,run:G=>G===a.Mode.PREVIEW?(this.locateSymbol(F,W),!0):G===a.Mode.OPEN?(this.locateSymbol(F,W),!0):!1})})}else return[]}else if(O=await this.getQueryFiles(T,w,R),O[0]){const M=await this.getItems([O[0].getUri().codeUri.fsPath],{groupLabel:(0,a.localize)("search.fileResults"),showBorder:!0});O[0]=M[0]}return O}async getQueryFiles(w,T,R){const O=(await this.workspaceService.roots).map(F=>new a.URI(F.uri).codeUri.fsPath),M=await this.fileSearchService.find(w,{rootUris:O,fuzzyMatch:!0,limit:f,useGitIgnore:!0,noIgnoreParent:!0,excludePatterns:this.getPreferenceSearchExcludes()},R),k=await this.getItems(M.filter(F=>T.has(F)||R.isCancellationRequested?!1:(T.add(F),!0)),{});return k.sort(this.compareItems.bind(this)),k}async flattenSymbols(w,T){w.children.forEach(R=>{T.push(R),R.children&&this.flattenSymbols(R,T)})}async getRecentlyItems(w,T,R){const P=await this.recentFilesManager.getMostRecentlyOpenedFiles(!0)||[];return await this.getItems(P.filter(O=>{const M=new a.URI(O);return w.has(O)||!r.default.test(T,M.displayName)||R.isCancellationRequested?!1:(w.add(O),!0)}),{groupLabel:(0,a.localize)("search.historyMatches")})}async getItems(w,T){const R=[];for(const[P,O]of w.entries()){const M=a.URI.isUriString(O)?new a.URI(O):a.URI.file(O),k=`file-icon ${this.labelService.getIcon(M.withoutFragment())}`;let F="";const L=await this.workspaceService.asRelativePath(M.parent);L&&(this.workspaceService.isMultiRootWorkspaceOpened?F=`${new a.URI(L.root).displayName}${L.path?` \u30FB ${L.path}`:""}`:F=L.path||"");const B=new a.QuickOpenItem({uri:M,label:M.displayName,tooltip:O,iconClass:k,description:F,groupLabel:P===0?T.groupLabel:"",showBorder:w.length>0&&P===0?T.showBorder:!1,run:U=>(U===a.Mode.PREVIEW&&(this.prevSelected=M),U===a.Mode.OPEN?(this.openFile(M),!0):!1)});R.push(B)}return R}openFile(w){const T=w.codeUri.fsPath;let R=c(this.currentLookFor);(!R||!R.startLineNumber&&!R.startColumn)&&(R=c(w.fragment?"#"+w.fragment:T)),this.currentLookFor="",this.commandService.executeCommand(a.EDITOR_COMMANDS.OPEN_RESOURCE.id,w.withoutFragment(),{preview:!1,range:R,focus:!0})}locateSymbol(w,T){this.workbenchEditorService.open(w,{range:T.range,preview:!0})}compareItems(w,T,R="getLabel"){function P(U){return U.trim().toLowerCase()}const O=P(y(this.currentLookFor));function M(U){const W=r.default.match(O,U);return W===null?0:W.score}let k=w[R](),F=T[R]();typeof k!="string"&&(k=k.path.toString()),typeof F!="string"&&(F=F.path.toString()),k=P(k),F=P(F);const L=M(k),B=M(F);if(L===B){const U=k.indexOf(O),W=F.indexOf(O);return U===W?k.length!==F.length?k.length<F.length?-1:1:F.localeCompare(k)===0?R==="getUri"?0:this.compareItems(w,T,"getUri"):F.localeCompare(k):U-W}return B-L}getPreferenceSearchExcludes(){const w=[],T=this.preferenceService.get("files.exclude"),R=this.preferenceService.get("search.exclude"),P=Object.assign({},T,R);for(const O of Object.keys(P))P[O]&&w.push(O);return w}};t.FileSearchQuickCommandHandler=S,n.__decorate([(0,o.Autowired)(a.CommandService),n.__metadata("design:type",Object)],S.prototype,"commandService",void 0),n.__decorate([(0,o.Autowired)(g.FileSearchServicePath),n.__metadata("design:type",Object)],S.prototype,"fileSearchService",void 0),n.__decorate([(0,o.Autowired)(_.WorkbenchEditorService),n.__metadata("design:type",_.WorkbenchEditorService)],S.prototype,"workbenchEditorService",void 0),n.__decorate([(0,o.Autowired)(s.DocumentSymbolStore),n.__metadata("design:type",s.DocumentSymbolStore)],S.prototype,"documentSymbolStore",void 0),n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",p.LabelService)],S.prototype,"labelService",void 0),n.__decorate([(0,o.Autowired)(d.IWorkspaceService),n.__metadata("design:type",Object)],S.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(a.RecentFilesManager),n.__metadata("design:type",a.RecentFilesManager)],S.prototype,"recentFilesManager",void 0),n.__decorate([(0,o.Autowired)(a.ILogger),n.__metadata("design:type",Object)],S.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",A)],S.prototype,"fileSearchActionProvider",void 0),n.__decorate([(0,o.Autowired)(a.PreferenceService),n.__metadata("design:type",Object)],S.prototype,"preferenceService",void 0),n.__decorate([(0,o.Autowired)(v.IReporterService),n.__metadata("design:type",Object)],S.prototype,"reporterService",void 0),t.FileSearchQuickCommandHandler=S=n.__decorate([(0,o.Injectable)()],S);let D=class{registerQuickOpenHandlers(w){w.registerHandler(this.fileSearchQuickCommandHandler,{title:(0,a.localize)("quickopen.tab.file"),commandId:t.quickFileOpen.id,order:1})}registerCommands(w){w.registerCommand(t.quickFileOpen,{execute:()=>this.quickOpenService.open("...")}),w.registerCommand(t.quickGoToSymbol,{execute:()=>this.quickOpenService.open("...@")})}registerKeybindings(w){w.registerKeybinding({command:t.quickFileOpen.id,keybinding:"ctrlcmd+p"})}};t.FileSearchContribution=D,n.__decorate([(0,o.Autowired)(S),n.__metadata("design:type",S)],D.prototype,"fileSearchQuickCommandHandler",void 0),n.__decorate([(0,o.Autowired)(h.PrefixQuickOpenService),n.__metadata("design:type",Object)],D.prototype,"quickOpenService",void 0),t.FileSearchContribution=D=n.__decorate([(0,m.Domain)(v.CommandContribution,a.KeybindingContribution,u.QuickOpenContribution)],D)},73827:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClientAddonModule=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(69452),p=e(79682),v=e(72915),m=e(27654),_=e(17631),s=e(22874),g=e(79240),l=e(18256),h=e(7756),u=e(16426);let d=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[p.ChromeDevtoolsContribution,l.LanguageChangeHintContribution,g.FileSearchContribution,h.StatusBarContribution,u.ToolbarCustomizeContribution,_.FileDropContribution,v.ConnectionRTTContribution,{token:a.IFileDropFrontendServiceToken,useClass:s.FileDropService},{token:m.ConnectionRTTBrowserServiceToken,useClass:m.ConnectionRTTBrowserService}],this.backServices=[{servicePath:a.FileDropServicePath},{servicePath:a.ConnectionBackServicePath}]}};t.ClientAddonModule=d,t.ClientAddonModule=d=n.__decorate([(0,r.Injectable)()],d)},18256:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageChangeHintContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(72665);let p=class{onStart(){this.preferenceService.onSpecificPreferenceChange(o.GeneralSettingsId.Language,async m=>{(0,o.setLanguageId)(m.newValue),this.preferenceService.get("general.askReloadOnLanguageChange")&&await this.dialogService.info((0,o.localize)("preference.general.language.change.refresh.info","After changing the language, it should be restarted to take effect. Will it be refreshed immediately?"),[(0,o.localize)("preference.general.language.change.refresh.later","Later"),(0,o.localize)("preference.general.language.change.refresh.now","Now")])===(0,o.localize)("preference.general.language.change.refresh.now","Now")&&this.clientApp.fireOnReload()})}};t.LanguageChangeHintContribution=p,n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],p.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.IClientApp),n.__metadata("design:type",Object)],p.prototype,"clientApp",void 0),n.__decorate([(0,r.Autowired)(a.IDialogService),n.__metadata("design:type",Object)],p.prototype,"dialogService",void 0),t.LanguageChangeHintContribution=p=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],p)},7756:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatusBarContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(43718);let p=class extends a.WithEventBus{onStart(){}handleBrowserConnectionOpen(){this.commandService.executeCommand("statusbar.changeBackgroundColor","var(--statusBar-background)"),this.logger.log("Browser connection open, change status bar background color")}handleBrowserConnectionClose(){this.commandService.executeCommand("statusbar.changeBackgroundColor","var(--kt-statusbar-offline-background)"),this.logger.log("Browser connection close, change status bar background color")}};t.StatusBarContribution=p,n.__decorate([(0,r.Autowired)(a.CommandService),n.__metadata("design:type",Object)],p.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(a.ILogger),n.__metadata("design:type",Object)],p.prototype,"logger",void 0),n.__decorate([(0,a.OnEvent)(a.BrowserConnectionOpenEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],p.prototype,"handleBrowserConnectionOpen",null),n.__decorate([(0,a.OnEvent)(a.BrowserConnectionCloseEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],p.prototype,"handleBrowserConnectionClose",null),t.StatusBarContribution=p=n.__decorate([(0,a.Domain)(o.ClientAppContribution)],p)},16426:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToolbarCustomizeContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(93899),p=e(62132);let v=class{registerCommands(_){_.registerCommand({id:"toolbar.showCustomizePanel",label:"Show Toolbar Customization"},{execute:()=>{this.viewService.setVisible(!0)}})}registerComponent(_){_.register("addon/toolbar-customize",{id:"addon/toolbar-customize",component:p.ToolbarCustomizeComponent}),this.config.layoutConfig[o.SlotLocation.extra]||(this.config.layoutConfig[o.SlotLocation.extra]={modules:[]}),this.config.layoutConfig[o.SlotLocation.extra].modules.push("addon/toolbar-customize")}registerMenus(_){_.registerMenuItem(a.MenuId.KTToolbarLocationContext,{command:{id:"toolbar.showCustomizePanel",label:(0,o.localize)("toolbar.customize.menu")}})}};t.ToolbarCustomizeContribution=v,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],v.prototype,"config",void 0),n.__decorate([(0,r.Autowired)(p.ToolbarCustomizeViewService),n.__metadata("design:type",p.ToolbarCustomizeViewService)],v.prototype,"viewService",void 0),t.ToolbarCustomizeContribution=v=n.__decorate([(0,o.Domain)(o.CommandContribution,o.ComponentContribution,a.MenuContribution)],v)},62132:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToolbarCustomizeComponent=t.ToolbarCustomizeViewService=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(76003),a=e(97267),p=e(41869),v=n.__importDefault(e(18541));let m=class{bindSetVisibleHandle(g){this._setVisible=g}setVisible(g){this._setVisible(g)}async toggleActionVisibility(g,l,h){const u=this.preferenceService.getValid("toolbar.ignoreActions",{});if(u[g]||(u[g]=[]),!h)u[g].indexOf(l)===-1&&u[g].push(l);else{const E=u[g].indexOf(l);E!==-1&&u[g].splice(E,1)}const d=this.preferenceService.inspect("toolbar.ignoreActions").workspaceValue?p.PreferenceScope.Workspace:p.PreferenceScope.User;await this.preferenceService.set("toolbar.ignoreActions",u,d)}};t.ToolbarCustomizeViewService=m,n.__decorate([(0,o.Autowired)(p.PreferenceService),n.__metadata("design:type",Object)],m.prototype,"preferenceService",void 0),t.ToolbarCustomizeViewService=m=n.__decorate([(0,o.Injectable)()],m);const _=()=>{const[s,g]=r.default.useState(!1),l=(0,p.useInjectable)(m),h=(0,p.useInjectable)(p.IToolbarRegistry),u=(0,p.useInjectable)(p.PreferenceService);if(l.bindSetVisibleHandle(g),!s)return null;const d=h.getAllLocations(),E=u.get("toolbar.ignoreActions")||{};let f=u.get("toolbar.buttonDisplay","iconAndText");function c(y){const b=[{id:"_head"},...h.getActionGroups(y)||[],{id:"_tail"}],A=[],S=E[y]||[];return b.forEach((D,I)=>{const w=h.getToolbarActions({location:y,group:D.id});w&&w.actions.length>0&&(A.length>0&&A.push(r.default.createElement("div",{className:v.default["group-split"],key:"split-"+I})),w.actions.forEach((T,R)=>{var P;let O=S.indexOf(T.id)===-1;const M="action-toggle-"+T.id;A.push(r.default.createElement("div",{className:v.default["action-item"],key:R+"_"+T.id},r.default.createElement(a.CheckBox,{onChange:()=>{l.toggleActionVisibility(y,T.id,!O),O=!O},defaultChecked:O,id:M,label:(P=T.description)!==null&&P!==void 0?P:T.id})))}))}),A.length===0?null:r.default.createElement("div",{key:y,className:v.default["toolbar-customize-location"]},A)}return r.default.createElement("div",{className:v.default["toolbar-customize-overlay"]},r.default.createElement("div",{className:v.default["toolbar-customize"]},d.map(y=>c(y)),r.default.createElement("div",{className:v.default["button-display"]},r.default.createElement("div",null,(0,p.localize)("toolbar-customize.buttonDisplay.description")),r.default.createElement(a.Select,{options:[{label:(0,p.localize)("toolbar-customize.buttonDisplay.icon"),value:"icon"},{label:(0,p.localize)("toolbar-customize.buttonDisplay.iconAndText"),value:"iconAndText"}],value:f,onChange:y=>{const b=u.inspect("toolbar.buttonDisplay").workspaceValue?p.PreferenceScope.Workspace:p.PreferenceScope.User;u.set("toolbar.buttonDisplay",y,b),f=y},className:v.default["button-display-select"]})),r.default.createElement("div",{className:v.default["customize-complete"]},r.default.createElement(a.Button,{type:"primary",onClick:()=>g(!1)},(0,p.localize)("toolbar-customize.complete")))))};t.ToolbarCustomizeComponent=_},69452:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IConnectionBackService=t.ConnectionBackServicePath=t.IFileDropFrontendServiceToken=t.IFileDropServiceToken=t.FileDropServicePath=void 0,t.FileDropServicePath="FileDropServicePath",t.IFileDropServiceToken=Symbol("IFileDropService"),t.IFileDropFrontendServiceToken=Symbol("IFileDropFrontendService"),t.ConnectionBackServicePath="ConnectionBackServicePath",t.IConnectionBackService=Symbol("IConnectionBackService")},77659:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeContextKey=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(50394);let p=class{get contextKeyService(){return this._contextKeyService}constructor(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.inlineChatIsVisible=a.InlineChatIsVisible.bind(this._contextKeyService),this.inlineCompletionIsTrigger=a.InlineCompletionIsTrigger.bind(this._contextKeyService),this.inlineHintWidgetIsVisible=a.InlineHintWidgetIsVisible.bind(this._contextKeyService),this.inlineInputWidgetIsVisible=a.InlineInputWidgetIsVisible.bind(this._contextKeyService),this.inlineInputWidgetIsStreaming=a.InlineInputWidgetIsStreaming.bind(this._contextKeyService),this.inlineDiffPartialEditsIsVisible=a.InlineDiffPartialEditsIsVisible.bind(this._contextKeyService),this.codeEditsIsVisible=a.CodeEditsIsVisible.bind(this._contextKeyService)}};t.AINativeContextKey=p,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],p.prototype,"globalContextKeyService",void 0),t.AINativeContextKey=p=n.__decorate([(0,r.Injectable)(),n.__param(0,(0,r.Optional)()),n.__metadata("design:paramtypes",[Object])],p)},32016:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeBrowserContribution=t.INLINE_DIFF_MANAGER_WIDGET_ID=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(57925),p=e(50394),v=e(1149),m=e(97222),_=e(43718),s=e(82353),g=e(54414),l=e(57517),h=e(51553),u=e(63067),d=e(46507),E=e(97682),f=e(68415),c=e(96640),y=e(19413),b=e(64811),A=e(69820),S=e(98987),D=e(61282),I=e(42995),w=e(51081),T=e(59347),R=e(76154),P=e(79559),O=e(57232),M=e(72991),k=e(71863),F=e(7511),L=e(42911),B=e(72801),U=e(87817),W=e(4972),j=e(82983),Q=e(73974),G=e(33108),Z=e(77633),$=e(51221),V=e(2281),H=e(31031),K=e(95608),Y=e(38890),X=e(77886),oe=e(89060),ie=e(74353),he=e(22169),me=e(90058);t.INLINE_DIFF_MANAGER_WIDGET_ID="inline-diff-manager-widget";let q=class{constructor(){this.registerFeature()}registerMultiDiffSourceResolver(ue){return ue.registerResolver(this.chatMultiDiffResolver)}registerEditorDocumentModelContentProvider(ue){ue.registerEditorDocumentModelContentProvider(this.chatEditResourceProvider)}async initialize(){const{supportsChatAssistant:ue}=this.aiNativeConfigService.capabilities;ue&&(o.ComponentRegistryImpl.addLayoutModule(this.appConfig.layoutConfig,y.AI_CHAT_VIEW_ID,y.AI_CHAT_CONTAINER_ID),o.ComponentRegistryImpl.addLayoutModule(this.appConfig.layoutConfig,s.DESIGN_MENU_BAR_RIGHT,y.AI_CHAT_LOGO_AVATAR_ID),this.chatProxyService.registerDefaultAgent(),this.chatInternalService.init(),await this.chatManagerService.init())}registerEditorExtensionContribution(ue){const{supportsInlineChat:te,supportsInlineCompletion:fe,supportsProblemFix:Ie,supportsCodeAction:Me}=this.aiNativeConfigService.capabilities;ue(Y.InlineDiffController.ID,new c.SyncDescriptor(Y.InlineDiffController,[this.injector]),E.EditorContributionInstantiation.Lazy),Me&&ue(me.SumiLightBulbWidget.ID,me.SumiLightBulbWidget,E.EditorContributionInstantiation.Lazy),te&&(ue($.InlineChatEditorController.ID,new c.SyncDescriptor($.InlineChatEditorController,[this.injector]),E.EditorContributionInstantiation.BeforeFirstInteraction),this.inlineInputService.getInteractiveInputHandler()&&(ue(X.InlineHintController.ID,new c.SyncDescriptor(X.InlineHintController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender),ue(oe.InlineInputController.ID,new c.SyncDescriptor(oe.InlineInputController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender))),fe&&(ue(F.IntelligentCompletionsController.ID,new c.SyncDescriptor(F.IntelligentCompletionsController,[this.injector]),E.EditorContributionInstantiation.Eager),ue(M.InlineCompletionsController.ID,new c.SyncDescriptor(M.InlineCompletionsController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender)),Ie&&ue(L.ProblemFixController.ID,new c.SyncDescriptor(L.ProblemFixController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender)}onReconnect(){const{supportsMCP:ue}=this.aiNativeConfigService.capabilities;ue&&this.initMCPServers()}onDidStart(){(0,_.runWhenIdle)(()=>{const{supportsRenameSuggestions:ue,supportsInlineChat:te,supportsMCP:fe,supportsCustomLLMSettings:Ie}=this.aiNativeConfigService.capabilities,Me=this.preferenceService.getValid(o.AINativeSettingSectionsId.ChatVisibleType);Me==="always"?this.commandService.executeCommand(a.AI_CHAT_VISIBLE.id,!0):Me==="never"&&this.commandService.executeCommand(a.AI_CHAT_VISIBLE.id,!1),ue&&this.renameSingleHandler.load(),te&&this.codeActionSingleHandler.load(),Ie&&(this.preferenceService.onSpecificPreferenceChange(o.AINativeSettingSectionsId.LLMModelSelection,Be=>{const Pe=this.getModelByName(Be.newValue),we=Pe?Object.keys(Pe):[],_e=we.length?we[0]:"",Ne=this.preferenceSchemaProvider.getPreferenceProperty(o.AINativeSettingSectionsId.ModelID);this.preferenceSchemaProvider.setSchema({properties:{[o.AINativeSettingSectionsId.ModelID]:{...Ne,default:_e,defaultValue:_e,enum:we.length?we:void 0}}},!0),this.preferenceService.set(o.AINativeSettingSectionsId.ModelID,_e,Be.scope),this.preferenceSettings.setEnumLabels(o.AINativeSettingSectionsId.ModelID,we.reduce((Te,We)=>({...Te,[We]:We}),{}))}),this.preferenceService.onSpecificPreferenceChange(o.AINativeSettingSectionsId.ModelID,Be=>{const Pe=this.preferenceService.get(o.AINativeSettingSectionsId.LLMModelSelection);if(!Pe)return;const we=this.getModelByName(Pe);we&&we[Be.newValue]&&(this.preferenceService.set(o.AINativeSettingSectionsId.MaxTokens,we[Be.newValue].maxTokens,Be.scope),this.preferenceService.set(o.AINativeSettingSectionsId.ContextWindow,we[Be.newValue].contextWindow,Be.scope))})),fe&&this.initMCPServers()})}async initMCPServers(){var ue;const te=await this.storageProvider(_.STORAGE_NAMESPACE.CHAT);let fe=te.get(b.MCPServersEnabledKey,[y.BUILTIN_MCP_SERVER_NAME]);const Ie=this.preferenceService.get(o.AINativeSettingSectionsId.MCPServers,[]);let Me=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0);if(Me.scope===_.PreferenceScope.Default&&Ie.length>0){const Pe={mcpServers:{}},we=new Set([y.BUILTIN_MCP_SERVER_NAME]);Ie.forEach(_e=>{_e.type===A.MCP_SERVER_TYPE.SSE?Pe.mcpServers[_e.name]={url:_e.serverHost}:_e.type===A.MCP_SERVER_TYPE.STDIO&&(Pe.mcpServers[_e.name]={command:_e.command,args:_e.args,env:_e.env}),_e.enabled&&we.add(_e.name)}),await this.preferenceService.set("mcp",Pe,_.PreferenceScope.Workspace),Me=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0),fe=Array.from(we),te.set(b.MCPServersEnabledKey,fe)}const Be=(ue=Me.value)===null||ue===void 0?void 0:ue.mcpServers;if(this.sumiMCPServerBackendProxy.$initBuiltinMCPServer(fe.includes(y.BUILTIN_MCP_SERVER_NAME)),Be&&Object.keys(Be).length>0){const Pe=(await Promise.all(Object.keys(Be).map(async we=>await this.mcpConfigService.getServerConfigByName(we)))).filter(we=>we!==void 0);await this.sumiMCPServerBackendProxy.$initExternalMCPServers(Pe)}this.mcpConfigService.fireMCPServersChange(!0)}getModelByName(ue){switch(ue){case"deepseek":return y.deepSeekModels;case"anthropic":return y.anthropicModels;case"openai":return y.openAiNativeModels;default:return}}registerFeature(){this.contributions.getContributions().forEach(ue=>{var te,fe,Ie,Me,Be,Pe,we,_e,Ne;(te=ue.registerInlineChatFeature)===null||te===void 0||te.call(ue,this.inlineChatFeatureRegistry),(fe=ue.registerChatFeature)===null||fe===void 0||fe.call(ue,this.chatFeatureRegistry),(Ie=ue.registerResolveConflictFeature)===null||Ie===void 0||Ie.call(ue,this.resolveConflictRegistry),(Me=ue.registerRenameProvider)===null||Me===void 0||Me.call(ue,this.renameCandidatesProviderRegistry),(Be=ue.registerChatRender)===null||Be===void 0||Be.call(ue,this.chatRenderRegistry),(Pe=ue.registerTerminalProvider)===null||Pe===void 0||Pe.call(ue,this.terminalProviderRegistry),(we=ue.registerIntelligentCompletionFeature)===null||we===void 0||we.call(ue,this.intelligentCompletionsRegistry),(_e=ue.registerProblemFixFeature)===null||_e===void 0||_e.call(ue,this.problemFixProviderRegistry),(Ne=ue.registerChatAgentPromptProvider)===null||Ne===void 0||Ne.call(ue)}),this.mcpServerContributions.getContributions().forEach(ue=>{ue.registerMCPServer(this.mcpServerRegistry)})}registerSetting(ue){ue.registerSettingGroup({id:o.AI_NATIVE_SETTING_GROUP_ID,title:_.AI_NATIVE_SETTING_GROUP_TITLE,iconClass:(0,o.getIcon)("magic-wand")}),ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.chat.title"),preferences:[{id:o.AINativeSettingSectionsId.ChatVisibleType,localized:"preference.ai.native.chat.visible.type"}]}),ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.interface.quick.title"),preferences:[{id:o.AINativeSettingSectionsId.InterfaceQuickNavigationEnabled,localized:"preference.ai.native.interface.quick.navigation"}]}),this.aiNativeConfigService.capabilities.supportsInlineCompletion&&(ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.intelligentCompletions.title"),preferences:[{id:o.AINativeSettingSectionsId.IntelligentCompletionsCacheEnabled,localized:"preference.ai.native.intelligentCompletions.cache.enabled"},{id:o.AINativeSettingSectionsId.IntelligentCompletionsDebounceTime,localized:"preference.ai.native.intelligentCompletions.debounceTime"},{id:o.AINativeSettingSectionsId.IntelligentCompletionsPromptEngineeringEnabled,localized:"preference.ai.native.intelligentCompletions.promptEngineering.enabled"},{id:o.AINativeSettingSectionsId.IntelligentCompletionsAlwaysVisible,localized:"preference.ai.native.intelligentCompletions.alwaysVisible"}]}),ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.codeEdits.title"),preferences:[{id:o.AINativeSettingSectionsId.CodeEditsLintErrors,localized:"preference.ai.native.codeEdits.lintErrors"},{id:o.AINativeSettingSectionsId.CodeEditsLineChange,localized:"preference.ai.native.codeEdits.lineChange"},{id:o.AINativeSettingSectionsId.CodeEditsTyping,localized:"preference.ai.native.codeEdits.typing"},{id:o.AINativeSettingSectionsId.CodeEditsRenderType,localized:"preference.ai.native.codeEdits.renderType"},{id:o.AINativeSettingSectionsId.SystemPrompt,localized:"preference.ai.native.chat.system.prompt"}]})),this.aiNativeConfigService.capabilities.supportsCustomLLMSettings&&ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.llm.apiSettings.title"),preferences:[{id:o.AINativeSettingSectionsId.LLMModelSelection,localized:"preference.ai.native.llm.model.selection"},{id:o.AINativeSettingSectionsId.ModelID,localized:"preference.ai.native.llm.model.id"},{id:o.AINativeSettingSectionsId.DeepseekApiKey,localized:"preference.ai.native.deepseek.apiKey"},{id:o.AINativeSettingSectionsId.AnthropicApiKey,localized:"preference.ai.native.anthropic.apiKey"},{id:o.AINativeSettingSectionsId.OpenaiApiKey,localized:"preference.ai.native.openai.apiKey"},{id:o.AINativeSettingSectionsId.OpenaiBaseURL,localized:"preference.ai.native.openai.baseURL"},{id:o.AINativeSettingSectionsId.MaxTokens,localized:"preference.ai.native.maxTokens"},{id:o.AINativeSettingSectionsId.ContextWindow,localized:"preference.ai.native.contextWindow"}]}),this.aiNativeConfigService.capabilities.supportsMCP&&ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.mcp.settings.title"),preferences:[{id:o.AINativeSettingSectionsId.MCPServers,localized:"preference.ai.native.mcp.servers"},{id:o.AINativeSettingSectionsId.TerminalAutoRun,localized:"ai.native.terminal.autorun"}]}),this.aiNativeConfigService.capabilities.supportsInlineChat&&ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.inlineChat.title"),preferences:[{id:o.AINativeSettingSectionsId.InlineChatAutoVisible,localized:"preference.ai.native.inlineChat.auto.visible"},{id:o.AINativeSettingSectionsId.InlineChatCodeActionEnabled,localized:"preference.ai.native.inlineChat.codeAction.enabled"},{id:o.AINativeSettingSectionsId.InlineDiffPreviewMode,localized:"preference.ai.native.inlineDiff.preview.mode"}]})}registerEditorFeature(ue){ue.registerEditorFeatureContribution({contribute:te=>{const{monacoEditor:fe}=te;return this.codeActionSingleHandler.mountEditor(te.monacoEditor),fe.onDidScrollChange(()=>{this.ctxMenuRenderer.visible&&this.ctxMenuRenderer.hide(!0)})}})}registerEditorComponent(ue){ue.registerEditorSideWidget({id:t.INLINE_DIFF_MANAGER_WIDGET_ID,component:K.InlineDiffManager,displaysOnResource:te=>{var fe;return!!(this.aiNativeConfigService.capabilities.supportsMCP&&(!((fe=this.applyService.getUriCodeBlocks(te.uri))===null||fe===void 0)&&fe.filter(Ie=>Ie.status==="pending").length))}})}registerCommands(ue){ue.registerCommand(a.AI_INLINE_CHAT_VISIBLE,{execute:te=>{this.aiInlineChatService._onInlineChatVisible.fire(te)}}),ue.registerCommand(a.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE,{execute:async te=>{var fe;if(!te){this.inlineInputService.hide();return}this.commandService.executeCommand(a.AI_INLINE_CHAT_VISIBLE.id,!1);const Ie=this.workbenchEditorService.currentCodeEditor;if(!Ie)return;const Me=Ie.monacoEditor.getPosition();if(!Me)return;const Be=Ie.monacoEditor.getSelection();if(Me?((fe=Ie.monacoEditor.getModel())===null||fe===void 0?void 0:fe.getLineLength(Me.lineNumber))===0:!1){this.inlineInputService.visibleByPosition(Me);return}if(Be&&!Be.isEmpty()){this.inlineInputService.visibleBySelection(Be);return}this.inlineInputService.visibleByNearestCodeBlock(Me,Ie.monacoEditor)}}),ue.registerCommand(a.AI_INLINE_CHAT_INTERACTIVE_INPUT_CANCEL,{execute:()=>{var te;const fe=this.workbenchEditorService.currentCodeEditor;fe&&((te=oe.InlineInputController.get(fe.monacoEditor))===null||te===void 0||te.cancelToken())}}),ue.registerCommand(a.AI_INLINE_COMPLETION_REPORTER,{execute:(te,fe,Ie,Me)=>{this.aiCompletionsService.report({sessionId:fe,accept:Ie,relationId:te,code:Me})}}),ue.registerCommand(a.AI_CHAT_VISIBLE,{execute:te=>{this.layoutService.toggleSlot(y.AI_CHAT_VIEW_ID,(0,_.isUndefined)(te)?!0:te)}}),ue.registerCommand(a.AI_INLINE_COMPLETION_VISIBLE,{execute:async te=>{te||(this.aiCompletionsService.hideStatusBarItem(),this.aiInlineCompletionsProvider.setVisibleCompletion(!1),this.aiInlineCompletionsProvider.cancelRequest())}}),ue.registerCommand(a.AI_INLINE_DIFF_PARTIAL_EDIT,{execute:te=>{this.inlineStreamDiffService.launchAcceptDiscardPartialEdit(te)}}),ue.afterExecuteCommand(f.HideInlineCompletion.ID,()=>{this.commandService.executeCommand(a.AI_INLINE_COMPLETION_VISIBLE.id,!1)})}registerRenderer(ue){this.designLayoutConfig.supportExternalChatPanel?ue.registerSlotRenderer(y.AI_CHAT_VIEW_ID,W.AIChatTabRendererWithTab):ue.registerSlotRenderer(y.AI_CHAT_VIEW_ID,W.AIChatTabRenderer),this.designLayoutConfig.useMergeRightWithLeftPanel&&(ue.registerSlotRenderer(o.SlotLocation.left,W.AILeftTabRenderer),ue.registerSlotRenderer(o.SlotLocation.right,W.AIRightTabRenderer))}registerComponent(ue){ue.register(y.AI_CHAT_CONTAINER_ID,[],{component:R.AIChatView,title:(0,o.localize)("aiNative.chat.ai.assistant.name"),iconClass:(0,o.getIcon)("magic-wand"),containerId:y.AI_CHAT_CONTAINER_ID}),ue.register(y.AI_MENU_BAR_DEBUG_TOOLBAR,{id:y.AI_MENU_BAR_DEBUG_TOOLBAR,component:U.AIRunToolbar}),ue.register(y.AI_CHAT_LOGO_AVATAR_ID,{id:y.AI_CHAT_LOGO_AVATAR_ID,component:j.AIChatLogoAvatar})}registerKeybindings(ue){this.aiNativeConfigService.capabilities.supportsInlineChat&&(ue.registerKeybinding({command:a.AI_INLINE_CHAT_VISIBLE.id,keybinding:"ctrlcmd+i",when:"editorTextFocus",args:!0,priority:0},o.KeybindingScope.USER),ue.registerKeybinding({command:a.AI_INLINE_CHAT_VISIBLE.id,keybinding:"esc",args:!1,when:`editorFocus && ${p.InlineChatIsVisible.raw}`}),this.inlineInputService.getInteractiveInputHandler()&&(ue.registerKeybinding({command:a.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:this.aiNativeConfigService.inlineChat.inputKeybinding,args:!0,priority:0,when:`editorFocus && (${p.InlineChatIsVisible.raw} || inlineSuggestionVisible)`},o.KeybindingScope.USER),ue.registerKeybinding({command:a.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:"esc",args:!1,priority:0,when:`editorFocus && ${p.InlineInputWidgetIsVisible.raw}`}),ue.registerKeybinding({command:a.AI_INLINE_CHAT_INTERACTIVE_INPUT_CANCEL.id,keybinding:"esc",priority:1,when:`editorFocus && ${p.InlineInputWidgetIsStreaming.raw}`}),ue.registerKeybinding({command:a.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:this.aiNativeConfigService.inlineChat.inputKeybinding,args:!0,priority:0,when:`editorFocus && ${p.InlineHintWidgetIsVisible.raw} && ${p.InlineChatIsVisible.not}`},o.KeybindingScope.USER))),ue.registerKeybinding({command:a.AI_INLINE_DIFF_PARTIAL_EDIT.id,keybinding:"ctrl+y",args:!0,priority:100,when:`editorTextFocus && ${p.InlineDiffPartialEditsIsVisible.raw}`}),ue.registerKeybinding({command:a.AI_INLINE_DIFF_PARTIAL_EDIT.id,keybinding:"ctrl+n",args:!1,priority:100,when:`editorTextFocus && ${p.InlineDiffPartialEditsIsVisible.raw}`})}};t.AINativeBrowserContribution=q,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],q.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],q.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(m.IBrowserCtxMenu),n.__metadata("design:type",m.IBrowserCtxMenu)],q.prototype,"ctxMenuRenderer",void 0),n.__decorate([(0,r.Autowired)(Z.AINativeCoreContribution),n.__metadata("design:type",Object)],q.prototype,"contributions",void 0),n.__decorate([(0,r.Autowired)(Z.MCPServerContribution),n.__metadata("design:type",Object)],q.prototype,"mcpServerContributions",void 0),n.__decorate([(0,r.Autowired)(Z.TokenMCPServerRegistry),n.__metadata("design:type",Object)],q.prototype,"mcpServerRegistry",void 0),n.__decorate([(0,r.Autowired)(_.InlineChatFeatureRegistryToken),n.__metadata("design:type",V.InlineChatFeatureRegistry)],q.prototype,"inlineChatFeatureRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],q.prototype,"chatFeatureRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ChatRenderRegistryToken),n.__metadata("design:type",Object)],q.prototype,"chatRenderRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ResolveConflictRegistryToken),n.__metadata("design:type",Object)],q.prototype,"resolveConflictRegistry",void 0),n.__decorate([(0,r.Autowired)(_.RenameCandidatesProviderRegistryToken),n.__metadata("design:type",Object)],q.prototype,"renameCandidatesProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(_.TerminalRegistryToken),n.__metadata("design:type",Object)],q.prototype,"terminalProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(_.IntelligentCompletionsRegistryToken),n.__metadata("design:type",Object)],q.prototype,"intelligentCompletionsRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ProblemFixRegistryToken),n.__metadata("design:type",Object)],q.prototype,"problemFixProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],q.prototype,"aiNativeConfigService",void 0),n.__decorate([(0,r.Autowired)(v.DesignLayoutConfig),n.__metadata("design:type",v.DesignLayoutConfig)],q.prototype,"designLayoutConfig",void 0),n.__decorate([(0,r.Autowired)(k.AICompletionsService),n.__metadata("design:type",k.AICompletionsService)],q.prototype,"aiCompletionsService",void 0),n.__decorate([(0,r.Autowired)(O.AIInlineCompletionsProvider),n.__metadata("design:type",O.AIInlineCompletionsProvider)],q.prototype,"aiInlineCompletionsProvider",void 0),n.__decorate([(0,r.Autowired)(_.CommandService),n.__metadata("design:type",Object)],q.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceSchemaProvider),n.__metadata("design:type",o.PreferenceSchemaProvider)],q.prototype,"preferenceSchemaProvider",void 0),n.__decorate([(0,r.Autowired)(o.IPreferenceSettingsService),n.__metadata("design:type",Object)],q.prototype,"preferenceSettings",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],q.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(u.IMainLayoutService),n.__metadata("design:type",Object)],q.prototype,"layoutService",void 0),n.__decorate([(0,r.Autowired)(y.ChatProxyServiceToken),n.__metadata("design:type",w.ChatProxyService)],q.prototype,"chatProxyService",void 0),n.__decorate([(0,r.Autowired)(o.IAIInlineChatService),n.__metadata("design:type",H.InlineChatService)],q.prototype,"aiInlineChatService",void 0),n.__decorate([(0,r.Autowired)(ie.InlineInputService),n.__metadata("design:type",ie.InlineInputService)],q.prototype,"inlineInputService",void 0),n.__decorate([(0,r.Autowired)(he.InlineStreamDiffService),n.__metadata("design:type",he.InlineStreamDiffService)],q.prototype,"inlineStreamDiffService",void 0),n.__decorate([(0,r.Autowired)(B.RenameSingleHandler),n.__metadata("design:type",B.RenameSingleHandler)],q.prototype,"renameSingleHandler",void 0),n.__decorate([(0,r.Autowired)(P.CodeActionSingleHandler),n.__metadata("design:type",P.CodeActionSingleHandler)],q.prototype,"codeActionSingleHandler",void 0),n.__decorate([(0,r.Autowired)(y.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],q.prototype,"sumiMCPServerBackendProxy",void 0),n.__decorate([(0,r.Autowired)(_.MCPConfigServiceToken),n.__metadata("design:type",G.MCPConfigService)],q.prototype,"mcpConfigService",void 0),n.__decorate([(0,r.Autowired)(g.WorkbenchEditorService),n.__metadata("design:type",h.WorkbenchEditorServiceImpl)],q.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(y.IChatManagerService),n.__metadata("design:type",D.ChatManagerService)],q.prototype,"chatManagerService",void 0),n.__decorate([(0,r.Autowired)(y.IChatInternalService),n.__metadata("design:type",T.ChatInternalService)],q.prototype,"chatInternalService",void 0),n.__decorate([(0,r.Autowired)(Q.BaseApplyService),n.__metadata("design:type",Q.BaseApplyService)],q.prototype,"applyService",void 0),n.__decorate([(0,r.Autowired)(_.StorageProvider),n.__metadata("design:type",Function)],q.prototype,"storageProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",S.ChatEditSchemeDocumentProvider)],q.prototype,"chatEditResourceProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",I.ChatMultiDiffResolver)],q.prototype,"chatMultiDiffResolver",void 0),t.AINativeBrowserContribution=q=n.__decorate([(0,o.Domain)(o.ClientAppContribution,l.BrowserEditorContribution,o.CommandContribution,d.SettingContribution,o.KeybindingContribution,o.ComponentContribution,o.SlotRendererContribution,o.MonacoContribution,l.MultiDiffSourceContribution),n.__metadata("design:paramtypes",[])],q)},96366:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApplyService=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(92323),p=e(57517),v=e(20868),m=e(79865),_=e(19413),s=e(73974),g=e(51081);function l(u){return u.title.toLowerCase().includes("all")}let h=class extends s.BaseApplyService{async postApplyHandler(d){const E=d.getModel();if(!E)return Promise.resolve();const f=m.languageFeaturesService.codeActionProvider.ordered(E);if(!f)return Promise.resolve();const[c]=f,y=E.getFullModelRange(),b={trigger:v.CodeActionTriggerType.Auto},A=new o.CancellationTokenSource,S=await c.provideCodeActions(E,y,b,A.token),D=S?.actions.filter(l)||[];if(D.length===0)return Promise.resolve();await Promise.allSettled(D.map(async I=>{if(I.command)try{await this.commandService.executeCommand(I.command.id,...I.command.arguments||[])}catch{}}))}async doApply(d){const E=new o.URI(o.path.join(this.appConfig.workspaceDir,d.relativePath)),c=(await this.modelService.createModelReference(E)).instance.getMonacoModel().getValue();return{stream:await this.aiBackService.requestStream(`Merge all changes from the <update> snippet into the <code> below.
31590
+ ${JSON.stringify(r,null,2)}`);const a=n[o]();return new Language(INTERNAL,a)})}}class LookaheadIterable{constructor(t,e,n){assertInternal(t),this[0]=e,this.language=n}get currentTypeId(){return C._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){C._ts_lookahead_iterator_delete(this[0]),this[0]=0}resetState(t){return C._ts_lookahead_iterator_reset_state(this[0],t)}reset(t,e){return!!C._ts_lookahead_iterator_reset(this[0],t[0],e)&&(this.language=t,!0)}[Symbol.iterator](){const t=this;return{next:()=>C._ts_lookahead_iterator_next(t[0])?{done:!1,value:t.currentType}:{done:!0,value:""}}}}class Query{constructor(t,e,n,r,o,a,p,v){assertInternal(t),this[0]=e,this.captureNames=n,this.textPredicates=r,this.predicates=o,this.setProperties=a,this.assertedProperties=p,this.refutedProperties=v,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(t,{startPosition:e=ZERO_POINT,endPosition:n=ZERO_POINT,startIndex:r=0,endIndex:o=0,matchLimit:a=4294967295,maxStartDepth:p=4294967295}={}){if(typeof a!="number")throw new Error("Arguments must be numbers");marshalNode(t),C._ts_query_matches_wasm(this[0],t.tree[0],e.row,e.column,n.row,n.column,r,o,a,p);const v=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),_=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),s=new Array(v);this.exceededMatchLimit=!!_;let g=0,l=m;for(let h=0;h<v;h++){const u=getValue(l,"i32");l+=SIZE_OF_INT;const d=getValue(l,"i32");l+=SIZE_OF_INT;const E=new Array(d);if(l=unmarshalCaptures(this,t.tree,l,E),this.textPredicates[u].every(f=>f(E))){s[g]={pattern:u,captures:E};const f=this.setProperties[u];f&&(s[g].setProperties=f);const c=this.assertedProperties[u];c&&(s[g].assertedProperties=c);const y=this.refutedProperties[u];y&&(s[g].refutedProperties=y),g++}}return s.length=g,C._free(m),s}captures(t,{startPosition:e=ZERO_POINT,endPosition:n=ZERO_POINT,startIndex:r=0,endIndex:o=0,matchLimit:a=4294967295,maxStartDepth:p=4294967295}={}){if(typeof a!="number")throw new Error("Arguments must be numbers");marshalNode(t),C._ts_query_captures_wasm(this[0],t.tree[0],e.row,e.column,n.row,n.column,r,o,a,p);const v=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),_=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),s=[];this.exceededMatchLimit=!!_;const g=[];let l=m;for(let h=0;h<v;h++){const u=getValue(l,"i32");l+=SIZE_OF_INT;const d=getValue(l,"i32");l+=SIZE_OF_INT;const E=getValue(l,"i32");if(l+=SIZE_OF_INT,g.length=d,l=unmarshalCaptures(this,t.tree,l,g),this.textPredicates[u].every(f=>f(g))){const f=g[E],c=this.setProperties[u];c&&(f.setProperties=c);const y=this.assertedProperties[u];y&&(f.assertedProperties=y);const b=this.refutedProperties[u];b&&(f.refutedProperties=b),s.push(f)}}return C._free(m),s}predicatesForPattern(t){return this.predicates[t]}disableCapture(t){const e=lengthBytesUTF8(t),n=C._malloc(e+1);stringToUTF8(t,n,e+1),C._ts_query_disable_capture(this[0],n,e),C._free(n)}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(x,t,e){const n=e-t;let r=x.textCallback(t,null,e);for(t+=r.length;t<e;){const o=x.textCallback(t,null,e);if(!(o&&o.length>0))break;t+=o.length,r+=o}return t>e&&(r=r.slice(0,n)),r}function unmarshalCaptures(x,t,e,n){for(let r=0,o=n.length;r<o;r++){const a=getValue(e,"i32"),p=unmarshalNode(t,e+=SIZE_OF_INT);e+=SIZE_OF_NODE,n[r]={name:x.captureNames[a],node:p}}return e}function assertInternal(x){if(x!==INTERNAL)throw new Error("Illegal constructor")}function isPoint(x){return x&&typeof x.row=="number"&&typeof x.column=="number"}function marshalNode(x){let t=TRANSFER_BUFFER;setValue(t,x.id,"i32"),t+=SIZE_OF_INT,setValue(t,x.startIndex,"i32"),t+=SIZE_OF_INT,setValue(t,x.startPosition.row,"i32"),t+=SIZE_OF_INT,setValue(t,x.startPosition.column,"i32"),t+=SIZE_OF_INT,setValue(t,x[0],"i32")}function unmarshalNode(x,t=TRANSFER_BUFFER){const e=getValue(t,"i32");if(e===0)return null;const n=getValue(t+=SIZE_OF_INT,"i32"),r=getValue(t+=SIZE_OF_INT,"i32"),o=getValue(t+=SIZE_OF_INT,"i32"),a=getValue(t+=SIZE_OF_INT,"i32"),p=new Node(INTERNAL,x);return p.id=e,p.startIndex=n,p.startPosition={row:r,column:o},p[0]=a,p}function marshalTreeCursor(x,t=TRANSFER_BUFFER){setValue(t+0*SIZE_OF_INT,x[0],"i32"),setValue(t+1*SIZE_OF_INT,x[1],"i32"),setValue(t+2*SIZE_OF_INT,x[2],"i32"),setValue(t+3*SIZE_OF_INT,x[3],"i32")}function unmarshalTreeCursor(x){x[0]=getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),x[1]=getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),x[2]=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),x[3]=getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(x,t){setValue(x,t.row,"i32"),setValue(x+SIZE_OF_INT,t.column,"i32")}function unmarshalPoint(x){return{row:getValue(x,"i32")>>>0,column:getValue(x+SIZE_OF_INT,"i32")>>>0}}function marshalRange(x,t){marshalPoint(x,t.startPosition),marshalPoint(x+=SIZE_OF_POINT,t.endPosition),setValue(x+=SIZE_OF_POINT,t.startIndex,"i32"),setValue(x+=SIZE_OF_INT,t.endIndex,"i32"),x+=SIZE_OF_INT}function unmarshalRange(x){const t={};return t.startPosition=unmarshalPoint(x),x+=SIZE_OF_POINT,t.endPosition=unmarshalPoint(x),x+=SIZE_OF_POINT,t.startIndex=getValue(x,"i32")>>>0,x+=SIZE_OF_INT,t.endIndex=getValue(x,"i32")>>>0,t}function marshalEdit(x){let t=TRANSFER_BUFFER;marshalPoint(t,x.startPosition),t+=SIZE_OF_POINT,marshalPoint(t,x.oldEndPosition),t+=SIZE_OF_POINT,marshalPoint(t,x.newEndPosition),t+=SIZE_OF_POINT,setValue(t,x.startIndex,"i32"),t+=SIZE_OF_INT,setValue(t,x.oldEndIndex,"i32"),t+=SIZE_OF_INT,setValue(t,x.newEndIndex,"i32"),t+=SIZE_OF_INT}for(const x of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype,x,{value:ParserImpl.prototype[x],enumerable:!1,writable:!1});Parser.Language=Language,Module.onRuntimeInitialized=()=>{ParserImpl.init(),resolveInitPromise()}}))}}return Parser}();module.exports=TreeSitter},52730:(x,t,e)=>{"use strict";var n=e(80705),r=e(14834),o=e(28498),a=e(79818),p=e(69336),v=a("Object.prototype.toString"),m=e(51913)(),_=typeof globalThis>"u"?e.g:globalThis,s=r(),g=a("String.prototype.slice"),l=Object.getPrototypeOf,h=a("Array.prototype.indexOf",!0)||function(c,y){for(var b=0;b<c.length;b+=1)if(c[b]===y)return b;return-1},u={__proto__:null};m&&p&&l?n(s,function(f){var c=new _[f];if(Symbol.toStringTag in c){var y=l(c),b=p(y,Symbol.toStringTag);if(!b){var A=l(y);b=p(A,Symbol.toStringTag)}u["$"+f]=o(b.get)}}):n(s,function(f){var c=new _[f],y=c.slice||c.set;y&&(u["$"+f]=o(y))});var d=function(c){var y=!1;return n(u,function(b,A){if(!y)try{"$"+b(c)===A&&(y=g(A,1))}catch{}}),y},E=function(c){var y=!1;return n(u,function(b,A){if(!y)try{b(c),y=g(A,1)}catch{}}),y};x.exports=function(c){if(!c||typeof c!="object")return!1;if(!m){var y=g(v(c),8,-1);return h(s,y)>-1?y:y!=="Object"?!1:E(c)}return p?d(c):null}},97442:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ZodError=t.quotelessJson=t.ZodIssueCode=void 0;const n=e(94705);t.ZodIssueCode=n.util.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"]);const r=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:");t.quotelessJson=r;class o extends Error{get errors(){return this.issues}constructor(p){super(),this.issues=[],this.addIssue=m=>{this.issues=[...this.issues,m]},this.addIssues=(m=[])=>{this.issues=[...this.issues,...m]};const v=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,v):this.__proto__=v,this.name="ZodError",this.issues=p}format(p){const v=p||function(s){return s.message},m={_errors:[]},_=s=>{for(const g of s.issues)if(g.code==="invalid_union")g.unionErrors.map(_);else if(g.code==="invalid_return_type")_(g.returnTypeError);else if(g.code==="invalid_arguments")_(g.argumentsError);else if(g.path.length===0)m._errors.push(v(g));else{let l=m,h=0;for(;h<g.path.length;){const u=g.path[h];h===g.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(v(g))):l[u]=l[u]||{_errors:[]},l=l[u],h++}}};return _(this),m}static assert(p){if(!(p instanceof o))throw new Error(`Not a ZodError: ${p}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,n.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(p=v=>v.message){const v={},m=[];for(const _ of this.issues)_.path.length>0?(v[_.path[0]]=v[_.path[0]]||[],v[_.path[0]].push(p(_))):m.push(p(_));return{formErrors:m,fieldErrors:v}}get formErrors(){return this.flatten()}}t.ZodError=o,o.create=a=>new o(a)},30548:function(x,t,e){"use strict";var n=this&&this.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorMap=t.setErrorMap=t.defaultErrorMap=void 0;const r=n(e(28412));t.defaultErrorMap=r.default;let o=r.default;function a(v){o=v}t.setErrorMap=a;function p(){return o}t.getErrorMap=p},86340:function(x,t,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(o,a,p,v){v===void 0&&(v=p);var m=Object.getOwnPropertyDescriptor(a,p);(!m||("get"in m?!a.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return a[p]}}),Object.defineProperty(o,v,m)}:function(o,a,p,v){v===void 0&&(v=p),o[v]=a[p]}),r=this&&this.__exportStar||function(o,a){for(var p in o)p!=="default"&&!Object.prototype.hasOwnProperty.call(a,p)&&n(a,o,p)};Object.defineProperty(t,"__esModule",{value:!0}),r(e(30548),t),r(e(66258),t),r(e(29201),t),r(e(94705),t),r(e(75226),t),r(e(97442),t)},15759:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errorUtil=void 0;var e;(function(n){n.errToObj=r=>typeof r=="string"?{message:r}:r||{},n.toString=r=>typeof r=="string"?r:r?.message})(e||(t.errorUtil=e={}))},66258:function(x,t,e){"use strict";var n=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=t.isValid=t.isDirty=t.isAborted=t.OK=t.DIRTY=t.INVALID=t.ParseStatus=t.addIssueToContext=t.EMPTY_PATH=t.makeIssue=void 0;const r=e(30548),o=n(e(28412)),a=u=>{const{data:d,path:E,errorMaps:f,issueData:c}=u,y=[...E,...c.path||[]],b={...c,path:y};if(c.message!==void 0)return{...c,path:y,message:c.message};let A="";const S=f.filter(D=>!!D).slice().reverse();for(const D of S)A=D(b,{data:d,defaultError:A}).message;return{...c,path:y,message:A}};t.makeIssue=a,t.EMPTY_PATH=[];function p(u,d){const E=(0,r.getErrorMap)(),f=(0,t.makeIssue)({issueData:d,data:u.data,path:u.path,errorMaps:[u.common.contextualErrorMap,u.schemaErrorMap,E,E===o.default?void 0:o.default].filter(c=>!!c)});u.common.issues.push(f)}t.addIssueToContext=p;class v{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(d,E){const f=[];for(const c of E){if(c.status==="aborted")return t.INVALID;c.status==="dirty"&&d.dirty(),f.push(c.value)}return{status:d.value,value:f}}static async mergeObjectAsync(d,E){const f=[];for(const c of E){const y=await c.key,b=await c.value;f.push({key:y,value:b})}return v.mergeObjectSync(d,f)}static mergeObjectSync(d,E){const f={};for(const c of E){const{key:y,value:b}=c;if(y.status==="aborted"||b.status==="aborted")return t.INVALID;y.status==="dirty"&&d.dirty(),b.status==="dirty"&&d.dirty(),y.value!=="__proto__"&&(typeof b.value<"u"||c.alwaysSet)&&(f[y.value]=b.value)}return{status:d.value,value:f}}}t.ParseStatus=v,t.INVALID=Object.freeze({status:"aborted"});const m=u=>({status:"dirty",value:u});t.DIRTY=m;const _=u=>({status:"valid",value:u});t.OK=_;const s=u=>u.status==="aborted";t.isAborted=s;const g=u=>u.status==="dirty";t.isDirty=g;const l=u=>u.status==="valid";t.isValid=l;const h=u=>typeof Promise<"u"&&u instanceof Promise;t.isAsync=h},29201:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},94705:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getParsedType=t.ZodParsedType=t.objectUtil=t.util=void 0;var e;(function(o){o.assertEqual=m=>m;function a(m){}o.assertIs=a;function p(m){throw new Error}o.assertNever=p,o.arrayToEnum=m=>{const _={};for(const s of m)_[s]=s;return _},o.getValidEnumValues=m=>{const _=o.objectKeys(m).filter(g=>typeof m[m[g]]!="number"),s={};for(const g of _)s[g]=m[g];return o.objectValues(s)},o.objectValues=m=>o.objectKeys(m).map(function(_){return m[_]}),o.objectKeys=typeof Object.keys=="function"?m=>Object.keys(m):m=>{const _=[];for(const s in m)Object.prototype.hasOwnProperty.call(m,s)&&_.push(s);return _},o.find=(m,_)=>{for(const s of m)if(_(s))return s},o.isInteger=typeof Number.isInteger=="function"?m=>Number.isInteger(m):m=>typeof m=="number"&&isFinite(m)&&Math.floor(m)===m;function v(m,_=" | "){return m.map(s=>typeof s=="string"?`'${s}'`:s).join(_)}o.joinValues=v,o.jsonStringifyReplacer=(m,_)=>typeof _=="bigint"?_.toString():_})(e||(t.util=e={}));var n;(function(o){o.mergeShapes=(a,p)=>({...a,...p})})(n||(t.objectUtil=n={})),t.ZodParsedType=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);const r=o=>{switch(typeof o){case"undefined":return t.ZodParsedType.undefined;case"string":return t.ZodParsedType.string;case"number":return isNaN(o)?t.ZodParsedType.nan:t.ZodParsedType.number;case"boolean":return t.ZodParsedType.boolean;case"function":return t.ZodParsedType.function;case"bigint":return t.ZodParsedType.bigint;case"symbol":return t.ZodParsedType.symbol;case"object":return Array.isArray(o)?t.ZodParsedType.array:o===null?t.ZodParsedType.null:o.then&&typeof o.then=="function"&&o.catch&&typeof o.catch=="function"?t.ZodParsedType.promise:typeof Map<"u"&&o instanceof Map?t.ZodParsedType.map:typeof Set<"u"&&o instanceof Set?t.ZodParsedType.set:typeof Date<"u"&&o instanceof Date?t.ZodParsedType.date:t.ZodParsedType.object;default:return t.ZodParsedType.unknown}};t.getParsedType=r},75995:function(x,t,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(v,m,_,s){s===void 0&&(s=_);var g=Object.getOwnPropertyDescriptor(m,_);(!g||("get"in g?!m.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return m[_]}}),Object.defineProperty(v,s,g)}:function(v,m,_,s){s===void 0&&(s=_),v[s]=m[_]}),r=this&&this.__setModuleDefault||(Object.create?function(v,m){Object.defineProperty(v,"default",{enumerable:!0,value:m})}:function(v,m){v.default=m}),o=this&&this.__importStar||function(v){if(v&&v.__esModule)return v;var m={};if(v!=null)for(var _ in v)_!=="default"&&Object.prototype.hasOwnProperty.call(v,_)&&n(m,v,_);return r(m,v),m},a=this&&this.__exportStar||function(v,m){for(var _ in v)_!=="default"&&!Object.prototype.hasOwnProperty.call(m,_)&&n(m,v,_)};Object.defineProperty(t,"__esModule",{value:!0}),t.z=void 0;const p=o(e(86340));t.z=p,a(e(86340),t),t.default=p},28412:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(94705),r=e(97442),o=(a,p)=>{let v;switch(a.code){case r.ZodIssueCode.invalid_type:a.received===n.ZodParsedType.undefined?v="Required":v=`Expected ${a.expected}, received ${a.received}`;break;case r.ZodIssueCode.invalid_literal:v=`Invalid literal value, expected ${JSON.stringify(a.expected,n.util.jsonStringifyReplacer)}`;break;case r.ZodIssueCode.unrecognized_keys:v=`Unrecognized key(s) in object: ${n.util.joinValues(a.keys,", ")}`;break;case r.ZodIssueCode.invalid_union:v="Invalid input";break;case r.ZodIssueCode.invalid_union_discriminator:v=`Invalid discriminator value. Expected ${n.util.joinValues(a.options)}`;break;case r.ZodIssueCode.invalid_enum_value:v=`Invalid enum value. Expected ${n.util.joinValues(a.options)}, received '${a.received}'`;break;case r.ZodIssueCode.invalid_arguments:v="Invalid function arguments";break;case r.ZodIssueCode.invalid_return_type:v="Invalid function return type";break;case r.ZodIssueCode.invalid_date:v="Invalid date";break;case r.ZodIssueCode.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(v=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(v=`${v} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?v=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?v=`Invalid input: must end with "${a.validation.endsWith}"`:n.util.assertNever(a.validation):a.validation!=="regex"?v=`Invalid ${a.validation}`:v="Invalid";break;case r.ZodIssueCode.too_small:a.type==="array"?v=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?v=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?v=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?v=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:v="Invalid input";break;case r.ZodIssueCode.too_big:a.type==="array"?v=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?v=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?v=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?v=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?v=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:v="Invalid input";break;case r.ZodIssueCode.custom:v="Invalid input";break;case r.ZodIssueCode.invalid_intersection_types:v="Intersection results could not be merged";break;case r.ZodIssueCode.not_multiple_of:v=`Number must be a multiple of ${a.multipleOf}`;break;case r.ZodIssueCode.not_finite:v="Number must be finite";break;default:v=p.defaultError,n.util.assertNever(a)}return{message:v}};t.default=o},75226:function(x,t,e){"use strict";var n=this&&this.__classPrivateFieldGet||function(qt,nt,Ft,Jt){if(Ft==="a"&&!Jt)throw new TypeError("Private accessor was defined without a getter");if(typeof nt=="function"?qt!==nt||!Jt:!nt.has(qt))throw new TypeError("Cannot read private member from an object whose class did not declare it");return Ft==="m"?Jt:Ft==="a"?Jt.call(qt):Jt?Jt.value:nt.get(qt)},r=this&&this.__classPrivateFieldSet||function(qt,nt,Ft,Jt,Dn){if(Jt==="m")throw new TypeError("Private method is not writable");if(Jt==="a"&&!Dn)throw new TypeError("Private accessor was defined without a setter");if(typeof nt=="function"?qt!==nt||!Dn:!nt.has(qt))throw new TypeError("Cannot write private member to an object whose class did not declare it");return Jt==="a"?Dn.call(qt,Ft):Dn?Dn.value=Ft:nt.set(qt,Ft),Ft},o,a;Object.defineProperty(t,"__esModule",{value:!0}),t.boolean=t.bigint=t.array=t.any=t.coerce=t.ZodFirstPartyTypeKind=t.late=t.ZodSchema=t.Schema=t.custom=t.ZodReadonly=t.ZodPipeline=t.ZodBranded=t.BRAND=t.ZodNaN=t.ZodCatch=t.ZodDefault=t.ZodNullable=t.ZodOptional=t.ZodTransformer=t.ZodEffects=t.ZodPromise=t.ZodNativeEnum=t.ZodEnum=t.ZodLiteral=t.ZodLazy=t.ZodFunction=t.ZodSet=t.ZodMap=t.ZodRecord=t.ZodTuple=t.ZodIntersection=t.ZodDiscriminatedUnion=t.ZodUnion=t.ZodObject=t.ZodArray=t.ZodVoid=t.ZodNever=t.ZodUnknown=t.ZodAny=t.ZodNull=t.ZodUndefined=t.ZodSymbol=t.ZodDate=t.ZodBoolean=t.ZodBigInt=t.ZodNumber=t.ZodString=t.datetimeRegex=t.ZodType=void 0,t.NEVER=t.void=t.unknown=t.union=t.undefined=t.tuple=t.transformer=t.symbol=t.string=t.strictObject=t.set=t.record=t.promise=t.preprocess=t.pipeline=t.ostring=t.optional=t.onumber=t.oboolean=t.object=t.number=t.nullable=t.null=t.never=t.nativeEnum=t.nan=t.map=t.literal=t.lazy=t.intersection=t.instanceof=t.function=t.enum=t.effect=t.discriminatedUnion=t.date=void 0;const p=e(30548),v=e(15759),m=e(66258),_=e(94705),s=e(97442);class g{constructor(nt,Ft,Jt,Dn){this._cachedPath=[],this.parent=nt,this.data=Ft,this._path=Jt,this._key=Dn}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}}const l=(qt,nt)=>{if((0,m.isValid)(nt))return{success:!0,data:nt.value};if(!qt.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const Ft=new s.ZodError(qt.common.issues);return this._error=Ft,this._error}}};function h(qt){if(!qt)return{};const{errorMap:nt,invalid_type_error:Ft,required_error:Jt,description:Dn}=qt;if(nt&&(Ft||Jt))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return nt?{errorMap:nt,description:Dn}:{errorMap:(Bi,Mi)=>{var Xi,vi;const{message:Qi}=qt;return Bi.code==="invalid_enum_value"?{message:Qi??Mi.defaultError}:typeof Mi.data>"u"?{message:(Xi=Qi??Jt)!==null&&Xi!==void 0?Xi:Mi.defaultError}:Bi.code!=="invalid_type"?{message:Mi.defaultError}:{message:(vi=Qi??Ft)!==null&&vi!==void 0?vi:Mi.defaultError}},description:Dn}}class u{get description(){return this._def.description}_getType(nt){return(0,_.getParsedType)(nt.data)}_getOrReturnCtx(nt,Ft){return Ft||{common:nt.parent.common,data:nt.data,parsedType:(0,_.getParsedType)(nt.data),schemaErrorMap:this._def.errorMap,path:nt.path,parent:nt.parent}}_processInputParams(nt){return{status:new m.ParseStatus,ctx:{common:nt.parent.common,data:nt.data,parsedType:(0,_.getParsedType)(nt.data),schemaErrorMap:this._def.errorMap,path:nt.path,parent:nt.parent}}}_parseSync(nt){const Ft=this._parse(nt);if((0,m.isAsync)(Ft))throw new Error("Synchronous parse encountered promise.");return Ft}_parseAsync(nt){const Ft=this._parse(nt);return Promise.resolve(Ft)}parse(nt,Ft){const Jt=this.safeParse(nt,Ft);if(Jt.success)return Jt.data;throw Jt.error}safeParse(nt,Ft){var Jt;const Dn={common:{issues:[],async:(Jt=Ft?.async)!==null&&Jt!==void 0?Jt:!1,contextualErrorMap:Ft?.errorMap},path:Ft?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:nt,parsedType:(0,_.getParsedType)(nt)},Fn=this._parseSync({data:nt,path:Dn.path,parent:Dn});return l(Dn,Fn)}"~validate"(nt){var Ft,Jt;const Dn={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:nt,parsedType:(0,_.getParsedType)(nt)};if(!this["~standard"].async)try{const Fn=this._parseSync({data:nt,path:[],parent:Dn});return(0,m.isValid)(Fn)?{value:Fn.value}:{issues:Dn.common.issues}}catch(Fn){!((Jt=(Ft=Fn?.message)===null||Ft===void 0?void 0:Ft.toLowerCase())===null||Jt===void 0)&&Jt.includes("encountered")&&(this["~standard"].async=!0),Dn.common={issues:[],async:!0}}return this._parseAsync({data:nt,path:[],parent:Dn}).then(Fn=>(0,m.isValid)(Fn)?{value:Fn.value}:{issues:Dn.common.issues})}async parseAsync(nt,Ft){const Jt=await this.safeParseAsync(nt,Ft);if(Jt.success)return Jt.data;throw Jt.error}async safeParseAsync(nt,Ft){const Jt={common:{issues:[],contextualErrorMap:Ft?.errorMap,async:!0},path:Ft?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:nt,parsedType:(0,_.getParsedType)(nt)},Dn=this._parse({data:nt,path:Jt.path,parent:Jt}),Fn=await((0,m.isAsync)(Dn)?Dn:Promise.resolve(Dn));return l(Jt,Fn)}refine(nt,Ft){const Jt=Dn=>typeof Ft=="string"||typeof Ft>"u"?{message:Ft}:typeof Ft=="function"?Ft(Dn):Ft;return this._refinement((Dn,Fn)=>{const Bi=nt(Dn),Mi=()=>Fn.addIssue({code:s.ZodIssueCode.custom,...Jt(Dn)});return typeof Promise<"u"&&Bi instanceof Promise?Bi.then(Xi=>Xi?!0:(Mi(),!1)):Bi?!0:(Mi(),!1)})}refinement(nt,Ft){return this._refinement((Jt,Dn)=>nt(Jt)?!0:(Dn.addIssue(typeof Ft=="function"?Ft(Jt,Dn):Ft),!1))}_refinement(nt){return new Ye({schema:this,typeName:At.ZodEffects,effect:{type:"refinement",refinement:nt}})}superRefine(nt){return this._refinement(nt)}constructor(nt){this.spa=this.safeParseAsync,this._def=nt,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:Ft=>this["~validate"](Ft)}}optional(){return Ke.create(this,this._def)}nullable(){return mt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ee.create(this)}promise(){return Ue.create(this,this._def)}or(nt){return fe.create([this,nt],this._def)}and(nt){return Pe.create(this,nt,this._def)}transform(nt){return new Ye({...h(this._def),schema:this,typeName:At.ZodEffects,effect:{type:"transform",transform:nt}})}default(nt){const Ft=typeof nt=="function"?nt:()=>nt;return new _t({...h(this._def),innerType:this,defaultValue:Ft,typeName:At.ZodDefault})}brand(){return new wt({typeName:At.ZodBranded,type:this,...h(this._def)})}catch(nt){const Ft=typeof nt=="function"?nt:()=>nt;return new Mt({...h(this._def),innerType:this,catchValue:Ft,typeName:At.ZodCatch})}describe(nt){const Ft=this.constructor;return new Ft({...this._def,description:nt})}pipe(nt){return st.create(this,nt)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}t.ZodType=u,t.Schema=u,t.ZodSchema=u;const d=/^c[^\s-]{8,}$/i,E=/^[0-9a-z]+$/,f=/^[0-9A-HJKMNP-TV-Z]{26}$/i,c=/^[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,y=/^[a-z0-9_-]{21}$/i,b=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,A=/^[-+]?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)?)??$/,S=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,D="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let I;const w=/^(?:(?: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])$/,T=/^(?:(?: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])$/,R=/^(([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]))$/,P=/^(([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])$/,O=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,M=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,k="((\\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])))",F=new RegExp(`^${k}$`);function L(qt){let nt="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return qt.precision?nt=`${nt}\\.\\d{${qt.precision}}`:qt.precision==null&&(nt=`${nt}(\\.\\d+)?`),nt}function B(qt){return new RegExp(`^${L(qt)}$`)}function U(qt){let nt=`${k}T${L(qt)}`;const Ft=[];return Ft.push(qt.local?"Z?":"Z"),qt.offset&&Ft.push("([+-]\\d{2}:?\\d{2})"),nt=`${nt}(${Ft.join("|")})`,new RegExp(`^${nt}$`)}t.datetimeRegex=U;function W(qt,nt){return!!((nt==="v4"||!nt)&&w.test(qt)||(nt==="v6"||!nt)&&R.test(qt))}function j(qt,nt){if(!b.test(qt))return!1;try{const[Ft]=qt.split("."),Jt=Ft.replace(/-/g,"+").replace(/_/g,"/").padEnd(Ft.length+(4-Ft.length%4)%4,"="),Dn=JSON.parse(atob(Jt));return!(typeof Dn!="object"||Dn===null||!Dn.typ||!Dn.alg||nt&&Dn.alg!==nt)}catch{return!1}}function Q(qt,nt){return!!((nt==="v4"||!nt)&&T.test(qt)||(nt==="v6"||!nt)&&P.test(qt))}class G extends u{_parse(nt){if(this._def.coerce&&(nt.data=String(nt.data)),this._getType(nt)!==_.ZodParsedType.string){const Fn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Fn,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.string,received:Fn.parsedType}),m.INVALID}const Jt=new m.ParseStatus;let Dn;for(const Fn of this._def.checks)if(Fn.kind==="min")nt.data.length<Fn.value&&(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.too_small,minimum:Fn.value,type:"string",inclusive:!0,exact:!1,message:Fn.message}),Jt.dirty());else if(Fn.kind==="max")nt.data.length>Fn.value&&(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.too_big,maximum:Fn.value,type:"string",inclusive:!0,exact:!1,message:Fn.message}),Jt.dirty());else if(Fn.kind==="length"){const Bi=nt.data.length>Fn.value,Mi=nt.data.length<Fn.value;(Bi||Mi)&&(Dn=this._getOrReturnCtx(nt,Dn),Bi?(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.too_big,maximum:Fn.value,type:"string",inclusive:!0,exact:!0,message:Fn.message}):Mi&&(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.too_small,minimum:Fn.value,type:"string",inclusive:!0,exact:!0,message:Fn.message}),Jt.dirty())}else if(Fn.kind==="email")S.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"email",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="emoji")I||(I=new RegExp(D,"u")),I.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"emoji",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="uuid")c.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"uuid",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="nanoid")y.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"nanoid",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="cuid")d.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"cuid",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="cuid2")E.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"cuid2",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="ulid")f.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"ulid",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty());else if(Fn.kind==="url")try{new URL(nt.data)}catch{Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"url",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()}else Fn.kind==="regex"?(Fn.regex.lastIndex=0,Fn.regex.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"regex",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty())):Fn.kind==="trim"?nt.data=nt.data.trim():Fn.kind==="includes"?nt.data.includes(Fn.value,Fn.position)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.invalid_string,validation:{includes:Fn.value,position:Fn.position},message:Fn.message}),Jt.dirty()):Fn.kind==="toLowerCase"?nt.data=nt.data.toLowerCase():Fn.kind==="toUpperCase"?nt.data=nt.data.toUpperCase():Fn.kind==="startsWith"?nt.data.startsWith(Fn.value)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.invalid_string,validation:{startsWith:Fn.value},message:Fn.message}),Jt.dirty()):Fn.kind==="endsWith"?nt.data.endsWith(Fn.value)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.invalid_string,validation:{endsWith:Fn.value},message:Fn.message}),Jt.dirty()):Fn.kind==="datetime"?U(Fn).test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.invalid_string,validation:"datetime",message:Fn.message}),Jt.dirty()):Fn.kind==="date"?F.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.invalid_string,validation:"date",message:Fn.message}),Jt.dirty()):Fn.kind==="time"?B(Fn).test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.invalid_string,validation:"time",message:Fn.message}),Jt.dirty()):Fn.kind==="duration"?A.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"duration",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()):Fn.kind==="ip"?W(nt.data,Fn.version)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"ip",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()):Fn.kind==="jwt"?j(nt.data,Fn.alg)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"jwt",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()):Fn.kind==="cidr"?Q(nt.data,Fn.version)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"cidr",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()):Fn.kind==="base64"?O.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"base64",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()):Fn.kind==="base64url"?M.test(nt.data)||(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{validation:"base64url",code:s.ZodIssueCode.invalid_string,message:Fn.message}),Jt.dirty()):_.util.assertNever(Fn);return{status:Jt.value,value:nt.data}}_regex(nt,Ft,Jt){return this.refinement(Dn=>nt.test(Dn),{validation:Ft,code:s.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(Jt)})}_addCheck(nt){return new G({...this._def,checks:[...this._def.checks,nt]})}email(nt){return this._addCheck({kind:"email",...v.errorUtil.errToObj(nt)})}url(nt){return this._addCheck({kind:"url",...v.errorUtil.errToObj(nt)})}emoji(nt){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(nt)})}uuid(nt){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(nt)})}nanoid(nt){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(nt)})}cuid(nt){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(nt)})}cuid2(nt){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(nt)})}ulid(nt){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(nt)})}base64(nt){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(nt)})}base64url(nt){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(nt)})}jwt(nt){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(nt)})}ip(nt){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(nt)})}cidr(nt){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(nt)})}datetime(nt){var Ft,Jt;return typeof nt=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:nt}):this._addCheck({kind:"datetime",precision:typeof nt?.precision>"u"?null:nt?.precision,offset:(Ft=nt?.offset)!==null&&Ft!==void 0?Ft:!1,local:(Jt=nt?.local)!==null&&Jt!==void 0?Jt:!1,...v.errorUtil.errToObj(nt?.message)})}date(nt){return this._addCheck({kind:"date",message:nt})}time(nt){return typeof nt=="string"?this._addCheck({kind:"time",precision:null,message:nt}):this._addCheck({kind:"time",precision:typeof nt?.precision>"u"?null:nt?.precision,...v.errorUtil.errToObj(nt?.message)})}duration(nt){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(nt)})}regex(nt,Ft){return this._addCheck({kind:"regex",regex:nt,...v.errorUtil.errToObj(Ft)})}includes(nt,Ft){return this._addCheck({kind:"includes",value:nt,position:Ft?.position,...v.errorUtil.errToObj(Ft?.message)})}startsWith(nt,Ft){return this._addCheck({kind:"startsWith",value:nt,...v.errorUtil.errToObj(Ft)})}endsWith(nt,Ft){return this._addCheck({kind:"endsWith",value:nt,...v.errorUtil.errToObj(Ft)})}min(nt,Ft){return this._addCheck({kind:"min",value:nt,...v.errorUtil.errToObj(Ft)})}max(nt,Ft){return this._addCheck({kind:"max",value:nt,...v.errorUtil.errToObj(Ft)})}length(nt,Ft){return this._addCheck({kind:"length",value:nt,...v.errorUtil.errToObj(Ft)})}nonempty(nt){return this.min(1,v.errorUtil.errToObj(nt))}trim(){return new G({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new G({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new G({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(nt=>nt.kind==="datetime")}get isDate(){return!!this._def.checks.find(nt=>nt.kind==="date")}get isTime(){return!!this._def.checks.find(nt=>nt.kind==="time")}get isDuration(){return!!this._def.checks.find(nt=>nt.kind==="duration")}get isEmail(){return!!this._def.checks.find(nt=>nt.kind==="email")}get isURL(){return!!this._def.checks.find(nt=>nt.kind==="url")}get isEmoji(){return!!this._def.checks.find(nt=>nt.kind==="emoji")}get isUUID(){return!!this._def.checks.find(nt=>nt.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(nt=>nt.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(nt=>nt.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(nt=>nt.kind==="cuid2")}get isULID(){return!!this._def.checks.find(nt=>nt.kind==="ulid")}get isIP(){return!!this._def.checks.find(nt=>nt.kind==="ip")}get isCIDR(){return!!this._def.checks.find(nt=>nt.kind==="cidr")}get isBase64(){return!!this._def.checks.find(nt=>nt.kind==="base64")}get isBase64url(){return!!this._def.checks.find(nt=>nt.kind==="base64url")}get minLength(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="min"&&(nt===null||Ft.value>nt)&&(nt=Ft.value);return nt}get maxLength(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="max"&&(nt===null||Ft.value<nt)&&(nt=Ft.value);return nt}}t.ZodString=G,G.create=qt=>{var nt;return new G({checks:[],typeName:At.ZodString,coerce:(nt=qt?.coerce)!==null&&nt!==void 0?nt:!1,...h(qt)})};function Z(qt,nt){const Ft=(qt.toString().split(".")[1]||"").length,Jt=(nt.toString().split(".")[1]||"").length,Dn=Ft>Jt?Ft:Jt,Fn=parseInt(qt.toFixed(Dn).replace(".","")),Bi=parseInt(nt.toFixed(Dn).replace(".",""));return Fn%Bi/Math.pow(10,Dn)}class $ extends u{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(nt){if(this._def.coerce&&(nt.data=Number(nt.data)),this._getType(nt)!==_.ZodParsedType.number){const Fn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Fn,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.number,received:Fn.parsedType}),m.INVALID}let Jt;const Dn=new m.ParseStatus;for(const Fn of this._def.checks)Fn.kind==="int"?_.util.isInteger(nt.data)||(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:Fn.message}),Dn.dirty()):Fn.kind==="min"?(Fn.inclusive?nt.data<Fn.value:nt.data<=Fn.value)&&(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_small,minimum:Fn.value,type:"number",inclusive:Fn.inclusive,exact:!1,message:Fn.message}),Dn.dirty()):Fn.kind==="max"?(Fn.inclusive?nt.data>Fn.value:nt.data>=Fn.value)&&(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_big,maximum:Fn.value,type:"number",inclusive:Fn.inclusive,exact:!1,message:Fn.message}),Dn.dirty()):Fn.kind==="multipleOf"?Z(nt.data,Fn.value)!==0&&(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.not_multiple_of,multipleOf:Fn.value,message:Fn.message}),Dn.dirty()):Fn.kind==="finite"?Number.isFinite(nt.data)||(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.not_finite,message:Fn.message}),Dn.dirty()):_.util.assertNever(Fn);return{status:Dn.value,value:nt.data}}gte(nt,Ft){return this.setLimit("min",nt,!0,v.errorUtil.toString(Ft))}gt(nt,Ft){return this.setLimit("min",nt,!1,v.errorUtil.toString(Ft))}lte(nt,Ft){return this.setLimit("max",nt,!0,v.errorUtil.toString(Ft))}lt(nt,Ft){return this.setLimit("max",nt,!1,v.errorUtil.toString(Ft))}setLimit(nt,Ft,Jt,Dn){return new $({...this._def,checks:[...this._def.checks,{kind:nt,value:Ft,inclusive:Jt,message:v.errorUtil.toString(Dn)}]})}_addCheck(nt){return new $({...this._def,checks:[...this._def.checks,nt]})}int(nt){return this._addCheck({kind:"int",message:v.errorUtil.toString(nt)})}positive(nt){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(nt)})}negative(nt){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(nt)})}nonpositive(nt){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(nt)})}nonnegative(nt){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(nt)})}multipleOf(nt,Ft){return this._addCheck({kind:"multipleOf",value:nt,message:v.errorUtil.toString(Ft)})}finite(nt){return this._addCheck({kind:"finite",message:v.errorUtil.toString(nt)})}safe(nt){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(nt)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.toString(nt)})}get minValue(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="min"&&(nt===null||Ft.value>nt)&&(nt=Ft.value);return nt}get maxValue(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="max"&&(nt===null||Ft.value<nt)&&(nt=Ft.value);return nt}get isInt(){return!!this._def.checks.find(nt=>nt.kind==="int"||nt.kind==="multipleOf"&&_.util.isInteger(nt.value))}get isFinite(){let nt=null,Ft=null;for(const Jt of this._def.checks){if(Jt.kind==="finite"||Jt.kind==="int"||Jt.kind==="multipleOf")return!0;Jt.kind==="min"?(Ft===null||Jt.value>Ft)&&(Ft=Jt.value):Jt.kind==="max"&&(nt===null||Jt.value<nt)&&(nt=Jt.value)}return Number.isFinite(Ft)&&Number.isFinite(nt)}}t.ZodNumber=$,$.create=qt=>new $({checks:[],typeName:At.ZodNumber,coerce:qt?.coerce||!1,...h(qt)});class V extends u{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(nt){if(this._def.coerce)try{nt.data=BigInt(nt.data)}catch{return this._getInvalidInput(nt)}if(this._getType(nt)!==_.ZodParsedType.bigint)return this._getInvalidInput(nt);let Jt;const Dn=new m.ParseStatus;for(const Fn of this._def.checks)Fn.kind==="min"?(Fn.inclusive?nt.data<Fn.value:nt.data<=Fn.value)&&(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_small,type:"bigint",minimum:Fn.value,inclusive:Fn.inclusive,message:Fn.message}),Dn.dirty()):Fn.kind==="max"?(Fn.inclusive?nt.data>Fn.value:nt.data>=Fn.value)&&(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_big,type:"bigint",maximum:Fn.value,inclusive:Fn.inclusive,message:Fn.message}),Dn.dirty()):Fn.kind==="multipleOf"?nt.data%Fn.value!==BigInt(0)&&(Jt=this._getOrReturnCtx(nt,Jt),(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.not_multiple_of,multipleOf:Fn.value,message:Fn.message}),Dn.dirty()):_.util.assertNever(Fn);return{status:Dn.value,value:nt.data}}_getInvalidInput(nt){const Ft=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.bigint,received:Ft.parsedType}),m.INVALID}gte(nt,Ft){return this.setLimit("min",nt,!0,v.errorUtil.toString(Ft))}gt(nt,Ft){return this.setLimit("min",nt,!1,v.errorUtil.toString(Ft))}lte(nt,Ft){return this.setLimit("max",nt,!0,v.errorUtil.toString(Ft))}lt(nt,Ft){return this.setLimit("max",nt,!1,v.errorUtil.toString(Ft))}setLimit(nt,Ft,Jt,Dn){return new V({...this._def,checks:[...this._def.checks,{kind:nt,value:Ft,inclusive:Jt,message:v.errorUtil.toString(Dn)}]})}_addCheck(nt){return new V({...this._def,checks:[...this._def.checks,nt]})}positive(nt){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(nt)})}negative(nt){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(nt)})}nonpositive(nt){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(nt)})}nonnegative(nt){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(nt)})}multipleOf(nt,Ft){return this._addCheck({kind:"multipleOf",value:nt,message:v.errorUtil.toString(Ft)})}get minValue(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="min"&&(nt===null||Ft.value>nt)&&(nt=Ft.value);return nt}get maxValue(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="max"&&(nt===null||Ft.value<nt)&&(nt=Ft.value);return nt}}t.ZodBigInt=V,V.create=qt=>{var nt;return new V({checks:[],typeName:At.ZodBigInt,coerce:(nt=qt?.coerce)!==null&&nt!==void 0?nt:!1,...h(qt)})};class H extends u{_parse(nt){if(this._def.coerce&&(nt.data=!!nt.data),this._getType(nt)!==_.ZodParsedType.boolean){const Jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.boolean,received:Jt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodBoolean=H,H.create=qt=>new H({typeName:At.ZodBoolean,coerce:qt?.coerce||!1,...h(qt)});class K extends u{_parse(nt){if(this._def.coerce&&(nt.data=new Date(nt.data)),this._getType(nt)!==_.ZodParsedType.date){const Fn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Fn,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.date,received:Fn.parsedType}),m.INVALID}if(isNaN(nt.data.getTime())){const Fn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Fn,{code:s.ZodIssueCode.invalid_date}),m.INVALID}const Jt=new m.ParseStatus;let Dn;for(const Fn of this._def.checks)Fn.kind==="min"?nt.data.getTime()<Fn.value&&(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.too_small,message:Fn.message,inclusive:!0,exact:!1,minimum:Fn.value,type:"date"}),Jt.dirty()):Fn.kind==="max"?nt.data.getTime()>Fn.value&&(Dn=this._getOrReturnCtx(nt,Dn),(0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.too_big,message:Fn.message,inclusive:!0,exact:!1,maximum:Fn.value,type:"date"}),Jt.dirty()):_.util.assertNever(Fn);return{status:Jt.value,value:new Date(nt.data.getTime())}}_addCheck(nt){return new K({...this._def,checks:[...this._def.checks,nt]})}min(nt,Ft){return this._addCheck({kind:"min",value:nt.getTime(),message:v.errorUtil.toString(Ft)})}max(nt,Ft){return this._addCheck({kind:"max",value:nt.getTime(),message:v.errorUtil.toString(Ft)})}get minDate(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="min"&&(nt===null||Ft.value>nt)&&(nt=Ft.value);return nt!=null?new Date(nt):null}get maxDate(){let nt=null;for(const Ft of this._def.checks)Ft.kind==="max"&&(nt===null||Ft.value<nt)&&(nt=Ft.value);return nt!=null?new Date(nt):null}}t.ZodDate=K,K.create=qt=>new K({checks:[],coerce:qt?.coerce||!1,typeName:At.ZodDate,...h(qt)});class Y extends u{_parse(nt){if(this._getType(nt)!==_.ZodParsedType.symbol){const Jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.symbol,received:Jt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodSymbol=Y,Y.create=qt=>new Y({typeName:At.ZodSymbol,...h(qt)});class X extends u{_parse(nt){if(this._getType(nt)!==_.ZodParsedType.undefined){const Jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.undefined,received:Jt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodUndefined=X,X.create=qt=>new X({typeName:At.ZodUndefined,...h(qt)});class oe extends u{_parse(nt){if(this._getType(nt)!==_.ZodParsedType.null){const Jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.null,received:Jt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodNull=oe,oe.create=qt=>new oe({typeName:At.ZodNull,...h(qt)});class ie extends u{constructor(){super(...arguments),this._any=!0}_parse(nt){return(0,m.OK)(nt.data)}}t.ZodAny=ie,ie.create=qt=>new ie({typeName:At.ZodAny,...h(qt)});class he extends u{constructor(){super(...arguments),this._unknown=!0}_parse(nt){return(0,m.OK)(nt.data)}}t.ZodUnknown=he,he.create=qt=>new he({typeName:At.ZodUnknown,...h(qt)});class me extends u{_parse(nt){const Ft=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.never,received:Ft.parsedType}),m.INVALID}}t.ZodNever=me,me.create=qt=>new me({typeName:At.ZodNever,...h(qt)});class q extends u{_parse(nt){if(this._getType(nt)!==_.ZodParsedType.undefined){const Jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.void,received:Jt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodVoid=q,q.create=qt=>new q({typeName:At.ZodVoid,...h(qt)});class Ee extends u{_parse(nt){const{ctx:Ft,status:Jt}=this._processInputParams(nt),Dn=this._def;if(Ft.parsedType!==_.ZodParsedType.array)return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.array,received:Ft.parsedType}),m.INVALID;if(Dn.exactLength!==null){const Bi=Ft.data.length>Dn.exactLength.value,Mi=Ft.data.length<Dn.exactLength.value;(Bi||Mi)&&((0,m.addIssueToContext)(Ft,{code:Bi?s.ZodIssueCode.too_big:s.ZodIssueCode.too_small,minimum:Mi?Dn.exactLength.value:void 0,maximum:Bi?Dn.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:Dn.exactLength.message}),Jt.dirty())}if(Dn.minLength!==null&&Ft.data.length<Dn.minLength.value&&((0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.too_small,minimum:Dn.minLength.value,type:"array",inclusive:!0,exact:!1,message:Dn.minLength.message}),Jt.dirty()),Dn.maxLength!==null&&Ft.data.length>Dn.maxLength.value&&((0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.too_big,maximum:Dn.maxLength.value,type:"array",inclusive:!0,exact:!1,message:Dn.maxLength.message}),Jt.dirty()),Ft.common.async)return Promise.all([...Ft.data].map((Bi,Mi)=>Dn.type._parseAsync(new g(Ft,Bi,Ft.path,Mi)))).then(Bi=>m.ParseStatus.mergeArray(Jt,Bi));const Fn=[...Ft.data].map((Bi,Mi)=>Dn.type._parseSync(new g(Ft,Bi,Ft.path,Mi)));return m.ParseStatus.mergeArray(Jt,Fn)}get element(){return this._def.type}min(nt,Ft){return new Ee({...this._def,minLength:{value:nt,message:v.errorUtil.toString(Ft)}})}max(nt,Ft){return new Ee({...this._def,maxLength:{value:nt,message:v.errorUtil.toString(Ft)}})}length(nt,Ft){return new Ee({...this._def,exactLength:{value:nt,message:v.errorUtil.toString(Ft)}})}nonempty(nt){return this.min(1,nt)}}t.ZodArray=Ee,Ee.create=(qt,nt)=>new Ee({type:qt,minLength:null,maxLength:null,exactLength:null,typeName:At.ZodArray,...h(nt)});function ue(qt){if(qt instanceof te){const nt={};for(const Ft in qt.shape){const Jt=qt.shape[Ft];nt[Ft]=Ke.create(ue(Jt))}return new te({...qt._def,shape:()=>nt})}else return qt instanceof Ee?new Ee({...qt._def,type:ue(qt.element)}):qt instanceof Ke?Ke.create(ue(qt.unwrap())):qt instanceof mt?mt.create(ue(qt.unwrap())):qt instanceof we?we.create(qt.items.map(nt=>ue(nt))):qt}class te extends u{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const nt=this._def.shape(),Ft=_.util.objectKeys(nt);return this._cached={shape:nt,keys:Ft}}_parse(nt){if(this._getType(nt)!==_.ZodParsedType.object){const vi=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(vi,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:vi.parsedType}),m.INVALID}const{status:Jt,ctx:Dn}=this._processInputParams(nt),{shape:Fn,keys:Bi}=this._getCached(),Mi=[];if(!(this._def.catchall instanceof me&&this._def.unknownKeys==="strip"))for(const vi in Dn.data)Bi.includes(vi)||Mi.push(vi);const Xi=[];for(const vi of Bi){const Qi=Fn[vi],qi=Dn.data[vi];Xi.push({key:{status:"valid",value:vi},value:Qi._parse(new g(Dn,qi,Dn.path,vi)),alwaysSet:vi in Dn.data})}if(this._def.catchall instanceof me){const vi=this._def.unknownKeys;if(vi==="passthrough")for(const Qi of Mi)Xi.push({key:{status:"valid",value:Qi},value:{status:"valid",value:Dn.data[Qi]}});else if(vi==="strict")Mi.length>0&&((0,m.addIssueToContext)(Dn,{code:s.ZodIssueCode.unrecognized_keys,keys:Mi}),Jt.dirty());else if(vi!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const vi=this._def.catchall;for(const Qi of Mi){const qi=Dn.data[Qi];Xi.push({key:{status:"valid",value:Qi},value:vi._parse(new g(Dn,qi,Dn.path,Qi)),alwaysSet:Qi in Dn.data})}}return Dn.common.async?Promise.resolve().then(async()=>{const vi=[];for(const Qi of Xi){const qi=await Qi.key,lo=await Qi.value;vi.push({key:qi,value:lo,alwaysSet:Qi.alwaysSet})}return vi}).then(vi=>m.ParseStatus.mergeObjectSync(Jt,vi)):m.ParseStatus.mergeObjectSync(Jt,Xi)}get shape(){return this._def.shape()}strict(nt){return v.errorUtil.errToObj,new te({...this._def,unknownKeys:"strict",...nt!==void 0?{errorMap:(Ft,Jt)=>{var Dn,Fn,Bi,Mi;const Xi=(Bi=(Fn=(Dn=this._def).errorMap)===null||Fn===void 0?void 0:Fn.call(Dn,Ft,Jt).message)!==null&&Bi!==void 0?Bi:Jt.defaultError;return Ft.code==="unrecognized_keys"?{message:(Mi=v.errorUtil.errToObj(nt).message)!==null&&Mi!==void 0?Mi:Xi}:{message:Xi}}}:{}})}strip(){return new te({...this._def,unknownKeys:"strip"})}passthrough(){return new te({...this._def,unknownKeys:"passthrough"})}extend(nt){return new te({...this._def,shape:()=>({...this._def.shape(),...nt})})}merge(nt){return new te({unknownKeys:nt._def.unknownKeys,catchall:nt._def.catchall,shape:()=>({...this._def.shape(),...nt._def.shape()}),typeName:At.ZodObject})}setKey(nt,Ft){return this.augment({[nt]:Ft})}catchall(nt){return new te({...this._def,catchall:nt})}pick(nt){const Ft={};return _.util.objectKeys(nt).forEach(Jt=>{nt[Jt]&&this.shape[Jt]&&(Ft[Jt]=this.shape[Jt])}),new te({...this._def,shape:()=>Ft})}omit(nt){const Ft={};return _.util.objectKeys(this.shape).forEach(Jt=>{nt[Jt]||(Ft[Jt]=this.shape[Jt])}),new te({...this._def,shape:()=>Ft})}deepPartial(){return ue(this)}partial(nt){const Ft={};return _.util.objectKeys(this.shape).forEach(Jt=>{const Dn=this.shape[Jt];nt&&!nt[Jt]?Ft[Jt]=Dn:Ft[Jt]=Dn.optional()}),new te({...this._def,shape:()=>Ft})}required(nt){const Ft={};return _.util.objectKeys(this.shape).forEach(Jt=>{if(nt&&!nt[Jt])Ft[Jt]=this.shape[Jt];else{let Fn=this.shape[Jt];for(;Fn instanceof Ke;)Fn=Fn._def.innerType;Ft[Jt]=Fn}}),new te({...this._def,shape:()=>Ft})}keyof(){return ge(_.util.objectKeys(this.shape))}}t.ZodObject=te,te.create=(qt,nt)=>new te({shape:()=>qt,unknownKeys:"strip",catchall:me.create(),typeName:At.ZodObject,...h(nt)}),te.strictCreate=(qt,nt)=>new te({shape:()=>qt,unknownKeys:"strict",catchall:me.create(),typeName:At.ZodObject,...h(nt)}),te.lazycreate=(qt,nt)=>new te({shape:qt,unknownKeys:"strip",catchall:me.create(),typeName:At.ZodObject,...h(nt)});class fe extends u{_parse(nt){const{ctx:Ft}=this._processInputParams(nt),Jt=this._def.options;function Dn(Fn){for(const Mi of Fn)if(Mi.result.status==="valid")return Mi.result;for(const Mi of Fn)if(Mi.result.status==="dirty")return Ft.common.issues.push(...Mi.ctx.common.issues),Mi.result;const Bi=Fn.map(Mi=>new s.ZodError(Mi.ctx.common.issues));return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_union,unionErrors:Bi}),m.INVALID}if(Ft.common.async)return Promise.all(Jt.map(async Fn=>{const Bi={...Ft,common:{...Ft.common,issues:[]},parent:null};return{result:await Fn._parseAsync({data:Ft.data,path:Ft.path,parent:Bi}),ctx:Bi}})).then(Dn);{let Fn;const Bi=[];for(const Xi of Jt){const vi={...Ft,common:{...Ft.common,issues:[]},parent:null},Qi=Xi._parseSync({data:Ft.data,path:Ft.path,parent:vi});if(Qi.status==="valid")return Qi;Qi.status==="dirty"&&!Fn&&(Fn={result:Qi,ctx:vi}),vi.common.issues.length&&Bi.push(vi.common.issues)}if(Fn)return Ft.common.issues.push(...Fn.ctx.common.issues),Fn.result;const Mi=Bi.map(Xi=>new s.ZodError(Xi));return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_union,unionErrors:Mi}),m.INVALID}}get options(){return this._def.options}}t.ZodUnion=fe,fe.create=(qt,nt)=>new fe({options:qt,typeName:At.ZodUnion,...h(nt)});const Ie=qt=>qt instanceof pe?Ie(qt.schema):qt instanceof Ye?Ie(qt.innerType()):qt instanceof re?[qt.value]:qt instanceof De?qt.options:qt instanceof Ae?_.util.objectValues(qt.enum):qt instanceof _t?Ie(qt._def.innerType):qt instanceof X?[void 0]:qt instanceof oe?[null]:qt instanceof Ke?[void 0,...Ie(qt.unwrap())]:qt instanceof mt?[null,...Ie(qt.unwrap())]:qt instanceof wt||qt instanceof rt?Ie(qt.unwrap()):qt instanceof Mt?Ie(qt._def.innerType):[];class Me extends u{_parse(nt){const{ctx:Ft}=this._processInputParams(nt);if(Ft.parsedType!==_.ZodParsedType.object)return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:Ft.parsedType}),m.INVALID;const Jt=this.discriminator,Dn=Ft.data[Jt],Fn=this.optionsMap.get(Dn);return Fn?Ft.common.async?Fn._parseAsync({data:Ft.data,path:Ft.path,parent:Ft}):Fn._parseSync({data:Ft.data,path:Ft.path,parent:Ft}):((0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Jt]}),m.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(nt,Ft,Jt){const Dn=new Map;for(const Fn of Ft){const Bi=Ie(Fn.shape[nt]);if(!Bi.length)throw new Error(`A discriminator value for key \`${nt}\` could not be extracted from all schema options`);for(const Mi of Bi){if(Dn.has(Mi))throw new Error(`Discriminator property ${String(nt)} has duplicate value ${String(Mi)}`);Dn.set(Mi,Fn)}}return new Me({typeName:At.ZodDiscriminatedUnion,discriminator:nt,options:Ft,optionsMap:Dn,...h(Jt)})}}t.ZodDiscriminatedUnion=Me;function Be(qt,nt){const Ft=(0,_.getParsedType)(qt),Jt=(0,_.getParsedType)(nt);if(qt===nt)return{valid:!0,data:qt};if(Ft===_.ZodParsedType.object&&Jt===_.ZodParsedType.object){const Dn=_.util.objectKeys(nt),Fn=_.util.objectKeys(qt).filter(Mi=>Dn.indexOf(Mi)!==-1),Bi={...qt,...nt};for(const Mi of Fn){const Xi=Be(qt[Mi],nt[Mi]);if(!Xi.valid)return{valid:!1};Bi[Mi]=Xi.data}return{valid:!0,data:Bi}}else if(Ft===_.ZodParsedType.array&&Jt===_.ZodParsedType.array){if(qt.length!==nt.length)return{valid:!1};const Dn=[];for(let Fn=0;Fn<qt.length;Fn++){const Bi=qt[Fn],Mi=nt[Fn],Xi=Be(Bi,Mi);if(!Xi.valid)return{valid:!1};Dn.push(Xi.data)}return{valid:!0,data:Dn}}else return Ft===_.ZodParsedType.date&&Jt===_.ZodParsedType.date&&+qt==+nt?{valid:!0,data:qt}:{valid:!1}}class Pe extends u{_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt),Dn=(Fn,Bi)=>{if((0,m.isAborted)(Fn)||(0,m.isAborted)(Bi))return m.INVALID;const Mi=Be(Fn.value,Bi.value);return Mi.valid?(((0,m.isDirty)(Fn)||(0,m.isDirty)(Bi))&&Ft.dirty(),{status:Ft.value,value:Mi.data}):((0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_intersection_types}),m.INVALID)};return Jt.common.async?Promise.all([this._def.left._parseAsync({data:Jt.data,path:Jt.path,parent:Jt}),this._def.right._parseAsync({data:Jt.data,path:Jt.path,parent:Jt})]).then(([Fn,Bi])=>Dn(Fn,Bi)):Dn(this._def.left._parseSync({data:Jt.data,path:Jt.path,parent:Jt}),this._def.right._parseSync({data:Jt.data,path:Jt.path,parent:Jt}))}}t.ZodIntersection=Pe,Pe.create=(qt,nt,Ft)=>new Pe({left:qt,right:nt,typeName:At.ZodIntersection,...h(Ft)});class we extends u{_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt);if(Jt.parsedType!==_.ZodParsedType.array)return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.array,received:Jt.parsedType}),m.INVALID;if(Jt.data.length<this._def.items.length)return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m.INVALID;!this._def.rest&&Jt.data.length>this._def.items.length&&((0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ft.dirty());const Fn=[...Jt.data].map((Bi,Mi)=>{const Xi=this._def.items[Mi]||this._def.rest;return Xi?Xi._parse(new g(Jt,Bi,Jt.path,Mi)):null}).filter(Bi=>!!Bi);return Jt.common.async?Promise.all(Fn).then(Bi=>m.ParseStatus.mergeArray(Ft,Bi)):m.ParseStatus.mergeArray(Ft,Fn)}get items(){return this._def.items}rest(nt){return new we({...this._def,rest:nt})}}t.ZodTuple=we,we.create=(qt,nt)=>{if(!Array.isArray(qt))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new we({items:qt,typeName:At.ZodTuple,rest:null,...h(nt)})};class _e extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt);if(Jt.parsedType!==_.ZodParsedType.object)return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:Jt.parsedType}),m.INVALID;const Dn=[],Fn=this._def.keyType,Bi=this._def.valueType;for(const Mi in Jt.data)Dn.push({key:Fn._parse(new g(Jt,Mi,Jt.path,Mi)),value:Bi._parse(new g(Jt,Jt.data[Mi],Jt.path,Mi)),alwaysSet:Mi in Jt.data});return Jt.common.async?m.ParseStatus.mergeObjectAsync(Ft,Dn):m.ParseStatus.mergeObjectSync(Ft,Dn)}get element(){return this._def.valueType}static create(nt,Ft,Jt){return Ft instanceof u?new _e({keyType:nt,valueType:Ft,typeName:At.ZodRecord,...h(Jt)}):new _e({keyType:G.create(),valueType:nt,typeName:At.ZodRecord,...h(Ft)})}}t.ZodRecord=_e;class Ne extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt);if(Jt.parsedType!==_.ZodParsedType.map)return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.map,received:Jt.parsedType}),m.INVALID;const Dn=this._def.keyType,Fn=this._def.valueType,Bi=[...Jt.data.entries()].map(([Mi,Xi],vi)=>({key:Dn._parse(new g(Jt,Mi,Jt.path,[vi,"key"])),value:Fn._parse(new g(Jt,Xi,Jt.path,[vi,"value"]))}));if(Jt.common.async){const Mi=new Map;return Promise.resolve().then(async()=>{for(const Xi of Bi){const vi=await Xi.key,Qi=await Xi.value;if(vi.status==="aborted"||Qi.status==="aborted")return m.INVALID;(vi.status==="dirty"||Qi.status==="dirty")&&Ft.dirty(),Mi.set(vi.value,Qi.value)}return{status:Ft.value,value:Mi}})}else{const Mi=new Map;for(const Xi of Bi){const vi=Xi.key,Qi=Xi.value;if(vi.status==="aborted"||Qi.status==="aborted")return m.INVALID;(vi.status==="dirty"||Qi.status==="dirty")&&Ft.dirty(),Mi.set(vi.value,Qi.value)}return{status:Ft.value,value:Mi}}}}t.ZodMap=Ne,Ne.create=(qt,nt,Ft)=>new Ne({valueType:nt,keyType:qt,typeName:At.ZodMap,...h(Ft)});class Te extends u{_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt);if(Jt.parsedType!==_.ZodParsedType.set)return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.set,received:Jt.parsedType}),m.INVALID;const Dn=this._def;Dn.minSize!==null&&Jt.data.size<Dn.minSize.value&&((0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_small,minimum:Dn.minSize.value,type:"set",inclusive:!0,exact:!1,message:Dn.minSize.message}),Ft.dirty()),Dn.maxSize!==null&&Jt.data.size>Dn.maxSize.value&&((0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.too_big,maximum:Dn.maxSize.value,type:"set",inclusive:!0,exact:!1,message:Dn.maxSize.message}),Ft.dirty());const Fn=this._def.valueType;function Bi(Xi){const vi=new Set;for(const Qi of Xi){if(Qi.status==="aborted")return m.INVALID;Qi.status==="dirty"&&Ft.dirty(),vi.add(Qi.value)}return{status:Ft.value,value:vi}}const Mi=[...Jt.data.values()].map((Xi,vi)=>Fn._parse(new g(Jt,Xi,Jt.path,vi)));return Jt.common.async?Promise.all(Mi).then(Xi=>Bi(Xi)):Bi(Mi)}min(nt,Ft){return new Te({...this._def,minSize:{value:nt,message:v.errorUtil.toString(Ft)}})}max(nt,Ft){return new Te({...this._def,maxSize:{value:nt,message:v.errorUtil.toString(Ft)}})}size(nt,Ft){return this.min(nt,Ft).max(nt,Ft)}nonempty(nt){return this.min(1,nt)}}t.ZodSet=Te,Te.create=(qt,nt)=>new Te({valueType:qt,minSize:null,maxSize:null,typeName:At.ZodSet,...h(nt)});class We extends u{constructor(){super(...arguments),this.validate=this.implement}_parse(nt){const{ctx:Ft}=this._processInputParams(nt);if(Ft.parsedType!==_.ZodParsedType.function)return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.function,received:Ft.parsedType}),m.INVALID;function Jt(Mi,Xi){return(0,m.makeIssue)({data:Mi,path:Ft.path,errorMaps:[Ft.common.contextualErrorMap,Ft.schemaErrorMap,(0,p.getErrorMap)(),p.defaultErrorMap].filter(vi=>!!vi),issueData:{code:s.ZodIssueCode.invalid_arguments,argumentsError:Xi}})}function Dn(Mi,Xi){return(0,m.makeIssue)({data:Mi,path:Ft.path,errorMaps:[Ft.common.contextualErrorMap,Ft.schemaErrorMap,(0,p.getErrorMap)(),p.defaultErrorMap].filter(vi=>!!vi),issueData:{code:s.ZodIssueCode.invalid_return_type,returnTypeError:Xi}})}const Fn={errorMap:Ft.common.contextualErrorMap},Bi=Ft.data;if(this._def.returns instanceof Ue){const Mi=this;return(0,m.OK)(async function(...Xi){const vi=new s.ZodError([]),Qi=await Mi._def.args.parseAsync(Xi,Fn).catch(yo=>{throw vi.addIssue(Jt(Xi,yo)),vi}),qi=await Reflect.apply(Bi,this,Qi);return await Mi._def.returns._def.type.parseAsync(qi,Fn).catch(yo=>{throw vi.addIssue(Dn(qi,yo)),vi})})}else{const Mi=this;return(0,m.OK)(function(...Xi){const vi=Mi._def.args.safeParse(Xi,Fn);if(!vi.success)throw new s.ZodError([Jt(Xi,vi.error)]);const Qi=Reflect.apply(Bi,this,vi.data),qi=Mi._def.returns.safeParse(Qi,Fn);if(!qi.success)throw new s.ZodError([Dn(Qi,qi.error)]);return qi.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...nt){return new We({...this._def,args:we.create(nt).rest(he.create())})}returns(nt){return new We({...this._def,returns:nt})}implement(nt){return this.parse(nt)}strictImplement(nt){return this.parse(nt)}static create(nt,Ft,Jt){return new We({args:nt||we.create([]).rest(he.create()),returns:Ft||he.create(),typeName:At.ZodFunction,...h(Jt)})}}t.ZodFunction=We;class pe extends u{get schema(){return this._def.getter()}_parse(nt){const{ctx:Ft}=this._processInputParams(nt);return this._def.getter()._parse({data:Ft.data,path:Ft.path,parent:Ft})}}t.ZodLazy=pe,pe.create=(qt,nt)=>new pe({getter:qt,typeName:At.ZodLazy,...h(nt)});class re extends u{_parse(nt){if(nt.data!==this._def.value){const Ft=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Ft,{received:Ft.data,code:s.ZodIssueCode.invalid_literal,expected:this._def.value}),m.INVALID}return{status:"valid",value:nt.data}}get value(){return this._def.value}}t.ZodLiteral=re,re.create=(qt,nt)=>new re({value:qt,typeName:At.ZodLiteral,...h(nt)});function ge(qt,nt){return new De({values:qt,typeName:At.ZodEnum,...h(nt)})}class De extends u{constructor(){super(...arguments),o.set(this,void 0)}_parse(nt){if(typeof nt.data!="string"){const Ft=this._getOrReturnCtx(nt),Jt=this._def.values;return(0,m.addIssueToContext)(Ft,{expected:_.util.joinValues(Jt),received:Ft.parsedType,code:s.ZodIssueCode.invalid_type}),m.INVALID}if(n(this,o,"f")||r(this,o,new Set(this._def.values),"f"),!n(this,o,"f").has(nt.data)){const Ft=this._getOrReturnCtx(nt),Jt=this._def.values;return(0,m.addIssueToContext)(Ft,{received:Ft.data,code:s.ZodIssueCode.invalid_enum_value,options:Jt}),m.INVALID}return(0,m.OK)(nt.data)}get options(){return this._def.values}get enum(){const nt={};for(const Ft of this._def.values)nt[Ft]=Ft;return nt}get Values(){const nt={};for(const Ft of this._def.values)nt[Ft]=Ft;return nt}get Enum(){const nt={};for(const Ft of this._def.values)nt[Ft]=Ft;return nt}extract(nt,Ft=this._def){return De.create(nt,{...this._def,...Ft})}exclude(nt,Ft=this._def){return De.create(this.options.filter(Jt=>!nt.includes(Jt)),{...this._def,...Ft})}}t.ZodEnum=De,o=new WeakMap,De.create=ge;class Ae extends u{constructor(){super(...arguments),a.set(this,void 0)}_parse(nt){const Ft=_.util.getValidEnumValues(this._def.values),Jt=this._getOrReturnCtx(nt);if(Jt.parsedType!==_.ZodParsedType.string&&Jt.parsedType!==_.ZodParsedType.number){const Dn=_.util.objectValues(Ft);return(0,m.addIssueToContext)(Jt,{expected:_.util.joinValues(Dn),received:Jt.parsedType,code:s.ZodIssueCode.invalid_type}),m.INVALID}if(n(this,a,"f")||r(this,a,new Set(_.util.getValidEnumValues(this._def.values)),"f"),!n(this,a,"f").has(nt.data)){const Dn=_.util.objectValues(Ft);return(0,m.addIssueToContext)(Jt,{received:Jt.data,code:s.ZodIssueCode.invalid_enum_value,options:Dn}),m.INVALID}return(0,m.OK)(nt.data)}get enum(){return this._def.values}}t.ZodNativeEnum=Ae,a=new WeakMap,Ae.create=(qt,nt)=>new Ae({values:qt,typeName:At.ZodNativeEnum,...h(nt)});class Ue extends u{unwrap(){return this._def.type}_parse(nt){const{ctx:Ft}=this._processInputParams(nt);if(Ft.parsedType!==_.ZodParsedType.promise&&Ft.common.async===!1)return(0,m.addIssueToContext)(Ft,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.promise,received:Ft.parsedType}),m.INVALID;const Jt=Ft.parsedType===_.ZodParsedType.promise?Ft.data:Promise.resolve(Ft.data);return(0,m.OK)(Jt.then(Dn=>this._def.type.parseAsync(Dn,{path:Ft.path,errorMap:Ft.common.contextualErrorMap})))}}t.ZodPromise=Ue,Ue.create=(qt,nt)=>new Ue({type:qt,typeName:At.ZodPromise,...h(nt)});class Ye extends u{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===At.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt),Dn=this._def.effect||null,Fn={addIssue:Bi=>{(0,m.addIssueToContext)(Jt,Bi),Bi.fatal?Ft.abort():Ft.dirty()},get path(){return Jt.path}};if(Fn.addIssue=Fn.addIssue.bind(Fn),Dn.type==="preprocess"){const Bi=Dn.transform(Jt.data,Fn);if(Jt.common.async)return Promise.resolve(Bi).then(async Mi=>{if(Ft.value==="aborted")return m.INVALID;const Xi=await this._def.schema._parseAsync({data:Mi,path:Jt.path,parent:Jt});return Xi.status==="aborted"?m.INVALID:Xi.status==="dirty"||Ft.value==="dirty"?(0,m.DIRTY)(Xi.value):Xi});{if(Ft.value==="aborted")return m.INVALID;const Mi=this._def.schema._parseSync({data:Bi,path:Jt.path,parent:Jt});return Mi.status==="aborted"?m.INVALID:Mi.status==="dirty"||Ft.value==="dirty"?(0,m.DIRTY)(Mi.value):Mi}}if(Dn.type==="refinement"){const Bi=Mi=>{const Xi=Dn.refinement(Mi,Fn);if(Jt.common.async)return Promise.resolve(Xi);if(Xi instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Mi};if(Jt.common.async===!1){const Mi=this._def.schema._parseSync({data:Jt.data,path:Jt.path,parent:Jt});return Mi.status==="aborted"?m.INVALID:(Mi.status==="dirty"&&Ft.dirty(),Bi(Mi.value),{status:Ft.value,value:Mi.value})}else return this._def.schema._parseAsync({data:Jt.data,path:Jt.path,parent:Jt}).then(Mi=>Mi.status==="aborted"?m.INVALID:(Mi.status==="dirty"&&Ft.dirty(),Bi(Mi.value).then(()=>({status:Ft.value,value:Mi.value}))))}if(Dn.type==="transform")if(Jt.common.async===!1){const Bi=this._def.schema._parseSync({data:Jt.data,path:Jt.path,parent:Jt});if(!(0,m.isValid)(Bi))return Bi;const Mi=Dn.transform(Bi.value,Fn);if(Mi instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Ft.value,value:Mi}}else return this._def.schema._parseAsync({data:Jt.data,path:Jt.path,parent:Jt}).then(Bi=>(0,m.isValid)(Bi)?Promise.resolve(Dn.transform(Bi.value,Fn)).then(Mi=>({status:Ft.value,value:Mi})):Bi);_.util.assertNever(Dn)}}t.ZodEffects=Ye,t.ZodTransformer=Ye,Ye.create=(qt,nt,Ft)=>new Ye({schema:qt,typeName:At.ZodEffects,effect:nt,...h(Ft)}),Ye.createWithPreprocess=(qt,nt,Ft)=>new Ye({schema:nt,effect:{type:"preprocess",transform:qt},typeName:At.ZodEffects,...h(Ft)});class Ke extends u{_parse(nt){return this._getType(nt)===_.ZodParsedType.undefined?(0,m.OK)(void 0):this._def.innerType._parse(nt)}unwrap(){return this._def.innerType}}t.ZodOptional=Ke,Ke.create=(qt,nt)=>new Ke({innerType:qt,typeName:At.ZodOptional,...h(nt)});class mt extends u{_parse(nt){return this._getType(nt)===_.ZodParsedType.null?(0,m.OK)(null):this._def.innerType._parse(nt)}unwrap(){return this._def.innerType}}t.ZodNullable=mt,mt.create=(qt,nt)=>new mt({innerType:qt,typeName:At.ZodNullable,...h(nt)});class _t extends u{_parse(nt){const{ctx:Ft}=this._processInputParams(nt);let Jt=Ft.data;return Ft.parsedType===_.ZodParsedType.undefined&&(Jt=this._def.defaultValue()),this._def.innerType._parse({data:Jt,path:Ft.path,parent:Ft})}removeDefault(){return this._def.innerType}}t.ZodDefault=_t,_t.create=(qt,nt)=>new _t({innerType:qt,typeName:At.ZodDefault,defaultValue:typeof nt.default=="function"?nt.default:()=>nt.default,...h(nt)});class Mt extends u{_parse(nt){const{ctx:Ft}=this._processInputParams(nt),Jt={...Ft,common:{...Ft.common,issues:[]}},Dn=this._def.innerType._parse({data:Jt.data,path:Jt.path,parent:{...Jt}});return(0,m.isAsync)(Dn)?Dn.then(Fn=>({status:"valid",value:Fn.status==="valid"?Fn.value:this._def.catchValue({get error(){return new s.ZodError(Jt.common.issues)},input:Jt.data})})):{status:"valid",value:Dn.status==="valid"?Dn.value:this._def.catchValue({get error(){return new s.ZodError(Jt.common.issues)},input:Jt.data})}}removeCatch(){return this._def.innerType}}t.ZodCatch=Mt,Mt.create=(qt,nt)=>new Mt({innerType:qt,typeName:At.ZodCatch,catchValue:typeof nt.catch=="function"?nt.catch:()=>nt.catch,...h(nt)});class ct extends u{_parse(nt){if(this._getType(nt)!==_.ZodParsedType.nan){const Jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(Jt,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.nan,received:Jt.parsedType}),m.INVALID}return{status:"valid",value:nt.data}}}t.ZodNaN=ct,ct.create=qt=>new ct({typeName:At.ZodNaN,...h(qt)}),t.BRAND=Symbol("zod_brand");class wt extends u{_parse(nt){const{ctx:Ft}=this._processInputParams(nt),Jt=Ft.data;return this._def.type._parse({data:Jt,path:Ft.path,parent:Ft})}unwrap(){return this._def.type}}t.ZodBranded=wt;class st extends u{_parse(nt){const{status:Ft,ctx:Jt}=this._processInputParams(nt);if(Jt.common.async)return(async()=>{const Fn=await this._def.in._parseAsync({data:Jt.data,path:Jt.path,parent:Jt});return Fn.status==="aborted"?m.INVALID:Fn.status==="dirty"?(Ft.dirty(),(0,m.DIRTY)(Fn.value)):this._def.out._parseAsync({data:Fn.value,path:Jt.path,parent:Jt})})();{const Dn=this._def.in._parseSync({data:Jt.data,path:Jt.path,parent:Jt});return Dn.status==="aborted"?m.INVALID:Dn.status==="dirty"?(Ft.dirty(),{status:"dirty",value:Dn.value}):this._def.out._parseSync({data:Dn.value,path:Jt.path,parent:Jt})}}static create(nt,Ft){return new st({in:nt,out:Ft,typeName:At.ZodPipeline})}}t.ZodPipeline=st;class rt extends u{_parse(nt){const Ft=this._def.innerType._parse(nt),Jt=Dn=>((0,m.isValid)(Dn)&&(Dn.value=Object.freeze(Dn.value)),Dn);return(0,m.isAsync)(Ft)?Ft.then(Dn=>Jt(Dn)):Jt(Ft)}unwrap(){return this._def.innerType}}t.ZodReadonly=rt,rt.create=(qt,nt)=>new rt({innerType:qt,typeName:At.ZodReadonly,...h(nt)});function lt(qt,nt={},Ft){return qt?ie.create().superRefine((Jt,Dn)=>{var Fn,Bi;if(!qt(Jt)){const Mi=typeof nt=="function"?nt(Jt):typeof nt=="string"?{message:nt}:nt,Xi=(Bi=(Fn=Mi.fatal)!==null&&Fn!==void 0?Fn:Ft)!==null&&Bi!==void 0?Bi:!0,vi=typeof Mi=="string"?{message:Mi}:Mi;Dn.addIssue({code:"custom",...vi,fatal:Xi})}}):ie.create()}t.custom=lt,t.late={object:te.lazycreate};var At;(function(qt){qt.ZodString="ZodString",qt.ZodNumber="ZodNumber",qt.ZodNaN="ZodNaN",qt.ZodBigInt="ZodBigInt",qt.ZodBoolean="ZodBoolean",qt.ZodDate="ZodDate",qt.ZodSymbol="ZodSymbol",qt.ZodUndefined="ZodUndefined",qt.ZodNull="ZodNull",qt.ZodAny="ZodAny",qt.ZodUnknown="ZodUnknown",qt.ZodNever="ZodNever",qt.ZodVoid="ZodVoid",qt.ZodArray="ZodArray",qt.ZodObject="ZodObject",qt.ZodUnion="ZodUnion",qt.ZodDiscriminatedUnion="ZodDiscriminatedUnion",qt.ZodIntersection="ZodIntersection",qt.ZodTuple="ZodTuple",qt.ZodRecord="ZodRecord",qt.ZodMap="ZodMap",qt.ZodSet="ZodSet",qt.ZodFunction="ZodFunction",qt.ZodLazy="ZodLazy",qt.ZodLiteral="ZodLiteral",qt.ZodEnum="ZodEnum",qt.ZodEffects="ZodEffects",qt.ZodNativeEnum="ZodNativeEnum",qt.ZodOptional="ZodOptional",qt.ZodNullable="ZodNullable",qt.ZodDefault="ZodDefault",qt.ZodCatch="ZodCatch",qt.ZodPromise="ZodPromise",qt.ZodBranded="ZodBranded",qt.ZodPipeline="ZodPipeline",qt.ZodReadonly="ZodReadonly"})(At||(t.ZodFirstPartyTypeKind=At={}));class jt{constructor(...nt){}}const _n=(qt,nt={message:`Input not instance of ${qt.name}`})=>lt(Ft=>Ft instanceof qt,nt);t.instanceof=_n;const In=G.create;t.string=In;const ci=$.create;t.number=ci;const xn=ct.create;t.nan=xn;const dn=V.create;t.bigint=dn;const jn=H.create;t.boolean=jn;const sn=K.create;t.date=sn;const at=Y.create;t.symbol=at;const $e=X.create;t.undefined=$e;const Oe=oe.create;t.null=Oe;const Le=ie.create;t.any=Le;const ze=he.create;t.unknown=ze;const St=me.create;t.never=St;const $t=q.create;t.void=$t;const On=Ee.create;t.array=On;const Bn=te.create;t.object=Bn;const ui=te.strictCreate;t.strictObject=ui;const li=fe.create;t.union=li;const Ni=Me.create;t.discriminatedUnion=Ni;const Rn=Pe.create;t.intersection=Rn;const Cn=we.create;t.tuple=Cn;const $n=_e.create;t.record=$n;const Si=Ne.create;t.map=Si;const Ui=Te.create;t.set=Ui;const bi=We.create;t.function=bi;const un=pe.create;t.lazy=un;const Vn=re.create;t.literal=Vn;const Xt=De.create;t.enum=Xt;const Qe=Ae.create;t.nativeEnum=Qe;const vt=Ue.create;t.promise=vt;const pt=Ye.create;t.effect=pt,t.transformer=pt;const gt=Ke.create;t.optional=gt;const nn=mt.create;t.nullable=nn;const Gt=Ye.createWithPreprocess;t.preprocess=Gt;const Kt=st.create;t.pipeline=Kt;const vn=()=>In().optional();t.ostring=vn;const Hn=()=>ci().optional();t.onumber=Hn;const Jn=()=>jn().optional();t.oboolean=Jn,t.coerce={string:qt=>G.create({...qt,coerce:!0}),number:qt=>$.create({...qt,coerce:!0}),boolean:qt=>H.create({...qt,coerce:!0}),bigint:qt=>V.create({...qt,coerce:!0}),date:qt=>K.create({...qt,coerce:!0})},t.NEVER=m.INVALID},79682:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChromeDevtoolsContribution=void 0;const r=e(85608),o=e(76003),a=e(41869),p=e(65265),v=e(98295),m=e(27654);let _=n=class extends a.Disposable{constructor(){super(...arguments),this.lantencyHandler=g=>{const{command:l}=g.detail;l===p.DevtoolsLantencyCommand.Start?this.interval||this.startRTTInterval():l===p.DevtoolsLantencyCommand.Stop&&this.interval&&(clearInterval(this.interval),this.interval=void 0)}}initialize(){var g;this.appConfig.devtools&&(window.addEventListener(p.EDevtoolsEvent.Latency,this.lantencyHandler),this.addDispose(a.Disposable.create(()=>{window.removeEventListener(p.EDevtoolsEvent.Latency,this.lantencyHandler),this.interval&&(clearInterval(this.interval),this.interval=void 0)})),!((g=window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__)===null||g===void 0)&&g.captureRPC&&(this.interval||this.startRTTInterval()))}startRTTInterval(){this.interval=setInterval(async()=>{const g=Date.now();await this.rttService.measure();const l=Date.now()-g;window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.captureRPC&&(window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.latency=l)},n.INTERVAL)}};t.ChromeDevtoolsContribution=_,_.INTERVAL=1e3,r.__decorate([(0,o.Autowired)(a.AppConfig),r.__metadata("design:type",Object)],_.prototype,"appConfig",void 0),r.__decorate([(0,o.Autowired)(m.ConnectionRTTBrowserServiceToken),r.__metadata("design:type",m.ConnectionRTTBrowserService)],_.prototype,"rttService",void 0),t.ChromeDevtoolsContribution=_=n=r.__decorate([(0,v.Domain)(a.ClientAppContribution)],_)},72915:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionRTTContribution=void 0;const r=e(85608),o=e(76003),a=e(26542),p=e(92323),v=e(98295),m=e(27654),_={id:"connection.start.rtt",label:"%connection.start.rtt%",category:"%command.category.developerTools%"},s={id:"connection.stop.rtt",label:"%connection.stop.rtt%",category:"%command.category.developerTools%"},g={alignment:a.StatusBarAlignment.LEFT,priority:1/0-1};let l=n=class{registerCommands(u){u.registerCommand(_,{execute:()=>{this.interval||this.startRTTInterval()}}),u.registerCommand(s,{execute:()=>{this.interval&&(clearInterval(this.interval),this.statusBar&&(this.statusBar.dispose(),this.statusBar=void 0))}})}startRTTInterval(){this.interval=setInterval(async()=>{const u=Date.now();await this.rttService.measure();const E={text:`${Date.now()-u}ms`};if(this.statusBar)this.statusBar.update({...E,...g});else{const f=this.statusBarService.addElement("connection-rtt",{...E,...g});this.statusBar=f}},n.INTERVAL)}};t.ConnectionRTTContribution=l,l.INTERVAL=1e3,r.__decorate([(0,o.Autowired)(a.IStatusBarService),r.__metadata("design:type",Object)],l.prototype,"statusBarService",void 0),r.__decorate([(0,o.Autowired)(m.ConnectionRTTBrowserServiceToken),r.__metadata("design:type",m.ConnectionRTTBrowserService)],l.prototype,"rttService",void 0),t.ConnectionRTTContribution=l=n=r.__decorate([(0,v.Domain)(p.CommandContribution)],l)},27654:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionRTTBrowserService=t.ConnectionRTTBrowserServiceToken=void 0;const n=e(85608),r=e(76003),o=e(69452);t.ConnectionRTTBrowserServiceToken=Symbol("ConnectionRTTBrowserService");let a=class{async measure(){await this.connectionBackService.$measure()}};t.ConnectionRTTBrowserService=a,n.__decorate([(0,r.Autowired)(o.ConnectionBackServicePath),n.__metadata("design:type",Object)],a.prototype,"connectionBackService",void 0),t.ConnectionRTTBrowserService=a=n.__decorate([(0,r.Injectable)()],a)},17631:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDropContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(43718),p=e(69452);let v=class extends a.WithEventBus{onDidDropFile(_){this.dropService.onDidDropFile(_)}};t.FileDropContribution=v,n.__decorate([(0,r.Autowired)(p.IFileDropFrontendServiceToken),n.__metadata("design:type",Object)],v.prototype,"dropService",void 0),n.__decorate([(0,a.OnEvent)(a.FileTreeDropEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[a.FileTreeDropEvent]),n.__metadata("design:returntype",void 0)],v.prototype,"onDidDropFile",null),t.FileDropContribution=v=n.__decorate([(0,r.Injectable)(),(0,o.Domain)(o.ClientAppContribution)],v)},22874:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDropService=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(26542),p=e(43718),v=e(42933),{Path:m}=p.path,_=e(69452);let s=class extends p.WithEventBus{constructor(){super(...arguments),this.pending=new Set}onDidUploadFileStart(l){this.pending.add(l),this.createOrUpdateStatusBar()}onDidUploadFileEnd(l){this.pending.delete(l),this.createOrUpdateStatusBar()}createOrUpdateStatusBar(l){if(this.pending.size===0){this.uploadStatus&&(this.uploadStatus.dispose(),this.uploadStatus=void 0);return}const h="sumi-upload-file-status",u=(0,o.formatLocalize)("workbench.uploadingFiles",this.pending.size,l||"0 MB"),d={text:u,alignment:a.StatusBarAlignment.RIGHT,tooltip:u,iconClass:"kaitian-icon kticon-cloud-server"};this.uploadStatus?this.uploadStatus.update({id:h,...d}):this.uploadStatus=this.statusBarService.addElement(h,d)}onDidDropFile(l){var h;const{payload:{event:u,targetDir:d}}=l;if(!d||!(!((h=u.dataTransfer)===null||h===void 0)&&h.files)||u.dataTransfer.files.length===0)return;const E=u.dataTransfer.items;let f=0;const c=Date.now(),y=b=>{f+=b;const A=Date.now(),D=`${(f/((A-c)/1e3)/1024/1024).toFixed(2)} MB`;this.createOrUpdateStatusBar(D)};for(const b of E){const A=b.webkitGetAsEntry();this.processFilesEntry(d,A,y)}}async processFilesEntry(l,h,u){if(h.isFile)this.processFileEntry(h,l,u);else{const d=p.Uri.file(new m(l).join(h.fullPath).toString()).toString();await this.fs.createFolder(d),this.processDirEntry(h,l,u)}}toBinaryString(l){let h;const u=l.length;let d="";for(h=0;h<u;h+=1)d+=String.fromCharCode(l[h]);return d}async doUploadFile(l,h,u){var d;const E=new m(h).join(l.name).toString();this.onDidUploadFileStart(E.toString()),await this.fs.createFile(p.Uri.file(E.toString()).toString()),await this.dropService.$ensureFileExist(l.name,h);const f=l.stream().getReader();let c=await f.read();for(;!c.done;)await this.dropService.$writeStream(this.toBinaryString(c.value),l.name,h,c.done),u((d=c.value)===null||d===void 0?void 0:d.byteLength),c=await f.read();c.done&&this.onDidUploadFileEnd(E.toString())}processFileEntry(l,h,u){l.file(d=>{const E=new File([d],l.fullPath,{type:l.type});this.doUploadFile(E,h,u)},()=>{})}processDirEntry(l,h,u){l.createReader().readEntries(E=>{E.forEach(async f=>{this.processFilesEntry(h,f,u)})},()=>{})}};t.FileDropService=s,n.__decorate([(0,r.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],s.prototype,"fs",void 0),n.__decorate([(0,r.Autowired)(_.FileDropServicePath),n.__metadata("design:type",Object)],s.prototype,"dropService",void 0),n.__decorate([(0,r.Autowired)(a.IStatusBarService),n.__metadata("design:type",Object)],s.prototype,"statusBarService",void 0),t.FileDropService=s=n.__decorate([(0,r.Injectable)()],s)},79240:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSearchContribution=t.FileSearchQuickCommandHandler=t.matchLineReg=t.quickGoToSymbol=t.quickFileOpen=void 0,t.getValidateInput=y;const n=e(85608),r=n.__importDefault(e(39050)),o=e(76003),a=e(41869),p=e(26542),v=e(43718),m=e(98295),_=e(54414),s=e(17459),g=e(84660),l=n.__importStar(e(20868)),h=e(97821),u=e(80490),d=e(51500),E=e(30981),f=200;t.quickFileOpen={id:"workbench.action.quickOpen",category:"File",label:"Open File..."},t.quickGoToSymbol={id:"workbench.action.gotoSymbol",category:"File",label:"Open File Symbol..."},t.matchLineReg=/^([^:#(]*)[:#(]?L?(\d+)?[:,]?(\d+)?\)?/;function c(I=""){const w=I.match(t.matchLineReg)||[];if(w.length<2)return;const T={line:Number(w[2]||0),start:Number(w[3]||0)};return new l.Range(T.line,T.start,T.line,T.start)}function y(I){return I.replace(t.matchLineReg,"$1")}let b=class extends h.QuickOpenBaseAction{constructor(){super({id:"file-search:splitToRight",tooltip:(0,a.localize)("quickOpen.openOnTheRightSide"),class:(0,a.getIcon)("embed")})}async run(w){await this.commandService.executeCommand(a.EDITOR_COMMANDS.OPEN_RESOURCE.id,w.getUri(),{preview:!1,split:_.EditorGroupSplitAction.Right,range:c(this.injector.get(S).currentLookFor),focus:!0})}};n.__decorate([(0,o.Autowired)(a.CommandService),n.__metadata("design:type",Object)],b.prototype,"commandService",void 0),n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],b.prototype,"injector",void 0),b=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],b);let A=class{hasActions(){return!0}getActions(){return[this.fileSearchActionLeftRight]}getValidateInput(w){return y(w)}};n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",b)],A.prototype,"fileSearchActionLeftRight",void 0),A=n.__decorate([(0,o.Injectable)()],A);let S=class{constructor(){this.cancelIndicator=new v.CancellationTokenSource,this.default=!0,this.prefix="...",this.description=(0,a.localize)("file-search.command.fileOpen.description"),this.prevEditorState={},this.currentLookFor=""}getModel(){return{onType:async(w,T)=>{this.cancelIndicator.cancel(),this.cancelIndicator=new v.CancellationTokenSource;const R=this.cancelIndicator.token,P=new Set;let O=[];w=w.trim().replace(/\s/g,""),this.currentLookFor=w;const M=y(w),k=this.reporterService.time(v.REPORT_NAME.QUICK_OPEN_MEASURE),F=await this.getRecentlyItems(P,M,R);if(w&&(this.logger.debug("lookFor",w,M),O=await this.getFindOutItems(P,M,R)),R.isCancellationRequested)return;const L=F.concat(O);T(L,L.length?this.fileSearchActionProvider:void 0),k.timeEnd(w.indexOf("@")>-1?"file-symbol":"file",{lookFor:w,stat:{recently:F.length,find:O.length}})}}}getOptions(){return{placeholder:(0,a.localize)("file-search.command.fileOpen.placeholder"),fuzzyMatchLabel:{enableSeparateSubstringMatching:!0},showItemsWithoutHighlight:!0,fuzzyMatchDescription:{enableSeparateSubstringMatching:!0},getPlaceholderItem:w=>new a.QuickOpenItem({label:(0,a.localize)(w.indexOf("@")>-1?"search.fileSymbolResults.notfound":"search.fileResults.notfound"),run:()=>!1})}}onClose(w){w&&this.prevEditorState.uri&&(this.workbenchEditorService.open(this.prevEditorState.uri,{range:this.prevEditorState.range}),this.prevEditorState={}),this.prevSelected=void 0,this.cancelIndicator.cancel()}onToggle(){this.cancelIndicator.cancel()}trySaveEditorState(){var w;if(this.workbenchEditorService.currentResource){let T={startColumn:1,startLineNumber:1,endColumn:1,endLineNumber:1};const R=(w=this.workbenchEditorService.currentEditor)===null||w===void 0?void 0:w.getSelections();if(R){const{selectionStartLineNumber:P,selectionStartColumn:O,positionLineNumber:M,positionColumn:k}=R[0];T=new l.Range(P,O,M,k)}this.prevEditorState={uri:this.workbenchEditorService.currentResource.uri,range:T}}}async getFindOutItems(w,T,R){var P;let O;if(T.indexOf("@")>-1){this.trySaveEditorState(),O=[];const[M,k]=T.split("@");let F;if(this.prevSelected)F=this.prevSelected.withoutFragment();else if(M){const L=await this.getQueryFiles(M,w,R);L.length&&(F=L[0].getUri())}else F=(P=this.workbenchEditorService.currentResource)===null||P===void 0?void 0:P.uri;if(F){const L=await this.documentSymbolStore.getDocumentSymbolAsync(F)||[],B=[];this.flattenSymbols({children:L},B),O=B.filter(W=>{const j=(0,E.matchesFuzzy)(k,W.name,!0)||[];return j&&(W.labelHighlights=j),j&&j.length}).map((W,j)=>{var Q;return new a.QuickOpenItem({uri:F,label:W.name,iconClass:(0,a.getSymbolIcon)(W.kind),description:(Q=W.parent)===null||Q===void 0?void 0:Q.name,labelHighlights:W.labelHighlights,groupLabel:j===0?(0,a.formatLocalize)("search.fileSymbolResults",B.length):"",showBorder:!1,run:G=>G===a.Mode.PREVIEW?(this.locateSymbol(F,W),!0):G===a.Mode.OPEN?(this.locateSymbol(F,W),!0):!1})})}else return[]}else if(O=await this.getQueryFiles(T,w,R),O[0]){const M=await this.getItems([O[0].getUri().codeUri.fsPath],{groupLabel:(0,a.localize)("search.fileResults"),showBorder:!0});O[0]=M[0]}return O}async getQueryFiles(w,T,R){const O=(await this.workspaceService.roots).map(F=>new a.URI(F.uri).codeUri.fsPath),M=await this.fileSearchService.find(w,{rootUris:O,fuzzyMatch:!0,limit:f,useGitIgnore:!0,noIgnoreParent:!0,excludePatterns:this.getPreferenceSearchExcludes()},R),k=await this.getItems(M.filter(F=>T.has(F)||R.isCancellationRequested?!1:(T.add(F),!0)),{});return k.sort(this.compareItems.bind(this)),k}async flattenSymbols(w,T){w.children.forEach(R=>{T.push(R),R.children&&this.flattenSymbols(R,T)})}async getRecentlyItems(w,T,R){const P=await this.recentFilesManager.getMostRecentlyOpenedFiles(!0)||[];return await this.getItems(P.filter(O=>{const M=new a.URI(O);return w.has(O)||!r.default.test(T,M.displayName)||R.isCancellationRequested?!1:(w.add(O),!0)}),{groupLabel:(0,a.localize)("search.historyMatches")})}async getItems(w,T){const R=[];for(const[P,O]of w.entries()){const M=a.URI.isUriString(O)?new a.URI(O):a.URI.file(O),k=`file-icon ${this.labelService.getIcon(M.withoutFragment())}`;let F="";const L=await this.workspaceService.asRelativePath(M.parent);L&&(this.workspaceService.isMultiRootWorkspaceOpened?F=`${new a.URI(L.root).displayName}${L.path?` \u30FB ${L.path}`:""}`:F=L.path||"");const B=new a.QuickOpenItem({uri:M,label:M.displayName,tooltip:O,iconClass:k,description:F,groupLabel:P===0?T.groupLabel:"",showBorder:w.length>0&&P===0?T.showBorder:!1,run:U=>(U===a.Mode.PREVIEW&&(this.prevSelected=M),U===a.Mode.OPEN?(this.openFile(M),!0):!1)});R.push(B)}return R}openFile(w){const T=w.codeUri.fsPath;let R=c(this.currentLookFor);(!R||!R.startLineNumber&&!R.startColumn)&&(R=c(w.fragment?"#"+w.fragment:T)),this.currentLookFor="",this.commandService.executeCommand(a.EDITOR_COMMANDS.OPEN_RESOURCE.id,w.withoutFragment(),{preview:!1,range:R,focus:!0})}locateSymbol(w,T){this.workbenchEditorService.open(w,{range:T.range,preview:!0})}compareItems(w,T,R="getLabel"){function P(U){return U.trim().toLowerCase()}const O=P(y(this.currentLookFor));function M(U){const W=r.default.match(O,U);return W===null?0:W.score}let k=w[R](),F=T[R]();typeof k!="string"&&(k=k.path.toString()),typeof F!="string"&&(F=F.path.toString()),k=P(k),F=P(F);const L=M(k),B=M(F);if(L===B){const U=k.indexOf(O),W=F.indexOf(O);return U===W?k.length!==F.length?k.length<F.length?-1:1:F.localeCompare(k)===0?R==="getUri"?0:this.compareItems(w,T,"getUri"):F.localeCompare(k):U-W}return B-L}getPreferenceSearchExcludes(){const w=[],T=this.preferenceService.get("files.exclude"),R=this.preferenceService.get("search.exclude"),P=Object.assign({},T,R);for(const O of Object.keys(P))P[O]&&w.push(O);return w}};t.FileSearchQuickCommandHandler=S,n.__decorate([(0,o.Autowired)(a.CommandService),n.__metadata("design:type",Object)],S.prototype,"commandService",void 0),n.__decorate([(0,o.Autowired)(g.FileSearchServicePath),n.__metadata("design:type",Object)],S.prototype,"fileSearchService",void 0),n.__decorate([(0,o.Autowired)(_.WorkbenchEditorService),n.__metadata("design:type",_.WorkbenchEditorService)],S.prototype,"workbenchEditorService",void 0),n.__decorate([(0,o.Autowired)(s.DocumentSymbolStore),n.__metadata("design:type",s.DocumentSymbolStore)],S.prototype,"documentSymbolStore",void 0),n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",p.LabelService)],S.prototype,"labelService",void 0),n.__decorate([(0,o.Autowired)(d.IWorkspaceService),n.__metadata("design:type",Object)],S.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(a.RecentFilesManager),n.__metadata("design:type",a.RecentFilesManager)],S.prototype,"recentFilesManager",void 0),n.__decorate([(0,o.Autowired)(a.ILogger),n.__metadata("design:type",Object)],S.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",A)],S.prototype,"fileSearchActionProvider",void 0),n.__decorate([(0,o.Autowired)(a.PreferenceService),n.__metadata("design:type",Object)],S.prototype,"preferenceService",void 0),n.__decorate([(0,o.Autowired)(v.IReporterService),n.__metadata("design:type",Object)],S.prototype,"reporterService",void 0),t.FileSearchQuickCommandHandler=S=n.__decorate([(0,o.Injectable)()],S);let D=class{registerQuickOpenHandlers(w){w.registerHandler(this.fileSearchQuickCommandHandler,{title:(0,a.localize)("quickopen.tab.file"),commandId:t.quickFileOpen.id,order:1})}registerCommands(w){w.registerCommand(t.quickFileOpen,{execute:()=>this.quickOpenService.open("...")}),w.registerCommand(t.quickGoToSymbol,{execute:()=>this.quickOpenService.open("...@")})}registerKeybindings(w){w.registerKeybinding({command:t.quickFileOpen.id,keybinding:"ctrlcmd+p"})}};t.FileSearchContribution=D,n.__decorate([(0,o.Autowired)(S),n.__metadata("design:type",S)],D.prototype,"fileSearchQuickCommandHandler",void 0),n.__decorate([(0,o.Autowired)(h.PrefixQuickOpenService),n.__metadata("design:type",Object)],D.prototype,"quickOpenService",void 0),t.FileSearchContribution=D=n.__decorate([(0,m.Domain)(v.CommandContribution,a.KeybindingContribution,u.QuickOpenContribution)],D)},73827:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClientAddonModule=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(69452),p=e(79682),v=e(72915),m=e(27654),_=e(17631),s=e(22874),g=e(79240),l=e(18256),h=e(7756),u=e(16426);let d=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[p.ChromeDevtoolsContribution,l.LanguageChangeHintContribution,g.FileSearchContribution,h.StatusBarContribution,u.ToolbarCustomizeContribution,_.FileDropContribution,v.ConnectionRTTContribution,{token:a.IFileDropFrontendServiceToken,useClass:s.FileDropService},{token:m.ConnectionRTTBrowserServiceToken,useClass:m.ConnectionRTTBrowserService}],this.backServices=[{servicePath:a.FileDropServicePath},{servicePath:a.ConnectionBackServicePath}]}};t.ClientAddonModule=d,t.ClientAddonModule=d=n.__decorate([(0,r.Injectable)()],d)},18256:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageChangeHintContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(72665);let p=class{onStart(){this.preferenceService.onSpecificPreferenceChange(o.GeneralSettingsId.Language,async m=>{(0,o.setLanguageId)(m.newValue),this.preferenceService.get("general.askReloadOnLanguageChange")&&await this.dialogService.info((0,o.localize)("preference.general.language.change.refresh.info","After changing the language, it should be restarted to take effect. Will it be refreshed immediately?"),[(0,o.localize)("preference.general.language.change.refresh.later","Later"),(0,o.localize)("preference.general.language.change.refresh.now","Now")])===(0,o.localize)("preference.general.language.change.refresh.now","Now")&&this.clientApp.fireOnReload()})}};t.LanguageChangeHintContribution=p,n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],p.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.IClientApp),n.__metadata("design:type",Object)],p.prototype,"clientApp",void 0),n.__decorate([(0,r.Autowired)(a.IDialogService),n.__metadata("design:type",Object)],p.prototype,"dialogService",void 0),t.LanguageChangeHintContribution=p=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],p)},7756:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatusBarContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(43718);let p=class extends a.WithEventBus{onStart(){}handleBrowserConnectionOpen(){this.commandService.executeCommand("statusbar.changeBackgroundColor","var(--statusBar-background)"),this.logger.log("Browser connection open, change status bar background color")}handleBrowserConnectionClose(){this.commandService.executeCommand("statusbar.changeBackgroundColor","var(--kt-statusbar-offline-background)"),this.logger.log("Browser connection close, change status bar background color")}};t.StatusBarContribution=p,n.__decorate([(0,r.Autowired)(a.CommandService),n.__metadata("design:type",Object)],p.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(a.ILogger),n.__metadata("design:type",Object)],p.prototype,"logger",void 0),n.__decorate([(0,a.OnEvent)(a.BrowserConnectionOpenEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],p.prototype,"handleBrowserConnectionOpen",null),n.__decorate([(0,a.OnEvent)(a.BrowserConnectionCloseEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],p.prototype,"handleBrowserConnectionClose",null),t.StatusBarContribution=p=n.__decorate([(0,a.Domain)(o.ClientAppContribution)],p)},16426:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToolbarCustomizeContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(93899),p=e(62132);let v=class{registerCommands(_){_.registerCommand({id:"toolbar.showCustomizePanel",label:"Show Toolbar Customization"},{execute:()=>{this.viewService.setVisible(!0)}})}registerComponent(_){_.register("addon/toolbar-customize",{id:"addon/toolbar-customize",component:p.ToolbarCustomizeComponent}),this.config.layoutConfig[o.SlotLocation.extra]||(this.config.layoutConfig[o.SlotLocation.extra]={modules:[]}),this.config.layoutConfig[o.SlotLocation.extra].modules.push("addon/toolbar-customize")}registerMenus(_){_.registerMenuItem(a.MenuId.KTToolbarLocationContext,{command:{id:"toolbar.showCustomizePanel",label:(0,o.localize)("toolbar.customize.menu")}})}};t.ToolbarCustomizeContribution=v,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],v.prototype,"config",void 0),n.__decorate([(0,r.Autowired)(p.ToolbarCustomizeViewService),n.__metadata("design:type",p.ToolbarCustomizeViewService)],v.prototype,"viewService",void 0),t.ToolbarCustomizeContribution=v=n.__decorate([(0,o.Domain)(o.CommandContribution,o.ComponentContribution,a.MenuContribution)],v)},62132:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToolbarCustomizeComponent=t.ToolbarCustomizeViewService=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(76003),a=e(97267),p=e(41869),v=n.__importDefault(e(18541));let m=class{bindSetVisibleHandle(g){this._setVisible=g}setVisible(g){this._setVisible(g)}async toggleActionVisibility(g,l,h){const u=this.preferenceService.getValid("toolbar.ignoreActions",{});if(u[g]||(u[g]=[]),!h)u[g].indexOf(l)===-1&&u[g].push(l);else{const E=u[g].indexOf(l);E!==-1&&u[g].splice(E,1)}const d=this.preferenceService.inspect("toolbar.ignoreActions").workspaceValue?p.PreferenceScope.Workspace:p.PreferenceScope.User;await this.preferenceService.set("toolbar.ignoreActions",u,d)}};t.ToolbarCustomizeViewService=m,n.__decorate([(0,o.Autowired)(p.PreferenceService),n.__metadata("design:type",Object)],m.prototype,"preferenceService",void 0),t.ToolbarCustomizeViewService=m=n.__decorate([(0,o.Injectable)()],m);const _=()=>{const[s,g]=r.default.useState(!1),l=(0,p.useInjectable)(m),h=(0,p.useInjectable)(p.IToolbarRegistry),u=(0,p.useInjectable)(p.PreferenceService);if(l.bindSetVisibleHandle(g),!s)return null;const d=h.getAllLocations(),E=u.get("toolbar.ignoreActions")||{};let f=u.get("toolbar.buttonDisplay","iconAndText");function c(y){const b=[{id:"_head"},...h.getActionGroups(y)||[],{id:"_tail"}],A=[],S=E[y]||[];return b.forEach((D,I)=>{const w=h.getToolbarActions({location:y,group:D.id});w&&w.actions.length>0&&(A.length>0&&A.push(r.default.createElement("div",{className:v.default["group-split"],key:"split-"+I})),w.actions.forEach((T,R)=>{var P;let O=S.indexOf(T.id)===-1;const M="action-toggle-"+T.id;A.push(r.default.createElement("div",{className:v.default["action-item"],key:R+"_"+T.id},r.default.createElement(a.CheckBox,{onChange:()=>{l.toggleActionVisibility(y,T.id,!O),O=!O},defaultChecked:O,id:M,label:(P=T.description)!==null&&P!==void 0?P:T.id})))}))}),A.length===0?null:r.default.createElement("div",{key:y,className:v.default["toolbar-customize-location"]},A)}return r.default.createElement("div",{className:v.default["toolbar-customize-overlay"]},r.default.createElement("div",{className:v.default["toolbar-customize"]},d.map(y=>c(y)),r.default.createElement("div",{className:v.default["button-display"]},r.default.createElement("div",null,(0,p.localize)("toolbar-customize.buttonDisplay.description")),r.default.createElement(a.Select,{options:[{label:(0,p.localize)("toolbar-customize.buttonDisplay.icon"),value:"icon"},{label:(0,p.localize)("toolbar-customize.buttonDisplay.iconAndText"),value:"iconAndText"}],value:f,onChange:y=>{const b=u.inspect("toolbar.buttonDisplay").workspaceValue?p.PreferenceScope.Workspace:p.PreferenceScope.User;u.set("toolbar.buttonDisplay",y,b),f=y},className:v.default["button-display-select"]})),r.default.createElement("div",{className:v.default["customize-complete"]},r.default.createElement(a.Button,{type:"primary",onClick:()=>g(!1)},(0,p.localize)("toolbar-customize.complete")))))};t.ToolbarCustomizeComponent=_},69452:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IConnectionBackService=t.ConnectionBackServicePath=t.IFileDropFrontendServiceToken=t.IFileDropServiceToken=t.FileDropServicePath=void 0,t.FileDropServicePath="FileDropServicePath",t.IFileDropServiceToken=Symbol("IFileDropService"),t.IFileDropFrontendServiceToken=Symbol("IFileDropFrontendService"),t.ConnectionBackServicePath="ConnectionBackServicePath",t.IConnectionBackService=Symbol("IConnectionBackService")},77659:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeContextKey=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(50394);let p=class{get contextKeyService(){return this._contextKeyService}constructor(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.inlineChatIsVisible=a.InlineChatIsVisible.bind(this._contextKeyService),this.inlineCompletionIsTrigger=a.InlineCompletionIsTrigger.bind(this._contextKeyService),this.inlineHintWidgetIsVisible=a.InlineHintWidgetIsVisible.bind(this._contextKeyService),this.inlineInputWidgetIsVisible=a.InlineInputWidgetIsVisible.bind(this._contextKeyService),this.inlineInputWidgetIsStreaming=a.InlineInputWidgetIsStreaming.bind(this._contextKeyService),this.inlineDiffPartialEditsIsVisible=a.InlineDiffPartialEditsIsVisible.bind(this._contextKeyService),this.codeEditsIsVisible=a.CodeEditsIsVisible.bind(this._contextKeyService)}};t.AINativeContextKey=p,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],p.prototype,"globalContextKeyService",void 0),t.AINativeContextKey=p=n.__decorate([(0,r.Injectable)(),n.__param(0,(0,r.Optional)()),n.__metadata("design:paramtypes",[Object])],p)},32016:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeBrowserContribution=t.INLINE_DIFF_MANAGER_WIDGET_ID=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(57925),p=e(50394),v=e(1149),m=e(97222),_=e(43718),s=e(82353),g=e(54414),l=e(57517),h=e(51553),u=e(63067),d=e(46507),E=e(97682),f=e(68415),c=e(96640),y=e(19413),b=e(64811),A=e(69820),S=e(98987),D=e(61282),I=e(42995),w=e(51081),T=e(59347),R=e(76154),P=e(79559),O=e(57232),M=e(72991),k=e(71863),F=e(7511),L=e(42911),B=e(72801),U=e(87817),W=e(4972),j=e(82983),Q=e(73974),G=e(33108),Z=e(77633),$=e(51221),V=e(2281),H=e(31031),K=e(95608),Y=e(38890),X=e(77886),oe=e(89060),ie=e(74353),he=e(22169),me=e(90058);t.INLINE_DIFF_MANAGER_WIDGET_ID="inline-diff-manager-widget";let q=class{constructor(){this.registerFeature()}registerMultiDiffSourceResolver(ue){return ue.registerResolver(this.chatMultiDiffResolver)}registerEditorDocumentModelContentProvider(ue){ue.registerEditorDocumentModelContentProvider(this.chatEditResourceProvider)}async initialize(){const{supportsChatAssistant:ue}=this.aiNativeConfigService.capabilities;ue&&(o.ComponentRegistryImpl.addLayoutModule(this.appConfig.layoutConfig,y.AI_CHAT_VIEW_ID,y.AI_CHAT_CONTAINER_ID),o.ComponentRegistryImpl.addLayoutModule(this.appConfig.layoutConfig,s.DESIGN_MENU_BAR_RIGHT,y.AI_CHAT_LOGO_AVATAR_ID),this.chatProxyService.registerDefaultAgent(),this.chatInternalService.init(),await this.chatManagerService.init())}registerEditorExtensionContribution(ue){const{supportsInlineChat:te,supportsInlineCompletion:fe,supportsProblemFix:Ie,supportsCodeAction:Me}=this.aiNativeConfigService.capabilities;ue(Y.InlineDiffController.ID,new c.SyncDescriptor(Y.InlineDiffController,[this.injector]),E.EditorContributionInstantiation.Lazy),Me&&ue(me.SumiLightBulbWidget.ID,me.SumiLightBulbWidget,E.EditorContributionInstantiation.Lazy),te&&(ue($.InlineChatEditorController.ID,new c.SyncDescriptor($.InlineChatEditorController,[this.injector]),E.EditorContributionInstantiation.BeforeFirstInteraction),this.inlineInputService.getInteractiveInputHandler()&&(ue(X.InlineHintController.ID,new c.SyncDescriptor(X.InlineHintController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender),ue(oe.InlineInputController.ID,new c.SyncDescriptor(oe.InlineInputController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender))),fe&&(ue(F.IntelligentCompletionsController.ID,new c.SyncDescriptor(F.IntelligentCompletionsController,[this.injector]),E.EditorContributionInstantiation.Eager),ue(M.InlineCompletionsController.ID,new c.SyncDescriptor(M.InlineCompletionsController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender)),Ie&&ue(L.ProblemFixController.ID,new c.SyncDescriptor(L.ProblemFixController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender)}onReconnect(){const{supportsMCP:ue}=this.aiNativeConfigService.capabilities;ue&&this.initMCPServers()}onDidStart(){(0,_.runWhenIdle)(()=>{const{supportsRenameSuggestions:ue,supportsInlineChat:te,supportsMCP:fe,supportsCustomLLMSettings:Ie}=this.aiNativeConfigService.capabilities,Me=this.preferenceService.getValid(o.AINativeSettingSectionsId.ChatVisibleType);Me==="always"?this.commandService.executeCommand(a.AI_CHAT_VISIBLE.id,!0):Me==="never"&&this.commandService.executeCommand(a.AI_CHAT_VISIBLE.id,!1),ue&&this.renameSingleHandler.load(),te&&this.codeActionSingleHandler.load(),Ie&&(this.preferenceService.onSpecificPreferenceChange(o.AINativeSettingSectionsId.LLMModelSelection,Be=>{const Pe=this.getModelByName(Be.newValue),we=Pe?Object.keys(Pe):[],_e=we.length?we[0]:"",Ne=this.preferenceSchemaProvider.getPreferenceProperty(o.AINativeSettingSectionsId.ModelID);this.preferenceSchemaProvider.setSchema({properties:{[o.AINativeSettingSectionsId.ModelID]:{...Ne,default:_e,defaultValue:_e,enum:we.length?we:void 0}}},!0),this.preferenceService.set(o.AINativeSettingSectionsId.ModelID,_e,Be.scope),this.preferenceSettings.setEnumLabels(o.AINativeSettingSectionsId.ModelID,we.reduce((Te,We)=>({...Te,[We]:We}),{}))}),this.preferenceService.onSpecificPreferenceChange(o.AINativeSettingSectionsId.ModelID,Be=>{const Pe=this.preferenceService.get(o.AINativeSettingSectionsId.LLMModelSelection);if(!Pe)return;const we=this.getModelByName(Pe);we&&we[Be.newValue]&&(this.preferenceService.set(o.AINativeSettingSectionsId.MaxTokens,we[Be.newValue].maxTokens,Be.scope),this.preferenceService.set(o.AINativeSettingSectionsId.ContextWindow,we[Be.newValue].contextWindow,Be.scope))})),fe&&this.initMCPServers()})}async initMCPServers(){var ue;const te=await this.storageProvider(_.STORAGE_NAMESPACE.CHAT);let fe=te.get(b.MCPServersEnabledKey,[y.BUILTIN_MCP_SERVER_NAME]);const Ie=this.preferenceService.get(o.AINativeSettingSectionsId.MCPServers,[]);let Me=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0);if(Me.scope===_.PreferenceScope.Default&&Ie.length>0){const Pe={mcpServers:{}},we=new Set([y.BUILTIN_MCP_SERVER_NAME]);Ie.forEach(_e=>{_e.type===A.MCP_SERVER_TYPE.SSE?Pe.mcpServers[_e.name]={url:_e.serverHost}:_e.type===A.MCP_SERVER_TYPE.STDIO&&(Pe.mcpServers[_e.name]={command:_e.command,args:_e.args,env:_e.env}),_e.enabled&&we.add(_e.name)}),await this.preferenceService.set("mcp",Pe,_.PreferenceScope.Workspace),Me=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0),fe=Array.from(we),te.set(b.MCPServersEnabledKey,fe)}const Be=(ue=Me.value)===null||ue===void 0?void 0:ue.mcpServers;if(this.sumiMCPServerBackendProxy.$initBuiltinMCPServer(fe.includes(y.BUILTIN_MCP_SERVER_NAME)),Be&&Object.keys(Be).length>0){const Pe=(await Promise.all(Object.keys(Be).map(async we=>await this.mcpConfigService.getServerConfigByName(we)))).filter(we=>we!==void 0);await this.sumiMCPServerBackendProxy.$initExternalMCPServers(Pe)}this.mcpConfigService.fireMCPServersChange(!0)}getModelByName(ue){switch(ue){case"deepseek":return y.deepSeekModels;case"anthropic":return y.anthropicModels;case"openai":return y.openAiNativeModels;default:return}}registerFeature(){this.contributions.getContributions().forEach(ue=>{var te,fe,Ie,Me,Be,Pe,we,_e,Ne;(te=ue.registerInlineChatFeature)===null||te===void 0||te.call(ue,this.inlineChatFeatureRegistry),(fe=ue.registerChatFeature)===null||fe===void 0||fe.call(ue,this.chatFeatureRegistry),(Ie=ue.registerResolveConflictFeature)===null||Ie===void 0||Ie.call(ue,this.resolveConflictRegistry),(Me=ue.registerRenameProvider)===null||Me===void 0||Me.call(ue,this.renameCandidatesProviderRegistry),(Be=ue.registerChatRender)===null||Be===void 0||Be.call(ue,this.chatRenderRegistry),(Pe=ue.registerTerminalProvider)===null||Pe===void 0||Pe.call(ue,this.terminalProviderRegistry),(we=ue.registerIntelligentCompletionFeature)===null||we===void 0||we.call(ue,this.intelligentCompletionsRegistry),(_e=ue.registerProblemFixFeature)===null||_e===void 0||_e.call(ue,this.problemFixProviderRegistry),(Ne=ue.registerChatAgentPromptProvider)===null||Ne===void 0||Ne.call(ue)}),this.mcpServerContributions.getContributions().forEach(ue=>{ue.registerMCPServer(this.mcpServerRegistry)})}registerSetting(ue){ue.registerSettingGroup({id:o.AI_NATIVE_SETTING_GROUP_ID,title:_.AI_NATIVE_SETTING_GROUP_TITLE,iconClass:(0,o.getIcon)("magic-wand")}),ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.chat.title"),preferences:[{id:o.AINativeSettingSectionsId.ChatVisibleType,localized:"preference.ai.native.chat.visible.type"}]}),ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.interface.quick.title"),preferences:[{id:o.AINativeSettingSectionsId.InterfaceQuickNavigationEnabled,localized:"preference.ai.native.interface.quick.navigation"}]}),this.aiNativeConfigService.capabilities.supportsInlineCompletion&&(ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.intelligentCompletions.title"),preferences:[{id:o.AINativeSettingSectionsId.IntelligentCompletionsCacheEnabled,localized:"preference.ai.native.intelligentCompletions.cache.enabled"},{id:o.AINativeSettingSectionsId.IntelligentCompletionsDebounceTime,localized:"preference.ai.native.intelligentCompletions.debounceTime"},{id:o.AINativeSettingSectionsId.IntelligentCompletionsPromptEngineeringEnabled,localized:"preference.ai.native.intelligentCompletions.promptEngineering.enabled"},{id:o.AINativeSettingSectionsId.IntelligentCompletionsAlwaysVisible,localized:"preference.ai.native.intelligentCompletions.alwaysVisible"}]}),ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.codeEdits.title"),preferences:[{id:o.AINativeSettingSectionsId.CodeEditsLintErrors,localized:"preference.ai.native.codeEdits.lintErrors"},{id:o.AINativeSettingSectionsId.CodeEditsLineChange,localized:"preference.ai.native.codeEdits.lineChange"},{id:o.AINativeSettingSectionsId.CodeEditsTyping,localized:"preference.ai.native.codeEdits.typing"},{id:o.AINativeSettingSectionsId.CodeEditsRenderType,localized:"preference.ai.native.codeEdits.renderType"},{id:o.AINativeSettingSectionsId.SystemPrompt,localized:"preference.ai.native.chat.system.prompt"}]})),this.aiNativeConfigService.capabilities.supportsCustomLLMSettings&&ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.llm.apiSettings.title"),preferences:[{id:o.AINativeSettingSectionsId.LLMModelSelection,localized:"preference.ai.native.llm.model.selection"},{id:o.AINativeSettingSectionsId.ModelID,localized:"preference.ai.native.llm.model.id"},{id:o.AINativeSettingSectionsId.DeepseekApiKey,localized:"preference.ai.native.deepseek.apiKey"},{id:o.AINativeSettingSectionsId.AnthropicApiKey,localized:"preference.ai.native.anthropic.apiKey"},{id:o.AINativeSettingSectionsId.OpenaiApiKey,localized:"preference.ai.native.openai.apiKey"},{id:o.AINativeSettingSectionsId.OpenaiBaseURL,localized:"preference.ai.native.openai.baseURL"},{id:o.AINativeSettingSectionsId.MaxTokens,localized:"preference.ai.native.maxTokens"},{id:o.AINativeSettingSectionsId.ContextWindow,localized:"preference.ai.native.contextWindow"}]}),this.aiNativeConfigService.capabilities.supportsMCP&&ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.mcp.settings.title"),preferences:[{id:o.AINativeSettingSectionsId.MCPServers,localized:"preference.ai.native.mcp.servers"},{id:o.AINativeSettingSectionsId.TerminalAutoRun,localized:"ai.native.terminal.autorun"}]}),this.aiNativeConfigService.capabilities.supportsInlineChat&&ue.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.inlineChat.title"),preferences:[{id:o.AINativeSettingSectionsId.InlineChatAutoVisible,localized:"preference.ai.native.inlineChat.auto.visible"},{id:o.AINativeSettingSectionsId.InlineChatCodeActionEnabled,localized:"preference.ai.native.inlineChat.codeAction.enabled"},{id:o.AINativeSettingSectionsId.InlineDiffPreviewMode,localized:"preference.ai.native.inlineDiff.preview.mode"}]})}registerEditorFeature(ue){ue.registerEditorFeatureContribution({contribute:te=>{const{monacoEditor:fe}=te;return this.codeActionSingleHandler.mountEditor(te.monacoEditor),fe.onDidScrollChange(()=>{this.ctxMenuRenderer.visible&&this.ctxMenuRenderer.hide(!0)})}})}registerEditorComponent(ue){ue.registerEditorSideWidget({id:t.INLINE_DIFF_MANAGER_WIDGET_ID,component:K.InlineDiffManager,displaysOnResource:te=>{var fe;return!!(this.aiNativeConfigService.capabilities.supportsMCP&&(!((fe=this.applyService.getUriCodeBlocks(te.uri))===null||fe===void 0)&&fe.filter(Ie=>Ie.status==="pending").length))}})}registerCommands(ue){ue.registerCommand(a.AI_INLINE_CHAT_VISIBLE,{execute:te=>{this.aiInlineChatService._onInlineChatVisible.fire(te)}}),ue.registerCommand(a.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE,{execute:async te=>{var fe;if(!te){this.inlineInputService.hide();return}this.commandService.executeCommand(a.AI_INLINE_CHAT_VISIBLE.id,!1);const Ie=this.workbenchEditorService.currentCodeEditor;if(!Ie)return;const Me=Ie.monacoEditor.getPosition();if(!Me)return;const Be=Ie.monacoEditor.getSelection();if(Me?((fe=Ie.monacoEditor.getModel())===null||fe===void 0?void 0:fe.getLineLength(Me.lineNumber))===0:!1){this.inlineInputService.visibleByPosition(Me);return}if(Be&&!Be.isEmpty()){this.inlineInputService.visibleBySelection(Be);return}this.inlineInputService.visibleByNearestCodeBlock(Me,Ie.monacoEditor)}}),ue.registerCommand(a.AI_INLINE_CHAT_INTERACTIVE_INPUT_CANCEL,{execute:()=>{var te;const fe=this.workbenchEditorService.currentCodeEditor;fe&&((te=oe.InlineInputController.get(fe.monacoEditor))===null||te===void 0||te.cancelToken())}}),ue.registerCommand(a.AI_INLINE_COMPLETION_REPORTER,{execute:(te,fe,Ie,Me)=>{this.aiCompletionsService.report({sessionId:fe,accept:Ie,relationId:te,code:Me})}}),ue.registerCommand(a.AI_CHAT_VISIBLE,{execute:te=>{this.layoutService.toggleSlot(y.AI_CHAT_VIEW_ID,(0,_.isUndefined)(te)?!0:te)}}),ue.registerCommand(a.AI_INLINE_COMPLETION_VISIBLE,{execute:async te=>{te||(this.aiCompletionsService.hideStatusBarItem(),this.aiInlineCompletionsProvider.setVisibleCompletion(!1),this.aiInlineCompletionsProvider.cancelRequest())}}),ue.registerCommand(a.AI_INLINE_DIFF_PARTIAL_EDIT,{execute:te=>{this.inlineStreamDiffService.launchAcceptDiscardPartialEdit(te)}}),ue.afterExecuteCommand(f.HideInlineCompletion.ID,()=>{this.commandService.executeCommand(a.AI_INLINE_COMPLETION_VISIBLE.id,!1)})}registerRenderer(ue){this.designLayoutConfig.supportExternalChatPanel?ue.registerSlotRenderer(y.AI_CHAT_VIEW_ID,W.AIChatTabRendererWithTab):ue.registerSlotRenderer(y.AI_CHAT_VIEW_ID,W.AIChatTabRenderer),this.designLayoutConfig.useMergeRightWithLeftPanel&&(ue.registerSlotRenderer(o.SlotLocation.left,W.AILeftTabRenderer),ue.registerSlotRenderer(o.SlotLocation.right,W.AIRightTabRenderer))}registerComponent(ue){ue.register(y.AI_CHAT_CONTAINER_ID,[],{component:R.AIChatView,title:(0,o.localize)("aiNative.chat.ai.assistant.name"),iconClass:(0,o.getIcon)("magic-wand"),containerId:y.AI_CHAT_CONTAINER_ID}),ue.register(y.AI_MENU_BAR_DEBUG_TOOLBAR,{id:y.AI_MENU_BAR_DEBUG_TOOLBAR,component:U.AIRunToolbar}),ue.register(y.AI_CHAT_LOGO_AVATAR_ID,{id:y.AI_CHAT_LOGO_AVATAR_ID,component:j.AIChatLogoAvatar})}registerKeybindings(ue){this.aiNativeConfigService.capabilities.supportsInlineChat&&(ue.registerKeybinding({command:a.AI_INLINE_CHAT_VISIBLE.id,keybinding:"ctrlcmd+i",when:"editorTextFocus",args:!0,priority:0},o.KeybindingScope.USER),ue.registerKeybinding({command:a.AI_INLINE_CHAT_VISIBLE.id,keybinding:"esc",args:!1,when:`editorFocus && ${p.InlineChatIsVisible.raw}`}),this.inlineInputService.getInteractiveInputHandler()&&(ue.registerKeybinding({command:a.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:this.aiNativeConfigService.inlineChat.inputKeybinding,args:!0,priority:0,when:`editorFocus && (${p.InlineChatIsVisible.raw} || inlineSuggestionVisible)`},o.KeybindingScope.USER),ue.registerKeybinding({command:a.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:"esc",args:!1,priority:0,when:`editorFocus && ${p.InlineInputWidgetIsVisible.raw}`}),ue.registerKeybinding({command:a.AI_INLINE_CHAT_INTERACTIVE_INPUT_CANCEL.id,keybinding:"esc",priority:1,when:`editorFocus && ${p.InlineInputWidgetIsStreaming.raw}`}),ue.registerKeybinding({command:a.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:this.aiNativeConfigService.inlineChat.inputKeybinding,args:!0,priority:0,when:`editorFocus && ${p.InlineHintWidgetIsVisible.raw} && ${p.InlineChatIsVisible.not}`},o.KeybindingScope.USER))),ue.registerKeybinding({command:a.AI_INLINE_DIFF_PARTIAL_EDIT.id,keybinding:"ctrl+y",args:!0,priority:100,when:`editorTextFocus && ${p.InlineDiffPartialEditsIsVisible.raw}`}),ue.registerKeybinding({command:a.AI_INLINE_DIFF_PARTIAL_EDIT.id,keybinding:"ctrl+n",args:!1,priority:100,when:`editorTextFocus && ${p.InlineDiffPartialEditsIsVisible.raw}`})}};t.AINativeBrowserContribution=q,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],q.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],q.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(m.IBrowserCtxMenu),n.__metadata("design:type",m.IBrowserCtxMenu)],q.prototype,"ctxMenuRenderer",void 0),n.__decorate([(0,r.Autowired)(Z.AINativeCoreContribution),n.__metadata("design:type",Object)],q.prototype,"contributions",void 0),n.__decorate([(0,r.Autowired)(Z.MCPServerContribution),n.__metadata("design:type",Object)],q.prototype,"mcpServerContributions",void 0),n.__decorate([(0,r.Autowired)(Z.TokenMCPServerRegistry),n.__metadata("design:type",Object)],q.prototype,"mcpServerRegistry",void 0),n.__decorate([(0,r.Autowired)(_.InlineChatFeatureRegistryToken),n.__metadata("design:type",V.InlineChatFeatureRegistry)],q.prototype,"inlineChatFeatureRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],q.prototype,"chatFeatureRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ChatRenderRegistryToken),n.__metadata("design:type",Object)],q.prototype,"chatRenderRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ResolveConflictRegistryToken),n.__metadata("design:type",Object)],q.prototype,"resolveConflictRegistry",void 0),n.__decorate([(0,r.Autowired)(_.RenameCandidatesProviderRegistryToken),n.__metadata("design:type",Object)],q.prototype,"renameCandidatesProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(_.TerminalRegistryToken),n.__metadata("design:type",Object)],q.prototype,"terminalProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(_.IntelligentCompletionsRegistryToken),n.__metadata("design:type",Object)],q.prototype,"intelligentCompletionsRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ProblemFixRegistryToken),n.__metadata("design:type",Object)],q.prototype,"problemFixProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],q.prototype,"aiNativeConfigService",void 0),n.__decorate([(0,r.Autowired)(v.DesignLayoutConfig),n.__metadata("design:type",v.DesignLayoutConfig)],q.prototype,"designLayoutConfig",void 0),n.__decorate([(0,r.Autowired)(k.AICompletionsService),n.__metadata("design:type",k.AICompletionsService)],q.prototype,"aiCompletionsService",void 0),n.__decorate([(0,r.Autowired)(O.AIInlineCompletionsProvider),n.__metadata("design:type",O.AIInlineCompletionsProvider)],q.prototype,"aiInlineCompletionsProvider",void 0),n.__decorate([(0,r.Autowired)(_.CommandService),n.__metadata("design:type",Object)],q.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceSchemaProvider),n.__metadata("design:type",o.PreferenceSchemaProvider)],q.prototype,"preferenceSchemaProvider",void 0),n.__decorate([(0,r.Autowired)(o.IPreferenceSettingsService),n.__metadata("design:type",Object)],q.prototype,"preferenceSettings",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],q.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(u.IMainLayoutService),n.__metadata("design:type",Object)],q.prototype,"layoutService",void 0),n.__decorate([(0,r.Autowired)(y.ChatProxyServiceToken),n.__metadata("design:type",w.ChatProxyService)],q.prototype,"chatProxyService",void 0),n.__decorate([(0,r.Autowired)(o.IAIInlineChatService),n.__metadata("design:type",H.InlineChatService)],q.prototype,"aiInlineChatService",void 0),n.__decorate([(0,r.Autowired)(ie.InlineInputService),n.__metadata("design:type",ie.InlineInputService)],q.prototype,"inlineInputService",void 0),n.__decorate([(0,r.Autowired)(he.InlineStreamDiffService),n.__metadata("design:type",he.InlineStreamDiffService)],q.prototype,"inlineStreamDiffService",void 0),n.__decorate([(0,r.Autowired)(B.RenameSingleHandler),n.__metadata("design:type",B.RenameSingleHandler)],q.prototype,"renameSingleHandler",void 0),n.__decorate([(0,r.Autowired)(P.CodeActionSingleHandler),n.__metadata("design:type",P.CodeActionSingleHandler)],q.prototype,"codeActionSingleHandler",void 0),n.__decorate([(0,r.Autowired)(y.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],q.prototype,"sumiMCPServerBackendProxy",void 0),n.__decorate([(0,r.Autowired)(_.MCPConfigServiceToken),n.__metadata("design:type",G.MCPConfigService)],q.prototype,"mcpConfigService",void 0),n.__decorate([(0,r.Autowired)(g.WorkbenchEditorService),n.__metadata("design:type",h.WorkbenchEditorServiceImpl)],q.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(y.IChatManagerService),n.__metadata("design:type",D.ChatManagerService)],q.prototype,"chatManagerService",void 0),n.__decorate([(0,r.Autowired)(y.IChatInternalService),n.__metadata("design:type",T.ChatInternalService)],q.prototype,"chatInternalService",void 0),n.__decorate([(0,r.Autowired)(Q.BaseApplyService),n.__metadata("design:type",Q.BaseApplyService)],q.prototype,"applyService",void 0),n.__decorate([(0,r.Autowired)(_.StorageProvider),n.__metadata("design:type",Function)],q.prototype,"storageProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",S.ChatEditSchemeDocumentProvider)],q.prototype,"chatEditResourceProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",I.ChatMultiDiffResolver)],q.prototype,"chatMultiDiffResolver",void 0),t.AINativeBrowserContribution=q=n.__decorate([(0,o.Domain)(o.ClientAppContribution,l.BrowserEditorContribution,o.CommandContribution,d.SettingContribution,o.KeybindingContribution,o.ComponentContribution,o.SlotRendererContribution,o.MonacoContribution,l.MultiDiffSourceContribution),n.__metadata("design:paramtypes",[])],q)},96366:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApplyService=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(57517),p=e(19413),v=e(73974),m=e(51081);let _=class extends v.BaseApplyService{async doApply(g){const l=new o.URI(o.path.join(this.appConfig.workspaceDir,g.relativePath)),u=(await this.modelService.createModelReference(l)).instance.getMonacoModel().getValue();return{stream:await this.aiBackService.requestStream(`Merge all changes from the <update> snippet into the <code> below.
31591
31591
  - Preserve the code's structure, order, comments, and indentation exactly.
31592
31592
  - Output only the updated code, enclosed within <updated-code> and </updated-code> tags.
31593
31593
  - Do not include any additional text, explanations, placeholders, ellipses, or code fences.
31594
31594
 
31595
- <code>${c}</code>
31595
+ <code>${u}</code>
31596
31596
 
31597
- <update>${d.codeEdit}</update>
31598
- ${d.instructions?`
31599
- User's intention: ${d.instructions}
31597
+ <update>${g.codeEdit}</update>
31598
+ ${g.instructions?`
31599
+ User's intention: ${g.instructions}
31600
31600
  `:""}
31601
31601
  Provide the complete updated code.
31602
- `,{...this.chatProxyService.getRequestOptions(),trimTexts:["<updated-code>","</updated-code>"],system:"You are a coding assistant that helps merge code updates, ensuring every modification is fully integrated."})}}};t.ApplyService=h,n.__decorate([(0,r.Autowired)(a.CommandService),n.__metadata("design:type",Object)],h.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(p.IEditorDocumentModelService),n.__metadata("design:type",Object)],h.prototype,"modelService",void 0),n.__decorate([(0,r.Autowired)(o.AIBackSerivcePath),n.__metadata("design:type",Object)],h.prototype,"aiBackService",void 0),n.__decorate([(0,r.Autowired)(_.ChatProxyServiceToken),n.__metadata("design:type",g.ChatProxyService)],h.prototype,"chatProxyService",void 0),t.ApplyService=h=n.__decorate([(0,r.Injectable)()],h)},74055:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAgentService=void 0;const n=e(85608),r=n.__importDefault(e(66652)),o=e(76003),a=e(43718),p=e(46044),v=e(73307),m=e(29770);let _=class extends a.Disposable{constructor(){super(),this.agents=new Map,this.initialUserMessageMap=new Map,this.shouldUpdateContext=!1,this._onDidChangeAgents=new a.Emitter,this.onDidChangeAgents=this._onDidChangeAgents.event,this._onDidSendMessage=new a.Emitter,this.onDidSendMessage=this._onDidSendMessage.event,this.addDispose(this._onDidChangeAgents),this.addDispose(this.llmContextService.onDidContextFilesChangeEvent(g=>{g.version!==this.contextVersion&&(this.contextVersion=g.version,this.shouldUpdateContext=!0)}))}registerAgent(g){if(this.agents.has(g.id))throw new Error(`Already registered an agent with id ${g.id}`);return this.agents.set(g.id,{agent:g,commands:[]}),this._onDidChangeAgents.fire(),(0,a.toDisposable)(()=>{this.agents.delete(g.id)&&this._onDidChangeAgents.fire()})}async updateAgent(g,l){const h=this.agents.get(g);if(!h)throw new Error(`No agent with id ${g} registered`);h.agent.metadata={...h.agent.metadata,...l},h.commands=await h.agent.provideSlashCommands(a.CancellationToken.None),l.isDefault&&(this.defaultAgentId=g);const u=await h.agent.provideChatWelcomeMessage(a.CancellationToken.None);if(u){const{content:d,sampleQuestions:E}=u;this.chatFeatureRegistry.registerWelcome(d,E)}this._onDidChangeAgents.fire()}getAgents(){return Array.from(this.agents.values(),g=>g.agent)}hasAgent(g){return this.agents.has(g)}getDefaultAgentId(){return this.defaultAgentId}getAgent(g){const l=this.agents.get(g);return l?.agent}async invokeAgent(g,l,h,u,d){const E=this.agents.get(g);if(!E)throw new Error(`No agent with id ${g}`);if(this.initialUserMessageMap.has(l.sessionId))(this.shouldUpdateContext||l.regenerate||u.length===0)&&(l.message=await this.provideContextMessage(l.message,l.sessionId),this.shouldUpdateContext=!1);else{this.initialUserMessageMap.set(l.sessionId,l.message);const c=l.message;l.message=await this.provideContextMessage(c,l.sessionId)}return await E.agent.invoke(l,h,u,d)}async provideContextMessage(g,l){const h=await this.llmContextService.serialize(),u=await this.promptProvider.provideContextPrompt(h,g);return this.aiReporter.send({msgType:a.AIServiceType.Chat,actionType:a.ActionTypeEnum.ContextEnhance,actionSource:a.ActionSourceEnum.Chat,sessionId:l,message:u}),u}populateChatInput(g,l){this.aiChatService.sendMessage({...l,agentId:g,immediate:!1})}getCommands(){return(0,r.default)(Array.from(this.agents.values(),({agent:g,commands:l})=>l.map(h=>({...h,agentId:g.id}))))}async getFollowups(g,l,h){const u=this.agents.get(g);if(!u)throw new Error(`No agent with id ${g}`);return u.agent.provideFollowups?u.agent.provideFollowups(l,h):[]}async getSampleQuestions(g,l){const h=this.agents.get(g);if(!h)throw new Error(`No agent with id ${g}`);return h.agent.provideSampleQuestions?h.agent.provideSampleQuestions(l):[]}async getAllSampleQuestions(){const g=await Promise.all(Array.from(this.agents.values()).map(async({agent:l})=>{try{return await this.getSampleQuestions(l.id,a.CancellationToken.None)}catch(h){return this.logger.error(h),[]}}));return(0,r.default)(g)}sendMessage(g){this._onDidSendMessage.fire(g)}parseMessage(g,l){var h;const u={agentId:"",command:"",message:g};let d=l;const E=this.getAgents(),f=new RegExp(`^@(${E.map(y=>y.id).join("|")})(?:\\s+|$)`,"i"),c=u.message.match(f);if(c){const y=E.find(b=>b.id.toLowerCase()===c[1].toLowerCase());if(!y)return u;d=y.id,u.agentId=d,u.message=u.message.replace(c[0],"")}if(d){const y=(h=this.agents.get(d))===null||h===void 0?void 0:h.commands;if(y?.length){const b=new RegExp(`^/\\s?(${y.map(S=>S.name).join("|")})(?:\\s+|$)`,"i"),A=u.message.match(b);if(A){const S=y.find(D=>D.name.toLowerCase()===A[1].toLowerCase());if(!S)return u;u.command=S.name,u.message=u.message.replace(A[0],"")}}}return u}};t.ChatAgentService=_,n.__decorate([(0,o.Autowired)(a.ILogger),n.__metadata("design:type",Object)],_.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(a.IAIReporter),n.__metadata("design:type",Object)],_.prototype,"aiReporter",void 0),n.__decorate([(0,o.Autowired)(p.LLMContextServiceToken),n.__metadata("design:type",Object)],_.prototype,"llmContextService",void 0),n.__decorate([(0,o.Autowired)(v.ChatAgentPromptProvider),n.__metadata("design:type",Object)],_.prototype,"promptProvider",void 0),n.__decorate([(0,o.Autowired)(a.ChatServiceToken),n.__metadata("design:type",m.ChatService)],_.prototype,"aiChatService",void 0),n.__decorate([(0,o.Autowired)(a.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],_.prototype,"chatFeatureRegistry",void 0),t.ChatAgentService=_=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],_)},84543:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAgentViewService=void 0;const n=e(85608),r=e(76003),o=e(43718),a=e(19413),p=e(51081);let v=class{constructor(){this.componentsMap=new Map,this.componentsDeferredMap=new Map}registerChatComponent(_){return this.componentsMap.set(_.id,_),this.componentsDeferredMap.has(_.id)&&(this.componentsDeferredMap.get(_.id).resolve(_),this.componentsDeferredMap.delete(_.id)),{dispose:()=>{this.componentsMap.get(_.id)===_&&(this.componentsMap.delete(_.id),this.componentsDeferredMap.delete(_.id))}}}getChatComponent(_){return this.componentsMap.has(_)?this.componentsMap.get(_):(this.componentsDeferredMap.has(_)||this.componentsDeferredMap.set(_,new o.Deferred),null)}getChatComponentDeferred(_){return this.componentsDeferredMap.get(_)||null}getRenderAgents(){return this.chatAgentService.getAgents().filter(_=>_.id!==p.ChatProxyService.AGENT_ID)}};t.ChatAgentViewService=v,n.__decorate([(0,r.Autowired)(a.IChatAgentService),n.__metadata("design:type",Object)],v.prototype,"chatAgentService",void 0),t.ChatAgentViewService=v=n.__decorate([(0,r.Injectable)()],v)},98987:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatEditSchemeDocumentProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(54414),p=e(96689),v=e(73974);let m=class{constructor(){this._onDidChangeContent=new o.Emitter,this.onDidChangeContent=this._onDidChangeContent.event}handlesScheme(s){return s===v.BaseApplyService.CHAT_EDITING_SOURCE_RESOLVER_SCHEME}async provideEditorDocumentModelContent(s,g){const{id:l,side:h}=s.getParsedQuery(),d=this.baseApplyService.getSessionCodeBlocks().find(f=>f.toolCallId===l);return(h==="left"?d?.originalCode:d?.updatedCode)||""}isReadonly(s){return!0}onDidDisposeModel(){}};t.ChatEditSchemeDocumentProvider=m,n.__decorate([(0,r.Autowired)(p.IEditorDocumentModelService),n.__metadata("design:type",Object)],m.prototype,"editorDocumentModelService",void 0),n.__decorate([(0,r.Autowired)(a.WorkbenchEditorService),n.__metadata("design:type",a.WorkbenchEditorService)],m.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],m.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(o.IApplicationService),n.__metadata("design:type",Object)],m.prototype,"applicationService",void 0),n.__decorate([(0,r.Autowired)(v.BaseApplyService),n.__metadata("design:type",v.BaseApplyService)],m.prototype,"baseApplyService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],m.prototype,"preferenceService",void 0),t.ChatEditSchemeDocumentProvider=m=n.__decorate([(0,r.Injectable)()],m)},61282:(x,t,e)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatManagerService=void 0;const o=e(85608),a=e(76003),p=e(41869),v=e(43718),m=e(19413),_=e(44260),s=e(42033),g=20;class l extends v.LRUCache{disposeKey(d){const E=this.get(d);E&&E.dispose(),this.delete(d)}dispose(){this.forEach(d=>{d.dispose()}),this.clear()}}let h=class extends v.Disposable{fromJSON(d){return d.filter(E=>E.history.messages.length>0).map(E=>{const f=new s.ChatModel({sessionId:E.sessionId,history:new _.MsgHistoryManager(E.history),modelId:E.modelId}),c=E.requests.map(y=>new s.ChatRequestModel(y.requestId,f,y.message,new s.ChatResponseModel(y.requestId,f,y.message.agentId,{responseContents:y.response.responseContents,isComplete:!0,responseText:y.response.responseText,responseParts:y.response.responseParts,errorDetails:y.response.errorDetails,followups:y.response.followups,isCanceled:y.response.isCanceled})));return f.restoreRequests(c),f})}constructor(){super(),n.set(this,this.registerDispose(new l(g))),r.set(this,this.registerDispose(new v.DisposableMap)),this.storageInitEmitter=new v.Emitter,this.onStorageInit=this.storageInitEmitter.event}async init(){this._chatStorage=await this.storageProvider(v.STORAGE_NAMESPACE.CHAT);const d=this._chatStorage.get("sessionModels",[]);this.fromJSON(d).forEach(f=>{o.__classPrivateFieldGet(this,n,"f").set(f.sessionId,f),this.listenSession(f)}),await this.storageInitEmitter.fireAndAwait()}getSessions(){return Array.from(o.__classPrivateFieldGet(this,n,"f").values())}startSession(){const d=new s.ChatModel;return o.__classPrivateFieldGet(this,n,"f").set(d.sessionId,d),this.listenSession(d),d}getSession(d){return o.__classPrivateFieldGet(this,n,"f").get(d)}clearSession(d){var E;if(!o.__classPrivateFieldGet(this,n,"f").get(d))throw new Error(`Unknown session: ${d}`);o.__classPrivateFieldGet(this,n,"f").disposeKey(d),(E=o.__classPrivateFieldGet(this,r,"f").get(d))===null||E===void 0||E.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(d),this.saveSessions()}createRequest(d,E,f,c,y){const b=this.getSession(d);if(!b)throw new Error(`Unknown session: ${d}`);if(!o.__classPrivateFieldGet(this,r,"f").has(d))return b.addRequest({prompt:E,agentId:f,command:c,images:y})}async sendRequest(d,E,f){const c=this.getSession(d);if(!c)throw new Error(`Unknown session: ${d}`);const y=c.modelId,b=this.preferenceService.get(v.AINativeSettingSectionsId.ModelID);if(!y)c.modelId=b;else if(y!==b)throw new Error("Model changed unexpectedly");const A=new v.CancellationTokenSource,S=A.token;o.__classPrivateFieldGet(this,r,"f").set(c.sessionId,A);const D=S.onCancellationRequested(()=>{E.response.cancel()}),I=this.preferenceService.get(v.AINativeSettingSectionsId.ContextWindow),w=c.getMessageHistory(I);try{const T=O=>{S.isCancellationRequested||c.acceptResponseProgress(E,O)},R={sessionId:d,requestId:E.requestId,message:E.message.prompt,command:E.message.command,images:E.message.images,regenerate:f},P=await this.chatAgentService.invokeAgent(E.message.agentId,R,T,w,S);S.isCancellationRequested||(P.errorDetails&&E.response.setErrorDetails(P.errorDetails),this.chatAgentService.getFollowups(E.message.agentId,d,v.CancellationToken.None).then(M=>{E.response.setFollowups(M),E.response.complete()}))}finally{D.dispose(),o.__classPrivateFieldGet(this,r,"f").disposeKey(c.sessionId),this.saveSessions()}}listenSession(d){this.addDispose(d.history.onMessageAdditionalChange(()=>{this.saveSessions()}))}saveSessions(){this._chatStorage.set("sessionModels",this.getSessions())}cancelRequest(d){var E;(E=o.__classPrivateFieldGet(this,r,"f").get(d))===null||E===void 0||E.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(d),this.saveSessions()}};t.ChatManagerService=h,n=new WeakMap,r=new WeakMap,o.__decorate([(0,a.Autowired)(a.INJECTOR_TOKEN),o.__metadata("design:type",a.Injector)],h.prototype,"injector",void 0),o.__decorate([(0,a.Autowired)(m.IChatAgentService),o.__metadata("design:type",Object)],h.prototype,"chatAgentService",void 0),o.__decorate([(0,a.Autowired)(v.StorageProvider),o.__metadata("design:type",Function)],h.prototype,"storageProvider",void 0),o.__decorate([(0,a.Autowired)(p.PreferenceService),o.__metadata("design:type",Object)],h.prototype,"preferenceService",void 0),o.__decorate([(0,v.debounce)(1e3),o.__metadata("design:type",Function),o.__metadata("design:paramtypes",[]),o.__metadata("design:returntype",void 0)],h.prototype,"saveSessions",null),t.ChatManagerService=h=o.__decorate([(0,a.Injectable)(),o.__metadata("design:paramtypes",[])],h)},42033:(x,t,e)=>{"use strict";var n,r,o,a,p,v,m,_,s,g,l,h,u,d,E,f,c;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatSlashCommandItemModel=t.ChatWelcomeMessageModel=t.ChatModel=t.ChatRequestModel=t.ChatResponseModel=void 0;const y=e(85608),b=e(76003),A=e(43718),S=e(90684),D=e(19413),I=e(44260);class w extends A.Disposable{get responseParts(){return y.__classPrivateFieldGet(this,r,"f")}get responseContents(){return y.__classPrivateFieldGet(this,o,"f")}get isComplete(){return y.__classPrivateFieldGet(this,a,"f")}get isCanceled(){return y.__classPrivateFieldGet(this,p,"f")}get requestId(){return y.__classPrivateFieldGet(this,v,"f")}get responseText(){return y.__classPrivateFieldGet(this,m,"f")}get errorDetails(){return y.__classPrivateFieldGet(this,_,"f")}get followups(){return y.__classPrivateFieldGet(this,s,"f")}get onDidChange(){return y.__classPrivateFieldGet(this,g,"f").event}constructor(k,F,L,B){super(),n.add(this),this.session=F,this.agentId=L,r.set(this,[]),o.set(this,[]),a.set(this,!1),p.set(this,!1),v.set(this,void 0),m.set(this,""),_.set(this,void 0),s.set(this,void 0),g.set(this,this.registerDispose(new A.Emitter)),y.__classPrivateFieldSet(this,v,k,"f"),B&&(y.__classPrivateFieldSet(this,o,B.responseContents,"f"),y.__classPrivateFieldSet(this,r,B.responseParts||[],"f"),y.__classPrivateFieldSet(this,m,B.responseText,"f"),y.__classPrivateFieldSet(this,a,B.isComplete,"f"),y.__classPrivateFieldSet(this,p,B.isCanceled,"f"),y.__classPrivateFieldSet(this,_,B.errorDetails,"f"),y.__classPrivateFieldSet(this,s,B.followups,"f"))}updateContent(k,F){var L;const B=y.__classPrivateFieldGet(this,r,"f").length-1;if(k.kind==="content"||k.kind==="markdownContent"){const U=y.__classPrivateFieldGet(this,r,"f")[B];!U||U.kind!=="markdownContent"?k.kind==="content"?y.__classPrivateFieldGet(this,r,"f").push({content:new S.MarkdownString(k.content),kind:"markdownContent"}):y.__classPrivateFieldGet(this,r,"f").push(k):k.kind==="markdownContent"?y.__classPrivateFieldGet(this,r,"f")[B]={content:new S.MarkdownString(U.content.value+k.content.value),kind:"markdownContent"}:y.__classPrivateFieldGet(this,r,"f")[B]={content:new S.MarkdownString(U.content.value+k.content,U.content),kind:"markdownContent"},y.__classPrivateFieldGet(this,n,"m",l).call(this)}else if(k.kind==="reasoning"){const U=y.__classPrivateFieldGet(this,r,"f")[B];!U||U.kind!=="reasoning"?y.__classPrivateFieldGet(this,r,"f").push({content:k.content.replace(/^<think>/,""),kind:"reasoning"}):y.__classPrivateFieldGet(this,r,"f")[B]={content:U.content+k.content,kind:"reasoning"},y.__classPrivateFieldGet(this,n,"m",l).call(this)}else if(k.kind==="asyncContent"){const U=y.__classPrivateFieldGet(this,r,"f").push(k)-1;y.__classPrivateFieldGet(this,n,"m",l).call(this),(L=k.resolvedContent)===null||L===void 0||L.then(W=>{typeof W=="string"?y.__classPrivateFieldGet(this,r,"f")[U]={content:new S.MarkdownString(W),kind:"markdownContent"}:(0,S.isMarkdownString)(W)?y.__classPrivateFieldGet(this,r,"f")[U]={content:W,kind:"markdownContent"}:y.__classPrivateFieldGet(this,r,"f")[U]=W,y.__classPrivateFieldGet(this,n,"m",l).call(this,F)})}else if(k.kind==="treeData"||k.kind==="component")y.__classPrivateFieldGet(this,r,"f").push(k),y.__classPrivateFieldGet(this,n,"m",l).call(this,F);else if(k.kind==="toolCall"){const U=y.__classPrivateFieldGet(this,r,"f").find(W=>W.kind==="toolCall"&&W.content.id===k.content.id);U?U.content=k.content:y.__classPrivateFieldGet(this,r,"f").push(k),y.__classPrivateFieldGet(this,n,"m",l).call(this,F)}}complete(){y.__classPrivateFieldSet(this,a,!0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}cancel(){y.__classPrivateFieldSet(this,a,!0,"f"),y.__classPrivateFieldSet(this,p,!0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}reset(){y.__classPrivateFieldSet(this,o,[],"f"),y.__classPrivateFieldSet(this,r,[],"f"),y.__classPrivateFieldSet(this,m,"","f"),y.__classPrivateFieldSet(this,p,!1,"f"),y.__classPrivateFieldSet(this,a,!1,"f"),y.__classPrivateFieldSet(this,_,void 0,"f"),y.__classPrivateFieldSet(this,s,void 0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}setErrorDetails(k){y.__classPrivateFieldSet(this,_,k,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}setFollowups(k){y.__classPrivateFieldSet(this,s,k,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}toJSON(){return{isCanceled:this.isCanceled,responseContents:this.responseContents,responseText:this.responseText,responseParts:this.responseParts,errorDetails:this.errorDetails,followups:this.followups}}}t.ChatResponseModel=w,r=new WeakMap,o=new WeakMap,a=new WeakMap,p=new WeakMap,v=new WeakMap,m=new WeakMap,_=new WeakMap,s=new WeakMap,g=new WeakMap,n=new WeakSet,l=function(k){y.__classPrivateFieldSet(this,m,y.__classPrivateFieldGet(this,r,"f").map(L=>L.kind==="asyncContent"?L.content:L.kind==="treeData"||L.kind==="component"?"":L.kind==="toolCall"?L.content.function.name:L.kind==="reasoning"?"":L.content.value).join(`
31602
+ `,{...this.chatProxyService.getRequestOptions(),trimTexts:["<updated-code>","</updated-code>"],system:"You are a coding assistant that helps merge code updates, ensuring every modification is fully integrated."})}}};t.ApplyService=_,n.__decorate([(0,r.Autowired)(a.IEditorDocumentModelService),n.__metadata("design:type",Object)],_.prototype,"modelService",void 0),n.__decorate([(0,r.Autowired)(o.AIBackSerivcePath),n.__metadata("design:type",Object)],_.prototype,"aiBackService",void 0),n.__decorate([(0,r.Autowired)(p.ChatProxyServiceToken),n.__metadata("design:type",m.ChatProxyService)],_.prototype,"chatProxyService",void 0),t.ApplyService=_=n.__decorate([(0,r.Injectable)()],_)},74055:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAgentService=void 0;const n=e(85608),r=n.__importDefault(e(66652)),o=e(76003),a=e(43718),p=e(46044),v=e(73307),m=e(29770);let _=class extends a.Disposable{constructor(){super(),this.agents=new Map,this.initialUserMessageMap=new Map,this.shouldUpdateContext=!1,this._onDidChangeAgents=new a.Emitter,this.onDidChangeAgents=this._onDidChangeAgents.event,this._onDidSendMessage=new a.Emitter,this.onDidSendMessage=this._onDidSendMessage.event,this.addDispose(this._onDidChangeAgents),this.addDispose(this.llmContextService.onDidContextFilesChangeEvent(g=>{g.version!==this.contextVersion&&(this.contextVersion=g.version,this.shouldUpdateContext=!0)}))}registerAgent(g){if(this.agents.has(g.id))throw new Error(`Already registered an agent with id ${g.id}`);return this.agents.set(g.id,{agent:g,commands:[]}),this._onDidChangeAgents.fire(),(0,a.toDisposable)(()=>{this.agents.delete(g.id)&&this._onDidChangeAgents.fire()})}async updateAgent(g,l){const h=this.agents.get(g);if(!h)throw new Error(`No agent with id ${g} registered`);h.agent.metadata={...h.agent.metadata,...l},h.commands=await h.agent.provideSlashCommands(a.CancellationToken.None),l.isDefault&&(this.defaultAgentId=g);const u=await h.agent.provideChatWelcomeMessage(a.CancellationToken.None);if(u){const{content:d,sampleQuestions:E}=u;this.chatFeatureRegistry.registerWelcome(d,E)}this._onDidChangeAgents.fire()}getAgents(){return Array.from(this.agents.values(),g=>g.agent)}hasAgent(g){return this.agents.has(g)}getDefaultAgentId(){return this.defaultAgentId}getAgent(g){const l=this.agents.get(g);return l?.agent}async invokeAgent(g,l,h,u,d){const E=this.agents.get(g);if(!E)throw new Error(`No agent with id ${g}`);if(this.initialUserMessageMap.has(l.sessionId))(this.shouldUpdateContext||l.regenerate||u.length===0)&&(l.message=await this.provideContextMessage(l.message,l.sessionId),this.shouldUpdateContext=!1);else{this.initialUserMessageMap.set(l.sessionId,l.message);const c=l.message;l.message=await this.provideContextMessage(c,l.sessionId)}return await E.agent.invoke(l,h,u,d)}async provideContextMessage(g,l){const h=await this.llmContextService.serialize(),u=await this.promptProvider.provideContextPrompt(h,g);return this.aiReporter.send({msgType:a.AIServiceType.Chat,actionType:a.ActionTypeEnum.ContextEnhance,actionSource:a.ActionSourceEnum.Chat,sessionId:l,message:u}),u}populateChatInput(g,l){this.aiChatService.sendMessage({...l,agentId:g,immediate:!1})}getCommands(){return(0,r.default)(Array.from(this.agents.values(),({agent:g,commands:l})=>l.map(h=>({...h,agentId:g.id}))))}async getFollowups(g,l,h){const u=this.agents.get(g);if(!u)throw new Error(`No agent with id ${g}`);return u.agent.provideFollowups?u.agent.provideFollowups(l,h):[]}async getSampleQuestions(g,l){const h=this.agents.get(g);if(!h)throw new Error(`No agent with id ${g}`);return h.agent.provideSampleQuestions?h.agent.provideSampleQuestions(l):[]}async getAllSampleQuestions(){const g=await Promise.all(Array.from(this.agents.values()).map(async({agent:l})=>{try{return await this.getSampleQuestions(l.id,a.CancellationToken.None)}catch(h){return this.logger.error(h),[]}}));return(0,r.default)(g)}sendMessage(g){this._onDidSendMessage.fire(g)}parseMessage(g,l){var h;const u={agentId:"",command:"",message:g};let d=l;const E=this.getAgents(),f=new RegExp(`^@(${E.map(y=>y.id).join("|")})(?:\\s+|$)`,"i"),c=u.message.match(f);if(c){const y=E.find(b=>b.id.toLowerCase()===c[1].toLowerCase());if(!y)return u;d=y.id,u.agentId=d,u.message=u.message.replace(c[0],"")}if(d){const y=(h=this.agents.get(d))===null||h===void 0?void 0:h.commands;if(y?.length){const b=new RegExp(`^/\\s?(${y.map(S=>S.name).join("|")})(?:\\s+|$)`,"i"),A=u.message.match(b);if(A){const S=y.find(D=>D.name.toLowerCase()===A[1].toLowerCase());if(!S)return u;u.command=S.name,u.message=u.message.replace(A[0],"")}}}return u}};t.ChatAgentService=_,n.__decorate([(0,o.Autowired)(a.ILogger),n.__metadata("design:type",Object)],_.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(a.IAIReporter),n.__metadata("design:type",Object)],_.prototype,"aiReporter",void 0),n.__decorate([(0,o.Autowired)(p.LLMContextServiceToken),n.__metadata("design:type",Object)],_.prototype,"llmContextService",void 0),n.__decorate([(0,o.Autowired)(v.ChatAgentPromptProvider),n.__metadata("design:type",Object)],_.prototype,"promptProvider",void 0),n.__decorate([(0,o.Autowired)(a.ChatServiceToken),n.__metadata("design:type",m.ChatService)],_.prototype,"aiChatService",void 0),n.__decorate([(0,o.Autowired)(a.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],_.prototype,"chatFeatureRegistry",void 0),t.ChatAgentService=_=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],_)},84543:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAgentViewService=void 0;const n=e(85608),r=e(76003),o=e(43718),a=e(19413),p=e(51081);let v=class{constructor(){this.componentsMap=new Map,this.componentsDeferredMap=new Map}registerChatComponent(_){return this.componentsMap.set(_.id,_),this.componentsDeferredMap.has(_.id)&&(this.componentsDeferredMap.get(_.id).resolve(_),this.componentsDeferredMap.delete(_.id)),{dispose:()=>{this.componentsMap.get(_.id)===_&&(this.componentsMap.delete(_.id),this.componentsDeferredMap.delete(_.id))}}}getChatComponent(_){return this.componentsMap.has(_)?this.componentsMap.get(_):(this.componentsDeferredMap.has(_)||this.componentsDeferredMap.set(_,new o.Deferred),null)}getChatComponentDeferred(_){return this.componentsDeferredMap.get(_)||null}getRenderAgents(){return this.chatAgentService.getAgents().filter(_=>_.id!==p.ChatProxyService.AGENT_ID)}};t.ChatAgentViewService=v,n.__decorate([(0,r.Autowired)(a.IChatAgentService),n.__metadata("design:type",Object)],v.prototype,"chatAgentService",void 0),t.ChatAgentViewService=v=n.__decorate([(0,r.Injectable)()],v)},98987:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatEditSchemeDocumentProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(54414),p=e(96689),v=e(73974);let m=class{constructor(){this._onDidChangeContent=new o.Emitter,this.onDidChangeContent=this._onDidChangeContent.event}handlesScheme(s){return s===v.BaseApplyService.CHAT_EDITING_SOURCE_RESOLVER_SCHEME}async provideEditorDocumentModelContent(s,g){const{id:l,side:h}=s.getParsedQuery(),d=this.baseApplyService.getSessionCodeBlocks().find(f=>f.toolCallId===l);return(h==="left"?d?.originalCode:d?.updatedCode)||""}isReadonly(s){return!0}onDidDisposeModel(){}};t.ChatEditSchemeDocumentProvider=m,n.__decorate([(0,r.Autowired)(p.IEditorDocumentModelService),n.__metadata("design:type",Object)],m.prototype,"editorDocumentModelService",void 0),n.__decorate([(0,r.Autowired)(a.WorkbenchEditorService),n.__metadata("design:type",a.WorkbenchEditorService)],m.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],m.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(o.IApplicationService),n.__metadata("design:type",Object)],m.prototype,"applicationService",void 0),n.__decorate([(0,r.Autowired)(v.BaseApplyService),n.__metadata("design:type",v.BaseApplyService)],m.prototype,"baseApplyService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],m.prototype,"preferenceService",void 0),t.ChatEditSchemeDocumentProvider=m=n.__decorate([(0,r.Injectable)()],m)},61282:(x,t,e)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatManagerService=void 0;const o=e(85608),a=e(76003),p=e(41869),v=e(43718),m=e(19413),_=e(44260),s=e(42033),g=20;class l extends v.LRUCache{disposeKey(d){const E=this.get(d);E&&E.dispose(),this.delete(d)}dispose(){this.forEach(d=>{d.dispose()}),this.clear()}}let h=class extends v.Disposable{fromJSON(d){return d.filter(E=>E.history.messages.length>0).map(E=>{const f=new s.ChatModel({sessionId:E.sessionId,history:new _.MsgHistoryManager(E.history),modelId:E.modelId}),c=E.requests.map(y=>new s.ChatRequestModel(y.requestId,f,y.message,new s.ChatResponseModel(y.requestId,f,y.message.agentId,{responseContents:y.response.responseContents,isComplete:!0,responseText:y.response.responseText,responseParts:y.response.responseParts,errorDetails:y.response.errorDetails,followups:y.response.followups,isCanceled:y.response.isCanceled})));return f.restoreRequests(c),f})}constructor(){super(),n.set(this,this.registerDispose(new l(g))),r.set(this,this.registerDispose(new v.DisposableMap)),this.storageInitEmitter=new v.Emitter,this.onStorageInit=this.storageInitEmitter.event}async init(){this._chatStorage=await this.storageProvider(v.STORAGE_NAMESPACE.CHAT);const d=this._chatStorage.get("sessionModels",[]);this.fromJSON(d).forEach(f=>{o.__classPrivateFieldGet(this,n,"f").set(f.sessionId,f),this.listenSession(f)}),await this.storageInitEmitter.fireAndAwait()}getSessions(){return Array.from(o.__classPrivateFieldGet(this,n,"f").values())}startSession(){const d=new s.ChatModel;return o.__classPrivateFieldGet(this,n,"f").set(d.sessionId,d),this.listenSession(d),d}getSession(d){return o.__classPrivateFieldGet(this,n,"f").get(d)}clearSession(d){var E;if(!o.__classPrivateFieldGet(this,n,"f").get(d))throw new Error(`Unknown session: ${d}`);o.__classPrivateFieldGet(this,n,"f").disposeKey(d),(E=o.__classPrivateFieldGet(this,r,"f").get(d))===null||E===void 0||E.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(d),this.saveSessions()}createRequest(d,E,f,c,y){const b=this.getSession(d);if(!b)throw new Error(`Unknown session: ${d}`);if(!o.__classPrivateFieldGet(this,r,"f").has(d))return b.addRequest({prompt:E,agentId:f,command:c,images:y})}async sendRequest(d,E,f){const c=this.getSession(d);if(!c)throw new Error(`Unknown session: ${d}`);const y=c.modelId,b=this.preferenceService.get(v.AINativeSettingSectionsId.ModelID);if(!y)c.modelId=b;else if(y!==b)throw new Error("Model changed unexpectedly");const A=new v.CancellationTokenSource,S=A.token;o.__classPrivateFieldGet(this,r,"f").set(c.sessionId,A);const D=S.onCancellationRequested(()=>{E.response.cancel()}),I=this.preferenceService.get(v.AINativeSettingSectionsId.ContextWindow),w=c.getMessageHistory(I);try{const T=O=>{S.isCancellationRequested||c.acceptResponseProgress(E,O)},R={sessionId:d,requestId:E.requestId,message:E.message.prompt,command:E.message.command,images:E.message.images,regenerate:f},P=await this.chatAgentService.invokeAgent(E.message.agentId,R,T,w,S);S.isCancellationRequested||(P.errorDetails&&E.response.setErrorDetails(P.errorDetails),this.chatAgentService.getFollowups(E.message.agentId,d,v.CancellationToken.None).then(M=>{E.response.setFollowups(M),E.response.complete()}))}finally{D.dispose(),o.__classPrivateFieldGet(this,r,"f").disposeKey(c.sessionId),this.saveSessions()}}listenSession(d){this.addDispose(d.history.onMessageAdditionalChange(()=>{this.saveSessions()}))}saveSessions(){this._chatStorage.set("sessionModels",this.getSessions())}cancelRequest(d){var E;(E=o.__classPrivateFieldGet(this,r,"f").get(d))===null||E===void 0||E.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(d),this.saveSessions()}};t.ChatManagerService=h,n=new WeakMap,r=new WeakMap,o.__decorate([(0,a.Autowired)(a.INJECTOR_TOKEN),o.__metadata("design:type",a.Injector)],h.prototype,"injector",void 0),o.__decorate([(0,a.Autowired)(m.IChatAgentService),o.__metadata("design:type",Object)],h.prototype,"chatAgentService",void 0),o.__decorate([(0,a.Autowired)(v.StorageProvider),o.__metadata("design:type",Function)],h.prototype,"storageProvider",void 0),o.__decorate([(0,a.Autowired)(p.PreferenceService),o.__metadata("design:type",Object)],h.prototype,"preferenceService",void 0),o.__decorate([(0,v.debounce)(1e3),o.__metadata("design:type",Function),o.__metadata("design:paramtypes",[]),o.__metadata("design:returntype",void 0)],h.prototype,"saveSessions",null),t.ChatManagerService=h=o.__decorate([(0,a.Injectable)(),o.__metadata("design:paramtypes",[])],h)},42033:(x,t,e)=>{"use strict";var n,r,o,a,p,v,m,_,s,g,l,h,u,d,E,f,c;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatSlashCommandItemModel=t.ChatWelcomeMessageModel=t.ChatModel=t.ChatRequestModel=t.ChatResponseModel=void 0;const y=e(85608),b=e(76003),A=e(43718),S=e(90684),D=e(19413),I=e(44260);class w extends A.Disposable{get responseParts(){return y.__classPrivateFieldGet(this,r,"f")}get responseContents(){return y.__classPrivateFieldGet(this,o,"f")}get isComplete(){return y.__classPrivateFieldGet(this,a,"f")}get isCanceled(){return y.__classPrivateFieldGet(this,p,"f")}get requestId(){return y.__classPrivateFieldGet(this,v,"f")}get responseText(){return y.__classPrivateFieldGet(this,m,"f")}get errorDetails(){return y.__classPrivateFieldGet(this,_,"f")}get followups(){return y.__classPrivateFieldGet(this,s,"f")}get onDidChange(){return y.__classPrivateFieldGet(this,g,"f").event}constructor(k,F,L,B){super(),n.add(this),this.session=F,this.agentId=L,r.set(this,[]),o.set(this,[]),a.set(this,!1),p.set(this,!1),v.set(this,void 0),m.set(this,""),_.set(this,void 0),s.set(this,void 0),g.set(this,this.registerDispose(new A.Emitter)),y.__classPrivateFieldSet(this,v,k,"f"),B&&(y.__classPrivateFieldSet(this,o,B.responseContents,"f"),y.__classPrivateFieldSet(this,r,B.responseParts||[],"f"),y.__classPrivateFieldSet(this,m,B.responseText,"f"),y.__classPrivateFieldSet(this,a,B.isComplete,"f"),y.__classPrivateFieldSet(this,p,B.isCanceled,"f"),y.__classPrivateFieldSet(this,_,B.errorDetails,"f"),y.__classPrivateFieldSet(this,s,B.followups,"f"))}updateContent(k,F){var L;const B=y.__classPrivateFieldGet(this,r,"f").length-1;if(k.kind==="content"||k.kind==="markdownContent"){const U=y.__classPrivateFieldGet(this,r,"f")[B];!U||U.kind!=="markdownContent"?k.kind==="content"?y.__classPrivateFieldGet(this,r,"f").push({content:new S.MarkdownString(k.content),kind:"markdownContent"}):y.__classPrivateFieldGet(this,r,"f").push(k):k.kind==="markdownContent"?y.__classPrivateFieldGet(this,r,"f")[B]={content:new S.MarkdownString(U.content.value+k.content.value),kind:"markdownContent"}:y.__classPrivateFieldGet(this,r,"f")[B]={content:new S.MarkdownString(U.content.value+k.content,U.content),kind:"markdownContent"},y.__classPrivateFieldGet(this,n,"m",l).call(this)}else if(k.kind==="reasoning"){const U=y.__classPrivateFieldGet(this,r,"f")[B];!U||U.kind!=="reasoning"?y.__classPrivateFieldGet(this,r,"f").push({content:k.content.replace(/^<think>/,""),kind:"reasoning"}):y.__classPrivateFieldGet(this,r,"f")[B]={content:U.content+k.content,kind:"reasoning"},y.__classPrivateFieldGet(this,n,"m",l).call(this)}else if(k.kind==="asyncContent"){const U=y.__classPrivateFieldGet(this,r,"f").push(k)-1;y.__classPrivateFieldGet(this,n,"m",l).call(this),(L=k.resolvedContent)===null||L===void 0||L.then(W=>{typeof W=="string"?y.__classPrivateFieldGet(this,r,"f")[U]={content:new S.MarkdownString(W),kind:"markdownContent"}:(0,S.isMarkdownString)(W)?y.__classPrivateFieldGet(this,r,"f")[U]={content:W,kind:"markdownContent"}:y.__classPrivateFieldGet(this,r,"f")[U]=W,y.__classPrivateFieldGet(this,n,"m",l).call(this,F)})}else if(k.kind==="treeData"||k.kind==="component")y.__classPrivateFieldGet(this,r,"f").push(k),y.__classPrivateFieldGet(this,n,"m",l).call(this,F);else if(k.kind==="toolCall"){const U=y.__classPrivateFieldGet(this,r,"f").find(W=>W.kind==="toolCall"&&W.content.id===k.content.id);U?U.content=k.content:y.__classPrivateFieldGet(this,r,"f").push(k),y.__classPrivateFieldGet(this,n,"m",l).call(this,F)}}complete(){y.__classPrivateFieldSet(this,a,!0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}cancel(){y.__classPrivateFieldSet(this,a,!0,"f"),y.__classPrivateFieldSet(this,p,!0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}reset(){y.__classPrivateFieldSet(this,o,[],"f"),y.__classPrivateFieldSet(this,r,[],"f"),y.__classPrivateFieldSet(this,m,"","f"),y.__classPrivateFieldSet(this,p,!1,"f"),y.__classPrivateFieldSet(this,a,!1,"f"),y.__classPrivateFieldSet(this,_,void 0,"f"),y.__classPrivateFieldSet(this,s,void 0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}setErrorDetails(k){y.__classPrivateFieldSet(this,_,k,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}setFollowups(k){y.__classPrivateFieldSet(this,s,k,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}toJSON(){return{isCanceled:this.isCanceled,responseContents:this.responseContents,responseText:this.responseText,responseParts:this.responseParts,errorDetails:this.errorDetails,followups:this.followups}}}t.ChatResponseModel=w,r=new WeakMap,o=new WeakMap,a=new WeakMap,p=new WeakMap,v=new WeakMap,m=new WeakMap,_=new WeakMap,s=new WeakMap,g=new WeakMap,n=new WeakSet,l=function(k){y.__classPrivateFieldSet(this,m,y.__classPrivateFieldGet(this,r,"f").map(L=>L.kind==="asyncContent"?L.content:L.kind==="treeData"||L.kind==="component"?"":L.kind==="toolCall"?L.content.function.name:L.kind==="reasoning"?"":L.content.value).join(`
31603
31603
 
31604
31604
  `),"f");const F=[];for(const L of y.__classPrivateFieldGet(this,r,"f")){const B=F[F.length-1];L.kind==="markdownContent"&&B?.kind==="markdownContent"?F[F.length-1]={content:new S.MarkdownString(B.content.value+L.content.value,{isTrusted:B.content.isTrusted}),kind:"markdownContent"}:F.push(L)}y.__classPrivateFieldSet(this,o,F,"f"),k||y.__classPrivateFieldGet(this,g,"f").fire()};class T{get requestId(){return y.__classPrivateFieldGet(this,h,"f")}constructor(k,F,L,B){this.session=F,this.message=L,this.response=B,h.set(this,void 0),y.__classPrivateFieldSet(this,h,k,"f")}toJSON(){return{requestId:this.requestId,message:this.message,response:this.response}}}t.ChatRequestModel=T,h=new WeakMap;class R extends A.Disposable{constructor(k){var F,L;super(),this.requestIdPool=0,u.set(this,void 0),d.set(this,new Map),E.set(this,0),f.set(this,void 0),y.__classPrivateFieldSet(this,u,(F=k?.sessionId)!==null&&F!==void 0?F:(0,A.uuid)(),"f"),this.history=(L=k?.history)!==null&&L!==void 0?L:new I.MsgHistoryManager,y.__classPrivateFieldSet(this,f,k?.modelId,"f")}get sessionId(){return y.__classPrivateFieldGet(this,u,"f")}get requests(){return Array.from(y.__classPrivateFieldGet(this,d,"f").values())}restoreRequests(k){y.__classPrivateFieldSet(this,d,new Map(k.map(F=>[F.requestId,F])),"f"),this.requestIdPool=k.length}get slicedMessageCount(){return y.__classPrivateFieldGet(this,E,"f")}get modelId(){return y.__classPrivateFieldGet(this,f,"f")}set modelId(k){y.__classPrivateFieldSet(this,f,k,"f")}getMessageHistory(k){var F,L;const B=[];for(const U of this.requests)if(U.response.isComplete){B.push({role:"user",content:!((F=U.message.images)===null||F===void 0)&&F.length?[{type:"text",text:U.message.prompt},...U.message.images.map(W=>({type:"image",image:new URL(W)}))]:U.message.prompt});for(const W of U.response.responseParts)W.kind==="treeData"||W.kind==="component"||(W.kind!=="toolCall"?B.push({role:"assistant",content:[{type:"text",text:W.kind==="markdownContent"?W.content.value:W.content}]}):(B[B.length-1].role!=="assistant"&&B.push({role:"assistant",content:[]}),B[B.length-1].content.push({type:"tool-call",toolCallId:W.content.id,toolName:W.content.function.name,args:(()=>{try{return JSON.parse(W.content.function.arguments||"{}")}catch(j){return console.error("Failed to parse tool call arguments:",j),{}}})()}),B.push({role:"tool",content:[{type:"tool-result",toolCallId:W.content.id,toolName:W.content.function.name,result:(()=>{try{return JSON.parse(W.content.result||"{}")}catch(j){return console.error("Failed to parse tool result:",j),{}}})()}]})))}if(k)for(;y.__classPrivateFieldGet(this,E,"f")<B.length&&!(JSON.stringify(B.slice(y.__classPrivateFieldGet(this,E,"f"))).length/3<=k);)y.__classPrivateFieldSet(this,E,(L=y.__classPrivateFieldGet(this,E,"f"),L++,L),"f");return B.slice(y.__classPrivateFieldGet(this,E,"f"))}addRequest(k){const F=k,L=`${this.sessionId}_request_${this.requestIdPool++}`,B=new w(L,this,F.agentId),U=new T(L,this,F,B);return y.__classPrivateFieldGet(this,d,"f").set(L,U),U}acceptResponseProgress(k,F,L){if(k.response.isComplete)throw new Error("acceptResponseProgress: Adding progress to a completed response");const{kind:B}=F;["content","markdownContent","asyncContent","treeData","component","toolCall","reasoning"].includes(B)?k.response.updateContent(F,L):console.error(`Couldn't handle progress: ${JSON.stringify(F)}`)}getRequest(k){return y.__classPrivateFieldGet(this,d,"f").get(k)}dispose(){super.dispose(),y.__classPrivateFieldGet(this,d,"f").forEach(k=>k.response.dispose())}toJSON(){return{sessionId:this.sessionId,modelId:this.modelId,history:this.history,requests:this.requests}}}t.ChatModel=R,u=new WeakMap,d=new WeakMap,E=new WeakMap,f=new WeakMap;let P=c=class extends A.Disposable{get id(){return this._id}constructor(k,F){super(),this.content=k,this.sampleQuestions=F,this._id="welcome_"+c.nextId++}};t.ChatWelcomeMessageModel=P,P.nextId=0,t.ChatWelcomeMessageModel=P=c=y.__decorate([(0,b.Injectable)({multiple:!0}),y.__metadata("design:paramtypes",[Object,Array])],P);let O=class extends A.Disposable{constructor(k,F,L){super(),this.chatCommand=k,this.command=F,this.agentId=L}get name(){return this.chatCommand.name}get isShortcut(){return!!this.chatCommand.isShortcut}get icon(){return this.chatCommand.icon}get description(){return this.chatCommand.description}get tooltip(){return this.chatCommand.tooltip}get nameWithSlash(){return this.name.startsWith(D.SLASH_SYMBOL)?this.name:`${D.SLASH_SYMBOL} ${this.name}`}};t.ChatSlashCommandItemModel=O,t.ChatSlashCommandItemModel=O=y.__decorate([(0,b.Injectable)({multiple:!0}),y.__metadata("design:paramtypes",[Object,String,String])],O)},42995:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMultiDiffSource=t.ChatMultiDiffResolver=void 0;const r=e(85608),o=e(76003),a=e(41869),p=e(64335),v=e(73974);let m=n=class{canHandleUri(l){return l.scheme===n.CHAT_EDITING_MULTI_DIFF_SOURCE_RESOLVER_SCHEME}resolveDiffSource(l){return Promise.resolve(new s(this.baseApplyService,this.appConfig))}};t.ChatMultiDiffResolver=m,m.CHAT_EDITING_MULTI_DIFF_SOURCE_RESOLVER_SCHEME="chat-editing-multi-diff-source",r.__decorate([(0,o.Autowired)(v.BaseApplyService),r.__metadata("design:type",v.BaseApplyService)],m.prototype,"baseApplyService",void 0),r.__decorate([(0,o.Autowired)(a.AppConfig),r.__metadata("design:type",Object)],m.prototype,"appConfig",void 0),t.ChatMultiDiffResolver=m=n=r.__decorate([(0,o.Injectable)()],m);const _=(g,l,h)=>a.URI.from({scheme:v.BaseApplyService.CHAT_EDITING_SOURCE_RESOLVER_SCHEME,path:g,query:a.URI.stringifyQuery({id:l,side:h})});class s{constructor(l,h){this.baseApplyService=l,this.appConfig=h,this.resources=(()=>{const u=this.baseApplyService,d=this.appConfig;return{get value(){return u.getSessionCodeBlocks().filter(E=>E.status==="success"||E.status==="pending").reduce((E,f)=>{const c=E.find(y=>y.relativePath===f.relativePath);return c?(f.version<c.oldVersion&&(c.oldVersion=f.version,c.oldBlockId=f.toolCallId),f.version>c.newVersion&&(c.newVersion=f.version,c.newBlockId=f.toolCallId)):E.push({relativePath:f.relativePath,oldBlockId:f.toolCallId,newBlockId:f.toolCallId,oldVersion:f.version,newVersion:f.version}),E},[]).map(E=>{const f=a.path.join(d.workspaceDir,E.relativePath);return new p.MultiDiffEditorItem(_(f,E.oldBlockId,"left"),_(f,E.newBlockId,"right"),a.URI.file(f))})},onDidChange:this.baseApplyService.onCodeBlockUpdate}})()}}t.ChatMultiDiffSource=s},51081:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatProxyService=void 0;const r=e(85608),o=e(76003),a=e(41869),p=e(43718),v=e(27284),m=e(9447),_=e(72665),s=e(93062),g=e(19413),l=e(34817),h=e(29770),u=e(11735);let d=n=class extends p.Disposable{constructor(){super(...arguments),this.chatDeferred=new p.Deferred}getRequestOptions(){const f=this.preferenceService.get(v.AINativeSettingSectionsId.LLMModelSelection),c=this.preferenceService.get(v.AINativeSettingSectionsId.ModelID);let y="",b="";f==="deepseek"?y=this.preferenceService.get(v.AINativeSettingSectionsId.DeepseekApiKey,""):f==="openai"?y=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiApiKey,""):f==="anthropic"?y=this.preferenceService.get(v.AINativeSettingSectionsId.AnthropicApiKey,""):(y=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiApiKey,""),b=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiBaseURL,""));const A=this.preferenceService.get(v.AINativeSettingSectionsId.MaxTokens),S=this.chatAgentService.getAgent(n.AGENT_ID);return{clientId:this.applicationService.clientId,model:f,modelId:c,apiKey:y,baseURL:b,maxTokens:A,system:S?.metadata.systemPrompt}}registerDefaultAgent(){this.chatAgentViewService.registerChatComponent({id:"toolCall",component:l.ChatToolRender,initialProps:{}}),this.addDispose(this.chatAgentService.registerAgent({id:n.AGENT_ID,metadata:{systemPrompt:this.preferenceService.get(v.AINativeSettingSectionsId.SystemPrompt,`You are a powerful AI coding assistant working in OpenSumi, a top IDE framework. You collaborate with a USER to solve coding tasks, which may involve creating, modifying, or debugging code, or answering questions. When the USER sends a message, relevant context (e.g., open files, cursor position, edit history, linter errors) may be attached. Use this information as needed.
31605
31605
 
@@ -31721,16 +31721,16 @@ ${A.slice(1).join(`
31721
31721
  `).slice(d.startPosition.row);return`${f[0].slice(d.startPosition.column)}${f.length>1?`
31722
31722
  ${f.slice(1).join(`
31723
31723
  `)}`:""}`}}return l.text}findTypeIdentifier(l){let h=l;for(;h;){if(h.type==="type_identifier")return h.text;const u=h.child(1);if(!u)break;h=u}return""}async extractImportPaths(l){var h;const u=[],d=await this.parser.parse(l),E=d?.rootNode,f=[],c=[];if(E)for(let y=0;y<E?.childCount;y++){const b=E.child(y);if(b?.type==="import_statement")f.push(b);else if(b?.type==="type_annotation"){const A=b.child(1);A&&c.push(A.text)}else if(b?.type==="lexical_declaration"){const A=this.findTypeIdentifier(b);A&&c.push(A)}}for(const y of f)if(c.some(b=>y.text.includes(b))){let b=(h=y.child(3))===null||h===void 0?void 0:h.text;(b?.includes("'")||b?.includes('"'))&&(b=b.slice(1,-1)),b&&u.push(b)}return u}async extractInterfaceOrTypeCode(l){var h;const u=[];if(this.language==="typescript"){await this.parserLoaded.promise;const d=(h=this.parser)===null||h===void 0?void 0:h.parse(l),E=d?.rootNode;if(E)for(let f=0;f<E?.childCount;f++){const c=E.child(f);if(c?.type==="export_statement"){const y=c.child(1);(y?.type==="interface_declaration"||y?.type==="type_alias_declaration")&&u.push(y.text)}else(c?.type==="interface_declaration"||c?.type==="type_alias_declaration")&&u.push(c.text)}}return u}async findSyntaxErrorCount(l){var h;await this.parserLoaded.promise;const u=(h=this.parser)===null||h===void 0?void 0:h.parse(l),d=u?.rootNode;if(!d)return 0;let E=0;const f=c=>{(c.type==="function_declaration"||c.type==="class_declaration"||c.type==="variable_declarator"||c.type==="statement_block"||c.type==="expression_statement")&&(c.hasError||c.isMissing||c.type==="ERROR")&&E++;for(let b=0;b<c.childCount;b++){const A=c.child(b);A&&f(A)}};return f(d),E}async findNearestCodeBlockWithPosition(l,h){const u=await this.parser.parse(l);if(u){const{rootNode:d}=u,E=d.namedDescendantForIndex(h),f=this.findContainingCodeBlockWithPosition(E,h);if(!f)return null;let y=l.split(`
31724
- `).slice(0,f.startPosition.row).reduce((b,A)=>b+A.length,0);return y+=f.startPosition.row,y+=f.startPosition.column,{codeBlock:f.text,range:{start:{line:f.startPosition.row,character:0},end:{line:f.endPosition.row,character:1/0}},offset:y,type:f.startPosition.row===f.endPosition.row?p.NearestCodeBlockType.Line:p.NearestCodeBlockType.Block}}return null}dispose(){this.parser.delete(),this.lruCache.clear()}};t.LanguageParser=s,n.__decorate([(0,o.Autowired)(_.WasmModuleManager),n.__metadata("design:type",_.WasmModuleManager)],s.prototype,"wasmModuleManager",void 0),n.__decorate([(0,o.Autowired)(m.TreeSitterLanguageFacts),n.__metadata("design:type",m.TreeSitterLanguageFacts)],s.prototype,"languageFacts",void 0),t.LanguageParser=s=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String])],s)},85679:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageParserService=void 0;const n=e(85608),r=e(76003),o=e(3073),a=e(22486);let p=class{constructor(){this.pool=new Map}createParser(m){const _=a.parserNameMap[m];if(_)return this.pool.has(_)||this.pool.set(_,this.injector.get(o.LanguageParser,[_])),this.pool.get(_)}dispose(){this.pool.forEach(m=>m.dispose()),this.pool.clear()}};t.LanguageParserService=p,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],p.prototype,"injector",void 0),t.LanguageParserService=p=n.__decorate([(0,r.Injectable)()],p)},53374:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toMonacoRange=e;function e(n){return{startLineNumber:n.startPosition.row+1,startColumn:n.startPosition.column+1,endLineNumber:n.endPosition.row+1,endColumn:n.endPosition.column+1}}},19584:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GolangLanguageFacts=void 0;const e=["function_declaration","method_declaration","block","if_statement","else_statement","switch_statement","case_clause","for_statement","range_clause","type_switch_statement","type_case_clause","comm_clause","select_statement","go_statement","defer_statement"],n=new Set(e);class r{constructor(){this.name="go",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return n}isCodeBlock(a){return n.has(a)}}t.GolangLanguageFacts=r},22486:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeSitterLanguageFacts=t.knownLanguageFacts=void 0;const n=e(85608);n.__exportStar(e(17973),t);const r=e(76003),o=e(19584),a=e(44606),p=e(82381),v=e(41486),m=e(98588),_=e(96436),s=e(2349),g=e(78542),l=new Set;t.knownLanguageFacts=[o.GolangLanguageFacts,a.JavaLanguageFacts,p.JavaScriptLanguageFacts,v.JavaScriptReactLanguageFacts,m.PythonLanguageFacts,_.RustLanguageFacts,s.TypeScriptLanguageFacts,g.TypeScriptReactLanguageFacts];let h=class{constructor(){this.langs=new Map,t.knownLanguageFacts.forEach(d=>{const E=new d;this.langs.set(E.name,E)})}isCodeBlock(d,E){const f=this.langs.get(d);return f&&f.isCodeBlock?f.isCodeBlock(E):!1}isFunctionCodeBlock(d,E){const f=this.langs.get(d);return f&&f.isFunctionCodeBlocks?f.isFunctionCodeBlocks(E):!1}provideFunctionInfo(d,E){const f=this.langs.get(d);return f&&f.provideFunctionInfo?f.provideFunctionInfo(E):null}getCodeBlockTypes(d){const E=this.langs.get(d);return E?E.provideCodeBlocks():l}};t.TreeSitterLanguageFacts=h,t.TreeSitterLanguageFacts=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},44606:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaLanguageFacts=void 0;const e=["compilation_unit","class_declaration","interface_declaration","enum_declaration","method_declaration","constructor_declaration","block","static_initializer","instance_initializer","if_statement","switch_statement","while_statement","do_statement","for_statement","enhanced_for_statement","try_statement","catch_clause","finally_clause"],n=new Set(["method_declaration","constructor_declaration"]),r=new Set(e);class o{constructor(){this.name="java",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(p){return r.has(p)}isFunctionCodeBlocks(p){return n.has(p)}}t.JavaLanguageFacts=o},82381:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaScriptLanguageFacts=t.functionBlockCodeTypes=t.javascriptBlockCodeTypes=void 0;const n=e(53374);t.javascriptBlockCodeTypes=["function","function_declaration","function_expression","arrow_function","class_declaration","method_definition","if_statement","switch_case","while_statement","do_statement","for_statement","for_in_statement","try_statement","catch_clause","block","export_statement","lexical_declaration"],t.functionBlockCodeTypes=["function","function_declaration","function_expression","arrow_function","method_definition"];const r=new Set(t.functionBlockCodeTypes),o=new Set(t.javascriptBlockCodeTypes);class a{constructor(){this.name="javascript",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return o}isCodeBlock(v){return o.has(v)}isFunctionCodeBlocks(v){return r.has(v)}provideFunctionInfo(v){var m,_,s;switch(v.type){case"function_declaration":case"function_expression":return{infoCategory:"function",type:v.type,name:((m=v.firstNamedChild)===null||m===void 0?void 0:m.text)||"",signatures:v.children.filter(g=>g.type==="parameter").map(g=>{var l;return((l=g.firstChild)===null||l===void 0?void 0:l.text)||""}),range:(0,n.toMonacoRange)(v)};case"arrow_function":{const g=v.parent;return g&&g.type==="variable_declarator"&&g.parent&&(g.parent.type==="lexical_declaration"||g.parent.type==="export_statement"||g.parent.type==="variable_declaration")?{infoCategory:"function",type:v.type,name:((_=g.firstChild)===null||_===void 0?void 0:_.text)||"",signatures:v.children.filter(l=>l.type==="parameter").map(l=>{var h;return((h=l.firstChild)===null||h===void 0?void 0:h.text)||""}),range:(0,n.toMonacoRange)(g.parent)}:null}case"method_definition":return{infoCategory:"function",type:v.type,name:((s=v.firstNamedChild)===null||s===void 0?void 0:s.text)||"",signatures:v.children.filter(g=>g.type==="parameter").map(g=>{var l;return((l=g.firstChild)===null||l===void 0?void 0:l.text)||""}),range:(0,n.toMonacoRange)(v)}}return null}}t.JavaScriptLanguageFacts=a},41486:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaScriptReactLanguageFacts=t.javascriptreactBlockCodeTypes=void 0;const n=e(82381);t.javascriptreactBlockCodeTypes=[...n.javascriptBlockCodeTypes,"jsx_element","jsx_self_closing_element","jsx_expression","jsx_fragment"];const r=new Set(t.javascriptreactBlockCodeTypes);class o{constructor(){this.name="jsx",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(p){return r.has(p)}}t.JavaScriptReactLanguageFacts=o},98588:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PythonLanguageFacts=t.pythonBlockCodeTypes=void 0,t.pythonBlockCodeTypes=["function_definition","class_definition","compound_statement","if_statement","elif_clause","else_clause","for_statement","while_statement","try_statement","except_clause","with_statement","decorated_definition"];const e=new Set(t.pythonBlockCodeTypes);class n{constructor(){this.name="python",this.listCommentStyle="# ",this.blockCommentStyle={start:"'''",end:"'''",linePrefix:""}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.PythonLanguageFacts=n},96436:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RustLanguageFacts=t.rustBlockCodeTypes=void 0,t.rustBlockCodeTypes=["function_item","impl_item","trait_item","block","if_expression","match_expression","while_expression","loop_expression","for_expression","closure_expression","struct_item","enum_item","union_item","mod_item"];const e=new Set(t.rustBlockCodeTypes);class n{constructor(){this.name="rust",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.RustLanguageFacts=n},17973:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parserIdentifierMap=t.parserNameMap=void 0;const r=e(85608).__importDefault(e(19891)),o={typescript:"typescript",typescriptreact:"tsx",javascript:"javascript",javascriptreact:"jsx",rust:"rust",python:"python",java:"java",go:"go"};t.parserNameMap=o,t.parserIdentifierMap=(0,r.default)(t.parserNameMap)},2349:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeScriptLanguageFacts=t.typescriptBlockTypes=void 0,t.typescriptBlockTypes=["function","function_declaration","function_expression","arrow_function","class_declaration","interface_declaration","method_definition","method_signature","enum_declaration","type_alias_declaration","lexical_declaration","if_statement","switch_case","while_statement","do_statement","for_statement","for_in_statement","for_of_statement","try_statement","catch_clause","block","module","public_field_definition","private_field_definition","export_statement"];const e=new Set(t.typescriptBlockTypes);class n{constructor(){this.name="typescript",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.TypeScriptLanguageFacts=n},78542:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeScriptReactLanguageFacts=t.typescriptreactBlockTypes=void 0;const n=e(2349);t.typescriptreactBlockTypes=[...n.typescriptBlockTypes,"jsx_element","jsx_self_closing_element","jsx_expression","jsx_fragment"];const r=new Set(t.typescriptreactBlockTypes);class o{constructor(){this.name="tsx",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(p){return r.has(p)}}t.TypeScriptReactLanguageFacts=o},67045:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WasmModuleManager=void 0;const n=e(85608),r=n.__importDefault(e(13833)),o=e(76003),a=e(6858),p=e(70392);let v=class{async resolveResourceUri(){const _=await this.rendererRuntime.provideResourceUri(a.EKnownResources.TreeSitterWasmDirectory);this.resolvedResourceUriDeferred.resolve(_)}constructor(){this.resolvedResourceUriDeferred=new p.Deferred,this.cachedRuntime=new Map,this.parserInitialized=!1,this.resolveResourceUri()}async initParser(){const _=await this.resolvedResourceUriDeferred.promise;let s;return _.endsWith("/")?s=`${_}tree-sitter.wasm`:s=`${_}/tree-sitter.wasm`,this.parserInitialized||(await r.default.init({locateFile:()=>s}),this.parserInitialized=!0),new r.default}async loadLanguage(_){if(!this.cachedRuntime.has(_)){const s=new p.Deferred;this.cachedRuntime.set(_,s);const g=await this.resolvedResourceUriDeferred.promise;let l;g.endsWith("/")?l=`${g}tree-sitter-${_}.wasm`:l=`${g}/tree-sitter-${_}.wasm`,fetch(l).then(h=>h.arrayBuffer()).then(h=>{s.resolve(h)})}return this.cachedRuntime.get(_).promise}};t.WasmModuleManager=v,n.__decorate([(0,o.Autowired)(a.RendererRuntime),n.__metadata("design:type",a.RendererRuntime)],v.prototype,"rendererRuntime",void 0),t.WasmModuleManager=v=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],v)},4972:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIRightTabRenderer=t.AILeftTabRenderer=t.AIChatTabRendererWithTab=t.AIChatTabRenderer=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),a=e(41869),p=e(89195),v=e(1149),m=e(43718),_=e(11090),s=e(63067),g=e(46245),l=e(66368),h=e(19951),u=e(752),d=e(19413),E=n.__importDefault(e(87708)),f=()=>{const{side:D}=o.default.useContext(h.TabbarConfig),I=(0,a.useInjectable)(u.TabbarServiceFactory)(D);return(0,o.useEffect)(()=>{I.setIsLatter(!0)},[I]),o.default.createElement("div",{style:{width:0}},o.default.createElement(g.TabbarViewBase,{tabSize:0,MoreTabView:g.IconElipses,TabView:g.IconTabView,barSize:0,panelBorderSize:1}))},c=({className:D,components:I})=>o.default.createElement(h.TabRendererBase,{side:d.AI_CHAT_VIEW_ID,direction:"left-to-right",id:E.default.ai_chat_panel,className:(0,r.default)(D,`${d.AI_CHAT_VIEW_ID}-slot`),components:I,TabbarView:()=>o.default.createElement(f,null),TabpanelView:()=>o.default.createElement(l.BaseTabPanelView,{PanelView:l.ContainerView,PanelViewProps:{className:E.default.ai_chat_view_container}})});t.AIChatTabRenderer=c;const y=({className:D,components:I})=>o.default.createElement(h.TabRendererBase,{side:d.AI_CHAT_VIEW_ID,direction:"right-to-left",id:E.default.ai_chat_panel,className:(0,r.default)(D,`${d.AI_CHAT_VIEW_ID}-slot`,"design_right_slot"),components:I,TabbarView:()=>o.default.createElement(g.ChatTabbarRenderer2,null),TabpanelView:()=>o.default.createElement(l.BaseTabPanelView,{PanelView:l.ContainerView,PanelViewProps:{className:E.default.ai_chat_view_container}})});t.AIChatTabRendererWithTab=y;const b=({className:D,components:I})=>o.default.createElement(_.DesignLeftTabRenderer,{className:D,components:I,tabbarView:A});t.AILeftTabRenderer=b;const A=()=>{const D=(0,a.useInjectable)(s.IMainLayoutService),I=(0,a.useInjectable)(u.TabbarServiceFactory)(a.SlotLocation.right),w=(0,a.useAutorun)(I.currentContainerId),T=o.default.useMemo(()=>D.getExtraMenu(),[D]),[R]=(0,a.useContextMenus)(T),P=(0,o.useCallback)(({renderContainers:O})=>{const M=I.visibleContainers.filter(k=>{var F;return!(!((F=k.options)===null||F===void 0)&&F.hideTab)});return o.default.createElement(o.default.Fragment,null,M.length>0&&o.default.createElement(p.HorizontalVertical,{margin:"8px auto 0px",width:"60%"}),M.map(k=>O(k,I,w)))},[w,I]);return o.default.createElement(g.LeftTabbarRenderer,{renderOtherVisibleContainers:P,isRenderExtraTopMenus:!1,renderExtraMenus:o.default.createElement("div",{className:E.default.extra_bottom_icon_container},R.length>=0?R.map(O=>o.default.createElement(p.EnhanceIconWithCtxMenu,{key:O.id,id:O.id,wrapperClassName:E.default.extra_bottom_icon,iconClass:O.icon,menuNodes:O.children,skew:{x:-8,y:-4}})):null)})},S=({className:D,components:I})=>{const w=(0,a.useInjectable)(u.TabbarServiceFactory)(a.SlotLocation.right),T=(0,a.useInjectable)(v.DesignLayoutConfig),R=(0,o.useCallback)(()=>{w.updateCurrentContainerId("")},[]),P=(0,o.useCallback)(M=>{const{component:k}=M,{options:F}=k;return o.default.createElement(l.ContainerView,{...M,customTitleBar:o.default.createElement("div",{className:E.default.header},o.default.createElement("span",{className:E.default.title},F&&F.title),o.default.createElement("div",{className:E.default.side},o.default.createElement(p.EnhancePopover,{id:"ai_right_panel_header_close",title:(0,m.localize)("editor.title.context.close")},o.default.createElement(p.EnhanceIcon,{icon:"close",onClick:R})))),renderContainerWrap:({children:L})=>o.default.createElement("div",{className:E.default.right_slot_container_wrap},o.default.createElement("div",{className:E.default.container},L))})},[]),O=(0,o.useMemo)(()=>T.useMergeRightWithLeftPanel?E.default.right_tab_renderer:"",[T]);return o.default.createElement(_.DesignRightTabRenderer,{components:I,className:O,tabbarView:()=>o.default.createElement(g.RightTabbarRenderer,{barSize:0,style:{width:0}}),tabpanelView:()=>o.default.createElement(l.BaseTabPanelView,{PanelView:P})})};t.AIRightTabRenderer=S},82983:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIChatLogoAvatar=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(41869),a=e(89195),p=e(63067),v=e(19413),m=n.__importDefault(e(88473)),_=()=>{const s=(0,o.useInjectable)(p.IMainLayoutService),g=r.default.useCallback(()=>{s.toggleSlot(v.AI_CHAT_VIEW_ID)},[s]);return r.default.createElement("div",{className:m.default.ai_switch,onClick:g},r.default.createElement(a.AILogoAvatar,{iconClassName:m.default.avatar_icon_large}))};t.AIChatLogoAvatar=_},73974:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseApplyService=void 0;const n=e(85608),r=e(41429),o=e(76003),a=e(41869),p=e(54414),v=e(57517),m=e(55126),_=e(20868),s=e(70392),g=e(2261),l=e(19413),h=e(59347),u=e(40111),d=e(15989);class E extends a.WithEventBus{constructor(){super(),this.onCodeBlockUpdateEmitter=new s.Emitter,this.onCodeBlockUpdate=this.onCodeBlockUpdateEmitter.event,this.activePreviewerMap=this.registerDispose(new s.DisposableMap),this.editorListenerMap=this.registerDispose(new s.DisposableMap),this.addDispose(this.chatInternalService.onCancelRequest(()=>{const c=this.chatInternalService.sessionModel.history.lastMessageId;if(!c)return;const y=this.getMessageCodeBlocks(c);y&&Object.values(y).forEach(b=>{this.cancelApply(b)})})),this.currentSessionId=this.chatInternalService.sessionModel.sessionId,this.addDispose(this.chatInternalService.onChangeSession(c=>{c!==this.currentSessionId&&(this.cancelAllApply(),this.currentSessionId=c)})),this.addDispose(this.chatInternalService.onRegenerateRequest(()=>{const c=this.chatInternalService.sessionModel.history.getMessages(),y=c[c.length-1].id,b=this.getMessageCodeBlocks(y);b&&Object.values(b).forEach(A=>{this.cancelApply(A)})})),this.addDispose(this.chatInternalService.onWillClearSession(c=>{this.cancelAllApply(c)}))}getMessageCodeBlocks(c,y){y=y||this.chatInternalService.sessionModel.sessionId;const b=this.chatInternalService.getSession(y);if(!b)throw new Error(`Session ${y} not found`);const A=b.history.getMessageAdditional(c);return A?.codeBlockMap}onEditorGroupClose(c){const y=s.path.relative(this.appConfig.workspaceDir,c.payload.resource.uri.path.toString());this.activePreviewerMap.get(y)&&this.activePreviewerMap.disposeKey(y),this.editorListenerMap.disposeKey(c.payload.resource.uri.toString())}async onEditorGroupOpen(c){var y;const b=s.path.relative(this.appConfig.workspaceDir,c.payload.resource.uri.path.toString());if(this.duringApply||this.activePreviewerMap.has(b)||!this.chatInternalService.sessionModel.history.getMessages().length)return;const A=((y=this.getUriCodeBlocks(c.payload.resource.uri))===null||y===void 0?void 0:y.filter(S=>S.status==="pending"))||[];if(A.length>0&&A[0].updatedCode){const S=c.payload.group.codeEditor.monacoEditor;await this.renderApplyResult(S,A[0],A[0].updatedCode)}}get currentPreviewer(){var c;const y=(c=this.editorService.currentEditor)===null||c===void 0?void 0:c.currentUri;if(y)return this.activePreviewerMap.get(s.path.relative(this.appConfig.workspaceDir,y.path.toString()))}getUriCodeBlocks(c){const y=this.getSessionCodeBlocks(),b=s.path.relative(this.appConfig.workspaceDir,c.path.toString());return y.filter(A=>A.relativePath===b).sort((A,S)=>S.version-A.version)}getPendingPaths(c){return this.getSessionCodeBlocks(c).filter(b=>b.status==="pending").map(b=>b.relativePath)}getSessionCodeBlocks(c){const y=c?this.chatInternalService.getSession(c):this.chatInternalService.sessionModel;if(!y)throw new Error(`Session ${c} not found`);const b=y.history.sessionAdditionals;return Array.from(b.values()).map(A=>A.codeBlockMap||{}).reduce((A,S)=>(Object.values(S).forEach(D=>{A.push(D)}),A),[])}getCodeBlock(c,y){if(y=y||this.chatInternalService.sessionModel.history.lastMessageId,!y)throw new Error("Message ID is required");const b=this.getMessageCodeBlocks(y);if(b)return b[c]}updateCodeBlock(c){const y=c.messageId,b=this.getMessageCodeBlocks(y);if(!b)throw new Error("Code block not found");b[c.toolCallId]=c,this.chatInternalService.sessionModel.history.setMessageAdditional(y,{codeBlockMap:b}),this.onCodeBlockUpdateEmitter.fire(c)}async registerCodeBlock(c,y,b,A){var S,D;const I=this.chatInternalService.sessionModel.history.lastMessageId,w=this.getUriCodeBlocks(s.URI.file(s.path.join(this.appConfig.workspaceDir,c))),T=await this.editorDocumentModelService.createModelReference(s.URI.file(s.path.join(this.appConfig.workspaceDir,c))),R={codeEdit:y,relativePath:c,status:"generating",iterationCount:1,version:1,createdAt:Date.now(),toolCallId:b,messageId:I,instructions:A,originalCode:T.instance.getText()};if(w?.length){R.version=w.length+1;for(const O of w)if(O.relativePath===c&&(!((D=(S=O.applyResult)===null||S===void 0?void 0:S.diagnosticInfos)===null||D===void 0)&&D.length))R.iterationCount++;else break}const P=this.getMessageCodeBlocks(I)||{};return P[b]=R,this.chatInternalService.sessionModel.history.setMessageAdditional(I,{codeBlockMap:P}),this.onCodeBlockUpdateEmitter.fire(R),R}async apply(c){var y,b;try{if(this.duringApply=!0,c.iterationCount>3)throw new Error("Lint error max iteration count exceeded");const A=c.originalCode?await this.doApply(c):{result:c.codeEdit};if(!A.stream&&!A.result)return c.status="failed",this.updateCodeBlock(c),c;this.activePreviewerMap.has(c.relativePath)&&(this.editorListenerMap.disposeKey(s.URI.file(s.path.join(this.appConfig.workspaceDir,c.relativePath)).toString()),this.activePreviewerMap.disposeKey(c.relativePath));const S=await this.editorService.open(s.URI.file(s.path.join(this.appConfig.workspaceDir,c.relativePath)));if(!S)throw new Error("Failed to open file");const D=await this.renderApplyResult(S.group.codeEditor.monacoEditor,c,A.result||A.stream,A.range);if(c.updatedCode=D.updatedCode,c.status="pending",this.postApplyHandler&&typeof this.postApplyHandler=="function")try{await this.postApplyHandler(S.group.codeEditor.monacoEditor)}catch{}const I=S.group.codeEditor.monacoEditor.getModel(),w=this.getDiagnosticInfos(I.uri.toString(),((y=D.result)===null||y===void 0?void 0:y.rangesFromDiffHunk)||[]);return D.result&&(c.applyResult={diff:(b=D.result)===null||b===void 0?void 0:b.diff,diagnosticInfos:w}),this.updateCodeBlock(c),c}catch(A){throw c.status="failed",this.updateCodeBlock(c),A}finally{this.duringApply=!1}}async renderApplyResult(c,y,b,A){var S,D,I;const w=new s.Deferred,T=d.InlineDiffController.get(c);if(A=A||c.getModel().getFullModelRange(),typeof b=="string"){const R=b,P=c.getModel().getValue(),O=s.URI.file(s.path.join(this.appConfig.workspaceDir,y.relativePath)),M=this.editorDocumentModelService.getModelReference(O);(P!==R||M?.instance.dirty)&&((S=c.getModel())===null||S===void 0||S.pushEditOperations([],[g.EditOperation.replace(A,R)],()=>null),await this.editorService.save(O));const k=(D=this.getUriCodeBlocks(O))===null||D===void 0?void 0:D.filter(W=>W.status==="pending"),F=k?.[k.length-1];if(((I=F||y)===null||I===void 0?void 0:I.originalCode)===R)throw new Error("No changes applied");const L=T.createDiffPreviewer(c,_.Selection.fromRange(A,_.SelectionDirection.LTR),{disposeWhenEditorClosed:!0,renderRemovedWidgetImmediately:!0,reverse:!0});this.activePreviewerMap.set(y.relativePath,L),L.setValue(F?.originalCode||y.originalCode||`
31725
- `),this.eventBus.fire(new v.RegisterEditorSideComponentEvent),this.listenPartialEdit(c.getModel(),y).then(W=>{if(W){const j=this.getDiagnosticInfos(c.getModel().uri.toString(),U);y.applyResult={diff:W.diff,diagnosticInfos:j}}this.updateCodeBlock(y),this.editorService.save(s.URI.file(s.path.join(this.appConfig.workspaceDir,y.relativePath)))});const{diff:B,rangesFromDiffHunk:U}=this.getDiffResult(y.originalCode,R,y.relativePath);w.resolve({result:{diff:B,rangesFromDiffHunk:U},updatedCode:R})}else{const R=new u.InlineChatController;R.mountReadable(b);const P=T.showPreviewerByStream(c,{crossSelection:_.Selection.fromRange(A,_.SelectionDirection.LTR),chatResponse:R,previewerOptions:{disposeWhenEditorClosed:!0,renderRemovedWidgetImmediately:!1}});this.addDispose(R.onError(O=>{w.reject(O)})),this.addDispose(R.onAbort(()=>{w.reject(new Error("Apply aborted"))})),this.addDispose(P.getNode().onDiffFinished(async O=>{const M=O.newFullRangeTextLines.join(`
31724
+ `).slice(0,f.startPosition.row).reduce((b,A)=>b+A.length,0);return y+=f.startPosition.row,y+=f.startPosition.column,{codeBlock:f.text,range:{start:{line:f.startPosition.row,character:0},end:{line:f.endPosition.row,character:1/0}},offset:y,type:f.startPosition.row===f.endPosition.row?p.NearestCodeBlockType.Line:p.NearestCodeBlockType.Block}}return null}dispose(){this.parser.delete(),this.lruCache.clear()}};t.LanguageParser=s,n.__decorate([(0,o.Autowired)(_.WasmModuleManager),n.__metadata("design:type",_.WasmModuleManager)],s.prototype,"wasmModuleManager",void 0),n.__decorate([(0,o.Autowired)(m.TreeSitterLanguageFacts),n.__metadata("design:type",m.TreeSitterLanguageFacts)],s.prototype,"languageFacts",void 0),t.LanguageParser=s=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String])],s)},85679:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageParserService=void 0;const n=e(85608),r=e(76003),o=e(3073),a=e(22486);let p=class{constructor(){this.pool=new Map}createParser(m){const _=a.parserNameMap[m];if(_)return this.pool.has(_)||this.pool.set(_,this.injector.get(o.LanguageParser,[_])),this.pool.get(_)}dispose(){this.pool.forEach(m=>m.dispose()),this.pool.clear()}};t.LanguageParserService=p,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],p.prototype,"injector",void 0),t.LanguageParserService=p=n.__decorate([(0,r.Injectable)()],p)},53374:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toMonacoRange=e;function e(n){return{startLineNumber:n.startPosition.row+1,startColumn:n.startPosition.column+1,endLineNumber:n.endPosition.row+1,endColumn:n.endPosition.column+1}}},19584:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GolangLanguageFacts=void 0;const e=["function_declaration","method_declaration","block","if_statement","else_statement","switch_statement","case_clause","for_statement","range_clause","type_switch_statement","type_case_clause","comm_clause","select_statement","go_statement","defer_statement"],n=new Set(e);class r{constructor(){this.name="go",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return n}isCodeBlock(a){return n.has(a)}}t.GolangLanguageFacts=r},22486:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeSitterLanguageFacts=t.knownLanguageFacts=void 0;const n=e(85608);n.__exportStar(e(17973),t);const r=e(76003),o=e(19584),a=e(44606),p=e(82381),v=e(41486),m=e(98588),_=e(96436),s=e(2349),g=e(78542),l=new Set;t.knownLanguageFacts=[o.GolangLanguageFacts,a.JavaLanguageFacts,p.JavaScriptLanguageFacts,v.JavaScriptReactLanguageFacts,m.PythonLanguageFacts,_.RustLanguageFacts,s.TypeScriptLanguageFacts,g.TypeScriptReactLanguageFacts];let h=class{constructor(){this.langs=new Map,t.knownLanguageFacts.forEach(d=>{const E=new d;this.langs.set(E.name,E)})}isCodeBlock(d,E){const f=this.langs.get(d);return f&&f.isCodeBlock?f.isCodeBlock(E):!1}isFunctionCodeBlock(d,E){const f=this.langs.get(d);return f&&f.isFunctionCodeBlocks?f.isFunctionCodeBlocks(E):!1}provideFunctionInfo(d,E){const f=this.langs.get(d);return f&&f.provideFunctionInfo?f.provideFunctionInfo(E):null}getCodeBlockTypes(d){const E=this.langs.get(d);return E?E.provideCodeBlocks():l}};t.TreeSitterLanguageFacts=h,t.TreeSitterLanguageFacts=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},44606:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaLanguageFacts=void 0;const e=["compilation_unit","class_declaration","interface_declaration","enum_declaration","method_declaration","constructor_declaration","block","static_initializer","instance_initializer","if_statement","switch_statement","while_statement","do_statement","for_statement","enhanced_for_statement","try_statement","catch_clause","finally_clause"],n=new Set(["method_declaration","constructor_declaration"]),r=new Set(e);class o{constructor(){this.name="java",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(p){return r.has(p)}isFunctionCodeBlocks(p){return n.has(p)}}t.JavaLanguageFacts=o},82381:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaScriptLanguageFacts=t.functionBlockCodeTypes=t.javascriptBlockCodeTypes=void 0;const n=e(53374);t.javascriptBlockCodeTypes=["function","function_declaration","function_expression","arrow_function","class_declaration","method_definition","if_statement","switch_case","while_statement","do_statement","for_statement","for_in_statement","try_statement","catch_clause","block","export_statement","lexical_declaration"],t.functionBlockCodeTypes=["function","function_declaration","function_expression","arrow_function","method_definition"];const r=new Set(t.functionBlockCodeTypes),o=new Set(t.javascriptBlockCodeTypes);class a{constructor(){this.name="javascript",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return o}isCodeBlock(v){return o.has(v)}isFunctionCodeBlocks(v){return r.has(v)}provideFunctionInfo(v){var m,_,s;switch(v.type){case"function_declaration":case"function_expression":return{infoCategory:"function",type:v.type,name:((m=v.firstNamedChild)===null||m===void 0?void 0:m.text)||"",signatures:v.children.filter(g=>g.type==="parameter").map(g=>{var l;return((l=g.firstChild)===null||l===void 0?void 0:l.text)||""}),range:(0,n.toMonacoRange)(v)};case"arrow_function":{const g=v.parent;return g&&g.type==="variable_declarator"&&g.parent&&(g.parent.type==="lexical_declaration"||g.parent.type==="export_statement"||g.parent.type==="variable_declaration")?{infoCategory:"function",type:v.type,name:((_=g.firstChild)===null||_===void 0?void 0:_.text)||"",signatures:v.children.filter(l=>l.type==="parameter").map(l=>{var h;return((h=l.firstChild)===null||h===void 0?void 0:h.text)||""}),range:(0,n.toMonacoRange)(g.parent)}:null}case"method_definition":return{infoCategory:"function",type:v.type,name:((s=v.firstNamedChild)===null||s===void 0?void 0:s.text)||"",signatures:v.children.filter(g=>g.type==="parameter").map(g=>{var l;return((l=g.firstChild)===null||l===void 0?void 0:l.text)||""}),range:(0,n.toMonacoRange)(v)}}return null}}t.JavaScriptLanguageFacts=a},41486:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaScriptReactLanguageFacts=t.javascriptreactBlockCodeTypes=void 0;const n=e(82381);t.javascriptreactBlockCodeTypes=[...n.javascriptBlockCodeTypes,"jsx_element","jsx_self_closing_element","jsx_expression","jsx_fragment"];const r=new Set(t.javascriptreactBlockCodeTypes);class o{constructor(){this.name="jsx",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(p){return r.has(p)}}t.JavaScriptReactLanguageFacts=o},98588:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PythonLanguageFacts=t.pythonBlockCodeTypes=void 0,t.pythonBlockCodeTypes=["function_definition","class_definition","compound_statement","if_statement","elif_clause","else_clause","for_statement","while_statement","try_statement","except_clause","with_statement","decorated_definition"];const e=new Set(t.pythonBlockCodeTypes);class n{constructor(){this.name="python",this.listCommentStyle="# ",this.blockCommentStyle={start:"'''",end:"'''",linePrefix:""}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.PythonLanguageFacts=n},96436:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RustLanguageFacts=t.rustBlockCodeTypes=void 0,t.rustBlockCodeTypes=["function_item","impl_item","trait_item","block","if_expression","match_expression","while_expression","loop_expression","for_expression","closure_expression","struct_item","enum_item","union_item","mod_item"];const e=new Set(t.rustBlockCodeTypes);class n{constructor(){this.name="rust",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.RustLanguageFacts=n},17973:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parserIdentifierMap=t.parserNameMap=void 0;const r=e(85608).__importDefault(e(19891)),o={typescript:"typescript",typescriptreact:"tsx",javascript:"javascript",javascriptreact:"jsx",rust:"rust",python:"python",java:"java",go:"go"};t.parserNameMap=o,t.parserIdentifierMap=(0,r.default)(t.parserNameMap)},2349:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeScriptLanguageFacts=t.typescriptBlockTypes=void 0,t.typescriptBlockTypes=["function","function_declaration","function_expression","arrow_function","class_declaration","interface_declaration","method_definition","method_signature","enum_declaration","type_alias_declaration","lexical_declaration","if_statement","switch_case","while_statement","do_statement","for_statement","for_in_statement","for_of_statement","try_statement","catch_clause","block","module","public_field_definition","private_field_definition","export_statement"];const e=new Set(t.typescriptBlockTypes);class n{constructor(){this.name="typescript",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.TypeScriptLanguageFacts=n},78542:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeScriptReactLanguageFacts=t.typescriptreactBlockTypes=void 0;const n=e(2349);t.typescriptreactBlockTypes=[...n.typescriptBlockTypes,"jsx_element","jsx_self_closing_element","jsx_expression","jsx_fragment"];const r=new Set(t.typescriptreactBlockTypes);class o{constructor(){this.name="tsx",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(p){return r.has(p)}}t.TypeScriptReactLanguageFacts=o},67045:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WasmModuleManager=void 0;const n=e(85608),r=n.__importDefault(e(13833)),o=e(76003),a=e(6858),p=e(70392);let v=class{async resolveResourceUri(){const _=await this.rendererRuntime.provideResourceUri(a.EKnownResources.TreeSitterWasmDirectory);this.resolvedResourceUriDeferred.resolve(_)}constructor(){this.resolvedResourceUriDeferred=new p.Deferred,this.cachedRuntime=new Map,this.parserInitialized=!1,this.resolveResourceUri()}async initParser(){const _=await this.resolvedResourceUriDeferred.promise;let s;return _.endsWith("/")?s=`${_}tree-sitter.wasm`:s=`${_}/tree-sitter.wasm`,this.parserInitialized||(await r.default.init({locateFile:()=>s}),this.parserInitialized=!0),new r.default}async loadLanguage(_){if(!this.cachedRuntime.has(_)){const s=new p.Deferred;this.cachedRuntime.set(_,s);const g=await this.resolvedResourceUriDeferred.promise;let l;g.endsWith("/")?l=`${g}tree-sitter-${_}.wasm`:l=`${g}/tree-sitter-${_}.wasm`,fetch(l).then(h=>h.arrayBuffer()).then(h=>{s.resolve(h)})}return this.cachedRuntime.get(_).promise}};t.WasmModuleManager=v,n.__decorate([(0,o.Autowired)(a.RendererRuntime),n.__metadata("design:type",a.RendererRuntime)],v.prototype,"rendererRuntime",void 0),t.WasmModuleManager=v=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],v)},4972:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIRightTabRenderer=t.AILeftTabRenderer=t.AIChatTabRendererWithTab=t.AIChatTabRenderer=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),a=e(41869),p=e(89195),v=e(1149),m=e(43718),_=e(11090),s=e(63067),g=e(46245),l=e(66368),h=e(19951),u=e(752),d=e(19413),E=n.__importDefault(e(87708)),f=()=>{const{side:D}=o.default.useContext(h.TabbarConfig),I=(0,a.useInjectable)(u.TabbarServiceFactory)(D);return(0,o.useEffect)(()=>{I.setIsLatter(!0)},[I]),o.default.createElement("div",{style:{width:0}},o.default.createElement(g.TabbarViewBase,{tabSize:0,MoreTabView:g.IconElipses,TabView:g.IconTabView,barSize:0,panelBorderSize:1}))},c=({className:D,components:I})=>o.default.createElement(h.TabRendererBase,{side:d.AI_CHAT_VIEW_ID,direction:"left-to-right",id:E.default.ai_chat_panel,className:(0,r.default)(D,`${d.AI_CHAT_VIEW_ID}-slot`),components:I,TabbarView:()=>o.default.createElement(f,null),TabpanelView:()=>o.default.createElement(l.BaseTabPanelView,{PanelView:l.ContainerView,PanelViewProps:{className:E.default.ai_chat_view_container}})});t.AIChatTabRenderer=c;const y=({className:D,components:I})=>o.default.createElement(h.TabRendererBase,{side:d.AI_CHAT_VIEW_ID,direction:"right-to-left",id:E.default.ai_chat_panel,className:(0,r.default)(D,`${d.AI_CHAT_VIEW_ID}-slot`,"design_right_slot"),components:I,TabbarView:()=>o.default.createElement(g.ChatTabbarRenderer2,null),TabpanelView:()=>o.default.createElement(l.BaseTabPanelView,{PanelView:l.ContainerView,PanelViewProps:{className:E.default.ai_chat_view_container}})});t.AIChatTabRendererWithTab=y;const b=({className:D,components:I})=>o.default.createElement(_.DesignLeftTabRenderer,{className:D,components:I,tabbarView:A});t.AILeftTabRenderer=b;const A=()=>{const D=(0,a.useInjectable)(s.IMainLayoutService),I=(0,a.useInjectable)(u.TabbarServiceFactory)(a.SlotLocation.right),w=(0,a.useAutorun)(I.currentContainerId),T=o.default.useMemo(()=>D.getExtraMenu(),[D]),[R]=(0,a.useContextMenus)(T),P=(0,o.useCallback)(({renderContainers:O})=>{const M=I.visibleContainers.filter(k=>{var F;return!(!((F=k.options)===null||F===void 0)&&F.hideTab)});return o.default.createElement(o.default.Fragment,null,M.length>0&&o.default.createElement(p.HorizontalVertical,{margin:"8px auto 0px",width:"60%"}),M.map(k=>O(k,I,w)))},[w,I]);return o.default.createElement(g.LeftTabbarRenderer,{renderOtherVisibleContainers:P,isRenderExtraTopMenus:!1,renderExtraMenus:o.default.createElement("div",{className:E.default.extra_bottom_icon_container},R.length>=0?R.map(O=>o.default.createElement(p.EnhanceIconWithCtxMenu,{key:O.id,id:O.id,wrapperClassName:E.default.extra_bottom_icon,iconClass:O.icon,menuNodes:O.children,skew:{x:-8,y:-4}})):null)})},S=({className:D,components:I})=>{const w=(0,a.useInjectable)(u.TabbarServiceFactory)(a.SlotLocation.right),T=(0,a.useInjectable)(v.DesignLayoutConfig),R=(0,o.useCallback)(()=>{w.updateCurrentContainerId("")},[]),P=(0,o.useCallback)(M=>{const{component:k}=M,{options:F}=k;return o.default.createElement(l.ContainerView,{...M,customTitleBar:o.default.createElement("div",{className:E.default.header},o.default.createElement("span",{className:E.default.title},F&&F.title),o.default.createElement("div",{className:E.default.side},o.default.createElement(p.EnhancePopover,{id:"ai_right_panel_header_close",title:(0,m.localize)("editor.title.context.close")},o.default.createElement(p.EnhanceIcon,{icon:"close",onClick:R})))),renderContainerWrap:({children:L})=>o.default.createElement("div",{className:E.default.right_slot_container_wrap},o.default.createElement("div",{className:E.default.container},L))})},[]),O=(0,o.useMemo)(()=>T.useMergeRightWithLeftPanel?E.default.right_tab_renderer:"",[T]);return o.default.createElement(_.DesignRightTabRenderer,{components:I,className:O,tabbarView:()=>o.default.createElement(g.RightTabbarRenderer,{barSize:0,style:{width:0}}),tabpanelView:()=>o.default.createElement(l.BaseTabPanelView,{PanelView:P})})};t.AIRightTabRenderer=S},82983:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIChatLogoAvatar=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(41869),a=e(89195),p=e(63067),v=e(19413),m=n.__importDefault(e(88473)),_=()=>{const s=(0,o.useInjectable)(p.IMainLayoutService),g=r.default.useCallback(()=>{s.toggleSlot(v.AI_CHAT_VIEW_ID)},[s]);return r.default.createElement("div",{className:m.default.ai_switch,onClick:g},r.default.createElement(a.AILogoAvatar,{iconClassName:m.default.avatar_icon_large}))};t.AIChatLogoAvatar=_},73974:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseApplyService=void 0;const n=e(85608),r=e(41429),o=e(76003),a=e(41869),p=e(54414),v=e(57517),m=e(55126),_=e(20868),s=e(70392),g=e(2261),l=e(19413),h=e(59347),u=e(40111),d=e(15989);class E extends a.WithEventBus{constructor(){super(),this.onCodeBlockUpdateEmitter=new s.Emitter,this.onCodeBlockUpdate=this.onCodeBlockUpdateEmitter.event,this.activePreviewerMap=this.registerDispose(new s.DisposableMap),this.editorListenerMap=this.registerDispose(new s.DisposableMap),this.addDispose(this.chatInternalService.onCancelRequest(()=>{const c=this.chatInternalService.sessionModel.history.lastMessageId;if(!c)return;const y=this.getMessageCodeBlocks(c);y&&Object.values(y).forEach(b=>{this.cancelApply(b)})})),this.currentSessionId=this.chatInternalService.sessionModel.sessionId,this.addDispose(this.chatInternalService.onChangeSession(c=>{c!==this.currentSessionId&&(this.cancelAllApply(),this.currentSessionId=c)})),this.addDispose(this.chatInternalService.onRegenerateRequest(()=>{const c=this.chatInternalService.sessionModel.history.getMessages(),y=c[c.length-1].id,b=this.getMessageCodeBlocks(y);b&&Object.values(b).forEach(A=>{this.cancelApply(A)})})),this.addDispose(this.chatInternalService.onWillClearSession(c=>{this.cancelAllApply(c)}))}getMessageCodeBlocks(c,y){y=y||this.chatInternalService.sessionModel.sessionId;const b=this.chatInternalService.getSession(y);if(!b)throw new Error(`Session ${y} not found`);const A=b.history.getMessageAdditional(c);return A?.codeBlockMap}onEditorGroupClose(c){const y=s.path.relative(this.appConfig.workspaceDir,c.payload.resource.uri.path.toString());this.activePreviewerMap.get(y)&&this.activePreviewerMap.disposeKey(y),this.editorListenerMap.disposeKey(c.payload.resource.uri.toString())}async onEditorGroupOpen(c){var y;const b=s.path.relative(this.appConfig.workspaceDir,c.payload.resource.uri.path.toString());if(this.duringApply||this.activePreviewerMap.has(b)||!this.chatInternalService.sessionModel.history.getMessages().length)return;const A=((y=this.getUriCodeBlocks(c.payload.resource.uri))===null||y===void 0?void 0:y.filter(S=>S.status==="pending"))||[];if(A.length>0&&A[0].updatedCode){const S=c.payload.group.codeEditor.monacoEditor;await this.renderApplyResult(S,A[0],A[0].updatedCode)}}get currentPreviewer(){var c;const y=(c=this.editorService.currentEditor)===null||c===void 0?void 0:c.currentUri;if(y)return this.activePreviewerMap.get(s.path.relative(this.appConfig.workspaceDir,y.path.toString()))}getUriCodeBlocks(c){const y=this.getSessionCodeBlocks(),b=s.path.relative(this.appConfig.workspaceDir,c.path.toString());return y.filter(A=>A.relativePath===b).sort((A,S)=>S.version-A.version)}getPendingPaths(c){return this.getSessionCodeBlocks(c).filter(b=>b.status==="pending").map(b=>b.relativePath)}getSessionCodeBlocks(c){const y=c?this.chatInternalService.getSession(c):this.chatInternalService.sessionModel;if(!y)throw new Error(`Session ${c} not found`);const b=y.history.sessionAdditionals;return Array.from(b.values()).map(A=>A.codeBlockMap||{}).reduce((A,S)=>(Object.values(S).forEach(D=>{A.push(D)}),A),[])}getCodeBlock(c,y){if(y=y||this.chatInternalService.sessionModel.history.lastMessageId,!y)throw new Error("Message ID is required");const b=this.getMessageCodeBlocks(y);if(b)return b[c]}updateCodeBlock(c){const y=c.messageId,b=this.getMessageCodeBlocks(y);if(!b)throw new Error("Code block not found");b[c.toolCallId]=c,this.chatInternalService.sessionModel.history.setMessageAdditional(y,{codeBlockMap:b}),this.onCodeBlockUpdateEmitter.fire(c)}async registerCodeBlock(c,y,b,A){var S,D;const I=this.chatInternalService.sessionModel.history.lastMessageId,w=this.getUriCodeBlocks(s.URI.file(s.path.join(this.appConfig.workspaceDir,c))),T=await this.editorDocumentModelService.createModelReference(s.URI.file(s.path.join(this.appConfig.workspaceDir,c))),R={codeEdit:y,relativePath:c,status:"generating",iterationCount:1,version:1,createdAt:Date.now(),toolCallId:b,messageId:I,instructions:A,originalCode:T.instance.getText()};if(w?.length){R.version=w.length+1;for(const O of w)if(O.relativePath===c&&(!((D=(S=O.applyResult)===null||S===void 0?void 0:S.diagnosticInfos)===null||D===void 0)&&D.length))R.iterationCount++;else break}const P=this.getMessageCodeBlocks(I)||{};return P[b]=R,this.chatInternalService.sessionModel.history.setMessageAdditional(I,{codeBlockMap:P}),this.onCodeBlockUpdateEmitter.fire(R),R}async apply(c){try{if(this.duringApply=!0,c.iterationCount>3)throw new Error("Lint error max iteration count exceeded");const y=c.originalCode?await this.doApply(c):{result:c.codeEdit};if(!y.stream&&!y.result)return c.status="failed",this.updateCodeBlock(c),c;this.activePreviewerMap.has(c.relativePath)&&(this.editorListenerMap.disposeKey(s.URI.file(s.path.join(this.appConfig.workspaceDir,c.relativePath)).toString()),this.activePreviewerMap.disposeKey(c.relativePath));const b=await this.editorService.open(s.URI.file(s.path.join(this.appConfig.workspaceDir,c.relativePath)));if(!b)throw new Error("Failed to open file");const A=await this.renderApplyResult(b.group.codeEditor.monacoEditor,c,y.result||y.stream,y.range);return c.updatedCode=A.updatedCode,c.status="pending",c.applyResult=A.result,this.updateCodeBlock(c),c}catch(y){throw c.status="failed",this.updateCodeBlock(c),y}finally{this.duringApply=!1}}async renderApplyResult(c,y,b,A){var S,D,I;const w=new s.Deferred,T=d.InlineDiffController.get(c);if(A=A||c.getModel().getFullModelRange(),typeof b=="string"){const R=b,P=c.getModel().getValue(),O=s.URI.file(s.path.join(this.appConfig.workspaceDir,y.relativePath)),M=this.editorDocumentModelService.getModelReference(O);(P!==R||M?.instance.dirty)&&((S=c.getModel())===null||S===void 0||S.pushEditOperations([],[g.EditOperation.replace(A,R)],()=>null),await this.editorService.save(O));const k=(D=this.getUriCodeBlocks(O))===null||D===void 0?void 0:D.filter(j=>j.status==="pending"),F=k?.[k.length-1];if(((I=F||y)===null||I===void 0?void 0:I.originalCode)===R)throw new Error("No changes applied");const L=T.createDiffPreviewer(c,_.Selection.fromRange(A,_.SelectionDirection.LTR),{disposeWhenEditorClosed:!0,renderRemovedWidgetImmediately:!0,reverse:!0});this.activePreviewerMap.set(y.relativePath,L),L.setValue(F?.originalCode||y.originalCode||`
31725
+ `),this.eventBus.fire(new v.RegisterEditorSideComponentEvent),this.listenPartialEdit(c.getModel(),y).then(j=>{j&&(y.applyResult=j),this.updateCodeBlock(y),this.editorService.save(s.URI.file(s.path.join(this.appConfig.workspaceDir,y.relativePath)))});const{diff:B,rangesFromDiffHunk:U}=this.getDiffResult(y.originalCode,R,y.relativePath),W=this.getDiagnosticInfos(c.getModel().uri.toString(),U);w.resolve({result:{diff:B,diagnosticInfos:W},updatedCode:R})}else{const R=new u.InlineChatController;R.mountReadable(b);const P=T.showPreviewerByStream(c,{crossSelection:_.Selection.fromRange(A,_.SelectionDirection.LTR),chatResponse:R,previewerOptions:{disposeWhenEditorClosed:!0,renderRemovedWidgetImmediately:!1}});this.addDispose(R.onError(O=>{w.reject(O)})),this.addDispose(R.onAbort(()=>{w.reject(new Error("Apply aborted"))})),this.addDispose(P.getNode().onDiffFinished(async O=>{const M=O.newFullRangeTextLines.join(`
31726
31726
  `);if(y.originalCode===M){P.dispose(),w.reject(new Error("no changes applied"));return}P.dispose();try{const k=await this.renderApplyResult(c,y,M);w.resolve(k)}catch(k){w.reject(k)}})),this.activePreviewerMap.set(y.relativePath,P)}return w.promise}cancelApply(c,y){var b,A;(c.status==="generating"||c.status==="pending")&&(this.editorListenerMap.disposeKey(s.URI.file(s.path.join(this.appConfig.workspaceDir,c.relativePath)).toString()),this.activePreviewerMap.has(c.relativePath)&&((A=(b=this.activePreviewerMap.get(c.relativePath))===null||b===void 0?void 0:b.getNode())===null||A===void 0||A.livePreviewDiffDecorationModel.discardUnProcessed(),this.activePreviewerMap.disposeKey(c.relativePath)),c.status="cancelled",this.updateCodeBlock(c))}cancelAllApply(c){this.getSessionCodeBlocks(c).forEach(b=>{this.cancelApply(b)})}revealApplyPosition(c){var y;const b=(y=c.applyResult)===null||y===void 0?void 0:y.diff.split(`
31727
- `).find(I=>I.startsWith("@@"));let A=0,S=0;if(b){const[,,,I,w]=b.match(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);A=parseInt(I,10)-1,S=parseInt(w,10)-1}this.editorService.open(s.URI.file(s.path.join(this.appConfig.workspaceDir,c.relativePath)));const D=this.editorService.currentEditor;D&&D.setSelection(new _.Selection(A,0,S,0))}async processAll(c,y){var b;const A=y?(b=this.getUriCodeBlocks(y))===null||b===void 0?void 0:b.filter(w=>w.status==="pending"):this.getSessionCodeBlocks().filter(w=>w.status==="pending");if(!A?.length)throw new Error("No pending code block found");const S=y?[A[0].relativePath]:A.map(w=>w.relativePath).reduce((w,T)=>(w.includes(T)||w.push(T),w),[]),D=this.editorService.getAllOpenedUris(),I=S.filter(w=>!D.some(T=>T.codeUri.fsPath.endsWith(w))).map(w=>s.URI.file(s.path.join(this.appConfig.workspaceDir,w)));I.length&&await this.editorService.openUris(I),S.forEach(w=>{this.doProcess(c,w)}),A.forEach(w=>{w.status=c==="accept"?"success":"cancelled",this.updateCodeBlock(w)})}doProcess(c,y){var b,A;const S=(A=(b=this.activePreviewerMap.get(y))===null||b===void 0?void 0:b.getNode())===null||A===void 0?void 0:A.livePreviewDiffDecorationModel;if(!S)throw new Error("No active previewer found");c==="accept"?S.acceptUnProcessed():S.discardUnProcessed(),this.editorService.save(s.URI.file(s.path.join(this.appConfig.workspaceDir,y)))}listenPartialEdit(c,y){const b=new s.Deferred,A=c.uri.toString(),S=this.inlineDiffService.onPartialEdit(D=>{if(D.totalPartialEditCount===D.resolvedPartialEditCount&&D.uri.path===c.uri.path.toString()){if(D.acceptPartialEditCount>0){y.status="success";const I=c.getValue(),{diff:w,rangesFromDiffHunk:T}=this.getDiffResult(y.originalCode,I,y.relativePath),R=this.getDiagnosticInfos(c.uri.toString(),T);this.aiReporter.send({msgType:a.AIServiceType.Chat,actionType:a.ActionTypeEnum.Accept,actionSource:a.ActionSourceEnum.Chat,sessionId:this.chatInternalService.sessionModel.sessionId,isReceive:!0,isDrop:D.acceptPartialEditCount!==D.totalPartialEditCount,code:I,originCode:y.originalCode,message:JSON.stringify({diff:w,diagnosticInfos:R,instructions:y.instructions,codeEdit:y.codeEdit,partialEditCount:D.totalPartialEditCount,acceptPartialEditCount:D.acceptPartialEditCount,addedLinesCount:D.totalAddedLinesCount,deletedLinesCount:D.totalDeletedLinesCount})}),b.resolve({diff:w,rangesFromDiffHunk:T})}else y.status="cancelled",b.resolve(),this.aiReporter.send({msgType:a.AIServiceType.Chat,actionType:a.ActionTypeEnum.Discard,actionSource:a.ActionSourceEnum.Chat,sessionId:this.chatInternalService.sessionModel.sessionId,isReceive:!1,isDrop:!0,originCode:y.originalCode,message:JSON.stringify({instructions:y.instructions,codeEdit:y.codeEdit})});this.editorListenerMap.disposeKey(A)}});return this.editorListenerMap.set(A,S),b.promise}getDiffResult(c,y,b){const A=(0,r.createPatch)(b,c,y).split(`
31727
+ `).find(I=>I.startsWith("@@"));let A=0,S=0;if(b){const[,,,I,w]=b.match(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);A=parseInt(I,10)-1,S=parseInt(w,10)-1}this.editorService.open(s.URI.file(s.path.join(this.appConfig.workspaceDir,c.relativePath)));const D=this.editorService.currentEditor;D&&D.setSelection(new _.Selection(A,0,S,0))}async processAll(c,y){var b;const A=y?(b=this.getUriCodeBlocks(y))===null||b===void 0?void 0:b.filter(w=>w.status==="pending"):this.getSessionCodeBlocks().filter(w=>w.status==="pending");if(!A?.length)throw new Error("No pending code block found");const S=y?[A[0].relativePath]:A.map(w=>w.relativePath).reduce((w,T)=>(w.includes(T)||w.push(T),w),[]),D=this.editorService.getAllOpenedUris(),I=S.filter(w=>!D.some(T=>T.codeUri.fsPath.endsWith(w))).map(w=>s.URI.file(s.path.join(this.appConfig.workspaceDir,w)));I.length&&await this.editorService.openUris(I),S.forEach(w=>{this.doProcess(c,w)}),A.forEach(w=>{w.status=c==="accept"?"success":"cancelled",this.updateCodeBlock(w)})}doProcess(c,y){var b,A;const S=(A=(b=this.activePreviewerMap.get(y))===null||b===void 0?void 0:b.getNode())===null||A===void 0?void 0:A.livePreviewDiffDecorationModel;if(!S)throw new Error("No active previewer found");c==="accept"?S.acceptUnProcessed():S.discardUnProcessed(),this.editorService.save(s.URI.file(s.path.join(this.appConfig.workspaceDir,y)))}listenPartialEdit(c,y){const b=new s.Deferred,A=c.uri.toString(),S=this.inlineDiffService.onPartialEdit(D=>{if(D.totalPartialEditCount===D.resolvedPartialEditCount&&D.uri.path===c.uri.path.toString()){if(D.acceptPartialEditCount>0){y.status="success";const I=c.getValue(),{diff:w,rangesFromDiffHunk:T}=this.getDiffResult(y.originalCode,I,y.relativePath),R=this.getDiagnosticInfos(c.uri.toString(),T);this.aiReporter.send({msgType:a.AIServiceType.Chat,actionType:a.ActionTypeEnum.Accept,actionSource:a.ActionSourceEnum.Chat,sessionId:this.chatInternalService.sessionModel.sessionId,isReceive:!0,isDrop:D.acceptPartialEditCount!==D.totalPartialEditCount,code:I,originCode:y.originalCode,message:JSON.stringify({diff:w,diagnosticInfos:R,instructions:y.instructions,codeEdit:y.codeEdit,partialEditCount:D.totalPartialEditCount,acceptPartialEditCount:D.acceptPartialEditCount,addedLinesCount:D.totalAddedLinesCount,deletedLinesCount:D.totalDeletedLinesCount})}),b.resolve({diff:w,diagnosticInfos:R})}else y.status="cancelled",b.resolve(),this.aiReporter.send({msgType:a.AIServiceType.Chat,actionType:a.ActionTypeEnum.Discard,actionSource:a.ActionSourceEnum.Chat,sessionId:this.chatInternalService.sessionModel.sessionId,isReceive:!1,isDrop:!0,originCode:y.originalCode,message:JSON.stringify({instructions:y.instructions,codeEdit:y.codeEdit})});this.editorListenerMap.disposeKey(A)}});return this.editorListenerMap.set(A,S),b.promise}getDiffResult(c,y,b){const A=(0,r.createPatch)(b,c,y).split(`
31728
31728
  `).slice(4).join(`
31729
31729
  `),S=A.split(`
31730
31730
  `).map(D=>{if(D.startsWith("@@")){const[,,,I,w]=D.match(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);return new _.Range(parseInt(I,10),0,parseInt(I,10)+parseInt(w,10)-1,0)}return null}).filter(D=>D!==null);return{diff:A,rangesFromDiffHunk:S}}getDiagnosticInfos(c,y){return this.markerService.getManager().getMarkers({resource:c}).filter(A=>A.severity>=a.MarkerSeverity.Warning&&y.some(S=>S.containsPosition(new _.Position(A.startLineNumber,A.startColumn))))}}t.BaseApplyService=E,E.CHAT_EDITING_SOURCE_RESOLVER_SCHEME="chat-editing-source",n.__decorate([(0,o.Autowired)(l.IChatInternalService),n.__metadata("design:type",h.ChatInternalService)],E.prototype,"chatInternalService",void 0),n.__decorate([(0,o.Autowired)(a.AppConfig),n.__metadata("design:type",Object)],E.prototype,"appConfig",void 0),n.__decorate([(0,o.Autowired)(p.WorkbenchEditorService),n.__metadata("design:type",p.WorkbenchEditorService)],E.prototype,"editorService",void 0),n.__decorate([(0,o.Autowired)(l.InlineDiffServiceToken),n.__metadata("design:type",Object)],E.prototype,"inlineDiffService",void 0),n.__decorate([(0,o.Autowired)(m.IMarkerService),n.__metadata("design:type",Object)],E.prototype,"markerService",void 0),n.__decorate([(0,o.Autowired)(v.IEditorDocumentModelService),n.__metadata("design:type",Object)],E.prototype,"editorDocumentModelService",void 0),n.__decorate([(0,o.Autowired)(a.IAIReporter),n.__metadata("design:type",Object)],E.prototype,"aiReporter",void 0),n.__decorate([(0,a.OnEvent)(v.EditorGroupCloseEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[v.EditorGroupCloseEvent]),n.__metadata("design:returntype",void 0)],E.prototype,"onEditorGroupClose",null),n.__decorate([(0,a.OnEvent)(v.EditorGroupOpenEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[v.EditorGroupOpenEvent]),n.__metadata("design:returntype",Promise)],E.prototype,"onEditorGroupOpen",null)},75279:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigView=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),a=e(97267),p=e(41869),v=e(43718),m=e(19413),_=n.__importDefault(e(76599)),s=e(51750),g=()=>{const l=(0,p.useInjectable)(v.MCPConfigServiceToken),[h,u]=o.default.useState([]),[d,E]=o.default.useState(!1),[f,c]=o.default.useState(),[y,b]=o.default.useState(),[A,S]=o.default.useState(l.isInitialized),D=(0,o.useCallback)(async()=>{const M=await l.getServers();u(M)},[l]);o.default.useEffect(()=>{D();const M=l.onMCPServersChange(k=>{k&&S(!0),D()});return()=>{M.dispose()}},[D]);const I=(0,o.useCallback)(async(M,k)=>{try{b(M),await l.controlServer(M,k),await D(),b(void 0)}catch{b(void 0)}},[l,D]),w=(0,o.useCallback)(()=>{c(void 0),E(!0)},[]),T=(0,o.useCallback)(async M=>{const k=await l.getServerConfigByName(M.name);k&&(c(k),E(!0))},[l]),R=(0,o.useCallback)(async M=>{await l.deleteServer(M),await D()},[l,D]),P=(0,o.useCallback)(async(M,k)=>{E(!1),await l.saveServer(M,k),M?.enabled&&(b(k.name),await l.controlServer(k.name,!0),b(void 0)),await D()},[l,D]),O=(0,o.useCallback)(async M=>{b(M.name),await l.syncServer(M.name),await D(),b(void 0)},[l,D]);return o.default.createElement("div",{className:_.default.container},o.default.createElement("div",{className:_.default.header},o.default.createElement("div",null,o.default.createElement("h2",{className:_.default.title},"MCP Servers"),o.default.createElement("p",{className:_.default.description},(0,v.localize)("ai.native.mcp.manage.connections"))),o.default.createElement("button",{className:_.default.actionButton,onClick:w},o.default.createElement(a.Icon,{icon:"plus",className:_.default.actionButtonIcon}),(0,v.localize)("ai.native.mcp.addMCPServer.title"))),o.default.createElement("div",{className:_.default.serversList},h.map(M=>o.default.createElement("div",{key:M.name,className:_.default.serverItem},o.default.createElement("div",{className:_.default.serverHeader},o.default.createElement("div",{className:_.default.serverTitleRow},o.default.createElement("h3",{className:_.default.serverName},M.name,o.default.createElement("span",{className:(0,r.default)(_.default.serverStatusIcon,M.isStarted?_.default.active:_.default.inactive)}))),o.default.createElement("div",{className:_.default.serverActions},o.default.createElement(a.Popover,{id:"mcp-server-action-popover",trigger:a.PopoverTriggerType.hover,content:M.isStarted?(0,v.localize)("ai.native.mcp.disable.title"):(0,v.localize)("ai.native.mcp.enable.title")},o.default.createElement(a.Button,{type:"default",className:(0,r.default)(_.default.serverActionButton,M.isStarted&&_.default.active),onClick:()=>I(M.name,!M.isStarted)},o.default.createElement("i",{className:`codicon ${y===M.name||!A&&M.name!==m.BUILTIN_MCP_SERVER_NAME&&!M.isStarted?"codicon-loading kt-icon-loading":M.isStarted?"codicon-check":"codicon-circle"}`}),o.default.createElement("span",null,(0,v.localize)(M.isStarted?"ai.native.mcp.enabled":"ai.native.mcp.disabled")))),M.name!==m.BUILTIN_MCP_SERVER_NAME&&o.default.createElement(a.Button,{type:"icon",iconClass:"codicon codicon-edit",className:_.default.iconButton,title:(0,v.localize)("ai.native.mcp.tool.action.edit"),onClick:()=>T(M)}),M.name!==m.BUILTIN_MCP_SERVER_NAME&&o.default.createElement(a.Button,{type:"icon",iconClass:"codicon codicon-sync",className:_.default.iconButton,title:(0,v.localize)("ai.native.mcp.tool.action.sync"),onClick:()=>O(M)}),M.name!==m.BUILTIN_MCP_SERVER_NAME&&o.default.createElement(a.Button,{type:"icon",iconClass:"codicon codicon-trash",className:_.default.iconButton,title:(0,v.localize)("ai.native.mcp.tool.action.delete"),onClick:()=>R(M.name)}))),o.default.createElement("div",{className:_.default.serverDetail},M.type&&o.default.createElement("div",{className:_.default.detailRow},o.default.createElement("span",{className:_.default.detailLabel},"Type:"),o.default.createElement(a.Badge,{className:(0,r.default)(_.default.serverType,_.default.typeTag)},l.getReadableServerType(M.type)))),M.tools&&M.tools.length>0&&o.default.createElement("div",{className:_.default.serverDetail},o.default.createElement("div",{className:_.default.detailRow},o.default.createElement("span",{className:_.default.detailLabel},"Tools:"),o.default.createElement("span",{className:_.default.detailContent},M.tools.map((k,F)=>o.default.createElement(a.Badge,{key:F,className:_.default.toolTag,title:k.description},k.name))))),M.command&&o.default.createElement("div",{className:_.default.serverDetail},o.default.createElement("div",{className:_.default.detailRow},o.default.createElement("span",{className:_.default.detailLabel},"Command:"),o.default.createElement("span",{className:_.default.detailContent},M.command))),M.url&&o.default.createElement("div",{className:_.default.serverDetail},o.default.createElement("div",{className:_.default.detailRow},o.default.createElement("span",{className:_.default.detailLabel},"Server Link:"),o.default.createElement("span",{className:(0,r.default)(_.default.detailContent,_.default.link)},M.url)))))),o.default.createElement(s.MCPServerForm,{visible:d,initialData:f,servers:h,onSave:M=>P(f,M),onCancel:()=>E(!1)}))};t.MCPConfigView=g},51750:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPServerForm=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),a=e(97267),p=e(48412),v=e(53017),m=e(41869),_=e(43718),s=e(72665),g=e(69820),l=n.__importDefault(e(83761)),h=({visible:u,initialData:d,onSave:E,onCancel:f,servers:c})=>{const[y,b]=(0,o.useState)(()=>({name:"",command:"",args:[],env:{},type:g.MCP_SERVER_TYPE.STDIO,...d})),A=(0,m.useInjectable)(s.IMessageService),[S,D]=(0,o.useState)(()=>{var B;return((B=d?.args)===null||B===void 0?void 0:B.join(" "))||""}),[I,w]=(0,o.useState)(()=>d?.env?Object.entries(d.env).map(([B,U])=>`${B}=${U}`).join(`
31731
31731
  `):"");(0,o.useEffect)(()=>{var B;b({name:"",command:"",args:[],env:{},type:g.MCP_SERVER_TYPE.STDIO,...d}),D(((B=d?.args)===null||B===void 0?void 0:B.join(" "))||""),w(d?.env?Object.entries(d.env).map(([U,W])=>`${U}=${W}`).join(`
31732
31732
  `):"")},[d]);const T=(0,o.useCallback)(B=>{var U,W;if(B.name.trim()==="")return A.error((0,_.localize)("ai.native.mcp.name.isRequired")),!1;if(!d&&c.some(Q=>Q.name.toLocaleLowerCase()===B.name.toLocaleLowerCase()))return A.error((0,_.formatLocalize)("ai.native.mcp.serverNameExists",B.name)),!1;if(B.type===g.MCP_SERVER_TYPE.SSE){const Q=((U=B.url)===null||U===void 0?void 0:U.trim())!=="";return Q||A.error((0,_.localize)("ai.native.mcp.url.isRequired")),Q}const j=((W=B.command)===null||W===void 0?void 0:W.trim())!=="";return j||A.error((0,_.localize)("ai.native.mcp.command.isRequired")),j},[c,d]),R=(0,o.useCallback)(B=>{var U;if(B.preventDefault(),!T(y))return;const j={...y};if(j.command&&(j.command=j.command.trim()),j.url&&(j.url=j.url.trim()),y.type===g.MCP_SERVER_TYPE.SSE)j.url=(U=j.url)===null||U===void 0?void 0:U.trim();else{const Q=S.split(" ").filter(Boolean),G=I.split(`
31733
- `).filter(Boolean).reduce((Z,$)=>{const[V,H]=$.split("=");return V&&H&&(Z[V.trim()]=H.trim()),Z},{});j.args=Q,j.env=G}b({...y,name:"",command:"",url:"",args:[],env:{}}),E(j)},[y,S,I,E,T]),P=(0,o.useCallback)(B=>{b({...y,command:B.target.value})},[y,S]),O=(0,o.useCallback)(B=>{D(B.target.value)},[S]),M=(0,o.useCallback)(B=>{w(B.target.value)},[I]),k=(0,o.useCallback)(B=>{b({...y,url:B.target.value})},[y]),F=(0,o.useCallback)(B=>{b({...y,type:B,command:"",args:[],env:{},url:""})},[y]),L=(0,o.useCallback)(()=>y?.type===g.MCP_SERVER_TYPE.STDIO?o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:l.default.formItem},o.default.createElement("label",null,(0,_.localize)("ai.native.mcp.command")),o.default.createElement("input",{type:"text",value:y.command,onChange:P,placeholder:(0,_.localize)("ai.native.mcp.command.placeHolder"),required:!0})),o.default.createElement("div",{className:l.default.formItem},o.default.createElement("label",null,(0,_.localize)("ai.native.mcp.args")),o.default.createElement("textarea",{value:S,onChange:O,placeholder:(0,_.localize)("ai.native.mcp.args.placeHolder"),rows:3})),o.default.createElement("div",{className:l.default.formItem},o.default.createElement("label",null,(0,_.localize)("ai.native.mcp.env")),o.default.createElement("textarea",{value:I,onChange:M,placeholder:(0,_.localize)("ai.native.mcp.env.placeHolder"),rows:3}))):o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:l.default.formItem},o.default.createElement("label",null,(0,_.localize)("ai.native.mcp.url")),o.default.createElement("textarea",{value:y.url,onChange:k,placeholder:(0,_.localize)("ai.native.mcp.url.placeHolder"),rows:3}))),[y,S,I]);return o.default.createElement(v.Modal,{title:d?(0,_.localize)("ai.native.mcp.editMCPServer.title"):(0,_.localize)("ai.native.mcp.addMCPServer.title"),visible:u,onCancel:f,centered:!0,width:600,footer:null,style:{background:"var(--editor-background)"}},o.default.createElement("form",{className:l.default.form,onSubmit:B=>B.preventDefault()},o.default.createElement("div",{className:l.default.formRow},o.default.createElement("div",{className:(0,r.default)(l.default.formItem,l.default.formItemName)},o.default.createElement("label",null,(0,_.localize)("ai.native.mcp.name")),o.default.createElement("input",{type:"text",value:y.name,onChange:B=>b({...y,name:B.target.value}),placeholder:(0,_.localize)("ai.native.mcp.name.placeHolder"),required:!0})),o.default.createElement("div",{className:(0,r.default)(l.default.formItem,l.default.formItemType)},o.default.createElement("label",null,(0,_.localize)("ai.native.mcp.type")),o.default.createElement(a.Select,{size:"large",value:y.type,options:[{label:(0,_.localize)("ai.native.mcp.stdio"),value:g.MCP_SERVER_TYPE.STDIO},{label:(0,_.localize)("ai.native.mcp.sse"),value:g.MCP_SERVER_TYPE.SSE}],className:l.default.formItemSelect,onChange:F}))),L(),o.default.createElement("div",{className:l.default.formActions},o.default.createElement(p.Button,{onClick:f,type:"primary",className:l.default.secondaryButton},(0,_.localize)("ai.native.mcp.buttonCancel")),o.default.createElement(p.Button,{onClick:R,type:"primary"},d?(0,_.localize)("ai.native.mcp.buttonUpdate"):(0,_.localize)("ai.native.mcp.buttonSave")))))};t.MCPServerForm=h},27397:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigCommandContribution=t.MCPConfigCommands=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(43718),p=e(54414),v=e(5297),m=e(33108);var _;(function(g){g.OPEN_MCP_CONFIG={id:"mcp.openConfig",label:"Open MCP Configuration"},g.OPEN_MCP_CONFIG_FILE={id:"mcp.openConfigFile",label:"Open MCP Configuration (JSON)"}})(_||(t.MCPConfigCommands=_={}));let s=class{registerCommands(l){l.registerCommand(_.OPEN_MCP_CONFIG,{execute:()=>{const h=new o.URI().withScheme(v.MCP_CONFIG_COMPONENTS_SCHEME_ID);this.editorService.open(h,{preview:!1,focus:!0})}}),l.registerCommand(_.OPEN_MCP_CONFIG_FILE,{execute:()=>{this.mcpConfigService.openConfigFile()}})}};t.MCPConfigCommandContribution=s,n.__decorate([(0,r.Autowired)(p.WorkbenchEditorService),n.__metadata("design:type",p.WorkbenchEditorService)],s.prototype,"editorService",void 0),n.__decorate([(0,r.Autowired)(a.MCPConfigServiceToken),n.__metadata("design:type",m.MCPConfigService)],s.prototype,"mcpConfigService",void 0),t.MCPConfigCommandContribution=s=n.__decorate([(0,a.Domain)(o.CommandContribution)],s)},5297:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigContribution=t.MCP_CONFIG_COMPONENTS_SCHEME_ID=void 0;const n=e(85608),r=e(76003),o=e(97267),a=e(93899),p=e(39496),v=e(26542),m=e(43718),_=e(82196),s=e(7443),g=e(10560),l=e(75279),h=e(27397),u="opensumi-mcp-config-viewer";t.MCP_CONFIG_COMPONENTS_SCHEME_ID="mcp-config";let d=class{registerEditorComponent(f){f.registerEditorComponent({uid:u,scheme:t.MCP_CONFIG_COMPONENTS_SCHEME_ID,component:l.MCPConfigView,renderMode:_.EditorComponentRenderMode.ONE_PER_WORKBENCH}),f.registerEditorComponentResolver(t.MCP_CONFIG_COMPONENTS_SCHEME_ID,(c,y)=>{y.push({type:"component",componentId:u})})}registerResource(f){f.registerResourceProvider({scheme:t.MCP_CONFIG_COMPONENTS_SCHEME_ID,provideResource:async c=>{const{configType:y}=c.getParsedQuery();return{uri:c,name:(0,m.localize)("ai.native.mcp.config.title"),icon:(0,o.getIcon)("mcp"),metadata:{configType:y}}}})}registerMenus(f){f.registerMenuItem(p.MenuId.EditorTitle,{command:h.MCPConfigCommands.OPEN_MCP_CONFIG_FILE.id,iconClass:(0,o.getIcon)("open"),group:"navigation",order:4,when:`resourceScheme == ${t.MCP_CONFIG_COMPONENTS_SCHEME_ID}`}),f.registerMenuItem(p.MenuId.EditorTitle,{command:h.MCPConfigCommands.OPEN_MCP_CONFIG.id,iconClass:(0,o.getIcon)("open"),group:"navigation",order:4,when:"resourceFilename =~ /mcp.json/"})}};t.MCPConfigContribution=d,n.__decorate([(0,r.Autowired)(g.IWorkspaceService),n.__metadata("design:type",Object)],d.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(s.IconService),n.__metadata("design:type",s.IconService)],d.prototype,"iconService",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",v.LabelService)],d.prototype,"labelService",void 0),t.MCPConfigContribution=d=n.__decorate([(0,m.Domain)(_.BrowserEditorContribution,a.MenuContribution)],d)},33108:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigService=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(78132),p=e(43718),v=e(54414),m=e(72665),_=e(19413),s=e(64811),g=e(69820),l=e(45331);let h=class extends p.Disposable{constructor(){super(),this.whenReadyDeferred=new p.Deferred,this._isInitialized=!1,this.mcpServersChangeEventEmitter=new p.Emitter,this.init(),this.disposables.push(this.mcpServerProxyService.onChangeMCPServers(()=>{this.fireMCPServersChange()})),this.disposables.push(this.preferenceService.onSpecificPreferenceChange("mcp",()=>{this.fireMCPServersChange()}))}async init(){this.chatStorage=await this.storageProvider(p.STORAGE_NAMESPACE.CHAT),this.whenReadyDeferred.resolve()}get whenReady(){return this.whenReadyDeferred.promise}get isInitialized(){return this._isInitialized}get onMCPServersChange(){return this.mcpServersChangeEventEmitter.event}fireMCPServersChange(d=!1){d&&(this._isInitialized=!0),this.mcpServersChangeEventEmitter.fire(d)}async getServers(){const{value:d,scope:E}=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0);if(E===p.PreferenceScope.Default){const S=(await this.mcpServerProxyService.$getServers()).find(D=>D.name===_.BUILTIN_MCP_SERVER_NAME);return S?[S]:[]}const f=Object.keys(d.mcpServers).map(A=>{const S=d.mcpServers[A];return S.url?{name:A,type:g.MCP_SERVER_TYPE.SSE,url:S.url}:{name:A,type:g.MCP_SERVER_TYPE.STDIO,command:S.command,args:S.args,env:S.env}}),c=await this.mcpServerProxyService.$getServers(),y=c.find(A=>A.name===_.BUILTIN_MCP_SERVER_NAME),b=f?.map(A=>{const S=c.find(D=>D.name===A.name);return S||this.sumiMCPServerBackendProxy.$addOrUpdateServer(A),{...A,isStarted:S?.isStarted||!1,tools:S?.tools||[]}});return y&&b.unshift(y),b}async controlServer(d,E){try{E?await this.mcpServerProxyService.$startServer(d):await this.mcpServerProxyService.$stopServer(d);const f=this.chatStorage.get(s.MCPServersEnabledKey,[_.BUILTIN_MCP_SERVER_NAME]),c=new Set(f);E?c.add(d):c.delete(d),this.chatStorage.set(s.MCPServersEnabledKey,Array.from(c))}catch(f){const c=f.message||f;throw this.logger.error(`Failed to ${E?"start":"stop"} server ${d}:`,c),this.messageService.error(c),f}}async saveServer(d,E){await this.whenReady;const{value:f}=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0),c=f.mcpServers;let y;E.type===g.MCP_SERVER_TYPE.SSE?y={url:E.url}:y={command:E.command,args:E.args,env:E.env},d?.name&&delete c[d.name],c[E.name]=y,await this.preferenceService.set("mcp",{mcpServers:c}),d?.enabled&&this.sumiMCPServerBackendProxy.$removeServer(d.name),this.sumiMCPServerBackendProxy.$addOrUpdateServer(E)}async deleteServer(d){const{value:E}=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0),f=E.mcpServers;f[d]&&(delete f[d],await this.sumiMCPServerBackendProxy.$removeServer(d),await this.preferenceService.set("mcp",{mcpServers:f}))}async syncServer(d){try{await this.sumiMCPServerBackendProxy.$syncServer(d)}catch(E){this.logger.error(`Failed to sync server ${d}:`,E),this.messageService.error(E.message||E)}}async getServerConfigByName(d){const{value:E}=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0);await this.whenReady;const f=this.chatStorage.get(s.MCPServersEnabledKey,[_.BUILTIN_MCP_SERVER_NAME]),c=E.mcpServers[d];if(c)return c.url?{name:d,type:g.MCP_SERVER_TYPE.SSE,url:c.url,enabled:f.includes(d)}:{name:d,type:g.MCP_SERVER_TYPE.STDIO,command:c.command,args:c.args,env:c.env,enabled:f.includes(d)}}getReadableServerType(d){switch(d){case g.MCP_SERVER_TYPE.STDIO:return(0,p.localize)("ai.native.mcp.type.stdio");case g.MCP_SERVER_TYPE.SSE:return(0,p.localize)("ai.native.mcp.type.sse");case g.MCP_SERVER_TYPE.BUILTIN:return(0,p.localize)("ai.native.mcp.type.builtin");default:return d}}async openConfigFile(){let d=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0);d.scope===p.PreferenceScope.Default&&(await this.preferenceService.set("mcp",{mcpServers:{}},p.PreferenceScope.Workspace),d=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0));const E=d.configUri;E&&this.workbenchEditorService.open(E,{preview:!1})}};t.MCPConfigService=h,n.__decorate([(0,r.Autowired)(_.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],h.prototype,"sumiMCPServerBackendProxy",void 0),n.__decorate([(0,r.Autowired)(l.MCPServerProxyService),n.__metadata("design:type",l.MCPServerProxyService)],h.prototype,"mcpServerProxyService",void 0),n.__decorate([(0,r.Autowired)(a.PreferenceService),n.__metadata("design:type",Object)],h.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(m.IMessageService),n.__metadata("design:type",Object)],h.prototype,"messageService",void 0),n.__decorate([(0,r.Autowired)(p.StorageProvider),n.__metadata("design:type",Function)],h.prototype,"storageProvider",void 0),n.__decorate([(0,r.Autowired)(v.WorkbenchEditorService),n.__metadata("design:type",v.WorkbenchEditorService)],h.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],h.prototype,"logger",void 0),t.MCPConfigService=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},33368:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPFolderPreferenceProvider=void 0;const n=e(85608),r=e(76003),o=e(91825);let a=class extends o.FolderFilePreferenceProvider{parse(v){const m=super.parse(v);if(m!==void 0)return{mcp:{...m}}}getPath(v){if(v==="mcp")return[];if(v.startsWith("mcp."))return[v.substr(4)]}};t.MCPFolderPreferenceProvider=a,t.MCPFolderPreferenceProvider=a=n.__decorate([(0,r.Injectable)()],a)},55003:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPPreferencesContribution=t.MCPResourceProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(57517),p=e(924);let v=class{provideResource(s){return{supportsRevive:!0,name:(0,o.localize)("menu-bar.title.debug"),icon:(0,o.getIcon)("debug"),uri:s}}provideResourceSubname(){return null}async shouldCloseResource(){return!0}};t.MCPResourceProvider=v,t.MCPResourceProvider=v=n.__decorate([(0,r.Injectable)()],v);let m=class{constructor(){this.schema=p.MCPPreferencesSchema,this.name="mcp"}registerResource(s){s.registerResourceProvider(this.prefResourceProvider)}registerSchema(s){s.registerSchema(p.MCPSchemaUri,p.MCPSchema,["mcp.json"])}};t.MCPPreferencesContribution=m,n.__decorate([(0,r.Autowired)(v),n.__metadata("design:type",v)],m.prototype,"prefResourceProvider",void 0),t.MCPPreferencesContribution=m=n.__decorate([(0,o.Domain)(o.PreferenceContribution,o.PreferenceConfiguration,a.BrowserEditorContribution,o.JsonSchemaContribution)],m)},924:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPSchema=t.MCPPreferencesSchema=t.MCPSchemaUri=void 0,t.MCPSchemaUri="vscode://schemas/mcp/user",t.MCPPreferencesSchema={type:"object",scope:"resource",properties:{mcp:{$ref:t.MCPSchemaUri,description:"MCP configuration for Workspace.",defaultValue:{mcpServers:{}}}}},t.MCPSchema={$id:t.MCPSchemaUri,type:"object",title:"MCP",required:[],default:{mcpServers:{}},properties:{mcpServers:{type:"object",description:"List of MCP Servers. Add new servers or edit existing ones by using IntelliSense.",additionalProperties:{type:"object",properties:{command:{type:"string",description:"The command to start the MCP server."},args:{type:"array",description:"The arguments for the command to start the MCP server.",items:{type:"string"}},env:{type:"object",description:"The environment variables for the command to start the MCP server.",additionalProperties:{type:"string"}},url:{type:"string",description:"The SSE URL for the MCP server."}},oneOf:[{required:["command"]},{required:["url"]}]}}}}},45331:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPServerProxyService=void 0;const n=e(85608),r=e(48085),o=e(76003),a=e(41869),p=e(43718),v=e(19413),m=e(77633);let _=class{constructor(){this._onChangeMCPServers=new p.Emitter,this.onChangeMCPServers=this._onChangeMCPServers.event}$callMCPTool(g,l){return this.mcpServerRegistry.callMCPTool(g,l)}async $getBuiltinMCPTools(){const g=await this.mcpServerRegistry.getMCPTools().map(l=>({name:l.name,description:l.description,inputSchema:(0,r.zodToJsonSchema)(l.inputSchema),providerName:v.BUILTIN_MCP_SERVER_NAME}));return this.logger.log("SUMI MCP tools",g),g}async $updateMCPServers(){this._onChangeMCPServers.fire("update")}async getAllMCPTools(){return this.sumiMCPServerProxyService.$getAllMCPTools()}async $getServers(){return this.sumiMCPServerProxyService.$getServers()}async $startServer(g){await this.sumiMCPServerProxyService.$startServer(g)}async $stopServer(g){await this.sumiMCPServerProxyService.$stopServer(g)}};t.MCPServerProxyService=_,n.__decorate([(0,o.Autowired)(m.TokenMCPServerRegistry),n.__metadata("design:type",Object)],_.prototype,"mcpServerRegistry",void 0),n.__decorate([(0,o.Autowired)(a.ILogger),n.__metadata("design:type",Object)],_.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(v.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],_.prototype,"sumiMCPServerProxyService",void 0),t.MCPServerProxyService=_=n.__decorate([(0,o.Injectable)()],_)},79502:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPServerRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718),a=e(19413),p=e(98864);class v{constructor(s){this.logger=s}appendLine(s){this.logger.log(s)}}let m=class{constructor(){this.tools=[],this.toolComponents={}}get logger(){return new v(this.baseLogger)}set activeMessageInfo(s){this._activeMessageInfo=s}getMCPTool(s,g=a.BUILTIN_MCP_SERVER_NAME){return this.tools.find(l=>(0,p.getToolName)(l.name,g)===s)}registerMCPTool(s){this.tools.push(s)}registerToolComponent(s,g,l=a.BUILTIN_MCP_SERVER_NAME){this.toolComponents[(0,p.getToolName)(s,l)]=g}getToolComponent(s){return this.toolComponents[s]}getMCPTools(){return this.tools.sort((s,g)=>{var l,h;return((l=s.order)!==null&&l!==void 0?l:1/0)-((h=g.order)!==null&&h!==void 0?h:1/0)})}async callMCPTool(s,g){try{const l=this.tools.find(d=>d.name===s);if(!l)throw new Error(`MCP tool ${s} not found`);const h=g.toolCallId;g=l.inputSchema.parse(g);const u=await l.handler({...g,toolCallId:h},this.logger);return this.reportToolCall(s,g,u,h),u}catch(l){return console.error("callMCPTool error:",l),this.reportToolCall(s,g,l,g.toolCallId),{content:[{type:"text",text:`The tool ${s} failed to execute. Error: ${l}`}],isError:!0}}}reportToolCall(s,g,l,h){if(!this.tools.find(d=>d.name===s))throw new Error(`MCP tool ${s} not found`);this.aiReporter.send({msgType:o.AIServiceType.ToolCall,message:JSON.stringify({args:g,name:s,result:l}),messageId:this._activeMessageInfo.messageId,sessionId:this._activeMessageInfo.sessionId,relationId:h})}};t.MCPServerRegistry=m,n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],m.prototype,"baseLogger",void 0),n.__decorate([(0,r.Autowired)(o.IAIReporter),n.__metadata("design:type",Object)],m.prototype,"aiReporter",void 0),t.MCPServerRegistry=m=n.__decorate([(0,r.Injectable)()],m)},30703:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPToolsDialog=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=n.__importDefault(e(49783)),a=({tools:p})=>r.createElement("div",{className:o.default.mcp_tools_dialog},r.createElement("div",{className:o.default.dialog_title},"MCP Tools"),r.createElement("div",{className:o.default.tools_list},p.map(v=>r.createElement("div",{key:v.name,className:o.default.tool_item},r.createElement("div",{className:o.default.tool_name},v.name),r.createElement("div",{className:o.default.tool_description},v.description),v.providerName&&r.createElement("div",{className:o.default.tool_provider},"Provider: ",v.providerName)))));t.MCPToolsDialog=a},58260:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditFileToolComponent=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),a=e(97267),p=e(41869),v=e(54414),m=e(14162),_=e(87822),s=e(16781),g=e(21967),l=e(56474),h=e(73974),u=n.__importDefault(e(51601)),d=E=>{var f,c,y;const{args:b,messageId:A,toolCallId:S}=E,[D,I]=(0,o.useState)("code"),w=(0,p.useInjectable)(p.LabelService),T=(0,p.useInjectable)(p.AppConfig),R=(0,p.useInjectable)(h.BaseApplyService),P=(0,p.useInjectable)(v.WorkbenchEditorService),{target_file:O="",code_edit:M,instructions:k}=b||{},F=p.path.join(T.workspaceDir,O),[L,B]=(0,o.useState)(R.getCodeBlock(S,A)),U=(0,o.useMemo)(()=>O?`file-icon ${w.getIcon(p.URI.file(F))}`:void 0,[O,F]),W=(0,o.useMemo)(()=>{if(!O)return;const G=s.StandaloneServices.get(_.IModelService),Z=s.StandaloneServices.get(m.ILanguageService);return(0,p.detectModeId)(G,Z,p.Uri.file(F))},[O,F]),j=(0,o.useMemo)(()=>{var G,Z;if(L?.status==="failed")try{return(Z=(G=JSON.parse(E.result||"{}").content)===null||G===void 0?void 0:G[0])===null||Z===void 0?void 0:Z.text}catch{return""}},[E.result,L]);(0,o.useEffect)(()=>{const G=R.onCodeBlockUpdate(Z=>{Z.toolCallId===S&&B({...Z})});return()=>{G.dispose()}},[]);const Q=G=>{G.stopPropagation(),I(D==="code"?"diff":"code")};return!b||!L?null:[k&&o.default.createElement("p",{key:"edit-file-tool-instructions"},k),o.default.createElement("div",{className:u.default["edit-file-tool"],key:"edit-file-tool"},o.default.createElement("div",{className:(0,r.default)(u.default["edit-file-tool-header"],{clickable:L.status==="pending"||L.status==="success"}),onClick:()=>{L.status==="pending"?P.open(p.URI.file(F)):L.status==="success"&&R.revealApplyPosition(L)}},o.default.createElement("div",{className:u.default.left},U&&o.default.createElement("span",{className:U}),o.default.createElement("span",{className:u.default["edit-file-tool-file-name"]},O),L.iterationCount>1&&o.default.createElement("span",{className:u.default["edit-file-tool-iteration-count"]},L.iterationCount,"/3"),o.default.createElement(g.ApplyStatus,{status:L.status,error:j})),o.default.createElement("div",{className:u.default.right},o.default.createElement(a.Popover,{title:"Show Code",id:"edit-file-tool-show-code"},o.default.createElement(a.Icon,{iconClass:"codicon codicon-file-code",onClick:Q})),((f=L.applyResult)===null||f===void 0?void 0:f.diff)&&o.default.createElement(a.Popover,{title:"Show Diff",id:"edit-file-tool-show-diff"},o.default.createElement(a.Icon,{iconClass:"codicon codicon-diff-multiple",onClick:Q})))),o.default.createElement(l.ChatMarkdown,{markdown:D==="code"?`\`\`\`${W||""}
31733
+ `).filter(Boolean).reduce((Z,$)=>{const[V,H]=$.split("=");return V&&H&&(Z[V.trim()]=H.trim()),Z},{});j.args=Q,j.env=G}b({...y,name:"",command:"",url:"",args:[],env:{}}),E(j)},[y,S,I,E,T]),P=(0,o.useCallback)(B=>{b({...y,command:B.target.value})},[y,S]),O=(0,o.useCallback)(B=>{D(B.target.value)},[S]),M=(0,o.useCallback)(B=>{w(B.target.value)},[I]),k=(0,o.useCallback)(B=>{b({...y,url:B.target.value})},[y]),F=(0,o.useCallback)(B=>{b({...y,type:B,command:"",args:[],env:{},url:""})},[y]),L=(0,o.useCallback)(()=>y?.type===g.MCP_SERVER_TYPE.STDIO?o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:l.default.formItem},o.default.createElement("label",null,(0,_.localize)("ai.native.mcp.command")),o.default.createElement("input",{type:"text",value:y.command,onChange:P,placeholder:(0,_.localize)("ai.native.mcp.command.placeHolder"),required:!0})),o.default.createElement("div",{className:l.default.formItem},o.default.createElement("label",null,(0,_.localize)("ai.native.mcp.args")),o.default.createElement("textarea",{value:S,onChange:O,placeholder:(0,_.localize)("ai.native.mcp.args.placeHolder"),rows:3})),o.default.createElement("div",{className:l.default.formItem},o.default.createElement("label",null,(0,_.localize)("ai.native.mcp.env")),o.default.createElement("textarea",{value:I,onChange:M,placeholder:(0,_.localize)("ai.native.mcp.env.placeHolder"),rows:3}))):o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:l.default.formItem},o.default.createElement("label",null,(0,_.localize)("ai.native.mcp.url")),o.default.createElement("textarea",{value:y.url,onChange:k,placeholder:(0,_.localize)("ai.native.mcp.url.placeHolder"),rows:3}))),[y,S,I]);return o.default.createElement(v.Modal,{title:d?(0,_.localize)("ai.native.mcp.editMCPServer.title"):(0,_.localize)("ai.native.mcp.addMCPServer.title"),visible:u,onCancel:f,centered:!0,width:600,footer:null,style:{background:"var(--editor-background)"}},o.default.createElement("form",{className:l.default.form,onSubmit:B=>B.preventDefault()},o.default.createElement("div",{className:l.default.formRow},o.default.createElement("div",{className:(0,r.default)(l.default.formItem,l.default.formItemName)},o.default.createElement("label",null,(0,_.localize)("ai.native.mcp.name")),o.default.createElement("input",{type:"text",value:y.name,onChange:B=>b({...y,name:B.target.value}),placeholder:(0,_.localize)("ai.native.mcp.name.placeHolder"),required:!0})),o.default.createElement("div",{className:(0,r.default)(l.default.formItem,l.default.formItemType)},o.default.createElement("label",null,(0,_.localize)("ai.native.mcp.type")),o.default.createElement(a.Select,{size:"large",value:y.type,options:[{label:(0,_.localize)("ai.native.mcp.stdio"),value:g.MCP_SERVER_TYPE.STDIO},{label:(0,_.localize)("ai.native.mcp.sse"),value:g.MCP_SERVER_TYPE.SSE}],className:l.default.formItemSelect,onChange:F}))),L(),o.default.createElement("div",{className:l.default.formActions},o.default.createElement(p.Button,{onClick:f,type:"primary",className:l.default.secondaryButton},(0,_.localize)("ai.native.mcp.buttonCancel")),o.default.createElement(p.Button,{onClick:R,type:"primary"},d?(0,_.localize)("ai.native.mcp.buttonUpdate"):(0,_.localize)("ai.native.mcp.buttonSave")))))};t.MCPServerForm=h},27397:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigCommandContribution=t.MCPConfigCommands=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(43718),p=e(54414),v=e(5297),m=e(33108);var _;(function(g){g.OPEN_MCP_CONFIG={id:"mcp.openConfig",label:"Open MCP Configuration"},g.OPEN_MCP_CONFIG_FILE={id:"mcp.openConfigFile",label:"Open MCP Configuration (JSON)"}})(_||(t.MCPConfigCommands=_={}));let s=class{registerCommands(l){l.registerCommand(_.OPEN_MCP_CONFIG,{execute:()=>{const h=new o.URI().withScheme(v.MCP_CONFIG_COMPONENTS_SCHEME_ID);this.editorService.open(h,{preview:!1,focus:!0})}}),l.registerCommand(_.OPEN_MCP_CONFIG_FILE,{execute:()=>{this.mcpConfigService.openConfigFile()}})}};t.MCPConfigCommandContribution=s,n.__decorate([(0,r.Autowired)(p.WorkbenchEditorService),n.__metadata("design:type",p.WorkbenchEditorService)],s.prototype,"editorService",void 0),n.__decorate([(0,r.Autowired)(a.MCPConfigServiceToken),n.__metadata("design:type",m.MCPConfigService)],s.prototype,"mcpConfigService",void 0),t.MCPConfigCommandContribution=s=n.__decorate([(0,a.Domain)(o.CommandContribution)],s)},5297:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigContribution=t.MCP_CONFIG_COMPONENTS_SCHEME_ID=void 0;const n=e(85608),r=e(76003),o=e(97267),a=e(93899),p=e(39496),v=e(26542),m=e(43718),_=e(82196),s=e(7443),g=e(10560),l=e(75279),h=e(27397),u="opensumi-mcp-config-viewer";t.MCP_CONFIG_COMPONENTS_SCHEME_ID="mcp-config";let d=class{registerEditorComponent(f){f.registerEditorComponent({uid:u,scheme:t.MCP_CONFIG_COMPONENTS_SCHEME_ID,component:l.MCPConfigView,renderMode:_.EditorComponentRenderMode.ONE_PER_WORKBENCH}),f.registerEditorComponentResolver(t.MCP_CONFIG_COMPONENTS_SCHEME_ID,(c,y)=>{y.push({type:"component",componentId:u})})}registerResource(f){f.registerResourceProvider({scheme:t.MCP_CONFIG_COMPONENTS_SCHEME_ID,provideResource:async c=>{const{configType:y}=c.getParsedQuery();return{uri:c,name:(0,m.localize)("ai.native.mcp.config.title"),icon:(0,o.getIcon)("mcp"),metadata:{configType:y}}}})}registerMenus(f){f.registerMenuItem(p.MenuId.EditorTitle,{command:h.MCPConfigCommands.OPEN_MCP_CONFIG_FILE.id,iconClass:(0,o.getIcon)("open"),group:"navigation",order:4,when:`resourceScheme == ${t.MCP_CONFIG_COMPONENTS_SCHEME_ID}`}),f.registerMenuItem(p.MenuId.EditorTitle,{command:h.MCPConfigCommands.OPEN_MCP_CONFIG.id,iconClass:(0,o.getIcon)("open"),group:"navigation",order:4,when:"resourceFilename =~ /mcp.json/"})}};t.MCPConfigContribution=d,n.__decorate([(0,r.Autowired)(g.IWorkspaceService),n.__metadata("design:type",Object)],d.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(s.IconService),n.__metadata("design:type",s.IconService)],d.prototype,"iconService",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",v.LabelService)],d.prototype,"labelService",void 0),t.MCPConfigContribution=d=n.__decorate([(0,m.Domain)(_.BrowserEditorContribution,a.MenuContribution)],d)},33108:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigService=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(78132),p=e(43718),v=e(54414),m=e(72665),_=e(19413),s=e(64811),g=e(69820),l=e(45331);let h=class extends p.Disposable{constructor(){super(),this.whenReadyDeferred=new p.Deferred,this._isInitialized=!1,this.mcpServersChangeEventEmitter=new p.Emitter,this.init(),this.disposables.push(this.mcpServerProxyService.onChangeMCPServers(()=>{this.fireMCPServersChange()})),this.disposables.push(this.preferenceService.onSpecificPreferenceChange("mcp",()=>{this.fireMCPServersChange()}))}async init(){this.chatStorage=await this.storageProvider(p.STORAGE_NAMESPACE.CHAT),this.whenReadyDeferred.resolve()}get whenReady(){return this.whenReadyDeferred.promise}get isInitialized(){return this._isInitialized}get onMCPServersChange(){return this.mcpServersChangeEventEmitter.event}fireMCPServersChange(d=!1){d&&(this._isInitialized=!0),this.mcpServersChangeEventEmitter.fire(d)}async getServers(){const{value:d,scope:E}=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0);if(E===p.PreferenceScope.Default){const S=(await this.mcpServerProxyService.$getServers()).find(D=>D.name===_.BUILTIN_MCP_SERVER_NAME);return S?[S]:[]}const f=Object.keys(d.mcpServers).map(A=>{const S=d.mcpServers[A];return S.url?{name:A,type:g.MCP_SERVER_TYPE.SSE,url:S.url}:{name:A,type:g.MCP_SERVER_TYPE.STDIO,command:S.command,args:S.args,env:S.env}}),c=await this.mcpServerProxyService.$getServers(),y=c.find(A=>A.name===_.BUILTIN_MCP_SERVER_NAME),b=f?.map(A=>{const S=c.find(D=>D.name===A.name);return S||this.sumiMCPServerBackendProxy.$addOrUpdateServer(A),{...A,isStarted:S?.isStarted||!1,tools:S?.tools||[]}});return y&&b.unshift(y),b}async controlServer(d,E){try{E?await this.mcpServerProxyService.$startServer(d):await this.mcpServerProxyService.$stopServer(d);const f=this.chatStorage.get(s.MCPServersEnabledKey,[_.BUILTIN_MCP_SERVER_NAME]),c=new Set(f);E?c.add(d):c.delete(d),this.chatStorage.set(s.MCPServersEnabledKey,Array.from(c))}catch(f){const c=f.message||f;throw this.logger.error(`Failed to ${E?"start":"stop"} server ${d}:`,c),this.messageService.error(c),f}}async saveServer(d,E){await this.whenReady;const{value:f}=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0),c=f.mcpServers;let y;E.type===g.MCP_SERVER_TYPE.SSE?y={url:E.url}:y={command:E.command,args:E.args,env:E.env},d?.name&&delete c[d.name],c[E.name]=y,await this.preferenceService.set("mcp",{mcpServers:c}),d?.enabled&&this.sumiMCPServerBackendProxy.$removeServer(d.name),this.sumiMCPServerBackendProxy.$addOrUpdateServer(E)}async deleteServer(d){const{value:E}=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0),f=E.mcpServers;f[d]&&(delete f[d],await this.sumiMCPServerBackendProxy.$removeServer(d),await this.preferenceService.set("mcp",{mcpServers:f}))}async syncServer(d){try{await this.sumiMCPServerBackendProxy.$syncServer(d)}catch(E){this.logger.error(`Failed to sync server ${d}:`,E),this.messageService.error(E.message||E)}}async getServerConfigByName(d){const{value:E}=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0);await this.whenReady;const f=this.chatStorage.get(s.MCPServersEnabledKey,[_.BUILTIN_MCP_SERVER_NAME]),c=E.mcpServers[d];if(c)return c.url?{name:d,type:g.MCP_SERVER_TYPE.SSE,url:c.url,enabled:f.includes(d)}:{name:d,type:g.MCP_SERVER_TYPE.STDIO,command:c.command,args:c.args,env:c.env,enabled:f.includes(d)}}getReadableServerType(d){switch(d){case g.MCP_SERVER_TYPE.STDIO:return(0,p.localize)("ai.native.mcp.type.stdio");case g.MCP_SERVER_TYPE.SSE:return(0,p.localize)("ai.native.mcp.type.sse");case g.MCP_SERVER_TYPE.BUILTIN:return(0,p.localize)("ai.native.mcp.type.builtin");default:return d}}async openConfigFile(){let d=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0);d.scope===p.PreferenceScope.Default&&(await this.preferenceService.set("mcp",{mcpServers:{}},p.PreferenceScope.Workspace),d=this.preferenceService.resolve("mcp",{mcpServers:{}},void 0));const E=d.configUri;E&&this.workbenchEditorService.open(E,{preview:!1})}};t.MCPConfigService=h,n.__decorate([(0,r.Autowired)(_.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],h.prototype,"sumiMCPServerBackendProxy",void 0),n.__decorate([(0,r.Autowired)(l.MCPServerProxyService),n.__metadata("design:type",l.MCPServerProxyService)],h.prototype,"mcpServerProxyService",void 0),n.__decorate([(0,r.Autowired)(a.PreferenceService),n.__metadata("design:type",Object)],h.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(m.IMessageService),n.__metadata("design:type",Object)],h.prototype,"messageService",void 0),n.__decorate([(0,r.Autowired)(p.StorageProvider),n.__metadata("design:type",Function)],h.prototype,"storageProvider",void 0),n.__decorate([(0,r.Autowired)(v.WorkbenchEditorService),n.__metadata("design:type",v.WorkbenchEditorService)],h.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],h.prototype,"logger",void 0),t.MCPConfigService=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},33368:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPFolderPreferenceProvider=void 0;const n=e(85608),r=e(76003),o=e(91825);let a=class extends o.FolderFilePreferenceProvider{parse(v){const m=super.parse(v);if(m!==void 0)return{mcp:{...m}}}getPath(v){if(v==="mcp")return[];if(v.startsWith("mcp."))return[v.substr(4)]}};t.MCPFolderPreferenceProvider=a,t.MCPFolderPreferenceProvider=a=n.__decorate([(0,r.Injectable)()],a)},55003:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPPreferencesContribution=t.MCPResourceProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(57517),p=e(924);let v=class{provideResource(s){return{supportsRevive:!0,name:(0,o.localize)("menu-bar.title.debug"),icon:(0,o.getIcon)("debug"),uri:s}}provideResourceSubname(){return null}async shouldCloseResource(){return!0}};t.MCPResourceProvider=v,t.MCPResourceProvider=v=n.__decorate([(0,r.Injectable)()],v);let m=class{constructor(){this.schema=p.MCPPreferencesSchema,this.name="mcp"}registerResource(s){s.registerResourceProvider(this.prefResourceProvider)}registerSchema(s){s.registerSchema(p.MCPSchemaUri,p.MCPSchema,["mcp.json"])}};t.MCPPreferencesContribution=m,n.__decorate([(0,r.Autowired)(v),n.__metadata("design:type",v)],m.prototype,"prefResourceProvider",void 0),t.MCPPreferencesContribution=m=n.__decorate([(0,o.Domain)(o.PreferenceContribution,o.PreferenceConfiguration,a.BrowserEditorContribution,o.JsonSchemaContribution)],m)},924:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPSchema=t.MCPPreferencesSchema=t.MCPSchemaUri=void 0,t.MCPSchemaUri="vscode://schemas/mcp/user",t.MCPPreferencesSchema={type:"object",scope:"resource",properties:{mcp:{$ref:t.MCPSchemaUri,description:"MCP configuration for Workspace.",defaultValue:{mcpServers:{}}}}},t.MCPSchema={$id:t.MCPSchemaUri,type:"object",title:"MCP",required:[],default:{mcpServers:{}},properties:{mcpServers:{type:"object",description:"List of MCP Servers. Add new servers or edit existing ones by using IntelliSense.",additionalProperties:{type:"object",properties:{command:{type:"string",description:"The command to start the MCP server."},args:{type:"array",description:"The arguments for the command to start the MCP server.",items:{type:"string"}},env:{type:"object",description:"The environment variables for the command to start the MCP server.",additionalProperties:{type:"string"}},url:{type:"string",description:"The SSE URL for the MCP server."}},oneOf:[{required:["command"]},{required:["url"]}]}}}}},45331:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPServerProxyService=void 0;const n=e(85608),r=e(48085),o=e(76003),a=e(41869),p=e(43718),v=e(19413),m=e(77633);let _=class{constructor(){this._onChangeMCPServers=new p.Emitter,this.onChangeMCPServers=this._onChangeMCPServers.event}$callMCPTool(g,l){return this.mcpServerRegistry.callMCPTool(g,l)}async $getBuiltinMCPTools(){const g=await this.mcpServerRegistry.getMCPTools().map(l=>({name:l.name,description:l.description,inputSchema:(0,r.zodToJsonSchema)(l.inputSchema),providerName:v.BUILTIN_MCP_SERVER_NAME}));return this.logger.log("SUMI MCP tools",g),g}async $updateMCPServers(){this._onChangeMCPServers.fire("update")}async getAllMCPTools(){return this.sumiMCPServerProxyService.$getAllMCPTools()}async $getServers(){return this.sumiMCPServerProxyService.$getServers()}async $startServer(g){await this.sumiMCPServerProxyService.$startServer(g)}async $stopServer(g){await this.sumiMCPServerProxyService.$stopServer(g)}};t.MCPServerProxyService=_,n.__decorate([(0,o.Autowired)(m.TokenMCPServerRegistry),n.__metadata("design:type",Object)],_.prototype,"mcpServerRegistry",void 0),n.__decorate([(0,o.Autowired)(a.ILogger),n.__metadata("design:type",Object)],_.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(v.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],_.prototype,"sumiMCPServerProxyService",void 0),t.MCPServerProxyService=_=n.__decorate([(0,o.Injectable)()],_)},79502:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPServerRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718),a=e(19413),p=e(98864);class v{constructor(s){this.logger=s}appendLine(s){this.logger.log(s)}}let m=class{constructor(){this.tools=[],this.toolComponents={}}get logger(){return new v(this.baseLogger)}set activeMessageInfo(s){this._activeMessageInfo=s}getMCPTool(s,g=a.BUILTIN_MCP_SERVER_NAME){return this.tools.find(l=>(0,p.getToolName)(l.name,g)===s)}registerMCPTool(s){const g=this.tools.findIndex(l=>l.name===s.name);g!==-1?this.tools[g]=s:this.tools.push(s)}registerToolComponent(s,g,l=a.BUILTIN_MCP_SERVER_NAME){this.toolComponents[(0,p.getToolName)(s,l)]=g}getToolComponent(s){return this.toolComponents[s]}getMCPTools(){return this.tools.sort((s,g)=>{var l,h;return((l=s.order)!==null&&l!==void 0?l:1/0)-((h=g.order)!==null&&h!==void 0?h:1/0)})}async callMCPTool(s,g){try{const l=this.tools.find(d=>d.name===s);if(!l)throw new Error(`MCP tool ${s} not found`);const h=g.toolCallId;g=l.inputSchema.parse(g);const u=await l.handler({...g,toolCallId:h},this.logger);return this.reportToolCall(s,g,u,h),u}catch(l){return console.error("callMCPTool error:",l),this.reportToolCall(s,g,l,g.toolCallId),{content:[{type:"text",text:`The tool ${s} failed to execute. Error: ${l}`}],isError:!0}}}reportToolCall(s,g,l,h){if(!this.tools.find(d=>d.name===s))throw new Error(`MCP tool ${s} not found`);this.aiReporter.send({msgType:o.AIServiceType.ToolCall,message:JSON.stringify({args:g,name:s,result:l}),messageId:this._activeMessageInfo.messageId,sessionId:this._activeMessageInfo.sessionId,relationId:h})}};t.MCPServerRegistry=m,n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],m.prototype,"baseLogger",void 0),n.__decorate([(0,r.Autowired)(o.IAIReporter),n.__metadata("design:type",Object)],m.prototype,"aiReporter",void 0),t.MCPServerRegistry=m=n.__decorate([(0,r.Injectable)()],m)},30703:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPToolsDialog=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=n.__importDefault(e(49783)),a=({tools:p})=>r.createElement("div",{className:o.default.mcp_tools_dialog},r.createElement("div",{className:o.default.dialog_title},"MCP Tools"),r.createElement("div",{className:o.default.tools_list},p.map(v=>r.createElement("div",{key:v.name,className:o.default.tool_item},r.createElement("div",{className:o.default.tool_name},v.name),r.createElement("div",{className:o.default.tool_description},v.description),v.providerName&&r.createElement("div",{className:o.default.tool_provider},"Provider: ",v.providerName)))));t.MCPToolsDialog=a},58260:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditFileToolComponent=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),a=e(97267),p=e(41869),v=e(54414),m=e(14162),_=e(87822),s=e(16781),g=e(21967),l=e(56474),h=e(73974),u=n.__importDefault(e(51601)),d=E=>{var f,c,y;const{args:b,messageId:A,toolCallId:S}=E,[D,I]=(0,o.useState)("code"),w=(0,p.useInjectable)(p.LabelService),T=(0,p.useInjectable)(p.AppConfig),R=(0,p.useInjectable)(h.BaseApplyService),P=(0,p.useInjectable)(v.WorkbenchEditorService),{target_file:O="",code_edit:M,instructions:k}=b||{},F=p.path.join(T.workspaceDir,O),[L,B]=(0,o.useState)(R.getCodeBlock(S,A)),U=(0,o.useMemo)(()=>O?`file-icon ${w.getIcon(p.URI.file(F))}`:void 0,[O,F]),W=(0,o.useMemo)(()=>{if(!O)return;const G=s.StandaloneServices.get(_.IModelService),Z=s.StandaloneServices.get(m.ILanguageService);return(0,p.detectModeId)(G,Z,p.Uri.file(F))},[O,F]),j=(0,o.useMemo)(()=>{var G,Z;if(L?.status==="failed")try{return(Z=(G=JSON.parse(E.result||"{}").content)===null||G===void 0?void 0:G[0])===null||Z===void 0?void 0:Z.text}catch{return""}},[E.result,L]);(0,o.useEffect)(()=>{const G=R.onCodeBlockUpdate(Z=>{Z.toolCallId===S&&B({...Z})});return()=>{G.dispose()}},[]);const Q=G=>{G.stopPropagation(),I(D==="code"?"diff":"code")};return!b||!L?null:[k&&o.default.createElement("p",{key:"edit-file-tool-instructions"},k),o.default.createElement("div",{className:u.default["edit-file-tool"],key:"edit-file-tool"},o.default.createElement("div",{className:(0,r.default)(u.default["edit-file-tool-header"],{clickable:L.status==="pending"||L.status==="success"}),onClick:()=>{L.status==="pending"?P.open(p.URI.file(F)):L.status==="success"&&R.revealApplyPosition(L)}},o.default.createElement("div",{className:u.default.left},U&&o.default.createElement("span",{className:U}),o.default.createElement("span",{className:u.default["edit-file-tool-file-name"]},O),L.iterationCount>1&&o.default.createElement("span",{className:u.default["edit-file-tool-iteration-count"]},L.iterationCount,"/3"),o.default.createElement(g.ApplyStatus,{status:L.status,error:j})),o.default.createElement("div",{className:u.default.right},o.default.createElement(a.Popover,{title:"Show Code",id:"edit-file-tool-show-code"},o.default.createElement(a.Icon,{iconClass:"codicon codicon-file-code",onClick:Q})),((f=L.applyResult)===null||f===void 0?void 0:f.diff)&&o.default.createElement(a.Popover,{title:"Show Diff",id:"edit-file-tool-show-diff"},o.default.createElement(a.Icon,{iconClass:"codicon codicon-diff-multiple",onClick:Q})))),o.default.createElement(l.ChatMarkdown,{markdown:D==="code"?`\`\`\`${W||""}
31734
31734
  ${M}
31735
31735
  \`\`\``:`\`\`\`diff
31736
31736
  ${(c=L.applyResult)===null||c===void 0?void 0:c.diff}
@@ -31738,7 +31738,7 @@ ${(c=L.applyResult)===null||c===void 0?void 0:c.diff}
31738
31738
  `)[0])))]};t.EditFileToolComponent=d},95292:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListDirToolComponent=t.GrepSearchToolComponent=t.FileSearchToolComponent=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(80564),a=e(41869),p=e(54414),v=e(51500),m=e(19413),_=n.__importDefault(e(51601)),s=({args:u,toolCallId:d,messageId:E})=>r.default.createElement(h,{args:u,toolCallId:d,messageId:E,toolName:"fileSearch",headerText:`Searched files "${u.query}"`});t.FileSearchToolComponent=s;const g=({args:u,toolCallId:d,messageId:E})=>r.default.createElement(h,{args:u,toolCallId:d,messageId:E,toolName:"grepSearch",headerText:`Grepped codebase "${u.query}"`});t.GrepSearchToolComponent=g;const l=({args:u,toolCallId:d,messageId:E})=>r.default.createElement(h,{args:u,toolCallId:d,messageId:E,toolName:"listDir",headerText:`Listed directory "${u.relative_workspace_path}"`});t.ListDirToolComponent=l;const h=({args:u,toolCallId:d,toolName:E,messageId:f,headerText:c})=>{const[y,b]=(0,r.useState)(!1),A=(0,a.useInjectable)(a.LabelService),S=(0,a.useInjectable)(p.WorkbenchEditorService),D=(0,a.useInjectable)(v.IWorkspaceService),I=(0,a.useInjectable)(a.CommandService),w=(0,r.useMemo)(()=>{var k,F;return a.URI.parse((F=(k=D.tryGetRoots())===null||k===void 0?void 0:k[0])===null||F===void 0?void 0:F.uri)},[]),T=(0,a.useInjectable)(m.IChatInternalService),[R,P]=(0,r.useState)([]);(0,r.useEffect)(()=>{const k=T.sessionModel.history.onMessageAdditionalChange(F=>{F[d]&&P(F[d].files||[])});return()=>{k.dispose()}},[]);const O=async k=>{if(!k.isDirectory)S.open(a.URI.parse(k.uri));else{const F=a.URI.parse(k.uri);I.executeCommand("filetree.location",F)}},M=(0,r.useMemo)(()=>R.map(k=>{const F=a.URI.parse(k.uri);return{iconClass:A.getIcon(F,{isDirectory:k.isDirectory}),name:F.path.base,path:a.path.relative(w.codeUri.fsPath,F.path.dir.toString()),uri:k.uri,isDirectory:k.isDirectory}}),[R]);return r.default.createElement("div",{className:_.default.container},r.default.createElement("div",{className:_.default.header,onClick:()=>b(!y)},r.default.createElement("span",{style:{transform:`rotate(${y?"90deg":"0deg"})`,display:"flex"}},r.default.createElement(o.Icon,{iconClass:"codicon codicon-chevron-right"})),r.default.createElement("span",null,c," \xB7 ",R.length," files")),y&&r.default.createElement("ul",{className:_.default.fileList},M.map((k,F)=>r.default.createElement("li",{key:F,className:_.default.fileItem,onClick:()=>O({uri:k.uri,isDirectory:k.isDirectory})},r.default.createElement("span",{className:k.iconClass}),r.default.createElement("span",{style:{flex:1}},k.name),r.default.createElement("span",{className:_.default.filePath},k.path)))))}},24706:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalToolComponent=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),a=e(81878),p=e(52141),v=e(89897),m=e(43718),_=e(71990),s=e(83854),g=e(22559),l=e(62471),h=n.__importDefault(e(51601));function u(f){const c={};try{const y=JSON.parse(f);return y.isError&&(c.isError=y.isError),y.content&&(c.text=y.content.map(b=>b.text).join(`
31739
31739
  `)),c}catch{return null}}const d={[s.ETerminalAutoExecutionPolicy.always]:"ai.native.terminal.autorun.always",[s.ETerminalAutoExecutionPolicy.auto]:"ai.native.terminal.autorun.auto",[s.ETerminalAutoExecutionPolicy.off]:"ai.native.terminal.autorun.off"};function E(f){return(0,m.localize)(d[f])}t.TerminalToolComponent=(0,r.memo)(f=>{const{args:c,toolCallId:y}=f,b=(0,o.useInjectable)(g.RunCommandHandler),A=(0,o.useInjectable)(o.PreferenceService),S=(0,o.useInjectable)(m.CommandService),[D,I]=(0,r.useState)(!1),w=A.get(_.AINativeSettingSectionsId.TerminalAutoRun),T=(0,r.useMemo)(()=>{var M;return!!(w===s.ETerminalAutoExecutionPolicy.off||w===s.ETerminalAutoExecutionPolicy.auto&&(!((M=f.args)===null||M===void 0)&&M.require_user_approval))},[f.args]);(0,r.useEffect)(()=>{f.state==="result"?I(!1):T||I(!0)},[f]);const R=(0,r.useCallback)(()=>{S.executeCommand("workbench.action.openSettings","ai.native.terminal.autorun")},[]),P=(0,r.useCallback)(M=>{y&&(b.handleApproval(y,M),I(!0))},[]),O=(0,r.useMemo)(()=>f.result?u(f.result):null,[f]);return r.default.createElement("div",{className:h.default.run_cmd_tool},r.default.createElement("div",null,r.default.createElement("div",{className:h.default.command_title},r.default.createElement(a.Icon,{icon:"terminal"}),r.default.createElement("span",null,T?(0,m.localize)("ai.native.mcp.terminal.allow-question"):(0,m.localize)("ai.native.mcp.terminal.command"))),r.default.createElement("p",{className:h.default.command_content},r.default.createElement("code",null,"$ ",c?.command)),r.default.createElement("p",{className:h.default.comand_description},c?.explanation),f.state==="complete"&&T&&c&&!D&&r.default.createElement("div",{className:h.default.cmmand_footer},r.default.createElement(a.Button,{type:"link",size:"small",onClick:()=>P(!0)},(0,m.localize)("ai.native.mcp.terminal.allow")),r.default.createElement(a.Button,{type:"link",size:"small",onClick:()=>P(!1)},(0,m.localize)("ai.native.mcp.terminal.deny"))),f.state==="result"&&O&&r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:h.default.command_content},r.default.createElement(a.Icon,{icon:"output"}),r.default.createElement("code",{dangerouslySetInnerHTML:{__html:(0,l.computeAnsiLogString)(O.text||"")}})),r.default.createElement("div",{className:h.default.auto_execution_policy},r.default.createElement("span",{className:h.default.auto_execution_policy_label},E(w||s.ETerminalAutoExecutionPolicy.auto)),r.default.createElement(p.EnhancePopover,{id:"policy-config-popover",title:(0,m.localize)("ai.native.terminal.autorun.command")},r.default.createElement(a.Icon,{size:"small",iconClass:"codicon codicon-settings-gear",onClick:R}))))),D&&r.default.createElement("div",{className:h.default.running},r.default.createElement(v.Loading,null),r.default.createElement("span",null,(0,m.localize)("ai.native.terminal.autorun.running"))))})},62471:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.computeAnsiLogString=p;const n=e(85608),r=n.__importDefault(e(30002)),o=n.__importDefault(e(39718)),a=new r.default;function p(v,m=!0,_=!1){const s=v.split(`
31740
31740
  `);let g=m?(0,o.default)(s):s;return _&&(g=g.map(h=>h.replace("\r","")).filter(h=>!!h)),g.map(h=>a.ansi_to_html(h)).join(`
31741
- `)}},39718:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cursorUp=t.eraseEndLine=t.eraseLine=t.ESC=void 0,t.default=n,t.ESC="\x1B[",t.eraseLine=t.ESC+"2K",t.eraseEndLine=t.ESC+"K";const e=(r=1)=>t.ESC+r+"A";t.cursorUp=e;function n(r){const o=(0,t.cursorUp)(1)+t.eraseLine,a=t.eraseLine,p=`\r${t.eraseEndLine}`,v=["\\r","\\u001b\\[G","\\u001b\\[1G"],m=new RegExp(`${v.join("|")}`);return r.reduce((s,g)=>{let l=0;const h=o.length;for(;l=g.indexOf(o,l),l>=0;)l+=h,s.pop();let u=g.lastIndexOf(a);u<0&&(u=g.lastIndexOf(p)),u>0&&(g=g.slice(u));const d=g.split(m).filter(E=>!!E);return d.length>1&&(g=d.reduce((E,f)=>{const c=E.slice(f.length);return f+c},"")),s.push(g),s},[])}},7228:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateNewFileWithTextTool=void 0;const n=e(85608),r=e(75995),o=e(76003),a=e(43718),p=e(14951),v=e(51500),m=e(77633),_=e(73974),s=e(58260),g=r.z.object({target_file:r.z.string().describe("The relative path where the file should be created"),code_edit:r.z.string().describe("The content to write into the new file")});let l=class{registerMCPServer(u){u.registerMCPTool(this.getToolDefinition()),u.registerToolComponent("create_new_file_with_text",s.EditFileToolComponent)}getToolDefinition(){return{name:"create_new_file_with_text",label:"Create File",order:7,description:`Creates a new file at the specified path within the project directory and populates it with the provided text. Use this tool to generate new files in your project structure. Returns one of two possible responses: "ok" if the file was successfully created and populated, "can't find project dir" if the project directory cannot be determined. Note: This tool creates any necessary parent directories automatically.`,inputSchema:g,handler:this.handler.bind(this)}}async handler(u,d){try{const E=this.workspaceService.tryGetRoots();if(!E||E.length===0)return d.appendLine("Error: Cannot determine project directory"),{content:[{type:"text",text:"can't find project dir"}],isError:!0};const f=a.URI.parse(E[0].uri),c=a.path.join(f.codeUri.fsPath,u.target_file),y=a.URI.file(c),b=a.path.dirname(c),A=a.URI.file(b);await this.fileService.createFolder(A.toString()),await this.fileService.createFile(y.toString());const S=await this.applyService.registerCodeBlock(u.target_file,u.code_edit,u.toolCallId);return await this.applyService.apply(S),d.appendLine(`Successfully created file at: ${u.target_file}`),{content:[{type:"text",text:"ok"}]}}catch(E){return d.appendLine(`Error during file creation: ${E}`),{content:[{type:"text",text:E.message}],isError:!0}}}};t.CreateNewFileWithTextTool=l,n.__decorate([(0,o.Autowired)(v.IWorkspaceService),n.__metadata("design:type",Object)],l.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(p.IFileServiceClient),n.__metadata("design:type",Object)],l.prototype,"fileService",void 0),n.__decorate([(0,o.Autowired)(_.BaseApplyService),n.__metadata("design:type",_.BaseApplyService)],l.prototype,"applyService",void 0),t.CreateNewFileWithTextTool=l=n.__decorate([(0,a.Domain)(m.MCPServerContribution)],l)},90977:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditFileTool=void 0;const n=e(85608),r=e(75995),o=e(76003),a=e(43718),p=e(77633),v=e(58260),m=e(9343),_=r.z.object({target_file:r.z.string().describe("The target file to modify. Always specify the target file as the first argument and use the relative path in the workspace of the file to edit"),instructions:r.z.string().optional().describe("A single sentence instruction describing what you are going to do for the sketched edit. This is used to assist the less intelligent model in applying the edit. Please use the first person to describe what you are going to do. Dont repeat what you have said previously in normal messages. And use it to disambiguate uncertainty in the edit."),code_edit:r.z.string().describe("Specify ONLY the precise lines of code that you wish to edit. **NEVER specify or write out unchanged code**. Instead, represent all unchanged code using the comment of the language you're editing in - example: `// ... existing code ...`")}).transform(g=>({targetFile:g.target_file,instructions:g.instructions,codeEdit:g.code_edit}));let s=class{registerMCPServer(l){l.registerMCPTool(this.getToolDefinition()),l.registerToolComponent("edit_file",v.EditFileToolComponent)}getToolDefinition(){return{name:"edit_file",label:"Edit File",order:5,description:`Use this tool to propose an edit to an existing file.
31741
+ `)}},39718:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cursorUp=t.eraseEndLine=t.eraseLine=t.ESC=void 0,t.default=n,t.ESC="\x1B[",t.eraseLine=t.ESC+"2K",t.eraseEndLine=t.ESC+"K";const e=(r=1)=>t.ESC+r+"A";t.cursorUp=e;function n(r){const o=(0,t.cursorUp)(1)+t.eraseLine,a=t.eraseLine,p=`\r${t.eraseEndLine}`,v=["\\r","\\u001b\\[G","\\u001b\\[1G"],m=new RegExp(`${v.join("|")}`);return r.reduce((s,g)=>{let l=0;const h=o.length;for(;l=g.indexOf(o,l),l>=0;)l+=h,s.pop();let u=g.lastIndexOf(a);u<0&&(u=g.lastIndexOf(p)),u>0&&(g=g.slice(u));const d=g.split(m).filter(E=>!!E);return d.length>1&&(g=d.reduce((E,f)=>{const c=E.slice(f.length);return f+c},"")),s.push(g),s},[])}},7228:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateNewFileWithTextTool=void 0;const n=e(85608),r=e(75995),o=e(76003),a=e(43718),p=e(14951),v=e(51500),m=e(77633),_=e(73974),s=e(58260),g=r.z.object({target_file:r.z.string().describe("The relative path where the file should be created"),code_edit:r.z.string().describe("The content to write into the new file")}).transform(h=>({targetFile:h.target_file,codeEdit:h.code_edit}));let l=class{registerMCPServer(u){u.registerMCPTool(this.getToolDefinition()),u.registerToolComponent("create_new_file_with_text",s.EditFileToolComponent)}getToolDefinition(){return{name:"create_new_file_with_text",label:"Create File",order:7,description:`Creates a new file at the specified path within the project directory and populates it with the provided text. Use this tool to generate new files in your project structure. Returns one of two possible responses: "ok" if the file was successfully created and populated, "can't find project dir" if the project directory cannot be determined. Note: This tool creates any necessary parent directories automatically.`,inputSchema:g,handler:this.handler.bind(this)}}async handler(u,d){try{const E=this.workspaceService.tryGetRoots();if(!E||E.length===0)return d.appendLine("Error: Cannot determine project directory"),{content:[{type:"text",text:"can't find project dir"}],isError:!0};const f=a.URI.parse(E[0].uri),c=a.path.join(f.codeUri.fsPath,u.targetFile),y=a.URI.file(c),b=a.path.dirname(c),A=a.URI.file(b);await this.fileService.createFolder(A.toString()),await this.fileService.createFile(y.toString());const S=await this.applyService.registerCodeBlock(u.targetFile,u.codeEdit,u.toolCallId);return await this.applyService.apply(S),d.appendLine(`Successfully created file at: ${u.targetFile}`),{content:[{type:"text",text:"ok"}]}}catch(E){return d.appendLine(`Error during file creation: ${E}`),{content:[{type:"text",text:E.message}],isError:!0}}}};t.CreateNewFileWithTextTool=l,n.__decorate([(0,o.Autowired)(v.IWorkspaceService),n.__metadata("design:type",Object)],l.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(p.IFileServiceClient),n.__metadata("design:type",Object)],l.prototype,"fileService",void 0),n.__decorate([(0,o.Autowired)(_.BaseApplyService),n.__metadata("design:type",_.BaseApplyService)],l.prototype,"applyService",void 0),t.CreateNewFileWithTextTool=l=n.__decorate([(0,a.Domain)(m.MCPServerContribution)],l)},90977:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditFileTool=void 0;const n=e(85608),r=e(75995),o=e(76003),a=e(43718),p=e(77633),v=e(58260),m=e(9343),_=r.z.object({target_file:r.z.string().describe("The target file to modify. Always specify the target file as the first argument and use the relative path in the workspace of the file to edit"),instructions:r.z.string().optional().describe("A single sentence instruction describing what you are going to do for the sketched edit. This is used to assist the less intelligent model in applying the edit. Please use the first person to describe what you are going to do. Dont repeat what you have said previously in normal messages. And use it to disambiguate uncertainty in the edit."),code_edit:r.z.string().describe("Specify ONLY the precise lines of code that you wish to edit. **NEVER specify or write out unchanged code**. Instead, represent all unchanged code using the comment of the language you're editing in - example: `// ... existing code ...`")}).transform(g=>({targetFile:g.target_file,instructions:g.instructions,codeEdit:g.code_edit}));let s=class{registerMCPServer(l){l.registerMCPTool(this.getToolDefinition()),l.registerToolComponent("edit_file",v.EditFileToolComponent)}getToolDefinition(){return{name:"edit_file",label:"Edit File",order:5,description:`Use this tool to propose an edit to an existing file.
31742
31742
  This will be read by a less intelligent model, which will quickly apply the edit. You should make it clear what the edit is, while also minimizing the unchanged code you write.
31743
31743
  When writing the edit, you should specify each edit in sequence, with the special comment \`// ... existing code ...\` to represent unchanged code in between edited lines.
31744
31744
  For example:
@@ -31765,27 +31765,27 @@ ${u.applyResult.diagnosticInfos.map(d=>`Line ${d.startLineNumber}: ${d.message.s
31765
31765
  `)[0]}`).join(`
31766
31766
  `)}
31767
31767
 
31768
- Please fix the linter errors if it is clear how to (or you can easily figure out how to). Do not make uneducated guesses. And do not loop more than 3 times on fixing linter errors on the same file.`:""}`:u.status==="cancelled"?"User cancelled the edit.":"The apply model made no changes to the file."}]}}};t.EditFileTool=s,n.__decorate([(0,o.Autowired)(m.EditFileHandler),n.__metadata("design:type",m.EditFileHandler)],s.prototype,"editFileHandler",void 0),t.EditFileTool=s=n.__decorate([(0,a.Domain)(p.MCPServerContribution)],s)},80173:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSearchTool=void 0;const n=e(85608),r=e(75995),o=e(76003),a=e(79240),p=e(43718),v=e(87863),m=e(84660),_=e(51500),s=e(19413),g=e(59347),l=e(77633),h=e(95292),u=r.z.object({query:r.z.string().describe("Fuzzy filename to search for"),explanation:r.z.string().describe("One sentence explanation as to why this tool is being used, and how it contributes to the goal.")}),d=10;let E=class{registerMCPServer(c){c.registerMCPTool(this.getToolDefinition()),c.registerToolComponent("file_search",h.FileSearchToolComponent)}getToolDefinition(){return{name:"file_search",label:"Search Files",order:6,description:"Fast file search based on fuzzy matching against file path. Use if you know part of the file path but don't know where it's located exactly. Response will be capped to 10 results. Make your query more specific if need to filter results further.",inputSchema:u,handler:this.handler.bind(this)}}async handler(c,y){if(!c.query)throw new Error("No fileSearch parameters provided. Need to give a query.");const b=this.workspaceService.tryGetRoots();if(!b||b.length===0)throw new Error("Cannot determine project directory");const A=this.normalizeQuery(c.query),S=await this.fileSearchService.find(A,{rootUris:[new p.URI(b[0].uri).codeUri.fsPath],excludePatterns:Object.keys(v.defaultFilesWatcherExcludes),limit:100,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0}),D=S.slice(0,d).map(w=>({uri:p.URI.parse(w).codeUri.fsPath,isDirectory:!1})),I=this.chatInternalService.sessionModel.history.getMessages();return this.chatInternalService.sessionModel.history.setMessageAdditional(I[I.length-1].id,{[c.toolCallId]:{files:D}}),y.appendLine(`Found ${D.length} files matching "${c.query}"`),{content:[{type:"text",text:`${D.map(w=>w.uri).join(`
31768
+ Please fix the linter errors if it is clear how to (or you can easily figure out how to). Do not make uneducated guesses. And do not loop more than 3 times on fixing linter errors on the same file.`:""}`:u.status==="cancelled"?"User cancelled the edit.":"The apply model made no changes to the file."}]}}};t.EditFileTool=s,n.__decorate([(0,o.Autowired)(m.EditFileHandler),n.__metadata("design:type",m.EditFileHandler)],s.prototype,"editFileHandler",void 0),t.EditFileTool=s=n.__decorate([(0,a.Domain)(p.MCPServerContribution)],s)},80173:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSearchTool=void 0;const n=e(85608),r=e(75995),o=e(76003),a=e(79240),p=e(43718),v=e(87863),m=e(84660),_=e(51500),s=e(19413),g=e(59347),l=e(77633),h=e(95292),u=r.z.object({query:r.z.string().describe("Fuzzy filename to search for"),explanation:r.z.string().describe("One sentence explanation as to why this tool is being used, and how it contributes to the goal.")}),d=10;let E=class{registerMCPServer(c){c.registerMCPTool(this.getToolDefinition()),c.registerToolComponent("file_search",h.FileSearchToolComponent)}getToolDefinition(){return{name:"file_search",label:"Search Files",order:6,description:"Fast file search based on fuzzy matching against file path. Use if you know part of the file path but don't know where it's located exactly. Response will be capped to 10 results. Make your query more specific if need to filter results further.",inputSchema:u,handler:this.handler.bind(this)}}async handler(c,y){var b;if(!c.query)throw new Error("No fileSearch parameters provided. Need to give a query.");const A=this.workspaceService.tryGetRoots();if(!A||A.length===0)throw new Error("Cannot determine project directory");const S=this.normalizeQuery(c.query),D=await this.fileSearchService.find(S,{rootUris:[new p.URI(A[0].uri).codeUri.fsPath],excludePatterns:Object.keys(v.defaultFilesWatcherExcludes),limit:100,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0}),I=D.slice(0,d).map(R=>({uri:p.URI.parse(R).codeUri.fsPath,isDirectory:!1})),w=this.chatInternalService.sessionModel.history.getMessages(),T=(b=w[w.length-1])===null||b===void 0?void 0:b.id;return T&&this.chatInternalService.sessionModel.history.setMessageAdditional(T,{[c.toolCallId]:{files:I}}),y.appendLine(`Found ${I.length} files matching "${c.query}"`),{content:[{type:"text",text:`${I.map(R=>R.uri).join(`
31769
31769
  `)}
31770
- ${S.length>d?`
31771
- Found ${S.length} files matching "${c.query}", only return the first ${d} results`:""}`}]}}normalizeQuery(c){const y=c.trim().replace(/\s/g,"");return(0,a.getValidateInput)(y)}};t.FileSearchTool=E,n.__decorate([(0,o.Autowired)(_.IWorkspaceService),n.__metadata("design:type",Object)],E.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(m.FileSearchServicePath),n.__metadata("design:type",Object)],E.prototype,"fileSearchService",void 0),n.__decorate([(0,o.Autowired)(s.IChatInternalService),n.__metadata("design:type",g.ChatInternalService)],E.prototype,"chatInternalService",void 0),t.FileSearchTool=E=n.__decorate([(0,p.Domain)(l.MCPServerContribution)],E)},30645:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GetDiagnosticsByPathTool=void 0;const n=e(85608),r=n.__importStar(e(64756)),o=e(75995),a=e(76003),p=e(43718),v=e(51500),m=e(26592),_=e(34835),s=e(77633),g=o.z.object({filePathInProject:o.z.string().describe("The relative path to the file to get diagnostics for")});let l=class{registerMCPServer(u){u.registerMCPTool(this.getToolDefinition())}getToolDefinition(){return{name:"get_diagnostics_by_path",label:"Get Diagnostics By Path",order:9,description:`Retrieves diagnostic information (errors, warnings, etc.) from a specific file in the project. Use this tool to get information about problems in any project file. IMPORTANT: This tool should be called after any code generation or modification operations to verify and fix potential issues. Requires a filePathInProject parameter specifying the target file path relative to project root. Returns a JSON-formatted list of diagnostics, where each entry contains: - path: The file path where the diagnostic was found - line: The line number (1-based) of the diagnostic - severity: The severity level ("error", "warning", "information", or "hint") - message: The diagnostic message Returns an empty list ([]) if no diagnostics are found or the file doesn't exist. Best Practice: Always check diagnostics after code generation to ensure code quality and fix any issues immediately. Use this tool in combination with get_open_in_editor_file_diagnostics to verify all affected files after code changes. Diagnostic Severity Handling Guidelines: - "error": Must be fixed immediately as they indicate critical issues that will prevent code from working correctly. - "warning": For user code, preserve unless the warning indicates a clear improvement opportunity. For generated code, optimize to remove warnings. - "information"/"hint": For user code, preserve as they might reflect intentional patterns. For generated code, optimize if it improves code quality without changing functionality.`,inputSchema:g,handler:this.handler.bind(this)}}async handler(u,d){try{const E=this.workspaceService.tryGetRoots();if(!E||E.length===0)return d.appendLine("Error: Cannot determine project directory"),{content:[{type:"text",text:"[]"}],isError:!0};const f=p.URI.parse(E[0].uri),c=r.join(f.codeUri.fsPath,u.filePathInProject),y=m.URI.file(c),b=r.relative(f.codeUri.fsPath,c);if(b.startsWith("..")||r.isAbsolute(b))return d.appendLine("Error: File is outside of project scope"),{content:[{type:"text",text:"[]"}],isError:!0};const S=this.markerService.read({resource:y}).map(I=>({path:u.filePathInProject,line:I.startLineNumber,severity:this.getSeverityString(I.severity),message:I.message})),D=JSON.stringify(S,null,2);return d.appendLine(`Found ${S.length} diagnostics in ${u.filePathInProject}`),{content:[{type:"text",text:D}]}}catch(E){return d.appendLine(`Error getting diagnostics: ${E}`),{content:[{type:"text",text:"[]"}],isError:!0}}}getSeverityString(u){switch(u){case _.MarkerSeverity.Error:return"error";case _.MarkerSeverity.Warning:return"warning";case _.MarkerSeverity.Info:return"information";case _.MarkerSeverity.Hint:return"hint";default:return"unknown"}}};t.GetDiagnosticsByPathTool=l,n.__decorate([(0,a.Autowired)(v.IWorkspaceService),n.__metadata("design:type",Object)],l.prototype,"workspaceService",void 0),n.__decorate([(0,a.Autowired)(_.IMarkerService),n.__metadata("design:type",Object)],l.prototype,"markerService",void 0),t.GetDiagnosticsByPathTool=l=n.__decorate([(0,p.Domain)(s.MCPServerContribution)],l)},82078:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GetOpenEditorFileDiagnosticsTool=void 0;const n=e(85608),r=n.__importStar(e(64756)),o=e(75995),a=e(76003),p=e(43718),v=e(54414),m=e(51500),_=e(26592),s=e(34835),g=e(77633),l=o.z.object({});let h=class{registerMCPServer(d){d.registerMCPTool(this.getToolDefinition())}getToolDefinition(){return{name:"get_open_in_editor_file_diagnostics",label:"Get Current Editor Diagnostics",order:8,description:'Retrieves diagnostic information (errors, warnings, etc.) from the currently active file in VS Code editor. Use this tool to get information about problems in your current file. IMPORTANT: This tool should be called after any code generation or modification operations to verify and fix potential issues. Returns a JSON-formatted list of diagnostics, where each entry contains: - path: The file path where the diagnostic was found - line: The line number (1-based) of the diagnostic - severity: The severity level ("error", "warning", "information", or "hint") - message: The diagnostic message Returns an empty list ([]) if no diagnostics are found or no file is open. Best Practice: Always check diagnostics after code generation to ensure code quality and fix any issues immediately. Diagnostic Severity Handling Guidelines: - "error": Must be fixed immediately as they indicate critical issues that will prevent code from working correctly. - "warning": For user code, preserve unless the warning indicates a clear improvement opportunity. For generated code, optimize to remove warnings. - "information"/"hint": For user code, preserve as they might reflect intentional patterns. For generated code, optimize if it improves code quality without changing functionality.',inputSchema:l,handler:this.handler.bind(this)}}async handler(d,E){try{const f=this.editorService.currentEditor;if(!f||!f.currentUri)return E.appendLine("Error: No active text editor found"),{content:[{type:"text",text:"[]"}],isError:!0};const c=this.workspaceService.tryGetRoots();if(!c||c.length===0)return E.appendLine("Error: Cannot determine project directory"),{content:[{type:"text",text:"[]"}],isError:!0};const y=_.URI.parse(f.currentUri.toString()),b=this.markerService.read({resource:y}),A=p.URI.parse(c[0].uri),S=r.relative(A.codeUri.fsPath,f.currentUri.codeUri.fsPath),D=b.map(w=>({path:S,line:w.startLineNumber,severity:this.getSeverityString(w.severity),message:w.message})),I=JSON.stringify(D,null,2);return E.appendLine(`Found ${D.length} diagnostics in current file`),{content:[{type:"text",text:I}]}}catch(f){return E.appendLine(`Error getting diagnostics: ${f}`),{content:[{type:"text",text:"[]"}],isError:!0}}}getSeverityString(d){switch(d){case s.MarkerSeverity.Error:return"error";case s.MarkerSeverity.Warning:return"warning";case s.MarkerSeverity.Info:return"information";case s.MarkerSeverity.Hint:return"hint";default:return"unknown"}}};t.GetOpenEditorFileDiagnosticsTool=h,n.__decorate([(0,a.Autowired)(v.WorkbenchEditorService),n.__metadata("design:type",v.WorkbenchEditorService)],h.prototype,"editorService",void 0),n.__decorate([(0,a.Autowired)(m.IWorkspaceService),n.__metadata("design:type",Object)],h.prototype,"workspaceService",void 0),n.__decorate([(0,a.Autowired)(s.IMarkerService),n.__metadata("design:type",Object)],h.prototype,"markerService",void 0),t.GetOpenEditorFileDiagnosticsTool=h=n.__decorate([(0,p.Domain)(g.MCPServerContribution)],h)},39855:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GrepSearchTool=void 0;const n=e(85608),r=e(75995),o=e(76003),a=e(43718),p=e(13439),v=e(51495),m=e(51500),_=e(19413),s=e(59347),g=e(77633),l=e(95292),h=r.z.object({query:r.z.string().describe("The regex pattern to search for"),case_sensitive:r.z.boolean().optional().describe("Whether the search should be case sensitive"),include_pattern:r.z.string().optional().describe('Glob pattern for files to include (e.g. "*.ts" for TypeScript files)'),exclude_pattern:r.z.string().optional().describe("Glob pattern for files to exclude"),explanation:r.z.string().optional().describe("One sentence explanation as to why this tool is being used, and how it contributes to the goal.")}),u=50;let d=class{registerMCPServer(f){f.registerMCPTool(this.getToolDefinition()),f.registerToolComponent("grep_search",l.GrepSearchToolComponent)}getToolDefinition(){return{name:"grep_search",label:"Search Contents",order:4,description:`Fast text-based regex search that finds exact pattern matches within files or directories, utilizing the ripgrep command for efficient searching.
31770
+ ${D.length>d?`
31771
+ Found ${D.length} files matching "${c.query}", only return the first ${d} results`:""}`}]}}normalizeQuery(c){const y=c.trim().replace(/\s/g,"");return(0,a.getValidateInput)(y)}};t.FileSearchTool=E,n.__decorate([(0,o.Autowired)(_.IWorkspaceService),n.__metadata("design:type",Object)],E.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(m.FileSearchServicePath),n.__metadata("design:type",Object)],E.prototype,"fileSearchService",void 0),n.__decorate([(0,o.Autowired)(s.IChatInternalService),n.__metadata("design:type",g.ChatInternalService)],E.prototype,"chatInternalService",void 0),t.FileSearchTool=E=n.__decorate([(0,p.Domain)(l.MCPServerContribution)],E)},30645:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GetDiagnosticsByPathTool=void 0;const n=e(85608),r=n.__importStar(e(64756)),o=e(75995),a=e(76003),p=e(43718),v=e(51500),m=e(26592),_=e(34835),s=e(77633),g=o.z.object({filePathInProject:o.z.string().describe("The relative path to the file to get diagnostics for")});let l=class{registerMCPServer(u){u.registerMCPTool(this.getToolDefinition())}getToolDefinition(){return{name:"get_diagnostics_by_path",label:"Get Diagnostics By Path",order:9,description:`Retrieves diagnostic information (errors, warnings, etc.) from a specific file in the project. Use this tool to get information about problems in any project file. IMPORTANT: This tool should be called after any code generation or modification operations to verify and fix potential issues. Requires a filePathInProject parameter specifying the target file path relative to project root. Returns a JSON-formatted list of diagnostics, where each entry contains: - path: The file path where the diagnostic was found - line: The line number (1-based) of the diagnostic - severity: The severity level ("error", "warning", "information", or "hint") - message: The diagnostic message Returns an empty list ([]) if no diagnostics are found or the file doesn't exist. Best Practice: Always check diagnostics after code generation to ensure code quality and fix any issues immediately. Use this tool in combination with get_open_in_editor_file_diagnostics to verify all affected files after code changes. Diagnostic Severity Handling Guidelines: - "error": Must be fixed immediately as they indicate critical issues that will prevent code from working correctly. - "warning": For user code, preserve unless the warning indicates a clear improvement opportunity. For generated code, optimize to remove warnings. - "information"/"hint": For user code, preserve as they might reflect intentional patterns. For generated code, optimize if it improves code quality without changing functionality.`,inputSchema:g,handler:this.handler.bind(this)}}async handler(u,d){try{const E=this.workspaceService.tryGetRoots();if(!E||E.length===0)return d.appendLine("Error: Cannot determine project directory"),{content:[{type:"text",text:"[]"}],isError:!0};const f=p.URI.parse(E[0].uri),c=r.join(f.codeUri.fsPath,u.filePathInProject),y=m.URI.file(c),b=r.relative(f.codeUri.fsPath,c);if(b.startsWith("..")||r.isAbsolute(b))return d.appendLine("Error: File is outside of project scope"),{content:[{type:"text",text:"[]"}],isError:!0};const S=this.markerService.read({resource:y}).map(I=>({path:u.filePathInProject,line:I.startLineNumber,severity:this.getSeverityString(I.severity),message:I.message})),D=JSON.stringify(S,null,2);return d.appendLine(`Found ${S.length} diagnostics in ${u.filePathInProject}`),{content:[{type:"text",text:D}]}}catch(E){return d.appendLine(`Error getting diagnostics: ${E}`),{content:[{type:"text",text:"[]"}],isError:!0}}}getSeverityString(u){switch(u){case _.MarkerSeverity.Error:return"error";case _.MarkerSeverity.Warning:return"warning";case _.MarkerSeverity.Info:return"information";case _.MarkerSeverity.Hint:return"hint";default:return"unknown"}}};t.GetDiagnosticsByPathTool=l,n.__decorate([(0,a.Autowired)(v.IWorkspaceService),n.__metadata("design:type",Object)],l.prototype,"workspaceService",void 0),n.__decorate([(0,a.Autowired)(_.IMarkerService),n.__metadata("design:type",Object)],l.prototype,"markerService",void 0),t.GetDiagnosticsByPathTool=l=n.__decorate([(0,p.Domain)(s.MCPServerContribution)],l)},82078:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GetOpenEditorFileDiagnosticsTool=void 0;const n=e(85608),r=n.__importStar(e(64756)),o=e(75995),a=e(76003),p=e(43718),v=e(54414),m=e(51500),_=e(26592),s=e(34835),g=e(77633),l=o.z.object({});let h=class{registerMCPServer(d){d.registerMCPTool(this.getToolDefinition())}getToolDefinition(){return{name:"get_open_in_editor_file_diagnostics",label:"Get Current Editor Diagnostics",order:8,description:'Retrieves diagnostic information (errors, warnings, etc.) from the currently active file in VS Code editor. Use this tool to get information about problems in your current file. IMPORTANT: This tool should be called after any code generation or modification operations to verify and fix potential issues. Returns a JSON-formatted list of diagnostics, where each entry contains: - path: The file path where the diagnostic was found - line: The line number (1-based) of the diagnostic - severity: The severity level ("error", "warning", "information", or "hint") - message: The diagnostic message Returns an empty list ([]) if no diagnostics are found or no file is open. Best Practice: Always check diagnostics after code generation to ensure code quality and fix any issues immediately. Diagnostic Severity Handling Guidelines: - "error": Must be fixed immediately as they indicate critical issues that will prevent code from working correctly. - "warning": For user code, preserve unless the warning indicates a clear improvement opportunity. For generated code, optimize to remove warnings. - "information"/"hint": For user code, preserve as they might reflect intentional patterns. For generated code, optimize if it improves code quality without changing functionality.',inputSchema:l,handler:this.handler.bind(this)}}async handler(d,E){try{const f=this.editorService.currentEditor;if(!f||!f.currentUri)return E.appendLine("Error: No active text editor found"),{content:[{type:"text",text:"[]"}],isError:!0};const c=this.workspaceService.tryGetRoots();if(!c||c.length===0)return E.appendLine("Error: Cannot determine project directory"),{content:[{type:"text",text:"[]"}],isError:!0};const y=_.URI.parse(f.currentUri.toString()),b=this.markerService.read({resource:y}),A=p.URI.parse(c[0].uri),S=r.relative(A.codeUri.fsPath,f.currentUri.codeUri.fsPath),D=b.map(w=>({path:S,line:w.startLineNumber,severity:this.getSeverityString(w.severity),message:w.message})),I=JSON.stringify(D,null,2);return E.appendLine(`Found ${D.length} diagnostics in current file`),{content:[{type:"text",text:I}]}}catch(f){return E.appendLine(`Error getting diagnostics: ${f}`),{content:[{type:"text",text:"[]"}],isError:!0}}}getSeverityString(d){switch(d){case s.MarkerSeverity.Error:return"error";case s.MarkerSeverity.Warning:return"warning";case s.MarkerSeverity.Info:return"information";case s.MarkerSeverity.Hint:return"hint";default:return"unknown"}}};t.GetOpenEditorFileDiagnosticsTool=h,n.__decorate([(0,a.Autowired)(v.WorkbenchEditorService),n.__metadata("design:type",v.WorkbenchEditorService)],h.prototype,"editorService",void 0),n.__decorate([(0,a.Autowired)(m.IWorkspaceService),n.__metadata("design:type",Object)],h.prototype,"workspaceService",void 0),n.__decorate([(0,a.Autowired)(s.IMarkerService),n.__metadata("design:type",Object)],h.prototype,"markerService",void 0),t.GetOpenEditorFileDiagnosticsTool=h=n.__decorate([(0,p.Domain)(g.MCPServerContribution)],h)},39855:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GrepSearchTool=void 0;const n=e(85608),r=e(75995),o=e(76003),a=e(43718),p=e(13439),v=e(51495),m=e(51500),_=e(19413),s=e(59347),g=e(77633),l=e(95292),h=r.z.object({query:r.z.string().describe("The regex pattern to search for"),case_sensitive:r.z.boolean().optional().describe("Whether the search should be case sensitive"),include_pattern:r.z.string().optional().describe('Glob pattern for files to include (e.g. "*.ts" for TypeScript files)'),exclude_pattern:r.z.string().optional().describe("Glob pattern for files to exclude"),explanation:r.z.string().optional().describe("One sentence explanation as to why this tool is being used, and how it contributes to the goal.")}).transform(E=>({query:E.query,caseSensitive:E.case_sensitive,includePattern:E.include_pattern,excludePattern:E.exclude_pattern,explanation:E.explanation})),u=50;let d=class{registerMCPServer(f){f.registerMCPTool(this.getToolDefinition()),f.registerToolComponent("grep_search",l.GrepSearchToolComponent)}getToolDefinition(){return{name:"grep_search",label:"Search Contents",order:4,description:`Fast text-based regex search that finds exact pattern matches within files or directories, utilizing the ripgrep command for efficient searching.
31772
31772
  Results will be formatted in the style of ripgrep and can be configured to include line numbers and content.
31773
31773
  To avoid overwhelming output, the results are capped at 50 matches.
31774
31774
  Use the include or exclude patterns to filter the search scope by file type or specific paths.
31775
31775
 
31776
- This is best for finding exact text matches or regex patterns.`,inputSchema:h,handler:this.handler.bind(this)}}async handler(f,c){var y,b;if(!f.query)throw new Error("No ripgrep search parameters provided. Need to give at least a query.");const A=this.workspaceService.tryGetRoots();if(!A||A.length===0)throw new Error("Cannot determine project directory");const S=f.query;await this.searchService.doSearch(S,{isMatchCase:!!f.case_sensitive,include:(y=f.include_pattern)===null||y===void 0?void 0:y.split(","),exclude:(b=f.exclude_pattern)===null||b===void 0?void 0:b.split(","),maxResults:u,isUseRegexp:!0,isToggleOpen:!1,isDetailOpen:!1,isWholeWord:!1,isOnlyOpenEditors:!1,isIncludeIgnored:!1},a.CancellationToken.None);const D=new a.Deferred;return this.searchService.onDidChange(()=>{if(this.searchService.isSearching)return;const w=[],T=[];for(const[P,O]of this.searchService.searchResults.entries())w.push(`File: ${P}
31777
- ${O.reduce((M,k)=>M.find(F=>F.line===k.line)?M:[...M,k],[]).map(M=>`Line: ${M.line}
31778
- Content: ${M.lineText||M.renderLineText}`).join(`
31779
- `)}`),T.push({uri:P,isDirectory:!1});D.resolve(w.join(`
31776
+ This is best for finding exact text matches or regex patterns.`,inputSchema:h,handler:this.handler.bind(this)}}async handler(f,c){var y,b;if(!f.query)throw new Error("No ripgrep search parameters provided. Need to give at least a query.");const A=this.workspaceService.tryGetRoots();if(!A||A.length===0)throw new Error("Cannot determine project directory");const S=f.query;await this.searchService.doSearch(S,{isMatchCase:!!f.caseSensitive,include:(y=f.includePattern)===null||y===void 0?void 0:y.split(","),exclude:(b=f.excludePattern)===null||b===void 0?void 0:b.split(","),maxResults:u,isUseRegexp:!0,isToggleOpen:!1,isDetailOpen:!1,isWholeWord:!1,isOnlyOpenEditors:!1,isIncludeIgnored:!1},a.CancellationToken.None);const D=new a.Deferred;return this.searchService.onDidChange(()=>{var w;if(this.searchService.isSearching)return;const T=[],R=[];for(const[M,k]of this.searchService.searchResults.entries())T.push(`File: ${M}
31777
+ ${k.reduce((F,L)=>F.find(B=>B.line===L.line)?F:[...F,L],[]).map(F=>`Line: ${F.line}
31778
+ Content: ${F.lineText||F.renderLineText}`).join(`
31779
+ `)}`),R.push({uri:M,isDirectory:!1});D.resolve(T.join(`
31780
31780
 
31781
- `));const R=this.chatInternalService.sessionModel.history.getMessages();this.chatInternalService.sessionModel.history.setMessageAdditional(R[R.length-1].id,{[f.toolCallId]:{files:T}})}),{content:[{type:"text",text:await D.promise}]}}};t.GrepSearchTool=d,n.__decorate([(0,o.Autowired)(m.IWorkspaceService),n.__metadata("design:type",Object)],d.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(p.IContentSearchClientService),n.__metadata("design:type",v.ContentSearchClientService)],d.prototype,"searchService",void 0),n.__decorate([(0,o.Autowired)(_.IChatInternalService),n.__metadata("design:type",s.ChatInternalService)],d.prototype,"chatInternalService",void 0),t.GrepSearchTool=d=n.__decorate([(0,a.Domain)(g.MCPServerContribution)],d)},9343:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditFileHandler=void 0;const n=e(85608),r=e(76003),o=e(73974);let a=class{async handler(v,m){const{targetFile:_,codeEdit:s,instructions:g}=v,l=await this.applyService.registerCodeBlock(_,s,m,g);return await this.applyService.apply(l)}};t.EditFileHandler=a,n.__decorate([(0,r.Autowired)(o.BaseApplyService),n.__metadata("design:type",o.BaseApplyService)],a.prototype,"applyService",void 0),t.EditFileHandler=a=n.__decorate([(0,r.Injectable)()],a)},64942:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListDirHandler=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(14951);class p{constructor(_){this.maxConcurrent=_,this.currentCount=0,this.pendingQueue=[]}async execute(_){this.currentCount>=this.maxConcurrent&&await new Promise(s=>this.pendingQueue.push(s)),this.currentCount++;try{return await _()}finally{if(this.currentCount--,this.pendingQueue.length>0){const s=this.pendingQueue.shift();s?.()}}}}let v=class{constructor(){this.MAX_FILE_SIZE=1024*1024,this.MAX_INDEXED_FILES=50}getWorkspaceDir(){return this.appConfig.workspaceDir}async handler(_){var s,g;const{relativeWorkspacePath:l}=_;if(!l)throw new Error("No list dir parameters provided. Need to give at least the path.");const h=`${this.appConfig.workspaceDir}/${l}`,u=await this.fileSystemService.getFileStat(h,!0);if(!u||!u.isDirectory)throw new Error(`Could not find file ${l} in the workspace.`);const d=((s=u.children)===null||s===void 0?void 0:s.filter(y=>!y.isDirectory&&y.size!==void 0&&y.size<=this.MAX_FILE_SIZE).slice(0,this.MAX_INDEXED_FILES))||[],E=new Set(d.map(y=>new o.URI(y.uri).displayName)),f=new p(4);return{files:await Promise.all(((g=u.children)===null||g===void 0?void 0:g.sort((y,b)=>b.lastModification-y.lastModification).map(async y=>{var b;const A=new o.URI(y.uri),S=`${h}/${A.displayName}`;let D;return E.has(A.displayName)&&(D=await f.execute(async()=>this.countFileLines(S))),{name:A.displayName,isDirectory:y.isDirectory,size:y.size,lastModified:y.lastModification,numChildren:(b=y.children)===null||b===void 0?void 0:b.length,numLines:D}}))||[]),directoryRelativeWorkspacePath:l}}async countFileLines(_){return(await this.fileSystemService.readFile(o.URI.file(_).toString())).toString().split(`
31781
+ `));const P=this.chatInternalService.sessionModel.history.getMessages(),O=(w=P[P.length-1])===null||w===void 0?void 0:w.id;O&&this.chatInternalService.sessionModel.history.setMessageAdditional(O,{[f.toolCallId]:{files:R}})}),{content:[{type:"text",text:await D.promise}]}}};t.GrepSearchTool=d,n.__decorate([(0,o.Autowired)(m.IWorkspaceService),n.__metadata("design:type",Object)],d.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(p.IContentSearchClientService),n.__metadata("design:type",v.ContentSearchClientService)],d.prototype,"searchService",void 0),n.__decorate([(0,o.Autowired)(_.IChatInternalService),n.__metadata("design:type",s.ChatInternalService)],d.prototype,"chatInternalService",void 0),t.GrepSearchTool=d=n.__decorate([(0,a.Domain)(g.MCPServerContribution)],d)},9343:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditFileHandler=void 0;const n=e(85608),r=e(76003),o=e(73974);let a=class{async handler(v,m){const{targetFile:_,codeEdit:s,instructions:g}=v,l=await this.applyService.registerCodeBlock(_,s,m,g);return await this.applyService.apply(l)}};t.EditFileHandler=a,n.__decorate([(0,r.Autowired)(o.BaseApplyService),n.__metadata("design:type",o.BaseApplyService)],a.prototype,"applyService",void 0),t.EditFileHandler=a=n.__decorate([(0,r.Injectable)()],a)},64942:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListDirHandler=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(14951);class p{constructor(_){this.maxConcurrent=_,this.currentCount=0,this.pendingQueue=[]}async execute(_){this.currentCount>=this.maxConcurrent&&await new Promise(s=>this.pendingQueue.push(s)),this.currentCount++;try{return await _()}finally{if(this.currentCount--,this.pendingQueue.length>0){const s=this.pendingQueue.shift();s?.()}}}}let v=class{constructor(){this.MAX_FILE_SIZE=1024*1024,this.MAX_INDEXED_FILES=50}getWorkspaceDir(){return this.appConfig.workspaceDir}async handler(_){var s,g;const{relativeWorkspacePath:l}=_;if(!l)throw new Error("No list dir parameters provided. Need to give at least the path.");const h=`${this.appConfig.workspaceDir}/${l}`,u=await this.fileSystemService.getFileStat(h,!0);if(!u||!u.isDirectory)throw new Error(`Could not find file ${l} in the workspace.`);const d=((s=u.children)===null||s===void 0?void 0:s.filter(y=>!y.isDirectory&&y.size!==void 0&&y.size<=this.MAX_FILE_SIZE).slice(0,this.MAX_INDEXED_FILES))||[],E=new Set(d.map(y=>new o.URI(y.uri).displayName)),f=new p(4);return{files:await Promise.all(((g=u.children)===null||g===void 0?void 0:g.sort((y,b)=>b.lastModification-y.lastModification).map(async y=>{var b;const A=new o.URI(y.uri),S=`${h}/${A.displayName}`;let D;return E.has(A.displayName)&&(D=await f.execute(async()=>this.countFileLines(S))),{name:A.displayName,isDirectory:y.isDirectory,size:y.size,lastModified:y.lastModification,numChildren:(b=y.children)===null||b===void 0?void 0:b.length,numLines:D}}))||[]),directoryRelativeWorkspacePath:l}}async countFileLines(_){return(await this.fileSystemService.readFile(o.URI.file(_).toString())).toString().split(`
31782
31782
  `).length}};t.ListDirHandler=v,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],v.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(a.IFileServiceClient),n.__metadata("design:type",Object)],v.prototype,"fileSystemService",void 0),t.ListDirHandler=v=n.__decorate([(0,r.Injectable)()],v)},707:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileHandler=void 0;const r=e(85608),o=e(76003),a=e(79240),p=e(41869),v=e(43718),m=e(57517),_=e(14951);let s=n=class{constructor(){this.fileResultMap=new Map}async findSimilarFiles(l,h){return(await this.fileSearchQuickCommandHandler.getQueryFiles(l,new Set,v.CancellationToken.None)).slice(0,h).map(d=>{var E;return(E=d.getUri())===null||E===void 0?void 0:E.codeUri.fsPath}).filter(Boolean)}createFileNotFoundError(l,h){const u=h.length>0?`Could not find file '${l}'. Did you mean one of:
31783
31783
  ${h.map(d=>`- ${d}`).join(`
31784
31784
  `)}`:`Could not find file '${l}' in the workspace.`;return new Error(JSON.stringify({clientVisibleErrorMessage:u,modelVisibleErrorMessage:u,actualErrorMessage:`File not found: ${l}`}))}createFileTooLargeError(l,h){return new Error(JSON.stringify({clientVisibleErrorMessage:`File is too large, >${l}MB`,modelVisibleErrorMessage:`The file is too large to read, was >${l}MB`,actualErrorMessage:`File is too large to read, was >${l}MB, size: ${h} bytes`}))}trimContent(l,h){return l.slice(0,h).split(n.NEWLINE).slice(0,-1).join(n.NEWLINE)}getLineRange(l,h){var u,d;let E=(u=l.startLineOneIndexed)!==null&&u!==void 0?u:1,f=(d=l.endLineOneIndexedInclusive)!==null&&d!==void 0?d:E+n.MAX_LINES-1,c=!1,y=!1;return h?{start:E,end:f,didShorten:c,didSetDefault:y}:(l.endLineOneIndexedInclusive===void 0||l.startLineOneIndexed===void 0?(E=1,f=n.MAX_LINES,y=!0):l.endLineOneIndexedInclusive-l.startLineOneIndexed>n.MAX_LINES&&(f=l.startLineOneIndexed+n.MAX_LINES,c=!0),{start:E,end:f,didShorten:c,didSetDefault:y})}async readFile(l){if(!l)throw new Error("No read file parameters provided. Need to give at least the path.");const h=new v.URI(`${this.appConfig.workspaceDir}/${l.relativeWorkspacePath}`);if(!h){const f=await this.findSimilarFiles(l.relativeWorkspacePath,3);throw this.createFileNotFoundError(l.relativeWorkspacePath,f)}const u=(n.MAX_FILE_SIZE_BYTES/1e6).toFixed(2),d=await this.fileSystemService.getFileStat(h.toString());if(d?.size&&d.size>n.MAX_FILE_SIZE_BYTES)throw this.createFileTooLargeError(u,d.size);let E;try{E=await this.modelService.createModelReference(h);const f=E.instance.getMonacoModel().getValue(),c=f.split(n.NEWLINE),y=!(l.readEntireFile&&l.fileIsAllowedToBeReadEntirely),b=l.readEntireFile&&!l.fileIsAllowedToBeReadEntirely;let A=!1;if(y){const{start:D,end:I,didShorten:w,didSetDefault:T}=this.getLineRange(l,b),R=Math.max(D,1),P=Math.min(I,c.length);let O=c.slice(R-1,P).join(n.NEWLINE);return O.length>n.MAX_CHARS&&(A=!0,O=this.trimContent(O,n.MAX_CHARS)),w&&this.fileResultMap.set(l.relativeWorkspacePath,{content:O,startLineOneIndexed:R,endLineOneIndexedInclusive:P}),{contents:O,didDowngradeToLineRange:b,didShortenLineRange:w,didShortenCharRange:A,didSetDefaultLineRange:T,fullFileContents:f,startLineOneIndexed:R,endLineOneIndexedInclusive:P,relativeWorkspacePath:l.relativeWorkspacePath}}let S=f;return S.length>n.MAX_CHARS&&(A=!0,S=this.trimContent(S,n.MAX_CHARS)),{contents:S,fullFileContents:f,didDowngradeToLineRange:!1,didShortenCharRange:A}}finally{E?.dispose()}}getFileReadResult(l){return this.fileResultMap.get(l)}};t.FileHandler=s,s.MAX_FILE_SIZE_BYTES=2e6,s.MAX_LINES=250,s.MAX_CHARS=1e5,s.NEWLINE=`
31785
- `,r.__decorate([(0,o.Autowired)(m.IEditorDocumentModelService),r.__metadata("design:type",Object)],s.prototype,"modelService",void 0),r.__decorate([(0,o.Autowired)(a.FileSearchQuickCommandHandler),r.__metadata("design:type",a.FileSearchQuickCommandHandler)],s.prototype,"fileSearchQuickCommandHandler",void 0),r.__decorate([(0,o.Autowired)(p.AppConfig),r.__metadata("design:type",Object)],s.prototype,"appConfig",void 0),r.__decorate([(0,o.Autowired)(_.IFileServiceClient),r.__metadata("design:type",Object)],s.prototype,"fileSystemService",void 0),t.FileHandler=s=n=r.__decorate([(0,o.Injectable)()],s)},22559:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RunCommandHandler=t.inputSchema=void 0;const n=e(85608),r=n.__importDefault(e(75995)),o=e(76003),a=e(41869),p=e(6487),v=e(69448),m=e(83854),_={italic:"\x1B[3m",reset:"\x1B[0m"};t.inputSchema=r.default.object({command:r.default.string().describe("The terminal command to execute"),is_background:r.default.boolean().describe("Whether the command should be run in the background"),explanation:r.default.string().describe("One sentence explanation as to why this command needs to be run and how it contributes to the goal."),require_user_approval:r.default.boolean().describe("Whether the user must approve the command before it is executed. Only set this to false if the command is safe and if it matches the user's requirements for commands that should be executed automatically.")});let s=class{constructor(){this.approvalDeferredMap=new Map,this.terminalId=0}getShellLaunchConfig(l){return{name:`MCP:Terminal_${this.terminalId++}`,cwd:this.appConfig.workspaceDir,args:["-c",l]}}isAlwaysApproval(l){const h=this.preferenceService.get(a.AINativeSettingSectionsId.TerminalAutoRun);return!!(h===m.ETerminalAutoExecutionPolicy.off||h===m.ETerminalAutoExecutionPolicy.auto&&l)}async handler(l,h){if(h.appendLine(`Executing command: ${l.command}`),this.isAlwaysApproval(l.require_user_approval)){const f=new v.Deferred;if(this.approvalDeferredMap.set(l.toolCallId,f),!await f.promise)return{isError:!1,content:[{type:"text",text:"User rejection"}]}}const u=await this.terminalController.createTerminalWithWidget({config:this.getShellLaunchConfig(l.command),closeWhenExited:!1});this.terminalController.showTerminalPanel();const d=[],E=new v.Deferred;return l.is_background&&E.resolve({isError:!1,content:[{type:"text",text:`Successful run command ${l.command} in background.`}]}),u.onOutput(f=>{d.push({type:"text",text:f.data.toString()})}),u.onExit(f=>{const c=f.code!==0;E.resolve({isError:c,content:d}),h.appendLine(`Command ${l.command} finished with exit code: ${f.code}`),u.term.writeln(`
31785
+ `,r.__decorate([(0,o.Autowired)(m.IEditorDocumentModelService),r.__metadata("design:type",Object)],s.prototype,"modelService",void 0),r.__decorate([(0,o.Autowired)(a.FileSearchQuickCommandHandler),r.__metadata("design:type",a.FileSearchQuickCommandHandler)],s.prototype,"fileSearchQuickCommandHandler",void 0),r.__decorate([(0,o.Autowired)(p.AppConfig),r.__metadata("design:type",Object)],s.prototype,"appConfig",void 0),r.__decorate([(0,o.Autowired)(_.IFileServiceClient),r.__metadata("design:type",Object)],s.prototype,"fileSystemService",void 0),t.FileHandler=s=n=r.__decorate([(0,o.Injectable)()],s)},22559:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RunCommandHandler=t.inputSchema=void 0;const n=e(85608),r=n.__importDefault(e(75995)),o=e(76003),a=e(41869),p=e(6487),v=e(69448),m=e(83854),_={italic:"\x1B[3m",reset:"\x1B[0m"};t.inputSchema=r.default.object({command:r.default.string().describe("The terminal command to execute"),is_background:r.default.boolean().describe("Whether the command should be run in the background"),explanation:r.default.string().describe("One sentence explanation as to why this command needs to be run and how it contributes to the goal."),require_user_approval:r.default.boolean().describe("Whether the user must approve the command before it is executed. Only set this to false if the command is safe and if it matches the user's requirements for commands that should be executed automatically.")}).transform(g=>({command:g.command,isBackground:g.is_background,explanation:g.explanation,requireUserApproval:g.require_user_approval}));let s=class{constructor(){this.approvalDeferredMap=new Map,this.terminalId=0}getShellLaunchConfig(l){return{name:`MCP:Terminal_${this.terminalId++}`,cwd:this.appConfig.workspaceDir,args:["-c",l]}}isAlwaysApproval(l){const h=this.preferenceService.get(a.AINativeSettingSectionsId.TerminalAutoRun);return!!(h===m.ETerminalAutoExecutionPolicy.off||h===m.ETerminalAutoExecutionPolicy.auto&&l)}async handler(l,h){if(h.appendLine(`Executing command: ${l.command}`),this.isAlwaysApproval(l.requireUserApproval)){const f=new v.Deferred;if(this.approvalDeferredMap.set(l.toolCallId,f),!await f.promise)return{isError:!1,content:[{type:"text",text:"User rejection"}]}}const u=await this.terminalController.createTerminalWithWidget({config:this.getShellLaunchConfig(l.command),closeWhenExited:!1});this.terminalController.showTerminalPanel();const d=[],E=new v.Deferred;return l.isBackground&&E.resolve({isError:!1,content:[{type:"text",text:`Successful run command ${l.command} in background.`}]}),u.onOutput(f=>{d.push({type:"text",text:f.data.toString()})}),u.onExit(f=>{const c=f.code!==0;E.resolve({isError:c,content:d}),h.appendLine(`Command ${l.command} finished with exit code: ${f.code}`),u.term.writeln(`
31786
31786
  ${_.italic}> Command ${l.command} executed successfully. Terminal will close in ${3e3/1e3} seconds.${_.reset}
31787
- `),setTimeout(()=>{u.dispose(),this.terminalView.removeWidget(u.id)},3e3)}),E.promise}handleApproval(l,h){if(!this.approvalDeferredMap.has(l))return;const u=this.approvalDeferredMap.get(l);u?.resolve(h)}};t.RunCommandHandler=s,n.__decorate([(0,o.Autowired)(p.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,o.Autowired)(a.AppConfig),n.__metadata("design:type",Object)],s.prototype,"appConfig",void 0),n.__decorate([(0,o.Autowired)(p.ITerminalGroupViewService),n.__metadata("design:type",Object)],s.prototype,"terminalView",void 0),n.__decorate([(0,o.Autowired)(a.PreferenceService),n.__metadata("design:type",Object)],s.prototype,"preferenceService",void 0),t.RunCommandHandler=s=n.__decorate([(0,o.Injectable)()],s)},82248:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListDirTool=void 0;const n=e(85608),r=e(75995),o=e(76003),a=e(43718),p=e(19413),v=e(59347),m=e(77633),_=e(95292),s=e(64942),g=r.z.object({relative_workspace_path:r.z.string().describe("Path to list contents of, relative to the workspace root. Ex: './' is the root of the workspace"),explanation:r.z.string().optional().describe("One sentence explanation as to why this tool is being used, and how it contributes to the goal.")}).transform(h=>({relativeWorkspacePath:h.relative_workspace_path}));let l=class{registerMCPServer(u){u.registerMCPTool(this.getToolDefinition()),u.registerToolComponent("list_dir",_.ListDirToolComponent)}getToolDefinition(){return{name:"list_dir",label:"List Directory",order:3,description:"List the contents of a directory. The quick tool to use for discovery, before using more targeted tools like semantic search or file reading. Useful to try to understand the file structure before diving deeper into specific files. Can be used to explore the codebase.",inputSchema:g,handler:this.handler.bind(this)}}async handler(u,d){const E=await this.listDirHandler.handler(u),f=E.files.map(y=>({uri:`${this.listDirHandler.getWorkspaceDir()}/${E.directoryRelativeWorkspacePath}/${y.name}`,isDirectory:y.isDirectory})),c=this.chatInternalService.sessionModel.history.getMessages();return this.chatInternalService.sessionModel.history.setMessageAdditional(c[c.length-1].id,{[u.toolCallId]:{files:f,title:`Listed directory "${u.relativeWorkspacePath}"`,details:E.files.map(y=>{var b;return{type:y.isDirectory?"dir":"file",name:y.name,info:y.isDirectory?`${(b=y.numChildren)!==null&&b!==void 0?b:"?"} items`:`${y.size}KB, ${y.numLines} lines`,lastModified:y.lastModified}})}}),d.appendLine(`Listed ${f.length} files in directory "${u.relativeWorkspacePath}"`),{content:[{type:"text",text:`Contents of directory "${u.relativeWorkspacePath}":
31788
- ${E.files.map(y=>{var b;return`[${y.isDirectory?"dir":"file"}] ${y.name} ${y.isDirectory?`(${(b=y.numChildren)!==null&&b!==void 0?b:"?"} items)`:`(${y.size}KB, ${y.numLines} lines)`} - ${new Date(y.lastModified).toLocaleString()}`}).join(`
31787
+ `),setTimeout(()=>{u.dispose(),this.terminalView.removeWidget(u.id)},3e3)}),E.promise}handleApproval(l,h){if(!this.approvalDeferredMap.has(l))return;const u=this.approvalDeferredMap.get(l);u?.resolve(h)}};t.RunCommandHandler=s,n.__decorate([(0,o.Autowired)(p.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,o.Autowired)(a.AppConfig),n.__metadata("design:type",Object)],s.prototype,"appConfig",void 0),n.__decorate([(0,o.Autowired)(p.ITerminalGroupViewService),n.__metadata("design:type",Object)],s.prototype,"terminalView",void 0),n.__decorate([(0,o.Autowired)(a.PreferenceService),n.__metadata("design:type",Object)],s.prototype,"preferenceService",void 0),t.RunCommandHandler=s=n.__decorate([(0,o.Injectable)()],s)},82248:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListDirTool=void 0;const n=e(85608),r=e(75995),o=e(76003),a=e(43718),p=e(19413),v=e(59347),m=e(77633),_=e(95292),s=e(64942),g=r.z.object({relative_workspace_path:r.z.string().describe("Path to list contents of, relative to the workspace root. Ex: './' is the root of the workspace"),explanation:r.z.string().optional().describe("One sentence explanation as to why this tool is being used, and how it contributes to the goal.")}).transform(h=>({relativeWorkspacePath:h.relative_workspace_path}));let l=class{registerMCPServer(u){u.registerMCPTool(this.getToolDefinition()),u.registerToolComponent("list_dir",_.ListDirToolComponent)}getToolDefinition(){return{name:"list_dir",label:"List Directory",order:3,description:"List the contents of a directory. The quick tool to use for discovery, before using more targeted tools like semantic search or file reading. Useful to try to understand the file structure before diving deeper into specific files. Can be used to explore the codebase.",inputSchema:g,handler:this.handler.bind(this)}}async handler(u,d){var E;const f=await this.listDirHandler.handler(u),c=f.files.map(A=>({uri:`${this.listDirHandler.getWorkspaceDir()}/${f.directoryRelativeWorkspacePath}/${A.name}`,isDirectory:A.isDirectory})),y=this.chatInternalService.sessionModel.history.getMessages(),b=(E=y[y.length-1])===null||E===void 0?void 0:E.id;return b&&this.chatInternalService.sessionModel.history.setMessageAdditional(b,{[u.toolCallId]:{files:c,title:`Listed directory "${u.relativeWorkspacePath}"`,details:f.files.map(A=>{var S;return{type:A.isDirectory?"dir":"file",name:A.name,info:A.isDirectory?`${(S=A.numChildren)!==null&&S!==void 0?S:"?"} items`:`${A.size}KB, ${A.numLines} lines`,lastModified:A.lastModified}})}}),d.appendLine(`Listed ${c.length} files in directory "${u.relativeWorkspacePath}"`),{content:[{type:"text",text:`Contents of directory "${u.relativeWorkspacePath}":
31788
+ ${f.files.map(A=>{var S;return`[${A.isDirectory?"dir":"file"}] ${A.name} ${A.isDirectory?`(${(S=A.numChildren)!==null&&S!==void 0?S:"?"} items)`:`(${A.size}KB, ${A.numLines} lines)`} - ${new Date(A.lastModified).toLocaleString()}`}).join(`
31789
31789
  `)}`}]}}};t.ListDirTool=l,n.__decorate([(0,o.Autowired)(s.ListDirHandler),n.__metadata("design:type",s.ListDirHandler)],l.prototype,"listDirHandler",void 0),n.__decorate([(0,o.Autowired)(p.IChatInternalService),n.__metadata("design:type",v.ChatInternalService)],l.prototype,"chatInternalService",void 0),t.ListDirTool=l=n.__decorate([(0,a.Domain)(m.MCPServerContribution)],l)},36977:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReadFileTool=void 0;const n=e(85608),r=e(75995),o=e(76003),a=e(43718),p=e(77633),v=e(707),m=r.z.object({relative_workspace_path:r.z.string().describe("The path of the file to read, relative to the workspace root."),should_read_entire_file:r.z.boolean().describe("Whether to read the entire file. Defaults to false."),start_line_one_indexed:r.z.number().describe("The one-indexed line number to start reading from (inclusive)."),end_line_one_indexed_inclusive:r.z.number().describe("The one-indexed line number to end reading at (inclusive)."),explanation:r.z.string().optional().describe("One sentence explanation as to why this tool is being used, and how it contributes to the goal.")}).transform(s=>({relativeWorkspacePath:s.relative_workspace_path,readEntireFile:s.should_read_entire_file,startLineOneIndexed:s.start_line_one_indexed,endLineOneIndexedInclusive:s.end_line_one_indexed_inclusive}));let _=class{registerMCPServer(g){g.registerMCPTool(this.getToolDefinition())}getToolDefinition(){return{name:"read_file",label:"Read File",order:1,description:`Read the contents of a file (and the outline).
31790
31790
 
31791
31791
  When using this tool to gather information, it's your responsibility to ensure you have the COMPLETE context. Each time you call this command you should: