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Ac,MAAO,KAAK,MAAQ,IAAI,MAAM,MAE/I,KAAK,UAAY,IAAI,UAAU,MAAO,KAAK,SAAW,IAAI,SAAS,MAAO,KAAK,UAAY,IAAI,UAAU,MAAO,KAAK,WAAa,IAAI,WAAW,MAAO,KAAK,MAAQ,IAAI,MAAM,MAAO,KAAK,UAAY,IAAI,UAAU,MAAO,KAAK,WAAa,IAAI,WAAW,MAAO,KAAK,UAAY,IAAI,UAAU,MAAO,KAAK,MAAQ,IAAI,MAAM,KACnU,EAEJ,IAAI,0BAA4B,QAChC,IAAI,IAAI,KAAK,oBAAoB,0BAA0B,GAAK,oBAAoB,GAChF,oBAAoB,YAAY,OAAO,eAAe,0BAA2B,aAAc,CAC/F,OAAO","file":"/npm/@coze/api@1.3.9/dist/cjs/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@coze/api@1.3.9/dist/cjs/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","\"use strict\";\n// The require scope\nvar __webpack_require__ = {};\n/************************************************************************/ // webpack/runtime/compat_get_default_export\n(()=>{\n    // getDefaultExport function for compatibility with non-ESM modules\n    __webpack_require__.n = function(module) {\n        var getter = module && module.__esModule ? function() {\n            return module['default'];\n        } : function() {\n            return module;\n        };\n        __webpack_require__.d(getter, {\n            a: getter\n        });\n        return getter;\n    };\n})();\n// webpack/runtime/define_property_getters\n(()=>{\n    __webpack_require__.d = function(exports1, definition) {\n        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {\n            enumerable: true,\n            get: definition[key]\n        });\n    };\n})();\n// webpack/runtime/has_own_property\n(()=>{\n    __webpack_require__.o = function(obj, prop) {\n        return Object.prototype.hasOwnProperty.call(obj, prop);\n    };\n})();\n// webpack/runtime/make_namespace_object\n(()=>{\n    // define __esModule on exports\n    __webpack_require__.r = function(exports1) {\n        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {\n            value: 'Module'\n        });\n        Object.defineProperty(exports1, '__esModule', {\n            value: true\n        });\n    };\n})();\n/************************************************************************/ var __webpack_exports__ = {};\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, {\n    VariableChannel: ()=>/* reexport */ bots_VariableChannel,\n    Transcriptions: ()=>/* reexport */ Transcriptions,\n    InternalServerError: ()=>/* reexport */ InternalServerError,\n    fetchAPI: ()=>/* reexport */ fetchAPI,\n    COZE_CN_BASE_WS_URL: ()=>/* reexport */ COZE_CN_BASE_WS_URL,\n    Websockets: ()=>/* reexport */ Websockets,\n    Knowledge: ()=>/* reexport */ Knowledge,\n    APIError: ()=>/* reexport */ APIError,\n    CozeAPI: ()=>/* binding */ CozeAPI,\n    OldDocuments: ()=>/* reexport */ Documents,\n    POLL_INTERVAL: ()=>/* reexport */ POLL_INTERVAL,\n    WebSocketAPI: ()=>/* reexport */ WebSocketAPI,\n    handleAdditionalMessages: ()=>/* reexport */ handleAdditionalMessages,\n    Documents: ()=>/* reexport */ documents_Documents,\n    Variables: ()=>/* reexport */ Variables,\n    Audio: ()=>/* reexport */ Audio,\n    Files: ()=>/* reexport */ Files,\n    ChatEventType: ()=>/* reexport */ chat_ChatEventType,\n    ChatStatus: ()=>/* reexport */ chat_ChatStatus,\n    NotFoundError: ()=>/* reexport */ NotFoundError,\n    APIConnectionError: ()=>/* reexport */ APIConnectionError,\n    COZE_COM_BASE_WS_URL: ()=>/* reexport */ COZE_COM_BASE_WS_URL,\n    Rooms: ()=>/* reexport */ Rooms,\n    Users: ()=>/* reexport */ Users,\n    VoiceprintGroups: ()=>/* reexport */ VoiceprintGroups,\n    WorkSpaces: ()=>/* reexport */ WorkSpaces,\n    JSONParseError: ()=>/* reexport */ JSONParseError,\n    castToError: ()=>/* reexport */ castToError,\n    getDeviceToken: ()=>/* reexport */ getDeviceToken,\n    getDeviceCode: ()=>/* reexport */ getDeviceCode,\n    getJWTToken: ()=>/* reexport */ getJWTToken,\n    getPKCEOAuthToken: ()=>/* reexport */ getPKCEOAuthToken,\n    getWebAuthenticationUrl: ()=>/* reexport */ getWebAuthenticationUrl,\n    handleParameters: ()=>/* reexport */ handleParameters,\n    COZE_COM_BASE_URL: ()=>/* reexport */ COZE_COM_BASE_URL,\n    AuthenticationError: ()=>/* reexport */ AuthenticationError,\n    COZE_CN_BASE_URL: ()=>/* reexport */ COZE_CN_BASE_URL,\n    VariableType: ()=>/* reexport */ bots_VariableType,\n    getPKCEAuthenticationUrl: ()=>/* reexport */ getPKCEAuthenticationUrl,\n    TemplateEntityType: ()=>/* reexport */ templates_TemplateEntityType,\n    Conversations: ()=>/* reexport */ Conversations,\n    Workflows: ()=>/* reexport */ Workflows,\n    GatewayError: ()=>/* reexport */ GatewayError,\n    RoomMode: ()=>/* reexport */ rooms_RoomMode,\n    PermissionDeniedError: ()=>/* reexport */ PermissionDeniedError,\n    APIUserAbortError: ()=>/* reexport */ APIUserAbortError,\n    Live: ()=>/* reexport */ Live,\n    Bots: ()=>/* reexport */ Bots,\n    Chat: ()=>/* reexport */ Chat,\n    RateLimitError: ()=>/* reexport */ RateLimitError,\n    Runs: ()=>/* reexport */ Runs,\n    SuggestReplyMode: ()=>/* reexport */ bots_SuggestReplyMode,\n    WebsocketsEventType: ()=>/* reexport */ types_WebsocketsEventType,\n    CreateRoomTurnDetectionType: ()=>/* reexport */ rooms_CreateRoomTurnDetectionType,\n    PKCEAuthErrorType: ()=>/* reexport */ auth_PKCEAuthErrorType,\n    TimeoutError: ()=>/* reexport */ TimeoutError,\n    VoiceprintFeature: ()=>/* reexport */ VoiceprintFeature,\n    _getJWTToken: ()=>/* reexport */ _getJWTToken,\n    MAX_POLL_INTERVAL: ()=>/* reexport */ MAX_POLL_INTERVAL,\n    WorkflowChat: ()=>/* reexport */ WorkflowChat,\n    WorkflowEventType: ()=>/* reexport */ runs_WorkflowEventType,\n    Templates: ()=>/* reexport */ Templates,\n    getWebOAuthToken: ()=>/* reexport */ getWebOAuthToken,\n    refreshOAuthToken: ()=>/* reexport */ refreshOAuthToken,\n    Images: ()=>/* reexport */ Images,\n    BadRequestError: ()=>/* reexport */ BadRequestError,\n    CozeError: ()=>/* reexport */ CozeError,\n    RoleType: ()=>/* reexport */ chat_RoleType,\n    Voices: ()=>/* reexport */ Voices,\n    Messages: ()=>/* reexport */ messages_Messages,\n    WorkflowEvent: ()=>/* reexport */ WorkflowEvent,\n    adapterFetch: ()=>/* reexport */ adapterFetch,\n    Datasets: ()=>/* reexport */ Datasets,\n    LiveType: ()=>/* reexport */ live_LiveType\n});\nclass APIResource {\n    constructor(client){\n        this._client = client;\n    }\n}\n/* eslint-disable @typescript-eslint/no-namespace */ class Bots extends APIResource {\n    /**\n   * Create a new agent. | 调用接口创建一个新的智能体。\n   * @docs en:https://www.coze.com/docs/developer_guides/create_bot?_lang=en\n   * @docs zh:https://www.coze.cn/docs/developer_guides/create_bot?_lang=zh\n   * @param params - Required The parameters for creating a bot. | 创建 Bot 的参数。\n   * @param params.space_id - Required The Space ID of the space where the agent is located. | Bot 所在的空间的 Space ID。\n   * @param params.name - Required The name of the agent. It should be 1 to 20 characters long. | Bot 的名称。\n   * @param params.description - Optional The description of the agent. It can be 0 to 500 characters long. | Bot 的描述信息。\n   * @param params.icon_file_id - Optional The file ID for the agent's avatar. | 作为智能体头像的文件 ID。\n   * @param params.prompt_info - Optional The personality and reply logic of the agent. | Bot 的提示词配置。\n   * @param params.onboarding_info - Optional The settings related to the agent's opening remarks. | Bot 的开场白配置。\n   * @returns Information about the created bot. | 创建的 Bot 信息。\n   */ async create(params, options) {\n        const apiUrl = '/v1/bot/create';\n        const result = await this._client.post(apiUrl, params, false, options);\n        return result.data;\n    }\n    /**\n   * Update the configuration of an agent. | 调用接口修改智能体的配置。\n   * @docs en:https://www.coze.com/docs/developer_guides/update_bot?_lang=en\n   * @docs zh:https://www.coze.cn/docs/developer_guides/update_bot?_lang=zh\n   * @param params - Required The parameters for updating a bot. | 修改 Bot 的参数。\n   * @param params.bot_id - Required The ID of the agent that the API interacts with. | 待修改配置的智能体ID。\n   * @param params.name - Optional The name of the agent. | Bot 的名称。\n   * @param params.description - Optional The description of the agent. | Bot 的描述信息。\n   * @param params.icon_file_id - Optional The file ID for the agent's avatar. | 作为智能体头像的文件 ID。\n   * @param params.prompt_info - Optional The personality and reply logic of the agent. | Bot 的提示词配置。\n   * @param params.onboarding_info - Optional The settings related to the agent's opening remarks. | Bot 的开场白配置。\n   * @param params.knowledge - Optional Knowledge configurations of the agent. | Bot 的知识库配置。\n   * @returns Undefined | 无返回值\n   */ async update(params, options) {\n        const apiUrl = '/v1/bot/update';\n        const result = await this._client.post(apiUrl, params, false, options);\n        return result.data;\n    }\n    /**\n   * Get the agents published as API service. | 调用接口查看指定空间发布到 Agent as API 渠道的智能体列表。\n   * @docs en:https://www.coze.com/docs/developer_guides/published_bots_list?_lang=en\n   * @docs zh:https://www.coze.cn/docs/developer_guides/published_bots_list?_lang=zh\n   * @param params - Required The parameters for listing bots. | 列出 Bot 的参数。\n   * @param params.space_id - Required The ID of the space. | Bot 所在的空间的 Space ID。\n   * @param params.page_size - Optional Pagination size. | 分页大小。\n   * @param params.page_index - Optional Page number for paginated queries. | 分页查询时的页码。\n   * @returns List of published bots. | 已发布的 Bot 列表。\n   * @deprecated Use listNew instead.\n   */ async list(params, options) {\n        const apiUrl = '/v1/space/published_bots_list';\n        const result = await this._client.get(apiUrl, params, false, options);\n        return result.data;\n    }\n    /**\n   * Get bots list. | 查看智能体列表\n   */ async listNew(params, options) {\n        const apiUrl = '/v1/bots';\n        const result = await this._client.get(apiUrl, params, false, options);\n        return result.data;\n    }\n    /**\n   * Publish the specified agent as an API service. | 调用接口创建一个新的智能体。\n   * @docs en:https://www.coze.com/docs/developer_guides/publish_bot?_lang=en\n   * @docs zh:https://www.coze.cn/docs/developer_guides/publish_bot?_lang=zh\n   * @param params - Required The parameters for publishing a bot. | 发布 Bot 的参数。\n   * @param params.bot_id - Required The ID of the agent that the API interacts with. | 要发布的智能体ID。\n   * @param params.connector_ids - Required The list of publishing channel IDs for the agent. | 智能体的发布渠道 ID 列表。\n   * @returns Undefined | 无返回值\n   */ async publish(params, options) {\n        const apiUrl = '/v1/bot/publish';\n        const result = await this._client.post(apiUrl, params, false, options);\n        return result.data;\n    }\n    /**\n   * Get the configuration information of the agent. | 获取指定智能体的配置信息。\n   * @docs en:https://www.coze.com/docs/developer_guides/get_metadata?_lang=en\n   * @docs zh:https://www.coze.cn/docs/developer_guides/get_metadata?_lang=zh\n   * @param params - Required The parameters for retrieving a bot. | 获取 Bot 的参数。\n   * @param params.bot_id - Required The ID of the agent that the API interacts with. | 要查看的智能体ID。\n   * @returns Information about the bot. | Bot 的配置信息。\n   * @deprecated Use retrieveNew instead.\n   */ async retrieve(params, options) {\n        const apiUrl = '/v1/bot/get_online_info';\n        const result = await this._client.get(apiUrl, params, false, options);\n        return result.data;\n    }\n    /**\n   * Get the configuration information of the agent. | 获取指定智能体的配置信息。\n   * @param botId - Required The ID of the agent that the API interacts with. | 要查看的智能体ID。\n   * @param params\n   * @param options\n   * @returns\n   */ async retrieveNew(botId, params, options) {\n        const apiUrl = `/v1/bots/${botId}`;\n        const result = await this._client.get(apiUrl, params, false, options);\n        return result.data;\n    }\n}\nvar bots_SuggestReplyMode = /*#__PURE__*/ function(SuggestReplyMode) {\n    /**\n   * The bot does not suggest replies.\n   */ SuggestReplyMode[\"DISABLE\"] = \"disable\";\n    /**\n   * The bot suggests replies.\n   */ SuggestReplyMode[\"ENABLE\"] = \"enable\";\n    /**\n   * The bot suggests replies based on the customized prompt.\n   */ SuggestReplyMode[\"CUSTOMIZED\"] = \"customized\";\n    return SuggestReplyMode;\n}({});\nvar bots_VariableType = /*#__PURE__*/ function(VariableType) {\n    /**\n   * The variable is a key-value pair.\n   */ VariableType[\"KVVariable\"] = \"KVVariable\";\n    /**\n   * The variable is a list.\n   */ VariableType[\"ListVariable\"] = \"ListVariable\";\n    return VariableType;\n}({});\nvar bots_VariableChannel = /*#__PURE__*/ function(VariableChannel) {\n    /**\n   * The variable is a custom variable.\n   */ VariableChannel[\"Custom\"] = \"custom\";\n    /**\n   * The variable is a system variable.\n   */ VariableChannel[\"System\"] = \"system\";\n    /**\n   * The variable is a location variable.\n   */ VariableChannel[\"Location\"] = \"location\";\n    /**\n   * The variable is a Feishu variable.\n   */ VariableChannel[\"Feishu\"] = \"feishu\";\n    /**\n   * The variable is an app variable.\n   */ VariableChannel[\"APP\"] = \"app\";\n    return VariableChannel;\n}({});\n/* eslint-disable security/detect-object-injection */ /* eslint-disable @typescript-eslint/no-explicit-any */ function safeJsonParse(jsonString) {\n    let defaultValue = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : '';\n    try {\n        return JSON.parse(jsonString);\n    } catch (error) {\n        return defaultValue;\n    }\n}\nfunction sleep(ms) {\n    return new Promise((resolve)=>{\n        setTimeout(resolve, ms);\n    });\n}\nfunction isUniApp() {\n    return 'undefined' != typeof uni;\n}\nfunction isBrowser() {\n    return 'undefined' != typeof window;\n}\nfunction isPlainObject(obj) {\n    if ('object' != typeof obj || null === obj) return false;\n    const proto = Object.getPrototypeOf(obj);\n    if (null === proto) return true;\n    let baseProto = proto;\n    while(null !== Object.getPrototypeOf(baseProto))baseProto = Object.getPrototypeOf(baseProto);\n    return proto === baseProto;\n}\nfunction mergeConfig() {\n    for(var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++)objects[_key] = arguments[_key];\n    return objects.reduce((result, obj)=>{\n        if (void 0 === obj) return result || {};\n        for(const key in obj)if (Object.prototype.hasOwnProperty.call(obj, key)) {\n            if (isPlainObject(obj[key]) && !Array.isArray(obj[key])) result[key] = mergeConfig(result[key] || {}, obj[key]);\n            else result[key] = obj[key];\n        }\n        return result;\n    }, {});\n}\nfunction isPersonalAccessToken(token) {\n    return !!(null == token ? void 0 : token.startsWith('pat_'));\n}\nfunction buildWebsocketUrl(path, params) {\n    const queryString = Object.entries(params || {}).filter((param)=>{\n        let [_, value] = param;\n        return null != value && '' !== value;\n    }).map((param)=>{\n        let [key, value] = param;\n        return `${key}=${value}`;\n    }).join('&');\n    return `${path}${queryString ? `?${queryString}` : ''}`;\n}\nconst isBrowserExtension = ()=>'undefined' != typeof chrome && !!chrome.runtime && !!chrome.runtime.id;\n/* eslint-disable max-params */ class CozeError extends Error {\n}\nclass APIError extends CozeError {\n    static makeMessage(status, errorBody, message, headers) {\n        if (!errorBody && message) return message;\n        if (errorBody) {\n            const list = [];\n            const { code, msg, error } = errorBody;\n            if (code) list.push(`code: ${code}`);\n            if (msg) list.push(`msg: ${msg}`);\n            if ((null == error ? void 0 : error.detail) && msg !== error.detail) list.push(`detail: ${error.detail}`);\n            const logId = (null == error ? void 0 : error.logid) || (null == headers ? void 0 : headers['x-tt-logid']);\n            if (logId) list.push(`logid: ${logId}`);\n            return list.join(', ');\n        }\n        if (status) return `http status code: ${status} (no body)`;\n        return '(no status code or body)';\n    }\n    static generate(status, errorResponse, message, headers) {\n        if (!status) return new APIConnectionError({\n            cause: castToError(errorResponse)\n        });\n        const error = errorResponse;\n        // https://www.coze.cn/docs/developer_guides/coze_error_codes\n        if (400 === status || (null == error ? void 0 : error.code) === 4000) return new BadRequestError(status, error, message, headers);\n        if (401 === status || (null == error ? void 0 : error.code) === 4100) return new AuthenticationError(status, error, message, headers);\n        if (403 === status || (null == error ? void 0 : error.code) === 4101) return new PermissionDeniedError(status, error, message, headers);\n        if (404 === status || (null == error ? void 0 : error.code) === 4200) return new NotFoundError(status, error, message, headers);\n        if (429 === status || (null == error ? void 0 : error.code) === 4013) return new RateLimitError(status, error, message, headers);\n        if (408 === status) return new TimeoutError(status, error, message, headers);\n        if (502 === status) return new GatewayError(status, error, message, headers);\n        if (status >= 500) return new InternalServerError(status, error, message, headers);\n        return new APIError(status, error, message, headers);\n    }\n    constructor(status, error, message, headers){\n        var _error_detail, _error_error;\n        super(`${APIError.makeMessage(status, error, message, headers)}`);\n        this.status = status;\n        this.headers = headers;\n        this.logid = (null == error ? void 0 : null === (_error_detail = error.detail) || void 0 === _error_detail ? void 0 : _error_detail.logid) || (null == headers ? void 0 : headers['x-tt-logid']);\n        // this.error = error;\n        this.code = null == error ? void 0 : error.code;\n        this.msg = null == error ? void 0 : error.msg;\n        this.detail = null == error ? void 0 : null === (_error_error = error.error) || void 0 === _error_error ? void 0 : _error_error.detail;\n        this.rawError = error;\n    }\n}\nclass APIConnectionError extends APIError {\n    constructor({ message }){\n        super(void 0, void 0, message || 'Connection error.', void 0), this.status = void 0;\n    // if (cause) {\n    //   this.cause = cause;\n    // }\n    }\n}\nclass APIUserAbortError extends APIError {\n    constructor(message){\n        super(void 0, void 0, message || 'Request was aborted.', void 0), this.name = 'UserAbortError', this.status = void 0;\n    }\n}\nclass BadRequestError extends APIError {\n    constructor(...args){\n        super(...args), this.name = 'BadRequestError', this.status = 400;\n    }\n}\nclass AuthenticationError extends APIError {\n    constructor(...args){\n        super(...args), this.name = 'AuthenticationError', this.status = 401;\n    }\n}\nclass PermissionDeniedError extends APIError {\n    constructor(...args){\n        super(...args), this.name = 'PermissionDeniedError', this.status = 403;\n    }\n}\nclass NotFoundError extends APIError {\n    constructor(...args){\n        super(...args), this.name = 'NotFoundError', this.status = 404;\n    }\n}\nclass TimeoutError extends APIError {\n    constructor(...args){\n        super(...args), this.name = 'TimeoutError', this.status = 408;\n    }\n}\nclass RateLimitError extends APIError {\n    constructor(...args){\n        super(...args), this.name = 'RateLimitError', this.status = 429;\n    }\n}\nclass InternalServerError extends APIError {\n    constructor(...args){\n        super(...args), this.name = 'InternalServerError', this.status = 500;\n    }\n}\nclass GatewayError extends APIError {\n    constructor(...args){\n        super(...args), this.name = 'GatewayError', this.status = 502;\n    }\n}\nconst castToError = (err)=>{\n    if (err instanceof Error) return err;\n    return new Error(err);\n};\nclass JSONParseError extends Error {\n    constructor({ message, cause }){\n        super(message);\n        this.cause = cause;\n    }\n}\nclass Messages extends APIResource {\n    /**\n   * Get the list of messages in a chat. | 获取对话中的消息列表。\n   * @docs en:https://www.coze.com/docs/developer_guides/chat_message_list?_lang=en\n   * @docs zh:https://www.coze.cn/docs/developer_guides/chat_message_list?_lang=zh\n   * @param conversation_id - Required The ID of the conversation. | 会话 ID。\n   * @param chat_id - Required The ID of the chat. | 对话 ID。\n   * @returns An array of chat messages. | 对话消息数组。\n   */ async list(conversation_id, chat_id, options) {\n        const apiUrl = `/v3/chat/message/list?conversation_id=${conversation_id}&chat_id=${chat_id}`;\n        const result = await this._client.get(apiUrl, void 0, false, options);\n        return result.data;\n    }\n}\nconst uuid = ()=>(Math.random() * new Date().getTime()).toString();\nconst handleAdditionalMessages = (additional_messages)=>null == additional_messages ? void 0 : additional_messages.map((i)=>({\n            ...i,\n            content: 'object' == typeof i.content ? JSON.stringify(i.content) : i.content\n        }));\nconst handleParameters = (parameters)=>{\n    if (parameters) {\n        for (const [key, value] of Object.entries(parameters))if ('object' == typeof value) parameters[key] = JSON.stringify(value);\n    }\n    return parameters;\n};\nclass Chat extends APIResource {\n    /**\n   * Call the Chat API to send messages to a published Coze agent. | 调用此接口发起一次对话，支持添加上下文\n   * @docs en:https://www.coze.com/docs/developer_guides/chat_v3?_lang=en\n   * @docs zh:https://www.coze.cn/docs/developer_guides/chat_v3?_lang=zh\n   * @param params - Required The parameters for creating a chat session. | 创建会话的参数。\n   * @param params.bot_id - Required The ID of the agent. | 要进行会话聊天的 Bot ID。\n   * @param params.user_id - Optional The ID of the user interacting with the Bot. | 标识当前与 Bot 交互的用户。\n   * @param params.additional_messages - Optional Additional messages for the conversation. | 对话的附加信息。\n   * @param params.custom_variables - Optional Variables defined in the Bot. | Bot 中定义变量。\n   * @param params.auto_save_history - Optional Whether to automatically save the conversation history. | 是否自动保存历史对话记录。\n   * @param params.meta_data - Optional Additional metadata for the message. | 创建消息时的附加消息。\n   * @param params.conversation_id - Optional The ID of the conversation. | 标识对话发生在哪一次会话中。\n   * @param params.extra_params - Optional Extra parameters for the conversation. | 附加参数。\n   * @param params.shortcut_command - Optional The shortcut command information. | 快捷指令信息。\n   * @param params.parameters - Optional custom parameters. | 自定义参数。\n   * @returns The data of the created chat. | 创建的对话数据。\n   */ async create(params, options) {\n        if (!params.user_id) params.user_id = uuid();\n        const { conversation_id, ...rest } = params;\n        const apiUrl = `/v3/chat${conversation_id ? `?conversation_id=${conversation_id}` : ''}`;\n        const payload = {\n            ...rest,\n            additional_messages: handleAdditionalMessages(params.additional_messages),\n            shortcut_command: params.shortcut_command ? {\n                ...params.shortcut_command,\n                parameters: handleParameters(params.shortcut_command.parameters)\n            } : void 0,\n            stream: false\n        };\n        const result = await this._client.post(apiUrl, payload, false, options);\n        return result.data;\n    }\n    /**\n   * Call the Chat API to send messages to a published Coze agent. | 调用此接口发起一次对话，支持添加上下文\n   * @docs en:https://www.coze.com/docs/developer_guides/chat_v3?_lang=en\n   * @docs zh:https://www.coze.cn/docs/developer_guides/chat_v3?_lang=zh\n   * @param params - Required The parameters for creating a chat session. | 创建会话的参数。\n   * @param params.bot_id - Required The ID of the agent. | 要进行会话聊天的 Bot ID。\n   * @param params.user_id - Optional The ID of the user interacting with the Bot. | 标识当前与 Bot 交互的用户。\n   * @param params.additional_messages - Optional Additional messages for the conversation. | 对话的附加信息。\n   * @param params.custom_variables - Optional Variables defined in the Bot. | Bot 中定义的变量。\n   * @param params.auto_save_history - Optional Whether to automatically save the conversation history. | 是否自动保存历史对话记录。\n   * @param params.meta_data - Optional Additional metadata for the message. | 创建消息时的附加消息。\n   * @param params.conversation_id - Optional The ID of the conversation. | 标识对话发生在哪一次会话中。\n   * @param params.extra_params - Optional Extra parameters for the conversation. | 附加参数。\n   * @param params.shortcut_command - Optional The shortcut command information. | 快捷指令信息。\n   * @param params.parameters - Optional custom parameters. | 自定义参数。\n   * @returns\n   */ async createAndPoll(params, options) {\n        if (!params.user_id) params.user_id = uuid();\n        const { conversation_id, ...rest } = params;\n        const apiUrl = `/v3/chat${conversation_id ? `?conversation_id=${conversation_id}` : ''}`;\n        const payload = {\n            ...rest,\n            additional_messages: handleAdditionalMessages(params.additional_messages),\n            shortcut_command: params.shortcut_command ? {\n                ...params.shortcut_command,\n                parameters: handleParameters(params.shortcut_command.parameters)\n            } : void 0,\n            stream: false\n        };\n        const result = await this._client.post(apiUrl, payload, false, options);\n        const chatId = result.data.id;\n        const conversationId = result.data.conversation_id;\n        let chat;\n        while(true){\n            await sleep(100);\n            chat = await this.retrieve(conversationId, chatId);\n            if ('completed' === chat.status || 'failed' === chat.status || 'requires_action' === chat.status) break;\n        }\n        const messageList = await this.messages.list(conversationId, chatId);\n        return {\n            chat,\n            messages: messageList\n        };\n    }\n    /**\n   * Call the Chat API to send messages to a published Coze agent with streaming response. | 调用此接口发起一次对话，支持流式响应。\n   * @docs en:https://www.coze.com/docs/developer_guides/chat_v3?_lang=en\n   * @docs zh:https://www.coze.cn/docs/developer_guides/chat_v3?_lang=zh\n   * @param params - Required The parameters for streaming a chat session. | 流式会话的参数。\n   * @param params.bot_id - Required The ID of the agent. | 要进行会话聊天的 Bot ID。\n   * @param params.user_id - Optional The ID of the user interacting with the Bot. | 标识当前与 Bot 交互的用户。\n   * @param params.additional_messages - Optional Additional messages for the conversation. | 对话的附加信息。\n   * @param params.custom_variables - Optional Variables defined in the Bot. | Bot 中定义的变量。\n   * @param params.auto_save_history - Optional Whether to automatically save the conversation history. | 是否自动保存历史对话记录。\n   * @param params.meta_data - Optional Additional metadata for the message. | 创建消息时的附加消息。\n   * @param params.conversation_id - Optional The ID of the conversation. | 标识对话发生在哪一次会话中。\n   * @param params.extra_params - Optional Extra parameters for the conversation. | 附加参数。\n   * @param params.shortcut_command - Optional The shortcut command information. | 快捷指令信息。\n   * @param params.parameters - Optional custom parameters. | 自定义参数。\n   * @returns A stream of chat data. | 对话数据流。\n   */ async *stream(params, options) {\n        if (!params.user_id) params.user_id = uuid();\n        const { conversation_id, ...rest } = params;\n        const apiUrl = `/v3/chat${conversation_id ? `?conversation_id=${conversation_id}` : ''}`;\n        const payload = {\n            ...rest,\n            additional_messages: handleAdditionalMessages(params.additional_messages),\n            shortcut_command: params.shortcut_command ? {\n                ...params.shortcut_command,\n                parameters: handleParameters(params.shortcut_command.parameters)\n            } : void 0,\n            stream: true\n        };\n        const result = await this._client.post(apiUrl, payload, true, options);\n        for await (const message of result)if (\"done\" === message.event) {\n            const ret = {\n                event: message.event,\n                data: '[DONE]'\n            };\n            yield ret;\n        } else try {\n            const ret = {\n                event: message.event,\n                data: JSON.parse(message.data)\n            };\n            yield ret;\n        } catch (error) {\n            throw new CozeError(`Could not parse message into JSON:${message.data}`);\n        }\n    }\n    /**\n   * Get the detailed information of the chat. | 查看对话的详细信息。\n   * @docs en:https://www.coze.com/docs/developer_guides/retrieve_chat?_lang=en\n   * @docs zh:https://www.coze.cn/docs/developer_guides/retrieve_chat?_lang=zh\n   * @param conversation_id - Required The ID of the conversation. | 会话 ID。\n   * @param chat_id - Required The ID of the chat. | 对话 ID。\n   * @returns The data of the retrieved chat. | 检索到的对话数据。\n   */ async retrieve(conversation_id, chat_id, options) {\n        const apiUrl = `/v3/chat/retrieve?conversation_id=${conversation_id}&chat_id=${chat_id}`;\n        const result = await this._client.post(apiUrl, void 0, false, options);\n        return result.data;\n    }\n    /**\n   * Cancel a chat session. | 取消对话会话。\n   * @docs en:https://www.coze.com/docs/developer_guides/cancel_chat?_lang=en\n   * @docs zh:https://www.coze.cn/docs/developer_guides/cancel_chat?_lang=zh\n   * @param conversation_id - Required The ID of the conversation. | 会话 ID。\n   * @param chat_id - Required The ID of the chat. | 对话 ID。\n   * @returns The data of the canceled chat. | 取消的对话数据。\n   */ async cancel(conversation_id, chat_id, options) {\n        const apiUrl = '/v3/chat/cancel';\n        const payload = {\n            conversation_id,\n            chat_id\n        };\n        const result = await this._client.post(apiUrl, payload, false, options);\n        return result.data;\n    }\n    /**\n   * Submit tool outputs for a chat session. | 提交对话会话的工具输出。\n   * @docs en:https://www.coze.com/docs/developer_guides/chat_submit_tool_outputs?_lang=en\n   * @docs zh:https://www.coze.cn/docs/developer_guides/chat_submit_tool_outputs?_lang=zh\n   * @param params - Required Parameters for submitting tool outputs. | 提交工具输出的参数。\n   * @param params.conversation_id - Required The ID of the conversation. | 会话 ID。\n   * @param params.chat_id - Required The ID of the chat. | 对话 ID。\n   * @param params.tool_outputs - Required The outputs of the tool. | 工具的输出。\n   * @param params.stream - Optional Whether to use streaming response. | 是否使用流式响应。\n   * @returns The data of the submitted tool outputs or a stream of chat data. | 提交的工具输出数据或对话数据流。\n   */ async *submitToolOutputs(params, options) {\n        const { conversation_id, chat_id, ...rest } = params;\n        const apiUrl = `/v3/chat/submit_tool_outputs?conversation_id=${params.conversation_id}&chat_id=${params.chat_id}`;\n        const payload = {\n            ...rest\n        };\n        if (false === params.stream) {\n            const response = await this._client.post(apiUrl, payload, false, options);\n            return response.data;\n        }\n        {\n            const result = await this._client.post(apiUrl, payload, true, options);\n            for await (const message of result)if (\"done\" === message.event) {\n                const ret = {\n                    event: message.event,\n                    data: '[DONE]'\n                };\n                yield ret;\n            } else try {\n                const ret = {\n                    event: message.event,\n                    data: JSON.parse(message.data)\n                };\n                yield ret;\n            } catch (error) {\n                throw new CozeError(`Could not parse message into JSON:${message.data}`);\n            }\n        }\n    }\n    constructor(...args){\n        super(...args), this.messages = new Messages(this._client);\n    }\n}\nvar chat_ChatStatus = /*#__PURE__*/ function(ChatStatus) {\n    ChatStatus[\"CREATED\"] = \"created\";\n    ChatStatus[\"IN_PROGRESS\"] = \"in_progress\";\n    ChatStatus[\"COMPLETED\"] = \"completed\";\n    ChatStatus[\"FAILED\"] = \"failed\";\n    ChatStatus[\"REQUIRES_ACTION\"] = \"requires_action\";\n    ChatStatus[\"CANCELED\"] = \"canceled\";\n    ChatStatus[\"UNKNOWN\"] = \"unknown\";\n    return ChatStatus;\n}({});\nvar chat_ChatEventType = /*#__PURE__*/ function(ChatEventType) {\n    ChatEventType[\"CONVERSATION_CHAT_CREATED\"] = \"conversation.chat.created\";\n    ChatEventType[\"CONVERSATION_CHAT_IN_PROGRESS\"] = \"conversation.chat.in_progress\";\n    ChatEventType[\"CONVERSATION_CHAT_COMPLETED\"] = \"conversation.chat.completed\";\n    ChatEventType[\"CONVERSATION_CHAT_FAILED\"] = \"conversation.chat.failed\";\n    ChatEventType[\"CONVERSATION_CHAT_REQUIRES_ACTION\"] = \"conversation.chat.requires_action\";\n    ChatEventType[\"CONVERSATION_MESSAGE_DELTA\"] = \"conversation.message.delta\";\n    ChatEventType[\"CONVERSATION_MESSAGE_COMPLETED\"] = \"conversation.message.completed\";\n    ChatEventType[\"CONVERSATION_AUDIO_DELTA\"] = \"conversation.audio.delta\";\n    ChatEventType[\"DONE\"] = \"done\";\n    ChatEventType[\"ERROR\"] = \"error\";\n    return ChatEventType;\n}({});\nvar chat_RoleType = /*#__PURE__*/ function(RoleType) {\n    RoleType[\"User\"] = \"user\";\n    RoleType[\"Assistant\"] = \"assistant\";\n    return RoleType;\n}({});\nclass messages_Messages extends APIResource {\n    /**\n   * Create a message and add it to the specified conversation. | 创建一条消息，并将其添加到指定的会话中。\n   * @docs en: https://www.coze.com/docs/developer_guides/create_message?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/create_message?_lang=zh\n   * @param conversation_id - Required The ID of the conversation. | Conversation ID，即会话的唯一标识。\n   * @param params - Required The parameters for creating a message | 创建消息所需的参数\n   * @param params.role - Required The entity that sent this message. Possible values: user, assistant. | 发送这条消息的实体。取值：user, assistant。\n   * @param params.content - Required The content of the message. | 消息的内容。\n   * @param params.content_type - Required The type of the message content. | 消息内容的类型。\n   * @param params.meta_data - Optional Additional information when creating a message. | 创建消息时的附加消息。\n   * @returns Information about the new message. | 消息详情。\n   */ async create(conversation_id, params, options) {\n        const apiUrl = `/v1/conversation/message/create?conversation_id=${conversation_id}`;\n        const response = await this._client.post(apiUrl, params, false, options);\n        return response.data;\n    }\n    /**\n   * Modify a message, supporting the modification of message content, additional content, and message type. | 修改一条消息，支持修改消息内容、附加内容和消息类型。\n   * @docs en: https://www.coze.com/docs/developer_guides/modify_message?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/modify_message?_lang=zh\n   * @param conversation_id - Required The ID of the conversation. | Conversation ID，即会话的唯一标识。\n   * @param message_id - Required The ID of the message. | Message ID，即消息的唯一标识。\n   * @param params - Required The parameters for modifying a message | 修改消息所需的参数\n   * @param params.meta_data - Optional Additional information when modifying a message. | 修改消息时的附加消息。\n   * @param params.content - Optional The content of the message. | 消息的内容。\n   * @param params.content_type - Optional The type of the message content. | 消息内容的类型。\n   * @returns Information about the modified message. | 消息详情。\n   */ // eslint-disable-next-line max-params\n    async update(conversation_id, message_id, params, options) {\n        const apiUrl = `/v1/conversation/message/modify?conversation_id=${conversation_id}&message_id=${message_id}`;\n        const response = await this._client.post(apiUrl, params, false, options);\n        return response.message;\n    }\n    /**\n   * Get the detailed information of specified message. | 查看指定消息的详细信息。\n   * @docs en: https://www.coze.com/docs/developer_guides/retrieve_message?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/retrieve_message?_lang=zh\n   * @param conversation_id - Required The ID of the conversation. | Conversation ID，即会话的唯一标识。\n   * @param message_id - Required The ID of the message. | Message ID，即消息的唯一标识。\n   * @returns Information about the message. | 消息详情。\n   */ async retrieve(conversation_id, message_id, options) {\n        const apiUrl = `/v1/conversation/message/retrieve?conversation_id=${conversation_id}&message_id=${message_id}`;\n        const response = await this._client.get(apiUrl, null, false, options);\n        return response.data;\n    }\n    /**\n   * List messages in a conversation. | 列出会话中的消息。\n   * @docs en: https://www.coze.com/docs/developer_guides/message_list?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/message_list?_lang=zh\n   * @param conversation_id - Required The ID of the conversation. | Conversation ID，即会话的唯一标识。\n   * @param params - Optional The parameters for listing messages | 列出消息所需的参数\n   * @param params.order - Optional The order of the messages. | 消息的顺序。\n   * @param params.chat_id - Optional The ID of the chat. | 聊天 ID。\n   * @param params.before_id - Optional The ID of the message before which to list. | 列出此消息之前的消息 ID。\n   * @param params.after_id - Optional The ID of the message after which to list. | 列出此消息之后的消息 ID。\n   * @param params.limit - Optional The maximum number of messages to return. | 返回的最大消息数。\n   * @returns A list of messages. | 消息列表。\n   */ async list(conversation_id, params, options) {\n        const apiUrl = `/v1/conversation/message/list?conversation_id=${conversation_id}`;\n        const response = await this._client.post(apiUrl, params, false, options);\n        return response;\n    }\n    /**\n   * Call the API to delete a message within a specified conversation. | 调用接口在指定会话中删除消息。\n   * @docs en: https://www.coze.com/docs/developer_guides/delete_message?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/delete_message?_lang=zh\n   * @param conversation_id - Required The ID of the conversation. | Conversation ID，即会话的唯一标识。\n   * @param message_id - Required The ID of the message. | Message ID，即消息的唯一标识。\n   * @returns Details of the deleted message. | 已删除的消息详情。\n   */ async delete(conversation_id, message_id, options) {\n        const apiUrl = `/v1/conversation/message/delete?conversation_id=${conversation_id}&message_id=${message_id}`;\n        const response = await this._client.post(apiUrl, void 0, false, options);\n        return response.data;\n    }\n}\nclass Conversations extends APIResource {\n    /**\n   * Create a conversation. Conversation is an interaction between an agent and a user, including one or more messages. | 调用接口创建一个会话。\n   * @docs en: https://www.coze.com/docs/developer_guides/create_conversation?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/create_conversation?_lang=zh\n   * @param params - Required The parameters for creating a conversation | 创建会话所需的参数\n   * @param params.messages - Optional Messages in the conversation. | 会话中的消息内容。\n   * @param params.meta_data - Optional Additional information when creating a message. | 创建消息时的附加消息。\n   * @param params.bot_id - Optional Bind and isolate conversation on different bots. | 绑定和隔离不同Bot的会话。\n   * @returns Information about the created conversation. | 会话的基础信息。\n   */ async create(params, options) {\n        const apiUrl = '/v1/conversation/create';\n        const response = await this._client.post(apiUrl, params, false, options);\n        return response.data;\n    }\n    /**\n   * Get the information of specific conversation. | 通过会话 ID 查看会话信息。\n   * @docs en: https://www.coze.com/docs/developer_guides/retrieve_conversation?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/retrieve_conversation?_lang=zh\n   * @param conversation_id - Required The ID of the conversation. | Conversation ID，即会话的唯一标识。\n   * @returns Information about the conversation. | 会话的基础信息。\n   */ async retrieve(conversation_id, options) {\n        const apiUrl = `/v1/conversation/retrieve?conversation_id=${conversation_id}`;\n        const response = await this._client.get(apiUrl, null, false, options);\n        return response.data;\n    }\n    /**\n   * List all conversations. | 列出 Bot 下所有会话。\n   * @param params\n   * @param params.bot_id - Required Bot ID. | Bot ID。\n   * @param params.page_num - Optional The page number. | 页码，默认值为 1。\n   * @param params.page_size - Optional The number of conversations per page. | 每页的会话数量，默认值为 50。\n   * @returns Information about the conversations. | 会话的信息。\n   */ async list(params, options) {\n        const apiUrl = '/v1/conversations';\n        const response = await this._client.get(apiUrl, params, false, options);\n        return response.data;\n    }\n    /**\n   * Clear a conversation. | 清空会话。\n   * @param conversation_id - Required The ID of the conversation. | Conversation ID，即会话的唯一标识。\n   * @returns Information about the conversation session. | 会话的会话 ID。\n   */ async clear(conversation_id, options) {\n        const apiUrl = `/v1/conversations/${conversation_id}/clear`;\n        const response = await this._client.post(apiUrl, null, false, options);\n        return response.data;\n    }\n    constructor(...args){\n        super(...args), this.messages = new messages_Messages(this._client);\n    }\n}\nconst external_axios_namespaceObject = require(\"axios\");\nvar external_axios_default = /*#__PURE__*/ __webpack_require__.n(external_axios_namespaceObject);\nclass Files extends APIResource {\n    /**\n   * Upload files to Coze platform. | 调用接口上传文件到扣子。\n   * @docs en: https://www.coze.com/docs/developer_guides/upload_files?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/upload_files?_lang=zh\n   * @param params - Required The parameters for file upload | 上传文件所需的参数\n   * @param params.file - Required The file to be uploaded. | 需要上传的文件。\n   * @returns Information about the new file. | 已上传的文件信息。\n   */ async upload(params, options) {\n        const apiUrl = '/v1/files/upload';\n        const response = await this._client.post(apiUrl, (0, external_axios_namespaceObject.toFormData)(params), false, options);\n        return response.data;\n    }\n    /**\n   * Get the information of the specific file uploaded to Coze platform. | 查看已上传的文件详情。\n   * @docs en: https://www.coze.com/docs/developer_guides/retrieve_files?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/retrieve_files?_lang=zh\n   * @param file_id - Required The ID of the uploaded file. | 已上传的文件 ID。\n   * @returns Information about the uploaded file. | 已上传的文件信息。\n   */ async retrieve(file_id, options) {\n        const apiUrl = `/v1/files/retrieve?file_id=${file_id}`;\n        const response = await this._client.get(apiUrl, null, false, options);\n        return response.data;\n    }\n}\nclass Runs extends APIResource {\n    /**\n   * Initiates a workflow run. | 启动工作流运行。\n   * @docs en: https://www.coze.com/docs/developer_guides/workflow_run?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/workflow_run?_lang=zh\n   * @param params.workflow_id - Required The ID of the workflow to run. | 必选 要运行的工作流 ID。\n   * @param params.bot_id - Optional The ID of the bot associated with the workflow. | 可选 与工作流关联的机器人 ID。\n   * @param params.parameters - Optional Parameters for the workflow execution. | 可选 工作流执行的参数。\n   * @param params.ext - Optional Additional information for the workflow execution. | 可选 工作流执行的附加信息。\n   * @param params.execute_mode - Optional The mode in which to execute the workflow. | 可选 工作流执行的模式。\n   * @param params.connector_id - Optional The ID of the connector to use for the workflow. | 可选 用于工作流的连接器 ID。\n   * @param params.app_id - Optional The ID of the app.  | 可选 要进行会话聊天的 App ID\n   * @returns RunWorkflowData | 工作流运行数据\n   */ async create(params, options) {\n        const apiUrl = '/v1/workflow/run';\n        const response = await this._client.post(apiUrl, params, false, options);\n        return response;\n    }\n    /**\n   * Streams the workflow run events. | 流式传输工作流运行事件。\n   * @docs en: https://www.coze.com/docs/developer_guides/workflow_stream_run?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/workflow_stream_run?_lang=zh\n   * @param params.workflow_id - Required The ID of the workflow to run. | 必选 要运行的工作流 ID。\n   * @param params.bot_id - Optional The ID of the bot associated with the workflow. | 可选 与工作流关联的机器人 ID。\n   * @param params.parameters - Optional Parameters for the workflow execution. | 可选 工作流执行的参数。\n   * @param params.ext - Optional Additional information for the workflow execution. | 可选 工作流执行的附加信息。\n   * @param params.execute_mode - Optional The mode in which to execute the workflow. | 可选 工作流执行的模式。\n   * @param params.connector_id - Optional The ID of the connector to use for the workflow. | 可选 用于工作流的连接器 ID。\n   * @param params.app_id - Optional The ID of the app.  | 可选 要进行会话聊天的 App ID\n   * @returns Stream<WorkflowEvent, { id: string; event: string; data: string }> | 工作流事件流\n   */ async *stream(params, options) {\n        const apiUrl = '/v1/workflow/stream_run';\n        const result = await this._client.post(apiUrl, params, true, options);\n        for await (const message of result)try {\n            if (\"Done\" === message.event) yield new WorkflowEvent(Number(message.id), \"Done\");\n            else yield new WorkflowEvent(Number(message.id), message.event, JSON.parse(message.data));\n        } catch (error) {\n            throw new CozeError(`Could not parse message into JSON:${message.data}`);\n        }\n    }\n    /**\n   * Resumes a paused workflow run. | 恢复暂停的工作流运行。\n   * @docs en: https://www.coze.com/docs/developer_guides/workflow_resume?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/workflow_resume?_lang=zh\n   * @param params.workflow_id - Required The ID of the workflow to resume. | 必选 要恢复的工作流 ID。\n   * @param params.event_id - Required The ID of the event to resume from. | 必选 要从中恢复的事件 ID。\n   * @param params.resume_data - Required Data needed to resume the workflow. | 必选 恢复工作流所需的数据。\n   * @param params.interrupt_type - Required The type of interruption to resume from. | 必选 要恢复的中断类型。\n   * @returns AsyncGenerator<WorkflowEvent, { id: string; event: string; data: string }> | 工作流事件流\n   */ async *resume(params, options) {\n        const apiUrl = '/v1/workflow/stream_resume';\n        const result = await this._client.post(apiUrl, params, true, options);\n        for await (const message of result)try {\n            if (\"Done\" === message.event) yield new WorkflowEvent(Number(message.id), \"Done\");\n            else yield new WorkflowEvent(Number(message.id), message.event, JSON.parse(message.data));\n        } catch (error) {\n            throw new CozeError(`Could not parse message into JSON:${message.data}`);\n        }\n    }\n    /**\n   * Get the workflow run history | 工作流异步运行后，查看执行结果\n   * @docs zh: https://www.coze.cn/open/docs/developer_guides/workflow_history\n   * @param workflowId - Required The ID of the workflow. | 必选 工作流 ID。\n   * @param executeId - Required The ID of the workflow execution. | 必选 工作流执行 ID。\n   * @returns WorkflowExecuteHistory[] | 工作流执行历史\n   */ async history(workflowId, executeId, options) {\n        const apiUrl = `/v1/workflows/${workflowId}/run_histories/${executeId}`;\n        const response = await this._client.get(apiUrl, void 0, false, options);\n        return response.data;\n    }\n}\nvar runs_WorkflowEventType = /*#__PURE__*/ function(WorkflowEventType) {\n    // The output message from the workflow node, such as the output message from\n    // the message node or end node. You can view the specific message content in data.\n    WorkflowEventType[\"MESSAGE\"] = \"Message\";\n    // An error has occurred. You can view the error_code and error_message in data to\n    // troubleshoot the issue.\n    // 报错。可以在 data 中查看 error_code 和 error_message，排查问题。\n    WorkflowEventType[\"ERROR\"] = \"Error\";\n    // End. Indicates the end of the workflow execution, where data is empty.\n    // 结束。表示工作流执行结束，此时 data 为空。\n    WorkflowEventType[\"DONE\"] = \"Done\";\n    // Interruption. Indicates the workflow has been interrupted, where the data field\n    // contains specific interruption information.\n    // 中断。表示工作流中断，此时 data 字段中包含具体的中断信息。\n    WorkflowEventType[\"INTERRUPT\"] = \"Interrupt\";\n    return WorkflowEventType;\n}({});\nclass WorkflowEvent {\n    constructor(id, event, data){\n        this.id = id;\n        this.event = event;\n        this.data = data;\n    }\n}\nclass WorkflowChat extends APIResource {\n    /**\n   * Execute a chat workflow. | 执行对话流\n   * @docs en: https://www.coze.cn/docs/developer_guides/workflow_chat?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/workflow_chat?_lang=zh\n   * @param params.workflow_id - Required The ID of the workflow to chat with. | 必选 要对话的工作流 ID。\n   * @param params.additional_messages - Required Array of messages for the chat. | 必选 对话的消息数组。\n   * @param params.parameters - Optional  Parameters for the workflow execution. | 必选 工作流执行的参数。\n   * @param params.app_id - Optional The ID of the app. | 可选 应用 ID。\n   * @param params.bot_id - Optional The ID of the bot. | 可选 Bot ID。\n   * @param params.conversation_id - Optional The ID of the conversation. | 可选 会话 ID。\n   * @param params.ext - Optional Additional information for the chat. | 可选 对话的附加信息。\n   * @returns AsyncGenerator<StreamChatData> | 对话数据流\n   */ async *stream(params, options) {\n        const apiUrl = '/v1/workflows/chat';\n        const payload = {\n            ...params,\n            additional_messages: handleAdditionalMessages(params.additional_messages)\n        };\n        const result = await this._client.post(apiUrl, payload, true, options);\n        for await (const message of result)if (message.event === chat_ChatEventType.DONE) {\n            const ret = {\n                event: message.event,\n                data: '[DONE]'\n            };\n            yield ret;\n        } else try {\n            const ret = {\n                event: message.event,\n                data: JSON.parse(message.data)\n            };\n            yield ret;\n        } catch (error) {\n            throw new CozeError(`Could not parse message into JSON:${message.data}`);\n        }\n    }\n}\nclass Workflows extends APIResource {\n    constructor(...args){\n        super(...args), this.runs = new Runs(this._client), this.chat = new WorkflowChat(this._client);\n    }\n}\nclass WorkSpaces extends APIResource {\n    /**\n   * View the list of workspaces that the current Coze user has joined. | 查看当前扣子用户加入的空间列表。\n   * @docs en: https://www.coze.com/docs/developer_guides/list_workspace?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/list_workspace?_lang=zh\n   * @param params.page_num - Optional The page number for paginated queries. Default is 1.\n   * | 可选 分页查询时的页码。默认为 1，即从第一页数据开始返回。\n   * @param params.page_size - Optional The size of pagination. Default is 10. Maximum is 50. | 可选 分页大小。默认为 10，最大为 50。\n   * @returns OpenSpaceData | 工作空间列表\n   */ async list(params, options) {\n        const apiUrl = '/v1/workspaces';\n        const response = await this._client.get(apiUrl, params, false, options);\n        return safeJsonParse(response, response).data;\n    }\n}\n// Required header for knowledge APIs\nconst documents_headers = {\n    'agw-js-conv': 'str'\n};\nclass Documents extends APIResource {\n    /**\n   * @deprecated  The method is deprecated and will be removed in a future version. Please use 'client.datasets.documents.list' instead.\n   *\n   * View the file list of a specified knowledge base, which includes lists of documents, spreadsheets, or images.\n   * | 调用接口查看指定知识库的内容列表，即文件、表格或图像列表。\n   * @docs en: https://www.coze.com/docs/developer_guides/list_knowledge_files?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/list_knowledge_files?_lang=zh\n   * @param params.dataset_id - Required The ID of the knowledge base. | 必选 待查看文件的知识库 ID。\n   * @param params.page - Optional The page number for paginated queries. Default is 1. | 可选 分页查询时的页码。默认为 1。\n   * @param params.page_size - Optional The size of pagination. Default is 10. | 可选 分页大小。默认为 10。\n   * @returns ListDocumentData | 知识库文件列表\n   */ list(params, options) {\n        const apiUrl = '/open_api/knowledge/document/list';\n        const response = this._client.get(apiUrl, params, false, mergeConfig(options, {\n            headers: documents_headers\n        }));\n        return response;\n    }\n    /**\n   * @deprecated  The method is deprecated and will be removed in a future version. Please use 'client.datasets.documents.create' instead.\n   *\n   * Upload files to the specific knowledge. | 调用此接口向指定知识库中上传文件。\n   * @docs en: https://www.coze.com/docs/developer_guides/create_knowledge_files?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/create_knowledge_files?_lang=zh\n   * @param params.dataset_id - Required The ID of the knowledge. | 必选 知识库 ID。\n   * @param params.document_bases - Required The metadata information of the files awaiting upload. | 必选 待上传文件的元数据信息。\n   * @param params.chunk_strategy - Required when uploading files to a new knowledge for the first time. Chunk strategy.\n   * | 向新知识库首次上传文件时必选 分段规则。\n   * @returns DocumentInfo[] | 已上传文件的基本信息\n   */ async create(params, options) {\n        const apiUrl = '/open_api/knowledge/document/create';\n        const response = await this._client.post(apiUrl, params, false, mergeConfig(options, {\n            headers: documents_headers\n        }));\n        return response.document_infos;\n    }\n    /**\n   * @deprecated  The method is deprecated and will be removed in a future version. Please use 'client.datasets.documents.delete' instead.\n   *\n   * Delete text, images, sheets, and other files in the knowledge base, supporting batch deletion.\n   * | 删除知识库中的文本、图像、表格等文件，支持批量删除。\n   * @docs en: https://www.coze.com/docs/developer_guides/delete_knowledge_files?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/delete_knowledge_files?_lang=zh\n   * @param params.document_ids - Required The list of knowledge base files to be deleted. | 必选 待删除的文件 ID。\n   * @returns void | 无返回\n   */ async delete(params, options) {\n        const apiUrl = '/open_api/knowledge/document/delete';\n        await this._client.post(apiUrl, params, false, mergeConfig(options, {\n            headers: documents_headers\n        }));\n    }\n    /**\n   * @deprecated  The method is deprecated and will be removed in a future version. Please use 'client.datasets.documents.update' instead.\n   *\n   * Modify the knowledge base file name and update strategy. | 调用接口修改知识库文件名称和更新策略。\n   * @docs en: https://www.coze.com/docs/developer_guides/modify_knowledge_files?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/modify_knowledge_files?_lang=zh\n   * @param params.document_id - Required The ID of the knowledge base file. | 必选 待修改的知识库文件 ID。\n   * @param params.document_name - Optional The new name of the knowledge base file. | 可选 知识库文件的新名称。\n   * @param params.update_rule - Optional The update strategy for online web pages. | 可选 在线网页更新策略。\n   * @returns void | 无返回\n   */ async update(params, options) {\n        const apiUrl = '/open_api/knowledge/document/update';\n        await this._client.post(apiUrl, params, false, mergeConfig(options, {\n            headers: documents_headers\n        }));\n    }\n}\nclass Knowledge extends APIResource {\n    constructor(...args){\n        super(...args), /**\n   * @deprecated\n   */ this.documents = new Documents(this._client);\n    }\n}\n// Required header for knowledge APIs\nconst documents_documents_headers = {\n    'agw-js-conv': 'str'\n};\nclass documents_Documents extends APIResource {\n    /**\n   * View the file list of a specified knowledge base, which includes lists of documents, spreadsheets, or images.\n   * | 调用接口查看指定知识库的内容列表，即文件、表格或图像列表。\n   * @docs en: https://www.coze.com/docs/developer_guides/list_knowledge_files?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/list_knowledge_files?_lang=zh\n   * @param params.dataset_id - Required The ID of the knowledge base. | 必选 待查看文件的知识库 ID。\n   * @param params.page - Optional The page number for paginated queries. Default is 1. | 可选 分页查询时的页码。默认为 1。\n   * @param params.page_size - Optional The size of pagination. Default is 10. | 可选 分页大小。默认为 10。\n   * @returns ListDocumentData | 知识库文件列表\n   */ async list(params, options) {\n        const apiUrl = '/open_api/knowledge/document/list';\n        const response = await this._client.post(apiUrl, params, false, mergeConfig(options, {\n            headers: documents_documents_headers\n        }));\n        return response;\n    }\n    /**\n   * Upload files to the specific knowledge. | 调用此接口向指定知识库中上传文件。\n   * @docs en: https://www.coze.com/docs/developer_guides/create_knowledge_files?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/create_knowledge_files?_lang=zh\n   * @param params.dataset_id - Required The ID of the knowledge. | 必选 知识库 ID。\n   * @param params.document_bases - Required The metadata information of the files awaiting upload. | 必选 待上传文件的元数据信息。\n   * @param params.chunk_strategy - Required when uploading files to a new knowledge for the first time. Chunk strategy.\n   * | 向新知识库首次上传文件时必选 分段规则。\n   * @returns DocumentInfo[] | 已上传文件的基本信息\n   */ async create(params, options) {\n        const apiUrl = '/open_api/knowledge/document/create';\n        const response = await this._client.post(apiUrl, params, false, mergeConfig(options, {\n            headers: documents_documents_headers\n        }));\n        return response.document_infos;\n    }\n    /**\n   * Delete text, images, sheets, and other files in the knowledge base, supporting batch deletion.\n   * | 删除知识库中的文本、图像、表格等文件，支持批量删除。\n   * @docs en: https://www.coze.com/docs/developer_guides/delete_knowledge_files?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/delete_knowledge_files?_lang=zh\n   * @param params.document_ids - Required The list of knowledge base files to be deleted. | 必选 待删除的文件 ID。\n   * @returns void | 无返回\n   */ async delete(params, options) {\n        const apiUrl = '/open_api/knowledge/document/delete';\n        await this._client.post(apiUrl, params, false, mergeConfig(options, {\n            headers: documents_documents_headers\n        }));\n    }\n    /**\n   * Modify the knowledge base file name and update strategy. | 调用接口修改知识库文件名称和更新策略。\n   * @docs en: https://www.coze.com/docs/developer_guides/modify_knowledge_files?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/modify_knowledge_files?_lang=zh\n   * @param params.document_id - Required The ID of the knowledge base file. | 必选 待修改的知识库文件 ID。\n   * @param params.document_name - Optional The new name of the knowledge base file. | 可选 知识库文件的新名称。\n   * @param params.update_rule - Optional The update strategy for online web pages. | 可选 在线网页更新策略。\n   * @returns void | 无返回\n   */ async update(params, options) {\n        const apiUrl = '/open_api/knowledge/document/update';\n        await this._client.post(apiUrl, params, false, mergeConfig(options, {\n            headers: documents_documents_headers\n        }));\n    }\n}\nclass Images extends APIResource {\n    /**\n   * Update the description of an image in the knowledge base | 更新知识库中的图片描述\n   * @docs en: https://www.coze.com/docs/developer_guides/developer_guides/update_image_caption?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/developer_guides/update_image_caption?_lang=zh\n   * @param datasetId - The ID of the dataset | 必选 知识库 ID\n   * @param documentId - The ID of the document | 必选 知识库文件 ID\n   * @param params - The parameters for updating the image\n   * @param params.caption - Required. The description of the image | 必选 图片的描述信息\n   * @returns undefined\n   */ // eslint-disable-next-line max-params\n    async update(datasetId, documentId, params, options) {\n        const apiUrl = `/v1/datasets/${datasetId}/images/${documentId}`;\n        await this._client.put(apiUrl, params, false, options);\n    }\n    /**\n   * List images in the knowledge base | 列出知识库中的图片\n   * @docs en: https://www.coze.com/docs/developer_guides/developer_guides/get_images?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/developer_guides/get_images?_lang=zh\n   * @param datasetId - The ID of the dataset | 必选 知识库 ID\n   * @param params - The parameters for listing images\n   * @param params.page_num - Optional. Page number for pagination, minimum value is 1, defaults to 1 | 可选 分页查询时的页码。默认为 1。\n   * @param params.page_size - Optional. Number of items per page, range 1-299, defaults to 10 | 可选 分页大小。默认为 10。\n   * @param params.keyword - Optional. Search keyword for image descriptions | 可选 图片描述的搜索关键词。\n   * @param params.has_caption - Optional. Filter for images with/without captions | 可选 是否过滤有/无描述的图片。\n   */ async list(datasetId, params, options) {\n        const apiUrl = `/v1/datasets/${datasetId}/images`;\n        const response = await this._client.get(apiUrl, params, false, options);\n        return response.data;\n    }\n}\nclass Datasets extends APIResource {\n    /**\n   * Creates a new dataset | 创建数据集\n   * @docs en: https://www.coze.com/docs/developer_guides/create_dataset?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/create_dataset?_lang=zh\n   * @param params - The parameters for creating a dataset\n   * @param {string} params.name - Required. Dataset name, maximum length of 100 characters | 必选 数据集名称，最大长度为 100 个字符\n   * @param {string} params.space_id - Required. Space ID where the dataset belongs | 必选 数据集所属的空间 ID\n   * @param {number} params.format_type - Required. Dataset type (0: Text type, 2: Image type) | 必选 数据集类型 (0: 文本类型, 2: 图片类型)\n   * @param {string} [params.description] - Optional. Dataset description | 可选 数据集描述\n   * @param {string} [params.file_id] - Optional. Dataset icon file ID from file upload\n   */ async create(params, options) {\n        const apiUrl = '/v1/datasets';\n        const response = await this._client.post(apiUrl, params, false, options);\n        return response.data;\n    }\n    /**\n   * Lists all datasets in a space | 列出空间中的所有数据集\n   * @docs en: https://www.coze.com/docs/developer_guides/list_dataset?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/list_dataset?_lang=zh\n   * @param params - The parameters for listing datasets | 列出数据集的参数\n   * @param {string} params.space_id - Required. Space ID where the datasets belong | 必选 数据集所属的空间 ID\n   * @param {string} [params.name] - Optional. Dataset name for fuzzy search | 可选 数据集名称用于模糊搜索\n   * @param {number} [params.format_type] - Optional. Dataset type (0: Text type, 2: Image type) | 可选 数据集类型 (0: 文本类型, 2: 图片类型)\n   * @param {number} [params.page_num] - Optional. Page number for pagination (default: 1) | 可选 分页查询时的页码。默认为 1。\n   * @param {number} [params.page_size] - Optional. Number of items per page (default: 10) | 可选 分页大小。默认为 10。\n   */ async list(params, options) {\n        const apiUrl = '/v1/datasets';\n        const response = await this._client.get(apiUrl, params, false, options);\n        return response.data;\n    }\n    /**\n   * Updates a dataset | 更新数据集\n   * @docs en: https://www.coze.com/docs/developer_guides/update_dataset?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/update_dataset?_lang=zh\n   * @param dataset_id - Required. The ID of the dataset to update | 必选 数据集 ID\n   * @param params - Required. The parameters for updating the dataset | 必选 更新数据集的参数\n   * @param params.name - Required. Dataset name, maximum length of 100 characters. | 必选 数据集名称，最大长度为 100 个字符。\n   * @param params.file_id - Optional. Dataset icon, should pass the file_id obtained from the file upload interface. | 可选 数据集图标，应传递从文件上传接口获取的 file_id。\n   * @param params.description - Optional. Dataset description. | 可选 数据集描述。\n   */ async update(dataset_id, params, options) {\n        const apiUrl = `/v1/datasets/${dataset_id}`;\n        await this._client.put(apiUrl, params, false, options);\n    }\n    /**\n   * Deletes a dataset | 删除数据集\n   * @docs en: https://www.coze.com/docs/developer_guides/delete_dataset?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/delete_dataset?_lang=zh\n   * @param dataset_id - Required. The ID of the dataset to delete | 必选 数据集 ID\n   */ async delete(dataset_id, options) {\n        const apiUrl = `/v1/datasets/${dataset_id}`;\n        await this._client.delete(apiUrl, false, options);\n    }\n    /**\n   * Views the progress of dataset upload | 查看数据集上传进度\n   * @docs en: https://www.coze.com/docs/developer_guides/get_dataset_progress?_lang=en\n   * @docs zh: https://www.coze.cn/docs/developer_guides/get_dataset_progress?_lang=zh\n   * @param dataset_id - Required. The ID of the dataset to process | 必选 数据集 ID\n   * @param params - Required. The parameters for processing the dataset | 必选 处理数据集的参数\n   * @param params.dataset_ids - Required. List of dataset IDs | 必选 数据集 ID 列表\n   */ async process(dataset_id, params, options) {\n        const apiUrl = `/v1/datasets/${dataset_id}/process`;\n        const response = await this._client.post(apiUrl, params, false, options);\n        return response.data;\n    }\n    constructor(...args){\n        super(...args), this.documents = new documents_Documents(this._client), this.images = new Images(this._client);\n    }\n}\nclass Voices extends APIResource {\n    /**\n   * @description Clone a voice | 音色克隆\n   * @param params\n   * @param params.voice_name - Required. Voice name, cannot be empty and must be longer than 6 characters\n   * | 复刻的音色名称，不能为空，长度大于 6\n   * @param params.file - Required. Audio file | 音频文件\n   * @param params.audio_format - Required. Only supports \"wav\", \"mp3\", \"ogg\", \"m4a\", \"aac\", \"pcm\" formats\n   * | 只支持 \"wav\", \"mp3\", \"ogg\", \"m4a\", \"aac\", \"pcm\" 格式\n   * @param params.language - Optional. Only supports \"zh\", \"en\" \"ja\" \"es\" \"id\" \"pt\" languages\n   * | 只支持 \"zh\", \"en\" \"ja\" \"es\" \"id\" \"pt\" 语种\n   * @param params.voice_id - Optional. If provided, will train on existing voice and override previous training\n   * | 传入的话就会在原有的音色上去训练，覆盖前面训练好的音色\n   * @param params.preview_text - Optional. If provided, will generate preview audio based on this text, otherwise uses default text\n   * | 如果传入会基于该文本生成预览音频，否则使用默认的文本\n   * @param params.text - Optional. Users can read this text, service will compare audio with text. Returns error if difference is too large\n   * | 可以让用户按照该文本念诵，服务会对比音频与该文本的差异。若差异过大会返回错误\n   * @param params.space_id - Optional.  The space id of the voice. | 空间ID\n   * @param params.description- Optional. The description of the voice. | 音色描述\n   * @param options - Request options\n   * @returns Clone voice data\n   */ async clone(params, options) {\n        const apiUrl = '/v1/audio/voices/clone';\n        const response = await this._client.post(apiUrl, (0, external_axios_namespaceObject.toFormData)(params), false, options);\n        return response.data;\n    }\n    /**\n   * @description List voices | 获取音色列表\n   * @param params\n   * @param params.filter_system_voice - Optional. Whether to filter system voices, default is false\n   * | 是否过滤系统音色, 默认不过滤\n   * @param params.page_num - Optional. Starts from 1 by default, value must be > 0\n   * | 不传默认从 1 开始，传值需要 > 0\n   * @param params.page_size - Optional. Default is 100, value must be (0, 100]\n   * | 不传默认 100，传值需要 (0, 100]\n   * @param params.model_type - Optional. The type of the voice model, if not filled, all will be returned.\n   * @param options - Request options\n   * @returns List voices data\n   */ async list(params, options) {\n        const apiUrl = '/v1/audio/voices';\n        const response = await this._client.get(apiUrl, params, false, options);\n        return response.data;\n    }\n}\nclass Transcriptions extends APIResource {\n    /**\n   * ASR voice to text | ASR 语音转文本\n   * @param params - Required The parameters for file upload | 上传文件所需的参数\n   * @param params.file - Required The audio file to be uploaded. | 需要上传的音频文件。\n   */ async create(params, options) {\n        const apiUrl = '/v1/audio/transcriptions';\n        const response = await this._client.post(apiUrl, (0, external_axios_namespaceObject.toFormData)(params), false, options);\n        return response.data;\n    }\n}\nclass Speech extends APIResource {\n    /**\n   * @description Speech synthesis | 语音合成\n   * @param params\n   * @param params.input - Required. Text to generate audio | 要为其生成音频的文本\n   * @param params.voice_id - Required. Voice ID | 生成音频的音色 ID\n   * @param params.response_format - Optional. Audio encoding format,\n   * supports \"wav\", \"pcm\", \"ogg\", \"opus\", \"mp3\", default is \"mp3\"\n   * | 音频编码格式，支持 \"wav\", \"pcm\", \"ogg\", \"opus\", \"mp3\"，默认是 \"mp3\"\n   * @param options - Request options\n   * @returns Speech synthesis data\n   */ async create(params, options) {\n        const apiUrl = '/v1/audio/speech';\n        const response = await this._client.post(apiUrl, {\n            ...params,\n            sample_rate: params.sample_rate || 24000\n        }, false, mergeConfig(options, {\n            responseType: 'arraybuffer'\n        }));\n        return response;\n    }\n}\nclass Rooms extends APIResource {\n    async create(params, options) {\n        const apiUrl = '/v1/audio/rooms';\n        const response = await this._client.post(apiUrl, params, false, options);\n        return response.data;\n    }\n}\nvar rooms_RoomMode = /*#__PURE__*/ function(RoomMode) {\n    RoomMode[\"Default\"] = \"default\";\n    RoomMode[\"S2S\"] = \"s2s\";\n    RoomMode[\"Podcast\"] = \"podcast\";\n    RoomMode[\"Translate\"] = \"translate\";\n    return RoomMode;\n}({});\nvar rooms_CreateRoomTurnDetectionType = /*#__PURE__*/ function(CreateRoomTurnDetectionType) {\n    CreateRoomTurnDetectionType[\"ServerVad\"] = \"server_vad\";\n    CreateRoomTurnDetectionType[\"ClientVad\"] = \"client_vad\";\n    CreateRoomTurnDetectionType[\"ClientInterrupt\"] = \"client_interrupt\";\n    return CreateRoomTurnDetectionType;\n}({});\nclass VoiceprintFeature extends APIResource {\n    /**\n   * Create voiceprint feature\n   */ async create(groupId, params, options) {\n        const apiUrl = `/v1/audio/voiceprint_groups/${groupId}/features`;\n        const response = await this._client.post(apiUrl, (0, external_axios_namespaceObject.toFormData)(params), false, options);\n        return response.data;\n    }\n    /**\n   * Update voiceprint feature\n   */ // eslint-disable-next-line max-params\n    async update(groupId, featureId, params, options) {\n        const apiUrl = `/v1/audio/voiceprint_groups/${groupId}/features/${featureId}`;\n        const response = await this._client.put(apiUrl, (0, external_axios_namespaceObject.toFormData)(params), false, options);\n        return response.data;\n    }\n    /**\n   * Delete voiceprint feature\n   */ async delete(groupId, featureId, options) {\n        const apiUrl = `/v1/audio/voiceprint_groups/${groupId}/features/${featureId}`;\n        const response = await this._client.delete(apiUrl, false, options);\n        return response.data;\n    }\n    /**\n   * Get voiceprint feature list\n   */ async list(groupId, params, options) {\n        const apiUrl = `/v1/audio/voiceprint_groups/${groupId}/features`;\n        const response = await this._client.get(apiUrl, params, false, options);\n        return response.data;\n    }\n    /**\n   * Speaker identification\n   */ async speakerIdentify(groupId, params, options) {\n        const apiUrl = `/v1/audio/voiceprint_groups/${groupId}/speaker_identify`;\n        const response = await this._client.post(apiUrl, (0, external_axios_namespaceObject.toFormData)(params), false, options);\n        return response.data;\n    }\n}\nclass VoiceprintGroups extends APIResource {\n    /**\n   * Create voiceprint group\n   */ async create(params, options) {\n        const apiUrl = '/v1/audio/voiceprint_groups';\n        const response = await this._client.post(apiUrl, params, false, options);\n        return response.data;\n    }\n    /**\n   * Get voiceprint group list\n   */ async list(params, options) {\n        const apiUrl = '/v1/audio/voiceprint_groups';\n        const response = await this._client.get(apiUrl, params, false, options);\n        return response.data;\n    }\n    /**\n   * Update voiceprint group\n   */ async update(groupId, params, options) {\n        const apiUrl = `/v1/audio/voiceprint_groups/${groupId}`;\n        const response = await this._client.put(apiUrl, params, false, options);\n        return response.data;\n    }\n    /**\n   * Delete voiceprint group\n   */ async delete(groupId, options) {\n        const apiUrl = `/v1/audio/voiceprint_groups/${groupId}`;\n        const response = await this._client.delete(apiUrl, false, options);\n        return response.data;\n    }\n    constructor(...args){\n        super(...args), this.features = new VoiceprintFeature(this._client);\n    }\n}\nclass Live extends APIResource {\n    /**\n   * 拉流 获取收听者信息\n   */ async retrieve(liveId, options) {\n        const apiUrl = `/v1/audio/live/${liveId}`;\n        const response = await this._client.get(apiUrl, void 0, false, options);\n        return response.data;\n    }\n}\nvar live_LiveType = /*#__PURE__*/ function(LiveType) {\n    LiveType[\"Origin\"] = \"origin\";\n    LiveType[\"Translation\"] = \"translation\";\n    return LiveType;\n}({});\nclass Audio extends APIResource {\n    constructor(...args){\n        super(...args), this.rooms = new Rooms(this._client), this.live = new Live(this._client), this.voices = new Voices(this._client), this.speech = new Speech(this._client), this.transcriptions = new Transcriptions(this._client), this.voiceprintGroups = new VoiceprintGroups(this._client);\n    }\n}\nclass Templates extends APIResource {\n    /**\n   * Duplicate a template. | 复制一个模板。\n   * @param templateId - Required. The ID of the template to duplicate. | 要复制的模板的 ID。\n   * @param params - Optional. The parameters for the duplicate operation. | 可选参数，用于复制操作。\n   * @param params.workspace_id - Required. The ID of the workspace to duplicate the template into. | 要复制到的目标工作空间的 ID。\n   * @param params.name - Optional. The name of the new template. | 新模板的名称。\n   * @returns TemplateDuplicateRes | 复制模板结果\n   */ async duplicate(templateId, params, options) {\n        const apiUrl = `/v1/templates/${templateId}/duplicate`;\n        const response = await this._client.post(apiUrl, params, false, options);\n        return response.data;\n    }\n}\nvar templates_TemplateEntityType = /*#__PURE__*/ function(TemplateEntityType) {\n    TemplateEntityType[\"AGENT\"] = \"agent\";\n    return TemplateEntityType;\n}({});\nclass chat_Chat extends APIResource {\n    async create(req, options) {\n        const apiUrl = buildWebsocketUrl('/v1/chat', req);\n        return await this._client.makeWebsocket(apiUrl, options);\n    }\n}\nclass transcriptions_Transcriptions extends APIResource {\n    async create(req, options) {\n        const apiUrl = buildWebsocketUrl('/v1/audio/transcriptions', req);\n        return await this._client.makeWebsocket(apiUrl, options);\n    }\n}\nclass speech_Speech extends APIResource {\n    async create(req, options) {\n        const apiUrl = buildWebsocketUrl('/v1/audio/speech', req);\n        return await this._client.makeWebsocket(apiUrl, options);\n    }\n}\nclass SimultInterpretation extends APIResource {\n    async create(options) {\n        const apiUrl = '/v1/audio/simult_interpretation';\n        return await this._client.makeWebsocket(apiUrl, options);\n    }\n}\nclass audio_Audio extends APIResource {\n    constructor(...args){\n        super(...args), this.speech = new speech_Speech(this._client), this.transcriptions = new transcriptions_Transcriptions(this._client), this.simultInterpretation = new SimultInterpretation(this._client);\n    }\n}\n// Common types (not exported)\n// Keep all existing exports but use the base types where applicable\nvar types_WebsocketsEventType = /*#__PURE__*/ function(WebsocketsEventType) {\n    // Common\n    /** SDK error */ WebsocketsEventType[\"CLIENT_ERROR\"] = \"client_error\";\n    /** Connection closed */ WebsocketsEventType[\"CLOSED\"] = \"closed\";\n    /** All events */ WebsocketsEventType[\"ALL\"] = \"all\";\n    // Error\n    /** Received error event */ WebsocketsEventType[\"ERROR\"] = \"error\";\n    // v1/audio/speech\n    /** Send text to server */ WebsocketsEventType[\"INPUT_TEXT_BUFFER_APPEND\"] = \"input_text_buffer.append\";\n    /** No text to send, after audio all received, can close connection */ WebsocketsEventType[\"INPUT_TEXT_BUFFER_COMPLETE\"] = \"input_text_buffer.complete\";\n    /** Send speech config to server */ WebsocketsEventType[\"SPEECH_UPDATE\"] = \"speech.update\";\n    /** Received `speech.updated` event */ WebsocketsEventType[\"SPEECH_UPDATED\"] = \"speech.updated\";\n    /** After speech created */ WebsocketsEventType[\"SPEECH_CREATED\"] = \"speech.created\";\n    /** Received `input_text_buffer.complete` event */ WebsocketsEventType[\"INPUT_TEXT_BUFFER_COMPLETED\"] = \"input_text_buffer.completed\";\n    /** Received `speech.update` event */ WebsocketsEventType[\"SPEECH_AUDIO_UPDATE\"] = \"speech.audio.update\";\n    /** All audio received, can close connection */ WebsocketsEventType[\"SPEECH_AUDIO_COMPLETED\"] = \"speech.audio.completed\";\n    // v1/audio/transcriptions\n    /** Send audio to server */ WebsocketsEventType[\"INPUT_AUDIO_BUFFER_APPEND\"] = \"input_audio_buffer.append\";\n    /** No audio to send, after text all received, can close connection */ WebsocketsEventType[\"INPUT_AUDIO_BUFFER_COMPLETE\"] = \"input_audio_buffer.complete\";\n    /** Send transcriptions config to server */ WebsocketsEventType[\"TRANSCRIPTIONS_UPDATE\"] = \"transcriptions.update\";\n    /** Send `input_audio_buffer.clear` event */ WebsocketsEventType[\"INPUT_AUDIO_BUFFER_CLEAR\"] = \"input_audio_buffer.clear\";\n    /** After transcriptions created */ WebsocketsEventType[\"TRANSCRIPTIONS_CREATED\"] = \"transcriptions.created\";\n    /** Received `input_audio_buffer.complete` event */ WebsocketsEventType[\"INPUT_AUDIO_BUFFER_COMPLETED\"] = \"input_audio_buffer.completed\";\n    /** Received `transcriptions.update` event */ WebsocketsEventType[\"TRANSCRIPTIONS_MESSAGE_UPDATE\"] = \"transcriptions.message.update\";\n    /** All audio received, can close connection */ WebsocketsEventType[\"TRANSCRIPTIONS_MESSAGE_COMPLETED\"] = \"transcriptions.message.completed\";\n    /** Received `input_audio_buffer.cleared` event */ WebsocketsEventType[\"INPUT_AUDIO_BUFFER_CLEARED\"] = \"input_audio_buffer.cleared\";\n    /** Received `transcriptions.updated` event */ WebsocketsEventType[\"TRANSCRIPTIONS_UPDATED\"] = \"transcriptions.updated\";\n    // v1/chat\n    /** Send chat config to server */ WebsocketsEventType[\"CHAT_UPDATE\"] = \"chat.update\";\n    /** Send tool outputs to server */ WebsocketsEventType[\"CONVERSATION_CHAT_SUBMIT_TOOL_OUTPUTS\"] = \"conversation.chat.submit_tool_outputs\";\n    /** After chat created */ WebsocketsEventType[\"CHAT_CREATED\"] = \"chat.created\";\n    /** After chat updated */ WebsocketsEventType[\"CHAT_UPDATED\"] = \"chat.updated\";\n    /** Audio AST completed, chat started */ WebsocketsEventType[\"CONVERSATION_CHAT_CREATED\"] = \"conversation.chat.created\";\n    /** Message created */ WebsocketsEventType[\"CONVERSATION_MESSAGE_CREATE\"] = \"conversation.message.create\";\n    /** Clear conversation */ WebsocketsEventType[\"CONVERSATION_CLEAR\"] = \"conversation.clear\";\n    /** Chat in progress */ WebsocketsEventType[\"CONVERSATION_CHAT_IN_PROGRESS\"] = \"conversation.chat.in_progress\";\n    /** Get agent text message update */ WebsocketsEventType[\"CONVERSATION_MESSAGE_DELTA\"] = \"conversation.message.delta\";\n    /** Need plugin submit */ WebsocketsEventType[\"CONVERSATION_CHAT_REQUIRES_ACTION\"] = \"conversation.chat.requires_action\";\n    /** Message completed */ WebsocketsEventType[\"CONVERSATION_MESSAGE_COMPLETED\"] = \"conversation.message.completed\";\n    /** Get agent audio message update */ WebsocketsEventType[\"CONVERSATION_AUDIO_DELTA\"] = \"conversation.audio.delta\";\n    /** Audio message completed */ WebsocketsEventType[\"CONVERSATION_AUDIO_COMPLETED\"] = \"conversation.audio.completed\";\n    /** All message received, can close connection */ WebsocketsEventType[\"CONVERSATION_CHAT_COMPLETED\"] = \"conversation.chat.completed\";\n    /** Chat failed */ WebsocketsEventType[\"CONVERSATION_CHAT_FAILED\"] = \"conversation.chat.failed\";\n    /** Received `conversation.cleared` event */ WebsocketsEventType[\"CONVERSATION_CLEARED\"] = \"conversation.cleared\";\n    /** Speech started */ WebsocketsEventType[\"INPUT_AUDIO_BUFFER_SPEECH_STARTED\"] = \"input_audio_buffer.speech_started\";\n    /** Speech stopped */ WebsocketsEventType[\"INPUT_AUDIO_BUFFER_SPEECH_STOPPED\"] = \"input_audio_buffer.speech_stopped\";\n    /** Chat interrupted by client */ WebsocketsEventType[\"CONVERSATION_CHAT_CANCEL\"] = \"conversation.chat.cancel\";\n    /** Chat canceled */ WebsocketsEventType[\"CONVERSATION_CHAT_CANCELED\"] = \"conversation.chat.canceled\";\n    /** Audio transcript update */ WebsocketsEventType[\"CONVERSATION_AUDIO_TRANSCRIPT_UPDATE\"] = \"conversation.audio_transcript.update\";\n    /** Audio transcript completed */ WebsocketsEventType[\"CONVERSATION_AUDIO_TRANSCRIPT_COMPLETED\"] = \"conversation.audio_transcript.completed\";\n    /** Audio sentence start */ WebsocketsEventType[\"CONVERSATION_AUDIO_SENTENCE_START\"] = \"conversation.audio.sentence_start\";\n    /** Audio dump */ WebsocketsEventType[\"DUMP_AUDIO\"] = \"dump.audio\";\n    // v1/audio/simult_interpretation\n    WebsocketsEventType[\"SIMULT_INTERPRETATION_UPDATE\"] = \"simult_interpretation.update\";\n    WebsocketsEventType[\"SIMULT_INTERPRETATION_CREATED\"] = \"simult_interpretation.created\";\n    WebsocketsEventType[\"SIMULT_INTERPRETATION_UPDATED\"] = \"simult_interpretation.updated\";\n    WebsocketsEventType[\"SIMULT_INTERPRETATION_AUDIO_DELTA\"] = \"simult_interpretation.audio.delta\";\n    WebsocketsEventType[\"SIMULT_INTERPRETATION_TRANSCRIPTION_DELTA\"] = \"simult_interpretation.transcription.delta\";\n    WebsocketsEventType[\"SIMULT_INTERPRETATION_TRANSLATION_DELTA\"] = \"simult_interpretation.translation.delta\";\n    WebsocketsEventType[\"SIMULT_INTERPRETATION_MESSAGE_COMPLETED\"] = \"simult_interpretation.message.completed\";\n    return WebsocketsEventType;\n}({});\nclass Websockets extends APIResource {\n    constructor(...args){\n        super(...args), this.audio = new audio_Audio(this._client), this.chat = new chat_Chat(this._client);\n    }\n}\nclass Variables extends APIResource {\n    /**\n   * Set values for user variables\n   * @docs en: https://www.coze.com/open/docs/developer_guides/update_variable\n   * @docs zh: https://www.coze.cn/open/docs/developer_guides/update_variable\n   * @param params - The parameters for the variable update\n   * @param options - Optional request options\n   */ async update(params, options) {\n        const apiUrl = '/v1/variables';\n        await this._client.put(apiUrl, params, false, options);\n    }\n    /**\n   * Get the values of user variables\n   * @docs en: https://www.coze.com/open/docs/developer_guides/read_variable\n   * @docs zh: https://www.coze.cn/open/docs/developer_guides/read_variable\n   * @param params - The parameters for the variable retrieval\n   * @param options - Optional request options\n   */ async retrieve(params, options) {\n        const apiUrl = '/v1/variables';\n        const response = await this._client.get(apiUrl, params, false, options);\n        return response.data;\n    }\n}\n/**\n * Users client for interacting with user-related APIs\n */ class Users extends APIResource {\n    /**\n   * Get information about the authenticated user.\n   * @param options - Optional request configuration options.\n   * @returns Information about the authenticated user.\n   */ async me(options) {\n        const apiUrl = '/v1/users/me';\n        const result = await this._client.get(apiUrl, void 0, false, options);\n        return result.data;\n    }\n}\nconst external_ws_namespaceObject = require(\"ws\");\nvar external_ws_default = /*#__PURE__*/ __webpack_require__.n(external_ws_namespaceObject);\nconst external_reconnecting_websocket_namespaceObject = require(\"reconnecting-websocket\");\nvar external_reconnecting_websocket_default = /*#__PURE__*/ __webpack_require__.n(external_reconnecting_websocket_namespaceObject);\nclass WebSocketAPI {\n    // Standard WebSocket properties\n    get readyState() {\n        return this.rws.readyState;\n    }\n    // Standard WebSocket methods\n    send(data) {\n        return this.rws.send(JSON.stringify(data));\n    }\n    close(code, reason) {\n        return this.rws.close(code, reason);\n    }\n    reconnect(code, reason) {\n        return this.rws.reconnect(code, reason);\n    }\n    // Event listener methods\n    addEventListener(type, listener) {\n        this.rws.addEventListener(type, listener);\n    }\n    removeEventListener(type, listener) {\n        this.rws.removeEventListener(type, listener);\n    }\n    constructor(url, options = {}){\n        // Event handler methods\n        this.onmessage = null;\n        this.onopen = null;\n        this.onclose = null;\n        this.onerror = null;\n        const separator = url.includes('?') ? '&' : '?';\n        const { authorization } = options.headers || {};\n        // Get the appropriate WebSocket implementation\n        let WebSocketImpl;\n        if (isUniApp()) {\n            // Use MiniApp WebSocket implementation\n            const factory = 'function' == typeof getMiniAppWebSocketFactory ? getMiniAppWebSocketFactory() : null;\n            WebSocketImpl = factory ? factory.getWebSocketImplementation() : window.WebSocket;\n        } else // Use browser's native WebSocket\n        WebSocketImpl = isBrowser() ? window.WebSocket : class extends external_ws_default() {\n            constructor(url2, protocols){\n                super(url2, protocols, {\n                    headers: options.headers\n                });\n            }\n        };\n        this.rws = new (external_reconnecting_websocket_default())(`${url}${separator}authorization=${authorization}`, [], {\n            WebSocket: WebSocketImpl,\n            ...options\n        });\n        this.rws.addEventListener('message', (event)=>{\n            try {\n                var _this_onmessage, _this;\n                const data = JSON.parse(event.data);\n                null === (_this_onmessage = (_this = this).onmessage) || void 0 === _this_onmessage || _this_onmessage.call(_this, data, event);\n            } catch (error) {\n                console.error('WebSocketAPI onmessage error', error);\n            }\n        });\n        this.rws.addEventListener('open', (event)=>{\n            var _this_onopen, _this;\n            null === (_this_onopen = (_this = this).onopen) || void 0 === _this_onopen || _this_onopen.call(_this, event);\n        });\n        this.rws.addEventListener('close', (event)=>{\n            var _this_onclose, _this;\n            null === (_this_onclose = (_this = this).onclose) || void 0 === _this_onclose || _this_onclose.call(_this, event);\n        });\n        this.rws.addEventListener('error', (event)=>{\n            var _event_target__req_res, _event_target__req, _event_target, _event_target__req_res1, _event_target__req1, _event_target1, _this_onerror, _this;\n            const { readyState } = this.rws;\n            if (3 === readyState) return;\n            const statusCode = null === (_event_target = event.target) || void 0 === _event_target ? void 0 : null === (_event_target__req = _event_target._req) || void 0 === _event_target__req ? void 0 : null === (_event_target__req_res = _event_target__req.res) || void 0 === _event_target__req_res ? void 0 : _event_target__req_res.statusCode;\n            const rawHeaders = (null === (_event_target1 = event.target) || void 0 === _event_target1 ? void 0 : null === (_event_target__req1 = _event_target1._req) || void 0 === _event_target__req1 ? void 0 : null === (_event_target__req_res1 = _event_target__req1.res) || void 0 === _event_target__req_res1 ? void 0 : _event_target__req_res1.rawHeaders) || [];\n            const logidIndex = rawHeaders.findIndex((header)=>'X-Tt-Logid' === header);\n            const logid = -1 !== logidIndex ? rawHeaders[logidIndex + 1] : void 0;\n            const error = {\n                id: '0',\n                event_type: types_WebsocketsEventType.ERROR,\n                data: {\n                    code: -1,\n                    msg: 'WebSocket error'\n                },\n                detail: {\n                    logid\n                }\n            };\n            if (401 === statusCode) {\n                error.data.code = 401;\n                error.data.msg = 'Unauthorized';\n            } else if (403 === statusCode) {\n                error.data.code = 403;\n                error.data.msg = 'Forbidden';\n            } else {\n                error.data.code = 500;\n                var _event_error;\n                error.data.msg = String(null !== (_event_error = null == event ? void 0 : event.error) && void 0 !== _event_error ? _event_error : '') || 'WebSocket error';\n            }\n            null === (_this_onerror = (_this = this).onerror) || void 0 === _this_onerror || _this_onerror.call(_this, error, event);\n        });\n    }\n}\nconst external_os_namespaceObject = require(\"os\");\nvar external_os_default = /*#__PURE__*/ __webpack_require__.n(external_os_namespaceObject);\nvar package_namespaceObject = JSON.parse('{\"name\":\"@coze/api\",\"version\":\"1.3.9\",\"description\":\"Official Coze Node.js SDK for seamless AI integration into your applications | 扣子官方 Node.js SDK，助您轻松集成 AI 能力到应用中\",\"keywords\":[\"coze\",\"ai\",\"nodejs\",\"sdk\",\"chatbot\",\"typescript\"],\"homepage\":\"https://github.com/coze-dev/coze-js/tree/main/packages/coze-js\",\"bugs\":{\"url\":\"https://github.com/coze-dev/coze-js/issues\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/coze-dev/coze-js.git\",\"directory\":\"packages/coze-js\"},\"license\":\"MIT\",\"author\":\"Leeight <leeight@gmail.com>\",\"exports\":{\".\":\"./src/index.ts\",\"./ws-tools\":\"./src/ws-tools/index.ts\"},\"main\":\"src/index.ts\",\"unpkg\":\"dist/umd/index.js\",\"module\":\"src/index.ts\",\"browser\":{\"crypto\":false,\"os\":false,\"jsonwebtoken\":false,\"node-fetch\":false,\"ws\":false},\"typesVersions\":{\"*\":{\".\":[\"dist/types/index.d.ts\"],\"ws-tools\":[\"dist/types/ws-tools/ws-tools/index.d.ts\"]}},\"files\":[\"dist\",\"LICENSE\",\"README.md\",\"README.zh-CN.md\"],\"scripts\":{\"build\":\"rslib build\",\"format\":\"prettier --write .\",\"lint\":\"eslint ./ --cache --quiet\",\"start\":\"rslib build -w\",\"test\":\"vitest\",\"test:cov\":\"vitest --coverage --run\"},\"dependencies\":{\"agora-extension-ai-denoiser\":\"^1.0.0\",\"agora-rtc-sdk-ng\":\"4.23.2-1\",\"agora-rte-extension\":\"^1.2.4\",\"jsonwebtoken\":\"^9.0.2\",\"node-fetch\":\"^2.x\",\"opus-encdec\":\"^0.1.1\",\"reconnecting-websocket\":\"^4.4.0\",\"uuid\":\"^10.0.0\",\"ws\":\"^8.11.0\"},\"devDependencies\":{\"@coze-infra/eslint-config\":\"workspace:*\",\"@coze-infra/ts-config\":\"workspace:*\",\"@coze-infra/vitest-config\":\"workspace:*\",\"@rslib/core\":\"0.0.18\",\"@swc/core\":\"^1.3.14\",\"@types/jsonwebtoken\":\"^9.0.0\",\"@types/node\":\"^20\",\"@types/node-fetch\":\"^2.x\",\"@types/uuid\":\"^9.0.1\",\"@types/whatwg-fetch\":\"^0.0.33\",\"@types/ws\":\"^8.5.1\",\"@vitest/coverage-v8\":\"~2.1.9\",\"axios\":\"^1.7.7\",\"typescript\":\"^5.5.3\",\"vitest\":\"~2.1.9\"},\"peerDependencies\":{\"axios\":\"^1.7.1\"},\"publishConfig\":{\"access\":\"public\",\"registry\":\"https://registry.npmjs.org\"},\"cozePublishConfig\":{\"exports\":{\".\":{\"require\":\"./dist/cjs/index.js\",\"import\":\"./dist/esm/index.mjs\",\"types\":\"./dist/types/index.d.ts\"},\"./ws-tools\":{\"require\":\"./dist/cjs/ws-tools/index.js\",\"import\":\"./dist/esm/ws-tools/index.mjs\",\"types\":\"./dist/types/ws-tools/ws-tools/index.d.ts\"}},\"main\":\"dist/cjs/index.js\",\"module\":\"dist/esm/index.mjs\",\"types\":\"dist/types/index.d.ts\"},\"overrides\":{\"agora-extension-ai-denoiser\":{\"agora-rtc-sdk-ng\":\"$agora-rtc-sdk-ng\"}}}'); // CONCATENATED MODULE: ./src/version.ts\nconst { version: version_version } = package_namespaceObject;\nconst getEnv = ()=>{\n    const nodeVersion = process.version.slice(1); // Remove 'v' prefix\n    const { platform } = process;\n    let osName = platform.toLowerCase();\n    let osVersion = external_os_default().release();\n    if ('darwin' === platform) {\n        osName = 'macos';\n        // Try to parse the macOS version\n        try {\n            const darwinVersion = external_os_default().release().split('.');\n            if (darwinVersion.length >= 2) {\n                const majorVersion = parseInt(darwinVersion[0], 10);\n                if (!isNaN(majorVersion) && majorVersion >= 9) {\n                    const macVersion = majorVersion - 9;\n                    osVersion = `10.${macVersion}.${darwinVersion[1]}`;\n                }\n            }\n        } catch (error) {\n        // Keep the default os.release() value if parsing fails\n        }\n    } else if ('win32' === platform) {\n        osName = 'windows';\n        osVersion = external_os_default().release();\n    } else if ('linux' === platform) {\n        osName = 'linux';\n        osVersion = external_os_default().release();\n    }\n    return {\n        osName,\n        osVersion,\n        nodeVersion\n    };\n};\nconst getUserAgent = ()=>{\n    const { nodeVersion, osName, osVersion } = getEnv();\n    return `coze-js/${version_version} node/${nodeVersion} ${osName}/${osVersion}`.toLowerCase();\n};\nconst getNodeClientUserAgent = ()=>{\n    const { osVersion, nodeVersion, osName } = getEnv();\n    const ua = {\n        version: version_version,\n        lang: 'node',\n        lang_version: nodeVersion,\n        os_name: osName,\n        os_version: osVersion\n    };\n    return JSON.stringify(ua);\n};\nconst getBrowserClientUserAgent = ()=>{\n    const browserInfo = {\n        name: 'unknown',\n        version: 'unknown'\n    };\n    const osInfo = {\n        name: 'unknown',\n        version: 'unknown'\n    };\n    const { userAgent } = navigator;\n    if (userAgent) {\n        // 检测操作系统及版本\n        if (userAgent.indexOf('Windows') > -1) {\n            var _userAgent_match;\n            osInfo.name = 'windows';\n            const windowsVersion = (null === (_userAgent_match = userAgent.match(/Windows NT ([0-9.]+)/)) || void 0 === _userAgent_match ? void 0 : _userAgent_match[1]) || 'unknown';\n            osInfo.version = windowsVersion;\n        } else if (userAgent.indexOf('Mac OS X') > -1) {\n            var _userAgent_match1;\n            osInfo.name = 'macos';\n            // 将 10_15_7 格式转换为 10.15.7\n            osInfo.version = ((null === (_userAgent_match1 = userAgent.match(/Mac OS X ([0-9_]+)/)) || void 0 === _userAgent_match1 ? void 0 : _userAgent_match1[1]) || 'unknown').replace(/_/g, '.');\n        } else if (userAgent.indexOf('Linux') > -1) {\n            var _userAgent_match2;\n            osInfo.name = 'linux';\n            osInfo.version = (null === (_userAgent_match2 = userAgent.match(/Linux ([0-9.]+)/)) || void 0 === _userAgent_match2 ? void 0 : _userAgent_match2[1]) || 'unknown';\n        }\n        // 检测浏览器及版本\n        if (userAgent.indexOf('Chrome') > -1) {\n            var _userAgent_match3;\n            browserInfo.name = 'chrome';\n            browserInfo.version = (null === (_userAgent_match3 = userAgent.match(/Chrome\\/([0-9.]+)/)) || void 0 === _userAgent_match3 ? void 0 : _userAgent_match3[1]) || 'unknown';\n        } else if (userAgent.indexOf('Firefox') > -1) {\n            var _userAgent_match4;\n            browserInfo.name = 'firefox';\n            browserInfo.version = (null === (_userAgent_match4 = userAgent.match(/Firefox\\/([0-9.]+)/)) || void 0 === _userAgent_match4 ? void 0 : _userAgent_match4[1]) || 'unknown';\n        } else if (userAgent.indexOf('Safari') > -1) {\n            var _userAgent_match5;\n            browserInfo.name = 'safari';\n            browserInfo.version = (null === (_userAgent_match5 = userAgent.match(/Version\\/([0-9.]+)/)) || void 0 === _userAgent_match5 ? void 0 : _userAgent_match5[1]) || 'unknown';\n        }\n    }\n    const ua = {\n        version: version_version,\n        browser: browserInfo.name,\n        browser_version: browserInfo.version,\n        os_name: osInfo.name,\n        os_version: osInfo.version\n    };\n    return JSON.stringify(ua);\n};\n// Get UniApp client user agent\nconst getUniAppClientUserAgent = ()=>{\n    // Get system info\n    if (!(null == uni ? void 0 : uni.getSystemInfoSync)) return JSON.stringify({});\n    const systemInfo = uni.getSystemInfoSync();\n    const platformInfo = {\n        name: 'unknown',\n        version: 'unknown'\n    };\n    const osInfo = {\n        name: 'unknown',\n        version: 'unknown'\n    };\n    // Handle operating system info\n    if ('android' === systemInfo.platform) {\n        osInfo.name = 'android';\n        osInfo.version = systemInfo.system || 'unknown';\n    } else if ('ios' === systemInfo.platform) {\n        osInfo.name = 'ios';\n        osInfo.version = systemInfo.system || 'unknown';\n    } else if ('windows' === systemInfo.platform) {\n        osInfo.name = 'windows';\n        osInfo.version = systemInfo.system || 'unknown';\n    } else if ('mac' === systemInfo.platform) {\n        osInfo.name = 'macos';\n        osInfo.version = systemInfo.system || 'unknown';\n    } else {\n        // Other platforms use platform name directly\n        osInfo.name = systemInfo.platform;\n        osInfo.version = systemInfo.system || 'unknown';\n    }\n    // Handle app/platform info\n    if (systemInfo.AppPlatform) {\n        // App environment\n        platformInfo.name = systemInfo.AppPlatform.toLowerCase();\n        platformInfo.version = systemInfo.appVersion || 'unknown';\n    } else if (systemInfo.uniPlatform) {\n        // UniApp recognized platform\n        platformInfo.name = systemInfo.uniPlatform;\n        platformInfo.version = systemInfo.SDKVersion || 'unknown';\n    } else {\n        // Try to determine platform type from environment\n        const { appName, appVersion } = systemInfo;\n        if (appName) {\n            platformInfo.name = appName.toLowerCase();\n            platformInfo.version = appVersion || 'unknown';\n        }\n    }\n    const ua = {\n        version: version_version,\n        framework: 'uniapp',\n        platform: platformInfo.name,\n        platform_version: platformInfo.version,\n        os_name: osInfo.name,\n        os_version: osInfo.version,\n        screen_width: systemInfo.screenWidth,\n        screen_height: systemInfo.screenHeight,\n        device_model: systemInfo.model,\n        device_brand: systemInfo.brand\n    };\n    return JSON.stringify(ua);\n};\nconst external_node_fetch_namespaceObject = require(\"node-fetch\");\nvar external_node_fetch_default = /*#__PURE__*/ __webpack_require__.n(external_node_fetch_namespaceObject);\n/**\n * default coze  base URL is api.coze.com\n */ const COZE_COM_BASE_URL = 'https://api.coze.com';\n/**\n * change to api.coze.cn if you use https://coze.cn\n */ const COZE_CN_BASE_URL = 'https://api.coze.cn';\n/**\n * default base websocket URL is wss://ws.coze.com\n */ const COZE_COM_BASE_WS_URL = 'wss://ws.coze.com';\n/**\n * change to wss://ws.coze.cn if you use https://coze.cn\n */ const COZE_CN_BASE_WS_URL = 'wss://ws.coze.cn';\nconst POLL_INTERVAL = 5000;\nconst MAX_POLL_INTERVAL = 30000;\n/* eslint-disable @typescript-eslint/no-explicit-any */ const handleError = (error)=>{\n    if (!error.isAxiosError && (!error.code || !error.message)) return APIError.generate(500, void 0, `Unexpected error: ${error.message}`, void 0);\n    if ('ECONNABORTED' === error.code && error.message.includes('timeout') || 'ETIMEDOUT' === error.code) {\n        var _error_response;\n        return new TimeoutError(408, void 0, `Request timed out: ${error.message}`, null === (_error_response = error.response) || void 0 === _error_response ? void 0 : _error_response.headers);\n    }\n    if ('ERR_CANCELED' === error.code) return new APIUserAbortError(error.message);\n    else {\n        var _error_response1, _error_response2, _error_response3;\n        return APIError.generate((null === (_error_response1 = error.response) || void 0 === _error_response1 ? void 0 : _error_response1.status) || 500, null === (_error_response2 = error.response) || void 0 === _error_response2 ? void 0 : _error_response2.data, error.message, null === (_error_response3 = error.response) || void 0 === _error_response3 ? void 0 : _error_response3.headers);\n    }\n};\n// node-fetch is used for streaming requests\nconst adapterFetch = async (options)=>{\n    const response = await external_node_fetch_default()(options.url, {\n        body: options.data,\n        ...options\n    });\n    return {\n        data: response.body,\n        ...response\n    };\n};\nconst isSupportNativeFetch = ()=>{\n    if (isBrowser() || isBrowserExtension() || isUniApp()) return true;\n    // native fetch is supported in node 18.0.0 or higher\n    const version = process.version.slice(1);\n    return compareVersions(version, '18.0.0') >= 0;\n};\nasync function fetchAPI(url) {\n    let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};\n    const axiosInstance = options.axiosInstance || external_axios_default();\n    // Add version check for streaming requests\n    if (options.isStreaming && isAxiosStatic(axiosInstance)) {\n        const axiosVersion = axiosInstance.VERSION || external_axios_default().VERSION;\n        if (!axiosVersion || compareVersions(axiosVersion, '1.7.1') < 0) throw new CozeError('Streaming requests require axios version 1.7.1 or higher. Please upgrade your axios version.');\n    }\n    // Check for 4101 authentication error\n    // If BaseURL is set to overseas address, provide a warning to try setting it to the domestic address\n    const checkError = ()=>{\n        if (url.startsWith(COZE_COM_BASE_URL)) console.warn(`\n鉴权失败，如果您是国内用户，请将 baseURL 设置为 ${COZE_CN_BASE_URL} 示例：\nnew CozeAPI({\n  // ...\n  baseURL: COZE_CN_BASE_URL\n})`);\n    };\n    const response = await axiosInstance({\n        url,\n        responseType: options.isStreaming ? 'stream' : 'json',\n        adapter: options.isStreaming ? isSupportNativeFetch() ? 'fetch' : adapterFetch : void 0,\n        ...options\n    }).catch((error)=>{\n        if ((null == error ? void 0 : error.status) === 401) checkError();\n        throw handleError(error);\n    });\n    return {\n        async *stream () {\n            try {\n                const stream = response.data;\n                const reader = stream[Symbol.asyncIterator] ? stream[Symbol.asyncIterator]() : stream.getReader();\n                const decoder = new TextDecoder();\n                const fieldValues = {};\n                let buffer = '';\n                while(true){\n                    const { done, value } = await (reader.next ? reader.next() : reader.read());\n                    if (done) {\n                        if (buffer) {\n                            // If the stream ends without a newline, it means an error occurred\n                            fieldValues.event = 'error';\n                            fieldValues.data = buffer;\n                            try {\n                                const error = JSON.parse(buffer);\n                                if ((null == error ? void 0 : error.code) === 4101) checkError();\n                            // eslint-disable-next-line no-empty\n                            } catch (e) {}\n                            yield fieldValues;\n                        }\n                        break;\n                    }\n                    buffer += decoder.decode(value, {\n                        stream: true\n                    });\n                    const lines = buffer.split('\\n');\n                    for(let i = 0; i < lines.length - 1; i++){\n                        const line = lines[i];\n                        const index = line.indexOf(':');\n                        if (-1 !== index) {\n                            const field = line.substring(0, index).trim();\n                            const content = line.substring(index + 1).trim();\n                            fieldValues[field] = content;\n                            if ('data' === field) yield fieldValues;\n                        }\n                    }\n                    buffer = lines[lines.length - 1]; // Keep the last incomplete line in the buffer\n                }\n            } catch (error) {\n                handleError(error);\n            }\n        },\n        json: ()=>response.data,\n        response\n    };\n}\n// Add version comparison utility\nfunction compareVersions(v1, v2) {\n    const v1Parts = v1.split('.').map(Number);\n    const v2Parts = v2.split('.').map(Number);\n    for(let i = 0; i < 3; i++){\n        const part1 = v1Parts[i] || 0;\n        const part2 = v2Parts[i] || 0;\n        if (part1 > part2) return 1;\n        if (part1 < part2) return -1;\n    }\n    return 0;\n}\nfunction isAxiosStatic(instance) {\n    return !!(null == instance ? void 0 : instance.Axios);\n}\n/* eslint-disable max-params */ class APIClient {\n    async getToken() {\n        if ('function' == typeof this.token) return await this.token();\n        return this.token;\n    }\n    async buildOptions(method, body, options) {\n        const token = await this.getToken();\n        const headers = {\n            authorization: `Bearer ${token}`\n        };\n        if (isUniApp()) headers['X-Coze-Client-User-Agent'] = getUniAppClientUserAgent();\n        else if (isBrowser() || isBrowserExtension()) headers['X-Coze-Client-User-Agent'] = getBrowserClientUserAgent();\n        else {\n            headers['User-Agent'] = getUserAgent();\n            headers['X-Coze-Client-User-Agent'] = getNodeClientUserAgent();\n        }\n        const config = mergeConfig(this.axiosOptions, options, {\n            headers\n        }, {\n            headers: this.headers || {}\n        });\n        config.method = method;\n        config.data = body;\n        return config;\n    }\n    async buildWebsocketOptions(options) {\n        const token = await this.getToken();\n        const headers = {\n            authorization: `Bearer ${token}`\n        };\n        if (isUniApp()) headers['X-Coze-Client-User-Agent'] = getUniAppClientUserAgent();\n        else if (isBrowser()) headers['X-Coze-Client-User-Agent'] = getBrowserClientUserAgent();\n        else {\n            headers['User-Agent'] = getUserAgent();\n            headers['X-Coze-Client-User-Agent'] = getNodeClientUserAgent();\n        }\n        var _this__config_debug;\n        const config = mergeConfig({\n            debug: null !== (_this__config_debug = this._config.debug) && void 0 !== _this__config_debug && _this__config_debug\n        }, this._config.websocketOptions, options, {\n            headers\n        }, {\n            headers: this.headers || {}\n        });\n        return config;\n    }\n    async makeRequest(apiUrl, method, body, isStream, options) {\n        const fullUrl = `${this.baseURL}${apiUrl}`;\n        try {\n            const fetchOptions = await this.buildOptions(method, body, options);\n            fetchOptions.isStreaming = isStream;\n            fetchOptions.axiosInstance = this.axiosInstance;\n            this.debugLog(null == options ? void 0 : options.debug, `--- request url: ${fullUrl}`);\n            this.debugLog(null == options ? void 0 : options.debug, '--- request options:', fetchOptions);\n            const { response, stream, json } = await fetchAPI(fullUrl, fetchOptions);\n            this.debugLog(null == options ? void 0 : options.debug, `--- response status: ${response.status}`);\n            this.debugLog(null == options ? void 0 : options.debug, '--- response headers: ', response.headers);\n            var _response_headers;\n            // Taro use `header`\n            const contentType = (null !== (_response_headers = response.headers) && void 0 !== _response_headers ? _response_headers : response.header)['content-type'];\n            if (isStream) {\n                if (contentType && contentType.includes('application/json')) {\n                    const result = await json();\n                    const { code, msg } = result;\n                    if (0 !== code && void 0 !== code) throw APIError.generate(response.status, result, msg, response.headers);\n                }\n                return stream();\n            }\n            if (!(contentType && contentType.includes('application/json'))) return await response.data;\n            {\n                const result = await json();\n                const { code, msg } = result;\n                if (0 !== code && void 0 !== code) throw APIError.generate(response.status, result, msg, response.headers);\n                return result;\n            }\n        } catch (error) {\n            var _this__config;\n            // Call the onApiError callback if provided\n            // This handles network errors and other exceptions not caught above\n            const onApiError = (null == options ? void 0 : options.onApiError) || (null === (_this__config = this._config) || void 0 === _this__config ? void 0 : _this__config.onApiError);\n            if (onApiError) onApiError(error);\n            // Re-throw the error after calling the callback\n            throw error;\n        }\n    }\n    async post(apiUrl, body) {\n        let isStream = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], options = arguments.length > 3 ? arguments[3] : void 0;\n        return this.makeRequest(apiUrl, 'POST', body, isStream, options);\n    }\n    async get(apiUrl, param, isStream, options) {\n        // 拼接参数\n        const queryString = Object.entries(param || {}).filter((param)=>{\n            let [_, value] = param;\n            return null != value;\n        }).map((param)=>{\n            let [key, value] = param;\n            return `${key}=${value}`;\n        }).join('&');\n        return this.makeRequest(queryString ? `${apiUrl}${apiUrl.includes('?') ? '&' : '?'}${queryString}` : apiUrl, 'GET', void 0, isStream, options);\n    }\n    async put(apiUrl, body, isStream, options) {\n        return this.makeRequest(apiUrl, 'PUT', body, isStream, options);\n    }\n    async delete(apiUrl, isStream, options) {\n        return this.makeRequest(apiUrl, 'DELETE', void 0, isStream, options);\n    }\n    async makeWebsocket(apiUrl, options) {\n        const fullUrl = `${this.baseWsURL}${apiUrl}`;\n        const websocketOptions = await this.buildWebsocketOptions(options);\n        this.debugLog(null == options ? void 0 : options.debug, `--- websocket url: ${fullUrl}`);\n        this.debugLog(null == options ? void 0 : options.debug, '--- websocket options:', websocketOptions);\n        const ws = new WebSocketAPI(fullUrl, websocketOptions);\n        return ws;\n    }\n    getConfig() {\n        return this._config;\n    }\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    debugLog() {\n        let forceDebug = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];\n        for(var _len = arguments.length, msgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)msgs[_key - 1] = arguments[_key];\n        if (this.debug || forceDebug) console.debug(...msgs);\n    }\n    constructor(config){\n        this._config = config;\n        this.baseURL = config.baseURL || COZE_COM_BASE_URL;\n        this.baseWsURL = config.baseWsURL || COZE_CN_BASE_WS_URL;\n        this.token = config.token;\n        this.axiosOptions = config.axiosOptions || {};\n        this.axiosInstance = config.axiosInstance;\n        this.debug = config.debug || false;\n        this.allowPersonalAccessTokenInBrowser = config.allowPersonalAccessTokenInBrowser || false;\n        this.headers = config.headers;\n        if (isBrowser() && 'function' != typeof this.token && isPersonalAccessToken(this.token) && !this.allowPersonalAccessTokenInBrowser) throw new CozeError('Browser environments do not support authentication using Personal Access Token (PAT) by default.\\nas it may expose secret API keys. \\n\\nPlease use OAuth2.0 authentication mechanism. see:\\nhttps://www.coze.com/docs/developer_guides/oauth_apps?_lang=en \\n\\nIf you need to force use, please set the `allowPersonalAccessTokenInBrowser` option to `true`. \\n\\ne.g new CozeAPI({ token, allowPersonalAccessTokenInBrowser: true });\\n\\n');\n    }\n}\nAPIClient.APIError = APIError;\nAPIClient.BadRequestError = BadRequestError;\nAPIClient.AuthenticationError = AuthenticationError;\nAPIClient.PermissionDeniedError = PermissionDeniedError;\nAPIClient.NotFoundError = NotFoundError;\nAPIClient.RateLimitError = RateLimitError;\nAPIClient.InternalServerError = InternalServerError;\nAPIClient.GatewayError = GatewayError;\nAPIClient.TimeoutError = TimeoutError;\nAPIClient.UserAbortError = APIUserAbortError;\nconst external_crypto_namespaceObject = require(\"crypto\");\nconst external_jsonwebtoken_namespaceObject = require(\"jsonwebtoken\");\nvar external_jsonwebtoken_default = /*#__PURE__*/ __webpack_require__.n(external_jsonwebtoken_namespaceObject);\nconst getCrypto = ()=>{\n    if (isUniApp()) return {\n        getRandomValues: uni.getRandomValues,\n        subtle: {\n            // TODO Currently not supporting uniapp, will provide support later if needed\n            digest: ()=>{\n                console.error('digest is not supported in uniapp');\n                throw new Error('digest is not supported in uniapp');\n            }\n        }\n    };\n    if (isBrowser() || isBrowserExtension()) {\n        if ('undefined' != typeof self && self.crypto) return self.crypto;\n        if ('undefined' != typeof window && window.crypto) return window.crypto;\n    }\n    // #ifndef MP\n    return {\n        getRandomValues: (array)=>external_crypto_namespaceObject.randomFillSync(array),\n        subtle: external_crypto_namespaceObject.subtle\n    };\n// #endif\n};\nconst generateRandomString = ()=>{\n    const array = new Uint8Array(32);\n    getCrypto().getRandomValues(array);\n    return Array.from(array, (byte)=>byte.toString(16).padStart(2, '0')).join('');\n};\nconst getWebAuthenticationUrl = (config)=>{\n    var _config_baseURL;\n    const baseUrl = (null !== (_config_baseURL = config.baseURL) && void 0 !== _config_baseURL ? _config_baseURL : COZE_COM_BASE_URL).replace('https://api', 'https://www');\n    var _config_state;\n    const params = new URLSearchParams({\n        response_type: 'code',\n        client_id: config.clientId,\n        redirect_uri: config.redirectUrl,\n        state: null !== (_config_state = config.state) && void 0 !== _config_state ? _config_state : ''\n    });\n    if (config.workspaceId) return `${baseUrl}/api/permission/oauth2/workspace_id/${config.workspaceId}/authorize?${params.toString()}`;\n    return `${baseUrl}/api/permission/oauth2/authorize?${params.toString()}`;\n};\nconst getPKCEAuthenticationUrl = async (config)=>{\n    var _config_baseURL;\n    const baseUrl = (null !== (_config_baseURL = config.baseURL) && void 0 !== _config_baseURL ? _config_baseURL : COZE_COM_BASE_URL).replace('https://api', 'https://www');\n    const crypto = getCrypto();\n    // Generate code_challenge from code_verifier\n    const generateCodeChallenge = async (codeVerifier)=>{\n        const encoder = new TextEncoder();\n        const data = encoder.encode(codeVerifier);\n        const hash = await crypto.subtle.digest('SHA-256', data);\n        return btoa(String.fromCharCode(...new Uint8Array(hash))).replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n    };\n    // Generate a random code_verifier\n    const codeVerifier = generateRandomString();\n    const codeChallenge = await generateCodeChallenge(codeVerifier);\n    var _config_state;\n    const params = new URLSearchParams({\n        response_type: 'code',\n        client_id: config.clientId,\n        redirect_uri: config.redirectUrl,\n        state: null !== (_config_state = config.state) && void 0 !== _config_state ? _config_state : '',\n        code_challenge: codeChallenge,\n        code_challenge_method: config.code_challenge_method || 'S256'\n    });\n    if (config.workspaceId) return {\n        url: `${baseUrl}/api/permission/oauth2/workspace_id/${config.workspaceId}/authorize?${params.toString()}`,\n        codeVerifier\n    };\n    return {\n        url: `${baseUrl}/api/permission/oauth2/authorize?${params.toString()}`,\n        codeVerifier\n    };\n};\nconst getWebOAuthToken = async (config, options)=>{\n    const api = new APIClient({\n        token: config.clientSecret,\n        baseURL: config.baseURL\n    });\n    const apiUrl = '/api/permission/oauth2/token';\n    const payload = {\n        grant_type: 'authorization_code',\n        client_id: config.clientId,\n        redirect_uri: config.redirectUrl,\n        code: config.code\n    };\n    const result = await api.post(apiUrl, payload, false, options);\n    return result;\n};\nconst getPKCEOAuthToken = async (config, options)=>{\n    const api = new APIClient({\n        token: '',\n        baseURL: config.baseURL\n    });\n    const apiUrl = '/api/permission/oauth2/token';\n    const payload = {\n        grant_type: 'authorization_code',\n        client_id: config.clientId,\n        redirect_uri: config.redirectUrl,\n        code: config.code,\n        code_verifier: config.codeVerifier\n    };\n    const result = await api.post(apiUrl, payload, false, options);\n    return result;\n};\nconst refreshOAuthToken = async (config, options)=>{\n    const api = new APIClient({\n        token: config.clientSecret || '',\n        baseURL: config.baseURL\n    });\n    const apiUrl = '/api/permission/oauth2/token';\n    const payload = {\n        grant_type: 'refresh_token',\n        client_id: config.clientId,\n        refresh_token: config.refreshToken\n    };\n    const result = await api.post(apiUrl, payload, false, options);\n    return result;\n};\nconst getDeviceCode = async (config, options)=>{\n    if (isBrowser()) throw new Error('getDeviceCode is not supported in browser');\n    const api = new APIClient({\n        token: '',\n        baseURL: config.baseURL\n    });\n    let apiUrl;\n    apiUrl = config.workspaceId ? `/api/permission/oauth2/workspace_id/${config.workspaceId}/device/code` : '/api/permission/oauth2/device/code';\n    const payload = {\n        client_id: config.clientId\n    };\n    const result = await api.post(apiUrl, payload, false, options);\n    return result;\n};\nconst _getDeviceToken = async (config, options)=>{\n    const api = new APIClient({\n        token: '',\n        baseURL: config.baseURL\n    });\n    const apiUrl = '/api/permission/oauth2/token';\n    const payload = {\n        grant_type: 'urn:ietf:params:oauth:grant-type:device_code',\n        client_id: config.clientId,\n        device_code: config.deviceCode\n    };\n    const result = await api.post(apiUrl, payload, false, options);\n    return result;\n};\nconst getDeviceToken = async (config, options)=>{\n    if (isBrowser()) throw new Error('getDeviceToken is not supported in browser');\n    if (!config.poll) return _getDeviceToken(config, options);\n    let interval = POLL_INTERVAL;\n    while(true)try {\n        // Attempt to get the device token\n        const deviceToken = await _getDeviceToken(config, options);\n        return deviceToken;\n    } catch (error) {\n        if (error instanceof APIError) {\n            var _error_rawError, _error_rawError1;\n            // If the error is authorization_pending, continue polling\n            if ((null == error ? void 0 : null === (_error_rawError = error.rawError) || void 0 === _error_rawError ? void 0 : _error_rawError.error) === \"authorization_pending\") {\n                await sleep(interval);\n                continue;\n            // If the error is slow_down, increase the interval\n            }\n            if ((null == error ? void 0 : null === (_error_rawError1 = error.rawError) || void 0 === _error_rawError1 ? void 0 : _error_rawError1.error) === \"slow_down\") {\n                if (interval < MAX_POLL_INTERVAL) interval += POLL_INTERVAL;\n                await sleep(interval);\n                continue;\n            }\n        }\n        // For any other error, throw it\n        throw error;\n    }\n};\nconst _getJWTToken = async (config, options)=>{\n    const api = new APIClient({\n        token: config.token,\n        baseURL: config.baseURL\n    });\n    let apiUrl;\n    apiUrl = config.accountId ? `/api/permission/oauth2/account/${config.accountId}/token` : '/api/permission/oauth2/token';\n    var _config_durationSeconds;\n    const payload = {\n        grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',\n        duration_seconds: null !== (_config_durationSeconds = config.durationSeconds) && void 0 !== _config_durationSeconds ? _config_durationSeconds : 900,\n        scope: config.scope\n    };\n    const result = await api.post(apiUrl, payload, false, options);\n    return result;\n};\nconst getJWTToken = async (config, options)=>{\n    if (isBrowser()) throw new Error('getJWTToken is not supported in browser');\n    // Validate private key format\n    const keyFormat = config.privateKey.includes('BEGIN RSA PRIVATE KEY') ? 'RSA' : config.privateKey.includes('BEGIN PRIVATE KEY') ? 'PKCS8' : null;\n    if (!keyFormat) throw APIError.generate(400, void 0, 'Invalid private key format. Expected PEM format (RSA or PKCS8)', void 0);\n    // Prepare the payload for the JWT\n    const now = Math.floor(Date.now() / 1000);\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    const payload = {\n        iss: config.appId,\n        aud: config.aud,\n        iat: now,\n        exp: now + 3600,\n        jti: generateRandomString()\n    };\n    if (config.sessionName) payload.session_name = config.sessionName;\n    return new Promise((resolve, reject)=>{\n        var _config_algorithm;\n        external_jsonwebtoken_default().sign(payload, config.privateKey, {\n            algorithm: null !== (_config_algorithm = config.algorithm) && void 0 !== _config_algorithm ? _config_algorithm : 'RS256',\n            keyid: config.keyid\n        }, async (err, token)=>{\n            if (err || !token) {\n                reject(err);\n                return;\n            }\n            // Exchange the JWT for an OAuth token\n            try {\n                const result = await _getJWTToken({\n                    ...config,\n                    token\n                }, options);\n                resolve(result);\n            } catch (err2) {\n                reject(err2);\n            }\n        });\n    });\n};\nvar auth_PKCEAuthErrorType = /*#__PURE__*/ function(PKCEAuthErrorType) {\n    PKCEAuthErrorType[\"AUTHORIZATION_PENDING\"] = \"authorization_pending\";\n    PKCEAuthErrorType[\"SLOW_DOWN\"] = \"slow_down\";\n    PKCEAuthErrorType[\"ACCESS_DENIED\"] = \"access_denied\";\n    PKCEAuthErrorType[\"EXPIRED_TOKEN\"] = \"expired_token\";\n    return PKCEAuthErrorType;\n}({});\nclass CozeAPI extends APIClient {\n    constructor(...args){\n        super(...args), this.bots = new Bots(this), this.chat = new Chat(this), this.conversations = new Conversations(this), this.files = new Files(this), /**\n   * @deprecated\n   */ this.knowledge = new Knowledge(this), this.datasets = new Datasets(this), this.workflows = new Workflows(this), this.workspaces = new WorkSpaces(this), this.audio = new Audio(this), this.templates = new Templates(this), this.websockets = new Websockets(this), this.variables = new Variables(this), this.users = new Users(this);\n    }\n}\nvar __webpack_export_target__ = exports;\nfor(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];\nif (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {\n    value: true\n});\n"]}