import { newVarInputVal } from "js/composer/varInputValManager";

export const dataCommands = {
  label: "数据处理",
  icon: "format_color_text",
  defaultOpened: false,
  commands: [
    {
      value: "quickcomposer.data.string.reverse",
      label: "字符串处理",
      icon: "text_fields",
      subCommands: [
        {
          value: "quickcomposer.data.string.reverse",
          label: "字符串反转",
          icon: "swap_horiz",
          config: [
            {
              label: "要反转的文本",
              component: "VariableInput",
              icon: "text_fields",
              width: 12,
            },
          ],
          outputs: {
            label: "反转结果",
            suggestName: "reversedString",
            typeName: "字符串",
          },
        },
        {
          value: "quickcomposer.data.string.replace",
          label: "字符串替换",
          icon: "find_replace",
          config: [
            {
              label: "原始文本",
              component: "VariableInput",
              icon: "text_fields",
              width: 12,
            },
            {
              label: "要替换的文本",
              component: "VariableInput",
              icon: "find_replace",
              width: 6,
            },
            {
              label: "替换为",
              component: "VariableInput",
              icon: "text_fields",
              width: 6,
            },
          ],
          outputs: {
            label: "替换结果",
            suggestName: "replacedString",
            typeName: "字符串",
          },
        },
        {
          value: "quickcomposer.data.string.substring",
          label: "字符串截取",
          icon: "content_cut",
          config: [
            {
              label: "原始文本",
              component: "VariableInput",
              icon: "text_fields",
              width: 12,
            },
            {
              label: "起始位置",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "first_page",
              width: 6,
            },
            {
              label: "结束位置",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "last_page",
              width: 6,
            },
          ],
          outputs: {
            label: "截取结果",
            suggestName: "substringedString",
            typeName: "字符串",
          },
        },
        {
          value: "quickcomposer.data.string.trim",
          label: "去除空白",
          icon: "format_align_justify",
          config: [
            {
              label: "原始文本",
              component: "VariableInput",
              icon: "text_fields",
              width: 8,
            },
            {
              label: "模式",
              component: "QSelect",
              icon: "settings",
              options: [
                { label: "两端", value: "both" },
                { label: "左侧", value: "start" },
                { label: "右侧", value: "end" },
              ],
              defaultValue: "both",
              width: 4,
            },
          ],
          outputs: {
            label: "去除空白结果",
            suggestName: "trimmedString",
            typeName: "字符串",
          },
        },
        {
          value: "quickcomposer.data.string.changeCase",
          label: "大小写转换",
          icon: "text_fields",
          config: [
            {
              label: "原始文本",
              component: "VariableInput",
              icon: "text_fields",
              width: 8,
            },
            {
              label: "转换为",
              component: "QSelect",
              icon: "settings",
              options: [
                { label: "大写", value: "upper" },
                { label: "小写", value: "lower" },
                { label: "首字母大写", value: "capitalize" },
                { label: "驼峰", value: "camel" },
                { label: "蛇形", value: "snake" },
                { label: "短横线", value: "kebab" },
                { label: "常量", value: "constant" },
              ],
              defaultValue: "upper",
              width: 4,
            },
          ],
          outputs: {
            label: "转换结果",
            suggestName: "changedCaseString",
            typeName: "字符串",
          },
        },
        {
          value: "quickcomposer.data.string.pad",
          label: "字符串填充",
          icon: "format_size",
          config: [
            {
              label: "原始文本",
              component: "VariableInput",
              icon: "text_fields",
              width: 12,
            },
            {
              label: "目标长度",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "straighten",
              width: 4,
            },
            {
              label: "填充字符",
              component: "VariableInput",
              icon: "space_bar",
              width: 4,
              defaultValue: newVarInputVal("str", " "),
            },
            {
              label: "填充位置",
              component: "QSelect",
              icon: "settings",
              options: [
                { label: "左侧", value: "start" },
                { label: "右侧", value: "end" },
                { label: "两端", value: "both" },
              ],
              defaultValue: "end",
              width: 4,
            },
          ],
          outputs: {
            label: "填充结果",
            suggestName: "paddedString",
            typeName: "字符串",
          },
        },
        {
          value: "quickcomposer.data.string.split",
          label: "字符串分割",
          icon: "splitscreen",
          config: [
            {
              label: "原始文本",
              component: "VariableInput",
              icon: "text_fields",
              width: 8,
            },
            {
              label: "分隔符",
              component: "VariableInput",
              icon: "space_bar",
              width: 4,
              defaultValue: newVarInputVal("str", ","),
            },
          ],
          outputs: {
            label: "分割结果",
            suggestName: "splitedString",
            typeName: "字符串",
          },
        },
        {
          value: "quickcomposer.data.string.join",
          label: "数组合并",
          icon: "merge",
          config: [
            {
              label: "字符串数组",
              component: "VariableInput",
              icon: "view_list",
              width: 8,
            },
            {
              label: "连接符",
              component: "VariableInput",
              icon: "space_bar",
              width: 4,
              defaultValue: newVarInputVal("str", ","),
            },
          ],
          outputs: {
            label: "合并结果",
            suggestName: "joinedString",
            typeName: "字符串",
          },
        },
        {
          value: "quickcomposer.data.string.repeat",
          label: "字符串重复",
          icon: "copy_all",
          config: [
            {
              label: "要重复的文本",
              component: "VariableInput",
              icon: "text_fields",
              width: 8,
            },
            {
              label: "重复次数",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "repeat",
              width: 4,
              defaultValue: 1,
            },
          ],
          outputs: {
            label: "重复结果",
            suggestName: "repeatedString",
            typeName: "字符串",
          },
        },
        {
          value: "quickcomposer.data.string.extract",
          label: "提取字符",
          icon: "content_cut",
          config: [
            {
              label: "原始文本",
              component: "VariableInput",
              icon: "text_fields",
              width: 8,
            },
            {
              label: "提取类型",
              component: "QSelect",
              icon: "settings",
              options: [
                { label: "数字", value: "number" },
                { label: "字母", value: "letter" },
                { label: "中文", value: "chinese" },
                { label: "标点符号", value: "punctuation" },
                { label: "空白字符", value: "whitespace" },
              ],
              defaultValue: "number",
              width: 4,
            },
          ],
          outputs: {
            label: "提取结果",
            suggestName: "extractedString",
            typeName: "字符串",
          },
        },
        {
          value: "quickcomposer.data.string.count",
          label: "字符统计",
          icon: "numbers",
          config: [
            {
              label: "原始文本",
              component: "VariableInput",
              icon: "text_fields",
              width: 8,
            },
            {
              label: "统计类型",
              component: "QSelect",
              icon: "settings",
              options: [
                { label: "字符数", value: "char" },
                { label: "单词数", value: "word" },
                { label: "行数", value: "line" },
                { label: "数字数", value: "number" },
                { label: "字母数", value: "letter" },
                { label: "中文字数", value: "chinese" },
                { label: "空白字符数", value: "whitespace" },
              ],
              defaultValue: "char",
              width: 4,
            },
          ],
          outputs: {
            label: "统计结果",
            suggestName: "countedString",
            typeName: "字符串",
          },
        },
        {
          value: "quickcomposer.data.string.wrap",
          label: "文本换行",
          icon: "wrap_text",
          config: [
            {
              label: "原始文本",
              component: "VariableInput",
              icon: "text_fields",
              width: 8,
            },
            {
              label: "每行字符数",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "straighten",
              width: 4,
              defaultValue: 80,
            },
          ],
          outputs: {
            label: "换行结果",
            suggestName: "wrappedString",
            typeName: "字符串",
          },
        },
        {
          value: "quickcomposer.data.string.align",
          label: "文本对齐",
          icon: "format_align_center",
          config: [
            {
              label: "原始文本",
              component: "VariableInput",
              icon: "text_fields",
              width: 12,
            },
            {
              label: "对齐方式",
              component: "QSelect",
              icon: "settings",
              options: [
                { label: "左对齐", value: "left" },
                { label: "居中", value: "center" },
                { label: "右对齐", value: "right" },
                { label: "两端对齐", value: "justify" },
              ],
              defaultValue: "left",
              width: 6,
            },
            {
              label: "总宽度",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "straighten",
              width: 6,
              defaultValue: 80,
            },
          ],
          outputs: {
            label: "对齐结果",
            suggestName: "alignedString",
            typeName: "字符串",
          },
        },
      ],
    },
    {
      value: "quickcomposer.data.regexTransform",
      label: "正则提取/替换",
      component: "RegexEditor",
      componentProps: {
        inputLabel: "要处理的文本",
      },
    },
    {
      value: "quickcomposer.data.buffer.from",
      label: "Buffer操作",
      config: [],
      icon: "memory",
      subCommands: [
        {
          value: "quickcomposer.data.buffer.from",
          label: "创建Buffer",
          icon: "add_box",
          config: [
            {
              label: "数据",
              component: "VariableInput",
              icon: "text_fields",
              width: 9,
            },
            {
              label: "编码",
              component: "QSelect",
              icon: "code",
              options: [
                { label: "UTF-8", value: "utf8" },
                { label: "UTF-16LE", value: "utf16le" },
                { label: "Latin1", value: "latin1" },
                { label: "Base64", value: "base64" },
                { label: "Hex", value: "hex" },
                { label: "ASCII", value: "ascii" },
                { label: "Binary", value: "binary" },
                { label: "UCS-2", value: "ucs2" },
              ],
              defaultValue: "utf8",
              width: 3,
            },
          ],
        },
        {
          value: "quickcomposer.data.buffer.toString",
          label: "转换字符串",
          icon: "text_fields",
          config: [
            {
              label: "Buffer",
              component: "VariableInput",
              icon: "memory",
              width: 12,
            },
            {
              label: "编码",
              component: "QSelect",
              icon: "code",
              options: [
                { label: "UTF-8", value: "utf8" },
                { label: "UTF-16LE", value: "utf16le" },
                { label: "Latin1", value: "latin1" },
                { label: "Base64", value: "base64" },
                { label: "Hex", value: "hex" },
                { label: "ASCII", value: "ascii" },
                { label: "Binary", value: "binary" },
                { label: "UCS-2", value: "ucs2" },
              ],
              defaultValue: "utf8",
              width: 4,
            },
            {
              label: "起始位置",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "first_page",
              width: 4,
            },
            {
              label: "结束位置",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "last_page",
              width: 4,
            },
          ],
        },
        {
          value: "quickcomposer.data.buffer.write",
          label: "写入数据",
          icon: "edit",
          config: [
            {
              label: "Buffer",
              component: "VariableInput",
              icon: "memory",
              width: 6,
            },
            {
              label: "要写入的字符串",
              component: "VariableInput",
              icon: "edit",
              width: 6,
            },
            {
              label: "偏移量",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "first_page",
              width: 4,
            },
            {
              label: "长度",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "straighten",
              width: 4,
            },
            {
              label: "编码",
              component: "QSelect",
              icon: "code",
              options: [
                { label: "UTF-8", value: "utf8" },
                { label: "UTF-16LE", value: "utf16le" },
                { label: "Latin1", value: "latin1" },
                { label: "Base64", value: "base64" },
                { label: "Hex", value: "hex" },
                { label: "ASCII", value: "ascii" },
                { label: "Binary", value: "binary" },
                { label: "UCS-2", value: "ucs2" },
              ],
              defaultValue: "utf8",
              width: 4,
            },
          ],
        },
        {
          value: "quickcomposer.data.buffer.fill",
          label: "填充数据",
          icon: "format_color_fill",
          config: [
            {
              label: "Buffer",
              component: "VariableInput",
              icon: "memory",
              width: 6,
            },
            {
              label: "填充值",
              component: "VariableInput",
              icon: "format_color_fill",
              width: 6,
            },
            {
              label: "起始位置",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "first_page",
              width: 4,
            },
            {
              label: "结束位置",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "last_page",
              width: 4,
            },
            {
              label: "编码",
              component: "QSelect",
              icon: "code",
              options: [
                { label: "UTF-8", value: "utf8" },
                { label: "UTF-16LE", value: "utf16le" },
                { label: "Latin1", value: "latin1" },
                { label: "Base64", value: "base64" },
                { label: "Hex", value: "hex" },
                { label: "ASCII", value: "ascii" },
                { label: "Binary", value: "binary" },
                { label: "UCS-2", value: "ucs2" },
              ],
              defaultValue: "utf8",
              width: 4,
            },
          ],
        },
        {
          value: "quickcomposer.data.buffer.copy",
          label: "复制数据",
          icon: "content_copy",
          config: [
            {
              label: "源Buffer",
              component: "VariableInput",
              icon: "content_copy",
              width: 6,
            },
            {
              label: "目标Buffer",
              component: "VariableInput",
              icon: "save",
              width: 6,
            },
            {
              label: "目标起始位置",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "first_page",
              width: 4,
            },
            {
              label: "源起始位置",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "first_page",
              width: 4,
            },
            {
              label: "源结束位置",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "last_page",
              width: 4,
            },
          ],
        },
        {
          value: "quickcomposer.data.buffer.compare",
          label: "比较数据",
          icon: "compare",
          config: [
            {
              label: "Buffer 1",
              component: "VariableInput",
              icon: "memory",
              width: 6,
            },
            {
              label: "Buffer 2",
              component: "VariableInput",
              icon: "memory",
              width: 6,
            },
          ],
        },
        {
          value: "quickcomposer.data.buffer.concat",
          label: "连接Buffer",
          icon: "merge",
          config: [
            {
              label: "Buffer",
              component: "ArrayEditor",
              icon: "memory",
              width: 12,
              defaultValue: [newVarInputVal("var")],
              defaultRowValue: newVarInputVal("var"),
              disableToggleType: true,
            },
            {
              label: "总长度（可选）",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "straighten",
              width: 12,
            },
          ],
        },
        {
          value: "quickcomposer.data.buffer.slice",
          label: "切片数据",
          icon: "content_cut",
          config: [
            {
              label: "Buffer",
              component: "VariableInput",
              icon: "memory",
              width: 12,
            },
            {
              label: "起始位置",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "first_page",
              width: 6,
            },
            {
              label: "结束位置",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "last_page",
              width: 6,
            },
          ],
        },
        {
          value: "quickcomposer.data.buffer.indexOf",
          label: "查找数据",
          icon: "search",
          config: [
            {
              label: "Buffer",
              component: "VariableInput",
              icon: "memory",
              width: 12,
            },
            {
              label: "要查找的值",
              component: "VariableInput",
              icon: "search",
              width: 4,
            },
            {
              label: "起始位置",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              icon: "first_page",
              width: 4,
            },
            {
              label: "编码",
              component: "QSelect",
              icon: "code",
              options: [
                { label: "UTF-8", value: "utf8" },
                { label: "UTF-16LE", value: "utf16le" },
                { label: "Latin1", value: "latin1" },
                { label: "Base64", value: "base64" },
                { label: "Hex", value: "hex" },
                { label: "ASCII", value: "ascii" },
                { label: "Binary", value: "binary" },
                { label: "UCS-2", value: "ucs2" },
              ],
              defaultValue: "utf8",
              width: 4,
            },
          ],
        },
        {
          value: "quickcomposer.data.buffer.swap",
          label: "交换字节序",
          icon: "swap_horiz",
          config: [
            {
              label: "Buffer",
              component: "VariableInput",
              icon: "memory",
              width: 9,
            },
            {
              label: "字节大小",
              component: "QSelect",
              icon: "memory",
              options: [
                { label: "16位", value: 16 },
                { label: "32位", value: 32 },
                { label: "64位", value: 64 },
              ],
              defaultValue: 16,
              width: 3,
            },
          ],
        },
      ],
    },
    {
      value: "quickcomposer.data.zlib",
      label: "数据压缩解压",
      component: "ZlibEditor",
      icon: "compress",
      asyncMode: "await",
    },
    {
      value: "quickcomposer.data.htmlParser",
      label: "HTML解析",
      icon: "html",
      config: [
        {
          label: "要解析的 HTML",
          component: "VariableInput",
          icon: "html",
          placeholder: "例如：<div>Hello, World!</div>",
          width: 12,
        },
        {
          label: "CSS选择器（可选）",
          component: "VariableInput",
          icon: "css",
          placeholder: "例如：.class",
          width: 7,
        },
        {
          label: "属性（可选）",
          component: "VariableInput",
          icon: "colorize",
          options: {
            items: [
              { label: "innerText", value: "innerText" },
              { label: "innerHTML", value: "innerHTML" },
              { label: "href", value: "href" },
              { label: "src", value: "src" },
              { label: "value", value: "value" },
            ],
          },
          defaultValue: newVarInputVal("str"),
          width: 5,
        },
      ],
    },
    {
      value: "quickcommand.markdownParse",
      label: "Markdown解析",
      icon: "file_download",
      config: [
        {
          label: "要解析的Markdown",
          component: "VariableInput",
          icon: "file_download",
          width: 12,
        },
      ],
      outputs: [
        {
          label: "解析后的HTML",
          suggestName: "parsedHtml",
        },
      ],
    },
    {
      value: "JSON.stringify",
      label: "JSON处理",
      icon: "data_object",
      subCommands: [
        {
          value: "JSON.stringify",
          label: "JSON序列化",
          icon: "data_object",
          config: [
            {
              label: "要序列化的对象",
              component: "VariableInput",
              icon: "input",
              defaultValue: newVarInputVal("var"),
              disableToggleType: true,
              width: 12,
            },
            {
              label: "替换函数/指定属性",
              component: "VariableInput",
              icon: "swap_horiz",
              defaultValue: newVarInputVal("var", "null"),
              disableToggleType: true,
              width: 6,
            },
            {
              label: "缩进",
              component: "NumberInput",
              icon: "format_indent_increase",
              defaultValue: 2,
              step: 1,
              min: 0,
              width: 6,
            },
          ],
        },
        {
          value: "JSON.parse",
          label: "JSON反序列化",
          icon: "text_fields",
          config: [
            {
              label: "要反序列化的JSON字符串",
              component: "VariableInput",
              icon: "input",
              width: 12,
            },
          ],
        },
      ],
    },
    {
      value: "quickcomposer.data.array.filter",
      label: "数组处理",
      icon: "view_list",
      subCommands: [
        {
          value: "quickcomposer.data.array.filter",
          label: "数组过滤",
          icon: "filter_alt",
          config: [
            {
              label: "原始数组",
              component: "VariableInput",
              icon: "view_list",
              width: 12,
              defaultValue: newVarInputVal("var"),
              disableToggleType: true,
              placeholder:
                '[{"id":1,"name":"张三","age":20},{"id":2,"name":"李四","age":18}]',
            },
            {
              label: "过滤条件",
              component: "VariableInput",
              icon: "code",
              width: 12,
              placeholder: "age > 18",
            },
          ],
        },
        {
          value: "quickcomposer.data.array.map",
          label: "数组映射",
          icon: "transform",
          config: [
            {
              label: "原始数组",
              component: "VariableInput",
              icon: "view_list",
              width: 12,
              placeholder:
                '[{"id":1,"name":"张三","age":20},{"id":2,"name":"李四","age":18}]',
            },
            {
              label: "转换函数",
              component: "VariableInput",
              icon: "code",
              placeholder: "name",
              width: 12,
            },
          ],
        },
        {
          value: "quickcomposer.data.array.sort",
          label: "数组排序",
          icon: "sort",
          config: [
            {
              label: "原始数组",
              component: "VariableInput",
              icon: "view_list",
              width: 12,
              placeholder:
                '[{"id":1,"name":"张三","age":20},{"id":2,"name":"李四","age":18}]',
            },
            {
              label: "排序字段",
              component: "VariableInput",
              icon: "key",
              width: 6,
              placeholder: "age",
            },
            {
              label: "排序方式",
              component: "QSelect",
              icon: "sort",
              options: [
                { label: "升序", value: "asc" },
                { label: "降序", value: "desc" },
              ],
              defaultValue: "asc",
              width: 6,
            },
          ],
        },
        {
          value: "quickcomposer.data.array.group",
          label: "数组分组",
          icon: "group_work",
          config: [
            {
              label: "原始数组",
              component: "VariableInput",
              icon: "view_list",
              width: 8,
              placeholder:
                '[{"id":1,"name":"张三","dept":"技术"},{"id":2,"name":"李四","dept":"技术"}]',
            },
            {
              label: "分组字段",
              component: "VariableInput",
              icon: "key",
              width: 4,
              placeholder: "dept",
            },
          ],
        },
        {
          value: "quickcomposer.data.array.unique",
          label: "数组去重",
          icon: "filter_1",
          config: [
            {
              label: "原始数组",
              component: "VariableInput",
              icon: "view_list",
              width: 8,
              placeholder: '[{"id":1,"dept":"技术"},{"id":2,"dept":"技术"}]',
            },
            {
              label: "去重字段",
              component: "VariableInput",
              icon: "key",
              width: 4,
              placeholder: "dept",
            },
          ],
        },
        {
          value: "quickcomposer.data.array.find",
          label: "查找元素",
          icon: "search",
          config: [
            {
              label: "原始数组",
              component: "VariableInput",
              icon: "view_list",
              width: 12,
              placeholder: '[{"id":1,"name":"张三"},{"id":2,"name":"李四"}]',
            },
            {
              label: "查找条件",
              component: "VariableInput",
              icon: "code",
              width: 12,
              placeholder: "id === 1",
            },
          ],
        },
        {
          value: "quickcomposer.data.array.aggregate",
          label: "数组聚合",
          icon: "functions",
          config: [
            {
              label: "原始数组",
              component: "VariableInput",
              icon: "view_list",
              width: 12,
              placeholder: '[{"id":1,"amount":100},{"id":2,"amount":200}]',
            },
            {
              label: "聚合操作",
              component: "QSelect",
              icon: "functions",
              options: [
                { label: "求和", value: "sum" },
                { label: "平均值", value: "avg" },
                { label: "最大值", value: "max" },
                { label: "最小值", value: "min" },
                { label: "计数", value: "count" },
              ],
              defaultValue: "sum",
              width: 6,
            },
            {
              label: "聚合字段",
              component: "VariableInput",
              icon: "key",
              width: 6,
              placeholder: "amount",
            },
          ],
        },
        {
          value: "quickcomposer.data.array.slice",
          label: "数组切片",
          icon: "content_cut",
          config: [
            {
              label: "原始数组",
              component: "VariableInput",
              icon: "view_list",
              width: 12,
              placeholder: "[1,2,3,4,5]",
            },
            {
              label: "起始位置",
              component: "VariableInput",
              icon: "first_page",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              width: 6,
              placeholder: "1",
            },
            {
              label: "结束位置",
              component: "VariableInput",
              icon: "last_page",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              width: 6,
              placeholder: "3",
            },
          ],
        },
        {
          value: "quickcomposer.data.array.flatten",
          label: "数组扁平化",
          icon: "unfold_less",
          config: [
            {
              label: "原始数组",
              component: "VariableInput",
              icon: "view_list",
              width: 8,
              placeholder: "[[1,2],[3,4],[[5,6]]]",
            },
            {
              label: "扁平化深度",
              component: "VariableInput",
              icon: "format_indent_decrease",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              width: 4,
            },
          ],
        },
        {
          value: "quickcomposer.data.array.diff",
          label: "数组差集",
          icon: "difference",
          config: [
            {
              label: "数组1",
              component: "VariableInput",
              icon: "view_list",
              width: 6,
              placeholder: "[1,2,3,4]",
            },
            {
              label: "数组2",
              component: "VariableInput",
              icon: "view_list",
              width: 6,
              placeholder: "[3,4,5,6]",
            },
            {
              label: "比较字段",
              component: "VariableInput",
              icon: "key",
              width: 12,
              placeholder: "对象数组时使用，如: id",
            },
          ],
        },
        {
          value: "quickcomposer.data.array.intersect",
          label: "数组交集",
          icon: "join_full",
          config: [
            {
              label: "数组1",
              component: "VariableInput",
              icon: "view_list",
              width: 6,
              placeholder: "[1,2,3,4]",
            },
            {
              label: "数组2",
              component: "VariableInput",
              icon: "view_list",
              width: 6,
              placeholder: "[3,4,5,6]",
            },
            {
              label: "比较字段",
              component: "VariableInput",
              icon: "key",
              width: 12,
              placeholder: "对象数组时使用，如: id",
            },
          ],
        },
        {
          value: "quickcomposer.data.array.union",
          label: "数组并集",
          icon: "join_inner",
          config: [
            {
              label: "数组1",
              component: "VariableInput",
              icon: "view_list",
              width: 6,
              placeholder: "[1,2,3,4]",
            },
            {
              label: "数组2",
              component: "VariableInput",
              icon: "view_list",
              width: 6,
              placeholder: "[3,4,5,6]",
            },
            {
              label: "比较字段",
              component: "VariableInput",
              icon: "key",
              width: 12,
              placeholder: "对象数组时使用，如: id",
            },
          ],
        },
        {
          value: "quickcomposer.data.array.chunk",
          label: "数组分块",
          icon: "grid_view",
          config: [
            {
              label: "原始数组",
              component: "VariableInput",
              icon: "view_list",
              width: 8,
              placeholder: "[1,2,3,4,5,6]",
            },
            {
              label: "块大小",
              component: "VariableInput",
              icon: "straighten",
              disableToggleType: true,
              defaultValue: newVarInputVal("var"),
              width: 4,
            },
          ],
        },
        {
          value: "quickcomposer.data.array.shuffle",
          label: "数组随机排序",
          icon: "shuffle",
          config: [
            {
              label: "原始数组",
              component: "VariableInput",
              icon: "view_list",
              width: 12,
              placeholder: "[1,2,3,4,5]",
            },
          ],
        },
      ],
    },
    {
      value: "quickcomposer.data.time.format",
      label: "时间处理",
      icon: "schedule",
      subCommands: [
        {
          value: "quickcomposer.data.time.format",
          label: "时间格式化",
          icon: "event",
          config: [
            {
              label: "时间",
              component: "VariableInput",
              icon: "schedule",
              width: 8,
              placeholder: "2024-01-01 或 now 或 timestamp",
            },
            {
              label: "格式",
              component: "QSelect",
              icon: "format_shapes",
              width: 4,
              options: [
                { label: "YYYY-MM-DD", value: "YYYY-MM-DD" },
                { label: "YYYY-MM-DD HH:mm:ss", value: "YYYY-MM-DD HH:mm:ss" },
                { label: "YYYY年MM月DD日", value: "YYYY年MM月DD日" },
                { label: "MM/DD/YYYY", value: "MM/DD/YYYY" },
                { label: "DD/MM/YYYY", value: "DD/MM/YYYY" },
                { label: "HH:mm:ss", value: "HH:mm:ss" },
                { label: "YYYY-MM-DD HH:mm", value: "YYYY-MM-DD HH:mm" },
                { label: "时间戳(秒)", value: "timestamp" },
                { label: "时间戳(毫秒)", value: "timestamp_ms" },
                { label: "相对时间", value: "relative" },
              ],
              defaultValue: "YYYY-MM-DD HH:mm:ss",
            },
          ],
        },
        {
          value: "quickcomposer.data.time.parse",
          label: "时间解析",
          icon: "input",
          config: [
            {
              label: "时间字符串",
              component: "VariableInput",
              icon: "schedule",
              width: 12,
              placeholder: "2024-01-01 或 now 或 timestamp",
            },
          ],
          outputs: {
            label: "时间解析结果",
            suggestName: "timeParseResult",
            structure: {
              date: {
                label: "日期",
                year: { label: "年", suggestName: "dateYear" },
                month: { label: "月", suggestName: "dateMonth" },
                day: { label: "日", suggestName: "dateDay" },
              },
              time: {
                label: "时间",
                hours: { label: "时", suggestName: "timeHours" },
                minutes: { label: "分", suggestName: "timeMinutes" },
                seconds: { label: "秒", suggestName: "timeSeconds" },
              },
              formats: {
                label: "格式化结果",
                iso: { label: "ISO 8601 格式", suggestName: "formatIso" },
                locale: { label: "本地格式", suggestName: "formatLocale" },
                localeDate: {
                  label: "本地日期",
                  suggestName: "formatLocaleDate",
                },
                localeTime: {
                  label: "本地时间",
                  suggestName: "formatLocaleTime",
                },
                dateCN: {
                  label: "YYYY年MM月DD日",
                  suggestName: "formatDateCN",
                },
              },
              timestamp: {
                label: "时间戳(秒)",
                suggestName: "formatTimestamp",
              },
              timestamp_ms: {
                label: "时间戳(毫秒)",
                suggestName: "formatTimestampMs",
              },
              calendar: {
                label: "日历信息",
                week: { label: "周", suggestName: "calendarWeek" },
                weekText: { label: "周文本", suggestName: "canlendarweekText" },
                isWeekend: { label: "是否周末", suggestName: "isWeekend" },
                isLeapYear: { label: "是否闰年", suggestName: "isLeapYear" },
                daysInMonth: { label: "月份天数", suggestName: "daysInMonth" },
                constellation: { label: "星座", suggestName: "constellation" },
              },
            },
          },
        },
        {
          value: "quickcomposer.data.time.add",
          label: "时间加减",
          icon: "add",
          config: [
            {
              label: "基准时间",
              component: "VariableInput",
              icon: "schedule",
              width: 12,
              placeholder: "2024-01-01 或 now",
            },
            {
              label: "数值",
              component: "VariableInput",
              disableToggleType: true,
              defaultValue: newVarInputVal("var", "1"),
              icon: "exposure",
              width: 6,
            },
            {
              label: "单位",
              component: "QSelect",
              icon: "straighten",
              width: 6,
              options: [
                { label: "年", value: "years" },
                { label: "月", value: "months" },
                { label: "周", value: "weeks" },
                { label: "天", value: "days" },
                { label: "小时", value: "hours" },
                { label: "分钟", value: "minutes" },
                { label: "秒", value: "seconds" },
              ],
              defaultValue: "days",
            },
          ],
        },
        {
          value: "quickcomposer.data.time.diff",
          label: "时间差值",
          icon: "difference",
          config: [
            {
              label: "时间1",
              component: "VariableInput",
              icon: "schedule",
              width: 6,
              placeholder: "2024-01-01",
            },
            {
              label: "时间2",
              component: "VariableInput",
              icon: "schedule",
              width: 6,
              placeholder: "2024-02-01",
            },
            {
              label: "返回单位",
              component: "QSelect",
              icon: "straighten",
              width: 6,
              options: [
                { label: "年", value: "years" },
                { label: "月", value: "months" },
                { label: "周", value: "weeks" },
                { label: "天", value: "days" },
                { label: "小时", value: "hours" },
                { label: "分钟", value: "minutes" },
                { label: "秒", value: "seconds" },
                { label: "毫秒", value: "milliseconds" },
              ],
              defaultValue: "days",
            },
            {
              label: "绝对值",
              component: "CheckButton",
              width: 6,
              defaultValue: true,
            },
          ],
        },
        {
          value: "quickcomposer.data.time.startOf",
          label: "时间边界",
          icon: "first_page",
          config: [
            {
              label: "时间",
              component: "VariableInput",
              icon: "schedule",
              width: 6,
              placeholder: "2024-01-01 或 now",
            },
            {
              label: "单位",
              component: "QSelect",
              icon: "straighten",
              width: 3,
              options: [
                { label: "年", value: "year" },
                { label: "月", value: "month" },
                { label: "周", value: "week" },
                { label: "天", value: "day" },
                { label: "小时", value: "hour" },
                { label: "分钟", value: "minute" },
                { label: "秒", value: "second" },
              ],
              defaultValue: "day",
            },
            {
              label: "类型",
              component: "QSelect",
              icon: "settings",
              width: 3,
              options: [
                { label: "开始", value: "start" },
                { label: "结束", value: "end" },
              ],
              defaultValue: "start",
            },
          ],
        },
        {
          value: "quickcomposer.data.time.isValid",
          label: "时间验证",
          icon: "check_circle",
          config: [
            {
              label: "时间",
              component: "VariableInput",
              icon: "schedule",
              width: 8,
              placeholder: "2024-01-01",
            },
            {
              label: "格式",
              component: "QSelect",
              icon: "format_shapes",
              width: 4,
              options: [
                { label: "YYYY-MM-DD", value: "YYYY-MM-DD" },
                { label: "YYYY-MM-DD HH:mm:ss", value: "YYYY-MM-DD HH:mm:ss" },
                { label: "YYYY年MM月DD日", value: "YYYY年MM月DD日" },
                { label: "MM/DD/YYYY", value: "MM/DD/YYYY" },
                { label: "DD/MM/YYYY", value: "DD/MM/YYYY" },
              ],
              defaultValue: "YYYY-MM-DD",
            },
          ],
        },
        {
          value: "quickcomposer.data.time.workday",
          label: "工作日计算",
          icon: "work",
          config: [
            {
              label: "开始时间",
              component: "VariableInput",
              icon: "schedule",
              width: 4,
              placeholder: "2024-01-01",
            },
            {
              label: "工作日天数",
              component: "NumberInput",
              icon: "exposure",
              width: 4,
              defaultValue: 1,
            },
            {
              label: "包含周末",
              component: "CheckButton",
              width: 4,
              defaultValue: false,
            },
            {
              label: "节假日",
              component: "ArrayEditor",
              icon: "event_busy",
              width: 12,
              placeholder: "['2024-01-01']",
            },
          ],
        },
        {
          value: "quickcomposer.data.time.between",
          label: "时间范围判断",
          icon: "date_range",
          config: [
            {
              label: "判断时间",
              component: "VariableInput",
              icon: "schedule",
              width: 12,
              placeholder: "2024-01-01 或 now",
            },
            {
              label: "开始时间",
              component: "VariableInput",
              icon: "schedule",
              width: 4,
              placeholder: "2024-01-01",
            },
            {
              label: "结束时间",
              component: "VariableInput",
              icon: "schedule",
              width: 4,
              placeholder: "2024-02-01",
            },
            {
              label: "包含边界",
              component: "CheckButton",
              width: 4,
              defaultValue: true,
            },
          ],
        },
      ],
    },
  ],
};
