vscode-behavior3 2.5.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/extension.js CHANGED
@@ -215705,6 +215705,7 @@ var normalizeWorkspaceModel = (value) => {
215705
215705
  }
215706
215706
  return {
215707
215707
  settings: {
215708
+ allowNewFunction: typeof settingsRecord.allowNewFunction === "boolean" ? settingsRecord.allowNewFunction : void 0,
215708
215709
  checkExpr: typeof settingsRecord.checkExpr === "boolean" ? settingsRecord.checkExpr : void 0,
215709
215710
  buildScript: asOptionalString(settingsRecord.buildScript),
215710
215711
  checkScripts: settingsRecord.checkScripts === void 0 ? void 0 : Array.isArray(settingsRecord.checkScripts) ? settingsRecord.checkScripts.map(
@@ -216248,82 +216249,549 @@ var checkOneof = (arg, argValue, inputValue) => {
216248
216249
  return normalizedArgValue !== "" && normalizedInputValue === "" || normalizedArgValue === "" && normalizedInputValue !== "";
216249
216250
  };
216250
216251
 
216251
- // webview/shared/tree-materializer.ts
216252
- var applyPatchIfAny = (node, patch) => {
216253
- if (!patch) {
216254
- return;
216255
- }
216256
- if (patch.desc !== void 0) {
216257
- node.desc = patch.desc;
216258
- }
216259
- if (patch.input !== void 0) {
216260
- node.input = patch.input;
216261
- }
216262
- if (patch.output !== void 0) {
216263
- node.output = patch.output;
216264
- }
216265
- if (patch.args !== void 0) {
216266
- node.args = { ...node.args ?? {}, ...patch.args };
216267
- }
216268
- if (patch.debug !== void 0) {
216269
- node.debug = patch.debug;
216270
- }
216271
- if (patch.disabled !== void 0) {
216272
- node.disabled = patch.disabled;
216273
- }
216274
- };
216275
- var applyArgDefaults = (node, def) => {
216276
- if (!def?.args?.length) {
216277
- return;
216278
- }
216279
- node.args ||= {};
216280
- for (const arg of def.args) {
216281
- if (node.args[arg.name] === void 0 && arg.default !== void 0) {
216282
- node.args[arg.name] = arg.default;
216283
- }
216284
- }
216285
- };
216286
- var buildResolvedExternalNode = (sourceNode, overrideChain, rootOverride) => {
216287
- const value = clonePersistedNode(sourceNode);
216288
- for (const tree of [...overrideChain].reverse()) {
216289
- applyPatchIfAny(value, tree.overrides[sourceNode.uuid]);
216290
- }
216291
- const subtreeOriginal = clonePersistedNode(value);
216292
- applyPatchIfAny(value, rootOverride[sourceNode.uuid]);
216293
- return { value, subtreeOriginal };
216294
- };
216295
- var isInvalidSubtreeSource = (value) => {
216296
- return Boolean(value && typeof value === "object" && "error" in value);
216252
+ // media/locales/en.json
216253
+ var en_default = {
216254
+ about: "About Behavior3",
216255
+ actuaSize: "Actual Size",
216256
+ actualSize: "Actual Size",
216257
+ add: "Add",
216258
+ alertNewVersion: "This file is created by a newer version of Behavior3({{version}}), please upgrade to the latest version.",
216259
+ batch: "Batch Script",
216260
+ batchCompleted: "Batch completed",
216261
+ batchFailed: "Batch failed, more information can be found in the console.",
216262
+ build: "Build",
216263
+ buildCompleted: "Build completed",
216264
+ buildFailed: "Build failed, more information can be found in the console.",
216265
+ cancel: "Cancel",
216266
+ compact: "Compact",
216267
+ console: "Console",
216268
+ copy: "Copy",
216269
+ createProject: "Create Project",
216270
+ checkExpr: "Check expression",
216271
+ cut: "Cut",
216272
+ delete: "Delete",
216273
+ deleteNode: "Delete Node",
216274
+ devTools: "Toggle Developer Tools",
216275
+ donotSave: "Don't Save",
216276
+ duplicate: "Duplicate",
216277
+ editSubtree: "Edit Subtree",
216278
+ fieldRequired: "Field '{{field}}' is required",
216279
+ forceReload: "Force Reload",
216280
+ fullscreen: "Toggle Full Screen",
216281
+ hide: "Hide Behavior3",
216282
+ hideOthers: "Hide Others",
216283
+ insertNode: "Insert Node",
216284
+ jumpNode: "Jump Node",
216285
+ language: "Language",
216286
+ moveToTrash: "Move to Trash",
216287
+ newFile: "New File...",
216288
+ newFolder: "New Folder...",
216289
+ newWindow: "New Window",
216290
+ nodeDefinition: "NODES",
216291
+ normal: "Normal",
216292
+ open: "Open...",
216293
+ openProject: "Open Project",
216294
+ paste: "Paste",
216295
+ quit: "Quit Behavior3",
216296
+ recent: "Recent",
216297
+ redo: "Redo",
216298
+ reload: "Reload",
216299
+ reset: "Reset",
216300
+ "reset.confirm": "Reset to original value?",
216301
+ "reset.defaultConfirm": "Reset to default value?",
216302
+ rename: "Rename...",
216303
+ replace: "Replace",
216304
+ reportIssue: "Report Issue",
216305
+ revealFileOnMac: "Reveal in Finder",
216306
+ revealFileOnWindows: "Reveal in File Explorer",
216307
+ save: "Save",
216308
+ saveAll: "Save All",
216309
+ saveAs: "Save As...",
216310
+ saveAsSubtree: "Save As Subtree",
216311
+ searchFile: "Search File",
216312
+ searchNode: "Search Node",
216313
+ selectAll: "Select All",
216314
+ services: "Services",
216315
+ setupBuildScript: "Setup Build Script",
216316
+ start: "Start",
216317
+ undo: "Undo",
216318
+ unhide: "Show All",
216319
+ zoomIn: "Zoom In",
216320
+ zoomOut: "Zoom Out",
216321
+ "menu.edit": "Edit",
216322
+ "menu.file": "File",
216323
+ "menu.view": "View",
216324
+ "menu.window": "Window",
216325
+ "menu.help": "Help",
216326
+ "workspace.saveAllOnClose": "Do you want to save the changes to the following {{count}} files?",
216327
+ "workspace.saveOnClose": "Do you want to save the changes you made to '{{name}}'?",
216328
+ "workspace.reloadFile": "'{{name}}' has changed, do you want to reload now?",
216329
+ "explorer.deleteFile": "Are you sure you want delete '{{name}}'?",
216330
+ "explorer.deleteFolder": "Are you sure you want delete '{{name}}' and its contents?",
216331
+ "explorer.replaceFile": "Are you sure you want replace '{{name}}'?",
216332
+ "explorer.restoreFileInfo": "You can restore this file from the Trash.",
216333
+ "explorer.title": "Explorer",
216334
+ "tree.overview": "Overview",
216335
+ "tree.name": "Tree name",
216336
+ "tree.desc": "Tree desc",
216337
+ "tree.export": "Export",
216338
+ "tree.prefix": "ID prefix",
216339
+ "tree.group": "Enable Node Grouping",
216340
+ "tree.group.placeholder": "Select node groups",
216341
+ "tree.vars": "Define Variables",
216342
+ "tree.vars.local": "Local Variables",
216343
+ "tree.vars.add": "Add Variable",
216344
+ "tree.vars.name": "name",
216345
+ "tree.vars.invalidName": "Invalid variable name",
216346
+ "tree.vars.desc": "description",
216347
+ "tree.vars.imports": "Import Variables",
216348
+ "tree.vars.subtree": "Subtree Variables",
216349
+ "tree.import.add": "Add Import",
216350
+ "tree.custom": "Custom Data",
216351
+ "tree.custom.add": "Add Entry",
216352
+ "tree.custom.key": "key",
216353
+ "tree.custom.value": "value",
216354
+ "tree.custom.type.string": "String value",
216355
+ "tree.custom.type.number": "Number value",
216356
+ "tree.custom.type.boolean": "Boolean value",
216357
+ "tree.custom.type.invalid": "Invalid custom value",
216358
+ "regnode.input": "Input: ",
216359
+ "regnode.output": "Output: ",
216360
+ "regnode.args": "Args: ",
216361
+ "regnode.mark": "Mark: ",
216362
+ "regnode.subtree": "Subtree: ",
216363
+ "node.args": "Const arguments",
216364
+ "node.children.unlimited": "Unlimited",
216365
+ "node.children": "Num children",
216366
+ "node.debug": "Debug",
216367
+ "node.deleteRootNodeDenied": "Unable to delete the root node",
216368
+ "node.dropDenied": "This node position is denied to drop the node",
216369
+ "node.desc": "Node desc",
216370
+ "node.disabled": "Disabled",
216371
+ "node.editSubtreeDenied": "Unable to edit the subtree node",
216372
+ "node.editFailed": "Node '{{name}}' edit failed",
216373
+ "node.group": "Node group",
216374
+ "node.groupNotEnabled": "One of '{{group}}' node group is not enabled in current file",
216375
+ "node.id": "Node id",
216376
+ "node.inputVariable": "Input variables",
216377
+ "node.invalidChildren": "Invalid number of children",
216378
+ "node.invalidExpression": "Invalid expression",
216379
+ "node.invalidValue": "Invalid value",
216380
+ "node.invalidVariableName": "Invalid variable name, should start with a letter or underscore",
216381
+ "node.name": "Node name",
216382
+ "node.noNodeSelected": "No node selected",
216383
+ "node.notFound": "Node '{{name}}' not found",
216384
+ "node.oneof.error": "Only one is allowed between input '{{input}}' and argument '{{desc}}({{arg}})'",
216385
+ "node.oneof.inputNotfound": "Input '{{input}}' not found",
216386
+ "node.outputVariable": "Output variables",
216387
+ "node.pasteDataError": "Paste data error",
216388
+ "node.rootNodeAsSubtree": "Root node cann't be save as subtree",
216389
+ "node.subtree": "Subtree",
216390
+ "node.subtreeMissing": "Subtree file is missing: {{path}}",
216391
+ "node.subtreeInvalid": "Subtree file is invalid: {{path}}",
216392
+ "node.subtreeCyclic": "Subtree reference is cyclic: {{path}}",
216393
+ "node.subtreeOpenFailed": "Failed to open subtree: file not found or unreadable ({{path}})",
216394
+ "node.subtreePathError": "You should save the subtree inside the current workspace",
216395
+ "node.subtreeSaveRootError": "Root node cann't be save as subtree",
216396
+ "node.subtreeSaveSuccess": "Saved and converted to subtree node: {{path}}",
216397
+ "node.moveSubtreeDenied": "Cannot move nodes inside a subtree",
216398
+ "node.dropSubtreeInternalDenied": "Cannot drop onto a subtree internal node",
216399
+ "node.moveRootDenied": "Cannot move the root node",
216400
+ "node.dropAroundRootDenied": "Cannot place a node before or after the root",
216401
+ "node.addChildToSubtreeRefDenied": "Cannot add child nodes to a subtree reference",
216402
+ "node.moveIntoDescendantDenied": "Cannot move a node into its own descendant",
216403
+ "node.type": "Node type",
216404
+ "node.undefinedVariable": "Variable '{{variable}}' is not defined",
216405
+ "node.jsonData": "JSON Data",
216406
+ "node.unknown.title": "Unknown Node",
216407
+ "node.unknownType": "Unknown",
216408
+ "node.resolutionError": "Resolution Error",
216409
+ "node.unknown.desc": "New node",
216410
+ "build.success": "Build completed.",
216411
+ "build.failed": "Build failed.",
216412
+ "editor.loading": "Loading editor...",
216413
+ "editor.externalChangeConflict": "External file change detected while the document has unsaved edits.",
216414
+ "editor.reloadFromDisk": "Reload",
216415
+ "editor.dismissConflict": "Dismiss",
216416
+ "editor.newerVersionEditDenied": "This file is created by a newer version of Behavior3({{version}}). Please upgrade to the latest version.",
216417
+ "inspector.noActiveDocument": "Open a Behavior3 editor to inspect and edit the active tree.",
216418
+ "inspector.embeddedModeNotice": "Inspector is configured to appear inside the Behavior3 editor.",
216419
+ "inspector.embeddedToolbar.build": "Build Behavior Tree",
216420
+ "inspector.embeddedToolbar.toggleEditorMode": "Toggle Editor Mode",
216421
+ "inspector.embeddedToolbar.toggleInspectorNodeJson": "Toggle Raw Node JSON",
216422
+ "inspector.embeddedToolbar.createProject": "Create Project",
216423
+ "inspector.embeddedToolbar.createTree": "Create Behavior Tree",
216424
+ "mutation.invalidJsonPath": "Invalid JSON path: {{path}}",
216425
+ "mutation.missingSelectedNode": "No selected node is available for this mutation.",
216426
+ "mutation.selectedNodeMismatch": "The selected node changed before the mutation was applied.",
216427
+ "mutation.missingTargetNode": "The target node could not be found.",
216428
+ "mutation.missingSourceNode": "The source node could not be found.",
216429
+ "mutation.missingSubtreeOriginal": "Missing subtree original snapshot for this mutation.",
216430
+ "mutation.missingDetachedSubtreeRoot": "Missing detached subtree snapshot for this mutation.",
216431
+ "mutation.moveRootDenied": "Cannot move the root node.",
216432
+ "mutation.dropAroundRootDenied": "Cannot drop before or after the root node.",
216433
+ "mutation.addChildToSubtreeRefDenied": "Cannot add a child directly to a subtree reference.",
216434
+ "mutation.moveIntoDescendantDenied": "Cannot move a node into its own descendant.",
216435
+ "mutation.deleteRootNodeDenied": "Cannot delete the root node.",
216436
+ "mutation.editSubtreeDenied": "Cannot edit structure on a subtree reference.",
216437
+ "mutation.saveSelectedAsSubtreeRootDenied": "The root node cannot be saved as a subtree.",
216438
+ "mutation.saveSelectedAsSubtreeMissingTarget": "The target node could not be saved as a subtree.",
216439
+ "mutation.saveSelectedAsSubtreePostSaveMissingTarget": "The target node could not be found after saving the subtree.",
216440
+ "runtime.nodeCheckRuntimeHasErrors": "Checker runtime has errors.",
216441
+ "runtime.invalidSavedSubtreePath": "Host returned an invalid saved subtree path.",
216442
+ "runtime.unsupportedDocumentMutation": "Unsupported document mutation.",
216443
+ "runtime.visibleHookNotRegistered": "Visible '{{name}}' is not registered.",
216444
+ "runtime.visibleHookFailed": "Visible '{{name}}' failed: {{error}}",
216445
+ "runtime.visibleExpressionDisabled": "Visible expression is disabled; enable settings.allowNewFunction.",
216446
+ "runtime.visibleExpressionCompileFailed": "Visible expression failed to compile: {{error}}",
216447
+ "runtime.visibleExpressionFailed": "Visible expression failed: {{error}}",
216448
+ "runtime.visibleExpressionUnknownArg": "Visible expression referenced args.{{property}}, but '{{property}}' is not in the defined arg scope (defined args: {{definedArgs}}).",
216449
+ "runtime.visibleExpressionNoArgs": "Visible expression referenced args.{{property}}, but this node defines no args.",
216450
+ "runtime.visibleExpressionUnknownSlotIndex": "Visible expression referenced {{fieldKind}}[{{index}}], but {{definedScope}}.",
216451
+ "runtime.visibleExpressionInvalidSlotProperty": "Visible expression referenced {{fieldKind}}.{{property}}, but {{fieldKind}} only supports defined numeric slot indices.",
216452
+ "runtime.visibleSlotScopeNone": "this node defines no {{fieldKind}} slots",
216453
+ "runtime.visibleSlotScopeIndex": "the defined {{fieldKind}} index is {{start}}",
216454
+ "runtime.visibleSlotScopeRange": "the defined {{fieldKind}} indices are {{start}}..{{end}}",
216455
+ "runtime.visibleSlotScopeRangeVariadic": "the defined {{fieldKind}} indices are {{start}}..{{end}}+",
216456
+ "override.resetTitle": "Reset this override?",
216457
+ "form.enterJsonArray": "Enter JSON array",
216458
+ "form.enterJsonValue": "Enter JSON value",
216459
+ "form.unset": "Unset",
216460
+ "form.true": "True",
216461
+ "form.false": "False",
216462
+ "validation.jsonArray": "{{name}} must be a JSON array",
216463
+ "validation.integer": "{{field}} must be an integer",
216464
+ "validation.number": "{{field}} must be a number",
216465
+ "validation.missingOneofInput": "Missing input slot for oneof '{{input}}'",
216466
+ "validation.oneof": "Only one of '{{left}}' and '{{right}}' can be set",
216467
+ "validation.invalidJsonPath": "Path must be a workdir-relative .json file: {{path}}",
216468
+ "validation.variableDescriptionRequired": "Variable description is required",
216469
+ "validation.customKeyRequired": "Custom key is required",
216470
+ "validation.customKeyDuplicate": "Custom key '{{key}}' is duplicated",
216471
+ "validation.customValueInvalid": "Custom value must be a string, number, or boolean"
216297
216472
  };
216298
- var toStatusFlag = (nodeName, defsByName) => {
216299
- let status = 0;
216300
- const def = defsByName.get(nodeName);
216301
- def?.status?.forEach((entry) => {
216302
- switch (entry) {
216303
- case "success":
216304
- status |= 1 << 2 /* SUCCESS */;
216305
- break;
216306
- case "failure":
216307
- status |= 1 << 1 /* FAILURE */;
216308
- break;
216309
- case "running":
216310
- status |= 1 << 0 /* RUNNING */;
216311
- break;
216312
- }
216473
+
216474
+ // media/locales/zh.json
216475
+ var zh_default = {
216476
+ about: "\u5173\u4E8E Behavior3",
216477
+ actualSize: "\u5B9E\u9645\u5927\u5C0F",
216478
+ add: "\u6DFB\u52A0",
216479
+ alertNewVersion: "\u6B64\u6587\u4EF6\u7531\u65B0\u7248\u672C Behavior3({{version}}) \u521B\u5EFA\uFF0C\u8BF7\u5347\u7EA7\u5230\u6700\u65B0\u7248\u672C\u3002",
216480
+ batch: "\u6279\u5904\u7406\u811A\u672C",
216481
+ batchCompleted: "\u6279\u5904\u7406\u5B8C\u6210",
216482
+ batchFailed: "\u6279\u5904\u7406\u51FA\u73B0\u9519\u8BEF\uFF0C\u8BE6\u60C5\u8BF7\u67E5\u770B\u63A7\u5236\u53F0\uFF01",
216483
+ build: "\u6784\u5EFA",
216484
+ buildCompleted: "\u6784\u5EFA\u5B8C\u6210",
216485
+ buildFailed: "\u6784\u5EFA\u51FA\u73B0\u9519\u8BEF\uFF0C\u8BE6\u60C5\u8BF7\u67E5\u770B\u63A7\u5236\u53F0\uFF01",
216486
+ cancel: "\u53D6\u6D88",
216487
+ compact: "\u7D27\u51D1",
216488
+ console: "\u63A7\u5236\u53F0",
216489
+ checkExpr: "\u68C0\u67E5\u8868\u8FBE\u5F0F",
216490
+ copy: "\u590D\u5236",
216491
+ createProject: "\u65B0\u5EFA\u9879\u76EE",
216492
+ cut: "\u526A\u5207",
216493
+ delete: "\u5220\u9664",
216494
+ deleteNode: "\u5220\u9664\u8282\u70B9",
216495
+ devTools: "\u5207\u6362\u5F00\u53D1\u8005\u5DE5\u5177",
216496
+ donotSave: "\u4E0D\u4FDD\u5B58",
216497
+ duplicate: "\u751F\u6210\u526F\u672C",
216498
+ editSubtree: "\u7F16\u8F91\u5B50\u6811",
216499
+ fieldRequired: "\u5B57\u6BB5\u201C{{field}}\u201D\u5FC5\u586B",
216500
+ forceReload: "\u5F3A\u5236\u91CD\u65B0\u52A0\u8F7D",
216501
+ fullscreen: "\u5207\u6362\u5168\u5C4F",
216502
+ hide: "\u9690\u85CF Behavior3",
216503
+ hideOthers: "\u9690\u85CF\u5176\u5B83",
216504
+ insertNode: "\u63D2\u5165\u8282\u70B9",
216505
+ jumpNode: "\u8DF3\u8F6C\u8282\u70B9",
216506
+ language: "\u8BED\u8A00",
216507
+ moveToTrash: "\u79FB\u81F3\u56DE\u6536\u7AD9",
216508
+ newFile: "\u65B0\u5EFA\u884C\u4E3A\u6811...",
216509
+ newFolder: "\u65B0\u5EFA\u76EE\u5F55...",
216510
+ newWindow: "\u65B0\u5EFA\u7A97\u53E3",
216511
+ nodeDefinition: "\u8282\u70B9\u5B9A\u4E49",
216512
+ normal: "\u6B63\u5E38",
216513
+ open: "\u6253\u5F00...",
216514
+ openProject: "\u6253\u5F00\u9879\u76EE",
216515
+ paste: "\u7C98\u8D34",
216516
+ quit: "\u9000\u51FA Behavior3",
216517
+ recent: "\u6700\u8FD1\u6253\u5F00",
216518
+ redo: "\u91CD\u505A",
216519
+ reload: "\u91CD\u65B0\u52A0\u8F7D",
216520
+ reset: "\u91CD\u7F6E",
216521
+ "reset.confirm": "\u91CD\u7F6E\u4E3A\u539F\u59CB\u503C\uFF1F",
216522
+ "reset.defaultConfirm": "\u91CD\u7F6E\u4E3A\u9ED8\u8BA4\u503C\uFF1F",
216523
+ rename: "\u91CD\u547D\u540D...",
216524
+ replace: "\u66FF\u6362",
216525
+ reportIssue: "\u95EE\u9898\u53CD\u9988",
216526
+ revealFileOnMac: "\u5728 Finder \u4E2D\u663E\u793A",
216527
+ revealFileOnWindows: "\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u6253\u5F00",
216528
+ save: "\u4FDD\u5B58",
216529
+ saveAll: "\u4FDD\u5B58\u5168\u90E8",
216530
+ saveAs: "\u53E6\u5B58\u4E3A...",
216531
+ saveAsSubtree: "\u53E6\u5B58\u4E3A\u5B50\u6811",
216532
+ searchFile: "\u641C\u7D22\u6587\u4EF6",
216533
+ searchNode: "\u641C\u7D22\u8282\u70B9",
216534
+ selectAll: "\u5168\u9009",
216535
+ services: "\u670D\u52A1",
216536
+ setupBuildScript: "\u8BBE\u7F6E\u6784\u5EFA\u811A\u672C",
216537
+ start: "\u5F00\u59CB",
216538
+ undo: "\u64A4\u9500",
216539
+ unhide: "\u663E\u793A\u6240\u6709",
216540
+ zoomIn: "\u653E\u5927",
216541
+ zoomOut: "\u7F29\u5C0F",
216542
+ "menu.file": "\u6587\u4EF6",
216543
+ "menu.edit": "\u7F16\u8F91",
216544
+ "menu.view": "\u89C6\u56FE",
216545
+ "menu.window": "\u7A97\u53E3",
216546
+ "menu.help": "\u5E2E\u52A9",
216547
+ "workspace.saveAllOnClose": "\u4F60\u9700\u8981\u4FDD\u5B58\u5BF9\u4EE5\u4E0B {{count}} \u4E2A\u6587\u4EF6\u7684\u4FEE\u6539\u5417\uFF1F",
216548
+ "workspace.saveOnClose": "\u4F60\u9700\u8981\u4FDD\u5B58\u5BF9\u6587\u4EF6 {{name}} \u7684\u4FEE\u6539\u5417\uFF1F",
216549
+ "workspace.reloadFile": "\u6587\u4EF6 {{name}} \u53D1\u751F\u6539\u53D8\uFF0C\u4F60\u9700\u8981\u91CD\u65B0\u52A0\u8F7D\u5417\uFF1F",
216550
+ "explorer.deleteFile": "\u4F60\u786E\u5B9A\u8981\u5220\u9664\u6587\u4EF6 '{{name}}'\uFF1F",
216551
+ "explorer.deleteFolder": "\u4F60\u786E\u5B9A\u8981\u5220\u9664\u76EE\u5F55 '{{name}}'\uFF1F",
216552
+ "explorer.replaceFile": "\u4F60\u786E\u5B9A\u8981\u66FF\u6362\u6587\u4EF6 '{{name}}'\uFF1F",
216553
+ "explorer.restoreFileInfo": "\u4F60\u53EF\u4EE5\u4ECE\u56DE\u6536\u7AD9\u6062\u590D\u6B64\u6587\u4EF6\u3002",
216554
+ "explorer.title": "\u8D44\u6E90\u6D4F\u89C8",
216555
+ "tree.overview": "\u6982\u51B5",
216556
+ "tree.name": "\u884C\u4E3A\u6811",
216557
+ "tree.desc": "\u8BF4\u660E",
216558
+ "tree.export": "\u5BFC\u51FA",
216559
+ "tree.prefix": "\u6807\u8BC6\u524D\u7F00",
216560
+ "tree.group": "\u542F\u7528\u8282\u70B9\u5206\u7EC4",
216561
+ "tree.group.placeholder": "\u9009\u62E9\u8282\u70B9\u5206\u7EC4",
216562
+ "tree.vars": "\u5B9A\u4E49\u53D8\u91CF",
216563
+ "tree.vars.local": "\u672C\u5730\u53D8\u91CF",
216564
+ "tree.vars.add": "\u6DFB\u52A0\u53D8\u91CF",
216565
+ "tree.vars.name": "\u53D8\u91CF\u540D",
216566
+ "tree.vars.invalidName": "\u53D8\u91CF\u540D\u4E0D\u5408\u6CD5",
216567
+ "tree.vars.desc": "\u53D8\u91CF\u8BF4\u660E",
216568
+ "tree.vars.imports": "\u5BFC\u5165\u53D8\u91CF",
216569
+ "tree.vars.subtree": "\u5B50\u6811\u53D8\u91CF",
216570
+ "tree.import.add": "\u6DFB\u52A0\u5BFC\u5165",
216571
+ "tree.custom": "\u81EA\u5B9A\u4E49\u6570\u636E",
216572
+ "tree.custom.add": "\u6DFB\u52A0\u6761\u76EE",
216573
+ "tree.custom.key": "\u952E",
216574
+ "tree.custom.value": "\u503C",
216575
+ "tree.custom.type.string": "\u5B57\u7B26\u4E32\u503C",
216576
+ "tree.custom.type.number": "\u6570\u5B57\u503C",
216577
+ "tree.custom.type.boolean": "\u5E03\u5C14\u503C",
216578
+ "tree.custom.type.invalid": "\u975E\u6CD5\u7684\u81EA\u5B9A\u4E49\u503C",
216579
+ "regnode.input": "\u8F93\u5165\uFF1A",
216580
+ "regnode.output": "\u8F93\u51FA\uFF1A",
216581
+ "regnode.args": "\u53C2\u6570\uFF1A",
216582
+ "regnode.mark": "\u5907\u6CE8\uFF1A",
216583
+ "regnode.subtree": "\u5B50\u6811\uFF1A",
216584
+ "node.args": "\u5E38\u91CF\u53C2\u6570",
216585
+ "node.children.unlimited": "\u65E0\u9650\u5236",
216586
+ "node.children": "\u5B50\u8282\u70B9\u6570\u91CF",
216587
+ "node.debug": "\u8C03\u8BD5",
216588
+ "node.deleteRootNodeDenied": "\u4E0D\u80FD\u5220\u9664\u6839\u8282\u70B9",
216589
+ "node.dropDenied": "\u6B64\u8282\u70B9\u4F4D\u7F6E\u4E0D\u5141\u8BB8\u653E\u7F6E\u62D6\u62FD\u7684\u8282\u70B9",
216590
+ "node.desc": "\u8282\u70B9\u8BF4\u660E",
216591
+ "node.disabled": "\u7981\u7528",
216592
+ "node.editSubtreeDenied": "\u4E0D\u80FD\u7F16\u8F91\u5B50\u6811\u8282\u70B9",
216593
+ "node.editFailed": "\u8282\u70B9 {{name}} \u7F16\u8F91\u5931\u8D25",
216594
+ "node.group": "\u8282\u70B9\u5206\u7EC4",
216595
+ "node.groupNotEnabled": "\u8282\u70B9\u5206\u7EC4 \u201C{{group}}\u201D \u4EFB\u610F\u4E00\u4E2A\u672A\u5728\u5F53\u524D\u6587\u4EF6\u4E2D\u542F\u7528",
216596
+ "node.id": "\u8282\u70B9\u6807\u8BC6",
216597
+ "node.inputVariable": "\u8F93\u5165\u53D8\u91CF",
216598
+ "node.invalidChildren": "\u5B50\u8282\u70B9\u6570\u91CF\u4E0D\u5408\u6CD5",
216599
+ "node.invalidExpression": "\u8868\u8FBE\u5F0F\u4E0D\u5408\u6CD5",
216600
+ "node.invalidValue": "\u65E0\u6548\u7684\u503C",
216601
+ "node.invalidVariableName": "\u53D8\u91CF\u540D\u5FC5\u987B\u4EE5\u5B57\u6BCD\u6216\u4E0B\u5212\u7EBF\u5F00\u5934",
216602
+ "node.name": "\u8282\u70B9\u540D\u79F0",
216603
+ "node.noNodeSelected": "\u672A\u9009\u62E9\u4EFB\u52A1\u8282\u70B9",
216604
+ "node.notFound": "\u8282\u70B9 \u201C{{name}}\u201D \u4E0D\u5B58\u5728",
216605
+ "node.oneof.error": "\u8F93\u5165\u9879 \u201C{{input}}\u201D \u548C\u53C2\u6570 \u201C{{desc}}({{arg}})\u201D \u4E4B\u4E2D\uFF0C\u53EA\u80FD\u9009\u62E9\u8BBE\u7F6E\u5176\u4E2D\u4E4B\u4E00",
216606
+ "node.oneof.inputNotfound": "\u8F93\u5165\u9879\u201C{{input}}\u201D\u4E0D\u5B58\u5728",
216607
+ "node.outputVariable": "\u8F93\u51FA\u53D8\u91CF",
216608
+ "node.pasteDataError": "\u7C98\u8D34\u6570\u636E\u51FA\u9519",
216609
+ "node.rootNodeAsSubtree": "\u6839\u8282\u70B9\u4E0D\u80FD\u4FDD\u5B58\u4E3A\u5B50\u6811",
216610
+ "node.subtree": "\u5B50\u6811",
216611
+ "node.subtreeMissing": "\u5B50\u6811\u6587\u4EF6\u7F3A\u5931\uFF1A{{path}}",
216612
+ "node.subtreeInvalid": "\u5B50\u6811\u6587\u4EF6\u65E0\u6548\uFF1A{{path}}",
216613
+ "node.subtreeCyclic": "\u5B50\u6811\u5F15\u7528\u51FA\u73B0\u5FAA\u73AF\uFF1A{{path}}",
216614
+ "node.subtreeOpenFailed": "\u6253\u5F00\u5B50\u6811\u5931\u8D25\uFF1A\u6587\u4EF6\u4E0D\u5B58\u5728\u6216\u4E0D\u53EF\u8BFB\uFF08{{path}}\uFF09",
216615
+ "node.subtreePathError": "\u5B50\u6811\u5FC5\u987B\u4FDD\u5B58\u5728\u5F53\u524D\u5DE5\u4F5C\u533A\u7684\u76EE\u5F55\u5185",
216616
+ "node.subtreeSaveRootError": "\u6839\u8282\u70B9\u4E0D\u80FD\u4FDD\u5B58\u4E3A\u5B50\u6811",
216617
+ "node.subtreeSaveSuccess": "\u5DF2\u4FDD\u5B58\u5E76\u8F6C\u6362\u4E3A\u5B50\u6811\u8282\u70B9\uFF1A{{path}}",
216618
+ "node.moveSubtreeDenied": "\u4E0D\u80FD\u79FB\u52A8\u5B50\u6811\u5185\u90E8\u8282\u70B9",
216619
+ "node.dropSubtreeInternalDenied": "\u4E0D\u80FD\u62D6\u653E\u5230\u5B50\u6811\u5185\u90E8\u8282\u70B9",
216620
+ "node.moveRootDenied": "\u4E0D\u80FD\u79FB\u52A8\u6839\u8282\u70B9",
216621
+ "node.dropAroundRootDenied": "\u4E0D\u80FD\u5C06\u8282\u70B9\u653E\u5230\u6839\u8282\u70B9\u4E4B\u524D\u6216\u4E4B\u540E",
216622
+ "node.addChildToSubtreeRefDenied": "\u4E0D\u80FD\u5411\u5B50\u6811\u5F15\u7528\u6DFB\u52A0\u5B50\u8282\u70B9",
216623
+ "node.moveIntoDescendantDenied": "\u4E0D\u80FD\u5C06\u8282\u70B9\u79FB\u52A8\u5230\u81EA\u5DF1\u7684\u540E\u4EE3\u8282\u70B9\u4E2D",
216624
+ "node.type": "\u8282\u70B9\u7C7B\u578B",
216625
+ "node.undefinedVariable": "\u53D8\u91CF \u201C{{variable}}\u201D \u672A\u5B9A\u4E49",
216626
+ "node.jsonData": "JSON \u6570\u636E",
216627
+ "node.unknown.title": "\u672A\u77E5\u8282\u70B9",
216628
+ "node.unknownType": "\u672A\u77E5",
216629
+ "node.resolutionError": "\u89E3\u6790\u9519\u8BEF",
216630
+ "node.unknown.desc": "\u65B0\u5EFA\u8282\u70B9",
216631
+ "build.success": "\u6784\u5EFA\u5B8C\u6210\u3002",
216632
+ "build.failed": "\u6784\u5EFA\u5931\u8D25\u3002",
216633
+ "editor.loading": "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668...",
216634
+ "editor.externalChangeConflict": "\u68C0\u6D4B\u5230\u5916\u90E8\u6587\u4EF6\u53D8\u66F4\uFF0C\u5F53\u524D\u6587\u6863\u8FD8\u6709\u672A\u4FDD\u5B58\u4FEE\u6539\u3002",
216635
+ "editor.reloadFromDisk": "\u91CD\u65B0\u8F7D\u5165",
216636
+ "editor.dismissConflict": "\u5FFD\u7565",
216637
+ "editor.newerVersionEditDenied": "\u6B64\u6587\u4EF6\u7531\u65B0\u7248\u672C Behavior3({{version}}) \u521B\u5EFA\uFF0C\u8BF7\u5347\u7EA7\u5230\u6700\u65B0\u7248\u672C\u540E\u518D\u7F16\u8F91\u3002",
216638
+ "inspector.noActiveDocument": "\u6253\u5F00\u4E00\u4E2A Behavior3 \u7F16\u8F91\u5668\u540E\uFF0C\u8FD9\u91CC\u4F1A\u663E\u793A\u5F53\u524D\u884C\u4E3A\u6811\u7684 Inspector\uFF0C\u5E76\u652F\u6301\u76F4\u63A5\u7F16\u8F91\u3002",
216639
+ "inspector.embeddedModeNotice": "Inspector \u5F53\u524D\u914D\u7F6E\u4E3A\u5728 Behavior3 \u7F16\u8F91\u5668\u5185\u90E8\u663E\u793A\u3002",
216640
+ "inspector.embeddedToolbar.build": "\u6784\u5EFA\u884C\u4E3A\u6811",
216641
+ "inspector.embeddedToolbar.toggleEditorMode": "\u5207\u6362\u7F16\u8F91\u5668\u6A21\u5F0F",
216642
+ "inspector.embeddedToolbar.toggleInspectorNodeJson": "\u5207\u6362\u539F\u59CB\u8282\u70B9 JSON",
216643
+ "inspector.embeddedToolbar.createProject": "\u65B0\u5EFA\u9879\u76EE",
216644
+ "inspector.embeddedToolbar.createTree": "\u65B0\u5EFA\u884C\u4E3A\u6811",
216645
+ "mutation.invalidJsonPath": "\u65E0\u6548\u7684 JSON \u8DEF\u5F84: {{path}}",
216646
+ "mutation.missingSelectedNode": "\u5F53\u524D\u6CA1\u6709\u53EF\u7528\u4E8E\u63D0\u4EA4\u6B64\u4FEE\u6539\u7684\u9009\u4E2D\u8282\u70B9\u3002",
216647
+ "mutation.selectedNodeMismatch": "\u5F53\u524D\u9009\u4E2D\u8282\u70B9\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u8BD5\u3002",
216648
+ "mutation.missingTargetNode": "\u672A\u627E\u5230\u76EE\u6807\u8282\u70B9\uFF0C\u8BF7\u91CD\u8BD5\u3002",
216649
+ "mutation.missingSourceNode": "\u672A\u627E\u5230\u6E90\u8282\u70B9\uFF0C\u8BF7\u91CD\u8BD5\u3002",
216650
+ "mutation.missingSubtreeOriginal": "\u7F3A\u5C11 subtree \u539F\u59CB\u8282\u70B9\u5FEB\u7167\uFF0C\u8BF7\u91CD\u8BD5\u3002",
216651
+ "mutation.missingDetachedSubtreeRoot": "\u7F3A\u5C11\u7528\u4E8E\u89E3\u7ED1 subtree \u5F15\u7528\u7684\u5FEB\u7167\uFF0C\u8BF7\u91CD\u8BD5\u3002",
216652
+ "mutation.moveRootDenied": "\u4E0D\u80FD\u79FB\u52A8\u6839\u8282\u70B9\u3002",
216653
+ "mutation.dropAroundRootDenied": "\u4E0D\u80FD\u56F4\u7ED5\u6839\u8282\u70B9\u63D2\u5165\u3002",
216654
+ "mutation.addChildToSubtreeRefDenied": "\u4E0D\u80FD\u76F4\u63A5\u5411 subtree \u5F15\u7528\u6DFB\u52A0\u5B50\u8282\u70B9\u3002",
216655
+ "mutation.moveIntoDescendantDenied": "\u4E0D\u80FD\u79FB\u52A8\u5230\u81EA\u5DF1\u7684\u540E\u4EE3\u4E0B\u3002",
216656
+ "mutation.deleteRootNodeDenied": "\u4E0D\u80FD\u5220\u9664\u6839\u8282\u70B9\u3002",
216657
+ "mutation.editSubtreeDenied": "\u4E0D\u80FD\u5728 subtree \u5F15\u7528\u4E0A\u76F4\u63A5\u4FEE\u6539\u7ED3\u6784\u3002",
216658
+ "mutation.saveSelectedAsSubtreeRootDenied": "\u6839\u8282\u70B9\u4E0D\u80FD\u53E6\u5B58\u4E3A subtree\u3002",
216659
+ "mutation.saveSelectedAsSubtreeMissingTarget": "\u672A\u627E\u5230\u53EF\u53E6\u5B58\u4E3A subtree \u7684\u76EE\u6807\u8282\u70B9\u3002",
216660
+ "mutation.saveSelectedAsSubtreePostSaveMissingTarget": "\u63D0\u4EA4 subtree \u4FDD\u5B58\u7ED3\u679C\u65F6\u672A\u627E\u5230\u76EE\u6807\u8282\u70B9\u3002",
216661
+ "runtime.nodeCheckRuntimeHasErrors": "checker \u8FD0\u884C\u65F6\u5B58\u5728\u9519\u8BEF\u3002",
216662
+ "runtime.invalidSavedSubtreePath": "\u5BBF\u4E3B\u8FD4\u56DE\u4E86\u65E0\u6548\u7684 subtree \u4FDD\u5B58\u8DEF\u5F84\u3002",
216663
+ "runtime.unsupportedDocumentMutation": "\u4E0D\u652F\u6301\u6B64\u6587\u6863\u4FEE\u6539\u3002",
216664
+ "runtime.visibleHookNotRegistered": "visible \u201C{{name}}\u201D \u672A\u6CE8\u518C\u3002",
216665
+ "runtime.visibleHookFailed": "visible \u201C{{name}}\u201D \u6267\u884C\u5931\u8D25\uFF1A{{error}}",
216666
+ "runtime.visibleExpressionDisabled": "visible \u8868\u8FBE\u5F0F\u5DF2\u7981\u7528\uFF1B\u8BF7\u542F\u7528 settings.allowNewFunction\u3002",
216667
+ "runtime.visibleExpressionCompileFailed": "visible \u8868\u8FBE\u5F0F\u7F16\u8BD1\u5931\u8D25\uFF1A{{error}}",
216668
+ "runtime.visibleExpressionFailed": "visible \u8868\u8FBE\u5F0F\u6267\u884C\u5931\u8D25\uFF1A{{error}}",
216669
+ "runtime.visibleExpressionUnknownArg": "visible \u8868\u8FBE\u5F0F\u5F15\u7528\u4E86 args.{{property}}\uFF0C\u4F46 \u201C{{property}}\u201D \u4E0D\u5728\u5DF2\u5B9A\u4E49\u7684\u53C2\u6570\u8303\u56F4\u5185\uFF08\u5DF2\u5B9A\u4E49\u53C2\u6570\uFF1A{{definedArgs}}\uFF09\u3002",
216670
+ "runtime.visibleExpressionNoArgs": "visible \u8868\u8FBE\u5F0F\u5F15\u7528\u4E86 args.{{property}}\uFF0C\u4F46\u5F53\u524D\u8282\u70B9\u672A\u5B9A\u4E49\u53C2\u6570\u3002",
216671
+ "runtime.visibleExpressionUnknownSlotIndex": "visible \u8868\u8FBE\u5F0F\u5F15\u7528\u4E86 {{fieldKind}}[{{index}}]\uFF0C\u4F46{{definedScope}}\u3002",
216672
+ "runtime.visibleExpressionInvalidSlotProperty": "visible \u8868\u8FBE\u5F0F\u5F15\u7528\u4E86 {{fieldKind}}.{{property}}\uFF0C\u4F46 {{fieldKind}} \u4EC5\u652F\u6301\u5DF2\u5B9A\u4E49\u7684\u6570\u5B57\u69FD\u4F4D\u7D22\u5F15\u3002",
216673
+ "runtime.visibleSlotScopeNone": "\u5F53\u524D\u8282\u70B9\u672A\u5B9A\u4E49{{fieldKind}}\u69FD\u4F4D",
216674
+ "runtime.visibleSlotScopeIndex": "\u5DF2\u5B9A\u4E49\u7684{{fieldKind}}\u69FD\u4F4D\u7D22\u5F15\u53EA\u6709 {{start}}",
216675
+ "runtime.visibleSlotScopeRange": "\u5DF2\u5B9A\u4E49\u7684{{fieldKind}}\u69FD\u4F4D\u7D22\u5F15\u8303\u56F4\u662F {{start}}..{{end}}",
216676
+ "runtime.visibleSlotScopeRangeVariadic": "\u5DF2\u5B9A\u4E49\u7684{{fieldKind}}\u69FD\u4F4D\u7D22\u5F15\u8303\u56F4\u662F {{start}}..{{end}}+",
216677
+ "override.resetTitle": "\u91CD\u7F6E\u6B64\u8986\u76D6\uFF1F",
216678
+ "form.enterJsonArray": "\u8F93\u5165 JSON \u6570\u7EC4",
216679
+ "form.enterJsonValue": "\u8F93\u5165 JSON \u503C",
216680
+ "form.unset": "\u672A\u8BBE\u7F6E",
216681
+ "form.true": "\u662F",
216682
+ "form.false": "\u5426",
216683
+ "validation.jsonArray": "{{name}} \u5FC5\u987B\u662F JSON \u6570\u7EC4",
216684
+ "validation.integer": "{{field}} \u5FC5\u987B\u662F\u6574\u6570",
216685
+ "validation.number": "{{field}} \u5FC5\u987B\u662F\u6570\u5B57",
216686
+ "validation.missingOneofInput": "\u7F3A\u5C11 oneof \u8F93\u5165\u9879 \u201C{{input}}\u201D",
216687
+ "validation.oneof": "\u201C{{left}}\u201D \u548C \u201C{{right}}\u201D \u53EA\u80FD\u8BBE\u7F6E\u5176\u4E2D\u4E4B\u4E00",
216688
+ "validation.invalidJsonPath": "\u8DEF\u5F84\u5FC5\u987B\u662F\u5DE5\u4F5C\u76EE\u5F55\u5185\u7684\u76F8\u5BF9 .json \u6587\u4EF6\uFF1A{{path}}",
216689
+ "validation.variableDescriptionRequired": "\u53D8\u91CF\u8BF4\u660E\u5FC5\u586B",
216690
+ "validation.customKeyRequired": "\u81EA\u5B9A\u4E49 key \u5FC5\u586B",
216691
+ "validation.customKeyDuplicate": "\u81EA\u5B9A\u4E49 key \u201C{{key}}\u201D \u91CD\u590D\u4E86",
216692
+ "validation.customValueInvalid": "\u81EA\u5B9A\u4E49\u503C\u5FC5\u987B\u662F\u5B57\u7B26\u4E32\u3001\u6570\u5B57\u6216\u5E03\u5C14\u503C"
216693
+ };
216694
+
216695
+ // webview/shared/runtime-i18n.ts
216696
+ var runtimeTranslations = {
216697
+ en: en_default,
216698
+ zh: zh_default
216699
+ };
216700
+ var INTERPOLATION_PATTERN = /\{\{\s*([^{}\s]+)\s*\}\}/g;
216701
+ var normalizeI18nLanguage = (language) => {
216702
+ const value = (language ?? "").toLowerCase();
216703
+ return value.startsWith("zh") ? "zh" : "en";
216704
+ };
216705
+ var interpolateRuntimeMessage = (template, params) => {
216706
+ if (!params) {
216707
+ return template;
216708
+ }
216709
+ return template.replace(INTERPOLATION_PATTERN, (match, key) => {
216710
+ const value = params[key];
216711
+ return value === void 0 || value === null ? match : String(value);
216313
216712
  });
216314
- return status;
216315
216713
  };
216316
- var appendStatusFlag = (status, childStatus) => {
216317
- const childSuccess = childStatus >> 2 /* SUCCESS */ & 1;
216318
- const childFailure = childStatus >> 1 /* FAILURE */ & 1;
216319
- if (childSuccess === 0) {
216320
- status |= 1 << 5 /* SUCCESS_ZERO */;
216714
+ var translateRuntimeMessage = (language, key, params) => {
216715
+ const template = runtimeTranslations[language][key] ?? runtimeTranslations.en[key] ?? key;
216716
+ return interpolateRuntimeMessage(template, params);
216717
+ };
216718
+
216719
+ // webview/shared/tree-materializer.ts
216720
+ var applyPatchIfAny = (node, patch) => {
216721
+ if (!patch) {
216722
+ return;
216321
216723
  }
216322
- if (childFailure === 0) {
216323
- status |= 1 << 4 /* FAILURE_ZERO */;
216724
+ if (patch.desc !== void 0) {
216725
+ node.desc = patch.desc;
216324
216726
  }
216325
- status |= childStatus;
216326
- return status;
216727
+ if (patch.input !== void 0) {
216728
+ node.input = patch.input;
216729
+ }
216730
+ if (patch.output !== void 0) {
216731
+ node.output = patch.output;
216732
+ }
216733
+ if (patch.args !== void 0) {
216734
+ node.args = { ...node.args ?? {}, ...patch.args };
216735
+ }
216736
+ if (patch.debug !== void 0) {
216737
+ node.debug = patch.debug;
216738
+ }
216739
+ if (patch.disabled !== void 0) {
216740
+ node.disabled = patch.disabled;
216741
+ }
216742
+ };
216743
+ var applyArgDefaults = (node, def) => {
216744
+ if (!def?.args?.length) {
216745
+ return;
216746
+ }
216747
+ node.args ||= {};
216748
+ for (const arg of def.args) {
216749
+ if (node.args[arg.name] === void 0 && arg.default !== void 0) {
216750
+ node.args[arg.name] = arg.default;
216751
+ }
216752
+ }
216753
+ };
216754
+ var buildResolvedExternalNode = (sourceNode, overrideChain, rootOverride) => {
216755
+ const value = clonePersistedNode(sourceNode);
216756
+ for (const tree of [...overrideChain].reverse()) {
216757
+ applyPatchIfAny(value, tree.overrides[sourceNode.uuid]);
216758
+ }
216759
+ const subtreeOriginal = clonePersistedNode(value);
216760
+ applyPatchIfAny(value, rootOverride[sourceNode.uuid]);
216761
+ return { value, subtreeOriginal };
216762
+ };
216763
+ var isInvalidSubtreeSource = (value) => {
216764
+ return Boolean(value && typeof value === "object" && "error" in value);
216765
+ };
216766
+ var toStatusFlag = (nodeName, defsByName) => {
216767
+ let status = 0;
216768
+ const def = defsByName.get(nodeName);
216769
+ def?.status?.forEach((entry) => {
216770
+ switch (entry) {
216771
+ case "success":
216772
+ status |= 1 << 2 /* SUCCESS */;
216773
+ break;
216774
+ case "failure":
216775
+ status |= 1 << 1 /* FAILURE */;
216776
+ break;
216777
+ case "running":
216778
+ status |= 1 << 0 /* RUNNING */;
216779
+ break;
216780
+ }
216781
+ });
216782
+ return status;
216783
+ };
216784
+ var appendStatusFlag = (status, childStatus) => {
216785
+ const childSuccess = childStatus >> 2 /* SUCCESS */ & 1;
216786
+ const childFailure = childStatus >> 1 /* FAILURE */ & 1;
216787
+ if (childSuccess === 0) {
216788
+ status |= 1 << 5 /* SUCCESS_ZERO */;
216789
+ }
216790
+ if (childFailure === 0) {
216791
+ status |= 1 << 4 /* FAILURE_ZERO */;
216792
+ }
216793
+ status |= childStatus;
216794
+ return status;
216327
216795
  };
216328
216796
  var buildStatusFlag = (status, nodeName, childStatus, defsByName) => {
216329
216797
  const def = defsByName.get(nodeName);
@@ -216696,6 +217164,282 @@ var createNodeFieldCheckers = (moduleExports, env2) => {
216696
217164
  return { checkers, hasError, hasCheckers: decorated.length > 0 };
216697
217165
  };
216698
217166
  var normalizeNodeFieldVisibleResult = (result) => result !== false;
217167
+ var VISIBLE_HANDLER_NAME_PATTERN = /^\w+$/;
217168
+ var VISIBLE_EXPRESSION_TOKEN_PATTERN = /[\s()[\].!=<>|&+*\/?:'"]/;
217169
+ var VISIBLE_ARRAY_INDEX_PATTERN = /^(0|[1-9]\d*)$/;
217170
+ var visibleExpressionCache = /* @__PURE__ */ new Map();
217171
+ var getBuildEnvLanguage = (env2) => normalizeI18nLanguage(env2.language);
217172
+ var translateVisibleRuntimeMessage = (env2, key, params) => translateRuntimeMessage(getBuildEnvLanguage(env2), key, params);
217173
+ var formatVisibleArgScope = (env2, definedArgNames) => getBuildEnvLanguage(env2) === "zh" ? definedArgNames.join("\u3001") : definedArgNames.join(", ");
217174
+ var getVisibleFieldKindLabel = (env2, fieldKind) => {
217175
+ if (getBuildEnvLanguage(env2) === "zh") {
217176
+ return fieldKind === "input" ? "\u8F93\u5165" : "\u8F93\u51FA";
217177
+ }
217178
+ return fieldKind;
217179
+ };
217180
+ var parseVisibleArrayIndex = (property) => {
217181
+ if (typeof property === "number") {
217182
+ return Number.isInteger(property) && property >= 0 ? property : null;
217183
+ }
217184
+ if (typeof property === "string" && VISIBLE_ARRAY_INDEX_PATTERN.test(property)) {
217185
+ return Number(property);
217186
+ }
217187
+ return null;
217188
+ };
217189
+ var isVisibleSlotIndexDefined = (slotDefs, index) => {
217190
+ if (index < 0) {
217191
+ return false;
217192
+ }
217193
+ const slotCount = slotDefs?.length ?? 0;
217194
+ if (slotCount === 0) {
217195
+ return false;
217196
+ }
217197
+ if (index < slotCount) {
217198
+ return true;
217199
+ }
217200
+ const normalizedSlotDefs = slotDefs ?? [];
217201
+ return parseSlotDefinition(
217202
+ normalizedSlotDefs[slotCount - 1] ?? "",
217203
+ normalizedSlotDefs,
217204
+ slotCount - 1
217205
+ ).variadic;
217206
+ };
217207
+ var formatVisibleSlotScope = (env2, fieldKind, slotDefs) => {
217208
+ const slotCount = slotDefs?.length ?? 0;
217209
+ const fieldKindLabel = getVisibleFieldKindLabel(env2, fieldKind);
217210
+ if (slotCount === 0) {
217211
+ return translateVisibleRuntimeMessage(env2, "runtime.visibleSlotScopeNone", {
217212
+ fieldKind: fieldKindLabel
217213
+ });
217214
+ }
217215
+ if (parseSlotDefinition(slotDefs?.[slotCount - 1] ?? "", slotDefs, slotCount - 1).variadic) {
217216
+ return translateVisibleRuntimeMessage(env2, "runtime.visibleSlotScopeRangeVariadic", {
217217
+ fieldKind: fieldKindLabel,
217218
+ start: 0,
217219
+ end: slotCount - 1
217220
+ });
217221
+ }
217222
+ return slotCount === 1 ? translateVisibleRuntimeMessage(env2, "runtime.visibleSlotScopeIndex", {
217223
+ fieldKind: fieldKindLabel,
217224
+ start: 0
217225
+ }) : translateVisibleRuntimeMessage(env2, "runtime.visibleSlotScopeRange", {
217226
+ fieldKind: fieldKindLabel,
217227
+ start: 0,
217228
+ end: slotCount - 1
217229
+ });
217230
+ };
217231
+ var createVisibleArgScope = (ctx) => {
217232
+ const definedArgNames = (ctx.nodeDef.args ?? []).map((arg) => arg.name);
217233
+ const definedArgNameSet = new Set(definedArgNames);
217234
+ const target = Object.assign(
217235
+ /* @__PURE__ */ Object.create(null),
217236
+ ctx.node.args ?? {}
217237
+ );
217238
+ return new Proxy(target, {
217239
+ get(currentTarget, property) {
217240
+ if (typeof property === "symbol") {
217241
+ return Reflect.get(currentTarget, property);
217242
+ }
217243
+ if (definedArgNameSet.has(property)) {
217244
+ return currentTarget[property];
217245
+ }
217246
+ throw new Error(
217247
+ definedArgNames.length ? translateVisibleRuntimeMessage(
217248
+ ctx.env,
217249
+ "runtime.visibleExpressionUnknownArg",
217250
+ {
217251
+ property,
217252
+ definedArgs: formatVisibleArgScope(ctx.env, definedArgNames)
217253
+ }
217254
+ ) : translateVisibleRuntimeMessage(ctx.env, "runtime.visibleExpressionNoArgs", {
217255
+ property
217256
+ })
217257
+ );
217258
+ },
217259
+ has(_currentTarget, property) {
217260
+ if (typeof property === "symbol") {
217261
+ return false;
217262
+ }
217263
+ return definedArgNameSet.has(property);
217264
+ }
217265
+ });
217266
+ };
217267
+ var createVisibleSlotScope = (fieldKind, values, slotDefs, env2) => {
217268
+ const target = values ?? [];
217269
+ return new Proxy(target, {
217270
+ get(currentTarget, property, receiver) {
217271
+ if (typeof property === "symbol") {
217272
+ return Reflect.get(currentTarget, property, receiver);
217273
+ }
217274
+ const index = parseVisibleArrayIndex(property);
217275
+ if (index !== null) {
217276
+ if (!isVisibleSlotIndexDefined(slotDefs, index)) {
217277
+ throw new Error(
217278
+ translateVisibleRuntimeMessage(
217279
+ env2,
217280
+ "runtime.visibleExpressionUnknownSlotIndex",
217281
+ {
217282
+ fieldKind: getVisibleFieldKindLabel(env2, fieldKind),
217283
+ index,
217284
+ definedScope: formatVisibleSlotScope(env2, fieldKind, slotDefs)
217285
+ }
217286
+ )
217287
+ );
217288
+ }
217289
+ return Reflect.get(currentTarget, property, receiver);
217290
+ }
217291
+ if (property in currentTarget || property in Array.prototype) {
217292
+ return Reflect.get(currentTarget, property, receiver);
217293
+ }
217294
+ throw new Error(
217295
+ translateVisibleRuntimeMessage(
217296
+ env2,
217297
+ "runtime.visibleExpressionInvalidSlotProperty",
217298
+ {
217299
+ fieldKind: getVisibleFieldKindLabel(env2, fieldKind),
217300
+ property: String(property)
217301
+ }
217302
+ )
217303
+ );
217304
+ },
217305
+ has(currentTarget, property) {
217306
+ if (typeof property === "symbol") {
217307
+ return property in currentTarget;
217308
+ }
217309
+ const index = parseVisibleArrayIndex(property);
217310
+ if (index !== null) {
217311
+ return isVisibleSlotIndexDefined(slotDefs, index);
217312
+ }
217313
+ return property in currentTarget || property in Array.prototype;
217314
+ }
217315
+ });
217316
+ };
217317
+ var isNamedNodeFieldVisible = (visibleName) => VISIBLE_HANDLER_NAME_PATTERN.test(visibleName);
217318
+ var isInlineNodeFieldVisibleExpression = (visibleName, visibles) => {
217319
+ if (visibles.has(visibleName)) {
217320
+ return false;
217321
+ }
217322
+ if (isNamedNodeFieldVisible(visibleName)) {
217323
+ return false;
217324
+ }
217325
+ return VISIBLE_EXPRESSION_TOKEN_PATTERN.test(visibleName);
217326
+ };
217327
+ var getVisibleExpressionEvaluator = (expression) => {
217328
+ const cached = visibleExpressionCache.get(expression);
217329
+ if (cached) {
217330
+ return cached;
217331
+ }
217332
+ const evaluator = new Function(
217333
+ "args",
217334
+ "input",
217335
+ "output",
217336
+ "value",
217337
+ `"use strict"; return (${expression});`
217338
+ );
217339
+ visibleExpressionCache.set(expression, evaluator);
217340
+ return evaluator;
217341
+ };
217342
+ var resolveNodeFieldVisible = (params) => {
217343
+ if (!isInlineNodeFieldVisibleExpression(params.visibleName, params.visibles)) {
217344
+ const visible = params.visibles.get(params.visibleName);
217345
+ if (!visible) {
217346
+ return {
217347
+ diagnostic: {
217348
+ source: params.visibleName,
217349
+ message: translateVisibleRuntimeMessage(
217350
+ params.ctx.env,
217351
+ "runtime.visibleHookNotRegistered",
217352
+ {
217353
+ name: params.visibleName
217354
+ }
217355
+ )
217356
+ }
217357
+ };
217358
+ }
217359
+ try {
217360
+ return {
217361
+ visible: normalizeNodeFieldVisibleResult(visible.visible(params.value, params.ctx))
217362
+ };
217363
+ } catch (error) {
217364
+ return {
217365
+ diagnostic: {
217366
+ source: params.visibleName,
217367
+ message: translateVisibleRuntimeMessage(
217368
+ params.ctx.env,
217369
+ "runtime.visibleHookFailed",
217370
+ {
217371
+ name: params.visibleName,
217372
+ error: formatRuntimeError(error)
217373
+ }
217374
+ )
217375
+ }
217376
+ };
217377
+ }
217378
+ }
217379
+ if (!params.ctx.env.allowNewFunction) {
217380
+ return {
217381
+ diagnostic: {
217382
+ source: params.visibleName,
217383
+ message: translateVisibleRuntimeMessage(
217384
+ params.ctx.env,
217385
+ "runtime.visibleExpressionDisabled"
217386
+ )
217387
+ }
217388
+ };
217389
+ }
217390
+ let evaluator;
217391
+ try {
217392
+ evaluator = getVisibleExpressionEvaluator(params.visibleName);
217393
+ } catch (error) {
217394
+ return {
217395
+ diagnostic: {
217396
+ source: params.visibleName,
217397
+ message: translateVisibleRuntimeMessage(
217398
+ params.ctx.env,
217399
+ "runtime.visibleExpressionCompileFailed",
217400
+ {
217401
+ error: formatRuntimeError(error)
217402
+ }
217403
+ )
217404
+ }
217405
+ };
217406
+ }
217407
+ try {
217408
+ return {
217409
+ visible: normalizeNodeFieldVisibleResult(
217410
+ evaluator(
217411
+ createVisibleArgScope(params.ctx),
217412
+ createVisibleSlotScope(
217413
+ "input",
217414
+ params.ctx.node.input ?? [],
217415
+ params.ctx.nodeDef.input,
217416
+ params.ctx.env
217417
+ ),
217418
+ createVisibleSlotScope(
217419
+ "output",
217420
+ params.ctx.node.output ?? [],
217421
+ params.ctx.nodeDef.output,
217422
+ params.ctx.env
217423
+ ),
217424
+ params.value
217425
+ )
217426
+ )
217427
+ };
217428
+ } catch (error) {
217429
+ return {
217430
+ diagnostic: {
217431
+ source: params.visibleName,
217432
+ message: translateVisibleRuntimeMessage(
217433
+ params.ctx.env,
217434
+ "runtime.visibleExpressionFailed",
217435
+ {
217436
+ error: formatRuntimeError(error)
217437
+ }
217438
+ )
217439
+ }
217440
+ };
217441
+ }
217442
+ };
216699
217443
  var createNodeFieldVisibles = (moduleExports, env2) => {
216700
217444
  const visibles = /* @__PURE__ */ new Map();
216701
217445
  let hasError = false;
@@ -217090,38 +217834,49 @@ var collectNodeFieldCheckDiagnostics = (params) => {
217090
217834
  nodeDef,
217091
217835
  treePath: target.treePath ?? params.treePath,
217092
217836
  env: params.env,
217093
- onArg: ({ fieldName, checkerName, value, ctx }) => {
217094
- if (!checkerName) {
217095
- return;
217096
- }
217097
- const pushDiagnostic = (message) => {
217837
+ onArg: ({ fieldName, checkerName, visibleName, value, ctx }) => {
217838
+ const pushDiagnostic = (source, message) => {
217098
217839
  diagnostics.push({
217099
217840
  instanceKey: target.instanceKey,
217100
217841
  nodeId: node.id,
217101
217842
  nodeName: node.name,
217102
217843
  fieldKind: "arg",
217103
217844
  fieldName,
217104
- checker: checkerName,
217845
+ checker: source,
217105
217846
  message
217106
217847
  });
217107
217848
  };
217849
+ if (visibleName) {
217850
+ const resolution = resolveNodeFieldVisible({
217851
+ visibleName,
217852
+ value,
217853
+ ctx,
217854
+ visibles: params.visibles ?? /* @__PURE__ */ new Map()
217855
+ });
217856
+ if (resolution.diagnostic) {
217857
+ pushDiagnostic(resolution.diagnostic.source, resolution.diagnostic.message);
217858
+ }
217859
+ }
217860
+ if (!checkerName) {
217861
+ return;
217862
+ }
217108
217863
  const checker = params.checkers.get(checkerName);
217109
217864
  if (!checker) {
217110
- pushDiagnostic(`checker '${checkerName}' is not registered`);
217865
+ pushDiagnostic(checkerName, `checker '${checkerName}' is not registered`);
217111
217866
  return;
217112
217867
  }
217113
217868
  try {
217114
217869
  const messages = normalizeNodeFieldCheckResult(checker.validate(value, ctx));
217115
- messages.forEach(pushDiagnostic);
217870
+ messages.forEach((message) => pushDiagnostic(checkerName, message));
217116
217871
  } catch (error) {
217117
- pushDiagnostic(`checker '${checkerName}' failed: ${formatRuntimeError(error)}`);
217872
+ pushDiagnostic(
217873
+ checkerName,
217874
+ `checker '${checkerName}' failed: ${formatRuntimeError(error)}`
217875
+ );
217118
217876
  }
217119
217877
  },
217120
- onInput: ({ fieldName, fieldIndex, checkerName, value, ctx }) => {
217121
- if (!checkerName) {
217122
- return;
217123
- }
217124
- const pushDiagnostic = (message) => {
217878
+ onInput: ({ fieldName, fieldIndex, checkerName, visibleName, value, ctx }) => {
217879
+ const pushDiagnostic = (source, message) => {
217125
217880
  diagnostics.push({
217126
217881
  instanceKey: target.instanceKey,
217127
217882
  nodeId: node.id,
@@ -217129,27 +217884,41 @@ var collectNodeFieldCheckDiagnostics = (params) => {
217129
217884
  fieldKind: "input",
217130
217885
  fieldName,
217131
217886
  fieldIndex,
217132
- checker: checkerName,
217887
+ checker: source,
217133
217888
  message
217134
217889
  });
217135
217890
  };
217891
+ if (visibleName) {
217892
+ const resolution = resolveNodeFieldVisible({
217893
+ visibleName,
217894
+ value,
217895
+ ctx,
217896
+ visibles: params.visibles ?? /* @__PURE__ */ new Map()
217897
+ });
217898
+ if (resolution.diagnostic) {
217899
+ pushDiagnostic(resolution.diagnostic.source, resolution.diagnostic.message);
217900
+ }
217901
+ }
217902
+ if (!checkerName) {
217903
+ return;
217904
+ }
217136
217905
  const checker = params.checkers.get(checkerName);
217137
217906
  if (!checker) {
217138
- pushDiagnostic(`checker '${checkerName}' is not registered`);
217907
+ pushDiagnostic(checkerName, `checker '${checkerName}' is not registered`);
217139
217908
  return;
217140
217909
  }
217141
217910
  try {
217142
217911
  const messages = normalizeNodeFieldCheckResult(checker.validate(value, ctx));
217143
- messages.forEach(pushDiagnostic);
217912
+ messages.forEach((message) => pushDiagnostic(checkerName, message));
217144
217913
  } catch (error) {
217145
- pushDiagnostic(`checker '${checkerName}' failed: ${formatRuntimeError(error)}`);
217914
+ pushDiagnostic(
217915
+ checkerName,
217916
+ `checker '${checkerName}' failed: ${formatRuntimeError(error)}`
217917
+ );
217146
217918
  }
217147
217919
  },
217148
- onOutput: ({ fieldName, fieldIndex, checkerName, value, ctx }) => {
217149
- if (!checkerName) {
217150
- return;
217151
- }
217152
- const pushDiagnostic = (message) => {
217920
+ onOutput: ({ fieldName, fieldIndex, checkerName, visibleName, value, ctx }) => {
217921
+ const pushDiagnostic = (source, message) => {
217153
217922
  diagnostics.push({
217154
217923
  instanceKey: target.instanceKey,
217155
217924
  nodeId: node.id,
@@ -217157,20 +217926,37 @@ var collectNodeFieldCheckDiagnostics = (params) => {
217157
217926
  fieldKind: "output",
217158
217927
  fieldName,
217159
217928
  fieldIndex,
217160
- checker: checkerName,
217929
+ checker: source,
217161
217930
  message
217162
217931
  });
217163
217932
  };
217933
+ if (visibleName) {
217934
+ const resolution = resolveNodeFieldVisible({
217935
+ visibleName,
217936
+ value,
217937
+ ctx,
217938
+ visibles: params.visibles ?? /* @__PURE__ */ new Map()
217939
+ });
217940
+ if (resolution.diagnostic) {
217941
+ pushDiagnostic(resolution.diagnostic.source, resolution.diagnostic.message);
217942
+ }
217943
+ }
217944
+ if (!checkerName) {
217945
+ return;
217946
+ }
217164
217947
  const checker = params.checkers.get(checkerName);
217165
217948
  if (!checker) {
217166
- pushDiagnostic(`checker '${checkerName}' is not registered`);
217949
+ pushDiagnostic(checkerName, `checker '${checkerName}' is not registered`);
217167
217950
  return;
217168
217951
  }
217169
217952
  try {
217170
217953
  const messages = normalizeNodeFieldCheckResult(checker.validate(value, ctx));
217171
- messages.forEach(pushDiagnostic);
217954
+ messages.forEach((message) => pushDiagnostic(checkerName, message));
217172
217955
  } catch (error) {
217173
- pushDiagnostic(`checker '${checkerName}' failed: ${formatRuntimeError(error)}`);
217956
+ pushDiagnostic(
217957
+ checkerName,
217958
+ `checker '${checkerName}' failed: ${formatRuntimeError(error)}`
217959
+ );
217174
217960
  }
217175
217961
  }
217176
217962
  });
@@ -217194,66 +217980,60 @@ var resolveNodeFieldVisibility = (params) => {
217194
217980
  if (!visibleName) {
217195
217981
  return;
217196
217982
  }
217197
- const visible = params.visibles.get(visibleName);
217198
- if (!visible) {
217983
+ const resolution = resolveNodeFieldVisible({
217984
+ visibleName,
217985
+ value,
217986
+ ctx,
217987
+ visibles: params.visibles
217988
+ });
217989
+ if (resolution.diagnostic) {
217199
217990
  params.env.logger.warn(
217200
- `visible '${visibleName}' is not registered for ${formatFieldLocator(node, "arg", fieldName)}`
217991
+ `${resolution.diagnostic.message} for ${formatFieldLocator(node, "arg", fieldName)}`
217201
217992
  );
217202
217993
  return;
217203
217994
  }
217204
- try {
217205
- visibility.args[fieldName] = normalizeNodeFieldVisibleResult(
217206
- visible.visible(value, ctx)
217207
- );
217208
- } catch (error) {
217209
- params.env.logger.warn(
217210
- `visible '${visibleName}' failed for ${formatFieldLocator(node, "arg", fieldName)}: ${formatRuntimeError(error)}`
217211
- );
217212
- visibility.args[fieldName] = true;
217995
+ if (typeof resolution.visible === "boolean") {
217996
+ visibility.args[fieldName] = resolution.visible;
217213
217997
  }
217214
217998
  },
217215
217999
  onInput: ({ fieldName, fieldIndex, visibleName, value, ctx }) => {
217216
218000
  if (!visibleName) {
217217
218001
  return;
217218
218002
  }
217219
- const visible = params.visibles.get(visibleName);
217220
- if (!visible) {
218003
+ const resolution = resolveNodeFieldVisible({
218004
+ visibleName,
218005
+ value,
218006
+ ctx,
218007
+ visibles: params.visibles
218008
+ });
218009
+ if (resolution.diagnostic) {
217221
218010
  params.env.logger.warn(
217222
- `visible '${visibleName}' is not registered for ${formatFieldLocator(node, "input", fieldName, fieldIndex)}`
218011
+ `${resolution.diagnostic.message} for ${formatFieldLocator(node, "input", fieldName, fieldIndex)}`
217223
218012
  );
217224
218013
  return;
217225
218014
  }
217226
- try {
217227
- visibility.input[fieldIndex] = normalizeNodeFieldVisibleResult(
217228
- visible.visible(value, ctx)
217229
- );
217230
- } catch (error) {
217231
- params.env.logger.warn(
217232
- `visible '${visibleName}' failed for ${formatFieldLocator(node, "input", fieldName, fieldIndex)}: ${formatRuntimeError(error)}`
217233
- );
217234
- visibility.input[fieldIndex] = true;
218015
+ if (typeof resolution.visible === "boolean") {
218016
+ visibility.input[fieldIndex] = resolution.visible;
217235
218017
  }
217236
218018
  },
217237
218019
  onOutput: ({ fieldName, fieldIndex, visibleName, value, ctx }) => {
217238
218020
  if (!visibleName) {
217239
218021
  return;
217240
218022
  }
217241
- const visible = params.visibles.get(visibleName);
217242
- if (!visible) {
218023
+ const resolution = resolveNodeFieldVisible({
218024
+ visibleName,
218025
+ value,
218026
+ ctx,
218027
+ visibles: params.visibles
218028
+ });
218029
+ if (resolution.diagnostic) {
217243
218030
  params.env.logger.warn(
217244
- `visible '${visibleName}' is not registered for ${formatFieldLocator(node, "output", fieldName, fieldIndex)}`
218031
+ `${resolution.diagnostic.message} for ${formatFieldLocator(node, "output", fieldName, fieldIndex)}`
217245
218032
  );
217246
218033
  return;
217247
218034
  }
217248
- try {
217249
- visibility.output[fieldIndex] = normalizeNodeFieldVisibleResult(
217250
- visible.visible(value, ctx)
217251
- );
217252
- } catch (error) {
217253
- params.env.logger.warn(
217254
- `visible '${visibleName}' failed for ${formatFieldLocator(node, "output", fieldName, fieldIndex)}: ${formatRuntimeError(error)}`
217255
- );
217256
- visibility.output[fieldIndex] = true;
218035
+ if (typeof resolution.visible === "boolean") {
218036
+ visibility.output[fieldIndex] = resolution.visible;
217257
218037
  }
217258
218038
  }
217259
218039
  });
@@ -217689,13 +218469,19 @@ var buildProjectWithContext = async (project, buildDir, context) => {
217689
218469
  path: b3path_default,
217690
218470
  workdir: context.workdir,
217691
218471
  nodeDefs: context.nodeDefs,
217692
- logger
218472
+ logger,
218473
+ allowNewFunction: settings.allowNewFunction ?? false
217693
218474
  };
217694
218475
  const buildRuntime = createBuildScriptRuntimeWithCheckModules(
217695
218476
  buildScriptModule,
217696
218477
  checkScriptModules,
217697
218478
  scriptEnv
217698
218479
  );
218480
+ const visibleRuntime = createNodeFieldVisibleRuntimeWithCheckModules(
218481
+ buildScriptModule,
218482
+ checkScriptModules,
218483
+ scriptEnv
218484
+ );
217699
218485
  if (buildSetting && (!buildScriptModule || buildRuntime.hasError)) {
217700
218486
  hasError = true;
217701
218487
  }
@@ -217741,7 +218527,8 @@ var buildProjectWithContext = async (project, buildDir, context) => {
217741
218527
  tree,
217742
218528
  treePath: candidatePath,
217743
218529
  env: scriptEnv,
217744
- checkers: buildRuntime.nodeFieldCheckers
218530
+ checkers: buildRuntime.nodeFieldCheckers,
218531
+ visibles: visibleRuntime.nodeFieldVisibles
217745
218532
  });
217746
218533
  if (checkDiagnostics.length) {
217747
218534
  hasError = true;
@@ -217774,6 +218561,7 @@ var batchProcessProjectWithContext = async (project, scriptPath, context) => {
217774
218561
  let writtenFiles = 0;
217775
218562
  const allErrors = [];
217776
218563
  const stagedWrites = [];
218564
+ const settings = readWorkspaceSettings(project);
217777
218565
  let buildScriptModule;
217778
218566
  try {
217779
218567
  buildScriptModule = await loadRuntimeModule(scriptPath, {
@@ -217787,7 +218575,8 @@ var batchProcessProjectWithContext = async (project, scriptPath, context) => {
217787
218575
  path: b3path_default,
217788
218576
  workdir: context.workdir,
217789
218577
  nodeDefs: context.nodeDefs,
217790
- logger
218578
+ logger,
218579
+ allowNewFunction: settings.allowNewFunction ?? false
217791
218580
  };
217792
218581
  const buildScript = createBatchHooks(buildScriptModule, scriptEnv);
217793
218582
  if (!buildScriptModule || !buildScript) {
@@ -219740,6 +220529,29 @@ async function resolveB3SettingFilePath(workspaceFolder, documentUri) {
219740
220529
  }
219741
220530
  return void 0;
219742
220531
  }
220532
+ async function resolveB3WorkspaceFilePath(workspaceFolder, documentUri) {
220533
+ if (documentUri) {
220534
+ const wf = vscode7.workspace.getWorkspaceFolder(documentUri);
220535
+ const foundFs = findB3WorkspacePath(documentUri, wf?.uri ?? workspaceFolder);
220536
+ if (foundFs) {
220537
+ try {
220538
+ await vscode7.workspace.fs.stat(vscode7.Uri.file(foundFs));
220539
+ return foundFs;
220540
+ } catch {
220541
+ }
220542
+ }
220543
+ }
220544
+ const pattern = new vscode7.RelativePattern(workspaceFolder.fsPath, "*.b3-workspace");
220545
+ const found = await vscode7.workspace.findFiles(pattern, null, 1);
220546
+ if (found.length > 0) {
220547
+ try {
220548
+ await vscode7.workspace.fs.stat(found[0]);
220549
+ return found[0].fsPath;
220550
+ } catch {
220551
+ }
220552
+ }
220553
+ return void 0;
220554
+ }
219743
220555
  async function resolveNodeDefs(workspaceFolder, documentUri) {
219744
220556
  const filePath = await resolveB3SettingFilePath(workspaceFolder, documentUri);
219745
220557
  if (!filePath) {
@@ -219754,23 +220566,19 @@ async function resolveNodeDefs(workspaceFolder, documentUri) {
219754
220566
  return [];
219755
220567
  }
219756
220568
  }
219757
- async function resolveWorkspaceNodeColors(workspaceFolder, documentUri) {
219758
- let wfPath;
219759
- if (documentUri) {
219760
- const wf = vscode7.workspace.getWorkspaceFolder(documentUri);
219761
- wfPath = findB3WorkspacePath(documentUri, wf?.uri ?? workspaceFolder);
219762
- }
220569
+ async function resolveWorkspaceFileSettings(workspaceFolder, documentUri) {
220570
+ const wfPath = await resolveB3WorkspaceFilePath(workspaceFolder, documentUri);
219763
220571
  if (!wfPath) {
219764
- const pattern = new vscode7.RelativePattern(workspaceFolder.fsPath, "*.b3-workspace");
219765
- const found = await vscode7.workspace.findFiles(pattern, null, 1);
219766
- if (found.length > 0) wfPath = found[0].fsPath;
220572
+ return void 0;
219767
220573
  }
219768
- if (!wfPath) return void 0;
219769
220574
  try {
219770
220575
  const raw = await vscode7.workspace.fs.readFile(vscode7.Uri.file(wfPath));
219771
220576
  const data = parseWorkspaceModelContent(Buffer.from(raw).toString("utf-8"));
219772
- const nc = data.settings.nodeColors;
219773
- return nc && Object.keys(nc).length > 0 ? nc : void 0;
220577
+ const nodeColors = data.settings.nodeColors;
220578
+ return {
220579
+ allowNewFunction: data.settings.allowNewFunction,
220580
+ nodeColors: nodeColors && Object.keys(nodeColors).length > 0 ? nodeColors : void 0
220581
+ };
219774
220582
  } catch {
219775
220583
  return void 0;
219776
220584
  }
@@ -219924,941 +220732,510 @@ var ProjectIndex = class {
219924
220732
  return void 0;
219925
220733
  }
219926
220734
  const relativePath = path7.relative(this.workdir.fsPath, uri.fsPath).replace(/\\/g, "/");
219927
- if (relativePath.startsWith("..") || path7.isAbsolute(relativePath)) {
219928
- return void 0;
219929
- }
219930
- return parseWorkdirRelativeJsonPath(relativePath) ?? void 0;
219931
- }
219932
- async readWorkspaceFileContent(fileUri) {
219933
- const openDocument = vscode8.workspace.textDocuments.find(
219934
- (document) => isSameUri(document.uri, fileUri)
219935
- );
219936
- if (openDocument) {
219937
- return openDocument.getText();
219938
- }
219939
- const raw = await vscode8.workspace.fs.readFile(fileUri);
219940
- return Buffer.from(raw).toString("utf-8");
219941
- }
219942
- async readTreeFile(relativePath) {
219943
- const normalizedPath = parseWorkdirRelativeJsonPath(relativePath);
219944
- if (!normalizedPath) {
219945
- return null;
219946
- }
219947
- const fileUri = vscode8.Uri.joinPath(this.workdir, normalizedPath);
219948
- const content = await this.readWorkspaceFileContent(fileUri).catch(() => null);
219949
- if (content === null) {
219950
- this.treeCache.set(normalizedPath, {
219951
- content: "",
219952
- tree: null
219953
- });
219954
- return null;
219955
- }
219956
- const cached = this.treeCache.get(normalizedPath);
219957
- if (cached && cached.content === content) {
219958
- return cached.tree;
219959
- }
219960
- try {
219961
- const tree = parsePersistedTreeContent(content, normalizedPath);
219962
- this.treeCache.set(normalizedPath, {
219963
- content,
219964
- tree
219965
- });
219966
- return tree;
219967
- } catch {
219968
- this.treeCache.set(normalizedPath, {
219969
- content,
219970
- tree: null
219971
- });
219972
- return null;
219973
- }
219974
- }
219975
- getLocalVarsFromTree(relativePath) {
219976
- const normalizedPath = parseWorkdirRelativeJsonPath(relativePath);
219977
- if (!normalizedPath) {
219978
- return [];
219979
- }
219980
- const tree = this.treeCache.get(normalizedPath)?.tree;
219981
- if (!tree) {
219982
- return [];
219983
- }
219984
- return tree.variables.locals.filter((entry) => entry.name).map((entry) => ({ name: entry.name, desc: entry.desc ?? "" }));
219985
- }
219986
- async readVarsFromFile(relativePath, visitedForGlobal, globalVars) {
219987
- const localVars = [];
219988
- const parsedPath = parseWorkdirRelativeJsonPath(relativePath);
219989
- if (!parsedPath) {
219990
- return localVars;
219991
- }
219992
- const normalizedPath = parsedPath;
219993
- if (visitedForGlobal.has(normalizedPath)) {
219994
- return localVars;
219995
- }
219996
- visitedForGlobal.add(normalizedPath);
219997
- const tree = await this.readTreeFile(normalizedPath);
219998
- if (!tree) {
219999
- return localVars;
220000
- }
220001
- for (const entry of tree.variables.locals) {
220002
- if (!entry.name) {
220003
- continue;
220004
- }
220005
- const variable = { name: entry.name, desc: entry.desc ?? "" };
220006
- localVars.push(variable);
220007
- if (!globalVars[entry.name]) {
220008
- globalVars[entry.name] = variable;
220009
- }
220010
- }
220011
- for (const importPath of tree.variables.imports) {
220012
- await this.readVarsFromFile(importPath, visitedForGlobal, globalVars);
220013
- }
220014
- for (const subtreePath of collectSubtreePaths2(tree.root)) {
220015
- await this.readVarsFromFile(subtreePath, visitedForGlobal, globalVars);
220016
- }
220017
- return localVars;
220018
- }
220019
- async collectOrderedTransitiveImportPaths(seedImports) {
220020
- return collectTransitivePaths(normalizePathList(seedImports), async (relativePath) => {
220021
- const tree = await this.readTreeFile(relativePath);
220022
- return normalizePathList(tree?.variables.imports ?? []);
220023
- });
220024
- }
220025
- async collectOrderedTransitiveSubtreePaths(root) {
220026
- return collectTransitivePaths(
220027
- normalizePathList(collectSubtreePaths2(root)),
220028
- async (relativePath) => {
220029
- const tree = await this.readTreeFile(relativePath);
220030
- return tree?.root ? normalizePathList(collectSubtreePaths2(tree.root)) : [];
220031
- }
220032
- );
220033
- }
220034
- };
220035
-
220036
- // src/editor-session/settings/live-settings.ts
220037
- var vscode10 = __toESM(require("vscode"));
220038
-
220039
- // src/editor-session/settings/editor-settings.ts
220040
- var vscode9 = __toESM(require("vscode"));
220041
- function getEditorLanguage(setting) {
220042
- if (setting === "zh" || setting === "en") {
220043
- return setting;
220044
- }
220045
- const envLanguage = vscode9.env.language.toLowerCase();
220046
- return envLanguage.startsWith("zh") ? "zh" : "en";
220047
- }
220048
- function getVSCodeTheme() {
220049
- const kind = vscode9.window.activeColorTheme.kind;
220050
- return kind === vscode9.ColorThemeKind.Light || kind === vscode9.ColorThemeKind.HighContrastLight ? "light" : "dark";
220051
- }
220052
-
220053
- // src/editor-session/settings/live-settings.ts
220054
- function createLiveSettingsResolver(workspaceFolderUri, documentUri) {
220055
- return async () => {
220056
- const config = vscode10.workspace.getConfiguration("behavior3");
220057
- return {
220058
- checkExpr: config.get("checkExpr", true),
220059
- subtreeEditable: config.get("subtreeEditable", true),
220060
- language: getEditorLanguage(config.get("language", "auto")),
220061
- inspectorMode: config.get("inspectorMode", "sidebar"),
220062
- nodeColors: await resolveWorkspaceNodeColors(workspaceFolderUri, documentUri)
220063
- };
220064
- };
220065
- }
220066
-
220067
- // src/editor-session/session/context.ts
220068
- async function createTreeEditorSessionContext(params) {
220069
- const workspaceFolderUri = getWorkdir(params.document.uri);
220070
- const projectRootUri = vscode11.Uri.file(
220071
- getBehaviorProjectRootFsPath(params.document.uri, workspaceFolderUri)
220072
- );
220073
- const projectIndex = new ProjectIndex(projectRootUri);
220074
- const resolveLiveSettings = createLiveSettingsResolver(
220075
- workspaceFolderUri,
220076
- params.document.uri
220077
- );
220078
- const [nodeDefs, settingDir, currentSettings] = await Promise.all([
220079
- resolveNodeDefs(workspaceFolderUri, params.document.uri),
220080
- getResolvedB3SettingDir(workspaceFolderUri, params.document.uri),
220081
- resolveLiveSettings()
220082
- ]);
220083
- const state = {
220084
- nodeDefs,
220085
- settingDir,
220086
- currentSettings,
220087
- fileVersionIsNewer: false,
220088
- newerFileVersion: null,
220089
- cachedSubtreeRefs: null,
220090
- latestAllFiles: [],
220091
- latestVarDecls: {
220092
- usingVars: {},
220093
- importDecls: [],
220094
- subtreeDecls: []
220095
- },
220096
- sharedSelection: normalizeHostSelectionState(params.initialSelection),
220097
- selectionRevision: 0,
220098
- inspectorContentSyncKind: "reload"
220099
- };
220100
- const documentSession = params.document.sessionState;
220101
- const buildDocumentSessionMessage = () => documentSession.getSnapshot();
220102
- params.configureWebview(params.webviewPanel.webview, workspaceFolderUri);
220103
- const postMessage = (message) => params.webviewPanel.webview.postMessage(message);
220104
- const mapDefsForWebview = (defs = state.nodeDefs) => mapNodeDefsIconsForWebview(
220105
- params.webviewPanel.webview,
220106
- workspaceFolderUri,
220107
- state.settingDir,
220108
- defs
220109
- );
220110
- return {
220111
- ...params,
220112
- workspaceFolderUri,
220113
- projectRootUri,
220114
- projectIndex,
220115
- state,
220116
- documentSession,
220117
- resolveLiveSettings,
220118
- postMessage,
220119
- mapDefsForWebview,
220120
- buildDocumentSessionMessage,
220121
- enqueueMainDocumentOperation: createSerialOperationQueue()
220122
- };
220123
- }
220124
-
220125
- // src/editor-session/session/document-lifecycle.ts
220126
- var vscode12 = __toESM(require("vscode"));
220127
- function createSessionDocumentLifecycle(context, inspectorSync, subtreeTracking, fileVersionGuard) {
220128
- const {
220129
- document,
220130
- revertDocument,
220131
- onDidChangeDocument,
220132
- state,
220133
- documentSession,
220134
- postMessage,
220135
- buildDocumentSessionMessage,
220136
- enqueueMainDocumentOperation
220137
- } = context;
220138
- const { fanoutDocumentSnapshot } = inspectorSync;
220139
- const { invalidateSubtreeRefs, refreshTrackedSubtreeRefs } = subtreeTracking;
220140
- const { updateFileVersionState, blockEditingForNewerFile } = fileVersionGuard;
220141
- const applySessionHistorySnapshot = async (snapshot) => {
220142
- const sessionSnapshot = buildDocumentSessionMessage();
220143
- const changed = document.syncContentState(snapshot, sessionSnapshot.dirty);
220144
- if (!changed) {
220145
- return false;
220146
- }
220147
- state.inspectorContentSyncKind = "update";
220148
- invalidateSubtreeRefs();
220149
- void refreshTrackedSubtreeRefs();
220150
- updateFileVersionState(snapshot);
220151
- onDidChangeDocument(document);
220152
- await fanoutDocumentSnapshot({
220153
- syncKind: "update"
220154
- });
220155
- return true;
220156
- };
220157
- const handleSaveDocumentMessage = async (msg, reply = postMessage) => {
220158
- await enqueueMainDocumentOperation(async () => {
220159
- const editBlockedMessage = blockEditingForNewerFile();
220160
- if (editBlockedMessage) {
220161
- await reply({
220162
- type: "saveDocumentResult",
220163
- requestId: msg.requestId,
220164
- success: false,
220165
- error: editBlockedMessage
220166
- });
220167
- return;
220168
- }
220169
- try {
220170
- if (document.isDirty) {
220171
- await vscode12.workspace.save(document.uri);
220172
- }
220173
- const success = !document.isDirty;
220174
- if (!success) {
220175
- getBehavior3OutputChannel().warn(
220176
- `[saveDocument] save failed for ${document.uri.fsPath}; isDirty=${document.isDirty}`
220177
- );
220178
- }
220179
- await reply({
220180
- type: "saveDocumentResult",
220181
- requestId: msg.requestId,
220182
- success,
220183
- error: success ? void 0 : "Failed to save document"
220184
- });
220185
- if (success) {
220186
- state.inspectorContentSyncKind = "reload";
220187
- }
220188
- } catch (error) {
220189
- getBehavior3OutputChannel().error(
220190
- `[saveDocument] exception for ${document.uri.fsPath}: ${String(error)}`
220191
- );
220192
- await reply({
220193
- type: "saveDocumentResult",
220194
- requestId: msg.requestId,
220195
- success: false,
220196
- error: String(error)
220197
- });
220198
- }
220199
- });
220200
- };
220201
- const handleHistoryNavigationMessage = async (direction) => {
220202
- await enqueueMainDocumentOperation(async () => {
220203
- const editBlockedMessage = blockEditingForNewerFile();
220204
- if (editBlockedMessage) {
220205
- return;
220206
- }
220207
- const snapshot = direction === "undo" ? documentSession.undo() : documentSession.redo();
220208
- if (!snapshot) {
220209
- return;
220210
- }
220211
- await applySessionHistorySnapshot(snapshot);
220212
- });
220213
- };
220214
- const handleRevertDocumentMessage = async (msg, reply = postMessage) => {
220215
- await enqueueMainDocumentOperation(async () => {
220216
- const cancellation = new vscode12.CancellationTokenSource();
220217
- try {
220218
- await revertDocument(document, cancellation.token);
220219
- state.inspectorContentSyncKind = "reload";
220220
- await reply({
220221
- type: "revertDocumentResult",
220222
- requestId: msg.requestId,
220223
- success: true
220224
- });
220225
- } catch (error) {
220226
- await reply({
220227
- type: "revertDocumentResult",
220228
- requestId: msg.requestId,
220229
- success: false,
220230
- error: String(error)
220231
- });
220232
- } finally {
220233
- cancellation.dispose();
220234
- }
220235
- });
220236
- };
220237
- const handleMainDocumentFileChange = async () => {
220238
- await enqueueMainDocumentOperation(async () => {
220239
- let content;
220240
- try {
220241
- content = await readFileContentFromDisk(document.uri);
220242
- } catch {
220243
- return;
220244
- }
220245
- invalidateSubtreeRefs();
220246
- if (document.consumeOwnWrite(content)) {
220247
- return;
220248
- }
220249
- if (document.content === content) {
220250
- return;
220251
- }
220252
- if (!document.isDirty) {
220253
- document.updateContent(content, { markSaved: true, markDirty: false });
220254
- documentSession.replaceFromDisk(content);
220255
- state.inspectorContentSyncKind = "reload";
220256
- void refreshTrackedSubtreeRefs();
220257
- updateFileVersionState(content, { showWarning: true });
220258
- await fanoutDocumentSnapshot({
220259
- syncKind: "reload"
220260
- });
220261
- return;
220262
- }
220263
- documentSession.showReloadConflict(content);
220264
- await fanoutDocumentSnapshot({
220265
- syncKind: "update",
220266
- refreshVars: false
220267
- });
220268
- });
220269
- };
220270
- return {
220271
- handleSaveDocumentMessage,
220272
- handleHistoryNavigationMessage,
220273
- handleRevertDocumentMessage,
220274
- handleMainDocumentFileChange
220275
- };
220276
- }
220277
-
220278
- // src/editor-session/document/subtree-overrides.ts
220279
- var path8 = __toESM(require("path"));
220280
- var vscode13 = __toESM(require("vscode"));
220281
- function branchContainsSubtreeLink(node) {
220282
- if (!node) {
220283
- return false;
220284
- }
220285
- let found = false;
220286
- walkPersistedNodes(node, (entry) => {
220287
- if (entry.path) {
220288
- found = true;
220289
- }
220290
- });
220291
- return found;
220292
- }
220293
- async function normalizeReachableSubtreeOverrides(params) {
220294
- if (Object.keys(params.tree.overrides).length === 0) {
220295
- return;
220296
- }
220297
- const subtreeSources = await loadSubtreeSourceCache({
220298
- root: params.tree.root,
220299
- readContent: async (relativePath) => {
220300
- const subtreeUri = vscode13.Uri.file(path8.join(params.projectRootFsPath, relativePath));
220301
- try {
220302
- return await params.readWorkspaceFileContent(subtreeUri);
220303
- } catch {
220304
- return null;
220305
- }
220306
- }
220307
- });
220308
- pruneStaleSubtreeOverrides({
220309
- tree: params.tree,
220310
- subtreeSources
220311
- });
220312
- }
220313
- function mutationMayAffectSubtreeOverrideReachability(mutation, currentTree) {
220314
- switch (mutation.type) {
220315
- case "updateNode": {
220316
- if (mutation.payload.currentNodeSnapshot?.subtreeNode) {
220317
- return false;
220318
- }
220319
- const currentNode = findPersistedNodeByStableId(
220320
- currentTree.root,
220321
- mutation.payload.target.structuralStableId
220322
- ) ?? mutation.payload.currentNodeSnapshot?.data;
220323
- if (!currentNode) {
220324
- return false;
220325
- }
220326
- const currentPath = currentNode.path;
220327
- const nextPath = mutation.payload.data.path?.trim() || void 0;
220328
- return currentPath !== nextPath;
220329
- }
220330
- case "replaceNode": {
220331
- const currentNode = findPersistedNodeByStableId(
220332
- currentTree.root,
220333
- mutation.payload.target.structuralStableId
220334
- );
220335
- return branchContainsSubtreeLink(currentNode) || branchContainsSubtreeLink(mutation.payload.snapshot);
220336
- }
220337
- case "deleteNode": {
220338
- const currentNode = findPersistedNodeByStableId(
220339
- currentTree.root,
220340
- mutation.payload.target.structuralStableId
220341
- );
220342
- return branchContainsSubtreeLink(currentNode);
220343
- }
220344
- default:
220345
- return false;
220346
- }
220347
- }
220348
-
220349
- // src/editor-session/session/selection-state.ts
220350
- var buildPendingSelectionRef = (structuralStableId) => ({
220351
- instanceKey: structuralStableId,
220352
- displayId: "",
220353
- structuralStableId,
220354
- sourceStableId: structuralStableId,
220355
- sourceTreePath: null,
220356
- subtreeStack: []
220357
- });
220358
- var applySharedSelectionState = (currentSelection, nextSelection, opts) => {
220359
- const normalized = normalizeHostSelectionState(nextSelection);
220360
- if (isJsonEqual(currentSelection, normalized)) {
220361
- return {
220362
- selection: currentSelection,
220363
- result: opts?.reassertIfEqual ? "reasserted" : "noop"
220364
- };
220365
- }
220366
- return {
220367
- selection: normalized,
220368
- result: "changed"
220369
- };
220370
- };
220371
-
220372
- // src/editor-session/session/messages.ts
220373
- function buildVarDeclLoadedMessage(result, allFiles) {
220374
- return {
220375
- type: "varDeclLoaded",
220376
- usingVars: Object.values(result.usingVars),
220377
- allFiles,
220378
- importDecls: result.importDecls,
220379
- subtreeDecls: result.subtreeDecls
220380
- };
220381
- }
220382
- function buildDocumentSnapshotChangedMessage(params) {
220383
- return {
220384
- type: "documentSnapshotChanged",
220385
- snapshot: {
220386
- content: params.content,
220387
- documentSession: params.documentSession,
220388
- selection: params.selection,
220389
- syncKind: params.syncKind
220390
- }
220391
- };
220392
- }
220393
- function buildHostSelectionFromMutationSelection(selection) {
220394
- return selection.kind === "tree" ? { kind: "tree" } : {
220395
- kind: "node",
220396
- ref: buildPendingSelectionRef(selection.structuralStableId)
220397
- };
220398
- }
220399
- function buildInitMessage(params) {
220400
- return {
220401
- type: "init",
220402
- content: params.content,
220403
- filePath: params.filePath,
220404
- workdir: params.workdir,
220405
- nodeDefs: params.nodeDefs,
220406
- checkExpr: params.settings.checkExpr,
220407
- subtreeEditable: params.settings.subtreeEditable,
220408
- language: params.settings.language,
220409
- theme: params.theme,
220410
- inspectorMode: params.settings.inspectorMode,
220411
- allFiles: params.allFiles,
220412
- nodeColors: params.settings.nodeColors,
220413
- documentSession: params.documentSession,
220414
- selection: params.selection
220415
- };
220416
- }
220417
-
220418
- // webview/shared/node-overrides.ts
220419
- var hasOwn = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
220420
- var getNodeArgOverrideCompareValue = (args, arg) => {
220421
- if (args && hasOwn(args, arg.name)) {
220422
- return args[arg.name];
220423
- }
220424
- return arg.default;
220425
- };
220426
-
220427
- // media/locales/en.json
220428
- var en_default = {
220429
- about: "About Behavior3",
220430
- actuaSize: "Actual Size",
220431
- actualSize: "Actual Size",
220432
- add: "Add",
220433
- alertNewVersion: "This file is created by a newer version of Behavior3({{version}}), please upgrade to the latest version.",
220434
- batch: "Batch Script",
220435
- batchCompleted: "Batch completed",
220436
- batchFailed: "Batch failed, more information can be found in the console.",
220437
- build: "Build",
220438
- buildCompleted: "Build completed",
220439
- buildFailed: "Build failed, more information can be found in the console.",
220440
- cancel: "Cancel",
220441
- compact: "Compact",
220442
- console: "Console",
220443
- copy: "Copy",
220444
- createProject: "Create Project",
220445
- checkExpr: "Check expression",
220446
- cut: "Cut",
220447
- delete: "Delete",
220448
- deleteNode: "Delete Node",
220449
- devTools: "Toggle Developer Tools",
220450
- donotSave: "Don't Save",
220451
- duplicate: "Duplicate",
220452
- editSubtree: "Edit Subtree",
220453
- fieldRequired: "Field '{{field}}' is required",
220454
- forceReload: "Force Reload",
220455
- fullscreen: "Toggle Full Screen",
220456
- hide: "Hide Behavior3",
220457
- hideOthers: "Hide Others",
220458
- insertNode: "Insert Node",
220459
- jumpNode: "Jump Node",
220460
- language: "Language",
220461
- moveToTrash: "Move to Trash",
220462
- newFile: "New File...",
220463
- newFolder: "New Folder...",
220464
- newWindow: "New Window",
220465
- nodeDefinition: "NODES",
220466
- normal: "Normal",
220467
- open: "Open...",
220468
- openProject: "Open Project",
220469
- paste: "Paste",
220470
- quit: "Quit Behavior3",
220471
- recent: "Recent",
220472
- redo: "Redo",
220473
- reload: "Reload",
220474
- reset: "Reset",
220475
- "reset.confirm": "Reset to original value?",
220476
- "reset.defaultConfirm": "Reset to default value?",
220477
- rename: "Rename...",
220478
- replace: "Replace",
220479
- reportIssue: "Report Issue",
220480
- revealFileOnMac: "Reveal in Finder",
220481
- revealFileOnWindows: "Reveal in File Explorer",
220482
- save: "Save",
220483
- saveAll: "Save All",
220484
- saveAs: "Save As...",
220485
- saveAsSubtree: "Save As Subtree",
220486
- searchFile: "Search File",
220487
- searchNode: "Search Node",
220488
- selectAll: "Select All",
220489
- services: "Services",
220490
- setupBuildScript: "Setup Build Script",
220491
- start: "Start",
220492
- undo: "Undo",
220493
- unhide: "Show All",
220494
- zoomIn: "Zoom In",
220495
- zoomOut: "Zoom Out",
220496
- "menu.edit": "Edit",
220497
- "menu.file": "File",
220498
- "menu.view": "View",
220499
- "menu.window": "Window",
220500
- "menu.help": "Help",
220501
- "workspace.saveAllOnClose": "Do you want to save the changes to the following {{count}} files?",
220502
- "workspace.saveOnClose": "Do you want to save the changes you made to '{{name}}'?",
220503
- "workspace.reloadFile": "'{{name}}' has changed, do you want to reload now?",
220504
- "explorer.deleteFile": "Are you sure you want delete '{{name}}'?",
220505
- "explorer.deleteFolder": "Are you sure you want delete '{{name}}' and its contents?",
220506
- "explorer.replaceFile": "Are you sure you want replace '{{name}}'?",
220507
- "explorer.restoreFileInfo": "You can restore this file from the Trash.",
220508
- "explorer.title": "Explorer",
220509
- "tree.overview": "Overview",
220510
- "tree.name": "Tree name",
220511
- "tree.desc": "Tree desc",
220512
- "tree.export": "Export",
220513
- "tree.prefix": "ID prefix",
220514
- "tree.group": "Enable Node Grouping",
220515
- "tree.group.placeholder": "Select node groups",
220516
- "tree.vars": "Define Variables",
220517
- "tree.vars.local": "Local Variables",
220518
- "tree.vars.add": "Add Variable",
220519
- "tree.vars.name": "name",
220520
- "tree.vars.invalidName": "Invalid variable name",
220521
- "tree.vars.desc": "description",
220522
- "tree.vars.imports": "Import Variables",
220523
- "tree.vars.subtree": "Subtree Variables",
220524
- "tree.import.add": "Add Import",
220525
- "tree.custom": "Custom Data",
220526
- "tree.custom.add": "Add Entry",
220527
- "tree.custom.key": "key",
220528
- "tree.custom.value": "value",
220529
- "tree.custom.type.string": "String value",
220530
- "tree.custom.type.number": "Number value",
220531
- "tree.custom.type.boolean": "Boolean value",
220532
- "tree.custom.type.invalid": "Invalid custom value",
220533
- "regnode.input": "Input: ",
220534
- "regnode.output": "Output: ",
220535
- "regnode.args": "Args: ",
220536
- "regnode.mark": "Mark: ",
220537
- "regnode.subtree": "Subtree: ",
220538
- "node.args": "Const arguments",
220539
- "node.children.unlimited": "Unlimited",
220540
- "node.children": "Num children",
220541
- "node.debug": "Debug",
220542
- "node.deleteRootNodeDenied": "Unable to delete the root node",
220543
- "node.dropDenied": "This node position is denied to drop the node",
220544
- "node.desc": "Node desc",
220545
- "node.disabled": "Disabled",
220546
- "node.editSubtreeDenied": "Unable to edit the subtree node",
220547
- "node.editFailed": "Node '{{name}}' edit failed",
220548
- "node.group": "Node group",
220549
- "node.groupNotEnabled": "One of '{{group}}' node group is not enabled in current file",
220550
- "node.id": "Node id",
220551
- "node.inputVariable": "Input variables",
220552
- "node.invalidChildren": "Invalid number of children",
220553
- "node.invalidExpression": "Invalid expression",
220554
- "node.invalidValue": "Invalid value",
220555
- "node.invalidVariableName": "Invalid variable name, should start with a letter or underscore",
220556
- "node.name": "Node name",
220557
- "node.noNodeSelected": "No node selected",
220558
- "node.notFound": "Node '{{name}}' not found",
220559
- "node.oneof.error": "Only one is allowed between input '{{input}}' and argument '{{desc}}({{arg}})'",
220560
- "node.oneof.inputNotfound": "Input '{{input}}' not found",
220561
- "node.outputVariable": "Output variables",
220562
- "node.pasteDataError": "Paste data error",
220563
- "node.rootNodeAsSubtree": "Root node cann't be save as subtree",
220564
- "node.subtree": "Subtree",
220565
- "node.subtreeMissing": "Subtree file is missing: {{path}}",
220566
- "node.subtreeInvalid": "Subtree file is invalid: {{path}}",
220567
- "node.subtreeCyclic": "Subtree reference is cyclic: {{path}}",
220568
- "node.subtreeOpenFailed": "Failed to open subtree: file not found or unreadable ({{path}})",
220569
- "node.subtreePathError": "You should save the subtree inside the current workspace",
220570
- "node.subtreeSaveRootError": "Root node cann't be save as subtree",
220571
- "node.subtreeSaveSuccess": "Saved and converted to subtree node: {{path}}",
220572
- "node.moveSubtreeDenied": "Cannot move nodes inside a subtree",
220573
- "node.dropSubtreeInternalDenied": "Cannot drop onto a subtree internal node",
220574
- "node.moveRootDenied": "Cannot move the root node",
220575
- "node.dropAroundRootDenied": "Cannot place a node before or after the root",
220576
- "node.addChildToSubtreeRefDenied": "Cannot add child nodes to a subtree reference",
220577
- "node.moveIntoDescendantDenied": "Cannot move a node into its own descendant",
220578
- "node.type": "Node type",
220579
- "node.undefinedVariable": "Variable '{{variable}}' is not defined",
220580
- "node.jsonData": "JSON Data",
220581
- "node.unknown.title": "Unknown Node",
220582
- "node.unknownType": "Unknown",
220583
- "node.resolutionError": "Resolution Error",
220584
- "node.unknown.desc": "New node",
220585
- "build.success": "Build completed.",
220586
- "build.failed": "Build failed.",
220587
- "editor.loading": "Loading editor...",
220588
- "editor.externalChangeConflict": "External file change detected while the document has unsaved edits.",
220589
- "editor.reloadFromDisk": "Reload",
220590
- "editor.dismissConflict": "Dismiss",
220591
- "editor.newerVersionEditDenied": "This file is created by a newer version of Behavior3({{version}}). Please upgrade to the latest version.",
220592
- "inspector.noActiveDocument": "Open a Behavior3 editor to inspect and edit the active tree.",
220593
- "inspector.embeddedModeNotice": "Inspector is configured to appear inside the Behavior3 editor.",
220594
- "inspector.embeddedToolbar.build": "Build Behavior Tree",
220595
- "inspector.embeddedToolbar.toggleEditorMode": "Toggle Editor Mode",
220596
- "inspector.embeddedToolbar.toggleInspectorNodeJson": "Toggle Raw Node JSON",
220597
- "inspector.embeddedToolbar.createProject": "Create Project",
220598
- "inspector.embeddedToolbar.createTree": "Create Behavior Tree",
220599
- "mutation.invalidJsonPath": "Invalid JSON path: {{path}}",
220600
- "mutation.missingSelectedNode": "No selected node is available for this mutation.",
220601
- "mutation.selectedNodeMismatch": "The selected node changed before the mutation was applied.",
220602
- "mutation.missingTargetNode": "The target node could not be found.",
220603
- "mutation.missingSourceNode": "The source node could not be found.",
220604
- "mutation.missingSubtreeOriginal": "Missing subtree original snapshot for this mutation.",
220605
- "mutation.missingDetachedSubtreeRoot": "Missing detached subtree snapshot for this mutation.",
220606
- "mutation.moveRootDenied": "Cannot move the root node.",
220607
- "mutation.dropAroundRootDenied": "Cannot drop before or after the root node.",
220608
- "mutation.addChildToSubtreeRefDenied": "Cannot add a child directly to a subtree reference.",
220609
- "mutation.moveIntoDescendantDenied": "Cannot move a node into its own descendant.",
220610
- "mutation.deleteRootNodeDenied": "Cannot delete the root node.",
220611
- "mutation.editSubtreeDenied": "Cannot edit structure on a subtree reference.",
220612
- "mutation.saveSelectedAsSubtreeRootDenied": "The root node cannot be saved as a subtree.",
220613
- "mutation.saveSelectedAsSubtreeMissingTarget": "The target node could not be saved as a subtree.",
220614
- "mutation.saveSelectedAsSubtreePostSaveMissingTarget": "The target node could not be found after saving the subtree.",
220615
- "runtime.nodeCheckRuntimeHasErrors": "Checker runtime has errors.",
220616
- "runtime.invalidSavedSubtreePath": "Host returned an invalid saved subtree path.",
220617
- "runtime.unsupportedDocumentMutation": "Unsupported document mutation.",
220618
- "override.resetTitle": "Reset this override?",
220619
- "form.enterJsonArray": "Enter JSON array",
220620
- "form.enterJsonValue": "Enter JSON value",
220621
- "form.unset": "Unset",
220622
- "form.true": "True",
220623
- "form.false": "False",
220624
- "validation.jsonArray": "{{name}} must be a JSON array",
220625
- "validation.integer": "{{field}} must be an integer",
220626
- "validation.number": "{{field}} must be a number",
220627
- "validation.missingOneofInput": "Missing input slot for oneof '{{input}}'",
220628
- "validation.oneof": "Only one of '{{left}}' and '{{right}}' can be set",
220629
- "validation.invalidJsonPath": "Path must be a workdir-relative .json file: {{path}}",
220630
- "validation.variableDescriptionRequired": "Variable description is required",
220631
- "validation.customKeyRequired": "Custom key is required",
220632
- "validation.customKeyDuplicate": "Custom key '{{key}}' is duplicated",
220633
- "validation.customValueInvalid": "Custom value must be a string, number, or boolean"
220634
- };
220635
-
220636
- // media/locales/zh.json
220637
- var zh_default = {
220638
- about: "\u5173\u4E8E Behavior3",
220639
- actualSize: "\u5B9E\u9645\u5927\u5C0F",
220640
- add: "\u6DFB\u52A0",
220641
- alertNewVersion: "\u6B64\u6587\u4EF6\u7531\u65B0\u7248\u672C Behavior3({{version}}) \u521B\u5EFA\uFF0C\u8BF7\u5347\u7EA7\u5230\u6700\u65B0\u7248\u672C\u3002",
220642
- batch: "\u6279\u5904\u7406\u811A\u672C",
220643
- batchCompleted: "\u6279\u5904\u7406\u5B8C\u6210",
220644
- batchFailed: "\u6279\u5904\u7406\u51FA\u73B0\u9519\u8BEF\uFF0C\u8BE6\u60C5\u8BF7\u67E5\u770B\u63A7\u5236\u53F0\uFF01",
220645
- build: "\u6784\u5EFA",
220646
- buildCompleted: "\u6784\u5EFA\u5B8C\u6210",
220647
- buildFailed: "\u6784\u5EFA\u51FA\u73B0\u9519\u8BEF\uFF0C\u8BE6\u60C5\u8BF7\u67E5\u770B\u63A7\u5236\u53F0\uFF01",
220648
- cancel: "\u53D6\u6D88",
220649
- compact: "\u7D27\u51D1",
220650
- console: "\u63A7\u5236\u53F0",
220651
- checkExpr: "\u68C0\u67E5\u8868\u8FBE\u5F0F",
220652
- copy: "\u590D\u5236",
220653
- createProject: "\u65B0\u5EFA\u9879\u76EE",
220654
- cut: "\u526A\u5207",
220655
- delete: "\u5220\u9664",
220656
- deleteNode: "\u5220\u9664\u8282\u70B9",
220657
- devTools: "\u5207\u6362\u5F00\u53D1\u8005\u5DE5\u5177",
220658
- donotSave: "\u4E0D\u4FDD\u5B58",
220659
- duplicate: "\u751F\u6210\u526F\u672C",
220660
- editSubtree: "\u7F16\u8F91\u5B50\u6811",
220661
- fieldRequired: "\u5B57\u6BB5\u201C{{field}}\u201D\u5FC5\u586B",
220662
- forceReload: "\u5F3A\u5236\u91CD\u65B0\u52A0\u8F7D",
220663
- fullscreen: "\u5207\u6362\u5168\u5C4F",
220664
- hide: "\u9690\u85CF Behavior3",
220665
- hideOthers: "\u9690\u85CF\u5176\u5B83",
220666
- insertNode: "\u63D2\u5165\u8282\u70B9",
220667
- jumpNode: "\u8DF3\u8F6C\u8282\u70B9",
220668
- language: "\u8BED\u8A00",
220669
- moveToTrash: "\u79FB\u81F3\u56DE\u6536\u7AD9",
220670
- newFile: "\u65B0\u5EFA\u884C\u4E3A\u6811...",
220671
- newFolder: "\u65B0\u5EFA\u76EE\u5F55...",
220672
- newWindow: "\u65B0\u5EFA\u7A97\u53E3",
220673
- nodeDefinition: "\u8282\u70B9\u5B9A\u4E49",
220674
- normal: "\u6B63\u5E38",
220675
- open: "\u6253\u5F00...",
220676
- openProject: "\u6253\u5F00\u9879\u76EE",
220677
- paste: "\u7C98\u8D34",
220678
- quit: "\u9000\u51FA Behavior3",
220679
- recent: "\u6700\u8FD1\u6253\u5F00",
220680
- redo: "\u91CD\u505A",
220681
- reload: "\u91CD\u65B0\u52A0\u8F7D",
220682
- reset: "\u91CD\u7F6E",
220683
- "reset.confirm": "\u91CD\u7F6E\u4E3A\u539F\u59CB\u503C\uFF1F",
220684
- "reset.defaultConfirm": "\u91CD\u7F6E\u4E3A\u9ED8\u8BA4\u503C\uFF1F",
220685
- rename: "\u91CD\u547D\u540D...",
220686
- replace: "\u66FF\u6362",
220687
- reportIssue: "\u95EE\u9898\u53CD\u9988",
220688
- revealFileOnMac: "\u5728 Finder \u4E2D\u663E\u793A",
220689
- revealFileOnWindows: "\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u6253\u5F00",
220690
- save: "\u4FDD\u5B58",
220691
- saveAll: "\u4FDD\u5B58\u5168\u90E8",
220692
- saveAs: "\u53E6\u5B58\u4E3A...",
220693
- saveAsSubtree: "\u53E6\u5B58\u4E3A\u5B50\u6811",
220694
- searchFile: "\u641C\u7D22\u6587\u4EF6",
220695
- searchNode: "\u641C\u7D22\u8282\u70B9",
220696
- selectAll: "\u5168\u9009",
220697
- services: "\u670D\u52A1",
220698
- setupBuildScript: "\u8BBE\u7F6E\u6784\u5EFA\u811A\u672C",
220699
- start: "\u5F00\u59CB",
220700
- undo: "\u64A4\u9500",
220701
- unhide: "\u663E\u793A\u6240\u6709",
220702
- zoomIn: "\u653E\u5927",
220703
- zoomOut: "\u7F29\u5C0F",
220704
- "menu.file": "\u6587\u4EF6",
220705
- "menu.edit": "\u7F16\u8F91",
220706
- "menu.view": "\u89C6\u56FE",
220707
- "menu.window": "\u7A97\u53E3",
220708
- "menu.help": "\u5E2E\u52A9",
220709
- "workspace.saveAllOnClose": "\u4F60\u9700\u8981\u4FDD\u5B58\u5BF9\u4EE5\u4E0B {{count}} \u4E2A\u6587\u4EF6\u7684\u4FEE\u6539\u5417\uFF1F",
220710
- "workspace.saveOnClose": "\u4F60\u9700\u8981\u4FDD\u5B58\u5BF9\u6587\u4EF6 {{name}} \u7684\u4FEE\u6539\u5417\uFF1F",
220711
- "workspace.reloadFile": "\u6587\u4EF6 {{name}} \u53D1\u751F\u6539\u53D8\uFF0C\u4F60\u9700\u8981\u91CD\u65B0\u52A0\u8F7D\u5417\uFF1F",
220712
- "explorer.deleteFile": "\u4F60\u786E\u5B9A\u8981\u5220\u9664\u6587\u4EF6 '{{name}}'\uFF1F",
220713
- "explorer.deleteFolder": "\u4F60\u786E\u5B9A\u8981\u5220\u9664\u76EE\u5F55 '{{name}}'\uFF1F",
220714
- "explorer.replaceFile": "\u4F60\u786E\u5B9A\u8981\u66FF\u6362\u6587\u4EF6 '{{name}}'\uFF1F",
220715
- "explorer.restoreFileInfo": "\u4F60\u53EF\u4EE5\u4ECE\u56DE\u6536\u7AD9\u6062\u590D\u6B64\u6587\u4EF6\u3002",
220716
- "explorer.title": "\u8D44\u6E90\u6D4F\u89C8",
220717
- "tree.overview": "\u6982\u51B5",
220718
- "tree.name": "\u884C\u4E3A\u6811",
220719
- "tree.desc": "\u8BF4\u660E",
220720
- "tree.export": "\u5BFC\u51FA",
220721
- "tree.prefix": "\u6807\u8BC6\u524D\u7F00",
220722
- "tree.group": "\u542F\u7528\u8282\u70B9\u5206\u7EC4",
220723
- "tree.group.placeholder": "\u9009\u62E9\u8282\u70B9\u5206\u7EC4",
220724
- "tree.vars": "\u5B9A\u4E49\u53D8\u91CF",
220725
- "tree.vars.local": "\u672C\u5730\u53D8\u91CF",
220726
- "tree.vars.add": "\u6DFB\u52A0\u53D8\u91CF",
220727
- "tree.vars.name": "\u53D8\u91CF\u540D",
220728
- "tree.vars.invalidName": "\u53D8\u91CF\u540D\u4E0D\u5408\u6CD5",
220729
- "tree.vars.desc": "\u53D8\u91CF\u8BF4\u660E",
220730
- "tree.vars.imports": "\u5BFC\u5165\u53D8\u91CF",
220731
- "tree.vars.subtree": "\u5B50\u6811\u53D8\u91CF",
220732
- "tree.import.add": "\u6DFB\u52A0\u5BFC\u5165",
220733
- "tree.custom": "\u81EA\u5B9A\u4E49\u6570\u636E",
220734
- "tree.custom.add": "\u6DFB\u52A0\u6761\u76EE",
220735
- "tree.custom.key": "\u952E",
220736
- "tree.custom.value": "\u503C",
220737
- "tree.custom.type.string": "\u5B57\u7B26\u4E32\u503C",
220738
- "tree.custom.type.number": "\u6570\u5B57\u503C",
220739
- "tree.custom.type.boolean": "\u5E03\u5C14\u503C",
220740
- "tree.custom.type.invalid": "\u975E\u6CD5\u7684\u81EA\u5B9A\u4E49\u503C",
220741
- "regnode.input": "\u8F93\u5165\uFF1A",
220742
- "regnode.output": "\u8F93\u51FA\uFF1A",
220743
- "regnode.args": "\u53C2\u6570\uFF1A",
220744
- "regnode.mark": "\u5907\u6CE8\uFF1A",
220745
- "regnode.subtree": "\u5B50\u6811\uFF1A",
220746
- "node.args": "\u5E38\u91CF\u53C2\u6570",
220747
- "node.children.unlimited": "\u65E0\u9650\u5236",
220748
- "node.children": "\u5B50\u8282\u70B9\u6570\u91CF",
220749
- "node.debug": "\u8C03\u8BD5",
220750
- "node.deleteRootNodeDenied": "\u4E0D\u80FD\u5220\u9664\u6839\u8282\u70B9",
220751
- "node.dropDenied": "\u6B64\u8282\u70B9\u4F4D\u7F6E\u4E0D\u5141\u8BB8\u653E\u7F6E\u62D6\u62FD\u7684\u8282\u70B9",
220752
- "node.desc": "\u8282\u70B9\u8BF4\u660E",
220753
- "node.disabled": "\u7981\u7528",
220754
- "node.editSubtreeDenied": "\u4E0D\u80FD\u7F16\u8F91\u5B50\u6811\u8282\u70B9",
220755
- "node.editFailed": "\u8282\u70B9 {{name}} \u7F16\u8F91\u5931\u8D25",
220756
- "node.group": "\u8282\u70B9\u5206\u7EC4",
220757
- "node.groupNotEnabled": "\u8282\u70B9\u5206\u7EC4 \u201C{{group}}\u201D \u4EFB\u610F\u4E00\u4E2A\u672A\u5728\u5F53\u524D\u6587\u4EF6\u4E2D\u542F\u7528",
220758
- "node.id": "\u8282\u70B9\u6807\u8BC6",
220759
- "node.inputVariable": "\u8F93\u5165\u53D8\u91CF",
220760
- "node.invalidChildren": "\u5B50\u8282\u70B9\u6570\u91CF\u4E0D\u5408\u6CD5",
220761
- "node.invalidExpression": "\u8868\u8FBE\u5F0F\u4E0D\u5408\u6CD5",
220762
- "node.invalidValue": "\u65E0\u6548\u7684\u503C",
220763
- "node.invalidVariableName": "\u53D8\u91CF\u540D\u5FC5\u987B\u4EE5\u5B57\u6BCD\u6216\u4E0B\u5212\u7EBF\u5F00\u5934",
220764
- "node.name": "\u8282\u70B9\u540D\u79F0",
220765
- "node.noNodeSelected": "\u672A\u9009\u62E9\u4EFB\u52A1\u8282\u70B9",
220766
- "node.notFound": "\u8282\u70B9 \u201C{{name}}\u201D \u4E0D\u5B58\u5728",
220767
- "node.oneof.error": "\u8F93\u5165\u9879 \u201C{{input}}\u201D \u548C\u53C2\u6570 \u201C{{desc}}({{arg}})\u201D \u4E4B\u4E2D\uFF0C\u53EA\u80FD\u9009\u62E9\u8BBE\u7F6E\u5176\u4E2D\u4E4B\u4E00",
220768
- "node.oneof.inputNotfound": "\u8F93\u5165\u9879\u201C{{input}}\u201D\u4E0D\u5B58\u5728",
220769
- "node.outputVariable": "\u8F93\u51FA\u53D8\u91CF",
220770
- "node.pasteDataError": "\u7C98\u8D34\u6570\u636E\u51FA\u9519",
220771
- "node.rootNodeAsSubtree": "\u6839\u8282\u70B9\u4E0D\u80FD\u4FDD\u5B58\u4E3A\u5B50\u6811",
220772
- "node.subtree": "\u5B50\u6811",
220773
- "node.subtreeMissing": "\u5B50\u6811\u6587\u4EF6\u7F3A\u5931\uFF1A{{path}}",
220774
- "node.subtreeInvalid": "\u5B50\u6811\u6587\u4EF6\u65E0\u6548\uFF1A{{path}}",
220775
- "node.subtreeCyclic": "\u5B50\u6811\u5F15\u7528\u51FA\u73B0\u5FAA\u73AF\uFF1A{{path}}",
220776
- "node.subtreeOpenFailed": "\u6253\u5F00\u5B50\u6811\u5931\u8D25\uFF1A\u6587\u4EF6\u4E0D\u5B58\u5728\u6216\u4E0D\u53EF\u8BFB\uFF08{{path}}\uFF09",
220777
- "node.subtreePathError": "\u5B50\u6811\u5FC5\u987B\u4FDD\u5B58\u5728\u5F53\u524D\u5DE5\u4F5C\u533A\u7684\u76EE\u5F55\u5185",
220778
- "node.subtreeSaveRootError": "\u6839\u8282\u70B9\u4E0D\u80FD\u4FDD\u5B58\u4E3A\u5B50\u6811",
220779
- "node.subtreeSaveSuccess": "\u5DF2\u4FDD\u5B58\u5E76\u8F6C\u6362\u4E3A\u5B50\u6811\u8282\u70B9\uFF1A{{path}}",
220780
- "node.moveSubtreeDenied": "\u4E0D\u80FD\u79FB\u52A8\u5B50\u6811\u5185\u90E8\u8282\u70B9",
220781
- "node.dropSubtreeInternalDenied": "\u4E0D\u80FD\u62D6\u653E\u5230\u5B50\u6811\u5185\u90E8\u8282\u70B9",
220782
- "node.moveRootDenied": "\u4E0D\u80FD\u79FB\u52A8\u6839\u8282\u70B9",
220783
- "node.dropAroundRootDenied": "\u4E0D\u80FD\u5C06\u8282\u70B9\u653E\u5230\u6839\u8282\u70B9\u4E4B\u524D\u6216\u4E4B\u540E",
220784
- "node.addChildToSubtreeRefDenied": "\u4E0D\u80FD\u5411\u5B50\u6811\u5F15\u7528\u6DFB\u52A0\u5B50\u8282\u70B9",
220785
- "node.moveIntoDescendantDenied": "\u4E0D\u80FD\u5C06\u8282\u70B9\u79FB\u52A8\u5230\u81EA\u5DF1\u7684\u540E\u4EE3\u8282\u70B9\u4E2D",
220786
- "node.type": "\u8282\u70B9\u7C7B\u578B",
220787
- "node.undefinedVariable": "\u53D8\u91CF \u201C{{variable}}\u201D \u672A\u5B9A\u4E49",
220788
- "node.jsonData": "JSON \u6570\u636E",
220789
- "node.unknown.title": "\u672A\u77E5\u8282\u70B9",
220790
- "node.unknownType": "\u672A\u77E5",
220791
- "node.resolutionError": "\u89E3\u6790\u9519\u8BEF",
220792
- "node.unknown.desc": "\u65B0\u5EFA\u8282\u70B9",
220793
- "build.success": "\u6784\u5EFA\u5B8C\u6210\u3002",
220794
- "build.failed": "\u6784\u5EFA\u5931\u8D25\u3002",
220795
- "editor.loading": "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668...",
220796
- "editor.externalChangeConflict": "\u68C0\u6D4B\u5230\u5916\u90E8\u6587\u4EF6\u53D8\u66F4\uFF0C\u5F53\u524D\u6587\u6863\u8FD8\u6709\u672A\u4FDD\u5B58\u4FEE\u6539\u3002",
220797
- "editor.reloadFromDisk": "\u91CD\u65B0\u8F7D\u5165",
220798
- "editor.dismissConflict": "\u5FFD\u7565",
220799
- "editor.newerVersionEditDenied": "\u6B64\u6587\u4EF6\u7531\u65B0\u7248\u672C Behavior3({{version}}) \u521B\u5EFA\uFF0C\u8BF7\u5347\u7EA7\u5230\u6700\u65B0\u7248\u672C\u540E\u518D\u7F16\u8F91\u3002",
220800
- "inspector.noActiveDocument": "\u6253\u5F00\u4E00\u4E2A Behavior3 \u7F16\u8F91\u5668\u540E\uFF0C\u8FD9\u91CC\u4F1A\u663E\u793A\u5F53\u524D\u884C\u4E3A\u6811\u7684 Inspector\uFF0C\u5E76\u652F\u6301\u76F4\u63A5\u7F16\u8F91\u3002",
220801
- "inspector.embeddedModeNotice": "Inspector \u5F53\u524D\u914D\u7F6E\u4E3A\u5728 Behavior3 \u7F16\u8F91\u5668\u5185\u90E8\u663E\u793A\u3002",
220802
- "inspector.embeddedToolbar.build": "\u6784\u5EFA\u884C\u4E3A\u6811",
220803
- "inspector.embeddedToolbar.toggleEditorMode": "\u5207\u6362\u7F16\u8F91\u5668\u6A21\u5F0F",
220804
- "inspector.embeddedToolbar.toggleInspectorNodeJson": "\u5207\u6362\u539F\u59CB\u8282\u70B9 JSON",
220805
- "inspector.embeddedToolbar.createProject": "\u65B0\u5EFA\u9879\u76EE",
220806
- "inspector.embeddedToolbar.createTree": "\u65B0\u5EFA\u884C\u4E3A\u6811",
220807
- "mutation.invalidJsonPath": "\u65E0\u6548\u7684 JSON \u8DEF\u5F84: {{path}}",
220808
- "mutation.missingSelectedNode": "\u5F53\u524D\u6CA1\u6709\u53EF\u7528\u4E8E\u63D0\u4EA4\u6B64\u4FEE\u6539\u7684\u9009\u4E2D\u8282\u70B9\u3002",
220809
- "mutation.selectedNodeMismatch": "\u5F53\u524D\u9009\u4E2D\u8282\u70B9\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u8BD5\u3002",
220810
- "mutation.missingTargetNode": "\u672A\u627E\u5230\u76EE\u6807\u8282\u70B9\uFF0C\u8BF7\u91CD\u8BD5\u3002",
220811
- "mutation.missingSourceNode": "\u672A\u627E\u5230\u6E90\u8282\u70B9\uFF0C\u8BF7\u91CD\u8BD5\u3002",
220812
- "mutation.missingSubtreeOriginal": "\u7F3A\u5C11 subtree \u539F\u59CB\u8282\u70B9\u5FEB\u7167\uFF0C\u8BF7\u91CD\u8BD5\u3002",
220813
- "mutation.missingDetachedSubtreeRoot": "\u7F3A\u5C11\u7528\u4E8E\u89E3\u7ED1 subtree \u5F15\u7528\u7684\u5FEB\u7167\uFF0C\u8BF7\u91CD\u8BD5\u3002",
220814
- "mutation.moveRootDenied": "\u4E0D\u80FD\u79FB\u52A8\u6839\u8282\u70B9\u3002",
220815
- "mutation.dropAroundRootDenied": "\u4E0D\u80FD\u56F4\u7ED5\u6839\u8282\u70B9\u63D2\u5165\u3002",
220816
- "mutation.addChildToSubtreeRefDenied": "\u4E0D\u80FD\u76F4\u63A5\u5411 subtree \u5F15\u7528\u6DFB\u52A0\u5B50\u8282\u70B9\u3002",
220817
- "mutation.moveIntoDescendantDenied": "\u4E0D\u80FD\u79FB\u52A8\u5230\u81EA\u5DF1\u7684\u540E\u4EE3\u4E0B\u3002",
220818
- "mutation.deleteRootNodeDenied": "\u4E0D\u80FD\u5220\u9664\u6839\u8282\u70B9\u3002",
220819
- "mutation.editSubtreeDenied": "\u4E0D\u80FD\u5728 subtree \u5F15\u7528\u4E0A\u76F4\u63A5\u4FEE\u6539\u7ED3\u6784\u3002",
220820
- "mutation.saveSelectedAsSubtreeRootDenied": "\u6839\u8282\u70B9\u4E0D\u80FD\u53E6\u5B58\u4E3A subtree\u3002",
220821
- "mutation.saveSelectedAsSubtreeMissingTarget": "\u672A\u627E\u5230\u53EF\u53E6\u5B58\u4E3A subtree \u7684\u76EE\u6807\u8282\u70B9\u3002",
220822
- "mutation.saveSelectedAsSubtreePostSaveMissingTarget": "\u63D0\u4EA4 subtree \u4FDD\u5B58\u7ED3\u679C\u65F6\u672A\u627E\u5230\u76EE\u6807\u8282\u70B9\u3002",
220823
- "runtime.nodeCheckRuntimeHasErrors": "checker \u8FD0\u884C\u65F6\u5B58\u5728\u9519\u8BEF\u3002",
220824
- "runtime.invalidSavedSubtreePath": "\u5BBF\u4E3B\u8FD4\u56DE\u4E86\u65E0\u6548\u7684 subtree \u4FDD\u5B58\u8DEF\u5F84\u3002",
220825
- "runtime.unsupportedDocumentMutation": "\u4E0D\u652F\u6301\u6B64\u6587\u6863\u4FEE\u6539\u3002",
220826
- "override.resetTitle": "\u91CD\u7F6E\u6B64\u8986\u76D6\uFF1F",
220827
- "form.enterJsonArray": "\u8F93\u5165 JSON \u6570\u7EC4",
220828
- "form.enterJsonValue": "\u8F93\u5165 JSON \u503C",
220829
- "form.unset": "\u672A\u8BBE\u7F6E",
220830
- "form.true": "\u662F",
220831
- "form.false": "\u5426",
220832
- "validation.jsonArray": "{{name}} \u5FC5\u987B\u662F JSON \u6570\u7EC4",
220833
- "validation.integer": "{{field}} \u5FC5\u987B\u662F\u6574\u6570",
220834
- "validation.number": "{{field}} \u5FC5\u987B\u662F\u6570\u5B57",
220835
- "validation.missingOneofInput": "\u7F3A\u5C11 oneof \u8F93\u5165\u9879 \u201C{{input}}\u201D",
220836
- "validation.oneof": "\u201C{{left}}\u201D \u548C \u201C{{right}}\u201D \u53EA\u80FD\u8BBE\u7F6E\u5176\u4E2D\u4E4B\u4E00",
220837
- "validation.invalidJsonPath": "\u8DEF\u5F84\u5FC5\u987B\u662F\u5DE5\u4F5C\u76EE\u5F55\u5185\u7684\u76F8\u5BF9 .json \u6587\u4EF6\uFF1A{{path}}",
220838
- "validation.variableDescriptionRequired": "\u53D8\u91CF\u8BF4\u660E\u5FC5\u586B",
220839
- "validation.customKeyRequired": "\u81EA\u5B9A\u4E49 key \u5FC5\u586B",
220840
- "validation.customKeyDuplicate": "\u81EA\u5B9A\u4E49 key \u201C{{key}}\u201D \u91CD\u590D\u4E86",
220841
- "validation.customValueInvalid": "\u81EA\u5B9A\u4E49\u503C\u5FC5\u987B\u662F\u5B57\u7B26\u4E32\u3001\u6570\u5B57\u6216\u5E03\u5C14\u503C"
220735
+ if (relativePath.startsWith("..") || path7.isAbsolute(relativePath)) {
220736
+ return void 0;
220737
+ }
220738
+ return parseWorkdirRelativeJsonPath(relativePath) ?? void 0;
220739
+ }
220740
+ async readWorkspaceFileContent(fileUri) {
220741
+ const openDocument = vscode8.workspace.textDocuments.find(
220742
+ (document) => isSameUri(document.uri, fileUri)
220743
+ );
220744
+ if (openDocument) {
220745
+ return openDocument.getText();
220746
+ }
220747
+ const raw = await vscode8.workspace.fs.readFile(fileUri);
220748
+ return Buffer.from(raw).toString("utf-8");
220749
+ }
220750
+ async readTreeFile(relativePath) {
220751
+ const normalizedPath = parseWorkdirRelativeJsonPath(relativePath);
220752
+ if (!normalizedPath) {
220753
+ return null;
220754
+ }
220755
+ const fileUri = vscode8.Uri.joinPath(this.workdir, normalizedPath);
220756
+ const content = await this.readWorkspaceFileContent(fileUri).catch(() => null);
220757
+ if (content === null) {
220758
+ this.treeCache.set(normalizedPath, {
220759
+ content: "",
220760
+ tree: null
220761
+ });
220762
+ return null;
220763
+ }
220764
+ const cached = this.treeCache.get(normalizedPath);
220765
+ if (cached && cached.content === content) {
220766
+ return cached.tree;
220767
+ }
220768
+ try {
220769
+ const tree = parsePersistedTreeContent(content, normalizedPath);
220770
+ this.treeCache.set(normalizedPath, {
220771
+ content,
220772
+ tree
220773
+ });
220774
+ return tree;
220775
+ } catch {
220776
+ this.treeCache.set(normalizedPath, {
220777
+ content,
220778
+ tree: null
220779
+ });
220780
+ return null;
220781
+ }
220782
+ }
220783
+ getLocalVarsFromTree(relativePath) {
220784
+ const normalizedPath = parseWorkdirRelativeJsonPath(relativePath);
220785
+ if (!normalizedPath) {
220786
+ return [];
220787
+ }
220788
+ const tree = this.treeCache.get(normalizedPath)?.tree;
220789
+ if (!tree) {
220790
+ return [];
220791
+ }
220792
+ return tree.variables.locals.filter((entry) => entry.name).map((entry) => ({ name: entry.name, desc: entry.desc ?? "" }));
220793
+ }
220794
+ async readVarsFromFile(relativePath, visitedForGlobal, globalVars) {
220795
+ const localVars = [];
220796
+ const parsedPath = parseWorkdirRelativeJsonPath(relativePath);
220797
+ if (!parsedPath) {
220798
+ return localVars;
220799
+ }
220800
+ const normalizedPath = parsedPath;
220801
+ if (visitedForGlobal.has(normalizedPath)) {
220802
+ return localVars;
220803
+ }
220804
+ visitedForGlobal.add(normalizedPath);
220805
+ const tree = await this.readTreeFile(normalizedPath);
220806
+ if (!tree) {
220807
+ return localVars;
220808
+ }
220809
+ for (const entry of tree.variables.locals) {
220810
+ if (!entry.name) {
220811
+ continue;
220812
+ }
220813
+ const variable = { name: entry.name, desc: entry.desc ?? "" };
220814
+ localVars.push(variable);
220815
+ if (!globalVars[entry.name]) {
220816
+ globalVars[entry.name] = variable;
220817
+ }
220818
+ }
220819
+ for (const importPath of tree.variables.imports) {
220820
+ await this.readVarsFromFile(importPath, visitedForGlobal, globalVars);
220821
+ }
220822
+ for (const subtreePath of collectSubtreePaths2(tree.root)) {
220823
+ await this.readVarsFromFile(subtreePath, visitedForGlobal, globalVars);
220824
+ }
220825
+ return localVars;
220826
+ }
220827
+ async collectOrderedTransitiveImportPaths(seedImports) {
220828
+ return collectTransitivePaths(normalizePathList(seedImports), async (relativePath) => {
220829
+ const tree = await this.readTreeFile(relativePath);
220830
+ return normalizePathList(tree?.variables.imports ?? []);
220831
+ });
220832
+ }
220833
+ async collectOrderedTransitiveSubtreePaths(root) {
220834
+ return collectTransitivePaths(
220835
+ normalizePathList(collectSubtreePaths2(root)),
220836
+ async (relativePath) => {
220837
+ const tree = await this.readTreeFile(relativePath);
220838
+ return tree?.root ? normalizePathList(collectSubtreePaths2(tree.root)) : [];
220839
+ }
220840
+ );
220841
+ }
220842
220842
  };
220843
220843
 
220844
- // webview/shared/runtime-i18n.ts
220845
- var runtimeTranslations = {
220846
- en: en_default,
220847
- zh: zh_default
220848
- };
220849
- var INTERPOLATION_PATTERN = /\{\{\s*([^{}\s]+)\s*\}\}/g;
220850
- var interpolateRuntimeMessage = (template, params) => {
220851
- if (!params) {
220852
- return template;
220844
+ // src/editor-session/settings/live-settings.ts
220845
+ var vscode10 = __toESM(require("vscode"));
220846
+
220847
+ // src/editor-session/settings/editor-settings.ts
220848
+ var vscode9 = __toESM(require("vscode"));
220849
+ function getEditorLanguage(setting) {
220850
+ if (setting === "zh" || setting === "en") {
220851
+ return setting;
220852
+ }
220853
+ const envLanguage = vscode9.env.language.toLowerCase();
220854
+ return envLanguage.startsWith("zh") ? "zh" : "en";
220855
+ }
220856
+ function getVSCodeTheme() {
220857
+ const kind = vscode9.window.activeColorTheme.kind;
220858
+ return kind === vscode9.ColorThemeKind.Light || kind === vscode9.ColorThemeKind.HighContrastLight ? "light" : "dark";
220859
+ }
220860
+
220861
+ // src/editor-session/settings/live-settings.ts
220862
+ function createLiveSettingsResolver(workspaceFolderUri, documentUri) {
220863
+ return async () => {
220864
+ const config = vscode10.workspace.getConfiguration("behavior3");
220865
+ const workspaceSettings = await resolveWorkspaceFileSettings(
220866
+ workspaceFolderUri,
220867
+ documentUri
220868
+ );
220869
+ return {
220870
+ allowNewFunction: workspaceSettings?.allowNewFunction ?? false,
220871
+ checkExpr: config.get("checkExpr", true),
220872
+ subtreeEditable: config.get("subtreeEditable", true),
220873
+ language: getEditorLanguage(config.get("language", "auto")),
220874
+ inspectorMode: config.get("inspectorMode", "sidebar"),
220875
+ nodeColors: workspaceSettings?.nodeColors
220876
+ };
220877
+ };
220878
+ }
220879
+
220880
+ // src/editor-session/session/context.ts
220881
+ async function createTreeEditorSessionContext(params) {
220882
+ const workspaceFolderUri = getWorkdir(params.document.uri);
220883
+ const projectRootUri = vscode11.Uri.file(
220884
+ getBehaviorProjectRootFsPath(params.document.uri, workspaceFolderUri)
220885
+ );
220886
+ const projectIndex = new ProjectIndex(projectRootUri);
220887
+ const resolveLiveSettings = createLiveSettingsResolver(
220888
+ workspaceFolderUri,
220889
+ params.document.uri
220890
+ );
220891
+ const [nodeDefs, settingDir, currentSettings] = await Promise.all([
220892
+ resolveNodeDefs(workspaceFolderUri, params.document.uri),
220893
+ getResolvedB3SettingDir(workspaceFolderUri, params.document.uri),
220894
+ resolveLiveSettings()
220895
+ ]);
220896
+ const state = {
220897
+ nodeDefs,
220898
+ settingDir,
220899
+ currentSettings,
220900
+ fileVersionIsNewer: false,
220901
+ newerFileVersion: null,
220902
+ cachedSubtreeRefs: null,
220903
+ latestAllFiles: [],
220904
+ latestVarDecls: {
220905
+ usingVars: {},
220906
+ importDecls: [],
220907
+ subtreeDecls: []
220908
+ },
220909
+ sharedSelection: normalizeHostSelectionState(params.initialSelection),
220910
+ selectionRevision: 0,
220911
+ inspectorContentSyncKind: "reload"
220912
+ };
220913
+ const documentSession = params.document.sessionState;
220914
+ const buildDocumentSessionMessage = () => documentSession.getSnapshot();
220915
+ params.configureWebview(params.webviewPanel.webview, workspaceFolderUri);
220916
+ const postMessage = (message) => params.webviewPanel.webview.postMessage(message);
220917
+ const mapDefsForWebview = (defs = state.nodeDefs) => mapNodeDefsIconsForWebview(
220918
+ params.webviewPanel.webview,
220919
+ workspaceFolderUri,
220920
+ state.settingDir,
220921
+ defs
220922
+ );
220923
+ return {
220924
+ ...params,
220925
+ workspaceFolderUri,
220926
+ projectRootUri,
220927
+ projectIndex,
220928
+ state,
220929
+ documentSession,
220930
+ resolveLiveSettings,
220931
+ postMessage,
220932
+ mapDefsForWebview,
220933
+ buildDocumentSessionMessage,
220934
+ enqueueMainDocumentOperation: createSerialOperationQueue()
220935
+ };
220936
+ }
220937
+
220938
+ // src/editor-session/session/document-lifecycle.ts
220939
+ var vscode12 = __toESM(require("vscode"));
220940
+ function createSessionDocumentLifecycle(context, inspectorSync, subtreeTracking, fileVersionGuard) {
220941
+ const {
220942
+ document,
220943
+ revertDocument,
220944
+ onDidChangeDocument,
220945
+ state,
220946
+ documentSession,
220947
+ postMessage,
220948
+ buildDocumentSessionMessage,
220949
+ enqueueMainDocumentOperation
220950
+ } = context;
220951
+ const { fanoutDocumentSnapshot } = inspectorSync;
220952
+ const { invalidateSubtreeRefs, refreshTrackedSubtreeRefs } = subtreeTracking;
220953
+ const { updateFileVersionState, blockEditingForNewerFile } = fileVersionGuard;
220954
+ const applySessionHistorySnapshot = async (snapshot) => {
220955
+ const sessionSnapshot = buildDocumentSessionMessage();
220956
+ const changed = document.syncContentState(snapshot, sessionSnapshot.dirty);
220957
+ if (!changed) {
220958
+ return false;
220959
+ }
220960
+ state.inspectorContentSyncKind = "update";
220961
+ invalidateSubtreeRefs();
220962
+ void refreshTrackedSubtreeRefs();
220963
+ updateFileVersionState(snapshot);
220964
+ onDidChangeDocument(document);
220965
+ await fanoutDocumentSnapshot({
220966
+ syncKind: "update"
220967
+ });
220968
+ return true;
220969
+ };
220970
+ const handleSaveDocumentMessage = async (msg, reply = postMessage) => {
220971
+ await enqueueMainDocumentOperation(async () => {
220972
+ const editBlockedMessage = blockEditingForNewerFile();
220973
+ if (editBlockedMessage) {
220974
+ await reply({
220975
+ type: "saveDocumentResult",
220976
+ requestId: msg.requestId,
220977
+ success: false,
220978
+ error: editBlockedMessage
220979
+ });
220980
+ return;
220981
+ }
220982
+ try {
220983
+ if (document.isDirty) {
220984
+ await vscode12.workspace.save(document.uri);
220985
+ }
220986
+ const success = !document.isDirty;
220987
+ if (!success) {
220988
+ getBehavior3OutputChannel().warn(
220989
+ `[saveDocument] save failed for ${document.uri.fsPath}; isDirty=${document.isDirty}`
220990
+ );
220991
+ }
220992
+ await reply({
220993
+ type: "saveDocumentResult",
220994
+ requestId: msg.requestId,
220995
+ success,
220996
+ error: success ? void 0 : "Failed to save document"
220997
+ });
220998
+ if (success) {
220999
+ state.inspectorContentSyncKind = "reload";
221000
+ }
221001
+ } catch (error) {
221002
+ getBehavior3OutputChannel().error(
221003
+ `[saveDocument] exception for ${document.uri.fsPath}: ${String(error)}`
221004
+ );
221005
+ await reply({
221006
+ type: "saveDocumentResult",
221007
+ requestId: msg.requestId,
221008
+ success: false,
221009
+ error: String(error)
221010
+ });
221011
+ }
221012
+ });
221013
+ };
221014
+ const handleHistoryNavigationMessage = async (direction) => {
221015
+ await enqueueMainDocumentOperation(async () => {
221016
+ const editBlockedMessage = blockEditingForNewerFile();
221017
+ if (editBlockedMessage) {
221018
+ return;
221019
+ }
221020
+ const snapshot = direction === "undo" ? documentSession.undo() : documentSession.redo();
221021
+ if (!snapshot) {
221022
+ return;
221023
+ }
221024
+ await applySessionHistorySnapshot(snapshot);
221025
+ });
221026
+ };
221027
+ const handleRevertDocumentMessage = async (msg, reply = postMessage) => {
221028
+ await enqueueMainDocumentOperation(async () => {
221029
+ const cancellation = new vscode12.CancellationTokenSource();
221030
+ try {
221031
+ await revertDocument(document, cancellation.token);
221032
+ state.inspectorContentSyncKind = "reload";
221033
+ await reply({
221034
+ type: "revertDocumentResult",
221035
+ requestId: msg.requestId,
221036
+ success: true
221037
+ });
221038
+ } catch (error) {
221039
+ await reply({
221040
+ type: "revertDocumentResult",
221041
+ requestId: msg.requestId,
221042
+ success: false,
221043
+ error: String(error)
221044
+ });
221045
+ } finally {
221046
+ cancellation.dispose();
221047
+ }
221048
+ });
221049
+ };
221050
+ const handleMainDocumentFileChange = async () => {
221051
+ await enqueueMainDocumentOperation(async () => {
221052
+ let content;
221053
+ try {
221054
+ content = await readFileContentFromDisk(document.uri);
221055
+ } catch {
221056
+ return;
221057
+ }
221058
+ invalidateSubtreeRefs();
221059
+ if (document.consumeOwnWrite(content)) {
221060
+ return;
221061
+ }
221062
+ if (document.content === content) {
221063
+ return;
221064
+ }
221065
+ if (!document.isDirty) {
221066
+ document.updateContent(content, { markSaved: true, markDirty: false });
221067
+ documentSession.replaceFromDisk(content);
221068
+ state.inspectorContentSyncKind = "reload";
221069
+ void refreshTrackedSubtreeRefs();
221070
+ updateFileVersionState(content, { showWarning: true });
221071
+ await fanoutDocumentSnapshot({
221072
+ syncKind: "reload"
221073
+ });
221074
+ return;
221075
+ }
221076
+ documentSession.showReloadConflict(content);
221077
+ await fanoutDocumentSnapshot({
221078
+ syncKind: "update",
221079
+ refreshVars: false
221080
+ });
221081
+ });
221082
+ };
221083
+ return {
221084
+ handleSaveDocumentMessage,
221085
+ handleHistoryNavigationMessage,
221086
+ handleRevertDocumentMessage,
221087
+ handleMainDocumentFileChange
221088
+ };
221089
+ }
221090
+
221091
+ // src/editor-session/document/subtree-overrides.ts
221092
+ var path8 = __toESM(require("path"));
221093
+ var vscode13 = __toESM(require("vscode"));
221094
+ function branchContainsSubtreeLink(node) {
221095
+ if (!node) {
221096
+ return false;
220853
221097
  }
220854
- return template.replace(INTERPOLATION_PATTERN, (match, key) => {
220855
- const value = params[key];
220856
- return value === void 0 || value === null ? match : String(value);
221098
+ let found = false;
221099
+ walkPersistedNodes(node, (entry) => {
221100
+ if (entry.path) {
221101
+ found = true;
221102
+ }
221103
+ });
221104
+ return found;
221105
+ }
221106
+ async function normalizeReachableSubtreeOverrides(params) {
221107
+ if (Object.keys(params.tree.overrides).length === 0) {
221108
+ return;
221109
+ }
221110
+ const subtreeSources = await loadSubtreeSourceCache({
221111
+ root: params.tree.root,
221112
+ readContent: async (relativePath) => {
221113
+ const subtreeUri = vscode13.Uri.file(path8.join(params.projectRootFsPath, relativePath));
221114
+ try {
221115
+ return await params.readWorkspaceFileContent(subtreeUri);
221116
+ } catch {
221117
+ return null;
221118
+ }
221119
+ }
221120
+ });
221121
+ pruneStaleSubtreeOverrides({
221122
+ tree: params.tree,
221123
+ subtreeSources
220857
221124
  });
221125
+ }
221126
+ function mutationMayAffectSubtreeOverrideReachability(mutation, currentTree) {
221127
+ switch (mutation.type) {
221128
+ case "updateNode": {
221129
+ if (mutation.payload.currentNodeSnapshot?.subtreeNode) {
221130
+ return false;
221131
+ }
221132
+ const currentNode = findPersistedNodeByStableId(
221133
+ currentTree.root,
221134
+ mutation.payload.target.structuralStableId
221135
+ ) ?? mutation.payload.currentNodeSnapshot?.data;
221136
+ if (!currentNode) {
221137
+ return false;
221138
+ }
221139
+ const currentPath = currentNode.path;
221140
+ const nextPath = mutation.payload.data.path?.trim() || void 0;
221141
+ return currentPath !== nextPath;
221142
+ }
221143
+ case "replaceNode": {
221144
+ const currentNode = findPersistedNodeByStableId(
221145
+ currentTree.root,
221146
+ mutation.payload.target.structuralStableId
221147
+ );
221148
+ return branchContainsSubtreeLink(currentNode) || branchContainsSubtreeLink(mutation.payload.snapshot);
221149
+ }
221150
+ case "deleteNode": {
221151
+ const currentNode = findPersistedNodeByStableId(
221152
+ currentTree.root,
221153
+ mutation.payload.target.structuralStableId
221154
+ );
221155
+ return branchContainsSubtreeLink(currentNode);
221156
+ }
221157
+ default:
221158
+ return false;
221159
+ }
221160
+ }
221161
+
221162
+ // src/editor-session/session/selection-state.ts
221163
+ var buildPendingSelectionRef = (structuralStableId) => ({
221164
+ instanceKey: structuralStableId,
221165
+ displayId: "",
221166
+ structuralStableId,
221167
+ sourceStableId: structuralStableId,
221168
+ sourceTreePath: null,
221169
+ subtreeStack: []
221170
+ });
221171
+ var applySharedSelectionState = (currentSelection, nextSelection, opts) => {
221172
+ const normalized = normalizeHostSelectionState(nextSelection);
221173
+ if (isJsonEqual(currentSelection, normalized)) {
221174
+ return {
221175
+ selection: currentSelection,
221176
+ result: opts?.reassertIfEqual ? "reasserted" : "noop"
221177
+ };
221178
+ }
221179
+ return {
221180
+ selection: normalized,
221181
+ result: "changed"
221182
+ };
220858
221183
  };
220859
- var translateRuntimeMessage = (language, key, params) => {
220860
- const template = runtimeTranslations[language][key] ?? runtimeTranslations.en[key] ?? key;
220861
- return interpolateRuntimeMessage(template, params);
221184
+
221185
+ // src/editor-session/session/messages.ts
221186
+ function buildVarDeclLoadedMessage(result, allFiles) {
221187
+ return {
221188
+ type: "varDeclLoaded",
221189
+ usingVars: Object.values(result.usingVars),
221190
+ allFiles,
221191
+ importDecls: result.importDecls,
221192
+ subtreeDecls: result.subtreeDecls
221193
+ };
221194
+ }
221195
+ function buildDocumentSnapshotChangedMessage(params) {
221196
+ return {
221197
+ type: "documentSnapshotChanged",
221198
+ snapshot: {
221199
+ content: params.content,
221200
+ documentSession: params.documentSession,
221201
+ selection: params.selection,
221202
+ syncKind: params.syncKind
221203
+ }
221204
+ };
221205
+ }
221206
+ function buildHostSelectionFromMutationSelection(selection) {
221207
+ return selection.kind === "tree" ? { kind: "tree" } : {
221208
+ kind: "node",
221209
+ ref: buildPendingSelectionRef(selection.structuralStableId)
221210
+ };
221211
+ }
221212
+ function buildInitMessage(params) {
221213
+ return {
221214
+ type: "init",
221215
+ content: params.content,
221216
+ filePath: params.filePath,
221217
+ workdir: params.workdir,
221218
+ nodeDefs: params.nodeDefs,
221219
+ allowNewFunction: params.settings.allowNewFunction,
221220
+ checkExpr: params.settings.checkExpr,
221221
+ subtreeEditable: params.settings.subtreeEditable,
221222
+ language: params.settings.language,
221223
+ theme: params.theme,
221224
+ inspectorMode: params.settings.inspectorMode,
221225
+ allFiles: params.allFiles,
221226
+ nodeColors: params.settings.nodeColors,
221227
+ documentSession: params.documentSession,
221228
+ selection: params.selection
221229
+ };
221230
+ }
221231
+
221232
+ // webview/shared/node-overrides.ts
221233
+ var hasOwn = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
221234
+ var getNodeArgOverrideCompareValue = (args, arg) => {
221235
+ if (args && hasOwn(args, arg.name)) {
221236
+ return args[arg.name];
221237
+ }
221238
+ return arg.default;
220862
221239
  };
220863
221240
 
220864
221241
  // webview/shared/document.ts
@@ -221978,19 +222355,22 @@ function createSessionInspectorSync(context) {
221978
222355
  var fs4 = __toESM(require("fs"));
221979
222356
  var path9 = __toESM(require("path"));
221980
222357
  var vscode16 = __toESM(require("vscode"));
221981
- function createSessionBuildScriptEnv(workdir, nodeDefs) {
222358
+ function createSessionBuildScriptEnv(workdir, nodeDefs, allowNewFunction = false, language) {
221982
222359
  return {
221983
222360
  fs: fs4,
221984
222361
  path: b3path_default,
221985
222362
  workdir,
221986
222363
  nodeDefs: createNodeDefMap(nodeDefs),
221987
- logger: createBuildScriptLogger()
222364
+ logger: createBuildScriptLogger(),
222365
+ allowNewFunction,
222366
+ language
221988
222367
  };
221989
222368
  }
221990
222369
  async function createSessionNodeCheckRuntime({
221991
222370
  documentUri,
221992
222371
  workspaceFolderUri,
221993
222372
  nodeDefs,
222373
+ language,
221994
222374
  readWorkspaceFileContent: readWorkspaceFileContent2
221995
222375
  }) {
221996
222376
  const workspaceFile = findB3WorkspacePath(documentUri, workspaceFolderUri);
@@ -221998,18 +222378,20 @@ async function createSessionNodeCheckRuntime({
221998
222378
  return {
221999
222379
  buildScriptRuntime: createBuildScriptRuntime(
222000
222380
  null,
222001
- createSessionBuildScriptEnv(workspaceFolderUri.fsPath, nodeDefs)
222381
+ createSessionBuildScriptEnv(workspaceFolderUri.fsPath, nodeDefs, false, language)
222002
222382
  ),
222003
222383
  nodeFieldVisibleHandlers: /* @__PURE__ */ new Map(),
222004
- treePath: workspaceFolderUri.fsPath
222384
+ treePath: workspaceFolderUri.fsPath,
222385
+ allowNewFunction: false
222005
222386
  };
222006
222387
  }
222007
222388
  const workspaceText = await readWorkspaceFileContent2(vscode16.Uri.file(workspaceFile));
222008
222389
  const workspaceModel = parseWorkspaceModelContent(workspaceText);
222009
222390
  const buildScript = workspaceModel.settings.buildScript;
222010
222391
  const checkScripts = workspaceModel.settings.checkScripts ?? [];
222392
+ const allowNewFunction = workspaceModel.settings.allowNewFunction ?? false;
222011
222393
  const workdir = path9.dirname(workspaceFile).replace(/\\/g, "/");
222012
- const env2 = createSessionBuildScriptEnv(workdir, nodeDefs);
222394
+ const env2 = createSessionBuildScriptEnv(workdir, nodeDefs, allowNewFunction, language);
222013
222395
  let buildScriptModule = null;
222014
222396
  let hasRuntimeLoadError = false;
222015
222397
  if (buildScript) {
@@ -222048,7 +222430,8 @@ async function createSessionNodeCheckRuntime({
222048
222430
  hasError: buildScriptRuntime.hasError || hasRuntimeLoadError
222049
222431
  },
222050
222432
  nodeFieldVisibleHandlers: visibleRuntime.nodeFieldVisibles,
222051
- treePath: workdir
222433
+ treePath: workdir,
222434
+ allowNewFunction
222052
222435
  };
222053
222436
  }
222054
222437
 
@@ -222061,6 +222444,7 @@ function createSessionNodeChecks(context) {
222061
222444
  documentUri: document.uri,
222062
222445
  workspaceFolderUri,
222063
222446
  nodeDefs: state.nodeDefs,
222447
+ language: state.currentSettings.language,
222064
222448
  readWorkspaceFileContent
222065
222449
  });
222066
222450
  };
@@ -222071,8 +222455,14 @@ function createSessionNodeChecks(context) {
222071
222455
  const diagnostics = collectNodeFieldCheckDiagnostics({
222072
222456
  tree,
222073
222457
  treePath: msg.treePath || runtimeResult.treePath,
222074
- env: createSessionBuildScriptEnv(runtimeResult.treePath, state.nodeDefs),
222458
+ env: createSessionBuildScriptEnv(
222459
+ runtimeResult.treePath,
222460
+ state.nodeDefs,
222461
+ runtimeResult.allowNewFunction,
222462
+ state.currentSettings.language
222463
+ ),
222075
222464
  checkers: runtimeResult.buildScriptRuntime.nodeFieldCheckers,
222465
+ visibles: runtimeResult.nodeFieldVisibleHandlers,
222076
222466
  targets: msg.nodes.map((entry) => ({
222077
222467
  instanceKey: entry.instanceKey,
222078
222468
  treePath: entry.treePath,
@@ -222113,7 +222503,12 @@ function createSessionNodeChecks(context) {
222113
222503
  const visibility = resolveNodeFieldVisibility({
222114
222504
  tree,
222115
222505
  treePath: msg.treePath || runtimeResult.treePath,
222116
- env: createSessionBuildScriptEnv(runtimeResult.treePath, state.nodeDefs),
222506
+ env: createSessionBuildScriptEnv(
222507
+ runtimeResult.treePath,
222508
+ state.nodeDefs,
222509
+ runtimeResult.allowNewFunction,
222510
+ state.currentSettings.language
222511
+ ),
222117
222512
  visibles: runtimeResult.nodeFieldVisibleHandlers,
222118
222513
  target: toNodeData(msg.target.node),
222119
222514
  targetTreePath: msg.target.treePath
@@ -223199,6 +223594,7 @@ var buildEmbeddedModeSettingsMessage = (snapshot) => ({
223199
223594
  type: "settingLoaded",
223200
223595
  nodeDefs: snapshot?.initMessage.nodeDefs ?? [],
223201
223596
  settings: {
223597
+ allowNewFunction: snapshot?.initMessage.allowNewFunction,
223202
223598
  checkExpr: snapshot?.initMessage.checkExpr,
223203
223599
  subtreeEditable: snapshot?.initMessage.subtreeEditable,
223204
223600
  language: snapshot?.initMessage.language,