@ehfuse/taskbox 0.11.3 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -8,7 +8,7 @@ import{a as Pi,b as wp,c as sm,d as kL,e as TL,f as yL,g as CL,h as SL}from"./ch
8
8
 
9
9
  `).trim()}function xl(e){return yc(e)?Cc(e):e}function _d(e){let t=DE(Bd(e)).trim(),o=Cc(t);return o.trim()?/<(?!\/?(p|br|span)(\s|>|\/))[a-z]/i.test(t)||/<span[^>]*style=/i.test(t)?t:o:""}var wE=new Set(["P","DIV","UL","OL","H1","H2","H3","H4","BLOCKQUOTE","PRE"]);function DE(e){if(typeof DOMParser>"u")return e;let t=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html"),o=t.body.firstElementChild;if(!o)return e;let a=null;for(let r of Array.from(o.childNodes)){if(r.nodeType===Node.ELEMENT_NODE&&wE.has(r.tagName)){a=null;continue}a||(a=t.createElement("p"),o.insertBefore(a,r)),a.appendChild(r)}for(let r of Array.from(o.querySelectorAll(":scope > p")))!r.textContent?.replace(/\u00a0/g," ").trim()&&!r.querySelector("br, img")&&r.remove();return o.innerHTML}function jx(e){let t=a=>a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return e.split(`
10
10
  `).map(a=>`<p>${a?t(a):"<br>"}</p>`).join("")}import{jsx as wd,jsxs as OE}from"react/jsx-runtime";var ME={left:[["heading"],["bold","italic","strike","underline"],["link","bgcolor","code"],["bulletList","numberList"]],right:[]},Dd=EE(function({defaultHtml:t="",placeholder:o,alwaysExpanded:a=!1,autoFocus:r=!1,minHeight:i=44,maxHeight:l=280,onChange:s,onSubmit:c,onFiles:u,footer:m,variant:d="bare"},f){let p=Qx(null),[g,x]=Yx(!1),[b,_]=Yx(()=>!!Cc(t).trim()),h=Kx(),y=a||g||b;RE(f,()=>({getComment:()=>_d(p.current?.getHtml()??""),clear:()=>{p.current?.setHtml(""),_(!1)},focus:()=>p.current?.focus()})),Xx(()=>{if(!r)return;let I=requestAnimationFrame(()=>p.current?.focus());return()=>cancelAnimationFrame(I)},[r]);let k=I=>{let C=Array.from(I??[]);return C.length===0||!u?!1:(u(C),!0)};return OE(Id,{...h.handlers,onKeyDownCapture:I=>{h.handlers.onKeyDownCapture(I),!I.defaultPrevented&&I.key==="Enter"&&(I.ctrlKey||I.metaKey)&&!I.nativeEvent.isComposing&&(I.preventDefault(),I.stopPropagation(),c?.())},onFocusCapture:()=>x(!0),onBlurCapture:I=>{I.currentTarget.contains(I.relatedTarget)||x(!1)},onPasteCapture:I=>{k(I.clipboardData?.files)&&(I.preventDefault(),I.stopPropagation())},onDropCapture:I=>{k(I.dataTransfer?.files)&&(I.preventDefault(),I.stopPropagation())},sx:{position:"relative",bgcolor:"#ffffff",...d==="boxed"?{border:"1px solid",borderColor:g?"primary.main":"#dedddb",boxShadow:g?I=>`0 0 0 1px ${I.palette.primary.main}`:"none",borderRadius:"8px",transition:"border-color 120ms"}:{},"& .ehfuse-editor, & .ehfuse-editor-wrapper, & .ehfuse-editor-container":{border:"none !important",boxShadow:"none !important",borderRadius:0},"& .ehfuse-toolbar":{display:y?void 0:"none !important",background:"transparent",borderBottom:"1px solid #ececea"},"& .ehfuse-editor-content":{maxHeight:l,overflowY:"auto",fontSize:15,lineHeight:1.6},"& .ehfuse-editor-content > p:first-of-type":{mt:0},"& .ehfuse-editor-content > p:last-of-type":{mb:0},"& .ehfuse-editor-content.ehfuse-editor-empty::before":d==="boxed"?{top:"10px",left:"12px"}:{top:"12px",left:"16px"}},children:[wd(PE,{ref:p,defaultValue:t||"<p></p>",autoHeight:!0,showToolbar:!0,toolbarOptions:ME,locale:ua(),minHeight:y?Math.max(i,64):i,placeholder:o,contentStyle:{padding:d==="boxed"?"10px 12px":"12px 16px"},onChange:I=>{let C=_d(I);_(!!C),s?.(C)}}),h.popper,m&&y?wd(Id,{sx:{display:"flex",alignItems:"center",px:1,pb:.75},children:m}):null]})});function Zx({html:e}){let{openExternalUrl:t,mentionCandidates:o}=le(),a=Qx(null),r=Bd(e),i=(o??[]).map(l=>l.name).filter(l=>l.trim().length>=2);return Xx(()=>{let l=a.current;if(!l)return;l.innerHTML=r;let s=[...new Set(i)].sort((f,p)=>p.length-f.length);if(s.length===0||!r.includes("@"))return;let c=f=>f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=new RegExp(`(^|[^A-Za-z0-9._%+-])(@(?:${s.map(c).join("|")}))`,"g"),m=document.createTreeWalker(l,NodeFilter.SHOW_TEXT),d=[];for(;m.nextNode();){let f=m.currentNode;f.data.includes("@")&&!f.parentElement?.closest("a, code")&&d.push(f)}for(let f of d){let p=f.data,g=document.createDocumentFragment(),x=0;for(let b of p.matchAll(u)){let _=(b.index??0)+b[1].length;_>x&&g.append(p.slice(x,_));let h=document.createElement("span");h.className="taskbox-mention",h.textContent=b[2],g.append(h),x=_+b[2].length}x!==0&&(x<p.length&&g.append(p.slice(x)),f.replaceWith(g))}},[r,i.join("|")]),wd(Id,{ref:a,onClickCapture:l=>{let s=l.target?.closest?.("a[href]");s&&(l.preventDefault(),l.stopPropagation(),t?t(s.href):window.open(s.href,"_blank","noopener,noreferrer"))},sx:{fontSize:15,lineHeight:1.6,wordBreak:"break-word","& p":{m:0},"& ul, & ol":{pl:"1.5em",my:.25},"& li > p":{m:0},"& h1, & h2, & h3, & h4":{fontSize:"1.05em",fontWeight:700,m:0},"& blockquote":{m:0,pl:1.5,borderLeft:"3px solid #dedddb",color:"text.secondary"},"& code":{fontFamily:"monospace",fontSize:"0.9em",bgcolor:"#f1f5f9",px:.5,borderRadius:.5},"& pre":{m:0,p:1,bgcolor:"#f1f5f9",borderRadius:1,overflowX:"auto"},"& a[href]":{color:"#2563eb",textDecoration:"none",cursor:"pointer","&:hover":{textDecoration:"underline"}},"& .taskbox-mention":{color:"#2563eb",fontWeight:600}}})}import{ConfirmActionPopper as KE}from"@ehfuse/mui-confirm-action";import{Box as eb}from"@mui/material";import{Fragment as zE,jsx as Ed}from"react/jsx-runtime";var LE=/https?:\/\/[^\s<>"']+/g;function AE(e){let t=e,o="";for(;;){let a=t.slice(-1);if(a===")"&&(t.match(/\(/g)??[]).length<(t.match(/\)/g)??[]).length){t=t.slice(0,-1),o=a+o;continue}if(".,;:!?]}".includes(a)&&a!==""){t=t.slice(0,-1),o=a+o;continue}break}return[t,o]}var qE=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Jx(e,t,o="m"){let a=[...new Set(t.filter(s=>s.trim().length>=2))].sort((s,c)=>c.length-s.length);if(a.length===0||!e.includes("@"))return[e];let r=new RegExp(`(^|[^A-Za-z0-9._%+-])(@(?:${a.map(qE).join("|")}))`,"g"),i=[],l=0;for(let s of e.matchAll(r)){let c=(s.index??0)+s[1].length;c>l&&i.push(e.slice(l,c)),i.push(Ed(eb,{component:"span",sx:{color:"#2563eb",fontWeight:600},children:s[2]},`${o}-${c}`)),l=c+s[2].length}return l<e.length&&i.push(e.slice(l)),i}function tb({text:e}){let{openExternalUrl:t,mentionCandidates:o}=le(),a=(o??[]).map(s=>s.name),r=s=>{t?t(s):window.open(s,"_blank","noopener,noreferrer")},i=[],l=0;for(let s of e.matchAll(LE)){let c=s.index??0,[u,m]=AE(s[0]);c>l&&i.push(...Jx(e.slice(l,c),a,`m${l}`)),i.push(Ed(eb,{component:"a",href:u,onClick:d=>{d.preventDefault(),d.stopPropagation(),r(u)},sx:{color:"#2563eb",textDecoration:"underline",wordBreak:"break-all",cursor:"pointer"},children:u},`${c}-${u}`)),m&&i.push(m),l=c+s[0].length}return l<e.length&&i.push(...Jx(e.slice(l),a,`m${l}`)),Ed(zE,{children:i})}import{Fragment as Rd,jsx as J,jsxs as pt}from"react/jsx-runtime";var jE=5;function ib({kind:e,reactions:t,myAccountSeq:o,onToggle:a}){O();let r=t??[],i=o>0&&r.some(u=>u.account_seq===o),l=e==="like"?n("section.reactLike"):n("section.reactAck"),s=r.length===0?l:J(ye,{sx:{whiteSpace:"pre-line",fontSize:12},children:r.map(u=>`${u.name} \xB7 ${u.time}`).join(`
11
- `)}),c=e==="like"?"#e5484d":"#2f80ed";return J(lb,{title:s,arrow:!0,enterDelay:300,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:pt(ye,{sx:{display:"inline-flex",alignItems:"center"},children:[J(Yo,{size:"small","aria-label":n("section.commentReaction",{label:l}),onClick:a,sx:{color:i?c:"#c9c8c5",p:.5},children:e==="like"?i?J(HE,{sx:{fontSize:16}}):J(WE,{sx:{fontSize:16}}):i?J($E,{sx:{fontSize:16}}):J(VE,{sx:{fontSize:16}})}),r.length>0?J(ye,{component:"span",sx:{fontSize:12,color:i?c:"#9a9a97",ml:-.25},children:r.length}):null]})})}function sb({taskSeq:e,comments:t,currentUserName:o="",myAccountSeq:a=0,avatarSrcByName:r,onUpdate:i,onRemove:l,onToggleReaction:s,onPreview:c,onDownload:u}){O();let[m,d]=Qr(null),f=Sc(null),[p,g]=Qr(null),x=$e(),[b,_]=Qr(null),h=(S,M)=>{navigator.clipboard.writeText(M).then(()=>{_(S),setTimeout(()=>_(F=>F===S?null:F),1500)})},[y,k]=Qr(!1),I=Math.max(0,t.length-jE),C=I>0&&!y,E=m?Math.min(m.index,I):I,P=t.map((S,M)=>({comment:S,index:M})).slice(C?E:0),V=Oi(),A=(S,M)=>{if(c){c(S,M&&M.length>1?M:void 0);return}window.open(V(S.uuid??""),"_blank","noopener,noreferrer")},v=S=>{if(u){u(S);return}window.open(V(S.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},T=le().slots?.avatar,D=od();return pt(ye,{className:"taskbox-comments",sx:{px:2,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[pt(ye,{sx:{display:"flex",alignItems:"center",gap:1},children:[D.showIcon?J(Vr,{sx:{fontSize:18,display:"block",color:D.color}}):null,pt(ye,{sx:{fontSize:td,fontWeight:D.fontWeight,color:D.color},children:[n("section.comments"),t.length>0?` (${t.length})`:""]}),I>0&&(!C||E>0)?J(ye,{role:"button",tabIndex:0,onClick:()=>k(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),k(M=>!M))},sx:{ml:"auto",flexShrink:0,cursor:"pointer",fontSize:14.5,color:"#5b87d6","&:hover":{textDecoration:"underline"}},children:C?n("section.showOlder",{keepFrom:E}):n("section.hideOlder")}):null]}),t.length===0?J(ye,{sx:{mt:1,fontSize:14.5,color:"#9a9a97"},children:n("section.noComments")}):null,J(ye,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:P.map(({comment:S,index:M})=>{let F=!!o&&S.author===o,W=J(ye,{component:"span",sx:{fontSize:14.5,fontWeight:700,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.author}),B=S.external?J(ye,{component:"span",sx:{flexShrink:0,px:.6,fontSize:11.5,fontWeight:500,lineHeight:"18px",color:"#d9730d",bgcolor:"#fdf0e6",borderRadius:"4px",whiteSpace:"nowrap"},children:n("section.merchant")}):null;return pt(ye,{sx:{display:"flex",gap:1.5,alignItems:"flex-start","&:hover .taskbox-comment-actions":{opacity:1,pointerEvents:"auto"},"&:not(:last-child)":{borderBottom:"1px dashed #e0dfdc",pb:1}},children:[(()=>{let R=r?.get(S.author)??"";return T?J(ye,{sx:{display:"inline-flex",flexShrink:0},children:J(T,{name:S.author,src:R||void 0,size:44})}):J(ye,{sx:{display:"inline-flex",flexShrink:0},children:J(fo,{src:R,name:S.author,avatarSx:{width:44,height:44,fontSize:20,borderRadius:"50%",...Hr[0]},iconFontSize:24})})})(),pt(ye,{sx:{flex:1,minWidth:0},children:[x?pt(ye,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},children:[W,B]}):null,pt(ye,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0,position:"relative"},children:[x?null:W,x?null:B,J(ye,{component:"span",sx:{fontSize:12.5,color:"#9a9a97",flexShrink:0,whiteSpace:"nowrap"},children:S.time}),F?J(ye,{sx:{ml:"auto"}}):pt(ye,{sx:{display:"flex",alignItems:"center",gap:.25,ml:"auto",flexShrink:0},children:[J(Yo,{size:"small","aria-label":n("section.copyComment"),onClick:()=>h(M,xl(S.text)),sx:{color:b===M?"#2f9e5b":"#9a9a97",p:.5},children:b===M?J(ab,{sx:{fontSize:15}}):J(rb,{sx:{fontSize:15}})}),J(ib,{kind:"like",reactions:S.likes,myAccountSeq:a,onToggle:()=>s?.(e,M,"like")}),J(ib,{kind:"ack",reactions:S.acks,myAccountSeq:a,onToggle:()=>s?.(e,M,"ack")})]}),F?pt(ye,{className:"taskbox-comment-actions",sx:{display:"flex",alignItems:"center",gap:.25,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",pointerEvents:x?"auto":"none",backgroundColor:"var(--taskbox-comment-bg, #fff)",opacity:x?1:0,transition:"opacity 0.15s"},children:[J(Yo,{size:"small","aria-label":n("section.copyComment"),onClick:()=>h(M,xl(S.text)),sx:{color:b===M?"#2f9e5b":"#9a9a97"},children:b===M?J(ab,{sx:{fontSize:15}}):J(rb,{sx:{fontSize:15}})}),J(Yo,{size:"small","aria-label":n("section.editComment"),onClick:()=>d({index:M,text:S.text,attachments:[...S.attachments??[]],files:[]}),sx:{color:"#9a9a97"},children:J(NE,{sx:{fontSize:15}})}),J(Yo,{size:"small","aria-label":n("section.deleteComment"),onClick:R=>g({anchorEl:R.currentTarget,index:M}),sx:{color:"#9a9a97"},children:J(Bc,{sx:{fontSize:15}})})]}):null]}),m?.index===M?pt(ye,{sx:{mt:.5},children:[J(Dd,{defaultHtml:yc(S.text)?S.text:jx(S.text),alwaysExpanded:!0,autoFocus:!0,variant:"boxed",minHeight:56,onChange:R=>d(Y=>Y&&{...Y,text:R})}),pt(ye,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:.75,mt:.75},children:[m.attachments.map((R,Y)=>{let X=()=>d({...m,attachments:m.attachments.filter((ae,ne)=>ne!==Y)});return bl(R.name)&&R.uuid?pt(ye,{sx:{position:"relative"},children:[J(ye,{component:"img",src:V(R.uuid,{thumb:"md"}),alt:R.name,title:R.name,loading:"lazy",sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"1px solid #e6e6e3",display:"block"}}),J(Yo,{size:"small","aria-label":n("section.removeAttachment"),onClick:X,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:"1px solid #e6e6e3","&:hover":{bgcolor:"#f1f5f9"}},children:J(Bc,{sx:{fontSize:14}})})]},`kept-${R.uuid}-${Y}`):J(vc,{size:"small",icon:J(mi,{sx:{fontSize:14}}),label:R.name,onDelete:X,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`kept-${R.uuid??R.name}-${Y}`)}),m.files.map((R,Y)=>{let X=()=>d({...m,files:m.files.filter((ae,ne)=>ne!==Y)});return bl(R.name)?pt(ye,{sx:{position:"relative"},children:[J(ye,{component:"img",src:URL.createObjectURL(R),alt:R.name,title:n("section.newFile",{name:R.name}),onLoad:ae=>URL.revokeObjectURL(ae.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"2px solid #2f80ed",display:"block"}}),J(Yo,{size:"small","aria-label":n("section.removeAttachment"),onClick:X,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:"1px solid #e6e6e3","&:hover":{bgcolor:"#f1f5f9"}},children:J(Bc,{sx:{fontSize:14}})})]},`new-${R.name}-${Y}`):J(vc,{size:"small",icon:J(mi,{sx:{fontSize:14}}),label:n("section.newFile",{name:R.name}),onDelete:X,sx:{fontSize:14,height:26,bgcolor:"#eef4ff"}},`new-${R.name}-${Y}`)}),J(lb,{title:n("section.addAttachment"),arrow:!0,children:J(Yo,{size:"small","aria-label":n("section.addAttachment"),onClick:()=>f.current?.click(),sx:{ml:"auto",color:"#2f80ed"},children:J(UE,{sx:{fontSize:20}})})})]}),pt(ye,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:.75,mt:.5},children:[J(ob,{size:"small",color:"inherit",onClick:()=>d(null),children:n("common.cancel")}),J(ob,{size:"small",variant:"contained",disabled:!m.text.trim()&&m.attachments.length===0&&m.files.length===0,onClick:()=>{i(e,M,m.text,{attachments:m.attachments,files:m.files}),d(null)},children:n("common.save")})]}),J(ye,{component:"input",type:"file",multiple:!0,ref:f,sx:{display:"none"},onChange:R=>{let Y=Array.from(R.target.files??[]);Y.length>0&&d({...m,files:[...m.files,...Y].slice(0,10)}),R.target.value=""}})]}):pt(ye,{children:[S.text?yc(S.text)?J(Zx,{html:S.text}):J(ye,{sx:{fontSize:15,whiteSpace:"pre-wrap"},children:J(tb,{text:S.text})}):null,(S.attachments??[]).length>0?J(ye,{sx:{display:"flex",flexWrap:"wrap",gap:.75,mt:.75},children:(S.attachments??[]).map((R,Y)=>{let X=!!R.uuid,ae=bl(R.name),ne=(S.attachments??[]).filter($=>!!$.uuid&&bl($.name));if(ae&&X)return J(ye,{component:"img",src:V(R.uuid??"",{thumb:"md"}),alt:R.name,title:n("section.viewLarge",{name:R.name}),loading:"lazy",onClick:()=>A(R,ne),sx:{width:96,height:96,objectFit:"cover",borderRadius:1,border:"1px solid #e6e6e3",cursor:"pointer",bgcolor:"#f8fafc"}},`${R.name}-${Y}`);let pe=pc(R.name);return J(vc,{size:"small",icon:J(mi,{sx:{fontSize:14}}),label:`${R.name} (${hd(R.size)})`,clickable:X,onClick:X?()=>pe?A(R):v(R):void 0,title:X?n("section.fileAction",{name:R.name,value:pe?n("section.preview"):n("section.download")}):R.name,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${R.name}-${Y}`)})}):null]})]})]},`${S.time}-${M}`)})}),J(KE,{open:!!p,anchorEl:p?.anchorEl??null,title:n("section.deleteCommentConfirm"),confirmText:n("common.delete"),onCancel:()=>g(null),onConfirm:()=>{p&&(l(e,p.index),d(null)),g(null)}})]})}function bl(e){return/\.(png|jpe?g|gif|webp|bmp|svg|heic|heif)$/i.test(String(e??"").trim())}function cb({onSubmit:e,rows:t=2}){O();let[o,a]=Qr(""),r=Gx({value:o,setValue:a}),[i,l]=Qr([]),[s,c]=Qr(!1),u=Sc(null),m=Sc(null),f=$e()||t===1,p=y=>{let k=Array.from(y??[]);k.length!==0&&l(I=>[...I,...k].slice(0,10))},g=Sc(null),[x,b]=Qr(""),_=()=>{let y=f?o.trim():(g.current?.getComment()??"").trim();!y&&i.length===0||(e(y,i.length>0?i:void 0),a(""),g.current?.clear(),b(""),l([]))},h=pt(Rd,{children:[J(Yo,{size:"small","aria-label":n("section.attachFile"),onClick:()=>u.current?.click(),sx:{color:"#9a9a97"},children:J(mi,{sx:{fontSize:20}})}),J(Yo,{size:"small","aria-label":n("section.attachImage"),onClick:()=>m.current?.click(),sx:{color:"#9a9a97"},children:J(GE,{sx:{fontSize:20}})})]});return pt(ye,{children:[i.length>0?J(ye,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1.5,px:2,pt:2},children:i.map((y,k)=>bl(y.name)?pt(ye,{sx:{position:"relative"},children:[J(ye,{component:"img",src:URL.createObjectURL(y),alt:y.name,title:y.name,onLoad:I=>URL.revokeObjectURL(I.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"1px solid #e6e6e3",display:"block"}}),J(Yo,{size:"small","aria-label":n("section.removeAttachment"),onClick:()=>l(I=>I.filter((C,E)=>E!==k)),sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:"1px solid #e6e6e3","&:hover":{bgcolor:"#f1f5f9"}},children:J(Bc,{sx:{fontSize:14}})})]},`${y.name}-${k}`):J(vc,{size:"small",icon:J(mi,{sx:{fontSize:14}}),label:`${y.name} (${hd(y.size)})`,onDelete:()=>l(I=>I.filter((C,E)=>E!==k)),sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${y.name}-${k}`))}):null,pt(ye,{sx:{position:"relative",display:"flex"},onDragOver:y=>{Array.from(y.dataTransfer?.types??[]).includes("Files")&&(y.preventDefault(),c(!0))},onDragLeave:y=>{y.currentTarget.contains(y.relatedTarget)||c(!1)},onDrop:y=>{Array.from(y.dataTransfer?.types??[]).includes("Files")&&(y.preventDefault(),c(!1),p(y.dataTransfer?.files??null))},children:[s?pt(ye,{sx:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",gap:.75,borderRadius:1,border:"2px dashed #2f80ed",bgcolor:"rgba(47,128,237,0.08)",color:"#2f80ed",fontSize:14,fontWeight:600,pointerEvents:"none"},children:[J(mi,{sx:{fontSize:18}}),n("section.dropToAttach")]}):null,f?pt(Rd,{children:[J(FE,{value:o,placeholder:n("section.commentPlaceholder"),onChange:y=>a(y.target.value),inputRef:r.inputRef,onSelect:r.onSelectionChange,onKeyDown:y=>{r.onKeyDown(y)},onPaste:y=>{Array.from(y.clipboardData?.files??[]).length!==0&&(y.preventDefault(),p(y.clipboardData.files))},fullWidth:!0,multiline:!0,minRows:f?1:t,maxRows:3,sx:{"& .MuiInputBase-root":{pl:2,pr:f?15:6.5,pb:f?void 0:5,borderRadius:0},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}}),r.popper,pt(ye,{sx:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:.25},children:[h,J(Yo,{"aria-label":n("section.postComment"),disabled:!o.trim()&&i.length===0,onClick:_,sx:{color:"#2563eb","&.Mui-disabled":{color:"#c9c8c5"}},children:J(nb,{sx:{fontSize:22}})})]})]}):J(ye,{sx:{flex:1,minWidth:0},children:J(Dd,{ref:g,placeholder:n("section.commentPlaceholder"),alwaysExpanded:i.length>0,onChange:b,onSubmit:_,onFiles:y=>l(k=>[...k,...y].slice(0,10)),footer:pt(Rd,{children:[h,J(ye,{sx:{flex:1}}),J(Yo,{"aria-label":n("section.postComment"),disabled:!x&&i.length===0,onClick:_,sx:{color:"#2563eb","&.Mui-disabled":{color:"#c9c8c5"}},children:J(nb,{sx:{fontSize:22}})})]})})})]}),J(ye,{component:"input",ref:u,type:"file",multiple:!0,onChange:y=>{p(y.target.files),y.target.value=""},sx:{display:"none"}}),J(ye,{component:"input",ref:m,type:"file",accept:"image/*",multiple:!0,onChange:y=>{p(y.target.files),y.target.value=""},sx:{display:"none"}})]})}import{useState as kl}from"react";import{Box as di,Button as iR,ButtonBase as lR,IconButton as pi,Tooltip as fi}from"@mui/material";import sR from"@mui/icons-material/Close";import cR from"@mui/icons-material/ArrowBack";import mR from"@mui/icons-material/ContentCopyOutlined";import uR from"@mui/icons-material/ShareOutlined";import dR from"@mui/icons-material/HistoryOutlined";import pR from"@mui/icons-material/Print";import{ConfirmActionPopper as fR}from"@ehfuse/mui-confirm-action";import{Box as Tr,Button as QE,CircularProgress as ZE}from"@mui/material";import{FormDialog as JE}from"@ehfuse/mui-form-dialog";import{OverlayScrollbar as eR}from"@ehfuse/overlay-scrollbar";import{useEffect as YE}from"react";import{useModal as XE}from"@ehfuse/forma";function hl({taskSeq:e,items:t,loading:o,onLoad:a}){let r={activity:XE({modalId:ve("taskbox-task-activity")})},i=r.activity.isOpen;return YE(()=>{i&&e>0&&!t&&a?.(e)},[i,e,t,a]),{modals:r,items:t,loading:o,openDialog:()=>r.activity.open()}}import{jsx as yr,jsxs as _c}from"react/jsx-runtime";var tR={get created(){return n("activity.created")},get completed(){return n("activity.completed")},get uncompleted(){return n("activity.uncompleted")},get returned(){return n("activity.returned")},get confirm_requested(){return n("activity.confirmRequested")},get acked(){return n("activity.acked")},get claimed(){return n("activity.claimed")},get bug_verified(){return n("activity.bugVerified")},get bug_reopened(){return n("activity.bugReopened")}};function mb(e){return String(e??"").trim()||n("common.none")}function oR(e){if(e.kind!=="field")return tR[String(e.kind)]??n("activity.changed");let t=String(e.field_label??e.field??"").trim()||n("activity.field"),o=String(e.old_value??"").trim(),a=String(e.new_value??"").trim();return!o&&a?n("activity.fieldSet",{label:t,after:a}):o&&!a?n("activity.fieldCleared",{label:t}):n("activity.fieldChanged",{label:t,value:mb(o),value2:mb(a)})}function Ic({controller:e}){O();let t=$e(),{items:o,loading:a}=e,r=e.modals.activity,i=yr(Tr,{sx:{height:t?"100%":420,minHeight:0},children:yr(eR,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:_c(Tr,{sx:{px:2,pt:2,display:"flex",flexDirection:"column",gap:1,"&::after":{content:'""',flexShrink:0,height:16}},children:[a&&!o?_c(Tr,{sx:{display:"flex",alignItems:"center",gap:1,color:"#9a9a97",fontSize:14.5},children:[yr(ZE,{size:14,thickness:5,sx:{color:"#9a9a97"}}),n("common.loading")]}):null,o&&o.length===0?yr(Tr,{sx:{fontSize:14.5,color:"#9a9a97"},children:n("activity.empty")}):null,(o??[]).map(l=>_c(Tr,{sx:{display:"flex",flexDirection:t?"column":"row",gap:t?.25:1,alignItems:t?"stretch":"baseline",minWidth:0,flexShrink:0,...t?{pb:1,borderBottom:"1px solid #ededeb","&:last-of-type":{borderBottom:"none",pb:0}}:{}},children:[yr(Tr,{sx:{flexShrink:0,...t?{}:{width:"10.5em"},whiteSpace:"nowrap",fontSize:13.5,color:"#9a9a97",lineHeight:1.5},children:Uo(l.acted_time)}),_c(Tr,{sx:{minWidth:0,fontSize:14.5,color:"#37352f",lineHeight:1.5},children:[yr(Tr,{component:"span",sx:{fontWeight:500},children:String(l.actor_name??"").trim()||n("dialog.noName")}),yr(Tr,{component:"span",sx:{ml:.5},children:oR(l)})]})]},l.seq))]})})});return yr(JE,{open:r.isOpen,onClose:r.close,maxWidth:"sm",fullScreen:t,mobilePresentation:t?"slide":"dialog",contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sx:t?{DialogContent:{pb:0,"& .os-content > div":{height:"100%",boxSizing:"border-box",paddingBottom:0,marginBottom:0},"& .FormSection-content, & .section-content":{height:"100%",paddingBottom:0,marginBottom:0}}}:void 0,title:o&&o.length>0?n("activity.titleWithCount",{count:o.length}):n("activity.title"),locale:Te(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-activity",sections:[{id:"task-activity",showTitle:!1,children:i}],scrollPastLastSection:!1,actions:{showCancelButton:!1,right:yr(QE,{variant:"contained",onClick:r.close,children:n("common.close")})}})}import{InfoAlert as nR,SuccessAlert as rR}from"@ehfuse/alerts";var ub=e=>e?e.replace(/<(script|style)[\s\S]*?<\/\1>/gi,"").replace(/<br\s*\/?>/gi,`
11
+ `)}),c=e==="like"?"#e5484d":"#2f80ed";return J(lb,{title:s,arrow:!0,enterDelay:300,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:pt(ye,{sx:{display:"inline-flex",alignItems:"center"},children:[J(Yo,{size:"small","aria-label":n("section.commentReaction",{label:l}),onClick:a,sx:{color:i?c:"#c9c8c5",p:.5,"&:hover":{color:i?c:"#787774"}},children:e==="like"?i?J(HE,{sx:{fontSize:16}}):J(WE,{sx:{fontSize:16}}):i?J($E,{sx:{fontSize:16}}):J(VE,{sx:{fontSize:16}})}),r.length>0?J(ye,{component:"span",sx:{fontSize:12,color:i?c:"#9a9a97",ml:-.25},children:r.length}):null]})})}function sb({taskSeq:e,comments:t,currentUserName:o="",myAccountSeq:a=0,avatarSrcByName:r,onUpdate:i,onRemove:l,onToggleReaction:s,onPreview:c,onDownload:u}){O();let[m,d]=Qr(null),f=Sc(null),[p,g]=Qr(null),x=$e(),[b,_]=Qr(null),h=(S,M)=>{navigator.clipboard.writeText(M).then(()=>{_(S),setTimeout(()=>_(F=>F===S?null:F),1500)})},[y,k]=Qr(!1),I=Math.max(0,t.length-jE),C=I>0&&!y,E=m?Math.min(m.index,I):I,P=t.map((S,M)=>({comment:S,index:M})).slice(C?E:0),V=Oi(),A=(S,M)=>{if(c){c(S,M&&M.length>1?M:void 0);return}window.open(V(S.uuid??""),"_blank","noopener,noreferrer")},v=S=>{if(u){u(S);return}window.open(V(S.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},T=le().slots?.avatar,D=od();return pt(ye,{className:"taskbox-comments",sx:{px:2,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[pt(ye,{sx:{display:"flex",alignItems:"center",gap:1},children:[D.showIcon?J(Vr,{sx:{fontSize:18,display:"block",color:D.color}}):null,pt(ye,{sx:{fontSize:td,fontWeight:D.fontWeight,color:D.color},children:[n("section.comments"),t.length>0?` (${t.length})`:""]}),I>0&&(!C||E>0)?J(ye,{role:"button",tabIndex:0,onClick:()=>k(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),k(M=>!M))},sx:{ml:"auto",flexShrink:0,cursor:"pointer",fontSize:14.5,color:"#5b87d6","&:hover":{textDecoration:"underline"}},children:C?n("section.showOlder",{keepFrom:E}):n("section.hideOlder")}):null]}),t.length===0?J(ye,{sx:{mt:1,fontSize:14.5,color:"#9a9a97"},children:n("section.noComments")}):null,J(ye,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:P.map(({comment:S,index:M})=>{let F=!!o&&S.author===o,W=J(ye,{component:"span",sx:{fontSize:14.5,fontWeight:700,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.author}),B=S.external?J(ye,{component:"span",sx:{flexShrink:0,px:.6,fontSize:11.5,fontWeight:500,lineHeight:"18px",color:"#d9730d",bgcolor:"#fdf0e6",borderRadius:"4px",whiteSpace:"nowrap"},children:n("section.merchant")}):null;return pt(ye,{sx:{display:"flex",gap:1.5,alignItems:"flex-start","&:hover .taskbox-comment-actions":{opacity:1,pointerEvents:"auto"},"&:not(:last-child)":{borderBottom:"1px dashed #e0dfdc",pb:1}},children:[(()=>{let R=r?.get(S.author)??"";return T?J(ye,{sx:{display:"inline-flex",flexShrink:0},children:J(T,{name:S.author,src:R||void 0,size:44})}):J(ye,{sx:{display:"inline-flex",flexShrink:0},children:J(fo,{src:R,name:S.author,avatarSx:{width:44,height:44,fontSize:20,borderRadius:"50%",...Hr[0]},iconFontSize:24})})})(),pt(ye,{sx:{flex:1,minWidth:0},children:[x?pt(ye,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},children:[W,B]}):null,pt(ye,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0,position:"relative"},children:[x?null:W,x?null:B,J(ye,{component:"span",sx:{fontSize:12.5,color:"#9a9a97",flexShrink:0,whiteSpace:"nowrap"},children:S.time}),F?J(ye,{sx:{ml:"auto"}}):pt(ye,{sx:{display:"flex",alignItems:"center",gap:.25,ml:"auto",flexShrink:0},children:[J(Yo,{size:"small","aria-label":n("section.copyComment"),onClick:()=>h(M,xl(S.text)),sx:{color:b===M?"#2f9e5b":"#9a9a97",p:.5,"&:hover":{color:"#37352f"}},children:b===M?J(ab,{sx:{fontSize:15}}):J(rb,{sx:{fontSize:15}})}),J(ib,{kind:"like",reactions:S.likes,myAccountSeq:a,onToggle:()=>s?.(e,M,"like")}),J(ib,{kind:"ack",reactions:S.acks,myAccountSeq:a,onToggle:()=>s?.(e,M,"ack")})]}),F?pt(ye,{className:"taskbox-comment-actions",sx:{display:"flex",alignItems:"center",gap:.25,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",pointerEvents:x?"auto":"none",backgroundColor:"var(--taskbox-comment-bg, #fff)",opacity:x?1:0,transition:"opacity 0.15s"},children:[J(Yo,{size:"small","aria-label":n("section.copyComment"),onClick:()=>h(M,xl(S.text)),sx:{color:b===M?"#2f9e5b":"#9a9a97","&:hover":{color:"#37352f"}},children:b===M?J(ab,{sx:{fontSize:15}}):J(rb,{sx:{fontSize:15}})}),J(Yo,{size:"small","aria-label":n("section.editComment"),onClick:()=>d({index:M,text:S.text,attachments:[...S.attachments??[]],files:[]}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(NE,{sx:{fontSize:15}})}),J(Yo,{size:"small","aria-label":n("section.deleteComment"),onClick:R=>g({anchorEl:R.currentTarget,index:M}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(Bc,{sx:{fontSize:15}})})]}):null]}),m?.index===M?pt(ye,{sx:{mt:.5},children:[J(Dd,{defaultHtml:yc(S.text)?S.text:jx(S.text),alwaysExpanded:!0,autoFocus:!0,variant:"boxed",minHeight:56,onChange:R=>d(Y=>Y&&{...Y,text:R})}),pt(ye,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:.75,mt:.75},children:[m.attachments.map((R,Y)=>{let X=()=>d({...m,attachments:m.attachments.filter((ae,ne)=>ne!==Y)});return bl(R.name)&&R.uuid?pt(ye,{sx:{position:"relative"},children:[J(ye,{component:"img",src:V(R.uuid,{thumb:"md"}),alt:R.name,title:R.name,loading:"lazy",sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"1px solid #e6e6e3",display:"block"}}),J(Yo,{size:"small","aria-label":n("section.removeAttachment"),onClick:X,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:"1px solid #e6e6e3","&:hover":{bgcolor:"#f1f5f9"}},children:J(Bc,{sx:{fontSize:14}})})]},`kept-${R.uuid}-${Y}`):J(vc,{size:"small",icon:J(mi,{sx:{fontSize:14}}),label:R.name,onDelete:X,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`kept-${R.uuid??R.name}-${Y}`)}),m.files.map((R,Y)=>{let X=()=>d({...m,files:m.files.filter((ae,ne)=>ne!==Y)});return bl(R.name)?pt(ye,{sx:{position:"relative"},children:[J(ye,{component:"img",src:URL.createObjectURL(R),alt:R.name,title:n("section.newFile",{name:R.name}),onLoad:ae=>URL.revokeObjectURL(ae.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"2px solid #2f80ed",display:"block"}}),J(Yo,{size:"small","aria-label":n("section.removeAttachment"),onClick:X,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:"1px solid #e6e6e3","&:hover":{bgcolor:"#f1f5f9"}},children:J(Bc,{sx:{fontSize:14}})})]},`new-${R.name}-${Y}`):J(vc,{size:"small",icon:J(mi,{sx:{fontSize:14}}),label:n("section.newFile",{name:R.name}),onDelete:X,sx:{fontSize:14,height:26,bgcolor:"#eef4ff"}},`new-${R.name}-${Y}`)}),J(lb,{title:n("section.addAttachment"),arrow:!0,children:J(Yo,{size:"small","aria-label":n("section.addAttachment"),onClick:()=>f.current?.click(),sx:{ml:"auto",color:"#2f80ed"},children:J(UE,{sx:{fontSize:20}})})})]}),pt(ye,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:.75,mt:.5},children:[J(ob,{size:"small",color:"inherit",onClick:()=>d(null),children:n("common.cancel")}),J(ob,{size:"small",variant:"contained",disabled:!m.text.trim()&&m.attachments.length===0&&m.files.length===0,onClick:()=>{i(e,M,m.text,{attachments:m.attachments,files:m.files}),d(null)},children:n("common.save")})]}),J(ye,{component:"input",type:"file",multiple:!0,ref:f,sx:{display:"none"},onChange:R=>{let Y=Array.from(R.target.files??[]);Y.length>0&&d({...m,files:[...m.files,...Y].slice(0,10)}),R.target.value=""}})]}):pt(ye,{children:[S.text?yc(S.text)?J(Zx,{html:S.text}):J(ye,{sx:{fontSize:15,whiteSpace:"pre-wrap"},children:J(tb,{text:S.text})}):null,(S.attachments??[]).length>0?J(ye,{sx:{display:"flex",flexWrap:"wrap",gap:.75,mt:.75},children:(S.attachments??[]).map((R,Y)=>{let X=!!R.uuid,ae=bl(R.name),ne=(S.attachments??[]).filter($=>!!$.uuid&&bl($.name));if(ae&&X)return J(ye,{component:"img",src:V(R.uuid??"",{thumb:"md"}),alt:R.name,title:n("section.viewLarge",{name:R.name}),loading:"lazy",onClick:()=>A(R,ne),sx:{width:96,height:96,objectFit:"cover",borderRadius:1,border:"1px solid #e6e6e3",cursor:"pointer",bgcolor:"#f8fafc"}},`${R.name}-${Y}`);let pe=pc(R.name);return J(vc,{size:"small",icon:J(mi,{sx:{fontSize:14}}),label:`${R.name} (${hd(R.size)})`,clickable:X,onClick:X?()=>pe?A(R):v(R):void 0,title:X?n("section.fileAction",{name:R.name,value:pe?n("section.preview"):n("section.download")}):R.name,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${R.name}-${Y}`)})}):null]})]})]},`${S.time}-${M}`)})}),J(KE,{open:!!p,anchorEl:p?.anchorEl??null,title:n("section.deleteCommentConfirm"),confirmText:n("common.delete"),onCancel:()=>g(null),onConfirm:()=>{p&&(l(e,p.index),d(null)),g(null)}})]})}function bl(e){return/\.(png|jpe?g|gif|webp|bmp|svg|heic|heif)$/i.test(String(e??"").trim())}function cb({onSubmit:e,rows:t=2}){O();let[o,a]=Qr(""),r=Gx({value:o,setValue:a}),[i,l]=Qr([]),[s,c]=Qr(!1),u=Sc(null),m=Sc(null),f=$e()||t===1,p=y=>{let k=Array.from(y??[]);k.length!==0&&l(I=>[...I,...k].slice(0,10))},g=Sc(null),[x,b]=Qr(""),_=()=>{let y=f?o.trim():(g.current?.getComment()??"").trim();!y&&i.length===0||(e(y,i.length>0?i:void 0),a(""),g.current?.clear(),b(""),l([]))},h=pt(Rd,{children:[J(Yo,{size:"small","aria-label":n("section.attachFile"),onClick:()=>u.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(mi,{sx:{fontSize:20}})}),J(Yo,{size:"small","aria-label":n("section.attachImage"),onClick:()=>m.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(GE,{sx:{fontSize:20}})})]});return pt(ye,{children:[i.length>0?J(ye,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1.5,px:2,pt:2},children:i.map((y,k)=>bl(y.name)?pt(ye,{sx:{position:"relative"},children:[J(ye,{component:"img",src:URL.createObjectURL(y),alt:y.name,title:y.name,onLoad:I=>URL.revokeObjectURL(I.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"1px solid #e6e6e3",display:"block"}}),J(Yo,{size:"small","aria-label":n("section.removeAttachment"),onClick:()=>l(I=>I.filter((C,E)=>E!==k)),sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:"1px solid #e6e6e3","&:hover":{bgcolor:"#f1f5f9"}},children:J(Bc,{sx:{fontSize:14}})})]},`${y.name}-${k}`):J(vc,{size:"small",icon:J(mi,{sx:{fontSize:14}}),label:`${y.name} (${hd(y.size)})`,onDelete:()=>l(I=>I.filter((C,E)=>E!==k)),sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${y.name}-${k}`))}):null,pt(ye,{sx:{position:"relative",display:"flex"},onDragOver:y=>{Array.from(y.dataTransfer?.types??[]).includes("Files")&&(y.preventDefault(),c(!0))},onDragLeave:y=>{y.currentTarget.contains(y.relatedTarget)||c(!1)},onDrop:y=>{Array.from(y.dataTransfer?.types??[]).includes("Files")&&(y.preventDefault(),c(!1),p(y.dataTransfer?.files??null))},children:[s?pt(ye,{sx:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",gap:.75,borderRadius:1,border:"2px dashed #2f80ed",bgcolor:"rgba(47,128,237,0.08)",color:"#2f80ed",fontSize:14,fontWeight:600,pointerEvents:"none"},children:[J(mi,{sx:{fontSize:18}}),n("section.dropToAttach")]}):null,f?pt(Rd,{children:[J(FE,{value:o,placeholder:n("section.commentPlaceholder"),onChange:y=>a(y.target.value),inputRef:r.inputRef,onSelect:r.onSelectionChange,onKeyDown:y=>{r.onKeyDown(y)},onPaste:y=>{Array.from(y.clipboardData?.files??[]).length!==0&&(y.preventDefault(),p(y.clipboardData.files))},fullWidth:!0,multiline:!0,minRows:f?1:t,maxRows:3,sx:{"& .MuiInputBase-root":{pl:2,pr:f?15:6.5,pb:f?void 0:5,borderRadius:0},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}}),r.popper,pt(ye,{sx:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:.25},children:[h,J(Yo,{"aria-label":n("section.postComment"),disabled:!o.trim()&&i.length===0,onClick:_,sx:{color:"#2563eb","&.Mui-disabled":{color:"#c9c8c5"}},children:J(nb,{sx:{fontSize:22}})})]})]}):J(ye,{sx:{flex:1,minWidth:0},children:J(Dd,{ref:g,placeholder:n("section.commentPlaceholder"),alwaysExpanded:i.length>0,onChange:b,onSubmit:_,onFiles:y=>l(k=>[...k,...y].slice(0,10)),footer:pt(Rd,{children:[h,J(ye,{sx:{flex:1}}),J(Yo,{"aria-label":n("section.postComment"),disabled:!x&&i.length===0,onClick:_,sx:{color:"#2563eb","&.Mui-disabled":{color:"#c9c8c5"}},children:J(nb,{sx:{fontSize:22}})})]})})})]}),J(ye,{component:"input",ref:u,type:"file",multiple:!0,onChange:y=>{p(y.target.files),y.target.value=""},sx:{display:"none"}}),J(ye,{component:"input",ref:m,type:"file",accept:"image/*",multiple:!0,onChange:y=>{p(y.target.files),y.target.value=""},sx:{display:"none"}})]})}import{useState as kl}from"react";import{Box as di,Button as iR,ButtonBase as lR,IconButton as pi,Tooltip as fi}from"@mui/material";import sR from"@mui/icons-material/Close";import cR from"@mui/icons-material/ArrowBack";import mR from"@mui/icons-material/ContentCopyOutlined";import uR from"@mui/icons-material/ShareOutlined";import dR from"@mui/icons-material/HistoryOutlined";import pR from"@mui/icons-material/Print";import{ConfirmActionPopper as fR}from"@ehfuse/mui-confirm-action";import{Box as Tr,Button as QE,CircularProgress as ZE}from"@mui/material";import{FormDialog as JE}from"@ehfuse/mui-form-dialog";import{OverlayScrollbar as eR}from"@ehfuse/overlay-scrollbar";import{useEffect as YE}from"react";import{useModal as XE}from"@ehfuse/forma";function hl({taskSeq:e,items:t,loading:o,onLoad:a}){let r={activity:XE({modalId:ve("taskbox-task-activity")})},i=r.activity.isOpen;return YE(()=>{i&&e>0&&!t&&a?.(e)},[i,e,t,a]),{modals:r,items:t,loading:o,openDialog:()=>r.activity.open()}}import{jsx as yr,jsxs as _c}from"react/jsx-runtime";var tR={get created(){return n("activity.created")},get completed(){return n("activity.completed")},get uncompleted(){return n("activity.uncompleted")},get returned(){return n("activity.returned")},get confirm_requested(){return n("activity.confirmRequested")},get acked(){return n("activity.acked")},get claimed(){return n("activity.claimed")},get bug_verified(){return n("activity.bugVerified")},get bug_reopened(){return n("activity.bugReopened")}};function mb(e){return String(e??"").trim()||n("common.none")}function oR(e){if(e.kind!=="field")return tR[String(e.kind)]??n("activity.changed");let t=String(e.field_label??e.field??"").trim()||n("activity.field"),o=String(e.old_value??"").trim(),a=String(e.new_value??"").trim();return!o&&a?n("activity.fieldSet",{label:t,after:a}):o&&!a?n("activity.fieldCleared",{label:t}):n("activity.fieldChanged",{label:t,value:mb(o),value2:mb(a)})}function Ic({controller:e}){O();let t=$e(),{items:o,loading:a}=e,r=e.modals.activity,i=yr(Tr,{sx:{height:t?"100%":420,minHeight:0},children:yr(eR,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:_c(Tr,{sx:{px:2,pt:2,display:"flex",flexDirection:"column",gap:1,"&::after":{content:'""',flexShrink:0,height:16}},children:[a&&!o?_c(Tr,{sx:{display:"flex",alignItems:"center",gap:1,color:"#9a9a97",fontSize:14.5},children:[yr(ZE,{size:14,thickness:5,sx:{color:"#9a9a97"}}),n("common.loading")]}):null,o&&o.length===0?yr(Tr,{sx:{fontSize:14.5,color:"#9a9a97"},children:n("activity.empty")}):null,(o??[]).map(l=>_c(Tr,{sx:{display:"flex",flexDirection:t?"column":"row",gap:t?.25:1,alignItems:t?"stretch":"baseline",minWidth:0,flexShrink:0,...t?{pb:1,borderBottom:"1px solid #ededeb","&:last-of-type":{borderBottom:"none",pb:0}}:{}},children:[yr(Tr,{sx:{flexShrink:0,...t?{}:{width:"10.5em"},whiteSpace:"nowrap",fontSize:13.5,color:"#9a9a97",lineHeight:1.5},children:Uo(l.acted_time)}),_c(Tr,{sx:{minWidth:0,fontSize:14.5,color:"#37352f",lineHeight:1.5},children:[yr(Tr,{component:"span",sx:{fontWeight:500},children:String(l.actor_name??"").trim()||n("dialog.noName")}),yr(Tr,{component:"span",sx:{ml:.5},children:oR(l)})]})]},l.seq))]})})});return yr(JE,{open:r.isOpen,onClose:r.close,maxWidth:"sm",fullScreen:t,mobilePresentation:t?"slide":"dialog",contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sx:t?{DialogContent:{pb:0,"& .os-content > div":{height:"100%",boxSizing:"border-box",paddingBottom:0,marginBottom:0},"& .FormSection-content, & .section-content":{height:"100%",paddingBottom:0,marginBottom:0}}}:void 0,title:o&&o.length>0?n("activity.titleWithCount",{count:o.length}):n("activity.title"),locale:Te(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-activity",sections:[{id:"task-activity",showTitle:!1,children:i}],scrollPastLastSection:!1,actions:{showCancelButton:!1,right:yr(QE,{variant:"contained",onClick:r.close,children:n("common.close")})}})}import{InfoAlert as nR,SuccessAlert as rR}from"@ehfuse/alerts";var ub=e=>e?e.replace(/<(script|style)[\s\S]*?<\/\1>/gi,"").replace(/<br\s*\/?>/gi,`
12
12
  `).replace(/<\/(p|div|li|h[1-6]|tr)>/gi,`
13
13
  `).replace(/<[^>]+>/g,"").replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#39;/gi,"'").replace(/&amp;/gi,"&").replace(/\n{3,}/g,`
14
14