@opensumi/cli-engine 3.9.1-next-1747733557.0 → 3.9.1-next-1747791726.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/browser.js +9 -9
- package/package.json +10 -10
package/lib/browser/browser.js
CHANGED
|
@@ -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(57517),p=e(19413),v=e(73974),m=e(51081);let _=class extends v.BaseApplyService{postApplyHandler(g){return Promise.resolve()}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.
|
|
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.
|
|
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>${
|
|
31595
|
+
<code>${c}</code>
|
|
31596
31596
|
|
|
31597
|
-
<update>${
|
|
31598
|
-
${
|
|
31599
|
-
User's intention: ${
|
|
31597
|
+
<update>${d.codeEdit}</update>
|
|
31598
|
+
${d.instructions?`
|
|
31599
|
+
User's intention: ${d.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=_,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(`
|
|
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(`
|
|
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,10 +31721,10 @@ ${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){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);if(c.updatedCode=A.updatedCode,c.status="pending",c.applyResult=A.result,this.updateCodeBlock(c),this.postApplyHandler&&typeof this.postApplyHandler=="function")try{await this.postApplyHandler(b.group.codeEditor.monacoEditor)}catch{}return 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(
|
|
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(`
|
|
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,
|
|
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(`
|
|
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(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/cli-engine",
|
|
3
|
-
"version": "3.9.1-next-
|
|
3
|
+
"version": "3.9.1-next-1747791726.0",
|
|
4
4
|
"description": "Integration engine runtime for opensumi-cli and opensumi extension",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@koa/cors": "^5.0.0",
|
|
28
28
|
"@opensumi/di": "^1.8.0",
|
|
29
|
-
"@opensumi/ide-core-browser": "3.9.1-next-
|
|
30
|
-
"@opensumi/ide-core-common": "3.9.1-next-
|
|
31
|
-
"@opensumi/ide-core-node": "3.9.1-next-
|
|
32
|
-
"@opensumi/ide-express-file-server": "3.9.1-next-
|
|
33
|
-
"@opensumi/ide-extension": "3.9.1-next-
|
|
34
|
-
"@opensumi/ide-i18n": "3.9.1-next-
|
|
35
|
-
"@opensumi/ide-main-layout": "3.9.1-next-
|
|
36
|
-
"@opensumi/ide-startup": "3.9.1-next-
|
|
29
|
+
"@opensumi/ide-core-browser": "3.9.1-next-1747791726.0",
|
|
30
|
+
"@opensumi/ide-core-common": "3.9.1-next-1747791726.0",
|
|
31
|
+
"@opensumi/ide-core-node": "3.9.1-next-1747791726.0",
|
|
32
|
+
"@opensumi/ide-express-file-server": "3.9.1-next-1747791726.0",
|
|
33
|
+
"@opensumi/ide-extension": "3.9.1-next-1747791726.0",
|
|
34
|
+
"@opensumi/ide-i18n": "3.9.1-next-1747791726.0",
|
|
35
|
+
"@opensumi/ide-main-layout": "3.9.1-next-1747791726.0",
|
|
36
|
+
"@opensumi/ide-startup": "3.9.1-next-1747791726.0",
|
|
37
37
|
"chalk": "^4.1.2",
|
|
38
38
|
"ejs": "^3.1.7",
|
|
39
39
|
"ip": "^1.1.8",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"webpack": "^5.90.0",
|
|
73
73
|
"webpack-cli": "^5.1.4"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "8f0f4598a7fb17dcb5546928a4da0a1c45363e14"
|
|
76
76
|
}
|