@opensumi/cli-engine 3.8.3-next-1745835843.0 → 3.8.3-next-1745893346.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.
@@ -31401,7 +31401,7 @@ and limitations under the License.
31401
31401
  `)[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),d=C._ts_query_capture_count(r),_=C._ts_query_pattern_count(r),v=new Array(d),m=new Array(o);for(let u=0;u<d;u++){const l=C._ts_query_capture_name_for_id(r,u,TRANSFER_BUFFER),E=getValue(TRANSFER_BUFFER,"i32");v[u]=UTF8ToString(l,E)}for(let u=0;u<o;u++){const l=C._ts_query_string_value_for_id(r,u,TRANSFER_BUFFER),E=getValue(TRANSFER_BUFFER,"i32");m[u]=UTF8ToString(l,E)}const p=new Array(_),s=new Array(_),g=new Array(_),a=new Array(_),h=new Array(_);for(let u=0;u<_;u++){const l=C._ts_query_predicates_for_pattern(r,u,TRANSFER_BUFFER),E=getValue(TRANSFER_BUFFER,"i32");a[u]=[],h[u]=[];const f=[];let c=l;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 w,T=!0,D=!0;switch(S){case"any-not-eq?":case"not-eq?":T=!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(D=!S.startsWith("any-"),f[2].type==="capture"){const R=f[1].name,P=f[2].name;h[u].push(k=>{const F=[],L=[];for(const j of k)j.name===R&&F.push(j.node),j.name===P&&L.push(j.node);const B=(j,W,U)=>U?j.text===W.text:j.text!==W.text;return D?F.every(j=>L.some(W=>B(j,W,T))):F.some(j=>L.some(W=>B(j,W,T)))})}else{w=f[1].name;const R=f[2].value,P=F=>F.text===R,k=F=>F.text!==R;h[u].push(F=>{const L=[];for(const j of F)j.name===w&&L.push(j.node);const B=T?P:k;return D?L.every(B):L.some(B)})}break;case"any-not-match?":case"not-match?":T=!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}.`);w=f[1].name;const I=new RegExp(f[2].value);D=!S.startsWith("any-"),h[u].push(R=>{const P=[];for(const F of R)F.name===w&&P.push(F.node.text);const k=(F,L)=>L?I.test(F):!I.test(F);return P.length===0?!T:D?P.every(F=>k(F,T)):P.some(F=>k(F,T))});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(R=>R.type!=="string"))throw new Error('Arguments to `#set!` predicate must be a strings.".');p[u]||(p[u]={}),p[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(R=>R.type!=="string"))throw new Error(`Arguments to \`#${S}\` predicate must be a strings.".`);const O=S==="is?"?s:g;O[u]||(O[u]={}),O[u][f[1].value]=f[2]?f[2].value:null;break;case"not-any-of?":T=!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 R=2;R<f.length;R++)if(f[R].type!=="string")throw new Error(`Arguments to \`#${S}\` predicate must be a strings.".`);w=f[1].name;const M=f.slice(2).map(R=>R.value);h[u].push(R=>{const P=[];for(const k of R)k.name===w&&P.push(k.node.text);return P.length===0?!T:P.every(k=>M.includes(k))===T});break;default:a[u].push({operator:S,operands:f.slice(1)})}f.length=0}}Object.freeze(p[u]),Object.freeze(s[u]),Object.freeze(g[u])}return C._free(n),new Query(INTERNAL,r,v,h,a,Object.freeze(p),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 d=new TextDecoder("utf-8").decode(o);throw new Error(`Language.load failed with status ${r.status}.
31402
31402
 
31403
31403
  ${d}`)}}))}return e.then(n=>loadWebAssemblyModule(n,{loadAsync:!0})).then(n=>{const r=Object.keys(n),o=r.find(_=>LANGUAGE_FUNCTION_REGEX.test(_)&&!_.includes("external_scanner_"));o||console.log(`Couldn't find language function in WASM file. Symbols:
31404
- ${JSON.stringify(r,null,2)}`);const d=n[o]();return new Language(INTERNAL,d)})}}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,d,_,v){assertInternal(t),this[0]=e,this.captureNames=n,this.textPredicates=r,this.predicates=o,this.setProperties=d,this.assertedProperties=_,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:d=4294967295,maxStartDepth:_=4294967295}={}){if(typeof d!="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,d,_);const v=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),p=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),s=new Array(v);this.exceededMatchLimit=!!p;let g=0,a=m;for(let h=0;h<v;h++){const u=getValue(a,"i32");a+=SIZE_OF_INT;const l=getValue(a,"i32");a+=SIZE_OF_INT;const E=new Array(l);if(a=unmarshalCaptures(this,t.tree,a,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:d=4294967295,maxStartDepth:_=4294967295}={}){if(typeof d!="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,d,_);const v=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),p=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),s=[];this.exceededMatchLimit=!!p;const g=[];let a=m;for(let h=0;h<v;h++){const u=getValue(a,"i32");a+=SIZE_OF_INT;const l=getValue(a,"i32");a+=SIZE_OF_INT;const E=getValue(a,"i32");if(a+=SIZE_OF_INT,g.length=l,a=unmarshalCaptures(this,t.tree,a,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 d=getValue(e,"i32"),_=unmarshalNode(t,e+=SIZE_OF_INT);e+=SIZE_OF_NODE,n[r]={name:x.captureNames[d],node:_}}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"),d=getValue(t+=SIZE_OF_INT,"i32"),_=new Node(INTERNAL,x);return _.id=e,_.startIndex=n,_.startPosition={row:r,column:o},_[0]=d,_}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),d=e(79818),_=e(69336),v=d("Object.prototype.toString"),m=e(51913)(),p=typeof globalThis>"u"?e.g:globalThis,s=r(),g=d("String.prototype.slice"),a=Object.getPrototypeOf,h=d("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&&_&&a?n(s,function(f){var c=new p[f];if(Symbol.toStringTag in c){var y=a(c),b=_(y,Symbol.toStringTag);if(!b){var A=a(y);b=_(A,Symbol.toStringTag)}u["$"+f]=o(b.get)}}):n(s,function(f){var c=new p[f],y=c.slice||c.set;y&&(u["$"+f]=o(y))});var l=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 _?l(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=d=>JSON.stringify(d,null,2).replace(/"([^"]+)":/g,"$1:");t.quotelessJson=r;class o extends Error{get errors(){return this.issues}constructor(_){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=_}format(_){const v=_||function(s){return s.message},m={_errors:[]},p=s=>{for(const g of s.issues)if(g.code==="invalid_union")g.unionErrors.map(p);else if(g.code==="invalid_return_type")p(g.returnTypeError);else if(g.code==="invalid_arguments")p(g.argumentsError);else if(g.path.length===0)m._errors.push(v(g));else{let a=m,h=0;for(;h<g.path.length;){const u=g.path[h];h===g.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(v(g))):a[u]=a[u]||{_errors:[]},a=a[u],h++}}};return p(this),m}static assert(_){if(!(_ instanceof o))throw new Error(`Not a ZodError: ${_}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,n.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(_=v=>v.message){const v={},m=[];for(const p of this.issues)p.path.length>0?(v[p.path[0]]=v[p.path[0]]||[],v[p.path[0]].push(_(p))):m.push(_(p));return{formErrors:m,fieldErrors:v}}get formErrors(){return this.flatten()}}t.ZodError=o,o.create=d=>new o(d)},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 d(v){o=v}t.setErrorMap=d;function _(){return o}t.getErrorMap=_},86340:function(x,t,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(o,d,_,v){v===void 0&&(v=_);var m=Object.getOwnPropertyDescriptor(d,_);(!m||("get"in m?!d.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return d[_]}}),Object.defineProperty(o,v,m)}:function(o,d,_,v){v===void 0&&(v=_),o[v]=d[_]}),r=this&&this.__exportStar||function(o,d){for(var _ in o)_!=="default"&&!Object.prototype.hasOwnProperty.call(d,_)&&n(d,o,_)};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)),d=u=>{const{data:l,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(w=>!!w).slice().reverse();for(const w of S)A=w(b,{data:l,defaultError:A}).message;return{...c,path:y,message:A}};t.makeIssue=d,t.EMPTY_PATH=[];function _(u,l){const E=(0,r.getErrorMap)(),f=(0,t.makeIssue)({issueData:l,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=_;class v{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(l,E){const f=[];for(const c of E){if(c.status==="aborted")return t.INVALID;c.status==="dirty"&&l.dirty(),f.push(c.value)}return{status:l.value,value:f}}static async mergeObjectAsync(l,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(l,f)}static mergeObjectSync(l,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"&&l.dirty(),b.status==="dirty"&&l.dirty(),y.value!=="__proto__"&&(typeof b.value<"u"||c.alwaysSet)&&(f[y.value]=b.value)}return{status:l.value,value:f}}}t.ParseStatus=v,t.INVALID=Object.freeze({status:"aborted"});const m=u=>({status:"dirty",value:u});t.DIRTY=m;const p=u=>({status:"valid",value:u});t.OK=p;const s=u=>u.status==="aborted";t.isAborted=s;const g=u=>u.status==="dirty";t.isDirty=g;const a=u=>u.status==="valid";t.isValid=a;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 d(m){}o.assertIs=d;function _(m){throw new Error}o.assertNever=_,o.arrayToEnum=m=>{const p={};for(const s of m)p[s]=s;return p},o.getValidEnumValues=m=>{const p=o.objectKeys(m).filter(g=>typeof m[m[g]]!="number"),s={};for(const g of p)s[g]=m[g];return o.objectValues(s)},o.objectValues=m=>o.objectKeys(m).map(function(p){return m[p]}),o.objectKeys=typeof Object.keys=="function"?m=>Object.keys(m):m=>{const p=[];for(const s in m)Object.prototype.hasOwnProperty.call(m,s)&&p.push(s);return p},o.find=(m,p)=>{for(const s of m)if(p(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,p=" | "){return m.map(s=>typeof s=="string"?`'${s}'`:s).join(p)}o.joinValues=v,o.jsonStringifyReplacer=(m,p)=>typeof p=="bigint"?p.toString():p})(e||(t.util=e={}));var n;(function(o){o.mergeShapes=(d,_)=>({...d,..._})})(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,p,s){s===void 0&&(s=p);var g=Object.getOwnPropertyDescriptor(m,p);(!g||("get"in g?!m.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return m[p]}}),Object.defineProperty(v,s,g)}:function(v,m,p,s){s===void 0&&(s=p),v[s]=m[p]}),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 p in v)p!=="default"&&Object.prototype.hasOwnProperty.call(v,p)&&n(m,v,p);return r(m,v),m},d=this&&this.__exportStar||function(v,m){for(var p in v)p!=="default"&&!Object.prototype.hasOwnProperty.call(m,p)&&n(m,v,p)};Object.defineProperty(t,"__esModule",{value:!0}),t.z=void 0;const _=o(e(86340));t.z=_,d(e(86340),t),t.default=_},28412:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(94705),r=e(97442),o=(d,_)=>{let v;switch(d.code){case r.ZodIssueCode.invalid_type:d.received===n.ZodParsedType.undefined?v="Required":v=`Expected ${d.expected}, received ${d.received}`;break;case r.ZodIssueCode.invalid_literal:v=`Invalid literal value, expected ${JSON.stringify(d.expected,n.util.jsonStringifyReplacer)}`;break;case r.ZodIssueCode.unrecognized_keys:v=`Unrecognized key(s) in object: ${n.util.joinValues(d.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(d.options)}`;break;case r.ZodIssueCode.invalid_enum_value:v=`Invalid enum value. Expected ${n.util.joinValues(d.options)}, received '${d.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 d.validation=="object"?"includes"in d.validation?(v=`Invalid input: must include "${d.validation.includes}"`,typeof d.validation.position=="number"&&(v=`${v} at one or more positions greater than or equal to ${d.validation.position}`)):"startsWith"in d.validation?v=`Invalid input: must start with "${d.validation.startsWith}"`:"endsWith"in d.validation?v=`Invalid input: must end with "${d.validation.endsWith}"`:n.util.assertNever(d.validation):d.validation!=="regex"?v=`Invalid ${d.validation}`:v="Invalid";break;case r.ZodIssueCode.too_small:d.type==="array"?v=`Array must contain ${d.exact?"exactly":d.inclusive?"at least":"more than"} ${d.minimum} element(s)`:d.type==="string"?v=`String must contain ${d.exact?"exactly":d.inclusive?"at least":"over"} ${d.minimum} character(s)`:d.type==="number"?v=`Number must be ${d.exact?"exactly equal to ":d.inclusive?"greater than or equal to ":"greater than "}${d.minimum}`:d.type==="date"?v=`Date must be ${d.exact?"exactly equal to ":d.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(d.minimum))}`:v="Invalid input";break;case r.ZodIssueCode.too_big:d.type==="array"?v=`Array must contain ${d.exact?"exactly":d.inclusive?"at most":"less than"} ${d.maximum} element(s)`:d.type==="string"?v=`String must contain ${d.exact?"exactly":d.inclusive?"at most":"under"} ${d.maximum} character(s)`:d.type==="number"?v=`Number must be ${d.exact?"exactly":d.inclusive?"less than or equal to":"less than"} ${d.maximum}`:d.type==="bigint"?v=`BigInt must be ${d.exact?"exactly":d.inclusive?"less than or equal to":"less than"} ${d.maximum}`:d.type==="date"?v=`Date must be ${d.exact?"exactly":d.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(d.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 ${d.multipleOf}`;break;case r.ZodIssueCode.not_finite:v="Number must be finite";break;default:v=_.defaultError,n.util.assertNever(d)}return{message:v}};t.default=o},75226:function(x,t,e){"use strict";var n=this&&this.__classPrivateFieldGet||function(nn,nt,jt,qt){if(jt==="a"&&!qt)throw new TypeError("Private accessor was defined without a getter");if(typeof nt=="function"?nn!==nt||!qt:!nt.has(nn))throw new TypeError("Cannot read private member from an object whose class did not declare it");return jt==="m"?qt:jt==="a"?qt.call(nn):qt?qt.value:nt.get(nn)},r=this&&this.__classPrivateFieldSet||function(nn,nt,jt,qt,In){if(qt==="m")throw new TypeError("Private method is not writable");if(qt==="a"&&!In)throw new TypeError("Private accessor was defined without a setter");if(typeof nt=="function"?nn!==nt||!In:!nt.has(nn))throw new TypeError("Cannot write private member to an object whose class did not declare it");return qt==="a"?In.call(nn,jt):In?In.value=jt:nt.set(nn,jt),jt},o,d;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 _=e(30548),v=e(15759),m=e(66258),p=e(94705),s=e(97442);class g{constructor(nt,jt,qt,In){this._cachedPath=[],this.parent=nt,this.data=jt,this._path=qt,this._key=In}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 a=(nn,nt)=>{if((0,m.isValid)(nt))return{success:!0,data:nt.value};if(!nn.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const jt=new s.ZodError(nn.common.issues);return this._error=jt,this._error}}};function h(nn){if(!nn)return{};const{errorMap:nt,invalid_type_error:jt,required_error:qt,description:In}=nn;if(nt&&(jt||qt))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return nt?{errorMap:nt,description:In}:{errorMap:(Bi,Mi)=>{var Xi,yi;const{message:Zi}=nn;return Bi.code==="invalid_enum_value"?{message:Zi??Mi.defaultError}:typeof Mi.data>"u"?{message:(Xi=Zi??qt)!==null&&Xi!==void 0?Xi:Mi.defaultError}:Bi.code!=="invalid_type"?{message:Mi.defaultError}:{message:(yi=Zi??jt)!==null&&yi!==void 0?yi:Mi.defaultError}},description:In}}class u{get description(){return this._def.description}_getType(nt){return(0,p.getParsedType)(nt.data)}_getOrReturnCtx(nt,jt){return jt||{common:nt.parent.common,data:nt.data,parsedType:(0,p.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,p.getParsedType)(nt.data),schemaErrorMap:this._def.errorMap,path:nt.path,parent:nt.parent}}}_parseSync(nt){const jt=this._parse(nt);if((0,m.isAsync)(jt))throw new Error("Synchronous parse encountered promise.");return jt}_parseAsync(nt){const jt=this._parse(nt);return Promise.resolve(jt)}parse(nt,jt){const qt=this.safeParse(nt,jt);if(qt.success)return qt.data;throw qt.error}safeParse(nt,jt){var qt;const In={common:{issues:[],async:(qt=jt?.async)!==null&&qt!==void 0?qt:!1,contextualErrorMap:jt?.errorMap},path:jt?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:nt,parsedType:(0,p.getParsedType)(nt)},jn=this._parseSync({data:nt,path:In.path,parent:In});return a(In,jn)}"~validate"(nt){var jt,qt;const In={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:nt,parsedType:(0,p.getParsedType)(nt)};if(!this["~standard"].async)try{const jn=this._parseSync({data:nt,path:[],parent:In});return(0,m.isValid)(jn)?{value:jn.value}:{issues:In.common.issues}}catch(jn){!((qt=(jt=jn?.message)===null||jt===void 0?void 0:jt.toLowerCase())===null||qt===void 0)&&qt.includes("encountered")&&(this["~standard"].async=!0),In.common={issues:[],async:!0}}return this._parseAsync({data:nt,path:[],parent:In}).then(jn=>(0,m.isValid)(jn)?{value:jn.value}:{issues:In.common.issues})}async parseAsync(nt,jt){const qt=await this.safeParseAsync(nt,jt);if(qt.success)return qt.data;throw qt.error}async safeParseAsync(nt,jt){const qt={common:{issues:[],contextualErrorMap:jt?.errorMap,async:!0},path:jt?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:nt,parsedType:(0,p.getParsedType)(nt)},In=this._parse({data:nt,path:qt.path,parent:qt}),jn=await((0,m.isAsync)(In)?In:Promise.resolve(In));return a(qt,jn)}refine(nt,jt){const qt=In=>typeof jt=="string"||typeof jt>"u"?{message:jt}:typeof jt=="function"?jt(In):jt;return this._refinement((In,jn)=>{const Bi=nt(In),Mi=()=>jn.addIssue({code:s.ZodIssueCode.custom,...qt(In)});return typeof Promise<"u"&&Bi instanceof Promise?Bi.then(Xi=>Xi?!0:(Mi(),!1)):Bi?!0:(Mi(),!1)})}refinement(nt,jt){return this._refinement((qt,In)=>nt(qt)?!0:(In.addIssue(typeof jt=="function"?jt(qt,In):jt),!1))}_refinement(nt){return new Ge({schema:this,typeName:bt.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:jt=>this["~validate"](jt)}}optional(){return je.create(this,this._def)}nullable(){return gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Se.create(this)}promise(){return Fe.create(this,this._def)}or(nt){return ue.create([this,nt],this._def)}and(nt){return Ae.create(this,nt,this._def)}transform(nt){return new Ge({...h(this._def),schema:this,typeName:bt.ZodEffects,effect:{type:"transform",transform:nt}})}default(nt){const jt=typeof nt=="function"?nt:()=>nt;return new ot({...h(this._def),innerType:this,defaultValue:jt,typeName:bt.ZodDefault})}brand(){return new At({typeName:bt.ZodBranded,type:this,...h(this._def)})}catch(nt){const jt=typeof nt=="function"?nt:()=>nt;return new Mt({...h(this._def),innerType:this,catchValue:jt,typeName:bt.ZodCatch})}describe(nt){const jt=this.constructor;return new jt({...this._def,description:nt})}pipe(nt){return rt.create(this,nt)}readonly(){return st.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 l=/^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,w="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let T;const D=/^(?:(?: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])$/,I=/^(?:(?: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])$/,O=/^(([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]))$/,M=/^(([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])$/,R=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,P=/^([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(nn){let nt="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return nn.precision?nt=`${nt}\\.\\d{${nn.precision}}`:nn.precision==null&&(nt=`${nt}(\\.\\d+)?`),nt}function B(nn){return new RegExp(`^${L(nn)}$`)}function j(nn){let nt=`${k}T${L(nn)}`;const jt=[];return jt.push(nn.local?"Z?":"Z"),nn.offset&&jt.push("([+-]\\d{2}:?\\d{2})"),nt=`${nt}(${jt.join("|")})`,new RegExp(`^${nt}$`)}t.datetimeRegex=j;function W(nn,nt){return!!((nt==="v4"||!nt)&&D.test(nn)||(nt==="v6"||!nt)&&O.test(nn))}function U(nn,nt){if(!b.test(nn))return!1;try{const[jt]=nn.split("."),qt=jt.replace(/-/g,"+").replace(/_/g,"/").padEnd(jt.length+(4-jt.length%4)%4,"="),In=JSON.parse(atob(qt));return!(typeof In!="object"||In===null||!In.typ||!In.alg||nt&&In.alg!==nt)}catch{return!1}}function Q(nn,nt){return!!((nt==="v4"||!nt)&&I.test(nn)||(nt==="v6"||!nt)&&M.test(nn))}class V extends u{_parse(nt){if(this._def.coerce&&(nt.data=String(nt.data)),this._getType(nt)!==p.ZodParsedType.string){const jn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jn,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.string,received:jn.parsedType}),m.INVALID}const qt=new m.ParseStatus;let In;for(const jn of this._def.checks)if(jn.kind==="min")nt.data.length<jn.value&&(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.too_small,minimum:jn.value,type:"string",inclusive:!0,exact:!1,message:jn.message}),qt.dirty());else if(jn.kind==="max")nt.data.length>jn.value&&(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.too_big,maximum:jn.value,type:"string",inclusive:!0,exact:!1,message:jn.message}),qt.dirty());else if(jn.kind==="length"){const Bi=nt.data.length>jn.value,Mi=nt.data.length<jn.value;(Bi||Mi)&&(In=this._getOrReturnCtx(nt,In),Bi?(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.too_big,maximum:jn.value,type:"string",inclusive:!0,exact:!0,message:jn.message}):Mi&&(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.too_small,minimum:jn.value,type:"string",inclusive:!0,exact:!0,message:jn.message}),qt.dirty())}else if(jn.kind==="email")S.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"email",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="emoji")T||(T=new RegExp(w,"u")),T.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"emoji",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="uuid")c.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"uuid",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="nanoid")y.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"nanoid",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="cuid")l.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"cuid",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="cuid2")E.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"cuid2",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="ulid")f.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"ulid",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="url")try{new URL(nt.data)}catch{In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"url",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()}else jn.kind==="regex"?(jn.regex.lastIndex=0,jn.regex.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"regex",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty())):jn.kind==="trim"?nt.data=nt.data.trim():jn.kind==="includes"?nt.data.includes(jn.value,jn.position)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.invalid_string,validation:{includes:jn.value,position:jn.position},message:jn.message}),qt.dirty()):jn.kind==="toLowerCase"?nt.data=nt.data.toLowerCase():jn.kind==="toUpperCase"?nt.data=nt.data.toUpperCase():jn.kind==="startsWith"?nt.data.startsWith(jn.value)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.invalid_string,validation:{startsWith:jn.value},message:jn.message}),qt.dirty()):jn.kind==="endsWith"?nt.data.endsWith(jn.value)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.invalid_string,validation:{endsWith:jn.value},message:jn.message}),qt.dirty()):jn.kind==="datetime"?j(jn).test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.invalid_string,validation:"datetime",message:jn.message}),qt.dirty()):jn.kind==="date"?F.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.invalid_string,validation:"date",message:jn.message}),qt.dirty()):jn.kind==="time"?B(jn).test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.invalid_string,validation:"time",message:jn.message}),qt.dirty()):jn.kind==="duration"?A.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"duration",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()):jn.kind==="ip"?W(nt.data,jn.version)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"ip",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()):jn.kind==="jwt"?U(nt.data,jn.alg)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"jwt",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()):jn.kind==="cidr"?Q(nt.data,jn.version)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"cidr",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()):jn.kind==="base64"?R.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"base64",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()):jn.kind==="base64url"?P.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"base64url",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()):p.util.assertNever(jn);return{status:qt.value,value:nt.data}}_regex(nt,jt,qt){return this.refinement(In=>nt.test(In),{validation:jt,code:s.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(qt)})}_addCheck(nt){return new V({...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 jt,qt;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:(jt=nt?.offset)!==null&&jt!==void 0?jt:!1,local:(qt=nt?.local)!==null&&qt!==void 0?qt:!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,jt){return this._addCheck({kind:"regex",regex:nt,...v.errorUtil.errToObj(jt)})}includes(nt,jt){return this._addCheck({kind:"includes",value:nt,position:jt?.position,...v.errorUtil.errToObj(jt?.message)})}startsWith(nt,jt){return this._addCheck({kind:"startsWith",value:nt,...v.errorUtil.errToObj(jt)})}endsWith(nt,jt){return this._addCheck({kind:"endsWith",value:nt,...v.errorUtil.errToObj(jt)})}min(nt,jt){return this._addCheck({kind:"min",value:nt,...v.errorUtil.errToObj(jt)})}max(nt,jt){return this._addCheck({kind:"max",value:nt,...v.errorUtil.errToObj(jt)})}length(nt,jt){return this._addCheck({kind:"length",value:nt,...v.errorUtil.errToObj(jt)})}nonempty(nt){return this.min(1,v.errorUtil.errToObj(nt))}trim(){return new V({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new V({...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 jt of this._def.checks)jt.kind==="min"&&(nt===null||jt.value>nt)&&(nt=jt.value);return nt}get maxLength(){let nt=null;for(const jt of this._def.checks)jt.kind==="max"&&(nt===null||jt.value<nt)&&(nt=jt.value);return nt}}t.ZodString=V,V.create=nn=>{var nt;return new V({checks:[],typeName:bt.ZodString,coerce:(nt=nn?.coerce)!==null&&nt!==void 0?nt:!1,...h(nn)})};function $(nn,nt){const jt=(nn.toString().split(".")[1]||"").length,qt=(nt.toString().split(".")[1]||"").length,In=jt>qt?jt:qt,jn=parseInt(nn.toFixed(In).replace(".","")),Bi=parseInt(nt.toFixed(In).replace(".",""));return jn%Bi/Math.pow(10,In)}class Y 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)!==p.ZodParsedType.number){const jn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jn,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.number,received:jn.parsedType}),m.INVALID}let qt;const In=new m.ParseStatus;for(const jn of this._def.checks)jn.kind==="int"?p.util.isInteger(nt.data)||(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:jn.message}),In.dirty()):jn.kind==="min"?(jn.inclusive?nt.data<jn.value:nt.data<=jn.value)&&(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_small,minimum:jn.value,type:"number",inclusive:jn.inclusive,exact:!1,message:jn.message}),In.dirty()):jn.kind==="max"?(jn.inclusive?nt.data>jn.value:nt.data>=jn.value)&&(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_big,maximum:jn.value,type:"number",inclusive:jn.inclusive,exact:!1,message:jn.message}),In.dirty()):jn.kind==="multipleOf"?$(nt.data,jn.value)!==0&&(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.not_multiple_of,multipleOf:jn.value,message:jn.message}),In.dirty()):jn.kind==="finite"?Number.isFinite(nt.data)||(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.not_finite,message:jn.message}),In.dirty()):p.util.assertNever(jn);return{status:In.value,value:nt.data}}gte(nt,jt){return this.setLimit("min",nt,!0,v.errorUtil.toString(jt))}gt(nt,jt){return this.setLimit("min",nt,!1,v.errorUtil.toString(jt))}lte(nt,jt){return this.setLimit("max",nt,!0,v.errorUtil.toString(jt))}lt(nt,jt){return this.setLimit("max",nt,!1,v.errorUtil.toString(jt))}setLimit(nt,jt,qt,In){return new Y({...this._def,checks:[...this._def.checks,{kind:nt,value:jt,inclusive:qt,message:v.errorUtil.toString(In)}]})}_addCheck(nt){return new Y({...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,jt){return this._addCheck({kind:"multipleOf",value:nt,message:v.errorUtil.toString(jt)})}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 jt of this._def.checks)jt.kind==="min"&&(nt===null||jt.value>nt)&&(nt=jt.value);return nt}get maxValue(){let nt=null;for(const jt of this._def.checks)jt.kind==="max"&&(nt===null||jt.value<nt)&&(nt=jt.value);return nt}get isInt(){return!!this._def.checks.find(nt=>nt.kind==="int"||nt.kind==="multipleOf"&&p.util.isInteger(nt.value))}get isFinite(){let nt=null,jt=null;for(const qt of this._def.checks){if(qt.kind==="finite"||qt.kind==="int"||qt.kind==="multipleOf")return!0;qt.kind==="min"?(jt===null||qt.value>jt)&&(jt=qt.value):qt.kind==="max"&&(nt===null||qt.value<nt)&&(nt=qt.value)}return Number.isFinite(jt)&&Number.isFinite(nt)}}t.ZodNumber=Y,Y.create=nn=>new Y({checks:[],typeName:bt.ZodNumber,coerce:nn?.coerce||!1,...h(nn)});class z 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)!==p.ZodParsedType.bigint)return this._getInvalidInput(nt);let qt;const In=new m.ParseStatus;for(const jn of this._def.checks)jn.kind==="min"?(jn.inclusive?nt.data<jn.value:nt.data<=jn.value)&&(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_small,type:"bigint",minimum:jn.value,inclusive:jn.inclusive,message:jn.message}),In.dirty()):jn.kind==="max"?(jn.inclusive?nt.data>jn.value:nt.data>=jn.value)&&(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_big,type:"bigint",maximum:jn.value,inclusive:jn.inclusive,message:jn.message}),In.dirty()):jn.kind==="multipleOf"?nt.data%jn.value!==BigInt(0)&&(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.not_multiple_of,multipleOf:jn.value,message:jn.message}),In.dirty()):p.util.assertNever(jn);return{status:In.value,value:nt.data}}_getInvalidInput(nt){const jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.bigint,received:jt.parsedType}),m.INVALID}gte(nt,jt){return this.setLimit("min",nt,!0,v.errorUtil.toString(jt))}gt(nt,jt){return this.setLimit("min",nt,!1,v.errorUtil.toString(jt))}lte(nt,jt){return this.setLimit("max",nt,!0,v.errorUtil.toString(jt))}lt(nt,jt){return this.setLimit("max",nt,!1,v.errorUtil.toString(jt))}setLimit(nt,jt,qt,In){return new z({...this._def,checks:[...this._def.checks,{kind:nt,value:jt,inclusive:qt,message:v.errorUtil.toString(In)}]})}_addCheck(nt){return new z({...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,jt){return this._addCheck({kind:"multipleOf",value:nt,message:v.errorUtil.toString(jt)})}get minValue(){let nt=null;for(const jt of this._def.checks)jt.kind==="min"&&(nt===null||jt.value>nt)&&(nt=jt.value);return nt}get maxValue(){let nt=null;for(const jt of this._def.checks)jt.kind==="max"&&(nt===null||jt.value<nt)&&(nt=jt.value);return nt}}t.ZodBigInt=z,z.create=nn=>{var nt;return new z({checks:[],typeName:bt.ZodBigInt,coerce:(nt=nn?.coerce)!==null&&nt!==void 0?nt:!1,...h(nn)})};class H extends u{_parse(nt){if(this._def.coerce&&(nt.data=!!nt.data),this._getType(nt)!==p.ZodParsedType.boolean){const qt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.boolean,received:qt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodBoolean=H,H.create=nn=>new H({typeName:bt.ZodBoolean,coerce:nn?.coerce||!1,...h(nn)});class K extends u{_parse(nt){if(this._def.coerce&&(nt.data=new Date(nt.data)),this._getType(nt)!==p.ZodParsedType.date){const jn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jn,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.date,received:jn.parsedType}),m.INVALID}if(isNaN(nt.data.getTime())){const jn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jn,{code:s.ZodIssueCode.invalid_date}),m.INVALID}const qt=new m.ParseStatus;let In;for(const jn of this._def.checks)jn.kind==="min"?nt.data.getTime()<jn.value&&(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.too_small,message:jn.message,inclusive:!0,exact:!1,minimum:jn.value,type:"date"}),qt.dirty()):jn.kind==="max"?nt.data.getTime()>jn.value&&(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.too_big,message:jn.message,inclusive:!0,exact:!1,maximum:jn.value,type:"date"}),qt.dirty()):p.util.assertNever(jn);return{status:qt.value,value:new Date(nt.data.getTime())}}_addCheck(nt){return new K({...this._def,checks:[...this._def.checks,nt]})}min(nt,jt){return this._addCheck({kind:"min",value:nt.getTime(),message:v.errorUtil.toString(jt)})}max(nt,jt){return this._addCheck({kind:"max",value:nt.getTime(),message:v.errorUtil.toString(jt)})}get minDate(){let nt=null;for(const jt of this._def.checks)jt.kind==="min"&&(nt===null||jt.value>nt)&&(nt=jt.value);return nt!=null?new Date(nt):null}get maxDate(){let nt=null;for(const jt of this._def.checks)jt.kind==="max"&&(nt===null||jt.value<nt)&&(nt=jt.value);return nt!=null?new Date(nt):null}}t.ZodDate=K,K.create=nn=>new K({checks:[],coerce:nn?.coerce||!1,typeName:bt.ZodDate,...h(nn)});class Z extends u{_parse(nt){if(this._getType(nt)!==p.ZodParsedType.symbol){const qt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.symbol,received:qt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodSymbol=Z,Z.create=nn=>new Z({typeName:bt.ZodSymbol,...h(nn)});class X extends u{_parse(nt){if(this._getType(nt)!==p.ZodParsedType.undefined){const qt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.undefined,received:qt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodUndefined=X,X.create=nn=>new X({typeName:bt.ZodUndefined,...h(nn)});class oe extends u{_parse(nt){if(this._getType(nt)!==p.ZodParsedType.null){const qt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.null,received:qt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodNull=oe,oe.create=nn=>new oe({typeName:bt.ZodNull,...h(nn)});class ie extends u{constructor(){super(...arguments),this._any=!0}_parse(nt){return(0,m.OK)(nt.data)}}t.ZodAny=ie,ie.create=nn=>new ie({typeName:bt.ZodAny,...h(nn)});class ge extends u{constructor(){super(...arguments),this._unknown=!0}_parse(nt){return(0,m.OK)(nt.data)}}t.ZodUnknown=ge,ge.create=nn=>new ge({typeName:bt.ZodUnknown,...h(nn)});class me extends u{_parse(nt){const jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.never,received:jt.parsedType}),m.INVALID}}t.ZodNever=me,me.create=nn=>new me({typeName:bt.ZodNever,...h(nn)});class q extends u{_parse(nt){if(this._getType(nt)!==p.ZodParsedType.undefined){const qt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.void,received:qt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodVoid=q,q.create=nn=>new q({typeName:bt.ZodVoid,...h(nn)});class Se extends u{_parse(nt){const{ctx:jt,status:qt}=this._processInputParams(nt),In=this._def;if(jt.parsedType!==p.ZodParsedType.array)return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.array,received:jt.parsedType}),m.INVALID;if(In.exactLength!==null){const Bi=jt.data.length>In.exactLength.value,Mi=jt.data.length<In.exactLength.value;(Bi||Mi)&&((0,m.addIssueToContext)(jt,{code:Bi?s.ZodIssueCode.too_big:s.ZodIssueCode.too_small,minimum:Mi?In.exactLength.value:void 0,maximum:Bi?In.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:In.exactLength.message}),qt.dirty())}if(In.minLength!==null&&jt.data.length<In.minLength.value&&((0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.too_small,minimum:In.minLength.value,type:"array",inclusive:!0,exact:!1,message:In.minLength.message}),qt.dirty()),In.maxLength!==null&&jt.data.length>In.maxLength.value&&((0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.too_big,maximum:In.maxLength.value,type:"array",inclusive:!0,exact:!1,message:In.maxLength.message}),qt.dirty()),jt.common.async)return Promise.all([...jt.data].map((Bi,Mi)=>In.type._parseAsync(new g(jt,Bi,jt.path,Mi)))).then(Bi=>m.ParseStatus.mergeArray(qt,Bi));const jn=[...jt.data].map((Bi,Mi)=>In.type._parseSync(new g(jt,Bi,jt.path,Mi)));return m.ParseStatus.mergeArray(qt,jn)}get element(){return this._def.type}min(nt,jt){return new Se({...this._def,minLength:{value:nt,message:v.errorUtil.toString(jt)}})}max(nt,jt){return new Se({...this._def,maxLength:{value:nt,message:v.errorUtil.toString(jt)}})}length(nt,jt){return new Se({...this._def,exactLength:{value:nt,message:v.errorUtil.toString(jt)}})}nonempty(nt){return this.min(1,nt)}}t.ZodArray=Se,Se.create=(nn,nt)=>new Se({type:nn,minLength:null,maxLength:null,exactLength:null,typeName:bt.ZodArray,...h(nt)});function _e(nn){if(nn instanceof ne){const nt={};for(const jt in nn.shape){const qt=nn.shape[jt];nt[jt]=je.create(_e(qt))}return new ne({...nn._def,shape:()=>nt})}else return nn instanceof Se?new Se({...nn._def,type:_e(nn.element)}):nn instanceof je?je.create(_e(nn.unwrap())):nn instanceof gt?gt.create(_e(nn.unwrap())):nn instanceof Ce?Ce.create(nn.items.map(nt=>_e(nt))):nn}class ne 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(),jt=p.util.objectKeys(nt);return this._cached={shape:nt,keys:jt}}_parse(nt){if(this._getType(nt)!==p.ZodParsedType.object){const yi=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(yi,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.object,received:yi.parsedType}),m.INVALID}const{status:qt,ctx:In}=this._processInputParams(nt),{shape:jn,keys:Bi}=this._getCached(),Mi=[];if(!(this._def.catchall instanceof me&&this._def.unknownKeys==="strip"))for(const yi in In.data)Bi.includes(yi)||Mi.push(yi);const Xi=[];for(const yi of Bi){const Zi=jn[yi],to=In.data[yi];Xi.push({key:{status:"valid",value:yi},value:Zi._parse(new g(In,to,In.path,yi)),alwaysSet:yi in In.data})}if(this._def.catchall instanceof me){const yi=this._def.unknownKeys;if(yi==="passthrough")for(const Zi of Mi)Xi.push({key:{status:"valid",value:Zi},value:{status:"valid",value:In.data[Zi]}});else if(yi==="strict")Mi.length>0&&((0,m.addIssueToContext)(In,{code:s.ZodIssueCode.unrecognized_keys,keys:Mi}),qt.dirty());else if(yi!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const yi=this._def.catchall;for(const Zi of Mi){const to=In.data[Zi];Xi.push({key:{status:"valid",value:Zi},value:yi._parse(new g(In,to,In.path,Zi)),alwaysSet:Zi in In.data})}}return In.common.async?Promise.resolve().then(async()=>{const yi=[];for(const Zi of Xi){const to=await Zi.key,uo=await Zi.value;yi.push({key:to,value:uo,alwaysSet:Zi.alwaysSet})}return yi}).then(yi=>m.ParseStatus.mergeObjectSync(qt,yi)):m.ParseStatus.mergeObjectSync(qt,Xi)}get shape(){return this._def.shape()}strict(nt){return v.errorUtil.errToObj,new ne({...this._def,unknownKeys:"strict",...nt!==void 0?{errorMap:(jt,qt)=>{var In,jn,Bi,Mi;const Xi=(Bi=(jn=(In=this._def).errorMap)===null||jn===void 0?void 0:jn.call(In,jt,qt).message)!==null&&Bi!==void 0?Bi:qt.defaultError;return jt.code==="unrecognized_keys"?{message:(Mi=v.errorUtil.errToObj(nt).message)!==null&&Mi!==void 0?Mi:Xi}:{message:Xi}}}:{}})}strip(){return new ne({...this._def,unknownKeys:"strip"})}passthrough(){return new ne({...this._def,unknownKeys:"passthrough"})}extend(nt){return new ne({...this._def,shape:()=>({...this._def.shape(),...nt})})}merge(nt){return new ne({unknownKeys:nt._def.unknownKeys,catchall:nt._def.catchall,shape:()=>({...this._def.shape(),...nt._def.shape()}),typeName:bt.ZodObject})}setKey(nt,jt){return this.augment({[nt]:jt})}catchall(nt){return new ne({...this._def,catchall:nt})}pick(nt){const jt={};return p.util.objectKeys(nt).forEach(qt=>{nt[qt]&&this.shape[qt]&&(jt[qt]=this.shape[qt])}),new ne({...this._def,shape:()=>jt})}omit(nt){const jt={};return p.util.objectKeys(this.shape).forEach(qt=>{nt[qt]||(jt[qt]=this.shape[qt])}),new ne({...this._def,shape:()=>jt})}deepPartial(){return _e(this)}partial(nt){const jt={};return p.util.objectKeys(this.shape).forEach(qt=>{const In=this.shape[qt];nt&&!nt[qt]?jt[qt]=In:jt[qt]=In.optional()}),new ne({...this._def,shape:()=>jt})}required(nt){const jt={};return p.util.objectKeys(this.shape).forEach(qt=>{if(nt&&!nt[qt])jt[qt]=this.shape[qt];else{let jn=this.shape[qt];for(;jn instanceof je;)jn=jn._def.innerType;jt[qt]=jn}}),new ne({...this._def,shape:()=>jt})}keyof(){return he(p.util.objectKeys(this.shape))}}t.ZodObject=ne,ne.create=(nn,nt)=>new ne({shape:()=>nn,unknownKeys:"strip",catchall:me.create(),typeName:bt.ZodObject,...h(nt)}),ne.strictCreate=(nn,nt)=>new ne({shape:()=>nn,unknownKeys:"strict",catchall:me.create(),typeName:bt.ZodObject,...h(nt)}),ne.lazycreate=(nn,nt)=>new ne({shape:nn,unknownKeys:"strip",catchall:me.create(),typeName:bt.ZodObject,...h(nt)});class ue extends u{_parse(nt){const{ctx:jt}=this._processInputParams(nt),qt=this._def.options;function In(jn){for(const Mi of jn)if(Mi.result.status==="valid")return Mi.result;for(const Mi of jn)if(Mi.result.status==="dirty")return jt.common.issues.push(...Mi.ctx.common.issues),Mi.result;const Bi=jn.map(Mi=>new s.ZodError(Mi.ctx.common.issues));return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_union,unionErrors:Bi}),m.INVALID}if(jt.common.async)return Promise.all(qt.map(async jn=>{const Bi={...jt,common:{...jt.common,issues:[]},parent:null};return{result:await jn._parseAsync({data:jt.data,path:jt.path,parent:Bi}),ctx:Bi}})).then(In);{let jn;const Bi=[];for(const Xi of qt){const yi={...jt,common:{...jt.common,issues:[]},parent:null},Zi=Xi._parseSync({data:jt.data,path:jt.path,parent:yi});if(Zi.status==="valid")return Zi;Zi.status==="dirty"&&!jn&&(jn={result:Zi,ctx:yi}),yi.common.issues.length&&Bi.push(yi.common.issues)}if(jn)return jt.common.issues.push(...jn.ctx.common.issues),jn.result;const Mi=Bi.map(Xi=>new s.ZodError(Xi));return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_union,unionErrors:Mi}),m.INVALID}}get options(){return this._def.options}}t.ZodUnion=ue,ue.create=(nn,nt)=>new ue({options:nn,typeName:bt.ZodUnion,...h(nt)});const Ie=nn=>nn instanceof pe?Ie(nn.schema):nn instanceof Ge?Ie(nn.innerType()):nn instanceof re?[nn.value]:nn instanceof Oe?nn.options:nn instanceof De?p.util.objectValues(nn.enum):nn instanceof ot?Ie(nn._def.innerType):nn instanceof X?[void 0]:nn instanceof oe?[null]:nn instanceof je?[void 0,...Ie(nn.unwrap())]:nn instanceof gt?[null,...Ie(nn.unwrap())]:nn instanceof At||nn instanceof st?Ie(nn.unwrap()):nn instanceof Mt?Ie(nn._def.innerType):[];class Pe extends u{_parse(nt){const{ctx:jt}=this._processInputParams(nt);if(jt.parsedType!==p.ZodParsedType.object)return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.object,received:jt.parsedType}),m.INVALID;const qt=this.discriminator,In=jt.data[qt],jn=this.optionsMap.get(In);return jn?jt.common.async?jn._parseAsync({data:jt.data,path:jt.path,parent:jt}):jn._parseSync({data:jt.data,path:jt.path,parent:jt}):((0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[qt]}),m.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(nt,jt,qt){const In=new Map;for(const jn of jt){const Bi=Ie(jn.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(In.has(Mi))throw new Error(`Discriminator property ${String(nt)} has duplicate value ${String(Mi)}`);In.set(Mi,jn)}}return new Pe({typeName:bt.ZodDiscriminatedUnion,discriminator:nt,options:jt,optionsMap:In,...h(qt)})}}t.ZodDiscriminatedUnion=Pe;function ve(nn,nt){const jt=(0,p.getParsedType)(nn),qt=(0,p.getParsedType)(nt);if(nn===nt)return{valid:!0,data:nn};if(jt===p.ZodParsedType.object&&qt===p.ZodParsedType.object){const In=p.util.objectKeys(nt),jn=p.util.objectKeys(nn).filter(Mi=>In.indexOf(Mi)!==-1),Bi={...nn,...nt};for(const Mi of jn){const Xi=ve(nn[Mi],nt[Mi]);if(!Xi.valid)return{valid:!1};Bi[Mi]=Xi.data}return{valid:!0,data:Bi}}else if(jt===p.ZodParsedType.array&&qt===p.ZodParsedType.array){if(nn.length!==nt.length)return{valid:!1};const In=[];for(let jn=0;jn<nn.length;jn++){const Bi=nn[jn],Mi=nt[jn],Xi=ve(Bi,Mi);if(!Xi.valid)return{valid:!1};In.push(Xi.data)}return{valid:!0,data:In}}else return jt===p.ZodParsedType.date&&qt===p.ZodParsedType.date&&+nn==+nt?{valid:!0,data:nn}:{valid:!1}}class Ae extends u{_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt),In=(jn,Bi)=>{if((0,m.isAborted)(jn)||(0,m.isAborted)(Bi))return m.INVALID;const Mi=ve(jn.value,Bi.value);return Mi.valid?(((0,m.isDirty)(jn)||(0,m.isDirty)(Bi))&&jt.dirty(),{status:jt.value,value:Mi.data}):((0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_intersection_types}),m.INVALID)};return qt.common.async?Promise.all([this._def.left._parseAsync({data:qt.data,path:qt.path,parent:qt}),this._def.right._parseAsync({data:qt.data,path:qt.path,parent:qt})]).then(([jn,Bi])=>In(jn,Bi)):In(this._def.left._parseSync({data:qt.data,path:qt.path,parent:qt}),this._def.right._parseSync({data:qt.data,path:qt.path,parent:qt}))}}t.ZodIntersection=Ae,Ae.create=(nn,nt,jt)=>new Ae({left:nn,right:nt,typeName:bt.ZodIntersection,...h(jt)});class Ce extends u{_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt);if(qt.parsedType!==p.ZodParsedType.array)return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.array,received:qt.parsedType}),m.INVALID;if(qt.data.length<this._def.items.length)return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m.INVALID;!this._def.rest&&qt.data.length>this._def.items.length&&((0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),jt.dirty());const jn=[...qt.data].map((Bi,Mi)=>{const Xi=this._def.items[Mi]||this._def.rest;return Xi?Xi._parse(new g(qt,Bi,qt.path,Mi)):null}).filter(Bi=>!!Bi);return qt.common.async?Promise.all(jn).then(Bi=>m.ParseStatus.mergeArray(jt,Bi)):m.ParseStatus.mergeArray(jt,jn)}get items(){return this._def.items}rest(nt){return new Ce({...this._def,rest:nt})}}t.ZodTuple=Ce,Ce.create=(nn,nt)=>{if(!Array.isArray(nn))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ce({items:nn,typeName:bt.ZodTuple,rest:null,...h(nt)})};class fe extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt);if(qt.parsedType!==p.ZodParsedType.object)return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.object,received:qt.parsedType}),m.INVALID;const In=[],jn=this._def.keyType,Bi=this._def.valueType;for(const Mi in qt.data)In.push({key:jn._parse(new g(qt,Mi,qt.path,Mi)),value:Bi._parse(new g(qt,qt.data[Mi],qt.path,Mi)),alwaysSet:Mi in qt.data});return qt.common.async?m.ParseStatus.mergeObjectAsync(jt,In):m.ParseStatus.mergeObjectSync(jt,In)}get element(){return this._def.valueType}static create(nt,jt,qt){return jt instanceof u?new fe({keyType:nt,valueType:jt,typeName:bt.ZodRecord,...h(qt)}):new fe({keyType:V.create(),valueType:nt,typeName:bt.ZodRecord,...h(jt)})}}t.ZodRecord=fe;class xe extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt);if(qt.parsedType!==p.ZodParsedType.map)return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.map,received:qt.parsedType}),m.INVALID;const In=this._def.keyType,jn=this._def.valueType,Bi=[...qt.data.entries()].map(([Mi,Xi],yi)=>({key:In._parse(new g(qt,Mi,qt.path,[yi,"key"])),value:jn._parse(new g(qt,Xi,qt.path,[yi,"value"]))}));if(qt.common.async){const Mi=new Map;return Promise.resolve().then(async()=>{for(const Xi of Bi){const yi=await Xi.key,Zi=await Xi.value;if(yi.status==="aborted"||Zi.status==="aborted")return m.INVALID;(yi.status==="dirty"||Zi.status==="dirty")&&jt.dirty(),Mi.set(yi.value,Zi.value)}return{status:jt.value,value:Mi}})}else{const Mi=new Map;for(const Xi of Bi){const yi=Xi.key,Zi=Xi.value;if(yi.status==="aborted"||Zi.status==="aborted")return m.INVALID;(yi.status==="dirty"||Zi.status==="dirty")&&jt.dirty(),Mi.set(yi.value,Zi.value)}return{status:jt.value,value:Mi}}}}t.ZodMap=xe,xe.create=(nn,nt,jt)=>new xe({valueType:nt,keyType:nn,typeName:bt.ZodMap,...h(jt)});class Te extends u{_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt);if(qt.parsedType!==p.ZodParsedType.set)return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.set,received:qt.parsedType}),m.INVALID;const In=this._def;In.minSize!==null&&qt.data.size<In.minSize.value&&((0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_small,minimum:In.minSize.value,type:"set",inclusive:!0,exact:!1,message:In.minSize.message}),jt.dirty()),In.maxSize!==null&&qt.data.size>In.maxSize.value&&((0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_big,maximum:In.maxSize.value,type:"set",inclusive:!0,exact:!1,message:In.maxSize.message}),jt.dirty());const jn=this._def.valueType;function Bi(Xi){const yi=new Set;for(const Zi of Xi){if(Zi.status==="aborted")return m.INVALID;Zi.status==="dirty"&&jt.dirty(),yi.add(Zi.value)}return{status:jt.value,value:yi}}const Mi=[...qt.data.values()].map((Xi,yi)=>jn._parse(new g(qt,Xi,qt.path,yi)));return qt.common.async?Promise.all(Mi).then(Xi=>Bi(Xi)):Bi(Mi)}min(nt,jt){return new Te({...this._def,minSize:{value:nt,message:v.errorUtil.toString(jt)}})}max(nt,jt){return new Te({...this._def,maxSize:{value:nt,message:v.errorUtil.toString(jt)}})}size(nt,jt){return this.min(nt,jt).max(nt,jt)}nonempty(nt){return this.min(1,nt)}}t.ZodSet=Te,Te.create=(nn,nt)=>new Te({valueType:nn,minSize:null,maxSize:null,typeName:bt.ZodSet,...h(nt)});class Ne extends u{constructor(){super(...arguments),this.validate=this.implement}_parse(nt){const{ctx:jt}=this._processInputParams(nt);if(jt.parsedType!==p.ZodParsedType.function)return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.function,received:jt.parsedType}),m.INVALID;function qt(Mi,Xi){return(0,m.makeIssue)({data:Mi,path:jt.path,errorMaps:[jt.common.contextualErrorMap,jt.schemaErrorMap,(0,_.getErrorMap)(),_.defaultErrorMap].filter(yi=>!!yi),issueData:{code:s.ZodIssueCode.invalid_arguments,argumentsError:Xi}})}function In(Mi,Xi){return(0,m.makeIssue)({data:Mi,path:jt.path,errorMaps:[jt.common.contextualErrorMap,jt.schemaErrorMap,(0,_.getErrorMap)(),_.defaultErrorMap].filter(yi=>!!yi),issueData:{code:s.ZodIssueCode.invalid_return_type,returnTypeError:Xi}})}const jn={errorMap:jt.common.contextualErrorMap},Bi=jt.data;if(this._def.returns instanceof Fe){const Mi=this;return(0,m.OK)(async function(...Xi){const yi=new s.ZodError([]),Zi=await Mi._def.args.parseAsync(Xi,jn).catch(Ao=>{throw yi.addIssue(qt(Xi,Ao)),yi}),to=await Reflect.apply(Bi,this,Zi);return await Mi._def.returns._def.type.parseAsync(to,jn).catch(Ao=>{throw yi.addIssue(In(to,Ao)),yi})})}else{const Mi=this;return(0,m.OK)(function(...Xi){const yi=Mi._def.args.safeParse(Xi,jn);if(!yi.success)throw new s.ZodError([qt(Xi,yi.error)]);const Zi=Reflect.apply(Bi,this,yi.data),to=Mi._def.returns.safeParse(Zi,jn);if(!to.success)throw new s.ZodError([In(Zi,to.error)]);return to.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...nt){return new Ne({...this._def,args:Ce.create(nt).rest(ge.create())})}returns(nt){return new Ne({...this._def,returns:nt})}implement(nt){return this.parse(nt)}strictImplement(nt){return this.parse(nt)}static create(nt,jt,qt){return new Ne({args:nt||Ce.create([]).rest(ge.create()),returns:jt||ge.create(),typeName:bt.ZodFunction,...h(qt)})}}t.ZodFunction=Ne;class pe extends u{get schema(){return this._def.getter()}_parse(nt){const{ctx:jt}=this._processInputParams(nt);return this._def.getter()._parse({data:jt.data,path:jt.path,parent:jt})}}t.ZodLazy=pe,pe.create=(nn,nt)=>new pe({getter:nn,typeName:bt.ZodLazy,...h(nt)});class re extends u{_parse(nt){if(nt.data!==this._def.value){const jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jt,{received:jt.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=(nn,nt)=>new re({value:nn,typeName:bt.ZodLiteral,...h(nt)});function he(nn,nt){return new Oe({values:nn,typeName:bt.ZodEnum,...h(nt)})}class Oe extends u{constructor(){super(...arguments),o.set(this,void 0)}_parse(nt){if(typeof nt.data!="string"){const jt=this._getOrReturnCtx(nt),qt=this._def.values;return(0,m.addIssueToContext)(jt,{expected:p.util.joinValues(qt),received:jt.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 jt=this._getOrReturnCtx(nt),qt=this._def.values;return(0,m.addIssueToContext)(jt,{received:jt.data,code:s.ZodIssueCode.invalid_enum_value,options:qt}),m.INVALID}return(0,m.OK)(nt.data)}get options(){return this._def.values}get enum(){const nt={};for(const jt of this._def.values)nt[jt]=jt;return nt}get Values(){const nt={};for(const jt of this._def.values)nt[jt]=jt;return nt}get Enum(){const nt={};for(const jt of this._def.values)nt[jt]=jt;return nt}extract(nt,jt=this._def){return Oe.create(nt,{...this._def,...jt})}exclude(nt,jt=this._def){return Oe.create(this.options.filter(qt=>!nt.includes(qt)),{...this._def,...jt})}}t.ZodEnum=Oe,o=new WeakMap,Oe.create=he;class De extends u{constructor(){super(...arguments),d.set(this,void 0)}_parse(nt){const jt=p.util.getValidEnumValues(this._def.values),qt=this._getOrReturnCtx(nt);if(qt.parsedType!==p.ZodParsedType.string&&qt.parsedType!==p.ZodParsedType.number){const In=p.util.objectValues(jt);return(0,m.addIssueToContext)(qt,{expected:p.util.joinValues(In),received:qt.parsedType,code:s.ZodIssueCode.invalid_type}),m.INVALID}if(n(this,d,"f")||r(this,d,new Set(p.util.getValidEnumValues(this._def.values)),"f"),!n(this,d,"f").has(nt.data)){const In=p.util.objectValues(jt);return(0,m.addIssueToContext)(qt,{received:qt.data,code:s.ZodIssueCode.invalid_enum_value,options:In}),m.INVALID}return(0,m.OK)(nt.data)}get enum(){return this._def.values}}t.ZodNativeEnum=De,d=new WeakMap,De.create=(nn,nt)=>new De({values:nn,typeName:bt.ZodNativeEnum,...h(nt)});class Fe extends u{unwrap(){return this._def.type}_parse(nt){const{ctx:jt}=this._processInputParams(nt);if(jt.parsedType!==p.ZodParsedType.promise&&jt.common.async===!1)return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.promise,received:jt.parsedType}),m.INVALID;const qt=jt.parsedType===p.ZodParsedType.promise?jt.data:Promise.resolve(jt.data);return(0,m.OK)(qt.then(In=>this._def.type.parseAsync(In,{path:jt.path,errorMap:jt.common.contextualErrorMap})))}}t.ZodPromise=Fe,Fe.create=(nn,nt)=>new Fe({type:nn,typeName:bt.ZodPromise,...h(nt)});class Ge extends u{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===bt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt),In=this._def.effect||null,jn={addIssue:Bi=>{(0,m.addIssueToContext)(qt,Bi),Bi.fatal?jt.abort():jt.dirty()},get path(){return qt.path}};if(jn.addIssue=jn.addIssue.bind(jn),In.type==="preprocess"){const Bi=In.transform(qt.data,jn);if(qt.common.async)return Promise.resolve(Bi).then(async Mi=>{if(jt.value==="aborted")return m.INVALID;const Xi=await this._def.schema._parseAsync({data:Mi,path:qt.path,parent:qt});return Xi.status==="aborted"?m.INVALID:Xi.status==="dirty"||jt.value==="dirty"?(0,m.DIRTY)(Xi.value):Xi});{if(jt.value==="aborted")return m.INVALID;const Mi=this._def.schema._parseSync({data:Bi,path:qt.path,parent:qt});return Mi.status==="aborted"?m.INVALID:Mi.status==="dirty"||jt.value==="dirty"?(0,m.DIRTY)(Mi.value):Mi}}if(In.type==="refinement"){const Bi=Mi=>{const Xi=In.refinement(Mi,jn);if(qt.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(qt.common.async===!1){const Mi=this._def.schema._parseSync({data:qt.data,path:qt.path,parent:qt});return Mi.status==="aborted"?m.INVALID:(Mi.status==="dirty"&&jt.dirty(),Bi(Mi.value),{status:jt.value,value:Mi.value})}else return this._def.schema._parseAsync({data:qt.data,path:qt.path,parent:qt}).then(Mi=>Mi.status==="aborted"?m.INVALID:(Mi.status==="dirty"&&jt.dirty(),Bi(Mi.value).then(()=>({status:jt.value,value:Mi.value}))))}if(In.type==="transform")if(qt.common.async===!1){const Bi=this._def.schema._parseSync({data:qt.data,path:qt.path,parent:qt});if(!(0,m.isValid)(Bi))return Bi;const Mi=In.transform(Bi.value,jn);if(Mi instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:jt.value,value:Mi}}else return this._def.schema._parseAsync({data:qt.data,path:qt.path,parent:qt}).then(Bi=>(0,m.isValid)(Bi)?Promise.resolve(In.transform(Bi.value,jn)).then(Mi=>({status:jt.value,value:Mi})):Bi);p.util.assertNever(In)}}t.ZodEffects=Ge,t.ZodTransformer=Ge,Ge.create=(nn,nt,jt)=>new Ge({schema:nn,typeName:bt.ZodEffects,effect:nt,...h(jt)}),Ge.createWithPreprocess=(nn,nt,jt)=>new Ge({schema:nt,effect:{type:"preprocess",transform:nn},typeName:bt.ZodEffects,...h(jt)});class je extends u{_parse(nt){return this._getType(nt)===p.ZodParsedType.undefined?(0,m.OK)(void 0):this._def.innerType._parse(nt)}unwrap(){return this._def.innerType}}t.ZodOptional=je,je.create=(nn,nt)=>new je({innerType:nn,typeName:bt.ZodOptional,...h(nt)});class gt extends u{_parse(nt){return this._getType(nt)===p.ZodParsedType.null?(0,m.OK)(null):this._def.innerType._parse(nt)}unwrap(){return this._def.innerType}}t.ZodNullable=gt,gt.create=(nn,nt)=>new gt({innerType:nn,typeName:bt.ZodNullable,...h(nt)});class ot extends u{_parse(nt){const{ctx:jt}=this._processInputParams(nt);let qt=jt.data;return jt.parsedType===p.ZodParsedType.undefined&&(qt=this._def.defaultValue()),this._def.innerType._parse({data:qt,path:jt.path,parent:jt})}removeDefault(){return this._def.innerType}}t.ZodDefault=ot,ot.create=(nn,nt)=>new ot({innerType:nn,typeName:bt.ZodDefault,defaultValue:typeof nt.default=="function"?nt.default:()=>nt.default,...h(nt)});class Mt extends u{_parse(nt){const{ctx:jt}=this._processInputParams(nt),qt={...jt,common:{...jt.common,issues:[]}},In=this._def.innerType._parse({data:qt.data,path:qt.path,parent:{...qt}});return(0,m.isAsync)(In)?In.then(jn=>({status:"valid",value:jn.status==="valid"?jn.value:this._def.catchValue({get error(){return new s.ZodError(qt.common.issues)},input:qt.data})})):{status:"valid",value:In.status==="valid"?In.value:this._def.catchValue({get error(){return new s.ZodError(qt.common.issues)},input:qt.data})}}removeCatch(){return this._def.innerType}}t.ZodCatch=Mt,Mt.create=(nn,nt)=>new Mt({innerType:nn,typeName:bt.ZodCatch,catchValue:typeof nt.catch=="function"?nt.catch:()=>nt.catch,...h(nt)});class lt extends u{_parse(nt){if(this._getType(nt)!==p.ZodParsedType.nan){const qt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.nan,received:qt.parsedType}),m.INVALID}return{status:"valid",value:nt.data}}}t.ZodNaN=lt,lt.create=nn=>new lt({typeName:bt.ZodNaN,...h(nn)}),t.BRAND=Symbol("zod_brand");class At extends u{_parse(nt){const{ctx:jt}=this._processInputParams(nt),qt=jt.data;return this._def.type._parse({data:qt,path:jt.path,parent:jt})}unwrap(){return this._def.type}}t.ZodBranded=At;class rt extends u{_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt);if(qt.common.async)return(async()=>{const jn=await this._def.in._parseAsync({data:qt.data,path:qt.path,parent:qt});return jn.status==="aborted"?m.INVALID:jn.status==="dirty"?(jt.dirty(),(0,m.DIRTY)(jn.value)):this._def.out._parseAsync({data:jn.value,path:qt.path,parent:qt})})();{const In=this._def.in._parseSync({data:qt.data,path:qt.path,parent:qt});return In.status==="aborted"?m.INVALID:In.status==="dirty"?(jt.dirty(),{status:"dirty",value:In.value}):this._def.out._parseSync({data:In.value,path:qt.path,parent:qt})}}static create(nt,jt){return new rt({in:nt,out:jt,typeName:bt.ZodPipeline})}}t.ZodPipeline=rt;class st extends u{_parse(nt){const jt=this._def.innerType._parse(nt),qt=In=>((0,m.isValid)(In)&&(In.value=Object.freeze(In.value)),In);return(0,m.isAsync)(jt)?jt.then(In=>qt(In)):qt(jt)}unwrap(){return this._def.innerType}}t.ZodReadonly=st,st.create=(nn,nt)=>new st({innerType:nn,typeName:bt.ZodReadonly,...h(nt)});function ct(nn,nt={},jt){return nn?ie.create().superRefine((qt,In)=>{var jn,Bi;if(!nn(qt)){const Mi=typeof nt=="function"?nt(qt):typeof nt=="string"?{message:nt}:nt,Xi=(Bi=(jn=Mi.fatal)!==null&&jn!==void 0?jn:jt)!==null&&Bi!==void 0?Bi:!0,yi=typeof Mi=="string"?{message:Mi}:Mi;In.addIssue({code:"custom",...yi,fatal:Xi})}}):ie.create()}t.custom=ct,t.late={object:ne.lazycreate};var bt;(function(nn){nn.ZodString="ZodString",nn.ZodNumber="ZodNumber",nn.ZodNaN="ZodNaN",nn.ZodBigInt="ZodBigInt",nn.ZodBoolean="ZodBoolean",nn.ZodDate="ZodDate",nn.ZodSymbol="ZodSymbol",nn.ZodUndefined="ZodUndefined",nn.ZodNull="ZodNull",nn.ZodAny="ZodAny",nn.ZodUnknown="ZodUnknown",nn.ZodNever="ZodNever",nn.ZodVoid="ZodVoid",nn.ZodArray="ZodArray",nn.ZodObject="ZodObject",nn.ZodUnion="ZodUnion",nn.ZodDiscriminatedUnion="ZodDiscriminatedUnion",nn.ZodIntersection="ZodIntersection",nn.ZodTuple="ZodTuple",nn.ZodRecord="ZodRecord",nn.ZodMap="ZodMap",nn.ZodSet="ZodSet",nn.ZodFunction="ZodFunction",nn.ZodLazy="ZodLazy",nn.ZodLiteral="ZodLiteral",nn.ZodEnum="ZodEnum",nn.ZodEffects="ZodEffects",nn.ZodNativeEnum="ZodNativeEnum",nn.ZodOptional="ZodOptional",nn.ZodNullable="ZodNullable",nn.ZodDefault="ZodDefault",nn.ZodCatch="ZodCatch",nn.ZodPromise="ZodPromise",nn.ZodBranded="ZodBranded",nn.ZodPipeline="ZodPipeline",nn.ZodReadonly="ZodReadonly"})(bt||(t.ZodFirstPartyTypeKind=bt={}));class Ut{constructor(...nt){}}const hn=(nn,nt={message:`Input not instance of ${nn.name}`})=>ct(jt=>jt instanceof nn,nt);t.instanceof=hn;const kn=V.create;t.string=kn;const fi=Y.create;t.number=fi;const Nn=lt.create;t.nan=Nn;const cn=z.create;t.bigint=cn;const zn=H.create;t.boolean=zn;const pn=K.create;t.date=pn;const Ht=Z.create;t.symbol=Ht;const pt=X.create;t.undefined=pt;const We=oe.create;t.null=We;const Ke=ie.create;t.any=Ke;const Ze=ge.create;t.unknown=Ze;const Qt=me.create;t.never=Qt;const Cn=q.create;t.void=Cn;const ni=Se.create;t.array=ni;const ri=ne.create;t.object=ri;const xi=ne.strictCreate;t.strictObject=xi;const bi=ue.create;t.union=bi;const Ui=Pe.create;t.discriminatedUnion=Ui;const Wn=Ae.create;t.intersection=Wn;const Sn=Ce.create;t.tuple=Sn;const ii=fe.create;t.record=ii;const Oi=xe.create;t.map=Oi;const Vi=Te.create;t.set=Vi;const wi=Ne.create;t.function=wi;const dn=pe.create;t.lazy=dn;const Gn=re.create;t.literal=Gn;const vn=Oe.create;t.enum=vn;const et=De.create;t.nativeEnum=et;const It=Fe.create;t.promise=It;const yt=Ge.create;t.effect=yt,t.transformer=yt;const Ct=je.create;t.optional=Ct;const gn=gt.create;t.nullable=gn;const on=Ge.createWithPreprocess;t.preprocess=on;const Yt=rt.create;t.pipeline=Yt;const On=()=>kn().optional();t.ostring=On;const Zn=()=>fi().optional();t.onumber=Zn;const ci=()=>zn().optional();t.oboolean=ci,t.coerce={string:nn=>V.create({...nn,coerce:!0}),number:nn=>Y.create({...nn,coerce:!0}),boolean:nn=>H.create({...nn,coerce:!0}),bigint:nn=>z.create({...nn,coerce:!0}),date:nn=>K.create({...nn,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),d=e(41869),_=e(65265),v=e(98295),m=e(27654);let p=n=class extends d.Disposable{constructor(){super(...arguments),this.lantencyHandler=g=>{const{command:a}=g.detail;a===_.DevtoolsLantencyCommand.Start?this.interval||this.startRTTInterval():a===_.DevtoolsLantencyCommand.Stop&&this.interval&&(clearInterval(this.interval),this.interval=void 0)}}initialize(){var g;this.appConfig.devtools&&(window.addEventListener(_.EDevtoolsEvent.Latency,this.lantencyHandler),this.addDispose(d.Disposable.create(()=>{window.removeEventListener(_.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 a=Date.now()-g;window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.captureRPC&&(window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.latency=a)},n.INTERVAL)}};t.ChromeDevtoolsContribution=p,p.INTERVAL=1e3,r.__decorate([(0,o.Autowired)(d.AppConfig),r.__metadata("design:type",Object)],p.prototype,"appConfig",void 0),r.__decorate([(0,o.Autowired)(m.ConnectionRTTBrowserServiceToken),r.__metadata("design:type",m.ConnectionRTTBrowserService)],p.prototype,"rttService",void 0),t.ChromeDevtoolsContribution=p=n=r.__decorate([(0,v.Domain)(d.ClientAppContribution)],p)},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),d=e(26542),_=e(92323),v=e(98295),m=e(27654),p={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:d.StatusBarAlignment.LEFT,priority:1/0-1};let a=n=class{registerCommands(u){u.registerCommand(p,{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=a,a.INTERVAL=1e3,r.__decorate([(0,o.Autowired)(d.IStatusBarService),r.__metadata("design:type",Object)],a.prototype,"statusBarService",void 0),r.__decorate([(0,o.Autowired)(m.ConnectionRTTBrowserServiceToken),r.__metadata("design:type",m.ConnectionRTTBrowserService)],a.prototype,"rttService",void 0),t.ConnectionRTTContribution=a=n=r.__decorate([(0,v.Domain)(_.CommandContribution)],a)},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 d=class{async measure(){await this.connectionBackService.$measure()}};t.ConnectionRTTBrowserService=d,n.__decorate([(0,r.Autowired)(o.ConnectionBackServicePath),n.__metadata("design:type",Object)],d.prototype,"connectionBackService",void 0),t.ConnectionRTTBrowserService=d=n.__decorate([(0,r.Injectable)()],d)},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),d=e(43718),_=e(69452);let v=class extends d.WithEventBus{onDidDropFile(p){this.dropService.onDidDropFile(p)}};t.FileDropContribution=v,n.__decorate([(0,r.Autowired)(_.IFileDropFrontendServiceToken),n.__metadata("design:type",Object)],v.prototype,"dropService",void 0),n.__decorate([(0,d.OnEvent)(d.FileTreeDropEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[d.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),d=e(26542),_=e(43718),v=e(42933),{Path:m}=_.path,p=e(69452);let s=class extends _.WithEventBus{constructor(){super(...arguments),this.pending=new Set}onDidUploadFileStart(a){this.pending.add(a),this.createOrUpdateStatusBar()}onDidUploadFileEnd(a){this.pending.delete(a),this.createOrUpdateStatusBar()}createOrUpdateStatusBar(a){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,a||"0 MB"),l={text:u,alignment:d.StatusBarAlignment.RIGHT,tooltip:u,iconClass:"kaitian-icon kticon-cloud-server"};this.uploadStatus?this.uploadStatus.update({id:h,...l}):this.uploadStatus=this.statusBarService.addElement(h,l)}onDidDropFile(a){var h;const{payload:{event:u,targetDir:l}}=a;if(!l||!(!((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(),w=`${(f/((A-c)/1e3)/1024/1024).toFixed(2)} MB`;this.createOrUpdateStatusBar(w)};for(const b of E){const A=b.webkitGetAsEntry();this.processFilesEntry(l,A,y)}}async processFilesEntry(a,h,u){if(h.isFile)this.processFileEntry(h,a,u);else{const l=_.Uri.file(new m(a).join(h.fullPath).toString()).toString();await this.fs.createFolder(l),this.processDirEntry(h,a,u)}}toBinaryString(a){let h;const u=a.length;let l="";for(h=0;h<u;h+=1)l+=String.fromCharCode(a[h]);return l}async doUploadFile(a,h,u){var l;const E=new m(h).join(a.name).toString();this.onDidUploadFileStart(E.toString()),await this.fs.createFile(_.Uri.file(E.toString()).toString()),await this.dropService.$ensureFileExist(a.name,h);const f=a.stream().getReader();let c=await f.read();for(;!c.done;)await this.dropService.$writeStream(this.toBinaryString(c.value),a.name,h,c.done),u((l=c.value)===null||l===void 0?void 0:l.byteLength),c=await f.read();c.done&&this.onDidUploadFileEnd(E.toString())}processFileEntry(a,h,u){a.file(l=>{const E=new File([l],a.fullPath,{type:a.type});this.doUploadFile(E,h,u)},()=>{})}processDirEntry(a,h,u){a.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)(p.FileDropServicePath),n.__metadata("design:type",Object)],s.prototype,"dropService",void 0),n.__decorate([(0,r.Autowired)(d.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),d=e(41869),_=e(26542),v=e(43718),m=e(98295),p=e(54414),s=e(17459),g=e(84660),a=n.__importStar(e(20868)),h=e(97821),u=e(80490),l=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(T=""){const D=T.match(t.matchLineReg)||[];if(D.length<2)return;const I={line:Number(D[2]||0),start:Number(D[3]||0)};return new a.Range(I.line,I.start,I.line,I.start)}function y(T){return T.replace(t.matchLineReg,"$1")}let b=class extends h.QuickOpenBaseAction{constructor(){super({id:"file-search:splitToRight",tooltip:(0,d.localize)("quickOpen.openOnTheRightSide"),class:(0,d.getIcon)("embed")})}async run(D){await this.commandService.executeCommand(d.EDITOR_COMMANDS.OPEN_RESOURCE.id,D.getUri(),{preview:!1,split:p.EditorGroupSplitAction.Right,range:c(this.injector.get(S).currentLookFor),focus:!0})}};n.__decorate([(0,o.Autowired)(d.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(D){return y(D)}};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,d.localize)("file-search.command.fileOpen.description"),this.prevEditorState={},this.currentLookFor=""}getModel(){return{onType:async(D,I)=>{this.cancelIndicator.cancel(),this.cancelIndicator=new v.CancellationTokenSource;const O=this.cancelIndicator.token,M=new Set;let R=[];D=D.trim().replace(/\s/g,""),this.currentLookFor=D;const P=y(D),k=this.reporterService.time(v.REPORT_NAME.QUICK_OPEN_MEASURE),F=await this.getRecentlyItems(M,P,O);if(D&&(this.logger.debug("lookFor",D,P),R=await this.getFindOutItems(M,P,O)),O.isCancellationRequested)return;const L=F.concat(R);I(L,L.length?this.fileSearchActionProvider:void 0),k.timeEnd(D.indexOf("@")>-1?"file-symbol":"file",{lookFor:D,stat:{recently:F.length,find:R.length}})}}}getOptions(){return{placeholder:(0,d.localize)("file-search.command.fileOpen.placeholder"),fuzzyMatchLabel:{enableSeparateSubstringMatching:!0},showItemsWithoutHighlight:!0,fuzzyMatchDescription:{enableSeparateSubstringMatching:!0},getPlaceholderItem:D=>new d.QuickOpenItem({label:(0,d.localize)(D.indexOf("@")>-1?"search.fileSymbolResults.notfound":"search.fileResults.notfound"),run:()=>!1})}}onClose(D){D&&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 D;if(this.workbenchEditorService.currentResource){let I={startColumn:1,startLineNumber:1,endColumn:1,endLineNumber:1};const O=(D=this.workbenchEditorService.currentEditor)===null||D===void 0?void 0:D.getSelections();if(O){const{selectionStartLineNumber:M,selectionStartColumn:R,positionLineNumber:P,positionColumn:k}=O[0];I=new a.Range(M,R,P,k)}this.prevEditorState={uri:this.workbenchEditorService.currentResource.uri,range:I}}}async getFindOutItems(D,I,O){var M;let R;if(I.indexOf("@")>-1){this.trySaveEditorState(),R=[];const[P,k]=I.split("@");let F;if(this.prevSelected)F=this.prevSelected.withoutFragment();else if(P){const L=await this.getQueryFiles(P,D,O);L.length&&(F=L[0].getUri())}else F=(M=this.workbenchEditorService.currentResource)===null||M===void 0?void 0:M.uri;if(F){const L=await this.documentSymbolStore.getDocumentSymbolAsync(F)||[],B=[];this.flattenSymbols({children:L},B),R=B.filter(W=>{const U=(0,E.matchesFuzzy)(k,W.name,!0)||[];return U&&(W.labelHighlights=U),U&&U.length}).map((W,U)=>{var Q;return new d.QuickOpenItem({uri:F,label:W.name,iconClass:(0,d.getSymbolIcon)(W.kind),description:(Q=W.parent)===null||Q===void 0?void 0:Q.name,labelHighlights:W.labelHighlights,groupLabel:U===0?(0,d.formatLocalize)("search.fileSymbolResults",B.length):"",showBorder:!1,run:V=>V===d.Mode.PREVIEW?(this.locateSymbol(F,W),!0):V===d.Mode.OPEN?(this.locateSymbol(F,W),!0):!1})})}else return[]}else if(R=await this.getQueryFiles(I,D,O),R[0]){const P=await this.getItems([R[0].getUri().codeUri.fsPath],{groupLabel:(0,d.localize)("search.fileResults"),showBorder:!0});R[0]=P[0]}return R}async getQueryFiles(D,I,O){const R=(await this.workspaceService.roots).map(F=>new d.URI(F.uri).codeUri.fsPath),P=await this.fileSearchService.find(D,{rootUris:R,fuzzyMatch:!0,limit:f,useGitIgnore:!0,noIgnoreParent:!0,excludePatterns:this.getPreferenceSearchExcludes()},O),k=await this.getItems(P.filter(F=>I.has(F)||O.isCancellationRequested?!1:(I.add(F),!0)),{});return k.sort(this.compareItems.bind(this)),k}async flattenSymbols(D,I){D.children.forEach(O=>{I.push(O),O.children&&this.flattenSymbols(O,I)})}async getRecentlyItems(D,I,O){const M=await this.recentFilesManager.getMostRecentlyOpenedFiles(!0)||[];return await this.getItems(M.filter(R=>{const P=new d.URI(R);return D.has(R)||!r.default.test(I,P.displayName)||O.isCancellationRequested?!1:(D.add(R),!0)}),{groupLabel:(0,d.localize)("search.historyMatches")})}async getItems(D,I){const O=[];for(const[M,R]of D.entries()){const P=d.URI.isUriString(R)?new d.URI(R):d.URI.file(R),k=`file-icon ${this.labelService.getIcon(P.withoutFragment())}`;let F="";const L=await this.workspaceService.asRelativePath(P.parent);L&&(this.workspaceService.isMultiRootWorkspaceOpened?F=`${new d.URI(L.root).displayName}${L.path?` \u30FB ${L.path}`:""}`:F=L.path||"");const B=new d.QuickOpenItem({uri:P,label:P.displayName,tooltip:R,iconClass:k,description:F,groupLabel:M===0?I.groupLabel:"",showBorder:D.length>0&&M===0?I.showBorder:!1,run:j=>(j===d.Mode.PREVIEW&&(this.prevSelected=P),j===d.Mode.OPEN?(this.openFile(P),!0):!1)});O.push(B)}return O}openFile(D){const I=D.codeUri.fsPath;let O=c(this.currentLookFor);(!O||!O.startLineNumber&&!O.startColumn)&&(O=c(D.fragment?"#"+D.fragment:I)),this.currentLookFor="",this.commandService.executeCommand(d.EDITOR_COMMANDS.OPEN_RESOURCE.id,D.withoutFragment(),{preview:!1,range:O,focus:!0})}locateSymbol(D,I){this.workbenchEditorService.open(D,{range:I.range,preview:!0})}compareItems(D,I,O="getLabel"){function M(j){return j.trim().toLowerCase()}const R=M(y(this.currentLookFor));function P(j){const W=r.default.match(R,j);return W===null?0:W.score}let k=D[O](),F=I[O]();typeof k!="string"&&(k=k.path.toString()),typeof F!="string"&&(F=F.path.toString()),k=M(k),F=M(F);const L=P(k),B=P(F);if(L===B){const j=k.indexOf(R),W=F.indexOf(R);return j===W?k.length!==F.length?k.length<F.length?-1:1:F.localeCompare(k)===0?O==="getUri"?0:this.compareItems(D,I,"getUri"):F.localeCompare(k):j-W}return B-L}getPreferenceSearchExcludes(){const D=[],I=this.preferenceService.get("files.exclude"),O=this.preferenceService.get("search.exclude"),M=Object.assign({},I,O);for(const R of Object.keys(M))M[R]&&D.push(R);return D}};t.FileSearchQuickCommandHandler=S,n.__decorate([(0,o.Autowired)(d.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)(p.WorkbenchEditorService),n.__metadata("design:type",p.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",_.LabelService)],S.prototype,"labelService",void 0),n.__decorate([(0,o.Autowired)(l.IWorkspaceService),n.__metadata("design:type",Object)],S.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(d.RecentFilesManager),n.__metadata("design:type",d.RecentFilesManager)],S.prototype,"recentFilesManager",void 0),n.__decorate([(0,o.Autowired)(d.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)(d.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 w=class{registerQuickOpenHandlers(D){D.registerHandler(this.fileSearchQuickCommandHandler,{title:(0,d.localize)("quickopen.tab.file"),commandId:t.quickFileOpen.id,order:1})}registerCommands(D){D.registerCommand(t.quickFileOpen,{execute:()=>this.quickOpenService.open("...")}),D.registerCommand(t.quickGoToSymbol,{execute:()=>this.quickOpenService.open("...@")})}registerKeybindings(D){D.registerKeybinding({command:t.quickFileOpen.id,keybinding:"ctrlcmd+p"})}};t.FileSearchContribution=w,n.__decorate([(0,o.Autowired)(S),n.__metadata("design:type",S)],w.prototype,"fileSearchQuickCommandHandler",void 0),n.__decorate([(0,o.Autowired)(h.PrefixQuickOpenService),n.__metadata("design:type",Object)],w.prototype,"quickOpenService",void 0),t.FileSearchContribution=w=n.__decorate([(0,m.Domain)(v.CommandContribution,d.KeybindingContribution,u.QuickOpenContribution)],w)},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),d=e(69452),_=e(79682),v=e(72915),m=e(27654),p=e(17631),s=e(22874),g=e(79240),a=e(18256),h=e(7756),u=e(16426);let l=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[_.ChromeDevtoolsContribution,a.LanguageChangeHintContribution,g.FileSearchContribution,h.StatusBarContribution,u.ToolbarCustomizeContribution,p.FileDropContribution,v.ConnectionRTTContribution,{token:d.IFileDropFrontendServiceToken,useClass:s.FileDropService},{token:m.ConnectionRTTBrowserServiceToken,useClass:m.ConnectionRTTBrowserService}],this.backServices=[{servicePath:d.FileDropServicePath},{servicePath:d.ConnectionBackServicePath}]}};t.ClientAddonModule=l,t.ClientAddonModule=l=n.__decorate([(0,r.Injectable)()],l)},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),d=e(72665);let _=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=_,n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],_.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.IClientApp),n.__metadata("design:type",Object)],_.prototype,"clientApp",void 0),n.__decorate([(0,r.Autowired)(d.IDialogService),n.__metadata("design:type",Object)],_.prototype,"dialogService",void 0),t.LanguageChangeHintContribution=_=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],_)},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),d=e(43718);let _=class extends d.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=_,n.__decorate([(0,r.Autowired)(d.CommandService),n.__metadata("design:type",Object)],_.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(d.ILogger),n.__metadata("design:type",Object)],_.prototype,"logger",void 0),n.__decorate([(0,d.OnEvent)(d.BrowserConnectionOpenEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],_.prototype,"handleBrowserConnectionOpen",null),n.__decorate([(0,d.OnEvent)(d.BrowserConnectionCloseEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],_.prototype,"handleBrowserConnectionClose",null),t.StatusBarContribution=_=n.__decorate([(0,d.Domain)(o.ClientAppContribution)],_)},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),d=e(93899),_=e(62132);let v=class{registerCommands(p){p.registerCommand({id:"toolbar.showCustomizePanel",label:"Show Toolbar Customization"},{execute:()=>{this.viewService.setVisible(!0)}})}registerComponent(p){p.register("addon/toolbar-customize",{id:"addon/toolbar-customize",component:_.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(p){p.registerMenuItem(d.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)(_.ToolbarCustomizeViewService),n.__metadata("design:type",_.ToolbarCustomizeViewService)],v.prototype,"viewService",void 0),t.ToolbarCustomizeContribution=v=n.__decorate([(0,o.Domain)(o.CommandContribution,o.ComponentContribution,d.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),d=e(97267),_=e(41869),v=n.__importDefault(e(18541));let m=class{bindSetVisibleHandle(g){this._setVisible=g}setVisible(g){this._setVisible(g)}async toggleActionVisibility(g,a,h){const u=this.preferenceService.getValid("toolbar.ignoreActions",{});if(u[g]||(u[g]=[]),!h)u[g].indexOf(a)===-1&&u[g].push(a);else{const E=u[g].indexOf(a);E!==-1&&u[g].splice(E,1)}const l=this.preferenceService.inspect("toolbar.ignoreActions").workspaceValue?_.PreferenceScope.Workspace:_.PreferenceScope.User;await this.preferenceService.set("toolbar.ignoreActions",u,l)}};t.ToolbarCustomizeViewService=m,n.__decorate([(0,o.Autowired)(_.PreferenceService),n.__metadata("design:type",Object)],m.prototype,"preferenceService",void 0),t.ToolbarCustomizeViewService=m=n.__decorate([(0,o.Injectable)()],m);const p=()=>{const[s,g]=r.default.useState(!1),a=(0,_.useInjectable)(m),h=(0,_.useInjectable)(_.IToolbarRegistry),u=(0,_.useInjectable)(_.PreferenceService);if(a.bindSetVisibleHandle(g),!s)return null;const l=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((w,T)=>{const D=h.getToolbarActions({location:y,group:w.id});D&&D.actions.length>0&&(A.length>0&&A.push(r.default.createElement("div",{className:v.default["group-split"],key:"split-"+T})),D.actions.forEach((I,O)=>{var M;let R=S.indexOf(I.id)===-1;const P="action-toggle-"+I.id;A.push(r.default.createElement("div",{className:v.default["action-item"],key:O+"_"+I.id},r.default.createElement(d.CheckBox,{onChange:()=>{a.toggleActionVisibility(y,I.id,!R),R=!R},defaultChecked:R,id:P,label:(M=I.description)!==null&&M!==void 0?M:I.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"]},l.map(y=>c(y)),r.default.createElement("div",{className:v.default["button-display"]},r.default.createElement("div",null,(0,_.localize)("toolbar-customize.buttonDisplay.description")),r.default.createElement(d.Select,{options:[{label:(0,_.localize)("toolbar-customize.buttonDisplay.icon"),value:"icon"},{label:(0,_.localize)("toolbar-customize.buttonDisplay.iconAndText"),value:"iconAndText"}],value:f,onChange:y=>{const b=u.inspect("toolbar.buttonDisplay").workspaceValue?_.PreferenceScope.Workspace:_.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(d.Button,{type:"primary",onClick:()=>g(!1)},(0,_.localize)("toolbar-customize.complete")))))};t.ToolbarCustomizeComponent=p},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),d=e(50394);let _=class{get contextKeyService(){return this._contextKeyService}constructor(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.inlineChatIsVisible=d.InlineChatIsVisible.bind(this._contextKeyService),this.inlineCompletionIsTrigger=d.InlineCompletionIsTrigger.bind(this._contextKeyService),this.inlineHintWidgetIsVisible=d.InlineHintWidgetIsVisible.bind(this._contextKeyService),this.inlineInputWidgetIsVisible=d.InlineInputWidgetIsVisible.bind(this._contextKeyService),this.inlineInputWidgetIsStreaming=d.InlineInputWidgetIsStreaming.bind(this._contextKeyService),this.inlineDiffPartialEditsIsVisible=d.InlineDiffPartialEditsIsVisible.bind(this._contextKeyService),this.codeEditsIsVisible=d.CodeEditsIsVisible.bind(this._contextKeyService)}};t.AINativeContextKey=_,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],_.prototype,"globalContextKeyService",void 0),t.AINativeContextKey=_=n.__decorate([(0,r.Injectable)(),n.__param(0,(0,r.Optional)()),n.__metadata("design:paramtypes",[Object])],_)},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),d=e(57925),_=e(50394),v=e(1149),m=e(97222),p=e(43718),s=e(82353),g=e(54414),a=e(57517),h=e(51553),u=e(63067),l=e(46507),E=e(97682),f=e(68415),c=e(96640),y=e(19413),b=e(64811),A=e(69820),S=e(61282),w=e(51081),T=e(59347),D=e(76154),I=e(79559),O=e(57232),M=e(72991),R=e(71863),P=e(7511),k=e(42911),F=e(72801),L=e(87817),B=e(4972),j=e(82983),W=e(73974),U=e(33108),Q=e(77633),V=e(51221),$=e(2281),Y=e(31031),z=e(95608),H=e(38890),K=e(77886),Z=e(89060),X=e(74353),oe=e(22169),ie=e(90058);t.INLINE_DIFF_MANAGER_WIDGET_ID="inline-diff-manager-widget";let ge=class{constructor(){this.registerFeature()}async initialize(){const{supportsChatAssistant:q}=this.aiNativeConfigService.capabilities;q&&(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(q){const{supportsInlineChat:Se,supportsInlineCompletion:_e,supportsProblemFix:ne,supportsCodeAction:ue}=this.aiNativeConfigService.capabilities;q(H.InlineDiffController.ID,new c.SyncDescriptor(H.InlineDiffController,[this.injector]),E.EditorContributionInstantiation.Lazy),ue&&q(ie.SumiLightBulbWidget.ID,ie.SumiLightBulbWidget,E.EditorContributionInstantiation.Lazy),Se&&(q(V.InlineChatEditorController.ID,new c.SyncDescriptor(V.InlineChatEditorController,[this.injector]),E.EditorContributionInstantiation.BeforeFirstInteraction),this.inlineInputService.getInteractiveInputHandler()&&(q(K.InlineHintController.ID,new c.SyncDescriptor(K.InlineHintController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender),q(Z.InlineInputController.ID,new c.SyncDescriptor(Z.InlineInputController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender))),_e&&(q(P.IntelligentCompletionsController.ID,new c.SyncDescriptor(P.IntelligentCompletionsController,[this.injector]),E.EditorContributionInstantiation.Eager),q(M.InlineCompletionsController.ID,new c.SyncDescriptor(M.InlineCompletionsController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender)),ne&&q(k.ProblemFixController.ID,new c.SyncDescriptor(k.ProblemFixController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender)}onReconnect(){const{supportsMCP:q}=this.aiNativeConfigService.capabilities;q&&this.initMCPServers()}onDidStart(){(0,p.runWhenIdle)(()=>{const{supportsRenameSuggestions:q,supportsInlineChat:Se,supportsMCP:_e,supportsCustomLLMSettings:ne}=this.aiNativeConfigService.capabilities,ue=this.preferenceService.getValid(o.AINativeSettingSectionsId.ChatVisibleType);ue==="always"?this.commandService.executeCommand(d.AI_CHAT_VISIBLE.id,!0):ue==="never"&&this.commandService.executeCommand(d.AI_CHAT_VISIBLE.id,!1),q&&this.renameSingleHandler.load(),Se&&this.codeActionSingleHandler.load(),ne&&(this.preferenceService.onSpecificPreferenceChange(o.AINativeSettingSectionsId.LLMModelSelection,Ie=>{const Pe=this.getModelByName(Ie.newValue),ve=Pe?Object.keys(Pe):[],Ae=ve.length?ve[0]:"",Ce=this.preferenceSchemaProvider.getPreferenceProperty(o.AINativeSettingSectionsId.ModelID);this.preferenceSchemaProvider.setSchema({properties:{[o.AINativeSettingSectionsId.ModelID]:{...Ce,default:Ae,defaultValue:Ae,enum:ve.length?ve:void 0}}},!0),this.preferenceService.set(o.AINativeSettingSectionsId.ModelID,Ae,Ie.scope),this.preferenceSettings.setEnumLabels(o.AINativeSettingSectionsId.ModelID,ve.reduce((fe,xe)=>({...fe,[xe]:xe}),{}))}),this.preferenceService.onSpecificPreferenceChange(o.AINativeSettingSectionsId.ModelID,Ie=>{const Pe=this.preferenceService.get(o.AINativeSettingSectionsId.LLMModelSelection);if(!Pe)return;const ve=this.getModelByName(Pe);ve&&ve[Ie.newValue]&&(this.preferenceService.set(o.AINativeSettingSectionsId.MaxTokens,ve[Ie.newValue].maxTokens,Ie.scope),this.preferenceService.set(o.AINativeSettingSectionsId.ContextWindow,ve[Ie.newValue].contextWindow,Ie.scope))})),_e&&this.initMCPServers()})}async initMCPServers(){var q;const Se=await this.storageProvider(p.STORAGE_NAMESPACE.CHAT);let _e=Se.get(b.MCPServersEnabledKey,[y.BUILTIN_MCP_SERVER_NAME]);const ne=this.preferenceService.get(o.AINativeSettingSectionsId.MCPServers,[]);let ue=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0);if(ue.scope===p.PreferenceScope.Default&&ne.length>0){const Pe={mcpServers:[]},ve=new Set([y.BUILTIN_MCP_SERVER_NAME]);ne.forEach(Ae=>{Ae.type===A.MCP_SERVER_TYPE.SSE?Pe.mcpServers.push({[Ae.name]:{url:Ae.serverHost}}):Ae.type===A.MCP_SERVER_TYPE.STDIO&&Pe.mcpServers.push({[Ae.name]:{command:Ae.command,args:Ae.args,env:Ae.env}}),Ae.enabled&&ve.add(Ae.name)}),await this.preferenceService.set("mcp",Pe,p.PreferenceScope.Workspace),ue=this.preferenceService.resolve("mcp",void 0,void 0),_e=Array.from(ve),Se.set(b.MCPServersEnabledKey,_e)}const Ie=(q=ue.value)===null||q===void 0?void 0:q.mcpServers;if(this.sumiMCPServerBackendProxy.$initBuiltinMCPServer(_e.includes(y.BUILTIN_MCP_SERVER_NAME)),Ie&&Ie.length>0){const Pe=(await Promise.all(Ie.map(async ve=>{const Ae=Object.keys(ve)[0];return await this.mcpConfigService.getServerConfigByName(Ae)}))).filter(ve=>ve!==void 0);await this.sumiMCPServerBackendProxy.$initExternalMCPServers(Pe),this.mcpConfigService.fireMCPServersChange(!0)}}getModelByName(q){switch(q){case"deepseek":return y.deepSeekModels;case"anthropic":return y.anthropicModels;case"openai":return y.openAiNativeModels;default:return}}registerFeature(){this.contributions.getContributions().forEach(q=>{var Se,_e,ne,ue,Ie,Pe,ve,Ae,Ce;(Se=q.registerInlineChatFeature)===null||Se===void 0||Se.call(q,this.inlineChatFeatureRegistry),(_e=q.registerChatFeature)===null||_e===void 0||_e.call(q,this.chatFeatureRegistry),(ne=q.registerResolveConflictFeature)===null||ne===void 0||ne.call(q,this.resolveConflictRegistry),(ue=q.registerRenameProvider)===null||ue===void 0||ue.call(q,this.renameCandidatesProviderRegistry),(Ie=q.registerChatRender)===null||Ie===void 0||Ie.call(q,this.chatRenderRegistry),(Pe=q.registerTerminalProvider)===null||Pe===void 0||Pe.call(q,this.terminalProviderRegistry),(ve=q.registerIntelligentCompletionFeature)===null||ve===void 0||ve.call(q,this.intelligentCompletionsRegistry),(Ae=q.registerProblemFixFeature)===null||Ae===void 0||Ae.call(q,this.problemFixProviderRegistry),(Ce=q.registerChatAgentPromptProvider)===null||Ce===void 0||Ce.call(q)}),this.mcpServerContributions.getContributions().forEach(q=>{q.registerMCPServer(this.mcpServerRegistry)})}registerSetting(q){q.registerSettingGroup({id:o.AI_NATIVE_SETTING_GROUP_ID,title:p.AI_NATIVE_SETTING_GROUP_TITLE,iconClass:(0,o.getIcon)("magic-wand")}),q.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"}]}),q.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&&(q.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"}]}),q.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&&q.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&&q.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"}]}),this.aiNativeConfigService.capabilities.supportsInlineChat&&q.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(q){q.registerEditorFeatureContribution({contribute:Se=>{const{monacoEditor:_e}=Se;return this.codeActionSingleHandler.mountEditor(Se.monacoEditor),_e.onDidScrollChange(()=>{this.ctxMenuRenderer.visible&&this.ctxMenuRenderer.hide(!0)})}})}registerEditorComponent(q){q.registerEditorSideWidget({id:t.INLINE_DIFF_MANAGER_WIDGET_ID,component:z.InlineDiffManager,displaysOnResource:Se=>{var _e;return!!(this.aiNativeConfigService.capabilities.supportsMCP&&(!((_e=this.applyService.getUriCodeBlocks(Se.uri))===null||_e===void 0)&&_e.filter(ne=>ne.status==="pending").length))}})}registerCommands(q){q.registerCommand(d.AI_INLINE_CHAT_VISIBLE,{execute:Se=>{this.aiInlineChatService._onInlineChatVisible.fire(Se)}}),q.registerCommand(d.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE,{execute:async Se=>{var _e;if(!Se){this.inlineInputService.hide();return}this.commandService.executeCommand(d.AI_INLINE_CHAT_VISIBLE.id,!1);const ne=this.workbenchEditorService.currentCodeEditor;if(!ne)return;const ue=ne.monacoEditor.getPosition();if(!ue)return;const Ie=ne.monacoEditor.getSelection();if(ue?((_e=ne.monacoEditor.getModel())===null||_e===void 0?void 0:_e.getLineLength(ue.lineNumber))===0:!1){this.inlineInputService.visibleByPosition(ue);return}if(Ie&&!Ie.isEmpty()){this.inlineInputService.visibleBySelection(Ie);return}this.inlineInputService.visibleByNearestCodeBlock(ue,ne.monacoEditor)}}),q.registerCommand(d.AI_INLINE_CHAT_INTERACTIVE_INPUT_CANCEL,{execute:()=>{var Se;const _e=this.workbenchEditorService.currentCodeEditor;_e&&((Se=Z.InlineInputController.get(_e.monacoEditor))===null||Se===void 0||Se.cancelToken())}}),q.registerCommand(d.AI_INLINE_COMPLETION_REPORTER,{execute:(Se,_e,ne,ue)=>{this.aiCompletionsService.report({sessionId:_e,accept:ne,relationId:Se,code:ue})}}),q.registerCommand(d.AI_CHAT_VISIBLE,{execute:Se=>{this.layoutService.toggleSlot(y.AI_CHAT_VIEW_ID,(0,p.isUndefined)(Se)?!0:Se)}}),q.registerCommand(d.AI_INLINE_COMPLETION_VISIBLE,{execute:async Se=>{Se||(this.aiCompletionsService.hideStatusBarItem(),this.aiInlineCompletionsProvider.setVisibleCompletion(!1),this.aiInlineCompletionsProvider.cancelRequest())}}),q.registerCommand(d.AI_INLINE_DIFF_PARTIAL_EDIT,{execute:Se=>{this.inlineStreamDiffService.launchAcceptDiscardPartialEdit(Se)}}),q.afterExecuteCommand(f.HideInlineCompletion.ID,()=>{this.commandService.executeCommand(d.AI_INLINE_COMPLETION_VISIBLE.id,!1)})}registerRenderer(q){this.designLayoutConfig.supportExternalChatPanel?q.registerSlotRenderer(y.AI_CHAT_VIEW_ID,B.AIChatTabRendererWithTab):q.registerSlotRenderer(y.AI_CHAT_VIEW_ID,B.AIChatTabRenderer),this.designLayoutConfig.useMergeRightWithLeftPanel&&(q.registerSlotRenderer(o.SlotLocation.left,B.AILeftTabRenderer),q.registerSlotRenderer(o.SlotLocation.right,B.AIRightTabRenderer))}registerComponent(q){q.register(y.AI_CHAT_CONTAINER_ID,[],{component:D.AIChatView,title:(0,o.localize)("aiNative.chat.ai.assistant.name"),iconClass:(0,o.getIcon)("magic-wand"),containerId:y.AI_CHAT_CONTAINER_ID}),q.register(y.AI_MENU_BAR_DEBUG_TOOLBAR,{id:y.AI_MENU_BAR_DEBUG_TOOLBAR,component:L.AIRunToolbar}),q.register(y.AI_CHAT_LOGO_AVATAR_ID,{id:y.AI_CHAT_LOGO_AVATAR_ID,component:j.AIChatLogoAvatar})}registerKeybindings(q){this.aiNativeConfigService.capabilities.supportsInlineChat&&(q.registerKeybinding({command:d.AI_INLINE_CHAT_VISIBLE.id,keybinding:"ctrlcmd+i",when:"editorTextFocus",args:!0,priority:0},o.KeybindingScope.USER),q.registerKeybinding({command:d.AI_INLINE_CHAT_VISIBLE.id,keybinding:"esc",args:!1,when:`editorFocus && ${_.InlineChatIsVisible.raw}`}),this.inlineInputService.getInteractiveInputHandler()&&(q.registerKeybinding({command:d.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:this.aiNativeConfigService.inlineChat.inputKeybinding,args:!0,priority:0,when:`editorFocus && (${_.InlineChatIsVisible.raw} || inlineSuggestionVisible)`},o.KeybindingScope.USER),q.registerKeybinding({command:d.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:"esc",args:!1,priority:0,when:`editorFocus && ${_.InlineInputWidgetIsVisible.raw}`}),q.registerKeybinding({command:d.AI_INLINE_CHAT_INTERACTIVE_INPUT_CANCEL.id,keybinding:"esc",priority:1,when:`editorFocus && ${_.InlineInputWidgetIsStreaming.raw}`}),q.registerKeybinding({command:d.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:this.aiNativeConfigService.inlineChat.inputKeybinding,args:!0,priority:0,when:`editorFocus && ${_.InlineHintWidgetIsVisible.raw} && ${_.InlineChatIsVisible.not}`},o.KeybindingScope.USER))),q.registerKeybinding({command:d.AI_INLINE_DIFF_PARTIAL_EDIT.id,keybinding:"ctrl+y",args:!0,priority:100,when:`editorTextFocus && ${_.InlineDiffPartialEditsIsVisible.raw}`}),q.registerKeybinding({command:d.AI_INLINE_DIFF_PARTIAL_EDIT.id,keybinding:"ctrl+n",args:!1,priority:100,when:`editorTextFocus && ${_.InlineDiffPartialEditsIsVisible.raw}`})}};t.AINativeBrowserContribution=ge,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],ge.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],ge.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(m.IBrowserCtxMenu),n.__metadata("design:type",m.IBrowserCtxMenu)],ge.prototype,"ctxMenuRenderer",void 0),n.__decorate([(0,r.Autowired)(Q.AINativeCoreContribution),n.__metadata("design:type",Object)],ge.prototype,"contributions",void 0),n.__decorate([(0,r.Autowired)(Q.MCPServerContribution),n.__metadata("design:type",Object)],ge.prototype,"mcpServerContributions",void 0),n.__decorate([(0,r.Autowired)(Q.TokenMCPServerRegistry),n.__metadata("design:type",Object)],ge.prototype,"mcpServerRegistry",void 0),n.__decorate([(0,r.Autowired)(p.InlineChatFeatureRegistryToken),n.__metadata("design:type",$.InlineChatFeatureRegistry)],ge.prototype,"inlineChatFeatureRegistry",void 0),n.__decorate([(0,r.Autowired)(p.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"chatFeatureRegistry",void 0),n.__decorate([(0,r.Autowired)(p.ChatRenderRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"chatRenderRegistry",void 0),n.__decorate([(0,r.Autowired)(p.ResolveConflictRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"resolveConflictRegistry",void 0),n.__decorate([(0,r.Autowired)(p.RenameCandidatesProviderRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"renameCandidatesProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(p.TerminalRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"terminalProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(p.IntelligentCompletionsRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"intelligentCompletionsRegistry",void 0),n.__decorate([(0,r.Autowired)(p.ProblemFixRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"problemFixProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],ge.prototype,"aiNativeConfigService",void 0),n.__decorate([(0,r.Autowired)(v.DesignLayoutConfig),n.__metadata("design:type",v.DesignLayoutConfig)],ge.prototype,"designLayoutConfig",void 0),n.__decorate([(0,r.Autowired)(R.AICompletionsService),n.__metadata("design:type",R.AICompletionsService)],ge.prototype,"aiCompletionsService",void 0),n.__decorate([(0,r.Autowired)(O.AIInlineCompletionsProvider),n.__metadata("design:type",O.AIInlineCompletionsProvider)],ge.prototype,"aiInlineCompletionsProvider",void 0),n.__decorate([(0,r.Autowired)(p.CommandService),n.__metadata("design:type",Object)],ge.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceSchemaProvider),n.__metadata("design:type",o.PreferenceSchemaProvider)],ge.prototype,"preferenceSchemaProvider",void 0),n.__decorate([(0,r.Autowired)(o.IPreferenceSettingsService),n.__metadata("design:type",Object)],ge.prototype,"preferenceSettings",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],ge.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(u.IMainLayoutService),n.__metadata("design:type",Object)],ge.prototype,"layoutService",void 0),n.__decorate([(0,r.Autowired)(y.ChatProxyServiceToken),n.__metadata("design:type",w.ChatProxyService)],ge.prototype,"chatProxyService",void 0),n.__decorate([(0,r.Autowired)(o.IAIInlineChatService),n.__metadata("design:type",Y.InlineChatService)],ge.prototype,"aiInlineChatService",void 0),n.__decorate([(0,r.Autowired)(X.InlineInputService),n.__metadata("design:type",X.InlineInputService)],ge.prototype,"inlineInputService",void 0),n.__decorate([(0,r.Autowired)(oe.InlineStreamDiffService),n.__metadata("design:type",oe.InlineStreamDiffService)],ge.prototype,"inlineStreamDiffService",void 0),n.__decorate([(0,r.Autowired)(F.RenameSingleHandler),n.__metadata("design:type",F.RenameSingleHandler)],ge.prototype,"renameSingleHandler",void 0),n.__decorate([(0,r.Autowired)(I.CodeActionSingleHandler),n.__metadata("design:type",I.CodeActionSingleHandler)],ge.prototype,"codeActionSingleHandler",void 0),n.__decorate([(0,r.Autowired)(y.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],ge.prototype,"sumiMCPServerBackendProxy",void 0),n.__decorate([(0,r.Autowired)(p.MCPConfigServiceToken),n.__metadata("design:type",U.MCPConfigService)],ge.prototype,"mcpConfigService",void 0),n.__decorate([(0,r.Autowired)(g.WorkbenchEditorService),n.__metadata("design:type",h.WorkbenchEditorServiceImpl)],ge.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(y.IChatManagerService),n.__metadata("design:type",S.ChatManagerService)],ge.prototype,"chatManagerService",void 0),n.__decorate([(0,r.Autowired)(y.IChatInternalService),n.__metadata("design:type",T.ChatInternalService)],ge.prototype,"chatInternalService",void 0),n.__decorate([(0,r.Autowired)(W.BaseApplyService),n.__metadata("design:type",W.BaseApplyService)],ge.prototype,"applyService",void 0),n.__decorate([(0,r.Autowired)(p.StorageProvider),n.__metadata("design:type",Function)],ge.prototype,"storageProvider",void 0),t.AINativeBrowserContribution=ge=n.__decorate([(0,o.Domain)(o.ClientAppContribution,a.BrowserEditorContribution,o.CommandContribution,l.SettingContribution,o.KeybindingContribution,o.ComponentContribution,o.SlotRendererContribution,o.MonacoContribution),n.__metadata("design:paramtypes",[])],ge)},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),d=e(57517),_=e(19413),v=e(73974),m=e(51081);let p=class extends v.BaseApplyService{async doApply(g){const a=new o.URI(o.path.join(this.appConfig.workspaceDir,g.relativePath)),u=(await this.modelService.createModelReference(a)).instance.getMonacoModel().getValue();return{stream:await this.aiBackService.requestStream(`Merge all changes from the <update> snippet into the <code> below.
31404
+ ${JSON.stringify(r,null,2)}`);const d=n[o]();return new Language(INTERNAL,d)})}}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,d,_,v){assertInternal(t),this[0]=e,this.captureNames=n,this.textPredicates=r,this.predicates=o,this.setProperties=d,this.assertedProperties=_,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:d=4294967295,maxStartDepth:_=4294967295}={}){if(typeof d!="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,d,_);const v=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),p=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),s=new Array(v);this.exceededMatchLimit=!!p;let g=0,a=m;for(let h=0;h<v;h++){const u=getValue(a,"i32");a+=SIZE_OF_INT;const l=getValue(a,"i32");a+=SIZE_OF_INT;const E=new Array(l);if(a=unmarshalCaptures(this,t.tree,a,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:d=4294967295,maxStartDepth:_=4294967295}={}){if(typeof d!="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,d,_);const v=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),p=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),s=[];this.exceededMatchLimit=!!p;const g=[];let a=m;for(let h=0;h<v;h++){const u=getValue(a,"i32");a+=SIZE_OF_INT;const l=getValue(a,"i32");a+=SIZE_OF_INT;const E=getValue(a,"i32");if(a+=SIZE_OF_INT,g.length=l,a=unmarshalCaptures(this,t.tree,a,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 d=getValue(e,"i32"),_=unmarshalNode(t,e+=SIZE_OF_INT);e+=SIZE_OF_NODE,n[r]={name:x.captureNames[d],node:_}}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"),d=getValue(t+=SIZE_OF_INT,"i32"),_=new Node(INTERNAL,x);return _.id=e,_.startIndex=n,_.startPosition={row:r,column:o},_[0]=d,_}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),d=e(79818),_=e(69336),v=d("Object.prototype.toString"),m=e(51913)(),p=typeof globalThis>"u"?e.g:globalThis,s=r(),g=d("String.prototype.slice"),a=Object.getPrototypeOf,h=d("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&&_&&a?n(s,function(f){var c=new p[f];if(Symbol.toStringTag in c){var y=a(c),b=_(y,Symbol.toStringTag);if(!b){var A=a(y);b=_(A,Symbol.toStringTag)}u["$"+f]=o(b.get)}}):n(s,function(f){var c=new p[f],y=c.slice||c.set;y&&(u["$"+f]=o(y))});var l=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 _?l(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=d=>JSON.stringify(d,null,2).replace(/"([^"]+)":/g,"$1:");t.quotelessJson=r;class o extends Error{get errors(){return this.issues}constructor(_){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=_}format(_){const v=_||function(s){return s.message},m={_errors:[]},p=s=>{for(const g of s.issues)if(g.code==="invalid_union")g.unionErrors.map(p);else if(g.code==="invalid_return_type")p(g.returnTypeError);else if(g.code==="invalid_arguments")p(g.argumentsError);else if(g.path.length===0)m._errors.push(v(g));else{let a=m,h=0;for(;h<g.path.length;){const u=g.path[h];h===g.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(v(g))):a[u]=a[u]||{_errors:[]},a=a[u],h++}}};return p(this),m}static assert(_){if(!(_ instanceof o))throw new Error(`Not a ZodError: ${_}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,n.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(_=v=>v.message){const v={},m=[];for(const p of this.issues)p.path.length>0?(v[p.path[0]]=v[p.path[0]]||[],v[p.path[0]].push(_(p))):m.push(_(p));return{formErrors:m,fieldErrors:v}}get formErrors(){return this.flatten()}}t.ZodError=o,o.create=d=>new o(d)},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 d(v){o=v}t.setErrorMap=d;function _(){return o}t.getErrorMap=_},86340:function(x,t,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(o,d,_,v){v===void 0&&(v=_);var m=Object.getOwnPropertyDescriptor(d,_);(!m||("get"in m?!d.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return d[_]}}),Object.defineProperty(o,v,m)}:function(o,d,_,v){v===void 0&&(v=_),o[v]=d[_]}),r=this&&this.__exportStar||function(o,d){for(var _ in o)_!=="default"&&!Object.prototype.hasOwnProperty.call(d,_)&&n(d,o,_)};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)),d=u=>{const{data:l,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(w=>!!w).slice().reverse();for(const w of S)A=w(b,{data:l,defaultError:A}).message;return{...c,path:y,message:A}};t.makeIssue=d,t.EMPTY_PATH=[];function _(u,l){const E=(0,r.getErrorMap)(),f=(0,t.makeIssue)({issueData:l,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=_;class v{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(l,E){const f=[];for(const c of E){if(c.status==="aborted")return t.INVALID;c.status==="dirty"&&l.dirty(),f.push(c.value)}return{status:l.value,value:f}}static async mergeObjectAsync(l,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(l,f)}static mergeObjectSync(l,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"&&l.dirty(),b.status==="dirty"&&l.dirty(),y.value!=="__proto__"&&(typeof b.value<"u"||c.alwaysSet)&&(f[y.value]=b.value)}return{status:l.value,value:f}}}t.ParseStatus=v,t.INVALID=Object.freeze({status:"aborted"});const m=u=>({status:"dirty",value:u});t.DIRTY=m;const p=u=>({status:"valid",value:u});t.OK=p;const s=u=>u.status==="aborted";t.isAborted=s;const g=u=>u.status==="dirty";t.isDirty=g;const a=u=>u.status==="valid";t.isValid=a;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 d(m){}o.assertIs=d;function _(m){throw new Error}o.assertNever=_,o.arrayToEnum=m=>{const p={};for(const s of m)p[s]=s;return p},o.getValidEnumValues=m=>{const p=o.objectKeys(m).filter(g=>typeof m[m[g]]!="number"),s={};for(const g of p)s[g]=m[g];return o.objectValues(s)},o.objectValues=m=>o.objectKeys(m).map(function(p){return m[p]}),o.objectKeys=typeof Object.keys=="function"?m=>Object.keys(m):m=>{const p=[];for(const s in m)Object.prototype.hasOwnProperty.call(m,s)&&p.push(s);return p},o.find=(m,p)=>{for(const s of m)if(p(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,p=" | "){return m.map(s=>typeof s=="string"?`'${s}'`:s).join(p)}o.joinValues=v,o.jsonStringifyReplacer=(m,p)=>typeof p=="bigint"?p.toString():p})(e||(t.util=e={}));var n;(function(o){o.mergeShapes=(d,_)=>({...d,..._})})(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,p,s){s===void 0&&(s=p);var g=Object.getOwnPropertyDescriptor(m,p);(!g||("get"in g?!m.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return m[p]}}),Object.defineProperty(v,s,g)}:function(v,m,p,s){s===void 0&&(s=p),v[s]=m[p]}),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 p in v)p!=="default"&&Object.prototype.hasOwnProperty.call(v,p)&&n(m,v,p);return r(m,v),m},d=this&&this.__exportStar||function(v,m){for(var p in v)p!=="default"&&!Object.prototype.hasOwnProperty.call(m,p)&&n(m,v,p)};Object.defineProperty(t,"__esModule",{value:!0}),t.z=void 0;const _=o(e(86340));t.z=_,d(e(86340),t),t.default=_},28412:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(94705),r=e(97442),o=(d,_)=>{let v;switch(d.code){case r.ZodIssueCode.invalid_type:d.received===n.ZodParsedType.undefined?v="Required":v=`Expected ${d.expected}, received ${d.received}`;break;case r.ZodIssueCode.invalid_literal:v=`Invalid literal value, expected ${JSON.stringify(d.expected,n.util.jsonStringifyReplacer)}`;break;case r.ZodIssueCode.unrecognized_keys:v=`Unrecognized key(s) in object: ${n.util.joinValues(d.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(d.options)}`;break;case r.ZodIssueCode.invalid_enum_value:v=`Invalid enum value. Expected ${n.util.joinValues(d.options)}, received '${d.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 d.validation=="object"?"includes"in d.validation?(v=`Invalid input: must include "${d.validation.includes}"`,typeof d.validation.position=="number"&&(v=`${v} at one or more positions greater than or equal to ${d.validation.position}`)):"startsWith"in d.validation?v=`Invalid input: must start with "${d.validation.startsWith}"`:"endsWith"in d.validation?v=`Invalid input: must end with "${d.validation.endsWith}"`:n.util.assertNever(d.validation):d.validation!=="regex"?v=`Invalid ${d.validation}`:v="Invalid";break;case r.ZodIssueCode.too_small:d.type==="array"?v=`Array must contain ${d.exact?"exactly":d.inclusive?"at least":"more than"} ${d.minimum} element(s)`:d.type==="string"?v=`String must contain ${d.exact?"exactly":d.inclusive?"at least":"over"} ${d.minimum} character(s)`:d.type==="number"?v=`Number must be ${d.exact?"exactly equal to ":d.inclusive?"greater than or equal to ":"greater than "}${d.minimum}`:d.type==="date"?v=`Date must be ${d.exact?"exactly equal to ":d.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(d.minimum))}`:v="Invalid input";break;case r.ZodIssueCode.too_big:d.type==="array"?v=`Array must contain ${d.exact?"exactly":d.inclusive?"at most":"less than"} ${d.maximum} element(s)`:d.type==="string"?v=`String must contain ${d.exact?"exactly":d.inclusive?"at most":"under"} ${d.maximum} character(s)`:d.type==="number"?v=`Number must be ${d.exact?"exactly":d.inclusive?"less than or equal to":"less than"} ${d.maximum}`:d.type==="bigint"?v=`BigInt must be ${d.exact?"exactly":d.inclusive?"less than or equal to":"less than"} ${d.maximum}`:d.type==="date"?v=`Date must be ${d.exact?"exactly":d.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(d.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 ${d.multipleOf}`;break;case r.ZodIssueCode.not_finite:v="Number must be finite";break;default:v=_.defaultError,n.util.assertNever(d)}return{message:v}};t.default=o},75226:function(x,t,e){"use strict";var n=this&&this.__classPrivateFieldGet||function(nn,nt,jt,qt){if(jt==="a"&&!qt)throw new TypeError("Private accessor was defined without a getter");if(typeof nt=="function"?nn!==nt||!qt:!nt.has(nn))throw new TypeError("Cannot read private member from an object whose class did not declare it");return jt==="m"?qt:jt==="a"?qt.call(nn):qt?qt.value:nt.get(nn)},r=this&&this.__classPrivateFieldSet||function(nn,nt,jt,qt,In){if(qt==="m")throw new TypeError("Private method is not writable");if(qt==="a"&&!In)throw new TypeError("Private accessor was defined without a setter");if(typeof nt=="function"?nn!==nt||!In:!nt.has(nn))throw new TypeError("Cannot write private member to an object whose class did not declare it");return qt==="a"?In.call(nn,jt):In?In.value=jt:nt.set(nn,jt),jt},o,d;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 _=e(30548),v=e(15759),m=e(66258),p=e(94705),s=e(97442);class g{constructor(nt,jt,qt,In){this._cachedPath=[],this.parent=nt,this.data=jt,this._path=qt,this._key=In}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 a=(nn,nt)=>{if((0,m.isValid)(nt))return{success:!0,data:nt.value};if(!nn.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const jt=new s.ZodError(nn.common.issues);return this._error=jt,this._error}}};function h(nn){if(!nn)return{};const{errorMap:nt,invalid_type_error:jt,required_error:qt,description:In}=nn;if(nt&&(jt||qt))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return nt?{errorMap:nt,description:In}:{errorMap:(Bi,Mi)=>{var Xi,yi;const{message:Zi}=nn;return Bi.code==="invalid_enum_value"?{message:Zi??Mi.defaultError}:typeof Mi.data>"u"?{message:(Xi=Zi??qt)!==null&&Xi!==void 0?Xi:Mi.defaultError}:Bi.code!=="invalid_type"?{message:Mi.defaultError}:{message:(yi=Zi??jt)!==null&&yi!==void 0?yi:Mi.defaultError}},description:In}}class u{get description(){return this._def.description}_getType(nt){return(0,p.getParsedType)(nt.data)}_getOrReturnCtx(nt,jt){return jt||{common:nt.parent.common,data:nt.data,parsedType:(0,p.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,p.getParsedType)(nt.data),schemaErrorMap:this._def.errorMap,path:nt.path,parent:nt.parent}}}_parseSync(nt){const jt=this._parse(nt);if((0,m.isAsync)(jt))throw new Error("Synchronous parse encountered promise.");return jt}_parseAsync(nt){const jt=this._parse(nt);return Promise.resolve(jt)}parse(nt,jt){const qt=this.safeParse(nt,jt);if(qt.success)return qt.data;throw qt.error}safeParse(nt,jt){var qt;const In={common:{issues:[],async:(qt=jt?.async)!==null&&qt!==void 0?qt:!1,contextualErrorMap:jt?.errorMap},path:jt?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:nt,parsedType:(0,p.getParsedType)(nt)},jn=this._parseSync({data:nt,path:In.path,parent:In});return a(In,jn)}"~validate"(nt){var jt,qt;const In={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:nt,parsedType:(0,p.getParsedType)(nt)};if(!this["~standard"].async)try{const jn=this._parseSync({data:nt,path:[],parent:In});return(0,m.isValid)(jn)?{value:jn.value}:{issues:In.common.issues}}catch(jn){!((qt=(jt=jn?.message)===null||jt===void 0?void 0:jt.toLowerCase())===null||qt===void 0)&&qt.includes("encountered")&&(this["~standard"].async=!0),In.common={issues:[],async:!0}}return this._parseAsync({data:nt,path:[],parent:In}).then(jn=>(0,m.isValid)(jn)?{value:jn.value}:{issues:In.common.issues})}async parseAsync(nt,jt){const qt=await this.safeParseAsync(nt,jt);if(qt.success)return qt.data;throw qt.error}async safeParseAsync(nt,jt){const qt={common:{issues:[],contextualErrorMap:jt?.errorMap,async:!0},path:jt?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:nt,parsedType:(0,p.getParsedType)(nt)},In=this._parse({data:nt,path:qt.path,parent:qt}),jn=await((0,m.isAsync)(In)?In:Promise.resolve(In));return a(qt,jn)}refine(nt,jt){const qt=In=>typeof jt=="string"||typeof jt>"u"?{message:jt}:typeof jt=="function"?jt(In):jt;return this._refinement((In,jn)=>{const Bi=nt(In),Mi=()=>jn.addIssue({code:s.ZodIssueCode.custom,...qt(In)});return typeof Promise<"u"&&Bi instanceof Promise?Bi.then(Xi=>Xi?!0:(Mi(),!1)):Bi?!0:(Mi(),!1)})}refinement(nt,jt){return this._refinement((qt,In)=>nt(qt)?!0:(In.addIssue(typeof jt=="function"?jt(qt,In):jt),!1))}_refinement(nt){return new Ge({schema:this,typeName:bt.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:jt=>this["~validate"](jt)}}optional(){return je.create(this,this._def)}nullable(){return gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Se.create(this)}promise(){return Fe.create(this,this._def)}or(nt){return ue.create([this,nt],this._def)}and(nt){return Ae.create(this,nt,this._def)}transform(nt){return new Ge({...h(this._def),schema:this,typeName:bt.ZodEffects,effect:{type:"transform",transform:nt}})}default(nt){const jt=typeof nt=="function"?nt:()=>nt;return new ot({...h(this._def),innerType:this,defaultValue:jt,typeName:bt.ZodDefault})}brand(){return new At({typeName:bt.ZodBranded,type:this,...h(this._def)})}catch(nt){const jt=typeof nt=="function"?nt:()=>nt;return new Mt({...h(this._def),innerType:this,catchValue:jt,typeName:bt.ZodCatch})}describe(nt){const jt=this.constructor;return new jt({...this._def,description:nt})}pipe(nt){return rt.create(this,nt)}readonly(){return st.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 l=/^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,w="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let T;const D=/^(?:(?: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])$/,I=/^(?:(?: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])$/,O=/^(([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]))$/,M=/^(([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])$/,R=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,P=/^([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(nn){let nt="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return nn.precision?nt=`${nt}\\.\\d{${nn.precision}}`:nn.precision==null&&(nt=`${nt}(\\.\\d+)?`),nt}function B(nn){return new RegExp(`^${L(nn)}$`)}function j(nn){let nt=`${k}T${L(nn)}`;const jt=[];return jt.push(nn.local?"Z?":"Z"),nn.offset&&jt.push("([+-]\\d{2}:?\\d{2})"),nt=`${nt}(${jt.join("|")})`,new RegExp(`^${nt}$`)}t.datetimeRegex=j;function W(nn,nt){return!!((nt==="v4"||!nt)&&D.test(nn)||(nt==="v6"||!nt)&&O.test(nn))}function U(nn,nt){if(!b.test(nn))return!1;try{const[jt]=nn.split("."),qt=jt.replace(/-/g,"+").replace(/_/g,"/").padEnd(jt.length+(4-jt.length%4)%4,"="),In=JSON.parse(atob(qt));return!(typeof In!="object"||In===null||!In.typ||!In.alg||nt&&In.alg!==nt)}catch{return!1}}function Q(nn,nt){return!!((nt==="v4"||!nt)&&I.test(nn)||(nt==="v6"||!nt)&&M.test(nn))}class V extends u{_parse(nt){if(this._def.coerce&&(nt.data=String(nt.data)),this._getType(nt)!==p.ZodParsedType.string){const jn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jn,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.string,received:jn.parsedType}),m.INVALID}const qt=new m.ParseStatus;let In;for(const jn of this._def.checks)if(jn.kind==="min")nt.data.length<jn.value&&(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.too_small,minimum:jn.value,type:"string",inclusive:!0,exact:!1,message:jn.message}),qt.dirty());else if(jn.kind==="max")nt.data.length>jn.value&&(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.too_big,maximum:jn.value,type:"string",inclusive:!0,exact:!1,message:jn.message}),qt.dirty());else if(jn.kind==="length"){const Bi=nt.data.length>jn.value,Mi=nt.data.length<jn.value;(Bi||Mi)&&(In=this._getOrReturnCtx(nt,In),Bi?(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.too_big,maximum:jn.value,type:"string",inclusive:!0,exact:!0,message:jn.message}):Mi&&(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.too_small,minimum:jn.value,type:"string",inclusive:!0,exact:!0,message:jn.message}),qt.dirty())}else if(jn.kind==="email")S.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"email",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="emoji")T||(T=new RegExp(w,"u")),T.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"emoji",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="uuid")c.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"uuid",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="nanoid")y.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"nanoid",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="cuid")l.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"cuid",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="cuid2")E.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"cuid2",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="ulid")f.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"ulid",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty());else if(jn.kind==="url")try{new URL(nt.data)}catch{In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"url",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()}else jn.kind==="regex"?(jn.regex.lastIndex=0,jn.regex.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"regex",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty())):jn.kind==="trim"?nt.data=nt.data.trim():jn.kind==="includes"?nt.data.includes(jn.value,jn.position)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.invalid_string,validation:{includes:jn.value,position:jn.position},message:jn.message}),qt.dirty()):jn.kind==="toLowerCase"?nt.data=nt.data.toLowerCase():jn.kind==="toUpperCase"?nt.data=nt.data.toUpperCase():jn.kind==="startsWith"?nt.data.startsWith(jn.value)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.invalid_string,validation:{startsWith:jn.value},message:jn.message}),qt.dirty()):jn.kind==="endsWith"?nt.data.endsWith(jn.value)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.invalid_string,validation:{endsWith:jn.value},message:jn.message}),qt.dirty()):jn.kind==="datetime"?j(jn).test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.invalid_string,validation:"datetime",message:jn.message}),qt.dirty()):jn.kind==="date"?F.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.invalid_string,validation:"date",message:jn.message}),qt.dirty()):jn.kind==="time"?B(jn).test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.invalid_string,validation:"time",message:jn.message}),qt.dirty()):jn.kind==="duration"?A.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"duration",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()):jn.kind==="ip"?W(nt.data,jn.version)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"ip",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()):jn.kind==="jwt"?U(nt.data,jn.alg)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"jwt",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()):jn.kind==="cidr"?Q(nt.data,jn.version)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"cidr",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()):jn.kind==="base64"?R.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"base64",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()):jn.kind==="base64url"?P.test(nt.data)||(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{validation:"base64url",code:s.ZodIssueCode.invalid_string,message:jn.message}),qt.dirty()):p.util.assertNever(jn);return{status:qt.value,value:nt.data}}_regex(nt,jt,qt){return this.refinement(In=>nt.test(In),{validation:jt,code:s.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(qt)})}_addCheck(nt){return new V({...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 jt,qt;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:(jt=nt?.offset)!==null&&jt!==void 0?jt:!1,local:(qt=nt?.local)!==null&&qt!==void 0?qt:!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,jt){return this._addCheck({kind:"regex",regex:nt,...v.errorUtil.errToObj(jt)})}includes(nt,jt){return this._addCheck({kind:"includes",value:nt,position:jt?.position,...v.errorUtil.errToObj(jt?.message)})}startsWith(nt,jt){return this._addCheck({kind:"startsWith",value:nt,...v.errorUtil.errToObj(jt)})}endsWith(nt,jt){return this._addCheck({kind:"endsWith",value:nt,...v.errorUtil.errToObj(jt)})}min(nt,jt){return this._addCheck({kind:"min",value:nt,...v.errorUtil.errToObj(jt)})}max(nt,jt){return this._addCheck({kind:"max",value:nt,...v.errorUtil.errToObj(jt)})}length(nt,jt){return this._addCheck({kind:"length",value:nt,...v.errorUtil.errToObj(jt)})}nonempty(nt){return this.min(1,v.errorUtil.errToObj(nt))}trim(){return new V({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new V({...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 jt of this._def.checks)jt.kind==="min"&&(nt===null||jt.value>nt)&&(nt=jt.value);return nt}get maxLength(){let nt=null;for(const jt of this._def.checks)jt.kind==="max"&&(nt===null||jt.value<nt)&&(nt=jt.value);return nt}}t.ZodString=V,V.create=nn=>{var nt;return new V({checks:[],typeName:bt.ZodString,coerce:(nt=nn?.coerce)!==null&&nt!==void 0?nt:!1,...h(nn)})};function $(nn,nt){const jt=(nn.toString().split(".")[1]||"").length,qt=(nt.toString().split(".")[1]||"").length,In=jt>qt?jt:qt,jn=parseInt(nn.toFixed(In).replace(".","")),Bi=parseInt(nt.toFixed(In).replace(".",""));return jn%Bi/Math.pow(10,In)}class Y 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)!==p.ZodParsedType.number){const jn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jn,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.number,received:jn.parsedType}),m.INVALID}let qt;const In=new m.ParseStatus;for(const jn of this._def.checks)jn.kind==="int"?p.util.isInteger(nt.data)||(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:jn.message}),In.dirty()):jn.kind==="min"?(jn.inclusive?nt.data<jn.value:nt.data<=jn.value)&&(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_small,minimum:jn.value,type:"number",inclusive:jn.inclusive,exact:!1,message:jn.message}),In.dirty()):jn.kind==="max"?(jn.inclusive?nt.data>jn.value:nt.data>=jn.value)&&(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_big,maximum:jn.value,type:"number",inclusive:jn.inclusive,exact:!1,message:jn.message}),In.dirty()):jn.kind==="multipleOf"?$(nt.data,jn.value)!==0&&(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.not_multiple_of,multipleOf:jn.value,message:jn.message}),In.dirty()):jn.kind==="finite"?Number.isFinite(nt.data)||(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.not_finite,message:jn.message}),In.dirty()):p.util.assertNever(jn);return{status:In.value,value:nt.data}}gte(nt,jt){return this.setLimit("min",nt,!0,v.errorUtil.toString(jt))}gt(nt,jt){return this.setLimit("min",nt,!1,v.errorUtil.toString(jt))}lte(nt,jt){return this.setLimit("max",nt,!0,v.errorUtil.toString(jt))}lt(nt,jt){return this.setLimit("max",nt,!1,v.errorUtil.toString(jt))}setLimit(nt,jt,qt,In){return new Y({...this._def,checks:[...this._def.checks,{kind:nt,value:jt,inclusive:qt,message:v.errorUtil.toString(In)}]})}_addCheck(nt){return new Y({...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,jt){return this._addCheck({kind:"multipleOf",value:nt,message:v.errorUtil.toString(jt)})}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 jt of this._def.checks)jt.kind==="min"&&(nt===null||jt.value>nt)&&(nt=jt.value);return nt}get maxValue(){let nt=null;for(const jt of this._def.checks)jt.kind==="max"&&(nt===null||jt.value<nt)&&(nt=jt.value);return nt}get isInt(){return!!this._def.checks.find(nt=>nt.kind==="int"||nt.kind==="multipleOf"&&p.util.isInteger(nt.value))}get isFinite(){let nt=null,jt=null;for(const qt of this._def.checks){if(qt.kind==="finite"||qt.kind==="int"||qt.kind==="multipleOf")return!0;qt.kind==="min"?(jt===null||qt.value>jt)&&(jt=qt.value):qt.kind==="max"&&(nt===null||qt.value<nt)&&(nt=qt.value)}return Number.isFinite(jt)&&Number.isFinite(nt)}}t.ZodNumber=Y,Y.create=nn=>new Y({checks:[],typeName:bt.ZodNumber,coerce:nn?.coerce||!1,...h(nn)});class z 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)!==p.ZodParsedType.bigint)return this._getInvalidInput(nt);let qt;const In=new m.ParseStatus;for(const jn of this._def.checks)jn.kind==="min"?(jn.inclusive?nt.data<jn.value:nt.data<=jn.value)&&(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_small,type:"bigint",minimum:jn.value,inclusive:jn.inclusive,message:jn.message}),In.dirty()):jn.kind==="max"?(jn.inclusive?nt.data>jn.value:nt.data>=jn.value)&&(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_big,type:"bigint",maximum:jn.value,inclusive:jn.inclusive,message:jn.message}),In.dirty()):jn.kind==="multipleOf"?nt.data%jn.value!==BigInt(0)&&(qt=this._getOrReturnCtx(nt,qt),(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.not_multiple_of,multipleOf:jn.value,message:jn.message}),In.dirty()):p.util.assertNever(jn);return{status:In.value,value:nt.data}}_getInvalidInput(nt){const jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.bigint,received:jt.parsedType}),m.INVALID}gte(nt,jt){return this.setLimit("min",nt,!0,v.errorUtil.toString(jt))}gt(nt,jt){return this.setLimit("min",nt,!1,v.errorUtil.toString(jt))}lte(nt,jt){return this.setLimit("max",nt,!0,v.errorUtil.toString(jt))}lt(nt,jt){return this.setLimit("max",nt,!1,v.errorUtil.toString(jt))}setLimit(nt,jt,qt,In){return new z({...this._def,checks:[...this._def.checks,{kind:nt,value:jt,inclusive:qt,message:v.errorUtil.toString(In)}]})}_addCheck(nt){return new z({...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,jt){return this._addCheck({kind:"multipleOf",value:nt,message:v.errorUtil.toString(jt)})}get minValue(){let nt=null;for(const jt of this._def.checks)jt.kind==="min"&&(nt===null||jt.value>nt)&&(nt=jt.value);return nt}get maxValue(){let nt=null;for(const jt of this._def.checks)jt.kind==="max"&&(nt===null||jt.value<nt)&&(nt=jt.value);return nt}}t.ZodBigInt=z,z.create=nn=>{var nt;return new z({checks:[],typeName:bt.ZodBigInt,coerce:(nt=nn?.coerce)!==null&&nt!==void 0?nt:!1,...h(nn)})};class H extends u{_parse(nt){if(this._def.coerce&&(nt.data=!!nt.data),this._getType(nt)!==p.ZodParsedType.boolean){const qt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.boolean,received:qt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodBoolean=H,H.create=nn=>new H({typeName:bt.ZodBoolean,coerce:nn?.coerce||!1,...h(nn)});class K extends u{_parse(nt){if(this._def.coerce&&(nt.data=new Date(nt.data)),this._getType(nt)!==p.ZodParsedType.date){const jn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jn,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.date,received:jn.parsedType}),m.INVALID}if(isNaN(nt.data.getTime())){const jn=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jn,{code:s.ZodIssueCode.invalid_date}),m.INVALID}const qt=new m.ParseStatus;let In;for(const jn of this._def.checks)jn.kind==="min"?nt.data.getTime()<jn.value&&(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.too_small,message:jn.message,inclusive:!0,exact:!1,minimum:jn.value,type:"date"}),qt.dirty()):jn.kind==="max"?nt.data.getTime()>jn.value&&(In=this._getOrReturnCtx(nt,In),(0,m.addIssueToContext)(In,{code:s.ZodIssueCode.too_big,message:jn.message,inclusive:!0,exact:!1,maximum:jn.value,type:"date"}),qt.dirty()):p.util.assertNever(jn);return{status:qt.value,value:new Date(nt.data.getTime())}}_addCheck(nt){return new K({...this._def,checks:[...this._def.checks,nt]})}min(nt,jt){return this._addCheck({kind:"min",value:nt.getTime(),message:v.errorUtil.toString(jt)})}max(nt,jt){return this._addCheck({kind:"max",value:nt.getTime(),message:v.errorUtil.toString(jt)})}get minDate(){let nt=null;for(const jt of this._def.checks)jt.kind==="min"&&(nt===null||jt.value>nt)&&(nt=jt.value);return nt!=null?new Date(nt):null}get maxDate(){let nt=null;for(const jt of this._def.checks)jt.kind==="max"&&(nt===null||jt.value<nt)&&(nt=jt.value);return nt!=null?new Date(nt):null}}t.ZodDate=K,K.create=nn=>new K({checks:[],coerce:nn?.coerce||!1,typeName:bt.ZodDate,...h(nn)});class Z extends u{_parse(nt){if(this._getType(nt)!==p.ZodParsedType.symbol){const qt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.symbol,received:qt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodSymbol=Z,Z.create=nn=>new Z({typeName:bt.ZodSymbol,...h(nn)});class X extends u{_parse(nt){if(this._getType(nt)!==p.ZodParsedType.undefined){const qt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.undefined,received:qt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodUndefined=X,X.create=nn=>new X({typeName:bt.ZodUndefined,...h(nn)});class oe extends u{_parse(nt){if(this._getType(nt)!==p.ZodParsedType.null){const qt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.null,received:qt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodNull=oe,oe.create=nn=>new oe({typeName:bt.ZodNull,...h(nn)});class ie extends u{constructor(){super(...arguments),this._any=!0}_parse(nt){return(0,m.OK)(nt.data)}}t.ZodAny=ie,ie.create=nn=>new ie({typeName:bt.ZodAny,...h(nn)});class ge extends u{constructor(){super(...arguments),this._unknown=!0}_parse(nt){return(0,m.OK)(nt.data)}}t.ZodUnknown=ge,ge.create=nn=>new ge({typeName:bt.ZodUnknown,...h(nn)});class me extends u{_parse(nt){const jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.never,received:jt.parsedType}),m.INVALID}}t.ZodNever=me,me.create=nn=>new me({typeName:bt.ZodNever,...h(nn)});class q extends u{_parse(nt){if(this._getType(nt)!==p.ZodParsedType.undefined){const qt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.void,received:qt.parsedType}),m.INVALID}return(0,m.OK)(nt.data)}}t.ZodVoid=q,q.create=nn=>new q({typeName:bt.ZodVoid,...h(nn)});class Se extends u{_parse(nt){const{ctx:jt,status:qt}=this._processInputParams(nt),In=this._def;if(jt.parsedType!==p.ZodParsedType.array)return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.array,received:jt.parsedType}),m.INVALID;if(In.exactLength!==null){const Bi=jt.data.length>In.exactLength.value,Mi=jt.data.length<In.exactLength.value;(Bi||Mi)&&((0,m.addIssueToContext)(jt,{code:Bi?s.ZodIssueCode.too_big:s.ZodIssueCode.too_small,minimum:Mi?In.exactLength.value:void 0,maximum:Bi?In.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:In.exactLength.message}),qt.dirty())}if(In.minLength!==null&&jt.data.length<In.minLength.value&&((0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.too_small,minimum:In.minLength.value,type:"array",inclusive:!0,exact:!1,message:In.minLength.message}),qt.dirty()),In.maxLength!==null&&jt.data.length>In.maxLength.value&&((0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.too_big,maximum:In.maxLength.value,type:"array",inclusive:!0,exact:!1,message:In.maxLength.message}),qt.dirty()),jt.common.async)return Promise.all([...jt.data].map((Bi,Mi)=>In.type._parseAsync(new g(jt,Bi,jt.path,Mi)))).then(Bi=>m.ParseStatus.mergeArray(qt,Bi));const jn=[...jt.data].map((Bi,Mi)=>In.type._parseSync(new g(jt,Bi,jt.path,Mi)));return m.ParseStatus.mergeArray(qt,jn)}get element(){return this._def.type}min(nt,jt){return new Se({...this._def,minLength:{value:nt,message:v.errorUtil.toString(jt)}})}max(nt,jt){return new Se({...this._def,maxLength:{value:nt,message:v.errorUtil.toString(jt)}})}length(nt,jt){return new Se({...this._def,exactLength:{value:nt,message:v.errorUtil.toString(jt)}})}nonempty(nt){return this.min(1,nt)}}t.ZodArray=Se,Se.create=(nn,nt)=>new Se({type:nn,minLength:null,maxLength:null,exactLength:null,typeName:bt.ZodArray,...h(nt)});function _e(nn){if(nn instanceof ne){const nt={};for(const jt in nn.shape){const qt=nn.shape[jt];nt[jt]=je.create(_e(qt))}return new ne({...nn._def,shape:()=>nt})}else return nn instanceof Se?new Se({...nn._def,type:_e(nn.element)}):nn instanceof je?je.create(_e(nn.unwrap())):nn instanceof gt?gt.create(_e(nn.unwrap())):nn instanceof Ce?Ce.create(nn.items.map(nt=>_e(nt))):nn}class ne 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(),jt=p.util.objectKeys(nt);return this._cached={shape:nt,keys:jt}}_parse(nt){if(this._getType(nt)!==p.ZodParsedType.object){const yi=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(yi,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.object,received:yi.parsedType}),m.INVALID}const{status:qt,ctx:In}=this._processInputParams(nt),{shape:jn,keys:Bi}=this._getCached(),Mi=[];if(!(this._def.catchall instanceof me&&this._def.unknownKeys==="strip"))for(const yi in In.data)Bi.includes(yi)||Mi.push(yi);const Xi=[];for(const yi of Bi){const Zi=jn[yi],to=In.data[yi];Xi.push({key:{status:"valid",value:yi},value:Zi._parse(new g(In,to,In.path,yi)),alwaysSet:yi in In.data})}if(this._def.catchall instanceof me){const yi=this._def.unknownKeys;if(yi==="passthrough")for(const Zi of Mi)Xi.push({key:{status:"valid",value:Zi},value:{status:"valid",value:In.data[Zi]}});else if(yi==="strict")Mi.length>0&&((0,m.addIssueToContext)(In,{code:s.ZodIssueCode.unrecognized_keys,keys:Mi}),qt.dirty());else if(yi!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const yi=this._def.catchall;for(const Zi of Mi){const to=In.data[Zi];Xi.push({key:{status:"valid",value:Zi},value:yi._parse(new g(In,to,In.path,Zi)),alwaysSet:Zi in In.data})}}return In.common.async?Promise.resolve().then(async()=>{const yi=[];for(const Zi of Xi){const to=await Zi.key,uo=await Zi.value;yi.push({key:to,value:uo,alwaysSet:Zi.alwaysSet})}return yi}).then(yi=>m.ParseStatus.mergeObjectSync(qt,yi)):m.ParseStatus.mergeObjectSync(qt,Xi)}get shape(){return this._def.shape()}strict(nt){return v.errorUtil.errToObj,new ne({...this._def,unknownKeys:"strict",...nt!==void 0?{errorMap:(jt,qt)=>{var In,jn,Bi,Mi;const Xi=(Bi=(jn=(In=this._def).errorMap)===null||jn===void 0?void 0:jn.call(In,jt,qt).message)!==null&&Bi!==void 0?Bi:qt.defaultError;return jt.code==="unrecognized_keys"?{message:(Mi=v.errorUtil.errToObj(nt).message)!==null&&Mi!==void 0?Mi:Xi}:{message:Xi}}}:{}})}strip(){return new ne({...this._def,unknownKeys:"strip"})}passthrough(){return new ne({...this._def,unknownKeys:"passthrough"})}extend(nt){return new ne({...this._def,shape:()=>({...this._def.shape(),...nt})})}merge(nt){return new ne({unknownKeys:nt._def.unknownKeys,catchall:nt._def.catchall,shape:()=>({...this._def.shape(),...nt._def.shape()}),typeName:bt.ZodObject})}setKey(nt,jt){return this.augment({[nt]:jt})}catchall(nt){return new ne({...this._def,catchall:nt})}pick(nt){const jt={};return p.util.objectKeys(nt).forEach(qt=>{nt[qt]&&this.shape[qt]&&(jt[qt]=this.shape[qt])}),new ne({...this._def,shape:()=>jt})}omit(nt){const jt={};return p.util.objectKeys(this.shape).forEach(qt=>{nt[qt]||(jt[qt]=this.shape[qt])}),new ne({...this._def,shape:()=>jt})}deepPartial(){return _e(this)}partial(nt){const jt={};return p.util.objectKeys(this.shape).forEach(qt=>{const In=this.shape[qt];nt&&!nt[qt]?jt[qt]=In:jt[qt]=In.optional()}),new ne({...this._def,shape:()=>jt})}required(nt){const jt={};return p.util.objectKeys(this.shape).forEach(qt=>{if(nt&&!nt[qt])jt[qt]=this.shape[qt];else{let jn=this.shape[qt];for(;jn instanceof je;)jn=jn._def.innerType;jt[qt]=jn}}),new ne({...this._def,shape:()=>jt})}keyof(){return he(p.util.objectKeys(this.shape))}}t.ZodObject=ne,ne.create=(nn,nt)=>new ne({shape:()=>nn,unknownKeys:"strip",catchall:me.create(),typeName:bt.ZodObject,...h(nt)}),ne.strictCreate=(nn,nt)=>new ne({shape:()=>nn,unknownKeys:"strict",catchall:me.create(),typeName:bt.ZodObject,...h(nt)}),ne.lazycreate=(nn,nt)=>new ne({shape:nn,unknownKeys:"strip",catchall:me.create(),typeName:bt.ZodObject,...h(nt)});class ue extends u{_parse(nt){const{ctx:jt}=this._processInputParams(nt),qt=this._def.options;function In(jn){for(const Mi of jn)if(Mi.result.status==="valid")return Mi.result;for(const Mi of jn)if(Mi.result.status==="dirty")return jt.common.issues.push(...Mi.ctx.common.issues),Mi.result;const Bi=jn.map(Mi=>new s.ZodError(Mi.ctx.common.issues));return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_union,unionErrors:Bi}),m.INVALID}if(jt.common.async)return Promise.all(qt.map(async jn=>{const Bi={...jt,common:{...jt.common,issues:[]},parent:null};return{result:await jn._parseAsync({data:jt.data,path:jt.path,parent:Bi}),ctx:Bi}})).then(In);{let jn;const Bi=[];for(const Xi of qt){const yi={...jt,common:{...jt.common,issues:[]},parent:null},Zi=Xi._parseSync({data:jt.data,path:jt.path,parent:yi});if(Zi.status==="valid")return Zi;Zi.status==="dirty"&&!jn&&(jn={result:Zi,ctx:yi}),yi.common.issues.length&&Bi.push(yi.common.issues)}if(jn)return jt.common.issues.push(...jn.ctx.common.issues),jn.result;const Mi=Bi.map(Xi=>new s.ZodError(Xi));return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_union,unionErrors:Mi}),m.INVALID}}get options(){return this._def.options}}t.ZodUnion=ue,ue.create=(nn,nt)=>new ue({options:nn,typeName:bt.ZodUnion,...h(nt)});const Ie=nn=>nn instanceof pe?Ie(nn.schema):nn instanceof Ge?Ie(nn.innerType()):nn instanceof re?[nn.value]:nn instanceof Oe?nn.options:nn instanceof De?p.util.objectValues(nn.enum):nn instanceof ot?Ie(nn._def.innerType):nn instanceof X?[void 0]:nn instanceof oe?[null]:nn instanceof je?[void 0,...Ie(nn.unwrap())]:nn instanceof gt?[null,...Ie(nn.unwrap())]:nn instanceof At||nn instanceof st?Ie(nn.unwrap()):nn instanceof Mt?Ie(nn._def.innerType):[];class Pe extends u{_parse(nt){const{ctx:jt}=this._processInputParams(nt);if(jt.parsedType!==p.ZodParsedType.object)return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.object,received:jt.parsedType}),m.INVALID;const qt=this.discriminator,In=jt.data[qt],jn=this.optionsMap.get(In);return jn?jt.common.async?jn._parseAsync({data:jt.data,path:jt.path,parent:jt}):jn._parseSync({data:jt.data,path:jt.path,parent:jt}):((0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[qt]}),m.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(nt,jt,qt){const In=new Map;for(const jn of jt){const Bi=Ie(jn.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(In.has(Mi))throw new Error(`Discriminator property ${String(nt)} has duplicate value ${String(Mi)}`);In.set(Mi,jn)}}return new Pe({typeName:bt.ZodDiscriminatedUnion,discriminator:nt,options:jt,optionsMap:In,...h(qt)})}}t.ZodDiscriminatedUnion=Pe;function ve(nn,nt){const jt=(0,p.getParsedType)(nn),qt=(0,p.getParsedType)(nt);if(nn===nt)return{valid:!0,data:nn};if(jt===p.ZodParsedType.object&&qt===p.ZodParsedType.object){const In=p.util.objectKeys(nt),jn=p.util.objectKeys(nn).filter(Mi=>In.indexOf(Mi)!==-1),Bi={...nn,...nt};for(const Mi of jn){const Xi=ve(nn[Mi],nt[Mi]);if(!Xi.valid)return{valid:!1};Bi[Mi]=Xi.data}return{valid:!0,data:Bi}}else if(jt===p.ZodParsedType.array&&qt===p.ZodParsedType.array){if(nn.length!==nt.length)return{valid:!1};const In=[];for(let jn=0;jn<nn.length;jn++){const Bi=nn[jn],Mi=nt[jn],Xi=ve(Bi,Mi);if(!Xi.valid)return{valid:!1};In.push(Xi.data)}return{valid:!0,data:In}}else return jt===p.ZodParsedType.date&&qt===p.ZodParsedType.date&&+nn==+nt?{valid:!0,data:nn}:{valid:!1}}class Ae extends u{_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt),In=(jn,Bi)=>{if((0,m.isAborted)(jn)||(0,m.isAborted)(Bi))return m.INVALID;const Mi=ve(jn.value,Bi.value);return Mi.valid?(((0,m.isDirty)(jn)||(0,m.isDirty)(Bi))&&jt.dirty(),{status:jt.value,value:Mi.data}):((0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_intersection_types}),m.INVALID)};return qt.common.async?Promise.all([this._def.left._parseAsync({data:qt.data,path:qt.path,parent:qt}),this._def.right._parseAsync({data:qt.data,path:qt.path,parent:qt})]).then(([jn,Bi])=>In(jn,Bi)):In(this._def.left._parseSync({data:qt.data,path:qt.path,parent:qt}),this._def.right._parseSync({data:qt.data,path:qt.path,parent:qt}))}}t.ZodIntersection=Ae,Ae.create=(nn,nt,jt)=>new Ae({left:nn,right:nt,typeName:bt.ZodIntersection,...h(jt)});class Ce extends u{_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt);if(qt.parsedType!==p.ZodParsedType.array)return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.array,received:qt.parsedType}),m.INVALID;if(qt.data.length<this._def.items.length)return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m.INVALID;!this._def.rest&&qt.data.length>this._def.items.length&&((0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),jt.dirty());const jn=[...qt.data].map((Bi,Mi)=>{const Xi=this._def.items[Mi]||this._def.rest;return Xi?Xi._parse(new g(qt,Bi,qt.path,Mi)):null}).filter(Bi=>!!Bi);return qt.common.async?Promise.all(jn).then(Bi=>m.ParseStatus.mergeArray(jt,Bi)):m.ParseStatus.mergeArray(jt,jn)}get items(){return this._def.items}rest(nt){return new Ce({...this._def,rest:nt})}}t.ZodTuple=Ce,Ce.create=(nn,nt)=>{if(!Array.isArray(nn))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ce({items:nn,typeName:bt.ZodTuple,rest:null,...h(nt)})};class fe extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt);if(qt.parsedType!==p.ZodParsedType.object)return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.object,received:qt.parsedType}),m.INVALID;const In=[],jn=this._def.keyType,Bi=this._def.valueType;for(const Mi in qt.data)In.push({key:jn._parse(new g(qt,Mi,qt.path,Mi)),value:Bi._parse(new g(qt,qt.data[Mi],qt.path,Mi)),alwaysSet:Mi in qt.data});return qt.common.async?m.ParseStatus.mergeObjectAsync(jt,In):m.ParseStatus.mergeObjectSync(jt,In)}get element(){return this._def.valueType}static create(nt,jt,qt){return jt instanceof u?new fe({keyType:nt,valueType:jt,typeName:bt.ZodRecord,...h(qt)}):new fe({keyType:V.create(),valueType:nt,typeName:bt.ZodRecord,...h(jt)})}}t.ZodRecord=fe;class xe extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt);if(qt.parsedType!==p.ZodParsedType.map)return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.map,received:qt.parsedType}),m.INVALID;const In=this._def.keyType,jn=this._def.valueType,Bi=[...qt.data.entries()].map(([Mi,Xi],yi)=>({key:In._parse(new g(qt,Mi,qt.path,[yi,"key"])),value:jn._parse(new g(qt,Xi,qt.path,[yi,"value"]))}));if(qt.common.async){const Mi=new Map;return Promise.resolve().then(async()=>{for(const Xi of Bi){const yi=await Xi.key,Zi=await Xi.value;if(yi.status==="aborted"||Zi.status==="aborted")return m.INVALID;(yi.status==="dirty"||Zi.status==="dirty")&&jt.dirty(),Mi.set(yi.value,Zi.value)}return{status:jt.value,value:Mi}})}else{const Mi=new Map;for(const Xi of Bi){const yi=Xi.key,Zi=Xi.value;if(yi.status==="aborted"||Zi.status==="aborted")return m.INVALID;(yi.status==="dirty"||Zi.status==="dirty")&&jt.dirty(),Mi.set(yi.value,Zi.value)}return{status:jt.value,value:Mi}}}}t.ZodMap=xe,xe.create=(nn,nt,jt)=>new xe({valueType:nt,keyType:nn,typeName:bt.ZodMap,...h(jt)});class Te extends u{_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt);if(qt.parsedType!==p.ZodParsedType.set)return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.set,received:qt.parsedType}),m.INVALID;const In=this._def;In.minSize!==null&&qt.data.size<In.minSize.value&&((0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_small,minimum:In.minSize.value,type:"set",inclusive:!0,exact:!1,message:In.minSize.message}),jt.dirty()),In.maxSize!==null&&qt.data.size>In.maxSize.value&&((0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.too_big,maximum:In.maxSize.value,type:"set",inclusive:!0,exact:!1,message:In.maxSize.message}),jt.dirty());const jn=this._def.valueType;function Bi(Xi){const yi=new Set;for(const Zi of Xi){if(Zi.status==="aborted")return m.INVALID;Zi.status==="dirty"&&jt.dirty(),yi.add(Zi.value)}return{status:jt.value,value:yi}}const Mi=[...qt.data.values()].map((Xi,yi)=>jn._parse(new g(qt,Xi,qt.path,yi)));return qt.common.async?Promise.all(Mi).then(Xi=>Bi(Xi)):Bi(Mi)}min(nt,jt){return new Te({...this._def,minSize:{value:nt,message:v.errorUtil.toString(jt)}})}max(nt,jt){return new Te({...this._def,maxSize:{value:nt,message:v.errorUtil.toString(jt)}})}size(nt,jt){return this.min(nt,jt).max(nt,jt)}nonempty(nt){return this.min(1,nt)}}t.ZodSet=Te,Te.create=(nn,nt)=>new Te({valueType:nn,minSize:null,maxSize:null,typeName:bt.ZodSet,...h(nt)});class Ne extends u{constructor(){super(...arguments),this.validate=this.implement}_parse(nt){const{ctx:jt}=this._processInputParams(nt);if(jt.parsedType!==p.ZodParsedType.function)return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.function,received:jt.parsedType}),m.INVALID;function qt(Mi,Xi){return(0,m.makeIssue)({data:Mi,path:jt.path,errorMaps:[jt.common.contextualErrorMap,jt.schemaErrorMap,(0,_.getErrorMap)(),_.defaultErrorMap].filter(yi=>!!yi),issueData:{code:s.ZodIssueCode.invalid_arguments,argumentsError:Xi}})}function In(Mi,Xi){return(0,m.makeIssue)({data:Mi,path:jt.path,errorMaps:[jt.common.contextualErrorMap,jt.schemaErrorMap,(0,_.getErrorMap)(),_.defaultErrorMap].filter(yi=>!!yi),issueData:{code:s.ZodIssueCode.invalid_return_type,returnTypeError:Xi}})}const jn={errorMap:jt.common.contextualErrorMap},Bi=jt.data;if(this._def.returns instanceof Fe){const Mi=this;return(0,m.OK)(async function(...Xi){const yi=new s.ZodError([]),Zi=await Mi._def.args.parseAsync(Xi,jn).catch(Ao=>{throw yi.addIssue(qt(Xi,Ao)),yi}),to=await Reflect.apply(Bi,this,Zi);return await Mi._def.returns._def.type.parseAsync(to,jn).catch(Ao=>{throw yi.addIssue(In(to,Ao)),yi})})}else{const Mi=this;return(0,m.OK)(function(...Xi){const yi=Mi._def.args.safeParse(Xi,jn);if(!yi.success)throw new s.ZodError([qt(Xi,yi.error)]);const Zi=Reflect.apply(Bi,this,yi.data),to=Mi._def.returns.safeParse(Zi,jn);if(!to.success)throw new s.ZodError([In(Zi,to.error)]);return to.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...nt){return new Ne({...this._def,args:Ce.create(nt).rest(ge.create())})}returns(nt){return new Ne({...this._def,returns:nt})}implement(nt){return this.parse(nt)}strictImplement(nt){return this.parse(nt)}static create(nt,jt,qt){return new Ne({args:nt||Ce.create([]).rest(ge.create()),returns:jt||ge.create(),typeName:bt.ZodFunction,...h(qt)})}}t.ZodFunction=Ne;class pe extends u{get schema(){return this._def.getter()}_parse(nt){const{ctx:jt}=this._processInputParams(nt);return this._def.getter()._parse({data:jt.data,path:jt.path,parent:jt})}}t.ZodLazy=pe,pe.create=(nn,nt)=>new pe({getter:nn,typeName:bt.ZodLazy,...h(nt)});class re extends u{_parse(nt){if(nt.data!==this._def.value){const jt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(jt,{received:jt.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=(nn,nt)=>new re({value:nn,typeName:bt.ZodLiteral,...h(nt)});function he(nn,nt){return new Oe({values:nn,typeName:bt.ZodEnum,...h(nt)})}class Oe extends u{constructor(){super(...arguments),o.set(this,void 0)}_parse(nt){if(typeof nt.data!="string"){const jt=this._getOrReturnCtx(nt),qt=this._def.values;return(0,m.addIssueToContext)(jt,{expected:p.util.joinValues(qt),received:jt.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 jt=this._getOrReturnCtx(nt),qt=this._def.values;return(0,m.addIssueToContext)(jt,{received:jt.data,code:s.ZodIssueCode.invalid_enum_value,options:qt}),m.INVALID}return(0,m.OK)(nt.data)}get options(){return this._def.values}get enum(){const nt={};for(const jt of this._def.values)nt[jt]=jt;return nt}get Values(){const nt={};for(const jt of this._def.values)nt[jt]=jt;return nt}get Enum(){const nt={};for(const jt of this._def.values)nt[jt]=jt;return nt}extract(nt,jt=this._def){return Oe.create(nt,{...this._def,...jt})}exclude(nt,jt=this._def){return Oe.create(this.options.filter(qt=>!nt.includes(qt)),{...this._def,...jt})}}t.ZodEnum=Oe,o=new WeakMap,Oe.create=he;class De extends u{constructor(){super(...arguments),d.set(this,void 0)}_parse(nt){const jt=p.util.getValidEnumValues(this._def.values),qt=this._getOrReturnCtx(nt);if(qt.parsedType!==p.ZodParsedType.string&&qt.parsedType!==p.ZodParsedType.number){const In=p.util.objectValues(jt);return(0,m.addIssueToContext)(qt,{expected:p.util.joinValues(In),received:qt.parsedType,code:s.ZodIssueCode.invalid_type}),m.INVALID}if(n(this,d,"f")||r(this,d,new Set(p.util.getValidEnumValues(this._def.values)),"f"),!n(this,d,"f").has(nt.data)){const In=p.util.objectValues(jt);return(0,m.addIssueToContext)(qt,{received:qt.data,code:s.ZodIssueCode.invalid_enum_value,options:In}),m.INVALID}return(0,m.OK)(nt.data)}get enum(){return this._def.values}}t.ZodNativeEnum=De,d=new WeakMap,De.create=(nn,nt)=>new De({values:nn,typeName:bt.ZodNativeEnum,...h(nt)});class Fe extends u{unwrap(){return this._def.type}_parse(nt){const{ctx:jt}=this._processInputParams(nt);if(jt.parsedType!==p.ZodParsedType.promise&&jt.common.async===!1)return(0,m.addIssueToContext)(jt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.promise,received:jt.parsedType}),m.INVALID;const qt=jt.parsedType===p.ZodParsedType.promise?jt.data:Promise.resolve(jt.data);return(0,m.OK)(qt.then(In=>this._def.type.parseAsync(In,{path:jt.path,errorMap:jt.common.contextualErrorMap})))}}t.ZodPromise=Fe,Fe.create=(nn,nt)=>new Fe({type:nn,typeName:bt.ZodPromise,...h(nt)});class Ge extends u{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===bt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt),In=this._def.effect||null,jn={addIssue:Bi=>{(0,m.addIssueToContext)(qt,Bi),Bi.fatal?jt.abort():jt.dirty()},get path(){return qt.path}};if(jn.addIssue=jn.addIssue.bind(jn),In.type==="preprocess"){const Bi=In.transform(qt.data,jn);if(qt.common.async)return Promise.resolve(Bi).then(async Mi=>{if(jt.value==="aborted")return m.INVALID;const Xi=await this._def.schema._parseAsync({data:Mi,path:qt.path,parent:qt});return Xi.status==="aborted"?m.INVALID:Xi.status==="dirty"||jt.value==="dirty"?(0,m.DIRTY)(Xi.value):Xi});{if(jt.value==="aborted")return m.INVALID;const Mi=this._def.schema._parseSync({data:Bi,path:qt.path,parent:qt});return Mi.status==="aborted"?m.INVALID:Mi.status==="dirty"||jt.value==="dirty"?(0,m.DIRTY)(Mi.value):Mi}}if(In.type==="refinement"){const Bi=Mi=>{const Xi=In.refinement(Mi,jn);if(qt.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(qt.common.async===!1){const Mi=this._def.schema._parseSync({data:qt.data,path:qt.path,parent:qt});return Mi.status==="aborted"?m.INVALID:(Mi.status==="dirty"&&jt.dirty(),Bi(Mi.value),{status:jt.value,value:Mi.value})}else return this._def.schema._parseAsync({data:qt.data,path:qt.path,parent:qt}).then(Mi=>Mi.status==="aborted"?m.INVALID:(Mi.status==="dirty"&&jt.dirty(),Bi(Mi.value).then(()=>({status:jt.value,value:Mi.value}))))}if(In.type==="transform")if(qt.common.async===!1){const Bi=this._def.schema._parseSync({data:qt.data,path:qt.path,parent:qt});if(!(0,m.isValid)(Bi))return Bi;const Mi=In.transform(Bi.value,jn);if(Mi instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:jt.value,value:Mi}}else return this._def.schema._parseAsync({data:qt.data,path:qt.path,parent:qt}).then(Bi=>(0,m.isValid)(Bi)?Promise.resolve(In.transform(Bi.value,jn)).then(Mi=>({status:jt.value,value:Mi})):Bi);p.util.assertNever(In)}}t.ZodEffects=Ge,t.ZodTransformer=Ge,Ge.create=(nn,nt,jt)=>new Ge({schema:nn,typeName:bt.ZodEffects,effect:nt,...h(jt)}),Ge.createWithPreprocess=(nn,nt,jt)=>new Ge({schema:nt,effect:{type:"preprocess",transform:nn},typeName:bt.ZodEffects,...h(jt)});class je extends u{_parse(nt){return this._getType(nt)===p.ZodParsedType.undefined?(0,m.OK)(void 0):this._def.innerType._parse(nt)}unwrap(){return this._def.innerType}}t.ZodOptional=je,je.create=(nn,nt)=>new je({innerType:nn,typeName:bt.ZodOptional,...h(nt)});class gt extends u{_parse(nt){return this._getType(nt)===p.ZodParsedType.null?(0,m.OK)(null):this._def.innerType._parse(nt)}unwrap(){return this._def.innerType}}t.ZodNullable=gt,gt.create=(nn,nt)=>new gt({innerType:nn,typeName:bt.ZodNullable,...h(nt)});class ot extends u{_parse(nt){const{ctx:jt}=this._processInputParams(nt);let qt=jt.data;return jt.parsedType===p.ZodParsedType.undefined&&(qt=this._def.defaultValue()),this._def.innerType._parse({data:qt,path:jt.path,parent:jt})}removeDefault(){return this._def.innerType}}t.ZodDefault=ot,ot.create=(nn,nt)=>new ot({innerType:nn,typeName:bt.ZodDefault,defaultValue:typeof nt.default=="function"?nt.default:()=>nt.default,...h(nt)});class Mt extends u{_parse(nt){const{ctx:jt}=this._processInputParams(nt),qt={...jt,common:{...jt.common,issues:[]}},In=this._def.innerType._parse({data:qt.data,path:qt.path,parent:{...qt}});return(0,m.isAsync)(In)?In.then(jn=>({status:"valid",value:jn.status==="valid"?jn.value:this._def.catchValue({get error(){return new s.ZodError(qt.common.issues)},input:qt.data})})):{status:"valid",value:In.status==="valid"?In.value:this._def.catchValue({get error(){return new s.ZodError(qt.common.issues)},input:qt.data})}}removeCatch(){return this._def.innerType}}t.ZodCatch=Mt,Mt.create=(nn,nt)=>new Mt({innerType:nn,typeName:bt.ZodCatch,catchValue:typeof nt.catch=="function"?nt.catch:()=>nt.catch,...h(nt)});class lt extends u{_parse(nt){if(this._getType(nt)!==p.ZodParsedType.nan){const qt=this._getOrReturnCtx(nt);return(0,m.addIssueToContext)(qt,{code:s.ZodIssueCode.invalid_type,expected:p.ZodParsedType.nan,received:qt.parsedType}),m.INVALID}return{status:"valid",value:nt.data}}}t.ZodNaN=lt,lt.create=nn=>new lt({typeName:bt.ZodNaN,...h(nn)}),t.BRAND=Symbol("zod_brand");class At extends u{_parse(nt){const{ctx:jt}=this._processInputParams(nt),qt=jt.data;return this._def.type._parse({data:qt,path:jt.path,parent:jt})}unwrap(){return this._def.type}}t.ZodBranded=At;class rt extends u{_parse(nt){const{status:jt,ctx:qt}=this._processInputParams(nt);if(qt.common.async)return(async()=>{const jn=await this._def.in._parseAsync({data:qt.data,path:qt.path,parent:qt});return jn.status==="aborted"?m.INVALID:jn.status==="dirty"?(jt.dirty(),(0,m.DIRTY)(jn.value)):this._def.out._parseAsync({data:jn.value,path:qt.path,parent:qt})})();{const In=this._def.in._parseSync({data:qt.data,path:qt.path,parent:qt});return In.status==="aborted"?m.INVALID:In.status==="dirty"?(jt.dirty(),{status:"dirty",value:In.value}):this._def.out._parseSync({data:In.value,path:qt.path,parent:qt})}}static create(nt,jt){return new rt({in:nt,out:jt,typeName:bt.ZodPipeline})}}t.ZodPipeline=rt;class st extends u{_parse(nt){const jt=this._def.innerType._parse(nt),qt=In=>((0,m.isValid)(In)&&(In.value=Object.freeze(In.value)),In);return(0,m.isAsync)(jt)?jt.then(In=>qt(In)):qt(jt)}unwrap(){return this._def.innerType}}t.ZodReadonly=st,st.create=(nn,nt)=>new st({innerType:nn,typeName:bt.ZodReadonly,...h(nt)});function ct(nn,nt={},jt){return nn?ie.create().superRefine((qt,In)=>{var jn,Bi;if(!nn(qt)){const Mi=typeof nt=="function"?nt(qt):typeof nt=="string"?{message:nt}:nt,Xi=(Bi=(jn=Mi.fatal)!==null&&jn!==void 0?jn:jt)!==null&&Bi!==void 0?Bi:!0,yi=typeof Mi=="string"?{message:Mi}:Mi;In.addIssue({code:"custom",...yi,fatal:Xi})}}):ie.create()}t.custom=ct,t.late={object:ne.lazycreate};var bt;(function(nn){nn.ZodString="ZodString",nn.ZodNumber="ZodNumber",nn.ZodNaN="ZodNaN",nn.ZodBigInt="ZodBigInt",nn.ZodBoolean="ZodBoolean",nn.ZodDate="ZodDate",nn.ZodSymbol="ZodSymbol",nn.ZodUndefined="ZodUndefined",nn.ZodNull="ZodNull",nn.ZodAny="ZodAny",nn.ZodUnknown="ZodUnknown",nn.ZodNever="ZodNever",nn.ZodVoid="ZodVoid",nn.ZodArray="ZodArray",nn.ZodObject="ZodObject",nn.ZodUnion="ZodUnion",nn.ZodDiscriminatedUnion="ZodDiscriminatedUnion",nn.ZodIntersection="ZodIntersection",nn.ZodTuple="ZodTuple",nn.ZodRecord="ZodRecord",nn.ZodMap="ZodMap",nn.ZodSet="ZodSet",nn.ZodFunction="ZodFunction",nn.ZodLazy="ZodLazy",nn.ZodLiteral="ZodLiteral",nn.ZodEnum="ZodEnum",nn.ZodEffects="ZodEffects",nn.ZodNativeEnum="ZodNativeEnum",nn.ZodOptional="ZodOptional",nn.ZodNullable="ZodNullable",nn.ZodDefault="ZodDefault",nn.ZodCatch="ZodCatch",nn.ZodPromise="ZodPromise",nn.ZodBranded="ZodBranded",nn.ZodPipeline="ZodPipeline",nn.ZodReadonly="ZodReadonly"})(bt||(t.ZodFirstPartyTypeKind=bt={}));class Ut{constructor(...nt){}}const hn=(nn,nt={message:`Input not instance of ${nn.name}`})=>ct(jt=>jt instanceof nn,nt);t.instanceof=hn;const kn=V.create;t.string=kn;const fi=Y.create;t.number=fi;const Nn=lt.create;t.nan=Nn;const cn=z.create;t.bigint=cn;const zn=H.create;t.boolean=zn;const pn=K.create;t.date=pn;const Ht=Z.create;t.symbol=Ht;const pt=X.create;t.undefined=pt;const We=oe.create;t.null=We;const Ke=ie.create;t.any=Ke;const Ze=ge.create;t.unknown=Ze;const Qt=me.create;t.never=Qt;const Cn=q.create;t.void=Cn;const ni=Se.create;t.array=ni;const ri=ne.create;t.object=ri;const xi=ne.strictCreate;t.strictObject=xi;const bi=ue.create;t.union=bi;const Ui=Pe.create;t.discriminatedUnion=Ui;const Wn=Ae.create;t.intersection=Wn;const Sn=Ce.create;t.tuple=Sn;const ii=fe.create;t.record=ii;const Oi=xe.create;t.map=Oi;const Vi=Te.create;t.set=Vi;const wi=Ne.create;t.function=wi;const dn=pe.create;t.lazy=dn;const Gn=re.create;t.literal=Gn;const vn=Oe.create;t.enum=vn;const et=De.create;t.nativeEnum=et;const It=Fe.create;t.promise=It;const yt=Ge.create;t.effect=yt,t.transformer=yt;const Ct=je.create;t.optional=Ct;const gn=gt.create;t.nullable=gn;const on=Ge.createWithPreprocess;t.preprocess=on;const Yt=rt.create;t.pipeline=Yt;const On=()=>kn().optional();t.ostring=On;const Zn=()=>fi().optional();t.onumber=Zn;const ci=()=>zn().optional();t.oboolean=ci,t.coerce={string:nn=>V.create({...nn,coerce:!0}),number:nn=>Y.create({...nn,coerce:!0}),boolean:nn=>H.create({...nn,coerce:!0}),bigint:nn=>z.create({...nn,coerce:!0}),date:nn=>K.create({...nn,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),d=e(41869),_=e(65265),v=e(98295),m=e(27654);let p=n=class extends d.Disposable{constructor(){super(...arguments),this.lantencyHandler=g=>{const{command:a}=g.detail;a===_.DevtoolsLantencyCommand.Start?this.interval||this.startRTTInterval():a===_.DevtoolsLantencyCommand.Stop&&this.interval&&(clearInterval(this.interval),this.interval=void 0)}}initialize(){var g;this.appConfig.devtools&&(window.addEventListener(_.EDevtoolsEvent.Latency,this.lantencyHandler),this.addDispose(d.Disposable.create(()=>{window.removeEventListener(_.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 a=Date.now()-g;window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.captureRPC&&(window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.latency=a)},n.INTERVAL)}};t.ChromeDevtoolsContribution=p,p.INTERVAL=1e3,r.__decorate([(0,o.Autowired)(d.AppConfig),r.__metadata("design:type",Object)],p.prototype,"appConfig",void 0),r.__decorate([(0,o.Autowired)(m.ConnectionRTTBrowserServiceToken),r.__metadata("design:type",m.ConnectionRTTBrowserService)],p.prototype,"rttService",void 0),t.ChromeDevtoolsContribution=p=n=r.__decorate([(0,v.Domain)(d.ClientAppContribution)],p)},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),d=e(26542),_=e(92323),v=e(98295),m=e(27654),p={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:d.StatusBarAlignment.LEFT,priority:1/0-1};let a=n=class{registerCommands(u){u.registerCommand(p,{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=a,a.INTERVAL=1e3,r.__decorate([(0,o.Autowired)(d.IStatusBarService),r.__metadata("design:type",Object)],a.prototype,"statusBarService",void 0),r.__decorate([(0,o.Autowired)(m.ConnectionRTTBrowserServiceToken),r.__metadata("design:type",m.ConnectionRTTBrowserService)],a.prototype,"rttService",void 0),t.ConnectionRTTContribution=a=n=r.__decorate([(0,v.Domain)(_.CommandContribution)],a)},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 d=class{async measure(){await this.connectionBackService.$measure()}};t.ConnectionRTTBrowserService=d,n.__decorate([(0,r.Autowired)(o.ConnectionBackServicePath),n.__metadata("design:type",Object)],d.prototype,"connectionBackService",void 0),t.ConnectionRTTBrowserService=d=n.__decorate([(0,r.Injectable)()],d)},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),d=e(43718),_=e(69452);let v=class extends d.WithEventBus{onDidDropFile(p){this.dropService.onDidDropFile(p)}};t.FileDropContribution=v,n.__decorate([(0,r.Autowired)(_.IFileDropFrontendServiceToken),n.__metadata("design:type",Object)],v.prototype,"dropService",void 0),n.__decorate([(0,d.OnEvent)(d.FileTreeDropEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[d.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),d=e(26542),_=e(43718),v=e(42933),{Path:m}=_.path,p=e(69452);let s=class extends _.WithEventBus{constructor(){super(...arguments),this.pending=new Set}onDidUploadFileStart(a){this.pending.add(a),this.createOrUpdateStatusBar()}onDidUploadFileEnd(a){this.pending.delete(a),this.createOrUpdateStatusBar()}createOrUpdateStatusBar(a){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,a||"0 MB"),l={text:u,alignment:d.StatusBarAlignment.RIGHT,tooltip:u,iconClass:"kaitian-icon kticon-cloud-server"};this.uploadStatus?this.uploadStatus.update({id:h,...l}):this.uploadStatus=this.statusBarService.addElement(h,l)}onDidDropFile(a){var h;const{payload:{event:u,targetDir:l}}=a;if(!l||!(!((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(),w=`${(f/((A-c)/1e3)/1024/1024).toFixed(2)} MB`;this.createOrUpdateStatusBar(w)};for(const b of E){const A=b.webkitGetAsEntry();this.processFilesEntry(l,A,y)}}async processFilesEntry(a,h,u){if(h.isFile)this.processFileEntry(h,a,u);else{const l=_.Uri.file(new m(a).join(h.fullPath).toString()).toString();await this.fs.createFolder(l),this.processDirEntry(h,a,u)}}toBinaryString(a){let h;const u=a.length;let l="";for(h=0;h<u;h+=1)l+=String.fromCharCode(a[h]);return l}async doUploadFile(a,h,u){var l;const E=new m(h).join(a.name).toString();this.onDidUploadFileStart(E.toString()),await this.fs.createFile(_.Uri.file(E.toString()).toString()),await this.dropService.$ensureFileExist(a.name,h);const f=a.stream().getReader();let c=await f.read();for(;!c.done;)await this.dropService.$writeStream(this.toBinaryString(c.value),a.name,h,c.done),u((l=c.value)===null||l===void 0?void 0:l.byteLength),c=await f.read();c.done&&this.onDidUploadFileEnd(E.toString())}processFileEntry(a,h,u){a.file(l=>{const E=new File([l],a.fullPath,{type:a.type});this.doUploadFile(E,h,u)},()=>{})}processDirEntry(a,h,u){a.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)(p.FileDropServicePath),n.__metadata("design:type",Object)],s.prototype,"dropService",void 0),n.__decorate([(0,r.Autowired)(d.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),d=e(41869),_=e(26542),v=e(43718),m=e(98295),p=e(54414),s=e(17459),g=e(84660),a=n.__importStar(e(20868)),h=e(97821),u=e(80490),l=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(T=""){const D=T.match(t.matchLineReg)||[];if(D.length<2)return;const I={line:Number(D[2]||0),start:Number(D[3]||0)};return new a.Range(I.line,I.start,I.line,I.start)}function y(T){return T.replace(t.matchLineReg,"$1")}let b=class extends h.QuickOpenBaseAction{constructor(){super({id:"file-search:splitToRight",tooltip:(0,d.localize)("quickOpen.openOnTheRightSide"),class:(0,d.getIcon)("embed")})}async run(D){await this.commandService.executeCommand(d.EDITOR_COMMANDS.OPEN_RESOURCE.id,D.getUri(),{preview:!1,split:p.EditorGroupSplitAction.Right,range:c(this.injector.get(S).currentLookFor),focus:!0})}};n.__decorate([(0,o.Autowired)(d.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(D){return y(D)}};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,d.localize)("file-search.command.fileOpen.description"),this.prevEditorState={},this.currentLookFor=""}getModel(){return{onType:async(D,I)=>{this.cancelIndicator.cancel(),this.cancelIndicator=new v.CancellationTokenSource;const O=this.cancelIndicator.token,M=new Set;let R=[];D=D.trim().replace(/\s/g,""),this.currentLookFor=D;const P=y(D),k=this.reporterService.time(v.REPORT_NAME.QUICK_OPEN_MEASURE),F=await this.getRecentlyItems(M,P,O);if(D&&(this.logger.debug("lookFor",D,P),R=await this.getFindOutItems(M,P,O)),O.isCancellationRequested)return;const L=F.concat(R);I(L,L.length?this.fileSearchActionProvider:void 0),k.timeEnd(D.indexOf("@")>-1?"file-symbol":"file",{lookFor:D,stat:{recently:F.length,find:R.length}})}}}getOptions(){return{placeholder:(0,d.localize)("file-search.command.fileOpen.placeholder"),fuzzyMatchLabel:{enableSeparateSubstringMatching:!0},showItemsWithoutHighlight:!0,fuzzyMatchDescription:{enableSeparateSubstringMatching:!0},getPlaceholderItem:D=>new d.QuickOpenItem({label:(0,d.localize)(D.indexOf("@")>-1?"search.fileSymbolResults.notfound":"search.fileResults.notfound"),run:()=>!1})}}onClose(D){D&&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 D;if(this.workbenchEditorService.currentResource){let I={startColumn:1,startLineNumber:1,endColumn:1,endLineNumber:1};const O=(D=this.workbenchEditorService.currentEditor)===null||D===void 0?void 0:D.getSelections();if(O){const{selectionStartLineNumber:M,selectionStartColumn:R,positionLineNumber:P,positionColumn:k}=O[0];I=new a.Range(M,R,P,k)}this.prevEditorState={uri:this.workbenchEditorService.currentResource.uri,range:I}}}async getFindOutItems(D,I,O){var M;let R;if(I.indexOf("@")>-1){this.trySaveEditorState(),R=[];const[P,k]=I.split("@");let F;if(this.prevSelected)F=this.prevSelected.withoutFragment();else if(P){const L=await this.getQueryFiles(P,D,O);L.length&&(F=L[0].getUri())}else F=(M=this.workbenchEditorService.currentResource)===null||M===void 0?void 0:M.uri;if(F){const L=await this.documentSymbolStore.getDocumentSymbolAsync(F)||[],B=[];this.flattenSymbols({children:L},B),R=B.filter(W=>{const U=(0,E.matchesFuzzy)(k,W.name,!0)||[];return U&&(W.labelHighlights=U),U&&U.length}).map((W,U)=>{var Q;return new d.QuickOpenItem({uri:F,label:W.name,iconClass:(0,d.getSymbolIcon)(W.kind),description:(Q=W.parent)===null||Q===void 0?void 0:Q.name,labelHighlights:W.labelHighlights,groupLabel:U===0?(0,d.formatLocalize)("search.fileSymbolResults",B.length):"",showBorder:!1,run:V=>V===d.Mode.PREVIEW?(this.locateSymbol(F,W),!0):V===d.Mode.OPEN?(this.locateSymbol(F,W),!0):!1})})}else return[]}else if(R=await this.getQueryFiles(I,D,O),R[0]){const P=await this.getItems([R[0].getUri().codeUri.fsPath],{groupLabel:(0,d.localize)("search.fileResults"),showBorder:!0});R[0]=P[0]}return R}async getQueryFiles(D,I,O){const R=(await this.workspaceService.roots).map(F=>new d.URI(F.uri).codeUri.fsPath),P=await this.fileSearchService.find(D,{rootUris:R,fuzzyMatch:!0,limit:f,useGitIgnore:!0,noIgnoreParent:!0,excludePatterns:this.getPreferenceSearchExcludes()},O),k=await this.getItems(P.filter(F=>I.has(F)||O.isCancellationRequested?!1:(I.add(F),!0)),{});return k.sort(this.compareItems.bind(this)),k}async flattenSymbols(D,I){D.children.forEach(O=>{I.push(O),O.children&&this.flattenSymbols(O,I)})}async getRecentlyItems(D,I,O){const M=await this.recentFilesManager.getMostRecentlyOpenedFiles(!0)||[];return await this.getItems(M.filter(R=>{const P=new d.URI(R);return D.has(R)||!r.default.test(I,P.displayName)||O.isCancellationRequested?!1:(D.add(R),!0)}),{groupLabel:(0,d.localize)("search.historyMatches")})}async getItems(D,I){const O=[];for(const[M,R]of D.entries()){const P=d.URI.isUriString(R)?new d.URI(R):d.URI.file(R),k=`file-icon ${this.labelService.getIcon(P.withoutFragment())}`;let F="";const L=await this.workspaceService.asRelativePath(P.parent);L&&(this.workspaceService.isMultiRootWorkspaceOpened?F=`${new d.URI(L.root).displayName}${L.path?` \u30FB ${L.path}`:""}`:F=L.path||"");const B=new d.QuickOpenItem({uri:P,label:P.displayName,tooltip:R,iconClass:k,description:F,groupLabel:M===0?I.groupLabel:"",showBorder:D.length>0&&M===0?I.showBorder:!1,run:j=>(j===d.Mode.PREVIEW&&(this.prevSelected=P),j===d.Mode.OPEN?(this.openFile(P),!0):!1)});O.push(B)}return O}openFile(D){const I=D.codeUri.fsPath;let O=c(this.currentLookFor);(!O||!O.startLineNumber&&!O.startColumn)&&(O=c(D.fragment?"#"+D.fragment:I)),this.currentLookFor="",this.commandService.executeCommand(d.EDITOR_COMMANDS.OPEN_RESOURCE.id,D.withoutFragment(),{preview:!1,range:O,focus:!0})}locateSymbol(D,I){this.workbenchEditorService.open(D,{range:I.range,preview:!0})}compareItems(D,I,O="getLabel"){function M(j){return j.trim().toLowerCase()}const R=M(y(this.currentLookFor));function P(j){const W=r.default.match(R,j);return W===null?0:W.score}let k=D[O](),F=I[O]();typeof k!="string"&&(k=k.path.toString()),typeof F!="string"&&(F=F.path.toString()),k=M(k),F=M(F);const L=P(k),B=P(F);if(L===B){const j=k.indexOf(R),W=F.indexOf(R);return j===W?k.length!==F.length?k.length<F.length?-1:1:F.localeCompare(k)===0?O==="getUri"?0:this.compareItems(D,I,"getUri"):F.localeCompare(k):j-W}return B-L}getPreferenceSearchExcludes(){const D=[],I=this.preferenceService.get("files.exclude"),O=this.preferenceService.get("search.exclude"),M=Object.assign({},I,O);for(const R of Object.keys(M))M[R]&&D.push(R);return D}};t.FileSearchQuickCommandHandler=S,n.__decorate([(0,o.Autowired)(d.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)(p.WorkbenchEditorService),n.__metadata("design:type",p.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",_.LabelService)],S.prototype,"labelService",void 0),n.__decorate([(0,o.Autowired)(l.IWorkspaceService),n.__metadata("design:type",Object)],S.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(d.RecentFilesManager),n.__metadata("design:type",d.RecentFilesManager)],S.prototype,"recentFilesManager",void 0),n.__decorate([(0,o.Autowired)(d.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)(d.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 w=class{registerQuickOpenHandlers(D){D.registerHandler(this.fileSearchQuickCommandHandler,{title:(0,d.localize)("quickopen.tab.file"),commandId:t.quickFileOpen.id,order:1})}registerCommands(D){D.registerCommand(t.quickFileOpen,{execute:()=>this.quickOpenService.open("...")}),D.registerCommand(t.quickGoToSymbol,{execute:()=>this.quickOpenService.open("...@")})}registerKeybindings(D){D.registerKeybinding({command:t.quickFileOpen.id,keybinding:"ctrlcmd+p"})}};t.FileSearchContribution=w,n.__decorate([(0,o.Autowired)(S),n.__metadata("design:type",S)],w.prototype,"fileSearchQuickCommandHandler",void 0),n.__decorate([(0,o.Autowired)(h.PrefixQuickOpenService),n.__metadata("design:type",Object)],w.prototype,"quickOpenService",void 0),t.FileSearchContribution=w=n.__decorate([(0,m.Domain)(v.CommandContribution,d.KeybindingContribution,u.QuickOpenContribution)],w)},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),d=e(69452),_=e(79682),v=e(72915),m=e(27654),p=e(17631),s=e(22874),g=e(79240),a=e(18256),h=e(7756),u=e(16426);let l=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[_.ChromeDevtoolsContribution,a.LanguageChangeHintContribution,g.FileSearchContribution,h.StatusBarContribution,u.ToolbarCustomizeContribution,p.FileDropContribution,v.ConnectionRTTContribution,{token:d.IFileDropFrontendServiceToken,useClass:s.FileDropService},{token:m.ConnectionRTTBrowserServiceToken,useClass:m.ConnectionRTTBrowserService}],this.backServices=[{servicePath:d.FileDropServicePath},{servicePath:d.ConnectionBackServicePath}]}};t.ClientAddonModule=l,t.ClientAddonModule=l=n.__decorate([(0,r.Injectable)()],l)},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),d=e(72665);let _=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=_,n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],_.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.IClientApp),n.__metadata("design:type",Object)],_.prototype,"clientApp",void 0),n.__decorate([(0,r.Autowired)(d.IDialogService),n.__metadata("design:type",Object)],_.prototype,"dialogService",void 0),t.LanguageChangeHintContribution=_=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],_)},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),d=e(43718);let _=class extends d.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=_,n.__decorate([(0,r.Autowired)(d.CommandService),n.__metadata("design:type",Object)],_.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(d.ILogger),n.__metadata("design:type",Object)],_.prototype,"logger",void 0),n.__decorate([(0,d.OnEvent)(d.BrowserConnectionOpenEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],_.prototype,"handleBrowserConnectionOpen",null),n.__decorate([(0,d.OnEvent)(d.BrowserConnectionCloseEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],_.prototype,"handleBrowserConnectionClose",null),t.StatusBarContribution=_=n.__decorate([(0,d.Domain)(o.ClientAppContribution)],_)},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),d=e(93899),_=e(62132);let v=class{registerCommands(p){p.registerCommand({id:"toolbar.showCustomizePanel",label:"Show Toolbar Customization"},{execute:()=>{this.viewService.setVisible(!0)}})}registerComponent(p){p.register("addon/toolbar-customize",{id:"addon/toolbar-customize",component:_.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(p){p.registerMenuItem(d.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)(_.ToolbarCustomizeViewService),n.__metadata("design:type",_.ToolbarCustomizeViewService)],v.prototype,"viewService",void 0),t.ToolbarCustomizeContribution=v=n.__decorate([(0,o.Domain)(o.CommandContribution,o.ComponentContribution,d.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),d=e(97267),_=e(41869),v=n.__importDefault(e(18541));let m=class{bindSetVisibleHandle(g){this._setVisible=g}setVisible(g){this._setVisible(g)}async toggleActionVisibility(g,a,h){const u=this.preferenceService.getValid("toolbar.ignoreActions",{});if(u[g]||(u[g]=[]),!h)u[g].indexOf(a)===-1&&u[g].push(a);else{const E=u[g].indexOf(a);E!==-1&&u[g].splice(E,1)}const l=this.preferenceService.inspect("toolbar.ignoreActions").workspaceValue?_.PreferenceScope.Workspace:_.PreferenceScope.User;await this.preferenceService.set("toolbar.ignoreActions",u,l)}};t.ToolbarCustomizeViewService=m,n.__decorate([(0,o.Autowired)(_.PreferenceService),n.__metadata("design:type",Object)],m.prototype,"preferenceService",void 0),t.ToolbarCustomizeViewService=m=n.__decorate([(0,o.Injectable)()],m);const p=()=>{const[s,g]=r.default.useState(!1),a=(0,_.useInjectable)(m),h=(0,_.useInjectable)(_.IToolbarRegistry),u=(0,_.useInjectable)(_.PreferenceService);if(a.bindSetVisibleHandle(g),!s)return null;const l=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((w,T)=>{const D=h.getToolbarActions({location:y,group:w.id});D&&D.actions.length>0&&(A.length>0&&A.push(r.default.createElement("div",{className:v.default["group-split"],key:"split-"+T})),D.actions.forEach((I,O)=>{var M;let R=S.indexOf(I.id)===-1;const P="action-toggle-"+I.id;A.push(r.default.createElement("div",{className:v.default["action-item"],key:O+"_"+I.id},r.default.createElement(d.CheckBox,{onChange:()=>{a.toggleActionVisibility(y,I.id,!R),R=!R},defaultChecked:R,id:P,label:(M=I.description)!==null&&M!==void 0?M:I.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"]},l.map(y=>c(y)),r.default.createElement("div",{className:v.default["button-display"]},r.default.createElement("div",null,(0,_.localize)("toolbar-customize.buttonDisplay.description")),r.default.createElement(d.Select,{options:[{label:(0,_.localize)("toolbar-customize.buttonDisplay.icon"),value:"icon"},{label:(0,_.localize)("toolbar-customize.buttonDisplay.iconAndText"),value:"iconAndText"}],value:f,onChange:y=>{const b=u.inspect("toolbar.buttonDisplay").workspaceValue?_.PreferenceScope.Workspace:_.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(d.Button,{type:"primary",onClick:()=>g(!1)},(0,_.localize)("toolbar-customize.complete")))))};t.ToolbarCustomizeComponent=p},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),d=e(50394);let _=class{get contextKeyService(){return this._contextKeyService}constructor(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.inlineChatIsVisible=d.InlineChatIsVisible.bind(this._contextKeyService),this.inlineCompletionIsTrigger=d.InlineCompletionIsTrigger.bind(this._contextKeyService),this.inlineHintWidgetIsVisible=d.InlineHintWidgetIsVisible.bind(this._contextKeyService),this.inlineInputWidgetIsVisible=d.InlineInputWidgetIsVisible.bind(this._contextKeyService),this.inlineInputWidgetIsStreaming=d.InlineInputWidgetIsStreaming.bind(this._contextKeyService),this.inlineDiffPartialEditsIsVisible=d.InlineDiffPartialEditsIsVisible.bind(this._contextKeyService),this.codeEditsIsVisible=d.CodeEditsIsVisible.bind(this._contextKeyService)}};t.AINativeContextKey=_,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],_.prototype,"globalContextKeyService",void 0),t.AINativeContextKey=_=n.__decorate([(0,r.Injectable)(),n.__param(0,(0,r.Optional)()),n.__metadata("design:paramtypes",[Object])],_)},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),d=e(57925),_=e(50394),v=e(1149),m=e(97222),p=e(43718),s=e(82353),g=e(54414),a=e(57517),h=e(51553),u=e(63067),l=e(46507),E=e(97682),f=e(68415),c=e(96640),y=e(19413),b=e(64811),A=e(69820),S=e(61282),w=e(51081),T=e(59347),D=e(76154),I=e(79559),O=e(57232),M=e(72991),R=e(71863),P=e(7511),k=e(42911),F=e(72801),L=e(87817),B=e(4972),j=e(82983),W=e(73974),U=e(33108),Q=e(77633),V=e(51221),$=e(2281),Y=e(31031),z=e(95608),H=e(38890),K=e(77886),Z=e(89060),X=e(74353),oe=e(22169),ie=e(90058);t.INLINE_DIFF_MANAGER_WIDGET_ID="inline-diff-manager-widget";let ge=class{constructor(){this.registerFeature()}async initialize(){const{supportsChatAssistant:q}=this.aiNativeConfigService.capabilities;q&&(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(q){const{supportsInlineChat:Se,supportsInlineCompletion:_e,supportsProblemFix:ne,supportsCodeAction:ue}=this.aiNativeConfigService.capabilities;q(H.InlineDiffController.ID,new c.SyncDescriptor(H.InlineDiffController,[this.injector]),E.EditorContributionInstantiation.Lazy),ue&&q(ie.SumiLightBulbWidget.ID,ie.SumiLightBulbWidget,E.EditorContributionInstantiation.Lazy),Se&&(q(V.InlineChatEditorController.ID,new c.SyncDescriptor(V.InlineChatEditorController,[this.injector]),E.EditorContributionInstantiation.BeforeFirstInteraction),this.inlineInputService.getInteractiveInputHandler()&&(q(K.InlineHintController.ID,new c.SyncDescriptor(K.InlineHintController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender),q(Z.InlineInputController.ID,new c.SyncDescriptor(Z.InlineInputController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender))),_e&&(q(P.IntelligentCompletionsController.ID,new c.SyncDescriptor(P.IntelligentCompletionsController,[this.injector]),E.EditorContributionInstantiation.Eager),q(M.InlineCompletionsController.ID,new c.SyncDescriptor(M.InlineCompletionsController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender)),ne&&q(k.ProblemFixController.ID,new c.SyncDescriptor(k.ProblemFixController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender)}onReconnect(){const{supportsMCP:q}=this.aiNativeConfigService.capabilities;q&&this.initMCPServers()}onDidStart(){(0,p.runWhenIdle)(()=>{const{supportsRenameSuggestions:q,supportsInlineChat:Se,supportsMCP:_e,supportsCustomLLMSettings:ne}=this.aiNativeConfigService.capabilities,ue=this.preferenceService.getValid(o.AINativeSettingSectionsId.ChatVisibleType);ue==="always"?this.commandService.executeCommand(d.AI_CHAT_VISIBLE.id,!0):ue==="never"&&this.commandService.executeCommand(d.AI_CHAT_VISIBLE.id,!1),q&&this.renameSingleHandler.load(),Se&&this.codeActionSingleHandler.load(),ne&&(this.preferenceService.onSpecificPreferenceChange(o.AINativeSettingSectionsId.LLMModelSelection,Ie=>{const Pe=this.getModelByName(Ie.newValue),ve=Pe?Object.keys(Pe):[],Ae=ve.length?ve[0]:"",Ce=this.preferenceSchemaProvider.getPreferenceProperty(o.AINativeSettingSectionsId.ModelID);this.preferenceSchemaProvider.setSchema({properties:{[o.AINativeSettingSectionsId.ModelID]:{...Ce,default:Ae,defaultValue:Ae,enum:ve.length?ve:void 0}}},!0),this.preferenceService.set(o.AINativeSettingSectionsId.ModelID,Ae,Ie.scope),this.preferenceSettings.setEnumLabels(o.AINativeSettingSectionsId.ModelID,ve.reduce((fe,xe)=>({...fe,[xe]:xe}),{}))}),this.preferenceService.onSpecificPreferenceChange(o.AINativeSettingSectionsId.ModelID,Ie=>{const Pe=this.preferenceService.get(o.AINativeSettingSectionsId.LLMModelSelection);if(!Pe)return;const ve=this.getModelByName(Pe);ve&&ve[Ie.newValue]&&(this.preferenceService.set(o.AINativeSettingSectionsId.MaxTokens,ve[Ie.newValue].maxTokens,Ie.scope),this.preferenceService.set(o.AINativeSettingSectionsId.ContextWindow,ve[Ie.newValue].contextWindow,Ie.scope))})),_e&&this.initMCPServers()})}async initMCPServers(){var q;const Se=await this.storageProvider(p.STORAGE_NAMESPACE.CHAT);let _e=Se.get(b.MCPServersEnabledKey,[y.BUILTIN_MCP_SERVER_NAME]);const ne=this.preferenceService.get(o.AINativeSettingSectionsId.MCPServers,[]);let ue=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0);if(ue.scope===p.PreferenceScope.Default&&ne.length>0){const Pe={mcpServers:[]},ve=new Set([y.BUILTIN_MCP_SERVER_NAME]);ne.forEach(Ae=>{Ae.type===A.MCP_SERVER_TYPE.SSE?Pe.mcpServers.push({[Ae.name]:{url:Ae.serverHost}}):Ae.type===A.MCP_SERVER_TYPE.STDIO&&Pe.mcpServers.push({[Ae.name]:{command:Ae.command,args:Ae.args,env:Ae.env}}),Ae.enabled&&ve.add(Ae.name)}),await this.preferenceService.set("mcp",Pe,p.PreferenceScope.Workspace),ue=this.preferenceService.resolve("mcp",void 0,void 0),_e=Array.from(ve),Se.set(b.MCPServersEnabledKey,_e)}const Ie=(q=ue.value)===null||q===void 0?void 0:q.mcpServers;if(this.sumiMCPServerBackendProxy.$initBuiltinMCPServer(_e.includes(y.BUILTIN_MCP_SERVER_NAME)),Ie&&Ie.length>0){const Pe=(await Promise.all(Ie.map(async ve=>{const Ae=Object.keys(ve)[0];return await this.mcpConfigService.getServerConfigByName(Ae)}))).filter(ve=>ve!==void 0);await this.sumiMCPServerBackendProxy.$initExternalMCPServers(Pe)}this.mcpConfigService.fireMCPServersChange(!0)}getModelByName(q){switch(q){case"deepseek":return y.deepSeekModels;case"anthropic":return y.anthropicModels;case"openai":return y.openAiNativeModels;default:return}}registerFeature(){this.contributions.getContributions().forEach(q=>{var Se,_e,ne,ue,Ie,Pe,ve,Ae,Ce;(Se=q.registerInlineChatFeature)===null||Se===void 0||Se.call(q,this.inlineChatFeatureRegistry),(_e=q.registerChatFeature)===null||_e===void 0||_e.call(q,this.chatFeatureRegistry),(ne=q.registerResolveConflictFeature)===null||ne===void 0||ne.call(q,this.resolveConflictRegistry),(ue=q.registerRenameProvider)===null||ue===void 0||ue.call(q,this.renameCandidatesProviderRegistry),(Ie=q.registerChatRender)===null||Ie===void 0||Ie.call(q,this.chatRenderRegistry),(Pe=q.registerTerminalProvider)===null||Pe===void 0||Pe.call(q,this.terminalProviderRegistry),(ve=q.registerIntelligentCompletionFeature)===null||ve===void 0||ve.call(q,this.intelligentCompletionsRegistry),(Ae=q.registerProblemFixFeature)===null||Ae===void 0||Ae.call(q,this.problemFixProviderRegistry),(Ce=q.registerChatAgentPromptProvider)===null||Ce===void 0||Ce.call(q)}),this.mcpServerContributions.getContributions().forEach(q=>{q.registerMCPServer(this.mcpServerRegistry)})}registerSetting(q){q.registerSettingGroup({id:o.AI_NATIVE_SETTING_GROUP_ID,title:p.AI_NATIVE_SETTING_GROUP_TITLE,iconClass:(0,o.getIcon)("magic-wand")}),q.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"}]}),q.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&&(q.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"}]}),q.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&&q.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&&q.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"}]}),this.aiNativeConfigService.capabilities.supportsInlineChat&&q.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(q){q.registerEditorFeatureContribution({contribute:Se=>{const{monacoEditor:_e}=Se;return this.codeActionSingleHandler.mountEditor(Se.monacoEditor),_e.onDidScrollChange(()=>{this.ctxMenuRenderer.visible&&this.ctxMenuRenderer.hide(!0)})}})}registerEditorComponent(q){q.registerEditorSideWidget({id:t.INLINE_DIFF_MANAGER_WIDGET_ID,component:z.InlineDiffManager,displaysOnResource:Se=>{var _e;return!!(this.aiNativeConfigService.capabilities.supportsMCP&&(!((_e=this.applyService.getUriCodeBlocks(Se.uri))===null||_e===void 0)&&_e.filter(ne=>ne.status==="pending").length))}})}registerCommands(q){q.registerCommand(d.AI_INLINE_CHAT_VISIBLE,{execute:Se=>{this.aiInlineChatService._onInlineChatVisible.fire(Se)}}),q.registerCommand(d.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE,{execute:async Se=>{var _e;if(!Se){this.inlineInputService.hide();return}this.commandService.executeCommand(d.AI_INLINE_CHAT_VISIBLE.id,!1);const ne=this.workbenchEditorService.currentCodeEditor;if(!ne)return;const ue=ne.monacoEditor.getPosition();if(!ue)return;const Ie=ne.monacoEditor.getSelection();if(ue?((_e=ne.monacoEditor.getModel())===null||_e===void 0?void 0:_e.getLineLength(ue.lineNumber))===0:!1){this.inlineInputService.visibleByPosition(ue);return}if(Ie&&!Ie.isEmpty()){this.inlineInputService.visibleBySelection(Ie);return}this.inlineInputService.visibleByNearestCodeBlock(ue,ne.monacoEditor)}}),q.registerCommand(d.AI_INLINE_CHAT_INTERACTIVE_INPUT_CANCEL,{execute:()=>{var Se;const _e=this.workbenchEditorService.currentCodeEditor;_e&&((Se=Z.InlineInputController.get(_e.monacoEditor))===null||Se===void 0||Se.cancelToken())}}),q.registerCommand(d.AI_INLINE_COMPLETION_REPORTER,{execute:(Se,_e,ne,ue)=>{this.aiCompletionsService.report({sessionId:_e,accept:ne,relationId:Se,code:ue})}}),q.registerCommand(d.AI_CHAT_VISIBLE,{execute:Se=>{this.layoutService.toggleSlot(y.AI_CHAT_VIEW_ID,(0,p.isUndefined)(Se)?!0:Se)}}),q.registerCommand(d.AI_INLINE_COMPLETION_VISIBLE,{execute:async Se=>{Se||(this.aiCompletionsService.hideStatusBarItem(),this.aiInlineCompletionsProvider.setVisibleCompletion(!1),this.aiInlineCompletionsProvider.cancelRequest())}}),q.registerCommand(d.AI_INLINE_DIFF_PARTIAL_EDIT,{execute:Se=>{this.inlineStreamDiffService.launchAcceptDiscardPartialEdit(Se)}}),q.afterExecuteCommand(f.HideInlineCompletion.ID,()=>{this.commandService.executeCommand(d.AI_INLINE_COMPLETION_VISIBLE.id,!1)})}registerRenderer(q){this.designLayoutConfig.supportExternalChatPanel?q.registerSlotRenderer(y.AI_CHAT_VIEW_ID,B.AIChatTabRendererWithTab):q.registerSlotRenderer(y.AI_CHAT_VIEW_ID,B.AIChatTabRenderer),this.designLayoutConfig.useMergeRightWithLeftPanel&&(q.registerSlotRenderer(o.SlotLocation.left,B.AILeftTabRenderer),q.registerSlotRenderer(o.SlotLocation.right,B.AIRightTabRenderer))}registerComponent(q){q.register(y.AI_CHAT_CONTAINER_ID,[],{component:D.AIChatView,title:(0,o.localize)("aiNative.chat.ai.assistant.name"),iconClass:(0,o.getIcon)("magic-wand"),containerId:y.AI_CHAT_CONTAINER_ID}),q.register(y.AI_MENU_BAR_DEBUG_TOOLBAR,{id:y.AI_MENU_BAR_DEBUG_TOOLBAR,component:L.AIRunToolbar}),q.register(y.AI_CHAT_LOGO_AVATAR_ID,{id:y.AI_CHAT_LOGO_AVATAR_ID,component:j.AIChatLogoAvatar})}registerKeybindings(q){this.aiNativeConfigService.capabilities.supportsInlineChat&&(q.registerKeybinding({command:d.AI_INLINE_CHAT_VISIBLE.id,keybinding:"ctrlcmd+i",when:"editorTextFocus",args:!0,priority:0},o.KeybindingScope.USER),q.registerKeybinding({command:d.AI_INLINE_CHAT_VISIBLE.id,keybinding:"esc",args:!1,when:`editorFocus && ${_.InlineChatIsVisible.raw}`}),this.inlineInputService.getInteractiveInputHandler()&&(q.registerKeybinding({command:d.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:this.aiNativeConfigService.inlineChat.inputKeybinding,args:!0,priority:0,when:`editorFocus && (${_.InlineChatIsVisible.raw} || inlineSuggestionVisible)`},o.KeybindingScope.USER),q.registerKeybinding({command:d.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:"esc",args:!1,priority:0,when:`editorFocus && ${_.InlineInputWidgetIsVisible.raw}`}),q.registerKeybinding({command:d.AI_INLINE_CHAT_INTERACTIVE_INPUT_CANCEL.id,keybinding:"esc",priority:1,when:`editorFocus && ${_.InlineInputWidgetIsStreaming.raw}`}),q.registerKeybinding({command:d.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:this.aiNativeConfigService.inlineChat.inputKeybinding,args:!0,priority:0,when:`editorFocus && ${_.InlineHintWidgetIsVisible.raw} && ${_.InlineChatIsVisible.not}`},o.KeybindingScope.USER))),q.registerKeybinding({command:d.AI_INLINE_DIFF_PARTIAL_EDIT.id,keybinding:"ctrl+y",args:!0,priority:100,when:`editorTextFocus && ${_.InlineDiffPartialEditsIsVisible.raw}`}),q.registerKeybinding({command:d.AI_INLINE_DIFF_PARTIAL_EDIT.id,keybinding:"ctrl+n",args:!1,priority:100,when:`editorTextFocus && ${_.InlineDiffPartialEditsIsVisible.raw}`})}};t.AINativeBrowserContribution=ge,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],ge.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],ge.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(m.IBrowserCtxMenu),n.__metadata("design:type",m.IBrowserCtxMenu)],ge.prototype,"ctxMenuRenderer",void 0),n.__decorate([(0,r.Autowired)(Q.AINativeCoreContribution),n.__metadata("design:type",Object)],ge.prototype,"contributions",void 0),n.__decorate([(0,r.Autowired)(Q.MCPServerContribution),n.__metadata("design:type",Object)],ge.prototype,"mcpServerContributions",void 0),n.__decorate([(0,r.Autowired)(Q.TokenMCPServerRegistry),n.__metadata("design:type",Object)],ge.prototype,"mcpServerRegistry",void 0),n.__decorate([(0,r.Autowired)(p.InlineChatFeatureRegistryToken),n.__metadata("design:type",$.InlineChatFeatureRegistry)],ge.prototype,"inlineChatFeatureRegistry",void 0),n.__decorate([(0,r.Autowired)(p.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"chatFeatureRegistry",void 0),n.__decorate([(0,r.Autowired)(p.ChatRenderRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"chatRenderRegistry",void 0),n.__decorate([(0,r.Autowired)(p.ResolveConflictRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"resolveConflictRegistry",void 0),n.__decorate([(0,r.Autowired)(p.RenameCandidatesProviderRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"renameCandidatesProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(p.TerminalRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"terminalProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(p.IntelligentCompletionsRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"intelligentCompletionsRegistry",void 0),n.__decorate([(0,r.Autowired)(p.ProblemFixRegistryToken),n.__metadata("design:type",Object)],ge.prototype,"problemFixProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],ge.prototype,"aiNativeConfigService",void 0),n.__decorate([(0,r.Autowired)(v.DesignLayoutConfig),n.__metadata("design:type",v.DesignLayoutConfig)],ge.prototype,"designLayoutConfig",void 0),n.__decorate([(0,r.Autowired)(R.AICompletionsService),n.__metadata("design:type",R.AICompletionsService)],ge.prototype,"aiCompletionsService",void 0),n.__decorate([(0,r.Autowired)(O.AIInlineCompletionsProvider),n.__metadata("design:type",O.AIInlineCompletionsProvider)],ge.prototype,"aiInlineCompletionsProvider",void 0),n.__decorate([(0,r.Autowired)(p.CommandService),n.__metadata("design:type",Object)],ge.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceSchemaProvider),n.__metadata("design:type",o.PreferenceSchemaProvider)],ge.prototype,"preferenceSchemaProvider",void 0),n.__decorate([(0,r.Autowired)(o.IPreferenceSettingsService),n.__metadata("design:type",Object)],ge.prototype,"preferenceSettings",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],ge.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(u.IMainLayoutService),n.__metadata("design:type",Object)],ge.prototype,"layoutService",void 0),n.__decorate([(0,r.Autowired)(y.ChatProxyServiceToken),n.__metadata("design:type",w.ChatProxyService)],ge.prototype,"chatProxyService",void 0),n.__decorate([(0,r.Autowired)(o.IAIInlineChatService),n.__metadata("design:type",Y.InlineChatService)],ge.prototype,"aiInlineChatService",void 0),n.__decorate([(0,r.Autowired)(X.InlineInputService),n.__metadata("design:type",X.InlineInputService)],ge.prototype,"inlineInputService",void 0),n.__decorate([(0,r.Autowired)(oe.InlineStreamDiffService),n.__metadata("design:type",oe.InlineStreamDiffService)],ge.prototype,"inlineStreamDiffService",void 0),n.__decorate([(0,r.Autowired)(F.RenameSingleHandler),n.__metadata("design:type",F.RenameSingleHandler)],ge.prototype,"renameSingleHandler",void 0),n.__decorate([(0,r.Autowired)(I.CodeActionSingleHandler),n.__metadata("design:type",I.CodeActionSingleHandler)],ge.prototype,"codeActionSingleHandler",void 0),n.__decorate([(0,r.Autowired)(y.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],ge.prototype,"sumiMCPServerBackendProxy",void 0),n.__decorate([(0,r.Autowired)(p.MCPConfigServiceToken),n.__metadata("design:type",U.MCPConfigService)],ge.prototype,"mcpConfigService",void 0),n.__decorate([(0,r.Autowired)(g.WorkbenchEditorService),n.__metadata("design:type",h.WorkbenchEditorServiceImpl)],ge.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(y.IChatManagerService),n.__metadata("design:type",S.ChatManagerService)],ge.prototype,"chatManagerService",void 0),n.__decorate([(0,r.Autowired)(y.IChatInternalService),n.__metadata("design:type",T.ChatInternalService)],ge.prototype,"chatInternalService",void 0),n.__decorate([(0,r.Autowired)(W.BaseApplyService),n.__metadata("design:type",W.BaseApplyService)],ge.prototype,"applyService",void 0),n.__decorate([(0,r.Autowired)(p.StorageProvider),n.__metadata("design:type",Function)],ge.prototype,"storageProvider",void 0),t.AINativeBrowserContribution=ge=n.__decorate([(0,o.Domain)(o.ClientAppContribution,a.BrowserEditorContribution,o.CommandContribution,l.SettingContribution,o.KeybindingContribution,o.ComponentContribution,o.SlotRendererContribution,o.MonacoContribution),n.__metadata("design:paramtypes",[])],ge)},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),d=e(57517),_=e(19413),v=e(73974),m=e(51081);let p=class extends v.BaseApplyService{async doApply(g){const a=new o.URI(o.path.join(this.appConfig.workspaceDir,g.relativePath)),u=(await this.modelService.createModelReference(a)).instance.getMonacoModel().getValue();return{stream:await this.aiBackService.requestStream(`Merge all changes from the <update> snippet into the <code> below.
31405
31405
  - Preserve the code's structure, order, comments, and indentation exactly.
31406
31406
  - Output only the updated code, enclosed within <updated-code> and </updated-code> tags.
31407
31407
  - Do not include any additional text, explanations, placeholders, ellipses, or code fences.
@@ -31544,7 +31544,7 @@ ${f.slice(1).join(`
31544
31544
  `).map(w=>{if(w.startsWith("@@")){const[,,,T,D]=w.match(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);return new p.Range(parseInt(T,10),0,parseInt(T,10)+parseInt(D,10)-1,0)}return null}).filter(w=>w!==null);return{diff:A,rangesFromDiffHunk:S}}getDiagnosticInfos(c,y){return this.markerService.getManager().getMarkers({resource:c}).filter(A=>A.severity>=d.MarkerSeverity.Warning&&y.some(S=>S.containsPosition(new p.Position(A.startLineNumber,A.startColumn))))}}t.BaseApplyService=E,n.__decorate([(0,o.Autowired)(a.IChatInternalService),n.__metadata("design:type",h.ChatInternalService)],E.prototype,"chatInternalService",void 0),n.__decorate([(0,o.Autowired)(d.AppConfig),n.__metadata("design:type",Object)],E.prototype,"appConfig",void 0),n.__decorate([(0,o.Autowired)(_.WorkbenchEditorService),n.__metadata("design:type",_.WorkbenchEditorService)],E.prototype,"editorService",void 0),n.__decorate([(0,o.Autowired)(a.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)(d.IAIReporter),n.__metadata("design:type",Object)],E.prototype,"aiReporter",void 0),n.__decorate([(0,d.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,d.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)),d=e(97267),_=e(41869),v=e(43718),m=e(19413),p=n.__importDefault(e(76599)),s=e(51750),g=()=>{const a=(0,_.useInjectable)(v.MCPConfigServiceToken),[h,u]=o.default.useState([]),[l,E]=o.default.useState(!1),[f,c]=o.default.useState(),[y,b]=o.default.useState(),[A,S]=o.default.useState(!1),w=(0,o.useCallback)(async()=>{const P=await a.getServers();u(P)},[a]);o.default.useEffect(()=>{w();const P=a.onMCPServersChange(k=>{k&&S(!0),w()});return()=>{P.dispose()}},[w]);const T=(0,o.useCallback)(async(P,k)=>{try{b(P),await a.controlServer(P,k),await w(),b(void 0)}catch{b(void 0)}},[a,w]),D=(0,o.useCallback)(()=>{c(void 0),E(!0)},[]),I=(0,o.useCallback)(async P=>{const k=await a.getServerConfigByName(P.name);k&&(c(k),E(!0))},[a]),O=(0,o.useCallback)(async P=>{await a.deleteServer(P),await w()},[a,w]),M=(0,o.useCallback)(async P=>{await a.saveServer(P),E(!1),await w()},[a,w]),R=(0,o.useCallback)(async P=>{b(P.name),await a.syncServer(P.name),await w(),b(void 0)},[a,w]);return o.default.createElement("div",{className:p.default.container},o.default.createElement("div",{className:p.default.header},o.default.createElement("div",null,o.default.createElement("h2",{className:p.default.title},"MCP Servers"),o.default.createElement("p",{className:p.default.description},(0,v.localize)("ai.native.mcp.manage.connections"))),o.default.createElement("button",{className:p.default.actionButton,onClick:D},o.default.createElement(d.Icon,{icon:"plus",className:p.default.actionButtonIcon}),(0,v.localize)("ai.native.mcp.addMCPServer.title"))),o.default.createElement("div",{className:p.default.serversList},h.map(P=>o.default.createElement("div",{key:P.name,className:p.default.serverItem},o.default.createElement("div",{className:p.default.serverHeader},o.default.createElement("div",{className:p.default.serverTitleRow},o.default.createElement("h3",{className:p.default.serverName},P.name,o.default.createElement("span",{className:(0,r.default)(p.default.serverStatusIcon,P.isStarted?p.default.active:p.default.inactive)}))),o.default.createElement("div",{className:p.default.serverActions},o.default.createElement(d.Popover,{id:"mcp-server-action-popover",trigger:d.PopoverTriggerType.hover,content:P.isStarted?(0,v.localize)("ai.native.mcp.disable.title"):(0,v.localize)("ai.native.mcp.enable.title")},o.default.createElement(d.Button,{type:"default",className:(0,r.default)(p.default.serverActionButton,P.isStarted&&p.default.active),onClick:()=>T(P.name,!P.isStarted)},o.default.createElement("i",{className:`codicon ${y===P.name||!A&&P.name!==m.BUILTIN_MCP_SERVER_NAME?"codicon-loading kt-icon-loading":P.isStarted?"codicon-check":"codicon-circle"}`}),o.default.createElement("span",null,(0,v.localize)(P.isStarted?"ai.native.mcp.enabled":"ai.native.mcp.disabled")))),P.name!==m.BUILTIN_MCP_SERVER_NAME&&o.default.createElement(d.Button,{type:"icon",iconClass:"codicon codicon-edit",className:p.default.iconButton,title:(0,v.localize)("ai.native.mcp.tool.action.edit"),onClick:()=>I(P)}),P.name!==m.BUILTIN_MCP_SERVER_NAME&&o.default.createElement(d.Button,{type:"icon",iconClass:"codicon codicon-sync",className:p.default.iconButton,title:(0,v.localize)("ai.native.mcp.tool.action.sync"),onClick:()=>R(P)}),P.name!==m.BUILTIN_MCP_SERVER_NAME&&o.default.createElement(d.Button,{type:"icon",iconClass:"codicon codicon-trash",className:p.default.iconButton,title:(0,v.localize)("ai.native.mcp.tool.action.delete"),onClick:()=>O(P.name)}))),o.default.createElement("div",{className:p.default.serverDetail},P.type&&o.default.createElement("div",{className:p.default.detailRow},o.default.createElement("span",{className:p.default.detailLabel},"Type:"),o.default.createElement(d.Badge,{className:(0,r.default)(p.default.serverType,p.default.typeTag)},a.getReadableServerType(P.type)))),P.tools&&P.tools.length>0&&o.default.createElement("div",{className:p.default.serverDetail},o.default.createElement("div",{className:p.default.detailRow},o.default.createElement("span",{className:p.default.detailLabel},"Tools:"),o.default.createElement("span",{className:p.default.detailContent},P.tools.map((k,F)=>o.default.createElement(d.Badge,{key:F,className:p.default.toolTag,title:k.description},k.name))))),P.command&&o.default.createElement("div",{className:p.default.serverDetail},o.default.createElement("div",{className:p.default.detailRow},o.default.createElement("span",{className:p.default.detailLabel},"Command:"),o.default.createElement("span",{className:p.default.detailContent},P.command))),P.url&&o.default.createElement("div",{className:p.default.serverDetail},o.default.createElement("div",{className:p.default.detailRow},o.default.createElement("span",{className:p.default.detailLabel},"Server Link:"),o.default.createElement("span",{className:(0,r.default)(p.default.detailContent,p.default.link)},P.url)))))),o.default.createElement(s.MCPServerForm,{visible:l,initialData:f,servers:h,onSave: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)),d=e(97267),_=e(48412),v=e(53017),m=e(41869),p=e(43718),s=e(72665),g=e(69820),a=n.__importDefault(e(83761)),h=({visible:u,initialData:l,onSave:E,onCancel:f,servers:c})=>{const[y,b]=(0,o.useState)(()=>({name:"",command:"",args:[],env:{},type:g.MCP_SERVER_TYPE.STDIO,...l})),A=(0,m.useInjectable)(s.IMessageService),[S,w]=(0,o.useState)(()=>{var B;return((B=l?.args)===null||B===void 0?void 0:B.join(" "))||""}),[T,D]=(0,o.useState)(()=>l?.env?Object.entries(l.env).map(([B,j])=>`${B}=${j}`).join(`
31545
31545
  `):"");(0,o.useEffect)(()=>{var B;b({name:"",command:"",args:[],env:{},type:g.MCP_SERVER_TYPE.STDIO,...l}),w(((B=l?.args)===null||B===void 0?void 0:B.join(" "))||""),D(l?.env?Object.entries(l.env).map(([j,W])=>`${j}=${W}`).join(`
31546
31546
  `):"")},[l]);const I=(0,o.useCallback)(B=>{var j,W;if(B.name.trim()==="")return A.error((0,p.localize)("ai.native.mcp.name.isRequired")),!1;if(!l&&c.some(Q=>Q.name.toLocaleLowerCase()===B.name.toLocaleLowerCase()))return A.error((0,p.formatLocalize)("ai.native.mcp.serverNameExists",B.name)),!1;if(B.type===g.MCP_SERVER_TYPE.SSE){const Q=((j=B.url)===null||j===void 0?void 0:j.trim())!=="";return Q||A.error((0,p.localize)("ai.native.mcp.url.isRequired")),Q}const U=((W=B.command)===null||W===void 0?void 0:W.trim())!=="";return U||A.error((0,p.localize)("ai.native.mcp.command.isRequired")),U},[c,l]),O=(0,o.useCallback)(B=>{var j;if(B.preventDefault(),!I(y))return;const U={...y};if(y.type===g.MCP_SERVER_TYPE.SSE)U.url=(j=U.url)===null||j===void 0?void 0:j.trim();else{const Q=S.split(" ").filter(Boolean),V=T.split(`
31547
- `).filter(Boolean).reduce(($,Y)=>{const[z,H]=Y.split("=");return z&&H&&($[z.trim()]=H.trim()),$},{});U.args=Q,U.env=V}b({...y,command:"",url:"",args:[],env:{}}),E(U)},[y,S,T,E,I]),M=(0,o.useCallback)(B=>{b({...y,command:B.target.value})},[y,S]),R=(0,o.useCallback)(B=>{w(B.target.value)},[S]),P=(0,o.useCallback)(B=>{D(B.target.value)},[T]),k=(0,o.useCallback)(B=>{b({...y,url:B.target.value})},[y]),F=(0,o.useCallback)(B=>{b({...y,type:B,command:"",args:[],env:{},url:""})},[y]),L=(0,o.useCallback)(()=>y?.type===g.MCP_SERVER_TYPE.STDIO?o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:a.default.formItem},o.default.createElement("label",null,(0,p.localize)("ai.native.mcp.command")),o.default.createElement("input",{type:"text",value:y.command,onChange:M,placeholder:(0,p.localize)("ai.native.mcp.command.placeHolder"),required:!0})),o.default.createElement("div",{className:a.default.formItem},o.default.createElement("label",null,(0,p.localize)("ai.native.mcp.args")),o.default.createElement("textarea",{value:S,onChange:R,placeholder:(0,p.localize)("ai.native.mcp.args.placeHolder"),rows:3})),o.default.createElement("div",{className:a.default.formItem},o.default.createElement("label",null,(0,p.localize)("ai.native.mcp.env")),o.default.createElement("textarea",{value:T,onChange:P,placeholder:(0,p.localize)("ai.native.mcp.env.placeHolder"),rows:3}))):o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:a.default.formItem},o.default.createElement("label",null,(0,p.localize)("ai.native.mcp.url")),o.default.createElement("textarea",{value:y.url,onChange:k,placeholder:(0,p.localize)("ai.native.mcp.url.placeHolder"),rows:3}))),[y,S,T]);return o.default.createElement(v.Modal,{title:l?(0,p.localize)("ai.native.mcp.editMCPServer.title"):(0,p.localize)("ai.native.mcp.addMCPServer.title"),visible:u,onCancel:f,centered:!0,width:600,footer:null,style:{background:"var(--editor-background)"}},o.default.createElement("form",{className:a.default.form,onSubmit:B=>B.preventDefault()},o.default.createElement("div",{className:a.default.formRow},o.default.createElement("div",{className:(0,r.default)(a.default.formItem,a.default.formItemName)},o.default.createElement("label",null,(0,p.localize)("ai.native.mcp.name")),o.default.createElement("input",{type:"text",value:y.name,onChange:B=>b({...y,name:B.target.value}),placeholder:(0,p.localize)("ai.native.mcp.name.placeHolder"),required:!0})),o.default.createElement("div",{className:(0,r.default)(a.default.formItem,a.default.formItemType)},o.default.createElement("label",null,(0,p.localize)("ai.native.mcp.type")),o.default.createElement(d.Select,{size:"large",value:y.type,options:[{label:(0,p.localize)("ai.native.mcp.stdio"),value:g.MCP_SERVER_TYPE.STDIO},{label:(0,p.localize)("ai.native.mcp.sse"),value:g.MCP_SERVER_TYPE.SSE}],className:a.default.formItemSelect,onChange:F}))),L(),o.default.createElement("div",{className:a.default.formActions},o.default.createElement(_.Button,{onClick:f,type:"primary",className:a.default.secondaryButton},(0,p.localize)("ai.native.mcp.buttonCancel")),o.default.createElement(_.Button,{onClick:O,type:"primary"},l?(0,p.localize)("ai.native.mcp.buttonUpdate"):(0,p.localize)("ai.native.mcp.buttonSave")))))};t.MCPServerForm=h},27397:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigCommandContribution=t.MCPConfigCommands=void 0;const n=e(85608),r=e(76003),o=e(41869),d=e(43718),_=e(54414),v=e(5297),m=e(33108);var p;(function(g){g.OPEN_MCP_CONFIG={id:"mcp.openConfig",label:"Open MCP Configuration"},g.OPEN_MCP_CONFIG_FILE={id:"mcp.openConfigFile",label:"Open MCP Configuration (JSON)"}})(p||(t.MCPConfigCommands=p={}));let s=class{registerCommands(a){a.registerCommand(p.OPEN_MCP_CONFIG,{execute:()=>{const h=new o.URI().withScheme(v.MCP_CONFIG_COMPONENTS_SCHEME_ID);this.editorService.open(h,{preview:!1,focus:!0})}}),a.registerCommand(p.OPEN_MCP_CONFIG_FILE,{execute:()=>{this.mcpConfigService.openConfigFile()}})}};t.MCPConfigCommandContribution=s,n.__decorate([(0,r.Autowired)(_.WorkbenchEditorService),n.__metadata("design:type",_.WorkbenchEditorService)],s.prototype,"editorService",void 0),n.__decorate([(0,r.Autowired)(d.MCPConfigServiceToken),n.__metadata("design:type",m.MCPConfigService)],s.prototype,"mcpConfigService",void 0),t.MCPConfigCommandContribution=s=n.__decorate([(0,d.Domain)(o.CommandContribution)],s)},5297:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigContribution=t.MCP_CONFIG_COMPONENTS_SCHEME_ID=void 0;const n=e(85608),r=e(76003),o=e(97267),d=e(93899),_=e(39496),v=e(26542),m=e(43718),p=e(82196),s=e(7443),g=e(10560),a=e(75279),h=e(27397),u="opensumi-mcp-config-viewer";t.MCP_CONFIG_COMPONENTS_SCHEME_ID="mcp-config";let l=class{registerEditorComponent(f){f.registerEditorComponent({uid:u,scheme:t.MCP_CONFIG_COMPONENTS_SCHEME_ID,component:a.MCPConfigView,renderMode:p.EditorComponentRenderMode.ONE_PER_WORKBENCH}),f.registerEditorComponentResolver(t.MCP_CONFIG_COMPONENTS_SCHEME_ID,(c,y)=>{y.push({type:"component",componentId:u})})}registerResource(f){f.registerResourceProvider({scheme:t.MCP_CONFIG_COMPONENTS_SCHEME_ID,provideResource:async c=>{const{configType:y}=c.getParsedQuery();return{uri:c,name:(0,m.localize)("ai.native.mcp.config.title"),icon:(0,o.getIcon)("mcp"),metadata:{configType:y}}}})}registerMenus(f){f.registerMenuItem(_.MenuId.EditorTitle,{command:h.MCPConfigCommands.OPEN_MCP_CONFIG_FILE.id,iconClass:(0,o.getIcon)("open"),group:"navigation",order:4,when:`resourceScheme == ${t.MCP_CONFIG_COMPONENTS_SCHEME_ID}`}),f.registerMenuItem(_.MenuId.EditorTitle,{command:h.MCPConfigCommands.OPEN_MCP_CONFIG.id,iconClass:(0,o.getIcon)("open"),group:"navigation",order:4,when:"resourceFilename =~ /mcp.json/"})}};t.MCPConfigContribution=l,n.__decorate([(0,r.Autowired)(g.IWorkspaceService),n.__metadata("design:type",Object)],l.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(s.IconService),n.__metadata("design:type",s.IconService)],l.prototype,"iconService",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",v.LabelService)],l.prototype,"labelService",void 0),t.MCPConfigContribution=l=n.__decorate([(0,m.Domain)(p.BrowserEditorContribution,d.MenuContribution)],l)},33108:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigService=void 0;const n=e(85608),r=e(76003),o=e(41869),d=e(78132),_=e(43718),v=e(54414),m=e(72665),p=e(19413),s=e(64811),g=e(69820),a=e(45331);let h=class extends _.Disposable{constructor(){super(),this.whenReadyDeferred=new _.Deferred,this.mcpServersChangeEventEmitter=new _.Emitter,this.init(),this.disposables.push(this.mcpServerProxyService.onChangeMCPServers(()=>{this.fireMCPServersChange()})),this.disposables.push(this.preferenceService.onSpecificPreferenceChange("mcp",()=>{this.fireMCPServersChange()}))}async init(){this.chatStorage=await this.storageProvider(_.STORAGE_NAMESPACE.CHAT),this.whenReadyDeferred.resolve()}get whenReady(){return this.whenReadyDeferred.promise}get onMCPServersChange(){return this.mcpServersChangeEventEmitter.event}fireMCPServersChange(l=!1){this.mcpServersChangeEventEmitter.fire(l)}async getServers(){const{value:l,scope:E}=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0);if(E===_.PreferenceScope.Default){const S=(await this.mcpServerProxyService.$getServers()).find(w=>w.name===p.BUILTIN_MCP_SERVER_NAME);return S?[S]:[]}const f=l?.mcpServers.map(A=>{const S=Object.keys(A)[0],w=A[S];return w.url?{name:S,type:g.MCP_SERVER_TYPE.SSE,url:w.url}:{name:S,type:g.MCP_SERVER_TYPE.STDIO,command:w.command,args:w.args,env:w.env}}),c=await this.mcpServerProxyService.$getServers(),y=c.find(A=>A.name===p.BUILTIN_MCP_SERVER_NAME),b=f?.map(A=>{const S=c.find(w=>w.name===A.name);return{...A,isStarted:S?.isStarted||!1,tools:S?.tools||[]}});return y&&b.unshift(y),b}async controlServer(l,E){try{E?await this.mcpServerProxyService.$startServer(l):await this.mcpServerProxyService.$stopServer(l);const f=this.chatStorage.get(s.MCPServersEnabledKey,[p.BUILTIN_MCP_SERVER_NAME]),c=new Set(f);E?c.add(l):c.delete(l),this.chatStorage.set(s.MCPServersEnabledKey,Array.from(c))}catch(f){const c=f.message||f;throw this.logger.error(`Failed to ${E?"start":"stop"} server ${l}:`,c),this.messageService.error(c),f}}async saveServer(l){await this.whenReady;const{value:E}=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0),f=E.mcpServers,c=f?.findIndex(b=>Object.keys(b)[0]===l.name);let y;l.type===g.MCP_SERVER_TYPE.SSE?y={[l.name]:{url:l.url}}:y={[l.name]:{command:l.command,args:l.args,env:l.env}},c!==void 0&&c>=0?f[c]=y:f.push(y),await this.sumiMCPServerBackendProxy.$addOrUpdateServer(l),await this.preferenceService.set("mcp",{mcpServers:f})}async deleteServer(l){const{value:E}=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0),f=E?.mcpServers,c=f?.findIndex(y=>Object.keys(y)[0]===l);c!==void 0&&c>=0&&f?.splice(c,1),await this.sumiMCPServerBackendProxy.$removeServer(l),await this.preferenceService.set("mcp",{mcpServers:f})}async syncServer(l){await this.sumiMCPServerBackendProxy.$syncServer(l)}async getServerConfigByName(l){const{value:E}=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0);await this.whenReady;const f=this.chatStorage.get(s.MCPServersEnabledKey,[p.BUILTIN_MCP_SERVER_NAME]),c=E?.mcpServers,y=c?.find(b=>Object.keys(b)[0]===l);if(y)return y[l].url?{name:l,type:g.MCP_SERVER_TYPE.SSE,url:y[l].url,enabled:f.includes(l)}:{name:l,type:g.MCP_SERVER_TYPE.STDIO,command:y[l].command,args:y[l].args,env:y[l].env,enabled:f.includes(l)}}getReadableServerType(l){switch(l){case g.MCP_SERVER_TYPE.STDIO:return(0,_.localize)("ai.native.mcp.type.stdio");case g.MCP_SERVER_TYPE.SSE:return(0,_.localize)("ai.native.mcp.type.sse");case g.MCP_SERVER_TYPE.BUILTIN:return(0,_.localize)("ai.native.mcp.type.builtin");default:return l}}async openConfigFile(){let l=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0);l.scope===_.PreferenceScope.Default&&(await this.preferenceService.set("mcp",{mcpServers:[]},_.PreferenceScope.Workspace),l=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0));const E=l.configUri;E&&this.workbenchEditorService.open(E,{preview:!1})}};t.MCPConfigService=h,n.__decorate([(0,r.Autowired)(p.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],h.prototype,"sumiMCPServerBackendProxy",void 0),n.__decorate([(0,r.Autowired)(a.MCPServerProxyService),n.__metadata("design:type",a.MCPServerProxyService)],h.prototype,"mcpServerProxyService",void 0),n.__decorate([(0,r.Autowired)(d.PreferenceService),n.__metadata("design:type",Object)],h.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(m.IMessageService),n.__metadata("design:type",Object)],h.prototype,"messageService",void 0),n.__decorate([(0,r.Autowired)(_.StorageProvider),n.__metadata("design:type",Function)],h.prototype,"storageProvider",void 0),n.__decorate([(0,r.Autowired)(v.WorkbenchEditorService),n.__metadata("design:type",v.WorkbenchEditorService)],h.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],h.prototype,"logger",void 0),t.MCPConfigService=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},33368:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPFolderPreferenceProvider=void 0;const n=e(85608),r=e(76003),o=e(91825);let d=class extends o.FolderFilePreferenceProvider{parse(v){const m=super.parse(v);if(m!==void 0)return{mcp:{...m}}}getPath(v){if(v==="mcp")return[];if(v.startsWith("mcp."))return[v.substr(4)]}};t.MCPFolderPreferenceProvider=d,t.MCPFolderPreferenceProvider=d=n.__decorate([(0,r.Injectable)()],d)},55003:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPPreferencesContribution=t.MCPResourceProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),d=e(57517),_=e(924);let v=class{provideResource(s){return{supportsRevive:!0,name:(0,o.localize)("menu-bar.title.debug"),icon:(0,o.getIcon)("debug"),uri:s}}provideResourceSubname(){return null}async shouldCloseResource(){return!0}};t.MCPResourceProvider=v,t.MCPResourceProvider=v=n.__decorate([(0,r.Injectable)()],v);let m=class{constructor(){this.schema=_.MCPPreferencesSchema,this.name="mcp"}registerResource(s){s.registerResourceProvider(this.prefResourceProvider)}registerSchema(s){s.registerSchema(_.MCPSchemaUri,_.MCPSchema,["mcp.json"])}};t.MCPPreferencesContribution=m,n.__decorate([(0,r.Autowired)(v),n.__metadata("design:type",v)],m.prototype,"prefResourceProvider",void 0),t.MCPPreferencesContribution=m=n.__decorate([(0,o.Domain)(o.PreferenceContribution,o.PreferenceConfiguration,d.BrowserEditorContribution,o.JsonSchemaContribution)],m)},924:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPSchema=t.MCPPreferencesSchema=t.MCPSchemaUri=void 0,t.MCPSchemaUri="vscode://schemas/mcp/user",t.MCPPreferencesSchema={type:"object",scope:"resource",properties:{mcp:{$ref:t.MCPSchemaUri,description:"MCP configuration for Workspace.",defaultValue:{mcpServers:[]}}}},t.MCPSchema={$id:t.MCPSchemaUri,type:"object",title:"MCP",required:[],default:{mcpServers:[]},properties:{mcpServers:{type:"array",description:"List of MCP Servers. Add new servers or edit existing ones by using IntelliSense.",items:{type:"object",properties:{command:{type:"string",description:"The command to start the MCP server."},args:{type:"array",description:"The arguments for the command to start the MCP server."},env:{type:"object",description:"The environment variables for the command to start the MCP server."},url:{type:"string",description:"The SSE URL for the MCP server."}}}}}}},45331:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPServerProxyService=void 0;const n=e(85608),r=e(48085),o=e(76003),d=e(41869),_=e(43718),v=e(19413),m=e(77633);let p=class{constructor(){this._onChangeMCPServers=new _.Emitter,this.onChangeMCPServers=this._onChangeMCPServers.event}$callMCPTool(g,a){return this.mcpServerRegistry.callMCPTool(g,a)}async $getBuiltinMCPTools(){const g=await this.mcpServerRegistry.getMCPTools().map(a=>({name:a.name,description:a.description,inputSchema:(0,r.zodToJsonSchema)(a.inputSchema),providerName:v.BUILTIN_MCP_SERVER_NAME}));return this.logger.log("SUMI MCP tools",g),g}async $updateMCPServers(){this._onChangeMCPServers.fire("update")}async getAllMCPTools(){return this.sumiMCPServerProxyService.$getAllMCPTools()}async $getServers(){return this.sumiMCPServerProxyService.$getServers()}async $startServer(g){await this.sumiMCPServerProxyService.$startServer(g)}async $stopServer(g){await this.sumiMCPServerProxyService.$stopServer(g)}};t.MCPServerProxyService=p,n.__decorate([(0,o.Autowired)(m.TokenMCPServerRegistry),n.__metadata("design:type",Object)],p.prototype,"mcpServerRegistry",void 0),n.__decorate([(0,o.Autowired)(d.ILogger),n.__metadata("design:type",Object)],p.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(v.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],p.prototype,"sumiMCPServerProxyService",void 0),t.MCPServerProxyService=p=n.__decorate([(0,o.Injectable)()],p)},79502:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPServerRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718),d=e(19413),_=e(98864);class v{constructor(s){this.logger=s}appendLine(s){this.logger.log(s)}}let m=class{constructor(){this.tools=[],this.toolComponents={}}get logger(){return new v(this.baseLogger)}set activeMessageInfo(s){this._activeMessageInfo=s}getMCPTool(s,g=d.BUILTIN_MCP_SERVER_NAME){return this.tools.find(a=>(0,_.getToolName)(a.name,g)===s)}registerMCPTool(s){this.tools.push(s)}registerToolComponent(s,g,a=d.BUILTIN_MCP_SERVER_NAME){this.toolComponents[(0,_.getToolName)(s,a)]=g}getToolComponent(s){return this.toolComponents[s]}getMCPTools(){return this.tools.sort((s,g)=>{var a,h;return((a=s.order)!==null&&a!==void 0?a:1/0)-((h=g.order)!==null&&h!==void 0?h:1/0)})}async callMCPTool(s,g){try{const a=this.tools.find(l=>l.name===s);if(!a)throw new Error(`MCP tool ${s} not found`);const h=g.toolCallId;g=a.inputSchema.parse(g);const u=await a.handler({...g,toolCallId:h},this.logger);return this.reportToolCall(s,g,u,h),u}catch(a){return console.error("callMCPTool error:",a),this.reportToolCall(s,g,a,g.toolCallId),{content:[{type:"text",text:`The tool ${s} failed to execute. Error: ${a}`}],isError:!0}}}reportToolCall(s,g,a,h){if(!this.tools.find(l=>l.name===s))throw new Error(`MCP tool ${s} not found`);this.aiReporter.send({msgType:o.AIServiceType.ToolCall,message:JSON.stringify({args:g,name:s,result:a}),messageId:this._activeMessageInfo.messageId,sessionId:this._activeMessageInfo.sessionId,relationId:h})}};t.MCPServerRegistry=m,n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],m.prototype,"baseLogger",void 0),n.__decorate([(0,r.Autowired)(o.IAIReporter),n.__metadata("design:type",Object)],m.prototype,"aiReporter",void 0),t.MCPServerRegistry=m=n.__decorate([(0,r.Injectable)()],m)},30703:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPToolsDialog=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=n.__importDefault(e(49783)),d=({tools:_})=>r.createElement("div",{className:o.default.mcp_tools_dialog},r.createElement("div",{className:o.default.dialog_title},"MCP Tools"),r.createElement("div",{className:o.default.tools_list},_.map(v=>r.createElement("div",{key:v.name,className:o.default.tool_item},r.createElement("div",{className:o.default.tool_name},v.name),r.createElement("div",{className:o.default.tool_description},v.description),v.providerName&&r.createElement("div",{className:o.default.tool_provider},"Provider: ",v.providerName)))));t.MCPToolsDialog=d},58260:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditFileToolComponent=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),d=e(97267),_=e(41869),v=e(54414),m=e(14162),p=e(87822),s=e(16781),g=e(21967),a=e(56474),h=e(73974),u=n.__importDefault(e(51601)),l=E=>{var f,c,y;const{args:b,messageId:A,toolCallId:S}=E,[w,T]=(0,o.useState)("code"),D=(0,_.useInjectable)(_.LabelService),I=(0,_.useInjectable)(_.AppConfig),O=(0,_.useInjectable)(h.BaseApplyService),M=(0,_.useInjectable)(v.WorkbenchEditorService),{target_file:R="",code_edit:P,instructions:k}=b||{},F=_.path.join(I.workspaceDir,R),[L,B]=(0,o.useState)(O.getCodeBlock(S,A)),j=(0,o.useMemo)(()=>R?`file-icon ${D.getIcon(_.URI.file(F))}`:void 0,[R,F]),W=(0,o.useMemo)(()=>{if(!R)return;const Q=s.StandaloneServices.get(p.IModelService),V=s.StandaloneServices.get(m.ILanguageService);return(0,_.detectModeId)(Q,V,_.Uri.file(F))},[R,F]);(0,o.useEffect)(()=>{const Q=O.onCodeBlockUpdate(V=>{V.toolCallId===S&&B({...V})});return()=>{Q.dispose()}},[]);const U=Q=>{Q.stopPropagation(),T(w==="code"?"diff":"code")};return!b||!L?null:[k&&o.default.createElement("p",{key:"edit-file-tool-instructions"},k),o.default.createElement("div",{className:u.default["edit-file-tool"],key:"edit-file-tool"},o.default.createElement("div",{className:(0,r.default)(u.default["edit-file-tool-header"],{clickable:L.status==="pending"||L.status==="success"}),onClick:()=>{L.status==="pending"?M.open(_.URI.file(F)):L.status==="success"&&O.revealApplyPosition(L)}},o.default.createElement("div",{className:u.default.left},j&&o.default.createElement("span",{className:j}),o.default.createElement("span",{className:u.default["edit-file-tool-file-name"]},R),L.iterationCount>1&&o.default.createElement("span",{className:u.default["edit-file-tool-iteration-count"]},L.iterationCount,"/3"),o.default.createElement(g.ApplyStatus,{status:L.status,error:E.result})),o.default.createElement("div",{className:u.default.right},o.default.createElement(d.Popover,{title:"Show Code",id:"edit-file-tool-show-code"},o.default.createElement(d.Icon,{iconClass:"codicon codicon-file-code",onClick:U})),((f=L.applyResult)===null||f===void 0?void 0:f.diff)&&o.default.createElement(d.Popover,{title:"Show Diff",id:"edit-file-tool-show-diff"},o.default.createElement(d.Icon,{iconClass:"codicon codicon-diff-multiple",onClick:U})))),o.default.createElement(a.ChatMarkdown,{markdown:w==="code"?`\`\`\`${W||""}
31547
+ `).filter(Boolean).reduce(($,Y)=>{const[z,H]=Y.split("=");return z&&H&&($[z.trim()]=H.trim()),$},{});U.args=Q,U.env=V}b({...y,name:"",command:"",url:"",args:[],env:{}}),E(U)},[y,S,T,E,I]),M=(0,o.useCallback)(B=>{b({...y,command:B.target.value})},[y,S]),R=(0,o.useCallback)(B=>{w(B.target.value)},[S]),P=(0,o.useCallback)(B=>{D(B.target.value)},[T]),k=(0,o.useCallback)(B=>{b({...y,url:B.target.value})},[y]),F=(0,o.useCallback)(B=>{b({...y,type:B,command:"",args:[],env:{},url:""})},[y]),L=(0,o.useCallback)(()=>y?.type===g.MCP_SERVER_TYPE.STDIO?o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:a.default.formItem},o.default.createElement("label",null,(0,p.localize)("ai.native.mcp.command")),o.default.createElement("input",{type:"text",value:y.command,onChange:M,placeholder:(0,p.localize)("ai.native.mcp.command.placeHolder"),required:!0})),o.default.createElement("div",{className:a.default.formItem},o.default.createElement("label",null,(0,p.localize)("ai.native.mcp.args")),o.default.createElement("textarea",{value:S,onChange:R,placeholder:(0,p.localize)("ai.native.mcp.args.placeHolder"),rows:3})),o.default.createElement("div",{className:a.default.formItem},o.default.createElement("label",null,(0,p.localize)("ai.native.mcp.env")),o.default.createElement("textarea",{value:T,onChange:P,placeholder:(0,p.localize)("ai.native.mcp.env.placeHolder"),rows:3}))):o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:a.default.formItem},o.default.createElement("label",null,(0,p.localize)("ai.native.mcp.url")),o.default.createElement("textarea",{value:y.url,onChange:k,placeholder:(0,p.localize)("ai.native.mcp.url.placeHolder"),rows:3}))),[y,S,T]);return o.default.createElement(v.Modal,{title:l?(0,p.localize)("ai.native.mcp.editMCPServer.title"):(0,p.localize)("ai.native.mcp.addMCPServer.title"),visible:u,onCancel:f,centered:!0,width:600,footer:null,style:{background:"var(--editor-background)"}},o.default.createElement("form",{className:a.default.form,onSubmit:B=>B.preventDefault()},o.default.createElement("div",{className:a.default.formRow},o.default.createElement("div",{className:(0,r.default)(a.default.formItem,a.default.formItemName)},o.default.createElement("label",null,(0,p.localize)("ai.native.mcp.name")),o.default.createElement("input",{type:"text",value:y.name,onChange:B=>b({...y,name:B.target.value}),placeholder:(0,p.localize)("ai.native.mcp.name.placeHolder"),required:!0})),o.default.createElement("div",{className:(0,r.default)(a.default.formItem,a.default.formItemType)},o.default.createElement("label",null,(0,p.localize)("ai.native.mcp.type")),o.default.createElement(d.Select,{size:"large",value:y.type,options:[{label:(0,p.localize)("ai.native.mcp.stdio"),value:g.MCP_SERVER_TYPE.STDIO},{label:(0,p.localize)("ai.native.mcp.sse"),value:g.MCP_SERVER_TYPE.SSE}],className:a.default.formItemSelect,onChange:F}))),L(),o.default.createElement("div",{className:a.default.formActions},o.default.createElement(_.Button,{onClick:f,type:"primary",className:a.default.secondaryButton},(0,p.localize)("ai.native.mcp.buttonCancel")),o.default.createElement(_.Button,{onClick:O,type:"primary"},l?(0,p.localize)("ai.native.mcp.buttonUpdate"):(0,p.localize)("ai.native.mcp.buttonSave")))))};t.MCPServerForm=h},27397:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigCommandContribution=t.MCPConfigCommands=void 0;const n=e(85608),r=e(76003),o=e(41869),d=e(43718),_=e(54414),v=e(5297),m=e(33108);var p;(function(g){g.OPEN_MCP_CONFIG={id:"mcp.openConfig",label:"Open MCP Configuration"},g.OPEN_MCP_CONFIG_FILE={id:"mcp.openConfigFile",label:"Open MCP Configuration (JSON)"}})(p||(t.MCPConfigCommands=p={}));let s=class{registerCommands(a){a.registerCommand(p.OPEN_MCP_CONFIG,{execute:()=>{const h=new o.URI().withScheme(v.MCP_CONFIG_COMPONENTS_SCHEME_ID);this.editorService.open(h,{preview:!1,focus:!0})}}),a.registerCommand(p.OPEN_MCP_CONFIG_FILE,{execute:()=>{this.mcpConfigService.openConfigFile()}})}};t.MCPConfigCommandContribution=s,n.__decorate([(0,r.Autowired)(_.WorkbenchEditorService),n.__metadata("design:type",_.WorkbenchEditorService)],s.prototype,"editorService",void 0),n.__decorate([(0,r.Autowired)(d.MCPConfigServiceToken),n.__metadata("design:type",m.MCPConfigService)],s.prototype,"mcpConfigService",void 0),t.MCPConfigCommandContribution=s=n.__decorate([(0,d.Domain)(o.CommandContribution)],s)},5297:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigContribution=t.MCP_CONFIG_COMPONENTS_SCHEME_ID=void 0;const n=e(85608),r=e(76003),o=e(97267),d=e(93899),_=e(39496),v=e(26542),m=e(43718),p=e(82196),s=e(7443),g=e(10560),a=e(75279),h=e(27397),u="opensumi-mcp-config-viewer";t.MCP_CONFIG_COMPONENTS_SCHEME_ID="mcp-config";let l=class{registerEditorComponent(f){f.registerEditorComponent({uid:u,scheme:t.MCP_CONFIG_COMPONENTS_SCHEME_ID,component:a.MCPConfigView,renderMode:p.EditorComponentRenderMode.ONE_PER_WORKBENCH}),f.registerEditorComponentResolver(t.MCP_CONFIG_COMPONENTS_SCHEME_ID,(c,y)=>{y.push({type:"component",componentId:u})})}registerResource(f){f.registerResourceProvider({scheme:t.MCP_CONFIG_COMPONENTS_SCHEME_ID,provideResource:async c=>{const{configType:y}=c.getParsedQuery();return{uri:c,name:(0,m.localize)("ai.native.mcp.config.title"),icon:(0,o.getIcon)("mcp"),metadata:{configType:y}}}})}registerMenus(f){f.registerMenuItem(_.MenuId.EditorTitle,{command:h.MCPConfigCommands.OPEN_MCP_CONFIG_FILE.id,iconClass:(0,o.getIcon)("open"),group:"navigation",order:4,when:`resourceScheme == ${t.MCP_CONFIG_COMPONENTS_SCHEME_ID}`}),f.registerMenuItem(_.MenuId.EditorTitle,{command:h.MCPConfigCommands.OPEN_MCP_CONFIG.id,iconClass:(0,o.getIcon)("open"),group:"navigation",order:4,when:"resourceFilename =~ /mcp.json/"})}};t.MCPConfigContribution=l,n.__decorate([(0,r.Autowired)(g.IWorkspaceService),n.__metadata("design:type",Object)],l.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(s.IconService),n.__metadata("design:type",s.IconService)],l.prototype,"iconService",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",v.LabelService)],l.prototype,"labelService",void 0),t.MCPConfigContribution=l=n.__decorate([(0,m.Domain)(p.BrowserEditorContribution,d.MenuContribution)],l)},33108:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPConfigService=void 0;const n=e(85608),r=e(76003),o=e(41869),d=e(78132),_=e(43718),v=e(54414),m=e(72665),p=e(19413),s=e(64811),g=e(69820),a=e(45331);let h=class extends _.Disposable{constructor(){super(),this.whenReadyDeferred=new _.Deferred,this.mcpServersChangeEventEmitter=new _.Emitter,this.init(),this.disposables.push(this.mcpServerProxyService.onChangeMCPServers(()=>{this.fireMCPServersChange()})),this.disposables.push(this.preferenceService.onSpecificPreferenceChange("mcp",()=>{this.fireMCPServersChange()}))}async init(){this.chatStorage=await this.storageProvider(_.STORAGE_NAMESPACE.CHAT),this.whenReadyDeferred.resolve()}get whenReady(){return this.whenReadyDeferred.promise}get onMCPServersChange(){return this.mcpServersChangeEventEmitter.event}fireMCPServersChange(l=!1){this.mcpServersChangeEventEmitter.fire(l)}async getServers(){const{value:l,scope:E}=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0);if(E===_.PreferenceScope.Default){const S=(await this.mcpServerProxyService.$getServers()).find(w=>w.name===p.BUILTIN_MCP_SERVER_NAME);return S?[S]:[]}const f=l?.mcpServers.map(A=>{const S=Object.keys(A)[0],w=A[S];return w.url?{name:S,type:g.MCP_SERVER_TYPE.SSE,url:w.url}:{name:S,type:g.MCP_SERVER_TYPE.STDIO,command:w.command,args:w.args,env:w.env}}),c=await this.mcpServerProxyService.$getServers(),y=c.find(A=>A.name===p.BUILTIN_MCP_SERVER_NAME),b=f?.map(A=>{const S=c.find(w=>w.name===A.name);return{...A,isStarted:S?.isStarted||!1,tools:S?.tools||[]}});return y&&b.unshift(y),b}async controlServer(l,E){try{E?await this.mcpServerProxyService.$startServer(l):await this.mcpServerProxyService.$stopServer(l);const f=this.chatStorage.get(s.MCPServersEnabledKey,[p.BUILTIN_MCP_SERVER_NAME]),c=new Set(f);E?c.add(l):c.delete(l),this.chatStorage.set(s.MCPServersEnabledKey,Array.from(c))}catch(f){const c=f.message||f;throw this.logger.error(`Failed to ${E?"start":"stop"} server ${l}:`,c),this.messageService.error(c),f}}async saveServer(l){await this.whenReady;const{value:E}=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0),f=E.mcpServers,c=f?.findIndex(b=>Object.keys(b)[0]===l.name);let y;l.type===g.MCP_SERVER_TYPE.SSE?y={[l.name]:{url:l.url}}:y={[l.name]:{command:l.command,args:l.args,env:l.env}},c!==void 0&&c>=0?f[c]=y:f.push(y),await this.sumiMCPServerBackendProxy.$addOrUpdateServer(l),await this.preferenceService.set("mcp",{mcpServers:f})}async deleteServer(l){const{value:E}=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0),f=E?.mcpServers,c=f?.findIndex(y=>Object.keys(y)[0]===l);c!==void 0&&c>=0&&f?.splice(c,1),await this.sumiMCPServerBackendProxy.$removeServer(l),await this.preferenceService.set("mcp",{mcpServers:f})}async syncServer(l){await this.sumiMCPServerBackendProxy.$syncServer(l)}async getServerConfigByName(l){const{value:E}=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0);await this.whenReady;const f=this.chatStorage.get(s.MCPServersEnabledKey,[p.BUILTIN_MCP_SERVER_NAME]),c=E?.mcpServers,y=c?.find(b=>Object.keys(b)[0]===l);if(y)return y[l].url?{name:l,type:g.MCP_SERVER_TYPE.SSE,url:y[l].url,enabled:f.includes(l)}:{name:l,type:g.MCP_SERVER_TYPE.STDIO,command:y[l].command,args:y[l].args,env:y[l].env,enabled:f.includes(l)}}getReadableServerType(l){switch(l){case g.MCP_SERVER_TYPE.STDIO:return(0,_.localize)("ai.native.mcp.type.stdio");case g.MCP_SERVER_TYPE.SSE:return(0,_.localize)("ai.native.mcp.type.sse");case g.MCP_SERVER_TYPE.BUILTIN:return(0,_.localize)("ai.native.mcp.type.builtin");default:return l}}async openConfigFile(){let l=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0);l.scope===_.PreferenceScope.Default&&(await this.preferenceService.set("mcp",{mcpServers:[]},_.PreferenceScope.Workspace),l=this.preferenceService.resolve("mcp",{mcpServers:[]},void 0));const E=l.configUri;E&&this.workbenchEditorService.open(E,{preview:!1})}};t.MCPConfigService=h,n.__decorate([(0,r.Autowired)(p.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],h.prototype,"sumiMCPServerBackendProxy",void 0),n.__decorate([(0,r.Autowired)(a.MCPServerProxyService),n.__metadata("design:type",a.MCPServerProxyService)],h.prototype,"mcpServerProxyService",void 0),n.__decorate([(0,r.Autowired)(d.PreferenceService),n.__metadata("design:type",Object)],h.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(m.IMessageService),n.__metadata("design:type",Object)],h.prototype,"messageService",void 0),n.__decorate([(0,r.Autowired)(_.StorageProvider),n.__metadata("design:type",Function)],h.prototype,"storageProvider",void 0),n.__decorate([(0,r.Autowired)(v.WorkbenchEditorService),n.__metadata("design:type",v.WorkbenchEditorService)],h.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],h.prototype,"logger",void 0),t.MCPConfigService=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},33368:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPFolderPreferenceProvider=void 0;const n=e(85608),r=e(76003),o=e(91825);let d=class extends o.FolderFilePreferenceProvider{parse(v){const m=super.parse(v);if(m!==void 0)return{mcp:{...m}}}getPath(v){if(v==="mcp")return[];if(v.startsWith("mcp."))return[v.substr(4)]}};t.MCPFolderPreferenceProvider=d,t.MCPFolderPreferenceProvider=d=n.__decorate([(0,r.Injectable)()],d)},55003:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPPreferencesContribution=t.MCPResourceProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),d=e(57517),_=e(924);let v=class{provideResource(s){return{supportsRevive:!0,name:(0,o.localize)("menu-bar.title.debug"),icon:(0,o.getIcon)("debug"),uri:s}}provideResourceSubname(){return null}async shouldCloseResource(){return!0}};t.MCPResourceProvider=v,t.MCPResourceProvider=v=n.__decorate([(0,r.Injectable)()],v);let m=class{constructor(){this.schema=_.MCPPreferencesSchema,this.name="mcp"}registerResource(s){s.registerResourceProvider(this.prefResourceProvider)}registerSchema(s){s.registerSchema(_.MCPSchemaUri,_.MCPSchema,["mcp.json"])}};t.MCPPreferencesContribution=m,n.__decorate([(0,r.Autowired)(v),n.__metadata("design:type",v)],m.prototype,"prefResourceProvider",void 0),t.MCPPreferencesContribution=m=n.__decorate([(0,o.Domain)(o.PreferenceContribution,o.PreferenceConfiguration,d.BrowserEditorContribution,o.JsonSchemaContribution)],m)},924:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPSchema=t.MCPPreferencesSchema=t.MCPSchemaUri=void 0,t.MCPSchemaUri="vscode://schemas/mcp/user",t.MCPPreferencesSchema={type:"object",scope:"resource",properties:{mcp:{$ref:t.MCPSchemaUri,description:"MCP configuration for Workspace.",defaultValue:{mcpServers:[]}}}},t.MCPSchema={$id:t.MCPSchemaUri,type:"object",title:"MCP",required:[],default:{mcpServers:[]},properties:{mcpServers:{type:"array",description:"List of MCP Servers. Add new servers or edit existing ones by using IntelliSense.",items:{type:"object",properties:{command:{type:"string",description:"The command to start the MCP server."},args:{type:"array",description:"The arguments for the command to start the MCP server."},env:{type:"object",description:"The environment variables for the command to start the MCP server."},url:{type:"string",description:"The SSE URL for the MCP server."}}}}}}},45331:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPServerProxyService=void 0;const n=e(85608),r=e(48085),o=e(76003),d=e(41869),_=e(43718),v=e(19413),m=e(77633);let p=class{constructor(){this._onChangeMCPServers=new _.Emitter,this.onChangeMCPServers=this._onChangeMCPServers.event}$callMCPTool(g,a){return this.mcpServerRegistry.callMCPTool(g,a)}async $getBuiltinMCPTools(){const g=await this.mcpServerRegistry.getMCPTools().map(a=>({name:a.name,description:a.description,inputSchema:(0,r.zodToJsonSchema)(a.inputSchema),providerName:v.BUILTIN_MCP_SERVER_NAME}));return this.logger.log("SUMI MCP tools",g),g}async $updateMCPServers(){this._onChangeMCPServers.fire("update")}async getAllMCPTools(){return this.sumiMCPServerProxyService.$getAllMCPTools()}async $getServers(){return this.sumiMCPServerProxyService.$getServers()}async $startServer(g){await this.sumiMCPServerProxyService.$startServer(g)}async $stopServer(g){await this.sumiMCPServerProxyService.$stopServer(g)}};t.MCPServerProxyService=p,n.__decorate([(0,o.Autowired)(m.TokenMCPServerRegistry),n.__metadata("design:type",Object)],p.prototype,"mcpServerRegistry",void 0),n.__decorate([(0,o.Autowired)(d.ILogger),n.__metadata("design:type",Object)],p.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(v.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],p.prototype,"sumiMCPServerProxyService",void 0),t.MCPServerProxyService=p=n.__decorate([(0,o.Injectable)()],p)},79502:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPServerRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718),d=e(19413),_=e(98864);class v{constructor(s){this.logger=s}appendLine(s){this.logger.log(s)}}let m=class{constructor(){this.tools=[],this.toolComponents={}}get logger(){return new v(this.baseLogger)}set activeMessageInfo(s){this._activeMessageInfo=s}getMCPTool(s,g=d.BUILTIN_MCP_SERVER_NAME){return this.tools.find(a=>(0,_.getToolName)(a.name,g)===s)}registerMCPTool(s){this.tools.push(s)}registerToolComponent(s,g,a=d.BUILTIN_MCP_SERVER_NAME){this.toolComponents[(0,_.getToolName)(s,a)]=g}getToolComponent(s){return this.toolComponents[s]}getMCPTools(){return this.tools.sort((s,g)=>{var a,h;return((a=s.order)!==null&&a!==void 0?a:1/0)-((h=g.order)!==null&&h!==void 0?h:1/0)})}async callMCPTool(s,g){try{const a=this.tools.find(l=>l.name===s);if(!a)throw new Error(`MCP tool ${s} not found`);const h=g.toolCallId;g=a.inputSchema.parse(g);const u=await a.handler({...g,toolCallId:h},this.logger);return this.reportToolCall(s,g,u,h),u}catch(a){return console.error("callMCPTool error:",a),this.reportToolCall(s,g,a,g.toolCallId),{content:[{type:"text",text:`The tool ${s} failed to execute. Error: ${a}`}],isError:!0}}}reportToolCall(s,g,a,h){if(!this.tools.find(l=>l.name===s))throw new Error(`MCP tool ${s} not found`);this.aiReporter.send({msgType:o.AIServiceType.ToolCall,message:JSON.stringify({args:g,name:s,result:a}),messageId:this._activeMessageInfo.messageId,sessionId:this._activeMessageInfo.sessionId,relationId:h})}};t.MCPServerRegistry=m,n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],m.prototype,"baseLogger",void 0),n.__decorate([(0,r.Autowired)(o.IAIReporter),n.__metadata("design:type",Object)],m.prototype,"aiReporter",void 0),t.MCPServerRegistry=m=n.__decorate([(0,r.Injectable)()],m)},30703:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPToolsDialog=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=n.__importDefault(e(49783)),d=({tools:_})=>r.createElement("div",{className:o.default.mcp_tools_dialog},r.createElement("div",{className:o.default.dialog_title},"MCP Tools"),r.createElement("div",{className:o.default.tools_list},_.map(v=>r.createElement("div",{key:v.name,className:o.default.tool_item},r.createElement("div",{className:o.default.tool_name},v.name),r.createElement("div",{className:o.default.tool_description},v.description),v.providerName&&r.createElement("div",{className:o.default.tool_provider},"Provider: ",v.providerName)))));t.MCPToolsDialog=d},58260:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditFileToolComponent=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),d=e(97267),_=e(41869),v=e(54414),m=e(14162),p=e(87822),s=e(16781),g=e(21967),a=e(56474),h=e(73974),u=n.__importDefault(e(51601)),l=E=>{var f,c,y;const{args:b,messageId:A,toolCallId:S}=E,[w,T]=(0,o.useState)("code"),D=(0,_.useInjectable)(_.LabelService),I=(0,_.useInjectable)(_.AppConfig),O=(0,_.useInjectable)(h.BaseApplyService),M=(0,_.useInjectable)(v.WorkbenchEditorService),{target_file:R="",code_edit:P,instructions:k}=b||{},F=_.path.join(I.workspaceDir,R),[L,B]=(0,o.useState)(O.getCodeBlock(S,A)),j=(0,o.useMemo)(()=>R?`file-icon ${D.getIcon(_.URI.file(F))}`:void 0,[R,F]),W=(0,o.useMemo)(()=>{if(!R)return;const Q=s.StandaloneServices.get(p.IModelService),V=s.StandaloneServices.get(m.ILanguageService);return(0,_.detectModeId)(Q,V,_.Uri.file(F))},[R,F]);(0,o.useEffect)(()=>{const Q=O.onCodeBlockUpdate(V=>{V.toolCallId===S&&B({...V})});return()=>{Q.dispose()}},[]);const U=Q=>{Q.stopPropagation(),T(w==="code"?"diff":"code")};return!b||!L?null:[k&&o.default.createElement("p",{key:"edit-file-tool-instructions"},k),o.default.createElement("div",{className:u.default["edit-file-tool"],key:"edit-file-tool"},o.default.createElement("div",{className:(0,r.default)(u.default["edit-file-tool-header"],{clickable:L.status==="pending"||L.status==="success"}),onClick:()=>{L.status==="pending"?M.open(_.URI.file(F)):L.status==="success"&&O.revealApplyPosition(L)}},o.default.createElement("div",{className:u.default.left},j&&o.default.createElement("span",{className:j}),o.default.createElement("span",{className:u.default["edit-file-tool-file-name"]},R),L.iterationCount>1&&o.default.createElement("span",{className:u.default["edit-file-tool-iteration-count"]},L.iterationCount,"/3"),o.default.createElement(g.ApplyStatus,{status:L.status,error:E.result})),o.default.createElement("div",{className:u.default.right},o.default.createElement(d.Popover,{title:"Show Code",id:"edit-file-tool-show-code"},o.default.createElement(d.Icon,{iconClass:"codicon codicon-file-code",onClick:U})),((f=L.applyResult)===null||f===void 0?void 0:f.diff)&&o.default.createElement(d.Popover,{title:"Show Diff",id:"edit-file-tool-show-diff"},o.default.createElement(d.Icon,{iconClass:"codicon codicon-diff-multiple",onClick:U})))),o.default.createElement(a.ChatMarkdown,{markdown:w==="code"?`\`\`\`${W||""}
31548
31548
  ${P}
31549
31549
  \`\`\``:`\`\`\`diff
31550
31550
  ${(c=L.applyResult)===null||c===void 0?void 0:c.diff}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/cli-engine",
3
- "version": "3.8.3-next-1745835843.0",
3
+ "version": "3.8.3-next-1745893346.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.8.3-next-1745835843.0",
30
- "@opensumi/ide-core-common": "3.8.3-next-1745835843.0",
31
- "@opensumi/ide-core-node": "3.8.3-next-1745835843.0",
32
- "@opensumi/ide-express-file-server": "3.8.3-next-1745835843.0",
33
- "@opensumi/ide-extension": "3.8.3-next-1745835843.0",
34
- "@opensumi/ide-i18n": "3.8.3-next-1745835843.0",
35
- "@opensumi/ide-main-layout": "3.8.3-next-1745835843.0",
36
- "@opensumi/ide-startup": "3.8.3-next-1745835843.0",
29
+ "@opensumi/ide-core-browser": "3.8.3-next-1745893346.0",
30
+ "@opensumi/ide-core-common": "3.8.3-next-1745893346.0",
31
+ "@opensumi/ide-core-node": "3.8.3-next-1745893346.0",
32
+ "@opensumi/ide-express-file-server": "3.8.3-next-1745893346.0",
33
+ "@opensumi/ide-extension": "3.8.3-next-1745893346.0",
34
+ "@opensumi/ide-i18n": "3.8.3-next-1745893346.0",
35
+ "@opensumi/ide-main-layout": "3.8.3-next-1745893346.0",
36
+ "@opensumi/ide-startup": "3.8.3-next-1745893346.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": "b7a150321e5fa3d3879f5dd30d8f4946d155dc59"
75
+ "gitHead": "04be39f1c35bb7bdaf9dcab643d72c5e8632d404"
76
76
  }