1import {T}from'./chunk-DMj-RMej.js';import {S}from'./chunk-BUEVLaRT.js';import {W as W$1}from'./chunk-CF84gehD.js';import {R}from'./chunk-BGOHF1M9.js';import {c as ce}from'./chunk-BRsHFk4j.js';import'./chunk-C0DmzTpz.js';import {W,aJ as ve,eo as Yt,fC as qD,dH as bn$1,d9 as s,E,D,V,fD as C,fB as y,aE as ut,O,v as vr,e as f,bI as Gt,d5 as d,bJ as V$1,a as G,ex as Ct,X as Xb,j as Xv,cX as Yv,cY as OM,aA as LM,N as Ng,bu as Ts,bv as Og,bM as Ic,bN as Gc,T as Tt,z as zg,w as w0,H as H0,Z as Zx,k as dn$1,b2 as da,cp as xr,da as wr,l as zw,bA as Nw,s as sk,n as nd,r as rC,m as wC,o as mv,p as GC,t as tD,q as vD,u as al,x as tM,y as dM,L as Lb,A as r1,P as P1,B as xS,C as Vs,F as zs,I as Fi$1,J as GS,bB as rf,bC as Od,K as iI,M as RI,Q as us,S as ms,Y as UI,_ as tE,c6 as eE,$ as Dn$1,a0 as ME,a1 as ny,a2 as go,a3 as Kd,av as on$1,a4 as XE,fg as Zf,a5 as LT,a6 as mA,cx as WM,a7 as mt,a8 as fy,aa as Js,ac as H_,ae as pS,ad as gd,aB as ey,aC as DS,ai as dy,bn as nS,ag as SC,aj as jy,al as gS,ak as Ed,aZ as by,a_ as m_,a$ as y_,b8 as an$1,b9 as Wm,df as Wc,dg as xc,dh as vc,cV as fu,cS as ey$1,cT as iy,cU as ty,bV as zy,bW as W_,bD as db,ab as Ey,bX as $y,bE as pb,ba as xy,ar as kt,cL as Bf,c3 as Xr,R as RM,fE as Mf,fF as kf,a9 as ZT,af as XT,ah as YT,b5 as ly,am as JT,aR as i_,aS as Vp,aT as d_,aU as Hp,aV as KT,aD as By,cE as vd,cF as Ea,bg as mS,bS as Y_,bl as zg$1,bi as D_,bh as rS,bk as gy}from'./main-4WA6AAHG.js';import {l as l$1}from'./chunk-CkU8oUfw.js';function Hi(t,p){t&1&&(Js(0,"p",13)(1,"mat-icon"),H_(2,"lock"),gd(),H_(3),pS(4,"translate"),gd()),t&2&&(SC(3),Ed(" ",gS(4,1,"Automatic replies are not included in your current plan. You can still reply to comments yourself.")," "));}var Fi=(()=>{class t{constructor(e,a,n,c,y,De){this.ref=e,this.service=a,this.toastr=n,this.translate=c,this.errorService=y,this.saving=false,this.model=D({},De);}save(){this.saving=true,this.service.updateTikTokCommentSettings({autoReplyPublicComment:this.model.autoReplyPublicComment,maxRepliesPerVideo:this.model.maxRepliesPerVideo,maxRepliesPerHour:this.model.maxRepliesPerHour}).subscribe({next:e=>{if(this.saving=false,!e?.succeeded){this.errorService.setError(e?.errors,this.translate.instant("Failed to Complete the Operation"));return}this.toastr.success(this.translate.instant("Settings saved")),this.ref.close(e.data);},error:e=>{this.saving=false,this.errorService.setError(e,this.translate.instant("Failed to Complete the Operation"));}});}close(){this.ref.close();}static{this.\u0275fac=function(a){return new(a||t)(V(an$1),V(C),V(ut),V(O),V(Gt),V(Wm))};}static{this.\u0275cmp=Xb({type:t,selectors:[["app-tiktok-comment-settings-dialog"]],decls:39,vars:40,consts:[["mat-dialog-title",""],[1,"tt-settings"],[1,"tt-settings__row"],[3,"ngModelChange","ngModel","disabled"],[1,"tt-settings__hint"],["class","tt-settings__locked",4,"ngIf"],[1,"tt-settings__limits"],["appearance","outline"],["matInput","","type","number","min","0","max","500",3,"ngModelChange","ngModel","disabled"],["matInput","","type","number","min","0","max","1000",3,"ngModelChange","ngModel","disabled"],["align","end"],["mat-button","",3,"click"],["mat-flat-button","","color","primary",3,"click","disabled"],[1,"tt-settings__locked"]],template:function(a,n){a&1&&(Js(0,"h2",0),H_(1),pS(2,"translate"),gd(),Js(3,"mat-dialog-content",1)(4,"div",2)(5,"mat-slide-toggle",3),zy("ngModelChange",function(y){return W_(n.model.autoReplyPublicComment,y)||(n.model.autoReplyPublicComment=y),y}),H_(6),pS(7,"translate"),gd(),db(),Js(8,"p",4),H_(9),pS(10,"translate"),gd(),ey(11,Hi,5,3,"p",5),gd(),Js(12,"div",6)(13,"p",4),H_(14),pS(15,"translate"),gd(),Js(16,"mat-form-field",7)(17,"mat-label"),H_(18),pS(19,"translate"),gd(),Js(20,"input",8),zy("ngModelChange",function(y){return W_(n.model.maxRepliesPerVideo,y)||(n.model.maxRepliesPerVideo=y),y}),gd(),db(),Js(21,"mat-hint"),H_(22),pS(23,"translate"),gd()(),Js(24,"mat-form-field",7)(25,"mat-label"),H_(26),pS(27,"translate"),gd(),Js(28,"input",9),zy("ngModelChange",function(y){return W_(n.model.maxRepliesPerHour,y)||(n.model.maxRepliesPerHour=y),y}),gd(),db(),Js(29,"mat-hint"),H_(30),pS(31,"translate"),gd()()()(),Js(32,"mat-dialog-actions",10)(33,"button",11),Ey("click",function(){return n.close()}),H_(34),pS(35,"translate"),gd(),Js(36,"button",12),Ey("click",function(){return n.save()}),H_(37),pS(38,"translate"),gd()()),a&2&&(SC(),jy(gS(2,20,"Comment reply settings")),SC(4),$
1y("ngModel",n.model.autoReplyPublicComment),dy("disabled",!n.model.isAiEntitled),pb(),SC(),Ed(" ",gS(7,22,"Reply to comments automatically")," "),SC(3),Ed(" ",gS(10,24,"Welcome, keyword and AI replies are posted publicly under the comment.")," "),SC(2),dy("ngIf",!n.model.isAiEntitled),SC(),xy("tt-settings__limits--off",!n.model.autoReplyPublicComment),SC(2),Ed(" ",gS(15,26,"Limits protect your allowance and stop TikTok treating repeated replies as spam.")," "),SC(4),jy(gS(19,28,"Maximum automatic replies per video")),SC(2),$y("ngModel",n.model.maxRepliesPerVideo),dy("disabled",!n.model.autoReplyPublicComment),pb(),SC(2),jy(gS(23,30,"Counted over the life of the video")),SC(4),jy(gS(27,32,"Maximum automatic replies per hour")),SC(2),$y("ngModel",n.model.maxRepliesPerHour),dy("disabled",!n.model.autoReplyPublicComment),pb(),SC(2),jy(gS(31,34,"Across all of your videos")),SC(4),jy(gS(35,36,"Cancel")),SC(2),dy("disabled",n.saving),SC(),Ed(" ",gS(38,38,"Save")," "));},dependencies:[Xv,OM,Ng,Ts,Wc,Og,xc,vc,Gc,Tt,zg,w0,H0,Zx,dn$1,da,xr,wr,zw,Nw,sk,nd,rC,wC,fu,mv,GC,tD,vD,al,tM,dM,Lb,r1,P1,xS,Vs,zs,GS,iI,RI,us,ms,UI,tE,Dn$1,ME,ny,ey$1,iy,ty,go,Kd,XE,LT,mA,mt],styles:[".tt-settings[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:20px;padding-top:8px}.tt-settings__hint[_ngcontent-%COMP%]{margin:6px 0 0;font-size:13px;opacity:.75}.tt-settings__locked[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin:10px 0 0;font-size:13px;opacity:.85}.tt-settings__locked[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.tt-settings__limits[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px}.tt-settings__limits--off[_ngcontent-%COMP%]{opacity:.55}.tt-settings[_ngcontent-%COMP%] mat-form-field[_ngcontent-%COMP%]{width:100%}"],changeDetection:1});}}return t})();var I=(function(t){return t[t.Unanswered=1]="Unanswered",t[t.RepliedByAgent=2]="RepliedByAgent",t[t.RepliedAutomatically=3]="RepliedAutomatically",t[t.RepliedInTikTokApp=4]="RepliedInTikTokApp",t[t.NoReplyNeeded=5]="NoReplyNeeded",t})(I||{});var B=(function(t){return t[t.AwaitingReply=1]="AwaitingReply",t[t.Replied=2]="Replied",t[t.NoReplyNeeded=3]="NoReplyNeeded",t[t.All=4]="All",t})(B||{});var Qi=()=>["Your TikTok account is not connected, so new comments cannot be fetched."],Xi=()=>[1,2,3,4],Gi=()=>[10,20,50],Ki=(t,p)=>p.value,Ji=(t,p)=>p.messageId;function Zi(t,p){t&1&&fy(0,"app-alert-message",1),t&2&&dy("messages",nS(2,Qi))("dismissible",false);}function en(t,p){if(t&1){let e=i_();Js(0,"mat-chip-option",7),Ey("selectionChange",function(n){let c=Vp(e).$implicit,y=d_();return Hp(n.selected&&y.setFilter(c.value))}),H_(1),pS(2,"translate"),gd();}if(t&2){let e=p.$implicit,a=d_();dy("value",e.value)("selected",e.value===a.filter)("selectable",e.value!==a.filter),SC(),Ed(" ",gS(2,4,e.label)," ");}}function tn(t,p){t&1&&(Js(0,"p",4),fy(1,"app-spinner",8),H_(2),pS(3,"translate"),gd()),t&2&&(SC(),dy("diameter",14),SC(),Ed(" ",gS(3,2,"Checking TikTok for new comments\u2026")," "));}function nn(t,p){t&1&&(Js(0,"div",9),fy(1,"app-skeleton-loader",10),Js(2,"div",11),fy(3,"app-skeleton-loader",12)(4,"app-skeleton-loader",13),gd()()),t&2&&(SC(4),dy("lines",2));}function on(t,p){t&1&&(Js(0,"div",5),XT(1,nn,5,1,"div",9,KT),gd()),t&2&&(SC(),JT(nS(0,Xi)));}function an(t,p){if(t&1&&fy(0,"app-empty-state",6),t&2){let e=d_();dy("title",e.emptyTitle);}}function rn(t,p){if(t&1&&fy(0,"img",18),t&2){let e=d_().$implicit;dy("alt",Y_(e.videoCaption||""))("src",e.videoThumbnailUrl,zg$1);}}function sn(t,p){t&1&&(Js(0,"mat-icon"),H_(1,"music_video"),gd());}function ln(t,p){t&1&&(Js(0,"span",22)(1,"mat-icon"),H_(2,"reply"),gd(),H_(3),pS(4,"translate"),gd()),t&2&&(SC(3),Ed("",gS(4,1,"Replying to your reply")," "));}function dn(t,p){t&1&&(Js(0,"span",26),H_(1),pS(2,"translate"),gd()),t&2&&(SC(),jy(gS(2,1,"From the TikTok app")));}function pn(t,p){if(t&1&&(Js(0,"span",26),H_(1),gd()),t&2){let e=d_().$implicit;SC(),jy(e.answeredByName);}}function mn(t,p){if(t&1&&H_(0),t&2){let e=d_(2).$implicit;Ed(" ",e.dismissedByName," \xB7 ");}}function cn(t,p){if(t&1&&(Js(0,"span",26),ZT(1,mn,1,1),H_(2),pS(3,"date"),gd()),t&2){let e=d_().$implicit;SC(),YT(e.dismissedByName?1:-1),SC(),Ed("",mS(3,2,e.dismissedOn,"yyyy/MM/dd HH:mm")," ");}}function _n(t,p){if(t&1){let e=i_();Js(0,"button",32),Ey("click",function(){Vp(e);let n=d_().$implicit,c=d_(2);return Hp(c.setNoReplyNeeded(n,true))}),Js(1,"mat-icon"),H_(2,"do_not_disturb_on"),gd(),H_(3),pS(4,"translate"),gd();}if(t&2){let e=d_().$implicit,a=d_(2);dy("disabled",a.markingMessageId===e.messageId),SC(3),Ed("",gS(4,2,"No reply needed")," ");}}function un(t,p){if(t&1){let e=i_();Js(0,"button",32),Ey("click",function(){Vp(e);let n=d_().$implicit,c=d_(2);return Hp(c.setNoReplyNeeded(n,false))}),Js(1,"mat-icon"),H_(2,"undo"),gd(),H_(3),pS(4,"translate"),gd();}if(t&2){let e=d_().$implicit,a=d_(2);dy("disabled",a.markingMessageId===e.messageId),SC(3),Ed("",gS(4,2,"Move back to Needs a reply")," ");}}function gn(t,p){if(t&1){let e=i_();Js(0,"div",31)(1,"mat-form-field",33)(2,"mat-label"),H_(3),pS(4,"translate"),gd(),Js(5,"textarea",34),zy("ngModelChange",function(n){Vp(e);let c=d_(3);return W_(c.replyText,n)||(c.replyText=n),Hp(n)}),gd(),db(),Js(6,"mat-hint",35),H_(7),gd()(),Js(8,"div",36)(9,"button",30),Ey("click",function(){Vp(e);let n=d_(3);return Hp(n.cancelReply())}),H_(10),pS(11,"translate"),gd(),Js(12,"button",37),Ey("click",function(){Vp(e);let n=d_().$implicit,c=d_(2);return Hp(c.sendReply(n))}),H_(13),pS(14,"translate"),gd()()();}if(t&2){let e=d_(3);SC(3),jy(gS(4,8,"Your public reply")),SC(2),$y("ngModel",e.replyText),dy("maxlength",e.REPLY_MAX),pb(),SC(2),By("",e.replyText.length," / ",e.REPLY_MAX),SC(3),jy(gS(11,10,"Cancel")),SC(2),dy("disabled",e.sendingReply||!e.replyText.trim()),SC(),Ed(" ",gS(14,12,"Post reply")," ");}}function fn(t,p){if(t&1){let e=i_();Js(0,"div",9)(1,"button",17),pS(2,"translate"),Ey("click",function(){let n=Vp(e).$implicit,c=d_(2);return Hp(c.open(n))}),ZT(3,rn,1,3,"img",18)(4,sn,2,0,"mat-icon"),gd(),Js(5,"div",11)(6,"p",19),H_(7),pS(8,"translate"),gd(),Js(9,"div",20)(10,"strong"),H_(11),gd(),Js(12,"span",21),H_(13),pS(14,"date"),gd()(),ZT(15,ln,5,3,"span",22),Js(16,"p",23),H_(17),gd(),Js(18,"div",24)(19,"span",25),H_(20),pS(21,"translate"),gd(),ZT(22,dn,3,3,"span",26),ZT(23,pn,2,1,"span",26),ZT(24,cn,4,5,"span",26),gd(),Js(25,"div",27)(26,"button",28),Ey("click",function(){let n=Vp(e).$implicit,c=d_(2);return Hp(c.startReply(n))}),Js(27,"mat-icon"),H_(28,"reply"),gd(),H_(29),pS(30,"translate"),gd(),ZT(31,_n,5,4,"button",29),ZT(32,un,5,4,"button",29),Js(33,"button",30),Ey("click",function(){let n=Vp(e).$implicit,c=d_(2);return Hp(c.open(n))}),Js(34,"mat-icon"),H_(35,"video_library"),gd(),H_(36),pS(37,"translate"),gd()(),ZT(38,gn,15,14,"div",31),gd()();}if(t&2){let e=p.$implicit,a=d_(2);xy("tt-queue-item--selected",e.messageId===a.selectedMessageId),SC(),ly("aria-label",gS(2,20,"Open the video")),SC(2),YT(e.videoThumbnailUrl?3:4),SC(4),jy(e.videoCaption||gS(8,22,"Untitled video")),SC(4),jy(a.authorLabel(e)),SC(2),jy(mS(14,24,e.timestamp,"yyyy/MM/dd HH:mm")),SC(2),YT(e.isFollowUp?15:-1),SC(2),jy(e.text),SC(2),dy("ngClass",a.statusPillClass(e.status)),SC(),jy(gS(21,27,a.statusLabel(e.status))),SC(2),YT(e.status===a.Status.RepliedInTikTokApp?22:-1),SC(),YT(e.status===a.Status.RepliedByAgent&&e.answeredByName?23:-1),SC(),YT(e.status===a.Status.NoReplyNeeded&&e.dismissedOn?24:-1),SC(2),dy("disabled",!e.commentId||a.replyingToMessageId===e.messageId),SC(3),Ed("",gS(30,29,"Reply")," "),SC(2),YT(e.status===a.Status.Unanswered?31:-1),SC(),YT(e.status===a.Status.NoReplyNeeded?32:-1),SC(4),Ed("",gS(37,31,"Open the video")," "),SC(2),YT(a.replyingToMessageId===e.messageId?38:-1);}}function vn(t,p){if(t&1){let e=i_();Js(0,"div",14),XT(1,fn,39,33,"div",15,Ji),gd(),Js(3,"mat-paginator",16),Ey("page",function(n){Vp(e);let c=d_();return Hp(c.onPage(n))}),gd();}if(t&2){let e=d_();SC(),JT(e.items),SC(2),dy("length",e.total)("pageSize",e.pageSize)("pageIndex",e.pageNumber-1)("pageSizeOptions",nS(4,Gi));}}var rt=(()=>{class t{constructor(e,a,n,c,y,De){this.service=e,this.countService=a,this.signalR=n,this.toastr=c,this.translate=y,this.errorService=De,this.selectedMessageId=null,this.openComment=new kt,this.commentsChanged=new kt,this.REPLY_MAX=1200,this.Status=I,this.filters=[{value:B.AwaitingReply,label:"Needs a reply"},{value:B.Replied,label:"Replied"},{value:B.NoReplyNeeded,label:"No reply needed"},{value:B.All,label:"All"}],this.filter=B.AwaitingReply,this.items=[],this.total=0,this.pageNumber=1,this.pageSize=20,this.loading=false,this.hasLoadedOnce=false,this.checkingTikTok=false,this.notConnected=false,this.replyingToMessageId=null,this.replyText="",this.sendingReply=false,this.markingMessageId=null,this.liveReloadPending=false,this.loadSub=W.EMPTY,this.liveSub=W.EMPTY;}ngOnInit(){this.load(),this.checkTikTok(),this.liveSub=this.signalR.tikTokCommentReceived$.pipe(Bf
1(3e3)).subscribe(()=>{if(this.replyingToMessageId!==null){this.liveReloadPending=true;return}this.load();});}ngOnDestroy(){this.loadSub.unsubscribe(),this.liveSub.unsubscribe();}load(){this.loadSub.unsubscribe(),this.liveReloadPending=false,this.loading=true,this.loadSub=this.service.getTikTokCommentsByStatus(this.filter,this.pageNumber,this.pageSize).pipe(Xr(()=>this.loading=false)).subscribe({next:e=>{if(this.hasLoadedOnce=true,!e?.succeeded){this.errorService.setError(e?.errors,this.translate.instant("Failed to Complete the Operation"));return}this.items=e.data??[],this.total=e.count??this.items.length,this.items.length===0&&this.pageNumber>1&&this.total>0&&(this.pageNumber--,this.load());},error:e=>{this.hasLoadedOnce=true,this.errorService.setError(e,this.translate.instant("Failed to Complete the Operation"));}});}checkTikTok(){this.checkingTikTok||(this.checkingTikTok=true,this.service.refreshTikTokComments().pipe(Xr(()=>this.checkingTikTok=false)).subscribe({next:e=>{let a=e?.succeeded?e.data:null;a&&(this.notConnected=!a.isConnected,a.commentsImported>0&&(this.load(),this.countService.refresh().subscribe()));},error:()=>{}}));}refresh(){this.load(),this.checkTikTok();}setFilter(e){e!==this.filter&&(this.filter=e,this.pageNumber=1,this.cancelReply(),this.load());}onPage(e){this.pageNumber=e.pageIndex+1,this.pageSize=e.pageSize,this.cancelReply(),this.load();}open(e){this.openComment.emit(e);}startReply(e){this.replyingToMessageId=e.messageId,this.replyText="";}cancelReply(){this.replyingToMessageId=null,this.replyText="",this.liveReloadPending&&this.load();}sendReply(e){let a=this.replyText.trim();!a||this.sendingReply||!e.commentId||(this.sendingReply=true,this.service.replyToTikTokComment({customerId:e.customerId,commentId:e.commentId,replyText:a}).pipe(Xr(()=>this.sendingReply=false)).subscribe({next:n=>{if(!n?.succeeded){this.errorService.setError(n?.errors,this.translate.instant("Failed to Complete the Operation"));return}this.toastr.success("The reply was posted on TikTok"),this.cancelReply(),this.afterChange(e);},error:n=>this.errorService.setError(n,this.translate.instant("Failed to Complete the Operation"))}));}setNoReplyNeeded(e,a){this.markingMessageId===null&&(this.markingMessageId=e.messageId,this.service.setTikTokCommentNoReplyNeeded({messageId:e.messageId,noReplyNeeded:a}).pipe(Xr(()=>this.markingMessageId=null)).subscribe({next:n=>{if(!n?.succeeded){this.errorService.setError(n?.errors,this.translate.instant("Failed to Complete the Operation"));return}this.toastr.success(a?"Marked as no reply needed":"Moved back to Needs a reply"),this.afterChange(e);},error:n=>this.errorService.setError(n,this.translate.instant("Failed to Complete the Operation"))}));}afterChange(e){this.load(),this.countService.refresh().subscribe(),this.commentsChanged.emit(e.tikTokVideoId);}statusLabel(e){switch(e){case I.RepliedByAgent:case I.RepliedInTikTokApp:return "Replied by an agent";case I.RepliedAutomatically:return "Replied automatically";case I.NoReplyNeeded:return "No reply needed";default:return "Not replied yet"}}statusPillClass(e){switch(e){case I.RepliedByAgent:case I.RepliedInTikTokApp:return "sl-pill--success";case I.RepliedAutomatically:return "sl-pill--info";case I.NoReplyNeeded:return "sl-pill--muted";default:return "sl-pill--warning"}}authorLabel(e){return e.authorName||this.translate.instant("TikTok commenter")}get emptyTitle(){return this.filter===B.AwaitingReply?"Nothing is waiting for a reply":"No comments here"}static{this.\u0275fac=function(a){return new(a||t)(V(C),V(y),V(Ct),V(ut),V(O),V(Gt))};}static{this.\u0275cmp=Xb({type:t,selectors:[["app-tiktok-needs-reply-list"]],inputs:{selectedMessageId:"selectedMessageId"},outputs:{openComment:"openComment",commentsChanged:"commentsChanged"},decls:10,vars:6,consts:[[1,"tt-queue"],["type","warning","linkText","TikTok Account","linkRoute","/apps/settings/manage-tiktok",3,"messages","dismissible"],["hideSingleSelectionIndicator","",1,"tt-queue__filters"],[3,"value","selected","selectable"],["role","status",1,"tt-queue__checking"],["aria-hidden","true",1,"tt-queue__list"],["icon","mark_chat_read","message","Comments from the last 30 days are shown here.","size","small",3,"title"],[3,"selectionChange","value","selected","selectable"],[3,"diameter"],[1,"tt-queue-item"],["type","custom","width","48px","height","72px"],[1,"tt-queue-item__body"],["type","custom","width","45%","height","12px"],["type","text",3,"lines"],[1,"tt-queue__list"],[1,"tt-queue-item",3,"tt-queue-item--selected"],[3,"page","length","pageSize","pageIndex","pageSizeOptions"],["type","button",1,"tt-queue-item__thumb",3,"click"],["loading","lazy",3,"src","alt"],[1,"tt-queue-item__video"],[1,"tt-queue-item__who"],[1,"tt-queue-item__time"],[1,"tt-queue-item__followup"],[1,"tt-queue-item__text"],[1,"tt-queue-item__status"],[1,"sl
1-pill",3,"ngClass"],[1,"tt-queue-item__note"],[1,"tt-queue-item__actions"],["mat-button","","color","primary","type","button",3,"click","disabled"],["mat-button","","type","button",3,"disabled"],["mat-button","","type","button",3,"click"],[1,"tt-queue-reply"],["mat-button","","type","button",3,"click","disabled"],["appearance","outline",1,"tt-queue-reply__field"],["matInput","","rows","3",3,"ngModelChange","ngModel","maxlength"],["align","end"],[1,"tt-queue-reply__actions"],["mat-flat-button","","color","primary","type","button",3,"click","disabled"]],template:function(a,n){a&1&&(Js(0,"div",0),ZT(1,Zi,1,3,"app-alert-message",1),Js(2,"mat-chip-listbox",2),pS(3,"translate"),XT(4,en,3,6,"mat-chip-option",3,Ki),gd(),ZT(6,tn,4,4,"p",4),ZT(7,on,3,1,"div",5)(8,an,1,1,"app-empty-state",6)(9,vn,4,5),gd()),a&2&&(SC(),YT(n.notConnected?1:-1),SC(),ly("aria-label",gS(3,4,"Needs a reply")),SC(2),JT(n.filters),SC(2),YT(n.checkingTikTok?6:-1),SC(),YT(n.loading&&!n.hasLoadedOnce?7:n.items.length===0?8:9));},dependencies:[Xv,RM,Ng,Ts,Og,Ic,Gc,Tt,R,S,l$1,W$1,zg,w0,H0,Zx,dn$1,da,xr,wr,zw,Nw,sk,nd,rC,wC,mv,GC,tD,vD,al,tM,dM,Lb,r1,P1,xS,Vs,zs,GS,iI,RI,Mf,kf,us,ms,UI,tE,Dn$1,ME,ny,go,Kd,XE,Zf,LT,mA,WM,mt],styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block}.tt-queue[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--space-3)}.tt-queue__filters[_ngcontent-%COMP%]{margin-bottom:2px}.tt-queue__checking[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--space-2);margin:0;font-size:var(--font-size-xs);color:var(--color-text-muted)}.tt-queue__list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--space-2)}.tt-queue-item[_ngcontent-%COMP%]{display:flex;gap:var(--space-3);padding:10px;border:1px solid var(--color-border);border-radius:var(--radius-lg)}.tt-queue-item--selected[_ngcontent-%COMP%]{border-color:var(--color-primary);background:var(--color-light-primary)}.tt-queue-item__thumb[_ngcontent-%COMP%]{flex:0 0 48px;width:48px;height:72px;padding:0;border:0;border-radius:var(--radius-md);overflow:hidden;cursor:pointer;background:var(--color-surface-2);color:var(--color-text-muted);font-family:inherit;display:flex;align-items:center;justify-content:center}.tt-queue-item__thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover}.tt-queue-item__thumb[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.tt-queue-item__thumb[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.tt-queue-item__body[_ngcontent-%COMP%]{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}.tt-queue-item__video[_ngcontent-%COMP%]{margin:0;font-size:var(--font-size-xs);color:var(--color-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tt-queue-item__who[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:var(--space-2);flex-wrap:wrap;font-size:var(--font-size-sm)}.tt-queue-item__time[_ngcontent-%COMP%]{font-size:var(--font-size-xs);color:var(--color-text-muted)}.tt-queue-item__followup[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;font-size:var(--font-size-xs);color:var(--color-primary-dark, var(--color-text))}.tt-queue-item__followup[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px}.tt-queue-item__text[_ngcontent-%COMP%]{margin:0;font-size:var(--font-size-sm);line-height:1.55;white-space:pre-wrap;word-break:break-word;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.tt-queue-item__status[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--space-2);flex-wrap:wrap}.tt-queue-item__note[_ngcontent-%COMP%]{font-size:var(--font-size-xs);color:var(--color-text-muted)}.tt-queue-item__actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:2px;margin-inline-start:-8px}.tt-queue-reply[_ngcontent-%COMP%]{margin-top:var(--space-2)}.tt-queue-reply__field[_ngcontent-%COMP%]{width:100%}.tt-queue-reply__actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:var(--space-2)}'],changeDetection:1});}}return t})();var hn=()=>["Open Needs a reply to see every comment still waiting on an answer, across all your videos.","Pick a video from the list. The red badge counts comments still waiting on a reply.","Read the thread and press Reply to answer publicly, under the comment.","Use Reply settings to let welcome, keyword and AI replies answer comments for you."],xn=()=>[12,24,48],zi=t=>({$implicit:t});function Cn(t,p){if(t&1){let e=i_();Js(0,"button",15),Ey("click",function(){Vp(e);let n=d_(2);return Hp(n.showView("needs-reply"))}),Js(1,"mat-icon"),H_(2,"mark_chat_unread"),gd(),H_(3),pS(4,"translate"),gd();}if(t&2){let e=d_(2);
1SC(3),By(" ",e.pendingCount," ",gS(4,2,"awaiting a reply")," ");}}function yn(t,p){if(t&1){let e=i_();Js(0,"div",11),ey(1,Cn,5,4,"button",12),Js(2,"button",13),Ey("click",function(){Vp(e);let n=d_();return Hp(n.refresh())}),Js(3,"mat-icon"),H_(4,"refresh"),gd(),H_(5),pS(6,"translate"),gd(),Js(7,"button",14),Ey("click",function(){Vp(e);let n=d_();return Hp(n.openSettings())}),Js(8,"mat-icon"),H_(9,"settings"),gd(),H_(10),pS(11,"translate"),gd()();}if(t&2){let e=d_();SC(),dy("ngIf",e.pendingCount>0),SC(),dy("disabled",e.view==="videos"&&e.loadingVideos),SC(3),Ed(" ",gS(6,5,"Refresh")," "),SC(2),dy("disabled",!e.settings),SC(3),Ed(" ",gS(11,7,"Reply settings")," ");}}function Mn(t,p){if(t&1&&(Js(0,"span",20),H_(1),gd()),t&2){let e=d_(2);SC(),Ed(" ",e.pendingCount>99?"99+":e.pendingCount," ");}}function kn(t,p){if(t&1){let e=i_();Js(0,"mat-button-toggle-group",16),pS(1,"translate"),Ey("change",function(n){Vp(e);let c=d_();return Hp(c.showView(n.value))}),Js(2,"mat-button-toggle",17)(3,"mat-icon"),H_(4,"video_library"),gd(),H_(5),pS(6,"translate"),gd(),Js(7,"mat-button-toggle",18)(8,"mat-icon"),H_(9,"mark_chat_unread"),gd(),H_(10),pS(11,"translate"),ey(12,Mn,2,1,"span",19),gd()();}if(t&2){let e=d_();dy("value",e.view),ly("aria-label",gS(1,5,"TikTok comments")),SC(5),Ed(" ",gS(6,7,"Videos")," "),SC(5),Ed(" ",gS(11,9,"Needs a reply")," "),SC(2),dy("ngIf",e.pendingCount>0);}}function bn(t,p){t&1&&fy(0,"mat-progress-bar",21);}function Tn(t,p){t&1&&(Js(0,"div",22)(1,"mat-icon"),H_(2,"workspace_premium"),gd(),Js(3,"h3"),H_(4),pS(5,"translate"),gd(),Js(6,"p"),H_(7),pS(8,"translate"),gd()()),t&2&&(SC(4),jy(gS(5,2,"Available on the points plans")),SC(3),jy(gS(8,4,"TikTok comments are part of the points plans. Upgrade your plan to read and answer them.")));}function In(t,p){t&1&&(Js(0,"div",22)(1,"mat-icon"),H_(2,"video_library"),gd(),Js(3,"h3"),H_(4),pS(5,"translate"),gd(),Js(6,"p"),H_(7),pS(8,"translate"),gd()()),t&2&&(SC(4),jy(gS(5,2,"No videos yet")),SC(3),jy(gS(8,4,"Once your TikTok account has published a video, it will appear here with its comments.")));}function Sn(t,p){if(t&1){let e=i_();Js(0,"app-tiktok-needs-reply-list",29),Ey("openComment",function(n){Vp(e);let c=d_(2);return Hp(c.openFromQueue(n))})("commentsChanged",function(n){Vp(e);let c=d_(2);return Hp(c.onQueueChanged(n))}),gd();}if(t&2){let e=d_(2);dy("selectedMessageId",e.selectedQueueMessageId);}}function wn(t,p){if(t&1&&fy(0,"img",44),t&2){let e=d_().$implicit;dy("alt",Y_(e.caption||""))("src",e.thumbnailUrl,zg$1);}}function Pn(t,p){t&1&&(Js(0,"div",45)(1,"mat-icon"),H_(2,"music_video"),gd()());}function Vn(t,p){if(t&1&&(Js(0,"span",46),H_(1),gd()),t&2){let e=d_().$implicit;SC(),Ed(" ",e.unansweredCommentCount," ");}}function On(t,p){if(t&1&&(Js(0,"span"),H_(1),pS(2,"date"),gd()),t&2){let e=d_().$implicit;SC(),jy(mS(2,1,e.publishedOn,"yyyy/MM/dd"));}}function Rn(t,p){t&1&&(Js(0,"span",47)(1,"mat-icon"),H_(2,"visibility_off"),gd(),H_(3),pS(4,"translate"),gd()),t&2&&(SC(3),Ed("",gS(4,1,"Unavailable on TikTok")," "));}function En(t,p){if(t&1){let e=i_();Js(0,"div",33),Ey("click",function(){let n=Vp(e).$implicit,c=d_(3);return Hp(c.selectVideo(n))})("keydown.enter",function(){let n=Vp(e).$implicit,c=d_(3);return Hp(c.selectVideo(n))})("keydown.space",function(n){let c=Vp(e).$implicit,y=d_(3);return n.preventDefault(),Hp(y.selectVideo(c))}),Js(1,"div",34),ey(2,wn,1,3,"img",35)(3,Pn,3,0,"div",36)(4,Vn,2,1,"span",37),gd(),Js(5,"div",38)(6,"p",39),H_(7),pS(8,"translate"),gd(),Js(9,"div",40),ey(10,On,3,4,"span",28)(11,Rn,5,3,"span",41),gd(),Js(12,"div",42)(13,"span")(14,"mat-icon"),H_(15,"visibility"),gd(),H_(16),gd(),Js(17,"span")(18,"mat-icon"),H_(19,"favorite"),gd(),H_(20),gd(),Js(21,"span")(22,"mat-icon"),H_(23,"share"),gd(),H_(24),gd(),Js(25,"span",43),pS(26,"translate"),Js(27,"mat-icon"),H_(28,"chat_bubble"),gd(),H_(29),gd()()()();}if(t&2){let e=p.$implicit,a=d_(3);xy("tt-video--selected",a.selectedVideo?.id===e.id),ly("aria-pressed",a.selectedVideo?.id===e.id),SC(2),dy("ngIf",e.thumbnailUrl),SC(),dy("ngIf",!e.thumbnailUrl),SC(),dy("ngIf",e.unansweredCommentCount>0),SC(3),jy(e.caption||gS(8,14,"Untitled video")),SC(3),dy("ngIf",e.publishedOn),SC(),dy("ngIf",e.isUnavailable),SC(5),jy(e.views??0),SC(4),jy(e.likes??0),SC(4),jy(e.shares??0),SC(),dy("matTooltip",gS(26,16,"Comments and replies, as reported by TikTok")),SC(4),Ed("",e.tikTokCommentCount??0," ");}}function Bn(t,p){if(t&1){let e=i_();Js(0,"div",30),ey(1,En,30,18,"div",31),Js(2,"mat-paginator",32),Ey("page",function(n){Vp(e);let c=d_(2);return Hp(c.onPage(n))}),gd()();}if(t&2){let e=d_(2);SC(),dy("ngForOf",e.videos)("ngForTrackBy",e.trackVideo),SC(),dy("length",e.totalVideos)("pageSize",e.pageSize)("pageIndex",e.pageNumber-1)("pageSizeOptions",nS(6,xn));}}
1function Nn(t,p){t&1&&(Js(0,"p"),H_(1),pS(2,"translate"),gd()),t&2&&(SC(),jy(gS(2,1,"Pick a video to see its comments")));}function Ln(t,p){t&1&&(Js(0,"p"),H_(1),pS(2,"translate"),gd()),t&2&&(SC(),jy(gS(2,1,"Pick a comment to see it in its video")));}function Fn(t,p){if(t&1&&(Js(0,"div",48)(1,"mat-icon"),H_(2,"touch_app"),gd(),ey(3,Nn,3,3,"p",28)(4,Ln,3,3,"p",28),gd()),t&2){let e=d_(2);SC(3),dy("ngIf",e.view==="videos"),SC(),dy("ngIf",e.view==="needs-reply");}}function zn(t,p){if(t&1&&(Js(0,"a",53),pS(1,"translate"),pS(2,"translate"),Js(3,"mat-icon"),H_(4,"open_in_new"),gd()()),t&2){let e=d_(3);dy("href",e.selectedVideo.shareUrl,zg$1)("matTooltip",gS(1,3,"Open on TikTok")),ly("aria-label",gS(2,5,"Open on TikTok"));}}function An(t,p){t&1&&fy(0,"mat-progress-bar",21);}function Dn(t,p){t&1&&(Js(0,"div",54)(1,"p"),H_(2),pS(3,"translate"),gd(),Js(4,"p",55),H_(5),pS(6,"translate"),gd()()),t&2&&(SC(2),jy(gS(3,2,"No comments have arrived for this video yet.")),SC(3),Ed(" ",gS(6,4,"Comments made before this account was connected are not shown here.")," "));}function qn(t,p){if(t&1&&fy(0,"img",72),t&2){let e=d_().$implicit,a=d_(4);dy("alt",Y_(a.authorLabel(e)))("src",e.authorAvatarUrl,zg$1);}}function Un(t,p){t&1&&(Js(0,"div",73)(1,"mat-icon"),H_(2,"person"),gd()());}function jn(t,p){if(t&1&&(Js(0,"span",74),H_(1),gd()),t&2){let e=d_().$implicit;SC(),Ed("@",e.authorUsername);}}function $n(t,p){if(t&1){let e=i_();Js(0,"button",75),Ey("click",function(){Vp(e);let n=d_().$implicit,c=d_(4);return Hp(c.startReply(n))}),Js(1,"mat-icon"),H_(2,"reply"),gd(),H_(3),pS(4,"translate"),gd();}t&2&&(SC(3),Ed("",gS(4,1,"Reply")," "));}function Hn(t,p){t&1&&(Js(0,"span",76),H_(1),pS(2,"translate"),gd()),t&2&&(SC(),Ed(" ",gS(2,1,"This video is no longer available on TikTok, so it cannot be replied to.")," "));}function Yn(t,p){t&1&&gy(0);}function Wn(t,p){if(t&1&&fy(0,"img",72),t&2){let e=d_().$implicit,a=d_(6);dy("alt",Y_(a.authorLabel(e)))("src",e.authorAvatarUrl,zg$1);}}function Qn(t,p){t&1&&(Js(0,"div",73)(1,"mat-icon"),H_(2,"person"),gd()());}function Xn(t,p){t&1&&(Js(0,"span",83)(1,"mat-icon"),H_(2,"smart_toy"),gd(),H_(3),pS(4,"translate"),gd()),t&2&&(SC(3),Ed("",gS(4,1,"Automatic")," "));}function Gn(t,p){t&1&&(Js(0,"span",84),H_(1),pS(2,"translate"),gd()),t&2&&(SC(),Ed(" ",gS(2,1,"Sent by an agent")," "));}function Kn(t,p){if(t&1){let e=i_();Js(0,"div",67)(1,"button",75),Ey("click",function(){Vp(e);let n=d_().$implicit,c=d_(6);return Hp(c.startReply(n))}),Js(2,"mat-icon"),H_(3,"reply"),gd(),H_(4),pS(5,"translate"),gd()();}t&2&&(SC(4),Ed("",gS(5,1,"Reply")," "));}function Jn(t,p){t&1&&gy(0);}function Zn(t,p){if(t&1&&(Js(0,"div",79),ey(1,Wn,1,3,"img",60)(2,Qn,3,0,"div",61),Js(3,"div",62)(4,"div",63)(5,"strong"),H_(6),gd(),ey(7,Xn,5,3,"span",80)(8,Gn,3,3,"span",81),Js(9,"span",65),H_(10),pS(11,"date"),gd()(),Js(12,"p",66),H_(13),gd(),ey(14,Kn,6,3,"div",82)(15,Jn,1,0,"ng-container",70),gd()()),t&2){let e=p.$implicit,a=d_(6),n=D_(17);xy("tt-comment__main--highlight",!!a.highlightCommentId&&e.commentId===a.highlightCommentId),ly("id",a.commentAnchor(e.commentId)),SC(),dy("ngIf",e.authorAvatarUrl),SC(),dy("ngIf",!e.authorAvatarUrl),SC(4),jy(a.authorLabel(e)),SC(),dy("ngIf",e.isAutomatic),SC(),dy("ngIf",e.isOurs&&!e.isAutomatic),SC(2),jy(mS(11,13,e.timestamp,"yyyy/MM/dd HH:mm")),SC(3),jy(e.text),SC(),dy("ngIf",!e.isOurs&&!a.selectedVideo.isUnavailable),SC(),dy("ngTemplateOutlet",n)("ngTemplateOutletContext",rS(16,zi,e));}}function eo(t,p){if(t&1&&(Js(0,"div",77),ey(1,Zn,16,18,"div",78),gd()),t&2){let e=d_().$implicit,a=d_(4);SC(),dy("ngForOf",e.replies)("ngForTrackBy",a.trackComment);}}function to(t,p){if(t&1&&(Js(0,"div",58)(1,"div",59),ey(2,qn,1,3,"img",60)(3,Un,3,0,"div",61),Js(4,"div",62)(5,"div",63)(6,"strong"),H_(7),gd(),ey(8,jn,2,1,"span",64),Js(9,"span",65),H_(10),pS(11,"date"),gd()(),Js(12,"p",66),H_(13),gd(),Js(14,"div",67),ey(15,$n,5,3,"button",68)(16,Hn,3,3,"span",69),gd(),ey(17,Yn,1,0,"ng-container",70),gd()(),ey(18,eo,2,2,"div",71),gd()),t&2){let e=p.$implicit,a=d_(4),n=D_(17);SC(),xy("tt-comment__main--ours",e.isOurs)("tt-comment__main--highlight",!!a.highlightCommentId&&e.commentId===a.highlightCommentId),ly("id",a.commentAnchor(e.commentId)),SC(),dy("ngIf",e.authorAvatarUrl),SC(),dy("ngIf",!e.authorAvatarUrl),SC(4),jy(a.authorLabel(e)),SC(),dy("ngIf",e.authorUsername),SC(2),jy(mS(11,16,e.timestamp,"yyyy/MM/dd HH:mm")),SC(3),jy(e.text),SC(2),dy("ngIf",!e.isOurs&&!a.selectedVideo.isUnavailable),SC(),dy("ngIf",a.selectedVideo.isUnavailable),SC(),dy("ngTemplateOutlet",n)("ngTemplateOutletContext",rS(19,zi,e)),SC(),dy("ngIf",e.replies?.length);}}function io(t,p){if(t&1&&(Js(0,"div",56),ey(1,to,19,21,"div",57),gd()),t&2){let e=d_(3);SC(),dy("ngForOf",e.comments)("ngForTrackBy",e.trackComment);}}function no(t,p){if(t&1&&(vd(0),Js(1,"div",49)(2,"h3"),H_(3),pS(4,"translate"),gd(),ey(5,zn,5,7,"a",50),gd(),ey(6,An,1,0,"mat-progress-bar",8)(7,Dn,7,6,"div",51)(8,io,2,2,"div",52),Ea()),t&2){let e=d_(2);SC(3),jy(e.selectedVideo.caption||gS(4,5,"Untitled video")),SC(2),dy("ngIf",e.selectedVideo.shareUrl),SC(),dy("ngIf",e.loadingComments),SC(),dy("ngIf",!e.loadingComments&&e.comments.length===0),SC(),dy("ngIf",!e.loadingComments&&e.comments.length>0);}}function oo(t,p){if(t&1&&(Js(0,"div",23),ey(1,Sn,1,1,"app-tiktok-needs-reply-list",24)(2,Bn,3,7,"div",25),Js(3,"div",26),ey(4,Fn,5,2,"div",27)(5,no,9,7,"ng-container",28),gd()()),t&2){let e=d_();SC(),dy("ngIf",e.view==="needs-reply"),SC(),dy("ngIf",e.view==="videos"),SC(2),dy("ngIf",!e.selectedVideo),SC(),dy("ngIf",e.selectedVideo);}}function ao(t,p){if(t&1){let e=i_();Js(0,"div",86)(1,"mat-form-field",87)(2,"mat-label"),H_(3),pS(4,"translate"),gd(),Js(5,"textarea",88),zy("ngModelChange",function(n){Vp(e);let c=d_(2);return W_(c.replyText,n)||(c.replyText=n),Hp(n)}),gd(),db(),Js(6,"mat-hint",89),H_(7),gd()(),Js(8,"div",90)(9,"button",91),Ey("click",function(){Vp(e);let n=d_(2);return Hp(n.onCancelReply())}),H_(10),pS(11,"translate"),gd(),Js(12,"button",14),Ey("click",function(){Vp(e);let n=d_().$implicit,c=d_();return Hp(c.sendReply(n))}),H_(13),pS(14,"translate"),gd()()();}if(t&2){let e=d_(2);SC(3),jy(gS(4,8,"Your public reply")),SC(2),$y("ngModel",e.replyText),dy("maxlength",e.REPLY_MAX),pb(),SC(2),By("",e.replyText.length," / ",e.REPLY_MAX),SC(3),jy(gS(11,10,"Cancel")),SC(2),dy("disabled",e.sendingReply||!e.replyText.trim()),SC(),Ed(" ",gS(14,12,"Post reply")," ");}}function ro(t,p){if(t&1&&ey(0,ao,15,14,"div",85),t&2){let e=p.$implicit,a=d_();dy("ngIf",a.replyingToCommentId===e.commentId);}}var Zo=(()=>{class t{constructor(e,a,n,c,y,De,Ai,Di,qi,Ui,ji){this.service=e,this.countService=a,this.toastr=n,this.translate=c,this.dialog=y,this.dialogConfig=De,this.errorService=Ai,this.appInitService=Di,this.route=qi,this.router=Ui,this.signalR=ji,this.REPLY_MAX=1200,this.view="videos",this.videos=[],this.totalVideos=0,this.pageNumber=1,this.pageSize=12,this.loadingVideos=false,this.hasLoadedOnce=false,this.selectedVideo=null,this.comments=[],this.loadingComments=false,this.replyingToCommentId=null,this.replyText="",this.sendingReply=false,this.highlightCommentId=null,this.selectedQueueMessageId=null,this.pendingCount=0,this.settings=null,this.isPointsBased=false,this.modeResolved=false,this.countSub=W.EMPTY,this.commentsSub=W.EMPTY,this.liveSub=W.EMPTY,this.liveReloadPending=false,this.trackVideo=($i,Je)=>Je.id,this.trackComment=($i,Je)=>Je.messageId;}
1ngOnInit(){this.liveSub=this.signalR.tikTokCommentReceived$.pipe(ve(e=>e.object?.tikTokVideoId),Yt(e=>e!=null&&e===this.selectedVideo?.id),qD(3e3)).subscribe(e=>{if(!(!this.selectedVideo||e!==this.selectedVideo.id||this.loadingComments)){if(this.replyingToCommentId!==null){this.liveReloadPending=true;return}this.loadComments(this.selectedVideo.id,true);}}),this.view=this.route.snapshot.queryParamMap.get("tab")===T?"needs-reply":"videos",this.appInitService.appInitData$.pipe(Yt(e=>!!e?.clientStatus),bn$1(1)).subscribe(e=>{this.isPointsBased=e.clientStatus.billingMode===s.PointsBased,this.modeResolved=true,this.isPointsBased&&(this.view==="videos"&&this.loadVideos(),this.loadSettings(),this.countService.loadOnce(),this.countSub=this.countService.count$.subscribe(a=>this.pendingCount=a),this.countService.refresh().subscribe());});}ngOnDestroy(){this.countSub.unsubscribe(),this.commentsSub.unsubscribe(),this.liveSub.unsubscribe();}showView(e){e!==this.view&&(this.view=e,this.commentsSub.unsubscribe(),this.loadingComments=false,this.selectedVideo=null,this.comments=[],this.highlightCommentId=null,this.selectedQueueMessageId=null,this.cancelReply(),this.router.navigate([],{relativeTo:this.route,queryParams:{tab:e==="needs-reply"?T:null},queryParamsHandling:"merge",replaceUrl:true}),e==="videos"&&this.loadVideos());}refresh(){this.view==="videos"?this.loadVideos():this.queueList?.refresh();}loadVideos(e=false){e||(this.loadingVideos=true),this.service.getTikTokVideos(this.pageNumber,this.pageSize).subscribe({next:a=>{if(this.loadingVideos=false,this.hasLoadedOnce=true,!a?.succeeded){e||this.errorService.setError(a?.errors,this.translate.instant("Failed to Complete the Operation"));return}if(this.videos=a.data??[],this.totalVideos=a.count??this.videos.length,this.selectedVideo){let n=this.videos.find(c=>c.id===this.selectedVideo.id);n&&(this.selectedVideo=n);}},error:a=>{this.loadingVideos=false,this.hasLoadedOnce=true,e||this.errorService.setError(a,this.translate.instant("Failed to Complete the Operation"));}});}onPage(e){this.pageNumber=e.pageIndex+1,this.pageSize=e.pageSize,this.loadVideos();}selectVideo(e){this.selectedVideo=e,this.highlightCommentId=null,this.cancelReply(),this.loadComments(e.id);}openFromQueue(e){this.selectedQueueMessageId=e.messageId,this.highlightCommentId=e.commentId,this.selectedVideo={id:e.tikTokVideoId,videoId:e.videoId,caption:e.videoCaption,thumbnailUrl:e.videoThumbnailUrl,shareUrl:e.videoShareUrl,embedUrl:null,publishedOn:null,videoDuration:null,likes:null,shares:null,views:null,tikTokCommentCount:null,storedCommentCount:0,unansweredCommentCount:0,isUnavailable:false},this.cancelReply(),this.loadComments(e.tikTokVideoId);}onQueueChanged(e){this.selectedVideo?.id===e&&this.loadComments(e);}loadComments(e,a=false){this.commentsSub.unsubscribe(),this.liveReloadPending=false,a||(this.loadingComments=true,this.comments=[]),this.commentsSub=this.service.getTikTokVideoComments(e).subscribe({next:n=>{if(this.loadingComments=false,!n?.succeeded){a||this.errorService.setError(n?.errors,this.translate.instant("Failed to Complete the Operation"));return}this.comments=n.data??[];let c=this.countReceived(this.comments);this.view==="videos"&&this.selectedVideo&&c!==this.selectedVideo.storedCommentCount&&this.loadVideos(a),this.highlightCommentId&&!a&&this.scrollToComment(this.highlightCommentId);},error:n=>{this.loadingComments=false,a||this.errorService.setError(n,this.translate.instant("Failed to Complete the Operation"));}});}startReply(e){this.replyingToCommentId=e.commentId,this.replyText="";}cancelReply(){this.replyingToCommentId=null,this.replyText="";}onCancelReply(){this.cancelReply(),this.liveReloadPending&&this.selectedVideo&&this.loadComments(this.selectedVideo.id,true);}sendReply(e){let a=this.replyText.trim();!a||this.sendingReply||!e.commentId||(this.sendingReply=true,this.service.replyToTikTokComment({customerId:e.customerId,commentId:e.commentId,replyText:a}).subscribe({next:n=>{if(this.sendingReply=false,!n?.succeeded){this.errorService.setError(n?.errors,this.translate.instant("Failed to Complete the Operation"));return}this.toastr.success("The reply was posted on TikTok"),this.cancelReply(),this.selectedVideo&&this.loadComments(this.selectedVideo.id),this.countService.refresh().subscribe(),this.view==="videos"?this.loadVideos():this.queueList?.load();},error:n=>{this.sendingReply=false,this.errorService.setError(n,this.translate.instant("Failed to Complete the Operation"));}}));}loadSettings(){this.service.getTikTokCommentSettings().subscribe({next:e=>{e?.succeeded&&(this.settings=e.data);},error:()=>{}});}openSettings(){if(!this.settings)return;let e=this.dialogConfig.getDefaultDialogConfig();this.dialog.open(Fi,E(D({},e),{width:"520px",data:D({},this.settings)})).afterClosed().subscribe(n=>{n&&(this.settings=n);});}get isEmpty(){return this.view==="videos"&&this.isPointsBased&&this.hasLoadedOnce&&!this.loadingVideos&&this.videos.length===0}authorLabel(e){return e.authorName?e.authorName:e.authorUsername?"@"+e.authorUsername:this.translate.instant(e.isOurs?"Your TikTok account":"TikTok commenter")}commentAnchor(e){return e?"tt-c-"+e:null}countReceived(e){return e.reduce((a,n)=>a+(n.isOurs?0:1)+this.countReceived(n.replies??[]),0)}scrollToComment(e){setTimeout(()=>{let a=this.commentAnchor(e);a&&document.getElementById(a)?.scrollIntoView({behavior:"smooth",block:"center"});});}static{this.\u0275fac=function(a){return new(a||t)(V(C),V(y),V(ut),V(O),V(vr),V(f),V(Gt),V(d),V(V$1),V(G),V(Ct))};}static{this.\u0275cmp=Xb({type:t,selectors:[["app-tiktok-videos"]],viewQuery:function(a,n){if(a&1&&by(rt,5),a&2){let c;m_(c=y_())&&(n.queueList=c.first);}},decls:18,vars:14,consts:[["composer",""],["helpKey","tiktok-comments","intro","Public comments left on your TikTok videos, shown under the video they belong to rather than
1in the conversations inbox \u2014 so you can see what a question is about before answering it.","note","Comments can take up to five minutes to arrive \u2014 TikTok delivers them more slowly than messages. The count on each card is TikTok's own figure, which also counts replies and comments made before this account was connected.","warning","TikTok has no way to answer a commenter privately, so every reply here is public. The reply limits protect your allowance and stop TikTok treating repeated replies as spam.",3,"steps"],[1,"tt-videos"],[1,"tt-videos__header"],[1,"tt-videos__title"],[1,"tt-videos__subtitle"],["class","tt-videos__actions",4,"ngIf"],["class","tt-videos__views","hideSingleSelectionIndicator","",3,"value","change",4,"ngIf"],["mode","indeterminate",4,"ngIf"],["class","tt-videos__empty",4,"ngIf"],["class","tt-videos__body",4,"ngIf"],[1,"tt-videos__actions"],["type","button","class","tt-videos__todo",3,"click",4,"ngIf"],["mat-stroked-button","",3,"click","disabled"],["mat-flat-button","","color","primary",3,"click","disabled"],["type","button",1,"tt-videos__todo",3,"click"],["hideSingleSelectionIndicator","",1,"tt-videos__views",3,"change","value"],["value","videos"],["value","needs-reply"],["class","sl-pill sl-pill--error sl-pill--plain tt-videos__views-count",4,"ngIf"],[1,"sl-pill","sl-pill--error","sl-pill--plain","tt-videos__views-count"],["mode","indeterminate"],[1,"tt-videos__empty"],[1,"tt-videos__body"],[3,"selectedMessageId","openComment","commentsChanged",4,"ngIf"],["class","tt-videos__list",4,"ngIf"],[1,"tt-videos__detail"],["class","tt-detail__placeholder",4,"ngIf"],[4,"ngIf"],[3,"openComment","commentsChanged","selectedMessageId"],[1,"tt-videos__list"],["class","tt-video","role","button","tabindex","0",3,"tt-video--selected","click","keydown.enter","keydown.space",4,"ngFor","ngForOf","ngForTrackBy"],[3,"page","length","pageSize","pageIndex","pageSizeOptions"],["role","button","tabindex","0",1,"tt-video",3,"click","keydown.enter","keydown.space"],[1,"tt-video__thumb"],["loading","lazy",3,"src","alt",4,"ngIf"],["class","tt-video__thumb-fallback",4,"ngIf"],["class","tt-video__badge",4,"ngIf"],[1,"tt-video__info"],[1,"tt-video__caption"],[1,"tt-video__meta"],["class","tt-video__unavailable",4,"ngIf"],[1,"tt-video__stats"],[3,"matTooltip"],["loading","lazy",3,"src","alt"],[1,"tt-video__thumb-fallback"],[1,"tt-video__badge"],[1,"tt-video__unavailable"],[1,"tt-detail__placeholder"],[1,"tt-detail__header"],["target","_blank","rel","noopener","mat-icon-button","",3,"href","matTooltip",4,"ngIf"],["class","tt-detail__empty",4,"ngIf"],["class","tt-comments",4,"ngIf"],["target","_blank","rel","noopener","mat-icon-button","",3,"href","matTooltip"],[1,"tt-detail__empty"],[1,"tt-detail__note"],[1,"tt-comments"],["class","tt-comment",4,"ngFor","ngForOf","ngForTrackBy"],[1,"tt-comment"],[1,"tt-comment__main"],["class","tt-comment__avatar","loading","lazy",3,"src","alt",4,"ngIf"],["class","tt-comment__avatar tt-comment__avatar--blank",4,"ngIf"],[1,"tt-comment__body"],[1,"tt-comment__who"],["class","tt-comment__handle",4,"ngIf"],[1,"tt-comment__time"],[1,"tt-comment__text"],[1,"tt-comment__tools"],["mat-button","","color","primary",3,"click",4,"ngIf"],["class","tt-comment__blocked",4,"ngIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["class","tt-comment__replies",4,"ngIf"],["loading","lazy",1,"tt-comment__avatar",3,"src","alt"],[1,"tt-comment__avatar","tt-comment__avatar--blank"],[1,"tt-comment__handle"],["mat-button","","color","primary",3,"click"],[1,"tt-comment__blocked"],[1,"tt-comment__replies"],["class","tt-comment__main tt-comment__main--reply",3,"tt-comment__main--highlight",4,"ngFor","ngForOf","ngForTrackBy"],[1,"tt-comment__main","tt-comment__main--reply"],["class","tt-chip tt-chip--auto",4,"ngIf"],["class","tt-chip",4,"ngIf"],["class","tt-comment__tools",4,"ngIf"],[1,"tt-chip","tt-chip--auto"],[1,"tt-chip"],["class","tt-reply",4,"ngIf"],[1,"tt-reply"],["appearance","outline",1,"tt-reply__field"],["matInput","","rows","3",3,"ngModelChange","ngModel","maxlength"],["align","end"],[1,"tt-reply__actions"],["mat-button","",3,"click"]],template:function(a,n){a&1&&(fy(0,"app-page-help",1),Js(1,"div",2)(2,"div",3)(3,"div")(4,"h2",4),H_(5),pS(6,"translate"),gd(),Js(7,"p",5),H_(8),pS(9,"translate"),gd()(),ey(10,yn,12,9,"div",6),gd(),ey(11,kn,13,11,"mat-button-toggle-group",7)(12,bn,1,0,"mat-progress-bar",8)(13,Tn,9,6,"div",9)(14,In,9,6,"div",9)(15,oo,6,4,"div",10),gd(),ey(16,ro,1,1,"ng-template",null,0,DS)),a&2&&(dy("steps",nS(13,hn)),SC(5),jy(gS(6,9,"TikTok comments")),SC(3),Ed(" ",gS(9,11,"Comments people leave on your videos, grouped under the video they belong to.")," "),SC(2),dy("ngIf",n.isPointsBased),SC(),dy("ngIf",n.isPointsBased),SC(),dy("ngIf",n.view==="videos"&&n.loadingVideos),SC(),dy("ngIf",n.modeResolved&&!n.isPointsBased),SC(),dy("ngIf",n.isEmpty),SC(),dy("ngIf",n.isPointsBased&&!n.isEmpty));},dependencies:[Xv,Yv,OM,LM,Ng,Ts,Og,Ic,Gc,Tt,ce,rt,zg,w0,H0,Zx,dn$1,da,xr,wr,zw,Nw,sk,nd,rC,wC,mv,GC,tD,vD,al,tM,dM,Lb,r1,P1,xS,Vs,zs,Fi$1,GS,rf,Od,iI,RI,us,ms,UI,tE,eE,Dn$1,ME,ny,go,Kd,on$1,XE,Zf,LT,mA,WM,mt],styles:['@charset "UTF-8";.tt-videos[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}.tt-videos__header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;flex-wrap:wrap}.tt-videos__title[_ngcontent-%COMP%]{margin:0;font-size:20px;font-weight:600}.tt-videos__subtitle[_ngcontent-%COMP%]{margin:4px 0 0;font-size:13px;opacity:.7}.tt-videos__actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.tt-videos__todo[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;font-size:13px;font-weight:500;background:rgba(var(--mat-sys-primary-rgb, 76 175 80),.12)}.tt-videos__todo[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.tt-videos[_ngcontent-%COMP%] button.tt-videos__todo[_ngcontent-%COMP%]{border:0;color:inherit;font-family:inherit;cursor:pointer}.tt-videos[_ngcontent-%COMP%] button.tt-videos__todo[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.tt-videos__views[_ngcontent-%COMP%]{align-self:flex-start}.tt-videos__views[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;margin-inline-end:4px;vertical-align:middle}.tt-videos__views-count[_ngcontent-%COMP%]{margin-inline-start:6px}.tt-videos__empty[_ngcontent-%COMP%]{text-align:center;padding:56px 16px;opacity:.75}.tt-videos__empty[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:48px;width:48px;height:48px;opacity:.5}.tt-videos__empty[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:12px 0 4px;font-size:17px}.tt-videos__empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:13px}.tt-videos__body[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(300px,380px) 1fr;gap:16px;align-items:start}@media(max-width:1100px){.tt-videos__body[_ngcontent-%COMP%]{grid-template-columns:1fr}}.tt-videos__list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.tt-videos__detail[_ngcontent-%COMP%]{border:1px solid var(--mat-sys-outline-variant, rgba(0, 0, 0, .12));border-radius:12px;padding:16px;min-height:320px}.tt-video[_ngcontent-%COMP%]{display:flex;gap:12px;padding:10px;border:1px solid var(--mat-sys-outline-variant, rgba(0, 0, 0, .12));border-radius:10px;cursor:pointer;transition:background .15s ease,border-color .15s ease}.tt-video[_ngcontent-%COMP%]:hover{background:#00000008}.tt-video[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--mat-sys-primary, #4caf50);outline-offset:2px}.tt-video--selected[_ngcontent-%COMP%]{border-color:var(--mat-sys-primary, #4caf50);background:rgba(var(--mat-sys-primary-rgb, 76 175 80),.08)}.tt-video__thumb[_ngcontent-%COMP%]{position:relative;flex:0 0 64px;width:64px;
1height:96px;border-radius:8px;overflow:hidden;background:#0000000f}.tt-video__thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover}.tt-video__thumb-fallback[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;height:100%;opacity:.45}.tt-video__badge[_ngcontent-%COMP%]{position:absolute;top:4px;inset-inline-end:4px;min-width:20px;height:20px;padding:0 5px;border-radius:999px;background:#e53935;color:#fff;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center}.tt-video__info[_ngcontent-%COMP%]{flex:1;min-width:0}.tt-video__caption[_ngcontent-%COMP%]{margin:0 0 6px;font-size:13px;font-weight:500;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.tt-video__meta[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;font-size:11px;opacity:.65;margin-bottom:6px}.tt-video__unavailable[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:3px;color:#e53935;opacity:.9}.tt-video__unavailable[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:13px;width:13px;height:13px}.tt-video__stats[_ngcontent-%COMP%]{display:flex;gap:12px;font-size:11px;opacity:.8}.tt-video__stats[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:3px}.tt-video__stats[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px}.tt-detail__placeholder[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;min-height:280px;opacity:.5}.tt-detail__placeholder[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:36px;width:36px;height:36px}.tt-detail__placeholder[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:13px}.tt-detail__header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}.tt-detail__header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:15px;font-weight:600}.tt-detail__empty[_ngcontent-%COMP%]{padding:32px 8px;text-align:center;opacity:.7;font-size:13px}.tt-detail__note[_ngcontent-%COMP%]{font-size:12px;opacity:.8;margin-top:6px}.tt-comments[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:18px}.tt-comment__main[_ngcontent-%COMP%]{display:flex;gap:10px}.tt-comment__main--reply[_ngcontent-%COMP%]{margin-inline-start:34px;margin-top:10px}.tt-comment__main--ours[_ngcontent-%COMP%] .tt-comment__text[_ngcontent-%COMP%]{background:rgba(var(--mat-sys-primary-rgb, 76 175 80),.1)}.tt-comment__main--highlight[_ngcontent-%COMP%]{outline:2px solid var(--color-primary);outline-offset:4px;border-radius:var(--radius-lg)}.tt-comment__avatar[_ngcontent-%COMP%]{flex:0 0 32px;width:32px;height:32px;border-radius:50%;object-fit:cover;background:#00000014}.tt-comment__avatar--blank[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;opacity:.5}.tt-comment__avatar--blank[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.tt-comment__body[_ngcontent-%COMP%]{flex:1;min-width:0}.tt-comment__who[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:12px;margin-bottom:3px}.tt-comment__handle[_ngcontent-%COMP%]{opacity:.6}.tt-comment__time[_ngcontent-%COMP%]{opacity:.5;font-size:11px}.tt-comment__text[_ngcontent-%COMP%]{margin:0;padding:8px 10px;border-radius:10px;background:#0000000a;font-size:13px;line-height:1.55;white-space:pre-wrap;word-break:break-word}.tt-comment__tools[_ngcontent-%COMP%]{margin-top:2px}.tt-comment__blocked[_ngcontent-%COMP%]{font-size:12px;opacity:.65}.tt-comment__replies[_ngcontent-%COMP%]{display:flex;flex-direction:column}.tt-chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:3px;padding:1px 8px;border-radius:999px;font-size:11px;background:#00000012}.tt-chip[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:13px;width:13px;height:13px}.tt-chip--auto[_ngcontent-%COMP%]{background:rgba(var(--mat-sys-primary-rgb, 76 175 80),.16)}.tt-reply[_ngcontent-%COMP%]{margin-top:10px}.tt-reply__field[_ngcontent-%COMP%]{width:100%}.tt-reply__actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;
1gap:8px}'],changeDetection:1});}}return t})();export{Zo as TiktokVideosComponent};
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.