react-terminal-viewer-cicd 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +181 -0
  2. package/dist/esm/Addon/EventEmiter.d.ts +18 -0
  3. package/dist/esm/Addon/EventEmiter.js +64 -0
  4. package/dist/esm/Addon/HighlightAddon.d.ts +26 -0
  5. package/dist/esm/Addon/HighlightAddon.js +188 -0
  6. package/dist/esm/Addon/SearchAddon.d.ts +140 -0
  7. package/dist/esm/Addon/SearchAddon.js +797 -0
  8. package/dist/esm/Addon/WorkerLog/GlobalContext.d.ts +10 -0
  9. package/dist/esm/Addon/WorkerLog/GlobalContext.js +37 -0
  10. package/dist/esm/Addon/WorkerLog/LimitMap.d.ts +14 -0
  11. package/dist/esm/Addon/WorkerLog/LimitMap.js +54 -0
  12. package/dist/esm/Addon/WorkerLog/LogWorker.d.ts +2 -0
  13. package/dist/esm/Addon/WorkerLog/LogWorker.js +13 -0
  14. package/dist/esm/Addon/WorkerLog/Logs.d.ts +21 -0
  15. package/dist/esm/Addon/WorkerLog/Logs.js +60 -0
  16. package/dist/esm/Addon/WorkerLog/Mark.d.ts +36 -0
  17. package/dist/esm/Addon/WorkerLog/Mark.js +155 -0
  18. package/dist/esm/Addon/WorkerLog/Searcher.d.ts +16 -0
  19. package/dist/esm/Addon/WorkerLog/Searcher.js +88 -0
  20. package/dist/esm/Addon/WorkerLog/WebWokerServer.d.ts +10 -0
  21. package/dist/esm/Addon/WorkerLog/WebWokerServer.js +57 -0
  22. package/dist/esm/Addon/WorkerLog/WebWorkerClient.d.ts +13 -0
  23. package/dist/esm/Addon/WorkerLog/WebWorkerClient.js +83 -0
  24. package/dist/esm/Addon/WorkerLog/log.worker.d.ts +1 -0
  25. package/dist/esm/Addon/WorkerLog/log.worker.js +63 -0
  26. package/dist/esm/Addon/WorkerLog/types.d.ts +18 -0
  27. package/dist/esm/Addon/WorkerLog/types.js +1 -0
  28. package/dist/esm/Addon/useAddon.d.ts +9 -0
  29. package/dist/esm/Addon/useAddon.js +33 -0
  30. package/dist/esm/Hooks/useBatchProcess.d.ts +2 -0
  31. package/dist/esm/Hooks/useBatchProcess.js +47 -0
  32. package/dist/esm/Hooks/useCache.d.ts +31 -0
  33. package/dist/esm/Hooks/useCache.js +206 -0
  34. package/dist/esm/Hooks/useDebounceInput.d.ts +3 -0
  35. package/dist/esm/Hooks/useDebounceInput.js +26 -0
  36. package/dist/esm/Hooks/useLocalStore.d.ts +2 -0
  37. package/dist/esm/Hooks/useLocalStore.js +9 -0
  38. package/dist/esm/Hooks/useRemote.d.ts +30 -0
  39. package/dist/esm/Hooks/useRemote.js +398 -0
  40. package/dist/esm/Hooks/useThrottle.d.ts +2 -0
  41. package/dist/esm/Hooks/useThrottle.js +13 -0
  42. package/dist/esm/Hooks/useWorkerLogs.d.ts +9 -0
  43. package/dist/esm/Hooks/useWorkerLogs.js +162 -0
  44. package/dist/esm/TerminalViewer/index.d.ts +185 -0
  45. package/dist/esm/TerminalViewer/index.js +292 -0
  46. package/dist/esm/TerminalViewer/index.less +17 -0
  47. package/dist/esm/TerminalViewerBody/index.d.ts +87 -0
  48. package/dist/esm/TerminalViewerBody/index.js +248 -0
  49. package/dist/esm/TerminalViewerBody/index.less +51 -0
  50. package/dist/esm/TerminalViewerHeader/index.d.ts +88 -0
  51. package/dist/esm/TerminalViewerHeader/index.js +129 -0
  52. package/dist/esm/TerminalViewerHeader/index.less +143 -0
  53. package/dist/esm/TerminalViewerToolBar/index.d.ts +46 -0
  54. package/dist/esm/TerminalViewerToolBar/index.js +28 -0
  55. package/dist/esm/TerminalViewerToolBar/index.less +32 -0
  56. package/dist/esm/TerminalViewerVirtualDom/index.d.ts +71 -0
  57. package/dist/esm/TerminalViewerVirtualDom/index.js +309 -0
  58. package/dist/esm/TerminalViewerVirtualDom/index.less +68 -0
  59. package/dist/esm/index.d.ts +9 -0
  60. package/dist/esm/index.js +9 -0
  61. package/dist/esm/mock/index.d.ts +12 -0
  62. package/dist/esm/mock/index.js +98 -0
  63. package/dist/esm/types.d.ts +30 -0
  64. package/dist/esm/types.js +1 -0
  65. package/dist/worker/Addon/EventEmiter.d.ts +18 -0
  66. package/dist/worker/Addon/HighlightAddon.d.ts +26 -0
  67. package/dist/worker/Addon/SearchAddon.d.ts +140 -0
  68. package/dist/worker/Addon/WorkerLog/GlobalContext.d.ts +10 -0
  69. package/dist/worker/Addon/WorkerLog/LimitMap.d.ts +14 -0
  70. package/dist/worker/Addon/WorkerLog/LogWorker.d.ts +2 -0
  71. package/dist/worker/Addon/WorkerLog/Logs.d.ts +21 -0
  72. package/dist/worker/Addon/WorkerLog/Mark.d.ts +36 -0
  73. package/dist/worker/Addon/WorkerLog/Searcher.d.ts +16 -0
  74. package/dist/worker/Addon/WorkerLog/WebWokerServer.d.ts +10 -0
  75. package/dist/worker/Addon/WorkerLog/WebWorkerClient.d.ts +13 -0
  76. package/dist/worker/Addon/WorkerLog/log.worker.d.ts +1 -0
  77. package/dist/worker/Addon/WorkerLog/types.d.ts +18 -0
  78. package/dist/worker/Addon/useAddon.d.ts +9 -0
  79. package/dist/worker/Hooks/useBatchProcess.d.ts +2 -0
  80. package/dist/worker/Hooks/useCache.d.ts +31 -0
  81. package/dist/worker/Hooks/useDebounceInput.d.ts +3 -0
  82. package/dist/worker/Hooks/useLocalStore.d.ts +2 -0
  83. package/dist/worker/Hooks/useRemote.d.ts +30 -0
  84. package/dist/worker/Hooks/useRemote.test.d.ts +1 -0
  85. package/dist/worker/Hooks/useThrottle.d.ts +2 -0
  86. package/dist/worker/Hooks/useWorkerLogs.d.ts +9 -0
  87. package/dist/worker/TerminalViewer/index.d.ts +185 -0
  88. package/dist/worker/TerminalViewer/index.test.d.ts +1 -0
  89. package/dist/worker/TerminalViewerBody/index.d.ts +87 -0
  90. package/dist/worker/TerminalViewerBody/index.test.d.ts +1 -0
  91. package/dist/worker/TerminalViewerHeader/index.d.ts +88 -0
  92. package/dist/worker/TerminalViewerToolBar/index.d.ts +46 -0
  93. package/dist/worker/TerminalViewerVirtualDom/index.d.ts +71 -0
  94. package/dist/worker/index.d.ts +9 -0
  95. package/dist/worker/log.worker.js +2 -0
  96. package/dist/worker/log.worker.js.map +1 -0
  97. package/dist/worker/mock/index.d.ts +12 -0
  98. package/dist/worker/types.d.ts +30 -0
  99. package/package.json +97 -0
@@ -0,0 +1,185 @@
1
+ import React from 'react';
2
+ import { ITerminalOptions } from 'xterm';
3
+ import type { ISearchOptions } from '../Addon/SearchAddon';
4
+ import type { IRemoteOptions } from '../Hooks/useRemote';
5
+ import type { ICacheOptions } from '../Hooks/useCache';
6
+ import type { IHighlightOptions } from '../Addon/HighlightAddon';
7
+ import { ExtraOptions, TerminalRef, LogAfterProps } from '../types';
8
+ import './index.less';
9
+ export interface TerminalViewerProps {
10
+ /**
11
+ * @description.zh-CN 指定 TerminalViewer 挂载的节点,并在容器内展现,false 为挂载在当前位置
12
+ * @default 当前位置
13
+ */
14
+ ref?: TerminalRef;
15
+ /**
16
+ * @description.zh-CN 是否自动拉伸填充容器宽高
17
+ * @default true
18
+ */
19
+ fit?: boolean;
20
+ /**
21
+ *@description.zh-CN 是否开启自动滚动到底部
22
+ *@default true
23
+ */
24
+ autoScroll?: boolean;
25
+ /**
26
+ * @description.zh-CN 自动滚动到某一行,开启后自动滚动到底部失效
27
+ */
28
+ scrollToRow?: number;
29
+ /**
30
+ * @description.zh-CN 是否支持刷新
31
+ * @default true
32
+ */
33
+ refreshable?: boolean;
34
+ /**
35
+ * @description.zh-CN 搜索框 placeholder
36
+ */
37
+ searchPlaceholder?: string;
38
+ /**
39
+ * @description.zh-CN 默认全屏显示
40
+ * @default false
41
+ */
42
+ defaultFullScreen?: boolean;
43
+ /**
44
+ * @description.zh-CN 自定义日志头部, null 为不显示默认头部
45
+ */
46
+ header?: React.ReactNode;
47
+ /**
48
+ * @description.zh-CN 搜索框前的内容
49
+ */
50
+ inputAddonBefore?: React.ReactNode;
51
+ /**
52
+ * @description.zh-CN 搜索框后的内容
53
+ */
54
+ inputAddonAfter?: React.ReactNode;
55
+ /**
56
+ * @description.zh-CN toolbar 自定义工具栏
57
+ */
58
+ toolbar?: React.ReactNode;
59
+ /**
60
+ * @description.zh-CN 是否显示全屏图标
61
+ * @default true
62
+ */
63
+ showFullScreen?: boolean;
64
+ /**
65
+ * @description.zh-CN 自定义空文本显示
66
+ */
67
+ empty?: React.ReactNode;
68
+ /**
69
+ * @description.zh-CN 外层样式类名
70
+ */
71
+ className?: string;
72
+ /**
73
+ * @description.zh-CN 可用于设置外层容器样式
74
+ */
75
+ style?: object;
76
+ /**
77
+ * @description.zh-CN 用于渲染日志的默认数据,如 "echo 1\r\necho2"
78
+ * @default ''
79
+ */
80
+ defaultData?: string;
81
+ /**
82
+ * @description.zh-CN 默认打开的标签
83
+ * @default 0
84
+ */
85
+ defaultTabIndex?: number;
86
+ /**
87
+ * @description.zh-CN 激活的标签, 如果同时设置了 defaultTabIndex 则以此属性为准
88
+ * @default 0
89
+ */
90
+ activeTabIndex?: number;
91
+ /**
92
+ * @description.zh-CN 设置日志后置标签,仅在开启虚拟 DOM 生效
93
+ */
94
+ logAfter?: React.FunctionComponent<LogAfterProps> | React.ComponentClass<LogAfterProps>;
95
+ /**
96
+ * @description.zh-CN 多标签配置选项
97
+ */
98
+ tabs?: {
99
+ key: string | number;
100
+ title?: React.ReactNode;
101
+ defaultData?: string;
102
+ remoteOptions?: IRemoteOptions;
103
+ cacheOptions?: ICacheOptions;
104
+ }[];
105
+ /**
106
+ *@description.zh-CN 自定义图标
107
+ */
108
+ icons?: {
109
+ search?: React.ReactNode;
110
+ up?: React.ReactNode;
111
+ down?: React.ReactNode;
112
+ clear?: React.ReactNode;
113
+ top?: React.ReactNode;
114
+ bottom?: React.ReactNode;
115
+ fullScreen?: React.ReactNode;
116
+ fullScreenExit?: React.ReactNode;
117
+ refresh?: React.ReactNode;
118
+ loading?: React.ReactNode;
119
+ };
120
+ /**
121
+ * @description.zh-CN 是否支持渲染超链接
122
+ * @default true
123
+ */
124
+ webLinksSupport?: boolean;
125
+ /**
126
+ * @description.zh-CN 是否使用 canvas 渲染, 开启 canvas 会有更好的性能但可能会遇到更多的问题
127
+ * @default false
128
+ */
129
+ canvasSupport?: boolean;
130
+ /**
131
+ * @description.zh-CN 是否使用自研虚拟 DOM 内核,开启后 terminalOptions, canvasSupport, webLinksSupport 不可用
132
+ * @default false
133
+ */
134
+ virtualDomSupport?: boolean;
135
+ /**
136
+ * @description.zh-CN 日志 web worker 路径, 需配合 CopyPlugin 使用且仅在开启 virtualDomSupport 为 true 时有效
137
+
138
+ * @default "/worker"
139
+ */
140
+ workerPath?: string;
141
+ /**
142
+ * @description.zh-CN 远程加载配置
143
+ *
144
+ */
145
+ remoteOptions?: IRemoteOptions;
146
+ /**
147
+ * @description.zh-CN 缓存全局配置,仅在配置远程加载后有效,如 `expires: 60 * 1000` 表示自动清理已过期一分钟的缓存
148
+ */
149
+ cacheOptions?: ICacheOptions;
150
+ /**
151
+ * @description.zh-CN xterm 搜索选项
152
+ */
153
+ searchOptions?: ISearchOptions;
154
+ /**
155
+ * @description.zh-CN 高亮选项
156
+ */
157
+ highlightOptions?: IHighlightOptions[];
158
+ /**
159
+ * @description.zh-CN xtem.js 配置, https://github.com/xtermjs/xterm.js
160
+ */
161
+ terminalOptions?: ITerminalOptions;
162
+ /**
163
+ * @description.zh-CN 额外的功能选项 { showLineNumber 仅 虚拟 DOM 模式支持}
164
+ */
165
+ extraOptions?: ExtraOptions;
166
+ /**
167
+ * @description.zh-CN 指定 TerminalViewer 挂载的节点,并在容器内展现,开启全屏后无效, false 为挂载在当前位置
168
+ * @default 当前节点
169
+ */
170
+ getContainer?: string | HTMLElement | (() => HTMLElement | null);
171
+ /**
172
+ * @description.zh-CN 点击 tab 标题后回调函数
173
+ */
174
+ onTitleChange?: (index: number) => void;
175
+ /**
176
+ * @description.zh-CN 加载状态变更回调函数
177
+ */
178
+ onLoading?: (bool: boolean) => void;
179
+ /**
180
+ * @description.zh-CN 刷新后的回调函数
181
+ */
182
+ onRefresh?: () => void;
183
+ }
184
+ declare const TerminalViewer: React.ForwardRefExoticComponent<Omit<TerminalViewerProps, "ref"> & React.RefAttributes<TerminalRef | undefined>>;
185
+ export default TerminalViewer;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import { Terminal, ITerminalOptions } from 'xterm';
3
+ import 'xterm/css/xterm.css';
4
+ import { FitAddon } from 'xterm-addon-fit';
5
+ import { WebLinksAddon } from 'xterm-addon-web-links';
6
+ import { CanvasAddon } from 'xterm-addon-canvas';
7
+ import { SearchAddon } from '../Addon/SearchAddon';
8
+ import { HighlightAddon } from '../Addon/HighlightAddon';
9
+ import type { AddonType } from '../Addon/useAddon';
10
+ import type { IRemoteOptions } from '../Hooks/useRemote';
11
+ import type { ICacheOptions } from '../Hooks/useCache';
12
+ import type { IHighlightOptions } from '../Addon/HighlightAddon';
13
+ import { TerminalRef } from '../types';
14
+ import './index.less';
15
+ export interface TerminalExposedRef {
16
+ terminal?: Terminal | undefined;
17
+ addons?: {
18
+ search?: SearchAddon | undefined;
19
+ fit?: FitAddon | undefined;
20
+ webLinks?: WebLinksAddon | undefined;
21
+ highlight?: HighlightAddon | undefined;
22
+ canvas?: CanvasAddon | undefined;
23
+ };
24
+ refresh?: (() => void) | undefined;
25
+ }
26
+ export interface TerminalViewerBodyProps {
27
+ /**
28
+ * @description.zh-CN 是否自动拉伸填充容器宽高
29
+ * @default true
30
+ */
31
+ fit?: boolean;
32
+ /**
33
+ *@description.zh-CN 是否开启自动滚动到底部
34
+ *@default true
35
+ */
36
+ autoScroll?: boolean;
37
+ /**
38
+ * @description.zh-CN 外层样式类名
39
+ */
40
+ className?: string;
41
+ /**
42
+ * @description.zh-CN 自定义空文本显示
43
+ */
44
+ empty?: React.ReactNode;
45
+ /**
46
+ * @description.zh-CN 是否支持渲染超链接
47
+ * @default true
48
+ */
49
+ webLinksSupport?: boolean;
50
+ /**
51
+ * @description.zh-CN 是否使用 canvas 渲染
52
+ * @default false
53
+ */
54
+ canvasSupport?: boolean;
55
+ /**
56
+ * @description.zh-CN 远程搜索选配置
57
+ *
58
+ */
59
+ remoteOptions?: IRemoteOptions;
60
+ /**
61
+ * @description.zh-CN 缓存配置,仅在配置远程加载后有效,如 `expires: 60 * 1000` 表示自动清理已过期一分钟的缓存
62
+ */
63
+ cacheOptions?: ICacheOptions;
64
+ /**
65
+ * @description.zh-CN 高亮选项
66
+ */
67
+ highlightOptions?: IHighlightOptions[];
68
+ /**
69
+ * @description.zh-CN xtem.js 配置, https://github.com/xtermjs/xterm.js
70
+ */
71
+ terminalOptions?: ITerminalOptions;
72
+ /**
73
+ * @description.zh-CN 用于渲染日志的默认数据,如 "echo 1\r\necho2"
74
+ * @default '''
75
+ */
76
+ defaultData?: string;
77
+ /**
78
+ * @description.zh-CN 插件加载成功后的回调
79
+ */
80
+ onAddonReady?: (instance: Terminal, addon: AddonType) => void;
81
+ /**
82
+ * @description.zh-CN 加载状态变更后的回调
83
+ */
84
+ onLoading?: (loading: boolean) => void;
85
+ }
86
+ declare const TerminalViewerBody: React.ForwardRefExoticComponent<TerminalViewerBodyProps & React.RefAttributes<TerminalRef | undefined>>;
87
+ export default TerminalViewerBody;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,88 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface TerminalViewerHeaderProps {
4
+ /**
5
+ * @description.zh-CN 搜索框 placeholder
6
+ * @default 请输入
7
+ */
8
+ placeholder?: string;
9
+ /**
10
+ * @description.zh-CN 搜索框默认内容
11
+ *
12
+ */
13
+ defaultValue?: string;
14
+ /**
15
+ * @description.zh-CN 是否支持清除搜索框
16
+ * @default true
17
+ */
18
+ clearable?: string;
19
+ /**
20
+ * @description.zh-CN 是否支持刷新
21
+ */
22
+ refreshable?: boolean;
23
+ /**
24
+ * @description.zh-CN 是否处于加载状态
25
+ */
26
+ loading?: boolean;
27
+ /**
28
+ * @description.zh-CN 搜索结果
29
+ */
30
+ searchResult?: {
31
+ resultIndex: number;
32
+ resultCount: number;
33
+ };
34
+ /**
35
+ * @description.zh-CN 激活的标题
36
+ * @default 0;
37
+ */
38
+ activeTitleIndex?: number;
39
+ /**
40
+ * @description.zh-CN Tab 标题
41
+ */
42
+ titles?: React.ReactNode[] | number[];
43
+ /**
44
+ * @description.zh-CN 搜索框前的内容
45
+ */
46
+ inputAddonBefore?: React.ReactNode;
47
+ /**
48
+ * @description.zh-CN 搜索框后的内容
49
+ */
50
+ inputAddonAfter?: React.ReactNode;
51
+ /**
52
+ *@description.zh-CN 自定义图标
53
+ */
54
+ icons?: {
55
+ search?: React.ReactNode;
56
+ up?: React.ReactNode;
57
+ down?: React.ReactNode;
58
+ clear?: React.ReactNode;
59
+ refresh?: React.ReactNode;
60
+ loading?: React.ReactNode;
61
+ };
62
+ /**
63
+ * @description.zh-CN 点击下一个按钮回调
64
+ */
65
+ onSearchPrev?: (value: string) => void;
66
+ /**
67
+ * @description.zh-CN 点击上一个按钮回调
68
+ */
69
+ onSearchNext?: (value: string) => void;
70
+ /**
71
+ * @description.zh-CN 搜索框文本变更回调函数
72
+ */
73
+ onSearchChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
74
+ /**
75
+ * @description.zh-CN 清空文本框后回调函数
76
+ */
77
+ onSearchClear?: (e: React.SyntheticEvent<HTMLElement>) => void;
78
+ /**
79
+ * @description.zh-CN 点击 Tab 标题后回调函数
80
+ */
81
+ onTitleChange?: (index: number) => void;
82
+ /**
83
+ *@description.zh-CN 点击刷新按钮后的回调
84
+ */
85
+ onRefresh?: (e: React.SyntheticEvent<HTMLSpanElement>) => void;
86
+ }
87
+ declare const TerminalViewerHeader: React.FC<TerminalViewerHeaderProps>;
88
+ export default TerminalViewerHeader;
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface TerminalViewerToolBarProps {
4
+ /**
5
+ * @description.zh-CN 外层容器样式类名
6
+ */
7
+ className?: string;
8
+ /**
9
+ * @description.zh-CN 外层容器样式
10
+ *
11
+ */
12
+ style?: object;
13
+ /**
14
+ *@description.zh-CN 自定义图标
15
+ */
16
+ icons?: {
17
+ top?: React.ReactNode;
18
+ bottom?: React.ReactNode;
19
+ fullScreen?: React.ReactNode;
20
+ fullScreenExit?: React.ReactNode;
21
+ };
22
+ /**
23
+ * @description.zh-CN 是否为全屏模式
24
+ * @default false
25
+ */
26
+ fullScreen?: boolean;
27
+ /**
28
+ * @description.zh-CN 是否显示全屏图标
29
+ * @default true
30
+ */
31
+ showFullScreen?: boolean;
32
+ /** *
33
+ * @description.zh.CN 点击滚动到顶部按钮的回调
34
+ */
35
+ onScrollTop?: (e: React.SyntheticEvent<HTMLDivElement>) => void;
36
+ /**
37
+ * @description.zh.CN 点击滚动到底部按钮的回调
38
+ */
39
+ onScrollBottom?: (e: React.SyntheticEvent<HTMLDivElement>) => void;
40
+ /**
41
+ * @description.zh.CN 点击全屏/取消全屏按钮的回调
42
+ */
43
+ onFullScreen?: (e: React.SyntheticEvent<HTMLDivElement>) => void;
44
+ }
45
+ declare const TerminalViewerToolBar: React.FC<TerminalViewerToolBarProps>;
46
+ export default TerminalViewerToolBar;
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import type { ListRowProps } from 'react-virtualized';
3
+ import type { IRemoteOptions } from '../Hooks/useRemote';
4
+ import type { ICacheOptions } from '../Hooks/useCache';
5
+ import { IHighlightOptions } from '../Addon/HighlightAddon';
6
+ import type { SearcherRef } from '../Addon/WorkerLog/types';
7
+ import { VirtualDomTerminal, TerminalRef, ExtraOptions, LogAfterProps } from '../types';
8
+ import './index.less';
9
+ export interface TerminalViewerVirtualDomProps {
10
+ /**
11
+ * @description.zh-CN 是否自动拉伸填充容器宽高
12
+ * @default true
13
+ */
14
+ fit?: boolean;
15
+ /**
16
+ * @description.zh-CN 外层样式类名
17
+ */
18
+ className?: string;
19
+ /**
20
+ * @description.zh-CN 自定义空文本显示
21
+ */
22
+ empty?: React.ReactNode;
23
+ /**
24
+ *@description.zh-CN 是否开启自动滚动到底部
25
+ *@default true
26
+ */
27
+ autoScroll?: boolean;
28
+ /**
29
+ * @description.zh-CN 自动滚动到某一行,开启后自动滚动到底部失效
30
+ */
31
+ scrollToRow?: number;
32
+ /**
33
+ * @description.zh-CN 设置日志后置标签,仅在开启虚拟 DOM 生效
34
+ */
35
+ logAfter?: React.FunctionComponent<LogAfterProps> | React.ComponentClass<LogAfterProps>;
36
+ /**
37
+ * @description.zh-CN 用于渲染日志的默认数据,如 "echo 1\r\necho2"
38
+ * @default '''
39
+ */
40
+ defaultData?: string;
41
+ /**
42
+ * @description.zh-CN 远程搜索配置
43
+ *
44
+ */
45
+ remoteOptions?: IRemoteOptions;
46
+ /**
47
+ * @description.zh-CN 缓存配置,仅在配置远程加载后有效,如 `expires: 60 * 1000` 表示自动清理已过期一分钟的缓存
48
+ */
49
+ cacheOptions?: ICacheOptions;
50
+ /**
51
+ * @description.zh-CN 高亮选项
52
+ */
53
+ highlightOptions?: IHighlightOptions[];
54
+ /**
55
+ * @description.zh-CN 额外的功能选项 { showLineNumber 仅 虚拟 DOM 模式支持}
56
+ */
57
+ extraOptions?: ExtraOptions;
58
+ /**
59
+ * @description.zh-CN 插件加载成功后的回调
60
+ */
61
+ onAddonReady?: (instance?: VirtualDomTerminal, addon?: SearcherRef) => void;
62
+ /**
63
+ * @description.zh-CN 加载状态变更后的回调
64
+ */
65
+ onLoading?: (loading: boolean) => void;
66
+ }
67
+ export type RowRenderProps = ListRowProps & {
68
+ style: object;
69
+ };
70
+ declare const TerminalViewerVirtualDom: React.ForwardRefExoticComponent<TerminalViewerVirtualDomProps & React.RefAttributes<TerminalRef | undefined>>;
71
+ export default TerminalViewerVirtualDom;
@@ -0,0 +1,9 @@
1
+ import { Terminal, ITerminalOptions } from 'xterm';
2
+ import TerminalViewer from './TerminalViewer';
3
+ import TerminalViewerHeader from './TerminalViewerHeader';
4
+ import TerminalViewerBody from './TerminalViewerBody';
5
+ import TerminalViewerVirtualDom from './TerminalViewerVirtualDom';
6
+ import TerminalViewerToolBar from './TerminalViewerToolBar';
7
+ export { Terminal, ITerminalOptions };
8
+ export { TerminalViewerHeader, TerminalViewerBody, TerminalViewerVirtualDom, TerminalViewerToolBar, };
9
+ export default TerminalViewer;
@@ -0,0 +1,2 @@
1
+ !function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var t=function(){function t(e){var t=this;this.events={},this.context=e,this.context.addEventListener("message",(function(e){var n=e.data.topic;t.exec(n,e.data)}))}return t.prototype.on=function(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),this},t.prototype.exec=function(e,t){var n=this;return Array.isArray(this.events[e])?(this.events[e].forEach((function(e){e(n,t)})),this):this},t.prototype.send=function(t,n){return void 0===n&&(n={}),this.context.postMessage(e({topic:t},n)),this},t}(),n=function(){function e(e){this.map=new Map,this.queue=[],this.limit=(null==e?void 0:e.limit)||50}return e.prototype.get=function(e){return this.map.get(e)},Object.defineProperty(e.prototype,"size",{get:function(){return this.map.size},enumerable:!1,configurable:!0}),e.prototype.set=function(e,t){if(this.size>=this.limit){var n=this.queue.shift();n&&this.delete(n)}return this.queue.push(e),this.map.set(e,t)},e.prototype.has=function(e){return this.map.has(e)},e.prototype.delete=function(e){return this.map.delete(e)},e}(),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a,o={};a=o,function(e,t){if("string"!=typeof a.nodeName)t(a);else{var n={};t(n),e.AnsiUp=n.default}}(r,(function(e){var t,n=this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e};!function(e){e[e.EOS=0]="EOS",e[e.Text=1]="Text",e[e.Incomplete=2]="Incomplete",e[e.ESC=3]="ESC",e[e.Unknown=4]="Unknown",e[e.SGR=5]="SGR",e[e.OSCURL=6]="OSCURL"}(t||(t={}));var r=function(){function e(){this.VERSION="5.2.1",this.setup_palettes(),this._use_classes=!1,this.bold=!1,this.italic=!1,this.underline=!1,this.fg=this.bg=null,this._buffer="",this._url_whitelist={http:1,https:1},this._escape_html=!0}return Object.defineProperty(e.prototype,"use_classes",{get:function(){return this._use_classes},set:function(e){this._use_classes=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url_whitelist",{get:function(){return this._url_whitelist},set:function(e){this._url_whitelist=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"escape_html",{get:function(){return this._escape_html},set:function(e){this._escape_html=e},enumerable:!1,configurable:!0}),e.prototype.setup_palettes=function(){var e=this;this.ansi_colors=[[{rgb:[0,0,0],class_name:"ansi-black"},{rgb:[187,0,0],class_name:"ansi-red"},{rgb:[0,187,0],class_name:"ansi-green"},{rgb:[187,187,0],class_name:"ansi-yellow"},{rgb:[0,0,187],class_name:"ansi-blue"},{rgb:[187,0,187],class_name:"ansi-magenta"},{rgb:[0,187,187],class_name:"ansi-cyan"},{rgb:[255,255,255],class_name:"ansi-white"}],[{rgb:[85,85,85],class_name:"ansi-bright-black"},{rgb:[255,85,85],class_name:"ansi-bright-red"},{rgb:[0,255,0],class_name:"ansi-bright-green"},{rgb:[255,255,85],class_name:"ansi-bright-yellow"},{rgb:[85,85,255],class_name:"ansi-bright-blue"},{rgb:[255,85,255],class_name:"ansi-bright-magenta"},{rgb:[85,255,255],class_name:"ansi-bright-cyan"},{rgb:[255,255,255],class_name:"ansi-bright-white"}]],this.palette_256=[],this.ansi_colors.forEach((function(t){t.forEach((function(t){e.palette_256.push(t)}))}));for(var t=[0,95,135,175,215,255],n=0;n<6;++n)for(var r=0;r<6;++r)for(var i=0;i<6;++i){var a={rgb:[t[n],t[r],t[i]],class_name:"truecolor"};this.palette_256.push(a)}for(var o=8,s=0;s<24;++s,o+=10){var l={rgb:[o,o,o],class_name:"truecolor"};this.palette_256.push(l)}},e.prototype.escape_txt_for_html=function(e){return this._escape_html?e.replace(/[&<>"']/gm,(function(e){return"&"===e?"&amp;":"<"===e?"&lt;":">"===e?"&gt;":'"'===e?"&quot;":"'"===e?"&#x27;":void 0})):e},e.prototype.append_buffer=function(e){var t=this._buffer+e;this._buffer=t},e.prototype.get_next_packet=function(){var e={kind:t.EOS,text:"",url:""},r=this._buffer.length;if(0==r)return e;var a,o,s,l,u=this._buffer.indexOf("");if(-1==u)return e.kind=t.Text,e.text=this._buffer,this._buffer="",e;if(u>0)return e.kind=t.Text,e.text=this._buffer.slice(0,u),this._buffer=this._buffer.slice(u),e;if(0==u){if(r<3)return e.kind=t.Incomplete,e;var c=this._buffer.charAt(1);if("["!=c&&"]"!=c&&"("!=c)return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if("["==c){if(this._csi_regex||(this._csi_regex=i(n(["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n [ # CSI\n ([<-?]?) # private-mode char\n ([d;]*) # any digits or semicolons\n ([ -/]? # an intermediate modifier\n [@-~]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n [ # CSI\n [ -~]* # anything legal\n ([\0-:]) # anything illegal\n )\n "],["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \\x1b\\[ # CSI\n ([\\x3c-\\x3f]?) # private-mode char\n ([\\d;]*) # any digits or semicolons\n ([\\x20-\\x2f]? # an intermediate modifier\n [\\x40-\\x7e]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \\x1b\\[ # CSI\n [\\x20-\\x7e]* # anything legal\n ([\\x00-\\x1f:]) # anything illegal\n )\n "]))),null===(d=this._buffer.match(this._csi_regex)))return e.kind=t.Incomplete,e;if(d[4])return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;""!=d[1]||"m"!=d[3]?e.kind=t.Unknown:e.kind=t.SGR,e.text=d[2];var h=d[0].length;return this._buffer=this._buffer.slice(h),e}if("]"==c){if(r<4)return e.kind=t.Incomplete,e;if("8"!=this._buffer.charAt(2)||";"!=this._buffer.charAt(3))return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;this._osc_st||(this._osc_st=(a=n(["\n (?: # legal sequence\n (\\) # ESC | # alternate\n () # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\0-] # anything illegal\n | # alternate\n [\b-] # anything illegal\n | # alternate\n [-] # anything illegal\n )\n "],["\n (?: # legal sequence\n (\\x1b\\\\) # ESC \\\n | # alternate\n (\\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\\x00-\\x06] # anything illegal\n | # alternate\n [\\x08-\\x1a] # anything illegal\n | # alternate\n [\\x1c-\\x1f] # anything illegal\n )\n "]),o=a.raw[0],s=/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,l=o.replace(s,""),new RegExp(l,"g"))),this._osc_st.lastIndex=0;var f=this._osc_st.exec(this._buffer);if(null===f)return e.kind=t.Incomplete,e;if(f[3])return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;var d,p=this._osc_st.exec(this._buffer);return null===p?(e.kind=t.Incomplete,e):p[3]?(e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e):(this._osc_regex||(this._osc_regex=i(n(["\n ^ # beginning of line\n #\n ]8; # OSC Hyperlink\n [ -:<-~]* # params (excluding ;)\n ; # end of params\n ([!-~]{0,512}) # URL capture\n (?: # ST\n (?:\\) # ESC | # alternate\n (?:) # BEL (what xterm did)\n )\n ([ -~]+) # TEXT capture\n ]8;; # OSC Hyperlink End\n (?: # ST\n (?:\\) # ESC | # alternate\n (?:) # BEL (what xterm did)\n )\n "],["\n ^ # beginning of line\n #\n \\x1b\\]8; # OSC Hyperlink\n [\\x20-\\x3a\\x3c-\\x7e]* # params (excluding ;)\n ; # end of params\n ([\\x21-\\x7e]{0,512}) # URL capture\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n ([\\x20-\\x7e]+) # TEXT capture\n \\x1b\\]8;; # OSC Hyperlink End\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n "]))),null===(d=this._buffer.match(this._osc_regex))?(e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e):(e.kind=t.OSCURL,e.url=d[1],e.text=d[2],h=d[0].length,this._buffer=this._buffer.slice(h),e))}if("("==c)return e.kind=t.Unknown,this._buffer=this._buffer.slice(3),e}},e.prototype.ansi_to_html=function(e){this.append_buffer(e);for(var n=[];;){var r=this.get_next_packet();if(r.kind==t.EOS||r.kind==t.Incomplete)break;r.kind!=t.ESC&&r.kind!=t.Unknown&&(r.kind==t.Text?n.push(this.transform_to_html(this.with_state(r))):r.kind==t.SGR?this.process_ansi(r):r.kind==t.OSCURL&&n.push(this.process_hyperlink(r)))}return n.join("")},e.prototype.with_state=function(e){return{bold:this.bold,italic:this.italic,underline:this.underline,fg:this.fg,bg:this.bg,text:e.text}},e.prototype.process_ansi=function(e){for(var t=e.text.split(";");t.length>0;){var n=t.shift(),r=parseInt(n,10);if(isNaN(r)||0===r)this.fg=this.bg=null,this.bold=!1,this.italic=!1,this.underline=!1;else if(1===r)this.bold=!0;else if(3===r)this.italic=!0;else if(4===r)this.underline=!0;else if(22===r)this.bold=!1;else if(23===r)this.italic=!1;else if(24===r)this.underline=!1;else if(39===r)this.fg=null;else if(49===r)this.bg=null;else if(r>=30&&r<38)this.fg=this.ansi_colors[0][r-30];else if(r>=40&&r<48)this.bg=this.ansi_colors[0][r-40];else if(r>=90&&r<98)this.fg=this.ansi_colors[1][r-90];else if(r>=100&&r<108)this.bg=this.ansi_colors[1][r-100];else if((38===r||48===r)&&t.length>0){var i=38===r,a=t.shift();if("5"===a&&t.length>0){var o=parseInt(t.shift(),10);o>=0&&o<=255&&(i?this.fg=this.palette_256[o]:this.bg=this.palette_256[o])}if("2"===a&&t.length>2){var s=parseInt(t.shift(),10),l=parseInt(t.shift(),10),u=parseInt(t.shift(),10);if(s>=0&&s<=255&&l>=0&&l<=255&&u>=0&&u<=255){var c={rgb:[s,l,u],class_name:"truecolor"};i?this.fg=c:this.bg=c}}}}},e.prototype.transform_to_html=function(e){var t=e.text;if(0===t.length)return t;if(t=this.escape_txt_for_html(t),!e.bold&&!e.italic&&!e.underline&&null===e.fg&&null===e.bg)return t;var n=[],r=[],i=e.fg,a=e.bg;e.bold&&n.push("font-weight:bold"),e.italic&&n.push("font-style:italic"),e.underline&&n.push("text-decoration:underline"),this._use_classes?(i&&("truecolor"!==i.class_name?r.push(i.class_name+"-fg"):n.push("color:rgb("+i.rgb.join(",")+")")),a&&("truecolor"!==a.class_name?r.push(a.class_name+"-bg"):n.push("background-color:rgb("+a.rgb.join(",")+")"))):(i&&n.push("color:rgb("+i.rgb.join(",")+")"),a&&n.push("background-color:rgb("+a.rgb+")"));var o="",s="";return r.length&&(o=' class="'+r.join(" ")+'"'),n.length&&(s=' style="'+n.join(";")+'"'),"<span"+s+o+">"+t+"</span>"},e.prototype.process_hyperlink=function(e){var t=e.url.split(":");return t.length<1?"":this._url_whitelist[t[0]]?'<a href="'+this.escape_txt_for_html(e.url)+'">'+this.escape_txt_for_html(e.text)+"</a>":""},e}();function i(e){var t=e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,"");return new RegExp(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r}));var s=i(o),l={entityMap:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}},u={},c=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,h=new RegExp("[\\-\\.0-9"+c.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),f=new RegExp("^"+c.source+h.source+"*(?::"+c.source+h.source+"*)?$"),d=0,p=1,m=2,g=3,b=4,v=5,N=6,w=7;function _(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,_)}function x(){}function y(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function E(e,t,n,r,i,a){function o(e,t,r){e in n.attributeNames&&a.fatalError("Attribute "+e+" redefined"),n.addValue(e,t,r)}for(var s,l=++t,u=d;;){var c=e.charAt(l);switch(c){case"=":if(u===p)s=e.slice(t,l),u=g;else{if(u!==m)throw new Error("attribute equal must after attrName");u=g}break;case"'":case'"':if(u===g||u===p){if(u===p&&(a.warning('attribute value must after "="'),s=e.slice(t,l)),t=l+1,!((l=e.indexOf(c,t))>0))throw new Error("attribute value no end '"+c+"' match");o(s,h=e.slice(t,l).replace(/&#?\w+;/g,i),t-1),u=v}else{if(u!=b)throw new Error('attribute value must after "="');o(s,h=e.slice(t,l).replace(/&#?\w+;/g,i),t),a.warning('attribute "'+s+'" missed start quot('+c+")!!"),t=l+1,u=v}break;case"/":switch(u){case d:n.setTagName(e.slice(t,l));case v:case N:case w:u=w,n.closed=!0;case b:case p:case m:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),u==d&&n.setTagName(e.slice(t,l)),l;case">":switch(u){case d:n.setTagName(e.slice(t,l));case v:case N:case w:break;case b:case p:"/"===(h=e.slice(t,l)).slice(-1)&&(n.closed=!0,h=h.slice(0,-1));case m:u===m&&(h=s),u==b?(a.warning('attribute "'+h+'" missed quot(")!'),o(s,h.replace(/&#?\w+;/g,i),t)):("http://www.w3.org/1999/xhtml"===r[""]&&h.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+h+'" missed value!! "'+h+'" instead!!'),o(h,h,t));break;case g:throw new Error("attribute value missed!!")}return l;case"€":c=" ";default:if(c<=" ")switch(u){case d:n.setTagName(e.slice(t,l)),u=N;break;case p:s=e.slice(t,l),u=m;break;case b:var h=e.slice(t,l).replace(/&#?\w+;/g,i);a.warning('attribute "'+h+'" missed quot(")!!'),o(s,h,t);case v:u=N}else switch(u){case m:n.tagName,"http://www.w3.org/1999/xhtml"===r[""]&&s.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),o(s,s,t),t=l,u=p;break;case v:a.warning('attribute space is required"'+s+'"!!');case N:u=p,t=l;break;case g:u=b,t=l;break;case w:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function S(e,t,n){for(var r=e.tagName,i=null,a=e.length;a--;){var o=e[a],s=o.qName,l=o.value;if((f=s.indexOf(":"))>0)var u=o.prefix=s.slice(0,f),c=s.slice(f+1),h="xmlns"===u&&c;else c=s,u=null,h="xmlns"===s&&"";o.localName=c,!1!==h&&(null==i&&(i={},I(n,n={})),n[h]=i[h]=l,o.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(h,l))}for(a=e.length;a--;){(u=(o=e[a]).prefix)&&("xml"===u&&(o.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==u&&(o.uri=n[u||""]))}var f;(f=r.indexOf(":"))>0?(u=e.prefix=r.slice(0,f),c=e.localName=r.slice(f+1)):(u=null,c=e.localName=r);var d=e.uri=n[u||""];if(t.startElement(d,c,r,e),!e.closed)return e.currentNSMap=n,e.localNSMap=i,!0;if(t.endElement(d,c,r),i)for(u in i)t.endPrefixMapping(u)}function C(e,t,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var a=e.indexOf("</"+n+">",t),o=e.substring(t+1,a);if(/[&<]/.test(o))return/^script$/i.test(n)?(i.characters(o,0,o.length),a):(o=o.replace(/&#?\w+;/g,r),i.characters(o,0,o.length),a)}return t+1}function T(e,t,n,r){var i=r[n];return null==i&&((i=e.lastIndexOf("</"+n+">"))<t&&(i=e.lastIndexOf("</"+n)),r[n]=i),i<t}function I(e,t){for(var n in e)t[n]=e[n]}function D(e,t,n,r){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(i=e.indexOf("--\x3e",t+4))>t?(n.comment(e,t+4,i-t-4),i+3):(r.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var i=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,i-t-9),n.endCDATA(),i+3}var a=function(e,t){var n,r=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;i.lastIndex=t,i.exec(e);for(;n=i.exec(e);)if(r.push(n),n[1])return r}(e,t),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var s=a[1][0],l=!1,u=!1;o>3&&(/^public$/i.test(a[2][0])?(l=a[3][0],u=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(u=a[3][0]));var c=a[o-1];return n.startDTD(s,l,u),n.endDTD(),c.index+c[0].length}return-1}function k(e,t,n){var r=e.indexOf("?>",t);if(r){var i=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return i?(i[0].length,n.processingInstruction(i[1],i[2]),r+2):-1}return-1}function A(){this.attributeNames={}}_.prototype=new Error,_.prototype.name=_.name,x.prototype={parse:function(e,t,n){var r=this.domBuilder;r.startDocument(),I(t,t={}),function(e,t,n,r,i){function a(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function o(e){var t=e.slice(1,-1);return t in n?n[t]:"#"===t.charAt(0)?a(parseInt(t.substr(1).replace("x","0x"))):(i.error("entity not found:"+e),e)}function s(t){if(t>m){var n=e.substring(m,t).replace(/&#?\w+;/g,o);f&&l(m),r.characters(n,0,t-m),m=t}}function l(t,n){for(;t>=c&&(n=h.exec(e));)u=n.index,c=u+n[0].length,f.lineNumber++;f.columnNumber=t-u+1}var u=0,c=0,h=/.*(?:\r\n?|\n)|.*$/g,f=r.locator,d=[{currentNSMap:t}],p={},m=0;for(;;){try{var g=e.indexOf("<",m);if(g<0){if(!e.substr(m).match(/^\s*$/)){var b=r.doc,v=b.createTextNode(e.substr(m));b.appendChild(v),r.currentElement=v}return}switch(g>m&&s(g),e.charAt(g+1)){case"/":var N=e.indexOf(">",g+3),w=e.substring(g+2,N),x=d.pop();N<0?(w=e.substring(g+2).replace(/[\s<].*/,""),i.error("end tag name: "+w+" is not complete:"+x.tagName),N=g+1+w.length):w.match(/\s</)&&(w=w.replace(/[\s<].*/,""),i.error("end tag name: "+w+" maybe not complete"),N=g+1+w.length);var I=x.localNSMap,O=x.tagName==w;if(O||x.tagName&&x.tagName.toLowerCase()==w.toLowerCase()){if(r.endElement(x.uri,x.localName,w),I)for(var R in I)r.endPrefixMapping(R);O||i.fatalError("end tag name: "+w+" is not match the current start tagName:"+x.tagName)}else d.push(x);N++;break;case"?":f&&l(g),N=k(e,g,r);break;case"!":f&&l(g),N=D(e,g,r,i);break;default:f&&l(g);var M=new A,U=d[d.length-1].currentNSMap,L=(N=E(e,g,M,U,o,i),M.length);if(!M.closed&&T(e,N,M.tagName,p)&&(M.closed=!0,n.nbsp||i.warning("unclosed xml attribute")),f&&L){for(var B=y(f,{}),F=0;F<L;F++){var P=M[F];l(P.offset),P.locator=y(f,{})}r.locator=B,S(M,r,U)&&d.push(M),r.locator=f}else S(M,r,U)&&d.push(M);"http://www.w3.org/1999/xhtml"!==M.uri||M.closed?N++:N=C(e,N,M.tagName,o,r)}}catch(e){if(e instanceof _)throw e;i.error("element parse error: "+e),N=-1}N>m?m=N:s(Math.max(g,m)+1)}}(e,t,n,r,this.errorHandler),r.endDocument()}},A.prototype={setTagName:function(e){if(!f.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,n){if(!f.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},u.XMLReader=x,u.ParseError=_;var O={};function R(e,t){for(var n in e)t[n]=e[n]}function M(e,t){var n=e.prototype;if(!(n instanceof t)){function r(){}r.prototype=t.prototype,R(n,r=new r),e.prototype=n=r}n.constructor!=e&&("function"!=typeof e&&console.error("unknow Class:"+e),n.constructor=e)}var U="http://www.w3.org/1999/xhtml",L={},B=L.ELEMENT_NODE=1,F=L.ATTRIBUTE_NODE=2,P=L.TEXT_NODE=3,q=L.CDATA_SECTION_NODE=4,j=L.ENTITY_REFERENCE_NODE=5,$=L.ENTITY_NODE=6,V=L.PROCESSING_INSTRUCTION_NODE=7,z=L.COMMENT_NODE=8,H=L.DOCUMENT_NODE=9,X=L.DOCUMENT_TYPE_NODE=10,Y=L.DOCUMENT_FRAGMENT_NODE=11,G=L.NOTATION_NODE=12,W={},K={};W.INDEX_SIZE_ERR=(K[1]="Index size error",1),W.DOMSTRING_SIZE_ERR=(K[2]="DOMString size error",2);var Z=W.HIERARCHY_REQUEST_ERR=(K[3]="Hierarchy request error",3);W.WRONG_DOCUMENT_ERR=(K[4]="Wrong document",4),W.INVALID_CHARACTER_ERR=(K[5]="Invalid character",5),W.NO_DATA_ALLOWED_ERR=(K[6]="No data allowed",6),W.NO_MODIFICATION_ALLOWED_ERR=(K[7]="No modification allowed",7);var Q=W.NOT_FOUND_ERR=(K[8]="Not found",8);W.NOT_SUPPORTED_ERR=(K[9]="Not supported",9);var J=W.INUSE_ATTRIBUTE_ERR=(K[10]="Attribute in use",10);function ee(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,K[e]),this.message=K[e],Error.captureStackTrace&&Error.captureStackTrace(this,ee);return n.code=e,t&&(this.message=this.message+": "+t),n}function te(){}function ne(e,t){this._node=e,this._refresh=t,re(this)}function re(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var n=e._refresh(e._node);Ue(e,"length",n.length),R(n,e),e._inc=t}}function ie(){}function ae(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function oe(e,t,n,r){if(r?t[ae(t,r)]=n:t[t.length++]=n,e){n.ownerElement=e;var i=e.ownerDocument;i&&(r&&de(i,e,r),function(e,t,n){e&&e._inc++;var r=n.namespaceURI;"http://www.w3.org/2000/xmlns/"==r&&(t._nsMap[n.prefix?n.localName:""]=n.value)}(i,e,n))}}function se(e,t,n){var r=ae(t,n);if(!(r>=0))throw ee(Q,new Error(e.tagName+"@"+n));for(var i=t.length-1;r<i;)t[r]=t[++r];if(t.length=i,e){var a=e.ownerDocument;a&&(de(a,e,n),n.ownerElement=null)}}function le(e){if(this._features={},e)for(var t in e)this._features=e[t]}function ue(){}function ce(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function he(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(he(e,t))return!0}while(e=e.nextSibling)}function fe(){}function de(e,t,n,r){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&delete t._nsMap[n.prefix?n.localName:""]}function pe(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var i=t.firstChild,a=0;i;)r[a++]=i,i=i.nextSibling;r.length=a}}}function me(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,pe(e.ownerDocument,e),t}function ge(e,t,n){var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===Y){var i=t.firstChild;if(null==i)return t;var a=t.lastChild}else i=a=t;var o=n?n.previousSibling:e.lastChild;i.previousSibling=o,a.nextSibling=n,o?o.nextSibling=i:e.firstChild=i,null==n?e.lastChild=a:n.previousSibling=a;do{i.parentNode=e}while(i!==a&&(i=i.nextSibling));return pe(e.ownerDocument||e,e),t.nodeType==Y&&(t.firstChild=t.lastChild=null),t}function be(){this._nsMap={}}function ve(){}function Ne(){}function we(){}function _e(){}function xe(){}function ye(){}function Ee(){}function Se(){}function Ce(){}function Te(){}function Ie(){}function De(){}function ke(e,t){var n=[],r=9==this.nodeType&&this.documentElement||this,i=r.prefix,a=r.namespaceURI;if(a&&null==i&&null==(i=r.lookupPrefix(a)))var o=[{namespace:a,prefix:null}];return Oe(this,n,e,t,o),n.join("")}function Ae(e,t,n){var r=e.prefix||"",i=e.namespaceURI;if(!r&&!i)return!1;if("xml"===r&&"http://www.w3.org/XML/1998/namespace"===i||"http://www.w3.org/2000/xmlns/"==i)return!1;for(var a=n.length;a--;){var o=n[a];if(o.prefix==r)return o.namespace!=i}return!0}function Oe(e,t,n,r,i){if(r){if(!(e=r(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case B:i||(i=[]),i.length;var a=e.attributes,o=a.length,s=e.firstChild,l=e.tagName;n=U===e.namespaceURI||n,t.push("<",l);for(var u=0;u<o;u++){"xmlns"==(c=a.item(u)).prefix?i.push({prefix:c.localName,namespace:c.value}):"xmlns"==c.nodeName&&i.push({prefix:"",namespace:c.value})}for(u=0;u<o;u++){var c;if(Ae(c=a.item(u),0,i)){var h=c.prefix||"",f=c.namespaceURI,d=h?" xmlns:"+h:" xmlns";t.push(d,'="',f,'"'),i.push({prefix:h,namespace:f})}Oe(c,t,n,r,i)}if(Ae(e,0,i)){h=e.prefix||"";if(f=e.namespaceURI){d=h?" xmlns:"+h:" xmlns";t.push(d,'="',f,'"'),i.push({prefix:h,namespace:f})}}if(s||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(t.push(">"),n&&/^script$/i.test(l))for(;s;)s.data?t.push(s.data):Oe(s,t,n,r,i),s=s.nextSibling;else for(;s;)Oe(s,t,n,r,i),s=s.nextSibling;t.push("</",l,">")}else t.push("/>");return;case H:case Y:for(s=e.firstChild;s;)Oe(s,t,n,r,i),s=s.nextSibling;return;case F:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,ce),'"');case P:return t.push(e.data.replace(/[<&]/g,ce).replace(/]]>/g,"]]&gt;"));case q:return t.push("<![CDATA[",e.data,"]]>");case z:return t.push("\x3c!--",e.data,"--\x3e");case X:var p=e.publicId,m=e.systemId;if(t.push("<!DOCTYPE ",e.name),p)t.push(" PUBLIC ",p),m&&"."!=m&&t.push(" ",m),t.push(">");else if(m&&"."!=m)t.push(" SYSTEM ",m,">");else{var g=e.internalSubset;g&&t.push(" [",g,"]"),t.push(">")}return;case V:return t.push("<?",e.target," ",e.data,"?>");case j:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Re(e,t,n){var r;switch(t.nodeType){case B:(r=t.cloneNode(!1)).ownerDocument=e;case Y:break;case F:n=!0}if(r||(r=t.cloneNode(!1)),r.ownerDocument=e,r.parentNode=null,n)for(var i=t.firstChild;i;)r.appendChild(Re(e,i,n)),i=i.nextSibling;return r}function Me(e,t,n){var r=new t.constructor;for(var i in t){var a=t[i];"object"!=typeof a&&a!=r[i]&&(r[i]=a)}switch(t.childNodes&&(r.childNodes=new te),r.ownerDocument=e,r.nodeType){case B:var o=t.attributes,s=r.attributes=new ie,l=o.length;s._ownerElement=r;for(var u=0;u<l;u++)r.setAttributeNode(Me(e,o.item(u),!0));break;case F:n=!0}if(n)for(var c=t.firstChild;c;)r.appendChild(Me(e,c,n)),c=c.nextSibling;return r}function Ue(e,t,n){e[t]=n}W.INVALID_STATE_ERR=(K[11]="Invalid state",11),W.SYNTAX_ERR=(K[12]="Syntax error",12),W.INVALID_MODIFICATION_ERR=(K[13]="Invalid modification",13),W.NAMESPACE_ERR=(K[14]="Invalid namespace",14),W.INVALID_ACCESS_ERR=(K[15]="Invalid access",15),ee.prototype=Error.prototype,R(W,ee),te.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var n=[],r=0;r<this.length;r++)Oe(this[r],n,e,t);return n.join("")}},ne.prototype.item=function(e){return re(this),this[e]},M(ne,te),ie.prototype={length:0,item:te.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var n=this[t];if(n.nodeName==e)return n}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new ee(J);var n=this.getNamedItem(e.nodeName);return oe(this._ownerElement,this,e,n),n},setNamedItemNS:function(e){var t,n=e.ownerElement;if(n&&n!=this._ownerElement)throw new ee(J);return t=this.getNamedItemNS(e.namespaceURI,e.localName),oe(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return se(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var n=this.getNamedItemNS(e,t);return se(this._ownerElement,this,n),n},getNamedItemNS:function(e,t){for(var n=this.length;n--;){var r=this[n];if(r.localName==t&&r.namespaceURI==e)return r}return null}},le.prototype={hasFeature:function(e,t){var n=this._features[e.toLowerCase()];return!(!n||t&&!(t in n))},createDocument:function(e,t,n){var r=new fe;if(r.implementation=this,r.childNodes=new te,r.doctype=n,n&&r.appendChild(n),t){var i=r.createElementNS(e,t);r.appendChild(i)}return r},createDocumentType:function(e,t,n){var r=new ye;return r.name=e,r.nodeName=e,r.publicId=t,r.systemId=n,r}},ue.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return ge(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return me(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return Me(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==P&&e.nodeType==P?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var r in n)if(n[r]==e)return r;t=t.nodeType==F?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n)return n[e];t=t.nodeType==F?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},R(L,ue),R(L,ue.prototype),fe.prototype={nodeName:"#document",nodeType:H,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==Y){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return null==this.documentElement&&e.nodeType==B&&(this.documentElement=e),ge(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),me(this,e)},importNode:function(e,t){return Re(this,e,t)},getElementById:function(e){var t=null;return he(this.documentElement,(function(n){if(n.nodeType==B&&n.getAttribute("id")==e)return t=n,!0})),t},getElementsByClassName:function(e){var t=new RegExp("(^|\\s)"+e+"(\\s|$)");return new ne(this,(function(e){var n=[];return he(e.documentElement,(function(r){r!==e&&r.nodeType==B&&t.test(r.getAttribute("class"))&&n.push(r)})),n}))},createElement:function(e){var t=new be;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new te,(t.attributes=new ie)._ownerElement=t,t},createDocumentFragment:function(){var e=new Te;return e.ownerDocument=this,e.childNodes=new te,e},createTextNode:function(e){var t=new we;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new _e;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new xe;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new Ie;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new ve;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Ce;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new be,r=t.split(":"),i=n.attributes=new ie;return n.childNodes=new te,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,i._ownerElement=n,n},createAttributeNS:function(e,t){var n=new ve,r=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},M(fe,ue),be.prototype={nodeType:B,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===Y?this.insertBefore(e,null):function(e,t){var n=t.parentNode;if(n){var r=e.lastChild;n.removeChild(t),r=e.lastChild}return r=e.lastChild,t.parentNode=e,t.previousSibling=r,t.nextSibling=null,r?r.nextSibling=t:e.firstChild=t,e.lastChild=t,pe(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new ne(this,(function(t){var n=[];return he(t,(function(r){r===t||r.nodeType!=B||"*"!==e&&r.tagName!=e||n.push(r)})),n}))},getElementsByTagNameNS:function(e,t){return new ne(this,(function(n){var r=[];return he(n,(function(i){i===n||i.nodeType!==B||"*"!==e&&i.namespaceURI!==e||"*"!==t&&i.localName!=t||r.push(i)})),r}))}},fe.prototype.getElementsByTagName=be.prototype.getElementsByTagName,fe.prototype.getElementsByTagNameNS=be.prototype.getElementsByTagNameNS,M(be,ue),ve.prototype.nodeType=F,M(ve,ue),Ne.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(K[Z])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},M(Ne,ue),we.prototype={nodeName:"#text",nodeType:P,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},M(we,Ne),_e.prototype={nodeName:"#comment",nodeType:z},M(_e,Ne),xe.prototype={nodeName:"#cdata-section",nodeType:q},M(xe,Ne),ye.prototype.nodeType=X,M(ye,ue),Ee.prototype.nodeType=G,M(Ee,ue),Se.prototype.nodeType=$,M(Se,ue),Ce.prototype.nodeType=j,M(Ce,ue),Te.prototype.nodeName="#document-fragment",Te.prototype.nodeType=Y,M(Te,ue),Ie.prototype.nodeType=V,M(Ie,ue),De.prototype.serializeToString=function(e,t,n){return ke.call(e,t,n)},ue.prototype.toString=ke;try{if(Object.defineProperty){function Je(e){switch(e.nodeType){case B:case Y:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(Je(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(ne.prototype,"length",{get:function(){return re(this),this.$$length}}),Object.defineProperty(ue.prototype,"textContent",{get:function(){return Je(this)},set:function(e){switch(this.nodeType){case B:case Y:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),Ue=function(e,t,n){e["$$"+t]=n}}}catch(et){}function Le(e){this.options=e||{locator:{}}}function Be(){this.cdata=!1}function Fe(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Pe(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function qe(e,t,n){return"string"==typeof e?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+"":e}function je(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}O.Node=ue,O.DOMException=ee,O.DOMImplementation=le,O.XMLSerializer=De,Le.prototype.parseFromString=function(e,t){var n=this.options,r=new ze,i=n.domBuilder||new Be,a=n.errorHandler,o=n.locator,s=n.xmlns||{},l=/\/x?html?$/.test(t),u=l?$e.entityMap:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return o&&i.setDocumentLocator(o),r.errorHandler=function(e,t,n){if(!e){if(t instanceof Be)return t;e=t}var r={},i=e instanceof Function;function a(t){var a=e[t];!a&&i&&(a=2==e.length?function(n){e(t,n)}:e),r[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+Pe(n))}||function(){}}return n=n||{},a("warning"),a("error"),a("fatalError"),r}(a,i,o),r.domBuilder=n.domBuilder||i,l&&(s[""]="http://www.w3.org/1999/xhtml"),s.xml=s.xml||"http://www.w3.org/XML/1998/namespace",e&&"string"==typeof e?r.parse(e,s,u):r.errorHandler.error("invalid doc source"),i.doc},Be.prototype={startDocument:function(){this.doc=(new Xe).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var i=this.doc,a=i.createElementNS(e,n||t),o=r.length;je(this,a),this.currentElement=a,this.locator&&Fe(this.locator,a);for(var s=0;s<o;s++){e=r.getURI(s);var l=r.getValue(s),u=(n=r.getQName(s),i.createAttributeNS(e,n));this.locator&&Fe(r.getLocator(s),u),u.value=u.nodeValue=l,a.setAttributeNode(u)}},endElement:function(e,t,n){var r=this.currentElement;r.tagName,this.currentElement=r.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var n=this.doc.createProcessingInstruction(e,t);this.locator&&Fe(this.locator,n),je(this,n)},ignorableWhitespace:function(e,t,n){},characters:function(e,t,n){if(e=qe.apply(this,arguments)){if(this.cdata)var r=this.doc.createCDATASection(e);else r=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(e)&&this.doc.appendChild(r),this.locator&&Fe(this.locator,r)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,n){e=qe.apply(this,arguments);var r=this.doc.createComment(e);this.locator&&Fe(this.locator,r),je(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,n){var r=this.doc.implementation;if(r&&r.createDocumentType){var i=r.createDocumentType(e,t,n);this.locator&&Fe(this.locator,i),je(this,i)}},warning:function(e){console.warn("[xmldom warning]\t"+e,Pe(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,Pe(this.locator))},fatalError:function(e){throw new He(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){Be.prototype[e]=function(){return null}}));var $e=l,Ve=u,ze=Ve.XMLReader,He=Ve.ParseError,Xe=O.DOMImplementation,Ye=Le,Ge=function(){function e(e,t){void 0===t&&(t={className:"terminal-viewer-hl-mark",markedClassName:"terminal-viewer-hl-mark terminal-viewer-hl-marked"}),this.isMarked=!1,this.dom=(new Ye).parseFromString("".concat('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',"<html><body>").concat(e,"</body></html>"),"text/html"),this.options=t,this.matchCount=0,this.matchedIndex=0,this.isMarked=!1,this.hlIndex=0}return e.prototype.mark=function(e,t){var n=this;void 0===t&&(t={matchedIndex:0,hlIndex:0});var r=new RegExp(this.escapeStr(e),"gi"),i=Array.from(this.dom.getElementsByTagName("body")[0].childNodes),a=e.length;return this.matchedIndex=t.matchedIndex,this.hlIndex=t.hlIndex,i.forEach((function(e){var t=n.getTextNodes(e);t.forEach((function(e){for(var t=e,i=t.textContent||"";i;){var o=i.search(r);if(-1===o)break;i=(null==(t=n.wrapRangeInTextNode(t,o,o+a))?void 0:t.textContent)||"",n.matchCount++,n.matchedIndex++}})),t=[]})),i=[],this},e.prototype.escapeStr=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},e.prototype.getStyle=function(e){var t=(e?this.options.markedStyle:this.options.style)||{};return Object.keys(t).filter((function(e){return t[e]})).map((function(e){return"".concat(e,":").concat(t[e],";")})).join("")},e.prototype.getTextNodes=function(e){for(var t=[],n=[e];0!==n.length;){var r=n.shift();if(r&&3===r.nodeType&&t.push(r),r&&r.hasChildNodes()){var i=Array.from(r.childNodes);i.forEach((function(e){3===e.nodeType&&t.push(e)})),n.push.apply(n,i)}}return t},e.prototype.wrapRangeInTextNode=function(e,t,n){var r,i=this.options,a=i.className,o=i.markedClassName,s=e.splitText(t),l=s.splitText(n-t),u=this.dom.createElement("mark"),c=this.getStyle(this.matchedIndex===this.hlIndex);return this.matchedIndex===this.hlIndex&&(this.isMarked=!0),u.setAttribute("class",(this.matchedIndex===this.hlIndex?o:a)||""),c&&u.setAttribute("style",c),u.textContent=s.textContent,null===(r=s.parentNode)||void 0===r||r.replaceChild(u,s),l},e.prototype.toString=function(){var e=this.dom.getElementsByTagName("body")[0].toString().match(/^<body xmlns="http:\/\/www\.w3\.org\/1999\/xhtml">(.[\s\S]*?)<\/body>$/);return e&&e[1]?e[1]:""},e.prototype.distory=function(){this.dom=null},e}(),We=function(){function e(e){void 0===e&&(e={markClassName:"terminal-viewer-hl-mark",markedClassName:"terminal-viewer-hl-mark terminal-viewer-hl-marked"}),this.options=e}return e.prototype.search=function(e,t,n,r){var i,a,o,s,l;if(void 0===n&&(n=0),void 0===r&&(r=void 0),!Array.isArray(t)||0===t.length||!e)return{count:0,map:{},markedKey:0};for(var u=this.options,c=u.markClassName,h=u.markedClassName,f={color:null===(i=null==r?void 0:r.decorations)||void 0===i?void 0:i.matchForegroundColor,background:null===(a=null==r?void 0:r.decorations)||void 0===a?void 0:a.matchBackground,border:null===(o=null==r?void 0:r.decorations)||void 0===o?void 0:o.matchBorder},d={background:null===(s=null==r?void 0:r.decorations)||void 0===s?void 0:s.activeMatchBackground,border:null===(l=null==r?void 0:r.decorations)||void 0===l?void 0:l.activeMatchBorder},p=0,m=0,g={},b=0,v=t.length;b<v&&!(p>=1e3);b++){var N=t[b]||"";if(N.toLowerCase().includes(e.toLowerCase())){var w=new Ge(N,{className:c,markedClassName:h,style:f,markedStyle:d}),_=w.mark(e,{matchedIndex:p,hlIndex:n}).toString();w.isMarked&&(m=b),0!==w.matchCount&&(p+=w.matchCount,g[b]=_||N),w.distory(),w=null}}return{count:p,map:g,markedKey:m}},e}(),Ke=function(){function e(e){var t=e.id,r=e.string;this.id=t,this.string=r,this.searcher=new We,this.logDataMap=new n({limit:1})}return e.prototype.convert=function(){return 0===this.string.length?[]:this.string.split("\r\n").map((function(e){return(new s).ansi_to_html(e)}))},e.prototype.getArrayData=function(){return this.logDataMap.has(this.id)||this.logDataMap.set(this.id,this.convert()),this.logDataMap.get(this.id)||[]},e.prototype.mark=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=void 0),e?this.searcher.search(e,this.getArrayData(),t,n):this.searcher.search(e,[])},e}(),Ze=new t(self),Qe=new n({limit:8});Ze.on("highlight-log",(function(e,t){var n=t.id,r=t.string;Qe.has(n)||Qe.set(n,new Ke({id:n,string:r}));var i=Qe.get(n);e.send("highlight-log-success",{id:n,logs:null==i?void 0:i.getArrayData()})})),Ze.on("search-log",(function(e,t){var n=t.id,r=t.searchId,i=t.keyword,a=void 0===i?"":i,o=t.hlIndex,s=t.string,l=void 0===s?"":s,u=t.options;if(a){Qe.has(n)||Qe.set(n,new Ke({id:n,string:l}));var c=Qe.get(n);c&&e.send("search-log-success",{id:n,searchId:r,searcherResult:c.mark(a,o,u)||{map:{},count:0,markedKey:0}})}else e.send("search-log-success",{id:n,searchId:r,searcherResult:{map:{},count:0,markedKey:0}})}))}));
2
+ //# sourceMappingURL=log.worker.js.map