@godscene/visualizer 1.7.11
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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/es/component/blackboard/highlights.mjs +47 -0
- package/dist/es/component/blackboard/index.css +118 -0
- package/dist/es/component/blackboard/index.mjs +122 -0
- package/dist/es/component/config-selector/index.mjs +251 -0
- package/dist/es/component/context-preview/index.mjs +37 -0
- package/dist/es/component/env-config/index.mjs +237 -0
- package/dist/es/component/env-config-reminder/index.css +30 -0
- package/dist/es/component/env-config-reminder/index.mjs +27 -0
- package/dist/es/component/form-field/index.mjs +158 -0
- package/dist/es/component/history-selector/index.css +237 -0
- package/dist/es/component/history-selector/index.mjs +197 -0
- package/dist/es/component/index.mjs +1 -0
- package/dist/es/component/logo/index.css +19 -0
- package/dist/es/component/logo/index.mjs +20 -0
- package/dist/es/component/logo/logo.mjs +2 -0
- package/dist/es/component/misc/index.mjs +96 -0
- package/dist/es/component/nav-actions/index.mjs +14 -0
- package/dist/es/component/nav-actions/style.css +35 -0
- package/dist/es/component/player/index.css +296 -0
- package/dist/es/component/player/index.mjs +702 -0
- package/dist/es/component/player/playback-controls.mjs +4 -0
- package/dist/es/component/player/report-download.mjs +61 -0
- package/dist/es/component/player/scenes/StepScene.mjs +194 -0
- package/dist/es/component/player/scenes/derive-frame-state.mjs +229 -0
- package/dist/es/component/player/scenes/export-branded-video.mjs +360 -0
- package/dist/es/component/player/scenes/frame-calculator.mjs +149 -0
- package/dist/es/component/player/scenes/playback-frame.mjs +6 -0
- package/dist/es/component/player/scenes/playback-layout.mjs +12 -0
- package/dist/es/component/player/scenes/pointer-layout.mjs +36 -0
- package/dist/es/component/player/use-frame-player.mjs +87 -0
- package/dist/es/component/playground/index.css +930 -0
- package/dist/es/component/playground/playground-demo-ui-context.json +290 -0
- package/dist/es/component/playground-result/index.css +92 -0
- package/dist/es/component/playground-result/index.mjs +232 -0
- package/dist/es/component/prompt-input/index.css +832 -0
- package/dist/es/component/prompt-input/index.mjs +959 -0
- package/dist/es/component/screenshot-viewer/index.css +237 -0
- package/dist/es/component/screenshot-viewer/index.mjs +319 -0
- package/dist/es/component/service-mode-control/index.mjs +107 -0
- package/dist/es/component/shiny-text/index.css +107 -0
- package/dist/es/component/shiny-text/index.mjs +15 -0
- package/dist/es/component/universal-playground/empty-state.mjs +5 -0
- package/dist/es/component/universal-playground/index.css +619 -0
- package/dist/es/component/universal-playground/index.mjs +558 -0
- package/dist/es/component/universal-playground/providers/context-provider.mjs +90 -0
- package/dist/es/component/universal-playground/providers/indexeddb-storage-provider.mjs +280 -0
- package/dist/es/component/universal-playground/providers/storage-provider.mjs +279 -0
- package/dist/es/component/universal-playground/universal-playground-electron.mjs +668 -0
- package/dist/es/hooks/useMinimalTypeGate.mjs +47 -0
- package/dist/es/hooks/usePlaygroundExecution.mjs +435 -0
- package/dist/es/hooks/usePlaygroundState.mjs +278 -0
- package/dist/es/hooks/useSafeOverrideAIConfig.mjs +20 -0
- package/dist/es/hooks/useServerValid.mjs +55 -0
- package/dist/es/hooks/useTheme.mjs +25 -0
- package/dist/es/icons/action-chevron.mjs +61 -0
- package/dist/es/icons/avatar.mjs +70 -0
- package/dist/es/icons/close.mjs +61 -0
- package/dist/es/icons/global-perspective.mjs +58 -0
- package/dist/es/icons/history.mjs +72 -0
- package/dist/es/icons/magnifying-glass.mjs +81 -0
- package/dist/es/icons/player-setting.mjs +68 -0
- package/dist/es/icons/prompt-history.mjs +70 -0
- package/dist/es/icons/setting.mjs +62 -0
- package/dist/es/icons/show-marker.mjs +58 -0
- package/dist/es/index.mjs +26 -0
- package/dist/es/static/image/logo.png +0 -0
- package/dist/es/store/history.mjs +128 -0
- package/dist/es/store/store.mjs +277 -0
- package/dist/es/types.mjs +73 -0
- package/dist/es/utils/action-label.mjs +15 -0
- package/dist/es/utils/color.mjs +35 -0
- package/dist/es/utils/constants.mjs +99 -0
- package/dist/es/utils/device-capabilities.mjs +13 -0
- package/dist/es/utils/empty-state-scroll.mjs +8 -0
- package/dist/es/utils/highlight-element.mjs +62 -0
- package/dist/es/utils/index.mjs +13 -0
- package/dist/es/utils/playground-utils.mjs +43 -0
- package/dist/es/utils/progress-action-icon.mjs +30 -0
- package/dist/es/utils/prompt-input-utils.mjs +49 -0
- package/dist/es/utils/prompt-placeholder.mjs +19 -0
- package/dist/es/utils/replay-scripts.mjs +428 -0
- package/dist/lib/component/blackboard/highlights.js +84 -0
- package/dist/lib/component/blackboard/index.css +118 -0
- package/dist/lib/component/blackboard/index.js +169 -0
- package/dist/lib/component/config-selector/index.js +295 -0
- package/dist/lib/component/context-preview/index.js +82 -0
- package/dist/lib/component/env-config/index.js +271 -0
- package/dist/lib/component/env-config-reminder/index.css +30 -0
- package/dist/lib/component/env-config-reminder/index.js +61 -0
- package/dist/lib/component/form-field/index.js +204 -0
- package/dist/lib/component/history-selector/index.css +237 -0
- package/dist/lib/component/history-selector/index.js +243 -0
- package/dist/lib/component/index.js +58 -0
- package/dist/lib/component/logo/index.css +19 -0
- package/dist/lib/component/logo/index.js +67 -0
- package/dist/lib/component/logo/logo.js +24 -0
- package/dist/lib/component/misc/index.js +152 -0
- package/dist/lib/component/nav-actions/index.js +48 -0
- package/dist/lib/component/nav-actions/style.css +35 -0
- package/dist/lib/component/player/index.css +296 -0
- package/dist/lib/component/player/index.js +747 -0
- package/dist/lib/component/player/playback-controls.js +38 -0
- package/dist/lib/component/player/report-download.js +98 -0
- package/dist/lib/component/player/scenes/StepScene.js +228 -0
- package/dist/lib/component/player/scenes/derive-frame-state.js +266 -0
- package/dist/lib/component/player/scenes/export-branded-video.js +403 -0
- package/dist/lib/component/player/scenes/frame-calculator.js +186 -0
- package/dist/lib/component/player/scenes/playback-frame.js +40 -0
- package/dist/lib/component/player/scenes/playback-layout.js +46 -0
- package/dist/lib/component/player/scenes/pointer-layout.js +88 -0
- package/dist/lib/component/player/use-frame-player.js +121 -0
- package/dist/lib/component/playground/index.css +930 -0
- package/dist/lib/component/playground/playground-demo-ui-context.json +290 -0
- package/dist/lib/component/playground-result/index.css +92 -0
- package/dist/lib/component/playground-result/index.js +276 -0
- package/dist/lib/component/prompt-input/index.css +832 -0
- package/dist/lib/component/prompt-input/index.js +1005 -0
- package/dist/lib/component/screenshot-viewer/index.css +237 -0
- package/dist/lib/component/screenshot-viewer/index.js +353 -0
- package/dist/lib/component/service-mode-control/index.js +141 -0
- package/dist/lib/component/shiny-text/index.css +107 -0
- package/dist/lib/component/shiny-text/index.js +49 -0
- package/dist/lib/component/universal-playground/empty-state.js +39 -0
- package/dist/lib/component/universal-playground/index.css +619 -0
- package/dist/lib/component/universal-playground/index.js +607 -0
- package/dist/lib/component/universal-playground/providers/context-provider.js +133 -0
- package/dist/lib/component/universal-playground/providers/indexeddb-storage-provider.js +320 -0
- package/dist/lib/component/universal-playground/providers/storage-provider.js +337 -0
- package/dist/lib/component/universal-playground/universal-playground-electron.js +717 -0
- package/dist/lib/hooks/useMinimalTypeGate.js +81 -0
- package/dist/lib/hooks/usePlaygroundExecution.js +478 -0
- package/dist/lib/hooks/usePlaygroundState.js +312 -0
- package/dist/lib/hooks/useSafeOverrideAIConfig.js +57 -0
- package/dist/lib/hooks/useServerValid.js +89 -0
- package/dist/lib/hooks/useTheme.js +59 -0
- package/dist/lib/icons/action-chevron.js +95 -0
- package/dist/lib/icons/avatar.js +104 -0
- package/dist/lib/icons/close.js +95 -0
- package/dist/lib/icons/global-perspective.js +92 -0
- package/dist/lib/icons/history.js +106 -0
- package/dist/lib/icons/magnifying-glass.js +115 -0
- package/dist/lib/icons/player-setting.js +102 -0
- package/dist/lib/icons/prompt-history.js +104 -0
- package/dist/lib/icons/setting.js +96 -0
- package/dist/lib/icons/show-marker.js +92 -0
- package/dist/lib/index.js +204 -0
- package/dist/lib/static/image/logo.png +0 -0
- package/dist/lib/store/history.js +135 -0
- package/dist/lib/store/store.js +287 -0
- package/dist/lib/types.js +119 -0
- package/dist/lib/utils/action-label.js +52 -0
- package/dist/lib/utils/color.js +75 -0
- package/dist/lib/utils/constants.js +172 -0
- package/dist/lib/utils/device-capabilities.js +50 -0
- package/dist/lib/utils/empty-state-scroll.js +42 -0
- package/dist/lib/utils/highlight-element.js +99 -0
- package/dist/lib/utils/index.js +69 -0
- package/dist/lib/utils/playground-utils.js +86 -0
- package/dist/lib/utils/progress-action-icon.js +67 -0
- package/dist/lib/utils/prompt-input-utils.js +89 -0
- package/dist/lib/utils/prompt-placeholder.js +53 -0
- package/dist/lib/utils/replay-scripts.js +474 -0
- package/dist/types/component/blackboard/highlights.d.ts +11 -0
- package/dist/types/component/blackboard/index.d.ts +10 -0
- package/dist/types/component/config-selector/index.d.ts +15 -0
- package/dist/types/component/context-preview/index.d.ts +9 -0
- package/dist/types/component/env-config/index.d.ts +8 -0
- package/dist/types/component/env-config-reminder/index.d.ts +6 -0
- package/dist/types/component/form-field/index.d.ts +17 -0
- package/dist/types/component/history-selector/index.d.ts +13 -0
- package/dist/types/component/index.d.ts +1 -0
- package/dist/types/component/logo/index.d.ts +5 -0
- package/dist/types/component/misc/index.d.ts +6 -0
- package/dist/types/component/nav-actions/index.d.ts +12 -0
- package/dist/types/component/player/index.d.ts +15 -0
- package/dist/types/component/player/playback-controls.d.ts +1 -0
- package/dist/types/component/player/report-download.d.ts +32 -0
- package/dist/types/component/player/scenes/StepScene.d.ts +9 -0
- package/dist/types/component/player/scenes/derive-frame-state.d.ts +40 -0
- package/dist/types/component/player/scenes/export-branded-video.d.ts +33 -0
- package/dist/types/component/player/scenes/frame-calculator.d.ts +40 -0
- package/dist/types/component/player/scenes/playback-frame.d.ts +3 -0
- package/dist/types/component/player/scenes/playback-layout.d.ts +7 -0
- package/dist/types/component/player/scenes/pointer-layout.d.ts +20 -0
- package/dist/types/component/player/use-frame-player.d.ts +17 -0
- package/dist/types/component/playground-result/index.d.ts +22 -0
- package/dist/types/component/prompt-input/index.d.ts +23 -0
- package/dist/types/component/screenshot-viewer/index.d.ts +23 -0
- package/dist/types/component/service-mode-control/index.d.ts +6 -0
- package/dist/types/component/shiny-text/index.d.ts +12 -0
- package/dist/types/component/universal-playground/empty-state.d.ts +3 -0
- package/dist/types/component/universal-playground/index.d.ts +4 -0
- package/dist/types/component/universal-playground/providers/context-provider.d.ts +37 -0
- package/dist/types/component/universal-playground/providers/indexeddb-storage-provider.d.ts +71 -0
- package/dist/types/component/universal-playground/providers/storage-provider.d.ts +58 -0
- package/dist/types/component/universal-playground/universal-playground-electron.d.ts +4 -0
- package/dist/types/hooks/useMinimalTypeGate.d.ts +72 -0
- package/dist/types/hooks/usePlaygroundExecution.d.ts +40 -0
- package/dist/types/hooks/usePlaygroundState.d.ts +26 -0
- package/dist/types/hooks/useSafeOverrideAIConfig.d.ts +16 -0
- package/dist/types/hooks/useServerValid.d.ts +1 -0
- package/dist/types/hooks/useTheme.d.ts +7 -0
- package/dist/types/index.d.ts +29 -0
- package/dist/types/store/history.d.ts +16 -0
- package/dist/types/store/store.d.ts +57 -0
- package/dist/types/types.d.ts +278 -0
- package/dist/types/utils/action-label.d.ts +11 -0
- package/dist/types/utils/color.d.ts +4 -0
- package/dist/types/utils/constants.d.ts +80 -0
- package/dist/types/utils/device-capabilities.d.ts +9 -0
- package/dist/types/utils/empty-state-scroll.d.ts +11 -0
- package/dist/types/utils/highlight-element.d.ts +3 -0
- package/dist/types/utils/index.d.ts +5 -0
- package/dist/types/utils/playground-utils.d.ts +11 -0
- package/dist/types/utils/progress-action-icon.d.ts +12 -0
- package/dist/types/utils/prompt-input-utils.d.ts +24 -0
- package/dist/types/utils/prompt-placeholder.d.ts +1 -0
- package/dist/types/utils/replay-scripts.d.ts +50 -0
- package/package.json +82 -0
|
@@ -0,0 +1,1005 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
PromptInput: ()=>PromptInput
|
|
37
|
+
});
|
|
38
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
|
+
const icons_namespaceObject = require("@ant-design/icons");
|
|
40
|
+
const external_antd_namespaceObject = require("antd");
|
|
41
|
+
const external_react_namespaceObject = require("react");
|
|
42
|
+
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
43
|
+
const useMinimalTypeGate_js_namespaceObject = require("../../hooks/useMinimalTypeGate.js");
|
|
44
|
+
const action_chevron_js_namespaceObject = require("../../icons/action-chevron.js");
|
|
45
|
+
var action_chevron_js_default = /*#__PURE__*/ __webpack_require__.n(action_chevron_js_namespaceObject);
|
|
46
|
+
const prompt_history_js_namespaceObject = require("../../icons/prompt-history.js");
|
|
47
|
+
var prompt_history_js_default = /*#__PURE__*/ __webpack_require__.n(prompt_history_js_namespaceObject);
|
|
48
|
+
const history_js_namespaceObject = require("../../store/history.js");
|
|
49
|
+
const external_types_js_namespaceObject = require("../../types.js");
|
|
50
|
+
const action_label_js_namespaceObject = require("../../utils/action-label.js");
|
|
51
|
+
const constants_js_namespaceObject = require("../../utils/constants.js");
|
|
52
|
+
const device_capabilities_js_namespaceObject = require("../../utils/device-capabilities.js");
|
|
53
|
+
const playground_utils_js_namespaceObject = require("../../utils/playground-utils.js");
|
|
54
|
+
const prompt_input_utils_js_namespaceObject = require("../../utils/prompt-input-utils.js");
|
|
55
|
+
const prompt_placeholder_js_namespaceObject = require("../../utils/prompt-placeholder.js");
|
|
56
|
+
const index_js_namespaceObject = require("../config-selector/index.js");
|
|
57
|
+
const external_form_field_index_js_namespaceObject = require("../form-field/index.js");
|
|
58
|
+
const external_history_selector_index_js_namespaceObject = require("../history-selector/index.js");
|
|
59
|
+
require("./index.css");
|
|
60
|
+
function _define_property(obj, key, value) {
|
|
61
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
62
|
+
value: value,
|
|
63
|
+
enumerable: true,
|
|
64
|
+
configurable: true,
|
|
65
|
+
writable: true
|
|
66
|
+
});
|
|
67
|
+
else obj[key] = value;
|
|
68
|
+
return obj;
|
|
69
|
+
}
|
|
70
|
+
function _object_spread(target) {
|
|
71
|
+
for(var i = 1; i < arguments.length; i++){
|
|
72
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
73
|
+
var ownKeys = Object.keys(source);
|
|
74
|
+
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
75
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
76
|
+
}));
|
|
77
|
+
ownKeys.forEach(function(key) {
|
|
78
|
+
_define_property(target, key, source[key]);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return target;
|
|
82
|
+
}
|
|
83
|
+
const { TextArea } = external_antd_namespaceObject.Input;
|
|
84
|
+
const STUDIO_MINIMAL_PROMPT_ICONS = {
|
|
85
|
+
action: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAASdJREFUeAHtlt3NgjAUhg8/CVx+G8gGX5xAnUDdQMcgkIgJBLbQEXQD3MAR6gZewgXgOUn9iRp6vAC96JM07YG36Zv+nBZAwySO4ymWgUoXRdEfaYGJyRElSbKyLGuHJVdpHcc5khb7RMCAZcA0TU82PYZ8IPsoZ4ttoEu0ga8bMB6DNE1X8H6jTUBuLmQL7SxkLbDkzz/ruhZBEKxfDGRZNm2aZgc9UFXVLAzDPbVvS1AUxQGrE3SPwHK8BganBy7NBuTU+r5vKLSNbG5RuwQF+hRoA9rA76RifMl4+JjI4Z5yu0KUZTnE8c4U3GbAdd3/HgYnPNu2R9eg98uIvmOGfL2M2tCpWBv4BQPiqW7j9IGWZ4CODT7X5pRAVFrUjEn7eNQ0bVwAyWpjMDlJKpAAAAAASUVORK5CYII=',
|
|
86
|
+
actionChevron: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAAUxJREFUeAHtUztOw0AQ3V1SuLCldP4VuEyHuQE34Aqho0tugHKCwBFyApwTYEoqyAlwCsufKkgu3NjmjfkoCDu7KSP5SaNZ774Zv9nZYWzAgH2MAdu2z4+J4apEy7I8uBDWlGV5uQNU4gRTBOd8CUfqPU3THlXjzlRIUH8HdwuLYB8wX9d1XhRFKIuVXpHjONd1XQdN0+yEED48h72iojGOr9I0fT4ULyTKPSR/aJVwPk+SZIuEET6n33uBrOmyHoTs694XSLz62cyybI3k96iEqgjodbFjAWVLVNDAnvo4dEYc4vZxOiswTXMGdXMsIyidsn7cwLbExU9mXQTeocqDe28POffo3tkBuK57UVXVG63RLz/P8w3rq2BvmH6byiSI43hD3DaZEP/68WcODMOg9z5BySs0dcEUgXl4wVzQ0h+NRhN8r9mAAaeDT7K0eaMcqhtVAAAAAElFTkSuQmCC',
|
|
87
|
+
settings: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAAaFJREFUeAHtlt9tgzAQxi8EJa/pBMkIHYENygalG7RvSQQKlfjz2I5ANkg3oBukG6QbtI9IIPq5ihHQOBXmFImqPwnZBvtsf9ydTfQPA77vz4IguCENDGJgOp3ux+PxLgxDnzrCsgAw/zZmGPOO48iUFci4wE42xITKXlEUO9d1X34s4NjZISZU9qCSjeKqastKWZYpMaKyNxqNto02MRDHcXmsJqvV6q7LWBYnxK4+SBOTeHDw2HAwn4aGlg9EUfQE2e+xYwchtaUeaPmAmFyUyH4W9aThA9jZ7alOiN39crl8O/FpoRpzjrq96hcgj2/wwVcNQlxb6/X6VdRrYaeNtGfUVvXbgE9iRNprOCHktPF/Z+3OeZ4fPM9LZbumgHjX2Qnr9rSioE/ma6MVBZDvWWQ/cbLR0GE5jEQoQhFLpGIkpvcuY1nOAkyeiBKJSRSXPw37UCkgbrWmaSZwsBkxoLInHBgJ6EG2KwUgn801+Tl78hyRVApkWfaIexxp4rRfqOzBUdN6+29cyYAMvQN1hCUMIbc1mUyu4VzDz4wX5wvRfah9kIOcwwAAAABJRU5ErkJggg=='
|
|
88
|
+
};
|
|
89
|
+
const PromptInput = ({ runButtonEnabled, form, serviceMode, selectedType, dryMode, stoppable, loading, onRun, onStop, clearPromptAfterRun = true, actionSpace, hideDomAndScreenshotOptions = false, deviceType, chrome })=>{
|
|
90
|
+
var _ref, _ref1;
|
|
91
|
+
var _chrome_icons, _chrome_icons1, _chrome_icons2, _chrome_icons3;
|
|
92
|
+
const [hoveringSettings, setHoveringSettings] = (0, external_react_namespaceObject.useState)(false);
|
|
93
|
+
const [promptValue, setPromptValue] = (0, external_react_namespaceObject.useState)('');
|
|
94
|
+
const placeholder = (0, prompt_placeholder_js_namespaceObject.getPlaceholderForType)(selectedType);
|
|
95
|
+
const isMinimalChrome = (null == chrome ? void 0 : chrome.variant) === 'minimal';
|
|
96
|
+
const resolvedPlaceholder = (null == chrome ? void 0 : chrome.placeholder) || placeholder;
|
|
97
|
+
const actionButtonLabel = (0, action_label_js_namespaceObject.getPromptInputActionLabel)(selectedType, null == chrome ? void 0 : chrome.primaryActionLabel);
|
|
98
|
+
const textAreaRef = (0, external_react_namespaceObject.useRef)(null);
|
|
99
|
+
const modeRadioGroupRef = (0, external_react_namespaceObject.useRef)(null);
|
|
100
|
+
const params = external_antd_namespaceObject.Form.useWatch('params', form);
|
|
101
|
+
const lastHistoryRef = (0, external_react_namespaceObject.useRef)(null);
|
|
102
|
+
const history = (0, history_js_namespaceObject.useHistoryStore)((state)=>state.history);
|
|
103
|
+
const lastSelectedType = (0, history_js_namespaceObject.useHistoryStore)((state)=>state.lastSelectedType);
|
|
104
|
+
const addHistory = (0, history_js_namespaceObject.useHistoryStore)((state)=>state.addHistory);
|
|
105
|
+
const setLastSelectedType = (0, history_js_namespaceObject.useHistoryStore)((state)=>state.setLastSelectedType);
|
|
106
|
+
const historyForSelectedType = (0, external_react_namespaceObject.useMemo)(()=>history[selectedType] || [], [
|
|
107
|
+
history,
|
|
108
|
+
selectedType
|
|
109
|
+
]);
|
|
110
|
+
const handleMinimalTypeGateReset = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
111
|
+
lastHistoryRef.current = null;
|
|
112
|
+
setPromptValue('');
|
|
113
|
+
}, []);
|
|
114
|
+
const { markExplicitSelection, skipNextRestore, shouldSkipRestoreOnce } = (0, useMinimalTypeGate_js_namespaceObject.useMinimalTypeGate)({
|
|
115
|
+
enabled: isMinimalChrome,
|
|
116
|
+
form,
|
|
117
|
+
selectedType,
|
|
118
|
+
onAfterReset: handleMinimalTypeGateReset
|
|
119
|
+
});
|
|
120
|
+
const needsStructuredParams = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
121
|
+
if (actionSpace) {
|
|
122
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
123
|
+
if (!(null == action ? void 0 : action.paramSchema)) return false;
|
|
124
|
+
if ((0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) {
|
|
125
|
+
const schema = action.paramSchema;
|
|
126
|
+
const shape = schema.shape || {};
|
|
127
|
+
const shapeKeys = Object.keys(shape);
|
|
128
|
+
return shapeKeys.length > 0;
|
|
129
|
+
}
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
}, [
|
|
134
|
+
selectedType,
|
|
135
|
+
actionSpace
|
|
136
|
+
]);
|
|
137
|
+
const needsAnyInput = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
138
|
+
if (actionSpace && actionSpace.length > 0) {
|
|
139
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
140
|
+
if (action) {
|
|
141
|
+
if (action.paramSchema && (0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) {
|
|
142
|
+
const schema = action.paramSchema;
|
|
143
|
+
const shape = schema.shape || {};
|
|
144
|
+
const hasRequiredFields = Object.keys(shape).some((key)=>{
|
|
145
|
+
const field = shape[key];
|
|
146
|
+
const { isOptional } = (0, external_types_js_namespaceObject.unwrapZodType)(field);
|
|
147
|
+
return !isOptional;
|
|
148
|
+
});
|
|
149
|
+
return hasRequiredFields;
|
|
150
|
+
}
|
|
151
|
+
return !!action.paramSchema;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
}, [
|
|
156
|
+
selectedType,
|
|
157
|
+
actionSpace
|
|
158
|
+
]);
|
|
159
|
+
const showDataExtractionOptions = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
160
|
+
const dataExtractionMethods = [
|
|
161
|
+
'aiQuery',
|
|
162
|
+
'aiBoolean',
|
|
163
|
+
'aiNumber',
|
|
164
|
+
'aiString',
|
|
165
|
+
'aiAsk',
|
|
166
|
+
'aiAssert'
|
|
167
|
+
];
|
|
168
|
+
return dataExtractionMethods.includes(selectedType);
|
|
169
|
+
}, [
|
|
170
|
+
selectedType
|
|
171
|
+
]);
|
|
172
|
+
const showDeepLocateOption = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
173
|
+
if ('aiAct' === selectedType || 'aiLocate' === selectedType) return true;
|
|
174
|
+
if (actionSpace) {
|
|
175
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
176
|
+
if ((null == action ? void 0 : action.paramSchema) && (0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) {
|
|
177
|
+
const schema = action.paramSchema;
|
|
178
|
+
const shape = schema.shape || {};
|
|
179
|
+
const hasLocateField = Object.keys(shape).some((key)=>{
|
|
180
|
+
const field = shape[key];
|
|
181
|
+
const { actualField } = (0, external_types_js_namespaceObject.unwrapZodType)(field);
|
|
182
|
+
return (0, external_types_js_namespaceObject.isLocateField)(actualField);
|
|
183
|
+
});
|
|
184
|
+
return hasLocateField;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return false;
|
|
188
|
+
}, [
|
|
189
|
+
selectedType,
|
|
190
|
+
actionSpace
|
|
191
|
+
]);
|
|
192
|
+
const showDeepThinkOption = (0, external_react_namespaceObject.useMemo)(()=>'aiAct' === selectedType, [
|
|
193
|
+
selectedType
|
|
194
|
+
]);
|
|
195
|
+
const hasConfigOptions = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
196
|
+
const hasTracking = 'In-Browser-Extension' === serviceMode;
|
|
197
|
+
const hasDeepLocate = showDeepLocateOption;
|
|
198
|
+
const hasDeepThink = showDeepThinkOption;
|
|
199
|
+
const hasDataExtraction = showDataExtractionOptions && !hideDomAndScreenshotOptions;
|
|
200
|
+
const hasDeviceOptions = (0, device_capabilities_js_namespaceObject.hasDeviceSpecificConfig)(deviceType);
|
|
201
|
+
return hasTracking || hasDeepLocate || hasDeepThink || hasDataExtraction || hasDeviceOptions;
|
|
202
|
+
}, [
|
|
203
|
+
serviceMode,
|
|
204
|
+
showDeepLocateOption,
|
|
205
|
+
showDeepThinkOption,
|
|
206
|
+
showDataExtractionOptions,
|
|
207
|
+
hideDomAndScreenshotOptions,
|
|
208
|
+
deviceType
|
|
209
|
+
]);
|
|
210
|
+
const availableDropdownMethods = (0, external_react_namespaceObject.useMemo)(()=>(0, prompt_input_utils_js_namespaceObject.getAvailablePromptActionTypes)(actionSpace), [
|
|
211
|
+
actionSpace
|
|
212
|
+
]);
|
|
213
|
+
const hiddenDropdownAPIs = (0, external_react_namespaceObject.useMemo)(()=>availableDropdownMethods.filter((api)=>!constants_js_namespaceObject.defaultMainButtons.includes(api)), [
|
|
214
|
+
availableDropdownMethods
|
|
215
|
+
]);
|
|
216
|
+
const handleTypeSelect = (0, external_react_namespaceObject.useCallback)((api)=>{
|
|
217
|
+
markExplicitSelection();
|
|
218
|
+
form.setFieldValue('type', api);
|
|
219
|
+
}, [
|
|
220
|
+
form,
|
|
221
|
+
markExplicitSelection
|
|
222
|
+
]);
|
|
223
|
+
const apiGroupDefinitions = (0, external_react_namespaceObject.useMemo)(()=>[
|
|
224
|
+
{
|
|
225
|
+
key: 'interaction-group',
|
|
226
|
+
label: 'Interaction APIs',
|
|
227
|
+
match: (api)=>{
|
|
228
|
+
var _apiMetadata_api;
|
|
229
|
+
return (null == (_apiMetadata_api = constants_js_namespaceObject.apiMetadata[api]) ? void 0 : _apiMetadata_api.group) === 'interaction';
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
key: 'extraction-group',
|
|
234
|
+
label: 'Data Extraction APIs',
|
|
235
|
+
match: (api)=>{
|
|
236
|
+
var _apiMetadata_api;
|
|
237
|
+
return (null == (_apiMetadata_api = constants_js_namespaceObject.apiMetadata[api]) ? void 0 : _apiMetadata_api.group) === 'extraction';
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
key: 'validation-group',
|
|
242
|
+
label: 'Validation APIs',
|
|
243
|
+
match: (api)=>{
|
|
244
|
+
var _apiMetadata_api;
|
|
245
|
+
return (null == (_apiMetadata_api = constants_js_namespaceObject.apiMetadata[api]) ? void 0 : _apiMetadata_api.group) === 'validation';
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
key: 'device-specific-group',
|
|
250
|
+
label: 'Device-Specific APIs',
|
|
251
|
+
match: (api)=>!constants_js_namespaceObject.apiMetadata[api]
|
|
252
|
+
}
|
|
253
|
+
], []);
|
|
254
|
+
const buildApiMenuItem = (0, external_react_namespaceObject.useCallback)((api)=>{
|
|
255
|
+
var _apiMetadata_api;
|
|
256
|
+
return {
|
|
257
|
+
key: api,
|
|
258
|
+
label: (0, playground_utils_js_namespaceObject.actionNameForType)(api),
|
|
259
|
+
title: (null == (_apiMetadata_api = constants_js_namespaceObject.apiMetadata[api]) ? void 0 : _apiMetadata_api.title) || '',
|
|
260
|
+
onClick: ()=>handleTypeSelect(api)
|
|
261
|
+
};
|
|
262
|
+
}, [
|
|
263
|
+
handleTypeSelect
|
|
264
|
+
]);
|
|
265
|
+
const hiddenApiGroupItems = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
266
|
+
const items = [];
|
|
267
|
+
for (const group of apiGroupDefinitions){
|
|
268
|
+
const apisInGroup = hiddenDropdownAPIs.filter(group.match);
|
|
269
|
+
if (0 !== apisInGroup.length) items.push({
|
|
270
|
+
key: group.key,
|
|
271
|
+
type: 'group',
|
|
272
|
+
label: group.label,
|
|
273
|
+
children: apisInGroup.map(buildApiMenuItem)
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
return items;
|
|
277
|
+
}, [
|
|
278
|
+
apiGroupDefinitions,
|
|
279
|
+
hiddenDropdownAPIs,
|
|
280
|
+
buildApiMenuItem
|
|
281
|
+
]);
|
|
282
|
+
const actionDropdownMenu = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
283
|
+
const primaryActions = constants_js_namespaceObject.defaultMainButtons.filter((api)=>availableDropdownMethods.includes(api));
|
|
284
|
+
const items = [];
|
|
285
|
+
if (primaryActions.length > 0) items.push({
|
|
286
|
+
key: 'primary-group',
|
|
287
|
+
type: 'group',
|
|
288
|
+
label: 'Primary APIs',
|
|
289
|
+
children: primaryActions.map(buildApiMenuItem)
|
|
290
|
+
});
|
|
291
|
+
items.push(...hiddenApiGroupItems);
|
|
292
|
+
return {
|
|
293
|
+
items
|
|
294
|
+
};
|
|
295
|
+
}, [
|
|
296
|
+
availableDropdownMethods,
|
|
297
|
+
buildApiMenuItem,
|
|
298
|
+
hiddenApiGroupItems
|
|
299
|
+
]);
|
|
300
|
+
const moreApisDropdownMenu = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
301
|
+
items: hiddenApiGroupItems
|
|
302
|
+
}), [
|
|
303
|
+
hiddenApiGroupItems
|
|
304
|
+
]);
|
|
305
|
+
const getDefaultParams = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
306
|
+
if (!needsStructuredParams || !actionSpace) return {};
|
|
307
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
308
|
+
if ((null == action ? void 0 : action.paramSchema) && (0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) {
|
|
309
|
+
const defaultParams = {};
|
|
310
|
+
const schema = action.paramSchema;
|
|
311
|
+
const shape = schema.shape || {};
|
|
312
|
+
Object.keys(shape).forEach((key)=>{
|
|
313
|
+
const field = shape[key];
|
|
314
|
+
const defaultValue = (0, external_types_js_namespaceObject.extractDefaultValue)(field);
|
|
315
|
+
if (void 0 !== defaultValue) defaultParams[key] = defaultValue;
|
|
316
|
+
});
|
|
317
|
+
return defaultParams;
|
|
318
|
+
}
|
|
319
|
+
return {};
|
|
320
|
+
}, [
|
|
321
|
+
selectedType,
|
|
322
|
+
needsStructuredParams,
|
|
323
|
+
actionSpace
|
|
324
|
+
]);
|
|
325
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
326
|
+
if (!isMinimalChrome && !form.getFieldValue('type') && lastSelectedType) form.setFieldValue('type', lastSelectedType);
|
|
327
|
+
}, [
|
|
328
|
+
form,
|
|
329
|
+
isMinimalChrome,
|
|
330
|
+
lastSelectedType
|
|
331
|
+
]);
|
|
332
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
333
|
+
if (!isMinimalChrome && selectedType && selectedType !== lastSelectedType) setLastSelectedType(selectedType);
|
|
334
|
+
}, [
|
|
335
|
+
selectedType,
|
|
336
|
+
isMinimalChrome,
|
|
337
|
+
lastSelectedType,
|
|
338
|
+
setLastSelectedType
|
|
339
|
+
]);
|
|
340
|
+
const scrollToSelectedItem = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
341
|
+
const container = modeRadioGroupRef.current;
|
|
342
|
+
if (!container) return;
|
|
343
|
+
let targetElement = null;
|
|
344
|
+
const selectedRadioButton = container.querySelector('.ant-radio-button-wrapper-checked');
|
|
345
|
+
const dropdownButton = container.querySelector('.more-apis-button.selected-from-dropdown');
|
|
346
|
+
if (selectedRadioButton) targetElement = selectedRadioButton;
|
|
347
|
+
else if (dropdownButton) targetElement = dropdownButton;
|
|
348
|
+
if (targetElement) {
|
|
349
|
+
const containerRect = container.getBoundingClientRect();
|
|
350
|
+
const targetRect = targetElement.getBoundingClientRect();
|
|
351
|
+
const targetLeft = targetRect.left - containerRect.left + container.scrollLeft;
|
|
352
|
+
const targetWidth = targetRect.width;
|
|
353
|
+
const containerWidth = containerRect.width;
|
|
354
|
+
const optimalScrollLeft = targetLeft - (containerWidth - targetWidth) / 2;
|
|
355
|
+
container.scrollTo({
|
|
356
|
+
left: Math.max(0, optimalScrollLeft),
|
|
357
|
+
behavior: 'smooth'
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}, []);
|
|
361
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
362
|
+
if (shouldSkipRestoreOnce()) return;
|
|
363
|
+
if (isMinimalChrome) {
|
|
364
|
+
const defaultParams = getDefaultParams();
|
|
365
|
+
form.setFieldsValue({
|
|
366
|
+
prompt: '',
|
|
367
|
+
params: defaultParams
|
|
368
|
+
});
|
|
369
|
+
setPromptValue('');
|
|
370
|
+
lastHistoryRef.current = null;
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
const lastHistory = historyForSelectedType[0];
|
|
374
|
+
if (lastHistory && lastHistoryRef.current && lastHistory.timestamp === lastHistoryRef.current.timestamp) return;
|
|
375
|
+
if (lastHistory) {
|
|
376
|
+
form.setFieldsValue({
|
|
377
|
+
type: lastHistory.type,
|
|
378
|
+
prompt: lastHistory.prompt || '',
|
|
379
|
+
params: lastHistory.params
|
|
380
|
+
});
|
|
381
|
+
setPromptValue(lastHistory.prompt || '');
|
|
382
|
+
lastHistoryRef.current = lastHistory;
|
|
383
|
+
} else {
|
|
384
|
+
const defaultParams = getDefaultParams();
|
|
385
|
+
form.setFieldsValue({
|
|
386
|
+
prompt: '',
|
|
387
|
+
params: defaultParams
|
|
388
|
+
});
|
|
389
|
+
setPromptValue('');
|
|
390
|
+
lastHistoryRef.current = null;
|
|
391
|
+
}
|
|
392
|
+
}, [
|
|
393
|
+
selectedType,
|
|
394
|
+
historyForSelectedType,
|
|
395
|
+
form,
|
|
396
|
+
getDefaultParams,
|
|
397
|
+
isMinimalChrome,
|
|
398
|
+
shouldSkipRestoreOnce
|
|
399
|
+
]);
|
|
400
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
401
|
+
const timeoutId = setTimeout(()=>{
|
|
402
|
+
scrollToSelectedItem();
|
|
403
|
+
}, 100);
|
|
404
|
+
return ()=>clearTimeout(timeoutId);
|
|
405
|
+
}, [
|
|
406
|
+
selectedType,
|
|
407
|
+
scrollToSelectedItem
|
|
408
|
+
]);
|
|
409
|
+
const formPromptValue = external_antd_namespaceObject.Form.useWatch('prompt', form);
|
|
410
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
411
|
+
if (formPromptValue !== promptValue) setPromptValue(formPromptValue || '');
|
|
412
|
+
}, [
|
|
413
|
+
formPromptValue,
|
|
414
|
+
promptValue
|
|
415
|
+
]);
|
|
416
|
+
const handleSelectHistory = (0, external_react_namespaceObject.useCallback)((historyItem)=>{
|
|
417
|
+
markExplicitSelection();
|
|
418
|
+
if (historyItem.type !== selectedType) skipNextRestore();
|
|
419
|
+
form.setFieldsValue({
|
|
420
|
+
prompt: historyItem.prompt,
|
|
421
|
+
type: historyItem.type,
|
|
422
|
+
params: historyItem.params
|
|
423
|
+
});
|
|
424
|
+
setPromptValue(historyItem.prompt);
|
|
425
|
+
}, [
|
|
426
|
+
form,
|
|
427
|
+
markExplicitSelection,
|
|
428
|
+
selectedType,
|
|
429
|
+
skipNextRestore
|
|
430
|
+
]);
|
|
431
|
+
const handlePromptChange = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
432
|
+
const value = e.target.value;
|
|
433
|
+
setPromptValue(value);
|
|
434
|
+
}, []);
|
|
435
|
+
const hasSingleStructuredParam = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
436
|
+
if (!needsStructuredParams || !actionSpace) return false;
|
|
437
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
438
|
+
if ((null == action ? void 0 : action.paramSchema) && (0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) {
|
|
439
|
+
const schema = action.paramSchema;
|
|
440
|
+
const shape = schema.shape || {};
|
|
441
|
+
return 1 === Object.keys(shape).length;
|
|
442
|
+
}
|
|
443
|
+
return false;
|
|
444
|
+
}, [
|
|
445
|
+
selectedType,
|
|
446
|
+
needsStructuredParams,
|
|
447
|
+
actionSpace
|
|
448
|
+
]);
|
|
449
|
+
const minimalInlineFieldConfig = (0, external_react_namespaceObject.useMemo)(()=>isMinimalChrome ? (0, prompt_input_utils_js_namespaceObject.getInlineStructuredFieldConfig)(actionSpace, selectedType) : null, [
|
|
450
|
+
actionSpace,
|
|
451
|
+
isMinimalChrome,
|
|
452
|
+
selectedType
|
|
453
|
+
]);
|
|
454
|
+
const isRunButtonEnabled = (0, external_react_namespaceObject.useMemo)(()=>(0, playground_utils_js_namespaceObject.isRunButtonEnabled)(runButtonEnabled, !!needsStructuredParams, params, actionSpace, selectedType, promptValue), [
|
|
455
|
+
runButtonEnabled,
|
|
456
|
+
needsStructuredParams,
|
|
457
|
+
selectedType,
|
|
458
|
+
actionSpace,
|
|
459
|
+
promptValue,
|
|
460
|
+
params
|
|
461
|
+
]);
|
|
462
|
+
const handleRunWithHistory = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
463
|
+
const values = form.getFieldsValue();
|
|
464
|
+
let historyPrompt = '';
|
|
465
|
+
if (needsStructuredParams && values.params && actionSpace) {
|
|
466
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
467
|
+
if ((null == action ? void 0 : action.paramSchema) && (0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) {
|
|
468
|
+
let locateValue = '';
|
|
469
|
+
const otherValues = [];
|
|
470
|
+
const schema = action.paramSchema;
|
|
471
|
+
const shape = schema.shape || {};
|
|
472
|
+
Object.keys(shape).forEach((key)=>{
|
|
473
|
+
var _values_params;
|
|
474
|
+
const paramValue = null == (_values_params = values.params) ? void 0 : _values_params[key];
|
|
475
|
+
if (null != paramValue && '' !== paramValue) {
|
|
476
|
+
const field = shape[key];
|
|
477
|
+
const { actualField } = (0, external_types_js_namespaceObject.unwrapZodType)(field);
|
|
478
|
+
if ((0, external_types_js_namespaceObject.isLocateField)(actualField)) locateValue = String(paramValue);
|
|
479
|
+
else if ('distance' === key) otherValues.push(`${paramValue}`);
|
|
480
|
+
else otherValues.push(String(paramValue));
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
const mainPart = otherValues.join(' ');
|
|
484
|
+
historyPrompt = locateValue ? `${locateValue} - ${mainPart}` : mainPart;
|
|
485
|
+
} else historyPrompt = values.prompt || '';
|
|
486
|
+
} else historyPrompt = values.prompt || '';
|
|
487
|
+
const newHistoryItem = {
|
|
488
|
+
type: values.type,
|
|
489
|
+
prompt: historyPrompt,
|
|
490
|
+
params: values.params,
|
|
491
|
+
timestamp: Date.now()
|
|
492
|
+
};
|
|
493
|
+
addHistory(newHistoryItem);
|
|
494
|
+
onRun();
|
|
495
|
+
if (clearPromptAfterRun) {
|
|
496
|
+
lastHistoryRef.current = newHistoryItem;
|
|
497
|
+
setPromptValue('');
|
|
498
|
+
if (needsStructuredParams) {
|
|
499
|
+
const defaultParams = getDefaultParams();
|
|
500
|
+
form.setFieldValue('params', defaultParams);
|
|
501
|
+
} else form.setFieldValue('prompt', '');
|
|
502
|
+
}
|
|
503
|
+
}, [
|
|
504
|
+
form,
|
|
505
|
+
addHistory,
|
|
506
|
+
onRun,
|
|
507
|
+
needsStructuredParams,
|
|
508
|
+
selectedType,
|
|
509
|
+
clearPromptAfterRun,
|
|
510
|
+
actionSpace,
|
|
511
|
+
getDefaultParams
|
|
512
|
+
]);
|
|
513
|
+
const handleKeyDown = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
514
|
+
if ('Enter' === e.key && e.metaKey && isRunButtonEnabled) {
|
|
515
|
+
handleRunWithHistory();
|
|
516
|
+
e.preventDefault();
|
|
517
|
+
e.stopPropagation();
|
|
518
|
+
} else if ('Enter' === e.key) setTimeout(()=>{
|
|
519
|
+
if (textAreaRef.current) {
|
|
520
|
+
var _textAreaRef_current_resizableTextArea;
|
|
521
|
+
const textarea = null == (_textAreaRef_current_resizableTextArea = textAreaRef.current.resizableTextArea) ? void 0 : _textAreaRef_current_resizableTextArea.textArea;
|
|
522
|
+
if (textarea) {
|
|
523
|
+
const selectionStart = textarea.selectionStart;
|
|
524
|
+
const value = textarea.value;
|
|
525
|
+
const lastNewlineIndex = value.lastIndexOf('\n');
|
|
526
|
+
const isAtLastLine = -1 === lastNewlineIndex || selectionStart > lastNewlineIndex;
|
|
527
|
+
if (isAtLastLine) textarea.scrollTop = textarea.scrollHeight;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}, 0);
|
|
531
|
+
}, [
|
|
532
|
+
handleRunWithHistory,
|
|
533
|
+
isRunButtonEnabled
|
|
534
|
+
]);
|
|
535
|
+
const handleStructuredKeyDown = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
536
|
+
if ('Enter' === e.key && e.metaKey && isRunButtonEnabled) {
|
|
537
|
+
handleRunWithHistory();
|
|
538
|
+
e.preventDefault();
|
|
539
|
+
e.stopPropagation();
|
|
540
|
+
}
|
|
541
|
+
}, [
|
|
542
|
+
handleRunWithHistory,
|
|
543
|
+
isRunButtonEnabled
|
|
544
|
+
]);
|
|
545
|
+
const renderStructuredParams = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
546
|
+
if (!needsStructuredParams) return null;
|
|
547
|
+
if (actionSpace) {
|
|
548
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
549
|
+
if ((null == action ? void 0 : action.paramSchema) && (0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) {
|
|
550
|
+
const schema = action.paramSchema;
|
|
551
|
+
const shape = schema.shape || {};
|
|
552
|
+
const schemaKeys = Object.keys(shape);
|
|
553
|
+
if (1 === schemaKeys.length) {
|
|
554
|
+
const key = schemaKeys[0];
|
|
555
|
+
const field = shape[key];
|
|
556
|
+
const { actualField } = (0, external_types_js_namespaceObject.unwrapZodType)(field);
|
|
557
|
+
const isLocateFieldFlag = (0, external_types_js_namespaceObject.isLocateField)(actualField);
|
|
558
|
+
const placeholderText = (()=>{
|
|
559
|
+
var _fieldWithRuntime__def;
|
|
560
|
+
const fieldWithRuntime = actualField;
|
|
561
|
+
if (null == (_fieldWithRuntime__def = fieldWithRuntime._def) ? void 0 : _fieldWithRuntime__def.description) return fieldWithRuntime._def.description;
|
|
562
|
+
if (fieldWithRuntime.description) return fieldWithRuntime.description;
|
|
563
|
+
if (actionSpace) {
|
|
564
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
565
|
+
if ((null == action ? void 0 : action.paramSchema) && 'object' == typeof action.paramSchema && 'shape' in action.paramSchema) {
|
|
566
|
+
var _fieldDef__def;
|
|
567
|
+
const shape = action.paramSchema.shape || {};
|
|
568
|
+
const fieldDef = shape[key];
|
|
569
|
+
if (null == fieldDef ? void 0 : null == (_fieldDef__def = fieldDef._def) ? void 0 : _fieldDef__def.description) return fieldDef._def.description;
|
|
570
|
+
if (null == fieldDef ? void 0 : fieldDef.description) return fieldDef.description;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
if (isLocateFieldFlag) return 'Describe the element you want to interact with';
|
|
574
|
+
if ('keyName' === key) return 'Enter key name or text to type';
|
|
575
|
+
if ('value' === key) return 'Enter text to input';
|
|
576
|
+
return `Enter ${key}`;
|
|
577
|
+
})();
|
|
578
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
579
|
+
name: [
|
|
580
|
+
'params',
|
|
581
|
+
key
|
|
582
|
+
],
|
|
583
|
+
style: {
|
|
584
|
+
margin: 0
|
|
585
|
+
},
|
|
586
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Input.TextArea, {
|
|
587
|
+
className: "main-side-console-input-textarea",
|
|
588
|
+
rows: 3,
|
|
589
|
+
placeholder: placeholderText,
|
|
590
|
+
autoFocus: true,
|
|
591
|
+
onKeyDown: handleStructuredKeyDown
|
|
592
|
+
})
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
const fields = [];
|
|
596
|
+
const sortedKeys = schemaKeys.sort((keyA, keyB)=>{
|
|
597
|
+
const fieldSchemaA = shape[keyA];
|
|
598
|
+
const fieldSchemaB = shape[keyB];
|
|
599
|
+
const { isOptional: isOptionalA } = (0, external_types_js_namespaceObject.unwrapZodType)(fieldSchemaA);
|
|
600
|
+
const { isOptional: isOptionalB } = (0, external_types_js_namespaceObject.unwrapZodType)(fieldSchemaB);
|
|
601
|
+
if (!isOptionalA && isOptionalB) return -1;
|
|
602
|
+
if (isOptionalA && !isOptionalB) return 1;
|
|
603
|
+
return 0;
|
|
604
|
+
});
|
|
605
|
+
sortedKeys.forEach((key, index)=>{
|
|
606
|
+
var _actualField__def, _actualField__def1, _actualField__def2;
|
|
607
|
+
const fieldSchema = shape[key];
|
|
608
|
+
const { actualField, isOptional } = (0, external_types_js_namespaceObject.unwrapZodType)(fieldSchema);
|
|
609
|
+
const isLocateFieldFlag = (0, external_types_js_namespaceObject.isLocateField)(actualField);
|
|
610
|
+
const label = key.charAt(0).toUpperCase() + key.slice(1);
|
|
611
|
+
const isRequired = !isOptional;
|
|
612
|
+
const marginBottom = index === sortedKeys.length - 1 ? 0 : 12;
|
|
613
|
+
const placeholder = (()=>{
|
|
614
|
+
var _fieldWithRuntime__def;
|
|
615
|
+
const fieldWithRuntime = actualField;
|
|
616
|
+
if (null == (_fieldWithRuntime__def = fieldWithRuntime._def) ? void 0 : _fieldWithRuntime__def.description) return fieldWithRuntime._def.description;
|
|
617
|
+
if (fieldWithRuntime.description) return fieldWithRuntime.description;
|
|
618
|
+
if (actionSpace) {
|
|
619
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
620
|
+
if ((null == action ? void 0 : action.paramSchema) && 'object' == typeof action.paramSchema && 'shape' in action.paramSchema) {
|
|
621
|
+
var _fieldDef__def;
|
|
622
|
+
const shape = action.paramSchema.shape || {};
|
|
623
|
+
const fieldDef = shape[key];
|
|
624
|
+
if (null == fieldDef ? void 0 : null == (_fieldDef__def = fieldDef._def) ? void 0 : _fieldDef__def.description) return fieldDef._def.description;
|
|
625
|
+
if (null == fieldDef ? void 0 : fieldDef.description) return fieldDef.description;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
if (isLocateFieldFlag) return 'Describe the element you want to interact with';
|
|
629
|
+
})();
|
|
630
|
+
const fieldProps = {
|
|
631
|
+
name: key,
|
|
632
|
+
label,
|
|
633
|
+
fieldSchema: actualField,
|
|
634
|
+
isRequired,
|
|
635
|
+
marginBottom,
|
|
636
|
+
placeholder
|
|
637
|
+
};
|
|
638
|
+
if (isLocateFieldFlag) fields.push(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_form_field_index_js_namespaceObject.LocateField, _object_spread({}, fieldProps), key));
|
|
639
|
+
else if ((null == (_actualField__def = actualField._def) ? void 0 : _actualField__def.typeName) === 'ZodEnum') fields.push(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_form_field_index_js_namespaceObject.EnumField, _object_spread({}, fieldProps), key));
|
|
640
|
+
else if ((null == (_actualField__def1 = actualField._def) ? void 0 : _actualField__def1.typeName) === 'ZodNumber') fields.push(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_form_field_index_js_namespaceObject.NumberField, _object_spread({}, fieldProps), key));
|
|
641
|
+
else if ((null == (_actualField__def2 = actualField._def) ? void 0 : _actualField__def2.typeName) === 'ZodBoolean') fields.push(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_form_field_index_js_namespaceObject.BooleanField, _object_spread({}, fieldProps), key));
|
|
642
|
+
else fields.push(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_form_field_index_js_namespaceObject.TextField, _object_spread({}, fieldProps), key));
|
|
643
|
+
});
|
|
644
|
+
if ('aiScroll' === selectedType) {
|
|
645
|
+
const directionField = fields.find((field)=>/*#__PURE__*/ external_react_default().isValidElement(field) && 'direction' === field.props.name);
|
|
646
|
+
const distanceField = fields.find((field)=>/*#__PURE__*/ external_react_default().isValidElement(field) && 'distance' === field.props.name);
|
|
647
|
+
const otherFields = fields.filter((field)=>/*#__PURE__*/ external_react_default().isValidElement(field) && 'direction' !== field.props.name && 'distance' !== field.props.name);
|
|
648
|
+
if (directionField && distanceField) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
649
|
+
className: "structured-params",
|
|
650
|
+
children: [
|
|
651
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
652
|
+
style: {
|
|
653
|
+
display: 'flex',
|
|
654
|
+
gap: 12,
|
|
655
|
+
marginBottom: 12
|
|
656
|
+
},
|
|
657
|
+
children: [
|
|
658
|
+
directionField,
|
|
659
|
+
distanceField
|
|
660
|
+
]
|
|
661
|
+
}),
|
|
662
|
+
otherFields
|
|
663
|
+
]
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
667
|
+
className: "structured-params",
|
|
668
|
+
children: fields
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
return null;
|
|
673
|
+
}, [
|
|
674
|
+
selectedType,
|
|
675
|
+
needsStructuredParams,
|
|
676
|
+
actionSpace,
|
|
677
|
+
handleStructuredKeyDown
|
|
678
|
+
]);
|
|
679
|
+
const handleMouseEnter = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
680
|
+
setHoveringSettings(true);
|
|
681
|
+
}, []);
|
|
682
|
+
const handleMouseLeave = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
683
|
+
setHoveringSettings(false);
|
|
684
|
+
}, []);
|
|
685
|
+
const renderActionButton = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
686
|
+
const runButton = (text)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
|
|
687
|
+
type: "primary",
|
|
688
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.SendOutlined, {}),
|
|
689
|
+
style: {
|
|
690
|
+
borderRadius: 20,
|
|
691
|
+
zIndex: 999
|
|
692
|
+
},
|
|
693
|
+
onClick: handleRunWithHistory,
|
|
694
|
+
disabled: !isRunButtonEnabled,
|
|
695
|
+
loading: loading,
|
|
696
|
+
children: text
|
|
697
|
+
});
|
|
698
|
+
if (dryMode) return 'aiAct' === selectedType ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Tooltip, {
|
|
699
|
+
title: "Start executing until some interaction actions need to be performed. You can see the process of planning and locating.",
|
|
700
|
+
children: runButton('Dry Run')
|
|
701
|
+
}) : runButton('Run');
|
|
702
|
+
if (stoppable) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
|
|
703
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.BorderOutlined, {}),
|
|
704
|
+
onClick: onStop,
|
|
705
|
+
style: {
|
|
706
|
+
borderRadius: 20,
|
|
707
|
+
zIndex: 999
|
|
708
|
+
},
|
|
709
|
+
children: "Stop"
|
|
710
|
+
});
|
|
711
|
+
return runButton('Run');
|
|
712
|
+
}, [
|
|
713
|
+
dryMode,
|
|
714
|
+
loading,
|
|
715
|
+
handleRunWithHistory,
|
|
716
|
+
onStop,
|
|
717
|
+
isRunButtonEnabled,
|
|
718
|
+
selectedType,
|
|
719
|
+
stoppable
|
|
720
|
+
]);
|
|
721
|
+
const renderMinimalActionButton = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
722
|
+
const runButton = (ariaLabel)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
|
|
723
|
+
"aria-label": ariaLabel,
|
|
724
|
+
className: "minimal-run-trigger",
|
|
725
|
+
type: "primary",
|
|
726
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.ArrowUpOutlined, {}),
|
|
727
|
+
onClick: handleRunWithHistory,
|
|
728
|
+
disabled: !isRunButtonEnabled,
|
|
729
|
+
loading: loading
|
|
730
|
+
});
|
|
731
|
+
if (dryMode) return 'aiAct' === selectedType ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Tooltip, {
|
|
732
|
+
title: "Start executing until some interaction actions need to be performed. You can see the process of planning and locating.",
|
|
733
|
+
children: runButton('Dry run')
|
|
734
|
+
}) : runButton('Run');
|
|
735
|
+
if (stoppable) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
|
|
736
|
+
"aria-label": "Stop running",
|
|
737
|
+
className: "minimal-run-trigger minimal-run-trigger-stop",
|
|
738
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.BorderOutlined, {}),
|
|
739
|
+
onClick: onStop
|
|
740
|
+
});
|
|
741
|
+
return runButton('Run');
|
|
742
|
+
}, [
|
|
743
|
+
dryMode,
|
|
744
|
+
loading,
|
|
745
|
+
handleRunWithHistory,
|
|
746
|
+
isRunButtonEnabled,
|
|
747
|
+
onStop,
|
|
748
|
+
selectedType,
|
|
749
|
+
stoppable
|
|
750
|
+
]);
|
|
751
|
+
const inputContent = needsAnyInput ? needsStructuredParams ? minimalInlineFieldConfig ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
752
|
+
name: [
|
|
753
|
+
'params',
|
|
754
|
+
minimalInlineFieldConfig.name
|
|
755
|
+
],
|
|
756
|
+
style: {
|
|
757
|
+
margin: 0
|
|
758
|
+
},
|
|
759
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TextArea, {
|
|
760
|
+
className: "main-side-console-input-textarea",
|
|
761
|
+
disabled: !runButtonEnabled,
|
|
762
|
+
rows: 3,
|
|
763
|
+
placeholder: 'prompt' === minimalInlineFieldConfig.name ? resolvedPlaceholder : minimalInlineFieldConfig.placeholder,
|
|
764
|
+
autoFocus: true,
|
|
765
|
+
onKeyDown: handleStructuredKeyDown
|
|
766
|
+
})
|
|
767
|
+
}) : hasSingleStructuredParam ? renderStructuredParams() : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
768
|
+
className: "structured-params-container",
|
|
769
|
+
children: renderStructuredParams()
|
|
770
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
771
|
+
name: "prompt",
|
|
772
|
+
style: {
|
|
773
|
+
margin: 0
|
|
774
|
+
},
|
|
775
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TextArea, {
|
|
776
|
+
className: "main-side-console-input-textarea",
|
|
777
|
+
disabled: !runButtonEnabled,
|
|
778
|
+
rows: 3,
|
|
779
|
+
placeholder: resolvedPlaceholder,
|
|
780
|
+
autoFocus: true,
|
|
781
|
+
onKeyDown: handleKeyDown,
|
|
782
|
+
onChange: handlePromptChange,
|
|
783
|
+
ref: textAreaRef
|
|
784
|
+
})
|
|
785
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
786
|
+
className: "no-input-method",
|
|
787
|
+
children: [
|
|
788
|
+
'Click "Run" to execute ',
|
|
789
|
+
(0, playground_utils_js_namespaceObject.actionNameForType)(selectedType)
|
|
790
|
+
]
|
|
791
|
+
});
|
|
792
|
+
const minimalActionIconSrc = null != (_ref = null == chrome ? void 0 : null == (_chrome_icons = chrome.icons) ? void 0 : _chrome_icons.action) ? _ref : STUDIO_MINIMAL_PROMPT_ICONS.action;
|
|
793
|
+
const minimalActionChevronSrc = null == chrome ? void 0 : null == (_chrome_icons1 = chrome.icons) ? void 0 : _chrome_icons1.actionChevron;
|
|
794
|
+
const minimalSettingsIconSrc = null != (_ref1 = null == chrome ? void 0 : null == (_chrome_icons2 = chrome.icons) ? void 0 : _chrome_icons2.settings) ? _ref1 : STUDIO_MINIMAL_PROMPT_ICONS.settings;
|
|
795
|
+
const minimalHistoryIconSrc = null == chrome ? void 0 : null == (_chrome_icons3 = chrome.icons) ? void 0 : _chrome_icons3.history;
|
|
796
|
+
if (isMinimalChrome) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
797
|
+
className: "prompt-input-wrapper prompt-input-wrapper-minimal",
|
|
798
|
+
children: [
|
|
799
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
800
|
+
hidden: true,
|
|
801
|
+
name: "type",
|
|
802
|
+
style: {
|
|
803
|
+
margin: 0
|
|
804
|
+
},
|
|
805
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Input, {})
|
|
806
|
+
}),
|
|
807
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
808
|
+
className: `main-side-console-input minimal-main-side-console-input ${!runButtonEnabled ? 'disabled' : ''} ${loading ? 'loading' : ''}`,
|
|
809
|
+
children: [
|
|
810
|
+
inputContent,
|
|
811
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
812
|
+
className: "minimal-toolbar-row",
|
|
813
|
+
children: [
|
|
814
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
815
|
+
className: "minimal-toolbar-left",
|
|
816
|
+
children: [
|
|
817
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Dropdown, {
|
|
818
|
+
menu: actionDropdownMenu,
|
|
819
|
+
placement: "topLeft",
|
|
820
|
+
trigger: [
|
|
821
|
+
'click'
|
|
822
|
+
],
|
|
823
|
+
disabled: !runButtonEnabled,
|
|
824
|
+
overlayClassName: "more-apis-dropdown",
|
|
825
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
|
|
826
|
+
"aria-label": `Select action type (current: ${actionButtonLabel})`,
|
|
827
|
+
className: "minimal-action-trigger",
|
|
828
|
+
disabled: !runButtonEnabled,
|
|
829
|
+
type: "button",
|
|
830
|
+
children: [
|
|
831
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
832
|
+
alt: "",
|
|
833
|
+
className: "minimal-action-icon",
|
|
834
|
+
src: minimalActionIconSrc
|
|
835
|
+
}),
|
|
836
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
837
|
+
className: "minimal-action-label",
|
|
838
|
+
children: actionButtonLabel
|
|
839
|
+
}),
|
|
840
|
+
minimalActionChevronSrc ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
841
|
+
alt: "",
|
|
842
|
+
className: "minimal-action-chevron",
|
|
843
|
+
src: minimalActionChevronSrc
|
|
844
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(action_chevron_js_default(), {
|
|
845
|
+
"aria-hidden": "true",
|
|
846
|
+
className: "minimal-action-chevron",
|
|
847
|
+
focusable: "false"
|
|
848
|
+
})
|
|
849
|
+
]
|
|
850
|
+
})
|
|
851
|
+
}),
|
|
852
|
+
hasConfigOptions ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
853
|
+
className: hoveringSettings ? 'settings-wrapper settings-wrapper-hover' : 'settings-wrapper',
|
|
854
|
+
onMouseEnter: handleMouseEnter,
|
|
855
|
+
onMouseLeave: handleMouseLeave,
|
|
856
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.ConfigSelector, {
|
|
857
|
+
enableTracking: 'In-Browser-Extension' === serviceMode,
|
|
858
|
+
showDeepLocateOption: showDeepLocateOption,
|
|
859
|
+
showDeepThinkOption: showDeepThinkOption,
|
|
860
|
+
showDataExtractionOptions: showDataExtractionOptions,
|
|
861
|
+
hideDomAndScreenshotOptions: hideDomAndScreenshotOptions,
|
|
862
|
+
deviceType: deviceType,
|
|
863
|
+
popupPlacement: "topRight",
|
|
864
|
+
trigger: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
865
|
+
"aria-label": "Open run configuration",
|
|
866
|
+
className: "minimal-icon-trigger",
|
|
867
|
+
type: "button",
|
|
868
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
869
|
+
alt: "",
|
|
870
|
+
className: "minimal-toolbar-icon",
|
|
871
|
+
src: minimalSettingsIconSrc
|
|
872
|
+
})
|
|
873
|
+
})
|
|
874
|
+
})
|
|
875
|
+
}) : null,
|
|
876
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_history_selector_index_js_namespaceObject.HistorySelector, {
|
|
877
|
+
onSelect: handleSelectHistory,
|
|
878
|
+
history: historyForSelectedType,
|
|
879
|
+
currentType: selectedType,
|
|
880
|
+
popupPlacement: "top",
|
|
881
|
+
trigger: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
882
|
+
"aria-label": "Open prompt history",
|
|
883
|
+
className: "minimal-icon-trigger",
|
|
884
|
+
type: "button",
|
|
885
|
+
children: minimalHistoryIconSrc ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
886
|
+
alt: "",
|
|
887
|
+
className: "minimal-toolbar-icon minimal-toolbar-icon-history",
|
|
888
|
+
src: minimalHistoryIconSrc
|
|
889
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(prompt_history_js_default(), {
|
|
890
|
+
"aria-hidden": "true",
|
|
891
|
+
className: "minimal-toolbar-icon minimal-toolbar-icon-history",
|
|
892
|
+
focusable: "false"
|
|
893
|
+
})
|
|
894
|
+
})
|
|
895
|
+
})
|
|
896
|
+
]
|
|
897
|
+
}),
|
|
898
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
899
|
+
className: "form-controller-wrapper",
|
|
900
|
+
children: renderMinimalActionButton()
|
|
901
|
+
})
|
|
902
|
+
]
|
|
903
|
+
})
|
|
904
|
+
]
|
|
905
|
+
})
|
|
906
|
+
]
|
|
907
|
+
});
|
|
908
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
909
|
+
className: "prompt-input-wrapper",
|
|
910
|
+
children: [
|
|
911
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
912
|
+
className: "mode-radio-group-wrapper",
|
|
913
|
+
children: [
|
|
914
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
915
|
+
className: "mode-radio-group",
|
|
916
|
+
ref: modeRadioGroupRef,
|
|
917
|
+
children: [
|
|
918
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
919
|
+
name: "type",
|
|
920
|
+
style: {
|
|
921
|
+
margin: 0
|
|
922
|
+
},
|
|
923
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio.Group, {
|
|
924
|
+
buttonStyle: "solid",
|
|
925
|
+
disabled: !runButtonEnabled,
|
|
926
|
+
children: constants_js_namespaceObject.defaultMainButtons.map((apiType)=>{
|
|
927
|
+
var _apiMetadata_apiType;
|
|
928
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Tooltip, {
|
|
929
|
+
title: (null == (_apiMetadata_apiType = constants_js_namespaceObject.apiMetadata[apiType]) ? void 0 : _apiMetadata_apiType.title) || '',
|
|
930
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio.Button, {
|
|
931
|
+
value: apiType,
|
|
932
|
+
children: (0, playground_utils_js_namespaceObject.actionNameForType)(apiType)
|
|
933
|
+
})
|
|
934
|
+
}, apiType);
|
|
935
|
+
})
|
|
936
|
+
})
|
|
937
|
+
}),
|
|
938
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Dropdown, {
|
|
939
|
+
menu: moreApisDropdownMenu,
|
|
940
|
+
placement: "bottomLeft",
|
|
941
|
+
trigger: [
|
|
942
|
+
'click'
|
|
943
|
+
],
|
|
944
|
+
disabled: !runButtonEnabled,
|
|
945
|
+
overlayClassName: "more-apis-dropdown",
|
|
946
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Button, {
|
|
947
|
+
className: `more-apis-button ${!constants_js_namespaceObject.defaultMainButtons.includes(selectedType) ? 'selected-from-dropdown' : ''}`,
|
|
948
|
+
children: [
|
|
949
|
+
selectedType && !constants_js_namespaceObject.defaultMainButtons.includes(selectedType) ? (0, playground_utils_js_namespaceObject.actionNameForType)(selectedType) : 'more',
|
|
950
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.DownOutlined, {
|
|
951
|
+
style: {
|
|
952
|
+
fontSize: '10px',
|
|
953
|
+
marginLeft: '2px'
|
|
954
|
+
}
|
|
955
|
+
})
|
|
956
|
+
]
|
|
957
|
+
})
|
|
958
|
+
})
|
|
959
|
+
]
|
|
960
|
+
}),
|
|
961
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
962
|
+
className: "action-icons",
|
|
963
|
+
children: [
|
|
964
|
+
hasConfigOptions && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
965
|
+
className: hoveringSettings ? 'settings-wrapper settings-wrapper-hover' : 'settings-wrapper',
|
|
966
|
+
onMouseEnter: handleMouseEnter,
|
|
967
|
+
onMouseLeave: handleMouseLeave,
|
|
968
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.ConfigSelector, {
|
|
969
|
+
enableTracking: 'In-Browser-Extension' === serviceMode,
|
|
970
|
+
showDeepLocateOption: showDeepLocateOption,
|
|
971
|
+
showDeepThinkOption: showDeepThinkOption,
|
|
972
|
+
showDataExtractionOptions: showDataExtractionOptions,
|
|
973
|
+
hideDomAndScreenshotOptions: hideDomAndScreenshotOptions,
|
|
974
|
+
deviceType: deviceType
|
|
975
|
+
})
|
|
976
|
+
}),
|
|
977
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_history_selector_index_js_namespaceObject.HistorySelector, {
|
|
978
|
+
onSelect: handleSelectHistory,
|
|
979
|
+
history: historyForSelectedType,
|
|
980
|
+
currentType: selectedType
|
|
981
|
+
})
|
|
982
|
+
]
|
|
983
|
+
})
|
|
984
|
+
]
|
|
985
|
+
}),
|
|
986
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
987
|
+
className: `main-side-console-input ${!runButtonEnabled ? 'disabled' : ''} ${loading ? 'loading' : ''}`,
|
|
988
|
+
children: [
|
|
989
|
+
inputContent,
|
|
990
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
991
|
+
className: "form-controller-wrapper",
|
|
992
|
+
children: renderActionButton()
|
|
993
|
+
})
|
|
994
|
+
]
|
|
995
|
+
})
|
|
996
|
+
]
|
|
997
|
+
});
|
|
998
|
+
};
|
|
999
|
+
exports.PromptInput = __webpack_exports__.PromptInput;
|
|
1000
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
1001
|
+
"PromptInput"
|
|
1002
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
1003
|
+
Object.defineProperty(exports, '__esModule', {
|
|
1004
|
+
value: true
|
|
1005
|
+
});
|