{"version":3,"sources":["jsdelivr-header.js","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/index.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/create-fixed-history-plugin.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/services/fixed-history-service.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/fixed-history-config.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/services/fixed-history-operation-service.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/services/fixed-history-form-data-service.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/fixed-history-registers.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/add-from-node.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/base.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/ungroup.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/move-nodes.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/move-child-nodes.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/move-block.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/delete-nodes.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/delete-node.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/delete-from-node.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/delete-child-node.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/delete-block.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/create-group.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/add-nodes.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/add-node.ts","/npm/@flowgram.ai/fixed-history-plugin@1.0.7/src/operation-metas/add-child-node.ts","/npm/@flowgram.ai/f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BAAkB,QAAQ,EAAK,QAAQ,KAAK,KAAM,GAE9D,EACA,iBAAkB,CAAC,gBAAA,0BDlDrB,WAAA,cAAc,QAAA,wBARd,OAAA","file":"/npm/@flowgram.ai/fixed-history-plugin@1.0.7/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@flowgram.ai/fixed-history-plugin@1.0.7/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport { createFixedHistoryPlugin } from './create-fixed-history-plugin';\nexport * from './types';\nexport * from './services';\nexport * from '@flowgram.ai/history';\nexport * from './fixed-history-config';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { interfaces } from 'inversify';\nimport { bindContributions } from '@flowgram.ai/utils';\nimport { HistoryContainerModule, OperationService } from '@flowgram.ai/history';\nimport { OperationContribution } from '@flowgram.ai/history';\nimport { FlowOperationBaseService } from '@flowgram.ai/document';\nimport { FlowDocument } from '@flowgram.ai/document';\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nimport { FixedHistoryPluginOptions } from './types';\nimport { FixedHistoryService } from './services/fixed-history-service';\nimport { FixedHistoryOperationService } from './services/fixed-history-operation-service';\nimport { FixedHistoryFormDataService } from './services';\nimport { FixedHistoryRegisters } from './fixed-history-registers';\nimport { FixedHistoryConfig } from './fixed-history-config';\n\nexport function registerHistory(bind: interfaces.Bind, rebind: interfaces.Rebind) {\n  bindContributions(bind, FixedHistoryRegisters, [OperationContribution]);\n  bind(FixedHistoryService).toSelf().inSingletonScope();\n  bind(FixedHistoryFormDataService).toSelf().inSingletonScope();\n  bind(FixedHistoryConfig).toSelf().inSingletonScope();\n  rebind(FlowOperationBaseService).to(FixedHistoryOperationService).inSingletonScope();\n}\n\nexport const createFixedHistoryPlugin = definePluginCreator<FixedHistoryPluginOptions<any>>({\n  onBind: ({ bind, rebind }) => {\n    registerHistory(bind, rebind);\n  },\n  onInit(ctx, opts): void {\n    const fixedHistoryService = ctx.get<FixedHistoryService>(FixedHistoryService);\n    fixedHistoryService.setSource(ctx);\n    const document = ctx.get<FlowDocument>(FlowDocument);\n\n    if (opts?.uri) {\n      fixedHistoryService.historyService.context.uri = opts.uri;\n    }\n\n    if (opts?.getDocumentJSON) {\n      fixedHistoryService.historyService.config.getSnapshot = opts.getDocumentJSON(ctx);\n    } else {\n      fixedHistoryService.historyService.config.getSnapshot = () => document.toJSON();\n    }\n\n    const config = fixedHistoryService.config;\n    config.init(ctx, opts);\n\n    if (opts?.operationMetas) {\n      fixedHistoryService.registerOperationMetas(opts.operationMetas);\n    }\n\n    if (opts.onApply) {\n      ctx.get(OperationService).onApply(opts.onApply.bind(null, ctx));\n    }\n  },\n  containerModules: [HistoryContainerModule],\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { injectable, inject } from 'inversify';\nimport { HistoryService, Operation } from '@flowgram.ai/history';\nimport { OperationRegistry } from '@flowgram.ai/history';\nimport { OperationMeta } from '@flowgram.ai/history';\nimport {\n  AddOrDeleteBlockValue,\n  AddOrDeleteChildNodeValue,\n  AddOrDeleteFromNodeOperationValue,\n  FlowNodeEntity,\n  FlowNodeJSON,\n  OperationType,\n} from '@flowgram.ai/document';\nimport { FlowDocument } from '@flowgram.ai/document';\nimport { FlowOperationBaseService } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\n\nimport { IHistoryDocument } from '../types';\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { FixedHistoryOperationService } from './fixed-history-operation-service';\n\n@injectable()\nexport class FixedHistoryService implements IHistoryDocument {\n  @inject(HistoryService) historyService: HistoryService;\n\n  @inject(OperationRegistry) operationRegistry: OperationRegistry;\n\n  @inject(FlowOperationBaseService)\n  fixedHistoryOperationService: FixedHistoryOperationService;\n\n  @inject(FlowDocument) document: FlowDocument;\n\n  @inject(FixedHistoryConfig) config: FixedHistoryConfig;\n\n  setSource(source: PluginContext) {\n    this.historyService.context.source = source;\n  }\n\n  /**\n   * 注册操作\n   * @param operationMetas\n   */\n  public registerOperationMetas(operationMetas: OperationMeta[]) {\n    operationMetas.forEach((operationMeta) => {\n      this.operationRegistry.registerOperationMeta(operationMeta);\n    });\n  }\n\n  /**\n   * 事务\n   * @param transaction\n   */\n  public transact(transaction: () => void) {\n    this.historyService.transact(transaction);\n  }\n\n  /**\n   * 撤销\n   */\n  async undo() {\n    await this.historyService.undo();\n  }\n\n  /**\n   * 重做\n   */\n  async redo() {\n    await this.historyService.redo();\n  }\n\n  /**\n   * 是否可重做\n   */\n  canRedo() {\n    return this.historyService.canRedo();\n  }\n\n  /**\n   * 是否可撤销\n   */\n  canUndo() {\n    return this.historyService.canUndo();\n  }\n\n  /**\n   * 添加一个操作\n   * @param operation\n   */\n  pushHistoryOperation(operation: Operation) {\n    return this.historyService.pushOperation(operation);\n  }\n\n  /**\n   * 获取历史操作\n   */\n  getHistoryOperations() {\n    return this.historyService.getHistoryOperations();\n  }\n\n  /**\n   * 添加节点\n   * @param value 添加节点配置\n   * @returns\n   * @deprecated 请使用 `FlowOperationService.addFromNode` 代替\n   */\n  addFromNode(fromNode: FlowNodeEntity | string, json: FlowNodeJSON): FlowNodeEntity {\n    const value: AddOrDeleteFromNodeOperationValue = {\n      fromId: typeof fromNode === 'string' ? fromNode : fromNode.id,\n      data: json,\n    };\n    return this.historyService.pushOperation({\n      type: OperationType.addFromNode,\n      value,\n      uri: this.config.getNodeURI(json.id),\n    });\n  }\n\n  /**\n   * 删除节点\n   * @param node 节点\n   * @returns\n   * @deprecated 请使用 `FlowOperationService.deleteNode` 代替\n   */\n  deleteNode(node: FlowNodeEntity): void {\n    const { originParent, parent } = node;\n    const uri = this.config.getNodeURI(node.id);\n    let nodeJSON = this.config.nodeToJSON(node);\n\n    // 非数据节点\n    if (!nodeJSON) {\n      nodeJSON = {\n        id: node.id,\n        type: node.flowNodeType,\n      };\n    }\n\n    if (parent) {\n      const index = parent.children.findIndex((child) => child === node);\n\n      if (originParent) {\n        // 分支节点\n        let parentId: string | undefined = originParent.id;\n        if (!parentId) {\n          console.warn('no parent found');\n          return;\n        }\n\n        const value: AddOrDeleteBlockValue = {\n          targetId: parentId,\n          blockData: nodeJSON,\n        };\n\n        if (index >= 0) {\n          value.index = index;\n        }\n\n        return this.historyService.pushOperation({\n          type: OperationType.deleteBlock,\n          value,\n          uri,\n        });\n      } else {\n        // Reactor节点\n        const value: AddOrDeleteChildNodeValue = {\n          data: nodeJSON,\n          parentId: parent.id,\n        };\n\n        if (index >= 0) {\n          value.index = index;\n        }\n\n        return this.historyService.pushOperation({\n          type: OperationType.deleteChildNode,\n          value,\n          uri,\n        });\n      }\n    } else {\n      // 普通节点\n      if (!node.pre) {\n        console.warn('no pre found');\n        return;\n      }\n\n      return this.historyService.pushOperation({\n        type: OperationType.deleteFromNode,\n        value: {\n          fromId: node.pre.id,\n          data: nodeJSON,\n          uri,\n        },\n      });\n    }\n  }\n\n  /**\n   * 添加子节点\n   * @param data\n   * @param parent\n   * @param index\n   * @param originParent\n   * @returns\n   * @deprecated 请使用 `FlowOperationService.addNode` 代替\n   */\n  addChildNode(\n    data: FlowNodeJSON,\n    parent?: FlowNodeEntity,\n    index?: number,\n    originParent?: FlowNodeEntity\n  ) {\n    const value: AddOrDeleteChildNodeValue = {\n      data,\n      parentId: parent?.id,\n      originParentId: originParent?.id,\n      index,\n    };\n\n    return this.historyService.pushOperation({\n      type: OperationType.addChildNode,\n      value: value,\n      uri: this.config.getNodeURI(data.id),\n    });\n  }\n\n  /**\n   * 批量删除\n   * @param nodes\n   * @deprecated 请使用 `FlowOperationService.deleteNodes` 代替\n   */\n  deleteNodes(nodes: FlowNodeEntity[]) {\n    if (nodes.length === 0) {\n      return;\n    }\n\n    this.historyService.transact(() => {\n      nodes.reverse().forEach((node) => {\n        this.deleteNode(node);\n      });\n    });\n  }\n\n  /**\n   * 批量添加\n   * @param from\n   * @param nodes\n   */\n  addFromNodes(from: FlowNodeEntity, nodes: FlowNodeEntity[]) {\n    if (nodes.length === 0) {\n      return;\n    }\n    return this.historyService.pushOperation({\n      type: OperationType.addNodes,\n      value: {\n        fromId: from.id,\n        nodes: nodes.map((node) => this.config.nodeToJSON(node)),\n        uri: this.config.getNodeURI(nodes[0].id),\n      },\n    });\n  }\n\n  /**\n   * 添加块级元素\n   * @param target 目标\n   * @param blockData 块数据\n   * @param parent 父级\n   * @returns\n   * @deprecated 请使用 `FlowOperationService.addBlock` 代替\n   */\n  addBlock(\n    target: string | FlowNodeEntity,\n    blockData: FlowNodeJSON,\n    parent?: FlowNodeEntity | undefined,\n    index?: number\n  ): FlowNodeEntity {\n    const value: AddOrDeleteBlockValue = {\n      targetId: typeof target === 'string' ? target : target.id,\n      blockData,\n      index,\n    };\n\n    if (parent) {\n      value.parentId = parent.id;\n    }\n\n    return this.historyService.pushOperation({\n      type: OperationType.addBlock,\n      value,\n      uri: this.config.getNodeURI(value.blockData.id),\n    });\n  }\n\n  /**\n   * 移动节点\n   * @param node 被移动的节点\n   * @param toNode 被放置的节点\n   * @returns\n   */\n  moveNode(node: FlowNodeEntity, toNode: FlowNodeEntity) {\n    return this.fixedHistoryOperationService.dragNodes({\n      dropNode: toNode,\n      nodes: [node],\n    });\n  }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { injectable } from 'inversify';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\nimport { FlowNodeJSON } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\n\nimport {\n  FixedHistoryPluginOptions,\n  GetBlockLabel,\n  GetNodeLabel,\n  GetNodeLabelById,\n  GetNodeURI,\n  NodeToJson,\n} from './types';\n\n@injectable()\nexport class FixedHistoryConfig {\n  init(ctx: PluginContext, options: FixedHistoryPluginOptions) {\n    if (options.nodeToJSON) {\n      this.nodeToJSON = options.nodeToJSON(ctx);\n    }\n\n    if (options.getNodeLabelById) {\n      this.getNodeLabelById = options.getNodeLabelById(ctx);\n    }\n\n    if (options.getNodeLabel) {\n      this.getNodeLabel = options.getNodeLabel(ctx);\n    }\n\n    if (options.getBlockLabel) {\n      this.getBlockLabel = options.getBlockLabel(ctx);\n    }\n\n    if (options.getNodeURI) {\n      this.getNodeURI = options.getNodeURI(ctx);\n    }\n  }\n\n  nodeToJSON: NodeToJson = (node: FlowNodeEntity) => node.toJSON();\n\n  getNodeLabelById: GetNodeLabelById = (id: string) => id;\n\n  getNodeLabel: GetNodeLabel = (node: FlowNodeJSON) => node.id;\n\n  getBlockLabel: GetBlockLabel = (node: FlowNodeJSON) => node.id;\n\n  getNodeURI: GetNodeURI = (id: string) => `node:${id}`;\n\n  getParentName(parentId?: string) {\n    return parentId ? this.getNodeLabelById(parentId) : 'root';\n  }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject, injectable } from 'inversify';\nimport { FlowOperation, FlowOperationBaseServiceImpl } from '@flowgram.ai/document';\nimport { HistoryService } from '@flowgram.ai/history';\n\n@injectable()\nexport class FixedHistoryOperationService extends FlowOperationBaseServiceImpl {\n  @inject(HistoryService) historyService: HistoryService;\n\n  apply(operation: FlowOperation): any {\n    return this.historyService.pushOperation(operation);\n  }\n\n  originApply(operation: FlowOperation): any {\n    return super.apply(operation);\n  }\n\n  transact(transaction: () => void): void {\n    this.historyService.transact(transaction);\n  }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { cloneDeep } from 'lodash-es';\nimport { inject, injectable } from 'inversify';\nimport { Disposable, Emitter } from '@flowgram.ai/utils';\nimport { FlowNodeFormData, FormModel } from '@flowgram.ai/form-core';\nimport { FlowDocument } from '@flowgram.ai/document';\n\n@injectable()\nexport class FixedHistoryFormDataService implements Disposable {\n  @inject(FlowDocument) document: FlowDocument;\n\n  private _cache = new Map<FlowNodeFormData, Map<string, any>>();\n\n  private _formValueChangeByHistoryEmitter = new Emitter<{\n    formData: FlowNodeFormData;\n    value: any;\n    path: string;\n  }>();\n\n  onFormValueChangeByHistory = this._formValueChangeByHistoryEmitter.event;\n\n  resetCache(flowNodeFormData: FlowNodeFormData, value: any) {\n    Object.keys(value).forEach((key) => {\n      this.setCache(flowNodeFormData, key, value[key]);\n    });\n  }\n\n  setCache(flowNodeFormData: FlowNodeFormData, prop: string, value: any) {\n    if (!this._cache.has(flowNodeFormData)) {\n      this._cache.set(flowNodeFormData, new Map());\n    }\n\n    const formData = this._cache.get(flowNodeFormData)!;\n    formData.set(prop, cloneDeep(value));\n  }\n\n  getCache(flowNodeFormData: FlowNodeFormData, prop: string): any {\n    if (!this._cache.has(flowNodeFormData)) {\n      return;\n    }\n\n    const formData = this._cache.get(flowNodeFormData)!;\n    return formData.get(prop);\n  }\n\n  /**\n   * 获取表单数据\n   * @param id node id\n   * @returns 表单数据\n   */\n  getFormDataByNodeId(id: string) {\n    const node = this.document.getNode(id);\n    if (!node) {\n      return;\n    }\n    const formData = node.getData<FlowNodeFormData>(FlowNodeFormData);\n    return formData;\n  }\n\n  getFormItemValue(formData: FlowNodeFormData, path: string) {\n    const formItem = this.getFormItem(formData, path);\n\n    if (!formItem) {\n      return;\n    }\n    return formItem.value;\n  }\n\n  setFormItemValue(formData: FlowNodeFormData, path: string, value: any) {\n    const formItem = this.getFormItem(formData, path);\n\n    if (formItem) {\n      formItem.value = value;\n      this._formValueChangeByHistoryEmitter.fire({\n        formData,\n        path,\n        value,\n      });\n    }\n  }\n\n  getFormItem(formData: FlowNodeFormData, path: string) {\n    if (typeof path === 'undefined') {\n      return;\n    }\n    if (path.endsWith('/')) {\n      path = path.slice(0, -1);\n    }\n\n    if (!path.startsWith('/')) {\n      path = '/' + path;\n    }\n\n    const formItem = formData.getFormModel<FormModel>().getFormItemByPath(path);\n\n    return formItem;\n  }\n\n  dispose() {\n    this._formValueChangeByHistoryEmitter.dispose();\n    this._cache.clear();\n  }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { injectable } from 'inversify';\nimport { OperationContribution, OperationRegistry } from '@flowgram.ai/history';\n\nimport { operationMetas } from './operation-metas';\n\n@injectable()\nexport class FixedHistoryRegisters implements OperationContribution {\n  registerOperationMeta(operationRegistry: OperationRegistry): void {\n    operationMetas.forEach(operationMeta => {\n      operationRegistry.registerOperationMeta(operationMeta);\n    });\n  }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n  type AddOrDeleteFromNodeOperationValue,\n  type FlowNodeEntity,\n  OperationType,\n} from '@flowgram.ai/document';\nimport { type PluginContext } from '@flowgram.ai/core';\nimport { type OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const addFromNodeOperationMeta: OperationMeta<\n  AddOrDeleteFromNodeOperationValue,\n  PluginContext,\n  FlowNodeEntity\n> = {\n  ...baseOperationMeta,\n  type: OperationType.addFromNode,\n  inverse: op => ({ ...op, type: OperationType.deleteFromNode }),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const { value } = op;\n    return `Create ${config.getNodeLabel(value.data)}`;\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const { value } = op;\n    const nodeName = config.getNodeLabel(value.data);\n    const fromName = config.getNodeLabelById(value.fromId);\n    return `Create ${value.data.type} node ${nodeName} after ${fromName}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowOperation, FlowOperationBaseService } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryOperationService } from '../services';\n\nexport const baseOperationMeta: Pick<OperationMeta, 'apply'> = {\n  apply: (operation, ctx: PluginContext) => {\n    const fixedHistoryOperationService = ctx.get(\n      FlowOperationBaseService,\n    ) as FixedHistoryOperationService;\n\n    return fixedHistoryOperationService.originApply(operation as FlowOperation);\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createOrUngroupValue, OperationType } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { baseOperationMeta } from './base';\n\nexport const ungroupOperationMeta: OperationMeta<createOrUngroupValue, PluginContext, void> = {\n  ...baseOperationMeta,\n  type: OperationType.ungroup,\n  inverse: op => ({ ...op, type: OperationType.createGroup }),\n  getLabel: (op, ctx) => {\n    const value = op.value;\n    return `Ungroup ${value.groupId}`;\n  },\n  getDescription: (op, ctx) => {\n    const value = op.value;\n    return `Ungroup with nodes ${value.nodeIds.join(', ')}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { MoveNodesOperationValue, OperationType } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const moveNodesOperationMeta: OperationMeta<MoveNodesOperationValue, PluginContext, void> = {\n  ...baseOperationMeta,\n  type: OperationType.moveNodes,\n  inverse: op => ({\n    ...op,\n    value: {\n      ...op.value,\n      fromId: op.value.toId,\n      toId: op.value.fromId,\n    },\n  }),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return `${value.nodeIds.map(id => `Move ${config.getNodeLabelById(id)}`).join(';')}`;\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return `${value.nodeIds\n      .map(id => `Move ${config.getNodeLabelById(id)} to ${config.getNodeLabelById(value.toId)}`)\n      .join(';')}`;\n  },\n  getURI: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const nodeIds = op.value.nodeIds;\n    if (nodeIds.length === 0) {\n      return;\n    }\n    return config.getNodeURI(nodeIds[0]);\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { MoveChildNodesOperationValue, OperationType } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const moveChildNodesOperationMeta: OperationMeta<\n  MoveChildNodesOperationValue,\n  PluginContext,\n  void\n> = {\n  ...baseOperationMeta,\n  type: OperationType.moveChildNodes,\n  inverse: op => ({\n    ...op,\n    value: {\n      ...op.value,\n      fromIndex: op.value.toIndex,\n      toIndex: op.value.fromIndex,\n      fromParentId: op.value.toParentId,\n      toParentId: op.value.fromParentId,\n    },\n  }),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return `Move ${value.nodeIds.map(id => config.getNodeLabelById(id)).join(',')}`;\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    const position = typeof value.toIndex !== 'undefined' ? `position ${value.toIndex}` : 'the end';\n    return `Move nodes ${value.nodeIds\n      .map(id => config.getNodeLabelById(id))\n      .join(',')} to ${position}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { MoveBlockOperationValue, OperationType } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const moveBlockOperationMeta: OperationMeta<MoveBlockOperationValue, PluginContext, void> = {\n  ...baseOperationMeta,\n  type: OperationType.moveBlock,\n  inverse: op => ({\n    ...op,\n    value: {\n      ...op.value,\n      fromIndex: op.value.toIndex,\n      toIndex: op.value.fromIndex,\n      fromParentId: op.value.toParentId,\n      toParentId: op.value.fromParentId,\n    },\n  }),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return `Move ${config.getNodeLabelById(value.nodeId)}`;\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    const position = typeof value.toIndex !== 'undefined' ? `position ${value.toIndex}` : 'the end';\n    return `Move branch ${config.getNodeLabelById(value.nodeId)} to ${position}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { AddOrDeleteNodesOperationValue, OperationType } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const deleteNodesOperationMeta: OperationMeta<\n  AddOrDeleteNodesOperationValue,\n  PluginContext,\n  void\n> = {\n  ...baseOperationMeta,\n  type: OperationType.deleteNodes,\n  inverse: op => ({\n    ...op,\n    type: OperationType.addNodes,\n  }),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return value.nodes.map(node => `Delete ${config.getNodeLabel(node)}`).join(';');\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    const fromName = config.getNodeLabelById(value.fromId);\n    return value.nodes\n      .map(node => `Delete ${node.type} node ${config.getNodeLabel(node)} after ${fromName}`)\n      .join(';');\n  },\n  shouldMerge: (op, prev, stackItem) => {\n    if (!prev) {\n      return false;\n    }\n    if (\n      // 合并500ms内的操作, 如分组内最后一个节点会联动删除分组\n      Date.now() - stackItem.getTimestamp() <\n      500\n    ) {\n      return true;\n    }\n    return false;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowOperationBaseService, OperationType } from '@flowgram.ai/document';\nimport { AddOrDeleteNodeValue } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const deleteNodeOperationMeta: OperationMeta<AddOrDeleteNodeValue, PluginContext, void> = {\n  ...baseOperationMeta,\n  type: OperationType.deleteNode,\n  inverse: op => ({ ...op, type: OperationType.addNode }),\n  apply: ({ value: { data } }, ctx) =>\n    ctx.get<FlowOperationBaseService>(FlowOperationBaseService).deleteNode(data.id),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return `Create ${config.getNodeLabel(value.data)}`;\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    const nodeName = config.getNodeLabel(value.data);\n    const parentName = config.getParentName(value.parentId);\n    const position = typeof value.index !== 'undefined' ? `position ${value.index}` : 'the end';\n    return `Delete ${value.data.type} node ${nodeName} in ${parentName} at ${position}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { AddOrDeleteFromNodeOperationValue, OperationType } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const deleteFromNodeOperationMeta: OperationMeta<\n  AddOrDeleteFromNodeOperationValue,\n  PluginContext,\n  void\n> = {\n  ...baseOperationMeta,\n  type: OperationType.deleteFromNode,\n  inverse: op => ({ ...op, type: OperationType.addFromNode }),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return `Delete ${config.getNodeLabel(value.data)}`;\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    const nodeName = config.getNodeLabel(value.data);\n    const parentName = config.getNodeLabelById(value.fromId);\n    return `Delete ${value.data.type} node ${nodeName} after ${parentName}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowNodeEntity, OperationType } from '@flowgram.ai/document';\nimport { AddOrDeleteChildNodeValue } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const deleteChildNodeOperationMeta: OperationMeta<\n  AddOrDeleteChildNodeValue,\n  PluginContext,\n  FlowNodeEntity\n> = {\n  ...baseOperationMeta,\n  type: OperationType.deleteChildNode,\n  inverse: op => ({ ...op, type: OperationType.addChildNode }),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return `Delete ${config.getNodeLabel(value.data)}`;\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    const nodeName = config.getNodeLabel(value.data);\n    const parentName = config.getParentName(value.parentId);\n    const position = typeof value.index !== 'undefined' ? `position ${value.index}` : 'the end';\n    return `Delete ${value.data.type} node ${nodeName} in ${parentName} at ${position}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { AddOrDeleteBlockValue, OperationType } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const deleteBlockOperationMeta: OperationMeta<AddOrDeleteBlockValue, PluginContext, void> = {\n  ...baseOperationMeta,\n  type: OperationType.deleteBlock,\n  inverse: op => ({ ...op, type: OperationType.addBlock }),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return `Delete ${config.getBlockLabel(value.blockData)}`;\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    const branchName = config.getBlockLabel(value.blockData);\n    const targetName = config.getNodeLabelById(value.targetId);\n    const position = typeof value.index !== 'undefined' ? `position ${value.index}` : 'the end';\n    return `Delete branch ${branchName} in ${targetName} at ${position}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createOrUngroupValue, OperationType } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { baseOperationMeta } from './base';\n\nexport const createGroupOperationMeta: OperationMeta<createOrUngroupValue, PluginContext, void> = {\n  ...baseOperationMeta,\n  type: OperationType.createGroup,\n  inverse: op => ({ ...op, type: OperationType.ungroup }),\n  getLabel: (op, ctx) => {\n    const value = op.value;\n    return `Create group ${value.groupId} from ${value.targetId}`;\n  },\n  getDescription: (op, ctx) => {\n    const value = op.value;\n    return `Create group with nodes ${value.nodeIds.join(', ')}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { AddOrDeleteNodesOperationValue, OperationType } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const addNodesOperationMeta: OperationMeta<\n  AddOrDeleteNodesOperationValue,\n  PluginContext,\n  void\n> = {\n  ...baseOperationMeta,\n  type: OperationType.addNodes,\n  inverse: op => ({\n    ...op,\n    type: OperationType.deleteNodes,\n  }),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return `${value.nodes.map(node => `Create ${config.getNodeLabel(node)}`).join(';')}`;\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    const fromName = config.getNodeLabelById(value.fromId);\n    return `${value.nodes\n      .map(node => `Create ${node.type} node ${config.getNodeLabel(node)} after ${fromName}`)\n      .join(';')}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowNodeEntity, FlowOperationBaseService, OperationType } from '@flowgram.ai/document';\nimport { AddOrDeleteNodeValue } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\n\nexport const addNodeOperationMeta: OperationMeta<\n  AddOrDeleteNodeValue,\n  PluginContext,\n  FlowNodeEntity\n> = {\n  type: OperationType.addNode,\n  inverse: op => ({ ...op, type: OperationType.deleteNode }),\n  apply: ({ value: { data, parentId, index, hidden } }, ctx) =>\n    ctx.get<FlowOperationBaseService>(FlowOperationBaseService).addNode(data, {\n      parent: parentId,\n      index,\n      hidden,\n    }),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return `Create ${config.getNodeLabel(value.data)}`;\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    const nodeName = config.getNodeLabel(value.data);\n    const parentName = config.getParentName(value.parentId);\n    const position = typeof value.index !== 'undefined' ? `position ${value.index}` : 'the end';\n    return `Create ${value.data.type} node ${nodeName} in ${parentName} at ${position}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowNodeEntity, OperationType } from '@flowgram.ai/document';\nimport { AddOrDeleteChildNodeValue } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const addChildNodeOperationMeta: OperationMeta<\n  AddOrDeleteChildNodeValue,\n  PluginContext,\n  FlowNodeEntity\n> = {\n  ...baseOperationMeta,\n  type: OperationType.addChildNode,\n  inverse: op => ({ ...op, type: OperationType.deleteChildNode }),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return `Create ${config.getNodeLabel(value.data)}`;\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    const nodeName = config.getNodeLabel(value.data);\n    const parentName = config.getParentName(value.parentId);\n    const position = typeof value.index !== 'undefined' ? `position ${value.index}` : 'the end';\n    return `Create ${value.data.type} node ${nodeName} in ${parentName} at ${position}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { AddOrDeleteBlockValue, OperationType } from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\nimport { OperationMeta } from '@flowgram.ai/history';\n\nimport { FixedHistoryConfig } from '../fixed-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const addBlockOperationMeta: OperationMeta<AddOrDeleteBlockValue, PluginContext, void> = {\n  ...baseOperationMeta,\n  type: OperationType.addBlock,\n  inverse: op => ({ ...op, type: OperationType.deleteBlock }),\n  getLabel: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    return `Create ${config.getBlockLabel(value.blockData)}`;\n  },\n  getDescription: (op, ctx) => {\n    const config = ctx.get<FixedHistoryConfig>(FixedHistoryConfig);\n    const value = op.value;\n    const branchName = config.getBlockLabel(value.blockData);\n    const targetName = config.getNodeLabelById(value.targetId);\n    const position = typeof value.index !== 'undefined' ? `position ${value.index}` : 'the end';\n    return `Create branch ${branchName} in ${targetName} at ${position}`;\n  },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport * from './add-from-node';\nimport { ungroupOperationMeta } from './ungroup';\nimport { moveNodesOperationMeta } from './move-nodes';\nimport { moveChildNodesOperationMeta } from './move-child-nodes';\nimport { moveBlockOperationMeta } from './move-block';\nimport { deleteNodesOperationMeta } from './delete-nodes';\nimport { deleteNodeOperationMeta } from './delete-node';\nimport { deleteFromNodeOperationMeta } from './delete-from-node';\nimport { deleteChildNodeOperationMeta } from './delete-child-node';\nimport { deleteBlockOperationMeta } from './delete-block';\nimport { createGroupOperationMeta } from './create-group';\nimport { addNodesOperationMeta } from './add-nodes';\nimport { addNodeOperationMeta } from './add-node';\nimport { addFromNodeOperationMeta } from './add-from-node';\nimport { addChildNodeOperationMeta } from './add-child-node';\nimport { addBlockOperationMeta } from './add-block';\n\nexport const operationMetas = [\n  deleteFromNodeOperationMeta,\n  addFromNodeOperationMeta,\n  addBlockOperationMeta,\n  deleteBlockOperationMeta,\n  createGroupOperationMeta,\n  ungroupOperationMeta,\n  moveNodesOperationMeta,\n  deleteNodesOperationMeta,\n  addNodesOperationMeta,\n  moveBlockOperationMeta,\n  addChildNodeOperationMeta,\n  deleteChildNodeOperationMeta,\n  moveChildNodesOperationMeta,\n  addNodeOperationMeta,\n  deleteNodeOperationMeta,\n];\n"]}