"use strict";(self.webpackChunkflow_web_extension=self.webpackChunkflow_web_extension||[]).push([["16103"],{839952:function(e,t,_){_.r(t),_.d(t,{DeepResearchEditButton:()=>m});var o=_(771197),a=_(397458),i=_(932873),r=_(652983),c=_(383154),n=_(430185),d=_(41139),l=_(467065),s=_(688580),p=_(221330),u=_(707974),D=_(478508),m=e=>{var t,{editorRef:_,referenceQuoteManage:m,deepResearchId:b,disabled:h=!1,onClick:E}=e,A=(0,p.g1)(),[f,k]=(0,r.useState)(!1),C=(t=(0,o._)(function*(){if(!f&&!h)try{if(k(!0),null==E||E("edit_with_doubao_doc"),!_.current){c.pJ.error(A("doc_toast_convertFail"));return}var e,t,o,a,i=_.current,r=null===(o=i.raw)||void 0===o?void 0:o.getContent();if(!r){c.pJ.error(A("doc_toast_convertFail"));return}var n=(null===(a=_.current)||void 0===a?void 0:a.getTitle())||"",p=(yield(0,s.C)({docEditor:i,deltaSet:r,enableReferenceQuote:!1,referenceQuoteManager:m})).split("\n"),C=!1,v=p.filter(e=>!(!C&&e.trim().startsWith("# "))||(C=!0,!1)).join("\n").trim(),g=(null==m?void 0:m.getReferenceList())||[],T="";g.length>0&&(T="\n\n## ".concat(A("doc_source_header"),"\n\n"),g.forEach((e,t)=>{T+="".concat(t+1,". [").concat(e.title,"](").concat(e.url,")\n")}));var I=v+T,L=yield(0,l.Lx)(I,n,void 0);(null==L?void 0:L.token)?((0,u.oB)({clickFrom:u.DY.DeepResearchEditWithDoubaoDoc,createWay:u.f4.EditWithDoubaoDoc,pageToken:L.token,deepResearchId:b}),(0,D.qy)({pageToken:L.token,enterFrom:"deep_research_edit_with_doubao_doc"})):c.pJ.error(A("doc_toast_convertFail"))}catch(o){d.k.persist.error({eventName:"deep_research_to_docx_edit_error",error:o instanceof Error?o:Error(String(o)),meta:{deepResearchId:b,title:(null===(e=_.current)||void 0===e?void 0:e.getTitle())||"",hasReferences:((null==m?void 0:null===(t=m.getReferenceList())||void 0===t?void 0:t.length)||0)>0}}),c.pJ.error(A("doc_toast_convertFail"))}finally{k(!1)}}),function(){return t.apply(this,arguments)});return b?(0,a.jsx)(n.a,{size:"larger",newIcon:!0,onClick:C,disabled:f||h,"data-testid":"deep_research_edit_with_doc_edit_btn",title:f?A("doc_toast_convertingDoc"):A("doc_canvas_btn_convertDoc"),children:(0,a.jsx)(i.Z,{})}):null}},707974:function(e,t,_){_.d(t,{DY:()=>p,f4:()=>u,n0:()=>m,oB:()=>D});var o,a,i,r=_(698127),c=_(706790),n=_(788704),d=_(791),l=_(913356),s=_(478508),p=((o={}).AiDocImportDocument="ai_doc_import_document",o.AiDocTemplateBlank="ai_doc_template_blank",o.AiDocListCreateButton="ai_doc_list_create_button",o.SendMessageCreate="send_message_create",o.AiDocTemplateBesideChatBox="ai_doc_template_beside_chat_box",o.AiDocTemplateLibrary="ai_doc_template_library",o.CopyDoc="copy_doc",o.AiDocDetailCreateButton="ai_doc_detail_create_button",o.AiSpaceBlank="ai_space_blank",o.DeepResearchEditWithDoubaoDoc="deep_research_edit_with_doubao_doc",o.AiDocOnboardingCard="ai_doc_onboarding_card",o),u=((a={}).ImportDocument="import_document",a.Template="template",a.BlankFile="blank_file",a.SendMessage="send_message",a.CopyDoc="copy_doc",a.EditWithDoubaoDoc="edit_with_doubao_doc",a),D=e=>{var{clickFrom:t,createWay:_,templateId:o,templateName:a,fromPageToken:i,fromArtifactMetaId:p,pageToken:u,artifactMetaId:D,artifactType:m=d.ArtifactType.Page,deepResearchId:b,superTaskId:h,superTaskMode:E}=e;if(u){var A=(0,s.XU)({key:u});(0,n.L)("create_ai_doc",(0,c._)((0,r._)({click_from:t,create_way:_,author_id:(0,l.n5)(),ai_doc_template_id:o,ai_doc_template_name:a,from_page_token:i,from_artifact_meta_id:p,page_token:A?u:void 0,legacy_page_token:A?void 0:u,deep_research_id:b},D?{artifact_meta_id:D,artifact_type:m}:{}),{super_task_id:h,super_task_mode:E}))}},m=((i={}).DIRECT_ENTER="direct_enter",i.SIDEBAR_SKILL="sidebar_skill",i.SKILL="skill",i.AI_DOC_IMPORT_DOCUMENT="ai_doc_import_document",i.AI_DOC_TEMPLATE_BLANK="ai_doc_template_blank",i.SEND_MESSAGE_CREATE="send_message_create",i.AI_DOC_TEMPLATE_BESIDE_CHAT_BOX="ai_doc_template_beside_chat_box",i.AI_DOC_TEMPLATE_LIBRARY="ai_doc_template_library",i.AI_DOC_LIST="ai_doc_list",i.AI_SPACE_DOC_LIST="ai_space_doc_list",i.SHARE_LINK="share_link",i.COPY_DOC="copy_doc",i.AI_SPACE_BLANK="ai_space_blank",i.PUBLIC_LINK="public_link",i.AI_DOC_ONBOARDING_CARD="ai_doc_onboarding_card",i.MEETING_RECORD_CREATE_BUTTON="meeting_record_create_button",i)}}]);
//# sourceMappingURL=16103.js.map