@cozeloop/prompt-components 0.0.1 → 0.0.2
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/edenx.config.d.ts +2 -0
- package/dist/{es/basic-editor/extensions/go-syntax.js → go-syntax-067c4f5d.mjs} +16 -9
- package/dist/go-syntax-4deb0289.js +8 -0
- package/dist/{es/basic-editor/extensions/go-theme.js → go-theme-062a6df6.mjs} +3 -4
- package/dist/go-theme-fbd8a4fa.js +1 -0
- package/dist/index.cjs +61 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2788 -0
- package/dist/{types → src}/basic-editor/custom-facet.d.ts +2 -1
- package/dist/src/basic-editor/diff.d.ts +16 -0
- package/dist/src/basic-editor/extensions/go-syntax.d.ts +71 -0
- package/dist/src/basic-editor/extensions/go-template.d.ts +1 -0
- package/dist/{types → src}/basic-editor/extensions/go-theme.d.ts +1 -1
- package/dist/src/basic-editor/extensions/jinja.d.ts +4 -0
- package/dist/{types → src}/basic-editor/extensions/keymap.d.ts +3 -2
- package/dist/src/basic-editor/extensions/language-support.d.ts +2 -0
- package/dist/src/basic-editor/extensions/markdown.d.ts +2 -0
- package/dist/src/basic-editor/extensions/search/dom/icon.d.ts +59 -0
- package/dist/src/basic-editor/extensions/search/dom/match-count.d.ts +14 -0
- package/dist/src/basic-editor/extensions/search/index.d.ts +1 -0
- package/dist/src/basic-editor/extensions/search/panel.d.ts +33 -0
- package/dist/src/basic-editor/extensions/search/theme.d.ts +1 -0
- package/dist/src/basic-editor/extensions/validation.d.ts +8 -0
- package/dist/src/basic-editor/extensions/variable.d.ts +11 -0
- package/dist/src/basic-editor/index.d.ts +29 -0
- package/dist/{types → src}/code-editor/index.d.ts +1 -1
- package/dist/src/code-editor/json-editor.d.ts +18 -0
- package/dist/src/code-editor/raw-text-editor.d.ts +11 -0
- package/dist/{types → src}/consts/index.d.ts +1 -1
- package/dist/src/dev-layout/index.d.ts +7 -0
- package/dist/{types → src}/index.d.ts +7 -7
- package/dist/src/mermaid-diagram/index.d.ts +12 -0
- package/dist/src/mermaid-diagram/use-svg-pan-zoom.d.ts +12 -0
- package/dist/{types → src}/mermaid-diagram/utils.d.ts +1 -1
- package/dist/src/model-config-editor/basic-type.d.ts +13 -0
- package/dist/src/model-config-editor/model-config-form.d.ts +13 -0
- package/dist/src/model-config-editor/popover-type.d.ts +19 -0
- package/dist/src/model-select/index.d.ts +27 -0
- package/dist/src/model-select/model-option/index.d.ts +25 -0
- package/dist/src/model-select/model-option-group/index.d.ts +16 -0
- package/dist/src/prompt-editor/index.d.ts +31 -0
- package/dist/src/prompt-editor/message-type-select.d.ts +11 -0
- package/dist/src/schema-editor/index.d.ts +11 -0
- package/dist/{types → src}/utils/base.d.ts +5 -4
- package/dist/src/utils/model-config.d.ts +5 -0
- package/dist/style.css +1 -0
- package/dist/test-build.d.ts +7 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +15 -5
- package/dist/es/basic-editor/custom-facet.js +0 -9
- package/dist/es/basic-editor/diff.js +0 -138
- package/dist/es/basic-editor/extensions/go-template.js +0 -16
- package/dist/es/basic-editor/extensions/jinja.js +0 -80
- package/dist/es/basic-editor/extensions/keymap.js +0 -442
- package/dist/es/basic-editor/extensions/language-support.js +0 -12
- package/dist/es/basic-editor/extensions/markdown.js +0 -58
- package/dist/es/basic-editor/extensions/search/dom/icon.js +0 -250
- package/dist/es/basic-editor/extensions/search/dom/match-count.js +0 -33
- package/dist/es/basic-editor/extensions/search/index.js +0 -18
- package/dist/es/basic-editor/extensions/search/panel.js +0 -418
- package/dist/es/basic-editor/extensions/search/theme.js +0 -184
- package/dist/es/basic-editor/extensions/validation.js +0 -84
- package/dist/es/basic-editor/extensions/validation.module.js +0 -5
- package/dist/es/basic-editor/extensions/validation_module.css +0 -7
- package/dist/es/basic-editor/extensions/variable.js +0 -178
- package/dist/es/basic-editor/index.js +0 -171
- package/dist/es/code-editor/code-editor.js +0 -83
- package/dist/es/code-editor/index.js +0 -12
- package/dist/es/code-editor/json-editor.js +0 -157
- package/dist/es/code-editor/raw-text-editor.js +0 -46
- package/dist/es/code-editor/text-editor.js +0 -41
- package/dist/es/code-editor/themes/coze-dark.js +0 -112
- package/dist/es/code-editor/themes/coze-light.js +0 -118
- package/dist/es/consts/index.js +0 -12
- package/dist/es/dev-layout/index.js +0 -35
- package/dist/es/index.js +0 -66
- package/dist/es/mermaid-diagram/index.js +0 -148
- package/dist/es/mermaid-diagram/index.module.js +0 -5
- package/dist/es/mermaid-diagram/index_module.css +0 -4
- package/dist/es/mermaid-diagram/use-svg-pan-zoom.js +0 -49
- package/dist/es/mermaid-diagram/utils.js +0 -74
- package/dist/es/model-config-editor/basic-type.js +0 -73
- package/dist/es/model-config-editor/index.module.js +0 -5
- package/dist/es/model-config-editor/index_module.css +0 -8
- package/dist/es/model-config-editor/model-config-form.js +0 -130
- package/dist/es/model-config-editor/popover-type.js +0 -118
- package/dist/es/model-select/index.js +0 -136
- package/dist/es/model-select/index.module.js +0 -5
- package/dist/es/model-select/index_module.css +0 -14
- package/dist/es/model-select/model-option/index.js +0 -161
- package/dist/es/model-select/model-option/index.module.js +0 -5
- package/dist/es/model-select/model-option/index_module.css +0 -23
- package/dist/es/model-select/model-option-group/index.js +0 -44
- package/dist/es/prompt-editor/index.js +0 -188
- package/dist/es/prompt-editor/index.module.js +0 -5
- package/dist/es/prompt-editor/index_module.css +0 -71
- package/dist/es/prompt-editor/message-type-select.js +0 -74
- package/dist/es/schema-editor/index.js +0 -43
- package/dist/es/utils/base.js +0 -53
- package/dist/es/utils/model-config.js +0 -32
- package/dist/lib/basic-editor/custom-facet.js +0 -33
- package/dist/lib/basic-editor/diff.js +0 -167
- package/dist/lib/basic-editor/extensions/go-syntax.js +0 -146
- package/dist/lib/basic-editor/extensions/go-template.js +0 -50
- package/dist/lib/basic-editor/extensions/go-theme.js +0 -1091
- package/dist/lib/basic-editor/extensions/jinja.js +0 -100
- package/dist/lib/basic-editor/extensions/keymap.js +0 -465
- package/dist/lib/basic-editor/extensions/language-support.js +0 -32
- package/dist/lib/basic-editor/extensions/markdown.js +0 -78
- package/dist/lib/basic-editor/extensions/search/dom/icon.js +0 -291
- package/dist/lib/basic-editor/extensions/search/dom/match-count.js +0 -67
- package/dist/lib/basic-editor/extensions/search/index.js +0 -38
- package/dist/lib/basic-editor/extensions/search/panel.js +0 -429
- package/dist/lib/basic-editor/extensions/search/theme.js +0 -208
- package/dist/lib/basic-editor/extensions/validation.js +0 -118
- package/dist/lib/basic-editor/extensions/validation.module.js +0 -25
- package/dist/lib/basic-editor/extensions/validation_module.css +0 -7
- package/dist/lib/basic-editor/extensions/variable.js +0 -190
- package/dist/lib/basic-editor/index.js +0 -193
- package/dist/lib/code-editor/code-editor.js +0 -117
- package/dist/lib/code-editor/index.js +0 -40
- package/dist/lib/code-editor/json-editor.js +0 -184
- package/dist/lib/code-editor/raw-text-editor.js +0 -70
- package/dist/lib/code-editor/text-editor.js +0 -75
- package/dist/lib/code-editor/themes/coze-dark.js +0 -136
- package/dist/lib/code-editor/themes/coze-light.js +0 -142
- package/dist/lib/consts/index.js +0 -38
- package/dist/lib/dev-layout/index.js +0 -69
- package/dist/lib/index.js +0 -110
- package/dist/lib/mermaid-diagram/index.js +0 -174
- package/dist/lib/mermaid-diagram/index.module.js +0 -25
- package/dist/lib/mermaid-diagram/index_module.css +0 -4
- package/dist/lib/mermaid-diagram/use-svg-pan-zoom.js +0 -83
- package/dist/lib/mermaid-diagram/utils.js +0 -98
- package/dist/lib/model-config-editor/basic-type.js +0 -105
- package/dist/lib/model-config-editor/index.module.js +0 -25
- package/dist/lib/model-config-editor/index_module.css +0 -8
- package/dist/lib/model-config-editor/model-config-form.js +0 -149
- package/dist/lib/model-config-editor/popover-type.js +0 -145
- package/dist/lib/model-select/index.js +0 -170
- package/dist/lib/model-select/index.module.js +0 -25
- package/dist/lib/model-select/index_module.css +0 -14
- package/dist/lib/model-select/model-option/index.js +0 -188
- package/dist/lib/model-select/model-option/index.module.js +0 -25
- package/dist/lib/model-select/model-option/index_module.css +0 -23
- package/dist/lib/model-select/model-option-group/index.js +0 -75
- package/dist/lib/prompt-editor/index.js +0 -218
- package/dist/lib/prompt-editor/index.module.js +0 -25
- package/dist/lib/prompt-editor/index_module.css +0 -71
- package/dist/lib/prompt-editor/message-type-select.js +0 -108
- package/dist/lib/schema-editor/index.js +0 -77
- package/dist/lib/utils/base.js +0 -82
- package/dist/lib/utils/model-config.js +0 -57
- package/dist/types/basic-editor/diff.d.ts +0 -15
- package/dist/types/basic-editor/extensions/go-syntax.d.ts +0 -71
- package/dist/types/basic-editor/extensions/go-template.d.ts +0 -1
- package/dist/types/basic-editor/extensions/jinja.d.ts +0 -6
- package/dist/types/basic-editor/extensions/language-support.d.ts +0 -2
- package/dist/types/basic-editor/extensions/markdown.d.ts +0 -2
- package/dist/types/basic-editor/extensions/search/dom/icon.d.ts +0 -59
- package/dist/types/basic-editor/extensions/search/dom/match-count.d.ts +0 -14
- package/dist/types/basic-editor/extensions/search/index.d.ts +0 -1
- package/dist/types/basic-editor/extensions/search/panel.d.ts +0 -32
- package/dist/types/basic-editor/extensions/search/theme.d.ts +0 -1
- package/dist/types/basic-editor/extensions/validation.d.ts +0 -10
- package/dist/types/basic-editor/extensions/variable.d.ts +0 -14
- package/dist/types/basic-editor/index.d.ts +0 -28
- package/dist/types/code-editor/code-editor.d.ts +0 -23
- package/dist/types/code-editor/json-editor.d.ts +0 -17
- package/dist/types/code-editor/raw-text-editor.d.ts +0 -11
- package/dist/types/code-editor/text-editor.d.ts +0 -23
- package/dist/types/code-editor/themes/coze-dark.d.ts +0 -1
- package/dist/types/code-editor/themes/coze-light.d.ts +0 -1
- package/dist/types/dev-layout/index.d.ts +0 -13
- package/dist/types/mermaid-diagram/index.d.ts +0 -12
- package/dist/types/mermaid-diagram/use-svg-pan-zoom.d.ts +0 -17
- package/dist/types/model-config-editor/basic-type.d.ts +0 -19
- package/dist/types/model-config-editor/model-config-form.d.ts +0 -14
- package/dist/types/model-config-editor/popover-type.d.ts +0 -25
- package/dist/types/model-select/index.d.ts +0 -38
- package/dist/types/model-select/model-option/index.d.ts +0 -30
- package/dist/types/model-select/model-option-group/index.d.ts +0 -15
- package/dist/types/prompt-editor/index.d.ts +0 -30
- package/dist/types/prompt-editor/message-type-select.d.ts +0 -16
- package/dist/types/schema-editor/index.d.ts +0 -18
- package/dist/types/utils/model-config.d.ts +0 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,2788 @@
|
|
|
1
|
+
import { jsxs as y, Fragment as ue, jsx as u } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js";
|
|
2
|
+
import Ke, { useState as F, useEffect as z, useLayoutEffect as G, forwardRef as Y, useRef as S, useImperativeHandle as q, useMemo as Ce, useCallback as ve } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/react@18.2.0/node_modules/react/index.js";
|
|
3
|
+
import { useEditor as et, Mention as tt, PositionMirror as nt, useLatest as K, getCurrentMentionReplaceRange as rt, useInjector as J, EditorProvider as X, Renderer as ot, Placeholder as ct, goToPreviousChunk as it, goToNextChunk as st, MergeViewRenderer as at, createRenderer as De, option as R } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@coze-editor+editor@0.1.0-alpha.dac011_@codemirror+autocomplete@6.18.6_@codemirror+language@6_2lzzbb62e4bh3ygs7i5hudz3bm/node_modules/@coze-editor/editor/dist/esm/react.js";
|
|
4
|
+
import { EditorProvider as $r, useEditor as Pr, useInjector as Ur, useLatest as Wr } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@coze-editor+editor@0.1.0-alpha.dac011_@codemirror+autocomplete@6.18.6_@codemirror+language@6_2lzzbb62e4bh3ygs7i5hudz3bm/node_modules/@coze-editor/editor/dist/esm/react.js";
|
|
5
|
+
import Ee, { languageSupport as lt, markdownLanguage as Ae } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@coze-editor+editor@0.1.0-alpha.dac011_@codemirror+autocomplete@6.18.6_@codemirror+language@6_2lzzbb62e4bh3ygs7i5hudz3bm/node_modules/@coze-editor/editor/dist/esm/preset-prompt.js";
|
|
6
|
+
import { EditorView as N, runScopeHandlers as dt, keymap as me } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@codemirror+view@6.34.1/node_modules/@codemirror/view/dist/index.js";
|
|
7
|
+
import { Decoration as Qr, EditorView as Zr, WidgetType as Gr, keymap as qr } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@codemirror+view@6.34.1/node_modules/@codemirror/view/dist/index.js";
|
|
8
|
+
import { Prec as ze, EditorSelection as H, countColumn as W, Facet as ut } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@codemirror+state@6.4.1/node_modules/@codemirror/state/dist/index.js";
|
|
9
|
+
import { EditorSelection as Xr, Prec as Kr, StateEffect as eo, StateField as to } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@codemirror+state@6.4.1/node_modules/@codemirror/state/dist/index.js";
|
|
10
|
+
import { indentWithTab as mt, history as ht, defaultKeymap as pt, historyKeymap as ft } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@codemirror+commands@6.3.3/node_modules/@codemirror/commands/dist/index.js";
|
|
11
|
+
import { Popover as je, Typography as E, Menu as ee, Button as gt, Space as Z, IconButton as xt, Input as Mt, withField as bt, Tooltip as U, Form as he, Tag as $, Avatar as Se, Select as te } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@coze-arch+coze-design@0.0.6-alpha.101d0c_@types+react@18.2.37_acorn@8.14.0_react-dom@18.2.0_react@18.2.0/node_modules/@coze-arch/coze-design/dist/esm/index.mjs";
|
|
12
|
+
import { astDecorator as pe, mixLanguages as Te } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@coze-editor+editor@0.1.0-alpha.dac011_@codemirror+autocomplete@6.18.6_@codemirror+language@6_2lzzbb62e4bh3ygs7i5hudz3bm/node_modules/@coze-editor/editor/dist/esm/index.js";
|
|
13
|
+
import { getSearchQuery as yt, findPrevious as ge, findNext as xe, closeSearchPanel as wt, replaceNext as Me, replaceAll as Nt, SearchQuery as kt, setSearchQuery as be, search as It, searchKeymap as Ct, gotoLine as vt } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@codemirror+search@6.5.6/node_modules/@codemirror/search/dist/index.js";
|
|
14
|
+
import D from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/crelt@1.0.6/node_modules/crelt/index.js";
|
|
15
|
+
import { syntaxTree as Fe, indentUnit as Dt } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@codemirror+language@6.10.1/node_modules/@codemirror/language/dist/index.js";
|
|
16
|
+
import { createOnigurumaEngine as Et } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/shiki@3.3.0/node_modules/shiki/dist/engine-oniguruma.mjs";
|
|
17
|
+
import { createHighlighterCore as At } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/shiki@3.3.0/node_modules/shiki/dist/core.mjs";
|
|
18
|
+
import zt from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/codemirror-shiki@0.2.2_@codemirror+state@6.4.1_@codemirror+view@6.34.1_shiki@3.3.0/node_modules/codemirror-shiki/dist/index.mjs";
|
|
19
|
+
import A from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js";
|
|
20
|
+
import { IconCozNodeExpand as jt, IconCozHandle as St, IconCozQuestionMarkCircle as Le, IconCozDiamondFill as Tt, IconCozUpdate as Ft } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@coze-arch+coze-design@0.0.6-alpha.101d0c_@types+react@18.2.37_acorn@8.14.0_react-dom@18.2.0_react@18.2.0/node_modules/@coze-arch/coze-design/dist/esm/components/icon/index.mjs";
|
|
21
|
+
import Lt, { createTheme as Oe, tags as M, languages as Be, themes as _e, transformerCreator as Ot } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@coze-editor+editor@0.1.0-alpha.dac011_@codemirror+autocomplete@6.18.6_@codemirror+language@6_2lzzbb62e4bh3ygs7i5hudz3bm/node_modules/@coze-editor/editor/dist/esm/preset-code.js";
|
|
22
|
+
import { shell as Bt } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@coze-editor+editor@0.1.0-alpha.dac011_@codemirror+autocomplete@6.18.6_@codemirror+language@6_2lzzbb62e4bh3ygs7i5hudz3bm/node_modules/@coze-editor/editor/dist/esm/language-shell.js";
|
|
23
|
+
import { json as ae } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@coze-editor+editor@0.1.0-alpha.dac011_@codemirror+autocomplete@6.18.6_@codemirror+language@6_2lzzbb62e4bh3ygs7i5hudz3bm/node_modules/@coze-editor/editor/dist/esm/language-json.js";
|
|
24
|
+
import _t from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@coze-editor+editor@0.1.0-alpha.dac011_@codemirror+autocomplete@6.18.6_@codemirror+language@6_2lzzbb62e4bh3ygs7i5hudz3bm/node_modules/@coze-editor/editor/dist/esm/preset-universal.js";
|
|
25
|
+
import { isUndefined as ye, groupBy as Rt, uniqueId as Vt, isEmpty as Ht } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/lodash.js";
|
|
26
|
+
import { MdBoxLazy as Re } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@flow-web+md-box@2.4.2_react-dom@18.2.0_react@18.2.0/node_modules/@flow-web/md-box/dist/es/lazy/index.js";
|
|
27
|
+
import { InputSlider as $t } from "@cozeloop/components";
|
|
28
|
+
import { useHover as Pt } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/ahooks@3.7.8_patch_hash=sa4ddrxdk2yhjzudeck6u5ww3i_react@18.2.0/node_modules/ahooks/es/index.js";
|
|
29
|
+
import { default as ro, updateRegexpDecorations as oo } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/@coze-editor+extension-regexp-decorator@0.1.0-alpha.0fd19e_@codemirror+state@6.4.1_@codemirror+view@6.34.1/node_modules/@coze-editor/extension-regexp-decorator/dist/esm/index.js";
|
|
30
|
+
import ne from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/mermaid@11.6.0/node_modules/mermaid/dist/mermaid.core.mjs";
|
|
31
|
+
import { toBase64 as Ut } from "/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.mjs";
|
|
32
|
+
function Wt({
|
|
33
|
+
variables: e,
|
|
34
|
+
isGoTemplate: t
|
|
35
|
+
}) {
|
|
36
|
+
const [n, r] = F(""), [o, c] = F(!1), [s, a] = F(-1), i = et();
|
|
37
|
+
function l(p) {
|
|
38
|
+
const f = rt(i.$view.state);
|
|
39
|
+
f && (i.replaceText({
|
|
40
|
+
...f,
|
|
41
|
+
text: t ? `{{.${p}}}` : `{{${p}}}`,
|
|
42
|
+
cursorOffset: p ? 0 : -2
|
|
43
|
+
}), c(!1));
|
|
44
|
+
}
|
|
45
|
+
function d(p) {
|
|
46
|
+
a(p.state.selection.main.head), c(p.value && e.length > 0);
|
|
47
|
+
}
|
|
48
|
+
z(() => {
|
|
49
|
+
i && (o ? i.disableKeybindings(["ArrowUp", "ArrowDown", "Enter"]) : i.disableKeybindings([]));
|
|
50
|
+
}, [i, o]);
|
|
51
|
+
const m = Yt({
|
|
52
|
+
enable: o,
|
|
53
|
+
variables: e,
|
|
54
|
+
onApply: l
|
|
55
|
+
});
|
|
56
|
+
return /* @__PURE__ */ y(ue, { children: [
|
|
57
|
+
/* @__PURE__ */ u(
|
|
58
|
+
tt,
|
|
59
|
+
{
|
|
60
|
+
trigger: (p) => {
|
|
61
|
+
if (p.docChanged) {
|
|
62
|
+
let f;
|
|
63
|
+
return p.changes.iterChanges((h, x, g, w, j) => {
|
|
64
|
+
h > 0 && // 新增,非替换
|
|
65
|
+
h === x && // 新增内容为 {
|
|
66
|
+
j.toString() === "{}" && // { 前还有个 {
|
|
67
|
+
p.state.sliceDoc(
|
|
68
|
+
Math.max(0, h - 1),
|
|
69
|
+
Math.max(0, h)
|
|
70
|
+
) === "{" && (f = {
|
|
71
|
+
from: g - 1,
|
|
72
|
+
to: w + 1,
|
|
73
|
+
triggerCharacter: "{{",
|
|
74
|
+
cursorPosition: p.state.selection.main.head
|
|
75
|
+
});
|
|
76
|
+
}), f;
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
onOpenChange: d
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ u(
|
|
83
|
+
je,
|
|
84
|
+
{
|
|
85
|
+
visible: o,
|
|
86
|
+
trigger: "custom",
|
|
87
|
+
position: "topLeft",
|
|
88
|
+
rePosKey: n,
|
|
89
|
+
content: /* @__PURE__ */ y("div", { className: "p-1 min-w-[100px] flex flex-col gap-1", children: [
|
|
90
|
+
/* @__PURE__ */ u(E.Text, { type: "secondary", strong: !0, children: "插入变量" }),
|
|
91
|
+
/* @__PURE__ */ u("div", { className: "max-h-[200px] overflow-y-auto", children: e.map((p, f) => /* @__PURE__ */ u(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
className: `cursor-pointer hover:bg-gray-100 px-2 py-1 mb-0.5 rounded ${m === f ? "!bg-gray-200" : ""}`,
|
|
95
|
+
onMouseDown: (h) => h.preventDefault(),
|
|
96
|
+
onClick: () => (p == null ? void 0 : p.key) && l(p.key),
|
|
97
|
+
children: p.key
|
|
98
|
+
},
|
|
99
|
+
p.key
|
|
100
|
+
)) })
|
|
101
|
+
] }),
|
|
102
|
+
onClickOutSide: () => c(!1),
|
|
103
|
+
children: /* @__PURE__ */ u(
|
|
104
|
+
nt,
|
|
105
|
+
{
|
|
106
|
+
position: s,
|
|
107
|
+
onChange: () => r(String(Math.random()))
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] });
|
|
113
|
+
}
|
|
114
|
+
function Yt(e) {
|
|
115
|
+
const { enable: t, variables: n, onApply: r } = e, [o, c] = F(0), s = K(o), a = K([...n, { key: "" }]), i = K(r);
|
|
116
|
+
return z(() => {
|
|
117
|
+
c(0);
|
|
118
|
+
}, [t]), z(() => {
|
|
119
|
+
if (!t)
|
|
120
|
+
return;
|
|
121
|
+
function l(d) {
|
|
122
|
+
switch (d.key) {
|
|
123
|
+
case "ArrowUp":
|
|
124
|
+
c((m) => {
|
|
125
|
+
const p = m - 1;
|
|
126
|
+
return Math.max(0, p);
|
|
127
|
+
});
|
|
128
|
+
break;
|
|
129
|
+
case "ArrowDown":
|
|
130
|
+
c((m) => {
|
|
131
|
+
const p = m + 1;
|
|
132
|
+
return Math.min(a.current.length - 1, p);
|
|
133
|
+
});
|
|
134
|
+
break;
|
|
135
|
+
case "Enter": {
|
|
136
|
+
const m = a.current[s.current];
|
|
137
|
+
m && i.current(m.key || "");
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return document.addEventListener("keydown", l, !1), () => {
|
|
143
|
+
document.removeEventListener("keydown", l, !1);
|
|
144
|
+
};
|
|
145
|
+
}, [t]), o;
|
|
146
|
+
}
|
|
147
|
+
const Ve = 50, Qt = {
|
|
148
|
+
temperature: "生成随机性",
|
|
149
|
+
max_tokens: "最大回复长度",
|
|
150
|
+
top_p: "Top P"
|
|
151
|
+
}, He = 4096, Zt = "_valid_1lwoa_1", Gt = "_invalid_1lwoa_5", Q = {
|
|
152
|
+
valid: Zt,
|
|
153
|
+
invalid: Gt
|
|
154
|
+
};
|
|
155
|
+
function qt(e) {
|
|
156
|
+
return !!new RegExp(`^[a-zA-Z][\\w]{0,${Ve - 1}}$`, "gm").test(e);
|
|
157
|
+
}
|
|
158
|
+
function Jt({
|
|
159
|
+
variables: e,
|
|
160
|
+
isNormalTemplate: t
|
|
161
|
+
}) {
|
|
162
|
+
const n = J();
|
|
163
|
+
return G(
|
|
164
|
+
() => n.inject([
|
|
165
|
+
pe.whole.of((r, o) => {
|
|
166
|
+
var c, s, a, i;
|
|
167
|
+
if (r.name === "JinjaExpression" && ((c = r.node.firstChild) == null ? void 0 : c.name) === "JinjaExpressionStart" && ((s = r.node.lastChild) == null ? void 0 : s.name) === "JinjaExpressionEnd") {
|
|
168
|
+
const l = r.node.firstChild.to, d = r.node.lastChild.from, m = o.sliceDoc(l, d);
|
|
169
|
+
return qt(m) && t ? {
|
|
170
|
+
type: "className",
|
|
171
|
+
className: Q.valid,
|
|
172
|
+
from: l,
|
|
173
|
+
to: d
|
|
174
|
+
} : !t && (e == null ? void 0 : e.find((f) => f.key === m)) ? {
|
|
175
|
+
type: "className",
|
|
176
|
+
className: Q.valid,
|
|
177
|
+
from: l,
|
|
178
|
+
to: d
|
|
179
|
+
} : {
|
|
180
|
+
type: "className",
|
|
181
|
+
className: Q.invalid,
|
|
182
|
+
from: l,
|
|
183
|
+
to: d
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
if (r.name === "JinjaStatement" && ((a = r.node.firstChild) == null ? void 0 : a.name) === "JinjaStatementStart" && ((i = r.node.lastChild) == null ? void 0 : i.name) === "JinjaStatementEnd" && !t) {
|
|
187
|
+
const l = r.node.firstChild.to, d = r.node.lastChild.from, m = o.sliceDoc(l, d);
|
|
188
|
+
return (e || []).map((p) => {
|
|
189
|
+
if (p.key) {
|
|
190
|
+
const f = m.indexOf(p.key);
|
|
191
|
+
if (f !== -1)
|
|
192
|
+
return {
|
|
193
|
+
type: "className",
|
|
194
|
+
className: Q.valid,
|
|
195
|
+
from: l + f,
|
|
196
|
+
to: l + f + p.key.length + 1
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}).filter(
|
|
200
|
+
(p) => p !== void 0
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
})
|
|
204
|
+
]),
|
|
205
|
+
[n, e]
|
|
206
|
+
), null;
|
|
207
|
+
}
|
|
208
|
+
const Xt = ze.high(
|
|
209
|
+
N.theme({
|
|
210
|
+
"& .cm-panels.cm-panels-top": {
|
|
211
|
+
borderBottom: "none",
|
|
212
|
+
backgroundColor: "transparent"
|
|
213
|
+
},
|
|
214
|
+
"& .cm-panels.cm-panels-bottom": {
|
|
215
|
+
borderTop: "none",
|
|
216
|
+
backgroundColor: "transparent",
|
|
217
|
+
border: "1px solid rgba(28, 31, 35, .08)"
|
|
218
|
+
},
|
|
219
|
+
"& .cm-searchMatch": {
|
|
220
|
+
outline: "none"
|
|
221
|
+
},
|
|
222
|
+
"& .cm-custom-search": {
|
|
223
|
+
position: "absolute",
|
|
224
|
+
top: 0,
|
|
225
|
+
right: "10px",
|
|
226
|
+
backgroundColor: "#f3f3f3",
|
|
227
|
+
display: "flex",
|
|
228
|
+
padding: "4px",
|
|
229
|
+
boxSizing: "border-box",
|
|
230
|
+
minWidth: "360px",
|
|
231
|
+
maxWidth: "calc(100% - 30px)",
|
|
232
|
+
borderRadius: "4px",
|
|
233
|
+
boxShadow: "0 2px 8px 2px rgba(0, 0, 0, 0.16)",
|
|
234
|
+
overflow: "hidden"
|
|
235
|
+
},
|
|
236
|
+
"& .cm-custom-search button": {
|
|
237
|
+
borderWidth: 0
|
|
238
|
+
},
|
|
239
|
+
"& .cm-custom-search input": {
|
|
240
|
+
outline: "none"
|
|
241
|
+
},
|
|
242
|
+
"& .cm-custom-search .cm-custom-search-drag": {
|
|
243
|
+
width: "3px",
|
|
244
|
+
height: "100%",
|
|
245
|
+
position: "absolute",
|
|
246
|
+
top: "0px",
|
|
247
|
+
left: "0px",
|
|
248
|
+
backgroundColor: "#c8c8c8"
|
|
249
|
+
},
|
|
250
|
+
"& .cm-custom-search .cm-custom-search-drag:hover": {
|
|
251
|
+
backgroundColor: "#0090f1",
|
|
252
|
+
cursor: "col-resize"
|
|
253
|
+
},
|
|
254
|
+
"& .cm-custom-text-field": {
|
|
255
|
+
backgroundColor: "inherit",
|
|
256
|
+
padding: 0,
|
|
257
|
+
border: "none",
|
|
258
|
+
color: "#444d56",
|
|
259
|
+
fontSize: "12px",
|
|
260
|
+
lineHeight: "16px",
|
|
261
|
+
verticalAlign: "middle",
|
|
262
|
+
width: "calc(100% - 58px)"
|
|
263
|
+
},
|
|
264
|
+
"& .cm-custom-search-panel-icon": {
|
|
265
|
+
display: "inline-flex",
|
|
266
|
+
"align-items": "center",
|
|
267
|
+
"justify-content": "center",
|
|
268
|
+
padding: "4px",
|
|
269
|
+
"border-radius": "2px",
|
|
270
|
+
"background-color": "transparent",
|
|
271
|
+
"box-sizing": "border-box",
|
|
272
|
+
width: "20px",
|
|
273
|
+
height: "20px",
|
|
274
|
+
cursor: "pointer"
|
|
275
|
+
},
|
|
276
|
+
"& .cm-custom-search-panel-icon:hover": {
|
|
277
|
+
color: "rgba(0, 100, 250, 1)",
|
|
278
|
+
backgroundColor: "rgba(46, 60, 56, .09)"
|
|
279
|
+
},
|
|
280
|
+
"& .cm-custom-search-panel-icon:active": {
|
|
281
|
+
backgroundColor: "rgba(46, 50, 56, .13)"
|
|
282
|
+
},
|
|
283
|
+
"& .cm-custom-search-panel-icon span": {
|
|
284
|
+
display: "inline-flex",
|
|
285
|
+
lineHeight: "12px",
|
|
286
|
+
fontSize: "12px"
|
|
287
|
+
},
|
|
288
|
+
"& .cm-custom-search-panel-icon-active": {
|
|
289
|
+
color: "rgba(0, 100, 250, 1)",
|
|
290
|
+
backgroundColor: "rgba(46, 50, 56, .05)"
|
|
291
|
+
},
|
|
292
|
+
"& .cm-custom-search-panel-icon-disabled": {
|
|
293
|
+
color: "rgba(28, 31, 35, .35)",
|
|
294
|
+
backgroundColor: "transparent"
|
|
295
|
+
},
|
|
296
|
+
"& .cm-custom-search-panel-icon-disabled:hover": {
|
|
297
|
+
color: "rgba(28, 31, 35, .35)",
|
|
298
|
+
backgroundColor: "transparent"
|
|
299
|
+
},
|
|
300
|
+
"& .cm-custom-search-panel-icon-disabled:active": {
|
|
301
|
+
color: "rgba(28, 31, 35, .35)",
|
|
302
|
+
backgroundColor: "transparent"
|
|
303
|
+
},
|
|
304
|
+
"& .cm-custom-search-panel-expand": {
|
|
305
|
+
display: "flex",
|
|
306
|
+
padding: "4px"
|
|
307
|
+
},
|
|
308
|
+
"& .cm-custom-search-panel-content": {
|
|
309
|
+
display: "flex",
|
|
310
|
+
flexDirection: "column",
|
|
311
|
+
flex: 1
|
|
312
|
+
},
|
|
313
|
+
"& .cm-custom-search-panel-content-top": {
|
|
314
|
+
display: "flex",
|
|
315
|
+
alignItems: "center"
|
|
316
|
+
},
|
|
317
|
+
"& .cm-custom-search-action-wrapper": {
|
|
318
|
+
display: "flex",
|
|
319
|
+
alignItems: "center",
|
|
320
|
+
justifyContent: "end"
|
|
321
|
+
},
|
|
322
|
+
"& .cm-custom-search-panel-content-input-wrapper": {
|
|
323
|
+
display: "flex",
|
|
324
|
+
alignItems: "center",
|
|
325
|
+
flex: 1,
|
|
326
|
+
position: "relative",
|
|
327
|
+
border: "1px solid #555",
|
|
328
|
+
padding: "4px",
|
|
329
|
+
minWidth: "170px",
|
|
330
|
+
marginLeft: "4px",
|
|
331
|
+
marginRight: "6px",
|
|
332
|
+
borderRadius: "2px"
|
|
333
|
+
},
|
|
334
|
+
"& .cm-custom-search-panel-content-input-wrapper-focus": {
|
|
335
|
+
borderColor: "rgba(0, 100, 250, 1)"
|
|
336
|
+
},
|
|
337
|
+
"& .cm-custom-search-panel-content-input-wrapper .cm-custom-search-panel-icon": {
|
|
338
|
+
position: "absolute",
|
|
339
|
+
top: "4px",
|
|
340
|
+
right: "4px",
|
|
341
|
+
padding: "2px",
|
|
342
|
+
width: "16px",
|
|
343
|
+
height: "16px !important"
|
|
344
|
+
},
|
|
345
|
+
"& .cm-panel.cm-custom-search [name=word]": {
|
|
346
|
+
right: "22px"
|
|
347
|
+
},
|
|
348
|
+
"& .cm-panel.cm-custom-search [name=case]": {
|
|
349
|
+
right: "40px"
|
|
350
|
+
},
|
|
351
|
+
"& .cm-panel.cm-custom-search [name=enter]": {
|
|
352
|
+
right: "58px"
|
|
353
|
+
},
|
|
354
|
+
"& .cm-panel.cm-custom-search [name=previous]": {
|
|
355
|
+
marginRight: "2px"
|
|
356
|
+
},
|
|
357
|
+
"& .cm-panel.cm-custom-search [name=next]": {
|
|
358
|
+
marginRight: "2px"
|
|
359
|
+
},
|
|
360
|
+
"& .cm-panel.cm-custom-search [name=close-icon]": {
|
|
361
|
+
marginRight: "2px"
|
|
362
|
+
},
|
|
363
|
+
"& .cm-panel.cm-custom-search [name=replace]": {
|
|
364
|
+
marginRight: "2px"
|
|
365
|
+
},
|
|
366
|
+
"& .cm-panel.cm-custom-search [name=expand]": {
|
|
367
|
+
transform: "rotate(0deg)"
|
|
368
|
+
},
|
|
369
|
+
"& .cm-panel.cm-custom-search [name=expand].cm-custom-search-panel-icon-active": {
|
|
370
|
+
transform: "rotate(90deg)"
|
|
371
|
+
},
|
|
372
|
+
"& .cm-custom-search-match-count": {
|
|
373
|
+
fontSize: "12px",
|
|
374
|
+
width: "80px",
|
|
375
|
+
overflow: "hidden"
|
|
376
|
+
},
|
|
377
|
+
"& .cm-custom-search-panel-content-bottom": {
|
|
378
|
+
marginRight: "104px",
|
|
379
|
+
display: "flex",
|
|
380
|
+
alignItems: "center"
|
|
381
|
+
},
|
|
382
|
+
"& .cm-custom-search-panel-content-bottom .cm-custom-search-panel-content-input-wrapper": {
|
|
383
|
+
marginTop: "6px"
|
|
384
|
+
}
|
|
385
|
+
})
|
|
386
|
+
);
|
|
387
|
+
class Kt {
|
|
388
|
+
constructor(t = { matchCount: 0, matchIndex: -1, searching: !1 }) {
|
|
389
|
+
this._data = t, this.dom = D("div", {
|
|
390
|
+
class: "cm-custom-search-match-count"
|
|
391
|
+
}), this.update();
|
|
392
|
+
}
|
|
393
|
+
update() {
|
|
394
|
+
this._data.matchCount > 0 ? (this.dom.innerText = ` ${this._data.matchIndex + 1} of ${this._data.matchCount > 1e3 ? "1000+" : this._data.matchCount}`, this.dom.style.color = "unset") : (this.dom.innerText = "无结果", this._data.searching ? this.dom.style.color = "red" : this.dom.style.color = "unset");
|
|
395
|
+
}
|
|
396
|
+
get data() {
|
|
397
|
+
return this._data;
|
|
398
|
+
}
|
|
399
|
+
set data(t) {
|
|
400
|
+
this._data = t, this.update();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
class _ {
|
|
404
|
+
constructor(t = {}) {
|
|
405
|
+
const { onchange: n, checked: r, checkable: o = !0, disabled: c, ...s } = t;
|
|
406
|
+
this.checkable = o, this._checked = r || !1, this._disabled = c || !1, this.dom = D(
|
|
407
|
+
"button",
|
|
408
|
+
{
|
|
409
|
+
class: this._checked ? "cm-custom-search-panel-icon cm-custom-search-panel-icon-active" : "cm-custom-search-panel-icon",
|
|
410
|
+
type: "button",
|
|
411
|
+
onclick: () => {
|
|
412
|
+
this.checked = !this.checked, n == null || n();
|
|
413
|
+
},
|
|
414
|
+
...s
|
|
415
|
+
},
|
|
416
|
+
[this.getSVG()]
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
get checked() {
|
|
420
|
+
return this._checked;
|
|
421
|
+
}
|
|
422
|
+
set checked(t) {
|
|
423
|
+
this.checkable && (t ? this.dom.classList.contains("cm-custom-search-panel-icon-active") || this.dom.classList.add("cm-custom-search-panel-icon-active") : this.dom.classList.remove("cm-custom-search-panel-icon-active")), this._checked = t;
|
|
424
|
+
}
|
|
425
|
+
get disabled() {
|
|
426
|
+
return this._disabled;
|
|
427
|
+
}
|
|
428
|
+
set disabled(t) {
|
|
429
|
+
t ? this.dom.classList.contains("cm-custom-search-panel-icon-disabled") || this.dom.classList.add("cm-custom-search-panel-icon-disabled") : this.dom.classList.remove("cm-custom-search-panel-icon-disabled"), this._disabled = t;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
class en extends _ {
|
|
433
|
+
constructor(t = {}) {
|
|
434
|
+
super(t);
|
|
435
|
+
}
|
|
436
|
+
getSVG() {
|
|
437
|
+
const t = document.createElement("span");
|
|
438
|
+
return t.innerHTML = '<svg t="1749105226766" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4424" width="14" height="14"><path d="M270.628571 197.485714L21.942857 811.885714h73.142857l73.142857-190.171428h277.942858l80.457142 190.171428h73.142858L343.771429 197.485714h-73.142858z m-73.142857 373.028572l102.4-263.314286c7.314286-7.314286 7.314286-21.942857 14.628572-43.885714 7.314286 21.942857 7.314286 36.571429 14.628571 43.885714l102.4 263.314286H197.485714zM980.114286 709.485714V526.628571c7.314286-117.028571-51.2-175.542857-175.542857-168.228571-109.714286-7.314286-175.542857 36.571429-204.8 131.657143l65.828571 21.942857c14.628571-73.142857 58.514286-102.4 131.657143-95.085714 80.457143-7.314286 117.028571 36.571429 109.714286 117.028571-21.942857 14.628571-73.142857 29.257143-153.6 36.571429-109.714286 7.314286-160.914286 58.514286-160.914286 146.285714 7.314286 73.142857 58.514286 109.714286 153.6 117.028571 80.457143 0 138.971429-21.942857 175.542857-73.142857 0 21.942857 7.314286 43.885714 21.942857 58.514286h65.828572c-29.257143-29.257143-36.571429-58.514286-29.257143-109.714286z m-73.142857-65.828571c-7.314286 80.457143-58.514286 124.342857-153.6 131.657143-58.514286-7.314286-95.085714-29.257143-95.085715-73.142857s36.571429-73.142857 117.028572-87.771429c80.457143-7.314286 124.342857-14.628571 131.657143-36.571429v65.828572z" fill="currentColor" p-id="4425"></path></svg>', t;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
class tn extends _ {
|
|
442
|
+
constructor(t = {}) {
|
|
443
|
+
super(t);
|
|
444
|
+
}
|
|
445
|
+
getSVG() {
|
|
446
|
+
const t = document.createElement("span");
|
|
447
|
+
return t.innerHTML = '<svg t="1749105951963" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10628" width="12" height="12"><path d="M192 794.752c-18.816 0-33.92 6.272-45.184 18.816a61.632 61.632 0 0 0-18.816 45.184c0 17.6 6.272 33.92 18.816 46.4a61.44 61.44 0 0 0 45.184 17.6c17.6 0 32.64-6.272 45.184-17.6 12.544-12.544 18.816-28.8 18.816-46.4a61.632 61.632 0 0 0-18.816-45.184 61.632 61.632 0 0 0-45.184-18.816zM612.864 88.448h62.208l-5.76 235.008 214.272-79.488 19.584 58.752-218.88 69.12 146.304 178.56-48.384 38.016-138.24-185.472-138.24 185.472-47.232-38.016 145.152-178.56-218.88-69.12 19.584-58.752 214.272 79.488-5.76-235.008z" fill="currentColor" p-id="10629"></path></svg>', t;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
class nn extends _ {
|
|
451
|
+
constructor(t = {}) {
|
|
452
|
+
super(t);
|
|
453
|
+
}
|
|
454
|
+
getSVG() {
|
|
455
|
+
const t = document.createElement("span");
|
|
456
|
+
return t.innerHTML = '<svg t="1749105508508" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7841" width="16" height="16"><path d="M160 192h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64z m0 576h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64z m276.8-94.688l-19.68-51.744H249.504l-19.68 52.864c-7.696 20.64-14.256 34.56-19.696 41.76-5.44 7.232-14.352 10.832-26.72 10.832-10.496 0-19.776-3.84-27.84-11.52s-12.096-16.416-12.096-26.16c0-5.632 0.928-11.44 2.816-17.44 1.872-6 4.96-14.336 9.28-25.024l105.456-267.76 10.832-27.696c4.224-10.784 8.72-19.744 13.504-26.864a54.848 54.848 0 0 1 18.848-17.28c7.776-4.416 17.392-6.624 28.816-6.624 11.632 0 21.328 2.208 29.12 6.608 7.776 4.4 14.064 10.08 18.848 17.024 4.768 6.928 8.8 14.384 12.08 22.352 3.28 7.968 7.456 18.608 12.528 31.92l107.712 266.08c8.432 20.24 12.656 34.96 12.656 44.144 0 9.552-3.984 18.32-11.952 26.288a39.28 39.28 0 0 1-28.832 11.952c-6.56 0-12.192-1.168-16.864-3.52a34.56 34.56 0 0 1-11.824-9.552c-3.184-4.032-6.608-10.224-10.256-18.56a1087.68 1087.68 0 0 1-9.44-22.08z m-165.36-114.464h123.2l-62.176-170.16-61.024 170.16zM776 683.712c-18.56 14.448-36.512 25.28-53.856 32.48-17.344 7.232-36.8 10.832-58.368 10.832-19.68 0-36.976-3.888-51.888-11.664-14.896-7.776-26.4-18.336-34.448-31.648a82.096 82.096 0 0 1-12.096-43.312c0-20.992 6.656-38.896 19.968-53.712 13.312-14.816 31.6-24.752 54.848-29.808 4.864-1.12 16.96-3.664 36.272-7.6a1589.856 1589.856 0 0 0 49.648-10.832 949.488 949.488 0 0 0 44.864-11.952c-0.944-20.24-5.024-35.104-12.24-44.576-7.216-9.472-22.176-14.208-44.864-14.208-19.504 0-34.176 2.72-44 8.16-9.856 5.44-18.288 13.6-25.328 24.48-7.04 10.88-12 18.032-14.896 21.504-2.912 3.472-9.152 5.2-18.72 5.2-8.608 0-16.064-2.752-22.352-8.288-6.272-5.536-9.424-12.608-9.424-21.232 0-13.504 4.8-26.624 14.352-39.376 9.552-12.752 24.48-23.248 44.72-31.504s45.472-12.368 75.648-12.368c33.76 0 60.288 3.984 79.6 11.952 19.312 7.968 32.96 20.576 40.912 37.824 7.984 17.248 11.968 40.128 11.968 68.624a6293.76 6293.76 0 0 1-0.576 87.744c0 14.448 2.4 29.488 7.184 45.152 4.768 15.648 7.168 25.728 7.168 30.24 0 7.856-3.712 15.04-11.104 21.504-7.408 6.464-15.808 9.696-25.184 9.696-7.872 0-15.648-3.696-23.344-11.104-7.68-7.408-15.84-18.144-24.464-32.208z m-5.056-111.088c-11.264 4.128-27.616 8.48-49.088 13.072-21.472 4.608-36.32 7.968-44.576 10.128s-16.128 6.384-23.616 12.656c-7.52 6.288-11.264 15.04-11.264 26.304 0 11.616 4.416 21.52 13.232 29.664 8.8 8.16 20.336 12.24 34.592 12.24 15.184 0 29.2-3.328 42.048-9.984 12.832-6.656 22.256-15.232 28.256-25.728 6.944-11.632 10.4-30.752 10.4-57.376v-10.976z" p-id="7842" fill="currentColor"></path></svg>', t;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
class rn extends _ {
|
|
460
|
+
constructor(t = {}) {
|
|
461
|
+
super({ ...t, checkable: !1 });
|
|
462
|
+
}
|
|
463
|
+
getSVG() {
|
|
464
|
+
const t = document.createElement("span");
|
|
465
|
+
return t.innerHTML = `<svg
|
|
466
|
+
viewBox="0 0 24 24"
|
|
467
|
+
fill="none"
|
|
468
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
469
|
+
width="1em"
|
|
470
|
+
height="1em"
|
|
471
|
+
focusable=false
|
|
472
|
+
aria-hidden=true
|
|
473
|
+
>
|
|
474
|
+
<path
|
|
475
|
+
fill-rule="evenodd"
|
|
476
|
+
clip-rule="evenodd"
|
|
477
|
+
d="M12 23C11.1716 23 10.5 22.3284 10.5 21.5L10.5 6.12132L4.06066 12.5607C3.47487 13.1464 2.52513 13.1464 1.93934 12.5607C1.35355 11.9749 1.35355 11.0251 1.93934 10.4393L10.9393 1.43934C11.5251 0.853554 12.4749 0.853554 13.0607 1.43934L22.0607 10.4393C22.6464 11.0251 22.6464 11.9749 22.0607 12.5607C21.4749 13.1464 20.5251 13.1464 19.9393 12.5607L13.5 6.12132L13.5 21.5C13.5 22.3284 12.8284 23 12 23Z"
|
|
478
|
+
fill="currentColor"
|
|
479
|
+
/>
|
|
480
|
+
</svg>`, t;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
class on extends _ {
|
|
484
|
+
constructor(t = {}) {
|
|
485
|
+
super({ ...t, checkable: !1 });
|
|
486
|
+
}
|
|
487
|
+
getSVG() {
|
|
488
|
+
const t = document.createElement("span");
|
|
489
|
+
return t.innerHTML = `<svg
|
|
490
|
+
viewBox="0 0 24 24"
|
|
491
|
+
fill="none"
|
|
492
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
493
|
+
width="1em"
|
|
494
|
+
height="1em"
|
|
495
|
+
focusable=false
|
|
496
|
+
aria-hidden=true
|
|
497
|
+
>
|
|
498
|
+
<path
|
|
499
|
+
fill-rule="evenodd"
|
|
500
|
+
clip-rule="evenodd"
|
|
501
|
+
d="M12 1C12.8284 1 13.5 1.67157 13.5 2.5V17.8787L19.9393 11.4393C20.5251 10.8536 21.4749 10.8536 22.0607 11.4393C22.6464 12.0251 22.6464 12.9749 22.0607 13.5607L13.0607 22.5607C12.4749 23.1464 11.5251 23.1464 10.9393 22.5607L1.93934 13.5607C1.35355 12.9749 1.35355 12.0251 1.93934 11.4393C2.52513 10.8536 3.47487 10.8536 4.06066 11.4393L10.5 17.8787V2.5C10.5 1.67157 11.1716 1 12 1Z"
|
|
502
|
+
fill="currentColor"
|
|
503
|
+
/>
|
|
504
|
+
</svg>`, t;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
class cn extends _ {
|
|
508
|
+
constructor(t = {}) {
|
|
509
|
+
super({ ...t, checkable: !1 });
|
|
510
|
+
}
|
|
511
|
+
getSVG() {
|
|
512
|
+
const t = document.createElement("span");
|
|
513
|
+
return t.innerHTML = '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="14" height="14"><path d="M206.144 239.296l144.704 145.216L492.8 242.176l-44.8-44.8-64.768 64.448-0.512-102.4a33.472 33.472 0 0 1 32-33.664H512V64H414.72A94.848 94.848 0 0 0 320 159.296V262.4L251.328 194.112l-45.184 45.184z m426.88 114.816h0.64c11.712 19.904 28.864 29.888 51.584 29.888 25.152 0 45.184-10.752 60.16-32.192 15.104-21.44 22.592-49.92 22.592-85.312 0-32.704-6.4-58.432-19.264-77.248-12.864-18.88-31.232-28.288-55.04-28.288-25.92 0-45.952 12.416-60.032 37.184h-0.64V64H576v314.816h56.96v-24.704z m-0.96-67.904v-21.76c0-15.872 3.712-28.672 11.2-38.464a34.56 34.56 0 0 1 28.48-14.72 31.36 31.36 0 0 1 27.904 14.912c6.656 9.856 9.92 23.552 9.92 41.152 0 21.12-3.584 37.568-10.816 49.152a33.536 33.536 0 0 1-30.08 17.28 31.68 31.68 0 0 1-26.304-13.504 54.592 54.592 0 0 1-10.24-34.048zM576 817.216c-16.384 9.856-40 14.784-70.912 14.784-36.032 0-65.28-11.392-87.616-34.112-22.336-22.72-33.472-52.032-33.472-87.936 0-41.472 11.904-74.112 35.84-97.92 23.936-24.064 56-36.032 96-36.032 27.712 0 47.744 3.84 60.16 11.456v63.872a80.64 80.64 0 0 0-50.688-17.664c-20.8 0-37.312 6.4-49.536 19.072-12.16 12.544-18.112 29.952-18.112 52.224 0 21.632 5.76 38.592 17.408 51.008 11.648 12.224 27.584 18.368 47.936 18.368 18.048 0 35.712-5.888 52.992-17.664v60.544zM256 448L192 512v384l64 64h448l64-64V512l-64-64H256z m0 64h448v384H256V512z" fill="currentColor"></path></svg>', t;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
class sn extends _ {
|
|
517
|
+
constructor(t = {}) {
|
|
518
|
+
super({ ...t, checkable: !1 });
|
|
519
|
+
}
|
|
520
|
+
getSVG() {
|
|
521
|
+
const t = document.createElement("span");
|
|
522
|
+
return t.innerHTML = '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="14" height="14"><path d="M742.4 171.328c9.408-19.84 22.784-29.76 40.064-29.76 15.872 0 28.16 7.552 36.672 22.592 8.576 15.104 12.864 35.648 12.864 61.824 0 28.352-4.992 51.072-15.04 68.288-9.984 17.152-23.36 25.728-40.128 25.728-15.168 0-26.624-8-34.368-23.936h-0.512v19.84H704V64h37.952v107.328h0.512z m-1.024 70.4a49.92 49.92 0 0 0 6.848 27.264c4.544 7.232 10.432 10.816 17.536 10.816 8.704 0 15.36-4.608 20.096-13.824 4.8-9.28 7.232-22.4 7.232-39.36 0-14.08-2.24-24.96-6.656-32.896-4.288-7.936-10.496-11.968-18.56-11.968-7.68 0-14.016 3.968-19.008 11.84a56.704 56.704 0 0 0-7.488 30.72v17.408zM263.68 492.48L128 356.352l42.368-42.368 64.384 64v-96.64A88.96 88.96 0 0 1 323.52 192H473.6v57.92H323.52a31.36 31.36 0 0 0-29.952 31.552l0.448 96 60.736-60.416 41.984 41.984-133.12 133.44zM598.784 315.52H640V206.08C640 154.112 619.84 128 579.584 128c-8.64 0-18.24 1.536-28.8 4.672a92.416 92.416 0 0 0-24.832 10.688v42.56c15.168-12.992 31.168-19.456 48-19.456 16.704 0 25.088 9.984 25.088 30.016l-38.4 6.592c-32.384 5.504-48.64 25.984-48.64 61.504 0 16.832 3.904 30.272 11.712 40.384A39.04 39.04 0 0 0 556.16 320c18.56 0 32.576-10.24 42.048-30.72h0.576v26.24z m0.256-86.72v12.352c0 11.2-2.56 20.48-7.68 27.904a23.552 23.552 0 0 1-20.032 10.88 17.664 17.664 0 0 1-14.08-6.08 24.32 24.32 0 0 1-5.12-15.872c0-14.208 7.04-22.464 21.248-24.896l25.6-4.288zM448 827.52h-41.216v-26.24h-0.576c-9.472 20.48-23.488 30.72-42.048 30.72a39.04 39.04 0 0 1-32.448-15.04c-7.808-10.112-11.712-23.552-11.712-40.32 0-35.584 16.256-56.064 48.64-61.568l38.4-6.592c0-20.032-8.32-30.08-25.088-30.08-16.832 0-32.832 6.528-48 19.52v-42.56c6.08-4.032 14.336-7.616 24.832-10.688 10.56-3.136 20.16-4.672 28.8-4.672 40.32 0 60.416 26.048 60.416 78.08v109.44z m-40.96-74.368v-12.352l-25.6 4.352c-14.208 2.368-21.312 10.624-21.312 24.832 0 6.4 1.728 11.712 5.12 15.872a17.664 17.664 0 0 0 14.08 6.08 23.552 23.552 0 0 0 19.968-10.88c5.12-7.424 7.68-16.64 7.68-27.904zM592.768 832c20.544 0 36.352-3.712 47.232-11.072v-45.44a57.6 57.6 0 0 1-35.328 13.248 39.616 39.616 0 0 1-32-13.76c-7.68-9.28-11.584-22.08-11.584-38.272 0-16.64 4.032-29.696 12.096-39.168a41.216 41.216 0 0 1 33.024-14.272c12.416 0 23.68 4.416 33.792 13.248v-47.936c-8.256-5.76-21.632-8.576-40.064-8.576-26.688 0-48.064 8.96-64.064 27.008-15.936 17.92-23.872 42.368-23.872 73.472 0 26.88 7.424 48.896 22.336 65.92 14.848 17.088 34.368 25.6 58.432 25.6zM128 576l64-64h576l64 64v320l-64 64H192l-64-64V576z m64 0v320h576V576H192z m192-128l64-64h448l64 64v320l-64 64V448H384z" fill="currentColor"></path></svg>', t;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
class an extends _ {
|
|
526
|
+
constructor(t = {}) {
|
|
527
|
+
super({ ...t, checkable: !1 });
|
|
528
|
+
}
|
|
529
|
+
getSVG() {
|
|
530
|
+
const t = document.createElement("span");
|
|
531
|
+
return t.innerHTML = `<svg
|
|
532
|
+
viewBox="0 0 24 24"
|
|
533
|
+
fill="none"
|
|
534
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
535
|
+
width="1em"
|
|
536
|
+
height="1em"
|
|
537
|
+
focusable=false
|
|
538
|
+
aria-hidden=true
|
|
539
|
+
>
|
|
540
|
+
<path
|
|
541
|
+
d="M17.6568 19.7782C18.2426 20.3639 19.1924 20.3639 19.7782 19.7782C20.3639 19.1924 20.3639 18.2426 19.7782 17.6568L14.1213 12L19.7782 6.34313C20.3639 5.75734 20.3639 4.8076 19.7782 4.22181C19.1924 3.63602 18.2426 3.63602 17.6568 4.22181L12 9.87866L6.34313 4.22181C5.75734 3.63602 4.8076 3.63602 4.22181 4.22181C3.63602 4.8076 3.63602 5.75734 4.22181 6.34313L9.87866 12L4.22181 17.6568C3.63602 18.2426 3.63602 19.1924 4.22181 19.7782C4.8076 20.3639 5.75734 20.3639 6.34313 19.7782L12 14.1213L17.6568 19.7782Z"
|
|
542
|
+
fill="currentColor"
|
|
543
|
+
/>
|
|
544
|
+
</svg>`, t;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
class ln extends _ {
|
|
548
|
+
constructor(t = {}) {
|
|
549
|
+
super({ ...t });
|
|
550
|
+
}
|
|
551
|
+
getSVG() {
|
|
552
|
+
const t = document.createElement("span");
|
|
553
|
+
return t.innerHTML = `<svg
|
|
554
|
+
viewBox="0 0 24 24"
|
|
555
|
+
fill="none"
|
|
556
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
557
|
+
width="1em"
|
|
558
|
+
height="1em"
|
|
559
|
+
focusable=false
|
|
560
|
+
aria-hidden=true
|
|
561
|
+
>
|
|
562
|
+
<path
|
|
563
|
+
fill-rule="evenodd"
|
|
564
|
+
clip-rule="evenodd"
|
|
565
|
+
d="M7.43934 19.7957C6.85355 19.2099 6.85355 18.2601 7.43934 17.6744L13.0962 12.0175L7.43934 6.36065C6.85355 5.77486 6.85355 4.82511 7.43934 4.23933C8.02513 3.65354 8.97487 3.65354 9.56066 4.23933L16.2782 10.9568C16.864 11.5426 16.864 12.4924 16.2782 13.0782L9.56066 19.7957C8.97487 20.3815 8.02513 20.3815 7.43934 19.7957Z"
|
|
566
|
+
fill="currentColor"
|
|
567
|
+
/>
|
|
568
|
+
</svg>`, t;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
class dn {
|
|
572
|
+
constructor(t) {
|
|
573
|
+
this.view = t, this.commit = this.commit.bind(this), this.query = yt(t.state), this.matchCount = new Kt();
|
|
574
|
+
const n = this.initSearchLine(t), r = this.initReplaceLine(t), o = () => {
|
|
575
|
+
var a;
|
|
576
|
+
if (t.state.readOnly) {
|
|
577
|
+
r.style.display = "none";
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
if (!((a = this.expand) != null && a.checked)) {
|
|
581
|
+
r.style.display = "none";
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
r.style.display = "flex";
|
|
585
|
+
};
|
|
586
|
+
o();
|
|
587
|
+
const c = this.initExpandButton(t, () => o()), s = mn(this);
|
|
588
|
+
this.dom = D(
|
|
589
|
+
"div",
|
|
590
|
+
{
|
|
591
|
+
onkeydown: (a) => this.keydown(a),
|
|
592
|
+
class: "cm-custom-search"
|
|
593
|
+
},
|
|
594
|
+
[
|
|
595
|
+
D("div", {
|
|
596
|
+
class: "cm-custom-search-drag",
|
|
597
|
+
onmousedown: s
|
|
598
|
+
}),
|
|
599
|
+
...c,
|
|
600
|
+
D(
|
|
601
|
+
"div",
|
|
602
|
+
{
|
|
603
|
+
class: "cm-custom-search-panel-content"
|
|
604
|
+
},
|
|
605
|
+
[n, r]
|
|
606
|
+
)
|
|
607
|
+
]
|
|
608
|
+
), this.updateMatchCount(t.state, this.query);
|
|
609
|
+
}
|
|
610
|
+
initExpandButton(t, n) {
|
|
611
|
+
return this.expand = new ln({
|
|
612
|
+
name: "expand",
|
|
613
|
+
title: v(t, "展开"),
|
|
614
|
+
onchange: n
|
|
615
|
+
}), t.state.readOnly ? [] : [
|
|
616
|
+
D(
|
|
617
|
+
"div",
|
|
618
|
+
{
|
|
619
|
+
class: "cm-custom-search-panel-expand"
|
|
620
|
+
},
|
|
621
|
+
[this.expand.dom]
|
|
622
|
+
)
|
|
623
|
+
];
|
|
624
|
+
}
|
|
625
|
+
initSearchLine(t) {
|
|
626
|
+
const n = {
|
|
627
|
+
current: null
|
|
628
|
+
}, r = () => {
|
|
629
|
+
var c;
|
|
630
|
+
(c = n.current) == null || c.focus(), n.current && !n.current.classList.contains(
|
|
631
|
+
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
632
|
+
) && n.current.classList.add(
|
|
633
|
+
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
634
|
+
);
|
|
635
|
+
}, o = () => {
|
|
636
|
+
var c;
|
|
637
|
+
(c = n.current) == null || c.blur(), n.current && n.current.classList.remove(
|
|
638
|
+
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
639
|
+
);
|
|
640
|
+
};
|
|
641
|
+
return this.searchField = D("input", {
|
|
642
|
+
value: this.query.search,
|
|
643
|
+
placeholder: v(t, "查找"),
|
|
644
|
+
title: v(t, "查找"),
|
|
645
|
+
class: "cm-custom-text-field",
|
|
646
|
+
name: "search",
|
|
647
|
+
form: "",
|
|
648
|
+
"main-field": "true",
|
|
649
|
+
onchange: this.commit,
|
|
650
|
+
onkeyup: this.commit,
|
|
651
|
+
onfocus: r,
|
|
652
|
+
onblur: o
|
|
653
|
+
}), this.caseField = new en({
|
|
654
|
+
checked: this.query.caseSensitive,
|
|
655
|
+
onchange: () => {
|
|
656
|
+
this.searchField.focus(), this.commit();
|
|
657
|
+
},
|
|
658
|
+
name: "case",
|
|
659
|
+
title: v(t, "区分大小写")
|
|
660
|
+
}), this.reField = new tn({
|
|
661
|
+
name: "re",
|
|
662
|
+
checked: this.query.regexp,
|
|
663
|
+
onchange: () => {
|
|
664
|
+
this.searchField.focus(), this.commit();
|
|
665
|
+
},
|
|
666
|
+
title: v(t, "正则表达式")
|
|
667
|
+
}), this.wordField = new nn({
|
|
668
|
+
name: "word",
|
|
669
|
+
checked: this.query.wholeWord,
|
|
670
|
+
onchange: () => {
|
|
671
|
+
this.searchField.focus(), this.commit();
|
|
672
|
+
},
|
|
673
|
+
title: v(t, "全词匹配")
|
|
674
|
+
}), this.arrowUp = new rn({
|
|
675
|
+
name: "previous",
|
|
676
|
+
onclick: () => {
|
|
677
|
+
ge(t), this.updateMatchCount(t.state, this.query);
|
|
678
|
+
},
|
|
679
|
+
title: v(t, "上一个匹配")
|
|
680
|
+
}), this.arrowDown = new on({
|
|
681
|
+
name: "next",
|
|
682
|
+
onclick: () => {
|
|
683
|
+
xe(t), this.updateMatchCount(t.state, this.query);
|
|
684
|
+
},
|
|
685
|
+
title: v(t, "下一个匹配")
|
|
686
|
+
}), n.current = D(
|
|
687
|
+
"div",
|
|
688
|
+
{
|
|
689
|
+
class: "cm-custom-search-panel-content-input-wrapper"
|
|
690
|
+
},
|
|
691
|
+
[
|
|
692
|
+
this.searchField,
|
|
693
|
+
// enter.dom,
|
|
694
|
+
this.caseField.dom,
|
|
695
|
+
this.reField.dom,
|
|
696
|
+
this.wordField.dom
|
|
697
|
+
]
|
|
698
|
+
), D(
|
|
699
|
+
"div",
|
|
700
|
+
{
|
|
701
|
+
class: "cm-custom-search-panel-content-top"
|
|
702
|
+
},
|
|
703
|
+
[
|
|
704
|
+
n.current,
|
|
705
|
+
this.matchCount.dom,
|
|
706
|
+
D(
|
|
707
|
+
"div",
|
|
708
|
+
{
|
|
709
|
+
class: "cm-custom-search-action-wrapper"
|
|
710
|
+
},
|
|
711
|
+
[
|
|
712
|
+
this.arrowUp.dom,
|
|
713
|
+
this.arrowDown.dom,
|
|
714
|
+
new an({
|
|
715
|
+
name: "close-icon",
|
|
716
|
+
onclick: () => wt(t),
|
|
717
|
+
title: v(t, "关闭")
|
|
718
|
+
}).dom
|
|
719
|
+
]
|
|
720
|
+
)
|
|
721
|
+
]
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
initReplaceLine(t) {
|
|
725
|
+
const n = {
|
|
726
|
+
current: null
|
|
727
|
+
}, r = () => {
|
|
728
|
+
var c;
|
|
729
|
+
(c = n.current) == null || c.focus(), n.current && !n.current.classList.contains(
|
|
730
|
+
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
731
|
+
) && n.current.classList.add(
|
|
732
|
+
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
733
|
+
);
|
|
734
|
+
}, o = () => {
|
|
735
|
+
var c;
|
|
736
|
+
(c = n.current) == null || c.blur(), n.current && n.current.classList.remove(
|
|
737
|
+
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
738
|
+
);
|
|
739
|
+
};
|
|
740
|
+
return this.replaceField = D("input", {
|
|
741
|
+
value: this.query.replace,
|
|
742
|
+
placeholder: v(t, "替换"),
|
|
743
|
+
title: v(t, "替换"),
|
|
744
|
+
class: "cm-custom-text-field",
|
|
745
|
+
name: "replace",
|
|
746
|
+
form: "",
|
|
747
|
+
onchange: this.commit,
|
|
748
|
+
onkeyup: this.commit,
|
|
749
|
+
onfocus: r,
|
|
750
|
+
onblur: o
|
|
751
|
+
}), this.replace = new cn({
|
|
752
|
+
name: "replace",
|
|
753
|
+
onclick: () => {
|
|
754
|
+
Me(t), this.updateMatchCount(t.state, this.query);
|
|
755
|
+
},
|
|
756
|
+
title: v(t, "替换")
|
|
757
|
+
}), this.replaceAll = new sn({
|
|
758
|
+
name: "replaceAll",
|
|
759
|
+
onclick: () => {
|
|
760
|
+
Nt(t), this.updateMatchCount(t.state, this.query);
|
|
761
|
+
},
|
|
762
|
+
title: v(t, "替换所有")
|
|
763
|
+
}), n.current = D(
|
|
764
|
+
"div",
|
|
765
|
+
{
|
|
766
|
+
class: "cm-custom-search-panel-content-input-wrapper"
|
|
767
|
+
},
|
|
768
|
+
[this.replaceField]
|
|
769
|
+
), D(
|
|
770
|
+
"div",
|
|
771
|
+
{
|
|
772
|
+
class: "cm-custom-search-panel-content-bottom"
|
|
773
|
+
},
|
|
774
|
+
[n.current, this.replace.dom, this.replaceAll.dom]
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
commit() {
|
|
778
|
+
const t = new kt({
|
|
779
|
+
search: this.searchField.value,
|
|
780
|
+
caseSensitive: this.caseField.checked,
|
|
781
|
+
regexp: this.reField.checked,
|
|
782
|
+
wholeWord: this.wordField.checked,
|
|
783
|
+
replace: this.replaceField.value
|
|
784
|
+
});
|
|
785
|
+
t.eq(this.query) || (this.query = t, this.view.dispatch({ effects: be.of(t) })), this.updateMatchCount(this.view.state, this.query);
|
|
786
|
+
}
|
|
787
|
+
keydown(t) {
|
|
788
|
+
dt(this.view, t, "search-panel") ? t.preventDefault() : (t.keyCode === 13 || t.key === "Enter") && t.target === this.searchField ? (t.preventDefault(), (t.shiftKey ? ge : xe)(this.view)) : (t.keyCode === 13 || t.key === "Enter") && t.target === this.replaceField && (t.preventDefault(), Me(this.view));
|
|
789
|
+
}
|
|
790
|
+
updateMatchCount(t, n) {
|
|
791
|
+
this.matchCount.data = {
|
|
792
|
+
...un(t, n),
|
|
793
|
+
searching: !!n.search
|
|
794
|
+
}, this.matchCount.data.matchCount > 0 ? (this.replace.disabled = !1, this.replaceAll.disabled = !1, this.arrowUp.disabled = !1, this.arrowDown.disabled = !1) : (this.replace.disabled = !0, this.replaceAll.disabled = !0, this.arrowUp.disabled = !0, this.arrowDown.disabled = !0);
|
|
795
|
+
}
|
|
796
|
+
update(t) {
|
|
797
|
+
for (const n of t.transactions)
|
|
798
|
+
for (const r of n.effects)
|
|
799
|
+
r.is(be) && !r.value.eq(this.query) && (this.setQuery(r.value), this.updateMatchCount(t.state, r.value));
|
|
800
|
+
}
|
|
801
|
+
setQuery(t) {
|
|
802
|
+
this.query = t, this.searchField.value = t.search, this.replaceField.value = t.replace, this.caseField.checked = t.caseSensitive, this.reField.checked = t.regexp, this.wordField.checked = t.wholeWord;
|
|
803
|
+
}
|
|
804
|
+
mount() {
|
|
805
|
+
this.searchField.select();
|
|
806
|
+
}
|
|
807
|
+
get top() {
|
|
808
|
+
return !0;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
function v(e, t) {
|
|
812
|
+
return e.state.phrase(t);
|
|
813
|
+
}
|
|
814
|
+
function un(e, t) {
|
|
815
|
+
try {
|
|
816
|
+
const { from: n, to: r } = e.selection.main;
|
|
817
|
+
let o = 0, c = -1;
|
|
818
|
+
const s = t.getCursor(e);
|
|
819
|
+
let a = s.next();
|
|
820
|
+
for (; !a.done; )
|
|
821
|
+
a.value.from === n && a.value.to === r && (c = o), a = s.next(), o++;
|
|
822
|
+
return { matchIndex: c, matchCount: o };
|
|
823
|
+
} catch {
|
|
824
|
+
return { matchIndex: -1, matchCount: 0 };
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
function mn(e) {
|
|
828
|
+
let t = !1, n = 0, r = 0;
|
|
829
|
+
const o = (a) => {
|
|
830
|
+
if (a.preventDefault(), a.stopPropagation(), !t || !(e != null && e.dom))
|
|
831
|
+
return;
|
|
832
|
+
const i = n - a.clientX + r;
|
|
833
|
+
e.dom.style.width = `${i}px`;
|
|
834
|
+
}, c = (a) => {
|
|
835
|
+
a.preventDefault(), a.stopPropagation(), t = !1, n = 0, r = 0, document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", c);
|
|
836
|
+
};
|
|
837
|
+
return (a) => {
|
|
838
|
+
a.preventDefault(), a.stopPropagation(), t = !0, n = a.clientX, r = (e == null ? void 0 : e.dom.clientWidth) ?? 0, document.addEventListener("mousemove", o), document.addEventListener("mouseup", c);
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
const hn = () => [
|
|
842
|
+
Xt,
|
|
843
|
+
It({
|
|
844
|
+
createPanel: (e) => new dn(e)
|
|
845
|
+
}),
|
|
846
|
+
me.of([...Ct, { key: "Ctrl-g", run: vt }])
|
|
847
|
+
];
|
|
848
|
+
function $e() {
|
|
849
|
+
const e = J();
|
|
850
|
+
return G(
|
|
851
|
+
() => e.inject([
|
|
852
|
+
pe.whole.of((t) => {
|
|
853
|
+
if (t.name.startsWith("ATXHeading"))
|
|
854
|
+
return {
|
|
855
|
+
type: "className",
|
|
856
|
+
className: "heading"
|
|
857
|
+
};
|
|
858
|
+
if (t.name === "Emphasis")
|
|
859
|
+
return {
|
|
860
|
+
type: "className",
|
|
861
|
+
className: "emphasis"
|
|
862
|
+
};
|
|
863
|
+
if (t.name === "StrongEmphasis")
|
|
864
|
+
return {
|
|
865
|
+
type: "className",
|
|
866
|
+
className: "strong-emphasis"
|
|
867
|
+
};
|
|
868
|
+
if (t.name === "ListMark" || t.name === "QuoteMark")
|
|
869
|
+
return {
|
|
870
|
+
type: "className",
|
|
871
|
+
className: "mark"
|
|
872
|
+
};
|
|
873
|
+
}),
|
|
874
|
+
N.theme({
|
|
875
|
+
".heading": {
|
|
876
|
+
color: "#00818C",
|
|
877
|
+
fontWeight: "bold"
|
|
878
|
+
},
|
|
879
|
+
".emphasis": {
|
|
880
|
+
fontStyle: "italic"
|
|
881
|
+
},
|
|
882
|
+
".strong-emphasis": {
|
|
883
|
+
fontWeight: "bold"
|
|
884
|
+
},
|
|
885
|
+
".mark": {
|
|
886
|
+
color: "#4E40E5"
|
|
887
|
+
}
|
|
888
|
+
})
|
|
889
|
+
]),
|
|
890
|
+
[e]
|
|
891
|
+
), null;
|
|
892
|
+
}
|
|
893
|
+
function Pe() {
|
|
894
|
+
const e = J();
|
|
895
|
+
return G(() => e.inject([lt]), [e]), null;
|
|
896
|
+
}
|
|
897
|
+
class re {
|
|
898
|
+
constructor(t) {
|
|
899
|
+
this.node = t.node, this.from = t.from, this.to = t.to, this.spaceBefore = t.spaceBefore, this.spaceAfter = t.spaceAfter, this.type = t.type, this.item = t.item;
|
|
900
|
+
}
|
|
901
|
+
blank(t, n = !0) {
|
|
902
|
+
let r = this.spaceBefore + (this.node.name === "Blockquote" ? ">" : "");
|
|
903
|
+
if (t !== null) {
|
|
904
|
+
for (; r.length < t; )
|
|
905
|
+
r += " ";
|
|
906
|
+
return r;
|
|
907
|
+
}
|
|
908
|
+
for (let o = this.to - this.from - r.length - this.spaceAfter.length; o > 0; o--)
|
|
909
|
+
r += " ";
|
|
910
|
+
return r + (n ? this.spaceAfter : "");
|
|
911
|
+
}
|
|
912
|
+
marker(t, n) {
|
|
913
|
+
if (this.node.name === "OrderedList" && this.item) {
|
|
914
|
+
const r = We(this.item, t);
|
|
915
|
+
if (r) {
|
|
916
|
+
const o = Number(r[2]) + n;
|
|
917
|
+
return `${this.spaceBefore}${o}.${this.spaceAfter}`;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
return `${this.spaceBefore}${this.type}${this.spaceAfter}`;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
function Ue(e, t) {
|
|
924
|
+
const n = [];
|
|
925
|
+
let r = e;
|
|
926
|
+
for (; r && r.name !== "FencedCode"; ) {
|
|
927
|
+
if (r.name === "ListItem" || r.name === "Blockquote") {
|
|
928
|
+
const o = t.lineAt(r.from), c = r.from - o.from, s = o.text.slice(c);
|
|
929
|
+
let a = null;
|
|
930
|
+
if (r.name === "Blockquote") {
|
|
931
|
+
const i = /^ *>( ?)/.exec(s);
|
|
932
|
+
i && (a = new re({
|
|
933
|
+
node: r,
|
|
934
|
+
from: c,
|
|
935
|
+
to: c + i[0].length,
|
|
936
|
+
spaceBefore: "",
|
|
937
|
+
spaceAfter: i[1],
|
|
938
|
+
type: ">",
|
|
939
|
+
item: null
|
|
940
|
+
}));
|
|
941
|
+
} else if (r.name === "ListItem" && r.parent) {
|
|
942
|
+
if (r.parent.name === "OrderedList") {
|
|
943
|
+
const i = /^( *)(\d+)([.)])( *)/.exec(s);
|
|
944
|
+
if (i) {
|
|
945
|
+
let l = i[4], d = i[0].length;
|
|
946
|
+
l.length >= 4 && (l = l.slice(0, l.length - 4), d -= 4), a = new re({
|
|
947
|
+
node: r.parent,
|
|
948
|
+
from: c,
|
|
949
|
+
to: c + d,
|
|
950
|
+
spaceBefore: i[1],
|
|
951
|
+
spaceAfter: l,
|
|
952
|
+
type: i[2],
|
|
953
|
+
item: r
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
} else if (r.parent.name === "BulletList") {
|
|
957
|
+
const i = /^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(s);
|
|
958
|
+
if (i) {
|
|
959
|
+
let l = i[4], d = i[0].length;
|
|
960
|
+
l.length > 4 && (l = l.slice(0, l.length - 4), d -= 4);
|
|
961
|
+
let m = i[2];
|
|
962
|
+
i[3] && (m += i[3].replace(/[xX]/, " ")), a = new re({
|
|
963
|
+
node: r.parent,
|
|
964
|
+
from: c,
|
|
965
|
+
to: c + d,
|
|
966
|
+
spaceBefore: i[1],
|
|
967
|
+
spaceAfter: l,
|
|
968
|
+
type: m,
|
|
969
|
+
item: r
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
a && n.unshift(a);
|
|
975
|
+
}
|
|
976
|
+
r = r.parent;
|
|
977
|
+
}
|
|
978
|
+
return n;
|
|
979
|
+
}
|
|
980
|
+
function We(e, t) {
|
|
981
|
+
return /^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from, e.from + 10));
|
|
982
|
+
}
|
|
983
|
+
function le(e, t, n, r = 0) {
|
|
984
|
+
let o = -1, c = e;
|
|
985
|
+
for (; c; ) {
|
|
986
|
+
if (c.name === "ListItem") {
|
|
987
|
+
const s = We(c, t);
|
|
988
|
+
if (!s)
|
|
989
|
+
break;
|
|
990
|
+
const a = Number(s[2]);
|
|
991
|
+
if (o >= 0) {
|
|
992
|
+
if (a !== o + 1)
|
|
993
|
+
break;
|
|
994
|
+
n.push({
|
|
995
|
+
from: c.from + s[1].length,
|
|
996
|
+
to: c.from + s[0].length,
|
|
997
|
+
insert: String(o + 2 + r)
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
o = a;
|
|
1001
|
+
}
|
|
1002
|
+
c = c.nextSibling;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
function fe(e, t) {
|
|
1006
|
+
const n = /^[ \t]*/.exec(e), r = n ? n[0].length : 0;
|
|
1007
|
+
if (!r || t.facet(Dt) !== " ")
|
|
1008
|
+
return e;
|
|
1009
|
+
const o = W(e, 4, r);
|
|
1010
|
+
let c = "";
|
|
1011
|
+
for (let s = o; s > 0; )
|
|
1012
|
+
s >= 4 ? (c += " ", s -= 4) : (c += " ", s--);
|
|
1013
|
+
return c + e.slice(r);
|
|
1014
|
+
}
|
|
1015
|
+
function pn(e, t, n, r, o) {
|
|
1016
|
+
if (!n.item)
|
|
1017
|
+
return null;
|
|
1018
|
+
const { doc: c } = e, s = n.node.firstChild, a = n.node.getChild("ListItem", "ListItem");
|
|
1019
|
+
if (!s)
|
|
1020
|
+
return null;
|
|
1021
|
+
if (s.to >= r || a && a.to < r || o.from > 0 && !/[^\s>]/.test(c.lineAt(o.from - 1).text)) {
|
|
1022
|
+
const i = [], l = t.length > 1 ? t[t.length - 2] : null;
|
|
1023
|
+
let d, m = "";
|
|
1024
|
+
return l ? (d = o.from + (l.item ? l.from : l.to), l.item && (m = l.marker(c, 1))) : d = o.from, i.push({ from: d, to: r, insert: m }), n.node.name === "OrderedList" && n.item && le(n.item, c, i, -2), (l == null ? void 0 : l.node.name) === "OrderedList" && l.item && le(l.item, c, i), {
|
|
1025
|
+
range: H.cursor(d + m.length),
|
|
1026
|
+
changes: i
|
|
1027
|
+
};
|
|
1028
|
+
} else {
|
|
1029
|
+
const i = Ye(t, e, o);
|
|
1030
|
+
return {
|
|
1031
|
+
range: H.cursor(r + i.length + 1),
|
|
1032
|
+
changes: { from: o.from, insert: i + e.lineBreak }
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
function fn(e, t, n) {
|
|
1037
|
+
if (t.node.name !== "Blockquote" || !n.from)
|
|
1038
|
+
return null;
|
|
1039
|
+
const r = e.doc.lineAt(n.from - 1), o = />\s*$/.exec(r.text);
|
|
1040
|
+
if (o && o.index === t.from) {
|
|
1041
|
+
const c = e.changes([
|
|
1042
|
+
{ from: r.from + o.index, to: r.to },
|
|
1043
|
+
{ from: n.from + t.from, to: n.to }
|
|
1044
|
+
]);
|
|
1045
|
+
return {
|
|
1046
|
+
range: H.cursor(c.mapPos(n.from)),
|
|
1047
|
+
changes: c
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
return null;
|
|
1051
|
+
}
|
|
1052
|
+
function gn(e, t, n, r, o) {
|
|
1053
|
+
const { doc: c } = e, s = [];
|
|
1054
|
+
n.node.name === "OrderedList" && n.item && le(n.item, c, s);
|
|
1055
|
+
const a = !!n.item && n.item.from < o.from;
|
|
1056
|
+
let i = "";
|
|
1057
|
+
const l = /^[\s\d.)\-+*>]*/.exec(o.text), d = l ? l[0].length : 0;
|
|
1058
|
+
if (!a || d >= n.to)
|
|
1059
|
+
for (let p = 0; p < t.length; p++) {
|
|
1060
|
+
const f = t[p];
|
|
1061
|
+
if (p === t.length - 1 && !a)
|
|
1062
|
+
console.log("m", c), i += f.marker(c, 1);
|
|
1063
|
+
else {
|
|
1064
|
+
const h = p < t.length - 1 ? W(o.text, 4, t[p + 1].from) - i.length : null;
|
|
1065
|
+
i += f.blank(h);
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
let m = r;
|
|
1069
|
+
for (; m > o.from && /\s/.test(o.text.charAt(m - o.from - 1)); )
|
|
1070
|
+
m--;
|
|
1071
|
+
return i = fe(i, e), xn(n.node, e.doc) && (i = Ye(t, e, o) + e.lineBreak + i), s.push({ from: m, to: r, insert: e.lineBreak + i }), {
|
|
1072
|
+
range: H.cursor(m + i.length + 1),
|
|
1073
|
+
changes: s
|
|
1074
|
+
};
|
|
1075
|
+
}
|
|
1076
|
+
const jr = ({
|
|
1077
|
+
state: e,
|
|
1078
|
+
dispatch: t
|
|
1079
|
+
}) => {
|
|
1080
|
+
const n = Fe(e), { doc: r } = e;
|
|
1081
|
+
let o = !1;
|
|
1082
|
+
const c = e.changeByRange((s) => {
|
|
1083
|
+
if (!s.empty || !Ae.isActiveAt(e, s.from))
|
|
1084
|
+
return o = !0, { range: s };
|
|
1085
|
+
const a = s.from, i = r.lineAt(a), l = Ue(n.resolveInner(a, -1), r);
|
|
1086
|
+
for (; l.length && l[l.length - 1].from > a - i.from; )
|
|
1087
|
+
l.pop();
|
|
1088
|
+
if (!l.length)
|
|
1089
|
+
return o = !0, { range: s };
|
|
1090
|
+
const d = l[l.length - 1];
|
|
1091
|
+
if (d.to - d.spaceAfter.length > a - i.from)
|
|
1092
|
+
return o = !0, { range: s };
|
|
1093
|
+
const m = a >= d.to - d.spaceAfter.length, p = !/\S/.test(
|
|
1094
|
+
i.text.slice(d.to - (i.from + d.from))
|
|
1095
|
+
);
|
|
1096
|
+
if (m && p) {
|
|
1097
|
+
const f = pn(
|
|
1098
|
+
e,
|
|
1099
|
+
l,
|
|
1100
|
+
d,
|
|
1101
|
+
a,
|
|
1102
|
+
i
|
|
1103
|
+
);
|
|
1104
|
+
if (f)
|
|
1105
|
+
return f;
|
|
1106
|
+
const h = fn(e, d, i);
|
|
1107
|
+
if (h)
|
|
1108
|
+
return h;
|
|
1109
|
+
}
|
|
1110
|
+
return gn(e, l, d, a, i);
|
|
1111
|
+
});
|
|
1112
|
+
return o || c.changes.empty ? !1 : (t(e.update(c, { scrollIntoView: !0, userEvent: "input" })), !0);
|
|
1113
|
+
};
|
|
1114
|
+
function xn(e, t) {
|
|
1115
|
+
if (e.name !== "OrderedList" && e.name !== "BulletList")
|
|
1116
|
+
return !1;
|
|
1117
|
+
const n = e.firstChild, r = e.getChild("ListItem", "ListItem");
|
|
1118
|
+
if (!n || !r)
|
|
1119
|
+
return !1;
|
|
1120
|
+
const o = t.lineAt(n.to), c = t.lineAt(r.from), s = /^[\s>]*$/.test(o.text);
|
|
1121
|
+
return o.number + (s ? 0 : 1) < c.number;
|
|
1122
|
+
}
|
|
1123
|
+
function Ye(e, t, n) {
|
|
1124
|
+
let r = "";
|
|
1125
|
+
for (let o = 0; o < e.length - 1; o++) {
|
|
1126
|
+
const c = e[o], s = e[o + 1], a = W(n.text, 4, s.from) - r.length;
|
|
1127
|
+
r += c.blank(a, !0);
|
|
1128
|
+
}
|
|
1129
|
+
return fe(r, t);
|
|
1130
|
+
}
|
|
1131
|
+
function Mn(e, t) {
|
|
1132
|
+
let n = e.resolveInner(t, -1), r = t;
|
|
1133
|
+
const o = (c) => c.name === "QuoteMark" || c.name === "ListMark";
|
|
1134
|
+
for (o(n) && n.parent && (r = n.from, n = n.parent); ; ) {
|
|
1135
|
+
const c = n.childBefore(r);
|
|
1136
|
+
if (!c)
|
|
1137
|
+
break;
|
|
1138
|
+
if (o(c))
|
|
1139
|
+
r = c.from;
|
|
1140
|
+
else if ((c.name === "OrderedList" || c.name === "BulletList") && c.lastChild)
|
|
1141
|
+
n = c.lastChild, r = n.to;
|
|
1142
|
+
else
|
|
1143
|
+
break;
|
|
1144
|
+
}
|
|
1145
|
+
return n;
|
|
1146
|
+
}
|
|
1147
|
+
const Sr = ({ state: e, dispatch: t }) => {
|
|
1148
|
+
const n = Fe(e);
|
|
1149
|
+
let r = !1;
|
|
1150
|
+
const o = e.changeByRange((c) => {
|
|
1151
|
+
const { from: s, to: a } = c;
|
|
1152
|
+
if (a !== s || !Ae.isActiveAt(e, s))
|
|
1153
|
+
return r = !0, { range: c };
|
|
1154
|
+
const i = e.doc.lineAt(s), l = Ue(Mn(n, s), e.doc);
|
|
1155
|
+
if (!l.length)
|
|
1156
|
+
return r = !0, { range: c };
|
|
1157
|
+
const d = l[l.length - 1], m = d.to - d.spaceAfter.length + (d.spaceAfter ? 1 : 0);
|
|
1158
|
+
if (s - i.from > m && !/\S/.test(i.text.slice(m, s - i.from))) {
|
|
1159
|
+
const f = i.from + m;
|
|
1160
|
+
return {
|
|
1161
|
+
range: H.cursor(f),
|
|
1162
|
+
changes: { from: f, to: s }
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
const p = !d.item || i.from <= d.item.from || !/\S/.test(i.text.slice(0, d.to));
|
|
1166
|
+
if (s - i.from === m && p) {
|
|
1167
|
+
const f = i.from + d.from;
|
|
1168
|
+
if (d.item && d.node.from < d.item.from && /\S/.test(i.text.slice(d.from, d.to))) {
|
|
1169
|
+
let h = d.blank(
|
|
1170
|
+
W(i.text, 4, d.to) - W(i.text, 4, d.from)
|
|
1171
|
+
);
|
|
1172
|
+
return f === i.from && (h = fe(h, e)), {
|
|
1173
|
+
range: H.cursor(f + h.length),
|
|
1174
|
+
changes: { from: f, to: i.from + d.to, insert: h }
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
if (f < s)
|
|
1178
|
+
return {
|
|
1179
|
+
range: H.cursor(f),
|
|
1180
|
+
changes: { from: f, to: s }
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
return r = !0, { range: c };
|
|
1184
|
+
});
|
|
1185
|
+
return r || o.changes.empty ? !1 : (t(
|
|
1186
|
+
e.update(o, { scrollIntoView: !0, userEvent: "delete" })
|
|
1187
|
+
), !0);
|
|
1188
|
+
}, bn = ({ state: e, dispatch: t }) => e.selection.main.empty ? (t(
|
|
1189
|
+
e.update(
|
|
1190
|
+
{
|
|
1191
|
+
changes: { from: e.selection.main.head, insert: " " },
|
|
1192
|
+
// 插入后,将光标移动到空格后面
|
|
1193
|
+
selection: H.cursor(e.selection.main.head + 2)
|
|
1194
|
+
},
|
|
1195
|
+
{ userEvent: "input" }
|
|
1196
|
+
)
|
|
1197
|
+
), !0) : !1, P = "lowest";
|
|
1198
|
+
function Qe({ isJinja2Template: e }) {
|
|
1199
|
+
const t = J();
|
|
1200
|
+
return G(
|
|
1201
|
+
() => t.inject([
|
|
1202
|
+
pe.whole.of((n) => {
|
|
1203
|
+
if ((n.name === "JinjaStatement" || n.name === "JinjaRawOpenStatement" || n.name === "JinjaRawCloseStatement") && e)
|
|
1204
|
+
return {
|
|
1205
|
+
type: "className",
|
|
1206
|
+
className: "jinja-statement",
|
|
1207
|
+
prec: P
|
|
1208
|
+
};
|
|
1209
|
+
if (n.name === "JinjaStringLiteral" && e)
|
|
1210
|
+
return {
|
|
1211
|
+
type: "className",
|
|
1212
|
+
className: "jinja-string",
|
|
1213
|
+
prec: P
|
|
1214
|
+
};
|
|
1215
|
+
if (n.name === "JinjaComment" && e)
|
|
1216
|
+
return {
|
|
1217
|
+
type: "className",
|
|
1218
|
+
className: "jinja-comment",
|
|
1219
|
+
prec: P
|
|
1220
|
+
};
|
|
1221
|
+
if (n.name === "JinjaExpression")
|
|
1222
|
+
return {
|
|
1223
|
+
type: "className",
|
|
1224
|
+
className: "jinja-expression",
|
|
1225
|
+
prec: P
|
|
1226
|
+
};
|
|
1227
|
+
if ((n.name === "JinjaFilterName" || n.name === "JinjaStatementStart" || n.name === "JinjaStatementEnd" || n.name === "JinjaKeyword" || n.name === "JinjaFilterName") && e)
|
|
1228
|
+
return {
|
|
1229
|
+
type: "className",
|
|
1230
|
+
className: "jinja-statement-keyword",
|
|
1231
|
+
prec: P
|
|
1232
|
+
};
|
|
1233
|
+
}),
|
|
1234
|
+
N.theme({
|
|
1235
|
+
".jinja-statement": {
|
|
1236
|
+
color: "#060709CC"
|
|
1237
|
+
},
|
|
1238
|
+
".jinja-statement-keyword": {
|
|
1239
|
+
color: "#D1009D"
|
|
1240
|
+
},
|
|
1241
|
+
".jinja-string": {
|
|
1242
|
+
color: "#060709CC"
|
|
1243
|
+
},
|
|
1244
|
+
".jinja-comment": {
|
|
1245
|
+
color: "#0607094D"
|
|
1246
|
+
},
|
|
1247
|
+
".jinja-expression": {
|
|
1248
|
+
color: "var(--Green-COZColorGreen7, #00A136)"
|
|
1249
|
+
}
|
|
1250
|
+
})
|
|
1251
|
+
]),
|
|
1252
|
+
[t, e]
|
|
1253
|
+
), null;
|
|
1254
|
+
}
|
|
1255
|
+
const yn = At({
|
|
1256
|
+
langs: [import("./go-syntax-067c4f5d.mjs").then((e) => e.tmLanguage)],
|
|
1257
|
+
themes: [import("./go-theme-062a6df6.mjs")],
|
|
1258
|
+
engine: Et(import("/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/shiki@3.3.0/node_modules/shiki/dist/wasm.mjs"))
|
|
1259
|
+
}), wn = zt({
|
|
1260
|
+
highlighter: yn,
|
|
1261
|
+
language: "go-template",
|
|
1262
|
+
theme: "one-light"
|
|
1263
|
+
}), we = [
|
|
1264
|
+
N.theme({
|
|
1265
|
+
".cm-gutters": {
|
|
1266
|
+
backgroundColor: "transparent",
|
|
1267
|
+
borderRight: "none"
|
|
1268
|
+
},
|
|
1269
|
+
".cm-scroller": {
|
|
1270
|
+
paddingLeft: "10px",
|
|
1271
|
+
paddingRight: "6px !important"
|
|
1272
|
+
}
|
|
1273
|
+
}),
|
|
1274
|
+
ze.high(me.of([{ key: "Tab", run: bn }, mt]))
|
|
1275
|
+
], Nn = Y(
|
|
1276
|
+
({
|
|
1277
|
+
defaultValue: e,
|
|
1278
|
+
onChange: t,
|
|
1279
|
+
variables: n,
|
|
1280
|
+
height: r,
|
|
1281
|
+
minHeight: o,
|
|
1282
|
+
maxHeight: c,
|
|
1283
|
+
fontSize: s = 13,
|
|
1284
|
+
forbidJinjaHighlight: a,
|
|
1285
|
+
forbidVariables: i,
|
|
1286
|
+
readOnly: l,
|
|
1287
|
+
linePlaceholder: d = "请输入内容,支持按此格式书写变量:{{USER_NAME}}",
|
|
1288
|
+
customExtensions: m = [],
|
|
1289
|
+
autoScrollToBottom: p,
|
|
1290
|
+
onBlur: f,
|
|
1291
|
+
isGoTemplate: h,
|
|
1292
|
+
onFocus: x,
|
|
1293
|
+
canSearch: g,
|
|
1294
|
+
children: w,
|
|
1295
|
+
isJinja2Template: j
|
|
1296
|
+
}, L) => {
|
|
1297
|
+
const T = S(null);
|
|
1298
|
+
q(L, () => ({
|
|
1299
|
+
setEditorValue: (k) => {
|
|
1300
|
+
var C;
|
|
1301
|
+
const I = T.current;
|
|
1302
|
+
I && ((C = I == null ? void 0 : I.setValue) == null || C.call(I, k || ""));
|
|
1303
|
+
},
|
|
1304
|
+
insertText: (k) => {
|
|
1305
|
+
const I = T.current;
|
|
1306
|
+
if (!I)
|
|
1307
|
+
return;
|
|
1308
|
+
const C = I.getSelection();
|
|
1309
|
+
C && I.replaceText({
|
|
1310
|
+
...C,
|
|
1311
|
+
text: k,
|
|
1312
|
+
cursorOffset: 0
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
}));
|
|
1316
|
+
const b = Ce(() => {
|
|
1317
|
+
const k = [...we, ...m], I = g ? [...hn()] : [];
|
|
1318
|
+
return h ? [...k, wn, ...I] : [...k, ...I];
|
|
1319
|
+
}, [m, we, h, g]);
|
|
1320
|
+
return z(() => {
|
|
1321
|
+
(j || h) && setTimeout(() => {
|
|
1322
|
+
var k;
|
|
1323
|
+
(k = T.current) == null || k.updateWholeDecorations();
|
|
1324
|
+
}, 150);
|
|
1325
|
+
}, [n, j, h]), /* @__PURE__ */ y(X, { children: [
|
|
1326
|
+
/* @__PURE__ */ u(
|
|
1327
|
+
ot,
|
|
1328
|
+
{
|
|
1329
|
+
plugins: Ee,
|
|
1330
|
+
defaultValue: e,
|
|
1331
|
+
options: {
|
|
1332
|
+
editable: !l,
|
|
1333
|
+
readOnly: l,
|
|
1334
|
+
height: r,
|
|
1335
|
+
minHeight: o || r,
|
|
1336
|
+
maxHeight: c || r,
|
|
1337
|
+
fontSize: s
|
|
1338
|
+
},
|
|
1339
|
+
onChange: (k) => t == null ? void 0 : t(k.value),
|
|
1340
|
+
onFocus: x,
|
|
1341
|
+
onBlur: f,
|
|
1342
|
+
extensions: b,
|
|
1343
|
+
didMount: (k) => {
|
|
1344
|
+
T.current = k, p && k.$view.dispatch({
|
|
1345
|
+
effects: N.scrollIntoView(
|
|
1346
|
+
k.$view.state.doc.length
|
|
1347
|
+
)
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
),
|
|
1352
|
+
!i && /* @__PURE__ */ u(Wt, { variables: n || [], isGoTemplate: h }),
|
|
1353
|
+
/* @__PURE__ */ u(Pe, {}),
|
|
1354
|
+
!a && !h && /* @__PURE__ */ y(ue, { children: [
|
|
1355
|
+
/* @__PURE__ */ u(
|
|
1356
|
+
Jt,
|
|
1357
|
+
{
|
|
1358
|
+
variables: n,
|
|
1359
|
+
isNormalTemplate: !j && !h
|
|
1360
|
+
}
|
|
1361
|
+
),
|
|
1362
|
+
/* @__PURE__ */ u(Qe, { isJinja2Template: j })
|
|
1363
|
+
] }),
|
|
1364
|
+
/* @__PURE__ */ u($e, {}),
|
|
1365
|
+
/* @__PURE__ */ u(ct, { children: d }),
|
|
1366
|
+
w
|
|
1367
|
+
] });
|
|
1368
|
+
}
|
|
1369
|
+
);
|
|
1370
|
+
var de = /* @__PURE__ */ ((e) => (e[e.System = 1] = "System", e[e.User = 2] = "User", e[e.Assistant = 3] = "Assistant", e[e.Tool = 4] = "Tool", e[e.Placeholder = 20] = "Placeholder", e))(de || {});
|
|
1371
|
+
const kn = "_header_1dclu_13", V = {
|
|
1372
|
+
"prompt-editor-container": "_prompt-editor-container_1dclu_3",
|
|
1373
|
+
header: kn,
|
|
1374
|
+
"drag-btn": "_drag-btn_1dclu_23",
|
|
1375
|
+
"prompt-editor-container-error": "_prompt-editor-container-error_1dclu_29",
|
|
1376
|
+
"prompt-editor-btn-group": "_prompt-editor-btn-group_1dclu_32",
|
|
1377
|
+
"prompt-editor-container-active": "_prompt-editor-container-active_1dclu_46",
|
|
1378
|
+
"prompt-editor-container-disabled": "_prompt-editor-container-disabled_1dclu_52",
|
|
1379
|
+
"role-display": "_role-display_1dclu_61",
|
|
1380
|
+
"full-screen": "_full-screen_1dclu_64"
|
|
1381
|
+
};
|
|
1382
|
+
function In({
|
|
1383
|
+
value: e,
|
|
1384
|
+
onChange: t,
|
|
1385
|
+
disabled: n,
|
|
1386
|
+
messageTypeList: r = []
|
|
1387
|
+
}) {
|
|
1388
|
+
var s, a;
|
|
1389
|
+
const [o, c] = F(!1);
|
|
1390
|
+
return n ? /* @__PURE__ */ u(
|
|
1391
|
+
E.Text,
|
|
1392
|
+
{
|
|
1393
|
+
size: "small",
|
|
1394
|
+
type: "tertiary",
|
|
1395
|
+
className: A("px-2", V["role-display"], "variable-text"),
|
|
1396
|
+
children: (((s = r.find((i) => i.value === e)) == null ? void 0 : s.label) || e) ?? "-"
|
|
1397
|
+
}
|
|
1398
|
+
) : /* @__PURE__ */ u(
|
|
1399
|
+
ee,
|
|
1400
|
+
{
|
|
1401
|
+
visible: o,
|
|
1402
|
+
trigger: "custom",
|
|
1403
|
+
position: "bottomLeft",
|
|
1404
|
+
showTick: !1,
|
|
1405
|
+
render: /* @__PURE__ */ u(
|
|
1406
|
+
ee.SubMenu,
|
|
1407
|
+
{
|
|
1408
|
+
mode: "selection",
|
|
1409
|
+
selectedKeys: [`${e}`],
|
|
1410
|
+
onSelectionChange: (i) => {
|
|
1411
|
+
t == null || t(Number(i)), c(!1);
|
|
1412
|
+
},
|
|
1413
|
+
children: r == null ? void 0 : r.map((i) => /* @__PURE__ */ u(
|
|
1414
|
+
ee.Item,
|
|
1415
|
+
{
|
|
1416
|
+
itemKey: `${i.value}`,
|
|
1417
|
+
className: A("!px-2", {
|
|
1418
|
+
"coz-mg-primary": `${i}` == `${e}`
|
|
1419
|
+
}),
|
|
1420
|
+
children: /* @__PURE__ */ u(E.Text, { className: "variable-text", children: i.label })
|
|
1421
|
+
},
|
|
1422
|
+
i.value
|
|
1423
|
+
))
|
|
1424
|
+
}
|
|
1425
|
+
),
|
|
1426
|
+
onClickOutSide: () => c(!1),
|
|
1427
|
+
children: /* @__PURE__ */ y(
|
|
1428
|
+
gt,
|
|
1429
|
+
{
|
|
1430
|
+
size: "mini",
|
|
1431
|
+
color: "secondary",
|
|
1432
|
+
onClick: () => c(!0),
|
|
1433
|
+
className: A(V["role-display"], "variable-text"),
|
|
1434
|
+
children: [
|
|
1435
|
+
(((a = r.find((i) => i.value === e)) == null ? void 0 : a.label) || e) ?? "-",
|
|
1436
|
+
/* @__PURE__ */ u(jt, { className: "ml-0.5" })
|
|
1437
|
+
]
|
|
1438
|
+
}
|
|
1439
|
+
)
|
|
1440
|
+
}
|
|
1441
|
+
);
|
|
1442
|
+
}
|
|
1443
|
+
const Tr = Y(
|
|
1444
|
+
({
|
|
1445
|
+
className: e,
|
|
1446
|
+
message: t,
|
|
1447
|
+
dragBtnHidden: n,
|
|
1448
|
+
messageTypeDisabled: r,
|
|
1449
|
+
variables: o,
|
|
1450
|
+
disabled: c,
|
|
1451
|
+
isDrag: s,
|
|
1452
|
+
onMessageChange: a,
|
|
1453
|
+
onMessageTypeChange: i,
|
|
1454
|
+
placeholder: l,
|
|
1455
|
+
messageTypeList: d,
|
|
1456
|
+
leftActionBtns: m,
|
|
1457
|
+
rightActionBtns: p,
|
|
1458
|
+
children: f,
|
|
1459
|
+
hideActionWrap: h,
|
|
1460
|
+
isFullscreen: x,
|
|
1461
|
+
...g
|
|
1462
|
+
}, w) => {
|
|
1463
|
+
const [j, L] = F(!1), T = (k) => {
|
|
1464
|
+
a == null || a({ ...t, content: k });
|
|
1465
|
+
}, b = c || s;
|
|
1466
|
+
return /* @__PURE__ */ y(
|
|
1467
|
+
"div",
|
|
1468
|
+
{
|
|
1469
|
+
className: A(
|
|
1470
|
+
V["prompt-editor-container"],
|
|
1471
|
+
{
|
|
1472
|
+
[V["prompt-editor-container-active"]]: j,
|
|
1473
|
+
[V["prompt-editor-container-disabled"]]: c,
|
|
1474
|
+
[V["full-screen"]]: x
|
|
1475
|
+
},
|
|
1476
|
+
e
|
|
1477
|
+
),
|
|
1478
|
+
children: [
|
|
1479
|
+
h ? null : /* @__PURE__ */ y("div", { className: V.header, children: [
|
|
1480
|
+
/* @__PURE__ */ y(Z, { spacing: 2, children: [
|
|
1481
|
+
n ? null : /* @__PURE__ */ u(
|
|
1482
|
+
xt,
|
|
1483
|
+
{
|
|
1484
|
+
color: "secondary",
|
|
1485
|
+
size: "mini",
|
|
1486
|
+
icon: /* @__PURE__ */ u(St, { fontSize: 14 }),
|
|
1487
|
+
className: A("drag !w-[14px]", V["drag-btn"])
|
|
1488
|
+
}
|
|
1489
|
+
),
|
|
1490
|
+
t != null && t.message_type ? /* @__PURE__ */ u(
|
|
1491
|
+
In,
|
|
1492
|
+
{
|
|
1493
|
+
value: t.message_type,
|
|
1494
|
+
onChange: i,
|
|
1495
|
+
disabled: r || b,
|
|
1496
|
+
messageTypeList: d
|
|
1497
|
+
}
|
|
1498
|
+
) : null,
|
|
1499
|
+
m
|
|
1500
|
+
] }),
|
|
1501
|
+
p
|
|
1502
|
+
] }),
|
|
1503
|
+
/* @__PURE__ */ u(
|
|
1504
|
+
"div",
|
|
1505
|
+
{
|
|
1506
|
+
className: A("w-full overflow-y-auto styled-scrollbar", {
|
|
1507
|
+
"py-1": (t == null ? void 0 : t.message_type) !== de.Placeholder
|
|
1508
|
+
}),
|
|
1509
|
+
children: (t == null ? void 0 : t.message_type) === de.Placeholder ? /* @__PURE__ */ u(
|
|
1510
|
+
Mt,
|
|
1511
|
+
{
|
|
1512
|
+
value: t.content,
|
|
1513
|
+
onChange: T,
|
|
1514
|
+
borderless: !0,
|
|
1515
|
+
disabled: b,
|
|
1516
|
+
style: { border: 0, borderRadius: 0 },
|
|
1517
|
+
onInput: (k) => {
|
|
1518
|
+
const I = k.target;
|
|
1519
|
+
if (I) {
|
|
1520
|
+
let { value: C } = I;
|
|
1521
|
+
if (C === "")
|
|
1522
|
+
return;
|
|
1523
|
+
/^[A-Za-z]/.test(C) || (C = C.slice(1)), C = C.replace(/[^A-Za-z0-9_]/g, ""), I.value = C;
|
|
1524
|
+
}
|
|
1525
|
+
},
|
|
1526
|
+
maxLength: Ve,
|
|
1527
|
+
max: 50,
|
|
1528
|
+
className: "!pl-3 font-sm",
|
|
1529
|
+
inputStyle: {
|
|
1530
|
+
fontSize: 13,
|
|
1531
|
+
color: "var(--Green-COZColorGreen7, #00A136)",
|
|
1532
|
+
fontFamily: "JetBrainsMonoRegular"
|
|
1533
|
+
},
|
|
1534
|
+
onFocus: () => L(!0),
|
|
1535
|
+
onBlur: () => L(!1),
|
|
1536
|
+
placeholder: "支持输入英文字母和下划线,且首字母必须是字母"
|
|
1537
|
+
},
|
|
1538
|
+
t.key || t.id
|
|
1539
|
+
) : /* @__PURE__ */ u(
|
|
1540
|
+
Nn,
|
|
1541
|
+
{
|
|
1542
|
+
...g,
|
|
1543
|
+
defaultValue: t == null ? void 0 : t.content,
|
|
1544
|
+
onChange: T,
|
|
1545
|
+
variables: o,
|
|
1546
|
+
readOnly: b,
|
|
1547
|
+
linePlaceholder: l,
|
|
1548
|
+
onFocus: () => L(!0),
|
|
1549
|
+
onBlur: () => L(!1),
|
|
1550
|
+
ref: w,
|
|
1551
|
+
children: f
|
|
1552
|
+
},
|
|
1553
|
+
(t == null ? void 0 : t.key) || (t == null ? void 0 : t.id)
|
|
1554
|
+
)
|
|
1555
|
+
}
|
|
1556
|
+
)
|
|
1557
|
+
]
|
|
1558
|
+
}
|
|
1559
|
+
);
|
|
1560
|
+
}
|
|
1561
|
+
), Ne = ut.define({
|
|
1562
|
+
combine(e) {
|
|
1563
|
+
return e[e.length - 1];
|
|
1564
|
+
}
|
|
1565
|
+
}), ke = [
|
|
1566
|
+
// diff theme
|
|
1567
|
+
N.theme({
|
|
1568
|
+
"&.cm-merge-b .cm-changedLine": {
|
|
1569
|
+
background: "transparent !important"
|
|
1570
|
+
},
|
|
1571
|
+
"&.cm-merge-b .cm-line": {
|
|
1572
|
+
paddingLeft: "12px !important"
|
|
1573
|
+
},
|
|
1574
|
+
"&.cm-merge-b .cm-changedText": {
|
|
1575
|
+
background: "rgba(34,184,24,0.3)"
|
|
1576
|
+
},
|
|
1577
|
+
"&.cm-merge-a .cm-changedText, .cm-deletedChunk .cm-deletedText": {
|
|
1578
|
+
background: "rgba(238,68,51,0.3)"
|
|
1579
|
+
}
|
|
1580
|
+
})
|
|
1581
|
+
], Fr = Y(
|
|
1582
|
+
({
|
|
1583
|
+
oldValue: e,
|
|
1584
|
+
newValue: t,
|
|
1585
|
+
autoScrollToBottom: n,
|
|
1586
|
+
children: r,
|
|
1587
|
+
editorAble: o,
|
|
1588
|
+
onChange: c
|
|
1589
|
+
}, s) => {
|
|
1590
|
+
const a = S(null);
|
|
1591
|
+
return q(s, () => ({
|
|
1592
|
+
goToPreviousChunk: () => {
|
|
1593
|
+
var l;
|
|
1594
|
+
const i = (l = a.current) == null ? void 0 : l.$view;
|
|
1595
|
+
i && it(i);
|
|
1596
|
+
},
|
|
1597
|
+
goToNextChunk: () => {
|
|
1598
|
+
var l;
|
|
1599
|
+
const i = (l = a.current) == null ? void 0 : l.$view;
|
|
1600
|
+
i && st(i);
|
|
1601
|
+
}
|
|
1602
|
+
})), /* @__PURE__ */ y(X, { children: [
|
|
1603
|
+
/* @__PURE__ */ u(
|
|
1604
|
+
at,
|
|
1605
|
+
{
|
|
1606
|
+
plugins: Ee,
|
|
1607
|
+
domProps: {
|
|
1608
|
+
style: {
|
|
1609
|
+
flex: 1,
|
|
1610
|
+
fontSize: 12,
|
|
1611
|
+
width: "100%"
|
|
1612
|
+
}
|
|
1613
|
+
},
|
|
1614
|
+
mergeConfig: {
|
|
1615
|
+
gutter: !0,
|
|
1616
|
+
collapseUnchanged: {
|
|
1617
|
+
margin: 3,
|
|
1618
|
+
minSize: 4
|
|
1619
|
+
},
|
|
1620
|
+
diffConfig: {
|
|
1621
|
+
scanLimit: 3e3
|
|
1622
|
+
}
|
|
1623
|
+
},
|
|
1624
|
+
a: {
|
|
1625
|
+
defaultValue: e,
|
|
1626
|
+
extensions: [
|
|
1627
|
+
...ke,
|
|
1628
|
+
Ne.of({
|
|
1629
|
+
id: "a",
|
|
1630
|
+
oldValue: e,
|
|
1631
|
+
newValue: t
|
|
1632
|
+
})
|
|
1633
|
+
],
|
|
1634
|
+
options: {
|
|
1635
|
+
editable: !1,
|
|
1636
|
+
readOnly: !0
|
|
1637
|
+
}
|
|
1638
|
+
},
|
|
1639
|
+
b: {
|
|
1640
|
+
defaultValue: t,
|
|
1641
|
+
extensions: [
|
|
1642
|
+
...ke,
|
|
1643
|
+
Ne.of({
|
|
1644
|
+
id: "b",
|
|
1645
|
+
oldValue: e,
|
|
1646
|
+
newValue: t
|
|
1647
|
+
})
|
|
1648
|
+
],
|
|
1649
|
+
options: {
|
|
1650
|
+
editable: o,
|
|
1651
|
+
readOnly: !o
|
|
1652
|
+
}
|
|
1653
|
+
},
|
|
1654
|
+
didMount: (i) => {
|
|
1655
|
+
n && i.b.$view.dispatch({
|
|
1656
|
+
effects: N.scrollIntoView(
|
|
1657
|
+
i.b.$view.state.doc.length
|
|
1658
|
+
)
|
|
1659
|
+
}), c && i.b.$on("change", (l) => {
|
|
1660
|
+
c(l.value);
|
|
1661
|
+
}), a.current = i.a;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
),
|
|
1665
|
+
/* @__PURE__ */ u(Pe, {}),
|
|
1666
|
+
/* @__PURE__ */ u(Qe, {}),
|
|
1667
|
+
/* @__PURE__ */ u($e, {}),
|
|
1668
|
+
r
|
|
1669
|
+
] });
|
|
1670
|
+
}
|
|
1671
|
+
), O = {
|
|
1672
|
+
background: "#fff",
|
|
1673
|
+
// syntax
|
|
1674
|
+
comment: "#000A298A",
|
|
1675
|
+
key: "#00818C",
|
|
1676
|
+
string: "#D1009D",
|
|
1677
|
+
number: "#C74200",
|
|
1678
|
+
boolean: "#2B57D9",
|
|
1679
|
+
null: "#2B57D9",
|
|
1680
|
+
separator: "#0F1529D1"
|
|
1681
|
+
}, Cn = [
|
|
1682
|
+
N.theme({
|
|
1683
|
+
".cm-completionIcon-property": {
|
|
1684
|
+
backgroundImage: 'url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMi4zNTc2IDguMTAzNTVDMTIuMTYyMyA3LjkwODI5IDExLjg0NTcgNy45MDgyOSAxMS42NTA1IDguMTAzNTVMOC4xMDM1NSAxMS42NTA1QzcuOTA4MjkgMTEuODQ1NyA3LjkwODI5IDEyLjE2MjMgOC4xMDM1NSAxMi4zNTc2TDExLjY1MDUgMTUuOTA0NUMxMS44NDU3IDE2LjA5OTggMTIuMTYyMyAxNi4wOTk4IDEyLjM1NzYgMTUuOTA0NUwxNS45MDQ1IDEyLjM1NzZDMTYuMDk5OCAxMi4xNjIzIDE2LjA5OTggMTEuODQ1NyAxNS45MDQ1IDExLjY1MDVMMTIuMzU3NiA4LjEwMzU1WiIgZmlsbD0iIzA2MDcwOUNDIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMS4wMDI2IDEuNDU1NDVDMTEuNjIxNCAxLjA5ODE4IDEyLjM4MzggMS4wOTgxOCAxMy4wMDI2IDEuNDU1NDVMMjAuNjM4IDUuODYzNzRDMjEuMjU2OCA2LjIyMSAyMS42MzggNi44ODEyNiAyMS42MzggNy41OTU3OVYxNi40MTI0QzIxLjYzOCAxNy4xMjY5IDIxLjI1NjggMTcuNzg3MiAyMC42MzggMTguMTQ0NEwxMy4wMDI2IDIyLjU1MjdDMTIuMzgzOCAyMi45MSAxMS42MjE0IDIyLjkxIDExLjAwMjYgMjIuNTUyN0wzLjM2NzE5IDE4LjE0NDRDMi43NDgzOSAxNy43ODcyIDIuMzY3MTkgMTcuMTI2OSAyLjM2NzE5IDE2LjQxMjRWNy41OTU3OUMyLjM2NzE5IDYuODgxMjYgMi43NDgzOSA2LjIyMTAxIDMuMzY3MTkgNS44NjM3NEwxMS4wMDI2IDEuNDU1NDVaTTEyLjAwMjYgMy4xODc1TDE5LjYzOCA3LjU5NTc5VjE2LjQxMjRMMTIuMDAyNiAyMC44MjA3TDQuMzY3MTkgMTYuNDEyNEw0LjM2NzE5IDcuNTk1NzlMMTIuMDAyNiAzLjE4NzVaIiBmaWxsPSIjMDYwNzA5Q0MiLz48L3N2Zz4=")',
|
|
1685
|
+
backgroundSize: "11px 11px",
|
|
1686
|
+
backgroundRepeat: "no-repeat",
|
|
1687
|
+
width: "11px",
|
|
1688
|
+
height: "11px"
|
|
1689
|
+
},
|
|
1690
|
+
".cm-completionIcon-property::after": {
|
|
1691
|
+
content: '""'
|
|
1692
|
+
}
|
|
1693
|
+
}),
|
|
1694
|
+
Oe({
|
|
1695
|
+
variant: "light",
|
|
1696
|
+
settings: {
|
|
1697
|
+
background: O.background,
|
|
1698
|
+
foreground: "#4D4D4C",
|
|
1699
|
+
caret: "#AEAFAD",
|
|
1700
|
+
selection: "#52649A21",
|
|
1701
|
+
gutterBackground: O.background,
|
|
1702
|
+
gutterForeground: "#000A298A",
|
|
1703
|
+
gutterBorderColor: "transparent",
|
|
1704
|
+
gutterBorderWidth: 0,
|
|
1705
|
+
lineHighlight: "#efefef78",
|
|
1706
|
+
bracketColors: ["#E4D129", "#AC05FF", "#2B57D9"],
|
|
1707
|
+
tooltip: {
|
|
1708
|
+
backgroundColor: "var(--coz-bg-max)",
|
|
1709
|
+
color: "var(--coz-fg-primary)",
|
|
1710
|
+
border: "solid 1px var(--coz-stroke-plus)",
|
|
1711
|
+
boxShadow: "var(--coz-shadow-default)",
|
|
1712
|
+
borderRadius: "8px"
|
|
1713
|
+
},
|
|
1714
|
+
tooltipCompletion: {
|
|
1715
|
+
backgroundColor: "#FFFFFF",
|
|
1716
|
+
color: "#060709CC"
|
|
1717
|
+
},
|
|
1718
|
+
completionItemHover: {
|
|
1719
|
+
backgroundColor: "#5768A114"
|
|
1720
|
+
},
|
|
1721
|
+
completionItemSelected: {
|
|
1722
|
+
backgroundColor: "#52649A21"
|
|
1723
|
+
},
|
|
1724
|
+
completionItemIcon: {
|
|
1725
|
+
color: "#060709CC"
|
|
1726
|
+
},
|
|
1727
|
+
completionItemLabel: {
|
|
1728
|
+
color: "#060709CC"
|
|
1729
|
+
},
|
|
1730
|
+
completionItemDetail: {
|
|
1731
|
+
color: "#2029459E"
|
|
1732
|
+
}
|
|
1733
|
+
},
|
|
1734
|
+
styles: [
|
|
1735
|
+
// JSON
|
|
1736
|
+
{
|
|
1737
|
+
tag: M.comment,
|
|
1738
|
+
color: O.comment
|
|
1739
|
+
},
|
|
1740
|
+
{
|
|
1741
|
+
tag: [M.propertyName],
|
|
1742
|
+
color: O.key
|
|
1743
|
+
},
|
|
1744
|
+
{
|
|
1745
|
+
tag: [M.string],
|
|
1746
|
+
color: O.string
|
|
1747
|
+
},
|
|
1748
|
+
{
|
|
1749
|
+
tag: [M.number],
|
|
1750
|
+
color: O.number
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
tag: [M.bool],
|
|
1754
|
+
color: O.boolean
|
|
1755
|
+
},
|
|
1756
|
+
{
|
|
1757
|
+
tag: [M.null],
|
|
1758
|
+
color: O.null
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
tag: [M.separator],
|
|
1762
|
+
color: O.separator
|
|
1763
|
+
},
|
|
1764
|
+
// shell
|
|
1765
|
+
// curl
|
|
1766
|
+
{
|
|
1767
|
+
tag: [M.standard(M.variableName)],
|
|
1768
|
+
color: "#00804A"
|
|
1769
|
+
},
|
|
1770
|
+
// -X
|
|
1771
|
+
{
|
|
1772
|
+
tag: [M.attributeName],
|
|
1773
|
+
color: "#C74200"
|
|
1774
|
+
},
|
|
1775
|
+
// url in string (includes quotes), e.g. "https://..."
|
|
1776
|
+
{
|
|
1777
|
+
tag: [M.special(M.string)],
|
|
1778
|
+
color: "#2B57D9"
|
|
1779
|
+
}
|
|
1780
|
+
]
|
|
1781
|
+
})
|
|
1782
|
+
], B = {
|
|
1783
|
+
background: "#151B27",
|
|
1784
|
+
// syntax
|
|
1785
|
+
comment: "#FFFFFF63",
|
|
1786
|
+
key: "#39E5D7",
|
|
1787
|
+
string: "#FF94D2",
|
|
1788
|
+
number: "#FF9933",
|
|
1789
|
+
boolean: "#78B0FF",
|
|
1790
|
+
null: "#78B0FF",
|
|
1791
|
+
separator: "#FFFFFFC9"
|
|
1792
|
+
}, vn = [
|
|
1793
|
+
N.theme({
|
|
1794
|
+
".cm-completionIcon-property": {
|
|
1795
|
+
backgroundImage: 'url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMi4zNTc2IDguMTAzNTVDMTIuMTYyMyA3LjkwODI5IDExLjg0NTcgNy45MDgyOSAxMS42NTA1IDguMTAzNTVMOC4xMDM1NSAxMS42NTA1QzcuOTA4MjkgMTEuODQ1NyA3LjkwODI5IDEyLjE2MjMgOC4xMDM1NSAxMi4zNTc2TDExLjY1MDUgMTUuOTA0NUMxMS44NDU3IDE2LjA5OTggMTIuMTYyMyAxNi4wOTk4IDEyLjM1NzYgMTUuOTA0NUwxNS45MDQ1IDEyLjM1NzZDMTYuMDk5OCAxMi4xNjIzIDE2LjA5OTggMTEuODQ1NyAxNS45MDQ1IDExLjY1MDVMMTIuMzU3NiA4LjEwMzU1WiIgZmlsbD0iI0ZGRkZGRkM5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMS4wMDI2IDEuNDU1NDVDMTEuNjIxNCAxLjA5ODE4IDEyLjM4MzggMS4wOTgxOCAxMy4wMDI2IDEuNDU1NDVMMjAuNjM4IDUuODYzNzRDMjEuMjU2OCA2LjIyMSAyMS42MzggNi44ODEyNiAyMS42MzggNy41OTU3OVYxNi40MTI0QzIxLjYzOCAxNy4xMjY5IDIxLjI1NjggMTcuNzg3MiAyMC42MzggMTguMTQ0NEwxMy4wMDI2IDIyLjU1MjdDMTIuMzgzOCAyMi45MSAxMS42MjE0IDIyLjkxIDExLjAwMjYgMjIuNTUyN0wzLjM2NzE5IDE4LjE0NDRDMi43NDgzOSAxNy43ODcyIDIuMzY3MTkgMTcuMTI2OSAyLjM2NzE5IDE2LjQxMjRWNy41OTU3OUMyLjM2NzE5IDYuODgxMjYgMi43NDgzOSA2LjIyMTAxIDMuMzY3MTkgNS44NjM3NEwxMS4wMDI2IDEuNDU1NDVaTTEyLjAwMjYgMy4xODc1TDE5LjYzOCA3LjU5NTc5VjE2LjQxMjRMMTIuMDAyNiAyMC44MjA3TDQuMzY3MTkgMTYuNDEyNEw0LjM2NzE5IDcuNTk1NzlMMTIuMDAyNiAzLjE4NzVaIiBmaWxsPSIjRkZGRkZGQzkiLz48L3N2Zz4=")',
|
|
1796
|
+
backgroundSize: "11px 11px",
|
|
1797
|
+
backgroundRepeat: "no-repeat",
|
|
1798
|
+
width: "11px",
|
|
1799
|
+
height: "11px"
|
|
1800
|
+
},
|
|
1801
|
+
".cm-completionIcon-property::after": {
|
|
1802
|
+
content: '""'
|
|
1803
|
+
}
|
|
1804
|
+
}),
|
|
1805
|
+
Oe({
|
|
1806
|
+
variant: "dark",
|
|
1807
|
+
settings: {
|
|
1808
|
+
background: B.background,
|
|
1809
|
+
foreground: "#fff",
|
|
1810
|
+
caret: "#AEAFAD",
|
|
1811
|
+
selection: "#d9d9d942",
|
|
1812
|
+
gutterBackground: B.background,
|
|
1813
|
+
gutterForeground: "#FFFFFF63",
|
|
1814
|
+
gutterBorderColor: "transparent",
|
|
1815
|
+
gutterBorderWidth: 0,
|
|
1816
|
+
lineHighlight: "#272e3d36",
|
|
1817
|
+
bracketColors: ["#FFEF61", "#DD99FF", "#78B0FF"],
|
|
1818
|
+
tooltip: {
|
|
1819
|
+
backgroundColor: "#363D4D",
|
|
1820
|
+
color: "#fff",
|
|
1821
|
+
border: "none"
|
|
1822
|
+
},
|
|
1823
|
+
completionItemHover: {
|
|
1824
|
+
backgroundColor: "#FFFFFF0F"
|
|
1825
|
+
},
|
|
1826
|
+
completionItemSelected: {
|
|
1827
|
+
backgroundColor: "#FFFFFF17"
|
|
1828
|
+
},
|
|
1829
|
+
completionItemIcon: {
|
|
1830
|
+
color: "#FFFFFFC9"
|
|
1831
|
+
},
|
|
1832
|
+
completionItemLabel: {
|
|
1833
|
+
color: "#FFFFFFC9"
|
|
1834
|
+
},
|
|
1835
|
+
completionItemDetail: {
|
|
1836
|
+
color: "#FFFFFF63"
|
|
1837
|
+
}
|
|
1838
|
+
},
|
|
1839
|
+
styles: [
|
|
1840
|
+
// json
|
|
1841
|
+
{
|
|
1842
|
+
tag: M.comment,
|
|
1843
|
+
color: B.comment
|
|
1844
|
+
},
|
|
1845
|
+
{
|
|
1846
|
+
tag: [M.propertyName],
|
|
1847
|
+
color: B.key
|
|
1848
|
+
},
|
|
1849
|
+
{
|
|
1850
|
+
tag: [M.string],
|
|
1851
|
+
color: B.string
|
|
1852
|
+
},
|
|
1853
|
+
{
|
|
1854
|
+
tag: [M.number],
|
|
1855
|
+
color: B.number
|
|
1856
|
+
},
|
|
1857
|
+
{
|
|
1858
|
+
tag: [M.bool],
|
|
1859
|
+
color: B.boolean
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
tag: [M.null],
|
|
1863
|
+
color: B.null
|
|
1864
|
+
},
|
|
1865
|
+
{
|
|
1866
|
+
tag: [M.separator],
|
|
1867
|
+
color: B.separator
|
|
1868
|
+
},
|
|
1869
|
+
// shell
|
|
1870
|
+
// curl
|
|
1871
|
+
{
|
|
1872
|
+
tag: [M.standard(M.variableName)],
|
|
1873
|
+
color: "#3BEB84"
|
|
1874
|
+
},
|
|
1875
|
+
// -X
|
|
1876
|
+
{
|
|
1877
|
+
tag: [M.attributeName],
|
|
1878
|
+
color: "#FF9933"
|
|
1879
|
+
},
|
|
1880
|
+
// url in string (includes quotes), e.g. "https://..."
|
|
1881
|
+
{
|
|
1882
|
+
tag: [M.special(M.string)],
|
|
1883
|
+
color: "#78B0FF"
|
|
1884
|
+
}
|
|
1885
|
+
]
|
|
1886
|
+
})
|
|
1887
|
+
];
|
|
1888
|
+
Be.register("json", {
|
|
1889
|
+
// mixLanguages 用于解决 「插值也使用了括号,导致无法正确高亮」的问题
|
|
1890
|
+
language: Te({
|
|
1891
|
+
outerLanguage: ae.language
|
|
1892
|
+
}),
|
|
1893
|
+
languageService: ae.languageService
|
|
1894
|
+
});
|
|
1895
|
+
Be.register("shell", Bt);
|
|
1896
|
+
_e.register("coze-light", Cn);
|
|
1897
|
+
_e.register("coze-dark", vn);
|
|
1898
|
+
const Dn = (e) => N.theme({
|
|
1899
|
+
".cm-content, .cm-gutter, .cm-right-gutter": {
|
|
1900
|
+
minHeight: typeof e == "number" ? `${e}px` : typeof e == "string" ? e : "unset"
|
|
1901
|
+
},
|
|
1902
|
+
"&.cm-editor": {
|
|
1903
|
+
minHeight: typeof e == "number" ? `${e}px` : typeof e == "string" ? e : "unset"
|
|
1904
|
+
}
|
|
1905
|
+
}), En = (e) => N.theme({
|
|
1906
|
+
"&.cm-editor": {
|
|
1907
|
+
maxHeight: typeof e == "number" ? `${e}px` : typeof e == "string" ? e : "unset"
|
|
1908
|
+
}
|
|
1909
|
+
}), An = (e) => N.theme({
|
|
1910
|
+
"&.cm-editor": {
|
|
1911
|
+
height: typeof e == "number" ? `${e}px` : typeof e == "string" ? e : "unset"
|
|
1912
|
+
}
|
|
1913
|
+
}), zn = (e) => N.theme({
|
|
1914
|
+
"&.cm-editor": {
|
|
1915
|
+
padding: typeof e == "number" ? `${e}px` : typeof e == "string" ? e : "unset"
|
|
1916
|
+
}
|
|
1917
|
+
}), jn = (e) => N.theme({
|
|
1918
|
+
"&.cm-editor, .cm-gutters": {
|
|
1919
|
+
borderRadius: typeof e == "number" ? `${e}px` : typeof e == "string" ? e : "unset"
|
|
1920
|
+
}
|
|
1921
|
+
}), Sn = (e) => N.theme({
|
|
1922
|
+
".cm-content, .cm-gutter, .cm-right-gutter": {
|
|
1923
|
+
lineHeight: typeof e == "number" ? `${e}px` : typeof e == "string" ? e : "unset"
|
|
1924
|
+
}
|
|
1925
|
+
});
|
|
1926
|
+
function Tn() {
|
|
1927
|
+
return [
|
|
1928
|
+
R("minHeight", Dn),
|
|
1929
|
+
R("maxHeight", En),
|
|
1930
|
+
R("editerHeight", An),
|
|
1931
|
+
R("borderRadius", jn),
|
|
1932
|
+
R("padding", zn),
|
|
1933
|
+
R("lineHeight", Sn)
|
|
1934
|
+
];
|
|
1935
|
+
}
|
|
1936
|
+
const Fn = [
|
|
1937
|
+
N.theme({
|
|
1938
|
+
"&.cm-focused": {
|
|
1939
|
+
outline: "none"
|
|
1940
|
+
},
|
|
1941
|
+
"& *": {
|
|
1942
|
+
fontFamily: 'Menlo, Monaco, "Courier New", monospace'
|
|
1943
|
+
}
|
|
1944
|
+
}),
|
|
1945
|
+
N.theme({
|
|
1946
|
+
"&.cm-content": {
|
|
1947
|
+
wordBreak: "break-all"
|
|
1948
|
+
}
|
|
1949
|
+
})
|
|
1950
|
+
], Ln = De(
|
|
1951
|
+
[...Lt, ...Tn()],
|
|
1952
|
+
Fn
|
|
1953
|
+
), On = N.theme({
|
|
1954
|
+
"&.cm-editor": {
|
|
1955
|
+
outline: "none"
|
|
1956
|
+
},
|
|
1957
|
+
"&.cm-content": {
|
|
1958
|
+
wordBreak: "break-all"
|
|
1959
|
+
}
|
|
1960
|
+
}), Bn = (e) => N.theme({
|
|
1961
|
+
".cm-content, .cm-gutter, .cm-right-gutter": {
|
|
1962
|
+
minHeight: typeof e == "number" ? `${e}px` : typeof e == "string" ? e : "unset"
|
|
1963
|
+
}
|
|
1964
|
+
}), _n = (e) => N.theme({
|
|
1965
|
+
".cm-content, .cm-gutter, .cm-right-gutter": {
|
|
1966
|
+
lineHeight: typeof e == "number" ? `${e}px` : typeof e == "string" ? e : "unset"
|
|
1967
|
+
}
|
|
1968
|
+
}), Rn = [
|
|
1969
|
+
Te({}),
|
|
1970
|
+
On,
|
|
1971
|
+
// ...其他 extensions
|
|
1972
|
+
ht(),
|
|
1973
|
+
me.of([...pt, ...ft])
|
|
1974
|
+
], Vn = De(
|
|
1975
|
+
[
|
|
1976
|
+
..._t,
|
|
1977
|
+
R("minHeight", Bn),
|
|
1978
|
+
R("lineHeight", _n)
|
|
1979
|
+
],
|
|
1980
|
+
Rn
|
|
1981
|
+
), Hn = [
|
|
1982
|
+
N.theme({
|
|
1983
|
+
".cm-activeLineGutter": {
|
|
1984
|
+
backgroundColor: "transparent !important"
|
|
1985
|
+
},
|
|
1986
|
+
".cm-activeLine": {
|
|
1987
|
+
backgroundColor: "transparent !important"
|
|
1988
|
+
}
|
|
1989
|
+
})
|
|
1990
|
+
];
|
|
1991
|
+
function $n(e, t) {
|
|
1992
|
+
const n = new RegExp(
|
|
1993
|
+
t,
|
|
1994
|
+
t.flags.includes("g") ? t.flags : `${t.flags}g`
|
|
1995
|
+
);
|
|
1996
|
+
let r;
|
|
1997
|
+
const o = [];
|
|
1998
|
+
for (; r = n.exec(e), !!r; )
|
|
1999
|
+
r.index === n.lastIndex && n.lastIndex++, o.push({
|
|
2000
|
+
match: r[0],
|
|
2001
|
+
range: [r.index, r.index + r[0].length]
|
|
2002
|
+
});
|
|
2003
|
+
return o;
|
|
2004
|
+
}
|
|
2005
|
+
const Pn = Ot((e) => {
|
|
2006
|
+
const t = e.toString(), n = $n(t, /\{\{([^\}]*)\}\}/g);
|
|
2007
|
+
return n.length > 0 && n.forEach(({ range: r }) => {
|
|
2008
|
+
e.replaceRange(r[0], r[1], "null");
|
|
2009
|
+
}), e;
|
|
2010
|
+
}), Un = Ke.forwardRef(
|
|
2011
|
+
(e, t) => {
|
|
2012
|
+
const {
|
|
2013
|
+
value: n,
|
|
2014
|
+
onChange: r,
|
|
2015
|
+
placeholder: o,
|
|
2016
|
+
className: c,
|
|
2017
|
+
isDarkTheme: s,
|
|
2018
|
+
readonly: a,
|
|
2019
|
+
minHeight: i = "100px",
|
|
2020
|
+
maxHeight: l,
|
|
2021
|
+
editerHeight: d,
|
|
2022
|
+
padding: m,
|
|
2023
|
+
borderRadius: p
|
|
2024
|
+
} = e, f = S(null), h = ve(
|
|
2025
|
+
(g) => {
|
|
2026
|
+
typeof r == "function" && r(g.value);
|
|
2027
|
+
},
|
|
2028
|
+
[r]
|
|
2029
|
+
);
|
|
2030
|
+
z(() => {
|
|
2031
|
+
var g;
|
|
2032
|
+
(g = f.current) == null || g.updateASTDecorations();
|
|
2033
|
+
}, [s]), z(() => {
|
|
2034
|
+
const g = f.current;
|
|
2035
|
+
g && typeof n == "string" && n !== g.getValue() && g.setValue(n);
|
|
2036
|
+
}, [n]);
|
|
2037
|
+
const x = async () => {
|
|
2038
|
+
var w;
|
|
2039
|
+
const g = (w = f.current) == null ? void 0 : w.$view;
|
|
2040
|
+
g && g.dispatch(
|
|
2041
|
+
await ae.languageService.format(g.state, {
|
|
2042
|
+
tabSize: 2
|
|
2043
|
+
})
|
|
2044
|
+
);
|
|
2045
|
+
};
|
|
2046
|
+
return q(t, () => ({
|
|
2047
|
+
formatJson: x
|
|
2048
|
+
})), /* @__PURE__ */ u(X, { children: /* @__PURE__ */ u("div", { className: c, children: /* @__PURE__ */ u(
|
|
2049
|
+
Ln,
|
|
2050
|
+
{
|
|
2051
|
+
defaultValue: n ?? "",
|
|
2052
|
+
onChange: h,
|
|
2053
|
+
options: {
|
|
2054
|
+
placeholder: o,
|
|
2055
|
+
lineWrapping: !0,
|
|
2056
|
+
theme: s ? "coze-dark" : "coze-light",
|
|
2057
|
+
languageId: "json",
|
|
2058
|
+
editable: !a,
|
|
2059
|
+
transformer: Pn,
|
|
2060
|
+
minHeight: i,
|
|
2061
|
+
maxHeight: l,
|
|
2062
|
+
editerHeight: d,
|
|
2063
|
+
borderRadius: p,
|
|
2064
|
+
padding: m,
|
|
2065
|
+
fontSize: 13,
|
|
2066
|
+
lineHeight: 20
|
|
2067
|
+
},
|
|
2068
|
+
didMount: (g) => f.current = g,
|
|
2069
|
+
extensions: Hn
|
|
2070
|
+
}
|
|
2071
|
+
) }) });
|
|
2072
|
+
}
|
|
2073
|
+
), Wn = Y(
|
|
2074
|
+
(e, t) => {
|
|
2075
|
+
const { value: n, onChange: r, placeholder: o, className: c, minHeight: s, readonly: a } = e, i = S(null), l = ve(
|
|
2076
|
+
(d) => {
|
|
2077
|
+
typeof r == "function" && r(d.value);
|
|
2078
|
+
},
|
|
2079
|
+
[r]
|
|
2080
|
+
);
|
|
2081
|
+
return z(() => {
|
|
2082
|
+
const d = i.current;
|
|
2083
|
+
d && typeof n == "string" && n !== d.getValue() && d.setValue(n);
|
|
2084
|
+
}, [n]), /* @__PURE__ */ u(X, { children: /* @__PURE__ */ u("div", { ref: t, className: c, children: /* @__PURE__ */ u(
|
|
2085
|
+
Vn,
|
|
2086
|
+
{
|
|
2087
|
+
defaultValue: n ?? "",
|
|
2088
|
+
onChange: l,
|
|
2089
|
+
options: {
|
|
2090
|
+
placeholder: o,
|
|
2091
|
+
lineWrapping: !0,
|
|
2092
|
+
minHeight: s,
|
|
2093
|
+
fontSize: 13,
|
|
2094
|
+
editable: !a,
|
|
2095
|
+
lineHeight: 20
|
|
2096
|
+
},
|
|
2097
|
+
didMount: (d) => i.current = d
|
|
2098
|
+
}
|
|
2099
|
+
) }) });
|
|
2100
|
+
}
|
|
2101
|
+
), Lr = ({
|
|
2102
|
+
value: e,
|
|
2103
|
+
onChange: t,
|
|
2104
|
+
placeholder: n,
|
|
2105
|
+
readOnly: r,
|
|
2106
|
+
language: o,
|
|
2107
|
+
className: c
|
|
2108
|
+
}) => /* @__PURE__ */ u(
|
|
2109
|
+
"div",
|
|
2110
|
+
{
|
|
2111
|
+
className: A(
|
|
2112
|
+
"w-full h-[500px] border border-solid coz-stroke-primary rounded-[4px] overflow-hidden relative bg-white",
|
|
2113
|
+
{ "opacity-70": r },
|
|
2114
|
+
c
|
|
2115
|
+
),
|
|
2116
|
+
children: o === "json" ? /* @__PURE__ */ u(
|
|
2117
|
+
Un,
|
|
2118
|
+
{
|
|
2119
|
+
className: "w-full h-full overflow-y-auto",
|
|
2120
|
+
onChange: t,
|
|
2121
|
+
value: e || "",
|
|
2122
|
+
placeholder: n,
|
|
2123
|
+
readonly: r,
|
|
2124
|
+
borderRadius: 4
|
|
2125
|
+
}
|
|
2126
|
+
) : /* @__PURE__ */ u(
|
|
2127
|
+
Wn,
|
|
2128
|
+
{
|
|
2129
|
+
className: "w-full h-full overflow-y-auto",
|
|
2130
|
+
onChange: t,
|
|
2131
|
+
value: e || "",
|
|
2132
|
+
placeholder: n,
|
|
2133
|
+
readonly: r
|
|
2134
|
+
}
|
|
2135
|
+
)
|
|
2136
|
+
}
|
|
2137
|
+
), oe = (e) => {
|
|
2138
|
+
if (e !== void 0)
|
|
2139
|
+
return Number(e);
|
|
2140
|
+
}, ce = (e, t) => {
|
|
2141
|
+
const n = t.find((o) => o.name === e), r = e === "max_tokens" ? He : 0;
|
|
2142
|
+
return {
|
|
2143
|
+
min: Number((n == null ? void 0 : n.min) || 0),
|
|
2144
|
+
max: Math.max(Number((n == null ? void 0 : n.max) || 1), r),
|
|
2145
|
+
defaultValue: Number((n == null ? void 0 : n.defaultVal) || r),
|
|
2146
|
+
label: {
|
|
2147
|
+
text: /* @__PURE__ */ u(E.Text, { children: n != null && n.name && Qt[n.name] || "" }),
|
|
2148
|
+
extra: /* @__PURE__ */ u(
|
|
2149
|
+
U,
|
|
2150
|
+
{
|
|
2151
|
+
content: /* @__PURE__ */ u(Re, { className: "!text-white", markDown: (n == null ? void 0 : n.desc) || "" }),
|
|
2152
|
+
theme: "dark",
|
|
2153
|
+
children: /* @__PURE__ */ u(Le, {})
|
|
2154
|
+
}
|
|
2155
|
+
)
|
|
2156
|
+
}
|
|
2157
|
+
};
|
|
2158
|
+
}, ie = bt($t);
|
|
2159
|
+
function Ze({ model: e }) {
|
|
2160
|
+
if (!e)
|
|
2161
|
+
return null;
|
|
2162
|
+
const t = e == null ? void 0 : e.ability, n = (t == null ? void 0 : t.modelParams) || [], r = e == null ? void 0 : e.defaultRuntimeParam;
|
|
2163
|
+
return /* @__PURE__ */ y(ue, { children: [
|
|
2164
|
+
/* @__PURE__ */ u(
|
|
2165
|
+
ie,
|
|
2166
|
+
{
|
|
2167
|
+
field: "max_tokens",
|
|
2168
|
+
labelPosition: "left",
|
|
2169
|
+
...ce("max_tokens", n),
|
|
2170
|
+
label: {
|
|
2171
|
+
text: /* @__PURE__ */ u(E.Text, { children: "最大回复长度" }),
|
|
2172
|
+
extra: /* @__PURE__ */ u(
|
|
2173
|
+
U,
|
|
2174
|
+
{
|
|
2175
|
+
content: /* @__PURE__ */ u(
|
|
2176
|
+
Re,
|
|
2177
|
+
{
|
|
2178
|
+
className: "!text-white",
|
|
2179
|
+
markDown: "- **max_tokens**: 控制模型输出的 Tokens 长度上限。通常 100 Tokens 约等于 150 个中文汉字。"
|
|
2180
|
+
}
|
|
2181
|
+
),
|
|
2182
|
+
theme: "dark",
|
|
2183
|
+
children: /* @__PURE__ */ u(Le, {})
|
|
2184
|
+
}
|
|
2185
|
+
)
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
),
|
|
2189
|
+
ye(r == null ? void 0 : r.temperature) ? null : /* @__PURE__ */ u(
|
|
2190
|
+
ie,
|
|
2191
|
+
{
|
|
2192
|
+
field: "temperature",
|
|
2193
|
+
labelPosition: "left",
|
|
2194
|
+
...ce("temperature", n),
|
|
2195
|
+
step: 0.01
|
|
2196
|
+
}
|
|
2197
|
+
),
|
|
2198
|
+
ye(r == null ? void 0 : r.topP) ? null : /* @__PURE__ */ u(
|
|
2199
|
+
ie,
|
|
2200
|
+
{
|
|
2201
|
+
field: "top_p",
|
|
2202
|
+
labelPosition: "left",
|
|
2203
|
+
label: {
|
|
2204
|
+
text: /* @__PURE__ */ u(E.Text, { children: "Top P" })
|
|
2205
|
+
},
|
|
2206
|
+
...ce("top_p", n),
|
|
2207
|
+
step: 0.01
|
|
2208
|
+
}
|
|
2209
|
+
),
|
|
2210
|
+
t != null && t.jsonModeEnabled ? /* @__PURE__ */ u(
|
|
2211
|
+
he.Switch,
|
|
2212
|
+
{
|
|
2213
|
+
labelPosition: "left",
|
|
2214
|
+
label: {
|
|
2215
|
+
text: /* @__PURE__ */ u(E.Text, { children: "JSON Mode" })
|
|
2216
|
+
},
|
|
2217
|
+
field: "json_mode"
|
|
2218
|
+
}
|
|
2219
|
+
) : null
|
|
2220
|
+
] });
|
|
2221
|
+
}
|
|
2222
|
+
const Ge = (e) => {
|
|
2223
|
+
var t, n, r, o;
|
|
2224
|
+
return {
|
|
2225
|
+
id: e == null ? void 0 : e.id,
|
|
2226
|
+
name: e == null ? void 0 : e.displayName,
|
|
2227
|
+
provider: e == null ? void 0 : e.provider,
|
|
2228
|
+
provider_model_id: e == null ? void 0 : e.identification,
|
|
2229
|
+
temperature: oe((t = e == null ? void 0 : e.defaultRuntimeParam) == null ? void 0 : t.temperature),
|
|
2230
|
+
max_tokens: oe(
|
|
2231
|
+
((n = e == null ? void 0 : e.defaultRuntimeParam) == null ? void 0 : n.maxTokens) || He
|
|
2232
|
+
),
|
|
2233
|
+
top_p: oe((r = e == null ? void 0 : e.defaultRuntimeParam) == null ? void 0 : r.topP),
|
|
2234
|
+
function_call_mode: (o = e == null ? void 0 : e.ability) == null ? void 0 : o.functionCallEnabled
|
|
2235
|
+
};
|
|
2236
|
+
}, qe = (e) => (e == null ? void 0 : e.modelStatus) === (void 0).Offlining ? /* @__PURE__ */ u($, { color: "yellow", className: "flex-shrink-0", size: "mini", children: "下线中" }) : (e == null ? void 0 : e.modelStatus) === (void 0).Unavailable ? /* @__PURE__ */ u($, { color: "red", className: "flex-shrink-0", size: "mini", children: "已下线" }) : null, se = {
|
|
2237
|
+
"model-option": "_model-option_v1jrk_2",
|
|
2238
|
+
"model-info-border": "_model-info-border_v1jrk_5",
|
|
2239
|
+
"model-option_selected": "_model-option_selected_v1jrk_6"
|
|
2240
|
+
};
|
|
2241
|
+
function Yn({
|
|
2242
|
+
model: e,
|
|
2243
|
+
selected: t,
|
|
2244
|
+
disabled: n,
|
|
2245
|
+
onClick: r,
|
|
2246
|
+
...o
|
|
2247
|
+
}) {
|
|
2248
|
+
var l, d;
|
|
2249
|
+
const c = S(null), s = Pt(c), a = e.modelTags || [], i = (m) => m != null && m.length ? /* @__PURE__ */ u(
|
|
2250
|
+
U,
|
|
2251
|
+
{
|
|
2252
|
+
content: /* @__PURE__ */ u(Z, { wrap: !0, spacing: 3, children: m == null ? void 0 : m.map((p) => /* @__PURE__ */ u($, { children: p })) }),
|
|
2253
|
+
children: /* @__PURE__ */ y(
|
|
2254
|
+
$,
|
|
2255
|
+
{
|
|
2256
|
+
style: { flex: "0 0 auto" },
|
|
2257
|
+
size: "mini",
|
|
2258
|
+
color: "primary",
|
|
2259
|
+
className: "!bg-transparent !border border-solid",
|
|
2260
|
+
children: [
|
|
2261
|
+
"+",
|
|
2262
|
+
m.length
|
|
2263
|
+
]
|
|
2264
|
+
}
|
|
2265
|
+
)
|
|
2266
|
+
}
|
|
2267
|
+
) : null;
|
|
2268
|
+
return /* @__PURE__ */ y(
|
|
2269
|
+
"article",
|
|
2270
|
+
{
|
|
2271
|
+
ref: c,
|
|
2272
|
+
className: A(
|
|
2273
|
+
"pl-[16px] pr-[12px] w-full relative",
|
|
2274
|
+
"flex gap-[16px] items-center rounded-[12px]",
|
|
2275
|
+
n ? "cursor-not-allowed" : "cursor-pointer",
|
|
2276
|
+
se["model-option"],
|
|
2277
|
+
{ [se["model-option_selected"]]: t }
|
|
2278
|
+
),
|
|
2279
|
+
style: { minWidth: 480, maxWidth: 570 },
|
|
2280
|
+
onClick: () => {
|
|
2281
|
+
r == null || r();
|
|
2282
|
+
},
|
|
2283
|
+
children: [
|
|
2284
|
+
/* @__PURE__ */ u(
|
|
2285
|
+
Se,
|
|
2286
|
+
{
|
|
2287
|
+
className: "shrink-0 rounded-[6px] border border-solid coz-stroke-primary",
|
|
2288
|
+
shape: "square",
|
|
2289
|
+
src: e.modelIcon,
|
|
2290
|
+
size: "default"
|
|
2291
|
+
}
|
|
2292
|
+
),
|
|
2293
|
+
/* @__PURE__ */ y(
|
|
2294
|
+
"div",
|
|
2295
|
+
{
|
|
2296
|
+
className: A(
|
|
2297
|
+
"h-[70px] py-[14px] w-full",
|
|
2298
|
+
"flex flex-col overflow-hidden",
|
|
2299
|
+
"border-0 border-b border-solid coz-stroke-primary",
|
|
2300
|
+
se["model-info-border"]
|
|
2301
|
+
),
|
|
2302
|
+
style: s ? {
|
|
2303
|
+
mask: Qn([
|
|
2304
|
+
o.enableConfig,
|
|
2305
|
+
o.enableJumpDetail
|
|
2306
|
+
])
|
|
2307
|
+
} : void 0,
|
|
2308
|
+
children: [
|
|
2309
|
+
/* @__PURE__ */ y("div", { className: "w-full flex items-center gap-[6px] overflow-hidden", children: [
|
|
2310
|
+
/* @__PURE__ */ u(E.Title, { fontSize: "14px", ellipsis: { showTooltip: !0 }, children: e.displayName }),
|
|
2311
|
+
/* @__PURE__ */ y("div", { className: "shrink-0 flex gap-[6px]", children: [
|
|
2312
|
+
n ? /* @__PURE__ */ u("div", { className: "h-[16px] leading-[16px]", children: /* @__PURE__ */ u(Tt, { className: "coz-fg-hglt text-[12px]" }) }) : null,
|
|
2313
|
+
(l = e.commercialModelStatusDetail) != null && l.isNewModel ? /* @__PURE__ */ u(U, { content: "Pro 版用户专享", theme: "dark", children: /* @__PURE__ */ u($, { size: "mini", color: "brand", children: "新模型" }) }) : null,
|
|
2314
|
+
(d = e.commercialModelStatusDetail) != null && d.isAdvancedModel ? /* @__PURE__ */ u(U, { content: "专业版用户专享", theme: "dark", children: /* @__PURE__ */ u($, { size: "mini", color: "blue", children: "高级" }) }) : null,
|
|
2315
|
+
qe(e),
|
|
2316
|
+
a != null && a.length ? /* @__PURE__ */ y(Z, { spacing: 4, children: [
|
|
2317
|
+
a.slice(0, 3).map((m) => /* @__PURE__ */ u(
|
|
2318
|
+
$,
|
|
2319
|
+
{
|
|
2320
|
+
size: "mini",
|
|
2321
|
+
color: "primary",
|
|
2322
|
+
className: "!bg-transparent !border border-solid coz-stroke-plus !rounded-[4px]",
|
|
2323
|
+
children: m
|
|
2324
|
+
},
|
|
2325
|
+
m
|
|
2326
|
+
)),
|
|
2327
|
+
i(a.slice(3))
|
|
2328
|
+
] }) : null
|
|
2329
|
+
] })
|
|
2330
|
+
] }),
|
|
2331
|
+
/* @__PURE__ */ u(
|
|
2332
|
+
E.Text,
|
|
2333
|
+
{
|
|
2334
|
+
className: "mt-[4px] text-[12px] leading-[16px] coz-fg-secondary",
|
|
2335
|
+
ellipsis: { showTooltip: { opts: { theme: "dark" } } },
|
|
2336
|
+
children: e.description
|
|
2337
|
+
}
|
|
2338
|
+
)
|
|
2339
|
+
]
|
|
2340
|
+
}
|
|
2341
|
+
)
|
|
2342
|
+
]
|
|
2343
|
+
}
|
|
2344
|
+
);
|
|
2345
|
+
}
|
|
2346
|
+
function Qn(e) {
|
|
2347
|
+
const t = e.reduce(
|
|
2348
|
+
(i, l) => i + (l ? 1 : 0),
|
|
2349
|
+
0
|
|
2350
|
+
);
|
|
2351
|
+
if (t === 0)
|
|
2352
|
+
return "none";
|
|
2353
|
+
const n = 32, r = 3, o = 16, c = 24, s = t * n + (t - 1) * r + o, a = s + c;
|
|
2354
|
+
return `linear-gradient(to left, rgba(0,0,0,0), rgba(0,0,0,0) ${s}px, #fff ${a}px)`;
|
|
2355
|
+
}
|
|
2356
|
+
const Ie = {
|
|
2357
|
+
"model-select-dropdown": "_model-select-dropdown_1bmpq_2",
|
|
2358
|
+
"model-select": "_model-select_1bmpq_2"
|
|
2359
|
+
};
|
|
2360
|
+
function Zn({ item: e }) {
|
|
2361
|
+
return /* @__PURE__ */ y("div", { className: "flex items-center w-full gap-1", children: [
|
|
2362
|
+
/* @__PURE__ */ u("div", { className: "overflow-hidden flex-shrink-0 mr-[8px]", children: /* @__PURE__ */ u(Se, { src: e == null ? void 0 : e.modelIcon, shape: "square", size: "extra-extra-small" }) }),
|
|
2363
|
+
/* @__PURE__ */ u(
|
|
2364
|
+
E.Text,
|
|
2365
|
+
{
|
|
2366
|
+
style: {
|
|
2367
|
+
maxWidth: "400px",
|
|
2368
|
+
fontSize: "13px"
|
|
2369
|
+
},
|
|
2370
|
+
ellipsis: { showTooltip: { opts: { theme: "dark" } } },
|
|
2371
|
+
children: e == null ? void 0 : e.displayName
|
|
2372
|
+
}
|
|
2373
|
+
),
|
|
2374
|
+
qe(e)
|
|
2375
|
+
] });
|
|
2376
|
+
}
|
|
2377
|
+
function Je({
|
|
2378
|
+
className: e,
|
|
2379
|
+
style: t,
|
|
2380
|
+
value: n,
|
|
2381
|
+
disabled: r,
|
|
2382
|
+
defaultSelectFirstModel: o,
|
|
2383
|
+
loading: c,
|
|
2384
|
+
modelListData: s,
|
|
2385
|
+
onChange: a,
|
|
2386
|
+
loadMore: i,
|
|
2387
|
+
optionCustomRender: l,
|
|
2388
|
+
valueKey: d = "identification"
|
|
2389
|
+
}) {
|
|
2390
|
+
const m = (h) => {
|
|
2391
|
+
var g;
|
|
2392
|
+
const x = (g = s == null ? void 0 : s.list) == null ? void 0 : g.find((w) => (w == null ? void 0 : w[d]) === h);
|
|
2393
|
+
a == null || a(x);
|
|
2394
|
+
}, p = S(), { modelGroups: f } = Ce(() => {
|
|
2395
|
+
const h = Rt(
|
|
2396
|
+
s == null ? void 0 : s.list,
|
|
2397
|
+
(g) => {
|
|
2398
|
+
var w;
|
|
2399
|
+
return (w = g.commercialModelSeries) == null ? void 0 : w.seriesName;
|
|
2400
|
+
}
|
|
2401
|
+
);
|
|
2402
|
+
return {
|
|
2403
|
+
modelGroups: Object.values(h).filter(
|
|
2404
|
+
(g) => !!(g != null && g.length)
|
|
2405
|
+
)
|
|
2406
|
+
};
|
|
2407
|
+
}, [s == null ? void 0 : s.list]);
|
|
2408
|
+
return z(() => {
|
|
2409
|
+
var h, x;
|
|
2410
|
+
!n && o && ((h = s == null ? void 0 : s.list) != null && h.length) && (a == null || a((x = s == null ? void 0 : s.list) == null ? void 0 : x[0]));
|
|
2411
|
+
}, [s == null ? void 0 : s.list, o, n]), /* @__PURE__ */ u(
|
|
2412
|
+
te,
|
|
2413
|
+
{
|
|
2414
|
+
ref: p,
|
|
2415
|
+
className: A("w-full", Ie["model-select"], e),
|
|
2416
|
+
style: t,
|
|
2417
|
+
showArrow: !1,
|
|
2418
|
+
suffix: /* @__PURE__ */ y("div", { className: "flex items-center gap-1 flex-shrink-0 text-[13px]", children: [
|
|
2419
|
+
/* @__PURE__ */ u(Ft, {}),
|
|
2420
|
+
"选择模型"
|
|
2421
|
+
] }),
|
|
2422
|
+
loading: c,
|
|
2423
|
+
disabled: r,
|
|
2424
|
+
value: n == null ? void 0 : n[d],
|
|
2425
|
+
onChange: (h) => m == null ? void 0 : m(h),
|
|
2426
|
+
onListScroll: (h) => {
|
|
2427
|
+
const x = h.currentTarget, g = x.scrollHeight - x.scrollTop === x.clientHeight;
|
|
2428
|
+
!(s != null && s.hasMore) || !g || i == null || i();
|
|
2429
|
+
},
|
|
2430
|
+
placeholder: "请选择模型",
|
|
2431
|
+
renderSelectedItem: (h) => /* @__PURE__ */ u(Zn, { item: h["data-item"] || n }),
|
|
2432
|
+
dropdownClassName: Ie["model-select-dropdown"],
|
|
2433
|
+
showTick: !1,
|
|
2434
|
+
filter: (h, x) => {
|
|
2435
|
+
var g;
|
|
2436
|
+
if (h && (x != null && x["data-item"])) {
|
|
2437
|
+
const w = x["data-item"];
|
|
2438
|
+
return (g = w == null ? void 0 : w.displayName) == null ? void 0 : g.includes(h);
|
|
2439
|
+
}
|
|
2440
|
+
return !0;
|
|
2441
|
+
},
|
|
2442
|
+
children: f.map((h) => {
|
|
2443
|
+
var x, g, w, j, L, T;
|
|
2444
|
+
return /* @__PURE__ */ u(
|
|
2445
|
+
te.OptGroup,
|
|
2446
|
+
{
|
|
2447
|
+
label: `${(g = (x = h[0]) == null ? void 0 : x.commercialModelSeries) == null ? void 0 : g.seriesName} | ${(j = (w = h[0]) == null ? void 0 : w.commercialModelSeries) != null && j.modelVendor ? `由${(T = (L = h[0]) == null ? void 0 : L.commercialModelSeries) == null ? void 0 : T.modelVendor}提供` : ""}`,
|
|
2448
|
+
children: h.map(
|
|
2449
|
+
(b) => l ? l(b) : /* @__PURE__ */ u(
|
|
2450
|
+
te.Option,
|
|
2451
|
+
{
|
|
2452
|
+
value: b == null ? void 0 : b[d],
|
|
2453
|
+
"data-item": b,
|
|
2454
|
+
disabled: b.disabled,
|
|
2455
|
+
children: /* @__PURE__ */ u(
|
|
2456
|
+
Yn,
|
|
2457
|
+
{
|
|
2458
|
+
model: b,
|
|
2459
|
+
selected: (n == null ? void 0 : n[d]) === (b == null ? void 0 : b[d]),
|
|
2460
|
+
disabled: b.disabled
|
|
2461
|
+
},
|
|
2462
|
+
b == null ? void 0 : b[d]
|
|
2463
|
+
)
|
|
2464
|
+
},
|
|
2465
|
+
b == null ? void 0 : b[d]
|
|
2466
|
+
)
|
|
2467
|
+
)
|
|
2468
|
+
}
|
|
2469
|
+
);
|
|
2470
|
+
})
|
|
2471
|
+
}
|
|
2472
|
+
);
|
|
2473
|
+
}
|
|
2474
|
+
const Xe = {
|
|
2475
|
+
"model-config-form": "_model-config-form_1su22_2"
|
|
2476
|
+
};
|
|
2477
|
+
function Or({
|
|
2478
|
+
className: e,
|
|
2479
|
+
style: t,
|
|
2480
|
+
value: n,
|
|
2481
|
+
onChange: r,
|
|
2482
|
+
disabled: o,
|
|
2483
|
+
modelSelectProps: c
|
|
2484
|
+
}) {
|
|
2485
|
+
const s = S(), [a, i] = F(
|
|
2486
|
+
c == null ? void 0 : c.value
|
|
2487
|
+
);
|
|
2488
|
+
return z(() => {
|
|
2489
|
+
var l, d;
|
|
2490
|
+
if ((a == null ? void 0 : a.id) !== (n == null ? void 0 : n.id)) {
|
|
2491
|
+
const m = Ge(a);
|
|
2492
|
+
(d = (l = s.current) == null ? void 0 : l.setValues) == null || d.call(l, m, { isOverride: !0 });
|
|
2493
|
+
}
|
|
2494
|
+
}, [a, n]), /* @__PURE__ */ y(
|
|
2495
|
+
he,
|
|
2496
|
+
{
|
|
2497
|
+
className: A(Xe["model-config-form"], e),
|
|
2498
|
+
style: t,
|
|
2499
|
+
labelWidth: 120,
|
|
2500
|
+
initValues: n,
|
|
2501
|
+
onValueChange: r,
|
|
2502
|
+
getFormApi: (l) => s.current = l,
|
|
2503
|
+
disabled: o,
|
|
2504
|
+
children: [
|
|
2505
|
+
/* @__PURE__ */ u(
|
|
2506
|
+
Je,
|
|
2507
|
+
{
|
|
2508
|
+
...c,
|
|
2509
|
+
value: a,
|
|
2510
|
+
disabled: o,
|
|
2511
|
+
onChange: i
|
|
2512
|
+
}
|
|
2513
|
+
),
|
|
2514
|
+
/* @__PURE__ */ u(Ze, { model: a })
|
|
2515
|
+
]
|
|
2516
|
+
}
|
|
2517
|
+
);
|
|
2518
|
+
}
|
|
2519
|
+
function Br({
|
|
2520
|
+
value: e,
|
|
2521
|
+
disabled: t,
|
|
2522
|
+
modelSelectProps: n,
|
|
2523
|
+
popoverProps: r,
|
|
2524
|
+
onChange: o,
|
|
2525
|
+
renderDisplayContent: c
|
|
2526
|
+
}) {
|
|
2527
|
+
const s = S(), { wrapClassName: a, wrapStyle: i, ...l } = r || {}, [d, m] = F(), [p, f] = F(!1);
|
|
2528
|
+
return z(() => {
|
|
2529
|
+
var h, x;
|
|
2530
|
+
if ((d == null ? void 0 : d.id) !== (e == null ? void 0 : e.id)) {
|
|
2531
|
+
const g = Ge(d);
|
|
2532
|
+
(x = (h = s.current) == null ? void 0 : h.setValues) == null || x.call(h, g, { isOverride: !0 });
|
|
2533
|
+
}
|
|
2534
|
+
}, [d, e]), /* @__PURE__ */ u(
|
|
2535
|
+
je,
|
|
2536
|
+
{
|
|
2537
|
+
content: /* @__PURE__ */ u("div", { className: "pt-1 px-4 pb-4", style: { width: 496 }, children: /* @__PURE__ */ y(
|
|
2538
|
+
he,
|
|
2539
|
+
{
|
|
2540
|
+
className: Xe["model-config-form"],
|
|
2541
|
+
labelWidth: 120,
|
|
2542
|
+
initValues: e,
|
|
2543
|
+
onValueChange: o,
|
|
2544
|
+
getFormApi: (h) => s.current = h,
|
|
2545
|
+
disabled: t,
|
|
2546
|
+
children: [
|
|
2547
|
+
/* @__PURE__ */ y(Z, { className: "py-0", children: [
|
|
2548
|
+
/* @__PURE__ */ u(E.Title, { heading: 6, style: { minWidth: 120 }, children: "模型选择" }),
|
|
2549
|
+
/* @__PURE__ */ u(
|
|
2550
|
+
Je,
|
|
2551
|
+
{
|
|
2552
|
+
...n,
|
|
2553
|
+
value: d,
|
|
2554
|
+
disabled: t,
|
|
2555
|
+
onChange: m
|
|
2556
|
+
}
|
|
2557
|
+
)
|
|
2558
|
+
] }),
|
|
2559
|
+
/* @__PURE__ */ u(
|
|
2560
|
+
E.Title,
|
|
2561
|
+
{
|
|
2562
|
+
heading: 6,
|
|
2563
|
+
style: { marginTop: 12, marginBottom: 12 },
|
|
2564
|
+
children: "参数配置"
|
|
2565
|
+
}
|
|
2566
|
+
),
|
|
2567
|
+
/* @__PURE__ */ u(Ze, { model: d })
|
|
2568
|
+
]
|
|
2569
|
+
}
|
|
2570
|
+
) }),
|
|
2571
|
+
keepDOM: !0,
|
|
2572
|
+
trigger: "custom",
|
|
2573
|
+
visible: p,
|
|
2574
|
+
onClickOutSide: () => f(!1),
|
|
2575
|
+
...l,
|
|
2576
|
+
children: /* @__PURE__ */ u(
|
|
2577
|
+
"div",
|
|
2578
|
+
{
|
|
2579
|
+
className: a,
|
|
2580
|
+
style: i,
|
|
2581
|
+
onClick: () => f(!0),
|
|
2582
|
+
children: c == null ? void 0 : c(d, p)
|
|
2583
|
+
}
|
|
2584
|
+
)
|
|
2585
|
+
}
|
|
2586
|
+
);
|
|
2587
|
+
}
|
|
2588
|
+
function _r({
|
|
2589
|
+
title: e,
|
|
2590
|
+
actionBtns: t,
|
|
2591
|
+
children: n,
|
|
2592
|
+
className: r,
|
|
2593
|
+
style: o
|
|
2594
|
+
}) {
|
|
2595
|
+
return /* @__PURE__ */ y(
|
|
2596
|
+
"div",
|
|
2597
|
+
{
|
|
2598
|
+
className: A("flex flex-col h-full w-full", r),
|
|
2599
|
+
style: o,
|
|
2600
|
+
children: [
|
|
2601
|
+
/* @__PURE__ */ y(
|
|
2602
|
+
"div",
|
|
2603
|
+
{
|
|
2604
|
+
className: "h-[40px] px-6 py-2 box-border coz-fg-plus w-full border-0 border-t border-b border-solid flex justify-between items-center",
|
|
2605
|
+
style: { background: "#F6F6FB" },
|
|
2606
|
+
children: [
|
|
2607
|
+
/* @__PURE__ */ u(E.Text, { strong: !0, children: e }),
|
|
2608
|
+
t
|
|
2609
|
+
]
|
|
2610
|
+
}
|
|
2611
|
+
),
|
|
2612
|
+
n
|
|
2613
|
+
]
|
|
2614
|
+
}
|
|
2615
|
+
);
|
|
2616
|
+
}
|
|
2617
|
+
const Gn = (e) => `mermaid-diagram-${(/* @__PURE__ */ new Date()).getTime()}.${e}`, qn = (e, t) => {
|
|
2618
|
+
const n = document.createElement("a");
|
|
2619
|
+
n.download = e, n.href = t, n.click(), n.remove();
|
|
2620
|
+
}, Jn = (e, t) => () => {
|
|
2621
|
+
const { canvas: n } = e;
|
|
2622
|
+
e.drawImage(t, 0, 0, n.width, n.height), qn(
|
|
2623
|
+
Gn("png"),
|
|
2624
|
+
n.toDataURL("image/png").replace("image/png", "image/octet-stream")
|
|
2625
|
+
);
|
|
2626
|
+
}, Xn = (e, t, n) => {
|
|
2627
|
+
e && (e = e.cloneNode(!0)), n && (e == null || e.setAttribute("height", `${n}px`)), t && (e == null || e.setAttribute("width", `${t}px`));
|
|
2628
|
+
const r = e.outerHTML.replaceAll("<br>", "<br/>").replaceAll(/<img([^>]*)>/g, (o, c) => `<img ${c} />`);
|
|
2629
|
+
return Ut(`<?xml version="1.0" encoding="UTF-8"?>
|
|
2630
|
+
<?xml-stylesheet href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" type="text/css"?>
|
|
2631
|
+
${r}`);
|
|
2632
|
+
}, Kn = async (e) => {
|
|
2633
|
+
await new Promise((a) => setTimeout(a, 1e3));
|
|
2634
|
+
const t = document.createElement("canvas"), n = document.querySelector(e);
|
|
2635
|
+
if (!n)
|
|
2636
|
+
return;
|
|
2637
|
+
const r = n.getBoundingClientRect(), o = 2;
|
|
2638
|
+
t.width = r.width * o, t.height = r.height * o;
|
|
2639
|
+
const c = t.getContext("2d");
|
|
2640
|
+
if (!c)
|
|
2641
|
+
throw new Error("context not found");
|
|
2642
|
+
c.fillStyle = "white", c.fillRect(0, 0, t.width, t.height);
|
|
2643
|
+
const s = new Image();
|
|
2644
|
+
s.addEventListener("load", () => {
|
|
2645
|
+
Jn(c, s)();
|
|
2646
|
+
}), s.src = `data:image/svg+xml;base64,${Xn(n, t.width, t.height)}`;
|
|
2647
|
+
}, er = ({
|
|
2648
|
+
svgSelector: e,
|
|
2649
|
+
viewportSelector: t,
|
|
2650
|
+
renderedChart: n,
|
|
2651
|
+
zoomStepLength: r = 0.25
|
|
2652
|
+
}) => {
|
|
2653
|
+
const o = S(null);
|
|
2654
|
+
return z(() => {
|
|
2655
|
+
n && import("/Users/bytedance/project/bot-studio-monorepo/common/temp/default/node_modules/.pnpm/svg-pan-zoom@3.6.2/node_modules/svg-pan-zoom/src/svg-pan-zoom.js").then((i) => {
|
|
2656
|
+
if (o.current)
|
|
2657
|
+
return;
|
|
2658
|
+
const l = i.default(e, {
|
|
2659
|
+
viewportSelector: t,
|
|
2660
|
+
mouseWheelZoomEnabled: !1
|
|
2661
|
+
});
|
|
2662
|
+
o.current = l;
|
|
2663
|
+
});
|
|
2664
|
+
}, [n]), {
|
|
2665
|
+
zoomIn: () => {
|
|
2666
|
+
var i, l;
|
|
2667
|
+
(l = o.current) == null || l.zoom(
|
|
2668
|
+
((i = o.current) == null ? void 0 : i.getZoom()) + r
|
|
2669
|
+
);
|
|
2670
|
+
},
|
|
2671
|
+
zoomOut: () => {
|
|
2672
|
+
var i, l;
|
|
2673
|
+
(l = o.current) == null || l.zoom(
|
|
2674
|
+
((i = o.current) == null ? void 0 : i.getZoom()) - r
|
|
2675
|
+
);
|
|
2676
|
+
},
|
|
2677
|
+
fit: () => {
|
|
2678
|
+
var i, l;
|
|
2679
|
+
(i = o.current) == null || i.fit(), (l = o.current) == null || l.center();
|
|
2680
|
+
}
|
|
2681
|
+
};
|
|
2682
|
+
}, tr = "_container_xyzpo_1", nr = {
|
|
2683
|
+
container: tr
|
|
2684
|
+
}, rr = {
|
|
2685
|
+
theme: "base",
|
|
2686
|
+
themeVariables: {
|
|
2687
|
+
background: "#f9fafb",
|
|
2688
|
+
fontSize: "12px",
|
|
2689
|
+
primaryColor: "#E5F6FF",
|
|
2690
|
+
primaryTextColor: "rgba(0,0,0,0.8)",
|
|
2691
|
+
secondaryColor: "#F5EBFF",
|
|
2692
|
+
primaryBorderColor: "#73A6FF",
|
|
2693
|
+
secondaryBorderColor: "#BE8FED",
|
|
2694
|
+
secondaryTextColor: "rgba(0,0,0,0.56)",
|
|
2695
|
+
tertiaryColor: "#FFF6CC",
|
|
2696
|
+
tertiaryBorderColor: "#FFBC52",
|
|
2697
|
+
tertiaryTextColor: "rgba(0,0,0,0.3)",
|
|
2698
|
+
noteBkgColor: "#F3F4F6",
|
|
2699
|
+
noteTextColor: "rgba(0,0,0,0.55)",
|
|
2700
|
+
noteBorderColor: "#A8A8A8",
|
|
2701
|
+
lineColor: "rgba(0,0,0,0.3)",
|
|
2702
|
+
textColor: "rgba(0,0,0,0.8)",
|
|
2703
|
+
errorBkgColor: "#FFEBEA",
|
|
2704
|
+
errorTextColor: "#FF3B30"
|
|
2705
|
+
}
|
|
2706
|
+
}, Rr = /* @__PURE__ */ Y(function({ chart: t, className: n }, r) {
|
|
2707
|
+
const o = S(null), c = S(`mermaid-diagram-${Vt()}`), s = `svg-${c.current}`, [a, i] = F(""), l = async (f) => {
|
|
2708
|
+
var h;
|
|
2709
|
+
if (!Ht(f))
|
|
2710
|
+
try {
|
|
2711
|
+
if (!await ne.parse(f, {
|
|
2712
|
+
suppressErrors: !0
|
|
2713
|
+
}))
|
|
2714
|
+
return;
|
|
2715
|
+
const g = await ne.render(
|
|
2716
|
+
s,
|
|
2717
|
+
f,
|
|
2718
|
+
o.current || void 0
|
|
2719
|
+
);
|
|
2720
|
+
o.current && g.svg && (o.current.innerHTML = g.svg, (h = g.bindFunctions) == null || h.call(g, o.current), i(f));
|
|
2721
|
+
} catch {
|
|
2722
|
+
f !== a && l(a);
|
|
2723
|
+
}
|
|
2724
|
+
};
|
|
2725
|
+
z(() => {
|
|
2726
|
+
ne.initialize({
|
|
2727
|
+
...rr,
|
|
2728
|
+
startOnLoad: !1,
|
|
2729
|
+
logLevel: "error",
|
|
2730
|
+
suppressErrorRendering: !0
|
|
2731
|
+
});
|
|
2732
|
+
}, []), z(() => {
|
|
2733
|
+
l(t);
|
|
2734
|
+
}, [t]);
|
|
2735
|
+
const { zoomIn: d, zoomOut: m, fit: p } = er({
|
|
2736
|
+
svgSelector: `#${s}`,
|
|
2737
|
+
viewportSelector: c.current,
|
|
2738
|
+
renderedChart: a
|
|
2739
|
+
});
|
|
2740
|
+
return q(r, () => ({
|
|
2741
|
+
zoomIn: d,
|
|
2742
|
+
zoomOut: m,
|
|
2743
|
+
fit: p,
|
|
2744
|
+
exportImg: async () => Kn(`#${s}`)
|
|
2745
|
+
})), /* @__PURE__ */ u(
|
|
2746
|
+
"div",
|
|
2747
|
+
{
|
|
2748
|
+
id: c.current,
|
|
2749
|
+
className: A(
|
|
2750
|
+
"w-full min-w-[330px] h-[300px]",
|
|
2751
|
+
nr.container,
|
|
2752
|
+
n
|
|
2753
|
+
),
|
|
2754
|
+
ref: o
|
|
2755
|
+
}
|
|
2756
|
+
);
|
|
2757
|
+
});
|
|
2758
|
+
export {
|
|
2759
|
+
Un as BaseJsonEditor,
|
|
2760
|
+
Wn as BaseRawTextEditor,
|
|
2761
|
+
Or as BasicModelConfigEditor,
|
|
2762
|
+
Qr as Decoration,
|
|
2763
|
+
_r as DevLayout,
|
|
2764
|
+
$r as EditorProvider,
|
|
2765
|
+
Xr as EditorSelection,
|
|
2766
|
+
Zr as EditorView,
|
|
2767
|
+
Rr as MermaidDiagram,
|
|
2768
|
+
Je as ModelSelect,
|
|
2769
|
+
Br as PopoverModelConfigEdiotr,
|
|
2770
|
+
Kr as Prec,
|
|
2771
|
+
Nn as PromptBasicEditor,
|
|
2772
|
+
Fr as PromptDiffEditor,
|
|
2773
|
+
Tr as PromptEditor,
|
|
2774
|
+
Lr as SchemaEditor,
|
|
2775
|
+
eo as StateEffect,
|
|
2776
|
+
to as StateField,
|
|
2777
|
+
Gr as WidgetType,
|
|
2778
|
+
Ne as cunstomFacet,
|
|
2779
|
+
Sr as deleteMarkupBackward,
|
|
2780
|
+
bn as insertFourSpaces,
|
|
2781
|
+
jr as insertNewlineContinueMarkup,
|
|
2782
|
+
qr as keymap,
|
|
2783
|
+
ro as regexpDecorator,
|
|
2784
|
+
oo as updateRegexpDecorations,
|
|
2785
|
+
Pr as useEditor,
|
|
2786
|
+
Ur as useInjector,
|
|
2787
|
+
Wr as useLatest
|
|
2788
|
+
};
|