@opensumi/cli-engine 3.8.3-next-1741771971.0 → 3.8.3-next-1741774345.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.
@@ -10099,14 +10099,12 @@ html li {
10099
10099
  vertical-align: middle;
10100
10100
  font-size: 12px;
10101
10101
  cursor: pointer;
10102
- opacity: 0.8;
10103
10102
  }
10104
10103
  .qP_JyMAbn6UcEbMubLzk .kt-icon {
10105
10104
  font-size: 12px;
10106
10105
  margin-right: 3px;
10107
10106
  }
10108
10107
  .qP_JyMAbn6UcEbMubLzk:hover {
10109
- opacity: 1;
10110
10108
  background-color: var(--chat-slashCommandBackground);
10111
10109
  color: var(--chat-slashCommandForeground);
10112
10110
  }
@@ -10115,7 +10113,7 @@ html li {
10115
10113
  vertical-align: middle;
10116
10114
  font-size: 12px;
10117
10115
  }
10118
- `,"",{version:3,sources:["webpack://./../../packages/ai-native/lib/browser/components/components.module.less"],names:[],mappings:"AAAA;EACE,kBAAkB;EAClB,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,aAAa;EACb,iBAAiB;EACjB,UAAU;EACV,WAAW;AACb;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,eAAe;EACf,oCAAoC;EACpC,eAAe;EACf,oBAAoB;AACtB;AACA;EACE,oCAAoC;AACtC;AACA;EACE,iBAAiB;AACnB;AACA;EACE,yBAAyB;AAC3B;AACA;EACE,eAAe;AACjB;AACA;EACE,aAAa;EACb,8BAA8B;EAC9B,mBAAmB;EACnB,mBAAmB;EACnB,kBAAkB;EAClB,aAAa;EACb,WAAW;EACX,eAAe;EACf,oCAAoC;AACtC;AACA;EACE,cAAc;EACd,mBAAmB;EACnB,aAAa;EACb,qBAAqB;AACvB;AACA;EACE,wBAAwB;EACxB,iBAAiB;EACjB,eAAe;AACjB;AACA;EACE,eAAe;AACjB;AACA;EACE,uBAAuB;AACzB;AACA;EACE,yBAAyB;AAC3B;AACA;EACE,eAAe;AACjB;AACA;EACE,aAAa;EACb,cAAc;AAChB;AACA;EACE,eAAe;AACjB;AACA;EACE,oCAAoC;AACtC;AACA;EACE,kBAAkB;EAClB,kBAAkB;EAClB,yBAAyB;EACzB,wCAAwC;EACxC,oDAAoD;AACtD;AACA;EACE,wDAAwD;AAC1D;AACA;EACE,qBAAqB;EACrB,aAAa;EACb,mBAAmB;AACrB;AACA;EACE,8CAA8C;EAC9C,mCAAmC;EACnC,kBAAkB;EAClB,cAAc;EACd,YAAY;EACZ,iBAAiB;EACjB,eAAe;EACf,UAAU;AACZ;AACA;EACE,oCAAoC;EACpC,gBAAgB;AAClB;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,QAAQ;EACR,UAAU;EACV,WAAW;EACX,YAAY;EACZ,YAAY;EACZ,kBAAkB;AACpB;AACA;EACE,YAAY;AACd;AACA;EACE,qDAAqD;AACvD;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,eAAe;AACjB;AACA;EACE,aAAa;AACf;AACA;EACE,+CAA+C;AACjD;AACA;EACE,iBAAiB;AACnB;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;EACb,8CAA8C;EAC9C,kBAAkB;EAClB,mKAAmK;AACrK;AACA;EACE,SAAS;EACT,cAAc;AAChB;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,cAAc;EACd,eAAe;EACf,eAAe;EACf,SAAS;AACX;AACA;EACE,+CAA+C;AACjD;AACA;EACE,oBAAoB;AACtB;AACA;EACE,gDAAgD;AAClD;AACA;EACE,+CAA+C;EAC/C,kBAAkB;EAClB,aAAa;EACb,mBAAmB;AACrB;AACA;EACE,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,iBAAiB;AACnB;AACA;EACE,eAAe;EACf,cAAc;AAChB;AACA;EACE,aAAa;AACf;AACA;EACE,kBAAkB;AACpB;AACA;EACE,kBAAkB;EAClB,qBAAqB;EACrB,cAAc;EACd,iBAAiB;EACjB,8CAA8C;EAC9C,mCAAmC;AACrC;AACA;EACE,kBAAkB;EAClB,gBAAgB;AAClB;AACA;EACE,mBAAmB;AACrB;AACA;EACE,kBAAkB;EAClB,eAAe;EACf,yBAAyB;EACzB,iBAAiB;AACnB;AACA;EACE,WAAW;EACX,WAAW;AACb;AACA;EACE,aAAa;EACb,kBAAkB;EAClB,UAAU;EACV,QAAQ;EACR,YAAY;EACZ,YAAY;EACZ,mBAAmB;EACnB,gBAAgB;AAClB;AACA;EACE,eAAe;AACjB;AACA;EACE,kBAAkB;EAClB,gBAAgB;EAChB,eAAe;EACf,iBAAiB;EACjB,cAAc;AAChB;AACA;EACE,yCAAyC;AAC3C;AACA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,UAAU;EACV,iBAAiB;EACjB,cAAc;EACd,mDAAmD;EACnD,4BAA4B;EAC5B,oCAAoC;EACpC,eAAe;AACjB;AACA;EACE,kBAAkB;AACpB;AACA;EACE,YAAY;AACd;AACA;;CAEC;AACD;EACE,SAAS;EACT,0BAA0B;AAC5B;AACA;EACE,gBAAgB;AAClB;AACA;EACE,MAAM;AACR;AACA;EACE,cAAc;EACd,kBAAkB;EAClB,yBAAyB;EACzB,aAAa;AACf;AACA;EACE,WAAW;AACb;AACA;EACE,WAAW;EACX,6BAA6B;EAC7B,kEAAkE;EAClE,kCAAkC;EAClC,mGAAsF;AACxF;AACA;EACE;IACE,QAAQ;EACV;EACA;IACE,UAAU;EACZ;AACF;AACA;EACE;IACE,UAAU;EACZ;EACA;IACE,WAAW;EACb;AACF;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,WAAW;EACX,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,WAAW;EACX,qBAAqB;EACrB,yBAAyB;EACzB,yDAAgD;EAChD,cAAc;EACd,kBAAkB;EAClB,wBAAwB;EACxB,MAAM;AACR;AACA;EACE,OAAO;EACP,qBAAqB;AACvB;AACA;EACE,SAAS;EACT,qBAAqB;AACvB;AACA;EACE,UAAU;EACV,qBAAqB;AACvB;AACA;EACE;;;IAGE,yBAAyB;EAC3B;EACA;IACE,sBAAsB;EACxB;AACF;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,QAAQ;AACV;AACA;EACE,UAAU;AACZ;AACA;EACE,aAAa;EACb,kBAAkB;EAClB,QAAQ;AACV;AACA;EACE,eAAe;EACf,wCAAwC;AAC1C;AACA;EACE,aAAa;EACb,sBAAsB;EACtB,kBAAkB;EAClB,iBAAiB;AACnB;AACA;EACE,cAAc;EACd,eAAe;AACjB;AACA;EACE,iBAAiB;AACnB;AACA;;;;;EAKE,WAAW;AACb;AACA;EACE,gBAAgB;EAChB,iBAAiB;AACnB;AACA;EACE,cAAc;AAChB;AACA;EACE,aAAa;AACf;AACA;EACE,gBAAgB;AAClB;AACA;EACE,yCAAyC;EACzC,kBAAkB;EAClB,YAAY;EACZ,aAAa;AACf;AACA;;CAEC;AACD;EACE,eAAe;EACf,iBAAiB;AACnB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AACA;EACE,WAAW;EACX,iBAAiB;AACnB;AACA;EACE,aAAa;EACb,sBAAsB;AACxB;AACA;EACE,eAAe;EACf,cAAc;AAChB;AACA;EACE,iBAAiB;EACjB,aAAa;EACb,mBAAmB;EACnB,eAAe;AACjB;AACA;EACE,aAAa;EACb,eAAe;EACf,mBAAmB;EACnB,gBAAgB;AAClB;AACA;EACE,gBAAgB;EAChB,aAAa;EACb,mBAAmB;AACrB;AACA;EACE,cAAc;AAChB;AACA;EACE,0CAA0C;AAC5C;AACA;EACE,yCAAyC;AAC3C;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,QAAQ;EACR,kBAAkB;EAClB,kCAAkC;AACpC;AACA;EACE,cAAc;AAChB;AACA;EACE,kBAAkB;EAClB,eAAe;AACjB;AACA;EACE,kBAAkB;EAClB,mDAAmD;EACnD,mCAAmC;AACrC;AACA;EACE,oBAAoB;EACpB,mBAAmB;EACnB,cAAc;EACd,aAAa;EACb,mCAAmC;EACnC,8BAA8B;EAC9B,kBAAkB;EAClB,sBAAsB;EACtB,eAAe;EACf,eAAe;EACf,YAAY;AACd;AACA;EACE,eAAe;EACf,iBAAiB;AACnB;AACA;EACE,UAAU;EACV,oDAAoD;EACpD,yCAAyC;AAC3C;AACA;EACE,iBAAiB;EACjB,sBAAsB;EACtB,eAAe;AACjB",sourcesContent:[`.thinking_container {
10116
+ `,"",{version:3,sources:["webpack://./../../packages/ai-native/lib/browser/components/components.module.less"],names:[],mappings:"AAAA;EACE,kBAAkB;EAClB,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,aAAa;EACb,iBAAiB;EACjB,UAAU;EACV,WAAW;AACb;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,eAAe;EACf,oCAAoC;EACpC,eAAe;EACf,oBAAoB;AACtB;AACA;EACE,oCAAoC;AACtC;AACA;EACE,iBAAiB;AACnB;AACA;EACE,yBAAyB;AAC3B;AACA;EACE,eAAe;AACjB;AACA;EACE,aAAa;EACb,8BAA8B;EAC9B,mBAAmB;EACnB,mBAAmB;EACnB,kBAAkB;EAClB,aAAa;EACb,WAAW;EACX,eAAe;EACf,oCAAoC;AACtC;AACA;EACE,cAAc;EACd,mBAAmB;EACnB,aAAa;EACb,qBAAqB;AACvB;AACA;EACE,wBAAwB;EACxB,iBAAiB;EACjB,eAAe;AACjB;AACA;EACE,eAAe;AACjB;AACA;EACE,uBAAuB;AACzB;AACA;EACE,yBAAyB;AAC3B;AACA;EACE,eAAe;AACjB;AACA;EACE,aAAa;EACb,cAAc;AAChB;AACA;EACE,eAAe;AACjB;AACA;EACE,oCAAoC;AACtC;AACA;EACE,kBAAkB;EAClB,kBAAkB;EAClB,yBAAyB;EACzB,wCAAwC;EACxC,oDAAoD;AACtD;AACA;EACE,wDAAwD;AAC1D;AACA;EACE,qBAAqB;EACrB,aAAa;EACb,mBAAmB;AACrB;AACA;EACE,8CAA8C;EAC9C,mCAAmC;EACnC,kBAAkB;EAClB,cAAc;EACd,YAAY;EACZ,iBAAiB;EACjB,eAAe;EACf,UAAU;AACZ;AACA;EACE,oCAAoC;EACpC,gBAAgB;AAClB;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,QAAQ;EACR,UAAU;EACV,WAAW;EACX,YAAY;EACZ,YAAY;EACZ,kBAAkB;AACpB;AACA;EACE,YAAY;AACd;AACA;EACE,qDAAqD;AACvD;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,eAAe;AACjB;AACA;EACE,aAAa;AACf;AACA;EACE,+CAA+C;AACjD;AACA;EACE,iBAAiB;AACnB;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;EACb,8CAA8C;EAC9C,kBAAkB;EAClB,mKAAmK;AACrK;AACA;EACE,SAAS;EACT,cAAc;AAChB;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,cAAc;EACd,eAAe;EACf,eAAe;EACf,SAAS;AACX;AACA;EACE,+CAA+C;AACjD;AACA;EACE,oBAAoB;AACtB;AACA;EACE,gDAAgD;AAClD;AACA;EACE,+CAA+C;EAC/C,kBAAkB;EAClB,aAAa;EACb,mBAAmB;AACrB;AACA;EACE,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,iBAAiB;AACnB;AACA;EACE,eAAe;EACf,cAAc;AAChB;AACA;EACE,aAAa;AACf;AACA;EACE,kBAAkB;AACpB;AACA;EACE,kBAAkB;EAClB,qBAAqB;EACrB,cAAc;EACd,iBAAiB;EACjB,8CAA8C;EAC9C,mCAAmC;AACrC;AACA;EACE,kBAAkB;EAClB,gBAAgB;AAClB;AACA;EACE,mBAAmB;AACrB;AACA;EACE,kBAAkB;EAClB,eAAe;EACf,yBAAyB;EACzB,iBAAiB;AACnB;AACA;EACE,WAAW;EACX,WAAW;AACb;AACA;EACE,aAAa;EACb,kBAAkB;EAClB,UAAU;EACV,QAAQ;EACR,YAAY;EACZ,YAAY;EACZ,mBAAmB;EACnB,gBAAgB;AAClB;AACA;EACE,eAAe;AACjB;AACA;EACE,kBAAkB;EAClB,gBAAgB;EAChB,eAAe;EACf,iBAAiB;EACjB,cAAc;AAChB;AACA;EACE,yCAAyC;AAC3C;AACA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,UAAU;EACV,iBAAiB;EACjB,cAAc;EACd,mDAAmD;EACnD,4BAA4B;EAC5B,oCAAoC;EACpC,eAAe;AACjB;AACA;EACE,kBAAkB;AACpB;AACA;EACE,YAAY;AACd;AACA;;CAEC;AACD;EACE,SAAS;EACT,0BAA0B;AAC5B;AACA;EACE,gBAAgB;AAClB;AACA;EACE,MAAM;AACR;AACA;EACE,cAAc;EACd,kBAAkB;EAClB,yBAAyB;EACzB,aAAa;AACf;AACA;EACE,WAAW;AACb;AACA;EACE,WAAW;EACX,6BAA6B;EAC7B,kEAAkE;EAClE,kCAAkC;EAClC,mGAAsF;AACxF;AACA;EACE;IACE,QAAQ;EACV;EACA;IACE,UAAU;EACZ;AACF;AACA;EACE;IACE,UAAU;EACZ;EACA;IACE,WAAW;EACb;AACF;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,WAAW;EACX,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,WAAW;EACX,qBAAqB;EACrB,yBAAyB;EACzB,yDAAgD;EAChD,cAAc;EACd,kBAAkB;EAClB,wBAAwB;EACxB,MAAM;AACR;AACA;EACE,OAAO;EACP,qBAAqB;AACvB;AACA;EACE,SAAS;EACT,qBAAqB;AACvB;AACA;EACE,UAAU;EACV,qBAAqB;AACvB;AACA;EACE;;;IAGE,yBAAyB;EAC3B;EACA;IACE,sBAAsB;EACxB;AACF;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,QAAQ;AACV;AACA;EACE,UAAU;AACZ;AACA;EACE,aAAa;EACb,kBAAkB;EAClB,QAAQ;AACV;AACA;EACE,eAAe;EACf,wCAAwC;AAC1C;AACA;EACE,aAAa;EACb,sBAAsB;EACtB,kBAAkB;EAClB,iBAAiB;AACnB;AACA;EACE,cAAc;EACd,eAAe;AACjB;AACA;EACE,iBAAiB;AACnB;AACA;;;;;EAKE,WAAW;AACb;AACA;EACE,gBAAgB;EAChB,iBAAiB;AACnB;AACA;EACE,cAAc;AAChB;AACA;EACE,aAAa;AACf;AACA;EACE,gBAAgB;AAClB;AACA;EACE,yCAAyC;EACzC,kBAAkB;EAClB,YAAY;EACZ,aAAa;AACf;AACA;;CAEC;AACD;EACE,eAAe;EACf,iBAAiB;AACnB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AACA;EACE,WAAW;EACX,iBAAiB;AACnB;AACA;EACE,aAAa;EACb,sBAAsB;AACxB;AACA;EACE,eAAe;EACf,cAAc;AAChB;AACA;EACE,iBAAiB;EACjB,aAAa;EACb,mBAAmB;EACnB,eAAe;AACjB;AACA;EACE,aAAa;EACb,eAAe;EACf,mBAAmB;EACnB,gBAAgB;AAClB;AACA;EACE,gBAAgB;EAChB,aAAa;EACb,mBAAmB;AACrB;AACA;EACE,cAAc;AAChB;AACA;EACE,0CAA0C;AAC5C;AACA;EACE,yCAAyC;AAC3C;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,QAAQ;EACR,kBAAkB;EAClB,kCAAkC;AACpC;AACA;EACE,cAAc;AAChB;AACA;EACE,kBAAkB;EAClB,eAAe;AACjB;AACA;EACE,kBAAkB;EAClB,mDAAmD;EACnD,mCAAmC;AACrC;AACA;EACE,oBAAoB;EACpB,mBAAmB;EACnB,cAAc;EACd,aAAa;EACb,mCAAmC;EACnC,8BAA8B;EAC9B,kBAAkB;EAClB,sBAAsB;EACtB,eAAe;EACf,eAAe;AACjB;AACA;EACE,eAAe;EACf,iBAAiB;AACnB;AACA;EACE,oDAAoD;EACpD,yCAAyC;AAC3C;AACA;EACE,iBAAiB;EACjB,sBAAsB;EACtB,eAAe;AACjB",sourcesContent:[`.thinking_container {
10119
10117
  position: relative;
10120
10118
  height: 100%;
10121
10119
  }
@@ -10594,14 +10592,12 @@ html li {
10594
10592
  vertical-align: middle;
10595
10593
  font-size: 12px;
10596
10594
  cursor: pointer;
10597
- opacity: 0.8;
10598
10595
  }
10599
10596
  .attachment :global .kt-icon {
10600
10597
  font-size: 12px;
10601
10598
  margin-right: 3px;
10602
10599
  }
10603
10600
  .attachment:hover {
10604
- opacity: 1;
10605
10601
  background-color: var(--chat-slashCommandBackground);
10606
10602
  color: var(--chat-slashCommandForeground);
10607
10603
  }
@@ -30839,7 +30835,7 @@ The user's OS is ${(0,p.getOperatingSystemName)()}. The absolute path of the use
30839
30835
  `);let O=0,P=!1;for(let k=0;k<M.length;k++){const F=M[k].trim();if(typeof O>"u"&&F.match(/^\s*\|/)){const L=F.match(/(\|[^\|]+)(?=\||$)/g);L&&(O=L.length)}else if(typeof O=="number")if(F.match(/^\s*\|/)&&k===M.length-1)P=!0;else return}if(O>0){const k=P?M.slice(0,-1).join(`
30840
30836
  `):R,F=!!k.match(/\|\s*$/),L=k+(F?"":"|")+`
30841
30837
  |${" --- |".repeat(O)}`;return p.marked.lexer(L)}}function T(I){return I.reduce((R,M)=>R+M.raw,"")}function D(I){for(const{type:R,raw:M}of I.tokens){if(R!=="text")continue;const O=M.split(`
30842
- `),P=O[O.length-1],k=[{condition:P.includes("`"),action:d},{condition:P.includes("**"),action:y},{condition:P.match(/\*\w/),action:E},{condition:P.match(/(^|\s)__\w/),action:A},{condition:P.match(/(^|\s)_\w/),action:f},{condition:P.match(/(^|\s)\[.*\]\(\w*/),action:a},{condition:P.match(/(^|\s)\[\w/),action:b}];for(const F of k)if(F.condition)return F.action(I)}}},49601:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMentionInput=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(81878),p=e(43718),v=e(92323),m=e(54414),_=e(47720),s=e(51500),g=e(19413),l=e(27397),h=n.__importDefault(e(6960)),u=e(96086),d=e(44692);t.ChatMentionInput=r.default.forwardRef(E=>{const{onSend:f,disabled:a=!1}=E,[b,y]=(0,r.useState)(E.value||""),A=(0,o.useInjectable)(g.IChatInternalService),S=(0,o.useInjectable)(v.CommandService),w=(0,o.useInjectable)(_.FileSearchServicePath),T=(0,o.useInjectable)(o.RecentFilesManager),D=(0,o.useInjectable)(s.IWorkspaceService),I=(0,o.useInjectable)(m.WorkbenchEditorService),R=(0,o.useInjectable)(o.LabelService),M=r.default.useCallback(()=>{S.executeCommand(l.OPEN_MCP_CONFIG_COMMAND.id)},[S]);(0,r.useEffect)(()=>{E.value!==b&&y(E.value||"")},[E.value]);const O=[{id:d.MentionType.FILE,type:d.MentionType.FILE,text:"File",icon:(0,c.getIcon)("file"),getHighestLevelItems:()=>{const L=I.currentEditor,B=L?.currentUri;return B?[{id:B.codeUri.fsPath,type:d.MentionType.FILE,text:B.displayName,value:B.codeUri.fsPath,description:`(${(0,p.localize)("aiNative.chat.defaultContextFile")})`,contextId:B.codeUri.fsPath,icon:R.getIcon(B)}]:[]},getItems:async L=>{if(L){const B=(await D.roots).map(W=>new p.URI(W.uri).codeUri.fsPath.toString()),j=await w.find(L,{rootUris:B,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0,limit:10});return Promise.all(j.map(async W=>{var U;const Q=new p.URI(W);return{id:Q.codeUri.fsPath,type:d.MentionType.FILE,text:Q.displayName,value:Q.codeUri.fsPath,description:((U=await D.asRelativePath(Q.parent))===null||U===void 0?void 0:U.path)||"",contextId:Q.codeUri.fsPath,icon:R.getIcon(Q)}}))}else{const B=await T.getMostRecentlyOpenedFiles();return Promise.all(B.map(async j=>{var W;const U=new p.URI(j);return{id:U.codeUri.fsPath,type:d.MentionType.FILE,text:U.displayName,value:U.codeUri.fsPath,description:((W=await D.asRelativePath(U.parent))===null||W===void 0?void 0:W.path)||"",contextId:U.codeUri.fsPath,icon:R.getIcon(U)}}))}}},{id:d.MentionType.FOLDER,type:d.MentionType.FOLDER,text:"Folder",icon:(0,c.getIcon)("folder"),getHighestLevelItems:()=>{var L;const B=I.currentEditor,j=(L=B?.currentUri)===null||L===void 0?void 0:L.parent;return j?[{id:j.codeUri.fsPath,type:d.MentionType.FOLDER,text:j.displayName,value:j.codeUri.fsPath,description:`(${(0,p.localize)("aiNative.chat.defaultContextFolder")})`,contextId:j.codeUri.fsPath,icon:(0,c.getIcon)("folder")}]:[]},getItems:async L=>{if(L){const B=(await D.roots).map(W=>new p.URI(W.uri).codeUri.fsPath.toString()),j=await w.find(L,{rootUris:B,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0,limit:10,onlyFolders:!0});return Promise.all(j.map(async W=>{var U;const Q=new p.URI(W);return{id:Q.codeUri.fsPath,type:d.MentionType.FOLDER,text:Q.displayName,value:Q.codeUri.fsPath,description:((U=await D.asRelativePath(Q.parent))===null||U===void 0?void 0:U.path)||"",contextId:Q.codeUri.fsPath,icon:(0,c.getIcon)("folder")}}))}else{const B=await T.getMostRecentlyOpenedFiles(),j=Array.from(new Set(B.map(W=>new p.URI(W).parent.codeUri.fsPath)));return Promise.all(j.map(async W=>{const U=new p.URI(W),Q=await D.asRelativePath(U);return{id:U.codeUri.fsPath,type:d.MentionType.FOLDER,text:U.displayName,value:U.codeUri.fsPath,description:Q?.root?Q.path:"",contextId:U.codeUri.fsPath,icon:(0,c.getIcon)("folder")}}))}}}],P=(0,r.useMemo)(()=>({modelOptions:[{label:"QWQ 32B",value:"qwq-32b"},{label:"DeepSeek R1",value:"deepseek-r1"}],defaultModel:"deepseek-r1",buttons:[{id:"mcp-server",icon:"mcp",title:"MCP Server",onClick:M,position:d.FooterButtonPosition.LEFT}],showModelSelector:!0}),[M]),k=(0,r.useCallback)(()=>{A.cancelRequest()},[]),F=(0,r.useCallback)(async(L,B)=>{a||f(L,void 0,void 0,B)},[f,I,a]);return r.default.createElement("div",{className:h.default.chat_input_container},r.default.createElement(u.MentionInput,{mentionItems:O,onSend:F,onStop:k,loading:a,labelService:R,workspaceService:D,placeholder:(0,p.localize)("aiNative.chat.input.placeholder.default"),footerConfig:P}))})},92635:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatNotify=t.ChatReply=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(48412),p=e(91416),v=e(78569),m=e(72871),_=e(41869),s=e(81878),g=e(89195),l=e(43718),h=e(52416),u=e(90684),d=e(19413),E=e(56474),f=e(17319),a=n.__importDefault(e(6960)),b=T=>{const D=(0,_.useInjectable)(_.LabelService),I=(0,_.useInjectable)(_.CommandService),R=(L,B,j)=>{let W=D.getIcon(L,{isDirectory:B});return B&&j&&(W+=" expanded"),W},M=(0,o.useMemo)(()=>{const L=B=>{const j=typeof B.type=="number"?B.type===l.FileType.Directory:!!B.children,W=new l.URI(B.uri);return{label:B.label,iconClassName:R(W,j,j),expandable:!0,expanded:!0,children:j?(B.children||[]).map(L):null,uri:W}};return(T.treeData.children||[]).map(L)},[T.treeData]),[O,P]=(0,o.useState)(22),k=(0,o.useRef)(null),F=L=>{k.current=L;const B=()=>{let j=L.getModel().root.branchSize;j<1?j=1:j>20&&(j=20),P(j*22)};B(),L.onDidUpdate(B)};return M.length?o.default.createElement("div",{className:a.default.tree_container},o.default.createElement(p.BasicRecycleTree,{height:O,treeData:M,onContextMenu:L=>L.preventDefault(),onClick:(L,B)=>{!k.current||!B||(v.BasicCompositeTreeNode.is(B)?B.raw.iconClassName=R(B.raw.uri,!0,B.expanded):I.executeCommand(_.EDITOR_COMMANDS.OPEN_RESOURCE.id,B.raw.uri,{disableNavigate:!0,preview:!0}))},onReady:F,treeName:T.treeData.label,leaveBottomBlank:!1,baseIndent:0})):null},y=T=>{const{toolCall:D,messageId:I}=T,R=(0,_.useInjectable)(l.ChatAgentViewServiceToken),[M,O]=(0,o.useState)(null);return(0,o.useEffect)(()=>{const P=R.getChatComponent("toolCall");if(P){const{component:F,initialProps:L}=P;O(o.default.createElement(F,{...L,value:D,messageId:I}));return}O(o.default.createElement("div",null,o.default.createElement(g.Loading,null),o.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),R.getChatComponentDeferred("toolCall").promise.then(({component:F,initialProps:L})=>{O(o.default.createElement(F,{...L,value:D,messageId:I}))})},[D.state]),M},A=T=>{const D=(0,_.useInjectable)(l.ChatAgentViewServiceToken),[I,R]=(0,o.useState)(null);return(0,o.useEffect)(()=>{const M=D.getChatComponent(T.component);if(M){const{component:P,initialProps:k}=M;R(o.default.createElement(P,{...k,value:T.value,messageId:T.messageId}));return}R(o.default.createElement("div",null,o.default.createElement(g.Loading,null),o.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),D.getChatComponentDeferred(T.component).promise.then(({component:P,initialProps:k})=>{R(o.default.createElement(P,{...k,value:T.value}))})},[T.component,T.value]),I},S=T=>{var D,I;const{relationId:R,request:M,startTime:O=0,onRegenerate:P,onDidChange:k,onDone:F,agentId:L,command:B,history:j,msgId:W}=T,[,U]=(0,o.useReducer)(pe=>(pe+1)%1e6,0),Q=(0,_.useInjectable)(l.IAIReporter),V=(0,_.useInjectable)(h.IIconService),$=(0,_.useInjectable)(_.IContextKeyService),Y=(0,_.useInjectable)(d.IChatInternalService),G=(0,_.useInjectable)(l.ChatServiceToken),z=(0,_.useInjectable)(d.IChatAgentService),K=(0,_.useInjectable)(l.ChatRenderRegistryToken),[Z,X]=(0,o.useState)(M.response.isComplete?new Set(M.response.responseContents.map((pe,ie)=>pe.kind==="reasoning"?ie:-1).filter(pe=>pe!==-1)):new Set);(0,o.useEffect)(()=>{M.response.isComplete&&X(new Set(M.response.responseContents.map((pe,ie)=>pe.kind==="reasoning"?ie:-1).filter(pe=>pe!==-1)))},[M.response.isComplete]),(0,o.useEffect)(()=>{const pe=new _.DisposableCollection;return pe.push(M.response.onDidChange(()=>{j.updateAssistantMessage(W,{content:M.response.responseText}),M.response.isComplete&&(F&&F(),Q.end(R,{assistantMessage:M.response.responseText,replytime:Date.now()-O,success:!0,isStop:!1,command:B,agentId:L,messageId:W,sessionId:Y.sessionModel.sessionId})),(0,o.startTransition)(()=>{k?.(),U()})})),()=>pe.dispose()},[R,k,F]);const oe=(0,o.useCallback)(()=>{M.response.reset(),P?.()},[P]),ne=(0,o.useCallback)(pe=>{if(K.chatAIRoleRender){const ie=K.chatAIRoleRender;return o.default.createElement(ie,{content:pe.value})}return o.default.createElement(E.ChatMarkdown,{markdown:pe,fillInIncompleteTokens:!0})},[K,K.chatAIRoleRender]),ue=pe=>o.default.createElement(b,{treeData:pe}),fe=pe=>o.default.createElement("div",{className:a.default.placeholder},o.default.createElement(s.Icon,{iconClass:V.fromString("$(codicon/sync~spin)")}),o.default.createElement("div",{className:a.default.placeholder_content},ne(pe))),q=o.default.useMemo(()=>M.response.responseContents.map((pe,ie)=>{let ge;if(pe.kind==="asyncContent")ge=fe(new u.MarkdownString(pe.content));else if(pe.kind==="treeData")ge=ue(pe.treeData);else if(pe.kind==="component")ge=o.default.createElement(A,{component:pe.component,value:pe.value,messageId:W});else if(pe.kind==="toolCall")ge=o.default.createElement(y,{toolCall:pe.content,messageId:W});else if(pe.kind==="reasoning"){const Ie=ie===M.response.responseContents.length-1&&!M.response.isComplete;ge=o.default.createElement("div",{className:(0,r.default)(a.default.reasoning,{[a.default.thinking]:Ie})},o.default.createElement(c.Button,{size:"small",type:"secondary",className:a.default.thinking,onClick:()=>{Ie||(Z.has(ie)?Z.delete(ie):Z.add(ie),X(new Set(Z)))}},o.default.createElement(s.Icon,{iconClass:"codicon codicon-sparkle"}),(0,l.localize)("aiNative.chat.thinking"),Ie?o.default.createElement(g.Loading,null):Z.has(ie)?o.default.createElement(s.Icon,{iconClass:"codicon codicon-chevron-right"}):o.default.createElement(s.Icon,{iconClass:"codicon codicon-chevron-down"})),Z.has(ie)?null:o.default.createElement("div",{className:a.default.reasoning_content},ne(new u.MarkdownString(pe.content))))}else ge=ne(pe.content);return o.default.createElement(o.Fragment,{key:`${pe.kind}-${ie}`},ge)}),[M.response.responseContents,Z]),Ae=o.default.useMemo(()=>M.response.followups?M.response.followups.map((pe,ie)=>{let ge=null;if(pe.kind==="reply"){const Ie=o.default.createElement("a",{onClick:()=>{G.sendMessage({...z.parseMessage(pe.message),reportExtra:{actionSource:l.ActionSourceEnum.Chat,actionType:l.ActionTypeEnum.Followup}})}},pe.title||pe.message);ge=pe.tooltip?o.default.createElement(m.Tooltip,{title:pe.tooltip},Ie):Ie}else pe.when&&!$.match(pe.when)&&(ge=null),ge=o.default.createElement(c.Button,{type:"default"},pe.title);return ge&&o.default.createElement(o.Fragment,{key:ie},ge)}):null,[M.response.followups]);return M.response.isComplete?o.default.createElement(f.ChatThinkingResult,{hasMessage:M.response.responseParts.length>0||M.response.responseContents.length>0||!!(!((D=M.response.errorDetails)===null||D===void 0)&&D.message),onRegenerate:oe,requestId:M.requestId},o.default.createElement("div",{className:a.default.ai_chat_response_container},!((I=M.response.errorDetails)===null||I===void 0)&&I.message?o.default.createElement("div",{className:a.default.error},o.default.createElement(s.Icon,{className:(0,s.getIcon)("close-circle")}),o.default.createElement("span",null,M.response.errorDetails.message)):o.default.createElement(o.default.Fragment,null,q,Ae?.length!==0&&o.default.createElement("div",{className:a.default.followups},Ae)))):o.default.createElement(f.ChatThinking,{message:M.response.responseText},q)};t.ChatReply=S;const w=T=>{const{chunk:D}=T,I=(0,_.useInjectable)(l.ChatRenderRegistryToken),R=o.default.useMemo(()=>{let M;if(D.kind==="component")M=o.default.createElement(A,{component:D.component,value:D.value});else{let O=o.default.createElement(E.ChatMarkdown,{markdown:D.content,fillInIncompleteTokens:!0});if(I.chatAIRoleRender){const P=I.chatAIRoleRender;O=o.default.createElement(P,{content:D.content})}M=O}return M},[D]);return o.default.createElement(f.ChatThinkingResult,{hasMessage:!0,requestId:T.requestId,showRegenerate:!1},o.default.createElement("div",{className:a.default.ai_chat_response_container},R))};t.ChatNotify=w},17319:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatThinkingResult=t.ChatThinking=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(89195),p=e(68974),v=e(43718),m=e(19413),_=n.__importDefault(e(6960)),s=l=>{const{children:h,message:u,thinkingText:d}=l,E=(0,o.useInjectable)(v.ChatRenderRegistryToken),f=(0,r.useMemo)(()=>E.chatThinkingRender,[E,E.chatThinkingRender]),a=(0,r.useMemo)(()=>Array.isArray(h)?h.length===0:!h,[h]),b=(0,r.useCallback)(()=>a?f?r.default.createElement(f,{thinkingText:d}):r.default.createElement("span",{className:_.default.thinking_text},d||"Thinking..."):h,[u,h,d,f]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:_.default.content},b()),r.default.createElement("div",{className:_.default.thinking_container},r.default.createElement("div",{className:_.default.stop},!f&&r.default.createElement("span",{className:_.default.progress_bar},a&&r.default.createElement(p.Progress,{loading:!0,wrapperClassName:_.default.ai_native_progress_wrapper})))))};t.ChatThinking=s;const g=({children:l,message:h,onRegenerate:u,requestId:d,hasMessage:E=!0,showRegenerate:f})=>{const a=(0,o.useInjectable)(m.IChatInternalService),[b,y]=(0,r.useState)(a.latestRequestId),A=(0,o.useInjectable)(v.ChatRenderRegistryToken);(0,r.useEffect)(()=>{const I=a.onChangeRequestId(R=>{y(R)});return()=>I.dispose()},[a]);const S=(0,r.useMemo)(()=>A.chatThinkingResultRender,[A,A.chatThinkingResultRender]),w=(0,r.useCallback)(()=>{u&&u()},[u]),T=(0,r.useCallback)(()=>{if(typeof E=="boolean"?!E:!h?.trim()){const I=(0,v.localize)("aiNative.chat.stop.immediately");return S?r.default.createElement(S,{thinkingResult:I}):r.default.createElement("span",null,I)}return l},[h,E,l]),D=(0,r.useMemo)(()=>(0,v.isUndefined)(f)?b===d&&!!d:!!f,[b,d,f]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:_.default.content},T()),r.default.createElement("div",{className:_.default.thinking_container},r.default.createElement("div",{className:_.default.bottom_container},r.default.createElement("div",{className:_.default.reset},D?r.default.createElement(c.EnhanceIcon,{icon:"refresh",wrapperClassName:_.default.text_btn,className:_.default.transform,onClick:w,tabIndex:0,role:"button"},r.default.createElement("span",null,(0,v.localize)("aiNative.operate.afresh.title"))):null),r.default.createElement("div",{className:_.default.thumbs},r.default.createElement(c.Thumbs,{relationId:d,wrapperClassName:_.default.icon_btn})))))};t.ChatThinkingResult=g},34817:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatToolRender=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(41869),p=e(81878),v=e(89195),m=e(43718),_=e(33783),s=e(77633),g=e(25834),l=n.__importDefault(e(16796)),h=u=>{var d,E,f;const{value:a,messageId:b}=u,[y,A]=(0,o.useState)(!1),S=(0,c.useInjectable)(s.TokenMCPServerRegistry);if(!a||!a.function||!a.id)return null;const w=((d=S.getMCPTool(a.function.name))===null||d===void 0?void 0:d.label)||a.function.name,T=S.getToolComponent(a.function.name),D=O=>{switch(O){case"streaming-start":case"streaming":return{label:"Generating",icon:o.default.createElement(v.Loading,null)};case"complete":return{label:"Complete",icon:o.default.createElement(p.Icon,{iconClass:"codicon codicon-check"})};case"result":return{label:"Result Ready",icon:o.default.createElement(p.Icon,{iconClass:"codicon codicon-check-all"})};default:return{label:O||"Unknown",icon:o.default.createElement(p.Icon,{iconClass:"codicon codicon-question"})}}},I=()=>{var O;try{return a.state!=="complete"&&a.state!=="result"?{}:JSON.parse(((O=a.function)===null||O===void 0?void 0:O.arguments)||"{}")}catch{return{}}},R=()=>{A(!y)},M=D(a.state);return T&&(a.state==="complete"||a.state==="result")?o.default.createElement(T,{state:a.state,args:I(),result:a.result,index:a.index,messageId:b,toolCallId:a.id}):o.default.createElement("div",{className:l.default.chat_tool_render},o.default.createElement("div",{className:l.default.tool_header,onClick:R},o.default.createElement("div",{className:l.default.tool_name},o.default.createElement(p.Icon,{iconClass:`codicon codicon-chevron-${y?"down":"right"}`}),o.default.createElement(p.Icon,{size:"small",iconClass:(0,r.default)("codicon codicon-tools",l.default.tool_icon)}),o.default.createElement("span",{className:l.default.tool_label},w)),a.state&&o.default.createElement("div",{className:l.default.tool_state},o.default.createElement("span",{className:l.default.state_icon},M.icon))),o.default.createElement("div",{className:(0,r.default)(l.default.tool_content,{[l.default.expanded]:y})},((E=a?.function)===null||E===void 0?void 0:E.arguments)&&o.default.createElement("div",{className:l.default.tool_arguments},o.default.createElement("div",{className:l.default.section_label},(0,_.localize)("ai.native.mcp.tool.arguments"),":"),o.default.createElement(g.CodeEditorWithHighlight,{input:(f=a?.function)===null||f===void 0?void 0:f.arguments,language:"json",relationId:(0,m.uuid)(4)})),a?.result&&o.default.createElement("div",{className:l.default.tool_result},o.default.createElement("div",{className:l.default.section_label},(0,_.localize)("ai.native.mcp.tool.results"),":"),o.default.createElement(g.CodeEditorWithHighlight,{input:a.result,language:"json",relationId:(0,m.uuid)(4)}))))};t.ChatToolRender=h},29039:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SlashCustomRender=void 0;const r=e(85608).__importStar(e(14041)),o=e(41869),c=e(43718),p=e(19413),v=m=>{const{userMessage:_,relationId:s,requestId:g,renderContent:l,startTime:h,agentId:u,command:d}=m,E=(0,o.useInjectable)(p.IChatInternalService),f=(0,o.useInjectable)(c.IAIReporter);return r.useEffect(()=>{E.setLatestRequestId(g),f.end(s,{message:_,replytime:Date.now()-h,success:!0,isStop:!1,agentId:u,command:d})},[l,g,s]),r.createElement("div",null,l({userMessage:_}))};t.SlashCustomRender=v},86556:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WelcomeMessage=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(81878),p=e(4246),v=e(43718),m=e(90684);e(41937);const _=e(19413),s=e(56474),g=e(17319),l=e(78048),h=n.__importDefault(e(6960)),u=()=>{var d,E;const f=(0,o.useInjectable)(v.ChatServiceToken),a=(0,o.useInjectable)(_.IChatAgentService),b=(0,o.useInjectable)(v.ChatFeatureRegistryToken),y=(0,o.useInjectable)(v.ChatRenderRegistryToken),[A,S]=r.useState([]);(0,o.useUpdateOnEvent)(b.onDidWelcomeMessageChange);const w=r.useMemo(()=>{if(!b.chatWelcomeMessageModel)return[];const{sampleQuestions:R=[]}=b.chatWelcomeMessageModel;return R.map(l.extractIcon)},[(d=b.chatWelcomeMessageModel)===null||d===void 0?void 0:d.sampleQuestions]),T=r.useMemo(()=>{if(!b.chatWelcomeMessageModel)return"";const{content:R}=b.chatWelcomeMessageModel;return R},[(E=b.chatWelcomeMessageModel)===null||E===void 0?void 0:E.content]);if(r.useEffect(()=>{const R=a.onDidChangeAgents(async()=>{const O=(await a.getAllSampleQuestions()).map(l.extractIcon);S(O)});return()=>R.dispose()},[]),!T)return r.createElement(g.ChatThinking,{thinkingText:(0,v.localize)("aiNative.chat.welcome.loading.text")});const D=r.useMemo(()=>w.concat(A),[w,A]);return r.useMemo(()=>{if(y.chatWelcomeRender){const R=y.chatWelcomeRender;return r.createElement(R,{message:T,sampleQuestions:D})}return r.createElement("div",{className:h.default.chat_welcome_head},r.createElement("div",{className:h.default.chat_container_des},(0,m.isMarkdownString)(T)?r.createElement(s.ChatMarkdown,{key:"welcome",markdown:T}):T),r.createElement("div",{className:h.default.chat_container_content},D.map((R,M)=>{const O=r.createElement("a",{className:h.default.link_item,onClick:(0,p.withPrevented)(()=>{f.sendMessage({...a.parseMessage(R.message),reportExtra:{actionType:v.ActionTypeEnum.Welcome,actionSource:v.ActionSourceEnum.Chat}})})},R.icon?r.createElement(c.Icon,{className:R.icon,style:{color:"inherit",marginRight:"4px"}}):"",r.createElement("span",null,R.title));return R.tooltip?r.createElement(c.Tooltip,{title:R.tooltip,key:M},O):r.createElement(r.Fragment,{key:M},O)})))},[y.chatWelcomeRender,T,D])};t.WelcomeMessage=u},83933:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.highLightLanguageSupport=void 0,t.highLightLanguageSupport=["1c","abnf","accesslog","actionscript","ada","angelscript","apache","applescript","arcade","arduino","armasm","xml","asciidoc","aspectj","autohotkey","autoit","avrasm","awk","axapta","bash","basic","bnf","brainfuck","c-like","c","cal","capnproto","ceylon","clean","clojure","clojure-repl","cmake","coffeescript","coq","cos","cpp","crmsh","crystal","csharp","csp","css","d","markdown","dart","delphi","diff","django","dns","dockerfile","dos","dsconfig","dts","dust","ebnf","elixir","elm","ruby","erb","erlang-repl","erlang","excel","fix","flix","fortran","fsharp","gams","gauss","gcode","gherkin","glsl","gml","go","golo","gradle","groovy","haml","handlebars","haskell","haxe","hsp","htmlbars","http","hy","inform7","ini","irpf90","isbl","java","javascript","jboss-cli","json","julia","julia-repl","kotlin","lasso","latex","ldif","leaf","less","lisp","livecodeserver","livescript","llvm","lsl","lua","makefile","mathematica","matlab","maxima","mel","mercury","mipsasm","mizar","perl","mojolicious","monkey","moonscript","n1ql","nginx","nim","nix","node-repl","nsis","objectivec","ocaml","openscad","oxygene","parser3","pf","pgsql","php","php-template","plaintext","pony","powershell","processing","profile","prolog","properties","protobuf","puppet","purebasic","python","python-repl","q","qml","r","reasonml","rib","roboconf","routeros","rsl","ruleslanguage","rust","sas","scala","scheme","scilab","scss","shell","smali","smalltalk","sml","sqf","sql_more","sql","stan","stata","step21","stylus","subunit","swift","taggerscript","yaml","tap","tcl","thrift","tp","twig","typescript","vala","vbnet","vbscript","vbscript-html","verilog","vhdl","vim","x86asm","xl","xquery","zephir"]},96086:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionInput=t.WHITE_SPACE_TEXT=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(81878),p=e(89195),v=e(70392),m=n.__importDefault(e(97599)),_=e(80732),s=e(44692);t.WHITE_SPACE_TEXT="&nbsp;";const g=({mentionItems:l=[],onSend:h,onStop:u,loading:d=!1,mentionKeyword:E=s.MENTION_KEYWORD,onSelectionChange:f,labelService:a,workspaceService:b,placeholder:y="Ask anything, @ to mention",footerConfig:A={buttons:[],showModelSelector:!1}})=>{const S=o.useRef(null),[w,T]=o.useState({active:!1,startPos:null,filter:"",position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1}),[D,I]=o.useState(A.defaultModel||""),[R,M]=o.useState({}),[O,P]=o.useState([]),[k,F]=o.useState(-1),[L,B]=o.useState(""),[j,W]=o.useState(!1),U=()=>w.level===0?l:w.parentType?w.loading?R[w.parentType]||[]:R[w.parentType]||[]:[],V=((fe,q)=>{const[Ae,pe]=o.useState(fe);return o.useEffect(()=>{const ie=setTimeout(()=>{pe(fe)},q);return()=>{clearTimeout(ie)}},[fe,q]),Ae})(w.secondLevelFilter,300);o.useEffect(()=>{if(w.level===1&&w.parentType&&V!==void 0){const fe=l.find(Ae=>Ae.id===w.parentType);if(!fe)return;T(Ae=>({...Ae,loading:!0})),(async()=>{try{const Ae=[];if(fe.getHighestLevelItems){const pe=fe.getHighestLevelItems();for(const ie of pe)Ae.some(ge=>ge.id===ie.id)||Ae.push(ie);M(ie=>({...ie,[w.parentType]:pe}))}if(fe.getItems)try{const pe=await fe.getItems(V),ie=[...Ae];for(const ge of pe)ie.some(Ie=>Ie.id===ge.id)||ie.push(ge);M(ge=>({...ge,[w.parentType]:ie}))}catch{T(ie=>({...ie,loading:!1}))}T(pe=>({...pe,loading:!1}))}catch{T(pe=>({...pe,loading:!1}))}})()}},[V,w.level,w.parentType]);const $=fe=>{const q=window.getSelection();if(!q||!q.rangeCount)return 0;const Ae=q.getRangeAt(0),pe=Ae.cloneRange();return pe.selectNodeContents(fe),pe.setEnd(Ae.endContainer,Ae.endOffset),pe.toString().length},Y=()=>{j&&(W(!1),F(-1));const fe=window.getSelection();if(!fe||!fe.rangeCount||!S.current)return;const q=S.current.textContent||"",Ae=$(S.current);if(q[Ae-1]===E&&!w.active&&!w.inlineSearchActive&&T({active:!0,startPos:Ae,filter:E,position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1}),w.active&&w.level===0&&w.startPos!==null)if(Ae<w.startPos)T(pe=>({...pe,active:!1}));else{const pe=q.substring(w.startPos-1,Ae);T(ie=>({...ie,filter:pe,activeIndex:0}))}if(w.inlineSearchActive&&w.inlineSearchStartPos!==null&&w.parentType){const pe=l.find(Ie=>Ie.id===w.parentType);if(!pe)return;const ie=`@${pe.type}:`,ge=w.inlineSearchStartPos-ie.length;if(ge>=0&&Ae>ge+ie.length){const Ie=q.substring(ge+ie.length,Ae);Ie!==w.secondLevelFilter&&T(Pe=>({...Pe,secondLevelFilter:Ie,active:!0,activeIndex:0}))}else Ae<=ge&&T(Ie=>({...Ie,inlineSearchActive:!1,active:!1}))}if(S.current&&(S.current.scrollHeight>120?S.current.style.overflowY="auto":S.current.style.overflowY="hidden"),S.current){const pe=S.current.innerHTML;(pe===""||pe==="<br>"||pe==="<br/>")&&(S.current.innerHTML="")}},G=fe=>{if(fe.key==="Escape"&&(w.active||w.inlineSearchActive)){w.level>0?T(Ae=>({...Ae,level:0,activeIndex:0,secondLevelFilter:"",inlineSearchActive:!1})):T(Ae=>({...Ae,active:!1,inlineSearchActive:!1})),fe.preventDefault();return}if(fe.key===s.MENTION_KEYWORD&&!w.active&&!w.inlineSearchActive&&S.current){const Ae=$(S.current);T({active:!0,startPos:Ae+1,filter:E,position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1})}if(fe.key==="Enter"){if(fe.nativeEvent.isComposing)return;if(!fe.shiftKey&&(fe.preventDefault(),!w.active)){oe();return}}if(fe.key==="ArrowUp"||fe.key==="ArrowDown"){if(!w.active&&!w.inlineSearchActive&&S.current){fe.preventDefault(),j||(B(S.current.innerHTML),W(!0));let Ae=k;fe.key==="ArrowUp"?Ae=Math.min(O.length-1,k+1):Ae=Math.max(-1,k-1),F(Ae),Ae===-1?S.current.innerHTML=L:S.current.innerHTML=O[O.length-1-Ae];const pe=document.createRange();pe.selectNodeContents(S.current),pe.collapse(!1);const ie=window.getSelection();ie&&(ie.removeAllRanges(),ie.addRange(pe));return}}else j&&fe.key!=="ArrowUp"&&fe.key!=="ArrowDown"&&(W(!1),F(-1));if(!w.active)return;let q=U();if(w.level===0&&w.filter&&w.filter.length>1){const Ae=w.filter.substring(1).toLowerCase();q=q.filter(pe=>pe.text.toLowerCase().includes(Ae))}if(q.length!==0&&(fe.key==="ArrowDown"?(T(Ae=>({...Ae,activeIndex:(Ae.activeIndex+1)%q.length})),fe.preventDefault()):fe.key==="ArrowUp"?(T(Ae=>({...Ae,activeIndex:(Ae.activeIndex-1+q.length)%q.length})),fe.preventDefault()):(fe.key==="Enter"||fe.key==="Tab")&&q.length>0&&(Z(q[w.activeIndex]),fe.preventDefault()),fe.key==="Backspace"&&S.current)){const Ae=S.current.innerHTML;(Ae==="<br>"||Ae==="<br/>")&&(S.current.innerHTML="")}},z=()=>{};o.useEffect(()=>{S.current&&y&&!S.current.textContent&&S.current.setAttribute("data-placeholder",y)},[y]);const K=fe=>{var q;w.active&&!(!((q=document.querySelector(`.${m.default.mention_panel}`))===null||q===void 0)&&q.contains(fe.target))&&T(Ae=>({...Ae,active:!1,inlineSearchActive:!1}))};o.useEffect(()=>(document.addEventListener("click",K,!0),()=>{document.removeEventListener("click",K,!0)}),[w.active]);const Z=(fe,q=!1)=>{var Ae;if(!S.current)return;if(fe.getItems){const Me=window.getSelection();if(!Me||!Me.rangeCount)return;if(w.level===0&&w.startPos!==null){let Fe,_e,re;const he=document.createTreeWalker(S.current,NodeFilter.SHOW_TEXT);let Oe=0,De;for(;De=he.nextNode();){const Be=((Ae=De.textContent)===null||Ae===void 0?void 0:Ae.length)||0;if(w.startPos-1>=Oe&&w.startPos-1<Oe+Be){Fe=De,_e=w.startPos-1-Oe;const ze=q?w.startPos+w.filter.length-1:$(S.current);re=Math.min(ze-Oe,Be);break}Oe+=Be}if(Fe){const Be=document.createRange();Be.setStart(Fe,_e),Be.setEnd(Fe,re),Be.deleteContents();const ze=document.createTextNode(`${E}${fe.type}:`);Be.insertNode(ze);const Ve=document.createRange();Ve.setStartAfter(ze),Ve.setEndAfter(ze),Me.removeAllRanges(),Me.addRange(Ve),T(ft=>({...ft,active:!0,level:1,parentType:fe.id,inlineSearchActive:!0,inlineSearchStartPos:$(S.current),secondLevelFilter:"",activeIndex:0})),S.current.focus();return}}return}const pe=window.getSelection();if(!pe||!pe.rangeCount)return;if(w.inlineSearchActive&&w.parentType&&w.inlineSearchStartPos!==null){const Me=l.find(re=>re.id===w.parentType);if(!Me)return;const Fe=`${E}${Me.type}:`,_e=w.inlineSearchStartPos-Fe.length;if(_e>=0){let it=function(Ot){if(Ot.nodeType===3)ft.push({node:Ot,start:ze,end:ze+Ot.textContent.length}),ze+=Ot.textContent.length;else if(Ot.nodeType===1){const lt=Ot.childNodes||[];for(const Tt of Array.from(lt))it(Tt)}};const re=document.createElement("span");if(re.className=m.default.mention_tag,re.dataset.id=fe.id,re.dataset.type=fe.type,re.dataset.contextId=fe.contextId||"",re.contentEditable="false",fe.type==="file"||fe.type==="folder"){const Ot=document.createElement("span");Ot.className=(0,r.default)(m.default.mention_icon,fe.type==="file"?a?.getIcon(new v.URI(fe.text)):(0,c.getIcon)("folder")),re.appendChild(Ot)}const he=b?.workspace;let Oe=fe.text;he&&fe.contextId&&(Oe=fe.contextId.replace(new v.URI(he.uri).codeUri.fsPath,"").slice(1));const De=document.createTextNode(Oe);re.appendChild(De);const Be=document.createRange();let ze=0,Ve=!1;const ft=[];it(S.current);for(const Ot of ft){if(_e>=Ot.start&&_e<=Ot.end){const lt=_e-Ot.start;Be.setStart(Ot.node,lt),Ve=!0}if(Ve){const lt=q?_e+Fe.length+w.secondLevelFilter.length:$(S.current);if(lt>=Ot.start&&lt<=Ot.end){const Tt=lt-Ot.start;Be.setEnd(Ot.node,Tt);break}}}if(Ve){Be.deleteContents(),Be.insertNode(re);const Ot=document.createRange();Ot.setStartAfter(re),Ot.setEndAfter(re),pe.removeAllRanges(),pe.addRange(Ot);const lt=document.createTextNode("\xA0");Ot.insertNode(lt),Ot.setStartAfter(lt),Ot.setEndAfter(lt),pe.removeAllRanges(),pe.addRange(Ot)}T(Ot=>({...Ot,active:!1,inlineSearchActive:!1})),S.current.focus();return}}const ie=document.createElement("span");if(ie.className=m.default.mention_tag,ie.dataset.id=fe.id,ie.dataset.type=fe.type,ie.dataset.contextId=fe.contextId||"",ie.contentEditable="false",fe.type==="file"||fe.type==="folder"){const Me=document.createElement("span");Me.className=(0,r.default)(m.default.mention_icon,fe.type==="file"?a?.getIcon(new v.URI(fe.text)):(0,c.getIcon)("folder")),ie.appendChild(Me)}const ge=b?.workspace;let Ie=fe.text;ge&&fe.contextId&&(Ie=fe.contextId.replace(new v.URI(ge.uri).codeUri.fsPath,"").slice(1));const Pe=document.createTextNode(Ie);ie.appendChild(Pe);let Se=0,Te=!1;const Ee=[];function me(Me){if(Me.nodeType===3)Ee.push({node:Me,start:Se,end:Se+Me.textContent.length}),Se+=Me.textContent.length;else if(Me.nodeType===1){const Fe=Me.childNodes;for(const _e of Array.from(Fe))me(_e)}}me(S.current);const Ne=document.createRange();if(w.startPos!==null)for(const Me of Ee){if(w.startPos-1>=Me.start&&w.startPos-1<=Me.end){const Fe=w.startPos-1-Me.start;Ne.setStart(Me.node,Fe),Te=!0}if(Te){const Fe=q?w.startPos+w.filter.length-1:$(S.current);if(Fe>=Me.start&&Fe<=Me.end){const _e=Fe-Me.start;Ne.setEnd(Me.node,_e);break}}}if(Te){Ne.deleteContents(),Ne.insertNode(ie);const Me=document.createRange();Me.setStartAfter(ie),Me.setEndAfter(ie),pe.removeAllRanges(),pe.addRange(Me);const Fe=document.createTextNode("\xA0");Me.insertNode(Fe),Me.setStartAfter(Fe),Me.setEndAfter(Fe),pe.removeAllRanges(),pe.addRange(Me)}T(Me=>({...Me,active:!1})),S.current.focus()},X=o.useCallback(fe=>{I(fe),f?.(fe)},[D,f]),oe=()=>{if(!S.current)return;const fe=S.current.innerHTML;if(!fe)return;const q=document.createElement("div");q.innerHTML=fe,q.querySelectorAll(`.${m.default.mention_tag}`).forEach(ie=>{var ge;const Ie=ie.getAttribute("data-context-id");if(Ie){const Pe=document.createTextNode(`{{${E}${ie.getAttribute("data-type")}:${Ie}}}`);(ge=ie.parentNode)===null||ge===void 0||ge.replaceChild(Pe,ie)}});let pe=q.innerHTML;pe=pe.trim().replaceAll(t.WHITE_SPACE_TEXT," "),fe&&(P(ie=>[...ie,fe]),F(-1),W(!1)),h&&h(pe,{model:D,...A}),S.current.innerHTML="",S.current&&(S.current.style.overflowY="hidden",S.current.style.height="auto")},ne=o.useCallback(()=>{u&&u()},[u]),ue=o.useCallback(fe=>(A.buttons||[]).filter(q=>q.position===fe).map(q=>o.createElement(c.Popover,{key:q.id,overlayClassName:m.default.popover_icon,id:`ai-chat-${q.id}`,position:c.PopoverPosition.top,title:q.title},o.createElement(p.EnhanceIcon,{className:(0,r.default)((0,c.getIcon)(q.icon),m.default[`${q.id}_logo`]),tabIndex:0,role:"button",ariaLabel:q.title,onClick:q.onClick}))),[A.buttons]);return o.createElement("div",{className:m.default.input_container},w.active&&o.createElement("div",{className:m.default.mention_panel_container},o.createElement(_.MentionPanel,{items:U(),activeIndex:w.activeIndex,onSelectItem:fe=>Z(fe,!0),position:{top:0,left:0},filter:w.level===0?w.filter:w.secondLevelFilter,visible:!0,level:w.level,loading:w.loading})),o.createElement("div",{className:m.default.editor_area},o.createElement("div",{ref:S,className:m.default.editor,contentEditable:!0,onInput:Y,onKeyDown:G,onCompositionEnd:z})),o.createElement("div",{className:m.default.footer},o.createElement("div",{className:m.default.left_control},A.showModelSelector&&o.createElement(c.Select,{options:A.modelOptions||[],value:D,onChange:X,className:m.default.model_selector,size:"small"}),ue(s.FooterButtonPosition.LEFT)),o.createElement("div",{className:m.default.right_control},ue(s.FooterButtonPosition.RIGHT),o.createElement(c.Popover,{overlayClassName:m.default.popover_icon,id:"ai-chat-send",position:c.PopoverPosition.top,content:d?"Stop":"Send"},d?o.createElement(p.EnhanceIcon,{wrapperClassName:m.default.stop_logo,className:(0,r.default)((0,c.getIcon)("stop"),m.default.stop_logo_icon),tabIndex:0,role:"button",ariaLabel:"Stop",onClick:ne}):o.createElement(p.EnhanceIcon,{wrapperClassName:m.default.send_logo,className:(0,r.default)((0,c.getIcon)("send-outlined"),m.default.send_logo_icon),tabIndex:0,role:"button",onClick:oe,ariaLabel:"Send"})))))};t.MentionInput=g},40167:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionItem=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(81878),p=n.__importDefault(e(97599)),v=({item:m,isActive:_,onClick:s})=>o.createElement("div",{className:`${p.default.mention_item} ${_?p.default.active:""}`,onClick:()=>s(m)},o.createElement("div",{className:p.default.mention_item_left},o.createElement(c.Icon,{className:(0,r.default)(p.default.mention_item_icon,m.icon)}),o.createElement("span",{className:p.default.mention_item_text},m.text),o.createElement("span",{className:p.default.mention_item_description},m.description)),m.getItems&&o.createElement(c.Icon,{className:(0,r.default)(p.default.mention_item_right,(0,c.getIcon)("arrowright"))}));t.MentionItem=v},80732:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionPanel=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=n.__importDefault(e(97599)),c=e(40167),p=({items:v,activeIndex:m,onSelectItem:_,position:s,filter:g,visible:l,level:h,loading:u=!1})=>{const d=r.useRef(null);if(r.useEffect(()=>{if(l&&d.current){const a=d.current.querySelector(`.${o.default.mention_item}.${o.default.active}`);a&&a.scrollIntoView({block:"nearest"})}},[m,l]),!l)return null;const f=(()=>{let a=v;if(h===0){if(g&&g.length>1){const b=g.substring(1).toLowerCase();a=v.filter(y=>y.text.toLowerCase().includes(b))}}else g&&g.length>0&&(a=v.filter(b=>b.text.toLowerCase().includes(g.toLowerCase())));return a})();return h===0&&f.length===0?null:r.createElement("div",{ref:d,className:o.default.mention_panel,style:{top:s.top,left:s.left}},u&&r.createElement("div",{className:o.default.loading_bar}),v.length>0?r.createElement("ul",{className:o.default.mention_list},v.map((a,b)=>r.createElement(c.MentionItem,{key:a.id,item:a,isActive:b===m,onClick:()=>_(a,!0)}))):r.createElement("div",{className:o.default.no_results},u?"\u6B63\u5728\u641C\u7D22...":"\u65E0\u5339\u914D\u7ED3\u679C"))};t.MentionPanel=p},44692:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MENTION_KEYWORD=t.MentionType=t.FooterButtonPosition=void 0;var e;(function(r){r.LEFT="left",r.RIGHT="right"})(e||(t.FooterButtonPosition=e={}));var n;(function(r){r.FILE="file",r.FOLDER="folder",r.CODE="code"})(n||(t.MentionType=n={})),t.MENTION_KEYWORD="@"},78048:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractIcon=t.createMessageByAI=t.createMessageByUser=void 0;const n=e(41869),r="",o=m=>({...m,type:"text",className:`${m.position==="left"?"rce-ai-msg":"rce-user-msg"} ${m.className?m.className:""}`}),c=(m,_)=>o({...m,position:"right",title:r,className:_,role:1});t.createMessageByUser=c;const p=(m,_)=>o({...m,position:"left",title:"",className:_,role:2});t.createMessageByAI=p;const v=m=>{let{title:_}=m;const{message:s,tooltip:g}=m;let l=m.icon||"";if(!_)return{icon:l,title:s,message:s,tooltip:g};const h=_.match(/^\$\(([a-z.]+\/)?([a-z0-9-]+)(~[a-z]+)?\)/i);if(h){const[u,d,E,f]=h,a=d?d.slice(0,-1):n.CODICON_OWNER;l=(0,n.getExternalIcon)(E,a),f&&(l+=` ${f.slice(1)}`),_=_.slice(u.length)}return{icon:l,title:_,message:s,tooltip:g}};t.extractIcon=v},19957:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LlmContextContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(46044);let p=class{initialize(){this.llmContextService.startAutoCollection()}};t.LlmContextContribution=p,n.__decorate([(0,r.Autowired)(c.LLMContextServiceToken),n.__metadata("design:type",Object)],p.prototype,"llmContextService",void 0),t.LlmContextContribution=p=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],p)},63536:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LLMContextServiceImpl=void 0;const n=e(85608),r=e(76003),o=e(11050),c=e(25234),p=e(19083),v=e(86560),m=e(96689),_=e(82196),s=e(14951),g=e(6287),l=e(20868);let h=class extends c.WithEventBus{constructor(){super(...arguments),this.isAutoCollecting=!1,this.contextVersion=0,this.maxAttachFilesLimit=10,this.maxAttachFoldersLimit=10,this.maxViewFilesLimit=20,this.attachedFiles=[],this.attachedFolders=[],this.recentlyViewFiles=[],this.onDidContextFilesChangeEmitter=new v.Emitter,this.onDidContextFilesChangeEvent=this.onDidContextFilesChangeEmitter.event}addFileToList(d,E,f){const a=E.findIndex(b=>b.uri.toString()===d.uri.toString());a>-1&&E.splice(a,1),E.push(d),E.length>f&&E.shift()}addFolderToList(d,E,f){const a=E.findIndex(b=>b.uri.toString()===d.uri.toString());a>-1&&E.splice(a,1),E.push(d),E.length>f&&E.shift()}addFileToContext(d,E,f=!1){if(!d)return;const a={uri:d,selection:E},b=f?this.attachedFiles:this.recentlyViewFiles,y=f?this.maxAttachFilesLimit:this.maxViewFilesLimit;f&&this.docModelManager.createModelReference(d),this.addFileToList(a,b,y),this.notifyContextChange()}addFolderToContext(d){if(!d)return;const E={uri:d};this.addFolderToList(E,this.attachedFolders,this.maxAttachFoldersLimit),this.notifyContextChange()}notifyContextChange(){this.onDidContextFilesChangeEmitter.fire(this.getAllContextFiles())}cleanFileContext(){this.attachedFiles=[],this.attachedFolders=[],this.notifyContextChange()}getAllContextFiles(){return{viewed:this.recentlyViewFiles,attached:this.attachedFiles,attachedFolders:this.attachedFolders,version:this.contextVersion++}}removeFileFromContext(d,E=!1){const f=E?this.attachedFiles:this.recentlyViewFiles,a=f.findIndex(b=>b.uri.toString()===d.toString());a>-1&&f.splice(a,1),this.notifyContextChange()}startAutoCollection(){this.isAutoCollecting||(this.isAutoCollecting=!0,this.startAutoCollectionInternal())}startAutoCollectionInternal(){this.disposables.push(this.eventBus.on(m.EditorDocumentModelCreationEvent,d=>{d.payload.uri.scheme==="file"&&this.addFileToContext(d.payload.uri,void 0,!1)})),this.disposables.push(this.eventBus.on(m.EditorDocumentModelRemovalEvent,d=>{d.payload.scheme==="file"&&this.removeFileFromContext(d.payload,!1)})),this.disposables.push(this.eventBus.on(m.EditorDocumentModelSavedEvent,d=>{d.payload.scheme})),this.disposables.push(this.eventBus.on(_.EditorSelectionChangeEvent,d=>{if(d.payload.selections.length>0){const E=[d.payload.selections[0].selectionStartLineNumber,d.payload.selections[0].positionLineNumber].sort();E[0]===E[1]?this.addFileToContext(d.payload.editorUri,void 0,!1):this.addFileToContext(d.payload.editorUri,E.sort((f,a)=>f-a),!1)}}))}stopAutoCollection(){this.dispose()}async serialize(){const d=this.getAllContextFiles(),E=v.URI.file(this.appConfig.workspaceDir);return{recentlyViewFiles:this.serializeRecentlyViewFiles(d.viewed,E),attachedFiles:this.serializeAttachedFiles(d.attached,E),attachedFolders:await this.serializeAttachedFolders(d.attachedFolders,E)}}async serializeAttachedFolders(d,E){const f=Array.from(new Set(d.map(a=>a.uri.toString())));return Promise.all(f.map(async a=>{var b;const y=new v.URI(a);return`\`\`\`
30838
+ `),P=O[O.length-1],k=[{condition:P.includes("`"),action:d},{condition:P.includes("**"),action:y},{condition:P.match(/\*\w/),action:E},{condition:P.match(/(^|\s)__\w/),action:A},{condition:P.match(/(^|\s)_\w/),action:f},{condition:P.match(/(^|\s)\[.*\]\(\w*/),action:a},{condition:P.match(/(^|\s)\[\w/),action:b}];for(const F of k)if(F.condition)return F.action(I)}}},49601:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMentionInput=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(81878),p=e(43718),v=e(92323),m=e(54414),_=e(47720),s=e(51500),g=e(19413),l=e(27397),h=n.__importDefault(e(6960)),u=e(96086),d=e(44692),E=f=>{const{onSend:a,disabled:b=!1}=f,[y,A]=(0,r.useState)(f.value||""),S=(0,o.useInjectable)(g.IChatInternalService),w=(0,o.useInjectable)(v.CommandService),T=(0,o.useInjectable)(_.FileSearchServicePath),D=(0,o.useInjectable)(o.RecentFilesManager),I=(0,o.useInjectable)(s.IWorkspaceService),R=(0,o.useInjectable)(m.WorkbenchEditorService),M=(0,o.useInjectable)(o.LabelService),O=r.default.useCallback(()=>{w.executeCommand(l.OPEN_MCP_CONFIG_COMMAND.id)},[w]);(0,r.useEffect)(()=>{f.value!==y&&A(f.value||"")},[f.value]);const P=[{id:d.MentionType.FILE,type:d.MentionType.FILE,text:"File",icon:(0,c.getIcon)("file"),getHighestLevelItems:()=>{const B=R.currentEditor,j=B?.currentUri;return j?[{id:j.codeUri.fsPath,type:d.MentionType.FILE,text:j.displayName,value:j.codeUri.fsPath,description:`(${(0,p.localize)("aiNative.chat.defaultContextFile")})`,contextId:j.codeUri.fsPath,icon:M.getIcon(j)}]:[]},getItems:async B=>{if(B){const j=(await I.roots).map(U=>new p.URI(U.uri).codeUri.fsPath.toString()),W=await T.find(B,{rootUris:j,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0,limit:10});return Promise.all(W.map(async U=>{var Q;const V=new p.URI(U),$=(Q=await I.asRelativePath(V.parent))===null||Q===void 0?void 0:Q.path;return{id:V.codeUri.fsPath,type:d.MentionType.FILE,text:V.displayName,value:V.codeUri.fsPath,description:$||"",contextId:V.codeUri.fsPath,icon:M.getIcon(V)}}))}else{const j=await D.getMostRecentlyOpenedFiles();return Promise.all(j.map(async W=>{var U;const Q=new p.URI(W),V=(U=await I.asRelativePath(Q.parent))===null||U===void 0?void 0:U.path;return{id:Q.codeUri.fsPath,type:d.MentionType.FILE,text:Q.displayName,value:Q.codeUri.fsPath,description:V||"",contextId:Q.codeUri.fsPath,icon:M.getIcon(Q)}}))}}},{id:d.MentionType.FOLDER,type:d.MentionType.FOLDER,text:"Folder",icon:(0,c.getIcon)("folder"),getHighestLevelItems:()=>{var B;const j=R.currentEditor,W=(B=j?.currentUri)===null||B===void 0?void 0:B.parent;return W?[{id:W.codeUri.fsPath,type:d.MentionType.FOLDER,text:W.displayName,value:W.codeUri.fsPath,description:`(${(0,p.localize)("aiNative.chat.defaultContextFolder")})`,contextId:W.codeUri.fsPath,icon:(0,c.getIcon)("folder")}]:[]},getItems:async B=>{if(B){const j=(await I.roots).map(U=>new p.URI(U.uri).codeUri.fsPath.toString()),W=await T.find(B,{rootUris:j,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0,limit:10,onlyFolders:!0});return Promise.all(W.map(async U=>{var Q;const V=new p.URI(U);return{id:V.codeUri.fsPath,type:d.MentionType.FOLDER,text:V.displayName,value:V.codeUri.fsPath,description:((Q=await I.asRelativePath(V.parent))===null||Q===void 0?void 0:Q.path)||"",contextId:V.codeUri.fsPath,icon:(0,c.getIcon)("folder")}}))}else{const j=await D.getMostRecentlyOpenedFiles(),W=Array.from(new Set(j.map(U=>new p.URI(U).parent.codeUri.fsPath)));return Promise.all(W.map(async U=>{const Q=new p.URI(U),V=await I.asRelativePath(Q);return{id:Q.codeUri.fsPath,type:d.MentionType.FOLDER,text:Q.displayName,value:Q.codeUri.fsPath,description:V?.root?V.path:"",contextId:Q.codeUri.fsPath,icon:(0,c.getIcon)("folder")}}))}}}],k=(0,r.useMemo)(()=>({modelOptions:[{label:"QWQ 32B",value:"qwq-32b"},{label:"DeepSeek R1",value:"deepseek-r1"}],defaultModel:"deepseek-r1",buttons:[{id:"mcp-server",icon:"mcp",title:"MCP Server",onClick:O,position:d.FooterButtonPosition.LEFT}],showModelSelector:!0}),[O]),F=(0,r.useCallback)(()=>{S.cancelRequest()},[]),L=(0,r.useCallback)(async(B,j)=>{b||a(B,void 0,void 0,j)},[a,R,b]);return r.default.createElement("div",{className:h.default.chat_input_container},r.default.createElement(u.MentionInput,{mentionItems:P,onSend:L,onStop:F,loading:b,labelService:M,workspaceService:I,placeholder:(0,p.localize)("aiNative.chat.input.placeholder.default"),footerConfig:k}))};t.ChatMentionInput=E},92635:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatNotify=t.ChatReply=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(48412),p=e(91416),v=e(78569),m=e(72871),_=e(41869),s=e(81878),g=e(89195),l=e(43718),h=e(52416),u=e(90684),d=e(19413),E=e(56474),f=e(17319),a=n.__importDefault(e(6960)),b=T=>{const D=(0,_.useInjectable)(_.LabelService),I=(0,_.useInjectable)(_.CommandService),R=(L,B,j)=>{let W=D.getIcon(L,{isDirectory:B});return B&&j&&(W+=" expanded"),W},M=(0,o.useMemo)(()=>{const L=B=>{const j=typeof B.type=="number"?B.type===l.FileType.Directory:!!B.children,W=new l.URI(B.uri);return{label:B.label,iconClassName:R(W,j,j),expandable:!0,expanded:!0,children:j?(B.children||[]).map(L):null,uri:W}};return(T.treeData.children||[]).map(L)},[T.treeData]),[O,P]=(0,o.useState)(22),k=(0,o.useRef)(null),F=L=>{k.current=L;const B=()=>{let j=L.getModel().root.branchSize;j<1?j=1:j>20&&(j=20),P(j*22)};B(),L.onDidUpdate(B)};return M.length?o.default.createElement("div",{className:a.default.tree_container},o.default.createElement(p.BasicRecycleTree,{height:O,treeData:M,onContextMenu:L=>L.preventDefault(),onClick:(L,B)=>{!k.current||!B||(v.BasicCompositeTreeNode.is(B)?B.raw.iconClassName=R(B.raw.uri,!0,B.expanded):I.executeCommand(_.EDITOR_COMMANDS.OPEN_RESOURCE.id,B.raw.uri,{disableNavigate:!0,preview:!0}))},onReady:F,treeName:T.treeData.label,leaveBottomBlank:!1,baseIndent:0})):null},y=T=>{const{toolCall:D,messageId:I}=T,R=(0,_.useInjectable)(l.ChatAgentViewServiceToken),[M,O]=(0,o.useState)(null);return(0,o.useEffect)(()=>{const P=R.getChatComponent("toolCall");if(P){const{component:F,initialProps:L}=P;O(o.default.createElement(F,{...L,value:D,messageId:I}));return}O(o.default.createElement("div",null,o.default.createElement(g.Loading,null),o.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),R.getChatComponentDeferred("toolCall").promise.then(({component:F,initialProps:L})=>{O(o.default.createElement(F,{...L,value:D,messageId:I}))})},[D.state]),M},A=T=>{const D=(0,_.useInjectable)(l.ChatAgentViewServiceToken),[I,R]=(0,o.useState)(null);return(0,o.useEffect)(()=>{const M=D.getChatComponent(T.component);if(M){const{component:P,initialProps:k}=M;R(o.default.createElement(P,{...k,value:T.value,messageId:T.messageId}));return}R(o.default.createElement("div",null,o.default.createElement(g.Loading,null),o.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),D.getChatComponentDeferred(T.component).promise.then(({component:P,initialProps:k})=>{R(o.default.createElement(P,{...k,value:T.value}))})},[T.component,T.value]),I},S=T=>{var D,I;const{relationId:R,request:M,startTime:O=0,onRegenerate:P,onDidChange:k,onDone:F,agentId:L,command:B,history:j,msgId:W}=T,[,U]=(0,o.useReducer)(pe=>(pe+1)%1e6,0),Q=(0,_.useInjectable)(l.IAIReporter),V=(0,_.useInjectable)(h.IIconService),$=(0,_.useInjectable)(_.IContextKeyService),Y=(0,_.useInjectable)(d.IChatInternalService),G=(0,_.useInjectable)(l.ChatServiceToken),z=(0,_.useInjectable)(d.IChatAgentService),K=(0,_.useInjectable)(l.ChatRenderRegistryToken),[Z,X]=(0,o.useState)(M.response.isComplete?new Set(M.response.responseContents.map((pe,ie)=>pe.kind==="reasoning"?ie:-1).filter(pe=>pe!==-1)):new Set);(0,o.useEffect)(()=>{M.response.isComplete&&X(new Set(M.response.responseContents.map((pe,ie)=>pe.kind==="reasoning"?ie:-1).filter(pe=>pe!==-1)))},[M.response.isComplete]),(0,o.useEffect)(()=>{const pe=new _.DisposableCollection;return pe.push(M.response.onDidChange(()=>{j.updateAssistantMessage(W,{content:M.response.responseText}),M.response.isComplete&&(F&&F(),Q.end(R,{assistantMessage:M.response.responseText,replytime:Date.now()-O,success:!0,isStop:!1,command:B,agentId:L,messageId:W,sessionId:Y.sessionModel.sessionId})),(0,o.startTransition)(()=>{k?.(),U()})})),()=>pe.dispose()},[R,k,F]);const oe=(0,o.useCallback)(()=>{M.response.reset(),P?.()},[P]),ne=(0,o.useCallback)(pe=>{if(K.chatAIRoleRender){const ie=K.chatAIRoleRender;return o.default.createElement(ie,{content:pe.value})}return o.default.createElement(E.ChatMarkdown,{markdown:pe,fillInIncompleteTokens:!0})},[K,K.chatAIRoleRender]),ue=pe=>o.default.createElement(b,{treeData:pe}),fe=pe=>o.default.createElement("div",{className:a.default.placeholder},o.default.createElement(s.Icon,{iconClass:V.fromString("$(codicon/sync~spin)")}),o.default.createElement("div",{className:a.default.placeholder_content},ne(pe))),q=o.default.useMemo(()=>M.response.responseContents.map((pe,ie)=>{let ge;if(pe.kind==="asyncContent")ge=fe(new u.MarkdownString(pe.content));else if(pe.kind==="treeData")ge=ue(pe.treeData);else if(pe.kind==="component")ge=o.default.createElement(A,{component:pe.component,value:pe.value,messageId:W});else if(pe.kind==="toolCall")ge=o.default.createElement(y,{toolCall:pe.content,messageId:W});else if(pe.kind==="reasoning"){const Ie=ie===M.response.responseContents.length-1&&!M.response.isComplete;ge=o.default.createElement("div",{className:(0,r.default)(a.default.reasoning,{[a.default.thinking]:Ie})},o.default.createElement(c.Button,{size:"small",type:"secondary",className:a.default.thinking,onClick:()=>{Ie||(Z.has(ie)?Z.delete(ie):Z.add(ie),X(new Set(Z)))}},o.default.createElement(s.Icon,{iconClass:"codicon codicon-sparkle"}),(0,l.localize)("aiNative.chat.thinking"),Ie?o.default.createElement(g.Loading,null):Z.has(ie)?o.default.createElement(s.Icon,{iconClass:"codicon codicon-chevron-right"}):o.default.createElement(s.Icon,{iconClass:"codicon codicon-chevron-down"})),Z.has(ie)?null:o.default.createElement("div",{className:a.default.reasoning_content},ne(new u.MarkdownString(pe.content))))}else ge=ne(pe.content);return o.default.createElement(o.Fragment,{key:`${pe.kind}-${ie}`},ge)}),[M.response.responseContents,Z]),Ae=o.default.useMemo(()=>M.response.followups?M.response.followups.map((pe,ie)=>{let ge=null;if(pe.kind==="reply"){const Ie=o.default.createElement("a",{onClick:()=>{G.sendMessage({...z.parseMessage(pe.message),reportExtra:{actionSource:l.ActionSourceEnum.Chat,actionType:l.ActionTypeEnum.Followup}})}},pe.title||pe.message);ge=pe.tooltip?o.default.createElement(m.Tooltip,{title:pe.tooltip},Ie):Ie}else pe.when&&!$.match(pe.when)&&(ge=null),ge=o.default.createElement(c.Button,{type:"default"},pe.title);return ge&&o.default.createElement(o.Fragment,{key:ie},ge)}):null,[M.response.followups]);return M.response.isComplete?o.default.createElement(f.ChatThinkingResult,{hasMessage:M.response.responseParts.length>0||M.response.responseContents.length>0||!!(!((D=M.response.errorDetails)===null||D===void 0)&&D.message),onRegenerate:oe,requestId:M.requestId},o.default.createElement("div",{className:a.default.ai_chat_response_container},!((I=M.response.errorDetails)===null||I===void 0)&&I.message?o.default.createElement("div",{className:a.default.error},o.default.createElement(s.Icon,{className:(0,s.getIcon)("close-circle")}),o.default.createElement("span",null,M.response.errorDetails.message)):o.default.createElement(o.default.Fragment,null,q,Ae?.length!==0&&o.default.createElement("div",{className:a.default.followups},Ae)))):o.default.createElement(f.ChatThinking,{message:M.response.responseText},q)};t.ChatReply=S;const w=T=>{const{chunk:D}=T,I=(0,_.useInjectable)(l.ChatRenderRegistryToken),R=o.default.useMemo(()=>{let M;if(D.kind==="component")M=o.default.createElement(A,{component:D.component,value:D.value});else{let O=o.default.createElement(E.ChatMarkdown,{markdown:D.content,fillInIncompleteTokens:!0});if(I.chatAIRoleRender){const P=I.chatAIRoleRender;O=o.default.createElement(P,{content:D.content})}M=O}return M},[D]);return o.default.createElement(f.ChatThinkingResult,{hasMessage:!0,requestId:T.requestId,showRegenerate:!1},o.default.createElement("div",{className:a.default.ai_chat_response_container},R))};t.ChatNotify=w},17319:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatThinkingResult=t.ChatThinking=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(89195),p=e(68974),v=e(43718),m=e(19413),_=n.__importDefault(e(6960)),s=l=>{const{children:h,message:u,thinkingText:d}=l,E=(0,o.useInjectable)(v.ChatRenderRegistryToken),f=(0,r.useMemo)(()=>E.chatThinkingRender,[E,E.chatThinkingRender]),a=(0,r.useMemo)(()=>Array.isArray(h)?h.length===0:!h,[h]),b=(0,r.useCallback)(()=>a?f?r.default.createElement(f,{thinkingText:d}):r.default.createElement("span",{className:_.default.thinking_text},d||"Thinking..."):h,[u,h,d,f]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:_.default.content},b()),r.default.createElement("div",{className:_.default.thinking_container},r.default.createElement("div",{className:_.default.stop},!f&&r.default.createElement("span",{className:_.default.progress_bar},a&&r.default.createElement(p.Progress,{loading:!0,wrapperClassName:_.default.ai_native_progress_wrapper})))))};t.ChatThinking=s;const g=({children:l,message:h,onRegenerate:u,requestId:d,hasMessage:E=!0,showRegenerate:f})=>{const a=(0,o.useInjectable)(m.IChatInternalService),[b,y]=(0,r.useState)(a.latestRequestId),A=(0,o.useInjectable)(v.ChatRenderRegistryToken);(0,r.useEffect)(()=>{const I=a.onChangeRequestId(R=>{y(R)});return()=>I.dispose()},[a]);const S=(0,r.useMemo)(()=>A.chatThinkingResultRender,[A,A.chatThinkingResultRender]),w=(0,r.useCallback)(()=>{u&&u()},[u]),T=(0,r.useCallback)(()=>{if(typeof E=="boolean"?!E:!h?.trim()){const I=(0,v.localize)("aiNative.chat.stop.immediately");return S?r.default.createElement(S,{thinkingResult:I}):r.default.createElement("span",null,I)}return l},[h,E,l]),D=(0,r.useMemo)(()=>(0,v.isUndefined)(f)?b===d&&!!d:!!f,[b,d,f]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:_.default.content},T()),r.default.createElement("div",{className:_.default.thinking_container},r.default.createElement("div",{className:_.default.bottom_container},r.default.createElement("div",{className:_.default.reset},D?r.default.createElement(c.EnhanceIcon,{icon:"refresh",wrapperClassName:_.default.text_btn,className:_.default.transform,onClick:w,tabIndex:0,role:"button"},r.default.createElement("span",null,(0,v.localize)("aiNative.operate.afresh.title"))):null),r.default.createElement("div",{className:_.default.thumbs},r.default.createElement(c.Thumbs,{relationId:d,wrapperClassName:_.default.icon_btn})))))};t.ChatThinkingResult=g},34817:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatToolRender=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(41869),p=e(81878),v=e(89195),m=e(43718),_=e(33783),s=e(77633),g=e(25834),l=n.__importDefault(e(16796)),h=u=>{var d,E,f;const{value:a,messageId:b}=u,[y,A]=(0,o.useState)(!1),S=(0,c.useInjectable)(s.TokenMCPServerRegistry);if(!a||!a.function||!a.id)return null;const w=((d=S.getMCPTool(a.function.name))===null||d===void 0?void 0:d.label)||a.function.name,T=S.getToolComponent(a.function.name),D=O=>{switch(O){case"streaming-start":case"streaming":return{label:"Generating",icon:o.default.createElement(v.Loading,null)};case"complete":return{label:"Complete",icon:o.default.createElement(p.Icon,{iconClass:"codicon codicon-check"})};case"result":return{label:"Result Ready",icon:o.default.createElement(p.Icon,{iconClass:"codicon codicon-check-all"})};default:return{label:O||"Unknown",icon:o.default.createElement(p.Icon,{iconClass:"codicon codicon-question"})}}},I=()=>{var O;try{return a.state!=="complete"&&a.state!=="result"?{}:JSON.parse(((O=a.function)===null||O===void 0?void 0:O.arguments)||"{}")}catch{return{}}},R=()=>{A(!y)},M=D(a.state);return T&&(a.state==="complete"||a.state==="result")?o.default.createElement(T,{state:a.state,args:I(),result:a.result,index:a.index,messageId:b,toolCallId:a.id}):o.default.createElement("div",{className:l.default.chat_tool_render},o.default.createElement("div",{className:l.default.tool_header,onClick:R},o.default.createElement("div",{className:l.default.tool_name},o.default.createElement(p.Icon,{iconClass:`codicon codicon-chevron-${y?"down":"right"}`}),o.default.createElement(p.Icon,{size:"small",iconClass:(0,r.default)("codicon codicon-tools",l.default.tool_icon)}),o.default.createElement("span",{className:l.default.tool_label},w)),a.state&&o.default.createElement("div",{className:l.default.tool_state},o.default.createElement("span",{className:l.default.state_icon},M.icon))),o.default.createElement("div",{className:(0,r.default)(l.default.tool_content,{[l.default.expanded]:y})},((E=a?.function)===null||E===void 0?void 0:E.arguments)&&o.default.createElement("div",{className:l.default.tool_arguments},o.default.createElement("div",{className:l.default.section_label},(0,_.localize)("ai.native.mcp.tool.arguments"),":"),o.default.createElement(g.CodeEditorWithHighlight,{input:(f=a?.function)===null||f===void 0?void 0:f.arguments,language:"json",relationId:(0,m.uuid)(4)})),a?.result&&o.default.createElement("div",{className:l.default.tool_result},o.default.createElement("div",{className:l.default.section_label},(0,_.localize)("ai.native.mcp.tool.results"),":"),o.default.createElement(g.CodeEditorWithHighlight,{input:a.result,language:"json",relationId:(0,m.uuid)(4)}))))};t.ChatToolRender=h},29039:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SlashCustomRender=void 0;const r=e(85608).__importStar(e(14041)),o=e(41869),c=e(43718),p=e(19413),v=m=>{const{userMessage:_,relationId:s,requestId:g,renderContent:l,startTime:h,agentId:u,command:d}=m,E=(0,o.useInjectable)(p.IChatInternalService),f=(0,o.useInjectable)(c.IAIReporter);return r.useEffect(()=>{E.setLatestRequestId(g),f.end(s,{message:_,replytime:Date.now()-h,success:!0,isStop:!1,agentId:u,command:d})},[l,g,s]),r.createElement("div",null,l({userMessage:_}))};t.SlashCustomRender=v},86556:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WelcomeMessage=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(81878),p=e(4246),v=e(43718),m=e(90684);e(41937);const _=e(19413),s=e(56474),g=e(17319),l=e(78048),h=n.__importDefault(e(6960)),u=()=>{var d,E;const f=(0,o.useInjectable)(v.ChatServiceToken),a=(0,o.useInjectable)(_.IChatAgentService),b=(0,o.useInjectable)(v.ChatFeatureRegistryToken),y=(0,o.useInjectable)(v.ChatRenderRegistryToken),[A,S]=r.useState([]);(0,o.useUpdateOnEvent)(b.onDidWelcomeMessageChange);const w=r.useMemo(()=>{if(!b.chatWelcomeMessageModel)return[];const{sampleQuestions:R=[]}=b.chatWelcomeMessageModel;return R.map(l.extractIcon)},[(d=b.chatWelcomeMessageModel)===null||d===void 0?void 0:d.sampleQuestions]),T=r.useMemo(()=>{if(!b.chatWelcomeMessageModel)return"";const{content:R}=b.chatWelcomeMessageModel;return R},[(E=b.chatWelcomeMessageModel)===null||E===void 0?void 0:E.content]);if(r.useEffect(()=>{const R=a.onDidChangeAgents(async()=>{const O=(await a.getAllSampleQuestions()).map(l.extractIcon);S(O)});return()=>R.dispose()},[]),!T)return r.createElement(g.ChatThinking,{thinkingText:(0,v.localize)("aiNative.chat.welcome.loading.text")});const D=r.useMemo(()=>w.concat(A),[w,A]);return r.useMemo(()=>{if(y.chatWelcomeRender){const R=y.chatWelcomeRender;return r.createElement(R,{message:T,sampleQuestions:D})}return r.createElement("div",{className:h.default.chat_welcome_head},r.createElement("div",{className:h.default.chat_container_des},(0,m.isMarkdownString)(T)?r.createElement(s.ChatMarkdown,{key:"welcome",markdown:T}):T),r.createElement("div",{className:h.default.chat_container_content},D.map((R,M)=>{const O=r.createElement("a",{className:h.default.link_item,onClick:(0,p.withPrevented)(()=>{f.sendMessage({...a.parseMessage(R.message),reportExtra:{actionType:v.ActionTypeEnum.Welcome,actionSource:v.ActionSourceEnum.Chat}})})},R.icon?r.createElement(c.Icon,{className:R.icon,style:{color:"inherit",marginRight:"4px"}}):"",r.createElement("span",null,R.title));return R.tooltip?r.createElement(c.Tooltip,{title:R.tooltip,key:M},O):r.createElement(r.Fragment,{key:M},O)})))},[y.chatWelcomeRender,T,D])};t.WelcomeMessage=u},83933:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.highLightLanguageSupport=void 0,t.highLightLanguageSupport=["1c","abnf","accesslog","actionscript","ada","angelscript","apache","applescript","arcade","arduino","armasm","xml","asciidoc","aspectj","autohotkey","autoit","avrasm","awk","axapta","bash","basic","bnf","brainfuck","c-like","c","cal","capnproto","ceylon","clean","clojure","clojure-repl","cmake","coffeescript","coq","cos","cpp","crmsh","crystal","csharp","csp","css","d","markdown","dart","delphi","diff","django","dns","dockerfile","dos","dsconfig","dts","dust","ebnf","elixir","elm","ruby","erb","erlang-repl","erlang","excel","fix","flix","fortran","fsharp","gams","gauss","gcode","gherkin","glsl","gml","go","golo","gradle","groovy","haml","handlebars","haskell","haxe","hsp","htmlbars","http","hy","inform7","ini","irpf90","isbl","java","javascript","jboss-cli","json","julia","julia-repl","kotlin","lasso","latex","ldif","leaf","less","lisp","livecodeserver","livescript","llvm","lsl","lua","makefile","mathematica","matlab","maxima","mel","mercury","mipsasm","mizar","perl","mojolicious","monkey","moonscript","n1ql","nginx","nim","nix","node-repl","nsis","objectivec","ocaml","openscad","oxygene","parser3","pf","pgsql","php","php-template","plaintext","pony","powershell","processing","profile","prolog","properties","protobuf","puppet","purebasic","python","python-repl","q","qml","r","reasonml","rib","roboconf","routeros","rsl","ruleslanguage","rust","sas","scala","scheme","scilab","scss","shell","smali","smalltalk","sml","sqf","sql_more","sql","stan","stata","step21","stylus","subunit","swift","taggerscript","yaml","tap","tcl","thrift","tp","twig","typescript","vala","vbnet","vbscript","vbscript-html","verilog","vhdl","vim","x86asm","xl","xquery","zephir"]},96086:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionInput=t.WHITE_SPACE_TEXT=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(81878),p=e(89195),v=e(70392),m=n.__importDefault(e(97599)),_=e(80732),s=e(44692);t.WHITE_SPACE_TEXT="&nbsp;";const g=({mentionItems:l=[],onSend:h,onStop:u,loading:d=!1,mentionKeyword:E=s.MENTION_KEYWORD,onSelectionChange:f,labelService:a,workspaceService:b,placeholder:y="Ask anything, @ to mention",footerConfig:A={buttons:[],showModelSelector:!1}})=>{const S=o.useRef(null),[w,T]=o.useState({active:!1,startPos:null,filter:"",position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1}),[D,I]=o.useState(A.defaultModel||""),[R,M]=o.useState({}),[O,P]=o.useState([]),[k,F]=o.useState(-1),[L,B]=o.useState(""),[j,W]=o.useState(!1),U=()=>w.level===0?l:w.parentType?w.loading?R[w.parentType]||[]:R[w.parentType]||[]:[],V=((fe,q)=>{const[Ae,pe]=o.useState(fe);return o.useEffect(()=>{const ie=setTimeout(()=>{pe(fe)},q);return()=>{clearTimeout(ie)}},[fe,q]),Ae})(w.secondLevelFilter,300);o.useEffect(()=>{if(w.level===1&&w.parentType&&V!==void 0){const fe=l.find(Ae=>Ae.id===w.parentType);if(!fe)return;T(Ae=>({...Ae,loading:!0})),(async()=>{try{const Ae=[];if(fe.getHighestLevelItems){const pe=fe.getHighestLevelItems();for(const ie of pe)Ae.some(ge=>ge.id===ie.id)||Ae.push(ie);M(ie=>({...ie,[w.parentType]:pe}))}if(fe.getItems)try{const pe=await fe.getItems(V),ie=[...Ae];for(const ge of pe)ie.some(Ie=>Ie.id===ge.id)||ie.push(ge);M(ge=>({...ge,[w.parentType]:ie}))}catch{T(ie=>({...ie,loading:!1}))}T(pe=>({...pe,loading:!1}))}catch{T(pe=>({...pe,loading:!1}))}})()}},[V,w.level,w.parentType]);const $=fe=>{const q=window.getSelection();if(!q||!q.rangeCount)return 0;const Ae=q.getRangeAt(0),pe=Ae.cloneRange();return pe.selectNodeContents(fe),pe.setEnd(Ae.endContainer,Ae.endOffset),pe.toString().length},Y=()=>{j&&(W(!1),F(-1));const fe=window.getSelection();if(!fe||!fe.rangeCount||!S.current)return;const q=S.current.textContent||"",Ae=$(S.current);if(q[Ae-1]===E&&!w.active&&!w.inlineSearchActive&&T({active:!0,startPos:Ae,filter:E,position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1}),w.active&&w.level===0&&w.startPos!==null)if(Ae<w.startPos)T(pe=>({...pe,active:!1}));else{const pe=q.substring(w.startPos-1,Ae);T(ie=>({...ie,filter:pe,activeIndex:0}))}if(w.inlineSearchActive&&w.inlineSearchStartPos!==null&&w.parentType){const pe=l.find(Ie=>Ie.id===w.parentType);if(!pe)return;const ie=`@${pe.type}:`,ge=w.inlineSearchStartPos-ie.length;if(ge>=0&&Ae>ge+ie.length){const Ie=q.substring(ge+ie.length,Ae);Ie!==w.secondLevelFilter&&T(Pe=>({...Pe,secondLevelFilter:Ie,active:!0,activeIndex:0}))}else Ae<=ge&&T(Ie=>({...Ie,inlineSearchActive:!1,active:!1}))}if(S.current&&(S.current.scrollHeight>120?S.current.style.overflowY="auto":S.current.style.overflowY="hidden"),S.current){const pe=S.current.innerHTML;(pe===""||pe==="<br>"||pe==="<br/>")&&(S.current.innerHTML="")}},G=fe=>{if(fe.key==="Escape"&&(w.active||w.inlineSearchActive)){w.level>0?T(Ae=>({...Ae,level:0,activeIndex:0,secondLevelFilter:"",inlineSearchActive:!1})):T(Ae=>({...Ae,active:!1,inlineSearchActive:!1})),fe.preventDefault();return}if(fe.key===s.MENTION_KEYWORD&&!w.active&&!w.inlineSearchActive&&S.current){const Ae=$(S.current);T({active:!0,startPos:Ae+1,filter:E,position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1})}if(fe.key==="Enter"){if(fe.nativeEvent.isComposing)return;if(!fe.shiftKey&&(fe.preventDefault(),!w.active)){oe();return}}if(fe.key==="ArrowUp"||fe.key==="ArrowDown"){if(!w.active&&!w.inlineSearchActive&&S.current){fe.preventDefault(),j||(B(S.current.innerHTML),W(!0));let Ae=k;fe.key==="ArrowUp"?Ae=Math.min(O.length-1,k+1):Ae=Math.max(-1,k-1),F(Ae),Ae===-1?S.current.innerHTML=L:S.current.innerHTML=O[O.length-1-Ae];const pe=document.createRange();pe.selectNodeContents(S.current),pe.collapse(!1);const ie=window.getSelection();ie&&(ie.removeAllRanges(),ie.addRange(pe));return}}else j&&fe.key!=="ArrowUp"&&fe.key!=="ArrowDown"&&(W(!1),F(-1));if(!w.active)return;let q=U();if(w.level===0&&w.filter&&w.filter.length>1){const Ae=w.filter.substring(1).toLowerCase();q=q.filter(pe=>pe.text.toLowerCase().includes(Ae))}if(q.length!==0&&(fe.key==="ArrowDown"?(T(Ae=>({...Ae,activeIndex:(Ae.activeIndex+1)%q.length})),fe.preventDefault()):fe.key==="ArrowUp"?(T(Ae=>({...Ae,activeIndex:(Ae.activeIndex-1+q.length)%q.length})),fe.preventDefault()):(fe.key==="Enter"||fe.key==="Tab")&&q.length>0&&(Z(q[w.activeIndex]),fe.preventDefault()),fe.key==="Backspace"&&S.current)){const Ae=S.current.innerHTML;(Ae==="<br>"||Ae==="<br/>")&&(S.current.innerHTML="")}},z=()=>{};o.useEffect(()=>{S.current&&y&&!S.current.textContent&&S.current.setAttribute("data-placeholder",y)},[y]);const K=fe=>{var q;w.active&&!(!((q=document.querySelector(`.${m.default.mention_panel}`))===null||q===void 0)&&q.contains(fe.target))&&T(Ae=>({...Ae,active:!1,inlineSearchActive:!1}))};o.useEffect(()=>(document.addEventListener("click",K,!0),()=>{document.removeEventListener("click",K,!0)}),[w.active]);const Z=(fe,q=!1)=>{var Ae;if(!S.current)return;if(fe.getItems){const Me=window.getSelection();if(!Me||!Me.rangeCount)return;if(w.level===0&&w.startPos!==null){let Fe,_e,re;const he=document.createTreeWalker(S.current,NodeFilter.SHOW_TEXT);let Oe=0,De;for(;De=he.nextNode();){const Be=((Ae=De.textContent)===null||Ae===void 0?void 0:Ae.length)||0;if(w.startPos-1>=Oe&&w.startPos-1<Oe+Be){Fe=De,_e=w.startPos-1-Oe;const ze=q?w.startPos+w.filter.length-1:$(S.current);re=Math.min(ze-Oe,Be);break}Oe+=Be}if(Fe){const Be=document.createRange();Be.setStart(Fe,_e),Be.setEnd(Fe,re),Be.deleteContents();const ze=document.createTextNode(`${E}${fe.type}:`);Be.insertNode(ze);const Ve=document.createRange();Ve.setStartAfter(ze),Ve.setEndAfter(ze),Me.removeAllRanges(),Me.addRange(Ve),T(ft=>({...ft,active:!0,level:1,parentType:fe.id,inlineSearchActive:!0,inlineSearchStartPos:$(S.current),secondLevelFilter:"",activeIndex:0})),S.current.focus();return}}return}const pe=window.getSelection();if(!pe||!pe.rangeCount)return;if(w.inlineSearchActive&&w.parentType&&w.inlineSearchStartPos!==null){const Me=l.find(re=>re.id===w.parentType);if(!Me)return;const Fe=`${E}${Me.type}:`,_e=w.inlineSearchStartPos-Fe.length;if(_e>=0){let it=function(Ot){if(Ot.nodeType===3)ft.push({node:Ot,start:ze,end:ze+Ot.textContent.length}),ze+=Ot.textContent.length;else if(Ot.nodeType===1){const lt=Ot.childNodes||[];for(const Tt of Array.from(lt))it(Tt)}};const re=document.createElement("span");if(re.className=m.default.mention_tag,re.dataset.id=fe.id,re.dataset.type=fe.type,re.dataset.contextId=fe.contextId||"",re.contentEditable="false",fe.type==="file"||fe.type==="folder"){const Ot=document.createElement("span");Ot.className=(0,r.default)(m.default.mention_icon,fe.type==="file"?a?.getIcon(new v.URI(fe.text)):(0,c.getIcon)("folder")),re.appendChild(Ot)}const he=b?.workspace;let Oe=fe.text;he&&fe.contextId&&(Oe=fe.contextId.replace(new v.URI(he.uri).codeUri.fsPath,"").slice(1));const De=document.createTextNode(Oe);re.appendChild(De);const Be=document.createRange();let ze=0,Ve=!1;const ft=[];it(S.current);for(const Ot of ft){if(_e>=Ot.start&&_e<=Ot.end){const lt=_e-Ot.start;Be.setStart(Ot.node,lt),Ve=!0}if(Ve){const lt=q?_e+Fe.length+w.secondLevelFilter.length:$(S.current);if(lt>=Ot.start&&lt<=Ot.end){const Tt=lt-Ot.start;Be.setEnd(Ot.node,Tt);break}}}if(Ve){Be.deleteContents(),Be.insertNode(re);const Ot=document.createRange();Ot.setStartAfter(re),Ot.setEndAfter(re),pe.removeAllRanges(),pe.addRange(Ot);const lt=document.createTextNode("\xA0");Ot.insertNode(lt),Ot.setStartAfter(lt),Ot.setEndAfter(lt),pe.removeAllRanges(),pe.addRange(Ot)}T(Ot=>({...Ot,active:!1,inlineSearchActive:!1})),S.current.focus();return}}const ie=document.createElement("span");if(ie.className=m.default.mention_tag,ie.dataset.id=fe.id,ie.dataset.type=fe.type,ie.dataset.contextId=fe.contextId||"",ie.contentEditable="false",fe.type==="file"||fe.type==="folder"){const Me=document.createElement("span");Me.className=(0,r.default)(m.default.mention_icon,fe.type==="file"?a?.getIcon(new v.URI(fe.text)):(0,c.getIcon)("folder")),ie.appendChild(Me)}const ge=b?.workspace;let Ie=fe.text;ge&&fe.contextId&&(Ie=fe.contextId.replace(new v.URI(ge.uri).codeUri.fsPath,"").slice(1));const Pe=document.createTextNode(Ie);ie.appendChild(Pe);let Se=0,Te=!1;const Ee=[];function me(Me){if(Me.nodeType===3)Ee.push({node:Me,start:Se,end:Se+Me.textContent.length}),Se+=Me.textContent.length;else if(Me.nodeType===1){const Fe=Me.childNodes;for(const _e of Array.from(Fe))me(_e)}}me(S.current);const Ne=document.createRange();if(w.startPos!==null)for(const Me of Ee){if(w.startPos-1>=Me.start&&w.startPos-1<=Me.end){const Fe=w.startPos-1-Me.start;Ne.setStart(Me.node,Fe),Te=!0}if(Te){const Fe=q?w.startPos+w.filter.length-1:$(S.current);if(Fe>=Me.start&&Fe<=Me.end){const _e=Fe-Me.start;Ne.setEnd(Me.node,_e);break}}}if(Te){Ne.deleteContents(),Ne.insertNode(ie);const Me=document.createRange();Me.setStartAfter(ie),Me.setEndAfter(ie),pe.removeAllRanges(),pe.addRange(Me);const Fe=document.createTextNode("\xA0");Me.insertNode(Fe),Me.setStartAfter(Fe),Me.setEndAfter(Fe),pe.removeAllRanges(),pe.addRange(Me)}T(Me=>({...Me,active:!1})),S.current.focus()},X=o.useCallback(fe=>{I(fe),f?.(fe)},[D,f]),oe=()=>{if(!S.current)return;const fe=S.current.innerHTML;if(!fe)return;const q=document.createElement("div");q.innerHTML=fe,q.querySelectorAll(`.${m.default.mention_tag}`).forEach(ie=>{var ge;const Ie=ie.getAttribute("data-context-id");if(Ie){const Pe=document.createTextNode(`{{${E}${ie.getAttribute("data-type")}:${Ie}}}`);(ge=ie.parentNode)===null||ge===void 0||ge.replaceChild(Pe,ie)}});let pe=q.innerHTML;pe=pe.trim().replaceAll(t.WHITE_SPACE_TEXT," "),fe&&(P(ie=>[...ie,fe]),F(-1),W(!1)),h&&h(pe,{model:D,...A}),S.current.innerHTML="",S.current&&(S.current.style.overflowY="hidden",S.current.style.height="auto")},ne=o.useCallback(()=>{u&&u()},[u]),ue=o.useCallback(fe=>(A.buttons||[]).filter(q=>q.position===fe).map(q=>o.createElement(c.Popover,{key:q.id,overlayClassName:m.default.popover_icon,id:`ai-chat-${q.id}`,position:c.PopoverPosition.top,title:q.title},o.createElement(p.EnhanceIcon,{className:(0,r.default)((0,c.getIcon)(q.icon),m.default[`${q.id}_logo`]),tabIndex:0,role:"button",ariaLabel:q.title,onClick:q.onClick}))),[A.buttons]);return o.createElement("div",{className:m.default.input_container},w.active&&o.createElement("div",{className:m.default.mention_panel_container},o.createElement(_.MentionPanel,{items:U(),activeIndex:w.activeIndex,onSelectItem:fe=>Z(fe,!0),position:{top:0,left:0},filter:w.level===0?w.filter:w.secondLevelFilter,visible:!0,level:w.level,loading:w.loading})),o.createElement("div",{className:m.default.editor_area},o.createElement("div",{ref:S,className:m.default.editor,contentEditable:!0,onInput:Y,onKeyDown:G,onCompositionEnd:z})),o.createElement("div",{className:m.default.footer},o.createElement("div",{className:m.default.left_control},A.showModelSelector&&o.createElement(c.Select,{options:A.modelOptions||[],value:D,onChange:X,className:m.default.model_selector,size:"small"}),ue(s.FooterButtonPosition.LEFT)),o.createElement("div",{className:m.default.right_control},ue(s.FooterButtonPosition.RIGHT),o.createElement(c.Popover,{overlayClassName:m.default.popover_icon,id:"ai-chat-send",position:c.PopoverPosition.top,content:d?"Stop":"Send"},d?o.createElement(p.EnhanceIcon,{wrapperClassName:m.default.stop_logo,className:(0,r.default)((0,c.getIcon)("stop"),m.default.stop_logo_icon),tabIndex:0,role:"button",ariaLabel:"Stop",onClick:ne}):o.createElement(p.EnhanceIcon,{wrapperClassName:m.default.send_logo,className:(0,r.default)((0,c.getIcon)("send-outlined"),m.default.send_logo_icon),tabIndex:0,role:"button",onClick:oe,ariaLabel:"Send"})))))};t.MentionInput=g},40167:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionItem=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(81878),p=n.__importDefault(e(97599)),v=({item:m,isActive:_,onClick:s})=>o.createElement("div",{className:`${p.default.mention_item} ${_?p.default.active:""}`,onClick:()=>s(m)},o.createElement("div",{className:p.default.mention_item_left},o.createElement(c.Icon,{className:(0,r.default)(p.default.mention_item_icon,m.icon)}),o.createElement("span",{className:p.default.mention_item_text},m.text),o.createElement("span",{className:p.default.mention_item_description},m.description)),m.getItems&&o.createElement(c.Icon,{className:(0,r.default)(p.default.mention_item_right,(0,c.getIcon)("arrowright"))}));t.MentionItem=v},80732:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionPanel=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=n.__importDefault(e(97599)),c=e(40167),p=({items:v,activeIndex:m,onSelectItem:_,position:s,filter:g,visible:l,level:h,loading:u=!1})=>{const d=r.useRef(null);if(r.useEffect(()=>{if(l&&d.current){const a=d.current.querySelector(`.${o.default.mention_item}.${o.default.active}`);a&&a.scrollIntoView({block:"nearest"})}},[m,l]),!l)return null;const f=(()=>{let a=v;if(h===0){if(g&&g.length>1){const b=g.substring(1).toLowerCase();a=v.filter(y=>y.text.toLowerCase().includes(b))}}else g&&g.length>0&&(a=v.filter(b=>b.text.toLowerCase().includes(g.toLowerCase())));return a})();return h===0&&f.length===0?null:r.createElement("div",{ref:d,className:o.default.mention_panel,style:{top:s.top,left:s.left}},u&&r.createElement("div",{className:o.default.loading_bar}),v.length>0?r.createElement("ul",{className:o.default.mention_list},v.map((a,b)=>r.createElement(c.MentionItem,{key:a.id,item:a,isActive:b===m,onClick:()=>_(a,!0)}))):r.createElement("div",{className:o.default.no_results},u?"\u6B63\u5728\u641C\u7D22...":"\u65E0\u5339\u914D\u7ED3\u679C"))};t.MentionPanel=p},44692:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MENTION_KEYWORD=t.MentionType=t.FooterButtonPosition=void 0;var e;(function(r){r.LEFT="left",r.RIGHT="right"})(e||(t.FooterButtonPosition=e={}));var n;(function(r){r.FILE="file",r.FOLDER="folder",r.CODE="code"})(n||(t.MentionType=n={})),t.MENTION_KEYWORD="@"},78048:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractIcon=t.createMessageByAI=t.createMessageByUser=void 0;const n=e(41869),r="",o=m=>({...m,type:"text",className:`${m.position==="left"?"rce-ai-msg":"rce-user-msg"} ${m.className?m.className:""}`}),c=(m,_)=>o({...m,position:"right",title:r,className:_,role:1});t.createMessageByUser=c;const p=(m,_)=>o({...m,position:"left",title:"",className:_,role:2});t.createMessageByAI=p;const v=m=>{let{title:_}=m;const{message:s,tooltip:g}=m;let l=m.icon||"";if(!_)return{icon:l,title:s,message:s,tooltip:g};const h=_.match(/^\$\(([a-z.]+\/)?([a-z0-9-]+)(~[a-z]+)?\)/i);if(h){const[u,d,E,f]=h,a=d?d.slice(0,-1):n.CODICON_OWNER;l=(0,n.getExternalIcon)(E,a),f&&(l+=` ${f.slice(1)}`),_=_.slice(u.length)}return{icon:l,title:_,message:s,tooltip:g}};t.extractIcon=v},19957:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LlmContextContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(46044);let p=class{initialize(){this.llmContextService.startAutoCollection()}};t.LlmContextContribution=p,n.__decorate([(0,r.Autowired)(c.LLMContextServiceToken),n.__metadata("design:type",Object)],p.prototype,"llmContextService",void 0),t.LlmContextContribution=p=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],p)},63536:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LLMContextServiceImpl=void 0;const n=e(85608),r=e(76003),o=e(11050),c=e(25234),p=e(19083),v=e(86560),m=e(96689),_=e(82196),s=e(14951),g=e(6287),l=e(20868);let h=class extends c.WithEventBus{constructor(){super(...arguments),this.isAutoCollecting=!1,this.contextVersion=0,this.maxAttachFilesLimit=10,this.maxAttachFoldersLimit=10,this.maxViewFilesLimit=20,this.attachedFiles=[],this.attachedFolders=[],this.recentlyViewFiles=[],this.onDidContextFilesChangeEmitter=new v.Emitter,this.onDidContextFilesChangeEvent=this.onDidContextFilesChangeEmitter.event}addFileToList(d,E,f){const a=E.findIndex(b=>b.uri.toString()===d.uri.toString());a>-1&&E.splice(a,1),E.push(d),E.length>f&&E.shift()}addFolderToList(d,E,f){const a=E.findIndex(b=>b.uri.toString()===d.uri.toString());a>-1&&E.splice(a,1),E.push(d),E.length>f&&E.shift()}addFileToContext(d,E,f=!1){if(!d)return;const a={uri:d,selection:E},b=f?this.attachedFiles:this.recentlyViewFiles,y=f?this.maxAttachFilesLimit:this.maxViewFilesLimit;f&&this.docModelManager.createModelReference(d),this.addFileToList(a,b,y),this.notifyContextChange()}addFolderToContext(d){if(!d)return;const E={uri:d};this.addFolderToList(E,this.attachedFolders,this.maxAttachFoldersLimit),this.notifyContextChange()}notifyContextChange(){this.onDidContextFilesChangeEmitter.fire(this.getAllContextFiles())}cleanFileContext(){this.attachedFiles=[],this.attachedFolders=[],this.notifyContextChange()}getAllContextFiles(){return{viewed:this.recentlyViewFiles,attached:this.attachedFiles,attachedFolders:this.attachedFolders,version:this.contextVersion++}}removeFileFromContext(d,E=!1){const f=E?this.attachedFiles:this.recentlyViewFiles,a=f.findIndex(b=>b.uri.toString()===d.toString());a>-1&&f.splice(a,1),this.notifyContextChange()}startAutoCollection(){this.isAutoCollecting||(this.isAutoCollecting=!0,this.startAutoCollectionInternal())}startAutoCollectionInternal(){this.disposables.push(this.eventBus.on(m.EditorDocumentModelCreationEvent,d=>{d.payload.uri.scheme==="file"&&this.addFileToContext(d.payload.uri,void 0,!1)})),this.disposables.push(this.eventBus.on(m.EditorDocumentModelRemovalEvent,d=>{d.payload.scheme==="file"&&this.removeFileFromContext(d.payload,!1)})),this.disposables.push(this.eventBus.on(m.EditorDocumentModelSavedEvent,d=>{d.payload.scheme})),this.disposables.push(this.eventBus.on(_.EditorSelectionChangeEvent,d=>{if(d.payload.selections.length>0){const E=[d.payload.selections[0].selectionStartLineNumber,d.payload.selections[0].positionLineNumber].sort();E[0]===E[1]?this.addFileToContext(d.payload.editorUri,void 0,!1):this.addFileToContext(d.payload.editorUri,E.sort((f,a)=>f-a),!1)}}))}stopAutoCollection(){this.dispose()}async serialize(){const d=this.getAllContextFiles(),E=v.URI.file(this.appConfig.workspaceDir);return{recentlyViewFiles:this.serializeRecentlyViewFiles(d.viewed,E),attachedFiles:this.serializeAttachedFiles(d.attached,E),attachedFolders:await this.serializeAttachedFolders(d.attachedFolders,E)}}async serializeAttachedFolders(d,E){const f=Array.from(new Set(d.map(a=>a.uri.toString())));return Promise.all(f.map(async a=>{var b;const y=new v.URI(a);return`\`\`\`
30843
30839
  ${((b=E.relative(y))===null||b===void 0?void 0:b.toString())||"/"}
30844
30840
  ${(await this.getPartiaFolderStructure(y.codeUri.fsPath)).map(S=>`- ${S}`).join(`
30845
30841
  `)}
@@ -31189,7 +31185,7 @@ Tokenizing line: ${R}`);for(let W=0;W<B.tokens.length;W++){const U=B.tokens[W];j
31189
31185
 
31190
31186
  `),this}appendMarkdown(s){return this.value+=s,this}appendCodeblock(s,g){return this.value+="\n```",this.value+=s,this.value+=`
31191
31187
  `,this.value+=g,this.value+="\n```\n",this}}t.MarkdownString=p;function v(_){return _ instanceof p?!0:_&&typeof _=="object"?typeof _.value=="string"&&(typeof _.isTrusted=="boolean"||_.isTrusted===void 0)&&(typeof _.supportThemeIcons=="boolean"||_.supportThemeIcons===void 0):!1}function m(_){const s=[],g=_.split("|").map(h=>h.trim());_=g[0];const l=g[1];if(l){const h=/height=(\d+)/.exec(l),u=/width=(\d+)/.exec(l),d=h?h[1]:"",E=u?u[1]:"",f=isFinite(parseInt(E,10)),a=isFinite(parseInt(d,10));f&&s.push(`width="${E}"`),a&&s.push(`height="${d}"`)}return{href:_,dimensions:s}}},53886:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(84811),t),n.__exportStar(e(38677),t),n.__exportStar(e(32112),t),n.__exportStar(e(58063),t),n.__exportStar(e(3484),t),n.__exportStar(e(84569),t),n.__exportStar(e(92771),t),n.__exportStar(e(87330),t),n.__exportStar(e(37070),t),n.__exportStar(e(32504),t),n.__exportStar(e(78941),t),n.__exportStar(e(69403),t)},32112:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},69403:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerLane=void 0;var e;(function(n){n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=4]="Right",n[n.Full=7]="Full"})(e||(t.OverviewRulerLane=e={}))},58063:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3484:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},92771:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},51418:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},73294:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},50288:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},37846:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.knownProtocols=void 0;const n=e(11431),r=e(46147);t.knownProtocols=new Map,t.knownProtocols.set(r.ExtHostAPIIdentifier.ExtHostDocuments,n.ExtensionDocumentProtocol)},35250:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectIdentifier=void 0;var e;(function(n){n.name="$ident";function r(c,p){return Object.defineProperty(c,n.name,{value:p,enumerable:!0}),c}n.mixin=r;function o(c){return c[n.name]}n.of=o})(e||(t.ObjectIdentifier=e={}))},16363:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},70858:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isLittleEndian=p,t.encodeSemanticTokensDto=v,t.decodeSemanticTokensDto=_;function e(s){for(let g=0,l=s.length;g<l;g+=4){const h=s[g+0],u=s[g+1],d=s[g+2],E=s[g+3];s[g+0]=E,s[g+1]=d,s[g+2]=u,s[g+3]=h}}function n(s){const g=new Uint8Array(s.buffer,s.byteOffset,s.length*4);return p()||e(g),g}function r(s){const g=s;if(p()||e(g),g.byteOffset%4===0)return new Uint32Array(g.buffer,g.byteOffset,g.length/4);{const l=new Uint8Array(g.byteLength);return l.set(g),new Uint32Array(l.buffer,l.byteOffset,l.length/4)}}let o=!0,c=!1;function p(){if(!c){c=!0;const s=new Uint8Array(2);s[0]=1,s[1]=2,o=new Uint16Array(s.buffer)[0]===513}return o}function v(s){const g=new Uint32Array(m(s));let l=0;if(g[l++]=s.id,s.type==="full")g[l++]=1,g[l++]=s.data.length,g.set(s.data,l),l+=s.data.length;else{g[l++]=2,g[l++]=s.deltas.length;for(const h of s.deltas)g[l++]=h.start,g[l++]=h.deleteCount,h.data?(g[l++]=h.data.length,g.set(h.data,l),l+=h.data.length):g[l++]=0}return n(g)}function m(s){let g=0;if(g+=2,s.type==="full")g+=1+s.data.length;else{g+=1,g+=3*s.deltas.length;for(const l of s.deltas)l.data&&(g+=l.data.length)}return g}function _(s){const g=r(s);let l=0;const h=g[l++];if(g[l++]===1){const f=g[l++],a=g.subarray(l,l+f);return l+=f,{id:h,type:"full",data:a}}const d=g[l++],E=[];for(let f=0;f<d;f++){const a=g[l++],b=g[l++],y=g[l++];let A;y>0&&(A=g.subarray(l,l+y),l+=y),E[f]={start:a,deleteCount:b,data:A}}return{id:h,type:"delta",deltas:E}}},29490:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},89225:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.startsWith=e,t.endsWith=n,t.isLowerAsciiLetter=r,t.isUpperAsciiLetter=o,t.equalsIgnoreCase=p,t.escapeRegExpCharacters=m,t.startsWithIgnoreCase=_;function e(s,g){if(s.length<g.length)return!1;if(s===g)return!0;for(let l=0;l<g.length;l++)if(s[l]!==g[l])return!1;return!0}function n(s,g){const l=s.length-g.length;return l>0?s.indexOf(g,l)===l:l===0?s===g:!1}function r(s){return s>=97&&s<=122}function o(s){return s>=65&&s<=90}function c(s){return r(s)||o(s)}function p(s,g){const l=s?s.length:0,h=g?g.length:0;return l!==h?!1:v(s,g)}function v(s,g,l=s.length){if(typeof s!="string"||typeof g!="string")return!1;for(let h=0;h<l;h++){const u=s.charCodeAt(h),d=g.charCodeAt(h);if(u!==d){if(c(u)&&c(d)){const E=Math.abs(u-d);if(E!==0&&E!==32)return!1}else if(String.fromCharCode(u).toLowerCase()!==String.fromCharCode(d).toLowerCase())return!1}}return!0}function m(s){return s.replace(/[-\\{}*+?|^$.[\]()#]/g,"\\$&")}function _(s,g){const l=g.length;return g.length>s.length?!1:v(s,g,l)}},54741:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TaskFilterDTO=void 0;var e;(function(n){function r(c){return c}n.from=r;function o(c){if(c)return Object.assign(Object.create(null),c)}n.to=o})(e||(t.TaskFilterDTO=e={}))},25535:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},54056:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TestItemRootImpl=t.TestItemImpl=t.MixedTestItemController=t.InvalidTestItemError=t.DuplicateTestItemError=t.diffTestItems=t.getPrivateApiFor=t.createPrivateApiFor=void 0;const e=new WeakMap,n=(E,f)=>{const a={controllerId:f};return e.set(E,a),a};t.createPrivateApiFor=n;const r=E=>e.get(E);t.getPrivateApiFor=r;const o=(E,f,a,b)=>{let y=a;return{enumerable:!0,configurable:!1,get(){return y},set(A){var S;if(!b(y,A)){const w=y;y=A,(S=E.listener)===null||S===void 0||S.call(E,{op:3,key:f,value:A,previous:w})}}}},c=(E,f)=>E===f,p={range:(E,f)=>E===f?!0:!E||!f?!1:E.isEqual(f),label:c,description:c,sortText:c,busy:c,error:c,canResolveChildren:c,tags:(E,f)=>!(E.length!==f.length||E.some(a=>!f.find(b=>a.id===b.id)))},v=Object.keys(p),m=(E,f)=>({range:o(E,"range",void 0,p.range),label:o(E,"label",f,p.label),description:o(E,"description",void 0,p.description),sortText:o(E,"sortText",void 0,p.sortText),canResolveChildren:o(E,"canResolveChildren",!1,p.canResolveChildren),busy:o(E,"busy",!1,p.busy),error:o(E,"error",void 0,p.error),tags:o(E,"tags",[],p.tags)}),_=(E,f)=>{const a=new Map;for(const b of v){const y=p[b];y(E[b],f[b])||a.set(b,f[b])}return a};t.diffTestItems=_;class s extends Error{constructor(f){super(`Attempted to insert a duplicate test item ID ${f}`)}}t.DuplicateTestItemError=s;class g extends Error{constructor(f){super(`TestItem with ID "${f}" is invalid. Make sure to create it from the createTestItem method.`)}}t.InvalidTestItemError=g;class l extends Error{constructor(f,a,b){super(`TestItem with ID "${f}" is from controller "${a}" and cannot be added as a child of an item from controller "${b}".`)}}t.MixedTestItemController=l;const h=E=>{const f=(0,t.getPrivateApiFor)(E);let a=new Map;return{get size(){return a.size},forEach(b,y){for(const A of a.values())b.call(y,A,this)},replace(b){var y;const A=new Map,S=new Set(a.keys()),w={op:4,ops:[]};for(const T of b){if(!(T instanceof u))throw new g(T.id);const D=(0,t.getPrivateApiFor)(T).controllerId;if(D!==f.controllerId)throw new l(T.id,D,f.controllerId);if(A.has(T.id))throw new s(T.id);A.set(T.id,T),S.delete(T.id),w.ops.push({op:0,item:T})}for(const T of S.keys())w.ops.push({op:1,id:T});(y=f.listener)===null||y===void 0||y.call(f,w),a=A},add(b){var y;if(!(b instanceof u))throw new g(b.id);a.set(b.id,b),(y=f.listener)===null||y===void 0||y.call(f,{op:0,item:b})},delete(b){var y;a.delete(b)&&((y=f.listener)===null||y===void 0||y.call(f,{op:1,id:b}))},get(b){return a.get(b)},toJSON(){return Array.from(a.values())},[Symbol.iterator](){return a.values()}}};class u{constructor(f,a,b,y){if(a.includes("\0"))throw new Error(`Test IDs may not include the ${JSON.stringify(a)} symbol`);const A=(0,t.createPrivateApiFor)(this,f);Object.defineProperties(this,{id:{value:a,enumerable:!0,writable:!1},uri:{value:y,enumerable:!0,writable:!1},parent:{enumerable:!1,get(){return A.parent instanceof d?void 0:A.parent}},children:{value:h(this),enumerable:!0,writable:!1},...m(A,b)})}invalidateResults(){var f,a;(a=(f=(0,t.getPrivateApiFor)(this)).listener)===null||a===void 0||a.call(f,{op:2})}}t.TestItemImpl=u;class d extends u{constructor(f,a){super(f,f,a,void 0)}}t.TestItemRootImpl=d},82086:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4809:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},86162:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeviewsService=t.ITreeViewsService=t.TreeViewSelection=t.TreeViewItem=t.TreeItemCheckboxState=void 0;var e;(function(c){c[c.Unchecked=0]="Unchecked",c[c.Checked=1]="Checked"})(e||(t.TreeItemCheckboxState=e={}));class n{}t.TreeViewItem=n;var r;(function(c){function p(v){return!!v&&typeof v=="object"&&"treeViewId"in v&&"treeItemId"in v}c.is=p})(r||(t.TreeViewSelection=r={})),t.ITreeViewsService=Symbol("ITreeViewsService");class o{constructor(){this._dragOperations=new Map,this._renderedElements=new Map}removeDragOperationTransfer(p){if(p&&this._dragOperations.has(p)){const v=this._dragOperations.get(p);return this._dragOperations.delete(p),v}}addDragOperationTransfer(p,v){this._dragOperations.set(p,v)}getRenderedTreeElement(p){if(this._renderedElements.has(p))return this._renderedElements.get(p)}addRenderedTreeItemElement(p,v){this._renderedElements.set(p,v)}removeRenderedTreeItemElement(p){this._renderedElements.has(p)&&this._renderedElements.delete(p)}}t.TreeviewsService=o},64945:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},43710:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isObject=o,t.mixin=c,t.illegalArgument=p,t.isLocationArray=v,t.isDefinitionLinkArray=m,t.reviveRegExp=_,t.reviveIndentationRule=s,t.reviveOnEnterRule=g,t.reviveOnEnterRules=l,t.serializeEnterRules=h,t.serializeRegExp=u,t.serializeIndentation=d,t.serializeAutoClosingPairs=E;const r=e(85608).__importStar(e(51328));function o(f){return typeof f=="object"&&f!==null&&!Array.isArray(f)&&!(f instanceof RegExp)&&!(f instanceof Date)}function c(f,a,b=!0){return o(f)?(o(a)&&Object.keys(a).forEach(y=>{y in f?b&&(o(f[y])&&o(a[y])?c(f[y],a[y],b):f[y]=a[y]):f[y]=a[y]}),f):a}function p(f){return f?new Error(`Illegal argument: ${f}`):new Error("Illegal argument")}function v(f){return Array.isArray(f)&&f.length>0&&f[0]instanceof r.Location}function m(f){return Array.isArray(f)&&f.length>0&&f[0].hasOwnProperty("targetUri")&&f[0].hasOwnProperty("targetRange")}function _(f){if(!(typeof f>"u"||f===null))return new RegExp(f.pattern,f.flags)}function s(f){if(!(typeof f>"u"||f===null))return{increaseIndentPattern:_(f.increaseIndentPattern),decreaseIndentPattern:_(f.decreaseIndentPattern),indentNextLinePattern:_(f.indentNextLinePattern),unIndentedLinePattern:_(f.unIndentedLinePattern)}}function g(f){return{beforeText:_(f.beforeText),afterText:_(f.afterText),action:f.action,previousLineText:_(f.previousLineText)}}function l(f){if(!(typeof f>"u"||f===null))return f.map(g)}function h(f){if(!(typeof f>"u"||f===null))return f.map(a=>({action:a.action,beforeText:u(a.beforeText),afterText:u(a.afterText),previousLineText:u(a.previousLineText)}))}function u(f){if(!(typeof f>"u"||f===null))return{pattern:f.source,flags:(f.global?"g":"")+(f.ignoreCase?"i":"")+(f.multiline?"m":"")}}function d(f){if(!(typeof f>"u"||f===null))return{increaseIndentPattern:u(f.increaseIndentPattern),decreaseIndentPattern:u(f.decreaseIndentPattern),indentNextLinePattern:u(f.indentNextLinePattern),unIndentedLinePattern:u(f.unIndentedLinePattern)}}function E(f){if(f)return f.map(a=>({open:a.open,close:a.close,notIn:a.notIn?a.notIn.map(b=>r.SyntaxTokenType.toString(b)):void 0}))}},96833:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},98116:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebviewViewResolverRegistrationRemovalEvent=t.WebviewViewResolverRegistrationEvent=void 0;const n=e(43718);class r extends n.BasicEvent{}t.WebviewViewResolverRegistrationEvent=r;class o extends n.BasicEvent{}t.WebviewViewResolverRegistrationRemovalEvent=o},55467:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},92622:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigurationTarget=void 0,t.reviveWorkspaceEditDto=o;const n=e(43718);var r;(function(c){c[c.Global=1]="Global",c[c.Workspace=2]="Workspace",c[c.WorkspaceFolder=3]="WorkspaceFolder"})(r||(t.ConfigurationTarget=r={}));function o(c){if(c&&c.edits)for(const p of c.edits)if(typeof p.resource=="object")p.resource=n.URI.from(p.resource),p.options={openDirtyInEditor:!0},p.textEdit=p.textEdit,p.versionId=p.versionId;else{const v=p;v.newResource=p.newResource?n.URI.from(p.newResource):void 0,v.oldResource=p.oldResource?n.URI.from(p.oldResource):void 0,v.options={...v.options,showInEditor:!1}}return c}},57646:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BinaryEditorComponent=void 0;const r=e(85608).__importDefault(e(14041)),o=e(76003),c=e(41869),p=e(37406),v=e(57517),m=e(88819),_=s=>{const g=s.resource.uri.codeUri.fsPath,l=(0,c.useInjectable)(o.INJECTOR_TOKEN),h=(0,c.useInjectable)(c.AppConfig),u=(0,c.useInjectable)(v.WorkbenchEditorService),d=(0,c.useInjectable)(c.IEventBus),E=()=>{const a=u.currentResource;a&&(a.metadata={...a.metadata,skipPreventBinary:!0},d.fire(new v.ResourceOpenTypeChangedEvent(a.uri)))},f=[{label:(0,c.localize)("editor.file.prevent.stillOpen"),onClick:()=>E()}];return h.isElectronRenderer&&f.push({label:(0,c.localize)("editor.openExternal"),onClick:()=>l.get(p.IElectronMainUIService).openPath(g)}),r.default.createElement(m.PreventComponent,{description:(0,c.localize)("editor.cannotOpenBinary"),actions:f})};t.BinaryEditorComponent=_},60387:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WalkThroughSnippetSchemeDocumentProvider=t.VscodeSchemeDocumentProvider=t.FileSchemeDocumentProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(96405),p=e(68692),v=e(14951),m=e(80449);let _=class extends p.BaseFileSystemEditorDocumentProvider{handlesUri(h){return h.scheme===o.Schemes.file?20:-1}handlesScheme(){return!1}provideEncoding(h){return super.provideEncoding(h)}preferLanguageForUri(h){if(["settings.json"].includes(h.path.base))return"jsonc"}async saveDocumentModel(h,u,d,E,f,a=!1,b=`
31192
- `,y){const A=this.hashCalculateService.calculate(d);return u.length>m.FILE_SAVE_BY_CHANGE_THRESHOLD?await this.fileSchemeDocClient.saveByChange(h.toString(),{baseMd5:A,changes:E,eol:b},f,a,y):await this.fileSchemeDocClient.saveByContent(h.toString(),{baseMd5:A,content:u},f,a,y)}async provideEditorDocumentModelContentMd5(h,u){return this.fileSchemeDocClient.getMd5(h.toString(),u)}};t.FileSchemeDocumentProvider=_,n.__decorate([(0,r.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],_.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(m.IFileSchemeDocClient),n.__metadata("design:type",Object)],_.prototype,"fileSchemeDocClient",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],_.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(c.IHashCalculateService),n.__metadata("design:type",Object)],_.prototype,"hashCalculateService",void 0),t.FileSchemeDocumentProvider=_=n.__decorate([(0,r.Injectable)()],_);let s=class{constructor(){this._onDidChangeContent=new o.Emitter,this.onDidChangeContent=this._onDidChangeContent.event,this.listeners={}}isReadonly(h){return!0}handlesScheme(h){return h==="vscode"}async provideEditorDocumentModelContent(h,u){return this.getSchemaContent(h)}getSchemaContent(h){const u=h.toString(),d=this.jsonRegistry.getSchemaContributions().schemas[u];if(d){const E=JSON.stringify(d);if(!this.listeners[u]){const f=o.Disposable.create(()=>{this.jsonRegistry.onDidChangeSchema(a=>{a===u&&this._onDidChangeContent.fire(h)})});this.listeners[u]=f}return E}return"{}"}onDidDisposeModel(h){h.toString()&&(this.listeners[h.toString()].dispose(),delete this.listeners[h.toString()])}};t.VscodeSchemeDocumentProvider=s,n.__decorate([(0,r.Autowired)(o.ISchemaStore),n.__metadata("design:type",Object)],s.prototype,"schemaStore",void 0),n.__decorate([(0,r.Autowired)(o.IJSONSchemaRegistry),n.__metadata("design:type",Object)],s.prototype,"jsonRegistry",void 0),t.VscodeSchemeDocumentProvider=s=n.__decorate([(0,r.Injectable)()],s);let g=class{constructor(){this.documentContentMaps=new Map,this._onDidChangeContent=new o.Emitter,this.onDidChangeContent=this._onDidChangeContent.event}handlesScheme(h){return h===o.Schemes.walkThroughSnippet}provideEditorDocumentModelContent(h,u){return this.documentContentMaps.has(h.toString())||this.documentContentMaps.set(h.toString(),""),this.documentContentMaps.get(h.toString())}isReadonly(){return!1}preferLanguageForUri(){return"plaintext"}};t.WalkThroughSnippetSchemeDocumentProvider=g,t.WalkThroughSnippetSchemeDocumentProvider=g=n.__decorate([(0,r.Injectable)()],g)},41352:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSchemeDocClientService=void 0;const n=e(85608),r=e(76003),o=e(80449);let c=class{saveByChange(v,m,_,s,g){return this.fileDocBackendService.$saveByChange(v,m,_,s,g)}saveByContent(v,m,_,s,g){return this.fileDocBackendService.$saveByContent(v,m,_,s,g)}getMd5(v,m){return this.fileDocBackendService.$getMd5(v,m)}};t.FileSchemeDocClientService=c,n.__decorate([(0,r.Autowired)(o.FileSchemeDocNodeServicePath),n.__metadata("design:type",Object)],c.prototype,"fileDocBackendService",void 0),t.FileSchemeDocClientService=c=n.__decorate([(0,r.Injectable)()],c)},17276:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSystemEditorComponentContribution=t.FileSystemEditorResourceContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(26542),p=e(57517),v=e(17878),m=e(42933),_=e(57646),s=e(60387),g=e(88819),l=e(99025),h="video-preview",u="image-preview",d="external-file",E="large-file-prevent";let f=class{registerResource(y){y.registerResourceProvider(this.untitledResourceProvider)}registerEditorDocumentModelContentProvider(y){y.registerEditorDocumentModelContentProvider(this.fileSchemeDocumentProvider),y.registerEditorDocumentModelContentProvider(this.vscodeSchemeDocumentProvider),y.registerEditorDocumentModelContentProvider(this.walkThroughSnippetSchemeDocumentProvider),y.registerEditorDocumentModelContentProvider(this.untitledSchemeDocumentProvider)}};t.FileSystemEditorResourceContribution=f,n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.FileSchemeDocumentProvider)],f.prototype,"fileSchemeDocumentProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.VscodeSchemeDocumentProvider)],f.prototype,"vscodeSchemeDocumentProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.WalkThroughSnippetSchemeDocumentProvider)],f.prototype,"walkThroughSnippetSchemeDocumentProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",v.UntitledSchemeResourceProvider)],f.prototype,"untitledResourceProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",v.UntitledSchemeDocumentProvider)],f.prototype,"untitledSchemeDocumentProvider",void 0),t.FileSystemEditorResourceContribution=f=n.__decorate([(0,o.Domain)(p.BrowserEditorContribution)],f);let a=class{constructor(){this.cachedFileType=new o.LRUMap(200,100),this.fileServiceClient.onFilesChanged(y=>{y.forEach(A=>{this.cachedFileType.delete(A.uri.toString())})})}registerEditorComponent(y){y.registerEditorComponent({component:l.ImagePreview,uid:u,scheme:o.Schemes.file}),y.registerEditorComponent({component:l.VideoPreview,uid:h,scheme:o.Schemes.file}),y.registerEditorComponent({component:_.BinaryEditorComponent,uid:d,scheme:o.Schemes.file}),y.registerEditorComponent({component:g.LargeFilePrevent,uid:E,scheme:o.Schemes.file}),y.registerEditorComponentResolver(A=>A===o.Schemes.file||this.fileServiceClient.handlesScheme(A)?10:-1,(A,S)=>{S.length===0&&S.push({type:p.EditorOpenType.component,componentId:d})}),y.registerEditorComponentResolver(A=>A===o.Schemes.file||this.fileServiceClient.handlesScheme(A)?10:-1,async(A,S)=>{const w=await this.getFileType(A.uri.toString());switch(w){case"image":{S.push({type:p.EditorOpenType.component,componentId:u});break}case"video":{S.push({type:p.EditorOpenType.component,componentId:h});break}case"binary":case"text":{const{metadata:T,uri:D}=A,I=T||{};if(w==="binary"&&!I.skipPreventBinary)break;const R=await this.fileServiceClient.getFileStat(D.toString());await this.preference.ready;const M=this.preference.getValid("editor.largeFile",4*1024*1024*1024);R&&(R.size||0)>M&&!I.skipPreventTooLarge?S.push({type:p.EditorOpenType.component,componentId:E}):S.push({type:p.EditorOpenType.code,title:(0,o.localize)("editorOpenType.code")});break}}}),y.registerEditorComponentResolver(o.Schemes.untitled,(A,S,w)=>{w([{type:p.EditorOpenType.code,priority:"default"}])})}async getFileType(y){return this.cachedFileType.has(y)||((0,c.getLanguageIdFromMonaco)(new o.URI(y))?this.cachedFileType.set(y,"text"):this.cachedFileType.set(y,await this.getRealFileType(y))),this.cachedFileType.get(y)}async getRealFileType(y){try{return await this.fileServiceClient.getFileType(y)}catch{return"text"}}};t.FileSystemEditorComponentContribution=a,n.__decorate([(0,r.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],a.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],a.prototype,"preference",void 0),t.FileSystemEditorComponentContribution=a=n.__decorate([(0,o.Domain)(p.BrowserEditorContribution),n.__metadata("design:paramtypes",[])],a)},52568:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSchemeModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(80449),p=e(41352),v=e(17276);let m=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[v.FileSystemEditorResourceContribution,v.FileSystemEditorComponentContribution,{token:c.IFileSchemeDocClient,useClass:p.FileSchemeDocClientService}],this.backServices=[{servicePath:c.FileSchemeDocNodeServicePath}]}};t.FileSchemeModule=m,t.FileSchemeModule=m=n.__decorate([(0,r.Injectable)()],m)},88819:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LargeFilePrevent=t.PreventComponent=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(41869),p=e(81878),v=e(54414),m=e(82196),_=n.__importDefault(e(19996)),s=l=>o.default.createElement("div",{className:_.default["error-page"]},o.default.createElement("div",{className:(0,r.default)(_.default.icon,(0,c.getExternalIcon)("warning"))}),o.default.createElement("div",{className:_.default.description},l.description),o.default.createElement("div",{className:_.default["actions-wrapper"]},l.actions.map((h,u)=>o.default.createElement(p.Button,{key:u,onClick:()=>h.onClick(),className:_.default["action-button"]},h.label))));t.PreventComponent=s;const g=()=>{const l=(0,c.useInjectable)(v.WorkbenchEditorService),h=(0,c.useInjectable)(c.IEventBus),u=()=>{const d=l.currentResource;d&&(d.metadata={...d.metadata,skipPreventTooLarge:!0},h.fire(new m.ResourceOpenTypeChangedEvent(d.uri)))};return o.default.createElement(t.PreventComponent,{description:(0,c.localize)("editor.largeFile.prevent"),actions:[{label:(0,c.localize)("editor.file.prevent.stillOpen"),onClick:()=>u()}]})};t.LargeFilePrevent=g},99025:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImagePreview=t.VideoPreview=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(40827),p=n.__importDefault(e(19996)),v=_=>{const s=(0,o.useInjectable)(c.StaticResourceService);return{src:r.default.useMemo(()=>s.resolveStaticResource(_.uri).toString(),[_])}};t.VideoPreview=(0,r.memo)(_=>{const{src:s}=v(_.resource);return r.default.createElement("div",{className:p.default.kt_video_preview},r.default.createElement("video",{playsInline:!0,controls:!0,className:p.default.kt_video,src:s}))});const m=_=>{const s=r.default.useRef(),g=r.default.useRef(),{src:l}=v(_.resource);return r.default.useEffect(()=>{const h=new o.Disposable;return s.current&&(s.current.src=l),()=>{h.dispose()}},[_.resource]),r.default.createElement("div",{className:p.default.kt_image_preview},r.default.createElement("div",{ref:g},r.default.createElement("img",{ref:h=>h&&(s.current=h)})))};t.ImagePreview=m},80449:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChangeType=t.FileSchemeDocNodeServicePath=t.IFileSchemeDocNodeService=t.IFileSchemeDocClient=t.FILE_SAVE_BY_CHANGE_THRESHOLD=t.FILE_ON_DISK_SCHEME=void 0,t.FILE_ON_DISK_SCHEME="fileOnDisk",t.FILE_SAVE_BY_CHANGE_THRESHOLD=1e5,t.IFileSchemeDocClient=Symbol("IFileSchemeDocClient"),t.IFileSchemeDocNodeService=Symbol("FileSchemeDocNodeService"),t.FileSchemeDocNodeServicePath="FileSchemeDocNodeService";var e;(function(n){n[n.ADDED=1]="ADDED",n[n.REMOVED=2]="REMOVED"})(e||(t.ChangeType=e={}))},15625:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IFileSearchService=t.FileSearchServicePath=void 0,t.FileSearchServicePath="FileSearchServicePath",t.IFileSearchService=Symbol("FileSearchService")},84660:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(15625),t)},47720:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(84660),t)},2156:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileServiceClient=t.BrowserFileSystemRegistryImpl=void 0;const n=e(85608),r=e(32852),o=e(76003),c=e(41869),p=e(43718),v=e(37406),m=e(8170),_=e(41682),s=e(42933),g=e(81952);let l=class{constructor(){this.providers=new Map}registerFileSystemProvider(d){const E=d.scheme;return this.providers.set(E,d),{dispose:()=>{this.providers.delete(E)}}}};t.BrowserFileSystemRegistryImpl=l,t.BrowserFileSystemRegistryImpl=l=n.__decorate([(0,o.Injectable)()],l);let h=class{get clientId(){return this.applicationService.clientId}constructor(){this.watcherWithSchemaMap=new Map,this.watcherDisposerMap=new Map,this.onFileChangedEmitter=new c.Emitter,this.onFileProviderChangedEmitter=new c.Emitter,this._onFilesChanged=new c.Emitter,this.onFilesChanged=this._onFilesChanged.event,this._onFileProviderChanged=new c.Emitter,this.onFileProviderChanged=this._onFileProviderChanged.event,this._onDidChangeFileSystemProviderRegistrations=new c.Emitter,this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event,this._onWillActivateFileSystemProvider=new c.Emitter,this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event,this._onDidChangeFileSystemProviderCapabilities=new c.Emitter,this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event,this.filesExcludesMatcherList=[],this.watcherId=0,this.toDisposable=new c.DisposableCollection,this.watchFileExcludes=[],this.watchFileExcludesMatcherList=[],this.filesExcludes=[],this.workspaceRoots=[],this._providerChanged=new Set,this.fsProviders=new Map,this.userHomeDeferred=new c.Deferred,this.options={encoding:"utf8",overwrite:!1,recursive:!0,moveToTrash:!0},this.uriWatcherMap=new Map,this.toDisposable.push(this.onDidChangeFileSystemProviderRegistrations(d=>{d.added&&d.scheme===p.Schemes.file&&this.doGetCurrentUserHome()}))}async initialize(){const d=await this.getProvider(p.Schemes.file);d.initialize&&await d.initialize(this.clientId,this.appConfig.recursiveWatcherBackend)}async doGetCurrentUserHome(){const E=(await this.getProvider(p.Schemes.file)).getCurrentUserHome();this.userHomeDeferred.resolve(E)}handlesScheme(d){return this.registry.providers.has(d)||this.fsProviders.has(d)}dispose(){return this.toDisposable.dispose()}async resolveContent(d,E){const f=this.convertUri(d),b=await(await this.getProvider(f.scheme)).readFile(f.codeUri),y=b.data||b;return{content:c.BinaryBuffer.wrap(Uint8Array.from(y)).toString(E?.encoding)}}async readFile(d){const E=this.convertUri(d),a=await(await this.getProvider(E.scheme)).readFile(E.codeUri),b=a.data||a;return{content:c.BinaryBuffer.wrap(Uint8Array.from(b))}}async readFileStream(d){const E=this.convertUri(d);return await(await this.getProvider(E.scheme)).readFileStream(E.codeUri)}async getFileStat(d,E=!0){const f=this.convertUri(d),a=await this.getProvider(f.scheme);try{const b=await a.stat(f.codeUri);if(!b)throw s.FileSystemError.FileNotFound(f.codeUri.toString(),"File not found.");return this.filterStat(b,E)}catch(b){if(s.FileSystemError.FileNotFound.is(b))return}}async setContent(d,E,f){const a=this.convertUri(d.uri),b=await this.getProvider(a.scheme),y=await b.stat(a.codeUri);if(!y)throw s.FileSystemError.FileNotFound(d.uri,"File not found.");if(y.isDirectory)throw s.FileSystemError.FileIsADirectory(d.uri,"Cannot set the content.");if(!await this.isInSync(d,y))throw this.createOutOfSyncError(d);return await b.writeFile(a.codeUri,typeof E=="string"?c.BinaryBuffer.fromString(E).buffer:E,{create:!1,overwrite:!0,encoding:f?.encoding}),await b.stat(a.codeUri)}async updateContent(d,E,f){const a=this.convertUri(d.uri),b=await this.getProvider(a.scheme),y=await b.stat(a.codeUri);if(!y)throw s.FileSystemError.FileNotFound(d.uri,"File not found.");if(y.isDirectory)throw s.FileSystemError.FileIsADirectory(d.uri,"Cannot set the content.");if(!this.checkInSync(d,y))throw this.createOutOfSyncError(d);if(E.length===0)return y;const A=await b.readFile(a.codeUri),S=this.applyContentChanges(c.BinaryBuffer.wrap(A).toString(f?.encoding),E);await b.writeFile(a.codeUri,c.BinaryBuffer.fromString(S).buffer,{create:!1,overwrite:!0,encoding:f?.encoding});const w=await b.stat(a.codeUri);if(!w)throw s.FileSystemError.FileNotFound(a.codeUri.toString(),"File not found.");return w}async createFile(d,E){const f=this.convertUri(d),a=await this.getProvider(f.scheme),b=c.BinaryBuffer.fromString(E?.content||"").buffer;let y=await a.writeFile(f.codeUri,b,{create:!0,overwrite:E&&E.overwrite||!1,encoding:E?.encoding});return y=y||await a.stat(f.codeUri),y}async createFolder(d){const E=this.convertUri(d),f=await this.getProvider(E.scheme),a=await f.createDirectory(E.codeUri);return a||await f.stat(E.codeUri)}async move(d,E,f){const a=this.convertUri(d),b=this.convertUri(E),y=await this.getProvider(a.scheme),A=await y.rename(a.codeUri,b.codeUri,{overwrite:!!(f&&f.overwrite)});return A||await y.stat(b.codeUri)}async copy(d,E,f){const a=this.convertUri(d),b=this.convertUri(E),y=await this.getProvider(a.scheme),A=await this.doGetOverwrite(f);if(!(0,s.containsExtraFileMethod)(y,"copy"))throw this.getErrorProvideNotSupport(a.scheme,"copy");const S=await y.copy(a.codeUri,b.codeUri,{overwrite:!!A});return S||await y.stat(b.codeUri)}async getFsPath(d){if(d.startsWith("file:/"))return c.FileUri.fsPath(d)}fireFilesChange(d){const E=d.changes.map(f=>({uri:f.uri,type:f.type}));this._onFilesChanged.fire(E),this.eventBus.fire(new c.FilesChangeEvent(E))}async watchFileChanges(d,E){const a=(this.appConfig.pollingWatcherDirectories||[]).some(I=>d.path.toString().startsWith(I)),b=this.convertUri(d.toString()),y=this.uriWatcherMap.get(b.toString());if(y)if(y.isDisposed())this.uriWatcherMap.delete(b.toString());else return y;const A=this.watcherId++,S=await this.getProvider(b.scheme),w=this.watcherWithSchemaMap.get(b.scheme)||[],T=await S.watch(b.codeUri,{excludes:E,pollingWatch:a});this.watcherDisposerMap.set(A,{dispose:async()=>{const I=this.uriWatcherMap.get(b.toString());await Promise.all([S.unwatch&&S.unwatch(T),I&&I.dispose()]),this.uriWatcherMap.delete(b.toString())}}),w.push(A),this.watcherWithSchemaMap.set(b.scheme,w);const D=new g.FileSystemWatcher({fileServiceClient:this,watchId:A,uri:d});return this.uriWatcherMap.set(b.toString(),D),D}async setWatchFileExcludes(d){return await(await this.getProvider(p.Schemes.file)).setWatchFileExcludes(d)}async getWatchFileExcludes(){return await(await this.getProvider(p.Schemes.file)).getWatchFileExcludes()}async setFilesExcludes(d,E){this.filesExcludes=d,this.filesExcludesMatcherList=[],E&&this.setWorkspaceRoots(E),this.updateExcludeMatcher()}async setWorkspaceRoots(d){this.workspaceRoots=d,this.updateExcludeMatcher()}async unwatchFileChanges(d){const E=this.watcherDisposerMap.get(d);if(!(!E||!E.dispose))return this.watcherDisposerMap.delete(d),E.dispose()}async delete(d,E){if(this.appConfig.isElectronRenderer&&E?.moveToTrash!==!1){const b=new c.URI(d);if(b.scheme===p.Schemes.file)return this.injector.get(v.IElectronMainUIService).moveToTrash(b.codeUri.fsPath)}const f=this.convertUri(d),a=await this.getProvider(f.scheme);await a.stat(f.codeUri),await a.delete(f.codeUri,{recursive:!0,moveToTrash:await this.doGetMoveToTrash(E)})}async getEncoding(d){return"utf8"}listCapabilities(){return _.Iterable.map(this.fsProviders,([d,E])=>({scheme:d,capabilities:E.capabilities}))}registerProvider(d,E){if(this.fsProviders.has(d))throw new Error(`The file system provider for \`${d}\` already registered`);const f=[];this.fsProviders.set(d,E),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:d,provider:E}),f.push({dispose:()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:d,provider:E}),this.fsProviders.delete(d),this._providerChanged.add(d)}}),E.onDidChangeFile&&f.push(E.onDidChangeFile(b=>this.fireFilesChange({changes:b}))),this.toDisposable.push(E.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:E,scheme:d}))),f.push({dispose:async()=>{const b=[];(this.watcherWithSchemaMap.get(d)||[]).forEach(y=>b.push(this.unwatchFileChanges(y))),await Promise.all(b)}}),this._providerChanged.add(d),this.onFileProviderChangedEmitter.fire(Array.from(this._providerChanged)),this.toDisposable.pushAll(f);const a=new c.DisposableCollection;return a.pushAll(f),this._onFileProviderChanged.fire(Array.from(this._providerChanged)),a}async access(d,E=s.FileAccess.Constants.F_OK){const f=this.convertUri(d),a=await this.getProvider(f.scheme);if(!(0,s.containsExtraFileMethod)(a,"access"))throw this.getErrorProvideNotSupport(f.scheme,"access");return await a.access(f.codeUri,E)}async getFileType(d){const E=this.convertUri(d),f=await this.getProvider(E.scheme);if(!(0,s.containsExtraFileMethod)(f,"getFileType"))throw this.getErrorProvideNotSupport(E.scheme,"getFileType");return await f.getFileType(d)}async getCurrentUserHome(){return this.userHomeDeferred.promise}getErrorProvideNotSupport(d,E){return`Scheme ${d} not support this function: ${E}.`}convertUri(d){const E=new c.URI(d);if(!E.scheme)throw new Error(`Unsupported convert Uri with non-scheme Uri: ${d}`);return E}updateExcludeMatcher(){this.filesExcludes.forEach(d=>{this.workspaceRoots.length>0?this.workspaceRoots.forEach(E=>{const a=new c.URI(E).resolve(d).path.toString();this.filesExcludesMatcherList.push((0,c.parseGlob)(a))}):this.filesExcludesMatcherList.push((0,c.parseGlob)(d))})}async shouldWaitProvider(d){const E=await this._onWillActivateFileSystemProvider.fireAndAwait({scheme:d}),{result:f}=E[0];if(f&&f.includes(d)){const a=await c.Event.toPromise(c.Event.filter(this.onFileProviderChanged,b=>b.includes(d)));if(!(0,p.isUndefined)(a))return!0}return!1}async getProvider(d){this._providerChanged.has(d)&&(await this.eventBus.fireAndAwait(new c.ExtensionActivateEvent({topic:"onFileSystem",data:d}),{timeout:3e3}),this._providerChanged.delete(d));const E=this.fsProviders.get(d);if(!E)throw new Error(`Not find ${d} provider.`);return E}async isReadonly(d){try{const E=new c.URI(d);return!!(await(await this.getProvider(E.scheme)).stat(this.convertUri(d).codeUri)).readonly}catch{return!1}}isExclude(d){const E=new c.URI(d);return this.filesExcludesMatcherList.some(f=>f(E.path.toString()))}filterStat(d,E=!0){if(d&&!this.isExclude(d.uri))return d.children&&E&&(d.children=this.filterStatChildren(d.children)),d}filterStatChildren(d){const E=[];return d.forEach(f=>{if(this.isExclude(f.uri))return!1;const a=this.filterStat(f);a&&E.push(a)}),E}applyContentChanges(d,E){let f=r.TextDocument.create("","",1,d);for(const a of E){let b=a.text;if(a.range){const y=f.offsetAt(a.range.start),A=f.offsetAt(a.range.end);b=f.getText().substr(0,y)+a.text+f.getText().substr(A)}f=r.TextDocument.create(f.uri,f.languageId,f.version,b)}return f.getText()}async isInSync(d,E){return!!this.checkInSync(d,E)}checkInSync(d,E){return E.lastModification===d.lastModification&&E.size===d.size}createOutOfSyncError(d){return s.FileSystemError.FileIsOutOfSync(d.uri)}async doGetEncoding(d){return d&&typeof d.encoding<"u"?d.encoding:this.options.encoding}async doGetOverwrite(d){return d&&typeof d.overwrite<"u"?d.overwrite:this.options.overwrite}async doGetRecursive(d){return d&&typeof d.recursive<"u"?d.recursive:this.options.recursive}async doGetMoveToTrash(d){return d&&typeof d.moveToTrash<"u"?d.moveToTrash:this.options.moveToTrash}};t.FileServiceClient=h,n.__decorate([(0,o.Autowired)(s.IBrowserFileSystemRegistry),n.__metadata("design:type",l)],h.prototype,"registry",void 0),n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],h.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(p.IEventBus),n.__metadata("design:type",Object)],h.prototype,"eventBus",void 0),n.__decorate([(0,o.Autowired)(c.AppConfig),n.__metadata("design:type",Object)],h.prototype,"appConfig",void 0),n.__decorate([(0,o.Autowired)(m.IApplicationService),n.__metadata("design:type",Object)],h.prototype,"applicationService",void 0),t.FileServiceClient=h=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],h)},69037:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileServiceContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(42933),p=e(2156);let v=class{constructor(){this._disposables=new o.DisposableStore,this._disposables.add(this.fileSystem.registerProvider(o.Schemes.file,this.diskFileServiceProvider))}async initialize(){const _=this.contributionProvider.getContributions();await Promise.all(_.map(async s=>{s.registerProvider&&await s.registerProvider(this.fileSystem)})),await Promise.all(_.map(async s=>{s.onFileServiceReady&&await s.onFileServiceReady()})),this.fileSystem.initialize&&await this.fileSystem.initialize()}dispose(){this._disposables.dispose()}};t.FileServiceContribution=v,n.__decorate([(0,r.Autowired)(c.IFileServiceClient),n.__metadata("design:type",p.FileServiceClient)],v.prototype,"fileSystem",void 0),n.__decorate([(0,r.Autowired)(c.IDiskFileProvider),n.__metadata("design:type",Object)],v.prototype,"diskFileServiceProvider",void 0),n.__decorate([(0,r.Autowired)(o.FsProviderContribution),n.__metadata("design:type",Object)],v.prototype,"contributionProvider",void 0),t.FileServiceContribution=v=n.__decorate([(0,o.Domain)(o.ClientAppContribution),n.__metadata("design:paramtypes",[])],v)},60476:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiskFsProviderClient=t.CoreFileServiceProviderClient=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(42933);class p{constructor(){this.onDidChangeFileEmitter=new o.Emitter,this.onDidChangeFile=this.onDidChangeFileEmitter.event}watch(_,s){return this.fileServiceProvider.watch(_,s)}unwatch(_){return this.fileServiceProvider.unwatch&&this.fileServiceProvider.unwatch(_)}async stat(_){return await this.fileServiceProvider.stat(_)}readDirectory(_){return this.fileServiceProvider.readDirectory(_)}createDirectory(_){return this.fileServiceProvider.createDirectory(_)}async readFile(_,s){return s&&(0,o.getDebugLogger)("fileService.fsProvider").warn("encoding option for fsProvider.readFile is deprecated"),await this.fileServiceProvider.readFile(_)}readFileStream(_){if(this.fileServiceProvider.readFileStream)return this.fileServiceProvider.readFileStream(_);throw new Error("readFileStream not supported")}writeFile(_,s,g){return this.fileServiceProvider.writeFile(_,Array.from(s),g)}delete(_,s){return this.fileServiceProvider.delete(_,s)}rename(_,s,g){return this.fileServiceProvider.rename(_,s,g)}}t.CoreFileServiceProviderClient=p,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],p.prototype,"injector",void 0);let v=class extends p{constructor(){super(...arguments),this.onDidChangeCapabilities=o.Event.None}get capabilities(){return this._capabilities||(this._capabilities=12318,o.isLinux&&(this._capabilities|=1024)),this._capabilities}async initialize(_,s){var g,l;if(!((g=this.fileServiceProvider)===null||g===void 0)&&g.initialize)try{await((l=this.fileServiceProvider)===null||l===void 0?void 0:l.initialize(_,s))}catch(h){(0,o.getDebugLogger)("fileService.fsProvider").error("initialize error",h)}}setWatchFileExcludes(_){return this.fileServiceProvider.setWatchFileExcludes(_)}getWatchFileExcludes(){return this.fileServiceProvider.getWatchFileExcludes()}onDidFilesChanged(_){const s=_.changes.map(g=>({uri:g.uri,type:g.type}));this.onDidChangeFileEmitter.fire(s)}copy(_,s,g){return this.fileServiceProvider.copy(_,s,g)}access(_,s){return this.fileServiceProvider.access(_,s)}getCurrentUserHome(){return this.fileServiceProvider.getCurrentUserHome()}getFileType(_){return this.fileServiceProvider.getFileType(_)}};t.DiskFsProviderClient=v,n.__decorate([(0,r.Autowired)(c.DiskFileServicePath),n.__metadata("design:type",Object)],v.prototype,"fileServiceProvider",void 0),n.__decorate([(0,o.debounce)(100),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Array]),n.__metadata("design:returntype",void 0)],v.prototype,"setWatchFileExcludes",null),t.DiskFsProviderClient=v=n.__decorate([(0,r.Injectable)()],v)},96708:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileServiceClientModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(42933),p=e(70671),v=e(2156),m=e(69037),_=e(60476),s=e(23188);let g=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[{token:c.IFileServiceClient,useClass:v.FileServiceClient},{token:c.IBrowserFileSystemRegistry,useClass:v.BrowserFileSystemRegistryImpl},{token:c.IDiskFileProvider,useClass:_.DiskFsProviderClient},{token:c.IShadowFileProvider,useClass:s.ShadowFileSystemProvider},m.FileServiceContribution],this.backServices=[{servicePath:c.DiskFileServicePath,clientToken:c.IDiskFileProvider,protocol:p.DiskFileServiceProtocol}]}};t.FileServiceClientModule=g,t.FileServiceClientModule=g=n.__decorate([(0,r.Injectable)()],g)},23188:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShadowFileSystemProvider=void 0;const n=e(85608),r=e(76003),o=e(41869);let c=class{constructor(){this.capabilities=2048,this.onDidChangeCapabilities=o.Event.None,this.readonly=!0,this.shadowFiles=new Map,this.fileChangeEmitter=new o.Emitter,this.onDidChangeFile=this.fileChangeEmitter.event}unwatch(v){throw new Error("Method not implemented.")}readFileStream(v){throw new Error("Method not implemented.")}watch(v,m){throw new Error("Method not implemented.")}stat(v){return Promise.resolve({uri:v.toString(),lastModification:0})}readDirectory(v){throw new Error("Method not implemented.")}createDirectory(v){throw new Error("Method not implemented.")}readFile(v){return this.shadowFiles.get(v.toString())||o.BinaryBuffer.fromString("no available").buffer}writeFile(v,m,_){this.shadowFiles.set(v.toString(),m)}delete(v,m){throw new Error("Method not implemented.")}rename(v,m,_){throw new Error("Method not implemented.")}copy(v,m,_){throw new Error("Method not implemented.")}exists(v){throw new Error("Method not implemented.")}access(v,m){throw new Error("Method not implemented.")}};t.ShadowFileSystemProvider=c,t.ShadowFileSystemProvider=c=n.__decorate([(0,r.Injectable)()],c)},81952:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSystemWatcher=void 0;const n=e(43718);function r(c,p){return c.filter(v=>!!v.uri.startsWith(p))}class o{constructor(p){this.toDispose=new n.DisposableCollection,this.changeEmitter=new n.Emitter,this.toDispose.push(this.changeEmitter),this.fileServiceClient=p.fileServiceClient,this.watchId=p.watchId,this.uri=p.uri,this.fileServiceClient.onFilesChanged(v=>{const m=r(v,this.uri.toString());m&&m.length>0&&this.changeEmitter.fire(m)})}get onFilesChanged(){return this.changeEmitter.event}dispose(){return Promise.all([this.toDispose.dispose(),this.fileServiceClient.unwatchFileChanges(this.watchId)])}isDisposed(){return this.toDispose.disposed}}t.FileSystemWatcher=o},91813:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EXT_LIST_TEXT=t.EXT_LIST_IMAGE=t.EXT_LIST_VIDEO=void 0,t.getFileTypeByExt=e,t.EXT_LIST_VIDEO=new Set(["mp4","webm","mkv","mov","mts","flv","avi","wmv"]),t.EXT_LIST_IMAGE=new Set(["png","gif","jpg","jpeg","svg","bmp","avif","cr2","cr3","dng","flif","heic","icns","jxl","jpm","jpx","nef","raf","rw2","tif","orf","webp","apng"]),t.EXT_LIST_TEXT=new Set(["xml"]);function e(n){let r="text";return n&&(t.EXT_LIST_IMAGE.has(n)?r="image":t.EXT_LIST_VIDEO.has(n)?r="video":t.EXT_LIST_TEXT.has(n)?r="text":r="binary"),r}},79929:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IBrowserFileSystemRegistry=t.IFileServiceClient=void 0;const n=e(43718);t.IFileServiceClient=n.IFileServiceClient,t.IBrowserFileSystemRegistry=Symbol("IBrowserFileSystemRegistry")},49818:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSystemError=t.FileOperationError=t.FileSystemProviderError=t.FileSystemProviderErrorCode=t.FileAccess=t.IFileService=t.IShadowFileProvider=t.IDiskFileProvider=t.FileStat=t.FileType=void 0,t.createFileSystemProviderError=_,t.markAsFileSystemProviderError=s,t.containsExtraFileMethod=l,t.notEmpty=h,t.isErrnoException=u,t.handleError=d;const n=e(85608),r=e(43718);var o=e(31036);Object.defineProperty(t,"FileType",{enumerable:!0,get:function(){return o.FileType}}),Object.defineProperty(t,"FileStat",{enumerable:!0,get:function(){return o.FileStat}}),n.__exportStar(e(11854),t),t.IDiskFileProvider=Symbol("IDiskFileProvider"),t.IShadowFileProvider=Symbol("IShadowFileProvider"),t.IFileService=Symbol("IFileService");var c;(function(E){let f;(function(a){a.F_OK=0,a.R_OK=4,a.W_OK=2,a.X_OK=1})(f=E.Constants||(E.Constants={}))})(c||(t.FileAccess=c={}));var p;(function(E){E.FileExists="EntryExists",E.FileNotFound="EntryNotFound",E.FileNotADirectory="EntryNotADirectory",E.FileIsADirectory="EntryIsADirectory",E.FileIsOutOfSync="FileIsOutOfSync",E.FileExceedsMemoryLimit="EntryExceedsMemoryLimit",E.FileTooLarge="EntryTooLarge",E.FileWriteLocked="EntryWriteLocked",E.NoPermissions="NoPermissions",E.Unavailable="Unavailable",E.Unknown="Unknown"})(p||(t.FileSystemProviderErrorCode=p={}));class v extends Error{static declare(f,a){return Object.assign((...b)=>_(a(...b),f),{is:b=>{var y;return(y=b.stack)===null||y===void 0?void 0:y.startsWith(f)}})}constructor(f,a){super(f),this.code=a}is(f){return this.name===f.name}}t.FileSystemProviderError=v;class m extends Error{constructor(f,a,b){super(f),this.fileOperationResult=a,this.options=b}static isFileOperationError(f){return f instanceof Error&&!(0,r.isUndefinedOrNull)(f.fileOperationResult)}}t.FileOperationError=m;function _(E,f){const a=new v(E.toString(),f);return s(a,f),a}function s(E,f){return E.name=f?`${f} (FileSystemError)`:"FileSystemError",E}var g;(function(E){E.FileNotFound=v.declare(p.FileNotFound,(f,a)=>`${a?a+" ":""} '${f}' is not found.`),E.FileExists=v.declare(p.FileExists,(f,a)=>`${a?a+" ":""}'${f}' already exists.`),E.FileNotADirectory=v.declare(p.FileNotADirectory,(f,a)=>`${a?a+" ":""}'${f}' is not a directory.`),E.FileIsADirectory=v.declare(p.FileIsADirectory,(f,a)=>`${a?a+" ":""}'${f}' is a directory.`),E.FileIsOutOfSync=v.declare(p.FileIsOutOfSync,(f,a)=>`${a?a+" ":""}'${f}' is out of sync.`),E.FileExceedsMemoryLimit=v.declare(p.FileExceedsMemoryLimit,(f,a)=>`${a?a+" ":""}'${f}' is exceeds memory limit.`),E.FileTooLarge=v.declare(p.FileTooLarge,(f,a)=>`${a?a+" ":""}'${f}' is too large.`),E.FileWriteLocked=v.declare(p.FileWriteLocked,(f,a)=>`${a?a+" ":""}'${f}' is locked.`),E.FileIsNoPermissions=v.declare(p.NoPermissions,(f,a)=>`${a?a+" ":""}'${f}' is no permissions.`),E.Unavailable=v.declare(p.Unavailable,(f,a)=>`${a?a+" ":""}'${f}' is unavailable.`),E.Unknown=v.declare(p.Unknown,(f,a)=>`${a?a+" ":""}'${f}' is unkonw.`)})(g||(t.FileSystemError=g={}));function l(E,f){return(0,r.hasProperty)(E,f)&&(0,r.isFunction)(E[f])}function h(E){return E!==void 0}function u(E){return E.code!==void 0&&E.errno!==void 0}function d(E){var f,a,b,y,A;if(u(E))switch(E.code){case"EEXIST":throw g.FileExists(r.Uri.file((f=E.path)!==null&&f!==void 0?f:""));case"EPERM":case"EACCESS":throw g.FileIsNoPermissions(r.Uri.file((a=E.path)!==null&&a!==void 0?a:""));case"ENOENT":throw g.FileNotFound(r.Uri.file((b=E.path)!==null&&b!==void 0?b:""));case"ENOTDIR":throw g.FileNotADirectory(r.Uri.file((y=E.path)!==null&&y!==void 0?y:""));case"EISDIR":throw g.FileIsADirectory(r.Uri.file((A=E.path)!==null&&A!==void 0?A:""))}throw E}},42933:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(79929),t),n.__exportStar(e(49818),t),n.__exportStar(e(28217),t),n.__exportStar(e(91813),t),n.__exportStar(e(50295),t)},70671:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiskFileServiceProtocol=void 0;const n=e(26387),r=e(52890),o=e(50295);t.DiskFileServiceProtocol={name:o.DiskFileServicePath,methods:[{method:"readFile",request:[{name:"uri",type:r.UriComponentsProto}],response:{type:n.Type.binary()}}]}},50295:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileExtServicePath=t.FileWatcherServicePath=t.ShadowFileServicePath=t.DiskFileServicePath=t.FileServicePath=void 0,t.FileServicePath="FileService",t.DiskFileServicePath="DiskFileService",t.ShadowFileServicePath="ShadowFileService",t.FileWatcherServicePath="FileWatcherService",t.FileExtServicePath="FileExtServicePath"},28217:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WatcherProcessManagerProxy=t.WatcherServiceProxy=t.WATCHER_INIT_DATA_KEY=t.SUMI_WATCHER_PROCESS_SOCK_KEY=t.INsfw=void 0;const n=e(86058);var r;(function(o){let c;(function(p){p[p.CREATED=0]="CREATED",p[p.DELETED=1]="DELETED",p[p.MODIFIED=2]="MODIFIED",p[p.RENAMED=3]="RENAMED"})(c=o.actions||(o.actions={}))})(r||(t.INsfw=r={})),t.SUMI_WATCHER_PROCESS_SOCK_KEY="sumi-watcher-process-sock",t.WATCHER_INIT_DATA_KEY="sumi-watcher-init-data",t.WatcherServiceProxy=new n.ProxyIdentifier("WatcherHostServiceImpl"),t.WatcherProcessManagerProxy=new n.ProxyIdentifier("WatcherProcessManagerProxy")},14951:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(42933),t)},57942:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeDialogModel=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(26542),m=e(6250),_=e(2812),s=r.__importDefault(e(89200)),g=e(9018);let l=n=class{static createContainer(u,d){return u.createChild([{token:m.IFileDialogTreeService,useValue:d},{token:m.IFileDialogModel,useClass:n}])}static createModel(u,d){return n.createContainer(u,d).get(m.IFileDialogModel)}constructor(){this.selectedDecoration=new c.Decoration(s.default.mod_selected),this.focusedDecoration=new c.Decoration(s.default.mod_focused),this.loadingDecoration=new c.Decoration(s.default.mod_loading),this.cutDecoration=new c.Decoration(s.default.mod_cut),this._selectedFiles=[],this.disposableCollection=new p.DisposableCollection,this.onDidFocusedFileChangeEmitter=new p.Emitter,this.onDidSelectedFileChangeEmitter=new p.Emitter,this.clearFileSelectedDecoration=()=>{this._selectedFiles.forEach(u=>{this.selectedDecoration.removeTarget(u)}),this._selectedFiles=[],this.onDidSelectedFileChangeEmitter.fire([])},this.activeFileDecoration=(u,d=!0)=>{u!==this.treeModel.root&&(this.preContextMenuFocusedFile&&(this.focusedDecoration.removeTarget(this.preContextMenuFocusedFile),this.selectedDecoration.removeTarget(this.preContextMenuFocusedFile),this.preContextMenuFocusedFile=null),u&&(this.selectedFiles.length>0&&this.selectedFiles.forEach(E=>{this.selectedDecoration.removeTarget(E)}),this.focusedFile&&this.focusedDecoration.removeTarget(this.focusedFile),this.selectedDecoration.addTarget(u),this.focusedDecoration.addTarget(u),this._focusedFile=u,this._selectedFiles=[u],this.onDidFocusedFileChangeEmitter.fire(u.uri),this.onDidSelectedFileChangeEmitter.fire([u.uri]),d&&this.treeModel.dispatchChange()))},this.selectFileDecoration=(u,d=!0)=>{u!==this.treeModel.root&&(this.preContextMenuFocusedFile&&(this.focusedDecoration.removeTarget(this.preContextMenuFocusedFile),this.selectedDecoration.removeTarget(this.preContextMenuFocusedFile),this.preContextMenuFocusedFile=null),u&&(this.selectedFiles.length>0&&this.selectedFiles.forEach(E=>{this.selectedDecoration.removeTarget(E)}),this.focusedFile&&this.focusedDecoration.removeTarget(this.focusedFile),this.selectedDecoration.addTarget(u),this._selectedFiles=[u],this.onDidSelectedFileChangeEmitter.fire([u.uri]),d&&this.treeModel.dispatchChange()))},this.activeFileFocusedDecoration=(u,d=!1)=>{u!==this.treeModel.root&&(this.focusedFile!==u&&(d?(this.preContextMenuFocusedFile?(this.focusedDecoration.removeTarget(this.preContextMenuFocusedFile),this.selectedDecoration.removeTarget(this.preContextMenuFocusedFile)):this.focusedFile&&this.focusedDecoration.removeTarget(this.focusedFile),this.preContextMenuFocusedFile=u):this.focusedFile&&(this.preContextMenuFocusedFile=null,this.focusedDecoration.removeTarget(this.focusedFile)),u&&(this.selectedDecoration.addTarget(u),this.focusedDecoration.addTarget(u),this._focusedFile=u,this._selectedFiles.push(u),this.onDidFocusedFileChangeEmitter.fire(u.uri),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(E=>E.uri)))),this.treeModel.dispatchChange())},this.activeFileSelectedDecoration=u=>{this._selectedFiles.indexOf(u)>-1||(this._selectedFiles.push(u),this.selectedDecoration.addTarget(u),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(d=>d.uri)),this.treeModel.dispatchChange())},this.activeFileDecorationByRange=(u,d)=>{for(this.clearFileSelectedDecoration(),this.preContextMenuFocusedFile=null;u<=d;u++){const E=this.treeModel.root.getTreeNodeAtIndex(u);E&&(this._selectedFiles.push(E),this.selectedDecoration.addTarget(E))}this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(E=>E.uri)),this.treeModel.dispatchChange()},this.enactiveFileDecoration=()=>{this.focusedFile&&(this.focusedDecoration.removeTarget(this.focusedFile),this.onDidFocusedFileChangeEmitter.fire(),this.treeModel.dispatchChange()),this._focusedFile=void 0},this.toggleDirectory=async u=>{u.expanded?this.fileTreeHandle.collapseNode(u):this.fileTreeHandle.expandNode(u)},this.handleTreeBlur=()=>{this.enactiveFileDecoration()},this.handleTreeFocus=()=>{},this.handleItemRangeClick=(u,d)=>{if(!this.focusedFile)this.handleItemClick(u,d);else if(this.focusedFile&&this.focusedFile!==u){const E=this.treeModel.root.getIndexAtTreeNode(u),f=this.treeModel.root.getIndexAtTreeNode(this.focusedFile);f>E?this.activeFileDecorationByRange(E,f):f<E&&this.activeFileDecorationByRange(f,E)}},this.handleItemToggleClick=(u,d)=>{d!==c.TreeNodeType.CompositeTreeNode&&d!==c.TreeNodeType.TreeNode||(this.selectedFiles.indexOf(u)>-1?this.focusedFile===u?this.enactiveFileDecoration():this.activeFileFocusedDecoration(u):this.activeFileSelectedDecoration(u))},this.handleItemClick=(u,d)=>{this.clickTimes++,(d===c.TreeNodeType.CompositeTreeNode||d===c.TreeNodeType.TreeNode)&&this.activeFileDecoration(u),d===c.TreeNodeType.CompositeTreeNode&&this.corePreferences["workbench.list.openMode"]==="singleClick"&&this.toggleDirectory(u),this.clickTimer&&clearTimeout(this.clickTimer),this.clickTimer=setTimeout(()=>{this.clickTimes>1&&d!==c.TreeNodeType.TreeNode&&this.corePreferences["workbench.list.openMode"]==="doubleClick"&&this.toggleDirectory(u),this.clickTimes=0},200)},this.getDirectoryList=()=>this.fileTreeDialogService.getDirectoryList(),this._whenReady=this.initTreeModel()}get onDidFocusedFileChange(){return this.onDidFocusedFileChangeEmitter.event}get onDidSelectedFileChange(){return this.onDidSelectedFileChangeEmitter.event}get fileTreeHandle(){return this._fileTreeHandle}get decorations(){return this._decorations}get treeModel(){return this._treeModel}get whenReady(){return this._whenReady}get focusedFile(){return this._focusedFile}get selectedFiles(){return this._selectedFiles}async initTreeModel(){const u=(await this.fileTreeDialogService.resolveChildren())[0];this._treeModel=this.injector.get(_.FileTreeModel,[u]),this.initDecorations(u),this.disposableCollection.push(this._decorations),this.disposableCollection.push(this.labelService.onDidChange(()=>{this.treeModel.dispatchChange()})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.WillResolveChildren,d=>{this.loadingDecoration.addTarget(d)})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.DidResolveChildren,d=>{this.loadingDecoration.removeTarget(d)}))}async updateTreeModel(u){const d=await this.fileTreeDialogService.resolveRoot(u);if(d&&d.length>0){const E=d[0];this._treeModel=this.injector.get(_.FileTreeModel,[E]),this.clearFileSelectedDecoration(),this.initDecorations(E)}}initDecorations(u){this._decorations&&this._decorations.dispose(),this._decorations=new c.DecorationsManager(u),this._decorations.addDecoration(this.selectedDecoration),this._decorations.addDecoration(this.focusedDecoration),this._decorations.addDecoration(this.cutDecoration),this._decorations.addDecoration(this.loadingDecoration)}handleTreeHandler(u){this._fileTreeHandle=u}dispose(){this.disposableCollection.dispose()}};t.FileTreeDialogModel=l,l.FILE_TREE_SNAPSHOT_KEY="FILE_TREE_SNAPSHOT",l.DEFAULT_LOCATION_FLUSH_DELAY=500,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],l.prototype,"injector",void 0),r.__decorate([(0,o.Autowired)(m.IFileDialogTreeService),r.__metadata("design:type",g.FileTreeDialogService)],l.prototype,"fileTreeDialogService",void 0),r.__decorate([(0,o.Autowired)(v.LabelService),r.__metadata("design:type",v.LabelService)],l.prototype,"labelService",void 0),r.__decorate([(0,o.Autowired)(p.CorePreferences),r.__metadata("design:type",Object)],l.prototype,"corePreferences",void 0),t.FileTreeDialogModel=l=n=r.__decorate([(0,o.Injectable)(),r.__metadata("design:paramtypes",[])],l)},69748:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FILE_TREE_BADGE_LIMIT=t.FILE_TREE_NODE_HEIGHT=t.FileTreeDialogNode=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(97267),p=e(41869),v=e(69959),m=n.__importDefault(e(89200)),_=({item:s,onClick:g,itemType:l,labelService:h,leftPadding:u=8,onTwistierClick:d,decorations:E,defaultLeftPadding:f=8,template:a})=>{const b=l===c.TreeNodeType.RenamePrompt,y=l===c.TreeNodeType.NewPrompt,A=b||y,S=(0,p.useDesignStyles)(m.default.expansion_toggle,"expansion_toggle"),w=(0,p.useDesignStyles)(m.default.file_tree_node,"file_tree_node"),T=W=>{(l===c.TreeNodeType.TreeNode||l===c.TreeNodeType.CompositeTreeNode)&&g(W,s,l)},D=W=>{(l===c.TreeNodeType.TreeNode||l===c.TreeNodeType.CompositeTreeNode)&&(d?d(W,s,l):g(W,s,l))},I=l===c.TreeNodeType.CompositeTreeNode;let R;A?y?R=`${f+(s.parent.depth+1||0)*(u||0)}px`:R=`${f+(s.target.depth||0)*(u||0)}px`:R=I?`${f+(s.depth||0)*(u||0)}px`:`${f+(s.depth||0)*(u||0)+8}px`;const M={height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`,paddingLeft:R},O=(W,U)=>{if(E&&E?.classlist.indexOf(m.default.mod_loading)>-1)return o.default.createElement(c.Loading,null);if(A&&W instanceof c.PromptHandle){let Q=!1;if(b?Q=W.target.type===c.TreeNodeType.CompositeTreeNode:Q=W.type===c.TreeNodeType.CompositeTreeNode,Q)return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,S,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:y||!(b&&W.target.type===c.TreeNodeType.CompositeTreeNode&&W.target.expanded)})})}else return o.default.createElement("div",{onClick:U,className:(0,r.default)(m.default.file_tree_node_segment,S,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:!W.expanded})})},P=W=>{let U,Q;A&&W instanceof c.PromptHandle?W instanceof c.RenamePromptHandle?(U=W.target.uri.resolve(W.$.value),Q=v.Directory.is(W.target)):(U=W.parent.uri.resolve(W.$.value),Q=W.type===c.TreeNodeType.CompositeTreeNode):(U=W.uri,Q=W.filestat.isDirectory);const V=h.getIcon(U,{isDirectory:Q});return o.default.createElement("div",{className:(0,r.default)(m.default.file_icon,V,{expanded:Q&&W.expanded}),style:{height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`}})},k=W=>a?o.default.createElement(a,null):A&&W instanceof c.PromptHandle?o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_inputbox)},o.default.createElement("div",{className:(0,r.default)("input-box",m.default.file_tree_node_prompt_box)},o.default.createElement(W.ProxiedInput,{wrapperStyle:{height:t.FILE_TREE_NODE_HEIGHT,padding:"0 5px"}}))):o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_displayname)},W.name),F=()=>o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_tail)},L()),L=()=>null,B=W=>{if(I)return O(W,D);if(A)return O(W,()=>{})},j=()=>s.tooltip||s.name;return o.default.createElement("div",{key:s.id,onClick:T,title:j(),className:(0,r.default)(w,E?E.classlist:null),style:M,draggable:l===c.TreeNodeType.TreeNode||l===c.TreeNodeType.CompositeTreeNode},o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_content)},B(s),P(s),o.default.createElement("div",{className:A?m.default.file_tree_node_prompt_wrap:m.default.file_tree_node_overflow_wrap},k(s)),F()))};t.FileTreeDialogNode=_,t.FILE_TREE_NODE_HEIGHT=22,t.FILE_TREE_BADGE_LIMIT=99},68195:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDialogContextKey=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(66e3);let p=class{initScopedContext(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.fileDialogViewVisibleContext=c.FileDialogViewVisibleContext.bind(this._contextKeyService)}get service(){return this._contextKeyService}};t.FileDialogContextKey=p,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],p.prototype,"globalContextKeyService",void 0),t.FileDialogContextKey=p=n.__decorate([(0,r.Injectable)()],p)},9018:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeDialogService=void 0;const n=e(85608),r=e(76003),o=e(97267),c=e(41869),p=e(26542),v=e(54414),m=e(14951),_=e(72665),s=e(51500),g=e(6250),l=e(57781),h=e(97738),u=e(68195);let d=class extends o.Tree{constructor(f){super(),this._whenReady=this.resolveWorkspaceRoot(f)}get whenReady(){return this._whenReady}async resolveWorkspaceRoot(f){if(f){const a=new c.URI(f).withScheme(c.Schemes.file),b=await this.fileTreeAPI.resolveFileStat(a);b&&(this.workspaceRoot=b)}}async resolveChildren(f){if(f){if(f.uri){const{children:a}=await this.fileTreeAPI.resolveChildren(this,f.uri.toString(),f);return a}}else{this.workspaceRoot||(this.workspaceRoot=(await this.workspaceService.roots)[0]);const{children:a}=await this.fileTreeAPI.resolveChildren(this,this.workspaceRoot);return this.root=a[0],a}return[]}async resolveRoot(f){let a;/^file:\/\//.test(f)&&(a=new c.URI(f)),a=c.URI.file(f);const b=await this.fileTreeAPI.resolveFileStat(a);if(b){const{children:y}=await this.fileTreeAPI.resolveChildren(this,b);return this.root=y[0],y}}getDirectoryList(){const f=[];if(!this.root)return f;let a=new c.URI(this.workspaceRoot.uri);if(a&&a.parent)for(;a.parent;){const b=a.codeUri.fsPath;if(f.indexOf(b)>=0)break;f.push(b),a=a.parent}else f.push(a.codeUri.fsPath.toString());return f}sortComparator(f,a){return f.constructor===a.constructor?f.name.startsWith(".")&&!a.name.startsWith(".")?1:!f.name.startsWith(".")&&a.name.startsWith(".")?-1:f.name.localeCompare(a.name,"kn",{numeric:!0}):f.type===o.TreeNodeType.CompositeTreeNode?-1:a.type===o.TreeNodeType.CompositeTreeNode?1:0}initContextKey(f){f&&this.fileDialogContextKey.initScopedContext(f)}get contextKey(){return this.fileDialogContextKey}async saveAs(f){const{oldFilePath:a,newFilePath:b}=f;if(!a||!b)throw new Error("oldFilePath and newFilePath are required");await this.createFile(f);try{const y=c.URI.file(f.newFilePath),A={preview:!1,focus:!0,replace:!0,forceClose:!0,disableNavigate:!1};await this.workbenchEditorService.open(y,A),await this.fileTreeModelService.clearFileSelectedDecoration();const S=this.fileTreeService.getNodeByPathOrUri(y);S&&await this.fileTreeModelService.activeFileDecoration(S)}catch(y){throw new Error(`Failed to open saveAs file: ${y.message}`)}}async createFile(f){try{const{oldFilePath:a,newFilePath:b}=f;if(!await this.fileServiceClient.getFileStat(a))throw new Error(`Source file not found: ${a}`);const{content:A}=await this.fileServiceClient.readFile(a);await this.fileServiceClient.createFile(b,{content:A.toString(),encoding:"utf8",overwrite:!0})}catch(a){throw new Error(`Failed to create file: ${a.message}`)}}renderCustomMsg(){return null}async getDefaultFilePath(f,a){return a}dispose(){super.dispose()}};t.FileTreeDialogService=d,n.__decorate([(0,r.Autowired)(g.IFileTreeAPI),n.__metadata("design:type",Object)],d.prototype,"fileTreeAPI",void 0),n.__decorate([(0,r.Autowired)(s.IWorkspaceService),n.__metadata("design:type",Object)],d.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(p.LabelService),n.__metadata("design:type",p.LabelService)],d.prototype,"labelService",void 0),n.__decorate([(0,r.Autowired)(u.FileDialogContextKey),n.__metadata("design:type",u.FileDialogContextKey)],d.prototype,"fileDialogContextKey",void 0),n.__decorate([(0,r.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],d.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(v.WorkbenchEditorService),n.__metadata("design:type",v.WorkbenchEditorService)],d.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(_.IDialogService),n.__metadata("design:type",Object)],d.prototype,"dialogService",void 0),n.__decorate([(0,r.Autowired)(h.FileTreeModelService),n.__metadata("design:type",h.FileTreeModelService)],d.prototype,"fileTreeModelService",void 0),n.__decorate([(0,r.Autowired)(g.IFileTreeService),n.__metadata("design:type",l.FileTreeService)],d.prototype,"fileTreeService",void 0),t.FileTreeDialogService=d=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__param(0,(0,r.Optional)()),n.__metadata("design:paramtypes",[String])],d)},51888:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDialog=t.FILE_TREE_DIALOG_HEIGHT=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),c=e(41869),p=e(68974),v=e(72665),m=e(69748),_=n.__importDefault(e(13294));t.FILE_TREE_DIALOG_HEIGHT=22;const s=({options:g,model:l,isOpenDialog:h,fileService:u})=>{const d=(0,c.useInjectable)(v.IDialogService),E=(0,r.useRef)(null),[f,a]=(0,r.useState)(g.defaultFileName||""),[b,y]=(0,r.useState)(!1),[A,S]=(0,r.useState)(""),[w,T]=(0,r.useState)([]),D=(0,r.useRef)(g.defaultFileName||"");(0,r.useEffect)(()=>{var oe;return l&&(y(!1),O(),(oe=u.contextKey.fileDialogViewVisibleContext)===null||oe===void 0||oe.set(!0)),()=>{l.dispose()}},[l]),(0,r.useEffect)(()=>{g.defaultFileName&&(a(g.defaultFileName||""),D.current=g.defaultFileName||"")},[g]),(0,r.useEffect)(()=>{if(b){const oe=l.getDirectoryList();T(oe)}},[b]);const I=(0,r.useCallback)(()=>{const oe=l.selectedFiles.map(ne=>ne.uri.path.toString());if(D.current&&g.showNameInput&&(oe?.length===1||g.defaultUri)){const ne=oe?.length===1?oe[0]:g.defaultUri.path.toString();g?.saveAs&&u.saveAs({oldFilePath:c.path.join(ne,g?.defaultFileName||""),newFilePath:c.path.join(ne,D.current)}),d.hide([c.path.join(ne,D.current)])}else oe.length>0?d.hide(oe):A?d.hide([A]):g.defaultUri?d.hide([g.defaultUri.path.toString()]):l.treeModel&&l.treeModel.root?d.hide([l.treeModel.root.uri.path.toString()]):d.hide([]);y(!1),u.contextKey.fileDialogViewVisibleContext.set(!1)},[b,d,l,g,A]),R=async oe=>{let ne=oe.treeModel.root.uri.codeUri.fsPath;return u.getDefaultFilePath&&(ne=await u.getDefaultFilePath(oe,ne)),ne},M=(0,r.useCallback)(()=>{y(!1),d.hide(),u.contextKey.fileDialogViewVisibleContext.set(!1)},[b,d]),O=(0,r.useCallback)(async()=>{await l.whenReady,await l.treeModel.ensureReady;const oe=await R(l);S(oe),y(!0)},[l,A,b]),P=!h,k=(0,r.useCallback)(oe=>{l.handleTreeHandler({...oe,getModel:()=>l.treeModel})},[l]),F=(0,r.useCallback)((oe,ne)=>{oe.stopPropagation();const{toggleDirectory:ue}=l;ue(ne)},[l]),L=(0,r.useCallback)(oe=>B(oe)?!1:oe.shiftKey,[]),B=(0,r.useCallback)(oe=>{const{metaKey:ne,ctrlKey:ue}=oe;return c.isMacintosh&&ne||ue},[]),j=(0,r.useCallback)((oe,ne,ue)=>{var fe;oe.stopPropagation();const{handleItemClick:q,handleItemToggleClick:Ae,handleItemRangeClick:pe}=l;if(!ne)return;const ie=L(event),ge=B(event);if(ie&&!P&&g.canSelectMany)pe(ne,ue);else if(ge&&!P&&g.canSelectMany)Ae(ne,ue);else if(P)ue===o.TreeNodeType.CompositeTreeNode&&q(ne,ue);else if(g.canSelectFiles&&ue===o.TreeNodeType.TreeNode){const Ie=new Set(Object.values((fe=g.filters)!==null&&fe!==void 0?fe:{}).flat().map(Pe=>`.${Pe}`));if(Ie.size>0){const Pe=c.URI.parse(ne.filestat.uri).path.ext;Ie.has(Pe)&&q(ne,ue)}else q(ne,ue)}else g.canSelectFolders&&ue===o.TreeNodeType.CompositeTreeNode&&q(ne,ue)},[l,P,g]),W=(0,r.useCallback)(async oe=>{y(!1),S(oe),await l.updateTreeModel(oe),y(!0)},[l,b,A]),U=(0,r.useCallback)(async oe=>{y(!1),S(oe),await l.updateTreeModel(oe),y(!0)},[l,b,A,w]),Q=(0,r.useCallback)(()=>u.renderCustomMsg?u.renderCustomMsg():null,[u.renderCustomMsg]),V=(0,r.useCallback)(oe=>r.default.createElement(m.FileTreeDialogNode,{item:oe.item,itemType:oe.itemType,labelService:l.labelService,decorations:l.decorations.getDecorations(oe.item),onClick:j,onTwistierClick:F,defaultLeftPadding:8,leftPadding:8}),[l.treeModel]),$=(0,r.useCallback)(()=>{if(b){if(l.treeModel)return r.default.createElement(o.RecycleTree,{height:300,itemHeight:t.FILE_TREE_DIALOG_HEIGHT,onReady:k,model:l.treeModel},V)}else return r.default.createElement(p.Progress,{loading:!0})},[b,l]),Y=(0,r.useMemo)(()=>u.showFilePathSearch!==!1,[u.showFilePathSearch]),G=(0,r.useCallback)(()=>{if(w.length>0)return r.default.createElement(o.Select,{onChange:W,onSearchChange:U,className:_.default.select_control,size:"large",searchPlaceholder:A,value:A,showSearch:Y},w.map((oe,ne)=>r.default.createElement(o.Option,{value:oe,key:`${ne} - ${oe}`},oe)))},[w,A]),z=(0,r.useCallback)(oe=>{const{key:ne}=c.KeyCode.createKeyCode(oe),ue=oe.shiftKey||oe.metaKey||oe.altKey||oe.ctrlKey;ne&&c.Key.ENTER.keyCode===ne.keyCode&&!ue&&I()},[I]);(0,r.useEffect)(()=>{var oe;return E.current&&(u.initContextKey(E.current),u.contextKey.fileDialogViewVisibleContext.set(!0),(oe=E.current)===null||oe===void 0||oe.addEventListener("keyup",z)),()=>{var ne;(ne=E.current)===null||ne===void 0||ne.removeEventListener("keyup",z)}},[]);const K=(0,r.useMemo)(()=>r.default.createElement(r.default.Fragment,null,Q(),r.default.createElement("div",{className:_.default.file_dialog_directory},G()),r.default.createElement("div",{className:_.default.file_dialog_content},$())),[G,$]),Z=(0,r.useMemo)(()=>r.default.createElement("div",{className:_.default.file_dialog_buttons},r.default.createElement(o.Button,{onClick:M,type:"ghost",className:_.default.button},(0,c.localize)("dialog.file.close")),r.default.createElement(o.Button,{onClick:I,type:"primary",className:_.default.button,disabled:P&&g.showNameInput&&f.length===0},h&&g.openLabel||(0,c.localize)("dialog.file.ok"))),[M,I,P,h,f,g]),X=(0,r.useCallback)(oe=>{a(oe.target.value),D.current=oe.target.value},[f]);return r.default.createElement("div",{className:_.default.file_dialog_wrapper,ref:E},r.default.createElement("div",{className:_.default.file_dialog_directory_title},h?g.title||(0,c.localize)("dialog.file.openLabel"):g.saveLabel||(0,c.localize)("dialog.file.saveLabel")),K,!h&&g.showNameInput&&r.default.createElement("div",{className:_.default.file_dialog_file_container},r.default.createElement("span",{className:_.default.file_dialog_file_name},(0,c.localize)("dialog.file.name"),": "),r.default.createElement(o.Input,{size:"small",value:f,autoFocus:!0,selection:{start:0,end:f.indexOf(".")||f.length},onChange:X})),Z)};t.FileDialog=s},89508:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WindowDialogServiceImpl=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(76003),c=e(41869),p=e(37406),v=e(14951),m=e(72665),_=e(57942),s=n.__importDefault(e(13294)),g=e(9018),l=e(51888);let h=class{constructor(){this.idx=1,this._whenReady=this.init()}async init(){this.recentGlobalStorage=await this.storageProvider(c.STORAGE_NAMESPACE.GLOBAL_RECENT_DATA);const d=await this.recentGlobalStorage.get("RECENT_DIALOG_DEFAULT_URI");if(d)this._defaultUri=new c.URI(d);else{const E=await this.fileServiceClient.getCurrentUserHome();this._defaultUri=new c.URI(E.uri)}}get defaultUri(){return this._defaultUri}get whenReady(){return this._whenReady}async updateRecentDefaultUri(d){this.recentGlobalStorage.set("RECENT_DIALOG_DEFAULT_URI",d.toString()),this._defaultUri=d}async showOpenDialog(d={}){this.dialogService.reset(),await this.whenReady;const E={canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1};if(this.appConfig.isElectronRenderer&&!this.appConfig.isRemote){const f=this.injector.get(p.IElectronMainUIService),a=[];d.canSelectFiles&&a.push("openFile"),d.canSelectFolders&&a.push("openDirectory"),d.canSelectMany&&a.push("multiSelections"),c.isMacintosh&&a.push("treatPackageAsDirectory","createDirectory");const b=d.defaultUri||this.defaultUri,y=await f.showOpenDialog(c.electronEnv.currentWindowId,{defaultPath:b.codeUri.fsPath,title:d.title,buttonLabel:d.openLabel,properties:a});if(y&&y.length>0){const A=y.map(S=>c.URI.file(S));return this.updateRecentDefaultUri(A[0].parent),A}else return}else{d.defaultUri||(d.defaultUri=this.defaultUri);let f;d.defaultUri?f=this.injector.get(g.FileTreeDialogService,[d.defaultUri.toString()]):f=this.injector.get(g.FileTreeDialogService),await f.whenReady;const a=_.FileTreeDialogModel.createModel(this.injector,f),b=await this.dialogService.open({message:r.default.createElement(l.FileDialog,{key:this.idx++,fileService:f,model:a,options:{...E,...d},isOpenDialog:!0}),type:c.MessageType.Empty,buttons:[],closable:!0,props:{className:s.default.file_dialog_wrapper}});if(this.dialogService.reset(),b&&b.length>0){const y=b.map(A=>c.URI.file(A));return this.updateRecentDefaultUri(y[0].parent),y}else return}}async showSaveDialog(d={}){if(await this.whenReady,this.appConfig.isElectronRenderer&&!this.appConfig.isRemote){const E=d.defaultUri||this.defaultUri,a=await this.injector.get(p.IElectronMainUIService).showSaveDialog(c.electronEnv.currentWindowId,{defaultPath:E.resolve(d.defaultFileName||"").codeUri.fsPath,title:d.saveLabel,message:d.saveLabel});if(a){const b=c.URI.file(a);return this.updateRecentDefaultUri(b.parent),b}else return}else{d.defaultUri||(d.defaultUri=this.defaultUri);let E;d.defaultUri?E=this.injector.get(g.FileTreeDialogService,[d.defaultUri.toString()]):E=this.injector.get(g.FileTreeDialogService),await E.whenReady;const f=_.FileTreeDialogModel.createModel(this.injector,E),a=await this.dialogService.open({message:r.default.createElement(l.FileDialog,{key:this.idx++,fileService:E,model:f,options:d,isOpenDialog:!1}),type:c.MessageType.Empty,buttons:[],closable:!0,props:{className:s.default.file_dialog_wrapper}});if(this.dialogService.reset(),a&&a.length>0){const b=c.URI.file(a[0]);return this.updateRecentDefaultUri(b.parent),b}else return}}};t.WindowDialogServiceImpl=h,n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],h.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(m.IDialogService),n.__metadata("design:type",Object)],h.prototype,"dialogService",void 0),n.__decorate([(0,o.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],h.prototype,"fileServiceClient",void 0),n.__decorate([(0,o.Autowired)(c.StorageProvider),n.__metadata("design:type",Function)],h.prototype,"storageProvider",void 0),n.__decorate([(0,o.Autowired)(c.AppConfig),n.__metadata("design:type",Object)],h.prototype,"appConfig",void 0),t.WindowDialogServiceImpl=h=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],h)},88014:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileContextKey=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(16413);let p=class{constructor(){this.explorerResourceIsFolder=c.ExplorerResourceIsFolderContext.bind(this.globalContextKeyService),this.explorerViewletVisibleContext=c.ExplorerViewletVisibleContext.bind(this.globalContextKeyService)}initScopedContext(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.explorerFocused=c.ExplorerFocusedContext.bind(this._contextKeyService),this.explorerResourceCut=c.ExplorerResourceCut.bind(this._contextKeyService),this.filesExplorerFocused=c.FilesExplorerFocusedContext.bind(this._contextKeyService),this.filesExplorerInputFocused=c.FilesExplorerInputFocusedContext.bind(this._contextKeyService),this.filesExplorerFilteredContext=c.FilesExplorerFilteredContext.bind(this._contextKeyService),this.explorerCompressedFocusContext=c.ExplorerCompressedFocusContext.bind(this._contextKeyService),this.explorerCompressedFirstFocusContext=c.ExplorerCompressedFirstFocusContext.bind(this._contextKeyService),this.explorerCompressedLastFocusContext=c.ExplorerCompressedLastFocusContext.bind(this._contextKeyService)}get service(){return this._contextKeyService}};t.FileContextKey=p,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],p.prototype,"globalContextKeyService",void 0),t.FileContextKey=p=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],p)},40439:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(16413),p=e(93899),v=e(68969),m=e(98295),_=e(41893),s=e(54414),g=e(32595),l=e(63067),h=e(58296),u=e(72665),d=e(55121),E=e(51500),f=e(6250),a=e(69959),b=e(56384),y=e(57781),A=e(97738),S=e(4446);let w=class{constructor(){this._disposables=new o.DisposableStore,this.isRendered=!1,this.deleteThrottler=new o.Throttler,this.willDeleteUris=[]}initialize(){this.workspaceService.initFileServiceExclude().then(async()=>{await this.fileTreeService.init(),this.fileTreeModelService.initTreeModel()}),this.progressService.registerProgressIndicator(g.EXPLORER_CONTAINER_ID)}async onStart(){this.viewsRegistry.registerViewWelcomeContent(f.RESOURCE_VIEW_ID,{content:(0,o.formatLocalize)("welcome-view.noFolderHelp",o.FILE_COMMANDS.OPEN_FOLDER.id),group:h.ViewContentGroups.Open,order:1}),this.mainLayoutService.collectViewComponent({id:f.RESOURCE_VIEW_ID,name:this.getWorkspaceTitle(),weight:3,priority:9,collapsed:!1,component:b.FileTree},g.EXPLORER_CONTAINER_ID),this._disposables.add(this.workspaceService.onWorkspaceLocationChanged(()=>{const D=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);D&&D.updateViewTitle(f.RESOURCE_VIEW_ID,this.getWorkspaceTitle())}))}onDidStart(){const D=this.injector.get(S.SymlinkDecorationsProvider,[this.fileTreeService]);this.decorationService.registerDecorationsProvider(D)}onDidRender(){this.isRendered=!0;const D=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);D&&(this.fileTreeModelService.whenReady.then(()=>{this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(D.isActivated())}),D.onActivate(()=>{this.fileTreeModelService.performLocationOnHandleShow(),this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(!0)}),D.onInActivate(()=>{this.fileTreeModelService.handleTreeBlur(),this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(!1)}))}getWorkspaceTitle(){let D=(0,o.localize)("file.empty.defaultTitle");const I=this.workspaceService.workspace;return I&&(D=new o.URI(I.uri).displayName,!I.isDirectory&&D.endsWith(`.${this.workspaceService.workspaceSuffixName}`)&&(D=D.slice(0,D.lastIndexOf(".")),D===E.UNTITLED_WORKSPACE))?(0,o.localize)("file.workspace.defaultTip"):D}onReconnect(){this.fileTreeService.reWatch()}revealFile(D){if(D)if(this.isRendered){const I=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);!I||!I.isVisible||I.isCollapsed(f.RESOURCE_VIEW_ID)?this.fileTreeModelService.locationOnShow(D):this.fileTreeModelService.location(D)}else this.fileTreeModelService.locationOnShow(D)}registerMenus(D){D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.NEW_FILE.id,label:(0,o.localize)("file.new")},order:1,group:"0_new"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.NEW_FOLDER.id,label:(0,o.localize)("file.folder.new")},order:2,group:"0_new"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.WORKSPACE_COMMANDS.ADD_WORKSPACE_FOLDER.id,label:(0,o.localize)("workspace.addFolderToWorkspace")},order:1,group:"0_workspace",when:"config.workspace.supportMultiRootWorkspace"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.WORKSPACE_COMMANDS.REMOVE_WORKSPACE_FOLDER.id,label:(0,o.localize)("workspace.removeFolderFromWorkspace")},order:1,group:"0_workspace",when:"config.workspace.supportMultiRootWorkspace"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_RESOURCES.id,label:(0,o.localize)("file.open")},order:1,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_TO_THE_SIDE.id,label:(0,o.localize)("file.open.side")},order:2,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_TYPE_WITH.id,label:(0,o.localize)("file.open.type")},order:3,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_TERMINAL_WITH_PATH.id,label:(0,o.localize)("file.filetree.openTerminalWithPath")},when:"workbench.panel.terminal",order:4,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.SEARCH_ON_FOLDER.id,label:(0,o.localize)("file.search.folder")},order:1,group:"2_search"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.DELETE_FILE.id,label:(0,o.localize)("file.delete")},order:1,group:"7_modification"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.RENAME_FILE.id,label:(0,o.localize)("file.rename")},order:3,group:"7_modification"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COMPARE_SELECTED.id,label:(0,o.localize)("file.compare")},order:2,group:"3_compare"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COPY_FILE.id,label:(0,o.localize)("file.copy.file")},order:1,group:"5_cutcopypaste"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.CUT_FILE.id,label:(0,o.localize)("file.cut.file")},order:2,group:"5_cutcopypaste"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.PASTE_FILE.id,label:(0,o.localize)("file.paste.file")},order:3,group:"5_cutcopypaste"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COPY_PATH.id,label:(0,o.localize)("file.copy.path")},group:"6_copypath"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COPY_RELATIVE_PATH.id,label:(0,o.localize)("file.copy.relativepath")},group:"6_copypath"})}registerCommands(D){const I=()=>{this.fileTreeService.filterMode&&this.fileTreeService.toggleFilterMode()};D.registerCommand(o.FILE_COMMANDS.OPEN_TERMINAL_WITH_PATH,{execute:M=>{let O=M;if(!O)return;const P=this.fileTreeService.getNodeByPathOrUri(O);P&&!P.filestat.isDirectory&&(O=P.uri.parent),this.commandService.executeCommand(o.TERMINAL_COMMANDS.OPEN_WITH_PATH.id,O)}}),D.registerCommand(o.FILE_COMMANDS.SEARCH_ON_FOLDER,{execute:async M=>{var O;let P=M;if(P||(this.fileTreeModelService.focusedFile?P=this.fileTreeModelService.focusedFile.uri:this.fileTreeModelService.selectedFiles.length>0&&(P=(O=this.fileTreeModelService.selectedFiles[0])===null||O===void 0?void 0:O.uri)),!P)return;let k;if(this.fileTreeService.isMultipleWorkspace)for(const F of await this.workspaceService.roots){const L=new o.URI(F.uri);if(L.isEqualOrParent(P)){k=`./${L.relative(P).toString()}`;break}}else if(this.workspaceService.workspace){const F=new o.URI(this.workspaceService.workspace.uri);F.isEqualOrParent(P)&&(k=`./${F.relative(P).toString()}`)}this.commandService.executeCommand(o.SEARCH_COMMANDS.OPEN_SEARCH.id,{includeValue:k+"/"})},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&a.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.LOCATION,{execute:M=>{M?this.revealFile(M):this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0&&this.revealFile(this.fileTreeModelService.selectedFiles[0].uri)}}),D.registerCommand(o.FILE_COMMANDS.LOCATION_WITH_EDITOR,{execute:()=>{var M,O,P;((O=(M=this.workbenchEditorService.currentEditor)===null||M===void 0?void 0:M.currentUri)===null||O===void 0?void 0:O.scheme)===o.Schemes.file&&this.revealFile((P=this.workbenchEditorService.currentEditor)===null||P===void 0?void 0:P.currentUri)}}),D.registerCommand(o.FILE_COMMANDS.COLLAPSE_ALL,{execute:()=>{const M=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);!M||!M.isVisible||this.fileTreeModelService.collapseAll()}}),D.registerCommand(o.FILE_COMMANDS.REFRESH_ALL,{execute:async()=>{const M=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);!M||!M.isVisible||await this.fileTreeService.refresh()}}),D.registerCommand(o.FILE_COMMANDS.DELETE_FILE,{execute:(M,O)=>{if(I(),O?this.willDeleteUris=this.willDeleteUris.concat(O):this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0?this.willDeleteUris=this.willDeleteUris.concat(this.fileTreeModelService.selectedFiles.map(P=>P.uri)):this.fileTreeModelService.focusedFile&&this.willDeleteUris.push(this.fileTreeModelService.focusedFile.uri),this.willDeleteUris.length!==0)return this.deleteThrottler.queue(this.doDelete.bind(this))},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.RENAME_FILE,{execute:M=>{if(I(),!M)if(this.fileTreeModelService.contextMenuFile)M=this.fileTreeModelService.contextMenuFile.uri;else if(this.fileTreeModelService.focusedFile)M=this.fileTreeModelService.focusedFile.uri;else return;this.fileTreeModelService.renamePrompt(M)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.NEW_FILE,{execute:async M=>{var O;if(I(),M)this.fileTreeModelService.newFilePrompt(M);else if(this.fileTreeService.isCompactMode&&this.fileTreeModelService.activeUri)this.fileTreeModelService.newFilePrompt(this.fileTreeModelService.activeUri);else if(this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0)this.fileTreeModelService.newFilePrompt(this.fileTreeModelService.selectedFiles[0].uri);else{let P;this.fileTreeService.isMultipleWorkspace?P=new o.URI((await this.workspaceService.roots)[0].uri):P=new o.URI((O=this.workspaceService.workspace)===null||O===void 0?void 0:O.uri),this.fileTreeModelService.newFilePrompt(P)}}}),D.registerCommand(o.FILE_COMMANDS.NEW_FOLDER,{execute:async M=>{var O;if(I(),M)this.fileTreeModelService.newDirectoryPrompt(M);else if(this.fileTreeService.isCompactMode&&this.fileTreeModelService.activeUri)this.fileTreeModelService.newDirectoryPrompt(this.fileTreeModelService.activeUri);else if(this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0)this.fileTreeModelService.newDirectoryPrompt(this.fileTreeModelService.selectedFiles[0].uri);else{let P;this.fileTreeService.isMultipleWorkspace?P=new o.URI((await this.workspaceService.roots)[0].uri):P=new o.URI((O=this.workspaceService.workspace)===null||O===void 0?void 0:O.uri),this.fileTreeModelService.newDirectoryPrompt(P)}}}),D.registerCommand(o.FILE_COMMANDS.COMPARE_SELECTED,{execute:(M,O)=>{if(O&&O.length){const P=this.workbenchEditorService.currentEditor;P&&P.currentUri&&this.fileTreeService.compare(O[0],P.currentUri)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!a.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.OPEN_RESOURCES,{execute:M=>{this.fileTreeService.openAndFixedFile(M)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!a.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.OPEN_TO_THE_SIDE,{execute:M=>{this.fileTreeService.openToTheSide(M)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!a.Directory.is(this.fileTreeModelService.contextMenuFile)});const R=(M,O)=>{const{availableOpenTypes:P,currentOpenType:k}=this.workbenchEditorService.currentEditorGroup;if(!(P&&M&&k))return{items:[],selectIndex:-1};const F=this.preferenceService.get("workbench.editorAssociations"),L=[],B=(Q,V)=>V.type===s.EditorOpenType.code?Q.type===s.EditorOpenType.code:V.type===s.EditorOpenType.component&&Q.type===s.EditorOpenType.component?Q.componentId===V.componentId:!1,j=(Q,V)=>(Q?Q+=(0,o.localize)("file.open.type.detail.and")+V:Q=V,Q);let W,U;if(F){const Q=Object.keys(F).find(V=>(0,o.match)(V,M.path.toString().toLowerCase())||(0,o.match)(V,M.path.base.toLowerCase()));W=Q&&F[Q]}return P.forEach((Q,V)=>{var $;const Y={label:Q.title||Q.componentId||Q.type,detail:Q.title,run:G=>O(G,Q)};B(k,Q)&&(Y.description=j(Y.description,(0,o.localize)("file.open.type.detail.active")),U=V),W&&(!(($=Q.componentId)===null||$===void 0)&&$.endsWith(W))&&(Y.description=j(Y.description,(0,o.localize)("file.open.type.detail.default"))),L.push(new o.QuickOpenItem(Y))}),{items:L,selectIndex:U}};D.registerCommand(o.FILE_COMMANDS.OPEN_TYPE_WITH,{execute:M=>{const O=(L,B)=>{var j,W;return L===o.Mode.OPEN?((j=this.workbenchEditorService.currentEditorGroup)===null||j===void 0||j.changeOpenType((W=B.componentId)!==null&&W!==void 0?W:B.type),!0):!1},{items:P,selectIndex:k}=R(M,O);if(P.length===0||typeof k>"u")return;const F=L=>{this.quickOpenService.open({onType:(B,j)=>j(L)},{fuzzyMatchLabel:!0,ignoreFocusOut:!1,placeholder:(0,o.formatLocalize)("file.open.type.placeholder",M.path.base),selectIndex:()=>k})};P.push(new o.QuickOpenItem({label:(0,o.formatLocalize)("file.open.type.preference.default",`*${M.path.ext}`),showBorder:!0,run:L=>{if(L===o.Mode.OPEN){const B=(U,Q)=>{var V,$,Y;if(U===o.Mode.OPEN){const G="workbench.editorAssociations",z=this.preferenceService.resolve(G).scope,K=this.preferenceService.get(G);return this.preferenceService.set(G,{...K||{},[`*${M.path.ext}`]:(V=Q.componentId)!==null&&V!==void 0?V:Q.type},z),($=this.workbenchEditorService.currentEditorGroup)===null||$===void 0||$.changeOpenType((Y=Q.componentId)!==null&&Y!==void 0?Y:Q.type),!0}return!1},{items:j,selectIndex:W}=R(M,B);if(j.length===0||typeof W>"u")return!0;F(j)}return!1}})),F(P)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!a.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.COPY_PATH,{execute:async M=>{if(!M)return;let P=M.path.toString();if(M.scheme===s.DIFF_SCHEME){const F=M.getParsedQuery();P=new o.URI(F.modified).path.toString()}let k=decodeURIComponent(P);await this.appService.backendOS===o.OperatingSystem.Windows&&(k=k.slice(1)),await this.clipboardService.writeText(k)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile}),D.registerCommand(o.FILE_COMMANDS.COPY_RELATIVE_PATH,{execute:async M=>{if(!M)return;if(M.scheme===s.DIFF_SCHEME){const k=M.getParsedQuery();M=new o.URI(k.modified).withScheme("file")}const O=this.fileTreeService.getNodeByPathOrUri(M);if(O&&O.filestat.isInSymbolicDirectory)return await this.clipboardService.writeText(O.path.split(d.Path.separator).slice(2).join(d.Path.separator));let P;if(this.fileTreeService.isMultipleWorkspace)for(const k of await this.workspaceService.roots){if(P=new o.URI(k.uri),P.isEqual(M))return await this.clipboardService.writeText("./");if(P.isEqualOrParent(M))return await this.clipboardService.writeText(decodeURIComponent(P.relative(M).toString()))}else if(this.workspaceService.workspace)return P=new o.URI(this.workspaceService.workspace.uri),P.isEqual(M)?await this.clipboardService.writeText("./"):await this.clipboardService.writeText(decodeURIComponent(P.relative(M).toString()))},isVisible:()=>!!this.fileTreeModelService.contextMenuFile}),D.registerCommand(o.FILE_COMMANDS.COPY_FILE,{execute:(M,O)=>{if(O&&O.length)this.fileTreeModelService.copyFile(O);else{const P=this.fileTreeModelService.selectedFiles.map(k=>k.uri);P&&P.length&&this.fileTreeModelService.copyFile(P)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)||!!this.fileTreeModelService.focusedFile&&!this.fileTreeModelService.focusedFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.SELECT_CURRENT_NODE,{execute:(M,O)=>{if(O&&O.length)this.fileTreeModelService.selectChildNode(O);else{const P=this.fileTreeModelService.selectedFiles.map(k=>k.uri);P&&P.length&&this.fileTreeModelService.selectChildNode(P)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)||!!this.fileTreeModelService.focusedFile&&!this.fileTreeModelService.focusedFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.CUT_FILE,{execute:(M,O)=>{if(O&&O.length)this.fileTreeModelService.cutFile(O);else{const P=this.fileTreeModelService.selectedFiles.map(k=>k.uri);P&&P.length&&this.fileTreeModelService.cutFile(P)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)||!!this.fileTreeModelService.focusedFile&&!this.fileTreeModelService.focusedFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.PASTE_FILE,{execute:M=>{if(I(),M)this.fileTreeModelService.pasteFile(M);else if(this.fileTreeModelService.focusedFile){let O;this.fileTreeModelService.activeUri?O=this.fileTreeModelService.activeUri:O=this.fileTreeModelService.focusedFile.uri,this.fileTreeModelService.pasteFile(O)}},isEnabled:()=>this.fileTreeModelService.pasteStore&&this.fileTreeModelService.pasteStore.type!==f.PasteTypes.NONE||this.appConfig.isElectronRenderer}),D.registerCommand(o.FILE_COMMANDS.VSCODE_OPEN_FOLDER,{execute:(M,O)=>{const P=this.injector.get(o.IWindowService),k={newWindow:!0};return typeof O=="boolean"?k.newWindow=O:k.newWindow=typeof O?.forceNewWindow=="boolean"?O.forceNewWindow:!0,M?P.openWorkspace(M,k):this.commandService.executeCommand(o.FILE_COMMANDS.OPEN_FOLDER.id,k)},isVisible:()=>{const M=this.preferenceService.get("application.supportsOpenFolder");return M??!1}}),D.registerCommand(o.FILE_COMMANDS.OPEN_FOLDER,{execute:M=>{const O=this.injector.get(o.IWindowService);this.appConfig.isElectronRenderer?this.injector.get(o.IElectronNativeDialogService).showOpenDialog({title:(0,o.localize)("workspace.openDirectory"),properties:["openDirectory"]}).then(k=>{k&&k.length>0&&O.openWorkspace(o.URI.file(k[0]),M||{newWindow:!0})}):this.injector.get(u.IWindowDialogService).showOpenDialog({title:(0,o.localize)("workspace.openDirectory"),canSelectFiles:!1,canSelectFolders:!0}).then(k=>{var F;k&&k.length>0&&this.injector.get(E.IWorkspaceService).open(k[0],{preserveWindow:(F=M?.newWindow)!==null&&F!==void 0?F:!1})})},isVisible:()=>{const M=this.preferenceService.get("application.supportsOpenFolder");return M??!1}}),D.registerCommand(o.FILE_COMMANDS.OPEN_WORKSPACE,{execute:M=>{if(!this.preferenceService.get("application.supportsOpenWorkspace"))return;const P=this.injector.get(o.IWindowService);this.appConfig.isElectronRenderer?this.injector.get(o.IElectronNativeDialogService).showOpenDialog({title:(0,o.localize)("workspace.openWorkspace"),properties:["openFile"],filters:[{name:(0,o.localize)("workspace.openWorkspaceTitle"),extensions:[this.workspaceService.workspaceSuffixName]}]}).then(F=>{F&&F.length>0&&P.openWorkspace(o.URI.file(F[0]),M||{newWindow:!0})}):this.injector.get(u.IWindowDialogService).showOpenDialog({title:(0,o.localize)("workspace.openWorkspace"),canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1,filters:{workspace:[this.workspaceService.workspaceSuffixName]}}).then(F=>{var L;F&&F.length>0&&this.injector.get(E.IWorkspaceService).open(F[0],{preserveWindow:(L=M?.newWindow)!==null&&L!==void 0?L:!1})})},isVisible:()=>{const M=this.preferenceService.get("application.supportsOpenWorkspace");return M??!1}}),D.registerCommand(o.FILE_COMMANDS.REVEAL_IN_EXPLORER,{execute:M=>{var O;let P=M instanceof o.URI?M:M?.uri;const k=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);k&&!k.isVisible&&k.activate(),k&&k.isCollapsed(f.RESOURCE_VIEW_ID)&&k?.setCollapsed(f.RESOURCE_VIEW_ID,!1),!P&&(!((O=this.workbenchEditorService.currentEditor)===null||O===void 0)&&O.currentUri)&&(P=this.workbenchEditorService.currentEditor.currentUri),P&&this.revealFile(o.URI.parse(P.toString()))}}),D.registerCommand(o.FILE_COMMANDS.FOCUS_FILES,{execute:()=>{const M=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);M&&M.activate()}}),D.registerCommand(o.FILE_COMMANDS.OPEN_FILE,{execute:M=>this.windowDialogService.showOpenDialog(M)}),D.registerCommand(o.FILE_COMMANDS.SAVE_FILE,{execute:M=>this.windowDialogService.showSaveDialog(M)}),D.registerCommand(o.FILE_COMMANDS.FILTER_TOGGLE,{execute:()=>this.fileTreeService.toggleFilterMode()}),D.registerCommand(o.FILE_COMMANDS.FILTER_OPEN,{execute:()=>{if(!this.fileTreeService.filterMode)return this.fileTreeService.toggleFilterMode()}}),D.registerCommand(o.FILE_COMMANDS.FILTER_CLOSE,{execute:()=>{this.fileTreeService.filterMode&&this.fileTreeService.toggleFilterMode()}}),D.registerCommand(o.FILE_COMMANDS.NEXT,{execute:()=>{this.fileTreeModelService.moveToNext()}}),D.registerCommand(o.FILE_COMMANDS.PREV,{execute:()=>{this.fileTreeModelService.moveToPrev()}}),D.registerCommand(o.FILE_COMMANDS.COLLAPSE,{execute:()=>{this.fileTreeModelService.collapseCurrentFile()}}),D.registerCommand(o.FILE_COMMANDS.EXPAND,{execute:()=>{this.fileTreeModelService.expandCurrentFile()}}),D.registerCommand(o.FILE_COMMANDS.TOGGLE_OR_OPEN,{execute:()=>{this.fileTreeModelService.toggleOrOpenCurrentFile()}}),D.registerCommand(o.WORKSPACE_COMMANDS.REMOVE_WORKSPACE_FOLDER,{execute:async(M,O)=>{if(I(),!O.length||!this.workspaceService.isMultiRootWorkspaceOpened)return;const P=await this.workspaceService.roots,k=O.filter(F=>P.find(L=>L.uri===F.toString()));k.length>0&&await this.workspaceService.removeRoots(k)},isVisible:()=>this.workspaceService.isMultiRootWorkspaceOpened&&!!this.fileTreeModelService.contextMenuFile&&!!this.workspaceService.tryGetRoots().find(M=>{var O;return M.uri===((O=this.fileTreeModelService.contextMenuFile)===null||O===void 0?void 0:O.uri.toString())})})}registerKeybindings(D){D.registerKeybinding({command:o.FILE_COMMANDS.COPY_FILE.id,keybinding:"ctrlcmd+c",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.PASTE_FILE.id,keybinding:"ctrlcmd+v",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.CUT_FILE.id,keybinding:"ctrlcmd+x",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.SELECT_CURRENT_NODE.id,keybinding:"ctrlcmd+a",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.RENAME_FILE.id,keybinding:"enter",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.DELETE_FILE.id,keybinding:"ctrlcmd+backspace",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.FILTER_OPEN.id,keybinding:"ctrlcmd+f",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.FILTER_CLOSE.id,keybinding:"esc",when:`${c.FilesExplorerFocusedContext.raw} && ${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.NEXT.id,keybinding:"down",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.PREV.id,keybinding:"up",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.EXPAND.id,keybinding:"right",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.COLLAPSE.id,keybinding:"left",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.TOGGLE_OR_OPEN.id,keybinding:"space",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`})}registerToolbarItems(D){D.registerItem({id:o.FILE_COMMANDS.LOCATION_WITH_EDITOR.id,command:o.FILE_COMMANDS.LOCATION_WITH_EDITOR.id,label:(0,o.localize)("file.location"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !config.explorer.autoReveal && !${c.FilesExplorerFilteredContext.raw}`,order:0}),D.registerItem({id:o.FILE_COMMANDS.NEW_FILE.id,command:o.FILE_COMMANDS.NEW_FILE.id,label:(0,o.localize)("file.new"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !${c.FilesExplorerFilteredContext.raw}`,order:1}),D.registerItem({id:o.FILE_COMMANDS.NEW_FOLDER.id,command:o.FILE_COMMANDS.NEW_FOLDER.id,label:(0,o.localize)("file.folder.new"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !${c.FilesExplorerFilteredContext.raw}`,order:2}),D.registerItem({id:o.FILE_COMMANDS.FILTER_TOGGLE.id,command:o.FILE_COMMANDS.FILTER_TOGGLE.id,label:(0,o.localize)("file.filetree.filter"),viewId:f.RESOURCE_VIEW_ID,toggledWhen:`${c.FilesExplorerFilteredContext.raw}`,order:3}),D.registerItem({id:o.FILE_COMMANDS.REFRESH_ALL.id,command:o.FILE_COMMANDS.REFRESH_ALL.id,label:(0,o.localize)("file.refresh"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !${c.FilesExplorerFilteredContext.raw}`,order:4}),D.registerItem({id:o.FILE_COMMANDS.COLLAPSE_ALL.id,command:o.FILE_COMMANDS.COLLAPSE_ALL.id,label:(0,o.localize)("file.collapse"),viewId:f.RESOURCE_VIEW_ID,order:5}),D.registerItem({id:o.WORKSPACE_COMMANDS.ADD_WORKSPACE_FOLDER.id,command:o.WORKSPACE_COMMANDS.ADD_WORKSPACE_FOLDER.id,label:(0,o.localize)("workspace.addFolderToWorkspace"),viewId:f.RESOURCE_VIEW_ID,order:0,group:"file_explore_workspace",when:"config.workspace.supportMultiRootWorkspace"})}doDelete(){const D=this.willDeleteUris.slice();return this.willDeleteUris=[],this.fileTreeModelService.deleteFileByUris(D)}dispose(){this._disposables.dispose()}};t.FileTreeContribution=w,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],w.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(f.IFileTreeService),n.__metadata("design:type",y.FileTreeService)],w.prototype,"fileTreeService",void 0),n.__decorate([(0,r.Autowired)(l.IMainLayoutService),n.__metadata("design:type",Object)],w.prototype,"mainLayoutService",void 0),n.__decorate([(0,r.Autowired)(v.IProgressService),n.__metadata("design:type",Object)],w.prototype,"progressService",void 0),n.__decorate([(0,r.Autowired)(E.IWorkspaceService),n.__metadata("design:type",Object)],w.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(A.FileTreeModelService),n.__metadata("design:type",A.FileTreeModelService)],w.prototype,"fileTreeModelService",void 0),n.__decorate([(0,r.Autowired)(_.IDecorationsService),n.__metadata("design:type",_.IDecorationsService)],w.prototype,"decorationService",void 0),n.__decorate([(0,r.Autowired)(s.WorkbenchEditorService),n.__metadata("design:type",s.WorkbenchEditorService)],w.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(o.CommandService),n.__metadata("design:type",Object)],w.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(u.IWindowDialogService),n.__metadata("design:type",Object)],w.prototype,"windowDialogService",void 0),n.__decorate([(0,r.Autowired)(o.IClipboardService),n.__metadata("design:type",Object)],w.prototype,"clipboardService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],w.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.QuickOpenService),n.__metadata("design:type",Object)],w.prototype,"quickOpenService",void 0),n.__decorate([(0,r.Autowired)(l.IViewsRegistry),n.__metadata("design:type",Object)],w.prototype,"viewsRegistry",void 0),n.__decorate([(0,r.Autowired)(o.IApplicationService),n.__metadata("design:type",Object)],w.prototype,"appService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],w.prototype,"appConfig",void 0),t.FileTreeContribution=w=n.__decorate([(0,m.Domain)(p.MenuContribution,o.CommandContribution,o.KeybindingContribution,o.TabBarToolbarContribution,o.ClientAppContribution,l.MainLayoutContribution)],w)},2812:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeModel=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(69959),m=e(93239);let _=n=class extends c.TreeModel{constructor(g){super(),this.flushDispatchChangeDelayer=new p.ThrottledDelayer(n.DEFAULT_FLUSH_DELAY),this.init(g)}init(g){this.root=g,this.root.watcher.on(c.TreeNodeEvent.BranchDidUpdate,this.doDispatchChange.bind(this)),this.decorationService.onDidChange(this.doDispatchChange.bind(this))}doDispatchChange(){this.flushDispatchChangeDelayer.isTriggered()||this.flushDispatchChangeDelayer.cancel(),this.flushDispatchChangeDelayer.trigger(async()=>{this.dispatchChange()})}};t.FileTreeModel=_,_.DEFAULT_FLUSH_DELAY=100,r.__decorate([(0,o.Autowired)(m.FileTreeDecorationService),r.__metadata("design:type",m.FileTreeDecorationService)],_.prototype,"decorationService",void 0),t.FileTreeModel=_=n=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__param(0,(0,o.Optional)()),r.__metadata("design:paramtypes",[v.Directory])],_)},46377:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FILE_TREE_BADGE_LIMIT=t.FILE_TREE_NODE_HEIGHT=t.FileTreeNode=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(97267),p=e(41869),v=e(69959),m=n.__importDefault(e(89200)),{Path:_}=p.path,s=({item:g,onClick:l,onDoubleClick:h,onContextMenu:u,dndService:d,itemType:E,decorationService:f,labelService:a,leftPadding:b=8,onTwistierClick:y,decorations:A,defaultLeftPadding:S=8,template:w,hasFolderIcons:T,hasFileIcons:D,hidesExplorerArrows:I,hasPrompt:R,iconService:M})=>{const[O,P]=o.default.useState(-1),k=E===c.TreeNodeType.RenamePrompt,F=E===c.TreeNodeType.NewPrompt,L=k||F,B=!L&&g.name.indexOf(_.separator)>=0,j=(0,p.useDesignStyles)(m.default.expansion_toggle,"expansion_toggle"),W=(0,p.useDesignStyles)(m.default.file_tree_node,"file_tree_node"),U=L?null:f.getDecoration(g.uri,v.Directory.is(g)),Q=Pe=>{(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&(B&&P(g.name.split(_.separator).length-1),l(Pe,g,E))},V=Pe=>{(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&(B&&P(g.name.split(_.separator).length-1),h(Pe,g,E))},$=Pe=>{(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&(y?y(Pe,g,E):l(Pe,g,E))},Y=o.default.useCallback(Pe=>{Pe.nativeEvent.which!==0&&(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&u(Pe,g,E)},[u,g]),G=o.default.useCallback(Pe=>{const{handleDragStart:Se}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Se(Pe,g)},[d,g]),z=o.default.useCallback(Pe=>{const{handleDragLeave:Se}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Se(Pe,g)},[d,g]),K=o.default.useCallback(Pe=>{const{handleDragEnter:Se}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Se(Pe,g)},[d,g]),Z=o.default.useCallback(Pe=>{const{handleDrop:Se}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Se(Pe,g)},[d,g]),X=o.default.useCallback(Pe=>{const{handleDragOver:Se}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Se(Pe,g)},[d,g]);let oe=E===c.TreeNodeType.CompositeTreeNode,ne;L?F?(oe=g.type===c.TreeNodeType.CompositeTreeNode,ne=`${S+(g.parent.depth+1||0)*(b||0)+(oe?0:T?I?0:20:0)}px`):(oe=g.target.type===c.TreeNodeType.CompositeTreeNode,ne=`${S+(g.target.depth||0)*(b||0)+(oe?0:T?I?0:20:0)}px`):ne=`${S+(g.depth||0)*(b||0)+(oe?0:T?I?0:20:0)}px`;const ue={color:U?U.color:"",height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`,paddingLeft:ne,opacity:R&&!L?".6":"1"},fe=(Pe,Se)=>{if(A&&A?.classlist.indexOf(m.default.mod_loading)>-1)return o.default.createElement(c.Loading,null);if(L&&Pe instanceof c.PromptHandle){let Te=!1;if(k?Te=Pe.target.type===c.TreeNodeType.CompositeTreeNode:Te=Pe.type===c.TreeNodeType.CompositeTreeNode,Te)return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,j,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:F||!(k&&Pe.target.type===c.TreeNodeType.CompositeTreeNode&&Pe.target.expanded)})})}else return o.default.createElement("div",{onClick:Se,className:(0,r.default)(m.default.file_tree_node_segment,j,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:!Pe.expanded})})},q=Pe=>{let Se,Te;L&&Pe instanceof c.PromptHandle?Pe instanceof c.RenamePromptHandle?(Se=Pe.target.uri.resolve(Pe.$.value),Te=v.Directory.is(Pe.target)):(Se=Pe.parent.uri.resolve(Pe.$.value),Te=Pe.type===c.TreeNodeType.CompositeTreeNode):(Se=Pe.uri,Te=Pe.filestat.isDirectory);const Ee=a.getIcon(Se,{isDirectory:Te,isOpenedDirectory:Te&&Pe.expanded});return Te&&!T||!Te&&!D?null:o.default.createElement("div",{className:(0,r.default)(m.default.file_icon,Ee,{expanded:Te&&Pe.expanded}),style:{height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`}})},Ae=Pe=>{if(w)return o.default.createElement(w,null);if(L&&Pe instanceof c.PromptHandle)return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_inputbox)},o.default.createElement("div",{className:(0,r.default)("input-box",m.default.file_tree_node_prompt_box)},o.default.createElement(Pe.ProxiedInput,{wrapperStyle:{height:t.FILE_TREE_NODE_HEIGHT,padding:"0 5px"}})));if(B){const Se=Pe.displayName.split(_.separator),Te=Se.map((Ee,me)=>{const Ne=Se.slice(0,me+1).join(_.separator),Me=Be=>{Be.stopPropagation(),P(me);const ze=g.parent.uri.resolve(Se.slice(0,me+1).join(_.separator));l(Be,g,E,ze)},Fe=Be=>{Be.stopPropagation(),P(me);const ze=g.parent.uri.resolve(Se.slice(0,me+1).join(_.separator));u(Be,g,E,ze)},_e=Be=>{Be.stopPropagation(),Be.preventDefault(),O!==me&&(P(me),d.handleDragOver(Be,g))},re=Be=>{Be.stopPropagation(),Be.preventDefault(),P(-1)},he=Be=>{Be.stopPropagation(),O!==me&&P(me);const ze=g.parent.uri.resolve(Se.slice(0,me+1).join(_.separator));d.handleDragStart(Be,g,ze)},Oe=Be=>{const ze=g.parent.uri.resolve(Se.slice(0,me+1).join(_.separator));d.handleDrop(Be,g,ze)},De=(0,r.default)(O===me&&m.default.active,m.default.compact_name);return o.default.createElement("span",{key:Ne},o.default.createElement("a",{className:De,draggable:!0,onContextMenu:Fe,onDragStart:he,onDragOver:_e,onDragLeave:re,onDrop:Oe,onClick:Me},Ee),me!==Se.length-1?o.default.createElement("span",{className:m.default.compact_name_separator},_.separator):null)});return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_displayname)},Te)}return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_displayname)},a.getName(Pe.uri)||Pe.displayName)},pe=()=>o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_tail)},ie()),ie=()=>U?o.default.createElement("div",{className:m.default.file_tree_node_status},(0,p.transformLabelWithCodicon)(U.badge.slice(),{color:"inherit"},M.fromString.bind(M))):null,ge=Pe=>{if(I)return null;if(oe)return fe(Pe,$);if(L)return fe(Pe,()=>{})},Ie=()=>{let Pe=g.tooltip;return U&&U.badge&&(Pe+=` \u2022 ${U.tooltip}`),Pe};return o.default.createElement("div",{key:g.id,onClick:Q,onDoubleClick:V,onContextMenu:Y,onDragStart:G,onDragOver:X,onDragEnter:K,onDragLeave:z,onDrop:Z,title:Ie(),className:(0,r.default)(W,A?A.classlist:null),style:ue,draggable:E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode,"data-id":g.id},o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_content)},ge(g),q(g),o.default.createElement("div",{className:L?m.default.file_tree_node_prompt_wrap:m.default.file_tree_node_overflow_wrap},Ae(g)),pe()))};t.FileTreeNode=s,t.FILE_TREE_NODE_HEIGHT=22,t.FILE_TREE_BADGE_LIMIT=99},56384:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTree=t.FILE_TREE_FILTER_DELAY=t.FILTER_AREA_HEIGHT=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(97267),p=e(41869),v=e(68974),m=e(24429),_=e(87420),s=e(6250),g=e(46377),l=n.__importDefault(e(2613)),h=e(97738);t.FILTER_AREA_HEIGHT=30,t.FILE_TREE_FILTER_DELAY=500;const u=(0,c.RecycleTreeFilterDecorator)(c.RecycleTree),d=({viewState:f})=>{const[a,b]=(0,o.useState)(!1),[y,A]=(0,o.useState)(!0),[S,w]=(0,o.useState)(!1),[T,D]=(0,o.useState)(!1),[I,R]=(0,o.useState)(),M=(0,o.useRef)(null),O=(0,o.useRef)(new p.DisposableCollection),{height:P}=f,k=(0,p.useInjectable)(s.IFileTreeService),{iconService:F,locationToCurrentFile:L,filterMode:B,indent:j,baseIndent:W}=k,U=(0,p.useInjectable)(h.FileTreeModelService),[Q,V]=(0,o.useState)({indent:j,baseIndent:W}),[$,Y]=(0,o.useState)(B),[G,z]=(0,o.useState)(F.currentTheme||{hasFolderIcons:!0,hasFileIcons:!0,hidesExplorerArrows:!0}),K=(0,o.useCallback)(Ne=>Z(Ne)?!1:Ne.shiftKey,[]),Z=(0,o.useCallback)(Ne=>{const{metaKey:Me,ctrlKey:Fe}=Ne;return p.isOSX&&Me||Fe},[]),X=(0,o.useCallback)((Ne,Me,Fe,_e)=>{Ne.stopPropagation();const{handleItemClick:re,handleItemToggleClick:he,handleItemRangeClick:Oe}=U;if(!Me)return;const De=K(Ne),Be=Z(Ne);De?Oe(Me,Fe):Be?he(Me,Fe):re(Me,Fe,_e)},[]),oe=(0,o.useCallback)((Ne,Me,Fe)=>{Ne.stopPropagation();const{handleItemDoubleClick:_e}=U;Me&&_e(Me,Fe)},[]),ne=(0,o.useCallback)((Ne,Me)=>{Ne.stopPropagation();const{toggleDirectory:Fe}=U;Fe(Me)},[]);(0,o.useEffect)(()=>{a&&U.onFileTreeModelChange(async Ne=>{A(!0),Ne&&await Ne.ensureReady,R(Ne),A(!1)})},[a]),(0,o.useEffect)(()=>{var Ne,Me,Fe;const _e=new p.CancellationTokenSource;return q(_e.token),(Ne=O.current)===null||Ne===void 0||Ne.push(F.onThemeChange(re=>{z(re)})),(Me=O.current)===null||Me===void 0||Me.push(k.onTreeIndentChange(({indent:re,baseIndent:he})=>{V({indent:re,baseIndent:he})})),(Fe=O.current)===null||Fe===void 0||Fe.push(k.onFilterModeChange(re=>{Y(re)})),()=>{var re;_e.cancel(),(re=O.current)===null||re===void 0||re.dispose()}},[]);const ue=(0,o.useCallback)((Ne,Me)=>{let Fe;if(Ne&&Me)for(Fe=Ne.parentNode;Fe;){if(Me===Fe)return!0;Fe=Fe.parentNode}return!1},[]),fe=(0,o.useCallback)(Ne=>{ue(Ne.relatedTarget,M.current)||!Ne.relatedTarget||(w(!1),U.handleTreeBlur())},[M.current]);(0,o.useEffect)(()=>{$||(U.fileTreeHandle&&U.fileTreeHandle.clearFilter(),U.selectedFiles.length===1&&U.location(U.selectedFiles[0].uri))},[$]),(0,o.useEffect)(()=>{const Ne=new p.DisposableCollection;return I&&(Ne.push(U.onDidFocusedFileChange(Me=>{Me?Me.isEqual((I?.root).uri)?S||w(!S):S&&w(!S):Me||S&&w(!S)})),Ne.push(U.onDidContextMenuFileChange(Me=>{Me?Me.isEqual((I?.root).uri)?S||w(!S):S&&w(!S):Me||S&&w(!S)}))),()=>{Ne.dispose()}},[I,S]);const q=(0,o.useCallback)(async Ne=>{var Me;if(await U.whenReady,!Ne.isCancellationRequested){if(U.treeModel){if(await U.treeModel.ensureReady,R(U.treeModel),Ne.isCancellationRequested)return;M.current&&k.initContextKey(M.current)}A(!1),!((Me=O.current)===null||Me===void 0)&&Me.disposed||b(!0)}},[U,O.current]),Ae=(0,o.useCallback)(Ne=>{U.handleTreeHandler({...Ne,getModel:()=>U.treeModel,hasDirectFocus:()=>M.current===document.activeElement})},[M.current,I]),pe=(0,o.useCallback)(()=>{const{handleItemClick:Ne}=U;Ne()},[]),ie=(0,o.useCallback)(()=>{U.handleDblClick()},[]),ge=(0,o.useCallback)(()=>{const{handleTreeFocus:Ne}=U;Ne()},[]),Ie=(0,o.useCallback)(Ne=>{const{handleContextMenu:Me}=U;Me(Ne)},[]),Pe=(0,o.useCallback)(Ne=>{Ne.stopPropagation(),Ne.preventDefault()},[]),Se=(0,o.useCallback)(Ne=>{Ne.preventDefault(),D(!0)},[]),Te=(0,o.useCallback)(()=>{D(!1)},[]),Ee=(0,o.useCallback)(Ne=>{const{handleDrop:Me}=U.dndService;D(!1),Me(Ne)},[]),me=(0,o.useCallback)((Ne,Me,Fe,_e)=>{const{handleContextMenu:re}=U;re(Ne,Me,_e)},[]);return o.default.createElement("div",{className:(0,r.default)(l.default.file_tree,T&&l.default.outer_drag_over,S&&l.default.outer_active),tabIndex:-1,ref:M,onClick:pe,onDoubleClick:ie,onFocus:ge,onBlur:fe,onContextMenu:Ie,draggable:!0,onDragStart:Pe,onDragLeave:Te,onDragOver:Se,onDrop:Ee},o.default.createElement(E,{isLoading:y,isReady:a,height:P,model:I,iconTheme:G,treeIndent:Q,filterMode:$,locationToCurrentFile:L,onTreeReady:Ae,onContextMenu:me,onItemClick:X,onItemDoubleClick:oe,onTwistierClick:ne}))};t.FileTree=d;const E=(0,o.memo)(({isReady:f,isLoading:a,height:b,model:y,filterMode:A,treeIndent:S,iconTheme:w,onTreeReady:T,onItemClick:D,onItemDoubleClick:I,onContextMenu:R,onTwistierClick:M})=>{const O=(0,p.useInjectable)(s.IFileTreeService),P=(0,p.useInjectable)(_.IIconService),{decorationService:k,labelService:F,locationToCurrentFile:L}=O,B=(0,p.useInjectable)(h.FileTreeModelService),j=(0,o.useCallback)(W=>o.default.createElement(g.FileTreeNode,{item:W.item,itemType:W.itemType,template:W.template,decorationService:k,labelService:F,iconService:P,dndService:B.dndService,decorations:B.decorations.getDecorations(W.item),onClick:D,onDoubleClick:I,onTwistierClick:M,onContextMenu:R,defaultLeftPadding:S.baseIndent,leftPadding:S.indent,hasPrompt:W.hasPrompt,hasFolderIcons:w.hasFolderIcons,hasFileIcons:w.hasFileIcons,hidesExplorerArrows:w.hidesExplorerArrows}),[y,S,w]);return f?a?o.default.createElement(v.Progress,{loading:!0}):y?o.default.createElement(u,{height:b,itemHeight:g.FILE_TREE_NODE_HEIGHT,onReady:T,model:y,filterEnabled:A,filterAfterClear:L,filterAutoFocus:!0,leaveBottomBlank:!0},j):o.default.createElement(m.WelcomeView,{viewId:s.FILE_EXPLORER_WELCOME_ID}):o.default.createElement(v.Progress,{loading:!0})});E.displayName="FileTreeView"},57781:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeService=void 0;const n=e(85608),r=e(76003),o=e(97267),c=e(41869),p=e(18193),v=e(26542),m=e(42933),_=e(52416),s=e(51500),g=e(6250),l=e(69959),h=e(88014),u=e(93239),{Path:d}=c.path;let E=class extends o.Tree{constructor(){super(...arguments),this._fileServiceWatchers=new Map,this._symbolicFiles=new Map,this._changeEventDispatchQueue=new Set,this._readyToWatch=!1,this._watchRootsQueue=[],this.effectedNodes=[],this.onWorkspaceChangeEmitter=new c.Emitter,this.onTreeIndentChangeEmitter=new c.Emitter,this.onFilterModeChangeEmitter=new c.Emitter,this.onNodeRefreshedEmitter=new c.Emitter,this._filterMode=!1,this._refreshable=!0,this.refreshEffectNode=()=>{const a=this.effectedNodes.slice(0);if(this.effectedNodes=[],a.find(y=>l.Directory.isRoot(y)))this.refresh();else for(const y of a)this.refresh(y)},this.flushEventQueue=async()=>{if(!this._changeEventDispatchQueue||this._changeEventDispatchQueue.size===0)return;const a=Array.from(this._changeEventDispatchQueue),b=this.sortPaths(a);(!this.refreshCancelToken||this.refreshCancelToken.token.isCancellationRequested)&&(this.refreshCancelToken=new c.CancellationTokenSource);const y=(0,c.pSeries)(b.map(A=>async()=>{l.Directory.is(A.node)&&await A.node.refresh(this.refreshCancelToken)}));return this._changeEventDispatchQueue.clear(),await y},this.locationToCurrentFile=()=>{this.commandService.executeCommand(c.FILE_COMMANDS.LOCATION.id)}}get onNodeRefreshed(){return this.onNodeRefreshedEmitter.event}get refreshable(){return this._refreshable}get filterMode(){return this._filterMode}get baseIndent(){return this._baseIndent}get indent(){return this._indent}get onWorkspaceChange(){return this.onWorkspaceChangeEmitter.event}get onTreeIndentChange(){return this.onTreeIndentChangeEmitter.event}get onFilterModeChange(){return this.onFilterModeChangeEmitter.event}get isCompactMode(){return this._isCompactMode}get contextKey(){return this.fileContextKey}async init(){this._roots=await this.workspaceService.roots,await this.preferenceService.ready,this._baseIndent=this.preferenceService.getValid("explorer.fileTree.baseIndent",8),this._indent=this.preferenceService.getValid("explorer.fileTree.indent",8),this._isCompactMode=this.preferenceService.getValid("explorer.compactFolders",!0),this.toDispose.push(this.workspaceService.onWorkspaceChanged(a=>{this._roots=a;const b=new c.URI(a[0].uri),y=new l.Directory(this,void 0,b,b.displayName,a[0],this.fileTreeAPI.getReadableTooltip(b));this.root=y,this.onWorkspaceChangeEmitter.fire(y),this.refresh()})),this.toDispose.push(this.workspaceService.onWorkspaceFileExcludeChanged(()=>{this.refresh()})),this.toDispose.push(c.Disposable.create(()=>{var a;(a=this._root)===null||a===void 0||a.dispose(),this._roots=null})),this.toDispose.push(this.corePreferences.onPreferenceChanged(a=>{a.preferenceName==="explorer.fileTree.baseIndent"?(this._baseIndent=a.newValue||8,this.onTreeIndentChangeEmitter.fire({indent:this.indent,baseIndent:this.baseIndent})):a.preferenceName==="explorer.fileTree.indent"?(this._indent=a.newValue||8,this.onTreeIndentChangeEmitter.fire({indent:this.indent,baseIndent:this.baseIndent})):a.preferenceName==="explorer.compactFolders"&&(this._isCompactMode=a.newValue,this.refresh())}))}initContextKey(a){this.fileContextKey.initScopedContext(a)}startWatchFileEvent(){return this._readyToWatch=!0,Promise.all(this._watchRootsQueue.map(a=>this.watchFilesChange(a)))}async resolveChildren(a){var b,y,A,S;let w=[];if(a){if(l.Directory.isRoot(a)&&this.isMultipleWorkspace){const T=await this.workspaceService.roots;for(const D of T){const I=this.fileTreeAPI.toNode(this,D,a,this.workspaceService.getWorkspaceName(new c.URI(D.uri)));this.watchFilesChange(new c.URI(D.uri)),w=w.concat(I),(I.filestat.isSymbolicLink||I.filestat.isInSymbolicDirectory)&&this._symbolicFiles.set(I.filestat.uri,I)}return w}if(a.uri){const T=await this.fileTreeAPI.resolveChildren(this,a.uri.toString(),a,this.isCompactMode&&!l.Directory.isRoot(a));w=T.children,w.forEach(I=>{(I.filestat.isSymbolicLink||I.filestat.isInSymbolicDirectory)&&this._symbolicFiles.set(I.filestat.uri,I)});const D=T.filestat;if(D&&this.isCompactMode&&!l.Directory.isRoot(a)){const I=new c.URI(D.uri),R=a.parent;if(a&&R){let M=a.name;if(a.filestat.isSymbolicLink){const O=(y=new c.URI(a.filestat.realUri).relative(I))===null||y===void 0?void 0:y.toString();O&&(M=O,M=[a.uri.displayName].concat(M.split(d.separator)).join(d.separator))}else R.filestat.isSymbolicLink?M=(A=new c.URI(R.filestat.realUri).relative(I))===null||A===void 0?void 0:A.toString():M=(S=R.uri.relative(I))===null||S===void 0?void 0:S.toString();M&&M!==a.name&&a.updateMetaData({name:M,uri:I,tooltip:this.fileTreeAPI.getReadableTooltip(I),fileStat:D})}}return w}}else if(this._roots||(this._roots=await this.workspaceService.roots),this.isMultipleWorkspace){const T=new c.URI((b=this.workspaceService.workspace)===null||b===void 0?void 0:b.uri);let D=T.displayName;D=D.slice(0,D.lastIndexOf("."));const I={...this.workspaceService.workspace,isDirectory:!0},R=new l.Directory(this,void 0,T,D,I,this.fileTreeAPI.getReadableTooltip(T));return this.root=R,[R]}else if(this._roots.length>0)return w=await(await this.fileTreeAPI.resolveChildren(this,this._roots[0])).children,w.forEach(T=>{const D=this.workspaceService.getWorkspaceName(T.uri);D&&D!==T.name&&T.updateMetaData({name:D}),(T.filestat.isSymbolicLink||T.filestat.isInSymbolicDirectory)&&this._symbolicFiles.set(T.filestat.uri,T)}),this.watchFilesChange(new c.URI(this._roots[0].uri)),this.root=w[0],w;return[]}async watchFilesChange(a){if(!this._readyToWatch){this._watchRootsQueue.push(a);return}const b=await this.fileServiceClient.watchFileChanges(a);this.toDispose.push(b),this.toDispose.push(b.onFilesChanged(y=>{this.onFilesChanged(y)})),this._fileServiceWatchers.set(a.toString(),b)}updateRefreshable(a){var b;a!==this.refreshable&&(this._refreshable=a,this._refreshable?this.doHandleQueueChange():(b=this.refreshCancelToken)===null||b===void 0||b.cancel())}isContentFile(a){return!!a&&"filestat"in a&&!a.filestat.isDirectory}isFileContentChanged(a){return a.type===m.FileChangeType.UPDATED&&this.isContentFile(this.getNodeByPathOrUri(a.uri))}getAffectedChanges(a){const b=[];for(const y of a)this.isFileContentChanged(y)||b.push(y);return b}isRootAffected(a){return this._roots?a.some(b=>b.type>m.FileChangeType.UPDATED&&this._roots&&this._roots.find(y=>b.uri.indexOf(y.uri)>=0)):!1}async onFilesChanged(a){const b=await this.getAffectedNodes(this.getAffectedChanges(a));return b.length>0?this.effectedNodes=this.effectedNodes.concat(b):!(b.length>0)&&this.isRootAffected(a)&&this.effectedNodes.push(this.root),this.refreshEffectNode()}async getFileTreeNodePathByUri(a){var b,y,A,S,w,T;if(!a)return;let D;if(this.isMultipleWorkspace){if(this._roots||(this._roots=await this.workspaceService.roots),D=(S=this._roots.find(I=>new c.URI(I.uri).isEqualOrParent(a)))===null||S===void 0?void 0:S.uri,D){const I=new c.URI(D);if(I.isEqualOrParent(a))return new d(((w=this.root)===null||w===void 0?void 0:w.path)||"/").join(I.displayName).join(((T=I.relative(a))===null||T===void 0?void 0:T.toString())||"").toString()}}else if(D=(b=this.workspaceService.workspace)===null||b===void 0?void 0:b.uri,D){const I=new c.URI(D);if(I.isEqualOrParent(a))return new d(((y=this.root)===null||y===void 0?void 0:y.path)||"").join(((A=I.relative(a))===null||A===void 0?void 0:A.toString())||"").toString()}}async moveNodeByPath(a,b,y,A,S=o.TreeNodeType.TreeNode){const w=new d(a.path).join(y).toString(),T=new d(b.path).join(A).toString();if(w&&T&&T!==w){const D=a.moveNode(w,T);return D&&l.File.is(D)&&(D.updateMetaData({uri:b.uri.resolve(A),fileStat:{...b.filestat,uri:b.uri.resolve(A).toString(),isDirectory:S!==o.TreeNodeType.TreeNode},tooltip:this.fileTreeAPI.getReadableTooltip(b.uri.resolve(A))}),l.Directory.is(D)&&this.updateChildren(D)),D}}async updateChildren(a){const b=a.children;if(!(!b||b.length===0)){for(const y of b)if(l.File.is(y)){const A=a.uri.resolve(y.uri.displayName);y.updateMetaData({uri:A,fileStat:{...y.filestat,uri:A.toString(),isDirectory:!!l.Directory.is(y)},tooltip:this.fileTreeAPI.getReadableTooltip(A)}),l.Directory.is(y)&&this.updateChildren(y)}}}async addNode(a,b,y){let A,S;const w=d.splitPath(b);if(w.length>1){let D=a.uri;for(const I of w)D=D.resolve(I);!this.isCompactMode||l.Directory.isRoot(a)?S=w[0]:y===o.TreeNodeType.CompositeTreeNode?S=b:S=w.slice(0,w.length-1).join(d.separator)}else S=b;A={uri:a.uri.resolve(S).toString(),isDirectory:y===o.TreeNodeType.CompositeTreeNode||w.length>1,isSymbolicLink:!1,lastModification:new Date().getTime()};const T=await this.fileTreeAPI.toNode(this,A,a,S);return T&&a.addNode(T),T}async deleteAffectedNodeByPath(a,b){var y,A;const S=this.getNodeByPathOrUri(a);S&&S.parent&&(this.isCompactMode&&!b?((y=S.parent.children)===null||y===void 0?void 0:y.length)===2?this.refresh((A=S.parent)===null||A===void 0?void 0:A.parent):this.refresh(S.parent):S.parent.removeNode(S.path))}async deleteAffectedNodes(a,b=[]){const y=[];for(const A of a){const S=this.getNodeByPathOrUri(A);S&&l.File.is(S)&&y.push(S)}for(const A of y)!A?.parent||this._changeEventDispatchQueue.has(A?.parent.path)||await this.deleteAffectedNodeByPath(A.path);return b.filter(A=>A.type!==m.FileChangeType.DELETED)}async getAffectedNodes(a){const b=[];for(const y of a){const A=new c.URI(y.uri),S=this.getNodeByPathOrUri(A.parent);S&&b.push(S)}return b}isFileURI(a){return/^file:\/\//.test(a)}getNodeByPathOrUri(a){var b,y,A,S;let w,T;if(typeof a!="string"?(T=a,a=a.toString()):this.isFileURI(a)?T=new c.URI(a):!this.isFileURI(a)&&typeof a=="string"&&(w=a),this.isFileURI(a)&&T){if(this._symbolicFiles.has(T?.toString()))return this._symbolicFiles.get(T.toString());let D;if(this.isMultipleWorkspace?this._roots&&(D=(y=this._roots.find(I=>new c.URI(I.uri).isEqualOrParent(T)))===null||y===void 0?void 0:y.uri):D=(b=this.workspaceService.workspace)===null||b===void 0?void 0:b.uri,this.root&&D){const I=new c.URI(D);if(I.isEqualOrParent(T)){const R=I.relative(T);R&&(w=new d(this.root.path).join(R.toString()).toString())}}}if(w){const D=(A=this.root)===null||A===void 0?void 0:A.getTreeNodeByPath(w);if(!D){let I;const R=w.split(d.separator);for(;R.length>=1;){R.pop();const M=R.join(d.separator);if(I=(S=this.root)===null||S===void 0?void 0:S.getTreeNodeByPath(M),I)break}if(I&&l.Directory.is(I)){for(const M of I.children||[])if(M.path.includes(w))return M}}return D}}sortComparator(a,b){return a.constructor===b.constructor?a.name.localeCompare(b.name,"en",{numeric:!0}):a.type===o.TreeNodeType.CompositeTreeNode?-1:b.type===o.TreeNodeType.CompositeTreeNode?1:0}get contextMenuContextKeyService(){return this.fileContextKey?this.fileContextKey.service:this.contextKeyService}reWatch(){for(const[a,b]of this._fileServiceWatchers)b.dispose(),this.watchFilesChange(new c.URI(a))}get isMultipleWorkspace(){return!!this.workspaceService.workspace&&!this.workspaceService.workspace.isDirectory}getDisplayName(a){return this.workspaceService.getWorkspaceName(a)}async refresh(a=this.root){if(a)return l.Directory.is(a)||l.File.is(a)&&a.parent&&(a=a.parent),this._changeEventDispatchQueue.add(a.path),this.doHandleQueueChange()}async doHandleQueueChange(){if(this.refreshable)try{await this.flushEventQueue()}catch(a){this.logger.error("flush file change event queue error:",a)}finally{this.onNodeRefreshedEmitter.fire()}}sortPaths(a){const y=a.slice().map(S=>({node:this.getNodeByPathOrUri(S),path:S})).filter(S=>S&&!!S.node);a.length>1&&y.sort((S,w)=>{var T,D;const I=((T=S.node)===null||T===void 0?void 0:T.depth)||0,R=((D=w.node)===null||D===void 0?void 0:D.depth)||0;return I-R});const A=[];for(let S=y.length-1;S>=0;S--){const w=y[S];let T=!1;for(let D=0;D<S;D++){const I=y[D];l.Directory.is(I)&&w.node.path.startsWith(I.node.path)&&(T=!0)}T||A.push(w)}return A}openFile(a){const b=this.preferenceService.get("editor.previewMode");this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,a,{disableNavigate:!0,preview:b})}openAndFixedFile(a){this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,a,{disableNavigate:!0,preview:!1,focus:!0})}openToTheSide(a){this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,a,{disableNavigate:!0,split:4})}compare(a,b){this.commandService.executeCommand(c.EDITOR_COMMANDS.COMPARE.id,{original:a,modified:b})}toggleFilterMode(){var a;this._filterMode=!this.filterMode,this.onFilterModeChangeEmitter.fire(this.filterMode),(a=this.fileContextKey)===null||a===void 0||a.filesExplorerFilteredContext.set(this.filterMode),this.filterMode===!1&&this.commandService.executeCommand(c.FILE_COMMANDS.LOCATION.id)}};t.FileTreeService=E,n.__decorate([(0,r.Autowired)(g.IFileTreeAPI),n.__metadata("design:type",Object)],E.prototype,"fileTreeAPI",void 0),n.__decorate([(0,r.Autowired)(c.CommandService),n.__metadata("design:type",Object)],E.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(c.IContextKeyService),n.__metadata("design:type",Object)],E.prototype,"contextKeyService",void 0),n.__decorate([(0,r.Autowired)(s.IWorkspaceService),n.__metadata("design:type",Object)],E.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(p.CorePreferences),n.__metadata("design:type",Object)],E.prototype,"corePreferences",void 0),n.__decorate([(0,r.Autowired)(c.PreferenceService),n.__metadata("design:type",Object)],E.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(v.LabelService),n.__metadata("design:type",v.LabelService)],E.prototype,"labelService",void 0),n.__decorate([(0,r.Autowired)(u.FileTreeDecorationService),n.__metadata("design:type",u.FileTreeDecorationService)],E.prototype,"decorationService",void 0),n.__decorate([(0,r.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],E.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(_.IIconService),n.__metadata("design:type",Object)],E.prototype,"iconService",void 0),n.__decorate([(0,r.Autowired)(c.ILogger),n.__metadata("design:type",Object)],E.prototype,"logger",void 0),n.__decorate([(0,r.Autowired)(h.FileContextKey),n.__metadata("design:type",h.FileContextKey)],E.prototype,"fileContextKey",void 0),t.FileTreeService=E=n.__decorate([(0,r.Injectable)()],E)},83709:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeNextModule=void 0;const n=e(85608),r=e(41869),o=e(72665),c=e(41103),p=e(6250),v=e(89508),m=e(40439),_=e(57781),s=e(88808),g=e(93239),l=e(97738),h=e(24861);let u=class extends r.BrowserModule{constructor(){super(...arguments),this.providers=[{token:p.IFileTreeAPI,useClass:s.FileTreeAPI},{token:g.FileTreeDecorationService,useClass:g.FileTreeDecorationService},{token:p.IFileTreeService,useClass:_.FileTreeService},{token:l.FileTreeModelService,useClass:l.FileTreeModelService},{token:o.IWindowDialogService,useClass:v.WindowDialogServiceImpl},m.FileTreeContribution]}};t.FileTreeNextModule=u,t.FileTreeNextModule=u=n.__decorate([(0,r.Domain)(h.name),(0,r.ModuleDependencies)([c.WorkspaceModule])],u)},88808:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeAPI=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(42933),v=e(72665),m=e(26199),_=e(69959);let s=class{constructor(){this.onDidResolveChildrenEmitter=new c.Emitter,this.onDidResolveChildren=this.onDidResolveChildrenEmitter.event}async resolveChildren(l,h,u,d){var E;let f;if(!this.userhomePath){const a=await this.fileServiceClient.getCurrentUserHome();a&&(this.userhomePath=new c.URI(a.uri))}if(typeof h=="string"?f=await this.fileServiceClient.getFileStat(h):f=await this.fileServiceClient.getFileStat(h.uri),f){if(this.onDidResolveChildrenEmitter.fire(f.uri.toString()),((E=f.children)===null||E===void 0?void 0:E.length)===1&&f.children[0].isDirectory&&d)return await this.resolveChildren(l,f.children[0].uri,u,d);{const a={...f,isInSymbolicDirectory:u?.filestat.isSymbolicLink||u?.filestat.isInSymbolicDirectory};return{children:this.toNodes(l,a,u),filestat:a}}}else return{children:[],filestat:null}}async resolveNodeByPath(l,h,u){const d=await this.fileServiceClient.getFileStat(h);if(d)return this.toNode(l,d,u)}async resolveFileStat(l){return await this.fileServiceClient.getFileStat(l.toString())}toNodes(l,h,u){if(u){if(h.children)return h.children.map(d=>this.toNode(l,d,u))}else return[this.toNode(l,h,u)];return[]}toNode(l,h,u,d){var E;const f=new c.URI(h.uri),a=d||f.displayName;let b;return h.isInSymbolicDirectory=(E=u?.filestat.isSymbolicLink)!==null&&E!==void 0?E:u?.filestat.isInSymbolicDirectory,h.isDirectory?b=new _.Directory(l,u,f,a,h,this.getReadableTooltip(f)):b=new _.File(l,u,f,a,h,this.getReadableTooltip(f)),b}async mvFiles(l,h){const u=[];for(const f of l)if(f.url.isEqualOrParent(h))return;const d=l.sort((f,a)=>f.toString().length-a.toString().length),E=[];for(const f of d)E.length>0&&E.find(a=>a.url.isEqualOrParent(f.url))||E.push(f);if(this.corePreferences["explorer.confirmMove"]){const f=(0,c.localize)("file.confirm.move.ok"),a=(0,c.localize)("file.confirm.move.cancel");if(await this.dialogService.warning((0,c.formatLocalize)("file.confirm.move",`[ ${E.map(y=>y.url.displayName).join(",")} ]`,h.displayName),[a,f])!==f)return}for(const f of E){const a=await this.mv(f.url,h.resolve(f.url.displayName),f.isDirectory);a&&u.push(a)}return u}async mv(l,h,u=!1){try{await this.workspaceEditService.apply({edits:[{newResource:h,oldResource:l,options:{isDirectory:u,overwrite:!0}}]})}catch(d){return d.message}}async createFile(l,h){try{await this.workspaceEditService.apply({edits:[{newResource:l,options:{content:h}}]})}catch(u){return u.message}this.commandService.executeCommand(o.EDITOR_COMMANDS.OPEN_RESOURCE.id,l,{disableNavigate:!0,focus:!0})}async createDirectory(l){try{await this.workspaceEditService.apply({edits:[{newResource:l,options:{isDirectory:!0}}]})}catch(h){return h.message}}async delete(l){try{await this.workspaceEditService.apply({edits:[{oldResource:l,options:{}}]});return}catch(h){return h.message}}async copyFile(l,h){let u=1,d;try{d=await this.fileServiceClient.access(h.toString())}catch(E){return E.message}for(;d;){const E=h.displayName.replace(/\Wcopy\W\d+/,""),f=c.path.extname(E),b=`${c.path.basename(E,f)} copy ${u}${f}`;h=h.parent.resolve(b),u++;try{d=await this.fileServiceClient.access(h.toString())}catch{return}}try{return await this.fileServiceClient.copy(l.toString(),h.toString())}catch(E){return E.message}}getReadableTooltip(l){const h=l.toString(),u=this.userhomePath&&this.userhomePath.toString();return this.userhomePath&&this.userhomePath.isEqualOrParent(l)?decodeURIComponent(h.replace(u,"~")):decodeURIComponent(l.withScheme("").toString())}};t.FileTreeAPI=s,n.__decorate([(0,r.Autowired)(p.IFileServiceClient),n.__metadata("design:type",Object)],s.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(m.IWorkspaceEditService),n.__metadata("design:type",Object)],s.prototype,"workspaceEditService",void 0),n.__decorate([(0,r.Autowired)(c.CommandService),n.__metadata("design:type",Object)],s.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(o.CorePreferences),n.__metadata("design:type",Object)],s.prototype,"corePreferences",void 0),n.__decorate([(0,r.Autowired)(v.IDialogService),n.__metadata("design:type",Object)],s.prototype,"dialogService",void 0),t.FileTreeAPI=s=n.__decorate([(0,r.Injectable)()],s)},93239:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeDecorationService=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(41893),p=e(52416);let v=class{constructor(){this.disposeCollection=new o.DisposableCollection,this.onDidChangeEmitter=new o.Emitter,this.cacheDecorations=new Map,this.disposeCollection.pushAll([this.decorationsService.onDidChangeDecorations(_=>{var s,g,l;const h=(g=(s=_._data)===null||s===void 0?void 0:s._iter)===null||g===void 0?void 0:g._value;if(h){const u=new o.URI(h),d=this.getDecoration(u);this.cacheDecorations.has(h)?((l=this.cacheDecorations.get(h))===null||l===void 0?void 0:l.tooltip)!==d?.tooltip&&this.onDidChangeEmitter.fire():(this.cacheDecorations.set(h,d),this.onDidChangeEmitter.fire())}}),this.themeService.onThemeChange(()=>{this.onDidChangeEmitter.fire()})])}get onDidChange(){return this.onDidChangeEmitter.event}getDecoration(_,s=!1){_ instanceof o.URI&&(_=o.Uri.parse(_.toString()));const g=this.decorationsService.getDecoration(_,s);return g?{...g,color:this.themeService.getColor({id:g.color})}:{color:"",tooltip:"",badge:""}}dispose(){this.disposeCollection.dispose()}};t.FileTreeDecorationService=v,n.__decorate([(0,r.Autowired)(c.IDecorationsService),n.__metadata("design:type",c.IDecorationsService)],v.prototype,"decorationsService",void 0),n.__decorate([(0,r.Autowired)(p.IThemeService),n.__metadata("design:type",Object)],v.prototype,"themeService",void 0),t.FileTreeDecorationService=v=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],v)},30577:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DragAndDropService=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(53622),m=e(14951),_=e(72665),s=e(51500),g=e(6250),l=e(69959),h=r.__importDefault(e(89200)),u=r.__importDefault(e(2613)),d=e(57781),E=e(97738);let f=n=class extends p.WithEventBus{constructor(b){super(),this.model=b,this.toCancelNodeExpansion=new p.DisposableCollection,this.beingDraggedDec=new c.Decoration(h.default.mod_dragging),this.draggedOverDec=new c.Decoration(h.default.mod_dragover),this.beingDraggedNodes=[],this.dragOverTrigger=new p.ThrottledDelayer(n.MS_TILL_DRAGGED_OVER_EXPANDS),this.handleDragStart=(y,A,S)=>{y.stopPropagation();const w=R=>{this.handleDragEnd(R,A)};y.currentTarget.addEventListener("dragend",w,!1);let T=this.model.selectedFiles,D=!1;for(const R of T)R&&R.id===A.id&&(D=!0);D||(T=[A]),this.beingDraggedNodes=T,this.beingDraggedActiveUri=S;const I=T.find(R=>!l.Directory.is(R));if(I&&y.dataTransfer.setData("uri",I.uri.toString()),y.dataTransfer.setData("beingDraggedNodes",JSON.stringify(this.beingDraggedNodes.map(R=>R.uri.toString()))),I){const R=I;R.uri.scheme==="file"&&y.dataTransfer.setData("DownloadURL",`application/octet-stream:${R.displayName}:data:application/octet-stream;base64,${(0,p.encodeBase64)(p.BinaryBuffer.fromString(R.filestat.uri))}`)}if(T.forEach(R=>{this.beingDraggedDec.addTarget(R,c.TargetMatchMode.Self)}),y.dataTransfer){let R;T.length===1?R=S?S.displayName:typeof A.name=="string"?A.name:"":R=String(T.length);const M=document.createElement("div");M.className=u.default.file_tree_drag_image,M.textContent=R,document.body.appendChild(M),y.dataTransfer.setDragImage(M,-10,-10),setTimeout(()=>document.body.removeChild(M),0)}},this.handleDragEnter=(y,A)=>{y.stopPropagation(),y.preventDefault()},this.handleDragLeave=(y,A)=>{y.preventDefault(),y.stopPropagation(),this.toCancelNodeExpansion.dispose(),this.potentialParent&&(this.draggedOverDec.removeTarget(this.potentialParent),this.model.treeModel.dispatchChange())},this.handleDragOver=(y,A)=>{if(y.preventDefault(),y.stopPropagation(),!this.toCancelNodeExpansion.disposed||this.beingDraggedNodes.indexOf(A)>=0)return;this.draggedOverNode=A;const S=l.Directory.is(A)&&A.expanded?A:A.parent;(this.potentialParent!==S||!this.draggedOverDec.hasTarget(S))&&(this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.potentialParent=S,this.draggedOverDec.addTarget(this.potentialParent,c.TargetMatchMode.SelfAndChildren),this.model.treeModel.dispatchChange()),this.potentialParent!==A&&l.Directory.is(A)&&(this.dragOverTrigger.trigger(async()=>{A.expanded?(this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.potentialParent=A,this.draggedOverDec.addTarget(this.potentialParent,c.TargetMatchMode.SelfAndChildren)):(await A.setExpanded(!0),this.draggedOverNode===A&&(this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.potentialParent=A,this.draggedOverDec.addTarget(this.potentialParent,c.TargetMatchMode.SelfAndChildren))),this.model.treeModel.dispatchChange()}),this.toCancelNodeExpansion.push(p.Disposable.create(()=>{this.dragOverTrigger.isTriggered()||this.dragOverTrigger.cancel()})))},this.handleDrop=async(y,A,S)=>{var w,T;this.eventBus.fire(new v.FileTreeDropEvent({event:y.nativeEvent,targetDir:S?S.codeUri.path:A&&A instanceof l.File?(w=A.parent)===null||w===void 0?void 0:w.uri.codeUri.path:A?A.uri.codeUri.path:new p.URI((T=this.workspaceService.workspace)===null||T===void 0?void 0:T.uri).codeUri.path}));try{y.preventDefault(),y.stopPropagation(),y.dataTransfer.dropEffect="copy";let D;const I=!!this.beingDraggedActiveUri;this.fileTreeService.isCompactMode&&S&&!A?.uri.isEqual(S)?D=null:A?D=l.Directory.is(A)?A:A.parent:D=this.root;let R;if(this.beingDraggedActiveUri){const M=this.fileTreeService.getNodeByPathOrUri(this.beingDraggedActiveUri);R=[new l.Directory(this.fileTreeService,M?.parent,this.beingDraggedActiveUri,this.beingDraggedActiveUri.displayName,{uri:this.beingDraggedActiveUri.toString(),isDirectory:!0,lastModification:new Date().getTime()},this.beingDraggedActiveUri.displayName)]}else if(R=this.beingDraggedNodes,!R||R.length===0)try{const M=JSON.parse(y.dataTransfer.getData("beingDraggedNodes"));M&&M.length!==0&&(R=M.map(O=>this.fileTreeService.getNodeByPathOrUri(new p.URI(O))).filter(Boolean),R.length||(R=await Promise.all(M.map(async O=>{const P=new p.URI(O);let k;const F=await this.filesystem.getFileStat(P.toString());return F?.isDirectory?k=new l.Directory(this.fileTreeService,this.root,P,P.displayName,{uri:P.toString(),isDirectory:!0,lastModification:new Date().getTime()},P.displayName):k=new l.File(this.fileTreeService,this.root,P,P.displayName,{uri:P.toString(),isDirectory:!0,lastModification:new Date().getTime()},P.displayName),k}))))}catch{}if(R.length>0){const M=S||D&&D.uri,O=R.filter(P=>P&&P.parent&&(this.beingDraggedActiveUri?!P.parent.uri.isEqual(M):!0));if(O.length>0){const P=await this.fileTreeAPI.mvFiles(O.map(k=>({url:k.uri,isDirectory:k.filestat.isDirectory})),M);if(P&&P.length>0)P.forEach(k=>{this.messageService.error(k)});else if(P){if(D)if(this.fileTreeService.isCompactMode&&I){for(const k of O)this.fileTreeService.refresh(k.parent);this.fileTreeService.refresh(D)}else for(const k of O){const F=D.uri.resolve(k.name);this.fileTreeService.moveNodeByPath(k.parent,D,k.name,k.name,k.type),k.updateMetaData({name:F.displayName,fileStat:{...k.filestat,uri:F.toString()},uri:F,tooltip:this.fileTreeAPI.getReadableTooltip(F)}),l.Directory.is(k)&&this.fileTreeService.refresh(k)}else if(A){if(this.fileTreeService.isCompactMode&&I)for(const k of O)this.fileTreeService.refresh(k.parent);else for(const k of O)this.fileTreeService.deleteAffectedNodeByPath(k.path);this.fileTreeService.refresh(A.parent)}}else return}}A&&this.beingDraggedDec.removeTarget(A),this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.beingDraggedNodes.forEach(M=>{this.beingDraggedDec.removeTarget(M)}),this.beingDraggedNodes=[],this.beingDraggedActiveUri=void 0,this.potentialParent=null,this.model.treeModel.dispatchChange(),this.toCancelNodeExpansion.disposed||this.toCancelNodeExpansion.dispose()}catch(D){this.logger.error(D)}},this.handleDragEnd=(y,A)=>{this.beingDraggedDec.removeTarget(A),this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.beingDraggedNodes.forEach(S=>{this.beingDraggedDec.removeTarget(S)}),this.beingDraggedNodes=[],this.beingDraggedActiveUri=void 0,this.potentialParent=null,this.model.treeModel.dispatchChange(),this.toCancelNodeExpansion.disposed||this.toCancelNodeExpansion.dispose()},this.model.decorations.addDecoration(this.beingDraggedDec),this.model.decorations.addDecoration(this.draggedOverDec)}get root(){return this.model.treeModel.root}};t.DragAndDropService=f,f.MS_TILL_DRAGGED_OVER_EXPANDS=500,r.__decorate([(0,o.Autowired)(g.IFileTreeAPI),r.__metadata("design:type",Object)],f.prototype,"fileTreeAPI",void 0),r.__decorate([(0,o.Autowired)(p.ILogger),r.__metadata("design:type",Object)],f.prototype,"logger",void 0),r.__decorate([(0,o.Autowired)(_.IMessageService),r.__metadata("design:type",Object)],f.prototype,"messageService",void 0),r.__decorate([(0,o.Autowired)(g.IFileTreeService),r.__metadata("design:type",d.FileTreeService)],f.prototype,"fileTreeService",void 0),r.__decorate([(0,o.Autowired)(m.IFileServiceClient),r.__metadata("design:type",Object)],f.prototype,"filesystem",void 0),r.__decorate([(0,o.Autowired)(s.IWorkspaceService),r.__metadata("design:type",Object)],f.prototype,"workspaceService",void 0),t.DragAndDropService=f=n=r.__decorate([(0,o.Injectable)(),r.__param(0,(0,o.Optional)()),r.__metadata("design:paramtypes",[E.FileTreeModelService])],f)},97738:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeModelService=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(91830),m=e(93899),_=e(26542),s=e(54414),g=e(14951),l=e(63067),h=e(53576),u=e(72665),d=e(6250),E=e(69959),f=e(2812),a=e(46377),b=r.__importDefault(e(89200)),y=e(57781),A=e(30577),{Path:S,isValidBasename:w}=p.path,{coalesce:T}=p.arrays,{trim:D,rtrim:I}=p.strings;let R=n=class{constructor(){this._isDisposed=!1,this._whenReady=new p.Deferred,this.selectedDecoration=new c.Decoration(b.default.mod_selected),this.focusedDecoration=new c.Decoration(b.default.mod_focused),this.contextMenuDecoration=new c.Decoration(b.default.mod_actived),this.loadingDecoration=new c.Decoration(b.default.mod_loading),this.cutDecoration=new c.Decoration(b.default.mod_cut),this._selectedFiles=[],this.disposableCollection=new p.DisposableCollection,this._isMultiSelected=!1,this.refreshedActionDelayer=new p.ThrottledDelayer(n.DEFAULT_REFRESHED_ACTION_DELAY),this.labelChangedDelayer=new p.ThrottledDelayer(n.DEFAULT_LABEL_CHANGED_DELAY),this.locationThrottler=new p.Throttler,this.onDidFocusedFileChangeEmitter=new p.Emitter,this.onDidContextMenuFileChangeEmitter=new p.Emitter,this.onDidSelectedFileChangeEmitter=new p.Emitter,this.onFileTreeModelChangeEmitter=new p.Emitter,this._initTreeModelReady=!1,this.clearFileSelectedDecoration=()=>{this.selectedDecoration.clearAppliedTarget(),this._selectedFiles=[]},this.activeFileDecoration=(O,P=!0)=>{this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),O&&(this.selectedFiles.length>0&&this.selectedDecoration.clearAppliedTarget(),this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.selectedDecoration.addTarget(O),this.focusedDecoration.addTarget(O),this.focusedFile=O,this.selectedFiles=[O],P&&this.treeModel.dispatchChange())},this.selectFileDecoration=(O,P=!0)=>{O!==this.treeModel.root&&(this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),O&&(this.selectedFiles.length>0&&this.selectedDecoration.clearAppliedTarget(),this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.selectedDecoration.addTarget(O),this._selectedFiles=[O],P&&this.treeModel.dispatchChange()))},this.activateFileActivedDecoration=O=>{this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),this.focusedFile&&(this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0),this.contextMenuDecoration.addTarget(O),this.contextMenuFile=O,this.treeModel.dispatchChange()},this.activateFileFocusedDecoration=O=>{this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),this.focusedDecoration.addTarget(O),this.focusedFile=O,this.treeModel.dispatchChange()},this.activeFileFocusedDecoration=(O,P=!1)=>{O!==this.treeModel.root&&(this.focusedFile!==O&&(P?(this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.contextMenuFile=O):this.focusedFile&&(this.contextMenuFile=void 0,this.focusedDecoration.clearAppliedTarget()),O&&(this._selectedFiles.indexOf(O)<0&&(this.selectedDecoration.addTarget(O),this._selectedFiles.push(O),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(k=>k.uri))),this.focusedDecoration.addTarget(O),this.focusedFile=O)),this.treeModel.dispatchChange())},this.toggleFileSelectedDecoration=O=>{const P=this._selectedFiles.indexOf(O);P>-1?(this.focusedFile===O&&(this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0),this._selectedFiles.splice(P,1),this.selectedDecoration.clearAppliedTarget()):(this._selectedFiles.push(O),this.selectedDecoration.addTarget(O),this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.focusedFile=O,this.focusedDecoration.addTarget(O)),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(k=>k.uri)),this.treeModel.dispatchChange()},this.activeFileDecorationByRange=(O,P)=>{for(this.clearFileSelectedDecoration(),this.contextMenuFile=void 0;O<=P;O++){const k=this.treeModel.root.getTreeNodeAtIndex(O);k&&(this._selectedFiles.push(k),this.selectedDecoration.addTarget(k))}this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(k=>k.uri)),this.treeModel.dispatchChange()},this.deactivateFileDecoration=()=>{var O;this.focusedFile&&(this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0),this.contextMenuFile&&this.contextMenuDecoration.removeTarget(this.contextMenuFile),(O=this.treeModel)===null||O===void 0||O.dispatchChange()},this.toggleDirectory=async O=>{O.expanded?this.fileTreeHandle.collapseNode(O):this.fileTreeHandle.expandNode(O)},this.handleDblClick=()=>{this.commandService.executeCommand(p.FILE_COMMANDS.NEW_FILE.id)},this.handleContextMenu=(O,P,k)=>{var F;O.stopPropagation(),O.preventDefault();let L,B;P?(B=P,this._isMultiSelected?this.selectedFiles.indexOf(B)>=0?L=this.selectedFiles:L=[B]:L=[B]):(L=[this.treeModel.root],B=this.treeModel.root),this.activateFileActivedDecoration(B),this.setFileTreeContextKey(B),this.fileTreeService.isCompactMode&&k?(this._activeUri=k,(F=this.contextKey)===null||F===void 0||F.explorerResourceIsFolder.set(!0)):k||(this._activeUri=null);const j=this.contextMenuService.createMenu({id:m.MenuId.ExplorerContext,contextKeyService:this.fileTreeService.contextMenuContextKeyService}),W=j.getMergedMenuNodes();j.dispose(),this.updateExplorerCompressedContextKey(B,k);const{x:U,y:Q}=O.nativeEvent;this.ctxMenuRenderer.show({anchor:{x:U,y:Q},menuNodes:W,args:k?[k,[k]]:[B.uri,L.map(V=>V.uri)]})},this.handleTreeBlur=()=>{var O,P,k;this._isDisposed||((P=(O=this.contextKey)===null||O===void 0?void 0:O.filesExplorerFocused)===null||P===void 0||P.set(!1),this.deactivateFileDecoration(),(k=this.contextKey)===null||k===void 0||k.explorerResourceIsFolder.set(!1))},this.handleTreeFocus=()=>{var O,P;(P=(O=this.contextKey)===null||O===void 0?void 0:O.filesExplorerFocused)===null||P===void 0||P.set(!0)},this.handleItemRangeClick=(O,P)=>{if(this.selectedFiles.length===1&&E.Directory.isRoot(this.selectedFiles[0])&&this.clearFileSelectedDecoration(),!this.focusedFile)this.handleItemClick(O,P);else if(this.focusedFile&&this.focusedFile!==O){this._isMultiSelected=!0;const k=this.treeModel.root.getIndexAtTreeNode(O),F=this.treeModel.root.getIndexAtTreeNode(this.focusedFile);F>k?this.activeFileDecorationByRange(k,F):F<k&&this.activeFileDecorationByRange(F,k)}},this.handleItemToggleClick=(O,P)=>{this._isMultiSelected=!0,!(P!==c.TreeNodeType.CompositeTreeNode&&P!==c.TreeNodeType.TreeNode)&&(this.selectedFiles.length===1&&E.Directory.isRoot(this.selectedFiles[0])&&this.clearFileSelectedDecoration(),this.toggleFileSelectedDecoration(O))},this.handleItemClick=(O,P=this.fileTreeService.isMultipleWorkspace?c.TreeNodeType.TreeNode:c.TreeNodeType.CompositeTreeNode,k)=>{var F,L,B,j;if(this.treeModel&&(O||(O=this.treeModel.root),this.updateExplorerCompressedContextKey(O,k),this._isMultiSelected=!1,(P===c.TreeNodeType.CompositeTreeNode||P===c.TreeNodeType.TreeNode)&&this.activeFileDecoration(O),this.fileTreeService.isCompactMode&&k?(this._activeUri=k,(F=this.contextKey)===null||F===void 0||F.explorerResourceIsFolder.set(!0)):k||(this._activeUri=null,(L=this.contextKey)===null||L===void 0||L.explorerResourceIsFolder.set(P===c.TreeNodeType.CompositeTreeNode)),this.corePreferences["workbench.list.openMode"]==="singleClick")){if(P===c.TreeNodeType.CompositeTreeNode){if((B=this.contextKey)===null||B===void 0||B.explorerResourceIsFolder.set(!0),O===this.treeModel.root)return;this.toggleDirectory(O)}else if(P===c.TreeNodeType.TreeNode){if((j=this.contextKey)===null||j===void 0||j.explorerResourceIsFolder.set(!1),O===this.treeModel.root)return;this.fileTreeService.openFile(O.uri),this.mainlayoutService.bottomExpanded&&this.commandService.executeCommand(h.RETRACT_BOTTOM_PANEL.id)}}},this.handleItemDoubleClick=(O,P)=>{P===c.TreeNodeType.TreeNode?this.fileTreeService.openAndFixedFile(O.uri):this.corePreferences["workbench.list.openMode"]==="doubleClick"&&this.toggleDirectory(O)},this.validateFileName=(O,P)=>{var k;if(P=this.getWellFormedFileName(P),!P||P.length===0||/^\s+$/.test(P))return{message:(0,p.localize)("validate.tree.emptyFileNameError"),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P};if(P[0]==="/"||P[0]==="\\")return{message:(0,p.localize)("validate.tree.fileNameStartsWithSlashError"),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P};if(P[0]===" "||P[P.length-1]===" ")return{message:(0,p.localize)("validate.tree.fileNameFollowOrStartWithSpaceWarning"),type:c.PROMPT_VALIDATE_TYPE.WARNING,value:P};let F;if(O.target){const B=O.target;if(P===B.name)return null;F=B.parent}else F=O.parent;return F&&!(O instanceof c.RenamePromptHandle&&O.target.displayName.indexOf(S.separator)>0)&&((k=F.children)===null||k===void 0?void 0:k.find(W=>W.name===P))?{message:(0,p.formatLocalize)("validate.tree.fileNameExistsError",P),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P}:T(P.split(/[\\/]/)).some(B=>!w(B))?{message:(0,p.formatLocalize)("validate.tree.invalidFileNameError",this.trimLongName(P)),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P}:null},this.proxyPrompt=O=>{let P=!1;const k=async V=>{const $=await this.fileTreeService.getNodeByPathOrUri(V);$&&(E.Directory.is($)?this.selectFileDecoration($):this.location($.uri))},F=async V=>{var $,Y,G;if(this.validateMessage=void 0,O instanceof c.RenamePromptHandle){const z=O.target,K=O.target.displayName.split(S.separator),Z=z.name.indexOf(S.separator)>0;if(Z&&this.activeUri&&!O.target.uri.toString().includes(this.activeUri.toString()))return!1;const X=this.activeUri?K.length-O.target.uri.toString().replace(this.activeUri.toString(),"").split(S.separator).length:-1,oe=X===-1?[]:K.slice(0,X).concat(V);let ne=z.uri,ue=z.parent.uri.resolve(V);if(Z&&(($=this.activeUri)===null||$===void 0?void 0:$.displayName)===V||!Z&&V===z.name)return!0;O.addAddonAfter("loading_indicator"),Z&&oe.length>0&&E.Directory.is(z.parent)&&(ne=z.parent.uri.resolve(K.slice(0,X+1).join(S.separator)),ue=z.parent.uri.resolve(oe.concat().join(S.separator)));const fe=await this.fileTreeAPI.mv(ne,ue,z.type===c.TreeNodeType.CompositeTreeNode);if(fe)return this.validateMessage={type:c.PROMPT_VALIDATE_TYPE.ERROR,message:fe,value:V},this.fileTreeService.updateRefreshable(!0),O.addValidateMessage(this.validateMessage),!1;if(this.fileTreeService.updateRefreshable(!1),O.removeAddonAfter(),!Z&&z.parent){const q=await this.fileTreeService.moveNodeByPath(z.parent,z.parent,z.name,V,z.type);q&&this.selectFileDecoration(q,!1),this.fileTreeService.updateRefreshable(!0)}else if(E.Directory.is(z)&&!E.Directory.isRoot(z)){z.updateMetaData({name:oe.concat(K.slice(X+1)).join(S.separator),uri:ue,fileStat:{...z.filestat,uri:ue.toString()},tooltip:this.fileTreeAPI.getReadableTooltip(ue)}),this.treeModel.dispatchChange();let q;E.Directory.is(z.parent)&&(!((Y=z.parent.children)===null||Y===void 0)&&Y.find(Ae=>z.path.indexOf(Ae.path)>=0))?q=this.fileTreeService.refresh(z.parent):q=this.fileTreeService.refresh(z),q.then(()=>{k(ue)})}O.removeAddonAfter()}else if(O instanceof c.NewPromptHandle){const z=O.parent,K=z.uri.resolve(V);let Z;if(O.addAddonAfter("loading_indicator"),this.fileTreeService.updateRefreshable(!0),O.type===c.TreeNodeType.CompositeTreeNode?Z=await this.fileTreeAPI.createDirectory(K):Z=await this.fileTreeAPI.createFile(K),O.removeAddonAfter(),Z)return this.validateMessage={type:c.PROMPT_VALIDATE_TYPE.ERROR,message:Z,value:V},this.fileTreeService.updateRefreshable(!1),O.addValidateMessage(this.validateMessage),!1;if(V.includes(S.separator)&&this.fileTreeService.refresh(z).then(()=>{k(z.uri.resolve(V))}),this.fileTreeService.isCompactMode)if(O.type===c.TreeNodeType.CompositeTreeNode)if((!z.children||z.children.length===0)&&!E.Directory.isRoot(z)){const oe=z.uri.resolve(V),ne=[z.name].concat(V).join(S.separator);z.updateMetaData({name:ne,uri:oe,fileStat:{...z.filestat,uri:oe.toString()},tooltip:this.fileTreeAPI.getReadableTooltip(oe)}),k(oe)}else await this.fileTreeService.addNode(z,V,O.type),k(z.uri.resolve(V));else await this.fileTreeService.addNode(z,V,O.type),k(z.uri.resolve(V));else await this.fileTreeService.addNode(z,V,O.type),k(z.uri.resolve(V))}return(G=this.contextKey)===null||G===void 0||G.filesExplorerInputFocused.set(!1),!0},L=async V=>{var $,Y,G,z;if(this.validateMessage&&this.validateMessage.type===c.PROMPT_VALIDATE_TYPE.ERROR)return this.validateMessage=void 0,!0;if(P)return!1;if(!V){($=this.contextKey)===null||$===void 0||$.explorerCompressedFocusContext.set(!1),(Y=this.contextKey)===null||Y===void 0||Y.explorerCompressedFirstFocusContext.set(!1),(G=this.contextKey)===null||G===void 0||G.explorerCompressedLastFocusContext.set(!1),this.fileTreeService.isCompactMode&&O instanceof c.NewPromptHandle&&this.fileTreeService.refresh(O.parent);return}return(z=this.contextKey)===null||z===void 0||z.filesExplorerInputFocused.set(!1),await F(V),!0},B=async V=>{if(P=!0,this.validateMessage&&this.validateMessage.type===c.PROMPT_VALIDATE_TYPE.ERROR)return!1;if(V.trim()===""||this.validateMessage&&this.validateMessage.type!==c.PROMPT_VALIDATE_TYPE.ERROR)return this.validateMessage=void 0,!0;const $=await F(V);return P=!1,!!$},j=async()=>{var V;(V=this.contextKey)===null||V===void 0||V.filesExplorerInputFocused.set(!0)},W=()=>{var V;this.fileTreeService.updateRefreshable(!0),(V=this.contextKey)===null||V===void 0||V.filesExplorerInputFocused.set(!1),this.contextMenuFile&&this.selectFileDecoration(this.contextMenuFile,!0)},U=()=>{var V;(V=this.contextKey)===null||V===void 0||V.filesExplorerInputFocused.set(!1),this.fileTreeService.isCompactMode&&O instanceof c.NewPromptHandle&&this.fileTreeService.refresh(O.parent)},Q=V=>{const $=this.validateFileName(O,V);$?(this.validateMessage=$,O.addValidateMessage($)):!$&&this.validateMessage&&this.validateMessage.value!==V&&(this.validateMessage=void 0,O.removeValidateMessage())};O.destroyed||(this.fileTreeService.updateRefreshable(!1),O.onChange(Q),O.onCommit(B),O.onBlur(L),O.onFocus(j),O.onDestroy(W),O.onCancel(U))},this.copyFile=async O=>{var P;this.pasteStore&&this.pasteStore.type===d.PasteTypes.CUT&&(this._pasteStore.files.forEach(F=>{F&&this.cutDecoration.removeTarget(F)}),(P=this.contextKey)===null||P===void 0||P.explorerResourceCut.set(!1)),this.treeModel.dispatchChange();const k=[];for(const F of O){const L=this.fileTreeService.getNodeByPathOrUri(F);L&&k.push(L)}this._pasteStore={files:k,type:d.PasteTypes.COPY},this.clipboardService.writeResources(O)},this.pasteFile=async O=>{var P,k;let F=!1,L=this.fileTreeService.getNodeByPathOrUri(O.toString());if(!L)return;let B=this.pasteStore,j=!1;if(!B){const W=await this.clipboardService.readResources();if(!W||!W.length)return;B={files:[],type:d.PasteTypes.COPY,crossFiles:W},j=!0}if(B){if(E.Directory.is(L)||(F=!0,L=L.parent),j){const W=(0,p.localize)("file.confirm.paste.ok"),U=(0,p.localize)("file.confirm.paste.cancel");if(await this.dialogService.warning((0,p.formatLocalize)("file.confirm.paste",`[ ${(P=B.crossFiles)===null||P===void 0?void 0:P.map(V=>V.displayName).join(",")} ]`,E.Directory.isRoot(L)?L.uri.displayName:L.displayName),[U,W])!==W)return}if(B.type===d.PasteTypes.CUT){for(const U of B.files)U&&this.cutDecoration.removeTarget(U),L.expanded||await L.setExpanded(!0);const W=await this.fileTreeAPI.mvFiles(B.crossFiles?B.crossFiles.map(U=>{var Q;return{url:U,isDirectory:((Q=this.fileTreeService.getNodeByPathOrUri(U))===null||Q===void 0?void 0:Q.filestat.isDirectory)||!1}}):B.files.map(U=>({url:U.uri,isDirectory:U.filestat.isDirectory})),L.uri);W&&W.length>0&&(W.forEach(U=>{this.messageService.error(U)}),this.fileTreeService.refresh()),(k=this.contextKey)===null||k===void 0||k.explorerResourceCut.set(!1),this.treeModel.dispatchChange(),this._pasteStore={files:[],type:d.PasteTypes.NONE,crossFiles:void 0}}else if(B.type===d.PasteTypes.COPY){const W=B.crossFiles?B.crossFiles:B.files.map(U=>U.uri);for(const U of W){L.uri.isEqual(U)&&!F&&(L=L.parent);const Q=L.uri.resolve(U.displayName);L.expanded||await L.setExpanded(!0);const V=await this.fileTreeAPI.copyFile(U,Q);if(V)if(V.uri){const $=new p.URI(V.uri),Y=await this.filesystem.getFileStat(U.toString());this.fileTreeService.addNode(L,$.displayName,Y?.isDirectory?c.TreeNodeType.CompositeTreeNode:c.TreeNodeType.TreeNode)}else this.messageService.error(`Error when copy file: ${U.toString()}, ${V}`)}}}},this.cutFile=async O=>{var P;O.length>0&&((P=this.contextKey)===null||P===void 0||P.explorerResourceCut.set(!0)),this._pasteStore&&this._pasteStore.type===d.PasteTypes.CUT&&this._pasteStore.files.forEach(F=>{this.cutDecoration.removeTarget(F)});const k=[];for(const F of O){const L=this.fileTreeService.getNodeByPathOrUri(F);L&&k.push(L)}this._pasteStore={files:k,type:d.PasteTypes.CUT};for(const F of k)F&&this.cutDecoration.addTarget(F);this.treeModel.dispatchChange()},this.location=async O=>{if(await this.whenReady,!this.fileTreeService.filterMode)return this._fileToLocation=O,this.locationThrottler.queue(this.doLocation)},this.doLocation=async()=>{if(!this._fileToLocation)return;const O=this._fileToLocation;let P;if(typeof O=="string"?P=O:P=await this.fileTreeService.getFileTreeNodePathByUri(O),P){if(!this.fileTreeHandle)return;const k=await this.fileTreeHandle.ensureVisible(P,"center",!0);k&&this.selectFileDecoration(k)}this._fileToLocation=void 0},this.locationOnShow=O=>{this._nextLocationTarget=O},this.performLocationOnHandleShow=async()=>{this._nextLocationTarget&&(await this.location(this._nextLocationTarget),this._nextLocationTarget=void 0)}}get onDidFocusedFileChange(){return this.onDidFocusedFileChangeEmitter.event}get onDidContextMenuFileChange(){return this.onDidContextMenuFileChangeEmitter.event}get onDidSelectedFileChange(){return this.onDidSelectedFileChangeEmitter.event}get onFileTreeModelChange(){return this.onFileTreeModelChangeEmitter.event}get fileTreeHandle(){return this._fileTreeHandle}get decorations(){return this._decorations}get treeModel(){return this._treeModel}get dndService(){return this._dndService}get whenReady(){return this._whenReady.promise}get focusedFile(){return this._focusedFile}set focusedFile(O){this.onDidFocusedFileChangeEmitter.fire(O?O.uri:void 0),this._focusedFile=O}get contextMenuFile(){return this._contextMenuFile}set contextMenuFile(O){this.onDidContextMenuFileChangeEmitter.fire(O?O.uri:void 0),this._contextMenuFile=O}get selectedFiles(){return this._selectedFiles}set selectedFiles(O){this.onDidSelectedFileChangeEmitter.fire(O?O.map(P=>P.uri):[]),this._selectedFiles=O}get activeUri(){return this._activeUri}get pasteStore(){return this._pasteStore}get explorerStorage(){return this._explorerStorage}get currentRelativeUriContextKey(){return this._currentRelativeUriContextKey||(this._currentRelativeUriContextKey=this.fileTreeService.contextMenuContextKeyService.createKey("filetreeContextRelativeUri","")),this._currentRelativeUriContextKey}get currentContextUriContextKey(){return this._currentContextUriContextKey||(this._currentContextUriContextKey=this.fileTreeService.contextMenuContextKeyService.createKey("filetreeContextUri","")),this._currentContextUriContextKey}get contextMenuResourceContext(){return this._contextMenuResourceContext||(this._contextMenuResourceContext=new v.ResourceContextKey(this.fileTreeService.contextMenuContextKeyService)),this._contextMenuResourceContext}get contextKey(){return this.fileTreeService.contextKey}get initTreeModelReady(){return this._initTreeModelReady}async initTreeModel(){this._initTreeModelReady=!1;const O=(await this.fileTreeService.resolveChildren())[0];if(!O){this._whenReady.resolve();return}this._treeModel=this.injector.get(f.FileTreeModel,[O]),this.initDecorations(O),this._dndService=this.injector.get(A.DragAndDropService,[this]),this.treeStateWatcher=this._treeModel.getTreeStateWatcher(!0),this.disposableCollection.push(this.fileTreeService.onNodeRefreshed(()=>{this.initTreeModelReady&&(this.refreshedActionDelayer.isTriggered()||this.refreshedActionDelayer.cancel(),this.refreshedActionDelayer.trigger(async()=>{if(this.selectedFiles.length===0){const k=this.editorService.currentEditor;k&&k.currentUri&&this.location(k.currentUri)}this.fileTreeService.isCompactMode||(this._activeUri=null)}))})),this.disposableCollection.push(this.fileTreeService.onWorkspaceChange(()=>{this.disposableCollection.dispose(),this.initTreeModel()})),this.disposableCollection.push(this.labelService.onDidChange(async()=>{this.initTreeModelReady&&(this.labelChangedDelayer.isTriggered()||this.labelChangedDelayer.cancel(),this.labelChangedDelayer.trigger(async()=>{this.fileTreeService.refresh()}))})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.WillResolveChildren,k=>{this.loadingDecoration.addTarget(k),this.treeModel.dispatchChange()})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.DidResolveChildren,k=>{this.loadingDecoration.clearAppliedTarget(),this.treeModel.dispatchChange()})),this._explorerStorage=await this.storageProvider(p.STORAGE_NAMESPACE.EXPLORER);const P=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY);P&&await this.loadFileTreeSnapshot(P),this.disposableCollection.push(this.treeStateWatcher.onDidChange(()=>{if(!this._initTreeModelReady)return;const k=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY),F=this.treeStateWatcher.snapshot();this.explorerStorage.set(n.FILE_TREE_SNAPSHOT_KEY,{...k,...F})})),this.fileTreeService.startWatchFileEvent(),this.onFileTreeModelChangeEmitter.fire(this._treeModel),this._whenReady.resolve(),this._initTreeModelReady=!0}initDecorations(O){this._decorations=new c.DecorationsManager(O),this._decorations.addDecoration(this.selectedDecoration),this._decorations.addDecoration(this.focusedDecoration),this._decorations.addDecoration(this.contextMenuDecoration),this._decorations.addDecoration(this.cutDecoration),this._decorations.addDecoration(this.loadingDecoration)}setFileTreeContextKey(O){var P;this.currentContextUriContextKey.set(O.uri.toString()),this.currentRelativeUriContextKey.set((this.treeModel.root.uri.relative(O.uri)||"").toString()),this.contextMenuResourceContext.set(O.uri),(P=this.contextKey)===null||P===void 0||P.explorerResourceIsFolder.set(O&&O.type===c.TreeNodeType.CompositeTreeNode)}async loadFileTreeSnapshot(O){await this._treeModel.loadTreeState(O)}updateExplorerCompressedContextKey(O,P){var k,F,L,B,j,W,U,Q,V,$,Y,G,z,K,Z,X;if(O&&P){(k=this.contextKey)===null||k===void 0||k.explorerCompressedFocusContext.set(!0);const oe=new S(O.name);oe.name===P.displayName?((F=this.contextKey)===null||F===void 0||F.explorerCompressedLastFocusContext.set(!0),(L=this.contextKey)===null||L===void 0||L.explorerCompressedFirstFocusContext.set(!1)):oe.root&&oe.root.name===P.displayName?((B=this.contextKey)===null||B===void 0||B.explorerCompressedLastFocusContext.set(!1),(j=this.contextKey)===null||j===void 0||j.explorerCompressedFirstFocusContext.set(!0)):((W=this.contextKey)===null||W===void 0||W.explorerCompressedLastFocusContext.set(!1),(U=this.contextKey)===null||U===void 0||U.explorerCompressedFirstFocusContext.set(!1))}else O?O.name.indexOf(S.separator)>0?((Q=this.contextKey)===null||Q===void 0||Q.explorerCompressedFocusContext.set(!0),(V=this.contextKey)===null||V===void 0||V.explorerCompressedFirstFocusContext.set(!1),($=this.contextKey)===null||$===void 0||$.explorerCompressedLastFocusContext.set(!0)):((Y=this.contextKey)===null||Y===void 0||Y.explorerCompressedFocusContext.set(!1),(G=this.contextKey)===null||G===void 0||G.explorerCompressedFirstFocusContext.set(!1),(z=this.contextKey)===null||z===void 0||z.explorerCompressedLastFocusContext.set(!1)):((K=this.contextKey)===null||K===void 0||K.explorerCompressedFocusContext.set(!1),(Z=this.contextKey)===null||Z===void 0||Z.explorerCompressedFirstFocusContext.set(!1),(X=this.contextKey)===null||X===void 0||X.explorerCompressedLastFocusContext.set(!1))}handleTreeHandler(O){this._fileTreeHandle=O}toggleOrOpenCurrentFile(){let O;this.focusedFile?O=this.focusedFile:this.contextMenuFile&&(O=this.contextMenuFile),O&&(this.activeFileDecoration(O),E.Directory.is(O)?this.toggleDirectory(O):this.fileTreeService.openFile(O.uri))}moveToNext(){let O;if(this.focusedFile?O=this.focusedFile:this.contextMenuFile&&(O=this.contextMenuFile),!O)return;const k=this.treeModel.root.getIndexAtTreeNode(O)+1,F=this.treeModel.root.getTreeNodeAtIndex(k),L=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY),B=(k+1)*a.FILE_TREE_NODE_HEIGHT-(L.scrollPosition||0),{height:j}=this.fileTreeHandle.getCurrentSize();F&&(this.activateFileFocusedDecoration(F),B>j&&this.fileTreeHandle.ensureVisible(F,"end"))}moveToPrev(){let O;if(this.focusedFile?O=this.focusedFile:this.contextMenuFile&&(O=this.contextMenuFile),!O)return;const P=this.treeModel.root.getIndexAtTreeNode(O);if(P===0)return;const k=P-1,F=this.treeModel.root.getTreeNodeAtIndex(k);if(!F)return;const L=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY),B=k*a.FILE_TREE_NODE_HEIGHT;this.activateFileFocusedDecoration(F),(L.scrollPosition||0)>B&&this.fileTreeHandle.ensureVisible(F,"start")}async collapseCurrentFile(){let O;this.focusedFile?(O=this.focusedFile,this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0):this.contextMenuFile&&(O=this.contextMenuFile,this.focusedDecoration.removeTarget(this.contextMenuFile),this.contextMenuFile=void 0);const P=this.selectedFiles.indexOf(O);P>=0&&(this.selectedFiles.splice(P,1),this.selectedDecoration.removeTarget(O));let k;if(E.Directory.is(O)&&O.expanded)k=O;else if(O)E.Directory.isRoot(O.parent)?k=O:k=O.parent;else return;this.focusedFile=k,k&&k.expanded&&(await this.fileTreeHandle.collapseNode(k),this.activeFileFocusedDecoration(k,!0))}async expandCurrentFile(){let O;this.focusedFile?(O=this.focusedFile,this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0):this.contextMenuFile&&(O=this.contextMenuFile,this.focusedDecoration.removeTarget(this.contextMenuFile),this.contextMenuFile=void 0);const P=this.selectedFiles.indexOf(O);P>=0&&(this.selectedFiles.splice(P,1),this.selectedDecoration.removeTarget(O)),this.focusedFile=O,E.Directory.is(O)&&(O.expanded||await this.fileTreeHandle.expandNode(O))}async collapseAll(){await this.treeModel.root.collapsedAll();const O=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY);O&&this.explorerStorage.set(n.FILE_TREE_SNAPSHOT_KEY,{...O,expandedDirectories:{atSurface:[],buried:[]}})}async deleteFileByUris(O){var P;if(O.length===0)return;if(this.corePreferences["explorer.confirmDelete"]){const B=this.applicationService.backendOS===p.OperatingSystem.Linux,j=B?(0,p.localize)("file.confirm.delete.ok"):(0,p.localize)("file.confirm.moveToTrash.ok"),W=(0,p.localize)("file.confirm.delete.cancel"),U=10;let Q=O.slice(0,U).map($=>$.displayName).join(`
31188
+ `,y){const A=this.hashCalculateService.calculate(d);return u.length>m.FILE_SAVE_BY_CHANGE_THRESHOLD?await this.fileSchemeDocClient.saveByChange(h.toString(),{baseMd5:A,changes:E,eol:b},f,a,y):await this.fileSchemeDocClient.saveByContent(h.toString(),{baseMd5:A,content:u},f,a,y)}async provideEditorDocumentModelContentMd5(h,u){return this.fileSchemeDocClient.getMd5(h.toString(),u)}};t.FileSchemeDocumentProvider=_,n.__decorate([(0,r.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],_.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(m.IFileSchemeDocClient),n.__metadata("design:type",Object)],_.prototype,"fileSchemeDocClient",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],_.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(c.IHashCalculateService),n.__metadata("design:type",Object)],_.prototype,"hashCalculateService",void 0),t.FileSchemeDocumentProvider=_=n.__decorate([(0,r.Injectable)()],_);let s=class{constructor(){this._onDidChangeContent=new o.Emitter,this.onDidChangeContent=this._onDidChangeContent.event,this.listeners={}}isReadonly(h){return!0}handlesScheme(h){return h==="vscode"}async provideEditorDocumentModelContent(h,u){return this.getSchemaContent(h)}getSchemaContent(h){const u=h.toString(),d=this.jsonRegistry.getSchemaContributions().schemas[u];if(d){const E=JSON.stringify(d);if(!this.listeners[u]){const f=o.Disposable.create(()=>{this.jsonRegistry.onDidChangeSchema(a=>{a===u&&this._onDidChangeContent.fire(h)})});this.listeners[u]=f}return E}return"{}"}onDidDisposeModel(h){h.toString()&&(this.listeners[h.toString()].dispose(),delete this.listeners[h.toString()])}};t.VscodeSchemeDocumentProvider=s,n.__decorate([(0,r.Autowired)(o.ISchemaStore),n.__metadata("design:type",Object)],s.prototype,"schemaStore",void 0),n.__decorate([(0,r.Autowired)(o.IJSONSchemaRegistry),n.__metadata("design:type",Object)],s.prototype,"jsonRegistry",void 0),t.VscodeSchemeDocumentProvider=s=n.__decorate([(0,r.Injectable)()],s);let g=class{constructor(){this.documentContentMaps=new Map,this._onDidChangeContent=new o.Emitter,this.onDidChangeContent=this._onDidChangeContent.event}handlesScheme(h){return h===o.Schemes.walkThroughSnippet}provideEditorDocumentModelContent(h,u){return this.documentContentMaps.has(h.toString())||this.documentContentMaps.set(h.toString(),""),this.documentContentMaps.get(h.toString())}isReadonly(){return!1}preferLanguageForUri(){return"plaintext"}};t.WalkThroughSnippetSchemeDocumentProvider=g,t.WalkThroughSnippetSchemeDocumentProvider=g=n.__decorate([(0,r.Injectable)()],g)},41352:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSchemeDocClientService=void 0;const n=e(85608),r=e(76003),o=e(80449);let c=class{saveByChange(v,m,_,s,g){return this.fileDocBackendService.$saveByChange(v,m,_,s,g)}saveByContent(v,m,_,s,g){return this.fileDocBackendService.$saveByContent(v,m,_,s,g)}getMd5(v,m){return this.fileDocBackendService.$getMd5(v,m)}};t.FileSchemeDocClientService=c,n.__decorate([(0,r.Autowired)(o.FileSchemeDocNodeServicePath),n.__metadata("design:type",Object)],c.prototype,"fileDocBackendService",void 0),t.FileSchemeDocClientService=c=n.__decorate([(0,r.Injectable)()],c)},17276:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSystemEditorComponentContribution=t.FileSystemEditorResourceContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(26542),p=e(57517),v=e(17878),m=e(42933),_=e(57646),s=e(60387),g=e(88819),l=e(99025),h="video-preview",u="image-preview",d="external-file",E="large-file-prevent";let f=class{registerResource(y){y.registerResourceProvider(this.untitledResourceProvider)}registerEditorDocumentModelContentProvider(y){y.registerEditorDocumentModelContentProvider(this.fileSchemeDocumentProvider),y.registerEditorDocumentModelContentProvider(this.vscodeSchemeDocumentProvider),y.registerEditorDocumentModelContentProvider(this.walkThroughSnippetSchemeDocumentProvider),y.registerEditorDocumentModelContentProvider(this.untitledSchemeDocumentProvider)}};t.FileSystemEditorResourceContribution=f,n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.FileSchemeDocumentProvider)],f.prototype,"fileSchemeDocumentProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.VscodeSchemeDocumentProvider)],f.prototype,"vscodeSchemeDocumentProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.WalkThroughSnippetSchemeDocumentProvider)],f.prototype,"walkThroughSnippetSchemeDocumentProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",v.UntitledSchemeResourceProvider)],f.prototype,"untitledResourceProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",v.UntitledSchemeDocumentProvider)],f.prototype,"untitledSchemeDocumentProvider",void 0),t.FileSystemEditorResourceContribution=f=n.__decorate([(0,o.Domain)(p.BrowserEditorContribution)],f);let a=class{constructor(){this.cachedFileType=new o.LRUMap(200,100),this.fileServiceClient.onFilesChanged(y=>{y.forEach(A=>{this.cachedFileType.delete(A.uri.toString())})})}registerEditorComponent(y){y.registerEditorComponent({component:l.ImagePreview,uid:u,scheme:o.Schemes.file}),y.registerEditorComponent({component:l.VideoPreview,uid:h,scheme:o.Schemes.file}),y.registerEditorComponent({component:_.BinaryEditorComponent,uid:d,scheme:o.Schemes.file}),y.registerEditorComponent({component:g.LargeFilePrevent,uid:E,scheme:o.Schemes.file}),y.registerEditorComponentResolver(A=>A===o.Schemes.file||this.fileServiceClient.handlesScheme(A)?10:-1,(A,S)=>{S.length===0&&S.push({type:p.EditorOpenType.component,componentId:d})}),y.registerEditorComponentResolver(A=>A===o.Schemes.file||this.fileServiceClient.handlesScheme(A)?10:-1,async(A,S)=>{const w=await this.getFileType(A.uri.toString());switch(w){case"image":{S.push({type:p.EditorOpenType.component,componentId:u});break}case"video":{S.push({type:p.EditorOpenType.component,componentId:h});break}case"binary":case"text":{const{metadata:T,uri:D}=A,I=T||{};if(w==="binary"&&!I.skipPreventBinary)break;const R=await this.fileServiceClient.getFileStat(D.toString());await this.preference.ready;const M=this.preference.getValid("editor.largeFile",4*1024*1024*1024);R&&(R.size||0)>M&&!I.skipPreventTooLarge?S.push({type:p.EditorOpenType.component,componentId:E}):S.push({type:p.EditorOpenType.code,title:(0,o.localize)("editorOpenType.code")});break}}}),y.registerEditorComponentResolver(o.Schemes.untitled,(A,S,w)=>{w([{type:p.EditorOpenType.code,priority:"default"}])})}async getFileType(y){return this.cachedFileType.has(y)||((0,c.getLanguageIdFromMonaco)(new o.URI(y))?this.cachedFileType.set(y,"text"):this.cachedFileType.set(y,await this.getRealFileType(y))),this.cachedFileType.get(y)}async getRealFileType(y){try{return await this.fileServiceClient.getFileType(y)}catch{return"text"}}};t.FileSystemEditorComponentContribution=a,n.__decorate([(0,r.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],a.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],a.prototype,"preference",void 0),t.FileSystemEditorComponentContribution=a=n.__decorate([(0,o.Domain)(p.BrowserEditorContribution),n.__metadata("design:paramtypes",[])],a)},52568:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSchemeModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(80449),p=e(41352),v=e(17276);let m=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[v.FileSystemEditorResourceContribution,v.FileSystemEditorComponentContribution,{token:c.IFileSchemeDocClient,useClass:p.FileSchemeDocClientService}],this.backServices=[{servicePath:c.FileSchemeDocNodeServicePath}]}};t.FileSchemeModule=m,t.FileSchemeModule=m=n.__decorate([(0,r.Injectable)()],m)},88819:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LargeFilePrevent=t.PreventComponent=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(41869),p=e(81878),v=e(54414),m=e(82196),_=n.__importDefault(e(19996)),s=l=>o.default.createElement("div",{className:_.default["error-page"]},o.default.createElement("div",{className:(0,r.default)(_.default.icon,(0,c.getExternalIcon)("warning"))}),o.default.createElement("div",{className:_.default.description},l.description),o.default.createElement("div",{className:_.default["actions-wrapper"]},l.actions.map((h,u)=>o.default.createElement(p.Button,{key:u,onClick:()=>h.onClick(),className:_.default["action-button"]},h.label))));t.PreventComponent=s;const g=()=>{const l=(0,c.useInjectable)(v.WorkbenchEditorService),h=(0,c.useInjectable)(c.IEventBus),u=()=>{const d=l.currentResource;d&&(d.metadata={...d.metadata,skipPreventTooLarge:!0},h.fire(new m.ResourceOpenTypeChangedEvent(d.uri)))};return o.default.createElement(t.PreventComponent,{description:(0,c.localize)("editor.largeFile.prevent"),actions:[{label:(0,c.localize)("editor.file.prevent.stillOpen"),onClick:()=>u()}]})};t.LargeFilePrevent=g},99025:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImagePreview=t.VideoPreview=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(40827),p=n.__importDefault(e(19996)),v=_=>{const s=(0,o.useInjectable)(c.StaticResourceService);return{src:r.default.useMemo(()=>s.resolveStaticResource(_.uri).toString(),[_])}};t.VideoPreview=(0,r.memo)(_=>{const{src:s}=v(_.resource);return r.default.createElement("div",{className:p.default.kt_video_preview},r.default.createElement("video",{playsInline:!0,controls:!0,className:p.default.kt_video,src:s}))});const m=_=>{const s=r.default.useRef(),g=r.default.useRef(),{src:l}=v(_.resource);return r.default.useEffect(()=>{const h=new o.Disposable;return s.current&&(s.current.src=l),()=>{h.dispose()}},[_.resource]),r.default.createElement("div",{className:p.default.kt_image_preview},r.default.createElement("div",{ref:g},r.default.createElement("img",{ref:h=>h&&(s.current=h)})))};t.ImagePreview=m},80449:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChangeType=t.FileSchemeDocNodeServicePath=t.IFileSchemeDocNodeService=t.IFileSchemeDocClient=t.FILE_SAVE_BY_CHANGE_THRESHOLD=t.FILE_ON_DISK_SCHEME=void 0,t.FILE_ON_DISK_SCHEME="fileOnDisk",t.FILE_SAVE_BY_CHANGE_THRESHOLD=1e5,t.IFileSchemeDocClient=Symbol("IFileSchemeDocClient"),t.IFileSchemeDocNodeService=Symbol("FileSchemeDocNodeService"),t.FileSchemeDocNodeServicePath="FileSchemeDocNodeService";var e;(function(n){n[n.ADDED=1]="ADDED",n[n.REMOVED=2]="REMOVED"})(e||(t.ChangeType=e={}))},15625:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IFileSearchService=t.FileSearchServicePath=void 0,t.FileSearchServicePath="FileSearchServicePath",t.IFileSearchService=Symbol("FileSearchService")},84660:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(15625),t)},47720:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(84660),t)},2156:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileServiceClient=t.BrowserFileSystemRegistryImpl=void 0;const n=e(85608),r=e(32852),o=e(76003),c=e(41869),p=e(43718),v=e(37406),m=e(8170),_=e(41682),s=e(42933),g=e(81952);let l=class{constructor(){this.providers=new Map}registerFileSystemProvider(d){const E=d.scheme;return this.providers.set(E,d),{dispose:()=>{this.providers.delete(E)}}}};t.BrowserFileSystemRegistryImpl=l,t.BrowserFileSystemRegistryImpl=l=n.__decorate([(0,o.Injectable)()],l);let h=class{get clientId(){return this.applicationService.clientId}constructor(){this.watcherWithSchemaMap=new Map,this.watcherDisposerMap=new Map,this.onFileChangedEmitter=new c.Emitter,this.onFileProviderChangedEmitter=new c.Emitter,this._onFilesChanged=new c.Emitter,this.onFilesChanged=this._onFilesChanged.event,this._onFileProviderChanged=new c.Emitter,this.onFileProviderChanged=this._onFileProviderChanged.event,this._onDidChangeFileSystemProviderRegistrations=new c.Emitter,this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event,this._onWillActivateFileSystemProvider=new c.Emitter,this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event,this._onDidChangeFileSystemProviderCapabilities=new c.Emitter,this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event,this.filesExcludesMatcherList=[],this.watcherId=0,this.toDisposable=new c.DisposableCollection,this.watchFileExcludes=[],this.watchFileExcludesMatcherList=[],this.filesExcludes=[],this.workspaceRoots=[],this._providerChanged=new Set,this.fsProviders=new Map,this.userHomeDeferred=new c.Deferred,this.options={encoding:"utf8",overwrite:!1,recursive:!0,moveToTrash:!0},this.uriWatcherMap=new Map,this.toDisposable.push(this.onDidChangeFileSystemProviderRegistrations(d=>{d.added&&d.scheme===p.Schemes.file&&this.doGetCurrentUserHome()}))}async initialize(){const d=await this.getProvider(p.Schemes.file);d.initialize&&await d.initialize(this.clientId,this.appConfig.recursiveWatcherBackend)}async doGetCurrentUserHome(){const E=(await this.getProvider(p.Schemes.file)).getCurrentUserHome();this.userHomeDeferred.resolve(E)}handlesScheme(d){return this.registry.providers.has(d)||this.fsProviders.has(d)}dispose(){return this.toDisposable.dispose()}async resolveContent(d,E){const f=this.convertUri(d),b=await(await this.getProvider(f.scheme)).readFile(f.codeUri),y=b.data||b;return{content:c.BinaryBuffer.wrap(Uint8Array.from(y)).toString(E?.encoding)}}async readFile(d){const E=this.convertUri(d),a=await(await this.getProvider(E.scheme)).readFile(E.codeUri),b=a.data||a;return{content:c.BinaryBuffer.wrap(Uint8Array.from(b))}}async readFileStream(d){const E=this.convertUri(d);return await(await this.getProvider(E.scheme)).readFileStream(E.codeUri)}async getFileStat(d,E=!0){const f=this.convertUri(d),a=await this.getProvider(f.scheme);try{const b=await a.stat(f.codeUri);if(!b)throw s.FileSystemError.FileNotFound(f.codeUri.toString(),"File not found.");return this.filterStat(b,E)}catch(b){if(s.FileSystemError.FileNotFound.is(b))return}}async setContent(d,E,f){const a=this.convertUri(d.uri),b=await this.getProvider(a.scheme),y=await b.stat(a.codeUri);if(!y)throw s.FileSystemError.FileNotFound(d.uri,"File not found.");if(y.isDirectory)throw s.FileSystemError.FileIsADirectory(d.uri,"Cannot set the content.");if(!await this.isInSync(d,y))throw this.createOutOfSyncError(d);return await b.writeFile(a.codeUri,typeof E=="string"?c.BinaryBuffer.fromString(E).buffer:E,{create:!1,overwrite:!0,encoding:f?.encoding}),await b.stat(a.codeUri)}async updateContent(d,E,f){const a=this.convertUri(d.uri),b=await this.getProvider(a.scheme),y=await b.stat(a.codeUri);if(!y)throw s.FileSystemError.FileNotFound(d.uri,"File not found.");if(y.isDirectory)throw s.FileSystemError.FileIsADirectory(d.uri,"Cannot set the content.");if(!this.checkInSync(d,y))throw this.createOutOfSyncError(d);if(E.length===0)return y;const A=await b.readFile(a.codeUri),S=this.applyContentChanges(c.BinaryBuffer.wrap(A).toString(f?.encoding),E);await b.writeFile(a.codeUri,c.BinaryBuffer.fromString(S).buffer,{create:!1,overwrite:!0,encoding:f?.encoding});const w=await b.stat(a.codeUri);if(!w)throw s.FileSystemError.FileNotFound(a.codeUri.toString(),"File not found.");return w}async createFile(d,E){const f=this.convertUri(d),a=await this.getProvider(f.scheme),b=c.BinaryBuffer.fromString(E?.content||"").buffer;let y=await a.writeFile(f.codeUri,b,{create:!0,overwrite:E&&E.overwrite||!1,encoding:E?.encoding});return y=y||await a.stat(f.codeUri),y}async createFolder(d){const E=this.convertUri(d),f=await this.getProvider(E.scheme),a=await f.createDirectory(E.codeUri);return a||await f.stat(E.codeUri)}async move(d,E,f){const a=this.convertUri(d),b=this.convertUri(E),y=await this.getProvider(a.scheme),A=await y.rename(a.codeUri,b.codeUri,{overwrite:!!(f&&f.overwrite)});return A||await y.stat(b.codeUri)}async copy(d,E,f){const a=this.convertUri(d),b=this.convertUri(E),y=await this.getProvider(a.scheme),A=await this.doGetOverwrite(f);if(!(0,s.containsExtraFileMethod)(y,"copy"))throw this.getErrorProvideNotSupport(a.scheme,"copy");const S=await y.copy(a.codeUri,b.codeUri,{overwrite:!!A});return S||await y.stat(b.codeUri)}async getFsPath(d){if(d.startsWith("file:/"))return c.FileUri.fsPath(d)}fireFilesChange(d){const E=d.changes.map(f=>({uri:f.uri,type:f.type}));this._onFilesChanged.fire(E),this.eventBus.fire(new c.FilesChangeEvent(E))}async watchFileChanges(d,E){const a=(this.appConfig.pollingWatcherDirectories||[]).some(I=>d.path.toString().startsWith(I)),b=this.convertUri(d.toString()),y=this.uriWatcherMap.get(b.toString());if(y)if(y.isDisposed())this.uriWatcherMap.delete(b.toString());else return y;const A=this.watcherId++,S=await this.getProvider(b.scheme),w=this.watcherWithSchemaMap.get(b.scheme)||[],T=await S.watch(b.codeUri,{excludes:E,pollingWatch:a});this.watcherDisposerMap.set(A,{dispose:async()=>{const I=this.uriWatcherMap.get(b.toString());await Promise.all([S.unwatch&&S.unwatch(T),I&&I.dispose()]),this.uriWatcherMap.delete(b.toString())}}),w.push(A),this.watcherWithSchemaMap.set(b.scheme,w);const D=new g.FileSystemWatcher({fileServiceClient:this,watchId:A,uri:d});return this.uriWatcherMap.set(b.toString(),D),D}async setWatchFileExcludes(d){return await(await this.getProvider(p.Schemes.file)).setWatchFileExcludes(d)}async getWatchFileExcludes(){return await(await this.getProvider(p.Schemes.file)).getWatchFileExcludes()}async setFilesExcludes(d,E){this.filesExcludes=d,this.filesExcludesMatcherList=[],E&&this.setWorkspaceRoots(E),this.updateExcludeMatcher()}async setWorkspaceRoots(d){this.workspaceRoots=d,this.updateExcludeMatcher()}async unwatchFileChanges(d){const E=this.watcherDisposerMap.get(d);if(!(!E||!E.dispose))return this.watcherDisposerMap.delete(d),E.dispose()}async delete(d,E){if(this.appConfig.isElectronRenderer&&E?.moveToTrash!==!1){const b=new c.URI(d);if(b.scheme===p.Schemes.file)return this.injector.get(v.IElectronMainUIService).moveToTrash(b.codeUri.fsPath)}const f=this.convertUri(d),a=await this.getProvider(f.scheme);await a.stat(f.codeUri),await a.delete(f.codeUri,{recursive:!0,moveToTrash:await this.doGetMoveToTrash(E)})}async getEncoding(d){return"utf8"}listCapabilities(){return _.Iterable.map(this.fsProviders,([d,E])=>({scheme:d,capabilities:E.capabilities}))}registerProvider(d,E){if(this.fsProviders.has(d))throw new Error(`The file system provider for \`${d}\` already registered`);const f=[];this.fsProviders.set(d,E),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:d,provider:E}),f.push({dispose:()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:d,provider:E}),this.fsProviders.delete(d),this._providerChanged.add(d)}}),E.onDidChangeFile&&f.push(E.onDidChangeFile(b=>this.fireFilesChange({changes:b}))),this.toDisposable.push(E.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:E,scheme:d}))),f.push({dispose:async()=>{const b=[];(this.watcherWithSchemaMap.get(d)||[]).forEach(y=>b.push(this.unwatchFileChanges(y))),await Promise.all(b)}}),this._providerChanged.add(d),this.onFileProviderChangedEmitter.fire(Array.from(this._providerChanged)),this.toDisposable.pushAll(f);const a=new c.DisposableCollection;return a.pushAll(f),this._onFileProviderChanged.fire(Array.from(this._providerChanged)),a}async access(d,E=s.FileAccess.Constants.F_OK){const f=this.convertUri(d),a=await this.getProvider(f.scheme);if(!(0,s.containsExtraFileMethod)(a,"access"))throw this.getErrorProvideNotSupport(f.scheme,"access");return await a.access(f.codeUri,E)}async getFileType(d){const E=this.convertUri(d),f=await this.getProvider(E.scheme);if(!(0,s.containsExtraFileMethod)(f,"getFileType"))throw this.getErrorProvideNotSupport(E.scheme,"getFileType");return await f.getFileType(d)}async getCurrentUserHome(){return this.userHomeDeferred.promise}getErrorProvideNotSupport(d,E){return`Scheme ${d} not support this function: ${E}.`}convertUri(d){const E=new c.URI(d);if(!E.scheme)throw new Error(`Unsupported convert Uri with non-scheme Uri: ${d}`);return E}updateExcludeMatcher(){this.filesExcludes.forEach(d=>{this.workspaceRoots.length>0?this.workspaceRoots.forEach(E=>{const a=new c.URI(E).resolve(d).path.toString();this.filesExcludesMatcherList.push((0,c.parseGlob)(a))}):this.filesExcludesMatcherList.push((0,c.parseGlob)(d))})}async shouldWaitProvider(d){const E=await this._onWillActivateFileSystemProvider.fireAndAwait({scheme:d}),{result:f}=E[0];if(f&&f.includes(d)){const a=await c.Event.toPromise(c.Event.filter(this.onFileProviderChanged,b=>b.includes(d)));if(!(0,p.isUndefined)(a))return!0}return!1}async getProvider(d){this._providerChanged.has(d)&&(await this.eventBus.fireAndAwait(new c.ExtensionActivateEvent({topic:"onFileSystem",data:d}),{timeout:3e3}),this._providerChanged.delete(d));const E=this.fsProviders.get(d);if(!E)throw new Error(`Not find ${d} provider.`);return E}async isReadonly(d){try{const E=new c.URI(d);return!!(await(await this.getProvider(E.scheme)).stat(this.convertUri(d).codeUri)).readonly}catch{return!1}}isExclude(d){const E=new c.URI(d);return this.filesExcludesMatcherList.some(f=>f(E.path.toString()))}filterStat(d,E=!0){if(d&&!this.isExclude(d.uri))return d.children&&E&&(d.children=this.filterStatChildren(d.children)),d}filterStatChildren(d){const E=[];return d.forEach(f=>{if(this.isExclude(f.uri))return!1;const a=this.filterStat(f);a&&E.push(a)}),E}applyContentChanges(d,E){let f=r.TextDocument.create("","",1,d);for(const a of E){let b=a.text;if(a.range){const y=f.offsetAt(a.range.start),A=f.offsetAt(a.range.end);b=f.getText().substr(0,y)+a.text+f.getText().substr(A)}f=r.TextDocument.create(f.uri,f.languageId,f.version,b)}return f.getText()}async isInSync(d,E){return!!this.checkInSync(d,E)}checkInSync(d,E){return E.lastModification===d.lastModification&&E.size===d.size}createOutOfSyncError(d){return s.FileSystemError.FileIsOutOfSync(d.uri)}async doGetEncoding(d){return d&&typeof d.encoding<"u"?d.encoding:this.options.encoding}async doGetOverwrite(d){return d&&typeof d.overwrite<"u"?d.overwrite:this.options.overwrite}async doGetRecursive(d){return d&&typeof d.recursive<"u"?d.recursive:this.options.recursive}async doGetMoveToTrash(d){return d&&typeof d.moveToTrash<"u"?d.moveToTrash:this.options.moveToTrash}};t.FileServiceClient=h,n.__decorate([(0,o.Autowired)(s.IBrowserFileSystemRegistry),n.__metadata("design:type",l)],h.prototype,"registry",void 0),n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],h.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(p.IEventBus),n.__metadata("design:type",Object)],h.prototype,"eventBus",void 0),n.__decorate([(0,o.Autowired)(c.AppConfig),n.__metadata("design:type",Object)],h.prototype,"appConfig",void 0),n.__decorate([(0,o.Autowired)(m.IApplicationService),n.__metadata("design:type",Object)],h.prototype,"applicationService",void 0),t.FileServiceClient=h=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],h)},69037:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileServiceContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(42933),p=e(2156);let v=class{constructor(){this._disposables=new o.DisposableStore,this._disposables.add(this.fileSystem.registerProvider(o.Schemes.file,this.diskFileServiceProvider))}async initialize(){const _=this.contributionProvider.getContributions();await Promise.all(_.map(async s=>{s.registerProvider&&await s.registerProvider(this.fileSystem)})),await Promise.all(_.map(async s=>{s.onFileServiceReady&&await s.onFileServiceReady()})),this.fileSystem.initialize&&await this.fileSystem.initialize()}dispose(){this._disposables.dispose()}};t.FileServiceContribution=v,n.__decorate([(0,r.Autowired)(c.IFileServiceClient),n.__metadata("design:type",p.FileServiceClient)],v.prototype,"fileSystem",void 0),n.__decorate([(0,r.Autowired)(c.IDiskFileProvider),n.__metadata("design:type",Object)],v.prototype,"diskFileServiceProvider",void 0),n.__decorate([(0,r.Autowired)(o.FsProviderContribution),n.__metadata("design:type",Object)],v.prototype,"contributionProvider",void 0),t.FileServiceContribution=v=n.__decorate([(0,o.Domain)(o.ClientAppContribution),n.__metadata("design:paramtypes",[])],v)},60476:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiskFsProviderClient=t.CoreFileServiceProviderClient=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(42933);class p{constructor(){this.onDidChangeFileEmitter=new o.Emitter,this.onDidChangeFile=this.onDidChangeFileEmitter.event}watch(_,s){return this.fileServiceProvider.watch(_,s)}unwatch(_){return this.fileServiceProvider.unwatch&&this.fileServiceProvider.unwatch(_)}async stat(_){return await this.fileServiceProvider.stat(_)}readDirectory(_){return this.fileServiceProvider.readDirectory(_)}createDirectory(_){return this.fileServiceProvider.createDirectory(_)}async readFile(_,s){return s&&(0,o.getDebugLogger)("fileService.fsProvider").warn("encoding option for fsProvider.readFile is deprecated"),await this.fileServiceProvider.readFile(_)}readFileStream(_){if(this.fileServiceProvider.readFileStream)return this.fileServiceProvider.readFileStream(_);throw new Error("readFileStream not supported")}writeFile(_,s,g){return this.fileServiceProvider.writeFile(_,Array.from(s),g)}delete(_,s){return this.fileServiceProvider.delete(_,s)}rename(_,s,g){return this.fileServiceProvider.rename(_,s,g)}}t.CoreFileServiceProviderClient=p,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],p.prototype,"injector",void 0);let v=class extends p{constructor(){super(...arguments),this.onDidChangeCapabilities=o.Event.None}get capabilities(){return this._capabilities||(this._capabilities=12318,o.isLinux&&(this._capabilities|=1024)),this._capabilities}async initialize(_,s){var g,l;if(!((g=this.fileServiceProvider)===null||g===void 0)&&g.initialize)try{await((l=this.fileServiceProvider)===null||l===void 0?void 0:l.initialize(_,s))}catch(h){(0,o.getDebugLogger)("fileService.fsProvider").error("initialize error",h)}}setWatchFileExcludes(_){return this.fileServiceProvider.setWatchFileExcludes(_)}getWatchFileExcludes(){return this.fileServiceProvider.getWatchFileExcludes()}onDidFilesChanged(_){const s=_.changes.map(g=>({uri:g.uri,type:g.type}));this.onDidChangeFileEmitter.fire(s)}copy(_,s,g){return this.fileServiceProvider.copy(_,s,g)}access(_,s){return this.fileServiceProvider.access(_,s)}getCurrentUserHome(){return this.fileServiceProvider.getCurrentUserHome()}getFileType(_){return this.fileServiceProvider.getFileType(_)}};t.DiskFsProviderClient=v,n.__decorate([(0,r.Autowired)(c.DiskFileServicePath),n.__metadata("design:type",Object)],v.prototype,"fileServiceProvider",void 0),n.__decorate([(0,o.debounce)(100),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Array]),n.__metadata("design:returntype",void 0)],v.prototype,"setWatchFileExcludes",null),t.DiskFsProviderClient=v=n.__decorate([(0,r.Injectable)()],v)},96708:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileServiceClientModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(42933),p=e(70671),v=e(2156),m=e(69037),_=e(60476),s=e(23188);let g=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[{token:c.IFileServiceClient,useClass:v.FileServiceClient},{token:c.IBrowserFileSystemRegistry,useClass:v.BrowserFileSystemRegistryImpl},{token:c.IDiskFileProvider,useClass:_.DiskFsProviderClient},{token:c.IShadowFileProvider,useClass:s.ShadowFileSystemProvider},m.FileServiceContribution],this.backServices=[{servicePath:c.DiskFileServicePath,clientToken:c.IDiskFileProvider,protocol:p.DiskFileServiceProtocol}]}};t.FileServiceClientModule=g,t.FileServiceClientModule=g=n.__decorate([(0,r.Injectable)()],g)},23188:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShadowFileSystemProvider=void 0;const n=e(85608),r=e(76003),o=e(41869);let c=class{constructor(){this.capabilities=2048,this.onDidChangeCapabilities=o.Event.None,this.readonly=!0,this.shadowFiles=new Map,this.fileChangeEmitter=new o.Emitter,this.onDidChangeFile=this.fileChangeEmitter.event}unwatch(v){throw new Error("Method not implemented.")}readFileStream(v){throw new Error("Method not implemented.")}watch(v,m){throw new Error("Method not implemented.")}stat(v){return Promise.resolve({uri:v.toString(),lastModification:0})}readDirectory(v){throw new Error("Method not implemented.")}createDirectory(v){throw new Error("Method not implemented.")}readFile(v){return this.shadowFiles.get(v.toString())||o.BinaryBuffer.fromString("no available").buffer}writeFile(v,m,_){this.shadowFiles.set(v.toString(),m)}delete(v,m){throw new Error("Method not implemented.")}rename(v,m,_){throw new Error("Method not implemented.")}copy(v,m,_){throw new Error("Method not implemented.")}exists(v){throw new Error("Method not implemented.")}access(v,m){throw new Error("Method not implemented.")}};t.ShadowFileSystemProvider=c,t.ShadowFileSystemProvider=c=n.__decorate([(0,r.Injectable)()],c)},81952:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSystemWatcher=void 0;const n=e(43718);function r(c,p){return c.filter(v=>!!v.uri.startsWith(p))}class o{constructor(p){this.toDispose=new n.DisposableCollection,this.changeEmitter=new n.Emitter,this.toDispose.push(this.changeEmitter),this.fileServiceClient=p.fileServiceClient,this.watchId=p.watchId,this.uri=p.uri,this.fileServiceClient.onFilesChanged(v=>{const m=r(v,this.uri.toString());m&&m.length>0&&this.changeEmitter.fire(m)})}get onFilesChanged(){return this.changeEmitter.event}dispose(){return Promise.all([this.toDispose.dispose(),this.fileServiceClient.unwatchFileChanges(this.watchId)])}isDisposed(){return this.toDispose.disposed}}t.FileSystemWatcher=o},91813:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EXT_LIST_TEXT=t.EXT_LIST_IMAGE=t.EXT_LIST_VIDEO=void 0,t.getFileTypeByExt=e,t.EXT_LIST_VIDEO=new Set(["mp4","webm","mkv","mov","mts","flv","avi","wmv"]),t.EXT_LIST_IMAGE=new Set(["png","gif","jpg","jpeg","svg","bmp","avif","cr2","cr3","dng","flif","heic","icns","jxl","jpm","jpx","nef","raf","rw2","tif","orf","webp","apng"]),t.EXT_LIST_TEXT=new Set(["xml"]);function e(n){let r="text";return n&&(t.EXT_LIST_IMAGE.has(n)?r="image":t.EXT_LIST_VIDEO.has(n)?r="video":t.EXT_LIST_TEXT.has(n)?r="text":r="binary"),r}},79929:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IBrowserFileSystemRegistry=t.IFileServiceClient=void 0;const n=e(43718);t.IFileServiceClient=n.IFileServiceClient,t.IBrowserFileSystemRegistry=Symbol("IBrowserFileSystemRegistry")},49818:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSystemError=t.FileOperationError=t.FileSystemProviderError=t.FileSystemProviderErrorCode=t.FileAccess=t.IFileService=t.IShadowFileProvider=t.IDiskFileProvider=t.FileStat=t.FileType=void 0,t.createFileSystemProviderError=_,t.markAsFileSystemProviderError=s,t.containsExtraFileMethod=l,t.notEmpty=h,t.isErrnoException=u,t.handleError=d;const n=e(85608),r=e(43718);var o=e(31036);Object.defineProperty(t,"FileType",{enumerable:!0,get:function(){return o.FileType}}),Object.defineProperty(t,"FileStat",{enumerable:!0,get:function(){return o.FileStat}}),n.__exportStar(e(11854),t),t.IDiskFileProvider=Symbol("IDiskFileProvider"),t.IShadowFileProvider=Symbol("IShadowFileProvider"),t.IFileService=Symbol("IFileService");var c;(function(E){let f;(function(a){a.F_OK=0,a.R_OK=4,a.W_OK=2,a.X_OK=1})(f=E.Constants||(E.Constants={}))})(c||(t.FileAccess=c={}));var p;(function(E){E.FileExists="EntryExists",E.FileNotFound="EntryNotFound",E.FileNotADirectory="EntryNotADirectory",E.FileIsADirectory="EntryIsADirectory",E.FileIsOutOfSync="FileIsOutOfSync",E.FileExceedsMemoryLimit="EntryExceedsMemoryLimit",E.FileTooLarge="EntryTooLarge",E.FileWriteLocked="EntryWriteLocked",E.NoPermissions="NoPermissions",E.Unavailable="Unavailable",E.Unknown="Unknown"})(p||(t.FileSystemProviderErrorCode=p={}));class v extends Error{static declare(f,a){return Object.assign((...b)=>_(a(...b),f),{is:b=>{var y;return(y=b.stack)===null||y===void 0?void 0:y.startsWith(f)}})}constructor(f,a){super(f),this.code=a}is(f){return this.name===f.name}}t.FileSystemProviderError=v;class m extends Error{constructor(f,a,b){super(f),this.fileOperationResult=a,this.options=b}static isFileOperationError(f){return f instanceof Error&&!(0,r.isUndefinedOrNull)(f.fileOperationResult)}}t.FileOperationError=m;function _(E,f){const a=new v(E.toString(),f);return s(a,f),a}function s(E,f){return E.name=f?`${f} (FileSystemError)`:"FileSystemError",E}var g;(function(E){E.FileNotFound=v.declare(p.FileNotFound,(f,a)=>`${a?a+" ":""} '${f}' is not found.`),E.FileExists=v.declare(p.FileExists,(f,a)=>`${a?a+" ":""}'${f}' already exists.`),E.FileNotADirectory=v.declare(p.FileNotADirectory,(f,a)=>`${a?a+" ":""}'${f}' is not a directory.`),E.FileIsADirectory=v.declare(p.FileIsADirectory,(f,a)=>`${a?a+" ":""}'${f}' is a directory.`),E.FileIsOutOfSync=v.declare(p.FileIsOutOfSync,(f,a)=>`${a?a+" ":""}'${f}' is out of sync.`),E.FileExceedsMemoryLimit=v.declare(p.FileExceedsMemoryLimit,(f,a)=>`${a?a+" ":""}'${f}' is exceeds memory limit.`),E.FileTooLarge=v.declare(p.FileTooLarge,(f,a)=>`${a?a+" ":""}'${f}' is too large.`),E.FileWriteLocked=v.declare(p.FileWriteLocked,(f,a)=>`${a?a+" ":""}'${f}' is locked.`),E.FileIsNoPermissions=v.declare(p.NoPermissions,(f,a)=>`${a?a+" ":""}'${f}' is no permissions.`),E.Unavailable=v.declare(p.Unavailable,(f,a)=>`${a?a+" ":""}'${f}' is unavailable.`),E.Unknown=v.declare(p.Unknown,(f,a)=>`${a?a+" ":""}'${f}' is unkonw.`)})(g||(t.FileSystemError=g={}));function l(E,f){return(0,r.hasProperty)(E,f)&&(0,r.isFunction)(E[f])}function h(E){return E!==void 0}function u(E){return E.code!==void 0&&E.errno!==void 0}function d(E){var f,a,b,y,A;if(u(E))switch(E.code){case"EEXIST":throw g.FileExists(r.Uri.file((f=E.path)!==null&&f!==void 0?f:""));case"EPERM":case"EACCESS":throw g.FileIsNoPermissions(r.Uri.file((a=E.path)!==null&&a!==void 0?a:""));case"ENOENT":throw g.FileNotFound(r.Uri.file((b=E.path)!==null&&b!==void 0?b:""));case"ENOTDIR":throw g.FileNotADirectory(r.Uri.file((y=E.path)!==null&&y!==void 0?y:""));case"EISDIR":throw g.FileIsADirectory(r.Uri.file((A=E.path)!==null&&A!==void 0?A:""))}throw E}},42933:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(79929),t),n.__exportStar(e(49818),t),n.__exportStar(e(28217),t),n.__exportStar(e(91813),t),n.__exportStar(e(50295),t)},70671:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiskFileServiceProtocol=void 0;const n=e(26387),r=e(52890),o=e(50295);t.DiskFileServiceProtocol={name:o.DiskFileServicePath,methods:[{method:"readFile",request:[{name:"uri",type:r.UriComponentsProto}],response:{type:n.Type.binary()}}]}},50295:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileExtServicePath=t.FileWatcherServicePath=t.ShadowFileServicePath=t.DiskFileServicePath=t.FileServicePath=void 0,t.FileServicePath="FileService",t.DiskFileServicePath="DiskFileService",t.ShadowFileServicePath="ShadowFileService",t.FileWatcherServicePath="FileWatcherService",t.FileExtServicePath="FileExtServicePath"},28217:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WatcherProcessManagerProxy=t.WatcherServiceProxy=t.WATCHER_INIT_DATA_KEY=t.SUMI_WATCHER_PROCESS_SOCK_KEY=t.INsfw=void 0;const n=e(86058);var r;(function(o){let c;(function(p){p[p.CREATED=0]="CREATED",p[p.DELETED=1]="DELETED",p[p.MODIFIED=2]="MODIFIED",p[p.RENAMED=3]="RENAMED"})(c=o.actions||(o.actions={}))})(r||(t.INsfw=r={})),t.SUMI_WATCHER_PROCESS_SOCK_KEY="sumi-watcher-process-sock",t.WATCHER_INIT_DATA_KEY="sumi-watcher-init-data",t.WatcherServiceProxy=new n.ProxyIdentifier("WatcherHostServiceImpl"),t.WatcherProcessManagerProxy=new n.ProxyIdentifier("WatcherProcessManagerProxy")},14951:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(42933),t)},57942:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeDialogModel=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(26542),m=e(6250),_=e(2812),s=r.__importDefault(e(89200)),g=e(9018);let l=n=class{static createContainer(u,d){return u.createChild([{token:m.IFileDialogTreeService,useValue:d},{token:m.IFileDialogModel,useClass:n}])}static createModel(u,d){return n.createContainer(u,d).get(m.IFileDialogModel)}constructor(){this.selectedDecoration=new c.Decoration(s.default.mod_selected),this.focusedDecoration=new c.Decoration(s.default.mod_focused),this.loadingDecoration=new c.Decoration(s.default.mod_loading),this.cutDecoration=new c.Decoration(s.default.mod_cut),this._selectedFiles=[],this.disposableCollection=new p.DisposableCollection,this.onDidFocusedFileChangeEmitter=new p.Emitter,this.onDidSelectedFileChangeEmitter=new p.Emitter,this.clearFileSelectedDecoration=()=>{this._selectedFiles.forEach(u=>{this.selectedDecoration.removeTarget(u)}),this._selectedFiles=[],this.onDidSelectedFileChangeEmitter.fire([])},this.activeFileDecoration=(u,d=!0)=>{u!==this.treeModel.root&&(this.preContextMenuFocusedFile&&(this.focusedDecoration.removeTarget(this.preContextMenuFocusedFile),this.selectedDecoration.removeTarget(this.preContextMenuFocusedFile),this.preContextMenuFocusedFile=null),u&&(this.selectedFiles.length>0&&this.selectedFiles.forEach(E=>{this.selectedDecoration.removeTarget(E)}),this.focusedFile&&this.focusedDecoration.removeTarget(this.focusedFile),this.selectedDecoration.addTarget(u),this.focusedDecoration.addTarget(u),this._focusedFile=u,this._selectedFiles=[u],this.onDidFocusedFileChangeEmitter.fire(u.uri),this.onDidSelectedFileChangeEmitter.fire([u.uri]),d&&this.treeModel.dispatchChange()))},this.selectFileDecoration=(u,d=!0)=>{u!==this.treeModel.root&&(this.preContextMenuFocusedFile&&(this.focusedDecoration.removeTarget(this.preContextMenuFocusedFile),this.selectedDecoration.removeTarget(this.preContextMenuFocusedFile),this.preContextMenuFocusedFile=null),u&&(this.selectedFiles.length>0&&this.selectedFiles.forEach(E=>{this.selectedDecoration.removeTarget(E)}),this.focusedFile&&this.focusedDecoration.removeTarget(this.focusedFile),this.selectedDecoration.addTarget(u),this._selectedFiles=[u],this.onDidSelectedFileChangeEmitter.fire([u.uri]),d&&this.treeModel.dispatchChange()))},this.activeFileFocusedDecoration=(u,d=!1)=>{u!==this.treeModel.root&&(this.focusedFile!==u&&(d?(this.preContextMenuFocusedFile?(this.focusedDecoration.removeTarget(this.preContextMenuFocusedFile),this.selectedDecoration.removeTarget(this.preContextMenuFocusedFile)):this.focusedFile&&this.focusedDecoration.removeTarget(this.focusedFile),this.preContextMenuFocusedFile=u):this.focusedFile&&(this.preContextMenuFocusedFile=null,this.focusedDecoration.removeTarget(this.focusedFile)),u&&(this.selectedDecoration.addTarget(u),this.focusedDecoration.addTarget(u),this._focusedFile=u,this._selectedFiles.push(u),this.onDidFocusedFileChangeEmitter.fire(u.uri),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(E=>E.uri)))),this.treeModel.dispatchChange())},this.activeFileSelectedDecoration=u=>{this._selectedFiles.indexOf(u)>-1||(this._selectedFiles.push(u),this.selectedDecoration.addTarget(u),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(d=>d.uri)),this.treeModel.dispatchChange())},this.activeFileDecorationByRange=(u,d)=>{for(this.clearFileSelectedDecoration(),this.preContextMenuFocusedFile=null;u<=d;u++){const E=this.treeModel.root.getTreeNodeAtIndex(u);E&&(this._selectedFiles.push(E),this.selectedDecoration.addTarget(E))}this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(E=>E.uri)),this.treeModel.dispatchChange()},this.enactiveFileDecoration=()=>{this.focusedFile&&(this.focusedDecoration.removeTarget(this.focusedFile),this.onDidFocusedFileChangeEmitter.fire(),this.treeModel.dispatchChange()),this._focusedFile=void 0},this.toggleDirectory=async u=>{u.expanded?this.fileTreeHandle.collapseNode(u):this.fileTreeHandle.expandNode(u)},this.handleTreeBlur=()=>{this.enactiveFileDecoration()},this.handleTreeFocus=()=>{},this.handleItemRangeClick=(u,d)=>{if(!this.focusedFile)this.handleItemClick(u,d);else if(this.focusedFile&&this.focusedFile!==u){const E=this.treeModel.root.getIndexAtTreeNode(u),f=this.treeModel.root.getIndexAtTreeNode(this.focusedFile);f>E?this.activeFileDecorationByRange(E,f):f<E&&this.activeFileDecorationByRange(f,E)}},this.handleItemToggleClick=(u,d)=>{d!==c.TreeNodeType.CompositeTreeNode&&d!==c.TreeNodeType.TreeNode||(this.selectedFiles.indexOf(u)>-1?this.focusedFile===u?this.enactiveFileDecoration():this.activeFileFocusedDecoration(u):this.activeFileSelectedDecoration(u))},this.handleItemClick=(u,d)=>{this.clickTimes++,(d===c.TreeNodeType.CompositeTreeNode||d===c.TreeNodeType.TreeNode)&&this.activeFileDecoration(u),d===c.TreeNodeType.CompositeTreeNode&&this.corePreferences["workbench.list.openMode"]==="singleClick"&&this.toggleDirectory(u),this.clickTimer&&clearTimeout(this.clickTimer),this.clickTimer=setTimeout(()=>{this.clickTimes>1&&d!==c.TreeNodeType.TreeNode&&this.corePreferences["workbench.list.openMode"]==="doubleClick"&&this.toggleDirectory(u),this.clickTimes=0},200)},this.getDirectoryList=()=>this.fileTreeDialogService.getDirectoryList(),this._whenReady=this.initTreeModel()}get onDidFocusedFileChange(){return this.onDidFocusedFileChangeEmitter.event}get onDidSelectedFileChange(){return this.onDidSelectedFileChangeEmitter.event}get fileTreeHandle(){return this._fileTreeHandle}get decorations(){return this._decorations}get treeModel(){return this._treeModel}get whenReady(){return this._whenReady}get focusedFile(){return this._focusedFile}get selectedFiles(){return this._selectedFiles}async initTreeModel(){const u=(await this.fileTreeDialogService.resolveChildren())[0];this._treeModel=this.injector.get(_.FileTreeModel,[u]),this.initDecorations(u),this.disposableCollection.push(this._decorations),this.disposableCollection.push(this.labelService.onDidChange(()=>{this.treeModel.dispatchChange()})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.WillResolveChildren,d=>{this.loadingDecoration.addTarget(d)})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.DidResolveChildren,d=>{this.loadingDecoration.removeTarget(d)}))}async updateTreeModel(u){const d=await this.fileTreeDialogService.resolveRoot(u);if(d&&d.length>0){const E=d[0];this._treeModel=this.injector.get(_.FileTreeModel,[E]),this.clearFileSelectedDecoration(),this.initDecorations(E)}}initDecorations(u){this._decorations&&this._decorations.dispose(),this._decorations=new c.DecorationsManager(u),this._decorations.addDecoration(this.selectedDecoration),this._decorations.addDecoration(this.focusedDecoration),this._decorations.addDecoration(this.cutDecoration),this._decorations.addDecoration(this.loadingDecoration)}handleTreeHandler(u){this._fileTreeHandle=u}dispose(){this.disposableCollection.dispose()}};t.FileTreeDialogModel=l,l.FILE_TREE_SNAPSHOT_KEY="FILE_TREE_SNAPSHOT",l.DEFAULT_LOCATION_FLUSH_DELAY=500,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],l.prototype,"injector",void 0),r.__decorate([(0,o.Autowired)(m.IFileDialogTreeService),r.__metadata("design:type",g.FileTreeDialogService)],l.prototype,"fileTreeDialogService",void 0),r.__decorate([(0,o.Autowired)(v.LabelService),r.__metadata("design:type",v.LabelService)],l.prototype,"labelService",void 0),r.__decorate([(0,o.Autowired)(p.CorePreferences),r.__metadata("design:type",Object)],l.prototype,"corePreferences",void 0),t.FileTreeDialogModel=l=n=r.__decorate([(0,o.Injectable)(),r.__metadata("design:paramtypes",[])],l)},69748:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FILE_TREE_BADGE_LIMIT=t.FILE_TREE_NODE_HEIGHT=t.FileTreeDialogNode=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(97267),p=e(41869),v=e(69959),m=n.__importDefault(e(89200)),_=({item:s,onClick:g,itemType:l,labelService:h,leftPadding:u=8,onTwistierClick:d,decorations:E,defaultLeftPadding:f=8,template:a})=>{const b=l===c.TreeNodeType.RenamePrompt,y=l===c.TreeNodeType.NewPrompt,A=b||y,S=(0,p.useDesignStyles)(m.default.expansion_toggle,"expansion_toggle"),w=(0,p.useDesignStyles)(m.default.file_tree_node,"file_tree_node"),T=W=>{(l===c.TreeNodeType.TreeNode||l===c.TreeNodeType.CompositeTreeNode)&&g(W,s,l)},D=W=>{(l===c.TreeNodeType.TreeNode||l===c.TreeNodeType.CompositeTreeNode)&&(d?d(W,s,l):g(W,s,l))},I=l===c.TreeNodeType.CompositeTreeNode;let R;A?y?R=`${f+(s.parent.depth+1||0)*(u||0)}px`:R=`${f+(s.target.depth||0)*(u||0)}px`:R=I?`${f+(s.depth||0)*(u||0)}px`:`${f+(s.depth||0)*(u||0)+8}px`;const M={height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`,paddingLeft:R},O=(W,U)=>{if(E&&E?.classlist.indexOf(m.default.mod_loading)>-1)return o.default.createElement(c.Loading,null);if(A&&W instanceof c.PromptHandle){let Q=!1;if(b?Q=W.target.type===c.TreeNodeType.CompositeTreeNode:Q=W.type===c.TreeNodeType.CompositeTreeNode,Q)return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,S,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:y||!(b&&W.target.type===c.TreeNodeType.CompositeTreeNode&&W.target.expanded)})})}else return o.default.createElement("div",{onClick:U,className:(0,r.default)(m.default.file_tree_node_segment,S,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:!W.expanded})})},P=W=>{let U,Q;A&&W instanceof c.PromptHandle?W instanceof c.RenamePromptHandle?(U=W.target.uri.resolve(W.$.value),Q=v.Directory.is(W.target)):(U=W.parent.uri.resolve(W.$.value),Q=W.type===c.TreeNodeType.CompositeTreeNode):(U=W.uri,Q=W.filestat.isDirectory);const V=h.getIcon(U,{isDirectory:Q});return o.default.createElement("div",{className:(0,r.default)(m.default.file_icon,V,{expanded:Q&&W.expanded}),style:{height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`}})},k=W=>a?o.default.createElement(a,null):A&&W instanceof c.PromptHandle?o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_inputbox)},o.default.createElement("div",{className:(0,r.default)("input-box",m.default.file_tree_node_prompt_box)},o.default.createElement(W.ProxiedInput,{wrapperStyle:{height:t.FILE_TREE_NODE_HEIGHT,padding:"0 5px"}}))):o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_displayname)},W.name),F=()=>o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_tail)},L()),L=()=>null,B=W=>{if(I)return O(W,D);if(A)return O(W,()=>{})},j=()=>s.tooltip||s.name;return o.default.createElement("div",{key:s.id,onClick:T,title:j(),className:(0,r.default)(w,E?E.classlist:null),style:M,draggable:l===c.TreeNodeType.TreeNode||l===c.TreeNodeType.CompositeTreeNode},o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_content)},B(s),P(s),o.default.createElement("div",{className:A?m.default.file_tree_node_prompt_wrap:m.default.file_tree_node_overflow_wrap},k(s)),F()))};t.FileTreeDialogNode=_,t.FILE_TREE_NODE_HEIGHT=22,t.FILE_TREE_BADGE_LIMIT=99},68195:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDialogContextKey=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(66e3);let p=class{initScopedContext(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.fileDialogViewVisibleContext=c.FileDialogViewVisibleContext.bind(this._contextKeyService)}get service(){return this._contextKeyService}};t.FileDialogContextKey=p,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],p.prototype,"globalContextKeyService",void 0),t.FileDialogContextKey=p=n.__decorate([(0,r.Injectable)()],p)},9018:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeDialogService=void 0;const n=e(85608),r=e(76003),o=e(97267),c=e(41869),p=e(26542),v=e(54414),m=e(14951),_=e(72665),s=e(51500),g=e(6250),l=e(57781),h=e(97738),u=e(68195);let d=class extends o.Tree{constructor(f){super(),this._whenReady=this.resolveWorkspaceRoot(f)}get whenReady(){return this._whenReady}async resolveWorkspaceRoot(f){if(f){const a=new c.URI(f).withScheme(c.Schemes.file),b=await this.fileTreeAPI.resolveFileStat(a);b&&(this.workspaceRoot=b)}}async resolveChildren(f){if(f){if(f.uri){const{children:a}=await this.fileTreeAPI.resolveChildren(this,f.uri.toString(),f);return a}}else{this.workspaceRoot||(this.workspaceRoot=(await this.workspaceService.roots)[0]);const{children:a}=await this.fileTreeAPI.resolveChildren(this,this.workspaceRoot);return this.root=a[0],a}return[]}async resolveRoot(f){let a;/^file:\/\//.test(f)&&(a=new c.URI(f)),a=c.URI.file(f);const b=await this.fileTreeAPI.resolveFileStat(a);if(b){const{children:y}=await this.fileTreeAPI.resolveChildren(this,b);return this.root=y[0],y}}getDirectoryList(){const f=[];if(!this.root)return f;let a=new c.URI(this.workspaceRoot.uri);if(a&&a.parent)for(;a.parent;){const b=a.codeUri.fsPath;if(f.indexOf(b)>=0)break;f.push(b),a=a.parent}else f.push(a.codeUri.fsPath.toString());return f}sortComparator(f,a){return f.constructor===a.constructor?f.name.startsWith(".")&&!a.name.startsWith(".")?1:!f.name.startsWith(".")&&a.name.startsWith(".")?-1:f.name.localeCompare(a.name,"kn",{numeric:!0}):f.type===o.TreeNodeType.CompositeTreeNode?-1:a.type===o.TreeNodeType.CompositeTreeNode?1:0}initContextKey(f){f&&this.fileDialogContextKey.initScopedContext(f)}get contextKey(){return this.fileDialogContextKey}async saveAs(f){const{oldFilePath:a,newFilePath:b}=f;if(!a||!b)throw new Error("oldFilePath and newFilePath are required");await this.createFile(f);try{const y=c.URI.file(f.newFilePath),A={preview:!1,focus:!0,replace:!0,forceClose:!0,disableNavigate:!1};await this.workbenchEditorService.open(y,A),await this.fileTreeModelService.clearFileSelectedDecoration();const S=this.fileTreeService.getNodeByPathOrUri(y);S&&await this.fileTreeModelService.activeFileDecoration(S)}catch(y){throw new Error(`Failed to open saveAs file: ${y.message}`)}}async createFile(f){try{const{oldFilePath:a,newFilePath:b}=f;if(!await this.fileServiceClient.getFileStat(a))throw new Error(`Source file not found: ${a}`);const{content:A}=await this.fileServiceClient.readFile(a);await this.fileServiceClient.createFile(b,{content:A.toString(),encoding:"utf8",overwrite:!0})}catch(a){throw new Error(`Failed to create file: ${a.message}`)}}renderCustomMsg(){return null}async getDefaultFilePath(f,a){return a}dispose(){super.dispose()}};t.FileTreeDialogService=d,n.__decorate([(0,r.Autowired)(g.IFileTreeAPI),n.__metadata("design:type",Object)],d.prototype,"fileTreeAPI",void 0),n.__decorate([(0,r.Autowired)(s.IWorkspaceService),n.__metadata("design:type",Object)],d.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(p.LabelService),n.__metadata("design:type",p.LabelService)],d.prototype,"labelService",void 0),n.__decorate([(0,r.Autowired)(u.FileDialogContextKey),n.__metadata("design:type",u.FileDialogContextKey)],d.prototype,"fileDialogContextKey",void 0),n.__decorate([(0,r.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],d.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(v.WorkbenchEditorService),n.__metadata("design:type",v.WorkbenchEditorService)],d.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(_.IDialogService),n.__metadata("design:type",Object)],d.prototype,"dialogService",void 0),n.__decorate([(0,r.Autowired)(h.FileTreeModelService),n.__metadata("design:type",h.FileTreeModelService)],d.prototype,"fileTreeModelService",void 0),n.__decorate([(0,r.Autowired)(g.IFileTreeService),n.__metadata("design:type",l.FileTreeService)],d.prototype,"fileTreeService",void 0),t.FileTreeDialogService=d=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__param(0,(0,r.Optional)()),n.__metadata("design:paramtypes",[String])],d)},51888:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDialog=t.FILE_TREE_DIALOG_HEIGHT=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),c=e(41869),p=e(68974),v=e(72665),m=e(69748),_=n.__importDefault(e(13294));t.FILE_TREE_DIALOG_HEIGHT=22;const s=({options:g,model:l,isOpenDialog:h,fileService:u})=>{const d=(0,c.useInjectable)(v.IDialogService),E=(0,r.useRef)(null),[f,a]=(0,r.useState)(g.defaultFileName||""),[b,y]=(0,r.useState)(!1),[A,S]=(0,r.useState)(""),[w,T]=(0,r.useState)([]),D=(0,r.useRef)(g.defaultFileName||"");(0,r.useEffect)(()=>{var oe;return l&&(y(!1),O(),(oe=u.contextKey.fileDialogViewVisibleContext)===null||oe===void 0||oe.set(!0)),()=>{l.dispose()}},[l]),(0,r.useEffect)(()=>{g.defaultFileName&&(a(g.defaultFileName||""),D.current=g.defaultFileName||"")},[g]),(0,r.useEffect)(()=>{if(b){const oe=l.getDirectoryList();T(oe)}},[b]);const I=(0,r.useCallback)(()=>{const oe=l.selectedFiles.map(ne=>ne.uri.path.toString());if(D.current&&g.showNameInput&&(oe?.length===1||g.defaultUri)){const ne=oe?.length===1?oe[0]:g.defaultUri.path.toString();g?.saveAs&&u.saveAs({oldFilePath:c.path.join(ne,g?.defaultFileName||""),newFilePath:c.path.join(ne,D.current)}),d.hide([c.path.join(ne,D.current)])}else oe.length>0?d.hide(oe):A?d.hide([A]):g.defaultUri?d.hide([g.defaultUri.path.toString()]):l.treeModel&&l.treeModel.root?d.hide([l.treeModel.root.uri.path.toString()]):d.hide([]);y(!1),u.contextKey.fileDialogViewVisibleContext.set(!1)},[b,d,l,g,A]),R=async oe=>{let ne=oe.treeModel.root.uri.codeUri.fsPath;return u.getDefaultFilePath&&(ne=await u.getDefaultFilePath(oe,ne)),ne},M=(0,r.useCallback)(()=>{y(!1),d.hide(),u.contextKey.fileDialogViewVisibleContext.set(!1)},[b,d]),O=(0,r.useCallback)(async()=>{await l.whenReady,await l.treeModel.ensureReady;const oe=await R(l);S(oe),y(!0)},[l,A,b]),P=!h,k=(0,r.useCallback)(oe=>{l.handleTreeHandler({...oe,getModel:()=>l.treeModel})},[l]),F=(0,r.useCallback)((oe,ne)=>{oe.stopPropagation();const{toggleDirectory:ue}=l;ue(ne)},[l]),L=(0,r.useCallback)(oe=>B(oe)?!1:oe.shiftKey,[]),B=(0,r.useCallback)(oe=>{const{metaKey:ne,ctrlKey:ue}=oe;return c.isMacintosh&&ne||ue},[]),j=(0,r.useCallback)((oe,ne,ue)=>{var fe;oe.stopPropagation();const{handleItemClick:q,handleItemToggleClick:Ae,handleItemRangeClick:pe}=l;if(!ne)return;const ie=L(event),ge=B(event);if(ie&&!P&&g.canSelectMany)pe(ne,ue);else if(ge&&!P&&g.canSelectMany)Ae(ne,ue);else if(P)ue===o.TreeNodeType.CompositeTreeNode&&q(ne,ue);else if(g.canSelectFiles&&ue===o.TreeNodeType.TreeNode){const Ie=new Set(Object.values((fe=g.filters)!==null&&fe!==void 0?fe:{}).flat().map(Pe=>`.${Pe}`));if(Ie.size>0){const Pe=c.URI.parse(ne.filestat.uri).path.ext;Ie.has(Pe)&&q(ne,ue)}else q(ne,ue)}else g.canSelectFolders&&ue===o.TreeNodeType.CompositeTreeNode&&q(ne,ue)},[l,P,g]),W=(0,r.useCallback)(async oe=>{y(!1),S(oe),await l.updateTreeModel(oe),y(!0)},[l,b,A]),U=(0,r.useCallback)(async oe=>{y(!1),S(oe),await l.updateTreeModel(oe),y(!0)},[l,b,A,w]),Q=(0,r.useCallback)(()=>u.renderCustomMsg?u.renderCustomMsg():null,[u.renderCustomMsg]),V=(0,r.useCallback)(oe=>r.default.createElement(m.FileTreeDialogNode,{item:oe.item,itemType:oe.itemType,labelService:l.labelService,decorations:l.decorations.getDecorations(oe.item),onClick:j,onTwistierClick:F,defaultLeftPadding:8,leftPadding:8}),[l.treeModel]),$=(0,r.useCallback)(()=>{if(b){if(l.treeModel)return r.default.createElement(o.RecycleTree,{height:300,itemHeight:t.FILE_TREE_DIALOG_HEIGHT,onReady:k,model:l.treeModel},V)}else return r.default.createElement(p.Progress,{loading:!0})},[b,l]),Y=(0,r.useMemo)(()=>u.showFilePathSearch!==!1,[u.showFilePathSearch]),G=(0,r.useCallback)(()=>{if(w.length>0)return r.default.createElement(o.Select,{onChange:W,onSearchChange:U,className:_.default.select_control,size:"large",searchPlaceholder:A,value:A,showSearch:Y},w.map((oe,ne)=>r.default.createElement(o.Option,{value:oe,key:`${ne} - ${oe}`},oe)))},[w,A]),z=(0,r.useCallback)(oe=>{const{key:ne}=c.KeyCode.createKeyCode(oe),ue=oe.shiftKey||oe.metaKey||oe.altKey||oe.ctrlKey;ne&&c.Key.ENTER.keyCode===ne.keyCode&&!ue&&I()},[I]);(0,r.useEffect)(()=>{var oe;return E.current&&(u.initContextKey(E.current),u.contextKey.fileDialogViewVisibleContext.set(!0),(oe=E.current)===null||oe===void 0||oe.addEventListener("keyup",z)),()=>{var ne;(ne=E.current)===null||ne===void 0||ne.removeEventListener("keyup",z)}},[]);const K=(0,r.useMemo)(()=>r.default.createElement(r.default.Fragment,null,Q(),r.default.createElement("div",{className:_.default.file_dialog_directory},G()),r.default.createElement("div",{className:_.default.file_dialog_content},$())),[G,$]),Z=(0,r.useMemo)(()=>r.default.createElement("div",{className:_.default.file_dialog_buttons},r.default.createElement(o.Button,{onClick:M,type:"ghost",className:_.default.button},(0,c.localize)("dialog.file.close")),r.default.createElement(o.Button,{onClick:I,type:"primary",className:_.default.button,disabled:P&&g.showNameInput&&f.length===0},h&&g.openLabel||(0,c.localize)("dialog.file.ok"))),[M,I,P,h,f,g]),X=(0,r.useCallback)(oe=>{a(oe.target.value),D.current=oe.target.value},[f]);return r.default.createElement("div",{className:_.default.file_dialog_wrapper,ref:E},r.default.createElement("div",{className:_.default.file_dialog_directory_title},h?g.title||(0,c.localize)("dialog.file.openLabel"):g.saveLabel||(0,c.localize)("dialog.file.saveLabel")),K,!h&&g.showNameInput&&r.default.createElement("div",{className:_.default.file_dialog_file_container},r.default.createElement("span",{className:_.default.file_dialog_file_name},(0,c.localize)("dialog.file.name"),": "),r.default.createElement(o.Input,{size:"small",value:f,autoFocus:!0,selection:{start:0,end:f.indexOf(".")||f.length},onChange:X})),Z)};t.FileDialog=s},89508:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WindowDialogServiceImpl=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(76003),c=e(41869),p=e(37406),v=e(14951),m=e(72665),_=e(57942),s=n.__importDefault(e(13294)),g=e(9018),l=e(51888);let h=class{constructor(){this.idx=1,this._whenReady=this.init()}async init(){this.recentGlobalStorage=await this.storageProvider(c.STORAGE_NAMESPACE.GLOBAL_RECENT_DATA);const d=await this.recentGlobalStorage.get("RECENT_DIALOG_DEFAULT_URI");if(d)this._defaultUri=new c.URI(d);else{const E=await this.fileServiceClient.getCurrentUserHome();this._defaultUri=new c.URI(E.uri)}}get defaultUri(){return this._defaultUri}get whenReady(){return this._whenReady}async updateRecentDefaultUri(d){this.recentGlobalStorage.set("RECENT_DIALOG_DEFAULT_URI",d.toString()),this._defaultUri=d}async showOpenDialog(d={}){this.dialogService.reset(),await this.whenReady;const E={canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1};if(this.appConfig.isElectronRenderer&&!this.appConfig.isRemote){const f=this.injector.get(p.IElectronMainUIService),a=[];d.canSelectFiles&&a.push("openFile"),d.canSelectFolders&&a.push("openDirectory"),d.canSelectMany&&a.push("multiSelections"),c.isMacintosh&&a.push("treatPackageAsDirectory","createDirectory");const b=d.defaultUri||this.defaultUri,y=await f.showOpenDialog(c.electronEnv.currentWindowId,{defaultPath:b.codeUri.fsPath,title:d.title,buttonLabel:d.openLabel,properties:a});if(y&&y.length>0){const A=y.map(S=>c.URI.file(S));return this.updateRecentDefaultUri(A[0].parent),A}else return}else{d.defaultUri||(d.defaultUri=this.defaultUri);let f;d.defaultUri?f=this.injector.get(g.FileTreeDialogService,[d.defaultUri.toString()]):f=this.injector.get(g.FileTreeDialogService),await f.whenReady;const a=_.FileTreeDialogModel.createModel(this.injector,f),b=await this.dialogService.open({message:r.default.createElement(l.FileDialog,{key:this.idx++,fileService:f,model:a,options:{...E,...d},isOpenDialog:!0}),type:c.MessageType.Empty,buttons:[],closable:!0,props:{className:s.default.file_dialog_wrapper}});if(this.dialogService.reset(),b&&b.length>0){const y=b.map(A=>c.URI.file(A));return this.updateRecentDefaultUri(y[0].parent),y}else return}}async showSaveDialog(d={}){if(await this.whenReady,this.appConfig.isElectronRenderer&&!this.appConfig.isRemote){const E=d.defaultUri||this.defaultUri,a=await this.injector.get(p.IElectronMainUIService).showSaveDialog(c.electronEnv.currentWindowId,{defaultPath:E.resolve(d.defaultFileName||"").codeUri.fsPath,title:d.saveLabel,message:d.saveLabel});if(a){const b=c.URI.file(a);return this.updateRecentDefaultUri(b.parent),b}else return}else{d.defaultUri||(d.defaultUri=this.defaultUri);let E;d.defaultUri?E=this.injector.get(g.FileTreeDialogService,[d.defaultUri.toString()]):E=this.injector.get(g.FileTreeDialogService),await E.whenReady;const f=_.FileTreeDialogModel.createModel(this.injector,E),a=await this.dialogService.open({message:r.default.createElement(l.FileDialog,{key:this.idx++,fileService:E,model:f,options:d,isOpenDialog:!1}),type:c.MessageType.Empty,buttons:[],closable:!0,props:{className:s.default.file_dialog_wrapper}});if(this.dialogService.reset(),a&&a.length>0){const b=c.URI.file(a[0]);return this.updateRecentDefaultUri(b.parent),b}else return}}};t.WindowDialogServiceImpl=h,n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],h.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(m.IDialogService),n.__metadata("design:type",Object)],h.prototype,"dialogService",void 0),n.__decorate([(0,o.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],h.prototype,"fileServiceClient",void 0),n.__decorate([(0,o.Autowired)(c.StorageProvider),n.__metadata("design:type",Function)],h.prototype,"storageProvider",void 0),n.__decorate([(0,o.Autowired)(c.AppConfig),n.__metadata("design:type",Object)],h.prototype,"appConfig",void 0),t.WindowDialogServiceImpl=h=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],h)},88014:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileContextKey=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(16413);let p=class{constructor(){this.explorerResourceIsFolder=c.ExplorerResourceIsFolderContext.bind(this.globalContextKeyService),this.explorerViewletVisibleContext=c.ExplorerViewletVisibleContext.bind(this.globalContextKeyService)}initScopedContext(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.explorerFocused=c.ExplorerFocusedContext.bind(this._contextKeyService),this.explorerResourceCut=c.ExplorerResourceCut.bind(this._contextKeyService),this.filesExplorerFocused=c.FilesExplorerFocusedContext.bind(this._contextKeyService),this.filesExplorerInputFocused=c.FilesExplorerInputFocusedContext.bind(this._contextKeyService),this.filesExplorerFilteredContext=c.FilesExplorerFilteredContext.bind(this._contextKeyService),this.explorerCompressedFocusContext=c.ExplorerCompressedFocusContext.bind(this._contextKeyService),this.explorerCompressedFirstFocusContext=c.ExplorerCompressedFirstFocusContext.bind(this._contextKeyService),this.explorerCompressedLastFocusContext=c.ExplorerCompressedLastFocusContext.bind(this._contextKeyService)}get service(){return this._contextKeyService}};t.FileContextKey=p,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],p.prototype,"globalContextKeyService",void 0),t.FileContextKey=p=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],p)},40439:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(16413),p=e(93899),v=e(68969),m=e(98295),_=e(41893),s=e(54414),g=e(32595),l=e(63067),h=e(58296),u=e(72665),d=e(55121),E=e(51500),f=e(6250),a=e(69959),b=e(56384),y=e(57781),A=e(97738),S=e(4446);let w=class{constructor(){this._disposables=new o.DisposableStore,this.isRendered=!1,this.deleteThrottler=new o.Throttler,this.willDeleteUris=[]}initialize(){this.workspaceService.initFileServiceExclude().then(async()=>{await this.fileTreeService.init(),this.fileTreeModelService.initTreeModel()}),this.progressService.registerProgressIndicator(g.EXPLORER_CONTAINER_ID)}async onStart(){this.viewsRegistry.registerViewWelcomeContent(f.RESOURCE_VIEW_ID,{content:(0,o.formatLocalize)("welcome-view.noFolderHelp",o.FILE_COMMANDS.OPEN_FOLDER.id),group:h.ViewContentGroups.Open,order:1}),this.mainLayoutService.collectViewComponent({id:f.RESOURCE_VIEW_ID,name:this.getWorkspaceTitle(),weight:3,priority:9,collapsed:!1,component:b.FileTree},g.EXPLORER_CONTAINER_ID),this._disposables.add(this.workspaceService.onWorkspaceLocationChanged(()=>{const D=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);D&&D.updateViewTitle(f.RESOURCE_VIEW_ID,this.getWorkspaceTitle())}))}onDidStart(){const D=this.injector.get(S.SymlinkDecorationsProvider,[this.fileTreeService]);this.decorationService.registerDecorationsProvider(D)}onDidRender(){this.isRendered=!0;const D=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);D&&(this.fileTreeModelService.whenReady.then(()=>{this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(D.isActivated())}),D.onActivate(()=>{this.fileTreeModelService.performLocationOnHandleShow(),this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(!0)}),D.onInActivate(()=>{this.fileTreeModelService.handleTreeBlur(),this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(!1)}))}getWorkspaceTitle(){let D=(0,o.localize)("file.empty.defaultTitle");const I=this.workspaceService.workspace;return I&&(D=new o.URI(I.uri).displayName,!I.isDirectory&&D.endsWith(`.${this.workspaceService.workspaceSuffixName}`)&&(D=D.slice(0,D.lastIndexOf(".")),D===E.UNTITLED_WORKSPACE))?(0,o.localize)("file.workspace.defaultTip"):D}onReconnect(){this.fileTreeService.reWatch()}revealFile(D){if(D)if(this.isRendered){const I=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);!I||!I.isVisible||I.isCollapsed(f.RESOURCE_VIEW_ID)?this.fileTreeModelService.locationOnShow(D):this.fileTreeModelService.location(D)}else this.fileTreeModelService.locationOnShow(D)}registerMenus(D){D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.NEW_FILE.id,label:(0,o.localize)("file.new")},order:1,group:"0_new"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.NEW_FOLDER.id,label:(0,o.localize)("file.folder.new")},order:2,group:"0_new"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.WORKSPACE_COMMANDS.ADD_WORKSPACE_FOLDER.id,label:(0,o.localize)("workspace.addFolderToWorkspace")},order:1,group:"0_workspace",when:"config.workspace.supportMultiRootWorkspace"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.WORKSPACE_COMMANDS.REMOVE_WORKSPACE_FOLDER.id,label:(0,o.localize)("workspace.removeFolderFromWorkspace")},order:1,group:"0_workspace",when:"config.workspace.supportMultiRootWorkspace"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_RESOURCES.id,label:(0,o.localize)("file.open")},order:1,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_TO_THE_SIDE.id,label:(0,o.localize)("file.open.side")},order:2,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_TYPE_WITH.id,label:(0,o.localize)("file.open.type")},order:3,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_TERMINAL_WITH_PATH.id,label:(0,o.localize)("file.filetree.openTerminalWithPath")},when:"workbench.panel.terminal",order:4,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.SEARCH_ON_FOLDER.id,label:(0,o.localize)("file.search.folder")},order:1,group:"2_search"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.DELETE_FILE.id,label:(0,o.localize)("file.delete")},order:1,group:"7_modification"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.RENAME_FILE.id,label:(0,o.localize)("file.rename")},order:3,group:"7_modification"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COMPARE_SELECTED.id,label:(0,o.localize)("file.compare")},order:2,group:"3_compare"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COPY_FILE.id,label:(0,o.localize)("file.copy.file")},order:1,group:"5_cutcopypaste"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.CUT_FILE.id,label:(0,o.localize)("file.cut.file")},order:2,group:"5_cutcopypaste"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.PASTE_FILE.id,label:(0,o.localize)("file.paste.file")},order:3,group:"5_cutcopypaste"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COPY_PATH.id,label:(0,o.localize)("file.copy.path")},group:"6_copypath"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COPY_RELATIVE_PATH.id,label:(0,o.localize)("file.copy.relativepath")},group:"6_copypath"})}registerCommands(D){const I=()=>{this.fileTreeService.filterMode&&this.fileTreeService.toggleFilterMode()};D.registerCommand(o.FILE_COMMANDS.OPEN_TERMINAL_WITH_PATH,{execute:M=>{let O=M;if(!O)return;const P=this.fileTreeService.getNodeByPathOrUri(O);P&&!P.filestat.isDirectory&&(O=P.uri.parent),this.commandService.executeCommand(o.TERMINAL_COMMANDS.OPEN_WITH_PATH.id,O)}}),D.registerCommand(o.FILE_COMMANDS.SEARCH_ON_FOLDER,{execute:async M=>{var O;let P=M;if(P||(this.fileTreeModelService.focusedFile?P=this.fileTreeModelService.focusedFile.uri:this.fileTreeModelService.selectedFiles.length>0&&(P=(O=this.fileTreeModelService.selectedFiles[0])===null||O===void 0?void 0:O.uri)),!P)return;let k;if(this.fileTreeService.isMultipleWorkspace)for(const F of await this.workspaceService.roots){const L=new o.URI(F.uri);if(L.isEqualOrParent(P)){k=`./${L.relative(P).toString()}`;break}}else if(this.workspaceService.workspace){const F=new o.URI(this.workspaceService.workspace.uri);F.isEqualOrParent(P)&&(k=`./${F.relative(P).toString()}`)}this.commandService.executeCommand(o.SEARCH_COMMANDS.OPEN_SEARCH.id,{includeValue:k+"/"})},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&a.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.LOCATION,{execute:M=>{const O=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);O&&!O.isVisible&&(O.show(),O.isCollapsed(f.RESOURCE_VIEW_ID)||O.toggleViews([f.RESOURCE_VIEW_ID],!0)),M?this.revealFile(M):this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0&&this.revealFile(this.fileTreeModelService.selectedFiles[0].uri)}}),D.registerCommand(o.FILE_COMMANDS.LOCATION_WITH_EDITOR,{execute:()=>{var M,O,P;((O=(M=this.workbenchEditorService.currentEditor)===null||M===void 0?void 0:M.currentUri)===null||O===void 0?void 0:O.scheme)===o.Schemes.file&&this.revealFile((P=this.workbenchEditorService.currentEditor)===null||P===void 0?void 0:P.currentUri)}}),D.registerCommand(o.FILE_COMMANDS.COLLAPSE_ALL,{execute:()=>{const M=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);!M||!M.isVisible||this.fileTreeModelService.collapseAll()}}),D.registerCommand(o.FILE_COMMANDS.REFRESH_ALL,{execute:async()=>{const M=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);!M||!M.isVisible||await this.fileTreeService.refresh()}}),D.registerCommand(o.FILE_COMMANDS.DELETE_FILE,{execute:(M,O)=>{if(I(),O?this.willDeleteUris=this.willDeleteUris.concat(O):this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0?this.willDeleteUris=this.willDeleteUris.concat(this.fileTreeModelService.selectedFiles.map(P=>P.uri)):this.fileTreeModelService.focusedFile&&this.willDeleteUris.push(this.fileTreeModelService.focusedFile.uri),this.willDeleteUris.length!==0)return this.deleteThrottler.queue(this.doDelete.bind(this))},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.RENAME_FILE,{execute:M=>{if(I(),!M)if(this.fileTreeModelService.contextMenuFile)M=this.fileTreeModelService.contextMenuFile.uri;else if(this.fileTreeModelService.focusedFile)M=this.fileTreeModelService.focusedFile.uri;else return;this.fileTreeModelService.renamePrompt(M)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.NEW_FILE,{execute:async M=>{var O;if(I(),M)this.fileTreeModelService.newFilePrompt(M);else if(this.fileTreeService.isCompactMode&&this.fileTreeModelService.activeUri)this.fileTreeModelService.newFilePrompt(this.fileTreeModelService.activeUri);else if(this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0)this.fileTreeModelService.newFilePrompt(this.fileTreeModelService.selectedFiles[0].uri);else{let P;this.fileTreeService.isMultipleWorkspace?P=new o.URI((await this.workspaceService.roots)[0].uri):P=new o.URI((O=this.workspaceService.workspace)===null||O===void 0?void 0:O.uri),this.fileTreeModelService.newFilePrompt(P)}}}),D.registerCommand(o.FILE_COMMANDS.NEW_FOLDER,{execute:async M=>{var O;if(I(),M)this.fileTreeModelService.newDirectoryPrompt(M);else if(this.fileTreeService.isCompactMode&&this.fileTreeModelService.activeUri)this.fileTreeModelService.newDirectoryPrompt(this.fileTreeModelService.activeUri);else if(this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0)this.fileTreeModelService.newDirectoryPrompt(this.fileTreeModelService.selectedFiles[0].uri);else{let P;this.fileTreeService.isMultipleWorkspace?P=new o.URI((await this.workspaceService.roots)[0].uri):P=new o.URI((O=this.workspaceService.workspace)===null||O===void 0?void 0:O.uri),this.fileTreeModelService.newDirectoryPrompt(P)}}}),D.registerCommand(o.FILE_COMMANDS.COMPARE_SELECTED,{execute:(M,O)=>{if(O&&O.length){const P=this.workbenchEditorService.currentEditor;P&&P.currentUri&&this.fileTreeService.compare(O[0],P.currentUri)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!a.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.OPEN_RESOURCES,{execute:M=>{this.fileTreeService.openAndFixedFile(M)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!a.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.OPEN_TO_THE_SIDE,{execute:M=>{this.fileTreeService.openToTheSide(M)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!a.Directory.is(this.fileTreeModelService.contextMenuFile)});const R=(M,O)=>{const{availableOpenTypes:P,currentOpenType:k}=this.workbenchEditorService.currentEditorGroup;if(!(P&&M&&k))return{items:[],selectIndex:-1};const F=this.preferenceService.get("workbench.editorAssociations"),L=[],B=(Q,V)=>V.type===s.EditorOpenType.code?Q.type===s.EditorOpenType.code:V.type===s.EditorOpenType.component&&Q.type===s.EditorOpenType.component?Q.componentId===V.componentId:!1,j=(Q,V)=>(Q?Q+=(0,o.localize)("file.open.type.detail.and")+V:Q=V,Q);let W,U;if(F){const Q=Object.keys(F).find(V=>(0,o.match)(V,M.path.toString().toLowerCase())||(0,o.match)(V,M.path.base.toLowerCase()));W=Q&&F[Q]}return P.forEach((Q,V)=>{var $;const Y={label:Q.title||Q.componentId||Q.type,detail:Q.title,run:G=>O(G,Q)};B(k,Q)&&(Y.description=j(Y.description,(0,o.localize)("file.open.type.detail.active")),U=V),W&&(!(($=Q.componentId)===null||$===void 0)&&$.endsWith(W))&&(Y.description=j(Y.description,(0,o.localize)("file.open.type.detail.default"))),L.push(new o.QuickOpenItem(Y))}),{items:L,selectIndex:U}};D.registerCommand(o.FILE_COMMANDS.OPEN_TYPE_WITH,{execute:M=>{const O=(L,B)=>{var j,W;return L===o.Mode.OPEN?((j=this.workbenchEditorService.currentEditorGroup)===null||j===void 0||j.changeOpenType((W=B.componentId)!==null&&W!==void 0?W:B.type),!0):!1},{items:P,selectIndex:k}=R(M,O);if(P.length===0||typeof k>"u")return;const F=L=>{this.quickOpenService.open({onType:(B,j)=>j(L)},{fuzzyMatchLabel:!0,ignoreFocusOut:!1,placeholder:(0,o.formatLocalize)("file.open.type.placeholder",M.path.base),selectIndex:()=>k})};P.push(new o.QuickOpenItem({label:(0,o.formatLocalize)("file.open.type.preference.default",`*${M.path.ext}`),showBorder:!0,run:L=>{if(L===o.Mode.OPEN){const B=(U,Q)=>{var V,$,Y;if(U===o.Mode.OPEN){const G="workbench.editorAssociations",z=this.preferenceService.resolve(G).scope,K=this.preferenceService.get(G);return this.preferenceService.set(G,{...K||{},[`*${M.path.ext}`]:(V=Q.componentId)!==null&&V!==void 0?V:Q.type},z),($=this.workbenchEditorService.currentEditorGroup)===null||$===void 0||$.changeOpenType((Y=Q.componentId)!==null&&Y!==void 0?Y:Q.type),!0}return!1},{items:j,selectIndex:W}=R(M,B);if(j.length===0||typeof W>"u")return!0;F(j)}return!1}})),F(P)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!a.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.COPY_PATH,{execute:async M=>{if(!M)return;let P=M.path.toString();if(M.scheme===s.DIFF_SCHEME){const F=M.getParsedQuery();P=new o.URI(F.modified).path.toString()}let k=decodeURIComponent(P);await this.appService.backendOS===o.OperatingSystem.Windows&&(k=k.slice(1)),await this.clipboardService.writeText(k)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile}),D.registerCommand(o.FILE_COMMANDS.COPY_RELATIVE_PATH,{execute:async M=>{if(!M)return;if(M.scheme===s.DIFF_SCHEME){const k=M.getParsedQuery();M=new o.URI(k.modified).withScheme("file")}const O=this.fileTreeService.getNodeByPathOrUri(M);if(O&&O.filestat.isInSymbolicDirectory)return await this.clipboardService.writeText(O.path.split(d.Path.separator).slice(2).join(d.Path.separator));let P;if(this.fileTreeService.isMultipleWorkspace)for(const k of await this.workspaceService.roots){if(P=new o.URI(k.uri),P.isEqual(M))return await this.clipboardService.writeText("./");if(P.isEqualOrParent(M))return await this.clipboardService.writeText(decodeURIComponent(P.relative(M).toString()))}else if(this.workspaceService.workspace)return P=new o.URI(this.workspaceService.workspace.uri),P.isEqual(M)?await this.clipboardService.writeText("./"):await this.clipboardService.writeText(decodeURIComponent(P.relative(M).toString()))},isVisible:()=>!!this.fileTreeModelService.contextMenuFile}),D.registerCommand(o.FILE_COMMANDS.COPY_FILE,{execute:(M,O)=>{if(O&&O.length)this.fileTreeModelService.copyFile(O);else{const P=this.fileTreeModelService.selectedFiles.map(k=>k.uri);P&&P.length&&this.fileTreeModelService.copyFile(P)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)||!!this.fileTreeModelService.focusedFile&&!this.fileTreeModelService.focusedFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.SELECT_CURRENT_NODE,{execute:(M,O)=>{if(O&&O.length)this.fileTreeModelService.selectChildNode(O);else{const P=this.fileTreeModelService.selectedFiles.map(k=>k.uri);P&&P.length&&this.fileTreeModelService.selectChildNode(P)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)||!!this.fileTreeModelService.focusedFile&&!this.fileTreeModelService.focusedFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.CUT_FILE,{execute:(M,O)=>{if(O&&O.length)this.fileTreeModelService.cutFile(O);else{const P=this.fileTreeModelService.selectedFiles.map(k=>k.uri);P&&P.length&&this.fileTreeModelService.cutFile(P)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)||!!this.fileTreeModelService.focusedFile&&!this.fileTreeModelService.focusedFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.PASTE_FILE,{execute:M=>{if(I(),M)this.fileTreeModelService.pasteFile(M);else if(this.fileTreeModelService.focusedFile){let O;this.fileTreeModelService.activeUri?O=this.fileTreeModelService.activeUri:O=this.fileTreeModelService.focusedFile.uri,this.fileTreeModelService.pasteFile(O)}},isEnabled:()=>this.fileTreeModelService.pasteStore&&this.fileTreeModelService.pasteStore.type!==f.PasteTypes.NONE||this.appConfig.isElectronRenderer}),D.registerCommand(o.FILE_COMMANDS.VSCODE_OPEN_FOLDER,{execute:(M,O)=>{const P=this.injector.get(o.IWindowService),k={newWindow:!0};return typeof O=="boolean"?k.newWindow=O:k.newWindow=typeof O?.forceNewWindow=="boolean"?O.forceNewWindow:!0,M?P.openWorkspace(M,k):this.commandService.executeCommand(o.FILE_COMMANDS.OPEN_FOLDER.id,k)},isVisible:()=>{const M=this.preferenceService.get("application.supportsOpenFolder");return M??!1}}),D.registerCommand(o.FILE_COMMANDS.OPEN_FOLDER,{execute:M=>{const O=this.injector.get(o.IWindowService);this.appConfig.isElectronRenderer?this.injector.get(o.IElectronNativeDialogService).showOpenDialog({title:(0,o.localize)("workspace.openDirectory"),properties:["openDirectory"]}).then(k=>{k&&k.length>0&&O.openWorkspace(o.URI.file(k[0]),M||{newWindow:!0})}):this.injector.get(u.IWindowDialogService).showOpenDialog({title:(0,o.localize)("workspace.openDirectory"),canSelectFiles:!1,canSelectFolders:!0}).then(k=>{var F;k&&k.length>0&&this.injector.get(E.IWorkspaceService).open(k[0],{preserveWindow:(F=M?.newWindow)!==null&&F!==void 0?F:!1})})},isVisible:()=>{const M=this.preferenceService.get("application.supportsOpenFolder");return M??!1}}),D.registerCommand(o.FILE_COMMANDS.OPEN_WORKSPACE,{execute:M=>{if(!this.preferenceService.get("application.supportsOpenWorkspace"))return;const P=this.injector.get(o.IWindowService);this.appConfig.isElectronRenderer?this.injector.get(o.IElectronNativeDialogService).showOpenDialog({title:(0,o.localize)("workspace.openWorkspace"),properties:["openFile"],filters:[{name:(0,o.localize)("workspace.openWorkspaceTitle"),extensions:[this.workspaceService.workspaceSuffixName]}]}).then(F=>{F&&F.length>0&&P.openWorkspace(o.URI.file(F[0]),M||{newWindow:!0})}):this.injector.get(u.IWindowDialogService).showOpenDialog({title:(0,o.localize)("workspace.openWorkspace"),canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1,filters:{workspace:[this.workspaceService.workspaceSuffixName]}}).then(F=>{var L;F&&F.length>0&&this.injector.get(E.IWorkspaceService).open(F[0],{preserveWindow:(L=M?.newWindow)!==null&&L!==void 0?L:!1})})},isVisible:()=>{const M=this.preferenceService.get("application.supportsOpenWorkspace");return M??!1}}),D.registerCommand(o.FILE_COMMANDS.REVEAL_IN_EXPLORER,{execute:M=>{var O;let P=M instanceof o.URI?M:M?.uri;const k=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);k&&!k.isVisible&&k.activate(),k&&k.isCollapsed(f.RESOURCE_VIEW_ID)&&k?.setCollapsed(f.RESOURCE_VIEW_ID,!1),!P&&(!((O=this.workbenchEditorService.currentEditor)===null||O===void 0)&&O.currentUri)&&(P=this.workbenchEditorService.currentEditor.currentUri),P&&this.revealFile(o.URI.parse(P.toString()))}}),D.registerCommand(o.FILE_COMMANDS.FOCUS_FILES,{execute:()=>{const M=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);M&&M.activate()}}),D.registerCommand(o.FILE_COMMANDS.OPEN_FILE,{execute:M=>this.windowDialogService.showOpenDialog(M)}),D.registerCommand(o.FILE_COMMANDS.SAVE_FILE,{execute:M=>this.windowDialogService.showSaveDialog(M)}),D.registerCommand(o.FILE_COMMANDS.FILTER_TOGGLE,{execute:()=>this.fileTreeService.toggleFilterMode()}),D.registerCommand(o.FILE_COMMANDS.FILTER_OPEN,{execute:()=>{if(!this.fileTreeService.filterMode)return this.fileTreeService.toggleFilterMode()}}),D.registerCommand(o.FILE_COMMANDS.FILTER_CLOSE,{execute:()=>{this.fileTreeService.filterMode&&this.fileTreeService.toggleFilterMode()}}),D.registerCommand(o.FILE_COMMANDS.NEXT,{execute:()=>{this.fileTreeModelService.moveToNext()}}),D.registerCommand(o.FILE_COMMANDS.PREV,{execute:()=>{this.fileTreeModelService.moveToPrev()}}),D.registerCommand(o.FILE_COMMANDS.COLLAPSE,{execute:()=>{this.fileTreeModelService.collapseCurrentFile()}}),D.registerCommand(o.FILE_COMMANDS.EXPAND,{execute:()=>{this.fileTreeModelService.expandCurrentFile()}}),D.registerCommand(o.FILE_COMMANDS.TOGGLE_OR_OPEN,{execute:()=>{this.fileTreeModelService.toggleOrOpenCurrentFile()}}),D.registerCommand(o.WORKSPACE_COMMANDS.REMOVE_WORKSPACE_FOLDER,{execute:async(M,O)=>{if(I(),!O.length||!this.workspaceService.isMultiRootWorkspaceOpened)return;const P=await this.workspaceService.roots,k=O.filter(F=>P.find(L=>L.uri===F.toString()));k.length>0&&await this.workspaceService.removeRoots(k)},isVisible:()=>this.workspaceService.isMultiRootWorkspaceOpened&&!!this.fileTreeModelService.contextMenuFile&&!!this.workspaceService.tryGetRoots().find(M=>{var O;return M.uri===((O=this.fileTreeModelService.contextMenuFile)===null||O===void 0?void 0:O.uri.toString())})})}registerKeybindings(D){D.registerKeybinding({command:o.FILE_COMMANDS.COPY_FILE.id,keybinding:"ctrlcmd+c",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.PASTE_FILE.id,keybinding:"ctrlcmd+v",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.CUT_FILE.id,keybinding:"ctrlcmd+x",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.SELECT_CURRENT_NODE.id,keybinding:"ctrlcmd+a",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.RENAME_FILE.id,keybinding:"enter",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.DELETE_FILE.id,keybinding:"ctrlcmd+backspace",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.FILTER_OPEN.id,keybinding:"ctrlcmd+f",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.FILTER_CLOSE.id,keybinding:"esc",when:`${c.FilesExplorerFocusedContext.raw} && ${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.NEXT.id,keybinding:"down",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.PREV.id,keybinding:"up",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.EXPAND.id,keybinding:"right",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.COLLAPSE.id,keybinding:"left",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.TOGGLE_OR_OPEN.id,keybinding:"space",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`})}registerToolbarItems(D){D.registerItem({id:o.FILE_COMMANDS.LOCATION_WITH_EDITOR.id,command:o.FILE_COMMANDS.LOCATION_WITH_EDITOR.id,label:(0,o.localize)("file.location"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !config.explorer.autoReveal && !${c.FilesExplorerFilteredContext.raw}`,order:0}),D.registerItem({id:o.FILE_COMMANDS.NEW_FILE.id,command:o.FILE_COMMANDS.NEW_FILE.id,label:(0,o.localize)("file.new"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !${c.FilesExplorerFilteredContext.raw}`,order:1}),D.registerItem({id:o.FILE_COMMANDS.NEW_FOLDER.id,command:o.FILE_COMMANDS.NEW_FOLDER.id,label:(0,o.localize)("file.folder.new"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !${c.FilesExplorerFilteredContext.raw}`,order:2}),D.registerItem({id:o.FILE_COMMANDS.FILTER_TOGGLE.id,command:o.FILE_COMMANDS.FILTER_TOGGLE.id,label:(0,o.localize)("file.filetree.filter"),viewId:f.RESOURCE_VIEW_ID,toggledWhen:`${c.FilesExplorerFilteredContext.raw}`,order:3}),D.registerItem({id:o.FILE_COMMANDS.REFRESH_ALL.id,command:o.FILE_COMMANDS.REFRESH_ALL.id,label:(0,o.localize)("file.refresh"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !${c.FilesExplorerFilteredContext.raw}`,order:4}),D.registerItem({id:o.FILE_COMMANDS.COLLAPSE_ALL.id,command:o.FILE_COMMANDS.COLLAPSE_ALL.id,label:(0,o.localize)("file.collapse"),viewId:f.RESOURCE_VIEW_ID,order:5}),D.registerItem({id:o.WORKSPACE_COMMANDS.ADD_WORKSPACE_FOLDER.id,command:o.WORKSPACE_COMMANDS.ADD_WORKSPACE_FOLDER.id,label:(0,o.localize)("workspace.addFolderToWorkspace"),viewId:f.RESOURCE_VIEW_ID,order:0,group:"file_explore_workspace",when:"config.workspace.supportMultiRootWorkspace"})}doDelete(){const D=this.willDeleteUris.slice();return this.willDeleteUris=[],this.fileTreeModelService.deleteFileByUris(D)}dispose(){this._disposables.dispose()}};t.FileTreeContribution=w,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],w.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(f.IFileTreeService),n.__metadata("design:type",y.FileTreeService)],w.prototype,"fileTreeService",void 0),n.__decorate([(0,r.Autowired)(l.IMainLayoutService),n.__metadata("design:type",Object)],w.prototype,"mainLayoutService",void 0),n.__decorate([(0,r.Autowired)(v.IProgressService),n.__metadata("design:type",Object)],w.prototype,"progressService",void 0),n.__decorate([(0,r.Autowired)(E.IWorkspaceService),n.__metadata("design:type",Object)],w.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(A.FileTreeModelService),n.__metadata("design:type",A.FileTreeModelService)],w.prototype,"fileTreeModelService",void 0),n.__decorate([(0,r.Autowired)(_.IDecorationsService),n.__metadata("design:type",_.IDecorationsService)],w.prototype,"decorationService",void 0),n.__decorate([(0,r.Autowired)(s.WorkbenchEditorService),n.__metadata("design:type",s.WorkbenchEditorService)],w.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(o.CommandService),n.__metadata("design:type",Object)],w.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(u.IWindowDialogService),n.__metadata("design:type",Object)],w.prototype,"windowDialogService",void 0),n.__decorate([(0,r.Autowired)(o.IClipboardService),n.__metadata("design:type",Object)],w.prototype,"clipboardService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],w.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.QuickOpenService),n.__metadata("design:type",Object)],w.prototype,"quickOpenService",void 0),n.__decorate([(0,r.Autowired)(l.IViewsRegistry),n.__metadata("design:type",Object)],w.prototype,"viewsRegistry",void 0),n.__decorate([(0,r.Autowired)(o.IApplicationService),n.__metadata("design:type",Object)],w.prototype,"appService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],w.prototype,"appConfig",void 0),t.FileTreeContribution=w=n.__decorate([(0,m.Domain)(p.MenuContribution,o.CommandContribution,o.KeybindingContribution,o.TabBarToolbarContribution,o.ClientAppContribution,l.MainLayoutContribution)],w)},2812:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeModel=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(69959),m=e(93239);let _=n=class extends c.TreeModel{constructor(g){super(),this.flushDispatchChangeDelayer=new p.ThrottledDelayer(n.DEFAULT_FLUSH_DELAY),this.init(g)}init(g){this.root=g,this.root.watcher.on(c.TreeNodeEvent.BranchDidUpdate,this.doDispatchChange.bind(this)),this.decorationService.onDidChange(this.doDispatchChange.bind(this))}doDispatchChange(){this.flushDispatchChangeDelayer.isTriggered()||this.flushDispatchChangeDelayer.cancel(),this.flushDispatchChangeDelayer.trigger(async()=>{this.dispatchChange()})}};t.FileTreeModel=_,_.DEFAULT_FLUSH_DELAY=100,r.__decorate([(0,o.Autowired)(m.FileTreeDecorationService),r.__metadata("design:type",m.FileTreeDecorationService)],_.prototype,"decorationService",void 0),t.FileTreeModel=_=n=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__param(0,(0,o.Optional)()),r.__metadata("design:paramtypes",[v.Directory])],_)},46377:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FILE_TREE_BADGE_LIMIT=t.FILE_TREE_NODE_HEIGHT=t.FileTreeNode=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(97267),p=e(41869),v=e(69959),m=n.__importDefault(e(89200)),{Path:_}=p.path,s=({item:g,onClick:l,onDoubleClick:h,onContextMenu:u,dndService:d,itemType:E,decorationService:f,labelService:a,leftPadding:b=8,onTwistierClick:y,decorations:A,defaultLeftPadding:S=8,template:w,hasFolderIcons:T,hasFileIcons:D,hidesExplorerArrows:I,hasPrompt:R,iconService:M})=>{const[O,P]=o.default.useState(-1),k=E===c.TreeNodeType.RenamePrompt,F=E===c.TreeNodeType.NewPrompt,L=k||F,B=!L&&g.name.indexOf(_.separator)>=0,j=(0,p.useDesignStyles)(m.default.expansion_toggle,"expansion_toggle"),W=(0,p.useDesignStyles)(m.default.file_tree_node,"file_tree_node"),U=L?null:f.getDecoration(g.uri,v.Directory.is(g)),Q=Pe=>{(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&(B&&P(g.name.split(_.separator).length-1),l(Pe,g,E))},V=Pe=>{(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&(B&&P(g.name.split(_.separator).length-1),h(Pe,g,E))},$=Pe=>{(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&(y?y(Pe,g,E):l(Pe,g,E))},Y=o.default.useCallback(Pe=>{Pe.nativeEvent.which!==0&&(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&u(Pe,g,E)},[u,g]),G=o.default.useCallback(Pe=>{const{handleDragStart:Se}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Se(Pe,g)},[d,g]),z=o.default.useCallback(Pe=>{const{handleDragLeave:Se}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Se(Pe,g)},[d,g]),K=o.default.useCallback(Pe=>{const{handleDragEnter:Se}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Se(Pe,g)},[d,g]),Z=o.default.useCallback(Pe=>{const{handleDrop:Se}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Se(Pe,g)},[d,g]),X=o.default.useCallback(Pe=>{const{handleDragOver:Se}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Se(Pe,g)},[d,g]);let oe=E===c.TreeNodeType.CompositeTreeNode,ne;L?F?(oe=g.type===c.TreeNodeType.CompositeTreeNode,ne=`${S+(g.parent.depth+1||0)*(b||0)+(oe?0:T?I?0:20:0)}px`):(oe=g.target.type===c.TreeNodeType.CompositeTreeNode,ne=`${S+(g.target.depth||0)*(b||0)+(oe?0:T?I?0:20:0)}px`):ne=`${S+(g.depth||0)*(b||0)+(oe?0:T?I?0:20:0)}px`;const ue={color:U?U.color:"",height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`,paddingLeft:ne,opacity:R&&!L?".6":"1"},fe=(Pe,Se)=>{if(A&&A?.classlist.indexOf(m.default.mod_loading)>-1)return o.default.createElement(c.Loading,null);if(L&&Pe instanceof c.PromptHandle){let Te=!1;if(k?Te=Pe.target.type===c.TreeNodeType.CompositeTreeNode:Te=Pe.type===c.TreeNodeType.CompositeTreeNode,Te)return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,j,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:F||!(k&&Pe.target.type===c.TreeNodeType.CompositeTreeNode&&Pe.target.expanded)})})}else return o.default.createElement("div",{onClick:Se,className:(0,r.default)(m.default.file_tree_node_segment,j,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:!Pe.expanded})})},q=Pe=>{let Se,Te;L&&Pe instanceof c.PromptHandle?Pe instanceof c.RenamePromptHandle?(Se=Pe.target.uri.resolve(Pe.$.value),Te=v.Directory.is(Pe.target)):(Se=Pe.parent.uri.resolve(Pe.$.value),Te=Pe.type===c.TreeNodeType.CompositeTreeNode):(Se=Pe.uri,Te=Pe.filestat.isDirectory);const Ee=a.getIcon(Se,{isDirectory:Te,isOpenedDirectory:Te&&Pe.expanded});return Te&&!T||!Te&&!D?null:o.default.createElement("div",{className:(0,r.default)(m.default.file_icon,Ee,{expanded:Te&&Pe.expanded}),style:{height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`}})},Ae=Pe=>{if(w)return o.default.createElement(w,null);if(L&&Pe instanceof c.PromptHandle)return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_inputbox)},o.default.createElement("div",{className:(0,r.default)("input-box",m.default.file_tree_node_prompt_box)},o.default.createElement(Pe.ProxiedInput,{wrapperStyle:{height:t.FILE_TREE_NODE_HEIGHT,padding:"0 5px"}})));if(B){const Se=Pe.displayName.split(_.separator),Te=Se.map((Ee,me)=>{const Ne=Se.slice(0,me+1).join(_.separator),Me=Be=>{Be.stopPropagation(),P(me);const ze=g.parent.uri.resolve(Se.slice(0,me+1).join(_.separator));l(Be,g,E,ze)},Fe=Be=>{Be.stopPropagation(),P(me);const ze=g.parent.uri.resolve(Se.slice(0,me+1).join(_.separator));u(Be,g,E,ze)},_e=Be=>{Be.stopPropagation(),Be.preventDefault(),O!==me&&(P(me),d.handleDragOver(Be,g))},re=Be=>{Be.stopPropagation(),Be.preventDefault(),P(-1)},he=Be=>{Be.stopPropagation(),O!==me&&P(me);const ze=g.parent.uri.resolve(Se.slice(0,me+1).join(_.separator));d.handleDragStart(Be,g,ze)},Oe=Be=>{const ze=g.parent.uri.resolve(Se.slice(0,me+1).join(_.separator));d.handleDrop(Be,g,ze)},De=(0,r.default)(O===me&&m.default.active,m.default.compact_name);return o.default.createElement("span",{key:Ne},o.default.createElement("a",{className:De,draggable:!0,onContextMenu:Fe,onDragStart:he,onDragOver:_e,onDragLeave:re,onDrop:Oe,onClick:Me},Ee),me!==Se.length-1?o.default.createElement("span",{className:m.default.compact_name_separator},_.separator):null)});return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_displayname)},Te)}return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_displayname)},a.getName(Pe.uri)||Pe.displayName)},pe=()=>o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_tail)},ie()),ie=()=>U?o.default.createElement("div",{className:m.default.file_tree_node_status},(0,p.transformLabelWithCodicon)(U.badge.slice(),{color:"inherit"},M.fromString.bind(M))):null,ge=Pe=>{if(I)return null;if(oe)return fe(Pe,$);if(L)return fe(Pe,()=>{})},Ie=()=>{let Pe=g.tooltip;return U&&U.badge&&(Pe+=` \u2022 ${U.tooltip}`),Pe};return o.default.createElement("div",{key:g.id,onClick:Q,onDoubleClick:V,onContextMenu:Y,onDragStart:G,onDragOver:X,onDragEnter:K,onDragLeave:z,onDrop:Z,title:Ie(),className:(0,r.default)(W,A?A.classlist:null),style:ue,draggable:E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode,"data-id":g.id},o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_content)},ge(g),q(g),o.default.createElement("div",{className:L?m.default.file_tree_node_prompt_wrap:m.default.file_tree_node_overflow_wrap},Ae(g)),pe()))};t.FileTreeNode=s,t.FILE_TREE_NODE_HEIGHT=22,t.FILE_TREE_BADGE_LIMIT=99},56384:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTree=t.FILE_TREE_FILTER_DELAY=t.FILTER_AREA_HEIGHT=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(97267),p=e(41869),v=e(68974),m=e(24429),_=e(87420),s=e(6250),g=e(46377),l=n.__importDefault(e(2613)),h=e(97738);t.FILTER_AREA_HEIGHT=30,t.FILE_TREE_FILTER_DELAY=500;const u=(0,c.RecycleTreeFilterDecorator)(c.RecycleTree),d=({viewState:f})=>{const[a,b]=(0,o.useState)(!1),[y,A]=(0,o.useState)(!0),[S,w]=(0,o.useState)(!1),[T,D]=(0,o.useState)(!1),[I,R]=(0,o.useState)(),M=(0,o.useRef)(null),O=(0,o.useRef)(new p.DisposableCollection),{height:P}=f,k=(0,p.useInjectable)(s.IFileTreeService),{iconService:F,locationToCurrentFile:L,filterMode:B,indent:j,baseIndent:W}=k,U=(0,p.useInjectable)(h.FileTreeModelService),[Q,V]=(0,o.useState)({indent:j,baseIndent:W}),[$,Y]=(0,o.useState)(B),[G,z]=(0,o.useState)(F.currentTheme||{hasFolderIcons:!0,hasFileIcons:!0,hidesExplorerArrows:!0}),K=(0,o.useCallback)(Ne=>Z(Ne)?!1:Ne.shiftKey,[]),Z=(0,o.useCallback)(Ne=>{const{metaKey:Me,ctrlKey:Fe}=Ne;return p.isOSX&&Me||Fe},[]),X=(0,o.useCallback)((Ne,Me,Fe,_e)=>{Ne.stopPropagation();const{handleItemClick:re,handleItemToggleClick:he,handleItemRangeClick:Oe}=U;if(!Me)return;const De=K(Ne),Be=Z(Ne);De?Oe(Me,Fe):Be?he(Me,Fe):re(Me,Fe,_e)},[]),oe=(0,o.useCallback)((Ne,Me,Fe)=>{Ne.stopPropagation();const{handleItemDoubleClick:_e}=U;Me&&_e(Me,Fe)},[]),ne=(0,o.useCallback)((Ne,Me)=>{Ne.stopPropagation();const{toggleDirectory:Fe}=U;Fe(Me)},[]);(0,o.useEffect)(()=>{a&&U.onFileTreeModelChange(async Ne=>{A(!0),Ne&&await Ne.ensureReady,R(Ne),A(!1)})},[a]),(0,o.useEffect)(()=>{var Ne,Me,Fe;const _e=new p.CancellationTokenSource;return q(_e.token),(Ne=O.current)===null||Ne===void 0||Ne.push(F.onThemeChange(re=>{z(re)})),(Me=O.current)===null||Me===void 0||Me.push(k.onTreeIndentChange(({indent:re,baseIndent:he})=>{V({indent:re,baseIndent:he})})),(Fe=O.current)===null||Fe===void 0||Fe.push(k.onFilterModeChange(re=>{Y(re)})),()=>{var re;_e.cancel(),(re=O.current)===null||re===void 0||re.dispose()}},[]);const ue=(0,o.useCallback)((Ne,Me)=>{let Fe;if(Ne&&Me)for(Fe=Ne.parentNode;Fe;){if(Me===Fe)return!0;Fe=Fe.parentNode}return!1},[]),fe=(0,o.useCallback)(Ne=>{ue(Ne.relatedTarget,M.current)||!Ne.relatedTarget||(w(!1),U.handleTreeBlur())},[M.current]);(0,o.useEffect)(()=>{$||(U.fileTreeHandle&&U.fileTreeHandle.clearFilter(),U.selectedFiles.length===1&&U.location(U.selectedFiles[0].uri))},[$]),(0,o.useEffect)(()=>{const Ne=new p.DisposableCollection;return I&&(Ne.push(U.onDidFocusedFileChange(Me=>{Me?Me.isEqual((I?.root).uri)?S||w(!S):S&&w(!S):Me||S&&w(!S)})),Ne.push(U.onDidContextMenuFileChange(Me=>{Me?Me.isEqual((I?.root).uri)?S||w(!S):S&&w(!S):Me||S&&w(!S)}))),()=>{Ne.dispose()}},[I,S]);const q=(0,o.useCallback)(async Ne=>{var Me;if(await U.whenReady,!Ne.isCancellationRequested){if(U.treeModel){if(await U.treeModel.ensureReady,R(U.treeModel),Ne.isCancellationRequested)return;M.current&&k.initContextKey(M.current)}A(!1),!((Me=O.current)===null||Me===void 0)&&Me.disposed||b(!0)}},[U,O.current]),Ae=(0,o.useCallback)(Ne=>{U.handleTreeHandler({...Ne,getModel:()=>U.treeModel,hasDirectFocus:()=>M.current===document.activeElement})},[M.current,I]),pe=(0,o.useCallback)(()=>{const{handleItemClick:Ne}=U;Ne()},[]),ie=(0,o.useCallback)(()=>{U.handleDblClick()},[]),ge=(0,o.useCallback)(()=>{const{handleTreeFocus:Ne}=U;Ne()},[]),Ie=(0,o.useCallback)(Ne=>{const{handleContextMenu:Me}=U;Me(Ne)},[]),Pe=(0,o.useCallback)(Ne=>{Ne.stopPropagation(),Ne.preventDefault()},[]),Se=(0,o.useCallback)(Ne=>{Ne.preventDefault(),D(!0)},[]),Te=(0,o.useCallback)(()=>{D(!1)},[]),Ee=(0,o.useCallback)(Ne=>{const{handleDrop:Me}=U.dndService;D(!1),Me(Ne)},[]),me=(0,o.useCallback)((Ne,Me,Fe,_e)=>{const{handleContextMenu:re}=U;re(Ne,Me,_e)},[]);return o.default.createElement("div",{className:(0,r.default)(l.default.file_tree,T&&l.default.outer_drag_over,S&&l.default.outer_active),tabIndex:-1,ref:M,onClick:pe,onDoubleClick:ie,onFocus:ge,onBlur:fe,onContextMenu:Ie,draggable:!0,onDragStart:Pe,onDragLeave:Te,onDragOver:Se,onDrop:Ee},o.default.createElement(E,{isLoading:y,isReady:a,height:P,model:I,iconTheme:G,treeIndent:Q,filterMode:$,locationToCurrentFile:L,onTreeReady:Ae,onContextMenu:me,onItemClick:X,onItemDoubleClick:oe,onTwistierClick:ne}))};t.FileTree=d;const E=(0,o.memo)(({isReady:f,isLoading:a,height:b,model:y,filterMode:A,treeIndent:S,iconTheme:w,onTreeReady:T,onItemClick:D,onItemDoubleClick:I,onContextMenu:R,onTwistierClick:M})=>{const O=(0,p.useInjectable)(s.IFileTreeService),P=(0,p.useInjectable)(_.IIconService),{decorationService:k,labelService:F,locationToCurrentFile:L}=O,B=(0,p.useInjectable)(h.FileTreeModelService),j=(0,o.useCallback)(W=>o.default.createElement(g.FileTreeNode,{item:W.item,itemType:W.itemType,template:W.template,decorationService:k,labelService:F,iconService:P,dndService:B.dndService,decorations:B.decorations.getDecorations(W.item),onClick:D,onDoubleClick:I,onTwistierClick:M,onContextMenu:R,defaultLeftPadding:S.baseIndent,leftPadding:S.indent,hasPrompt:W.hasPrompt,hasFolderIcons:w.hasFolderIcons,hasFileIcons:w.hasFileIcons,hidesExplorerArrows:w.hidesExplorerArrows}),[y,S,w]);return f?a?o.default.createElement(v.Progress,{loading:!0}):y?o.default.createElement(u,{height:b,itemHeight:g.FILE_TREE_NODE_HEIGHT,onReady:T,model:y,filterEnabled:A,filterAfterClear:L,filterAutoFocus:!0,leaveBottomBlank:!0},j):o.default.createElement(m.WelcomeView,{viewId:s.FILE_EXPLORER_WELCOME_ID}):o.default.createElement(v.Progress,{loading:!0})});E.displayName="FileTreeView"},57781:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeService=void 0;const n=e(85608),r=e(76003),o=e(97267),c=e(41869),p=e(18193),v=e(26542),m=e(42933),_=e(52416),s=e(51500),g=e(6250),l=e(69959),h=e(88014),u=e(93239),{Path:d}=c.path;let E=class extends o.Tree{constructor(){super(...arguments),this._fileServiceWatchers=new Map,this._symbolicFiles=new Map,this._changeEventDispatchQueue=new Set,this._readyToWatch=!1,this._watchRootsQueue=[],this.effectedNodes=[],this.onWorkspaceChangeEmitter=new c.Emitter,this.onTreeIndentChangeEmitter=new c.Emitter,this.onFilterModeChangeEmitter=new c.Emitter,this.onNodeRefreshedEmitter=new c.Emitter,this._filterMode=!1,this._refreshable=!0,this.refreshEffectNode=()=>{const a=this.effectedNodes.slice(0);if(this.effectedNodes=[],a.find(y=>l.Directory.isRoot(y)))this.refresh();else for(const y of a)this.refresh(y)},this.flushEventQueue=async()=>{if(!this._changeEventDispatchQueue||this._changeEventDispatchQueue.size===0)return;const a=Array.from(this._changeEventDispatchQueue),b=this.sortPaths(a);(!this.refreshCancelToken||this.refreshCancelToken.token.isCancellationRequested)&&(this.refreshCancelToken=new c.CancellationTokenSource);const y=(0,c.pSeries)(b.map(A=>async()=>{l.Directory.is(A.node)&&await A.node.refresh(this.refreshCancelToken)}));return this._changeEventDispatchQueue.clear(),await y},this.locationToCurrentFile=()=>{this.commandService.executeCommand(c.FILE_COMMANDS.LOCATION.id)}}get onNodeRefreshed(){return this.onNodeRefreshedEmitter.event}get refreshable(){return this._refreshable}get filterMode(){return this._filterMode}get baseIndent(){return this._baseIndent}get indent(){return this._indent}get onWorkspaceChange(){return this.onWorkspaceChangeEmitter.event}get onTreeIndentChange(){return this.onTreeIndentChangeEmitter.event}get onFilterModeChange(){return this.onFilterModeChangeEmitter.event}get isCompactMode(){return this._isCompactMode}get contextKey(){return this.fileContextKey}async init(){this._roots=await this.workspaceService.roots,await this.preferenceService.ready,this._baseIndent=this.preferenceService.getValid("explorer.fileTree.baseIndent",8),this._indent=this.preferenceService.getValid("explorer.fileTree.indent",8),this._isCompactMode=this.preferenceService.getValid("explorer.compactFolders",!0),this.toDispose.push(this.workspaceService.onWorkspaceChanged(a=>{this._roots=a;const b=new c.URI(a[0].uri),y=new l.Directory(this,void 0,b,b.displayName,a[0],this.fileTreeAPI.getReadableTooltip(b));this.root=y,this.onWorkspaceChangeEmitter.fire(y),this.refresh()})),this.toDispose.push(this.workspaceService.onWorkspaceFileExcludeChanged(()=>{this.refresh()})),this.toDispose.push(c.Disposable.create(()=>{var a;(a=this._root)===null||a===void 0||a.dispose(),this._roots=null})),this.toDispose.push(this.corePreferences.onPreferenceChanged(a=>{a.preferenceName==="explorer.fileTree.baseIndent"?(this._baseIndent=a.newValue||8,this.onTreeIndentChangeEmitter.fire({indent:this.indent,baseIndent:this.baseIndent})):a.preferenceName==="explorer.fileTree.indent"?(this._indent=a.newValue||8,this.onTreeIndentChangeEmitter.fire({indent:this.indent,baseIndent:this.baseIndent})):a.preferenceName==="explorer.compactFolders"&&(this._isCompactMode=a.newValue,this.refresh())}))}initContextKey(a){this.fileContextKey.initScopedContext(a)}startWatchFileEvent(){return this._readyToWatch=!0,Promise.all(this._watchRootsQueue.map(a=>this.watchFilesChange(a)))}async resolveChildren(a){var b,y,A,S;let w=[];if(a){if(l.Directory.isRoot(a)&&this.isMultipleWorkspace){const T=await this.workspaceService.roots;for(const D of T){const I=this.fileTreeAPI.toNode(this,D,a,this.workspaceService.getWorkspaceName(new c.URI(D.uri)));this.watchFilesChange(new c.URI(D.uri)),w=w.concat(I),(I.filestat.isSymbolicLink||I.filestat.isInSymbolicDirectory)&&this._symbolicFiles.set(I.filestat.uri,I)}return w}if(a.uri){const T=await this.fileTreeAPI.resolveChildren(this,a.uri.toString(),a,this.isCompactMode&&!l.Directory.isRoot(a));w=T.children,w.forEach(I=>{(I.filestat.isSymbolicLink||I.filestat.isInSymbolicDirectory)&&this._symbolicFiles.set(I.filestat.uri,I)});const D=T.filestat;if(D&&this.isCompactMode&&!l.Directory.isRoot(a)){const I=new c.URI(D.uri),R=a.parent;if(a&&R){let M=a.name;if(a.filestat.isSymbolicLink){const O=(y=new c.URI(a.filestat.realUri).relative(I))===null||y===void 0?void 0:y.toString();O&&(M=O,M=[a.uri.displayName].concat(M.split(d.separator)).join(d.separator))}else R.filestat.isSymbolicLink?M=(A=new c.URI(R.filestat.realUri).relative(I))===null||A===void 0?void 0:A.toString():M=(S=R.uri.relative(I))===null||S===void 0?void 0:S.toString();M&&M!==a.name&&a.updateMetaData({name:M,uri:I,tooltip:this.fileTreeAPI.getReadableTooltip(I),fileStat:D})}}return w}}else if(this._roots||(this._roots=await this.workspaceService.roots),this.isMultipleWorkspace){const T=new c.URI((b=this.workspaceService.workspace)===null||b===void 0?void 0:b.uri);let D=T.displayName;D=D.slice(0,D.lastIndexOf("."));const I={...this.workspaceService.workspace,isDirectory:!0},R=new l.Directory(this,void 0,T,D,I,this.fileTreeAPI.getReadableTooltip(T));return this.root=R,[R]}else if(this._roots.length>0)return w=await(await this.fileTreeAPI.resolveChildren(this,this._roots[0])).children,w.forEach(T=>{const D=this.workspaceService.getWorkspaceName(T.uri);D&&D!==T.name&&T.updateMetaData({name:D}),(T.filestat.isSymbolicLink||T.filestat.isInSymbolicDirectory)&&this._symbolicFiles.set(T.filestat.uri,T)}),this.watchFilesChange(new c.URI(this._roots[0].uri)),this.root=w[0],w;return[]}async watchFilesChange(a){if(!this._readyToWatch){this._watchRootsQueue.push(a);return}const b=await this.fileServiceClient.watchFileChanges(a);this.toDispose.push(b),this.toDispose.push(b.onFilesChanged(y=>{this.onFilesChanged(y)})),this._fileServiceWatchers.set(a.toString(),b)}updateRefreshable(a){var b;a!==this.refreshable&&(this._refreshable=a,this._refreshable?this.doHandleQueueChange():(b=this.refreshCancelToken)===null||b===void 0||b.cancel())}isContentFile(a){return!!a&&"filestat"in a&&!a.filestat.isDirectory}isFileContentChanged(a){return a.type===m.FileChangeType.UPDATED&&this.isContentFile(this.getNodeByPathOrUri(a.uri))}getAffectedChanges(a){const b=[];for(const y of a)this.isFileContentChanged(y)||b.push(y);return b}isRootAffected(a){return this._roots?a.some(b=>b.type>m.FileChangeType.UPDATED&&this._roots&&this._roots.find(y=>b.uri.indexOf(y.uri)>=0)):!1}async onFilesChanged(a){const b=await this.getAffectedNodes(this.getAffectedChanges(a));return b.length>0?this.effectedNodes=this.effectedNodes.concat(b):!(b.length>0)&&this.isRootAffected(a)&&this.effectedNodes.push(this.root),this.refreshEffectNode()}async getFileTreeNodePathByUri(a){var b,y,A,S,w,T;if(!a)return;let D;if(this.isMultipleWorkspace){if(this._roots||(this._roots=await this.workspaceService.roots),D=(S=this._roots.find(I=>new c.URI(I.uri).isEqualOrParent(a)))===null||S===void 0?void 0:S.uri,D){const I=new c.URI(D);if(I.isEqualOrParent(a))return new d(((w=this.root)===null||w===void 0?void 0:w.path)||"/").join(I.displayName).join(((T=I.relative(a))===null||T===void 0?void 0:T.toString())||"").toString()}}else if(D=(b=this.workspaceService.workspace)===null||b===void 0?void 0:b.uri,D){const I=new c.URI(D);if(I.isEqualOrParent(a))return new d(((y=this.root)===null||y===void 0?void 0:y.path)||"").join(((A=I.relative(a))===null||A===void 0?void 0:A.toString())||"").toString()}}async moveNodeByPath(a,b,y,A,S=o.TreeNodeType.TreeNode){const w=new d(a.path).join(y).toString(),T=new d(b.path).join(A).toString();if(w&&T&&T!==w){const D=a.moveNode(w,T);return D&&l.File.is(D)&&(D.updateMetaData({uri:b.uri.resolve(A),fileStat:{...b.filestat,uri:b.uri.resolve(A).toString(),isDirectory:S!==o.TreeNodeType.TreeNode},tooltip:this.fileTreeAPI.getReadableTooltip(b.uri.resolve(A))}),l.Directory.is(D)&&this.updateChildren(D)),D}}async updateChildren(a){const b=a.children;if(!(!b||b.length===0)){for(const y of b)if(l.File.is(y)){const A=a.uri.resolve(y.uri.displayName);y.updateMetaData({uri:A,fileStat:{...y.filestat,uri:A.toString(),isDirectory:!!l.Directory.is(y)},tooltip:this.fileTreeAPI.getReadableTooltip(A)}),l.Directory.is(y)&&this.updateChildren(y)}}}async addNode(a,b,y){let A,S;const w=d.splitPath(b);if(w.length>1){let D=a.uri;for(const I of w)D=D.resolve(I);!this.isCompactMode||l.Directory.isRoot(a)?S=w[0]:y===o.TreeNodeType.CompositeTreeNode?S=b:S=w.slice(0,w.length-1).join(d.separator)}else S=b;A={uri:a.uri.resolve(S).toString(),isDirectory:y===o.TreeNodeType.CompositeTreeNode||w.length>1,isSymbolicLink:!1,lastModification:new Date().getTime()};const T=await this.fileTreeAPI.toNode(this,A,a,S);return T&&a.addNode(T),T}async deleteAffectedNodeByPath(a,b){var y,A;const S=this.getNodeByPathOrUri(a);S&&S.parent&&(this.isCompactMode&&!b?((y=S.parent.children)===null||y===void 0?void 0:y.length)===2?this.refresh((A=S.parent)===null||A===void 0?void 0:A.parent):this.refresh(S.parent):S.parent.removeNode(S.path))}async deleteAffectedNodes(a,b=[]){const y=[];for(const A of a){const S=this.getNodeByPathOrUri(A);S&&l.File.is(S)&&y.push(S)}for(const A of y)!A?.parent||this._changeEventDispatchQueue.has(A?.parent.path)||await this.deleteAffectedNodeByPath(A.path);return b.filter(A=>A.type!==m.FileChangeType.DELETED)}async getAffectedNodes(a){const b=[];for(const y of a){const A=new c.URI(y.uri),S=this.getNodeByPathOrUri(A.parent);S&&b.push(S)}return b}isFileURI(a){return/^file:\/\//.test(a)}getNodeByPathOrUri(a){var b,y,A,S;let w,T;if(typeof a!="string"?(T=a,a=a.toString()):this.isFileURI(a)?T=new c.URI(a):!this.isFileURI(a)&&typeof a=="string"&&(w=a),this.isFileURI(a)&&T){if(this._symbolicFiles.has(T?.toString()))return this._symbolicFiles.get(T.toString());let D;if(this.isMultipleWorkspace?this._roots&&(D=(y=this._roots.find(I=>new c.URI(I.uri).isEqualOrParent(T)))===null||y===void 0?void 0:y.uri):D=(b=this.workspaceService.workspace)===null||b===void 0?void 0:b.uri,this.root&&D){const I=new c.URI(D);if(I.isEqualOrParent(T)){const R=I.relative(T);R&&(w=new d(this.root.path).join(R.toString()).toString())}}}if(w){const D=(A=this.root)===null||A===void 0?void 0:A.getTreeNodeByPath(w);if(!D){let I;const R=w.split(d.separator);for(;R.length>=1;){R.pop();const M=R.join(d.separator);if(I=(S=this.root)===null||S===void 0?void 0:S.getTreeNodeByPath(M),I)break}if(I&&l.Directory.is(I)){for(const M of I.children||[])if(M.path.includes(w))return M}}return D}}sortComparator(a,b){return a.constructor===b.constructor?a.name.localeCompare(b.name,"en",{numeric:!0}):a.type===o.TreeNodeType.CompositeTreeNode?-1:b.type===o.TreeNodeType.CompositeTreeNode?1:0}get contextMenuContextKeyService(){return this.fileContextKey?this.fileContextKey.service:this.contextKeyService}reWatch(){for(const[a,b]of this._fileServiceWatchers)b.dispose(),this.watchFilesChange(new c.URI(a))}get isMultipleWorkspace(){return!!this.workspaceService.workspace&&!this.workspaceService.workspace.isDirectory}getDisplayName(a){return this.workspaceService.getWorkspaceName(a)}async refresh(a=this.root){if(a)return l.Directory.is(a)||l.File.is(a)&&a.parent&&(a=a.parent),this._changeEventDispatchQueue.add(a.path),this.doHandleQueueChange()}async doHandleQueueChange(){if(this.refreshable)try{await this.flushEventQueue()}catch(a){this.logger.error("flush file change event queue error:",a)}finally{this.onNodeRefreshedEmitter.fire()}}sortPaths(a){const y=a.slice().map(S=>({node:this.getNodeByPathOrUri(S),path:S})).filter(S=>S&&!!S.node);a.length>1&&y.sort((S,w)=>{var T,D;const I=((T=S.node)===null||T===void 0?void 0:T.depth)||0,R=((D=w.node)===null||D===void 0?void 0:D.depth)||0;return I-R});const A=[];for(let S=y.length-1;S>=0;S--){const w=y[S];let T=!1;for(let D=0;D<S;D++){const I=y[D];l.Directory.is(I)&&w.node.path.startsWith(I.node.path)&&(T=!0)}T||A.push(w)}return A}openFile(a){const b=this.preferenceService.get("editor.previewMode");this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,a,{disableNavigate:!0,preview:b})}openAndFixedFile(a){this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,a,{disableNavigate:!0,preview:!1,focus:!0})}openToTheSide(a){this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,a,{disableNavigate:!0,split:4})}compare(a,b){this.commandService.executeCommand(c.EDITOR_COMMANDS.COMPARE.id,{original:a,modified:b})}toggleFilterMode(){var a;this._filterMode=!this.filterMode,this.onFilterModeChangeEmitter.fire(this.filterMode),(a=this.fileContextKey)===null||a===void 0||a.filesExplorerFilteredContext.set(this.filterMode),this.filterMode===!1&&this.commandService.executeCommand(c.FILE_COMMANDS.LOCATION.id)}};t.FileTreeService=E,n.__decorate([(0,r.Autowired)(g.IFileTreeAPI),n.__metadata("design:type",Object)],E.prototype,"fileTreeAPI",void 0),n.__decorate([(0,r.Autowired)(c.CommandService),n.__metadata("design:type",Object)],E.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(c.IContextKeyService),n.__metadata("design:type",Object)],E.prototype,"contextKeyService",void 0),n.__decorate([(0,r.Autowired)(s.IWorkspaceService),n.__metadata("design:type",Object)],E.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(p.CorePreferences),n.__metadata("design:type",Object)],E.prototype,"corePreferences",void 0),n.__decorate([(0,r.Autowired)(c.PreferenceService),n.__metadata("design:type",Object)],E.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(v.LabelService),n.__metadata("design:type",v.LabelService)],E.prototype,"labelService",void 0),n.__decorate([(0,r.Autowired)(u.FileTreeDecorationService),n.__metadata("design:type",u.FileTreeDecorationService)],E.prototype,"decorationService",void 0),n.__decorate([(0,r.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],E.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(_.IIconService),n.__metadata("design:type",Object)],E.prototype,"iconService",void 0),n.__decorate([(0,r.Autowired)(c.ILogger),n.__metadata("design:type",Object)],E.prototype,"logger",void 0),n.__decorate([(0,r.Autowired)(h.FileContextKey),n.__metadata("design:type",h.FileContextKey)],E.prototype,"fileContextKey",void 0),t.FileTreeService=E=n.__decorate([(0,r.Injectable)()],E)},83709:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeNextModule=void 0;const n=e(85608),r=e(41869),o=e(72665),c=e(41103),p=e(6250),v=e(89508),m=e(40439),_=e(57781),s=e(88808),g=e(93239),l=e(97738),h=e(24861);let u=class extends r.BrowserModule{constructor(){super(...arguments),this.providers=[{token:p.IFileTreeAPI,useClass:s.FileTreeAPI},{token:g.FileTreeDecorationService,useClass:g.FileTreeDecorationService},{token:p.IFileTreeService,useClass:_.FileTreeService},{token:l.FileTreeModelService,useClass:l.FileTreeModelService},{token:o.IWindowDialogService,useClass:v.WindowDialogServiceImpl},m.FileTreeContribution]}};t.FileTreeNextModule=u,t.FileTreeNextModule=u=n.__decorate([(0,r.Domain)(h.name),(0,r.ModuleDependencies)([c.WorkspaceModule])],u)},88808:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeAPI=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(42933),v=e(72665),m=e(26199),_=e(69959);let s=class{constructor(){this.onDidResolveChildrenEmitter=new c.Emitter,this.onDidResolveChildren=this.onDidResolveChildrenEmitter.event}async resolveChildren(l,h,u,d){var E;let f;if(!this.userhomePath){const a=await this.fileServiceClient.getCurrentUserHome();a&&(this.userhomePath=new c.URI(a.uri))}if(typeof h=="string"?f=await this.fileServiceClient.getFileStat(h):f=await this.fileServiceClient.getFileStat(h.uri),f){if(this.onDidResolveChildrenEmitter.fire(f.uri.toString()),((E=f.children)===null||E===void 0?void 0:E.length)===1&&f.children[0].isDirectory&&d)return await this.resolveChildren(l,f.children[0].uri,u,d);{const a={...f,isInSymbolicDirectory:u?.filestat.isSymbolicLink||u?.filestat.isInSymbolicDirectory};return{children:this.toNodes(l,a,u),filestat:a}}}else return{children:[],filestat:null}}async resolveNodeByPath(l,h,u){const d=await this.fileServiceClient.getFileStat(h);if(d)return this.toNode(l,d,u)}async resolveFileStat(l){return await this.fileServiceClient.getFileStat(l.toString())}toNodes(l,h,u){if(u){if(h.children)return h.children.map(d=>this.toNode(l,d,u))}else return[this.toNode(l,h,u)];return[]}toNode(l,h,u,d){var E;const f=new c.URI(h.uri),a=d||f.displayName;let b;return h.isInSymbolicDirectory=(E=u?.filestat.isSymbolicLink)!==null&&E!==void 0?E:u?.filestat.isInSymbolicDirectory,h.isDirectory?b=new _.Directory(l,u,f,a,h,this.getReadableTooltip(f)):b=new _.File(l,u,f,a,h,this.getReadableTooltip(f)),b}async mvFiles(l,h){const u=[];for(const f of l)if(f.url.isEqualOrParent(h))return;const d=l.sort((f,a)=>f.toString().length-a.toString().length),E=[];for(const f of d)E.length>0&&E.find(a=>a.url.isEqualOrParent(f.url))||E.push(f);if(this.corePreferences["explorer.confirmMove"]){const f=(0,c.localize)("file.confirm.move.ok"),a=(0,c.localize)("file.confirm.move.cancel");if(await this.dialogService.warning((0,c.formatLocalize)("file.confirm.move",`[ ${E.map(y=>y.url.displayName).join(",")} ]`,h.displayName),[a,f])!==f)return}for(const f of E){const a=await this.mv(f.url,h.resolve(f.url.displayName),f.isDirectory);a&&u.push(a)}return u}async mv(l,h,u=!1){try{await this.workspaceEditService.apply({edits:[{newResource:h,oldResource:l,options:{isDirectory:u,overwrite:!0}}]})}catch(d){return d.message}}async createFile(l,h){try{await this.workspaceEditService.apply({edits:[{newResource:l,options:{content:h}}]})}catch(u){return u.message}this.commandService.executeCommand(o.EDITOR_COMMANDS.OPEN_RESOURCE.id,l,{disableNavigate:!0,focus:!0})}async createDirectory(l){try{await this.workspaceEditService.apply({edits:[{newResource:l,options:{isDirectory:!0}}]})}catch(h){return h.message}}async delete(l){try{await this.workspaceEditService.apply({edits:[{oldResource:l,options:{}}]});return}catch(h){return h.message}}async copyFile(l,h){let u=1,d;try{d=await this.fileServiceClient.access(h.toString())}catch(E){return E.message}for(;d;){const E=h.displayName.replace(/\Wcopy\W\d+/,""),f=c.path.extname(E),b=`${c.path.basename(E,f)} copy ${u}${f}`;h=h.parent.resolve(b),u++;try{d=await this.fileServiceClient.access(h.toString())}catch{return}}try{return await this.fileServiceClient.copy(l.toString(),h.toString())}catch(E){return E.message}}getReadableTooltip(l){const h=l.toString(),u=this.userhomePath&&this.userhomePath.toString();return this.userhomePath&&this.userhomePath.isEqualOrParent(l)?decodeURIComponent(h.replace(u,"~")):decodeURIComponent(l.withScheme("").toString())}};t.FileTreeAPI=s,n.__decorate([(0,r.Autowired)(p.IFileServiceClient),n.__metadata("design:type",Object)],s.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(m.IWorkspaceEditService),n.__metadata("design:type",Object)],s.prototype,"workspaceEditService",void 0),n.__decorate([(0,r.Autowired)(c.CommandService),n.__metadata("design:type",Object)],s.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(o.CorePreferences),n.__metadata("design:type",Object)],s.prototype,"corePreferences",void 0),n.__decorate([(0,r.Autowired)(v.IDialogService),n.__metadata("design:type",Object)],s.prototype,"dialogService",void 0),t.FileTreeAPI=s=n.__decorate([(0,r.Injectable)()],s)},93239:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeDecorationService=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(41893),p=e(52416);let v=class{constructor(){this.disposeCollection=new o.DisposableCollection,this.onDidChangeEmitter=new o.Emitter,this.cacheDecorations=new Map,this.disposeCollection.pushAll([this.decorationsService.onDidChangeDecorations(_=>{var s,g,l;const h=(g=(s=_._data)===null||s===void 0?void 0:s._iter)===null||g===void 0?void 0:g._value;if(h){const u=new o.URI(h),d=this.getDecoration(u);this.cacheDecorations.has(h)?((l=this.cacheDecorations.get(h))===null||l===void 0?void 0:l.tooltip)!==d?.tooltip&&this.onDidChangeEmitter.fire():(this.cacheDecorations.set(h,d),this.onDidChangeEmitter.fire())}}),this.themeService.onThemeChange(()=>{this.onDidChangeEmitter.fire()})])}get onDidChange(){return this.onDidChangeEmitter.event}getDecoration(_,s=!1){_ instanceof o.URI&&(_=o.Uri.parse(_.toString()));const g=this.decorationsService.getDecoration(_,s);return g?{...g,color:this.themeService.getColor({id:g.color})}:{color:"",tooltip:"",badge:""}}dispose(){this.disposeCollection.dispose()}};t.FileTreeDecorationService=v,n.__decorate([(0,r.Autowired)(c.IDecorationsService),n.__metadata("design:type",c.IDecorationsService)],v.prototype,"decorationsService",void 0),n.__decorate([(0,r.Autowired)(p.IThemeService),n.__metadata("design:type",Object)],v.prototype,"themeService",void 0),t.FileTreeDecorationService=v=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],v)},30577:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DragAndDropService=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(53622),m=e(14951),_=e(72665),s=e(51500),g=e(6250),l=e(69959),h=r.__importDefault(e(89200)),u=r.__importDefault(e(2613)),d=e(57781),E=e(97738);let f=n=class extends p.WithEventBus{constructor(b){super(),this.model=b,this.toCancelNodeExpansion=new p.DisposableCollection,this.beingDraggedDec=new c.Decoration(h.default.mod_dragging),this.draggedOverDec=new c.Decoration(h.default.mod_dragover),this.beingDraggedNodes=[],this.dragOverTrigger=new p.ThrottledDelayer(n.MS_TILL_DRAGGED_OVER_EXPANDS),this.handleDragStart=(y,A,S)=>{y.stopPropagation();const w=R=>{this.handleDragEnd(R,A)};y.currentTarget.addEventListener("dragend",w,!1);let T=this.model.selectedFiles,D=!1;for(const R of T)R&&R.id===A.id&&(D=!0);D||(T=[A]),this.beingDraggedNodes=T,this.beingDraggedActiveUri=S;const I=T.find(R=>!l.Directory.is(R));if(I&&y.dataTransfer.setData("uri",I.uri.toString()),y.dataTransfer.setData("beingDraggedNodes",JSON.stringify(this.beingDraggedNodes.map(R=>R.uri.toString()))),I){const R=I;R.uri.scheme==="file"&&y.dataTransfer.setData("DownloadURL",`application/octet-stream:${R.displayName}:data:application/octet-stream;base64,${(0,p.encodeBase64)(p.BinaryBuffer.fromString(R.filestat.uri))}`)}if(T.forEach(R=>{this.beingDraggedDec.addTarget(R,c.TargetMatchMode.Self)}),y.dataTransfer){let R;T.length===1?R=S?S.displayName:typeof A.name=="string"?A.name:"":R=String(T.length);const M=document.createElement("div");M.className=u.default.file_tree_drag_image,M.textContent=R,document.body.appendChild(M),y.dataTransfer.setDragImage(M,-10,-10),setTimeout(()=>document.body.removeChild(M),0)}},this.handleDragEnter=(y,A)=>{y.stopPropagation(),y.preventDefault()},this.handleDragLeave=(y,A)=>{y.preventDefault(),y.stopPropagation(),this.toCancelNodeExpansion.dispose(),this.potentialParent&&(this.draggedOverDec.removeTarget(this.potentialParent),this.model.treeModel.dispatchChange())},this.handleDragOver=(y,A)=>{if(y.preventDefault(),y.stopPropagation(),!this.toCancelNodeExpansion.disposed||this.beingDraggedNodes.indexOf(A)>=0)return;this.draggedOverNode=A;const S=l.Directory.is(A)&&A.expanded?A:A.parent;(this.potentialParent!==S||!this.draggedOverDec.hasTarget(S))&&(this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.potentialParent=S,this.draggedOverDec.addTarget(this.potentialParent,c.TargetMatchMode.SelfAndChildren),this.model.treeModel.dispatchChange()),this.potentialParent!==A&&l.Directory.is(A)&&(this.dragOverTrigger.trigger(async()=>{A.expanded?(this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.potentialParent=A,this.draggedOverDec.addTarget(this.potentialParent,c.TargetMatchMode.SelfAndChildren)):(await A.setExpanded(!0),this.draggedOverNode===A&&(this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.potentialParent=A,this.draggedOverDec.addTarget(this.potentialParent,c.TargetMatchMode.SelfAndChildren))),this.model.treeModel.dispatchChange()}),this.toCancelNodeExpansion.push(p.Disposable.create(()=>{this.dragOverTrigger.isTriggered()||this.dragOverTrigger.cancel()})))},this.handleDrop=async(y,A,S)=>{var w,T;this.eventBus.fire(new v.FileTreeDropEvent({event:y.nativeEvent,targetDir:S?S.codeUri.path:A&&A instanceof l.File?(w=A.parent)===null||w===void 0?void 0:w.uri.codeUri.path:A?A.uri.codeUri.path:new p.URI((T=this.workspaceService.workspace)===null||T===void 0?void 0:T.uri).codeUri.path}));try{y.preventDefault(),y.stopPropagation(),y.dataTransfer.dropEffect="copy";let D;const I=!!this.beingDraggedActiveUri;this.fileTreeService.isCompactMode&&S&&!A?.uri.isEqual(S)?D=null:A?D=l.Directory.is(A)?A:A.parent:D=this.root;let R;if(this.beingDraggedActiveUri){const M=this.fileTreeService.getNodeByPathOrUri(this.beingDraggedActiveUri);R=[new l.Directory(this.fileTreeService,M?.parent,this.beingDraggedActiveUri,this.beingDraggedActiveUri.displayName,{uri:this.beingDraggedActiveUri.toString(),isDirectory:!0,lastModification:new Date().getTime()},this.beingDraggedActiveUri.displayName)]}else if(R=this.beingDraggedNodes,!R||R.length===0)try{const M=JSON.parse(y.dataTransfer.getData("beingDraggedNodes"));M&&M.length!==0&&(R=M.map(O=>this.fileTreeService.getNodeByPathOrUri(new p.URI(O))).filter(Boolean),R.length||(R=await Promise.all(M.map(async O=>{const P=new p.URI(O);let k;const F=await this.filesystem.getFileStat(P.toString());return F?.isDirectory?k=new l.Directory(this.fileTreeService,this.root,P,P.displayName,{uri:P.toString(),isDirectory:!0,lastModification:new Date().getTime()},P.displayName):k=new l.File(this.fileTreeService,this.root,P,P.displayName,{uri:P.toString(),isDirectory:!0,lastModification:new Date().getTime()},P.displayName),k}))))}catch{}if(R.length>0){const M=S||D&&D.uri,O=R.filter(P=>P&&P.parent&&(this.beingDraggedActiveUri?!P.parent.uri.isEqual(M):!0));if(O.length>0){const P=await this.fileTreeAPI.mvFiles(O.map(k=>({url:k.uri,isDirectory:k.filestat.isDirectory})),M);if(P&&P.length>0)P.forEach(k=>{this.messageService.error(k)});else if(P){if(D)if(this.fileTreeService.isCompactMode&&I){for(const k of O)this.fileTreeService.refresh(k.parent);this.fileTreeService.refresh(D)}else for(const k of O){const F=D.uri.resolve(k.name);this.fileTreeService.moveNodeByPath(k.parent,D,k.name,k.name,k.type),k.updateMetaData({name:F.displayName,fileStat:{...k.filestat,uri:F.toString()},uri:F,tooltip:this.fileTreeAPI.getReadableTooltip(F)}),l.Directory.is(k)&&this.fileTreeService.refresh(k)}else if(A){if(this.fileTreeService.isCompactMode&&I)for(const k of O)this.fileTreeService.refresh(k.parent);else for(const k of O)this.fileTreeService.deleteAffectedNodeByPath(k.path);this.fileTreeService.refresh(A.parent)}}else return}}A&&this.beingDraggedDec.removeTarget(A),this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.beingDraggedNodes.forEach(M=>{this.beingDraggedDec.removeTarget(M)}),this.beingDraggedNodes=[],this.beingDraggedActiveUri=void 0,this.potentialParent=null,this.model.treeModel.dispatchChange(),this.toCancelNodeExpansion.disposed||this.toCancelNodeExpansion.dispose()}catch(D){this.logger.error(D)}},this.handleDragEnd=(y,A)=>{this.beingDraggedDec.removeTarget(A),this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.beingDraggedNodes.forEach(S=>{this.beingDraggedDec.removeTarget(S)}),this.beingDraggedNodes=[],this.beingDraggedActiveUri=void 0,this.potentialParent=null,this.model.treeModel.dispatchChange(),this.toCancelNodeExpansion.disposed||this.toCancelNodeExpansion.dispose()},this.model.decorations.addDecoration(this.beingDraggedDec),this.model.decorations.addDecoration(this.draggedOverDec)}get root(){return this.model.treeModel.root}};t.DragAndDropService=f,f.MS_TILL_DRAGGED_OVER_EXPANDS=500,r.__decorate([(0,o.Autowired)(g.IFileTreeAPI),r.__metadata("design:type",Object)],f.prototype,"fileTreeAPI",void 0),r.__decorate([(0,o.Autowired)(p.ILogger),r.__metadata("design:type",Object)],f.prototype,"logger",void 0),r.__decorate([(0,o.Autowired)(_.IMessageService),r.__metadata("design:type",Object)],f.prototype,"messageService",void 0),r.__decorate([(0,o.Autowired)(g.IFileTreeService),r.__metadata("design:type",d.FileTreeService)],f.prototype,"fileTreeService",void 0),r.__decorate([(0,o.Autowired)(m.IFileServiceClient),r.__metadata("design:type",Object)],f.prototype,"filesystem",void 0),r.__decorate([(0,o.Autowired)(s.IWorkspaceService),r.__metadata("design:type",Object)],f.prototype,"workspaceService",void 0),t.DragAndDropService=f=n=r.__decorate([(0,o.Injectable)(),r.__param(0,(0,o.Optional)()),r.__metadata("design:paramtypes",[E.FileTreeModelService])],f)},97738:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeModelService=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(91830),m=e(93899),_=e(26542),s=e(54414),g=e(14951),l=e(63067),h=e(53576),u=e(72665),d=e(6250),E=e(69959),f=e(2812),a=e(46377),b=r.__importDefault(e(89200)),y=e(57781),A=e(30577),{Path:S,isValidBasename:w}=p.path,{coalesce:T}=p.arrays,{trim:D,rtrim:I}=p.strings;let R=n=class{constructor(){this._isDisposed=!1,this._whenReady=new p.Deferred,this.selectedDecoration=new c.Decoration(b.default.mod_selected),this.focusedDecoration=new c.Decoration(b.default.mod_focused),this.contextMenuDecoration=new c.Decoration(b.default.mod_actived),this.loadingDecoration=new c.Decoration(b.default.mod_loading),this.cutDecoration=new c.Decoration(b.default.mod_cut),this._selectedFiles=[],this.disposableCollection=new p.DisposableCollection,this._isMultiSelected=!1,this.refreshedActionDelayer=new p.ThrottledDelayer(n.DEFAULT_REFRESHED_ACTION_DELAY),this.labelChangedDelayer=new p.ThrottledDelayer(n.DEFAULT_LABEL_CHANGED_DELAY),this.locationThrottler=new p.Throttler,this.onDidFocusedFileChangeEmitter=new p.Emitter,this.onDidContextMenuFileChangeEmitter=new p.Emitter,this.onDidSelectedFileChangeEmitter=new p.Emitter,this.onFileTreeModelChangeEmitter=new p.Emitter,this._initTreeModelReady=!1,this.clearFileSelectedDecoration=()=>{this.selectedDecoration.clearAppliedTarget(),this._selectedFiles=[]},this.activeFileDecoration=(O,P=!0)=>{this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),O&&(this.selectedFiles.length>0&&this.selectedDecoration.clearAppliedTarget(),this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.selectedDecoration.addTarget(O),this.focusedDecoration.addTarget(O),this.focusedFile=O,this.selectedFiles=[O],P&&this.treeModel.dispatchChange())},this.selectFileDecoration=(O,P=!0)=>{O!==this.treeModel.root&&(this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),O&&(this.selectedFiles.length>0&&this.selectedDecoration.clearAppliedTarget(),this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.selectedDecoration.addTarget(O),this._selectedFiles=[O],P&&this.treeModel.dispatchChange()))},this.activateFileActivedDecoration=O=>{this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),this.focusedFile&&(this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0),this.contextMenuDecoration.addTarget(O),this.contextMenuFile=O,this.treeModel.dispatchChange()},this.activateFileFocusedDecoration=O=>{this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),this.focusedDecoration.addTarget(O),this.focusedFile=O,this.treeModel.dispatchChange()},this.activeFileFocusedDecoration=(O,P=!1)=>{O!==this.treeModel.root&&(this.focusedFile!==O&&(P?(this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.contextMenuFile=O):this.focusedFile&&(this.contextMenuFile=void 0,this.focusedDecoration.clearAppliedTarget()),O&&(this._selectedFiles.indexOf(O)<0&&(this.selectedDecoration.addTarget(O),this._selectedFiles.push(O),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(k=>k.uri))),this.focusedDecoration.addTarget(O),this.focusedFile=O)),this.treeModel.dispatchChange())},this.toggleFileSelectedDecoration=O=>{const P=this._selectedFiles.indexOf(O);P>-1?(this.focusedFile===O&&(this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0),this._selectedFiles.splice(P,1),this.selectedDecoration.clearAppliedTarget()):(this._selectedFiles.push(O),this.selectedDecoration.addTarget(O),this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.focusedFile=O,this.focusedDecoration.addTarget(O)),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(k=>k.uri)),this.treeModel.dispatchChange()},this.activeFileDecorationByRange=(O,P)=>{for(this.clearFileSelectedDecoration(),this.contextMenuFile=void 0;O<=P;O++){const k=this.treeModel.root.getTreeNodeAtIndex(O);k&&(this._selectedFiles.push(k),this.selectedDecoration.addTarget(k))}this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(k=>k.uri)),this.treeModel.dispatchChange()},this.deactivateFileDecoration=()=>{var O;this.focusedFile&&(this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0),this.contextMenuFile&&this.contextMenuDecoration.removeTarget(this.contextMenuFile),(O=this.treeModel)===null||O===void 0||O.dispatchChange()},this.toggleDirectory=async O=>{O.expanded?this.fileTreeHandle.collapseNode(O):this.fileTreeHandle.expandNode(O)},this.handleDblClick=()=>{this.commandService.executeCommand(p.FILE_COMMANDS.NEW_FILE.id)},this.handleContextMenu=(O,P,k)=>{var F;O.stopPropagation(),O.preventDefault();let L,B;P?(B=P,this._isMultiSelected?this.selectedFiles.indexOf(B)>=0?L=this.selectedFiles:L=[B]:L=[B]):(L=[this.treeModel.root],B=this.treeModel.root),this.activateFileActivedDecoration(B),this.setFileTreeContextKey(B),this.fileTreeService.isCompactMode&&k?(this._activeUri=k,(F=this.contextKey)===null||F===void 0||F.explorerResourceIsFolder.set(!0)):k||(this._activeUri=null);const j=this.contextMenuService.createMenu({id:m.MenuId.ExplorerContext,contextKeyService:this.fileTreeService.contextMenuContextKeyService}),W=j.getMergedMenuNodes();j.dispose(),this.updateExplorerCompressedContextKey(B,k);const{x:U,y:Q}=O.nativeEvent;this.ctxMenuRenderer.show({anchor:{x:U,y:Q},menuNodes:W,args:k?[k,[k]]:[B.uri,L.map(V=>V.uri)]})},this.handleTreeBlur=()=>{var O,P,k;this._isDisposed||((P=(O=this.contextKey)===null||O===void 0?void 0:O.filesExplorerFocused)===null||P===void 0||P.set(!1),this.deactivateFileDecoration(),(k=this.contextKey)===null||k===void 0||k.explorerResourceIsFolder.set(!1))},this.handleTreeFocus=()=>{var O,P;(P=(O=this.contextKey)===null||O===void 0?void 0:O.filesExplorerFocused)===null||P===void 0||P.set(!0)},this.handleItemRangeClick=(O,P)=>{if(this.selectedFiles.length===1&&E.Directory.isRoot(this.selectedFiles[0])&&this.clearFileSelectedDecoration(),!this.focusedFile)this.handleItemClick(O,P);else if(this.focusedFile&&this.focusedFile!==O){this._isMultiSelected=!0;const k=this.treeModel.root.getIndexAtTreeNode(O),F=this.treeModel.root.getIndexAtTreeNode(this.focusedFile);F>k?this.activeFileDecorationByRange(k,F):F<k&&this.activeFileDecorationByRange(F,k)}},this.handleItemToggleClick=(O,P)=>{this._isMultiSelected=!0,!(P!==c.TreeNodeType.CompositeTreeNode&&P!==c.TreeNodeType.TreeNode)&&(this.selectedFiles.length===1&&E.Directory.isRoot(this.selectedFiles[0])&&this.clearFileSelectedDecoration(),this.toggleFileSelectedDecoration(O))},this.handleItemClick=(O,P=this.fileTreeService.isMultipleWorkspace?c.TreeNodeType.TreeNode:c.TreeNodeType.CompositeTreeNode,k)=>{var F,L,B,j;if(this.treeModel&&(O||(O=this.treeModel.root),this.updateExplorerCompressedContextKey(O,k),this._isMultiSelected=!1,(P===c.TreeNodeType.CompositeTreeNode||P===c.TreeNodeType.TreeNode)&&this.activeFileDecoration(O),this.fileTreeService.isCompactMode&&k?(this._activeUri=k,(F=this.contextKey)===null||F===void 0||F.explorerResourceIsFolder.set(!0)):k||(this._activeUri=null,(L=this.contextKey)===null||L===void 0||L.explorerResourceIsFolder.set(P===c.TreeNodeType.CompositeTreeNode)),this.corePreferences["workbench.list.openMode"]==="singleClick")){if(P===c.TreeNodeType.CompositeTreeNode){if((B=this.contextKey)===null||B===void 0||B.explorerResourceIsFolder.set(!0),O===this.treeModel.root)return;this.toggleDirectory(O)}else if(P===c.TreeNodeType.TreeNode){if((j=this.contextKey)===null||j===void 0||j.explorerResourceIsFolder.set(!1),O===this.treeModel.root)return;this.fileTreeService.openFile(O.uri),this.mainlayoutService.bottomExpanded&&this.commandService.executeCommand(h.RETRACT_BOTTOM_PANEL.id)}}},this.handleItemDoubleClick=(O,P)=>{P===c.TreeNodeType.TreeNode?this.fileTreeService.openAndFixedFile(O.uri):this.corePreferences["workbench.list.openMode"]==="doubleClick"&&this.toggleDirectory(O)},this.validateFileName=(O,P)=>{var k;if(P=this.getWellFormedFileName(P),!P||P.length===0||/^\s+$/.test(P))return{message:(0,p.localize)("validate.tree.emptyFileNameError"),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P};if(P[0]==="/"||P[0]==="\\")return{message:(0,p.localize)("validate.tree.fileNameStartsWithSlashError"),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P};if(P[0]===" "||P[P.length-1]===" ")return{message:(0,p.localize)("validate.tree.fileNameFollowOrStartWithSpaceWarning"),type:c.PROMPT_VALIDATE_TYPE.WARNING,value:P};let F;if(O.target){const B=O.target;if(P===B.name)return null;F=B.parent}else F=O.parent;return F&&!(O instanceof c.RenamePromptHandle&&O.target.displayName.indexOf(S.separator)>0)&&((k=F.children)===null||k===void 0?void 0:k.find(W=>W.name===P))?{message:(0,p.formatLocalize)("validate.tree.fileNameExistsError",P),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P}:T(P.split(/[\\/]/)).some(B=>!w(B))?{message:(0,p.formatLocalize)("validate.tree.invalidFileNameError",this.trimLongName(P)),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P}:null},this.proxyPrompt=O=>{let P=!1;const k=async V=>{const $=await this.fileTreeService.getNodeByPathOrUri(V);$&&(E.Directory.is($)?this.selectFileDecoration($):this.location($.uri))},F=async V=>{var $,Y,G;if(this.validateMessage=void 0,O instanceof c.RenamePromptHandle){const z=O.target,K=O.target.displayName.split(S.separator),Z=z.name.indexOf(S.separator)>0;if(Z&&this.activeUri&&!O.target.uri.toString().includes(this.activeUri.toString()))return!1;const X=this.activeUri?K.length-O.target.uri.toString().replace(this.activeUri.toString(),"").split(S.separator).length:-1,oe=X===-1?[]:K.slice(0,X).concat(V);let ne=z.uri,ue=z.parent.uri.resolve(V);if(Z&&(($=this.activeUri)===null||$===void 0?void 0:$.displayName)===V||!Z&&V===z.name)return!0;O.addAddonAfter("loading_indicator"),Z&&oe.length>0&&E.Directory.is(z.parent)&&(ne=z.parent.uri.resolve(K.slice(0,X+1).join(S.separator)),ue=z.parent.uri.resolve(oe.concat().join(S.separator)));const fe=await this.fileTreeAPI.mv(ne,ue,z.type===c.TreeNodeType.CompositeTreeNode);if(fe)return this.validateMessage={type:c.PROMPT_VALIDATE_TYPE.ERROR,message:fe,value:V},this.fileTreeService.updateRefreshable(!0),O.addValidateMessage(this.validateMessage),!1;if(this.fileTreeService.updateRefreshable(!1),O.removeAddonAfter(),!Z&&z.parent){const q=await this.fileTreeService.moveNodeByPath(z.parent,z.parent,z.name,V,z.type);q&&this.selectFileDecoration(q,!1),this.fileTreeService.updateRefreshable(!0)}else if(E.Directory.is(z)&&!E.Directory.isRoot(z)){z.updateMetaData({name:oe.concat(K.slice(X+1)).join(S.separator),uri:ue,fileStat:{...z.filestat,uri:ue.toString()},tooltip:this.fileTreeAPI.getReadableTooltip(ue)}),this.treeModel.dispatchChange();let q;E.Directory.is(z.parent)&&(!((Y=z.parent.children)===null||Y===void 0)&&Y.find(Ae=>z.path.indexOf(Ae.path)>=0))?q=this.fileTreeService.refresh(z.parent):q=this.fileTreeService.refresh(z),q.then(()=>{k(ue)})}O.removeAddonAfter()}else if(O instanceof c.NewPromptHandle){const z=O.parent,K=z.uri.resolve(V);let Z;if(O.addAddonAfter("loading_indicator"),this.fileTreeService.updateRefreshable(!0),O.type===c.TreeNodeType.CompositeTreeNode?Z=await this.fileTreeAPI.createDirectory(K):Z=await this.fileTreeAPI.createFile(K),O.removeAddonAfter(),Z)return this.validateMessage={type:c.PROMPT_VALIDATE_TYPE.ERROR,message:Z,value:V},this.fileTreeService.updateRefreshable(!1),O.addValidateMessage(this.validateMessage),!1;if(V.includes(S.separator)&&this.fileTreeService.refresh(z).then(()=>{k(z.uri.resolve(V))}),this.fileTreeService.isCompactMode)if(O.type===c.TreeNodeType.CompositeTreeNode)if((!z.children||z.children.length===0)&&!E.Directory.isRoot(z)){const oe=z.uri.resolve(V),ne=[z.name].concat(V).join(S.separator);z.updateMetaData({name:ne,uri:oe,fileStat:{...z.filestat,uri:oe.toString()},tooltip:this.fileTreeAPI.getReadableTooltip(oe)}),k(oe)}else await this.fileTreeService.addNode(z,V,O.type),k(z.uri.resolve(V));else await this.fileTreeService.addNode(z,V,O.type),k(z.uri.resolve(V));else await this.fileTreeService.addNode(z,V,O.type),k(z.uri.resolve(V))}return(G=this.contextKey)===null||G===void 0||G.filesExplorerInputFocused.set(!1),!0},L=async V=>{var $,Y,G,z;if(this.validateMessage&&this.validateMessage.type===c.PROMPT_VALIDATE_TYPE.ERROR)return this.validateMessage=void 0,!0;if(P)return!1;if(!V){($=this.contextKey)===null||$===void 0||$.explorerCompressedFocusContext.set(!1),(Y=this.contextKey)===null||Y===void 0||Y.explorerCompressedFirstFocusContext.set(!1),(G=this.contextKey)===null||G===void 0||G.explorerCompressedLastFocusContext.set(!1),this.fileTreeService.isCompactMode&&O instanceof c.NewPromptHandle&&this.fileTreeService.refresh(O.parent);return}return(z=this.contextKey)===null||z===void 0||z.filesExplorerInputFocused.set(!1),await F(V),!0},B=async V=>{if(P=!0,this.validateMessage&&this.validateMessage.type===c.PROMPT_VALIDATE_TYPE.ERROR)return!1;if(V.trim()===""||this.validateMessage&&this.validateMessage.type!==c.PROMPT_VALIDATE_TYPE.ERROR)return this.validateMessage=void 0,!0;const $=await F(V);return P=!1,!!$},j=async()=>{var V;(V=this.contextKey)===null||V===void 0||V.filesExplorerInputFocused.set(!0)},W=()=>{var V;this.fileTreeService.updateRefreshable(!0),(V=this.contextKey)===null||V===void 0||V.filesExplorerInputFocused.set(!1),this.contextMenuFile&&this.selectFileDecoration(this.contextMenuFile,!0)},U=()=>{var V;(V=this.contextKey)===null||V===void 0||V.filesExplorerInputFocused.set(!1),this.fileTreeService.isCompactMode&&O instanceof c.NewPromptHandle&&this.fileTreeService.refresh(O.parent)},Q=V=>{const $=this.validateFileName(O,V);$?(this.validateMessage=$,O.addValidateMessage($)):!$&&this.validateMessage&&this.validateMessage.value!==V&&(this.validateMessage=void 0,O.removeValidateMessage())};O.destroyed||(this.fileTreeService.updateRefreshable(!1),O.onChange(Q),O.onCommit(B),O.onBlur(L),O.onFocus(j),O.onDestroy(W),O.onCancel(U))},this.copyFile=async O=>{var P;this.pasteStore&&this.pasteStore.type===d.PasteTypes.CUT&&(this._pasteStore.files.forEach(F=>{F&&this.cutDecoration.removeTarget(F)}),(P=this.contextKey)===null||P===void 0||P.explorerResourceCut.set(!1)),this.treeModel.dispatchChange();const k=[];for(const F of O){const L=this.fileTreeService.getNodeByPathOrUri(F);L&&k.push(L)}this._pasteStore={files:k,type:d.PasteTypes.COPY},this.clipboardService.writeResources(O)},this.pasteFile=async O=>{var P,k;let F=!1,L=this.fileTreeService.getNodeByPathOrUri(O.toString());if(!L)return;let B=this.pasteStore,j=!1;if(!B){const W=await this.clipboardService.readResources();if(!W||!W.length)return;B={files:[],type:d.PasteTypes.COPY,crossFiles:W},j=!0}if(B){if(E.Directory.is(L)||(F=!0,L=L.parent),j){const W=(0,p.localize)("file.confirm.paste.ok"),U=(0,p.localize)("file.confirm.paste.cancel");if(await this.dialogService.warning((0,p.formatLocalize)("file.confirm.paste",`[ ${(P=B.crossFiles)===null||P===void 0?void 0:P.map(V=>V.displayName).join(",")} ]`,E.Directory.isRoot(L)?L.uri.displayName:L.displayName),[U,W])!==W)return}if(B.type===d.PasteTypes.CUT){for(const U of B.files)U&&this.cutDecoration.removeTarget(U),L.expanded||await L.setExpanded(!0);const W=await this.fileTreeAPI.mvFiles(B.crossFiles?B.crossFiles.map(U=>{var Q;return{url:U,isDirectory:((Q=this.fileTreeService.getNodeByPathOrUri(U))===null||Q===void 0?void 0:Q.filestat.isDirectory)||!1}}):B.files.map(U=>({url:U.uri,isDirectory:U.filestat.isDirectory})),L.uri);W&&W.length>0&&(W.forEach(U=>{this.messageService.error(U)}),this.fileTreeService.refresh()),(k=this.contextKey)===null||k===void 0||k.explorerResourceCut.set(!1),this.treeModel.dispatchChange(),this._pasteStore={files:[],type:d.PasteTypes.NONE,crossFiles:void 0}}else if(B.type===d.PasteTypes.COPY){const W=B.crossFiles?B.crossFiles:B.files.map(U=>U.uri);for(const U of W){L.uri.isEqual(U)&&!F&&(L=L.parent);const Q=L.uri.resolve(U.displayName);L.expanded||await L.setExpanded(!0);const V=await this.fileTreeAPI.copyFile(U,Q);if(V)if(V.uri){const $=new p.URI(V.uri),Y=await this.filesystem.getFileStat(U.toString());this.fileTreeService.addNode(L,$.displayName,Y?.isDirectory?c.TreeNodeType.CompositeTreeNode:c.TreeNodeType.TreeNode)}else this.messageService.error(`Error when copy file: ${U.toString()}, ${V}`)}}}},this.cutFile=async O=>{var P;O.length>0&&((P=this.contextKey)===null||P===void 0||P.explorerResourceCut.set(!0)),this._pasteStore&&this._pasteStore.type===d.PasteTypes.CUT&&this._pasteStore.files.forEach(F=>{this.cutDecoration.removeTarget(F)});const k=[];for(const F of O){const L=this.fileTreeService.getNodeByPathOrUri(F);L&&k.push(L)}this._pasteStore={files:k,type:d.PasteTypes.CUT};for(const F of k)F&&this.cutDecoration.addTarget(F);this.treeModel.dispatchChange()},this.location=async O=>{if(await this.whenReady,!this.fileTreeService.filterMode)return this._fileToLocation=O,this.locationThrottler.queue(this.doLocation)},this.doLocation=async()=>{if(!this._fileToLocation)return;const O=this._fileToLocation;let P;if(typeof O=="string"?P=O:P=await this.fileTreeService.getFileTreeNodePathByUri(O),P){if(!this.fileTreeHandle)return;const k=await this.fileTreeHandle.ensureVisible(P,"center",!0);k&&this.selectFileDecoration(k)}this._fileToLocation=void 0},this.locationOnShow=O=>{this._nextLocationTarget=O},this.performLocationOnHandleShow=async()=>{this._nextLocationTarget&&(await this.location(this._nextLocationTarget),this._nextLocationTarget=void 0)}}get onDidFocusedFileChange(){return this.onDidFocusedFileChangeEmitter.event}get onDidContextMenuFileChange(){return this.onDidContextMenuFileChangeEmitter.event}get onDidSelectedFileChange(){return this.onDidSelectedFileChangeEmitter.event}get onFileTreeModelChange(){return this.onFileTreeModelChangeEmitter.event}get fileTreeHandle(){return this._fileTreeHandle}get decorations(){return this._decorations}get treeModel(){return this._treeModel}get dndService(){return this._dndService}get whenReady(){return this._whenReady.promise}get focusedFile(){return this._focusedFile}set focusedFile(O){this.onDidFocusedFileChangeEmitter.fire(O?O.uri:void 0),this._focusedFile=O}get contextMenuFile(){return this._contextMenuFile}set contextMenuFile(O){this.onDidContextMenuFileChangeEmitter.fire(O?O.uri:void 0),this._contextMenuFile=O}get selectedFiles(){return this._selectedFiles}set selectedFiles(O){this.onDidSelectedFileChangeEmitter.fire(O?O.map(P=>P.uri):[]),this._selectedFiles=O}get activeUri(){return this._activeUri}get pasteStore(){return this._pasteStore}get explorerStorage(){return this._explorerStorage}get currentRelativeUriContextKey(){return this._currentRelativeUriContextKey||(this._currentRelativeUriContextKey=this.fileTreeService.contextMenuContextKeyService.createKey("filetreeContextRelativeUri","")),this._currentRelativeUriContextKey}get currentContextUriContextKey(){return this._currentContextUriContextKey||(this._currentContextUriContextKey=this.fileTreeService.contextMenuContextKeyService.createKey("filetreeContextUri","")),this._currentContextUriContextKey}get contextMenuResourceContext(){return this._contextMenuResourceContext||(this._contextMenuResourceContext=new v.ResourceContextKey(this.fileTreeService.contextMenuContextKeyService)),this._contextMenuResourceContext}get contextKey(){return this.fileTreeService.contextKey}get initTreeModelReady(){return this._initTreeModelReady}async initTreeModel(){this._initTreeModelReady=!1;const O=(await this.fileTreeService.resolveChildren())[0];if(!O){this._whenReady.resolve();return}this._treeModel=this.injector.get(f.FileTreeModel,[O]),this.initDecorations(O),this._dndService=this.injector.get(A.DragAndDropService,[this]),this.treeStateWatcher=this._treeModel.getTreeStateWatcher(!0),this.disposableCollection.push(this.fileTreeService.onNodeRefreshed(()=>{this.initTreeModelReady&&(this.refreshedActionDelayer.isTriggered()||this.refreshedActionDelayer.cancel(),this.refreshedActionDelayer.trigger(async()=>{if(this.selectedFiles.length===0){const k=this.editorService.currentEditor;k&&k.currentUri&&this.location(k.currentUri)}this.fileTreeService.isCompactMode||(this._activeUri=null)}))})),this.disposableCollection.push(this.fileTreeService.onWorkspaceChange(()=>{this.disposableCollection.dispose(),this.initTreeModel()})),this.disposableCollection.push(this.labelService.onDidChange(async()=>{this.initTreeModelReady&&(this.labelChangedDelayer.isTriggered()||this.labelChangedDelayer.cancel(),this.labelChangedDelayer.trigger(async()=>{this.fileTreeService.refresh()}))})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.WillResolveChildren,k=>{this.loadingDecoration.addTarget(k),this.treeModel.dispatchChange()})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.DidResolveChildren,k=>{this.loadingDecoration.clearAppliedTarget(),this.treeModel.dispatchChange()})),this._explorerStorage=await this.storageProvider(p.STORAGE_NAMESPACE.EXPLORER);const P=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY);P&&await this.loadFileTreeSnapshot(P),this.disposableCollection.push(this.treeStateWatcher.onDidChange(()=>{if(!this._initTreeModelReady)return;const k=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY),F=this.treeStateWatcher.snapshot();this.explorerStorage.set(n.FILE_TREE_SNAPSHOT_KEY,{...k,...F})})),this.fileTreeService.startWatchFileEvent(),this.onFileTreeModelChangeEmitter.fire(this._treeModel),this._whenReady.resolve(),this._initTreeModelReady=!0}initDecorations(O){this._decorations=new c.DecorationsManager(O),this._decorations.addDecoration(this.selectedDecoration),this._decorations.addDecoration(this.focusedDecoration),this._decorations.addDecoration(this.contextMenuDecoration),this._decorations.addDecoration(this.cutDecoration),this._decorations.addDecoration(this.loadingDecoration)}setFileTreeContextKey(O){var P;this.currentContextUriContextKey.set(O.uri.toString()),this.currentRelativeUriContextKey.set((this.treeModel.root.uri.relative(O.uri)||"").toString()),this.contextMenuResourceContext.set(O.uri),(P=this.contextKey)===null||P===void 0||P.explorerResourceIsFolder.set(O&&O.type===c.TreeNodeType.CompositeTreeNode)}async loadFileTreeSnapshot(O){await this._treeModel.loadTreeState(O)}updateExplorerCompressedContextKey(O,P){var k,F,L,B,j,W,U,Q,V,$,Y,G,z,K,Z,X;if(O&&P){(k=this.contextKey)===null||k===void 0||k.explorerCompressedFocusContext.set(!0);const oe=new S(O.name);oe.name===P.displayName?((F=this.contextKey)===null||F===void 0||F.explorerCompressedLastFocusContext.set(!0),(L=this.contextKey)===null||L===void 0||L.explorerCompressedFirstFocusContext.set(!1)):oe.root&&oe.root.name===P.displayName?((B=this.contextKey)===null||B===void 0||B.explorerCompressedLastFocusContext.set(!1),(j=this.contextKey)===null||j===void 0||j.explorerCompressedFirstFocusContext.set(!0)):((W=this.contextKey)===null||W===void 0||W.explorerCompressedLastFocusContext.set(!1),(U=this.contextKey)===null||U===void 0||U.explorerCompressedFirstFocusContext.set(!1))}else O?O.name.indexOf(S.separator)>0?((Q=this.contextKey)===null||Q===void 0||Q.explorerCompressedFocusContext.set(!0),(V=this.contextKey)===null||V===void 0||V.explorerCompressedFirstFocusContext.set(!1),($=this.contextKey)===null||$===void 0||$.explorerCompressedLastFocusContext.set(!0)):((Y=this.contextKey)===null||Y===void 0||Y.explorerCompressedFocusContext.set(!1),(G=this.contextKey)===null||G===void 0||G.explorerCompressedFirstFocusContext.set(!1),(z=this.contextKey)===null||z===void 0||z.explorerCompressedLastFocusContext.set(!1)):((K=this.contextKey)===null||K===void 0||K.explorerCompressedFocusContext.set(!1),(Z=this.contextKey)===null||Z===void 0||Z.explorerCompressedFirstFocusContext.set(!1),(X=this.contextKey)===null||X===void 0||X.explorerCompressedLastFocusContext.set(!1))}handleTreeHandler(O){this._fileTreeHandle=O}toggleOrOpenCurrentFile(){let O;this.focusedFile?O=this.focusedFile:this.contextMenuFile&&(O=this.contextMenuFile),O&&(this.activeFileDecoration(O),E.Directory.is(O)?this.toggleDirectory(O):this.fileTreeService.openFile(O.uri))}moveToNext(){let O;if(this.focusedFile?O=this.focusedFile:this.contextMenuFile&&(O=this.contextMenuFile),!O)return;const k=this.treeModel.root.getIndexAtTreeNode(O)+1,F=this.treeModel.root.getTreeNodeAtIndex(k),L=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY),B=(k+1)*a.FILE_TREE_NODE_HEIGHT-(L.scrollPosition||0),{height:j}=this.fileTreeHandle.getCurrentSize();F&&(this.activateFileFocusedDecoration(F),B>j&&this.fileTreeHandle.ensureVisible(F,"end"))}moveToPrev(){let O;if(this.focusedFile?O=this.focusedFile:this.contextMenuFile&&(O=this.contextMenuFile),!O)return;const P=this.treeModel.root.getIndexAtTreeNode(O);if(P===0)return;const k=P-1,F=this.treeModel.root.getTreeNodeAtIndex(k);if(!F)return;const L=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY),B=k*a.FILE_TREE_NODE_HEIGHT;this.activateFileFocusedDecoration(F),(L.scrollPosition||0)>B&&this.fileTreeHandle.ensureVisible(F,"start")}async collapseCurrentFile(){let O;this.focusedFile?(O=this.focusedFile,this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0):this.contextMenuFile&&(O=this.contextMenuFile,this.focusedDecoration.removeTarget(this.contextMenuFile),this.contextMenuFile=void 0);const P=this.selectedFiles.indexOf(O);P>=0&&(this.selectedFiles.splice(P,1),this.selectedDecoration.removeTarget(O));let k;if(E.Directory.is(O)&&O.expanded)k=O;else if(O)E.Directory.isRoot(O.parent)?k=O:k=O.parent;else return;this.focusedFile=k,k&&k.expanded&&(await this.fileTreeHandle.collapseNode(k),this.activeFileFocusedDecoration(k,!0))}async expandCurrentFile(){let O;this.focusedFile?(O=this.focusedFile,this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0):this.contextMenuFile&&(O=this.contextMenuFile,this.focusedDecoration.removeTarget(this.contextMenuFile),this.contextMenuFile=void 0);const P=this.selectedFiles.indexOf(O);P>=0&&(this.selectedFiles.splice(P,1),this.selectedDecoration.removeTarget(O)),this.focusedFile=O,E.Directory.is(O)&&(O.expanded||await this.fileTreeHandle.expandNode(O))}async collapseAll(){await this.treeModel.root.collapsedAll();const O=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY);O&&this.explorerStorage.set(n.FILE_TREE_SNAPSHOT_KEY,{...O,expandedDirectories:{atSurface:[],buried:[]}})}async deleteFileByUris(O){var P;if(O.length===0)return;if(this.corePreferences["explorer.confirmDelete"]){const B=this.applicationService.backendOS===p.OperatingSystem.Linux,j=B?(0,p.localize)("file.confirm.delete.ok"):(0,p.localize)("file.confirm.moveToTrash.ok"),W=(0,p.localize)("file.confirm.delete.cancel"),U=10;let Q=O.slice(0,U).map($=>$.displayName).join(`
31193
31189
  `);if(O.length>U&&(Q+=`
31194
31190
  ...`),B||(Q+=`
31195
31191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/cli-engine",
3
- "version": "3.8.3-next-1741771971.0",
3
+ "version": "3.8.3-next-1741774345.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-1741771971.0",
30
- "@opensumi/ide-core-common": "3.8.3-next-1741771971.0",
31
- "@opensumi/ide-core-node": "3.8.3-next-1741771971.0",
32
- "@opensumi/ide-express-file-server": "3.8.3-next-1741771971.0",
33
- "@opensumi/ide-extension": "3.8.3-next-1741771971.0",
34
- "@opensumi/ide-i18n": "3.8.3-next-1741771971.0",
35
- "@opensumi/ide-main-layout": "3.8.3-next-1741771971.0",
36
- "@opensumi/ide-startup": "3.8.3-next-1741771971.0",
29
+ "@opensumi/ide-core-browser": "3.8.3-next-1741774345.0",
30
+ "@opensumi/ide-core-common": "3.8.3-next-1741774345.0",
31
+ "@opensumi/ide-core-node": "3.8.3-next-1741774345.0",
32
+ "@opensumi/ide-express-file-server": "3.8.3-next-1741774345.0",
33
+ "@opensumi/ide-extension": "3.8.3-next-1741774345.0",
34
+ "@opensumi/ide-i18n": "3.8.3-next-1741774345.0",
35
+ "@opensumi/ide-main-layout": "3.8.3-next-1741774345.0",
36
+ "@opensumi/ide-startup": "3.8.3-next-1741774345.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": "6fd441cc2d2edaf27f7c6419a5cb2d345e78080c"
75
+ "gitHead": "c2881d9b16961092d802c0c7fbc43c12a5a3a1da"
76
76
  }