"use strict";(self.webpackChunkflow_web_extension=self.webpackChunkflow_web_extension||[]).push([["39082"],{79204:function(e,t,i){i.d(t,{Wc:()=>l,fz:()=>r});var n,a,r=((n={})[n.DesktopSearchRelatedWebCard=-11]="DesktopSearchRelatedWebCard",n[n.DesktopGrammarCorrection=-10]="DesktopGrammarCorrection",n[n.DesktopTimeStampReference=-9]="DesktopTimeStampReference",n[n.DesktopResourceContentReference=-8]="DesktopResourceContentReference",n[n.DesktopPodcastTranscript=-7]="DesktopPodcastTranscript",n[n.WebTranslateCardContext=-6]="WebTranslateCardContext",n[n.WebVideoSummary=-5]="WebVideoSummary",n[n.WebDocReference=-4]="WebDocReference",n[n.WebAcademicPreview=-3]="WebAcademicPreview",n[n.WebAcademicReference=-2]="WebAcademicReference",n[n.WebPluginReference=-1]="WebPluginReference",n[n.Replaceable=1]="Replaceable",n[n.Insertable=2]="Insertable",n[n.DocumentRef=3]="DocumentRef",n[n.KnowledgeCard=4]="KnowledgeCard",n[n.MetaPlaceHolder=5]="MetaPlaceHolder",n[n.EmbeddedMultiMedia=100]="EmbeddedMultiMedia",n[n.MetaTypeAlaCard=101]="MetaTypeAlaCard",n[n.CommonCard=102]="CommonCard",n[n.Think=103]="Think",n[n.BrandSuperscript=104]="BrandSuperscript",n[n.CodeAssistantFilePath=200]="CodeAssistantFilePath",n),l=((a={})[a.Available=1]="Available",a[a.InVisible=2]="InVisible",a[a.Broken=3]="Broken",a[a.Streaming=4]="Streaming",a[a.Unselected=5]="Unselected",a[a.NotCompliant=6]="NotCompliant",a)},530243:function(e,t,i){i.r(t),i.d(t,{CrowdTestMessageLifeCyclePlugin:()=>k});var n=i(771197),a=i(642494),r=i(79204),l=i(698127),d=i(706790),o=i(481812),s=i(651481),u=i(1014),c=i(65379),v=i(172622),p=i(865534);function f(e){var t,i,n=null===(t=p.useCrowdTestStore.getState().blockMap)||void 0===t?void 0:t[e];if(n){var{displayStreamIndex:a,feedbackStreamIndex:r,messages:o}=n,s=[];return o.forEach(e=>{var t,i,n,a=Number(null==e?void 0:e.stream_id)-1;(null===(t=e.ext)||void 0===t?void 0:t.sub_msg_index)&&(a=Number(null===(i=e.ext)||void 0===i?void 0:i.sub_msg_index)),s[a]=null!==(n=s[a])&&void 0!==n?n:[],s[a].push(e)}),(0,d._)((0,l._)({},n),{preferStreamIndex:null!==(i=null!=r?r:a)&&void 0!==i?i:0,messageGroups:s})}}function _(e){return m.apply(this,arguments)}function m(){return(m=(0,n._)(function*(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.PushMessageStatus.Available,i=arguments.length>2?arguments[2]:void 0,n=f(e);if(n){var{conversationId:a,preferStreamIndex:r,messageGroups:l}=n,d=null!=i?i:r;try{yield s.GH.getState().updateMessageList({conversationId:a,immerUpdate:e=>{var{draftMessageMap:i,draftLocalMessageMap:n}=e,a=l[d][0];if(a){var r=null===(o=a.ext)||void 0===o?void 0:o.refer_msg_id;if(r){var o,s,u=null!==(s=n[null!=r?r:""])&&void 0!==s?s:i[null!=r?r:""];(null==u?void 0:u.ext)&&(u.ext.crowd_test_message_group_selected=d.toString(),u.status=t)}else l.forEach((e,a)=>{e.forEach(e=>{var r,l,o,s=null!==(o=n[null!==(r=null==e?void 0:e.message_id)&&void 0!==r?r:""])&&void 0!==o?o:i[null!==(l=null==e?void 0:e.message_id)&&void 0!==l?l:""];a===d?s.status=t:s.status=c.PushMessageStatus.InVisible})})}}})}catch(e){}}})).apply(this,arguments)}function b(){return(b=(0,n._)(function*(e){var t,i,n,r=f(e);if(r){var{conversationId:l,feedbackType:d,preferStreamIndex:s,messageGroups:u}=r,c=null===(t=u[null!=s?s:0])||void 0===t?void 0:t.find(e=>null==e?void 0:e.message_id);i=(0,a.xdd)(c)?{conversation_id:l,message_id:null==c?void 0:null===(n=c.ext)||void 0===n?void 0:n.refer_msg_id,reply_id:e,feedbackSource:v.E7.System,extra:JSON.stringify({crowd_test_message_group_selected:s}),feedbackDetail:{feedback_type:null!=d?d:v.nw.Better,feedback_detail_type:0}}:{conversation_id:l,message_id:null==c?void 0:c.message_id,reply_id:e,feedbackSource:v.E7.System,feedbackDetail:{feedback_type:null!=d?d:v.nw.Better,feedback_detail_types:[100]}};try{yield(yield(0,o.p)()).feedback(i)}catch(e){}}})).apply(this,arguments)}function g(){return(g=(0,n._)(function*(e){var t,i,n=null!==(i=(0,u.MF)(e))&&void 0!==i?i:[];n.every(e=>(0,a.z_e)(e))&&(null===(t=n[0])||void 0===t?void 0:t.reply_id)&&(yield _(n[0].reply_id,c.PushMessageStatus.Available),yield function(e){return b.apply(this,arguments)}(n[0].reply_id))})).apply(this,arguments)}var y=i(215110);class k{beforeMessageSending(e,t){return(0,n._)(function*(){var e;return yield function(e){return g.apply(this,arguments)}(null!==(e=t.conversation_id)&&void 0!==e?e:""),t})()}onBatchMessageReceivingEnd(e,t){return(0,n._)(function*(){var e;return t.reply_id&&((0,a.Q5B)(t)||(0,a.xdd)(t))&&(null===(e=t.final_status)||void 0===e?void 0:e.message)==="Broken"&&(yield _(null==t?void 0:t.reply_id,r.Wc.Broken,0)),t})()}constructor(){this.pluginIdentifier=y.L}}}}]);
//# sourceMappingURL=39082.js.map