@opensumi/ide-components 3.8.3-next-1741848368.0 → 3.8.3-next-1741917543.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/lib/icon/iconfont/iconManager.d.ts +1 -4
- package/lib/icon/iconfont/iconManager.d.ts.map +1 -1
- package/lib/icon/iconfont/iconMap.d.ts +1 -4
- package/lib/icon/iconfont/iconMap.d.ts.map +1 -1
- package/lib/icon/iconfont/iconMap.js +1 -4
- package/lib/icon/iconfont/iconMap.js.map +1 -1
- package/lib/icon/iconfont/iconfont.css +7 -19
- package/lib/icon/iconfont/iconfont.eot +0 -0
- package/lib/icon/iconfont/iconfont.html +6 -24
- package/lib/icon/iconfont/iconfont.svg +4 -10
- package/lib/icon/iconfont/iconfont.ttf +0 -0
- package/lib/icon/iconfont/iconfont.woff +0 -0
- package/lib/icon/iconfont/iconfont.woff2 +0 -0
- package/lib/markdown-react/parse.d.ts.map +1 -1
- package/lib/markdown-react/parse.js.map +1 -1
- package/lib/recycle-tree/tree/TreeNode.d.ts +2 -2
- package/lib/recycle-tree/tree/TreeNode.d.ts.map +1 -1
- package/lib/recycle-tree/tree/TreeNode.js +5 -10
- package/lib/recycle-tree/tree/TreeNode.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -5836,7 +5836,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
5836
5836
|
/***/ ((__unused_webpack_module, exports) => {
|
|
5837
5837
|
|
|
5838
5838
|
"use strict";
|
|
5839
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.defaultIconfont = void 0;\n// GENERATE BY ./scripts/download-iconfont.ts\n// DON NOT EDIT IT MANUALLY\nexports.defaultIconfont = {\n 'Gitlab-fill': 'Gitlab-fill',\n 'PR': 'PR',\n 'ab': 'ab',\n 'abl': 'abl',\n 'activate-breakpoints': 'activate-breakpoints',\n 'add-comments': 'add-comments',\n 'afresh': 'afresh',\n 'arrow-down': 'arrow-down',\n 'arrow-right': 'arrow-right',\n 'arrowdown': 'arrowdown',\n 'arrowleft': 'arrowleft',\n 'arrowright': 'arrowright',\n 'arrowup': 'arrowup',\n 'bash': 'bash',\n 'bell': 'bell',\n 'branches': 'branches',\n 'breakpoint-activate': 'breakpoint-activate',\n 'breakpoint-deactivate': 'breakpoint-deactivate',\n 'breakpoint-disabled': 'breakpoint-disabled',\n 'breakpoint-enabled': 'breakpoint-enabled',\n 'breakpoint-stop': 'breakpoint-stop',\n 'breakpoint-stop-before': 'breakpoint-stop-before',\n 'brew': 'brew',\n 'browser-preview': 'browser-preview',\n 'caret-right': 'caret-right',\n 'check': 'check',\n 'check-circle-fill': 'check-circle-fill',\n 'check-close-circle-o': 'check-close-circle-o',\n 'check-square-o': 'check-square-o',\n 'circle-pause': 'circle-pause',\n 'clear': 'clear',\n 'clear-bold': 'clear-bold',\n 'close': 'close',\n 'close-all': 'close-all',\n 'close-circle': 'close-circle',\n 'close-circle-fill': 'close-circle-fill',\n 'close1': 'close1',\n 'close_square': 'close_square',\n 'cloud-download': 'cloud-download',\n 'cloud-server': 'cloud-server',\n 'code': 'code',\n '
|
|
5839
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.defaultIconfont = void 0;\n// GENERATE BY ./scripts/download-iconfont.ts\n// DON NOT EDIT IT MANUALLY\nexports.defaultIconfont = {\n 'Gitlab-fill': 'Gitlab-fill',\n 'PR': 'PR',\n 'ab': 'ab',\n 'abl': 'abl',\n 'activate-breakpoints': 'activate-breakpoints',\n 'add-comments': 'add-comments',\n 'afresh': 'afresh',\n 'arrow-down': 'arrow-down',\n 'arrow-right': 'arrow-right',\n 'arrowdown': 'arrowdown',\n 'arrowleft': 'arrowleft',\n 'arrowright': 'arrowright',\n 'arrowup': 'arrowup',\n 'bash': 'bash',\n 'bell': 'bell',\n 'branches': 'branches',\n 'breakpoint-activate': 'breakpoint-activate',\n 'breakpoint-deactivate': 'breakpoint-deactivate',\n 'breakpoint-disabled': 'breakpoint-disabled',\n 'breakpoint-enabled': 'breakpoint-enabled',\n 'breakpoint-stop': 'breakpoint-stop',\n 'breakpoint-stop-before': 'breakpoint-stop-before',\n 'brew': 'brew',\n 'browser-preview': 'browser-preview',\n 'caret-right': 'caret-right',\n 'check': 'check',\n 'check-circle-fill': 'check-circle-fill',\n 'check-close-circle-o': 'check-close-circle-o',\n 'check-square-o': 'check-square-o',\n 'circle-pause': 'circle-pause',\n 'clear': 'clear',\n 'clear-bold': 'clear-bold',\n 'close': 'close',\n 'close-all': 'close-all',\n 'close-circle': 'close-circle',\n 'close-circle-fill': 'close-circle-fill',\n 'close1': 'close1',\n 'close_square': 'close_square',\n 'cloud-download': 'cloud-download',\n 'cloud-server': 'cloud-server',\n 'code': 'code',\n 'collapse-all': 'collapse-all',\n 'commit': 'commit',\n 'content-search': 'content-search',\n 'continue': 'continue',\n 'control': 'control',\n 'copy': 'copy',\n 'create-pullrequest': 'create-pullrequest',\n 'deactivate-breakpoints': 'deactivate-breakpoints',\n 'debug': 'debug',\n 'debug-alt-small': 'debug-alt-small',\n 'debug-restart-frame': 'debug-restart-frame',\n 'default-menu-icon': 'default-menu-icon',\n 'delete': 'delete',\n 'deploy': 'deploy',\n 'detail': 'detail',\n 'discard': 'discard',\n 'disconnect': 'disconnect',\n 'dock-down': 'dock-down',\n 'dock-right': 'dock-right',\n 'doubleleft': 'doubleleft',\n 'doubleright': 'doubleright',\n 'down': 'down',\n 'down-arrow': 'down-arrow',\n 'download': 'download',\n 'drag': 'drag',\n 'edit': 'edit',\n 'editor': 'editor',\n 'ellipsis': 'ellipsis',\n 'embed': 'embed',\n 'error': 'error',\n 'expand': 'expand',\n 'expand-all': 'expand-all',\n 'experiment': 'experiment',\n 'explorer': 'explorer',\n 'extension': 'extension',\n 'eye': 'eye',\n 'eye-close': 'eye-close',\n 'file-copy': 'file-copy',\n 'file-default': 'file-default',\n 'file-exclamation': 'file-exclamation',\n 'file-text': 'file-text',\n 'filter': 'filter',\n 'focus': 'focus',\n 'folder': 'folder',\n 'folder-default': 'folder-default',\n 'follow-cursor': 'follow-cursor',\n 'fullescreen': 'fullescreen',\n 'fullscreen': 'fullscreen',\n 'fullscreen-exit': 'fullscreen-exit',\n 'git': 'git',\n 'github-fill': 'github-fill',\n 'gitlab': 'gitlab',\n 'global-search': 'global-search',\n 'go': 'go',\n 'hex': 'hex',\n 'info-circle': 'info-circle',\n 'info-circle-fill': 'info-circle-fill',\n 'insert': 'insert',\n 'java': 'java',\n 'keyboard': 'keyboard',\n 'kotlin': 'kotlin',\n 'layout': 'layout',\n 'layout1': 'layout1',\n 'left': 'left',\n 'left-nav-close': 'left-nav-close',\n 'left-nav-open': 'left-nav-open',\n 'left-right-subfield': 'left-right-subfield',\n 'line': 'line',\n 'link': 'link',\n 'loading': 'loading',\n 'magic-wand': 'magic-wand',\n 'max': 'max',\n 'menubar-dashboard-back': 'menubar-dashboard-back',\n 'menubar-edit': 'menubar-edit',\n 'menubar-file': 'menubar-file',\n 'menubar-go': 'menubar-go',\n 'menubar-selection': 'menubar-selection',\n 'menubar-setting': 'menubar-setting',\n 'menubar-tool': 'menubar-tool',\n 'menubar-view': 'menubar-view',\n 'menubar-workspace': 'menubar-workspace',\n 'message': 'message',\n 'min': 'min',\n 'minus': 'minus',\n 'mobile': 'mobile',\n 'mobile-phone': 'mobile-phone',\n 'more': 'more',\n 'new-file': 'new-file',\n 'new-folder': 'new-folder',\n 'node': 'node',\n 'open': 'open',\n 'open-changes': 'open-changes',\n 'openfile': 'openfile',\n 'out-link': 'out-link',\n 'pause': 'pause',\n 'pin': 'pin',\n 'pipeline': 'pipeline',\n 'plus': 'plus',\n 'project-information': 'project-information',\n 'python': 'python',\n 'question-circle': 'question-circle',\n 'question-circle-o': 'question-circle-o',\n 'receive': 'receive',\n 'refresh': 'refresh',\n 'regex': 'regex',\n 'reload': 'reload',\n 'replace': 'replace',\n 'repository': 'repository',\n 'retrieval': 'retrieval',\n 'revoke': 'revoke',\n 'revoke-white': 'revoke-white',\n 'right': 'right',\n 'right-arrow': 'right-arrow',\n 'rollback': 'rollback',\n 'run': 'run',\n 'rust': 'rust',\n 'save-all': 'save-all',\n 'scm': 'scm',\n 'search': 'search',\n 'send': 'send',\n 'send-hollow': 'send-hollow',\n 'send-solid': 'send-solid',\n 'setting': 'setting',\n 'sever': 'sever',\n 'share': 'share',\n 'shrink': 'shrink',\n 'smile': 'smile',\n 'start': 'start',\n 'step': 'step',\n 'step-in': 'step-in',\n 'step-out': 'step-out',\n 'stop': 'stop',\n 'swap': 'swap',\n 'sync': 'sync',\n 'team': 'team',\n 'terminal': 'terminal',\n 'test': 'test',\n 'thumbs': 'thumbs',\n 'thumbs-fill': 'thumbs-fill',\n 'thumbsdown': 'thumbsdown',\n 'thumbsdown-fill': 'thumbsdown-fill',\n 'time-circle': 'time-circle',\n 'toolkit': 'toolkit',\n 'tree': 'tree',\n 'undock': 'undock',\n 'unfullscreen': 'unfullscreen',\n 'unmax': 'unmax',\n 'unorderedlist': 'unorderedlist',\n 'unpin': 'unpin',\n 'up': 'up',\n 'up-down-subfield': 'up-down-subfield',\n 'vim': 'vim',\n 'wait': 'wait',\n 'warning-circle': 'warning-circle',\n 'window': 'window',\n 'window-close': 'window-close',\n 'window-maximize': 'window-maximize',\n 'zsh': 'zsh',\n};\n\n\n//# sourceURL=webpack://@opensumi/ide-components/./src/icon/iconfont/iconMap.ts?");
|
|
5840
5840
|
|
|
5841
5841
|
/***/ }),
|
|
5842
5842
|
|
|
@@ -6298,7 +6298,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
6298
6298
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6299
6299
|
|
|
6300
6300
|
"use strict";
|
|
6301
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.CompositeTreeNode = exports.TreeNode = exports.BranchOperatorStatus = void 0;\nexports.spliceArray = spliceArray;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"../../node_modules/tslib/tslib.es6.mjs\");\n/* eslint-disable @typescript-eslint/prefer-for-of */\nconst ide_utils_1 = __webpack_require__(/*! @opensumi/ide-utils */ \"../utils/lib/index.js\");\nconst types_1 = __webpack_require__(/*! ../types */ \"./src/recycle-tree/types/index.ts\");\nconst { Path } = ide_utils_1.path;\n/**\n * 裁剪数组\n *\n * @param arr 裁剪数组\n * @param start 起始位置\n * @param deleteCount 删除或替换位置\n * @param items 插入的数组\n */\nfunction spliceArray(arr, start, deleteCount = 0, items) {\n // 如果没有修改操作,直接返回原数组\n if (deleteCount === 0 && (!items || items.length === 0)) {\n return arr;\n }\n // 直接使用 slice + concat 避免 spread operator\n const before = arr.slice(0, start);\n const after = arr.slice(start + deleteCount);\n return before.concat(items || []).concat(after);\n}\nvar BranchOperatorStatus;\n(function (BranchOperatorStatus) {\n BranchOperatorStatus[BranchOperatorStatus[\"EXPANDED\"] = 1] = \"EXPANDED\";\n BranchOperatorStatus[BranchOperatorStatus[\"SHRINKED\"] = 2] = \"SHRINKED\";\n})(BranchOperatorStatus || (exports.BranchOperatorStatus = BranchOperatorStatus = {}));\nclass TreeNode {\n static is(node) {\n return !!node && 'depth' in node && 'name' in node && 'path' in node && 'id' in node;\n }\n static getTreeNodeById(id) {\n return TreeNode.idToTreeNode.get(id);\n }\n static getTreeNodeByPath(path) {\n return TreeNode.pathToTreeNode.get(path);\n }\n static setTreeNode(id, path, node) {\n TreeNode.idToTreeNode.set(id, node);\n TreeNode.pathToTreeNode.set(path, node);\n }\n static removeTreeNode(id, path) {\n TreeNode.idToTreeNode.delete(id);\n TreeNode.pathToTreeNode.delete(path);\n }\n static getIdByPath(path) {\n return TreeNode.pathToId.get(path);\n }\n static setIdByPath(path, id) {\n return TreeNode.pathToId.set(path, id);\n }\n static getGlobalTreeState(path) {\n let state = TreeNode.pathToGlobalTreeState.get(path);\n if (!state) {\n state = {\n isExpanding: false,\n isLoadingPath: false,\n isRefreshing: false,\n refreshCancelToken: new ide_utils_1.CancellationTokenSource(),\n loadPathCancelToken: new ide_utils_1.CancellationTokenSource(),\n };\n }\n return state;\n }\n static setGlobalTreeState(path, updateState) {\n let state = TreeNode.pathToGlobalTreeState.get(path);\n if (!state) {\n state = {\n isExpanding: false,\n isLoadingPath: false,\n isRefreshing: false,\n refreshCancelToken: new ide_utils_1.CancellationTokenSource(),\n loadPathCancelToken: new ide_utils_1.CancellationTokenSource(),\n };\n }\n state = Object.assign(Object.assign({}, state), updateState);\n TreeNode.pathToGlobalTreeState.set(path, state);\n return state;\n }\n constructor(tree, parent, watcher, optionalMetadata) {\n this._uid = TreeNode.nextId();\n this._parent = parent;\n this._tree = tree;\n this._disposed = false;\n this._visible = true;\n this._metadata = Object.assign({}, (optionalMetadata || {}));\n this._depth = parent ? parent.depth + 1 : 0;\n if (watcher) {\n this._watcher = watcher;\n }\n else if (parent) {\n this._watcher = parent.watcher;\n }\n }\n get disposed() {\n return this._disposed;\n }\n /**\n * 获取基础信息\n */\n get depth() {\n return this._depth;\n }\n get parent() {\n return this._parent;\n }\n set parent(node) {\n this._parent = node;\n // 节点 `parent` 变化,更新当前节点的 `path` 属性\n this._path = '';\n }\n get type() {\n return types_1.TreeNodeType.TreeNode;\n }\n get id() {\n return this._uid;\n }\n set id(id) {\n this._uid = id;\n }\n get displayName() {\n return this.name;\n }\n /**\n * 由于 Tree 对于唯一路径的 path 的依赖\n * 在传入 `name` 值时必须保证其在路径上的唯一性\n * 一般不建议手动管理 `name`,采用默认值即可\n */\n get name() {\n if (!this.parent) {\n return `root_${this.id}`;\n }\n return this.getMetadata('name') || String(this.id);\n }\n set name(name) {\n this.addMetadata('name', name);\n // 节点 `name` 变化,更新当前节点的 `path` 属性\n this._path = '';\n }\n // 节点绝对路径\n get path() {\n if (!this._path) {\n if (!this.parent) {\n this._path = this.name.startsWith(Path.separator) ? this.name : `${Path.separator}${this.name}`;\n }\n else {\n this._path = this.name.startsWith(Path.separator)\n ? `${this.parent.path}${this.name}`\n : `${this.parent.path}${Path.separator}${this.name}`;\n }\n }\n return this._path;\n }\n get checkboxInfo() {\n return {\n checked: false,\n tooltip: '',\n accessibilityInformation: this.accessibilityInformation,\n };\n }\n get accessibilityInformation() {\n return {\n label: this.name,\n role: 'treeitem',\n };\n }\n getMetadata(withKey) {\n if (withKey === 'name' && !this._metadata[withKey]) {\n this._metadata[withKey] = String(TreeNode.nextId());\n }\n return this._metadata[withKey];\n }\n addMetadata(withKey, value) {\n if (!(withKey in this._metadata)) {\n this._metadata[withKey] = value;\n this._watcher.notifyDidChangeMetadata(this, {\n type: types_1.MetadataChangeType.Added,\n key: withKey,\n prevValue: void 0,\n value,\n });\n }\n else {\n const prevValue = this._metadata[withKey];\n this._metadata[withKey] = value;\n this._watcher.notifyDidChangeMetadata(this, { type: types_1.MetadataChangeType.Updated, key: withKey, prevValue, value });\n }\n }\n removeMetadata(withKey) {\n if (withKey in this._metadata) {\n const prevValue = this._metadata[withKey];\n delete this._metadata[withKey];\n this._watcher.notifyDidChangeMetadata(this, {\n type: types_1.MetadataChangeType.Removed,\n key: withKey,\n prevValue,\n value: void 0,\n });\n }\n }\n /**\n * 这里的move操作可能为移动,也可能为重命名\n *\n * @param {ICompositeTreeNode} to\n * @param {string} [name=this.name]\n * @returns\n * @memberof TreeNode\n */\n mv(to, name = this.name) {\n // 一个普通节点必含有父节点,根节点不允许任何操作\n const prevParent = this._parent;\n if (to === null || !CompositeTreeNode.is(to)) {\n this.parent = undefined;\n this.dispose();\n return;\n }\n const didChangeParent = prevParent !== to;\n const prevPath = this.path;\n this._depth = to.depth + 1;\n if (didChangeParent || name !== this.name) {\n this.name = name;\n if (didChangeParent) {\n this._watcher.notifyWillChangeParent(this, prevParent, to);\n }\n if (this.parent) {\n this.parent.unlinkItem(this, true);\n this.parent = to;\n this.parent.insertItem(this);\n }\n if (didChangeParent) {\n this._watcher.notifyDidChangeParent(this, prevParent, to);\n }\n }\n if (this.path !== prevPath) {\n this._watcher.notifyDidChangePath(this);\n }\n }\n get visible() {\n return this._visible;\n }\n setVisible(b) {\n this._visible = b;\n return this;\n }\n dispose() {\n if (this._disposed) {\n return;\n }\n TreeNode.removeTreeNode(this.id, this.path);\n this._disposed = true;\n this._watcher.notifyDidDispose(this);\n }\n}\nexports.TreeNode = TreeNode;\nTreeNode.nextId = (() => {\n let id = 0;\n return () => id++;\n})();\nTreeNode.idToTreeNode = new Map();\nTreeNode.pathToTreeNode = new Map();\nTreeNode.pathToId = new Map();\n// 每颗树都只会在根节点上绑定一个可取消的对象,即同个时间点只能存在一个改变树数据结构的事情\nTreeNode.pathToGlobalTreeState = new Map();\nclass CompositeTreeNode extends TreeNode {\n static defaultSortComparator(a, b) {\n if (a.constructor === b.constructor) {\n return a.name > b.name ? 1 : a.name < b.name ? -1 : 0;\n }\n return CompositeTreeNode.is(a) ? -1 : CompositeTreeNode.is(b) ? 1 : 0;\n }\n static is(node) {\n return !!node && 'children' in node;\n }\n static isRoot(node) {\n return CompositeTreeNode.is(node) && !node.parent;\n }\n generatorWatcher() {\n const emitter = new ide_utils_1.Emitter();\n const onEventChanges = emitter.event;\n const disposeCollection = new ide_utils_1.DisposableCollection();\n const terminateWatch = (path) => {\n this.watchEvents.delete(path);\n };\n const watcher = {\n notifyWillProcessWatchEvent: (target, event) => {\n emitter.fire({ type: types_1.TreeNodeEvent.WillProcessWatchEvent, args: [target, event] });\n },\n notifyWillChangeParent: (target, prevParent, newParent) => {\n emitter.fire({ type: types_1.TreeNodeEvent.WillChangeParent, args: [target, prevParent, newParent] });\n },\n notifyDidChangeParent: (target, prevParent, newParent) => {\n emitter.fire({ type: types_1.TreeNodeEvent.DidChangeParent, args: [target, prevParent, newParent] });\n },\n notifyDidDispose: (target) => {\n emitter.fire({ type: types_1.TreeNodeEvent.DidDispose, args: [target] });\n },\n notifyDidProcessWatchEvent: (target, event) => {\n emitter.fire({ type: types_1.TreeNodeEvent.DidProcessWatchEvent, args: [target, event] });\n },\n notifyDidChangePath: (target) => {\n emitter.fire({ type: types_1.TreeNodeEvent.DidChangePath, args: [target] });\n },\n notifyWillChangeExpansionState: (target, nowExpanded) => {\n const isVisible = this.isItemVisibleAtSurface(target);\n emitter.fire({ type: types_1.TreeNodeEvent.WillChangeExpansionState, args: [target, nowExpanded, isVisible] });\n },\n notifyDidChangeExpansionState: (target, nowExpanded) => {\n const isVisible = this.isItemVisibleAtSurface(target);\n emitter.fire({ type: types_1.TreeNodeEvent.DidChangeExpansionState, args: [target, nowExpanded, isVisible] });\n },\n notifyDidChangeMetadata: (target, change) => {\n emitter.fire({ type: types_1.TreeNodeEvent.DidChangeMetadata, args: [target, change] });\n },\n notifyDidUpdateBranch: () => {\n emitter.fire({ type: types_1.TreeNodeEvent.BranchDidUpdate, args: [] });\n },\n notifyWillResolveChildren: (target, nowExpanded) => {\n emitter.fire({ type: types_1.TreeNodeEvent.WillResolveChildren, args: [target, nowExpanded] });\n },\n notifyDidResolveChildren: (target, nowExpanded) => {\n emitter.fire({ type: types_1.TreeNodeEvent.DidResolveChildren, args: [target, nowExpanded] });\n },\n // 监听所有事件\n on: (event, callback) => {\n const dispose = onEventChanges((data) => {\n if (data.type === event) {\n callback(...data.args);\n }\n });\n disposeCollection.push(dispose);\n return dispose;\n },\n // 监听Watch事件变化\n onWatchEvent: (path, callback) => {\n const terminator = terminateWatch;\n this.watchEvents.set(path, { terminator, callback });\n return terminator;\n },\n dispose: disposeCollection,\n };\n return watcher;\n }\n // parent 为undefined即表示该节点为根节点\n constructor(tree, parent, watcher, optionalMetadata) {\n super(tree, parent, watcher, optionalMetadata);\n this._children = null;\n this._lock = false;\n this.refreshThrottler = new ide_utils_1.ThrottledDelayer(CompositeTreeNode.REFRESH_DELAY);\n this.toRefreshPathQueue = new Set();\n /**\n * 处理 Watch 事件,同时可通过外部手动调 g用节点更新函数进行节点替换,这里为通用的事件管理\n * 如: transferItem,insertItem, unlinkItem等\n * @private\n * @memberof CompositeTreeNode\n */\n this.handleWatchEvent = (event) => tslib_1.__awaiter(this, void 0, void 0, function* () {\n this.watcher.notifyWillProcessWatchEvent(this, event);\n switch (event.type) {\n case types_1.WatchEvent.Moved: {\n const { oldPath, newPath } = event;\n if (typeof oldPath !== 'string') {\n throw new TypeError('Expected oldPath to be a string');\n }\n if (typeof newPath !== 'string') {\n throw new TypeError('Expected newPath to be a string');\n }\n if (Path.isRelative(oldPath)) {\n throw new TypeError('oldPath must be absolute');\n }\n if (Path.isRelative(newPath)) {\n throw new TypeError('newPath must be absolute');\n }\n this.transferItem(oldPath, newPath);\n break;\n }\n case types_1.WatchEvent.Added: {\n const { node } = event;\n if (!TreeNode.is(node)) {\n throw new TypeError('Expected node to be a TreeNode');\n }\n this.insertItem(node);\n break;\n }\n case types_1.WatchEvent.Removed: {\n const { path } = event;\n const pathObject = new Path(path);\n const dirName = pathObject.dir.toString();\n const name = pathObject.base.toString();\n if (dirName === this.path && !!this.children) {\n const item = this.children.find((c) => c.name === name);\n if (item) {\n this.unlinkItem(item);\n }\n }\n break;\n }\n default:\n // 如果当前变化的节点已在数据视图(并非滚动到不可见区域)中不可见,则将该节点折叠,待下次更新即可,\n if (!this.isItemVisibleAtRootSurface(this)) {\n this.isExpanded = false;\n this._children = null;\n }\n else {\n yield this.refresh();\n }\n break;\n }\n this.watcher.notifyDidProcessWatchEvent(this, event);\n });\n this.isExpanded = parent ? false : true;\n this._branchSize = 0;\n if (!parent) {\n this.watchEvents = new Map();\n // 为根节点创建监听器\n this._watcher = this.generatorWatcher();\n this._root = this;\n TreeNode.setTreeNode(this.id, this.path, this);\n }\n else {\n this._watcher = parent.watcher;\n }\n }\n // 重载 name 的 getter/setter,路径改变时需要重新监听文件节点变化\n set name(name) {\n const prevPath = this.path;\n if (!CompositeTreeNode.isRoot(this) && typeof this.watchTerminator === 'function') {\n this.watchTerminator(prevPath);\n this.addMetadata('name', name);\n this.watchTerminator = this.watcher.onWatchEvent(this.path, this.handleWatchEvent);\n }\n else {\n this.addMetadata('name', name);\n }\n // 节点 `name` 变化,更新当前节点的 `path` 属性\n this._path = '';\n }\n get name() {\n // 根节点保证路径不重复\n if (!this.parent) {\n return `root_${this.id}`;\n }\n return this.getMetadata('name');\n }\n // 作为根节点唯一的watcher需要在生成新节点的时候传入\n get watcher() {\n return this._watcher;\n }\n get type() {\n return types_1.TreeNodeType.CompositeTreeNode;\n }\n get children() {\n return this._children;\n }\n get expanded() {\n return this.isExpanded;\n }\n /**\n * 当前可见的分支数量\n *\n * 当节点为展开状态时,其整个分支(递归展平)由上一级的分支(根(位于数据层可见)或处于折叠状态的分支)拥有\n * 当节点为折叠状态时,其整个分支(递归展平)由其上一级父目录展开该节点\n *\n * @readonly\n * @memberof CompositeTreeNode\n */\n get branchSize() {\n return this._branchSize;\n }\n /**\n * 获取当前节点的分支数,一般为顶层节点,如Root上获取\n *\n * @readonly\n * @memberof CompositeTreeNode\n */\n get flattenedBranch() {\n return this._flattenedBranch;\n }\n get lock() {\n return this._lock;\n }\n get root() {\n if ((0, ide_utils_1.isUndefined)(this._root)) {\n this._root = this.getRoot() || null;\n }\n return this._root;\n }\n getRoot() {\n let root = this.parent;\n while (root && root.parent) {\n root = root.parent;\n }\n return root;\n }\n /**\n * 确保此\"目录\"的子级已加载(不影响\"展开\"状态)\n * 如果子级已经加载,则返回的Promise将立即解决\n * 否则,将发出重新加载请求并返回Promise\n * 一旦返回的Promise.resolve,\"CompositeTreeNode#children\" 便可以访问到对于节点\n */\n ensureLoaded(token) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n if (this._children) {\n return;\n }\n return yield this.hardReloadChildren(token);\n });\n }\n // 展开节点\n setExpanded() {\n return tslib_1.__awaiter(this, arguments, void 0, function* (ensureVisible = true, quiet = false, isOwner = true, token) {\n if (this.disposed) {\n return;\n }\n // 根节点不可折叠\n if (CompositeTreeNode.isRoot(this)) {\n return;\n }\n if (this.isExpanded) {\n return;\n }\n if (isOwner) {\n const state = TreeNode.getGlobalTreeState(this.path);\n state.loadPathCancelToken.cancel();\n state.refreshCancelToken.cancel();\n TreeNode.setGlobalTreeState(this.path, {\n isExpanding: true,\n });\n }\n this.isExpanded = true;\n if (this._children === null) {\n this._watcher.notifyWillResolveChildren(this, this.isExpanded);\n yield this.hardReloadChildren(token);\n this._watcher.notifyDidResolveChildren(this, this.isExpanded);\n // 检查其是否展开;可能同时执行了 setCollapsed 方法\n if (!this.isExpanded || (token === null || token === void 0 ? void 0 : token.isCancellationRequested)) {\n if (isOwner) {\n TreeNode.setGlobalTreeState(this.path, {\n isExpanding: false,\n });\n }\n return;\n }\n }\n if (ensureVisible && this.parent && CompositeTreeNode.is(this.parent)) {\n /**\n * 在传入 ensureVisible = true 时,这里传入的 token 不能取消所有副作用\n * 故在使用 ensureVisible = true 时必须保证 `setExpanded` 与 `setCollapsed` 的独立性\n * 如需要 `await node.setExpanded(true)` 后再执行 `node.setCollapsed()`\n */\n yield this.parent.setExpanded(true, !quiet, false, token);\n }\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n if (isOwner) {\n TreeNode.setGlobalTreeState(this.path, {\n isExpanding: false,\n });\n }\n return;\n }\n if (this.isExpanded) {\n this._watcher.notifyWillChangeExpansionState(this, true);\n // 与根节点合并分支\n this.expandBranch(this, quiet);\n this._watcher.notifyDidChangeExpansionState(this, true);\n }\n if (isOwner) {\n TreeNode.setGlobalTreeState(this.path, {\n isExpanding: false,\n });\n TreeNode.setTreeNode(this.id, this.path, this);\n }\n });\n }\n // 获取当前节点下所有展开的节点路径\n getAllExpandedNodePath() {\n var _a, _b;\n const paths = [];\n let start = 0;\n if (!CompositeTreeNode.isRoot(this)) {\n // 找到节点位置下标,向下进一步查找展开目录\n start = ((_a = this.root) === null || _a === void 0 ? void 0 : _a.getIndexAtTreeNodeId(this.id)) + 1;\n }\n const end = start + this.branchSize;\n for (let i = start; i < end; i++) {\n const node = (_b = this.root) === null || _b === void 0 ? void 0 : _b.getTreeNodeAtIndex(i);\n if (CompositeTreeNode.is(node) && node.expanded) {\n paths.push(node.path);\n }\n }\n return paths;\n }\n // 获取当前节点下所有折叠的节点路径\n getAllCollapsedNodePath() {\n let paths = [];\n if (this.children) {\n for (let i = 0; i < this.children.length; i++) {\n const child = this.children[i];\n if (!CompositeTreeNode.is(child)) {\n continue;\n }\n if (child.isExpanded) {\n paths = paths.concat(child.getAllCollapsedNodePath());\n }\n else {\n paths.push(child.path);\n }\n }\n return paths;\n }\n else {\n return paths;\n }\n }\n /**\n * 处理节点数据,让节点重新加载子节点及初始化 flattenedBranch\n * @param token CancellationToken\n */\n resolveChildrens(token) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n var _a, _b, _c;\n let childrens = this.children;\n let expandedPaths = [];\n try {\n childrens = (yield this._tree.resolveChildren(this)) || [];\n }\n catch (e) {\n childrens = [];\n }\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return false;\n }\n const flatTree = new Array(childrens.length);\n this._children = Array(childrens.length);\n for (let i = 0; i < childrens.length; i++) {\n const child = childrens[i];\n // 如果存在上一次缓存的节点,则使用缓存节点的 ID\n child.id = TreeNode.getIdByPath(child.path) || child.id;\n this._children[i] = child;\n TreeNode.setIdByPath(child.path, child.id);\n }\n (_a = this._children) === null || _a === void 0 ? void 0 : _a.sort(this._tree.sortComparator || CompositeTreeNode.defaultSortComparator);\n for (let i = 0; i < childrens.length; i++) {\n flatTree[i] = this._children[i].id;\n }\n const expandedChilds = [];\n for (let i = 0, len = ((_b = this.children) === null || _b === void 0 ? void 0 : _b.length) || 0; i < len; i++) {\n const subChild = (_c = this.children) === null || _c === void 0 ? void 0 : _c[i];\n if (CompositeTreeNode.is(subChild) && subChild.expanded) {\n const paths = yield subChild.resolveChildrens(token);\n if (paths) {\n expandedPaths = expandedPaths.concat(paths);\n }\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n expandedChilds.push(subChild);\n }\n }\n this._branchSize = flatTree.length;\n this.setFlattenedBranch(flatTree);\n for (let i = 0; i < expandedChilds.length; i++) {\n const child = expandedChilds[i];\n child.expandBranch(child, true);\n }\n return expandedPaths.concat(expandedChilds.map((child) => child.path.toString()));\n });\n }\n updateTreeNodeCache(child) {\n var _a;\n TreeNode.setTreeNode(child.id, child.path, child);\n if (CompositeTreeNode.is(child) && child.expanded && ((_a = child.children) === null || _a === void 0 ? void 0 : _a.length)) {\n for (let i = 0; i < child.children.length; i++) {\n const subChild = child.children[i];\n this.updateTreeNodeCache(subChild);\n }\n }\n }\n /**\n * 静默刷新子节点, 即不触发分支更新事件\n * @param toExpandPaths 待展开的路径\n * @param token CancellationToken\n * @param origin 当 this === origin 时,说明此节点为调用的源头节点\n */\n refreshTreeNodeByPaths() {\n return tslib_1.__awaiter(this, arguments, void 0, function* (toExpandPaths = this.getAllExpandedNodePath(), token, origin) {\n if (!CompositeTreeNode.is(this)) {\n return;\n }\n // 如果某次刷新操作被取消,则下次刷新依旧使用上一次刷新的展开目录进行刷新\n let toExpandPath;\n const originChildren = this.children;\n let childrens = this.children || [];\n if (this.expanded) {\n if (this === origin) {\n try {\n childrens = (yield this._tree.resolveChildren(this)) || [];\n }\n catch (e) {\n childrens = [];\n }\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n if (!this.expanded) {\n // 当请求刷新节点时,如果该节点已经不应该被处理,则清理 Children\n // 下次再被展开时便会自动更新 Children 最新内容\n if (this.children) {\n // 清理子节点,等待下次展开时更新\n if (!!this.children && this.parent) {\n for (let i = 0; i < this.children.length; i++) {\n const child = this.children[i];\n child.dispose();\n }\n this._children = null;\n }\n }\n return;\n }\n }\n while ((toExpandPath = toExpandPaths.shift())) {\n const isRelative = toExpandPath.indexOf(`${this.path}${Path.separator}`) > -1;\n if (!isRelative) {\n if (toExpandPath === this.path) {\n toExpandPath = undefined;\n }\n break;\n }\n const child = childrens === null || childrens === void 0 ? void 0 : childrens.find((child) => child.path === toExpandPath);\n // 对于压缩情况的路径需要额外处理一下\n // 如果这里加载的路径是 a/b/c, 有可能目前只加载到 a/b\n if (!child) {\n if (!childrens || childrens.length === 0) {\n break;\n }\n for (let i = 0; i < childrens.length; i++) {\n const child = childrens[i];\n const isInclude = toExpandPath.indexOf(`${child.path}${Path.separator}`) === 0; // 展开路径包含子节点路径\n if (isInclude && CompositeTreeNode.is(child)) {\n // 包含压缩节点的情况\n if (!CompositeTreeNode.is(child)) {\n // 说明此节点为非折叠节点时不处理\n continue;\n }\n child.isExpanded = true;\n // 加载路径包含当前判断路径,尝试加载该节点再匹配\n const extraExpandedPaths = yield child.resolveChildrens(token);\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n if (extraExpandedPaths) {\n toExpandPaths = toExpandPaths.filter((path) => !extraExpandedPaths.find((a) => a === path));\n }\n if (child.path !== toExpandPath && !toExpandPaths.includes(child.path)) {\n toExpandPaths.unshift(toExpandPath);\n }\n if (toExpandPaths.length > 0) {\n // 不需要重新加载压缩节点的子节点内容\n toExpandPaths =\n (yield child.refreshTreeNodeByPaths([...toExpandPaths], token, origin)) || [];\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n }\n break;\n }\n }\n }\n else if (CompositeTreeNode.is(child)) {\n // 如果节点默认展开,则忽略后续操作\n if (!child.expanded) {\n child.isExpanded = true;\n const extraExpandedPaths = yield child.resolveChildrens(token);\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n if (extraExpandedPaths) {\n toExpandPaths = toExpandPaths.filter((path) => !extraExpandedPaths.find((a) => a.includes(path)));\n }\n if (toExpandPaths.length > 0 && !(token === null || token === void 0 ? void 0 : token.isCancellationRequested)) {\n toExpandPaths =\n (yield child.refreshTreeNodeByPaths([...toExpandPaths], token, origin)) || [];\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n }\n }\n }\n }\n if (toExpandPath) {\n // 仍然存在需要进一步处理的待展开路径\n toExpandPaths.unshift(toExpandPath);\n if (this === origin) {\n // 说明待展开的路径已经不存在,直接处理子节点\n if (originChildren) {\n this.shrinkBranch(this, true);\n for (let i = 0; i < originChildren.length; i++) {\n const child = originChildren[i];\n child === null || child === void 0 ? void 0 : child.dispose();\n }\n }\n const expandedChilds = [];\n const flatTree = new Array(childrens.length);\n this._children = Array(childrens.length);\n for (let i = 0; i < childrens.length; i++) {\n const child = childrens[i];\n // 如果存在上一次缓存的节点,则使用缓存节点的 ID\n child.id = TreeNode.getIdByPath(child.path) || child.id;\n this._children[i] = child;\n TreeNode.setIdByPath(child.path, child.id);\n if (CompositeTreeNode.is(child) && child.expanded) {\n expandedChilds.push(child);\n }\n }\n this._children.sort(this._tree.sortComparator || CompositeTreeNode.defaultSortComparator);\n for (let i = 0; i < childrens.length; i++) {\n flatTree[i] = this._children[i].id;\n }\n this._branchSize = flatTree.length;\n this.setFlattenedBranch(flatTree, true);\n this.watcher.notifyDidUpdateBranch();\n }\n if (this.parent !== origin) {\n // 将所有子节点合并至第二层 Children 上,减少后续递归拼接带来额外成本\n this.expandBranch(this, true);\n }\n return toExpandPaths;\n }\n else if (CompositeTreeNode.isRoot(this)) {\n if (this.children) {\n this.shrinkBranch(this, true);\n for (let i = 0; i < this.children.length; i++) {\n const child = this.children[i];\n child === null || child === void 0 ? void 0 : child.dispose();\n }\n }\n const expandedChilds = [];\n const otherChilds = [];\n const flatTree = new Array(childrens.length);\n this._children = Array(childrens.length);\n for (let i = 0; i < childrens.length; i++) {\n const child = childrens[i];\n // 如果存在上一次缓存的节点,则使用缓存节点的 ID\n child.id = TreeNode.getIdByPath(child.path) || child.id;\n this._children[i] = child;\n TreeNode.setIdByPath(child.path, child.id);\n if (CompositeTreeNode.is(child) && child.expanded) {\n if (!child.children) {\n yield child.resolveChildrens(token);\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n }\n expandedChilds.push(child);\n }\n else {\n otherChilds.push(child);\n }\n }\n this._children.sort(this._tree.sortComparator || CompositeTreeNode.defaultSortComparator);\n for (let i = 0; i < childrens.length; i++) {\n flatTree[i] = this._children[i].id;\n }\n this._branchSize = flatTree.length;\n this.setFlattenedBranch(flatTree, true);\n for (let i = 0; i < expandedChilds.length; i++) {\n const child = expandedChilds[i];\n child.expandBranch(child, true);\n this.updateTreeNodeCache(child);\n }\n for (let i = 0; i < otherChilds.length; i++) {\n const child = otherChilds[i];\n this.updateTreeNodeCache(child);\n }\n // 清理上一次监听函数\n if (typeof this.watchTerminator === 'function') {\n this.watchTerminator(this.path);\n }\n this.watchTerminator = this.watcher.onWatchEvent(this.path, this.handleWatchEvent);\n this.watcher.notifyDidUpdateBranch();\n }\n else {\n // 非根节点刷新的情况\n const expandedChilds = [];\n if (this === origin) {\n // 通知节点更新\n if (this.children) {\n // 重置旧的节点分支\n this.shrinkBranch(this, true);\n }\n if (this.children) {\n for (let i = 0, len = this.children.length; i < len; i++) {\n const child = this.children[i];\n child.dispose();\n }\n }\n const flatTree = new Array(childrens.length);\n this._children = Array(childrens.length);\n for (let i = 0, len = childrens.length; i < len; i++) {\n const child = childrens[i];\n child.id = TreeNode.getIdByPath(child.path) || child.id;\n this._children[i] = child;\n TreeNode.setIdByPath(child.path, child.id);\n if (CompositeTreeNode.is(child) && child.expanded) {\n expandedChilds.push(child);\n }\n this.updateTreeNodeCache(child);\n }\n this._children.sort(this._tree.sortComparator || CompositeTreeNode.defaultSortComparator);\n for (let i = 0; i < childrens.length; i++) {\n flatTree[i] = this._children[i].id;\n }\n this._branchSize = flatTree.length;\n this.setFlattenedBranch(flatTree);\n for (let i = 0; i < expandedChilds.length; i++) {\n const child = expandedChilds[i];\n child.expandBranch(child, true);\n }\n }\n else {\n for (let i = 0; i < childrens.length; i++) {\n const child = childrens[i];\n if (child.expanded) {\n expandedChilds.push(child);\n }\n }\n }\n for (let i = 0; i < expandedChilds.length; i++) {\n const child = expandedChilds[i];\n child.expandBranch(child, true);\n }\n if (typeof this.watchTerminator === 'function') {\n this.watchTerminator(this.path);\n }\n this.watchTerminator = this.watcher.onWatchEvent(this.path, this.handleWatchEvent);\n if (this === origin) {\n this.expandBranch(this);\n }\n }\n }\n else {\n // 仅需处理存在子节点的情况,否则将会影响刷新后的节点长度\n if (this.children) {\n // 清理子节点,等待下次展开时更新\n if (!!this.children && this.parent) {\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0, len = this.children.length; i < len; i++) {\n const child = this.children[i];\n child.dispose();\n }\n this._children = null;\n }\n }\n return;\n }\n });\n }\n expandedAll() {\n return tslib_1.__awaiter(this, arguments, void 0, function* (collapsedPaths = this.getAllCollapsedNodePath()) {\n // 仅根节点使用\n if (!CompositeTreeNode.isRoot(this)) {\n return;\n }\n collapsedPaths = collapsedPaths.sort((a, b) => Path.pathDepth(a) - Path.pathDepth(b));\n let path;\n while (collapsedPaths.length > 0) {\n path = collapsedPaths.pop();\n const item = TreeNode.getTreeNodeByPath(path);\n if (CompositeTreeNode.is(item)) {\n yield item.setExpanded(false, true);\n }\n }\n // 通知分支树已更新\n this.watcher.notifyDidUpdateBranch();\n });\n }\n collapsedAll() {\n return tslib_1.__awaiter(this, arguments, void 0, function* (expandedPaths = this.getAllExpandedNodePath()) {\n // 仅根节点使用\n if (!CompositeTreeNode.isRoot(this)) {\n return;\n }\n expandedPaths = expandedPaths.sort((a, b) => Path.pathDepth(a) - Path.pathDepth(b));\n let path;\n while (expandedPaths.length > 0) {\n path = expandedPaths.pop();\n const item = TreeNode.getTreeNodeByPath(path);\n if (CompositeTreeNode.is(item)) {\n item.setCollapsed(true);\n }\n }\n // 通知分支树已更新\n this.watcher.notifyDidUpdateBranch();\n });\n }\n // 折叠节点\n setCollapsed(quiet = false) {\n // 根节点不可折叠\n if (CompositeTreeNode.isRoot(this) || this.disposed) {\n return;\n }\n if (!this.isExpanded) {\n return;\n }\n const state = TreeNode.getGlobalTreeState(this.path);\n if (state.isExpanding) {\n // 当节点处于加载子节点过程时,尽管为展开状态,但此时不应该支持折叠节点\n return;\n }\n state.loadPathCancelToken.cancel();\n state.refreshCancelToken.cancel();\n this._watcher.notifyWillChangeExpansionState(this, false);\n if (this._children && this.parent) {\n // 从根节点裁剪分支\n this.shrinkBranch(this, quiet);\n }\n this.isExpanded = false;\n TreeNode.setTreeNode(this.id, this.path, this);\n this._watcher.notifyDidChangeExpansionState(this, false);\n }\n mv(to, name = this.name) {\n const prevPath = this.path;\n super.mv(to, name);\n if (typeof this.watchTerminator === 'function') {\n this.watchTerminator(prevPath);\n this.watchTerminator = this.watcher.onWatchEvent(this.path, this.handleWatchEvent);\n }\n // 同时移动过子节点\n if (this.children) {\n for (let i = 0; i < this.children.length; i++) {\n const child = this.children[i];\n child.mv(child.parent, child.name);\n }\n }\n }\n /**\n * 在节点中插入新的节点\n *\n * 直接调用此方法将不会触发onWillHandleWatchEvent和onDidHandleWatchEvent事件\n */\n insertItem(item) {\n if (item.parent !== this) {\n item.mv(this, item.name);\n return;\n }\n if (this.children) {\n for (let i = 0; i < this.children.length; i++) {\n // path / id 是节点唯一标识\n if (this.children[i].path === item.path) {\n this.children[i] = item;\n return;\n }\n }\n }\n const branchSizeIncrease = 1 + (item instanceof CompositeTreeNode && item.expanded ? item._branchSize : 0);\n if (this._children) {\n this._children.push(item);\n this._children.sort(this._tree.sortComparator || CompositeTreeNode.defaultSortComparator);\n }\n this._branchSize += branchSizeIncrease;\n let master = this;\n // 如果该节点无叶子节点,则继续往上查找合适的插入位置\n while (!master._flattenedBranch) {\n if (master.parent) {\n master = master.parent;\n master._branchSize += branchSizeIncrease;\n }\n }\n if (!this._children) {\n return;\n }\n let relativeInsertionIndex = this._children.indexOf(item);\n let absInsertionIndex;\n const leadingSibling = this._children[relativeInsertionIndex - 1];\n if (leadingSibling) {\n const siblingIdx = master._flattenedBranch.indexOf(leadingSibling.id);\n relativeInsertionIndex =\n siblingIdx +\n (leadingSibling instanceof CompositeTreeNode && leadingSibling.expanded ? leadingSibling._branchSize : 0);\n }\n else {\n relativeInsertionIndex = master._flattenedBranch.indexOf(this.id);\n }\n if (relativeInsertionIndex === -1) {\n if (this._branchSize === 1) {\n // 在空Tree中插入节点时,相对插入位置为0\n relativeInsertionIndex = 0;\n }\n }\n // 非空Tree情况下需要+1,为了容纳自身节点位置,在插入节点下方插入新增节点\n absInsertionIndex = relativeInsertionIndex + 1;\n // 空 Tree 情况下需要重置为 0,避免设置 Uint32Array 时超出范围\n if (master._flattenedBranch.length === 0) {\n absInsertionIndex = 0;\n }\n let branch = [item.id];\n if (item instanceof CompositeTreeNode && item.expanded && item._flattenedBranch) {\n branch = branch.concat(item._flattenedBranch);\n item.setFlattenedBranch(null);\n }\n master.setFlattenedBranch(spliceArray(master._flattenedBranch, absInsertionIndex, 0, branch));\n TreeNode.setTreeNode(item.id, item.path, item);\n return item;\n }\n /**\n * 从父节点中移除节点\n *\n * 直接调用此方法将不会触发onWillHandleWatchEvent和onDidHandleWatchEvent事件\n */\n unlinkItem(item, reparenting) {\n var _a;\n if (!this._children) {\n return;\n }\n const idx = this._children.indexOf(item);\n if (idx === -1) {\n return;\n }\n // 当删除时父节点已不存在界面上时,跳过插入操作\n if (!this.isItemVisibleAtRootSurface(this)) {\n return;\n }\n (_a = this._children) === null || _a === void 0 ? void 0 : _a.splice(idx, 1);\n const branchSizeDecrease = 1 + (item instanceof CompositeTreeNode && item.expanded ? item._branchSize : 0);\n this._branchSize -= branchSizeDecrease;\n // 逐级往上查找节点的父节点,并沿途裁剪分支数\n let master = this;\n while (!master._flattenedBranch) {\n if (master.parent) {\n master = master.parent;\n master._branchSize -= branchSizeDecrease;\n }\n }\n const removalBeginIdx = master._flattenedBranch.indexOf(item.id);\n if (removalBeginIdx === -1) {\n return;\n }\n if (item instanceof CompositeTreeNode && item.expanded) {\n item.setFlattenedBranch(master._flattenedBranch.slice(removalBeginIdx + 1, removalBeginIdx + branchSizeDecrease));\n }\n master.setFlattenedBranch(spliceArray(master._flattenedBranch, removalBeginIdx, branchSizeDecrease));\n if (!reparenting && item.parent === this) {\n item.mv(null);\n }\n }\n /**\n * 转换节点路径\n */\n transferItem(oldPath, newPath) {\n var _a;\n const oldP = new Path(oldPath);\n const from = oldP.dir.toString();\n if (from !== this.path) {\n return;\n }\n const name = oldP.base.toString();\n const item = (_a = this._children) === null || _a === void 0 ? void 0 : _a.find((c) => c.name === name);\n if (!item) {\n return;\n }\n const newP = new Path(newPath);\n const to = newP.dir.toString();\n const destDir = to === from ? this : TreeNode.getTreeNodeByPath(to);\n if (!CompositeTreeNode.is(destDir)) {\n this.unlinkItem(item);\n return;\n }\n item.mv(destDir, newP.base.toString());\n return item;\n }\n dispose() {\n // 如果存在对应文件路径下的监听,同样需要清理掉\n if (this.watchEvents) {\n const watcher = this.watchEvents.get(this.path);\n if (watcher) {\n watcher.terminator();\n }\n this.watchEvents.clear();\n }\n if (this._children) {\n // 移除后应该折叠,因为下次初始化默认值为折叠,否则将会导致下次插入异常\n this.isExpanded = false;\n this._children.forEach((child) => {\n child.dispose();\n });\n this._children = null;\n this._flattenedBranch = null;\n }\n super.dispose();\n }\n /**\n * 设置扁平化的分支信息\n */\n setFlattenedBranch(leaves, withoutNotify) {\n this._flattenedBranch = leaves;\n // Root节点才通知更新\n if (CompositeTreeNode.isRoot(this) && !withoutNotify) {\n this.watcher.notifyDidUpdateBranch();\n }\n }\n /**\n * 展开分支节点\n * @param branch 分支节点\n */\n expandBranch(branch, withoutNotify) {\n if (this !== branch) {\n // 但节点为展开状态时进行裁剪\n if (branch._flattenedBranch) {\n this._branchSize += branch._branchSize;\n }\n }\n // 当前节点为折叠状态,更新分支信息\n if (this !== branch && this._flattenedBranch) {\n const injectionStartIdx = this._flattenedBranch.indexOf(branch.id) + 1;\n if (injectionStartIdx === 0) {\n // 中途发生了branch更新事件,此时的_flattenedBranch可能已被更新,即查找不到branch.id\n // 这种情况在父节点发生了多路径目录的创建定位动作下更易复现\n // 例:文件树在执行a/b/c定位操作时需要请求三次数据,而更新操作可能只需要一次\n // 导致就算更新操作后置执行,也可能比定位操作先执行完,同时将_flattenedBranch更新\n // 最终导致此处查询不到对应节点,下面的shrinkBranch同样可能有相同问题,如点击折叠全部功能时\n return;\n }\n this.setFlattenedBranch(spliceArray(this._flattenedBranch, injectionStartIdx, 0, branch._flattenedBranch), withoutNotify);\n // 取消展开分支对于分支的所有权,即最终只会有顶部Root拥有所有分支信息\n branch.setFlattenedBranch(null, withoutNotify);\n }\n else if (this.parent) {\n this.parent.expandBranch(branch, withoutNotify);\n }\n }\n /**\n * 清理分支节点\n * @param branch 分支节点\n */\n shrinkBranch(branch, withoutNotify) {\n if (this !== branch) {\n // 这里的`this`实际上为父节点\n // `this`的分支大小没有改变,仍然具有相同数量的叶子,但是从父级参照系(即根节点)来看,其分支缩小了\n this._branchSize -= branch._branchSize;\n }\n if (this !== branch && this._flattenedBranch) {\n const removalStartIdx = this._flattenedBranch.indexOf(branch.id) + 1;\n if (removalStartIdx === 0) {\n // 中途发生了branch更新事件,此时的_flattenedBranch可能已被更新,即查找不到branch.id\n return;\n }\n // 返回分支对于分支信息所有权,即将折叠的节点信息再次存储于折叠了的节点中\n branch.setFlattenedBranch(this._flattenedBranch.slice(removalStartIdx, removalStartIdx + branch._branchSize), withoutNotify);\n this.setFlattenedBranch(spliceArray(this._flattenedBranch, removalStartIdx, branch._flattenedBranch ? branch._flattenedBranch.length : 0), withoutNotify);\n }\n else if (this.parent) {\n this.parent.shrinkBranch(branch, withoutNotify);\n }\n }\n /**\n * 加载子节点信息\n * 当返回值为 true 时,正常加载完子节点并同步到数据结构中\n * 返回值为 false 时,加载节点的过程被中断\n *\n * @memberof CompositeTreeNode\n */\n hardReloadChildren(token) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n let rawItems;\n const oldPath = this.path;\n try {\n // ! `this.path` maybe changed after `resolveChildren` in file tree compact mode\n rawItems = (yield this._tree.resolveChildren(this)) || [];\n }\n catch (e) {\n rawItems = [];\n }\n // 当获取到新的子节点时,如果当前节点正处于非展开状态时,忽略后续裁切逻辑\n // 后续的 expandBranch 也不应该被响应\n if (!this.expanded || (token === null || token === void 0 ? void 0 : token.isCancellationRequested)) {\n return false;\n }\n if (this.path !== oldPath) {\n // do some clean up\n TreeNode.setGlobalTreeState(oldPath, {\n isExpanding: false,\n isLoadingPath: false,\n isRefreshing: false,\n });\n }\n const expandedChilds = [];\n const flatTree = new Array(rawItems.length);\n const tempChildren = new Array(rawItems.length);\n for (let i = 0; i < rawItems.length; i++) {\n const child = rawItems[i];\n child.id = TreeNode.getIdByPath(child.path) || child.id;\n tempChildren[i] = child;\n TreeNode.setIdByPath(child.path, child.id);\n if (CompositeTreeNode.is(child) && child.expanded) {\n if (!child.children) {\n yield child.resolveChildrens(token);\n }\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return false;\n }\n expandedChilds.push(child);\n }\n }\n tempChildren.sort(this._tree.sortComparator || CompositeTreeNode.defaultSortComparator);\n for (let i = 0; i < rawItems.length; i++) {\n flatTree[i] = tempChildren[i].id;\n }\n if (this.children) {\n this.shrinkBranch(this);\n }\n if (this.children) {\n for (let i = 0; i < this.children.length; i++) {\n const child = this.children[i];\n // The Child maybe `undefined`.\n child === null || child === void 0 ? void 0 : child.dispose();\n }\n }\n for (let i = 0; i < tempChildren.length; i++) {\n this.updateTreeNodeCache(tempChildren[i]);\n }\n this._children = tempChildren;\n this._branchSize = flatTree.length;\n this.setFlattenedBranch(flatTree);\n for (let i = 0; i < expandedChilds.length; i++) {\n const child = expandedChilds[i];\n child.expandBranch(child, true);\n }\n // 清理上一次监听函数\n if (typeof this.watchTerminator === 'function') {\n this.watchTerminator(this.path);\n }\n this.watchTerminator = this.watcher.onWatchEvent(this.path, this.handleWatchEvent);\n return true;\n });\n }\n moveNode(oldPath, newPath) {\n if (typeof oldPath !== 'string') {\n throw new TypeError('Expected oldPath to be a string');\n }\n if (typeof newPath !== 'string') {\n throw new TypeError('Expected newPath to be a string');\n }\n if (Path.isRelative(oldPath)) {\n throw new TypeError('oldPath must be absolute');\n }\n if (Path.isRelative(newPath)) {\n throw new TypeError('newPath must be absolute');\n }\n return this.transferItem(oldPath, newPath);\n }\n addNode(node) {\n if (!TreeNode.is(node)) {\n throw new TypeError('Expected node to be a TreeNode');\n }\n return this.insertItem(node);\n }\n removeNode(path) {\n const pathObject = new Path(path);\n const dirName = pathObject.dir.toString();\n const name = pathObject.base.toString();\n if (dirName === this.path && !!this.children) {\n const item = this.children.find((c) => c.name === name);\n if (item) {\n this.unlinkItem(item);\n }\n }\n }\n // 当没有传入具体路径时,使用当前展开目录作为刷新路径\n refresh(tokenSource, target) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n if (!CompositeTreeNode.isRoot(this)) {\n // 刷新操作只能从根节点进行,便于对重复的刷新操作进行合并\n return yield this.root.refresh(tokenSource, this);\n }\n const state = TreeNode.getGlobalTreeState(this.path);\n if (state.isLoadingPath || state.isExpanding) {\n return;\n }\n let token;\n if (tokenSource && !tokenSource.token.isCancellationRequested) {\n TreeNode.setGlobalTreeState(this.path, {\n isRefreshing: true,\n refreshCancelToken: tokenSource,\n });\n token = tokenSource.token;\n }\n else {\n if (state.refreshCancelToken.token.isCancellationRequested) {\n const refreshCancelToken = new ide_utils_1.CancellationTokenSource();\n TreeNode.setGlobalTreeState(this.path, {\n isRefreshing: true,\n refreshCancelToken,\n });\n token = refreshCancelToken.token;\n }\n else {\n token = state.refreshCancelToken.token;\n }\n }\n this.toRefreshPathQueue.add((target || this).path);\n yield this.refreshThrottler.trigger(() => this.doRefresh(token));\n TreeNode.setGlobalTreeState(this.path, {\n isRefreshing: false,\n });\n });\n }\n doRefresh(token) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n const target = this.getRefreshNode() || this;\n if (!CompositeTreeNode.is(target)) {\n return;\n }\n const paths = target.getAllExpandedNodePath();\n yield target.refreshTreeNodeByPaths(paths, token, target);\n });\n }\n getRefreshNode() {\n let paths = Array.from(this.toRefreshPathQueue);\n this.toRefreshPathQueue.clear();\n if (!paths.length) {\n return this.root;\n }\n // 根据路径层级深度进行排序\n paths = paths.sort((a, b) => {\n const depthA = Path.pathDepth(a);\n const depthB = Path.pathDepth(b);\n return depthA - depthB;\n });\n if (paths.length === 1 || Path.pathDepth(paths[0]) === 1) {\n // 说明刷新队列中包含根节点,直接返回根节点进行刷新\n return TreeNode.getTreeNodeByPath(paths[0]);\n }\n const sortedPaths = paths.map((p) => new Path(p));\n let rootPath = sortedPaths[0];\n for (let i = 1, len = sortedPaths.length; i < len; i++) {\n if (rootPath.isEqualOrParent(sortedPaths[i])) {\n continue;\n }\n else {\n while (!rootPath.isRoot) {\n rootPath = rootPath.dir;\n if (!rootPath || rootPath.isEqualOrParent(sortedPaths[i])) {\n break;\n }\n }\n }\n }\n if (rootPath) {\n return TreeNode.getTreeNodeByPath(rootPath.toString());\n }\n return this.root;\n }\n isItemVisibleAtRootSurface(node) {\n let parent = node;\n while (parent.parent) {\n parent = parent.parent;\n }\n return parent.isItemVisibleAtSurface(node);\n }\n /**\n * 检查节点是否可见,而不是被隐藏在节点中\n *\n * 这里的可见并不表示节点在当前视图中可见,而是在用户滚动到特定位置便可看见\n *\n * 隐藏在节点中可能的原因为其父节点中有一个以上处于折叠状态\n */\n isItemVisibleAtSurface(item) {\n if (item === this) {\n return true;\n }\n return !!this._flattenedBranch && this._flattenedBranch.indexOf(item.id) > -1;\n }\n transformToRelativePath(path) {\n const { splitPath } = Path;\n const pathFlag = splitPath(path);\n pathFlag.shift();\n return pathFlag;\n }\n /**\n * 根据路径展开节点树\n * @memberof CompositeTreeNode\n */\n loadTreeNodeByPath(path_1) {\n return tslib_1.__awaiter(this, arguments, void 0, function* (path, quiet = false) {\n if (!CompositeTreeNode.isRoot(this)) {\n return;\n }\n const state = TreeNode.getGlobalTreeState(this.path);\n if (state.isExpanding) {\n return;\n }\n state.refreshCancelToken.cancel();\n state.loadPathCancelToken.cancel();\n const loadPathCancelToken = new ide_utils_1.CancellationTokenSource();\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: true,\n loadPathCancelToken,\n });\n const token = loadPathCancelToken.token;\n const flattenedBranchChilds = [];\n const { splitPath, isRelative } = Path;\n const pathFlag = isRelative(path) ? splitPath(path) : this.transformToRelativePath(path);\n if (pathFlag.length === 0) {\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n return this;\n }\n if (!this.children) {\n yield this.ensureLoaded(token);\n }\n if (token.isCancellationRequested) {\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n return;\n }\n let next = this._children;\n let preItem;\n let preItemPath = '';\n let name;\n while (next && (name = pathFlag.shift())) {\n let item = next.find((c) => c.name.indexOf(name) === 0);\n if (item) {\n if (CompositeTreeNode.is(item)) {\n item._watcher.notifyWillChangeExpansionState(item, true);\n item.isExpanded = true;\n if (!item.children) {\n yield item.resolveChildrens(token);\n if (token.isCancellationRequested) {\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n return;\n }\n }\n flattenedBranchChilds.push(item);\n item._watcher.notifyDidChangeExpansionState(item, true);\n }\n if (pathFlag.length === 0) {\n preItem = item;\n break;\n }\n }\n // 可能展开后路径发生了变化, 需要重新处理一下当前加载路径\n if (!item && preItem) {\n const compactPath = splitPath(preItem.name).slice(1);\n if (compactPath[0] === name) {\n compactPath.shift();\n while (compactPath.length > 0) {\n if (compactPath[0] === pathFlag[0]) {\n compactPath.shift();\n pathFlag.shift();\n }\n else {\n break;\n }\n }\n name = pathFlag.shift();\n item = next.find((c) => c.name.indexOf(name) === 0);\n }\n }\n // 最终加载到的路径节点\n if (!item || (!CompositeTreeNode.is(item) && pathFlag.length > 0)) {\n break;\n }\n if (CompositeTreeNode.is(item)) {\n const isCompactName = item.name.indexOf(Path.separator) > 0;\n if (isCompactName) {\n const compactPath = splitPath(item.name).slice(1);\n while (compactPath.length > 0) {\n if (compactPath[0] === pathFlag[0]) {\n compactPath.shift();\n pathFlag.shift();\n }\n else {\n break;\n }\n }\n }\n if (!item._children) {\n preItemPath = item.path;\n if (CompositeTreeNode.is(item)) {\n item.isExpanded = true;\n if (!item.children) {\n yield item.resolveChildrens(token);\n if (token.isCancellationRequested) {\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n return;\n }\n }\n flattenedBranchChilds.push(item);\n }\n }\n if (item && pathFlag.length === 0) {\n preItem = item;\n break;\n }\n else {\n if (!!preItemPath && preItemPath !== item.path) {\n // 说明此时已发生了路径压缩,如从 a -> a/b/c\n // 需要根据路径变化移除对应的展开路径, 这里只需考虑短变长场景\n const prePaths = splitPath(preItemPath);\n const nextPaths = splitPath(item.path);\n if (nextPaths.length > prePaths.length) {\n pathFlag.splice(0, nextPaths.length - prePaths.length);\n }\n }\n next = item._children;\n preItem = item;\n }\n }\n }\n if (preItem) {\n let child;\n if (preItem.disposed) {\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n return;\n }\n while ((child = flattenedBranchChilds.pop())) {\n child.expandBranch(child, true);\n if (flattenedBranchChilds.length === 0) {\n this.updateTreeNodeCache(child);\n }\n }\n if (!quiet) {\n this.watcher.notifyDidUpdateBranch();\n }\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n return preItem;\n }\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n });\n }\n /**\n * 根据节点获取节点ID下标位置\n * @param {number} id\n * @returns\n * @memberof CompositeTreeNode\n */\n getIndexAtTreeNodeId(id) {\n if (this._flattenedBranch) {\n return this._flattenedBranch.indexOf(id);\n }\n return -1;\n }\n /**\n * 根据节点获取节点下标位置\n * @param {ITreeNodeOrCompositeTreeNode} node\n * @returns\n * @memberof CompositeTreeNode\n */\n getIndexAtTreeNode(node) {\n if (this._flattenedBranch) {\n return this._flattenedBranch.indexOf(node.id);\n }\n return -1;\n }\n /**\n * 根据下标位置获取节点\n * @param {number} index\n * @returns\n * @memberof CompositeTreeNode\n */\n getTreeNodeAtIndex(index) {\n var _a;\n const id = (_a = this._flattenedBranch) === null || _a === void 0 ? void 0 : _a[index];\n if (!id) {\n return undefined;\n }\n return TreeNode.getTreeNodeById(id);\n }\n /**\n * 根据节点ID获取节点\n * @param {number} id\n * @returns\n * @memberof CompositeTreeNode\n */\n getTreeNodeById(id) {\n return TreeNode.getTreeNodeById(id);\n }\n /**\n * 根据节点路径获取节点\n * @param {string} path\n * @returns\n * @memberof CompositeTreeNode\n */\n getTreeNodeByPath(path) {\n return TreeNode.getTreeNodeByPath(path);\n }\n}\nexports.CompositeTreeNode = CompositeTreeNode;\nCompositeTreeNode.REFRESH_DELAY = 200;\n\n\n//# sourceURL=webpack://@opensumi/ide-components/./src/recycle-tree/tree/TreeNode.ts?");
|
|
6301
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.CompositeTreeNode = exports.TreeNode = exports.BranchOperatorStatus = void 0;\nexports.spliceArray = spliceArray;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"../../node_modules/tslib/tslib.es6.mjs\");\n/* eslint-disable @typescript-eslint/prefer-for-of */\nconst ide_utils_1 = __webpack_require__(/*! @opensumi/ide-utils */ \"../utils/lib/index.js\");\nconst types_1 = __webpack_require__(/*! ../types */ \"./src/recycle-tree/types/index.ts\");\nconst { Path } = ide_utils_1.path;\n/**\n * 裁剪数组\n *\n * @param arr 裁剪数组\n * @param start 起始位置\n * @param deleteCount 删除或替换位置\n * @param items 插入的数组\n */\nfunction spliceArray(arr, start, deleteCount = 0, items) {\n const a = arr.slice(0);\n a.splice(start, deleteCount, ...(items || []));\n return a;\n}\nvar BranchOperatorStatus;\n(function (BranchOperatorStatus) {\n BranchOperatorStatus[BranchOperatorStatus[\"EXPANDED\"] = 1] = \"EXPANDED\";\n BranchOperatorStatus[BranchOperatorStatus[\"SHRINKED\"] = 2] = \"SHRINKED\";\n})(BranchOperatorStatus || (exports.BranchOperatorStatus = BranchOperatorStatus = {}));\nclass TreeNode {\n static is(node) {\n return !!node && 'depth' in node && 'name' in node && 'path' in node && 'id' in node;\n }\n static getTreeNodeById(id) {\n return TreeNode.idToTreeNode.get(id);\n }\n static getTreeNodeByPath(path) {\n return TreeNode.pathToTreeNode.get(path);\n }\n static setTreeNode(id, path, node) {\n TreeNode.idToTreeNode.set(id, node);\n TreeNode.pathToTreeNode.set(path, node);\n }\n static removeTreeNode(id, path) {\n TreeNode.idToTreeNode.delete(id);\n TreeNode.pathToTreeNode.delete(path);\n }\n static getIdByPath(path) {\n return TreeNode.pathToId.get(path);\n }\n static setIdByPath(path, id) {\n return TreeNode.pathToId.set(path, id);\n }\n static getGlobalTreeState(path) {\n let state = TreeNode.pathToGlobalTreeState.get(path);\n if (!state) {\n state = {\n isExpanding: false,\n isLoadingPath: false,\n isRefreshing: false,\n refreshCancelToken: new ide_utils_1.CancellationTokenSource(),\n loadPathCancelToken: new ide_utils_1.CancellationTokenSource(),\n };\n }\n return state;\n }\n static setGlobalTreeState(path, updateState) {\n let state = TreeNode.pathToGlobalTreeState.get(path);\n if (!state) {\n state = {\n isExpanding: false,\n isLoadingPath: false,\n isRefreshing: false,\n refreshCancelToken: new ide_utils_1.CancellationTokenSource(),\n loadPathCancelToken: new ide_utils_1.CancellationTokenSource(),\n };\n }\n state = Object.assign(Object.assign({}, state), updateState);\n TreeNode.pathToGlobalTreeState.set(path, state);\n return state;\n }\n constructor(tree, parent, watcher, optionalMetadata) {\n this._uid = TreeNode.nextId();\n this._parent = parent;\n this._tree = tree;\n this._disposed = false;\n this._visible = true;\n this._metadata = Object.assign({}, (optionalMetadata || {}));\n this._depth = parent ? parent.depth + 1 : 0;\n if (watcher) {\n this._watcher = watcher;\n }\n else if (parent) {\n this._watcher = parent.watcher;\n }\n }\n get disposed() {\n return this._disposed;\n }\n /**\n * 获取基础信息\n */\n get depth() {\n return this._depth;\n }\n get parent() {\n return this._parent;\n }\n set parent(node) {\n this._parent = node;\n // 节点 `parent` 变化,更新当前节点的 `path` 属性\n this._path = '';\n }\n get type() {\n return types_1.TreeNodeType.TreeNode;\n }\n get id() {\n return this._uid;\n }\n set id(id) {\n this._uid = id;\n }\n get displayName() {\n return this.name;\n }\n /**\n * 由于 Tree 对于唯一路径的 path 的依赖\n * 在传入 `name` 值时必须保证其在路径上的唯一性\n * 一般不建议手动管理 `name`,采用默认值即可\n */\n get name() {\n if (!this.parent) {\n return `root_${this.id}`;\n }\n return this.getMetadata('name') || String(this.id);\n }\n set name(name) {\n this.addMetadata('name', name);\n // 节点 `name` 变化,更新当前节点的 `path` 属性\n this._path = '';\n }\n // 节点绝对路径\n get path() {\n if (!this._path) {\n if (!this.parent) {\n this._path = this.name.startsWith(Path.separator) ? this.name : `${Path.separator}${this.name}`;\n }\n else {\n this._path = this.name.startsWith(Path.separator)\n ? `${this.parent.path}${this.name}`\n : `${this.parent.path}${Path.separator}${this.name}`;\n }\n }\n return this._path;\n }\n get checkboxInfo() {\n return {\n checked: false,\n tooltip: '',\n accessibilityInformation: this.accessibilityInformation,\n };\n }\n get accessibilityInformation() {\n return {\n label: this.name,\n role: 'treeitem',\n };\n }\n getMetadata(withKey) {\n if (withKey === 'name' && !this._metadata[withKey]) {\n this._metadata[withKey] = String(TreeNode.nextId());\n }\n return this._metadata[withKey];\n }\n addMetadata(withKey, value) {\n if (!(withKey in this._metadata)) {\n this._metadata[withKey] = value;\n this._watcher.notifyDidChangeMetadata(this, {\n type: types_1.MetadataChangeType.Added,\n key: withKey,\n prevValue: void 0,\n value,\n });\n }\n else {\n const prevValue = this._metadata[withKey];\n this._metadata[withKey] = value;\n this._watcher.notifyDidChangeMetadata(this, { type: types_1.MetadataChangeType.Updated, key: withKey, prevValue, value });\n }\n }\n removeMetadata(withKey) {\n if (withKey in this._metadata) {\n const prevValue = this._metadata[withKey];\n delete this._metadata[withKey];\n this._watcher.notifyDidChangeMetadata(this, {\n type: types_1.MetadataChangeType.Removed,\n key: withKey,\n prevValue,\n value: void 0,\n });\n }\n }\n /**\n * 这里的move操作可能为移动,也可能为重命名\n *\n * @param {ICompositeTreeNode} to\n * @param {string} [name=this.name]\n * @returns\n * @memberof TreeNode\n */\n mv(to, name = this.name) {\n // 一个普通节点必含有父节点,根节点不允许任何操作\n const prevParent = this._parent;\n if (to === null || !CompositeTreeNode.is(to)) {\n this.parent = undefined;\n this.dispose();\n return;\n }\n const didChangeParent = prevParent !== to;\n const prevPath = this.path;\n this._depth = to.depth + 1;\n if (didChangeParent || name !== this.name) {\n this.name = name;\n if (didChangeParent) {\n this._watcher.notifyWillChangeParent(this, prevParent, to);\n }\n if (this.parent) {\n this.parent.unlinkItem(this, true);\n this.parent = to;\n this.parent.insertItem(this);\n }\n if (didChangeParent) {\n this._watcher.notifyDidChangeParent(this, prevParent, to);\n }\n }\n if (this.path !== prevPath) {\n this._watcher.notifyDidChangePath(this);\n }\n }\n get visible() {\n return this._visible;\n }\n setVisible(b) {\n this._visible = b;\n return this;\n }\n dispose() {\n if (this._disposed) {\n return;\n }\n TreeNode.removeTreeNode(this.id, this.path);\n this._disposed = true;\n this._watcher.notifyDidDispose(this);\n }\n}\nexports.TreeNode = TreeNode;\nTreeNode.nextId = (() => {\n let id = 0;\n return () => id++;\n})();\nTreeNode.idToTreeNode = new Map();\nTreeNode.pathToTreeNode = new Map();\nTreeNode.pathToId = new Map();\n// 每颗树都只会在根节点上绑定一个可取消的对象,即同个时间点只能存在一个改变树数据结构的事情\nTreeNode.pathToGlobalTreeState = new Map();\nclass CompositeTreeNode extends TreeNode {\n static defaultSortComparator(a, b) {\n if (a.constructor === b.constructor) {\n return a.name > b.name ? 1 : a.name < b.name ? -1 : 0;\n }\n return CompositeTreeNode.is(a) ? -1 : CompositeTreeNode.is(b) ? 1 : 0;\n }\n static is(node) {\n return !!node && 'children' in node;\n }\n static isRoot(node) {\n return CompositeTreeNode.is(node) && !node.parent;\n }\n generatorWatcher() {\n const emitter = new ide_utils_1.Emitter();\n const onEventChanges = emitter.event;\n const disposeCollection = new ide_utils_1.DisposableCollection();\n const terminateWatch = (path) => {\n this.watchEvents.delete(path);\n };\n const watcher = {\n notifyWillProcessWatchEvent: (target, event) => {\n emitter.fire({ type: types_1.TreeNodeEvent.WillProcessWatchEvent, args: [target, event] });\n },\n notifyWillChangeParent: (target, prevParent, newParent) => {\n emitter.fire({ type: types_1.TreeNodeEvent.WillChangeParent, args: [target, prevParent, newParent] });\n },\n notifyDidChangeParent: (target, prevParent, newParent) => {\n emitter.fire({ type: types_1.TreeNodeEvent.DidChangeParent, args: [target, prevParent, newParent] });\n },\n notifyDidDispose: (target) => {\n emitter.fire({ type: types_1.TreeNodeEvent.DidDispose, args: [target] });\n },\n notifyDidProcessWatchEvent: (target, event) => {\n emitter.fire({ type: types_1.TreeNodeEvent.DidProcessWatchEvent, args: [target, event] });\n },\n notifyDidChangePath: (target) => {\n emitter.fire({ type: types_1.TreeNodeEvent.DidChangePath, args: [target] });\n },\n notifyWillChangeExpansionState: (target, nowExpanded) => {\n const isVisible = this.isItemVisibleAtSurface(target);\n emitter.fire({ type: types_1.TreeNodeEvent.WillChangeExpansionState, args: [target, nowExpanded, isVisible] });\n },\n notifyDidChangeExpansionState: (target, nowExpanded) => {\n const isVisible = this.isItemVisibleAtSurface(target);\n emitter.fire({ type: types_1.TreeNodeEvent.DidChangeExpansionState, args: [target, nowExpanded, isVisible] });\n },\n notifyDidChangeMetadata: (target, change) => {\n emitter.fire({ type: types_1.TreeNodeEvent.DidChangeMetadata, args: [target, change] });\n },\n notifyDidUpdateBranch: () => {\n emitter.fire({ type: types_1.TreeNodeEvent.BranchDidUpdate, args: [] });\n },\n notifyWillResolveChildren: (target, nowExpanded) => {\n emitter.fire({ type: types_1.TreeNodeEvent.WillResolveChildren, args: [target, nowExpanded] });\n },\n notifyDidResolveChildren: (target, nowExpanded) => {\n emitter.fire({ type: types_1.TreeNodeEvent.DidResolveChildren, args: [target, nowExpanded] });\n },\n // 监听所有事件\n on: (event, callback) => {\n const dispose = onEventChanges((data) => {\n if (data.type === event) {\n callback(...data.args);\n }\n });\n disposeCollection.push(dispose);\n return dispose;\n },\n // 监听Watch事件变化\n onWatchEvent: (path, callback) => {\n const terminator = terminateWatch;\n this.watchEvents.set(path, { terminator, callback });\n return terminator;\n },\n dispose: disposeCollection,\n };\n return watcher;\n }\n // parent 为undefined即表示该节点为根节点\n constructor(tree, parent, watcher, optionalMetadata) {\n super(tree, parent, watcher, optionalMetadata);\n this._children = null;\n this._lock = false;\n this.refreshThrottler = new ide_utils_1.ThrottledDelayer(CompositeTreeNode.REFRESH_DELAY);\n this.toRefreshPathQueue = new Set();\n /**\n * 处理 Watch 事件,同时可通过外部手动调 g用节点更新函数进行节点替换,这里为通用的事件管理\n * 如: transferItem,insertItem, unlinkItem等\n * @private\n * @memberof CompositeTreeNode\n */\n this.handleWatchEvent = (event) => tslib_1.__awaiter(this, void 0, void 0, function* () {\n this.watcher.notifyWillProcessWatchEvent(this, event);\n switch (event.type) {\n case types_1.WatchEvent.Moved: {\n const { oldPath, newPath } = event;\n if (typeof oldPath !== 'string') {\n throw new TypeError('Expected oldPath to be a string');\n }\n if (typeof newPath !== 'string') {\n throw new TypeError('Expected newPath to be a string');\n }\n if (Path.isRelative(oldPath)) {\n throw new TypeError('oldPath must be absolute');\n }\n if (Path.isRelative(newPath)) {\n throw new TypeError('newPath must be absolute');\n }\n this.transferItem(oldPath, newPath);\n break;\n }\n case types_1.WatchEvent.Added: {\n const { node } = event;\n if (!TreeNode.is(node)) {\n throw new TypeError('Expected node to be a TreeNode');\n }\n this.insertItem(node);\n break;\n }\n case types_1.WatchEvent.Removed: {\n const { path } = event;\n const pathObject = new Path(path);\n const dirName = pathObject.dir.toString();\n const name = pathObject.base.toString();\n if (dirName === this.path && !!this.children) {\n const item = this.children.find((c) => c.name === name);\n if (item) {\n this.unlinkItem(item);\n }\n }\n break;\n }\n default:\n // 如果当前变化的节点已在数据视图(并非滚动到不可见区域)中不可见,则将该节点折叠,待下次更新即可,\n if (!this.isItemVisibleAtRootSurface(this)) {\n this.isExpanded = false;\n this._children = null;\n }\n else {\n yield this.refresh();\n }\n break;\n }\n this.watcher.notifyDidProcessWatchEvent(this, event);\n });\n this.isExpanded = parent ? false : true;\n this._branchSize = 0;\n if (!parent) {\n this.watchEvents = new Map();\n // 为根节点创建监听器\n this._watcher = this.generatorWatcher();\n this._root = this;\n TreeNode.setTreeNode(this.id, this.path, this);\n }\n else {\n this._watcher = parent.watcher;\n }\n }\n // 重载 name 的 getter/setter,路径改变时需要重新监听文件节点变化\n set name(name) {\n const prevPath = this.path;\n if (!CompositeTreeNode.isRoot(this) && typeof this.watchTerminator === 'function') {\n this.watchTerminator(prevPath);\n this.addMetadata('name', name);\n this.watchTerminator = this.watcher.onWatchEvent(this.path, this.handleWatchEvent);\n }\n else {\n this.addMetadata('name', name);\n }\n // 节点 `name` 变化,更新当前节点的 `path` 属性\n this._path = '';\n }\n get name() {\n // 根节点保证路径不重复\n if (!this.parent) {\n return `root_${this.id}`;\n }\n return this.getMetadata('name');\n }\n // 作为根节点唯一的watcher需要在生成新节点的时候传入\n get watcher() {\n return this._watcher;\n }\n get type() {\n return types_1.TreeNodeType.CompositeTreeNode;\n }\n get children() {\n return this._children;\n }\n get expanded() {\n return this.isExpanded;\n }\n /**\n * 当前可见的分支数量\n *\n * 当节点为展开状态时,其整个分支(递归展平)由上一级的分支(根(位于数据层可见)或处于折叠状态的分支)拥有\n * 当节点为折叠状态时,其整个分支(递归展平)由其上一级父目录展开该节点\n *\n * @readonly\n * @memberof CompositeTreeNode\n */\n get branchSize() {\n return this._branchSize;\n }\n /**\n * 获取当前节点的分支数,一般为顶层节点,如Root上获取\n *\n * @readonly\n * @memberof CompositeTreeNode\n */\n get flattenedBranch() {\n return this._flattenedBranch;\n }\n get lock() {\n return this._lock;\n }\n get root() {\n if ((0, ide_utils_1.isUndefined)(this._root)) {\n this._root = this.getRoot() || null;\n }\n return this._root;\n }\n getRoot() {\n let root = this.parent;\n while (root && root.parent) {\n root = root.parent;\n }\n return root;\n }\n /**\n * 确保此“目录”的子级已加载(不影响“展开”状态)\n * 如果子级已经加载,则返回的Promise将立即解决\n * 否则,将发出重新加载请求并返回Promise\n * 一旦返回的Promise.resolve,“CompositeTreeNode#children” 便可以访问到对于节点\n */\n ensureLoaded(token) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n if (this._children) {\n return;\n }\n return yield this.hardReloadChildren(token);\n });\n }\n // 展开节点\n setExpanded() {\n return tslib_1.__awaiter(this, arguments, void 0, function* (ensureVisible = true, quiet = false, isOwner = true, token) {\n if (this.disposed) {\n return;\n }\n // 根节点不可折叠\n if (CompositeTreeNode.isRoot(this)) {\n return;\n }\n if (this.isExpanded) {\n return;\n }\n if (isOwner) {\n const state = TreeNode.getGlobalTreeState(this.path);\n state.loadPathCancelToken.cancel();\n state.refreshCancelToken.cancel();\n TreeNode.setGlobalTreeState(this.path, {\n isExpanding: true,\n });\n }\n this.isExpanded = true;\n if (this._children === null) {\n this._watcher.notifyWillResolveChildren(this, this.isExpanded);\n yield this.hardReloadChildren(token);\n this._watcher.notifyDidResolveChildren(this, this.isExpanded);\n // 检查其是否展开;可能同时执行了 setCollapsed 方法\n if (!this.isExpanded || (token === null || token === void 0 ? void 0 : token.isCancellationRequested)) {\n if (isOwner) {\n TreeNode.setGlobalTreeState(this.path, {\n isExpanding: false,\n });\n }\n return;\n }\n }\n if (ensureVisible && this.parent && CompositeTreeNode.is(this.parent)) {\n /**\n * 在传入 ensureVisible = true 时,这里传入的 token 不能取消所有副作用\n * 故在使用 ensureVisible = true 时必须保证 `setExpanded` 与 `setCollapsed` 的独立性\n * 如需要 `await node.setExpanded(true)` 后再执行 `node.setCollapsed()`\n */\n yield this.parent.setExpanded(true, !quiet, false, token);\n }\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n if (isOwner) {\n TreeNode.setGlobalTreeState(this.path, {\n isExpanding: false,\n });\n }\n return;\n }\n if (this.isExpanded) {\n this._watcher.notifyWillChangeExpansionState(this, true);\n // 与根节点合并分支\n this.expandBranch(this, quiet);\n this._watcher.notifyDidChangeExpansionState(this, true);\n }\n if (isOwner) {\n TreeNode.setGlobalTreeState(this.path, {\n isExpanding: false,\n });\n TreeNode.setTreeNode(this.id, this.path, this);\n }\n });\n }\n // 获取当前节点下所有展开的节点路径\n getAllExpandedNodePath() {\n var _a, _b;\n const paths = [];\n let start = 0;\n if (!CompositeTreeNode.isRoot(this)) {\n // 找到节点位置下标,向下进一步查找展开目录\n start = ((_a = this.root) === null || _a === void 0 ? void 0 : _a.getIndexAtTreeNodeId(this.id)) + 1;\n }\n const end = start + this.branchSize;\n for (let i = start; i < end; i++) {\n const node = (_b = this.root) === null || _b === void 0 ? void 0 : _b.getTreeNodeAtIndex(i);\n if (CompositeTreeNode.is(node) && node.expanded) {\n paths.push(node.path);\n }\n }\n return paths;\n }\n // 获取当前节点下所有折叠的节点路径\n getAllCollapsedNodePath() {\n let paths = [];\n if (this.children) {\n for (let i = 0; i < this.children.length; i++) {\n const child = this.children[i];\n if (!CompositeTreeNode.is(child)) {\n continue;\n }\n if (child.isExpanded) {\n paths = paths.concat(child.getAllCollapsedNodePath());\n }\n else {\n paths.push(child.path);\n }\n }\n return paths;\n }\n else {\n return paths;\n }\n }\n /**\n * 处理节点数据,让节点重新加载子节点及初始化 flattenedBranch\n * @param token CancellationToken\n */\n resolveChildrens(token) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n var _a, _b, _c;\n let childrens = this.children;\n let expandedPaths = [];\n try {\n childrens = (yield this._tree.resolveChildren(this)) || [];\n }\n catch (e) {\n childrens = [];\n }\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return false;\n }\n const flatTree = new Array(childrens.length);\n this._children = Array(childrens.length);\n for (let i = 0; i < childrens.length; i++) {\n const child = childrens[i];\n // 如果存在上一次缓存的节点,则使用缓存节点的 ID\n child.id = TreeNode.getIdByPath(child.path) || child.id;\n this._children[i] = child;\n TreeNode.setIdByPath(child.path, child.id);\n }\n (_a = this._children) === null || _a === void 0 ? void 0 : _a.sort(this._tree.sortComparator || CompositeTreeNode.defaultSortComparator);\n for (let i = 0; i < childrens.length; i++) {\n flatTree[i] = this._children[i].id;\n }\n const expandedChilds = [];\n for (let i = 0, len = ((_b = this.children) === null || _b === void 0 ? void 0 : _b.length) || 0; i < len; i++) {\n const subChild = (_c = this.children) === null || _c === void 0 ? void 0 : _c[i];\n if (CompositeTreeNode.is(subChild) && subChild.expanded) {\n const paths = yield subChild.resolveChildrens(token);\n if (paths) {\n expandedPaths = expandedPaths.concat(paths);\n }\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n expandedChilds.push(subChild);\n }\n }\n this._branchSize = flatTree.length;\n this.setFlattenedBranch(flatTree);\n for (let i = 0; i < expandedChilds.length; i++) {\n const child = expandedChilds[i];\n child.expandBranch(child, true);\n }\n return expandedPaths.concat(expandedChilds.map((child) => child.path.toString()));\n });\n }\n updateTreeNodeCache(child) {\n var _a;\n TreeNode.setTreeNode(child.id, child.path, child);\n if (CompositeTreeNode.is(child) && child.expanded && ((_a = child.children) === null || _a === void 0 ? void 0 : _a.length)) {\n for (let i = 0; i < child.children.length; i++) {\n const subChild = child.children[i];\n this.updateTreeNodeCache(subChild);\n }\n }\n }\n /**\n * 静默刷新子节点, 即不触发分支更新事件\n * @param toExpandPaths 待展开的路径\n * @param token CancellationToken\n * @param origin 当 this === origin 时,说明此节点为调用的源头节点\n */\n refreshTreeNodeByPaths() {\n return tslib_1.__awaiter(this, arguments, void 0, function* (toExpandPaths = this.getAllExpandedNodePath(), token, origin) {\n if (!CompositeTreeNode.is(this)) {\n return;\n }\n // 如果某次刷新操作被取消,则下次刷新依旧使用上一次刷新的展开目录进行刷新\n let toExpandPath;\n const originChildren = this.children;\n let childrens = this.children || [];\n if (this.expanded) {\n if (this === origin) {\n try {\n childrens = (yield this._tree.resolveChildren(this)) || [];\n }\n catch (e) {\n childrens = [];\n }\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n if (!this.expanded) {\n // 当请求刷新节点时,如果该节点已经不应该被处理,则清理 Children\n // 下次再被展开时便会自动更新 Children 最新内容\n if (this.children) {\n // 清理子节点,等待下次展开时更新\n if (!!this.children && this.parent) {\n for (let i = 0; i < this.children.length; i++) {\n const child = this.children[i];\n child.dispose();\n }\n this._children = null;\n }\n }\n return;\n }\n }\n while ((toExpandPath = toExpandPaths.shift())) {\n const isRelative = toExpandPath.indexOf(`${this.path}${Path.separator}`) > -1;\n if (!isRelative) {\n if (toExpandPath === this.path) {\n toExpandPath = undefined;\n }\n break;\n }\n const child = childrens === null || childrens === void 0 ? void 0 : childrens.find((child) => child.path === toExpandPath);\n // 对于压缩情况的路径需要额外处理一下\n // 如果这里加载的路径是 a/b/c, 有可能目前只加载到 a/b\n if (!child) {\n if (!childrens || childrens.length === 0) {\n break;\n }\n for (let i = 0; i < childrens.length; i++) {\n const child = childrens[i];\n const isInclude = toExpandPath.indexOf(`${child.path}${Path.separator}`) === 0; // 展开路径包含子节点路径\n if (isInclude && CompositeTreeNode.is(child)) {\n // 包含压缩节点的情况\n if (!CompositeTreeNode.is(child)) {\n // 说明此节点为非折叠节点时不处理\n continue;\n }\n child.isExpanded = true;\n // 加载路径包含当前判断路径,尝试加载该节点再匹配\n const extraExpandedPaths = yield child.resolveChildrens(token);\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n if (extraExpandedPaths) {\n toExpandPaths = toExpandPaths.filter((path) => !extraExpandedPaths.find((a) => a === path));\n }\n if (child.path !== toExpandPath && !toExpandPaths.includes(child.path)) {\n toExpandPaths.unshift(toExpandPath);\n }\n if (toExpandPaths.length > 0) {\n // 不需要重新加载压缩节点的子节点内容\n toExpandPaths =\n (yield child.refreshTreeNodeByPaths([...toExpandPaths], token, origin)) || [];\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n }\n break;\n }\n }\n }\n else if (CompositeTreeNode.is(child)) {\n // 如果节点默认展开,则忽略后续操作\n if (!child.expanded) {\n child.isExpanded = true;\n const extraExpandedPaths = yield child.resolveChildrens(token);\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n if (extraExpandedPaths) {\n toExpandPaths = toExpandPaths.filter((path) => !extraExpandedPaths.find((a) => a.includes(path)));\n }\n if (toExpandPaths.length > 0 && !(token === null || token === void 0 ? void 0 : token.isCancellationRequested)) {\n toExpandPaths =\n (yield child.refreshTreeNodeByPaths([...toExpandPaths], token, origin)) || [];\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n }\n }\n }\n }\n if (toExpandPath) {\n // 仍然存在需要进一步处理的待展开路径\n toExpandPaths.unshift(toExpandPath);\n if (this === origin) {\n // 说明待展开的路径已经不存在,直接处理子节点\n if (originChildren) {\n this.shrinkBranch(this, true);\n for (let i = 0; i < originChildren.length; i++) {\n const child = originChildren[i];\n child === null || child === void 0 ? void 0 : child.dispose();\n }\n }\n const expandedChilds = [];\n const flatTree = new Array(childrens.length);\n this._children = Array(childrens.length);\n for (let i = 0; i < childrens.length; i++) {\n const child = childrens[i];\n // 如果存在上一次缓存的节点,则使用缓存节点的 ID\n child.id = TreeNode.getIdByPath(child.path) || child.id;\n this._children[i] = child;\n TreeNode.setIdByPath(child.path, child.id);\n if (CompositeTreeNode.is(child) && child.expanded) {\n expandedChilds.push(child);\n }\n }\n this._children.sort(this._tree.sortComparator || CompositeTreeNode.defaultSortComparator);\n for (let i = 0; i < childrens.length; i++) {\n flatTree[i] = this._children[i].id;\n }\n this._branchSize = flatTree.length;\n this.setFlattenedBranch(flatTree, true);\n this.watcher.notifyDidUpdateBranch();\n }\n if (this.parent !== origin) {\n // 将所有子节点合并至第二层 Children 上,减少后续递归拼接带来额外成本\n this.expandBranch(this, true);\n }\n return toExpandPaths;\n }\n else if (CompositeTreeNode.isRoot(this)) {\n if (this.children) {\n this.shrinkBranch(this, true);\n for (let i = 0; i < this.children.length; i++) {\n const child = this.children[i];\n child === null || child === void 0 ? void 0 : child.dispose();\n }\n }\n const expandedChilds = [];\n const otherChilds = [];\n const flatTree = new Array(childrens.length);\n this._children = Array(childrens.length);\n for (let i = 0; i < childrens.length; i++) {\n const child = childrens[i];\n // 如果存在上一次缓存的节点,则使用缓存节点的 ID\n child.id = TreeNode.getIdByPath(child.path) || child.id;\n this._children[i] = child;\n TreeNode.setIdByPath(child.path, child.id);\n if (CompositeTreeNode.is(child) && child.expanded) {\n if (!child.children) {\n yield child.resolveChildrens(token);\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return;\n }\n }\n expandedChilds.push(child);\n }\n else {\n otherChilds.push(child);\n }\n }\n this._children.sort(this._tree.sortComparator || CompositeTreeNode.defaultSortComparator);\n for (let i = 0; i < childrens.length; i++) {\n flatTree[i] = this._children[i].id;\n }\n this._branchSize = flatTree.length;\n this.setFlattenedBranch(flatTree, true);\n for (let i = 0; i < expandedChilds.length; i++) {\n const child = expandedChilds[i];\n child.expandBranch(child, true);\n this.updateTreeNodeCache(child);\n }\n for (let i = 0; i < otherChilds.length; i++) {\n const child = otherChilds[i];\n this.updateTreeNodeCache(child);\n }\n // 清理上一次监听函数\n if (typeof this.watchTerminator === 'function') {\n this.watchTerminator(this.path);\n }\n this.watchTerminator = this.watcher.onWatchEvent(this.path, this.handleWatchEvent);\n this.watcher.notifyDidUpdateBranch();\n }\n else {\n // 非根节点刷新的情况\n const expandedChilds = [];\n if (this === origin) {\n // 通知节点更新\n if (this.children) {\n // 重置旧的节点分支\n this.shrinkBranch(this, true);\n }\n if (this.children) {\n for (let i = 0, len = this.children.length; i < len; i++) {\n const child = this.children[i];\n child.dispose();\n }\n }\n const flatTree = new Array(childrens.length);\n this._children = Array(childrens.length);\n for (let i = 0, len = childrens.length; i < len; i++) {\n const child = childrens[i];\n child.id = TreeNode.getIdByPath(child.path) || child.id;\n this._children[i] = child;\n TreeNode.setIdByPath(child.path, child.id);\n if (CompositeTreeNode.is(child) && child.expanded) {\n expandedChilds.push(child);\n }\n this.updateTreeNodeCache(child);\n }\n this._children.sort(this._tree.sortComparator || CompositeTreeNode.defaultSortComparator);\n for (let i = 0; i < childrens.length; i++) {\n flatTree[i] = this._children[i].id;\n }\n this._branchSize = flatTree.length;\n this.setFlattenedBranch(flatTree);\n for (let i = 0; i < expandedChilds.length; i++) {\n const child = expandedChilds[i];\n child.expandBranch(child, true);\n }\n }\n else {\n for (let i = 0; i < childrens.length; i++) {\n const child = childrens[i];\n if (child.expanded) {\n expandedChilds.push(child);\n }\n }\n }\n for (let i = 0; i < expandedChilds.length; i++) {\n const child = expandedChilds[i];\n child.expandBranch(child, true);\n }\n if (typeof this.watchTerminator === 'function') {\n this.watchTerminator(this.path);\n }\n this.watchTerminator = this.watcher.onWatchEvent(this.path, this.handleWatchEvent);\n if (this === origin) {\n this.expandBranch(this);\n }\n }\n }\n else {\n // 仅需处理存在子节点的情况,否则将会影响刷新后的节点长度\n if (this.children) {\n // 清理子节点,等待下次展开时更新\n if (!!this.children && this.parent) {\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0, len = this.children.length; i < len; i++) {\n const child = this.children[i];\n child.dispose();\n }\n this._children = null;\n }\n }\n return;\n }\n });\n }\n expandedAll() {\n return tslib_1.__awaiter(this, arguments, void 0, function* (collapsedPaths = this.getAllCollapsedNodePath()) {\n // 仅根节点使用\n if (!CompositeTreeNode.isRoot(this)) {\n return;\n }\n collapsedPaths = collapsedPaths.sort((a, b) => Path.pathDepth(a) - Path.pathDepth(b));\n let path;\n while (collapsedPaths.length > 0) {\n path = collapsedPaths.pop();\n const item = TreeNode.getTreeNodeByPath(path);\n if (CompositeTreeNode.is(item)) {\n yield item.setExpanded(false, true);\n }\n }\n // 通知分支树已更新\n this.watcher.notifyDidUpdateBranch();\n });\n }\n collapsedAll() {\n return tslib_1.__awaiter(this, arguments, void 0, function* (expandedPaths = this.getAllExpandedNodePath()) {\n // 仅根节点使用\n if (!CompositeTreeNode.isRoot(this)) {\n return;\n }\n expandedPaths = expandedPaths.sort((a, b) => Path.pathDepth(a) - Path.pathDepth(b));\n let path;\n while (expandedPaths.length > 0) {\n path = expandedPaths.pop();\n const item = TreeNode.getTreeNodeByPath(path);\n if (CompositeTreeNode.is(item)) {\n item.setCollapsed(true);\n }\n }\n // 通知分支树已更新\n this.watcher.notifyDidUpdateBranch();\n });\n }\n // 折叠节点\n setCollapsed(quiet = false) {\n // 根节点不可折叠\n if (CompositeTreeNode.isRoot(this) || this.disposed) {\n return;\n }\n if (!this.isExpanded) {\n return;\n }\n const state = TreeNode.getGlobalTreeState(this.path);\n if (state.isExpanding) {\n // 当节点处于加载子节点过程时,尽管为展开状态,但此时不应该支持折叠节点\n return;\n }\n state.loadPathCancelToken.cancel();\n state.refreshCancelToken.cancel();\n this._watcher.notifyWillChangeExpansionState(this, false);\n if (this._children && this.parent) {\n // 从根节点裁剪分支\n this.shrinkBranch(this, quiet);\n }\n this.isExpanded = false;\n TreeNode.setTreeNode(this.id, this.path, this);\n this._watcher.notifyDidChangeExpansionState(this, false);\n }\n mv(to, name = this.name) {\n const prevPath = this.path;\n super.mv(to, name);\n if (typeof this.watchTerminator === 'function') {\n this.watchTerminator(prevPath);\n this.watchTerminator = this.watcher.onWatchEvent(this.path, this.handleWatchEvent);\n }\n // 同时移动过子节点\n if (this.children) {\n for (let i = 0; i < this.children.length; i++) {\n const child = this.children[i];\n child.mv(child.parent, child.name);\n }\n }\n }\n /**\n * 在节点中插入新的节点\n *\n * 直接调用此方法将不会触发onWillHandleWatchEvent和onDidHandleWatchEvent事件\n */\n insertItem(item) {\n if (item.parent !== this) {\n item.mv(this, item.name);\n return;\n }\n if (this.children) {\n for (let i = 0; i < this.children.length; i++) {\n // path / id 是节点唯一标识\n if (this.children[i].path === item.path) {\n this.children[i] = item;\n return;\n }\n }\n }\n const branchSizeIncrease = 1 + (item instanceof CompositeTreeNode && item.expanded ? item._branchSize : 0);\n if (this._children) {\n this._children.push(item);\n this._children.sort(this._tree.sortComparator || CompositeTreeNode.defaultSortComparator);\n }\n this._branchSize += branchSizeIncrease;\n let master = this;\n // 如果该节点无叶子节点,则继续往上查找合适的插入位置\n while (!master._flattenedBranch) {\n if (master.parent) {\n master = master.parent;\n master._branchSize += branchSizeIncrease;\n }\n }\n if (!this._children) {\n return;\n }\n let relativeInsertionIndex = this._children.indexOf(item);\n let absInsertionIndex;\n const leadingSibling = this._children[relativeInsertionIndex - 1];\n if (leadingSibling) {\n const siblingIdx = master._flattenedBranch.indexOf(leadingSibling.id);\n relativeInsertionIndex =\n siblingIdx +\n (leadingSibling instanceof CompositeTreeNode && leadingSibling.expanded ? leadingSibling._branchSize : 0);\n }\n else {\n relativeInsertionIndex = master._flattenedBranch.indexOf(this.id);\n }\n if (relativeInsertionIndex === -1) {\n if (this._branchSize === 1) {\n // 在空Tree中插入节点时,相对插入位置为0\n relativeInsertionIndex = 0;\n }\n }\n // 非空Tree情况下需要+1,为了容纳自身节点位置,在插入节点下方插入新增节点\n absInsertionIndex = relativeInsertionIndex + 1;\n // 空 Tree 情况下需要重置为 0,避免设置 Uint32Array 时超出范围\n if (master._flattenedBranch.length === 0) {\n absInsertionIndex = 0;\n }\n let branch = [item.id];\n if (item instanceof CompositeTreeNode && item.expanded && item._flattenedBranch) {\n branch = branch.concat(item._flattenedBranch);\n item.setFlattenedBranch(null);\n }\n master.setFlattenedBranch(spliceArray(master._flattenedBranch, absInsertionIndex, 0, branch));\n TreeNode.setTreeNode(item.id, item.path, item);\n return item;\n }\n /**\n * 从父节点中移除节点\n *\n * 直接调用此方法将不会触发onWillHandleWatchEvent和onDidHandleWatchEvent事件\n */\n unlinkItem(item, reparenting) {\n var _a;\n if (!this._children) {\n return;\n }\n const idx = this._children.indexOf(item);\n if (idx === -1) {\n return;\n }\n // 当删除时父节点已不存在界面上时,跳过插入操作\n if (!this.isItemVisibleAtRootSurface(this)) {\n return;\n }\n (_a = this._children) === null || _a === void 0 ? void 0 : _a.splice(idx, 1);\n const branchSizeDecrease = 1 + (item instanceof CompositeTreeNode && item.expanded ? item._branchSize : 0);\n this._branchSize -= branchSizeDecrease;\n // 逐级往上查找节点的父节点,并沿途裁剪分支数\n let master = this;\n while (!master._flattenedBranch) {\n if (master.parent) {\n master = master.parent;\n master._branchSize -= branchSizeDecrease;\n }\n }\n const removalBeginIdx = master._flattenedBranch.indexOf(item.id);\n if (removalBeginIdx === -1) {\n return;\n }\n if (item instanceof CompositeTreeNode && item.expanded) {\n item.setFlattenedBranch(master._flattenedBranch.slice(removalBeginIdx + 1, removalBeginIdx + branchSizeDecrease));\n }\n master.setFlattenedBranch(spliceArray(master._flattenedBranch, removalBeginIdx, branchSizeDecrease));\n if (!reparenting && item.parent === this) {\n item.mv(null);\n }\n }\n /**\n * 转换节点路径\n */\n transferItem(oldPath, newPath) {\n var _a;\n const oldP = new Path(oldPath);\n const from = oldP.dir.toString();\n if (from !== this.path) {\n return;\n }\n const name = oldP.base.toString();\n const item = (_a = this._children) === null || _a === void 0 ? void 0 : _a.find((c) => c.name === name);\n if (!item) {\n return;\n }\n const newP = new Path(newPath);\n const to = newP.dir.toString();\n const destDir = to === from ? this : TreeNode.getTreeNodeByPath(to);\n if (!CompositeTreeNode.is(destDir)) {\n this.unlinkItem(item);\n return;\n }\n item.mv(destDir, newP.base.toString());\n return item;\n }\n dispose() {\n // 如果存在对应文件路径下的监听,同样需要清理掉\n if (this.watchEvents) {\n const watcher = this.watchEvents.get(this.path);\n if (watcher) {\n watcher.terminator();\n }\n this.watchEvents.clear();\n }\n if (this._children) {\n // 移除后应该折叠,因为下次初始化默认值为折叠,否则将会导致下次插入异常\n this.isExpanded = false;\n this._children.forEach((child) => {\n child.dispose();\n });\n this._children = null;\n this._flattenedBranch = null;\n }\n super.dispose();\n }\n /**\n * 设置扁平化的分支信息\n */\n setFlattenedBranch(leaves, withoutNotify) {\n this._flattenedBranch = leaves;\n // Root节点才通知更新\n if (CompositeTreeNode.isRoot(this) && !withoutNotify) {\n this.watcher.notifyDidUpdateBranch();\n }\n }\n /**\n * 展开分支节点\n * @param branch 分支节点\n */\n expandBranch(branch, withoutNotify) {\n if (this !== branch) {\n // 但节点为展开状态时进行裁剪\n if (branch._flattenedBranch) {\n this._branchSize += branch._branchSize;\n }\n }\n // 当前节点为折叠状态,更新分支信息\n if (this !== branch && this._flattenedBranch) {\n const injectionStartIdx = this._flattenedBranch.indexOf(branch.id) + 1;\n if (injectionStartIdx === 0) {\n // 中途发生了branch更新事件,此时的_flattenedBranch可能已被更新,即查找不到branch.id\n // 这种情况在父节点发生了多路径目录的创建定位动作下更易复现\n // 例:文件树在执行a/b/c定位操作时需要请求三次数据,而更新操作可能只需要一次\n // 导致就算更新操作后置执行,也可能比定位操作先执行完,同时将_flattenedBranch更新\n // 最终导致此处查询不到对应节点,下面的shrinkBranch同样可能有相同问题,如点击折叠全部功能时\n return;\n }\n this.setFlattenedBranch(spliceArray(this._flattenedBranch, injectionStartIdx, 0, branch._flattenedBranch), withoutNotify);\n // 取消展开分支对于分支的所有权,即最终只会有顶部Root拥有所有分支信息\n branch.setFlattenedBranch(null, withoutNotify);\n }\n else if (this.parent) {\n this.parent.expandBranch(branch, withoutNotify);\n }\n }\n /**\n * 清理分支节点\n * @param branch 分支节点\n */\n shrinkBranch(branch, withoutNotify) {\n if (this !== branch) {\n // 这里的`this`实际上为父节点\n // `this`的分支大小没有改变,仍然具有相同数量的叶子,但是从父级参照系(即根节点)来看,其分支缩小了\n this._branchSize -= branch._branchSize;\n }\n if (this !== branch && this._flattenedBranch) {\n const removalStartIdx = this._flattenedBranch.indexOf(branch.id) + 1;\n if (removalStartIdx === 0) {\n // 中途发生了branch更新事件,此时的_flattenedBranch可能已被更新,即查找不到branch.id\n return;\n }\n // 返回分支对于分支信息所有权,即将折叠的节点信息再次存储于折叠了的节点中\n branch.setFlattenedBranch(this._flattenedBranch.slice(removalStartIdx, removalStartIdx + branch._branchSize), withoutNotify);\n this.setFlattenedBranch(spliceArray(this._flattenedBranch, removalStartIdx, branch._flattenedBranch ? branch._flattenedBranch.length : 0), withoutNotify);\n }\n else if (this.parent) {\n this.parent.shrinkBranch(branch, withoutNotify);\n }\n }\n /**\n * 加载子节点信息\n * 当返回值为 true 时,正常加载完子节点并同步到数据结构中\n * 返回值为 false 时,加载节点的过程被中断\n *\n * @memberof CompositeTreeNode\n */\n hardReloadChildren(token) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n let rawItems;\n const oldPath = this.path;\n try {\n // ! `this.path` maybe changed after `resolveChildren` in file tree compact mode\n rawItems = (yield this._tree.resolveChildren(this)) || [];\n }\n catch (e) {\n rawItems = [];\n }\n // 当获取到新的子节点时,如果当前节点正处于非展开状态时,忽略后续裁切逻辑\n // 后续的 expandBranch 也不应该被响应\n if (!this.expanded || (token === null || token === void 0 ? void 0 : token.isCancellationRequested)) {\n return false;\n }\n if (this.path !== oldPath) {\n // do some clean up\n TreeNode.setGlobalTreeState(oldPath, {\n isExpanding: false,\n isLoadingPath: false,\n isRefreshing: false,\n });\n }\n const expandedChilds = [];\n const flatTree = new Array(rawItems.length);\n const tempChildren = new Array(rawItems.length);\n for (let i = 0; i < rawItems.length; i++) {\n const child = rawItems[i];\n child.id = TreeNode.getIdByPath(child.path) || child.id;\n tempChildren[i] = child;\n TreeNode.setIdByPath(child.path, child.id);\n if (CompositeTreeNode.is(child) && child.expanded) {\n if (!child.children) {\n yield child.resolveChildrens(token);\n }\n if (token === null || token === void 0 ? void 0 : token.isCancellationRequested) {\n return false;\n }\n expandedChilds.push(child);\n }\n }\n tempChildren.sort(this._tree.sortComparator || CompositeTreeNode.defaultSortComparator);\n for (let i = 0; i < rawItems.length; i++) {\n flatTree[i] = tempChildren[i].id;\n }\n if (this.children) {\n this.shrinkBranch(this);\n }\n if (this.children) {\n for (let i = 0; i < this.children.length; i++) {\n const child = this.children[i];\n // The Child maybe `undefined`.\n child === null || child === void 0 ? void 0 : child.dispose();\n }\n }\n for (let i = 0; i < tempChildren.length; i++) {\n this.updateTreeNodeCache(tempChildren[i]);\n }\n this._children = tempChildren;\n this._branchSize = flatTree.length;\n this.setFlattenedBranch(flatTree);\n for (let i = 0; i < expandedChilds.length; i++) {\n const child = expandedChilds[i];\n child.expandBranch(child, true);\n }\n // 清理上一次监听函数\n if (typeof this.watchTerminator === 'function') {\n this.watchTerminator(this.path);\n }\n this.watchTerminator = this.watcher.onWatchEvent(this.path, this.handleWatchEvent);\n return true;\n });\n }\n moveNode(oldPath, newPath) {\n if (typeof oldPath !== 'string') {\n throw new TypeError('Expected oldPath to be a string');\n }\n if (typeof newPath !== 'string') {\n throw new TypeError('Expected newPath to be a string');\n }\n if (Path.isRelative(oldPath)) {\n throw new TypeError('oldPath must be absolute');\n }\n if (Path.isRelative(newPath)) {\n throw new TypeError('newPath must be absolute');\n }\n return this.transferItem(oldPath, newPath);\n }\n addNode(node) {\n if (!TreeNode.is(node)) {\n throw new TypeError('Expected node to be a TreeNode');\n }\n return this.insertItem(node);\n }\n removeNode(path) {\n const pathObject = new Path(path);\n const dirName = pathObject.dir.toString();\n const name = pathObject.base.toString();\n if (dirName === this.path && !!this.children) {\n const item = this.children.find((c) => c.name === name);\n if (item) {\n this.unlinkItem(item);\n }\n }\n }\n // 当没有传入具体路径时,使用当前展开目录作为刷新路径\n refresh(tokenSource, target) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n if (!CompositeTreeNode.isRoot(this)) {\n // 刷新操作只能从根节点进行,便于对重复的刷新操作进行合并\n return yield this.root.refresh(tokenSource, this);\n }\n const state = TreeNode.getGlobalTreeState(this.path);\n if (state.isLoadingPath || state.isExpanding) {\n return;\n }\n let token;\n if (tokenSource && !tokenSource.token.isCancellationRequested) {\n TreeNode.setGlobalTreeState(this.path, {\n isRefreshing: true,\n refreshCancelToken: tokenSource,\n });\n token = tokenSource.token;\n }\n else {\n if (state.refreshCancelToken.token.isCancellationRequested) {\n const refreshCancelToken = new ide_utils_1.CancellationTokenSource();\n TreeNode.setGlobalTreeState(this.path, {\n isRefreshing: true,\n refreshCancelToken,\n });\n token = refreshCancelToken.token;\n }\n else {\n token = state.refreshCancelToken.token;\n }\n }\n this.toRefreshPathQueue.add((target || this).path);\n yield this.refreshThrottler.trigger(() => this.doRefresh(token));\n TreeNode.setGlobalTreeState(this.path, {\n isRefreshing: false,\n });\n });\n }\n doRefresh(token) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n const target = this.getRefreshNode() || this;\n if (!CompositeTreeNode.is(target)) {\n return;\n }\n const paths = target.getAllExpandedNodePath();\n yield target.refreshTreeNodeByPaths(paths, token, target);\n });\n }\n getRefreshNode() {\n let paths = Array.from(this.toRefreshPathQueue);\n this.toRefreshPathQueue.clear();\n if (!paths.length) {\n return this.root;\n }\n // 根据路径层级深度进行排序\n paths = paths.sort((a, b) => {\n const depthA = Path.pathDepth(a);\n const depthB = Path.pathDepth(b);\n return depthA - depthB;\n });\n if (paths.length === 1 || Path.pathDepth(paths[0]) === 1) {\n // 说明刷新队列中包含根节点,直接返回根节点进行刷新\n return TreeNode.getTreeNodeByPath(paths[0]);\n }\n const sortedPaths = paths.map((p) => new Path(p));\n let rootPath = sortedPaths[0];\n for (let i = 1, len = sortedPaths.length; i < len; i++) {\n if (rootPath.isEqualOrParent(sortedPaths[i])) {\n continue;\n }\n else {\n while (!rootPath.isRoot) {\n rootPath = rootPath.dir;\n if (!rootPath || rootPath.isEqualOrParent(sortedPaths[i])) {\n break;\n }\n }\n }\n }\n if (rootPath) {\n return TreeNode.getTreeNodeByPath(rootPath.toString());\n }\n return this.root;\n }\n isItemVisibleAtRootSurface(node) {\n let parent = node;\n while (parent.parent) {\n parent = parent.parent;\n }\n return parent.isItemVisibleAtSurface(node);\n }\n /**\n * 检查节点是否可见,而不是被隐藏在节点中\n *\n * 这里的可见并不表示节点在当前视图中可见,而是在用户滚动到特定位置便可看见\n *\n * 隐藏在节点中可能的原因为其父节点中有一个以上处于折叠状态\n */\n isItemVisibleAtSurface(item) {\n if (item === this) {\n return true;\n }\n return !!this._flattenedBranch && this._flattenedBranch.indexOf(item.id) > -1;\n }\n transformToRelativePath(path) {\n const { splitPath } = Path;\n const pathFlag = splitPath(path);\n pathFlag.shift();\n return pathFlag;\n }\n /**\n * 根据路径展开节点树\n * @memberof CompositeTreeNode\n */\n loadTreeNodeByPath(path_1) {\n return tslib_1.__awaiter(this, arguments, void 0, function* (path, quiet = false) {\n if (!CompositeTreeNode.isRoot(this)) {\n return;\n }\n const state = TreeNode.getGlobalTreeState(this.path);\n if (state.isExpanding) {\n return;\n }\n state.refreshCancelToken.cancel();\n state.loadPathCancelToken.cancel();\n const loadPathCancelToken = new ide_utils_1.CancellationTokenSource();\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: true,\n loadPathCancelToken,\n });\n const token = loadPathCancelToken.token;\n const flattenedBranchChilds = [];\n const { splitPath, isRelative } = Path;\n const pathFlag = isRelative(path) ? splitPath(path) : this.transformToRelativePath(path);\n if (pathFlag.length === 0) {\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n return this;\n }\n if (!this.children) {\n yield this.ensureLoaded(token);\n }\n if (token.isCancellationRequested) {\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n return;\n }\n let next = this._children;\n let preItem;\n let preItemPath = '';\n let name;\n while (next && (name = pathFlag.shift())) {\n let item = next.find((c) => c.name.indexOf(name) === 0);\n if (item) {\n if (CompositeTreeNode.is(item)) {\n item._watcher.notifyWillChangeExpansionState(item, true);\n item.isExpanded = true;\n if (!item.children) {\n yield item.resolveChildrens(token);\n if (token.isCancellationRequested) {\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n return;\n }\n }\n flattenedBranchChilds.push(item);\n item._watcher.notifyDidChangeExpansionState(item, true);\n }\n if (pathFlag.length === 0) {\n preItem = item;\n break;\n }\n }\n // 可能展开后路径发生了变化, 需要重新处理一下当前加载路径\n if (!item && preItem) {\n const compactPath = splitPath(preItem.name).slice(1);\n if (compactPath[0] === name) {\n compactPath.shift();\n while (compactPath.length > 0) {\n if (compactPath[0] === pathFlag[0]) {\n compactPath.shift();\n pathFlag.shift();\n }\n else {\n break;\n }\n }\n name = pathFlag.shift();\n item = next.find((c) => c.name.indexOf(name) === 0);\n }\n }\n // 最终加载到的路径节点\n if (!item || (!CompositeTreeNode.is(item) && pathFlag.length > 0)) {\n break;\n }\n if (CompositeTreeNode.is(item)) {\n const isCompactName = item.name.indexOf(Path.separator) > 0;\n if (isCompactName) {\n const compactPath = splitPath(item.name).slice(1);\n while (compactPath.length > 0) {\n if (compactPath[0] === pathFlag[0]) {\n compactPath.shift();\n pathFlag.shift();\n }\n else {\n break;\n }\n }\n }\n if (!item._children) {\n preItemPath = item.path;\n if (CompositeTreeNode.is(item)) {\n item.isExpanded = true;\n if (!item.children) {\n yield item.resolveChildrens(token);\n if (token.isCancellationRequested) {\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n return;\n }\n }\n flattenedBranchChilds.push(item);\n }\n }\n if (item && pathFlag.length === 0) {\n preItem = item;\n break;\n }\n else {\n if (!!preItemPath && preItemPath !== item.path) {\n // 说明此时已发生了路径压缩,如从 a -> a/b/c\n // 需要根据路径变化移除对应的展开路径, 这里只需考虑短变长场景\n const prePaths = splitPath(preItemPath);\n const nextPaths = splitPath(item.path);\n if (nextPaths.length > prePaths.length) {\n pathFlag.splice(0, nextPaths.length - prePaths.length);\n }\n }\n next = item._children;\n preItem = item;\n }\n }\n }\n if (preItem) {\n let child;\n if (preItem.disposed) {\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n return;\n }\n while ((child = flattenedBranchChilds.pop())) {\n child.expandBranch(child, true);\n if (flattenedBranchChilds.length === 0) {\n this.updateTreeNodeCache(child);\n }\n }\n if (!quiet) {\n this.watcher.notifyDidUpdateBranch();\n }\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n return preItem;\n }\n TreeNode.setGlobalTreeState(this.path, {\n isLoadingPath: false,\n });\n });\n }\n /**\n * 根据节点获取节点ID下标位置\n * @param {number} id\n * @returns\n * @memberof CompositeTreeNode\n */\n getIndexAtTreeNodeId(id) {\n if (this._flattenedBranch) {\n return this._flattenedBranch.indexOf(id);\n }\n return -1;\n }\n /**\n * 根据节点获取节点下标位置\n * @param {ITreeNodeOrCompositeTreeNode} node\n * @returns\n * @memberof CompositeTreeNode\n */\n getIndexAtTreeNode(node) {\n if (this._flattenedBranch) {\n return this._flattenedBranch.indexOf(node.id);\n }\n return -1;\n }\n /**\n * 根据下标位置获取节点\n * @param {number} index\n * @returns\n * @memberof CompositeTreeNode\n */\n getTreeNodeAtIndex(index) {\n var _a;\n const id = (_a = this._flattenedBranch) === null || _a === void 0 ? void 0 : _a[index];\n if (!id) {\n return undefined;\n }\n return TreeNode.getTreeNodeById(id);\n }\n /**\n * 根据节点ID获取节点\n * @param {number} id\n * @returns\n * @memberof CompositeTreeNode\n */\n getTreeNodeById(id) {\n return TreeNode.getTreeNodeById(id);\n }\n /**\n * 根据节点路径获取节点\n * @param {string} path\n * @returns\n * @memberof CompositeTreeNode\n */\n getTreeNodeByPath(path) {\n return TreeNode.getTreeNodeByPath(path);\n }\n}\nexports.CompositeTreeNode = CompositeTreeNode;\nCompositeTreeNode.REFRESH_DELAY = 200;\n\n\n//# sourceURL=webpack://@opensumi/ide-components/./src/recycle-tree/tree/TreeNode.ts?");
|
|
6302
6302
|
|
|
6303
6303
|
/***/ }),
|
|
6304
6304
|
|
|
@@ -42,7 +42,6 @@ export declare const defaultIconMap: {
|
|
|
42
42
|
'cloud-download': string;
|
|
43
43
|
'cloud-server': string;
|
|
44
44
|
code: string;
|
|
45
|
-
codebraces: string;
|
|
46
45
|
'collapse-all': string;
|
|
47
46
|
commit: string;
|
|
48
47
|
'content-search': string;
|
|
@@ -80,7 +79,6 @@ export declare const defaultIconMap: {
|
|
|
80
79
|
extension: string;
|
|
81
80
|
eye: string;
|
|
82
81
|
'eye-close': string;
|
|
83
|
-
file: string;
|
|
84
82
|
'file-copy': string;
|
|
85
83
|
'file-default': string;
|
|
86
84
|
'file-exclamation': string;
|
|
@@ -116,7 +114,6 @@ export declare const defaultIconMap: {
|
|
|
116
114
|
loading: string;
|
|
117
115
|
'magic-wand': string;
|
|
118
116
|
max: string;
|
|
119
|
-
mcp: string;
|
|
120
117
|
'menubar-dashboard-back': string;
|
|
121
118
|
'menubar-edit': string;
|
|
122
119
|
'menubar-file': string;
|
|
@@ -165,7 +162,7 @@ export declare const defaultIconMap: {
|
|
|
165
162
|
scm: string;
|
|
166
163
|
search: string;
|
|
167
164
|
send: string;
|
|
168
|
-
'send-
|
|
165
|
+
'send-hollow': string;
|
|
169
166
|
'send-solid': string;
|
|
170
167
|
setting: string;
|
|
171
168
|
sever: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iconManager.d.ts","sourceRoot":"","sources":["../../../src/icon/iconfont/iconManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,CAAC;AA0B3B,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"iconManager.d.ts","sourceRoot":"","sources":["../../../src/icon/iconfont/iconManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,CAAC;AA0B3B,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMzB,CAAC;AAEH,cAAM,WAAW;IACf,OAAO,CAAC,eAAe,CAAgB;IAEvC,OAAO,CAAC,QAAQ,CAA+D;IAE/E,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE;IAKnE,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;CAiBtC;AAED,eAAO,MAAM,WAAW,aAAoB,CAAC"}
|
|
@@ -40,7 +40,6 @@ export declare const defaultIconfont: {
|
|
|
40
40
|
'cloud-download': string;
|
|
41
41
|
'cloud-server': string;
|
|
42
42
|
code: string;
|
|
43
|
-
codebraces: string;
|
|
44
43
|
'collapse-all': string;
|
|
45
44
|
commit: string;
|
|
46
45
|
'content-search': string;
|
|
@@ -78,7 +77,6 @@ export declare const defaultIconfont: {
|
|
|
78
77
|
extension: string;
|
|
79
78
|
eye: string;
|
|
80
79
|
'eye-close': string;
|
|
81
|
-
file: string;
|
|
82
80
|
'file-copy': string;
|
|
83
81
|
'file-default': string;
|
|
84
82
|
'file-exclamation': string;
|
|
@@ -114,7 +112,6 @@ export declare const defaultIconfont: {
|
|
|
114
112
|
loading: string;
|
|
115
113
|
'magic-wand': string;
|
|
116
114
|
max: string;
|
|
117
|
-
mcp: string;
|
|
118
115
|
'menubar-dashboard-back': string;
|
|
119
116
|
'menubar-edit': string;
|
|
120
117
|
'menubar-file': string;
|
|
@@ -163,7 +160,7 @@ export declare const defaultIconfont: {
|
|
|
163
160
|
scm: string;
|
|
164
161
|
search: string;
|
|
165
162
|
send: string;
|
|
166
|
-
'send-
|
|
163
|
+
'send-hollow': string;
|
|
167
164
|
'send-solid': string;
|
|
168
165
|
setting: string;
|
|
169
166
|
sever: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iconMap.d.ts","sourceRoot":"","sources":["../../../src/icon/iconfont/iconMap.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"iconMap.d.ts","sourceRoot":"","sources":["../../../src/icon/iconfont/iconMap.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwM3B,CAAC"}
|
|
@@ -45,7 +45,6 @@ exports.defaultIconfont = {
|
|
|
45
45
|
'cloud-download': 'cloud-download',
|
|
46
46
|
'cloud-server': 'cloud-server',
|
|
47
47
|
'code': 'code',
|
|
48
|
-
'codebraces': 'codebraces',
|
|
49
48
|
'collapse-all': 'collapse-all',
|
|
50
49
|
'commit': 'commit',
|
|
51
50
|
'content-search': 'content-search',
|
|
@@ -83,7 +82,6 @@ exports.defaultIconfont = {
|
|
|
83
82
|
'extension': 'extension',
|
|
84
83
|
'eye': 'eye',
|
|
85
84
|
'eye-close': 'eye-close',
|
|
86
|
-
'file': 'file',
|
|
87
85
|
'file-copy': 'file-copy',
|
|
88
86
|
'file-default': 'file-default',
|
|
89
87
|
'file-exclamation': 'file-exclamation',
|
|
@@ -119,7 +117,6 @@ exports.defaultIconfont = {
|
|
|
119
117
|
'loading': 'loading',
|
|
120
118
|
'magic-wand': 'magic-wand',
|
|
121
119
|
'max': 'max',
|
|
122
|
-
'mcp': 'mcp',
|
|
123
120
|
'menubar-dashboard-back': 'menubar-dashboard-back',
|
|
124
121
|
'menubar-edit': 'menubar-edit',
|
|
125
122
|
'menubar-file': 'menubar-file',
|
|
@@ -168,7 +165,7 @@ exports.defaultIconfont = {
|
|
|
168
165
|
'scm': 'scm',
|
|
169
166
|
'search': 'search',
|
|
170
167
|
'send': 'send',
|
|
171
|
-
'send-
|
|
168
|
+
'send-hollow': 'send-hollow',
|
|
172
169
|
'send-solid': 'send-solid',
|
|
173
170
|
'setting': 'setting',
|
|
174
171
|
'sever': 'sever',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iconMap.js","sourceRoot":"","sources":["../../../src/icon/iconfont/iconMap.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAC7C,2BAA2B;AACd,QAAA,eAAe,GAAG;IAC7B,aAAa,EAAE,aAAa;IAC5B,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,KAAK;IACZ,sBAAsB,EAAE,sBAAsB;IAC9C,cAAc,EAAE,cAAc;IAC9B,QAAQ,EAAE,QAAQ;IAClB,YAAY,EAAE,YAAY;IAC1B,aAAa,EAAE,aAAa;IAC5B,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;IACxB,YAAY,EAAE,YAAY;IAC1B,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,UAAU;IACtB,qBAAqB,EAAE,qBAAqB;IAC5C,uBAAuB,EAAE,uBAAuB;IAChD,qBAAqB,EAAE,qBAAqB;IAC5C,oBAAoB,EAAE,oBAAoB;IAC1C,iBAAiB,EAAE,iBAAiB;IACpC,wBAAwB,EAAE,wBAAwB;IAClD,MAAM,EAAE,MAAM;IACd,iBAAiB,EAAE,iBAAiB;IACpC,aAAa,EAAE,aAAa;IAC5B,OAAO,EAAE,OAAO;IAChB,mBAAmB,EAAE,mBAAmB;IACxC,sBAAsB,EAAE,sBAAsB;IAC9C,gBAAgB,EAAE,gBAAgB;IAClC,cAAc,EAAE,cAAc;IAC9B,OAAO,EAAE,OAAO;IAChB,YAAY,EAAE,YAAY;IAC1B,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,WAAW;IACxB,cAAc,EAAE,cAAc;IAC9B,mBAAmB,EAAE,mBAAmB;IACxC,QAAQ,EAAE,QAAQ;IAClB,cAAc,EAAE,cAAc;IAC9B,gBAAgB,EAAE,gBAAgB;IAClC,cAAc,EAAE,cAAc;IAC9B,MAAM,EAAE,MAAM;IACd,
|
|
1
|
+
{"version":3,"file":"iconMap.js","sourceRoot":"","sources":["../../../src/icon/iconfont/iconMap.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAC7C,2BAA2B;AACd,QAAA,eAAe,GAAG;IAC7B,aAAa,EAAE,aAAa;IAC5B,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,KAAK;IACZ,sBAAsB,EAAE,sBAAsB;IAC9C,cAAc,EAAE,cAAc;IAC9B,QAAQ,EAAE,QAAQ;IAClB,YAAY,EAAE,YAAY;IAC1B,aAAa,EAAE,aAAa;IAC5B,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;IACxB,YAAY,EAAE,YAAY;IAC1B,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,UAAU;IACtB,qBAAqB,EAAE,qBAAqB;IAC5C,uBAAuB,EAAE,uBAAuB;IAChD,qBAAqB,EAAE,qBAAqB;IAC5C,oBAAoB,EAAE,oBAAoB;IAC1C,iBAAiB,EAAE,iBAAiB;IACpC,wBAAwB,EAAE,wBAAwB;IAClD,MAAM,EAAE,MAAM;IACd,iBAAiB,EAAE,iBAAiB;IACpC,aAAa,EAAE,aAAa;IAC5B,OAAO,EAAE,OAAO;IAChB,mBAAmB,EAAE,mBAAmB;IACxC,sBAAsB,EAAE,sBAAsB;IAC9C,gBAAgB,EAAE,gBAAgB;IAClC,cAAc,EAAE,cAAc;IAC9B,OAAO,EAAE,OAAO;IAChB,YAAY,EAAE,YAAY;IAC1B,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,WAAW;IACxB,cAAc,EAAE,cAAc;IAC9B,mBAAmB,EAAE,mBAAmB;IACxC,QAAQ,EAAE,QAAQ;IAClB,cAAc,EAAE,cAAc;IAC9B,gBAAgB,EAAE,gBAAgB;IAClC,cAAc,EAAE,cAAc;IAC9B,MAAM,EAAE,MAAM;IACd,cAAc,EAAE,cAAc;IAC9B,QAAQ,EAAE,QAAQ;IAClB,gBAAgB,EAAE,gBAAgB;IAClC,UAAU,EAAE,UAAU;IACtB,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,MAAM;IACd,oBAAoB,EAAE,oBAAoB;IAC1C,wBAAwB,EAAE,wBAAwB;IAClD,OAAO,EAAE,OAAO;IAChB,iBAAiB,EAAE,iBAAiB;IACpC,qBAAqB,EAAE,qBAAqB;IAC5C,mBAAmB,EAAE,mBAAmB;IACxC,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,YAAY;IAC1B,WAAW,EAAE,WAAW;IACxB,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,aAAa,EAAE,aAAa;IAC5B,MAAM,EAAE,MAAM;IACd,YAAY,EAAE,YAAY;IAC1B,UAAU,EAAE,UAAU;IACtB,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,UAAU;IACtB,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,QAAQ;IAClB,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,UAAU,EAAE,UAAU;IACtB,WAAW,EAAE,WAAW;IACxB,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;IACxB,cAAc,EAAE,cAAc;IAC9B,kBAAkB,EAAE,kBAAkB;IACtC,WAAW,EAAE,WAAW;IACxB,QAAQ,EAAE,QAAQ;IAClB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,QAAQ;IAClB,gBAAgB,EAAE,gBAAgB;IAClC,eAAe,EAAE,eAAe;IAChC,aAAa,EAAE,aAAa;IAC5B,YAAY,EAAE,YAAY;IAC1B,iBAAiB,EAAE,iBAAiB;IACpC,KAAK,EAAE,KAAK;IACZ,aAAa,EAAE,aAAa;IAC5B,QAAQ,EAAE,QAAQ;IAClB,eAAe,EAAE,eAAe;IAChC,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,KAAK;IACZ,aAAa,EAAE,aAAa;IAC5B,kBAAkB,EAAE,kBAAkB;IACtC,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,UAAU;IACtB,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,MAAM;IACd,gBAAgB,EAAE,gBAAgB;IAClC,eAAe,EAAE,eAAe;IAChC,qBAAqB,EAAE,qBAAqB;IAC5C,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,YAAY;IAC1B,KAAK,EAAE,KAAK;IACZ,wBAAwB,EAAE,wBAAwB;IAClD,cAAc,EAAE,cAAc;IAC9B,cAAc,EAAE,cAAc;IAC9B,YAAY,EAAE,YAAY;IAC1B,mBAAmB,EAAE,mBAAmB;IACxC,iBAAiB,EAAE,iBAAiB;IACpC,cAAc,EAAE,cAAc;IAC9B,cAAc,EAAE,cAAc;IAC9B,mBAAmB,EAAE,mBAAmB;IACxC,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,QAAQ;IAClB,cAAc,EAAE,cAAc;IAC9B,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,UAAU;IACtB,YAAY,EAAE,YAAY;IAC1B,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,cAAc,EAAE,cAAc;IAC9B,UAAU,EAAE,UAAU;IACtB,UAAU,EAAE,UAAU;IACtB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,UAAU;IACtB,MAAM,EAAE,MAAM;IACd,qBAAqB,EAAE,qBAAqB;IAC5C,QAAQ,EAAE,QAAQ;IAClB,iBAAiB,EAAE,iBAAiB;IACpC,mBAAmB,EAAE,mBAAmB;IACxC,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,YAAY;IAC1B,WAAW,EAAE,WAAW;IACxB,QAAQ,EAAE,QAAQ;IAClB,cAAc,EAAE,cAAc;IAC9B,OAAO,EAAE,OAAO;IAChB,aAAa,EAAE,aAAa;IAC5B,UAAU,EAAE,UAAU;IACtB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,UAAU;IACtB,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,MAAM;IACd,aAAa,EAAE,aAAa;IAC5B,YAAY,EAAE,YAAY;IAC1B,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,QAAQ;IAClB,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,UAAU;IACtB,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,UAAU;IACtB,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;IAClB,aAAa,EAAE,aAAa;IAC5B,YAAY,EAAE,YAAY;IAC1B,iBAAiB,EAAE,iBAAiB;IACpC,aAAa,EAAE,aAAa;IAC5B,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;IAClB,cAAc,EAAE,cAAc;IAC9B,OAAO,EAAE,OAAO;IAChB,eAAe,EAAE,eAAe;IAChC,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,IAAI;IACV,kBAAkB,EAAE,kBAAkB;IACtC,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,MAAM;IACd,gBAAgB,EAAE,gBAAgB;IAClC,QAAQ,EAAE,QAAQ;IAClB,cAAc,EAAE,cAAc;IAC9B,iBAAiB,EAAE,iBAAiB;IACpC,KAAK,EAAE,KAAK;CACb,CAAC"}
|