1import{b5 as Be,j as e,w as ee,aR as it,ag as Pe,r as a,u as Xe,N as et,aT as lt,b as te,t as oe,T as ge,D as ct,e as J,aO as dt,B as ut,h as pt,aU as mt,ba as _t,k as gt,aM as he,n as ht,a as Qe,R as Fe,a5 as Tt,x as De,b0 as ft,b6 as Et,f as It}from"./index-BBY15sAj.js";import{H as St}from"./Header-ClnXQq65.js";import{u as xt,T as Ct,R as bt,s as Ot}from"./useSyncSearchParamsPayload-D1Lz934y.js";import{C as yt}from"./ConnectionAction-BnbUuzw_.js";import{t as Ge}from"./toastCombinedError-D88axXD5.js";import{W as At,A as Ke,S as Mt,d as Rt}from"./getDataForModerationRules-Dz7YeShV.js";import{g as kt,a as jt}from"./sortingQueryBuilder-C0y4NVxx.js";import{u as X}from"./urlQueryBuilder-B7FR08j4.js";import{T as Nt}from"./TooltipWrapper-CBLJYZze.js";import{g as vt,K as wt}from"./getTableMenuPosition-WuTxV5bS.js";import{M as Lt}from"./Menu-BmjpnJkl.js";import{T as se,g as b,f as tt,S as i,b as ot,j as Pt,k as Dt,h as Se,i as A,a as Kt}from"./combinedPlatforms-CReTWGaj.js";import{C as Wt}from"./ConfirmDeleteModal-Jtn60Tga.js";import{u as Ht}from"./index-DETtyvdi.js";import{t as Bt}from"./toDisableInputFilter-clfdYQMq.js";import{S as Ft}from"./SearchInput-CJVm_E8a.js";import{O as Gt}from"./OldCommentsModal-DrdsRnDD.js";import{g as Ut,K as Yt}from"./index-BJMnTMs_.js";import{g as zt,R as $t}from"./index-wO5rIXG8.js";import{g as Vt,A as qt}from"./AddAiChatbotModal-9avrUVVW.js";import{u as Qt}from"./useUnsavedChangesWarning-CkM8xOWG.js";import{T as Zt}from"./TwoButtonsModal-tO79iaxk.js";import{O as Ze}from"./AddOfferModal-Y5UgbePs.js";import{e as Jt,c as st,d as Xt,f as nt,h as at,i as eo}from"./tt-api-functions-m_e8To36.js";import{T as to,b as Te,I as fe}from"./TextField-8dAl8v62.js";import{S as Ee}from"./Select-BcWdgGSa.js";import{M as Ie}from"./MenuItem-BqljAD2L.js";import{F as oo}from"./FormControlLabel-CRof4pPy.js";import{S as so}from"./Switch-Cz5SRIXz.js";import{A as Je}from"./AddOutlined-xp7vmzic.js";import"./Pagination-kJmwjW-c.js";import"./Checkbox-C7OkiWj7.js";import"./SwitchBase-BpCCQgwG.js";import"./useFormControl-D94OB1U5.js";import"./TableRow-Cs4Ck_0d.js";import"./appendTeamSlug-DMTfDJv9.js";import"./constants-Duf901SP.js";import"./DateTimeSelector-0gBxCtCO.js";import"./AdapterDateFns-C-OHZdwG.js";import"./useThemeProps-D7Q1aVMZ.js";import"./ListItem-BbAPWlGe.js";import"./isHostComponent-DVu5iVWx.js";import"./isMuiElement-iu7bEC02.js";import"./visuallyHidden-Dan1xhjv.js";import"./InputAdornment-DkvlsNnF.js";import"./index-GLQxUWa4.js";import"./index-COmIkRYU.js";import"./index-CPZ6avG0.js";import"./CalendarTodayOutlined-C_jDnXq9.js";import"./Toolbar-B0_ovqE9.js";import"./Autocomplete-Dybmme_b.js";import"./Close-Ch4GpVRF.js";import"./Slider-CMrk443i.js";import"./Delete-CjMr1BJL.js";import"./InfoOutlined-wUqsSERe.js";import"./user-5-Dsg3LaOk.js";import"./index-OztSKMtU.js";import"./IconMessageChatbot-DsnbX1F4.js";import"./deepEqualNormalized-VIur5MJC.js";import"./intercomOffset-BqOunVEA.js";import"./utils-Dk5xpljW.js";const no="_page_1yk3l_1",ao="_pageHeader_1yk3l_121",ro="_pageTitle_1yk3l_133",io="_pageSubtitle_1yk3l_148",lo="_mainWrapper_1yk3l_156",co="_buttonsContainer_1yk3l_169",uo="_actionWrapper_1yk3l_190",po="_inputContainer_1yk3l_204",mo="_tableWrapper_1yk3l_242",_o="_translatedMessage_1yk3l_263",Ue={page:no,pageHeader:ao,pageTitle:ro,pageSubtitle:io,mainWrapper:lo,buttonsContainer:co,actionWrapper:uo,inputContainer:po,tableWrapper:mo,translatedMessage:_o};var ze=(c=>(c[c.TT_UPDATE_PAGE_CONFIG_AND_FILTERS=0]="TT_UPDATE_PAGE_CONFIG_AND_FILTERS",c))(ze||{});const W={TIKTOK_COMMENT:"tiktok_comment"},rt={[W.TIKTOK_COMMENT]:"TikTok comments"};var Ye=(c=>(c.ADVERTISERS_REQUEST="?tiktok_account_id=",c))(Ye||{});const K={page:1,page_size:Be[0],platform:se.TIKTOK},go=(c,p)=>p.type!==ze.TT_UPDATE_PAGE_CONFIG_AND_FILTERS?c:{...c,...K,...p.payload},ho=(c,p)=>[{id:b.EDIT,content:"Edit"},{id:b.OLD_COMMENT,content:"Apply to previous content"},{id:p?b.DISABLE:b.ENABLE,content:p?b.DISABLE:b.ENABLE},{id:b.DUPLICATE,content:"Duplicate"},{id:b.DELETE,content:"Delete",destructive:!0,dividerBefore:!0}],To="This rule is blocked. Contact [email protected] to re-activate your account.",fo=(c,p)=>[{accessorKey:"moderation_rule_name",header:"Moderation rule name",meta:{rowDataStyle:{maxWidth:"30vw"}},cell:({row:{original:r}})=>e.jsxs(e.Fragment,{children:[e.jsx(Nt,{anchorElement:void 0,id:`${r==null?void 0:r.id}
1`,className:Ue.tooltipWrapper,style:{maxWidth:500,textWrap:"wrap",wordBreak:"break-word"},children:r.name}),e.jsx(ee,{variant:"b4-regular","data-tooltip-id":`${r==null?void 0:r.id}`,className:Ue.translatedMessage,children:r.name})]})},{accessorKey:"moderation_target",header:"Moderation target",meta:{sortColumn:!0},cell:({row:{original:r}})=>e.jsx(ee,{variant:"b4-regular",children:rt[r.moderation_target]})},{accessorKey:"moderation_condition",header:"Condition",meta:{sortColumn:!0},cell:({row:{original:r}})=>e.jsx(ee,{variant:"b4-regular",style:{maxWidth:p?"200px":"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.condition?tt[r.condition]:""})},{accessorKey:"is_active",header:"Status",meta:{sortColumn:!0},cell:({row:{original:r}})=>String((r==null?void 0:r.status)||"").toLowerCase()==="blocked"?e.jsx(it,{title:To,arrow:!0,children:e.jsx("span",{children:e.jsx(Pe,{variant:"outlined",color:"warning",label:"Blocked"})})}):r!=null&&r.is_active?e.jsx(Pe,{variant:"outlined",color:"success",label:"Enabled"}):e.jsx(Pe,{variant:"outlined",color:"error",label:"Disabled"})},{header:"Action",meta:{headerStyle:{textAlign:"right"},rowDataStyle:{textAlign:"right"}},cell:({row:{original:r,index:f},table:E})=>{const m=vt(f,E),T=ho(r.moderation_target,r.is_active);return e.jsx(Lt,{TriggerElement:e.jsx(wt,{}),menuItems:T,menuPosition:m,onMenuItemClick:H=>c(H,r)})}}],We=[i.REPLY,i.REPLY_WITH_AI,i.HIDE];i.REPLY,i.REPLY_WITH_AI;const He={name:"",moderation_target:W.TIKTOK_COMMENT,condition:ot.KEYWORD_CONTAINS,sentiment_labels:[],keyword_groups:[],action:i.UNSET,is_active:!0,reply_group:0,ai_chatbot_config:0,tiktok_account:0,tiktok_advertisers:[],platform:se.TIKTOK},Eo=(c,p)=>c.length!==p.length?!1:c.every((r,f)=>r===p[f]),Io=(c,p)=>Object.keys(c).some(f=>{if(Object.prototype.hasOwnProperty.call(p,f)){const E=c[f],m=p[f];return Array.isArray(E)&&Array.isArray(m)?!Eo(E,m):E!==m}return!1}),So=({open:c,setOpen:p,startInputsInModal:r,setStartInputsInModal:f,handleCloseModal:E})=>{var qe;const[m,T]=a.useState(He),[H,xe]=a.useState([]),[_,ne]=a.useState(!1),[j,Ce]=a.useState([]),[be,Oe]=a.useState([]),[B,M]=a.useState(!1),[ye,F]=a.useState(We),[ae,G]=a.useState(!1),[U,Y]=a.useState(!1),[z,N]=a.useState(!1),[re,$]=a.useState(null),Ae=Xe(),{ruleId:g}=et(),v=lt(),{name:V,moderation_target:ie,condition:l,sentiment_labels:R,keyword_groups:w,action:u,is_active:Me,reply_group:S,ai_chatbot_config:L,tiktok_account:I,tiktok_advertisers:O,scope:le}=m,y=!!g,Re=!!V&&!!I&&!!(O!=null&&O.length)&&(l!=null&&l.includes("keyword")?!!(w!=null&&w.length):!0)&&(l!=null&&l.includes("sentiment")?!!(R!=null&&R.length):!0)&&!!u&&(u===i.HIDE||(u===i.REPLY_WITH_AI||u===i.REPLY_WITH_DM_WITH_AI)&&L&&L>0||S&&S>0),ce=Io(re||He,m);Qt(ce);const{execute:ke}=te(Jt,{onSuccess(t){const n={name:t.name,moderation_target:t.moderation_target,condition:t.condition,sentiment_labels:t.sentiment_labels,keyword_groups:t.keyword_groups,action:t.action,is_active:t.is_active,reply_group:t.reply_group,ai_chatbot_config:t.ai_chatbot_config,tiktok_account:t.tiktok_account||0,tiktok_advertisers:t.tiktok_advertisers||[],platform:t.platform||se.TIKTOK};t.moderation_target===W.TIKTOK_COMMENT&&F(We),T({...n}),$({...n})},onError(){oe("Something went wrong while fetching exact moderation rule data")}}),{execute:je,data:q,loading:Ne}=te(st,{onError(){oe("Something went wrong while fetching TikTok accounts data")}}),{execute:de,data:x,loading:ue}=te(Xt,{onError(){oe("Something went wrong while fetching TikTok advertisers data")}});a.useEffect(()=>{g&&ke(g)},[g]),a.useEffect(()=>{I&&de(`${Ye.ADVERTISERS_REQUEST}${I}`)},[I]),a.useEffect(()=>{je()},[]);const ve=a.useMemo(()=>q?q.results.map(t=>({id:t.id,name:t.display_name})):[],[q]),pe=()=>{T(He),re&&$(null),p(!1),f(null),z&&N(!1),g&&Ae(Fe.TT_MODERATION_RULES)},k=()=>{if(!z&&ce){N(!0);return}pe()};a.useEffect(()=>{r&&T(t=>({...t,...r}))},[r]),a.useEffect(()=>{!y&&v&&u!==i.HIDE&&u!==i.UNSET&&T(t=>({...t,action:i.HIDE,reply_group:0,ai_chatbot_config:0}))},[v,u,y]);const o=t=>{const{name:n,value:d,type:h,checked:P}=t.target;T(_e=>({..._e,[n]:h==="checkbox"?P:d}))},s=t=>{const{name:n,value:d}=t.target;if(Array.isArray(d)){if(n===A.KEYWORD_GROUPS&&d.includes(`add ${n}`)){M(!0),ne(!1);return}}
1else if(typeof d=="string"&&d===`add ${n}`){if(n===A.AI_CHATBOT_CONFIG){Y(!0);return}if(n===A.REPLY_GROUP){G(!0);return}}T(h=>n==="moderation_target"?(d===W.TIKTOK_COMMENT&&F(We),{...h,moderation_target:d,action:i.UNSET,scope:Se.SELECTED}):{...h,[n]:d})},C=async(t,n)=>{T(d=>{let h=n.length>0?n:null;return h&&(t==="tiktok_account"?(h=h[0],de(`${Ye.ADVERTISERS_REQUEST}${h}`)):t==="tiktok_advertisers"&&(h=h.flatMap(P=>((x==null?void 0:x.results.filter(D=>D.id===P))||[]).map(D=>({id:D.id,name:D.name||D.advertiser_id,advertiser_id:D.advertiser_id}))))),{...d,[t]:h}})},Q=a.useMemo(()=>(x==null?void 0:x.results.map(t=>({id:t.id,name:t.name||t.advertiser_id})))||[],[x]),we=t=>{T(n=>{const d=n.keyword_groups?[...n.keyword_groups]:[];return{...n,keyword_groups:[...d,t]}})},me=(t,n)=>{T(d=>({...d,[n]:t}))},Z=(t,n)=>{T(d=>{var P;let h=0;return n===A.KEYWORD_GROUPS&&(h=((P=d[n])==null?void 0:P.filter(_e=>_e!==t))||[]),{...d,[n]:h}})},Le=async t=>{t.preventDefault();const n={...m,scope:le||Se.SELECTED,tiktok_advertiser_ids:O.map(d=>d.id)};u===i.HIDE?(delete n.reply_group,delete n.ai_chatbot_config):u===i.REPLY_WITH_AI||u===i.REPLY_WITH_DM_WITH_AI?delete n.reply_group:delete n.ai_chatbot_config;try{g?await nt(+g,n):await at(n)}catch(d){Ge(d);return}E?E():pe()};a.useEffect(()=>{zt("?page=1&page_size=300").then(t=>{Ce(t.results)})},[ae]),a.useEffect(()=>{Ut("?page=1&page_size=300").then(t=>{xe(t.results)})},[B]),a.useEffect(()=>{Vt("?page=1&page_size=300").then(t=>{Oe(t.results)})},[U]);const $e=ie!==W.TIKTOK_COMMENT?Pt:Dt,Ve=!y&&v?{[i.HIDE]:$e[i.HIDE]}:$e;return e.jsxs(a.Fragment,{children:[e.jsx(Zt,{isOpen:z,handleClose:k,title:e.jsx(ge,{textAlign:"center",fontWeight:"bold",width:"100%",letterSpacing:0,children:"WARNING"}),text:e.jsxs(e.Fragment,{children:[e.jsx(ge,{textAlign:"center",children:"You currently have unsaved data."}),e.jsx(ge,{textAlign:"center",mb:"40px",children:"If you close this window now, your changes will be lost."})]}),textButtonOne:"Close",textButtonTwo:"Stay here",functionButtonOne:k,functionButtonTwo:()=>N(!1)}),e.jsx(Yt,{open:B,setOpen:M,addItemId:we}),e.jsx($t,{open:ae,setOpen:G,addItemId:me}),U&&e.jsx(qt,{isOpenModal:U,setIsOpenModal:Y,addItemId:me,fullscreen:!1}),e.jsx(ct,{fullWidth:!0,maxWidth:!1,open:c,onClose:E??k,TransitionComponent:dt,PaperProps:{sx:{width:"calc(100% - 32px)",maxWidth:560,maxHeight:"calc(100% - 32px)",m:2,borderRadius:`${J.radius.card}px`,boxShadow:J.shadow.floating,overflow:"hidden"}},children:e.jsxs(ut,{component:"form",noValidate:!0,autoComplete:"off",onSubmit:Le,sx:{display:"flex",flexDirection:"column",minHeight:0,maxHeight:"calc(100vh - 32px)"},children:[e.jsxs(pt,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,px:3,py:2.5},children:[e.jsx(ge,{component:"h2",sx:{...J.typography.h4,color:J.color.ink},children:g?"Edit rule":"Create rule"}),e.jsx(mt,{onClick:k,"aria-label":"Close",children:e.jsx(_t,{})})]}),e.jsxs(gt,{dividers:!0,sx:{display:"flex",flexDirection:"column",gap:3,p:3,borderColor:J.color.hairline},children:[e.jsx(to,{name:"name",label:"Rule name",value:V,onChange:o}),e.jsx(Ze,{existingOptions:ve,chosenOptions:I?[I]:[],fieldName:"tiktok_account",label:"TikTok account",setChosenOptions:C,allowOnlyOneOption:!0,isDataLoading:Ne}),e.jsx(Ze,{existingOptions:Q,chosenOptions:O?O.map(t=>t.id):[],fieldName:"tiktok_advertisers",label:"Advertisers",setChosenOptions:C,isDataLoading:ue,disabled:!I}),e.jsxs(Te,{fullWidth:!0,children:[e.jsx(fe,{id:"moderation-target-label",children:"Moderation target"}),e.jsx(Ee,{label:"Moderation target",name:"moderation_target",labelId:"moderation-target-label",value:ie,onChange:s,MenuProps:he,children:Object.entries(rt).map(([t,n])=>e.jsx(Ie,{value:t,children:n},t))})]}),le===Se.ALL&&e.jsx(At,{}),e.jsxs(Te,{fullWidth:!0,children:[e.jsx(fe,{id:"condition-label",children:"Condition"}),e.jsx(Ee,{label:"Condition",labelId:"condition-label",name:"condition",value:l,onChange:s,MenuProps:he,children:Object.entries(tt).map(([t,n])=>e.jsx(Ie,{value:t,children:n},t))})]}),((qe=m==null?void 0:m.condition)==null?void 0:qe.includes("keyword"))&&e.jsx(Ke,{label:"Keywords",labelId:"keywords-MR-id",inputName:A.KEYWORD_GROUPS,openSelect:_,setOpenSelect:ne,currentRuleValue:m.keyword_groups,handleSelectChange:s,options:H,multiple:!0,handleDeleteChip:Z}),(l==null?void 0:l.includes("sentiment"))&&e.jsxs(Te,{fullWidth:!0,children:[e.jsx(fe,{id:"sentiment-labels-label",children:"Sentiment labels"}),e.jsx(Ee,{multiple:!0,name:"sentiment_labels",value:R,onChange:s,label:"Sentiment labels",labelId:"sentiment-labels-label",MenuProps:he,children:Mt.map(t=>e.jsx(Ie,{value:t.value,children:t.label},t.value))})]}),e.jsxs(Te,{fullWidth:!0,children:[e.jsx(fe,{id:"action-label",children:"Action"}),e.jsx(Ee,{name:"action",value:u,onChange:s,labelId:"action-label",label:"Action",MenuProps:he,children:ye.filter(t=>t!==i.UNSET&&Ve[t]!==void 0).map(t=>e.jsx(Ie,{value:t,disabled:y&&v&&t!==i.HIDE,children:Ve[t]},t))})]}),u&&(u===i.REPLY||u===i.REPLY_WITH_DM)?e.jsx(Ke,{label:"Replies",labelId:"replies-MR-id",inputName:A.REPLY_GROUP,currentRuleValue:m.reply_group,handleSelectChange:s,options:j,multiple:!1,handleDeleteChip:Z}):(u===i.REPLY_WITH_AI||u===i.REPLY_WITH_DM_WITH_AI)&&e.jsx(Ke,{label:"AI agent",labelId:"ai-agent-MR-TT-id",inputName:A.AI_CHATBOT_CONFIG,currentRuleValue:m[A.AI_CHATBOT_CONFIG],handleSelectChange:s,options:be,multiple:!1,handleDeleteChip:Z,textForAdding:"Add new AI agent"}
1),e.jsx(oo,{control:e.jsx(so,{checked:Me,onChange:o,name:"is_active",color:"primary"}),label:"Active"})]}),e.jsxs(ht,{sx:{gap:1.5,px:3,py:2.5},children:[e.jsx(Qe,{variant:"outlined",onClick:k,children:"Cancel"}),e.jsx(Qe,{type:"submit",variant:"contained",disabled:!Re,children:g?"Save changes":"Create rule"})]})]})})]})},Ns=()=>{const{page:c,pageHeader:p,pageTitle:r,pageSubtitle:f,mainWrapper:E,actionWrapper:m,inputContainer:T,tableWrapper:H,buttonsContainer:xe}=Ue,[_,ne]=a.useReducer(go,K),{setSearchParams:j}=xt({defaults:{page:"1",page_size:Be[0].toString()},actionType:ze.TT_UPDATE_PAGE_CONFIG_AND_FILTERS,dispatch:ne,sanitizeRest:o=>Ot(o),parse:o=>({page:Number(o.page)||K.page,page_size:Number(o.page_size)||K.page_size,search:o.search,ordering:o.ordering,contains_phishing:o.contains_phishing,platform:se.TIKTOK})}),{page:Ce,page_size:be,ordering:Oe}=a.useMemo(()=>_,[_]),[B,M]=a.useState(!1),[ye,F]=a.useState(!1),[ae,G]=a.useState(null),[U,Y]=a.useState(null),[z,N]=a.useState(!1),[re,$]=a.useState(null),Ae=Ht({maxWidth:768}),g=a.useRef(null),v=Xe(),{ruleId:V}=et(),{execute:ie,data:l,loading:R,error:w,reload:u}=te(eo,{initialLoading:!0,latestOnly:!0,onError(){oe("Failed to fetch MR data")}}),{execute:Me,data:S,loading:L,error:I,reload:O}=te(st,{initialLoading:!0,latestOnly:!0}),le=Tt(o=>o.teams.selectedTeam.team_slug);a.useEffect(()=>{Me("?page=1&page_size=100")},[le]);const y=!L&&!I&&((S==null?void 0:S.count)??0)>0;a.useEffect(()=>{ie(X({..._}))},[_,B]),a.useEffect(()=>{V&&M(!0)},[V]),a.useEffect(()=>{if(!g.current)return;const o=_.search??"";g.current.value!==o&&(g.current.value=o)},[_.search]);const Re=o=>{const s=X({..._,...K,search:o});j(s)},ce=()=>{var s;if(!_.search&&!((s=g.current)!=null&&s.value))return;const o=X({..._,...K,search:void 0});j(o)},ke=(o,s)=>{const Q=X({..._,...{page:o,page_size:s}});j(Q)},je=o=>{const s=jt(o),C=X({..._,ordering:s});j(C)},q=async o=>{try{await Rt(o),u()}catch(s){oe("Failed to delete rule"),console.error("Delete error:",s)}},Ne=async o=>{try{await nt((o==null?void 0:o.id)??0,{is_active:!o.is_active}),It(`The ${o.name} rule ${o.is_active?"disabled":"enabled"} successfully.`)}catch(s){Ge(s)}},de=async(o,s)=>{const{DELETE:C,EDIT:Q,OLD_COMMENT:we,ENABLE:me,DISABLE:Z,DUPLICATE:Le}=b;switch(o){case C:F(!0),G(s!=null&&s.id?+s.id:null);break;case Q:v(`${Fe.TT_MODERATION_RULES}/${s.id}`);break;case we:N(!0),$(s!=null&&s.id?s.id:null);break;case me:case Z:await Ne(s),u();break;case Le:await x(s),u()}},x=async o=>{try{const s={platform:o.platform,action:o.action,ai_chatbot_config:o.ai_chatbot_config,condition:o.condition,is_active:o.is_active,keyword_groups:o.keyword_groups,moderation_target:o.moderation_target,reply_group:o.reply_group,sentiment_labels:o.sentiment_labels,scope:Se.SELECTED,name:`${o.name} - copy`,tiktok_account:o.tiktok_account,tiktok_advertiser_ids:o.tiktok_advertisers.map(C=>C.id)};await at(s)}catch(s){Ge(s);return}},ue=()=>{M(!0)},ve=o=>{const s={name:"Hide negative comments",moderation_target:W.TIKTOK_COMMENT,condition:ot.SENTIMENT_MATCHES,sentiment_labels:[Kt.NEGATIVE],action:i.HIDE,is_active:!0,platform:se.TIKTOK};Y(s),M(!0)},pe={setOpen:M,open:B,startInputsInModal:U,setStartInputsInModal:Y},k=Bt(_,l==null?void 0:l.results);return e.jsxs("div",{className:c,children:[e.jsx(St,{className:p,titleClassName:r,subtitleClassName:f,subTitle:"Manage all your TikTok rules in one place",title:"Rules",renderCustomComponent:e.jsxs("div",{className:xe,children:[e.jsx(De,{size:"Small",variant:"Outlined",onClick:()=>ve(),disabled:!y,children:e.jsxs(e.Fragment,{children:[e.jsx(Je,{})," ",e.jsx(ee,{children:"Hide negative comments"})]})}),e.jsx(De,{size:"Small",variant:"Primary",onClick:ue,disabled:!y,children:e.jsxs(e.Fragment,{children:[e.jsx(Je,{})," ",e.jsx(ee,{children:"Add rule"})]})})]})}),e.jsx(So,{...pe}),e.jsx(Wt,{openModal:ye,setOpenModal:F,deleteItem:q,idToDelete:ae,setIdToDelete:G}),e.jsx(Gt,{isOpen:z,setIsOpen:N,ruleId:re,setRuleId:$}),I?e.jsx(ft,{errorText:"Unable to load connected TikTok accounts.",onButtonClick:O}):!L&&(S==null?void 0:S.count)===0&&!R&&!w&&(l==null?void 0:l.count)===0?e.jsx(Et,{title:"Connect a TikTok account to create rules.",actions:e.jsx(yt,{to:Fe.TT_ACCOUNTS,children:"Connect an account"})}
1):e.jsxs("main",{className:E,children:[e.jsxs("div",{className:m,children:[e.jsx(Ft,{placeholder:"Search rules",value:_.search??"",onSearch:Re,containerProps:{className:T},disabled:k,onClear:ce,ref:g}),xo]}),R||L?e.jsx(Ct,{}):e.jsx(bt,{data:(l==null?void 0:l.results)||[],emptyText:_.search||_.contains_phishing?"No rules match your search or filters.":"No moderation rules yet. Create a rule to get started.",emptyActions:e.jsx(De,{variant:"Primary",onClick:ue,disabled:!y,children:"Add rule"}),columns:fo(de,Ae),handleSelectedRow:()=>{},className:H,showErrorContainer:w,pagination:!0,sortingState:kt(Oe),paginationProps:{onPageChange:ke,totalCount:Number(l==null?void 0:l.count)||0,currentPage:Number(Ce)||0,pageSize:Number(be)||0,pageSizeOptions:Be},enableSorting:!0,onSortingChange:o=>{je(o)},errorContainerProps:{errorText:"Unable to load moderation rules.",onButtonClick:u},showScroll:!1})]})]})},xo=!1;export{Ns as default};
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.