"use strict";(self.webpackChunkflow_web_extension=self.webpackChunkflow_web_extension||[]).push([["50983"],{248036:function(e,n,t){t.r(n),t.d(n,{GenericConversationProtocolTransformPlugin:()=>f});var o=t(698127),i=t(706790),l=t(680610),_=t(790396),s=t(852922),a=t(595159),d=t(133756),r=t(438250),h=t(642494),u=t(312990),m=t(65379),v=t(330459),c=t(180178);class f{aliceChatMessageToMessage(e){var n,t,_,s,d,r=[];(0,h.mQ9)(e)&&r.push(...(0,u.H0)(null===(d=e.content_obj)||void 0===d?void 0:d.entities,e.nestedItems)),(null===(n=e.content_obj)||void 0===n?void 0:n.file_model)&&r.push(...(0,u.ay)(e.content_obj.file_model)),(null===(t=e.content_obj)||void 0===t?void 0:t.link_model)&&r.push((0,u.kl)(e.content_obj.link_model)),(null===(_=e.content_obj)||void 0===_?void 0:_.image_model)&&r.push(...(0,u.df)(e.content_obj.image_model.image_list)),(null==r?void 0:r.length)&&(0,l.Z)(e,{attachments:r});var v=(0,u.Id)(e.ext);if((null==v?void 0:v.length)&&(0,l.Z)(e,{references:v}),null===(s=e.meta_infos)||void 0===s?void 0:s.some(e=>e.type===m.MetaType.Think)){var{text:c,is_hide:f}=(0,a.y9)(e.meta_infos);return(0,i._)((0,o._)({},e),{content_obj:(0,i._)((0,o._)({},e.content_obj),{think:c}),has_think_reason:!0,think_reason_default_expand:!0,think_reason_is_hide:f})}return e}samanthaChatMessageToMessage(e){var n;if(null===(n=e.meta_infos)||void 0===n?void 0:n.some(e=>e.type===m.MetaType.Think)){var{text:t,is_hide:l}=(0,a.y9)(e.meta_infos);return(0,i._)((0,o._)({},e),{content_obj:(0,i._)((0,o._)({},e.content_obj),{think:t}),has_think_reason:!0,think_reason_default_expand:!0,think_reason_is_hide:l})}return e}messageToSamanthaChatMessage(e){var n,t=e.content_obj,i=(0,o._)({text:(null==t?void 0:t.text)||""},(0,_.Z)(t,["immersive_files","need_reference","prompt_tpl","hover_position"])),l=[...(0,u.Id)(e.ext)],a=[...e.attachments||[]];return(null==t?void 0:t.file_model)&&a.push(...(0,u.ay)(t.file_model)),(null==t?void 0:t.link_model)&&a.push((0,u.kl)(t.link_model)),(null==t?void 0:t.image_model)&&a.push(...(0,u.df)(null===(n=t.image_model)||void 0===n?void 0:n.image_list)),(null==t?void 0:t.entities)&&a.push(...(0,u.H0)(t.entities)),{content:(0,v.B)(i),content_type:r.y[d.W.SkillFreeChat],attachments:(0,s.Z)(a,(e,n)=>e.type===n.type&&e.key===n.key&&e.identifier===n.identifier),references:l}}constructor(){this.pluginIdentifier=c.W}}}}]);
//# sourceMappingURL=50983.js.map