@ehfuse/taskbox 0.11.22 → 0.11.23
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 +1 -1
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import{a as Fi,b as Wp,c as Cm,d as eA,e as tA,f as oA,g as nA,h as rA}from"./ch
|
|
|
2
2
|
`).replace(/<\/(p|div|li|h[1-6]|blockquote)>/gi,`
|
|
3
3
|
`),o=document.createElement("div");return o.innerHTML=t,(o.textContent??"").replace(/\n{3,}/g,`
|
|
4
4
|
|
|
5
|
-
`).trim()}var Mw={...Dx,left:(Dx.left??[]).map(e=>e.filter(t=>t!=="undo"&&t!=="redo")).filter(e=>e.length>0).flatMap(e=>e.includes("indent")?[["bulletList","numberList"],e]:[e])};function bc({syncKey:e,value:t,onChange:o,readOnly:a=!1,viewFirst:r=!1,onTranslate:i,minHeight:l=180,editing:s,onEditingChange:c}){O();let{uploadContentImage:u,openExternalUrl:m,openContentImage:d}=ie(),p=B=>{m?m(B):window.open(B,"_blank","noopener,noreferrer")},[f,g]=_x(()=>!r||!Da(t).trim()),x=s!==void 0,h=x?s:f,D=wa(c);D.current=c;let b=B=>{x||g(B),D.current?.(B)};Bx(()=>{r&&b(!Da(t).trim())},[e,r]);let v=wa(null),T=wa(new Pw),N=wa(null),k=wa(Date.now()+800),_=$e(),R=ww(),H=Iw(R.breakpoints.down("sm")),[M,y]=_x(!1),C=()=>{let B=Da(t);B&&navigator.clipboard.writeText(B).then(()=>{y(!0),window.setTimeout(()=>y(!1),1500)})},w=(B,P=!1)=>B instanceof Element?B.closest(P?".taskbox-content-readview a[href]":".ehfuse-editor-content a[href]"):null,S=B=>_||B.ctrlKey||B.metaKey;Bx(()=>{if(a)return;let B=Td(t);N.current===B||N.current===t||(N.current=B,k.current=Date.now()+800,v.current?.setHtml(B))},[e,t,a]);let A=Td(t),E=wa(null),q=wa({el:null,html:""});return _w(()=>{let B=E.current;B&&(q.current.el===B&&q.current.html===A||(B.innerHTML=A,q.current={el:B,html:A}))}),a||!h?xc(xl,{sx:{position:"relative",mt:1},children:[ro(xl,{onClickCapture:B=>{let P=B.target;if(P?.tagName==="IMG"&&P.src){B.preventDefault(),B.stopPropagation();let V=Array.from(B.currentTarget.querySelectorAll("img")).filter(le=>le.src),ee=V.map((le,U)=>({src:le.src,name:le.alt||decodeURIComponent(le.src.split("/").pop()||"")||`image-${U+1}`})),re=Math.max(0,V.indexOf(P));d?d(ee,re):p(ee[re].src);return}let j=w(B.target,!0);j&&(B.preventDefault(),B.stopPropagation(),p(j.href))},ref:E,className:"taskbox-content-readview","data-drag-scroll":"off",sx:{border:"1px solid #e0e0e0",borderRadius:1,p:"12px",pr:H?"12px":"52px",pb:"28px",minHeight:l,fontSize:16,lineHeight:1.6,color:"#37352f",wordBreak:"break-word",userSelect:"text","& > p:first-of-type":{mt:0},"& > p:last-of-type":{mb:0},"& a[href]":{color:"#2563eb",textDecoration:"underline",cursor:"pointer"},"& img":{maxWidth:"100%",cursor:"zoom-in"},"& ul, & ol":{pl:"1.5em",my:.5},"& ul":{listStyleType:"disc"},"& ol":{listStyleType:"decimal"},"& li > p":{my:0}}}),H?xc(xl,{sx:{display:"flex",gap:1,mt:1},children:[ro(bd,{variant:"outlined",color:"inherit",startIcon:ro(Ew,{sx:{fontSize:18}}),onClick:C,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:M?n("section.copied"):n("common.copy")}),a?null:ro(bd,{variant:"outlined",color:"inherit",startIcon:ro(Ix,{sx:{fontSize:18}}),onClick:()=>b(!0),sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:n("common.edit")}),i?ro(bd,{variant:"outlined",color:"inherit",startIcon:ro(wx,{sx:{fontSize:18}}),onClick:i,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:n("section.translate")}):null]}):xc(xl,{sx:{position:"absolute",top:6,right:6,display:"flex",flexDirection:"column",gap:.25},children:[a?null:ro(kd,{title:n("section.editContent"),arrow:!0,placement:"left",children:ro(hd,{size:"small","aria-label":n("section.editContent"),onClick:()=>b(!0),sx:{color:"#9a9a97"},children:ro(Ix,{sx:{fontSize:17}})})}),i?ro(kd,{title:n("section.translate"),arrow:!0,placement:"left",children:ro(hd,{size:"small","aria-label":n("section.translate"),onClick:i,sx:{color:"#9a9a97"},children:ro(wx,{sx:{fontSize:17}})})}):null]})]}):xc(xl,{onDragOver:B=>B.stopPropagation(),onDrop:B=>B.stopPropagation(),onMouseDownCapture:B=>{S(B)&&w(B.target)&&B.preventDefault()},onClickCapture:B=>{let P=S(B)?w(B.target):null;P&&(B.preventDefault(),B.stopPropagation(),p(P.href))},sx:{mt:1,"& .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":{top:"12px",left:"12px"},..._?{"& .ehfuse-editor-content a[href]":{cursor:"pointer"}}:{},position:"relative"},children:[r&&!x?ro(kd,{title:n("section.finishEditingTooltip"),arrow:!0,children:ro(hd,{size:"small","aria-label":n("section.finishEditing"),onMouseDown:B=>B.preventDefault(),onClick:()=>b(!1),sx:{position:"absolute",top:4,right:6,zIndex:2,color:"#2f9e5b"},children:ro(Dw,{sx:{fontSize:19}})})}):null,ro(Rw,{ref:v,defaultValue:Td(t),autoHeight:!0,showToolbar:!_,focusBorder:!0,styles:{focusBorderColor:"var(--primary)"},toolbarOptions:Mw,plugins:[T.current],locale:pa(),minHeight:l,placeholder:n("section.contentPlaceholder"),onImageUpload:u,contentStyle:{padding:"12px"},onChange:B=>{let P=Date.now()<k.current,j=B===N.current;N.current=B,!(P||j)&&o(B)}})]})}import{Fragment as $w,jsx as Do,jsxs as kc}from"react/jsx-runtime";function Sd(e){return String(e??"").replace(/<[^>]*>/g,"").replace(/ /g," ").trim().length>0}function Tc({content:e,templates:t,onApply:o,onSave:a,onRemove:r,readOnly:i=!1}){O();let[l,s]=yd(null),[c,u]=yd(!1),[m,d]=yd(""),p=async g=>{s(null),!(Sd(e)&&!await zw({title:n("section.loadTemplate"),message:n("section.loadTemplateConfirm",{name:g.name})}))&&o(g.content)},f=()=>{s(null);let g=Da(e);g&&navigator.clipboard.writeText(g).then(()=>Fw(n("section.contentCopied"))).catch(()=>Nw(n("section.contentCopyFailed")))};return kc($w,{children:[Do(Aw,{title:n("section.contentMenu"),arrow:!0,disableInteractive:!0,children:Do(Rx,{size:"small","aria-label":n("section.contentMenu"),onClick:g=>s(g.currentTarget),sx:{ml:"auto",color:"#9a9a97"},children:Do(qw,{sx:{fontSize:18}})})}),kc(Lw,{anchorEl:l,open:!!l,onClose:()=>s(null),transitionDuration:0,children:[Do(hc,{disabled:!Sd(e),onClick:f,sx:{fontSize:14,minWidth:220},children:n("menu.copyContent")}),i?null:Do(Ex,{sx:{my:.5}}),!i&&a?Do(hc,{disabled:!Sd(e),onClick:()=>{s(null),d(""),u(!0)},sx:{fontSize:14,minWidth:220},children:n("section.saveAsTemplate")}):null,!i&&a?Do(Ex,{sx:{my:.5}}):null,i?null:t.length===0?Do(hc,{disabled:!0,sx:{fontSize:14,minWidth:220},children:n("section.noSavedTemplates")}):t.map(g=>kc(hc,{onClick:()=>{p(g)},sx:{fontSize:14,minWidth:220,gap:1},children:[Do(Cd,{sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.name}),r?Do(Rx,{size:"small","aria-label":n("section.deleteTemplateAria",{name:g.name}),onClick:x=>{x.stopPropagation(),r(g.seq)},sx:{color:"#9a9a97"},children:Do(Xt,{sx:{fontSize:16}})}):null]},g.seq))]}),Do(Hw,{open:c,onClose:()=>u(!1),maxWidth:"xs",title:n("section.saveTemplateTitle"),locale:ye(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},tabs:{visible:!1},actions:{showCancelButton:!0,right:Do(Ow,{variant:"contained",disabled:!m.trim(),onClick:()=>{a?.(m.trim(),e),u(!1)},children:n("common.save")})},sections:[{id:"template-name",title:"",showTitle:!1,children:kc(Cd,{sx:{display:"flex",flexDirection:"column",gap:1},children:[Do(Cd,{sx:{fontSize:15,color:"#37352f"},children:n("section.saveTemplateHint")}),Do(Ww,{size:"medium",fullWidth:!0,autoFocus:!0,placeholder:n("section.templateNamePlaceholder"),value:m,onChange:g=>d(g.target.value)})]})}]})]})}import{useState as hl}from"react";import{Box as Ht,Button as Ox,Dialog as nD,IconButton as di,Switch as rD,TextField as aD,Tooltip as vd}from"@mui/material";import{DndContext as iD,PointerSensor as lD,closestCenter as sD,useSensor as cD,useSensors as mD}from"@dnd-kit/core";import{restrictToParentElement as uD,restrictToVerticalAxis as dD}from"@dnd-kit/modifiers";import{SortableContext as pD,arrayMove as fD,useSortable as gD,verticalListSortingStrategy as xD}from"@dnd-kit/sortable";import{CSS as bD}from"@dnd-kit/utilities";import Lx from"@mui/icons-material/Close";import hD from"@mui/icons-material/AddCircle";import Ax from"@mui/icons-material/AddTask";import kD from"@mui/icons-material/Checklist";import TD from"@mui/icons-material/CheckCircle";import yD from"@mui/icons-material/DragIndicator";import CD from"@mui/icons-material/Launch";import SD from"@mui/icons-material/LinkOutlined";import vD from"@mui/icons-material/RadioButtonUnchecked";import{useMemo as jw}from"react";import{Box as jn,Button as Yw,Tab as Xw,Tabs as Qw}from"@mui/material";import{FormDialog as Jw}from"@ehfuse/mui-form-dialog";import{ClearTextField as Zw}from"@ehfuse/mui-form-controls";import eD from"@mui/icons-material/CheckCircle";import tD from"@mui/icons-material/RadioButtonUnchecked";import{OverlayScrollbar as oD}from"@ehfuse/overlay-scrollbar";import{useRef as Vw}from"react";import{useGlobalForm as Uw,useModal as Kw}from"@ehfuse/forma";import{ErrorAlert as Gw}from"@ehfuse/alerts";var Px={type:"related",search:"",selectedSeqs:[]};function bl(e){O();let t=Vw(e);t.current=e;let o={link:Kw({modalId:ve("taskbox-task-link")})},a=Uw({formId:ve("taskbox-task-link-form"),initialValues:Px,onValidate:l=>l.selectedSeqs.length===0?(Gw(n("link.selectTask")),!1):!0,onSubmit:l=>{for(let s of l.selectedSeqs)t.current.onSubmit(s,l.type);return o.link.close(),!0}});return{form:a,modals:o,openDialog:()=>{a.setFormValues({...Px,selectedSeqs:[]}),o.link.open()},toggleSelected:l=>{let s=a.getFormValue("selectedSeqs")??[];if(s.includes(l)){a.setFormValue("selectedSeqs",s.filter(c=>c!==l));return}a.setFormValue("selectedSeqs",t.current.multiSelect?[...s,l]:[l])}}}import{jsx as xo,jsxs as yc}from"react/jsx-runtime";var Mx=[{type:"related",get label(){return n("link.related")},get hint(){return n("link.relatedHint")}},{type:"follow_up",get label(){return n("link.previous")},get hint(){return n("link.previousHint")}},{type:"duplicate_of",get label(){return n("link.duplicate")},get hint(){return n("link.duplicateHint")}}];function Cc({controller:e,task:t,tasks:o,excludeSeqs:a=[],hideRelationType:r=!1,title:i=n("link.title"),confirmLabel:l=n("link.confirm")}){O();let s=$e(),{form:c}=e,u=e.modals.link,m=c.useValue("type")??"related",d=String(c.useValue("search")??""),p=c.useValue("selectedSeqs")??[],f=jw(()=>{let h=new Set([t.seq,...a]),D=d.trim().toLowerCase();return o.filter(b=>h.has(b.seq)||b.is_event||b.is_notice||b.linked_only?!1:D?b.title.toLowerCase().includes(D)||(b.ticket_no??"").toLowerCase().includes(D):!0).sort((b,v)=>!!b.completed!=!!v.completed?b.completed?1:-1:v.seq-b.seq)},[o,t.seq,a,d]),g=Mx.find(h=>h.type===m)?.hint??"",x=yc(jn,{sx:{display:"flex",flexDirection:"column",minHeight:0,height:s?"100%":"auto"},children:[r?null:xo(Qw,{value:m,onChange:(h,D)=>c.setFormValue("type",D),sx:{minHeight:38,flexShrink:0,borderBottom:"1px solid #ededeb","& .MuiTab-root":{minHeight:38,py:.5,fontSize:16,color:"#333333"}},children:Mx.map(h=>xo(Xw,{value:h.type,label:h.label},h.type))}),r?null:xo(jn,{sx:{mt:1,mb:1.5,fontSize:14,flexShrink:0},children:g}),yc(jn,{sx:{...s?{height:"100%",minHeight:0}:{height:560},display:"flex",flexDirection:"column",...s?{}:{border:"1px solid #cccccc",borderRadius:1},overflow:"hidden",userSelect:"none"},children:[xo(jn,{sx:{px:1.5,py:1,borderBottom:"1px solid #cccccc",flexShrink:0},children:xo(Zw,{placeholder:n("link.searchPlaceholder"),name:"search",form:c,fullWidth:!0,autoFocus:!0,size:"small",sx:{"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiInputBase-root":{px:0}}})}),xo(jn,{sx:{flex:1,minHeight:0},children:xo(oD,{style:{height:"100%"},contentStyle:{paddingTop:0},children:xo(jn,{sx:{display:"flex",flexDirection:"column"},children:f.length===0?xo(jn,{sx:{py:4,textAlign:"center",fontSize:13.5,color:"#9a9a97"},children:n("link.empty")}):f.map(h=>{let D=h.is_notice||h.is_event?Oe(h.icon||(h.is_notice?_t:zt)):null,b=p.includes(h.seq);return yc(jn,{onClick:()=>e.toggleSelected(h.seq),sx:{display:"flex",alignItems:"center",gap:.75,px:1.5,py:1.25,flexShrink:0,cursor:"pointer",borderBottom:"1px solid #ededeb","&:last-of-type":{borderBottom:"none"},bgcolor:b?"#e3eefb":"transparent","&:hover":{bgcolor:b?"#e3eefb":"#f7f7f5"}},children:[b?xo(eD,{sx:{fontSize:20,flexShrink:0,color:"#2f6fd0"}}):xo(tD,{sx:{fontSize:20,flexShrink:0,color:"#c9c8c5"}}),D?xo(D,{sx:{fontSize:17,flexShrink:0,color:h.icon_color||"#1e3a8a"}}):null,yc(jn,{component:"span",sx:{flex:1,minWidth:0,fontSize:15,color:"#37352f",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,overflow:"hidden",lineHeight:1.5,wordBreak:"break-word"},children:[h.ticket_no?`${h.ticket_no} `:"",h.title]}),xo(jn,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:xo(Ke,{option:Nt(h)})})]},h.seq)})})})})]})]});return xo(Jw,{open:u.isOpen,onClose:u.close,maxWidth:"sm",fullScreen:s,mobilePresentation:s?"slide":"dialog",...s?{contentPaddingX:0,contentTopPadding:0,sectionsPaddingTop:0}:{},sx:s?{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:i,locale:ye(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-link",sections:[{id:"task-link",showTitle:!1,children:x}],scrollPastLastSection:!1,sectionContentPaddingTop:0,contentTopPadding:12,actions:{showCancelButton:!0,right:xo(Yw,{variant:"contained",disabled:p.length===0,onClick:()=>{c.submit()},children:l})}})}import{ConfirmActionPopper as BD}from"@ehfuse/mui-confirm-action";import{Fragment as wD,jsx as Se,jsxs as Yn}from"react/jsx-runtime";var qx="taskbox.checklist.hideCompleted";function _D({id:e,children:t}){let{attributes:o,listeners:a,setNodeRef:r,transform:i,transition:l,isDragging:s}=gD({id:e});return Se(Ht,{ref:r,sx:{transform:bD.Transform.toString(i),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({handleProps:{...o,...a},dragging:s})})}function ID({sortable:e,sensors:t,rowIds:o,onDragEnd:a,compact:r,children:i}){let l=Se(Ht,{sx:{display:"flex",flexDirection:"column",mt:.5,pl:r?0:3.25},children:i});return e?Se(iD,{sensors:t,collisionDetection:sD,modifiers:[dD,uD],onDragEnd:a,children:Se(pD,{items:o,strategy:xD,children:l})}):l}function Sc({taskSeq:e,checklist:t,onAdd:o,onToggle:a,confirmOnToggle:r=!1,onRemove:i,onUpdate:l,onReorder:s,removeLocked:c=!1,onConvertToTask:u,onOpenLinkedTask:m,linkCandidates:d,linkBaseTask:p,onLinkExistingTask:f,resolveLinkedTask:g,myAccountSeq:x=0}){O();let[h,D]=hl(""),b=bl({multiSelect:!0,onSubmit:U=>{if(!f)return;let te=d?.find($=>$.seq===U);f(e,U,String(te?.title??"").trim())}}),[v,T]=hl(null),N=$e(),[k,_]=hl(null),[R,H]=hl(null),M=U=>{let te=U.task_seq?g?.(U.task_seq):void 0;return te?te.completed:U.checked},y=U=>{if(!U.task_seq||x<=0)return!1;let te=g?.(U.task_seq);return te?!Vf(te,x):!1},C=U=>!!U.task_seq&&!!g&&!g?.(U.task_seq),w=t.filter(U=>!C(U)),S=w.filter(M).length,[A,E]=hl(()=>{try{return localStorage.getItem(qx)==="1"}catch{return!1}}),q=U=>{E(U);try{localStorage.setItem(qx,U?"1":"0")}catch{}},B=!!s&&!N&&!c,P=mD(cD(lD,{activationConstraint:{distance:5}})),j=(U,te)=>U.task_seq?`linked-${U.task_seq}`:`row-${te}`,V=t.map(j),ee=V.filter((U,te)=>{let $=t[te];return C($)?!1:!(A&&M($))}),re=U=>{let{active:te,over:$}=U;if(!$||te.id===$.id)return;let K=V.indexOf(String(te.id)),fe=V.indexOf(String($.id));K<0||fe<0||s?.(e,fD(t,K,fe))},le=()=>{h.trim()&&(o(e,h),D(""))};return Yn(zo,{icon:Se(kD,{sx:{fontSize:19,display:"block"}}),title:Yn(wD,{children:[n("section.todo"),t.length>0?Yn(Ht,{component:"span",sx:{fontSize:12.5,color:"#9a9a97"},children:[S," / ",t.length]}):null]}),titleExtra:w.length>0?Yn(Ht,{sx:{flex:1,minWidth:0,ml:1,display:"flex",alignItems:"center",gap:1},children:[Se(Ht,{sx:{flex:1,minWidth:0,height:6,borderRadius:3,bgcolor:"#ececea"},children:Se(Ht,{sx:{height:"100%",borderRadius:3,width:`${Math.round(S/w.length*100)}%`,bgcolor:"#2f80ed",transition:"width 0.2s"}})}),S>0?Yn(Ht,{component:"label",sx:{display:"inline-flex",alignItems:"center",gap:.25,flexShrink:0,cursor:"pointer",fontSize:13.5,fontWeight:400,color:"#57564f",userSelect:"none"},children:[Se(rD,{size:"small",checked:A,onChange:(U,te)=>q(te)}),n("section.hideDone")]}):null]}):null,children:[Se(ID,{sortable:B,sensors:P,rowIds:ee,onDragEnd:re,compact:N,children:t.map((U,te)=>{let $=U.task_seq?g?.(U.task_seq):void 0,K=M(U);if(A&&K||C(U))return null;let fe=!!U.task_seq,Ee=y(U),nt=se=>Yn(Ht,{sx:{display:"flex",alignItems:N?"flex-start":"center",gap:1,px:1.25,...B?{ml:-3,pl:.5}:{},py:.5,borderRadius:1,"&:hover":{bgcolor:"#f7f7f5"},"&:hover .taskbox-checklist-remove":{opacity:1},"&:hover .taskbox-checklist-convert":{opacity:1},"&:hover .taskbox-checklist-handle":{opacity:1}},children:[se?Se(Ht,{className:"taskbox-checklist-handle",...se,sx:{display:"inline-flex",flexShrink:0,alignItems:"center",color:"#c9c8c5",opacity:0,transition:"opacity 0.15s",cursor:"grab","&:active":{cursor:"grabbing"},touchAction:"none",userSelect:"none"},children:Se(yD,{sx:{fontSize:16}})}):null,Se(vd,{title:Ee?n("section.toggleLocked"):"",arrow:!0,disableInteractive:!0,children:Se(Ht,{component:"span",onClick:Ee?void 0:J=>r?H({anchorEl:J.currentTarget,index:te,checked:!K}):a(e,te,!K),sx:{display:"inline-flex",flexShrink:0,cursor:Ee?"default":"pointer",...N?{mt:"1px"}:{}},children:K?Se(TD,{sx:{fontSize:18,color:Ee?"#a9c6ec":"#2f80ed"}}):Se(vD,{sx:{fontSize:18,color:Ee?"#d6d5d1":"#9a9a97"}})})}),v?.index===te?Se(Ht,{component:"input",autoFocus:!0,spellCheck:!1,value:v.label,enterKeyHint:"done",onChange:J=>T({index:te,label:J.target.value}),onBlur:()=>{v.label.trim()&&v.label.trim()!==U.label&&l?.(e,te,v.label),T(null)},onKeyDown:J=>{J.key==="Enter"&&J.target.blur(),J.key==="Escape"&&T(null)},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",p:0}}):Se(Ht,{component:"span",onClick:fe?U.task_seq&&m?()=>m(U.task_seq):void 0:c||!l?void 0:N?()=>_({index:te,label:U.label}):()=>T({index:te,label:U.label}),sx:{flex:1,minWidth:0,fontSize:14.5,color:"#37352f",textDecoration:K?"line-through":"none",overflow:"hidden",textOverflow:"ellipsis",...N?{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,lineHeight:1.4,wordBreak:"break-word"}:{whiteSpace:"nowrap"},...fe?m?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}:c||!l?{}:{cursor:"text"}},children:U.label}),fe?Yn(Ht,{component:"span",onClick:U.task_seq&&m?()=>m(U.task_seq):void 0,sx:{display:"inline-flex",alignItems:"center",gap:.4,flexShrink:0,...N?{mt:"1px"}:{},px:.75,py:.2,borderRadius:1,fontSize:12,fontWeight:500,color:"#1d4f91",bgcolor:"#e3eefb",whiteSpace:"nowrap",...m?{cursor:"pointer"}:{}},children:[Se(CD,{sx:{fontSize:12}}),$?.manager_name?.trim()||n("template.task")]}):null,!c&&!fe&&u?Se(vd,{title:n("section.makeTask"),arrow:!0,enterDelay:300,disableInteractive:!0,children:Se(di,{className:"taskbox-checklist-convert",size:"small","aria-label":n("section.makeTask"),onClick:()=>u(e,te,U.label),sx:{display:N?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:Se(Ax,{sx:{fontSize:16}})})}):null,c?null:Se(di,{className:"taskbox-checklist-remove",size:"small","aria-label":n("section.deleteTodo"),onClick:()=>i(e,te),sx:{display:N?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:Se(Lx,{sx:{fontSize:15}})})]});return B?Se(_D,{id:V[te],children:({handleProps:se})=>nt(se)},V[te]):Se(Ht,{children:nt(null)},V[te])})}),Yn(Ht,{sx:{mt:.5,ml:N?0:3.25,display:"flex",alignItems:"center",gap:.5},children:[Se(Ht,{component:"input",spellCheck:!1,value:h,placeholder:n("section.addTodoPlaceholder"),enterKeyHint:"done",onChange:U=>D(U.target.value),onKeyDown:U=>{U.key==="Enter"&&le()},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",px:1.25,py:.75,"&::placeholder":{color:"#9a9a97"}}}),d&&p&&f?Se(vd,{title:n("section.attachExisting"),arrow:!0,children:Se(di,{size:"small","aria-label":n("section.attachExisting"),onMouseDown:U=>U.preventDefault(),onClick:b.openDialog,sx:{flexShrink:0,color:"#9a9a97"},children:Se(SD,{sx:{fontSize:20}})})}):null,Se(di,{size:"small","aria-label":n("section.addTodo"),disabled:!h.trim(),onMouseDown:U=>U.preventDefault(),onClick:le,sx:{flexShrink:0,color:h.trim()?"#2f80ed":"#c9c8c5"},children:Se(hD,{sx:{fontSize:20}})})]}),d&&p&&f?Se(Cc,{controller:b,task:p,tasks:d,excludeSeqs:t.map(U=>Number(U.task_seq??0)).filter(U=>U>0),hideRelationType:!0,title:n("section.attachExisting"),confirmLabel:n("section.attach")}):null,Se(BD,{open:!!R,anchorEl:R?.anchorEl??null,title:R?.checked?n("calendar.checklistCompleteConfirm"):n("task.uncompleteConfirm"),confirmText:R?.checked?n("common.done"):n("task.unmark"),onCancel:()=>H(null),onConfirm:()=>{R&&a(e,R.index,R.checked),H(null)}}),Se(nD,{open:!!k,onClose:()=>_(null),maxWidth:"xs",fullWidth:!0,slotProps:{paper:{sx:{borderRadius:2,m:2}}},children:Yn(Ht,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5},children:[Se(Ht,{sx:{fontSize:15.5,fontWeight:600,color:"#37352f"},children:n("section.editTodo")}),Se(aD,{autoFocus:!0,fullWidth:!0,size:"medium",value:k?.label??"",onChange:U=>_(te=>te&&{...te,label:U.target.value}),onKeyDown:U=>{if(U.key!=="Enter")return;let te=k;te&&te.label.trim()&&l?.(e,te.index,te.label.trim()),_(null)}}),Yn(Ht,{sx:{display:"flex",alignItems:"center",gap:1},children:[!c&&u&&k&&!t[k.index]?.task_seq?Se(di,{"aria-label":n("section.makeTask"),onClick:()=>{u(e,k.index,t[k.index]?.label??""),_(null)},sx:{color:"#57564f"},children:Se(Ax,{sx:{fontSize:20}})}):null,!c&&k?Se(di,{"aria-label":n("section.deleteTodo"),onClick:()=>{i(e,k.index),_(null)},sx:{color:"#e5484d"},children:Se(Lx,{sx:{fontSize:19}})}):null,Se(Ht,{sx:{flex:1}}),Se(Ox,{color:"inherit",onClick:()=>_(null),children:n("common.cancel")}),Se(Ox,{variant:"contained",disabled:!k?.label.trim(),onClick:()=>{k&&k.label.trim()&&l?.(e,k.index,k.label.trim()),_(null)},children:n("common.confirm")})]})]})})]})}import{useRef as OD,useState as LD}from"react";import{Box as mn,IconButton as AD}from"@mui/material";import{DndContext as qD,PointerSensor as zD,closestCenter as ND,useSensor as FD,useSensors as HD}from"@dnd-kit/core";import{restrictToParentElement as WD,restrictToVerticalAxis as $D}from"@dnd-kit/modifiers";import{SortableContext as VD,useSortable as UD,verticalListSortingStrategy as KD}from"@dnd-kit/sortable";import{CSS as GD}from"@dnd-kit/utilities";import jD from"@mui/icons-material/DragIndicator";import YD from"@mui/icons-material/Close";import Fx from"@mui/icons-material/AttachFileOutlined";var DD=new Set(["jpg","jpeg","png","gif","bmp","webp","svg","pdf","txt","json","xml","log","md","markdown","csv","xls","xlsx","html","htm","js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf","mp4","avi","mov","wmv","flv","webm","mp3","wav","ogg","m4a","aac"]),vc=e=>{let t=e?.split(".").pop()?.toLowerCase()??"";return DD.has(t)};import{LinearProgress as ED}from"@mui/material";import{Fragment as RD,jsx as MD,jsxs as PD}from"react/jsx-runtime";function zx(e){let t=hn(),o=t.useValue("attachmentUpload.taskSeq"),a=t.useValue("attachmentUpload.index"),r=t.useValue("attachmentUpload.total"),i=t.useValue("attachmentUpload.queue"),l=a??0;return!l||e>0&&(o??0)!==e?null:{index:l,total:r??0,queue:i??[]}}function Bd(){let t=hn().useValue("attachmentUpload.progress");return PD(RD,{children:[t??0,"%"]})}function Nx(){let t=hn().useValue("attachmentUpload.progress");return MD(ED,{variant:"determinate",value:t??0,sx:{height:4,borderRadius:2,bgcolor:"#dbe9fb",mt:.75}})}import{Fragment as Hx,jsx as wt,jsxs as Tl}from"react/jsx-runtime";function XD({id:e,children:t}){let{attributes:o,listeners:a,setNodeRef:r,transform:i,transition:l,isDragging:s}=UD({id:e});return wt(mn,{ref:r,sx:{transform:GD.Transform.toString(i),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({...o,...a})})}function kl(e){return e>=1048576?`${(e/1048576).toFixed(1)}MB`:`${Math.max(1,Math.round(e/1024))}KB`}var Bc={flex:1,minWidth:0,fontSize:13.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function _c({taskSeq:e,attachments:t,onAdd:o,onRemove:a,removeLocked:r=!1,onPreview:i,onDownload:l,onReorder:s}){O();let[c,u]=LD(!1),m=OD(null),d=$e(),p=$i(),f=Wi(),g=zx(e),x=e===0,h=!!s&&!x&&!d&&!r&&!g&&t.length>1,D=HD(FD(zD,{activationConstraint:{distance:5}})),b=(M,y)=>M.uuid?`file-${M.uuid}`:`file-${y}`,v=t.map(b),T=M=>{let{active:y,over:C}=M;if(!C||y.id===C.id)return;let w=v.indexOf(String(y.id)),S=v.indexOf(String(C.id));w<0||S<0||s?.(e,w,S)},N=M=>{if(i){i(M);return}window.open(f(M.uuid??""),"_blank","noopener,noreferrer")},k=M=>{if(l){l(M);return}window.open(f(M.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},_=M=>g?M+1<g.index?"done":M+1===g.index?"uploading":"waiting":"waiting",R=(M,y,C,w={})=>Tl(mn,{sx:{px:1,py:.5,borderRadius:1,border:"1px solid",borderColor:w.uploading?"#d5e6fb":"#e6e6e3",bgcolor:w.uploading?"#f4f9ff":"transparent","&:hover .taskbox-file-remove":{opacity:1},"&:hover .taskbox-file-handle":{opacity:1}},children:[Tl(mn,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[w.handleProps?wt(mn,{className:"taskbox-file-handle","aria-label":n("section.reorder"),...w.handleProps,sx:{display:"inline-flex",flexShrink:0,alignItems:"center",ml:-.5,mr:-.5,color:"#c9c8c5",opacity:0,transition:"opacity 0.15s",cursor:"grab","&:active":{cursor:"grabbing"},touchAction:"none",userSelect:"none"},children:wt(jD,{sx:{fontSize:16}})}):null,wt(Fx,{sx:{fontSize:16,color:"#9a9a97"}}),y,wt(mn,{component:"span",sx:{fontSize:12,color:w.uploading?"#2f80ed":"#9a9a97",flexShrink:0},children:C}),w.removeIndex!==void 0?wt(AD,{className:"taskbox-file-remove",size:"small","aria-label":n("section.deleteAttachment"),onClick:()=>a(e,w.removeIndex),sx:{opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:wt(YD,{sx:{fontSize:15}})}):null]}),w.uploading?wt(Nx,{}):null]},M),H=M=>{let y=vc(M.name);return wt(mn,{component:"button",type:"button",onClick:()=>y?N(M):k(M),title:n("section.fileAction",{name:M.name,value:y?n("section.preview"):n("section.download")}),sx:{...Bc,color:"#37352f",textAlign:"left",p:0,border:"none",background:"none",font:"inherit",fontSize:13.5,cursor:"pointer",outline:"none","&:focus-visible":{textDecoration:"underline",color:"#2f80ed"},"&:hover":{textDecoration:"underline",color:"#2f80ed"}},children:M.name})};return Tl(zo,{icon:wt(Fx,{sx:{fontSize:18,display:"block"}}),title:Tl(Hx,{children:[n("section.files")," ",t.length>0?t.length:""]}),children:[wt(QD,{sortable:h,sensors:D,rowIds:v,onDragEnd:T,children:Tl(mn,{sx:{display:"flex",flexDirection:"column",gap:.5,mt:1},children:[t.map((M,y)=>{let C=`${M.uuid||M.name}-${y}`;if(x){let w=_(y),S=w==="uploading";return R(C,wt(mn,{component:"span",sx:{...Bc,color:w==="done"?"#37352f":"#9a9a97"},children:M.name}),S?wt(Bd,{}):kl(M.size),{uploading:S,removeIndex:!r&&!g?y:void 0})}return M.uuid?h?wt(XD,{id:b(M,y),children:w=>R(C,H(M),kl(M.size),{removeIndex:r?void 0:y,handleProps:w})},b(M,y)):R(C,H(M),kl(M.size),{removeIndex:r?void 0:y}):R(C,wt(mn,{component:"span",title:n("section.legacyAttachment"),sx:{...Bc,color:"#9a9a97"},children:M.name}),kl(M.size),{removeIndex:r?void 0:y})}),!x&&g?g.queue.slice(g.index-1).map((M,y)=>{let C=y===0;return R(`uploading-${g.index+y}-${M.name}`,wt(mn,{component:"span",sx:{...Bc,color:"#9a9a97"},children:M.name}),C?wt(Bd,{}):kl(M.size),{uploading:C})}):null]})}),wt(mn,{onClick:()=>m.current?.click(),onDragOver:M=>{M.preventDefault(),u(!0)},onDragLeave:()=>u(!1),onDrop:M=>{M.preventDefault(),u(!1);let y=Array.from(M.dataTransfer.files);y.length>0&&o(e,y)},sx:{mt:1,py:2.5,display:"flex",alignItems:"center",justifyContent:"center",gap:.5,border:"1.5px dashed",borderColor:c?"#2f80ed":"#cfcfcc",borderRadius:1,bgcolor:c?"#eef6ff":"transparent",color:"#787774",fontSize:13.5,cursor:"pointer",transition:"background-color 0.15s, border-color 0.15s","&:hover":{bgcolor:"#fafaf9",borderColor:"#9a9a97"}},children:d?n("section.attachHint",{uploadMaxMb:p}):n("section.attachHintDrag",{uploadMaxMb:p})}),wt(mn,{component:"input",ref:m,type:"file",multiple:!0,onChange:M=>{let y=Array.from(M.target.files??[]);y.length>0&&o(e,y),M.target.value=""},sx:{display:"none"}})]})}function QD({sortable:e,sensors:t,rowIds:o,onDragEnd:a,children:r}){return e?wt(qD,{sensors:t,collisionDetection:ND,modifiers:[$D,WD],onDragEnd:a,children:wt(VD,{items:o,strategy:KD,children:r})}):wt(Hx,{children:r})}import{useState as rE}from"react";import{Checkbox as aE,Divider as iE,ListItemIcon as lE,Menu as sE,MenuItem as Ux}from"@mui/material";import cE from"@mui/icons-material/Add";import{Box as _d,Button as eE}from"@mui/material";import{FormDialog as tE}from"@ehfuse/mui-form-dialog";import{ClearTextField as oE}from"@ehfuse/mui-form-controls";import{ColorPicker as nE}from"@ehfuse/mui-color-picker";import{useGlobalForm as JD}from"@ehfuse/forma";import{ErrorAlert as ZD}from"@ehfuse/alerts";var Wx="#2f80ed";function $x({open:e,onClose:t,onSubmit:o}){O();let a=JD({formId:ve("taskbox-add-label-form"),initialValues:{name:"",color:Wx},onValidate:i=>String(i.name??"").trim()?!0:(ZD(n("dialog.enterLabelName")),!1),onSubmit:i=>(o(String(i.name).trim(),i.color),r.form.close(),!0)}),r={form:to({modalIdPrefix:"taskbox-add-label-dialog",open:e,onClose:t,onOpen:()=>a.setFormValues({name:"",color:Wx})})};return{form:a,modals:r}}import{jsx as yl,jsxs as Id}from"react/jsx-runtime";function Vx({open:e,onClose:t,onSubmit:o}){O();let{form:a,modals:r}=$x({open:e,onClose:t,onSubmit:o}),i=String(a.useFormValue("name")??""),l=String(a.useFormValue("color")??""),s=Sf(l),c=Id(_d,{children:[Id(_d,{sx:{display:"flex",alignItems:"center",gap:1.5,mt:.5},children:[yl(oE,{form:a,name:"name",label:n("dialog.labelName"),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),a.submit())},fullWidth:!0,autoFocus:!0}),yl(nE,{value:l,onChange:u=>a.setFormValue("color",u),shape:"circle",colorSize:28})]}),Id(_d,{sx:{mt:2,display:"flex",alignItems:"center",gap:1,fontSize:13,color:"#787774"},children:[n("dialog.preview"),yl(Ke,{option:{key:"__preview__",name:i.trim()||n("dialog.label"),...s}})]})]});return yl(tE,{open:r.form.isOpen,onClose:r.form.close,maxWidth:"xs",title:n("dialog.addLabelTitle"),locale:ye(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-add-label",sections:[{id:"add-label",showTitle:!1,children:c}],actions:{showCancelButton:!0,right:yl(eE,{variant:"contained",onClick:()=>{a.submit()},children:n("common.add")})}})}import{Fragment as mE,jsx as pi,jsxs as Ic}from"react/jsx-runtime";function wc({anchorEl:e,selectedKeys:t,labelOptions:o,onToggle:a,onAddLabel:r,onClose:i}){O();let[l,s]=rE(!1),c=zn();return Ic(mE,{children:[Ic(sE,{anchorEl:e,open:!!e,onClose:i,transitionDuration:0,...c,children:[o.map(u=>{let m=t.includes(u.key);return Ic(Ux,{onClick:()=>a(u.key),sx:{fontSize:14,minWidth:170,gap:1},children:[pi(aE,{size:"small",checked:m,sx:{p:0}}),pi(Ke,{option:u})]},u.key)}),pi(iE,{}),Ic(Ux,{onClick:()=>s(!0),sx:{fontSize:14,color:"#787774"},children:[pi(lE,{children:pi(cE,{sx:{fontSize:18,color:"#787774"}})}),n("menu.addLabel")]})]}),pi(Vx,{open:l,onClose:()=>s(!1),onSubmit:r})]})}function Kx(e,t){let o=Number(e.author_account_seq??0);return t.filter(a=>{let r=Number(a.account_seq??0);return r>0&&r!==o})}function Gx(e,t){let o=(e.target_account_seqs??[]).filter(d=>d>0);if(o.length===0)return null;let a=new Set(o),r=Kx(e,t),i=new Map;for(let d of r){let p=String(d.department??"").trim();if(!p)continue;let f=i.get(p)??[];f.push(d),i.set(p,f)}let l=[],s=new Set;for(let[d,p]of i)if(p.every(g=>a.has(Number(g.account_seq??0)))){l.push(d);for(let g of p)s.add(Number(g.account_seq??0))}let c=new Map(r.map(d=>[Number(d.account_seq??0),d.name])),u=e.target_names??[],m=[];return o.forEach((d,p)=>{s.has(d)||m.push(c.get(d)??u[p]??n("dialog.noName"))}),{teamNames:l,individualNames:m}}function Dc(e,t){let o=Gx(e,t);return o?[...o.teamNames,...o.individualNames].join(", "):n("col.allEmployees")}function OK(e,t){let o=Gx(e,t);return o?{kind:"members",teamNames:o.teamNames,individualNames:o.individualNames}:{kind:"everyone"}}function jx(e,t,o){let a=(e.target_account_seqs??[]).filter(f=>f>0),r=Kx(e,t),i=a.length>0?a.length:r.length,l=e.acks??[],s=o>0&&l.some(f=>f.account_seq===o),c=o>0&&Number(e.author_account_seq??0)===o,u=a.length===0||a.includes(o),m=new Set(l.map(f=>f.account_seq)),p=(a.length>0?r.filter(f=>a.includes(Number(f.account_seq??0))):r).filter(f=>!m.has(Number(f.account_seq??0))).map(f=>String(f.name??"").trim()).filter(f=>f.length>0);return{count:l.length,total:i,acked:s,pendingNames:p,canAck:o>0&&!c&&u&&!s&&!e.completed}}import{DatePicker as EE}from"@ehfuse/mui-datetime-picker";import{useState as uE}from"react";import{Box as Ea,IconButton as dE,Popover as pE}from"@mui/material";import fE from"@mui/icons-material/InfoOutlined";import gE from"@mui/icons-material/LockOutlined";import xE from"@mui/icons-material/PublicOutlined";import bE from"@mui/icons-material/Group";import{jsx as Yo,jsxs as Ra}from"react/jsx-runtime";var hE=[{key:"all",icon:Yo(xE,{sx:{fontSize:17,color:"#2f80ed"}}),label:"create.visibilityPublic",who:"create.visibilityInfoAll"},{key:"group",icon:Yo(bE,{sx:{fontSize:17,color:"#d9730d"}}),label:"create.visibilityDeptShort",who:"create.visibilityInfoGroup"},{key:"involved",icon:Yo(gE,{sx:{fontSize:17}}),label:"create.visibilityPrivate",who:"create.visibilityInfoPrivate"}];function Ec(){let[e,t]=uE(null),{colors:o}=ge(),a=String(va.labelColor??"#787774");return Ra(Ea,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.25},children:[n("create.visibility"),Yo(dE,{size:"small","aria-label":n("create.visibilityInfo"),onClick:r=>{r.stopPropagation(),t(r.currentTarget)},sx:{p:.25,color:a},children:Yo(fE,{sx:{fontSize:16}})}),Ra(pE,{open:!!e,anchorEl:e,onClose:()=>t(null),onClick:r=>r.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},transitionDuration:0,slotProps:{paper:{sx:{width:380,maxWidth:"calc(100vw - 32px)",p:2,borderRadius:2}}},children:[Ra(Ea,{sx:{fontSize:14,lineHeight:1.6,mb:1.5,px:1.5,py:1.25,borderRadius:1.5,bgcolor:o.accentSoft,color:o.textSecondary,wordBreak:"keep-all"},children:[Yo(Ea,{component:"strong",sx:{fontWeight:700,color:o.accentOnSurface},children:n("create.visibilityInfoNoteStrong")})," ",n("create.visibilityInfoNote")]}),Yo(Ea,{sx:{border:`1px solid ${o.border}`,borderRadius:1.5,overflow:"hidden"},children:Ra(Ea,{component:"table",sx:{width:"100%",borderCollapse:"collapse",fontSize:14,"& th, & td":{border:`1px solid ${o.border}`,py:1,px:1.25,textAlign:"left",verticalAlign:"middle"},"& tr > :first-of-type":{borderLeft:"none"},"& tr > :last-child":{borderRight:"none"},"& thead th":{borderTop:"none",bgcolor:o.surfaceSubtle,color:o.textSecondary,fontWeight:600},"& tbody tr:last-child td":{borderBottom:"none"},"& td":{color:o.textPrimary,wordBreak:"keep-all",lineHeight:1.5}},children:[Yo("thead",{children:Ra("tr",{children:[Yo("th",{children:n("create.visibilityInfoColScope")}),Yo("th",{children:n("create.visibilityInfoColWho")})]})}),Yo("tbody",{children:hE.map(r=>Ra("tr",{children:[Yo(Ea,{component:"td",sx:{whiteSpace:"nowrap"},children:Ra(Ea,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[r.icon,n(r.label)]})}),Yo("td",{children:n(r.who)})]},r.key))})]})})]})]})}import{Fragment as Pa,jsx as de,jsxs as In}from"react/jsx-runtime";var Zx="taskbox:create-expanded";function RE(){try{return window.localStorage.getItem(Zx)==="1"}catch{return!1}}function Ed({form:e,statusOptions:t,customTabs:o,sprints:a=[],avatarSrcByName:r,isNotice:i=!1,hideProject:l=!1,hideBug:s=!1,hideTypeToggle:c=!1,leadingRow:u,extraRows:m,hideLabel:d=!1,simple:p=!1,hideMembers:f=!1,templateItem:g=!1,postMode:x=!1,employees:h=[],workspaceName:D="",workspaceSlot:b,myAccountSeq:v=0,departments:T=[],myGroupSeq:N=0,onMemberEdit:k,onAddProject:_,onAddLabelOption:R,contentSyncKey:H="create",contentTemplates:M,contentTitleExtra:y,onSaveContentTemplate:C,onRemoveContentTemplate:w}){O();let S=hn(),A=$i(),E=e.useFormValue("manager_name"),q=e.useFormValue("receiver_names"),B=e.useFormValue("start_date"),P=!!e.useFormValue("is_event"),j=!!e.useFormValue("is_bug"),V=e.useFormValue("bug_repro")??"",ee=e.useFormValue("bug_device")??"",re=e.useFormValue("bug_where")??"",le=e.useFormValue("bug_version")??"",U=e.useFormValue("event_time")??"",te=e.useFormValue("event_place")??"",$=e.useFormValue("event_address")??"",K=e.useFormValue("due_date"),fe=e.useFormValue("reminders")??[],Ee=e.useFormValue("priority"),nt=e.useFormValue("content"),se=e.useFormValue("note")??"",F=e.useFormValue("checklist")??[],Y=e.useFormValue("tab_key"),ae=e.useFormValue("sprint_seq")??0,me=e.useFormValue("story_points")??0,we=o.find(I=>I.key===Y&&I.useSprints),Ce=we?a.filter(I=>`custom-${I.group_seq}`===Y):[],[vt,Ne]=fi(null),Re=e.useFormValue("label_keys"),[Pt,Ve]=fi(null),st=e.useFormValue("visibility")||"involved",io=Number(e.useFormValue("visibility_group_seq")??0),[Z,Be]=fi(null),qe=e.useFormValue("repeat_rule")||"",Ye=e.useFormValue("repeat_until")||"",[er,tr]=fi(null),[Co,Pn]=fi(null),or=e.useFormValue("target_names"),gn=e.useFormValue("target_account_seqs"),Mn=S.useValue("createAttachmentFiles")??[],Vt=i?Dc({author_account_seq:v,target_names:or,target_account_seqs:gn},h):"",[ct,Wo]=fi(RE),xn=p&&!P&&!i&&!x,Mt=xn&&!ct,Oo=()=>{let I=!ct;Wo(I);try{window.localStorage.setItem(Zx,I?"1":"0")}catch{}},lo=!x,Me=f?1:2;return In(Pa,{children:[u,!i&&!c?In(yr,{sx:{display:"flex",gap:1.25,px:2,pt:1.5,pb:1.5,flexShrink:0},children:[b?de(yr,{sx:{alignSelf:"center",mr:"6px",minWidth:0,display:"flex"},children:b}):D?de(yr,{sx:{alignSelf:"center",fontSize:13.5,fontWeight:600,color:"#37352f",mr:"6px",maxWidth:160,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:D,children:D}):null,[{value:"task",label:n("kind.task")},{value:"event",label:n("kind.event")},...s?[]:[{value:"bug",label:n("kind.bug")}]].map(I=>{let ue=(j?"bug":P?"event":"task")===I.value;return de(Yx,{onClick:()=>Vm(e,I.value),sx:{px:1.75,lineHeight:1,pt:"8px",pb:"10px",borderRadius:99,fontSize:13.5,fontWeight:ue?600:400,color:ue?"#ffffff":"#787774",bgcolor:ue?"#2563eb":"#f4f4f2"},children:I.label},I.label)})]}):null,de(Cl,{sx:{borderColor:"#e6e6e3"}}),In(yr,{sx:{pt:1.5,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[de(fc,{hideProject:l||Mt&&!Y,hideManager:f||x||Mt&&!E,hideReceivers:g||f||x&&st==="all"||Mt&&q.length===0,hideStartDate:Mt||x,hideReminder:g||x||Mt&&fe.length===0,hidePriority:x,hideDueDate:x||!P&&!!qe,values:{tabKey:Y,managerName:E,receiverNames:q,startDate:B,dueDate:K,reminders:fe,priority:Ee,eventTime:U,eventPlace:te,eventAddress:$},customTabs:o,avatarSrcByName:r,notice:i,event:P,onChangeEventTime:I=>e.setFormValue("event_time",I),onChangeEventPlace:I=>e.setFormValue("event_place",I),onChangeEventAddress:I=>e.setFormValue("event_address",I),targetSummary:Vt,onChangeProject:I=>e.setFormValue("tab_key",I),onAddProject:_,onChangeStartDate:I=>e.setFormValue("start_date",I),onClearStartDate:()=>e.setFormValue("start_date",""),onChangeDueDate:I=>e.setFormValue("due_date",I),onChangeReminder:I=>e.setFormValue("reminders",I),onChangePriority:I=>e.setFormValue("priority",I),onMemberEdit:k,pinColumns:lo,beforeStart:In(Pa,{children:[!g&&!j&&!x&&!(Mt&&!qe)?de(he,{icon:de(_E,{sx:{fontSize:17,...qe?{color:"#2f80ed"}:{}}}),label:n("create.repeat"),onClick:I=>tr(I),sx:P||!lo?void 0:it(Me),children:qe?xs(qe):de(yr,{component:"span",sx:{color:"#9a9a97"},children:n("common.none")})}):null,!g&&!j&&!x&&qe?de(he,{icon:de(IE,{sx:{fontSize:17}}),label:n("create.repeatUntil"),onClick:I=>Pn(I),sx:P||!lo?void 0:it(Me),children:Ye?Vo(Ye):de(yr,{component:"span",sx:{color:"#9a9a97"},children:n("create.auto")})}):null]}),trailing:In(Pa,{children:[!i&&!f&&!(Mt&&st==="involved")?de(he,{icon:st==="all"?de(Qx,{sx:{fontSize:17,color:"#2f80ed"}}):st==="group"?de(Jx,{sx:{fontSize:17,color:"#d9730d"}}):de(Xx,{sx:{fontSize:17}}),label:de(Ec,{}),onClick:I=>Be(I),sx:P||!lo?void 0:it(1),children:st==="all"?n("create.visibilityPublic"):st==="group"?n("create.visibilityDept",{value:T.find(I=>I.seq===io)?.name??n("create.department")}):n("create.visibilityPrivate")}):null,we&&!P&&!i&&!x&&!(Mt&&ae===0&&me===0)?In(Pa,{children:[de(he,{icon:de(BE,{sx:{fontSize:17}}),label:n("col.goal"),onClick:I=>Ne(I),sx:lo?it(1):void 0,children:ae>0?Ce.find(I=>I.seq===ae)?.name??n("create.deletedGoal"):de(yr,{component:"span",sx:{color:"#9a9a97"},children:n("board.unassigned")})}),de(he,{icon:de(wE,{sx:{fontSize:17}}),label:"\uD3EC\uC778\uD2B8",sx:lo?it(1):void 0,children:de(kr,{value:me>0?String(me):"",placeholder:n("create.notEstimated"),onCommit:I=>e.setFormValue("story_points",Number(I.replace(/[^0-9.]/g,""))||0)})})]}):null,j?de(gc,{values:{repro:V,device:ee,where:re,version:le},onChangeRepro:I=>e.setFormValue("bug_repro",I),onChangeDevice:I=>e.setFormValue("bug_device",I),onChangeWhere:I=>e.setFormValue("bug_where",I),onChangeVersion:I=>e.setFormValue("bug_version",I)}):null,!g&&!x&&!i?(m??[]).filter(I=>!(Mt&&!I.filled)).map(I=>de(he,{icon:I.icon,label:I.label,onClick:I.onClick,sx:P||!lo?void 0:it(Me),children:I.value},I.key)):null]}),leading:P||d?null:de(yr,{sx:{gridColumn:"1 / -1"},children:de(he,{icon:de(vE,{sx:{fontSize:17}}),label:n("dialog.label"),onClick:I=>Ve(I),children:(Re??[]).length>0?de(Wr,{labelKeys:Re??[],labelOptions:t}):de(yr,{component:"span",sx:{color:"#9a9a97"},children:n("menu.empty")})})})}),xn?In(Yx,{onClick:Oo,"aria-expanded":ct,sx:{alignSelf:"flex-start",display:"flex",alignItems:"center",gap:.5,minHeight:32,mx:2,pr:1,borderRadius:1,fontSize:14,color:"#2563eb","&:hover":{bgcolor:"#f2f2f0"}},children:[ct?de(kE,{sx:{fontSize:17}}):de(TE,{sx:{fontSize:17}}),ct?n("create.collapseFields"):n("create.expandFields")]}):null,de(Cl,{sx:{my:1.5,borderColor:"#e6e6e3"}}),de(zo,{icon:de(CE,{sx:{fontSize:18,display:"block"}}),title:n("common.content"),titleExtra:y||M?In(Pa,{children:[y,M?de(Tc,{content:nt,templates:M,onApply:I=>e.setFormValue("content",I),onSave:C,onRemove:w}):null]}):void 0,children:de(bc,{syncKey:H,value:nt,onChange:I=>e.setFormValue("content",I)})}),j||x||Mt&&!se?null:In(Pa,{children:[de(Cl,{sx:{my:1.5,borderColor:"#e6e6e3"}}),de(zo,{icon:de(SE,{sx:{fontSize:18,display:"block"}}),title:n("col.note"),children:de(DE,{form:e,name:"note",placeholder:n("create.notePlaceholder"),fullWidth:!0,size:"medium",sx:{mt:1}})})]}),P||x||Mt&&F.length===0?null:de(Cl,{sx:{my:1.5,borderColor:"#e6e6e3"}}),P||x||Mt&&F.length===0?null:de(Sc,{taskSeq:0,checklist:F,onAdd:(I,X)=>Gm(e,X),onToggle:(I,X,ue)=>jm(e,X,ue),onRemove:(I,X)=>Ym(e,X),onUpdate:(I,X,ue)=>Xm(e,X,ue)}),g?null:In(Pa,{children:[de(Cl,{sx:{my:1.5,borderColor:"#e6e6e3"}}),de(_c,{taskSeq:0,attachments:Mn.map(I=>({name:I.name,size:I.size})),onAdd:(I,X)=>Qm(S,X,A),onRemove:(I,X)=>Jm(S,X)})]})]}),de(wd,{transitionDuration:0,anchorEl:vt,open:!!vt,onClose:()=>Ne(null),children:[{seq:0,label:n("board.unassigned")},...Ce.map(I=>({seq:I.seq,label:an(I)}))].map(I=>de(Dd,{onClick:()=>{e.setFormValue("sprint_seq",I.seq),Ne(null)},sx:{fontSize:14,minWidth:170},children:I.label},I.seq))}),de(wd,{transitionDuration:0,anchorEl:er,open:!!er,onClose:()=>tr(null),children:[{value:"",label:n("common.none")},...Xi].map(I=>de(Dd,{selected:qe===I.value,onClick:()=>{tr(null),Um(e,I.value)},sx:{fontSize:14,minWidth:140},children:I.label},I.value||"none"))}),de(EE,{anchorEl:Co,open:!!Co,onClose:()=>Pn(null),selectedDate:Ye?new Date(`${Ye}T00:00:00`):new Date,onDateChange:I=>{Km(e,I),Pn(null)}}),de(wd,{transitionDuration:0,anchorEl:Z,open:!!Z,onClose:()=>Be(null),children:[{key:"involved",label:n("create.visibilityPrivate"),tip:n("create.privateTip"),icon:de(Xx,{sx:{fontSize:17,color:"#57564f"}}),selected:st==="involved",onPick:()=>Qi(e,"involved")},{key:"all",label:n("create.visibilityPublic"),tip:n("create.publicTip"),icon:de(Qx,{sx:{fontSize:17,color:"#2f80ed"}}),selected:st==="all",onPick:()=>Qi(e,"all")},...[...T].sort((I,X)=>I.seq===N?-1:X.seq===N?1:0).map(I=>({key:`group-${I.seq}`,label:n("create.visibilityDeptName",{name:I.name}),tip:n("create.deptTip",{name:I.name}),icon:de(Jx,{sx:{fontSize:17,color:"#d9730d"}}),selected:st==="group"&&io===I.seq,onPick:()=>Qi(e,"group",I.seq)}))].map(I=>de(yE,{title:I.tip,arrow:!0,disableInteractive:!0,placement:"right",children:In(Dd,{selected:I.selected,onClick:()=>{I.onPick(),x&&I.key==="all"&&(e.setFormValue("receiver_names",[]),e.setFormValue("receiver_account_seqs",[])),Be(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[I.icon,I.label]})},I.key))}),de(wc,{anchorEl:Pt,selectedKeys:Re??[],labelOptions:t,onToggle:I=>e.setFormValue("label_keys",Bs(Re??[],I)),onAddLabel:(I,X)=>R?.(I,X),onClose:()=>Ve(null)})]})}import{Fragment as ob,jsx as Tt,jsxs as Sl}from"react/jsx-runtime";var HE={gap:"0.75rem !important","& .left-actions, & .right-actions":{display:"contents"},"& .left-actions > span:empty":{display:"none"},"& .left-actions:not(:has(*:not(:empty)))":{display:"none"},"& .left-actions .MuiButton-root, & .right-actions .MuiButton-root":{flex:"1 1 0",minWidth:0,margin:"0 !important",paddingLeft:"8px !important",paddingRight:"8px !important",whiteSpace:"nowrap"},"& .right-actions .MuiButton-text":{border:"1px solid rgba(0, 0, 0, 0.23)"},"& .right-actions .MuiButton-contained":{border:"1px solid transparent"}};function nb({open:e,onClose:t,desktopPresentation:o="drawer",submitLabel:a,...r}){O();let{form:i,presetTitle:l="",presetContent:s="",presetVisibility:c,presetVisibilityGroupSeq:u=0,presetDueDate:m="",presetTabKey:d="",presetManager:p=null,isNotice:f=!1,defaultBug:g=!1}=r,x=hn(),h=ME(!1),[D,b]=eb(0),v=i.useFormValue("title"),T=i.useFormValue("icon"),N=i.useFormValue("icon_color"),k=!!i.useFormValue("is_event"),_=!!i.useFormValue("is_bug"),R=$e(),M=x.useValue("createSubmitting")??!1,y=f||k?Oe(T||(f?_t:zt)):null,C=f?n("create.titleNotice"):k?n("create.titleEvent"):_?n("task.createBug"):n("task.createTask"),w=f?n("create.noticeTitlePlaceholder"):k?n("create.eventTitlePlaceholder"):_?n("create.bugTitlePlaceholder"):n("create.taskTitlePlaceholder");PE(()=>{let B=h.current;h.current=e,!(!e||B)&&($m(i,x,{presetTitle:l,presetContent:s,presetVisibility:c,presetVisibilityGroupSeq:u,presetDueDate:m,presetTabKey:d,presetManager:p,isNotice:f,defaultBug:g}),b(P=>P+1))},[e]);let[S,A]=eb(null),E=B=>y?k?Tt(qE,{title:n("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:Tt(OE,{onClick:P=>A(P.currentTarget),sx:{display:"flex",p:.5,borderRadius:1,color:N||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:Tt(y,{sx:{fontSize:20}})})}):Tt(Cr,{sx:[{display:"flex",color:N||"#1e3a8a"},B],children:Tt(y,{sx:{fontSize:20}})}):null,q=Sl(Cr,{sx:{display:"flex",alignItems:"center",gap:1,px:2,pt:2,pb:1},children:[E({p:0}),Tt(Cr,{component:"input",autoFocus:!0,spellCheck:!1,value:v,placeholder:w,onChange:B=>i.setFormValue("title",B.target.value),sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:19,fontWeight:600,color:"#37352f",p:0,m:0,"&::placeholder":{color:"#c9c8c5",fontWeight:400}}})]});return R||o==="dialog"?Tt(ob,{children:Tt(FE,{open:e,onClose:t,backdropClick:!1,locale:ye(),fontScale:R?{enabled:!0,default:1.1,min:.6}:{enabled:!0},title:C,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fullScreen:R,mobilePresentation:R?"slide":"dialog",maxWidth:"md",actions:{showCancelButton:!0,right:Tt(Rd,{variant:"contained",disableElevation:!0,disabled:M,onClick:M?void 0:i.submit,children:M?n("create.saving"):a??n("create.saveButton")})},dialogActionSx:R?HE:void 0,tabs:{visible:!1},contentTopPadding:0,contentPaddingX:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,contentBottomPadding:0,scrollPastLastSection:!1,overlayScrollbar:{enabled:!0,contentStyle:{minWidth:0}},sections:[{id:"task-create",title:"",showTitle:!1,children:Tt(Cr,{sx:{width:"100%",minWidth:0,display:"flex",flexDirection:"column",gap:0},children:Tt(Ed,{...r,contentSyncKey:`create-${D}`,leadingRow:q})})}]})}):Sl(ob,{children:[Tt(LE,{anchor:"right",open:e,onClose:(B,P)=>{P!=="backdropClick"&&t()},"aria-label":n("create.newTaskAria"),sx:{zIndex:B=>B.zIndex.modal},slotProps:{paper:{sx:{width:720,maxWidth:"100vw"}}},children:Sl(Cr,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[Sl(Cr,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.5,flexShrink:0},children:[E({px:.5}),Tt(Cr,{component:"input",autoFocus:!0,spellCheck:!1,value:v,placeholder:w,onChange:B=>i.setFormValue("title",B.target.value),sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:18,fontWeight:500,color:"#37352f",p:0,m:0,"&::placeholder":{color:"#c9c8c5",fontWeight:400}}}),Tt(AE,{"aria-label":n("common.close"),onClick:t,sx:{color:"#6b7280"},children:Tt(zE,{})})]}),Tt(tb,{sx:{borderColor:"#e6e6e3"}}),Tt(Cr,{sx:{flex:1,minHeight:0},children:Tt(NE,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:Tt(Ed,{...r,contentSyncKey:`create-${D}`})})}),Tt(tb,{sx:{borderColor:"#e6e6e3"}}),Sl(Cr,{sx:{display:"flex",justifyContent:"flex-end",gap:.5,px:2,py:1.5,flexShrink:0},children:[Tt(Rd,{onClick:t,color:"inherit",disabled:M,children:n("common.cancel")}),Tt(Rd,{onClick:i.submit,variant:"contained",disabled:M,children:M?n("create.creating"):a??n("common.register")})]})]})}),Tt(Vr,{anchorEl:S,value:T,color:N,onSelect:B=>{i.setFormValue("icon",B),A(null)},onSelectColor:B=>i.setFormValue("icon_color",B),onClose:()=>A(null)})]})}import{useEffect as Jb,useRef as Zb,useState as eh}from"react";import{Box as Kc,Button as pM,Divider as th,Drawer as fM,IconButton as gM,ListItemIcon as ip,ListItemText as lp,Menu as xM,MenuItem as sp}from"@mui/material";import bM from"@mui/icons-material/MoreVert";import hM from"@mui/icons-material/DeleteOutline";import kM from"@mui/icons-material/ShareOutlined";import TM from"@mui/icons-material/HistoryOutlined";import yM from"@ehfuse/overlay-scrollbar";import{FormDialog as CM}from"@ehfuse/mui-form-dialog";import{useRef as qc,useState as Sr}from"react";import{Box as be,Button as Tb,Chip as zc,IconButton as Xo,Popover as xR,Tooltip as vb}from"@mui/material";import bR from"@mui/icons-material/ArrowUpwardRounded";import{TextField as hR}from"@ehfuse/mui-form-controls";import Nc from"@mui/icons-material/Close";import kR from"@mui/icons-material/EditOutlined";import yb from"@mui/icons-material/ContentCopyOutlined";import Cb from"@mui/icons-material/Check";import TR from"@mui/icons-material/Favorite";import yR from"@mui/icons-material/FavoriteBorderOutlined";import CR from"@mui/icons-material/CheckCircle";import SR from"@mui/icons-material/CheckCircleOutlineOutlined";import hi from"@mui/icons-material/AttachFileOutlined";import vR from"@mui/icons-material/AddCircleOutline";import BR from"@mui/icons-material/ImageOutlined";var Pd=e=>{if(e===0)return"0 Bytes";let t=1024,o=["Bytes","KB","MB","GB","TB"],a=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,a)).toFixed(2))+" "+o[a]};import{useCallback as Rc,useEffect as WE,useMemo as $E,useRef as rb,useState as Md}from"react";import{Box as Pc,Paper as VE,Popper as UE}from"@mui/material";import{jsx as Ma,jsxs as GE}from"react/jsx-runtime";var ab=8,KE=[{key:"\uC88B\uC544\uC694",get label(){return n("emoji.like")},insert:"\u{1F44D}",keywords:["like","\uC5C4\uC9C0","\uAD7F"]},{key:"\uD655\uC778",get label(){return n("emoji.check")},insert:"\u2705",keywords:["check","\uC644\uB8CC","\uCCB4\uD06C"]},{key:"\uAC10\uC0AC",get label(){return n("emoji.thanks")},insert:"\u{1F64F}",keywords:["thanks","\uACE0\uB9C8\uC6CC","\uBD80\uD0C1"]},{key:"\uCD95\uD558",get label(){return n("emoji.party")},insert:"\u{1F389}",keywords:["party","\uD30C\uD2F0","\uC9DD\uC9DD"]},{key:"\uBC15\uC218",get label(){return n("emoji.clap")},insert:"\u{1F44F}",keywords:["clap","\uC798\uD588\uC5B4"]},{key:"\uD558\uD2B8",get label(){return n("emoji.heart")},insert:"\u2764\uFE0F",keywords:["heart","\uC0AC\uB791"]},{key:"\uC6C3\uC74C",get label(){return n("emoji.laugh")},insert:"\u{1F604}",keywords:["smile","\uC6C3\uAE40","\u314B\u314B"]},{key:"\uBBF8\uC18C",get label(){return n("emoji.smile")},insert:"\u{1F642}",keywords:["smile","\uC88B\uC74C"]},{key:"\uB208\uBB3C",get label(){return n("emoji.tears")},insert:"\u{1F622}",keywords:["sad","\uC2AC\uD514","\u3160\u3160"]},{key:"\uB180\uB78C",get label(){return n("emoji.wow")},insert:"\u{1F62E}",keywords:["wow","\uD5C9"]},{key:"\uACE0\uBBFC",get label(){return n("emoji.think")},insert:"\u{1F914}",keywords:["think","\uC0DD\uAC01","\uC74C"]},{key:"\uC624\uCF00\uC774",get label(){return n("emoji.ok")},insert:"\u{1F44C}",keywords:["ok","\uC54C\uACA0\uC5B4"]},{key:"\uBD88",get label(){return n("emoji.fire")},insert:"\u{1F525}",keywords:["fire","\uAE09\uD568","\uB300\uBC15"]},{key:"\uC544\uC774\uB514\uC5B4",get label(){return n("emoji.idea")},insert:"\u{1F4A1}",keywords:["idea","\uC804\uAD6C"]},{key:"\uACBD\uACE0",get label(){return n("emoji.warning")},insert:"\u26A0\uFE0F",keywords:["warning","\uC8FC\uC758"]},{key:"\uC9C8\uBB38",get label(){return n("emoji.question")},insert:"\u2753",keywords:["question","\uBB3C\uC74C"]},{key:"\uC2DC\uACC4",get label(){return n("emoji.clock")},insert:"\u23F0",keywords:["time","\uC2DC\uAC04","\uC54C\uB78C"]},{key:"\uB2EC\uB825",get label(){return n("emoji.calendar")},insert:"\u{1F4C5}",keywords:["calendar","\uC77C\uC815","\uB0A0\uC9DC"]},{key:"\uBA54\uBAA8",get label(){return n("emoji.note")},insert:"\u{1F4DD}",keywords:["note","\uAE30\uB85D"]},{key:"\uCCA8\uBD80",get label(){return n("emoji.attach")},insert:"\u{1F4CE}",keywords:["attach","\uD074\uB9BD","\uD30C\uC77C"]},{key:"\uB9C1\uD06C",get label(){return n("emoji.link")},insert:"\u{1F517}",keywords:["link","\uC8FC\uC18C"]},{key:"\uB85C\uCF13",get label(){return n("emoji.rocket")},insert:"\u{1F680}",keywords:["rocket","\uCD9C\uBC1C","\uBC30\uD3EC"]},{key:"\uBCC4",get label(){return n("emoji.star")},insert:"\u2B50",keywords:["star","\uC911\uC694"]},{key:"\uC5D1\uC2A4",get label(){return n("emoji.x")},insert:"\u274C",keywords:["x","\uC548\uB428","\uCDE8\uC18C"]}];function vl(e,t,o){let a=e.slice(0,t),i=(o==="@"?/(^|[\s(])@([^\s@]{0,20})$/:/(^|[\s(])\/([^\s/]{0,20})$/).exec(a);return i?{start:t-i[2].length-1,query:i[2]}:null}function Od(e,t){let o=ie(),a=e??o.mentionCandidates??[],r=t??o.slashCommands,i=r===!0?KE:Array.isArray(r)?r:[];return{people:a,commands:i,enabled:a.length>0||i.length>0}}function Ld(e,t,o){if(!o)return[];let a=o.query.toLowerCase();return o.trigger==="@"?e.filter(r=>r.name.toLowerCase().includes(a)).slice(0,ab).map((r,i)=>({id:`p${i}-${r.name}`,text:`@${r.name} `,label:r.name,subtitle:r.subtitle,icon:Ma(fo,{src:r.avatar??"",name:r.name,avatarSx:{width:24,height:24,fontSize:14},iconFontSize:16})})):t.filter(r=>[r.key,r.label,...r.keywords??[]].some(i=>i.toLowerCase().includes(a))).slice(0,ab).map(r=>({id:`c-${r.key}`,text:r.insert,label:`/${r.label}`,icon:Ma(Pc,{component:"span",sx:{width:24,textAlign:"center",fontSize:18,lineHeight:1},children:r.insert})}))}function Ad({open:e,anchor:t,items:o,active:a,onPick:r,onHover:i}){return Ma(UE,{open:e,anchorEl:t,placement:"top-start",sx:{zIndex:1500},children:Ma(VE,{elevation:4,sx:{minWidth:220,maxWidth:320,py:.5,borderRadius:1.5},children:o.map((l,s)=>GE(Pc,{role:"option","aria-selected":s===a,onMouseDown:c=>c.preventDefault(),onClick:()=>r(l),onMouseEnter:()=>i(s),sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:.75,cursor:"pointer",fontSize:14,bgcolor:s===a?"action.selected":"transparent"},children:[l.icon,Ma(Pc,{component:"span",sx:{fontWeight:500,whiteSpace:"nowrap"},children:l.label}),l.subtitle?Ma(Pc,{component:"span",sx:{color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.subtitle}):null]},l.id))})})}function ib({value:e,setValue:t,candidates:o,slashCommands:a}){let{people:r,commands:i,enabled:l}=Od(o,a),s=rb(null),[c,u]=Md(null),[m,d]=Md(null),[p,f]=Md(0),g=$E(()=>Ld(r,i,m),[i,r,m]),x=!!(c&&m&&g.length>0),h=Rc(()=>{let k=s.current;if(!l||!k)return;let _=k.selectionStart??k.value.length,R=r.length>0?vl(k.value,_,"@"):null,H=!R&&i.length>0?vl(k.value,_,"/"):null,M=R?{...R,trigger:"@"}:H?{...H,trigger:"/"}:null;d(M),f(0),u(M?k.closest(".MuiInputBase-root")??k:null)},[i.length,l,r.length]),D=rb(null);WE(()=>{let k=s.current,_=D.current;if(_!==null&&k){D.current=null,k.setSelectionRange(_,_);return}document.activeElement===k&&h()},[e,h]);let b=Rc(k=>{let _=s.current;if(!m||!_)return;let R=_.selectionStart??e.length,H=e.slice(0,m.start)+k.text+e.slice(R),M=m.start+k.text.length;D.current=H===e?null:M,t(H),d(null),u(null),requestAnimationFrame(()=>{D.current=null,_.focus(),_.setSelectionRange(M,M)})},[m,t,e]),v=Rc(k=>!x||k.nativeEvent.isComposing?!1:k.key==="ArrowDown"||k.key==="ArrowUp"?(k.preventDefault(),f(_=>(_+(k.key==="ArrowDown"?1:g.length-1))%g.length),!0):k.key==="Enter"||k.key==="Tab"?(k.preventDefault(),b(g[Math.min(p,g.length-1)]),!0):k.key==="Escape"?(k.preventDefault(),k.stopPropagation(),d(null),u(null),!0):!1,[p,g,x,b]);return{inputRef:Rc(k=>{s.current=k},[]),onKeyDown:v,onSelectionChange:h,popper:l?Ma(Ad,{open:x,anchor:c,items:g,active:p,onPick:b,onHover:f}):null}}import{useCallback as qd,useEffect as jE,useRef as lb,useState as sb}from"react";import{Box as Bl,Tab as YE,Tabs as XE}from"@mui/material";import{jsx as gi,jsxs as ZE}from"react/jsx-runtime";var cb=[{key:"smile",labelKey:"section.emojiSmileys",items:["\u{1F600}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F606}","\u{1F605}","\u{1F923}","\u{1F602}","\u{1F642}","\u{1F643}","\u{1F609}","\u{1F60A}","\u{1F607}","\u{1F970}","\u{1F60D}","\u{1F929}","\u{1F618}","\u{1F617}","\u{1F61A}","\u{1F619}","\u{1F60B}","\u{1F61B}","\u{1F61C}","\u{1F92A}","\u{1F61D}","\u{1F917}","\u{1F92D}","\u{1F92B}","\u{1F914}","\u{1F928}","\u{1F610}","\u{1F611}","\u{1F636}","\u{1F60F}","\u{1F612}","\u{1F644}","\u{1F62C}","\u{1F60C}","\u{1F614}","\u{1F62A}","\u{1F634}","\u{1F637}","\u{1F912}","\u{1F915}","\u{1F975}","\u{1F976}","\u{1F635}","\u{1F92F}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62D}","\u{1F624}","\u{1F620}","\u{1F621}","\u{1F97A}","\u{1F633}","\u{1F631}","\u{1F628}","\u{1F630}","\u{1F625}","\u{1F910}","\u{1F62F}","\u{1F62E}"]},{key:"gesture",labelKey:"section.emojiPeople",items:["\u{1F44D}","\u{1F44E}","\u{1F44C}","\u270C\uFE0F","\u{1F91E}","\u{1F91F}","\u{1F918}","\u{1F919}","\u{1F448}","\u{1F449}","\u{1F446}","\u{1F447}","\u261D\uFE0F","\u270B","\u{1F91A}","\u{1F590}\uFE0F","\u{1F596}","\u{1F44B}","\u{1F91D}","\u{1F64F}","\u{1F4AA}","\u{1F9BE}","\u{1F44F}","\u{1F64C}","\u{1F450}","\u{1F932}","\u{1FAF6}","\u270D\uFE0F","\u{1F485}","\u{1F933}","\u{1F9E0}","\u{1F440}","\u{1F647}","\u{1F64B}","\u{1F646}","\u{1F645}","\u{1F481}","\u{1F937}","\u{1F926}","\u{1F9D1}\u200D\u{1F4BB}","\u{1F468}\u200D\u{1F4BC}","\u{1F469}\u200D\u{1F4BC}","\u{1F6B6}","\u{1F3C3}","\u{1F483}","\u{1F57A}","\u{1F476}","\u{1F9D3}"]},{key:"heart",labelKey:"section.emojiHearts",items:["\u2764\uFE0F","\u{1F9E1}","\u{1F49B}","\u{1F49A}","\u{1F499}","\u{1F49C}","\u{1F5A4}","\u{1F90D}","\u{1F90E}","\u{1F494}","\u2763\uFE0F","\u{1F495}","\u{1F49E}","\u{1F493}","\u{1F497}","\u{1F496}","\u{1F498}","\u{1F49D}","\u{1F49F}","\u2728","\u{1F4AB}","\u{1F4A5}","\u{1F389}","\u{1F38A}","\u{1F388}","\u{1F381}","\u{1F451}","\u{1FAC2}","\u{1F63B}","\u{1F490}","\u{1F380}","\u{1F48C}"]},{key:"work",labelKey:"section.emojiWork",items:["\u{1F4CC}","\u{1F4CE}","\u{1F4DD}","\u{1F4C4}","\u{1F4D1}","\u{1F4CA}","\u{1F4C8}","\u{1F4C9}","\u{1F5C2}\uFE0F","\u{1F4C5}","\u{1F4C6}","\u23F0","\u231B","\u2705","\u2611\uFE0F","\u274C","\u2B55","\u2757","\u2753","\u{1F4A1}","\u{1F514}","\u{1F515}","\u{1F4E2}","\u{1F4E3}","\u{1F4AC}","\u{1F4AD}","\u{1F517}","\u{1F512}","\u{1F511}","\u2699\uFE0F","\u{1F6E0}\uFE0F","\u{1F4EC}","\u{1F4BB}","\u{1F5A5}\uFE0F","\u{1F5A8}\uFE0F","\u{1F4DE}","\u{1F4F1}","\u{1F4B0}","\u{1F4B3}","\u{1F9FE}","\u{1F4E6}","\u{1F550}","\u{1F4CB}","\u{1F587}\uFE0F","\u270F\uFE0F","\u{1F5D1}\uFE0F","\u267B\uFE0F","\u{1F50D}"]},{key:"food",labelKey:"section.emojiFood",items:["\u2615","\u{1F375}","\u{1F964}","\u{1F9C3}","\u{1F37A}","\u{1F37B}","\u{1F942}","\u{1F377}","\u{1F378}","\u{1F943}","\u{1F35A}","\u{1F35C}","\u{1F372}","\u{1F35B}","\u{1F371}","\u{1F359}","\u{1F354}","\u{1F35F}","\u{1F355}","\u{1F32D}","\u{1F96A}","\u{1F32E}","\u{1F35D}","\u{1F957}","\u{1F356}","\u{1F357}","\u{1F969}","\u{1F373}","\u{1F95E}","\u{1F9C7}","\u{1F35E}","\u{1F950}","\u{1F370}","\u{1F382}","\u{1F9C1}","\u{1F36A}","\u{1F369}","\u{1F36B}","\u{1F36C}","\u{1F36D}","\u{1F366}","\u{1F34E}","\u{1F34A}","\u{1F34B}","\u{1F34C}","\u{1F349}","\u{1F347}","\u{1F353}"]},{key:"etc",labelKey:"section.emojiOther",items:["\u{1F525}","\u2B50","\u{1F31F}","\u{1F4AF}","\u{1F3AF}","\u{1F3C6}","\u{1F947}","\u{1F680}","\u{1F308}","\u2600\uFE0F","\u{1F319}","\u26C5","\u2601\uFE0F","\u{1F327}\uFE0F","\u2744\uFE0F","\u26A1","\u{1F338}","\u{1F33A}","\u{1F337}","\u{1F339}","\u{1F33B}","\u{1F340}","\u{1F33F}","\u{1F331}","\u{1F436}","\u{1F431}","\u{1F430}","\u{1F43C}","\u{1F98A}","\u{1F43B}","\u{1F425}","\u{1F98B}","\u{1F697}","\u2708\uFE0F","\u{1F3E0}","\u{1F3E2}","\u{1F3B5}","\u{1F3B6}","\u{1F4DA}","\u{1F3AE}","\u26BD","\u{1F3C0}","\u{1F48A}","\u{1FA7A}","\u{1F9F3}","\u{1F382}","\u{1F6D2}","\u{1F9F9}"]}],QE="'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif",mb="taskbox.recentEmojis",ub=24;function db(){try{let e=JSON.parse(window.localStorage.getItem(mb)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string").slice(0,ub):[]}catch{return[]}}function JE(e){let t=[e,...db().filter(o=>o!==e)].slice(0,ub);try{window.localStorage.setItem(mb,JSON.stringify(t))}catch{}return t}function pb({onPick:e}){let[t,o]=sb(()=>db()),[a,r]=sb(0),i=lb(null),l=lb(!1),s=t.length>0?[{key:"recent",labelKey:"section.emojiFrequent",items:t},...cb]:cb,c=Math.min(a,s.length-1),u=qd(p=>{o(JE(p)),e(p)},[e]),m=qd(p=>{r(p);let f=i.current;f&&(l.current=!0,f.scrollTo({left:f.clientWidth*p,behavior:"smooth"}),window.setTimeout(()=>{l.current=!1},350))},[]),d=qd(()=>{let p=i.current;if(!p||l.current||p.clientWidth===0)return;let f=Math.round(p.scrollLeft/p.clientWidth);r(g=>f!==g&&f>=0?f:g)},[]);return jE(()=>{let p=i.current;p&&(p.scrollLeft=p.clientWidth*c)},[]),ZE(Bl,{children:[gi(XE,{value:c,onChange:(p,f)=>m(f),variant:"scrollable",scrollButtons:!1,sx:{minHeight:36,borderBottom:"1px solid #ececea","& .MuiTab-root":{minHeight:36,minWidth:0,px:1.5,fontSize:13}},children:s.map(p=>gi(YE,{label:n(p.labelKey)},p.key))}),gi(Bl,{ref:i,onScroll:d,sx:{display:"flex",height:352,overflowX:"auto",overflowY:"hidden",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:s.map(p=>gi(Bl,{sx:{flex:"0 0 100%",width:"100%",height:"100%",overflowY:"auto",scrollSnapAlign:"start",scrollSnapStop:"always",p:1},children:gi(Bl,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(40px, 1fr))"},children:p.items.map((f,g)=>gi(Bl,{component:"button",type:"button",onClick:()=>u(f),"aria-label":f,sx:{border:0,bgcolor:"transparent",color:"#000",cursor:"pointer",fontFamily:QE,fontSize:24,lineHeight:1,py:.75,borderRadius:"8px","&:hover":{bgcolor:"rgba(15, 23, 42, 0.06)"},"&:active":{bgcolor:"rgba(15, 23, 42, 0.1)"}},children:f},`${f}-${g}`))})},p.key))})]})}import{forwardRef as lR,useImperativeHandle as sR,useLayoutEffect as xb,useRef as Oc,useState as gb}from"react";import{Box as Wd}from"@mui/material";import{EhfuseEditor as cR}from"@ehfuse/editor";import{useCallback as zd,useMemo as eR,useRef as tR,useState as Nd}from"react";import{jsx as oR}from"react/jsx-runtime";function fb(e,t){let{people:o,commands:a,enabled:r}=Od(e,t),[i,l]=Nd(null),[s,c]=Nd(null),u=tR(""),[m,d]=Nd(0),p=eR(()=>Ld(o,a,i),[a,o,i]),f=!!(r&&s&&i&&p.length>0),g=zd(()=>{if(!r)return;let b=window.getSelection();if(!b||b.rangeCount===0||!b.isCollapsed)return void l(null);let v=b.anchorNode;if(!v||v.nodeType!==Node.TEXT_NODE||!v.parentElement?.closest(".ehfuse-editor-content"))return void l(null);let T=v.data,N=b.anchorOffset,k=o.length>0?vl(T,N,"@"):null,_=!k&&a.length>0?vl(T,N,"/"):null,R=k?{...k,trigger:"@"}:_?{..._,trigger:"/"}:null;if(!R){u.current="",l(null),c(null);return}l({node:v,start:R.start,end:N,query:R.query,trigger:R.trigger});let H=`${R.trigger}${R.query}`;H!==u.current&&d(0),u.current=H;let M=document.createRange();M.setStart(v,R.start),M.setEnd(v,Math.min(R.start+1,T.length));let y=M.getBoundingClientRect();c({getBoundingClientRect:()=>y})},[a.length,r,o.length]),x=zd(b=>{if(!i)return;let{node:v,start:T,end:N}=i;if(!v.isConnected)return void l(null);let k=window.getSelection(),_=document.createRange();_.setStart(v,T),_.setEnd(v,Math.min(N,v.data.length)),k?.removeAllRanges(),k?.addRange(_),document.execCommand("insertText",!1,b.text),l(null),c(null)},[i]);return{handlers:{onKeyDownCapture:zd(b=>{!f||b.nativeEvent.isComposing||(b.key==="ArrowDown"||b.key==="ArrowUp"?(b.preventDefault(),b.stopPropagation(),d(v=>(v+(b.key==="ArrowDown"?1:p.length-1))%p.length)):b.key==="Enter"||b.key==="Tab"?(b.preventDefault(),b.stopPropagation(),x(p[Math.min(m,p.length-1)])):b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),l(null),c(null)))},[m,p,f,x]),onKeyUp:g,onMouseUp:g,onInput:g},popper:r?oR(Ad,{open:f,anchor:s,items:p,active:m,onPick:x,onHover:d}):null,isOpen:f}}function xi(e){return/^\s*<(p|div|ul|ol|h[1-6]|blockquote|pre)[\s>]/i.test(e)}var nR=new Set(["P","BR","DIV","SPAN","STRONG","B","EM","I","U","S","STRIKE","DEL","CODE","PRE","UL","OL","LI","H1","H2","H3","H4","BLOCKQUOTE","A","MARK"]),rR=new Set(["background-color","color","text-decoration"]);function Mc(e){if(typeof DOMParser>"u")return"";let o=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;if(!o)return"";let a=r=>{for(let i of Array.from(r.children)){if(!nR.has(i.tagName)){if(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE"].includes(i.tagName)){i.remove();continue}a(i),i.replaceWith(...Array.from(i.childNodes));continue}for(let l of Array.from(i.attributes)){let s=l.name.toLowerCase();if(i.tagName==="A"&&s==="href"){/^(https?:|mailto:|tel:)/i.test(l.value.trim())||i.removeAttribute(l.name);continue}if(s==="style"){let c=l.value.split(";").map(u=>u.trim()).filter(u=>rR.has(u.split(":")[0]?.trim().toLowerCase()??"")&&!/url\(|expression/i.test(u)).join("; ");c?i.setAttribute("style",c):i.removeAttribute("style");continue}i.removeAttribute(l.name)}a(i)}};return a(o),o.innerHTML}function _l(e){if(typeof DOMParser>"u")return e.replace(/<[^>]*>/g,"");let t=e.replace(/<br\s*\/?>/gi,`
|
|
5
|
+
`).trim()}var Mw={...Dx,left:(Dx.left??[]).map(e=>e.filter(t=>t!=="undo"&&t!=="redo")).filter(e=>e.length>0).flatMap(e=>e.includes("indent")?[["bulletList","numberList"],e]:[e])};function bc({syncKey:e,value:t,onChange:o,readOnly:a=!1,viewFirst:r=!1,onTranslate:i,minHeight:l=180,editing:s,onEditingChange:c}){O();let{uploadContentImage:u,openExternalUrl:m,openContentImage:d}=ie(),p=B=>{m?m(B):window.open(B,"_blank","noopener,noreferrer")},[f,g]=_x(()=>!r||!Da(t).trim()),x=s!==void 0,h=x?s:f,D=wa(c);D.current=c;let b=B=>{x||g(B),D.current?.(B)};Bx(()=>{r&&b(!Da(t).trim())},[e,r]);let v=wa(null),T=wa(new Pw),N=wa(null),k=wa(Date.now()+800),_=$e(),R=ww(),H=Iw(R.breakpoints.down("sm")),[M,y]=_x(!1),C=()=>{let B=Da(t);B&&navigator.clipboard.writeText(B).then(()=>{y(!0),window.setTimeout(()=>y(!1),1500)})},w=(B,P=!1)=>B instanceof Element?B.closest(P?".taskbox-content-readview a[href]":".ehfuse-editor-content a[href]"):null,S=B=>_||B.ctrlKey||B.metaKey;Bx(()=>{if(a)return;let B=Td(t);N.current===B||N.current===t||(N.current=B,k.current=Date.now()+800,v.current?.setHtml(B))},[e,t,a]);let A=Td(t),E=wa(null),q=wa({el:null,html:""});return _w(()=>{let B=E.current;B&&(q.current.el===B&&q.current.html===A||(B.innerHTML=A,q.current={el:B,html:A}))}),a||!h?xc(xl,{sx:{position:"relative",mt:1},children:[ro(xl,{onClickCapture:B=>{let P=B.target;if(P?.tagName==="IMG"&&P.src){B.preventDefault(),B.stopPropagation();let V=Array.from(B.currentTarget.querySelectorAll("img")).filter(le=>le.src),ee=V.map((le,U)=>({src:le.src,name:le.alt||decodeURIComponent(le.src.split("/").pop()||"")||`image-${U+1}`})),re=Math.max(0,V.indexOf(P));d?d(ee,re):p(ee[re].src);return}let j=w(B.target,!0);j&&(B.preventDefault(),B.stopPropagation(),p(j.href))},ref:E,className:"taskbox-content-readview","data-drag-scroll":"off",sx:{border:"1px solid #e0e0e0",borderRadius:1,p:"12px",pr:H?"12px":"52px",pb:"28px",minHeight:l,fontSize:16,lineHeight:1.6,color:"#37352f",wordBreak:"break-word",userSelect:"text","& > p:first-of-type":{mt:0},"& > p:last-of-type":{mb:0},"& a[href]":{color:"#2563eb",textDecoration:"underline",cursor:"pointer"},"& img":{maxWidth:"100%",cursor:"zoom-in"},"& ul, & ol":{pl:"1.5em",my:.5},"& ul":{listStyleType:"disc"},"& ol":{listStyleType:"decimal"},"& li > p":{my:0},"& h1, & h2, & h3, & h4, & h5, & h6":{m:"1em 0 0.5em",fontWeight:700,lineHeight:1.3},"& > :is(h1, h2, h3, h4, h5, h6):first-child":{mt:0},"& h1":{fontSize:"2em"},"& h2":{fontSize:"1.5em"},"& h3":{fontSize:"1.17em"},"& h4":{fontSize:"1em"},"& h5":{fontSize:"0.83em"},"& h6":{fontSize:"0.75em"},"& table:not([border])":{borderCollapse:"collapse",borderSpacing:0,width:"100%",my:"10px"},"& table:not([border]) > * > tr > th, & table:not([border]) > * > tr > td":{border:"1px solid #ddd",p:"6px",textAlign:"left",verticalAlign:"top",lineHeight:1.5},"& table:not([border]) > * > tr > th":{backgroundColor:"#f5f5f5",fontWeight:700},"& td > p, & th > p":{my:0},"& blockquote":{m:"20px 0",p:"4px 20px",borderLeft:"4px solid #0066cc",fontStyle:"italic",color:"#666",lineHeight:1.5},"& hr":{height:"1px",border:0,borderTop:"1px solid #e0e0e0",my:"20px"},"& code":{display:"block",fontFamily:'"Roboto", "Courier New", Courier, monospace',fontSize:"14px",backgroundColor:"#000",color:"#fff",p:"10px 12px",borderRadius:"3px",lineHeight:1.5,mb:"10px",whiteSpace:"pre-wrap"},"& code a":{color:"skyblue"},"& strong, & b":{fontWeight:700}}}),H?xc(xl,{sx:{display:"flex",gap:1,mt:1},children:[ro(bd,{variant:"outlined",color:"inherit",startIcon:ro(Ew,{sx:{fontSize:18}}),onClick:C,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:M?n("section.copied"):n("common.copy")}),a?null:ro(bd,{variant:"outlined",color:"inherit",startIcon:ro(Ix,{sx:{fontSize:18}}),onClick:()=>b(!0),sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:n("common.edit")}),i?ro(bd,{variant:"outlined",color:"inherit",startIcon:ro(wx,{sx:{fontSize:18}}),onClick:i,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:n("section.translate")}):null]}):xc(xl,{sx:{position:"absolute",top:6,right:6,display:"flex",flexDirection:"column",gap:.25},children:[a?null:ro(kd,{title:n("section.editContent"),arrow:!0,placement:"left",children:ro(hd,{size:"small","aria-label":n("section.editContent"),onClick:()=>b(!0),sx:{color:"#9a9a97"},children:ro(Ix,{sx:{fontSize:17}})})}),i?ro(kd,{title:n("section.translate"),arrow:!0,placement:"left",children:ro(hd,{size:"small","aria-label":n("section.translate"),onClick:i,sx:{color:"#9a9a97"},children:ro(wx,{sx:{fontSize:17}})})}):null]})]}):xc(xl,{onDragOver:B=>B.stopPropagation(),onDrop:B=>B.stopPropagation(),onMouseDownCapture:B=>{S(B)&&w(B.target)&&B.preventDefault()},onClickCapture:B=>{let P=S(B)?w(B.target):null;P&&(B.preventDefault(),B.stopPropagation(),p(P.href))},sx:{mt:1,"& .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":{top:"12px",left:"12px"},..._?{"& .ehfuse-editor-content a[href]":{cursor:"pointer"}}:{},position:"relative"},children:[r&&!x?ro(kd,{title:n("section.finishEditingTooltip"),arrow:!0,children:ro(hd,{size:"small","aria-label":n("section.finishEditing"),onMouseDown:B=>B.preventDefault(),onClick:()=>b(!1),sx:{position:"absolute",top:4,right:6,zIndex:2,color:"#2f9e5b"},children:ro(Dw,{sx:{fontSize:19}})})}):null,ro(Rw,{ref:v,defaultValue:Td(t),autoHeight:!0,showToolbar:!_,focusBorder:!0,styles:{focusBorderColor:"var(--primary)"},toolbarOptions:Mw,plugins:[T.current],locale:pa(),minHeight:l,placeholder:n("section.contentPlaceholder"),onImageUpload:u,contentStyle:{padding:"12px"},onChange:B=>{let P=Date.now()<k.current,j=B===N.current;N.current=B,!(P||j)&&o(B)}})]})}import{Fragment as $w,jsx as Do,jsxs as kc}from"react/jsx-runtime";function Sd(e){return String(e??"").replace(/<[^>]*>/g,"").replace(/ /g," ").trim().length>0}function Tc({content:e,templates:t,onApply:o,onSave:a,onRemove:r,readOnly:i=!1}){O();let[l,s]=yd(null),[c,u]=yd(!1),[m,d]=yd(""),p=async g=>{s(null),!(Sd(e)&&!await zw({title:n("section.loadTemplate"),message:n("section.loadTemplateConfirm",{name:g.name})}))&&o(g.content)},f=()=>{s(null);let g=Da(e);g&&navigator.clipboard.writeText(g).then(()=>Fw(n("section.contentCopied"))).catch(()=>Nw(n("section.contentCopyFailed")))};return kc($w,{children:[Do(Aw,{title:n("section.contentMenu"),arrow:!0,disableInteractive:!0,children:Do(Rx,{size:"small","aria-label":n("section.contentMenu"),onClick:g=>s(g.currentTarget),sx:{ml:"auto",color:"#9a9a97"},children:Do(qw,{sx:{fontSize:18}})})}),kc(Lw,{anchorEl:l,open:!!l,onClose:()=>s(null),transitionDuration:0,children:[Do(hc,{disabled:!Sd(e),onClick:f,sx:{fontSize:14,minWidth:220},children:n("menu.copyContent")}),i?null:Do(Ex,{sx:{my:.5}}),!i&&a?Do(hc,{disabled:!Sd(e),onClick:()=>{s(null),d(""),u(!0)},sx:{fontSize:14,minWidth:220},children:n("section.saveAsTemplate")}):null,!i&&a?Do(Ex,{sx:{my:.5}}):null,i?null:t.length===0?Do(hc,{disabled:!0,sx:{fontSize:14,minWidth:220},children:n("section.noSavedTemplates")}):t.map(g=>kc(hc,{onClick:()=>{p(g)},sx:{fontSize:14,minWidth:220,gap:1},children:[Do(Cd,{sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.name}),r?Do(Rx,{size:"small","aria-label":n("section.deleteTemplateAria",{name:g.name}),onClick:x=>{x.stopPropagation(),r(g.seq)},sx:{color:"#9a9a97"},children:Do(Xt,{sx:{fontSize:16}})}):null]},g.seq))]}),Do(Hw,{open:c,onClose:()=>u(!1),maxWidth:"xs",title:n("section.saveTemplateTitle"),locale:ye(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},tabs:{visible:!1},actions:{showCancelButton:!0,right:Do(Ow,{variant:"contained",disabled:!m.trim(),onClick:()=>{a?.(m.trim(),e),u(!1)},children:n("common.save")})},sections:[{id:"template-name",title:"",showTitle:!1,children:kc(Cd,{sx:{display:"flex",flexDirection:"column",gap:1},children:[Do(Cd,{sx:{fontSize:15,color:"#37352f"},children:n("section.saveTemplateHint")}),Do(Ww,{size:"medium",fullWidth:!0,autoFocus:!0,placeholder:n("section.templateNamePlaceholder"),value:m,onChange:g=>d(g.target.value)})]})}]})]})}import{useState as hl}from"react";import{Box as Ht,Button as Ox,Dialog as nD,IconButton as di,Switch as rD,TextField as aD,Tooltip as vd}from"@mui/material";import{DndContext as iD,PointerSensor as lD,closestCenter as sD,useSensor as cD,useSensors as mD}from"@dnd-kit/core";import{restrictToParentElement as uD,restrictToVerticalAxis as dD}from"@dnd-kit/modifiers";import{SortableContext as pD,arrayMove as fD,useSortable as gD,verticalListSortingStrategy as xD}from"@dnd-kit/sortable";import{CSS as bD}from"@dnd-kit/utilities";import Lx from"@mui/icons-material/Close";import hD from"@mui/icons-material/AddCircle";import Ax from"@mui/icons-material/AddTask";import kD from"@mui/icons-material/Checklist";import TD from"@mui/icons-material/CheckCircle";import yD from"@mui/icons-material/DragIndicator";import CD from"@mui/icons-material/Launch";import SD from"@mui/icons-material/LinkOutlined";import vD from"@mui/icons-material/RadioButtonUnchecked";import{useMemo as jw}from"react";import{Box as jn,Button as Yw,Tab as Xw,Tabs as Qw}from"@mui/material";import{FormDialog as Jw}from"@ehfuse/mui-form-dialog";import{ClearTextField as Zw}from"@ehfuse/mui-form-controls";import eD from"@mui/icons-material/CheckCircle";import tD from"@mui/icons-material/RadioButtonUnchecked";import{OverlayScrollbar as oD}from"@ehfuse/overlay-scrollbar";import{useRef as Vw}from"react";import{useGlobalForm as Uw,useModal as Kw}from"@ehfuse/forma";import{ErrorAlert as Gw}from"@ehfuse/alerts";var Px={type:"related",search:"",selectedSeqs:[]};function bl(e){O();let t=Vw(e);t.current=e;let o={link:Kw({modalId:ve("taskbox-task-link")})},a=Uw({formId:ve("taskbox-task-link-form"),initialValues:Px,onValidate:l=>l.selectedSeqs.length===0?(Gw(n("link.selectTask")),!1):!0,onSubmit:l=>{for(let s of l.selectedSeqs)t.current.onSubmit(s,l.type);return o.link.close(),!0}});return{form:a,modals:o,openDialog:()=>{a.setFormValues({...Px,selectedSeqs:[]}),o.link.open()},toggleSelected:l=>{let s=a.getFormValue("selectedSeqs")??[];if(s.includes(l)){a.setFormValue("selectedSeqs",s.filter(c=>c!==l));return}a.setFormValue("selectedSeqs",t.current.multiSelect?[...s,l]:[l])}}}import{jsx as xo,jsxs as yc}from"react/jsx-runtime";var Mx=[{type:"related",get label(){return n("link.related")},get hint(){return n("link.relatedHint")}},{type:"follow_up",get label(){return n("link.previous")},get hint(){return n("link.previousHint")}},{type:"duplicate_of",get label(){return n("link.duplicate")},get hint(){return n("link.duplicateHint")}}];function Cc({controller:e,task:t,tasks:o,excludeSeqs:a=[],hideRelationType:r=!1,title:i=n("link.title"),confirmLabel:l=n("link.confirm")}){O();let s=$e(),{form:c}=e,u=e.modals.link,m=c.useValue("type")??"related",d=String(c.useValue("search")??""),p=c.useValue("selectedSeqs")??[],f=jw(()=>{let h=new Set([t.seq,...a]),D=d.trim().toLowerCase();return o.filter(b=>h.has(b.seq)||b.is_event||b.is_notice||b.linked_only?!1:D?b.title.toLowerCase().includes(D)||(b.ticket_no??"").toLowerCase().includes(D):!0).sort((b,v)=>!!b.completed!=!!v.completed?b.completed?1:-1:v.seq-b.seq)},[o,t.seq,a,d]),g=Mx.find(h=>h.type===m)?.hint??"",x=yc(jn,{sx:{display:"flex",flexDirection:"column",minHeight:0,height:s?"100%":"auto"},children:[r?null:xo(Qw,{value:m,onChange:(h,D)=>c.setFormValue("type",D),sx:{minHeight:38,flexShrink:0,borderBottom:"1px solid #ededeb","& .MuiTab-root":{minHeight:38,py:.5,fontSize:16,color:"#333333"}},children:Mx.map(h=>xo(Xw,{value:h.type,label:h.label},h.type))}),r?null:xo(jn,{sx:{mt:1,mb:1.5,fontSize:14,flexShrink:0},children:g}),yc(jn,{sx:{...s?{height:"100%",minHeight:0}:{height:560},display:"flex",flexDirection:"column",...s?{}:{border:"1px solid #cccccc",borderRadius:1},overflow:"hidden",userSelect:"none"},children:[xo(jn,{sx:{px:1.5,py:1,borderBottom:"1px solid #cccccc",flexShrink:0},children:xo(Zw,{placeholder:n("link.searchPlaceholder"),name:"search",form:c,fullWidth:!0,autoFocus:!0,size:"small",sx:{"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiInputBase-root":{px:0}}})}),xo(jn,{sx:{flex:1,minHeight:0},children:xo(oD,{style:{height:"100%"},contentStyle:{paddingTop:0},children:xo(jn,{sx:{display:"flex",flexDirection:"column"},children:f.length===0?xo(jn,{sx:{py:4,textAlign:"center",fontSize:13.5,color:"#9a9a97"},children:n("link.empty")}):f.map(h=>{let D=h.is_notice||h.is_event?Oe(h.icon||(h.is_notice?_t:zt)):null,b=p.includes(h.seq);return yc(jn,{onClick:()=>e.toggleSelected(h.seq),sx:{display:"flex",alignItems:"center",gap:.75,px:1.5,py:1.25,flexShrink:0,cursor:"pointer",borderBottom:"1px solid #ededeb","&:last-of-type":{borderBottom:"none"},bgcolor:b?"#e3eefb":"transparent","&:hover":{bgcolor:b?"#e3eefb":"#f7f7f5"}},children:[b?xo(eD,{sx:{fontSize:20,flexShrink:0,color:"#2f6fd0"}}):xo(tD,{sx:{fontSize:20,flexShrink:0,color:"#c9c8c5"}}),D?xo(D,{sx:{fontSize:17,flexShrink:0,color:h.icon_color||"#1e3a8a"}}):null,yc(jn,{component:"span",sx:{flex:1,minWidth:0,fontSize:15,color:"#37352f",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,overflow:"hidden",lineHeight:1.5,wordBreak:"break-word"},children:[h.ticket_no?`${h.ticket_no} `:"",h.title]}),xo(jn,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:xo(Ke,{option:Nt(h)})})]},h.seq)})})})})]})]});return xo(Jw,{open:u.isOpen,onClose:u.close,maxWidth:"sm",fullScreen:s,mobilePresentation:s?"slide":"dialog",...s?{contentPaddingX:0,contentTopPadding:0,sectionsPaddingTop:0}:{},sx:s?{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:i,locale:ye(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-link",sections:[{id:"task-link",showTitle:!1,children:x}],scrollPastLastSection:!1,sectionContentPaddingTop:0,contentTopPadding:12,actions:{showCancelButton:!0,right:xo(Yw,{variant:"contained",disabled:p.length===0,onClick:()=>{c.submit()},children:l})}})}import{ConfirmActionPopper as BD}from"@ehfuse/mui-confirm-action";import{Fragment as wD,jsx as Se,jsxs as Yn}from"react/jsx-runtime";var qx="taskbox.checklist.hideCompleted";function _D({id:e,children:t}){let{attributes:o,listeners:a,setNodeRef:r,transform:i,transition:l,isDragging:s}=gD({id:e});return Se(Ht,{ref:r,sx:{transform:bD.Transform.toString(i),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({handleProps:{...o,...a},dragging:s})})}function ID({sortable:e,sensors:t,rowIds:o,onDragEnd:a,compact:r,children:i}){let l=Se(Ht,{sx:{display:"flex",flexDirection:"column",mt:.5,pl:r?0:3.25},children:i});return e?Se(iD,{sensors:t,collisionDetection:sD,modifiers:[dD,uD],onDragEnd:a,children:Se(pD,{items:o,strategy:xD,children:l})}):l}function Sc({taskSeq:e,checklist:t,onAdd:o,onToggle:a,confirmOnToggle:r=!1,onRemove:i,onUpdate:l,onReorder:s,removeLocked:c=!1,onConvertToTask:u,onOpenLinkedTask:m,linkCandidates:d,linkBaseTask:p,onLinkExistingTask:f,resolveLinkedTask:g,myAccountSeq:x=0}){O();let[h,D]=hl(""),b=bl({multiSelect:!0,onSubmit:U=>{if(!f)return;let te=d?.find($=>$.seq===U);f(e,U,String(te?.title??"").trim())}}),[v,T]=hl(null),N=$e(),[k,_]=hl(null),[R,H]=hl(null),M=U=>{let te=U.task_seq?g?.(U.task_seq):void 0;return te?te.completed:U.checked},y=U=>{if(!U.task_seq||x<=0)return!1;let te=g?.(U.task_seq);return te?!Vf(te,x):!1},C=U=>!!U.task_seq&&!!g&&!g?.(U.task_seq),w=t.filter(U=>!C(U)),S=w.filter(M).length,[A,E]=hl(()=>{try{return localStorage.getItem(qx)==="1"}catch{return!1}}),q=U=>{E(U);try{localStorage.setItem(qx,U?"1":"0")}catch{}},B=!!s&&!N&&!c,P=mD(cD(lD,{activationConstraint:{distance:5}})),j=(U,te)=>U.task_seq?`linked-${U.task_seq}`:`row-${te}`,V=t.map(j),ee=V.filter((U,te)=>{let $=t[te];return C($)?!1:!(A&&M($))}),re=U=>{let{active:te,over:$}=U;if(!$||te.id===$.id)return;let K=V.indexOf(String(te.id)),fe=V.indexOf(String($.id));K<0||fe<0||s?.(e,fD(t,K,fe))},le=()=>{h.trim()&&(o(e,h),D(""))};return Yn(zo,{icon:Se(kD,{sx:{fontSize:19,display:"block"}}),title:Yn(wD,{children:[n("section.todo"),t.length>0?Yn(Ht,{component:"span",sx:{fontSize:12.5,color:"#9a9a97"},children:[S," / ",t.length]}):null]}),titleExtra:w.length>0?Yn(Ht,{sx:{flex:1,minWidth:0,ml:1,display:"flex",alignItems:"center",gap:1},children:[Se(Ht,{sx:{flex:1,minWidth:0,height:6,borderRadius:3,bgcolor:"#ececea"},children:Se(Ht,{sx:{height:"100%",borderRadius:3,width:`${Math.round(S/w.length*100)}%`,bgcolor:"#2f80ed",transition:"width 0.2s"}})}),S>0?Yn(Ht,{component:"label",sx:{display:"inline-flex",alignItems:"center",gap:.25,flexShrink:0,cursor:"pointer",fontSize:13.5,fontWeight:400,color:"#57564f",userSelect:"none"},children:[Se(rD,{size:"small",checked:A,onChange:(U,te)=>q(te)}),n("section.hideDone")]}):null]}):null,children:[Se(ID,{sortable:B,sensors:P,rowIds:ee,onDragEnd:re,compact:N,children:t.map((U,te)=>{let $=U.task_seq?g?.(U.task_seq):void 0,K=M(U);if(A&&K||C(U))return null;let fe=!!U.task_seq,Ee=y(U),nt=se=>Yn(Ht,{sx:{display:"flex",alignItems:N?"flex-start":"center",gap:1,px:1.25,...B?{ml:-3,pl:.5}:{},py:.5,borderRadius:1,"&:hover":{bgcolor:"#f7f7f5"},"&:hover .taskbox-checklist-remove":{opacity:1},"&:hover .taskbox-checklist-convert":{opacity:1},"&:hover .taskbox-checklist-handle":{opacity:1}},children:[se?Se(Ht,{className:"taskbox-checklist-handle",...se,sx:{display:"inline-flex",flexShrink:0,alignItems:"center",color:"#c9c8c5",opacity:0,transition:"opacity 0.15s",cursor:"grab","&:active":{cursor:"grabbing"},touchAction:"none",userSelect:"none"},children:Se(yD,{sx:{fontSize:16}})}):null,Se(vd,{title:Ee?n("section.toggleLocked"):"",arrow:!0,disableInteractive:!0,children:Se(Ht,{component:"span",onClick:Ee?void 0:J=>r?H({anchorEl:J.currentTarget,index:te,checked:!K}):a(e,te,!K),sx:{display:"inline-flex",flexShrink:0,cursor:Ee?"default":"pointer",...N?{mt:"1px"}:{}},children:K?Se(TD,{sx:{fontSize:18,color:Ee?"#a9c6ec":"#2f80ed"}}):Se(vD,{sx:{fontSize:18,color:Ee?"#d6d5d1":"#9a9a97"}})})}),v?.index===te?Se(Ht,{component:"input",autoFocus:!0,spellCheck:!1,value:v.label,enterKeyHint:"done",onChange:J=>T({index:te,label:J.target.value}),onBlur:()=>{v.label.trim()&&v.label.trim()!==U.label&&l?.(e,te,v.label),T(null)},onKeyDown:J=>{J.key==="Enter"&&J.target.blur(),J.key==="Escape"&&T(null)},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",p:0}}):Se(Ht,{component:"span",onClick:fe?U.task_seq&&m?()=>m(U.task_seq):void 0:c||!l?void 0:N?()=>_({index:te,label:U.label}):()=>T({index:te,label:U.label}),sx:{flex:1,minWidth:0,fontSize:14.5,color:"#37352f",textDecoration:K?"line-through":"none",overflow:"hidden",textOverflow:"ellipsis",...N?{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,lineHeight:1.4,wordBreak:"break-word"}:{whiteSpace:"nowrap"},...fe?m?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}:c||!l?{}:{cursor:"text"}},children:U.label}),fe?Yn(Ht,{component:"span",onClick:U.task_seq&&m?()=>m(U.task_seq):void 0,sx:{display:"inline-flex",alignItems:"center",gap:.4,flexShrink:0,...N?{mt:"1px"}:{},px:.75,py:.2,borderRadius:1,fontSize:12,fontWeight:500,color:"#1d4f91",bgcolor:"#e3eefb",whiteSpace:"nowrap",...m?{cursor:"pointer"}:{}},children:[Se(CD,{sx:{fontSize:12}}),$?.manager_name?.trim()||n("template.task")]}):null,!c&&!fe&&u?Se(vd,{title:n("section.makeTask"),arrow:!0,enterDelay:300,disableInteractive:!0,children:Se(di,{className:"taskbox-checklist-convert",size:"small","aria-label":n("section.makeTask"),onClick:()=>u(e,te,U.label),sx:{display:N?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:Se(Ax,{sx:{fontSize:16}})})}):null,c?null:Se(di,{className:"taskbox-checklist-remove",size:"small","aria-label":n("section.deleteTodo"),onClick:()=>i(e,te),sx:{display:N?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:Se(Lx,{sx:{fontSize:15}})})]});return B?Se(_D,{id:V[te],children:({handleProps:se})=>nt(se)},V[te]):Se(Ht,{children:nt(null)},V[te])})}),Yn(Ht,{sx:{mt:.5,ml:N?0:3.25,display:"flex",alignItems:"center",gap:.5},children:[Se(Ht,{component:"input",spellCheck:!1,value:h,placeholder:n("section.addTodoPlaceholder"),enterKeyHint:"done",onChange:U=>D(U.target.value),onKeyDown:U=>{U.key==="Enter"&&le()},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",px:1.25,py:.75,"&::placeholder":{color:"#9a9a97"}}}),d&&p&&f?Se(vd,{title:n("section.attachExisting"),arrow:!0,children:Se(di,{size:"small","aria-label":n("section.attachExisting"),onMouseDown:U=>U.preventDefault(),onClick:b.openDialog,sx:{flexShrink:0,color:"#9a9a97"},children:Se(SD,{sx:{fontSize:20}})})}):null,Se(di,{size:"small","aria-label":n("section.addTodo"),disabled:!h.trim(),onMouseDown:U=>U.preventDefault(),onClick:le,sx:{flexShrink:0,color:h.trim()?"#2f80ed":"#c9c8c5"},children:Se(hD,{sx:{fontSize:20}})})]}),d&&p&&f?Se(Cc,{controller:b,task:p,tasks:d,excludeSeqs:t.map(U=>Number(U.task_seq??0)).filter(U=>U>0),hideRelationType:!0,title:n("section.attachExisting"),confirmLabel:n("section.attach")}):null,Se(BD,{open:!!R,anchorEl:R?.anchorEl??null,title:R?.checked?n("calendar.checklistCompleteConfirm"):n("task.uncompleteConfirm"),confirmText:R?.checked?n("common.done"):n("task.unmark"),onCancel:()=>H(null),onConfirm:()=>{R&&a(e,R.index,R.checked),H(null)}}),Se(nD,{open:!!k,onClose:()=>_(null),maxWidth:"xs",fullWidth:!0,slotProps:{paper:{sx:{borderRadius:2,m:2}}},children:Yn(Ht,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5},children:[Se(Ht,{sx:{fontSize:15.5,fontWeight:600,color:"#37352f"},children:n("section.editTodo")}),Se(aD,{autoFocus:!0,fullWidth:!0,size:"medium",value:k?.label??"",onChange:U=>_(te=>te&&{...te,label:U.target.value}),onKeyDown:U=>{if(U.key!=="Enter")return;let te=k;te&&te.label.trim()&&l?.(e,te.index,te.label.trim()),_(null)}}),Yn(Ht,{sx:{display:"flex",alignItems:"center",gap:1},children:[!c&&u&&k&&!t[k.index]?.task_seq?Se(di,{"aria-label":n("section.makeTask"),onClick:()=>{u(e,k.index,t[k.index]?.label??""),_(null)},sx:{color:"#57564f"},children:Se(Ax,{sx:{fontSize:20}})}):null,!c&&k?Se(di,{"aria-label":n("section.deleteTodo"),onClick:()=>{i(e,k.index),_(null)},sx:{color:"#e5484d"},children:Se(Lx,{sx:{fontSize:19}})}):null,Se(Ht,{sx:{flex:1}}),Se(Ox,{color:"inherit",onClick:()=>_(null),children:n("common.cancel")}),Se(Ox,{variant:"contained",disabled:!k?.label.trim(),onClick:()=>{k&&k.label.trim()&&l?.(e,k.index,k.label.trim()),_(null)},children:n("common.confirm")})]})]})})]})}import{useRef as OD,useState as LD}from"react";import{Box as mn,IconButton as AD}from"@mui/material";import{DndContext as qD,PointerSensor as zD,closestCenter as ND,useSensor as FD,useSensors as HD}from"@dnd-kit/core";import{restrictToParentElement as WD,restrictToVerticalAxis as $D}from"@dnd-kit/modifiers";import{SortableContext as VD,useSortable as UD,verticalListSortingStrategy as KD}from"@dnd-kit/sortable";import{CSS as GD}from"@dnd-kit/utilities";import jD from"@mui/icons-material/DragIndicator";import YD from"@mui/icons-material/Close";import Fx from"@mui/icons-material/AttachFileOutlined";var DD=new Set(["jpg","jpeg","png","gif","bmp","webp","svg","pdf","txt","json","xml","log","md","markdown","csv","xls","xlsx","html","htm","js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf","mp4","avi","mov","wmv","flv","webm","mp3","wav","ogg","m4a","aac"]),vc=e=>{let t=e?.split(".").pop()?.toLowerCase()??"";return DD.has(t)};import{LinearProgress as ED}from"@mui/material";import{Fragment as RD,jsx as MD,jsxs as PD}from"react/jsx-runtime";function zx(e){let t=hn(),o=t.useValue("attachmentUpload.taskSeq"),a=t.useValue("attachmentUpload.index"),r=t.useValue("attachmentUpload.total"),i=t.useValue("attachmentUpload.queue"),l=a??0;return!l||e>0&&(o??0)!==e?null:{index:l,total:r??0,queue:i??[]}}function Bd(){let t=hn().useValue("attachmentUpload.progress");return PD(RD,{children:[t??0,"%"]})}function Nx(){let t=hn().useValue("attachmentUpload.progress");return MD(ED,{variant:"determinate",value:t??0,sx:{height:4,borderRadius:2,bgcolor:"#dbe9fb",mt:.75}})}import{Fragment as Hx,jsx as wt,jsxs as Tl}from"react/jsx-runtime";function XD({id:e,children:t}){let{attributes:o,listeners:a,setNodeRef:r,transform:i,transition:l,isDragging:s}=UD({id:e});return wt(mn,{ref:r,sx:{transform:GD.Transform.toString(i),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({...o,...a})})}function kl(e){return e>=1048576?`${(e/1048576).toFixed(1)}MB`:`${Math.max(1,Math.round(e/1024))}KB`}var Bc={flex:1,minWidth:0,fontSize:13.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function _c({taskSeq:e,attachments:t,onAdd:o,onRemove:a,removeLocked:r=!1,onPreview:i,onDownload:l,onReorder:s}){O();let[c,u]=LD(!1),m=OD(null),d=$e(),p=$i(),f=Wi(),g=zx(e),x=e===0,h=!!s&&!x&&!d&&!r&&!g&&t.length>1,D=HD(FD(zD,{activationConstraint:{distance:5}})),b=(M,y)=>M.uuid?`file-${M.uuid}`:`file-${y}`,v=t.map(b),T=M=>{let{active:y,over:C}=M;if(!C||y.id===C.id)return;let w=v.indexOf(String(y.id)),S=v.indexOf(String(C.id));w<0||S<0||s?.(e,w,S)},N=M=>{if(i){i(M);return}window.open(f(M.uuid??""),"_blank","noopener,noreferrer")},k=M=>{if(l){l(M);return}window.open(f(M.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},_=M=>g?M+1<g.index?"done":M+1===g.index?"uploading":"waiting":"waiting",R=(M,y,C,w={})=>Tl(mn,{sx:{px:1,py:.5,borderRadius:1,border:"1px solid",borderColor:w.uploading?"#d5e6fb":"#e6e6e3",bgcolor:w.uploading?"#f4f9ff":"transparent","&:hover .taskbox-file-remove":{opacity:1},"&:hover .taskbox-file-handle":{opacity:1}},children:[Tl(mn,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[w.handleProps?wt(mn,{className:"taskbox-file-handle","aria-label":n("section.reorder"),...w.handleProps,sx:{display:"inline-flex",flexShrink:0,alignItems:"center",ml:-.5,mr:-.5,color:"#c9c8c5",opacity:0,transition:"opacity 0.15s",cursor:"grab","&:active":{cursor:"grabbing"},touchAction:"none",userSelect:"none"},children:wt(jD,{sx:{fontSize:16}})}):null,wt(Fx,{sx:{fontSize:16,color:"#9a9a97"}}),y,wt(mn,{component:"span",sx:{fontSize:12,color:w.uploading?"#2f80ed":"#9a9a97",flexShrink:0},children:C}),w.removeIndex!==void 0?wt(AD,{className:"taskbox-file-remove",size:"small","aria-label":n("section.deleteAttachment"),onClick:()=>a(e,w.removeIndex),sx:{opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:wt(YD,{sx:{fontSize:15}})}):null]}),w.uploading?wt(Nx,{}):null]},M),H=M=>{let y=vc(M.name);return wt(mn,{component:"button",type:"button",onClick:()=>y?N(M):k(M),title:n("section.fileAction",{name:M.name,value:y?n("section.preview"):n("section.download")}),sx:{...Bc,color:"#37352f",textAlign:"left",p:0,border:"none",background:"none",font:"inherit",fontSize:13.5,cursor:"pointer",outline:"none","&:focus-visible":{textDecoration:"underline",color:"#2f80ed"},"&:hover":{textDecoration:"underline",color:"#2f80ed"}},children:M.name})};return Tl(zo,{icon:wt(Fx,{sx:{fontSize:18,display:"block"}}),title:Tl(Hx,{children:[n("section.files")," ",t.length>0?t.length:""]}),children:[wt(QD,{sortable:h,sensors:D,rowIds:v,onDragEnd:T,children:Tl(mn,{sx:{display:"flex",flexDirection:"column",gap:.5,mt:1},children:[t.map((M,y)=>{let C=`${M.uuid||M.name}-${y}`;if(x){let w=_(y),S=w==="uploading";return R(C,wt(mn,{component:"span",sx:{...Bc,color:w==="done"?"#37352f":"#9a9a97"},children:M.name}),S?wt(Bd,{}):kl(M.size),{uploading:S,removeIndex:!r&&!g?y:void 0})}return M.uuid?h?wt(XD,{id:b(M,y),children:w=>R(C,H(M),kl(M.size),{removeIndex:r?void 0:y,handleProps:w})},b(M,y)):R(C,H(M),kl(M.size),{removeIndex:r?void 0:y}):R(C,wt(mn,{component:"span",title:n("section.legacyAttachment"),sx:{...Bc,color:"#9a9a97"},children:M.name}),kl(M.size),{removeIndex:r?void 0:y})}),!x&&g?g.queue.slice(g.index-1).map((M,y)=>{let C=y===0;return R(`uploading-${g.index+y}-${M.name}`,wt(mn,{component:"span",sx:{...Bc,color:"#9a9a97"},children:M.name}),C?wt(Bd,{}):kl(M.size),{uploading:C})}):null]})}),wt(mn,{onClick:()=>m.current?.click(),onDragOver:M=>{M.preventDefault(),u(!0)},onDragLeave:()=>u(!1),onDrop:M=>{M.preventDefault(),u(!1);let y=Array.from(M.dataTransfer.files);y.length>0&&o(e,y)},sx:{mt:1,py:2.5,display:"flex",alignItems:"center",justifyContent:"center",gap:.5,border:"1.5px dashed",borderColor:c?"#2f80ed":"#cfcfcc",borderRadius:1,bgcolor:c?"#eef6ff":"transparent",color:"#787774",fontSize:13.5,cursor:"pointer",transition:"background-color 0.15s, border-color 0.15s","&:hover":{bgcolor:"#fafaf9",borderColor:"#9a9a97"}},children:d?n("section.attachHint",{uploadMaxMb:p}):n("section.attachHintDrag",{uploadMaxMb:p})}),wt(mn,{component:"input",ref:m,type:"file",multiple:!0,onChange:M=>{let y=Array.from(M.target.files??[]);y.length>0&&o(e,y),M.target.value=""},sx:{display:"none"}})]})}function QD({sortable:e,sensors:t,rowIds:o,onDragEnd:a,children:r}){return e?wt(qD,{sensors:t,collisionDetection:ND,modifiers:[$D,WD],onDragEnd:a,children:wt(VD,{items:o,strategy:KD,children:r})}):wt(Hx,{children:r})}import{useState as rE}from"react";import{Checkbox as aE,Divider as iE,ListItemIcon as lE,Menu as sE,MenuItem as Ux}from"@mui/material";import cE from"@mui/icons-material/Add";import{Box as _d,Button as eE}from"@mui/material";import{FormDialog as tE}from"@ehfuse/mui-form-dialog";import{ClearTextField as oE}from"@ehfuse/mui-form-controls";import{ColorPicker as nE}from"@ehfuse/mui-color-picker";import{useGlobalForm as JD}from"@ehfuse/forma";import{ErrorAlert as ZD}from"@ehfuse/alerts";var Wx="#2f80ed";function $x({open:e,onClose:t,onSubmit:o}){O();let a=JD({formId:ve("taskbox-add-label-form"),initialValues:{name:"",color:Wx},onValidate:i=>String(i.name??"").trim()?!0:(ZD(n("dialog.enterLabelName")),!1),onSubmit:i=>(o(String(i.name).trim(),i.color),r.form.close(),!0)}),r={form:to({modalIdPrefix:"taskbox-add-label-dialog",open:e,onClose:t,onOpen:()=>a.setFormValues({name:"",color:Wx})})};return{form:a,modals:r}}import{jsx as yl,jsxs as Id}from"react/jsx-runtime";function Vx({open:e,onClose:t,onSubmit:o}){O();let{form:a,modals:r}=$x({open:e,onClose:t,onSubmit:o}),i=String(a.useFormValue("name")??""),l=String(a.useFormValue("color")??""),s=Sf(l),c=Id(_d,{children:[Id(_d,{sx:{display:"flex",alignItems:"center",gap:1.5,mt:.5},children:[yl(oE,{form:a,name:"name",label:n("dialog.labelName"),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),a.submit())},fullWidth:!0,autoFocus:!0}),yl(nE,{value:l,onChange:u=>a.setFormValue("color",u),shape:"circle",colorSize:28})]}),Id(_d,{sx:{mt:2,display:"flex",alignItems:"center",gap:1,fontSize:13,color:"#787774"},children:[n("dialog.preview"),yl(Ke,{option:{key:"__preview__",name:i.trim()||n("dialog.label"),...s}})]})]});return yl(tE,{open:r.form.isOpen,onClose:r.form.close,maxWidth:"xs",title:n("dialog.addLabelTitle"),locale:ye(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-add-label",sections:[{id:"add-label",showTitle:!1,children:c}],actions:{showCancelButton:!0,right:yl(eE,{variant:"contained",onClick:()=>{a.submit()},children:n("common.add")})}})}import{Fragment as mE,jsx as pi,jsxs as Ic}from"react/jsx-runtime";function wc({anchorEl:e,selectedKeys:t,labelOptions:o,onToggle:a,onAddLabel:r,onClose:i}){O();let[l,s]=rE(!1),c=zn();return Ic(mE,{children:[Ic(sE,{anchorEl:e,open:!!e,onClose:i,transitionDuration:0,...c,children:[o.map(u=>{let m=t.includes(u.key);return Ic(Ux,{onClick:()=>a(u.key),sx:{fontSize:14,minWidth:170,gap:1},children:[pi(aE,{size:"small",checked:m,sx:{p:0}}),pi(Ke,{option:u})]},u.key)}),pi(iE,{}),Ic(Ux,{onClick:()=>s(!0),sx:{fontSize:14,color:"#787774"},children:[pi(lE,{children:pi(cE,{sx:{fontSize:18,color:"#787774"}})}),n("menu.addLabel")]})]}),pi(Vx,{open:l,onClose:()=>s(!1),onSubmit:r})]})}function Kx(e,t){let o=Number(e.author_account_seq??0);return t.filter(a=>{let r=Number(a.account_seq??0);return r>0&&r!==o})}function Gx(e,t){let o=(e.target_account_seqs??[]).filter(d=>d>0);if(o.length===0)return null;let a=new Set(o),r=Kx(e,t),i=new Map;for(let d of r){let p=String(d.department??"").trim();if(!p)continue;let f=i.get(p)??[];f.push(d),i.set(p,f)}let l=[],s=new Set;for(let[d,p]of i)if(p.every(g=>a.has(Number(g.account_seq??0)))){l.push(d);for(let g of p)s.add(Number(g.account_seq??0))}let c=new Map(r.map(d=>[Number(d.account_seq??0),d.name])),u=e.target_names??[],m=[];return o.forEach((d,p)=>{s.has(d)||m.push(c.get(d)??u[p]??n("dialog.noName"))}),{teamNames:l,individualNames:m}}function Dc(e,t){let o=Gx(e,t);return o?[...o.teamNames,...o.individualNames].join(", "):n("col.allEmployees")}function OK(e,t){let o=Gx(e,t);return o?{kind:"members",teamNames:o.teamNames,individualNames:o.individualNames}:{kind:"everyone"}}function jx(e,t,o){let a=(e.target_account_seqs??[]).filter(f=>f>0),r=Kx(e,t),i=a.length>0?a.length:r.length,l=e.acks??[],s=o>0&&l.some(f=>f.account_seq===o),c=o>0&&Number(e.author_account_seq??0)===o,u=a.length===0||a.includes(o),m=new Set(l.map(f=>f.account_seq)),p=(a.length>0?r.filter(f=>a.includes(Number(f.account_seq??0))):r).filter(f=>!m.has(Number(f.account_seq??0))).map(f=>String(f.name??"").trim()).filter(f=>f.length>0);return{count:l.length,total:i,acked:s,pendingNames:p,canAck:o>0&&!c&&u&&!s&&!e.completed}}import{DatePicker as EE}from"@ehfuse/mui-datetime-picker";import{useState as uE}from"react";import{Box as Ea,IconButton as dE,Popover as pE}from"@mui/material";import fE from"@mui/icons-material/InfoOutlined";import gE from"@mui/icons-material/LockOutlined";import xE from"@mui/icons-material/PublicOutlined";import bE from"@mui/icons-material/Group";import{jsx as Yo,jsxs as Ra}from"react/jsx-runtime";var hE=[{key:"all",icon:Yo(xE,{sx:{fontSize:17,color:"#2f80ed"}}),label:"create.visibilityPublic",who:"create.visibilityInfoAll"},{key:"group",icon:Yo(bE,{sx:{fontSize:17,color:"#d9730d"}}),label:"create.visibilityDeptShort",who:"create.visibilityInfoGroup"},{key:"involved",icon:Yo(gE,{sx:{fontSize:17}}),label:"create.visibilityPrivate",who:"create.visibilityInfoPrivate"}];function Ec(){let[e,t]=uE(null),{colors:o}=ge(),a=String(va.labelColor??"#787774");return Ra(Ea,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.25},children:[n("create.visibility"),Yo(dE,{size:"small","aria-label":n("create.visibilityInfo"),onClick:r=>{r.stopPropagation(),t(r.currentTarget)},sx:{p:.25,color:a},children:Yo(fE,{sx:{fontSize:16}})}),Ra(pE,{open:!!e,anchorEl:e,onClose:()=>t(null),onClick:r=>r.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},transitionDuration:0,slotProps:{paper:{sx:{width:380,maxWidth:"calc(100vw - 32px)",p:2,borderRadius:2}}},children:[Ra(Ea,{sx:{fontSize:14,lineHeight:1.6,mb:1.5,px:1.5,py:1.25,borderRadius:1.5,bgcolor:o.accentSoft,color:o.textSecondary,wordBreak:"keep-all"},children:[Yo(Ea,{component:"strong",sx:{fontWeight:700,color:o.accentOnSurface},children:n("create.visibilityInfoNoteStrong")})," ",n("create.visibilityInfoNote")]}),Yo(Ea,{sx:{border:`1px solid ${o.border}`,borderRadius:1.5,overflow:"hidden"},children:Ra(Ea,{component:"table",sx:{width:"100%",borderCollapse:"collapse",fontSize:14,"& th, & td":{border:`1px solid ${o.border}`,py:1,px:1.25,textAlign:"left",verticalAlign:"middle"},"& tr > :first-of-type":{borderLeft:"none"},"& tr > :last-child":{borderRight:"none"},"& thead th":{borderTop:"none",bgcolor:o.surfaceSubtle,color:o.textSecondary,fontWeight:600},"& tbody tr:last-child td":{borderBottom:"none"},"& td":{color:o.textPrimary,wordBreak:"keep-all",lineHeight:1.5}},children:[Yo("thead",{children:Ra("tr",{children:[Yo("th",{children:n("create.visibilityInfoColScope")}),Yo("th",{children:n("create.visibilityInfoColWho")})]})}),Yo("tbody",{children:hE.map(r=>Ra("tr",{children:[Yo(Ea,{component:"td",sx:{whiteSpace:"nowrap"},children:Ra(Ea,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[r.icon,n(r.label)]})}),Yo("td",{children:n(r.who)})]},r.key))})]})})]})]})}import{Fragment as Pa,jsx as de,jsxs as In}from"react/jsx-runtime";var Zx="taskbox:create-expanded";function RE(){try{return window.localStorage.getItem(Zx)==="1"}catch{return!1}}function Ed({form:e,statusOptions:t,customTabs:o,sprints:a=[],avatarSrcByName:r,isNotice:i=!1,hideProject:l=!1,hideBug:s=!1,hideTypeToggle:c=!1,leadingRow:u,extraRows:m,hideLabel:d=!1,simple:p=!1,hideMembers:f=!1,templateItem:g=!1,postMode:x=!1,employees:h=[],workspaceName:D="",workspaceSlot:b,myAccountSeq:v=0,departments:T=[],myGroupSeq:N=0,onMemberEdit:k,onAddProject:_,onAddLabelOption:R,contentSyncKey:H="create",contentTemplates:M,contentTitleExtra:y,onSaveContentTemplate:C,onRemoveContentTemplate:w}){O();let S=hn(),A=$i(),E=e.useFormValue("manager_name"),q=e.useFormValue("receiver_names"),B=e.useFormValue("start_date"),P=!!e.useFormValue("is_event"),j=!!e.useFormValue("is_bug"),V=e.useFormValue("bug_repro")??"",ee=e.useFormValue("bug_device")??"",re=e.useFormValue("bug_where")??"",le=e.useFormValue("bug_version")??"",U=e.useFormValue("event_time")??"",te=e.useFormValue("event_place")??"",$=e.useFormValue("event_address")??"",K=e.useFormValue("due_date"),fe=e.useFormValue("reminders")??[],Ee=e.useFormValue("priority"),nt=e.useFormValue("content"),se=e.useFormValue("note")??"",F=e.useFormValue("checklist")??[],Y=e.useFormValue("tab_key"),ae=e.useFormValue("sprint_seq")??0,me=e.useFormValue("story_points")??0,we=o.find(I=>I.key===Y&&I.useSprints),Ce=we?a.filter(I=>`custom-${I.group_seq}`===Y):[],[vt,Ne]=fi(null),Re=e.useFormValue("label_keys"),[Pt,Ve]=fi(null),st=e.useFormValue("visibility")||"involved",io=Number(e.useFormValue("visibility_group_seq")??0),[Z,Be]=fi(null),qe=e.useFormValue("repeat_rule")||"",Ye=e.useFormValue("repeat_until")||"",[er,tr]=fi(null),[Co,Pn]=fi(null),or=e.useFormValue("target_names"),gn=e.useFormValue("target_account_seqs"),Mn=S.useValue("createAttachmentFiles")??[],Vt=i?Dc({author_account_seq:v,target_names:or,target_account_seqs:gn},h):"",[ct,Wo]=fi(RE),xn=p&&!P&&!i&&!x,Mt=xn&&!ct,Oo=()=>{let I=!ct;Wo(I);try{window.localStorage.setItem(Zx,I?"1":"0")}catch{}},lo=!x,Me=f?1:2;return In(Pa,{children:[u,!i&&!c?In(yr,{sx:{display:"flex",gap:1.25,px:2,pt:1.5,pb:1.5,flexShrink:0},children:[b?de(yr,{sx:{alignSelf:"center",mr:"6px",minWidth:0,display:"flex"},children:b}):D?de(yr,{sx:{alignSelf:"center",fontSize:13.5,fontWeight:600,color:"#37352f",mr:"6px",maxWidth:160,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:D,children:D}):null,[{value:"task",label:n("kind.task")},{value:"event",label:n("kind.event")},...s?[]:[{value:"bug",label:n("kind.bug")}]].map(I=>{let ue=(j?"bug":P?"event":"task")===I.value;return de(Yx,{onClick:()=>Vm(e,I.value),sx:{px:1.75,lineHeight:1,pt:"8px",pb:"10px",borderRadius:99,fontSize:13.5,fontWeight:ue?600:400,color:ue?"#ffffff":"#787774",bgcolor:ue?"#2563eb":"#f4f4f2"},children:I.label},I.label)})]}):null,de(Cl,{sx:{borderColor:"#e6e6e3"}}),In(yr,{sx:{pt:1.5,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[de(fc,{hideProject:l||Mt&&!Y,hideManager:f||x||Mt&&!E,hideReceivers:g||f||x&&st==="all"||Mt&&q.length===0,hideStartDate:Mt||x,hideReminder:g||x||Mt&&fe.length===0,hidePriority:x,hideDueDate:x||!P&&!!qe,values:{tabKey:Y,managerName:E,receiverNames:q,startDate:B,dueDate:K,reminders:fe,priority:Ee,eventTime:U,eventPlace:te,eventAddress:$},customTabs:o,avatarSrcByName:r,notice:i,event:P,onChangeEventTime:I=>e.setFormValue("event_time",I),onChangeEventPlace:I=>e.setFormValue("event_place",I),onChangeEventAddress:I=>e.setFormValue("event_address",I),targetSummary:Vt,onChangeProject:I=>e.setFormValue("tab_key",I),onAddProject:_,onChangeStartDate:I=>e.setFormValue("start_date",I),onClearStartDate:()=>e.setFormValue("start_date",""),onChangeDueDate:I=>e.setFormValue("due_date",I),onChangeReminder:I=>e.setFormValue("reminders",I),onChangePriority:I=>e.setFormValue("priority",I),onMemberEdit:k,pinColumns:lo,beforeStart:In(Pa,{children:[!g&&!j&&!x&&!(Mt&&!qe)?de(he,{icon:de(_E,{sx:{fontSize:17,...qe?{color:"#2f80ed"}:{}}}),label:n("create.repeat"),onClick:I=>tr(I),sx:P||!lo?void 0:it(Me),children:qe?xs(qe):de(yr,{component:"span",sx:{color:"#9a9a97"},children:n("common.none")})}):null,!g&&!j&&!x&&qe?de(he,{icon:de(IE,{sx:{fontSize:17}}),label:n("create.repeatUntil"),onClick:I=>Pn(I),sx:P||!lo?void 0:it(Me),children:Ye?Vo(Ye):de(yr,{component:"span",sx:{color:"#9a9a97"},children:n("create.auto")})}):null]}),trailing:In(Pa,{children:[!i&&!f&&!(Mt&&st==="involved")?de(he,{icon:st==="all"?de(Qx,{sx:{fontSize:17,color:"#2f80ed"}}):st==="group"?de(Jx,{sx:{fontSize:17,color:"#d9730d"}}):de(Xx,{sx:{fontSize:17}}),label:de(Ec,{}),onClick:I=>Be(I),sx:P||!lo?void 0:it(1),children:st==="all"?n("create.visibilityPublic"):st==="group"?n("create.visibilityDept",{value:T.find(I=>I.seq===io)?.name??n("create.department")}):n("create.visibilityPrivate")}):null,we&&!P&&!i&&!x&&!(Mt&&ae===0&&me===0)?In(Pa,{children:[de(he,{icon:de(BE,{sx:{fontSize:17}}),label:n("col.goal"),onClick:I=>Ne(I),sx:lo?it(1):void 0,children:ae>0?Ce.find(I=>I.seq===ae)?.name??n("create.deletedGoal"):de(yr,{component:"span",sx:{color:"#9a9a97"},children:n("board.unassigned")})}),de(he,{icon:de(wE,{sx:{fontSize:17}}),label:"\uD3EC\uC778\uD2B8",sx:lo?it(1):void 0,children:de(kr,{value:me>0?String(me):"",placeholder:n("create.notEstimated"),onCommit:I=>e.setFormValue("story_points",Number(I.replace(/[^0-9.]/g,""))||0)})})]}):null,j?de(gc,{values:{repro:V,device:ee,where:re,version:le},onChangeRepro:I=>e.setFormValue("bug_repro",I),onChangeDevice:I=>e.setFormValue("bug_device",I),onChangeWhere:I=>e.setFormValue("bug_where",I),onChangeVersion:I=>e.setFormValue("bug_version",I)}):null,!g&&!x&&!i?(m??[]).filter(I=>!(Mt&&!I.filled)).map(I=>de(he,{icon:I.icon,label:I.label,onClick:I.onClick,sx:P||!lo?void 0:it(Me),children:I.value},I.key)):null]}),leading:P||d?null:de(yr,{sx:{gridColumn:"1 / -1"},children:de(he,{icon:de(vE,{sx:{fontSize:17}}),label:n("dialog.label"),onClick:I=>Ve(I),children:(Re??[]).length>0?de(Wr,{labelKeys:Re??[],labelOptions:t}):de(yr,{component:"span",sx:{color:"#9a9a97"},children:n("menu.empty")})})})}),xn?In(Yx,{onClick:Oo,"aria-expanded":ct,sx:{alignSelf:"flex-start",display:"flex",alignItems:"center",gap:.5,minHeight:32,mx:2,pr:1,borderRadius:1,fontSize:14,color:"#2563eb","&:hover":{bgcolor:"#f2f2f0"}},children:[ct?de(kE,{sx:{fontSize:17}}):de(TE,{sx:{fontSize:17}}),ct?n("create.collapseFields"):n("create.expandFields")]}):null,de(Cl,{sx:{my:1.5,borderColor:"#e6e6e3"}}),de(zo,{icon:de(CE,{sx:{fontSize:18,display:"block"}}),title:n("common.content"),titleExtra:y||M?In(Pa,{children:[y,M?de(Tc,{content:nt,templates:M,onApply:I=>e.setFormValue("content",I),onSave:C,onRemove:w}):null]}):void 0,children:de(bc,{syncKey:H,value:nt,onChange:I=>e.setFormValue("content",I)})}),j||x||Mt&&!se?null:In(Pa,{children:[de(Cl,{sx:{my:1.5,borderColor:"#e6e6e3"}}),de(zo,{icon:de(SE,{sx:{fontSize:18,display:"block"}}),title:n("col.note"),children:de(DE,{form:e,name:"note",placeholder:n("create.notePlaceholder"),fullWidth:!0,size:"medium",sx:{mt:1}})})]}),P||x||Mt&&F.length===0?null:de(Cl,{sx:{my:1.5,borderColor:"#e6e6e3"}}),P||x||Mt&&F.length===0?null:de(Sc,{taskSeq:0,checklist:F,onAdd:(I,X)=>Gm(e,X),onToggle:(I,X,ue)=>jm(e,X,ue),onRemove:(I,X)=>Ym(e,X),onUpdate:(I,X,ue)=>Xm(e,X,ue)}),g?null:In(Pa,{children:[de(Cl,{sx:{my:1.5,borderColor:"#e6e6e3"}}),de(_c,{taskSeq:0,attachments:Mn.map(I=>({name:I.name,size:I.size})),onAdd:(I,X)=>Qm(S,X,A),onRemove:(I,X)=>Jm(S,X)})]})]}),de(wd,{transitionDuration:0,anchorEl:vt,open:!!vt,onClose:()=>Ne(null),children:[{seq:0,label:n("board.unassigned")},...Ce.map(I=>({seq:I.seq,label:an(I)}))].map(I=>de(Dd,{onClick:()=>{e.setFormValue("sprint_seq",I.seq),Ne(null)},sx:{fontSize:14,minWidth:170},children:I.label},I.seq))}),de(wd,{transitionDuration:0,anchorEl:er,open:!!er,onClose:()=>tr(null),children:[{value:"",label:n("common.none")},...Xi].map(I=>de(Dd,{selected:qe===I.value,onClick:()=>{tr(null),Um(e,I.value)},sx:{fontSize:14,minWidth:140},children:I.label},I.value||"none"))}),de(EE,{anchorEl:Co,open:!!Co,onClose:()=>Pn(null),selectedDate:Ye?new Date(`${Ye}T00:00:00`):new Date,onDateChange:I=>{Km(e,I),Pn(null)}}),de(wd,{transitionDuration:0,anchorEl:Z,open:!!Z,onClose:()=>Be(null),children:[{key:"involved",label:n("create.visibilityPrivate"),tip:n("create.privateTip"),icon:de(Xx,{sx:{fontSize:17,color:"#57564f"}}),selected:st==="involved",onPick:()=>Qi(e,"involved")},{key:"all",label:n("create.visibilityPublic"),tip:n("create.publicTip"),icon:de(Qx,{sx:{fontSize:17,color:"#2f80ed"}}),selected:st==="all",onPick:()=>Qi(e,"all")},...[...T].sort((I,X)=>I.seq===N?-1:X.seq===N?1:0).map(I=>({key:`group-${I.seq}`,label:n("create.visibilityDeptName",{name:I.name}),tip:n("create.deptTip",{name:I.name}),icon:de(Jx,{sx:{fontSize:17,color:"#d9730d"}}),selected:st==="group"&&io===I.seq,onPick:()=>Qi(e,"group",I.seq)}))].map(I=>de(yE,{title:I.tip,arrow:!0,disableInteractive:!0,placement:"right",children:In(Dd,{selected:I.selected,onClick:()=>{I.onPick(),x&&I.key==="all"&&(e.setFormValue("receiver_names",[]),e.setFormValue("receiver_account_seqs",[])),Be(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[I.icon,I.label]})},I.key))}),de(wc,{anchorEl:Pt,selectedKeys:Re??[],labelOptions:t,onToggle:I=>e.setFormValue("label_keys",Bs(Re??[],I)),onAddLabel:(I,X)=>R?.(I,X),onClose:()=>Ve(null)})]})}import{Fragment as ob,jsx as Tt,jsxs as Sl}from"react/jsx-runtime";var HE={gap:"0.75rem !important","& .left-actions, & .right-actions":{display:"contents"},"& .left-actions > span:empty":{display:"none"},"& .left-actions:not(:has(*:not(:empty)))":{display:"none"},"& .left-actions .MuiButton-root, & .right-actions .MuiButton-root":{flex:"1 1 0",minWidth:0,margin:"0 !important",paddingLeft:"8px !important",paddingRight:"8px !important",whiteSpace:"nowrap"},"& .right-actions .MuiButton-text":{border:"1px solid rgba(0, 0, 0, 0.23)"},"& .right-actions .MuiButton-contained":{border:"1px solid transparent"}};function nb({open:e,onClose:t,desktopPresentation:o="drawer",submitLabel:a,...r}){O();let{form:i,presetTitle:l="",presetContent:s="",presetVisibility:c,presetVisibilityGroupSeq:u=0,presetDueDate:m="",presetTabKey:d="",presetManager:p=null,isNotice:f=!1,defaultBug:g=!1}=r,x=hn(),h=ME(!1),[D,b]=eb(0),v=i.useFormValue("title"),T=i.useFormValue("icon"),N=i.useFormValue("icon_color"),k=!!i.useFormValue("is_event"),_=!!i.useFormValue("is_bug"),R=$e(),M=x.useValue("createSubmitting")??!1,y=f||k?Oe(T||(f?_t:zt)):null,C=f?n("create.titleNotice"):k?n("create.titleEvent"):_?n("task.createBug"):n("task.createTask"),w=f?n("create.noticeTitlePlaceholder"):k?n("create.eventTitlePlaceholder"):_?n("create.bugTitlePlaceholder"):n("create.taskTitlePlaceholder");PE(()=>{let B=h.current;h.current=e,!(!e||B)&&($m(i,x,{presetTitle:l,presetContent:s,presetVisibility:c,presetVisibilityGroupSeq:u,presetDueDate:m,presetTabKey:d,presetManager:p,isNotice:f,defaultBug:g}),b(P=>P+1))},[e]);let[S,A]=eb(null),E=B=>y?k?Tt(qE,{title:n("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:Tt(OE,{onClick:P=>A(P.currentTarget),sx:{display:"flex",p:.5,borderRadius:1,color:N||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:Tt(y,{sx:{fontSize:20}})})}):Tt(Cr,{sx:[{display:"flex",color:N||"#1e3a8a"},B],children:Tt(y,{sx:{fontSize:20}})}):null,q=Sl(Cr,{sx:{display:"flex",alignItems:"center",gap:1,px:2,pt:2,pb:1},children:[E({p:0}),Tt(Cr,{component:"input",autoFocus:!0,spellCheck:!1,value:v,placeholder:w,onChange:B=>i.setFormValue("title",B.target.value),sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:19,fontWeight:600,color:"#37352f",p:0,m:0,"&::placeholder":{color:"#c9c8c5",fontWeight:400}}})]});return R||o==="dialog"?Tt(ob,{children:Tt(FE,{open:e,onClose:t,backdropClick:!1,locale:ye(),fontScale:R?{enabled:!0,default:1.1,min:.6}:{enabled:!0},title:C,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fullScreen:R,mobilePresentation:R?"slide":"dialog",maxWidth:"md",actions:{showCancelButton:!0,right:Tt(Rd,{variant:"contained",disableElevation:!0,disabled:M,onClick:M?void 0:i.submit,children:M?n("create.saving"):a??n("create.saveButton")})},dialogActionSx:R?HE:void 0,tabs:{visible:!1},contentTopPadding:0,contentPaddingX:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,contentBottomPadding:0,scrollPastLastSection:!1,overlayScrollbar:{enabled:!0,contentStyle:{minWidth:0}},sections:[{id:"task-create",title:"",showTitle:!1,children:Tt(Cr,{sx:{width:"100%",minWidth:0,display:"flex",flexDirection:"column",gap:0},children:Tt(Ed,{...r,contentSyncKey:`create-${D}`,leadingRow:q})})}]})}):Sl(ob,{children:[Tt(LE,{anchor:"right",open:e,onClose:(B,P)=>{P!=="backdropClick"&&t()},"aria-label":n("create.newTaskAria"),sx:{zIndex:B=>B.zIndex.modal},slotProps:{paper:{sx:{width:720,maxWidth:"100vw"}}},children:Sl(Cr,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[Sl(Cr,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.5,flexShrink:0},children:[E({px:.5}),Tt(Cr,{component:"input",autoFocus:!0,spellCheck:!1,value:v,placeholder:w,onChange:B=>i.setFormValue("title",B.target.value),sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:18,fontWeight:500,color:"#37352f",p:0,m:0,"&::placeholder":{color:"#c9c8c5",fontWeight:400}}}),Tt(AE,{"aria-label":n("common.close"),onClick:t,sx:{color:"#6b7280"},children:Tt(zE,{})})]}),Tt(tb,{sx:{borderColor:"#e6e6e3"}}),Tt(Cr,{sx:{flex:1,minHeight:0},children:Tt(NE,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:Tt(Ed,{...r,contentSyncKey:`create-${D}`})})}),Tt(tb,{sx:{borderColor:"#e6e6e3"}}),Sl(Cr,{sx:{display:"flex",justifyContent:"flex-end",gap:.5,px:2,py:1.5,flexShrink:0},children:[Tt(Rd,{onClick:t,color:"inherit",disabled:M,children:n("common.cancel")}),Tt(Rd,{onClick:i.submit,variant:"contained",disabled:M,children:M?n("create.creating"):a??n("common.register")})]})]})}),Tt(Vr,{anchorEl:S,value:T,color:N,onSelect:B=>{i.setFormValue("icon",B),A(null)},onSelectColor:B=>i.setFormValue("icon_color",B),onClose:()=>A(null)})]})}import{useEffect as Jb,useRef as Zb,useState as eh}from"react";import{Box as Kc,Button as pM,Divider as th,Drawer as fM,IconButton as gM,ListItemIcon as ip,ListItemText as lp,Menu as xM,MenuItem as sp}from"@mui/material";import bM from"@mui/icons-material/MoreVert";import hM from"@mui/icons-material/DeleteOutline";import kM from"@mui/icons-material/ShareOutlined";import TM from"@mui/icons-material/HistoryOutlined";import yM from"@ehfuse/overlay-scrollbar";import{FormDialog as CM}from"@ehfuse/mui-form-dialog";import{useRef as qc,useState as Sr}from"react";import{Box as be,Button as Tb,Chip as zc,IconButton as Xo,Popover as xR,Tooltip as vb}from"@mui/material";import bR from"@mui/icons-material/ArrowUpwardRounded";import{TextField as hR}from"@ehfuse/mui-form-controls";import Nc from"@mui/icons-material/Close";import kR from"@mui/icons-material/EditOutlined";import yb from"@mui/icons-material/ContentCopyOutlined";import Cb from"@mui/icons-material/Check";import TR from"@mui/icons-material/Favorite";import yR from"@mui/icons-material/FavoriteBorderOutlined";import CR from"@mui/icons-material/CheckCircle";import SR from"@mui/icons-material/CheckCircleOutlineOutlined";import hi from"@mui/icons-material/AttachFileOutlined";import vR from"@mui/icons-material/AddCircleOutline";import BR from"@mui/icons-material/ImageOutlined";var Pd=e=>{if(e===0)return"0 Bytes";let t=1024,o=["Bytes","KB","MB","GB","TB"],a=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,a)).toFixed(2))+" "+o[a]};import{useCallback as Rc,useEffect as WE,useMemo as $E,useRef as rb,useState as Md}from"react";import{Box as Pc,Paper as VE,Popper as UE}from"@mui/material";import{jsx as Ma,jsxs as GE}from"react/jsx-runtime";var ab=8,KE=[{key:"\uC88B\uC544\uC694",get label(){return n("emoji.like")},insert:"\u{1F44D}",keywords:["like","\uC5C4\uC9C0","\uAD7F"]},{key:"\uD655\uC778",get label(){return n("emoji.check")},insert:"\u2705",keywords:["check","\uC644\uB8CC","\uCCB4\uD06C"]},{key:"\uAC10\uC0AC",get label(){return n("emoji.thanks")},insert:"\u{1F64F}",keywords:["thanks","\uACE0\uB9C8\uC6CC","\uBD80\uD0C1"]},{key:"\uCD95\uD558",get label(){return n("emoji.party")},insert:"\u{1F389}",keywords:["party","\uD30C\uD2F0","\uC9DD\uC9DD"]},{key:"\uBC15\uC218",get label(){return n("emoji.clap")},insert:"\u{1F44F}",keywords:["clap","\uC798\uD588\uC5B4"]},{key:"\uD558\uD2B8",get label(){return n("emoji.heart")},insert:"\u2764\uFE0F",keywords:["heart","\uC0AC\uB791"]},{key:"\uC6C3\uC74C",get label(){return n("emoji.laugh")},insert:"\u{1F604}",keywords:["smile","\uC6C3\uAE40","\u314B\u314B"]},{key:"\uBBF8\uC18C",get label(){return n("emoji.smile")},insert:"\u{1F642}",keywords:["smile","\uC88B\uC74C"]},{key:"\uB208\uBB3C",get label(){return n("emoji.tears")},insert:"\u{1F622}",keywords:["sad","\uC2AC\uD514","\u3160\u3160"]},{key:"\uB180\uB78C",get label(){return n("emoji.wow")},insert:"\u{1F62E}",keywords:["wow","\uD5C9"]},{key:"\uACE0\uBBFC",get label(){return n("emoji.think")},insert:"\u{1F914}",keywords:["think","\uC0DD\uAC01","\uC74C"]},{key:"\uC624\uCF00\uC774",get label(){return n("emoji.ok")},insert:"\u{1F44C}",keywords:["ok","\uC54C\uACA0\uC5B4"]},{key:"\uBD88",get label(){return n("emoji.fire")},insert:"\u{1F525}",keywords:["fire","\uAE09\uD568","\uB300\uBC15"]},{key:"\uC544\uC774\uB514\uC5B4",get label(){return n("emoji.idea")},insert:"\u{1F4A1}",keywords:["idea","\uC804\uAD6C"]},{key:"\uACBD\uACE0",get label(){return n("emoji.warning")},insert:"\u26A0\uFE0F",keywords:["warning","\uC8FC\uC758"]},{key:"\uC9C8\uBB38",get label(){return n("emoji.question")},insert:"\u2753",keywords:["question","\uBB3C\uC74C"]},{key:"\uC2DC\uACC4",get label(){return n("emoji.clock")},insert:"\u23F0",keywords:["time","\uC2DC\uAC04","\uC54C\uB78C"]},{key:"\uB2EC\uB825",get label(){return n("emoji.calendar")},insert:"\u{1F4C5}",keywords:["calendar","\uC77C\uC815","\uB0A0\uC9DC"]},{key:"\uBA54\uBAA8",get label(){return n("emoji.note")},insert:"\u{1F4DD}",keywords:["note","\uAE30\uB85D"]},{key:"\uCCA8\uBD80",get label(){return n("emoji.attach")},insert:"\u{1F4CE}",keywords:["attach","\uD074\uB9BD","\uD30C\uC77C"]},{key:"\uB9C1\uD06C",get label(){return n("emoji.link")},insert:"\u{1F517}",keywords:["link","\uC8FC\uC18C"]},{key:"\uB85C\uCF13",get label(){return n("emoji.rocket")},insert:"\u{1F680}",keywords:["rocket","\uCD9C\uBC1C","\uBC30\uD3EC"]},{key:"\uBCC4",get label(){return n("emoji.star")},insert:"\u2B50",keywords:["star","\uC911\uC694"]},{key:"\uC5D1\uC2A4",get label(){return n("emoji.x")},insert:"\u274C",keywords:["x","\uC548\uB428","\uCDE8\uC18C"]}];function vl(e,t,o){let a=e.slice(0,t),i=(o==="@"?/(^|[\s(])@([^\s@]{0,20})$/:/(^|[\s(])\/([^\s/]{0,20})$/).exec(a);return i?{start:t-i[2].length-1,query:i[2]}:null}function Od(e,t){let o=ie(),a=e??o.mentionCandidates??[],r=t??o.slashCommands,i=r===!0?KE:Array.isArray(r)?r:[];return{people:a,commands:i,enabled:a.length>0||i.length>0}}function Ld(e,t,o){if(!o)return[];let a=o.query.toLowerCase();return o.trigger==="@"?e.filter(r=>r.name.toLowerCase().includes(a)).slice(0,ab).map((r,i)=>({id:`p${i}-${r.name}`,text:`@${r.name} `,label:r.name,subtitle:r.subtitle,icon:Ma(fo,{src:r.avatar??"",name:r.name,avatarSx:{width:24,height:24,fontSize:14},iconFontSize:16})})):t.filter(r=>[r.key,r.label,...r.keywords??[]].some(i=>i.toLowerCase().includes(a))).slice(0,ab).map(r=>({id:`c-${r.key}`,text:r.insert,label:`/${r.label}`,icon:Ma(Pc,{component:"span",sx:{width:24,textAlign:"center",fontSize:18,lineHeight:1},children:r.insert})}))}function Ad({open:e,anchor:t,items:o,active:a,onPick:r,onHover:i}){return Ma(UE,{open:e,anchorEl:t,placement:"top-start",sx:{zIndex:1500},children:Ma(VE,{elevation:4,sx:{minWidth:220,maxWidth:320,py:.5,borderRadius:1.5},children:o.map((l,s)=>GE(Pc,{role:"option","aria-selected":s===a,onMouseDown:c=>c.preventDefault(),onClick:()=>r(l),onMouseEnter:()=>i(s),sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:.75,cursor:"pointer",fontSize:14,bgcolor:s===a?"action.selected":"transparent"},children:[l.icon,Ma(Pc,{component:"span",sx:{fontWeight:500,whiteSpace:"nowrap"},children:l.label}),l.subtitle?Ma(Pc,{component:"span",sx:{color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.subtitle}):null]},l.id))})})}function ib({value:e,setValue:t,candidates:o,slashCommands:a}){let{people:r,commands:i,enabled:l}=Od(o,a),s=rb(null),[c,u]=Md(null),[m,d]=Md(null),[p,f]=Md(0),g=$E(()=>Ld(r,i,m),[i,r,m]),x=!!(c&&m&&g.length>0),h=Rc(()=>{let k=s.current;if(!l||!k)return;let _=k.selectionStart??k.value.length,R=r.length>0?vl(k.value,_,"@"):null,H=!R&&i.length>0?vl(k.value,_,"/"):null,M=R?{...R,trigger:"@"}:H?{...H,trigger:"/"}:null;d(M),f(0),u(M?k.closest(".MuiInputBase-root")??k:null)},[i.length,l,r.length]),D=rb(null);WE(()=>{let k=s.current,_=D.current;if(_!==null&&k){D.current=null,k.setSelectionRange(_,_);return}document.activeElement===k&&h()},[e,h]);let b=Rc(k=>{let _=s.current;if(!m||!_)return;let R=_.selectionStart??e.length,H=e.slice(0,m.start)+k.text+e.slice(R),M=m.start+k.text.length;D.current=H===e?null:M,t(H),d(null),u(null),requestAnimationFrame(()=>{D.current=null,_.focus(),_.setSelectionRange(M,M)})},[m,t,e]),v=Rc(k=>!x||k.nativeEvent.isComposing?!1:k.key==="ArrowDown"||k.key==="ArrowUp"?(k.preventDefault(),f(_=>(_+(k.key==="ArrowDown"?1:g.length-1))%g.length),!0):k.key==="Enter"||k.key==="Tab"?(k.preventDefault(),b(g[Math.min(p,g.length-1)]),!0):k.key==="Escape"?(k.preventDefault(),k.stopPropagation(),d(null),u(null),!0):!1,[p,g,x,b]);return{inputRef:Rc(k=>{s.current=k},[]),onKeyDown:v,onSelectionChange:h,popper:l?Ma(Ad,{open:x,anchor:c,items:g,active:p,onPick:b,onHover:f}):null}}import{useCallback as qd,useEffect as jE,useRef as lb,useState as sb}from"react";import{Box as Bl,Tab as YE,Tabs as XE}from"@mui/material";import{jsx as gi,jsxs as ZE}from"react/jsx-runtime";var cb=[{key:"smile",labelKey:"section.emojiSmileys",items:["\u{1F600}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F606}","\u{1F605}","\u{1F923}","\u{1F602}","\u{1F642}","\u{1F643}","\u{1F609}","\u{1F60A}","\u{1F607}","\u{1F970}","\u{1F60D}","\u{1F929}","\u{1F618}","\u{1F617}","\u{1F61A}","\u{1F619}","\u{1F60B}","\u{1F61B}","\u{1F61C}","\u{1F92A}","\u{1F61D}","\u{1F917}","\u{1F92D}","\u{1F92B}","\u{1F914}","\u{1F928}","\u{1F610}","\u{1F611}","\u{1F636}","\u{1F60F}","\u{1F612}","\u{1F644}","\u{1F62C}","\u{1F60C}","\u{1F614}","\u{1F62A}","\u{1F634}","\u{1F637}","\u{1F912}","\u{1F915}","\u{1F975}","\u{1F976}","\u{1F635}","\u{1F92F}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62D}","\u{1F624}","\u{1F620}","\u{1F621}","\u{1F97A}","\u{1F633}","\u{1F631}","\u{1F628}","\u{1F630}","\u{1F625}","\u{1F910}","\u{1F62F}","\u{1F62E}"]},{key:"gesture",labelKey:"section.emojiPeople",items:["\u{1F44D}","\u{1F44E}","\u{1F44C}","\u270C\uFE0F","\u{1F91E}","\u{1F91F}","\u{1F918}","\u{1F919}","\u{1F448}","\u{1F449}","\u{1F446}","\u{1F447}","\u261D\uFE0F","\u270B","\u{1F91A}","\u{1F590}\uFE0F","\u{1F596}","\u{1F44B}","\u{1F91D}","\u{1F64F}","\u{1F4AA}","\u{1F9BE}","\u{1F44F}","\u{1F64C}","\u{1F450}","\u{1F932}","\u{1FAF6}","\u270D\uFE0F","\u{1F485}","\u{1F933}","\u{1F9E0}","\u{1F440}","\u{1F647}","\u{1F64B}","\u{1F646}","\u{1F645}","\u{1F481}","\u{1F937}","\u{1F926}","\u{1F9D1}\u200D\u{1F4BB}","\u{1F468}\u200D\u{1F4BC}","\u{1F469}\u200D\u{1F4BC}","\u{1F6B6}","\u{1F3C3}","\u{1F483}","\u{1F57A}","\u{1F476}","\u{1F9D3}"]},{key:"heart",labelKey:"section.emojiHearts",items:["\u2764\uFE0F","\u{1F9E1}","\u{1F49B}","\u{1F49A}","\u{1F499}","\u{1F49C}","\u{1F5A4}","\u{1F90D}","\u{1F90E}","\u{1F494}","\u2763\uFE0F","\u{1F495}","\u{1F49E}","\u{1F493}","\u{1F497}","\u{1F496}","\u{1F498}","\u{1F49D}","\u{1F49F}","\u2728","\u{1F4AB}","\u{1F4A5}","\u{1F389}","\u{1F38A}","\u{1F388}","\u{1F381}","\u{1F451}","\u{1FAC2}","\u{1F63B}","\u{1F490}","\u{1F380}","\u{1F48C}"]},{key:"work",labelKey:"section.emojiWork",items:["\u{1F4CC}","\u{1F4CE}","\u{1F4DD}","\u{1F4C4}","\u{1F4D1}","\u{1F4CA}","\u{1F4C8}","\u{1F4C9}","\u{1F5C2}\uFE0F","\u{1F4C5}","\u{1F4C6}","\u23F0","\u231B","\u2705","\u2611\uFE0F","\u274C","\u2B55","\u2757","\u2753","\u{1F4A1}","\u{1F514}","\u{1F515}","\u{1F4E2}","\u{1F4E3}","\u{1F4AC}","\u{1F4AD}","\u{1F517}","\u{1F512}","\u{1F511}","\u2699\uFE0F","\u{1F6E0}\uFE0F","\u{1F4EC}","\u{1F4BB}","\u{1F5A5}\uFE0F","\u{1F5A8}\uFE0F","\u{1F4DE}","\u{1F4F1}","\u{1F4B0}","\u{1F4B3}","\u{1F9FE}","\u{1F4E6}","\u{1F550}","\u{1F4CB}","\u{1F587}\uFE0F","\u270F\uFE0F","\u{1F5D1}\uFE0F","\u267B\uFE0F","\u{1F50D}"]},{key:"food",labelKey:"section.emojiFood",items:["\u2615","\u{1F375}","\u{1F964}","\u{1F9C3}","\u{1F37A}","\u{1F37B}","\u{1F942}","\u{1F377}","\u{1F378}","\u{1F943}","\u{1F35A}","\u{1F35C}","\u{1F372}","\u{1F35B}","\u{1F371}","\u{1F359}","\u{1F354}","\u{1F35F}","\u{1F355}","\u{1F32D}","\u{1F96A}","\u{1F32E}","\u{1F35D}","\u{1F957}","\u{1F356}","\u{1F357}","\u{1F969}","\u{1F373}","\u{1F95E}","\u{1F9C7}","\u{1F35E}","\u{1F950}","\u{1F370}","\u{1F382}","\u{1F9C1}","\u{1F36A}","\u{1F369}","\u{1F36B}","\u{1F36C}","\u{1F36D}","\u{1F366}","\u{1F34E}","\u{1F34A}","\u{1F34B}","\u{1F34C}","\u{1F349}","\u{1F347}","\u{1F353}"]},{key:"etc",labelKey:"section.emojiOther",items:["\u{1F525}","\u2B50","\u{1F31F}","\u{1F4AF}","\u{1F3AF}","\u{1F3C6}","\u{1F947}","\u{1F680}","\u{1F308}","\u2600\uFE0F","\u{1F319}","\u26C5","\u2601\uFE0F","\u{1F327}\uFE0F","\u2744\uFE0F","\u26A1","\u{1F338}","\u{1F33A}","\u{1F337}","\u{1F339}","\u{1F33B}","\u{1F340}","\u{1F33F}","\u{1F331}","\u{1F436}","\u{1F431}","\u{1F430}","\u{1F43C}","\u{1F98A}","\u{1F43B}","\u{1F425}","\u{1F98B}","\u{1F697}","\u2708\uFE0F","\u{1F3E0}","\u{1F3E2}","\u{1F3B5}","\u{1F3B6}","\u{1F4DA}","\u{1F3AE}","\u26BD","\u{1F3C0}","\u{1F48A}","\u{1FA7A}","\u{1F9F3}","\u{1F382}","\u{1F6D2}","\u{1F9F9}"]}],QE="'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif",mb="taskbox.recentEmojis",ub=24;function db(){try{let e=JSON.parse(window.localStorage.getItem(mb)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string").slice(0,ub):[]}catch{return[]}}function JE(e){let t=[e,...db().filter(o=>o!==e)].slice(0,ub);try{window.localStorage.setItem(mb,JSON.stringify(t))}catch{}return t}function pb({onPick:e}){let[t,o]=sb(()=>db()),[a,r]=sb(0),i=lb(null),l=lb(!1),s=t.length>0?[{key:"recent",labelKey:"section.emojiFrequent",items:t},...cb]:cb,c=Math.min(a,s.length-1),u=qd(p=>{o(JE(p)),e(p)},[e]),m=qd(p=>{r(p);let f=i.current;f&&(l.current=!0,f.scrollTo({left:f.clientWidth*p,behavior:"smooth"}),window.setTimeout(()=>{l.current=!1},350))},[]),d=qd(()=>{let p=i.current;if(!p||l.current||p.clientWidth===0)return;let f=Math.round(p.scrollLeft/p.clientWidth);r(g=>f!==g&&f>=0?f:g)},[]);return jE(()=>{let p=i.current;p&&(p.scrollLeft=p.clientWidth*c)},[]),ZE(Bl,{children:[gi(XE,{value:c,onChange:(p,f)=>m(f),variant:"scrollable",scrollButtons:!1,sx:{minHeight:36,borderBottom:"1px solid #ececea","& .MuiTab-root":{minHeight:36,minWidth:0,px:1.5,fontSize:13}},children:s.map(p=>gi(YE,{label:n(p.labelKey)},p.key))}),gi(Bl,{ref:i,onScroll:d,sx:{display:"flex",height:352,overflowX:"auto",overflowY:"hidden",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:s.map(p=>gi(Bl,{sx:{flex:"0 0 100%",width:"100%",height:"100%",overflowY:"auto",scrollSnapAlign:"start",scrollSnapStop:"always",p:1},children:gi(Bl,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(40px, 1fr))"},children:p.items.map((f,g)=>gi(Bl,{component:"button",type:"button",onClick:()=>u(f),"aria-label":f,sx:{border:0,bgcolor:"transparent",color:"#000",cursor:"pointer",fontFamily:QE,fontSize:24,lineHeight:1,py:.75,borderRadius:"8px","&:hover":{bgcolor:"rgba(15, 23, 42, 0.06)"},"&:active":{bgcolor:"rgba(15, 23, 42, 0.1)"}},children:f},`${f}-${g}`))})},p.key))})]})}import{forwardRef as lR,useImperativeHandle as sR,useLayoutEffect as xb,useRef as Oc,useState as gb}from"react";import{Box as Wd}from"@mui/material";import{EhfuseEditor as cR}from"@ehfuse/editor";import{useCallback as zd,useMemo as eR,useRef as tR,useState as Nd}from"react";import{jsx as oR}from"react/jsx-runtime";function fb(e,t){let{people:o,commands:a,enabled:r}=Od(e,t),[i,l]=Nd(null),[s,c]=Nd(null),u=tR(""),[m,d]=Nd(0),p=eR(()=>Ld(o,a,i),[a,o,i]),f=!!(r&&s&&i&&p.length>0),g=zd(()=>{if(!r)return;let b=window.getSelection();if(!b||b.rangeCount===0||!b.isCollapsed)return void l(null);let v=b.anchorNode;if(!v||v.nodeType!==Node.TEXT_NODE||!v.parentElement?.closest(".ehfuse-editor-content"))return void l(null);let T=v.data,N=b.anchorOffset,k=o.length>0?vl(T,N,"@"):null,_=!k&&a.length>0?vl(T,N,"/"):null,R=k?{...k,trigger:"@"}:_?{..._,trigger:"/"}:null;if(!R){u.current="",l(null),c(null);return}l({node:v,start:R.start,end:N,query:R.query,trigger:R.trigger});let H=`${R.trigger}${R.query}`;H!==u.current&&d(0),u.current=H;let M=document.createRange();M.setStart(v,R.start),M.setEnd(v,Math.min(R.start+1,T.length));let y=M.getBoundingClientRect();c({getBoundingClientRect:()=>y})},[a.length,r,o.length]),x=zd(b=>{if(!i)return;let{node:v,start:T,end:N}=i;if(!v.isConnected)return void l(null);let k=window.getSelection(),_=document.createRange();_.setStart(v,T),_.setEnd(v,Math.min(N,v.data.length)),k?.removeAllRanges(),k?.addRange(_),document.execCommand("insertText",!1,b.text),l(null),c(null)},[i]);return{handlers:{onKeyDownCapture:zd(b=>{!f||b.nativeEvent.isComposing||(b.key==="ArrowDown"||b.key==="ArrowUp"?(b.preventDefault(),b.stopPropagation(),d(v=>(v+(b.key==="ArrowDown"?1:p.length-1))%p.length)):b.key==="Enter"||b.key==="Tab"?(b.preventDefault(),b.stopPropagation(),x(p[Math.min(m,p.length-1)])):b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),l(null),c(null)))},[m,p,f,x]),onKeyUp:g,onMouseUp:g,onInput:g},popper:r?oR(Ad,{open:f,anchor:s,items:p,active:m,onPick:x,onHover:d}):null,isOpen:f}}function xi(e){return/^\s*<(p|div|ul|ol|h[1-6]|blockquote|pre)[\s>]/i.test(e)}var nR=new Set(["P","BR","DIV","SPAN","STRONG","B","EM","I","U","S","STRIKE","DEL","CODE","PRE","UL","OL","LI","H1","H2","H3","H4","BLOCKQUOTE","A","MARK"]),rR=new Set(["background-color","color","text-decoration"]);function Mc(e){if(typeof DOMParser>"u")return"";let o=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;if(!o)return"";let a=r=>{for(let i of Array.from(r.children)){if(!nR.has(i.tagName)){if(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE"].includes(i.tagName)){i.remove();continue}a(i),i.replaceWith(...Array.from(i.childNodes));continue}for(let l of Array.from(i.attributes)){let s=l.name.toLowerCase();if(i.tagName==="A"&&s==="href"){/^(https?:|mailto:|tel:)/i.test(l.value.trim())||i.removeAttribute(l.name);continue}if(s==="style"){let c=l.value.split(";").map(u=>u.trim()).filter(u=>rR.has(u.split(":")[0]?.trim().toLowerCase()??"")&&!/url\(|expression/i.test(u)).join("; ");c?i.setAttribute("style",c):i.removeAttribute("style");continue}i.removeAttribute(l.name)}a(i)}};return a(o),o.innerHTML}function _l(e){if(typeof DOMParser>"u")return e.replace(/<[^>]*>/g,"");let t=e.replace(/<br\s*\/?>/gi,`
|
|
6
6
|
`).replace(/<\/(p|div|li|h[1-6]|blockquote|pre)>/gi,`
|
|
7
7
|
`).replace(/<li[^>]*>/gi,"\u2022 ");return(new DOMParser().parseFromString(t,"text/html").body.textContent??"").replace(/\n{3,}/g,`
|
|
8
8
|
|