1"use strict";(self.webpackChunkfront=self.webpackChunkfront||[]).push([["3077"],{72331(e,a,l){l.d(a,{A:()=>o});var n=l(74848),t=l(96540),s=l(82349);l(47216),l(10202);let i={autoCloseBrackets:!0,cursorScrollMargin:48,mode:"markdown",theme:"md-highlight",indentUnit:2,tabSize:2,styleActiveLine:!0,viewportMargin:1/0,matchBrackets:!0,lineNumbers:!1,lineWrapping:!0,extraKeys:{Enter:"newlineAndIndent"}},r=t.forwardRef((e,a)=>{var l;let{value:r,defaultValue:o,onChange:c,placeholder:d,maxLength:x,disabled:p=!1,className:g="",style:m}=e,[h,u]=t.useState(null!=(l=null!=o?o:r)?l:""),f=t.useRef(null),v=t.useRef(null);t.useImperativeHandle(a,()=>({insertAtCursor:e=>{let a=f.current;if(!a)return;let l=v.current||a.getCursor();a.replaceRange(e,l);let n={line:l.line,ch:l.ch+e.length};a.setCursor(n),v.current=n,a.focus()},getEditor:()=>f.current})),t.useEffect(()=>{u(null!=r?r:"")},[r]);let j=t.useMemo(()=>({...i,readOnly:!!p&&"nocursor",placeholder:null!=d?d:""}),[p,d]);return(0,n.jsx)("div",{className:`markdown-editor-wrapper ${g}`,style:m,children:(0,n.jsx)(s.Controlled,{options:j,value:h,editorDidMount:e=>{f.current=e,e.on("cursorActivity",()=>{v.current=e.getCursor()}),setTimeout(()=>e.refresh(),0)},onBeforeChange:(e,a,l)=>{let n="number"==typeof x&&l.length>x?l.slice(0,x):l;u(n),null==c||c(n)}})})});r.displayName="MarkdownEditor";let o=r},18060(e,a,l){l.d(a,{A:()=>r});var n=l(74848),t=l(46942),s=l.n(t),i=l(17331);let r=e=>(0,n.jsx)(i.A,{...e,className:s()("quick-pro-table h-full",e.className)})},66158(e,a,l){l.r(a),l.d(a,{default:()=>en});var n=l(74848),t=l(96540),s=l(56347),i=l(26961),r=l(53623),o=l(26557),c=l(790),d=l(22192),x=l(50805),p=l(51509),g=l(6824),m=l(50400),h=l(7259),u=l(86944),f=l(65866),v=l(12908);let{TextArea:j}=c.A,N=(0,t.forwardRef)((e,a)=>{let{agentId:l,name:s,onNameUpdated:i}=e,[o]=d.A.useForm(),[N,y]=(0,t.useState)(!1),[b,A]=(0,t.useState)(!1),[w,$]=(0,t.useState)(!1),C=(0,f.O)(),{loading:k}=(0,h.A)(()=>(0,v.eI)({id:l}),{ready:!!l,onSuccess:e=>{let a=e.data,l=1===a.forceLanguage;o.setFieldsValue({agentName:a.agentName,description:a.description,forceLanguage:l,language:a.language&&"auto"!==a.language?a.language:void 0}),A(l),$(!0)}}),{runAsync:I,loading:L}=(0,h.A)(v.IA,{manual:!0});(0,t.useEffect)(()=>{s&&!o.getFieldValue("agentName")&&o.setFieldsValue({agentName:s})},[o,s]);let S=async()=>{try{let e=await o.validateFields();return await I({id:l,agentName:e.agentName,description:e.description,forceLanguage:+!!e.forceLanguage,...e.forceLanguage&&{language:e.language}}),i(e.agentName),y(!1),!0}catch{return!1}};(0,t.useImperativeHandle)(a,()=>({hasUnsavedChanges:()=>N,handleSave:S}),[N,l]);let F=!!l&&!w;return(0,n.jsxs)("div",{className:"bg-white rounded-2 p-6 min-h-full",children:[(0,n.jsx)("div",{className:"text-16px font-500 color-[rgba(0,0,0,0.85)] leading-22px mb-3",children:$i18n("1f3sa66Q")}),F?(0,n.jsx)(x.A,{active:!0,paragraph:{rows:6},title:!1}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(d.A,{form:o,initialValues:{forceLanguage:!1,language:void 0},layout:"vertical",onValuesChange:e=>{y(!0),"forceLanguage"in e&&(A(!!e.forceLanguage),e.forceLanguage&&!o.getFieldValue("language")&&C.length&&o.setFieldsValue({language:C[0].value}))},children:[(0,n.jsx)(d.A.Item,{className:"w-180",label:$i18n("seg.modalForm.name"),name:"agentName",rules:[{required:!0,message:$i18n("1f3sa66R")},{validator:(e,a)=>a&&!a.trim()?Promise.reject($i18n("1f3s8fmE")):Promise.resolve()}],children:(0,n.jsx)(c.A,{showCount:!0,maxLength:200,placeholder:$i18n("1f3sa66S")})}),(0,n.jsx)(d.A.Item,{className:"w-180",label:$i18n("plg.billing.subTable.description"),name:"description",children:(0,n.jsx)(j,{showCount:!0,maxLength:5e3,placeholder:$i18n("1f3sa66T"),rows:10})}),(0,n.jsx)(d.A.Item,{hidden:!0,name:"forceLanguage",valuePropName:"checked",children:(0,n.jsx)(p.A,{})}),(0,n.jsxs)("div",{className:"flex items-center gap-2",style:{marginBottom:16},children:[(0,n.jsx)("span",{className:"text-14px leading-22px color-[rgba(0,0,0,0.85)]",children:$i18n("pWIaTUz")}),(0,n.jsx)(r.A,{title:$i18n("pWIaTUA"),children:(0,n.jsx)(u.A,{className:"color-[rgba(0,0,0,0.45)] text-12px"})}),(0,n.jsx)(p.A,{checked:b,size:"small",onChange:e=>{o.setFieldsValue({forceLanguage:e}),A(e),y(!0),e&&!o.getFieldValue("language")&&C.length&&o.setFieldsValue({language:C[0].value})}})]}),b&&(0,n.jsx)(d.A.Item,{className:"w-180",label:$i18n("nAyC2Sr"),name:"language",rules:[{required:!0,message:$i18n("onlineChat.formItem.collect.placeholder")}],children:(0,n.jsx)(g.A,{fieldNames:{label:"key"},options:C,placeholder:$i18n("onlineChat.formItem.collect.placeholder")})})]}),(0,n.jsx)(m.A,{disabled:!N,loading:L||k,style:{opacity:N?1:.3},type:"primary",onClick:S,children:$i18n("save")})]})]})});var y=l(428),b=l(94824),A=l(68940),w=l(20736),$=l(73129),C=l(18060);let k=l.p+"static/media/channel-empty.ec0ba709.svg";var I=l(8053);let L={facebook:"facebookComment",instagram:"instagramComment"};var S=l(55257),F=l(54510),M=l(82097),T=l(55886),E=l(5373),P=l(31262),V=l(28073),H=l(69508),R=l(36962);let O=e=>
1{let{pages:a,value:l,onChange:s,placeholder:i,loading:o=!1,selectedPagesMap:d={}}=e,[x,p]=(0,t.useState)(""),g=(0,t.useMemo)(()=>new Set(l),[l]),m=e=>!0===e.selected&&!g.has(e.pageId),h=(0,t.useMemo)(()=>x.trim()?a.filter(e=>e.pageName.toLowerCase().includes(x.trim().toLowerCase())):a,[a,x]),u=(0,t.useMemo)(()=>h.filter(e=>!m(e)),[h,g]),f=u.length>0&&u.every(e=>g.has(e.pageId)),v=u.some(e=>g.has(e.pageId))&&!f,j=(0,t.useMemo)(()=>l.map(e=>{let l=a.find(a=>a.pageId===e);return{pageId:e,pageName:(null==l?void 0:l.pageName)||d[e]||e}}),[l,a,d]),N=Math.min(36*h.length,320),y=(0,n.jsxs)("div",{className:"w-full flex flex-col gap-1 pb-2",children:[(0,n.jsx)("div",{className:"flex items-center gap-2 h-8 px-3 py-1",style:{borderBottom:"1px solid rgba(231, 233, 237, 0.45)"},children:(0,n.jsx)(c.A,{allowClear:!0,bordered:!1,className:"flex-1 !p-0 !text-13px",placeholder:$i18n("1OyxuId4"),suffix:(0,n.jsx)(w.A,{className:"text-16px color-[rgba(0,0,0,0.25)]"}),value:x,onChange:e=>p(e.target.value)})}),(0,n.jsxs)("div",{className:"flex flex-col gap-0.5 pt-1 px-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 h-9 px-3 rounded-1.5 cursor-pointer hover:bg-[rgba(0,0,0,0.04)]",onClick:()=>{if(f){let e=new Set(u.map(e=>e.pageId));s(l.filter(a=>!e.has(a)))}else s([...new Set([...l,...u.map(e=>e.pageId)])])},children:[(0,n.jsx)(P.A,{checked:f,indeterminate:v}),(0,n.jsx)("span",{className:"text-14px leading-22px color-[rgba(0,0,0,0.85)]",children:$i18n("1OyxuId5")})]}),0===h.length&&!o&&(0,n.jsx)("div",{className:"text-13px color-[rgba(0,0,0,0.25)] py-3 text-center",children:$i18n("SgKGFmx")}),o&&(0,n.jsxs)("div",{className:"flex items-center justify-center text-13px color-[rgba(0,0,0,0.45)] py-3",children:[(0,n.jsx)(R.A,{className:"mr-2"}),$i18n("16ULg8jX")]}),h.length>0&&(0,n.jsx)(E.Y1,{height:N,itemCount:h.length,itemSize:36,width:"100%",children:e=>{let{index:a,style:t}=e,i=h[a],o=m(i),c=g.has(i.pageId),d=(0,n.jsxs)("div",{className:`flex items-center gap-2 h-9 px-3 rounded-1.5 ${o?"cursor-not-allowed bg-#FAFAFA":"cursor-pointer hover:bg-[rgba(0,0,0,0.04)]"}`,onClick:()=>(e=>{if(m(e))return;let a=e.pageId;g.has(a)?s(l.filter(e=>e!==a)):s([...l,a])})(i),children:[(0,n.jsx)(P.A,{checked:c,disabled:o}),(0,n.jsx)("span",{className:`flex-1 min-w-0 text-14px leading-22px truncate ${o?"color-[rgba(0,0,0,0.25)]":"color-[rgba(0,0,0,0.85)]"}`,children:i.pageName})]});return(0,n.jsx)("div",{style:t,children:o?(0,n.jsx)(r.A,{placement:"right",title:$i18n("1Oyxuux0"),children:d}):d})}})]})]});return(0,n.jsx)(V.A,{align:{offset:[0,-3]},content:y,overlayClassName:"[&_.ant-popover-inner-content]:!w-full [&_.ant-popover-inner-content]:!p-0",overlayInnerStyle:{padding:0,width:"100%"},overlayStyle:{width:"452px"},placement:"bottomLeft",showArrow:!1,trigger:"click",children:(0,n.jsx)("div",{className:"min-h-8 px-3 py-1 border-1 border-solid border-#E7E9ED rounded-1.5 cursor-pointer flex items-center flex-wrap gap-1 hover:border-#FF6600 transition-colors",children:j.length>0?j.map(e=>(0,n.jsx)(H.A,{closable:!0,className:"!m-0",onClose:a=>{var n;a.preventDefault(),n=e.pageId,s(l.filter(e=>e!==n))},children:e.pageName},e.pageId)):(0,n.jsx)("span",{className:"text-14px color-[rgba(0,0,0,0.25)]",children:i||$i18n("1OyxuId6")})})})};var Q=l(87042);let _=(e,a)=>e.some(e=>e.actionType===a),J=e=>{let{actions:a,onChange:l,channelType:t}=e,s=_(a,"like"),i=_(a,"reply"),r=_(a,"hide"),o=_(a,"delete"),c=_(a,"messenger"),d=e=>{var n,t;"delete"===e?o?l(a.filter(e=>"delete"!==e.actionType)):l([...a.filter(e=>!["like","reply","hide","delete"].includes(e.actionType)),{actionType:"delete"}]):l((n=a.filter(e=>"delete"!==e.actionType),_(n,t=e)?n.filter(e=>e.actionType!==t):[...n,{actionType:t}]))};return(0,n.jsx)("div",{className:"flex flex-col gap-3",children:(0,n.jsxs)("div",{className:"flex items-start gap-3 flex-wrap [&_.ant-checkbox-wrapper+.ant-checkbox-wrapper]:!ml-0",children:["instagram"!==t&&(0,n.jsx)(P.A,{checked:s,className:"!text-13px",disabled:o,onChange:()=>d("like"),children:$i18n("1WAlvooa")}),(0,n.jsx)(P.A,{checked:i,className:"!text-13px",disabled:o,onChange:()=>{i?l(a.filter(e=>"reply"!==e.actionType)):l([...a.filter(e=>"delete"!==e.actionType),{actionType:"reply"}])},children:$i18n("1WAlvoob")}),(0,n.jsx)(P.A,{checked:r,className:"!text-13px",disabled:o,onChange:()=>d("hide"),children:$i18n("1WAlvooc")}),(0,n.jsx)(P.A,{checked:o,className:"!text-13px",disabled:s||i||r,onChange:()=>d("delete"),children:$i18n("1WAlvood")}),(0,n.jsx)(P.A,{checked:c,className:"!text-13px",onChange:()=>{c?l(a.filter(e=>"messenger"!==e.actionType)):l([...a,{actionType:"messenger"}])}
1,children:"instagram"===t?$i18n("1WAlsx9C"):$i18n("1WAlvooe")})]})})};var D=l(25093);let W="__ungrouped__",z=e=>{let{value:a,onChange:l,items:s,groups:i,disabledCodes:r=[],placeholder:o}=e,c=(0,t.useMemo)(()=>new Set(r),[r]),d=(0,t.useMemo)(()=>{let e={};return s.forEach(a=>{e[a.labelCode]=a}),e},[s]),x=e=>null!=e.groupId?String(e.groupId):e.groupName?`name:${e.groupName}`:W,p=(0,t.useMemo)(()=>{let e=new Map;return i.forEach(a=>{e.set(String(a.groupId),{label:a.groupName,children:[]})}),s.forEach(a=>{let l=x(a),n=e.get(l);n||(n={label:a.groupName||"",children:[]},e.set(l,n)),n.children.push({label:a.labelName,value:a.labelCode,disabled:c.has(a.labelCode)})}),Array.from(e.entries()).filter(e=>{let[,a]=e;return a.children.length>0&&!!a.label}).map(e=>{let[a,l]=e;return{label:l.label,value:a,disabled:l.children.every(e=>e.disabled),children:l.children}})},[s,i,c]),g=(0,t.useMemo)(()=>a.map(e=>{let a=d[e.code];return a?[x(a),e.code]:[W,e.code]}).filter(e=>!!e),[a,d]);return(0,n.jsx)(D.A,{showArrow:!0,maxTagCount:"responsive",multiple:!0,options:p,placeholder:o,popupClassName:"src-components-CommentAgent-Configuration-ChannelConfig-IntentSelector-index-module__intentCascader--iaRH5",showCheckedStrategy:D.A.SHOW_CHILD,style:{width:"100%"},value:g,onChange:e=>{l(e.map(e=>String(e[e.length-1])).map(e=>{var a,l;let n=d[e];return{id:null!=(a=null==n?void 0:n.labelId)?a:"0",name:null!=(l=null==n?void 0:n.labelName)?l:e,code:e}}))}})},{TextArea:B}=c.A,K=e=>{var a,l,t,s;let{subRule:i,index:r,usedIntentCodes:o,intentItems:c,intentGroups:d,channelType:x,onChange:p,onDelete:g,canDelete:h}=e,u=e=>i.actions.some(a=>a.actionType===e),f=e=>i.actions.find(a=>a.actionType===e),v=e=>{p({...i,actions:e})},j=f("reply"),N=f("messenger");return(0,n.jsxs)("div",{className:"bg-#F6F7F8 rounded-2 px-6 pt-4 pb-6 flex flex-col gap-5",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center",children:[(0,n.jsxs)("span",{className:"text-13px leading-22px color-[rgba(0,0,0,0.45)]",children:[$i18n("1HVh9MOk")," ",r+1]}),h&&(0,n.jsx)(m.A,{danger:!0,icon:(0,n.jsx)($.A,{type:"icon-delete_1"}),size:"small",type:"text",onClick:g})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3 h-8",children:[(0,n.jsx)("span",{className:"text-14px font-500 leading-22px color-[rgba(0,0,0,0.85)] shrink-0",children:$i18n("1HVh9MOl")}),(0,n.jsx)("div",{className:"flex-1 min-w-0",children:(0,n.jsx)(z,{disabledCodes:o,groups:d,items:c,placeholder:$i18n("1HVh9MOm"),value:i.intents,onChange:e=>p({...i,intents:e})})}),(0,n.jsx)("span",{className:"text-14px font-500 leading-22px color-[rgba(0,0,0,0.85)] shrink-0",children:$i18n("1HVh9MOx")})]}),(0,n.jsx)(J,{actions:i.actions,channelType:x,onChange:v})]}),u("reply")&&(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsx)("span",{className:"text-14px font-500 leading-22px color-[rgba(0,0,0,0.85)]",children:$i18n("1HVh9MOy")}),(0,n.jsxs)(Q.A.Group,{className:"flex gap-6",value:null!=(a=null==j?void 0:j.replyMode)?a:void 0,onChange:e=>{v(i.actions.map(a=>"reply"===a.actionType?{...a,replyMode:e.target.value}:a))},children:[(0,n.jsx)(Q.A,{value:"agent",children:$i18n("1HVh9MOz")}),(0,n.jsx)(Q.A,{value:"fixed",children:$i18n("1HVh9MOA")})]}),(null==j?void 0:j.replyMode)==="fixed"&&(0,n.jsx)(B,{className:"!bg-white !border-#E7E9ED !rounded-2 !text-13px !leading-20px",placeholder:$i18n("1HVh9MOB"),rows:3,value:null!=(l=null==j?void 0:j.fixedContent)?l:"",onChange:e=>{v(i.actions.map(a=>"reply"===a.actionType?{...a,fixedContent:e.target.value}:a))}})]}),u("messenger")&&(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsx)("span",{className:"text-14px font-500 leading-22px color-[rgba(0,0,0,0.85)]",children:"instagram"===x?$i18n("1HVh6Vja"):$i18n("1HVh9MOC")}),(0,n.jsxs)(Q.A.Group,{className:"flex gap-6",value:null!=(t=null==N?void 0:N.replyMode)?t:void 0,onChange:e=>{v(i.actions.map(a=>"messenger"===a.actionType?{...a,replyMode:e.target.value}:a))},children:[(0,n.jsx)(Q.A,{value:"agent",children:$i18n("1HVh9MOD")}),(0,n.jsx)(Q.A,{value:"fixed",children:$i18n("1HVh7RMO")})]}),(null==N?void 0:N.replyMode)==="fixed"&&(0,n.jsx)(B,{className:"!bg-white !border-#E7E9ED !rounded-2 !text-13px !leading-20px",placeholder:$i18n("1HVh7RMP"),rows:3,value:null!=(s=null==N?void 0:N.fixedContent)?s:"",onCh
1ange:e=>{v(i.actions.map(a=>"messenger"===a.actionType?{...a,fixedContent:e.target.value}:a))}})]})]})},U=e=>{var a;let{isOpen:l,onClose:s,resolve:i,channelType:r,agentId:o,existingRule:d}=e,x=L[r],[p,g]=(0,t.useState)([]),{loading:u}=(0,h.A)(()=>(0,v.$S)({channel:x,pageNum:1,pageSize:99999,...d?{agentConfigId:o,ruleId:d.id}:{}}),{ready:l,refreshDeps:[l,x,o],onSuccess:e=>{var a;g((null==(a=e.data)?void 0:a.data)||[])}}),f=(0,t.useMemo)(()=>{let e={};return(null==d?void 0:d.pageIds)&&(null==d?void 0:d.pageNames)&&d.pageIds.forEach((a,l)=>{var n;let t=null==(n=d.pageNames)?void 0:n[l];t&&(e[a]=t)}),e},[d]),{data:j}=(0,h.A)(()=>(0,v.un)({}),{ready:l}),N=(null==j?void 0:j.data)||[],{data:y}=(0,h.A)(()=>(0,v.a2)(void 0),{ready:l}),b=(null==y?void 0:y.data)||[],[w,$]=(0,t.useState)(null!=(a=null==d?void 0:d.ruleName)?a:""),[C,k]=(0,t.useState)((null==d?void 0:d.pageIds)||[]),[I,S]=(0,t.useState)(d&&d.actions&&0!==d.actions.length?d.actions.map((e,a)=>({id:String(a+1),intents:e.labelInfos||[],actions:e.actions||[]})):[{id:"1",intents:[],actions:[]}]),{runAsync:E,loading:P}=(0,h.A)(v.xR,{manual:!0}),{runAsync:V,loading:H}=(0,h.A)(v.Ao,{manual:!0}),R=e=>{for(let l of e)if("reply"===l.actionType||"messenger"===l.actionType){var a;if(!l.replyMode)return $i18n("1JP9NAQq");if("fixed"===l.replyMode&&!(null!=(a=l.fixedContent)?a:"").trim())return $i18n("1JP9NAQr")}return null},Q=async()=>{if(!w.trim())return void F.Ay.warning($i18n("1JP9NAQs"));if(0===C.length)return void F.Ay.warning($i18n("1JP9NNro"));if(I.some(e=>0===e.intents.length))return void F.Ay.warning($i18n("1JP9NNrz"));if(I.some(e=>0===e.actions.length))return void F.Ay.warning($i18n("1JP9NAQt"));for(let e of I){let a=R(e.actions);if(a)return void F.Ay.warning(a)}let e=I.map(e=>({labelInfos:e.intents,actions:e.actions})),a={channel:x,ruleName:w.trim(),pageIds:C.length>0?C:null,actions:e};d?await V({...a,ruleId:d.id,enabled:d.enabled}):await E({...a,agentId:o}),i(!0)},_=()=>{i(null),s()},J=!!w.trim()&&C.length>0&&I.every(e=>e.intents.length>0&&e.actions.length>0);return(0,n.jsx)(M.A,{closable:!1,open:l,width:500,footer:(0,n.jsxs)("div",{className:"flex justify-end gap-4",children:[(0,n.jsx)(m.A,{onClick:_,children:$i18n("cancel")}),(0,n.jsx)(m.A,{disabled:!J,loading:P||H,type:"primary",onClick:Q,children:d?$i18n("ok"):$i18n("1JP9NNrA")})]}),title:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-16px font-500 color-[rgba(0,0,0,0.85)]",children:d?$i18n("1JP9NNrB"):$i18n("1JP9NNrC")}),(0,n.jsx)(T.A,{className:"text-14px cursor-pointer color-[rgba(0,0,0,0.45)]",onClick:_})]}),onClose:_,children:(0,n.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center px-1.5",children:[(0,n.jsx)("span",{className:"text-14px leading-22px color-#FA541C",children:"*\xa0"}),(0,n.jsx)("span",{className:"text-14px font-500 leading-22px color-[rgba(0,0,0,0.85)]",children:$i18n("1JP9NAQu")})]}),(0,n.jsx)(c.A,{showCount:!0,maxLength:100,placeholder:$i18n("1JP9NAQv"),value:w,onChange:e=>$(e.target.value)})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center px-1.5",children:[(0,n.jsx)("span",{className:"text-14px leading-22px color-#FA541C",children:"*\xa0"}),(0,n.jsx)("span",{className:"text-14px font-500 leading-22px color-[rgba(0,0,0,0.85)]",children:"facebook"===r?$i18n("1JP9NNrD"):$i18n("1JP9NNrE")})]}),(0,n.jsx)(O,{loading:u,pages:p,placeholder:$i18n("1JP9NNrF"),selectedPagesMap:f,value:C,onChange:k})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,n.jsx)("div",{className:"text-14px font-500 leading-22px color-[rgba(0,0,0,0.85)]",children:$i18n("1JP9NNrG")}),(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"inline-flex gap-1 items-center px-4 py-1.5 rounded-1.5 bg-white shadow-[0px_0px_2px_rgba(188,201,228,0.5)] cursor-pointer",onClick:()=>{S([...I,{id:String(Date.now()),intents:[],actions:[]}])},children:[(0,n.jsx)(A.A,{className:"text-12px color-#1E63F5"}),(0,n.jsx)("span",{className:"text-12px leading-22px color-#1E63F5",children:$i18n("1JP9NNrH")})]})})]}),I.map((e,a)=>(0,n.jsx)(K,{canDelete:I.length>1,channelType:r,index:a,intentGroups:b,intentItems:N,subRule:e,usedIntentCodes:I.flatMap((e,l)=>l!==a?e.intents.map(e=>e.code):[]),onChange:e=>{let l;(l=[...I])[a]=e,S(l)},onDelete:()=>{S(I.filter((e,l)=>
1l!==a))}},e.id))]})]})})},G={facebook:$i18n("1pLtKRA2"),instagram:$i18n("1pLtKRA3")},q={facebook:$i18n("1pLtKRA4"),instagram:$i18n("1pLtKRA5")},X=e=>{let{channelType:a,agentId:l}=e,{openModal:s}=(0,I.h)(),[i,o]=(0,t.useState)(""),[d,x]=(0,t.useState)(null),p=L[a],{data:g,loading:u,refresh:f}=(0,h.A)(()=>(0,v.aD)({agentId:l,channel:p,keyword:i||void 0}),{refreshDeps:[i,p],debounceWait:500,onSuccess:()=>x(i)}),j=(null==g?void 0:g.data)||[],{runAsync:N,loading:F}=(0,h.A)(v.k3,{manual:!0}),M=async()=>{await s(U,{channelType:a,agentId:l,existingRule:void 0})&&f()},T=async e=>{await s(U,{channelType:a,agentId:l,existingRule:e})&&f()},E=async e=>{await s(S.A,{})&&(await N({agentId:l,ruleId:e.id}),f())},P=[{title:$i18n("1pLtLG2g"),dataIndex:"ruleName",ellipsis:!1,render:(e,a)=>{var l;let t=(null==(l=a.ruleName)?void 0:l.trim())||"-";return(0,n.jsx)(r.A,{title:t,children:(0,n.jsx)("span",{className:"block truncate",children:t})})}},{title:$i18n("1pLtLQgM"),dataIndex:"pageNames",ellipsis:!1,render:(e,a)=>{let l;if(!a.pageNames||0===a.pageNames.length)return(0,n.jsx)("span",{children:"-"});let t=a.pageNames,s=t.length,i=t.join("ã");return l=s<=3?t.join("/"):t.slice(0,3).join("/")+`/...+${s}`,(0,n.jsx)(r.A,{overlayStyle:{maxWidth:400},title:i,children:(0,n.jsx)("span",{children:l})})}},{title:$i18n("1pLtLQgN"),dataIndex:"actions",key:"intents",render:(e,a)=>{let l=a.actions||[];return 0===l.length?(0,n.jsx)("span",{children:"-"}):(0,n.jsx)("div",{className:"flex flex-col gap-1",children:l.map((e,a)=>{let l=(e.labelInfos||[]).map(e=>e.name).filter(Boolean).join("ã")||"-";return(0,n.jsx)(r.A,{title:l,children:(0,n.jsx)("span",{className:"block truncate",children:l})},a)})})}},{title:$i18n("1pLtLQgY"),dataIndex:"actions",key:"actionTypes",render:(e,l)=>{let t=l.actions||[];return 0===t.length?(0,n.jsx)("span",{children:"-"}):(0,n.jsx)("div",{className:"flex flex-col gap-1",children:t.map((e,l)=>{let t=(e.actions||[]).map(e=>({like:$i18n("1pLtLQgZ"),reply:$i18n("1pLtLQh0"),hide:$i18n("1pLtLQh1"),delete:$i18n("1pLtLQh2"),messenger:"instagram"===a?$i18n("1pLtJKnS"):$i18n("1pLtLQh3")})[e.actionType]||e.actionType).join("ã")||"-";return(0,n.jsx)(r.A,{title:t,children:(0,n.jsx)("span",{className:"block truncate",children:t})},l)})})}},{title:$i18n("operation"),width:120,render:(e,a)=>(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsx)(b.A,{className:"text-14px color-[rgba(0,0,0,0.45)] cursor-pointer hover:color-#FF6600",onClick:()=>T(a)}),(0,n.jsx)($.A,{className:"text-14px color-[rgba(0,0,0,0.45)] cursor-pointer hover:color-#FF4D4F",type:"icon-delete_1",onClick:()=>E(a)})]})}];return u||0!==j.length||i||""!==d?(0,n.jsxs)("div",{className:"h-full flex flex-col gap-6",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-4 shrink-0",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsx)("span",{className:"text-14px leading-22px color-[rgba(0,0,0,0.85)]",children:G[a]}),(0,n.jsx)("span",{className:"text-13px leading-18px color-[rgba(0,0,0,0.45)]",children:q[a]})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center",children:[(0,n.jsx)(c.A,{className:"!w-288px !rounded-2",placeholder:$i18n("1pLtLQh5"),suffix:(0,n.jsx)(w.A,{className:"color-[rgba(0,0,0,0.25)]"}),value:i,onChange:e=>o(e.target.value)}),(0,n.jsx)(m.A,{className:"!text-#FF6600 !border-#FF6600 !text-13px",icon:(0,n.jsx)(A.A,{className:"!text-12px"}),onClick:M,children:$i18n("1pLtLoZ0")})]})]}),(0,n.jsx)(y.A,{spinning:u||F,children:(0,n.jsx)(C.A,{cardProps:!1,columns:P,dataSource:j,options:!1,pagination:!1,rowKey:"id",search:!1,toolBarRender:!1})})]}):(0,n.jsxs)("div",{className:"h-full flex flex-col items-center justify-center gap-8",children:[(0,n.jsx)("img",{alt:"empty",className:"w-62px",src:k}),(0,n.jsxs)("div",{className:"flex flex-col items-center gap-6",children:[(0,n.jsx)("span",{className:"text-14px leading-22px color-[rgba(0,0,0,0.65)]",children:q[a]}),(0,n.jsx)(m.A,{className:"!text-#FF6600 !border-#FF6600 !text-13px",icon:(0,n.jsx)(A.A,{className:"!text-12px"}),onClick:M,children:$i18n("1pLtLQh4")})]})]})},Y=e=>{let{agentId:a}=e;return(0,n.jsx)(X,{agentId:a,channelType:"facebook"})},Z=e=>{let{agentId:a}=e;return(0,n.jsx)(X,{agentId:a,channelType:"instagram"})};var ee=l(72331);let ea=(0,t.forwardRef)((e,a)=>{let{agentId:l}=e,[s,i]=(0,t.useState)(""),[r,o]=(0,t.useState)(!1),[c,d]=(0,t.useState)(!1),{loading:p}=(0,h.A)(()=>(0,v.eI)({id:l}),{ready:!!l,onSuccess:e=>{i(e.data.systemPrompt||""),d(!0)}}),{runAsync:g,loading:u}=(0,h.A)(v.IA,{manual:!0}),f=async()=>{try{return await g({id:l,systemPrompt:s}),o(!1),!0}catch{return!1}};(0,t.useImperativeHandle)(a,()=>({hasUnsavedChanges:()=>r,handleSave:f}),[r,l,s]);let j=!!l&&!c;return(0,n.jsxs)("div",{className:"h-full flex flex-col",children:[(0,n.jsx)("div",{className:"text-16px font-400 color-[rgba(0,0,0,0.85)] leading-24px flex-shrink-0 bg-white rounded-t-2 mx--6 mt--6 px-6 py-3",style:{boxShadow:"0 2px 2px 0 rgba(0, 0, 0, 0.05)"},children:$i18n("1bTeH8ek")}),j?(0,n.jsx)("div",{className:"mt-3",children:(0,n.jsx)(x.A,{active:!0,paragraph:{rows:10},title:!1})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"relative flex-1 min-h-0 mt-3",children:[(0,n.jsx)(ee.A,{maxLength:5e3,placeholder:$i18n("1bTeH8el"),style:{height:"100%"},value:s,onChange:e=>{i(e||""),o(!0)}}),(0,n.jsxs)("div",{className:"absolute bottom-12px right-34px color-[rgba(0,0,0,0.25)] font-400 text-12px",children:[s.length,"/",5e3]})]}),(0,n.jsx)("div",{className:"flex-shrink-0 mt-4",children:(0,n.jsx)(m.A,{disabled:!r,loading:u||p,style:{opacity:r?1:.3},type:"primary",onClick:f,children:$i18n("save")})})]})]})}),el=()=>{let e=(0,s.zy)(),a=(0,s.W6)(),{id:l,name:c}=e.state||{id:"",name:""},[d,x]=(0,t.useState)(c),[p,g]=(0,t.useState)("basic"),[m,h]=(0,t.useState)(!1),u=[{key:"basic",label:$i18n("114C6u2u")},{key:"prompt",label:$i18n("St3FLIW")},{key:"facebook",label:$i18n("114C6u2v")},{key:"instagram",label:$i18n("114C6u2w")}],f=(0,t.useRef)(null),v=(0,t.useRef)(null),j={basic:f,prompt:v},y={basic:(0,n.jsx)(N,{ref:f,agentId:l,name:d,onNameUpdated:x}),prompt:(0,n.jsx)(ea,{ref:v,agentId:l}),facebook:(0,n.jsx)(Y,{agentId:l}),instagram:(0,n.jsx)(Z,{agentId:l})},b=async()=>{var e,a;let l=null==(e=j[p])?void 0:e.current;return null==l||null==(a=l.hasUnsavedChanges)||!a.call(l)||"cancel"!==await new Promise(e=>{i.A.confirm({centered:!0,title:$i18n("wQz6Xpo"),content:$i18n("wQz6Xpz"),okText:$i18n("ok"),cancelText:$i18n("cancel"),onOk:()=>e("save"),onCancel:()=>e("cancel")})})},A=async()=>
1{if(!m){h(!0);try{await b()&&a.push("/aiBotSetting?from=CommentAgent")}finally{h(!1)}}},w=async e=>{if(!m&&e!==p){h(!0);try{await b()&&g(e)}finally{h(!1)}}};return(0,n.jsxs)("div",{className:"h-full flex flex-col overflow-hidden bg-#F5F6FA",children:[(0,n.jsxs)("div",{className:"flex items-center gap-4 px-4 h-12 flex-shrink-0",children:[(0,n.jsx)("div",{className:"flex items-center justify-center w-6 h-6 bg-white rounded-2 cursor-pointer",onClick:A,children:(0,n.jsx)(o.A,{className:"text-10px"})}),(0,n.jsx)(r.A,{title:d,children:(0,n.jsx)("span",{className:"text-14px font-500 color-[rgba(0,0,0,0.85)] leading-22px truncate max-w-60",children:d})})]}),(0,n.jsx)("div",{className:"px-6 flex-shrink-0",children:(0,n.jsx)("div",{className:"inline-flex items-center h-8 px-1 bg-[rgba(231,233,237,0.5)] border-1 border-solid border-#E7E9ED rounded-2",children:u.map(e=>(0,n.jsx)("div",{className:`flex items-center justify-center px-6 h-7 rounded-2 cursor-pointer text-13px leading-22px transition-all ${p===e.key?"bg-white text-#FF6600 font-500 shadow-[0px_0px_4px_rgba(188,201,228,0.35)]":"color-[rgba(0,0,0,0.45)]"}`,onClick:()=>w(e.key),children:e.label},e.key))})}),(0,n.jsx)("div",{className:`flex-1 p-6 ${"basic"===p?"overflow-y-auto":"overflow-hidden"}`,children:"basic"===p?y[p]:(0,n.jsx)("div",{className:"bg-white rounded-2 p-6 h-full overflow-y-auto",children:y[p]})})]})},en=()=>(0,n.jsx)(el,{})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.