@ehfuse/taskbox 0.11.27 → 0.11.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,25 +1,25 @@
1
- import{a as Wi,b as Up,c as vm,d as oA,e as nA,f as rA,g as aA,h as iA}from"./chunks/chunk-4L6MXOC5.js";import{a as pa,b as tA,c as Kp,d as cs,e as lA,f as sA,g as cA,h as mA,i as Gp}from"./chunks/chunk-HORIQZVA.js";import{a as ss,l as $i,m as Bm}from"./chunks/chunk-MYYLR4Z6.js";import{a as _T,b as IT,c as wT,d as fa,e as Sm,f as DT,g as n,h as on,i as ET,j as L,k as Ce,l as Fr,m as Vp,n as sr,o as zn}from"./chunks/chunk-WOL25EMO.js";import"./chunks/chunk-JQBDPUHS.js";var jp="waiting",uA="replied";import{createContext as RT,useContext as PT,useMemo as Yp}from"react";import{Box as MT,useMediaQuery as OT,useTheme as LT}from"@mui/material";import{ConfirmActionProvider as AT}from"@ehfuse/mui-confirm-action";var _m="--app-mobile-font-offset";function dt(e,t=0){return`calc(${e}px + max(0px, var(${_m}, 0px) - ${t}px))`}import{jsx as Im}from"react/jsx-runtime";var Xp=RT({});function qT({config:e,children:t}){let o=L(),a=Yp(()=>({...e??{}}),[e,o]),r=a.mobileFontOffsetPx,i=LT(),l=OT(i.breakpoints.up("lg")),s=a.isMobile??!l;return Im(Xp.Provider,{value:a,children:Im(AT,{isMobile:s,children:r===void 0?t:Im(MT,{sx:{display:"contents",[_m]:`${r}px`},children:t})})})}function le(){return PT(Xp)}function Vi(){let{buildFileUrl:e}=le();return Yp(()=>e||((t,o)=>{let a=[];return o?.thumb&&a.push(`thumb=${o.thumb}`),o?.download&&a.push("download=1"),`/api/v1/files/${t}${a.length?`?${a.join("&")}`:""}`}),[e])}function Ui(){let{uploadMaxMb:e}=le();return e??50}import{useGlobalForm as BS}from"@ehfuse/forma";import{useSyncExternalStore as zT}from"react";import Jp from"@mui/icons-material/DoNotDisturbAltOutlined";import Em from"@mui/icons-material/BookmarkBorderOutlined";import NT from"@mui/icons-material/LabelOutlined";import FT from"@mui/icons-material/FlagOutlined";import HT from"@mui/icons-material/StarBorderOutlined";import WT from"@mui/icons-material/FolderOutlined";import $T from"@mui/icons-material/EventOutlined";import VT from"@mui/icons-material/BuildOutlined";import UT from"@mui/icons-material/LocalShippingOutlined";import KT from"@mui/icons-material/StorefrontOutlined";import GT from"@mui/icons-material/GroupsOutlined";import jT from"@mui/icons-material/LightbulbOutlined";import YT from"@mui/icons-material/FavoriteBorderOutlined";import XT from"@mui/icons-material/AssignmentOutlined";import QT from"@mui/icons-material/HomeOutlined";import JT from"@mui/icons-material/WorkOutline";import ZT from"@mui/icons-material/SchoolOutlined";import ey from"@mui/icons-material/LocalHospitalOutlined";import ty from"@mui/icons-material/RestaurantOutlined";import oy from"@mui/icons-material/LocalFloristOutlined";import ny from"@mui/icons-material/DirectionsCarOutlined";import ry from"@mui/icons-material/CampaignOutlined";import ay from"@mui/icons-material/SavingsOutlined";import iy from"@mui/icons-material/Inventory2Outlined";import ly from"@mui/icons-material/CleaningServicesOutlined";import Zp from"@mui/icons-material/HandymanOutlined";import sy from"@mui/icons-material/LocalPhoneOutlined";import cy from"@mui/icons-material/EmailOutlined";import my from"@mui/icons-material/ShoppingCartOutlined";import uy from"@mui/icons-material/BarChartOutlined";import dy from"@mui/icons-material/PrintOutlined";import py from"@mui/icons-material/SecurityOutlined";import fy from"@mui/icons-material/AlarmOutlined";import gy from"@mui/icons-material/AttachFileOutlined";import xy from"@mui/icons-material/PhotoCameraOutlined";import by from"@mui/icons-material/ImageOutlined";import hy from"@mui/icons-material/MenuBookOutlined";import ky from"@mui/icons-material/EditOutlined";import Ty from"@mui/icons-material/KeyOutlined";import yy from"@mui/icons-material/LockOutlined";import Cy from"@mui/icons-material/LockOpenOutlined";import Sy from"@mui/icons-material/SettingsOutlined";import vy from"@mui/icons-material/CloudOutlined";import By from"@mui/icons-material/WifiOutlined";import _y from"@mui/icons-material/ComputerOutlined";import Iy from"@mui/icons-material/SmartphoneOutlined";import wy from"@mui/icons-material/TvOutlined";import Dy from"@mui/icons-material/AccessTimeOutlined";import Ey from"@mui/icons-material/TimerOutlined";import Ry from"@mui/icons-material/MapOutlined";import Py from"@mui/icons-material/PlaceOutlined";import My from"@mui/icons-material/NavigationOutlined";import Oy from"@mui/icons-material/FlightOutlined";import Ly from"@mui/icons-material/TrainOutlined";import Ay from"@mui/icons-material/DirectionsBusOutlined";import qy from"@mui/icons-material/DirectionsBikeOutlined";import zy from"@mui/icons-material/DirectionsWalkOutlined";import Ny from"@mui/icons-material/DirectionsRunOutlined";import Fy from"@mui/icons-material/FitnessCenterOutlined";import Hy from"@mui/icons-material/SportsSoccerOutlined";import Wy from"@mui/icons-material/EmojiEventsOutlined";import $y from"@mui/icons-material/CardGiftcardOutlined";import Vy from"@mui/icons-material/CakeOutlined";import ef from"@mui/icons-material/CoffeeOutlined";import Uy from"@mui/icons-material/LocalPizzaOutlined";import Ky from"@mui/icons-material/ShoppingBagOutlined";import tf from"@mui/icons-material/CreditCardOutlined";import Gy from"@mui/icons-material/AccountBalanceOutlined";import jy from"@mui/icons-material/AccountBalanceWalletOutlined";import Yy from"@mui/icons-material/AttachMoneyOutlined";import Xy from"@mui/icons-material/ReceiptLongOutlined";import Qy from"@mui/icons-material/CalculateOutlined";import Jy from"@mui/icons-material/TrendingUpOutlined";import Zy from"@mui/icons-material/ListAltOutlined";import eC from"@mui/icons-material/TaskAltOutlined";import tC from"@mui/icons-material/DoneAllOutlined";import oC from"@mui/icons-material/WarningAmberOutlined";import nC from"@mui/icons-material/InfoOutlined";import rC from"@mui/icons-material/HelpOutlined";import aC from"@mui/icons-material/SupportAgentOutlined";import iC from"@mui/icons-material/PersonOutlined";import lC from"@mui/icons-material/PersonAddOutlined";import sC from"@mui/icons-material/BadgeOutlined";import cC from"@mui/icons-material/WbSunnyOutlined";import mC from"@mui/icons-material/DarkModeOutlined";import uC from"@mui/icons-material/LocalFireDepartmentOutlined";import dC from"@mui/icons-material/WaterDropOutlined";import pC from"@mui/icons-material/BoltOutlined";import fC from"@mui/icons-material/AutorenewOutlined";import gC from"@mui/icons-material/ScienceOutlined";import xC from"@mui/icons-material/MedicalServicesOutlined";import bC from"@mui/icons-material/NotificationsOutlined";import hC from"@mui/icons-material/SendOutlined";import kC from"@mui/icons-material/LinkOutlined";import TC from"@mui/icons-material/PublicOutlined";import of from"@mui/icons-material/ApartmentOutlined";import yC from"@mui/icons-material/PlumbingOutlined";import CC from"@mui/icons-material/ElectricalServicesOutlined";import SC from"@mui/icons-material/ChatOutlined";import vC from"@mui/icons-material/DescriptionOutlined";import BC from"@mui/icons-material/FactCheckOutlined";import _C from"@mui/icons-material/RocketLaunchOutlined";import IC from"@mui/icons-material/PaletteOutlined";import wC from"@mui/icons-material/MusicNoteOutlined";import DC from"@mui/icons-material/VideocamOutlined";import EC from"@mui/icons-material/ThumbUpOutlined";import RC from"@mui/icons-material/PushPinOutlined";import PC from"@mui/icons-material/SearchOutlined";import MC from"@mui/icons-material/VisibilityOutlined";import OC from"@mui/icons-material/VerifiedOutlined";import LC from"@mui/icons-material/TrackChangesOutlined";import AC from"@mui/icons-material/ExtensionOutlined";import qC from"@mui/icons-material/CodeOutlined";import zC from"@mui/icons-material/BugReportOutlined";import NC from"@mui/icons-material/SmartToyOutlined";import FC from"@mui/icons-material/StorageOutlined";import HC from"@mui/icons-material/QrCode2Outlined";import WC from"@mui/icons-material/FileDownloadOutlined";import $C from"@mui/icons-material/FileUploadOutlined";import VC from"@mui/icons-material/MicOutlined";import UC from"@mui/icons-material/HeadphonesOutlined";import KC from"@mui/icons-material/MovieOutlined";import GC from"@mui/icons-material/SportsEsportsOutlined";import jC from"@mui/icons-material/BrushOutlined";import YC from"@mui/icons-material/ArchitectureOutlined";import XC from"@mui/icons-material/EngineeringOutlined";import QC from"@mui/icons-material/FactoryOutlined";import JC from"@mui/icons-material/AgricultureOutlined";import ZC from"@mui/icons-material/DirectionsBoatOutlined";import eS from"@mui/icons-material/TwoWheelerOutlined";import tS from"@mui/icons-material/HandshakeOutlined";import oS from"@mui/icons-material/GavelOutlined";import nS from"@mui/icons-material/BalanceOutlined";import rS from"@mui/icons-material/TranslateOutlined";import aS from"@mui/icons-material/PsychologyOutlined";import iS from"@mui/icons-material/PetsOutlined";import lS from"@mui/icons-material/CelebrationOutlined";import sS from"@mui/icons-material/BeachAccessOutlined";import cS from"@mui/icons-material/AcUnitOutlined";import mS from"@mui/icons-material/ForestOutlined";import uS from"@mui/icons-material/LandscapeOutlined";import dS from"@mui/icons-material/HotelOutlined";import pS from"@mui/icons-material/LocalLaundryServiceOutlined";import fS from"@mui/icons-material/ChairOutlined";import gS from"@mui/icons-material/LocalBarOutlined";import xS from"@mui/icons-material/LunchDiningOutlined";import bS from"@mui/icons-material/IcecreamOutlined";import hS from"@mui/icons-material/WorkspacePremiumOutlined";import kS from"@mui/icons-material/DiamondOutlined";import TS from"@mui/icons-material/VaccinesOutlined";import{jsx as vS}from"react/jsx-runtime";var Gi="bookmark",Hr="label",wt="notifications",zt="event",ds="warning",ps="#e53e3e",nf="none",rf=[{key:nf,Icon:Jp},{key:"label",Icon:NT},{key:"bookmark",Icon:Em},{key:"flag",Icon:FT},{key:"star",Icon:HT},{key:"folder",Icon:WT},{key:"event",Icon:$T},{key:"build",Icon:VT},{key:"shipping",Icon:UT},{key:"store",Icon:KT},{key:"groups",Icon:GT},{key:"idea",Icon:jT},{key:"heart",Icon:YT},{key:"assignment",Icon:XT},{key:"home",Icon:QT},{key:"work",Icon:JT},{key:"school",Icon:ZT},{key:"hospital",Icon:ey},{key:"restaurant",Icon:ty},{key:"flower",Icon:oy},{key:"car",Icon:ny},{key:"campaign",Icon:ry},{key:"savings",Icon:ay},{key:"inventory",Icon:iy},{key:"cleaning",Icon:ly},{key:"handyman",Icon:Zp},{key:"phone",Icon:sy},{key:"email",Icon:cy},{key:"cart",Icon:my},{key:"chart",Icon:uy},{key:"print",Icon:dy},{key:"security",Icon:py},{key:"alarm",Icon:fy},{key:"attach",Icon:gy},{key:"camera",Icon:xy},{key:"image",Icon:by},{key:"book",Icon:hy},{key:"edit",Icon:ky},{key:"key",Icon:Ty},{key:"lock",Icon:yy},{key:"unlock",Icon:Cy},{key:"settings",Icon:Sy},{key:"cloud",Icon:vy},{key:"wifi",Icon:By},{key:"computer",Icon:_y},{key:"smartphone",Icon:Iy},{key:"tv",Icon:wy},{key:"clock",Icon:Dy},{key:"timer",Icon:Ey},{key:"map",Icon:Ry},{key:"place",Icon:Py},{key:"navigation",Icon:My},{key:"flight",Icon:Oy},{key:"train",Icon:Ly},{key:"bus",Icon:Ay},{key:"bike",Icon:qy},{key:"walk",Icon:zy},{key:"run",Icon:Ny},{key:"fitness",Icon:Fy},{key:"soccer",Icon:Hy},{key:"trophy",Icon:Wy},{key:"gift",Icon:$y},{key:"cake",Icon:Vy},{key:"coffee",Icon:ef},{key:"pizza",Icon:Uy},{key:"bag",Icon:Ky},{key:"card",Icon:tf},{key:"bank",Icon:Gy},{key:"wallet",Icon:jy},{key:"money",Icon:Yy},{key:"receipt",Icon:Xy},{key:"calculate",Icon:Qy},{key:"trending",Icon:Jy},{key:"listalt",Icon:Zy},{key:"task",Icon:eC},{key:"doneall",Icon:tC},{key:"warning",Icon:oC},{key:"info",Icon:nC},{key:"help",Icon:rC},{key:"support",Icon:aC},{key:"person",Icon:iC},{key:"personadd",Icon:lC},{key:"badge",Icon:sC},{key:"sun",Icon:cC},{key:"moon",Icon:mC},{key:"fire",Icon:uC},{key:"water",Icon:dC},{key:"bolt",Icon:pC},{key:"renew",Icon:fC},{key:"science",Icon:gC},{key:"medical",Icon:xC},{key:"notifications",Icon:bC},{key:"send",Icon:hC},{key:"link",Icon:kC},{key:"public",Icon:TC},{key:"apartment",Icon:of},{key:"plumbing",Icon:yC},{key:"electrical",Icon:CC},{key:"chat",Icon:SC},{key:"description",Icon:vC},{key:"factcheck",Icon:BC},{key:"rocket",Icon:_C},{key:"palette",Icon:IC},{key:"music",Icon:wC},{key:"video",Icon:DC},{key:"thumbup",Icon:EC},{key:"pin",Icon:RC},{key:"search",Icon:PC},{key:"eye",Icon:MC},{key:"verified",Icon:OC},{key:"target",Icon:LC},{key:"extension",Icon:AC},{key:"code",Icon:qC},{key:"bug",Icon:zC},{key:"robot",Icon:NC},{key:"storage",Icon:FC},{key:"qrcode",Icon:HC},{key:"download",Icon:WC},{key:"upload",Icon:$C},{key:"mic",Icon:VC},{key:"headphones",Icon:UC},{key:"movie",Icon:KC},{key:"game",Icon:GC},{key:"brush",Icon:jC},{key:"architecture",Icon:YC},{key:"engineering",Icon:XC},{key:"factory",Icon:QC},{key:"agriculture",Icon:JC},{key:"boat",Icon:ZC},{key:"motorcycle",Icon:eS},{key:"handshake",Icon:tS},{key:"gavel",Icon:oS},{key:"balance",Icon:nS},{key:"translate",Icon:rS},{key:"psychology",Icon:aS},{key:"pets",Icon:iS},{key:"celebration",Icon:lS},{key:"beach",Icon:sS},{key:"snow",Icon:cS},{key:"forest",Icon:mS},{key:"mountain",Icon:uS},{key:"hotel",Icon:dS},{key:"laundry",Icon:pS},{key:"chair",Icon:fS},{key:"bar",Icon:gS},{key:"burger",Icon:xS},{key:"icecream",Icon:bS},{key:"medal",Icon:hS},{key:"diamond",Icon:kS},{key:"vaccine",Icon:TS}],yS={cafe:ef,payment:tf,business:of,construction:Zp},Ki=null,us=null,ms=null,wm=0,Dm=new Set;function af(){return Ki?Promise.resolve():(ms||(ms=import("./chunks/muiIconCatalog-YYESXZNB.js").then(e=>{Ki=e.MUI_ICON_BY_KEY,us=e.MUI_ICON_GROUPS,wm+=1,Dm.forEach(t=>t())}).catch(()=>{ms=null})),ms)}function CS(e){return Dm.add(e),()=>Dm.delete(e)}function lf(){return zT(CS,()=>wm,()=>wm)}function sf(){let e=lf();return us||af(),{groups:[{id:"common",label:n("misc.frequentIcons"),options:rf},...us??[]],loading:!us}}var Qp=new Map;function SS(e){let t=Qp.get(e);if(t)return t;let a=r=>{let i=lf(),l=Ki?.[e]??Em;return vS(l,{...r})};return Qp.set(e,a),a}function Oe(e){if(e===nf)return null;let t=rf.find(r=>r.key===e)?.Icon;if(t)return t;let o=String(e??"");if(Ki?.[o])return Ki[o];let a=yS[o];return a||(o?(af(),SS(o)):Em)}function uN(e){return Oe(e)??Jp}var Rm={title:"",icon:Hr,icon_color:"",manager_name:"",manager_account_seq:0,receiver_names:[],receiver_account_seqs:[],is_notice:!1,is_event:!1,is_bug:!1,visibility:"involved",visibility_group_seq:0,repeat_rule:"",repeat_until:"",bug_repro:"",bug_device:"",bug_where:"",bug_version:"",sprint_seq:0,story_points:0,event_time:"",event_place:"",event_address:"",target_names:[],target_account_seqs:[],start_date:"",due_date:"",reminders:[],priority:"medium",label_keys:[],note:"",content:"",checklist:[],tab_key:""},Pm={createAttachmentFiles:[],createSubmitting:!1,attachmentUpload:null};function ji(e){let{formId:t="taskbox-create-form",initialValues:o,onValidate:a,onSubmit:r}=e;return BS({formId:t,initialValues:{...Rm,...o},onValidate:a,onSubmit:r})}import{createContext as _S,useContext as IS,useId as wS,useLayoutEffect as mf,useMemo as uf,useRef as Yi,useSyncExternalStore as DS}from"react";import{Box as ES}from"@mui/material";import{useGlobalForm as RS}from"@ehfuse/forma";var Mm=["min30_before","hour1_before","hour2_before","same_day","day_before","two_days_before","three_days_before","week_before","month_before"];function nn(e){let t=Array.isArray(e?.reminders)?e?.reminders:[e?.reminder],o=new Set;for(let a of t){let r=String(a??"").trim();Mm.includes(r)&&o.add(r)}return Mm.filter(a=>o.has(a))}function fs(e,t){if(t==="none")return[];let o=e.includes(t)?e.filter(a=>a!==t):[...e,t];return Mm.filter(a=>o.includes(a))}function Om(e){let t=[],o=Number(e.manager_account_seq??0)||0;o>0&&t.push({account_seq:o,name:e.manager_name||"",role:"manager"});let a=e.receiver_names??[];return(e.receiver_account_seqs??[]).forEach((r,i)=>{let l=Number(r)||0;l>0&&!t.some(s=>s.account_seq===l)&&t.push({account_seq:l,name:a[i]??"",role:"receiver"})}),t}function Lm(e){if(e<=0)return[];let t=Math.floor(100/e),o=100-t*e;return Array.from({length:e},(a,r)=>t+(r<o?1:0))}function cf(e){let t=Om(e),o=e.contributions??[],a={};if(o.length>0){for(let l of t){let s=o.find(c=>Number(c.account_seq)===l.account_seq);a[String(l.account_seq)]=String(Number(s?.percent??0)||0)}return a}let r=t.some(l=>l.role==="manager"),i=Lm(t.length);return t.forEach((l,s)=>{a[String(l.account_seq)]=String(r?l.role==="manager"?100:0:i[s])}),a}function gs(e){let t=String(e??"").replace(/%/g,"").trim();if(!/^\d{1,3}$/.test(t))return null;let o=Number(t);return o>=0&&o<=100?o:null}function Am(e,t){return t.reduce((o,a)=>o+(gs(e[String(a.account_seq)]??"")??0),0)}function qm(e,t){return t.map(o=>({account_seq:o.account_seq,percent:gs(e[String(o.account_seq)]??"")??0}))}import{Fragment as df,jsx as Nm}from"react/jsx-runtime";var $a=["title","status","priority","start_date","due_date","reminders","tab_key","label_keys","note","event_time","event_place","event_address","story_points","sprint_seq","bug_repro","bug_device","bug_where","bug_version","resolution","contributions"];function Xi(e){return{title:e.title??"",status:String(e.status??""),priority:e.priority,start_date:e.start_date??"",due_date:e.due_date??"",reminders:nn(e),tab_key:String(e.tab_key??""),label_keys:e.label_keys??[],note:e.note??"",event_time:e.event_time??"",event_place:e.event_place??"",event_address:e.event_address??"",story_points:Number(e.story_points??0)||0,sprint_seq:Number(e.sprint_seq??0)||0,bug_repro:e.bug_repro??"",bug_device:e.bug_device??"",bug_where:e.bug_where??"",bug_version:e.bug_version??"",resolution:String(e.resolution??""),contributions:cf(e)}}function zm(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,a)=>o===t[a]);if(e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)){let o=e,a=t,r=Object.keys(o);return r.length===Object.keys(a).length&&r.every(i=>o[i]===a[i])}return!1}var PS=e=>$a.includes(e);function Fm(e){let t=wS(),o=RS({formId:`taskbox-detail-form-${t}`,initialValues:Xi(e)}),a=Yi(e);a.current=e;let r=Yi(null);r.current||(r.current=Xi(e));let i=Yi(e.seq),l=Yi(new Set),{handle:s,syncField:c}=uf(()=>{let u=(d,p)=>{if(l.current.has(d))return;let f=r.current,g=o.getFormValue(d),x=p[d];!zm(g,x)&&zm(g,f[d])&&o.setFormValue(d,x),f[d]=x};return{handle:{form:o,getTask:()=>a.current,focusField:d=>{l.current.add(d)},blurField:d=>{l.current.delete(d),PS(d)&&setTimeout(()=>u(d,Xi(a.current)),0)}},syncField:u}},[]);return mf(()=>{let u=Xi(e);if(i.current!==e.seq){i.current=e.seq,l.current.clear();for(let m of $a)zm(o.getFormValue(m),u[m])||o.setFormValue(m,u[m]);r.current=u;return}for(let m of $a)c(m,u)},[e]),s}var Hm=_S(null);function Wm(){return IS(Hm)}function Wo({form:e,name:t,children:o}){let a=e.useFormValue(t);return Nm(df,{children:o(a)})}function cr({name:e,children:t}){let o=Wm();return o?Nm(ES,{component:"span","data-taskbox-field":e,onFocus:()=>o.focusField(e),onBlur:()=>o.blurField(e),sx:{display:"contents"},children:t}):Nm(df,{children:t})}function Qi(e){let t=Yi({value:e,notified:e,listeners:new Set});return t.current.value=e,mf(()=>{let o=t.current;o.notified!==o.value&&(o.notified=o.value,o.listeners.forEach(a=>a()))}),uf(()=>({get:()=>t.current.value,subscribe:o=>(t.current.listeners.add(o),()=>{t.current.listeners.delete(o)})}),[])}function xs(e){return DS(e.subscribe,e.get,e.get)}import{useGlobalFormaState as MS}from"@ehfuse/forma";var pf="taskbox-ui-state";function Tn(){return MS({stateId:pf,initialValues:Pm})}import{useRef as LS}from"react";import{useModal as AS}from"@ehfuse/forma";import{ErrorAlert as $m,InfoAlert as gf}from"@ehfuse/alerts";function ff(e,t){let o=Number(t)||50,a=o*1024*1024,r=e.filter(s=>s.size>a),i=e.filter(s=>s.size<=a),l=r.length>0?n("section.attachLimit",{limitMb:o,value:r.map(s=>s.name).join(", ")}):null;return{accepted:i,rejected:r,message:l}}var Ji=[{value:"daily",get label(){return n("repeat.daily")}},{value:"weekly",get label(){return n("repeat.weekly")}},{value:"monthly",get label(){return n("repeat.monthly")}},{value:"yearly",get label(){return n("repeat.yearly")}}];function bs(e){return Ji.find(t=>t.value===e)?.label??n("common.none")}function OS(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;let t=new Date(`${e}T00:00:00`);return Number.isNaN(t.getTime())?null:t}function hs(e,t){let o=OS(e);if(!o)return"";let a=new Date(o);t==="daily"?a.setMonth(a.getMonth()+1):t==="weekly"?a.setMonth(a.getMonth()+3):t==="monthly"?a.setFullYear(a.getFullYear()+1):a.setFullYear(a.getFullYear()+3);let r=i=>String(i).padStart(2,"0");return`${a.getFullYear()}-${r(a.getMonth()+1)}-${r(a.getDate())}`}var Vm="#0f9d58";function ks(e){let t=o=>String(o).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function qS(){let e=new Date,t=o=>String(o).padStart(2,"0");return`${ks(e)} ${t(e.getHours())}:${t(e.getMinutes())}`}var zS=10;function NS(){let e=new Date;return e.setDate(e.getDate()+1),`${ks(e)} ${String(zS).padStart(2,"0")}:00`}function xf(e,t){let o=e?NS():qS();return t&&t<o?"":o}function Um(e,t,o){let{presetTitle:a="",presetContent:r="",presetVisibility:i,presetVisibilityGroupSeq:l=0,presetDueDate:s="",presetTabKey:c="",presetManager:u=null,isNotice:m=!1,defaultBug:d=!1}=o;e.setFormValues({...e.getFormValues(),title:a,icon:m?wt:d?ds:Hr,icon_color:m?"#e5484d":d?ps:"",manager_name:u?.name??"",manager_account_seq:u?.accountSeq??0,receiver_names:[],receiver_account_seqs:[],is_notice:m,is_event:!1,is_bug:d,visibility:i??(d?"all":"involved"),visibility_group_seq:i==="group"?l:0,bug_repro:"",bug_device:"",bug_where:"",bug_version:"",event_time:"",event_place:"",event_address:"",target_names:[],target_account_seqs:[],start_date:xf(m,s),due_date:s,reminders:[],priority:"medium",note:"",content:r,checklist:[],tab_key:c}),t.setValue("createAttachmentFiles",[])}function bf(e){return e.title.trim()?e.is_event&&!e.due_date?($m(n("create.selectEventDate")),!1):e.start_date&&e.due_date&&e.due_date<e.start_date?($m(n("create.dueAfterStart")),!1):!0:($m(e.is_notice?n("create.enterNoticeTitle"):e.is_event?n("create.enterEventTitle"):e.is_bug?n("create.enterBugTitle"):n("create.enterTaskTitle")),!1)}function Km(e,t){let o=e.getFormValue("is_bug")?"bug":e.getFormValue("is_event")?"event":"task";if(o===t)return;e.setFormValue("is_event",t==="event"),e.setFormValue("is_bug",t==="bug"),t==="event"?e.setFormValue("start_date",""):o==="event"&&!e.getFormValue("start_date")&&e.setFormValue("start_date",xf(!1,String(e.getFormValue("due_date")??""))),e.setFormValue("visibility",t==="bug"?"all":"involved"),e.setFormValue("visibility_group_seq",0),t==="bug"&&(e.setFormValue("repeat_rule",""),e.setFormValue("repeat_until",""));let a=e.getFormValue("icon"),r=e.getFormValue("icon_color"),i=[Hr,"event",ds].includes(a),l=!r||r===Vm||r===ps;i&&e.setFormValue("icon",t==="event"?"event":t==="bug"?ds:Hr),l&&e.setFormValue("icon_color",t==="event"?Vm:t==="bug"?ps:"")}function Gm(e,t){if(t===""){e.setFormValue("repeat_rule",""),e.setFormValue("repeat_until","");return}let o;if(e.getFormValue("is_event")){if(o=String(e.getFormValue("due_date")??"").slice(0,10),!o){gf(n("create.repeatNeedsDate"));return}}else o=String(e.getFormValue("start_date")??"").slice(0,10),o||(o=ks(new Date),e.getFormValue("is_notice")&&e.setFormValue("start_date",o)),e.setFormValue("due_date","");e.setFormValue("repeat_rule",t),e.setFormValue("repeat_until",hs(o,t))}function jm(e,t){e.setFormValue("repeat_until",ks(t))}function Zi(e,t,o=0){e.setFormValue("visibility",t),e.setFormValue("visibility_group_seq",t==="group"?o:0)}function Ts(e){return e.getFormValue("checklist")??[]}function Ym(e,t){e.setFormValue("checklist",[...Ts(e),{label:t,checked:!1}])}function Xm(e,t,o){e.setFormValue("checklist",Ts(e).map((a,r)=>r===t?{...a,checked:o}:a))}function Qm(e,t){e.setFormValue("checklist",Ts(e).filter((o,a)=>a!==t))}function Jm(e,t,o){e.setFormValue("checklist",Ts(e).map((a,r)=>r===t?{...a,label:o}:a))}function Zm(e,t,o){let a=ff(t,o);a.message&&gf(a.message),a.accepted.length!==0&&e.setValue("createAttachmentFiles",[...e.getValue("createAttachmentFiles")??[],...a.accepted])}function eu(e,t){let o=e.getValue("createAttachmentFiles")??[];e.setValue("createAttachmentFiles",o.filter((a,r)=>r!==t))}function FS(e){let{formId:t="taskbox-create-form",modalId:o="taskbox-create-drawer",initialValues:a}=e,r=LS(e);r.current=e;let i=Tn(),l={form:AS({modalId:o})};return{form:ji({formId:t,initialValues:a,onValidate:async c=>bf(c)?await r.current.onValidate?.(c)??!0:!1,onSubmit:async c=>{if(i.getValue("createSubmitting"))return!1;i.setValue("createSubmitting",!0);try{let u=i.getValue("createAttachmentFiles")??[];return await r.current.onSubmit(c,u)===!1?!1:(i.setValue("createAttachmentFiles",[]),l.form.close(),!0)}finally{i.setValue("createSubmitting",!1)}}}),modals:l,uiState:i,openCreate:l.form.open}}import{useCallback as HS,useEffect as tu,useId as WS,useRef as ou}from"react";import{useGlobalForm as $S}from"@ehfuse/forma";import{ConfirmDialog as hf,InfoAlert as VS,SuccessAlert as kf}from"@ehfuse/alerts";async function nu(e,t,o){let a=e.repeat_rule??"";if(t===a)return;if(t===""){await hf({title:n("detail.stopRepeat"),message:n("detail.stopRepeatConfirm")})&&o?.(e.seq,"","");return}let r=e.is_event?String(e.due_date??"").slice(0,10):String(e.start_date??"").slice(0,10)||String(e.due_date??"").slice(0,10);if(!r){VS(e.is_event?n("create.repeatNeedsDate"):e.is_notice?n("detail.repeatNeedsPostTime"):n("detail.repeatNeedsStart"));return}a&&!await hf({title:n("detail.changeRepeat"),message:n("detail.changeRepeatConfirm")})||o?.(e.seq,t,hs(r,t))}function ru(e,t,o){let a=l=>String(l).padStart(2,"0"),r=`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())}`,i=e.repeat_rule??"";i&&o?.(e.seq,i,r)}function au(e){L();let{open:t,task:o,isMobile:a,bodyProps:r,onSaveFields:i,onChangeTitle:l,onChangeIcon:s,onChangeIconColor:c}=e,{onEditSessionEnd:u}=le(),m=ou(null);o&&(m.current=o);let d=o??m.current,p=WS(),f=$S({formId:`taskbox-detail-changes-${p}`,initialValues:{changes:{}},onSubmit:C=>F(C.changes??{})}),x=f.useFormValue("changes")??{},h=Object.keys(x).length>0;tu(()=>{f.setFormValue("changes",{})},[o?.seq,t]);let E=C=>{let y=f.getFormValue("changes")??{};f.setFormValue("changes",{...y,...C})},b=ou(null),B=HS(()=>{let C=b.current;b.current=null,C?.edited&&C.seq>0&&u?.(C.seq)},[u]),T=()=>{let C=o?.seq??m.current?.seq??0;C&&(b.current?.seq===C?b.current.edited=!0:b.current={seq:C,edited:!0})};tu(()=>{let C=o?.seq??0;if(t&&C>0){b.current?.seq!==C&&(B(),b.current={seq:C,edited:!1});return}B()},[t,o?.seq,B]);let z=ou(B);z.current=B,tu(()=>()=>z.current(),[]);let k=d&&a&&h?{...d,...x}:d,_=k?.checklist??[],D=(C,y)=>{T(),a?E(C):y()};function F(C){if(!d)return!1;f.setFormValue("changes",{});let y=d.seq,I=!!b.current?.edited;b.current&&(b.current.edited=!1),I&&y>0&&u?.(y);let S=C.title===void 0?void 0:String(C.title).trim();if(i){let O={...C};return S!==void 0&&(S?O.title=S:delete O.title),Object.keys(O).length>0&&i(y,O),kf({message:n("detail.saved"),position:"center"}),!0}return S&&l(y,S),C.icon!==void 0&&s(y,String(C.icon)),C.icon_color!==void 0&&c?.(y,String(C.icon_color)),C.status!==void 0&&r.onChangeStatus(y,C.status),C.label_keys!==void 0&&r.onChangeLabels(y,C.label_keys??[]),C.tab_key!==void 0&&r.onChangeProject(y,String(C.tab_key??"")),C.start_date!==void 0&&r.onChangeDate(y,"start_date",String(C.start_date??"")),C.due_date!==void 0&&r.onChangeDate(y,"due_date",String(C.due_date??"")),C.reminders!==void 0&&r.onChangeReminder(y,C.reminders),C.priority!==void 0&&r.onChangePriority(y,C.priority),C.event_time!==void 0&&r.onChangeEventTime?.(y,String(C.event_time??"")),C.event_place!==void 0&&r.onChangeEventPlace?.(y,String(C.event_place??"")),C.event_address!==void 0&&r.onChangeEventAddress?.(y,String(C.event_address??"")),C.content!==void 0&&r.onChangeContent(y,String(C.content??"")),C.note!==void 0&&r.onChangeNote(y,String(C.note??"")),C.visibility!==void 0&&r.onChangeVisibility?.(y,C.visibility,Number(C.visibility_group_seq??0)),kf({message:n("detail.saved"),position:"center"}),!0}let R={...r,onChangeStatus:(C,y)=>{let I=y==="in_progress"||y==="bug_in_progress",S=!String(k?.start_date??"").trim(),O=I&&S?{status:y,start_date:Up()}:{status:y};D(O,()=>r.onChangeStatus(C,y))},onChangeLabels:(C,y)=>D({label_keys:y},()=>r.onChangeLabels(C,y)),onChangeProject:(C,y)=>D({tab_key:y},()=>r.onChangeProject(C,y)),onChangeDate:(C,y,I)=>D({[y]:I},()=>r.onChangeDate(C,y,I)),onChangeReminder:(C,y)=>D({reminders:y},()=>r.onChangeReminder(C,y)),onChangePriority:(C,y)=>D({priority:y},()=>r.onChangePriority(C,y)),onChangeEventTime:(C,y)=>D({event_time:y},()=>r.onChangeEventTime?.(C,y)),onChangeEventPlace:(C,y)=>D({event_place:y},()=>r.onChangeEventPlace?.(C,y)),onChangeEventAddress:(C,y)=>D({event_address:y},()=>r.onChangeEventAddress?.(C,y)),onChangeContent:(C,y)=>D({content:y},()=>r.onChangeContent(C,y)),onChangeNote:(C,y)=>D({note:y},()=>r.onChangeNote(C,y)),onMemberEdit:(C,y)=>r.onMemberEdit(C,y,a?I=>E(I):null),onChangeNoteDraft:a?(C,y)=>D({note:y},()=>{}):void 0,onChangeVisibility:r.onChangeVisibility?(C,y,I)=>D({visibility:y,visibility_group_seq:I},()=>r.onChangeVisibility?.(C,y,I)):void 0,onAddChecklistItem:(C,y)=>D({checklist:[..._,{label:y,checked:!1}]},()=>r.onAddChecklistItem(C,y)),onToggleChecklistItem:(C,y,I)=>D({checklist:_.map((S,O)=>O===y?{...S,checked:I}:S)},()=>r.onToggleChecklistItem(C,y,I)),onRemoveChecklistItem:(C,y)=>D({checklist:_.filter((I,S)=>S!==y)},()=>r.onRemoveChecklistItem(C,y)),onUpdateChecklistItem:r.onUpdateChecklistItem?(C,y,I)=>D({checklist:_.map((S,O)=>O===y?{...S,label:I}:S)},()=>r.onUpdateChecklistItem?.(C,y,I)):void 0,onReorderChecklist:r.onReorderChecklist?(C,y)=>D({checklist:y},()=>r.onReorderChecklist?.(C,y)):void 0,onAddAttachments:(C,y)=>{T(),r.onAddAttachments(C,y)},onRemoveAttachment:(C,y)=>{T(),r.onRemoveAttachment(C,y)},onReorderAttachments:r.onReorderAttachments?(C,y,I)=>{T(),r.onReorderAttachments?.(C,y,I)}:void 0,onLinkChecklistTask:r.onLinkChecklistTask?(C,y,I)=>D({checklist:[..._,{label:I,checked:!1,task_seq:y}]},()=>r.onLinkChecklistTask?.(C,y,I)):void 0};return{form:f,baseTask:d,task:k,hasPendingChanges:h,stagedBodyProps:R,changeTitle:(C,y)=>D({title:y},()=>l(C,y)),changeIcon:(C,y)=>D({icon:y},()=>s(C,y)),changeIconColor:(C,y)=>D({icon_color:y},()=>c?.(C,y))}}import{useMemo as US}from"react";import{useTheme as KS}from"@mui/material";function Va(e,t){let o=Math.max(0,Math.min(1,t));if(o<=0)return"transparent";let a=e.trim().replace("#",""),r=a.length===3?a.split("").map(c=>c+c).join(""):a;if(!/^[0-9a-fA-F]{6}$/.test(r))return e;let i=Number.parseInt(r.slice(0,2),16),l=Number.parseInt(r.slice(2,4),16),s=Number.parseInt(r.slice(4,6),16);return`rgba(${i}, ${l}, ${s}, ${o})`}function Tf(e,t){let o=Math.max(0,Math.min(1,t)),a=e.trim().replace("#",""),r=a.length===3?a.split("").map(u=>u+u).join(""):a;if(!/^[0-9a-fA-F]{6}$/.test(r))return e;let i=u=>Math.round(u+(255-u)*o),l=i(Number.parseInt(r.slice(0,2),16)),s=i(Number.parseInt(r.slice(2,4),16)),c=i(Number.parseInt(r.slice(4,6),16));return`#${[l,s,c].map(u=>u.toString(16).padStart(2,"0")).join("")}`}function iu(e,t,o){return o==="dark"?{accent:e,accentContrast:t,accentSoft:"#1d2b45",accentOnSurface:"#b3d1ff",danger:"#f87171",dangerSoft:"#3a1f22",success:"#4ade80",warning:"#fbbf24",textStrong:"#ffffff",textPrimary:"#e2e8f0",textSecondary:"#a3adbb",textMuted:"#77808d",textInverse:"#0f1216",surface:"#161a1f",surfaceSubtle:"#1e232a",surfaceHover:"#272d36",surfaceHoverStrong:"#323a45",border:"#2c333c",borderStrong:"#3b434e"}:{accent:e,accentContrast:t,accentSoft:"#eef4ff",accentOnSurface:e,danger:"#e5484d",dangerSoft:"#fdebec",success:"#16a34a",warning:"#e8a33d",textStrong:"#000000",textPrimary:"#37352f",textSecondary:"#787774",textMuted:"#9a9a97",textInverse:"#ffffff",surface:"#ffffff",surfaceSubtle:"#fafaf9",surfaceHover:"#f8f8f7",surfaceHoverStrong:"#efefed",border:"#e6e6e3",borderStrong:"#dedddb"}}function GS(e,t){let o=t==="dark";return{bg:o?Tf(e.accent,.45):e.accent,color:o?e.textInverse:e.accentContrast,border:"none",fontSize:11.5,fontWeight:600,minWidth:20,width:34,borderRadius:999,paddingX:.6,paddingY:.4}}function yf(e,t){return{...e,...t??{}}}function ys(e,t="light"){let o=t==="dark",a=GS(e,t),r=e.accentOnSurface;return{mode:t,colors:e,table:{bg:e.surface,borderColor:e.borderStrong,headerBg:e.surface,headerColor:e.textSecondary,headerActiveColor:e.textStrong,headerFilteredColor:r,headerFontSize:13,rowBg:e.surface,rowColor:e.textPrimary,rowSubColor:e.textSecondary,rowTitleColor:e.textStrong,rowTitleFontWeight:t==="dark"?400:500,rowHoverBg:e.surfaceHover,rowBorderColor:e.border,cellHoverBg:e.surfaceHoverStrong,emptyColor:e.textMuted,groupHeader:{bg:e.surfaceSubtle,hoverBg:e.surfaceHover,borderColor:e.border,labelColor:t==="dark"?e.textStrong:e.textPrimary,labelFontSize:15.5,labelFontWeight:t==="dark"?400:700,minHeight:48,badge:{...a,borderRadius:4,width:34}}},board:{columnBg:t==="dark"?e.surfaceSubtle:e.surface,columnHeaderColor:e.textPrimary,columnHeaderFontSize:13.5,badge:{...a,borderRadius:4,width:34}},summary:{gaugeTrackColor:t==="dark"?e.borderStrong:"#ececea",gaugeBarColor:r,gaugeCompleteColor:e.success,gaugeHeight:6,numberColor:r,overdueColor:e.danger,textColor:e.textStrong},actionButton:{bg:"#2f80ed",color:"#ffffff",hoverBg:"#2470dd",bgImage:"linear-gradient(180deg, #5ba1f5 0%, #2f80ed 100%)",hoverBgImage:"linear-gradient(180deg, #4d95ee 0%, #2470dd 100%)"},tabs:{bg:t==="dark"?e.surfaceSubtle:e.surface,color:t==="dark"?e.textSecondary:e.textStrong,hoverBg:e.surfaceHover,borderColor:t==="dark"?e.border:e.borderStrong,selectedBg:t==="dark"?e.surfaceHover:e.textStrong,selectedColor:t==="dark"?e.textStrong:e.surface},calendar:{bg:e.surface,borderColor:o?"#3a434f":e.border,headerBg:e.surfaceSubtle,headerColor:e.textSecondary,cellBg:o?"#1a1e24":e.surface,dateBandBg:e.surface,otherMonthBg:o?"#1a1e24":e.surface,todayBg:e.accentSoft,hoverBg:e.surfaceHover,dateColor:e.textPrimary,holidayColor:e.danger},card:{bg:o?"#232a33":e.surface,borderColor:o?"#333c47":e.border,hoverBg:o?"#2b3441":e.surfaceHover,titleColor:e.textPrimary,subColor:e.textSecondary},timeline:{bg:e.surface,gridColor:e.border,headerBg:e.surfaceSubtle,headerColor:e.textSecondary,todayLineColor:e.accentOnSurface,barColor:e.accentOnSurface,overdueBarColor:e.danger},avatar:{ringColor:t==="dark"?e.textStrong:e.accent,separatorColor:e.surface},chip:{borderRadius:.75,fontSize:13,fontWeight:500,plainColor:t==="dark"?e.textSecondary:"#57564f",plainDotColor:e.textMuted,darkBgAlpha:.15,darkTextSource:"dot"}}}function lu(e,t){if(!t)return e;let o=t.mode??e.mode,r={...o===e.mode?e.colors:iu(e.colors.accent,e.colors.accentContrast,o),...t.colors??{}},i=ys(r,o),{groupHeader:l,...s}=t.table??{},{badge:c,...u}=t.board??{},{badge:m,...d}=l??{};return{mode:o,colors:r,table:{...i.table,...s,groupHeader:{...i.table.groupHeader,...d,badge:yf(i.table.groupHeader.badge,m)}},board:{...i.board,...u,badge:yf(i.board.badge,c)},summary:{...i.summary,...t.summary??{}},chip:{...i.chip,...t.chip??{}},actionButton:{...i.actionButton,...t.actionButton??{}},tabs:{...i.tabs,...t.tabs??{}},avatar:{...i.avatar,...t.avatar??{}},calendar:{...i.calendar,...t.calendar??{}},card:{...i.card,...t.card??{}},timeline:{...i.timeline,...t.timeline??{}}}}function jS(e={}){let{mode:t="light",accent:o="#2563eb",accentContrast:a="#ffffff",input:r}=e;return lu(ys(iu(o,a,t),t),r)}function xe(){let e=KS(),{theme:t}=le(),o=e.palette.primary.main,a=e.palette.primary.contrastText,r=e.palette.mode==="dark"?"dark":"light";return US(()=>lu(ys(iu(o,a,r),r),t),[o,a,r,t])}import{useCallback as ro,useMemo as ao,useRef as aB,useState as Xr}from"react";import{Box as iB,Divider as lB,ListItemIcon as sB,Menu as pg,MenuItem as Xs}from"@mui/material";import cB from"@mui/icons-material/Add";import Au from"@mui/icons-material/Check";import mB from"@mui/icons-material/InboxOutlined";import{VirtualDataTable as uB}from"@ehfuse/mui-virtual-data-table";import{Box as su}from"@mui/material";import{jsx as Cf,jsxs as XS}from"react/jsx-runtime";var YS={high:{get label(){return n("priority.high")},dot:"#e5484d",bgcolor:"#fdebec",color:"#c4554d"},medium:{get label(){return n("priority.medium")},dot:"#2f80ed",bgcolor:"#e3eefb",color:"#1d4f91"},low:{get label(){return n("priority.low")},dot:"#9a9a97",bgcolor:"#efefed",color:"#57564f"}};function uo({priority:e,small:t=!1,plain:o=!1,dotOnly:a=!1}){L();let r=YS[e];if(a)return Cf(su,{component:"span",role:"img","aria-label":n("menu.priorityLabel",{label:r.label}),title:n("menu.priorityLabel",{label:r.label}),sx:{display:"inline-block",flexShrink:0,width:10,height:10,borderRadius:"50%",bgcolor:r.dot}});let i=xe(),l=i.mode==="dark",s=o||e==="low";return XS(su,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:t?.5:.75,px:s?0:t?.9:1.25,py:s?0:t?.25:.5,borderRadius:.75,fontSize:t?11.5:13,fontWeight:500,bgcolor:s?"transparent":l?Va(r.dot,i.chip.darkBgAlpha):r.bgcolor,color:s?l?i.chip.plainColor:r.color:l?i.chip.darkTextSource==="fg"?r.color:r.dot:r.color,whiteSpace:"nowrap"},children:[Cf(su,{component:"span",sx:{width:t?6:8,height:t?6:8,borderRadius:"50%",bgcolor:r.dot}}),r.label]})}import{Divider as t0,Menu as o0,MenuItem as If}from"@mui/material";import n0 from"@mui/icons-material/Check";function Nn(){return{}}var cu=[{key:"always",get name(){return n("bug.reproAlways")}},{key:"often",get name(){return n("bug.reproOften")}},{key:"sometimes",get name(){return n("bug.reproSometimes")}},{key:"once",get name(){return n("bug.reproOnce")}},{key:"unable",get name(){return n("bug.reproUnable")}}],mu=[{key:"desktop",get name(){return n("bug.deviceDesktop")}},{key:"tablet",get name(){return n("bug.deviceTablet")}},{key:"mobile",get name(){return n("bug.deviceMobile")}}],uu=[{key:"fixed",get name(){return n("bug.resFixed")}},{key:"duplicate",get name(){return n("section.duplicate")}},{key:"cannot_reproduce",get name(){return n("bug.reproUnable")}},{key:"by_design",get name(){return n("bug.resByDesign")}},{key:"wont_fix",get name(){return n("bug.resWontFix")}}];function Sf(e){return cu.find(t=>t.key===e)?.name??""}function vf(e){return mu.find(t=>t.key===e)?.name??""}function Cs(e){return uu.find(t=>t.key===e)?.name??""}function du(e,t=new Date){if(!e.is_event)return!1;let o=String(e.due_date??"").trim().slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(o))return!1;let a=String(e.event_time??"").trim();if(/^\d{2}:\d{2}$/.test(a)){let i=new Date(`${o}T${a}:00`);return!Number.isNaN(i.getTime())&&i.getTime()<=t.getTime()}let r=new Date(`${o}T00:00:00`);return Number.isNaN(r.getTime())?!1:(r.setDate(r.getDate()+1),r.getTime()<=t.getTime())}function Ss(e,t=new Date){return e.is_event?du(e,t):!!e.completed}var Mo=[{key:"not_started",get name(){return n("status.notStarted")},bg:"#efefed",fg:"#57564f",dot:"#9a9a97"},{key:"in_progress",get name(){return n("status.inProgress")},bg:"#dcf2e3",fg:"#1f6b3a",dot:"#2f9e5b"},{key:"review_waiting",get name(){return n("status.reviewWaiting")},bg:"#ede9fe",fg:"#5b3fa8",dot:"#8b5cf6"},{key:"hold",get name(){return n("status.hold")},bg:"#fbeee0",fg:"#8a5a2b",dot:"#d9730d"}],ol=Mo;function vs(e){return Mo.find(t=>t.key===e)??Mo[0]}var el={key:"completed",get name(){return n("common.done")},bg:"#e3eefb",fg:"#1d4f91",dot:"#2f80ed"};function Nt(e){if(e.is_notice)return Bf(e.status);if(e.is_bug&&e.completed){let t=Cs(e.resolution)||n("common.done");return{...el,name:t}}return e.completed&&e.status!=="hold"?el:e.is_bug?JS(e.status):vs(e.status)}var QS={key:"event_ended",get name(){return n("status.closedBug")},bg:"#efefed",fg:"#57564f",dot:"#9a9a97"};function nl(e){return du(e)?QS:null}var tl=[{key:"notice_scheduled",get name(){return n("status.noticeScheduled")},bg:"#faf1d7",fg:"#8a6d1d",dot:"#e8a33d"},{key:"notice_active",get name(){return n("status.noticeActive")},bg:"#dcf2e3",fg:"#1f6b3a",dot:"#2f9e5b"},{key:"notice_closed",get name(){return n("status.closedBug")},bg:"#efefed",fg:"#57564f",dot:"#9a9a97"}];function Bf(e){return tl.find(t=>t.key===e)??tl[1]}var pu="__closed__",ga=[{key:"bug_received",get name(){return n("status.bugReceived")},bg:"#fdeaea",fg:"#9b2c2c",dot:"#e53e3e"},{key:"bug_confirmed",get name(){return n("status.bugConfirmed")},bg:"#faf1d7",fg:"#8a6d1d",dot:"#e8a33d"},{key:"bug_in_progress",get name(){return n("status.inProgress")},bg:"#dcf2e3",fg:"#1f6b3a",dot:"#2f9e5b"},{key:"bug_hold",get name(){return n("status.hold")},bg:"#efefed",fg:"#57564f",dot:"#9a9a97"}],TF=[...ga.filter(e=>e.key!=="bug_hold"),{key:pu,get name(){return n("common.done")},bg:"#e3eefb",fg:"#1d4f91",dot:"#2f80ed"},...ga.filter(e=>e.key==="bug_hold")];function JS(e){return ga.find(t=>t.key===e)??ga[0]}function Bs(e){return e.is_notice?tl:e.is_bug?ga:ol}function yF(e){return e.status===jp}var ZS={in_progress:0,not_started:2,hold:3};function CF(e){return e.completed?9:ZS[String(e.status??"")]??2}function Ua(e,t){let o=new Map(t.map(r=>[r.key,r])),a=(e.label_keys??[]).map(r=>o.get(r)).filter(r=>!!r);if(e.is_event){let r=nl({is_event:!0,due_date:String(e.due_date??""),event_time:e.event_time});return r?[r,...a]:a}return e.is_notice?String(e.status??"")==="notice_active"?a:[Bf(e.status),...a]:e.is_bug?[Nt({...e,is_notice:!1}),...a]:e.completed?[el,...a]:[vs(e.status),...a]}function _f(e){return{bg:`${e}1f`,fg:e,dot:e}}function _s(e,t){return e.includes(t)?e.filter(o=>o!==t):[...e,t]}import{Box as Is}from"@mui/material";import{jsx as rl,jsxs as e0}from"react/jsx-runtime";function Ve({option:e,small:t=!1}){let o=xe(),a=o.mode==="dark",r=e.key==="not_started";return e0(Is,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:t?.5:.75,...r?{pr:t?.5:.75}:{px:t?.9:1.25},py:r?0:t?.25:.5,borderRadius:1.25,fontSize:t?11.5:13,fontWeight:500,bgcolor:r?"transparent":a?Va(e.dot,o.chip.darkBgAlpha):e.bg,color:r?a?o.chip.plainColor:e.fg:a?o.chip.darkTextSource==="fg"?e.fg:e.dot:e.fg,whiteSpace:"nowrap"},children:[rl(Is,{component:"span",sx:{width:t?6:8,height:t?6:8,borderRadius:"50%",bgcolor:e.dot,flexShrink:0}}),e.name]})}function wF({task:e,statusOptions:t,small:o=!1}){let a=Ua(e,t);return a.length===0?null:rl(Is,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5},children:a.map(r=>rl(Ve,{option:r,small:o},r.key))})}function Wr({labelKeys:e,labelOptions:t}){let o=new Map(t.map(r=>[r.key,r])),a=e.map(r=>o.get(r)).filter(r=>!!r);return a.length===0?null:rl(Is,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5},children:a.map(r=>rl(Ve,{option:r,small:!0},r.key))})}import{jsx as al,jsxs as wf}from"react/jsx-runtime";function Ka({anchorEl:e,value:t,options:o=Mo,onSelect:a,onComplete:r,onClose:i}){let l=Nn();return wf(o0,{anchorEl:e,open:!!e,onClose:i,transitionDuration:0,...l,children:[o.map(s=>wf(If,{onClick:()=>{a(s.key),i()},sx:{fontSize:14,minWidth:150,gap:1},children:[al(Ve,{option:s}),t===s.key?al(n0,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},s.key)),r?[al(t0,{sx:{my:.5}},"complete-divider"),al(If,{onClick:()=>{r(),i()},sx:{fontSize:14,minWidth:150,gap:1},children:al(Ve,{option:el})},"complete")]:null]})}var Df="";function NF(e){Df=e.trim()}function Ga(){return Df||n("task.noProject")}function ws(e){let t=String(e??"").trim().replace("T"," "),o=t.match(/^(\d{4})-(\d{2})-(\d{2})(?:[ ](\d{2}):(\d{2})(?::(\d{2}))?)?/);return o?new Date(Number(o[1]),Number(o[2])-1,Number(o[3]),Number(o[4]??0),Number(o[5]??0),Number(o[6]??0)):new Date(t)}function Dt(e,t="YYYY-MM-DD"){let o=typeof e=="string"?ws(e):e;if(!e||e===""||isNaN(o.getTime()))return"";let a=o.getFullYear(),r=(o.getMonth()+1).toString().padStart(2,"0"),i=o.getDate().toString().padStart(2,"0"),l=a.toString().slice(-2);switch(t){case"YYYY-MM-DD":return`${a}-${r}-${i}`;case"YY.MM.DD":return`${l}.${r}.${i}`;case"MM/DD/YYYY":return`${r}/${i}/${a}`;case"DD.MM.YYYY":return`${i}.${r}.${a}`;case"YYYYMMDD":return`${a}${r}${i}`;default:return t.replace(/YYYY/g,a.toString()).replace(/YY/g,l).replace(/MM/g,r).replace(/DD/g,i)}}function Ef(){return Dt(new Date)}var fu=[{value:"due",get label(){return n("group.byDue")}},{value:"status",get label(){return n("group.byStatus")}},{value:"manager",get label(){return n("group.byOwner")}},{value:"tab",get label(){return n("group.byProject")}},{value:"none",get label(){return n("group.none")}}],r0="__notice__",a0="__bug__",i0="__support__";function l0(e){let t=new Date(`${e}T00:00:00`);return t.setDate(t.getDate()+(6-t.getDay())),Dt(t)}var s0=[{key:"overdue",get label(){return n("group.overdue")}},{key:"today",get label(){return n("common.today")}},{key:"this_week",get label(){return n("group.thisWeek")}},{key:"later",get label(){return n("group.later")}},{key:"no_due",get label(){return n("group.noDue")}}];function c0(e,t,o){let a=e.due_date.slice(0,10);return a?a<t?"overdue":a===t?"today":a<=o?"this_week":"later":"no_due"}function m0(e){return typeof e=="function"?e:t=>t.is_bug?"bug":t.is_support?"support":null}function Ds(e,t,o,a=[],r=[],i="",l,s=!1){let c=e.filter(f=>f.is_notice);if(c.length>0){let f=Ds(e.filter(g=>!g.is_notice),t,o,a,r,i,l,s);return[{key:r0,label:n("tab.notice"),tasks:c},...f]}if(s){let f=m0(s),g=e.filter(h=>f(h)==="bug"),x=e.filter(h=>f(h)==="support");if(g.length>0||x.length>0){let h=Ds(e.filter(E=>f(E)===null),t,o,a,r,i,l,!1);return[...g.length>0?[{key:a0,label:n("tab.bug"),tasks:g}]:[],...x.length>0?[{key:i0,label:n("tab.support"),tasks:x}]:[],...h]}}let u=new Map,m=(f,g)=>{let x=u.get(f);x?x.push(g):u.set(f,[g])},d;if(t==="due"){let f=l0(o);for(let g of e)m(c0(g,o,f),g);d=s0}else if(t==="status"){for(let f of e)m(vs(f.status).key,f);d=Mo.map(f=>({key:f.key,label:f.name}))}else if(t==="tab"){for(let f of e)m(f.tab_key?.trim()||"__none__",f);d=[...a.filter(f=>!f.archived).map(f=>({key:f.key,label:f.label})),{key:"__none__",label:Ga()},...a.filter(f=>f.archived).map(f=>({key:f.key,label:n("table.archivedSuffix",{label:f.label})}))]}else if(l?.enabled){let f=Number(l.myAccountSeq??0),g=i.trim();for(let x of e){if(x.is_event){m("__event__",x);continue}if(!(Number(x.manager_account_seq??0)>0||String(x.manager_name??"").trim()!=="")){m("__none__",x);continue}let E=f>0&&Number(x.manager_account_seq??0)===f||!!g&&String(x.manager_name??"").trim()===g;m(E?"__manager__":"__reference__",x)}d=[{key:"__manager__",label:n("col.owner")},{key:"__none__",label:l?.unassignedLabel||n("group.personal")},{key:"__event__",label:n("group.event")},{key:"__reference__",label:n("col.cc")}]}else{let f=i.trim(),g=Number(l?.myAccountSeq??0),x=B=>g>0&&(B.receiver_account_seqs??[]).map(Number).includes(g)||!!f&&(B.receiver_names??[]).some(T=>String(T??"").trim()===f);for(let B of e){let T=String(B.manager_name??"").trim(),z=g>0&&Number(B.manager_account_seq??0)===g||!!f&&T===f;B.is_event?m("__event__",B):z?m(f||T,B):T&&x(B)?m("__reference__",B):m(T||"__none__",B)}let h=[...u.keys()].filter(B=>B!=="__none__"&&B!=="__event__"&&B!=="__reference__").sort((B,T)=>{if(f){if(B===f)return-1;if(T===f)return 1}return B.localeCompare(T)}),E=!!f&&h.includes(f),b=h.filter(B=>B!==f);d=[...E?[{key:f,label:n("col.owner")}]:[],{key:"__reference__",label:n("col.cc")},{key:"__none__",label:l?.unassignedLabel||n("group.personal")},{key:"__event__",label:n("group.event")},...b.map(B=>({key:B,label:B}))]}let p=[];for(let f of d){let g=u.get(f.key);!g||g.length===0||p.push({key:f.key,label:f.label,tasks:g})}return p}import{ConfirmActionPopper as dB}from"@ehfuse/mui-confirm-action";import{useEffect as u0,useState as d0}from"react";import{Box as p0,TextField as f0}from"@mui/material";import{ConfirmActionPopper as g0}from"@ehfuse/mui-confirm-action";import{jsx as gu}from"react/jsx-runtime";function oo(e,t){if(!e.completed||t<=0||!e.review_pending||(e.author_account_seq??0)!==t)return!1;let o=e.completed_by_account??0;return o>0&&o!==t}function Oo({open:e,anchorEl:t,nextCompleted:o,returnMode:a=!1,onCancel:r,onConfirm:i}){L();let[l,s]=d0("");u0(()=>{e&&s("")},[e]);let c=!o&&a;return gu(g0,{open:e,anchorEl:t,title:c?n("task.returnConfirm"):o?n("task.completeConfirm"):n("task.uncompleteConfirm"),confirmText:c?n("task.revert"):o?n("common.done"):n("task.unmark"),content:c?gu(p0,{sx:{mt:1},children:gu(f0,{autoFocus:!0,fullWidth:!0,multiline:!0,minRows:4,size:"small",placeholder:n("task.returnReasonPlaceholder"),value:l,onChange:u=>s(u.target.value),onClick:u=>u.stopPropagation(),onKeyDown:u=>u.stopPropagation()})}):void 0,onCancel:r,onConfirm:()=>{c&&!l.trim()||i(c?l.trim():"")}})}import{useTimePickerVariant as h0}from"@ehfuse/mui-form-controls";import{useMemo as Rf,useState as xu}from"react";import{Box as $r,Button as Pf,ButtonBase as Mf,Dialog as k0,Divider as Es,Menu as T0,MenuItem as y0,Popover as C0}from"@mui/material";import Of from"@mui/icons-material/ChevronRight";import S0 from"@mui/icons-material/Check";import v0 from"@mui/icons-material/NotificationsActiveOutlined";import{SimpleCalendar as B0,TimePicker as _0,WheelTimeSelector as I0}from"@ehfuse/mui-datetime-picker";import w0 from"@mui/icons-material/TimerOutlined";import{useEffect as x0,useState as b0}from"react";function Fn(e){let{loadHolidays:t}=le(),[o,a]=b0(()=>new Map),r=e.join(",");return x0(()=>{if(!t||!r){a(new Map);return}let i=!1;return t(r.split(",").map(Number)).then(l=>{if(i)return;let s=new Map;for(let c of l)s.has(c.date)||s.set(c.date,c.name);a(s)}).catch(()=>{}),()=>{i=!0}},[t,r]),o}import{Fragment as bu,jsx as Ut,jsxs as rn}from"react/jsx-runtime";var D0=9,E0=[{value:"min30_before",get label(){return n("reminder.min30")}},{value:"hour1_before",get label(){return n("reminder.hour1")}},{value:"hour2_before",get label(){return n("reminder.hour2")}}],Lf=[{value:"day_before",get label(){return n("reminder.day1")}},{value:"two_days_before",get label(){return n("reminder.day2")}},{value:"three_days_before",get label(){return n("reminder.day3")}},{value:"week_before",get label(){return n("reminder.week1")}},{value:"month_before",get label(){return n("reminder.month1")}}],Af=[{value:"none",get label(){return n("common.none")}},...E0,...Lf];function hu(e){return e?Af:[{value:"none",label:n("common.none")},...Lf]}function R0(e){return e==="same_day"?n("reminder.sameDay"):Af.find(t=>t.value===e)?.label??n("common.none")}function ku(e){if(e.length===0)return n("common.none");let t=e.map(o=>R0(o));return t.length<=3?t.join(", "):n("reminder.andMore",{value:t.slice(0,3).join(", "),value2:t.length-3})}function P0(e){let t=e?new Date(`${e}T00:00:00`):new Date;return Number.isNaN(t.getTime())?new Date:t}function an({anchorEl:e,open:t,date:o,reminders:a,hideReminder:r=!1,showTime:i=!1,autoFillTime:l=!0,centered:s=!1,onClose:c,onDateChange:u,onReminderChange:m}){L();let[d,p]=xu(null),f=h0(void 0),[g,x]=xu(null),h=Nn(),E=String(o??"").trim().slice(0,10),b=String(o??"").trim().slice(11,16),B=/^\d{2}:\d{2}$/.test(b)?b:"",T=(S,O)=>u(O?`${S} ${O}`:S),{defaultDueHour:z}=le(),k=`${String(Number.isInteger(z)&&z>=0&&z<=23?z:D0).padStart(2,"0")}:00`,_=S=>{if(B)return B;if(!l)return"";let O=new Date;return S===Dt(O)?`${String(O.getHours()).padStart(2,"0")}:${String(O.getMinutes()).padStart(2,"0")}`:k},[D,F]=xu(()=>{let S=Number(E.slice(0,4));return Number.isFinite(S)&&S>1900?S:new Date().getFullYear()}),R=Rf(()=>[D-1,D,D+1],[D]),C=Fn(R),y=Rf(()=>{let S=[];for(let O of C.keys()){let w=new Date(`${O}T00:00:00`);Number.isNaN(w.getTime())||S.push(w)}return S},[C]),I=rn($r,{sx:{width:300,maxWidth:"100%"},children:[Ut($r,{sx:{height:320},children:Ut(B0,{selectedDate:P0(E),onSelect:S=>{T(Dt(S),i?_(Dt(S)):B),i||c()},onClose:c,showFooter:!1,autoApply:!0,holidays:y,onYearChange:S=>F(S),onMonthChange:(S,O)=>{typeof O=="number"&&F(O)}})}),i&&f==="wheel"?rn(bu,{children:[Ut(Es,{sx:{borderColor:"#e6e6e3"}}),Ut($r,{sx:{py:1},children:Ut(I0,{value:{hour:B.slice(0,2)||k.slice(0,2),minute:B.slice(3,5)||"00"},format:"HH:mm",minuteStep:5,locale:zn(),onChange:(S,O)=>{T(E||Dt(new Date),`${String(S).padStart(2,"0")}:${String(O).padStart(2,"0")}`)}})})]}):i?rn(bu,{children:[Ut(Es,{sx:{borderColor:"#e6e6e3"}}),rn(Mf,{onClick:S=>x(S.currentTarget),sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1.25,fontSize:14,"&:hover":{bgcolor:"#f8f8f7"}},children:[rn($r,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75,color:"#37352f"},children:[Ut(w0,{sx:{fontSize:17,color:"#9a9a97"}}),n("calendar.time")]}),rn($r,{component:"span",sx:{display:"inline-flex",alignItems:"center",color:"#37352f"},children:[B||n("common.none"),Ut(Of,{sx:{fontSize:18,ml:.25,color:"#9a9a97"}})]})]}),Ut(_0,{timeVariant:f,anchorEl:g,open:!!g,onClose:()=>x(null),centered:s,value:{hour:B.slice(0,2)||k.slice(0,2),minute:B.slice(3,5)||"00"},format:"HH:mm",minuteStep:5,autoApply:!0,locale:zn(),onChange:(S,O)=>{T(E||Dt(new Date),`${S}:${O}`),x(null)}})]}):null,r?null:rn(bu,{children:[Ut(Es,{sx:{borderColor:"#e6e6e3"}}),rn(Mf,{onClick:S=>p(S.currentTarget),sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1.25,fontSize:14,"&:hover":{bgcolor:"#f8f8f7"}},children:[rn($r,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75,color:"#37352f"},children:[Ut(v0,{sx:{fontSize:17,color:"#9a9a97"}}),n("reminder.title")]}),rn($r,{component:"span",sx:{display:"inline-flex",alignItems:"center",color:"#37352f"},children:[ku(a),Ut(Of,{sx:{fontSize:18,ml:.25,color:"#9a9a97"}})]})]}),Ut(T0,{transitionDuration:0,anchorEl:d,open:!!d,onClose:()=>p(null),anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},...h,children:hu(!!B).map(S=>{let O=S.value==="none"?a.length===0:a.includes(S.value);return rn(y0,{selected:O,onClick:()=>{m(fs(a,S.value)),S.value==="none"&&p(null)},sx:{fontSize:14,minWidth:140,justifyContent:"space-between",gap:1},children:[S.label,O?Ut(S0,{sx:{fontSize:16,color:"#2f80ed"}}):null]},S.value)})})]}),Ut(Es,{sx:{borderColor:"#e6e6e3"}}),rn($r,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:1,py:.5},children:[Ut(Pf,{size:"small",onClick:()=>{T(Dt(new Date),i?_(Dt(new Date)):B),c()},sx:{minWidth:0,px:1.25,fontSize:13.5,color:"#2563eb"},children:n("common.today")}),Ut(Pf,{size:"small",onClick:c,sx:{minWidth:0,px:1.25,fontSize:13.5,color:"#2563eb"},children:n("common.close")})]})]});return s?Ut(k0,{open:t,onClose:c,slotProps:{paper:{sx:{borderRadius:3,width:300,maxWidth:"calc(100vw - 48px)",overflow:"hidden"}}},children:I}):Ut(C0,{transitionDuration:0,open:t,anchorEl:e,onClose:c,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{borderRadius:2,boxShadow:"0 8px 24px rgba(0,0,0,0.14)"}}},children:I})}import{Box as xa,Button as K0}from"@mui/material";import{FormDialog as G0}from"@ehfuse/mui-form-dialog";import{ClearTextField as j0,Switch as Y0}from"@ehfuse/mui-form-controls";import{useMemo as M0,useState as O0}from"react";import{Box as il,ButtonBase as L0,InputBase as A0,Tooltip as q0,Typography as qf}from"@mui/material";import z0 from"@mui/icons-material/Search";import N0 from"@ehfuse/overlay-scrollbar";import{Fragment as F0,jsx as yn,jsxs as ll}from"react/jsx-runtime";function zf({iconKey:e,Icon:t,selected:o,onChange:a}){return yn(q0,{title:e,placement:"top",arrow:!0,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:yn(L0,{onClick:()=>a(e),"aria-label":e,sx:{display:"flex",alignItems:"center",justifyContent:"center",height:40,minWidth:0,borderRadius:1,border:o?"2px solid #2563eb":"1px solid #dedddb",bgcolor:o?"#eef4ff":"#fff",color:o?"#1e3a8a":"#787774","&:hover":{bgcolor:o?"#eef4ff":"#f4f4f2"}},children:yn(t,{sx:{fontSize:20}})})})}function Rs({value:e,onChange:t,maxHeight:o=360}){L();let[a,r]=O0(""),{groups:i}=sf(),l=a.trim().toLowerCase(),s=M0(()=>{if(!l)return null;let c=new Set,u=[];for(let m of i)for(let d of m.options)c.has(d.key)||!d.key.toLowerCase().includes(l)||(c.add(d.key),u.push(d));return u},[l,i]);return ll(il,{sx:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[ll(il,{sx:{display:"flex",alignItems:"center",gap:1,px:1.25,height:44,borderRadius:1,border:"1px solid #dedddb",bgcolor:"#fff"},children:[yn(z0,{sx:{fontSize:20,color:"#9b9a97"}}),yn(A0,{value:a,onChange:c=>r(c.target.value),placeholder:n("menu.iconSearchPlaceholder"),autoFocus:!0,sx:{flex:1,fontSize:15},inputProps:{"aria-label":n("menu.iconSearch")}})]}),ll(N0,{style:{maxHeight:o},contentStyle:{minWidth:0,paddingRight:4},thumb:{width:6},children:[s&&ll(F0,{children:[yn(qf,{sx:{fontSize:12,color:"#9b9a97"},children:s.length>0?n("menu.iconSearchResults",{length:s.length}):n("menu.iconNotFound")}),yn(il,{sx:{display:"grid",gridTemplateColumns:"repeat(10, minmax(0, 1fr))",gap:.5},children:s.map(({key:c,Icon:u})=>yn(zf,{iconKey:c,Icon:u,selected:c===e,onChange:t},c))})]}),!s&&i.map((c,u)=>ll(il,{sx:{contentVisibility:"auto",containIntrinsicSize:`${42+Math.ceil(c.options.length/10)*44}px`},children:[yn(qf,{sx:{fontSize:13,fontWeight:700,color:"#1d4ed8",mt:u===0?0:2,pb:.5},children:c.label}),yn(il,{sx:{display:"grid",gridTemplateColumns:"repeat(10, minmax(0, 1fr))",gap:.5},children:c.options.map(({key:m,Icon:d})=>yn(zf,{iconKey:m,Icon:d,selected:m===e,onChange:t},m))})]},c.id))]})]})}import{useGlobalForm as V0}from"@ehfuse/forma";import{ErrorAlert as U0}from"@ehfuse/alerts";import{useEffect as H0,useId as W0,useRef as Ps}from"react";import{useModal as $0}from"@ehfuse/forma";function _e(e){return`${e}-${W0()}`}function no({modalIdPrefix:e,open:t,onClose:o,onOpen:a}){let r=Ps(o);r.current=o;let i=Ps(a);i.current=a;let l=$0({modalId:_e(e),onClose:()=>r.current()}),s=Ps(l);s.current=l;let c=Ps(!1);return H0(()=>{t&&!c.current?(i.current?.(),s.current.open()):!t&&c.current&&s.current.isOpen&&s.current.close(),c.current=t},[t]),l}function Nf({open:e,initialLabel:t="",initialIcon:o=Gi,initialUseSprints:a=!1,onClose:r,onSubmit:i}){L();let l=V0({formId:_e("taskbox-add-tab-form"),initialValues:{label:"",icon:Gi,useSprints:!1},onValidate:c=>String(c.label??"").trim()?!0:(U0(n("dialog.enterProjectName")),!1),onSubmit:c=>(i(String(c.label).trim(),c.icon,!!c.useSprints),s.form.close(),!0)}),s={form:no({modalIdPrefix:"taskbox-add-tab-dialog",open:e,onClose:r,onOpen:()=>l.setFormValues({label:t,icon:o,useSprints:a})})};return{form:l,modals:s}}import{jsx as mr,jsxs as Tu}from"react/jsx-runtime";function Ms({open:e,title:t=n("dialog.addProjectTitle"),initialLabel:o="",initialIcon:a=Gi,confirmText:r=n("common.add"),initialUseSprints:i=!1,onClose:l,onSubmit:s}){L();let{form:c,modals:u}=Nf({open:e,initialLabel:o,initialIcon:a,initialUseSprints:i,onClose:l,onSubmit:s}),m=String(c.useFormValue("icon")??""),d=Tu(xa,{children:[mr(j0,{form:c,name:"label",label:n("dialog.projectName"),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),c.submit())},fullWidth:!0,autoFocus:!0,sx:{mt:.5}}),mr(xa,{sx:{mt:2,fontSize:13,color:"#787774"},children:n("dialog.icon")}),mr(xa,{sx:{mt:1},children:mr(Rs,{value:m,onChange:p=>c.setFormValue("icon",p),maxHeight:264})}),Tu(xa,{sx:{mt:2,display:"flex",alignItems:"center",justifyContent:"space-between",gap:1},children:[Tu(xa,{children:[mr(xa,{sx:{fontSize:14,color:"#37352f"},children:n("dialog.useGoals")}),mr(xa,{sx:{fontSize:12.5,color:"#9a9a97"},children:n("dialog.useGoalsHint")})]}),mr(Y0,{form:c,name:"useSprints"})]})]});return mr(G0,{open:u.form.isOpen,onClose:u.form.close,maxWidth:"xs",title:t,locale:Ce(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-add-tab",sections:[{id:"add-tab",showTitle:!1,children:d}],actions:{showCancelButton:!0,right:mr(K0,{variant:"contained",onClick:()=>{c.submit()},children:r})}})}import{Box as Os,ButtonBase as X0,Divider as Q0,Popover as J0}from"@mui/material";import Z0 from"@mui/icons-material/Check";import{jsx as ba,jsxs as Ff}from"react/jsx-runtime";var yu=["#1e3a8a","#2f80ed","#06b6d4","#0fa3a3","#2f9e5b","#84cc16","#e8a33d","#d9730d","#e5484d","#e255a1","#a355c0","#8a5a2b","#57564f","#111827"];function Vr({anchorEl:e,value:t,color:o="",onSelect:a,onSelectColor:r,onClose:i}){return L(),ba(J0,{transitionDuration:0,open:!!e,anchorEl:e,onClose:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},marginThreshold:16,slotProps:{paper:{sx:{mt:1,maxHeight:"calc(100dvh - 96px)"}}},children:Ff(Os,{sx:{width:"min(492px, calc(100vw - 32px))"},children:[ba(Os,{sx:{p:1.25},children:ba(Rs,{value:t||Hr,maxHeight:"min(432px, calc(100dvh - 300px))",onChange:l=>{a(l),i()}})}),r?Ff(Os,{sx:{px:1.25,pb:1.25},children:[ba(Q0,{sx:{mb:1,borderColor:"#efefed"}}),ba(Os,{sx:{display:"grid",gridTemplateColumns:`repeat(${yu.length}, 1fr)`,justifyItems:"center"},children:yu.map(l=>{let s=(o||yu[0])===l;return ba(X0,{"aria-label":n("menu.iconColor",{hex:l}),onClick:()=>r(l),sx:{width:"100%",maxWidth:26,aspectRatio:"1 / 1",borderRadius:"50%",bgcolor:l,display:"flex",alignItems:"center",justifyContent:"center"},children:s?ba(Z0,{sx:{fontSize:15,color:"#ffffff"}}):null},l)})})]}):null]})})}import ev from"@mui/icons-material/LabelOutlined";import tv from"@mui/icons-material/NotesOutlined";import ov from"@mui/icons-material/AutorenewOutlined";import nv from"@mui/icons-material/CalendarTodayOutlined";import rv from"@mui/icons-material/EventOutlined";import Hf from"@mui/icons-material/PersonOutlineOutlined";import Wf from"@mui/icons-material/PeopleAltOutlined";import vu from"@mui/icons-material/CheckCircleOutlineOutlined";import av from"@mui/icons-material/FlagOutlined";import Bu from"@mui/icons-material/AccessTimeOutlined";import iv from"@mui/icons-material/StickyNote2Outlined";import lv from"@mui/icons-material/ViewKanbanOutlined";import sv from"@mui/icons-material/ConfirmationNumberOutlined";import cv from"@mui/icons-material/QuestionAnswerOutlined";import{jsx as Ft}from"react/jsx-runtime";var $f={completed:"50px",ticket_no:"100px",title:"minmax(220px, 1.8fr)",status:"110px",start_date:"132px",due_date:"132px",manager_name:"110px",receiver_names:"170px",answerer_names:"110px",targets:"170px",priority:"84px",ack:"104px",confirm:"100px",project:"150px",request:"100px",deleted_time:"150px",completed_time:"150px",created_time:"132px",note:"minmax(140px, 0.7fr)",origin_license_name:"150px",support_type:"90px",author_name:"110px"},Vf={completed:{width:56},ticket_no:{width:100},title:{minWidth:220},status:{width:110},start_date:{width:132},due_date:{width:132},manager_name:{width:110},receiver_names:{width:170},answerer_names:{width:110},targets:{width:170},priority:{width:100},ack:{width:104},confirm:{width:100},project:{width:150},request:{width:100},deleted_time:{width:150},completed_time:{width:150},created_time:{width:132},note:{width:160},origin_license_name:{width:150},support_type:{width:90},author_name:{width:110}},mv=new Set(["completed","ticket_no","title","due_date"]);function dH(e){return As(e).map(t=>$f[t.id]).join(" ")}function pH(e){return As(e).reduce((t,o)=>{let a=$f[o.id]??"",r=/^(\d+)px$/.exec(a);if(r)return t+Number(r[1]);let i=/^minmax\((\d+)px/.exec(a);return i?t+Number(i[1]):t},0)}var uv={id:"deleted_time",get label(){return n("col.deletedTime")},icon:Ft(Bu,{sx:{fontSize:15}}),align:"center",sortable:!0},dv={id:"completed_time",get label(){return n("col.completedTime")},icon:Ft(Bu,{sx:{fontSize:15}}),align:"center",sortable:!0},pv={id:"created_time",get label(){return n("col.createdTime")},icon:Ft(Bu,{sx:{fontSize:15}}),align:"center",sortable:!0},fv={id:"ticket_no",get label(){return n("col.ticket")},icon:Ft(sv,{sx:{fontSize:15}}),align:"center"},gv={id:"support_type",get label(){return n("col.kind")},icon:Ft(ev,{sx:{fontSize:15}}),align:"center"},xv={id:"author_name",get label(){return n("col.author")},icon:Ft(Hf,{sx:{fontSize:15}}),align:"center",valueFilter:"author_name"},bv={id:"answerer_names",get label(){return n("col.answerer")},icon:Ft(cv,{sx:{fontSize:15}}),align:"center",valueFilter:"answerer_names"},hv={id:"project",get label(){return n("col.project")},icon:Ft(lv,{sx:{fontSize:15}}),projectFilter:!0},kv={id:"targets",get label(){return n("col.targets")},icon:Ft(Wf,{sx:{fontSize:15}})},Su={id:"priority",get label(){return n("col.priority")},icon:Ft(av,{sx:{fontSize:15}}),align:"center",priorityFilter:!0},Tv={id:"ack",get label(){return n("col.confirm")},icon:Ft(vu,{sx:{fontSize:15}}),align:"center",ackFilter:!0},yv={id:"confirm",get label(){return n("col.confirm")},icon:Ft(vu,{sx:{fontSize:15}}),align:"center",ackFilter:!0};function Cu(e){let t=e.findIndex(a=>a.id==="receiver_names"||a.id==="targets"),o=t>=0?t+1:e.findIndex(a=>a.id==="note");return o<0?[...e,Su]:[...e.slice(0,o),Su,...e.slice(o)]}function As(e){return Cv(e).filter(t=>!(e?.showPriority===!1&&t.id==="priority")&&!(e?.hideStartDate&&t.id==="start_date")&&!(e?.compact&&!mv.has(t.id)))}function Cv(e){let{showProject:t=!1,showManager:o=!0,showActions:a=!0,showRequest:r=!0,notice:i=!1,bug:l=!1,support:s=!1,centerManager:c=!1,trash:u=!1,confirmMode:m="none"}=e??{};if(s){let g=x=>Ls.find(h=>h.id===x);return[g("completed"),gv,g("title"),g("status"),pv,g("start_date"),g("due_date"),xv,bv,{...g("manager_name"),align:"center"},g("receiver_names"),Su]}let d=g=>{if(!l)return g;let x=g.filter(b=>b.id!=="note"),h=x.findIndex(b=>b.id==="completed"),E=h>=0?h+1:0;return[...x.slice(0,E),fv,...x.slice(E)]};if(i)return d(Cu(Ls.filter(g=>!["manager_name","receiver_names","request"].includes(g.id)).flatMap(g=>g.id==="due_date"?[g,kv]:g.id==="note"?[Tv,g]:[g])));let p=o?Ls:Ls.filter(g=>g.id!=="manager_name");if(c&&(p=p.map(g=>g.id==="manager_name"?{...g,align:"center"}:g)),a)r||(p=p.filter(g=>g.id!=="request"));else{p=p.filter(x=>x.id!=="request");let g=p.findIndex(x=>x.id==="note");p=[...p.slice(0,g),u?uv:dv,...p.slice(g)]}if(m==="action"){let g=p.findIndex(x=>x.id==="note");p=[...p.slice(0,g),yv,...p.slice(g)]}if(!t)return d(Cu(p));let f=p.findIndex(g=>g.id==="receiver_names");return d(Cu([...p.slice(0,f+1),hv,...p.slice(f+1)]))}var Ls=[{id:"completed",get label(){return n("col.done")},icon:null,align:"center"},{id:"title",get label(){return n("col.title")},icon:Ft(tv,{sx:{fontSize:15}}),sortable:!0},{id:"status",get label(){return n("col.status")},icon:Ft(ov,{sx:{fontSize:15}}),align:"center",statusFilter:!0},{id:"start_date",get label(){return n("col.startTime")},icon:Ft(nv,{sx:{fontSize:15}}),align:"center",sortable:!0},{id:"due_date",get label(){return n("col.due")},icon:Ft(rv,{sx:{fontSize:15}}),align:"center",sortable:!0},{id:"manager_name",get label(){return n("col.owner")},icon:Ft(Hf,{sx:{fontSize:15}}),memberFilter:"manager"},{id:"receiver_names",get label(){return n("col.cc")},icon:Ft(Wf,{sx:{fontSize:15}}),memberFilter:"receivers"},{id:"request",get label(){return n("col.confirm")},icon:Ft(vu,{sx:{fontSize:15}}),align:"center",ackFilter:!0},{id:"note",get label(){return n("col.note")},icon:Ft(iv,{sx:{fontSize:15}})}];function ln(e){let t=e.visibility;return t==="involved"||t==="group"||t==="all"?t:e.is_open?"all":"involved"}function qs(e,t,o=0){if(t<=0)return!1;if(e.is_notice){if((e.author_account_seq??0)===t)return!0;let i=(e.target_account_seqs??[]).filter(l=>l>0);return i.length===0||i.includes(t)}if((e.author_account_seq??0)===t||(e.manager_account_seq??0)===t||(e.receiver_account_seqs??[]).includes(t))return!0;let r=ln(e);if(r==="all")return!0;if(r==="group"){let i=e.visibility_group_seq??0;return i>0&&o===i}return!1}function sl(e){let t=e;return!!(t.is_post||t.is_poll)}function _u(e){return e.author_name||e.created_by||e.manager_name||""}function Cn(e){return sl(e)?_u(e):e.manager_name||""}function Uf(e){return e.is_notice||e.is_event||sl(e)||e.completed||e.archived||(e.manager_account_seq??0)!==0?!1:ln(e)!=="involved"}function zs(e,t){return t<=0||(e.author_account_seq??0)===t?!1:Uf(e)}function Ns(e,t){return t<=0||e.is_notice||e.is_event||sl(e)||e.completed||e.archived||(e.manager_account_seq??0)>0||(e.author_account_seq??0)===t||Uf(e)?!1:(e.receiver_account_seqs??[]).includes(t)}function Kf(e){return!!e.is_bug&&(e.manager_account_seq??0)===0&&e.status==="bug_received"}function Fs(e){return(e.origin_license_seq??0)>0}function Gf(e,t){if(t<=0)return!1;let o=(e.author_account_seq??0)===t;return e.is_notice?o:o||(e.manager_account_seq??0)===t}function Hn(e,t){return t<=0?!1:Fs(e)?!0:e.is_notice?(e.author_account_seq??0)===t:(e.author_account_seq??0)===t||(e.manager_account_seq??0)===t||(e.receiver_account_seqs??[]).includes(t)}function Sv(e,t){return t<=0?!1:Fs(e)?!0:e.is_notice?(e.author_account_seq??0)===t:(e.author_account_seq??0)===t||(e.manager_account_seq??0)===t}function vv(e,t){return t<=0?!1:Fs(e)?!0:(e.author_account_seq??0)===t}function Ur(e,t,o){return o==="coreAuthorManager"?!Sv(e,t):!Hn(e,t)}function ha(e,t,o,a){return o==="coreAuthorManager"?!vv(e,t):a}var xH=[119,121,141,143];function Hs(e,t){let o=String(e.origin_author_avatar??"").trim(),a=String(e.author_name||e.origin_author_name||e.created_by||"").trim();if(!o||!a||!Fs(e)||t?.get(a)===o)return t;let r=new Map(t??[]);return r.set(a,o),r}import{createContext as js,memo as ag,useContext as Za,useEffect as zv,useRef as Nv,useState as Pu}from"react";import{Box as pt,Button as ig,ButtonBase as Fv,Checkbox as Hv,IconButton as Wv,Tooltip as Qa}from"@mui/material";import $v from"@mui/icons-material/Add";import Vv from"@mui/icons-material/KeyboardArrowDown";import Uv from"@mui/icons-material/KeyboardArrowRight";import Kv from"@mui/icons-material/PublicOutlined";import Gv from"@mui/icons-material/Group";import jv from"@mui/icons-material/CheckCircle";import Yv from"@mui/icons-material/CheckCircleOutlineOutlined";import Xv from"@mui/icons-material/ArrowUpward";import Qv from"@mui/icons-material/ArrowDownward";import{HeaderFilterIcon as Jv}from"@ehfuse/mui-virtual-data-table";import{useEffect as Bv,useState as jf}from"react";import{Avatar as Yf,Box as _v}from"@mui/material";import Iv from"@mui/icons-material/PersonOutlineOutlined";import{jsx as Ws}from"react/jsx-runtime";var Iu=new Set,Xf=e=>e.startsWith("data:")||e.startsWith("blob:");function wv(e){let t=e.trim();return t?([...t][0]??"").toUpperCase():""}function po({src:e,name:t="",avatarSx:o,iconFontSize:a=40}){let[r,i]=jf(()=>e?Xf(e)||Iu.has(e):!1),[l,s]=jf(!1),c={position:"relative",overflow:"hidden",borderRadius:"15px"},u=o?[c,...Array.isArray(o)?o:[o]]:c;if(Bv(()=>{s(!1),i(e?Xf(e)||Iu.has(e):!1)},[e]),!e||l){let m=wv(t);return Ws(Yf,{sx:u,children:m?Ws(_v,{component:"span",sx:{fontSize:"inherit",fontWeight:600,lineHeight:1,userSelect:"none"},children:m}):Ws(Iv,{sx:{fontSize:a}})})}return Ws(Yf,{src:e,imgProps:{onLoad:()=>{Iu.add(e),i(!0)},onError:()=>s(!0),style:r?void 0:{opacity:0}},sx:u})}var Dv=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),$s=(e,t)=>{if(!t||!t.trim())return[{text:e,highlight:!1}];try{let o=Dv(t.trim()),a=new RegExp(`(${o})`,"gi");return e.split(a).map(i=>i.toLowerCase()===t.trim().toLowerCase()?{text:i,highlight:!0}:{text:i,highlight:!1}).filter(i=>i.text)}catch{return[{text:e,highlight:!1}]}};function $o(e){let t=String(e??"").trim().slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return"";let o=new Date(`${t}T00:00:00`);return Number.isNaN(o.getTime())?"":`${t.slice(2).replaceAll("-",".")} (${Fr(o.getDay())})`}function wu(e){let t=String(e??"").trim().slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return"";let o=Number(t.slice(5,7)),a=Number(t.slice(8,10));return!o||!a?"":sr(new Date(2e3,o-1,a),{month:"short",day:"numeric"})}function Vo(e){let t=String(e??"").trim(),[o,a=""]=t.split(" "),r=$o(o);return r?a?`${r} ${a.slice(0,5)}`:r:""}function ja(e,t){let o=(e.checklist??[]).filter(r=>!(t&&r.task_seq&&!t(Number(r.task_seq))));return o.length===0?"":`${o.filter(r=>r.checked).length}/${o.length}`}import{Box as Qf,Tooltip as Ev}from"@mui/material";import{jsx as Vs}from"react/jsx-runtime";var Kr=[{bgcolor:"#dbe7ff",color:"#24408e"},{bgcolor:"#ffe4d6",color:"#8a4b21"},{bgcolor:"#dcf2e3",color:"#1f6b3a"},{bgcolor:"#f3e3f7",color:"#6d2f80"},{bgcolor:"#fdf0cf",color:"#8a6d1d"},{bgcolor:"#e0f0f6",color:"#1d5f78"},{bgcolor:"#efe6dc",color:"#6b4a2b"}];function So({names:e,size:t=22,ringFirst:o=!1,avatarSrcByName:a}){L();let r=xe(),i=le().avatarSrcByName,l=a??i;return Vs(Qf,{sx:{display:"flex",alignItems:"center"},children:e.map((s,c)=>Vs(Ev,{title:o&&c===0?n("misc.ownerName",{name:s}):s,arrow:!0,children:Vs(Qf,{sx:{ml:c===0?0:"-7px",zIndex:c,borderRadius:"50%",border:`2px solid ${r.avatar.separatorColor}`,display:"inline-flex",...r.avatar.sx},children:Vs(po,{src:l?.get(s)??"",name:s,avatarSx:{width:t,height:t,fontSize:Math.round(t/2),borderRadius:"50%",...Kr[c%Kr.length]},iconFontSize:Math.round(t*.6)})})},`${s}-${c}`))})}import{Box as Du,Button as Zf}from"@mui/material";import Rv from"@mui/icons-material/CheckCircle";import{Fragment as Jf,jsx as Ya,jsxs as Eu}from"react/jsx-runtime";function Pv(e){let t=e.mode==="dark";return{minWidth:0,width:"100%",px:1,py:.25,gap:.5,fontSize:13,color:e.table.rowColor,borderColor:e.colors.borderStrong,background:t?e.colors.surfaceHover:"linear-gradient(180deg, #ffffff 0%, #f6f7f9 100%)",whiteSpace:"nowrap","&:hover":{background:t?e.colors.surfaceSubtle:"linear-gradient(180deg, #fcfcfd 0%, #f0f2f4 100%)",borderColor:e.colors.borderStrong}}}function Mv(e){return{minWidth:0,px:1.25,py:.25,fontSize:13,whiteSpace:"nowrap",color:e.actionButton.color,backgroundColor:e.actionButton.bg,backgroundImage:e.actionButton.bgImage,boxShadow:"none","&:hover":{backgroundColor:e.actionButton.hoverBg,backgroundImage:e.actionButton.hoverBgImage,boxShadow:"none"},...e.actionButton.sx}}var Gr={minWidth:0,px:1.25,py:.25,fontSize:13,fontWeight:600,whiteSpace:"nowrap",color:"#fff",backgroundColor:"#8b5cf6",backgroundImage:"linear-gradient(180deg, #a685f9 0%, #8b5cf6 100%)",boxShadow:"none","&:hover":{backgroundColor:"#7c4ee8",backgroundImage:"linear-gradient(180deg, #9873f2 0%, #7c4ee8 100%)",boxShadow:"none"}};function Uo({onClick:e,children:t,fullWidth:o=!1,sx:a}){let r=xe();return Ya(Zf,{size:"small",variant:"contained",color:"inherit",fullWidth:o,sx:[Mv(r),...Array.isArray(a)?a:a?[a]:[]],onClick:i=>{i.stopPropagation(),e(i)},children:t})}function Xa({canConfirm:e,count:t,total:o,myConfirmed:a=!1,onConfirm:r,onShowList:i}){L();let l=xe(),s=Pv(l);return e?Ya(Uo,{onClick:()=>r(),children:n("task.confirm")}):Eu(Zf,{size:"small",variant:"outlined",color:"inherit",sx:{...s,containerType:"inline-size"},onClick:c=>{c.stopPropagation(),i(c.currentTarget)},children:[a?Ya(Rv,{sx:{fontSize:16,color:"#2f80ed",flexShrink:0}}):null,Ya(Du,{component:"span",sx:{flex:1,textAlign:"center",minWidth:0},children:o>0&&t>=o?Eu(Jf,{children:[Ya(Du,{component:"span",sx:{[`@container (max-width: ${a?91:71}px)`]:{display:"none"}},children:n("task.confirm")}),n("common.done")]}):Eu(Jf,{children:[t,Ya(Du,{component:"span",sx:{mx:.15},children:"/"}),o]})})]})}import{ConfirmActionPopper as Ov}from"@ehfuse/mui-confirm-action";import{jsx as Lv}from"react/jsx-runtime";function jr({anchorEl:e,onCancel:t,onConfirm:o}){return L(),Lv(Ov,{open:!!e,anchorEl:e,title:n("table.reviewDoneConfirm"),onCancel:t,onConfirm:o})}import{SvgIcon as Av}from"@mui/material";import{jsx as Us,jsxs as qv}from"react/jsx-runtime";function Yr({sx:e,...t}){return qv(Av,{viewBox:"0 0 48 48",...t,sx:{fill:"none",...e},children:[Us("path",{d:"M24,6C13.23,6,4.5,12.93,4.5,21.46c0,5.39,3.5,10.13,8.79,12.89l-1.76,7.06a.46.46,0,0,0,.68.51L21,36.7a24,24,0,0,0,3,.2c10.77,0,19.5-6.91,19.5-15.44S34.77,6,24,6Z",fill:"none",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),Us("circle",{cx:"23.91",cy:"21.46",r:"2.71",fill:"currentColor",stroke:"none"}),Us("circle",{cx:"33.65",cy:"21.46",r:"2.71",fill:"currentColor",stroke:"none"}),Us("circle",{cx:"14.18",cy:"21.46",r:"2.71",fill:"currentColor",stroke:"none"})]})}import{Fragment as Ys,jsx as Y,jsxs as Sn}from"react/jsx-runtime";var lg="14px";function Ja(e){let t=String(e??"").trim();if(!t)return"-";let o=t.slice(2,10).replaceAll("-","."),a=t.slice(11,16);return/^\d{2}:\d{2}$/.test(a)?`${o} ${a}`:o}function Zv(e){let t=String(e.event_time??"").trim();return e.is_event&&/^\d{2}:\d{2}$/.test(t)?Ja(`${String(e.due_date??"").slice(0,10)} ${t}`):Ja(e.due_date)}function Ks(e,t){let o=String(e??"").trim()||"-";return $s(o,t).map((a,r)=>Y("span",{style:a.highlight?{fontWeight:600,color:"#2563eb"}:void 0,children:a.text},`${a.text}-${r}`))}function ka({names:e,searchText:t,avatarSrcByName:o,emphasize:a=!1}){let r=e.filter(i=>i.trim());if(r.length===0)return null;if(r.length===1){let i=r[0]??"";return Sn(Ys,{children:[Y(po,{src:o?.get(i)??"",name:i,avatarSx:{width:24,height:24,fontSize:12,borderRadius:"50%",...Kr[0]},iconFontSize:15}),Y(pt,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...a?{fontWeight:500,color:"#2f80ed"}:{}},children:Ks(i,t)})]})}return Y(So,{names:r,size:22,avatarSrcByName:o})}function eB({display:e,summary:t,searchText:o,avatarSrcByName:a}){if(L(),!e||e.kind==="everyone")return Y(pt,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t||n("col.allEmployees")});let{teamNames:r,individualNames:i}=e;if(r.length===0)return Y(ka,{names:i,searchText:o,avatarSrcByName:a});let l=[...r,...i],s=l.join(", ");return l.length>2?Y(Qa,{title:s,arrow:!0,children:Y(pt,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n("col.namesAndMore",{value:l[0],value2:l[1],value3:l.length-2})})}):Y(Qa,{title:s,arrow:!0,children:Sn(pt,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},children:[Y(pt,{component:"span",sx:{flexShrink:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.join(", ")+(i.length>0?",":"")}),i.length>0?Y(ka,{names:i,searchText:o,avatarSrcByName:a}):null]})})}function Gs(e){let t=tB[e];return t?n(t):e}var tB={\uBB38\uC758:"support.inquiry",\uAC74\uC758\uC0AC\uD56D:"support.suggestion",\uC624\uB958\uC81C\uBCF4:"support.bugShort",\uC0C1\uB2F4\uC2E0\uCCAD:"support.consult"};function eg(e){return e==="\uBB38\uC758"?{bg:"#e8f1fd",fg:"#2f80ed"}:e==="\uAC74\uC758\uC0AC\uD56D"?{bg:"#f1ecfe",fg:"#8b5cf6"}:e==="\uC624\uB958\uC81C\uBCF4"?{bg:"#fdecec",fg:"#e5484d"}:e==="\uC0C1\uB2F4\uC2E0\uCCAD"?{bg:"#e6f7ec",fg:"#1f8a4c"}:{bg:"#f1f1ef",fg:"#6f6f6c"}}function Ru({label:e,bg:t,fg:o}){return Y(pt,{component:"span",sx:{flexShrink:0,px:.75,fontSize:12,fontWeight:500,lineHeight:"20px",color:o,bgcolor:t,borderRadius:"4px",whiteSpace:"nowrap",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"},children:e})}var cl=js(null),sg=js(!1);function at({onClick:e,hoverBg:t,align:o="left",cursor:a,sx:r,children:i,ownHover:l=!1}){let s=Za(cl)?.theme.table.rowColor,c=Za(sg);return Y(pt,{onClick:e,"data-own-hover":c&&l&&e?"":void 0,sx:{position:"absolute",inset:0,color:s,display:"flex",alignItems:"center",justifyContent:o==="center"?"center":"flex-start",gap:.75,px:lg,minWidth:0,overflow:"hidden",cursor:a??(e?"pointer":"default"),...c?{"tr:hover:not(:has([data-own-hover]:hover)) &":{bgcolor:t},...l&&e?{"&:hover":{bgcolor:t}}:{}}:e?{"&:hover":{bgcolor:t}}:{},...r},children:i})}function oB(e,t){let o=le(),{myAccountSeq:a,readOnly:r}=t,i=!Hn(e,a),l=i||r,s=Ur(e,a,o.editPolicy)||r,c=s||!!e.is_notice;return{config:o,noticeReadOnly:i,locked:l,coreCellLocked:s,memberLocked:c,managerLocked:c&&!Kf(e),noteLocked:r||(e.is_notice?!qs(e,a):!Hn(e,a)),completeLocked:e.is_event?!0:e.is_notice?(e.author_account_seq??0)!==a:(e.author_account_seq??0)!==a&&(e.manager_account_seq??0)!==a,isMyManagedTask:a>0&&!e.is_notice&&!e.is_event&&(e.manager_account_seq??0)===a}}function tg({task:e}){L();let t=le(),[o,a]=Pu(null);return Sn(Ys,{children:[Y(ig,{variant:"contained",size:"small",disableElevation:!0,onClick:r=>{r.stopPropagation(),a(r.currentTarget)},sx:Gr,children:n("col.reviewDone")}),Y(jr,{anchorEl:o,onCancel:()=>a(null),onConfirm:()=>{t.onReviewDone?.(e),a(null)}})]})}function og(e,t){return!e.is_notice&&e.completed&&!!e.review_pending&&!!t.onReviewDone&&(t.myAccountSeq??0)>0&&(e.author_account_seq??0)===(t.myAccountSeq??0)}function nB({task:e,locked:t,ctx:o}){let[a,r]=Pu(!1),[i,l]=Pu(""),s=Nv(null),{theme:c}=o;return zv(()=>{if(!a)return;let u=m=>{let d=s.current;d&&(m.target instanceof Node&&d.contains(m.target)||d.blur())};return document.addEventListener("mousedown",u,!0),document.addEventListener("touchstart",u,!0),()=>{document.removeEventListener("mousedown",u,!0),document.removeEventListener("touchstart",u,!0)}},[a]),Y(at,{hoverBg:c.table.cellHoverBg,cursor:t?"default":"text",onClick:()=>{!t&&!a&&(l(e.note),r(!0))},sx:{color:c.table.rowSubColor,"&:hover":{}},children:a?Y(pt,{component:"input",ref:s,autoFocus:!0,spellCheck:!1,value:i,onChange:u=>l(u.target.value),onBlur:()=>{r(!1),i.trim()!==e.note&&o.onChangeNote(e.seq,i)},onKeyDown:u=>{u.key==="Enter"&&u.target.blur(),u.key==="Escape"&&(l(e.note),r(!1))},sx:{flex:1,minWidth:0,width:"100%",border:"none",outline:"none",bgcolor:"transparent",font:"inherit",lineHeight:"inherit",letterSpacing:"inherit",color:c.table.rowTitleColor,caretColor:c.table.rowTitleColor,p:0,m:0}}):Y(pt,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.note?Ks(e.note,o.searchText):""})})}var cg=ag(function(t){let o=Za(cl);return Y(sg.Provider,{value:!!o?.isPostItem?.(t.task),children:Y(rB,{...t})})});function rB({task:e,columnId:t}){L();let o=Za(cl);if(!o)throw new Error("TaskBoxCell \uC740 TaskBoxCellContext \uC548\uC5D0\uC11C\uB9CC \uC4F4\uB2E4");let r=(o.useTaskItem?o.useTaskItem(e.seq):void 0)??e,i=oB(r,o),l=!!o.isPostItem?.(r),s=()=>o.onOpenDetail(r),{theme:c,searchText:u,avatarSrcByName:m}=o,d=c.table.cellHoverBg,p=(h,E)=>h?void 0:E,f=()=>Y(at,{hoverBg:d,onClick:p(i.coreCellLocked,()=>o.onMemberClick(r,"targets")),children:Y(eB,{display:r.is_notice?o.getTargetDisplay?.(r):void 0,summary:(r.is_notice?o.getTargetSummary?.(r):void 0)??"",searchText:u,avatarSrcByName:m})}),g=()=>Y(at,{hoverBg:d,ownHover:!0,onClick:p(i.memberLocked,()=>o.onMemberClick(r,"receivers")),children:Y(ka,{names:r.receiver_names,searchText:u,avatarSrcByName:m})}),x=()=>{let h=o.getAckInfo?.(r);return Y(Xa,{canConfirm:!!h?.canAck,count:h?.count??0,total:h?.total??0,myConfirmed:!!h?.acked,onConfirm:()=>o.onAckConfirm(r),onShowList:E=>o.onAckListClick(r,E)})};switch(t){case"completed":return Sn(at,{hoverBg:d,align:"center",sx:{px:0},onClick:l?s:void 0,children:[r.is_event?(()=>{let h=Oe(r.icon||zt);if(!h)return null;let E=Y(h,{sx:{fontSize:19,color:r.icon_color||"#1e3a8a"}});return i.locked||!o.onIconClick?E:Y(Qa,{title:n("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:Y(Fv,{onClick:b=>{b.stopPropagation(),o.onIconClick?.(r,b.currentTarget)},sx:{p:.25,borderRadius:1,"&:hover":{bgcolor:d}},children:E})})})():!l&&!i.noticeReadOnly&&!i.completeLocked&&!o.trashMode?Y(Qa,{title:r.completed&&r.completed_by?n("col.completedBy",{completed_by:r.completed_by,value:Vo(r.completed_time)}):r.completed?n("menu.uncomplete"):n("menu.complete"),arrow:!0,enterDelay:300,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Y(Hv,{checked:r.completed,inputProps:{"aria-label":r.completed?n("col.uncompleteAria",{title:r.title}):n("col.completeAria",{title:r.title})},icon:Y(Yv,{sx:{fontSize:20,color:"#9a9a97",opacity:.45}}),checkedIcon:Y(jv,{sx:{fontSize:20,color:"#2f80ed"}}),onClick:h=>h.stopPropagation(),onChange:(h,E)=>o.onRequestToggleCompleted({anchorEl:h.currentTarget,task:r,nextCompleted:E}),sx:{p:.5}})}):null,i.isMyManagedTask?Y(pt,{component:"span",sx:{position:"absolute",left:3,top:6,bottom:6,width:3,bgcolor:"#2f80ed",borderRadius:1.5,pointerEvents:"none"}}):null]});case"ticket_no":return Y(at,{hoverBg:d,align:"center",sx:{whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:r.ticket_no||"-"});case"support_type":return Y(at,{hoverBg:d,align:"center",sx:{whiteSpace:"nowrap"},children:r.support_type?(()=>{let h=eg(r.support_type);return Y(Ru,{label:Gs(r.support_type),bg:h.bg,fg:h.fg})})():"-"});case"title":{let h=i.config.titlePrefix?.(r)??"",E=ja(r,i.config.resolveTask),b=o.isTaskUnread?.(r)??!1,B=r.completed&&o.dimCompleted;return Sn(at,{hoverBg:d,onClick:()=>o.onOpenDetail(r),sx:{gap:1},children:[r.is_notice?(()=>{let T=Oe(r.icon||wt);return T?Y(T,{sx:{fontSize:18,flexShrink:0,color:r.icon_color||"#e5484d"}}):null})():null,!o.supportMode&&r.is_support&&r.support_type?(()=>{let T=eg(r.support_type);return Y(Ru,{label:Gs(r.support_type),bg:T.bg,fg:T.fg})})():null,o.bugMode&&(r.origin_license_seq??0)>0&&r.origin_license_name?Y(Ru,{label:r.origin_license_name,bg:"#fdf0e6",fg:"#d9730d"}):null,(()=>{if(r.is_notice||o.supportMode||r.is_support)return null;let T=ln(r);return T==="involved"?null:Y(Qa,{title:T==="all"?n("col.visibilityAll"):n("col.visibilityDept"),arrow:!0,disableInteractive:!0,children:T==="all"?Y(Kv,{sx:{fontSize:15,flexShrink:0,color:"#2f80ed"}}):Y(Gv,{sx:{fontSize:15,flexShrink:0,color:"#d9730d"}})})})(),Sn(pt,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:B?400:c.table.rowTitleFontWeight,color:B?c.colors.textMuted:c.table.rowTitleColor},children:[h?Y(pt,{component:"span",sx:{color:c.colors.textSecondary,fontWeight:500,fontSize:14,mr:.75},children:Ks(h,u)}):null,Ks(r.title,u)]}),E?Y(pt,{component:"span",sx:{flexShrink:0,fontSize:14,color:c.colors.textMuted,fontVariantNumeric:"tabular-nums"},children:E}):null,(r.comment_count??r.comments?.length??0)>0?Y(Yr,{sx:{fontSize:16,flexShrink:0,color:"#9a9a97"}}):null,Y(pt,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:Y(Wr,{labelKeys:r.label_keys??[],labelOptions:o.statusOptions})}),b&&!r.completed?Y(pt,{component:"span",sx:{flexShrink:0,px:.55,fontSize:10.5,fontWeight:700,lineHeight:1.6,color:"#fff",bgcolor:"#e5484d",borderRadius:"4px"},children:"N"}):null,Ss(r)&&!r.archived&&!i.locked&&o.onArchiveTask?Y(ig,{size:"small",variant:"outlined",color:"inherit",sx:{ml:"auto",flexShrink:0,minWidth:0,px:1.25,py:.25,fontSize:13,color:"text.primary",borderColor:"#d5d8dc",bgcolor:"#fff",whiteSpace:"nowrap"},onClick:T=>{T.stopPropagation(),o.onArchiveTask?.(r)},children:n("menu.archive")}):null]})}case"status":{if(l)return Y(at,{hoverBg:d,align:"center",onClick:s});let h=i.locked||!!r.is_event||!!r.completed;return Y(at,{hoverBg:d,align:"center",onClick:p(h,E=>o.onStatusClick(r,E.currentTarget)),children:r.is_event?(()=>{let E=nl(r);return E?Y(Ve,{option:E}):null})():Y(Ve,{option:Nt(r)})})}case"created_time":return Y(at,{hoverBg:d,align:"center",sx:{whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:Ja(r.created_time)});case"start_date":return l?Y(at,{hoverBg:d,align:"center",onClick:s,sx:{whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:Ja(r.created_time)}):Y(at,{hoverBg:d,align:"center",sx:{whiteSpace:"nowrap"},onClick:p(i.coreCellLocked,h=>o.onDateClick(r,"start_date",h.currentTarget)),children:Ja(r.start_date)});case"due_date":{if(l)return Y(at,{hoverBg:d,align:"center",onClick:s});let h=!r.is_notice&&!r.completed&&!!r.due_date&&r.due_date.slice(0,10)<=o.todayStr,E=r.is_event&&r.due_date?r.due_date.slice(0,10):"",b=!!E&&E<o.todayStr;return Y(at,{hoverBg:d,align:"center",sx:{color:b?c.colors.textSecondary:h?"#e5484d":c.colors.textPrimary,fontWeight:500,whiteSpace:"nowrap"},onClick:p(i.coreCellLocked,B=>o.onDateClick(r,"due_date",B.currentTarget)),children:r.due_date?Zv(r):null})}case"author_name":return Y(Qa,{title:r.origin_license_name||"",arrow:!0,placement:"top",disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Y(pt,{sx:{position:"absolute",inset:0},children:Y(at,{hoverBg:d,align:"center",children:Y(ka,{names:[r.author_name||r.origin_author_name||r.created_by||""],searchText:u,avatarSrcByName:Hs(r,m)})})})});case"answerer_names":return Y(at,{hoverBg:d,align:"center",children:Y(ka,{names:(r.answerer_names??[]).slice(0,1),searchText:u,avatarSrcByName:m})});case"targets":return f();case"manager_name":{if(r.is_notice)return f();if(r.is_event)return g();if(l)return Y(at,{hoverBg:d,align:o.managerCentered?"center":"left",onClick:s,children:Y(ka,{names:[_u(r)].filter(Boolean),searchText:u,avatarSrcByName:m})});let h=!!o.onClaimClick&&zs(r,o.myAccountSeq),E=!!o.onVolunteerClick&&Ns(r,o.myAccountSeq);return Y(at,{hoverBg:d,align:h||E||o.managerCentered?"center":"left",onClick:p(i.managerLocked,()=>o.onMemberClick(r,"manager")),children:h?Y(Uo,{onClick:b=>o.onClaimClick?.(r,b.currentTarget),children:n("col.claim")}):E?Y(Uo,{onClick:b=>o.onVolunteerClick?.(r,b.currentTarget),children:n("col.claim")}):Y(ka,{names:r.manager_name?[r.manager_name]:[],searchText:u,avatarSrcByName:m,emphasize:i.isMyManagedTask})})}case"receiver_names":return r.is_notice?f():g();case"priority":return l?Y(at,{hoverBg:d,align:"center",onClick:s}):Y(at,{hoverBg:d,align:"center",onClick:p(i.locked,h=>o.onPriorityClick(r,h.currentTarget)),children:Y(uo,{priority:r.priority,plain:!0})});case"project":{let h=o.projectByKey.get(r.tab_key??""),E=h?Oe(h.icon):null;return Y(at,{hoverBg:d,sx:{gap:.5},onClick:p(i.coreCellLocked,b=>o.onProjectClick(r,b.currentTarget)),children:h?.label?Sn(Ys,{children:[E?Y(E,{sx:{fontSize:15,flexShrink:0,color:"#1e3a8a"}}):null,Y(pt,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.label})]}):null})}case"ack":return Y(at,{hoverBg:d,align:"center",children:r.is_notice?x():null});case"request":{let h=[r.manager_account_seq??0,...r.receiver_account_seqs??[]].some(b=>b>0&&b!==(r.author_account_seq??0)),E=r.is_notice?void 0:o.getConfirmInfo?.(r);return Y(at,{hoverBg:d,align:"center",children:r.is_notice?x():og(r,i.config)?Y(tg,{task:r}):h?Y(Xa,{canConfirm:!!E?.canConfirm,count:E?.count??0,total:E?.total??0,myConfirmed:!!E?.myTime,onConfirm:()=>o.onConfirmTask(r),onShowList:b=>o.onAckListClick(r,b)}):null})}case"confirm":{let h=r.is_notice?void 0:o.getConfirmInfo?.(r);return Y(at,{hoverBg:d,align:"center",sx:{whiteSpace:"nowrap",color:c.table.rowSubColor},children:r.is_notice?x():og(r,i.config)?Y(tg,{task:r}):h&&h.total>0?Y(Xa,{canConfirm:!!h.canConfirm,count:h.count,total:h.total,myConfirmed:!!h.myTime,onConfirm:()=>o.onConfirmTask(r),onShowList:E=>o.onAckListClick(r,E)}):"-"})}case"completed_time":case"deleted_time":return Y(at,{hoverBg:d,align:"center",sx:{whiteSpace:"nowrap",color:o.trashMode?c.colors.danger:o.dimCompleted?c.table.rowSubColor:c.table.rowTitleColor},children:o.trashMode?Ja(r.deleted_time):r.completed_time||"-"});case"note":return Y(nB,{task:r,locked:i.noteLocked,ctx:o},r.seq);default:return null}}var Mu=js(null);function Ou(e){return!!(e.sortable||e.memberFilter||e.statusFilter||e.ackFilter||e.projectFilter||e.priorityFilter||e.valueFilter)}function mg({column:e}){let t=Za(Mu);if(!t)return Y(Ys,{children:e.label});let{theme:o}=t,a=t.sortBy===e.id,r=t.isFiltered(e),i=Ou(e),l=!!(e.memberFilter||e.statusFilter||e.ackFilter||e.projectFilter||e.priorityFilter||e.valueFilter);return Sn(pt,{component:"span",sx:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":"flex-start",gap:.5,minWidth:0,whiteSpace:"nowrap",color:a||r?o.table.headerFilteredColor:i?o.table.headerActiveColor:o.table.headerColor,...r?{fontWeight:600}:{}},children:[e.icon,e.label,l?Y(Jv,{color:r?o.table.headerFilteredColor:void 0}):null,a?t.sortDirection==="asc"?Y(Xv,{sx:{fontSize:13}}):Y(Qv,{sx:{fontSize:13}}):null]})}var Lu=js(null);function ng({bg:e,hoverBg:t,onClick:o,children:a}){return Y(pt,{sx:{display:"flex",alignItems:"center",gap:.5,px:lg,height:"100%",minHeight:48,boxSizing:"border-box",bgcolor:e,cursor:o?"pointer":"default",userSelect:"none",...t?{"&:hover":{bgcolor:t}}:{}},children:a})}function rg({theme:e,count:t,bg:o,color:a,border:r}){let i=e.table.groupHeader.badge;return Y(pt,{component:"span",sx:{flexShrink:0,width:i.width,py:i.paddingY,borderRadius:`${i.borderRadius}px`,bgcolor:o,border:r??"none",color:a,fontSize:i.fontSize,fontWeight:i.fontWeight,lineHeight:1.6,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:t})}var ug=ag(function({row:t}){L();let o=Za(Lu);if(!o)return null;let{theme:a}=o,r=a.table.groupHeader,i=u=>Y(pt,{component:"span",sx:{fontSize:r.labelFontSize,fontWeight:r.labelFontWeight,color:r.labelColor},children:u});if(t.kind==="pin"){let u=t.key==="unconfirmed";return Sn(ng,{bg:u?"#fdf3f2":"#f4f0fe",children:[i(t.label),Y(pt,{sx:{ml:"auto",display:"flex",alignItems:"center",pr:.5},children:Y(rg,{theme:a,count:t.count,bg:u?"#e5484d":"#8b5cf6",color:"#fff"})})]})}let{section:l,visibleTasks:s,collapsed:c}=t;return Sn(ng,{bg:r.bg,hoverBg:r.hoverBg,onClick:!0,children:[c?Y(Uv,{sx:{fontSize:20,color:a.colors.textMuted,ml:"-4px"}}):Y(Vv,{sx:{fontSize:20,color:a.colors.textMuted,ml:"-4px"}}),i(l.label),o.renderGroupTitleSummary&&!l.plain?Y(pt,{sx:{flexShrink:0,display:"flex",alignItems:"center",ml:.5},children:o.renderGroupTitleSummary(l.key,l.tasks)}):null,o.onAddInGroup&&!l.plain&&(!o.canAddInGroup||o.canAddInGroup(l.key))?Y(Wv,{size:"small","aria-label":n("col.addToGroup"),onClick:u=>{u.stopPropagation(),o.onAddInGroup?.(l.key,l.tasks)},sx:{flexShrink:0,ml:.75,p:.25,color:a.colors.textSecondary,"&:hover":{bgcolor:a.colors.surfaceHover,color:a.colors.accentOnSurface}},children:Y($v,{sx:{fontSize:21}})}):null,Sn(pt,{sx:{ml:"auto",minWidth:0,display:"flex",alignItems:"center",gap:1,pr:.5},children:[o.renderGroupSummary&&!l.plain?o.renderGroupSummary(l.key,l.tasks):null,Y(rg,{theme:a,count:s.length,bg:r.badge.bg,color:r.badge.color,border:r.badge.border})]})]})}),dg={padding:"0 !important",height:49,"[data-vdt-pinned-row] > &":{position:"sticky",top:0,zIndex:1}};import{jsx as ft,jsxs as ei}from"react/jsx-runtime";var fg=48,pB=5,fB={borderBottom:"1px solid #000"},gB={thumb:{width:8},showHorizontalScrollbar:!0,scrollTopFab:!0};function gg({tasks:e,statusOptions:t,avatarSrcByName:o,searchText:a,todayStr:r,sortBy:i,sortDirection:l,onSort:s,onRequestReply:c,onToggleCompleted:u,onChangeTaskDate:m,onChangeTaskReminder:d,onChangeTaskEventTime:p,groupBy:f,collapsedGroupKeys:g,customTabs:x,onToggleGroup:h,hideCompleted:E=!1,loading:b=!1,dimCompleted:B=!0,readOnly:T=!1,onChangeTaskIcon:z,onChangeTaskIconColor:k,onAddInGroup:_,canAddInGroup:D,renderGroupSummary:F,renderGroupTitleSummary:R,onChangeTaskProject:C,onAddProject:y,onChangeNote:I,onMemberClick:S,onClaimTask:O,onChangeTaskStatus:w,onOpenDetail:q,onTaskContextMenu:v,onMemberFilterClick:M,activeMemberFilters:j=[],onStatusFilterClick:V,statusFilterActive:Z=!1,onAckFilterClick:ae,ackFilterActive:me=!1,onProjectFilterClick:U,projectFilterActive:ee=!1,onPriorityFilterClick:$,priorityFilterActive:G=!1,onValueFilterClick:re,activeValueFilters:Ee=[],columns:ct,getConfirmInfo:se,onConfirmTask:Q,myAccountSeq:W=0,currentUserName:X="",groupManagerByMyRole:ie=!1,pinKindGroups:de=!1,tailGroups:we,isPostItem:Se,allowManagerVolunteer:_t=!0,noticeAdmin:He=!1,getTargetSummary:De,getTargetDisplay:mt,onArchiveTask:Ge,isTaskUnread:so,getAckInfo:ht,onAckConfirm:te,onAckListClick:Be,onChangeTaskPriority:Je,onEndReached:qe,useTaskItem:en,selectedTaskSeq:Ar,columnResize:co,columnWidths:tr,onColumnWidthsChange:xn}){let or=L(),Vt=xe(),bn=JSON.stringify(ct??{}),jt=ao(()=>({showManager:!0,showActions:!0,showRequest:!0,...ct}),[bn]),nr=jt.showManager??!0,ut=jt.showActions??!0,Ro=jt.showRequest??!0,hn=jt.confirmMode??"none",nt=jt.notice??!1,On=jt.bug??!1,Pe=jt.support??!1,K=Pe||(jt.centerManager??!1),P=jt.trash??!1,ce=f!=="none",{unassignedGroupLabel:ge}=le(),Ze=ao(()=>{if(!ce)return[];let A=(we??[]).map(Re=>({key:Re.key,label:Re.label,plain:Re.plain,tasks:[]})),oe=[];for(let Re of e){let et=(we??[]).findIndex(Nr=>Nr.match(Re));et>=0?A[et].tasks.push(Re):oe.push(Re)}return[...Ds(oe,f,r,x,t,X,{enabled:ie,myAccountSeq:W,unassignedLabel:ge},de),...A.filter(Re=>Re.tasks.length>0)]},[ce,e,we,f,r,x,t,X,ie,W,ge,de]),je=ao(()=>E?e.filter(A=>!A.completed):e,[e,E]),rt=ao(()=>je.filter(A=>A.completed||A.archived||A.is_support?!1:A.is_notice?!!ht?.(A).canAck:!!se?.(A).canConfirm),[je,ht,se]),It=ao(()=>W>0?e.filter(A=>A.completed&&!A.archived&&!A.is_support&&!!A.review_pending&&(A.author_account_seq??0)===W):[],[e,W]),Zt=ao(()=>new Set([...rt,...It].map(A=>A.seq)),[rt,It]),At=ao(()=>Ze.map(A=>({section:A,visibleTasks:A.tasks.filter(oe=>!Zt.has(oe.seq)&&(!E||!oe.completed))})).filter(A=>A.visibleTasks.length>0),[Ze,E,Zt]),Yt=ao(()=>new Set(g),[g]),rr=ao(()=>{let A=[];if(ce)for(let{section:oe,visibleTasks:Re}of At){let et=Yt.has(oe.key);if(A.push({kind:"header",section:oe,visibleTasks:Re,collapsed:et}),!et)for(let Nr of Re)A.push({kind:"task",task:Nr})}else for(let oe of je)Zt.has(oe.seq)||A.push({kind:"task",task:oe});return A},[ce,At,je,Yt,Zt]),ar=ao(()=>{let A=[];if(rt.length>0){A.push({kind:"pin",key:"unconfirmed",label:n("table.unconfirmed"),count:rt.length});for(let oe of rt)A.push({kind:"task",task:oe})}if(It.length>0){A.push({kind:"pin",key:"review",label:n("table.reviewPending"),count:It.length});for(let oe of It)A.push({kind:"task",task:oe})}return A},[rt,It,or]),ir=jt.showProject??(!nt&&f!=="tab"),qr=ao(()=>As({...jt,showProject:ir}),[jt,ir,or]),{onReturnTask:lr}=le(),Li=ao(()=>{let A=new Map;for(let oe of x)A.set(oe.key,{label:oe.archived?n("table.archivedSuffix",{label:oe.label}):oe.label,icon:oe.icon});return A},[x,or]),[Ne,zr]=Xr(null),[Fo,qt]=Xr(null),[$e,Po]=Xr(null),[Ho,Ln]=Xr(null),[os,ns]=Xr(!1),[Ai,rs]=Xr(null),yo=Ai?e.find(A=>A.seq===Ai.taskSeq)??null:null,[za,ma]=Xr(null),ua=za?e.find(A=>A.seq===za.taskSeq)??null:null,[An,qi]=Xr(null),zi=An?e.find(A=>A.seq===An.taskSeq)??null:null,kn=ro((A,oe)=>{qi({anchorEl:oe,taskSeq:A.seq})},[]),mo=ro((A,oe)=>{ma({anchorEl:oe,taskSeq:A.seq})},[]),as=ro((A,oe)=>{rs({anchorEl:oe,taskSeq:A.seq})},[]),Na=ro((A,oe,Re)=>{let et=!!A.is_event,Nr=String(A.event_time??"").trim(),BT=et&&oe==="due_date"&&/^\d{2}:\d{2}$/.test(Nr)?`${String(A.due_date??"").slice(0,10)} ${Nr}`:A[oe];zr({anchorEl:Re,taskSeq:A.seq,field:oe,date:BT,isEvent:et,reminders:nn(A),completed:A.completed})},[]),Fa=ro((A,oe)=>{Ln({anchorEl:oe,task:A})},[]),Ha=ro(A=>{if(Ne){if(Ne.isEvent&&Ne.field==="due_date"){let oe=A.slice(0,10),Re=A.slice(11,16),et=Ne.date.slice(0,10),Nr=Ne.date.slice(11,16);oe!==et&&m(Ne.taskSeq,"due_date",oe),Re!==Nr&&p?.(Ne.taskSeq,Re)}else m(Ne.taskSeq,Ne.field,A);zr(oe=>oe&&{...oe,date:A})}},[Ne,m,p]),ym=ro(A=>{Ne&&(d(Ne.taskSeq,A),zr(oe=>oe&&{...oe,reminders:A}))},[Ne,d]),eo=ro((A,oe)=>{Po({anchorEl:oe,taskSeq:A.seq,title:A.title,kind:"claim"})},[]),to=ro((A,oe)=>{Po({anchorEl:oe,taskSeq:A.seq,title:A.title,kind:"volunteer"})},[]),Co=aB({onConfirmTask:Q,onChangeNote:I,onMemberClick:S,onOpenDetail:q,onAckConfirm:te,onAckListClick:Be,onArchiveTask:Ge,onTaskContextMenu:v,onToggleGroup:h,onSort:s,onMemberFilterClick:M,onStatusFilterClick:V,onAckFilterClick:ae,onProjectFilterClick:U,onPriorityFilterClick:$,onValueFilterClick:re,sortBy:i,sortDirection:l});Co.current={onConfirmTask:Q,onChangeNote:I,onMemberClick:S,onOpenDetail:q,onAckConfirm:te,onAckListClick:Be,onArchiveTask:Ge,onTaskContextMenu:v,onToggleGroup:h,onSort:s,onMemberFilterClick:M,onStatusFilterClick:V,onAckFilterClick:ae,onProjectFilterClick:U,onPriorityFilterClick:$,onValueFilterClick:re,sortBy:i,sortDirection:l};let tn=ao(()=>({onConfirmTask:A=>Co.current.onConfirmTask?.(A),onChangeNote:(A,oe)=>Co.current.onChangeNote(A,oe),onMemberClick:(A,oe)=>Co.current.onMemberClick(A,oe),onOpenDetail:A=>Co.current.onOpenDetail(A),onAckConfirm:A=>Co.current.onAckConfirm?.(A),onAckListClick:(A,oe)=>Co.current.onAckListClick?.(A,oe),onArchiveTask:A=>Co.current.onArchiveTask?.(A)}),[]),is=!!Ge,Cm=ao(()=>({theme:Vt,useTaskItem:en,statusOptions:t,avatarSrcByName:o,searchText:a,myAccountSeq:W,todayStr:r,showManager:nr,showActions:ut,showRequest:Ro,confirmMode:hn,notice:nt,bugMode:On,supportMode:Pe,managerCentered:K,trashMode:P,dimCompleted:B,readOnly:T,projectByKey:Li,getConfirmInfo:se,getTargetSummary:De,getTargetDisplay:mt,getAckInfo:ht,isTaskUnread:so,isPostItem:Se,onConfirmTask:tn.onConfirmTask,onProjectClick:Fa,onRequestToggleCompleted:qt,onDateClick:Na,onChangeNote:tn.onChangeNote,onMemberClick:tn.onMemberClick,onClaimClick:O?eo:void 0,onVolunteerClick:_t?to:void 0,onStatusClick:as,onOpenDetail:tn.onOpenDetail,onPriorityClick:mo,onIconClick:z?kn:void 0,onArchiveTask:is?tn.onArchiveTask:void 0,onAckConfirm:tn.onAckConfirm,onAckListClick:tn.onAckListClick}),[Vt,en,t,o,a,W,r,nr,ut,Ro,hn,nt,On,Pe,K,P,B,T,Li,se,De,mt,ht,so,Se,tn,Fa,Na,O,eo,_t,to,as,mo,z,kn,is]),Ni=ro(A=>!!A.memberFilter&&j.includes(A.memberFilter)||!!A.valueFilter&&Ee.includes(A.valueFilter)||!!A.statusFilter&&Z||!!A.ackFilter&&me||!!A.projectFilter&&ee||!!A.priorityFilter&&G,[j.join(","),Ee.join(","),Z,me,ee,G]),ls=ao(()=>({theme:Vt,sortBy:i,sortDirection:l,isFiltered:Ni}),[Vt,i,l,Ni]),Wa=ao(()=>({theme:Vt,onAddInGroup:_,canAddInGroup:D,renderGroupSummary:F,renderGroupTitleSummary:R}),[Vt,_,D,F,R]),da=ro((A,oe)=>{let Re=Co.current;if(A.memberFilter)Re.onMemberFilterClick(A.memberFilter,oe);else if(A.statusFilter)Re.onStatusFilterClick(oe);else if(A.ackFilter)Re.onAckFilterClick?.(oe);else if(A.projectFilter)Re.onProjectFilterClick?.(oe);else if(A.priorityFilter)Re.onPriorityFilterClick?.(oe);else if(A.valueFilter)Re.onValueFilterClick?.(A.valueFilter,oe);else if(A.sortable){let et=Re.sortBy===A.id&&Re.sortDirection==="asc"?"desc":"asc";Re.onSort(A.id,et)}},[]),Fi=ro((A,oe)=>{(A.memberFilter||A.statusFilter||A.ackFilter||A.projectFilter||A.priorityFilter||A.valueFilter)&&(oe.preventDefault(),da(A,oe.currentTarget))},[da]),N=ro((A,oe)=>{Co.current.onSort(A,oe)},[]),Ye=ao(()=>qr.map(A=>{let oe=Vf[A.id]??{width:120},Re=Ou(A);return{id:A.id,text:ft(mg,{column:A}),width:oe.width,minWidth:oe.minWidth,align:A.align??"left",cellPadding:0,style:{position:"relative"},primary:A.id==="title",headerProps:Re?{onClick:et=>da(A,et.currentTarget),onContextMenu:et=>Fi(A,et),style:{cursor:"pointer"}}:void 0,sortMenu:!!A.sortable,colSpan:A.id==="manager_name"?et=>et.kind==="task"&&(et.task.is_notice||et.task.is_event)?2:1:void 0,render:et=>et.kind==="task"?ft(cg,{task:et.task,columnId:A.id}):null}}),[qr,da,Fi]),qn=ro(A=>A.kind==="task"?null:ft(ug,{row:A}),[]),Hi=ro(A=>{A.kind==="header"&&Co.current.onToggleGroup(A.section.key)},[]),kT=ro((A,oe,Re)=>{A.kind==="task"&&Co.current.onTaskContextMenu(A.task,Re)},[]),TT=ro(A=>A.kind==="task"?A.task.seq:A.kind==="header"?`group:${A.section.key}`:`pin:${A.key}`,[]),yT=`${f}|${i}|${l}|${a}|${E?1:0}`,CT=e.length>0?n("table.completedHidden",{length:e.length}):On?n("table.emptyBugs"):Pe?n("table.emptySupport"):nt?n("table.emptyNotices"):n("table.emptyTasks"),ST=(rt.length>0?1:0)+(It.length>0?1:0),vT=(fg+1)*(pB+ST);return ei(iB,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0,border:`1px solid ${Vt.table.borderColor}`,borderRadius:"0 0 4px 4px",overflow:"hidden",bgcolor:Vt.table.bg,color:Vt.table.rowColor,...Vt.table.sx},children:[ft(cl.Provider,{value:Cm,children:ft(Mu.Provider,{value:ls,children:ft(Lu.Provider,{value:Wa,children:ft(uB,{variant:"notion",framed:!1,showPaper:!1,colorMode:Vt.mode,data:rr,totalCount:rr.length,columns:Ye,rowHeight:fg,getRowId:TT,rowKeyFromId:!0,resetScrollOnDataChange:!1,selectedRowId:Ar??null,renderFullWidthRow:qn,fullWidthRowSx:dg,pinnedRows:ar.length>0?ar:void 0,pinnedRowsMaxHeight:vT,pinnedRowsSx:fB,onRowClick:Hi,onRowContextMenu:kT,sortBy:i,sortDirection:l,onSort:N,onEndReached:ce?void 0:qe,loading:b&&je.length===0,emptyMessage:CT,scrollbars:gB,columnResize:co,columnWidths:tr,onColumnWidthsChange:xn},yT)})})}),ft(Ka,{anchorEl:Ai?.anchorEl??null,value:yo?.status??"",options:yo?Bs(yo):ol,onSelect:A=>{yo&&w(yo.seq,A)},onComplete:yo&&!yo.completed&&!yo.is_notice&&!yo.is_event&&!yo.is_bug&&!P&&((yo.author_account_seq??0)===W||(yo.manager_account_seq??0)===W)?()=>u(yo,!0):void 0,onClose:()=>rs(null)}),ft(pg,{transitionDuration:0,anchorEl:za?.anchorEl??null,open:!!za,onClose:()=>ma(null),children:["high","medium","low"].map(A=>ei(Xs,{selected:ua?.priority===A,onClick:()=>{ua&&Je?.(ua.seq,A),ma(null)},sx:{fontSize:14,minWidth:130,gap:1},children:[ft(uo,{priority:A,small:!0}),ua?.priority===A?ft(Au,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},A))}),ei(pg,{anchorEl:Ho?.anchorEl??null,open:!!Ho,onClose:()=>Ln(null),transitionDuration:0,children:[ei(Xs,{selected:!Ho?.task.tab_key,onClick:()=>{Ho&&C(Ho.task.seq,""),Ln(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[ft(mB,{sx:{fontSize:17,color:"#9a9a97"}}),n("common.none"),Ho?.task.tab_key?null:ft(Au,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}})]}),x.filter(A=>!A.archived).map(A=>{let oe=Oe(A.icon),Re=Ho?.task.tab_key===A.key;return ei(Xs,{selected:Re,onClick:()=>{Ho&&C(Ho.task.seq,A.key),Ln(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[oe?ft(oe,{sx:{fontSize:17,color:"#1e3a8a"}}):null,A.label,Re?ft(Au,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},A.key)}),y?[ft(lB,{},"add-project-divider"),ei(Xs,{onClick:()=>ns(!0),sx:{fontSize:14,color:"#787774"},children:[ft(sB,{children:ft(cB,{sx:{fontSize:18,color:"#787774"}})}),n("table.addProject")]},"add-project")]:null]}),y?ft(Ms,{open:os,onClose:()=>ns(!1),onSubmit:(A,oe)=>{let Re=Ho?.task.seq??0;(async()=>{let et=await y(A,oe);et&&Re&&C(Re,et)})(),Ln(null)}}):null,ft(Vr,{anchorEl:An?.anchorEl??null,value:zi?.icon??"",color:zi?.icon_color??"",onSelect:A=>{An&&z?.(An.taskSeq,A),qi(null)},onSelectColor:k?A=>{An&&k(An.taskSeq,A)}:void 0,onClose:()=>qi(null)}),ft(an,{anchorEl:Ne?.anchorEl??null,open:!!Ne&&Ne?.field==="start_date",date:Ne?.date??"",reminders:[],hideReminder:!0,showTime:!Ne?.isEvent,onClose:()=>zr(null),onDateChange:Ha,onReminderChange:()=>{}}),ft(an,{anchorEl:Ne?.anchorEl??null,open:!!Ne&&Ne?.field==="due_date",date:Ne?.date??"",showTime:!Ne?.isEvent||!!p,autoFillTime:!Ne?.isEvent,reminders:Ne?.reminders??[],hideReminder:!!Ne?.completed,onClose:()=>zr(null),onDateChange:Ha,onReminderChange:ym}),ft(dB,{open:!!$e,anchorEl:$e?.anchorEl??null,title:$e?.kind==="claim"?n("table.claimTakeOverConfirm"):n("table.claimConfirm"),confirmText:n("col.claim"),onCancel:()=>Po(null),onConfirm:()=>{$e&&O?.($e.taskSeq),Po(null)}}),ft(Oo,{open:!!Fo,anchorEl:Fo?.anchorEl??null,nextCompleted:Fo?.nextCompleted??!1,returnMode:!!lr&&!!(Fo&&oo(Fo.task,W)),onCancel:()=>qt(null),onConfirm:A=>{Fo&&(A&&lr?lr(Fo.task,A):u(Fo.task,Fo.nextCompleted)),qt(null)}})]})}import{useCallback as Un,useMemo as ur,useRef as HB,useState as Bn}from"react";import{Box as Ue,ButtonBase as Rg,Divider as yg,IconButton as Cg,Menu as Sg,MenuItem as Qr}from"@mui/material";import Hu from"@mui/icons-material/Add";import vg from"@mui/icons-material/MoreVert";import Bg from"@mui/icons-material/EditOutlined";import _g from"@mui/icons-material/ArchiveOutlined";import Ig from"@mui/icons-material/UnarchiveOutlined";import WB from"@mui/icons-material/NotificationsOutlined";import $B from"@mui/icons-material/PeopleAltOutlined";import{SvgIcon as xB}from"@mui/material";import{jsx as xg}from"react/jsx-runtime";function Xt({sx:e,...t}){return xg(xB,{viewBox:"0 0 24 24",...t,sx:{fill:"none",...e},children:xg("path",{d:"M4 6H20M16 6L15.7294 5.18807C15.4671 4.40125 15.3359 4.00784 15.0927 3.71698C14.8779 3.46013 14.6021 3.26132 14.2905 3.13878C13.9376 3 13.523 3 12.6936 3H11.3064C10.477 3 10.0624 3 9.70951 3.13878C9.39792 3.26132 9.12208 3.46013 8.90729 3.71698C8.66405 4.00784 8.53292 4.40125 8.27064 5.18807L8 6M18 6V16.2C18 17.8802 18 18.7202 17.673 19.362C17.3854 19.9265 16.9265 20.3854 16.362 20.673C15.7202 21 14.8802 21 13.2 21H10.8C9.11984 21 8.27976 21 7.63803 20.673C7.07354 20.3854 6.6146 19.9265 6.32698 19.362C6 18.7202 6 17.8802 6 16.2V6M14 10V17M10 10V17",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}import{DndContext as VB,DragOverlay as UB,PointerSensor as KB,pointerWithin as GB,rectIntersection as jB,useDroppable as YB,useSensor as XB,useSensors as QB}from"@dnd-kit/core";import{SortableContext as Pg,arrayMove as wg,horizontalListSortingStrategy as JB,useSortable as ZB,verticalListSortingStrategy as e_}from"@dnd-kit/sortable";import{CSS as t_}from"@dnd-kit/utilities";import Wu from"@ehfuse/overlay-scrollbar";import{ConfirmActionPopper as Zs}from"@ehfuse/mui-confirm-action";import{useState as BB}from"react";import{Box as Vn,ButtonBase as _B,Checkbox as IB,Tooltip as bg}from"@mui/material";import wB from"@mui/icons-material/AlarmOutlined";import DB from"@mui/icons-material/DragIndicator";import EB from"@mui/icons-material/RadioButtonUnchecked";import RB from"@mui/icons-material/CheckCircle";import PB from"@mui/icons-material/TimerOutlined";import{Box as vn,Button as kB,Popover as TB}from"@mui/material";import yB from"@mui/icons-material/CheckCircle";import{useMediaQuery as bB,useTheme as hB}from"@mui/material";function We(){let{isMobile:e}=le(),t=hB(),o=bB(t.breakpoints.up("lg"));return e!==void 0?e:!o}import{Fragment as CB,jsx as Wn,jsxs as Ta}from"react/jsx-runtime";function Qs({anchorEl:e,open:t,acks:o,total:a,avatarSrcByName:r,pendingNames:i=[],onRequestConfirm:l,onClose:s}){L();let c=We();return Wn(TB,{open:t&&(c||!!e),anchorEl:e,onClose:s,transitionDuration:0,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},...c?{anchorReference:"none",slotProps:{paper:{sx:{position:"fixed",top:"50%",left:"50%",translate:"-50% -50%",maxWidth:"calc(100vw - 48px)",maxHeight:"70vh",borderRadius:3}}}}:{},children:Ta(vn,{sx:{minWidth:240,maxWidth:320,py:1},children:[Ta(vn,{sx:{px:2,pb:.75,fontSize:dt(13.5),fontWeight:600,color:"#37352f",borderBottom:"1px solid #efefed"},children:[n("task.confirm")," ",o.length,"/",a]}),i.length>0&&o.length>0?Ta(vn,{sx:{px:2,pt:1,pb:.5,fontSize:dt(12.5),fontWeight:600,color:"#9a9a97"},children:[n("task.confirm")," ",o.length]}):null,o.length===0?i.length>0?null:Wn(vn,{sx:{px:2,py:1.5,fontSize:dt(13.5),color:"#9a9a97"},children:n("menu.noAckYet")}):o.map(u=>Ta(vn,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:.75,minWidth:0},children:[Wn(So,{names:[u.name],size:22,avatarSrcByName:r}),Wn(vn,{component:"span",sx:{fontSize:dt(14),color:"#37352f",whiteSpace:"nowrap"},children:u.name}),Wn(vn,{component:"span",sx:{ml:"auto",fontSize:dt(12.5),color:"#9a9a97",whiteSpace:"nowrap"},children:Vo(u.time)}),Wn(yB,{sx:{fontSize:16,color:"#2f80ed",flexShrink:0}})]},u.account_seq)),i.length>0?Ta(CB,{children:[Ta(vn,{sx:{mt:o.length>0?.75:0,px:2,pt:1,pb:.5,borderTop:o.length>0?"1px solid #efefed":"none",fontSize:dt(12.5),fontWeight:600,color:"#9a9a97"},children:[n("menu.unacknowledged")," ",i.length]}),i.map(u=>Ta(vn,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:.75,minWidth:0},children:[Wn(So,{names:[u],size:22,avatarSrcByName:r}),Wn(vn,{component:"span",sx:{fontSize:dt(14),color:"#37352f",whiteSpace:"nowrap"},children:u})]},u))]}):null,l?Wn(vn,{sx:{borderTop:"1px solid #efefed",px:1.5,pt:1,pb:1},children:Wn(kB,{size:"small",fullWidth:!0,variant:"outlined",onClick:()=>{l(),s()},sx:{fontSize:dt(14),py:.9},children:n("menu.requestConfirm")})}):null]})})}function SB(e){let t=Number(e.author_account_seq??0);return[...new Set([Number(e.manager_account_seq??0),...e.receiver_account_seqs??[]].filter(o=>o>0&&o!==t))]}function vB(e){let t=new Map,o=Number(e.manager_account_seq??0);o>0&&t.set(o,String(e.manager_name??"").trim());let a=e.receiver_account_seqs??[],r=e.receiver_names??[];return a.forEach((i,l)=>{i>0&&!t.has(i)&&t.set(i,String(r[l]??"").trim())}),t}function $n(e,t){let o=SB(e),a=e.acks??[],r=t>0?a.find(s=>s.account_seq===t):void 0,i=new Set(a.map(s=>s.account_seq)),l=vB(e);return{myTime:r?.time??"",canConfirm:t>0&&o.includes(t)&&!r,count:a.filter(s=>o.includes(s.account_seq)).length,total:o.length,pendingNames:o.filter(s=>!i.has(s)).map(s=>l.get(s)??"").filter(s=>s.length>0)}}function c3(e){let t=String(e??"").trim();return t?t.slice(5,16).replaceAll("-","."):""}import{Fragment as LB,jsx as Mt,jsxs as ti}from"react/jsx-runtime";function Js(e){return{border:`1px solid ${e.borderColor}`,borderRadius:1,p:1,bgcolor:e.bg,display:"flex",flexDirection:"column",gap:.75,boxShadow:"0 1px 2px rgba(0,0,0,0.04)",...e.sx}}var MB=3;function OB(e){let t=e.trim();return t?t.slice(2,10).replaceAll("-","."):"-"}function hg(){let e=new Date,t=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${e.getFullYear()}-${t}-${o}`}var qu="taskbox-card-drag-handle";function ml({task:e,statusOptions:t,showDueDate:o=!1,onRequestArchiveToggle:a,onRequestReply:r,onDueDateClick:i,titleFontSize:l=13,dragHandleProps:s}){L();let c=xe(),u=ja(e,le().resolveTask),m=!!e.due_date&&e.due_date.slice(0,10)<=hg(),p=!!e.is_event&&!!e.due_date&&e.due_date.slice(0,10)<hg()?c.colors.textSecondary:m?c.colors.danger:c.colors.textPrimary,f=$n(e,0),[g,x]=BB(null),h=Ua(e,t),E=new Set(e.label_keys??[]),b=h.filter(T=>!E.has(T.key)),B=h.filter(T=>E.has(T.key));return ti(LB,{children:[ti(Vn,{sx:{display:"flex",alignItems:"flex-start",gap:.5},children:[s?Mt(Vn,{className:qu,...s,onClick:T=>T.stopPropagation(),sx:{display:"inline-flex",alignItems:"center",flexShrink:0,ml:-.5,mr:-.25,color:c.colors.textMuted,cursor:"grab",touchAction:"none","&:active":{cursor:"grabbing"}},children:Mt(DB,{sx:{fontSize:18}})}):null,Mt(IB,{size:"small",icon:Mt(EB,{sx:{fontSize:20}}),checkedIcon:Mt(RB,{sx:{fontSize:20}}),checked:e.completed,inputProps:{"aria-label":e.completed?n("col.uncompleteAria",{title:e.title}):n("col.completeAria",{title:e.title})},onPointerDown:T=>T.stopPropagation(),onClick:T=>T.stopPropagation(),onChange:(T,z)=>a?.({anchorEl:T.currentTarget,taskSeq:e.seq,nextCompleted:z}),sx:{p:0}}),Mt(bg,{title:e.title,arrow:!0,enterDelay:300,children:ti(Vn,{sx:{flex:1,minWidth:0,pr:1,fontSize:l,fontWeight:c.mode==="dark"||e.completed?400:500,color:e.completed?c.colors.textMuted:c.mode==="dark"?c.colors.textStrong:c.colors.textPrimary,lineHeight:1.35,overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:MB,overflowWrap:"anywhere"},children:[e.is_event&&e.event_time?`${e.event_time} `:"",e.title,u?Mt(Vn,{component:"span",sx:{ml:.75,fontSize:12.5,fontWeight:400,color:c.colors.textMuted,fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap",textDecoration:"none"},children:u}):null,(e.comment_count??e.comments?.length??0)>0?Mt(Yr,{sx:{fontSize:15,ml:.5,verticalAlign:"-2px",color:c.colors.textMuted}}):null]})})]}),e.is_bug&&e.ticket_no?Mt(Vn,{sx:{pl:3,mt:-.5,fontSize:12.5,color:c.colors.textSecondary,fontWeight:500,fontVariantNumeric:"tabular-nums"},children:e.ticket_no}):null,ti(Vn,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:.5},children:[ti(Vn,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5,minWidth:0},children:[b.map(T=>Mt(Ve,{option:T,small:!0},T.key)),Mt(uo,{priority:e.priority,small:!0}),B.map(T=>Mt(Ve,{option:T,small:!0},T.key))]}),o?Mt(bg,{title:n("col.due"),arrow:!0,placement:"top",disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Mt(_B,{disabled:!i,onPointerDown:T=>T.stopPropagation(),onClick:T=>{T.stopPropagation(),i?.(e,T.currentTarget)},sx:{display:"inline-flex",alignItems:"center",px:.5,py:.1,borderRadius:.75,fontSize:13,fontWeight:500,color:p,whiteSpace:"nowrap","&:hover":i?{bgcolor:c.colors.border}:void 0},children:String(e.due_date??"").trim()?OB(e.due_date):Mt(wB,{sx:{fontSize:15,color:c.colors.textMuted}})})}):null]}),o&&(e.due_date.slice(11,16)||e.estimated_time)?ti(Vn,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:.25,mt:-.5,fontSize:12,color:c.colors.textSecondary},children:[Mt(PB,{sx:{fontSize:14}}),e.due_date.slice(11,16)||e.estimated_time]}):null,Mt(So,{names:[...Cn(e)?[Cn(e)]:[],...e.receiver_names],size:20,ringFirst:!!Cn(e)}),f.total>0?Mt(Vn,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:.5},children:Mt(Vn,{sx:{flexShrink:0,width:64},onPointerDown:T=>T.stopPropagation(),onClick:T=>T.stopPropagation(),children:Mt(Xa,{canConfirm:!1,count:f.count,total:f.total,onConfirm:()=>{},onShowList:T=>x(T)})})}):null,Mt(Qs,{anchorEl:g,open:!!g,acks:e.acks??[],total:f.total,pendingNames:f.pendingNames,onRequestConfirm:r&&f.count<f.total?()=>{r(e),x(null)}:void 0,onClose:()=>x(null)})]})}import{Box as AB}from"@mui/material";import{useSortable as qB}from"@dnd-kit/sortable";import{CSS as zB}from"@dnd-kit/utilities";import{jsx as kg}from"react/jsx-runtime";function NB(e){return{px:1.25,py:1,display:"flex",flexDirection:"column",gap:.75,borderBottom:`1px solid ${e.borderColor}`,bgcolor:e.bg}}function Tg({task:e,statusOptions:t,variant:o="card",showDueDate:a=!1,onRequestArchiveToggle:r,onRequestReply:i,onDueDateClick:l,onCardClick:s,onCardContextMenu:c,titleFontSize:u}){let m=xe(),{attributes:d,listeners:p,setNodeRef:f,transform:g,transition:x,isDragging:h}=qB({id:String(e.seq)}),E=o==="list";return kg(AB,{ref:f,onClick:s?()=>s(e):void 0,onContextMenu:c?b=>c(e,b):void 0,sx:{...E?NB(m.card):Js(m.card),opacity:h?.35:e.completed?.55:1,transform:zB.Translate.toString(g),transition:x,position:"relative",cursor:"default","&:hover":E?{bgcolor:m.card.hoverBg}:{boxShadow:"0 3px 8px rgba(0,0,0,0.1)"}},children:kg(ml,{task:e,statusOptions:t,showDueDate:a,onRequestArchiveToggle:r,onRequestReply:i,onDueDateClick:l,titleFontSize:u,dragHandleProps:{...d,...p}})})}function FB(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?e.slice(5).replace("-","."):""}function sn(e){if(e.status==="closed")return n("group.closedSuffix",{name:e.name});let t=FB(e.end_date);return t?`${e.name} (~${t})`:e.name}import{jsx as fe,jsxs as gt}from"react/jsx-runtime";var Dg=2,Mg="taskbox-column-drag-handle",$u=[qu,Mg],ec="group-",cn="colmove-",zu="__default__",Nu=pu,Fu="__other__",tc="sprint-",Eg=`${tc}0`,o_={planning:"#9a9a97",active:"#2f80ed",closed:"#9a9a97"};function Og(e){return{flexShrink:0,width:e.width,py:e.paddingY,borderRadius:`${e.borderRadius}px`,bgcolor:e.bg,border:e.border,color:e.color,fontSize:e.fontSize,fontWeight:e.fontWeight,lineHeight:1.6,textAlign:"center",fontVariantNumeric:"tabular-nums",...e.sx}}function n_({column:e,tasks:t,statusOptions:o,onRequestArchiveToggle:a,onRequestReply:r,onDueDateClick:i,onAddTask:l,canAdd:s,onOpenMenu:c,onCardClick:u,onCardContextMenu:m,grow:d,summary:p,onOpenSprintMenu:f}){L();let g=xe(),{setNodeRef:x,isOver:h}=YB({id:`${ec}${e.key}`}),{attributes:E,listeners:b,setNodeRef:B,transform:T,transition:z,isDragging:k}=ZB({id:`${cn}${e.key}`,disabled:e.isDefault||e.isArchived||!!e.locked});return gt(Ue,{ref:_=>{x(_),B(_)},sx:{flex:d?"1 0 270px":"0 0 270px",minWidth:270,contain:"inline-size",minHeight:0,maxHeight:"100%",display:"flex",flexDirection:"column",borderRadius:1.5,boxShadow:_=>_.shadows[1],bgcolor:h?g.colors.accentSoft:g.board.columnBg,transition:"background-color 0.15s",overflow:"hidden",transform:t_.Translate.toString(T),...z?{transition:`${z}, background-color 0.15s`}:{},opacity:k?.6:1},children:[gt(Ue,{className:Mg,...E,...b,sx:{display:"flex",alignItems:"center",gap:.75,pl:1.25,pr:.5,py:1.1,borderBottom:`1px solid ${g.card.borderColor}`,flexShrink:0,touchAction:"none",cursor:e.isDefault||e.isArchived||e.locked?"default":"grab",opacity:e.isArchived?.65:1},children:[e.dot?fe(Ue,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:e.dot,flexShrink:0}}):e.isDefault?null:(()=>{let _=Oe(e.icon);return _?fe(_,{sx:{fontSize:17,color:"#1e3a8a"}}):null})(),fe(Ue,{component:"span",sx:{fontSize:g.board.columnHeaderFontSize,fontWeight:700,color:g.board.columnHeaderColor,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),fe(Ue,{component:"span",sx:{...Og(g.board.badge),ml:"auto"},children:t.length}),e.sprint&&f?fe(Cg,{size:"small","aria-label":n("board.goalMenu"),onPointerDown:_=>_.stopPropagation(),onClick:_=>f(_.currentTarget,e.sprint),sx:{color:"#9a9a97"},children:fe(vg,{sx:{fontSize:18}})}):e.locked?null:fe(Cg,{size:"small","aria-label":n("board.projectMenu"),onPointerDown:_=>_.stopPropagation(),onClick:_=>c({anchorEl:_.currentTarget,column:e}),sx:{color:"#9a9a97"},children:fe(vg,{sx:{fontSize:18}})})]}),p?fe(Ue,{sx:{px:1.25,py:1.25,borderBottom:`1px solid ${g.card.borderColor}`,flexShrink:0},children:p}):null,fe(Ue,{sx:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column"},children:fe(Wu,{style:{height:"auto",flex:"1 1 auto",minHeight:0},contentStyle:{minWidth:0},thumb:{width:6},dragScroll:{excludeClasses:$u},children:gt(Ue,{sx:{display:"flex",flexDirection:"column",flexGrow:1},children:[fe(Pg,{items:t.map(_=>String(_.seq)),strategy:e_,children:t.map(_=>fe(Tg,{task:_,statusOptions:o,variant:"list",showDueDate:!0,titleFontSize:15,onRequestArchiveToggle:a,onRequestReply:r,onDueDateClick:i,onCardClick:u,onCardContextMenu:m},_.seq))}),t.length===0&&!s?fe(Ue,{sx:{py:3,textAlign:"center",fontSize:13,color:"#9a9a97"},children:n("board.noCards")}):null,t.length===0&&s?fe(Ue,{sx:{flexGrow:1,minHeight:56,display:"flex",flexDirection:"column","&:hover .taskbox-board-add":{opacity:1,pointerEvents:"auto"}},children:gt(Rg,{className:"taskbox-board-add",onClick:()=>l(e.isDefault?"":e.key),sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,px:1.25,py:1.75,borderBottom:`1px dashed ${g.card.borderColor}`,bgcolor:g.card.bg,color:g.colors.accentOnSurface,fontSize:13,fontWeight:500,opacity:0,pointerEvents:"none",transition:"opacity 0.15s","&:hover":{bgcolor:g.card.hoverBg}},children:[fe(Hu,{sx:{fontSize:16}}),n("task.addTask")]})}):null]})})})]})}function Vu({tasks:e,statusOptions:t,customTabs:o,mode:a="active",onToggleCompleted:r,onRequestReply:i,onChangeDueDate:l,onChangeReminder:s,onMoveTask:c,columnAxis:u="project",statusColumns:m=[],statusKeyOf:d,closedColumn:p=!0,otherColumnLabel:f=n("board.other"),onMoveTaskStatus:g,sprintColumns:x=[],onMoveTaskSprint:h,onAddGroup:E,onAddTask:b,canAdd:B=!0,onRequestRename:T,onArchiveProject:z,onDeleteProject:k,onReorderProjects:_,onOpenDetail:D,onTaskContextMenu:F,hideCompleted:R=!1,renderColumnSummary:C,onEditSprint:y,onChangeSprintStatus:I,onRemoveSprint:S}){let O=L(),w=xe(),{onReturnTask:q,myAccountSeq:v=0}=le(),[M,j]=Bn(null),V=M?e.find(K=>K.seq===M.taskSeq):void 0,[Z,ae]=Bn(null),[me,U]=Bn(null),[ee,$]=Bn(null),[G,re]=Bn(null),[Ee,ct]=Bn(null),[se,Q]=Bn(null),[W,X]=Bn(null),[ie,de]=Bn(null),[we,Se]=Bn(null),[_t,He]=Bn(null),De=HB(!1),mt=ur(()=>new Map(e.map(K=>[K.seq,K])),[e]),Ge=ur(()=>{let K=e.filter(P=>P.is_notice);return K.sort((P,ce)=>P.completed!==ce.completed?P.completed?1:-1:ce.seq-P.seq),K},[e]),so=ur(()=>o.filter(K=>!K.archived),[o]),ht=ur(()=>o.filter(K=>K.archived),[o]),te=K=>({key:K.key,label:K.label,icon:K.icon,isDefault:!1,isArchived:K.archived}),Be=ur(()=>new Set(m.map(K=>K.key)),[m]),Je=ur(()=>new Set(x.map(K=>K.seq)),[x]),qe=ur(()=>{if(u==="sprint")return[{key:Eg,label:n("board.unassigned"),icon:"",isDefault:!0,isArchived:!1,dot:"#c9c8c5",locked:!0},...x.map(K=>({key:`${tc}${K.seq}`,label:sn(K),icon:"",isDefault:!1,isArchived:!1,dot:o_[K.status],locked:!0,sprint:K}))];if(u==="status"){let K=m.map(P=>({key:P.key,label:P.name,icon:"",isDefault:!1,isArchived:!1,dot:P.dot,locked:!0}));return!p||K.some(P=>P.key===Nu)?K:[...K,{key:Nu,label:n("common.done"),icon:"",isDefault:!1,isArchived:!1,dot:"#2f80ed",locked:!0}]}return a==="archived"?ht.map(te):[{key:zu,label:Ga(),icon:"",isDefault:!0,isArchived:!1},...so.map(te)]},[u,m,p,x,a,so,ht,O]),en=QB(XB(KB,{activationConstraint:{distance:5}})),Ar=Un(K=>{let P=String(K.active.id).startsWith(cn),ce=GB(K),ge=ce.length>0?ce:jB(K);if(P)return ge.filter(rt=>String(rt.id).startsWith(cn));let Ze=ge.filter(rt=>!String(rt.id).startsWith(cn)),je=Ze.filter(rt=>!String(rt.id).startsWith(ec));return je.length>0?je:Ze},[]),co=ur(()=>{let K=new Map;for(let P of e){if(P.is_notice)continue;let ce;if(u==="sprint"){let Ze=P.sprint_seq??0;ce=Je.has(Ze)?`${tc}${Ze}`:Eg}else ce=u==="status"?P.completed&&p?Nu:Be.has(d?d(P):String(P.status??""))?d?d(P):String(P.status??""):Fu:P.tab_key?.trim()||zu;let ge=K.get(ce);ge?ge.push(P):K.set(ce,[P])}for(let P of K.values())P.sort((ce,ge)=>{if(ce.completed!==ge.completed)return ce.completed?1:-1;let Ze=(ce.group_sort_no??0)>0,je=(ge.group_sort_no??0)>0;return Ze&&je?(ce.group_sort_no??0)-(ge.group_sort_no??0):Ze!==je?Ze?-1:1:ce.due_date!==ge.due_date?ce.due_date<ge.due_date?-1:1:ce.seq-ge.seq});return K},[e,u,Be,Je,d,p]),tr=ur(()=>u!=="status"||(co.get(Fu)??[]).length===0?qe:[...qe,{key:Fu,label:f,icon:"",isDefault:!1,isArchived:!1,dot:"#c9c8c5",locked:!0}],[u,qe,co,f]),xn=Un(K=>ie?(ie.get(K)??[]).map(P=>mt.get(P)).filter(P=>!!P):co.get(K)??[],[ie,mt,co]),or=Un(K=>{let P=xn(K);return R?P.filter(ce=>!ce.completed):P},[xn,R]),Vt=Un(K=>{let P=String(K.active.id);if(P.startsWith(cn)){He(P.slice(cn.length));return}Se(Number(P)),de(new Map(qe.map(ce=>[ce.key,(co.get(ce.key)??[]).map(ge=>ge.seq)])))},[qe,co]),bn=Un((K,P)=>{if(K.startsWith(ec))return{key:K.slice(ec.length),overSeq:null};let ce=Number(K);for(let[ge,Ze]of P)if(Ze.includes(ce))return{key:ge,overSeq:ce};return null},[]),jt=Un(K=>{let{active:P,over:ce}=K;!ce||String(P.id).startsWith(cn)||de(ge=>{if(!ge)return ge;let Ze=Number(P.id),je=bn(String(ce.id),ge);if(!je)return ge;let rt=[...ge.entries()].find(([,Yt])=>Yt.includes(Ze))?.[0];if(!rt||rt===je.key)return ge;let It=new Map(ge);It.set(rt,(It.get(rt)??[]).filter(Yt=>Yt!==Ze));let Zt=[...It.get(je.key)??[]],At=Zt.length;if(je.overSeq!==null){let Yt=Zt.indexOf(je.overSeq);Yt!==-1&&(At=Yt)}return Zt.splice(At,0,Ze),It.set(je.key,Zt),It})},[bn]),nr=Un(K=>{let P=String(K.active.id);if(P.startsWith(cn)){He(null);let At=String(K.over?.id??"");if(!At.startsWith(cn))return;let Yt=P.slice(cn.length),rr=At.slice(cn.length);if(Yt===rr)return;let ar=o.map(lr=>lr.key),ir=ar.indexOf(Yt),qr=ar.indexOf(rr);if(ir===-1||qr===-1)return;_(wg(ar,ir,qr));return}let ce=ie;if(de(null),Se(null),De.current=!0,!ce||!K.over)return;let ge=Number(P),Ze=[...ce.entries()].find(([,At])=>At.includes(ge));if(!Ze)return;let[je,rt]=Ze,It=[...rt],Zt=bn(String(K.over.id),ce);if(Zt&&Zt.key===je&&Zt.overSeq!==null&&Zt.overSeq!==ge){let At=It.indexOf(ge),Yt=It.indexOf(Zt.overSeq);At!==-1&&Yt!==-1&&(It=wg(It,At,Yt))}if(u==="status"){g?.(ge,je);return}if(u==="sprint"){h?.(ge,Number(je.slice(tc.length))||0);return}c(ge,je===zu?"":je,It)},[o,ie,bn,c,_,u,g,h]),ut=Un(()=>{de(null),Se(null),He(null),De.current=!0},[]),Ro=Un(K=>{if(De.current){De.current=!1;return}D(K)},[D]),hn=we!==null?mt.get(we)??null:null,nt=_t!==null?qe.find(K=>K.key===_t)??null:null,On=Un((K,P)=>{X({anchorEl:P,taskSeq:K.seq,date:K.due_date,reminders:nn(K)})},[]),Pe=Z?.column??null;return gt(Ue,{sx:{flex:1,minHeight:0,height:"100%",display:"flex",flexDirection:"column",border:`1px solid ${w.card.borderColor}`,borderRadius:"0 0 4px 4px",overflow:"hidden",bgcolor:w.colors.surfaceSubtle},children:[gt(VB,{sensors:en,collisionDetection:Ar,onDragStart:Vt,onDragOver:jt,onDragEnd:nr,onDragCancel:ut,children:[fe(Ue,{sx:{flex:1,minHeight:0,minWidth:0,contain:"inline-size"},children:a==="archived"&&qe.length===0?fe(Ue,{sx:{py:8,textAlign:"center",color:"#9a9a97",fontSize:14},children:n("board.noArchivedProjects")}):fe(Wu,{style:{height:"100%"},contentStyle:{width:"max-content",minWidth:"100%",height:"100%"},thumb:{width:8},showHorizontalScrollbar:!0,dragScroll:{excludeClasses:$u},children:gt(Ue,{sx:{display:"flex",alignItems:"flex-start",gap:Dg,height:"100%",minWidth:"min-content",p:Dg,boxSizing:"border-box"},children:[a==="active"&&Ge.length>0?gt(Ue,{sx:{flex:u!=="project"?"1 0 270px":"0 0 270px",minWidth:270,contain:"inline-size",minHeight:0,maxHeight:"100%",display:"flex",flexDirection:"column",borderRadius:1.5,boxShadow:K=>K.shadows[1],bgcolor:w.card.bg,overflow:"hidden"},children:[gt(Ue,{sx:{display:"flex",alignItems:"center",gap:.75,pl:1.25,pr:.5,py:1.1,borderBottom:`1px solid ${w.card.borderColor}`,flexShrink:0,minHeight:48},children:[fe(WB,{sx:{fontSize:17,color:"#e8763a"}}),fe(Ue,{component:"span",sx:{fontSize:14.5,fontWeight:700,color:w.board.columnHeaderColor},children:n("tab.notice")}),gt(Ue,{component:"span",sx:{fontSize:13,color:"#9a9a97",flexShrink:0},children:["(",Ge.length,")"]})]}),fe(Ue,{sx:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column"},children:fe(Wu,{style:{height:"auto",flex:"1 1 auto",minHeight:0},contentStyle:{minWidth:0},dragScroll:{excludeClasses:$u},thumb:{width:6},children:fe(Ue,{sx:{display:"flex",flexDirection:"column"},children:Ge.map(K=>gt(Ue,{onClick:()=>Ro(K),onContextMenu:P=>F(K,P),sx:{px:1.25,py:1,display:"flex",flexDirection:"column",gap:.75,borderBottom:`1px solid ${w.card.borderColor}`,bgcolor:w.card.bg,cursor:"pointer","&:hover":{bgcolor:w.card.hoverBg}},children:[fe(ml,{task:K,statusOptions:t,showDueDate:!0,titleFontSize:15,onRequestArchiveToggle:j}),(()=>{let P=(K.target_names??[]).filter(ge=>ge.trim());if(P.length===0)return null;let ce=P.length>2?n("board.namesAndMore",{value:P[0],value2:P[1],value3:P.length-2}):P.join(", ");return gt(Ue,{sx:{display:"flex",alignItems:"center",gap:.5,fontSize:12.5,color:"#787774",overflow:"hidden",whiteSpace:"nowrap"},children:[fe($B,{sx:{fontSize:14,flexShrink:0}}),fe(Ue,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis"},children:ce})]})})()]},K.seq))})})})]}):null,fe(Pg,{items:so.map(K=>`${cn}${K.key}`),strategy:JB,children:tr.map(K=>fe(n_,{column:K,tasks:or(K.key),summary:C?.(K.key,xn(K.key)),onOpenSprintMenu:y||I||S?(P,ce)=>U({anchorEl:P,sprint:ce}):void 0,statusOptions:t,onRequestArchiveToggle:j,onRequestReply:i,onDueDateClick:On,onAddTask:b,canAdd:B&&u==="project",onOpenMenu:ae,onCardClick:Ro,onCardContextMenu:F,grow:u!=="project"},K.key))}),a==="active"&&u==="project"?gt(Rg,{onClick:E,sx:{flex:"0 0 270px",minWidth:270,display:"flex",alignItems:"center",justifyContent:"center",gap:.5,py:2,border:"1.5px dashed #cfcfcc",borderRadius:1.5,color:"#787774",fontSize:14,"&:hover":{bgcolor:"#eef2f6",borderColor:"#9a9a97"}},children:[fe(Hu,{sx:{fontSize:18}}),"\uC0C8",n("col.project")]}):null,a==="active"&&tr.length===0&&Ge.length===0?fe(Ue,{sx:{flex:1,minWidth:240,display:"flex",alignItems:"center",justifyContent:"center",color:"#9a9a97",fontSize:14,py:6},children:u==="project"?n("board.noProjects"):n("table.emptyTasks")}):null]})})}),fe(UB,{children:hn?fe(Ue,{sx:{...Js,width:250,boxShadow:"0 8px 20px rgba(0,0,0,0.18)",cursor:"grabbing"},children:fe(ml,{task:hn,statusOptions:t,showDueDate:!0,titleFontSize:15})}):nt?gt(Ue,{sx:{display:"flex",alignItems:"center",gap:.75,width:270,px:1.25,py:1,bgcolor:w.card.bg,border:`1px solid ${w.card.borderColor}`,borderRadius:1.5,boxShadow:"0 8px 20px rgba(0,0,0,0.18)",opacity:.9,cursor:"grabbing"},children:[(()=>{let K=Oe(nt.icon);return K?fe(K,{sx:{fontSize:17,color:"#1e3a8a"}}):null})(),fe(Ue,{component:"span",sx:{fontSize:13.5,fontWeight:700,color:w.board.columnHeaderColor},children:nt.label}),fe(Ue,{component:"span",sx:Og(w.board.badge),children:(co.get(nt.key)??[]).length})]}):null})]}),gt(Sg,{transitionDuration:0,anchorEl:Z?.anchorEl??null,open:!!Z,onClose:()=>ae(null),children:[Pe&&!Pe.isArchived&&B?gt(Qr,{onClick:()=>{Pe&&b(Pe.isDefault?"":Pe.key),ae(null)},sx:{fontSize:14,gap:1},children:[fe(Hu,{sx:{fontSize:18,color:"#787774"}}),"\uC0C8",n("task.addTask")]}):null,Pe&&!Pe.isDefault&&!Pe.isArchived?gt(Qr,{onClick:()=>{T(Pe.key,Pe.label,Pe.icon),ae(null)},sx:{fontSize:14,gap:1},children:[fe(Bg,{sx:{fontSize:18,color:"#787774"}}),n("common.edit")]}):null,Pe&&!Pe.isDefault&&!Pe.isArchived?gt(Qr,{onClick:()=>{if(Z){let K=(co.get(Z.column.key)??[]).filter(P=>!P.completed&&!P.archived).length;K>0?ct({anchorEl:Z.anchorEl,count:K}):re(Z)}ae(null)},sx:{fontSize:14,gap:1},children:[fe(_g,{sx:{fontSize:18,color:"#787774"}}),n("menu.archive")]}):null,Pe&&Pe.isArchived?gt(Qr,{onClick:()=>{z(Pe.key,!1),ae(null)},sx:{fontSize:14,gap:1},children:[fe(Ig,{sx:{fontSize:18,color:"#787774"}}),n("menu.restore")]}):null,Pe&&!Pe.isDefault?fe(yg,{}):null,Pe&&!Pe.isDefault?gt(Qr,{onClick:()=>{Z&&Q(Z),ae(null)},sx:{fontSize:14,gap:1,color:"#e5484d"},children:[fe(Xt,{sx:{fontSize:18}}),n("common.delete")]}):null]}),gt(Sg,{transitionDuration:0,anchorEl:me?.anchorEl??null,open:!!me,onClose:()=>U(null),children:[y?gt(Qr,{onClick:()=>{me&&y(me.sprint.seq),U(null)},sx:{fontSize:14,gap:1},children:[fe(Bg,{sx:{fontSize:18,color:"#787774"}}),n("board.editGoal")]}):null,I?gt(Qr,{onClick:()=>{me&&I(me.sprint.seq,me.sprint.status==="closed"?"active":"closed"),U(null)},sx:{fontSize:14,gap:1},children:[me?.sprint.status==="closed"?fe(Ig,{sx:{fontSize:18,color:"#787774"}}):fe(_g,{sx:{fontSize:18,color:"#787774"}}),me?.sprint.status==="closed"?n("board.restartGoal"):n("board.closeGoal")]}):null,S?fe(yg,{}):null,S?gt(Qr,{onClick:()=>{me&&$(me),U(null)},sx:{fontSize:14,gap:1,color:"#e5484d"},children:[fe(Xt,{sx:{fontSize:18}}),n("board.deleteGoal")]}):null]}),fe(Zs,{open:!!ee,anchorEl:ee?.anchorEl??null,title:n("board.deleteGoalConfirm",{name:ee?.sprint.name??""}),confirmText:n("common.delete"),onCancel:()=>$(null),onConfirm:()=>{ee&&S?.(ee.sprint.seq),$(null)}}),fe(an,{anchorEl:W?.anchorEl??null,open:!!W,date:W?.date??"",reminders:W?.reminders??[],onClose:()=>X(null),onDateChange:K=>{W&&(l(W.taskSeq,K),X(P=>P&&{...P,date:K}))},onReminderChange:K=>{W&&(s(W.taskSeq,K),X(P=>P&&{...P,reminders:K}))}}),fe(Zs,{open:!!Ee,anchorEl:Ee?.anchorEl??null,title:n("board.archiveBlocked",{count:Ee?.count??0}),confirmText:n("common.confirm"),onCancel:()=>ct(null),onConfirm:()=>ct(null)}),fe(Zs,{open:!!G,anchorEl:G?.anchorEl??null,title:n("board.archiveProjectConfirm",{label:G?.column.label??""}),confirmText:n("menu.archive"),onCancel:()=>re(null),onConfirm:()=>{G&&z(G.column.key,!0),re(null)}}),fe(Zs,{open:!!se,anchorEl:se?.anchorEl??null,title:n("board.deleteProjectConfirm",{label:se?.column.label??""}),confirmText:n("common.delete"),onCancel:()=>Q(null),onConfirm:()=>{se&&k(se.column.key),Q(null)}}),fe(Oo,{open:!!M,anchorEl:M?.anchorEl??null,nextCompleted:M?.nextCompleted??!1,returnMode:!!q&&!!(V&&oo(V,v)),onCancel:()=>j(null),onConfirm:K=>{M&&(K&&q&&V?q(V,K):r(M.taskSeq,M.nextCompleted)),j(null)}})]})}import{useCallback as pr,useMemo as ul,useRef as qg,useState as dl}from"react";import{Box as Kt,Button as p_,ButtonBase as Ng,IconButton as zg}from"@mui/material";import f_ from"@mui/icons-material/Add";import g_ from"@mui/icons-material/ChevronLeft";import x_ from"@mui/icons-material/ChevronRight";import b_ from"@mui/icons-material/KeyboardArrowDown";import{DatePicker as h_}from"@ehfuse/mui-datetime-picker";import{DndContext as k_,DragOverlay as T_,PointerSensor as y_,pointerWithin as C_,rectIntersection as S_,useDroppable as v_,useSensor as B_,useSensors as __}from"@dnd-kit/core";import{SortableContext as I_,arrayMove as w_,useSortable as D_,verticalListSortingStrategy as E_}from"@dnd-kit/sortable";import{CSS as R_}from"@dnd-kit/utilities";import P_ from"@ehfuse/overlay-scrollbar";function r_(e){let[t,o,a]=e.split("-").map(Number),r=new Date(Date.UTC(t,o-1,a+1)),i=l=>String(l).padStart(2,"0");return`${r.getUTCFullYear()}-${i(r.getUTCMonth()+1)}-${i(r.getUTCDate())}`}function oi(e){let t=new Map;for(let o of e){let a=o.start_date;for(let r=0;r<62&&a<=o.end_date;r+=1){let i=t.get(a);i?i.push(o):t.set(a,[o]),a=r_(a)}}for(let o of t.values())o.sort((a,r)=>(a.time||"99:99").localeCompare(r.time||"99:99")||a.title.localeCompare(r.title));return t}function ni(e){let t=String((e.is_event?e.event_time:e.due_date.slice(11,16)||e.estimated_time)??"").trim();return/^\d{1,2}:\d{2}$/.test(t)?t:""}function ri(e,t){if(e.completed!==t.completed)return e.completed?1:-1;let o=ni(e),a=ni(t);if(!!o!=!!a)return o?-1:1;if(o&&a&&o!==a)return o<a?-1:1;let r=e.sort_no>0,i=t.sort_no>0;return r&&i?e.sort_no-t.sort_no:r!==i?r?-1:1:e.seq-t.seq}import{Box as Uu,Tooltip as a_}from"@mui/material";import{jsx as Ku,jsxs as i_}from"react/jsx-runtime";function ai({event:e,small:t=!1,onClick:o}){L();let a=e.time?`${e.time} ${e.title}`:e.title,r=e.calendar?n("calendar.googleWithCalendar",{calendar:e.calendar}):n("calendar.googleCalendar"),i=l=>{if(l.stopPropagation(),o){o(e);return}let[s,c,u]=e.start_date.split("-").map(Number);window.open(`https://calendar.google.com/calendar/r/day/${s}/${c}/${u}`,"_blank")};return Ku(a_,{title:`(${r}) ${a}`,arrow:!0,enterDelay:300,children:i_(Uu,{onClick:i,onPointerDown:l=>l.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:t?.6:.8,borderRadius:.75,bgcolor:"#f1f1ef",color:"#37352f",fontSize:15,fontWeight:500,overflow:"hidden",whiteSpace:"nowrap",flexShrink:0,minWidth:0,maxWidth:"100%",cursor:"pointer","&:hover":{bgcolor:"#ececea"}},children:[Ku(Uu,{component:"span",sx:{width:6,height:6,borderRadius:"50%",bgcolor:"#0f9d58",flexShrink:0}}),Ku(Uu,{component:"span",sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:a})]})})}import{useCallback as c_}from"react";import{Box as dr,Checkbox as m_}from"@mui/material";import{useLayoutEffect as l_,useState as Lg}from"react";var ju=new WeakMap,Gu=null;function s_(){return typeof ResizeObserver>"u"?null:(Gu||(Gu=new ResizeObserver(e=>{for(let t of e){let o=ju.get(t.target);if(!o)continue;let a=t.borderBoxSize?.[0]?.inlineSize??t.target.getBoundingClientRect().width;o(a)}})),Gu)}function Ag(){let[e,t]=Lg(null),[o,a]=Lg(0);return l_(()=>{if(!e)return;a(e.getBoundingClientRect().width);let r=s_();if(r)return ju.set(e,i=>a(l=>Math.abs(l-i)<1?l:i)),r.observe(e),()=>{r.unobserve(e),ju.delete(e)}},[e]),{ref:t,width:o}}import{jsx as Kn,jsxs as Yu}from"react/jsx-runtime";var Xu={high:"#e5484d",medium:"#2f80ed",low:"#d9a514"},ii=14,u_=150,d_=3;function Jr({task:e,statusOptions:t,onOpenDetail:o,onContextMenu:a,isPreview:r=!1,isDragging:i=!1,isMine:l=!1,avatarSrcByName:s,showManagerAvatar:c=!1,onOpenMembers:u,setNodeRef:m,dragProps:d,trailing:p,showCheckbox:f=!1,onRequestToggleCompleted:g,showTime:x=!0,wrapTitle:h=!1,titlePrefix:E}){let b=xe(),B=b.mode==="dark",[T]=Ua(e,t),z=String(e.manager_name??"").trim(),k=x?ni(e):"",_=le(),D=ja(e,_.resolveTask),F=E??_.titlePrefix?.(e)??"",R=e.is_notice||e.is_event?Oe(e.icon||(e.is_notice?wt:zt)):null,C=!e.completed&&!e.is_event&&!!e.due_date&&e.due_date.slice(0,10)<Ef(),{ref:y,width:I}=Ag(),S=I>0&&I<u_,O=S||h,w=c_(v=>{y(v),m?.(v)},[y,m]),q=c&&!l&&!S&&!!z;return Yu(dr,{ref:w,...d??{},onClick:v=>{v.stopPropagation(),o(e)},onContextMenu:a?v=>a(e,v):void 0,sx:{display:"flex",alignItems:O?"flex-start":"center",gap:.5,py:.6,px:1,flexShrink:0,borderRadius:.75,minWidth:0,maxWidth:"100%",bgcolor:T?B?Va(T.dot,b.chip.darkBgAlpha):T.bg:B?b.card.bg:b.colors.surfaceHover,color:T?B?b.chip.darkTextSource==="fg"?T.fg:T.dot:T.fg:b.colors.textPrimary,fontSize:ii,fontWeight:B||e.completed?400:500,opacity:r?.5:i?.35:e.completed?.6:1,border:r?`1px dashed ${b.colors.accent}`:"1px solid transparent",pointerEvents:r?"none":"auto",cursor:"pointer",touchAction:d?"none":"auto",overflow:"hidden","&:hover":{filter:"brightness(0.96)"},...C?{borderLeft:`3px solid ${b.colors.danger}`,pl:.75}:l?{borderLeft:"3px solid #2f80ed",pl:.75}:{}},children:[Kn(dr,{component:"span",sx:{width:6,height:6,borderRadius:"50%",flexShrink:0,...O?{mt:"6px"}:{},bgcolor:Xu[e.priority]??b.colors.accentOnSurface}}),f&&!S&&g?Kn(m_,{size:"small",checked:e.completed,onPointerDown:v=>v.stopPropagation(),onClick:v=>v.stopPropagation(),onChange:(v,M)=>g({anchorEl:v.currentTarget,taskSeq:e.seq,nextCompleted:M}),sx:{p:0,flexShrink:0}}):null,R&&!S?Kn(R,{sx:{fontSize:15,flexShrink:0,opacity:.75,...O?{mt:"2px"}:{}}}):null,Yu(dr,{sx:{minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column",color:B?b.colors.textStrong:b.colors.textPrimary},children:[S&&k?Kn(dr,{component:"span",sx:{lineHeight:1.35,fontSize:ii-1,color:e.completed?b.colors.textPrimary:b.colors.danger},children:k}):null,Yu(dr,{component:"span",sx:{minWidth:0,overflow:"hidden",...O?{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:d_,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.35}:{textOverflow:"ellipsis",whiteSpace:"nowrap"}},children:[!S&&k?Kn(dr,{component:"span",sx:{mr:.5,fontSize:ii-1,color:e.completed?b.colors.textPrimary:b.colors.danger},children:k}):null,F?Kn(dr,{component:"span",sx:{mr:.5,color:b.colors.textSecondary,fontWeight:500},children:F}):null,e.title,!S&&D?Kn(dr,{component:"span",sx:{ml:.5,fontSize:ii-2,color:b.colors.textMuted,fontVariantNumeric:"tabular-nums"},children:D}):null,!S&&(e.comment_count??e.comments?.length??0)>0?Kn(Yr,{sx:{fontSize:15,ml:.5,verticalAlign:"-2px",color:b.colors.textMuted}}):null]})]}),p??null,!p&&q?Kn(dr,{component:"span",onClick:u?v=>{v.stopPropagation(),u(e)}:void 0,sx:{display:"inline-flex",flexShrink:0,ml:"auto",pl:.5},children:Kn(po,{src:s?.get(z)??"",name:z,avatarSx:{width:22,height:22,fontSize:11},iconFontSize:14})}):null]})}import{jsx as Fe,jsxs as fr}from"react/jsx-runtime";var Fg=36,nc="day-";function Qu(e){let t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-t.getDay()),t}function oc(e,t){let o=new Date(e);return o.setDate(o.getDate()+t),o}function M_(e){let t=e[0],o=e[e.length-1];return t.getMonth()===o.getMonth()?sr(t,{year:"numeric",month:"long"}):fa()!=="ko"?new Intl.DateTimeFormat(Sm(),{year:"numeric",month:"long"}).formatRange(t,o):t.getFullYear()===o.getFullYear()?`${t.getFullYear()}\uB144 ${t.getMonth()+1}\uC6D4 - ${o.getMonth()+1}\uC6D4`:`${t.getFullYear()}\uB144 ${t.getMonth()+1}\uC6D4 - ${o.getFullYear()}\uB144 ${o.getMonth()+1}\uC6D4`}function O_(e){return e.getDate()===1?sr(e,{month:"short",day:"numeric"}):String(e.getDate())}function L_({task:e,statusOptions:t,isMine:o,avatarSrcByName:a,onCardClick:r,onCardContextMenu:i,onRequestArchiveToggle:l,dragDisabled:s=!1}){let{attributes:c,listeners:u,setNodeRef:m,transform:d,transition:p,isDragging:f}=D_({id:String(e.seq),disabled:s});return Fe(Jr,{task:e,statusOptions:t,isMine:o,avatarSrcByName:a,showManagerAvatar:!0,wrapTitle:!0,onOpenDetail:g=>r?.(g),onContextMenu:i,showCheckbox:!0,onRequestToggleCompleted:l,isDragging:f,setNodeRef:m,dragProps:s?void 0:{...c,...u,style:{transform:R_.Translate.toString(d),transition:p}}})}function A_({dayKey:e,isToday:t,dayLabel:o,holidayName:a,tasks:r,googleEvents:i,onGoogleEventClick:l,statusOptions:s,onRequestArchiveToggle:c,onRequestReply:u,onAddSchedule:m,canAdd:d,onCardClick:p,onCardContextMenu:f,summary:g,myAccountSeq:x,avatarSrcByName:h,dragDisabled:E=!1}){L();let b=xe(),{setNodeRef:B}=v_({id:`${nc}${e}`,disabled:E});return fr(Kt,{ref:B,sx:{minWidth:0,minHeight:0,height:"100%",display:"flex",flexDirection:"column",bgcolor:t?b.calendar.todayBg:b.calendar.cellBg},children:[fr(Kt,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:.5,px:1,height:Fg,bgcolor:t?b.calendar.todayBg:b.calendar.dateBandBg,borderBottom:`1px solid ${b.calendar.borderColor}`,flexShrink:0},children:[a?Fe(Kt,{component:"span",sx:{mr:"auto",fontSize:11.5,fontWeight:600,color:b.colors.danger,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}):null,t?Fe(Kt,{component:"span",sx:{mr:.75,px:.6,py:.1,borderRadius:.5,fontSize:11,fontWeight:600,bgcolor:b.colors.danger,color:b.calendar.cellBg,lineHeight:1.6},children:n("common.today")}):null,Fe(Kt,{component:"span",sx:{fontSize:13.5,fontWeight:t?700:400,color:a?b.colors.danger:b.mode==="dark"?b.colors.textStrong:b.colors.textPrimary,flexShrink:0},children:o})]}),g?Fe(Kt,{sx:{px:1,py:1,borderBottom:`1px solid ${b.calendar.borderColor}`,flexShrink:0},children:g}):null,Fe(Kt,{sx:{flex:1,minHeight:0,bgcolor:t?b.calendar.todayBg:b.colors.surfaceSubtle},children:Fe(P_,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:fr(Kt,{sx:{display:"flex",flexDirection:"column",flexGrow:1},children:[i.length>0?Fe(Kt,{sx:{display:"flex",flexDirection:"column",gap:.5,px:1,pt:.75,pb:.25},children:i.map(T=>Fe(ai,{event:T,onClick:l},T.uid))}):null,Fe(I_,{items:r.map(T=>String(T.seq)),strategy:E_,children:Fe(Kt,{sx:{display:"flex",flexDirection:"column",gap:.5,px:1,pt:r.length>0?.75:0},children:r.map(T=>Fe(L_,{task:T,statusOptions:s,isMine:x>0&&Number(T.manager_account_seq??0)===x,avatarSrcByName:h,onCardClick:p,onCardContextMenu:f,onRequestArchiveToggle:c,dragDisabled:E},T.seq))})}),Fe(Kt,{sx:{flexGrow:1,minHeight:56,display:"flex",flexDirection:"column",pb:1,...d?{"&:hover .taskbox-add-schedule":{opacity:1,pointerEvents:"auto"}}:{}},children:fr(Ng,{className:"taskbox-add-schedule",onClick:()=>m(e),sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,px:1.25,py:1.75,borderBottom:`1px dashed ${b.calendar.borderColor}`,bgcolor:b.calendar.cellBg,color:b.colors.accentOnSurface,fontSize:13,fontWeight:500,opacity:0,pointerEvents:"none",transition:"opacity 0.15s","&:hover":{bgcolor:b.calendar.hoverBg}},children:[Fe(f_,{sx:{fontSize:16}}),n("task.addTask")]})})]})})})]})}function Hg({tasks:e,googleEvents:t=[],onGoogleEventClick:o,statusOptions:a,fallbackToStartDate:r=!1,myAccountSeq:i=0,avatarSrcByName:l,todayStr:s,onToggleCompleted:c,onMoveTask:u,onRequestReply:m,onAddSchedule:d,canAdd:p=!0,disableDrag:f=!1,onOpenDetail:g,onTaskContextMenu:x,hideCompleted:h=!1,renderColumnSummary:E}){L();let b=xe(),[B,T]=dl(()=>Qu(new Date)),[z,k]=dl(null),{onReturnTask:_}=le(),D=z?e.find(W=>W.seq===z.taskSeq):void 0,[F,R]=dl(null),[C,y]=dl(null),[I,S]=dl(null),O=qg(!1),w=ul(()=>Array.from({length:7},(W,X)=>oc(B,X)),[B]),q=ul(()=>new Map(e.map(W=>[W.seq,W])),[e]),v=ul(()=>[...new Set(w.map(W=>W.getFullYear()))],[w]),M=Fn(v),j=__(B_(y_,{activationConstraint:{distance:5}})),V=pr(W=>{let X=C_(W),ie=X.length>0?X:S_(W),de=ie.filter(we=>!String(we.id).startsWith(nc));return de.length>0?de:ie},[]),Z=ul(()=>oi(t),[t]),ae=ul(()=>{let W=new Map;for(let X of e){let ie=X.due_date.slice(0,10)||(r?X.start_date.slice(0,10)||String(X.created_time??"").slice(0,10):"");if(!ie)continue;let de=W.get(ie);de?de.push(X):W.set(ie,[X])}for(let X of W.values())X.sort(ri);return W},[e,r]),me=pr(W=>C?(C.get(W)??[]).map(X=>q.get(X)).filter(X=>!!X):ae.get(W)??[],[C,q,ae]),U=pr(W=>{let X=me(W);return h?X.filter(ie=>!ie.completed):X},[me,h]),ee=pr(W=>{S(Number(W.active.id)),y(new Map(w.map(X=>{let ie=Dt(X);return[ie,(ae.get(ie)??[]).map(de=>de.seq)]})))},[w,ae]),$=pr((W,X)=>{if(W.startsWith(nc))return{day:W.slice(nc.length),overSeq:null};let ie=Number(W);for(let[de,we]of X)if(we.includes(ie))return{day:de,overSeq:ie};return null},[]),G=pr(W=>{let{active:X,over:ie}=W;ie&&y(de=>{if(!de)return de;let we=Number(X.id),Se=$(String(ie.id),de);if(!Se)return de;let _t=[...de.entries()].find(([,Ge])=>Ge.includes(we))?.[0];if(!_t||_t===Se.day)return de;let He=new Map(de);He.set(_t,(He.get(_t)??[]).filter(Ge=>Ge!==we));let De=[...He.get(Se.day)??[]],mt=De.length;if(Se.overSeq!==null){let Ge=De.indexOf(Se.overSeq);Ge!==-1&&(mt=Ge)}return De.splice(mt,0,we),He.set(Se.day,De),He})},[$]),re=pr(W=>{let{active:X,over:ie}=W,de=C;if(y(null),S(null),O.current=!0,!de||!ie)return;let we=Number(X.id),Se=[...de.entries()].find(([,Ge])=>Ge.includes(we));if(!Se)return;let[_t,He]=Se,De=[...He],mt=$(String(ie.id),de);if(mt&&mt.day===_t&&mt.overSeq!==null&&mt.overSeq!==we){let Ge=De.indexOf(we),so=De.indexOf(mt.overSeq);Ge!==-1&&so!==-1&&(De=w_(De,Ge,so))}u(we,_t,De)},[C,u,$]),Ee=pr(()=>{y(null),S(null),O.current=!0},[]),ct=pr(W=>{if(O.current){O.current=!1;return}g(W)},[g]),se=I!==null?q.get(I)??null:null,Q=qg(null);return fr(Kt,{onTouchStart:W=>{let X=W.touches[0];Q.current=X?{x:X.clientX,y:X.clientY}:null},onTouchEnd:W=>{let X=Q.current;Q.current=null;let ie=W.changedTouches[0];if(!X||!ie||I!==null)return;let de=ie.clientX-X.x,we=ie.clientY-X.y;Math.abs(de)<60||Math.abs(de)<=Math.abs(we)||T(oc(B,de<0?7:-7))},sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0,border:`1px solid ${b.calendar.borderColor}`,borderRadius:"0 0 4px 4px",overflow:"hidden"},children:[fr(Kt,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:b.calendar.navPaddingY??1,bgcolor:b.calendar.bg,borderBottom:`1px solid ${b.calendar.borderColor}`,flexShrink:0},children:[fr(Kt,{sx:{display:"flex",alignItems:"center",gap:.25},children:[Fe(zg,{size:"small","aria-label":n("calendar.prevWeek"),onClick:()=>T(oc(B,-7)),children:Fe(g_,{sx:{fontSize:24,color:b.colors.textSecondary}})}),Fe(p_,{size:"small",color:"inherit",onClick:()=>T(Qu(new Date)),sx:{minWidth:0,px:1,mx:1,fontSize:15.5,fontWeight:b.mode==="dark"?400:500,color:b.mode==="dark"?b.colors.textStrong:b.colors.textPrimary},children:n("common.today")}),Fe(zg,{size:"small","aria-label":n("calendar.nextWeek"),onClick:()=>T(oc(B,7)),children:Fe(x_,{sx:{fontSize:24,color:b.colors.textSecondary}})})]}),fr(Ng,{onClick:W=>R(W.currentTarget),sx:{ml:{xs:"auto",lg:0},display:"inline-flex",alignItems:"center",gap:.25,px:.75,py:.25,borderRadius:1,fontSize:15,fontWeight:b.mode==="dark"?400:700,color:b.mode==="dark"?b.colors.textStrong:b.colors.textPrimary,"&:hover":{bgcolor:b.colors.surfaceHover}},children:[M_(w),Fe(b_,{sx:{fontSize:18,color:b.colors.textMuted}})]})]}),Fe(Kt,{sx:{display:"grid",gridTemplateColumns:"repeat(7, minmax(0, 1fr))",bgcolor:b.calendar.headerBg,borderBottom:`1px solid ${b.calendar.borderColor}`,flexShrink:0,"& > *":{borderRight:`1px solid ${b.calendar.borderColor}`},"& > *:last-child":{borderRight:"none"}},children:w.map(W=>{let X=W.getDay(),ie=M.has(Dt(W));return Fe(Kt,{sx:{height:Fg,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12.5,color:X===0||ie?b.colors.danger:X===6?b.colors.accentOnSurface:b.colors.textSecondary},children:Fr(X)},Dt(W))})}),Fe(Kt,{sx:{flex:1,minHeight:0},children:fr(k_,{sensors:j,collisionDetection:V,onDragStart:ee,onDragOver:G,onDragEnd:re,onDragCancel:Ee,children:[Fe(Kt,{sx:{display:"grid",gridTemplateColumns:"repeat(7, minmax(0, 1fr))",height:"100%",minHeight:0,"& > *":{borderRight:`1px solid ${b.calendar.borderColor}`},"& > *:last-child":{borderRight:"none"}},children:w.map(W=>{let X=Dt(W);return Fe(A_,{dayKey:X,isToday:X===s,dayLabel:O_(W),holidayName:M.get(X)??"",summary:E?.(X,me(X)),tasks:U(X),googleEvents:Z.get(X)??[],onGoogleEventClick:o,statusOptions:a,onRequestArchiveToggle:k,onRequestReply:m,onAddSchedule:d,canAdd:p,onCardClick:ct,onCardContextMenu:x,myAccountSeq:i,avatarSrcByName:l,dragDisabled:f},X)})}),Fe(T_,{children:se?Fe(Kt,{sx:{boxShadow:"0 8px 20px rgba(0,0,0,0.18)",borderRadius:.75,cursor:"grabbing"},children:Fe(Jr,{task:se,statusOptions:a,onOpenDetail:()=>{},isMine:i>0&&Number(se.manager_account_seq??0)===i})}):null})]})}),Fe(h_,{anchorEl:F,open:!!F,onClose:()=>R(null),selectedDate:B,onDateChange:W=>{T(Qu(W)),R(null)}}),Fe(Oo,{open:!!z,anchorEl:z?.anchorEl??null,nextCompleted:z?.nextCompleted??!1,returnMode:!!_&&!!(D&&oo(D,i)),onCancel:()=>k(null),onConfirm:W=>{z&&(W&&_&&D?_(D,W):c(z.taskSeq,z.nextCompleted)),k(null)}})]})}import{useCallback as pl,useEffect as q_,useMemo as ya,useRef as Wg,useState as li}from"react";import{Box as vo,Button as z_,ButtonBase as Vg,IconButton as $g,Tooltip as N_}from"@mui/material";import F_ from"@mui/icons-material/Add";import H_ from"@mui/icons-material/ChevronLeft";import W_ from"@mui/icons-material/ChevronRight";import $_ from"@mui/icons-material/KeyboardArrowDown";import{DatePicker as V_}from"@ehfuse/mui-datetime-picker";import{DndContext as U_,DragOverlay as K_,PointerSensor as G_,pointerWithin as j_,rectIntersection as Y_,useDraggable as X_,useDroppable as Ug,useSensor as Q_,useSensors as J_}from"@dnd-kit/core";import Z_ from"@ehfuse/overlay-scrollbar";import{ConfirmActionPopper as e1}from"@ehfuse/mui-confirm-action";import{jsx as it,jsxs as gr}from"react/jsx-runtime";var rc="mday-",ac="mchip-",Kg=36;function t1(e){let t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-t.getDay()),t}function ic(e){let t=new Date(e);return t.setHours(0,0,0,0),t.setDate(1),t}function o1(e,t){let o=new Date(e);return o.setDate(o.getDate()+t),o}function Ju(e,t){let o=ic(e);return o.setMonth(o.getMonth()+t),o}function n1({task:e,statusOptions:t,isPreview:o=!1,isMine:a=!1,avatarSrcByName:r,onOpenDetail:i,onContextMenu:l,onRequestToggleCompleted:s,dragDisabled:c=!1}){let{attributes:u,listeners:m,setNodeRef:d,isDragging:p}=X_({id:String(e.seq),disabled:o||c}),{setNodeRef:f}=Ug({id:`${ac}${e.seq}`,disabled:o||c});return it(N_,{title:e.title,arrow:!0,enterDelay:400,children:it(Jr,{task:e,statusOptions:t,onOpenDetail:i,onContextMenu:l,showCheckbox:!!s,onRequestToggleCompleted:s,isPreview:o,isDragging:p,isMine:a,avatarSrcByName:r,showManagerAvatar:!0,wrapTitle:!0,setNodeRef:g=>{d(g),f(g)},dragProps:c?void 0:{...u,...m}})})}function r1({dayKey:e,dayNumber:t,isToday:o,isOtherMonth:a,weekday:r,holidayName:i,tasks:l,googleEvents:s,onGoogleEventClick:c,statusOptions:u,previewSeq:m,myAccountSeq:d,avatarSrcByName:p,onRequestToggleCompleted:f,onOpenDetail:g,onTaskContextMenu:x,onAddSchedule:h,canAdd:E,dragDisabled:b=!1,hideDateDivider:B=!1}){L();let T=xe(),z=T.mode==="dark",{setNodeRef:k,isOver:_}=Ug({id:`${rc}${e}`,disabled:b}),D=l,F=!!i||r===0;return gr(vo,{ref:k,sx:{minWidth:0,minHeight:0,display:"flex",flexDirection:"column",gap:.5,p:.5,bgcolor:_?T.colors.accentSoft:o?T.calendar.todayBg:a?T.calendar.otherMonthBg:T.calendar.cellBg,transition:"background-color 0.15s",overflow:"hidden",...E?{"&:hover .taskbox-month-add":{opacity:1,pointerEvents:"auto"}}:{}},children:[gr(vo,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:.5,height:Kg,flexShrink:0,mx:-.5,mt:-.5,px:1,bgcolor:o?T.calendar.todayBg:T.calendar.dateBandBg,borderBottom:B?"none":`1px solid ${T.calendar.borderColor}`},children:[i?it(vo,{component:"span",sx:{mr:.25,minWidth:0,fontSize:11,fontWeight:600,color:T.colors.danger,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}):null,o?it(vo,{component:"span",sx:{px:.5,borderRadius:.5,fontSize:10.5,fontWeight:600,bgcolor:T.colors.danger,color:T.calendar.cellBg,lineHeight:1.6},children:n("common.today")}):null,it(vo,{component:"span",sx:{fontSize:13.5,fontWeight:o?700:400,color:a?T.colors.textMuted:F?T.colors.danger:r===6?T.colors.accentOnSurface:z?T.colors.textStrong:T.colors.textPrimary,flexShrink:0},children:t})]}),s.map(R=>it(ai,{event:R,small:!0,onClick:c},R.uid)),D.map(R=>it(n1,{task:R,statusOptions:u,isPreview:R.seq===m,isMine:d>0&&Number(R.manager_account_seq??0)===d,avatarSrcByName:p,onRequestToggleCompleted:f,onOpenDetail:g,onContextMenu:x,dragDisabled:b},R.seq)),it(vo,{sx:{flexGrow:1,minHeight:0,display:"flex",alignItems:"flex-start"},children:gr(Vg,{className:"taskbox-month-add",onClick:()=>h(e),sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,px:1.25,py:.75,borderBottom:`1px dashed ${T.calendar.borderColor}`,bgcolor:T.calendar.cellBg,color:T.colors.accentOnSurface,fontSize:13,fontWeight:500,opacity:0,pointerEvents:"none",transition:"opacity 0.15s","&:hover":{bgcolor:T.calendar.hoverBg}},children:[it(F_,{sx:{fontSize:16}}),n("task.addTask")]})})]})}function Gg({tasks:e,googleEvents:t=[],onGoogleEventClick:o,statusOptions:a,fallbackToStartDate:r=!1,myAccountSeq:i=0,avatarSrcByName:l,onToggleCompleted:s,todayStr:c,onMoveTask:u,onAddSchedule:m,canAdd:d=!0,disableDrag:p=!1,onOpenDetail:f,onTaskContextMenu:g,hideDateDivider:x=!1}){L();let h=xe(),E=h.mode==="dark",[b,B]=li(()=>ic(new Date)),[T,z]=li(null),[k,_]=li(null),[D,F]=li(null),[R,C]=li(null),y=ya(()=>{let Q=t1(b);return Array.from({length:42},(W,X)=>o1(Q,X))},[b]),I=ya(()=>new Map(e.map(Q=>[Q.seq,Q])),[e]),S=ya(()=>oi(t),[t]),O=ya(()=>[...new Set(y.map(Q=>Q.getFullYear()))],[y]),w=Fn(O),q=ya(()=>{let Q=new Map;for(let W of e){let X=W.due_date.slice(0,10)||(r?W.start_date.slice(0,10)||String(W.created_time??"").slice(0,10):"");if(!X)continue;let ie=Q.get(X);ie?ie.push(W):Q.set(X,[W])}for(let W of Q.values())W.sort(ri);return Q},[e,r]),v=J_(Q_(G_,{activationConstraint:{distance:5}})),M=Wg(null),[j,V]=li(0);q_(()=>{let Q=M.current;if(!Q||typeof ResizeObserver>"u")return;let W=new ResizeObserver(()=>V(Math.floor(Q.clientHeight)));return W.observe(Q),V(Math.floor(Q.clientHeight)),()=>W.disconnect()},[]);let Z=pl(Q=>{let W=j_(Q),X=W.length>0?W:Y_(Q),ie=X.filter(de=>String(de.id).startsWith(ac));return ie.length>0?ie:X.filter(de=>String(de.id).startsWith(rc))},[]),ae=pl(Q=>{F(Number(Q.active.id))},[]),me=pl(Q=>{C(Q.over?String(Q.over.id):null)},[]),U=ya(()=>{let Q=new Map;for(let[W,X]of q)for(let ie of X)Q.set(ie.seq,W);return Q},[q]),ee=D!==null?I.get(D)?.due_date.slice(0,10)??"":"",$=ya(()=>{if(D===null||!R)return null;if(R.startsWith(ac)){let Q=Number(R.slice(ac.length)),W=U.get(Q);if(!W)return null;let X=(q.get(W)??[]).filter(de=>de.seq!==D),ie=X.findIndex(de=>de.seq===Q);return{day:W,index:ie===-1?X.length:ie}}if(R.startsWith(rc)){let Q=R.slice(rc.length),W=(q.get(Q)??[]).filter(X=>X.seq!==D);return{day:Q,index:W.length}}return null},[D,U,R,q]),G=pl(Q=>{let W=q.get(Q)??[];if(D===null||!$)return W;let X=I.get(D);if(!X)return W;let ie=W.filter(de=>de.seq!==D);return Q===$.day?[...ie.slice(0,$.index),X,...ie.slice($.index)]:Q===ee?ie:W},[D,ee,$,I,q]),re=pl(Q=>{let W=D,X=$;if(F(null),C(null),W===null||!X)return;let ie=(q.get(X.day)??[]).filter(we=>we.seq!==W),de=[...ie.slice(0,X.index).map(we=>we.seq),W,...ie.slice(X.index).map(we=>we.seq)];u(W,X.day,de)},[D,$,u,q]),Ee=D!==null?I.get(D)??null:null,ct=sr(b,{year:"numeric",month:"long"}),se=Wg(null);return gr(vo,{onTouchStart:Q=>{let W=Q.touches[0];se.current=W?{x:W.clientX,y:W.clientY}:null},onTouchEnd:Q=>{let W=se.current;se.current=null;let X=Q.changedTouches[0];if(!W||!X||D!==null)return;let ie=X.clientX-W.x,de=X.clientY-W.y;Math.abs(ie)<60||Math.abs(ie)<=Math.abs(de)||B(Ju(b,ie<0?1:-1))},sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0,border:`1px solid ${h.calendar.borderColor}`,borderRadius:"0 0 4px 4px",overflow:"hidden"},children:[gr(vo,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:h.calendar.navPaddingY??1,bgcolor:h.calendar.bg,borderBottom:`1px solid ${h.calendar.borderColor}`,flexShrink:0},children:[gr(vo,{sx:{display:"flex",alignItems:"center",gap:.25},children:[it($g,{size:"small","aria-label":n("calendar.prevMonth"),onClick:()=>B(Ju(b,-1)),children:it(H_,{sx:{fontSize:24,color:h.colors.textSecondary}})}),it(z_,{size:"small",color:"inherit",onClick:()=>B(ic(new Date)),sx:{minWidth:0,px:1,mx:1,fontSize:15.5,fontWeight:h.mode==="dark"?400:500,color:h.mode==="dark"?h.colors.textStrong:h.colors.textPrimary},children:n("common.today")}),it($g,{size:"small","aria-label":n("calendar.nextMonth"),onClick:()=>B(Ju(b,1)),children:it(W_,{sx:{fontSize:24,color:h.colors.textSecondary}})})]}),gr(Vg,{onClick:Q=>z(Q.currentTarget),sx:{display:"inline-flex",alignItems:"center",gap:.25,ml:{xs:"auto",lg:0},px:.75,py:.25,borderRadius:1,fontSize:15,fontWeight:h.mode==="dark"?400:700,color:h.mode==="dark"?h.colors.textStrong:h.colors.textPrimary,"&:hover":{bgcolor:h.colors.surfaceHover}},children:[ct,it($_,{sx:{fontSize:18,color:h.colors.textMuted}})]})]}),it(vo,{sx:{display:"grid",gridTemplateColumns:"repeat(7, minmax(0, 1fr))",bgcolor:h.calendar.headerBg,borderBottom:`1px solid ${h.calendar.borderColor}`,flexShrink:0,"& > *":{borderRight:`1px solid ${h.calendar.borderColor}`},"& > *:last-child":{borderRight:"none"}},children:Vp().map((Q,W)=>it(vo,{sx:{height:Kg,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12.5,color:W===0?h.colors.danger:W===6?h.colors.accentOnSurface:h.colors.textSecondary},children:Q},Q))}),it(vo,{ref:M,sx:{flex:1,minHeight:0},children:gr(U_,{sensors:v,collisionDetection:Z,onDragStart:ae,onDragOver:me,onDragEnd:re,onDragCancel:()=>{F(null),C(null)},children:[it(Z_,{style:{height:"100%"},thumb:{width:8},children:it(vo,{sx:{display:"grid",gridTemplateColumns:"repeat(7, minmax(0, 1fr))",gridTemplateRows:"repeat(6, minmax(112px, auto))",minHeight:j>0?`${j}px`:"100%",flexShrink:0,"& > *":{borderRight:`1px solid ${h.calendar.borderColor}`,borderBottom:`1px solid ${h.calendar.borderColor}`},"& > *:nth-of-type(7n)":{borderRight:"none"},"& > *:nth-last-of-type(-n+7)":{borderBottom:"none"}},children:y.map(Q=>{let W=Dt(Q);return it(r1,{dayKey:W,dayNumber:Q.getDate(),isToday:W===c,isOtherMonth:Q.getMonth()!==b.getMonth(),weekday:Q.getDay(),holidayName:w.get(W)??"",tasks:G(W),googleEvents:S.get(W)??[],onGoogleEventClick:o,statusOptions:a,previewSeq:$?.day===W?D:null,myAccountSeq:i,avatarSrcByName:l,onRequestToggleCompleted:s?_:void 0,onOpenDetail:f,onTaskContextMenu:g,onAddSchedule:m,canAdd:d,dragDisabled:p,hideDateDivider:x},W)})})}),it(K_,{children:Ee?gr(vo,{sx:{display:"flex",alignItems:"center",gap:.5,py:.6,px:.75,borderRadius:.75,bgcolor:h.calendar.cellBg,border:`1px solid ${h.calendar.borderColor}`,boxShadow:"0 6px 16px rgba(0,0,0,0.18)",fontSize:ii,fontWeight:500,color:h.colors.textPrimary,cursor:"grabbing",whiteSpace:"nowrap"},children:[it(vo,{component:"span",sx:{width:6,height:6,borderRadius:"50%",bgcolor:Xu[Ee.priority]}}),Ee.title]}):null})]})}),it(e1,{open:!!k,anchorEl:k?.anchorEl??null,title:k?.nextCompleted?n("task.completeConfirm"):n("task.uncompleteConfirm"),confirmText:k?.nextCompleted?n("common.done"):n("task.unmark"),onCancel:()=>_(null),onConfirm:()=>{k&&s?.(k.taskSeq,k.nextCompleted),_(null)}}),it(V_,{anchorEl:T,open:!!T,onClose:()=>z(null),selectedDate:b,onDateChange:Q=>{B(ic(Q)),z(null)}})]})}import{useEffect as c1,useMemo as fl,useRef as ed,useState as Xg}from"react";import{Box as fo,Button as m1,IconButton as Qg,useMediaQuery as u1}from"@mui/material";import d1 from"@mui/icons-material/ChevronLeft";import p1 from"@mui/icons-material/ChevronRight";import f1 from"@mui/icons-material/KeyboardArrowDown";import{DatePicker as g1}from"@ehfuse/mui-datetime-picker";import{Box as xr,Button as a1,Dialog as i1}from"@mui/material";import{jsx as br,jsxs as Zu}from"react/jsx-runtime";function jg({controller:e,avatarSrcByName:t}){L();let o=xe(),a=e.modals.members,r=e.ui.useValue("task"),i=r?[{label:n("role.owner"),names:[String(r.manager_name??"").trim()]},{label:n("role.cc"),names:r.receiver_names??[]},{label:n("role.author"),names:[String(r.created_by??"").trim()]}]:[];return br(i1,{open:a.isOpen,onClose:a.close,maxWidth:"xs",fullWidth:!0,slotProps:{paper:{sx:{borderRadius:2,m:2}}},children:r?Zu(xr,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5,bgcolor:o.colors.surface},children:[br(xr,{sx:{fontSize:15.5,fontWeight:600,color:o.colors.textStrong,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.title}),i.map(l=>{let s=l.names.filter(c=>!!c);return Zu(xr,{sx:{display:"flex",alignItems:"flex-start",gap:1.5},children:[br(xr,{sx:{width:56,flexShrink:0,fontSize:13.5,color:o.colors.textSecondary,pt:.5},children:l.label}),br(xr,{sx:{display:"flex",flexWrap:"wrap",gap:1,minWidth:0},children:s.length===0?br(xr,{sx:{fontSize:14,color:o.colors.textMuted,pt:.5},children:n("menu.empty")}):s.map(c=>Zu(xr,{sx:{display:"flex",alignItems:"center",gap:.75},children:[br(po,{src:t?.get(c)??"",name:c,avatarSx:{width:26,height:26,fontSize:12},iconFontSize:16}),br(xr,{sx:{fontSize:14.5,color:o.colors.textPrimary},children:c})]},`${l.label}-${c}`))})]},l.label)}),br(xr,{sx:{display:"flex",justifyContent:"flex-end",pt:.5},children:br(a1,{size:"small",color:"inherit",onClick:a.close,children:n("common.close")})})]}):null})}import{useFormaState as l1,useModal as s1}from"@ehfuse/forma";function Yg(){let e={members:s1({modalId:_e("taskbox-task-members")})},t=l1({task:null});return{modals:e,ui:t,openDialog:a=>{t.setValue("task",a),e.members.open()}}}import{jsx as Qt,jsxs as Gn}from"react/jsx-runtime";function Jg(e){let t=e?.parentElement??null;for(;t;){let o=window.getComputedStyle(t);if(/(auto|scroll)/.test(o.overflowY)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}var x1="(min-width:600px)";function td(e){let t=new Date(e);return t.setHours(0,0,0,0),t.setDate(1),t}function Zg(e){let t=o=>String(o).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function ex({tasks:e,googleEvents:t=[],onGoogleEventClick:o,statusOptions:a,todayStr:r,onOpenDetail:i,onAddSchedule:l,myAccountSeq:s=0,avatarSrcByName:c,fallbackToStartDate:u=!1}){L();let m=xe(),d=u1(x1),[p,f]=Xg(()=>td(new Date)),[g,x]=Xg(!1),h=fl(()=>{let y=new Date(p.getFullYear(),p.getMonth()+1,0).getDate();return Array.from({length:y},(I,S)=>{let O=new Date(p.getFullYear(),p.getMonth(),S+1);return{ymd:Zg(O),dayNumber:S+1,weekday:O.getDay()}})},[p]),E=fl(()=>{let y=new Map;for(let I of e){let S=I.due_date.slice(0,10)||(u?I.start_date.slice(0,10)||String(I.created_time??"").slice(0,10):"");if(!S)continue;let O=y.get(S);O?O.push(I):y.set(S,[I])}for(let I of y.values())I.sort(ri);return y},[e,u]),b=fl(()=>u?e.filter(y=>!y.due_date.slice(0,10)&&!y.start_date.slice(0,10)&&!String(y.created_time??"").slice(0,10)).sort((y,I)=>y.completed!==I.completed?y.completed?1:-1:y.seq-I.seq):[],[e,u]),B=Yg(),T=fl(()=>oi(t),[t]),z=fl(()=>[p.getFullYear()],[p]),k=Fn(z),_=ed(null),D=r.slice(0,7)===Zg(p).slice(0,7);c1(()=>{if(!D)return;let y=()=>{let O=_.current,w=Jg(O);if(!w||!O)return;let q=O.getBoundingClientRect().top-w.getBoundingClientRect().top+w.scrollTop;w.scrollTop=Math.max(0,q-w.clientHeight/2+O.clientHeight/2)},I=setTimeout(y,100),S=setTimeout(y,400);return()=>{clearTimeout(I),clearTimeout(S)}},[D,p]);let F=ed(null),R=ed(null),C=y=>{f(S=>new Date(S.getFullYear(),S.getMonth()+y,1));let I=Jg(F.current);I&&I.scrollTo({top:0,behavior:"auto"})};return Gn(fo,{ref:F,onTouchStart:y=>{let I=y.touches[0];R.current=I?{x:I.clientX,y:I.clientY}:null},onTouchEnd:y=>{let I=R.current;R.current=null;let S=y.changedTouches[0];if(!I||!S)return;let O=S.clientX-I.x,w=S.clientY-I.y;Math.abs(O)<60||Math.abs(O)<=Math.abs(w)||C(O<0?1:-1)},sx:{minWidth:0,maxWidth:"100%",overflow:"hidden",bgcolor:m.colors.surface},children:[Gn(fo,{sx:{display:"flex",alignItems:"center",gap:.5,px:1.5,py:1,flexShrink:0},children:[Qt(Qg,{size:"small","aria-label":n("calendar.prevMonth"),onClick:()=>C(-1),children:Qt(d1,{sx:{fontSize:24,color:m.colors.textSecondary}})}),Qt(m1,{size:"small",color:"inherit",onClick:()=>f(td(new Date)),sx:{minWidth:0,px:1,fontSize:15.5,color:m.mode==="dark"?m.colors.textStrong:m.colors.textPrimary},children:n("common.today")}),Qt(Qg,{size:"small","aria-label":n("calendar.nextMonth"),onClick:()=>C(1),children:Qt(p1,{sx:{fontSize:24,color:m.colors.textSecondary}})}),Gn(fo,{onClick:()=>x(!0),sx:{ml:"auto",pr:.5,display:"flex",alignItems:"center",gap:.25,fontSize:16.5,fontWeight:m.mode==="dark"?400:700,color:m.mode==="dark"?m.colors.textStrong:m.colors.textPrimary,cursor:"pointer"},children:[sr(p,{year:"numeric",month:"long"}),Qt(f1,{sx:{fontSize:20,color:m.colors.textMuted}})]})]}),Gn(fo,{sx:{minWidth:0,overflowX:"hidden",borderTop:`1px solid ${m.calendar.borderColor}`},children:[b.length>0?Gn(fo,{sx:{display:"flex",alignItems:"center",gap:1,px:1,py:.75,minWidth:0,maxWidth:"100%",flexShrink:0,borderBottom:`1px solid ${m.calendar.borderColor}`},children:[Gn(fo,{sx:{width:52,flexShrink:0,fontSize:12.5,lineHeight:1.3,color:m.colors.textSecondary,textAlign:"center"},children:[n("calendar.noDateLine1"),Qt("br",{}),n("calendar.noDateLine2")]}),Qt(fo,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:.5},children:b.map(y=>Qt(Jr,{task:y,statusOptions:a,onOpenDetail:i,isMine:s>0&&Number(y.manager_account_seq??0)===s,avatarSrcByName:c,showManagerAvatar:!0,onOpenMembers:B.openDialog},y.seq))})]}):null,h.map(({ymd:y,dayNumber:I,weekday:S})=>{let O=k.get(y)??"",w=y===r,q=!!O||S===0,v=E.get(y)??[],M=T.get(y)??[],j=v.length>0||M.length>0;return Gn(fo,{ref:w?_:void 0,onClick:l?()=>l(y):void 0,sx:{display:"flex",alignItems:"center",gap:1,px:1,minWidth:0,maxWidth:"100%",py:j?.75:.5,minHeight:44,flexShrink:0,borderBottom:`1px solid ${m.calendar.borderColor}`,...l?{cursor:"pointer"}:{}},children:[Qt(fo,{sx:{width:52,flexShrink:0,display:"flex",flexDirection:"column",alignItems:"center",gap:.25},children:Gn(fo,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:.25,"@media (min-width:600px)":{flexDirection:"row",gap:.75}},children:[Qt(fo,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:40,height:32,borderRadius:1,px:1.25,fontSize:22,fontWeight:500,color:w?m.colors.surface:q?m.colors.danger:S===6?m.colors.accentOnSurface:m.colors.textPrimary,bgcolor:w?m.colors.accentOnSurface:"transparent"},children:I}),Qt(fo,{component:"span",sx:{fontSize:13,color:q?m.colors.danger:S===6?m.colors.accentOnSurface:m.colors.textSecondary},children:Fr(S)})]})}),Gn(fo,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:.5},children:[M.map(V=>Qt(ai,{event:V,onClick:o},V.uid)),v.map(V=>{let Z=ni(V),ae=Qt(Jr,{task:V,statusOptions:a,onOpenDetail:i,isMine:s>0&&Number(V.manager_account_seq??0)===s,avatarSrcByName:c,showManagerAvatar:!0,onOpenMembers:B.openDialog,showTime:!d,wrapTitle:!0},V.seq);return d?Gn(fo,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[Qt(fo,{component:"span",sx:{width:44,flexShrink:0,textAlign:"right",fontSize:13.5,fontWeight:400,opacity:1,color:Z?V.completed?m.colors.textPrimary:m.colors.danger:"transparent"},children:Z||"00:00"}),Qt(fo,{sx:{flex:1,minWidth:0},children:ae})]},V.seq):ae})]})]},y)})]}),Qt(jg,{controller:B,avatarSrcByName:c}),Qt(g1,{open:g,centered:!0,monthOnly:!0,onClose:()=>x(!1),selectedDate:p,onDateChange:y=>{f(td(y)),x(!1)}})]})}import{useCallback as tx,useEffect as ox,useMemo as od,useRef as sc,useState as gl}from"react";import{Box as Ot,Tooltip as ax}from"@mui/material";import b1 from"@ehfuse/overlay-scrollbar";import h1 from"@mui/icons-material/CheckCircle";import k1 from"@mui/icons-material/RadioButtonUnchecked";import{DndContext as T1,PointerSensor as y1,closestCenter as C1,useSensor as S1,useSensors as v1}from"@dnd-kit/core";import{SortableContext as B1,arrayMove as _1,useSortable as I1,verticalListSortingStrategy as w1}from"@dnd-kit/sortable";import{ConfirmActionPopper as D1}from"@ehfuse/mui-confirm-action";import E1 from"@mui/icons-material/DragIndicator";import{jsx as kt,jsxs as hr}from"react/jsx-runtime";var nd=36,R1=48,nx=40,P1=24,M1=4,O1=14,rx=36,L1=12.5,si=220,A1={high:{bg:"#f6c6c9",border:"#e5484d"},medium:{bg:"#c5d8f6",border:"#2f80ed"},low:{bg:"#f3e3b6",border:"#d9a514"}};function Ca(e){let t=String(e??"").trim();if(!t)return null;let o=new Date(`${t}T00:00:00`);return Number.isNaN(o.getTime())?null:o}function lc(e,t){let o=new Date(e);return o.setDate(o.getDate()+t),o}function rd(e,t){return Math.round((t.getTime()-e.getTime())/864e5)}function q1({task:e,dragHandle:t,onPointerDown:o,onClick:a}){let r=xe(),i=sc(null),[l,s]=gl("");return kt(ax,{title:l,arrow:!0,enterDelay:300,children:hr(Ot,{onPointerDown:o,onClick:c=>a(e,c),onMouseEnter:()=>{let c=i.current;s(c&&c.scrollWidth>c.clientWidth?e.title:"")},sx:{width:si,flexShrink:0,position:"sticky",left:0,zIndex:2,bgcolor:r.timeline.bg,borderRight:`1px solid ${r.timeline.gridColor}`,display:"flex",alignItems:"center",gap:.5,pl:.5,pr:1.5,fontSize:15,fontWeight:r.mode==="dark"||e.completed?400:500,color:e.completed?r.colors.textMuted:r.mode==="dark"?r.colors.textStrong:r.colors.textPrimary,overflow:"hidden",whiteSpace:"nowrap",cursor:"pointer","&:hover":{bgcolor:r.colors.surfaceHover}},children:[t,kt(Ot,{ref:i,component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title})]})})}function z1({id:e,showIndicator:t,children:o}){let a=xe(),{attributes:r,listeners:i,setNodeRef:l}=I1({id:e});return hr(Ot,{ref:l,sx:{position:"relative"},children:[t?kt(Ot,{sx:{position:"absolute",top:-1,left:0,right:0,height:2,bgcolor:a.colors.accentOnSurface,zIndex:5}}):null,o({...r,...i})]})}function ix({tasks:e,hideCompletedChecklist:t=!1,todayStr:o,onOpenDetail:a,onToggleChecklist:r,onReorderTasks:i,onTaskContextMenu:l}){L();let s=xe(),[c,u]=gl(null),m=od(()=>[...e].sort((w,q)=>{let v=(w.timeline_sort_no??0)>0,M=(q.timeline_sort_no??0)>0;if(v&&M)return(w.timeline_sort_no??0)-(q.timeline_sort_no??0);if(v!==M)return v?-1:1;let j=w.due_date||w.start_date,V=q.due_date||q.start_date;return j!==V?j<V?-1:1:w.seq-q.seq}),[e]),[d,p]=gl(null),[f,g]=gl(null),x=v1(S1(y1,{activationConstraint:{distance:4}})),h=tx(w=>{p(w.over?Number(w.over.id):null)},[]),E=tx(w=>{p(null),g(null);let{active:q,over:v}=w;if(!v||q.id===v.id)return;let M=m.map(Z=>Z.seq),j=M.indexOf(Number(q.id)),V=M.indexOf(Number(v.id));j===-1||V===-1||i(_1(M,j,V))},[m,i]),b=od(()=>{let w=Ca(o)??new Date,q=w,v=lc(w,21);for(let V of m){let Z=Ca(V.start_date)??Ca(V.due_date),ae=Ca(V.due_date)??Z;Z&&Z<q&&(q=Z),ae&&ae>v&&(v=ae)}let M=lc(q,-3),j=rd(M,lc(v,3))+1;return Array.from({length:j},(V,Z)=>lc(M,Z))},[m,o]),B=b[0],T=b.findIndex(w=>Dt(w)===o),{dayWidths:z,dayOffsets:k,gridWidth:_}=od(()=>{let w=b.map((M,j)=>M.getDate()===1||j===0?R1:nd),q=[],v=0;for(let M of w)q.push(v),v+=M;return{dayWidths:w,dayOffsets:q,gridWidth:v}},[b]),D=si+_,F=sc(null),R=w=>{F.current={x:w.clientX,y:w.clientY}},C=(w,q)=>{let v=F.current;F.current=null,!(v&&(Math.abs(q.clientX-v.x)>5||Math.abs(q.clientY-v.y)>5))&&a(w)},y=sc(null),[I,S]=gl(!1);ox(()=>{let w=y.current?.getScrollContainer();if(!w)return;let q=()=>S(w.scrollHeight>w.clientHeight);q();let v=new ResizeObserver(q);return v.observe(w),()=>v.disconnect()},[m.length]);let O=sc(!1);return ox(()=>{if(m.length===0||O.current)return;O.current=!0;let w=window.requestAnimationFrame(()=>{let q=y.current?.getScrollContainer();!q||T<0||(q.scrollLeft=Math.max(0,k[T]-nd*3))});return()=>window.cancelAnimationFrame(w)},[m.length]),hr(Ot,{sx:{flex:1,minHeight:0,minWidth:0,maxWidth:"100%",display:"flex",flexDirection:"column",border:`1px solid ${s.timeline.gridColor}`,borderRadius:"0 0 4px 4px",overflow:"hidden",bgcolor:s.timeline.headerBg},children:[kt(Ot,{sx:{flex:1,minHeight:0,minWidth:0,contain:"inline-size"},children:kt(b1,{ref:y,style:{height:"100%"},contentStyle:{width:"max-content",minWidth:"100%"},thumb:{width:8},showHorizontalScrollbar:!0,dragScroll:{excludeClasses:["taskbox-timeline-handle"]},children:hr(Ot,{sx:{width:D,position:"relative",bgcolor:s.timeline.bg},children:[hr(Ot,{sx:{display:"flex",position:"sticky",top:0,zIndex:3,bgcolor:s.timeline.headerBg,borderBottom:`1px solid ${s.timeline.gridColor}`},children:[kt(Ot,{sx:{width:si,height:rx,flexShrink:0,position:"sticky",left:0,zIndex:4,bgcolor:s.timeline.headerBg,borderRight:`1px solid ${s.timeline.gridColor}`,display:"flex",alignItems:"center",px:1.5,fontSize:13,color:s.colors.textSecondary},children:n("common.title")}),b.map((w,q)=>{let v=w.getDay(),M=q===T,j=w.getDate()===1||q===0;return kt(Ot,{sx:{width:z[q],height:rx,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:L1,fontWeight:M&&s.mode!=="dark"?700:400,color:M?s.timeline.bg:v===0?s.colors.danger:v===6?s.colors.accentOnSurface:s.colors.textSecondary,bgcolor:M?s.colors.danger:"transparent",borderRight:`1px solid ${s.timeline.gridColor}`,whiteSpace:"nowrap"},children:j?`${w.getMonth()+1}/${w.getDate()}`:w.getDate()},Dt(w))})]}),kt(T1,{sensors:x,collisionDetection:C1,onDragStart:w=>g(Number(w.active.id)),onDragOver:h,onDragEnd:E,onDragCancel:()=>{p(null),g(null)},children:kt(B1,{items:m.map(w=>String(w.seq)),strategy:w1,children:hr(Ot,{sx:{position:"relative"},children:[b.map((w,q)=>{let v=w.getDay(),M=q===T;return!M&&v!==0&&v!==6?null:kt(Ot,{sx:{position:"absolute",top:0,bottom:0,left:si+k[q],width:z[q],bgcolor:M?"rgba(229,72,77,0.07)":s.colors.surfaceSubtle,zIndex:0}},`stripe-${Dt(w)}`)}),m.map((w,q)=>{let v=Ca(w.start_date)??Ca(w.due_date),M=Ca(w.due_date)??v,j=v?Math.min(b.length-1,Math.max(0,rd(B,v))):0,V=M?Math.min(b.length-1,Math.max(j,rd(B,M))):j,Z=A1[w.priority],ae=si+k[j]+2,me=k[V]+z[V]-k[j]-4,U=(w.checklist??[]).map((ee,$)=>({entry:ee,index:$})).filter(({entry:ee})=>!t||!ee.checked);return kt(z1,{id:String(w.seq),showIndicator:d===w.seq&&f!==w.seq,children:ee=>hr(Ot,{sx:{borderBottom:q===m.length-1&&I?"none":`1px solid ${s.timeline.gridColor}`,position:"relative",zIndex:1,opacity:f===w.seq?.45:1},children:[hr(Ot,{onContextMenu:$=>l(w,$),sx:{display:"flex",height:nx,position:"relative","&:hover":{bgcolor:"rgba(47,128,237,0.04)"}},children:[kt(q1,{task:w,dragHandle:kt(Ot,{component:"span",className:"taskbox-timeline-handle",...ee,onClick:$=>$.stopPropagation(),sx:{display:"inline-flex",alignItems:"center",flexShrink:0,color:s.colors.accentOnSurface,cursor:"grab",touchAction:"none","&:hover":{color:s.colors.accentOnSurface}},children:(()=>{let $=(w.is_notice||w.is_event?Oe(w.icon||(w.is_notice?wt:zt)):null)??E1;return kt($,{sx:{fontSize:17}})})()}),onPointerDown:R,onClick:C}),kt(ax,{title:`${w.title} (${w.start_date||"?"} ~ ${w.due_date||"?"})`,arrow:!0,enterDelay:300,children:kt(Ot,{onPointerDown:R,onClick:$=>C(w,$),sx:{position:"absolute",top:(nx-20)/2,left:ae,width:Math.max(nd-4,me),height:20,borderRadius:1,bgcolor:Z.bg,border:`1px solid ${Z.border}`,opacity:w.completed?.45:1,cursor:"pointer","&:hover":{filter:"brightness(0.95)"}}})})]}),U.map(({entry:$,index:G},re)=>kt(Ot,{sx:{display:"flex",height:P1,position:"relative",mt:re===0?`${M1}px`:0,mb:re===U.length-1?`${O1}px`:0},children:kt(Ot,{sx:{width:si,flexShrink:0,position:"sticky",left:0,zIndex:2,bgcolor:s.timeline.bg,borderRight:`1px solid ${s.timeline.gridColor}`,display:"flex",alignItems:"center",pl:4.25,pr:1.5,fontSize:13,color:$.checked?s.colors.textMuted:s.colors.textPrimary},children:hr(Ot,{onClick:Ee=>u({anchorEl:Ee.currentTarget,taskSeq:w.seq,index:G,checked:!$.checked}),sx:{display:"inline-flex",alignItems:"center",gap:.75,minWidth:0,cursor:"pointer"},children:[$.checked?kt(h1,{sx:{fontSize:17,color:s.colors.accentOnSurface,flexShrink:0}}):kt(k1,{sx:{fontSize:17,color:s.colors.textMuted,flexShrink:0}}),kt(Ot,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:$.checked?"line-through":"none"},children:$.label})]})})},`${w.seq}-check-${G}`))]})},w.seq)}),m.length===0?kt(Ot,{sx:{py:8,textAlign:"center",color:s.colors.textMuted,fontSize:14},children:n("table.emptyTasks")}):null]})})})]})})}),kt(D1,{open:!!c,anchorEl:c?.anchorEl??null,title:c?.checked?n("calendar.checklistCompleteConfirm"):n("task.uncompleteConfirm"),confirmText:c?.checked?n("common.done"):n("task.unmark"),onCancel:()=>u(null),onConfirm:()=>{c&&r(c.taskSeq,c.index,c.checked),u(null)}})]})}import{jsx as Sa}from"react/jsx-runtime";function v9(e){switch(e.view){case"card":case"kanban":{let{view:t,...o}=e;return Sa(Vu,{...o,columnAxis:t==="kanban"?"status":"project"})}case"sprint":{let{view:t,...o}=e;return Sa(Vu,{...o,columnAxis:"sprint"})}case"calendar":{let{view:t,...o}=e;return Sa(Hg,{...o})}case"month":{let{view:t,...o}=e;return Sa(Gg,{...o})}case"agenda":{let{view:t,...o}=e;return Sa(ex,{...o})}case"timeline":{let{view:t,...o}=e;return Sa(ix,{...o})}default:{let{view:t,...o}=e;return Sa(gg,{...o})}}}var B9=["list","card","kanban","calendar","month","timeline"];import{Box as Ko}from"@mui/material";import{Fragment as N1,jsx as jn,jsxs as va}from"react/jsx-runtime";function lx(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e)||!/^\d{4}-\d{2}-\d{2}$/.test(t))return null;let o=new Date(`${e}T00:00:00`),a=new Date(`${t}T00:00:00`);return Math.round((o.getTime()-a.getTime())/864e5)}function sx({tasks:e,todayStr:t,showProgress:o=!0,dday:a=null,workdaysLeft:r=null,showPoints:i=!0,showHours:l=!0,showOverdue:s=!0,showInfo:c=!0,inline:u=!1}){L();let m=xe(),d=e.filter(_=>!_.archived),p=d.filter(_=>_.completed).length,f=d.length>0?Math.round(p/d.length*100):0,g=d.filter(_=>!_.completed&&!_.is_event&&!!_.due_date&&_.due_date.slice(0,10)<t).length,x=d.reduce((_,D)=>D.completed?_:_+(D.story_points??0),0),h=o?jn(Ko,{sx:{flex:u?"0 0 110px":"1 1 auto",minWidth:0,height:m.summary.gaugeHeight,borderRadius:3,bgcolor:m.summary.gaugeTrackColor},children:jn(Ko,{sx:{height:"100%",borderRadius:3,width:`${f}%`,bgcolor:f>=100?m.summary.gaugeCompleteColor:m.summary.gaugeBarColor,transition:"width 0.2s"}})}):null,E=o?va(Ko,{component:"span",sx:{flexShrink:0,fontSize:u?14:13,color:m.summary.textColor},children:[f,"%"]}):null,b={color:m.summary.numberColor,fontWeight:700,fontSize:u?15:14},B=d.length-p,T=va(N1,{children:[u?null:jn("span",{children:on("board.remainingCount",{count:jn(Ko,{component:"span",sx:b,children:B})})}),s&&g>0?jn(Ko,{component:"span",sx:{color:m.summary.overdueColor,fontWeight:600},children:on("board.overdueCount",{count:jn(Ko,{component:"span",sx:{fontWeight:700,fontSize:u?15:14},children:g})})}):null,i&&x>0?va("span",{children:[jn(Ko,{component:"span",sx:b,children:x}),"SP"]}):null]}),z=typeof r=="number"&&Number.isFinite(r)?jn("span",{children:on("board.workdaysLeft",{count:jn(Ko,{component:"span",sx:b,children:r})})}):null,k=typeof a=="number"&&Number.isFinite(a)?jn(Ko,{component:"span",sx:{ml:u?0:"auto",flexShrink:0,px:.6,py:.1,borderRadius:.5,fontSize:12,fontWeight:600,bgcolor:m.summary.overdueColor,color:m.colors.textInverse,lineHeight:1.6},children:a===0?"D-day":a>0?`D-${a}`:`D+${-a}`}):null;return u?va(Ko,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0,fontSize:14.5,color:m.summary.textColor,whiteSpace:"nowrap",...m.summary.sx},children:[c?T:null,c?z:null,c?k:null,h,E]}):va(Ko,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[o?va(Ko,{sx:{display:"flex",alignItems:"center",gap:1},children:[h,E]}):null,va(Ko,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,fontSize:13.5,color:m.summary.textColor},children:[T,z,k]})]})}import{useMemo as H1}from"react";function F1(e){let t=String(e??"").trim();if(!t)return 0;let o=0,a=!1;for(let r of t.matchAll(/(\d+(?:\.\d+)?)\s*(h|시간|m|분|d|일)/gi)){let i=parseFloat(r[1]),l=r[2].toLowerCase();a=!0,l==="m"||l==="\uBD84"?o+=i/60:l==="d"||l==="\uC77C"?o+=i*8:o+=i}if(!a){let r=parseFloat(t);Number.isFinite(r)&&(o+=r)}return o}function O9(e){let t=Math.round(e*10)/10;return n("effort.hours",{value:t%1===0?t.toFixed(0):t.toFixed(1)})}function cx(e,t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(e)||!/^\d{4}-\d{2}-\d{2}$/.test(t))return 0;let a=new Date(`${e}T00:00:00`),r=new Date(`${t}T00:00:00`);if(r<a||r.getTime()-a.getTime()>3660*864e5)return 0;let i=0;for(let l=new Date(a);l<=r;l.setDate(l.getDate()+1)){let s=l.getDay();if(s===0||s===6)continue;let c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,"0")}-${String(l.getDate()).padStart(2,"0")}`;o.has(c)||(i+=1)}return i}function L9(e){return e.reduce((t,o)=>o.completed?t:t+F1(o.estimated_time),0)}import{jsx as W1}from"react/jsx-runtime";function H9({sprint:e,tasks:t,todayStr:o,...a}){let r=e.status==="closed"?null:lx(e.end_date,o),i=r!==null&&r>=0,l=H1(()=>{if(!i)return[];let u=Number(o.slice(0,4)),m=Number(e.end_date.slice(0,4))||u,d=[];for(let p=u;p<=Math.max(u,m);p+=1)d.push(p);return d},[i,o,e.end_date]),s=Fn(l),c=i?cx(o,e.end_date,new Set(s.keys())):null;return W1(sx,{tasks:t,todayStr:o,dday:r,workdaysLeft:c,...a})}import{useEffect as mI,useRef as uI,useState as dI}from"react";import{Box as sd}from"@mui/material";import{Children as $1}from"react";import{Box as id,CircularProgress as V1}from"@mui/material";import{jsx as cc}from"react/jsx-runtime";var ad={xs:2,md:3};function mx(){return cc(id,{sx:{position:"fixed",top:"calc(50% + 30px)",left:"50%",transform:"translate(-50%, -50%)",zIndex:1},children:cc(V1,{size:44,thickness:4,sx:{color:"#94a3b8"}})})}function ux({children:e,edge:t=!1}){return cc(id,{sx:t?{minWidth:0,display:"flex",flexDirection:"column",gap:"var(--mobile-edge-gap, 7px)",pb:ad,mx:"calc(-1 * var(--mobile-edge-bleed, 16px))"}:{minWidth:0,display:"flex",flexDirection:"column",gap:ad,pb:ad},children:$1.map(e,o=>o==null||o===!1?null:cc(id,{sx:{bgcolor:"background.paper",borderRadius:t?0:1,boxShadow:t?"none":1,overflow:"hidden",minWidth:0},children:o}))})}import{useLayoutEffect as j1,useRef as Y1,useState as ld}from"react";import{Box as Lo,Button as px,Checkbox as X1,Collapse as Q1,IconButton as J1,Typography as mn}from"@mui/material";import Z1 from"@mui/icons-material/ExpandMore";import eI from"@mui/icons-material/ExpandLess";import fx from"@mui/icons-material/CheckCircle";import tI from"@mui/icons-material/CheckCircleOutlineOutlined";import{Fragment as G1,jsx as dx}from"react/jsx-runtime";var U1="taskbox-search-highlight";function K1(e,t){let o=t?.keyPrefix??"hl";return e.map((a,r)=>dx("span",{className:a.highlight?t?.highlightClassName??U1:t?.className,style:a.highlight?{fontWeight:700,color:"#2563eb"}:void 0,children:a.text},`${o}-${a.text}-${r}`))}function ci({text:e,keyword:t,fallback:o="-",className:a,highlightClassName:r,keyPrefix:i}){let l=String(e??"").trim()||o,s=$s(l,t);return dx(G1,{children:K1(s,{className:a,highlightClassName:r,keyPrefix:i})})}import{Fragment as cI,jsx as be,jsxs as _n}from"react/jsx-runtime";var oI={flexShrink:0,minWidth:64,textAlign:"center",px:.75,py:.35,borderRadius:.75,bgcolor:"#f1f5f9",color:"#64748b",fontSize:dt(12.5),fontWeight:500,lineHeight:1.4},Go={fontSize:dt(14.5),color:"#374151",minWidth:0,lineHeight:1.45};function un({label:e,children:t}){return _n(Lo,{sx:{display:"flex",alignItems:"flex-start",gap:1,minWidth:0},children:[be(Lo,{sx:oI,children:e}),be(Lo,{sx:{...Go,flex:1,pt:.2},children:t})]})}var nI=10,rI=24,aI=16,iI=100,lI="#e5484d",sI="#fff5f5";function gx({task:e,statusOptions:t,projectLabel:o,searchText:a,todayStr:r,dimCompleted:i=!0,onRequestToggleCompleted:l,onOpenDetail:s,onTaskContextMenu:c,targetSummary:u="",ackInfo:m,completeLocked:d=!1,unread:p=!1,noticeReadOnly:f=!1,onAckConfirm:g,onAckListClick:x,myManaged:h=!1,isPost:E=!1,simple:b=!1}){L();let B=E?[e.author_name||e.created_by||"",$o(e.created_time)].filter(Boolean).join(" \xB7 "):"",T=e.is_event?nl(e):Nt(e),z=String(e.due_date??"").slice(11,16),k=e.is_event?String(e.event_time??"").trim():/^\d{2}:\d{2}$/.test(z)?z:String(e.estimated_time??"").trim(),_=$o(e.start_date),D=$o(e.due_date),F=_&&k&&!D?`${_} ${k}`:_,R=D&&k?`${D} ${k}`:D,C=le(),y=C.titlePrefix?.(e)??"",I=!e.is_notice&&e.completed&&!!e.review_pending&&!!C.onReviewDone&&(C.myAccountSeq??0)>0&&(e.author_account_seq??0)===(C.myAccountSeq??0),S=!!C.onReturnTask&&oo(e,C.myAccountSeq??0),[O,w]=ld(null),q=e.is_event&&e.due_date?String(e.due_date).slice(0,10):"",v=!!q&&q===r,M=!!q&&q<r,j=!e.is_event&&!e.is_notice&&!e.completed&&!!e.due_date&&e.due_date<r,V=(e.receiver_names??[]).filter(Boolean),Z=!e.is_notice&&$n(e,C.myAccountSeq??0).canConfirm,[ae,me]=ld(!1),U=b&&!ae,ee=b&&ae&&C.renderTaskBodyPreview?C.renderTaskBodyPreview(e):null,$=Y1(null),[G,re]=ld(0);j1(()=>{let se=$.current;if(!U||!se)return;let Q=()=>re(nI+se.offsetHeight/2);if(Q(),typeof ResizeObserver>"u")return;let W=new ResizeObserver(Q);return W.observe(se),()=>W.disconnect()},[U]);let Ee=M?"text.secondary":j||v?"#e5484d":Go.color,ct=j||v?600:400;return _n(Lo,{role:"button",tabIndex:0,onClick:()=>s(e),onKeyDown:se=>{(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),s(e))},onContextMenu:se=>c(e,se),sx:{display:"flex",flexDirection:"column",gap:.75,minWidth:0,p:1.25,pl:"calc(10px + var(--mobile-edge-band-inset, 0px))",cursor:"pointer",position:"relative",...Z?{bgcolor:sI}:{}},children:[h||Z?be(Lo,{sx:{position:"absolute",left:"var(--mobile-edge-band-inset, 0px)",top:0,bottom:0,width:4,bgcolor:Z?lI:"primary.main"}}):null,_n(Lo,{ref:$,sx:{display:"flex",alignItems:"flex-start",gap:.75,minWidth:0,mb:U?0:1},children:[e.is_event?(()=>{let se=Oe(e.icon||zt);return se?be(se,{sx:{fontSize:21,flexShrink:0,mt:.2,color:e.icon_color||"#1e3a8a"}}):null})():!E&&!f&&!d?be(X1,{checked:e.completed,icon:be(tI,{sx:{fontSize:22,color:"#9a9a97",opacity:.45}}),checkedIcon:be(fx,{sx:{fontSize:22,color:"#2f80ed"}}),onClick:se=>se.stopPropagation(),onChange:(se,Q)=>l({anchorEl:se.currentTarget,taskSeq:e.seq,nextCompleted:Q}),sx:{p:0,mt:.1,flexShrink:0}}):null,(()=>{if(!e.is_notice)return null;let se=Oe(e.icon||wt);return se?be(se,{sx:{fontSize:19,flexShrink:0,mt:"1px",color:e.icon_color||"#e5484d"}}):null})(),_n(Lo,{sx:{minWidth:0,flex:1,display:"flex",flexDirection:"column",gap:.5},children:[_n(mn,{sx:{fontSize:`calc(${dt(16)} - var(--card-title-shrink, 0px))`,fontWeight:e.completed&&i?500:600,lineHeight:1.35,minWidth:0,color:e.completed&&i?"#9a9a97":"#111827"},children:[y?be(Lo,{component:"span",sx:{color:"text.secondary",fontWeight:500,fontSize:dt(14),mr:.75},children:be(ci,{text:y,keyword:a})}):null,be(ci,{text:e.title,keyword:a})]}),U&&E?be(mn,{sx:{...Go,fontSize:dt(14),color:"text.secondary",minWidth:0},children:B}):U?_n(Lo,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:1.25,rowGap:.25,minWidth:0},children:[be(uo,{priority:e.priority,small:!0,dotOnly:!0}),R?be(mn,{sx:{...Go,fontSize:dt(14),whiteSpace:"nowrap",color:Ee,fontWeight:ct},children:R}):null,!e.is_notice&&Cn(e)?be(mn,{sx:{...Go,fontSize:dt(14),color:"text.secondary",whiteSpace:"nowrap"},children:be(ci,{text:Cn(e),keyword:a})}):null]}):null]}),p&&!e.completed?be(Lo,{component:"span",sx:{flexShrink:0,px:.55,fontSize:dt(10.5),fontWeight:700,lineHeight:1.6,color:"#fff",bgcolor:"#e5484d",borderRadius:"4px"},children:"N"}):null,b?_n(cI,{children:[be(Lo,{sx:{flexShrink:0,width:46}}),be(J1,{size:"small","aria-label":ae?n("board.collapse"):n("board.expand"),onClick:se=>{se.stopPropagation(),!ae&&typeof e.content!="string"&&C.onNeedTaskDetail?.(e.seq),me(Q=>!Q)},onKeyDown:se=>se.stopPropagation(),sx:{position:"absolute",top:0,right:0,bottom:0,width:56,p:0,pr:`${aI}px`,pt:G?`${Math.max(0,G-rI/2)}px`:"10px",justifyContent:"flex-end",alignItems:"flex-start",borderRadius:0,color:"#6b7280"},children:ae?be(eI,{}):be(Z1,{})})]}):null]}),be(Q1,{in:!U,timeout:iI,unmountOnExit:!0,appear:!1,children:_n(Lo,{sx:{display:"flex",flexDirection:"column",gap:.6,minWidth:0},children:[E?be(un,{label:n("board.written"),children:be(mn,{sx:{...Go,fontSize:dt(14)},children:B})}):null,E?null:be(un,{label:T?n("col.status"):n("col.priority"),children:_n(Lo,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1.25},children:[T?be(Ve,{option:T,small:!0}):null,be(uo,{priority:e.priority,small:!0,dotOnly:!0})]})}),(e.label_keys??[]).length>0?be(un,{label:n("dialog.label"),children:be(Wr,{labelKeys:e.label_keys,labelOptions:t})}):null,o?be(un,{label:n("col.project"),children:be(mn,{sx:Go,children:o})}):null,F?be(un,{label:n("board.start"),children:be(mn,{sx:Go,children:F})}):null,R?be(un,{label:n("board.due"),children:_n(mn,{sx:{...Go,color:Ee,fontWeight:ct},children:[R,j?n("board.overdueSuffix"):""]})}):null,I||S?_n(un,{label:n("board.review"),children:[S?be(Uo,{onClick:se=>{se.stopPropagation(),l({anchorEl:se.currentTarget,taskSeq:e.seq,nextCompleted:!1})},sx:{py:0,mr:1,fontSize:dt(13)},children:n("task.revert")}):null,I?be(px,{size:"small",variant:"contained",disableElevation:!0,onClick:se=>{se.stopPropagation(),w(se.currentTarget)},sx:{...Gr,py:0,fontSize:dt(13)},children:n("col.reviewDone")}):null,be(jr,{anchorEl:O,onCancel:()=>w(null),onConfirm:()=>{C.onReviewDone?.(e),w(null)}})]}):null,e.is_notice?be(un,{label:n("col.targets"),children:be(mn,{sx:Go,children:u||n("col.allEmployees")})}):null,m?be(un,{label:n("task.confirm"),children:be(px,{size:"small",variant:m.canAck?"contained":"outlined",color:"inherit",startIcon:m.acked?be(fx,{sx:{fontSize:"16px !important",color:"#2f80ed"}}):null,onClick:se=>{se.stopPropagation(),m.canAck?g?.(e):x?.(e,se.currentTarget)},sx:{py:0,px:1.25,minWidth:0,fontSize:dt(13),...m.canAck?{color:"#fff",bgcolor:"#2f80ed",boxShadow:"none","&:hover":{bgcolor:"#1e6fd9",boxShadow:"none"}}:{bgcolor:"#fff",borderColor:"#d5d8dc"}},children:m.canAck?n("task.confirm"):`${m.count}/${m.total}`})}):null,!e.is_notice&&Cn(e)?be(un,{label:n("col.owner"),children:be(mn,{sx:Go,children:be(ci,{text:Cn(e),keyword:a})})}):null,!e.is_notice&&V.length>0?be(un,{label:n("col.cc"),children:be(mn,{sx:Go,children:V.join(", ")})}):null,e.note?be(un,{label:n("col.note"),children:be(mn,{sx:Go,children:be(ci,{text:e.note,keyword:a})})}):null,ee?be(Lo,{sx:{mt:.5,minWidth:0},children:ee}):null]})})]})}import{jsx as mi,jsxs as fI}from"react/jsx-runtime";function pI(e,t){if(e.completed||e.archived||t<=0)return;let o=$n(e,t);if(o.canConfirm)return{count:o.count,total:o.total,acked:!1,canAck:!0,pendingNames:o.pendingNames}}function I$({tasks:e,statusOptions:t,customTabs:o,loading:a,dimCompleted:r=!0,simple:i=!1,edge:l=!1,searchText:s,todayStr:c,onToggleCompleted:u,onOpenDetail:m,onTaskContextMenu:d,getTargetSummary:p,getAckInfo:f,getNoticeReadOnly:g,isTaskUnread:x,getCompleteLocked:h,isPostItem:E,onAckConfirm:b,onAckListClick:B,onEndReached:T,myAccountSeq:z=0}){L();let k=new Map(o.map(S=>[S.key,S.label])),[_,D]=dI(null),{onReturnTask:F,slots:R}=le(),C=R?.loadingSpinner??mx,y=_?e.find(S=>S.seq===_.taskSeq):void 0,I=uI(null);return mI(()=>{let S=I.current;if(!T||!S)return;let O=new IntersectionObserver(w=>{w[0]?.isIntersecting&&T()});return O.observe(S),()=>O.disconnect()},[T,e.length]),e.length===0?a?mi(C,{}):mi(sd,{sx:{py:6,textAlign:"center",color:"#94a3b8",fontSize:"0.9rem"},children:n("table.noTasks")}):fI(sd,{sx:{minWidth:0},children:[mi(ux,{edge:l,children:e.map(S=>mi(gx,{dimCompleted:r,simple:i,myManaged:z>0&&!S.is_notice&&!S.is_event&&(S.manager_account_seq??0)===z,task:S,statusOptions:t,projectLabel:S.tab_key?k.get(S.tab_key)??"":"",searchText:s,todayStr:c,onRequestToggleCompleted:D,onOpenDetail:m,onTaskContextMenu:d,targetSummary:S.is_notice?p?.(S):void 0,ackInfo:S.is_notice?f?.(S):pI(S,z),noticeReadOnly:S.is_notice?g?.(S):!1,unread:x?.(S)??!1,completeLocked:h?.(S)??!1,isPost:!!E?.(S),onAckConfirm:b,onAckListClick:B},S.seq))}),T?mi(sd,{ref:I,sx:{height:"1px"}}):null,mi(Oo,{open:!!_,anchorEl:_?.anchorEl??null,nextCompleted:_?.nextCompleted??!1,returnMode:!!F&&!!(y&&oo(y,z)),onCancel:()=>D(null),onConfirm:S=>{_&&(S&&F&&y?F(y,S):u(_.taskSeq,_.nextCompleted)),D(null)}})]})}import{useState as xl}from"react";import{Box as xt,Checkbox as gI,Menu as xI,MenuItem as xx,Tooltip as bI}from"@mui/material";import hI from"@mui/icons-material/CheckCircle";import kI from"@mui/icons-material/CheckCircleOutlineOutlined";import TI from"@mui/icons-material/NotesOutlined";import yI from"@mui/icons-material/AutorenewOutlined";import CI from"@mui/icons-material/CalendarTodayOutlined";import SI from"@mui/icons-material/EventOutlined";import vI from"@mui/icons-material/PersonOutlineOutlined";import BI from"@mui/icons-material/PeopleAltOutlined";import _I from"@mui/icons-material/StickyNote2Outlined";import{ConfirmActionPopper as II}from"@ehfuse/mui-confirm-action";import{Fragment as EI,jsx as Ie,jsxs as kr}from"react/jsx-runtime";var cd={completed:{get label(){return n("col.done")},width:"44px",align:"center",icon:null},title:{get label(){return n("col.title")},width:"1fr",align:"left",icon:Ie(TI,{sx:{fontSize:15}})},manager_name:{get label(){return n("col.owner")},width:"112px",align:"center",icon:Ie(vI,{sx:{fontSize:15}})},receiver_names:{get label(){return n("col.cc")},width:"120px",align:"center",icon:Ie(BI,{sx:{fontSize:15}})},status:{get label(){return n("col.status")},width:"104px",align:"center",icon:Ie(yI,{sx:{fontSize:15}})},priority:{get label(){return n("col.priority")},width:"88px",align:"center",icon:null},start_date:{get label(){return n("col.startTime")},width:"110px",align:"center",icon:Ie(CI,{sx:{fontSize:15}})},due_date:{get label(){return n("col.due")},width:"110px",align:"center",icon:Ie(SI,{sx:{fontSize:15}})},note:{get label(){return n("col.note")},width:"1fr",align:"left",icon:Ie(_I,{sx:{fontSize:15}})}},wI=[{id:"completed"},{id:"title"},{id:"manager_name"},{id:"due_date"},{id:"status"}],DI=new Set(["manager_name","status","due_date"]);function bx(e){let t=String(e??"").trim();return t?t.slice(2,10).replaceAll("-","."):""}function oV(e,t){return t>0?e.filter(o=>!o.is_notice&&!o.completed&&!o.archived&&ln(o)==="group"&&Number(o.visibility_group_seq??0)===t).sort((o,a)=>{let r=String(o.due_date??"").trim(),i=String(a.due_date??"").trim();return r!==i?r?i?r.localeCompare(i):-1:1:Number(o.seq)-Number(a.seq)}):[]}function nV({tasks:e,columns:t=wI,loading:o=!1,emptyText:a=n("table.noTasks"),myAccountSeq:r=0,avatarSrcByName:i,managerCandidates:l=[],canAssignManager:s,onOpenDetail:c,onToggleCompleted:u,onChangeStatus:m,onChangeDueDate:d,onChangeReminder:p,onChangeManager:f,onClaimTask:g}){L();let x=xe(),[h,E]=xl(null),[b,B]=xl(null),[T,z]=xl(null),[k,_]=xl(null),{onReturnTask:D}=le(),[F,R]=xl(null),C=t.map(S=>S.width??cd[S.id].width).join(" "),y=(S,O)=>Ie(po,{src:i?.get(S)??"",name:S,avatarSx:{width:O,height:O,fontSize:Math.round(O/2),flexShrink:0,borderRadius:"50%"},iconFontSize:Math.round(O*.6)}),I=(S,O)=>{let q=cd[S.id].align==="center";switch(S.id){case"completed":if(O.is_event){let v=Oe(O.icon||zt);return Ie(xt,{className:"cell",sx:{justifyContent:"center"},children:v?Ie(v,{sx:{fontSize:19,color:O.icon_color||"#1e3a8a"}}):null},S.id)}return Ie(xt,{className:"cell",sx:{justifyContent:"center",...u?{"&:hover":{bgcolor:x.table.cellHoverBg}}:{}},children:Ie(bI,{title:O.completed?n("menu.uncomplete"):n("menu.complete"),arrow:!0,enterDelay:300,disableInteractive:!0,children:Ie(gI,{checked:!!O.completed,icon:Ie(kI,{sx:{fontSize:20,color:"#9a9a97",opacity:.45}}),checkedIcon:Ie(hI,{sx:{fontSize:20,color:"#2f80ed"}}),onChange:v=>_({anchorEl:v.currentTarget,task:O}),sx:{p:.5}})})},S.id);case"title":{let v=O.is_notice?Oe(O.icon||wt):null,M=O.icon_color||"#e5484d";return kr(xt,{className:"cell",onClick:()=>c(O),sx:{gap:1,cursor:"pointer","&:hover":{bgcolor:x.table.cellHoverBg}},children:[v?Ie(v,{sx:{fontSize:18,flexShrink:0,color:M}}):null,Ie(xt,{component:"span",sx:{fontSize:14.5,fontWeight:x.table.rowTitleFontWeight,color:x.table.rowTitleColor,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O.title||n("table.untitled")})]},S.id)}case"manager_name":{if(sl(O)){let j=Cn(O);return kr(xt,{className:"cell",sx:{gap:.75,justifyContent:"center"},children:[j?y(j,22):null,Ie(xt,{component:"span",sx:{fontSize:14,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:j})]},S.id)}let v=s?s(O):!1,M=r>0&&Number(O.manager_account_seq??0)===r;return v&&f?kr(xt,{className:"cell",onClick:j=>z({anchorEl:j.currentTarget,task:O}),sx:{gap:.75,justifyContent:"center",cursor:"pointer","&:hover":{bgcolor:x.table.cellHoverBg}},children:[O.manager_name?y(O.manager_name,22):null,Ie(xt,{component:"span",sx:{fontSize:14,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O.manager_name||""})]},S.id):Ie(xt,{className:"cell",sx:{gap:.75,justifyContent:"center"},children:O.manager_name?kr(EI,{children:[y(O.manager_name,22),Ie(xt,{component:"span",sx:{fontSize:14,fontWeight:M?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O.manager_name})]}):g?Ie(Uo,{onClick:j=>R({anchorEl:j.currentTarget,taskSeq:Number(O.seq)}),children:n("col.claim")}):null},S.id)}case"receiver_names":return Ie(xt,{className:"cell",sx:{justifyContent:"center",fontSize:14,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(O.receiver_names??[]).join(", ")},S.id);case"status":return Ie(xt,{className:"cell",onClick:m?v=>E({anchorEl:v.currentTarget,task:O}):void 0,sx:{py:.5,justifyContent:"center",...m?{cursor:"pointer","&:hover":{bgcolor:x.table.cellHoverBg}}:{}},children:Ie(Ve,{option:Nt(O)})},S.id);case"priority":return Ie(xt,{className:"cell",sx:{justifyContent:"center"},children:Ie(uo,{priority:O.priority,plain:!0})},S.id);case"start_date":return Ie(xt,{className:"cell",sx:{justifyContent:"center",whiteSpace:"nowrap",fontSize:14},children:bx(O.start_date)},S.id);case"due_date":return Ie(xt,{className:"cell",onClick:d?v=>B({anchorEl:v.currentTarget,taskSeq:Number(O.seq),date:String(O.due_date??"").slice(0,10),reminders:nn(O)}):void 0,sx:{justifyContent:"center",whiteSpace:"nowrap",fontSize:14,...d?{cursor:"pointer","&:hover":{bgcolor:x.table.cellHoverBg}}:{}},children:bx(O.due_date)},S.id);case"note":return Ie(xt,{className:"cell",sx:{justifyContent:q?"center":"flex-start",fontSize:14,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O.note||""},S.id);default:return null}};return kr(xt,{sx:{border:`1px solid ${x.table.borderColor}`,borderRadius:1,overflow:"hidden",bgcolor:x.table.bg,color:x.table.rowColor},children:[Ie(xt,{sx:{display:"grid",gridTemplateColumns:C,borderBottom:`1px solid ${x.table.borderColor}`,bgcolor:x.table.headerBg,"& > *":{display:"flex",alignItems:"center",gap:.5,px:1,py:1,minWidth:0,fontSize:x.table.headerFontSize,whiteSpace:"nowrap",userSelect:"none",borderRight:`1px solid ${x.table.rowBorderColor}`},"& > *:first-of-type":{px:.5},"& > *:last-child":{borderRight:"none",pr:2}},children:t.map(S=>{let O=cd[S.id];return kr(xt,{sx:{justifyContent:O.align==="center"?"center":"flex-start",color:DI.has(S.id)?x.table.headerActiveColor:x.table.headerColor},children:[O.icon,S.label??O.label]},S.id)})}),o?Ie(xt,{sx:{py:3,textAlign:"center",color:x.table.emptyColor,fontSize:14},children:n("common.loading")}):e.length===0?Ie(xt,{sx:{py:3,textAlign:"center",color:x.table.emptyColor,fontSize:14},children:a}):e.map((S,O)=>Ie(xt,{sx:{display:"grid",gridTemplateColumns:C,minHeight:44,fontSize:15,bgcolor:x.table.rowBg,borderTop:O===0?"none":`1px solid ${x.table.rowBorderColor}`,"&:hover":{bgcolor:x.table.rowHoverBg},"& > .cell":{px:1,minWidth:0,display:"flex",alignItems:"center",borderRight:`1px solid ${x.table.rowBorderColor}`},"& > .cell:first-of-type":{px:.5},"& > .cell:last-child":{borderRight:"none",pr:2}},children:t.map(w=>I(w,S))},S.seq)),Ie(Ka,{anchorEl:h?.anchorEl??null,value:String(h?.task.status??""),options:h?Bs(h.task):void 0,onSelect:S=>{h&&m?.(Number(h.task.seq),S),E(null)},onComplete:u&&h&&!h.task.completed&&!h.task.is_notice&&!h.task.is_event&&!h.task.is_bug?()=>u(h.task,!0):void 0,onClose:()=>E(null)}),kr(xI,{anchorEl:T?.anchorEl??null,open:!!T,onClose:()=>z(null),transitionDuration:0,children:[kr(xx,{onClick:()=>{T&&f?.(Number(T.task.seq),"",0),z(null)},sx:{fontSize:14,minWidth:170,gap:1,color:x.table.headerColor},children:[Ie(xt,{sx:{width:24,flexShrink:0}}),n("table.notSpecified")]}),l.map(S=>kr(xx,{selected:Number(T?.task.manager_account_seq??0)===Number(S.account_seq??0),onClick:()=>{T&&f?.(Number(T.task.seq),S.name,Number(S.account_seq??0)),z(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[y(S.name,24),S.name,S.role_name?Ie(xt,{component:"span",sx:{color:x.table.headerColor,fontSize:13},children:S.role_name}):null]},S.seq))]}),Ie(an,{anchorEl:b?.anchorEl??null,open:!!b,date:b?.date??"",reminders:b?.reminders??[],hideReminder:!p,onClose:()=>B(null),onDateChange:S=>{b&&(d?.(b.taskSeq,S),B(O=>O?{...O,date:S}:null))},onReminderChange:S=>{b&&(p?.(b.taskSeq,S),B(O=>O?{...O,reminders:S}:null))}}),Ie(Oo,{open:!!k,anchorEl:k?.anchorEl??null,nextCompleted:!k?.task.completed,returnMode:!!D&&!!(k&&oo(k.task,r)),onCancel:()=>_(null),onConfirm:S=>{k&&(S&&D?D(k.task,S):u?.(k.task,!k.task.completed)),_(null)}}),Ie(II,{open:!!F,anchorEl:F?.anchorEl??null,title:n("table.claimShortConfirm"),confirmText:n("col.claim"),onCancel:()=>R(null),onConfirm:()=>{F&&g?.(F.taskSeq),R(null)}})]})}function RI(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)}function mc(e,t){let o=String(e??"").slice(0,10);if(!RI(o)||typeof t!="number"||!Number.isFinite(t))return"";let a=new Date(`${o}T12:00:00`);a.setDate(a.getDate()+Math.trunc(t));let r=a.getFullYear(),i=String(a.getMonth()+1).padStart(2,"0"),l=String(a.getDate()).padStart(2,"0");return`${r}-${i}-${l}`}function PI(e,t,o){return{title:String(e.title??"").trim(),content:String(e.content??""),start_date:mc(t,e.start_offset_days),due_date:mc(t,e.due_offset_days),priority:e.priority??"medium",label_keys:[...e.label_keys??[]],manager_account_seq:Number(e.manager_account_seq)||0,manager_name:String(e.manager_name??""),checklist:(e.checklist??[]).map(a=>String(a??"").trim()).filter(a=>a.length>0).map(a=>({label:a,checked:!1})),group_seq:o,note:String(e.note??""),...e.visibility?{visibility:e.visibility,visibility_group_seq:Number(e.visibility_group_seq)||0}:{}}}function uc(e,t){let o=Number(e.group_seq)||0;return(e.items??[]).map(a=>PI(a,t,o)).filter(a=>a.title.length>0)}function lV(e){return typeof e!="number"||!Number.isFinite(e)?"-":e===0?n("template.baseDate"):e>0?n("template.baseDatePlus",{value:Math.trunc(e)}):n("template.baseDateMinus",{value:Math.trunc(e)})}import{useEffect as OE,useRef as LE,useState as ob}from"react";import{Box as vr,Button as Od,ButtonBase as AE,Divider as nb,Drawer as qE,IconButton as zE,Tooltip as NE}from"@mui/material";import FE from"@mui/icons-material/Close";import HE from"@ehfuse/overlay-scrollbar";import{FormDialog as WE}from"@ehfuse/mui-form-dialog";import{useState as pi}from"react";import yE from"@mui/icons-material/ExpandLess";import CE from"@mui/icons-material/ExpandMore";import{Box as Sr,ButtonBase as Qx,Divider as vl,Menu as Rd,MenuItem as Pd,Tooltip as SE}from"@mui/material";import vE from"@mui/icons-material/SubjectOutlined";import BE from"@mui/icons-material/StickyNote2Outlined";import _E from"@mui/icons-material/LabelOutlined";import IE from"@mui/icons-material/DirectionsRunOutlined";import Jx from"@mui/icons-material/LockOutlined";import Zx from"@mui/icons-material/PublicOutlined";import eb from"@mui/icons-material/Group";import wE from"@mui/icons-material/Repeat";import DE from"@mui/icons-material/EventOutlined";import EE from"@mui/icons-material/SpeedOutlined";import{TextField as RE}from"@ehfuse/mui-form-controls";import{PROPERTY_GRID_FOUR_CQ as XI,useTimePickerVariant as QI}from"@ehfuse/mui-form-controls";import{useState as _a}from"react";import{Box as Ia,Button as JI,ButtonBase as ZI,Divider as ew,ListItemIcon as tw,Menu as ud,MenuItem as bl}from"@mui/material";import ow from"@mui/icons-material/Add";import pc from"@mui/icons-material/Check";import nw from"@mui/icons-material/ViewKanbanOutlined";import rw from"@mui/icons-material/CalendarTodayOutlined";import aw from"@mui/icons-material/EventOutlined";import iw from"@mui/icons-material/PersonOutlineOutlined";import Cx from"@mui/icons-material/PeopleAltOutlined";import lw from"@mui/icons-material/FlagOutlined";import sw from"@mui/icons-material/TimerOutlined";import cw from"@mui/icons-material/NotificationsNoneOutlined";import mw from"@mui/icons-material/InboxOutlined";import uw from"@mui/icons-material/PlaceOutlined";import dw from"@mui/icons-material/MapOutlined";import{TimePicker as pw}from"@ehfuse/mui-datetime-picker";import{InfoAlert as Sx}from"@ehfuse/alerts";var Tr="@media (max-width: 719.95px)";function In(e){return{[Tr]:{order:e}}}import{PropertyInput as AI}from"@ehfuse/mui-form-controls";import{PropertyRow as MI}from"@ehfuse/mui-form-controls";import{jsx as LI}from"react/jsx-runtime";var Ba={rowMinHeight:32,labelWidth:104,labelFontSize:14,labelColor:"#787774",labelIconSize:null,labelEllipsis:!1,valueFontSize:14,valueMinHeight:null,valuePaddingY:.25,hoverBg:"#f2f2f0",hoverOnlyClickable:!0,idleCursor:"default",placeholderColor:"#9a9a97",inputLineHeight:"inherit",menuFontSize:14},OI={minWidth:"auto"};function ke({icon:e,label:t,onClick:o,sx:a,children:r}){return LI(MI,{icon:e,label:t,onClick:o,appearance:Ba,sx:[OI,...Array.isArray(a)?a:a?[a]:[]],children:r})}import{jsx as hx}from"react/jsx-runtime";function yr({value:e,placeholder:t,readOnly:o,onCommit:a,form:r,name:i}){let l=xe(),s=hx(AI,{...r&&i?{form:r,name:i}:{value:e??""},placeholder:t,readOnly:o,onCommit:c=>a(c),escapeReverts:!1,blurOnComposingEnter:!0,appearance:Ba,sx:{color:l.colors.textPrimary,caretColor:l.colors.textPrimary}});return i?hx(cr,{name:i,children:s}):s}import fw from"@mui/icons-material/StorefrontOutlined";import gw from"@mui/icons-material/SupportAgentOutlined";import{Suspense as qI,lazy as zI,useEffect as NI,useState as kx}from"react";import{Box as md,Dialog as FI,DialogContent as HI,DialogTitle as WI,IconButton as Tx,Tooltip as $I}from"@mui/material";import VI from"@mui/icons-material/Close";import UI from"@mui/icons-material/Search";import{Fragment as YI,jsx as wn,jsxs as dc}from"react/jsx-runtime";function KI(e){return L(),wn(md,{sx:{p:3,fontSize:14,color:"#9a9a97"},children:n("props.addressModuleMissing")})}var GI=zI(()=>import("react-daum-postcode").then(e=>({default:e.default})).catch(()=>({default:KI})));function jI(e){if(e.addressType!=="R")return e.address;let t="";return e.bname!==""&&/[동|로|가]$/g.test(e.bname)&&(t+=e.bname),e.buildingName!==""&&e.apartment==="Y"&&(t+=t!==""?`, ${e.buildingName}`:e.buildingName),t!==""?`${e.address} (${t})`:e.address}function yx({value:e,placeholder:t=n("props.addressPlaceholder"),readOnly:o,onCommit:a}){L();let[r,i]=kx(e),[l,s]=kx(!1),c=le().slots?.addressSearch;NI(()=>i(e),[e]);let u=d=>{i(d),s(!1),d!==e&&a(d)},m=d=>{u(jI(d))};return dc(YI,{children:[dc(md,{sx:{display:"flex",alignItems:"center",gap:.5,flex:1,minWidth:0},children:[wn(md,{component:"input",spellCheck:!1,value:r,readOnly:o,placeholder:t,onChange:d=>i(d.target.value),onBlur:()=>{l||r.trim()!==e&&a(r.trim())},onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),!o&&s(!0))},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",p:0,"&::placeholder":{color:"#9a9a97"}}}),o?null:wn($I,{title:n("props.addressSearch"),arrow:!0,children:wn(Tx,{tabIndex:-1,size:"small","aria-label":n("props.addressSearch"),onClick:()=>s(!0),sx:{color:"#9a9a97",p:.25,flexShrink:0},children:wn(UI,{sx:{fontSize:17}})})})]}),c?wn(c,{open:l,onComplete:u,onClose:()=>s(!1)}):dc(FI,{open:l,onClose:()=>s(!1),maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:{height:550}}},children:[dc(WI,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",pr:2},children:[n("props.addressSearch"),wn(Tx,{"aria-label":n("props.addressSearchClose"),onClick:()=>s(!1),size:"small",children:wn(VI,{})})]}),wn(HI,{style:{padding:0},dividers:!0,children:l?wn(qI,{fallback:null,children:wn(GI,{onComplete:m,onClose:()=>s(!1),defaultQuery:r,style:{width:"100%",height:"100%"}})}):null})]})]})}import{Fragment as wa,jsx as ne,jsxs as Bo}from"react/jsx-runtime";function vx(e){return String(e??"").includes(" ")?Vo(e):$o(e)}function xw(e){let[t="00",o="00"]=String(e??"").split(":");return{hour:/^\d{2}$/.test(t)?t:"00",minute:/^\d{2}$/.test(o)?o:"00"}}function Zr({label:e=n("menu.empty")}){return L(),ne(Ia,{component:"span",sx:{color:"#9a9a97"},children:e})}var fc={tabKey:"tab_key",startDate:"start_date",dueDate:"due_date",reminders:"reminders",priority:"priority",eventTime:"event_time",eventPlace:"event_place",eventAddress:"event_address"};function Cr({form:e,field:t,fallback:o,children:a}){return e?ne(Wo,{form:e,name:fc[t],children:r=>a(r)}):ne(wa,{children:a(o)})}var dd=XI,lt=e=>({gridColumn:`${e}`,[Tr]:{gridColumn:"auto"},[dd]:{gridColumn:"auto"}});function gc({values:e,form:t,customTabs:o,avatarSrcByName:a,managerLocked:r=!1,notice:i=!1,event:l=!1,hideDueDate:s=!1,hideReminder:c=!1,beforeStart:u,pinColumns:m=!1,projectColumn:d=1,afterProject:p,readOnly:f=!1,coreLocked:g,targetSummary:x="",narrowCollapsedSx:h,reminderLocked:E=!1,managerAction:b,hideProject:B=!1,hideManager:T=!1,hideReceivers:z=!1,hideStartDate:k=!1,hidePriority:_=!1,leading:D,supportOrigin:F,trailing:R,onChangeProject:C,onChangeStartDate:y,onClearStartDate:I,onChangeDueDate:S,onChangeReminder:O,onChangePriority:w,onChangeEventTime:q,onChangeEventPlace:v,onChangeEventAddress:M,onMemberEdit:j,onAddProject:V}){L();let[Z,ae]=_a(null),me=QI(void 0),[U,ee]=_a(!1),$=g??f,[G,re]=_a(null),[Ee,ct]=_a(null),[se,Q]=_a(null),[W,X]=_a(null),[ie,de]=_a(null),we=We(),Se=Nn(),_t=m&&!l,He=(te,Be,Je=!1)=>[In(te),{[dd]:{order:te}},...Je&&h?Array.isArray(h)?h:[h]:[],..._t&&Be?[lt(Be)]:[]],De=te=>t?t.getFormValue(fc[te]):e[te],mt=o.filter(te=>!te.archived),Ge=!!I&&!i&&!$,so=te=>{let Be=String(De("startDate")??"").trim(),Je=I?!!Be&&ws(Be).getTime()>Date.now():!!Be;if(y(te),Je||l)return;let qe=ws(te);if(!Number.isNaN(qe.getTime())){if(i){if(qe.getTime()<=Date.now())return;Sx(n("props.noticeStartInfo"));return}qe.getTime()<=Date.now()||Sx(n("props.startInfo"))}},ht=ne(ke,{icon:ne(cw,{sx:{fontSize:17}}),label:n("reminder.title"),onClick:$||E?void 0:te=>ct(te),sx:He(l?8:5,2,!0),children:ne(Cr,{form:t,field:"reminders",fallback:e.reminders,children:te=>te.length===0?ne(Zr,{label:n("common.none")}):ku(te)})});return Bo(wa,{children:[ne(Ia,{sx:{containerType:"inline-size"},children:Bo(Ia,{sx:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",[dd]:{gridTemplateColumns:"repeat(4, minmax(0, 1fr))"},gridAutoFlow:"row dense",columnGap:3,rowGap:0,px:2,[Tr]:{gridTemplateColumns:"minmax(0, 1fr)"}},children:[D,F?Bo(wa,{children:[Bo(ke,{icon:ne(fw,{sx:{fontSize:17}}),label:n("section.merchant"),sx:He(0,1),children:[F.licenseName||ne(Zr,{}),F.contactPhone?ne(Ia,{component:"span",sx:{ml:1,color:"#6f6f6c",fontSize:"0.92em"},children:F.contactPhone}):null,F.contactEmail?ne(Ia,{component:"span",sx:{ml:1,color:"#6f6f6c",fontSize:"0.92em"},children:F.contactEmail}):null]}),ne(ke,{icon:ne(gw,{sx:{fontSize:17}}),label:n("props.supportType"),sx:He(0,2),children:F.supportType||ne(Zr,{})})]}):null,B?null:ne(ke,{icon:ne(nw,{sx:{fontSize:17}}),label:n("col.project"),onClick:$?void 0:te=>ae(te),sx:_t&&d==="full"?[He(1,void 0,!0),{gridColumn:"1 / -1"}]:He(1,d==="full"?1:d,!0),children:ne(Cr,{form:t,field:"tabKey",fallback:e.tabKey,children:te=>{let Be=o.find(qe=>qe.key===te);if(!Be)return n("props.defaultProject");let Je=Oe(Be.icon);return Bo(wa,{children:[Je?ne(Je,{sx:{fontSize:16,color:"#1e3a8a"}}):null,Be.label]})}})}),p,i?ne(ke,{icon:ne(Cx,{sx:{fontSize:17}}),label:n("col.targets"),onClick:$?void 0:()=>j("targets"),sx:He(7,1),children:x||n("col.allEmployees")}):null,!i&&!l&&!T?ne(ke,{icon:ne(iw,{sx:{fontSize:17}}),label:n("col.owner"),onClick:r||$||!e.managerName&&b?void 0:()=>j("manager"),sx:He(7,1),children:e.managerName?Bo(wa,{children:[ne(So,{names:[e.managerName],size:20,avatarSrcByName:a}),e.managerName]}):b?Bo(Ia,{sx:{display:"inline-flex",alignItems:"center",gap:1},children:[b,!r&&!$?ne(JI,{size:"small",variant:"outlined",color:"inherit",onClick:te=>{te.stopPropagation(),j("manager")},sx:{minWidth:0,px:1.25,py:.25,fontSize:13,whiteSpace:"nowrap",borderColor:"divider",color:"text.primary"},children:n("common.select")}):null]}):ne(Zr,{})}):null,u,!l&&!k?ne(ke,{icon:ne(rw,{sx:{fontSize:17}}),label:i?n("props.postTime"):n("col.startTime"),onClick:$?void 0:te=>Q(te),sx:He(2,2),children:ne(Cr,{form:t,field:"startDate",fallback:e.startDate,children:te=>Bo(wa,{children:[te?vx(te):i?ne(Ia,{component:"span",sx:{fontSize:13.5,color:"text.secondary"},children:n("props.draftNotPosted")}):ne(Zr,{label:Ge?n("props.undecided"):void 0}),Ge&&te?ne(ZI,{onClick:Be=>{Be.stopPropagation(),I?.()},sx:{ml:"auto",flexShrink:0,px:1,py:.25,borderRadius:1,border:"1px solid #e6e6e3",fontSize:14,color:"#787774","&:hover":{bgcolor:"#ebebe9"}},children:n("props.undecided")}):null]})})}):null,!i&&!z?ne(ke,{icon:ne(Cx,{sx:{fontSize:17}}),label:l?n("props.attendees"):n("col.cc"),onClick:$?void 0:()=>j("receivers"),sx:He(l?7:8,1),children:e.receiverNames.length>0?Bo(wa,{children:[ne(So,{names:e.receiverNames,size:20,avatarSrcByName:a}),e.receiverNames.length===1?e.receiverNames[0]:null]}):ne(Zr,{})}):null,s?null:ne(ke,{icon:ne(aw,{sx:{fontSize:17}}),label:l?n("props.date"):n("col.due"),onClick:$?void 0:te=>X(te),sx:He(3,2),children:ne(Cr,{form:t,field:"dueDate",fallback:e.dueDate,children:te=>te?l?$o(te):vx(te):ne(Zr,{label:i?n("props.noExpiry"):void 0})})}),l?ne(ke,{icon:ne(sw,{sx:{fontSize:17}}),label:n("calendar.time"),onClick:$?void 0:te=>de(te),sx:In(4),children:ne(Cr,{form:t,field:"eventTime",fallback:e.eventTime,children:te=>te||ne(Zr,{label:n("googleEvent.allDay")})})}):null,l?ne(ke,{icon:ne(uw,{sx:{fontSize:17}}),label:"\uC7A5\uC18C",sx:In(5),children:ne(yr,{...t?{form:t,name:fc.eventPlace}:{value:e.eventPlace??""},placeholder:n("props.locationPlaceholder"),readOnly:$,onCommit:te=>v?.(te)})}):null,!c&&l?ht:null,l?ne(ke,{icon:ne(dw,{sx:{fontSize:17}}),label:n("props.address"),sx:[{gridColumn:"1 / -1"},In(6)],children:ne(cr,{name:fc.eventAddress,children:ne(Cr,{form:t,field:"eventAddress",fallback:e.eventAddress,children:te=>ne(yx,{value:te??"",placeholder:n("props.addressPlaceholder"),readOnly:$,onCommit:Be=>M?.(Be)})})})}):null,!l&&!_?ne(ke,{icon:ne(lw,{sx:{fontSize:17}}),label:n("col.priority"),onClick:f?void 0:te=>re(te),sx:He(6,1,!0),children:ne(Cr,{form:t,field:"priority",fallback:e.priority,children:te=>ne(uo,{priority:te,small:!0})})}):null,!c&&!l?ht:null,R]})}),Bo(ud,{transitionDuration:0,anchorEl:Z,open:!!Z,onClose:()=>ae(null),...Se,children:[Bo(bl,{selected:!De("tabKey"),onClick:()=>{C(""),ae(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[ne(mw,{sx:{fontSize:17,color:"#9a9a97"}}),n("common.none"),De("tabKey")?null:ne(pc,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}})]}),mt.map(te=>{let Be=Oe(te.icon),Je=De("tabKey")===te.key;return Bo(bl,{selected:Je,onClick:()=>{C(te.key),ae(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[Be?ne(Be,{sx:{fontSize:17,color:"#1e3a8a"}}):null,te.label,Je?ne(pc,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},te.key)}),V?[ne(ew,{},"add-project-divider"),Bo(bl,{onClick:()=>ee(!0),sx:{fontSize:14,color:"#787774"},children:[ne(tw,{children:ne(ow,{sx:{fontSize:18,color:"#787774"}})}),n("table.addProject")]},"add-project")]:null]}),V?ne(Ms,{open:U,onClose:()=>ee(!1),onSubmit:(te,Be,Je)=>{(async()=>{let qe=await V(te,Be,Je);qe&&C(qe)})(),ae(null)}}):null,ne(ud,{transitionDuration:0,anchorEl:G,open:!!G,onClose:()=>re(null),...Se,children:["high","medium","low"].map(te=>Bo(bl,{selected:De("priority")===te,onClick:()=>{w(te),re(null)},sx:{fontSize:14,minWidth:130,gap:1},children:[ne(uo,{priority:te,small:!0}),De("priority")===te?ne(pc,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},te))}),ne(Cr,{form:t,field:"reminders",fallback:e.reminders,children:te=>ne(ud,{transitionDuration:0,anchorEl:Ee,open:!!Ee,onClose:()=>ct(null),...Se,children:hu(l?!!De("eventTime"):String(De("dueDate")??"").includes(" ")).map(Be=>{let Je=Be.value==="none"?te.length===0:te.includes(Be.value);return Bo(bl,{selected:Je,onClick:()=>{O(fs(te,Be.value)),Be.value==="none"&&ct(null)},sx:{fontSize:14,minWidth:150,gap:1},children:[Be.label,Je?ne(pc,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},Be.value)})})}),l?ne(pw,{timeVariant:me,anchorEl:ie,open:!!ie,onClose:()=>de(null),value:xw(De("eventTime")),format:"HH:mm",minuteStep:10,autoApply:!0,centered:we,locale:zn(),onChange:(te,Be)=>{q?.(`${te}:${Be}`),de(null)}}):null,ne(an,{anchorEl:se,open:!!se,date:De("startDate"),reminders:[],hideReminder:!0,showTime:!0,centered:we,onClose:()=>Q(null),onDateChange:so,onReminderChange:()=>{}}),ne(Cr,{form:t,field:"reminders",fallback:e.reminders,children:te=>ne(an,{anchorEl:W,open:!!W,date:De("dueDate"),reminders:te,hideReminder:E||c,showTime:!l,centered:we,onClose:()=>X(null),onDateChange:S,onReminderChange:O})})]})}import{useState as bw}from"react";import{Box as hw,Menu as kw,MenuItem as Tw}from"@mui/material";import yw from"@mui/icons-material/RepeatOutlined";import Cw from"@mui/icons-material/DevicesOutlined";import Sw from"@mui/icons-material/ScreenSearchDesktopOutlined";import vw from"@mui/icons-material/SellOutlined";import Bw from"@mui/icons-material/TaskAltOutlined";import{Fragment as xd,jsx as Tt,jsxs as Bx}from"react/jsx-runtime";function pd({label:e=n("menu.empty")}){return L(),Tt(hw,{component:"span",sx:{color:"#9a9a97"},children:e})}var gd={repro:"bug_repro",device:"bug_device",where:"bug_where",version:"bug_version",resolution:"resolution"};function fd({form:e,field:t,fallback:o,children:a}){return e?Tt(Wo,{form:e,name:gd[t],children:r=>a(String(r??""))}):Tt(xd,{children:a(o)})}function xc({values:e,form:t,readOnly:o=!1,showResolution:a=!1,onChangeRepro:r,onChangeDevice:i,onChangeWhere:l,onChangeVersion:s,onChangeResolution:c}){L();let[u,m]=bw(null),d=u?.field==="repro"?cu:u?.field==="device"?mu:uu,p=f=>{u?.field==="repro"?r(f):u?.field==="device"?i(f):u?.field==="resolution"&&c?.(f),m(null)};return Bx(xd,{children:[Bx(xd,{children:[Tt(ke,{icon:Tt(yw,{sx:{fontSize:17}}),label:n("bug.repro"),onClick:o?void 0:f=>m({field:"repro",el:f}),children:Tt(fd,{form:t,field:"repro",fallback:e.repro,children:f=>Sf(f)||Tt(pd,{label:n("common.select")})})}),Tt(ke,{icon:Tt(Cw,{sx:{fontSize:17}}),label:n("bug.device"),onClick:o?void 0:f=>m({field:"device",el:f}),children:Tt(fd,{form:t,field:"device",fallback:e.device,children:f=>vf(f)||Tt(pd,{label:n("common.select")})})}),Tt(ke,{icon:Tt(Sw,{sx:{fontSize:17}}),label:"\uBC1C\uC0DD\uD654\uBA74",children:Tt(yr,{...t?{form:t,name:gd.where}:{value:e.where},placeholder:n("bug.screenPlaceholder"),readOnly:o,onCommit:l})}),Tt(ke,{icon:Tt(vw,{sx:{fontSize:17}}),label:"\uBC1C\uC0DD\uBC84\uC804",children:Tt(yr,{...t?{form:t,name:gd.version}:{value:e.version},placeholder:n("bug.versionPlaceholder"),readOnly:o,onCommit:s})}),a?Tt(ke,{icon:Tt(Bw,{sx:{fontSize:17}}),label:n("bug.resolution"),onClick:o?void 0:f=>m({field:"resolution",el:f}),children:Tt(fd,{form:t,field:"resolution",fallback:e.resolution??"",children:f=>Cs(f)||Tt(pd,{label:n("common.select")})})}):null]}),Tt(kw,{open:!!u,anchorEl:u?.el??null,onClose:()=>m(null),transitionDuration:0,children:d.map(f=>Tt(Tw,{onClick:()=>p(f.key),sx:{fontSize:14},children:f.name},f.key))})]})}import{Box as _x}from"@mui/material";import{jsxs as Ix}from"react/jsx-runtime";var bd=16;function hd(){let e=le().sectionTitle;return{showIcon:e?.showIcon??!0,color:e?.color??"#37352f",fontWeight:e?.fontWeight??500}}function Ao({icon:e,title:t,titleExtra:o,children:a}){let r=hd();return Ix(_x,{sx:{px:2,display:"flex",flexDirection:"column",gap:.25},children:[Ix(_x,{sx:{display:"flex",alignItems:"center",gap:1,fontSize:bd,fontWeight:r.fontWeight,color:r.color},children:[r.showIcon?e:null,t,o]}),a]})}import{useState as vd}from"react";import{Box as Bd,Button as Ow,Divider as Mx,IconButton as Ox,Menu as Lw,MenuItem as kc,Tooltip as Aw}from"@mui/material";import qw from"@mui/icons-material/MoreVert";import{ConfirmDialog as zw,ErrorAlert as Nw,SuccessAlert as Fw}from"@ehfuse/alerts";import{FormDialog as Hw}from"@ehfuse/mui-form-dialog";import{ClearTextField as Ww}from"@ehfuse/mui-form-controls";import{useEffect as wx,useLayoutEffect as _w,useRef as Da,useState as Dx}from"react";import{Box as hl,Button as Td,IconButton as yd,Tooltip as Cd,useMediaQuery as Iw,useTheme as ww}from"@mui/material";import Ex from"@mui/icons-material/EditOutlined";import Dw from"@mui/icons-material/DoneOutlined";import Rx from"@mui/icons-material/Translate";import Ew from"@mui/icons-material/ContentCopyOutlined";import{EhfuseEditor as Rw,ImageResizePlugin as Pw,minimalToolbarOptions as Px}from"@ehfuse/editor";var kd={"& 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}};import{jsx as io,jsxs as bc}from"react/jsx-runtime";function Sd(e){let t=e.trim();return t?t.startsWith("<")?e:`<p>${t}</p>`:"<p></p>"}function Ea(e){let t=e.replace(/<br\s*\/?>/gi,`
1
+ import{a as $i,b as Up,c as Bm,d as nA,e as rA,f as aA,g as iA,h as lA}from"./chunks/chunk-4L6MXOC5.js";import{a as fa,b as oA,c as Gp,d as ms,e as sA,f as cA,g as mA,h as uA,i as jp}from"./chunks/chunk-HORIQZVA.js";import{a as ee,b as cs,m as Vi,n as _m}from"./chunks/chunk-Q5FXCIHK.js";import{a as IT,b as wT,c as DT,d as ga,e as vm,f as ET,g as n,h as nn,i as RT,j as L,k as Se,l as Hr,m as Kp,n as cr,o as Nn}from"./chunks/chunk-WOL25EMO.js";import"./chunks/chunk-JQBDPUHS.js";var Yp="waiting",dA="replied";import{createContext as PT,useContext as OT,useMemo as Xp}from"react";import{Box as MT,useMediaQuery as LT,useTheme as AT}from"@mui/material";import{ConfirmActionProvider as qT}from"@ehfuse/mui-confirm-action";var Im="--app-mobile-font-offset";function pt(e,t=0){return`calc(${e}px + max(0px, var(${Im}, 0px) - ${t}px))`}import{jsx as wm}from"react/jsx-runtime";var Qp=PT({});function zT({config:e,children:t}){let o=L(),a=Xp(()=>({...e??{}}),[e,o]),r=a.mobileFontOffsetPx,i=AT(),l=LT(i.breakpoints.up("lg")),s=a.isMobile??!l;return wm(Qp.Provider,{value:a,children:wm(qT,{isMobile:s,children:r===void 0?t:wm(MT,{sx:{display:"contents",[Im]:`${r}px`},children:t})})})}function se(){return OT(Qp)}function Ki(){let{buildFileUrl:e}=se();return Xp(()=>e||((t,o)=>{let a=[];return o?.thumb&&a.push(`thumb=${o.thumb}`),o?.download&&a.push("download=1"),`/api/v1/files/${t}${a.length?`?${a.join("&")}`:""}`}),[e])}function Ui(){let{uploadMaxMb:e}=se();return e??50}import{useGlobalForm as _S}from"@ehfuse/forma";import{useSyncExternalStore as NT}from"react";import Zp from"@mui/icons-material/DoNotDisturbAltOutlined";import Rm from"@mui/icons-material/BookmarkBorderOutlined";import FT from"@mui/icons-material/LabelOutlined";import HT from"@mui/icons-material/FlagOutlined";import WT from"@mui/icons-material/StarBorderOutlined";import $T from"@mui/icons-material/FolderOutlined";import VT from"@mui/icons-material/EventOutlined";import KT from"@mui/icons-material/BuildOutlined";import UT from"@mui/icons-material/LocalShippingOutlined";import GT from"@mui/icons-material/StorefrontOutlined";import jT from"@mui/icons-material/GroupsOutlined";import YT from"@mui/icons-material/LightbulbOutlined";import XT from"@mui/icons-material/FavoriteBorderOutlined";import QT from"@mui/icons-material/AssignmentOutlined";import JT from"@mui/icons-material/HomeOutlined";import ZT from"@mui/icons-material/WorkOutline";import ey from"@mui/icons-material/SchoolOutlined";import ty from"@mui/icons-material/LocalHospitalOutlined";import oy from"@mui/icons-material/RestaurantOutlined";import ny from"@mui/icons-material/LocalFloristOutlined";import ry from"@mui/icons-material/DirectionsCarOutlined";import ay from"@mui/icons-material/CampaignOutlined";import iy from"@mui/icons-material/SavingsOutlined";import ly from"@mui/icons-material/Inventory2Outlined";import sy from"@mui/icons-material/CleaningServicesOutlined";import ef from"@mui/icons-material/HandymanOutlined";import cy from"@mui/icons-material/LocalPhoneOutlined";import my from"@mui/icons-material/EmailOutlined";import uy from"@mui/icons-material/ShoppingCartOutlined";import dy from"@mui/icons-material/BarChartOutlined";import py from"@mui/icons-material/PrintOutlined";import fy from"@mui/icons-material/SecurityOutlined";import gy from"@mui/icons-material/AlarmOutlined";import xy from"@mui/icons-material/AttachFileOutlined";import by from"@mui/icons-material/PhotoCameraOutlined";import hy from"@mui/icons-material/ImageOutlined";import ky from"@mui/icons-material/MenuBookOutlined";import Ty from"@mui/icons-material/EditOutlined";import yy from"@mui/icons-material/KeyOutlined";import Cy from"@mui/icons-material/LockOutlined";import Sy from"@mui/icons-material/LockOpenOutlined";import vy from"@mui/icons-material/SettingsOutlined";import By from"@mui/icons-material/CloudOutlined";import _y from"@mui/icons-material/WifiOutlined";import Iy from"@mui/icons-material/ComputerOutlined";import wy from"@mui/icons-material/SmartphoneOutlined";import Dy from"@mui/icons-material/TvOutlined";import Ey from"@mui/icons-material/AccessTimeOutlined";import Ry from"@mui/icons-material/TimerOutlined";import Py from"@mui/icons-material/MapOutlined";import Oy from"@mui/icons-material/PlaceOutlined";import My from"@mui/icons-material/NavigationOutlined";import Ly from"@mui/icons-material/FlightOutlined";import Ay from"@mui/icons-material/TrainOutlined";import qy from"@mui/icons-material/DirectionsBusOutlined";import zy from"@mui/icons-material/DirectionsBikeOutlined";import Ny from"@mui/icons-material/DirectionsWalkOutlined";import Fy from"@mui/icons-material/DirectionsRunOutlined";import Hy from"@mui/icons-material/FitnessCenterOutlined";import Wy from"@mui/icons-material/SportsSoccerOutlined";import $y from"@mui/icons-material/EmojiEventsOutlined";import Vy from"@mui/icons-material/CardGiftcardOutlined";import Ky from"@mui/icons-material/CakeOutlined";import tf from"@mui/icons-material/CoffeeOutlined";import Uy from"@mui/icons-material/LocalPizzaOutlined";import Gy from"@mui/icons-material/ShoppingBagOutlined";import of from"@mui/icons-material/CreditCardOutlined";import jy from"@mui/icons-material/AccountBalanceOutlined";import Yy from"@mui/icons-material/AccountBalanceWalletOutlined";import Xy from"@mui/icons-material/AttachMoneyOutlined";import Qy from"@mui/icons-material/ReceiptLongOutlined";import Jy from"@mui/icons-material/CalculateOutlined";import Zy from"@mui/icons-material/TrendingUpOutlined";import eC from"@mui/icons-material/ListAltOutlined";import tC from"@mui/icons-material/TaskAltOutlined";import oC from"@mui/icons-material/DoneAllOutlined";import nC from"@mui/icons-material/WarningAmberOutlined";import rC from"@mui/icons-material/InfoOutlined";import aC from"@mui/icons-material/HelpOutlined";import iC from"@mui/icons-material/SupportAgentOutlined";import lC from"@mui/icons-material/PersonOutlined";import sC from"@mui/icons-material/PersonAddOutlined";import cC from"@mui/icons-material/BadgeOutlined";import mC from"@mui/icons-material/WbSunnyOutlined";import uC from"@mui/icons-material/DarkModeOutlined";import dC from"@mui/icons-material/LocalFireDepartmentOutlined";import pC from"@mui/icons-material/WaterDropOutlined";import fC from"@mui/icons-material/BoltOutlined";import gC from"@mui/icons-material/AutorenewOutlined";import xC from"@mui/icons-material/ScienceOutlined";import bC from"@mui/icons-material/MedicalServicesOutlined";import hC from"@mui/icons-material/NotificationsOutlined";import kC from"@mui/icons-material/SendOutlined";import TC from"@mui/icons-material/LinkOutlined";import yC from"@mui/icons-material/PublicOutlined";import nf from"@mui/icons-material/ApartmentOutlined";import CC from"@mui/icons-material/PlumbingOutlined";import SC from"@mui/icons-material/ElectricalServicesOutlined";import vC from"@mui/icons-material/ChatOutlined";import BC from"@mui/icons-material/DescriptionOutlined";import _C from"@mui/icons-material/FactCheckOutlined";import IC from"@mui/icons-material/RocketLaunchOutlined";import wC from"@mui/icons-material/PaletteOutlined";import DC from"@mui/icons-material/MusicNoteOutlined";import EC from"@mui/icons-material/VideocamOutlined";import RC from"@mui/icons-material/ThumbUpOutlined";import PC from"@mui/icons-material/PushPinOutlined";import OC from"@mui/icons-material/SearchOutlined";import MC from"@mui/icons-material/VisibilityOutlined";import LC from"@mui/icons-material/VerifiedOutlined";import AC from"@mui/icons-material/TrackChangesOutlined";import qC from"@mui/icons-material/ExtensionOutlined";import zC from"@mui/icons-material/CodeOutlined";import NC from"@mui/icons-material/BugReportOutlined";import FC from"@mui/icons-material/SmartToyOutlined";import HC from"@mui/icons-material/StorageOutlined";import WC from"@mui/icons-material/QrCode2Outlined";import $C from"@mui/icons-material/FileDownloadOutlined";import VC from"@mui/icons-material/FileUploadOutlined";import KC from"@mui/icons-material/MicOutlined";import UC from"@mui/icons-material/HeadphonesOutlined";import GC from"@mui/icons-material/MovieOutlined";import jC from"@mui/icons-material/SportsEsportsOutlined";import YC from"@mui/icons-material/BrushOutlined";import XC from"@mui/icons-material/ArchitectureOutlined";import QC from"@mui/icons-material/EngineeringOutlined";import JC from"@mui/icons-material/FactoryOutlined";import ZC from"@mui/icons-material/AgricultureOutlined";import eS from"@mui/icons-material/DirectionsBoatOutlined";import tS from"@mui/icons-material/TwoWheelerOutlined";import oS from"@mui/icons-material/HandshakeOutlined";import nS from"@mui/icons-material/GavelOutlined";import rS from"@mui/icons-material/BalanceOutlined";import aS from"@mui/icons-material/TranslateOutlined";import iS from"@mui/icons-material/PsychologyOutlined";import lS from"@mui/icons-material/PetsOutlined";import sS from"@mui/icons-material/CelebrationOutlined";import cS from"@mui/icons-material/BeachAccessOutlined";import mS from"@mui/icons-material/AcUnitOutlined";import uS from"@mui/icons-material/ForestOutlined";import dS from"@mui/icons-material/LandscapeOutlined";import pS from"@mui/icons-material/HotelOutlined";import fS from"@mui/icons-material/LocalLaundryServiceOutlined";import gS from"@mui/icons-material/ChairOutlined";import xS from"@mui/icons-material/LocalBarOutlined";import bS from"@mui/icons-material/LunchDiningOutlined";import hS from"@mui/icons-material/IcecreamOutlined";import kS from"@mui/icons-material/WorkspacePremiumOutlined";import TS from"@mui/icons-material/DiamondOutlined";import yS from"@mui/icons-material/VaccinesOutlined";import{jsx as BS}from"react/jsx-runtime";var ji="bookmark",Wr="label",Dt="notifications",Nt="event",ps="warning",fs="#e53e3e",rf="none",af=[{key:rf,Icon:Zp},{key:"label",Icon:FT},{key:"bookmark",Icon:Rm},{key:"flag",Icon:HT},{key:"star",Icon:WT},{key:"folder",Icon:$T},{key:"event",Icon:VT},{key:"build",Icon:KT},{key:"shipping",Icon:UT},{key:"store",Icon:GT},{key:"groups",Icon:jT},{key:"idea",Icon:YT},{key:"heart",Icon:XT},{key:"assignment",Icon:QT},{key:"home",Icon:JT},{key:"work",Icon:ZT},{key:"school",Icon:ey},{key:"hospital",Icon:ty},{key:"restaurant",Icon:oy},{key:"flower",Icon:ny},{key:"car",Icon:ry},{key:"campaign",Icon:ay},{key:"savings",Icon:iy},{key:"inventory",Icon:ly},{key:"cleaning",Icon:sy},{key:"handyman",Icon:ef},{key:"phone",Icon:cy},{key:"email",Icon:my},{key:"cart",Icon:uy},{key:"chart",Icon:dy},{key:"print",Icon:py},{key:"security",Icon:fy},{key:"alarm",Icon:gy},{key:"attach",Icon:xy},{key:"camera",Icon:by},{key:"image",Icon:hy},{key:"book",Icon:ky},{key:"edit",Icon:Ty},{key:"key",Icon:yy},{key:"lock",Icon:Cy},{key:"unlock",Icon:Sy},{key:"settings",Icon:vy},{key:"cloud",Icon:By},{key:"wifi",Icon:_y},{key:"computer",Icon:Iy},{key:"smartphone",Icon:wy},{key:"tv",Icon:Dy},{key:"clock",Icon:Ey},{key:"timer",Icon:Ry},{key:"map",Icon:Py},{key:"place",Icon:Oy},{key:"navigation",Icon:My},{key:"flight",Icon:Ly},{key:"train",Icon:Ay},{key:"bus",Icon:qy},{key:"bike",Icon:zy},{key:"walk",Icon:Ny},{key:"run",Icon:Fy},{key:"fitness",Icon:Hy},{key:"soccer",Icon:Wy},{key:"trophy",Icon:$y},{key:"gift",Icon:Vy},{key:"cake",Icon:Ky},{key:"coffee",Icon:tf},{key:"pizza",Icon:Uy},{key:"bag",Icon:Gy},{key:"card",Icon:of},{key:"bank",Icon:jy},{key:"wallet",Icon:Yy},{key:"money",Icon:Xy},{key:"receipt",Icon:Qy},{key:"calculate",Icon:Jy},{key:"trending",Icon:Zy},{key:"listalt",Icon:eC},{key:"task",Icon:tC},{key:"doneall",Icon:oC},{key:"warning",Icon:nC},{key:"info",Icon:rC},{key:"help",Icon:aC},{key:"support",Icon:iC},{key:"person",Icon:lC},{key:"personadd",Icon:sC},{key:"badge",Icon:cC},{key:"sun",Icon:mC},{key:"moon",Icon:uC},{key:"fire",Icon:dC},{key:"water",Icon:pC},{key:"bolt",Icon:fC},{key:"renew",Icon:gC},{key:"science",Icon:xC},{key:"medical",Icon:bC},{key:"notifications",Icon:hC},{key:"send",Icon:kC},{key:"link",Icon:TC},{key:"public",Icon:yC},{key:"apartment",Icon:nf},{key:"plumbing",Icon:CC},{key:"electrical",Icon:SC},{key:"chat",Icon:vC},{key:"description",Icon:BC},{key:"factcheck",Icon:_C},{key:"rocket",Icon:IC},{key:"palette",Icon:wC},{key:"music",Icon:DC},{key:"video",Icon:EC},{key:"thumbup",Icon:RC},{key:"pin",Icon:PC},{key:"search",Icon:OC},{key:"eye",Icon:MC},{key:"verified",Icon:LC},{key:"target",Icon:AC},{key:"extension",Icon:qC},{key:"code",Icon:zC},{key:"bug",Icon:NC},{key:"robot",Icon:FC},{key:"storage",Icon:HC},{key:"qrcode",Icon:WC},{key:"download",Icon:$C},{key:"upload",Icon:VC},{key:"mic",Icon:KC},{key:"headphones",Icon:UC},{key:"movie",Icon:GC},{key:"game",Icon:jC},{key:"brush",Icon:YC},{key:"architecture",Icon:XC},{key:"engineering",Icon:QC},{key:"factory",Icon:JC},{key:"agriculture",Icon:ZC},{key:"boat",Icon:eS},{key:"motorcycle",Icon:tS},{key:"handshake",Icon:oS},{key:"gavel",Icon:nS},{key:"balance",Icon:rS},{key:"translate",Icon:aS},{key:"psychology",Icon:iS},{key:"pets",Icon:lS},{key:"celebration",Icon:sS},{key:"beach",Icon:cS},{key:"snow",Icon:mS},{key:"forest",Icon:uS},{key:"mountain",Icon:dS},{key:"hotel",Icon:pS},{key:"laundry",Icon:fS},{key:"chair",Icon:gS},{key:"bar",Icon:xS},{key:"burger",Icon:bS},{key:"icecream",Icon:hS},{key:"medal",Icon:kS},{key:"diamond",Icon:TS},{key:"vaccine",Icon:yS}],CS={cafe:tf,payment:of,business:nf,construction:ef},Gi=null,ds=null,us=null,Dm=0,Em=new Set;function lf(){return Gi?Promise.resolve():(us||(us=import("./chunks/muiIconCatalog-YYESXZNB.js").then(e=>{Gi=e.MUI_ICON_BY_KEY,ds=e.MUI_ICON_GROUPS,Dm+=1,Em.forEach(t=>t())}).catch(()=>{us=null})),us)}function SS(e){return Em.add(e),()=>Em.delete(e)}function sf(){return NT(SS,()=>Dm,()=>Dm)}function cf(){let e=sf();return ds||lf(),{groups:[{id:"common",label:n("misc.frequentIcons"),options:af},...ds??[]],loading:!ds}}var Jp=new Map;function vS(e){let t=Jp.get(e);if(t)return t;let a=r=>{let i=sf(),l=Gi?.[e]??Rm;return BS(l,{...r})};return Jp.set(e,a),a}function Le(e){if(e===rf)return null;let t=af.find(r=>r.key===e)?.Icon;if(t)return t;let o=String(e??"");if(Gi?.[o])return Gi[o];let a=CS[o];return a||(o?(lf(),vS(o)):Rm)}function dN(e){return Le(e)??Zp}var Pm={title:"",icon:Wr,icon_color:"",manager_name:"",manager_account_seq:0,receiver_names:[],receiver_account_seqs:[],is_notice:!1,is_event:!1,is_bug:!1,visibility:"involved",visibility_group_seq:0,repeat_rule:"",repeat_until:"",bug_repro:"",bug_device:"",bug_where:"",bug_version:"",sprint_seq:0,story_points:0,event_time:"",event_place:"",event_address:"",target_names:[],target_account_seqs:[],start_date:"",due_date:"",reminders:[],priority:"medium",label_keys:[],note:"",content:"",checklist:[],tab_key:""},Om={createAttachmentFiles:[],createSubmitting:!1,attachmentUpload:null};function Yi(e){let{formId:t="taskbox-create-form",initialValues:o,onValidate:a,onSubmit:r}=e;return _S({formId:t,initialValues:{...Pm,...o},onValidate:a,onSubmit:r})}import{createContext as IS,useContext as wS,useId as DS,useLayoutEffect as uf,useMemo as df,useRef as Xi,useSyncExternalStore as ES}from"react";import{Box as RS}from"@mui/material";import{useGlobalForm as PS}from"@ehfuse/forma";var Mm=["min30_before","hour1_before","hour2_before","same_day","day_before","two_days_before","three_days_before","week_before","month_before"];function rn(e){let t=Array.isArray(e?.reminders)?e?.reminders:[e?.reminder],o=new Set;for(let a of t){let r=String(a??"").trim();Mm.includes(r)&&o.add(r)}return Mm.filter(a=>o.has(a))}function gs(e,t){if(t==="none")return[];let o=e.includes(t)?e.filter(a=>a!==t):[...e,t];return Mm.filter(a=>o.includes(a))}function Lm(e){let t=[],o=Number(e.manager_account_seq??0)||0;o>0&&t.push({account_seq:o,name:e.manager_name||"",role:"manager"});let a=e.receiver_names??[];return(e.receiver_account_seqs??[]).forEach((r,i)=>{let l=Number(r)||0;l>0&&!t.some(s=>s.account_seq===l)&&t.push({account_seq:l,name:a[i]??"",role:"receiver"})}),t}function Am(e){if(e<=0)return[];let t=Math.floor(100/e),o=100-t*e;return Array.from({length:e},(a,r)=>t+(r<o?1:0))}function mf(e){let t=Lm(e),o=e.contributions??[],a={};if(o.length>0){for(let l of t){let s=o.find(c=>Number(c.account_seq)===l.account_seq);a[String(l.account_seq)]=String(Number(s?.percent??0)||0)}return a}let r=t.some(l=>l.role==="manager"),i=Am(t.length);return t.forEach((l,s)=>{a[String(l.account_seq)]=String(r?l.role==="manager"?100:0:i[s])}),a}function xs(e){let t=String(e??"").replace(/%/g,"").trim();if(!/^\d{1,3}$/.test(t))return null;let o=Number(t);return o>=0&&o<=100?o:null}function qm(e,t){return t.reduce((o,a)=>o+(xs(e[String(a.account_seq)]??"")??0),0)}function zm(e,t){return t.map(o=>({account_seq:o.account_seq,percent:xs(e[String(o.account_seq)]??"")??0}))}import{Fragment as pf,jsx as Fm}from"react/jsx-runtime";var Va=["title","status","priority","start_date","due_date","reminders","tab_key","label_keys","note","event_time","event_place","event_address","story_points","sprint_seq","bug_repro","bug_device","bug_where","bug_version","resolution","contributions"];function Qi(e){return{title:e.title??"",status:String(e.status??""),priority:e.priority,start_date:e.start_date??"",due_date:e.due_date??"",reminders:rn(e),tab_key:String(e.tab_key??""),label_keys:e.label_keys??[],note:e.note??"",event_time:e.event_time??"",event_place:e.event_place??"",event_address:e.event_address??"",story_points:Number(e.story_points??0)||0,sprint_seq:Number(e.sprint_seq??0)||0,bug_repro:e.bug_repro??"",bug_device:e.bug_device??"",bug_where:e.bug_where??"",bug_version:e.bug_version??"",resolution:String(e.resolution??""),contributions:mf(e)}}function Nm(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,a)=>o===t[a]);if(e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)){let o=e,a=t,r=Object.keys(o);return r.length===Object.keys(a).length&&r.every(i=>o[i]===a[i])}return!1}var OS=e=>Va.includes(e);function Hm(e){let t=DS(),o=PS({formId:`taskbox-detail-form-${t}`,initialValues:Qi(e)}),a=Xi(e);a.current=e;let r=Xi(null);r.current||(r.current=Qi(e));let i=Xi(e.seq),l=Xi(new Set),{handle:s,syncField:c}=df(()=>{let u=(d,p)=>{if(l.current.has(d))return;let f=r.current,g=o.getFormValue(d),x=p[d];!Nm(g,x)&&Nm(g,f[d])&&o.setFormValue(d,x),f[d]=x};return{handle:{form:o,getTask:()=>a.current,focusField:d=>{l.current.add(d)},blurField:d=>{l.current.delete(d),OS(d)&&setTimeout(()=>u(d,Qi(a.current)),0)}},syncField:u}},[]);return uf(()=>{let u=Qi(e);if(i.current!==e.seq){i.current=e.seq,l.current.clear();for(let m of Va)Nm(o.getFormValue(m),u[m])||o.setFormValue(m,u[m]);r.current=u;return}for(let m of Va)c(m,u)},[e]),s}var Wm=IS(null);function $m(){return wS(Wm)}function $o({form:e,name:t,children:o}){let a=e.useFormValue(t);return Fm(pf,{children:o(a)})}function mr({name:e,children:t}){let o=$m();return o?Fm(RS,{component:"span","data-taskbox-field":e,onFocus:()=>o.focusField(e),onBlur:()=>o.blurField(e),sx:{display:"contents"},children:t}):Fm(pf,{children:t})}function Ji(e){let t=Xi({value:e,notified:e,listeners:new Set});return t.current.value=e,uf(()=>{let o=t.current;o.notified!==o.value&&(o.notified=o.value,o.listeners.forEach(a=>a()))}),df(()=>({get:()=>t.current.value,subscribe:o=>(t.current.listeners.add(o),()=>{t.current.listeners.delete(o)})}),[])}function bs(e){return ES(e.subscribe,e.get,e.get)}import{useGlobalFormaState as MS}from"@ehfuse/forma";var ff="taskbox-ui-state";function yn(){return MS({stateId:ff,initialValues:Om})}import{useRef as AS}from"react";import{useModal as qS}from"@ehfuse/forma";import{ErrorAlert as Vm,InfoAlert as xf}from"@ehfuse/alerts";function gf(e,t){let o=Number(t)||50,a=o*1024*1024,r=e.filter(s=>s.size>a),i=e.filter(s=>s.size<=a),l=r.length>0?n("section.attachLimit",{limitMb:o,value:r.map(s=>s.name).join(", ")}):null;return{accepted:i,rejected:r,message:l}}var Zi=[{value:"daily",get label(){return n("repeat.daily")}},{value:"weekly",get label(){return n("repeat.weekly")}},{value:"monthly",get label(){return n("repeat.monthly")}},{value:"yearly",get label(){return n("repeat.yearly")}}];function hs(e){return Zi.find(t=>t.value===e)?.label??n("common.none")}function LS(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;let t=new Date(`${e}T00:00:00`);return Number.isNaN(t.getTime())?null:t}function ks(e,t){let o=LS(e);if(!o)return"";let a=new Date(o);t==="daily"?a.setMonth(a.getMonth()+1):t==="weekly"?a.setMonth(a.getMonth()+3):t==="monthly"?a.setFullYear(a.getFullYear()+1):a.setFullYear(a.getFullYear()+3);let r=i=>String(i).padStart(2,"0");return`${a.getFullYear()}-${r(a.getMonth()+1)}-${r(a.getDate())}`}var Km="#0f9d58";function Ts(e){let t=o=>String(o).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function zS(){let e=new Date,t=o=>String(o).padStart(2,"0");return`${Ts(e)} ${t(e.getHours())}:${t(e.getMinutes())}`}var NS=10;function FS(){let e=new Date;return e.setDate(e.getDate()+1),`${Ts(e)} ${String(NS).padStart(2,"0")}:00`}function bf(e,t){let o=e?FS():zS();return t&&t<o?"":o}function Um(e,t,o){let{presetTitle:a="",presetContent:r="",presetVisibility:i,presetVisibilityGroupSeq:l=0,presetDueDate:s="",presetTabKey:c="",presetManager:u=null,isNotice:m=!1,defaultBug:d=!1}=o;e.setFormValues({...e.getFormValues(),title:a,icon:m?Dt:d?ps:Wr,icon_color:m?"#e5484d":d?fs:"",manager_name:u?.name??"",manager_account_seq:u?.accountSeq??0,receiver_names:[],receiver_account_seqs:[],is_notice:m,is_event:!1,is_bug:d,visibility:i??(d?"all":"involved"),visibility_group_seq:i==="group"?l:0,bug_repro:"",bug_device:"",bug_where:"",bug_version:"",event_time:"",event_place:"",event_address:"",target_names:[],target_account_seqs:[],start_date:bf(m,s),due_date:s,reminders:[],priority:"medium",note:"",content:r,checklist:[],tab_key:c}),t.setValue("createAttachmentFiles",[])}function hf(e){return e.title.trim()?e.is_event&&!e.due_date?(Vm(n("create.selectEventDate")),!1):e.start_date&&e.due_date&&e.due_date<e.start_date?(Vm(n("create.dueAfterStart")),!1):!0:(Vm(e.is_notice?n("create.enterNoticeTitle"):e.is_event?n("create.enterEventTitle"):e.is_bug?n("create.enterBugTitle"):n("create.enterTaskTitle")),!1)}function Gm(e,t){let o=e.getFormValue("is_bug")?"bug":e.getFormValue("is_event")?"event":"task";if(o===t)return;e.setFormValue("is_event",t==="event"),e.setFormValue("is_bug",t==="bug"),t==="event"?e.setFormValue("start_date",""):o==="event"&&!e.getFormValue("start_date")&&e.setFormValue("start_date",bf(!1,String(e.getFormValue("due_date")??""))),e.setFormValue("visibility",t==="bug"?"all":"involved"),e.setFormValue("visibility_group_seq",0),t==="bug"&&(e.setFormValue("repeat_rule",""),e.setFormValue("repeat_until",""));let a=e.getFormValue("icon"),r=e.getFormValue("icon_color"),i=[Wr,"event",ps].includes(a),l=!r||r===Km||r===fs;i&&e.setFormValue("icon",t==="event"?"event":t==="bug"?ps:Wr),l&&e.setFormValue("icon_color",t==="event"?Km:t==="bug"?fs:"")}function jm(e,t){if(t===""){e.setFormValue("repeat_rule",""),e.setFormValue("repeat_until","");return}let o;if(e.getFormValue("is_event")){if(o=String(e.getFormValue("due_date")??"").slice(0,10),!o){xf(n("create.repeatNeedsDate"));return}}else o=String(e.getFormValue("start_date")??"").slice(0,10),o||(o=Ts(new Date),e.getFormValue("is_notice")&&e.setFormValue("start_date",o)),e.setFormValue("due_date","");e.setFormValue("repeat_rule",t),e.setFormValue("repeat_until",ks(o,t))}function Ym(e,t){e.setFormValue("repeat_until",Ts(t))}function el(e,t,o=0){e.setFormValue("visibility",t),e.setFormValue("visibility_group_seq",t==="group"?o:0)}function ys(e){return e.getFormValue("checklist")??[]}function Xm(e,t){e.setFormValue("checklist",[...ys(e),{label:t,checked:!1}])}function Qm(e,t,o){e.setFormValue("checklist",ys(e).map((a,r)=>r===t?{...a,checked:o}:a))}function Jm(e,t){e.setFormValue("checklist",ys(e).filter((o,a)=>a!==t))}function Zm(e,t,o){e.setFormValue("checklist",ys(e).map((a,r)=>r===t?{...a,label:o}:a))}function eu(e,t,o){let a=gf(t,o);a.message&&xf(a.message),a.accepted.length!==0&&e.setValue("createAttachmentFiles",[...e.getValue("createAttachmentFiles")??[],...a.accepted])}function tu(e,t){let o=e.getValue("createAttachmentFiles")??[];e.setValue("createAttachmentFiles",o.filter((a,r)=>r!==t))}function HS(e){let{formId:t="taskbox-create-form",modalId:o="taskbox-create-drawer",initialValues:a}=e,r=AS(e);r.current=e;let i=yn(),l={form:qS({modalId:o})};return{form:Yi({formId:t,initialValues:a,onValidate:async c=>hf(c)?await r.current.onValidate?.(c)??!0:!1,onSubmit:async c=>{if(i.getValue("createSubmitting"))return!1;i.setValue("createSubmitting",!0);try{let u=i.getValue("createAttachmentFiles")??[];return await r.current.onSubmit(c,u)===!1?!1:(i.setValue("createAttachmentFiles",[]),l.form.close(),!0)}finally{i.setValue("createSubmitting",!1)}}}),modals:l,uiState:i,openCreate:l.form.open}}import{useCallback as WS,useEffect as ou,useId as $S,useRef as nu}from"react";import{useGlobalForm as VS}from"@ehfuse/forma";import{ConfirmDialog as kf,InfoAlert as KS,SuccessAlert as Tf}from"@ehfuse/alerts";async function ru(e,t,o){let a=e.repeat_rule??"";if(t===a)return;if(t===""){await kf({title:n("detail.stopRepeat"),message:n("detail.stopRepeatConfirm")})&&o?.(e.seq,"","");return}let r=e.is_event?String(e.due_date??"").slice(0,10):String(e.start_date??"").slice(0,10)||String(e.due_date??"").slice(0,10);if(!r){KS(e.is_event?n("create.repeatNeedsDate"):e.is_notice?n("detail.repeatNeedsPostTime"):n("detail.repeatNeedsStart"));return}a&&!await kf({title:n("detail.changeRepeat"),message:n("detail.changeRepeatConfirm")})||o?.(e.seq,t,ks(r,t))}function au(e,t,o){let a=l=>String(l).padStart(2,"0"),r=`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())}`,i=e.repeat_rule??"";i&&o?.(e.seq,i,r)}function iu(e){L();let{open:t,task:o,isMobile:a,bodyProps:r,onSaveFields:i,onChangeTitle:l,onChangeIcon:s,onChangeIconColor:c}=e,{onEditSessionEnd:u}=se(),m=nu(null);o&&(m.current=o);let d=o??m.current,p=$S(),f=VS({formId:`taskbox-detail-changes-${p}`,initialValues:{changes:{}},onSubmit:C=>F(C.changes??{})}),x=f.useFormValue("changes")??{},h=Object.keys(x).length>0;ou(()=>{f.setFormValue("changes",{})},[o?.seq,t]);let E=C=>{let y=f.getFormValue("changes")??{};f.setFormValue("changes",{...y,...C})},b=nu(null),B=WS(()=>{let C=b.current;b.current=null,C?.edited&&C.seq>0&&u?.(C.seq)},[u]),T=()=>{let C=o?.seq??m.current?.seq??0;C&&(b.current?.seq===C?b.current.edited=!0:b.current={seq:C,edited:!0})};ou(()=>{let C=o?.seq??0;if(t&&C>0){b.current?.seq!==C&&(B(),b.current={seq:C,edited:!1});return}B()},[t,o?.seq,B]);let z=nu(B);z.current=B,ou(()=>()=>z.current(),[]);let k=d&&a&&h?{...d,...x}:d,_=k?.checklist??[],D=(C,y)=>{T(),a?E(C):y()};function F(C){if(!d)return!1;f.setFormValue("changes",{});let y=d.seq,I=!!b.current?.edited;b.current&&(b.current.edited=!1),I&&y>0&&u?.(y);let S=C.title===void 0?void 0:String(C.title).trim();if(i){let M={...C};return S!==void 0&&(S?M.title=S:delete M.title),Object.keys(M).length>0&&i(y,M),Tf({message:n("detail.saved"),position:"center"}),!0}return S&&l(y,S),C.icon!==void 0&&s(y,String(C.icon)),C.icon_color!==void 0&&c?.(y,String(C.icon_color)),C.status!==void 0&&r.onChangeStatus(y,C.status),C.label_keys!==void 0&&r.onChangeLabels(y,C.label_keys??[]),C.tab_key!==void 0&&r.onChangeProject(y,String(C.tab_key??"")),C.start_date!==void 0&&r.onChangeDate(y,"start_date",String(C.start_date??"")),C.due_date!==void 0&&r.onChangeDate(y,"due_date",String(C.due_date??"")),C.reminders!==void 0&&r.onChangeReminder(y,C.reminders),C.priority!==void 0&&r.onChangePriority(y,C.priority),C.event_time!==void 0&&r.onChangeEventTime?.(y,String(C.event_time??"")),C.event_place!==void 0&&r.onChangeEventPlace?.(y,String(C.event_place??"")),C.event_address!==void 0&&r.onChangeEventAddress?.(y,String(C.event_address??"")),C.content!==void 0&&r.onChangeContent(y,String(C.content??"")),C.note!==void 0&&r.onChangeNote(y,String(C.note??"")),C.visibility!==void 0&&r.onChangeVisibility?.(y,C.visibility,Number(C.visibility_group_seq??0)),Tf({message:n("detail.saved"),position:"center"}),!0}let R={...r,onChangeStatus:(C,y)=>{let I=y==="in_progress"||y==="bug_in_progress",S=!String(k?.start_date??"").trim(),M=I&&S?{status:y,start_date:Up()}:{status:y};D(M,()=>r.onChangeStatus(C,y))},onChangeLabels:(C,y)=>D({label_keys:y},()=>r.onChangeLabels(C,y)),onChangeProject:(C,y)=>D({tab_key:y},()=>r.onChangeProject(C,y)),onChangeDate:(C,y,I)=>D({[y]:I},()=>r.onChangeDate(C,y,I)),onChangeReminder:(C,y)=>D({reminders:y},()=>r.onChangeReminder(C,y)),onChangePriority:(C,y)=>D({priority:y},()=>r.onChangePriority(C,y)),onChangeEventTime:(C,y)=>D({event_time:y},()=>r.onChangeEventTime?.(C,y)),onChangeEventPlace:(C,y)=>D({event_place:y},()=>r.onChangeEventPlace?.(C,y)),onChangeEventAddress:(C,y)=>D({event_address:y},()=>r.onChangeEventAddress?.(C,y)),onChangeContent:(C,y)=>D({content:y},()=>r.onChangeContent(C,y)),onChangeNote:(C,y)=>D({note:y},()=>r.onChangeNote(C,y)),onMemberEdit:(C,y)=>r.onMemberEdit(C,y,a?I=>E(I):null),onChangeNoteDraft:a?(C,y)=>D({note:y},()=>{}):void 0,onChangeVisibility:r.onChangeVisibility?(C,y,I)=>D({visibility:y,visibility_group_seq:I},()=>r.onChangeVisibility?.(C,y,I)):void 0,onAddChecklistItem:(C,y)=>D({checklist:[..._,{label:y,checked:!1}]},()=>r.onAddChecklistItem(C,y)),onToggleChecklistItem:(C,y,I)=>D({checklist:_.map((S,M)=>M===y?{...S,checked:I}:S)},()=>r.onToggleChecklistItem(C,y,I)),onRemoveChecklistItem:(C,y)=>D({checklist:_.filter((I,S)=>S!==y)},()=>r.onRemoveChecklistItem(C,y)),onUpdateChecklistItem:r.onUpdateChecklistItem?(C,y,I)=>D({checklist:_.map((S,M)=>M===y?{...S,label:I}:S)},()=>r.onUpdateChecklistItem?.(C,y,I)):void 0,onReorderChecklist:r.onReorderChecklist?(C,y)=>D({checklist:y},()=>r.onReorderChecklist?.(C,y)):void 0,onAddAttachments:(C,y)=>{T(),r.onAddAttachments(C,y)},onRemoveAttachment:(C,y)=>{T(),r.onRemoveAttachment(C,y)},onReorderAttachments:r.onReorderAttachments?(C,y,I)=>{T(),r.onReorderAttachments?.(C,y,I)}:void 0,onLinkChecklistTask:r.onLinkChecklistTask?(C,y,I)=>D({checklist:[..._,{label:I,checked:!1,task_seq:y}]},()=>r.onLinkChecklistTask?.(C,y,I)):void 0};return{form:f,baseTask:d,task:k,hasPendingChanges:h,stagedBodyProps:R,changeTitle:(C,y)=>D({title:y},()=>l(C,y)),changeIcon:(C,y)=>D({icon:y},()=>s(C,y)),changeIconColor:(C,y)=>D({icon_color:y},()=>c?.(C,y))}}import{useMemo as US}from"react";import{useTheme as GS}from"@mui/material";function Ka(e,t){let o=Math.max(0,Math.min(1,t));if(o<=0)return"transparent";let a=e.trim().replace("#",""),r=a.length===3?a.split("").map(c=>c+c).join(""):a;if(!/^[0-9a-fA-F]{6}$/.test(r))return e;let i=Number.parseInt(r.slice(0,2),16),l=Number.parseInt(r.slice(2,4),16),s=Number.parseInt(r.slice(4,6),16);return`rgba(${i}, ${l}, ${s}, ${o})`}function yf(e,t){let o=Math.max(0,Math.min(1,t)),a=e.trim().replace("#",""),r=a.length===3?a.split("").map(u=>u+u).join(""):a;if(!/^[0-9a-fA-F]{6}$/.test(r))return e;let i=u=>Math.round(u+(255-u)*o),l=i(Number.parseInt(r.slice(0,2),16)),s=i(Number.parseInt(r.slice(2,4),16)),c=i(Number.parseInt(r.slice(4,6),16));return`#${[l,s,c].map(u=>u.toString(16).padStart(2,"0")).join("")}`}function lu(e,t,o){return o==="dark"?{accent:e,accentContrast:t,accentSoft:"#1d2b45",accentOnSurface:"#b3d1ff",danger:"#f87171",dangerSoft:"#3a1f22",success:"#4ade80",warning:"#fbbf24",textStrong:"#ffffff",textPrimary:"#e2e8f0",textSecondary:"#a3adbb",textMuted:"#77808d",textInverse:"#0f1216",surface:"#161a1f",surfaceSubtle:"#1e232a",surfaceHover:"#272d36",surfaceHoverStrong:"#323a45",border:"#2c333c",borderStrong:"#3b434e"}:{accent:e,accentContrast:t,accentSoft:"#eef4ff",accentOnSurface:e,danger:"#e5484d",dangerSoft:"#fdebec",success:"#16a34a",warning:"#e8a33d",textStrong:"#000000",textPrimary:"#37352f",textSecondary:"#787774",textMuted:"#9a9a97",textInverse:"#ffffff",surface:"#ffffff",surfaceSubtle:"#fafaf9",surfaceHover:"#f8f8f7",surfaceHoverStrong:"#efefed",border:ee,borderStrong:ee}}function jS(e,t){let o=t==="dark";return{bg:o?yf(e.accent,.45):e.accent,color:o?e.textInverse:e.accentContrast,border:"none",fontSize:11.5,fontWeight:600,minWidth:20,width:34,borderRadius:999,paddingX:.6,paddingY:.4}}function Cf(e,t){return{...e,...t??{}}}function Cs(e,t="light"){let o=t==="dark",a=jS(e,t),r=e.accentOnSurface;return{mode:t,colors:e,table:{bg:e.surface,borderColor:e.borderStrong,headerBg:e.surface,headerColor:e.textSecondary,headerActiveColor:e.textStrong,headerFilteredColor:r,headerFontSize:13,rowBg:e.surface,rowColor:e.textPrimary,rowSubColor:e.textSecondary,rowTitleColor:e.textStrong,rowTitleFontWeight:t==="dark"?400:500,rowHoverBg:e.surfaceHover,rowBorderColor:e.border,cellHoverBg:e.surfaceHoverStrong,emptyColor:e.textMuted,groupHeader:{bg:e.surfaceSubtle,hoverBg:e.surfaceHover,borderColor:e.border,labelColor:t==="dark"?e.textStrong:e.textPrimary,labelFontSize:15.5,labelFontWeight:t==="dark"?400:700,minHeight:48,badge:{...a,borderRadius:4,width:34}}},board:{columnBg:t==="dark"?e.surfaceSubtle:e.surface,columnHeaderColor:e.textPrimary,columnHeaderFontSize:13.5,badge:{...a,borderRadius:4,width:34}},summary:{gaugeTrackColor:t==="dark"?e.borderStrong:"#ececea",gaugeBarColor:r,gaugeCompleteColor:e.success,gaugeHeight:6,numberColor:r,overdueColor:e.danger,textColor:e.textStrong},actionButton:{bg:"#2f80ed",color:"#ffffff",hoverBg:"#2470dd",bgImage:"linear-gradient(180deg, #5ba1f5 0%, #2f80ed 100%)",hoverBgImage:"linear-gradient(180deg, #4d95ee 0%, #2470dd 100%)"},tabs:{bg:t==="dark"?e.surfaceSubtle:e.surface,color:t==="dark"?e.textSecondary:e.textStrong,hoverBg:e.surfaceHover,borderColor:t==="dark"?e.border:e.borderStrong,selectedBg:t==="dark"?e.surfaceHover:e.textStrong,selectedColor:t==="dark"?e.textStrong:e.surface},calendar:{bg:e.surface,borderColor:o?"#3a434f":e.border,headerBg:e.surfaceSubtle,headerColor:e.textSecondary,cellBg:o?"#1a1e24":e.surface,dateBandBg:e.surface,otherMonthBg:o?"#1a1e24":e.surface,todayBg:e.accentSoft,hoverBg:e.surfaceHover,dateColor:e.textPrimary,holidayColor:e.danger},card:{bg:o?"#232a33":e.surface,borderColor:o?"#333c47":e.border,hoverBg:o?"#2b3441":e.surfaceHover,titleColor:e.textPrimary,subColor:e.textSecondary},timeline:{bg:e.surface,gridColor:e.border,headerBg:e.surfaceSubtle,headerColor:e.textSecondary,todayLineColor:e.accentOnSurface,barColor:e.accentOnSurface,overdueBarColor:e.danger},avatar:{ringColor:t==="dark"?e.textStrong:e.accent,separatorColor:e.surface},chip:{borderRadius:.75,fontSize:13,fontWeight:500,plainColor:t==="dark"?e.textSecondary:"#57564f",plainDotColor:e.textMuted,darkBgAlpha:.15,darkTextSource:"dot"}}}function su(e,t){if(!t)return e;let o=t.mode??e.mode,r={...o===e.mode?e.colors:lu(e.colors.accent,e.colors.accentContrast,o),...t.colors??{}},i=Cs(r,o),{groupHeader:l,...s}=t.table??{},{badge:c,...u}=t.board??{},{badge:m,...d}=l??{};return{mode:o,colors:r,table:{...i.table,...s,groupHeader:{...i.table.groupHeader,...d,badge:Cf(i.table.groupHeader.badge,m)}},board:{...i.board,...u,badge:Cf(i.board.badge,c)},summary:{...i.summary,...t.summary??{}},chip:{...i.chip,...t.chip??{}},actionButton:{...i.actionButton,...t.actionButton??{}},tabs:{...i.tabs,...t.tabs??{}},avatar:{...i.avatar,...t.avatar??{}},calendar:{...i.calendar,...t.calendar??{}},card:{...i.card,...t.card??{}},timeline:{...i.timeline,...t.timeline??{}}}}function YS(e={}){let{mode:t="light",accent:o="#2563eb",accentContrast:a="#ffffff",input:r}=e;return su(Cs(lu(o,a,t),t),r)}function be(){let e=GS(),{theme:t}=se(),o=e.palette.primary.main,a=e.palette.primary.contrastText,r=e.palette.mode==="dark"?"dark":"light";return US(()=>su(Cs(lu(o,a,r),r),t),[o,a,r,t])}import{useCallback as ao,useMemo as io,useRef as iB,useState as Qr}from"react";import{Box as lB,Divider as sB,ListItemIcon as cB,Menu as fg,MenuItem as Qs}from"@mui/material";import mB from"@mui/icons-material/Add";import qu from"@mui/icons-material/Check";import uB from"@mui/icons-material/InboxOutlined";import{VirtualDataTable as dB}from"@ehfuse/mui-virtual-data-table";import{Box as cu}from"@mui/material";import{jsx as Sf,jsxs as QS}from"react/jsx-runtime";var XS={high:{get label(){return n("priority.high")},dot:"#e5484d",bgcolor:"#fdebec",color:"#c4554d"},medium:{get label(){return n("priority.medium")},dot:"#2f80ed",bgcolor:"#e3eefb",color:"#1d4f91"},low:{get label(){return n("priority.low")},dot:"#9a9a97",bgcolor:"#efefed",color:"#57564f"}};function po({priority:e,small:t=!1,plain:o=!1,dotOnly:a=!1}){L();let r=XS[e];if(a)return Sf(cu,{component:"span",role:"img","aria-label":n("menu.priorityLabel",{label:r.label}),title:n("menu.priorityLabel",{label:r.label}),sx:{display:"inline-block",flexShrink:0,width:10,height:10,borderRadius:"50%",bgcolor:r.dot}});let i=be(),l=i.mode==="dark",s=o||e==="low";return QS(cu,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:t?.5:.75,px:s?0:t?.9:1.25,py:s?0:t?.25:.5,borderRadius:.75,fontSize:t?11.5:13,fontWeight:500,bgcolor:s?"transparent":l?Ka(r.dot,i.chip.darkBgAlpha):r.bgcolor,color:s?l?i.chip.plainColor:r.color:l?i.chip.darkTextSource==="fg"?r.color:r.dot:r.color,whiteSpace:"nowrap"},children:[Sf(cu,{component:"span",sx:{width:t?6:8,height:t?6:8,borderRadius:"50%",bgcolor:r.dot}}),r.label]})}import{Divider as o0,Menu as n0,MenuItem as wf}from"@mui/material";import r0 from"@mui/icons-material/Check";function Fn(){return{}}var mu=[{key:"always",get name(){return n("bug.reproAlways")}},{key:"often",get name(){return n("bug.reproOften")}},{key:"sometimes",get name(){return n("bug.reproSometimes")}},{key:"once",get name(){return n("bug.reproOnce")}},{key:"unable",get name(){return n("bug.reproUnable")}}],uu=[{key:"desktop",get name(){return n("bug.deviceDesktop")}},{key:"tablet",get name(){return n("bug.deviceTablet")}},{key:"mobile",get name(){return n("bug.deviceMobile")}}],du=[{key:"fixed",get name(){return n("bug.resFixed")}},{key:"duplicate",get name(){return n("section.duplicate")}},{key:"cannot_reproduce",get name(){return n("bug.reproUnable")}},{key:"by_design",get name(){return n("bug.resByDesign")}},{key:"wont_fix",get name(){return n("bug.resWontFix")}}];function vf(e){return mu.find(t=>t.key===e)?.name??""}function Bf(e){return uu.find(t=>t.key===e)?.name??""}function Ss(e){return du.find(t=>t.key===e)?.name??""}function pu(e,t=new Date){if(!e.is_event)return!1;let o=String(e.due_date??"").trim().slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(o))return!1;let a=String(e.event_time??"").trim();if(/^\d{2}:\d{2}$/.test(a)){let i=new Date(`${o}T${a}:00`);return!Number.isNaN(i.getTime())&&i.getTime()<=t.getTime()}let r=new Date(`${o}T00:00:00`);return Number.isNaN(r.getTime())?!1:(r.setDate(r.getDate()+1),r.getTime()<=t.getTime())}function vs(e,t=new Date){return e.is_event?pu(e,t):!!e.completed}var Mo=[{key:"not_started",get name(){return n("status.notStarted")},bg:"#efefed",fg:"#57564f",dot:"#9a9a97"},{key:"in_progress",get name(){return n("status.inProgress")},bg:"#dcf2e3",fg:"#1f6b3a",dot:"#2f9e5b"},{key:"review_waiting",get name(){return n("status.reviewWaiting")},bg:"#ede9fe",fg:"#5b3fa8",dot:"#8b5cf6"},{key:"hold",get name(){return n("status.hold")},bg:"#fbeee0",fg:"#8a5a2b",dot:"#d9730d"}],nl=Mo;function Bs(e){return Mo.find(t=>t.key===e)??Mo[0]}var tl={key:"completed",get name(){return n("common.done")},bg:"#e3eefb",fg:"#1d4f91",dot:"#2f80ed"};function Ft(e){if(e.is_notice)return _f(e.status);if(e.is_bug&&e.completed){let t=Ss(e.resolution)||n("common.done");return{...tl,name:t}}return e.completed&&e.status!=="hold"?tl:e.is_bug?ZS(e.status):Bs(e.status)}var JS={key:"event_ended",get name(){return n("status.closedBug")},bg:"#efefed",fg:"#57564f",dot:"#9a9a97"};function rl(e){return pu(e)?JS:null}var ol=[{key:"notice_scheduled",get name(){return n("status.noticeScheduled")},bg:"#faf1d7",fg:"#8a6d1d",dot:"#e8a33d"},{key:"notice_active",get name(){return n("status.noticeActive")},bg:"#dcf2e3",fg:"#1f6b3a",dot:"#2f9e5b"},{key:"notice_closed",get name(){return n("status.closedBug")},bg:"#efefed",fg:"#57564f",dot:"#9a9a97"}];function _f(e){return ol.find(t=>t.key===e)??ol[1]}var fu="__closed__",xa=[{key:"bug_received",get name(){return n("status.bugReceived")},bg:"#fdeaea",fg:"#9b2c2c",dot:"#e53e3e"},{key:"bug_confirmed",get name(){return n("status.bugConfirmed")},bg:"#faf1d7",fg:"#8a6d1d",dot:"#e8a33d"},{key:"bug_in_progress",get name(){return n("status.inProgress")},bg:"#dcf2e3",fg:"#1f6b3a",dot:"#2f9e5b"},{key:"bug_hold",get name(){return n("status.hold")},bg:"#efefed",fg:"#57564f",dot:"#9a9a97"}],CF=[...xa.filter(e=>e.key!=="bug_hold"),{key:fu,get name(){return n("common.done")},bg:"#e3eefb",fg:"#1d4f91",dot:"#2f80ed"},...xa.filter(e=>e.key==="bug_hold")];function ZS(e){return xa.find(t=>t.key===e)??xa[0]}function _s(e){return e.is_notice?ol:e.is_bug?xa:nl}function SF(e){return e.status===Yp}var e0={in_progress:0,not_started:2,hold:3};function vF(e){return e.completed?9:e0[String(e.status??"")]??2}function Ua(e,t){let o=new Map(t.map(r=>[r.key,r])),a=(e.label_keys??[]).map(r=>o.get(r)).filter(r=>!!r);if(e.is_event){let r=rl({is_event:!0,due_date:String(e.due_date??""),event_time:e.event_time});return r?[r,...a]:a}return e.is_notice?String(e.status??"")==="notice_active"?a:[_f(e.status),...a]:e.is_bug?[Ft({...e,is_notice:!1}),...a]:e.completed?[tl,...a]:[Bs(e.status),...a]}function If(e){return{bg:`${e}1f`,fg:e,dot:e}}function Is(e,t){return e.includes(t)?e.filter(o=>o!==t):[...e,t]}import{Box as ws}from"@mui/material";import{jsx as al,jsxs as t0}from"react/jsx-runtime";function Ke({option:e,small:t=!1}){let o=be(),a=o.mode==="dark",r=e.key==="not_started";return t0(ws,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:t?.5:.75,...r?{pr:t?.5:.75}:{px:t?.9:1.25},py:r?0:t?.25:.5,borderRadius:1.25,fontSize:t?11.5:13,fontWeight:500,bgcolor:r?"transparent":a?Ka(e.dot,o.chip.darkBgAlpha):e.bg,color:r?a?o.chip.plainColor:e.fg:a?o.chip.darkTextSource==="fg"?e.fg:e.dot:e.fg,whiteSpace:"nowrap"},children:[al(ws,{component:"span",sx:{width:t?6:8,height:t?6:8,borderRadius:"50%",bgcolor:e.dot,flexShrink:0}}),e.name]})}function EF({task:e,statusOptions:t,small:o=!1}){let a=Ua(e,t);return a.length===0?null:al(ws,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5},children:a.map(r=>al(Ke,{option:r,small:o},r.key))})}function $r({labelKeys:e,labelOptions:t}){let o=new Map(t.map(r=>[r.key,r])),a=e.map(r=>o.get(r)).filter(r=>!!r);return a.length===0?null:al(ws,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5},children:a.map(r=>al(Ke,{option:r,small:!0},r.key))})}import{jsx as il,jsxs as Df}from"react/jsx-runtime";function Ga({anchorEl:e,value:t,options:o=Mo,onSelect:a,onComplete:r,onClose:i}){let l=Fn();return Df(n0,{anchorEl:e,open:!!e,onClose:i,transitionDuration:0,...l,children:[o.map(s=>Df(wf,{onClick:()=>{a(s.key),i()},sx:{fontSize:14,minWidth:150,gap:1},children:[il(Ke,{option:s}),t===s.key?il(r0,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},s.key)),r?[il(o0,{sx:{my:.5}},"complete-divider"),il(wf,{onClick:()=>{r(),i()},sx:{fontSize:14,minWidth:150,gap:1},children:il(Ke,{option:tl})},"complete")]:null]})}var Ef="";function HF(e){Ef=e.trim()}function ja(){return Ef||n("task.noProject")}function Ds(e){let t=String(e??"").trim().replace("T"," "),o=t.match(/^(\d{4})-(\d{2})-(\d{2})(?:[ ](\d{2}):(\d{2})(?::(\d{2}))?)?/);return o?new Date(Number(o[1]),Number(o[2])-1,Number(o[3]),Number(o[4]??0),Number(o[5]??0),Number(o[6]??0)):new Date(t)}function Et(e,t="YYYY-MM-DD"){let o=typeof e=="string"?Ds(e):e;if(!e||e===""||isNaN(o.getTime()))return"";let a=o.getFullYear(),r=(o.getMonth()+1).toString().padStart(2,"0"),i=o.getDate().toString().padStart(2,"0"),l=a.toString().slice(-2);switch(t){case"YYYY-MM-DD":return`${a}-${r}-${i}`;case"YY.MM.DD":return`${l}.${r}.${i}`;case"MM/DD/YYYY":return`${r}/${i}/${a}`;case"DD.MM.YYYY":return`${i}.${r}.${a}`;case"YYYYMMDD":return`${a}${r}${i}`;default:return t.replace(/YYYY/g,a.toString()).replace(/YY/g,l).replace(/MM/g,r).replace(/DD/g,i)}}function Rf(){return Et(new Date)}var gu=[{value:"due",get label(){return n("group.byDue")}},{value:"status",get label(){return n("group.byStatus")}},{value:"manager",get label(){return n("group.byOwner")}},{value:"tab",get label(){return n("group.byProject")}},{value:"none",get label(){return n("group.none")}}],a0="__notice__",i0="__bug__",l0="__support__";function s0(e){let t=new Date(`${e}T00:00:00`);return t.setDate(t.getDate()+(6-t.getDay())),Et(t)}var c0=[{key:"overdue",get label(){return n("group.overdue")}},{key:"today",get label(){return n("common.today")}},{key:"this_week",get label(){return n("group.thisWeek")}},{key:"later",get label(){return n("group.later")}},{key:"no_due",get label(){return n("group.noDue")}}];function m0(e,t,o){let a=e.due_date.slice(0,10);return a?a<t?"overdue":a===t?"today":a<=o?"this_week":"later":"no_due"}function u0(e){return typeof e=="function"?e:t=>t.is_bug?"bug":t.is_support?"support":null}function Es(e,t,o,a=[],r=[],i="",l,s=!1){let c=e.filter(f=>f.is_notice);if(c.length>0){let f=Es(e.filter(g=>!g.is_notice),t,o,a,r,i,l,s);return[{key:a0,label:n("tab.notice"),tasks:c},...f]}if(s){let f=u0(s),g=e.filter(h=>f(h)==="bug"),x=e.filter(h=>f(h)==="support");if(g.length>0||x.length>0){let h=Es(e.filter(E=>f(E)===null),t,o,a,r,i,l,!1);return[...g.length>0?[{key:i0,label:n("tab.bug"),tasks:g}]:[],...x.length>0?[{key:l0,label:n("tab.support"),tasks:x}]:[],...h]}}let u=new Map,m=(f,g)=>{let x=u.get(f);x?x.push(g):u.set(f,[g])},d;if(t==="due"){let f=s0(o);for(let g of e)m(m0(g,o,f),g);d=c0}else if(t==="status"){for(let f of e)m(Bs(f.status).key,f);d=Mo.map(f=>({key:f.key,label:f.name}))}else if(t==="tab"){for(let f of e)m(f.tab_key?.trim()||"__none__",f);d=[...a.filter(f=>!f.archived).map(f=>({key:f.key,label:f.label})),{key:"__none__",label:ja()},...a.filter(f=>f.archived).map(f=>({key:f.key,label:n("table.archivedSuffix",{label:f.label})}))]}else if(l?.enabled){let f=Number(l.myAccountSeq??0),g=i.trim();for(let x of e){if(x.is_event){m("__event__",x);continue}if(!(Number(x.manager_account_seq??0)>0||String(x.manager_name??"").trim()!=="")){m("__none__",x);continue}let E=f>0&&Number(x.manager_account_seq??0)===f||!!g&&String(x.manager_name??"").trim()===g;m(E?"__manager__":"__reference__",x)}d=[{key:"__manager__",label:n("col.owner")},{key:"__none__",label:l?.unassignedLabel||n("group.personal")},{key:"__event__",label:n("group.event")},{key:"__reference__",label:n("col.cc")}]}else{let f=i.trim(),g=Number(l?.myAccountSeq??0),x=B=>g>0&&(B.receiver_account_seqs??[]).map(Number).includes(g)||!!f&&(B.receiver_names??[]).some(T=>String(T??"").trim()===f);for(let B of e){let T=String(B.manager_name??"").trim(),z=g>0&&Number(B.manager_account_seq??0)===g||!!f&&T===f;B.is_event?m("__event__",B):z?m(f||T,B):T&&x(B)?m("__reference__",B):m(T||"__none__",B)}let h=[...u.keys()].filter(B=>B!=="__none__"&&B!=="__event__"&&B!=="__reference__").sort((B,T)=>{if(f){if(B===f)return-1;if(T===f)return 1}return B.localeCompare(T)}),E=!!f&&h.includes(f),b=h.filter(B=>B!==f);d=[...E?[{key:f,label:n("col.owner")}]:[],{key:"__reference__",label:n("col.cc")},{key:"__none__",label:l?.unassignedLabel||n("group.personal")},{key:"__event__",label:n("group.event")},...b.map(B=>({key:B,label:B}))]}let p=[];for(let f of d){let g=u.get(f.key);!g||g.length===0||p.push({key:f.key,label:f.label,tasks:g})}return p}import{ConfirmActionPopper as pB}from"@ehfuse/mui-confirm-action";import{useEffect as d0,useState as p0}from"react";import{Box as f0,TextField as g0}from"@mui/material";import{ConfirmActionPopper as x0}from"@ehfuse/mui-confirm-action";import{jsx as xu}from"react/jsx-runtime";function no(e,t){if(!e.completed||t<=0||!e.review_pending||(e.author_account_seq??0)!==t)return!1;let o=e.completed_by_account??0;return o>0&&o!==t}function Lo({open:e,anchorEl:t,nextCompleted:o,returnMode:a=!1,onCancel:r,onConfirm:i}){L();let[l,s]=p0("");d0(()=>{e&&s("")},[e]);let c=!o&&a;return xu(x0,{open:e,anchorEl:t,title:c?n("task.returnConfirm"):o?n("task.completeConfirm"):n("task.uncompleteConfirm"),confirmText:c?n("task.revert"):o?n("common.done"):n("task.unmark"),content:c?xu(f0,{sx:{mt:1},children:xu(g0,{autoFocus:!0,fullWidth:!0,multiline:!0,minRows:4,size:"small",placeholder:n("task.returnReasonPlaceholder"),value:l,onChange:u=>s(u.target.value),onClick:u=>u.stopPropagation(),onKeyDown:u=>u.stopPropagation()})}):void 0,onCancel:r,onConfirm:()=>{c&&!l.trim()||i(c?l.trim():"")}})}import{useTimePickerVariant as k0}from"@ehfuse/mui-form-controls";import{useMemo as Pf,useState as bu}from"react";import{Box as Vr,Button as Of,ButtonBase as Mf,Dialog as T0,Divider as Rs,Menu as y0,MenuItem as C0,Popover as S0}from"@mui/material";import Lf from"@mui/icons-material/ChevronRight";import v0 from"@mui/icons-material/Check";import B0 from"@mui/icons-material/NotificationsActiveOutlined";import{SimpleCalendar as _0,TimePicker as I0,WheelTimeSelector as w0}from"@ehfuse/mui-datetime-picker";import D0 from"@mui/icons-material/TimerOutlined";import{useEffect as b0,useState as h0}from"react";function Hn(e){let{loadHolidays:t}=se(),[o,a]=h0(()=>new Map),r=e.join(",");return b0(()=>{if(!t||!r){a(new Map);return}let i=!1;return t(r.split(",").map(Number)).then(l=>{if(i)return;let s=new Map;for(let c of l)s.has(c.date)||s.set(c.date,c.name);a(s)}).catch(()=>{}),()=>{i=!0}},[t,r]),o}import{Fragment as hu,jsx as Ut,jsxs as an}from"react/jsx-runtime";var E0=9,R0=[{value:"min30_before",get label(){return n("reminder.min30")}},{value:"hour1_before",get label(){return n("reminder.hour1")}},{value:"hour2_before",get label(){return n("reminder.hour2")}}],Af=[{value:"day_before",get label(){return n("reminder.day1")}},{value:"two_days_before",get label(){return n("reminder.day2")}},{value:"three_days_before",get label(){return n("reminder.day3")}},{value:"week_before",get label(){return n("reminder.week1")}},{value:"month_before",get label(){return n("reminder.month1")}}],qf=[{value:"none",get label(){return n("common.none")}},...R0,...Af];function ku(e){return e?qf:[{value:"none",label:n("common.none")},...Af]}function P0(e){return e==="same_day"?n("reminder.sameDay"):qf.find(t=>t.value===e)?.label??n("common.none")}function Tu(e){if(e.length===0)return n("common.none");let t=e.map(o=>P0(o));return t.length<=3?t.join(", "):n("reminder.andMore",{value:t.slice(0,3).join(", "),value2:t.length-3})}function O0(e){let t=e?new Date(`${e}T00:00:00`):new Date;return Number.isNaN(t.getTime())?new Date:t}function ln({anchorEl:e,open:t,date:o,reminders:a,hideReminder:r=!1,showTime:i=!1,autoFillTime:l=!0,centered:s=!1,onClose:c,onDateChange:u,onReminderChange:m}){L();let[d,p]=bu(null),f=k0(void 0),[g,x]=bu(null),h=Fn(),E=String(o??"").trim().slice(0,10),b=String(o??"").trim().slice(11,16),B=/^\d{2}:\d{2}$/.test(b)?b:"",T=(S,M)=>u(M?`${S} ${M}`:S),{defaultDueHour:z}=se(),k=`${String(Number.isInteger(z)&&z>=0&&z<=23?z:E0).padStart(2,"0")}:00`,_=S=>{if(B)return B;if(!l)return"";let M=new Date;return S===Et(M)?`${String(M.getHours()).padStart(2,"0")}:${String(M.getMinutes()).padStart(2,"0")}`:k},[D,F]=bu(()=>{let S=Number(E.slice(0,4));return Number.isFinite(S)&&S>1900?S:new Date().getFullYear()}),R=Pf(()=>[D-1,D,D+1],[D]),C=Hn(R),y=Pf(()=>{let S=[];for(let M of C.keys()){let w=new Date(`${M}T00:00:00`);Number.isNaN(w.getTime())||S.push(w)}return S},[C]),I=an(Vr,{sx:{width:300,maxWidth:"100%"},children:[Ut(Vr,{sx:{height:320},children:Ut(_0,{selectedDate:O0(E),onSelect:S=>{T(Et(S),i?_(Et(S)):B),i||c()},onClose:c,showFooter:!1,autoApply:!0,holidays:y,onYearChange:S=>F(S),onMonthChange:(S,M)=>{typeof M=="number"&&F(M)}})}),i&&f==="wheel"?an(hu,{children:[Ut(Rs,{sx:{borderColor:ee}}),Ut(Vr,{sx:{py:1},children:Ut(w0,{value:{hour:B.slice(0,2)||k.slice(0,2),minute:B.slice(3,5)||"00"},format:"HH:mm",minuteStep:5,locale:Nn(),onChange:(S,M)=>{T(E||Et(new Date),`${String(S).padStart(2,"0")}:${String(M).padStart(2,"0")}`)}})})]}):i?an(hu,{children:[Ut(Rs,{sx:{borderColor:ee}}),an(Mf,{onClick:S=>x(S.currentTarget),sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1.25,fontSize:14,"&:hover":{bgcolor:"#f8f8f7"}},children:[an(Vr,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75,color:"#37352f"},children:[Ut(D0,{sx:{fontSize:17,color:"#9a9a97"}}),n("calendar.time")]}),an(Vr,{component:"span",sx:{display:"inline-flex",alignItems:"center",color:"#37352f"},children:[B||n("common.none"),Ut(Lf,{sx:{fontSize:18,ml:.25,color:"#9a9a97"}})]})]}),Ut(I0,{timeVariant:f,anchorEl:g,open:!!g,onClose:()=>x(null),centered:s,value:{hour:B.slice(0,2)||k.slice(0,2),minute:B.slice(3,5)||"00"},format:"HH:mm",minuteStep:5,autoApply:!0,locale:Nn(),onChange:(S,M)=>{T(E||Et(new Date),`${S}:${M}`),x(null)}})]}):null,r?null:an(hu,{children:[Ut(Rs,{sx:{borderColor:ee}}),an(Mf,{onClick:S=>p(S.currentTarget),sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1.25,fontSize:14,"&:hover":{bgcolor:"#f8f8f7"}},children:[an(Vr,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75,color:"#37352f"},children:[Ut(B0,{sx:{fontSize:17,color:"#9a9a97"}}),n("reminder.title")]}),an(Vr,{component:"span",sx:{display:"inline-flex",alignItems:"center",color:"#37352f"},children:[Tu(a),Ut(Lf,{sx:{fontSize:18,ml:.25,color:"#9a9a97"}})]})]}),Ut(y0,{transitionDuration:0,anchorEl:d,open:!!d,onClose:()=>p(null),anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},...h,children:ku(!!B).map(S=>{let M=S.value==="none"?a.length===0:a.includes(S.value);return an(C0,{selected:M,onClick:()=>{m(gs(a,S.value)),S.value==="none"&&p(null)},sx:{fontSize:14,minWidth:140,justifyContent:"space-between",gap:1},children:[S.label,M?Ut(v0,{sx:{fontSize:16,color:"#2f80ed"}}):null]},S.value)})})]}),Ut(Rs,{sx:{borderColor:ee}}),an(Vr,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:1,py:.5},children:[Ut(Of,{size:"small",onClick:()=>{T(Et(new Date),i?_(Et(new Date)):B),c()},sx:{minWidth:0,px:1.25,fontSize:13.5,color:"#2563eb"},children:n("common.today")}),Ut(Of,{size:"small",onClick:c,sx:{minWidth:0,px:1.25,fontSize:13.5,color:"#2563eb"},children:n("common.close")})]})]});return s?Ut(T0,{open:t,onClose:c,slotProps:{paper:{sx:{borderRadius:3,width:300,maxWidth:"calc(100vw - 48px)",overflow:"hidden"}}},children:I}):Ut(S0,{transitionDuration:0,open:t,anchorEl:e,onClose:c,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{borderRadius:2,boxShadow:"0 8px 24px rgba(0,0,0,0.14)"}}},children:I})}import{Box as ba,Button as G0}from"@mui/material";import{FormDialog as j0}from"@ehfuse/mui-form-dialog";import{ClearTextField as Y0,Switch as X0}from"@ehfuse/mui-form-controls";import{useMemo as M0,useState as L0}from"react";import{Box as ll,ButtonBase as A0,InputBase as q0,Tooltip as z0,Typography as zf}from"@mui/material";import N0 from"@mui/icons-material/Search";import F0 from"@ehfuse/overlay-scrollbar";import{Fragment as H0,jsx as Cn,jsxs as sl}from"react/jsx-runtime";function Nf({iconKey:e,Icon:t,selected:o,onChange:a}){return Cn(z0,{title:e,placement:"top",arrow:!0,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Cn(A0,{onClick:()=>a(e),"aria-label":e,sx:{display:"flex",alignItems:"center",justifyContent:"center",height:40,minWidth:0,borderRadius:1,border:o?"2px solid #2563eb":`1px solid ${ee}`,bgcolor:o?"#eef4ff":"#fff",color:o?"#1e3a8a":"#787774","&:hover":{bgcolor:o?"#eef4ff":"#f4f4f2"}},children:Cn(t,{sx:{fontSize:20}})})})}function Ps({value:e,onChange:t,maxHeight:o=360}){L();let[a,r]=L0(""),{groups:i}=cf(),l=a.trim().toLowerCase(),s=M0(()=>{if(!l)return null;let c=new Set,u=[];for(let m of i)for(let d of m.options)c.has(d.key)||!d.key.toLowerCase().includes(l)||(c.add(d.key),u.push(d));return u},[l,i]);return sl(ll,{sx:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[sl(ll,{sx:{display:"flex",alignItems:"center",gap:1,px:1.25,height:44,borderRadius:1,border:`1px solid ${ee}`,bgcolor:"#fff"},children:[Cn(N0,{sx:{fontSize:20,color:"#9b9a97"}}),Cn(q0,{value:a,onChange:c=>r(c.target.value),placeholder:n("menu.iconSearchPlaceholder"),autoFocus:!0,sx:{flex:1,fontSize:15},inputProps:{"aria-label":n("menu.iconSearch")}})]}),sl(F0,{style:{maxHeight:o},contentStyle:{minWidth:0,paddingRight:4},thumb:{width:6},children:[s&&sl(H0,{children:[Cn(zf,{sx:{fontSize:12,color:"#9b9a97"},children:s.length>0?n("menu.iconSearchResults",{length:s.length}):n("menu.iconNotFound")}),Cn(ll,{sx:{display:"grid",gridTemplateColumns:"repeat(10, minmax(0, 1fr))",gap:.5},children:s.map(({key:c,Icon:u})=>Cn(Nf,{iconKey:c,Icon:u,selected:c===e,onChange:t},c))})]}),!s&&i.map((c,u)=>sl(ll,{sx:{contentVisibility:"auto",containIntrinsicSize:`${42+Math.ceil(c.options.length/10)*44}px`},children:[Cn(zf,{sx:{fontSize:13,fontWeight:700,color:"#1d4ed8",mt:u===0?0:2,pb:.5},children:c.label}),Cn(ll,{sx:{display:"grid",gridTemplateColumns:"repeat(10, minmax(0, 1fr))",gap:.5},children:c.options.map(({key:m,Icon:d})=>Cn(Nf,{iconKey:m,Icon:d,selected:m===e,onChange:t},m))})]},c.id))]})]})}import{useGlobalForm as K0}from"@ehfuse/forma";import{ErrorAlert as U0}from"@ehfuse/alerts";import{useEffect as W0,useId as $0,useRef as Os}from"react";import{useModal as V0}from"@ehfuse/forma";function Ie(e){return`${e}-${$0()}`}function ro({modalIdPrefix:e,open:t,onClose:o,onOpen:a}){let r=Os(o);r.current=o;let i=Os(a);i.current=a;let l=V0({modalId:Ie(e),onClose:()=>r.current()}),s=Os(l);s.current=l;let c=Os(!1);return W0(()=>{t&&!c.current?(i.current?.(),s.current.open()):!t&&c.current&&s.current.isOpen&&s.current.close(),c.current=t},[t]),l}function Ff({open:e,initialLabel:t="",initialIcon:o=ji,initialUseSprints:a=!1,onClose:r,onSubmit:i}){L();let l=K0({formId:Ie("taskbox-add-tab-form"),initialValues:{label:"",icon:ji,useSprints:!1},onValidate:c=>String(c.label??"").trim()?!0:(U0(n("dialog.enterProjectName")),!1),onSubmit:c=>(i(String(c.label).trim(),c.icon,!!c.useSprints),s.form.close(),!0)}),s={form:ro({modalIdPrefix:"taskbox-add-tab-dialog",open:e,onClose:r,onOpen:()=>l.setFormValues({label:t,icon:o,useSprints:a})})};return{form:l,modals:s}}import{jsx as ur,jsxs as yu}from"react/jsx-runtime";function Ms({open:e,title:t=n("dialog.addProjectTitle"),initialLabel:o="",initialIcon:a=ji,confirmText:r=n("common.add"),initialUseSprints:i=!1,onClose:l,onSubmit:s}){L();let{form:c,modals:u}=Ff({open:e,initialLabel:o,initialIcon:a,initialUseSprints:i,onClose:l,onSubmit:s}),m=String(c.useFormValue("icon")??""),d=yu(ba,{children:[ur(Y0,{form:c,name:"label",label:n("dialog.projectName"),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),c.submit())},fullWidth:!0,autoFocus:!0,sx:{mt:.5}}),ur(ba,{sx:{mt:2,fontSize:13,color:"#787774"},children:n("dialog.icon")}),ur(ba,{sx:{mt:1},children:ur(Ps,{value:m,onChange:p=>c.setFormValue("icon",p),maxHeight:264})}),yu(ba,{sx:{mt:2,display:"flex",alignItems:"center",justifyContent:"space-between",gap:1},children:[yu(ba,{children:[ur(ba,{sx:{fontSize:14,color:"#37352f"},children:n("dialog.useGoals")}),ur(ba,{sx:{fontSize:12.5,color:"#9a9a97"},children:n("dialog.useGoalsHint")})]}),ur(X0,{form:c,name:"useSprints"})]})]});return ur(j0,{open:u.form.isOpen,onClose:u.form.close,maxWidth:"xs",title:t,locale:Se(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-add-tab",sections:[{id:"add-tab",showTitle:!1,children:d}],actions:{showCancelButton:!0,right:ur(G0,{variant:"contained",onClick:()=>{c.submit()},children:r})}})}import{Box as Ls,ButtonBase as Q0,Divider as J0,Popover as Z0}from"@mui/material";import ev from"@mui/icons-material/Check";import{jsx as ha,jsxs as Hf}from"react/jsx-runtime";var Cu=["#1e3a8a","#2f80ed","#06b6d4","#0fa3a3","#2f9e5b","#84cc16","#e8a33d","#d9730d","#e5484d","#e255a1","#a355c0","#8a5a2b","#57564f","#111827"];function Kr({anchorEl:e,value:t,color:o="",onSelect:a,onSelectColor:r,onClose:i}){return L(),ha(Z0,{transitionDuration:0,open:!!e,anchorEl:e,onClose:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},marginThreshold:16,slotProps:{paper:{sx:{mt:1,maxHeight:"calc(100dvh - 96px)"}}},children:Hf(Ls,{sx:{width:"min(492px, calc(100vw - 32px))"},children:[ha(Ls,{sx:{p:1.25},children:ha(Ps,{value:t||Wr,maxHeight:"min(432px, calc(100dvh - 300px))",onChange:l=>{a(l),i()}})}),r?Hf(Ls,{sx:{px:1.25,pb:1.25},children:[ha(J0,{sx:{mb:1,borderColor:"#efefed"}}),ha(Ls,{sx:{display:"grid",gridTemplateColumns:`repeat(${Cu.length}, 1fr)`,justifyItems:"center"},children:Cu.map(l=>{let s=(o||Cu[0])===l;return ha(Q0,{"aria-label":n("menu.iconColor",{hex:l}),onClick:()=>r(l),sx:{width:"100%",maxWidth:26,aspectRatio:"1 / 1",borderRadius:"50%",bgcolor:l,display:"flex",alignItems:"center",justifyContent:"center"},children:s?ha(ev,{sx:{fontSize:15,color:"#ffffff"}}):null},l)})})]}):null]})})}import tv from"@mui/icons-material/LabelOutlined";import ov from"@mui/icons-material/NotesOutlined";import nv from"@mui/icons-material/AutorenewOutlined";import rv from"@mui/icons-material/CalendarTodayOutlined";import av from"@mui/icons-material/EventOutlined";import Wf from"@mui/icons-material/PersonOutlineOutlined";import $f from"@mui/icons-material/PeopleAltOutlined";import Bu from"@mui/icons-material/CheckCircleOutlineOutlined";import iv from"@mui/icons-material/FlagOutlined";import _u from"@mui/icons-material/AccessTimeOutlined";import lv from"@mui/icons-material/StickyNote2Outlined";import sv from"@mui/icons-material/ViewKanbanOutlined";import cv from"@mui/icons-material/ConfirmationNumberOutlined";import mv from"@mui/icons-material/QuestionAnswerOutlined";import{jsx as Ht}from"react/jsx-runtime";var Vf={completed:"50px",ticket_no:"100px",title:"minmax(220px, 1.8fr)",status:"110px",start_date:"132px",due_date:"132px",manager_name:"110px",receiver_names:"170px",answerer_names:"110px",targets:"170px",priority:"84px",ack:"104px",confirm:"100px",project:"150px",request:"100px",deleted_time:"150px",completed_time:"150px",created_time:"132px",note:"minmax(140px, 0.7fr)",origin_license_name:"150px",support_type:"90px",author_name:"110px"},Kf={completed:{width:56},ticket_no:{width:100},title:{minWidth:220},status:{width:110},start_date:{width:132},due_date:{width:132},manager_name:{width:110},receiver_names:{width:170},answerer_names:{width:110},targets:{width:170},priority:{width:100},ack:{width:104},confirm:{width:100},project:{width:150},request:{width:100},deleted_time:{width:150},completed_time:{width:150},created_time:{width:132},note:{width:160},origin_license_name:{width:150},support_type:{width:90},author_name:{width:110}},uv=new Set(["completed","ticket_no","title","due_date"]);function xH(e){return qs(e).map(t=>Vf[t.id]).join(" ")}function bH(e){return qs(e).reduce((t,o)=>{let a=Vf[o.id]??"",r=/^(\d+)px$/.exec(a);if(r)return t+Number(r[1]);let i=/^minmax\((\d+)px/.exec(a);return i?t+Number(i[1]):t},0)}var dv={id:"deleted_time",get label(){return n("col.deletedTime")},icon:Ht(_u,{sx:{fontSize:15}}),align:"center",sortable:!0},pv={id:"completed_time",get label(){return n("col.completedTime")},icon:Ht(_u,{sx:{fontSize:15}}),align:"center",sortable:!0},fv={id:"created_time",get label(){return n("col.createdTime")},icon:Ht(_u,{sx:{fontSize:15}}),align:"center",sortable:!0},gv={id:"ticket_no",get label(){return n("col.ticket")},icon:Ht(cv,{sx:{fontSize:15}}),align:"center"},xv={id:"support_type",get label(){return n("col.kind")},icon:Ht(tv,{sx:{fontSize:15}}),align:"center"},bv={id:"author_name",get label(){return n("col.author")},icon:Ht(Wf,{sx:{fontSize:15}}),align:"center",valueFilter:"author_name"},hv={id:"answerer_names",get label(){return n("col.answerer")},icon:Ht(mv,{sx:{fontSize:15}}),align:"center",valueFilter:"answerer_names"},kv={id:"project",get label(){return n("col.project")},icon:Ht(sv,{sx:{fontSize:15}}),projectFilter:!0},Tv={id:"targets",get label(){return n("col.targets")},icon:Ht($f,{sx:{fontSize:15}})},vu={id:"priority",get label(){return n("col.priority")},icon:Ht(iv,{sx:{fontSize:15}}),align:"center",priorityFilter:!0},yv={id:"ack",get label(){return n("col.confirm")},icon:Ht(Bu,{sx:{fontSize:15}}),align:"center",ackFilter:!0},Cv={id:"confirm",get label(){return n("col.confirm")},icon:Ht(Bu,{sx:{fontSize:15}}),align:"center",ackFilter:!0};function Su(e){let t=e.findIndex(a=>a.id==="receiver_names"||a.id==="targets"),o=t>=0?t+1:e.findIndex(a=>a.id==="note");return o<0?[...e,vu]:[...e.slice(0,o),vu,...e.slice(o)]}function qs(e){return Sv(e).filter(t=>!(e?.showPriority===!1&&t.id==="priority")&&!(e?.hideStartDate&&t.id==="start_date")&&!(e?.compact&&!uv.has(t.id)))}function Sv(e){let{showProject:t=!1,showManager:o=!0,showActions:a=!0,showRequest:r=!0,notice:i=!1,bug:l=!1,support:s=!1,centerManager:c=!1,trash:u=!1,confirmMode:m="none"}=e??{};if(s){let g=x=>As.find(h=>h.id===x);return[g("completed"),xv,g("title"),g("status"),fv,g("start_date"),g("due_date"),bv,hv,{...g("manager_name"),align:"center"},g("receiver_names"),vu]}let d=g=>{if(!l)return g;let x=g.filter(b=>b.id!=="note"),h=x.findIndex(b=>b.id==="completed"),E=h>=0?h+1:0;return[...x.slice(0,E),gv,...x.slice(E)]};if(i)return d(Su(As.filter(g=>!["manager_name","receiver_names","request"].includes(g.id)).flatMap(g=>g.id==="due_date"?[g,Tv]:g.id==="note"?[yv,g]:[g])));let p=o?As:As.filter(g=>g.id!=="manager_name");if(c&&(p=p.map(g=>g.id==="manager_name"?{...g,align:"center"}:g)),a)r||(p=p.filter(g=>g.id!=="request"));else{p=p.filter(x=>x.id!=="request");let g=p.findIndex(x=>x.id==="note");p=[...p.slice(0,g),u?dv:pv,...p.slice(g)]}if(m==="action"){let g=p.findIndex(x=>x.id==="note");p=[...p.slice(0,g),Cv,...p.slice(g)]}if(!t)return d(Su(p));let f=p.findIndex(g=>g.id==="receiver_names");return d(Su([...p.slice(0,f+1),kv,...p.slice(f+1)]))}var As=[{id:"completed",get label(){return n("col.done")},icon:null,align:"center"},{id:"title",get label(){return n("col.title")},icon:Ht(ov,{sx:{fontSize:15}}),sortable:!0},{id:"status",get label(){return n("col.status")},icon:Ht(nv,{sx:{fontSize:15}}),align:"center",statusFilter:!0},{id:"start_date",get label(){return n("col.startTime")},icon:Ht(rv,{sx:{fontSize:15}}),align:"center",sortable:!0},{id:"due_date",get label(){return n("col.due")},icon:Ht(av,{sx:{fontSize:15}}),align:"center",sortable:!0},{id:"manager_name",get label(){return n("col.owner")},icon:Ht(Wf,{sx:{fontSize:15}}),memberFilter:"manager"},{id:"receiver_names",get label(){return n("col.cc")},icon:Ht($f,{sx:{fontSize:15}}),memberFilter:"receivers"},{id:"request",get label(){return n("col.confirm")},icon:Ht(Bu,{sx:{fontSize:15}}),align:"center",ackFilter:!0},{id:"note",get label(){return n("col.note")},icon:Ht(lv,{sx:{fontSize:15}})}];function sn(e){let t=e.visibility;return t==="involved"||t==="group"||t==="all"?t:e.is_open?"all":"involved"}function zs(e,t,o=0){if(t<=0)return!1;if(e.is_notice){if((e.author_account_seq??0)===t)return!0;let i=(e.target_account_seqs??[]).filter(l=>l>0);return i.length===0||i.includes(t)}if((e.author_account_seq??0)===t||(e.manager_account_seq??0)===t||(e.receiver_account_seqs??[]).includes(t))return!0;let r=sn(e);if(r==="all")return!0;if(r==="group"){let i=e.visibility_group_seq??0;return i>0&&o===i}return!1}function cl(e){let t=e;return!!(t.is_post||t.is_poll)}function Iu(e){return e.author_name||e.created_by||e.manager_name||""}function Sn(e){return cl(e)?Iu(e):e.manager_name||""}function Uf(e){return e.is_notice||e.is_event||cl(e)||e.completed||e.archived||(e.manager_account_seq??0)!==0?!1:sn(e)!=="involved"}function Ns(e,t){return t<=0||(e.author_account_seq??0)===t?!1:Uf(e)}function Fs(e,t){return t<=0||e.is_notice||e.is_event||cl(e)||e.completed||e.archived||(e.manager_account_seq??0)>0||(e.author_account_seq??0)===t||Uf(e)?!1:(e.receiver_account_seqs??[]).includes(t)}function Gf(e){return!!e.is_bug&&(e.manager_account_seq??0)===0&&e.status==="bug_received"}function Hs(e){return(e.origin_license_seq??0)>0}function jf(e,t){if(t<=0)return!1;let o=(e.author_account_seq??0)===t;return e.is_notice?o:o||(e.manager_account_seq??0)===t}function Wn(e,t){return t<=0?!1:Hs(e)?!0:e.is_notice?(e.author_account_seq??0)===t:(e.author_account_seq??0)===t||(e.manager_account_seq??0)===t||(e.receiver_account_seqs??[]).includes(t)}function vv(e,t){return t<=0?!1:Hs(e)?!0:e.is_notice?(e.author_account_seq??0)===t:(e.author_account_seq??0)===t||(e.manager_account_seq??0)===t}function Bv(e,t){return t<=0?!1:Hs(e)?!0:(e.author_account_seq??0)===t}function Ur(e,t,o){return o==="coreAuthorManager"?!vv(e,t):!Wn(e,t)}function ka(e,t,o,a){return o==="coreAuthorManager"?!Bv(e,t):a}var TH=[119,121,141,143];function Ws(e,t){let o=String(e.origin_author_avatar??"").trim(),a=String(e.author_name||e.origin_author_name||e.created_by||"").trim();if(!o||!a||!Hs(e)||t?.get(a)===o)return t;let r=new Map(t??[]);return r.set(a,o),r}import{createContext as Ys,memo as ig,useContext as ei,useEffect as Nv,useRef as Fv,useState as Ou}from"react";import{Box as ft,Button as lg,ButtonBase as Hv,Checkbox as Wv,IconButton as $v,Tooltip as Ja}from"@mui/material";import Vv from"@mui/icons-material/Add";import Kv from"@mui/icons-material/KeyboardArrowDown";import Uv from"@mui/icons-material/KeyboardArrowRight";import Gv from"@mui/icons-material/PublicOutlined";import jv from"@mui/icons-material/Group";import Yv from"@mui/icons-material/CheckCircle";import Xv from"@mui/icons-material/CheckCircleOutlineOutlined";import Qv from"@mui/icons-material/ArrowUpward";import Jv from"@mui/icons-material/ArrowDownward";import{HeaderFilterIcon as Zv}from"@ehfuse/mui-virtual-data-table";import{useEffect as _v,useState as Yf}from"react";import{Avatar as Xf,Box as Iv}from"@mui/material";import wv from"@mui/icons-material/PersonOutlineOutlined";import{jsx as $s}from"react/jsx-runtime";var wu=new Set,Qf=e=>e.startsWith("data:")||e.startsWith("blob:");function Dv(e){let t=e.trim();return t?([...t][0]??"").toUpperCase():""}function fo({src:e,name:t="",avatarSx:o,iconFontSize:a=40}){let[r,i]=Yf(()=>e?Qf(e)||wu.has(e):!1),[l,s]=Yf(!1),c={position:"relative",overflow:"hidden",borderRadius:"15px"},u=o?[c,...Array.isArray(o)?o:[o]]:c;if(_v(()=>{s(!1),i(e?Qf(e)||wu.has(e):!1)},[e]),!e||l){let m=Dv(t);return $s(Xf,{sx:u,children:m?$s(Iv,{component:"span",sx:{fontSize:"inherit",fontWeight:600,lineHeight:1,userSelect:"none"},children:m}):$s(wv,{sx:{fontSize:a}})})}return $s(Xf,{src:e,imgProps:{onLoad:()=>{wu.add(e),i(!0)},onError:()=>s(!0),style:r?void 0:{opacity:0}},sx:u})}var Ev=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Vs=(e,t)=>{if(!t||!t.trim())return[{text:e,highlight:!1}];try{let o=Ev(t.trim()),a=new RegExp(`(${o})`,"gi");return e.split(a).map(i=>i.toLowerCase()===t.trim().toLowerCase()?{text:i,highlight:!0}:{text:i,highlight:!1}).filter(i=>i.text)}catch{return[{text:e,highlight:!1}]}};function Vo(e){let t=String(e??"").trim().slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return"";let o=new Date(`${t}T00:00:00`);return Number.isNaN(o.getTime())?"":`${t.slice(2).replaceAll("-",".")} (${Hr(o.getDay())})`}function Du(e){let t=String(e??"").trim().slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return"";let o=Number(t.slice(5,7)),a=Number(t.slice(8,10));return!o||!a?"":cr(new Date(2e3,o-1,a),{month:"short",day:"numeric"})}function Ko(e){let t=String(e??"").trim(),[o,a=""]=t.split(" "),r=Vo(o);return r?a?`${r} ${a.slice(0,5)}`:r:""}function Ya(e,t){let o=(e.checklist??[]).filter(r=>!(t&&r.task_seq&&!t(Number(r.task_seq))));return o.length===0?"":`${o.filter(r=>r.checked).length}/${o.length}`}import{Box as Jf,Tooltip as Rv}from"@mui/material";import{jsx as Ks}from"react/jsx-runtime";var Gr=[{bgcolor:"#dbe7ff",color:"#24408e"},{bgcolor:"#ffe4d6",color:"#8a4b21"},{bgcolor:"#dcf2e3",color:"#1f6b3a"},{bgcolor:"#f3e3f7",color:"#6d2f80"},{bgcolor:"#fdf0cf",color:"#8a6d1d"},{bgcolor:"#e0f0f6",color:"#1d5f78"},{bgcolor:"#efe6dc",color:"#6b4a2b"}];function vo({names:e,size:t=22,ringFirst:o=!1,avatarSrcByName:a}){L();let r=be(),i=se().avatarSrcByName,l=a??i;return Ks(Jf,{sx:{display:"flex",alignItems:"center"},children:e.map((s,c)=>Ks(Rv,{title:o&&c===0?n("misc.ownerName",{name:s}):s,arrow:!0,children:Ks(Jf,{sx:{ml:c===0?0:"-7px",zIndex:c,borderRadius:"50%",border:`2px solid ${r.avatar.separatorColor}`,display:"inline-flex",...r.avatar.sx},children:Ks(fo,{src:l?.get(s)??"",name:s,avatarSx:{width:t,height:t,fontSize:Math.round(t/2),borderRadius:"50%",...Gr[c%Gr.length]},iconFontSize:Math.round(t*.6)})})},`${s}-${c}`))})}import{Box as Eu,Button as eg}from"@mui/material";import Pv from"@mui/icons-material/CheckCircle";import{Fragment as Zf,jsx as Xa,jsxs as Ru}from"react/jsx-runtime";function Ov(e){let t=e.mode==="dark";return{minWidth:0,width:"100%",px:1,py:.25,gap:.5,fontSize:13,color:e.table.rowColor,borderColor:e.colors.borderStrong,background:t?e.colors.surfaceHover:"linear-gradient(180deg, #ffffff 0%, #f6f7f9 100%)",whiteSpace:"nowrap","&:hover":{background:t?e.colors.surfaceSubtle:"linear-gradient(180deg, #fcfcfd 0%, #f0f2f4 100%)",borderColor:e.colors.borderStrong}}}function Mv(e){return{minWidth:0,px:1.25,py:.25,fontSize:13,whiteSpace:"nowrap",color:e.actionButton.color,backgroundColor:e.actionButton.bg,backgroundImage:e.actionButton.bgImage,boxShadow:"none","&:hover":{backgroundColor:e.actionButton.hoverBg,backgroundImage:e.actionButton.hoverBgImage,boxShadow:"none"},...e.actionButton.sx}}var jr={minWidth:0,px:1.25,py:.25,fontSize:13,fontWeight:600,whiteSpace:"nowrap",color:"#fff",backgroundColor:"#8b5cf6",backgroundImage:"linear-gradient(180deg, #a685f9 0%, #8b5cf6 100%)",boxShadow:"none","&:hover":{backgroundColor:"#7c4ee8",backgroundImage:"linear-gradient(180deg, #9873f2 0%, #7c4ee8 100%)",boxShadow:"none"}};function Uo({onClick:e,children:t,fullWidth:o=!1,sx:a}){let r=be();return Xa(eg,{size:"small",variant:"contained",color:"inherit",fullWidth:o,sx:[Mv(r),...Array.isArray(a)?a:a?[a]:[]],onClick:i=>{i.stopPropagation(),e(i)},children:t})}function Qa({canConfirm:e,count:t,total:o,myConfirmed:a=!1,onConfirm:r,onShowList:i}){L();let l=be(),s=Ov(l);return e?Xa(Uo,{onClick:()=>r(),children:n("task.confirm")}):Ru(eg,{size:"small",variant:"outlined",color:"inherit",sx:{...s,containerType:"inline-size"},onClick:c=>{c.stopPropagation(),i(c.currentTarget)},children:[a?Xa(Pv,{sx:{fontSize:16,color:"#2f80ed",flexShrink:0}}):null,Xa(Eu,{component:"span",sx:{flex:1,textAlign:"center",minWidth:0},children:o>0&&t>=o?Ru(Zf,{children:[Xa(Eu,{component:"span",sx:{[`@container (max-width: ${a?91:71}px)`]:{display:"none"}},children:n("task.confirm")}),n("common.done")]}):Ru(Zf,{children:[t,Xa(Eu,{component:"span",sx:{mx:.15},children:"/"}),o]})})]})}import{ConfirmActionPopper as Lv}from"@ehfuse/mui-confirm-action";import{jsx as Av}from"react/jsx-runtime";function Yr({anchorEl:e,onCancel:t,onConfirm:o}){return L(),Av(Lv,{open:!!e,anchorEl:e,title:n("table.reviewDoneConfirm"),onCancel:t,onConfirm:o})}import{SvgIcon as qv}from"@mui/material";import{jsx as Us,jsxs as zv}from"react/jsx-runtime";function Xr({sx:e,...t}){return zv(qv,{viewBox:"0 0 48 48",...t,sx:{fill:"none",...e},children:[Us("path",{d:"M24,6C13.23,6,4.5,12.93,4.5,21.46c0,5.39,3.5,10.13,8.79,12.89l-1.76,7.06a.46.46,0,0,0,.68.51L21,36.7a24,24,0,0,0,3,.2c10.77,0,19.5-6.91,19.5-15.44S34.77,6,24,6Z",fill:"none",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),Us("circle",{cx:"23.91",cy:"21.46",r:"2.71",fill:"currentColor",stroke:"none"}),Us("circle",{cx:"33.65",cy:"21.46",r:"2.71",fill:"currentColor",stroke:"none"}),Us("circle",{cx:"14.18",cy:"21.46",r:"2.71",fill:"currentColor",stroke:"none"})]})}import{Fragment as Xs,jsx as Y,jsxs as vn}from"react/jsx-runtime";var sg="14px";function Za(e){let t=String(e??"").trim();if(!t)return"-";let o=t.slice(2,10).replaceAll("-","."),a=t.slice(11,16);return/^\d{2}:\d{2}$/.test(a)?`${o} ${a}`:o}function eB(e){let t=String(e.event_time??"").trim();return e.is_event&&/^\d{2}:\d{2}$/.test(t)?Za(`${String(e.due_date??"").slice(0,10)} ${t}`):Za(e.due_date)}function Gs(e,t){let o=String(e??"").trim()||"-";return Vs(o,t).map((a,r)=>Y("span",{style:a.highlight?{fontWeight:600,color:"#2563eb"}:void 0,children:a.text},`${a.text}-${r}`))}function Ta({names:e,searchText:t,avatarSrcByName:o,emphasize:a=!1}){let r=e.filter(i=>i.trim());if(r.length===0)return null;if(r.length===1){let i=r[0]??"";return vn(Xs,{children:[Y(fo,{src:o?.get(i)??"",name:i,avatarSx:{width:24,height:24,fontSize:12,borderRadius:"50%",...Gr[0]},iconFontSize:15}),Y(ft,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...a?{fontWeight:500,color:"#2f80ed"}:{}},children:Gs(i,t)})]})}return Y(vo,{names:r,size:22,avatarSrcByName:o})}function tB({display:e,summary:t,searchText:o,avatarSrcByName:a}){if(L(),!e||e.kind==="everyone")return Y(ft,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t||n("col.allEmployees")});let{teamNames:r,individualNames:i}=e;if(r.length===0)return Y(Ta,{names:i,searchText:o,avatarSrcByName:a});let l=[...r,...i],s=l.join(", ");return l.length>2?Y(Ja,{title:s,arrow:!0,children:Y(ft,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n("col.namesAndMore",{value:l[0],value2:l[1],value3:l.length-2})})}):Y(Ja,{title:s,arrow:!0,children:vn(ft,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},children:[Y(ft,{component:"span",sx:{flexShrink:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.join(", ")+(i.length>0?",":"")}),i.length>0?Y(Ta,{names:i,searchText:o,avatarSrcByName:a}):null]})})}function js(e){let t=oB[e];return t?n(t):e}var oB={\uBB38\uC758:"support.inquiry",\uAC74\uC758\uC0AC\uD56D:"support.suggestion",\uC624\uB958\uC81C\uBCF4:"support.bugShort",\uC0C1\uB2F4\uC2E0\uCCAD:"support.consult"};function tg(e){return e==="\uBB38\uC758"?{bg:"#e8f1fd",fg:"#2f80ed"}:e==="\uAC74\uC758\uC0AC\uD56D"?{bg:"#f1ecfe",fg:"#8b5cf6"}:e==="\uC624\uB958\uC81C\uBCF4"?{bg:"#fdecec",fg:"#e5484d"}:e==="\uC0C1\uB2F4\uC2E0\uCCAD"?{bg:"#e6f7ec",fg:"#1f8a4c"}:{bg:"#f1f1ef",fg:"#6f6f6c"}}function Pu({label:e,bg:t,fg:o}){return Y(ft,{component:"span",sx:{flexShrink:0,px:.75,fontSize:12,fontWeight:500,lineHeight:"20px",color:o,bgcolor:t,borderRadius:"4px",whiteSpace:"nowrap",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"},children:e})}var ml=Ys(null),cg=Ys(!1);function it({onClick:e,hoverBg:t,align:o="left",cursor:a,sx:r,children:i,ownHover:l=!1}){let s=ei(ml)?.theme.table.rowColor,c=ei(cg);return Y(ft,{onClick:e,"data-own-hover":c&&l&&e?"":void 0,sx:{position:"absolute",inset:0,color:s,display:"flex",alignItems:"center",justifyContent:o==="center"?"center":"flex-start",gap:.75,px:sg,minWidth:0,overflow:"hidden",cursor:a??(e?"pointer":"default"),...c?{"tr:hover:not(:has([data-own-hover]:hover)) &":{bgcolor:t},...l&&e?{"&:hover":{bgcolor:t}}:{}}:e?{"&:hover":{bgcolor:t}}:{},...r},children:i})}function nB(e,t){let o=se(),{myAccountSeq:a,readOnly:r}=t,i=!Wn(e,a),l=i||r,s=Ur(e,a,o.editPolicy)||r,c=s||!!e.is_notice;return{config:o,noticeReadOnly:i,locked:l,coreCellLocked:s,memberLocked:c,managerLocked:c&&!Gf(e),noteLocked:r||(e.is_notice?!zs(e,a):!Wn(e,a)),completeLocked:e.is_event?!0:e.is_notice?(e.author_account_seq??0)!==a:(e.author_account_seq??0)!==a&&(e.manager_account_seq??0)!==a,isMyManagedTask:a>0&&!e.is_notice&&!e.is_event&&(e.manager_account_seq??0)===a}}function og({task:e}){L();let t=se(),[o,a]=Ou(null);return vn(Xs,{children:[Y(lg,{variant:"contained",size:"small",disableElevation:!0,onClick:r=>{r.stopPropagation(),a(r.currentTarget)},sx:jr,children:n("col.reviewDone")}),Y(Yr,{anchorEl:o,onCancel:()=>a(null),onConfirm:()=>{t.onReviewDone?.(e),a(null)}})]})}function ng(e,t){return!e.is_notice&&e.completed&&!!e.review_pending&&!!t.onReviewDone&&(t.myAccountSeq??0)>0&&(e.author_account_seq??0)===(t.myAccountSeq??0)}function rB({task:e,locked:t,ctx:o}){let[a,r]=Ou(!1),[i,l]=Ou(""),s=Fv(null),{theme:c}=o;return Nv(()=>{if(!a)return;let u=m=>{let d=s.current;d&&(m.target instanceof Node&&d.contains(m.target)||d.blur())};return document.addEventListener("mousedown",u,!0),document.addEventListener("touchstart",u,!0),()=>{document.removeEventListener("mousedown",u,!0),document.removeEventListener("touchstart",u,!0)}},[a]),Y(it,{hoverBg:c.table.cellHoverBg,cursor:t?"default":"text",onClick:()=>{!t&&!a&&(l(e.note),r(!0))},sx:{color:c.table.rowSubColor,"&:hover":{}},children:a?Y(ft,{component:"input",ref:s,autoFocus:!0,spellCheck:!1,value:i,onChange:u=>l(u.target.value),onBlur:()=>{r(!1),i.trim()!==e.note&&o.onChangeNote(e.seq,i)},onKeyDown:u=>{u.key==="Enter"&&u.target.blur(),u.key==="Escape"&&(l(e.note),r(!1))},sx:{flex:1,minWidth:0,width:"100%",border:"none",outline:"none",bgcolor:"transparent",font:"inherit",lineHeight:"inherit",letterSpacing:"inherit",color:c.table.rowTitleColor,caretColor:c.table.rowTitleColor,p:0,m:0}}):Y(ft,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.note?Gs(e.note,o.searchText):""})})}var mg=ig(function(t){let o=ei(ml);return Y(cg.Provider,{value:!!o?.isPostItem?.(t.task),children:Y(aB,{...t})})});function aB({task:e,columnId:t}){L();let o=ei(ml);if(!o)throw new Error("TaskBoxCell \uC740 TaskBoxCellContext \uC548\uC5D0\uC11C\uB9CC \uC4F4\uB2E4");let r=(o.useTaskItem?o.useTaskItem(e.seq):void 0)??e,i=nB(r,o),l=!!o.isPostItem?.(r),s=()=>o.onOpenDetail(r),{theme:c,searchText:u,avatarSrcByName:m}=o,d=c.table.cellHoverBg,p=(h,E)=>h?void 0:E,f=()=>Y(it,{hoverBg:d,onClick:p(i.coreCellLocked,()=>o.onMemberClick(r,"targets")),children:Y(tB,{display:r.is_notice?o.getTargetDisplay?.(r):void 0,summary:(r.is_notice?o.getTargetSummary?.(r):void 0)??"",searchText:u,avatarSrcByName:m})}),g=()=>Y(it,{hoverBg:d,ownHover:!0,onClick:p(i.memberLocked,()=>o.onMemberClick(r,"receivers")),children:Y(Ta,{names:r.receiver_names,searchText:u,avatarSrcByName:m})}),x=()=>{let h=o.getAckInfo?.(r);return Y(Qa,{canConfirm:!!h?.canAck,count:h?.count??0,total:h?.total??0,myConfirmed:!!h?.acked,onConfirm:()=>o.onAckConfirm(r),onShowList:E=>o.onAckListClick(r,E)})};switch(t){case"completed":return vn(it,{hoverBg:d,align:"center",sx:{px:0},onClick:l?s:void 0,children:[r.is_event?(()=>{let h=Le(r.icon||Nt);if(!h)return null;let E=Y(h,{sx:{fontSize:19,color:r.icon_color||"#1e3a8a"}});return i.locked||!o.onIconClick?E:Y(Ja,{title:n("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:Y(Hv,{onClick:b=>{b.stopPropagation(),o.onIconClick?.(r,b.currentTarget)},sx:{p:.25,borderRadius:1,"&:hover":{bgcolor:d}},children:E})})})():!l&&!i.noticeReadOnly&&!i.completeLocked&&!o.trashMode?Y(Ja,{title:r.completed&&r.completed_by?n("col.completedBy",{completed_by:r.completed_by,value:Ko(r.completed_time)}):r.completed?n("menu.uncomplete"):n("menu.complete"),arrow:!0,enterDelay:300,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Y(Wv,{checked:r.completed,inputProps:{"aria-label":r.completed?n("col.uncompleteAria",{title:r.title}):n("col.completeAria",{title:r.title})},icon:Y(Xv,{sx:{fontSize:20,color:"#9a9a97",opacity:.45}}),checkedIcon:Y(Yv,{sx:{fontSize:20,color:"#2f80ed"}}),onClick:h=>h.stopPropagation(),onChange:(h,E)=>o.onRequestToggleCompleted({anchorEl:h.currentTarget,task:r,nextCompleted:E}),sx:{p:.5}})}):null,i.isMyManagedTask?Y(ft,{component:"span",sx:{position:"absolute",left:3,top:6,bottom:6,width:3,bgcolor:"#2f80ed",borderRadius:1.5,pointerEvents:"none"}}):null]});case"ticket_no":return Y(it,{hoverBg:d,align:"center",sx:{whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:r.ticket_no||"-"});case"support_type":return Y(it,{hoverBg:d,align:"center",sx:{whiteSpace:"nowrap"},children:r.support_type?(()=>{let h=tg(r.support_type);return Y(Pu,{label:js(r.support_type),bg:h.bg,fg:h.fg})})():"-"});case"title":{let h=i.config.titlePrefix?.(r)??"",E=Ya(r,i.config.resolveTask),b=o.isTaskUnread?.(r)??!1,B=r.completed&&o.dimCompleted;return vn(it,{hoverBg:d,onClick:()=>o.onOpenDetail(r),sx:{gap:1},children:[r.is_notice?(()=>{let T=Le(r.icon||Dt);return T?Y(T,{sx:{fontSize:18,flexShrink:0,color:r.icon_color||"#e5484d"}}):null})():null,!o.supportMode&&r.is_support&&r.support_type?(()=>{let T=tg(r.support_type);return Y(Pu,{label:js(r.support_type),bg:T.bg,fg:T.fg})})():null,o.bugMode&&(r.origin_license_seq??0)>0&&r.origin_license_name?Y(Pu,{label:r.origin_license_name,bg:"#fdf0e6",fg:"#d9730d"}):null,(()=>{if(r.is_notice||o.supportMode||r.is_support)return null;let T=sn(r);return T==="involved"?null:Y(Ja,{title:T==="all"?n("col.visibilityAll"):n("col.visibilityDept"),arrow:!0,disableInteractive:!0,children:T==="all"?Y(Gv,{sx:{fontSize:15,flexShrink:0,color:"#2f80ed"}}):Y(jv,{sx:{fontSize:15,flexShrink:0,color:"#d9730d"}})})})(),vn(ft,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:B?400:c.table.rowTitleFontWeight,color:B?c.colors.textMuted:c.table.rowTitleColor},children:[h?Y(ft,{component:"span",sx:{color:c.colors.textSecondary,fontWeight:500,fontSize:14,mr:.75},children:Gs(h,u)}):null,Gs(r.title,u)]}),E?Y(ft,{component:"span",sx:{flexShrink:0,fontSize:14,color:c.colors.textMuted,fontVariantNumeric:"tabular-nums"},children:E}):null,(r.comment_count??r.comments?.length??0)>0?Y(Xr,{sx:{fontSize:16,flexShrink:0,color:"#9a9a97"}}):null,Y(ft,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:Y($r,{labelKeys:r.label_keys??[],labelOptions:o.statusOptions})}),b&&!r.completed?Y(ft,{component:"span",sx:{flexShrink:0,px:.55,fontSize:10.5,fontWeight:700,lineHeight:1.6,color:"#fff",bgcolor:"#e5484d",borderRadius:"4px"},children:"N"}):null,vs(r)&&!r.archived&&!i.locked&&o.onArchiveTask?Y(lg,{size:"small",variant:"outlined",color:"inherit",sx:{ml:"auto",flexShrink:0,minWidth:0,px:1.25,py:.25,fontSize:13,color:"text.primary",borderColor:"#d5d8dc",bgcolor:"#fff",whiteSpace:"nowrap"},onClick:T=>{T.stopPropagation(),o.onArchiveTask?.(r)},children:n("menu.archive")}):null]})}case"status":{if(l)return Y(it,{hoverBg:d,align:"center",onClick:s});let h=i.locked||!!r.is_event||!!r.completed;return Y(it,{hoverBg:d,align:"center",onClick:p(h,E=>o.onStatusClick(r,E.currentTarget)),children:r.is_event?(()=>{let E=rl(r);return E?Y(Ke,{option:E}):null})():Y(Ke,{option:Ft(r)})})}case"created_time":return Y(it,{hoverBg:d,align:"center",sx:{whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:Za(r.created_time)});case"start_date":return l?Y(it,{hoverBg:d,align:"center",onClick:s,sx:{whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:Za(r.created_time)}):Y(it,{hoverBg:d,align:"center",sx:{whiteSpace:"nowrap"},onClick:p(i.coreCellLocked,h=>o.onDateClick(r,"start_date",h.currentTarget)),children:Za(r.start_date)});case"due_date":{if(l)return Y(it,{hoverBg:d,align:"center",onClick:s});let h=!r.is_notice&&!r.completed&&!!r.due_date&&r.due_date.slice(0,10)<=o.todayStr,E=r.is_event&&r.due_date?r.due_date.slice(0,10):"",b=!!E&&E<o.todayStr;return Y(it,{hoverBg:d,align:"center",sx:{color:b?c.colors.textSecondary:h?"#e5484d":c.colors.textPrimary,fontWeight:500,whiteSpace:"nowrap"},onClick:p(i.coreCellLocked,B=>o.onDateClick(r,"due_date",B.currentTarget)),children:r.due_date?eB(r):null})}case"author_name":return Y(Ja,{title:r.origin_license_name||"",arrow:!0,placement:"top",disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Y(ft,{sx:{position:"absolute",inset:0},children:Y(it,{hoverBg:d,align:"center",children:Y(Ta,{names:[r.author_name||r.origin_author_name||r.created_by||""],searchText:u,avatarSrcByName:Ws(r,m)})})})});case"answerer_names":return Y(it,{hoverBg:d,align:"center",children:Y(Ta,{names:(r.answerer_names??[]).slice(0,1),searchText:u,avatarSrcByName:m})});case"targets":return f();case"manager_name":{if(r.is_notice)return f();if(r.is_event)return g();if(l)return Y(it,{hoverBg:d,align:o.managerCentered?"center":"left",onClick:s,children:Y(Ta,{names:[Iu(r)].filter(Boolean),searchText:u,avatarSrcByName:m})});let h=!!o.onClaimClick&&Ns(r,o.myAccountSeq),E=!!o.onVolunteerClick&&Fs(r,o.myAccountSeq);return Y(it,{hoverBg:d,align:h||E||o.managerCentered?"center":"left",onClick:p(i.managerLocked,()=>o.onMemberClick(r,"manager")),children:h?Y(Uo,{onClick:b=>o.onClaimClick?.(r,b.currentTarget),children:n("col.claim")}):E?Y(Uo,{onClick:b=>o.onVolunteerClick?.(r,b.currentTarget),children:n("col.claim")}):Y(Ta,{names:r.manager_name?[r.manager_name]:[],searchText:u,avatarSrcByName:m,emphasize:i.isMyManagedTask})})}case"receiver_names":return r.is_notice?f():g();case"priority":return l?Y(it,{hoverBg:d,align:"center",onClick:s}):Y(it,{hoverBg:d,align:"center",onClick:p(i.locked,h=>o.onPriorityClick(r,h.currentTarget)),children:Y(po,{priority:r.priority,plain:!0})});case"project":{let h=o.projectByKey.get(r.tab_key??""),E=h?Le(h.icon):null;return Y(it,{hoverBg:d,sx:{gap:.5},onClick:p(i.coreCellLocked,b=>o.onProjectClick(r,b.currentTarget)),children:h?.label?vn(Xs,{children:[E?Y(E,{sx:{fontSize:15,flexShrink:0,color:"#1e3a8a"}}):null,Y(ft,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.label})]}):null})}case"ack":return Y(it,{hoverBg:d,align:"center",children:r.is_notice?x():null});case"request":{let h=[r.manager_account_seq??0,...r.receiver_account_seqs??[]].some(b=>b>0&&b!==(r.author_account_seq??0)),E=r.is_notice?void 0:o.getConfirmInfo?.(r);return Y(it,{hoverBg:d,align:"center",children:r.is_notice?x():ng(r,i.config)?Y(og,{task:r}):h?Y(Qa,{canConfirm:!!E?.canConfirm,count:E?.count??0,total:E?.total??0,myConfirmed:!!E?.myTime,onConfirm:()=>o.onConfirmTask(r),onShowList:b=>o.onAckListClick(r,b)}):null})}case"confirm":{let h=r.is_notice?void 0:o.getConfirmInfo?.(r);return Y(it,{hoverBg:d,align:"center",sx:{whiteSpace:"nowrap",color:c.table.rowSubColor},children:r.is_notice?x():ng(r,i.config)?Y(og,{task:r}):h&&h.total>0?Y(Qa,{canConfirm:!!h.canConfirm,count:h.count,total:h.total,myConfirmed:!!h.myTime,onConfirm:()=>o.onConfirmTask(r),onShowList:E=>o.onAckListClick(r,E)}):"-"})}case"completed_time":case"deleted_time":return Y(it,{hoverBg:d,align:"center",sx:{whiteSpace:"nowrap",color:o.trashMode?c.colors.danger:o.dimCompleted?c.table.rowSubColor:c.table.rowTitleColor},children:o.trashMode?Za(r.deleted_time):r.completed_time||"-"});case"note":return Y(rB,{task:r,locked:i.noteLocked,ctx:o},r.seq);default:return null}}var Mu=Ys(null);function Lu(e){return!!(e.sortable||e.memberFilter||e.statusFilter||e.ackFilter||e.projectFilter||e.priorityFilter||e.valueFilter)}function ug({column:e}){let t=ei(Mu);if(!t)return Y(Xs,{children:e.label});let{theme:o}=t,a=t.sortBy===e.id,r=t.isFiltered(e),i=Lu(e),l=!!(e.memberFilter||e.statusFilter||e.ackFilter||e.projectFilter||e.priorityFilter||e.valueFilter);return vn(ft,{component:"span",sx:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":"flex-start",gap:.5,minWidth:0,whiteSpace:"nowrap",color:a||r?o.table.headerFilteredColor:i?o.table.headerActiveColor:o.table.headerColor,...r?{fontWeight:600}:{}},children:[e.icon,e.label,l?Y(Zv,{color:r?o.table.headerFilteredColor:void 0}):null,a?t.sortDirection==="asc"?Y(Qv,{sx:{fontSize:13}}):Y(Jv,{sx:{fontSize:13}}):null]})}var Au=Ys(null);function rg({bg:e,hoverBg:t,onClick:o,children:a}){return Y(ft,{sx:{display:"flex",alignItems:"center",gap:.5,px:sg,height:"100%",minHeight:48,boxSizing:"border-box",bgcolor:e,cursor:o?"pointer":"default",userSelect:"none",...t?{"&:hover":{bgcolor:t}}:{}},children:a})}function ag({theme:e,count:t,bg:o,color:a,border:r}){let i=e.table.groupHeader.badge;return Y(ft,{component:"span",sx:{flexShrink:0,width:i.width,py:i.paddingY,borderRadius:`${i.borderRadius}px`,bgcolor:o,border:r??"none",color:a,fontSize:i.fontSize,fontWeight:i.fontWeight,lineHeight:1.6,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:t})}var dg=ig(function({row:t}){L();let o=ei(Au);if(!o)return null;let{theme:a}=o,r=a.table.groupHeader,i=u=>Y(ft,{component:"span",sx:{fontSize:r.labelFontSize,fontWeight:r.labelFontWeight,color:r.labelColor},children:u});if(t.kind==="pin"){let u=t.key==="unconfirmed";return vn(rg,{bg:u?"#fdf3f2":"#f4f0fe",children:[i(t.label),Y(ft,{sx:{ml:"auto",display:"flex",alignItems:"center",pr:.5},children:Y(ag,{theme:a,count:t.count,bg:u?"#e5484d":"#8b5cf6",color:"#fff"})})]})}let{section:l,visibleTasks:s,collapsed:c}=t;return vn(rg,{bg:r.bg,hoverBg:r.hoverBg,onClick:!0,children:[c?Y(Uv,{sx:{fontSize:20,color:a.colors.textMuted,ml:"-4px"}}):Y(Kv,{sx:{fontSize:20,color:a.colors.textMuted,ml:"-4px"}}),i(l.label),o.renderGroupTitleSummary&&!l.plain?Y(ft,{sx:{flexShrink:0,display:"flex",alignItems:"center",ml:.5},children:o.renderGroupTitleSummary(l.key,l.tasks)}):null,o.onAddInGroup&&!l.plain&&(!o.canAddInGroup||o.canAddInGroup(l.key))?Y($v,{size:"small","aria-label":n("col.addToGroup"),onClick:u=>{u.stopPropagation(),o.onAddInGroup?.(l.key,l.tasks)},sx:{flexShrink:0,ml:.75,p:.25,color:a.colors.textSecondary,"&:hover":{bgcolor:a.colors.surfaceHover,color:a.colors.accentOnSurface}},children:Y(Vv,{sx:{fontSize:21}})}):null,vn(ft,{sx:{ml:"auto",minWidth:0,display:"flex",alignItems:"center",gap:1,pr:.5},children:[o.renderGroupSummary&&!l.plain?o.renderGroupSummary(l.key,l.tasks):null,Y(ag,{theme:a,count:s.length,bg:r.badge.bg,color:r.badge.color,border:r.badge.border})]})]})}),pg={padding:"0 !important",height:49,"[data-vdt-pinned-row] > &":{position:"sticky",top:0,zIndex:1}};import{jsx as gt,jsxs as ti}from"react/jsx-runtime";var gg=48,fB=5,gB={borderBottom:"1px solid #000"},xB={thumb:{width:8},showHorizontalScrollbar:!0,scrollTopFab:!0};function xg({tasks:e,statusOptions:t,avatarSrcByName:o,searchText:a,todayStr:r,sortBy:i,sortDirection:l,onSort:s,onRequestReply:c,onToggleCompleted:u,onChangeTaskDate:m,onChangeTaskReminder:d,onChangeTaskEventTime:p,groupBy:f,collapsedGroupKeys:g,customTabs:x,onToggleGroup:h,hideCompleted:E=!1,loading:b=!1,dimCompleted:B=!0,readOnly:T=!1,onChangeTaskIcon:z,onChangeTaskIconColor:k,onAddInGroup:_,canAddInGroup:D,renderGroupSummary:F,renderGroupTitleSummary:R,onChangeTaskProject:C,onAddProject:y,onChangeNote:I,onMemberClick:S,onClaimTask:M,onChangeTaskStatus:w,onOpenDetail:q,onTaskContextMenu:v,onMemberFilterClick:O,activeMemberFilters:j=[],onStatusFilterClick:V,statusFilterActive:Z=!1,onAckFilterClick:ie,ackFilterActive:ue=!1,onProjectFilterClick:K,projectFilterActive:te=!1,onPriorityFilterClick:$,priorityFilterActive:G=!1,onValueFilterClick:ae,activeValueFilters:Re=[],columns:mt,getConfirmInfo:ce,onConfirmTask:Q,myAccountSeq:W=0,currentUserName:X="",groupManagerByMyRole:le=!1,pinKindGroups:pe=!1,tailGroups:De,isPostItem:ve,allowManagerVolunteer:It=!0,noticeAdmin:We=!1,getTargetSummary:Ee,getTargetDisplay:ut,onArchiveTask:je,isTaskUnread:co,getAckInfo:kt,onAckConfirm:oe,onAckListClick:_e,onChangeTaskPriority:Ze,onEndReached:ze,useTaskItem:tn,selectedTaskSeq:qr,columnResize:mo,columnWidths:or,onColumnWidthsChange:bn}){let nr=L(),Kt=be(),hn=JSON.stringify(mt??{}),Yt=io(()=>({showManager:!0,showActions:!0,showRequest:!0,...mt}),[hn]),rr=Yt.showManager??!0,dt=Yt.showActions??!0,Po=Yt.showRequest??!0,kn=Yt.confirmMode??"none",rt=Yt.notice??!1,Ln=Yt.bug??!1,Oe=Yt.support??!1,U=Oe||(Yt.centerManager??!1),P=Yt.trash??!1,me=f!=="none",{unassignedGroupLabel:xe}=se(),et=io(()=>{if(!me)return[];let A=(De??[]).map(Pe=>({key:Pe.key,label:Pe.label,plain:Pe.plain,tasks:[]})),ne=[];for(let Pe of e){let tt=(De??[]).findIndex(Fr=>Fr.match(Pe));tt>=0?A[tt].tasks.push(Pe):ne.push(Pe)}return[...Es(ne,f,r,x,t,X,{enabled:le,myAccountSeq:W,unassignedLabel:xe},pe),...A.filter(Pe=>Pe.tasks.length>0)]},[me,e,De,f,r,x,t,X,le,W,xe,pe]),Ye=io(()=>E?e.filter(A=>!A.completed):e,[e,E]),at=io(()=>Ye.filter(A=>A.completed||A.archived||A.is_support?!1:A.is_notice?!!kt?.(A).canAck:!!ce?.(A).canConfirm),[Ye,kt,ce]),wt=io(()=>W>0?e.filter(A=>A.completed&&!A.archived&&!A.is_support&&!!A.review_pending&&(A.author_account_seq??0)===W):[],[e,W]),eo=io(()=>new Set([...at,...wt].map(A=>A.seq)),[at,wt]),qt=io(()=>et.map(A=>({section:A,visibleTasks:A.tasks.filter(ne=>!eo.has(ne.seq)&&(!E||!ne.completed))})).filter(A=>A.visibleTasks.length>0),[et,E,eo]),Xt=io(()=>new Set(g),[g]),ar=io(()=>{let A=[];if(me)for(let{section:ne,visibleTasks:Pe}of qt){let tt=Xt.has(ne.key);if(A.push({kind:"header",section:ne,visibleTasks:Pe,collapsed:tt}),!tt)for(let Fr of Pe)A.push({kind:"task",task:Fr})}else for(let ne of Ye)eo.has(ne.seq)||A.push({kind:"task",task:ne});return A},[me,qt,Ye,Xt,eo]),ir=io(()=>{let A=[];if(at.length>0){A.push({kind:"pin",key:"unconfirmed",label:n("table.unconfirmed"),count:at.length});for(let ne of at)A.push({kind:"task",task:ne})}if(wt.length>0){A.push({kind:"pin",key:"review",label:n("table.reviewPending"),count:wt.length});for(let ne of wt)A.push({kind:"task",task:ne})}return A},[at,wt,nr]),lr=Yt.showProject??(!rt&&f!=="tab"),zr=io(()=>qs({...Yt,showProject:lr}),[Yt,lr,nr]),{onReturnTask:sr}=se(),Ai=io(()=>{let A=new Map;for(let ne of x)A.set(ne.key,{label:ne.archived?n("table.archivedSuffix",{label:ne.label}):ne.label,icon:ne.icon});return A},[x,nr]),[Fe,Nr]=Qr(null),[Ho,zt]=Qr(null),[Ve,Oo]=Qr(null),[Wo,An]=Qr(null),[ns,rs]=Qr(!1),[qi,as]=Qr(null),Co=qi?e.find(A=>A.seq===qi.taskSeq)??null:null,[Na,ua]=Qr(null),da=Na?e.find(A=>A.seq===Na.taskSeq)??null:null,[qn,zi]=Qr(null),Ni=qn?e.find(A=>A.seq===qn.taskSeq)??null:null,Tn=ao((A,ne)=>{zi({anchorEl:ne,taskSeq:A.seq})},[]),uo=ao((A,ne)=>{ua({anchorEl:ne,taskSeq:A.seq})},[]),is=ao((A,ne)=>{as({anchorEl:ne,taskSeq:A.seq})},[]),Fa=ao((A,ne,Pe)=>{let tt=!!A.is_event,Fr=String(A.event_time??"").trim(),_T=tt&&ne==="due_date"&&/^\d{2}:\d{2}$/.test(Fr)?`${String(A.due_date??"").slice(0,10)} ${Fr}`:A[ne];Nr({anchorEl:Pe,taskSeq:A.seq,field:ne,date:_T,isEvent:tt,reminders:rn(A),completed:A.completed})},[]),Ha=ao((A,ne)=>{An({anchorEl:ne,task:A})},[]),Wa=ao(A=>{if(Fe){if(Fe.isEvent&&Fe.field==="due_date"){let ne=A.slice(0,10),Pe=A.slice(11,16),tt=Fe.date.slice(0,10),Fr=Fe.date.slice(11,16);ne!==tt&&m(Fe.taskSeq,"due_date",ne),Pe!==Fr&&p?.(Fe.taskSeq,Pe)}else m(Fe.taskSeq,Fe.field,A);Nr(ne=>ne&&{...ne,date:A})}},[Fe,m,p]),Cm=ao(A=>{Fe&&(d(Fe.taskSeq,A),Nr(ne=>ne&&{...ne,reminders:A}))},[Fe,d]),to=ao((A,ne)=>{Oo({anchorEl:ne,taskSeq:A.seq,title:A.title,kind:"claim"})},[]),oo=ao((A,ne)=>{Oo({anchorEl:ne,taskSeq:A.seq,title:A.title,kind:"volunteer"})},[]),So=iB({onConfirmTask:Q,onChangeNote:I,onMemberClick:S,onOpenDetail:q,onAckConfirm:oe,onAckListClick:_e,onArchiveTask:je,onTaskContextMenu:v,onToggleGroup:h,onSort:s,onMemberFilterClick:O,onStatusFilterClick:V,onAckFilterClick:ie,onProjectFilterClick:K,onPriorityFilterClick:$,onValueFilterClick:ae,sortBy:i,sortDirection:l});So.current={onConfirmTask:Q,onChangeNote:I,onMemberClick:S,onOpenDetail:q,onAckConfirm:oe,onAckListClick:_e,onArchiveTask:je,onTaskContextMenu:v,onToggleGroup:h,onSort:s,onMemberFilterClick:O,onStatusFilterClick:V,onAckFilterClick:ie,onProjectFilterClick:K,onPriorityFilterClick:$,onValueFilterClick:ae,sortBy:i,sortDirection:l};let on=io(()=>({onConfirmTask:A=>So.current.onConfirmTask?.(A),onChangeNote:(A,ne)=>So.current.onChangeNote(A,ne),onMemberClick:(A,ne)=>So.current.onMemberClick(A,ne),onOpenDetail:A=>So.current.onOpenDetail(A),onAckConfirm:A=>So.current.onAckConfirm?.(A),onAckListClick:(A,ne)=>So.current.onAckListClick?.(A,ne),onArchiveTask:A=>So.current.onArchiveTask?.(A)}),[]),ls=!!je,Sm=io(()=>({theme:Kt,useTaskItem:tn,statusOptions:t,avatarSrcByName:o,searchText:a,myAccountSeq:W,todayStr:r,showManager:rr,showActions:dt,showRequest:Po,confirmMode:kn,notice:rt,bugMode:Ln,supportMode:Oe,managerCentered:U,trashMode:P,dimCompleted:B,readOnly:T,projectByKey:Ai,getConfirmInfo:ce,getTargetSummary:Ee,getTargetDisplay:ut,getAckInfo:kt,isTaskUnread:co,isPostItem:ve,onConfirmTask:on.onConfirmTask,onProjectClick:Ha,onRequestToggleCompleted:zt,onDateClick:Fa,onChangeNote:on.onChangeNote,onMemberClick:on.onMemberClick,onClaimClick:M?to:void 0,onVolunteerClick:It?oo:void 0,onStatusClick:is,onOpenDetail:on.onOpenDetail,onPriorityClick:uo,onIconClick:z?Tn:void 0,onArchiveTask:ls?on.onArchiveTask:void 0,onAckConfirm:on.onAckConfirm,onAckListClick:on.onAckListClick}),[Kt,tn,t,o,a,W,r,rr,dt,Po,kn,rt,Ln,Oe,U,P,B,T,Ai,ce,Ee,ut,kt,co,ve,on,Ha,Fa,M,to,It,oo,is,uo,z,Tn,ls]),Fi=ao(A=>!!A.memberFilter&&j.includes(A.memberFilter)||!!A.valueFilter&&Re.includes(A.valueFilter)||!!A.statusFilter&&Z||!!A.ackFilter&&ue||!!A.projectFilter&&te||!!A.priorityFilter&&G,[j.join(","),Re.join(","),Z,ue,te,G]),ss=io(()=>({theme:Kt,sortBy:i,sortDirection:l,isFiltered:Fi}),[Kt,i,l,Fi]),$a=io(()=>({theme:Kt,onAddInGroup:_,canAddInGroup:D,renderGroupSummary:F,renderGroupTitleSummary:R}),[Kt,_,D,F,R]),pa=ao((A,ne)=>{let Pe=So.current;if(A.memberFilter)Pe.onMemberFilterClick(A.memberFilter,ne);else if(A.statusFilter)Pe.onStatusFilterClick(ne);else if(A.ackFilter)Pe.onAckFilterClick?.(ne);else if(A.projectFilter)Pe.onProjectFilterClick?.(ne);else if(A.priorityFilter)Pe.onPriorityFilterClick?.(ne);else if(A.valueFilter)Pe.onValueFilterClick?.(A.valueFilter,ne);else if(A.sortable){let tt=Pe.sortBy===A.id&&Pe.sortDirection==="asc"?"desc":"asc";Pe.onSort(A.id,tt)}},[]),Hi=ao((A,ne)=>{(A.memberFilter||A.statusFilter||A.ackFilter||A.projectFilter||A.priorityFilter||A.valueFilter)&&(ne.preventDefault(),pa(A,ne.currentTarget))},[pa]),N=ao((A,ne)=>{So.current.onSort(A,ne)},[]),Xe=io(()=>zr.map(A=>{let ne=Kf[A.id]??{width:120},Pe=Lu(A);return{id:A.id,text:gt(ug,{column:A}),width:ne.width,minWidth:ne.minWidth,align:A.align??"left",cellPadding:0,style:{position:"relative"},primary:A.id==="title",headerProps:Pe?{onClick:tt=>pa(A,tt.currentTarget),onContextMenu:tt=>Hi(A,tt),style:{cursor:"pointer"}}:void 0,sortMenu:!!A.sortable,colSpan:A.id==="manager_name"?tt=>tt.kind==="task"&&(tt.task.is_notice||tt.task.is_event)?2:1:void 0,render:tt=>tt.kind==="task"?gt(mg,{task:tt.task,columnId:A.id}):null}}),[zr,pa,Hi]),zn=ao(A=>A.kind==="task"?null:gt(dg,{row:A}),[]),Wi=ao(A=>{A.kind==="header"&&So.current.onToggleGroup(A.section.key)},[]),TT=ao((A,ne,Pe)=>{A.kind==="task"&&So.current.onTaskContextMenu(A.task,Pe)},[]),yT=ao(A=>A.kind==="task"?A.task.seq:A.kind==="header"?`group:${A.section.key}`:`pin:${A.key}`,[]),CT=`${f}|${i}|${l}|${a}|${E?1:0}`,ST=e.length>0?n("table.completedHidden",{length:e.length}):Ln?n("table.emptyBugs"):Oe?n("table.emptySupport"):rt?n("table.emptyNotices"):n("table.emptyTasks"),vT=(at.length>0?1:0)+(wt.length>0?1:0),BT=(gg+1)*(fB+vT);return ti(lB,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0,border:`1px solid ${Kt.table.borderColor}`,borderRadius:"0 0 4px 4px",overflow:"hidden",bgcolor:Kt.table.bg,color:Kt.table.rowColor,...Kt.table.sx},children:[gt(ml.Provider,{value:Sm,children:gt(Mu.Provider,{value:ss,children:gt(Au.Provider,{value:$a,children:gt(dB,{variant:"notion",framed:!1,showPaper:!1,colorMode:Kt.mode,data:ar,totalCount:ar.length,columns:Xe,rowHeight:gg,getRowId:yT,rowKeyFromId:!0,resetScrollOnDataChange:!1,selectedRowId:qr??null,renderFullWidthRow:zn,fullWidthRowSx:pg,pinnedRows:ir.length>0?ir:void 0,pinnedRowsMaxHeight:BT,pinnedRowsSx:gB,onRowClick:Wi,onRowContextMenu:TT,sortBy:i,sortDirection:l,onSort:N,onEndReached:me?void 0:ze,loading:b&&Ye.length===0,emptyMessage:ST,scrollbars:xB,columnResize:mo,columnWidths:or,onColumnWidthsChange:bn},CT)})})}),gt(Ga,{anchorEl:qi?.anchorEl??null,value:Co?.status??"",options:Co?_s(Co):nl,onSelect:A=>{Co&&w(Co.seq,A)},onComplete:Co&&!Co.completed&&!Co.is_notice&&!Co.is_event&&!Co.is_bug&&!P&&((Co.author_account_seq??0)===W||(Co.manager_account_seq??0)===W)?()=>u(Co,!0):void 0,onClose:()=>as(null)}),gt(fg,{transitionDuration:0,anchorEl:Na?.anchorEl??null,open:!!Na,onClose:()=>ua(null),children:["high","medium","low"].map(A=>ti(Qs,{selected:da?.priority===A,onClick:()=>{da&&Ze?.(da.seq,A),ua(null)},sx:{fontSize:14,minWidth:130,gap:1},children:[gt(po,{priority:A,small:!0}),da?.priority===A?gt(qu,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},A))}),ti(fg,{anchorEl:Wo?.anchorEl??null,open:!!Wo,onClose:()=>An(null),transitionDuration:0,children:[ti(Qs,{selected:!Wo?.task.tab_key,onClick:()=>{Wo&&C(Wo.task.seq,""),An(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[gt(uB,{sx:{fontSize:17,color:"#9a9a97"}}),n("common.none"),Wo?.task.tab_key?null:gt(qu,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}})]}),x.filter(A=>!A.archived).map(A=>{let ne=Le(A.icon),Pe=Wo?.task.tab_key===A.key;return ti(Qs,{selected:Pe,onClick:()=>{Wo&&C(Wo.task.seq,A.key),An(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[ne?gt(ne,{sx:{fontSize:17,color:"#1e3a8a"}}):null,A.label,Pe?gt(qu,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},A.key)}),y?[gt(sB,{},"add-project-divider"),ti(Qs,{onClick:()=>rs(!0),sx:{fontSize:14,color:"#787774"},children:[gt(cB,{children:gt(mB,{sx:{fontSize:18,color:"#787774"}})}),n("table.addProject")]},"add-project")]:null]}),y?gt(Ms,{open:ns,onClose:()=>rs(!1),onSubmit:(A,ne)=>{let Pe=Wo?.task.seq??0;(async()=>{let tt=await y(A,ne);tt&&Pe&&C(Pe,tt)})(),An(null)}}):null,gt(Kr,{anchorEl:qn?.anchorEl??null,value:Ni?.icon??"",color:Ni?.icon_color??"",onSelect:A=>{qn&&z?.(qn.taskSeq,A),zi(null)},onSelectColor:k?A=>{qn&&k(qn.taskSeq,A)}:void 0,onClose:()=>zi(null)}),gt(ln,{anchorEl:Fe?.anchorEl??null,open:!!Fe&&Fe?.field==="start_date",date:Fe?.date??"",reminders:[],hideReminder:!0,showTime:!Fe?.isEvent,onClose:()=>Nr(null),onDateChange:Wa,onReminderChange:()=>{}}),gt(ln,{anchorEl:Fe?.anchorEl??null,open:!!Fe&&Fe?.field==="due_date",date:Fe?.date??"",showTime:!Fe?.isEvent||!!p,autoFillTime:!Fe?.isEvent,reminders:Fe?.reminders??[],hideReminder:!!Fe?.completed,onClose:()=>Nr(null),onDateChange:Wa,onReminderChange:Cm}),gt(pB,{open:!!Ve,anchorEl:Ve?.anchorEl??null,title:Ve?.kind==="claim"?n("table.claimTakeOverConfirm"):n("table.claimConfirm"),confirmText:n("col.claim"),onCancel:()=>Oo(null),onConfirm:()=>{Ve&&M?.(Ve.taskSeq),Oo(null)}}),gt(Lo,{open:!!Ho,anchorEl:Ho?.anchorEl??null,nextCompleted:Ho?.nextCompleted??!1,returnMode:!!sr&&!!(Ho&&no(Ho.task,W)),onCancel:()=>zt(null),onConfirm:A=>{Ho&&(A&&sr?sr(Ho.task,A):u(Ho.task,Ho.nextCompleted)),zt(null)}})]})}import{useCallback as Un,useMemo as dr,useRef as WB,useState as _n}from"react";import{Box as Ue,ButtonBase as Pg,Divider as Cg,IconButton as Sg,Menu as vg,MenuItem as Jr}from"@mui/material";import Wu from"@mui/icons-material/Add";import Bg from"@mui/icons-material/MoreVert";import _g from"@mui/icons-material/EditOutlined";import Ig from"@mui/icons-material/ArchiveOutlined";import wg from"@mui/icons-material/UnarchiveOutlined";import $B from"@mui/icons-material/NotificationsOutlined";import VB from"@mui/icons-material/PeopleAltOutlined";import{SvgIcon as bB}from"@mui/material";import{jsx as bg}from"react/jsx-runtime";function Qt({sx:e,...t}){return bg(bB,{viewBox:"0 0 24 24",...t,sx:{fill:"none",...e},children:bg("path",{d:"M4 6H20M16 6L15.7294 5.18807C15.4671 4.40125 15.3359 4.00784 15.0927 3.71698C14.8779 3.46013 14.6021 3.26132 14.2905 3.13878C13.9376 3 13.523 3 12.6936 3H11.3064C10.477 3 10.0624 3 9.70951 3.13878C9.39792 3.26132 9.12208 3.46013 8.90729 3.71698C8.66405 4.00784 8.53292 4.40125 8.27064 5.18807L8 6M18 6V16.2C18 17.8802 18 18.7202 17.673 19.362C17.3854 19.9265 16.9265 20.3854 16.362 20.673C15.7202 21 14.8802 21 13.2 21H10.8C9.11984 21 8.27976 21 7.63803 20.673C7.07354 20.3854 6.6146 19.9265 6.32698 19.362C6 18.7202 6 17.8802 6 16.2V6M14 10V17M10 10V17",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}import{DndContext as KB,DragOverlay as UB,PointerSensor as GB,pointerWithin as jB,rectIntersection as YB,useDroppable as XB,useSensor as QB,useSensors as JB}from"@dnd-kit/core";import{SortableContext as Og,arrayMove as Dg,horizontalListSortingStrategy as ZB,useSortable as e_,verticalListSortingStrategy as t_}from"@dnd-kit/sortable";import{CSS as o_}from"@dnd-kit/utilities";import $u from"@ehfuse/overlay-scrollbar";import{ConfirmActionPopper as ec}from"@ehfuse/mui-confirm-action";import{useState as _B}from"react";import{Box as Kn,ButtonBase as IB,Checkbox as wB,Tooltip as hg}from"@mui/material";import DB from"@mui/icons-material/AlarmOutlined";import EB from"@mui/icons-material/DragIndicator";import RB from"@mui/icons-material/RadioButtonUnchecked";import PB from"@mui/icons-material/CheckCircle";import OB from"@mui/icons-material/TimerOutlined";import{Box as Bn,Button as TB,Popover as yB}from"@mui/material";import CB from"@mui/icons-material/CheckCircle";import{useMediaQuery as hB,useTheme as kB}from"@mui/material";function $e(){let{isMobile:e}=se(),t=kB(),o=hB(t.breakpoints.up("lg"));return e!==void 0?e:!o}import{Fragment as SB,jsx as $n,jsxs as ya}from"react/jsx-runtime";function Js({anchorEl:e,open:t,acks:o,total:a,avatarSrcByName:r,pendingNames:i=[],onRequestConfirm:l,onClose:s}){L();let c=$e();return $n(yB,{open:t&&(c||!!e),anchorEl:e,onClose:s,transitionDuration:0,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},...c?{anchorReference:"none",slotProps:{paper:{sx:{position:"fixed",top:"50%",left:"50%",translate:"-50% -50%",maxWidth:"calc(100vw - 48px)",maxHeight:"70vh",borderRadius:3}}}}:{},children:ya(Bn,{sx:{minWidth:240,maxWidth:320,py:1},children:[ya(Bn,{sx:{px:2,pb:.75,fontSize:pt(13.5),fontWeight:600,color:"#37352f",borderBottom:"1px solid #efefed"},children:[n("task.confirm")," ",o.length,"/",a]}),i.length>0&&o.length>0?ya(Bn,{sx:{px:2,pt:1,pb:.5,fontSize:pt(12.5),fontWeight:600,color:"#9a9a97"},children:[n("task.confirm")," ",o.length]}):null,o.length===0?i.length>0?null:$n(Bn,{sx:{px:2,py:1.5,fontSize:pt(13.5),color:"#9a9a97"},children:n("menu.noAckYet")}):o.map(u=>ya(Bn,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:.75,minWidth:0},children:[$n(vo,{names:[u.name],size:22,avatarSrcByName:r}),$n(Bn,{component:"span",sx:{fontSize:pt(14),color:"#37352f",whiteSpace:"nowrap"},children:u.name}),$n(Bn,{component:"span",sx:{ml:"auto",fontSize:pt(12.5),color:"#9a9a97",whiteSpace:"nowrap"},children:Ko(u.time)}),$n(CB,{sx:{fontSize:16,color:"#2f80ed",flexShrink:0}})]},u.account_seq)),i.length>0?ya(SB,{children:[ya(Bn,{sx:{mt:o.length>0?.75:0,px:2,pt:1,pb:.5,borderTop:o.length>0?"1px solid #efefed":"none",fontSize:pt(12.5),fontWeight:600,color:"#9a9a97"},children:[n("menu.unacknowledged")," ",i.length]}),i.map(u=>ya(Bn,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:.75,minWidth:0},children:[$n(vo,{names:[u],size:22,avatarSrcByName:r}),$n(Bn,{component:"span",sx:{fontSize:pt(14),color:"#37352f",whiteSpace:"nowrap"},children:u})]},u))]}):null,l?$n(Bn,{sx:{borderTop:"1px solid #efefed",px:1.5,pt:1,pb:1},children:$n(TB,{size:"small",fullWidth:!0,variant:"outlined",onClick:()=>{l(),s()},sx:{fontSize:pt(14),py:.9},children:n("menu.requestConfirm")})}):null]})})}function vB(e){let t=Number(e.author_account_seq??0);return[...new Set([Number(e.manager_account_seq??0),...e.receiver_account_seqs??[]].filter(o=>o>0&&o!==t))]}function BB(e){let t=new Map,o=Number(e.manager_account_seq??0);o>0&&t.set(o,String(e.manager_name??"").trim());let a=e.receiver_account_seqs??[],r=e.receiver_names??[];return a.forEach((i,l)=>{i>0&&!t.has(i)&&t.set(i,String(r[l]??"").trim())}),t}function Vn(e,t){let o=vB(e),a=e.acks??[],r=t>0?a.find(s=>s.account_seq===t):void 0,i=new Set(a.map(s=>s.account_seq)),l=BB(e);return{myTime:r?.time??"",canConfirm:t>0&&o.includes(t)&&!r,count:a.filter(s=>o.includes(s.account_seq)).length,total:o.length,pendingNames:o.filter(s=>!i.has(s)).map(s=>l.get(s)??"").filter(s=>s.length>0)}}function p3(e){let t=String(e??"").trim();return t?t.slice(5,16).replaceAll("-","."):""}import{Fragment as AB,jsx as Mt,jsxs as oi}from"react/jsx-runtime";function Zs(e){return{border:`1px solid ${e.borderColor}`,borderRadius:1,p:1,bgcolor:e.bg,display:"flex",flexDirection:"column",gap:.75,boxShadow:"0 1px 2px rgba(0,0,0,0.04)",...e.sx}}var MB=3;function LB(e){let t=e.trim();return t?t.slice(2,10).replaceAll("-","."):"-"}function kg(){let e=new Date,t=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${e.getFullYear()}-${t}-${o}`}var zu="taskbox-card-drag-handle";function ul({task:e,statusOptions:t,showDueDate:o=!1,onRequestArchiveToggle:a,onRequestReply:r,onDueDateClick:i,titleFontSize:l=13,dragHandleProps:s}){L();let c=be(),u=Ya(e,se().resolveTask),m=!!e.due_date&&e.due_date.slice(0,10)<=kg(),p=!!e.is_event&&!!e.due_date&&e.due_date.slice(0,10)<kg()?c.colors.textSecondary:m?c.colors.danger:c.colors.textPrimary,f=Vn(e,0),[g,x]=_B(null),h=Ua(e,t),E=new Set(e.label_keys??[]),b=h.filter(T=>!E.has(T.key)),B=h.filter(T=>E.has(T.key));return oi(AB,{children:[oi(Kn,{sx:{display:"flex",alignItems:"flex-start",gap:.5},children:[s?Mt(Kn,{className:zu,...s,onClick:T=>T.stopPropagation(),sx:{display:"inline-flex",alignItems:"center",flexShrink:0,ml:-.5,mr:-.25,color:c.colors.textMuted,cursor:"grab",touchAction:"none","&:active":{cursor:"grabbing"}},children:Mt(EB,{sx:{fontSize:18}})}):null,Mt(wB,{size:"small",icon:Mt(RB,{sx:{fontSize:20}}),checkedIcon:Mt(PB,{sx:{fontSize:20}}),checked:e.completed,inputProps:{"aria-label":e.completed?n("col.uncompleteAria",{title:e.title}):n("col.completeAria",{title:e.title})},onPointerDown:T=>T.stopPropagation(),onClick:T=>T.stopPropagation(),onChange:(T,z)=>a?.({anchorEl:T.currentTarget,taskSeq:e.seq,nextCompleted:z}),sx:{p:0}}),Mt(hg,{title:e.title,arrow:!0,enterDelay:300,children:oi(Kn,{sx:{flex:1,minWidth:0,pr:1,fontSize:l,fontWeight:c.mode==="dark"||e.completed?400:500,color:e.completed?c.colors.textMuted:c.mode==="dark"?c.colors.textStrong:c.colors.textPrimary,lineHeight:1.35,overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:MB,overflowWrap:"anywhere"},children:[e.is_event&&e.event_time?`${e.event_time} `:"",e.title,u?Mt(Kn,{component:"span",sx:{ml:.75,fontSize:12.5,fontWeight:400,color:c.colors.textMuted,fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap",textDecoration:"none"},children:u}):null,(e.comment_count??e.comments?.length??0)>0?Mt(Xr,{sx:{fontSize:15,ml:.5,verticalAlign:"-2px",color:c.colors.textMuted}}):null]})})]}),e.is_bug&&e.ticket_no?Mt(Kn,{sx:{pl:3,mt:-.5,fontSize:12.5,color:c.colors.textSecondary,fontWeight:500,fontVariantNumeric:"tabular-nums"},children:e.ticket_no}):null,oi(Kn,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:.5},children:[oi(Kn,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5,minWidth:0},children:[b.map(T=>Mt(Ke,{option:T,small:!0},T.key)),Mt(po,{priority:e.priority,small:!0}),B.map(T=>Mt(Ke,{option:T,small:!0},T.key))]}),o?Mt(hg,{title:n("col.due"),arrow:!0,placement:"top",disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Mt(IB,{disabled:!i,onPointerDown:T=>T.stopPropagation(),onClick:T=>{T.stopPropagation(),i?.(e,T.currentTarget)},sx:{display:"inline-flex",alignItems:"center",px:.5,py:.1,borderRadius:.75,fontSize:13,fontWeight:500,color:p,whiteSpace:"nowrap","&:hover":i?{bgcolor:c.colors.border}:void 0},children:String(e.due_date??"").trim()?LB(e.due_date):Mt(DB,{sx:{fontSize:15,color:c.colors.textMuted}})})}):null]}),o&&(e.due_date.slice(11,16)||e.estimated_time)?oi(Kn,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:.25,mt:-.5,fontSize:12,color:c.colors.textSecondary},children:[Mt(OB,{sx:{fontSize:14}}),e.due_date.slice(11,16)||e.estimated_time]}):null,Mt(vo,{names:[...Sn(e)?[Sn(e)]:[],...e.receiver_names],size:20,ringFirst:!!Sn(e)}),f.total>0?Mt(Kn,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:.5},children:Mt(Kn,{sx:{flexShrink:0,width:64},onPointerDown:T=>T.stopPropagation(),onClick:T=>T.stopPropagation(),children:Mt(Qa,{canConfirm:!1,count:f.count,total:f.total,onConfirm:()=>{},onShowList:T=>x(T)})})}):null,Mt(Js,{anchorEl:g,open:!!g,acks:e.acks??[],total:f.total,pendingNames:f.pendingNames,onRequestConfirm:r&&f.count<f.total?()=>{r(e),x(null)}:void 0,onClose:()=>x(null)})]})}import{Box as qB}from"@mui/material";import{useSortable as zB}from"@dnd-kit/sortable";import{CSS as NB}from"@dnd-kit/utilities";import{jsx as Tg}from"react/jsx-runtime";function FB(e){return{px:1.25,py:1,display:"flex",flexDirection:"column",gap:.75,borderBottom:`1px solid ${e.borderColor}`,bgcolor:e.bg}}function yg({task:e,statusOptions:t,variant:o="card",showDueDate:a=!1,onRequestArchiveToggle:r,onRequestReply:i,onDueDateClick:l,onCardClick:s,onCardContextMenu:c,titleFontSize:u}){let m=be(),{attributes:d,listeners:p,setNodeRef:f,transform:g,transition:x,isDragging:h}=zB({id:String(e.seq)}),E=o==="list";return Tg(qB,{ref:f,onClick:s?()=>s(e):void 0,onContextMenu:c?b=>c(e,b):void 0,sx:{...E?FB(m.card):Zs(m.card),opacity:h?.35:e.completed?.55:1,transform:NB.Translate.toString(g),transition:x,position:"relative",cursor:"default","&:hover":E?{bgcolor:m.card.hoverBg}:{boxShadow:"0 3px 8px rgba(0,0,0,0.1)"}},children:Tg(ul,{task:e,statusOptions:t,showDueDate:a,onRequestArchiveToggle:r,onRequestReply:i,onDueDateClick:l,titleFontSize:u,dragHandleProps:{...d,...p}})})}function HB(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?e.slice(5).replace("-","."):""}function cn(e){if(e.status==="closed")return n("group.closedSuffix",{name:e.name});let t=HB(e.end_date);return t?`${e.name} (~${t})`:e.name}import{jsx as ge,jsxs as xt}from"react/jsx-runtime";var Eg=2,Mg="taskbox-column-drag-handle",Vu=[zu,Mg],tc="group-",mn="colmove-",Nu="__default__",Fu=fu,Hu="__other__",oc="sprint-",Rg=`${oc}0`,n_={planning:"#9a9a97",active:"#2f80ed",closed:"#9a9a97"};function Lg(e){return{flexShrink:0,width:e.width,py:e.paddingY,borderRadius:`${e.borderRadius}px`,bgcolor:e.bg,border:e.border,color:e.color,fontSize:e.fontSize,fontWeight:e.fontWeight,lineHeight:1.6,textAlign:"center",fontVariantNumeric:"tabular-nums",...e.sx}}function r_({column:e,tasks:t,statusOptions:o,onRequestArchiveToggle:a,onRequestReply:r,onDueDateClick:i,onAddTask:l,canAdd:s,onOpenMenu:c,onCardClick:u,onCardContextMenu:m,grow:d,summary:p,onOpenSprintMenu:f}){L();let g=be(),{setNodeRef:x,isOver:h}=XB({id:`${tc}${e.key}`}),{attributes:E,listeners:b,setNodeRef:B,transform:T,transition:z,isDragging:k}=e_({id:`${mn}${e.key}`,disabled:e.isDefault||e.isArchived||!!e.locked});return xt(Ue,{ref:_=>{x(_),B(_)},sx:{flex:d?"1 0 270px":"0 0 270px",minWidth:270,contain:"inline-size",minHeight:0,maxHeight:"100%",display:"flex",flexDirection:"column",borderRadius:1.5,boxShadow:_=>_.shadows[1],bgcolor:h?g.colors.accentSoft:g.board.columnBg,transition:"background-color 0.15s",overflow:"hidden",transform:o_.Translate.toString(T),...z?{transition:`${z}, background-color 0.15s`}:{},opacity:k?.6:1},children:[xt(Ue,{className:Mg,...E,...b,sx:{display:"flex",alignItems:"center",gap:.75,pl:1.25,pr:.5,py:1.1,borderBottom:`1px solid ${g.card.borderColor}`,flexShrink:0,touchAction:"none",cursor:e.isDefault||e.isArchived||e.locked?"default":"grab",opacity:e.isArchived?.65:1},children:[e.dot?ge(Ue,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:e.dot,flexShrink:0}}):e.isDefault?null:(()=>{let _=Le(e.icon);return _?ge(_,{sx:{fontSize:17,color:"#1e3a8a"}}):null})(),ge(Ue,{component:"span",sx:{fontSize:g.board.columnHeaderFontSize,fontWeight:700,color:g.board.columnHeaderColor,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),ge(Ue,{component:"span",sx:{...Lg(g.board.badge),ml:"auto"},children:t.length}),e.sprint&&f?ge(Sg,{size:"small","aria-label":n("board.goalMenu"),onPointerDown:_=>_.stopPropagation(),onClick:_=>f(_.currentTarget,e.sprint),sx:{color:"#9a9a97"},children:ge(Bg,{sx:{fontSize:18}})}):e.locked?null:ge(Sg,{size:"small","aria-label":n("board.projectMenu"),onPointerDown:_=>_.stopPropagation(),onClick:_=>c({anchorEl:_.currentTarget,column:e}),sx:{color:"#9a9a97"},children:ge(Bg,{sx:{fontSize:18}})})]}),p?ge(Ue,{sx:{px:1.25,py:1.25,borderBottom:`1px solid ${g.card.borderColor}`,flexShrink:0},children:p}):null,ge(Ue,{sx:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column"},children:ge($u,{style:{height:"auto",flex:"1 1 auto",minHeight:0},contentStyle:{minWidth:0},thumb:{width:6},dragScroll:{excludeClasses:Vu},children:xt(Ue,{sx:{display:"flex",flexDirection:"column",flexGrow:1},children:[ge(Og,{items:t.map(_=>String(_.seq)),strategy:t_,children:t.map(_=>ge(yg,{task:_,statusOptions:o,variant:"list",showDueDate:!0,titleFontSize:15,onRequestArchiveToggle:a,onRequestReply:r,onDueDateClick:i,onCardClick:u,onCardContextMenu:m},_.seq))}),t.length===0&&!s?ge(Ue,{sx:{py:3,textAlign:"center",fontSize:13,color:"#9a9a97"},children:n("board.noCards")}):null,t.length===0&&s?ge(Ue,{sx:{flexGrow:1,minHeight:56,display:"flex",flexDirection:"column","&:hover .taskbox-board-add":{opacity:1,pointerEvents:"auto"}},children:xt(Pg,{className:"taskbox-board-add",onClick:()=>l(e.isDefault?"":e.key),sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,px:1.25,py:1.75,borderBottom:`1px dashed ${g.card.borderColor}`,bgcolor:g.card.bg,color:g.colors.accentOnSurface,fontSize:13,fontWeight:500,opacity:0,pointerEvents:"none",transition:"opacity 0.15s","&:hover":{bgcolor:g.card.hoverBg}},children:[ge(Wu,{sx:{fontSize:16}}),n("task.addTask")]})}):null]})})})]})}function Ku({tasks:e,statusOptions:t,customTabs:o,mode:a="active",onToggleCompleted:r,onRequestReply:i,onChangeDueDate:l,onChangeReminder:s,onMoveTask:c,columnAxis:u="project",statusColumns:m=[],statusKeyOf:d,closedColumn:p=!0,otherColumnLabel:f=n("board.other"),onMoveTaskStatus:g,sprintColumns:x=[],onMoveTaskSprint:h,onAddGroup:E,onAddTask:b,canAdd:B=!0,onRequestRename:T,onArchiveProject:z,onDeleteProject:k,onReorderProjects:_,onOpenDetail:D,onTaskContextMenu:F,hideCompleted:R=!1,renderColumnSummary:C,onEditSprint:y,onChangeSprintStatus:I,onRemoveSprint:S}){let M=L(),w=be(),{onReturnTask:q,myAccountSeq:v=0}=se(),[O,j]=_n(null),V=O?e.find(U=>U.seq===O.taskSeq):void 0,[Z,ie]=_n(null),[ue,K]=_n(null),[te,$]=_n(null),[G,ae]=_n(null),[Re,mt]=_n(null),[ce,Q]=_n(null),[W,X]=_n(null),[le,pe]=_n(null),[De,ve]=_n(null),[It,We]=_n(null),Ee=WB(!1),ut=dr(()=>new Map(e.map(U=>[U.seq,U])),[e]),je=dr(()=>{let U=e.filter(P=>P.is_notice);return U.sort((P,me)=>P.completed!==me.completed?P.completed?1:-1:me.seq-P.seq),U},[e]),co=dr(()=>o.filter(U=>!U.archived),[o]),kt=dr(()=>o.filter(U=>U.archived),[o]),oe=U=>({key:U.key,label:U.label,icon:U.icon,isDefault:!1,isArchived:U.archived}),_e=dr(()=>new Set(m.map(U=>U.key)),[m]),Ze=dr(()=>new Set(x.map(U=>U.seq)),[x]),ze=dr(()=>{if(u==="sprint")return[{key:Rg,label:n("board.unassigned"),icon:"",isDefault:!0,isArchived:!1,dot:"#c9c8c5",locked:!0},...x.map(U=>({key:`${oc}${U.seq}`,label:cn(U),icon:"",isDefault:!1,isArchived:!1,dot:n_[U.status],locked:!0,sprint:U}))];if(u==="status"){let U=m.map(P=>({key:P.key,label:P.name,icon:"",isDefault:!1,isArchived:!1,dot:P.dot,locked:!0}));return!p||U.some(P=>P.key===Fu)?U:[...U,{key:Fu,label:n("common.done"),icon:"",isDefault:!1,isArchived:!1,dot:"#2f80ed",locked:!0}]}return a==="archived"?kt.map(oe):[{key:Nu,label:ja(),icon:"",isDefault:!0,isArchived:!1},...co.map(oe)]},[u,m,p,x,a,co,kt,M]),tn=JB(QB(GB,{activationConstraint:{distance:5}})),qr=Un(U=>{let P=String(U.active.id).startsWith(mn),me=jB(U),xe=me.length>0?me:YB(U);if(P)return xe.filter(at=>String(at.id).startsWith(mn));let et=xe.filter(at=>!String(at.id).startsWith(mn)),Ye=et.filter(at=>!String(at.id).startsWith(tc));return Ye.length>0?Ye:et},[]),mo=dr(()=>{let U=new Map;for(let P of e){if(P.is_notice)continue;let me;if(u==="sprint"){let et=P.sprint_seq??0;me=Ze.has(et)?`${oc}${et}`:Rg}else me=u==="status"?P.completed&&p?Fu:_e.has(d?d(P):String(P.status??""))?d?d(P):String(P.status??""):Hu:P.tab_key?.trim()||Nu;let xe=U.get(me);xe?xe.push(P):U.set(me,[P])}for(let P of U.values())P.sort((me,xe)=>{if(me.completed!==xe.completed)return me.completed?1:-1;let et=(me.group_sort_no??0)>0,Ye=(xe.group_sort_no??0)>0;return et&&Ye?(me.group_sort_no??0)-(xe.group_sort_no??0):et!==Ye?et?-1:1:me.due_date!==xe.due_date?me.due_date<xe.due_date?-1:1:me.seq-xe.seq});return U},[e,u,_e,Ze,d,p]),or=dr(()=>u!=="status"||(mo.get(Hu)??[]).length===0?ze:[...ze,{key:Hu,label:f,icon:"",isDefault:!1,isArchived:!1,dot:"#c9c8c5",locked:!0}],[u,ze,mo,f]),bn=Un(U=>le?(le.get(U)??[]).map(P=>ut.get(P)).filter(P=>!!P):mo.get(U)??[],[le,ut,mo]),nr=Un(U=>{let P=bn(U);return R?P.filter(me=>!me.completed):P},[bn,R]),Kt=Un(U=>{let P=String(U.active.id);if(P.startsWith(mn)){We(P.slice(mn.length));return}ve(Number(P)),pe(new Map(ze.map(me=>[me.key,(mo.get(me.key)??[]).map(xe=>xe.seq)])))},[ze,mo]),hn=Un((U,P)=>{if(U.startsWith(tc))return{key:U.slice(tc.length),overSeq:null};let me=Number(U);for(let[xe,et]of P)if(et.includes(me))return{key:xe,overSeq:me};return null},[]),Yt=Un(U=>{let{active:P,over:me}=U;!me||String(P.id).startsWith(mn)||pe(xe=>{if(!xe)return xe;let et=Number(P.id),Ye=hn(String(me.id),xe);if(!Ye)return xe;let at=[...xe.entries()].find(([,Xt])=>Xt.includes(et))?.[0];if(!at||at===Ye.key)return xe;let wt=new Map(xe);wt.set(at,(wt.get(at)??[]).filter(Xt=>Xt!==et));let eo=[...wt.get(Ye.key)??[]],qt=eo.length;if(Ye.overSeq!==null){let Xt=eo.indexOf(Ye.overSeq);Xt!==-1&&(qt=Xt)}return eo.splice(qt,0,et),wt.set(Ye.key,eo),wt})},[hn]),rr=Un(U=>{let P=String(U.active.id);if(P.startsWith(mn)){We(null);let qt=String(U.over?.id??"");if(!qt.startsWith(mn))return;let Xt=P.slice(mn.length),ar=qt.slice(mn.length);if(Xt===ar)return;let ir=o.map(sr=>sr.key),lr=ir.indexOf(Xt),zr=ir.indexOf(ar);if(lr===-1||zr===-1)return;_(Dg(ir,lr,zr));return}let me=le;if(pe(null),ve(null),Ee.current=!0,!me||!U.over)return;let xe=Number(P),et=[...me.entries()].find(([,qt])=>qt.includes(xe));if(!et)return;let[Ye,at]=et,wt=[...at],eo=hn(String(U.over.id),me);if(eo&&eo.key===Ye&&eo.overSeq!==null&&eo.overSeq!==xe){let qt=wt.indexOf(xe),Xt=wt.indexOf(eo.overSeq);qt!==-1&&Xt!==-1&&(wt=Dg(wt,qt,Xt))}if(u==="status"){g?.(xe,Ye);return}if(u==="sprint"){h?.(xe,Number(Ye.slice(oc.length))||0);return}c(xe,Ye===Nu?"":Ye,wt)},[o,le,hn,c,_,u,g,h]),dt=Un(()=>{pe(null),ve(null),We(null),Ee.current=!0},[]),Po=Un(U=>{if(Ee.current){Ee.current=!1;return}D(U)},[D]),kn=De!==null?ut.get(De)??null:null,rt=It!==null?ze.find(U=>U.key===It)??null:null,Ln=Un((U,P)=>{X({anchorEl:P,taskSeq:U.seq,date:U.due_date,reminders:rn(U)})},[]),Oe=Z?.column??null;return xt(Ue,{sx:{flex:1,minHeight:0,height:"100%",display:"flex",flexDirection:"column",border:`1px solid ${w.card.borderColor}`,borderRadius:"0 0 4px 4px",overflow:"hidden",bgcolor:w.colors.surfaceSubtle},children:[xt(KB,{sensors:tn,collisionDetection:qr,onDragStart:Kt,onDragOver:Yt,onDragEnd:rr,onDragCancel:dt,children:[ge(Ue,{sx:{flex:1,minHeight:0,minWidth:0,contain:"inline-size"},children:a==="archived"&&ze.length===0?ge(Ue,{sx:{py:8,textAlign:"center",color:"#9a9a97",fontSize:14},children:n("board.noArchivedProjects")}):ge($u,{style:{height:"100%"},contentStyle:{width:"max-content",minWidth:"100%",height:"100%"},thumb:{width:8},showHorizontalScrollbar:!0,dragScroll:{excludeClasses:Vu},children:xt(Ue,{sx:{display:"flex",alignItems:"flex-start",gap:Eg,height:"100%",minWidth:"min-content",p:Eg,boxSizing:"border-box"},children:[a==="active"&&je.length>0?xt(Ue,{sx:{flex:u!=="project"?"1 0 270px":"0 0 270px",minWidth:270,contain:"inline-size",minHeight:0,maxHeight:"100%",display:"flex",flexDirection:"column",borderRadius:1.5,boxShadow:U=>U.shadows[1],bgcolor:w.card.bg,overflow:"hidden"},children:[xt(Ue,{sx:{display:"flex",alignItems:"center",gap:.75,pl:1.25,pr:.5,py:1.1,borderBottom:`1px solid ${w.card.borderColor}`,flexShrink:0,minHeight:48},children:[ge($B,{sx:{fontSize:17,color:"#e8763a"}}),ge(Ue,{component:"span",sx:{fontSize:14.5,fontWeight:700,color:w.board.columnHeaderColor},children:n("tab.notice")}),xt(Ue,{component:"span",sx:{fontSize:13,color:"#9a9a97",flexShrink:0},children:["(",je.length,")"]})]}),ge(Ue,{sx:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column"},children:ge($u,{style:{height:"auto",flex:"1 1 auto",minHeight:0},contentStyle:{minWidth:0},dragScroll:{excludeClasses:Vu},thumb:{width:6},children:ge(Ue,{sx:{display:"flex",flexDirection:"column"},children:je.map(U=>xt(Ue,{onClick:()=>Po(U),onContextMenu:P=>F(U,P),sx:{px:1.25,py:1,display:"flex",flexDirection:"column",gap:.75,borderBottom:`1px solid ${w.card.borderColor}`,bgcolor:w.card.bg,cursor:"pointer","&:hover":{bgcolor:w.card.hoverBg}},children:[ge(ul,{task:U,statusOptions:t,showDueDate:!0,titleFontSize:15,onRequestArchiveToggle:j}),(()=>{let P=(U.target_names??[]).filter(xe=>xe.trim());if(P.length===0)return null;let me=P.length>2?n("board.namesAndMore",{value:P[0],value2:P[1],value3:P.length-2}):P.join(", ");return xt(Ue,{sx:{display:"flex",alignItems:"center",gap:.5,fontSize:12.5,color:"#787774",overflow:"hidden",whiteSpace:"nowrap"},children:[ge(VB,{sx:{fontSize:14,flexShrink:0}}),ge(Ue,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis"},children:me})]})})()]},U.seq))})})})]}):null,ge(Og,{items:co.map(U=>`${mn}${U.key}`),strategy:ZB,children:or.map(U=>ge(r_,{column:U,tasks:nr(U.key),summary:C?.(U.key,bn(U.key)),onOpenSprintMenu:y||I||S?(P,me)=>K({anchorEl:P,sprint:me}):void 0,statusOptions:t,onRequestArchiveToggle:j,onRequestReply:i,onDueDateClick:Ln,onAddTask:b,canAdd:B&&u==="project",onOpenMenu:ie,onCardClick:Po,onCardContextMenu:F,grow:u!=="project"},U.key))}),a==="active"&&u==="project"?xt(Pg,{onClick:E,sx:{flex:"0 0 270px",minWidth:270,display:"flex",alignItems:"center",justifyContent:"center",gap:.5,py:2,border:"1.5px dashed #cfcfcc",borderRadius:1.5,color:"#787774",fontSize:14,"&:hover":{bgcolor:"#eef2f6",borderColor:"#9a9a97"}},children:[ge(Wu,{sx:{fontSize:18}}),"\uC0C8",n("col.project")]}):null,a==="active"&&or.length===0&&je.length===0?ge(Ue,{sx:{flex:1,minWidth:240,display:"flex",alignItems:"center",justifyContent:"center",color:"#9a9a97",fontSize:14,py:6},children:u==="project"?n("board.noProjects"):n("table.emptyTasks")}):null]})})}),ge(UB,{children:kn?ge(Ue,{sx:{...Zs,width:250,boxShadow:"0 8px 20px rgba(0,0,0,0.18)",cursor:"grabbing"},children:ge(ul,{task:kn,statusOptions:t,showDueDate:!0,titleFontSize:15})}):rt?xt(Ue,{sx:{display:"flex",alignItems:"center",gap:.75,width:270,px:1.25,py:1,bgcolor:w.card.bg,border:`1px solid ${w.card.borderColor}`,borderRadius:1.5,boxShadow:"0 8px 20px rgba(0,0,0,0.18)",opacity:.9,cursor:"grabbing"},children:[(()=>{let U=Le(rt.icon);return U?ge(U,{sx:{fontSize:17,color:"#1e3a8a"}}):null})(),ge(Ue,{component:"span",sx:{fontSize:13.5,fontWeight:700,color:w.board.columnHeaderColor},children:rt.label}),ge(Ue,{component:"span",sx:Lg(w.board.badge),children:(mo.get(rt.key)??[]).length})]}):null})]}),xt(vg,{transitionDuration:0,anchorEl:Z?.anchorEl??null,open:!!Z,onClose:()=>ie(null),children:[Oe&&!Oe.isArchived&&B?xt(Jr,{onClick:()=>{Oe&&b(Oe.isDefault?"":Oe.key),ie(null)},sx:{fontSize:14,gap:1},children:[ge(Wu,{sx:{fontSize:18,color:"#787774"}}),"\uC0C8",n("task.addTask")]}):null,Oe&&!Oe.isDefault&&!Oe.isArchived?xt(Jr,{onClick:()=>{T(Oe.key,Oe.label,Oe.icon),ie(null)},sx:{fontSize:14,gap:1},children:[ge(_g,{sx:{fontSize:18,color:"#787774"}}),n("common.edit")]}):null,Oe&&!Oe.isDefault&&!Oe.isArchived?xt(Jr,{onClick:()=>{if(Z){let U=(mo.get(Z.column.key)??[]).filter(P=>!P.completed&&!P.archived).length;U>0?mt({anchorEl:Z.anchorEl,count:U}):ae(Z)}ie(null)},sx:{fontSize:14,gap:1},children:[ge(Ig,{sx:{fontSize:18,color:"#787774"}}),n("menu.archive")]}):null,Oe&&Oe.isArchived?xt(Jr,{onClick:()=>{z(Oe.key,!1),ie(null)},sx:{fontSize:14,gap:1},children:[ge(wg,{sx:{fontSize:18,color:"#787774"}}),n("menu.restore")]}):null,Oe&&!Oe.isDefault?ge(Cg,{}):null,Oe&&!Oe.isDefault?xt(Jr,{onClick:()=>{Z&&Q(Z),ie(null)},sx:{fontSize:14,gap:1,color:"#e5484d"},children:[ge(Qt,{sx:{fontSize:18}}),n("common.delete")]}):null]}),xt(vg,{transitionDuration:0,anchorEl:ue?.anchorEl??null,open:!!ue,onClose:()=>K(null),children:[y?xt(Jr,{onClick:()=>{ue&&y(ue.sprint.seq),K(null)},sx:{fontSize:14,gap:1},children:[ge(_g,{sx:{fontSize:18,color:"#787774"}}),n("board.editGoal")]}):null,I?xt(Jr,{onClick:()=>{ue&&I(ue.sprint.seq,ue.sprint.status==="closed"?"active":"closed"),K(null)},sx:{fontSize:14,gap:1},children:[ue?.sprint.status==="closed"?ge(wg,{sx:{fontSize:18,color:"#787774"}}):ge(Ig,{sx:{fontSize:18,color:"#787774"}}),ue?.sprint.status==="closed"?n("board.restartGoal"):n("board.closeGoal")]}):null,S?ge(Cg,{}):null,S?xt(Jr,{onClick:()=>{ue&&$(ue),K(null)},sx:{fontSize:14,gap:1,color:"#e5484d"},children:[ge(Qt,{sx:{fontSize:18}}),n("board.deleteGoal")]}):null]}),ge(ec,{open:!!te,anchorEl:te?.anchorEl??null,title:n("board.deleteGoalConfirm",{name:te?.sprint.name??""}),confirmText:n("common.delete"),onCancel:()=>$(null),onConfirm:()=>{te&&S?.(te.sprint.seq),$(null)}}),ge(ln,{anchorEl:W?.anchorEl??null,open:!!W,date:W?.date??"",reminders:W?.reminders??[],onClose:()=>X(null),onDateChange:U=>{W&&(l(W.taskSeq,U),X(P=>P&&{...P,date:U}))},onReminderChange:U=>{W&&(s(W.taskSeq,U),X(P=>P&&{...P,reminders:U}))}}),ge(ec,{open:!!Re,anchorEl:Re?.anchorEl??null,title:n("board.archiveBlocked",{count:Re?.count??0}),confirmText:n("common.confirm"),onCancel:()=>mt(null),onConfirm:()=>mt(null)}),ge(ec,{open:!!G,anchorEl:G?.anchorEl??null,title:n("board.archiveProjectConfirm",{label:G?.column.label??""}),confirmText:n("menu.archive"),onCancel:()=>ae(null),onConfirm:()=>{G&&z(G.column.key,!0),ae(null)}}),ge(ec,{open:!!ce,anchorEl:ce?.anchorEl??null,title:n("board.deleteProjectConfirm",{label:ce?.column.label??""}),confirmText:n("common.delete"),onCancel:()=>Q(null),onConfirm:()=>{ce&&k(ce.column.key),Q(null)}}),ge(Lo,{open:!!O,anchorEl:O?.anchorEl??null,nextCompleted:O?.nextCompleted??!1,returnMode:!!q&&!!(V&&no(V,v)),onCancel:()=>j(null),onConfirm:U=>{O&&(U&&q&&V?q(V,U):r(O.taskSeq,O.nextCompleted)),j(null)}})]})}import{useCallback as fr,useMemo as dl,useRef as zg,useState as pl}from"react";import{Box as Gt,Button as f_,ButtonBase as Fg,IconButton as Ng}from"@mui/material";import g_ from"@mui/icons-material/Add";import x_ from"@mui/icons-material/ChevronLeft";import b_ from"@mui/icons-material/ChevronRight";import h_ from"@mui/icons-material/KeyboardArrowDown";import{DatePicker as k_}from"@ehfuse/mui-datetime-picker";import{DndContext as T_,DragOverlay as y_,PointerSensor as C_,pointerWithin as S_,rectIntersection as v_,useDroppable as B_,useSensor as __,useSensors as I_}from"@dnd-kit/core";import{SortableContext as w_,arrayMove as D_,useSortable as E_,verticalListSortingStrategy as R_}from"@dnd-kit/sortable";import{CSS as P_}from"@dnd-kit/utilities";import O_ from"@ehfuse/overlay-scrollbar";function a_(e){let[t,o,a]=e.split("-").map(Number),r=new Date(Date.UTC(t,o-1,a+1)),i=l=>String(l).padStart(2,"0");return`${r.getUTCFullYear()}-${i(r.getUTCMonth()+1)}-${i(r.getUTCDate())}`}function ni(e){let t=new Map;for(let o of e){let a=o.start_date;for(let r=0;r<62&&a<=o.end_date;r+=1){let i=t.get(a);i?i.push(o):t.set(a,[o]),a=a_(a)}}for(let o of t.values())o.sort((a,r)=>(a.time||"99:99").localeCompare(r.time||"99:99")||a.title.localeCompare(r.title));return t}function ri(e){let t=String((e.is_event?e.event_time:e.due_date.slice(11,16)||e.estimated_time)??"").trim();return/^\d{1,2}:\d{2}$/.test(t)?t:""}function ai(e,t){if(e.completed!==t.completed)return e.completed?1:-1;let o=ri(e),a=ri(t);if(!!o!=!!a)return o?-1:1;if(o&&a&&o!==a)return o<a?-1:1;let r=e.sort_no>0,i=t.sort_no>0;return r&&i?e.sort_no-t.sort_no:r!==i?r?-1:1:e.seq-t.seq}import{Box as Uu,Tooltip as i_}from"@mui/material";import{jsx as Gu,jsxs as l_}from"react/jsx-runtime";function ii({event:e,small:t=!1,onClick:o}){L();let a=e.time?`${e.time} ${e.title}`:e.title,r=e.calendar?n("calendar.googleWithCalendar",{calendar:e.calendar}):n("calendar.googleCalendar"),i=l=>{if(l.stopPropagation(),o){o(e);return}let[s,c,u]=e.start_date.split("-").map(Number);window.open(`https://calendar.google.com/calendar/r/day/${s}/${c}/${u}`,"_blank")};return Gu(i_,{title:`(${r}) ${a}`,arrow:!0,enterDelay:300,children:l_(Uu,{onClick:i,onPointerDown:l=>l.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:t?.6:.8,borderRadius:.75,bgcolor:"#f1f1ef",color:"#37352f",fontSize:15,fontWeight:500,overflow:"hidden",whiteSpace:"nowrap",flexShrink:0,minWidth:0,maxWidth:"100%",cursor:"pointer","&:hover":{bgcolor:"#ececea"}},children:[Gu(Uu,{component:"span",sx:{width:6,height:6,borderRadius:"50%",bgcolor:"#0f9d58",flexShrink:0}}),Gu(Uu,{component:"span",sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:a})]})})}import{useCallback as m_}from"react";import{Box as pr,Checkbox as u_}from"@mui/material";import{useLayoutEffect as s_,useState as Ag}from"react";var Yu=new WeakMap,ju=null;function c_(){return typeof ResizeObserver>"u"?null:(ju||(ju=new ResizeObserver(e=>{for(let t of e){let o=Yu.get(t.target);if(!o)continue;let a=t.borderBoxSize?.[0]?.inlineSize??t.target.getBoundingClientRect().width;o(a)}})),ju)}function qg(){let[e,t]=Ag(null),[o,a]=Ag(0);return s_(()=>{if(!e)return;a(e.getBoundingClientRect().width);let r=c_();if(r)return Yu.set(e,i=>a(l=>Math.abs(l-i)<1?l:i)),r.observe(e),()=>{r.unobserve(e),Yu.delete(e)}},[e]),{ref:t,width:o}}import{jsx as Gn,jsxs as Xu}from"react/jsx-runtime";var Qu={high:"#e5484d",medium:"#2f80ed",low:"#d9a514"},li=14,d_=150,p_=3;function Zr({task:e,statusOptions:t,onOpenDetail:o,onContextMenu:a,isPreview:r=!1,isDragging:i=!1,isMine:l=!1,avatarSrcByName:s,showManagerAvatar:c=!1,onOpenMembers:u,setNodeRef:m,dragProps:d,trailing:p,showCheckbox:f=!1,onRequestToggleCompleted:g,showTime:x=!0,wrapTitle:h=!1,titlePrefix:E}){let b=be(),B=b.mode==="dark",[T]=Ua(e,t),z=String(e.manager_name??"").trim(),k=x?ri(e):"",_=se(),D=Ya(e,_.resolveTask),F=E??_.titlePrefix?.(e)??"",R=e.is_notice||e.is_event?Le(e.icon||(e.is_notice?Dt:Nt)):null,C=!e.completed&&!e.is_event&&!!e.due_date&&e.due_date.slice(0,10)<Rf(),{ref:y,width:I}=qg(),S=I>0&&I<d_,M=S||h,w=m_(v=>{y(v),m?.(v)},[y,m]),q=c&&!l&&!S&&!!z;return Xu(pr,{ref:w,...d??{},onClick:v=>{v.stopPropagation(),o(e)},onContextMenu:a?v=>a(e,v):void 0,sx:{display:"flex",alignItems:M?"flex-start":"center",gap:.5,py:.6,px:1,flexShrink:0,borderRadius:.75,minWidth:0,maxWidth:"100%",bgcolor:T?B?Ka(T.dot,b.chip.darkBgAlpha):T.bg:B?b.card.bg:b.colors.surfaceHover,color:T?B?b.chip.darkTextSource==="fg"?T.fg:T.dot:T.fg:b.colors.textPrimary,fontSize:li,fontWeight:B||e.completed?400:500,opacity:r?.5:i?.35:e.completed?.6:1,border:r?`1px dashed ${b.colors.accent}`:"1px solid transparent",pointerEvents:r?"none":"auto",cursor:"pointer",touchAction:d?"none":"auto",overflow:"hidden","&:hover":{filter:"brightness(0.96)"},...C?{borderLeft:`3px solid ${b.colors.danger}`,pl:.75}:l?{borderLeft:"3px solid #2f80ed",pl:.75}:{}},children:[Gn(pr,{component:"span",sx:{width:6,height:6,borderRadius:"50%",flexShrink:0,...M?{mt:"6px"}:{},bgcolor:Qu[e.priority]??b.colors.accentOnSurface}}),f&&!S&&g?Gn(u_,{size:"small",checked:e.completed,onPointerDown:v=>v.stopPropagation(),onClick:v=>v.stopPropagation(),onChange:(v,O)=>g({anchorEl:v.currentTarget,taskSeq:e.seq,nextCompleted:O}),sx:{p:0,flexShrink:0}}):null,R&&!S?Gn(R,{sx:{fontSize:15,flexShrink:0,opacity:.75,...M?{mt:"2px"}:{}}}):null,Xu(pr,{sx:{minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column",color:B?b.colors.textStrong:b.colors.textPrimary},children:[S&&k?Gn(pr,{component:"span",sx:{lineHeight:1.35,fontSize:li-1,color:e.completed?b.colors.textPrimary:b.colors.danger},children:k}):null,Xu(pr,{component:"span",sx:{minWidth:0,overflow:"hidden",...M?{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:p_,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.35}:{textOverflow:"ellipsis",whiteSpace:"nowrap"}},children:[!S&&k?Gn(pr,{component:"span",sx:{mr:.5,fontSize:li-1,color:e.completed?b.colors.textPrimary:b.colors.danger},children:k}):null,F?Gn(pr,{component:"span",sx:{mr:.5,color:b.colors.textSecondary,fontWeight:500},children:F}):null,e.title,!S&&D?Gn(pr,{component:"span",sx:{ml:.5,fontSize:li-2,color:b.colors.textMuted,fontVariantNumeric:"tabular-nums"},children:D}):null,!S&&(e.comment_count??e.comments?.length??0)>0?Gn(Xr,{sx:{fontSize:15,ml:.5,verticalAlign:"-2px",color:b.colors.textMuted}}):null]})]}),p??null,!p&&q?Gn(pr,{component:"span",onClick:u?v=>{v.stopPropagation(),u(e)}:void 0,sx:{display:"inline-flex",flexShrink:0,ml:"auto",pl:.5},children:Gn(fo,{src:s?.get(z)??"",name:z,avatarSx:{width:22,height:22,fontSize:11},iconFontSize:14})}):null]})}import{jsx as He,jsxs as gr}from"react/jsx-runtime";var Hg=36,rc="day-";function Ju(e){let t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-t.getDay()),t}function nc(e,t){let o=new Date(e);return o.setDate(o.getDate()+t),o}function M_(e){let t=e[0],o=e[e.length-1];return t.getMonth()===o.getMonth()?cr(t,{year:"numeric",month:"long"}):ga()!=="ko"?new Intl.DateTimeFormat(vm(),{year:"numeric",month:"long"}).formatRange(t,o):t.getFullYear()===o.getFullYear()?`${t.getFullYear()}\uB144 ${t.getMonth()+1}\uC6D4 - ${o.getMonth()+1}\uC6D4`:`${t.getFullYear()}\uB144 ${t.getMonth()+1}\uC6D4 - ${o.getFullYear()}\uB144 ${o.getMonth()+1}\uC6D4`}function L_(e){return e.getDate()===1?cr(e,{month:"short",day:"numeric"}):String(e.getDate())}function A_({task:e,statusOptions:t,isMine:o,avatarSrcByName:a,onCardClick:r,onCardContextMenu:i,onRequestArchiveToggle:l,dragDisabled:s=!1}){let{attributes:c,listeners:u,setNodeRef:m,transform:d,transition:p,isDragging:f}=E_({id:String(e.seq),disabled:s});return He(Zr,{task:e,statusOptions:t,isMine:o,avatarSrcByName:a,showManagerAvatar:!0,wrapTitle:!0,onOpenDetail:g=>r?.(g),onContextMenu:i,showCheckbox:!0,onRequestToggleCompleted:l,isDragging:f,setNodeRef:m,dragProps:s?void 0:{...c,...u,style:{transform:P_.Translate.toString(d),transition:p}}})}function q_({dayKey:e,isToday:t,dayLabel:o,holidayName:a,tasks:r,googleEvents:i,onGoogleEventClick:l,statusOptions:s,onRequestArchiveToggle:c,onRequestReply:u,onAddSchedule:m,canAdd:d,onCardClick:p,onCardContextMenu:f,summary:g,myAccountSeq:x,avatarSrcByName:h,dragDisabled:E=!1}){L();let b=be(),{setNodeRef:B}=B_({id:`${rc}${e}`,disabled:E});return gr(Gt,{ref:B,sx:{minWidth:0,minHeight:0,height:"100%",display:"flex",flexDirection:"column",bgcolor:t?b.calendar.todayBg:b.calendar.cellBg},children:[gr(Gt,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:.5,px:1,height:Hg,bgcolor:t?b.calendar.todayBg:b.calendar.dateBandBg,borderBottom:`1px solid ${b.calendar.borderColor}`,flexShrink:0},children:[a?He(Gt,{component:"span",sx:{mr:"auto",fontSize:11.5,fontWeight:600,color:b.colors.danger,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}):null,t?He(Gt,{component:"span",sx:{mr:.75,px:.6,py:.1,borderRadius:.5,fontSize:11,fontWeight:600,bgcolor:b.colors.danger,color:b.calendar.cellBg,lineHeight:1.6},children:n("common.today")}):null,He(Gt,{component:"span",sx:{fontSize:13.5,fontWeight:t?700:400,color:a?b.colors.danger:b.mode==="dark"?b.colors.textStrong:b.colors.textPrimary,flexShrink:0},children:o})]}),g?He(Gt,{sx:{px:1,py:1,borderBottom:`1px solid ${b.calendar.borderColor}`,flexShrink:0},children:g}):null,He(Gt,{sx:{flex:1,minHeight:0,bgcolor:t?b.calendar.todayBg:b.colors.surfaceSubtle},children:He(O_,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:gr(Gt,{sx:{display:"flex",flexDirection:"column",flexGrow:1},children:[i.length>0?He(Gt,{sx:{display:"flex",flexDirection:"column",gap:.5,px:1,pt:.75,pb:.25},children:i.map(T=>He(ii,{event:T,onClick:l},T.uid))}):null,He(w_,{items:r.map(T=>String(T.seq)),strategy:R_,children:He(Gt,{sx:{display:"flex",flexDirection:"column",gap:.5,px:1,pt:r.length>0?.75:0},children:r.map(T=>He(A_,{task:T,statusOptions:s,isMine:x>0&&Number(T.manager_account_seq??0)===x,avatarSrcByName:h,onCardClick:p,onCardContextMenu:f,onRequestArchiveToggle:c,dragDisabled:E},T.seq))})}),He(Gt,{sx:{flexGrow:1,minHeight:56,display:"flex",flexDirection:"column",pb:1,...d?{"&:hover .taskbox-add-schedule":{opacity:1,pointerEvents:"auto"}}:{}},children:gr(Fg,{className:"taskbox-add-schedule",onClick:()=>m(e),sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,px:1.25,py:1.75,borderBottom:`1px dashed ${b.calendar.borderColor}`,bgcolor:b.calendar.cellBg,color:b.colors.accentOnSurface,fontSize:13,fontWeight:500,opacity:0,pointerEvents:"none",transition:"opacity 0.15s","&:hover":{bgcolor:b.calendar.hoverBg}},children:[He(g_,{sx:{fontSize:16}}),n("task.addTask")]})})]})})})]})}function Wg({tasks:e,googleEvents:t=[],onGoogleEventClick:o,statusOptions:a,fallbackToStartDate:r=!1,myAccountSeq:i=0,avatarSrcByName:l,todayStr:s,onToggleCompleted:c,onMoveTask:u,onRequestReply:m,onAddSchedule:d,canAdd:p=!0,disableDrag:f=!1,onOpenDetail:g,onTaskContextMenu:x,hideCompleted:h=!1,renderColumnSummary:E}){L();let b=be(),[B,T]=pl(()=>Ju(new Date)),[z,k]=pl(null),{onReturnTask:_}=se(),D=z?e.find(W=>W.seq===z.taskSeq):void 0,[F,R]=pl(null),[C,y]=pl(null),[I,S]=pl(null),M=zg(!1),w=dl(()=>Array.from({length:7},(W,X)=>nc(B,X)),[B]),q=dl(()=>new Map(e.map(W=>[W.seq,W])),[e]),v=dl(()=>[...new Set(w.map(W=>W.getFullYear()))],[w]),O=Hn(v),j=I_(__(C_,{activationConstraint:{distance:5}})),V=fr(W=>{let X=S_(W),le=X.length>0?X:v_(W),pe=le.filter(De=>!String(De.id).startsWith(rc));return pe.length>0?pe:le},[]),Z=dl(()=>ni(t),[t]),ie=dl(()=>{let W=new Map;for(let X of e){let le=X.due_date.slice(0,10)||(r?X.start_date.slice(0,10)||String(X.created_time??"").slice(0,10):"");if(!le)continue;let pe=W.get(le);pe?pe.push(X):W.set(le,[X])}for(let X of W.values())X.sort(ai);return W},[e,r]),ue=fr(W=>C?(C.get(W)??[]).map(X=>q.get(X)).filter(X=>!!X):ie.get(W)??[],[C,q,ie]),K=fr(W=>{let X=ue(W);return h?X.filter(le=>!le.completed):X},[ue,h]),te=fr(W=>{S(Number(W.active.id)),y(new Map(w.map(X=>{let le=Et(X);return[le,(ie.get(le)??[]).map(pe=>pe.seq)]})))},[w,ie]),$=fr((W,X)=>{if(W.startsWith(rc))return{day:W.slice(rc.length),overSeq:null};let le=Number(W);for(let[pe,De]of X)if(De.includes(le))return{day:pe,overSeq:le};return null},[]),G=fr(W=>{let{active:X,over:le}=W;le&&y(pe=>{if(!pe)return pe;let De=Number(X.id),ve=$(String(le.id),pe);if(!ve)return pe;let It=[...pe.entries()].find(([,je])=>je.includes(De))?.[0];if(!It||It===ve.day)return pe;let We=new Map(pe);We.set(It,(We.get(It)??[]).filter(je=>je!==De));let Ee=[...We.get(ve.day)??[]],ut=Ee.length;if(ve.overSeq!==null){let je=Ee.indexOf(ve.overSeq);je!==-1&&(ut=je)}return Ee.splice(ut,0,De),We.set(ve.day,Ee),We})},[$]),ae=fr(W=>{let{active:X,over:le}=W,pe=C;if(y(null),S(null),M.current=!0,!pe||!le)return;let De=Number(X.id),ve=[...pe.entries()].find(([,je])=>je.includes(De));if(!ve)return;let[It,We]=ve,Ee=[...We],ut=$(String(le.id),pe);if(ut&&ut.day===It&&ut.overSeq!==null&&ut.overSeq!==De){let je=Ee.indexOf(De),co=Ee.indexOf(ut.overSeq);je!==-1&&co!==-1&&(Ee=D_(Ee,je,co))}u(De,It,Ee)},[C,u,$]),Re=fr(()=>{y(null),S(null),M.current=!0},[]),mt=fr(W=>{if(M.current){M.current=!1;return}g(W)},[g]),ce=I!==null?q.get(I)??null:null,Q=zg(null);return gr(Gt,{onTouchStart:W=>{let X=W.touches[0];Q.current=X?{x:X.clientX,y:X.clientY}:null},onTouchEnd:W=>{let X=Q.current;Q.current=null;let le=W.changedTouches[0];if(!X||!le||I!==null)return;let pe=le.clientX-X.x,De=le.clientY-X.y;Math.abs(pe)<60||Math.abs(pe)<=Math.abs(De)||T(nc(B,pe<0?7:-7))},sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0,border:`1px solid ${b.calendar.borderColor}`,borderRadius:"0 0 4px 4px",overflow:"hidden"},children:[gr(Gt,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:b.calendar.navPaddingY??1,bgcolor:b.calendar.bg,borderBottom:`1px solid ${b.calendar.borderColor}`,flexShrink:0},children:[gr(Gt,{sx:{display:"flex",alignItems:"center",gap:.25},children:[He(Ng,{size:"small","aria-label":n("calendar.prevWeek"),onClick:()=>T(nc(B,-7)),children:He(x_,{sx:{fontSize:24,color:b.colors.textSecondary}})}),He(f_,{size:"small",color:"inherit",onClick:()=>T(Ju(new Date)),sx:{minWidth:0,px:1,mx:1,fontSize:15.5,fontWeight:b.mode==="dark"?400:500,color:b.mode==="dark"?b.colors.textStrong:b.colors.textPrimary},children:n("common.today")}),He(Ng,{size:"small","aria-label":n("calendar.nextWeek"),onClick:()=>T(nc(B,7)),children:He(b_,{sx:{fontSize:24,color:b.colors.textSecondary}})})]}),gr(Fg,{onClick:W=>R(W.currentTarget),sx:{ml:{xs:"auto",lg:0},display:"inline-flex",alignItems:"center",gap:.25,px:.75,py:.25,borderRadius:1,fontSize:15,fontWeight:b.mode==="dark"?400:700,color:b.mode==="dark"?b.colors.textStrong:b.colors.textPrimary,"&:hover":{bgcolor:b.colors.surfaceHover}},children:[M_(w),He(h_,{sx:{fontSize:18,color:b.colors.textMuted}})]})]}),He(Gt,{sx:{display:"grid",gridTemplateColumns:"repeat(7, minmax(0, 1fr))",bgcolor:b.calendar.headerBg,borderBottom:`1px solid ${b.calendar.borderColor}`,flexShrink:0,"& > *":{borderRight:`1px solid ${b.calendar.borderColor}`},"& > *:last-child":{borderRight:"none"}},children:w.map(W=>{let X=W.getDay(),le=O.has(Et(W));return He(Gt,{sx:{height:Hg,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12.5,color:X===0||le?b.colors.danger:X===6?b.colors.accentOnSurface:b.colors.textSecondary},children:Hr(X)},Et(W))})}),He(Gt,{sx:{flex:1,minHeight:0},children:gr(T_,{sensors:j,collisionDetection:V,onDragStart:te,onDragOver:G,onDragEnd:ae,onDragCancel:Re,children:[He(Gt,{sx:{display:"grid",gridTemplateColumns:"repeat(7, minmax(0, 1fr))",height:"100%",minHeight:0,"& > *":{borderRight:`1px solid ${b.calendar.borderColor}`},"& > *:last-child":{borderRight:"none"}},children:w.map(W=>{let X=Et(W);return He(q_,{dayKey:X,isToday:X===s,dayLabel:L_(W),holidayName:O.get(X)??"",summary:E?.(X,ue(X)),tasks:K(X),googleEvents:Z.get(X)??[],onGoogleEventClick:o,statusOptions:a,onRequestArchiveToggle:k,onRequestReply:m,onAddSchedule:d,canAdd:p,onCardClick:mt,onCardContextMenu:x,myAccountSeq:i,avatarSrcByName:l,dragDisabled:f},X)})}),He(y_,{children:ce?He(Gt,{sx:{boxShadow:"0 8px 20px rgba(0,0,0,0.18)",borderRadius:.75,cursor:"grabbing"},children:He(Zr,{task:ce,statusOptions:a,onOpenDetail:()=>{},isMine:i>0&&Number(ce.manager_account_seq??0)===i})}):null})]})}),He(k_,{anchorEl:F,open:!!F,onClose:()=>R(null),selectedDate:B,onDateChange:W=>{T(Ju(W)),R(null)}}),He(Lo,{open:!!z,anchorEl:z?.anchorEl??null,nextCompleted:z?.nextCompleted??!1,returnMode:!!_&&!!(D&&no(D,i)),onCancel:()=>k(null),onConfirm:W=>{z&&(W&&_&&D?_(D,W):c(z.taskSeq,z.nextCompleted)),k(null)}})]})}import{useCallback as fl,useEffect as z_,useMemo as Ca,useRef as $g,useState as si}from"react";import{Box as Bo,Button as N_,ButtonBase as Kg,IconButton as Vg,Tooltip as F_}from"@mui/material";import H_ from"@mui/icons-material/Add";import W_ from"@mui/icons-material/ChevronLeft";import $_ from"@mui/icons-material/ChevronRight";import V_ from"@mui/icons-material/KeyboardArrowDown";import{DatePicker as K_}from"@ehfuse/mui-datetime-picker";import{DndContext as U_,DragOverlay as G_,PointerSensor as j_,pointerWithin as Y_,rectIntersection as X_,useDraggable as Q_,useDroppable as Ug,useSensor as J_,useSensors as Z_}from"@dnd-kit/core";import e1 from"@ehfuse/overlay-scrollbar";import{ConfirmActionPopper as t1}from"@ehfuse/mui-confirm-action";import{jsx as lt,jsxs as xr}from"react/jsx-runtime";var ac="mday-",ic="mchip-",Gg=36;function o1(e){let t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-t.getDay()),t}function lc(e){let t=new Date(e);return t.setHours(0,0,0,0),t.setDate(1),t}function n1(e,t){let o=new Date(e);return o.setDate(o.getDate()+t),o}function Zu(e,t){let o=lc(e);return o.setMonth(o.getMonth()+t),o}function r1({task:e,statusOptions:t,isPreview:o=!1,isMine:a=!1,avatarSrcByName:r,onOpenDetail:i,onContextMenu:l,onRequestToggleCompleted:s,dragDisabled:c=!1}){let{attributes:u,listeners:m,setNodeRef:d,isDragging:p}=Q_({id:String(e.seq),disabled:o||c}),{setNodeRef:f}=Ug({id:`${ic}${e.seq}`,disabled:o||c});return lt(F_,{title:e.title,arrow:!0,enterDelay:400,children:lt(Zr,{task:e,statusOptions:t,onOpenDetail:i,onContextMenu:l,showCheckbox:!!s,onRequestToggleCompleted:s,isPreview:o,isDragging:p,isMine:a,avatarSrcByName:r,showManagerAvatar:!0,wrapTitle:!0,setNodeRef:g=>{d(g),f(g)},dragProps:c?void 0:{...u,...m}})})}function a1({dayKey:e,dayNumber:t,isToday:o,isOtherMonth:a,weekday:r,holidayName:i,tasks:l,googleEvents:s,onGoogleEventClick:c,statusOptions:u,previewSeq:m,myAccountSeq:d,avatarSrcByName:p,onRequestToggleCompleted:f,onOpenDetail:g,onTaskContextMenu:x,onAddSchedule:h,canAdd:E,dragDisabled:b=!1,hideDateDivider:B=!1}){L();let T=be(),z=T.mode==="dark",{setNodeRef:k,isOver:_}=Ug({id:`${ac}${e}`,disabled:b}),D=l,F=!!i||r===0;return xr(Bo,{ref:k,sx:{minWidth:0,minHeight:0,display:"flex",flexDirection:"column",gap:.5,p:.5,bgcolor:_?T.colors.accentSoft:o?T.calendar.todayBg:a?T.calendar.otherMonthBg:T.calendar.cellBg,transition:"background-color 0.15s",overflow:"hidden",...E?{"&:hover .taskbox-month-add":{opacity:1,pointerEvents:"auto"}}:{}},children:[xr(Bo,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:.5,height:Gg,flexShrink:0,mx:-.5,mt:-.5,px:1,bgcolor:o?T.calendar.todayBg:T.calendar.dateBandBg,borderBottom:B?"none":`1px solid ${T.calendar.borderColor}`},children:[i?lt(Bo,{component:"span",sx:{mr:.25,minWidth:0,fontSize:11,fontWeight:600,color:T.colors.danger,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}):null,o?lt(Bo,{component:"span",sx:{px:.5,borderRadius:.5,fontSize:10.5,fontWeight:600,bgcolor:T.colors.danger,color:T.calendar.cellBg,lineHeight:1.6},children:n("common.today")}):null,lt(Bo,{component:"span",sx:{fontSize:13.5,fontWeight:o?700:400,color:a?T.colors.textMuted:F?T.colors.danger:r===6?T.colors.accentOnSurface:z?T.colors.textStrong:T.colors.textPrimary,flexShrink:0},children:t})]}),s.map(R=>lt(ii,{event:R,small:!0,onClick:c},R.uid)),D.map(R=>lt(r1,{task:R,statusOptions:u,isPreview:R.seq===m,isMine:d>0&&Number(R.manager_account_seq??0)===d,avatarSrcByName:p,onRequestToggleCompleted:f,onOpenDetail:g,onContextMenu:x,dragDisabled:b},R.seq)),lt(Bo,{sx:{flexGrow:1,minHeight:0,display:"flex",alignItems:"flex-start"},children:xr(Kg,{className:"taskbox-month-add",onClick:()=>h(e),sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,px:1.25,py:.75,borderBottom:`1px dashed ${T.calendar.borderColor}`,bgcolor:T.calendar.cellBg,color:T.colors.accentOnSurface,fontSize:13,fontWeight:500,opacity:0,pointerEvents:"none",transition:"opacity 0.15s","&:hover":{bgcolor:T.calendar.hoverBg}},children:[lt(H_,{sx:{fontSize:16}}),n("task.addTask")]})})]})}function jg({tasks:e,googleEvents:t=[],onGoogleEventClick:o,statusOptions:a,fallbackToStartDate:r=!1,myAccountSeq:i=0,avatarSrcByName:l,onToggleCompleted:s,todayStr:c,onMoveTask:u,onAddSchedule:m,canAdd:d=!0,disableDrag:p=!1,onOpenDetail:f,onTaskContextMenu:g,hideDateDivider:x=!1}){L();let h=be(),E=h.mode==="dark",[b,B]=si(()=>lc(new Date)),[T,z]=si(null),[k,_]=si(null),[D,F]=si(null),[R,C]=si(null),y=Ca(()=>{let Q=o1(b);return Array.from({length:42},(W,X)=>n1(Q,X))},[b]),I=Ca(()=>new Map(e.map(Q=>[Q.seq,Q])),[e]),S=Ca(()=>ni(t),[t]),M=Ca(()=>[...new Set(y.map(Q=>Q.getFullYear()))],[y]),w=Hn(M),q=Ca(()=>{let Q=new Map;for(let W of e){let X=W.due_date.slice(0,10)||(r?W.start_date.slice(0,10)||String(W.created_time??"").slice(0,10):"");if(!X)continue;let le=Q.get(X);le?le.push(W):Q.set(X,[W])}for(let W of Q.values())W.sort(ai);return Q},[e,r]),v=Z_(J_(j_,{activationConstraint:{distance:5}})),O=$g(null),[j,V]=si(0);z_(()=>{let Q=O.current;if(!Q||typeof ResizeObserver>"u")return;let W=new ResizeObserver(()=>V(Math.floor(Q.clientHeight)));return W.observe(Q),V(Math.floor(Q.clientHeight)),()=>W.disconnect()},[]);let Z=fl(Q=>{let W=Y_(Q),X=W.length>0?W:X_(Q),le=X.filter(pe=>String(pe.id).startsWith(ic));return le.length>0?le:X.filter(pe=>String(pe.id).startsWith(ac))},[]),ie=fl(Q=>{F(Number(Q.active.id))},[]),ue=fl(Q=>{C(Q.over?String(Q.over.id):null)},[]),K=Ca(()=>{let Q=new Map;for(let[W,X]of q)for(let le of X)Q.set(le.seq,W);return Q},[q]),te=D!==null?I.get(D)?.due_date.slice(0,10)??"":"",$=Ca(()=>{if(D===null||!R)return null;if(R.startsWith(ic)){let Q=Number(R.slice(ic.length)),W=K.get(Q);if(!W)return null;let X=(q.get(W)??[]).filter(pe=>pe.seq!==D),le=X.findIndex(pe=>pe.seq===Q);return{day:W,index:le===-1?X.length:le}}if(R.startsWith(ac)){let Q=R.slice(ac.length),W=(q.get(Q)??[]).filter(X=>X.seq!==D);return{day:Q,index:W.length}}return null},[D,K,R,q]),G=fl(Q=>{let W=q.get(Q)??[];if(D===null||!$)return W;let X=I.get(D);if(!X)return W;let le=W.filter(pe=>pe.seq!==D);return Q===$.day?[...le.slice(0,$.index),X,...le.slice($.index)]:Q===te?le:W},[D,te,$,I,q]),ae=fl(Q=>{let W=D,X=$;if(F(null),C(null),W===null||!X)return;let le=(q.get(X.day)??[]).filter(De=>De.seq!==W),pe=[...le.slice(0,X.index).map(De=>De.seq),W,...le.slice(X.index).map(De=>De.seq)];u(W,X.day,pe)},[D,$,u,q]),Re=D!==null?I.get(D)??null:null,mt=cr(b,{year:"numeric",month:"long"}),ce=$g(null);return xr(Bo,{onTouchStart:Q=>{let W=Q.touches[0];ce.current=W?{x:W.clientX,y:W.clientY}:null},onTouchEnd:Q=>{let W=ce.current;ce.current=null;let X=Q.changedTouches[0];if(!W||!X||D!==null)return;let le=X.clientX-W.x,pe=X.clientY-W.y;Math.abs(le)<60||Math.abs(le)<=Math.abs(pe)||B(Zu(b,le<0?1:-1))},sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0,border:`1px solid ${h.calendar.borderColor}`,borderRadius:"0 0 4px 4px",overflow:"hidden"},children:[xr(Bo,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:h.calendar.navPaddingY??1,bgcolor:h.calendar.bg,borderBottom:`1px solid ${h.calendar.borderColor}`,flexShrink:0},children:[xr(Bo,{sx:{display:"flex",alignItems:"center",gap:.25},children:[lt(Vg,{size:"small","aria-label":n("calendar.prevMonth"),onClick:()=>B(Zu(b,-1)),children:lt(W_,{sx:{fontSize:24,color:h.colors.textSecondary}})}),lt(N_,{size:"small",color:"inherit",onClick:()=>B(lc(new Date)),sx:{minWidth:0,px:1,mx:1,fontSize:15.5,fontWeight:h.mode==="dark"?400:500,color:h.mode==="dark"?h.colors.textStrong:h.colors.textPrimary},children:n("common.today")}),lt(Vg,{size:"small","aria-label":n("calendar.nextMonth"),onClick:()=>B(Zu(b,1)),children:lt($_,{sx:{fontSize:24,color:h.colors.textSecondary}})})]}),xr(Kg,{onClick:Q=>z(Q.currentTarget),sx:{display:"inline-flex",alignItems:"center",gap:.25,ml:{xs:"auto",lg:0},px:.75,py:.25,borderRadius:1,fontSize:15,fontWeight:h.mode==="dark"?400:700,color:h.mode==="dark"?h.colors.textStrong:h.colors.textPrimary,"&:hover":{bgcolor:h.colors.surfaceHover}},children:[mt,lt(V_,{sx:{fontSize:18,color:h.colors.textMuted}})]})]}),lt(Bo,{sx:{display:"grid",gridTemplateColumns:"repeat(7, minmax(0, 1fr))",bgcolor:h.calendar.headerBg,borderBottom:`1px solid ${h.calendar.borderColor}`,flexShrink:0,"& > *":{borderRight:`1px solid ${h.calendar.borderColor}`},"& > *:last-child":{borderRight:"none"}},children:Kp().map((Q,W)=>lt(Bo,{sx:{height:Gg,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12.5,color:W===0?h.colors.danger:W===6?h.colors.accentOnSurface:h.colors.textSecondary},children:Q},Q))}),lt(Bo,{ref:O,sx:{flex:1,minHeight:0},children:xr(U_,{sensors:v,collisionDetection:Z,onDragStart:ie,onDragOver:ue,onDragEnd:ae,onDragCancel:()=>{F(null),C(null)},children:[lt(e1,{style:{height:"100%"},thumb:{width:8},children:lt(Bo,{sx:{display:"grid",gridTemplateColumns:"repeat(7, minmax(0, 1fr))",gridTemplateRows:"repeat(6, minmax(112px, auto))",minHeight:j>0?`${j}px`:"100%",flexShrink:0,"& > *":{borderRight:`1px solid ${h.calendar.borderColor}`,borderBottom:`1px solid ${h.calendar.borderColor}`},"& > *:nth-of-type(7n)":{borderRight:"none"},"& > *:nth-last-of-type(-n+7)":{borderBottom:"none"}},children:y.map(Q=>{let W=Et(Q);return lt(a1,{dayKey:W,dayNumber:Q.getDate(),isToday:W===c,isOtherMonth:Q.getMonth()!==b.getMonth(),weekday:Q.getDay(),holidayName:w.get(W)??"",tasks:G(W),googleEvents:S.get(W)??[],onGoogleEventClick:o,statusOptions:a,previewSeq:$?.day===W?D:null,myAccountSeq:i,avatarSrcByName:l,onRequestToggleCompleted:s?_:void 0,onOpenDetail:f,onTaskContextMenu:g,onAddSchedule:m,canAdd:d,dragDisabled:p,hideDateDivider:x},W)})})}),lt(G_,{children:Re?xr(Bo,{sx:{display:"flex",alignItems:"center",gap:.5,py:.6,px:.75,borderRadius:.75,bgcolor:h.calendar.cellBg,border:`1px solid ${h.calendar.borderColor}`,boxShadow:"0 6px 16px rgba(0,0,0,0.18)",fontSize:li,fontWeight:500,color:h.colors.textPrimary,cursor:"grabbing",whiteSpace:"nowrap"},children:[lt(Bo,{component:"span",sx:{width:6,height:6,borderRadius:"50%",bgcolor:Qu[Re.priority]}}),Re.title]}):null})]})}),lt(t1,{open:!!k,anchorEl:k?.anchorEl??null,title:k?.nextCompleted?n("task.completeConfirm"):n("task.uncompleteConfirm"),confirmText:k?.nextCompleted?n("common.done"):n("task.unmark"),onCancel:()=>_(null),onConfirm:()=>{k&&s?.(k.taskSeq,k.nextCompleted),_(null)}}),lt(K_,{anchorEl:T,open:!!T,onClose:()=>z(null),selectedDate:b,onDateChange:Q=>{B(lc(Q)),z(null)}})]})}import{useEffect as m1,useMemo as gl,useRef as td,useState as Qg}from"react";import{Box as go,Button as u1,IconButton as Jg,useMediaQuery as d1}from"@mui/material";import p1 from"@mui/icons-material/ChevronLeft";import f1 from"@mui/icons-material/ChevronRight";import g1 from"@mui/icons-material/KeyboardArrowDown";import{DatePicker as x1}from"@ehfuse/mui-datetime-picker";import{Box as br,Button as i1,Dialog as l1}from"@mui/material";import{jsx as hr,jsxs as ed}from"react/jsx-runtime";function Yg({controller:e,avatarSrcByName:t}){L();let o=be(),a=e.modals.members,r=e.ui.useValue("task"),i=r?[{label:n("role.owner"),names:[String(r.manager_name??"").trim()]},{label:n("role.cc"),names:r.receiver_names??[]},{label:n("role.author"),names:[String(r.created_by??"").trim()]}]:[];return hr(l1,{open:a.isOpen,onClose:a.close,maxWidth:"xs",fullWidth:!0,slotProps:{paper:{sx:{borderRadius:2,m:2}}},children:r?ed(br,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5,bgcolor:o.colors.surface},children:[hr(br,{sx:{fontSize:15.5,fontWeight:600,color:o.colors.textStrong,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.title}),i.map(l=>{let s=l.names.filter(c=>!!c);return ed(br,{sx:{display:"flex",alignItems:"flex-start",gap:1.5},children:[hr(br,{sx:{width:56,flexShrink:0,fontSize:13.5,color:o.colors.textSecondary,pt:.5},children:l.label}),hr(br,{sx:{display:"flex",flexWrap:"wrap",gap:1,minWidth:0},children:s.length===0?hr(br,{sx:{fontSize:14,color:o.colors.textMuted,pt:.5},children:n("menu.empty")}):s.map(c=>ed(br,{sx:{display:"flex",alignItems:"center",gap:.75},children:[hr(fo,{src:t?.get(c)??"",name:c,avatarSx:{width:26,height:26,fontSize:12},iconFontSize:16}),hr(br,{sx:{fontSize:14.5,color:o.colors.textPrimary},children:c})]},`${l.label}-${c}`))})]},l.label)}),hr(br,{sx:{display:"flex",justifyContent:"flex-end",pt:.5},children:hr(i1,{size:"small",color:"inherit",onClick:a.close,children:n("common.close")})})]}):null})}import{useFormaState as s1,useModal as c1}from"@ehfuse/forma";function Xg(){let e={members:c1({modalId:Ie("taskbox-task-members")})},t=s1({task:null});return{modals:e,ui:t,openDialog:a=>{t.setValue("task",a),e.members.open()}}}import{jsx as Jt,jsxs as jn}from"react/jsx-runtime";function Zg(e){let t=e?.parentElement??null;for(;t;){let o=window.getComputedStyle(t);if(/(auto|scroll)/.test(o.overflowY)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}var b1="(min-width:600px)";function od(e){let t=new Date(e);return t.setHours(0,0,0,0),t.setDate(1),t}function ex(e){let t=o=>String(o).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function tx({tasks:e,googleEvents:t=[],onGoogleEventClick:o,statusOptions:a,todayStr:r,onOpenDetail:i,onAddSchedule:l,myAccountSeq:s=0,avatarSrcByName:c,fallbackToStartDate:u=!1}){L();let m=be(),d=d1(b1),[p,f]=Qg(()=>od(new Date)),[g,x]=Qg(!1),h=gl(()=>{let y=new Date(p.getFullYear(),p.getMonth()+1,0).getDate();return Array.from({length:y},(I,S)=>{let M=new Date(p.getFullYear(),p.getMonth(),S+1);return{ymd:ex(M),dayNumber:S+1,weekday:M.getDay()}})},[p]),E=gl(()=>{let y=new Map;for(let I of e){let S=I.due_date.slice(0,10)||(u?I.start_date.slice(0,10)||String(I.created_time??"").slice(0,10):"");if(!S)continue;let M=y.get(S);M?M.push(I):y.set(S,[I])}for(let I of y.values())I.sort(ai);return y},[e,u]),b=gl(()=>u?e.filter(y=>!y.due_date.slice(0,10)&&!y.start_date.slice(0,10)&&!String(y.created_time??"").slice(0,10)).sort((y,I)=>y.completed!==I.completed?y.completed?1:-1:y.seq-I.seq):[],[e,u]),B=Xg(),T=gl(()=>ni(t),[t]),z=gl(()=>[p.getFullYear()],[p]),k=Hn(z),_=td(null),D=r.slice(0,7)===ex(p).slice(0,7);m1(()=>{if(!D)return;let y=()=>{let M=_.current,w=Zg(M);if(!w||!M)return;let q=M.getBoundingClientRect().top-w.getBoundingClientRect().top+w.scrollTop;w.scrollTop=Math.max(0,q-w.clientHeight/2+M.clientHeight/2)},I=setTimeout(y,100),S=setTimeout(y,400);return()=>{clearTimeout(I),clearTimeout(S)}},[D,p]);let F=td(null),R=td(null),C=y=>{f(S=>new Date(S.getFullYear(),S.getMonth()+y,1));let I=Zg(F.current);I&&I.scrollTo({top:0,behavior:"auto"})};return jn(go,{ref:F,onTouchStart:y=>{let I=y.touches[0];R.current=I?{x:I.clientX,y:I.clientY}:null},onTouchEnd:y=>{let I=R.current;R.current=null;let S=y.changedTouches[0];if(!I||!S)return;let M=S.clientX-I.x,w=S.clientY-I.y;Math.abs(M)<60||Math.abs(M)<=Math.abs(w)||C(M<0?1:-1)},sx:{minWidth:0,maxWidth:"100%",overflow:"hidden",bgcolor:m.colors.surface},children:[jn(go,{sx:{display:"flex",alignItems:"center",gap:.5,px:1.5,py:1,flexShrink:0},children:[Jt(Jg,{size:"small","aria-label":n("calendar.prevMonth"),onClick:()=>C(-1),children:Jt(p1,{sx:{fontSize:24,color:m.colors.textSecondary}})}),Jt(u1,{size:"small",color:"inherit",onClick:()=>f(od(new Date)),sx:{minWidth:0,px:1,fontSize:15.5,color:m.mode==="dark"?m.colors.textStrong:m.colors.textPrimary},children:n("common.today")}),Jt(Jg,{size:"small","aria-label":n("calendar.nextMonth"),onClick:()=>C(1),children:Jt(f1,{sx:{fontSize:24,color:m.colors.textSecondary}})}),jn(go,{onClick:()=>x(!0),sx:{ml:"auto",pr:.5,display:"flex",alignItems:"center",gap:.25,fontSize:16.5,fontWeight:m.mode==="dark"?400:700,color:m.mode==="dark"?m.colors.textStrong:m.colors.textPrimary,cursor:"pointer"},children:[cr(p,{year:"numeric",month:"long"}),Jt(g1,{sx:{fontSize:20,color:m.colors.textMuted}})]})]}),jn(go,{sx:{minWidth:0,overflowX:"hidden",borderTop:`1px solid ${m.calendar.borderColor}`},children:[b.length>0?jn(go,{sx:{display:"flex",alignItems:"center",gap:1,px:1,py:.75,minWidth:0,maxWidth:"100%",flexShrink:0,borderBottom:`1px solid ${m.calendar.borderColor}`},children:[jn(go,{sx:{width:52,flexShrink:0,fontSize:12.5,lineHeight:1.3,color:m.colors.textSecondary,textAlign:"center"},children:[n("calendar.noDateLine1"),Jt("br",{}),n("calendar.noDateLine2")]}),Jt(go,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:.5},children:b.map(y=>Jt(Zr,{task:y,statusOptions:a,onOpenDetail:i,isMine:s>0&&Number(y.manager_account_seq??0)===s,avatarSrcByName:c,showManagerAvatar:!0,onOpenMembers:B.openDialog},y.seq))})]}):null,h.map(({ymd:y,dayNumber:I,weekday:S})=>{let M=k.get(y)??"",w=y===r,q=!!M||S===0,v=E.get(y)??[],O=T.get(y)??[],j=v.length>0||O.length>0;return jn(go,{ref:w?_:void 0,onClick:l?()=>l(y):void 0,sx:{display:"flex",alignItems:"center",gap:1,px:1,minWidth:0,maxWidth:"100%",py:j?.75:.5,minHeight:44,flexShrink:0,borderBottom:`1px solid ${m.calendar.borderColor}`,...l?{cursor:"pointer"}:{}},children:[Jt(go,{sx:{width:52,flexShrink:0,display:"flex",flexDirection:"column",alignItems:"center",gap:.25},children:jn(go,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:.25,"@media (min-width:600px)":{flexDirection:"row",gap:.75}},children:[Jt(go,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:40,height:32,borderRadius:1,px:1.25,fontSize:22,fontWeight:500,color:w?m.colors.surface:q?m.colors.danger:S===6?m.colors.accentOnSurface:m.colors.textPrimary,bgcolor:w?m.colors.accentOnSurface:"transparent"},children:I}),Jt(go,{component:"span",sx:{fontSize:13,color:q?m.colors.danger:S===6?m.colors.accentOnSurface:m.colors.textSecondary},children:Hr(S)})]})}),jn(go,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:.5},children:[O.map(V=>Jt(ii,{event:V,onClick:o},V.uid)),v.map(V=>{let Z=ri(V),ie=Jt(Zr,{task:V,statusOptions:a,onOpenDetail:i,isMine:s>0&&Number(V.manager_account_seq??0)===s,avatarSrcByName:c,showManagerAvatar:!0,onOpenMembers:B.openDialog,showTime:!d,wrapTitle:!0},V.seq);return d?jn(go,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[Jt(go,{component:"span",sx:{width:44,flexShrink:0,textAlign:"right",fontSize:13.5,fontWeight:400,opacity:1,color:Z?V.completed?m.colors.textPrimary:m.colors.danger:"transparent"},children:Z||"00:00"}),Jt(go,{sx:{flex:1,minWidth:0},children:ie})]},V.seq):ie})]})]},y)})]}),Jt(Yg,{controller:B,avatarSrcByName:c}),Jt(x1,{open:g,centered:!0,monthOnly:!0,onClose:()=>x(!1),selectedDate:p,onDateChange:y=>{f(od(y)),x(!1)}})]})}import{useCallback as ox,useEffect as nx,useMemo as nd,useRef as cc,useState as xl}from"react";import{Box as Lt,Tooltip as ix}from"@mui/material";import h1 from"@ehfuse/overlay-scrollbar";import k1 from"@mui/icons-material/CheckCircle";import T1 from"@mui/icons-material/RadioButtonUnchecked";import{DndContext as y1,PointerSensor as C1,closestCenter as S1,useSensor as v1,useSensors as B1}from"@dnd-kit/core";import{SortableContext as _1,arrayMove as I1,useSortable as w1,verticalListSortingStrategy as D1}from"@dnd-kit/sortable";import{ConfirmActionPopper as E1}from"@ehfuse/mui-confirm-action";import R1 from"@mui/icons-material/DragIndicator";import{jsx as Tt,jsxs as kr}from"react/jsx-runtime";var rd=36,P1=48,rx=40,O1=24,M1=4,L1=14,ax=36,A1=12.5,ci=220,q1={high:{bg:"#f6c6c9",border:"#e5484d"},medium:{bg:"#c5d8f6",border:"#2f80ed"},low:{bg:"#f3e3b6",border:"#d9a514"}};function Sa(e){let t=String(e??"").trim();if(!t)return null;let o=new Date(`${t}T00:00:00`);return Number.isNaN(o.getTime())?null:o}function sc(e,t){let o=new Date(e);return o.setDate(o.getDate()+t),o}function ad(e,t){return Math.round((t.getTime()-e.getTime())/864e5)}function z1({task:e,dragHandle:t,onPointerDown:o,onClick:a}){let r=be(),i=cc(null),[l,s]=xl("");return Tt(ix,{title:l,arrow:!0,enterDelay:300,children:kr(Lt,{onPointerDown:o,onClick:c=>a(e,c),onMouseEnter:()=>{let c=i.current;s(c&&c.scrollWidth>c.clientWidth?e.title:"")},sx:{width:ci,flexShrink:0,position:"sticky",left:0,zIndex:2,bgcolor:r.timeline.bg,borderRight:`1px solid ${r.timeline.gridColor}`,display:"flex",alignItems:"center",gap:.5,pl:.5,pr:1.5,fontSize:15,fontWeight:r.mode==="dark"||e.completed?400:500,color:e.completed?r.colors.textMuted:r.mode==="dark"?r.colors.textStrong:r.colors.textPrimary,overflow:"hidden",whiteSpace:"nowrap",cursor:"pointer","&:hover":{bgcolor:r.colors.surfaceHover}},children:[t,Tt(Lt,{ref:i,component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title})]})})}function N1({id:e,showIndicator:t,children:o}){let a=be(),{attributes:r,listeners:i,setNodeRef:l}=w1({id:e});return kr(Lt,{ref:l,sx:{position:"relative"},children:[t?Tt(Lt,{sx:{position:"absolute",top:-1,left:0,right:0,height:2,bgcolor:a.colors.accentOnSurface,zIndex:5}}):null,o({...r,...i})]})}function lx({tasks:e,hideCompletedChecklist:t=!1,todayStr:o,onOpenDetail:a,onToggleChecklist:r,onReorderTasks:i,onTaskContextMenu:l}){L();let s=be(),[c,u]=xl(null),m=nd(()=>[...e].sort((w,q)=>{let v=(w.timeline_sort_no??0)>0,O=(q.timeline_sort_no??0)>0;if(v&&O)return(w.timeline_sort_no??0)-(q.timeline_sort_no??0);if(v!==O)return v?-1:1;let j=w.due_date||w.start_date,V=q.due_date||q.start_date;return j!==V?j<V?-1:1:w.seq-q.seq}),[e]),[d,p]=xl(null),[f,g]=xl(null),x=B1(v1(C1,{activationConstraint:{distance:4}})),h=ox(w=>{p(w.over?Number(w.over.id):null)},[]),E=ox(w=>{p(null),g(null);let{active:q,over:v}=w;if(!v||q.id===v.id)return;let O=m.map(Z=>Z.seq),j=O.indexOf(Number(q.id)),V=O.indexOf(Number(v.id));j===-1||V===-1||i(I1(O,j,V))},[m,i]),b=nd(()=>{let w=Sa(o)??new Date,q=w,v=sc(w,21);for(let V of m){let Z=Sa(V.start_date)??Sa(V.due_date),ie=Sa(V.due_date)??Z;Z&&Z<q&&(q=Z),ie&&ie>v&&(v=ie)}let O=sc(q,-3),j=ad(O,sc(v,3))+1;return Array.from({length:j},(V,Z)=>sc(O,Z))},[m,o]),B=b[0],T=b.findIndex(w=>Et(w)===o),{dayWidths:z,dayOffsets:k,gridWidth:_}=nd(()=>{let w=b.map((O,j)=>O.getDate()===1||j===0?P1:rd),q=[],v=0;for(let O of w)q.push(v),v+=O;return{dayWidths:w,dayOffsets:q,gridWidth:v}},[b]),D=ci+_,F=cc(null),R=w=>{F.current={x:w.clientX,y:w.clientY}},C=(w,q)=>{let v=F.current;F.current=null,!(v&&(Math.abs(q.clientX-v.x)>5||Math.abs(q.clientY-v.y)>5))&&a(w)},y=cc(null),[I,S]=xl(!1);nx(()=>{let w=y.current?.getScrollContainer();if(!w)return;let q=()=>S(w.scrollHeight>w.clientHeight);q();let v=new ResizeObserver(q);return v.observe(w),()=>v.disconnect()},[m.length]);let M=cc(!1);return nx(()=>{if(m.length===0||M.current)return;M.current=!0;let w=window.requestAnimationFrame(()=>{let q=y.current?.getScrollContainer();!q||T<0||(q.scrollLeft=Math.max(0,k[T]-rd*3))});return()=>window.cancelAnimationFrame(w)},[m.length]),kr(Lt,{sx:{flex:1,minHeight:0,minWidth:0,maxWidth:"100%",display:"flex",flexDirection:"column",border:`1px solid ${s.timeline.gridColor}`,borderRadius:"0 0 4px 4px",overflow:"hidden",bgcolor:s.timeline.headerBg},children:[Tt(Lt,{sx:{flex:1,minHeight:0,minWidth:0,contain:"inline-size"},children:Tt(h1,{ref:y,style:{height:"100%"},contentStyle:{width:"max-content",minWidth:"100%"},thumb:{width:8},showHorizontalScrollbar:!0,dragScroll:{excludeClasses:["taskbox-timeline-handle"]},children:kr(Lt,{sx:{width:D,position:"relative",bgcolor:s.timeline.bg},children:[kr(Lt,{sx:{display:"flex",position:"sticky",top:0,zIndex:3,bgcolor:s.timeline.headerBg,borderBottom:`1px solid ${s.timeline.gridColor}`},children:[Tt(Lt,{sx:{width:ci,height:ax,flexShrink:0,position:"sticky",left:0,zIndex:4,bgcolor:s.timeline.headerBg,borderRight:`1px solid ${s.timeline.gridColor}`,display:"flex",alignItems:"center",px:1.5,fontSize:13,color:s.colors.textSecondary},children:n("common.title")}),b.map((w,q)=>{let v=w.getDay(),O=q===T,j=w.getDate()===1||q===0;return Tt(Lt,{sx:{width:z[q],height:ax,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:A1,fontWeight:O&&s.mode!=="dark"?700:400,color:O?s.timeline.bg:v===0?s.colors.danger:v===6?s.colors.accentOnSurface:s.colors.textSecondary,bgcolor:O?s.colors.danger:"transparent",borderRight:`1px solid ${s.timeline.gridColor}`,whiteSpace:"nowrap"},children:j?`${w.getMonth()+1}/${w.getDate()}`:w.getDate()},Et(w))})]}),Tt(y1,{sensors:x,collisionDetection:S1,onDragStart:w=>g(Number(w.active.id)),onDragOver:h,onDragEnd:E,onDragCancel:()=>{p(null),g(null)},children:Tt(_1,{items:m.map(w=>String(w.seq)),strategy:D1,children:kr(Lt,{sx:{position:"relative"},children:[b.map((w,q)=>{let v=w.getDay(),O=q===T;return!O&&v!==0&&v!==6?null:Tt(Lt,{sx:{position:"absolute",top:0,bottom:0,left:ci+k[q],width:z[q],bgcolor:O?"rgba(229,72,77,0.07)":s.colors.surfaceSubtle,zIndex:0}},`stripe-${Et(w)}`)}),m.map((w,q)=>{let v=Sa(w.start_date)??Sa(w.due_date),O=Sa(w.due_date)??v,j=v?Math.min(b.length-1,Math.max(0,ad(B,v))):0,V=O?Math.min(b.length-1,Math.max(j,ad(B,O))):j,Z=q1[w.priority],ie=ci+k[j]+2,ue=k[V]+z[V]-k[j]-4,K=(w.checklist??[]).map((te,$)=>({entry:te,index:$})).filter(({entry:te})=>!t||!te.checked);return Tt(N1,{id:String(w.seq),showIndicator:d===w.seq&&f!==w.seq,children:te=>kr(Lt,{sx:{borderBottom:q===m.length-1&&I?"none":`1px solid ${s.timeline.gridColor}`,position:"relative",zIndex:1,opacity:f===w.seq?.45:1},children:[kr(Lt,{onContextMenu:$=>l(w,$),sx:{display:"flex",height:rx,position:"relative","&:hover":{bgcolor:"rgba(47,128,237,0.04)"}},children:[Tt(z1,{task:w,dragHandle:Tt(Lt,{component:"span",className:"taskbox-timeline-handle",...te,onClick:$=>$.stopPropagation(),sx:{display:"inline-flex",alignItems:"center",flexShrink:0,color:s.colors.accentOnSurface,cursor:"grab",touchAction:"none","&:hover":{color:s.colors.accentOnSurface}},children:(()=>{let $=(w.is_notice||w.is_event?Le(w.icon||(w.is_notice?Dt:Nt)):null)??R1;return Tt($,{sx:{fontSize:17}})})()}),onPointerDown:R,onClick:C}),Tt(ix,{title:`${w.title} (${w.start_date||"?"} ~ ${w.due_date||"?"})`,arrow:!0,enterDelay:300,children:Tt(Lt,{onPointerDown:R,onClick:$=>C(w,$),sx:{position:"absolute",top:(rx-20)/2,left:ie,width:Math.max(rd-4,ue),height:20,borderRadius:1,bgcolor:Z.bg,border:`1px solid ${Z.border}`,opacity:w.completed?.45:1,cursor:"pointer","&:hover":{filter:"brightness(0.95)"}}})})]}),K.map(({entry:$,index:G},ae)=>Tt(Lt,{sx:{display:"flex",height:O1,position:"relative",mt:ae===0?`${M1}px`:0,mb:ae===K.length-1?`${L1}px`:0},children:Tt(Lt,{sx:{width:ci,flexShrink:0,position:"sticky",left:0,zIndex:2,bgcolor:s.timeline.bg,borderRight:`1px solid ${s.timeline.gridColor}`,display:"flex",alignItems:"center",pl:4.25,pr:1.5,fontSize:13,color:$.checked?s.colors.textMuted:s.colors.textPrimary},children:kr(Lt,{onClick:Re=>u({anchorEl:Re.currentTarget,taskSeq:w.seq,index:G,checked:!$.checked}),sx:{display:"inline-flex",alignItems:"center",gap:.75,minWidth:0,cursor:"pointer"},children:[$.checked?Tt(k1,{sx:{fontSize:17,color:s.colors.accentOnSurface,flexShrink:0}}):Tt(T1,{sx:{fontSize:17,color:s.colors.textMuted,flexShrink:0}}),Tt(Lt,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:$.checked?"line-through":"none"},children:$.label})]})})},`${w.seq}-check-${G}`))]})},w.seq)}),m.length===0?Tt(Lt,{sx:{py:8,textAlign:"center",color:s.colors.textMuted,fontSize:14},children:n("table.emptyTasks")}):null]})})})]})})}),Tt(E1,{open:!!c,anchorEl:c?.anchorEl??null,title:c?.checked?n("calendar.checklistCompleteConfirm"):n("task.uncompleteConfirm"),confirmText:c?.checked?n("common.done"):n("task.unmark"),onCancel:()=>u(null),onConfirm:()=>{c&&r(c.taskSeq,c.index,c.checked),u(null)}})]})}import{jsx as va}from"react/jsx-runtime";function w9(e){switch(e.view){case"card":case"kanban":{let{view:t,...o}=e;return va(Ku,{...o,columnAxis:t==="kanban"?"status":"project"})}case"sprint":{let{view:t,...o}=e;return va(Ku,{...o,columnAxis:"sprint"})}case"calendar":{let{view:t,...o}=e;return va(Wg,{...o})}case"month":{let{view:t,...o}=e;return va(jg,{...o})}case"agenda":{let{view:t,...o}=e;return va(tx,{...o})}case"timeline":{let{view:t,...o}=e;return va(lx,{...o})}default:{let{view:t,...o}=e;return va(xg,{...o})}}}var D9=["list","card","kanban","calendar","month","timeline"];import{Box as Go}from"@mui/material";import{Fragment as F1,jsx as Yn,jsxs as Ba}from"react/jsx-runtime";function sx(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e)||!/^\d{4}-\d{2}-\d{2}$/.test(t))return null;let o=new Date(`${e}T00:00:00`),a=new Date(`${t}T00:00:00`);return Math.round((o.getTime()-a.getTime())/864e5)}function cx({tasks:e,todayStr:t,showProgress:o=!0,dday:a=null,workdaysLeft:r=null,showPoints:i=!0,showHours:l=!0,showOverdue:s=!0,showInfo:c=!0,inline:u=!1}){L();let m=be(),d=e.filter(_=>!_.archived),p=d.filter(_=>_.completed).length,f=d.length>0?Math.round(p/d.length*100):0,g=d.filter(_=>!_.completed&&!_.is_event&&!!_.due_date&&_.due_date.slice(0,10)<t).length,x=d.reduce((_,D)=>D.completed?_:_+(D.story_points??0),0),h=o?Yn(Go,{sx:{flex:u?"0 0 110px":"1 1 auto",minWidth:0,height:m.summary.gaugeHeight,borderRadius:3,bgcolor:m.summary.gaugeTrackColor},children:Yn(Go,{sx:{height:"100%",borderRadius:3,width:`${f}%`,bgcolor:f>=100?m.summary.gaugeCompleteColor:m.summary.gaugeBarColor,transition:"width 0.2s"}})}):null,E=o?Ba(Go,{component:"span",sx:{flexShrink:0,fontSize:u?14:13,color:m.summary.textColor},children:[f,"%"]}):null,b={color:m.summary.numberColor,fontWeight:700,fontSize:u?15:14},B=d.length-p,T=Ba(F1,{children:[u?null:Yn("span",{children:nn("board.remainingCount",{count:Yn(Go,{component:"span",sx:b,children:B})})}),s&&g>0?Yn(Go,{component:"span",sx:{color:m.summary.overdueColor,fontWeight:600},children:nn("board.overdueCount",{count:Yn(Go,{component:"span",sx:{fontWeight:700,fontSize:u?15:14},children:g})})}):null,i&&x>0?Ba("span",{children:[Yn(Go,{component:"span",sx:b,children:x}),"SP"]}):null]}),z=typeof r=="number"&&Number.isFinite(r)?Yn("span",{children:nn("board.workdaysLeft",{count:Yn(Go,{component:"span",sx:b,children:r})})}):null,k=typeof a=="number"&&Number.isFinite(a)?Yn(Go,{component:"span",sx:{ml:u?0:"auto",flexShrink:0,px:.6,py:.1,borderRadius:.5,fontSize:12,fontWeight:600,bgcolor:m.summary.overdueColor,color:m.colors.textInverse,lineHeight:1.6},children:a===0?"D-day":a>0?`D-${a}`:`D+${-a}`}):null;return u?Ba(Go,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0,fontSize:14.5,color:m.summary.textColor,whiteSpace:"nowrap",...m.summary.sx},children:[c?T:null,c?z:null,c?k:null,h,E]}):Ba(Go,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[o?Ba(Go,{sx:{display:"flex",alignItems:"center",gap:1},children:[h,E]}):null,Ba(Go,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,fontSize:13.5,color:m.summary.textColor},children:[T,z,k]})]})}import{useMemo as W1}from"react";function H1(e){let t=String(e??"").trim();if(!t)return 0;let o=0,a=!1;for(let r of t.matchAll(/(\d+(?:\.\d+)?)\s*(h|시간|m|분|d|일)/gi)){let i=parseFloat(r[1]),l=r[2].toLowerCase();a=!0,l==="m"||l==="\uBD84"?o+=i/60:l==="d"||l==="\uC77C"?o+=i*8:o+=i}if(!a){let r=parseFloat(t);Number.isFinite(r)&&(o+=r)}return o}function z9(e){let t=Math.round(e*10)/10;return n("effort.hours",{value:t%1===0?t.toFixed(0):t.toFixed(1)})}function mx(e,t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(e)||!/^\d{4}-\d{2}-\d{2}$/.test(t))return 0;let a=new Date(`${e}T00:00:00`),r=new Date(`${t}T00:00:00`);if(r<a||r.getTime()-a.getTime()>3660*864e5)return 0;let i=0;for(let l=new Date(a);l<=r;l.setDate(l.getDate()+1)){let s=l.getDay();if(s===0||s===6)continue;let c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,"0")}-${String(l.getDate()).padStart(2,"0")}`;o.has(c)||(i+=1)}return i}function N9(e){return e.reduce((t,o)=>o.completed?t:t+H1(o.estimated_time),0)}import{jsx as $1}from"react/jsx-runtime";function K9({sprint:e,tasks:t,todayStr:o,...a}){let r=e.status==="closed"?null:sx(e.end_date,o),i=r!==null&&r>=0,l=W1(()=>{if(!i)return[];let u=Number(o.slice(0,4)),m=Number(e.end_date.slice(0,4))||u,d=[];for(let p=u;p<=Math.max(u,m);p+=1)d.push(p);return d},[i,o,e.end_date]),s=Hn(l),c=i?mx(o,e.end_date,new Set(s.keys())):null;return $1(cx,{tasks:t,todayStr:o,dday:r,workdaysLeft:c,...a})}import{useEffect as uI,useRef as dI,useState as pI}from"react";import{Box as cd}from"@mui/material";import{Children as V1}from"react";import{Box as ld,CircularProgress as K1}from"@mui/material";import{jsx as mc}from"react/jsx-runtime";var id={xs:2,md:3};function ux(){return mc(ld,{sx:{position:"fixed",top:"calc(50% + 30px)",left:"50%",transform:"translate(-50%, -50%)",zIndex:1},children:mc(K1,{size:44,thickness:4,sx:{color:"#94a3b8"}})})}function dx({children:e,edge:t=!1}){return mc(ld,{sx:t?{minWidth:0,display:"flex",flexDirection:"column",gap:"var(--mobile-edge-gap, 7px)",pb:id,mx:"calc(-1 * var(--mobile-edge-bleed, 16px))"}:{minWidth:0,display:"flex",flexDirection:"column",gap:id,pb:id},children:V1.map(e,o=>o==null||o===!1?null:mc(ld,{sx:{bgcolor:"background.paper",borderRadius:t?0:1,boxShadow:t?"none":1,overflow:"hidden",minWidth:0},children:o}))})}import{useLayoutEffect as Y1,useRef as X1,useState as sd}from"react";import{Box as Ao,Button as fx,Checkbox as Q1,Collapse as J1,IconButton as Z1,Typography as un}from"@mui/material";import eI from"@mui/icons-material/ExpandMore";import tI from"@mui/icons-material/ExpandLess";import gx from"@mui/icons-material/CheckCircle";import oI from"@mui/icons-material/CheckCircleOutlineOutlined";import{Fragment as j1,jsx as px}from"react/jsx-runtime";var U1="taskbox-search-highlight";function G1(e,t){let o=t?.keyPrefix??"hl";return e.map((a,r)=>px("span",{className:a.highlight?t?.highlightClassName??U1:t?.className,style:a.highlight?{fontWeight:700,color:"#2563eb"}:void 0,children:a.text},`${o}-${a.text}-${r}`))}function mi({text:e,keyword:t,fallback:o="-",className:a,highlightClassName:r,keyPrefix:i}){let l=String(e??"").trim()||o,s=Vs(l,t);return px(j1,{children:G1(s,{className:a,highlightClassName:r,keyPrefix:i})})}import{Fragment as mI,jsx as he,jsxs as In}from"react/jsx-runtime";var nI={flexShrink:0,minWidth:64,textAlign:"center",px:.75,py:.35,borderRadius:.75,bgcolor:"#f1f5f9",color:"#64748b",fontSize:pt(12.5),fontWeight:500,lineHeight:1.4},jo={fontSize:pt(14.5),color:"#374151",minWidth:0,lineHeight:1.45};function dn({label:e,children:t}){return In(Ao,{sx:{display:"flex",alignItems:"flex-start",gap:1,minWidth:0},children:[he(Ao,{sx:nI,children:e}),he(Ao,{sx:{...jo,flex:1,pt:.2},children:t})]})}var rI=10,aI=24,iI=16,lI=100,sI="#e5484d",cI="#fff5f5";function xx({task:e,statusOptions:t,projectLabel:o,searchText:a,todayStr:r,dimCompleted:i=!0,onRequestToggleCompleted:l,onOpenDetail:s,onTaskContextMenu:c,targetSummary:u="",ackInfo:m,completeLocked:d=!1,unread:p=!1,noticeReadOnly:f=!1,onAckConfirm:g,onAckListClick:x,myManaged:h=!1,isPost:E=!1,simple:b=!1}){L();let B=E?[e.author_name||e.created_by||"",Vo(e.created_time)].filter(Boolean).join(" \xB7 "):"",T=e.is_event?rl(e):Ft(e),z=String(e.due_date??"").slice(11,16),k=e.is_event?String(e.event_time??"").trim():/^\d{2}:\d{2}$/.test(z)?z:String(e.estimated_time??"").trim(),_=Vo(e.start_date),D=Vo(e.due_date),F=_&&k&&!D?`${_} ${k}`:_,R=D&&k?`${D} ${k}`:D,C=se(),y=C.titlePrefix?.(e)??"",I=!e.is_notice&&e.completed&&!!e.review_pending&&!!C.onReviewDone&&(C.myAccountSeq??0)>0&&(e.author_account_seq??0)===(C.myAccountSeq??0),S=!!C.onReturnTask&&no(e,C.myAccountSeq??0),[M,w]=sd(null),q=e.is_event&&e.due_date?String(e.due_date).slice(0,10):"",v=!!q&&q===r,O=!!q&&q<r,j=!e.is_event&&!e.is_notice&&!e.completed&&!!e.due_date&&e.due_date<r,V=(e.receiver_names??[]).filter(Boolean),Z=!e.is_notice&&Vn(e,C.myAccountSeq??0).canConfirm,[ie,ue]=sd(!1),K=b&&!ie,te=b&&ie&&C.renderTaskBodyPreview?C.renderTaskBodyPreview(e):null,$=X1(null),[G,ae]=sd(0);Y1(()=>{let ce=$.current;if(!K||!ce)return;let Q=()=>ae(rI+ce.offsetHeight/2);if(Q(),typeof ResizeObserver>"u")return;let W=new ResizeObserver(Q);return W.observe(ce),()=>W.disconnect()},[K]);let Re=O?"text.secondary":j||v?"#e5484d":jo.color,mt=j||v?600:400;return In(Ao,{role:"button",tabIndex:0,onClick:()=>s(e),onKeyDown:ce=>{(ce.key==="Enter"||ce.key===" ")&&(ce.preventDefault(),s(e))},onContextMenu:ce=>c(e,ce),sx:{display:"flex",flexDirection:"column",gap:.75,minWidth:0,p:1.25,pl:"calc(10px + var(--mobile-edge-band-inset, 0px))",cursor:"pointer",position:"relative",...Z?{bgcolor:cI}:{}},children:[h||Z?he(Ao,{sx:{position:"absolute",left:"var(--mobile-edge-band-inset, 0px)",top:0,bottom:0,width:4,bgcolor:Z?sI:"primary.main"}}):null,In(Ao,{ref:$,sx:{display:"flex",alignItems:"flex-start",gap:.75,minWidth:0,mb:K?0:1},children:[e.is_event?(()=>{let ce=Le(e.icon||Nt);return ce?he(ce,{sx:{fontSize:21,flexShrink:0,mt:.2,color:e.icon_color||"#1e3a8a"}}):null})():!E&&!f&&!d?he(Q1,{checked:e.completed,icon:he(oI,{sx:{fontSize:22,color:"#9a9a97",opacity:.45}}),checkedIcon:he(gx,{sx:{fontSize:22,color:"#2f80ed"}}),onClick:ce=>ce.stopPropagation(),onChange:(ce,Q)=>l({anchorEl:ce.currentTarget,taskSeq:e.seq,nextCompleted:Q}),sx:{p:0,mt:.1,flexShrink:0}}):null,(()=>{if(!e.is_notice)return null;let ce=Le(e.icon||Dt);return ce?he(ce,{sx:{fontSize:19,flexShrink:0,mt:"1px",color:e.icon_color||"#e5484d"}}):null})(),In(Ao,{sx:{minWidth:0,flex:1,display:"flex",flexDirection:"column",gap:.5},children:[In(un,{sx:{fontSize:`calc(${pt(16)} - var(--card-title-shrink, 0px))`,fontWeight:e.completed&&i?500:600,lineHeight:1.35,minWidth:0,color:e.completed&&i?"#9a9a97":"#111827"},children:[y?he(Ao,{component:"span",sx:{color:"text.secondary",fontWeight:500,fontSize:pt(14),mr:.75},children:he(mi,{text:y,keyword:a})}):null,he(mi,{text:e.title,keyword:a})]}),K&&E?he(un,{sx:{...jo,fontSize:pt(14),color:"text.secondary",minWidth:0},children:B}):K?In(Ao,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:1.25,rowGap:.25,minWidth:0},children:[he(po,{priority:e.priority,small:!0,dotOnly:!0}),R?he(un,{sx:{...jo,fontSize:pt(14),whiteSpace:"nowrap",color:Re,fontWeight:mt},children:R}):null,!e.is_notice&&Sn(e)?he(un,{sx:{...jo,fontSize:pt(14),color:"text.secondary",whiteSpace:"nowrap"},children:he(mi,{text:Sn(e),keyword:a})}):null]}):null]}),p&&!e.completed?he(Ao,{component:"span",sx:{flexShrink:0,px:.55,fontSize:pt(10.5),fontWeight:700,lineHeight:1.6,color:"#fff",bgcolor:"#e5484d",borderRadius:"4px"},children:"N"}):null,b?In(mI,{children:[he(Ao,{sx:{flexShrink:0,width:46}}),he(Z1,{size:"small","aria-label":ie?n("board.collapse"):n("board.expand"),onClick:ce=>{ce.stopPropagation(),!ie&&typeof e.content!="string"&&C.onNeedTaskDetail?.(e.seq),ue(Q=>!Q)},onKeyDown:ce=>ce.stopPropagation(),sx:{position:"absolute",top:0,right:0,bottom:0,width:56,p:0,pr:`${iI}px`,pt:G?`${Math.max(0,G-aI/2)}px`:"10px",justifyContent:"flex-end",alignItems:"flex-start",borderRadius:0,color:"#6b7280"},children:ie?he(tI,{}):he(eI,{})})]}):null]}),he(J1,{in:!K,timeout:lI,unmountOnExit:!0,appear:!1,children:In(Ao,{sx:{display:"flex",flexDirection:"column",gap:.6,minWidth:0},children:[E?he(dn,{label:n("board.written"),children:he(un,{sx:{...jo,fontSize:pt(14)},children:B})}):null,E?null:he(dn,{label:T?n("col.status"):n("col.priority"),children:In(Ao,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1.25},children:[T?he(Ke,{option:T,small:!0}):null,he(po,{priority:e.priority,small:!0,dotOnly:!0})]})}),(e.label_keys??[]).length>0?he(dn,{label:n("dialog.label"),children:he($r,{labelKeys:e.label_keys,labelOptions:t})}):null,o?he(dn,{label:n("col.project"),children:he(un,{sx:jo,children:o})}):null,F?he(dn,{label:n("board.start"),children:he(un,{sx:jo,children:F})}):null,R?he(dn,{label:n("board.due"),children:In(un,{sx:{...jo,color:Re,fontWeight:mt},children:[R,j?n("board.overdueSuffix"):""]})}):null,I||S?In(dn,{label:n("board.review"),children:[S?he(Uo,{onClick:ce=>{ce.stopPropagation(),l({anchorEl:ce.currentTarget,taskSeq:e.seq,nextCompleted:!1})},sx:{py:0,mr:1,fontSize:pt(13)},children:n("task.revert")}):null,I?he(fx,{size:"small",variant:"contained",disableElevation:!0,onClick:ce=>{ce.stopPropagation(),w(ce.currentTarget)},sx:{...jr,py:0,fontSize:pt(13)},children:n("col.reviewDone")}):null,he(Yr,{anchorEl:M,onCancel:()=>w(null),onConfirm:()=>{C.onReviewDone?.(e),w(null)}})]}):null,e.is_notice?he(dn,{label:n("col.targets"),children:he(un,{sx:jo,children:u||n("col.allEmployees")})}):null,m?he(dn,{label:n("task.confirm"),children:he(fx,{size:"small",variant:m.canAck?"contained":"outlined",color:"inherit",startIcon:m.acked?he(gx,{sx:{fontSize:"16px !important",color:"#2f80ed"}}):null,onClick:ce=>{ce.stopPropagation(),m.canAck?g?.(e):x?.(e,ce.currentTarget)},sx:{py:0,px:1.25,minWidth:0,fontSize:pt(13),...m.canAck?{color:"#fff",bgcolor:"#2f80ed",boxShadow:"none","&:hover":{bgcolor:"#1e6fd9",boxShadow:"none"}}:{bgcolor:"#fff",borderColor:"#d5d8dc"}},children:m.canAck?n("task.confirm"):`${m.count}/${m.total}`})}):null,!e.is_notice&&Sn(e)?he(dn,{label:n("col.owner"),children:he(un,{sx:jo,children:he(mi,{text:Sn(e),keyword:a})})}):null,!e.is_notice&&V.length>0?he(dn,{label:n("col.cc"),children:he(un,{sx:jo,children:V.join(", ")})}):null,e.note?he(dn,{label:n("col.note"),children:he(un,{sx:jo,children:he(mi,{text:e.note,keyword:a})})}):null,te?he(Ao,{sx:{mt:.5,minWidth:0},children:te}):null]})})]})}import{jsx as ui,jsxs as gI}from"react/jsx-runtime";function fI(e,t){if(e.completed||e.archived||t<=0)return;let o=Vn(e,t);if(o.canConfirm)return{count:o.count,total:o.total,acked:!1,canAck:!0,pendingNames:o.pendingNames}}function R6({tasks:e,statusOptions:t,customTabs:o,loading:a,dimCompleted:r=!0,simple:i=!1,edge:l=!1,searchText:s,todayStr:c,onToggleCompleted:u,onOpenDetail:m,onTaskContextMenu:d,getTargetSummary:p,getAckInfo:f,getNoticeReadOnly:g,isTaskUnread:x,getCompleteLocked:h,isPostItem:E,onAckConfirm:b,onAckListClick:B,onEndReached:T,myAccountSeq:z=0}){L();let k=new Map(o.map(S=>[S.key,S.label])),[_,D]=pI(null),{onReturnTask:F,slots:R}=se(),C=R?.loadingSpinner??ux,y=_?e.find(S=>S.seq===_.taskSeq):void 0,I=dI(null);return uI(()=>{let S=I.current;if(!T||!S)return;let M=new IntersectionObserver(w=>{w[0]?.isIntersecting&&T()});return M.observe(S),()=>M.disconnect()},[T,e.length]),e.length===0?a?ui(C,{}):ui(cd,{sx:{py:6,textAlign:"center",color:"#94a3b8",fontSize:"0.9rem"},children:n("table.noTasks")}):gI(cd,{sx:{minWidth:0},children:[ui(dx,{edge:l,children:e.map(S=>ui(xx,{dimCompleted:r,simple:i,myManaged:z>0&&!S.is_notice&&!S.is_event&&(S.manager_account_seq??0)===z,task:S,statusOptions:t,projectLabel:S.tab_key?k.get(S.tab_key)??"":"",searchText:s,todayStr:c,onRequestToggleCompleted:D,onOpenDetail:m,onTaskContextMenu:d,targetSummary:S.is_notice?p?.(S):void 0,ackInfo:S.is_notice?f?.(S):fI(S,z),noticeReadOnly:S.is_notice?g?.(S):!1,unread:x?.(S)??!1,completeLocked:h?.(S)??!1,isPost:!!E?.(S),onAckConfirm:b,onAckListClick:B},S.seq))}),T?ui(cd,{ref:I,sx:{height:"1px"}}):null,ui(Lo,{open:!!_,anchorEl:_?.anchorEl??null,nextCompleted:_?.nextCompleted??!1,returnMode:!!F&&!!(y&&no(y,z)),onCancel:()=>D(null),onConfirm:S=>{_&&(S&&F&&y?F(y,S):u(_.taskSeq,_.nextCompleted)),D(null)}})]})}import{useState as bl}from"react";import{Box as bt,Checkbox as xI,Menu as bI,MenuItem as bx,Tooltip as hI}from"@mui/material";import kI from"@mui/icons-material/CheckCircle";import TI from"@mui/icons-material/CheckCircleOutlineOutlined";import yI from"@mui/icons-material/NotesOutlined";import CI from"@mui/icons-material/AutorenewOutlined";import SI from"@mui/icons-material/CalendarTodayOutlined";import vI from"@mui/icons-material/EventOutlined";import BI from"@mui/icons-material/PersonOutlineOutlined";import _I from"@mui/icons-material/PeopleAltOutlined";import II from"@mui/icons-material/StickyNote2Outlined";import{ConfirmActionPopper as wI}from"@ehfuse/mui-confirm-action";import{Fragment as RI,jsx as we,jsxs as Tr}from"react/jsx-runtime";var md={completed:{get label(){return n("col.done")},width:"44px",align:"center",icon:null},title:{get label(){return n("col.title")},width:"1fr",align:"left",icon:we(yI,{sx:{fontSize:15}})},manager_name:{get label(){return n("col.owner")},width:"112px",align:"center",icon:we(BI,{sx:{fontSize:15}})},receiver_names:{get label(){return n("col.cc")},width:"120px",align:"center",icon:we(_I,{sx:{fontSize:15}})},status:{get label(){return n("col.status")},width:"104px",align:"center",icon:we(CI,{sx:{fontSize:15}})},priority:{get label(){return n("col.priority")},width:"88px",align:"center",icon:null},start_date:{get label(){return n("col.startTime")},width:"110px",align:"center",icon:we(SI,{sx:{fontSize:15}})},due_date:{get label(){return n("col.due")},width:"110px",align:"center",icon:we(vI,{sx:{fontSize:15}})},note:{get label(){return n("col.note")},width:"1fr",align:"left",icon:we(II,{sx:{fontSize:15}})}},DI=[{id:"completed"},{id:"title"},{id:"manager_name"},{id:"due_date"},{id:"status"}],EI=new Set(["manager_name","status","due_date"]);function hx(e){let t=String(e??"").trim();return t?t.slice(2,10).replaceAll("-","."):""}function iV(e,t){return t>0?e.filter(o=>!o.is_notice&&!o.completed&&!o.archived&&sn(o)==="group"&&Number(o.visibility_group_seq??0)===t).sort((o,a)=>{let r=String(o.due_date??"").trim(),i=String(a.due_date??"").trim();return r!==i?r?i?r.localeCompare(i):-1:1:Number(o.seq)-Number(a.seq)}):[]}function lV({tasks:e,columns:t=DI,loading:o=!1,emptyText:a=n("table.noTasks"),myAccountSeq:r=0,avatarSrcByName:i,managerCandidates:l=[],canAssignManager:s,onOpenDetail:c,onToggleCompleted:u,onChangeStatus:m,onChangeDueDate:d,onChangeReminder:p,onChangeManager:f,onClaimTask:g}){L();let x=be(),[h,E]=bl(null),[b,B]=bl(null),[T,z]=bl(null),[k,_]=bl(null),{onReturnTask:D}=se(),[F,R]=bl(null),C=t.map(S=>S.width??md[S.id].width).join(" "),y=(S,M)=>we(fo,{src:i?.get(S)??"",name:S,avatarSx:{width:M,height:M,fontSize:Math.round(M/2),flexShrink:0,borderRadius:"50%"},iconFontSize:Math.round(M*.6)}),I=(S,M)=>{let q=md[S.id].align==="center";switch(S.id){case"completed":if(M.is_event){let v=Le(M.icon||Nt);return we(bt,{className:"cell",sx:{justifyContent:"center"},children:v?we(v,{sx:{fontSize:19,color:M.icon_color||"#1e3a8a"}}):null},S.id)}return we(bt,{className:"cell",sx:{justifyContent:"center",...u?{"&:hover":{bgcolor:x.table.cellHoverBg}}:{}},children:we(hI,{title:M.completed?n("menu.uncomplete"):n("menu.complete"),arrow:!0,enterDelay:300,disableInteractive:!0,children:we(xI,{checked:!!M.completed,icon:we(TI,{sx:{fontSize:20,color:"#9a9a97",opacity:.45}}),checkedIcon:we(kI,{sx:{fontSize:20,color:"#2f80ed"}}),onChange:v=>_({anchorEl:v.currentTarget,task:M}),sx:{p:.5}})})},S.id);case"title":{let v=M.is_notice?Le(M.icon||Dt):null,O=M.icon_color||"#e5484d";return Tr(bt,{className:"cell",onClick:()=>c(M),sx:{gap:1,cursor:"pointer","&:hover":{bgcolor:x.table.cellHoverBg}},children:[v?we(v,{sx:{fontSize:18,flexShrink:0,color:O}}):null,we(bt,{component:"span",sx:{fontSize:14.5,fontWeight:x.table.rowTitleFontWeight,color:x.table.rowTitleColor,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:M.title||n("table.untitled")})]},S.id)}case"manager_name":{if(cl(M)){let j=Sn(M);return Tr(bt,{className:"cell",sx:{gap:.75,justifyContent:"center"},children:[j?y(j,22):null,we(bt,{component:"span",sx:{fontSize:14,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:j})]},S.id)}let v=s?s(M):!1,O=r>0&&Number(M.manager_account_seq??0)===r;return v&&f?Tr(bt,{className:"cell",onClick:j=>z({anchorEl:j.currentTarget,task:M}),sx:{gap:.75,justifyContent:"center",cursor:"pointer","&:hover":{bgcolor:x.table.cellHoverBg}},children:[M.manager_name?y(M.manager_name,22):null,we(bt,{component:"span",sx:{fontSize:14,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:M.manager_name||""})]},S.id):we(bt,{className:"cell",sx:{gap:.75,justifyContent:"center"},children:M.manager_name?Tr(RI,{children:[y(M.manager_name,22),we(bt,{component:"span",sx:{fontSize:14,fontWeight:O?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:M.manager_name})]}):g?we(Uo,{onClick:j=>R({anchorEl:j.currentTarget,taskSeq:Number(M.seq)}),children:n("col.claim")}):null},S.id)}case"receiver_names":return we(bt,{className:"cell",sx:{justifyContent:"center",fontSize:14,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(M.receiver_names??[]).join(", ")},S.id);case"status":return we(bt,{className:"cell",onClick:m?v=>E({anchorEl:v.currentTarget,task:M}):void 0,sx:{py:.5,justifyContent:"center",...m?{cursor:"pointer","&:hover":{bgcolor:x.table.cellHoverBg}}:{}},children:we(Ke,{option:Ft(M)})},S.id);case"priority":return we(bt,{className:"cell",sx:{justifyContent:"center"},children:we(po,{priority:M.priority,plain:!0})},S.id);case"start_date":return we(bt,{className:"cell",sx:{justifyContent:"center",whiteSpace:"nowrap",fontSize:14},children:hx(M.start_date)},S.id);case"due_date":return we(bt,{className:"cell",onClick:d?v=>B({anchorEl:v.currentTarget,taskSeq:Number(M.seq),date:String(M.due_date??"").slice(0,10),reminders:rn(M)}):void 0,sx:{justifyContent:"center",whiteSpace:"nowrap",fontSize:14,...d?{cursor:"pointer","&:hover":{bgcolor:x.table.cellHoverBg}}:{}},children:hx(M.due_date)},S.id);case"note":return we(bt,{className:"cell",sx:{justifyContent:q?"center":"flex-start",fontSize:14,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:M.note||""},S.id);default:return null}};return Tr(bt,{sx:{border:`1px solid ${x.table.borderColor}`,borderRadius:1,overflow:"hidden",bgcolor:x.table.bg,color:x.table.rowColor},children:[we(bt,{sx:{display:"grid",gridTemplateColumns:C,borderBottom:`1px solid ${x.table.borderColor}`,bgcolor:x.table.headerBg,"& > *":{display:"flex",alignItems:"center",gap:.5,px:1,py:1,minWidth:0,fontSize:x.table.headerFontSize,whiteSpace:"nowrap",userSelect:"none",borderRight:`1px solid ${x.table.rowBorderColor}`},"& > *:first-of-type":{px:.5},"& > *:last-child":{borderRight:"none",pr:2}},children:t.map(S=>{let M=md[S.id];return Tr(bt,{sx:{justifyContent:M.align==="center"?"center":"flex-start",color:EI.has(S.id)?x.table.headerActiveColor:x.table.headerColor},children:[M.icon,S.label??M.label]},S.id)})}),o?we(bt,{sx:{py:3,textAlign:"center",color:x.table.emptyColor,fontSize:14},children:n("common.loading")}):e.length===0?we(bt,{sx:{py:3,textAlign:"center",color:x.table.emptyColor,fontSize:14},children:a}):e.map((S,M)=>we(bt,{sx:{display:"grid",gridTemplateColumns:C,minHeight:44,fontSize:15,bgcolor:x.table.rowBg,borderTop:M===0?"none":`1px solid ${x.table.rowBorderColor}`,"&:hover":{bgcolor:x.table.rowHoverBg},"& > .cell":{px:1,minWidth:0,display:"flex",alignItems:"center",borderRight:`1px solid ${x.table.rowBorderColor}`},"& > .cell:first-of-type":{px:.5},"& > .cell:last-child":{borderRight:"none",pr:2}},children:t.map(w=>I(w,S))},S.seq)),we(Ga,{anchorEl:h?.anchorEl??null,value:String(h?.task.status??""),options:h?_s(h.task):void 0,onSelect:S=>{h&&m?.(Number(h.task.seq),S),E(null)},onComplete:u&&h&&!h.task.completed&&!h.task.is_notice&&!h.task.is_event&&!h.task.is_bug?()=>u(h.task,!0):void 0,onClose:()=>E(null)}),Tr(bI,{anchorEl:T?.anchorEl??null,open:!!T,onClose:()=>z(null),transitionDuration:0,children:[Tr(bx,{onClick:()=>{T&&f?.(Number(T.task.seq),"",0),z(null)},sx:{fontSize:14,minWidth:170,gap:1,color:x.table.headerColor},children:[we(bt,{sx:{width:24,flexShrink:0}}),n("table.notSpecified")]}),l.map(S=>Tr(bx,{selected:Number(T?.task.manager_account_seq??0)===Number(S.account_seq??0),onClick:()=>{T&&f?.(Number(T.task.seq),S.name,Number(S.account_seq??0)),z(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[y(S.name,24),S.name,S.role_name?we(bt,{component:"span",sx:{color:x.table.headerColor,fontSize:13},children:S.role_name}):null]},S.seq))]}),we(ln,{anchorEl:b?.anchorEl??null,open:!!b,date:b?.date??"",reminders:b?.reminders??[],hideReminder:!p,onClose:()=>B(null),onDateChange:S=>{b&&(d?.(b.taskSeq,S),B(M=>M?{...M,date:S}:null))},onReminderChange:S=>{b&&(p?.(b.taskSeq,S),B(M=>M?{...M,reminders:S}:null))}}),we(Lo,{open:!!k,anchorEl:k?.anchorEl??null,nextCompleted:!k?.task.completed,returnMode:!!D&&!!(k&&no(k.task,r)),onCancel:()=>_(null),onConfirm:S=>{k&&(S&&D?D(k.task,S):u?.(k.task,!k.task.completed)),_(null)}}),we(wI,{open:!!F,anchorEl:F?.anchorEl??null,title:n("table.claimShortConfirm"),confirmText:n("col.claim"),onCancel:()=>R(null),onConfirm:()=>{F&&g?.(F.taskSeq),R(null)}})]})}function PI(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)}function uc(e,t){let o=String(e??"").slice(0,10);if(!PI(o)||typeof t!="number"||!Number.isFinite(t))return"";let a=new Date(`${o}T12:00:00`);a.setDate(a.getDate()+Math.trunc(t));let r=a.getFullYear(),i=String(a.getMonth()+1).padStart(2,"0"),l=String(a.getDate()).padStart(2,"0");return`${r}-${i}-${l}`}function OI(e,t,o){return{title:String(e.title??"").trim(),content:String(e.content??""),start_date:uc(t,e.start_offset_days),due_date:uc(t,e.due_offset_days),priority:e.priority??"medium",label_keys:[...e.label_keys??[]],manager_account_seq:Number(e.manager_account_seq)||0,manager_name:String(e.manager_name??""),checklist:(e.checklist??[]).map(a=>String(a??"").trim()).filter(a=>a.length>0).map(a=>({label:a,checked:!1})),group_seq:o,note:String(e.note??""),...e.visibility?{visibility:e.visibility,visibility_group_seq:Number(e.visibility_group_seq)||0}:{}}}function dc(e,t){let o=Number(e.group_seq)||0;return(e.items??[]).map(a=>OI(a,t,o)).filter(a=>a.title.length>0)}function uV(e){return typeof e!="number"||!Number.isFinite(e)?"-":e===0?n("template.baseDate"):e>0?n("template.baseDatePlus",{value:Math.trunc(e)}):n("template.baseDateMinus",{value:Math.trunc(e)})}import{useEffect as LE,useRef as AE,useState as nb}from"react";import{Box as Br,Button as Ld,ButtonBase as qE,Divider as rb,Drawer as zE,IconButton as NE,Tooltip as FE}from"@mui/material";import HE from"@mui/icons-material/Close";import WE from"@ehfuse/overlay-scrollbar";import{FormDialog as $E}from"@ehfuse/mui-form-dialog";import{useState as fi}from"react";import CE from"@mui/icons-material/ExpandLess";import SE from"@mui/icons-material/ExpandMore";import{Box as vr,ButtonBase as Jx,Divider as Bl,Menu as Pd,MenuItem as Od,Tooltip as vE}from"@mui/material";import BE from"@mui/icons-material/SubjectOutlined";import _E from"@mui/icons-material/StickyNote2Outlined";import IE from"@mui/icons-material/LabelOutlined";import wE from"@mui/icons-material/DirectionsRunOutlined";import Zx from"@mui/icons-material/LockOutlined";import eb from"@mui/icons-material/PublicOutlined";import tb from"@mui/icons-material/Group";import DE from"@mui/icons-material/Repeat";import EE from"@mui/icons-material/EventOutlined";import RE from"@mui/icons-material/SpeedOutlined";import{TextField as PE}from"@ehfuse/mui-form-controls";import{PROPERTY_GRID_FOUR_CQ as QI,useTimePickerVariant as JI}from"@ehfuse/mui-form-controls";import{useState as Ia}from"react";import{Box as wa,Button as ZI,ButtonBase as ew,Divider as tw,ListItemIcon as ow,Menu as dd,MenuItem as hl}from"@mui/material";import nw from"@mui/icons-material/Add";import fc from"@mui/icons-material/Check";import rw from"@mui/icons-material/ViewKanbanOutlined";import aw from"@mui/icons-material/CalendarTodayOutlined";import iw from"@mui/icons-material/EventOutlined";import lw from"@mui/icons-material/PersonOutlineOutlined";import Sx from"@mui/icons-material/PeopleAltOutlined";import sw from"@mui/icons-material/FlagOutlined";import cw from"@mui/icons-material/TimerOutlined";import mw from"@mui/icons-material/NotificationsNoneOutlined";import uw from"@mui/icons-material/InboxOutlined";import dw from"@mui/icons-material/PlaceOutlined";import pw from"@mui/icons-material/MapOutlined";import{TimePicker as fw}from"@ehfuse/mui-datetime-picker";import{InfoAlert as vx}from"@ehfuse/alerts";var yr="@media (max-width: 719.95px)";function wn(e){return{[yr]:{order:e}}}import{PropertyInput as qI}from"@ehfuse/mui-form-controls";import{PropertyRow as MI}from"@ehfuse/mui-form-controls";import{jsx as AI}from"react/jsx-runtime";var _a={rowMinHeight:32,labelWidth:104,labelFontSize:14,labelColor:"#787774",labelIconSize:null,labelEllipsis:!1,valueFontSize:14,valueMinHeight:null,valuePaddingY:.25,hoverBg:"#f2f2f0",hoverOnlyClickable:!0,idleCursor:"default",placeholderColor:"#9a9a97",inputLineHeight:"inherit",menuFontSize:14},LI={minWidth:"auto"};function Te({icon:e,label:t,onClick:o,sx:a,children:r}){return AI(MI,{icon:e,label:t,onClick:o,appearance:_a,sx:[LI,...Array.isArray(a)?a:a?[a]:[]],children:r})}import{jsx as kx}from"react/jsx-runtime";function Cr({value:e,placeholder:t,readOnly:o,onCommit:a,form:r,name:i}){let l=be(),s=kx(qI,{...r&&i?{form:r,name:i}:{value:e??""},placeholder:t,readOnly:o,onCommit:c=>a(c),escapeReverts:!1,blurOnComposingEnter:!0,appearance:_a,sx:{color:l.colors.textPrimary,caretColor:l.colors.textPrimary}});return i?kx(mr,{name:i,children:s}):s}import gw from"@mui/icons-material/StorefrontOutlined";import xw from"@mui/icons-material/SupportAgentOutlined";import{Suspense as zI,lazy as NI,useEffect as FI,useState as Tx}from"react";import{Box as ud,Dialog as HI,DialogContent as WI,DialogTitle as $I,IconButton as yx,Tooltip as VI}from"@mui/material";import KI from"@mui/icons-material/Close";import UI from"@mui/icons-material/Search";import{Fragment as XI,jsx as Dn,jsxs as pc}from"react/jsx-runtime";function GI(e){return L(),Dn(ud,{sx:{p:3,fontSize:14,color:"#9a9a97"},children:n("props.addressModuleMissing")})}var jI=NI(()=>import("react-daum-postcode").then(e=>({default:e.default})).catch(()=>({default:GI})));function YI(e){if(e.addressType!=="R")return e.address;let t="";return e.bname!==""&&/[동|로|가]$/g.test(e.bname)&&(t+=e.bname),e.buildingName!==""&&e.apartment==="Y"&&(t+=t!==""?`, ${e.buildingName}`:e.buildingName),t!==""?`${e.address} (${t})`:e.address}function Cx({value:e,placeholder:t=n("props.addressPlaceholder"),readOnly:o,onCommit:a}){L();let[r,i]=Tx(e),[l,s]=Tx(!1),c=se().slots?.addressSearch;FI(()=>i(e),[e]);let u=d=>{i(d),s(!1),d!==e&&a(d)},m=d=>{u(YI(d))};return pc(XI,{children:[pc(ud,{sx:{display:"flex",alignItems:"center",gap:.5,flex:1,minWidth:0},children:[Dn(ud,{component:"input",spellCheck:!1,value:r,readOnly:o,placeholder:t,onChange:d=>i(d.target.value),onBlur:()=>{l||r.trim()!==e&&a(r.trim())},onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),!o&&s(!0))},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",p:0,"&::placeholder":{color:"#9a9a97"}}}),o?null:Dn(VI,{title:n("props.addressSearch"),arrow:!0,children:Dn(yx,{tabIndex:-1,size:"small","aria-label":n("props.addressSearch"),onClick:()=>s(!0),sx:{color:"#9a9a97",p:.25,flexShrink:0},children:Dn(UI,{sx:{fontSize:17}})})})]}),c?Dn(c,{open:l,onComplete:u,onClose:()=>s(!1)}):pc(HI,{open:l,onClose:()=>s(!1),maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:{height:550}}},children:[pc($I,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",pr:2},children:[n("props.addressSearch"),Dn(yx,{"aria-label":n("props.addressSearchClose"),onClick:()=>s(!1),size:"small",children:Dn(KI,{})})]}),Dn(WI,{style:{padding:0},dividers:!0,children:l?Dn(zI,{fallback:null,children:Dn(jI,{onComplete:m,onClose:()=>s(!1),defaultQuery:r,style:{width:"100%",height:"100%"}})}):null})]})]})}import{Fragment as Da,jsx as re,jsxs as _o}from"react/jsx-runtime";function Bx(e){return String(e??"").includes(" ")?Ko(e):Vo(e)}function bw(e){let[t="00",o="00"]=String(e??"").split(":");return{hour:/^\d{2}$/.test(t)?t:"00",minute:/^\d{2}$/.test(o)?o:"00"}}function ea({label:e=n("menu.empty")}){return L(),re(wa,{component:"span",sx:{color:"#9a9a97"},children:e})}var gc={tabKey:"tab_key",startDate:"start_date",dueDate:"due_date",reminders:"reminders",priority:"priority",eventTime:"event_time",eventPlace:"event_place",eventAddress:"event_address"};function Sr({form:e,field:t,fallback:o,children:a}){return e?re($o,{form:e,name:gc[t],children:r=>a(r)}):re(Da,{children:a(o)})}var pd=QI,st=e=>({gridColumn:`${e}`,[yr]:{gridColumn:"auto"},[pd]:{gridColumn:"auto"}});function xc({values:e,form:t,customTabs:o,avatarSrcByName:a,managerLocked:r=!1,notice:i=!1,event:l=!1,hideDueDate:s=!1,hideReminder:c=!1,beforeStart:u,pinColumns:m=!1,projectColumn:d=1,afterProject:p,readOnly:f=!1,coreLocked:g,targetSummary:x="",narrowCollapsedSx:h,reminderLocked:E=!1,managerAction:b,hideProject:B=!1,hideManager:T=!1,hideReceivers:z=!1,hideStartDate:k=!1,hidePriority:_=!1,leading:D,supportOrigin:F,trailing:R,onChangeProject:C,onChangeStartDate:y,onClearStartDate:I,onChangeDueDate:S,onChangeReminder:M,onChangePriority:w,onChangeEventTime:q,onChangeEventPlace:v,onChangeEventAddress:O,onMemberEdit:j,onAddProject:V}){L();let[Z,ie]=Ia(null),ue=JI(void 0),[K,te]=Ia(!1),$=g??f,[G,ae]=Ia(null),[Re,mt]=Ia(null),[ce,Q]=Ia(null),[W,X]=Ia(null),[le,pe]=Ia(null),De=$e(),ve=Fn(),It=m&&!l,We=(oe,_e,Ze=!1)=>[wn(oe),{[pd]:{order:oe}},...Ze&&h?Array.isArray(h)?h:[h]:[],...It&&_e?[st(_e)]:[]],Ee=oe=>t?t.getFormValue(gc[oe]):e[oe],ut=o.filter(oe=>!oe.archived),je=!!I&&!i&&!$,co=oe=>{let _e=String(Ee("startDate")??"").trim(),Ze=I?!!_e&&Ds(_e).getTime()>Date.now():!!_e;if(y(oe),Ze||l)return;let ze=Ds(oe);if(!Number.isNaN(ze.getTime())){if(i){if(ze.getTime()<=Date.now())return;vx(n("props.noticeStartInfo"));return}ze.getTime()<=Date.now()||vx(n("props.startInfo"))}},kt=re(Te,{icon:re(mw,{sx:{fontSize:17}}),label:n("reminder.title"),onClick:$||E?void 0:oe=>mt(oe),sx:We(l?8:5,2,!0),children:re(Sr,{form:t,field:"reminders",fallback:e.reminders,children:oe=>oe.length===0?re(ea,{label:n("common.none")}):Tu(oe)})});return _o(Da,{children:[re(wa,{sx:{containerType:"inline-size"},children:_o(wa,{sx:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",[pd]:{gridTemplateColumns:"repeat(4, minmax(0, 1fr))"},gridAutoFlow:"row dense",columnGap:3,rowGap:0,px:2,[yr]:{gridTemplateColumns:"minmax(0, 1fr)"}},children:[D,F?_o(Da,{children:[_o(Te,{icon:re(gw,{sx:{fontSize:17}}),label:n("section.merchant"),sx:We(0,1),children:[F.licenseName||re(ea,{}),F.contactPhone?re(wa,{component:"span",sx:{ml:1,color:"#6f6f6c",fontSize:"0.92em"},children:F.contactPhone}):null,F.contactEmail?re(wa,{component:"span",sx:{ml:1,color:"#6f6f6c",fontSize:"0.92em"},children:F.contactEmail}):null]}),re(Te,{icon:re(xw,{sx:{fontSize:17}}),label:n("props.supportType"),sx:We(0,2),children:F.supportType||re(ea,{})})]}):null,B?null:re(Te,{icon:re(rw,{sx:{fontSize:17}}),label:n("col.project"),onClick:$?void 0:oe=>ie(oe),sx:It&&d==="full"?[We(1,void 0,!0),{gridColumn:"1 / -1"}]:We(1,d==="full"?1:d,!0),children:re(Sr,{form:t,field:"tabKey",fallback:e.tabKey,children:oe=>{let _e=o.find(ze=>ze.key===oe);if(!_e)return n("props.defaultProject");let Ze=Le(_e.icon);return _o(Da,{children:[Ze?re(Ze,{sx:{fontSize:16,color:"#1e3a8a"}}):null,_e.label]})}})}),p,i?re(Te,{icon:re(Sx,{sx:{fontSize:17}}),label:n("col.targets"),onClick:$?void 0:()=>j("targets"),sx:We(7,1),children:x||n("col.allEmployees")}):null,!i&&!l&&!T?re(Te,{icon:re(lw,{sx:{fontSize:17}}),label:n("col.owner"),onClick:r||$||!e.managerName&&b?void 0:()=>j("manager"),sx:We(7,1),children:e.managerName?_o(Da,{children:[re(vo,{names:[e.managerName],size:20,avatarSrcByName:a}),e.managerName]}):b?_o(wa,{sx:{display:"inline-flex",alignItems:"center",gap:1},children:[b,!r&&!$?re(ZI,{size:"small",variant:"outlined",color:"inherit",onClick:oe=>{oe.stopPropagation(),j("manager")},sx:{minWidth:0,px:1.25,py:.25,fontSize:13,whiteSpace:"nowrap",borderColor:"divider",color:"text.primary"},children:n("common.select")}):null]}):re(ea,{})}):null,u,!l&&!k?re(Te,{icon:re(aw,{sx:{fontSize:17}}),label:i?n("props.postTime"):n("col.startTime"),onClick:$?void 0:oe=>Q(oe),sx:We(2,2),children:re(Sr,{form:t,field:"startDate",fallback:e.startDate,children:oe=>_o(Da,{children:[oe?Bx(oe):i?re(wa,{component:"span",sx:{fontSize:13.5,color:"text.secondary"},children:n("props.draftNotPosted")}):re(ea,{label:je?n("props.undecided"):void 0}),je&&oe?re(ew,{onClick:_e=>{_e.stopPropagation(),I?.()},sx:{ml:"auto",flexShrink:0,px:1,py:.25,borderRadius:1,border:`1px solid ${ee}`,fontSize:14,color:"#787774","&:hover":{bgcolor:"#ebebe9"}},children:n("props.undecided")}):null]})})}):null,!i&&!z?re(Te,{icon:re(Sx,{sx:{fontSize:17}}),label:l?n("props.attendees"):n("col.cc"),onClick:$?void 0:()=>j("receivers"),sx:We(l?7:8,1),children:e.receiverNames.length>0?_o(Da,{children:[re(vo,{names:e.receiverNames,size:20,avatarSrcByName:a}),e.receiverNames.length===1?e.receiverNames[0]:null]}):re(ea,{})}):null,s?null:re(Te,{icon:re(iw,{sx:{fontSize:17}}),label:l?n("props.date"):n("col.due"),onClick:$?void 0:oe=>X(oe),sx:We(3,2),children:re(Sr,{form:t,field:"dueDate",fallback:e.dueDate,children:oe=>oe?l?Vo(oe):Bx(oe):re(ea,{label:i?n("props.noExpiry"):void 0})})}),l?re(Te,{icon:re(cw,{sx:{fontSize:17}}),label:n("calendar.time"),onClick:$?void 0:oe=>pe(oe),sx:wn(4),children:re(Sr,{form:t,field:"eventTime",fallback:e.eventTime,children:oe=>oe||re(ea,{label:n("googleEvent.allDay")})})}):null,l?re(Te,{icon:re(dw,{sx:{fontSize:17}}),label:"\uC7A5\uC18C",sx:wn(5),children:re(Cr,{...t?{form:t,name:gc.eventPlace}:{value:e.eventPlace??""},placeholder:n("props.locationPlaceholder"),readOnly:$,onCommit:oe=>v?.(oe)})}):null,!c&&l?kt:null,l?re(Te,{icon:re(pw,{sx:{fontSize:17}}),label:n("props.address"),sx:[{gridColumn:"1 / -1"},wn(6)],children:re(mr,{name:gc.eventAddress,children:re(Sr,{form:t,field:"eventAddress",fallback:e.eventAddress,children:oe=>re(Cx,{value:oe??"",placeholder:n("props.addressPlaceholder"),readOnly:$,onCommit:_e=>O?.(_e)})})})}):null,!l&&!_?re(Te,{icon:re(sw,{sx:{fontSize:17}}),label:n("col.priority"),onClick:f?void 0:oe=>ae(oe),sx:We(6,1,!0),children:re(Sr,{form:t,field:"priority",fallback:e.priority,children:oe=>re(po,{priority:oe,small:!0})})}):null,!c&&!l?kt:null,R]})}),_o(dd,{transitionDuration:0,anchorEl:Z,open:!!Z,onClose:()=>ie(null),...ve,children:[_o(hl,{selected:!Ee("tabKey"),onClick:()=>{C(""),ie(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[re(uw,{sx:{fontSize:17,color:"#9a9a97"}}),n("common.none"),Ee("tabKey")?null:re(fc,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}})]}),ut.map(oe=>{let _e=Le(oe.icon),Ze=Ee("tabKey")===oe.key;return _o(hl,{selected:Ze,onClick:()=>{C(oe.key),ie(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[_e?re(_e,{sx:{fontSize:17,color:"#1e3a8a"}}):null,oe.label,Ze?re(fc,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},oe.key)}),V?[re(tw,{},"add-project-divider"),_o(hl,{onClick:()=>te(!0),sx:{fontSize:14,color:"#787774"},children:[re(ow,{children:re(nw,{sx:{fontSize:18,color:"#787774"}})}),n("table.addProject")]},"add-project")]:null]}),V?re(Ms,{open:K,onClose:()=>te(!1),onSubmit:(oe,_e,Ze)=>{(async()=>{let ze=await V(oe,_e,Ze);ze&&C(ze)})(),ie(null)}}):null,re(dd,{transitionDuration:0,anchorEl:G,open:!!G,onClose:()=>ae(null),...ve,children:["high","medium","low"].map(oe=>_o(hl,{selected:Ee("priority")===oe,onClick:()=>{w(oe),ae(null)},sx:{fontSize:14,minWidth:130,gap:1},children:[re(po,{priority:oe,small:!0}),Ee("priority")===oe?re(fc,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},oe))}),re(Sr,{form:t,field:"reminders",fallback:e.reminders,children:oe=>re(dd,{transitionDuration:0,anchorEl:Re,open:!!Re,onClose:()=>mt(null),...ve,children:ku(l?!!Ee("eventTime"):String(Ee("dueDate")??"").includes(" ")).map(_e=>{let Ze=_e.value==="none"?oe.length===0:oe.includes(_e.value);return _o(hl,{selected:Ze,onClick:()=>{M(gs(oe,_e.value)),_e.value==="none"&&mt(null)},sx:{fontSize:14,minWidth:150,gap:1},children:[_e.label,Ze?re(fc,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},_e.value)})})}),l?re(fw,{timeVariant:ue,anchorEl:le,open:!!le,onClose:()=>pe(null),value:bw(Ee("eventTime")),format:"HH:mm",minuteStep:10,autoApply:!0,centered:De,locale:Nn(),onChange:(oe,_e)=>{q?.(`${oe}:${_e}`),pe(null)}}):null,re(ln,{anchorEl:ce,open:!!ce,date:Ee("startDate"),reminders:[],hideReminder:!0,showTime:!0,centered:De,onClose:()=>Q(null),onDateChange:co,onReminderChange:()=>{}}),re(Sr,{form:t,field:"reminders",fallback:e.reminders,children:oe=>re(ln,{anchorEl:W,open:!!W,date:Ee("dueDate"),reminders:oe,hideReminder:E||c,showTime:!l,centered:De,onClose:()=>X(null),onDateChange:S,onReminderChange:M})})]})}import{useState as hw}from"react";import{Box as kw,Menu as Tw,MenuItem as yw}from"@mui/material";import Cw from"@mui/icons-material/RepeatOutlined";import Sw from"@mui/icons-material/DevicesOutlined";import vw from"@mui/icons-material/ScreenSearchDesktopOutlined";import Bw from"@mui/icons-material/SellOutlined";import _w from"@mui/icons-material/TaskAltOutlined";import{Fragment as bd,jsx as yt,jsxs as _x}from"react/jsx-runtime";function fd({label:e=n("menu.empty")}){return L(),yt(kw,{component:"span",sx:{color:"#9a9a97"},children:e})}var xd={repro:"bug_repro",device:"bug_device",where:"bug_where",version:"bug_version",resolution:"resolution"};function gd({form:e,field:t,fallback:o,children:a}){return e?yt($o,{form:e,name:xd[t],children:r=>a(String(r??""))}):yt(bd,{children:a(o)})}function bc({values:e,form:t,readOnly:o=!1,showResolution:a=!1,onChangeRepro:r,onChangeDevice:i,onChangeWhere:l,onChangeVersion:s,onChangeResolution:c}){L();let[u,m]=hw(null),d=u?.field==="repro"?mu:u?.field==="device"?uu:du,p=f=>{u?.field==="repro"?r(f):u?.field==="device"?i(f):u?.field==="resolution"&&c?.(f),m(null)};return _x(bd,{children:[_x(bd,{children:[yt(Te,{icon:yt(Cw,{sx:{fontSize:17}}),label:n("bug.repro"),onClick:o?void 0:f=>m({field:"repro",el:f}),children:yt(gd,{form:t,field:"repro",fallback:e.repro,children:f=>vf(f)||yt(fd,{label:n("common.select")})})}),yt(Te,{icon:yt(Sw,{sx:{fontSize:17}}),label:n("bug.device"),onClick:o?void 0:f=>m({field:"device",el:f}),children:yt(gd,{form:t,field:"device",fallback:e.device,children:f=>Bf(f)||yt(fd,{label:n("common.select")})})}),yt(Te,{icon:yt(vw,{sx:{fontSize:17}}),label:"\uBC1C\uC0DD\uD654\uBA74",children:yt(Cr,{...t?{form:t,name:xd.where}:{value:e.where},placeholder:n("bug.screenPlaceholder"),readOnly:o,onCommit:l})}),yt(Te,{icon:yt(Bw,{sx:{fontSize:17}}),label:"\uBC1C\uC0DD\uBC84\uC804",children:yt(Cr,{...t?{form:t,name:xd.version}:{value:e.version},placeholder:n("bug.versionPlaceholder"),readOnly:o,onCommit:s})}),a?yt(Te,{icon:yt(_w,{sx:{fontSize:17}}),label:n("bug.resolution"),onClick:o?void 0:f=>m({field:"resolution",el:f}),children:yt(gd,{form:t,field:"resolution",fallback:e.resolution??"",children:f=>Ss(f)||yt(fd,{label:n("common.select")})})}):null]}),yt(Tw,{open:!!u,anchorEl:u?.el??null,onClose:()=>m(null),transitionDuration:0,children:d.map(f=>yt(yw,{onClick:()=>p(f.key),sx:{fontSize:14},children:f.name},f.key))})]})}import{Box as Ix}from"@mui/material";import{jsxs as wx}from"react/jsx-runtime";var hd=16;function kd(){let e=se().sectionTitle;return{showIcon:e?.showIcon??!0,color:e?.color??"#37352f",fontWeight:e?.fontWeight??500}}function qo({icon:e,title:t,titleExtra:o,children:a}){let r=kd();return wx(Ix,{sx:{px:2,display:"flex",flexDirection:"column",gap:.25},children:[wx(Ix,{sx:{display:"flex",alignItems:"center",gap:1,fontSize:hd,fontWeight:r.fontWeight,color:r.color},children:[r.showIcon?e:null,t,o]}),a]})}import{useState as Bd}from"react";import{Box as _d,Button as Lw,Divider as Mx,IconButton as Lx,Menu as Aw,MenuItem as Tc,Tooltip as qw}from"@mui/material";import zw from"@mui/icons-material/MoreVert";import{ConfirmDialog as Nw,ErrorAlert as Fw,SuccessAlert as Hw}from"@ehfuse/alerts";import{FormDialog as Ww}from"@ehfuse/mui-form-dialog";import{ClearTextField as $w}from"@ehfuse/mui-form-controls";import{useEffect as Dx,useLayoutEffect as Iw,useRef as Ea,useState as Ex}from"react";import{Box as kl,Button as yd,IconButton as Cd,Tooltip as Sd,useMediaQuery as ww,useTheme as Dw}from"@mui/material";import Rx from"@mui/icons-material/EditOutlined";import Ew from"@mui/icons-material/DoneOutlined";import Px from"@mui/icons-material/Translate";import Rw from"@mui/icons-material/ContentCopyOutlined";import{EhfuseEditor as Pw,ImageResizePlugin as Ow,minimalToolbarOptions as Ox}from"@ehfuse/editor";var Td={"& 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}};import{jsx as lo,jsxs as hc}from"react/jsx-runtime";function vd(e){let t=e.trim();return t?t.startsWith("<")?e:`<p>${t}</p>`:"<p></p>"}function Ra(e){let t=e.replace(/<br\s*\/?>/gi,`
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={...Px,left:(Px.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 hc({syncKey:e,value:t,onChange:o,readOnly:a=!1,viewFirst:r=!1,onTranslate:i,minHeight:l=180,editing:s,onEditingChange:c}){L();let{uploadContentImage:u,openExternalUrl:m,openContentImage:d}=le(),p=v=>{m?m(v):window.open(v,"_blank","noopener,noreferrer")},[f,g]=Dx(()=>!r||!Ea(t).trim()),x=s!==void 0,h=x?s:f,E=Da(c);E.current=c;let b=v=>{x||g(v),E.current?.(v)};wx(()=>{r&&b(!Ea(t).trim())},[e,r]);let B=Da(null),T=Da(new Pw),z=Da(null),k=Da(Date.now()+800),_=We(),D=ww(),F=Iw(D.breakpoints.down("sm")),[R,C]=Dx(!1),y=()=>{let v=Ea(t);v&&navigator.clipboard.writeText(v).then(()=>{C(!0),window.setTimeout(()=>C(!1),1500)})},I=(v,M=!1)=>v instanceof Element?v.closest(M?".taskbox-content-readview a[href]":".ehfuse-editor-content a[href]"):null,S=v=>_||v.ctrlKey||v.metaKey;wx(()=>{if(a)return;let v=Sd(t);z.current===v||z.current===t||(z.current=v,k.current=Date.now()+800,B.current?.setHtml(v))},[e,t,a]);let O=Sd(t),w=Da(null),q=Da({el:null,html:""});return _w(()=>{let v=w.current;v&&(q.current.el===v&&q.current.html===O||(v.innerHTML=O,q.current={el:v,html:O}))}),a||!h?bc(hl,{sx:{position:"relative",mt:1},children:[io(hl,{onClickCapture:v=>{let M=v.target;if(M?.tagName==="IMG"&&M.src){v.preventDefault(),v.stopPropagation();let V=Array.from(v.currentTarget.querySelectorAll("img")).filter(me=>me.src),Z=V.map((me,U)=>({src:me.src,name:me.alt||decodeURIComponent(me.src.split("/").pop()||"")||`image-${U+1}`})),ae=Math.max(0,V.indexOf(M));d?d(Z,ae):p(Z[ae].src);return}let j=I(v.target,!0);j&&(v.preventDefault(),v.stopPropagation(),p(j.href))},ref:w,className:"taskbox-content-readview","data-drag-scroll":"off",sx:{border:"1px solid #e0e0e0",borderRadius:1,p:"12px",pr:F?"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},...kd}}),F?bc(hl,{sx:{display:"flex",gap:1,mt:1},children:[io(Td,{variant:"outlined",color:"inherit",startIcon:io(Ew,{sx:{fontSize:18}}),onClick:y,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:R?n("section.copied"):n("common.copy")}),a?null:io(Td,{variant:"outlined",color:"inherit",startIcon:io(Ex,{sx:{fontSize:18}}),onClick:()=>b(!0),sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:n("common.edit")}),i?io(Td,{variant:"outlined",color:"inherit",startIcon:io(Rx,{sx:{fontSize:18}}),onClick:i,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:n("section.translate")}):null]}):bc(hl,{sx:{position:"absolute",top:6,right:6,display:"flex",flexDirection:"column",gap:.25},children:[a?null:io(Cd,{title:n("section.editContent"),arrow:!0,placement:"left",children:io(yd,{size:"small","aria-label":n("section.editContent"),onClick:()=>b(!0),sx:{color:"#9a9a97"},children:io(Ex,{sx:{fontSize:17}})})}),i?io(Cd,{title:n("section.translate"),arrow:!0,placement:"left",children:io(yd,{size:"small","aria-label":n("section.translate"),onClick:i,sx:{color:"#9a9a97"},children:io(Rx,{sx:{fontSize:17}})})}):null]})]}):bc(hl,{onDragOver:v=>v.stopPropagation(),onDrop:v=>v.stopPropagation(),onMouseDownCapture:v=>{S(v)&&I(v.target)&&v.preventDefault()},onClickCapture:v=>{let M=S(v)?I(v.target):null;M&&(v.preventDefault(),v.stopPropagation(),p(M.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?io(Cd,{title:n("section.finishEditingTooltip"),arrow:!0,children:io(yd,{size:"small","aria-label":n("section.finishEditing"),onMouseDown:v=>v.preventDefault(),onClick:()=>b(!1),sx:{position:"absolute",top:4,right:6,zIndex:2,color:"#2f9e5b"},children:io(Dw,{sx:{fontSize:19}})})}):null,io(Rw,{ref:B,defaultValue:Sd(t),autoHeight:!0,showToolbar:!_,focusBorder:!0,styles:{focusBorderColor:"var(--primary)"},toolbarOptions:Mw,plugins:[T.current],locale:fa(),minHeight:l,placeholder:n("section.contentPlaceholder"),onImageUpload:u,contentStyle:{padding:"12px"},onChange:v=>{let M=Date.now()<k.current,j=v===z.current;z.current=v,!(M||j)&&o(v)}})]})}import{Fragment as $w,jsx as _o,jsxs as Tc}from"react/jsx-runtime";function _d(e){return String(e??"").replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").trim().length>0}function yc({content:e,templates:t,onApply:o,onSave:a,onRemove:r,readOnly:i=!1}){L();let[l,s]=vd(null),[c,u]=vd(!1),[m,d]=vd(""),p=async g=>{s(null),!(_d(e)&&!await zw({title:n("section.loadTemplate"),message:n("section.loadTemplateConfirm",{name:g.name})}))&&o(g.content)},f=()=>{s(null);let g=Ea(e);g&&navigator.clipboard.writeText(g).then(()=>Fw(n("section.contentCopied"))).catch(()=>Nw(n("section.contentCopyFailed")))};return Tc($w,{children:[_o(Aw,{title:n("section.contentMenu"),arrow:!0,disableInteractive:!0,children:_o(Ox,{size:"small","aria-label":n("section.contentMenu"),onClick:g=>s(g.currentTarget),sx:{ml:"auto",color:"#9a9a97"},children:_o(qw,{sx:{fontSize:18}})})}),Tc(Lw,{anchorEl:l,open:!!l,onClose:()=>s(null),transitionDuration:0,children:[_o(kc,{disabled:!_d(e),onClick:f,sx:{fontSize:14,minWidth:220},children:n("menu.copyContent")}),i?null:_o(Mx,{sx:{my:.5}}),!i&&a?_o(kc,{disabled:!_d(e),onClick:()=>{s(null),d(""),u(!0)},sx:{fontSize:14,minWidth:220},children:n("section.saveAsTemplate")}):null,!i&&a?_o(Mx,{sx:{my:.5}}):null,i?null:t.length===0?_o(kc,{disabled:!0,sx:{fontSize:14,minWidth:220},children:n("section.noSavedTemplates")}):t.map(g=>Tc(kc,{onClick:()=>{p(g)},sx:{fontSize:14,minWidth:220,gap:1},children:[_o(Bd,{sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.name}),r?_o(Ox,{size:"small","aria-label":n("section.deleteTemplateAria",{name:g.name}),onClick:x=>{x.stopPropagation(),r(g.seq)},sx:{color:"#9a9a97"},children:_o(Xt,{sx:{fontSize:16}})}):null]},g.seq))]}),_o(Hw,{open:c,onClose:()=>u(!1),maxWidth:"xs",title:n("section.saveTemplateTitle"),locale:Ce(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},tabs:{visible:!1},actions:{showCancelButton:!0,right:_o(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:Tc(Bd,{sx:{display:"flex",flexDirection:"column",gap:1},children:[_o(Bd,{sx:{fontSize:15,color:"#37352f"},children:n("section.saveTemplateHint")}),_o(Ww,{size:"medium",fullWidth:!0,autoFocus:!0,placeholder:n("section.templateNamePlaceholder"),value:m,onChange:g=>d(g.target.value)})]})}]})]})}import{useState as Tl}from"react";import{Box as Ht,Button as qx,Dialog as nD,IconButton as ui,Switch as rD,TextField as aD,Tooltip as Id}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 zx from"@mui/icons-material/Close";import hD from"@mui/icons-material/AddCircle";import Nx 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 Yn,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 Lx={type:"related",search:"",selectedSeqs:[]};function kl(e){L();let t=Vw(e);t.current=e;let o={link:Kw({modalId:_e("taskbox-task-link")})},a=Uw({formId:_e("taskbox-task-link-form"),initialValues:Lx,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({...Lx,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 go,jsxs as Cc}from"react/jsx-runtime";var Ax=[{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 Sc({controller:e,task:t,tasks:o,excludeSeqs:a=[],hideRelationType:r=!1,title:i=n("link.title"),confirmLabel:l=n("link.confirm")}){L();let s=We(),{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]),E=d.trim().toLowerCase();return o.filter(b=>h.has(b.seq)||b.is_event||b.is_notice||b.linked_only?!1:E?b.title.toLowerCase().includes(E)||(b.ticket_no??"").toLowerCase().includes(E):!0).sort((b,B)=>!!b.completed!=!!B.completed?b.completed?1:-1:B.seq-b.seq)},[o,t.seq,a,d]),g=Ax.find(h=>h.type===m)?.hint??"",x=Cc(Yn,{sx:{display:"flex",flexDirection:"column",minHeight:0,height:s?"100%":"auto"},children:[r?null:go(Qw,{value:m,onChange:(h,E)=>c.setFormValue("type",E),sx:{minHeight:38,flexShrink:0,borderBottom:"1px solid #ededeb","& .MuiTab-root":{minHeight:38,py:.5,fontSize:16,color:"#333333"}},children:Ax.map(h=>go(Xw,{value:h.type,label:h.label},h.type))}),r?null:go(Yn,{sx:{mt:1,mb:1.5,fontSize:14,flexShrink:0},children:g}),Cc(Yn,{sx:{...s?{height:"100%",minHeight:0}:{height:560},display:"flex",flexDirection:"column",...s?{}:{border:"1px solid #cccccc",borderRadius:1},overflow:"hidden",userSelect:"none"},children:[go(Yn,{sx:{px:1.5,py:1,borderBottom:"1px solid #cccccc",flexShrink:0},children:go(Zw,{placeholder:n("link.searchPlaceholder"),name:"search",form:c,fullWidth:!0,autoFocus:!0,size:"small",sx:{"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiInputBase-root":{px:0}}})}),go(Yn,{sx:{flex:1,minHeight:0},children:go(oD,{style:{height:"100%"},contentStyle:{paddingTop:0},children:go(Yn,{sx:{display:"flex",flexDirection:"column"},children:f.length===0?go(Yn,{sx:{py:4,textAlign:"center",fontSize:13.5,color:"#9a9a97"},children:n("link.empty")}):f.map(h=>{let E=h.is_notice||h.is_event?Oe(h.icon||(h.is_notice?wt:zt)):null,b=p.includes(h.seq);return Cc(Yn,{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?go(eD,{sx:{fontSize:20,flexShrink:0,color:"#2f6fd0"}}):go(tD,{sx:{fontSize:20,flexShrink:0,color:"#c9c8c5"}}),E?go(E,{sx:{fontSize:17,flexShrink:0,color:h.icon_color||"#1e3a8a"}}):null,Cc(Yn,{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]}),go(Yn,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:go(Ve,{option:Nt(h)})})]},h.seq)})})})})]})]});return go(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:Ce(),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:go(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 ve,jsxs as Xn}from"react/jsx-runtime";var Fx="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 ve(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=ve(Ht,{sx:{display:"flex",flexDirection:"column",mt:.5,pl:r?0:3.25},children:i});return e?ve(iD,{sensors:t,collisionDetection:sD,modifiers:[dD,uD],onDragEnd:a,children:ve(pD,{items:o,strategy:xD,children:l})}):l}function vc({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}){L();let[h,E]=Tl(""),b=kl({multiSelect:!0,onSubmit:U=>{if(!f)return;let ee=d?.find($=>$.seq===U);f(e,U,String(ee?.title??"").trim())}}),[B,T]=Tl(null),z=We(),[k,_]=Tl(null),[D,F]=Tl(null),R=U=>{let ee=U.task_seq?g?.(U.task_seq):void 0;return ee?ee.completed:U.checked},C=U=>{if(!U.task_seq||x<=0)return!1;let ee=g?.(U.task_seq);return ee?!Gf(ee,x):!1},y=U=>!!U.task_seq&&!!g&&!g?.(U.task_seq),I=t.filter(U=>!y(U)),S=I.filter(R).length,[O,w]=Tl(()=>{try{return localStorage.getItem(Fx)==="1"}catch{return!1}}),q=U=>{w(U);try{localStorage.setItem(Fx,U?"1":"0")}catch{}},v=!!s&&!z&&!c,M=mD(cD(lD,{activationConstraint:{distance:5}})),j=(U,ee)=>U.task_seq?`linked-${U.task_seq}`:`row-${ee}`,V=t.map(j),Z=V.filter((U,ee)=>{let $=t[ee];return y($)?!1:!(O&&R($))}),ae=U=>{let{active:ee,over:$}=U;if(!$||ee.id===$.id)return;let G=V.indexOf(String(ee.id)),re=V.indexOf(String($.id));G<0||re<0||s?.(e,fD(t,G,re))},me=()=>{h.trim()&&(o(e,h),E(""))};return Xn(Ao,{icon:ve(kD,{sx:{fontSize:19,display:"block"}}),title:Xn(wD,{children:[n("section.todo"),t.length>0?Xn(Ht,{component:"span",sx:{fontSize:12.5,color:"#9a9a97"},children:[S," / ",t.length]}):null]}),titleExtra:I.length>0?Xn(Ht,{sx:{flex:1,minWidth:0,ml:1,display:"flex",alignItems:"center",gap:1},children:[ve(Ht,{sx:{flex:1,minWidth:0,height:6,borderRadius:3,bgcolor:"#ececea"},children:ve(Ht,{sx:{height:"100%",borderRadius:3,width:`${Math.round(S/I.length*100)}%`,bgcolor:"#2f80ed",transition:"width 0.2s"}})}),S>0?Xn(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:[ve(rD,{size:"small",checked:O,onChange:(U,ee)=>q(ee)}),n("section.hideDone")]}):null]}):null,children:[ve(ID,{sortable:v,sensors:M,rowIds:Z,onDragEnd:ae,compact:z,children:t.map((U,ee)=>{let $=U.task_seq?g?.(U.task_seq):void 0,G=R(U);if(O&&G||y(U))return null;let re=!!U.task_seq,Ee=C(U),ct=se=>Xn(Ht,{sx:{display:"flex",alignItems:z?"flex-start":"center",gap:1,px:1.25,...v?{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?ve(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:ve(yD,{sx:{fontSize:16}})}):null,ve(Id,{title:Ee?n("section.toggleLocked"):"",arrow:!0,disableInteractive:!0,children:ve(Ht,{component:"span",onClick:Ee?void 0:Q=>r?F({anchorEl:Q.currentTarget,index:ee,checked:!G}):a(e,ee,!G),sx:{display:"inline-flex",flexShrink:0,cursor:Ee?"default":"pointer",...z?{mt:"1px"}:{}},children:G?ve(TD,{sx:{fontSize:18,color:Ee?"#a9c6ec":"#2f80ed"}}):ve(vD,{sx:{fontSize:18,color:Ee?"#d6d5d1":"#9a9a97"}})})}),B?.index===ee?ve(Ht,{component:"input",autoFocus:!0,spellCheck:!1,value:B.label,enterKeyHint:"done",onChange:Q=>T({index:ee,label:Q.target.value}),onBlur:()=>{B.label.trim()&&B.label.trim()!==U.label&&l?.(e,ee,B.label),T(null)},onKeyDown:Q=>{Q.key==="Enter"&&Q.target.blur(),Q.key==="Escape"&&T(null)},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",p:0}}):ve(Ht,{component:"span",onClick:re?U.task_seq&&m?()=>m(U.task_seq):void 0:c||!l?void 0:z?()=>_({index:ee,label:U.label}):()=>T({index:ee,label:U.label}),sx:{flex:1,minWidth:0,fontSize:14.5,color:"#37352f",textDecoration:G?"line-through":"none",overflow:"hidden",textOverflow:"ellipsis",...z?{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,lineHeight:1.4,wordBreak:"break-word"}:{whiteSpace:"nowrap"},...re?m?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}:c||!l?{}:{cursor:"text"}},children:U.label}),re?Xn(Ht,{component:"span",onClick:U.task_seq&&m?()=>m(U.task_seq):void 0,sx:{display:"inline-flex",alignItems:"center",gap:.4,flexShrink:0,...z?{mt:"1px"}:{},px:.75,py:.2,borderRadius:1,fontSize:12,fontWeight:500,color:"#1d4f91",bgcolor:"#e3eefb",whiteSpace:"nowrap",...m?{cursor:"pointer"}:{}},children:[ve(CD,{sx:{fontSize:12}}),$?.manager_name?.trim()||n("template.task")]}):null,!c&&!re&&u?ve(Id,{title:n("section.makeTask"),arrow:!0,enterDelay:300,disableInteractive:!0,children:ve(ui,{className:"taskbox-checklist-convert",size:"small","aria-label":n("section.makeTask"),onClick:()=>u(e,ee,U.label),sx:{display:z?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:ve(Nx,{sx:{fontSize:16}})})}):null,c?null:ve(ui,{className:"taskbox-checklist-remove",size:"small","aria-label":n("section.deleteTodo"),onClick:()=>i(e,ee),sx:{display:z?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:ve(zx,{sx:{fontSize:15}})})]});return v?ve(_D,{id:V[ee],children:({handleProps:se})=>ct(se)},V[ee]):ve(Ht,{children:ct(null)},V[ee])})}),Xn(Ht,{sx:{mt:.5,ml:z?0:3.25,display:"flex",alignItems:"center",gap:.5},children:[ve(Ht,{component:"input",spellCheck:!1,value:h,placeholder:n("section.addTodoPlaceholder"),enterKeyHint:"done",onChange:U=>E(U.target.value),onKeyDown:U=>{U.key==="Enter"&&me()},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?ve(Id,{title:n("section.attachExisting"),arrow:!0,children:ve(ui,{size:"small","aria-label":n("section.attachExisting"),onMouseDown:U=>U.preventDefault(),onClick:b.openDialog,sx:{flexShrink:0,color:"#9a9a97"},children:ve(SD,{sx:{fontSize:20}})})}):null,ve(ui,{size:"small","aria-label":n("section.addTodo"),disabled:!h.trim(),onMouseDown:U=>U.preventDefault(),onClick:me,sx:{flexShrink:0,color:h.trim()?"#2f80ed":"#c9c8c5"},children:ve(hD,{sx:{fontSize:20}})})]}),d&&p&&f?ve(Sc,{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,ve(BD,{open:!!D,anchorEl:D?.anchorEl??null,title:D?.checked?n("calendar.checklistCompleteConfirm"):n("task.uncompleteConfirm"),confirmText:D?.checked?n("common.done"):n("task.unmark"),onCancel:()=>F(null),onConfirm:()=>{D&&a(e,D.index,D.checked),F(null)}}),ve(nD,{open:!!k,onClose:()=>_(null),maxWidth:"xs",fullWidth:!0,slotProps:{paper:{sx:{borderRadius:2,m:2}}},children:Xn(Ht,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5},children:[ve(Ht,{sx:{fontSize:15.5,fontWeight:600,color:"#37352f"},children:n("section.editTodo")}),ve(aD,{autoFocus:!0,fullWidth:!0,size:"medium",value:k?.label??"",onChange:U=>_(ee=>ee&&{...ee,label:U.target.value}),onKeyDown:U=>{if(U.key!=="Enter")return;let ee=k;ee&&ee.label.trim()&&l?.(e,ee.index,ee.label.trim()),_(null)}}),Xn(Ht,{sx:{display:"flex",alignItems:"center",gap:1},children:[!c&&u&&k&&!t[k.index]?.task_seq?ve(ui,{"aria-label":n("section.makeTask"),onClick:()=>{u(e,k.index,t[k.index]?.label??""),_(null)},sx:{color:"#57564f"},children:ve(Nx,{sx:{fontSize:20}})}):null,!c&&k?ve(ui,{"aria-label":n("section.deleteTodo"),onClick:()=>{i(e,k.index),_(null)},sx:{color:"#e5484d"},children:ve(zx,{sx:{fontSize:19}})}):null,ve(Ht,{sx:{flex:1}}),ve(qx,{color:"inherit",onClick:()=>_(null),children:n("common.cancel")}),ve(qx,{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 jo,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 XD from"@mui/icons-material/AttachFileOutlined";import{FileTypeIcon as QD}from"@ehfuse/file-viewer/icons";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"]),Bc=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 Hx(e){let t=Tn(),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 wd(){let t=Tn().useValue("attachmentUpload.progress");return PD(RD,{children:[t??0,"%"]})}function Wx(){let t=Tn().useValue("attachmentUpload.progress");return MD(ED,{variant:"determinate",value:t??0,sx:{height:4,borderRadius:2,bgcolor:"#dbe9fb",mt:.75}})}import{Fragment as $x,jsx as yt,jsxs as Cl}from"react/jsx-runtime";function JD({id:e,children:t}){let{attributes:o,listeners:a,setNodeRef:r,transform:i,transition:l,isDragging:s}=UD({id:e});return yt(jo,{ref:r,sx:{transform:GD.Transform.toString(i),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({...o,...a})})}function yl(e){return e>=1048576?`${(e/1048576).toFixed(1)}MB`:`${Math.max(1,Math.round(e/1024))}KB`}var _c={flex:1,minWidth:0,fontSize:13.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function Ic({taskSeq:e,attachments:t,onAdd:o,onRemove:a,removeLocked:r=!1,onPreview:i,onDownload:l,onReorder:s}){L();let[c,u]=LD(!1),m=OD(null),d=We(),p=Ui(),f=Vi(),g=Hx(e),x=e===0,h=!!s&&!x&&!d&&!r&&!g&&t.length>1,E=HD(FD(zD,{activationConstraint:{distance:5}})),b=(R,C)=>R.uuid?`file-${R.uuid}`:`file-${C}`,B=t.map(b),T=R=>{let{active:C,over:y}=R;if(!y||C.id===y.id)return;let I=B.indexOf(String(C.id)),S=B.indexOf(String(y.id));I<0||S<0||s?.(e,I,S)},z=R=>{if(i){i(R);return}window.open(f(R.uuid??""),"_blank","noopener,noreferrer")},k=R=>{if(l){l(R);return}window.open(f(R.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},_=R=>g?R+1<g.index?"done":R+1===g.index?"uploading":"waiting":"waiting",D=(R,C,y,I,S={})=>Cl(jo,{sx:{px:1,py:.5,borderRadius:1,border:"1px solid",borderColor:S.uploading?"#d5e6fb":"#e6e6e3",bgcolor:S.uploading?"#f4f9ff":"transparent","&:hover .taskbox-file-remove":{opacity:1},"&:hover .taskbox-file-handle":{opacity:1}},children:[Cl(jo,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[S.handleProps?yt(jo,{className:"taskbox-file-handle","aria-label":n("section.reorder"),...S.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:yt(jD,{sx:{fontSize:16}})}):null,yt(jo,{component:"span",sx:{display:"inline-flex",flexShrink:0},children:yt(QD,{fileName:C,size:18})}),y,yt(jo,{component:"span",sx:{fontSize:12,color:S.uploading?"#2f80ed":"#9a9a97",flexShrink:0},children:I}),S.removeIndex!==void 0?yt(AD,{className:"taskbox-file-remove",size:"small","aria-label":n("section.deleteAttachment"),onClick:()=>a(e,S.removeIndex),sx:{opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:yt(YD,{sx:{fontSize:15}})}):null]}),S.uploading?yt(Wx,{}):null]},R),F=R=>{let C=Bc(R.name);return yt(jo,{component:"button",type:"button",onClick:()=>C?z(R):k(R),title:n("section.fileAction",{name:R.name,value:C?n("section.preview"):n("section.download")}),sx:{..._c,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:R.name})};return Cl(Ao,{icon:yt(XD,{sx:{fontSize:18,display:"block"}}),title:Cl($x,{children:[n("section.files")," ",t.length>0?t.length:""]}),children:[yt(ZD,{sortable:h,sensors:E,rowIds:B,onDragEnd:T,children:Cl(jo,{sx:{display:"flex",flexDirection:"column",gap:.5,mt:1},children:[t.map((R,C)=>{let y=`${R.uuid||R.name}-${C}`;if(x){let I=_(C),S=I==="uploading";return D(y,R.name,yt(jo,{component:"span",sx:{..._c,color:I==="done"?"#37352f":"#9a9a97"},children:R.name}),S?yt(wd,{}):yl(R.size),{uploading:S,removeIndex:!r&&!g?C:void 0})}return R.uuid?h?yt(JD,{id:b(R,C),children:I=>D(y,R.name,F(R),yl(R.size),{removeIndex:r?void 0:C,handleProps:I})},b(R,C)):D(y,R.name,F(R),yl(R.size),{removeIndex:r?void 0:C}):D(y,R.name,yt(jo,{component:"span",title:n("section.legacyAttachment"),sx:{..._c,color:"#9a9a97"},children:R.name}),yl(R.size),{removeIndex:r?void 0:C})}),!x&&g?g.queue.slice(g.index-1).map((R,C)=>{let y=C===0;return D(`uploading-${g.index+C}-${R.name}`,R.name,yt(jo,{component:"span",sx:{..._c,color:"#9a9a97"},children:R.name}),y?yt(wd,{}):yl(R.size),{uploading:y})}):null]})}),yt(jo,{onClick:()=>m.current?.click(),onDragOver:R=>{R.preventDefault(),u(!0)},onDragLeave:()=>u(!1),onDrop:R=>{R.preventDefault(),u(!1);let C=Array.from(R.dataTransfer.files);C.length>0&&o(e,C)},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})}),yt(jo,{component:"input",ref:m,type:"file",multiple:!0,onChange:R=>{let C=Array.from(R.target.files??[]);C.length>0&&o(e,C),R.target.value=""},sx:{display:"none"}})]})}function ZD({sortable:e,sensors:t,rowIds:o,onDragEnd:a,children:r}){return e?yt(qD,{sensors:t,collisionDetection:ND,modifiers:[$D,WD],onDragEnd:a,children:yt(VD,{items:o,strategy:KD,children:r})}):yt($x,{children:r})}import{useState as iE}from"react";import{Checkbox as lE,Divider as sE,ListItemIcon as cE,Menu as mE,MenuItem as Gx}from"@mui/material";import uE from"@mui/icons-material/Add";import{Box as Dd,Button as oE}from"@mui/material";import{FormDialog as nE}from"@ehfuse/mui-form-dialog";import{ClearTextField as rE}from"@ehfuse/mui-form-controls";import{ColorPicker as aE}from"@ehfuse/mui-color-picker";import{useGlobalForm as eE}from"@ehfuse/forma";import{ErrorAlert as tE}from"@ehfuse/alerts";var Vx="#2f80ed";function Ux({open:e,onClose:t,onSubmit:o}){L();let a=eE({formId:_e("taskbox-add-label-form"),initialValues:{name:"",color:Vx},onValidate:i=>String(i.name??"").trim()?!0:(tE(n("dialog.enterLabelName")),!1),onSubmit:i=>(o(String(i.name).trim(),i.color),r.form.close(),!0)}),r={form:no({modalIdPrefix:"taskbox-add-label-dialog",open:e,onClose:t,onOpen:()=>a.setFormValues({name:"",color:Vx})})};return{form:a,modals:r}}import{jsx as Sl,jsxs as Ed}from"react/jsx-runtime";function Kx({open:e,onClose:t,onSubmit:o}){L();let{form:a,modals:r}=Ux({open:e,onClose:t,onSubmit:o}),i=String(a.useFormValue("name")??""),l=String(a.useFormValue("color")??""),s=_f(l),c=Ed(Dd,{children:[Ed(Dd,{sx:{display:"flex",alignItems:"center",gap:1.5,mt:.5},children:[Sl(rE,{form:a,name:"name",label:n("dialog.labelName"),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),a.submit())},fullWidth:!0,autoFocus:!0}),Sl(aE,{value:l,onChange:u=>a.setFormValue("color",u),shape:"circle",colorSize:28})]}),Ed(Dd,{sx:{mt:2,display:"flex",alignItems:"center",gap:1,fontSize:13,color:"#787774"},children:[n("dialog.preview"),Sl(Ve,{option:{key:"__preview__",name:i.trim()||n("dialog.label"),...s}})]})]});return Sl(nE,{open:r.form.isOpen,onClose:r.form.close,maxWidth:"xs",title:n("dialog.addLabelTitle"),locale:Ce(),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:Sl(oE,{variant:"contained",onClick:()=>{a.submit()},children:n("common.add")})}})}import{Fragment as dE,jsx as di,jsxs as wc}from"react/jsx-runtime";function Dc({anchorEl:e,selectedKeys:t,labelOptions:o,onToggle:a,onAddLabel:r,onClose:i}){L();let[l,s]=iE(!1),c=Nn();return wc(dE,{children:[wc(mE,{anchorEl:e,open:!!e,onClose:i,transitionDuration:0,...c,children:[o.map(u=>{let m=t.includes(u.key);return wc(Gx,{onClick:()=>a(u.key),sx:{fontSize:14,minWidth:170,gap:1},children:[di(lE,{size:"small",checked:m,sx:{p:0}}),di(Ve,{option:u})]},u.key)}),di(sE,{}),wc(Gx,{onClick:()=>s(!0),sx:{fontSize:14,color:"#787774"},children:[di(cE,{children:di(uE,{sx:{fontSize:18,color:"#787774"}})}),n("menu.addLabel")]})]}),di(Kx,{open:l,onClose:()=>s(!1),onSubmit:r})]})}function jx(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 Yx(e,t){let o=(e.target_account_seqs??[]).filter(d=>d>0);if(o.length===0)return null;let a=new Set(o),r=jx(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 Ec(e,t){let o=Yx(e,t);return o?[...o.teamNames,...o.individualNames].join(", "):n("col.allEmployees")}function NK(e,t){let o=Yx(e,t);return o?{kind:"members",teamNames:o.teamNames,individualNames:o.individualNames}:{kind:"everyone"}}function Xx(e,t,o){let a=(e.target_account_seqs??[]).filter(f=>f>0),r=jx(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 PE}from"@ehfuse/mui-datetime-picker";import{useState as pE}from"react";import{Box as Ra,IconButton as fE,Popover as gE}from"@mui/material";import xE from"@mui/icons-material/InfoOutlined";import bE from"@mui/icons-material/LockOutlined";import hE from"@mui/icons-material/PublicOutlined";import kE from"@mui/icons-material/Group";import{jsx as Yo,jsxs as Pa}from"react/jsx-runtime";var TE=[{key:"all",icon:Yo(hE,{sx:{fontSize:17,color:"#2f80ed"}}),label:"create.visibilityPublic",who:"create.visibilityInfoAll"},{key:"group",icon:Yo(kE,{sx:{fontSize:17,color:"#d9730d"}}),label:"create.visibilityDeptShort",who:"create.visibilityInfoGroup"},{key:"involved",icon:Yo(bE,{sx:{fontSize:17}}),label:"create.visibilityPrivate",who:"create.visibilityInfoPrivate"}];function Rc(){let[e,t]=pE(null),{colors:o}=xe(),a=String(Ba.labelColor??"#787774");return Pa(Ra,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.25},children:[n("create.visibility"),Yo(fE,{size:"small","aria-label":n("create.visibilityInfo"),onClick:r=>{r.stopPropagation(),t(r.currentTarget)},sx:{p:.25,color:a},children:Yo(xE,{sx:{fontSize:16}})}),Pa(gE,{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:[Pa(Ra,{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(Ra,{component:"strong",sx:{fontWeight:700,color:o.accentOnSurface},children:n("create.visibilityInfoNoteStrong")})," ",n("create.visibilityInfoNote")]}),Yo(Ra,{sx:{border:`1px solid ${o.border}`,borderRadius:1.5,overflow:"hidden"},children:Pa(Ra,{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:Pa("tr",{children:[Yo("th",{children:n("create.visibilityInfoColScope")}),Yo("th",{children:n("create.visibilityInfoColWho")})]})}),Yo("tbody",{children:TE.map(r=>Pa("tr",{children:[Yo(Ra,{component:"td",sx:{whiteSpace:"nowrap"},children:Pa(Ra,{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 Ma,jsx as pe,jsxs as Dn}from"react/jsx-runtime";var tb="taskbox:create-expanded";function ME(){try{return window.localStorage.getItem(tb)==="1"}catch{return!1}}function Md({form:e,statusOptions:t,customTabs:o,sprints:a=[],avatarSrcByName:r,isNotice:i=!1,hideProject:l=!1,hideBug:s=!1,hideTypeToggle:c=!1,leadingRow:u,afterProject:m,extraRows:d,hideLabel:p=!1,simple:f=!1,hideMembers:g=!1,templateItem:x=!1,postMode:h=!1,employees:E=[],workspaceName:b="",workspaceSlot:B,myAccountSeq:T=0,departments:z=[],myGroupSeq:k=0,onMemberEdit:_,onAddProject:D,onAddLabelOption:F,contentSyncKey:R="create",contentTemplates:C,contentTitleExtra:y,onSaveContentTemplate:I,onRemoveContentTemplate:S}){L();let O=Tn(),w=Ui(),q=e.useFormValue("manager_name"),v=e.useFormValue("receiver_names"),M=e.useFormValue("start_date"),j=!!e.useFormValue("is_event"),V=!!e.useFormValue("is_bug"),Z=e.useFormValue("bug_repro")??"",ae=e.useFormValue("bug_device")??"",me=e.useFormValue("bug_where")??"",U=e.useFormValue("bug_version")??"",ee=e.useFormValue("event_time")??"",$=e.useFormValue("event_place")??"",G=e.useFormValue("event_address")??"",re=e.useFormValue("due_date"),Ee=e.useFormValue("reminders")??[],ct=e.useFormValue("priority"),se=e.useFormValue("content"),Q=e.useFormValue("note")??"",X=e.useFormValue("checklist")??[],ie=e.useFormValue("tab_key"),de=e.useFormValue("sprint_seq")??0,we=e.useFormValue("story_points")??0,Se=o.find(P=>P.key===ie&&P.useSprints),_t=Se?a.filter(P=>`custom-${P.group_seq}`===ie):[],[He,De]=pi(null),mt=e.useFormValue("label_keys"),[Ge,so]=pi(null),ht=e.useFormValue("visibility")||"involved",te=Number(e.useFormValue("visibility_group_seq")??0),[Be,Je]=pi(null),qe=e.useFormValue("repeat_rule")||"",en=e.useFormValue("repeat_until")||"",[Ar,co]=pi(null),[tr,xn]=pi(null),or=e.useFormValue("target_names"),Vt=e.useFormValue("target_account_seqs"),jt=O.useValue("createAttachmentFiles")??[],nr=i?Ec({author_account_seq:T,target_names:or,target_account_seqs:Vt},E):"",[ut,Ro]=pi(ME),hn=f&&!j&&!i&&!h,nt=hn&&!ut,On=()=>{let P=!ut;Ro(P);try{window.localStorage.setItem(tb,P?"1":"0")}catch{}},Pe=!h,K=g?1:2;return Dn(Ma,{children:[u,!i&&!c?Dn(Sr,{sx:{display:"flex",gap:1.25,px:2,pt:1.5,pb:1.5,flexShrink:0},children:[B?pe(Sr,{sx:{alignSelf:"center",mr:"6px",minWidth:0,display:"flex"},children:B}):b?pe(Sr,{sx:{alignSelf:"center",fontSize:13.5,fontWeight:600,color:"#37352f",mr:"6px",maxWidth:160,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:b,children:b}):null,[{value:"task",label:n("kind.task")},{value:"event",label:n("kind.event")},...s?[]:[{value:"bug",label:n("kind.bug")}]].map(P=>{let ge=(V?"bug":j?"event":"task")===P.value;return pe(Qx,{onClick:()=>Km(e,P.value),sx:{px:1.75,lineHeight:1,pt:"8px",pb:"10px",borderRadius:99,fontSize:13.5,fontWeight:ge?600:400,color:ge?"#ffffff":"#787774",bgcolor:ge?"#2563eb":"#f4f4f2"},children:P.label},P.label)})]}):null,pe(vl,{sx:{borderColor:"#e6e6e3"}}),Dn(Sr,{sx:{pt:1.5,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[pe(gc,{afterProject:m,hideProject:l||nt&&!ie,hideManager:g||h||nt&&!q,hideReceivers:x||g||h&&ht==="all"||nt&&v.length===0,hideStartDate:nt||h,hideReminder:x||h||nt&&Ee.length===0,hidePriority:h,hideDueDate:h||!j&&!!qe,values:{tabKey:ie,managerName:q,receiverNames:v,startDate:M,dueDate:re,reminders:Ee,priority:ct,eventTime:ee,eventPlace:$,eventAddress:G},customTabs:o,avatarSrcByName:r,notice:i,event:j,onChangeEventTime:P=>e.setFormValue("event_time",P),onChangeEventPlace:P=>e.setFormValue("event_place",P),onChangeEventAddress:P=>e.setFormValue("event_address",P),targetSummary:nr,onChangeProject:P=>e.setFormValue("tab_key",P),onAddProject:D,onChangeStartDate:P=>e.setFormValue("start_date",P),onClearStartDate:()=>e.setFormValue("start_date",""),onChangeDueDate:P=>e.setFormValue("due_date",P),onChangeReminder:P=>e.setFormValue("reminders",P),onChangePriority:P=>e.setFormValue("priority",P),onMemberEdit:_,pinColumns:Pe,beforeStart:Dn(Ma,{children:[!x&&!V&&!h&&!(nt&&!qe)?pe(ke,{icon:pe(wE,{sx:{fontSize:17,...qe?{color:"#2f80ed"}:{}}}),label:n("create.repeat"),onClick:P=>co(P),sx:j||!Pe?void 0:lt(K),children:qe?bs(qe):pe(Sr,{component:"span",sx:{color:"#9a9a97"},children:n("common.none")})}):null,!x&&!V&&!h&&qe?pe(ke,{icon:pe(DE,{sx:{fontSize:17}}),label:n("create.repeatUntil"),onClick:P=>xn(P),sx:j||!Pe?void 0:lt(K),children:en?$o(en):pe(Sr,{component:"span",sx:{color:"#9a9a97"},children:n("create.auto")})}):null]}),trailing:Dn(Ma,{children:[!i&&!g&&!(nt&&ht==="involved")?pe(ke,{icon:ht==="all"?pe(Zx,{sx:{fontSize:17,color:"#2f80ed"}}):ht==="group"?pe(eb,{sx:{fontSize:17,color:"#d9730d"}}):pe(Jx,{sx:{fontSize:17}}),label:pe(Rc,{}),onClick:P=>Je(P),sx:j||!Pe?void 0:lt(1),children:ht==="all"?n("create.visibilityPublic"):ht==="group"?n("create.visibilityDept",{value:z.find(P=>P.seq===te)?.name??n("create.department")}):n("create.visibilityPrivate")}):null,Se&&!j&&!i&&!h&&!(nt&&de===0&&we===0)?Dn(Ma,{children:[pe(ke,{icon:pe(IE,{sx:{fontSize:17}}),label:n("col.goal"),onClick:P=>De(P),sx:Pe?lt(1):void 0,children:de>0?_t.find(P=>P.seq===de)?.name??n("create.deletedGoal"):pe(Sr,{component:"span",sx:{color:"#9a9a97"},children:n("board.unassigned")})}),pe(ke,{icon:pe(EE,{sx:{fontSize:17}}),label:"\uD3EC\uC778\uD2B8",sx:Pe?lt(1):void 0,children:pe(yr,{value:we>0?String(we):"",placeholder:n("create.notEstimated"),onCommit:P=>e.setFormValue("story_points",Number(P.replace(/[^0-9.]/g,""))||0)})})]}):null,V?pe(xc,{values:{repro:Z,device:ae,where:me,version:U},onChangeRepro:P=>e.setFormValue("bug_repro",P),onChangeDevice:P=>e.setFormValue("bug_device",P),onChangeWhere:P=>e.setFormValue("bug_where",P),onChangeVersion:P=>e.setFormValue("bug_version",P)}):null,!x&&!h&&!i?(d??[]).filter(P=>!(nt&&!P.filled)).map(P=>pe(ke,{icon:P.icon,label:P.label,onClick:P.onClick,sx:j||!Pe?void 0:lt(K),children:P.value},P.key)):null]}),leading:j||p?null:pe(Sr,{sx:{gridColumn:"1 / -1"},children:pe(ke,{icon:pe(_E,{sx:{fontSize:17}}),label:n("dialog.label"),onClick:P=>so(P),children:(mt??[]).length>0?pe(Wr,{labelKeys:mt??[],labelOptions:t}):pe(Sr,{component:"span",sx:{color:"#9a9a97"},children:n("menu.empty")})})})}),hn?Dn(Qx,{onClick:On,"aria-expanded":ut,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:[ut?pe(yE,{sx:{fontSize:17}}):pe(CE,{sx:{fontSize:17}}),ut?n("create.collapseFields"):n("create.expandFields")]}):null,pe(vl,{sx:{my:1.5,borderColor:"#e6e6e3"}}),pe(Ao,{icon:pe(vE,{sx:{fontSize:18,display:"block"}}),title:n("common.content"),titleExtra:y||C?Dn(Ma,{children:[y,C?pe(yc,{content:se,templates:C,onApply:P=>e.setFormValue("content",P),onSave:I,onRemove:S}):null]}):void 0,children:pe(hc,{syncKey:R,value:se,onChange:P=>e.setFormValue("content",P)})}),V||h||nt&&!Q?null:Dn(Ma,{children:[pe(vl,{sx:{my:1.5,borderColor:"#e6e6e3"}}),pe(Ao,{icon:pe(BE,{sx:{fontSize:18,display:"block"}}),title:n("col.note"),children:pe(RE,{form:e,name:"note",placeholder:n("create.notePlaceholder"),fullWidth:!0,size:"medium",sx:{mt:1}})})]}),j||h||nt&&X.length===0?null:pe(vl,{sx:{my:1.5,borderColor:"#e6e6e3"}}),j||h||nt&&X.length===0?null:pe(vc,{taskSeq:0,checklist:X,onAdd:(P,ce)=>Ym(e,ce),onToggle:(P,ce,ge)=>Xm(e,ce,ge),onRemove:(P,ce)=>Qm(e,ce),onUpdate:(P,ce,ge)=>Jm(e,ce,ge)}),x?null:Dn(Ma,{children:[pe(vl,{sx:{my:1.5,borderColor:"#e6e6e3"}}),pe(Ic,{taskSeq:0,attachments:jt.map(P=>({name:P.name,size:P.size})),onAdd:(P,ce)=>Zm(O,ce,w),onRemove:(P,ce)=>eu(O,ce)})]})]}),pe(Rd,{transitionDuration:0,anchorEl:He,open:!!He,onClose:()=>De(null),children:[{seq:0,label:n("board.unassigned")},..._t.map(P=>({seq:P.seq,label:sn(P)}))].map(P=>pe(Pd,{onClick:()=>{e.setFormValue("sprint_seq",P.seq),De(null)},sx:{fontSize:14,minWidth:170},children:P.label},P.seq))}),pe(Rd,{transitionDuration:0,anchorEl:Ar,open:!!Ar,onClose:()=>co(null),children:[{value:"",label:n("common.none")},...Ji].map(P=>pe(Pd,{selected:qe===P.value,onClick:()=>{co(null),Gm(e,P.value)},sx:{fontSize:14,minWidth:140},children:P.label},P.value||"none"))}),pe(PE,{anchorEl:tr,open:!!tr,onClose:()=>xn(null),selectedDate:en?new Date(`${en}T00:00:00`):new Date,onDateChange:P=>{jm(e,P),xn(null)}}),pe(Rd,{transitionDuration:0,anchorEl:Be,open:!!Be,onClose:()=>Je(null),children:[{key:"involved",label:n("create.visibilityPrivate"),tip:n("create.privateTip"),icon:pe(Jx,{sx:{fontSize:17,color:"#57564f"}}),selected:ht==="involved",onPick:()=>Zi(e,"involved")},{key:"all",label:n("create.visibilityPublic"),tip:n("create.publicTip"),icon:pe(Zx,{sx:{fontSize:17,color:"#2f80ed"}}),selected:ht==="all",onPick:()=>Zi(e,"all")},...[...z].sort((P,ce)=>P.seq===k?-1:ce.seq===k?1:0).map(P=>({key:`group-${P.seq}`,label:n("create.visibilityDeptName",{name:P.name}),tip:n("create.deptTip",{name:P.name}),icon:pe(eb,{sx:{fontSize:17,color:"#d9730d"}}),selected:ht==="group"&&te===P.seq,onPick:()=>Zi(e,"group",P.seq)}))].map(P=>pe(SE,{title:P.tip,arrow:!0,disableInteractive:!0,placement:"right",children:Dn(Pd,{selected:P.selected,onClick:()=>{P.onPick(),h&&P.key==="all"&&(e.setFormValue("receiver_names",[]),e.setFormValue("receiver_account_seqs",[])),Je(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[P.icon,P.label]})},P.key))}),pe(Dc,{anchorEl:Ge,selectedKeys:mt??[],labelOptions:t,onToggle:P=>e.setFormValue("label_keys",_s(mt??[],P)),onAddLabel:(P,ce)=>F?.(P,ce),onClose:()=>so(null)})]})}import{Fragment as rb,jsx as Ct,jsxs as Bl}from"react/jsx-runtime";var $E={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 ab({open:e,onClose:t,desktopPresentation:o="drawer",submitLabel:a,...r}){L();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=Tn(),h=LE(!1),[E,b]=ob(0),B=i.useFormValue("title"),T=i.useFormValue("icon"),z=i.useFormValue("icon_color"),k=!!i.useFormValue("is_event"),_=!!i.useFormValue("is_bug"),D=We(),R=x.useValue("createSubmitting")??!1,C=f||k?Oe(T||(f?wt:zt)):null,y=f?n("create.titleNotice"):k?n("create.titleEvent"):_?n("task.createBug"):n("task.createTask"),I=f?n("create.noticeTitlePlaceholder"):k?n("create.eventTitlePlaceholder"):_?n("create.bugTitlePlaceholder"):n("create.taskTitlePlaceholder");OE(()=>{let v=h.current;h.current=e,!(!e||v)&&(Um(i,x,{presetTitle:l,presetContent:s,presetVisibility:c,presetVisibilityGroupSeq:u,presetDueDate:m,presetTabKey:d,presetManager:p,isNotice:f,defaultBug:g}),b(M=>M+1))},[e]);let[S,O]=ob(null),w=v=>C?k?Ct(NE,{title:n("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:Ct(AE,{onClick:M=>O(M.currentTarget),sx:{display:"flex",p:.5,borderRadius:1,color:z||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:Ct(C,{sx:{fontSize:20}})})}):Ct(vr,{sx:[{display:"flex",color:z||"#1e3a8a"},v],children:Ct(C,{sx:{fontSize:20}})}):null,q=Bl(vr,{sx:{display:"flex",alignItems:"center",gap:1,px:2,pt:2,pb:1},children:[w({p:0}),Ct(vr,{component:"input",autoFocus:!0,spellCheck:!1,value:B,placeholder:I,onChange:v=>i.setFormValue("title",v.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 D||o==="dialog"?Ct(rb,{children:Ct(WE,{open:e,onClose:t,backdropClick:!1,locale:Ce(),fontScale:D?{enabled:!0,default:1.1,min:.6}:{enabled:!0},title:y,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fullScreen:D,mobilePresentation:D?"slide":"dialog",maxWidth:"md",actions:{showCancelButton:!0,right:Ct(Od,{variant:"contained",disableElevation:!0,disabled:R,onClick:R?void 0:i.submit,children:R?n("create.saving"):a??n("create.saveButton")})},dialogActionSx:D?$E: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:Ct(vr,{sx:{width:"100%",minWidth:0,display:"flex",flexDirection:"column",gap:0},children:Ct(Md,{...r,contentSyncKey:`create-${E}`,leadingRow:q})})}]})}):Bl(rb,{children:[Ct(qE,{anchor:"right",open:e,onClose:(v,M)=>{M!=="backdropClick"&&t()},"aria-label":n("create.newTaskAria"),sx:{zIndex:v=>v.zIndex.modal},slotProps:{paper:{sx:{width:720,maxWidth:"100vw"}}},children:Bl(vr,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[Bl(vr,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.5,flexShrink:0},children:[w({px:.5}),Ct(vr,{component:"input",autoFocus:!0,spellCheck:!1,value:B,placeholder:I,onChange:v=>i.setFormValue("title",v.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}}}),Ct(zE,{"aria-label":n("common.close"),onClick:t,sx:{color:"#6b7280"},children:Ct(FE,{})})]}),Ct(nb,{sx:{borderColor:"#e6e6e3"}}),Ct(vr,{sx:{flex:1,minHeight:0},children:Ct(HE,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:Ct(Md,{...r,contentSyncKey:`create-${E}`})})}),Ct(nb,{sx:{borderColor:"#e6e6e3"}}),Bl(vr,{sx:{display:"flex",justifyContent:"flex-end",gap:.5,px:2,py:1.5,flexShrink:0},children:[Ct(Od,{onClick:t,color:"inherit",disabled:R,children:n("common.cancel")}),Ct(Od,{onClick:i.submit,variant:"contained",disabled:R,children:R?n("create.creating"):a??n("common.register")})]})]})}),Ct(Vr,{anchorEl:S,value:T,color:z,onSelect:v=>{i.setFormValue("icon",v),O(null)},onSelectColor:v=>i.setFormValue("icon_color",v),onClose:()=>O(null)})]})}import{useEffect as eh,useRef as th,useState as oh}from"react";import{Box as Gc,Button as gM,Divider as nh,Drawer as xM,IconButton as bM,ListItemIcon as cp,ListItemText as mp,Menu as hM,MenuItem as up}from"@mui/material";import kM from"@mui/icons-material/MoreVert";import TM from"@mui/icons-material/DeleteOutline";import yM from"@mui/icons-material/ShareOutlined";import CM from"@mui/icons-material/HistoryOutlined";import SM from"@ehfuse/overlay-scrollbar";import{FormDialog as vM}from"@ehfuse/mui-form-dialog";import{useRef as zc,useState as Br}from"react";import{Box as he,Button as Cb,Chip as Nc,IconButton as Xo,Popover as hR,Tooltip as _b}from"@mui/material";import kR from"@mui/icons-material/ArrowUpwardRounded";import{TextField as TR}from"@ehfuse/mui-form-controls";import Fc from"@mui/icons-material/Close";import yR from"@mui/icons-material/EditOutlined";import Sb from"@mui/icons-material/ContentCopyOutlined";import vb from"@mui/icons-material/Check";import CR from"@mui/icons-material/Favorite";import SR from"@mui/icons-material/FavoriteBorderOutlined";import vR from"@mui/icons-material/CheckCircle";import BR from"@mui/icons-material/CheckCircleOutlineOutlined";import bi from"@mui/icons-material/AttachFileOutlined";import _R from"@mui/icons-material/AddCircleOutline";import IR from"@mui/icons-material/ImageOutlined";var Ld=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 Pc,useEffect as VE,useMemo as UE,useRef as ib,useState as Ad}from"react";import{Box as Mc,Paper as KE,Popper as GE}from"@mui/material";import{jsx as Oa,jsxs as YE}from"react/jsx-runtime";var lb=8,jE=[{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 _l(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 qd(e,t){let o=le(),a=e??o.mentionCandidates??[],r=t??o.slashCommands,i=r===!0?jE:Array.isArray(r)?r:[];return{people:a,commands:i,enabled:a.length>0||i.length>0}}function zd(e,t,o){if(!o)return[];let a=o.query.toLowerCase();return o.trigger==="@"?e.filter(r=>r.name.toLowerCase().includes(a)).slice(0,lb).map((r,i)=>({id:`p${i}-${r.name}`,text:`@${r.name} `,label:r.name,subtitle:r.subtitle,icon:Oa(po,{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,lb).map(r=>({id:`c-${r.key}`,text:r.insert,label:`/${r.label}`,icon:Oa(Mc,{component:"span",sx:{width:24,textAlign:"center",fontSize:18,lineHeight:1},children:r.insert})}))}function Nd({open:e,anchor:t,items:o,active:a,onPick:r,onHover:i}){return Oa(GE,{open:e,anchorEl:t,placement:"top-start",sx:{zIndex:1500},children:Oa(KE,{elevation:4,sx:{minWidth:220,maxWidth:320,py:.5,borderRadius:1.5},children:o.map((l,s)=>YE(Mc,{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,Oa(Mc,{component:"span",sx:{fontWeight:500,whiteSpace:"nowrap"},children:l.label}),l.subtitle?Oa(Mc,{component:"span",sx:{color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.subtitle}):null]},l.id))})})}function sb({value:e,setValue:t,candidates:o,slashCommands:a}){let{people:r,commands:i,enabled:l}=qd(o,a),s=ib(null),[c,u]=Ad(null),[m,d]=Ad(null),[p,f]=Ad(0),g=UE(()=>zd(r,i,m),[i,r,m]),x=!!(c&&m&&g.length>0),h=Pc(()=>{let k=s.current;if(!l||!k)return;let _=k.selectionStart??k.value.length,D=r.length>0?_l(k.value,_,"@"):null,F=!D&&i.length>0?_l(k.value,_,"/"):null,R=D?{...D,trigger:"@"}:F?{...F,trigger:"/"}:null;d(R),f(0),u(R?k.closest(".MuiInputBase-root")??k:null)},[i.length,l,r.length]),E=ib(null);VE(()=>{let k=s.current,_=E.current;if(_!==null&&k){E.current=null,k.setSelectionRange(_,_);return}document.activeElement===k&&h()},[e,h]);let b=Pc(k=>{let _=s.current;if(!m||!_)return;let D=_.selectionStart??e.length,F=e.slice(0,m.start)+k.text+e.slice(D),R=m.start+k.text.length;E.current=F===e?null:R,t(F),d(null),u(null),requestAnimationFrame(()=>{E.current=null,_.focus(),_.setSelectionRange(R,R)})},[m,t,e]),B=Pc(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:Pc(k=>{s.current=k},[]),onKeyDown:B,onSelectionChange:h,popper:l?Oa(Nd,{open:x,anchor:c,items:g,active:p,onPick:b,onHover:f}):null}}import{useCallback as Fd,useEffect as XE,useRef as cb,useState as mb}from"react";import{Box as Il,Tab as QE,Tabs as JE}from"@mui/material";import{jsx as fi,jsxs as tR}from"react/jsx-runtime";var ub=[{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}"]}],ZE="'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif",db="taskbox.recentEmojis",pb=24;function fb(){try{let e=JSON.parse(window.localStorage.getItem(db)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string").slice(0,pb):[]}catch{return[]}}function eR(e){let t=[e,...fb().filter(o=>o!==e)].slice(0,pb);try{window.localStorage.setItem(db,JSON.stringify(t))}catch{}return t}function gb({onPick:e}){let[t,o]=mb(()=>fb()),[a,r]=mb(0),i=cb(null),l=cb(!1),s=t.length>0?[{key:"recent",labelKey:"section.emojiFrequent",items:t},...ub]:ub,c=Math.min(a,s.length-1),u=Fd(p=>{o(eR(p)),e(p)},[e]),m=Fd(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=Fd(()=>{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 XE(()=>{let p=i.current;p&&(p.scrollLeft=p.clientWidth*c)},[]),tR(Il,{children:[fi(JE,{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=>fi(QE,{label:n(p.labelKey)},p.key))}),fi(Il,{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=>fi(Il,{sx:{flex:"0 0 100%",width:"100%",height:"100%",overflowY:"auto",scrollSnapAlign:"start",scrollSnapStop:"always",p:1},children:fi(Il,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(40px, 1fr))"},children:p.items.map((f,g)=>fi(Il,{component:"button",type:"button",onClick:()=>u(f),"aria-label":f,sx:{border:0,bgcolor:"transparent",color:"#000",cursor:"pointer",fontFamily:ZE,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 cR,useImperativeHandle as mR,useLayoutEffect as hb,useRef as Lc,useState as bb}from"react";import{Box as Ud}from"@mui/material";import{EhfuseEditor as uR}from"@ehfuse/editor";import{useCallback as Hd,useMemo as oR,useRef as nR,useState as Wd}from"react";import{jsx as rR}from"react/jsx-runtime";function xb(e,t){let{people:o,commands:a,enabled:r}=qd(e,t),[i,l]=Wd(null),[s,c]=Wd(null),u=nR(""),[m,d]=Wd(0),p=oR(()=>zd(o,a,i),[a,o,i]),f=!!(r&&s&&i&&p.length>0),g=Hd(()=>{if(!r)return;let b=window.getSelection();if(!b||b.rangeCount===0||!b.isCollapsed)return void l(null);let B=b.anchorNode;if(!B||B.nodeType!==Node.TEXT_NODE||!B.parentElement?.closest(".ehfuse-editor-content"))return void l(null);let T=B.data,z=b.anchorOffset,k=o.length>0?_l(T,z,"@"):null,_=!k&&a.length>0?_l(T,z,"/"):null,D=k?{...k,trigger:"@"}:_?{..._,trigger:"/"}:null;if(!D){u.current="",l(null),c(null);return}l({node:B,start:D.start,end:z,query:D.query,trigger:D.trigger});let F=`${D.trigger}${D.query}`;F!==u.current&&d(0),u.current=F;let R=document.createRange();R.setStart(B,D.start),R.setEnd(B,Math.min(D.start+1,T.length));let C=R.getBoundingClientRect();c({getBoundingClientRect:()=>C})},[a.length,r,o.length]),x=Hd(b=>{if(!i)return;let{node:B,start:T,end:z}=i;if(!B.isConnected)return void l(null);let k=window.getSelection(),_=document.createRange();_.setStart(B,T),_.setEnd(B,Math.min(z,B.data.length)),k?.removeAllRanges(),k?.addRange(_),document.execCommand("insertText",!1,b.text),l(null),c(null)},[i]);return{handlers:{onKeyDownCapture:Hd(b=>{!f||b.nativeEvent.isComposing||(b.key==="ArrowDown"||b.key==="ArrowUp"?(b.preventDefault(),b.stopPropagation(),d(B=>(B+(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?rR(Nd,{open:f,anchor:s,items:p,active:m,onPick:x,onHover:d}):null,isOpen:f}}function gi(e){return/^\s*<(p|div|ul|ol|h[1-6]|blockquote|pre)[\s>]/i.test(e)}var aR=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"]),iR=new Set(["background-color","color","text-decoration"]);function Oc(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(!aR.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=>iR.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 wl(e){if(typeof DOMParser>"u")return e.replace(/<[^>]*>/g,"");let t=e.replace(/<br\s*\/?>/gi,`
5
+ `).trim()}var Mw={...Ox,left:(Ox.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 kc({syncKey:e,value:t,onChange:o,readOnly:a=!1,viewFirst:r=!1,onTranslate:i,minHeight:l=180,editing:s,onEditingChange:c}){L();let{uploadContentImage:u,openExternalUrl:m,openContentImage:d}=se(),p=v=>{m?m(v):window.open(v,"_blank","noopener,noreferrer")},[f,g]=Ex(()=>!r||!Ra(t).trim()),x=s!==void 0,h=x?s:f,E=Ea(c);E.current=c;let b=v=>{x||g(v),E.current?.(v)};Dx(()=>{r&&b(!Ra(t).trim())},[e,r]);let B=Ea(null),T=Ea(new Ow),z=Ea(null),k=Ea(Date.now()+800),_=$e(),D=Dw(),F=ww(D.breakpoints.down("sm")),[R,C]=Ex(!1),y=()=>{let v=Ra(t);v&&navigator.clipboard.writeText(v).then(()=>{C(!0),window.setTimeout(()=>C(!1),1500)})},I=(v,O=!1)=>v instanceof Element?v.closest(O?".taskbox-content-readview a[href]":".ehfuse-editor-content a[href]"):null,S=v=>_||v.ctrlKey||v.metaKey;Dx(()=>{if(a)return;let v=vd(t);z.current===v||z.current===t||(z.current=v,k.current=Date.now()+800,B.current?.setHtml(v))},[e,t,a]);let M=vd(t),w=Ea(null),q=Ea({el:null,html:""});return Iw(()=>{let v=w.current;v&&(q.current.el===v&&q.current.html===M||(v.innerHTML=M,q.current={el:v,html:M}))}),a||!h?hc(kl,{sx:{position:"relative",mt:1},children:[lo(kl,{onClickCapture:v=>{let O=v.target;if(O?.tagName==="IMG"&&O.src){v.preventDefault(),v.stopPropagation();let V=Array.from(v.currentTarget.querySelectorAll("img")).filter(ue=>ue.src),Z=V.map((ue,K)=>({src:ue.src,name:ue.alt||decodeURIComponent(ue.src.split("/").pop()||"")||`image-${K+1}`})),ie=Math.max(0,V.indexOf(O));d?d(Z,ie):p(Z[ie].src);return}let j=I(v.target,!0);j&&(v.preventDefault(),v.stopPropagation(),p(j.href))},ref:w,className:"taskbox-content-readview","data-drag-scroll":"off",sx:{border:"1px solid #e0e0e0",borderRadius:1,p:"12px",pr:F?"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},...Td}}),F?hc(kl,{sx:{display:"flex",gap:1,mt:1},children:[lo(yd,{variant:"outlined",color:"inherit",startIcon:lo(Rw,{sx:{fontSize:18}}),onClick:y,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:R?n("section.copied"):n("common.copy")}),a?null:lo(yd,{variant:"outlined",color:"inherit",startIcon:lo(Rx,{sx:{fontSize:18}}),onClick:()=>b(!0),sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:n("common.edit")}),i?lo(yd,{variant:"outlined",color:"inherit",startIcon:lo(Px,{sx:{fontSize:18}}),onClick:i,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:n("section.translate")}):null]}):hc(kl,{sx:{position:"absolute",top:6,right:6,display:"flex",flexDirection:"column",gap:.25},children:[a?null:lo(Sd,{title:n("section.editContent"),arrow:!0,placement:"left",children:lo(Cd,{size:"small","aria-label":n("section.editContent"),onClick:()=>b(!0),sx:{color:"#9a9a97"},children:lo(Rx,{sx:{fontSize:17}})})}),i?lo(Sd,{title:n("section.translate"),arrow:!0,placement:"left",children:lo(Cd,{size:"small","aria-label":n("section.translate"),onClick:i,sx:{color:"#9a9a97"},children:lo(Px,{sx:{fontSize:17}})})}):null]})]}):hc(kl,{onDragOver:v=>v.stopPropagation(),onDrop:v=>v.stopPropagation(),onMouseDownCapture:v=>{S(v)&&I(v.target)&&v.preventDefault()},onClickCapture:v=>{let O=S(v)?I(v.target):null;O&&(v.preventDefault(),v.stopPropagation(),p(O.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?lo(Sd,{title:n("section.finishEditingTooltip"),arrow:!0,children:lo(Cd,{size:"small","aria-label":n("section.finishEditing"),onMouseDown:v=>v.preventDefault(),onClick:()=>b(!1),sx:{position:"absolute",top:4,right:6,zIndex:2,color:"#2f9e5b"},children:lo(Ew,{sx:{fontSize:19}})})}):null,lo(Pw,{ref:B,defaultValue:vd(t),autoHeight:!0,showToolbar:!_,focusBorder:!0,styles:{focusBorderColor:"var(--primary)"},toolbarOptions:Mw,plugins:[T.current],locale:ga(),minHeight:l,placeholder:n("section.contentPlaceholder"),onImageUpload:u,contentStyle:{padding:"12px"},onChange:v=>{let O=Date.now()<k.current,j=v===z.current;z.current=v,!(O||j)&&o(v)}})]})}import{Fragment as Vw,jsx as Io,jsxs as yc}from"react/jsx-runtime";function Id(e){return String(e??"").replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").trim().length>0}function Cc({content:e,templates:t,onApply:o,onSave:a,onRemove:r,readOnly:i=!1}){L();let[l,s]=Bd(null),[c,u]=Bd(!1),[m,d]=Bd(""),p=async g=>{s(null),!(Id(e)&&!await Nw({title:n("section.loadTemplate"),message:n("section.loadTemplateConfirm",{name:g.name})}))&&o(g.content)},f=()=>{s(null);let g=Ra(e);g&&navigator.clipboard.writeText(g).then(()=>Hw(n("section.contentCopied"))).catch(()=>Fw(n("section.contentCopyFailed")))};return yc(Vw,{children:[Io(qw,{title:n("section.contentMenu"),arrow:!0,disableInteractive:!0,children:Io(Lx,{size:"small","aria-label":n("section.contentMenu"),onClick:g=>s(g.currentTarget),sx:{ml:"auto",color:"#9a9a97"},children:Io(zw,{sx:{fontSize:18}})})}),yc(Aw,{anchorEl:l,open:!!l,onClose:()=>s(null),transitionDuration:0,children:[Io(Tc,{disabled:!Id(e),onClick:f,sx:{fontSize:14,minWidth:220},children:n("menu.copyContent")}),i?null:Io(Mx,{sx:{my:.5}}),!i&&a?Io(Tc,{disabled:!Id(e),onClick:()=>{s(null),d(""),u(!0)},sx:{fontSize:14,minWidth:220},children:n("section.saveAsTemplate")}):null,!i&&a?Io(Mx,{sx:{my:.5}}):null,i?null:t.length===0?Io(Tc,{disabled:!0,sx:{fontSize:14,minWidth:220},children:n("section.noSavedTemplates")}):t.map(g=>yc(Tc,{onClick:()=>{p(g)},sx:{fontSize:14,minWidth:220,gap:1},children:[Io(_d,{sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.name}),r?Io(Lx,{size:"small","aria-label":n("section.deleteTemplateAria",{name:g.name}),onClick:x=>{x.stopPropagation(),r(g.seq)},sx:{color:"#9a9a97"},children:Io(Qt,{sx:{fontSize:16}})}):null]},g.seq))]}),Io(Ww,{open:c,onClose:()=>u(!1),maxWidth:"xs",title:n("section.saveTemplateTitle"),locale:Se(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},tabs:{visible:!1},actions:{showCancelButton:!0,right:Io(Lw,{variant:"contained",disabled:!m.trim(),onClick:()=>{a?.(m.trim(),e),u(!1)},children:n("common.save")})},sections:[{id:"template-name",title:"",showTitle:!1,children:yc(_d,{sx:{display:"flex",flexDirection:"column",gap:1},children:[Io(_d,{sx:{fontSize:15,color:"#37352f"},children:n("section.saveTemplateHint")}),Io($w,{size:"medium",fullWidth:!0,autoFocus:!0,placeholder:n("section.templateNamePlaceholder"),value:m,onChange:g=>d(g.target.value)})]})}]})]})}import{useState as yl}from"react";import{Box as Wt,Button as zx,Dialog as rD,IconButton as di,Switch as aD,TextField as iD,Tooltip as wd}from"@mui/material";import{DndContext as lD,PointerSensor as sD,closestCenter as cD,useSensor as mD,useSensors as uD}from"@dnd-kit/core";import{restrictToParentElement as dD,restrictToVerticalAxis as pD}from"@dnd-kit/modifiers";import{SortableContext as fD,arrayMove as gD,useSortable as xD,verticalListSortingStrategy as bD}from"@dnd-kit/sortable";import{CSS as hD}from"@dnd-kit/utilities";import Nx from"@mui/icons-material/Close";import kD from"@mui/icons-material/AddCircle";import Fx from"@mui/icons-material/AddTask";import TD from"@mui/icons-material/Checklist";import yD from"@mui/icons-material/CheckCircle";import CD from"@mui/icons-material/DragIndicator";import SD from"@mui/icons-material/Launch";import vD from"@mui/icons-material/LinkOutlined";import BD from"@mui/icons-material/RadioButtonUnchecked";import{useMemo as Yw}from"react";import{Box as Xn,Button as Xw,Tab as Qw,Tabs as Jw}from"@mui/material";import{FormDialog as Zw}from"@ehfuse/mui-form-dialog";import{ClearTextField as eD}from"@ehfuse/mui-form-controls";import tD from"@mui/icons-material/CheckCircle";import oD from"@mui/icons-material/RadioButtonUnchecked";import{OverlayScrollbar as nD}from"@ehfuse/overlay-scrollbar";import{useRef as Kw}from"react";import{useGlobalForm as Uw,useModal as Gw}from"@ehfuse/forma";import{ErrorAlert as jw}from"@ehfuse/alerts";var Ax={type:"related",search:"",selectedSeqs:[]};function Tl(e){L();let t=Kw(e);t.current=e;let o={link:Gw({modalId:Ie("taskbox-task-link")})},a=Uw({formId:Ie("taskbox-task-link-form"),initialValues:Ax,onValidate:l=>l.selectedSeqs.length===0?(jw(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({...Ax,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 Sc}from"react/jsx-runtime";var qx=[{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 vc({controller:e,task:t,tasks:o,excludeSeqs:a=[],hideRelationType:r=!1,title:i=n("link.title"),confirmLabel:l=n("link.confirm")}){L();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=Yw(()=>{let h=new Set([t.seq,...a]),E=d.trim().toLowerCase();return o.filter(b=>h.has(b.seq)||b.is_event||b.is_notice||b.linked_only?!1:E?b.title.toLowerCase().includes(E)||(b.ticket_no??"").toLowerCase().includes(E):!0).sort((b,B)=>!!b.completed!=!!B.completed?b.completed?1:-1:B.seq-b.seq)},[o,t.seq,a,d]),g=qx.find(h=>h.type===m)?.hint??"",x=Sc(Xn,{sx:{display:"flex",flexDirection:"column",minHeight:0,height:s?"100%":"auto"},children:[r?null:xo(Jw,{value:m,onChange:(h,E)=>c.setFormValue("type",E),sx:{minHeight:38,flexShrink:0,borderBottom:`1px solid ${ee}`,"& .MuiTab-root":{minHeight:38,py:.5,fontSize:16,color:"#333333"}},children:qx.map(h=>xo(Qw,{value:h.type,label:h.label},h.type))}),r?null:xo(Xn,{sx:{mt:1,mb:1.5,fontSize:14,flexShrink:0},children:g}),Sc(Xn,{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(Xn,{sx:{px:1.5,py:1,borderBottom:"1px solid #cccccc",flexShrink:0},children:xo(eD,{placeholder:n("link.searchPlaceholder"),name:"search",form:c,fullWidth:!0,autoFocus:!0,size:"small",sx:{"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiInputBase-root":{px:0}}})}),xo(Xn,{sx:{flex:1,minHeight:0},children:xo(nD,{style:{height:"100%"},contentStyle:{paddingTop:0},children:xo(Xn,{sx:{display:"flex",flexDirection:"column"},children:f.length===0?xo(Xn,{sx:{py:4,textAlign:"center",fontSize:13.5,color:"#9a9a97"},children:n("link.empty")}):f.map(h=>{let E=h.is_notice||h.is_event?Le(h.icon||(h.is_notice?Dt:Nt)):null,b=p.includes(h.seq);return Sc(Xn,{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 ${ee}`,"&:last-of-type":{borderBottom:"none"},bgcolor:b?"#e3eefb":"transparent","&:hover":{bgcolor:b?"#e3eefb":"#f7f7f5"}},children:[b?xo(tD,{sx:{fontSize:20,flexShrink:0,color:"#2f6fd0"}}):xo(oD,{sx:{fontSize:20,flexShrink:0,color:"#c9c8c5"}}),E?xo(E,{sx:{fontSize:17,flexShrink:0,color:h.icon_color||"#1e3a8a"}}):null,Sc(Xn,{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(Xn,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:xo(Ke,{option:Ft(h)})})]},h.seq)})})})})]})]});return xo(Zw,{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:Se(),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(Xw,{variant:"contained",disabled:p.length===0,onClick:()=>{c.submit()},children:l})}})}import{ConfirmActionPopper as _D}from"@ehfuse/mui-confirm-action";import{Fragment as DD,jsx as Be,jsxs as Qn}from"react/jsx-runtime";var Hx="taskbox.checklist.hideCompleted";function ID({id:e,children:t}){let{attributes:o,listeners:a,setNodeRef:r,transform:i,transition:l,isDragging:s}=xD({id:e});return Be(Wt,{ref:r,sx:{transform:hD.Transform.toString(i),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({handleProps:{...o,...a},dragging:s})})}function wD({sortable:e,sensors:t,rowIds:o,onDragEnd:a,compact:r,children:i}){let l=Be(Wt,{sx:{display:"flex",flexDirection:"column",mt:.5,pl:r?0:3.25},children:i});return e?Be(lD,{sensors:t,collisionDetection:cD,modifiers:[pD,dD],onDragEnd:a,children:Be(fD,{items:o,strategy:bD,children:l})}):l}function Bc({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}){L();let[h,E]=yl(""),b=Tl({multiSelect:!0,onSubmit:K=>{if(!f)return;let te=d?.find($=>$.seq===K);f(e,K,String(te?.title??"").trim())}}),[B,T]=yl(null),z=$e(),[k,_]=yl(null),[D,F]=yl(null),R=K=>{let te=K.task_seq?g?.(K.task_seq):void 0;return te?te.completed:K.checked},C=K=>{if(!K.task_seq||x<=0)return!1;let te=g?.(K.task_seq);return te?!jf(te,x):!1},y=K=>!!K.task_seq&&!!g&&!g?.(K.task_seq),I=t.filter(K=>!y(K)),S=I.filter(R).length,[M,w]=yl(()=>{try{return localStorage.getItem(Hx)==="1"}catch{return!1}}),q=K=>{w(K);try{localStorage.setItem(Hx,K?"1":"0")}catch{}},v=!!s&&!z&&!c,O=uD(mD(sD,{activationConstraint:{distance:5}})),j=(K,te)=>K.task_seq?`linked-${K.task_seq}`:`row-${te}`,V=t.map(j),Z=V.filter((K,te)=>{let $=t[te];return y($)?!1:!(M&&R($))}),ie=K=>{let{active:te,over:$}=K;if(!$||te.id===$.id)return;let G=V.indexOf(String(te.id)),ae=V.indexOf(String($.id));G<0||ae<0||s?.(e,gD(t,G,ae))},ue=()=>{h.trim()&&(o(e,h),E(""))};return Qn(qo,{icon:Be(TD,{sx:{fontSize:19,display:"block"}}),title:Qn(DD,{children:[n("section.todo"),t.length>0?Qn(Wt,{component:"span",sx:{fontSize:12.5,color:"#9a9a97"},children:[S," / ",t.length]}):null]}),titleExtra:I.length>0?Qn(Wt,{sx:{flex:1,minWidth:0,ml:1,display:"flex",alignItems:"center",gap:1},children:[Be(Wt,{sx:{flex:1,minWidth:0,height:6,borderRadius:3,bgcolor:"#ececea"},children:Be(Wt,{sx:{height:"100%",borderRadius:3,width:`${Math.round(S/I.length*100)}%`,bgcolor:"#2f80ed",transition:"width 0.2s"}})}),S>0?Qn(Wt,{component:"label",sx:{display:"inline-flex",alignItems:"center",gap:.25,flexShrink:0,cursor:"pointer",fontSize:13.5,fontWeight:400,color:"#57564f",userSelect:"none"},children:[Be(aD,{size:"small",checked:M,onChange:(K,te)=>q(te)}),n("section.hideDone")]}):null]}):null,children:[Be(wD,{sortable:v,sensors:O,rowIds:Z,onDragEnd:ie,compact:z,children:t.map((K,te)=>{let $=K.task_seq?g?.(K.task_seq):void 0,G=R(K);if(M&&G||y(K))return null;let ae=!!K.task_seq,Re=C(K),mt=ce=>Qn(Wt,{sx:{display:"flex",alignItems:z?"flex-start":"center",gap:1,px:1.25,...v?{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:[ce?Be(Wt,{className:"taskbox-checklist-handle",...ce,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:Be(CD,{sx:{fontSize:16}})}):null,Be(wd,{title:Re?n("section.toggleLocked"):"",arrow:!0,disableInteractive:!0,children:Be(Wt,{component:"span",onClick:Re?void 0:Q=>r?F({anchorEl:Q.currentTarget,index:te,checked:!G}):a(e,te,!G),sx:{display:"inline-flex",flexShrink:0,cursor:Re?"default":"pointer",...z?{mt:"1px"}:{}},children:G?Be(yD,{sx:{fontSize:18,color:Re?"#a9c6ec":"#2f80ed"}}):Be(BD,{sx:{fontSize:18,color:Re?"#d6d5d1":"#9a9a97"}})})}),B?.index===te?Be(Wt,{component:"input",autoFocus:!0,spellCheck:!1,value:B.label,enterKeyHint:"done",onChange:Q=>T({index:te,label:Q.target.value}),onBlur:()=>{B.label.trim()&&B.label.trim()!==K.label&&l?.(e,te,B.label),T(null)},onKeyDown:Q=>{Q.key==="Enter"&&Q.target.blur(),Q.key==="Escape"&&T(null)},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",p:0}}):Be(Wt,{component:"span",onClick:ae?K.task_seq&&m?()=>m(K.task_seq):void 0:c||!l?void 0:z?()=>_({index:te,label:K.label}):()=>T({index:te,label:K.label}),sx:{flex:1,minWidth:0,fontSize:14.5,color:"#37352f",textDecoration:G?"line-through":"none",overflow:"hidden",textOverflow:"ellipsis",...z?{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,lineHeight:1.4,wordBreak:"break-word"}:{whiteSpace:"nowrap"},...ae?m?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}:c||!l?{}:{cursor:"text"}},children:K.label}),ae?Qn(Wt,{component:"span",onClick:K.task_seq&&m?()=>m(K.task_seq):void 0,sx:{display:"inline-flex",alignItems:"center",gap:.4,flexShrink:0,...z?{mt:"1px"}:{},px:.75,py:.2,borderRadius:1,fontSize:12,fontWeight:500,color:"#1d4f91",bgcolor:"#e3eefb",whiteSpace:"nowrap",...m?{cursor:"pointer"}:{}},children:[Be(SD,{sx:{fontSize:12}}),$?.manager_name?.trim()||n("template.task")]}):null,!c&&!ae&&u?Be(wd,{title:n("section.makeTask"),arrow:!0,enterDelay:300,disableInteractive:!0,children:Be(di,{className:"taskbox-checklist-convert",size:"small","aria-label":n("section.makeTask"),onClick:()=>u(e,te,K.label),sx:{display:z?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:Be(Fx,{sx:{fontSize:16}})})}):null,c?null:Be(di,{className:"taskbox-checklist-remove",size:"small","aria-label":n("section.deleteTodo"),onClick:()=>i(e,te),sx:{display:z?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:Be(Nx,{sx:{fontSize:15}})})]});return v?Be(ID,{id:V[te],children:({handleProps:ce})=>mt(ce)},V[te]):Be(Wt,{children:mt(null)},V[te])})}),Qn(Wt,{sx:{mt:.5,ml:z?0:3.25,display:"flex",alignItems:"center",gap:.5},children:[Be(Wt,{component:"input",spellCheck:!1,value:h,placeholder:n("section.addTodoPlaceholder"),enterKeyHint:"done",onChange:K=>E(K.target.value),onKeyDown:K=>{K.key==="Enter"&&ue()},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?Be(wd,{title:n("section.attachExisting"),arrow:!0,children:Be(di,{size:"small","aria-label":n("section.attachExisting"),onMouseDown:K=>K.preventDefault(),onClick:b.openDialog,sx:{flexShrink:0,color:"#9a9a97"},children:Be(vD,{sx:{fontSize:20}})})}):null,Be(di,{size:"small","aria-label":n("section.addTodo"),disabled:!h.trim(),onMouseDown:K=>K.preventDefault(),onClick:ue,sx:{flexShrink:0,color:h.trim()?"#2f80ed":"#c9c8c5"},children:Be(kD,{sx:{fontSize:20}})})]}),d&&p&&f?Be(vc,{controller:b,task:p,tasks:d,excludeSeqs:t.map(K=>Number(K.task_seq??0)).filter(K=>K>0),hideRelationType:!0,title:n("section.attachExisting"),confirmLabel:n("section.attach")}):null,Be(_D,{open:!!D,anchorEl:D?.anchorEl??null,title:D?.checked?n("calendar.checklistCompleteConfirm"):n("task.uncompleteConfirm"),confirmText:D?.checked?n("common.done"):n("task.unmark"),onCancel:()=>F(null),onConfirm:()=>{D&&a(e,D.index,D.checked),F(null)}}),Be(rD,{open:!!k,onClose:()=>_(null),maxWidth:"xs",fullWidth:!0,slotProps:{paper:{sx:{borderRadius:2,m:2}}},children:Qn(Wt,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5},children:[Be(Wt,{sx:{fontSize:15.5,fontWeight:600,color:"#37352f"},children:n("section.editTodo")}),Be(iD,{autoFocus:!0,fullWidth:!0,size:"medium",value:k?.label??"",onChange:K=>_(te=>te&&{...te,label:K.target.value}),onKeyDown:K=>{if(K.key!=="Enter")return;let te=k;te&&te.label.trim()&&l?.(e,te.index,te.label.trim()),_(null)}}),Qn(Wt,{sx:{display:"flex",alignItems:"center",gap:1},children:[!c&&u&&k&&!t[k.index]?.task_seq?Be(di,{"aria-label":n("section.makeTask"),onClick:()=>{u(e,k.index,t[k.index]?.label??""),_(null)},sx:{color:"#57564f"},children:Be(Fx,{sx:{fontSize:20}})}):null,!c&&k?Be(di,{"aria-label":n("section.deleteTodo"),onClick:()=>{i(e,k.index),_(null)},sx:{color:"#e5484d"},children:Be(Nx,{sx:{fontSize:19}})}):null,Be(Wt,{sx:{flex:1}}),Be(zx,{color:"inherit",onClick:()=>_(null),children:n("common.cancel")}),Be(zx,{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 LD,useState as AD}from"react";import{Box as Yo,IconButton as qD}from"@mui/material";import{DndContext as zD,PointerSensor as ND,closestCenter as FD,useSensor as HD,useSensors as WD}from"@dnd-kit/core";import{restrictToParentElement as $D,restrictToVerticalAxis as VD}from"@dnd-kit/modifiers";import{SortableContext as KD,useSortable as UD,verticalListSortingStrategy as GD}from"@dnd-kit/sortable";import{CSS as jD}from"@dnd-kit/utilities";import YD from"@mui/icons-material/DragIndicator";import XD from"@mui/icons-material/Close";import QD from"@mui/icons-material/AttachFileOutlined";import{FileTypeIcon as JD}from"@ehfuse/file-viewer/icons";var ED=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"]),_c=e=>{let t=e?.split(".").pop()?.toLowerCase()??"";return ED.has(t)};import{LinearProgress as RD}from"@mui/material";import{Fragment as PD,jsx as MD,jsxs as OD}from"react/jsx-runtime";function Wx(e){let t=yn(),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 Dd(){let t=yn().useValue("attachmentUpload.progress");return OD(PD,{children:[t??0,"%"]})}function $x(){let t=yn().useValue("attachmentUpload.progress");return MD(RD,{variant:"determinate",value:t??0,sx:{height:4,borderRadius:2,bgcolor:"#dbe9fb",mt:.75}})}import{Fragment as Vx,jsx as Ct,jsxs as Sl}from"react/jsx-runtime";function ZD({id:e,children:t}){let{attributes:o,listeners:a,setNodeRef:r,transform:i,transition:l,isDragging:s}=UD({id:e});return Ct(Yo,{ref:r,sx:{transform:jD.Transform.toString(i),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({...o,...a})})}function Cl(e){return e>=1048576?`${(e/1048576).toFixed(1)}MB`:`${Math.max(1,Math.round(e/1024))}KB`}var Ic={flex:1,minWidth:0,fontSize:13.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function wc({taskSeq:e,attachments:t,onAdd:o,onRemove:a,removeLocked:r=!1,onPreview:i,onDownload:l,onReorder:s}){L();let[c,u]=AD(!1),m=LD(null),d=$e(),p=Ui(),f=Ki(),g=Wx(e),x=e===0,h=!!s&&!x&&!d&&!r&&!g&&t.length>1,E=WD(HD(ND,{activationConstraint:{distance:5}})),b=(R,C)=>R.uuid?`file-${R.uuid}`:`file-${C}`,B=t.map(b),T=R=>{let{active:C,over:y}=R;if(!y||C.id===y.id)return;let I=B.indexOf(String(C.id)),S=B.indexOf(String(y.id));I<0||S<0||s?.(e,I,S)},z=R=>{if(i){i(R);return}window.open(f(R.uuid??""),"_blank","noopener,noreferrer")},k=R=>{if(l){l(R);return}window.open(f(R.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},_=R=>g?R+1<g.index?"done":R+1===g.index?"uploading":"waiting":"waiting",D=(R,C,y,I,S={})=>Sl(Yo,{sx:{px:1,py:.5,borderRadius:1,border:"1px solid",borderColor:S.uploading?"#d5e6fb":ee,bgcolor:S.uploading?"#f4f9ff":"transparent","&:hover .taskbox-file-remove":{opacity:1},"&:hover .taskbox-file-handle":{opacity:1}},children:[Sl(Yo,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[S.handleProps?Ct(Yo,{className:"taskbox-file-handle","aria-label":n("section.reorder"),...S.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:Ct(YD,{sx:{fontSize:16}})}):null,Ct(Yo,{component:"span",sx:{display:"inline-flex",flexShrink:0},children:Ct(JD,{fileName:C,size:18})}),y,Ct(Yo,{component:"span",sx:{fontSize:12,color:S.uploading?"#2f80ed":"#9a9a97",flexShrink:0},children:I}),S.removeIndex!==void 0?Ct(qD,{className:"taskbox-file-remove",size:"small","aria-label":n("section.deleteAttachment"),onClick:()=>a(e,S.removeIndex),sx:{opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:Ct(XD,{sx:{fontSize:15}})}):null]}),S.uploading?Ct($x,{}):null]},R),F=R=>{let C=_c(R.name);return Ct(Yo,{component:"button",type:"button",onClick:()=>C?z(R):k(R),title:n("section.fileAction",{name:R.name,value:C?n("section.preview"):n("section.download")}),sx:{...Ic,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:R.name})};return Sl(qo,{icon:Ct(QD,{sx:{fontSize:18,display:"block"}}),title:Sl(Vx,{children:[n("section.files")," ",t.length>0?t.length:""]}),children:[Ct(eE,{sortable:h,sensors:E,rowIds:B,onDragEnd:T,children:Sl(Yo,{sx:{display:"flex",flexDirection:"column",gap:.5,mt:1},children:[t.map((R,C)=>{let y=`${R.uuid||R.name}-${C}`;if(x){let I=_(C),S=I==="uploading";return D(y,R.name,Ct(Yo,{component:"span",sx:{...Ic,color:I==="done"?"#37352f":"#9a9a97"},children:R.name}),S?Ct(Dd,{}):Cl(R.size),{uploading:S,removeIndex:!r&&!g?C:void 0})}return R.uuid?h?Ct(ZD,{id:b(R,C),children:I=>D(y,R.name,F(R),Cl(R.size),{removeIndex:r?void 0:C,handleProps:I})},b(R,C)):D(y,R.name,F(R),Cl(R.size),{removeIndex:r?void 0:C}):D(y,R.name,Ct(Yo,{component:"span",title:n("section.legacyAttachment"),sx:{...Ic,color:"#9a9a97"},children:R.name}),Cl(R.size),{removeIndex:r?void 0:C})}),!x&&g?g.queue.slice(g.index-1).map((R,C)=>{let y=C===0;return D(`uploading-${g.index+C}-${R.name}`,R.name,Ct(Yo,{component:"span",sx:{...Ic,color:"#9a9a97"},children:R.name}),y?Ct(Dd,{}):Cl(R.size),{uploading:y})}):null]})}),Ct(Yo,{onClick:()=>m.current?.click(),onDragOver:R=>{R.preventDefault(),u(!0)},onDragLeave:()=>u(!1),onDrop:R=>{R.preventDefault(),u(!1);let C=Array.from(R.dataTransfer.files);C.length>0&&o(e,C)},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})}),Ct(Yo,{component:"input",ref:m,type:"file",multiple:!0,onChange:R=>{let C=Array.from(R.target.files??[]);C.length>0&&o(e,C),R.target.value=""},sx:{display:"none"}})]})}function eE({sortable:e,sensors:t,rowIds:o,onDragEnd:a,children:r}){return e?Ct(zD,{sensors:t,collisionDetection:FD,modifiers:[VD,$D],onDragEnd:a,children:Ct(KD,{items:o,strategy:GD,children:r})}):Ct(Vx,{children:r})}import{useState as lE}from"react";import{Checkbox as sE,Divider as cE,ListItemIcon as mE,Menu as uE,MenuItem as jx}from"@mui/material";import dE from"@mui/icons-material/Add";import{Box as Ed,Button as nE}from"@mui/material";import{FormDialog as rE}from"@ehfuse/mui-form-dialog";import{ClearTextField as aE}from"@ehfuse/mui-form-controls";import{ColorPicker as iE}from"@ehfuse/mui-color-picker";import{useGlobalForm as tE}from"@ehfuse/forma";import{ErrorAlert as oE}from"@ehfuse/alerts";var Kx="#2f80ed";function Ux({open:e,onClose:t,onSubmit:o}){L();let a=tE({formId:Ie("taskbox-add-label-form"),initialValues:{name:"",color:Kx},onValidate:i=>String(i.name??"").trim()?!0:(oE(n("dialog.enterLabelName")),!1),onSubmit:i=>(o(String(i.name).trim(),i.color),r.form.close(),!0)}),r={form:ro({modalIdPrefix:"taskbox-add-label-dialog",open:e,onClose:t,onOpen:()=>a.setFormValues({name:"",color:Kx})})};return{form:a,modals:r}}import{jsx as vl,jsxs as Rd}from"react/jsx-runtime";function Gx({open:e,onClose:t,onSubmit:o}){L();let{form:a,modals:r}=Ux({open:e,onClose:t,onSubmit:o}),i=String(a.useFormValue("name")??""),l=String(a.useFormValue("color")??""),s=If(l),c=Rd(Ed,{children:[Rd(Ed,{sx:{display:"flex",alignItems:"center",gap:1.5,mt:.5},children:[vl(aE,{form:a,name:"name",label:n("dialog.labelName"),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),a.submit())},fullWidth:!0,autoFocus:!0}),vl(iE,{value:l,onChange:u=>a.setFormValue("color",u),shape:"circle",colorSize:28})]}),Rd(Ed,{sx:{mt:2,display:"flex",alignItems:"center",gap:1,fontSize:13,color:"#787774"},children:[n("dialog.preview"),vl(Ke,{option:{key:"__preview__",name:i.trim()||n("dialog.label"),...s}})]})]});return vl(rE,{open:r.form.isOpen,onClose:r.form.close,maxWidth:"xs",title:n("dialog.addLabelTitle"),locale:Se(),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:vl(nE,{variant:"contained",onClick:()=>{a.submit()},children:n("common.add")})}})}import{Fragment as pE,jsx as pi,jsxs as Dc}from"react/jsx-runtime";function Ec({anchorEl:e,selectedKeys:t,labelOptions:o,onToggle:a,onAddLabel:r,onClose:i}){L();let[l,s]=lE(!1),c=Fn();return Dc(pE,{children:[Dc(uE,{anchorEl:e,open:!!e,onClose:i,transitionDuration:0,...c,children:[o.map(u=>{let m=t.includes(u.key);return Dc(jx,{onClick:()=>a(u.key),sx:{fontSize:14,minWidth:170,gap:1},children:[pi(sE,{size:"small",checked:m,sx:{p:0}}),pi(Ke,{option:u})]},u.key)}),pi(cE,{}),Dc(jx,{onClick:()=>s(!0),sx:{fontSize:14,color:"#787774"},children:[pi(mE,{children:pi(dE,{sx:{fontSize:18,color:"#787774"}})}),n("menu.addLabel")]})]}),pi(Gx,{open:l,onClose:()=>s(!1),onSubmit:r})]})}function Yx(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 Xx(e,t){let o=(e.target_account_seqs??[]).filter(d=>d>0);if(o.length===0)return null;let a=new Set(o),r=Yx(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 Rc(e,t){let o=Xx(e,t);return o?[...o.teamNames,...o.individualNames].join(", "):n("col.allEmployees")}function UU(e,t){let o=Xx(e,t);return o?{kind:"members",teamNames:o.teamNames,individualNames:o.individualNames}:{kind:"everyone"}}function Qx(e,t,o){let a=(e.target_account_seqs??[]).filter(f=>f>0),r=Yx(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 OE}from"@ehfuse/mui-datetime-picker";import{useState as fE}from"react";import{Box as Pa,IconButton as gE,Popover as xE}from"@mui/material";import bE from"@mui/icons-material/InfoOutlined";import hE from"@mui/icons-material/LockOutlined";import kE from"@mui/icons-material/PublicOutlined";import TE from"@mui/icons-material/Group";import{jsx as Xo,jsxs as Oa}from"react/jsx-runtime";var yE=[{key:"all",icon:Xo(kE,{sx:{fontSize:17,color:"#2f80ed"}}),label:"create.visibilityPublic",who:"create.visibilityInfoAll"},{key:"group",icon:Xo(TE,{sx:{fontSize:17,color:"#d9730d"}}),label:"create.visibilityDeptShort",who:"create.visibilityInfoGroup"},{key:"involved",icon:Xo(hE,{sx:{fontSize:17}}),label:"create.visibilityPrivate",who:"create.visibilityInfoPrivate"}];function Pc(){let[e,t]=fE(null),{colors:o}=be(),a=String(_a.labelColor??"#787774");return Oa(Pa,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.25},children:[n("create.visibility"),Xo(gE,{size:"small","aria-label":n("create.visibilityInfo"),onClick:r=>{r.stopPropagation(),t(r.currentTarget)},sx:{p:.25,color:a},children:Xo(bE,{sx:{fontSize:16}})}),Oa(xE,{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:[Oa(Pa,{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:[Xo(Pa,{component:"strong",sx:{fontWeight:700,color:o.accentOnSurface},children:n("create.visibilityInfoNoteStrong")})," ",n("create.visibilityInfoNote")]}),Xo(Pa,{sx:{border:`1px solid ${o.border}`,borderRadius:1.5,overflow:"hidden"},children:Oa(Pa,{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:[Xo("thead",{children:Oa("tr",{children:[Xo("th",{children:n("create.visibilityInfoColScope")}),Xo("th",{children:n("create.visibilityInfoColWho")})]})}),Xo("tbody",{children:yE.map(r=>Oa("tr",{children:[Xo(Pa,{component:"td",sx:{whiteSpace:"nowrap"},children:Oa(Pa,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[r.icon,n(r.label)]})}),Xo("td",{children:n(r.who)})]},r.key))})]})})]})]})}import{Fragment as Ma,jsx as fe,jsxs as En}from"react/jsx-runtime";var ob="taskbox:create-expanded";function ME(){try{return window.localStorage.getItem(ob)==="1"}catch{return!1}}function Md({form:e,statusOptions:t,customTabs:o,sprints:a=[],avatarSrcByName:r,isNotice:i=!1,hideProject:l=!1,hideBug:s=!1,hideTypeToggle:c=!1,leadingRow:u,afterProject:m,extraRows:d,hideLabel:p=!1,simple:f=!1,hideMembers:g=!1,templateItem:x=!1,postMode:h=!1,employees:E=[],workspaceName:b="",workspaceSlot:B,myAccountSeq:T=0,departments:z=[],myGroupSeq:k=0,onMemberEdit:_,onAddProject:D,onAddLabelOption:F,contentSyncKey:R="create",contentTemplates:C,contentTitleExtra:y,onSaveContentTemplate:I,onRemoveContentTemplate:S}){L();let M=yn(),w=Ui(),q=e.useFormValue("manager_name"),v=e.useFormValue("receiver_names"),O=e.useFormValue("start_date"),j=!!e.useFormValue("is_event"),V=!!e.useFormValue("is_bug"),Z=e.useFormValue("bug_repro")??"",ie=e.useFormValue("bug_device")??"",ue=e.useFormValue("bug_where")??"",K=e.useFormValue("bug_version")??"",te=e.useFormValue("event_time")??"",$=e.useFormValue("event_place")??"",G=e.useFormValue("event_address")??"",ae=e.useFormValue("due_date"),Re=e.useFormValue("reminders")??[],mt=e.useFormValue("priority"),ce=e.useFormValue("content"),Q=e.useFormValue("note")??"",X=e.useFormValue("checklist")??[],le=e.useFormValue("tab_key"),pe=e.useFormValue("sprint_seq")??0,De=e.useFormValue("story_points")??0,ve=o.find(P=>P.key===le&&P.useSprints),It=ve?a.filter(P=>`custom-${P.group_seq}`===le):[],[We,Ee]=fi(null),ut=e.useFormValue("label_keys"),[je,co]=fi(null),kt=e.useFormValue("visibility")||"involved",oe=Number(e.useFormValue("visibility_group_seq")??0),[_e,Ze]=fi(null),ze=e.useFormValue("repeat_rule")||"",tn=e.useFormValue("repeat_until")||"",[qr,mo]=fi(null),[or,bn]=fi(null),nr=e.useFormValue("target_names"),Kt=e.useFormValue("target_account_seqs"),Yt=M.useValue("createAttachmentFiles")??[],rr=i?Rc({author_account_seq:T,target_names:nr,target_account_seqs:Kt},E):"",[dt,Po]=fi(ME),kn=f&&!j&&!i&&!h,rt=kn&&!dt,Ln=()=>{let P=!dt;Po(P);try{window.localStorage.setItem(ob,P?"1":"0")}catch{}},Oe=!h,U=g?1:2;return En(Ma,{children:[u,!i&&!c?En(vr,{sx:{display:"flex",gap:1.25,px:2,pt:1.5,pb:1.5,flexShrink:0},children:[B?fe(vr,{sx:{alignSelf:"center",mr:"6px",minWidth:0,display:"flex"},children:B}):b?fe(vr,{sx:{alignSelf:"center",fontSize:13.5,fontWeight:600,color:"#37352f",mr:"6px",maxWidth:160,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:b,children:b}):null,[{value:"task",label:n("kind.task")},{value:"event",label:n("kind.event")},...s?[]:[{value:"bug",label:n("kind.bug")}]].map(P=>{let xe=(V?"bug":j?"event":"task")===P.value;return fe(Jx,{onClick:()=>Gm(e,P.value),sx:{px:1.75,lineHeight:1,pt:"8px",pb:"10px",borderRadius:99,fontSize:13.5,fontWeight:xe?600:400,color:xe?"#ffffff":"#787774",bgcolor:xe?"#2563eb":"#f4f4f2"},children:P.label},P.label)})]}):null,fe(Bl,{sx:{borderColor:ee}}),En(vr,{sx:{pt:1.5,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[fe(xc,{afterProject:m,hideProject:l||rt&&!le,hideManager:g||h||rt&&!q,hideReceivers:x||g||h&&kt==="all"||rt&&v.length===0,hideStartDate:rt||h,hideReminder:x||h||rt&&Re.length===0,hidePriority:h,hideDueDate:h||!j&&!!ze,values:{tabKey:le,managerName:q,receiverNames:v,startDate:O,dueDate:ae,reminders:Re,priority:mt,eventTime:te,eventPlace:$,eventAddress:G},customTabs:o,avatarSrcByName:r,notice:i,event:j,onChangeEventTime:P=>e.setFormValue("event_time",P),onChangeEventPlace:P=>e.setFormValue("event_place",P),onChangeEventAddress:P=>e.setFormValue("event_address",P),targetSummary:rr,onChangeProject:P=>e.setFormValue("tab_key",P),onAddProject:D,onChangeStartDate:P=>e.setFormValue("start_date",P),onClearStartDate:()=>e.setFormValue("start_date",""),onChangeDueDate:P=>e.setFormValue("due_date",P),onChangeReminder:P=>e.setFormValue("reminders",P),onChangePriority:P=>e.setFormValue("priority",P),onMemberEdit:_,pinColumns:Oe,beforeStart:En(Ma,{children:[!x&&!V&&!h&&!(rt&&!ze)?fe(Te,{icon:fe(DE,{sx:{fontSize:17,...ze?{color:"#2f80ed"}:{}}}),label:n("create.repeat"),onClick:P=>mo(P),sx:j||!Oe?void 0:st(U),children:ze?hs(ze):fe(vr,{component:"span",sx:{color:"#9a9a97"},children:n("common.none")})}):null,!x&&!V&&!h&&ze?fe(Te,{icon:fe(EE,{sx:{fontSize:17}}),label:n("create.repeatUntil"),onClick:P=>bn(P),sx:j||!Oe?void 0:st(U),children:tn?Vo(tn):fe(vr,{component:"span",sx:{color:"#9a9a97"},children:n("create.auto")})}):null]}),trailing:En(Ma,{children:[!i&&!g&&!(rt&&kt==="involved")?fe(Te,{icon:kt==="all"?fe(eb,{sx:{fontSize:17,color:"#2f80ed"}}):kt==="group"?fe(tb,{sx:{fontSize:17,color:"#d9730d"}}):fe(Zx,{sx:{fontSize:17}}),label:fe(Pc,{}),onClick:P=>Ze(P),sx:j||!Oe?void 0:st(1),children:kt==="all"?n("create.visibilityPublic"):kt==="group"?n("create.visibilityDept",{value:z.find(P=>P.seq===oe)?.name??n("create.department")}):n("create.visibilityPrivate")}):null,ve&&!j&&!i&&!h&&!(rt&&pe===0&&De===0)?En(Ma,{children:[fe(Te,{icon:fe(wE,{sx:{fontSize:17}}),label:n("col.goal"),onClick:P=>Ee(P),sx:Oe?st(1):void 0,children:pe>0?It.find(P=>P.seq===pe)?.name??n("create.deletedGoal"):fe(vr,{component:"span",sx:{color:"#9a9a97"},children:n("board.unassigned")})}),fe(Te,{icon:fe(RE,{sx:{fontSize:17}}),label:"\uD3EC\uC778\uD2B8",sx:Oe?st(1):void 0,children:fe(Cr,{value:De>0?String(De):"",placeholder:n("create.notEstimated"),onCommit:P=>e.setFormValue("story_points",Number(P.replace(/[^0-9.]/g,""))||0)})})]}):null,V?fe(bc,{values:{repro:Z,device:ie,where:ue,version:K},onChangeRepro:P=>e.setFormValue("bug_repro",P),onChangeDevice:P=>e.setFormValue("bug_device",P),onChangeWhere:P=>e.setFormValue("bug_where",P),onChangeVersion:P=>e.setFormValue("bug_version",P)}):null,!x&&!h&&!i?(d??[]).filter(P=>!(rt&&!P.filled)).map(P=>fe(Te,{icon:P.icon,label:P.label,onClick:P.onClick,sx:j||!Oe?void 0:st(U),children:P.value},P.key)):null]}),leading:j||p?null:fe(vr,{sx:{gridColumn:"1 / -1"},children:fe(Te,{icon:fe(IE,{sx:{fontSize:17}}),label:n("dialog.label"),onClick:P=>co(P),children:(ut??[]).length>0?fe($r,{labelKeys:ut??[],labelOptions:t}):fe(vr,{component:"span",sx:{color:"#9a9a97"},children:n("menu.empty")})})})}),kn?En(Jx,{onClick:Ln,"aria-expanded":dt,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:[dt?fe(CE,{sx:{fontSize:17}}):fe(SE,{sx:{fontSize:17}}),dt?n("create.collapseFields"):n("create.expandFields")]}):null,fe(Bl,{sx:{my:1.5,borderColor:ee}}),fe(qo,{icon:fe(BE,{sx:{fontSize:18,display:"block"}}),title:n("common.content"),titleExtra:y||C?En(Ma,{children:[y,C?fe(Cc,{content:ce,templates:C,onApply:P=>e.setFormValue("content",P),onSave:I,onRemove:S}):null]}):void 0,children:fe(kc,{syncKey:R,value:ce,onChange:P=>e.setFormValue("content",P)})}),V||h||rt&&!Q?null:En(Ma,{children:[fe(Bl,{sx:{my:1.5,borderColor:ee}}),fe(qo,{icon:fe(_E,{sx:{fontSize:18,display:"block"}}),title:n("col.note"),children:fe(PE,{form:e,name:"note",placeholder:n("create.notePlaceholder"),fullWidth:!0,size:"medium",sx:{mt:1}})})]}),j||h||rt&&X.length===0?null:fe(Bl,{sx:{my:1.5,borderColor:ee}}),j||h||rt&&X.length===0?null:fe(Bc,{taskSeq:0,checklist:X,onAdd:(P,me)=>Xm(e,me),onToggle:(P,me,xe)=>Qm(e,me,xe),onRemove:(P,me)=>Jm(e,me),onUpdate:(P,me,xe)=>Zm(e,me,xe)}),x?null:En(Ma,{children:[fe(Bl,{sx:{my:1.5,borderColor:ee}}),fe(wc,{taskSeq:0,attachments:Yt.map(P=>({name:P.name,size:P.size})),onAdd:(P,me)=>eu(M,me,w),onRemove:(P,me)=>tu(M,me)})]})]}),fe(Pd,{transitionDuration:0,anchorEl:We,open:!!We,onClose:()=>Ee(null),children:[{seq:0,label:n("board.unassigned")},...It.map(P=>({seq:P.seq,label:cn(P)}))].map(P=>fe(Od,{onClick:()=>{e.setFormValue("sprint_seq",P.seq),Ee(null)},sx:{fontSize:14,minWidth:170},children:P.label},P.seq))}),fe(Pd,{transitionDuration:0,anchorEl:qr,open:!!qr,onClose:()=>mo(null),children:[{value:"",label:n("common.none")},...Zi].map(P=>fe(Od,{selected:ze===P.value,onClick:()=>{mo(null),jm(e,P.value)},sx:{fontSize:14,minWidth:140},children:P.label},P.value||"none"))}),fe(OE,{anchorEl:or,open:!!or,onClose:()=>bn(null),selectedDate:tn?new Date(`${tn}T00:00:00`):new Date,onDateChange:P=>{Ym(e,P),bn(null)}}),fe(Pd,{transitionDuration:0,anchorEl:_e,open:!!_e,onClose:()=>Ze(null),children:[{key:"involved",label:n("create.visibilityPrivate"),tip:n("create.privateTip"),icon:fe(Zx,{sx:{fontSize:17,color:"#57564f"}}),selected:kt==="involved",onPick:()=>el(e,"involved")},{key:"all",label:n("create.visibilityPublic"),tip:n("create.publicTip"),icon:fe(eb,{sx:{fontSize:17,color:"#2f80ed"}}),selected:kt==="all",onPick:()=>el(e,"all")},...[...z].sort((P,me)=>P.seq===k?-1:me.seq===k?1:0).map(P=>({key:`group-${P.seq}`,label:n("create.visibilityDeptName",{name:P.name}),tip:n("create.deptTip",{name:P.name}),icon:fe(tb,{sx:{fontSize:17,color:"#d9730d"}}),selected:kt==="group"&&oe===P.seq,onPick:()=>el(e,"group",P.seq)}))].map(P=>fe(vE,{title:P.tip,arrow:!0,disableInteractive:!0,placement:"right",children:En(Od,{selected:P.selected,onClick:()=>{P.onPick(),h&&P.key==="all"&&(e.setFormValue("receiver_names",[]),e.setFormValue("receiver_account_seqs",[])),Ze(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[P.icon,P.label]})},P.key))}),fe(Ec,{anchorEl:je,selectedKeys:ut??[],labelOptions:t,onToggle:P=>e.setFormValue("label_keys",Is(ut??[],P)),onAddLabel:(P,me)=>F?.(P,me),onClose:()=>co(null)})]})}import{Fragment as ab,jsx as St,jsxs as _l}from"react/jsx-runtime";var VE={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 ib({open:e,onClose:t,desktopPresentation:o="drawer",submitLabel:a,...r}){L();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=yn(),h=AE(!1),[E,b]=nb(0),B=i.useFormValue("title"),T=i.useFormValue("icon"),z=i.useFormValue("icon_color"),k=!!i.useFormValue("is_event"),_=!!i.useFormValue("is_bug"),D=$e(),R=x.useValue("createSubmitting")??!1,C=f||k?Le(T||(f?Dt:Nt)):null,y=f?n("create.titleNotice"):k?n("create.titleEvent"):_?n("task.createBug"):n("task.createTask"),I=f?n("create.noticeTitlePlaceholder"):k?n("create.eventTitlePlaceholder"):_?n("create.bugTitlePlaceholder"):n("create.taskTitlePlaceholder");LE(()=>{let v=h.current;h.current=e,!(!e||v)&&(Um(i,x,{presetTitle:l,presetContent:s,presetVisibility:c,presetVisibilityGroupSeq:u,presetDueDate:m,presetTabKey:d,presetManager:p,isNotice:f,defaultBug:g}),b(O=>O+1))},[e]);let[S,M]=nb(null),w=v=>C?k?St(FE,{title:n("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:St(qE,{onClick:O=>M(O.currentTarget),sx:{display:"flex",p:.5,borderRadius:1,color:z||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:St(C,{sx:{fontSize:20}})})}):St(Br,{sx:[{display:"flex",color:z||"#1e3a8a"},v],children:St(C,{sx:{fontSize:20}})}):null,q=_l(Br,{sx:{display:"flex",alignItems:"center",gap:1,px:2,pt:2,pb:1},children:[w({p:0}),St(Br,{component:"input",autoFocus:!0,spellCheck:!1,value:B,placeholder:I,onChange:v=>i.setFormValue("title",v.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 D||o==="dialog"?St(ab,{children:St($E,{open:e,onClose:t,backdropClick:!1,locale:Se(),fontScale:D?{enabled:!0,default:1.1,min:.6}:{enabled:!0},title:y,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fullScreen:D,mobilePresentation:D?"slide":"dialog",maxWidth:"md",actions:{showCancelButton:!0,right:St(Ld,{variant:"contained",disableElevation:!0,disabled:R,onClick:R?void 0:i.submit,children:R?n("create.saving"):a??n("create.saveButton")})},dialogActionSx:D?VE: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:St(Br,{sx:{width:"100%",minWidth:0,display:"flex",flexDirection:"column",gap:0},children:St(Md,{...r,contentSyncKey:`create-${E}`,leadingRow:q})})}]})}):_l(ab,{children:[St(zE,{anchor:"right",open:e,onClose:(v,O)=>{O!=="backdropClick"&&t()},"aria-label":n("create.newTaskAria"),sx:{zIndex:v=>v.zIndex.modal},slotProps:{paper:{sx:{width:720,maxWidth:"100vw"}}},children:_l(Br,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[_l(Br,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.5,flexShrink:0},children:[w({px:.5}),St(Br,{component:"input",autoFocus:!0,spellCheck:!1,value:B,placeholder:I,onChange:v=>i.setFormValue("title",v.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}}}),St(NE,{"aria-label":n("common.close"),onClick:t,sx:{color:"#6b7280"},children:St(HE,{})})]}),St(rb,{sx:{borderColor:ee}}),St(Br,{sx:{flex:1,minHeight:0},children:St(WE,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:St(Md,{...r,contentSyncKey:`create-${E}`})})}),St(rb,{sx:{borderColor:ee}}),_l(Br,{sx:{display:"flex",justifyContent:"flex-end",gap:.5,px:2,py:1.5,flexShrink:0},children:[St(Ld,{onClick:t,color:"inherit",disabled:R,children:n("common.cancel")}),St(Ld,{onClick:i.submit,variant:"contained",disabled:R,children:R?n("create.creating"):a??n("common.register")})]})]})}),St(Kr,{anchorEl:S,value:T,color:z,onSelect:v=>{i.setFormValue("icon",v),M(null)},onSelectColor:v=>i.setFormValue("icon_color",v),onClose:()=>M(null)})]})}import{useEffect as th,useRef as oh,useState as nh}from"react";import{Box as jc,Button as xO,Divider as rh,Drawer as bO,IconButton as hO,ListItemIcon as mp,ListItemText as up,Menu as kO,MenuItem as dp}from"@mui/material";import TO from"@mui/icons-material/MoreVert";import yO from"@mui/icons-material/DeleteOutline";import CO from"@mui/icons-material/ShareOutlined";import SO from"@mui/icons-material/HistoryOutlined";import vO from"@ehfuse/overlay-scrollbar";import{FormDialog as BO}from"@ehfuse/mui-form-dialog";import{useRef as Nc,useState as _r}from"react";import{Box as ke,Button as Sb,Chip as Fc,IconButton as Qo,Popover as kR,Tooltip as Ib}from"@mui/material";import TR from"@mui/icons-material/ArrowUpwardRounded";import{TextField as yR}from"@ehfuse/mui-form-controls";import Hc from"@mui/icons-material/Close";import CR from"@mui/icons-material/EditOutlined";import vb from"@mui/icons-material/ContentCopyOutlined";import Bb from"@mui/icons-material/Check";import SR from"@mui/icons-material/Favorite";import vR from"@mui/icons-material/FavoriteBorderOutlined";import BR from"@mui/icons-material/CheckCircle";import _R from"@mui/icons-material/CheckCircleOutlineOutlined";import hi from"@mui/icons-material/AttachFileOutlined";import IR from"@mui/icons-material/AddCircleOutline";import wR from"@mui/icons-material/ImageOutlined";var Ad=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 Oc,useEffect as KE,useMemo as UE,useRef as lb,useState as qd}from"react";import{Box as Mc,Paper as GE,Popper as jE}from"@mui/material";import{jsx as La,jsxs as XE}from"react/jsx-runtime";var sb=8,YE=[{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 Il(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 zd(e,t){let o=se(),a=e??o.mentionCandidates??[],r=t??o.slashCommands,i=r===!0?YE:Array.isArray(r)?r:[];return{people:a,commands:i,enabled:a.length>0||i.length>0}}function Nd(e,t,o){if(!o)return[];let a=o.query.toLowerCase();return o.trigger==="@"?e.filter(r=>r.name.toLowerCase().includes(a)).slice(0,sb).map((r,i)=>({id:`p${i}-${r.name}`,text:`@${r.name} `,label:r.name,subtitle:r.subtitle,icon:La(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,sb).map(r=>({id:`c-${r.key}`,text:r.insert,label:`/${r.label}`,icon:La(Mc,{component:"span",sx:{width:24,textAlign:"center",fontSize:18,lineHeight:1},children:r.insert})}))}function Fd({open:e,anchor:t,items:o,active:a,onPick:r,onHover:i}){return La(jE,{open:e,anchorEl:t,placement:"top-start",sx:{zIndex:1500},children:La(GE,{elevation:4,sx:{minWidth:220,maxWidth:320,py:.5,borderRadius:1.5},children:o.map((l,s)=>XE(Mc,{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,La(Mc,{component:"span",sx:{fontWeight:500,whiteSpace:"nowrap"},children:l.label}),l.subtitle?La(Mc,{component:"span",sx:{color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.subtitle}):null]},l.id))})})}function cb({value:e,setValue:t,candidates:o,slashCommands:a}){let{people:r,commands:i,enabled:l}=zd(o,a),s=lb(null),[c,u]=qd(null),[m,d]=qd(null),[p,f]=qd(0),g=UE(()=>Nd(r,i,m),[i,r,m]),x=!!(c&&m&&g.length>0),h=Oc(()=>{let k=s.current;if(!l||!k)return;let _=k.selectionStart??k.value.length,D=r.length>0?Il(k.value,_,"@"):null,F=!D&&i.length>0?Il(k.value,_,"/"):null,R=D?{...D,trigger:"@"}:F?{...F,trigger:"/"}:null;d(R),f(0),u(R?k.closest(".MuiInputBase-root")??k:null)},[i.length,l,r.length]),E=lb(null);KE(()=>{let k=s.current,_=E.current;if(_!==null&&k){E.current=null,k.setSelectionRange(_,_);return}document.activeElement===k&&h()},[e,h]);let b=Oc(k=>{let _=s.current;if(!m||!_)return;let D=_.selectionStart??e.length,F=e.slice(0,m.start)+k.text+e.slice(D),R=m.start+k.text.length;E.current=F===e?null:R,t(F),d(null),u(null),requestAnimationFrame(()=>{E.current=null,_.focus(),_.setSelectionRange(R,R)})},[m,t,e]),B=Oc(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:Oc(k=>{s.current=k},[]),onKeyDown:B,onSelectionChange:h,popper:l?La(Fd,{open:x,anchor:c,items:g,active:p,onPick:b,onHover:f}):null}}import{useCallback as Hd,useEffect as QE,useRef as mb,useState as ub}from"react";import{Box as wl,Tab as JE,Tabs as ZE}from"@mui/material";import{jsx as gi,jsxs as oR}from"react/jsx-runtime";var db=[{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}"]}],eR="'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif",pb="taskbox.recentEmojis",fb=24;function gb(){try{let e=JSON.parse(window.localStorage.getItem(pb)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string").slice(0,fb):[]}catch{return[]}}function tR(e){let t=[e,...gb().filter(o=>o!==e)].slice(0,fb);try{window.localStorage.setItem(pb,JSON.stringify(t))}catch{}return t}function xb({onPick:e}){let[t,o]=ub(()=>gb()),[a,r]=ub(0),i=mb(null),l=mb(!1),s=t.length>0?[{key:"recent",labelKey:"section.emojiFrequent",items:t},...db]:db,c=Math.min(a,s.length-1),u=Hd(p=>{o(tR(p)),e(p)},[e]),m=Hd(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=Hd(()=>{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 QE(()=>{let p=i.current;p&&(p.scrollLeft=p.clientWidth*c)},[]),oR(wl,{children:[gi(ZE,{value:c,onChange:(p,f)=>m(f),variant:"scrollable",scrollButtons:!1,sx:{minHeight:36,borderBottom:`1px solid ${ee}`,"& .MuiTab-root":{minHeight:36,minWidth:0,px:1.5,fontSize:13}},children:s.map(p=>gi(JE,{label:n(p.labelKey)},p.key))}),gi(wl,{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(wl,{sx:{flex:"0 0 100%",width:"100%",height:"100%",overflowY:"auto",scrollSnapAlign:"start",scrollSnapStop:"always",p:1},children:gi(wl,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(40px, 1fr))"},children:p.items.map((f,g)=>gi(wl,{component:"button",type:"button",onClick:()=>u(f),"aria-label":f,sx:{border:0,bgcolor:"transparent",color:"#000",cursor:"pointer",fontFamily:eR,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 mR,useImperativeHandle as uR,useLayoutEffect as kb,useRef as Ac,useState as hb}from"react";import{Box as Ud}from"@mui/material";import{EhfuseEditor as dR}from"@ehfuse/editor";import{useCallback as Wd,useMemo as nR,useRef as rR,useState as $d}from"react";import{jsx as aR}from"react/jsx-runtime";function bb(e,t){let{people:o,commands:a,enabled:r}=zd(e,t),[i,l]=$d(null),[s,c]=$d(null),u=rR(""),[m,d]=$d(0),p=nR(()=>Nd(o,a,i),[a,o,i]),f=!!(r&&s&&i&&p.length>0),g=Wd(()=>{if(!r)return;let b=window.getSelection();if(!b||b.rangeCount===0||!b.isCollapsed)return void l(null);let B=b.anchorNode;if(!B||B.nodeType!==Node.TEXT_NODE||!B.parentElement?.closest(".ehfuse-editor-content"))return void l(null);let T=B.data,z=b.anchorOffset,k=o.length>0?Il(T,z,"@"):null,_=!k&&a.length>0?Il(T,z,"/"):null,D=k?{...k,trigger:"@"}:_?{..._,trigger:"/"}:null;if(!D){u.current="",l(null),c(null);return}l({node:B,start:D.start,end:z,query:D.query,trigger:D.trigger});let F=`${D.trigger}${D.query}`;F!==u.current&&d(0),u.current=F;let R=document.createRange();R.setStart(B,D.start),R.setEnd(B,Math.min(D.start+1,T.length));let C=R.getBoundingClientRect();c({getBoundingClientRect:()=>C})},[a.length,r,o.length]),x=Wd(b=>{if(!i)return;let{node:B,start:T,end:z}=i;if(!B.isConnected)return void l(null);let k=window.getSelection(),_=document.createRange();_.setStart(B,T),_.setEnd(B,Math.min(z,B.data.length)),k?.removeAllRanges(),k?.addRange(_),document.execCommand("insertText",!1,b.text),l(null),c(null)},[i]);return{handlers:{onKeyDownCapture:Wd(b=>{!f||b.nativeEvent.isComposing||(b.key==="ArrowDown"||b.key==="ArrowUp"?(b.preventDefault(),b.stopPropagation(),d(B=>(B+(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?aR(Fd,{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 iR=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"]),lR=new Set(["background-color","color","text-decoration"]);function Lc(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(!iR.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=>lR.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 Dl(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
 
9
- `).trim()}function xi(e){return gi(e)?wl(e):e}function Dl(e){let t=sR(Oc(e)).trim(),o=wl(t);return o.trim()?/<(?!\/?(p|br|span)(\s|>|\/))[a-z]/i.test(t)||/<span[^>]*style=/i.test(t)?t:o:""}var lR=new Set(["P","DIV","UL","OL","H1","H2","H3","H4","BLOCKQUOTE","PRE"]);function sR(e){if(typeof DOMParser>"u")return e;let t=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html"),o=t.body.firstElementChild;if(!o)return e;let a=null;for(let r of Array.from(o.childNodes)){if(r.nodeType===Node.ELEMENT_NODE&&lR.has(r.tagName)){a=null;continue}a||(a=t.createElement("p"),o.insertBefore(a,r)),a.appendChild(r)}for(let r of Array.from(o.querySelectorAll(":scope > p")))!r.textContent?.replace(/\u00a0/g," ").trim()&&!r.querySelector("br, img")&&r.remove();return o.innerHTML}function $d(e){let t=a=>a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return e.split(`
10
- `).map(a=>`<p>${a?t(a):"<br>"}</p>`).join("")}import{jsx as Kd,jsxs as pR}from"react/jsx-runtime";var dR={left:[["heading"],["bold","italic","strike","underline"],["link","bgcolor","code"],["bulletList","numberList"]],right:[]},Vd="<p><br></p>",Ac=cR(function({defaultHtml:t="",placeholder:o,alwaysExpanded:a=!1,autoFocus:r=!1,minHeight:i=44,maxHeight:l=280,onChange:s,onSubmit:c,onFiles:u,footer:m,variant:d="bare",mentionCandidates:p,slashCommands:f},g){let x=Lc(null),h=Lc(null),E=Lc(null),[b,B]=bb(!1),[T,z]=bb(()=>!!wl(t).trim()),k=xb(p,f),_=a||b||T;mR(g,()=>({getComment:()=>Dl(x.current?.getHtml()??""),clear:()=>{x.current?.setHtml(Vd),z(!1)},focus:()=>x.current?.focus(),insertText:F=>{let R=h.current?.querySelector(".ehfuse-editor-content");if(!R)return;R.focus();let C=window.getSelection(),y=E.current;if(!y||!R.contains(y.startContainer)){y=document.createRange();let I=R.lastElementChild??R;y.selectNodeContents(I),y.collapse(!1)}C?.removeAllRanges(),C?.addRange(y),document.execCommand("insertText",!1,F)}})),hb(()=>{if(!r)return;let F=requestAnimationFrame(()=>x.current?.focus());return()=>cancelAnimationFrame(F)},[r]);let D=F=>{let R=Array.from(F??[]);return R.length===0||!u?!1:(u(R),!0)};return pR(Ud,{...k.handlers,onKeyDownCapture:F=>{k.handlers.onKeyDownCapture(F),!F.defaultPrevented&&F.key==="Enter"&&(F.ctrlKey||F.metaKey)&&!F.nativeEvent.isComposing&&(F.preventDefault(),F.stopPropagation(),c?.())},onFocusCapture:()=>B(!0),ref:h,onBlurCapture:F=>{let R=window.getSelection();R&&R.rangeCount>0&&F.currentTarget.contains(R.anchorNode)&&(E.current=R.getRangeAt(0).cloneRange()),!F.currentTarget.contains(F.relatedTarget)&&(B(!1),Dl(x.current?.getHtml()??"")||(x.current?.setHtml(Vd),E.current=null))},onPasteCapture:F=>{D(F.clipboardData?.files)&&(F.preventDefault(),F.stopPropagation())},onDropCapture:F=>{D(F.dataTransfer?.files)&&(F.preventDefault(),F.stopPropagation())},sx:{position:"relative",bgcolor:"#ffffff",...d==="boxed"?{border:"1px solid",borderColor:b?"primary.main":"#dedddb",boxShadow:b?F=>`0 0 0 1px ${F.palette.primary.main}`:"none",borderRadius:"8px",transition:"border-color 120ms"}:{},"& .ehfuse-editor, & .ehfuse-editor-wrapper, & .ehfuse-editor-container":{border:"none !important",boxShadow:"none !important",borderRadius:0},"& .ehfuse-toolbar":{display:_?void 0:"none !important",background:"transparent",borderBottom:"1px solid #ececea"},"& .ehfuse-editor-content":{maxHeight:l,overflowY:"auto",fontSize:15,lineHeight:1.6},"& .ehfuse-editor-content > p:first-of-type":{mt:0},"& .ehfuse-editor-content > p:last-of-type":{mb:0},"& .ehfuse-editor-content.ehfuse-editor-empty::before":d==="boxed"?{top:"10px",left:"12px"}:{top:"12px",left:"16px"}},children:[Kd(uR,{ref:x,defaultValue:t||Vd,autoHeight:!0,showToolbar:!0,toolbarOptions:dR,locale:fa(),minHeight:_?Math.max(i,64):i,placeholder:o,contentStyle:{padding:d==="boxed"?"10px 12px":"12px 16px"},onChange:F=>{let R=Dl(F);z(!!R),s?.(R)}}),k.popper,m?Kd(Ud,{sx:{display:"flex",alignItems:"center",px:1,pb:.75},children:m}):null]})});function Gd({html:e}){let{openExternalUrl:t,mentionCandidates:o}=le(),a=Lc(null),r=Oc(e),i=(o??[]).map(l=>l.name).filter(l=>l.trim().length>=2);return hb(()=>{let l=a.current;if(!l)return;l.innerHTML=r;let s=[...new Set(i)].sort((p,f)=>f.length-p.length);if(s.length===0||!r.includes("@"))return;let c=p=>p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=new RegExp(`(^|[^A-Za-z0-9._%+-])(@(?:${s.map(c).join("|")}))`,"g"),m=document.createTreeWalker(l,NodeFilter.SHOW_TEXT),d=[];for(;m.nextNode();){let p=m.currentNode;p.data.includes("@")&&!p.parentElement?.closest("a, code")&&d.push(p)}for(let p of d){let f=p.data,g=document.createDocumentFragment(),x=0;for(let h of f.matchAll(u)){let E=(h.index??0)+h[1].length;E>x&&g.append(f.slice(x,E));let b=document.createElement("span");b.className="taskbox-mention",b.textContent=h[2],g.append(b),x=E+h[2].length}x!==0&&(x<f.length&&g.append(f.slice(x)),p.replaceWith(g))}},[r,i.join("|")]),Kd(Ud,{ref:a,onClickCapture:l=>{let s=l.target?.closest?.("a[href]");s&&(l.preventDefault(),l.stopPropagation(),t?t(s.href):window.open(s.href,"_blank","noopener,noreferrer"))},sx:{fontSize:15,lineHeight:1.6,wordBreak:"break-word","& p":{m:0},"& ul, & ol":{pl:"1.5em",my:.25},"& li > p":{m:0},"& h1, & h2, & h3, & h4":{fontSize:"1.05em",fontWeight:700,m:0},"& blockquote":{m:0,pl:1.5,borderLeft:"3px solid #dedddb",color:"text.secondary"},"& code":{fontFamily:"monospace",fontSize:"0.9em",bgcolor:"#f1f5f9",px:.5,borderRadius:.5},"& pre":{m:0,p:1,bgcolor:"#f1f5f9",borderRadius:1,overflowX:"auto"},"& a[href]":{color:"#2563eb",textDecoration:"none",cursor:"pointer","&:hover":{textDecoration:"underline"}},"& .taskbox-mention":{color:"#2563eb",fontWeight:600}}})}import{ConfirmActionPopper as wR}from"@ehfuse/mui-confirm-action";import{Box as Tb}from"@mui/material";import{Fragment as bR,jsx as jd}from"react/jsx-runtime";var fR=/https?:\/\/[^\s<>"']+/g;function gR(e){let t=e,o="";for(;;){let a=t.slice(-1);if(a===")"&&(t.match(/\(/g)??[]).length<(t.match(/\)/g)??[]).length){t=t.slice(0,-1),o=a+o;continue}if(".,;:!?]}".includes(a)&&a!==""){t=t.slice(0,-1),o=a+o;continue}break}return[t,o]}var xR=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function kb(e,t,o="m"){let a=[...new Set(t.filter(s=>s.trim().length>=2))].sort((s,c)=>c.length-s.length);if(a.length===0||!e.includes("@"))return[e];let r=new RegExp(`(^|[^A-Za-z0-9._%+-])(@(?:${a.map(xR).join("|")}))`,"g"),i=[],l=0;for(let s of e.matchAll(r)){let c=(s.index??0)+s[1].length;c>l&&i.push(e.slice(l,c)),i.push(jd(Tb,{component:"span",sx:{color:"#2563eb",fontWeight:600},children:s[2]},`${o}-${c}`)),l=c+s[2].length}return l<e.length&&i.push(e.slice(l)),i}function yb({text:e}){let{openExternalUrl:t,mentionCandidates:o}=le(),a=(o??[]).map(s=>s.name),r=s=>{t?t(s):window.open(s,"_blank","noopener,noreferrer")},i=[],l=0;for(let s of e.matchAll(fR)){let c=s.index??0,[u,m]=gR(s[0]);c>l&&i.push(...kb(e.slice(l,c),a,`m${l}`)),i.push(jd(Tb,{component:"a",href:u,onClick:d=>{d.preventDefault(),d.stopPropagation(),r(u)},sx:{color:"#2563eb",textDecoration:"underline",wordBreak:"break-all",cursor:"pointer"},children:u},`${c}-${u}`)),m&&i.push(m),l=c+s[0].length}return l<e.length&&i.push(...kb(e.slice(l),a,`m${l}`)),jd(bR,{children:i})}import{Fragment as qc,jsx as J,jsxs as Xe}from"react/jsx-runtime";var DR=5;function Bb({kind:e,reactions:t,myAccountSeq:o,onToggle:a}){L();let r=t??[],i=o>0&&r.some(u=>u.account_seq===o),l=e==="like"?n("section.reactLike"):n("section.reactAck"),s=r.length===0?l:J(he,{sx:{whiteSpace:"pre-line",fontSize:12},children:r.map(u=>`${u.name} \xB7 ${u.time}`).join(`
11
- `)}),c=e==="like"?"#e5484d":"#2f80ed";return J(_b,{title:s,arrow:!0,enterDelay:300,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Xe(he,{sx:{display:"inline-flex",alignItems:"center"},children:[J(Xo,{size:"small","aria-label":n("section.commentReaction",{label:l}),onClick:a,sx:{color:i?c:"#c9c8c5",p:.5,"&:hover":{color:i?c:"#787774"}},children:e==="like"?i?J(CR,{sx:{fontSize:16}}):J(SR,{sx:{fontSize:16}}):i?J(vR,{sx:{fontSize:16}}):J(BR,{sx:{fontSize:16}})}),r.length>0?J(he,{component:"span",sx:{fontSize:12,color:i?c:"#9a9a97",ml:-.25},children:r.length}):null]})})}function Ib({taskSeq:e,comments:t,currentUserName:o="",myAccountSeq:a=0,avatarSrcByName:r,onUpdate:i,onRemove:l,onToggleReaction:s,onPreview:c,onDownload:u}){L();let[m,d]=Br(null),p=zc(null),[f,g]=Br(null),x=We(),[h,E]=Br(null),b=(w,q)=>{navigator.clipboard.writeText(q).then(()=>{E(w),setTimeout(()=>E(v=>v===w?null:v),1500)})},[B,T]=Br(!1),z=Math.max(0,t.length-DR),k=z>0&&!B,_=m?Math.min(m.index,z):z,D=t.map((w,q)=>({comment:w,index:q})).slice(k?_:0),F=Vi(),R=(w,q)=>{if(c){c(w,q&&q.length>1?q:void 0);return}window.open(F(w.uuid??""),"_blank","noopener,noreferrer")},C=w=>{if(u){u(w);return}window.open(F(w.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},y=le(),I=y.slots?.avatar,S=y.commentInput?.richEditor===!0,O=hd();return Xe(he,{className:"taskbox-comments",sx:{px:2,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[Xe(he,{sx:{display:"flex",alignItems:"center",gap:1},children:[O.showIcon?J(Yr,{sx:{fontSize:18,display:"block",color:O.color}}):null,Xe(he,{sx:{fontSize:bd,fontWeight:O.fontWeight,color:O.color},children:[n("section.comments"),t.length>0?` (${t.length})`:""]}),z>0&&(!k||_>0)?J(he,{role:"button",tabIndex:0,onClick:()=>T(w=>!w),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),T(q=>!q))},sx:{ml:"auto",flexShrink:0,cursor:"pointer",fontSize:14.5,color:"#5b87d6","&:hover":{textDecoration:"underline"}},children:k?n("section.showOlder",{keepFrom:_}):n("section.hideOlder")}):null]}),t.length===0?J(he,{sx:{mt:1,fontSize:14.5,color:"#9a9a97"},children:n("section.noComments")}):null,J(he,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:D.map(({comment:w,index:q})=>{let v=!!o&&w.author===o,M=J(he,{component:"span",sx:{fontSize:14.5,fontWeight:700,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.author}),j=w.external?J(he,{component:"span",sx:{flexShrink:0,px:.6,fontSize:11.5,fontWeight:500,lineHeight:"18px",color:"#d9730d",bgcolor:"#fdf0e6",borderRadius:"4px",whiteSpace:"nowrap"},children:n("section.merchant")}):null;return Xe(he,{sx:{display:"flex",gap:1.5,alignItems:"flex-start","&:hover .taskbox-comment-actions":{opacity:1,pointerEvents:"auto"},"&:not(:last-child)":{borderBottom:"1px dashed #e0dfdc",pb:1}},children:[(()=>{let V=r?.get(w.author)??"";return I?J(he,{sx:{display:"inline-flex",flexShrink:0},children:J(I,{name:w.author,src:V||void 0,size:44})}):J(he,{sx:{display:"inline-flex",flexShrink:0},children:J(po,{src:V,name:w.author,avatarSx:{width:44,height:44,fontSize:20,borderRadius:"50%",...Kr[0]},iconFontSize:24})})})(),Xe(he,{sx:{flex:1,minWidth:0},children:[x?Xe(he,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},children:[M,j]}):null,Xe(he,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0,position:"relative"},children:[x?null:M,x?null:j,J(he,{component:"span",sx:{fontSize:12.5,color:"#9a9a97",flexShrink:0,whiteSpace:"nowrap"},children:w.time}),v?J(he,{sx:{ml:"auto"}}):Xe(he,{sx:{display:"flex",alignItems:"center",gap:.25,ml:"auto",flexShrink:0},children:[J(Xo,{size:"small","aria-label":n("section.copyComment"),onClick:()=>b(q,xi(w.text)),sx:{color:h===q?"#2f9e5b":"#9a9a97",p:.5,"&:hover":{color:"#37352f"}},children:h===q?J(vb,{sx:{fontSize:15}}):J(Sb,{sx:{fontSize:15}})}),J(Bb,{kind:"like",reactions:w.likes,myAccountSeq:a,onToggle:()=>s?.(e,q,"like")}),J(Bb,{kind:"ack",reactions:w.acks,myAccountSeq:a,onToggle:()=>s?.(e,q,"ack")})]}),v?Xe(he,{className:"taskbox-comment-actions",sx:{display:"flex",alignItems:"center",gap:.25,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",pointerEvents:x?"auto":"none",backgroundColor:"var(--taskbox-comment-bg, #fff)",opacity:x?1:0,transition:"opacity 0.15s"},children:[J(Xo,{size:"small","aria-label":n("section.copyComment"),onClick:()=>b(q,xi(w.text)),sx:{color:h===q?"#2f9e5b":"#9a9a97","&:hover":{color:"#37352f"}},children:h===q?J(vb,{sx:{fontSize:15}}):J(Sb,{sx:{fontSize:15}})}),J(Xo,{size:"small","aria-label":n("section.editComment"),onClick:()=>d({index:q,text:w.text,attachments:[...w.attachments??[]],files:[]}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(yR,{sx:{fontSize:15}})}),J(Xo,{size:"small","aria-label":n("section.deleteComment"),onClick:V=>g({anchorEl:V.currentTarget,index:q}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(Fc,{sx:{fontSize:15}})})]}):null]}),m?.index===q?Xe(he,{sx:{mt:.5},children:[S||gi(w.text)?J(Ac,{defaultHtml:gi(w.text)?w.text:$d(w.text),alwaysExpanded:!0,autoFocus:!0,variant:"boxed",minHeight:56,onChange:V=>d(Z=>Z&&{...Z,text:V})}):J(he,{component:"textarea",autoFocus:!0,spellCheck:!1,value:m.text,onChange:V=>d({...m,text:V.target.value}),sx:{width:"100%",minHeight:56,border:"1px solid #dedddb",borderRadius:1,outline:"none",font:"inherit",fontSize:14,p:1,resize:"vertical",boxSizing:"border-box"}}),Xe(he,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:.75,mt:.75},children:[m.attachments.map((V,Z)=>{let ae=()=>d({...m,attachments:m.attachments.filter((me,U)=>U!==Z)});return El(V.name)&&V.uuid?Xe(he,{sx:{position:"relative"},children:[J(he,{component:"img",src:F(V.uuid,{thumb:"md"}),alt:V.name,title:V.name,loading:"lazy",sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"1px solid #e6e6e3",display:"block"}}),J(Xo,{size:"small","aria-label":n("section.removeAttachment"),onClick:ae,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:"1px solid #e6e6e3","&:hover":{bgcolor:"#f1f5f9"}},children:J(Fc,{sx:{fontSize:14}})})]},`kept-${V.uuid}-${Z}`):J(Nc,{size:"small",icon:J(bi,{sx:{fontSize:14}}),label:V.name,onDelete:ae,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`kept-${V.uuid??V.name}-${Z}`)}),m.files.map((V,Z)=>{let ae=()=>d({...m,files:m.files.filter((me,U)=>U!==Z)});return El(V.name)?Xe(he,{sx:{position:"relative"},children:[J(he,{component:"img",src:URL.createObjectURL(V),alt:V.name,title:n("section.newFile",{name:V.name}),onLoad:me=>URL.revokeObjectURL(me.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"2px solid #2f80ed",display:"block"}}),J(Xo,{size:"small","aria-label":n("section.removeAttachment"),onClick:ae,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:"1px solid #e6e6e3","&:hover":{bgcolor:"#f1f5f9"}},children:J(Fc,{sx:{fontSize:14}})})]},`new-${V.name}-${Z}`):J(Nc,{size:"small",icon:J(bi,{sx:{fontSize:14}}),label:n("section.newFile",{name:V.name}),onDelete:ae,sx:{fontSize:14,height:26,bgcolor:"#eef4ff"}},`new-${V.name}-${Z}`)}),J(_b,{title:n("section.addAttachment"),arrow:!0,children:J(Xo,{size:"small","aria-label":n("section.addAttachment"),onClick:()=>p.current?.click(),sx:{ml:"auto",color:"#2f80ed"},children:J(_R,{sx:{fontSize:20}})})})]}),Xe(he,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:.75,mt:.5},children:[J(Cb,{size:"small",color:"inherit",onClick:()=>d(null),children:n("common.cancel")}),J(Cb,{size:"small",variant:"contained",disabled:!m.text.trim()&&m.attachments.length===0&&m.files.length===0,onClick:()=>{i(e,q,m.text,{attachments:m.attachments,files:m.files}),d(null)},children:n("common.save")})]}),J(he,{component:"input",type:"file",multiple:!0,ref:p,sx:{display:"none"},onChange:V=>{let Z=Array.from(V.target.files??[]);Z.length>0&&d({...m,files:[...m.files,...Z].slice(0,10)}),V.target.value=""}})]}):Xe(he,{children:[w.text?gi(w.text)?J(Gd,{html:w.text}):J(he,{sx:{fontSize:15,whiteSpace:"pre-wrap"},children:J(yb,{text:w.text})}):null,(w.attachments??[]).length>0?J(he,{sx:{display:"flex",flexWrap:"wrap",gap:.75,mt:.75},children:(w.attachments??[]).map((V,Z)=>{let ae=!!V.uuid,me=El(V.name),U=(w.attachments??[]).filter($=>!!$.uuid&&El($.name));if(me&&ae)return J(he,{component:"img",src:F(V.uuid??"",{thumb:"md"}),alt:V.name,title:n("section.viewLarge",{name:V.name}),loading:"lazy",onClick:()=>R(V,U),sx:{width:96,height:96,objectFit:"cover",borderRadius:1,border:"1px solid #e6e6e3",cursor:"pointer",bgcolor:"#f8fafc"}},`${V.name}-${Z}`);let ee=Bc(V.name);return J(Nc,{size:"small",icon:J(bi,{sx:{fontSize:14}}),label:`${V.name} (${Ld(V.size)})`,clickable:ae,onClick:ae?()=>ee?R(V):C(V):void 0,title:ae?n("section.fileAction",{name:V.name,value:ee?n("section.preview"):n("section.download")}):V.name,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${V.name}-${Z}`)})}):null]})]})]},`${w.time}-${q}`)})}),J(wR,{open:!!f,anchorEl:f?.anchorEl??null,title:n("section.deleteCommentConfirm"),confirmText:n("common.delete"),onCancel:()=>g(null),onConfirm:()=>{f&&(l(e,f.index),d(null)),g(null)}})]})}function El(e){return/\.(png|jpe?g|gif|webp|bmp|svg|heic|heif)$/i.test(String(e??"").trim())}function ER(e){let{commentInput:t,mentionCandidates:o}=le(),r=((e?.mentionCandidates??o)?.length??0)>0,i=e?.placeholder??t?.placeholder,l=e?.placeholderShort??t?.placeholderShort,s=i??n(r?"section.commentPlaceholder":"section.commentPlaceholderPlain"),c=l??i??n(r?"section.commentPlaceholderShort":"section.commentPlaceholderPlain");return{wide:s,short:c}}function RR(){return Xe("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[J("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),J("path",{d:"M8.5 14.5c.9 1.2 2.1 1.8 3.5 1.8s2.6-.6 3.5-1.8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),J("circle",{cx:"9",cy:"10",r:"1",fill:"currentColor"}),J("circle",{cx:"15",cy:"10",r:"1",fill:"currentColor"})]})}function wb({onSubmit:e,rows:t=2,placeholder:o,placeholderShort:a,richEditor:r,mentionCandidates:i,slashCommands:l,attachments:s=!0,emojiPicker:c,disabled:u=!1}){L();let[m,d]=Br(""),p=sb({value:m,setValue:d,candidates:i,slashCommands:l}),[f,g]=Br([]),[x,h]=Br(!1),E=zc(null),b=zc(null),B=We(),T=B||t===1,z=le(),k=ER({placeholder:o,placeholderShort:a,mentionCandidates:i}),_=!B&&(r??z.commentInput?.richEditor)===!0,D=M=>{if(!s)return;let j=Array.from(M??[]);j.length!==0&&g(V=>[...V,...j].slice(0,10))},F=zc(null),[R,C]=Br(""),y=()=>{if(u)return;let M=_?(F.current?.getComment()??"").trim():m.trim();!M&&f.length===0||(e(M,f.length>0?f:void 0),d(""),F.current?.clear(),C(""),g([]))},I=c??z.slots?.emojiPicker,[S,O]=Br(null),w=M=>{_?F.current?.insertText(M):d(j=>`${j}${M}`),O(null)},q=M=>J(Xo,{size:"small","aria-label":n("section.postComment"),disabled:M||u,onClick:y,sx:{width:34,height:34,flexShrink:0,bgcolor:"primary.main",color:"#ffffff",transition:"background-color 160ms ease","&:hover":{bgcolor:"primary.dark"},"&.Mui-disabled":{bgcolor:"#e2e8f0",color:"#94a3b8"}},children:J(kR,{sx:{fontSize:22}})}),v=Xe(qc,{children:[s?Xe(qc,{children:[J(Xo,{size:"small","aria-label":n("section.attachFile"),onClick:()=>E.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(bi,{sx:{fontSize:20}})}),J(Xo,{size:"small","aria-label":n("section.attachImage"),onClick:()=>b.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(IR,{sx:{fontSize:20}})})]}):null,J(Xo,{size:"small","aria-label":n("section.emoji"),onMouseDown:M=>M.preventDefault(),onClick:M=>O(M.currentTarget),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(RR,{})}),J(hR,{open:!!S,anchorEl:S,onClose:()=>O(null),anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},disableRestoreFocus:!0,slotProps:{paper:{sx:{width:340,maxWidth:"calc(100vw - 32px)",overflow:"hidden"}}},children:I?J(I,{onPick:w}):J(gb,{onPick:w})})]});return Xe(he,{children:[f.length>0?J(he,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1.5,px:2,pt:2},children:f.map((M,j)=>El(M.name)?Xe(he,{sx:{position:"relative"},children:[J(he,{component:"img",src:URL.createObjectURL(M),alt:M.name,title:M.name,onLoad:V=>URL.revokeObjectURL(V.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"1px solid #e6e6e3",display:"block"}}),J(Xo,{size:"small","aria-label":n("section.removeAttachment"),onClick:()=>g(V=>V.filter((Z,ae)=>ae!==j)),sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:"1px solid #e6e6e3","&:hover":{bgcolor:"#f1f5f9"}},children:J(Fc,{sx:{fontSize:14}})})]},`${M.name}-${j}`):J(Nc,{size:"small",icon:J(bi,{sx:{fontSize:14}}),label:`${M.name} (${Ld(M.size)})`,onDelete:()=>g(V=>V.filter((Z,ae)=>ae!==j)),sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${M.name}-${j}`))}):null,Xe(he,{sx:{position:"relative",display:"flex"},onDragOver:M=>{!s||!Array.from(M.dataTransfer?.types??[]).includes("Files")||(M.preventDefault(),h(!0))},onDragLeave:M=>{M.currentTarget.contains(M.relatedTarget)||h(!1)},onDrop:M=>{!s||!Array.from(M.dataTransfer?.types??[]).includes("Files")||(M.preventDefault(),h(!1),D(M.dataTransfer?.files??null))},children:[x?Xe(he,{sx:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",gap:.75,borderRadius:1,border:"2px dashed #2f80ed",bgcolor:"rgba(47,128,237,0.08)",color:"#2f80ed",fontSize:14,fontWeight:600,pointerEvents:"none"},children:[J(bi,{sx:{fontSize:18}}),n("section.dropToAttach")]}):null,_?J(he,{sx:{flex:1,minWidth:0},children:J(Ac,{ref:F,placeholder:k.wide,mentionCandidates:i,slashCommands:l,alwaysExpanded:f.length>0,onChange:C,onSubmit:y,onFiles:M=>{s&&g(j=>[...j,...M].slice(0,10))},footer:Xe(qc,{children:[v,J(he,{sx:{flex:1}}),q(!R&&f.length===0)]})})}):Xe(qc,{children:[J(TR,{value:m,placeholder:T?k.short:k.wide,onChange:M=>d(M.target.value),inputRef:p.inputRef,onSelect:p.onSelectionChange,onKeyDown:M=>{p.onKeyDown(M)},onPaste:M=>{let j=Array.from(M.clipboardData?.files??[]);!s||j.length===0||(M.preventDefault(),D(M.clipboardData.files))},fullWidth:!0,multiline:!0,minRows:T?1:t,maxRows:3,sx:{"& .MuiInputBase-root":{pl:2,pr:T?15:6.5,pb:T?void 0:5,borderRadius:0},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}}),p.popper,T?Xe(he,{sx:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:.25},children:[v,q(!m.trim()&&f.length===0)]}):Xe(he,{sx:{position:"absolute",left:0,right:0,bottom:0,display:"flex",alignItems:"center",px:1,pb:.75},children:[v,J(he,{sx:{flex:1}}),q(!m.trim()&&f.length===0)]})]})]}),J(he,{component:"input",ref:E,type:"file",multiple:!0,onChange:M=>{D(M.target.files),M.target.value=""},sx:{display:"none"}}),J(he,{component:"input",ref:b,type:"file",accept:"image/*",multiple:!0,onChange:M=>{D(M.target.files),M.target.value=""},sx:{display:"none"}})]})}import{useState as Pl}from"react";import{Box as ki,Button as $R,ButtonBase as VR,IconButton as Ti,Tooltip as yi}from"@mui/material";import UR from"@mui/icons-material/Close";import KR from"@mui/icons-material/ArrowBack";import GR from"@mui/icons-material/ContentCopyOutlined";import jR from"@mui/icons-material/ShareOutlined";import YR from"@mui/icons-material/HistoryOutlined";import XR from"@mui/icons-material/Print";import{ConfirmActionPopper as QR}from"@ehfuse/mui-confirm-action";import{Box as _r,Button as OR,CircularProgress as LR}from"@mui/material";import{FormDialog as AR}from"@ehfuse/mui-form-dialog";import{OverlayScrollbar as qR}from"@ehfuse/overlay-scrollbar";import{useEffect as PR}from"react";import{useModal as MR}from"@ehfuse/forma";function Rl({taskSeq:e,items:t,loading:o,onLoad:a}){let r={activity:MR({modalId:_e("taskbox-task-activity")})},i=r.activity.isOpen;return PR(()=>{i&&e>0&&!t&&a?.(e)},[i,e,t,a]),{modals:r,items:t,loading:o,openDialog:()=>r.activity.open()}}import{jsx as Ir,jsxs as Hc}from"react/jsx-runtime";var zR={get created(){return n("activity.created")},get completed(){return n("activity.completed")},get uncompleted(){return n("activity.uncompleted")},get returned(){return n("activity.returned")},get confirm_requested(){return n("activity.confirmRequested")},get acked(){return n("activity.acked")},get claimed(){return n("activity.claimed")},get bug_verified(){return n("activity.bugVerified")},get bug_reopened(){return n("activity.bugReopened")}};function Db(e){return String(e??"").trim()||n("common.none")}function NR(e){if(e.kind!=="field")return zR[String(e.kind)]??n("activity.changed");let t=String(e.field_label??e.field??"").trim()||n("activity.field"),o=String(e.old_value??"").trim(),a=String(e.new_value??"").trim();return!o&&a?n("activity.fieldSet",{label:t,after:a}):o&&!a?n("activity.fieldCleared",{label:t}):n("activity.fieldChanged",{label:t,value:Db(o),value2:Db(a)})}function Wc({controller:e}){L();let t=We(),{items:o,loading:a}=e,r=e.modals.activity,i=Ir(_r,{sx:{height:t?"100%":420,minHeight:0},children:Ir(qR,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:Hc(_r,{sx:{px:2,pt:2,display:"flex",flexDirection:"column",gap:1,"&::after":{content:'""',flexShrink:0,height:16}},children:[a&&!o?Hc(_r,{sx:{display:"flex",alignItems:"center",gap:1,color:"#9a9a97",fontSize:14.5},children:[Ir(LR,{size:14,thickness:5,sx:{color:"#9a9a97"}}),n("common.loading")]}):null,o&&o.length===0?Ir(_r,{sx:{fontSize:14.5,color:"#9a9a97"},children:n("activity.empty")}):null,(o??[]).map(l=>Hc(_r,{sx:{display:"flex",flexDirection:t?"column":"row",gap:t?.25:1,alignItems:t?"stretch":"baseline",minWidth:0,flexShrink:0,...t?{pb:1,borderBottom:"1px solid #ededeb","&:last-of-type":{borderBottom:"none",pb:0}}:{}},children:[Ir(_r,{sx:{flexShrink:0,...t?{}:{width:"10.5em"},whiteSpace:"nowrap",fontSize:13.5,color:"#9a9a97",lineHeight:1.5},children:Vo(l.acted_time)}),Hc(_r,{sx:{minWidth:0,fontSize:14.5,color:"#37352f",lineHeight:1.5},children:[Ir(_r,{component:"span",sx:{fontWeight:500},children:String(l.actor_name??"").trim()||n("dialog.noName")}),Ir(_r,{component:"span",sx:{ml:.5},children:NR(l)})]})]},l.seq))]})})});return Ir(AR,{open:r.isOpen,onClose:r.close,maxWidth:"sm",fullScreen:t,mobilePresentation:t?"slide":"dialog",contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sx:t?{DialogContent:{pb:0,"& .os-content > div":{height:"100%",boxSizing:"border-box",paddingBottom:0,marginBottom:0},"& .FormSection-content, & .section-content":{height:"100%",paddingBottom:0,marginBottom:0}}}:void 0,title:o&&o.length>0?n("activity.titleWithCount",{count:o.length}):n("activity.title"),locale:Ce(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-activity",sections:[{id:"task-activity",showTitle:!1,children:i}],scrollPastLastSection:!1,actions:{showCancelButton:!1,right:Ir(OR,{variant:"contained",onClick:r.close,children:n("common.close")})}})}import{InfoAlert as FR,SuccessAlert as HR}from"@ehfuse/alerts";var Eb=e=>e?e.replace(/<(script|style)[\s\S]*?<\/\1>/gi,"").replace(/<br\s*\/?>/gi,`
9
+ `).trim()}function bi(e){return xi(e)?Dl(e):e}function El(e){let t=cR(Lc(e)).trim(),o=Dl(t);return o.trim()?/<(?!\/?(p|br|span)(\s|>|\/))[a-z]/i.test(t)||/<span[^>]*style=/i.test(t)?t:o:""}var sR=new Set(["P","DIV","UL","OL","H1","H2","H3","H4","BLOCKQUOTE","PRE"]);function cR(e){if(typeof DOMParser>"u")return e;let t=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html"),o=t.body.firstElementChild;if(!o)return e;let a=null;for(let r of Array.from(o.childNodes)){if(r.nodeType===Node.ELEMENT_NODE&&sR.has(r.tagName)){a=null;continue}a||(a=t.createElement("p"),o.insertBefore(a,r)),a.appendChild(r)}for(let r of Array.from(o.querySelectorAll(":scope > p")))!r.textContent?.replace(/\u00a0/g," ").trim()&&!r.querySelector("br, img")&&r.remove();return o.innerHTML}function Vd(e){let t=a=>a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return e.split(`
10
+ `).map(a=>`<p>${a?t(a):"<br>"}</p>`).join("")}import{jsx as Gd,jsxs as fR}from"react/jsx-runtime";var pR={left:[["heading"],["bold","italic","strike","underline"],["link","bgcolor","code"],["bulletList","numberList"]],right:[]},Kd="<p><br></p>",qc=mR(function({defaultHtml:t="",placeholder:o,alwaysExpanded:a=!1,autoFocus:r=!1,minHeight:i=44,maxHeight:l=280,onChange:s,onSubmit:c,onFiles:u,footer:m,variant:d="bare",mentionCandidates:p,slashCommands:f},g){let x=Ac(null),h=Ac(null),E=Ac(null),[b,B]=hb(!1),[T,z]=hb(()=>!!Dl(t).trim()),k=bb(p,f),_=a||b||T;uR(g,()=>({getComment:()=>El(x.current?.getHtml()??""),clear:()=>{x.current?.setHtml(Kd),z(!1)},focus:()=>x.current?.focus(),insertText:F=>{let R=h.current?.querySelector(".ehfuse-editor-content");if(!R)return;R.focus();let C=window.getSelection(),y=E.current;if(!y||!R.contains(y.startContainer)){y=document.createRange();let I=R.lastElementChild??R;y.selectNodeContents(I),y.collapse(!1)}C?.removeAllRanges(),C?.addRange(y),document.execCommand("insertText",!1,F)}})),kb(()=>{if(!r)return;let F=requestAnimationFrame(()=>x.current?.focus());return()=>cancelAnimationFrame(F)},[r]);let D=F=>{let R=Array.from(F??[]);return R.length===0||!u?!1:(u(R),!0)};return fR(Ud,{...k.handlers,onKeyDownCapture:F=>{k.handlers.onKeyDownCapture(F),!F.defaultPrevented&&F.key==="Enter"&&(F.ctrlKey||F.metaKey)&&!F.nativeEvent.isComposing&&(F.preventDefault(),F.stopPropagation(),c?.())},onFocusCapture:()=>B(!0),ref:h,onBlurCapture:F=>{let R=window.getSelection();R&&R.rangeCount>0&&F.currentTarget.contains(R.anchorNode)&&(E.current=R.getRangeAt(0).cloneRange()),!F.currentTarget.contains(F.relatedTarget)&&(B(!1),El(x.current?.getHtml()??"")||(x.current?.setHtml(Kd),E.current=null))},onPasteCapture:F=>{D(F.clipboardData?.files)&&(F.preventDefault(),F.stopPropagation())},onDropCapture:F=>{D(F.dataTransfer?.files)&&(F.preventDefault(),F.stopPropagation())},sx:{position:"relative",bgcolor:"#ffffff",...d==="boxed"?{border:"1px solid",borderColor:b?"primary.main":ee,boxShadow:b?F=>`0 0 0 1px ${F.palette.primary.main}`:"none",borderRadius:"8px",transition:"border-color 120ms"}:{},"& .ehfuse-editor, & .ehfuse-editor-wrapper, & .ehfuse-editor-container":{border:"none !important",boxShadow:"none !important",borderRadius:0},"& .ehfuse-toolbar":{display:_?void 0:"none !important",background:"transparent",borderBottom:`1px solid ${ee}`},"& .ehfuse-editor-content":{maxHeight:l,overflowY:"auto",fontSize:15,lineHeight:1.6},"& .ehfuse-editor-content > p:first-of-type":{mt:0},"& .ehfuse-editor-content > p:last-of-type":{mb:0},"& .ehfuse-editor-content.ehfuse-editor-empty::before":d==="boxed"?{top:"10px",left:"12px"}:{top:"12px",left:"16px"}},children:[Gd(dR,{ref:x,defaultValue:t||Kd,autoHeight:!0,showToolbar:!0,toolbarOptions:pR,locale:ga(),minHeight:_?Math.max(i,64):i,placeholder:o,contentStyle:{padding:d==="boxed"?"10px 12px":"12px 16px"},onChange:F=>{let R=El(F);z(!!R),s?.(R)}}),k.popper,m?Gd(Ud,{sx:{display:"flex",alignItems:"center",px:1,pb:.75},children:m}):null]})});function jd({html:e}){let{openExternalUrl:t,mentionCandidates:o}=se(),a=Ac(null),r=Lc(e),i=(o??[]).map(l=>l.name).filter(l=>l.trim().length>=2);return kb(()=>{let l=a.current;if(!l)return;l.innerHTML=r;let s=[...new Set(i)].sort((p,f)=>f.length-p.length);if(s.length===0||!r.includes("@"))return;let c=p=>p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=new RegExp(`(^|[^A-Za-z0-9._%+-])(@(?:${s.map(c).join("|")}))`,"g"),m=document.createTreeWalker(l,NodeFilter.SHOW_TEXT),d=[];for(;m.nextNode();){let p=m.currentNode;p.data.includes("@")&&!p.parentElement?.closest("a, code")&&d.push(p)}for(let p of d){let f=p.data,g=document.createDocumentFragment(),x=0;for(let h of f.matchAll(u)){let E=(h.index??0)+h[1].length;E>x&&g.append(f.slice(x,E));let b=document.createElement("span");b.className="taskbox-mention",b.textContent=h[2],g.append(b),x=E+h[2].length}x!==0&&(x<f.length&&g.append(f.slice(x)),p.replaceWith(g))}},[r,i.join("|")]),Gd(Ud,{ref:a,onClickCapture:l=>{let s=l.target?.closest?.("a[href]");s&&(l.preventDefault(),l.stopPropagation(),t?t(s.href):window.open(s.href,"_blank","noopener,noreferrer"))},sx:{fontSize:15,lineHeight:1.6,wordBreak:"break-word","& p":{m:0},"& ul, & ol":{pl:"1.5em",my:.25},"& li > p":{m:0},"& h1, & h2, & h3, & h4":{fontSize:"1.05em",fontWeight:700,m:0},"& blockquote":{m:0,pl:1.5,borderLeft:`3px solid ${ee}`,color:"text.secondary"},"& code":{fontFamily:"monospace",fontSize:"0.9em",bgcolor:"#f1f5f9",px:.5,borderRadius:.5},"& pre":{m:0,p:1,bgcolor:"#f1f5f9",borderRadius:1,overflowX:"auto"},"& a[href]":{color:"#2563eb",textDecoration:"none",cursor:"pointer","&:hover":{textDecoration:"underline"}},"& .taskbox-mention":{color:"#2563eb",fontWeight:600}}})}import{ConfirmActionPopper as DR}from"@ehfuse/mui-confirm-action";import{Box as yb}from"@mui/material";import{Fragment as hR,jsx as Yd}from"react/jsx-runtime";var gR=/https?:\/\/[^\s<>"']+/g;function xR(e){let t=e,o="";for(;;){let a=t.slice(-1);if(a===")"&&(t.match(/\(/g)??[]).length<(t.match(/\)/g)??[]).length){t=t.slice(0,-1),o=a+o;continue}if(".,;:!?]}".includes(a)&&a!==""){t=t.slice(0,-1),o=a+o;continue}break}return[t,o]}var bR=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Tb(e,t,o="m"){let a=[...new Set(t.filter(s=>s.trim().length>=2))].sort((s,c)=>c.length-s.length);if(a.length===0||!e.includes("@"))return[e];let r=new RegExp(`(^|[^A-Za-z0-9._%+-])(@(?:${a.map(bR).join("|")}))`,"g"),i=[],l=0;for(let s of e.matchAll(r)){let c=(s.index??0)+s[1].length;c>l&&i.push(e.slice(l,c)),i.push(Yd(yb,{component:"span",sx:{color:"#2563eb",fontWeight:600},children:s[2]},`${o}-${c}`)),l=c+s[2].length}return l<e.length&&i.push(e.slice(l)),i}function Cb({text:e}){let{openExternalUrl:t,mentionCandidates:o}=se(),a=(o??[]).map(s=>s.name),r=s=>{t?t(s):window.open(s,"_blank","noopener,noreferrer")},i=[],l=0;for(let s of e.matchAll(gR)){let c=s.index??0,[u,m]=xR(s[0]);c>l&&i.push(...Tb(e.slice(l,c),a,`m${l}`)),i.push(Yd(yb,{component:"a",href:u,onClick:d=>{d.preventDefault(),d.stopPropagation(),r(u)},sx:{color:"#2563eb",textDecoration:"underline",wordBreak:"break-all",cursor:"pointer"},children:u},`${c}-${u}`)),m&&i.push(m),l=c+s[0].length}return l<e.length&&i.push(...Tb(e.slice(l),a,`m${l}`)),Yd(hR,{children:i})}import{Fragment as zc,jsx as J,jsxs as Qe}from"react/jsx-runtime";var ER=5;function _b({kind:e,reactions:t,myAccountSeq:o,onToggle:a}){L();let r=t??[],i=o>0&&r.some(u=>u.account_seq===o),l=e==="like"?n("section.reactLike"):n("section.reactAck"),s=r.length===0?l:J(ke,{sx:{whiteSpace:"pre-line",fontSize:12},children:r.map(u=>`${u.name} \xB7 ${u.time}`).join(`
11
+ `)}),c=e==="like"?"#e5484d":"#2f80ed";return J(Ib,{title:s,arrow:!0,enterDelay:300,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Qe(ke,{sx:{display:"inline-flex",alignItems:"center"},children:[J(Qo,{size:"small","aria-label":n("section.commentReaction",{label:l}),onClick:a,sx:{color:i?c:"#c9c8c5",p:.5,"&:hover":{color:i?c:"#787774"}},children:e==="like"?i?J(SR,{sx:{fontSize:16}}):J(vR,{sx:{fontSize:16}}):i?J(BR,{sx:{fontSize:16}}):J(_R,{sx:{fontSize:16}})}),r.length>0?J(ke,{component:"span",sx:{fontSize:12,color:i?c:"#9a9a97",ml:-.25},children:r.length}):null]})})}function wb({taskSeq:e,comments:t,currentUserName:o="",myAccountSeq:a=0,avatarSrcByName:r,onUpdate:i,onRemove:l,onToggleReaction:s,onPreview:c,onDownload:u}){L();let[m,d]=_r(null),p=Nc(null),[f,g]=_r(null),x=$e(),[h,E]=_r(null),b=(w,q)=>{navigator.clipboard.writeText(q).then(()=>{E(w),setTimeout(()=>E(v=>v===w?null:v),1500)})},[B,T]=_r(!1),z=Math.max(0,t.length-ER),k=z>0&&!B,_=m?Math.min(m.index,z):z,D=t.map((w,q)=>({comment:w,index:q})).slice(k?_:0),F=Ki(),R=(w,q)=>{if(c){c(w,q&&q.length>1?q:void 0);return}window.open(F(w.uuid??""),"_blank","noopener,noreferrer")},C=w=>{if(u){u(w);return}window.open(F(w.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},y=se(),I=y.slots?.avatar,S=y.commentInput?.richEditor===!0,M=kd();return Qe(ke,{className:"taskbox-comments",sx:{px:2,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[Qe(ke,{sx:{display:"flex",alignItems:"center",gap:1},children:[M.showIcon?J(Xr,{sx:{fontSize:18,display:"block",color:M.color}}):null,Qe(ke,{sx:{fontSize:hd,fontWeight:M.fontWeight,color:M.color},children:[n("section.comments"),t.length>0?` (${t.length})`:""]}),z>0&&(!k||_>0)?J(ke,{role:"button",tabIndex:0,onClick:()=>T(w=>!w),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),T(q=>!q))},sx:{ml:"auto",flexShrink:0,cursor:"pointer",fontSize:14.5,color:"#5b87d6","&:hover":{textDecoration:"underline"}},children:k?n("section.showOlder",{keepFrom:_}):n("section.hideOlder")}):null]}),t.length===0?J(ke,{sx:{mt:1,fontSize:14.5,color:"#9a9a97"},children:n("section.noComments")}):null,J(ke,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:D.map(({comment:w,index:q})=>{let v=!!o&&w.author===o,O=J(ke,{component:"span",sx:{fontSize:14.5,fontWeight:700,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.author}),j=w.external?J(ke,{component:"span",sx:{flexShrink:0,px:.6,fontSize:11.5,fontWeight:500,lineHeight:"18px",color:"#d9730d",bgcolor:"#fdf0e6",borderRadius:"4px",whiteSpace:"nowrap"},children:n("section.merchant")}):null;return Qe(ke,{sx:{display:"flex",gap:1.5,alignItems:"flex-start","&:hover .taskbox-comment-actions":{opacity:1,pointerEvents:"auto"},"&:not(:last-child)":{borderBottom:"1px dashed #e0dfdc",pb:1}},children:[(()=>{let V=r?.get(w.author)??"";return I?J(ke,{sx:{display:"inline-flex",flexShrink:0},children:J(I,{name:w.author,src:V||void 0,size:44})}):J(ke,{sx:{display:"inline-flex",flexShrink:0},children:J(fo,{src:V,name:w.author,avatarSx:{width:44,height:44,fontSize:20,borderRadius:"50%",...Gr[0]},iconFontSize:24})})})(),Qe(ke,{sx:{flex:1,minWidth:0},children:[x?Qe(ke,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},children:[O,j]}):null,Qe(ke,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0,position:"relative"},children:[x?null:O,x?null:j,J(ke,{component:"span",sx:{fontSize:12.5,color:"#9a9a97",flexShrink:0,whiteSpace:"nowrap"},children:w.time}),v?J(ke,{sx:{ml:"auto"}}):Qe(ke,{sx:{display:"flex",alignItems:"center",gap:.25,ml:"auto",flexShrink:0},children:[J(Qo,{size:"small","aria-label":n("section.copyComment"),onClick:()=>b(q,bi(w.text)),sx:{color:h===q?"#2f9e5b":"#9a9a97",p:.5,"&:hover":{color:"#37352f"}},children:h===q?J(Bb,{sx:{fontSize:15}}):J(vb,{sx:{fontSize:15}})}),J(_b,{kind:"like",reactions:w.likes,myAccountSeq:a,onToggle:()=>s?.(e,q,"like")}),J(_b,{kind:"ack",reactions:w.acks,myAccountSeq:a,onToggle:()=>s?.(e,q,"ack")})]}),v?Qe(ke,{className:"taskbox-comment-actions",sx:{display:"flex",alignItems:"center",gap:.25,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",pointerEvents:x?"auto":"none",backgroundColor:"var(--taskbox-comment-bg, #fff)",opacity:x?1:0,transition:"opacity 0.15s"},children:[J(Qo,{size:"small","aria-label":n("section.copyComment"),onClick:()=>b(q,bi(w.text)),sx:{color:h===q?"#2f9e5b":"#9a9a97","&:hover":{color:"#37352f"}},children:h===q?J(Bb,{sx:{fontSize:15}}):J(vb,{sx:{fontSize:15}})}),J(Qo,{size:"small","aria-label":n("section.editComment"),onClick:()=>d({index:q,text:w.text,attachments:[...w.attachments??[]],files:[]}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(CR,{sx:{fontSize:15}})}),J(Qo,{size:"small","aria-label":n("section.deleteComment"),onClick:V=>g({anchorEl:V.currentTarget,index:q}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(Hc,{sx:{fontSize:15}})})]}):null]}),m?.index===q?Qe(ke,{sx:{mt:.5},children:[S||xi(w.text)?J(qc,{defaultHtml:xi(w.text)?w.text:Vd(w.text),alwaysExpanded:!0,autoFocus:!0,variant:"boxed",minHeight:56,onChange:V=>d(Z=>Z&&{...Z,text:V})}):J(ke,{component:"textarea",autoFocus:!0,spellCheck:!1,value:m.text,onChange:V=>d({...m,text:V.target.value}),sx:{width:"100%",minHeight:56,border:`1px solid ${ee}`,borderRadius:1,outline:"none",font:"inherit",fontSize:14,p:1,resize:"vertical",boxSizing:"border-box"}}),Qe(ke,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:.75,mt:.75},children:[m.attachments.map((V,Z)=>{let ie=()=>d({...m,attachments:m.attachments.filter((ue,K)=>K!==Z)});return Rl(V.name)&&V.uuid?Qe(ke,{sx:{position:"relative"},children:[J(ke,{component:"img",src:F(V.uuid,{thumb:"md"}),alt:V.name,title:V.name,loading:"lazy",sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:`1px solid ${ee}`,display:"block"}}),J(Qo,{size:"small","aria-label":n("section.removeAttachment"),onClick:ie,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${ee}`,"&:hover":{bgcolor:"#f1f5f9"}},children:J(Hc,{sx:{fontSize:14}})})]},`kept-${V.uuid}-${Z}`):J(Fc,{size:"small",icon:J(hi,{sx:{fontSize:14}}),label:V.name,onDelete:ie,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`kept-${V.uuid??V.name}-${Z}`)}),m.files.map((V,Z)=>{let ie=()=>d({...m,files:m.files.filter((ue,K)=>K!==Z)});return Rl(V.name)?Qe(ke,{sx:{position:"relative"},children:[J(ke,{component:"img",src:URL.createObjectURL(V),alt:V.name,title:n("section.newFile",{name:V.name}),onLoad:ue=>URL.revokeObjectURL(ue.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"2px solid #2f80ed",display:"block"}}),J(Qo,{size:"small","aria-label":n("section.removeAttachment"),onClick:ie,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${ee}`,"&:hover":{bgcolor:"#f1f5f9"}},children:J(Hc,{sx:{fontSize:14}})})]},`new-${V.name}-${Z}`):J(Fc,{size:"small",icon:J(hi,{sx:{fontSize:14}}),label:n("section.newFile",{name:V.name}),onDelete:ie,sx:{fontSize:14,height:26,bgcolor:"#eef4ff"}},`new-${V.name}-${Z}`)}),J(Ib,{title:n("section.addAttachment"),arrow:!0,children:J(Qo,{size:"small","aria-label":n("section.addAttachment"),onClick:()=>p.current?.click(),sx:{ml:"auto",color:"#2f80ed"},children:J(IR,{sx:{fontSize:20}})})})]}),Qe(ke,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:.75,mt:.5},children:[J(Sb,{size:"small",color:"inherit",onClick:()=>d(null),children:n("common.cancel")}),J(Sb,{size:"small",variant:"contained",disabled:!m.text.trim()&&m.attachments.length===0&&m.files.length===0,onClick:()=>{i(e,q,m.text,{attachments:m.attachments,files:m.files}),d(null)},children:n("common.save")})]}),J(ke,{component:"input",type:"file",multiple:!0,ref:p,sx:{display:"none"},onChange:V=>{let Z=Array.from(V.target.files??[]);Z.length>0&&d({...m,files:[...m.files,...Z].slice(0,10)}),V.target.value=""}})]}):Qe(ke,{children:[w.text?xi(w.text)?J(jd,{html:w.text}):J(ke,{sx:{fontSize:15,whiteSpace:"pre-wrap"},children:J(Cb,{text:w.text})}):null,(w.attachments??[]).length>0?J(ke,{sx:{display:"flex",flexWrap:"wrap",gap:.75,mt:.75},children:(w.attachments??[]).map((V,Z)=>{let ie=!!V.uuid,ue=Rl(V.name),K=(w.attachments??[]).filter($=>!!$.uuid&&Rl($.name));if(ue&&ie)return J(ke,{component:"img",src:F(V.uuid??"",{thumb:"md"}),alt:V.name,title:n("section.viewLarge",{name:V.name}),loading:"lazy",onClick:()=>R(V,K),sx:{width:96,height:96,objectFit:"cover",borderRadius:1,border:`1px solid ${ee}`,cursor:"pointer",bgcolor:"#f8fafc"}},`${V.name}-${Z}`);let te=_c(V.name);return J(Fc,{size:"small",icon:J(hi,{sx:{fontSize:14}}),label:`${V.name} (${Ad(V.size)})`,clickable:ie,onClick:ie?()=>te?R(V):C(V):void 0,title:ie?n("section.fileAction",{name:V.name,value:te?n("section.preview"):n("section.download")}):V.name,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${V.name}-${Z}`)})}):null]})]})]},`${w.time}-${q}`)})}),J(DR,{open:!!f,anchorEl:f?.anchorEl??null,title:n("section.deleteCommentConfirm"),confirmText:n("common.delete"),onCancel:()=>g(null),onConfirm:()=>{f&&(l(e,f.index),d(null)),g(null)}})]})}function Rl(e){return/\.(png|jpe?g|gif|webp|bmp|svg|heic|heif)$/i.test(String(e??"").trim())}function RR(e){let{commentInput:t,mentionCandidates:o}=se(),r=((e?.mentionCandidates??o)?.length??0)>0,i=e?.placeholder??t?.placeholder,l=e?.placeholderShort??t?.placeholderShort,s=i??n(r?"section.commentPlaceholder":"section.commentPlaceholderPlain"),c=l??i??n(r?"section.commentPlaceholderShort":"section.commentPlaceholderPlain");return{wide:s,short:c}}function PR(){return Qe("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[J("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),J("path",{d:"M8.5 14.5c.9 1.2 2.1 1.8 3.5 1.8s2.6-.6 3.5-1.8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),J("circle",{cx:"9",cy:"10",r:"1",fill:"currentColor"}),J("circle",{cx:"15",cy:"10",r:"1",fill:"currentColor"})]})}function Db({onSubmit:e,rows:t=2,placeholder:o,placeholderShort:a,richEditor:r,mentionCandidates:i,slashCommands:l,attachments:s=!0,emojiPicker:c,disabled:u=!1}){L();let[m,d]=_r(""),p=cb({value:m,setValue:d,candidates:i,slashCommands:l}),[f,g]=_r([]),[x,h]=_r(!1),E=Nc(null),b=Nc(null),B=$e(),T=B||t===1,z=se(),k=RR({placeholder:o,placeholderShort:a,mentionCandidates:i}),_=!B&&(r??z.commentInput?.richEditor)===!0,D=O=>{if(!s)return;let j=Array.from(O??[]);j.length!==0&&g(V=>[...V,...j].slice(0,10))},F=Nc(null),[R,C]=_r(""),y=()=>{if(u)return;let O=_?(F.current?.getComment()??"").trim():m.trim();!O&&f.length===0||(e(O,f.length>0?f:void 0),d(""),F.current?.clear(),C(""),g([]))},I=c??z.slots?.emojiPicker,[S,M]=_r(null),w=O=>{_?F.current?.insertText(O):d(j=>`${j}${O}`),M(null)},q=O=>J(Qo,{size:"small","aria-label":n("section.postComment"),disabled:O||u,onClick:y,sx:{width:34,height:34,flexShrink:0,bgcolor:"primary.main",color:"#ffffff",transition:"background-color 160ms ease","&:hover":{bgcolor:"primary.dark"},"&.Mui-disabled":{bgcolor:"#e2e8f0",color:"#94a3b8"}},children:J(TR,{sx:{fontSize:22}})}),v=Qe(zc,{children:[s?Qe(zc,{children:[J(Qo,{size:"small","aria-label":n("section.attachFile"),onClick:()=>E.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(hi,{sx:{fontSize:20}})}),J(Qo,{size:"small","aria-label":n("section.attachImage"),onClick:()=>b.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(wR,{sx:{fontSize:20}})})]}):null,J(Qo,{size:"small","aria-label":n("section.emoji"),onMouseDown:O=>O.preventDefault(),onClick:O=>M(O.currentTarget),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:J(PR,{})}),J(kR,{open:!!S,anchorEl:S,onClose:()=>M(null),anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},disableRestoreFocus:!0,slotProps:{paper:{sx:{width:340,maxWidth:"calc(100vw - 32px)",overflow:"hidden"}}},children:I?J(I,{onPick:w}):J(xb,{onPick:w})})]});return Qe(ke,{children:[f.length>0?J(ke,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1.5,px:2,pt:2},children:f.map((O,j)=>Rl(O.name)?Qe(ke,{sx:{position:"relative"},children:[J(ke,{component:"img",src:URL.createObjectURL(O),alt:O.name,title:O.name,onLoad:V=>URL.revokeObjectURL(V.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:`1px solid ${ee}`,display:"block"}}),J(Qo,{size:"small","aria-label":n("section.removeAttachment"),onClick:()=>g(V=>V.filter((Z,ie)=>ie!==j)),sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${ee}`,"&:hover":{bgcolor:"#f1f5f9"}},children:J(Hc,{sx:{fontSize:14}})})]},`${O.name}-${j}`):J(Fc,{size:"small",icon:J(hi,{sx:{fontSize:14}}),label:`${O.name} (${Ad(O.size)})`,onDelete:()=>g(V=>V.filter((Z,ie)=>ie!==j)),sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${O.name}-${j}`))}):null,Qe(ke,{sx:{position:"relative",display:"flex"},onDragOver:O=>{!s||!Array.from(O.dataTransfer?.types??[]).includes("Files")||(O.preventDefault(),h(!0))},onDragLeave:O=>{O.currentTarget.contains(O.relatedTarget)||h(!1)},onDrop:O=>{!s||!Array.from(O.dataTransfer?.types??[]).includes("Files")||(O.preventDefault(),h(!1),D(O.dataTransfer?.files??null))},children:[x?Qe(ke,{sx:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",gap:.75,borderRadius:1,border:"2px dashed #2f80ed",bgcolor:"rgba(47,128,237,0.08)",color:"#2f80ed",fontSize:14,fontWeight:600,pointerEvents:"none"},children:[J(hi,{sx:{fontSize:18}}),n("section.dropToAttach")]}):null,_?J(ke,{sx:{flex:1,minWidth:0},children:J(qc,{ref:F,placeholder:k.wide,mentionCandidates:i,slashCommands:l,alwaysExpanded:f.length>0,onChange:C,onSubmit:y,onFiles:O=>{s&&g(j=>[...j,...O].slice(0,10))},footer:Qe(zc,{children:[v,J(ke,{sx:{flex:1}}),q(!R&&f.length===0)]})})}):Qe(zc,{children:[J(yR,{value:m,placeholder:T?k.short:k.wide,onChange:O=>d(O.target.value),inputRef:p.inputRef,onSelect:p.onSelectionChange,onKeyDown:O=>{p.onKeyDown(O)},onPaste:O=>{let j=Array.from(O.clipboardData?.files??[]);!s||j.length===0||(O.preventDefault(),D(O.clipboardData.files))},fullWidth:!0,multiline:!0,minRows:T?1:t,maxRows:3,sx:{"& .MuiInputBase-root":{pl:2,pr:T?15:6.5,pb:T?void 0:5,borderRadius:0},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}}),p.popper,T?Qe(ke,{sx:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:.25},children:[v,q(!m.trim()&&f.length===0)]}):Qe(ke,{sx:{position:"absolute",left:0,right:0,bottom:0,display:"flex",alignItems:"center",px:1,pb:.75},children:[v,J(ke,{sx:{flex:1}}),q(!m.trim()&&f.length===0)]})]})]}),J(ke,{component:"input",ref:E,type:"file",multiple:!0,onChange:O=>{D(O.target.files),O.target.value=""},sx:{display:"none"}}),J(ke,{component:"input",ref:b,type:"file",accept:"image/*",multiple:!0,onChange:O=>{D(O.target.files),O.target.value=""},sx:{display:"none"}})]})}import{useState as Ol}from"react";import{Box as Ti,Button as VR,ButtonBase as KR,IconButton as yi,Tooltip as Ci}from"@mui/material";import UR from"@mui/icons-material/Close";import GR from"@mui/icons-material/ArrowBack";import jR from"@mui/icons-material/ContentCopyOutlined";import YR from"@mui/icons-material/ShareOutlined";import XR from"@mui/icons-material/HistoryOutlined";import QR from"@mui/icons-material/Print";import{ConfirmActionPopper as JR}from"@ehfuse/mui-confirm-action";import{Box as Ir,Button as LR,CircularProgress as AR}from"@mui/material";import{FormDialog as qR}from"@ehfuse/mui-form-dialog";import{OverlayScrollbar as zR}from"@ehfuse/overlay-scrollbar";import{useEffect as OR}from"react";import{useModal as MR}from"@ehfuse/forma";function Pl({taskSeq:e,items:t,loading:o,onLoad:a}){let r={activity:MR({modalId:Ie("taskbox-task-activity")})},i=r.activity.isOpen;return OR(()=>{i&&e>0&&!t&&a?.(e)},[i,e,t,a]),{modals:r,items:t,loading:o,openDialog:()=>r.activity.open()}}import{jsx as wr,jsxs as Wc}from"react/jsx-runtime";var NR={get created(){return n("activity.created")},get completed(){return n("activity.completed")},get uncompleted(){return n("activity.uncompleted")},get returned(){return n("activity.returned")},get confirm_requested(){return n("activity.confirmRequested")},get acked(){return n("activity.acked")},get claimed(){return n("activity.claimed")},get bug_verified(){return n("activity.bugVerified")},get bug_reopened(){return n("activity.bugReopened")}};function Eb(e){return String(e??"").trim()||n("common.none")}function FR(e){if(e.kind!=="field")return NR[String(e.kind)]??n("activity.changed");let t=String(e.field_label??e.field??"").trim()||n("activity.field"),o=String(e.old_value??"").trim(),a=String(e.new_value??"").trim();return!o&&a?n("activity.fieldSet",{label:t,after:a}):o&&!a?n("activity.fieldCleared",{label:t}):n("activity.fieldChanged",{label:t,value:Eb(o),value2:Eb(a)})}function $c({controller:e}){L();let t=$e(),{items:o,loading:a}=e,r=e.modals.activity,i=wr(Ir,{sx:{height:t?"100%":420,minHeight:0},children:wr(zR,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:Wc(Ir,{sx:{px:2,pt:2,display:"flex",flexDirection:"column",gap:1,"&::after":{content:'""',flexShrink:0,height:16}},children:[a&&!o?Wc(Ir,{sx:{display:"flex",alignItems:"center",gap:1,color:"#9a9a97",fontSize:14.5},children:[wr(AR,{size:14,thickness:5,sx:{color:"#9a9a97"}}),n("common.loading")]}):null,o&&o.length===0?wr(Ir,{sx:{fontSize:14.5,color:"#9a9a97"},children:n("activity.empty")}):null,(o??[]).map(l=>Wc(Ir,{sx:{display:"flex",flexDirection:t?"column":"row",gap:t?.25:1,alignItems:t?"stretch":"baseline",minWidth:0,flexShrink:0,...t?{pb:1,borderBottom:`1px solid ${ee}`,"&:last-of-type":{borderBottom:"none",pb:0}}:{}},children:[wr(Ir,{sx:{flexShrink:0,...t?{}:{width:"10.5em"},whiteSpace:"nowrap",fontSize:13.5,color:"#9a9a97",lineHeight:1.5},children:Ko(l.acted_time)}),Wc(Ir,{sx:{minWidth:0,fontSize:14.5,color:"#37352f",lineHeight:1.5},children:[wr(Ir,{component:"span",sx:{fontWeight:500},children:String(l.actor_name??"").trim()||n("dialog.noName")}),wr(Ir,{component:"span",sx:{ml:.5},children:FR(l)})]})]},l.seq))]})})});return wr(qR,{open:r.isOpen,onClose:r.close,maxWidth:"sm",fullScreen:t,mobilePresentation:t?"slide":"dialog",contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sx:t?{DialogContent:{pb:0,"& .os-content > div":{height:"100%",boxSizing:"border-box",paddingBottom:0,marginBottom:0},"& .FormSection-content, & .section-content":{height:"100%",paddingBottom:0,marginBottom:0}}}:void 0,title:o&&o.length>0?n("activity.titleWithCount",{count:o.length}):n("activity.title"),locale:Se(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-activity",sections:[{id:"task-activity",showTitle:!1,children:i}],scrollPastLastSection:!1,actions:{showCancelButton:!1,right:wr(LR,{variant:"contained",onClick:r.close,children:n("common.close")})}})}import{InfoAlert as HR,SuccessAlert as WR}from"@ehfuse/alerts";var Rb=e=>e?e.replace(/<(script|style)[\s\S]*?<\/\1>/gi,"").replace(/<br\s*\/?>/gi,`
12
12
  `).replace(/<\/(p|div|li|h[1-6]|tr)>/gi,`
13
13
  `).replace(/<[^>]+>/g,"").replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#39;/gi,"'").replace(/&amp;/gi,"&").replace(/\n{3,}/g,`
14
14
 
15
- `).trim():"";function WR(e){let t=[n("share.title",{title:e.title})],o=$o(e.start_date),a=$o(e.due_date);(o||a)&&t.push(n("share.period",{value:o&&a?`${o} ~ ${a}`:o||a})),e.manager_name&&t.push(n("share.owner",{manager_name:e.manager_name}));let r=Nt(e).name;r&&t.push(n("share.status",{statusName:r}));let i=Eb(e.content);i&&t.push("",i);let l=String(e.note??"").trim();return l&&t.push("",n("share.note",{note:l})),t.join(`
16
- `)}function Rb(e){navigator.clipboard.writeText(e).then(()=>HR(n("share.copied"))).catch(()=>FR(n("share.copyFailed")))}function hi(e,t,o){let a=WR(e);if(o){o(a);return}if(t&&typeof navigator.share=="function"){navigator.share({text:a}).catch(r=>{r?.name!=="AbortError"&&Rb(a)});return}Rb(a)}import{Fragment as JR,jsx as Le,jsxs as Yd}from"react/jsx-runtime";function Pb({task:e,myAccountSeq:t=0,onToggleCompleted:o,hideCompleted:a=!1,kindLabel:r,displayTitle:i,onChangeTitle:l,onChangeIcon:s,onChangeIconColor:c,onClose:u,appBarMode:m=!1,activityItems:d,activityLoading:p,onLoadActivity:f,onPrint:g,onDelete:x,canDelete:h,headerExtra:E}){L();let b=We(),B=Rl({taskSeq:e.seq,items:d,loading:p,onLoad:f}),[T,z]=Pl(null),[k,_]=Pl(null),[D,F]=Pl(null),[R,C]=Pl(null),[y,I]=Pl(null),S=!!e.is_notice,O=!!e.is_event,w=S?Oe(e.icon||wt):O?Oe(e.icon||zt):null,q=S&&t>0&&(e.author_account_seq??0)===t,{onReturnTask:v,onReviewDone:M,editPolicy:j,shareText:V}=le(),Z=!!v&&oo(e,t),ae=Z&&!!M,me=!Hn(e,t),U=Ur(e,t,j),ee=t>0&&(e.author_account_seq??0)===t,$=!!x&&(h??!ha(e,t,j,!ee)),G=!a&&!O&&(S?q:(e.author_account_seq??0)===t||(e.manager_account_seq??0)===t);return Yd(JR,{children:[Yd(ki,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.5,flexShrink:0},children:[m&&u?Le(Ti,{"aria-label":n("common.back"),onClick:u,sx:{color:"#37352f",ml:-1},children:Le(KR,{})}):null,G&&!m?Le(yi,{title:e.completed&&e.completed_by?n("col.completedBy",{completed_by:e.completed_by,value:Vo(e.completed_time)}):"",arrow:!0,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Yd(ki,{sx:{display:"flex",flexShrink:0,mr:1},children:[Le(Uo,{onClick:re=>I({anchorEl:re.currentTarget,nextCompleted:!e.completed}),children:e.completed?Z?n("task.revert"):n("menu.uncomplete"):n("detail.markDone")}),ae?Le($R,{variant:"contained",size:"small",disableElevation:!0,onClick:re=>C(re.currentTarget),sx:{ml:1,...Gr},children:n("col.reviewDone")}):null]})}):null,m||!w?null:O&&!me?Le(yi,{title:n("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:Le(VR,{onClick:re=>_(re.currentTarget),sx:{display:"flex",p:.5,borderRadius:1,color:e.icon_color||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:Le(w,{sx:{fontSize:20}})})}):Le(ki,{sx:{display:"flex",px:.5,color:e.icon_color||(S?"#e5484d":"#1e3a8a")},children:Le(w,{sx:{fontSize:20}})}),T!==null?Le(ki,{component:"input",autoFocus:!0,spellCheck:!1,value:T,onChange:re=>z(re.target.value),onBlur:()=>{T.trim()&&T.trim()!==e.title&&l(e.seq,T.trim()),z(null)},onKeyDown:re=>{re.key==="Enter"&&re.target.blur(),re.key==="Escape"&&z(null)},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:18,fontWeight:500,color:e.completed?"#9a9a97":"#37352f",p:0,m:0}}):m?Le(ki,{sx:{flex:1,minWidth:0,fontSize:18,fontWeight:500,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r??(S?n("detail.kindNotice"):O?n("kind.event"):e.is_bug?n("kind.bug"):n("kind.task"))}):Le(ki,{onClick:U||i?void 0:()=>z(e.title),sx:{flex:1,minWidth:0,fontSize:18,fontWeight:500,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:U||i?"default":"text"},children:i||e.title}),E?E(e):null,f?Le(yi,{title:n("activity.title"),arrow:!0,children:Le(Ti,{"aria-label":n("activity.title"),onClick:B.openDialog,sx:{color:"#6b7280"},children:Le(YR,{sx:{fontSize:20}})})}):null,Le(yi,{title:b?n("detail.share"):n("menu.copyContent"),arrow:!0,children:Le(Ti,{"aria-label":b?n("detail.share"):n("menu.copyContent"),onClick:()=>hi(e,b,V),sx:{color:"#6b7280"},children:b?Le(jR,{sx:{fontSize:20}}):Le(GR,{sx:{fontSize:20}})})}),g?Le(yi,{title:n("common.print"),arrow:!0,children:Le(Ti,{"aria-label":n("common.print"),onClick:()=>g(e),sx:{color:"#6b7280"},children:Le(XR,{sx:{fontSize:20}})})}):null,$?Le(yi,{title:n("common.delete"),arrow:!0,children:Le(Ti,{"aria-label":n("common.delete"),onClick:re=>F(re.currentTarget),sx:{color:"#6b7280","&:hover":{color:"#e5484d"}},children:Le(Xt,{sx:{fontSize:20}})})}):null,u&&!m?Le(Ti,{"aria-label":n("common.close"),onClick:u,sx:{color:"#6b7280"},children:Le(UR,{})}):null]}),Le(jr,{anchorEl:R,onCancel:()=>C(null),onConfirm:()=>{M?.(e),C(null)}}),Le(Oo,{open:!!y,anchorEl:y?.anchorEl??null,nextCompleted:y?.nextCompleted??!1,returnMode:Z,onCancel:()=>I(null),onConfirm:re=>{y&&(re&&v?v(e,re):o(e.seq,y.nextCompleted)),I(null)}}),Le(Vr,{anchorEl:k,value:e.icon??"",color:e.icon_color??"",onSelect:re=>{s(e.seq,re),_(null)},onSelectColor:c?re=>c(e.seq,re):void 0,onClose:()=>_(null)}),Le(QR,{open:!!D,anchorEl:D,title:n("detail.trashConfirm"),confirmText:n("common.delete"),onCancel:()=>F(null),onConfirm:()=>{F(null),x?.(e)}}),Le(Wc,{controller:B})]})}import{memo as NP,useRef as Kc,useState as zo}from"react";import{useEffect as ZR,useRef as eP,useState as tP}from"react";var oP=5e3,nP=15e3,rP=25;function Mb(e){let t=e.replace(/<[^>]*>/g," ").replace(/&nbsp;/g," ").replace(/\s+/g," ").trim();return Math.min(nP,Math.max(oP,Math.round(t.length/rP*1e3)))}var Xd=!1;typeof window<"u"&&(window.addEventListener("blur",()=>{Xd=!0}),window.addEventListener("focus",()=>{Xd=!1}));function aP(){return typeof document>"u"?!1:document.visibilityState==="visible"&&!Xd}function Ob(e,t,o,a){let[r,i]=tP(0),l=eP(a);return l.current=a,ZR(()=>{if(i(0),!t||o<=0)return;let s=0,c=Date.now(),u=!1,d=setInterval(()=>{let p=Date.now(),f=Math.min(p-c,1e3);c=p,!(u||!aP())&&(s+=f,i(Math.min(1,s/o)),s>=o&&(u=!0,l.current()))},250);return()=>clearInterval(d)},[e,t,o]),t?r:0}import{Box as tt,Button as qa,ButtonBase as Ub,Checkbox as FP,Divider as ea,IconButton as HP,Menu as rp,MenuItem as ap,Tooltip as WP}from"@mui/material";import $P from"@mui/icons-material/DoneOutlined";import VP from"@mui/icons-material/ExpandLess";import UP from"@mui/icons-material/ExpandMore";import KP from"@mui/icons-material/ConfirmationNumberOutlined";import GP from"@mui/icons-material/FactCheckOutlined";import Kb from"@mui/icons-material/Check";import jP from"@mui/icons-material/DirectionsRunOutlined";import YP from"@mui/icons-material/SpeedOutlined";import ip from"@mui/icons-material/CheckCircle";import XP from"@mui/icons-material/CheckCircleOutlineOutlined";import lp from"@mui/icons-material/CheckCircleOutlined";import Gb from"@mui/icons-material/AccessTimeOutlined";import QP from"@mui/icons-material/AutorenewOutlined";import JP from"@mui/icons-material/LabelOutlined";import ZP from"@mui/icons-material/PersonOutlineOutlined";import eM from"@mui/icons-material/SubjectOutlined";import tM from"@mui/icons-material/StickyNote2Outlined";import oM from"@mui/icons-material/PanToolAltOutlined";import jb from"@mui/icons-material/LockOutlined";import Yb from"@mui/icons-material/PublicOutlined";import Xb from"@mui/icons-material/Group";import nM from"@mui/icons-material/Repeat";import rM from"@mui/icons-material/EventOutlined";import{Box as iP}from"@mui/material";import{jsx as lP}from"react/jsx-runtime";function $c({size:e=40}){return lP(iP,{sx:{boxSizing:"border-box",width:e,height:e,borderRadius:"50%",border:"4px solid rgba(28, 64, 125, 0.14)",borderTopColor:"#1c407d",animation:"taskbox-content-loading-spin 0.75s linear infinite","@keyframes taskbox-content-loading-spin":{to:{transform:"rotate(360deg)"}}}})}import{useEffect as dP,useState as pP}from"react";import{Box as Io,Button as Lb,Chip as fP,IconButton as gP,Tooltip as xP}from"@mui/material";import ep from"@mui/icons-material/Check";import{ConfirmActionPopper as bP}from"@ehfuse/mui-confirm-action";import{FormDialog as hP}from"@ehfuse/mui-form-dialog";import kP from"@mui/icons-material/Translate";import Ab from"@mui/icons-material/ContentCopyOutlined";import{useEffect as sP,useRef as Qd}from"react";import{useFormaState as cP,useModal as mP}from"@ehfuse/forma";var Jd=new Map,uP={target:"",doneTargets:[],result:null,loading:!1,error:"",copied:!1,summaryCopied:!1};function Zd(e){L();let t=Qd(e);t.current=e;let{translateContent:o}=le(),a=Qd(o);a.current=o;let r=Qd(0),i={translate:mP({modalId:_e("taskbox-content-translate"),onClose:()=>{r.current+=1}})},l=cP(uP);sP(()=>{r.current+=1,l.setValue("target","")},[e.taskSeq]);let s=p=>(t.current.translatedTargets??[]).includes(p)||(l.getValue("doneTargets")??[]).includes(p)||Jd.has(`${t.current.taskSeq}:${p}`),c=p=>{l.setValue("target",p);let f=++r.current,g=t.current.taskSeq,x=a.current;if(!x||!(g>0)||!p)return;let h=`${g}:${p}`,E=Jd.get(h);if(E){l.setValues({result:E,error:""});return}l.setValues({loading:!0,error:"",result:null}),x({taskSeq:g,target:p}).then(b=>{if(f!==r.current)return;Jd.set(h,b);let B=l.getValue("doneTargets")??[];B.includes(p)||l.setValue("doneTargets",[...B,p]),l.setValue("result",b)}).catch(b=>{f===r.current&&l.setValue("error",b instanceof Error?b.message:n("translate.failed"))}).finally(()=>{f===r.current&&l.setValue("loading",!1)})},u=()=>{l.setValue("target",""),i.translate.open()},m=()=>{let p=l.getValue("result");p?.summary&&navigator.clipboard.writeText(p.summary).then(()=>{l.setValue("summaryCopied",!0),window.setTimeout(()=>l.setValue("summaryCopied",!1),1500)})},d=()=>{let p=l.getValue("result");if(!p)return;let f=p.html?Ea(p.html):p.text;navigator.clipboard.writeText(`${p.title}
15
+ `).trim():"";function $R(e){let t=[n("share.title",{title:e.title})],o=Vo(e.start_date),a=Vo(e.due_date);(o||a)&&t.push(n("share.period",{value:o&&a?`${o} ~ ${a}`:o||a})),e.manager_name&&t.push(n("share.owner",{manager_name:e.manager_name}));let r=Ft(e).name;r&&t.push(n("share.status",{statusName:r}));let i=Rb(e.content);i&&t.push("",i);let l=String(e.note??"").trim();return l&&t.push("",n("share.note",{note:l})),t.join(`
16
+ `)}function Pb(e){navigator.clipboard.writeText(e).then(()=>WR(n("share.copied"))).catch(()=>HR(n("share.copyFailed")))}function ki(e,t,o){let a=$R(e);if(o){o(a);return}if(t&&typeof navigator.share=="function"){navigator.share({text:a}).catch(r=>{r?.name!=="AbortError"&&Pb(a)});return}Pb(a)}import{Fragment as ZR,jsx as Ae,jsxs as Xd}from"react/jsx-runtime";function Ob({task:e,myAccountSeq:t=0,onToggleCompleted:o,hideCompleted:a=!1,kindLabel:r,displayTitle:i,onChangeTitle:l,onChangeIcon:s,onChangeIconColor:c,onClose:u,appBarMode:m=!1,activityItems:d,activityLoading:p,onLoadActivity:f,onPrint:g,onDelete:x,canDelete:h,headerExtra:E}){L();let b=$e(),B=Pl({taskSeq:e.seq,items:d,loading:p,onLoad:f}),[T,z]=Ol(null),[k,_]=Ol(null),[D,F]=Ol(null),[R,C]=Ol(null),[y,I]=Ol(null),S=!!e.is_notice,M=!!e.is_event,w=S?Le(e.icon||Dt):M?Le(e.icon||Nt):null,q=S&&t>0&&(e.author_account_seq??0)===t,{onReturnTask:v,onReviewDone:O,editPolicy:j,shareText:V}=se(),Z=!!v&&no(e,t),ie=Z&&!!O,ue=!Wn(e,t),K=Ur(e,t,j),te=t>0&&(e.author_account_seq??0)===t,$=!!x&&(h??!ka(e,t,j,!te)),G=!a&&!M&&(S?q:(e.author_account_seq??0)===t||(e.manager_account_seq??0)===t);return Xd(ZR,{children:[Xd(Ti,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.5,flexShrink:0},children:[m&&u?Ae(yi,{"aria-label":n("common.back"),onClick:u,sx:{color:"#37352f",ml:-1},children:Ae(GR,{})}):null,G&&!m?Ae(Ci,{title:e.completed&&e.completed_by?n("col.completedBy",{completed_by:e.completed_by,value:Ko(e.completed_time)}):"",arrow:!0,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Xd(Ti,{sx:{display:"flex",flexShrink:0,mr:1},children:[Ae(Uo,{onClick:ae=>I({anchorEl:ae.currentTarget,nextCompleted:!e.completed}),children:e.completed?Z?n("task.revert"):n("menu.uncomplete"):n("detail.markDone")}),ie?Ae(VR,{variant:"contained",size:"small",disableElevation:!0,onClick:ae=>C(ae.currentTarget),sx:{ml:1,...jr},children:n("col.reviewDone")}):null]})}):null,m||!w?null:M&&!ue?Ae(Ci,{title:n("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:Ae(KR,{onClick:ae=>_(ae.currentTarget),sx:{display:"flex",p:.5,borderRadius:1,color:e.icon_color||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:Ae(w,{sx:{fontSize:20}})})}):Ae(Ti,{sx:{display:"flex",px:.5,color:e.icon_color||(S?"#e5484d":"#1e3a8a")},children:Ae(w,{sx:{fontSize:20}})}),T!==null?Ae(Ti,{component:"input",autoFocus:!0,spellCheck:!1,value:T,onChange:ae=>z(ae.target.value),onBlur:()=>{T.trim()&&T.trim()!==e.title&&l(e.seq,T.trim()),z(null)},onKeyDown:ae=>{ae.key==="Enter"&&ae.target.blur(),ae.key==="Escape"&&z(null)},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:18,fontWeight:500,color:e.completed?"#9a9a97":"#37352f",p:0,m:0}}):m?Ae(Ti,{sx:{flex:1,minWidth:0,fontSize:18,fontWeight:500,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r??(S?n("detail.kindNotice"):M?n("kind.event"):e.is_bug?n("kind.bug"):n("kind.task"))}):Ae(Ti,{onClick:K||i?void 0:()=>z(e.title),sx:{flex:1,minWidth:0,fontSize:18,fontWeight:500,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:K||i?"default":"text"},children:i||e.title}),E?E(e):null,f?Ae(Ci,{title:n("activity.title"),arrow:!0,children:Ae(yi,{"aria-label":n("activity.title"),onClick:B.openDialog,sx:{color:"#6b7280"},children:Ae(XR,{sx:{fontSize:20}})})}):null,Ae(Ci,{title:b?n("detail.share"):n("menu.copyContent"),arrow:!0,children:Ae(yi,{"aria-label":b?n("detail.share"):n("menu.copyContent"),onClick:()=>ki(e,b,V),sx:{color:"#6b7280"},children:b?Ae(YR,{sx:{fontSize:20}}):Ae(jR,{sx:{fontSize:20}})})}),g?Ae(Ci,{title:n("common.print"),arrow:!0,children:Ae(yi,{"aria-label":n("common.print"),onClick:()=>g(e),sx:{color:"#6b7280"},children:Ae(QR,{sx:{fontSize:20}})})}):null,$?Ae(Ci,{title:n("common.delete"),arrow:!0,children:Ae(yi,{"aria-label":n("common.delete"),onClick:ae=>F(ae.currentTarget),sx:{color:"#6b7280","&:hover":{color:"#e5484d"}},children:Ae(Qt,{sx:{fontSize:20}})})}):null,u&&!m?Ae(yi,{"aria-label":n("common.close"),onClick:u,sx:{color:"#6b7280"},children:Ae(UR,{})}):null]}),Ae(Yr,{anchorEl:R,onCancel:()=>C(null),onConfirm:()=>{O?.(e),C(null)}}),Ae(Lo,{open:!!y,anchorEl:y?.anchorEl??null,nextCompleted:y?.nextCompleted??!1,returnMode:Z,onCancel:()=>I(null),onConfirm:ae=>{y&&(ae&&v?v(e,ae):o(e.seq,y.nextCompleted)),I(null)}}),Ae(Kr,{anchorEl:k,value:e.icon??"",color:e.icon_color??"",onSelect:ae=>{s(e.seq,ae),_(null)},onSelectColor:c?ae=>c(e.seq,ae):void 0,onClose:()=>_(null)}),Ae(JR,{open:!!D,anchorEl:D,title:n("detail.trashConfirm"),confirmText:n("common.delete"),onCancel:()=>F(null),onConfirm:()=>{F(null),x?.(e)}}),Ae($c,{controller:B})]})}import{memo as FP,useRef as Gc,useState as No}from"react";import{useEffect as eP,useRef as tP,useState as oP}from"react";var nP=5e3,rP=15e3,aP=25;function Mb(e){let t=e.replace(/<[^>]*>/g," ").replace(/&nbsp;/g," ").replace(/\s+/g," ").trim();return Math.min(rP,Math.max(nP,Math.round(t.length/aP*1e3)))}var Qd=!1;typeof window<"u"&&(window.addEventListener("blur",()=>{Qd=!0}),window.addEventListener("focus",()=>{Qd=!1}));function iP(){return typeof document>"u"?!1:document.visibilityState==="visible"&&!Qd}function Lb(e,t,o,a){let[r,i]=oP(0),l=tP(a);return l.current=a,eP(()=>{if(i(0),!t||o<=0)return;let s=0,c=Date.now(),u=!1,d=setInterval(()=>{let p=Date.now(),f=Math.min(p-c,1e3);c=p,!(u||!iP())&&(s+=f,i(Math.min(1,s/o)),s>=o&&(u=!0,l.current()))},250);return()=>clearInterval(d)},[e,t,o]),t?r:0}import{Box as ot,Button as za,ButtonBase as Ub,Checkbox as HP,Divider as ta,IconButton as WP,Menu as ap,MenuItem as ip,Tooltip as $P}from"@mui/material";import VP from"@mui/icons-material/DoneOutlined";import KP from"@mui/icons-material/ExpandLess";import UP from"@mui/icons-material/ExpandMore";import GP from"@mui/icons-material/ConfirmationNumberOutlined";import jP from"@mui/icons-material/FactCheckOutlined";import Gb from"@mui/icons-material/Check";import YP from"@mui/icons-material/DirectionsRunOutlined";import XP from"@mui/icons-material/SpeedOutlined";import lp from"@mui/icons-material/CheckCircle";import QP from"@mui/icons-material/CheckCircleOutlineOutlined";import sp from"@mui/icons-material/CheckCircleOutlined";import jb from"@mui/icons-material/AccessTimeOutlined";import JP from"@mui/icons-material/AutorenewOutlined";import ZP from"@mui/icons-material/LabelOutlined";import eO from"@mui/icons-material/PersonOutlineOutlined";import tO from"@mui/icons-material/SubjectOutlined";import oO from"@mui/icons-material/StickyNote2Outlined";import nO from"@mui/icons-material/PanToolAltOutlined";import Yb from"@mui/icons-material/LockOutlined";import Xb from"@mui/icons-material/PublicOutlined";import Qb from"@mui/icons-material/Group";import rO from"@mui/icons-material/Repeat";import aO from"@mui/icons-material/EventOutlined";import{Box as lP}from"@mui/material";import{jsx as sP}from"react/jsx-runtime";function Vc({size:e=40}){return sP(lP,{sx:{boxSizing:"border-box",width:e,height:e,borderRadius:"50%",border:"4px solid rgba(28, 64, 125, 0.14)",borderTopColor:"#1c407d",animation:"taskbox-content-loading-spin 0.75s linear infinite","@keyframes taskbox-content-loading-spin":{to:{transform:"rotate(360deg)"}}}})}import{useEffect as pP,useState as fP}from"react";import{Box as wo,Button as Ab,Chip as gP,IconButton as xP,Tooltip as bP}from"@mui/material";import tp from"@mui/icons-material/Check";import{ConfirmActionPopper as hP}from"@ehfuse/mui-confirm-action";import{FormDialog as kP}from"@ehfuse/mui-form-dialog";import TP from"@mui/icons-material/Translate";import qb from"@mui/icons-material/ContentCopyOutlined";import{useEffect as cP,useRef as Jd}from"react";import{useFormaState as mP,useModal as uP}from"@ehfuse/forma";var Zd=new Map,dP={target:"",doneTargets:[],result:null,loading:!1,error:"",copied:!1,summaryCopied:!1};function ep(e){L();let t=Jd(e);t.current=e;let{translateContent:o}=se(),a=Jd(o);a.current=o;let r=Jd(0),i={translate:uP({modalId:Ie("taskbox-content-translate"),onClose:()=>{r.current+=1}})},l=mP(dP);cP(()=>{r.current+=1,l.setValue("target","")},[e.taskSeq]);let s=p=>(t.current.translatedTargets??[]).includes(p)||(l.getValue("doneTargets")??[]).includes(p)||Zd.has(`${t.current.taskSeq}:${p}`),c=p=>{l.setValue("target",p);let f=++r.current,g=t.current.taskSeq,x=a.current;if(!x||!(g>0)||!p)return;let h=`${g}:${p}`,E=Zd.get(h);if(E){l.setValues({result:E,error:""});return}l.setValues({loading:!0,error:"",result:null}),x({taskSeq:g,target:p}).then(b=>{if(f!==r.current)return;Zd.set(h,b);let B=l.getValue("doneTargets")??[];B.includes(p)||l.setValue("doneTargets",[...B,p]),l.setValue("result",b)}).catch(b=>{f===r.current&&l.setValue("error",b instanceof Error?b.message:n("translate.failed"))}).finally(()=>{f===r.current&&l.setValue("loading",!1)})},u=()=>{l.setValue("target",""),i.translate.open()},m=()=>{let p=l.getValue("result");p?.summary&&navigator.clipboard.writeText(p.summary).then(()=>{l.setValue("summaryCopied",!0),window.setTimeout(()=>l.setValue("summaryCopied",!1),1500)})},d=()=>{let p=l.getValue("result");if(!p)return;let f=p.html?Ra(p.html):p.text;navigator.clipboard.writeText(`${p.title}
17
17
 
18
- ${f}`.trim()).then(()=>{l.setValue("copied",!0),window.setTimeout(()=>l.setValue("copied",!1),1500)})};return{modals:i,ui:l,taskSeq:e.taskSeq,isStored:s,selectTarget:c,openDialog:u,copySummary:m,copyResult:d}}import{jsx as bt,jsxs as Ml}from"react/jsx-runtime";var qb=[{code:"en",get label(){return n("lang.en")}},{code:"ja",get label(){return n("lang.ja")}},{code:"zh",get label(){return n("lang.zh")}},{code:"zh-TW",get label(){return n("lang.zhTW")}},{code:"vi",get label(){return n("lang.vi")}},{code:"th",get label(){return n("lang.th")}},{code:"ko",get label(){return n("lang.ko")}}];function zb({controller:e,title:t,html:o}){L();let a=e.modals.translate,{ui:r}=e,i=String(r.useValue("target")??"");r.useValue("doneTargets");let l=r.useValue("result"),s=!!r.useValue("loading"),c=String(r.useValue("error")??""),u=!!r.useValue("copied"),m=!!r.useValue("summaryCopied"),[d,p]=pP(null),f=(x,h)=>{if(x!==i){if(x===""||e.isStored(x)){e.selectTarget(x);return}p({code:x,anchor:h})}};dP(()=>{a.isOpen&&p(null)},[a.isOpen,e.taskSeq]);let g=Ml(Io,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[bt(Io,{sx:{display:"flex",flexWrap:"wrap",gap:.75},children:[{code:"",label:n("translate.original")},...qb].map(x=>bt(fP,{label:x.label,clickable:!0,icon:x.code&&e.isStored(x.code)?bt(ep,{sx:{fontSize:16}}):void 0,onClick:h=>f(x.code,h.currentTarget),color:i===x.code?"primary":"default",variant:i===x.code?"filled":"outlined",sx:{fontSize:14,height:30}},x.code||"__source__"))}),bt(bP,{open:!!d,anchorEl:d?.anchor??null,title:n("translate.startConfirm",{value:qb.find(x=>x.code===d?.code)?.label??""}),confirmText:n("translate.start"),cancelText:n("common.cancel"),placement:"bottom-start",onCancel:()=>p(null),onConfirm:()=>{d&&e.selectTarget(d.code),p(null)}}),i?s?bt(Io,{sx:{minHeight:200,display:"flex",alignItems:"center",justifyContent:"center"},children:bt($c,{})}):c?bt(Io,{sx:{fontSize:15,color:"#c62828",py:2},children:c}):l?Ml(Io,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[l.summary?Ml(Io,{sx:{position:"relative",display:"flex",alignItems:"center",gap:2,px:1.5,pr:5,py:1.25,bgcolor:"#eef4ff",border:"1px solid #c7d7fe",borderRadius:1},children:[bt(xP,{title:n("translate.copySummary"),arrow:!0,children:bt(gP,{size:"small","aria-label":n("translate.copySummary"),onClick:e.copySummary,sx:{position:"absolute",top:4,right:4,color:"#64748b"},children:m?bt(ep,{sx:{fontSize:18,color:"#2f9e5b"}}):bt(Ab,{sx:{fontSize:18}})})}),bt(kP,{sx:{fontSize:30,color:"#2563eb",flexShrink:0,mx:1.5}}),Ml(Io,{sx:{flex:1,minWidth:0},children:[bt(Io,{sx:{fontSize:16,fontWeight:600,color:"#1e3a8a"},children:n("translate.aiNotice")}),bt(Io,{sx:{fontSize:15,color:"#111",mt:.25,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:l.summary})]})]}):null,bt(Io,{sx:{fontSize:18,fontWeight:700,color:"#111",wordBreak:"break-word"},children:l.title}),l.html?bt(Io,{sx:{fontSize:16,lineHeight:1.6,color:"#37352f",wordBreak:"break-word","& > p:first-of-type":{mt:0},"& > p:last-of-type":{mb:0},"& a[href]":{color:"#2563eb",textDecoration:"underline"},"& img":{maxWidth:"100%"}},dangerouslySetInnerHTML:{__html:l.html}}):bt(Io,{sx:{fontSize:16,lineHeight:1.6,color:"#37352f",whiteSpace:"pre-wrap"},children:l.text})]}):null:Ml(Io,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[bt(Io,{sx:{fontSize:18,fontWeight:700,color:"#111",wordBreak:"break-word"},children:t}),bt(Io,{sx:{fontSize:16,lineHeight:1.6,color:"#37352f",wordBreak:"break-word","& > p:first-of-type":{mt:0},"& > p:last-of-type":{mb:0},"& a[href]":{color:"#2563eb",textDecoration:"underline"},"& img":{maxWidth:"100%"}},dangerouslySetInnerHTML:{__html:o||"<p></p>"}})]})]});return bt(hP,{open:a.isOpen,onClose:a.close,width:760,title:n("translate.title"),locale:Ce(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-content-translate",maxContentHeight:"80vh",sectionContentPaddingTop:0,sections:[{id:"translate",showTitle:!1,children:g}],actions:{showCancelButton:!1,left:i&&l?bt(Lb,{variant:"outlined",color:"inherit",startIcon:u?bt(ep,{sx:{fontSize:18,color:"#2f9e5b"}}):bt(Ab,{sx:{fontSize:18}}),onClick:e.copyResult,sx:{minWidth:80,color:"#37352f",borderColor:"#d9d9d6"},children:n("common.copy")}):void 0,right:bt(Lb,{variant:"contained",onClick:a.close,sx:{minWidth:80},children:n("common.close")})}})}import{ConfirmActionPopper as aM}from"@ehfuse/mui-confirm-action";import{DatePicker as iM}from"@ehfuse/mui-datetime-picker";import{useState as TP}from"react";import{TextField as yP}from"@ehfuse/mui-form-controls";import{jsx as CP}from"react/jsx-runtime";function Nb({value:e,onCommit:t,onDraftChange:o,readOnly:a=!1}){L();let[r,i]=TP(null);return CP(yP,{value:r??e,placeholder:a?"":n("create.notePlaceholder"),fullWidth:!0,size:"medium",slotProps:{input:{readOnly:a}},onChange:l=>{i(l.target.value),o?.(l.target.value)},onBlur:()=>{r!==null&&r.trim()!==e&&t(r),i(null)},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&i(null)},sx:{mt:1}})}import{Box as La,Button as SP}from"@mui/material";import vP from"@mui/icons-material/PieChartOutlineOutlined";import BP from"@mui/icons-material/PersonOutlineOutlined";import _P from"@mui/icons-material/PeopleAltOutlined";import{PropertyGrid as IP,PropertyInput as wP}from"@ehfuse/mui-form-controls";import{jsx as qo,jsxs as Vc}from"react/jsx-runtime";function DP(e){return e.getFormValue("contributions")??{}}function EP({form:e,participants:t}){L();let o=e.useFormValue("contributions")??{},a=Am(o,t),r=a===100;return Vc(La,{component:"span","data-testid":"task-contribution-total",sx:{fontSize:14,fontWeight:400,color:r?"#787774":"error.main",whiteSpace:"nowrap"},children:[n("section.total")," ",a,"%",r?"":n("section.mustBe100")]})}function Fb({form:e,participants:t,readOnly:o,avatarSrcByName:a,onSave:r}){L();let i=()=>{let s=DP(e);Am(s,t)===100&&r(qm(s,t))},l=()=>{let s=Lm(t.length),c={};t.forEach((u,m)=>{c[String(u.account_seq)]=String(s[m])}),e.setFormValue("contributions",c),r(qm(c,t))};return qo(Ao,{icon:qo(vP,{sx:{fontSize:18,display:"block"}}),title:n("section.contribution"),titleExtra:t.length>0?Vc(La,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:1,minWidth:0},children:[qo(EP,{form:e,participants:t}),!o&&t.length>1?qo(SP,{size:"small",onClick:l,sx:{fontSize:"0.875rem",flexShrink:0,whiteSpace:"nowrap"},children:n("section.splitEvenly")}):null]}):null,children:t.length===0?qo(La,{sx:{fontSize:14,color:"#9a9a97",py:.5},children:n("section.contributionHint")}):qo(cr,{name:"contributions",children:qo(IP,{children:t.map(s=>qo(ke,{icon:s.role==="manager"?qo(BP,{sx:{fontSize:17}}):qo(_P,{sx:{fontSize:17}}),label:s.role==="manager"?n("col.owner"):n("col.cc"),onClick:o?void 0:c=>c.querySelector("input")?.focus(),children:Vc(La,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%",minWidth:0},children:[qo(So,{names:[s.name],size:20,avatarSrcByName:a}),qo(La,{component:"span",sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name||n("workload.noName")}),Vc(La,{sx:{display:"inline-flex",alignItems:"baseline",flexShrink:0},children:[qo(wP,{form:e,name:`contributions.${s.account_seq}`,appearance:Ba,inputMode:"numeric",maxLength:3,placeholder:"0",readOnly:o,parse:c=>{let u=gs(c===""?"0":c);return u===null?null:String(u)},onCommit:()=>i(),sx:{flex:"0 0 auto",width:"3ch",textAlign:"right"}}),qo(La,{component:"span",sx:{ml:.25},children:"%"})]})]})},s.account_seq))})})})}import{useMemo as np,useState as RP}from"react";import{Box as xo,Button as $b,IconButton as PP}from"@mui/material";import MP from"@mui/icons-material/AccountTreeOutlined";import OP from"@mui/icons-material/LinkOutlined";import LP from"@mui/icons-material/Close";import AP from"@mui/icons-material/RedoOutlined";function Aa(e){return e.relations??[]}function FX(e,t,o){return Aa(e).some(a=>a.type===o&&a.task_seq===t.seq)||Aa(t).some(a=>a.type===o&&a.task_seq===e.seq)}function Hb(e){return`${e.created_time??""}|${String(e.seq).padStart(12,"0")}`}function tp(e,t){let o=new Map(t.map(g=>[g.seq,g]));o.set(e.seq,e);let a=new Map,r=(g,x)=>{a.has(g)||a.set(g,new Set),a.has(x)||a.set(x,new Set),a.get(g).add(x),a.get(x).add(g)};for(let g of o.values())for(let x of Aa(g))x.type==="follow_up"&&o.has(x.task_seq)&&r(g.seq,x.task_seq);let i=new Set([e.seq]),l=[e.seq];for(;l.length>0;){let g=l.shift();for(let x of a.get(g)??[])i.has(x)||(i.add(x),l.push(x))}let s=[...i].map(g=>o.get(g)).filter(g=>!!g).sort((g,x)=>Hb(g).localeCompare(Hb(x))),c=new Set;for(let g of Aa(e))g.type==="related"&&c.add(g.task_seq);for(let g of o.values())g.seq!==e.seq&&Aa(g).some(x=>x.type==="related"&&x.task_seq===e.seq)&&c.add(g.seq);let u=[...c].map(g=>o.get(g)).filter(g=>g!==void 0&&g.seq!==e.seq),m=[...o.values()].filter(g=>g.seq!==e.seq&&Aa(g).some(x=>x.type==="duplicate_of"&&x.task_seq===e.seq)),d=Aa(e).find(g=>g.type==="duplicate_of")?.task_seq,p=d?o.get(d)??null:null,f=[...o.values()].filter(g=>g.seq!==e.seq&&(g.checklist??[]).some(x=>Number(x.task_seq??0)===e.seq));return{lineage:s,related:u,duplicates:m,duplicateOf:p,parents:f}}function op(e,t){let o=tp(e,t);return(o.lineage.length>=2?o.lineage.length-1:0)+o.related.length+o.duplicates.length+(o.duplicateOf?1:0)+o.parents.length}function Wb(e,t){return op(e,t)>0}import{ConfirmActionPopper as qP}from"@ehfuse/mui-confirm-action";import{Fragment as zP,jsx as St,jsxs as En}from"react/jsx-runtime";function Uc({item:e,caption:t,onOpen:o,onUnlink:a}){L();let r=e.is_notice||e.is_event?Oe(e.icon||(e.is_notice?wt:zt)):null;return En(xo,{sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.5,borderRadius:1,"&:hover":{bgcolor:"#f7f7f5"},"&:hover .taskbox-relation-unlink":{opacity:1}},children:[t?St(xo,{component:"span",sx:{flexShrink:0,px:.6,py:.1,borderRadius:.75,fontSize:11.5,fontWeight:500,color:"#8a6d1d",bgcolor:"#faf1d7"},children:t}):null,r?St(r,{sx:{fontSize:16,flexShrink:0,color:e.icon_color||"#1e3a8a"}}):null,En(xo,{component:"span",onClick:o,sx:{flex:1,minWidth:0,fontSize:14,color:e.completed?"#9a9a97":"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...o?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}},children:[e.ticket_no?`${e.ticket_no} `:"",e.title]}),St(Ve,{option:Nt(e),small:!0}),a?St(PP,{className:"taskbox-relation-unlink",size:"small","aria-label":n("section.unlink"),onClick:a,sx:{opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:St(LP,{sx:{fontSize:15}})}):null]})}function Vb({task:e,tasks:t,readOnly:o=!1,onOpenTask:a,onLink:r,onUnlink:i,onCreateFollowUp:l}){L();let s=kl({onSubmit:(x,h)=>r?.(e.seq,x,h)}),[c,u]=RP(null),m=np(()=>tp(e,t),[e,t]),d=m.lineage.length>=2,p=np(()=>op(e,t),[e,t]),f=np(()=>{let x=new Set;for(let h of m.lineage)x.add(h.seq);for(let h of m.related)x.add(h.seq);for(let h of m.duplicates)x.add(h.seq);for(let h of m.parents)x.add(h.seq);return m.duplicateOf&&x.add(m.duplicateOf.seq),[...x]},[m]),g=(x,h,E)=>{u({anchorEl:x,targetSeq:h,type:E})};return En(Ao,{icon:St(MP,{sx:{fontSize:19,display:"block"}}),title:En(zP,{children:[n("section.relatedTasks"),p>0?St(xo,{component:"span",sx:{fontSize:12.5,color:"#9a9a97"},children:p}):null]}),titleExtra:o?null:En(xo,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:.5},children:[l?St($b,{size:"small",color:"inherit",startIcon:St(AP,{sx:{fontSize:16}}),onClick:()=>l(e.seq),sx:{minWidth:0,px:1,fontSize:12.5,color:"#787774"},children:n("section.followUps")}):null,r?St($b,{size:"small",color:"inherit",startIcon:St(OP,{sx:{fontSize:16}}),onClick:s.openDialog,sx:{minWidth:0,px:1,fontSize:12.5,color:"#787774"},children:n("link.confirm")}):null]}),children:[En(xo,{sx:{display:"flex",flexDirection:"column",mt:.5,pl:3.25},children:[d?St(xo,{sx:{mb:m.related.length||m.duplicates.length||m.duplicateOf?1:0},children:m.lineage.map((x,h)=>{let E=x.seq===e.seq,b=h===m.lineage.length-1;return En(xo,{sx:{display:"flex",gap:1},children:[En(xo,{sx:{display:"flex",flexDirection:"column",alignItems:"center",width:14,flexShrink:0,pt:1.1},children:[St(xo,{sx:{width:E?9:7,height:E?9:7,borderRadius:"50%",bgcolor:E?"#2f80ed":x.completed?"#9a9a97":"#c9c8c5",flexShrink:0}}),b?null:St(xo,{sx:{width:"2px",flex:1,bgcolor:"#e6e6e3"}})]}),En(xo,{sx:{flex:1,minWidth:0,pb:b?0:.5},children:[En(xo,{sx:{display:"flex",alignItems:"center",gap:.75},children:[En(xo,{component:"span",onClick:!E&&a?()=>a(x.seq):void 0,sx:{minWidth:0,fontSize:14,fontWeight:E?600:400,color:E?"#2f80ed":x.completed?"#9a9a97":"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...!E&&a?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}},children:[x.ticket_no?`${x.ticket_no} `:"",x.title]}),St(Ve,{option:Nt(x),small:!0})]}),St(xo,{sx:{fontSize:12,color:"#9a9a97"},children:x.completed&&x.completed_time?n("section.completedAt",{completed_time:x.completed_time}):x.created_time??""})]})]},x.seq)})}):null,m.parents.map(x=>St(Uc,{item:x,caption:n("section.parentTask"),onOpen:a?()=>a(x.seq):void 0},`parent-${x.seq}`)),m.duplicateOf?St(Uc,{item:m.duplicateOf,caption:n("section.original"),onOpen:a?()=>a(m.duplicateOf.seq):void 0,onUnlink:!o&&i?x=>g(x.currentTarget,m.duplicateOf.seq,"duplicate_of"):void 0}):null,m.duplicates.map(x=>St(Uc,{item:x,caption:n("section.duplicate"),onOpen:a?()=>a(x.seq):void 0,onUnlink:!o&&i?h=>g(h.currentTarget,x.seq,"duplicate_of"):void 0},`dup-${x.seq}`)),m.related.map(x=>St(Uc,{item:x,onOpen:a?()=>a(x.seq):void 0,onUnlink:!o&&i?h=>g(h.currentTarget,x.seq,"related"):void 0},`rel-${x.seq}`)),p===0?St(xo,{sx:{px:1.25,py:.75,fontSize:13.5,color:"#9a9a97"},children:n("section.noLinks")}):null]}),r?St(Sc,{controller:s,task:e,tasks:t,excludeSeqs:f}):null,St(qP,{open:!!c,anchorEl:c?.anchorEl??null,title:n("section.unlinkConfirm"),confirmText:n("task.unmark"),onCancel:()=>u(null),onConfirm:()=>{c&&i?.(e.seq,c.targetSeq,c.type),u(null)}})]})}import{Fragment as vt,jsx as H,jsxs as ze}from"react/jsx-runtime";function ta({label:e=n("menu.empty")}){return L(),H(tt,{component:"span",sx:{color:"#9a9a97"},children:e})}function Qb({store:e}){return H(vt,{children:xs(e)})}function lM({store:e}){let t=xs(e);return t==null||t===!1?null:H(tt,{sx:[In(13),lt(2)],children:t})}function Jb({store:e,children:t}){return H(vt,{children:t(xs(e))})}function sM(e){let t=Kc(e);t.current=e;let o=Kc(new Map),a={};for(let[r,i]of Object.entries(e)){if(typeof i!="function"){a[r]=i;continue}let l=o.current.get(r);l||(l=(...s)=>t.current[r]?.(...s),o.current.set(r,l)),a[r]=l}return a}function sp(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((o,a)=>o===t[a]||sp(o,t[a]));if(e&&t&&typeof e=="object"&&typeof t=="object"&&Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype)try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}return!1}var cM=new Set([...$a,"reminder","is_read"]);function mM(e,t){if(e===t)return!0;let o=!!(e.is_bug||t.is_bug),a=e,r=t,i=new Set([...Object.keys(a),...Object.keys(r)]);for(let l of i)if(!(cM.has(l)&&!(o&&l==="status"))&&!sp(a[l],r[l]))return!1;return!0}function uM(e,t){let o=e,a=t,r=new Set([...Object.keys(o),...Object.keys(a)]);for(let i of r){let l=o[i],s=a[i];if(i==="task"){if(!mM(l,s))return!1;continue}if(typeof l=="function"||typeof s=="function"){if(typeof l!=typeof s)return!1;continue}if(!sp(l,s))return!1}return!0}function dM({form:e,task:t,locked:o,options:a,onSelect:r}){L();let[i,l]=zo(null);return ze(vt,{children:[H(ke,{icon:H(QP,{sx:{fontSize:17}}),label:n("col.status"),onClick:o?void 0:s=>l(s),children:H(Wo,{form:e,name:"status",children:s=>H(Wo,{form:e,name:"resolution",children:c=>H(Ve,{option:Nt({...t,status:s,resolution:c})})})})}),H(Ka,{anchorEl:i,value:e.getFormValue("status"),options:a,onSelect:r,onClose:()=>l(null)})]})}function pM({form:e,locked:t,labelOptions:o,onChange:a,onAddLabel:r}){L();let[i,l]=zo(null);return H(Wo,{form:e,name:"label_keys",children:s=>ze(vt,{children:[H(ke,{icon:H(JP,{sx:{fontSize:17}}),label:n("dialog.label"),onClick:t?void 0:c=>l(c),children:s.length>0?H(Wr,{labelKeys:s,labelOptions:o}):H(ta,{})}),H(Dc,{anchorEl:i,selectedKeys:s,labelOptions:o,onToggle:c=>a(_s(s,c)),onAddLabel:r,onClose:()=>l(null)})]})})}function Zb({leadingContent:e,contentTitleExtra:t,propertyExtra:o,relatedTasksPool:a,...r}){let i=Fm(r.task),l=Qi(e),s=Qi(t),c=Qi(o),u=Qi(a),m=Kc({leading:l,titleExtra:s,propertyExtra:c,pool:u}),d=sM(r);return H(Hm.Provider,{value:i,children:H(fM,{...d,slots:m.current})})}var fM=NP(function({slots:t,task:o,customTabs:a,statusOptions:r,avatarSrcByName:i,onChangeStatus:l,onChangeLabels:s,onAddLabelOption:c,onChangeProject:u,onAddProject:m,onChangeDate:d,onChangeReminder:p,onMemberEdit:f,onChangePriority:g,onChangeVisibility:x,onChangeRepeat:h,departments:E=[],onChangeEventTime:b,onChangeEventPlace:B,onChangeEventAddress:T,onChangeNote:z,onChangeNoteDraft:k,onChangeContent:_,contentTemplates:D,onSaveContentTemplate:F,onRemoveContentTemplate:R,contentLoading:C=!1,onAddChecklistItem:y,onToggleChecklistItem:I,onRemoveChecklistItem:S,onUpdateChecklistItem:O,onReorderChecklist:w,onConvertChecklistToTask:q,onOpenChecklistTask:v,onLinkChecklistTask:M,resolveChecklistTask:j,onOpenRelatedTask:V,onLinkRelatedTask:Z,onUnlinkRelatedTask:ae,onCreateFollowUpTask:me,onAddAttachments:U,onRemoveAttachment:ee,onReorderAttachments:$,onPreview:G,onDownload:re,onUpdateComment:Ee,onRemoveComment:ct,onToggleCommentReaction:se,currentUserName:Q="",myAccountSeq:W=0,headerless:X=!1,noticeAdmin:ie=!1,hideProject:de=!1,hideProperties:we=!1,postMode:Se=!1,hideLabel:_t=!1,showTitle:He=!1,displayTitle:De,onChangeTitle:mt,onToggleCompleted:Ge,onChangeIcon:so,onChangeIconColor:ht,employees:te=[],onAckConfirm:Be,onRequestConfirm:Je,onChangeBugField:qe,sprints:en=[],sprintProject:Ar=!1,hideSprint:co=!1,onChangeSprint:tr,onChangeStoryPoints:xn,onChangeResolution:or,onClaimTask:Vt,onVerifyBug:bn,contributionEnabled:jt=!1,onChangeContributions:nr}){L();let{form:ut,getTask:Ro}=Wm(),[hn,nt]=zo(null),[On,Pe]=zo(!1),K=Kc(!1),[P,ce]=zo(null),[ge,Ze]=zo(null),[je,rt]=zo(null),[It,Zt]=zo(!1),At=Se?void 0:{[Tr]:It?{maxHeight:120,opacity:1,overflow:"hidden",transition:"max-height 0.25s ease, opacity 0.2s ease"}:{minHeight:0,maxHeight:0,opacity:0,overflow:"hidden",pointerEvents:"none",transition:"max-height 0.25s ease, opacity 0.2s ease"}},[Yt,rr]=zo(null),[ar,ir]=zo(null),[qr,lr]=zo(null),[Li,Ne]=zo(null),[zr,Fo]=zo(null),qt=!!o.is_notice,$e=!!o.is_event,Po=!!o.is_bug,Ho=!!Vt&&zs(o,W),{onReturnTask:Ln,onReviewDone:os,editPolicy:ns,translateContent:Ai,contentTranslate:rs}=le(),yo=X&&!!os&&!!Ln&&oo(o,W),[za,ma]=zo(null),ua=!!(Ai&&rs),An=Zd({taskSeq:o.seq,translatedTargets:o.translated_targets??[]}),qi=!!Vt&&Ns(o,W),zi=!!bn&&Po&&!!o.completed&&W>0&&(o.author_account_seq??0)===W&&!(o.acks??[]).some(N=>N.account_seq===W),kn=!Hn(o,W),mo=Ur(o,W,ns),as=!we&&!Se&&!o.is_event&&(o.is_notice?W>0&&(o.author_account_seq??0)===W:(o.author_account_seq??0)===W||(o.manager_account_seq??0)===W),Na=o.is_notice||o.is_event?Oe(o.icon||(o.is_notice?wt:zt)):null,Fa=qt?!qs(o,W):kn,Ha=Ho||qi?ze(Uo,{onClick:N=>Fo(N.currentTarget),children:[H(oM,{sx:{fontSize:16,mr:.5}}),n("col.claim")]}):null,ym=qt?Ec(o,te):"",eo=qt?Xx(o,te,W):null,to=qt?null:$n(o,W),Co=Mb(o.content??""),tn=Ob(o.seq,!!(to?.canConfirm&&Be),Co,()=>Be?.(o.seq)),is=Math.max(1,Math.ceil((1-tn)*Co/1e3)),Cm=!!(to&&to.total>0||qt&&eo),Ni=(o.origin_license_seq??0)>0,ls=!qt&&!Ni,Wa=we||Se,da=Se&&ln(o)==="all"&&(o.receiver_names??[]).length===0,Fi=ze(vt,{children:[H(ke,{icon:H(ZP,{sx:{fontSize:17}}),label:n("col.author"),sx:[In(9),At??null,...$e?[]:[lt(1)]],children:o.created_by?ze(vt,{children:[H(So,{names:[o.created_by],size:20,avatarSrcByName:i}),o.created_by]}):H(ta,{})}),H(ke,{icon:H(Gb,{sx:{fontSize:17}}),label:n("col.createdTime"),sx:[In(11),At??null,...$e?[]:[lt(da?1:2)]],children:o.created_time?Vo(o.created_time):H(ta,{})})]});return ze(vt,{children:[He?ze(tt,{sx:{px:2,pt:2,pb:.5,display:"flex",alignItems:"flex-start",gap:1},children:[as?H(FP,{checked:o.completed,icon:H(XP,{sx:{fontSize:22,color:"#9a9a97",opacity:.45}}),checkedIcon:H(ip,{sx:{fontSize:22,color:"#2f80ed"}}),onChange:(N,Ye)=>{ge||Ze({anchorEl:N.currentTarget,nextCompleted:Ye})},sx:{p:0,mt:.25}}):null,Na?$e&&!kn?H(Ub,{onClick:N=>ce(N.currentTarget),sx:{display:"flex",p:.25,mt:.1,borderRadius:1,color:o.icon_color||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:H(Na,{sx:{fontSize:20}})}):H(tt,{sx:{display:"flex",p:0,mt:.25,color:o.icon_color||(qt?"#e5484d":"#1e3a8a")},children:H(Na,{sx:{fontSize:20}})}):null,H(tt,{sx:{flex:1,minWidth:0},children:hn!==null?H(tt,{component:"div",contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,ref:N=>{if(!N||N.dataset.focused)return;N.dataset.focused="1",N.focus();let Ye=document.createRange();Ye.selectNodeContents(N),Ye.collapse(!1);let qn=window.getSelection();qn?.removeAllRanges(),qn?.addRange(Ye)},onBlur:N=>{let Ye=(N.currentTarget.textContent??"").replace(/\n/g," ").trim();!K.current&&Ye&&Ye!==Ro().title&&mt(o.seq,Ye),K.current=!1,nt(null)},onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),N.target.blur()),N.key==="Escape"&&(K.current=!0,N.target.blur())},onPaste:N=>{N.preventDefault();let Ye=N.clipboardData.getData("text/plain").replace(/\n/g," ");document.execCommand("insertText",!1,Ye)},sx:{outline:"none",fontSize:19,fontWeight:600,color:o.completed?"#9a9a97":"#37352f",lineHeight:"26px",cursor:"text",userSelect:"text",wordBreak:"break-word"},children:hn}):H(tt,{onClick:mo||De?void 0:()=>nt(String(ut.getFormValue("title")??"")),sx:{fontSize:19,fontWeight:600,color:o.completed?"#9a9a97":"#37352f",lineHeight:"26px",cursor:mo||De?"default":"text",userSelect:"text",wordBreak:"break-word"},children:De||H(Wo,{form:ut,name:"title",children:N=>N})})}),H(Oo,{open:!!ge,anchorEl:ge?.anchorEl??null,nextCompleted:ge?.nextCompleted??!1,returnMode:!!Ln&&oo(o,W),onCancel:()=>Ze(null),onConfirm:N=>{ge&&(N&&Ln?Ln(Ro(),N):Ge(o.seq,ge.nextCompleted)),Ze(null)}})]}):null,ze(tt,{sx:{py:1.5,display:"flex",flexDirection:"column",gap:0,[Tr]:{pb:0,"& > :last-child":{mb:0}}},children:[we?null:ze(vt,{children:[H(gc,{form:ut,hideProject:de,hideManager:Se,hideReceivers:da,hideStartDate:Se,hideReminder:Se,hidePriority:Se,pinColumns:!0,projectColumn:!$e&&!_t?2:"full",values:{tabKey:o.tab_key??"",managerName:Se?o.manager_name||o.author_name||"":o.manager_name,receiverNames:o.receiver_names,startDate:o.start_date,dueDate:o.due_date,reminders:nn(o),priority:o.priority,eventTime:o.event_time??"",eventPlace:o.event_place??"",eventAddress:o.event_address??""},customTabs:a,avatarSrcByName:Hs(o,i),hideDueDate:Se||!$e&&!!o.repeat_rule,notice:qt,event:$e,readOnly:kn,coreLocked:mo,targetSummary:ym,onChangeProject:N=>u(o.seq,N),onAddProject:m,onChangeStartDate:N=>d(o.seq,"start_date",N),onChangeDueDate:N=>d(o.seq,"due_date",N),onChangeReminder:N=>p(o.seq,N),onChangePriority:N=>g(o.seq,N),onChangeEventTime:N=>b?.(o.seq,N),onChangeEventPlace:N=>B?.(o.seq,N),onChangeEventAddress:N=>T?.(o.seq,N),onMemberEdit:N=>f(Ro(),N,null),narrowCollapsedSx:At,reminderLocked:o.completed,managerAction:Ha,supportOrigin:(o.origin_license_seq??0)>0?{licenseName:o.origin_license_name??"",authorName:o.origin_author_name||o.author_name||o.created_by||"",contactPhone:o.origin_contact_phone??"",contactEmail:o.origin_contact_email??"",supportType:Gs(o.support_type??"")}:void 0,leading:ze(vt,{children:[!Se&&(zi||Ha&&(qt||$e))?ze(tt,{sx:{gridColumn:"1 / -1",display:"flex",justifyContent:"flex-start",gap:2,px:2,py:1.5},children:[qt||$e?Ha:null,zi?ze(vt,{children:[H(qa,{variant:"contained",size:"large",onClick:()=>bn?.(o.seq,!0),sx:{bgcolor:"#2f80ed"},children:n("detail.bugVerified")}),H(qa,{variant:"outlined",size:"large",color:"error",onClick:()=>bn?.(o.seq,!1),children:n("detail.bugReopen")})]}):null]}):null,Po&&o.ticket_no?H(ke,{icon:H(KP,{sx:{fontSize:17}}),label:n("col.ticket"),sx:lt(1),children:H(tt,{component:"span",sx:{fontVariantNumeric:"tabular-nums"},children:o.ticket_no})}):null,$e||Se?null:H(tt,{sx:Po&&o.ticket_no||ls||Cm?lt(Po&&o.ticket_no?2:1):{gridColumn:"1 / -1"},children:H(dM,{form:ut,task:o,locked:kn||!!o.completed,options:qt?tl:Po?ga:ol,onSelect:N=>l(o.seq,N)})}),yo&&!Se?ze(ke,{icon:H(GP,{sx:{fontSize:17}}),label:n("board.review"),sx:{gridColumn:"1 / -1"},children:[H(Uo,{onClick:N=>Ze({anchorEl:N.currentTarget,nextCompleted:!1}),children:n("task.revert")}),H(qa,{size:"small",variant:"contained",disableElevation:!0,onClick:N=>{N.stopPropagation(),ma(N.currentTarget)},sx:{ml:1,...Gr},children:n("col.reviewDone")}),H(jr,{anchorEl:za,onCancel:()=>ma(null),onConfirm:()=>{os?.(Ro()),ma(null)}})]}):null,ls?(()=>{let N=ln(o),Ye=N==="all"?H(Yb,{sx:{fontSize:17,color:"#2f80ed"}}):N==="group"?H(Xb,{sx:{fontSize:17,color:"#d9730d"}}):H(jb,{sx:{fontSize:17}}),qn=N==="all"?n("create.visibilityPublic"):N==="group"?n("create.visibilityDept",{value:E.find(Hi=>Hi.seq===(o.visibility_group_seq??0))?.name??n("create.department")}):n("create.visibilityPrivate");return H(tt,{sx:$e?void 0:lt(Po||Se?1:2),children:H(ke,{icon:Ye,label:H(Rc,{}),onClick:mo||!x?void 0:Hi=>rr(Hi),children:qn})})})():null,!Po&&!Ni&&!Se?H(tt,{sx:$e?void 0:lt(1),children:H(ke,{icon:H(nM,{sx:{fontSize:17,...o.repeat_rule?{color:"#2f80ed"}:{}}}),label:n("create.repeat"),onClick:mo||!h?void 0:N=>ir(N),children:o.repeat_rule?bs(o.repeat_rule):H(ta,{label:n("common.none")})})}):null,!Po&&!Se&&o.repeat_rule?H(tt,{sx:$e?void 0:lt(2),children:H(ke,{icon:H(rM,{sx:{fontSize:17}}),label:n("create.repeatUntil"),onClick:mo||!h?void 0:N=>lr(N),children:o.repeat_until?n("detail.repeatUntilValue",{repeat_until:o.repeat_until}):H(ta,{})})}):null,!Se&&to&&to.total>0?H(tt,{sx:$e?void 0:lt(2),children:H(ke,{icon:H(lp,{sx:{fontSize:17}}),label:n("task.confirm"),children:to.canConfirm?ze(tt,{sx:{display:"inline-flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[H(qa,{size:"small",variant:"contained",onClick:()=>Be?.(o.seq),sx:{py:.1,px:1.25,minWidth:0,color:"#fff",bgcolor:"#2f80ed",backgroundImage:`linear-gradient(to right, #1a5fc4 ${tn*100}%, transparent ${tn*100}%)`,boxShadow:"none","&:hover":{bgcolor:"#1e6fd9",boxShadow:"none"}},children:n("task.confirm")}),H(tt,{component:"span",sx:{fontSize:14,color:"text.secondary",whiteSpace:"nowrap"},children:n("detail.autoConfirmIn",{seconds:is})})]}):ze(qa,{size:"small",variant:"outlined",color:"inherit",startIcon:to.myTime?H(ip,{sx:{fontSize:"16px !important",color:"#2f80ed"}}):null,onClick:N=>rt({anchorEl:N.currentTarget,open:!0}),sx:{py:.1,px:1.25,minWidth:0,fontSize:13,color:"text.primary",borderColor:"#d5d8dc",bgcolor:"#fff",whiteSpace:"nowrap"},children:[to.count," / ",to.total]})})}):null,qt&&eo?H(tt,{sx:lt(2),children:H(ke,{icon:H(lp,{sx:{fontSize:17}}),label:n("task.confirm"),children:H(tt,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,minWidth:0},children:eo.canAck?H(qa,{size:"small",variant:"contained",onClick:()=>Be?.(o.seq),sx:{py:.1,px:1.25,minWidth:0,color:"#fff",bgcolor:"#2f80ed",boxShadow:"none","&:hover":{bgcolor:"#1e6fd9",boxShadow:"none"}},children:n("task.confirm")}):H(qa,{size:"small",variant:"outlined",color:"inherit",startIcon:eo.acked?H(ip,{sx:{fontSize:"16px !important",color:"#2f80ed"}}):null,onClick:N=>rt({anchorEl:N.currentTarget,open:!0}),sx:{py:.1,px:1.25,minWidth:0,fontSize:13,color:"text.primary",borderColor:"#d5d8dc",bgcolor:"#fff",whiteSpace:"nowrap"},children:eo.total>0&&eo.count>=eo.total?n("common.done"):ze(vt,{children:[eo.count,H(tt,{component:"span",sx:{mx:.4},children:"/"}),eo.total]})})})})}):null,Ar&&!co&&!$e&&!qt&&!Se?ze(vt,{children:[H(ke,{icon:H(jP,{sx:{fontSize:17}}),label:n("col.goal"),onClick:mo?void 0:N=>Ne(N),sx:lt(1),children:H(Wo,{form:ut,name:"sprint_seq",children:N=>N>0?en.find(Ye=>Ye.seq===N)?.name??n("detail.deletedSprint"):H(ta,{label:n("board.unassigned")})})}),H(ke,{icon:H(YP,{sx:{fontSize:17}}),label:"\uD3EC\uC778\uD2B8",sx:lt(2),children:H(cr,{name:"story_points",children:H(Wo,{form:ut,name:"story_points",children:N=>H(yr,{value:N>0?String(N):"",placeholder:n("create.notEstimated"),readOnly:mo,onCommit:Ye=>xn?.(o.seq,Number(Ye.replace(/[^0-9.]/g,""))||0)})})})})]}):null,$e||_t?null:H(tt,{sx:[Se?lt(2):de?{gridColumn:"1 / -1"}:lt(1),At??null],children:H(pM,{form:ut,locked:kn,labelOptions:r,onChange:N=>s(o.seq,N),onAddLabel:c})})]}),afterProject:$e?null:ze(vt,{children:[Fi,H(lM,{store:t.propertyExtra})]}),trailing:ze(vt,{children:[Po?H(xc,{form:ut,values:{repro:o.bug_repro??"",device:o.bug_device??"",where:o.bug_where??"",version:o.bug_version??"",resolution:o.resolution??""},readOnly:mo,showResolution:!!o.completed,onChangeRepro:N=>qe?.(o.seq,"bug_repro",N),onChangeDevice:N=>qe?.(o.seq,"bug_device",N),onChangeWhere:N=>qe?.(o.seq,"bug_where",N),onChangeVersion:N=>qe?.(o.seq,"bug_version",N),onChangeResolution:N=>or?.(o.seq,N)}):null,$e?Fi:null,o.completed?ze(vt,{children:[H(ke,{icon:H(lp,{sx:{fontSize:17}}),label:n("detail.completedBy"),sx:[In(10),At??null,...$e?[]:[lt(1)]],children:o.completed_by?ze(vt,{children:[H(So,{names:[o.completed_by],size:20,avatarSrcByName:i}),o.completed_by]}):H(ta,{})}),H(ke,{icon:H(Gb,{sx:{fontSize:17}}),label:n("col.completedTime"),sx:[In(12),At??null,...$e?[]:[lt(2)]],children:o.completed_time?Vo(o.completed_time):H(ta,{})})]}):null]})}),ze(tt,{sx:{display:"none",[Tr]:{display:Se?"none":"block",mt:1.5,mb:0}},children:[H(ea,{sx:{borderColor:"#e6e6e3"}}),H(Ub,{onClick:()=>Zt(N=>!N),sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:.5,pt:1.25,pb:1.25,fontSize:13.5,bgcolor:"#f4f4f2",color:"#37352f","&:active":{opacity:.6}},children:It?ze(vt,{children:[n("detail.collapse")," ",H(VP,{sx:{fontSize:18}})]}):ze(vt,{children:[n("detail.moreInfo")," ",H(UP,{sx:{fontSize:18}})]})})]})]}),H(Qb,{store:t.leading}),ze(tt,{children:[H(ea,{sx:{my:1.5,borderColor:"#e6e6e3",[Tr]:{mt:0,mb:1.25}}}),H(Ao,{icon:H(eM,{sx:{fontSize:18,display:"block"}}),title:n("common.content"),titleExtra:ze(vt,{children:[H(Qb,{store:t.titleExtra}),H(yc,{content:o.content??"",templates:D??[],onApply:N=>_?.(o.seq,N),onSave:F,onRemove:R,readOnly:mo||!D}),On&&!mo?H(WP,{title:n("section.finishEditingTooltip"),arrow:!0,children:H(HP,{size:"small","aria-label":n("section.finishEditing"),onMouseDown:N=>N.preventDefault(),onClick:()=>Pe(!1),sx:{color:"#2f9e5b"},children:H($P,{sx:{fontSize:19}})})}):null]}),children:H(tt,{sx:{userSelect:"text"},children:C?H(tt,{sx:{minHeight:180,display:"flex",alignItems:"center",justifyContent:"center"},children:H($c,{})}):H(hc,{syncKey:o.seq,value:o.content??"",readOnly:mo,viewFirst:!0,editing:On,onEditingChange:Pe,onTranslate:ua?An.openDialog:void 0,onChange:N=>_(o.seq,N)})})}),o.is_bug||Wa?null:ze(vt,{children:[H(ea,{sx:{my:1.5,borderColor:"#e6e6e3"}}),H(Ao,{icon:H(tM,{sx:{fontSize:18,display:"block"}}),title:n("col.note"),children:H(tt,{sx:{userSelect:"text"},children:H(cr,{name:"note",children:H(Wo,{form:ut,name:"note",children:N=>H(Nb,{value:N,readOnly:Fa,onCommit:Ye=>z(o.seq,Ye),onDraftChange:k?Ye=>k(o.seq,Ye):void 0})})})})})]}),jt&&nr&&!$e&&!qt&&!Wa?ze(vt,{children:[H(ea,{sx:{my:1.5,borderColor:"#e6e6e3"}}),H(Fb,{form:ut,participants:Om(o),readOnly:kn,avatarSrcByName:i,onSave:N=>nr(o.seq,N)})]}):null,$e||Wa?null:ze(vt,{children:[H(ea,{sx:{my:1.5,borderColor:"#e6e6e3"}}),H(Jb,{store:t.pool,children:N=>H(vc,{taskSeq:o.seq,checklist:o.checklist??[],removeLocked:Fa,onAdd:y,onToggle:I,confirmOnToggle:!0,onRemove:S,onUpdate:O,onReorder:w,onConvertToTask:q,onOpenLinkedTask:v,resolveLinkedTask:j,myAccountSeq:W,linkCandidates:N,linkBaseTask:o,onLinkExistingTask:M})})]}),H(Jb,{store:t.pool,children:N=>N&&!Wa&&!$e&&!qt&&(!kn||Wb(o,N))?ze(vt,{children:[H(ea,{sx:{my:1.5,borderColor:"#e6e6e3"}}),H(Vb,{task:o,tasks:N,readOnly:kn,onOpenTask:V,onLink:Z,onUnlink:ae,onCreateFollowUp:me})]}):null}),H(ea,{sx:{my:1.5,borderColor:"#e6e6e3"}}),H(Ic,{taskSeq:o.seq,attachments:o.attachments??[],removeLocked:qt?Fa:mo,onAdd:U,onRemove:ee,onReorder:$,onPreview:G?(N,Ye)=>G({...N,taskSeq:o.seq},Ye?.map(qn=>({...qn,taskSeq:o.seq}))):void 0,onDownload:re?N=>re({...N,taskSeq:o.seq}):void 0})]}),H(ea,{sx:{my:1.5,borderColor:"#e6e6e3"}}),H(Ib,{taskSeq:o.seq,comments:o.comments??[],currentUserName:Q,myAccountSeq:W,avatarSrcByName:i,onUpdate:Ee,onRemove:ct,onToggleReaction:se,onPreview:G?(N,Ye)=>G({...N,taskSeq:o.seq},Ye?.map(qn=>({...qn,taskSeq:o.seq}))):void 0,onDownload:re?N=>re({...N,taskSeq:o.seq}):void 0})]}),ua?H(Wo,{form:ut,name:"title",children:N=>H(zb,{controller:An,title:N,html:o.content??""})}):null,H(rp,{transitionDuration:0,anchorEl:ar,open:!!ar,onClose:()=>ir(null),children:[{value:"",label:n("common.none")},...Ji].map(N=>H(ap,{selected:(o.repeat_rule??"")===N.value,onClick:()=>{ir(null),nu(Ro(),N.value,h)},sx:{fontSize:14,minWidth:140},children:N.label},N.value||"none"))}),H(iM,{anchorEl:qr,open:!!qr,onClose:()=>lr(null),selectedDate:o.repeat_until?new Date(`${o.repeat_until}T00:00:00`):new Date,onDateChange:N=>{lr(null),ru(Ro(),N,h)}}),H(rp,{transitionDuration:0,anchorEl:Yt,open:!!Yt,onClose:()=>rr(null),children:[{key:"involved",label:n("create.visibilityPrivate"),icon:H(jb,{sx:{fontSize:17,color:"#57564f"}}),selected:ln(o)==="involved",onPick:()=>x?.(o.seq,"involved",0)},{key:"all",label:n("create.visibilityPublic"),icon:H(Yb,{sx:{fontSize:17,color:"#2f80ed"}}),selected:ln(o)==="all",onPick:()=>x?.(o.seq,"all",0)},...E.map(N=>({key:`group-${N.seq}`,label:n("create.visibilityDeptName",{name:N.name}),icon:H(Xb,{sx:{fontSize:17,color:"#d9730d"}}),selected:ln(o)==="group"&&(o.visibility_group_seq??0)===N.seq,onPick:()=>x?.(o.seq,"group",N.seq)}))].map(N=>ze(ap,{selected:N.selected,onClick:()=>{N.onPick(),rr(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[N.icon,N.label,N.selected?H(Kb,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},N.key))}),H(rp,{transitionDuration:0,anchorEl:Li,open:!!Li,onClose:()=>Ne(null),children:[{seq:0,label:n("board.unassigned")},...en.filter(N=>`custom-${N.group_seq}`===String(ut.getFormValue("tab_key")??"")).map(N=>({seq:N.seq,label:sn(N)}))].map(N=>ze(ap,{onClick:()=>{tr?.(o.seq,N.seq),Ne(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[N.label,Number(ut.getFormValue("sprint_seq")??0)===N.seq?H(Kb,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},N.seq))}),H(Qs,{anchorEl:je?.anchorEl??null,open:!!je?.open,acks:o.acks??[],total:eo?.total??to?.total??0,pendingNames:eo?.pendingNames??to?.pendingNames??[],avatarSrcByName:i,onRequestConfirm:Je&&(eo?eo.count<eo.total:to&&to.count<to.total)?()=>{Je(o.seq),rt(N=>N?{...N,open:!1}:null)}:void 0,onClose:()=>rt(N=>N?{...N,open:!1}:null)}),H(Vr,{anchorEl:P,value:o.icon??"",color:o.icon_color??"",onSelect:N=>{so(o.seq,N),ce(null)},onSelectColor:ht?N=>ht(o.seq,N):void 0,onClose:()=>ce(null)}),H(aM,{open:!!zr,anchorEl:zr,title:Ho?n("table.claimTakeOverConfirm"):n("table.claimConfirm"),confirmText:n("col.claim"),onCancel:()=>Fo(null),onConfirm:()=>{Vt?.(o.seq),Fo(null)}})]})},uM);import{ConfirmActionPopper as BM}from"@ehfuse/mui-confirm-action";import{Fragment as rh,jsx as ot,jsxs as Ci}from"react/jsx-runtime";function WJ(){let e=new Date,t=o=>String(o).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}`}function $J({open:e,task:t,onClose:o,onAddComment:a,onSaveFields:r,presentation:i="auto",myAccountSeq:l=0,onToggleCompleted:s,onChangeTitle:c,onChangeIcon:u,onChangeIconColor:m,activityItems:d,activityLoading:p,onLoadActivity:f,onPrint:g,headerExtra:x,onDelete:h,canDelete:E,...b}){L();let B=We(),{form:T,baseTask:z,task:k,hasPendingChanges:_,stagedBodyProps:D,changeTitle:F,changeIcon:R,changeIconColor:C}=au({open:e,task:t,isMobile:B,bodyProps:b,onSaveFields:r,onChangeTitle:c,onChangeIcon:u,onChangeIconColor:m}),y=Rl({taskSeq:k?.seq??0,items:d,loading:p,onLoad:f}),[I,S]=oh(null),[O,w]=oh(null),{editPolicy:q,shareText:v}=le(),M=!!h&&(E??(z?!ha(z,l,q,!(l>0&&(z.author_account_seq??0)===l)):!1)),j=th(null);eh(()=>{j.current?.scrollTo({top:0})},[t?.seq]);let V=()=>{let G=j.current?.getScrollContainer();if(G){j.current?.scrollTo({top:G.scrollHeight,behavior:"smooth"});return}let re=document.querySelectorAll(".taskbox-comments");re[re.length-1]?.scrollIntoView({block:"end",behavior:"smooth"})},Z=th(!1),ae=k?.comments?.length??0;if(eh(()=>{Z.current&&(Z.current=!1,requestAnimationFrame(V))},[ae]),!z||!k)return null;let me=k,U=B||i==="dialog",ee=ot(Zb,{...D,headerless:U,task:me,myAccountSeq:l,onChangeTitle:F,onToggleCompleted:s,onChangeIcon:R,onChangeIconColor:C,showTitle:B||i==="dialog"}),$=ot(wb,{onSubmit:(G,re)=>{Z.current=!0,a(me.seq,G,re),requestAnimationFrame(V)}},me.seq);return U?Ci(rh,{children:[ot(vM,{open:e,onClose:o,backdropClick:!_,locale:Ce(),collapsibleTitle:!0,fontScale:{enabled:!0,default:1.1,min:.6},title:b.postMode?n("detail.kindPost"):me.is_notice?n("tab.notice"):me.is_event?n("kind.event"):me.is_bug?n("kind.bug"):n("kind.task"),titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1},custom:[...x?[{raw:!0,icon:ot(rh,{children:x(me)})}]:[],...B?[{raw:!0,icon:ot(gM,{variant:"contained",size:"small",disableElevation:!0,disabled:!_,onClick:_?()=>{T.submit()}:void 0,sx:{ml:1.5,height:32,minWidth:64,px:1.75,py:0,borderRadius:1,fontSize:14,fontWeight:600,bgcolor:"#2f80ed","&:hover":{bgcolor:"#2f80ed"},"&.Mui-disabled":{bgcolor:"#f2f2f0",color:"#c9c8c5"}},children:n("create.saveButton")})}]:[],{raw:!0,icon:ot(bM,{size:"small","aria-label":n("common.more"),onClick:G=>S(G.currentTarget),children:ot(kM,{sx:{color:"#6b7280"}})})}]},fullScreen:B,maxWidth:B?void 0:"md",width:B?void 0:720,mobilePresentation:B?"slide":void 0,tabs:{visible:!1},contentTopPadding:0,contentPaddingX:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,contentBottomPadding:0,scrollPastLastSection:!1,overlayScrollbar:{enabled:!0,contentStyle:{minWidth:0}},actions:{visible:!0,showCancelButton:!1,left:$},sx:{DialogContent:{borderBottom:"none"}},dialogActionSx:{padding:"0 !important","@media (max-width:1023.95px)":{padding:"0 !important"},borderTop:"1px solid #37352f","& .left-actions":{flex:1,width:"100%",minWidth:0,"& > *":{flex:1,minWidth:0}},"& .right-actions":{display:"none"}},sections:[{id:"task-detail",title:"",showTitle:!1,children:ot(Gc,{sx:{userSelect:"none",width:"100%",minWidth:0,display:"flex",flexDirection:"column",gap:0},children:ee})}]},z.seq),Ci(hM,{open:!!I,anchorEl:I,onClose:()=>S(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{zIndex:1500},children:[f?Ci(up,{onClick:()=>{S(null),y.openDialog()},children:[ot(cp,{children:ot(CM,{fontSize:"small"})}),ot(mp,{children:n("activity.title")})]}):null,Ci(up,{onClick:()=>{S(null),hi(me,!0,v)},children:[ot(cp,{children:ot(yM,{fontSize:"small"})}),ot(mp,{children:n("detail.share")})]}),M?Ci(up,{onClick:G=>{let re=I??G.currentTarget;S(null),w(re)},sx:{color:"#e5484d"},children:[ot(cp,{children:ot(TM,{fontSize:"small",sx:{color:"#e5484d"}})}),ot(mp,{children:n("common.delete")})]}):null]}),ot(BM,{open:!!O,anchorEl:O,title:n("detail.trashConfirm"),confirmText:n("common.delete"),onCancel:()=>w(null),onConfirm:()=>{w(null),h?.(me)}}),ot(Wc,{controller:y})]}):ot(xM,{anchor:"right",open:e,onClose:o,"aria-label":n("detail.taskDetail"),disableAutoFocus:!0,disableEnforceFocus:!0,sx:{zIndex:G=>G.zIndex.modal},slotProps:{paper:{sx:{width:720,maxWidth:"100vw"}}},children:Ci(Gc,{sx:{display:"flex",flexDirection:"column",height:"100%",userSelect:"none"},children:[ot(Pb,{task:me,myAccountSeq:l,onToggleCompleted:s,hideCompleted:!!(b.hideProperties||b.postMode),kindLabel:b.postMode?n("detail.kindPost"):void 0,displayTitle:b.displayTitle,onChangeTitle:c,onChangeIcon:u,onChangeIconColor:m,onClose:o,activityItems:d,activityLoading:p,onLoadActivity:f,onPrint:g,onDelete:h,canDelete:E,headerExtra:x}),ot(nh,{sx:{borderColor:"#e6e6e3"}}),ot(Gc,{sx:{flex:1,minHeight:0},children:ot(SM,{ref:j,style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:ee})}),ot(nh,{sx:{borderColor:"#37352f"}}),ot(Gc,{sx:{flexShrink:0},children:$})]})})}import{Box as wo,Button as gp,IconButton as ch}from"@mui/material";import{FormDialog as mh}from"@ehfuse/mui-form-dialog";import qM from"@mui/icons-material/Add";import zM from"@mui/icons-material/DirectionsRunOutlined";import NM from"@mui/icons-material/EditOutlined";import{ClearTextField as uh,DateTextField as dh,LabelSelect as ph}from"@ehfuse/mui-form-controls";import{Box as wr,Button as IM,FormControlLabel as dp,Radio as pp,RadioGroup as wM}from"@mui/material";import{FormDialog as DM}from"@ehfuse/mui-form-dialog";import{LabelSelect as EM}from"@ehfuse/mui-form-controls";import RM from"@ehfuse/overlay-scrollbar";import{useGlobalForm as _M}from"@ehfuse/forma";function ah({open:e,sprint:t,remainingTasks:o,sprints:a,onClose:r,onConfirm:i}){let l=a.filter(m=>m.seq!==t?.seq&&m.group_seq===(t?.group_seq??0)&&m.status!=="closed"),s=o.length>0,c=_M({formId:_e("taskbox-sprint-close-form"),initialValues:{mode:"backlog",moveToSeq:"0"},onValidate:m=>!(s&&m.mode==="move"&&!(Number(m.moveToSeq)>0)),onSubmit:m=>(i({mode:s?m.mode:"keep",moveToSprintSeq:m.mode==="move"&&Number(m.moveToSeq)||0,taskSeqs:o.map(d=>d.seq)}),!0)}),u={form:no({modalIdPrefix:"taskbox-sprint-close-dialog",open:e,onClose:r,onOpen:()=>c.setFormValues({mode:l.length>0?"move":"backlog",moveToSeq:String(l[0]?.seq??0)})})};return{form:c,modals:u,candidates:l,hasRemaining:s}}import{Fragment as PM,jsx as Jt,jsxs as jc}from"react/jsx-runtime";function ih({open:e,sprint:t,remainingTasks:o,sprints:a,onClose:r,onConfirm:i}){L();let{form:l,modals:s,candidates:c,hasRemaining:u}=ah({open:e,sprint:t,remainingTasks:o,sprints:a,onClose:r,onConfirm:i}),m=l.useFormValue("mode")??"backlog",d=Number(l.useFormValue("moveToSeq"))||0;return Jt(DM,{open:s.form.isOpen,onClose:s.form.close,maxWidth:"sm",title:n("sprint.closeTitle"),locale:Ce(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-close",tabs:{visible:!1},actions:{showCancelButton:!0,right:Jt(IM,{variant:"contained",onClick:()=>{l.submit()},disabled:u&&m==="move"&&!(d>0),children:n("sprint.closeButton")})},sections:[{id:"sprint-close",title:"",showTitle:!1,children:jc(wr,{sx:{display:"flex",flexDirection:"column",gap:2},children:[Jt(wr,{sx:{fontSize:18,color:"#37352f"},children:on("sprint.closeIntro",{name:Jt(wr,{component:"span",sx:{fontWeight:600},children:t?.name??""})})}),u?jc(PM,{children:[Jt(wr,{sx:{fontSize:15,color:"#6f6f6c"},children:n("sprint.remainingQuestion",{count:o.length})}),Jt(wr,{sx:{border:"1px solid #e6e6e3",borderRadius:1,overflow:"hidden"},children:Jt(RM,{style:{maxHeight:220},thumb:{width:6},children:o.map(p=>jc(wr,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,borderBottom:"1px solid #f2f2f0","&:last-of-type":{borderBottom:"none"}},children:[Jt(wr,{sx:{flex:1,minWidth:0,fontSize:16,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.title}),Jt(Ve,{option:Nt(p)})]},p.seq))})}),jc(wM,{value:m,onChange:(p,f)=>l.setFormValue("mode",f),children:[c.length>0?Jt(dp,{value:"move",control:Jt(pp,{size:"small"}),label:n("sprint.carryOver"),sx:{"& .MuiFormControlLabel-label":{fontSize:16}}}):null,m==="move"&&c.length>0?Jt(wr,{sx:{pl:4,pb:1},children:Jt(EM,{form:l,name:"moveToSeq",size:"small",label:"",fullWidth:!0,options:c.map(p=>({value:String(p.seq),label:p.name}))})}):null,Jt(dp,{value:"backlog",control:Jt(pp,{size:"small"}),label:n("sprint.moveToBacklog"),sx:{"& .MuiFormControlLabel-label":{fontSize:16}}}),Jt(dp,{value:"keep",control:Jt(pp,{size:"small"}),label:n("sprint.keepInGoal"),sx:{"& .MuiFormControlLabel-label":{fontSize:16}}})]})]}):Jt(wr,{sx:{fontSize:15,color:"#6f6f6c"},children:n("sprint.noRemaining")})]})}]})}var fp="custom-";function MM(e){return e.startsWith(fp)}function aZ(e){return e>0?`${fp}${e}`:""}function Rn(e){if(!MM(e))return 0;let t=Number(e.slice(fp.length));return Number.isInteger(t)&&t>0?t:0}import{useState as OM}from"react";import{useGlobalForm as LM,useModal as AM}from"@ehfuse/forma";import{ErrorAlert as lh}from"@ehfuse/alerts";var Yc={editingSeq:0,name:"",goal:"",start_date:"",end_date:""};function sh({open:e,customTabs:t,onClose:o,onCreate:a,onUpdate:r,onChangeStatus:i,tasks:l=[],onCloseSprint:s,onRemove:c}){L();let u=t.filter(B=>B.useSprints&&!B.archived),[m,d]=OM(null),p=m?l.filter(B=>(B.sprint_seq??0)===m.seq&&!B.completed):[],f=LM({formId:_e("taskbox-sprint-form"),initialValues:{groupKey:"",...Yc},onValidate:B=>Rn(B.groupKey)?String(B.name??"").trim()?!0:(lh(n("sprint.enterGoalName")),!1):(lh(n("sprint.selectProject")),!1),onSubmit:async B=>{let T={name:String(B.name).trim(),goal:String(B.goal??"").trim(),start_date:B.start_date??"",end_date:B.end_date??""};if(B.editingSeq>0)return r(B.editingSeq,T),g.form.close(),!0;let z=await a({group_seq:Rn(B.groupKey),...T});return z&&g.form.close(),z}}),g={manage:no({modalIdPrefix:"taskbox-sprint-manage-dialog",open:e,onClose:o,onOpen:()=>f.setFormValues({groupKey:u.length===1?u[0].key:"",...Yc})}),form:AM({modalId:_e("taskbox-sprint-form-dialog"),onClose:()=>f.setFormValues(Yc)})};return{form:f,modals:g,sprintTabs:u,closingSprint:m,remainingTasks:p,openCreateForm:()=>{f.setFormValues(Yc),g.form.open()},openEditForm:B=>{f.setFormValues({editingSeq:B.seq,groupKey:`custom-${B.group_seq}`,name:B.name,goal:B.goal,start_date:B.start_date,end_date:B.end_date}),g.form.open()},changeStatus:(B,T)=>{if(T==="closed"&&s){d(B);return}i(B.seq,T)},cancelCloseSprint:()=>d(null),confirmCloseSprint:B=>{m&&s?.(m.seq,B),d(null)},removeSprint:c}}import{Fragment as gh,jsx as Qe,jsxs as oa}from"react/jsx-runtime";var FM=[{value:"planning",get label(){return n("status.planning")}},{value:"active",get label(){return n("status.active")}},{value:"closed",get label(){return n("status.closed")}}];function fh(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?e.slice(5).replace("-","."):"-"}function BZ({open:e,customTabs:t,sprints:o,onClose:a,onCreate:r,onUpdate:i,onChangeStatus:l,tasks:s=[],onCloseSprint:c,onRemove:u}){L();let m=sh({open:e,customTabs:t,onClose:a,onCreate:r,onUpdate:i,onChangeStatus:l,tasks:s,onCloseSprint:c,onRemove:u}),{form:d,modals:p,sprintTabs:f,closingSprint:g,remainingTasks:x}=m,h=Number(d.useFormValue("editingSeq"))||0,E=d.isSubmitting,b=new Map(t.map(T=>[Rn(T.key),T.label])),B=Qe(wo,{children:f.length===0?Qe(wo,{sx:{py:2,fontSize:14,color:"#787774"},children:n("sprint.noSprintProjects")}):Qe(gh,{children:Qe(wo,{children:o.length===0?oa(wo,{sx:{py:4,display:"flex",flexDirection:"column",alignItems:"center",gap:2,color:"#9a9a97"},children:[Qe(zM,{sx:{fontSize:48,color:"#d9d9d6"}}),Qe(wo,{sx:{fontSize:13.5},children:n("sprint.noGoals")})]}):o.map(T=>oa(wo,{sx:{display:"flex",flexDirection:"column",gap:1,"&:not(:last-of-type)::after":{content:'""',display:"block",my:1.75,borderBottom:"1px solid #f0efed"}},children:[oa(wo,{sx:{minWidth:0},children:[oa(wo,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[Qe(wo,{component:"span",sx:{fontSize:18,fontWeight:600,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:T.name}),Qe(wo,{component:"span",sx:{flexShrink:0,px:1,py:.25,borderRadius:.75,bgcolor:"#f1f5f9",color:"#64748b",fontSize:13,fontWeight:500},children:b.get(T.group_seq)??n("sprint.deletedProject")}),oa(wo,{component:"span",sx:{flexShrink:0,fontSize:14,color:"#57564f"},children:[fh(T.start_date)," ~"," ",fh(T.end_date)]})]}),T.goal?Qe(wo,{sx:{mt:.5,fontSize:14,color:"#787774",lineHeight:1.5},children:T.goal}):null]}),oa(wo,{sx:{display:"flex",alignItems:"center",gap:.5},children:[Qe(ph,{label:n("col.status"),showLabel:!1,size:"small",value:T.status,options:FM.map(z=>({value:z.value,label:z.label})),onChange:z=>m.changeStatus(T,String(z.target.value)),sx:{width:104,flexShrink:0}}),Qe(ch,{"aria-label":n("board.editGoal"),onClick:()=>m.openEditForm(T),sx:{color:"#9a9a97","&:hover":{color:"#2563eb"}},children:Qe(NM,{sx:{fontSize:18}})}),Qe(ch,{"aria-label":n("board.deleteGoal"),onClick:()=>m.removeSprint(T.seq),sx:{color:"#9a9a97","&:hover":{color:"#e5484d"}},children:Qe(Xt,{style:{width:16,height:16}})})]})]},T.seq))})})});return oa(gh,{children:[Qe(mh,{open:p.manage.isOpen,onClose:p.manage.close,maxWidth:"sm",title:n("sprint.manageTitle"),locale:Ce(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-manage",sections:[{id:"sprint-manage",showTitle:!1,children:B}],sectionContentPaddingTop:0,actions:{showCancelButton:!0,left:f.length>0?Qe(gp,{startIcon:Qe(qM,{}),onClick:m.openCreateForm,sx:{color:"#2563eb"},children:n("sprint.newGoal")}):void 0,right:Qe(gp,{variant:"contained",onClick:p.manage.close,children:n("common.confirm")})}}),Qe(ih,{open:g!==null,sprint:g,remainingTasks:x,sprints:o,onClose:m.cancelCloseSprint,onConfirm:m.confirmCloseSprint}),Qe(mh,{open:p.form.isOpen,onClose:p.form.close,maxWidth:"sm",title:h>0?n("board.editGoal"):n("sprint.newGoal"),locale:Ce(),backdropClick:!1,tabs:{visible:!1},titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-form",sections:[{id:"sprint-form",title:"",showTitle:!1,children:Qe(wo,{sx:{pt:1},children:oa(wo,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:2.5,mt:1},children:[Qe(ph,{form:d,name:"groupKey",label:n("col.project"),size:"medium",options:f.map(T=>({value:T.key,label:T.label})),disabled:h>0}),Qe(uh,{form:d,name:"name",label:n("sprint.goalName"),size:"medium",placeholder:n("sprint.goalNamePlaceholder")}),Qe(dh,{form:d,name:"start_date",size:"medium",label:n("calendar.startDate")}),Qe(dh,{form:d,name:"end_date",size:"medium",label:n("calendar.endDate")}),Qe(uh,{form:d,name:"goal",label:n("googleEvent.description"),size:"medium",placeholder:n("sprint.optional"),sx:{gridColumn:"1 / -1"}})]})})}],actions:{showCancelButton:!0,right:Qe(gp,{variant:"contained",onClick:()=>{d.submit()},disabled:E,children:h>0?n("common.edit"):n("sprint.createGoal")})}})]})}import{Box as Et,Button as Qc,FormControlLabel as bh,Switch as hh}from"@mui/material";import{FormDialog as KM}from"@ehfuse/mui-form-dialog";import GM from"@mui/icons-material/LinkOutlined";import jM from"@mui/icons-material/LinkOffOutlined";import YM from"@mui/icons-material/SyncOutlined";import XM from"@mui/icons-material/ArrowForward";import{useRef as UM}from"react";import{useCallback as HM,useEffect as WM,useRef as Ol}from"react";import{useModal as $M}from"@ehfuse/forma";var Xc=[];function VM(){let e=Xc;if(Xc=[],e.length!==0){if(e.length===1){e[0].close();return}for(let t of e)window.dispatchEvent(new CustomEvent(`modal:close:${t.modalId}`));window.addEventListener("popstate",t=>t.stopImmediatePropagation(),{capture:!0,once:!0}),window.history.go(-e.length)}}function dn({modalId:e,open:t,onClose:o,onOpen:a}){let r=Ol(a);r.current=a;let i=Ol(o);i.current=o;let l=Ol(t);l.current=t;let s=Ol(!1),c=$M({modalId:e,onClose:()=>{s.current=!1,l.current&&i.current()}}),u=Ol(c);u.current=c;let m=HM(()=>{s.current||!u.current.isOpen||(s.current=!0,u.current.close())},[]);return WM(()=>{if(t){r.current?.(),u.current.open();return}!u.current.isOpen||s.current||(s.current=!0,Xc.push({modalId:u.current.modalId,close:()=>u.current.close()}),Xc.length===1&&queueMicrotask(VM))},[t]),{...c,close:m}}function xh(e){let t=UM(e);t.current=e;let o={link:dn({modalId:_e("taskbox-calendar-link"),open:e.open,onClose:()=>t.current.onClose()})},{status:a}=e.googleApi,{calendarName:r}=le(),i=a.linked&&a.calendar_name||r||"\uC5C5\uBB34\uD568",l={connect:()=>t.current.googleApi.onConnect(),disconnect:()=>t.current.googleApi.onDisconnect(),toggleExport:s=>t.current.googleApi.onToggleExport(s),toggleImport:s=>t.current.googleApi.onToggleImport(s),resync:()=>t.current.googleApi.onResync?.()};return{modals:o,status:a,busy:!!e.googleApi.busy,canResync:!!e.googleApi.onResync,calendarName:i,actions:l}}import{Fragment as JM,jsx as Me,jsxs as Qn}from"react/jsx-runtime";function kh({from:e,to:t}){return Qn(Et,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[e,Me(XM,{sx:{fontSize:16,color:"#787774"}}),t]})}function QM({size:e=28}){return Qn(Et,{component:"svg",viewBox:"0 0 48 48","aria-hidden":!0,sx:{width:e,height:e,flexShrink:0,mx:1},children:[Me("path",{fill:"#EA4335",d:"M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"}),Me("path",{fill:"#4285F4",d:"M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"}),Me("path",{fill:"#FBBC05",d:"M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"}),Me("path",{fill:"#34A853",d:"M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"})]})}function VZ(e){L();let t=xh(e),{status:o,busy:a,calendarName:r,actions:i}=t,l=t.modals.link,s=Qn(Et,{sx:{display:"flex",flexDirection:"column",gap:"24px"},children:[Qn(Et,{sx:{bgcolor:"#f2f6fa",borderRadius:1,px:1.5,py:1.25,fontSize:15,lineHeight:1.8,color:"#37352f",display:"flex",flexDirection:"column",gap:.25,"& > div":{display:"flex",gap:1},"& > div::before":{content:'"\u2022"',flexShrink:0}},children:[Me(Et,{children:Me(Et,{component:"span",children:on("calendarLink.exportDesc",{exportWord:Me("b",{children:n("calendarLink.export")}),calendar:Qn("b",{children:['"',r,'"']})})})}),Me(Et,{children:Me(Et,{component:"span",children:on("calendarLink.importDesc",{importWord:Me("b",{children:n("calendarLink.import")})})})}),Me(Et,{children:Me(Et,{component:"span",children:n("calendarLink.editInTaskbox",{calendarName:r})})})]}),o.configured?Qn(Et,{sx:{border:"1px solid #e6e6e3",borderRadius:1,pl:2,pr:3,py:1.75,display:"flex",flexDirection:"column",gap:1.25},children:[Qn(Et,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[Me(QM,{}),Qn(Et,{sx:{flex:1,minWidth:0},children:[Me(Et,{sx:{fontSize:18,color:"#111",fontWeight:700},children:n("calendarLink.connectGoogle")}),Me(Et,{sx:{fontSize:15,color:"#111",mt:.5,lineHeight:1.6},children:o.linked?Qn(JM,{children:[Me(Et,{component:"span",sx:{display:"block",fontWeight:600},children:n("calendarLink.connectedTo",{email:o.google_email||n("calendarLink.googleAccount")})}),Me(Et,{component:"span",sx:{display:"block"},children:n("calendarLink.calendarCreated",{calendarName:r})})]}):n("calendarLink.connectHint",{calendarName:r})}),o.last_error?Me(Et,{sx:{fontSize:13,color:"#c62828",mt:.5},children:n("calendarLink.lastError",{error:o.last_error})}):null]}),o.linked?Me(Qc,{size:"small",variant:"outlined",color:"inherit",disabled:a,startIcon:Me(jM,{sx:{fontSize:18}}),onClick:i.disconnect,sx:{flexShrink:0,whiteSpace:"nowrap",ml:2},children:n("calendarLink.disconnect")}):Me(Qc,{size:"small",variant:"contained",disableElevation:!0,disabled:a,startIcon:Me(GM,{sx:{fontSize:18}}),onClick:i.connect,sx:{flexShrink:0,whiteSpace:"nowrap",bgcolor:"#2563eb",ml:2},children:n("calendarLink.connect")})]}),o.linked?Qn(Et,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap",pl:4.5},children:[Me(bh,{control:Me(hh,{size:"small",checked:o.export_enabled,disabled:a,onChange:(c,u)=>i.toggleExport(u)}),label:Me(Et,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:on("calendarLink.withDirection",{direction:Me(kh,{from:n("calendarLink.taskbox"),to:n("calendarLink.google")})},{label:n("calendarLink.export")})}),sx:{m:0,"& .MuiFormControlLabel-label":{fontSize:14,color:"#37352f"}}}),Me(bh,{control:Me(hh,{size:"small",checked:o.import_enabled,disabled:a,onChange:(c,u)=>i.toggleImport(u)}),label:Me(Et,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:on("calendarLink.withDirection",{direction:Me(kh,{from:n("calendarLink.google"),to:n("calendarLink.taskbox")})},{label:n("calendarLink.import")})}),sx:{m:0,"& .MuiFormControlLabel-label":{fontSize:14,color:"#37352f"}}}),t.canResync?Me(Qc,{size:"small",color:"inherit",disabled:a||!o.export_enabled,startIcon:Me(YM,{sx:{fontSize:18}}),onClick:i.resync,sx:{ml:"auto",whiteSpace:"nowrap"},children:n("calendarLink.reexportAll")}):null]}):null]}):Me(Et,{sx:{fontSize:14,color:"#8a6d1d",lineHeight:1.7},children:n("calendarLink.notConfigured")})]});return Me(KM,{open:l.isOpen,onClose:l.close,width:680,title:n("calendarLink.title"),locale:Ce(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-calendar-link",sectionContentPaddingTop:0,sections:[{id:"calendar-link",showTitle:!1,children:s}],actions:{showCancelButton:!1,right:Me(Qc,{variant:"contained",onClick:l.close,sx:{minWidth:80},children:n("common.close")})}})}import{useTimePickerVariant as oO}from"@ehfuse/mui-form-controls";import{useState as Zc}from"react";import nO from"@mui/icons-material/OpenInNewOutlined";import{Box as na,Button as xp,ButtonBase as rO,FormControlLabel as aO,Switch as iO}from"@mui/material";import{FormDialog as lO}from"@ehfuse/mui-form-dialog";import{ClearTextField as bp}from"@ehfuse/mui-form-controls";import{DatePicker as Sh,TimePicker as vh}from"@ehfuse/mui-datetime-picker";import Bh from"@mui/icons-material/CalendarMonthOutlined";import _h from"@mui/icons-material/AccessTimeOutlined";import{useEffect as ZM,useRef as Jc}from"react";import{useGlobalForm as eO}from"@ehfuse/forma";import{ErrorAlert as Th}from"@ehfuse/alerts";var tO={title:"",allDay:!0,startDate:"",endDate:"",startTime:"09:00",endTime:"10:00",location:"",description:""};function yh(e,t){let[o,a]=e.split(":").map(Number),r=((o*60+a+t)%1440+1440)%1440,i=l=>String(l).padStart(2,"0");return`${i(Math.floor(r/60))}:${i(r%60)}`}function Ch(e){L();let t=Jc(e);t.current=e;let o=Jc(null);e.event&&(o.current=e.event);let a=e.event??o.current,r=a?.editable===!1,i=Jc(r);i.current=r;let l=Jc(!!e.onDelete);e.open&&(l.current=!!e.onDelete);let s=eO({formId:_e("taskbox-google-event-form"),initialValues:tO,onValidate:m=>t.current.busy||i.current?!1:m.title.trim()?m.startDate?!0:(Th(n("googleEvent.selectStartDate")),!1):(Th(n("googleEvent.enterTitle")),!1),onSubmit:m=>{let d=m.endDate&&m.endDate>=m.startDate?m.endDate:m.startDate;return t.current.onSave({title:m.title.trim(),start_date:m.startDate,end_date:d,time:m.allDay?"":m.startTime,end_time:m.allDay?"":m.endTime,location:m.location.trim(),description:m.description.trim()}),!0}}),c={event:dn({modalId:_e("taskbox-google-event"),open:e.open,onClose:()=>t.current.onClose()})};ZM(()=>{let m=e.event;if(!e.open||!m)return;let d=!!m.time;s.setFormValues({title:m.title==="(\uC81C\uBAA9 \uC5C6\uC74C)"?"":m.title,allDay:!d,startDate:m.start_date,endDate:m.end_date||m.start_date,startTime:d?m.time:"09:00",endTime:d?m.end_time||yh(m.time,60):"10:00",location:m.location??"",description:m.description??""})},[e.open,e.event]);let u={changeStartDate:m=>{let d=String(s.getFormValue("endDate")??"");s.setFormValue("startDate",m),(!d||d<m)&&s.setFormValue("endDate",m)},changeEndDate:m=>s.setFormValue("endDate",m),changeStartTime:m=>{let d=s.getFormValues();s.setFormValue("startTime",m),d.startDate===d.endDate&&d.endTime<=m&&s.setFormValue("endTime",yh(m,60))},changeEndTime:m=>s.setFormValue("endTime",m),changeAllDay:m=>s.setFormValue("allDay",m),remove:()=>t.current.onDelete?.()};return{form:s,modals:c,event:a,readOnly:r,busy:!!e.busy,canDelete:l.current,actions:u}}import{jsx as st,jsxs as Si}from"react/jsx-runtime";function Ih(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return e||n("googleEvent.pickDate");let[t,o,a]=e.split("-").map(Number),r=Fr(new Date(t,o-1,a).getDay());return`${t}.${String(o).padStart(2,"0")}.${String(a).padStart(2,"0")} (${r})`}function hp(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?new Date(`${e}T00:00:00`):new Date}function wh(e){let t=o=>String(o).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function Dh(e){let t=/^(\d{2}):(\d{2})$/.exec(e);return t?{hour:t[1],minute:t[2]}:{hour:"09",minute:"00"}}function sO(e){switch(e){case"fromGmail":return n("googleEvent.typeFromGmail");case"birthday":return n("googleEvent.typeBirthday");case"outOfOffice":return n("googleEvent.typeOutOfOffice");case"focusTime":return n("googleEvent.typeFocusTime");case"workingLocation":return n("googleEvent.typeWorkingLocation");default:return n("googleEvent.typeThis")}}function cO(e){let[t,o,a]=e.split("-").map(Number);window.open(`https://calendar.google.com/calendar/r/day/${t}/${o}/${a}`,"_blank")}function em({icon:e,label:t,placeholder:o,disabled:a,onClick:r}){return Si(rO,{disabled:a,onClick:i=>r(i.currentTarget),sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.9,borderRadius:1,border:"1px solid #d9d9d6",bgcolor:a?"#f7f7f5":"#fff",color:t?"#37352f":"#9b9a97",fontSize:15,fontWeight:500,minWidth:0,whiteSpace:"nowrap","&:hover":{bgcolor:"#f7f7f5"},"&.Mui-disabled":{color:"#b9b8b4"}},children:[e,t||o]})}function dee(e){L();let t=We(),o=Ch(e),a=oO(void 0),{form:r,event:i,readOnly:l,busy:s,actions:c}=o,u=o.modals.event,m=!!r.useValue("allDay"),d=String(r.useValue("startDate")??""),p=String(r.useValue("endDate")??""),f=String(r.useValue("startTime")??""),g=String(r.useValue("endTime")??""),[x,h]=Zc(null),[E,b]=Zc(null),[B,T]=Zc(null),[z,k]=Zc(null),_=i?Si(na,{sx:{display:"flex",flexDirection:"column",gap:2.25,pt:.5},children:[st(na,{sx:{bgcolor:l?"#fff4e5":"#f2f6fa",borderRadius:1,px:1.5,py:1,fontSize:14.5,lineHeight:1.7,color:"#37352f"},children:l?n("googleEvent.readOnly",{value:sO(i.event_type)}):n(i.recurring?"googleEvent.editableRecurring":"googleEvent.editable",{calendar:i.calendar||n("calendar.googleCalendar")})}),st(bp,{label:n("common.title"),name:"title",form:r,disabled:l,onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),r.submit())},fullWidth:!0,autoFocus:!t&&!l}),st(aO,{control:st(iO,{checked:m,disabled:l,onChange:(D,F)=>c.changeAllDay(F),size:"small"}),label:n("googleEvent.allDay"),sx:{ml:0,"& .MuiFormControlLabel-label":{fontSize:15,color:"#37352f"}}}),Si(na,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[Si(na,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[st(na,{sx:{width:44,fontSize:14.5,color:"#57564f",flexShrink:0},children:n("googleEvent.start")}),st(em,{icon:st(Bh,{sx:{fontSize:18,color:"#787774"}}),label:Ih(d),placeholder:n("googleEvent.pickDate"),disabled:l,onClick:h}),m?null:st(em,{icon:st(_h,{sx:{fontSize:18,color:"#787774"}}),label:f,placeholder:n("googleEvent.time"),disabled:l,onClick:T})]}),Si(na,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[st(na,{sx:{width:44,fontSize:14.5,color:"#57564f",flexShrink:0},children:n("googleEvent.end")}),st(em,{icon:st(Bh,{sx:{fontSize:18,color:"#787774"}}),label:Ih(p),placeholder:n("googleEvent.pickDate"),disabled:l,onClick:b}),m?null:st(em,{icon:st(_h,{sx:{fontSize:18,color:"#787774"}}),label:g,placeholder:n("googleEvent.time"),disabled:l,onClick:k})]})]}),st(bp,{label:n("googleEvent.location"),name:"location",form:r,disabled:l,fullWidth:!0}),st(bp,{label:n("googleEvent.description"),name:"description",form:r,disabled:l,fullWidth:!0,multiline:!0,minRows:3,maxRows:8}),st(Sh,{anchorEl:x,open:!!x,onClose:()=>h(null),selectedDate:hp(d),onDateChange:D=>{c.changeStartDate(wh(D)),h(null)},centered:t,locale:zn()}),st(Sh,{anchorEl:E,open:!!E,onClose:()=>b(null),selectedDate:hp(p||d),minDate:d?hp(d):void 0,onDateChange:D=>{c.changeEndDate(wh(D)),b(null)},centered:t,locale:zn()}),st(vh,{timeVariant:a,anchorEl:B,open:!!B,onClose:()=>T(null),value:Dh(f),format:"HH:mm",minuteStep:5,autoApply:!0,centered:t,locale:zn(),onChange:(D,F)=>{c.changeStartTime(`${D}:${F}`),T(null)}}),st(vh,{timeVariant:a,anchorEl:z,open:!!z,onClose:()=>k(null),value:Dh(g),format:"HH:mm",minuteStep:5,autoApply:!0,centered:t,locale:zn(),onChange:(D,F)=>{c.changeEndTime(`${D}:${F}`),k(null)}})]}):null;return st(lO,{open:u.isOpen,onClose:u.close,width:520,title:n("googleEvent.title"),locale:Ce(),tabs:{visible:!1},titleIcons:{delete:{visible:!l&&o.canDelete,confirmConfig:{title:i?.recurring?n("googleEvent.deleteOccurrenceConfirm"):n("googleEvent.deleteConfirm"),confirmText:n("common.delete")}}},onDelete:c.remove,fontScale:{enabled:!0},fontScaleKey:"taskbox-google-event",sectionContentPaddingTop:0,sections:[{id:"google-event",showTitle:!1,children:_}],actions:{showCancelButton:!l,right:l?Si(na,{sx:{display:"flex",gap:"1rem",alignItems:"center"},children:[st(xp,{variant:"outlined",startIcon:st(nO,{}),onClick:()=>i&&cO(i.start_date),children:n("googleEvent.openInGoogle")}),st(xp,{variant:"contained",onClick:u.close,sx:{minWidth:72},children:n("common.close")})]}):st(xp,{variant:"contained",onClick:()=>{r.submit()},disabled:s,children:n("common.save")})}})}import{useMemo as Ph,useState as fO}from"react";import{Box as Ll,Button as gO,Typography as xO}from"@mui/material";import{FormDialog as bO}from"@ehfuse/mui-form-dialog";import{SearchTextField as hO}from"@ehfuse/mui-form-controls";import{TreeView as kO}from"@ehfuse/tree-view";import{useMemo as mO,useRef as Eh}from"react";import{useFormaState as uO,useGlobalForm as dO}from"@ehfuse/forma";function pO(e){let t=[],o=a=>{for(let r of a.employees??[])t.push(r);for(let r of a.groups??[])o(r)};for(let a of e)o(a);return t}function Rh(e){let t=Eh(e);t.current=e;let o=mO(()=>pO(e.groups),[e.groups]),a=Eh(o);a.current=o;let r=uO({openCount:0}),i=dO({formId:_e("taskbox-employee-select-form"),initialValues:{selectedSeqs:[]},onSubmit:c=>{let u=a.current.filter(m=>c.selectedSeqs.includes(m.seq));return t.current.onConfirm(t.current.multiple?u:u.slice(0,1)),t.current.onClose(),!0}}),l={select:dn({modalId:_e("taskbox-employee-select"),open:e.open,onClose:()=>t.current.onClose(),onOpen:()=>{i.setFormValues({selectedSeqs:t.current.selectedSeqs}),r.setValue("openCount",Number(r.getValue("openCount")??0)+1)}})};return{form:i,modals:l,ui:r,allEmployees:o,changeSelection:c=>i.setFormValue("selectedSeqs",c)}}import{Fragment as vO,jsx as Pn,jsxs as BO}from"react/jsx-runtime";function Mh(e){return`${e.name}#${e.seq}`}function TO(e){return Number(e.slice(e.lastIndexOf("#")+1))||0}function yO(e,t){return t?[e.name,e.department,e.role_name,e.work_position].filter(Boolean).some(o=>String(o).toLowerCase().includes(t)):!0}function CO(e){let t=[[e.name,e.role_name].filter(Boolean).join(" "),e.department].filter(Boolean).join(" / ");return{id:`emp:${e.seq}`,label:Mh(e),renderLabel:Pn(Ll,{component:"span",sx:{display:"inline-flex",alignItems:"baseline",gap:.75},children:Pn(Ll,{component:"span",sx:{fontWeight:400,color:"text.primary"},children:t})})}}function Oh(e,t){let o=(e.groups??[]).map(r=>Oh(r,t)).filter(r=>r!==null),a=(e.employees??[]).filter(r=>yO(r,t)).map(CO);return o.length===0&&a.length===0?null:{id:`group:${e.key}`,label:e.name,children:[...o,...a]}}function SO({groups:e,allEmployees:t,initialSelectedSeqs:o,multiple:a,isMobile:r,onSelectionChange:i}){L();let[l,s]=fO(""),c=Ph(()=>e.map(m=>Oh(m,l.trim().toLowerCase())).filter(m=>m!==null),[e,l]),u=Ph(()=>t.filter(m=>o.includes(m.seq)).map(Mh),[]);return BO(vO,{children:[Pn(Ll,{sx:{px:1.5,py:1,borderBottom:"1px solid #cccccc",flexShrink:0},children:Pn(hO,{size:"small",fullWidth:!0,placeholder:n("dialog.searchNameDept"),onSearch:s,onClear:()=>s(""),sx:{"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiInputBase-root":{px:0}}})}),Pn(Ll,{sx:r?{display:"flex",flexDirection:"column"}:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:Pn(kO,{items:c,checkbox:!0,multiSelect:a,selectionMode:"child",showSearch:!1,defaultExpanded:!0,initialSelections:u,onChange:m=>i(m.map(TO).filter(d=>d>0)),styles:{border:"none",borderRadius:"0"}})})]})}function wee({open:e,title:t=n("dialog.selectEmployee"),hint:o="",groups:a,multiple:r=!1,selectedSeqs:i,confirmText:l=n("common.confirm"),onConfirm:s,onClose:c}){L();let u=We(),m=i??[],d=Rh({open:e,groups:a,multiple:r,selectedSeqs:m,onConfirm:s,onClose:c}),{form:p,allEmployees:f}=d,g=d.modals.select,x=p.useValue("selectedSeqs")??[],h=Number(d.ui.useValue("openCount")??0);return Pn(bO,{open:g.isOpen,onClose:g.close,title:r&&x.length>0?n("dialog.titleWithPeople",{title:t,count:x.length}):t,locale:Ce(),fullScreen:u,mobilePresentation:u?"slide":"dialog",draggable:!0,width:"600px",tabs:{visible:!1},titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},scrollPastLastSection:!1,sectionContentPaddingTop:0,fontScale:{enabled:!0},fontScaleKey:"taskbox-employee-select",sections:[{id:"employee-select",title:n("dialog.selectEmployee"),showTitle:!1,children:Pn(Ll,{sx:{...u?{}:{height:560},display:"flex",flexDirection:"column",border:"1px solid #cccccc",borderRadius:1,...u?{}:{overflow:"hidden"},userSelect:"none"},children:Pn(SO,{groups:a,allEmployees:f,initialSelectedSeqs:m,multiple:r,isMobile:u,onSelectionChange:d.changeSelection},h)})}],dialogActionSx:{"@media (max-width:1023.95px)":{gap:"0.75rem !important","& .left-actions":{flex:1,minWidth:0},"& .right-actions":{flex:1}}},actions:{visible:!0,showCancelButton:!1,left:o?Pn(xO,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-line",lineHeight:1.35},children:o}):void 0,right:Pn(gO,{variant:"contained",onClick:()=>{p.submit()},children:l})}})}import{useMemo as l2}from"react";import{Box as Dr,Button as tk}from"@mui/material";import{FormDialog as s2}from"@ehfuse/mui-form-dialog";import{LabelSelect as Cp}from"@ehfuse/mui-form-controls";import c2 from"@mui/icons-material/SpeedOutlined";import{Box as No,Button as DO}from"@mui/material";import{FormDialog as EO}from"@ehfuse/mui-form-dialog";import{LabelSelect as RO,NumberField as PO}from"@ehfuse/mui-form-controls";import MO from"@ehfuse/overlay-scrollbar";import{useEffect as _O,useRef as IO}from"react";import{useGlobalForm as wO}from"@ehfuse/forma";function Lh(e){return`byAccount.a${e}`}function Al(e){return Math.max(0,Math.floor(Number(e)||0))}function kp(e){return{basis:e.basis,default_capacity:e.default_capacity,byAccount:Object.fromEntries(Object.entries(e.by_account??{}).map(([t,o])=>[`a${t}`,o]))}}function Ah({open:e,capacity:t,onClose:o,onSave:a}){let r=wO({formId:_e("taskbox-workload-capacity-form"),initialValues:kp(t??pa),onSubmit:async s=>{let c={};for(let[u,m]of Object.entries(s.byAccount??{})){let d=Al(m),p=Number(u.slice(1));p>0&&d>0&&(c[p]=d)}return await a({...t??pa,basis:s.basis,default_capacity:Al(s.default_capacity),by_account:c}),!0}}),i={form:no({modalIdPrefix:"taskbox-workload-capacity-dialog",open:e,onClose:o,onOpen:()=>r.setFormValues(kp(t??pa))})},l=IO(!0);return _O(()=>{if(l.current){l.current=!1;return}e&&r.setFormValues(kp(t??pa))},[t]),{form:r,modals:i}}import{jsx as bo,jsxs as ql}from"react/jsx-runtime";var OO=[{value:"count",get label(){return n("workload.basisCount")}},{value:"points",get label(){return n("workload.basisPoints")}}];function qh({form:e,name:t,unit:o,size:a,clearWhenZero:r}){let i=Al(e.useFormValue(t));return bo(PO,{size:a,fullWidth:!0,min:0,max:999,thousandSeparator:!1,align:"right",suffix:o,clearWhenZero:r,value:i,onValueChange:l=>e.setFormValue(t,Al(l))})}function zh({open:e,capacity:t,employees:o,onClose:a,onSave:r}){L();let{form:i,modals:l}=Ah({open:e,capacity:t,onClose:a,onSave:r}),s=i.useFormValue("basis")==="points"?"SP":n("chart.unitCount");return bo(EO,{open:l.form.isOpen,onClose:l.form.close,maxWidth:"sm",title:n("workload.title"),locale:Ce(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-workload-capacity",tabs:{visible:!1},actions:{showCancelButton:!0,right:bo(DO,{variant:"contained",onClick:()=>{i.submit()},children:n("common.save")})},sectionContentPaddingTop:0,sections:[{id:"capacity",title:"",showTitle:!1,children:ql(No,{sx:{display:"flex",flexDirection:"column",gap:2},children:[bo(No,{sx:{fontSize:15,color:"#37352f"},children:n("workload.intro")}),ql(No,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[bo(No,{sx:{width:104,flexShrink:0,fontSize:16,color:"#37352f"},children:n("workload.basis")}),bo(RO,{form:i,name:"basis",size:"medium",fullWidth:!0,label:"",options:OO})]}),ql(No,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[bo(No,{sx:{width:104,flexShrink:0,fontSize:16,color:"#37352f"},children:n("workload.defaultCapacity")}),bo(qh,{form:i,name:"default_capacity",size:"medium",unit:s})]}),bo(No,{sx:{pl:"119px",mt:-1.25,fontSize:13.5,color:"#37352f"},children:n("workload.defaultHint",{unit:s})}),bo(No,{sx:{fontSize:16,fontWeight:700,color:"#37352f"},children:n("workload.perPerson")}),o.length===0?bo(No,{sx:{fontSize:15,color:"#787774"},children:n("workload.noEmployees")}):bo(No,{sx:{border:"1px solid #e6e6e3",borderRadius:1,overflow:"hidden"},children:bo(MO,{style:{maxHeight:260},thumb:{width:6},children:o.filter(c=>Number(c.account_seq)>0).map(c=>ql(No,{sx:{display:"flex",alignItems:"center",gap:1.5,px:2,py:1,borderBottom:"1px solid #f2f2f0","&:last-of-type":{borderBottom:"none"}},children:[ql(No,{sx:{flex:1,minWidth:0,fontSize:16,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[c.name,c.department?bo(No,{component:"span",sx:{ml:1,fontSize:14,color:"#787774"},children:c.department}):null]}),bo(No,{sx:{width:132,flexShrink:0},children:bo(qh,{form:i,name:Lh(Number(c.account_seq)),size:"small",unit:s,clearWhenZero:!0})})]},c.account_seq))})})]})}]})}import{lazy as LO,Suspense as AO}from"react";import{Box as qO}from"@mui/material";import{jsx as tm}from"react/jsx-runtime";function zO({height:e}){return tm(qO,{sx:typeof e=="number"?{height:e,minHeight:120}:{position:"absolute",inset:0}})}function zl(e,t){let o=LO(e);return function(r){return tm(AO,{fallback:tm(zO,{height:r.height??t}),children:tm(o,{...r})})}}var Nh=zl(()=>import("./chunks/SprintVelocityChart-CR3HMLUG.js").then(e=>({default:e.SprintVelocityChart})),200),Fh=zl(()=>import("./chunks/SprintBurndownChart-V2CBERDB.js").then(e=>({default:e.SprintBurndownChart})),200),Hh=zl(()=>import("./chunks/CumulativeFlowChart-VALY3NWH.js").then(e=>({default:e.CumulativeFlowChart})),220),Wh=zl(()=>import("./chunks/LeadTimeDistributionChart-EQ5YYG5Q.js").then(e=>({default:e.LeadTimeDistributionChart})),200),$h=zl(()=>import("./chunks/WorkloadChart-XZCA4DKC.js").then(e=>({default:e.WorkloadChart})),200);import{Box as YO,Button as XO}from"@mui/material";import{FormDialog as QO}from"@ehfuse/mui-form-dialog";import{useState as NO}from"react";import{Box as Wt,Button as FO,Menu as HO,MenuItem as WO}from"@mui/material";import $O from"@mui/icons-material/PersonOutlineOutlined";import VO from"@ehfuse/overlay-scrollbar";import{jsx as $t,jsxs as vi}from"react/jsx-runtime";var Vh=56,Uh=68,Kh=96;function UO(e){let t=String(e.due_date??"").slice(0,10);return t?t.slice(5).replace("-","/"):"-"}function Gh(e,t){let o=String(e.due_date??"").slice(0,10);return!!o&&o<t}function jh({tasks:e,row:t,todayStr:o,employees:a,rows:r,height:i=200,hideSummary:l=!1,onChangeManager:s,onOpenTask:c}){L();let[u,m]=NO(null),d=cs(e,t.accountSeq),p=f=>r.find(g=>g.accountSeq===f)?.total??0;return vi(Wt,{sx:{display:"flex",flexDirection:"column",minHeight:0,height:i},children:[l?null:vi(Wt,{sx:{display:"flex",alignItems:"center",gap:1,px:.5,pb:.75,fontSize:14,color:"#37352f"},children:[$t(Wt,{component:"span",sx:{fontWeight:700},children:t.name}),$t(Wt,{component:"span",children:n("chart.openCount",{count:d.length})}),t.capacity>0?$t(Wt,{component:"span",sx:{color:t.load>t.capacity?"#e5484d":"#787774"},children:n("chart.capacityOf",{capacity:t.capacity,load:t.load})}):null]}),vi(Wt,{sx:{flex:1,minHeight:0,display:"flex",flexDirection:"column",border:"1px solid #e6e6e3",borderRadius:1,overflow:"hidden"},children:[vi(Wt,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,flexShrink:0,bgcolor:"#fafaf9",borderBottom:"1px solid #e6e6e3",fontSize:13.5,fontWeight:600,color:"#37352f"},children:[$t(Wt,{sx:{width:Vh,flexShrink:0},children:n("board.due")}),$t(Wt,{sx:{flex:1,minWidth:0},children:n("template.task")}),$t(Wt,{sx:{width:Uh,flexShrink:0,textAlign:"center"},children:n("col.priority")}),s?$t(Wt,{sx:{width:Kh,flexShrink:0,textAlign:"center"},children:n("col.owner")}):null]}),$t(Wt,{sx:{flex:1,minHeight:0},children:$t(VO,{style:{height:"100%"},thumb:{width:6},children:d.length===0?$t(Wt,{sx:{p:2,fontSize:14,color:"#9a9a97"},children:n("chart.noOpenTasks")}):d.map(f=>vi(Wt,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1.5,borderBottom:"1px solid #f2f2f0"},children:[$t(Wt,{sx:{width:Vh,flexShrink:0,fontSize:13.5,color:Gh(f,o)?"#e5484d":"#787774",fontWeight:Gh(f,o)?700:400},children:UO(f)}),$t(Wt,{onClick:c?()=>c(f.seq):void 0,sx:{flex:1,minWidth:0,fontSize:14.5,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...c?{cursor:"pointer","&:hover":{textDecoration:"underline"}}:{}},children:f.title}),$t(Wt,{sx:{width:Uh,flexShrink:0,display:"flex",justifyContent:"center"},children:$t(uo,{priority:f.priority})}),s?$t(Wt,{sx:{width:Kh,flexShrink:0,display:"flex",justifyContent:"center"},children:$t(FO,{size:"small",variant:"outlined",startIcon:$t($O,{sx:{fontSize:17}}),onClick:g=>m({el:g.currentTarget,taskSeq:f.seq}),children:n("chart.move")})}):null]},f.seq))})})]}),$t(HO,{anchorEl:u?.el??null,open:!!u,onClose:()=>m(null),transitionDuration:0,children:a.filter(f=>Number(f.account_seq)>0&&Number(f.account_seq)!==t.accountSeq).map(f=>vi(WO,{onClick:()=>{u&&s&&s(u.taskSeq,Number(f.account_seq),f.name),m(null)},sx:{fontSize:14,minWidth:200},children:[$t(Wt,{sx:{flex:1},children:f.name}),$t(Wt,{component:"span",sx:{ml:2,fontSize:13,color:"#787774"},children:n("chart.countValue",{count:p(Number(f.account_seq))})})]},f.account_seq))})]})}import{useEffect as KO,useRef as GO,useState as jO}from"react";function Yh({open:e,row:t,onClose:o,onOpenTask:a}){let[r,i]=jO(t);KO(()=>{t&&i(t)},[t]);let l=GO(0),s={dialog:no({modalIdPrefix:"taskbox-workload-person-dialog",open:e,onClose:()=>{o();let u=l.current;l.current=0,u>0&&a?.(u)}})};return{modals:s,shown:t??r,openTask:a?u=>{if(!s.dialog.isOpen){a(u);return}l.current=u,s.dialog.close()}:void 0}}import{jsx as om}from"react/jsx-runtime";function Xh({open:e,row:t,rows:o,tasks:a,todayStr:r,employees:i,onClose:l,onChangeManager:s,onOpenTask:c}){L();let{modals:u,shown:m,openTask:d}=Yh({open:e,row:t,onClose:l,onOpenTask:c}),p=m?cs(a,m.accountSeq).length:0;return om(QO,{open:u.dialog.isOpen,onClose:u.dialog.close,maxWidth:"sm",title:m?n("workload.personTasksTitle",{name:m.name,count:p}):n("template.task"),locale:Ce(),titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-workload-person",tabs:{visible:!1},actions:{showCancelButton:!1,right:om(XO,{variant:"contained",onClick:u.dialog.close,children:n("common.close")})},sections:[{id:"person-tasks",title:"",showTitle:!1,children:om(YO,{sx:{minHeight:0},children:m?om(jh,{tasks:a,row:m,rows:o,todayStr:r,employees:i,height:"min(420px, 52vh)",hideSummary:!0,onChangeManager:s,onOpenTask:d}):null})}]})}import{useMemo as JO}from"react";import{Box as Qo,Tooltip as ZO}from"@mui/material";import{OverlayScrollbar as e2}from"@ehfuse/overlay-scrollbar";import{jsx as Do,jsxs as rm}from"react/jsx-runtime";var Qh="#e5484d",t2="#2f80ed",o2="#9a9a97",Tp=30,n2=96,nm=56;function yp({count:e,max:t,color:o,title:a}){let r=e>0&&t>0?.18+e/t*.72:0;return Do(ZO,{title:a,arrow:!0,disableInteractive:!0,placement:"top",children:Do(Qo,{sx:{display:"flex",alignItems:"center",justifyContent:"center",borderRight:"1px solid #ececea",borderBottom:"1px solid #ececea",bgcolor:r>0?`${o}${Math.round(r*255).toString(16).padStart(2,"0")}`:"transparent",color:r>.55?"#fff":"#37352f",fontSize:12.5,fontWeight:e>0?700:400,fontVariantNumeric:"tabular-nums"},children:e>0?e:""})})}function Jh({tasks:e,todayStr:t,weeks:o=6,height:a=200}){L();let r=JO(()=>Gp(e,{todayStr:t,weeks:o}),[e,t,o]);if(r.rows.length===0)return Do(Qo,{sx:$i(a),children:Do(ss,{text:n("chart.noAssignedOpen"),height:a})});let i=`${n2}px ${nm}px repeat(${r.weeks.length}, minmax(${nm}px, 1fr)) ${nm}px ${nm}px`,l={height:Tp,display:"flex",alignItems:"center",justifyContent:"center",borderRight:"1px solid #ececea",borderBottom:"1px solid #dcdad6",fontSize:12,fontWeight:700,color:"#37352f",bgcolor:"#f8f8f7",whiteSpace:"nowrap"};return Do(Qo,{sx:$i(a),children:Do(e2,{style:{height:"100%"},thumb:{width:8},children:rm(Qo,{sx:{display:"grid",gridTemplateColumns:i,minWidth:"fit-content",height:"100%",gridTemplateRows:`${Tp}px repeat(${r.rows.length}, minmax(${Tp}px, 1fr))`},children:[Do(Qo,{sx:{...l,justifyContent:"flex-start",pl:1},children:n("chart.assignee")}),Do(Qo,{sx:{...l,color:Qh},children:n("chart.overdue")}),r.weeks.map(s=>Do(Qo,{sx:{...l,...s.isCurrent?{borderBottom:"2px solid #2f80ed"}:{}},children:s.label},s.start)),Do(Qo,{sx:l,children:n("chart.noDue")}),Do(Qo,{sx:l,children:n("chart.total")}),r.rows.map(s=>rm(Qo,{sx:{display:"contents"},children:[Do(Qo,{sx:{display:"flex",alignItems:"center",pl:1,borderRight:"1px solid #ececea",borderBottom:"1px solid #ececea",fontSize:13,color:s.accountSeq>0?"#37352f":"#9a9a97",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),Do(yp,{count:s.overdue,max:r.maxCell,color:Qh,title:n("chart.cellOverdue",{name:s.name,count:s.overdue})}),s.byWeek.map((c,u)=>Do(yp,{count:c,max:r.maxCell,color:t2,title:n("chart.cellWeek",{name:s.name,week:r.weeks[u].label,count:c})},r.weeks[u].start)),Do(yp,{count:s.noDue,max:r.maxCell,color:o2,title:n("chart.cellNoDue",{name:s.name,count:s.noDue})}),rm(Qo,{sx:{display:"flex",alignItems:"center",justifyContent:"center",borderBottom:"1px solid #ececea",fontSize:12.5,fontWeight:700,color:"#37352f",fontVariantNumeric:"tabular-nums"},children:[s.total,s.beyond>0?rm(Qo,{component:"span",sx:{ml:.25,fontSize:10.5,color:"#9a9a97"},children:["(+",s.beyond,")"]}):null]})]},s.accountSeq))]})})})}import{useMemo as r2,useRef as a2,useState as Zh}from"react";import{useGlobalForm as i2}from"@ehfuse/forma";function ek({open:e,sprints:t,tasks:o,todayStr:a,initialSprintSeq:r,capacity:i,onSaveCapacity:l,onOpenTask:s,onClose:c}){let u=i2({formId:_e("taskbox-sprint-charts-form"),initialValues:{sprintSeq:"",flowDays:"30",workloadMode:"distribution"}}),[m,d]=Zh(0),[p,f]=Zh(!1),g=a2(0),x={charts:no({modalIdPrefix:"taskbox-sprint-charts-dialog",open:e,onClose:()=>{c();let T=g.current;g.current=0,T>0&&s?.(T)},onOpen:()=>{let T=t.find(k=>k.status==="active")??t[0],z=t.find(k=>k.seq===r)??T;u.setFormValue("sprintSeq",z?.seq?String(z.seq):"")}})},h=r2(()=>Kp(o,{todayStr:a,capacity:i}),[o,a,i]),E=h.find(T=>T.accountSeq===m)??null;return{form:u,modals:x,workloadRows:h,pickedAccountSeq:m,pickedRow:E,pickPerson:d,closePersonTasks:()=>d(0),capacityOpen:p,openCapacity:()=>f(!0),closeCapacity:()=>f(!1),saveCapacity:l?async T=>{await l(T),f(!1)}:void 0,openTask:s?T=>{if(!x.charts.isOpen){s(T);return}g.current=T,x.charts.close()}:void 0}}import{Fragment as ok,jsx as Bt,jsxs as am}from"react/jsx-runtime";var nk="min(560px, 62vh)",m2=`calc(${nk} - 4px)`,u2=[{value:"30",get label(){return n("chart.last30")}},{value:"60",get label(){return n("chart.last60")}},{value:"90",get label(){return n("chart.last90")}}];function Gte({open:e,sprints:t,tasks:o,todayStr:a,showSprintCharts:r,capacity:i=pa,capacityEmployees:l=[],onSaveCapacity:s,onChangeTaskManager:c,onOpenTask:u,initialSprintSeq:m=0,onClose:d}){L();let p=ek({open:e,sprints:t,tasks:o,todayStr:a,initialSprintSeq:m,capacity:i,onSaveCapacity:s,onOpenTask:u,onClose:d}),{form:f,modals:g,workloadRows:x,pickedAccountSeq:h,pickedRow:E}=p,b=Number(f.useFormValue("sprintSeq"))||0,B=Number(f.useFormValue("flowDays"))||30,T=f.useFormValue("workloadMode")==="timeline"?"timeline":"distribution",z=l2(()=>t.find(y=>y.seq===b)??null,[t,b]),k={height:m2,boxSizing:"border-box",px:3,py:2.5,display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden"},_=Bt(Cp,{form:f,name:"sprintSeq",label:n("col.goal"),showLabel:!1,showEmptyOption:!1,options:t.map(y=>({value:String(y.seq),label:sn(y)})),sx:{width:280,flexShrink:0}}),D=Bt(Cp,{form:f,name:"workloadMode",label:n("chart.view"),showLabel:!1,showEmptyOption:!1,options:[{value:"distribution",label:n("chart.loadNow")},{value:"timeline",label:n("chart.weeklyDue")}],sx:{width:280,flexShrink:0}}),F=am(ok,{children:[D,s?Bt(tk,{size:"small",variant:"outlined",startIcon:Bt(c2,{sx:{fontSize:18}}),onClick:p.openCapacity,sx:{flexShrink:0},children:n("chart.capacity")}):null]}),R=r??t.length>0,C=Bt(Cp,{form:f,name:"flowDays",label:n("chart.period"),showLabel:!1,showEmptyOption:!1,options:u2,sx:{width:280,flexShrink:0}});return am(ok,{children:[Bt(s2,{open:g.charts.isOpen,onClose:g.charts.close,maxWidth:"md",title:n("chart.title"),locale:Ce(),contentTopPadding:0,contentPaddingX:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sectionTitleGap:0,fixedHeight:nk,contentBottomPadding:0,scrollPastLastSection:!1,tabs:{visible:!0,switchContent:!0,fullWidth:!0},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-charts",sections:[...R?[{id:"velocity",tabTitle:n("chart.velocity"),showTitle:!1,children:Bt(Dr,{sx:k,children:Bt(Nh,{sprints:t,tasks:o,height:"100%"})})},{id:"burndown",tabTitle:n("chart.burndown"),showTitle:!1,children:Bt(Dr,{sx:k,children:z?Bt(Fh,{sprint:z,tasks:o,todayStr:a,height:"100%",headerLeft:_}):am(Dr,{sx:$i("100%"),children:[Bt(Dr,{sx:Bm,children:_}),Bt(ss,{text:n("chart.pickGoalForBurndown"),height:"100%"})]})})},{id:"cumulative-flow",tabTitle:n("chart.cfd"),showTitle:!1,children:Bt(Dr,{sx:k,children:Bt(Hh,{tasks:o,todayStr:a,days:B,height:"100%",headerLeft:C})})}]:[],{id:"workload",tabTitle:n("chart.workload"),showTitle:!1,children:Bt(Dr,{sx:k,children:T==="timeline"?am(Dr,{sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[Bt(Dr,{sx:Bm,children:F}),Bt(Jh,{tasks:o,todayStr:a,height:"100%"})]}):Bt($h,{tasks:o,todayStr:a,height:"100%",capacity:i,headerLeft:F,selectedAccountSeq:h,onSelectPerson:c?p.pickPerson:void 0})})},{id:"lead-time",tabTitle:n("chart.leadTime"),showTitle:!1,children:Bt(Dr,{sx:k,children:Bt(Wh,{tasks:o,todayStr:a,days:B,height:"100%",headerLeft:C})})}],actions:{showCancelButton:!1,right:Bt(tk,{variant:"contained",onClick:g.charts.close,children:n("common.close")})}}),Bt(Xh,{open:h>0,row:E,rows:x,tasks:o,todayStr:a,employees:l,onClose:p.closePersonTasks,onChangeManager:c,onOpenTask:p.openTask}),p.saveCapacity?Bt(zh,{open:p.capacityOpen,capacity:i,employees:l,onClose:p.closeCapacity,onSave:p.saveCapacity}):null]})}import{useMemo as d2}from"react";import{Box as p2}from"@mui/material";import{HEADER_MENU_ICON_PATHS as rk,HeaderMenuIcon as f2,HeaderMenuItem as g2,headerMenuAnchor as x2}from"@ehfuse/mui-virtual-data-table";import{jsx as Sp}from"react/jsx-runtime";function Bi(e,t){return d2(()=>t??(e?x2(e):null),[e,t])}function im(e,t){let o=t.filter(r=>!e.includes(r)),a=e.filter(r=>!t.includes(r));return o.length===1&&a.length===0?{kind:"toggle",value:o[0]}:a.length===1&&o.length===0?{kind:"toggle",value:a[0]}:t.length===0?{kind:"clear"}:null}function ak({checked:e,onClick:t,disabled:o,children:a}){return Sp(g2,{selected:e,disabled:o,onClick:t,icon:Sp(f2,{d:e?rk.radioOn:rk.radioOff,color:e?"primary.main":"text.disabled"}),children:a})}function ik({color:e}){return Sp(p2,{component:"span",sx:{width:8,height:8,borderRadius:"50%",bgcolor:e,flexShrink:0}})}import{HEADER_MENU_FONT_SIZE as b2,HeaderMenu as h2}from"@ehfuse/mui-virtual-data-table";import{jsx as lk}from"react/jsx-runtime";function loe({anchorPosition:e,anchorEl:t,candidates:o,selectedNames:a,avatarSrcByName:r,onToggle:i,onClear:l,onClose:s}){L();let c=Bi(t,e),u=le().avatarSrcByName,m=r??u,d=Math.round(b2*1.43);return lk(h2,{open:!!c,anchorPosition:c,onClose:s,filter:{options:o.map(p=>({value:p.name,label:p.name,icon:lk(po,{src:m?.get(p.name)??"",name:p.name,avatarSx:{width:d,height:d,fontSize:Math.round(d/2),borderRadius:"50%",flexShrink:0,...Kr[0]},iconFontSize:Math.round(d*.6)})})),value:a,onChange:p=>{let f=im(a,p);if(!f)return;let g=f.kind==="toggle"?o.find(x=>x.name===f.value):void 0;g?i(g):l()},clearLabel:n("menu.clearFilter"),emptyText:n("menu.noMembersInList")}})}import{useState as k2}from"react";import{ButtonBase as T2,Menu as y2,MenuItem as C2}from"@mui/material";import S2 from"@mui/icons-material/KeyboardArrowDown";import v2 from"@mui/icons-material/Check";import{Fragment as B2,jsx as vp,jsxs as Bp}from"react/jsx-runtime";function goe({value:e,onChange:t,options:o}){let[a,r]=k2(null),i=o??fu,l=fu.find(s=>s.value===e)?.label??"";return Bp(B2,{children:[Bp(T2,{onClick:s=>r(s.currentTarget),sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:.5,borderRadius:1,fontSize:13.5,color:"#37352f","&:hover":{bgcolor:"#f2f2f0"}},children:[l,vp(S2,{sx:{fontSize:17,color:"#9a9a97"}})]}),vp(y2,{transitionDuration:0,anchorEl:a,open:!!a,onClose:()=>r(null),children:i.map(s=>Bp(C2,{selected:s.value===e,onClick:()=>{t(s.value),r(null)},sx:{fontSize:14,minWidth:140,justifyContent:"space-between",gap:1},children:[s.label,s.value===e?vp(v2,{sx:{fontSize:16,color:"#2f80ed"}}):null]},s.value))})]})}import{Box as lm,ButtonBase as _2}from"@mui/material";import{DateTextField as sk}from"@ehfuse/mui-form-controls";import{jsx as Nl,jsxs as ck}from"react/jsx-runtime";var I2=[{get label(){return n("range.month1")},months:1},{get label(){return n("range.month3")},months:3},{get label(){return n("range.month6")},months:6},{get label(){return n("range.year1")},months:12},{get label(){return n("common.all")},months:0}];function mk({fromDate:e,toDate:t,onChange:o}){L();let a=i=>{if(i<=0){o("","");return}o(Wi(vm(i)),Wi(new Date))},r=i=>i<=0?!e&&!t:!e||!t?!1:e===Wi(vm(i))&&t===Wi(new Date);return ck(lm,{sx:{display:"flex",alignItems:"center",gap:1.5,flexWrap:"wrap"},children:[Nl(lm,{sx:{display:"flex",alignItems:"center",gap:1.5},children:I2.map(i=>{let l=r(i.months);return Nl(_2,{onClick:()=>a(i.months),sx:{px:1.25,py:.85,borderRadius:1,fontSize:13,fontWeight:l?500:400,border:"1px solid",borderColor:l?"#2f80ed":"#dedddb",color:l?"#2f80ed":"#37352f",bgcolor:l?"#eef6ff":"transparent","&:hover":{bgcolor:l?"#eef6ff":"#f7f7f5"}},children:i.label},i.label)})}),ck(lm,{sx:{display:"flex",alignItems:"center",gap:.5},children:[Nl(sk,{value:e,size:"small",placeholder:n("calendar.startDate"),onChange:i=>o(i.target.value,t),sx:{width:140,"& .MuiInputBase-input":{fontSize:13}}}),Nl(lm,{component:"span",sx:{fontSize:13,color:"#9a9a97"},children:"~"}),Nl(sk,{value:t,size:"small",placeholder:n("calendar.endDate"),onChange:i=>o(e,i.target.value),sx:{width:140,"& .MuiInputBase-input":{fontSize:13}}})]})]})}import{Popover as w2}from"@mui/material";import{jsx as uk}from"react/jsx-runtime";function _oe({anchorEl:e,fromDate:t,toDate:o,onChange:a,onClose:r}){return uk(w2,{transitionDuration:0,anchorEl:e,open:!!e,onClose:r,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{p:1.5}}},children:uk(mk,{fromDate:t,toDate:o,onChange:a})})}import{Box as D2,ButtonBase as E2,Tab as R2,Tabs as P2}from"@mui/material";import M2 from"@mui/icons-material/Checklist";import O2 from"@mui/icons-material/Face";import L2 from"@mui/icons-material/Publish";import A2 from"@mui/icons-material/NotificationsOutlined";import q2 from"@mui/icons-material/BugReportOutlined";import z2 from"@mui/icons-material/SupportAgentOutlined";import N2 from"@mui/icons-material/DescriptionOutlined";import F2 from"@mui/icons-material/Inventory2Outlined";import{jsx as pn}from"react/jsx-runtime";function dk(e,t){return t>0?`${e} (${t})`:e}var Hoe=[{id:"my",get label(){return n("tab.all")},icon:pn(M2,{sx:{fontSize:18}})},{id:"mine",get label(){return n("tab.mine")},icon:pn(O2,{sx:{fontSize:18}})},{id:"sent",get label(){return n("tab.sent")},icon:pn(L2,{sx:{fontSize:18}})},{id:"support",get label(){return n("tab.support")},icon:pn(z2,{sx:{fontSize:18}})},{id:"bug",get label(){return n("tab.bug")},icon:pn(q2,{sx:{fontSize:18}})},{id:"notice",get label(){return n("tab.notice")},icon:pn(A2,{sx:{fontSize:18}})},{id:"archive",get label(){return n("tab.archive")},icon:pn(F2,{sx:{fontSize:18}}),hideCount:!0},{id:"report",get label(){return n("tab.report")},icon:pn(N2,{sx:{fontSize:18}}),hideCount:!0}];function H2(e){return{minHeight:46,minWidth:75,bgcolor:e.bg,color:e.color,borderRadius:"8px 8px 0 0",padding:"10px 18px",textTransform:"none",fontSize:14,fontWeight:500,border:`1px solid ${e.borderColor}`,borderBottom:"none","&:hover":{bgcolor:e.hoverBg},"&.Mui-selected":{bgcolor:e.selectedBg,color:e.selectedColor,border:`1px solid ${e.selectedBg}`,borderBottom:"none","&:hover":{bgcolor:e.selectedBg}},...e.sx}}function Woe({items:e,activeTab:t,counts:o,onChange:a,compact:r=!1}){L();let i=xe(),l=H2(i.tabs),s=e;return r?pn(D2,{sx:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:1},children:s.map(c=>{let u=t===c.id;return pn(E2,{onClick:()=>a(c.id),sx:{height:40,minWidth:0,px:.5,borderRadius:1,fontSize:dt(13.5),fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",border:"1px solid",bgcolor:u?i.tabs.selectedBg:i.tabs.bg,color:u?i.tabs.selectedColor:i.tabs.color,borderColor:u?i.tabs.selectedBg:i.tabs.borderColor},children:dk(c.label,c.hideCount?0:o[c.id]??0)},c.id)})}):pn(P2,{value:t,onChange:(c,u)=>a(u),sx:{minHeight:46,"& .MuiTabs-indicator":{display:"none"},"& .MuiTabs-flexContainer":{gap:"12px",minHeight:46}},children:s.map(c=>pn(R2,{value:c.id,label:dk(c.label,c.hideCount?0:o[c.id]??0),icon:c.icon,iconPosition:"start",sx:l},c.id))})}import{useEffect as W2,useMemo as $2,useState as _p}from"react";import{Divider as sm,ListItemIcon as ho,Menu as Ip,MenuItem as Gt}from"@mui/material";import V2 from"@mui/icons-material/OpenInNewOutlined";import U2 from"@mui/icons-material/RestoreFromTrashOutlined";import K2 from"@mui/icons-material/Check";import G2 from"@mui/icons-material/CheckCircleOutlined";import j2 from"@mui/icons-material/RadioButtonUnchecked";import Y2 from"@mui/icons-material/SendOutlined";import X2 from"@mui/icons-material/EventOutlined";import Q2 from"@mui/icons-material/PersonOutlineOutlined";import J2 from"@mui/icons-material/ViewKanbanOutlined";import Z2 from"@mui/icons-material/ContentCopyOutlined";import e5 from"@mui/icons-material/PrintOutlined";import t5 from"@mui/icons-material/NextPlanOutlined";import o5 from"@mui/icons-material/ContentPasteOutlined";import n5 from"@mui/icons-material/ShareOutlined";import r5 from"@mui/icons-material/DirectionsRunOutlined";import pk from"@mui/icons-material/ChevronRight";import a5 from"@mui/icons-material/ArchiveOutlined";import i5 from"@mui/icons-material/UnarchiveOutlined";import{ConfirmDialog as fk}from"@ehfuse/alerts";import{Fragment as gk,jsx as Te,jsxs as Lt}from"react/jsx-runtime";function vne({target:e,onClose:t,customTabs:o,sprints:a=[],myAccountSeq:r=0,onOpenDetail:i,onToggleCompleted:l,onRequestConfirm:s,onChangeDueDate:c,onChangeReminder:u,onMemberEdit:m,onMoveProject:d,onDuplicate:p,onPrint:f,onCreateFollowUp:g,onShare:x,onAssignSprint:h,onArchiveToggle:E,onDelete:b,onRestore:B,onPurge:T}){L();let z=We(),k=Nn(),[_,D]=_p(null),[F,R]=_p(null),[C,y]=_p(null);W2(()=>{e||(D(null),R(null),y(null))},[e]);let I=e?.task??null,S=!!I?.is_notice,O=!!I?.is_event,w=I?!Hn(I,r):!1,{editPolicy:q,shareText:v}=le(),M=I?Ur(I,r,q):!1,j=I?ha(I,r,q,w):!1,V=I?ha(I,r,q,!1):!1,Z=!!I?.deleted,ae=(()=>{if(!I||I.completed)return!0;let G=$n(I,r);return G.total===0||G.count>=G.total})(),me=$2(()=>new Set(o.filter(G=>G.useSprints).map(G=>G.key)),[o]),U=async(G="one")=>{let re=I;if(t(),!re)return;await fk({title:n("menu.deleteTask"),message:G==="series"?n("menu.deleteSeriesConfirm",{title:re.title}):n("menu.deleteTaskConfirm",{title:re.title})})&&b?.(re.seq,G)},ee=async()=>{let G=I;if(t(),!G)return;await fk({title:n("menu.purge"),message:n("menu.purgeConfirm",{title:G.title})})&&T?.(G.seq)},$=()=>{I&&E(I.seq,!I.archived),t()};return Lt(gk,{children:[Lt(Ip,{open:!!e,onClose:t,transitionDuration:0,anchorReference:z?"none":"anchorPosition",anchorPosition:!z&&e?{top:e.position.top,left:e.position.left}:void 0,slotProps:{paper:{sx:{minWidth:190,...z?{position:"fixed",top:"50%",left:"50%",translate:"-50% -50%",maxHeight:"70vh"}:{}}},list:z?{sx:{"& .MuiMenuItem-root":{py:1,minHeight:0}}}:void 0},children:[Lt(Gt,{onClick:()=>{I&&i(I),t()},sx:{fontSize:14},children:[Te(ho,{children:Te(V2,{sx:{fontSize:19}})}),n("menu.openDetail")]}),Z?Te(sm,{}):null,Z&&B?Lt(Gt,{disabled:V,onClick:()=>{I&&B(I.seq),t()},sx:{fontSize:14},children:[Te(ho,{children:Te(U2,{sx:{fontSize:19}})}),n("menu.restore")]}):null,Z&&T?Lt(Gt,{disabled:V,onClick:()=>{ee()},sx:{fontSize:14,color:"#e5484d"},children:[Te(ho,{children:Te(Xt,{sx:{fontSize:19,color:"#e5484d"}})}),n("menu.purge")]}):null,Z?null:Lt(gk,{children:[Lt(Gt,{disabled:S?(I?.author_account_seq??0)!==r:(I?.author_account_seq??0)!==r&&(I?.manager_account_seq??0)!==r,onClick:()=>{I&&l(I.seq,!I.completed),t()},sx:{fontSize:14},children:[Te(ho,{children:I?.completed?Te(j2,{sx:{fontSize:19}}):Te(G2,{sx:{fontSize:19}})}),I?.completed?n("menu.uncomplete"):n("menu.complete")]}),!S&&s?Lt(Gt,{disabled:ae,onClick:()=>{I&&s(I),t()},sx:{fontSize:14},children:[Te(ho,{children:Te(Y2,{sx:{fontSize:19}})}),n("menu.requestConfirm")]}):null,O?null:Te(sm,{}),O?null:Lt(Gt,{disabled:M,onClick:G=>{I&&D({anchorEl:G.currentTarget,task:I})},sx:{fontSize:14},children:[Te(ho,{children:Te(X2,{sx:{fontSize:19}})}),n("menu.changeDue")]}),!S&&!O&&m?Lt(Gt,{disabled:q==="coreAuthorManager"?M:!1,onClick:()=>{I&&m(I,"manager"),t()},sx:{fontSize:14},children:[Te(ho,{children:Te(Q2,{sx:{fontSize:19}})}),n("menu.changeOwner")]}):null,O?null:Lt(Gt,{disabled:M,onClick:G=>{I&&R({anchorEl:G.currentTarget,task:I})},sx:{fontSize:14},children:[Te(ho,{children:Te(J2,{sx:{fontSize:19}})}),n("menu.moveProject"),Te(pk,{sx:{fontSize:18,ml:"auto",color:"#9a9a97"}})]}),Te(sm,{}),p?Lt(Gt,{disabled:w,onClick:()=>{I&&p(I.seq),t()},sx:{fontSize:14},children:[Te(ho,{children:Te(Z2,{sx:{fontSize:19}})}),n("menu.duplicate")]}):null,f?Lt(Gt,{onClick:()=>{I&&f(I),t()},sx:{fontSize:14},children:[Te(ho,{children:Te(e5,{sx:{fontSize:19}})}),n("common.print")]}):null,g&&I&&!I.is_event&&!I.is_notice?Lt(Gt,{onClick:()=>{I&&g(I.seq),t()},sx:{fontSize:14},children:[Te(ho,{children:Te(t5,{sx:{fontSize:19}})}),n("menu.createFollowUp")]}):null,Lt(Gt,{onClick:()=>{I&&(x?x(I):hi(I,z,v)),t()},sx:{fontSize:14},children:[Te(ho,{children:z?Te(n5,{sx:{fontSize:19}}):Te(o5,{sx:{fontSize:19}})}),z?n("menu.share"):n("menu.copyContent")]}),I&&!I.is_notice&&!I.is_event&&me.has(String(I.tab_key??""))&&h?Lt(Gt,{onClick:G=>y(G.currentTarget),sx:{fontSize:14},children:[Te(ho,{children:Te(r5,{sx:{fontSize:19}})}),n("menu.addToSprint"),Te(pk,{sx:{fontSize:18,ml:"auto",color:"#9a9a97"}})]}):null,Lt(Gt,{onClick:$,disabled:w||!I?.archived&&!(I&&Ss(I)),sx:{fontSize:14},children:[Te(ho,{children:I?.archived?Te(i5,{sx:{fontSize:19}}):Te(a5,{sx:{fontSize:19}})}),I?.archived?n("menu.unarchive"):n("menu.archive")]}),b?Te(sm,{}):null,b?Lt(Gt,{disabled:j,onClick:()=>{U("one")},sx:{fontSize:14,color:"#e5484d"},children:[Te(ho,{children:Te(Xt,{sx:{fontSize:19,color:"#e5484d"}})}),(I?.repeat_group_key??0)>0?n("menu.deleteThisOnly"):n("common.delete")]}):null,b&&(I?.repeat_group_key??0)>0?Lt(Gt,{disabled:j,onClick:()=>{U("series")},sx:{fontSize:14,color:"#e5484d"},children:[Te(ho,{children:Te(Xt,{sx:{fontSize:19,color:"#e5484d"}})}),n("menu.deleteSeries")]}):null]})]}),Te(an,{anchorEl:_?.anchorEl??null,open:!!_,date:_?.task.due_date??"",reminders:nn(_?.task),hideReminder:!!_?.task.completed,centered:z,onClose:()=>{D(null),t()},onDateChange:G=>{_&&c(_.task.seq,G)},onReminderChange:G=>{_&&u?.(_.task.seq,G)}}),Lt(Ip,{transitionDuration:0,anchorEl:F?.anchorEl??null,open:!!F,onClose:()=>{R(null),t()},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},...k,children:[Te(Gt,{selected:!F?.task.tab_key,onClick:()=>{F&&d(F.task.seq,""),R(null),t()},sx:{fontSize:14,minWidth:170},children:n("common.none")}),o.filter(G=>!G.archived).map(G=>Te(Gt,{selected:F?.task.tab_key===G.key,onClick:()=>{F&&d(F.task.seq,G.key),R(null),t()},sx:{fontSize:14,minWidth:170},children:G.label},G.key))]}),Te(Ip,{transitionDuration:0,anchorEl:C,open:!!C,onClose:()=>y(null),anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},children:[{seq:0,label:n("menu.backlogUnassigned")},...a.filter(G=>`custom-${G.group_seq}`===String(I?.tab_key??"")).map(G=>({seq:G.seq,label:sn(G)}))].map(G=>Lt(Gt,{onClick:()=>{I&&h?.(I.seq,G.seq),y(null),t()},sx:{fontSize:14,minWidth:160,gap:1},children:[G.label,(I?.sprint_seq??0)===G.seq?Te(K2,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},G.seq))})]})}import{HeaderMenu as l5}from"@ehfuse/mui-virtual-data-table";import{jsx as xk}from"react/jsx-runtime";function Ene({anchorPosition:e,anchorEl:t,labelOptions:o,selectedKeys:a,onChange:r,onToggle:i,onClear:l,clearLabel:s=n("menu.clearFilter"),onClose:c}){L();let u=Bi(t,e);return xk(l5,{open:!!u,anchorPosition:u,onClose:c,filter:{options:o.map(m=>({value:m.key,label:m.name,icon:xk(ik,{color:m.dot})})),value:a,onChange:m=>{if(r){r(m);return}let d=im(a,m);d?.kind==="toggle"?i?.(d.value):d?.kind==="clear"&&l?.()},clearLabel:s}})}import s5 from"@mui/icons-material/SettingsOutlined";import{HeaderMenu as c5,HeaderMenuItem as m5,HEADER_MENU_ICON_SIZE as u5}from"@ehfuse/mui-virtual-data-table";import{jsx as cm}from"react/jsx-runtime";function zne(e){L();let{anchorPosition:t,anchorEl:o,sprints:a,value:r,onSelect:i,onManage:l,onClose:s}=e,c=Bi(o,t),u=[{seq:0,label:n("common.all")},{seq:-1,label:n("menu.unassignedTasks")},...a.map(m=>({seq:m.seq,label:sn(m)}))];return cm(c5,{open:!!c,anchorPosition:c,onClose:s,header:u.map(m=>cm(ak,{checked:r===m.seq,onClick:()=>{i(m.seq),s()},children:m.label},m.seq)),children:cm(m5,{icon:cm(s5,{sx:{fontSize:u5,color:"text.secondary"}}),onClick:()=>{s(),l()},children:n("menu.manageGoals")})})}var d5={my:"tasks",mine:"tasks",sent:"tasks",notice:"notice",support:"support",bug:"bug",archive:"archive",done:"done",report:"report"};function p5(e){return d5[e]??"tasks"}var hk={get list(){return n("menu.list")},get card(){return n("menu.project")},get kanban(){return n("menu.status")},get sprint(){return n("menu.goal")},get calendar(){return n("menu.weekly")},get month(){return n("menu.monthly")},get agenda(){return n("menu.agenda")},get timeline(){return n("menu.timeline")}},bk=["list","calendar","month","card","kanban","sprint","timeline"],f5=["list","kanban"],g5=["list","card"];function Wne(e){let t=p5(e);switch(t){case"notice":return{kind:t,viewOptions:[],showCreate:!0,createLabel:n("task.createNotice"),showGroupBy:!1,showSprintFilter:!1,showDateRange:!1,showHideCompleted:!0,forceFlatList:!0,columns:{notice:!0}};case"bug":return{kind:t,viewOptions:bk,showCreate:!0,createLabel:n("task.createBug"),showGroupBy:!0,showSprintFilter:!0,showDateRange:!1,showHideCompleted:!0,forceFlatList:!1,columns:{bug:!0}};case"support":return{kind:t,viewOptions:f5,showCreate:!1,createLabel:"",showGroupBy:!0,showSprintFilter:!1,showDateRange:!1,showHideCompleted:!0,forceFlatList:!1,columns:{support:!0,showProject:!1}};case"archive":return{kind:t,viewOptions:g5,showCreate:!1,createLabel:"",showGroupBy:!1,showSprintFilter:!1,showDateRange:!0,showHideCompleted:!1,forceFlatList:!0,columns:{showActions:!1}};case"done":return{kind:t,viewOptions:["list"],showCreate:!1,createLabel:"",showGroupBy:!1,showSprintFilter:!1,showDateRange:!0,showHideCompleted:!1,forceFlatList:!0,columns:{showActions:!1}};case"report":return{kind:t,viewOptions:[],showCreate:!1,createLabel:"",showGroupBy:!1,showSprintFilter:!1,showDateRange:!0,showHideCompleted:!1,forceFlatList:!0,columns:{}};default:return{kind:t,viewOptions:bk,showCreate:!0,createLabel:n("task.createTask"),showGroupBy:!0,showSprintFilter:!0,showDateRange:!1,showHideCompleted:!0,forceFlatList:!1,columns:e==="mine"?{showRequest:!1,confirmMode:"action"}:e==="sent"?{confirmMode:"time"}:{}}}}import{useMemo as x5}from"react";import{useKeyboardState as b5}from"@ehfuse/keyboard-state";var kk=[{key:"g l",view:"list"},{key:"g b",view:"card"},{key:"g k",view:"kanban"},{key:"g s",view:"sprint"},{key:"g c",view:"calendar"},{key:"g m",view:"month"},{key:"g t",view:"timeline"}];function jne(e,t={}){let{enabled:o=!0,views:a}=t,{onCreateTask:r,onFocusSearch:i,onToggleHelp:l,onChangeView:s,onEscape:c}=e,u=a?a.join(","):"",m=x5(()=>{let d=[];if(r&&d.push({key:"n",callback:r,options:{preventDefault:!0}}),i&&d.push({key:"/",callback:i,options:{preventDefault:!0}}),l&&d.push({key:"shift+?",callback:l,options:{preventDefault:!0}}),c&&d.push({key:"escape",callback:c,options:{allowInEditable:!0}}),s)for(let p of Tk(u?u.split(","):void 0))d.push({key:p.key,callback:()=>s(p.view),options:{preventDefault:!0}});return d},[r,i,l,s,c,u]);b5(o?m:[])}function Tk(e){if(!e)return kk;let t=new Set(e);return kk.filter(o=>t.has(o.view))}function Fl(e){return[{keys:"N",description:n("task.createNew")},{keys:"/",description:n("common.search")},...Tk(e).map(t=>({keys:t.key.split(" ").map(o=>o.toUpperCase()).join(" \u2192 "),description:n("task.showView",{value:hk[t.view]})})),{keys:"?",description:n("task.help")},{keys:"Esc",description:n("common.close")}]}var Yne=Fl();import{Box as Wl,Button as k5}from"@mui/material";import T5 from"@mui/icons-material/ArrowRightAlt";import{FormDialog as y5}from"@ehfuse/mui-form-dialog";import{useState as h5}from"react";var yk={id:"concept",tabTitle:"manual.concept.tabTitle1",intro:"manual.concept.intro1",topics:[{title:"manual.concept.title1",lead:"manual.concept.lead1",steps:[{title:"manual.concept.title2",desc:"manual.concept.desc1"},{title:"manual.concept.title3",desc:"manual.concept.desc2"},{title:"manual.concept.title4",desc:"manual.concept.desc3"}]},{title:"manual.concept.title5",subtitle:"manual.concept.subtitle1",lead:"manual.concept.lead2",items:[{term:"manual.concept.term1",desc:"manual.concept.desc4"},{term:"manual.concept.term2",desc:"manual.concept.desc5"},{term:"manual.concept.term3",desc:"manual.concept.desc6"}]},{title:"manual.concept.title6",lead:"manual.concept.lead3",items:[{term:"manual.concept.term4",desc:"manual.concept.desc7"},{term:"manual.concept.term5",desc:"manual.concept.desc8"},{term:"manual.concept.term6",desc:"manual.concept.desc9"}]},{title:"manual.concept.title7",lead:"manual.concept.lead4",items:[{term:"manual.concept.term7",desc:"manual.concept.desc10"},{term:"manual.concept.term8",desc:"manual.concept.desc11"},{term:"manual.concept.term9",desc:"manual.concept.desc12"},{term:"manual.concept.term10",desc:"manual.concept.desc13"}]},{title:"manual.concept.title8",lead:"manual.concept.lead5",items:[{term:"manual.concept.term11",desc:"manual.concept.desc14"},{term:"manual.concept.term12",desc:"manual.concept.desc15"},{term:"manual.concept.term13",desc:"manual.concept.desc16"},{term:"manual.concept.term14",desc:"manual.concept.desc17"},{term:"manual.concept.term15",desc:"manual.concept.desc18"},{term:"manual.concept.term16",desc:"manual.concept.desc19"}]},{title:"manual.concept.title9",subtitle:"manual.concept.subtitle2",lead:"manual.concept.lead6",items:[{term:"manual.concept.term17",desc:"manual.concept.desc20"},{term:"manual.concept.term18",desc:"manual.concept.desc21"},{term:"manual.concept.term19",desc:"manual.concept.desc22"}]},{title:"manual.concept.title10",lead:"manual.concept.lead7",items:[{term:"manual.concept.term20",desc:"manual.concept.desc23"},{term:"manual.concept.term21",desc:"manual.concept.desc24"}]}]};var Ck={id:"roles",tabTitle:"manual.roles.tabTitle1",intro:"manual.roles.intro1",topics:[{title:"manual.roles.title1",subtitle:"manual.roles.subtitle1",lead:"manual.roles.lead1",items:[{term:"manual.roles.term1",desc:"manual.roles.desc1"},{term:"manual.roles.term2",desc:"manual.roles.desc2"},{term:"manual.roles.term3",desc:"manual.roles.desc3"},{term:"manual.roles.term4",desc:"manual.roles.desc4"},{term:"manual.roles.term5",desc:"manual.roles.desc5"}]},{title:"manual.roles.title2",subtitle:"manual.roles.subtitle2",lead:"manual.roles.lead2",items:[{term:"manual.roles.term6",desc:"manual.roles.desc6"},{term:"manual.roles.term7",desc:"manual.roles.desc7"},{term:"manual.roles.term8",desc:"manual.roles.desc8"},{term:"manual.roles.term9",desc:"manual.roles.desc9"},{term:"manual.roles.term10",desc:"manual.roles.desc10"},{term:"manual.roles.term11",desc:"manual.roles.desc11"}]},{title:"manual.roles.title3",subtitle:"manual.roles.subtitle3",lead:"manual.roles.lead3",items:[{term:"manual.roles.term12",desc:"manual.roles.desc12"},{term:"manual.roles.term13",desc:"manual.roles.desc13"},{term:"manual.roles.term14",desc:"manual.roles.desc14"},{term:"manual.roles.term15",desc:"manual.roles.desc15"},{term:"manual.roles.term16",desc:"manual.roles.desc16"}]},{title:"manual.roles.title4",lead:"manual.roles.lead4",items:[{term:"manual.roles.term17",desc:"manual.roles.desc17"},{term:"manual.roles.term18",desc:"manual.roles.desc18"},{term:"manual.roles.term19",desc:"manual.roles.desc19"},{term:"manual.roles.term20",desc:"manual.roles.desc20"},{term:"manual.roles.term21",desc:"manual.roles.desc21"},{term:"manual.roles.term22",desc:"manual.roles.desc22"},{term:"manual.roles.term23",desc:"manual.roles.desc23"}]},{title:"manual.roles.title5",lead:"manual.roles.lead5",items:[{term:"manual.roles.term24",desc:"manual.roles.desc24"},{term:"manual.roles.term25",desc:"manual.roles.desc25"},{term:"manual.roles.term26",desc:"manual.roles.desc26"},{term:"manual.roles.term27",desc:"manual.roles.desc27"}]},{title:"manual.roles.title6",feature:"support",lead:"manual.roles.lead6",items:[{term:"manual.roles.term28",desc:"manual.roles.desc28"},{term:"manual.roles.term29",desc:"manual.roles.desc29"},{term:"manual.roles.term30",desc:"manual.roles.desc30"},{term:"manual.roles.term31",desc:"manual.roles.desc31"}]}]};var Sk={id:"basics",tabTitle:"manual.basics.tabTitle1",intro:"manual.basics.intro1",topics:[{title:"manual.basics.title1",lines:["manual.basics.line1","manual.basics.line2","manual.basics.line3","manual.basics.line4","manual.basics.line5"]},{title:"manual.basics.title2",subtitle:"manual.basics.subtitle1",lead:"manual.basics.lead1",lines:["manual.basics.line6","manual.basics.text1","manual.basics.text2","manual.basics.text3","manual.basics.text4","manual.basics.text5"]},{title:"manual.basics.title3",lines:["manual.basics.line7","manual.basics.line8","manual.basics.line9"]},{title:"manual.basics.title4",lines:["manual.basics.line10","manual.basics.line11"]},{title:"manual.basics.title5",lines:["manual.basics.line12","manual.basics.line13"]},{title:"manual.basics.title6",subtitle:"manual.basics.subtitle2",lines:["manual.basics.line14","manual.basics.line15","manual.basics.line16","manual.basics.line17"]},{title:"manual.basics.title7",lines:["manual.basics.line18","manual.basics.line19","manual.basics.line20"]}]};var vk={id:"notify",tabTitle:"manual.notify.tabTitle1",intro:"manual.notify.intro1",topics:[{title:"manual.notify.title1",items:[{term:"manual.notify.term1",desc:"manual.notify.desc1"},{term:"manual.notify.term2",desc:"manual.notify.desc2"},{term:"manual.notify.term3",desc:"manual.notify.desc3"},{term:"manual.notify.term4",desc:"manual.notify.desc4"},{term:"manual.notify.term5",desc:"manual.notify.desc5"},{term:"manual.notify.term6",desc:"manual.notify.desc6"},{term:"manual.notify.term7",desc:"manual.notify.desc7"}]},{title:"manual.notify.title2",items:[{term:"manual.notify.term8",desc:"manual.notify.desc8"},{term:"manual.notify.term9",desc:"manual.notify.desc9"},{term:"manual.notify.term10",desc:"manual.notify.desc10"},{term:"manual.notify.term11",desc:"manual.notify.desc11"},{term:"manual.notify.term12",desc:"manual.notify.desc12"},{term:"manual.notify.term13",desc:"manual.notify.desc13"},{term:"manual.notify.term14",desc:"manual.notify.desc14"}]},{title:"manual.notify.title3",lead:"manual.notify.lead1",items:[{term:"manual.notify.term15",desc:"manual.notify.desc15"},{term:"manual.notify.term16",desc:"manual.notify.desc16"},{term:"manual.notify.term17",desc:"manual.notify.desc17"}]},{title:"manual.notify.title4",lead:"manual.notify.lead2",items:[{term:"manual.notify.term18",desc:"manual.notify.desc18"},{term:"manual.notify.term19",desc:"manual.notify.desc19"},{term:"manual.notify.term20",desc:"manual.notify.desc20"},{term:"manual.notify.term21",desc:"manual.notify.desc21"},{term:"manual.notify.term22",desc:"manual.notify.desc22"}]},{title:"manual.notify.title5",lead:"manual.notify.lead3",items:[{term:"manual.notify.term23",desc:"manual.notify.desc23"},{term:"manual.notify.term24",desc:"manual.notify.desc24"},{term:"manual.notify.term25",desc:"manual.notify.desc25"},{term:"manual.notify.term26",desc:"manual.notify.desc26"},{term:"manual.notify.term27",desc:"manual.notify.desc27"}]},{title:"manual.notify.title6",items:[{term:"manual.notify.term28",desc:"manual.notify.desc28"},{term:"manual.notify.term29",desc:"manual.notify.desc29"},{term:"manual.notify.term30",desc:"manual.notify.desc30"}]},{title:"manual.notify.title7",items:[{term:"manual.notify.term31",desc:"manual.notify.desc31"},{term:"manual.notify.term32",desc:"manual.notify.desc32"},{term:"manual.notify.term33",desc:"manual.notify.desc33"},{term:"manual.notify.term34",desc:"manual.notify.desc34"},{term:"manual.notify.term35",desc:"manual.notify.desc35"},{term:"manual.notify.term36",desc:"manual.notify.desc36"},{term:"manual.notify.term37",desc:"manual.notify.desc37"}]}]};var Bk={id:"more",tabTitle:"manual.more.tabTitle1",intro:"manual.more.intro1",topics:[{title:"manual.more.title1",lead:"manual.more.lead1",lines:["manual.more.line1","manual.more.text1","manual.more.text2"]},{title:"manual.more.title2",lead:"manual.more.lead2",items:[{term:"manual.more.term1",desc:"manual.more.desc1"},{term:"manual.more.term2",desc:"manual.more.desc2"},{term:"manual.more.term3",desc:"manual.more.desc3"},{term:"manual.more.term4",desc:"manual.more.desc4"},{term:"manual.more.term5",desc:"manual.more.desc5"},{term:"manual.more.term6",desc:"manual.more.desc6"}]},{title:"manual.more.title3",lines:["manual.more.line2","manual.more.line3"]},{title:"manual.more.title4",feature:"timeline",lines:["manual.more.line4"]},{title:"manual.more.title5",feature:"charts",lines:["manual.more.line5"]},{title:"manual.more.title6",lines:["manual.more.line6","manual.more.line7","manual.more.line8"]},{title:"manual.more.title7",feature:"label",lines:["manual.more.line9"]},{title:"manual.more.title8",lines:["manual.more.line10","manual.more.line11","manual.more.line12","manual.more.line13"]},{title:"manual.more.title9",lines:["manual.more.line14","manual.more.line15"]},{title:"manual.more.title10",subtitle:"manual.more.subtitle1",lead:"manual.more.lead3",lines:["manual.more.line16","manual.more.line17","manual.more.line18","manual.more.line19"]},{title:"manual.more.title11",lines:["manual.more.line20","manual.more.line21","manual.more.line22"]},{title:"manual.more.title12",feature:"project",lines:["manual.more.line23","manual.more.line24"]},{title:"manual.more.title13",feature:"sprint",lines:["manual.more.line25","manual.more.line26"]},{title:"manual.more.title14",lines:["manual.more.line27","manual.more.line28","manual.more.line29"]},{title:"manual.more.title15",lines:["manual.more.line30"]},{title:"manual.more.title16",feature:"bug",lines:["manual.more.line31","manual.more.line32"]},{title:"manual.more.title17",feature:"support",lines:["manual.more.line33","manual.more.line34"]},{title:"manual.more.title18",feature:"report",lines:["manual.more.line35"]}]};var _k={id:"calendar",tabTitle:"manual.calendar.tabTitle1",intro:"manual.calendar.intro1",topics:[{title:"manual.calendar.title1",lead:"manual.calendar.lead1",items:[{term:"manual.calendar.term1",desc:"manual.calendar.desc1"},{term:"manual.calendar.term2",desc:"manual.calendar.desc2"}]},{title:"manual.calendar.title2",lines:["manual.calendar.line1","manual.calendar.line2","manual.calendar.line3","manual.calendar.line4"]},{title:"manual.calendar.title3",lines:["manual.calendar.line5","manual.calendar.line6","manual.calendar.line7","manual.calendar.line8"]}]};var Ik={id:"shortcuts",tabTitle:"manual.shortcuts.tabTitle1",topics:[]};var Hl=[yk,Ck,Sk,vk,Bk,_k,Ik];function wk(e=Hl){let t=o=>o&&n(o);return e.map(o=>({...o,tabTitle:n(o.tabTitle),intro:t(o.intro),topics:o.topics.map(a=>({...a,title:n(a.title),subtitle:t(a.subtitle),lead:t(a.lead),steps:a.steps?.map(r=>({title:n(r.title),desc:n(r.desc)})),items:a.items?.map(r=>({term:n(r.term),desc:n(r.desc)})),lines:a.lines?.map(r=>n(r))}))}))}function Dk({open:e,onClose:t}){return{modals:{dialog:no({modalIdPrefix:"taskbox-shortcut-help-dialog",open:e,onClose:t})}}}function Ek({open:e,onClose:t,features:o,initialTab:a}){let[r,i]=h5(0);return{modals:{dialog:no({modalIdPrefix:"taskbox-manual-dialog",open:e,onClose:t,onOpen:()=>{let c=Hl.filter(u=>!u.feature||o[u.feature]!==!1).findIndex(u=>u.id===a);i(Math.max(0,c))}})},activeTabIndex:r,setActiveTabIndex:i}}import{jsx as ra,jsxs as Rk}from"react/jsx-runtime";function C5({keys:e}){return ra(Wl,{sx:{display:"flex",alignItems:"center",gap:.5,justifyContent:"flex-end"},children:e.split(" \u2192 ").map((t,o)=>Rk(Wl,{sx:{display:"flex",alignItems:"center",gap:.5},children:[o>0?ra(T5,{sx:{fontSize:18,color:"#9a9a97"}}):null,ra(Wl,{component:"span",sx:{minWidth:32,height:32,px:.75,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:13.5,fontWeight:700,color:"#37352f",bgcolor:"#f4f4f2",border:"1px solid #e0dfdb",borderRadius:1,fontVariantNumeric:"tabular-nums"},children:t})]},`${t}-${o}`))})}function Sre({open:e,onClose:t,views:o}){L();let{modals:a}=Dk({open:e,onClose:t}),r=Fl(o);return ra(y5,{open:a.dialog.isOpen,onClose:a.dialog.close,maxWidth:"xs",title:n("shortcut.title"),locale:Ce(),titleIcons:{delete:{visible:!1}},tabs:{visible:!1},sectionContentPaddingTop:0,sections:[{id:"shortcuts",showTitle:!1,children:ra(Wl,{sx:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:2,rowGap:1.25,alignItems:"center",fontSize:14,color:"#37352f"},children:r.map(i=>Rk(Wl,{sx:{display:"contents"},children:[ra(C5,{keys:i.keys}),ra("span",{children:i.description})]},i.keys))})}],actions:{showCancelButton:!1,right:ra(k5,{variant:"contained",onClick:a.dialog.close,children:n("common.close")})}})}import{Fragment as wp}from"react";import{Box as Rt,Button as S5}from"@mui/material";import v5 from"@mui/icons-material/ArrowRightAlt";import B5 from"@mui/icons-material/ChevronRightRounded";import _5 from"@mui/icons-material/ArrowForward";import{FormDialog as I5}from"@ehfuse/mui-form-dialog";import{Fragment as L5,jsx as Ke,jsxs as Er}from"react/jsx-runtime";function mm(e){return e.split(/(\*\*[^*]+\*\*|\s*(?:→|->)\s*)/g).filter(o=>o.length>0).map((o,a)=>o.startsWith("**")&&o.endsWith("**")?Ke(Rt,{component:"strong",sx:{fontWeight:700},children:o.slice(2,-2)},a):/^\s*(?:→|->)\s*$/.test(o)?Ke(_5,{sx:{fontSize:"1em",verticalAlign:"-0.15em",mx:.5,color:"text.secondary"}},a):Ke(wp,{children:o},a))}function w5({keys:e}){let t=xe();return Ke(Rt,{sx:{display:"flex",alignItems:"center",gap:.5,justifyContent:"flex-end"},children:e.split(" \u2192 ").map((o,a)=>Er(Rt,{sx:{display:"flex",alignItems:"center",gap:.5},children:[a>0?Ke(v5,{sx:{fontSize:20,color:t.colors.textMuted}}):null,Ke(Rt,{component:"span",sx:{minWidth:36,height:36,px:1,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:15,fontWeight:600,color:t.colors.textPrimary,bgcolor:t.colors.surfaceSubtle,border:`1px solid ${t.colors.border}`,borderRadius:1,fontVariantNumeric:"tabular-nums"},children:o})]},`${o}-${a}`))})}function D5({steps:e}){let t=xe();return Ke(Rt,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, minmax(0, 1fr))"},gap:{xs:1,sm:2},mt:1.5},children:e.map((o,a)=>Er(Rt,{sx:{position:"relative",minWidth:0,px:1.75,py:2.5,borderRadius:2,bgcolor:t.colors.surfaceSubtle,border:`1px solid ${t.colors.border}`,"&::before":{content:'""',position:"absolute",top:-1,left:12,right:12,height:3,borderRadius:"0 0 3px 3px",bgcolor:t.colors.accent,opacity:.85},"&::after":a<e.length-1?{content:'""',display:{xs:"none",sm:"block"},position:"absolute",top:"50%",right:-12,width:8,height:8,mt:"-4px",borderTop:`2px solid ${t.colors.borderStrong}`,borderRight:`2px solid ${t.colors.borderStrong}`,transform:"rotate(45deg)"}:void 0},children:[Er(Rt,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[Ke(Rt,{sx:{flexShrink:0,width:26,height:26,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:500,lineHeight:1,bgcolor:t.colors.accent,color:t.colors.accentContrast,fontVariantNumeric:"tabular-nums"},children:a+1}),Ke(Rt,{sx:{minWidth:0,fontSize:20,fontWeight:500,color:t.colors.textStrong,lineHeight:1.3,letterSpacing:"-0.01em"},children:o.title})]}),Ke(Rt,{sx:{mt:1.5,fontSize:15,lineHeight:1.5,color:t.colors.textPrimary,wordBreak:"keep-all"},children:o.desc})]},o.title))})}var Mk="70vh",E5=24,R5=44,Pk=`calc((${Mk} - ${E5*2+R5}px) / var(--mfd-font-scale, 1))`,P5=148;function M5({items:e}){let t=xe();return Ke(Rt,{sx:{mt:1.5,display:"grid",gridTemplateColumns:{xs:"1fr",sm:`${P5}px minmax(0, 1fr)`},fontSize:15,lineHeight:1.6,color:t.colors.textPrimary,border:`1px solid ${t.colors.border}`,borderRadius:1.5,overflow:"hidden","& > *":{px:1.5,py:1.35,borderTop:`1px solid ${t.colors.border}`},"& > *:nth-of-type(even)":{borderLeft:{sm:`1px solid ${t.colors.border}`}},"& > *:nth-of-type(1)":{borderTop:0},"& > *:nth-of-type(2)":{borderTop:{xs:`1px solid ${t.colors.border}`,sm:0}}},children:e.map(o=>Er(wp,{children:[Ke(Rt,{sx:{fontWeight:500,color:t.colors.textStrong,wordBreak:"keep-all",bgcolor:t.colors.surfaceSubtle,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center"},children:o.term}),Ke(Rt,{sx:{wordBreak:"keep-all"},children:mm(o.desc)})]},o.term))})}function O5({topic:e}){L();let t=xe();return Er(Rt,{component:"section",sx:{py:{xs:3,sm:4},borderBottom:`1px solid ${t.colors.border}`,"&:last-of-type":{pb:0,borderBottom:0}},children:[Er(Rt,{component:"h3",sx:{m:0,mb:1.75,fontSize:24,fontWeight:500,letterSpacing:"-0.01em",lineHeight:1.3,color:t.colors.textStrong,wordBreak:"keep-all",display:"flex",alignItems:"center",flexWrap:"wrap"},children:[e.title,e.subtitle?Er(L5,{children:[Ke(B5,{sx:{fontSize:22,color:t.colors.textMuted,mx:1,flexShrink:0}}),Ke(Rt,{component:"span",sx:{fontSize:18,fontWeight:400,color:t.colors.textPrimary},children:e.subtitle})]}):null]}),e.lead?Ke(Rt,{sx:{fontSize:15.5,lineHeight:1.65,color:t.colors.textPrimary,wordBreak:"keep-all"},children:mm(e.lead)}):null,e.steps?.length?Ke(D5,{steps:e.steps}):null,e.items?.length?Ke(M5,{items:e.items}):null,e.lines?.length?Ke(Rt,{component:"ul",sx:{m:0,mt:e.lead||e.steps||e.items?1.25:0,pl:2.5,display:"flex",flexDirection:"column",gap:.5,fontSize:15,lineHeight:1.6,color:t.colors.textPrimary,wordBreak:"keep-all"},children:e.lines.map((o,a)=>Ke("li",{children:mm(o)},a))}):null]})}function qre({open:e,onClose:t,views:o,features:a={},initialTab:r}){L();let i=xe(),{modals:l,activeTabIndex:s,setActiveTabIndex:c}=Ek({open:e,onClose:t,features:a,initialTab:r}),u=p=>!p||a[p]!==!1,m=Fl(o),d=wk(Hl).filter(p=>u(p.feature)).map(p=>({id:p.id,tabTitle:p.tabTitle,showTitle:!1,children:p.id==="shortcuts"?Ke(Rt,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:Pk,maxHeight:Pk,px:.5},children:Ke(Rt,{sx:{display:"grid",gridTemplateColumns:"auto auto",columnGap:2.5,rowGap:1.75,alignItems:"center",fontSize:17,fontWeight:500,color:i.colors.textPrimary},children:m.map(f=>Er(wp,{children:[Ke(w5,{keys:f.keys}),Ke("span",{children:f.description})]},f.keys))})}):Er(Rt,{sx:{display:"flex",flexDirection:"column",px:.5},children:[p.intro?Ke(Rt,{sx:{p:2,borderRadius:2,bgcolor:i.colors.accentSoft,color:i.colors.textStrong,fontSize:15.5,lineHeight:1.65,wordBreak:"keep-all"},children:mm(p.intro)}):null,p.topics.filter(f=>u(f.feature)).map(f=>Ke(O5,{topic:f},f.title))]})}));return Ke(I5,{open:l.dialog.isOpen,onClose:l.dialog.close,maxWidth:"md",title:n("manual.dialogTitle"),locale:Ce(),titleIcons:{delete:{visible:!1}},tabs:{visible:!0,switchContent:!0},activeTabValue:s,onTabChange:c,fixedHeight:"70vh",maxContentHeight:Mk,sectionContentPaddingTop:0,fontScale:{enabled:!0},fontScaleKey:"taskbox-manual",sections:d,actions:{showCancelButton:!1,right:Ke(S5,{variant:"contained",onClick:l.dialog.close,sx:{minWidth:80},children:n("common.close")})}})}import{useEffect as N5,useRef as F5,useState as qk}from"react";import{Box as Pt,Button as Mn,IconButton as Ep,Menu as zk,MenuItem as Nk,Switch as H5,Tooltip as Fk}from"@mui/material";import{FormDialog as Hk}from"@ehfuse/mui-form-dialog";import Rp from"@mui/icons-material/Add";import W5 from"@mui/icons-material/ArrowRightAlt";import $5 from"@mui/icons-material/BoltOutlined";import V5 from"@mui/icons-material/Close";import U5 from"@mui/icons-material/EditOutlined";import{ClearTextField as $l,LabelSelect as Jo}from"@ehfuse/mui-form-controls";import{useEffect as A5,useRef as Ok}from"react";import{useGlobalForm as q5,useModal as z5}from"@ehfuse/forma";import{ErrorAlert as Lk}from"@ehfuse/alerts";var _i=[{value:"due_date",get label(){return n("col.due")}},{value:"start_date",get label(){return n("col.startTime")}},{value:"priority",get label(){return n("col.priority")}},{value:"manager_account_seq",get label(){return n("col.owner")}},{value:"receiver_account_seqs",get label(){return n("col.cc")}},{value:"label_keys",get label(){return n("dialog.label")}},{value:"group_seq",get label(){return n("col.project")}},{value:"sprint_seq",get label(){return n("col.goal")}},{value:"content",get label(){return n("common.content")}},{value:"note",get label(){return n("col.note")}}];function um(){return{editSeq:0,name:"",trigger:"created",enabled:!0,sort_no:0,condition:{},action:{}}}function Dp(e){return e.filter(t=>!t.archived).map(t=>({value:String(Rn(t.key)),label:t.label}))}function dm(e){return e.map(t=>({value:t.key,label:t.name}))}function Ak(e){L();let t=Ok(e);t.current=e;let o=q5({formId:_e("taskbox-rule-form"),initialValues:um(),onValidate:k=>k.name.trim()?Object.keys(k.action??{}).length===0?(Lk({message:n("rule.addAction")}),!1):!0:(Lk({message:n("rule.enterName")}),!1),onSubmit:async k=>{let{editSeq:_,...D}=k,F=_>0?D.sort_no:t.current.rules.reduce((C,y)=>Math.max(C,y.sort_no),0)+1,R=_>0?await t.current.onUpdate(_,{...D,sort_no:F}):await t.current.onCreate({...D,sort_no:F});return R&&a.form.close(),R}}),a={list:dn({modalId:_e("taskbox-rule-manage"),open:e.open,onClose:()=>t.current.onClose()}),form:z5({modalId:_e("taskbox-rule-edit"),onClose:()=>o.setFormValues(um())})},r=Ok(a.form);r.current=a.form,A5(()=>{if(e.open)return;let k=window.setTimeout(()=>{r.current.isOpen&&r.current.close(),o.setFormValues(um())},500);return()=>window.clearTimeout(k)},[e.open]);let i=()=>({...o.getFormValue("condition")??{}}),l=()=>({...o.getFormValue("action")??{}}),s=(k,_)=>{let D=i();_===""||_===void 0||_===null?delete D[k]:D[k]=_,o.setFormValue("condition",D)},c=(k,_)=>{let D=l();_===""||_===void 0||_===null?delete D[k]:D[k]=_,o.setFormValue("action",D)},u=()=>{o.setFormValues(um()),a.form.open()},m=k=>{o.setFormValues({editSeq:k.seq,name:k.name,trigger:k.trigger,enabled:k.enabled,sort_no:k.sort_no,condition:{...k.condition,...k.trigger==="field_changed"&&k.condition.changed_field===void 0?{changed_field:_i[0]?.value??""}:{}},action:{...k.action}}),a.form.open()},d=k=>{let _=i();k!=="status_changed"&&(delete _.from_status,delete _.to_status),k!=="overdue"&&delete _.overdue_days,k!=="field_changed"&&delete _.changed_field,k!=="commented"&&(delete _.comment_contains,delete _.comment_by_others),k==="field_changed"&&_.changed_field===void 0&&(_.changed_field=_i[0]?.value??""),o.setFormValues({trigger:k,condition:_})},p=async k=>{let _=t.current.onPickAccount;if(!_)return;let D=i(),F=k==="manager_account"?D.manager_account_seq??0:D.receiver_account_seq??0,R=await _(F,k==="manager_account"?n("col.owner"):n("col.cc"));if(!R)return;let C=i();k==="manager_account"?(C.manager_account_seq=R.accountSeq,C.manager_name=R.name):(C.receiver_account_seq=R.accountSeq,C.receiver_name=R.name),o.setFormValue("condition",C)},f=k=>{let _=Dp(t.current.customTabs),D=dm(t.current.statusOptions);k==="group_seq"?s("group_seq",Number(_[0]?.value)||0):k==="kind"?s("is_bug",!0):k==="priority"?s("priority","high"):k==="label_key"?s("label_key",D[0]?.value??""):k==="title_contains"?o.setFormValue("condition",{...i(),title_contains:""}):k==="manager_empty"?s("manager_empty",!0):k==="manager_account"||k==="receiver_account"?p(k):k==="from_status"?s("from_status",Mo[0]?.key??""):k==="to_status"?s("to_status",Mo[0]?.key??""):k==="changed_field"?s("changed_field",_i[0]?.value??""):k==="comment_contains"?o.setFormValue("condition",{...i(),comment_contains:""}):k==="comment_by_others"?s("comment_by_others",!0):k==="overdue_days"&&s("overdue_days",1)},g=k=>{if(k==="kind"){s("is_bug",""),s("is_event","");return}if(k==="manager_account"){s("manager_account_seq",""),s("manager_name","");return}if(k==="receiver_account"){s("receiver_account_seq",""),s("receiver_name","");return}s(k,"")},x=k=>{s("is_bug",k?!0:""),s("is_event",k?"":!0)},h=async k=>{let _=t.current.onPickAccount;if(!_)return;let D=l(),F=k==="assign_manager"?D.assign_manager_account_seq??0:k==="add_receiver"?D.add_receiver_account_seq??0:D.notify_account_seq??0,R=await _(F,k==="assign_manager"?n("col.owner"):k==="add_receiver"?n("col.cc"):n("rule.notifyTarget"));if(!R)return;let C=l();k==="assign_manager"?(C.assign_manager_account_seq=R.accountSeq,C.assign_manager_name=R.name):k==="add_receiver"?(C.add_receiver_account_seq=R.accountSeq,C.add_receiver_name=R.name):(C.notify_account_seq=R.accountSeq,C.notify_name=R.name),o.setFormValue("action",C)};return{form:o,modals:a,actions:{openCreate:u,openEdit:m,changeTrigger:d,setCondition:s,setAction:c,addCondition:f,removeCondition:g,changeKind:x,pickConditionAccount:p,addAction:k=>{let _=dm(t.current.statusOptions);if(k==="set_status")c("set_status",Mo[0]?.key??"");else if(k==="set_priority")c("set_priority","high");else if(k==="add_label_key")c("add_label_key",_[0]?.value??"");else if(k==="apply_content_template"){let D=t.current.contentTemplates[0];o.setFormValue("action",{...l(),apply_content_template_seq:D?.seq??0,apply_content_template_name:D?.name??""})}else h(k)},removeAction:k=>{k==="assign_manager"?(c("assign_manager_account_seq",""),c("assign_manager_name","")):k==="add_receiver"?(c("add_receiver_account_seq",""),c("add_receiver_name","")):k==="apply_content_template"?(c("apply_content_template_seq",""),c("apply_content_template_name","")):k==="notify"?(c("notify_account_seq",""),c("notify_name",""),c("notify_message","")):c(k,"")},pickAccountFor:h,selectContentTemplate:k=>{let _=t.current.contentTemplates.find(D=>String(D.seq)===String(k));o.setFormValue("action",{...l(),apply_content_template_seq:_?.seq??0,apply_content_template_name:_?.name??""})},toggleRule:(k,_)=>t.current.onToggle(k,_),removeRule:k=>t.current.onRemove(k)}}}import{Fragment as $k,jsx as ue,jsxs as fn}from"react/jsx-runtime";var Pp=[{value:"created",get label(){return n("rule.trigger.created")},get hint(){return n("rule.trigger.createdHint")}},{value:"status_changed",get label(){return n("rule.trigger.statusChanged")},get hint(){return n("rule.trigger.statusChangedHint")}},{value:"commented",get label(){return n("rule.trigger.commented")},get hint(){return n("rule.trigger.commentedHint")}},{value:"manager_assigned",get label(){return n("rule.trigger.managerAssigned")},get hint(){return n("rule.trigger.managerAssignedHint")}},{value:"attachment_added",get label(){return n("rule.trigger.attached")},get hint(){return n("rule.trigger.attachedHint")}},{value:"field_changed",get label(){return n("rule.trigger.fieldChanged")},get hint(){return n("rule.trigger.fieldChangedHint")}},{value:"overdue",get label(){return n("rule.trigger.overdue")},get hint(){return n("rule.trigger.overdueHint")}}],fm=[{value:"high",get label(){return n("priority.high")}},{value:"medium",get label(){return n("priority.medium")}},{value:"low",get label(){return n("priority.low")}}];function pm(e){return Mo.find(t=>t.key===e)?.name??e}function K5(e,t,o){let{condition:a,action:r}=e,i=[];if(a.group_seq){let c=t.find(u=>Rn(u.key)===a.group_seq);i.push(n("rule.sum.project",{label:c?.label??`#${a.group_seq}`}))}a.is_bug===!0&&i.push(n("rule.sum.bugOnly")),a.is_event===!0&&i.push(n("rule.sum.eventOnly")),a.priority&&i.push(n("rule.sum.priority",{value:fm.find(c=>c.value===a.priority)?.label})),a.label_key&&i.push(n("rule.sum.label",{value:o.find(c=>c.key===a.label_key)?.name??a.label_key})),a.title_contains&&i.push(n("rule.sum.titleContains",{title_contains:a.title_contains})),a.status&&i.push(n("rule.sum.status",{value:pm(a.status)})),a.from_status&&i.push(n("rule.sum.fromStatus",{value:pm(a.from_status)})),a.to_status&&i.push(n("rule.sum.toStatus",{value:pm(a.to_status)})),a.manager_empty===!0&&i.push(n("rule.sum.noOwner")),a.manager_empty===!1&&i.push(n("rule.sum.hasOwner")),a.manager_account_seq&&i.push(n("rule.sum.owner",{manager_name:a.manager_name||n("rule.accountNo",{manager_account_seq:a.manager_account_seq})})),a.receiver_account_seq&&i.push(n("rule.sum.ccIncludes",{receiver_name:a.receiver_name||n("rule.accountNo2",{receiver_account_seq:a.receiver_account_seq})})),a.changed_field&&i.push(n("rule.sum.fieldChanged",{value:_i.find(c=>c.value===a.changed_field)?.label??a.changed_field})),a.comment_contains&&i.push(n("rule.sum.commentContains",{comment_contains:a.comment_contains})),a.comment_by_others===!0&&i.push(n("rule.sum.commentByOthers")),typeof a.overdue_days=="number"&&i.push(n("rule.sum.overdueDays",{overdue_days:a.overdue_days}));let l=[];r.set_status&&l.push(n("rule.sum.status",{value:pm(r.set_status)})),r.set_priority&&l.push(n("rule.sum.priority",{value:fm.find(c=>c.value===r.set_priority)?.label})),r.assign_manager_account_seq&&l.push(n("rule.sum.setOwner",{assign_manager_name:r.assign_manager_name||n("rule.specified")})),r.add_receiver_account_seq&&l.push(n("rule.sum.addCc",{add_receiver_name:r.add_receiver_name||n("rule.specified")})),r.add_label_key&&l.push(n("rule.sum.addLabel",{value:o.find(c=>c.key===r.add_label_key)?.name??r.add_label_key})),r.apply_content_template_seq&&l.push(n("rule.sum.applyTemplate",{apply_content_template_name:r.apply_content_template_name||n("rule.specified")})),r.notify_account_seq&&l.push(n("rule.sum.notify"));let s=Pp.find(c=>c.value===e.trigger)?.label??e.trigger;return{left:i.length>0?`${s} \xB7 ${i.join(", ")}`:s,right:l.join(", ")||n("rule.sum.noAction")}}var Wk={fontSize:16,fontWeight:700,color:"#37352f"},G5={display:"flex",alignItems:"center",gap:1},j5={width:104,flexShrink:0,fontSize:16,color:"#37352f"};function cae({open:e,rules:t,customTabs:o,statusOptions:a,contentTemplates:r=[],onPickAccount:i,onClose:l,onCreate:s,onUpdate:c,onToggle:u,onRemove:m}){L();let d=Ak({open:e,rules:t,customTabs:o,statusOptions:a,contentTemplates:r,onPickAccount:i,onClose:l,onCreate:s,onUpdate:c,onToggle:u,onRemove:m}),{form:p,actions:f}=d,g=d.modals.list,x=d.modals.form,{setCondition:h,setAction:E,removeCondition:b,removeAction:B,pickConditionAccount:T,pickAccountFor:z,changeTrigger:k}=f,_=p.isSubmitting,D=F5(null),[F,R]=qk(null),[C,y]=qk(null);N5(()=>{if(!x.isOpen)return;let $=window.setTimeout(()=>D.current?.focus(),120);return()=>window.clearTimeout($)},[x.isOpen]);let I=Number(p.useValue("editSeq")??0)>0,S=p.useValue("trigger")??"created",O=dm(a),w=Mo.map($=>({value:$.key,label:$.name})),q=Dp(o),v=p.useValue("condition")??{},M=p.useValue("action")??{},j=v.is_bug!==void 0||v.is_event!==void 0,V=[...v.group_seq===void 0&&q.length>0?[{key:"group_seq",label:n("rule.cond.project")}]:[],...j?[]:[{key:"kind",label:n("rule.cond.kind")}],...v.priority===void 0?[{key:"priority",label:n("rule.cond.priority")}]:[],...v.label_key===void 0&&O.length>0?[{key:"label_key",label:n("rule.cond.label")}]:[],...v.title_contains===void 0?[{key:"title_contains",label:n("rule.cond.titleContains")}]:[],...v.manager_empty===void 0?[{key:"manager_empty",label:n("rule.cond.ownerEmpty")}]:[],...i&&v.manager_account_seq===void 0?[{key:"manager_account",label:n("rule.cond.owner")}]:[],...i&&v.receiver_account_seq===void 0?[{key:"receiver_account",label:n("rule.cond.ccIncludes")}]:[],...S==="status_changed"&&v.from_status===void 0?[{key:"from_status",label:n("rule.cond.fromStatus")}]:[],...S==="status_changed"&&v.to_status===void 0?[{key:"to_status",label:n("rule.cond.toStatus")}]:[],...S==="field_changed"&&v.changed_field===void 0?[{key:"changed_field",label:n("rule.cond.fieldChanged")}]:[],...S==="commented"&&v.comment_contains===void 0?[{key:"comment_contains",label:n("rule.cond.commentContains")}]:[],...S==="commented"&&v.comment_by_others===void 0?[{key:"comment_by_others",label:n("rule.cond.commentByOthers")}]:[],...S==="overdue"&&v.overdue_days===void 0?[{key:"overdue_days",label:n("rule.cond.overdueDays")}]:[]],Z=$=>{R(null),f.addCondition($)},ae=[...M.set_status===void 0?[{key:"set_status",label:n("rule.act.setStatus")}]:[],...M.set_priority===void 0?[{key:"set_priority",label:n("rule.act.setPriority")}]:[],...M.add_label_key===void 0&&O.length>0?[{key:"add_label_key",label:n("rule.act.addLabel")}]:[],...i&&M.assign_manager_account_seq===void 0?[{key:"assign_manager",label:n("rule.act.assignOwner")}]:[],...i&&M.add_receiver_account_seq===void 0?[{key:"add_receiver",label:n("rule.act.addCc")}]:[],...r.length>0&&M.apply_content_template_seq===void 0?[{key:"apply_content_template",label:n("rule.act.applyTemplate")}]:[],...i&&M.notify_account_seq===void 0?[{key:"notify",label:n("rule.act.notify")}]:[]],me=$=>{y(null),f.addAction($)},U=($,G,re,Ee)=>fn(Pt,{sx:G5,children:[ue(Pt,{sx:j5,children:$}),fn(Pt,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:Ee?"column":"row",alignItems:Ee?"stretch":"center",gap:Ee?.5:1},children:[G,Ee?ue(Pt,{sx:{fontSize:13.5,color:"#37352f"},children:Ee}):null]}),ue(Fk,{title:n("rule.removeRow"),arrow:!0,disableInteractive:!0,children:ue(Ep,{size:"small","aria-label":n("rule.removeRowAria",{label:$}),onClick:re,children:ue(V5,{sx:{fontSize:16}})})})]}),ee=()=>fn(Pt,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[ue($l,{size:"medium",label:n("rule.ruleName"),inputRef:D,placeholder:n("rule.ruleNamePlaceholder"),name:"name",form:p}),ue(Pt,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap"},children:Pp.map($=>{let G=S===$.value;return ue(Mn,{disableElevation:!0,variant:G?"contained":"outlined",color:G?"primary":"inherit",onClick:()=>k($.value),sx:{borderRadius:99,px:1.75,...G?{}:{color:"#57564f",borderColor:"#d9d9d6"}},children:$.label},$.value)})}),ue(Pt,{sx:{fontSize:13,color:"#787774",mt:-.5},children:Pp.find($=>$.value===S)?.hint}),fn(Pt,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[ue(Pt,{sx:Wk,children:n("rule.whenTitle")}),V.length>0?ue(Mn,{size:"small",startIcon:ue(Rp,{sx:{fontSize:16}}),onClick:$=>R($.currentTarget),sx:{color:"#2563eb",minWidth:0},children:n("rule.addCondition")}):null]}),v.group_seq!==void 0?U(n("col.project"),ue(Jo,{size:"medium",fullWidth:!0,label:"",value:String(v.group_seq),options:q,onChange:$=>h("group_seq",Number($.target.value)||"")}),()=>b("group_seq")):null,j?U(n("col.kind"),ue(Jo,{size:"medium",fullWidth:!0,label:"",value:v.is_bug?"bug":"event",options:[{value:"bug",label:n("rule.sum.bugOnly")},{value:"event",label:n("rule.sum.eventOnly")}],onChange:$=>{let G=$.target.value==="bug";h("is_bug",G?!0:""),h("is_event",G?"":!0)}}),()=>b("kind")):null,v.priority!==void 0?U(n("col.priority"),ue(Jo,{size:"medium",fullWidth:!0,label:"",name:"condition.priority",form:p,options:fm}),()=>b("priority")):null,v.label_key!==void 0?U(n("dialog.label"),ue(Jo,{size:"medium",fullWidth:!0,label:"",name:"condition.label_key",form:p,options:O}),()=>b("label_key")):null,v.title_contains!==void 0?U(n("common.title"),ue($l,{size:"medium",fullWidth:!0,placeholder:n("rule.titleWordPlaceholder"),name:"condition.title_contains",form:p}),()=>b("title_contains")):null,v.manager_empty!==void 0?U(n("col.owner"),ue(Jo,{size:"medium",fullWidth:!0,label:"",value:v.manager_empty?"empty":"assigned",options:[{value:"empty",label:n("common.none")},{value:"assigned",label:n("rule.present")}],onChange:$=>h("manager_empty",$.target.value==="empty")}),()=>b("manager_empty")):null,v.manager_account_seq!==void 0?U(n("col.owner"),ue(Mn,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{T("manager_account")},children:v.manager_name||n("rule.accountNo",{manager_account_seq:v.manager_account_seq})}),()=>b("manager_account")):null,v.receiver_account_seq!==void 0?U(n("col.cc"),ue(Mn,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{T("receiver_account")},children:v.receiver_name||n("rule.accountNo2",{receiver_account_seq:v.receiver_account_seq})}),()=>b("receiver_account")):null,v.from_status!==void 0?U(n("rule.fromStatus"),ue(Jo,{size:"medium",fullWidth:!0,label:"",name:"condition.from_status",form:p,options:w}),()=>b("from_status")):null,v.to_status!==void 0?U(n("rule.toStatus"),ue(Jo,{size:"medium",fullWidth:!0,label:"",name:"condition.to_status",form:p,options:w}),()=>b("to_status")):null,v.changed_field!==void 0?U(n("rule.changedField"),ue(Jo,{size:"medium",fullWidth:!0,label:"",name:"condition.changed_field",form:p,options:_i}),()=>b("changed_field")):null,v.comment_contains!==void 0?U(n("rule.commentWord"),ue($l,{size:"medium",fullWidth:!0,placeholder:n("rule.commentWordPlaceholder"),name:"condition.comment_contains",form:p}),()=>b("comment_contains")):null,v.comment_by_others!==void 0?U(n("rule.commentAuthor"),ue(Jo,{size:"medium",fullWidth:!0,label:"",value:v.comment_by_others?"others":"any",options:[{value:"others",label:n("rule.notOwner")},{value:"any",label:n("rule.anyone")}],onChange:$=>h("comment_by_others",$.target.value==="others")}),()=>b("comment_by_others")):null,v.overdue_days!==void 0?U(n("rule.elapsedDays"),ue($l,{size:"medium",fullWidth:!0,type:"number",value:String(v.overdue_days),onChange:$=>h("overdue_days",Math.max(0,Number($.target.value)||0)),label:n("rule.overdueDaysLabel")}),()=>b("overdue_days")):null,Object.keys(v).length===0?ue(Pt,{sx:{fontSize:13.5,color:"#9a9a97"},children:n("rule.noConditionHint")}):null,fn(Pt,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[ue(Pt,{sx:Wk,children:n("rule.doTitle")}),ae.length>0?ue(Mn,{size:"small",startIcon:ue(Rp,{sx:{fontSize:16}}),onClick:$=>y($.currentTarget),sx:{color:"#2563eb",minWidth:0},children:n("rule.addActionButton")}):null]}),M.set_status!==void 0?U(n("col.status"),ue(Jo,{size:"medium",fullWidth:!0,label:"",name:"action.set_status",form:p,options:w}),()=>B("set_status")):null,M.set_priority!==void 0?U(n("col.priority"),ue(Jo,{size:"medium",fullWidth:!0,label:"",name:"action.set_priority",form:p,options:fm}),()=>B("set_priority")):null,M.apply_content_template_seq!==void 0?U(n("rule.bodyTemplate"),ue(Jo,{size:"medium",fullWidth:!0,label:"",value:String(M.apply_content_template_seq),options:r.map($=>({value:String($.seq),label:$.name})),onChange:$=>f.selectContentTemplate(String($.target.value))}),()=>B("apply_content_template"),n("rule.bodyTemplateHint")):null,M.add_label_key!==void 0?U(n("dialog.label"),ue(Jo,{size:"medium",fullWidth:!0,label:"",name:"action.add_label_key",form:p,options:O}),()=>B("add_label_key")):null,M.assign_manager_account_seq!==void 0?U(n("col.owner"),ue(Mn,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{z("assign_manager")},children:M.assign_manager_name||n("rule.accountNo3",{assign_manager_account_seq:M.assign_manager_account_seq})}),()=>B("assign_manager")):null,M.add_receiver_account_seq!==void 0?U(n("col.cc"),ue(Mn,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{z("add_receiver")},children:M.add_receiver_name||n("rule.accountNo4",{add_receiver_account_seq:M.add_receiver_account_seq})}),()=>B("add_receiver")):null,M.notify_account_seq!==void 0?U(n("rule.notification"),fn($k,{children:[ue(Mn,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{z("notify")},sx:{flexShrink:0},children:M.notify_name||n("rule.accountNo5",{notify_account_seq:M.notify_account_seq})}),ue($l,{size:"medium",fullWidth:!0,placeholder:n("rule.notifyMessagePlaceholder"),value:M.notify_message??"",onChange:$=>E("notify_message",$.target.value)})]}),()=>B("notify")):null,Object.keys(M).length===0?ue(Pt,{sx:{fontSize:13.5,color:"#9a9a97"},children:n("rule.pickActionHint")}):null,ue(zk,{transitionDuration:0,anchorEl:F,open:!!F,onClose:()=>R(null),children:V.map($=>ue(Nk,{dense:!0,onClick:()=>Z($.key),sx:{fontSize:14},children:$.label},$.key))}),ue(zk,{transitionDuration:0,anchorEl:C,open:!!C,onClose:()=>y(null),children:ae.map($=>ue(Nk,{dense:!0,onClick:()=>me($.key),sx:{fontSize:14},children:$.label},$.key))})]});return fn($k,{children:[ue(Hk,{open:g.isOpen,onClose:g.close,maxWidth:"sm",title:n("rule.title"),locale:Ce(),titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-rule-manage",tabs:{visible:!1},contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionContentPaddingTop:0,sections:[{id:"rules",title:"",showTitle:!1,children:fn(Pt,{sx:{display:"flex",flexDirection:"column",px:2.5,py:2},children:[t.length===0?fn(Pt,{sx:{py:4,display:"flex",flexDirection:"column",alignItems:"center",gap:2,color:"#9a9a97"},children:[ue($5,{sx:{fontSize:48,color:"#d9d9d6"}}),ue(Pt,{sx:{fontSize:15},children:n("rule.noRules")})]}):null,t.map($=>fn(Pt,{sx:{display:"flex",alignItems:"center",gap:2,py:1,"&:not(:last-of-type)":{borderBottom:"1px solid #ececea"},opacity:$.enabled?1:.5},children:[ue(Fk,{title:$.enabled?n("rule.enabled"):n("rule.disabled"),arrow:!0,disableInteractive:!0,children:ue(H5,{size:"small",inputProps:{"aria-label":n("rule.enableAria",{name:$.name})},checked:$.enabled,onChange:(G,re)=>f.toggleRule($.seq,re)})}),fn(Pt,{sx:{flex:1,minWidth:0},children:[ue(Pt,{sx:{fontSize:16,fontWeight:600,color:"#37352f"},children:$.name}),(()=>{let G=K5($,o,a);return fn(Pt,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5,fontSize:15,color:"#6f6f6c"},children:[ue(Pt,{component:"span",children:G.left}),ue(W5,{sx:{fontSize:18,color:"#9a9a97",flexShrink:0}}),ue(Pt,{component:"span",children:G.right})]})})()]}),ue(Ep,{size:"small","aria-label":n("rule.editAria",{name:$.name}),onClick:()=>f.openEdit($),children:ue(U5,{sx:{fontSize:18}})}),ue(Ep,{size:"small","aria-label":n("rule.deleteAria",{name:$.name}),onClick:()=>f.removeRule($.seq),children:ue(Xt,{sx:{fontSize:18}})})]},$.seq))]})}],actions:{showCancelButton:!1,left:ue(Mn,{startIcon:ue(Rp,{}),onClick:f.openCreate,sx:{color:"#2563eb"},children:n("rule.newRule")}),right:ue(Mn,{variant:"contained",onClick:g.close,children:n("common.close")})}}),ue(Hk,{open:x.isOpen,onClose:x.close,maxWidth:"sm",title:I?n("rule.editRule"):n("rule.newRule"),locale:Ce(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-rule-form",tabs:{visible:!1},sectionContentPaddingTop:0,sections:[{id:"rule-form",title:"",showTitle:!1,children:ee()}],actions:{showCancelButton:!0,right:ue(Mn,{variant:"contained",onClick:()=>{p.submit()},disabled:_,children:I?n("common.edit"):n("rule.addRule")})}})]})}import{useEffect as oT,useRef as Ul,useState as Qk}from"react";import{Box as lo,Button as Vl,IconButton as Kl,Tooltip as Gl}from"@mui/material";import Z5 from"@mui/icons-material/Tune";import Jk from"@mui/icons-material/Add";import eL from"@mui/icons-material/EditOutlined";import tL from"@mui/icons-material/ContentCopyOutlined";import oL from"@mui/icons-material/DragIndicator";import nL from"@mui/icons-material/PlaylistAddCheckOutlined";import{DndContext as rL,PointerSensor as aL,closestCenter as iL,useSensor as lL,useSensors as sL}from"@dnd-kit/core";import{restrictToParentElement as cL,restrictToVerticalAxis as mL}from"@dnd-kit/modifiers";import{SortableContext as uL,useSortable as dL,verticalListSortingStrategy as pL}from"@dnd-kit/sortable";import{CSS as fL}from"@dnd-kit/utilities";import{FormDialog as Zk}from"@ehfuse/mui-form-dialog";import{ClearTextField as Op,LabelSelect as gL}from"@ehfuse/mui-form-controls";import xL from"@ehfuse/overlay-scrollbar";import{useEffect as Y5,useRef as Vk}from"react";import{useGlobalForm as X5,useModal as Q5}from"@ehfuse/forma";import{ConfirmDialog as J5,ErrorAlert as Uk}from"@ehfuse/alerts";var Kk=0;function Gk(){return Kk+=1,`ti${Kk}`}function Mp(){return{editSeq:0,name:"",description:"",group_seq:0,itemIds:[],items:{}}}function jk(){return{title:"",start_offset_days:0,due_offset_days:0,priority:"medium"}}function Xk(e){L();let t=Vk(e);t.current=e;let o=X5({formId:_e("taskbox-template-form"),initialValues:Mp(),onValidate:u=>u.name.trim()?Yk(u).length===0?(Uk({message:n("template.addItemRequired")}),!1):!0:(Uk({message:n("template.enterName")}),!1),onSubmit:async u=>{let m={name:u.name.trim(),description:u.description,group_seq:u.group_seq,items:Yk(u)},d=u.editSeq>0?await t.current.onUpdate(u.editSeq,m):await t.current.onCreate(m);return d&&(a.form.close(),o.setFormValues(Mp())),d}}),a={list:dn({modalId:_e("taskbox-template-manage"),open:e.open,onClose:()=>t.current.onClose()}),form:Q5({modalId:_e("taskbox-template-edit")})},r=Vk(a.form);r.current=a.form,Y5(()=>{if(e.open)return;let u=window.setTimeout(()=>{r.current.isOpen&&r.current.close(),o.setFormValues(Mp())},500);return()=>window.clearTimeout(u)},[e.open]);let i=(u,m)=>{let d=m.items.map(()=>Gk());o.setFormValues({editSeq:u,name:m.name,description:m.description??"",group_seq:m.group_seq??0,itemIds:d,items:Object.fromEntries(m.items.map((p,f)=>[d[f],{...p}]))}),a.form.open()},l=(u,m)=>({name:m,description:u.description??"",group_seq:u.group_seq??0,items:u.items.map(d=>({...d}))}),s=(u,m)=>{let d=o.getFormValue(`items.${u}`);o.setFormValue(`items.${u}`,{...d??jk(),...m})};return{form:o,modals:a,actions:{openCreate:()=>i(0,{name:"",description:"",group_seq:0,items:[]}),openEdit:u=>i(u.seq,l(u,u.name)),openDuplicate:u=>i(0,l(u,n("template.copyName",{name:u.name}))),closeForm:()=>a.form.close(),setItem:s,addItem:()=>{let u=Gk();o.setFormValue(`items.${u}`,jk()),o.setFormValue("itemIds",[...o.getFormValue("itemIds")??[],u])},removeItem:u=>{let m=o.getFormValue("itemIds")??[];o.setFormValue("itemIds",m.filter(d=>d!==u))},moveItem:(u,m)=>{let d=[...o.getFormValue("itemIds")??[]],p=d.indexOf(u),f=d.indexOf(m);if(p<0||f<0||p===f)return;let[g]=d.splice(p,1);d.splice(f,0,g),o.setFormValue("itemIds",d)},pickItemManager:async u=>{let m=t.current.onPickAccount;if(!m)return;let d=o.getFormValue(`items.${u}`),p=await m(d?.manager_account_seq??0,n("col.owner"));p&&s(u,{manager_account_seq:p.accountSeq,manager_name:p.name})},clearItemManager:u=>s(u,{manager_account_seq:0,manager_name:""}),removeTemplate:async u=>{await J5({title:n("template.deleteTemplate"),message:n("template.deleteConfirm",{name:u.name})})&&t.current.onRemove(u.seq)},runTemplate:u=>t.current.onRun?.(u)}}}function Yk(e){return(e.itemIds??[]).map(t=>e.items?.[t]).filter(t=>!!t&&String(t.title??"").trim().length>0)}import{Fragment as yL,jsx as ye,jsxs as Rr}from"react/jsx-runtime";var nT=()=>n("template.itemTitlePlaceholder"),rT=2;var aT=20,$ae=`${aT+rT*8}px`;function bL({id:e,children:t}){let{attributes:o,listeners:a,setNodeRef:r,transform:i,transition:l,isDragging:s}=dL({id:e});return ye(lo,{ref:r,sx:{transform:fL.Transform.toString(i),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({handleProps:{...o,...a},dragging:s})})}function hL(e){return e.start_offset_days!==void 0||e.due_offset_days!==void 0||e.priority!==void 0&&e.priority!=="medium"||!!e.manager_account_seq||(e.label_keys?.length??0)>0||!!String(e.content??"").replace(/<[^>]*>/g,"").trim()||(e.checklist?.length??0)>0||!!String(e.note??"").trim()||!!e.visibility}function kL({id:e,index:t,isLast:o,form:a,actions:r,handleProps:i,onOpenProps:l}){L();let s=a.useValue(`items.${e}`)??{},c=hL(s);return Rr(lo,{sx:{borderBottom:o?"none":"1px solid #f2f2f0",px:rT,py:1,display:"flex",alignItems:"center",gap:1},children:[ye(lo,{...i,"aria-label":n("template.reorderItem",{value:t+1}),sx:{display:"inline-flex",alignItems:"center",flexShrink:0,mr:1,color:"#c9c8c5",cursor:"grab","&:active":{cursor:"grabbing"},touchAction:"none",userSelect:"none"},children:ye(oL,{sx:{fontSize:aT}})}),ye(Op,{size:"medium",fullWidth:!0,placeholder:nT(),slotProps:{htmlInput:{"data-template-title":t}},name:`items.${e}.title`,form:a}),ye(Gl,{title:c?n("template.propsFilled"):n("template.props"),arrow:!0,disableInteractive:!0,children:ye(Kl,{size:"medium","aria-label":n("template.itemProps",{value:t+1}),onClick:()=>l(e),sx:{flexShrink:0,color:c?"primary.main":"#9a9a97"},children:ye(Z5,{sx:{fontSize:20}})})}),ye(Gl,{title:n("template.deleteItem"),arrow:!0,disableInteractive:!0,children:ye(Kl,{size:"medium","aria-label":n("template.deleteItemAria",{value:t+1}),onClick:()=>r.removeItem(e),sx:{flexShrink:0},children:ye(Xt,{sx:{fontSize:18}})})})]})}function eT(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function tT(e,t){let o=a=>{let[r,i,l]=a.slice(0,10).split("-").map(Number);return Date.UTC(r,(i||1)-1,l||1)};return Math.round((o(t)-o(e))/864e5)}function TL({id:e,form:t,actions:o,customTabs:a,labels:r,onAddLabel:i,onPickAccount:l,onClose:s}){L();let c=Ul(e);c.current=e;let u=Ul(s);u.current=s;let m=Ul(eT()),d=ji({formId:"taskbox-template-item-form",onSubmit:g=>{let x=c.current;if(!x)return!1;let h=m.current;return o.setItem(x,{title:String(g.title??"").trim(),content:g.content??"",start_offset_days:g.start_date?tT(h,g.start_date):void 0,due_offset_days:g.due_date?tT(h,g.due_date):void 0,priority:g.priority,label_keys:[...g.label_keys??[]],manager_account_seq:g.manager_account_seq||void 0,manager_name:g.manager_account_seq?g.manager_name:void 0,checklist:(g.checklist??[]).map(E=>E.label).filter(E=>E.trim().length>0),note:g.note??"",visibility:g.visibility,visibility_group_seq:g.visibility==="group"?g.visibility_group_seq:void 0}),u.current(),!0}}),p=t.useValue(e?`items.${e}`:"__none__")??{},f=g=>g===void 0?"":mc(m.current,g);return oT(()=>{e&&(m.current=eT(),d.setFormValues({start_date:f(p.start_offset_days),priority:p.priority??"medium",label_keys:[...p.label_keys??[]],note:p.note??"",...p.visibility?{visibility:p.visibility,visibility_group_seq:p.visibility_group_seq??0}:{},checklist:(p.checklist??[]).map(g=>({label:g,checked:!1}))}))},[e]),ye(ab,{open:!!e,onClose:s,form:d,statusOptions:r,customTabs:a,presetTitle:p.title??"",presetContent:p.content??"",presetDueDate:f(p.due_offset_days),presetManager:p.manager_account_seq?{name:p.manager_name??"",accountSeq:p.manager_account_seq}:null,hideTypeToggle:!0,hideProject:!0,hideMembers:!l,templateItem:!0,submitLabel:n("common.apply"),contentSyncKey:`template-${e??""}`,onAddLabelOption:i,onMemberEdit:g=>{g!=="manager"||!l||(async()=>{let x=Number(d.getFormValue("manager_account_seq"))||0,h=await l(x,n("col.owner"));h&&d.setFormValues({manager_account_seq:h.accountSeq,manager_name:h.name})})()}})}function Vae({open:e,templates:t,customTabs:o,onPickAccount:a,onClose:r,onCreate:i,onUpdate:l,onRemove:s,onRun:c,labels:u=[],onAddLabel:m}){L();let[d,p]=Qk(null),f=Xk({open:e,templates:t,customTabs:o,onPickAccount:a,onClose:r,onCreate:i,onUpdate:l,onRemove:s,onRun:c}),{form:g,actions:x}=f,h=f.modals.list,E=f.modals.form,b=g.isSubmitting,B=Number(g.useValue("editSeq")??0),T=g.useValue("itemIds")??[],[z,k]=Qk(0),_=Ul(null),D=Ul(null),F=()=>{let q=D.current?.getScrollContainer()??null;if(q){q.scrollTop=q.scrollHeight;return}let v=_.current?.querySelectorAll("*")??[];for(let M of Array.from(v))if(M.scrollHeight>M.clientHeight+1){M.scrollTop=M.scrollHeight;return}},R=()=>{let q=_.current;if(!q)return null;let v=q.querySelectorAll("input[data-template-title]"),M=v.length?v:q.querySelectorAll(`input[placeholder="${nT()}"]`);return M.length?M[M.length-1]:null};oT(()=>{if(z===0)return;let q=0,v=0,M=()=>{F();let V=R();V&&document.activeElement!==V&&V.focus(),q+=1,!(V&&document.activeElement===V)&&q<8&&(v=window.setTimeout(M,50))},j=window.requestAnimationFrame(M);return()=>{window.cancelAnimationFrame(j),window.clearTimeout(v)}},[z]);let C=o.filter(q=>!q.archived).map(q=>({value:String(Rn(q.key)),label:q.label})),y=Number(g.useValue("group_seq")??0),I=sL(lL(aL,{activationConstraint:{distance:5}})),S=q=>{let v=String(q.active?.id??""),M=String(q.over?.id??"");!v||!M||v===M||x.moveItem(v,M)},O=ye(lo,{children:t.length===0?Rr(lo,{sx:{py:4,display:"flex",flexDirection:"column",alignItems:"center",gap:2,color:"#9a9a97"},children:[ye(nL,{sx:{fontSize:48,color:"#d9d9d6"}}),ye(lo,{sx:{fontSize:13.5},children:n("template.noTemplates")})]}):t.map(q=>Rr(lo,{sx:{display:"flex",alignItems:"center",gap:2.5,py:1.75,"&:not(:last-of-type)::after":{content:'""',display:"block",my:1.75,borderBottom:"1px solid #f0efed"}},children:[Rr(lo,{sx:{flex:1,minWidth:0},children:[ye(lo,{sx:{fontSize:18,fontWeight:600,color:"#37352f"},children:q.name}),Rr(lo,{sx:{fontSize:14,color:"#787774",mt:.25},children:[n("template.taskCount",{count:q.items.length}),q.description?` \xB7 ${q.description}`:""]})]}),c?ye(Vl,{size:"medium",variant:"outlined",onClick:()=>x.runTemplate(q),sx:{flexShrink:0},children:n("template.run")}):null,ye(Gl,{title:n("common.edit"),arrow:!0,disableInteractive:!0,children:ye(Kl,{size:"medium","aria-label":n("template.editAria",{name:q.name}),onClick:()=>x.openEdit(q),children:ye(eL,{sx:{fontSize:19}})})}),ye(Gl,{title:n("menu.duplicate"),arrow:!0,disableInteractive:!0,children:ye(Kl,{size:"medium","aria-label":n("template.duplicateAria",{name:q.name}),onClick:()=>x.openDuplicate(q),children:ye(tL,{sx:{fontSize:18}})})}),ye(Gl,{title:n("common.delete"),arrow:!0,disableInteractive:!0,children:ye(Kl,{size:"medium","aria-label":n("template.deleteAria",{name:q.name}),onClick:()=>{x.removeTemplate(q)},children:ye(Xt,{sx:{fontSize:18}})})})]},q.seq))}),w=Rr(lo,{sx:{display:"flex",flexDirection:"column",gap:3},children:[ye(Op,{size:"medium",label:n("template.name"),placeholder:n("template.namePlaceholder"),fullWidth:!0,name:"name",form:g}),Rr(lo,{sx:{display:"grid",gridTemplateColumns:C.length>0?"1fr 1fr":"1fr",gap:2},children:[ye(Op,{size:"medium",label:n("googleEvent.description"),placeholder:n("template.descriptionPlaceholder"),fullWidth:!0,name:"description",form:g}),C.length>0?ye(gL,{size:"medium",fullWidth:!0,label:n("template.targetProject"),value:String(y),options:[{value:"0",label:Ga()},...C],onChange:q=>g.setFormValue("group_seq",Number(q.target.value)||0)}):null]}),Rr(lo,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[ye(lo,{sx:{fontSize:18,fontWeight:600,color:"#37352f"},children:n("template.items")}),ye(lo,{sx:{fontSize:14,color:"#37352f"},children:n("template.datesHint")})]}),T.length===0?ye(lo,{sx:{fontSize:14,color:"#9a9a97",py:2},children:n("template.noItemsHint")}):ye(lo,{ref:_,sx:{border:"1px solid #e6e6e3",borderRadius:1,overflow:"hidden"},children:ye(xL,{ref:D,style:{maxHeight:"min(560px, 52vh)"},thumb:{width:6},children:ye(rL,{sensors:I,collisionDetection:iL,modifiers:[mL,cL],onDragEnd:S,children:ye(uL,{items:T,strategy:pL,children:T.map((q,v)=>ye(bL,{id:q,children:({handleProps:M})=>ye(kL,{id:q,index:v,isLast:v===T.length-1,form:g,actions:x,handleProps:M,onOpenProps:p})},q))})})})})]});return Rr(yL,{children:[ye(Zk,{open:h.isOpen,onClose:h.close,maxWidth:"md",title:n("template.title"),locale:Ce(),titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-template",tabs:{visible:!1},actions:{showCancelButton:!1,left:ye(Vl,{startIcon:ye(Jk,{sx:{fontSize:18}}),onClick:x.openCreate,children:n("template.newTemplate")}),right:ye(Vl,{variant:"contained",onClick:h.close,children:n("common.close")})},sectionContentPaddingTop:0,sections:[{id:"templates",title:"",showTitle:!1,children:O}]}),ye(Zk,{open:E.isOpen,onClose:E.close,maxWidth:"md",title:B>0?n("template.editTemplate"):n("template.newTemplate"),locale:Ce(),backdropClick:!1,fontScale:{enabled:!0},fontScaleKey:"taskbox-task-template-form",titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},tabs:{visible:!1},actions:{showCancelButton:!0,left:ye(Vl,{startIcon:ye(Jk,{sx:{fontSize:18}}),onClick:()=>{x.addItem(),k(q=>q+1)},children:n("template.addItem")}),right:ye(Vl,{variant:"contained",disabled:b,onClick:()=>{g.submit()},children:n("common.save")})},sectionContentPaddingTop:0,sections:[{id:"template-form",title:"",showTitle:!1,children:w}]}),ye(TL,{id:E.isOpen?d:null,form:g,actions:x,customTabs:o,labels:u,onAddLabel:m,onPickAccount:a,onClose:()=>p(null)})]})}import{Box as ko,Button as SL}from"@mui/material";import{FormDialog as vL}from"@ehfuse/mui-form-dialog";import{DateTextField as BL}from"@ehfuse/mui-form-controls";import _L from"@ehfuse/overlay-scrollbar";import{useRef as Lp}from"react";import{useGlobalForm as CL}from"@ehfuse/forma";function iT(e){let t=Lp(e);t.current=e;let o=Lp(e.template);e.template&&(o.current=e.template);let a=e.template??o.current,r=Lp(a);r.current=a;let i=CL({formId:_e("taskbox-template-run-form"),initialValues:{baseDate:e.todayStr},onValidate:c=>t.current.running||!r.current?!1:uc(r.current,c.baseDate).length>0,onSubmit:c=>r.current?(t.current.onRun(uc(r.current,c.baseDate),c.baseDate),!0):!1}),l={run:dn({modalId:_e("taskbox-template-run"),open:e.open,onClose:()=>t.current.onClose(),onOpen:()=>i.setFormValues({baseDate:t.current.todayStr})})},s=c=>a?uc(a,c):[];return{form:i,modals:l,template:a,running:!!e.running,planTasks:s}}import{jsx as Eo,jsxs as jl}from"react/jsx-runtime";function iie(e){L();let t=iT(e),{form:o,running:a}=t,r=t.modals.run,i=t.template,l=String(o.useValue("baseDate")??""),s=t.planTasks(l);return Eo(vL,{open:r.isOpen,onClose:r.close,maxWidth:"md",title:i?n("template.runTitle",{name:i.name}):n("template.runTemplate"),locale:Ce(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-template-run",tabs:{visible:!1},sectionContentPaddingTop:0,actions:{showCancelButton:!0,right:Eo(SL,{variant:"contained",disabled:a||s.length===0,onClick:()=>{o.submit()},children:a?n("template.creating"):n("template.createCount",{length:s.length})})},sections:[{id:"template-run",title:"",showTitle:!1,children:jl(ko,{sx:{display:"flex",flexDirection:"column",gap:2},children:[jl(ko,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[Eo(ko,{sx:{width:72,flexShrink:0,fontSize:16,color:"#37352f"},children:n("template.baseDate")}),Eo(BL,{size:"medium",fullWidth:!0,name:"baseDate",form:o})]}),Eo(ko,{sx:{fontSize:14.5,color:"#37352f"},children:n("template.runHint")}),jl(ko,{sx:{border:"1px solid #e6e6e3",borderRadius:1,overflow:"hidden"},children:[jl(ko,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,bgcolor:"#fafaf9",borderBottom:"1px solid #e6e6e3",fontSize:13.5,fontWeight:600,color:"#37352f"},children:[Eo(ko,{sx:{flex:1,minWidth:0},children:n("template.task")}),Eo(ko,{sx:{width:88,flexShrink:0,textAlign:"center"},children:n("board.start")}),Eo(ko,{sx:{width:88,flexShrink:0,textAlign:"center"},children:n("board.due")}),Eo(ko,{sx:{width:96,flexShrink:0,textAlign:"center"},children:n("col.owner")})]}),Eo(_L,{style:{maxHeight:520},thumb:{width:6},children:s.length===0?Eo(ko,{sx:{p:2,fontSize:14,color:"#9a9a97"},children:n("template.nothingToCreate")}):s.map((c,u)=>jl(ko,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1.25,borderBottom:u===s.length-1?"none":"1px solid #f2f2f0",fontSize:16,fontWeight:500,color:"#111111"},children:[Eo(ko,{sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.title}),Eo(ko,{sx:{width:88,flexShrink:0,textAlign:"center",fontSize:13.5,color:c.start_date?"#37352f":"#9a9a97"},children:wu(c.start_date)||"-"}),Eo(ko,{sx:{width:88,flexShrink:0,textAlign:"center",fontSize:13.5,color:c.due_date?"#37352f":"#9a9a97"},children:wu(c.due_date)||"-"}),Eo(ko,{sx:{width:96,flexShrink:0,textAlign:"center",fontSize:13.5,color:c.manager_name?"#37352f":"#9a9a97",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.manager_name||"-"})]},u))})]})]})}]})}var IL={get urgent(){return n("print.urgent")},get high(){return n("priority.high")},get normal(){return n("priority.medium")},get low(){return n("priority.low")}};function wL(e){return e.length===0?"":e.length<=2?e.join(", "):n("print.namesAndMore",{value:e[0],value2:e.length-1})}function gm(e){let t=String(e??"").trim().slice(0,10);return/^\d{4}-\d{2}-\d{2}$/.test(t)?`${t.slice(2,4)}.${t.slice(5,7)}.${t.slice(8,10)}`:"-"}function Ii(e){let t=o=>String(o).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}`}function Ap(e,t,o){let r=String(e.due_date??"").slice(11,16).trim()||String(e.estimated_time??"").trim(),i=gm(e.due_date),l=String(e.start_date??"").slice(11,16).trim(),s=gm(e.start_date),c=(e.receiver_names??[]).filter(Boolean).map(m=>String(m).trim()),u=(e.checklist??[]).length?`${(e.checklist??[]).filter(m=>m.checked).length}/${(e.checklist??[]).length}`:"";return{seq:Number(e.seq??0),title:String(e.title??"").trim(),statusName:Nt(e).name,projectLabel:e.tab_key?t.get(String(e.tab_key))??"":"",managerName:String(e.manager_name??"").trim(),receiverNames:wL(c),receiverNamesFull:c.join(", "),startDate:s!=="-"&&l?`${s} ${l}`:s,dueDate:i!=="-"&&r?`${i} ${r}`:i,priorityName:IL[String(e.priority??"")]??"",checklist:u,checklistItems:(e.checklist??[]).map(m=>{let d=m.task_seq&&o?o(Number(m.task_seq)):null,p=gm(d?.due_date),f=String(d?.due_date??"").slice(11,16).trim();return{label:String(m.label??"").trim(),checked:!!m.checked,managerName:String(d?.manager_name??"").trim(),dueDate:p!=="-"?f?`${p} ${f}`:p:""}}),note:String(e.note??"").trim(),completed:!!e.completed}}function Ae(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function DL(e,t){if(e===" ")return t*.3;let o=e.codePointAt(0)??0,a=o>=4352&&o<=4607||o>=12288&&o<=40959||o>=44032&&o<=55203||o>=63744&&o<=64255||o>=65280&&o<=65519;return t*(a?1:.55)}function xm(e,t){let o=0;for(let a of String(e??""))o+=DL(a,t);return o}function wi(e,t){let o=String(e??"").trim();if(!o)return["-"];let a=[],r="";for(let i of o){if(i===`
19
- `){r&&a.push(r),r="";continue}let l=`${r}${i}`;if(l.length>t&&r){a.push(r),r=i;continue}r=l}return r&&a.push(r),a.length>0?a:["-"]}function Jn(e,t,o){let a=String(e??"").replace(/\s+/g," ").trim();if(!a)return"";if(xm(a,o)<=t)return a;let r=xm("\u2026",o),i="",l=0;for(let s of a){let c=xm(s,o);if(l+c+r>t)break;i+=s,l+=c}return`${i}\u2026`}var Xl=595.28,Ql=841.89,Jl=841.89,Zl=595.28,To=28,gn=96,Zo=44,EL="'Malgun Gothic','\uB9D1\uC740 \uACE0\uB515','Apple SD Gothic Neo','Noto Sans KR',sans-serif",RL="'Batang','\uBC14\uD0D5','AppleMyungjo','Noto Serif KR',serif",Yl="#cbd5e1",PL=[`text { font-family: ${EL}; fill: #000000; }`,`.doc-title { font-family: ${RL}; font-size: 20px; font-weight: 700; }`,".doc-sub { font-size: 10.5px; fill: #333333; }",".doc-meta { font-size: 9.5px; fill: #333333; }",".th { font-size: 9.5px; font-weight: 700; fill: #000000; }",`.td { font-size: 9px; }
18
+ ${f}`.trim()).then(()=>{l.setValue("copied",!0),window.setTimeout(()=>l.setValue("copied",!1),1500)})};return{modals:i,ui:l,taskSeq:e.taskSeq,isStored:s,selectTarget:c,openDialog:u,copySummary:m,copyResult:d}}import{jsx as ht,jsxs as Ml}from"react/jsx-runtime";var zb=[{code:"en",get label(){return n("lang.en")}},{code:"ja",get label(){return n("lang.ja")}},{code:"zh",get label(){return n("lang.zh")}},{code:"zh-TW",get label(){return n("lang.zhTW")}},{code:"vi",get label(){return n("lang.vi")}},{code:"th",get label(){return n("lang.th")}},{code:"ko",get label(){return n("lang.ko")}}];function Nb({controller:e,title:t,html:o}){L();let a=e.modals.translate,{ui:r}=e,i=String(r.useValue("target")??"");r.useValue("doneTargets");let l=r.useValue("result"),s=!!r.useValue("loading"),c=String(r.useValue("error")??""),u=!!r.useValue("copied"),m=!!r.useValue("summaryCopied"),[d,p]=fP(null),f=(x,h)=>{if(x!==i){if(x===""||e.isStored(x)){e.selectTarget(x);return}p({code:x,anchor:h})}};pP(()=>{a.isOpen&&p(null)},[a.isOpen,e.taskSeq]);let g=Ml(wo,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[ht(wo,{sx:{display:"flex",flexWrap:"wrap",gap:.75},children:[{code:"",label:n("translate.original")},...zb].map(x=>ht(gP,{label:x.label,clickable:!0,icon:x.code&&e.isStored(x.code)?ht(tp,{sx:{fontSize:16}}):void 0,onClick:h=>f(x.code,h.currentTarget),color:i===x.code?"primary":"default",variant:i===x.code?"filled":"outlined",sx:{fontSize:14,height:30}},x.code||"__source__"))}),ht(hP,{open:!!d,anchorEl:d?.anchor??null,title:n("translate.startConfirm",{value:zb.find(x=>x.code===d?.code)?.label??""}),confirmText:n("translate.start"),cancelText:n("common.cancel"),placement:"bottom-start",onCancel:()=>p(null),onConfirm:()=>{d&&e.selectTarget(d.code),p(null)}}),i?s?ht(wo,{sx:{minHeight:200,display:"flex",alignItems:"center",justifyContent:"center"},children:ht(Vc,{})}):c?ht(wo,{sx:{fontSize:15,color:"#c62828",py:2},children:c}):l?Ml(wo,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[l.summary?Ml(wo,{sx:{position:"relative",display:"flex",alignItems:"center",gap:2,px:1.5,pr:5,py:1.25,bgcolor:"#eef4ff",border:"1px solid #c7d7fe",borderRadius:1},children:[ht(bP,{title:n("translate.copySummary"),arrow:!0,children:ht(xP,{size:"small","aria-label":n("translate.copySummary"),onClick:e.copySummary,sx:{position:"absolute",top:4,right:4,color:"#64748b"},children:m?ht(tp,{sx:{fontSize:18,color:"#2f9e5b"}}):ht(qb,{sx:{fontSize:18}})})}),ht(TP,{sx:{fontSize:30,color:"#2563eb",flexShrink:0,mx:1.5}}),Ml(wo,{sx:{flex:1,minWidth:0},children:[ht(wo,{sx:{fontSize:16,fontWeight:600,color:"#1e3a8a"},children:n("translate.aiNotice")}),ht(wo,{sx:{fontSize:15,color:"#111",mt:.25,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:l.summary})]})]}):null,ht(wo,{sx:{fontSize:18,fontWeight:700,color:"#111",wordBreak:"break-word"},children:l.title}),l.html?ht(wo,{sx:{fontSize:16,lineHeight:1.6,color:"#37352f",wordBreak:"break-word","& > p:first-of-type":{mt:0},"& > p:last-of-type":{mb:0},"& a[href]":{color:"#2563eb",textDecoration:"underline"},"& img":{maxWidth:"100%"}},dangerouslySetInnerHTML:{__html:l.html}}):ht(wo,{sx:{fontSize:16,lineHeight:1.6,color:"#37352f",whiteSpace:"pre-wrap"},children:l.text})]}):null:Ml(wo,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[ht(wo,{sx:{fontSize:18,fontWeight:700,color:"#111",wordBreak:"break-word"},children:t}),ht(wo,{sx:{fontSize:16,lineHeight:1.6,color:"#37352f",wordBreak:"break-word","& > p:first-of-type":{mt:0},"& > p:last-of-type":{mb:0},"& a[href]":{color:"#2563eb",textDecoration:"underline"},"& img":{maxWidth:"100%"}},dangerouslySetInnerHTML:{__html:o||"<p></p>"}})]})]});return ht(kP,{open:a.isOpen,onClose:a.close,width:760,title:n("translate.title"),locale:Se(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-content-translate",maxContentHeight:"80vh",sectionContentPaddingTop:0,sections:[{id:"translate",showTitle:!1,children:g}],actions:{showCancelButton:!1,left:i&&l?ht(Ab,{variant:"outlined",color:"inherit",startIcon:u?ht(tp,{sx:{fontSize:18,color:"#2f9e5b"}}):ht(qb,{sx:{fontSize:18}}),onClick:e.copyResult,sx:{minWidth:80,color:"#37352f",borderColor:"#d9d9d6"},children:n("common.copy")}):void 0,right:ht(Ab,{variant:"contained",onClick:a.close,sx:{minWidth:80},children:n("common.close")})}})}import{ConfirmActionPopper as iO}from"@ehfuse/mui-confirm-action";import{DatePicker as lO}from"@ehfuse/mui-datetime-picker";import{useState as yP}from"react";import{TextField as CP}from"@ehfuse/mui-form-controls";import{jsx as SP}from"react/jsx-runtime";function Fb({value:e,onCommit:t,onDraftChange:o,readOnly:a=!1}){L();let[r,i]=yP(null);return SP(CP,{value:r??e,placeholder:a?"":n("create.notePlaceholder"),fullWidth:!0,size:"medium",slotProps:{input:{readOnly:a}},onChange:l=>{i(l.target.value),o?.(l.target.value)},onBlur:()=>{r!==null&&r.trim()!==e&&t(r),i(null)},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&i(null)},sx:{mt:1}})}import{Box as Aa,Button as vP}from"@mui/material";import BP from"@mui/icons-material/PieChartOutlineOutlined";import _P from"@mui/icons-material/PersonOutlineOutlined";import IP from"@mui/icons-material/PeopleAltOutlined";import{PropertyGrid as wP,PropertyInput as DP}from"@ehfuse/mui-form-controls";import{jsx as zo,jsxs as Kc}from"react/jsx-runtime";function EP(e){return e.getFormValue("contributions")??{}}function RP({form:e,participants:t}){L();let o=e.useFormValue("contributions")??{},a=qm(o,t),r=a===100;return Kc(Aa,{component:"span","data-testid":"task-contribution-total",sx:{fontSize:14,fontWeight:400,color:r?"#787774":"error.main",whiteSpace:"nowrap"},children:[n("section.total")," ",a,"%",r?"":n("section.mustBe100")]})}function Hb({form:e,participants:t,readOnly:o,avatarSrcByName:a,onSave:r}){L();let i=()=>{let s=EP(e);qm(s,t)===100&&r(zm(s,t))},l=()=>{let s=Am(t.length),c={};t.forEach((u,m)=>{c[String(u.account_seq)]=String(s[m])}),e.setFormValue("contributions",c),r(zm(c,t))};return zo(qo,{icon:zo(BP,{sx:{fontSize:18,display:"block"}}),title:n("section.contribution"),titleExtra:t.length>0?Kc(Aa,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:1,minWidth:0},children:[zo(RP,{form:e,participants:t}),!o&&t.length>1?zo(vP,{size:"small",onClick:l,sx:{fontSize:"0.875rem",flexShrink:0,whiteSpace:"nowrap"},children:n("section.splitEvenly")}):null]}):null,children:t.length===0?zo(Aa,{sx:{fontSize:14,color:"#9a9a97",py:.5},children:n("section.contributionHint")}):zo(mr,{name:"contributions",children:zo(wP,{children:t.map(s=>zo(Te,{icon:s.role==="manager"?zo(_P,{sx:{fontSize:17}}):zo(IP,{sx:{fontSize:17}}),label:s.role==="manager"?n("col.owner"):n("col.cc"),onClick:o?void 0:c=>c.querySelector("input")?.focus(),children:Kc(Aa,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%",minWidth:0},children:[zo(vo,{names:[s.name],size:20,avatarSrcByName:a}),zo(Aa,{component:"span",sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name||n("workload.noName")}),Kc(Aa,{sx:{display:"inline-flex",alignItems:"baseline",flexShrink:0},children:[zo(DP,{form:e,name:`contributions.${s.account_seq}`,appearance:_a,inputMode:"numeric",maxLength:3,placeholder:"0",readOnly:o,parse:c=>{let u=xs(c===""?"0":c);return u===null?null:String(u)},onCommit:()=>i(),sx:{flex:"0 0 auto",width:"3ch",textAlign:"right"}}),zo(Aa,{component:"span",sx:{ml:.25},children:"%"})]})]})},s.account_seq))})})})}import{useMemo as rp,useState as PP}from"react";import{Box as bo,Button as Vb,IconButton as OP}from"@mui/material";import MP from"@mui/icons-material/AccountTreeOutlined";import LP from"@mui/icons-material/LinkOutlined";import AP from"@mui/icons-material/Close";import qP from"@mui/icons-material/RedoOutlined";function qa(e){return e.relations??[]}function ZX(e,t,o){return qa(e).some(a=>a.type===o&&a.task_seq===t.seq)||qa(t).some(a=>a.type===o&&a.task_seq===e.seq)}function Wb(e){return`${e.created_time??""}|${String(e.seq).padStart(12,"0")}`}function op(e,t){let o=new Map(t.map(g=>[g.seq,g]));o.set(e.seq,e);let a=new Map,r=(g,x)=>{a.has(g)||a.set(g,new Set),a.has(x)||a.set(x,new Set),a.get(g).add(x),a.get(x).add(g)};for(let g of o.values())for(let x of qa(g))x.type==="follow_up"&&o.has(x.task_seq)&&r(g.seq,x.task_seq);let i=new Set([e.seq]),l=[e.seq];for(;l.length>0;){let g=l.shift();for(let x of a.get(g)??[])i.has(x)||(i.add(x),l.push(x))}let s=[...i].map(g=>o.get(g)).filter(g=>!!g).sort((g,x)=>Wb(g).localeCompare(Wb(x))),c=new Set;for(let g of qa(e))g.type==="related"&&c.add(g.task_seq);for(let g of o.values())g.seq!==e.seq&&qa(g).some(x=>x.type==="related"&&x.task_seq===e.seq)&&c.add(g.seq);let u=[...c].map(g=>o.get(g)).filter(g=>g!==void 0&&g.seq!==e.seq),m=[...o.values()].filter(g=>g.seq!==e.seq&&qa(g).some(x=>x.type==="duplicate_of"&&x.task_seq===e.seq)),d=qa(e).find(g=>g.type==="duplicate_of")?.task_seq,p=d?o.get(d)??null:null,f=[...o.values()].filter(g=>g.seq!==e.seq&&(g.checklist??[]).some(x=>Number(x.task_seq??0)===e.seq));return{lineage:s,related:u,duplicates:m,duplicateOf:p,parents:f}}function np(e,t){let o=op(e,t);return(o.lineage.length>=2?o.lineage.length-1:0)+o.related.length+o.duplicates.length+(o.duplicateOf?1:0)+o.parents.length}function $b(e,t){return np(e,t)>0}import{ConfirmActionPopper as zP}from"@ehfuse/mui-confirm-action";import{Fragment as NP,jsx as vt,jsxs as Rn}from"react/jsx-runtime";function Uc({item:e,caption:t,onOpen:o,onUnlink:a}){L();let r=e.is_notice||e.is_event?Le(e.icon||(e.is_notice?Dt:Nt)):null;return Rn(bo,{sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.5,borderRadius:1,"&:hover":{bgcolor:"#f7f7f5"},"&:hover .taskbox-relation-unlink":{opacity:1}},children:[t?vt(bo,{component:"span",sx:{flexShrink:0,px:.6,py:.1,borderRadius:.75,fontSize:11.5,fontWeight:500,color:"#8a6d1d",bgcolor:"#faf1d7"},children:t}):null,r?vt(r,{sx:{fontSize:16,flexShrink:0,color:e.icon_color||"#1e3a8a"}}):null,Rn(bo,{component:"span",onClick:o,sx:{flex:1,minWidth:0,fontSize:14,color:e.completed?"#9a9a97":"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...o?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}},children:[e.ticket_no?`${e.ticket_no} `:"",e.title]}),vt(Ke,{option:Ft(e),small:!0}),a?vt(OP,{className:"taskbox-relation-unlink",size:"small","aria-label":n("section.unlink"),onClick:a,sx:{opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:vt(AP,{sx:{fontSize:15}})}):null]})}function Kb({task:e,tasks:t,readOnly:o=!1,onOpenTask:a,onLink:r,onUnlink:i,onCreateFollowUp:l}){L();let s=Tl({onSubmit:(x,h)=>r?.(e.seq,x,h)}),[c,u]=PP(null),m=rp(()=>op(e,t),[e,t]),d=m.lineage.length>=2,p=rp(()=>np(e,t),[e,t]),f=rp(()=>{let x=new Set;for(let h of m.lineage)x.add(h.seq);for(let h of m.related)x.add(h.seq);for(let h of m.duplicates)x.add(h.seq);for(let h of m.parents)x.add(h.seq);return m.duplicateOf&&x.add(m.duplicateOf.seq),[...x]},[m]),g=(x,h,E)=>{u({anchorEl:x,targetSeq:h,type:E})};return Rn(qo,{icon:vt(MP,{sx:{fontSize:19,display:"block"}}),title:Rn(NP,{children:[n("section.relatedTasks"),p>0?vt(bo,{component:"span",sx:{fontSize:12.5,color:"#9a9a97"},children:p}):null]}),titleExtra:o?null:Rn(bo,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:.5},children:[l?vt(Vb,{size:"small",color:"inherit",startIcon:vt(qP,{sx:{fontSize:16}}),onClick:()=>l(e.seq),sx:{minWidth:0,px:1,fontSize:12.5,color:"#787774"},children:n("section.followUps")}):null,r?vt(Vb,{size:"small",color:"inherit",startIcon:vt(LP,{sx:{fontSize:16}}),onClick:s.openDialog,sx:{minWidth:0,px:1,fontSize:12.5,color:"#787774"},children:n("link.confirm")}):null]}),children:[Rn(bo,{sx:{display:"flex",flexDirection:"column",mt:.5,pl:3.25},children:[d?vt(bo,{sx:{mb:m.related.length||m.duplicates.length||m.duplicateOf?1:0},children:m.lineage.map((x,h)=>{let E=x.seq===e.seq,b=h===m.lineage.length-1;return Rn(bo,{sx:{display:"flex",gap:1},children:[Rn(bo,{sx:{display:"flex",flexDirection:"column",alignItems:"center",width:14,flexShrink:0,pt:1.1},children:[vt(bo,{sx:{width:E?9:7,height:E?9:7,borderRadius:"50%",bgcolor:E?"#2f80ed":x.completed?"#9a9a97":"#c9c8c5",flexShrink:0}}),b?null:vt(bo,{sx:{width:"2px",flex:1,bgcolor:ee}})]}),Rn(bo,{sx:{flex:1,minWidth:0,pb:b?0:.5},children:[Rn(bo,{sx:{display:"flex",alignItems:"center",gap:.75},children:[Rn(bo,{component:"span",onClick:!E&&a?()=>a(x.seq):void 0,sx:{minWidth:0,fontSize:14,fontWeight:E?600:400,color:E?"#2f80ed":x.completed?"#9a9a97":"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...!E&&a?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}},children:[x.ticket_no?`${x.ticket_no} `:"",x.title]}),vt(Ke,{option:Ft(x),small:!0})]}),vt(bo,{sx:{fontSize:12,color:"#9a9a97"},children:x.completed&&x.completed_time?n("section.completedAt",{completed_time:x.completed_time}):x.created_time??""})]})]},x.seq)})}):null,m.parents.map(x=>vt(Uc,{item:x,caption:n("section.parentTask"),onOpen:a?()=>a(x.seq):void 0},`parent-${x.seq}`)),m.duplicateOf?vt(Uc,{item:m.duplicateOf,caption:n("section.original"),onOpen:a?()=>a(m.duplicateOf.seq):void 0,onUnlink:!o&&i?x=>g(x.currentTarget,m.duplicateOf.seq,"duplicate_of"):void 0}):null,m.duplicates.map(x=>vt(Uc,{item:x,caption:n("section.duplicate"),onOpen:a?()=>a(x.seq):void 0,onUnlink:!o&&i?h=>g(h.currentTarget,x.seq,"duplicate_of"):void 0},`dup-${x.seq}`)),m.related.map(x=>vt(Uc,{item:x,onOpen:a?()=>a(x.seq):void 0,onUnlink:!o&&i?h=>g(h.currentTarget,x.seq,"related"):void 0},`rel-${x.seq}`)),p===0?vt(bo,{sx:{px:1.25,py:.75,fontSize:13.5,color:"#9a9a97"},children:n("section.noLinks")}):null]}),r?vt(vc,{controller:s,task:e,tasks:t,excludeSeqs:f}):null,vt(zP,{open:!!c,anchorEl:c?.anchorEl??null,title:n("section.unlinkConfirm"),confirmText:n("task.unmark"),onCancel:()=>u(null),onConfirm:()=>{c&&i?.(e.seq,c.targetSeq,c.type),u(null)}})]})}import{Fragment as Bt,jsx as H,jsxs as Ne}from"react/jsx-runtime";function oa({label:e=n("menu.empty")}){return L(),H(ot,{component:"span",sx:{color:"#9a9a97"},children:e})}function Jb({store:e}){return H(Bt,{children:bs(e)})}function sO({store:e}){let t=bs(e);return t==null||t===!1?null:H(ot,{sx:[wn(13),st(2)],children:t})}function Zb({store:e,children:t}){return H(Bt,{children:t(bs(e))})}function cO(e){let t=Gc(e);t.current=e;let o=Gc(new Map),a={};for(let[r,i]of Object.entries(e)){if(typeof i!="function"){a[r]=i;continue}let l=o.current.get(r);l||(l=(...s)=>t.current[r]?.(...s),o.current.set(r,l)),a[r]=l}return a}function cp(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((o,a)=>o===t[a]||cp(o,t[a]));if(e&&t&&typeof e=="object"&&typeof t=="object"&&Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype)try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}return!1}var mO=new Set([...Va,"reminder","is_read"]);function uO(e,t){if(e===t)return!0;let o=!!(e.is_bug||t.is_bug),a=e,r=t,i=new Set([...Object.keys(a),...Object.keys(r)]);for(let l of i)if(!(mO.has(l)&&!(o&&l==="status"))&&!cp(a[l],r[l]))return!1;return!0}function dO(e,t){let o=e,a=t,r=new Set([...Object.keys(o),...Object.keys(a)]);for(let i of r){let l=o[i],s=a[i];if(i==="task"){if(!uO(l,s))return!1;continue}if(typeof l=="function"||typeof s=="function"){if(typeof l!=typeof s)return!1;continue}if(!cp(l,s))return!1}return!0}function pO({form:e,task:t,locked:o,options:a,onSelect:r}){L();let[i,l]=No(null);return Ne(Bt,{children:[H(Te,{icon:H(JP,{sx:{fontSize:17}}),label:n("col.status"),onClick:o?void 0:s=>l(s),children:H($o,{form:e,name:"status",children:s=>H($o,{form:e,name:"resolution",children:c=>H(Ke,{option:Ft({...t,status:s,resolution:c})})})})}),H(Ga,{anchorEl:i,value:e.getFormValue("status"),options:a,onSelect:r,onClose:()=>l(null)})]})}function fO({form:e,locked:t,labelOptions:o,onChange:a,onAddLabel:r}){L();let[i,l]=No(null);return H($o,{form:e,name:"label_keys",children:s=>Ne(Bt,{children:[H(Te,{icon:H(ZP,{sx:{fontSize:17}}),label:n("dialog.label"),onClick:t?void 0:c=>l(c),children:s.length>0?H($r,{labelKeys:s,labelOptions:o}):H(oa,{})}),H(Ec,{anchorEl:i,selectedKeys:s,labelOptions:o,onToggle:c=>a(Is(s,c)),onAddLabel:r,onClose:()=>l(null)})]})})}function eh({leadingContent:e,contentTitleExtra:t,propertyExtra:o,relatedTasksPool:a,...r}){let i=Hm(r.task),l=Ji(e),s=Ji(t),c=Ji(o),u=Ji(a),m=Gc({leading:l,titleExtra:s,propertyExtra:c,pool:u}),d=cO(r);return H(Wm.Provider,{value:i,children:H(gO,{...d,slots:m.current})})}var gO=FP(function({slots:t,task:o,customTabs:a,statusOptions:r,avatarSrcByName:i,onChangeStatus:l,onChangeLabels:s,onAddLabelOption:c,onChangeProject:u,onAddProject:m,onChangeDate:d,onChangeReminder:p,onMemberEdit:f,onChangePriority:g,onChangeVisibility:x,onChangeRepeat:h,departments:E=[],onChangeEventTime:b,onChangeEventPlace:B,onChangeEventAddress:T,onChangeNote:z,onChangeNoteDraft:k,onChangeContent:_,contentTemplates:D,onSaveContentTemplate:F,onRemoveContentTemplate:R,contentLoading:C=!1,onAddChecklistItem:y,onToggleChecklistItem:I,onRemoveChecklistItem:S,onUpdateChecklistItem:M,onReorderChecklist:w,onConvertChecklistToTask:q,onOpenChecklistTask:v,onLinkChecklistTask:O,resolveChecklistTask:j,onOpenRelatedTask:V,onLinkRelatedTask:Z,onUnlinkRelatedTask:ie,onCreateFollowUpTask:ue,onAddAttachments:K,onRemoveAttachment:te,onReorderAttachments:$,onPreview:G,onDownload:ae,onUpdateComment:Re,onRemoveComment:mt,onToggleCommentReaction:ce,currentUserName:Q="",myAccountSeq:W=0,headerless:X=!1,noticeAdmin:le=!1,hideProject:pe=!1,hideProperties:De=!1,postMode:ve=!1,hideLabel:It=!1,showTitle:We=!1,displayTitle:Ee,onChangeTitle:ut,onToggleCompleted:je,onChangeIcon:co,onChangeIconColor:kt,employees:oe=[],onAckConfirm:_e,onRequestConfirm:Ze,onChangeBugField:ze,sprints:tn=[],sprintProject:qr=!1,hideSprint:mo=!1,onChangeSprint:or,onChangeStoryPoints:bn,onChangeResolution:nr,onClaimTask:Kt,onVerifyBug:hn,contributionEnabled:Yt=!1,onChangeContributions:rr}){L();let{form:dt,getTask:Po}=$m(),[kn,rt]=No(null),[Ln,Oe]=No(!1),U=Gc(!1),[P,me]=No(null),[xe,et]=No(null),[Ye,at]=No(null),[wt,eo]=No(!1),qt=ve?void 0:{[yr]:wt?{maxHeight:120,opacity:1,overflow:"hidden",transition:"max-height 0.25s ease, opacity 0.2s ease"}:{minHeight:0,maxHeight:0,opacity:0,overflow:"hidden",pointerEvents:"none",transition:"max-height 0.25s ease, opacity 0.2s ease"}},[Xt,ar]=No(null),[ir,lr]=No(null),[zr,sr]=No(null),[Ai,Fe]=No(null),[Nr,Ho]=No(null),zt=!!o.is_notice,Ve=!!o.is_event,Oo=!!o.is_bug,Wo=!!Kt&&Ns(o,W),{onReturnTask:An,onReviewDone:ns,editPolicy:rs,translateContent:qi,contentTranslate:as}=se(),Co=X&&!!ns&&!!An&&no(o,W),[Na,ua]=No(null),da=!!(qi&&as),qn=ep({taskSeq:o.seq,translatedTargets:o.translated_targets??[]}),zi=!!Kt&&Fs(o,W),Ni=!!hn&&Oo&&!!o.completed&&W>0&&(o.author_account_seq??0)===W&&!(o.acks??[]).some(N=>N.account_seq===W),Tn=!Wn(o,W),uo=Ur(o,W,rs),is=!De&&!ve&&!o.is_event&&(o.is_notice?W>0&&(o.author_account_seq??0)===W:(o.author_account_seq??0)===W||(o.manager_account_seq??0)===W),Fa=o.is_notice||o.is_event?Le(o.icon||(o.is_notice?Dt:Nt)):null,Ha=zt?!zs(o,W):Tn,Wa=Wo||zi?Ne(Uo,{onClick:N=>Ho(N.currentTarget),children:[H(nO,{sx:{fontSize:16,mr:.5}}),n("col.claim")]}):null,Cm=zt?Rc(o,oe):"",to=zt?Qx(o,oe,W):null,oo=zt?null:Vn(o,W),So=Mb(o.content??""),on=Lb(o.seq,!!(oo?.canConfirm&&_e),So,()=>_e?.(o.seq)),ls=Math.max(1,Math.ceil((1-on)*So/1e3)),Sm=!!(oo&&oo.total>0||zt&&to),Fi=(o.origin_license_seq??0)>0,ss=!zt&&!Fi,$a=De||ve,pa=ve&&sn(o)==="all"&&(o.receiver_names??[]).length===0,Hi=Ne(Bt,{children:[H(Te,{icon:H(eO,{sx:{fontSize:17}}),label:n("col.author"),sx:[wn(9),qt??null,...Ve?[]:[st(1)]],children:o.created_by?Ne(Bt,{children:[H(vo,{names:[o.created_by],size:20,avatarSrcByName:i}),o.created_by]}):H(oa,{})}),H(Te,{icon:H(jb,{sx:{fontSize:17}}),label:n("col.createdTime"),sx:[wn(11),qt??null,...Ve?[]:[st(pa?1:2)]],children:o.created_time?Ko(o.created_time):H(oa,{})})]});return Ne(Bt,{children:[We?Ne(ot,{sx:{px:2,pt:2,pb:.5,display:"flex",alignItems:"flex-start",gap:1},children:[is?H(HP,{checked:o.completed,icon:H(QP,{sx:{fontSize:22,color:"#9a9a97",opacity:.45}}),checkedIcon:H(lp,{sx:{fontSize:22,color:"#2f80ed"}}),onChange:(N,Xe)=>{xe||et({anchorEl:N.currentTarget,nextCompleted:Xe})},sx:{p:0,mt:.25}}):null,Fa?Ve&&!Tn?H(Ub,{onClick:N=>me(N.currentTarget),sx:{display:"flex",p:.25,mt:.1,borderRadius:1,color:o.icon_color||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:H(Fa,{sx:{fontSize:20}})}):H(ot,{sx:{display:"flex",p:0,mt:.25,color:o.icon_color||(zt?"#e5484d":"#1e3a8a")},children:H(Fa,{sx:{fontSize:20}})}):null,H(ot,{sx:{flex:1,minWidth:0},children:kn!==null?H(ot,{component:"div",contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,ref:N=>{if(!N||N.dataset.focused)return;N.dataset.focused="1",N.focus();let Xe=document.createRange();Xe.selectNodeContents(N),Xe.collapse(!1);let zn=window.getSelection();zn?.removeAllRanges(),zn?.addRange(Xe)},onBlur:N=>{let Xe=(N.currentTarget.textContent??"").replace(/\n/g," ").trim();!U.current&&Xe&&Xe!==Po().title&&ut(o.seq,Xe),U.current=!1,rt(null)},onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),N.target.blur()),N.key==="Escape"&&(U.current=!0,N.target.blur())},onPaste:N=>{N.preventDefault();let Xe=N.clipboardData.getData("text/plain").replace(/\n/g," ");document.execCommand("insertText",!1,Xe)},sx:{outline:"none",fontSize:19,fontWeight:600,color:o.completed?"#9a9a97":"#37352f",lineHeight:"26px",cursor:"text",userSelect:"text",wordBreak:"break-word"},children:kn}):H(ot,{onClick:uo||Ee?void 0:()=>rt(String(dt.getFormValue("title")??"")),sx:{fontSize:19,fontWeight:600,color:o.completed?"#9a9a97":"#37352f",lineHeight:"26px",cursor:uo||Ee?"default":"text",userSelect:"text",wordBreak:"break-word"},children:Ee||H($o,{form:dt,name:"title",children:N=>N})})}),H(Lo,{open:!!xe,anchorEl:xe?.anchorEl??null,nextCompleted:xe?.nextCompleted??!1,returnMode:!!An&&no(o,W),onCancel:()=>et(null),onConfirm:N=>{xe&&(N&&An?An(Po(),N):je(o.seq,xe.nextCompleted)),et(null)}})]}):null,Ne(ot,{sx:{py:1.5,display:"flex",flexDirection:"column",gap:0,[yr]:{pb:0,"& > :last-child":{mb:0}}},children:[De?null:Ne(Bt,{children:[H(xc,{form:dt,hideProject:pe,hideManager:ve,hideReceivers:pa,hideStartDate:ve,hideReminder:ve,hidePriority:ve,pinColumns:!0,projectColumn:!Ve&&!It?2:"full",values:{tabKey:o.tab_key??"",managerName:ve?o.manager_name||o.author_name||"":o.manager_name,receiverNames:o.receiver_names,startDate:o.start_date,dueDate:o.due_date,reminders:rn(o),priority:o.priority,eventTime:o.event_time??"",eventPlace:o.event_place??"",eventAddress:o.event_address??""},customTabs:a,avatarSrcByName:Ws(o,i),hideDueDate:ve||!Ve&&!!o.repeat_rule,notice:zt,event:Ve,readOnly:Tn,coreLocked:uo,targetSummary:Cm,onChangeProject:N=>u(o.seq,N),onAddProject:m,onChangeStartDate:N=>d(o.seq,"start_date",N),onChangeDueDate:N=>d(o.seq,"due_date",N),onChangeReminder:N=>p(o.seq,N),onChangePriority:N=>g(o.seq,N),onChangeEventTime:N=>b?.(o.seq,N),onChangeEventPlace:N=>B?.(o.seq,N),onChangeEventAddress:N=>T?.(o.seq,N),onMemberEdit:N=>f(Po(),N,null),narrowCollapsedSx:qt,reminderLocked:o.completed,managerAction:Wa,supportOrigin:(o.origin_license_seq??0)>0?{licenseName:o.origin_license_name??"",authorName:o.origin_author_name||o.author_name||o.created_by||"",contactPhone:o.origin_contact_phone??"",contactEmail:o.origin_contact_email??"",supportType:js(o.support_type??"")}:void 0,leading:Ne(Bt,{children:[!ve&&(Ni||Wa&&(zt||Ve))?Ne(ot,{sx:{gridColumn:"1 / -1",display:"flex",justifyContent:"flex-start",gap:2,px:2,py:1.5},children:[zt||Ve?Wa:null,Ni?Ne(Bt,{children:[H(za,{variant:"contained",size:"large",onClick:()=>hn?.(o.seq,!0),sx:{bgcolor:"#2f80ed"},children:n("detail.bugVerified")}),H(za,{variant:"outlined",size:"large",color:"error",onClick:()=>hn?.(o.seq,!1),children:n("detail.bugReopen")})]}):null]}):null,Oo&&o.ticket_no?H(Te,{icon:H(GP,{sx:{fontSize:17}}),label:n("col.ticket"),sx:st(1),children:H(ot,{component:"span",sx:{fontVariantNumeric:"tabular-nums"},children:o.ticket_no})}):null,Ve||ve?null:H(ot,{sx:Oo&&o.ticket_no||ss||Sm?st(Oo&&o.ticket_no?2:1):{gridColumn:"1 / -1"},children:H(pO,{form:dt,task:o,locked:Tn||!!o.completed,options:zt?ol:Oo?xa:nl,onSelect:N=>l(o.seq,N)})}),Co&&!ve?Ne(Te,{icon:H(jP,{sx:{fontSize:17}}),label:n("board.review"),sx:{gridColumn:"1 / -1"},children:[H(Uo,{onClick:N=>et({anchorEl:N.currentTarget,nextCompleted:!1}),children:n("task.revert")}),H(za,{size:"small",variant:"contained",disableElevation:!0,onClick:N=>{N.stopPropagation(),ua(N.currentTarget)},sx:{ml:1,...jr},children:n("col.reviewDone")}),H(Yr,{anchorEl:Na,onCancel:()=>ua(null),onConfirm:()=>{ns?.(Po()),ua(null)}})]}):null,ss?(()=>{let N=sn(o),Xe=N==="all"?H(Xb,{sx:{fontSize:17,color:"#2f80ed"}}):N==="group"?H(Qb,{sx:{fontSize:17,color:"#d9730d"}}):H(Yb,{sx:{fontSize:17}}),zn=N==="all"?n("create.visibilityPublic"):N==="group"?n("create.visibilityDept",{value:E.find(Wi=>Wi.seq===(o.visibility_group_seq??0))?.name??n("create.department")}):n("create.visibilityPrivate");return H(ot,{sx:Ve?void 0:st(Oo||ve?1:2),children:H(Te,{icon:Xe,label:H(Pc,{}),onClick:uo||!x?void 0:Wi=>ar(Wi),children:zn})})})():null,!Oo&&!Fi&&!ve?H(ot,{sx:Ve?void 0:st(1),children:H(Te,{icon:H(rO,{sx:{fontSize:17,...o.repeat_rule?{color:"#2f80ed"}:{}}}),label:n("create.repeat"),onClick:uo||!h?void 0:N=>lr(N),children:o.repeat_rule?hs(o.repeat_rule):H(oa,{label:n("common.none")})})}):null,!Oo&&!ve&&o.repeat_rule?H(ot,{sx:Ve?void 0:st(2),children:H(Te,{icon:H(aO,{sx:{fontSize:17}}),label:n("create.repeatUntil"),onClick:uo||!h?void 0:N=>sr(N),children:o.repeat_until?n("detail.repeatUntilValue",{repeat_until:o.repeat_until}):H(oa,{})})}):null,!ve&&oo&&oo.total>0?H(ot,{sx:Ve?void 0:st(2),children:H(Te,{icon:H(sp,{sx:{fontSize:17}}),label:n("task.confirm"),children:oo.canConfirm?Ne(ot,{sx:{display:"inline-flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[H(za,{size:"small",variant:"contained",onClick:()=>_e?.(o.seq),sx:{py:.1,px:1.25,minWidth:0,color:"#fff",bgcolor:"#2f80ed",backgroundImage:`linear-gradient(to right, #1a5fc4 ${on*100}%, transparent ${on*100}%)`,boxShadow:"none","&:hover":{bgcolor:"#1e6fd9",boxShadow:"none"}},children:n("task.confirm")}),H(ot,{component:"span",sx:{fontSize:14,color:"text.secondary",whiteSpace:"nowrap"},children:n("detail.autoConfirmIn",{seconds:ls})})]}):Ne(za,{size:"small",variant:"outlined",color:"inherit",startIcon:oo.myTime?H(lp,{sx:{fontSize:"16px !important",color:"#2f80ed"}}):null,onClick:N=>at({anchorEl:N.currentTarget,open:!0}),sx:{py:.1,px:1.25,minWidth:0,fontSize:13,color:"text.primary",borderColor:"#d5d8dc",bgcolor:"#fff",whiteSpace:"nowrap"},children:[oo.count," / ",oo.total]})})}):null,zt&&to?H(ot,{sx:st(2),children:H(Te,{icon:H(sp,{sx:{fontSize:17}}),label:n("task.confirm"),children:H(ot,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,minWidth:0},children:to.canAck?H(za,{size:"small",variant:"contained",onClick:()=>_e?.(o.seq),sx:{py:.1,px:1.25,minWidth:0,color:"#fff",bgcolor:"#2f80ed",boxShadow:"none","&:hover":{bgcolor:"#1e6fd9",boxShadow:"none"}},children:n("task.confirm")}):H(za,{size:"small",variant:"outlined",color:"inherit",startIcon:to.acked?H(lp,{sx:{fontSize:"16px !important",color:"#2f80ed"}}):null,onClick:N=>at({anchorEl:N.currentTarget,open:!0}),sx:{py:.1,px:1.25,minWidth:0,fontSize:13,color:"text.primary",borderColor:"#d5d8dc",bgcolor:"#fff",whiteSpace:"nowrap"},children:to.total>0&&to.count>=to.total?n("common.done"):Ne(Bt,{children:[to.count,H(ot,{component:"span",sx:{mx:.4},children:"/"}),to.total]})})})})}):null,qr&&!mo&&!Ve&&!zt&&!ve?Ne(Bt,{children:[H(Te,{icon:H(YP,{sx:{fontSize:17}}),label:n("col.goal"),onClick:uo?void 0:N=>Fe(N),sx:st(1),children:H($o,{form:dt,name:"sprint_seq",children:N=>N>0?tn.find(Xe=>Xe.seq===N)?.name??n("detail.deletedSprint"):H(oa,{label:n("board.unassigned")})})}),H(Te,{icon:H(XP,{sx:{fontSize:17}}),label:"\uD3EC\uC778\uD2B8",sx:st(2),children:H(mr,{name:"story_points",children:H($o,{form:dt,name:"story_points",children:N=>H(Cr,{value:N>0?String(N):"",placeholder:n("create.notEstimated"),readOnly:uo,onCommit:Xe=>bn?.(o.seq,Number(Xe.replace(/[^0-9.]/g,""))||0)})})})})]}):null,Ve||It?null:H(ot,{sx:[ve?st(2):pe?{gridColumn:"1 / -1"}:st(1),qt??null],children:H(fO,{form:dt,locked:Tn,labelOptions:r,onChange:N=>s(o.seq,N),onAddLabel:c})})]}),afterProject:Ve?null:Ne(Bt,{children:[Hi,H(sO,{store:t.propertyExtra})]}),trailing:Ne(Bt,{children:[Oo?H(bc,{form:dt,values:{repro:o.bug_repro??"",device:o.bug_device??"",where:o.bug_where??"",version:o.bug_version??"",resolution:o.resolution??""},readOnly:uo,showResolution:!!o.completed,onChangeRepro:N=>ze?.(o.seq,"bug_repro",N),onChangeDevice:N=>ze?.(o.seq,"bug_device",N),onChangeWhere:N=>ze?.(o.seq,"bug_where",N),onChangeVersion:N=>ze?.(o.seq,"bug_version",N),onChangeResolution:N=>nr?.(o.seq,N)}):null,Ve?Hi:null,o.completed?Ne(Bt,{children:[H(Te,{icon:H(sp,{sx:{fontSize:17}}),label:n("detail.completedBy"),sx:[wn(10),qt??null,...Ve?[]:[st(1)]],children:o.completed_by?Ne(Bt,{children:[H(vo,{names:[o.completed_by],size:20,avatarSrcByName:i}),o.completed_by]}):H(oa,{})}),H(Te,{icon:H(jb,{sx:{fontSize:17}}),label:n("col.completedTime"),sx:[wn(12),qt??null,...Ve?[]:[st(2)]],children:o.completed_time?Ko(o.completed_time):H(oa,{})})]}):null]})}),Ne(ot,{sx:{display:"none",[yr]:{display:ve?"none":"block",mt:1.5,mb:0}},children:[H(ta,{sx:{borderColor:ee}}),H(Ub,{onClick:()=>eo(N=>!N),sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:.5,pt:1.25,pb:1.25,fontSize:13.5,bgcolor:"#f4f4f2",color:"#37352f","&:active":{opacity:.6}},children:wt?Ne(Bt,{children:[n("detail.collapse")," ",H(KP,{sx:{fontSize:18}})]}):Ne(Bt,{children:[n("detail.moreInfo")," ",H(UP,{sx:{fontSize:18}})]})})]})]}),H(Jb,{store:t.leading}),Ne(ot,{children:[H(ta,{sx:{my:1.5,borderColor:ee,[yr]:{mt:0,mb:1.25}}}),H(qo,{icon:H(tO,{sx:{fontSize:18,display:"block"}}),title:n("common.content"),titleExtra:Ne(Bt,{children:[H(Jb,{store:t.titleExtra}),H(Cc,{content:o.content??"",templates:D??[],onApply:N=>_?.(o.seq,N),onSave:F,onRemove:R,readOnly:uo||!D}),Ln&&!uo?H($P,{title:n("section.finishEditingTooltip"),arrow:!0,children:H(WP,{size:"small","aria-label":n("section.finishEditing"),onMouseDown:N=>N.preventDefault(),onClick:()=>Oe(!1),sx:{color:"#2f9e5b"},children:H(VP,{sx:{fontSize:19}})})}):null]}),children:H(ot,{sx:{userSelect:"text"},children:C?H(ot,{sx:{minHeight:180,display:"flex",alignItems:"center",justifyContent:"center"},children:H(Vc,{})}):H(kc,{syncKey:o.seq,value:o.content??"",readOnly:uo,viewFirst:!0,editing:Ln,onEditingChange:Oe,onTranslate:da?qn.openDialog:void 0,onChange:N=>_(o.seq,N)})})}),o.is_bug||$a?null:Ne(Bt,{children:[H(ta,{sx:{my:1.5,borderColor:ee}}),H(qo,{icon:H(oO,{sx:{fontSize:18,display:"block"}}),title:n("col.note"),children:H(ot,{sx:{userSelect:"text"},children:H(mr,{name:"note",children:H($o,{form:dt,name:"note",children:N=>H(Fb,{value:N,readOnly:Ha,onCommit:Xe=>z(o.seq,Xe),onDraftChange:k?Xe=>k(o.seq,Xe):void 0})})})})})]}),Yt&&rr&&!Ve&&!zt&&!$a?Ne(Bt,{children:[H(ta,{sx:{my:1.5,borderColor:ee}}),H(Hb,{form:dt,participants:Lm(o),readOnly:Tn,avatarSrcByName:i,onSave:N=>rr(o.seq,N)})]}):null,Ve||$a?null:Ne(Bt,{children:[H(ta,{sx:{my:1.5,borderColor:ee}}),H(Zb,{store:t.pool,children:N=>H(Bc,{taskSeq:o.seq,checklist:o.checklist??[],removeLocked:Ha,onAdd:y,onToggle:I,confirmOnToggle:!0,onRemove:S,onUpdate:M,onReorder:w,onConvertToTask:q,onOpenLinkedTask:v,resolveLinkedTask:j,myAccountSeq:W,linkCandidates:N,linkBaseTask:o,onLinkExistingTask:O})})]}),H(Zb,{store:t.pool,children:N=>N&&!$a&&!Ve&&!zt&&(!Tn||$b(o,N))?Ne(Bt,{children:[H(ta,{sx:{my:1.5,borderColor:ee}}),H(Kb,{task:o,tasks:N,readOnly:Tn,onOpenTask:V,onLink:Z,onUnlink:ie,onCreateFollowUp:ue})]}):null}),H(ta,{sx:{my:1.5,borderColor:ee}}),H(wc,{taskSeq:o.seq,attachments:o.attachments??[],removeLocked:zt?Ha:uo,onAdd:K,onRemove:te,onReorder:$,onPreview:G?(N,Xe)=>G({...N,taskSeq:o.seq},Xe?.map(zn=>({...zn,taskSeq:o.seq}))):void 0,onDownload:ae?N=>ae({...N,taskSeq:o.seq}):void 0})]}),H(ta,{sx:{my:1.5,borderColor:ee}}),H(wb,{taskSeq:o.seq,comments:o.comments??[],currentUserName:Q,myAccountSeq:W,avatarSrcByName:i,onUpdate:Re,onRemove:mt,onToggleReaction:ce,onPreview:G?(N,Xe)=>G({...N,taskSeq:o.seq},Xe?.map(zn=>({...zn,taskSeq:o.seq}))):void 0,onDownload:ae?N=>ae({...N,taskSeq:o.seq}):void 0})]}),da?H($o,{form:dt,name:"title",children:N=>H(Nb,{controller:qn,title:N,html:o.content??""})}):null,H(ap,{transitionDuration:0,anchorEl:ir,open:!!ir,onClose:()=>lr(null),children:[{value:"",label:n("common.none")},...Zi].map(N=>H(ip,{selected:(o.repeat_rule??"")===N.value,onClick:()=>{lr(null),ru(Po(),N.value,h)},sx:{fontSize:14,minWidth:140},children:N.label},N.value||"none"))}),H(lO,{anchorEl:zr,open:!!zr,onClose:()=>sr(null),selectedDate:o.repeat_until?new Date(`${o.repeat_until}T00:00:00`):new Date,onDateChange:N=>{sr(null),au(Po(),N,h)}}),H(ap,{transitionDuration:0,anchorEl:Xt,open:!!Xt,onClose:()=>ar(null),children:[{key:"involved",label:n("create.visibilityPrivate"),icon:H(Yb,{sx:{fontSize:17,color:"#57564f"}}),selected:sn(o)==="involved",onPick:()=>x?.(o.seq,"involved",0)},{key:"all",label:n("create.visibilityPublic"),icon:H(Xb,{sx:{fontSize:17,color:"#2f80ed"}}),selected:sn(o)==="all",onPick:()=>x?.(o.seq,"all",0)},...E.map(N=>({key:`group-${N.seq}`,label:n("create.visibilityDeptName",{name:N.name}),icon:H(Qb,{sx:{fontSize:17,color:"#d9730d"}}),selected:sn(o)==="group"&&(o.visibility_group_seq??0)===N.seq,onPick:()=>x?.(o.seq,"group",N.seq)}))].map(N=>Ne(ip,{selected:N.selected,onClick:()=>{N.onPick(),ar(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[N.icon,N.label,N.selected?H(Gb,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},N.key))}),H(ap,{transitionDuration:0,anchorEl:Ai,open:!!Ai,onClose:()=>Fe(null),children:[{seq:0,label:n("board.unassigned")},...tn.filter(N=>`custom-${N.group_seq}`===String(dt.getFormValue("tab_key")??"")).map(N=>({seq:N.seq,label:cn(N)}))].map(N=>Ne(ip,{onClick:()=>{or?.(o.seq,N.seq),Fe(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[N.label,Number(dt.getFormValue("sprint_seq")??0)===N.seq?H(Gb,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},N.seq))}),H(Js,{anchorEl:Ye?.anchorEl??null,open:!!Ye?.open,acks:o.acks??[],total:to?.total??oo?.total??0,pendingNames:to?.pendingNames??oo?.pendingNames??[],avatarSrcByName:i,onRequestConfirm:Ze&&(to?to.count<to.total:oo&&oo.count<oo.total)?()=>{Ze(o.seq),at(N=>N?{...N,open:!1}:null)}:void 0,onClose:()=>at(N=>N?{...N,open:!1}:null)}),H(Kr,{anchorEl:P,value:o.icon??"",color:o.icon_color??"",onSelect:N=>{co(o.seq,N),me(null)},onSelectColor:kt?N=>kt(o.seq,N):void 0,onClose:()=>me(null)}),H(iO,{open:!!Nr,anchorEl:Nr,title:Wo?n("table.claimTakeOverConfirm"):n("table.claimConfirm"),confirmText:n("col.claim"),onCancel:()=>Ho(null),onConfirm:()=>{Kt?.(o.seq),Ho(null)}})]})},dO);import{ConfirmActionPopper as _O}from"@ehfuse/mui-confirm-action";import{Fragment as ah,jsx as nt,jsxs as Si}from"react/jsx-runtime";function rZ(){let e=new Date,t=o=>String(o).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}`}function aZ({open:e,task:t,onClose:o,onAddComment:a,onSaveFields:r,presentation:i="auto",myAccountSeq:l=0,onToggleCompleted:s,onChangeTitle:c,onChangeIcon:u,onChangeIconColor:m,activityItems:d,activityLoading:p,onLoadActivity:f,onPrint:g,headerExtra:x,onDelete:h,canDelete:E,...b}){L();let B=$e(),{form:T,baseTask:z,task:k,hasPendingChanges:_,stagedBodyProps:D,changeTitle:F,changeIcon:R,changeIconColor:C}=iu({open:e,task:t,isMobile:B,bodyProps:b,onSaveFields:r,onChangeTitle:c,onChangeIcon:u,onChangeIconColor:m}),y=Pl({taskSeq:k?.seq??0,items:d,loading:p,onLoad:f}),[I,S]=nh(null),[M,w]=nh(null),{editPolicy:q,shareText:v}=se(),O=!!h&&(E??(z?!ka(z,l,q,!(l>0&&(z.author_account_seq??0)===l)):!1)),j=oh(null);th(()=>{j.current?.scrollTo({top:0})},[t?.seq]);let V=()=>{let G=j.current?.getScrollContainer();if(G){j.current?.scrollTo({top:G.scrollHeight,behavior:"smooth"});return}let ae=document.querySelectorAll(".taskbox-comments");ae[ae.length-1]?.scrollIntoView({block:"end",behavior:"smooth"})},Z=oh(!1),ie=k?.comments?.length??0;if(th(()=>{Z.current&&(Z.current=!1,requestAnimationFrame(V))},[ie]),!z||!k)return null;let ue=k,K=B||i==="dialog",te=nt(eh,{...D,headerless:K,task:ue,myAccountSeq:l,onChangeTitle:F,onToggleCompleted:s,onChangeIcon:R,onChangeIconColor:C,showTitle:B||i==="dialog"}),$=nt(Db,{onSubmit:(G,ae)=>{Z.current=!0,a(ue.seq,G,ae),requestAnimationFrame(V)}},ue.seq);return K?Si(ah,{children:[nt(BO,{open:e,onClose:o,backdropClick:!_,locale:Se(),collapsibleTitle:!0,fontScale:{enabled:!0,default:1.1,min:.6},title:b.postMode?n("detail.kindPost"):ue.is_notice?n("tab.notice"):ue.is_event?n("kind.event"):ue.is_bug?n("kind.bug"):n("kind.task"),titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1},custom:[...x?[{raw:!0,icon:nt(ah,{children:x(ue)})}]:[],...B?[{raw:!0,icon:nt(xO,{variant:"contained",size:"small",disableElevation:!0,disabled:!_,onClick:_?()=>{T.submit()}:void 0,sx:{ml:1.5,height:32,minWidth:64,px:1.75,py:0,borderRadius:1,fontSize:14,fontWeight:600,bgcolor:"#2f80ed","&:hover":{bgcolor:"#2f80ed"},"&.Mui-disabled":{bgcolor:"#f2f2f0",color:"#c9c8c5"}},children:n("create.saveButton")})}]:[],{raw:!0,icon:nt(hO,{size:"small","aria-label":n("common.more"),onClick:G=>S(G.currentTarget),children:nt(TO,{sx:{color:"#6b7280"}})})}]},fullScreen:B,maxWidth:B?void 0:"md",width:B?void 0:720,mobilePresentation:B?"slide":void 0,tabs:{visible:!1},contentTopPadding:0,contentPaddingX:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,contentBottomPadding:0,scrollPastLastSection:!1,overlayScrollbar:{enabled:!0,contentStyle:{minWidth:0}},actions:{visible:!0,showCancelButton:!1,left:$},sx:{DialogContent:{borderBottom:"none"}},dialogActionSx:{padding:"0 !important","@media (max-width:1023.95px)":{padding:"0 !important"},borderTop:"1px solid #37352f","& .left-actions":{flex:1,width:"100%",minWidth:0,"& > *":{flex:1,minWidth:0}},"& .right-actions":{display:"none"}},sections:[{id:"task-detail",title:"",showTitle:!1,children:nt(jc,{sx:{userSelect:"none",width:"100%",minWidth:0,display:"flex",flexDirection:"column",gap:0},children:te})}]},z.seq),Si(kO,{open:!!I,anchorEl:I,onClose:()=>S(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{zIndex:1500},children:[f?Si(dp,{onClick:()=>{S(null),y.openDialog()},children:[nt(mp,{children:nt(SO,{fontSize:"small"})}),nt(up,{children:n("activity.title")})]}):null,Si(dp,{onClick:()=>{S(null),ki(ue,!0,v)},children:[nt(mp,{children:nt(CO,{fontSize:"small"})}),nt(up,{children:n("detail.share")})]}),O?Si(dp,{onClick:G=>{let ae=I??G.currentTarget;S(null),w(ae)},sx:{color:"#e5484d"},children:[nt(mp,{children:nt(yO,{fontSize:"small",sx:{color:"#e5484d"}})}),nt(up,{children:n("common.delete")})]}):null]}),nt(_O,{open:!!M,anchorEl:M,title:n("detail.trashConfirm"),confirmText:n("common.delete"),onCancel:()=>w(null),onConfirm:()=>{w(null),h?.(ue)}}),nt($c,{controller:y})]}):nt(bO,{anchor:"right",open:e,onClose:o,"aria-label":n("detail.taskDetail"),disableAutoFocus:!0,disableEnforceFocus:!0,sx:{zIndex:G=>G.zIndex.modal},slotProps:{paper:{sx:{width:720,maxWidth:"100vw"}}},children:Si(jc,{sx:{display:"flex",flexDirection:"column",height:"100%",userSelect:"none"},children:[nt(Ob,{task:ue,myAccountSeq:l,onToggleCompleted:s,hideCompleted:!!(b.hideProperties||b.postMode),kindLabel:b.postMode?n("detail.kindPost"):void 0,displayTitle:b.displayTitle,onChangeTitle:c,onChangeIcon:u,onChangeIconColor:m,onClose:o,activityItems:d,activityLoading:p,onLoadActivity:f,onPrint:g,onDelete:h,canDelete:E,headerExtra:x}),nt(rh,{sx:{borderColor:ee}}),nt(jc,{sx:{flex:1,minHeight:0},children:nt(vO,{ref:j,style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:te})}),nt(rh,{sx:{borderColor:"#37352f"}}),nt(jc,{sx:{flexShrink:0},children:$})]})})}import{Box as Do,Button as xp,IconButton as mh}from"@mui/material";import{FormDialog as uh}from"@ehfuse/mui-form-dialog";import zO from"@mui/icons-material/Add";import NO from"@mui/icons-material/DirectionsRunOutlined";import FO from"@mui/icons-material/EditOutlined";import{ClearTextField as dh,DateTextField as ph,LabelSelect as fh}from"@ehfuse/mui-form-controls";import{Box as Dr,Button as wO,FormControlLabel as pp,Radio as fp,RadioGroup as DO}from"@mui/material";import{FormDialog as EO}from"@ehfuse/mui-form-dialog";import{LabelSelect as RO}from"@ehfuse/mui-form-controls";import PO from"@ehfuse/overlay-scrollbar";import{useGlobalForm as IO}from"@ehfuse/forma";function ih({open:e,sprint:t,remainingTasks:o,sprints:a,onClose:r,onConfirm:i}){let l=a.filter(m=>m.seq!==t?.seq&&m.group_seq===(t?.group_seq??0)&&m.status!=="closed"),s=o.length>0,c=IO({formId:Ie("taskbox-sprint-close-form"),initialValues:{mode:"backlog",moveToSeq:"0"},onValidate:m=>!(s&&m.mode==="move"&&!(Number(m.moveToSeq)>0)),onSubmit:m=>(i({mode:s?m.mode:"keep",moveToSprintSeq:m.mode==="move"&&Number(m.moveToSeq)||0,taskSeqs:o.map(d=>d.seq)}),!0)}),u={form:ro({modalIdPrefix:"taskbox-sprint-close-dialog",open:e,onClose:r,onOpen:()=>c.setFormValues({mode:l.length>0?"move":"backlog",moveToSeq:String(l[0]?.seq??0)})})};return{form:c,modals:u,candidates:l,hasRemaining:s}}import{Fragment as OO,jsx as Zt,jsxs as Yc}from"react/jsx-runtime";function lh({open:e,sprint:t,remainingTasks:o,sprints:a,onClose:r,onConfirm:i}){L();let{form:l,modals:s,candidates:c,hasRemaining:u}=ih({open:e,sprint:t,remainingTasks:o,sprints:a,onClose:r,onConfirm:i}),m=l.useFormValue("mode")??"backlog",d=Number(l.useFormValue("moveToSeq"))||0;return Zt(EO,{open:s.form.isOpen,onClose:s.form.close,maxWidth:"sm",title:n("sprint.closeTitle"),locale:Se(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-close",tabs:{visible:!1},actions:{showCancelButton:!0,right:Zt(wO,{variant:"contained",onClick:()=>{l.submit()},disabled:u&&m==="move"&&!(d>0),children:n("sprint.closeButton")})},sections:[{id:"sprint-close",title:"",showTitle:!1,children:Yc(Dr,{sx:{display:"flex",flexDirection:"column",gap:2},children:[Zt(Dr,{sx:{fontSize:18,color:"#37352f"},children:nn("sprint.closeIntro",{name:Zt(Dr,{component:"span",sx:{fontWeight:600},children:t?.name??""})})}),u?Yc(OO,{children:[Zt(Dr,{sx:{fontSize:15,color:"#6f6f6c"},children:n("sprint.remainingQuestion",{count:o.length})}),Zt(Dr,{sx:{border:`1px solid ${ee}`,borderRadius:1,overflow:"hidden"},children:Zt(PO,{style:{maxHeight:220},thumb:{width:6},children:o.map(p=>Yc(Dr,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,borderBottom:"1px solid #f2f2f0","&:last-of-type":{borderBottom:"none"}},children:[Zt(Dr,{sx:{flex:1,minWidth:0,fontSize:16,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.title}),Zt(Ke,{option:Ft(p)})]},p.seq))})}),Yc(DO,{value:m,onChange:(p,f)=>l.setFormValue("mode",f),children:[c.length>0?Zt(pp,{value:"move",control:Zt(fp,{size:"small"}),label:n("sprint.carryOver"),sx:{"& .MuiFormControlLabel-label":{fontSize:16}}}):null,m==="move"&&c.length>0?Zt(Dr,{sx:{pl:4,pb:1},children:Zt(RO,{form:l,name:"moveToSeq",size:"small",label:"",fullWidth:!0,options:c.map(p=>({value:String(p.seq),label:p.name}))})}):null,Zt(pp,{value:"backlog",control:Zt(fp,{size:"small"}),label:n("sprint.moveToBacklog"),sx:{"& .MuiFormControlLabel-label":{fontSize:16}}}),Zt(pp,{value:"keep",control:Zt(fp,{size:"small"}),label:n("sprint.keepInGoal"),sx:{"& .MuiFormControlLabel-label":{fontSize:16}}})]})]}):Zt(Dr,{sx:{fontSize:15,color:"#6f6f6c"},children:n("sprint.noRemaining")})]})}]})}var gp="custom-";function MO(e){return e.startsWith(gp)}function CZ(e){return e>0?`${gp}${e}`:""}function Pn(e){if(!MO(e))return 0;let t=Number(e.slice(gp.length));return Number.isInteger(t)&&t>0?t:0}import{useState as LO}from"react";import{useGlobalForm as AO,useModal as qO}from"@ehfuse/forma";import{ErrorAlert as sh}from"@ehfuse/alerts";var Xc={editingSeq:0,name:"",goal:"",start_date:"",end_date:""};function ch({open:e,customTabs:t,onClose:o,onCreate:a,onUpdate:r,onChangeStatus:i,tasks:l=[],onCloseSprint:s,onRemove:c}){L();let u=t.filter(B=>B.useSprints&&!B.archived),[m,d]=LO(null),p=m?l.filter(B=>(B.sprint_seq??0)===m.seq&&!B.completed):[],f=AO({formId:Ie("taskbox-sprint-form"),initialValues:{groupKey:"",...Xc},onValidate:B=>Pn(B.groupKey)?String(B.name??"").trim()?!0:(sh(n("sprint.enterGoalName")),!1):(sh(n("sprint.selectProject")),!1),onSubmit:async B=>{let T={name:String(B.name).trim(),goal:String(B.goal??"").trim(),start_date:B.start_date??"",end_date:B.end_date??""};if(B.editingSeq>0)return r(B.editingSeq,T),g.form.close(),!0;let z=await a({group_seq:Pn(B.groupKey),...T});return z&&g.form.close(),z}}),g={manage:ro({modalIdPrefix:"taskbox-sprint-manage-dialog",open:e,onClose:o,onOpen:()=>f.setFormValues({groupKey:u.length===1?u[0].key:"",...Xc})}),form:qO({modalId:Ie("taskbox-sprint-form-dialog"),onClose:()=>f.setFormValues(Xc)})};return{form:f,modals:g,sprintTabs:u,closingSprint:m,remainingTasks:p,openCreateForm:()=>{f.setFormValues(Xc),g.form.open()},openEditForm:B=>{f.setFormValues({editingSeq:B.seq,groupKey:`custom-${B.group_seq}`,name:B.name,goal:B.goal,start_date:B.start_date,end_date:B.end_date}),g.form.open()},changeStatus:(B,T)=>{if(T==="closed"&&s){d(B);return}i(B.seq,T)},cancelCloseSprint:()=>d(null),confirmCloseSprint:B=>{m&&s?.(m.seq,B),d(null)},removeSprint:c}}import{Fragment as xh,jsx as Je,jsxs as na}from"react/jsx-runtime";var HO=[{value:"planning",get label(){return n("status.planning")}},{value:"active",get label(){return n("status.active")}},{value:"closed",get label(){return n("status.closed")}}];function gh(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?e.slice(5).replace("-","."):"-"}function WZ({open:e,customTabs:t,sprints:o,onClose:a,onCreate:r,onUpdate:i,onChangeStatus:l,tasks:s=[],onCloseSprint:c,onRemove:u}){L();let m=ch({open:e,customTabs:t,onClose:a,onCreate:r,onUpdate:i,onChangeStatus:l,tasks:s,onCloseSprint:c,onRemove:u}),{form:d,modals:p,sprintTabs:f,closingSprint:g,remainingTasks:x}=m,h=Number(d.useFormValue("editingSeq"))||0,E=d.isSubmitting,b=new Map(t.map(T=>[Pn(T.key),T.label])),B=Je(Do,{children:f.length===0?Je(Do,{sx:{py:2,fontSize:14,color:"#787774"},children:n("sprint.noSprintProjects")}):Je(xh,{children:Je(Do,{children:o.length===0?na(Do,{sx:{py:4,display:"flex",flexDirection:"column",alignItems:"center",gap:2,color:"#9a9a97"},children:[Je(NO,{sx:{fontSize:48,color:"#d9d9d6"}}),Je(Do,{sx:{fontSize:13.5},children:n("sprint.noGoals")})]}):o.map(T=>na(Do,{sx:{display:"flex",flexDirection:"column",gap:1,"&:not(:last-of-type)::after":{content:'""',display:"block",my:1.75,borderBottom:"1px solid #f0efed"}},children:[na(Do,{sx:{minWidth:0},children:[na(Do,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[Je(Do,{component:"span",sx:{fontSize:18,fontWeight:600,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:T.name}),Je(Do,{component:"span",sx:{flexShrink:0,px:1,py:.25,borderRadius:.75,bgcolor:"#f1f5f9",color:"#64748b",fontSize:13,fontWeight:500},children:b.get(T.group_seq)??n("sprint.deletedProject")}),na(Do,{component:"span",sx:{flexShrink:0,fontSize:14,color:"#57564f"},children:[gh(T.start_date)," ~"," ",gh(T.end_date)]})]}),T.goal?Je(Do,{sx:{mt:.5,fontSize:14,color:"#787774",lineHeight:1.5},children:T.goal}):null]}),na(Do,{sx:{display:"flex",alignItems:"center",gap:.5},children:[Je(fh,{label:n("col.status"),showLabel:!1,size:"small",value:T.status,options:HO.map(z=>({value:z.value,label:z.label})),onChange:z=>m.changeStatus(T,String(z.target.value)),sx:{width:104,flexShrink:0}}),Je(mh,{"aria-label":n("board.editGoal"),onClick:()=>m.openEditForm(T),sx:{color:"#9a9a97","&:hover":{color:"#2563eb"}},children:Je(FO,{sx:{fontSize:18}})}),Je(mh,{"aria-label":n("board.deleteGoal"),onClick:()=>m.removeSprint(T.seq),sx:{color:"#9a9a97","&:hover":{color:"#e5484d"}},children:Je(Qt,{style:{width:16,height:16}})})]})]},T.seq))})})});return na(xh,{children:[Je(uh,{open:p.manage.isOpen,onClose:p.manage.close,maxWidth:"sm",title:n("sprint.manageTitle"),locale:Se(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-manage",sections:[{id:"sprint-manage",showTitle:!1,children:B}],sectionContentPaddingTop:0,actions:{showCancelButton:!0,left:f.length>0?Je(xp,{startIcon:Je(zO,{}),onClick:m.openCreateForm,sx:{color:"#2563eb"},children:n("sprint.newGoal")}):void 0,right:Je(xp,{variant:"contained",onClick:p.manage.close,children:n("common.confirm")})}}),Je(lh,{open:g!==null,sprint:g,remainingTasks:x,sprints:o,onClose:m.cancelCloseSprint,onConfirm:m.confirmCloseSprint}),Je(uh,{open:p.form.isOpen,onClose:p.form.close,maxWidth:"sm",title:h>0?n("board.editGoal"):n("sprint.newGoal"),locale:Se(),backdropClick:!1,tabs:{visible:!1},titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-form",sections:[{id:"sprint-form",title:"",showTitle:!1,children:Je(Do,{sx:{pt:1},children:na(Do,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:2.5,mt:1},children:[Je(fh,{form:d,name:"groupKey",label:n("col.project"),size:"medium",options:f.map(T=>({value:T.key,label:T.label})),disabled:h>0}),Je(dh,{form:d,name:"name",label:n("sprint.goalName"),size:"medium",placeholder:n("sprint.goalNamePlaceholder")}),Je(ph,{form:d,name:"start_date",size:"medium",label:n("calendar.startDate")}),Je(ph,{form:d,name:"end_date",size:"medium",label:n("calendar.endDate")}),Je(dh,{form:d,name:"goal",label:n("googleEvent.description"),size:"medium",placeholder:n("sprint.optional"),sx:{gridColumn:"1 / -1"}})]})})}],actions:{showCancelButton:!0,right:Je(xp,{variant:"contained",onClick:()=>{d.submit()},disabled:E,children:h>0?n("common.edit"):n("sprint.createGoal")})}})]})}import{Box as Rt,Button as Jc,FormControlLabel as hh,Switch as kh}from"@mui/material";import{FormDialog as GO}from"@ehfuse/mui-form-dialog";import jO from"@mui/icons-material/LinkOutlined";import YO from"@mui/icons-material/LinkOffOutlined";import XO from"@mui/icons-material/SyncOutlined";import QO from"@mui/icons-material/ArrowForward";import{useRef as UO}from"react";import{useCallback as WO,useEffect as $O,useRef as Ll}from"react";import{useModal as VO}from"@ehfuse/forma";var Qc=[];function KO(){let e=Qc;if(Qc=[],e.length!==0){if(e.length===1){e[0].close();return}for(let t of e)window.dispatchEvent(new CustomEvent(`modal:close:${t.modalId}`));window.addEventListener("popstate",t=>t.stopImmediatePropagation(),{capture:!0,once:!0}),window.history.go(-e.length)}}function pn({modalId:e,open:t,onClose:o,onOpen:a}){let r=Ll(a);r.current=a;let i=Ll(o);i.current=o;let l=Ll(t);l.current=t;let s=Ll(!1),c=VO({modalId:e,onClose:()=>{s.current=!1,l.current&&i.current()}}),u=Ll(c);u.current=c;let m=WO(()=>{s.current||!u.current.isOpen||(s.current=!0,u.current.close())},[]);return $O(()=>{if(t){r.current?.(),u.current.open();return}!u.current.isOpen||s.current||(s.current=!0,Qc.push({modalId:u.current.modalId,close:()=>u.current.close()}),Qc.length===1&&queueMicrotask(KO))},[t]),{...c,close:m}}function bh(e){let t=UO(e);t.current=e;let o={link:pn({modalId:Ie("taskbox-calendar-link"),open:e.open,onClose:()=>t.current.onClose()})},{status:a}=e.googleApi,{calendarName:r}=se(),i=a.linked&&a.calendar_name||r||"\uC5C5\uBB34\uD568",l={connect:()=>t.current.googleApi.onConnect(),disconnect:()=>t.current.googleApi.onDisconnect(),toggleExport:s=>t.current.googleApi.onToggleExport(s),toggleImport:s=>t.current.googleApi.onToggleImport(s),resync:()=>t.current.googleApi.onResync?.()};return{modals:o,status:a,busy:!!e.googleApi.busy,canResync:!!e.googleApi.onResync,calendarName:i,actions:l}}import{Fragment as ZO,jsx as Me,jsxs as Jn}from"react/jsx-runtime";function Th({from:e,to:t}){return Jn(Rt,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[e,Me(QO,{sx:{fontSize:16,color:"#787774"}}),t]})}function JO({size:e=28}){return Jn(Rt,{component:"svg",viewBox:"0 0 48 48","aria-hidden":!0,sx:{width:e,height:e,flexShrink:0,mx:1},children:[Me("path",{fill:"#EA4335",d:"M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"}),Me("path",{fill:"#4285F4",d:"M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"}),Me("path",{fill:"#FBBC05",d:"M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"}),Me("path",{fill:"#34A853",d:"M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"})]})}function see(e){L();let t=bh(e),{status:o,busy:a,calendarName:r,actions:i}=t,l=t.modals.link,s=Jn(Rt,{sx:{display:"flex",flexDirection:"column",gap:"24px"},children:[Jn(Rt,{sx:{bgcolor:"#f2f6fa",borderRadius:1,px:1.5,py:1.25,fontSize:15,lineHeight:1.8,color:"#37352f",display:"flex",flexDirection:"column",gap:.25,"& > div":{display:"flex",gap:1},"& > div::before":{content:'"\u2022"',flexShrink:0}},children:[Me(Rt,{children:Me(Rt,{component:"span",children:nn("calendarLink.exportDesc",{exportWord:Me("b",{children:n("calendarLink.export")}),calendar:Jn("b",{children:['"',r,'"']})})})}),Me(Rt,{children:Me(Rt,{component:"span",children:nn("calendarLink.importDesc",{importWord:Me("b",{children:n("calendarLink.import")})})})}),Me(Rt,{children:Me(Rt,{component:"span",children:n("calendarLink.editInTaskbox",{calendarName:r})})})]}),o.configured?Jn(Rt,{sx:{border:`1px solid ${ee}`,borderRadius:1,pl:2,pr:3,py:1.75,display:"flex",flexDirection:"column",gap:1.25},children:[Jn(Rt,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[Me(JO,{}),Jn(Rt,{sx:{flex:1,minWidth:0},children:[Me(Rt,{sx:{fontSize:18,color:"#111",fontWeight:700},children:n("calendarLink.connectGoogle")}),Me(Rt,{sx:{fontSize:15,color:"#111",mt:.5,lineHeight:1.6},children:o.linked?Jn(ZO,{children:[Me(Rt,{component:"span",sx:{display:"block",fontWeight:600},children:n("calendarLink.connectedTo",{email:o.google_email||n("calendarLink.googleAccount")})}),Me(Rt,{component:"span",sx:{display:"block"},children:n("calendarLink.calendarCreated",{calendarName:r})})]}):n("calendarLink.connectHint",{calendarName:r})}),o.last_error?Me(Rt,{sx:{fontSize:13,color:"#c62828",mt:.5},children:n("calendarLink.lastError",{error:o.last_error})}):null]}),o.linked?Me(Jc,{size:"small",variant:"outlined",color:"inherit",disabled:a,startIcon:Me(YO,{sx:{fontSize:18}}),onClick:i.disconnect,sx:{flexShrink:0,whiteSpace:"nowrap",ml:2},children:n("calendarLink.disconnect")}):Me(Jc,{size:"small",variant:"contained",disableElevation:!0,disabled:a,startIcon:Me(jO,{sx:{fontSize:18}}),onClick:i.connect,sx:{flexShrink:0,whiteSpace:"nowrap",bgcolor:"#2563eb",ml:2},children:n("calendarLink.connect")})]}),o.linked?Jn(Rt,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap",pl:4.5},children:[Me(hh,{control:Me(kh,{size:"small",checked:o.export_enabled,disabled:a,onChange:(c,u)=>i.toggleExport(u)}),label:Me(Rt,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:nn("calendarLink.withDirection",{direction:Me(Th,{from:n("calendarLink.taskbox"),to:n("calendarLink.google")})},{label:n("calendarLink.export")})}),sx:{m:0,"& .MuiFormControlLabel-label":{fontSize:14,color:"#37352f"}}}),Me(hh,{control:Me(kh,{size:"small",checked:o.import_enabled,disabled:a,onChange:(c,u)=>i.toggleImport(u)}),label:Me(Rt,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:nn("calendarLink.withDirection",{direction:Me(Th,{from:n("calendarLink.google"),to:n("calendarLink.taskbox")})},{label:n("calendarLink.import")})}),sx:{m:0,"& .MuiFormControlLabel-label":{fontSize:14,color:"#37352f"}}}),t.canResync?Me(Jc,{size:"small",color:"inherit",disabled:a||!o.export_enabled,startIcon:Me(XO,{sx:{fontSize:18}}),onClick:i.resync,sx:{ml:"auto",whiteSpace:"nowrap"},children:n("calendarLink.reexportAll")}):null]}):null]}):Me(Rt,{sx:{fontSize:14,color:"#8a6d1d",lineHeight:1.7},children:n("calendarLink.notConfigured")})]});return Me(GO,{open:l.isOpen,onClose:l.close,width:680,title:n("calendarLink.title"),locale:Se(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-calendar-link",sectionContentPaddingTop:0,sections:[{id:"calendar-link",showTitle:!1,children:s}],actions:{showCancelButton:!1,right:Me(Jc,{variant:"contained",onClick:l.close,sx:{minWidth:80},children:n("common.close")})}})}import{useTimePickerVariant as nM}from"@ehfuse/mui-form-controls";import{useState as em}from"react";import rM from"@mui/icons-material/OpenInNewOutlined";import{Box as ra,Button as bp,ButtonBase as aM,FormControlLabel as iM,Switch as lM}from"@mui/material";import{FormDialog as sM}from"@ehfuse/mui-form-dialog";import{ClearTextField as hp}from"@ehfuse/mui-form-controls";import{DatePicker as vh,TimePicker as Bh}from"@ehfuse/mui-datetime-picker";import _h from"@mui/icons-material/CalendarMonthOutlined";import Ih from"@mui/icons-material/AccessTimeOutlined";import{useEffect as eM,useRef as Zc}from"react";import{useGlobalForm as tM}from"@ehfuse/forma";import{ErrorAlert as yh}from"@ehfuse/alerts";var oM={title:"",allDay:!0,startDate:"",endDate:"",startTime:"09:00",endTime:"10:00",location:"",description:""};function Ch(e,t){let[o,a]=e.split(":").map(Number),r=((o*60+a+t)%1440+1440)%1440,i=l=>String(l).padStart(2,"0");return`${i(Math.floor(r/60))}:${i(r%60)}`}function Sh(e){L();let t=Zc(e);t.current=e;let o=Zc(null);e.event&&(o.current=e.event);let a=e.event??o.current,r=a?.editable===!1,i=Zc(r);i.current=r;let l=Zc(!!e.onDelete);e.open&&(l.current=!!e.onDelete);let s=tM({formId:Ie("taskbox-google-event-form"),initialValues:oM,onValidate:m=>t.current.busy||i.current?!1:m.title.trim()?m.startDate?!0:(yh(n("googleEvent.selectStartDate")),!1):(yh(n("googleEvent.enterTitle")),!1),onSubmit:m=>{let d=m.endDate&&m.endDate>=m.startDate?m.endDate:m.startDate;return t.current.onSave({title:m.title.trim(),start_date:m.startDate,end_date:d,time:m.allDay?"":m.startTime,end_time:m.allDay?"":m.endTime,location:m.location.trim(),description:m.description.trim()}),!0}}),c={event:pn({modalId:Ie("taskbox-google-event"),open:e.open,onClose:()=>t.current.onClose()})};eM(()=>{let m=e.event;if(!e.open||!m)return;let d=!!m.time;s.setFormValues({title:m.title==="(\uC81C\uBAA9 \uC5C6\uC74C)"?"":m.title,allDay:!d,startDate:m.start_date,endDate:m.end_date||m.start_date,startTime:d?m.time:"09:00",endTime:d?m.end_time||Ch(m.time,60):"10:00",location:m.location??"",description:m.description??""})},[e.open,e.event]);let u={changeStartDate:m=>{let d=String(s.getFormValue("endDate")??"");s.setFormValue("startDate",m),(!d||d<m)&&s.setFormValue("endDate",m)},changeEndDate:m=>s.setFormValue("endDate",m),changeStartTime:m=>{let d=s.getFormValues();s.setFormValue("startTime",m),d.startDate===d.endDate&&d.endTime<=m&&s.setFormValue("endTime",Ch(m,60))},changeEndTime:m=>s.setFormValue("endTime",m),changeAllDay:m=>s.setFormValue("allDay",m),remove:()=>t.current.onDelete?.()};return{form:s,modals:c,event:a,readOnly:r,busy:!!e.busy,canDelete:l.current,actions:u}}import{jsx as ct,jsxs as vi}from"react/jsx-runtime";function wh(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return e||n("googleEvent.pickDate");let[t,o,a]=e.split("-").map(Number),r=Hr(new Date(t,o-1,a).getDay());return`${t}.${String(o).padStart(2,"0")}.${String(a).padStart(2,"0")} (${r})`}function kp(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?new Date(`${e}T00:00:00`):new Date}function Dh(e){let t=o=>String(o).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function Eh(e){let t=/^(\d{2}):(\d{2})$/.exec(e);return t?{hour:t[1],minute:t[2]}:{hour:"09",minute:"00"}}function cM(e){switch(e){case"fromGmail":return n("googleEvent.typeFromGmail");case"birthday":return n("googleEvent.typeBirthday");case"outOfOffice":return n("googleEvent.typeOutOfOffice");case"focusTime":return n("googleEvent.typeFocusTime");case"workingLocation":return n("googleEvent.typeWorkingLocation");default:return n("googleEvent.typeThis")}}function mM(e){let[t,o,a]=e.split("-").map(Number);window.open(`https://calendar.google.com/calendar/r/day/${t}/${o}/${a}`,"_blank")}function tm({icon:e,label:t,placeholder:o,disabled:a,onClick:r}){return vi(aM,{disabled:a,onClick:i=>r(i.currentTarget),sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.9,borderRadius:1,border:"1px solid #d9d9d6",bgcolor:a?"#f7f7f5":"#fff",color:t?"#37352f":"#9b9a97",fontSize:15,fontWeight:500,minWidth:0,whiteSpace:"nowrap","&:hover":{bgcolor:"#f7f7f5"},"&.Mui-disabled":{color:"#b9b8b4"}},children:[e,t||o]})}function Eee(e){L();let t=$e(),o=Sh(e),a=nM(void 0),{form:r,event:i,readOnly:l,busy:s,actions:c}=o,u=o.modals.event,m=!!r.useValue("allDay"),d=String(r.useValue("startDate")??""),p=String(r.useValue("endDate")??""),f=String(r.useValue("startTime")??""),g=String(r.useValue("endTime")??""),[x,h]=em(null),[E,b]=em(null),[B,T]=em(null),[z,k]=em(null),_=i?vi(ra,{sx:{display:"flex",flexDirection:"column",gap:2.25,pt:.5},children:[ct(ra,{sx:{bgcolor:l?"#fff4e5":"#f2f6fa",borderRadius:1,px:1.5,py:1,fontSize:14.5,lineHeight:1.7,color:"#37352f"},children:l?n("googleEvent.readOnly",{value:cM(i.event_type)}):n(i.recurring?"googleEvent.editableRecurring":"googleEvent.editable",{calendar:i.calendar||n("calendar.googleCalendar")})}),ct(hp,{label:n("common.title"),name:"title",form:r,disabled:l,onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),r.submit())},fullWidth:!0,autoFocus:!t&&!l}),ct(iM,{control:ct(lM,{checked:m,disabled:l,onChange:(D,F)=>c.changeAllDay(F),size:"small"}),label:n("googleEvent.allDay"),sx:{ml:0,"& .MuiFormControlLabel-label":{fontSize:15,color:"#37352f"}}}),vi(ra,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[vi(ra,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[ct(ra,{sx:{width:44,fontSize:14.5,color:"#57564f",flexShrink:0},children:n("googleEvent.start")}),ct(tm,{icon:ct(_h,{sx:{fontSize:18,color:"#787774"}}),label:wh(d),placeholder:n("googleEvent.pickDate"),disabled:l,onClick:h}),m?null:ct(tm,{icon:ct(Ih,{sx:{fontSize:18,color:"#787774"}}),label:f,placeholder:n("googleEvent.time"),disabled:l,onClick:T})]}),vi(ra,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[ct(ra,{sx:{width:44,fontSize:14.5,color:"#57564f",flexShrink:0},children:n("googleEvent.end")}),ct(tm,{icon:ct(_h,{sx:{fontSize:18,color:"#787774"}}),label:wh(p),placeholder:n("googleEvent.pickDate"),disabled:l,onClick:b}),m?null:ct(tm,{icon:ct(Ih,{sx:{fontSize:18,color:"#787774"}}),label:g,placeholder:n("googleEvent.time"),disabled:l,onClick:k})]})]}),ct(hp,{label:n("googleEvent.location"),name:"location",form:r,disabled:l,fullWidth:!0}),ct(hp,{label:n("googleEvent.description"),name:"description",form:r,disabled:l,fullWidth:!0,multiline:!0,minRows:3,maxRows:8}),ct(vh,{anchorEl:x,open:!!x,onClose:()=>h(null),selectedDate:kp(d),onDateChange:D=>{c.changeStartDate(Dh(D)),h(null)},centered:t,locale:Nn()}),ct(vh,{anchorEl:E,open:!!E,onClose:()=>b(null),selectedDate:kp(p||d),minDate:d?kp(d):void 0,onDateChange:D=>{c.changeEndDate(Dh(D)),b(null)},centered:t,locale:Nn()}),ct(Bh,{timeVariant:a,anchorEl:B,open:!!B,onClose:()=>T(null),value:Eh(f),format:"HH:mm",minuteStep:5,autoApply:!0,centered:t,locale:Nn(),onChange:(D,F)=>{c.changeStartTime(`${D}:${F}`),T(null)}}),ct(Bh,{timeVariant:a,anchorEl:z,open:!!z,onClose:()=>k(null),value:Eh(g),format:"HH:mm",minuteStep:5,autoApply:!0,centered:t,locale:Nn(),onChange:(D,F)=>{c.changeEndTime(`${D}:${F}`),k(null)}})]}):null;return ct(sM,{open:u.isOpen,onClose:u.close,width:520,title:n("googleEvent.title"),locale:Se(),tabs:{visible:!1},titleIcons:{delete:{visible:!l&&o.canDelete,confirmConfig:{title:i?.recurring?n("googleEvent.deleteOccurrenceConfirm"):n("googleEvent.deleteConfirm"),confirmText:n("common.delete")}}},onDelete:c.remove,fontScale:{enabled:!0},fontScaleKey:"taskbox-google-event",sectionContentPaddingTop:0,sections:[{id:"google-event",showTitle:!1,children:_}],actions:{showCancelButton:!l,right:l?vi(ra,{sx:{display:"flex",gap:"1rem",alignItems:"center"},children:[ct(bp,{variant:"outlined",startIcon:ct(rM,{}),onClick:()=>i&&mM(i.start_date),children:n("googleEvent.openInGoogle")}),ct(bp,{variant:"contained",onClick:u.close,sx:{minWidth:72},children:n("common.close")})]}):ct(bp,{variant:"contained",onClick:()=>{r.submit()},disabled:s,children:n("common.save")})}})}import{useMemo as Oh,useState as gM}from"react";import{Box as Al,Button as xM,Typography as bM}from"@mui/material";import{FormDialog as hM}from"@ehfuse/mui-form-dialog";import{SearchTextField as kM}from"@ehfuse/mui-form-controls";import{TreeView as TM}from"@ehfuse/tree-view";import{useMemo as uM,useRef as Rh}from"react";import{useFormaState as dM,useGlobalForm as pM}from"@ehfuse/forma";function fM(e){let t=[],o=a=>{for(let r of a.employees??[])t.push(r);for(let r of a.groups??[])o(r)};for(let a of e)o(a);return t}function Ph(e){let t=Rh(e);t.current=e;let o=uM(()=>fM(e.groups),[e.groups]),a=Rh(o);a.current=o;let r=dM({openCount:0}),i=pM({formId:Ie("taskbox-employee-select-form"),initialValues:{selectedSeqs:[]},onSubmit:c=>{let u=a.current.filter(m=>c.selectedSeqs.includes(m.seq));return t.current.onConfirm(t.current.multiple?u:u.slice(0,1)),t.current.onClose(),!0}}),l={select:pn({modalId:Ie("taskbox-employee-select"),open:e.open,onClose:()=>t.current.onClose(),onOpen:()=>{i.setFormValues({selectedSeqs:t.current.selectedSeqs}),r.setValue("openCount",Number(r.getValue("openCount")??0)+1)}})};return{form:i,modals:l,ui:r,allEmployees:o,changeSelection:c=>i.setFormValue("selectedSeqs",c)}}import{Fragment as BM,jsx as On,jsxs as _M}from"react/jsx-runtime";function Mh(e){return`${e.name}#${e.seq}`}function yM(e){return Number(e.slice(e.lastIndexOf("#")+1))||0}function CM(e,t){return t?[e.name,e.department,e.role_name,e.work_position].filter(Boolean).some(o=>String(o).toLowerCase().includes(t)):!0}function SM(e){let t=[[e.name,e.role_name].filter(Boolean).join(" "),e.department].filter(Boolean).join(" / ");return{id:`emp:${e.seq}`,label:Mh(e),renderLabel:On(Al,{component:"span",sx:{display:"inline-flex",alignItems:"baseline",gap:.75},children:On(Al,{component:"span",sx:{fontWeight:400,color:"text.primary"},children:t})})}}function Lh(e,t){let o=(e.groups??[]).map(r=>Lh(r,t)).filter(r=>r!==null),a=(e.employees??[]).filter(r=>CM(r,t)).map(SM);return o.length===0&&a.length===0?null:{id:`group:${e.key}`,label:e.name,children:[...o,...a]}}function vM({groups:e,allEmployees:t,initialSelectedSeqs:o,multiple:a,isMobile:r,onSelectionChange:i}){L();let[l,s]=gM(""),c=Oh(()=>e.map(m=>Lh(m,l.trim().toLowerCase())).filter(m=>m!==null),[e,l]),u=Oh(()=>t.filter(m=>o.includes(m.seq)).map(Mh),[]);return _M(BM,{children:[On(Al,{sx:{px:1.5,py:1,borderBottom:"1px solid #cccccc",flexShrink:0},children:On(kM,{size:"small",fullWidth:!0,placeholder:n("dialog.searchNameDept"),onSearch:s,onClear:()=>s(""),sx:{"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiInputBase-root":{px:0}}})}),On(Al,{sx:r?{display:"flex",flexDirection:"column"}:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:On(TM,{items:c,checkbox:!0,multiSelect:a,selectionMode:"child",showSearch:!1,defaultExpanded:!0,initialSelections:u,onChange:m=>i(m.map(yM).filter(d=>d>0)),styles:{border:"none",borderRadius:"0"}})})]})}function Uee({open:e,title:t=n("dialog.selectEmployee"),hint:o="",groups:a,multiple:r=!1,selectedSeqs:i,confirmText:l=n("common.confirm"),onConfirm:s,onClose:c}){L();let u=$e(),m=i??[],d=Ph({open:e,groups:a,multiple:r,selectedSeqs:m,onConfirm:s,onClose:c}),{form:p,allEmployees:f}=d,g=d.modals.select,x=p.useValue("selectedSeqs")??[],h=Number(d.ui.useValue("openCount")??0);return On(hM,{open:g.isOpen,onClose:g.close,title:r&&x.length>0?n("dialog.titleWithPeople",{title:t,count:x.length}):t,locale:Se(),fullScreen:u,mobilePresentation:u?"slide":"dialog",draggable:!0,width:"600px",tabs:{visible:!1},titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},scrollPastLastSection:!1,sectionContentPaddingTop:0,fontScale:{enabled:!0},fontScaleKey:"taskbox-employee-select",sections:[{id:"employee-select",title:n("dialog.selectEmployee"),showTitle:!1,children:On(Al,{sx:{...u?{}:{height:560},display:"flex",flexDirection:"column",border:"1px solid #cccccc",borderRadius:1,...u?{}:{overflow:"hidden"},userSelect:"none"},children:On(vM,{groups:a,allEmployees:f,initialSelectedSeqs:m,multiple:r,isMobile:u,onSelectionChange:d.changeSelection},h)})}],dialogActionSx:{"@media (max-width:1023.95px)":{gap:"0.75rem !important","& .left-actions":{flex:1,minWidth:0},"& .right-actions":{flex:1}}},actions:{visible:!0,showCancelButton:!1,left:o?On(bM,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-line",lineHeight:1.35},children:o}):void 0,right:On(xM,{variant:"contained",onClick:()=>{p.submit()},children:l})}})}import{useMemo as s2}from"react";import{Box as Er,Button as ok}from"@mui/material";import{FormDialog as c2}from"@ehfuse/mui-form-dialog";import{LabelSelect as Sp}from"@ehfuse/mui-form-controls";import m2 from"@mui/icons-material/SpeedOutlined";import{Box as Fo,Button as EM}from"@mui/material";import{FormDialog as RM}from"@ehfuse/mui-form-dialog";import{LabelSelect as PM,NumberField as OM}from"@ehfuse/mui-form-controls";import MM from"@ehfuse/overlay-scrollbar";import{useEffect as IM,useRef as wM}from"react";import{useGlobalForm as DM}from"@ehfuse/forma";function Ah(e){return`byAccount.a${e}`}function ql(e){return Math.max(0,Math.floor(Number(e)||0))}function Tp(e){return{basis:e.basis,default_capacity:e.default_capacity,byAccount:Object.fromEntries(Object.entries(e.by_account??{}).map(([t,o])=>[`a${t}`,o]))}}function qh({open:e,capacity:t,onClose:o,onSave:a}){let r=DM({formId:Ie("taskbox-workload-capacity-form"),initialValues:Tp(t??fa),onSubmit:async s=>{let c={};for(let[u,m]of Object.entries(s.byAccount??{})){let d=ql(m),p=Number(u.slice(1));p>0&&d>0&&(c[p]=d)}return await a({...t??fa,basis:s.basis,default_capacity:ql(s.default_capacity),by_account:c}),!0}}),i={form:ro({modalIdPrefix:"taskbox-workload-capacity-dialog",open:e,onClose:o,onOpen:()=>r.setFormValues(Tp(t??fa))})},l=wM(!0);return IM(()=>{if(l.current){l.current=!1;return}e&&r.setFormValues(Tp(t??fa))},[t]),{form:r,modals:i}}import{jsx as ho,jsxs as zl}from"react/jsx-runtime";var LM=[{value:"count",get label(){return n("workload.basisCount")}},{value:"points",get label(){return n("workload.basisPoints")}}];function zh({form:e,name:t,unit:o,size:a,clearWhenZero:r}){let i=ql(e.useFormValue(t));return ho(OM,{size:a,fullWidth:!0,min:0,max:999,thousandSeparator:!1,align:"right",suffix:o,clearWhenZero:r,value:i,onValueChange:l=>e.setFormValue(t,ql(l))})}function Nh({open:e,capacity:t,employees:o,onClose:a,onSave:r}){L();let{form:i,modals:l}=qh({open:e,capacity:t,onClose:a,onSave:r}),s=i.useFormValue("basis")==="points"?"SP":n("chart.unitCount");return ho(RM,{open:l.form.isOpen,onClose:l.form.close,maxWidth:"sm",title:n("workload.title"),locale:Se(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-workload-capacity",tabs:{visible:!1},actions:{showCancelButton:!0,right:ho(EM,{variant:"contained",onClick:()=>{i.submit()},children:n("common.save")})},sectionContentPaddingTop:0,sections:[{id:"capacity",title:"",showTitle:!1,children:zl(Fo,{sx:{display:"flex",flexDirection:"column",gap:2},children:[ho(Fo,{sx:{fontSize:15,color:"#37352f"},children:n("workload.intro")}),zl(Fo,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[ho(Fo,{sx:{width:104,flexShrink:0,fontSize:16,color:"#37352f"},children:n("workload.basis")}),ho(PM,{form:i,name:"basis",size:"medium",fullWidth:!0,label:"",options:LM})]}),zl(Fo,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[ho(Fo,{sx:{width:104,flexShrink:0,fontSize:16,color:"#37352f"},children:n("workload.defaultCapacity")}),ho(zh,{form:i,name:"default_capacity",size:"medium",unit:s})]}),ho(Fo,{sx:{pl:"119px",mt:-1.25,fontSize:13.5,color:"#37352f"},children:n("workload.defaultHint",{unit:s})}),ho(Fo,{sx:{fontSize:16,fontWeight:700,color:"#37352f"},children:n("workload.perPerson")}),o.length===0?ho(Fo,{sx:{fontSize:15,color:"#787774"},children:n("workload.noEmployees")}):ho(Fo,{sx:{border:`1px solid ${ee}`,borderRadius:1,overflow:"hidden"},children:ho(MM,{style:{maxHeight:260},thumb:{width:6},children:o.filter(c=>Number(c.account_seq)>0).map(c=>zl(Fo,{sx:{display:"flex",alignItems:"center",gap:1.5,px:2,py:1,borderBottom:"1px solid #f2f2f0","&:last-of-type":{borderBottom:"none"}},children:[zl(Fo,{sx:{flex:1,minWidth:0,fontSize:16,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[c.name,c.department?ho(Fo,{component:"span",sx:{ml:1,fontSize:14,color:"#787774"},children:c.department}):null]}),ho(Fo,{sx:{width:132,flexShrink:0},children:ho(zh,{form:i,name:Ah(Number(c.account_seq)),size:"small",unit:s,clearWhenZero:!0})})]},c.account_seq))})})]})}]})}import{lazy as AM,Suspense as qM}from"react";import{Box as zM}from"@mui/material";import{jsx as om}from"react/jsx-runtime";function NM({height:e}){return om(zM,{sx:typeof e=="number"?{height:e,minHeight:120}:{position:"absolute",inset:0}})}function Nl(e,t){let o=AM(e);return function(r){return om(qM,{fallback:om(NM,{height:r.height??t}),children:om(o,{...r})})}}var Fh=Nl(()=>import("./chunks/SprintVelocityChart-BQRXOJHD.js").then(e=>({default:e.SprintVelocityChart})),200),Hh=Nl(()=>import("./chunks/SprintBurndownChart-EDDNFGQJ.js").then(e=>({default:e.SprintBurndownChart})),200),Wh=Nl(()=>import("./chunks/CumulativeFlowChart-2IPPSVYL.js").then(e=>({default:e.CumulativeFlowChart})),220),$h=Nl(()=>import("./chunks/LeadTimeDistributionChart-3MYBJV7I.js").then(e=>({default:e.LeadTimeDistributionChart})),200),Vh=Nl(()=>import("./chunks/WorkloadChart-5YP6AOGA.js").then(e=>({default:e.WorkloadChart})),200);import{Box as XM,Button as QM}from"@mui/material";import{FormDialog as JM}from"@ehfuse/mui-form-dialog";import{useState as FM}from"react";import{Box as $t,Button as HM,Menu as WM,MenuItem as $M}from"@mui/material";import VM from"@mui/icons-material/PersonOutlineOutlined";import KM from"@ehfuse/overlay-scrollbar";import{jsx as Vt,jsxs as Bi}from"react/jsx-runtime";var Kh=56,Uh=68,Gh=96;function UM(e){let t=String(e.due_date??"").slice(0,10);return t?t.slice(5).replace("-","/"):"-"}function jh(e,t){let o=String(e.due_date??"").slice(0,10);return!!o&&o<t}function Yh({tasks:e,row:t,todayStr:o,employees:a,rows:r,height:i=200,hideSummary:l=!1,onChangeManager:s,onOpenTask:c}){L();let[u,m]=FM(null),d=ms(e,t.accountSeq),p=f=>r.find(g=>g.accountSeq===f)?.total??0;return Bi($t,{sx:{display:"flex",flexDirection:"column",minHeight:0,height:i},children:[l?null:Bi($t,{sx:{display:"flex",alignItems:"center",gap:1,px:.5,pb:.75,fontSize:14,color:"#37352f"},children:[Vt($t,{component:"span",sx:{fontWeight:700},children:t.name}),Vt($t,{component:"span",children:n("chart.openCount",{count:d.length})}),t.capacity>0?Vt($t,{component:"span",sx:{color:t.load>t.capacity?"#e5484d":"#787774"},children:n("chart.capacityOf",{capacity:t.capacity,load:t.load})}):null]}),Bi($t,{sx:{flex:1,minHeight:0,display:"flex",flexDirection:"column",border:`1px solid ${ee}`,borderRadius:1,overflow:"hidden"},children:[Bi($t,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,flexShrink:0,bgcolor:"#fafaf9",borderBottom:`1px solid ${ee}`,fontSize:13.5,fontWeight:600,color:"#37352f"},children:[Vt($t,{sx:{width:Kh,flexShrink:0},children:n("board.due")}),Vt($t,{sx:{flex:1,minWidth:0},children:n("template.task")}),Vt($t,{sx:{width:Uh,flexShrink:0,textAlign:"center"},children:n("col.priority")}),s?Vt($t,{sx:{width:Gh,flexShrink:0,textAlign:"center"},children:n("col.owner")}):null]}),Vt($t,{sx:{flex:1,minHeight:0},children:Vt(KM,{style:{height:"100%"},thumb:{width:6},children:d.length===0?Vt($t,{sx:{p:2,fontSize:14,color:"#9a9a97"},children:n("chart.noOpenTasks")}):d.map(f=>Bi($t,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1.5,borderBottom:"1px solid #f2f2f0"},children:[Vt($t,{sx:{width:Kh,flexShrink:0,fontSize:13.5,color:jh(f,o)?"#e5484d":"#787774",fontWeight:jh(f,o)?700:400},children:UM(f)}),Vt($t,{onClick:c?()=>c(f.seq):void 0,sx:{flex:1,minWidth:0,fontSize:14.5,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...c?{cursor:"pointer","&:hover":{textDecoration:"underline"}}:{}},children:f.title}),Vt($t,{sx:{width:Uh,flexShrink:0,display:"flex",justifyContent:"center"},children:Vt(po,{priority:f.priority})}),s?Vt($t,{sx:{width:Gh,flexShrink:0,display:"flex",justifyContent:"center"},children:Vt(HM,{size:"small",variant:"outlined",startIcon:Vt(VM,{sx:{fontSize:17}}),onClick:g=>m({el:g.currentTarget,taskSeq:f.seq}),children:n("chart.move")})}):null]},f.seq))})})]}),Vt(WM,{anchorEl:u?.el??null,open:!!u,onClose:()=>m(null),transitionDuration:0,children:a.filter(f=>Number(f.account_seq)>0&&Number(f.account_seq)!==t.accountSeq).map(f=>Bi($M,{onClick:()=>{u&&s&&s(u.taskSeq,Number(f.account_seq),f.name),m(null)},sx:{fontSize:14,minWidth:200},children:[Vt($t,{sx:{flex:1},children:f.name}),Vt($t,{component:"span",sx:{ml:2,fontSize:13,color:"#787774"},children:n("chart.countValue",{count:p(Number(f.account_seq))})})]},f.account_seq))})]})}import{useEffect as GM,useRef as jM,useState as YM}from"react";function Xh({open:e,row:t,onClose:o,onOpenTask:a}){let[r,i]=YM(t);GM(()=>{t&&i(t)},[t]);let l=jM(0),s={dialog:ro({modalIdPrefix:"taskbox-workload-person-dialog",open:e,onClose:()=>{o();let u=l.current;l.current=0,u>0&&a?.(u)}})};return{modals:s,shown:t??r,openTask:a?u=>{if(!s.dialog.isOpen){a(u);return}l.current=u,s.dialog.close()}:void 0}}import{jsx as nm}from"react/jsx-runtime";function Qh({open:e,row:t,rows:o,tasks:a,todayStr:r,employees:i,onClose:l,onChangeManager:s,onOpenTask:c}){L();let{modals:u,shown:m,openTask:d}=Xh({open:e,row:t,onClose:l,onOpenTask:c}),p=m?ms(a,m.accountSeq).length:0;return nm(JM,{open:u.dialog.isOpen,onClose:u.dialog.close,maxWidth:"sm",title:m?n("workload.personTasksTitle",{name:m.name,count:p}):n("template.task"),locale:Se(),titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-workload-person",tabs:{visible:!1},actions:{showCancelButton:!1,right:nm(QM,{variant:"contained",onClick:u.dialog.close,children:n("common.close")})},sections:[{id:"person-tasks",title:"",showTitle:!1,children:nm(XM,{sx:{minHeight:0},children:m?nm(Yh,{tasks:a,row:m,rows:o,todayStr:r,employees:i,height:"min(420px, 52vh)",hideSummary:!0,onChangeManager:s,onOpenTask:d}):null})}]})}import{useMemo as ZM}from"react";import{Box as Jo,Tooltip as e2}from"@mui/material";import{OverlayScrollbar as t2}from"@ehfuse/overlay-scrollbar";import{jsx as Eo,jsxs as am}from"react/jsx-runtime";var Jh="#e5484d",o2="#2f80ed",n2="#9a9a97",yp=30,r2=96,rm=56;function Cp({count:e,max:t,color:o,title:a}){let r=e>0&&t>0?.18+e/t*.72:0;return Eo(e2,{title:a,arrow:!0,disableInteractive:!0,placement:"top",children:Eo(Jo,{sx:{display:"flex",alignItems:"center",justifyContent:"center",borderRight:`1px solid ${ee}`,borderBottom:`1px solid ${ee}`,bgcolor:r>0?`${o}${Math.round(r*255).toString(16).padStart(2,"0")}`:"transparent",color:r>.55?"#fff":"#37352f",fontSize:12.5,fontWeight:e>0?700:400,fontVariantNumeric:"tabular-nums"},children:e>0?e:""})})}function Zh({tasks:e,todayStr:t,weeks:o=6,height:a=200}){L();let r=ZM(()=>jp(e,{todayStr:t,weeks:o}),[e,t,o]);if(r.rows.length===0)return Eo(Jo,{sx:Vi(a),children:Eo(cs,{text:n("chart.noAssignedOpen"),height:a})});let i=`${r2}px ${rm}px repeat(${r.weeks.length}, minmax(${rm}px, 1fr)) ${rm}px ${rm}px`,l={height:yp,display:"flex",alignItems:"center",justifyContent:"center",borderRight:`1px solid ${ee}`,borderBottom:"1px solid #dcdad6",fontSize:12,fontWeight:700,color:"#37352f",bgcolor:"#f8f8f7",whiteSpace:"nowrap"};return Eo(Jo,{sx:Vi(a),children:Eo(t2,{style:{height:"100%"},thumb:{width:8},children:am(Jo,{sx:{display:"grid",gridTemplateColumns:i,minWidth:"fit-content",height:"100%",gridTemplateRows:`${yp}px repeat(${r.rows.length}, minmax(${yp}px, 1fr))`},children:[Eo(Jo,{sx:{...l,justifyContent:"flex-start",pl:1},children:n("chart.assignee")}),Eo(Jo,{sx:{...l,color:Jh},children:n("chart.overdue")}),r.weeks.map(s=>Eo(Jo,{sx:{...l,...s.isCurrent?{borderBottom:"2px solid #2f80ed"}:{}},children:s.label},s.start)),Eo(Jo,{sx:l,children:n("chart.noDue")}),Eo(Jo,{sx:l,children:n("chart.total")}),r.rows.map(s=>am(Jo,{sx:{display:"contents"},children:[Eo(Jo,{sx:{display:"flex",alignItems:"center",pl:1,borderRight:`1px solid ${ee}`,borderBottom:`1px solid ${ee}`,fontSize:13,color:s.accountSeq>0?"#37352f":"#9a9a97",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),Eo(Cp,{count:s.overdue,max:r.maxCell,color:Jh,title:n("chart.cellOverdue",{name:s.name,count:s.overdue})}),s.byWeek.map((c,u)=>Eo(Cp,{count:c,max:r.maxCell,color:o2,title:n("chart.cellWeek",{name:s.name,week:r.weeks[u].label,count:c})},r.weeks[u].start)),Eo(Cp,{count:s.noDue,max:r.maxCell,color:n2,title:n("chart.cellNoDue",{name:s.name,count:s.noDue})}),am(Jo,{sx:{display:"flex",alignItems:"center",justifyContent:"center",borderBottom:`1px solid ${ee}`,fontSize:12.5,fontWeight:700,color:"#37352f",fontVariantNumeric:"tabular-nums"},children:[s.total,s.beyond>0?am(Jo,{component:"span",sx:{ml:.25,fontSize:10.5,color:"#9a9a97"},children:["(+",s.beyond,")"]}):null]})]},s.accountSeq))]})})})}import{useMemo as a2,useRef as i2,useState as ek}from"react";import{useGlobalForm as l2}from"@ehfuse/forma";function tk({open:e,sprints:t,tasks:o,todayStr:a,initialSprintSeq:r,capacity:i,onSaveCapacity:l,onOpenTask:s,onClose:c}){let u=l2({formId:Ie("taskbox-sprint-charts-form"),initialValues:{sprintSeq:"",flowDays:"30",workloadMode:"distribution"}}),[m,d]=ek(0),[p,f]=ek(!1),g=i2(0),x={charts:ro({modalIdPrefix:"taskbox-sprint-charts-dialog",open:e,onClose:()=>{c();let T=g.current;g.current=0,T>0&&s?.(T)},onOpen:()=>{let T=t.find(k=>k.status==="active")??t[0],z=t.find(k=>k.seq===r)??T;u.setFormValue("sprintSeq",z?.seq?String(z.seq):"")}})},h=a2(()=>Gp(o,{todayStr:a,capacity:i}),[o,a,i]),E=h.find(T=>T.accountSeq===m)??null;return{form:u,modals:x,workloadRows:h,pickedAccountSeq:m,pickedRow:E,pickPerson:d,closePersonTasks:()=>d(0),capacityOpen:p,openCapacity:()=>f(!0),closeCapacity:()=>f(!1),saveCapacity:l?async T=>{await l(T),f(!1)}:void 0,openTask:s?T=>{if(!x.charts.isOpen){s(T);return}g.current=T,x.charts.close()}:void 0}}import{Fragment as nk,jsx as _t,jsxs as im}from"react/jsx-runtime";var rk="min(560px, 62vh)",u2=`calc(${rk} - 4px)`,d2=[{value:"30",get label(){return n("chart.last30")}},{value:"60",get label(){return n("chart.last60")}},{value:"90",get label(){return n("chart.last90")}}];function foe({open:e,sprints:t,tasks:o,todayStr:a,showSprintCharts:r,capacity:i=fa,capacityEmployees:l=[],onSaveCapacity:s,onChangeTaskManager:c,onOpenTask:u,initialSprintSeq:m=0,onClose:d}){L();let p=tk({open:e,sprints:t,tasks:o,todayStr:a,initialSprintSeq:m,capacity:i,onSaveCapacity:s,onOpenTask:u,onClose:d}),{form:f,modals:g,workloadRows:x,pickedAccountSeq:h,pickedRow:E}=p,b=Number(f.useFormValue("sprintSeq"))||0,B=Number(f.useFormValue("flowDays"))||30,T=f.useFormValue("workloadMode")==="timeline"?"timeline":"distribution",z=s2(()=>t.find(y=>y.seq===b)??null,[t,b]),k={height:u2,boxSizing:"border-box",px:3,py:2.5,display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden"},_=_t(Sp,{form:f,name:"sprintSeq",label:n("col.goal"),showLabel:!1,showEmptyOption:!1,options:t.map(y=>({value:String(y.seq),label:cn(y)})),sx:{width:280,flexShrink:0}}),D=_t(Sp,{form:f,name:"workloadMode",label:n("chart.view"),showLabel:!1,showEmptyOption:!1,options:[{value:"distribution",label:n("chart.loadNow")},{value:"timeline",label:n("chart.weeklyDue")}],sx:{width:280,flexShrink:0}}),F=im(nk,{children:[D,s?_t(ok,{size:"small",variant:"outlined",startIcon:_t(m2,{sx:{fontSize:18}}),onClick:p.openCapacity,sx:{flexShrink:0},children:n("chart.capacity")}):null]}),R=r??t.length>0,C=_t(Sp,{form:f,name:"flowDays",label:n("chart.period"),showLabel:!1,showEmptyOption:!1,options:d2,sx:{width:280,flexShrink:0}});return im(nk,{children:[_t(c2,{open:g.charts.isOpen,onClose:g.charts.close,maxWidth:"md",title:n("chart.title"),locale:Se(),contentTopPadding:0,contentPaddingX:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sectionTitleGap:0,fixedHeight:rk,contentBottomPadding:0,scrollPastLastSection:!1,tabs:{visible:!0,switchContent:!0,fullWidth:!0},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-charts",sections:[...R?[{id:"velocity",tabTitle:n("chart.velocity"),showTitle:!1,children:_t(Er,{sx:k,children:_t(Fh,{sprints:t,tasks:o,height:"100%"})})},{id:"burndown",tabTitle:n("chart.burndown"),showTitle:!1,children:_t(Er,{sx:k,children:z?_t(Hh,{sprint:z,tasks:o,todayStr:a,height:"100%",headerLeft:_}):im(Er,{sx:Vi("100%"),children:[_t(Er,{sx:_m,children:_}),_t(cs,{text:n("chart.pickGoalForBurndown"),height:"100%"})]})})},{id:"cumulative-flow",tabTitle:n("chart.cfd"),showTitle:!1,children:_t(Er,{sx:k,children:_t(Wh,{tasks:o,todayStr:a,days:B,height:"100%",headerLeft:C})})}]:[],{id:"workload",tabTitle:n("chart.workload"),showTitle:!1,children:_t(Er,{sx:k,children:T==="timeline"?im(Er,{sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[_t(Er,{sx:_m,children:F}),_t(Zh,{tasks:o,todayStr:a,height:"100%"})]}):_t(Vh,{tasks:o,todayStr:a,height:"100%",capacity:i,headerLeft:F,selectedAccountSeq:h,onSelectPerson:c?p.pickPerson:void 0})})},{id:"lead-time",tabTitle:n("chart.leadTime"),showTitle:!1,children:_t(Er,{sx:k,children:_t($h,{tasks:o,todayStr:a,days:B,height:"100%",headerLeft:C})})}],actions:{showCancelButton:!1,right:_t(ok,{variant:"contained",onClick:g.charts.close,children:n("common.close")})}}),_t(Qh,{open:h>0,row:E,rows:x,tasks:o,todayStr:a,employees:l,onClose:p.closePersonTasks,onChangeManager:c,onOpenTask:p.openTask}),p.saveCapacity?_t(Nh,{open:p.capacityOpen,capacity:i,employees:l,onClose:p.closeCapacity,onSave:p.saveCapacity}):null]})}import{useMemo as p2}from"react";import{Box as f2}from"@mui/material";import{HEADER_MENU_ICON_PATHS as ak,HeaderMenuIcon as g2,HeaderMenuItem as x2,headerMenuAnchor as b2}from"@ehfuse/mui-virtual-data-table";import{jsx as vp}from"react/jsx-runtime";function _i(e,t){return p2(()=>t??(e?b2(e):null),[e,t])}function lm(e,t){let o=t.filter(r=>!e.includes(r)),a=e.filter(r=>!t.includes(r));return o.length===1&&a.length===0?{kind:"toggle",value:o[0]}:a.length===1&&o.length===0?{kind:"toggle",value:a[0]}:t.length===0?{kind:"clear"}:null}function ik({checked:e,onClick:t,disabled:o,children:a}){return vp(x2,{selected:e,disabled:o,onClick:t,icon:vp(g2,{d:e?ak.radioOn:ak.radioOff,color:e?"primary.main":"text.disabled"}),children:a})}function lk({color:e}){return vp(f2,{component:"span",sx:{width:8,height:8,borderRadius:"50%",bgcolor:e,flexShrink:0}})}import{HEADER_MENU_FONT_SIZE as h2,HeaderMenu as k2}from"@ehfuse/mui-virtual-data-table";import{jsx as sk}from"react/jsx-runtime";function woe({anchorPosition:e,anchorEl:t,candidates:o,selectedNames:a,avatarSrcByName:r,onToggle:i,onClear:l,onClose:s}){L();let c=_i(t,e),u=se().avatarSrcByName,m=r??u,d=Math.round(h2*1.43);return sk(k2,{open:!!c,anchorPosition:c,onClose:s,filter:{options:o.map(p=>({value:p.name,label:p.name,icon:sk(fo,{src:m?.get(p.name)??"",name:p.name,avatarSx:{width:d,height:d,fontSize:Math.round(d/2),borderRadius:"50%",flexShrink:0,...Gr[0]},iconFontSize:Math.round(d*.6)})})),value:a,onChange:p=>{let f=lm(a,p);if(!f)return;let g=f.kind==="toggle"?o.find(x=>x.name===f.value):void 0;g?i(g):l()},clearLabel:n("menu.clearFilter"),emptyText:n("menu.noMembersInList")}})}import{useState as T2}from"react";import{ButtonBase as y2,Menu as C2,MenuItem as S2}from"@mui/material";import v2 from"@mui/icons-material/KeyboardArrowDown";import B2 from"@mui/icons-material/Check";import{Fragment as _2,jsx as Bp,jsxs as _p}from"react/jsx-runtime";function Aoe({value:e,onChange:t,options:o}){let[a,r]=T2(null),i=o??gu,l=gu.find(s=>s.value===e)?.label??"";return _p(_2,{children:[_p(y2,{onClick:s=>r(s.currentTarget),sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:.5,borderRadius:1,fontSize:13.5,color:"#37352f","&:hover":{bgcolor:"#f2f2f0"}},children:[l,Bp(v2,{sx:{fontSize:17,color:"#9a9a97"}})]}),Bp(C2,{transitionDuration:0,anchorEl:a,open:!!a,onClose:()=>r(null),children:i.map(s=>_p(S2,{selected:s.value===e,onClick:()=>{t(s.value),r(null)},sx:{fontSize:14,minWidth:140,justifyContent:"space-between",gap:1},children:[s.label,s.value===e?Bp(B2,{sx:{fontSize:16,color:"#2f80ed"}}):null]},s.value))})]})}import{Box as sm,ButtonBase as I2}from"@mui/material";import{DateTextField as ck}from"@ehfuse/mui-form-controls";import{jsx as Fl,jsxs as mk}from"react/jsx-runtime";var w2=[{get label(){return n("range.month1")},months:1},{get label(){return n("range.month3")},months:3},{get label(){return n("range.month6")},months:6},{get label(){return n("range.year1")},months:12},{get label(){return n("common.all")},months:0}];function uk({fromDate:e,toDate:t,onChange:o}){L();let a=i=>{if(i<=0){o("","");return}o($i(Bm(i)),$i(new Date))},r=i=>i<=0?!e&&!t:!e||!t?!1:e===$i(Bm(i))&&t===$i(new Date);return mk(sm,{sx:{display:"flex",alignItems:"center",gap:1.5,flexWrap:"wrap"},children:[Fl(sm,{sx:{display:"flex",alignItems:"center",gap:1.5},children:w2.map(i=>{let l=r(i.months);return Fl(I2,{onClick:()=>a(i.months),sx:{px:1.25,py:.85,borderRadius:1,fontSize:13,fontWeight:l?500:400,border:"1px solid",borderColor:l?"#2f80ed":ee,color:l?"#2f80ed":"#37352f",bgcolor:l?"#eef6ff":"transparent","&:hover":{bgcolor:l?"#eef6ff":"#f7f7f5"}},children:i.label},i.label)})}),mk(sm,{sx:{display:"flex",alignItems:"center",gap:.5},children:[Fl(ck,{value:e,size:"small",placeholder:n("calendar.startDate"),onChange:i=>o(i.target.value,t),sx:{width:140,"& .MuiInputBase-input":{fontSize:13}}}),Fl(sm,{component:"span",sx:{fontSize:13,color:"#9a9a97"},children:"~"}),Fl(ck,{value:t,size:"small",placeholder:n("calendar.endDate"),onChange:i=>o(e,i.target.value),sx:{width:140,"& .MuiInputBase-input":{fontSize:13}}})]})]})}import{Popover as D2}from"@mui/material";import{jsx as dk}from"react/jsx-runtime";function joe({anchorEl:e,fromDate:t,toDate:o,onChange:a,onClose:r}){return dk(D2,{transitionDuration:0,anchorEl:e,open:!!e,onClose:r,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{p:1.5}}},children:dk(uk,{fromDate:t,toDate:o,onChange:a})})}import{Box as E2,ButtonBase as R2,Tab as P2,Tabs as O2}from"@mui/material";import M2 from"@mui/icons-material/Checklist";import L2 from"@mui/icons-material/Face";import A2 from"@mui/icons-material/Publish";import q2 from"@mui/icons-material/NotificationsOutlined";import z2 from"@mui/icons-material/BugReportOutlined";import N2 from"@mui/icons-material/SupportAgentOutlined";import F2 from"@mui/icons-material/DescriptionOutlined";import H2 from"@mui/icons-material/Inventory2Outlined";import{jsx as fn}from"react/jsx-runtime";function pk(e,t){return t>0?`${e} (${t})`:e}var cne=[{id:"my",get label(){return n("tab.all")},icon:fn(M2,{sx:{fontSize:18}})},{id:"mine",get label(){return n("tab.mine")},icon:fn(L2,{sx:{fontSize:18}})},{id:"sent",get label(){return n("tab.sent")},icon:fn(A2,{sx:{fontSize:18}})},{id:"support",get label(){return n("tab.support")},icon:fn(N2,{sx:{fontSize:18}})},{id:"bug",get label(){return n("tab.bug")},icon:fn(z2,{sx:{fontSize:18}})},{id:"notice",get label(){return n("tab.notice")},icon:fn(q2,{sx:{fontSize:18}})},{id:"archive",get label(){return n("tab.archive")},icon:fn(H2,{sx:{fontSize:18}}),hideCount:!0},{id:"report",get label(){return n("tab.report")},icon:fn(F2,{sx:{fontSize:18}}),hideCount:!0}];function W2(e){return{minHeight:46,minWidth:75,bgcolor:e.bg,color:e.color,borderRadius:"8px 8px 0 0",padding:"10px 18px",textTransform:"none",fontSize:14,fontWeight:500,border:`1px solid ${e.borderColor}`,borderBottom:"none","&:hover":{bgcolor:e.hoverBg},"&.Mui-selected":{bgcolor:e.selectedBg,color:e.selectedColor,border:`1px solid ${e.selectedBg}`,borderBottom:"none","&:hover":{bgcolor:e.selectedBg}},...e.sx}}function mne({items:e,activeTab:t,counts:o,onChange:a,compact:r=!1}){L();let i=be(),l=W2(i.tabs),s=e;return r?fn(E2,{sx:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:1},children:s.map(c=>{let u=t===c.id;return fn(R2,{onClick:()=>a(c.id),sx:{height:40,minWidth:0,px:.5,borderRadius:1,fontSize:pt(13.5),fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",border:"1px solid",bgcolor:u?i.tabs.selectedBg:i.tabs.bg,color:u?i.tabs.selectedColor:i.tabs.color,borderColor:u?i.tabs.selectedBg:i.tabs.borderColor},children:pk(c.label,c.hideCount?0:o[c.id]??0)},c.id)})}):fn(O2,{value:t,onChange:(c,u)=>a(u),sx:{minHeight:46,"& .MuiTabs-indicator":{display:"none"},"& .MuiTabs-flexContainer":{gap:"12px",minHeight:46}},children:s.map(c=>fn(P2,{value:c.id,label:pk(c.label,c.hideCount?0:o[c.id]??0),icon:c.icon,iconPosition:"start",sx:l},c.id))})}import{useEffect as $2,useMemo as V2,useState as Ip}from"react";import{Divider as cm,ListItemIcon as ko,Menu as wp,MenuItem as jt}from"@mui/material";import K2 from"@mui/icons-material/OpenInNewOutlined";import U2 from"@mui/icons-material/RestoreFromTrashOutlined";import G2 from"@mui/icons-material/Check";import j2 from"@mui/icons-material/CheckCircleOutlined";import Y2 from"@mui/icons-material/RadioButtonUnchecked";import X2 from"@mui/icons-material/SendOutlined";import Q2 from"@mui/icons-material/EventOutlined";import J2 from"@mui/icons-material/PersonOutlineOutlined";import Z2 from"@mui/icons-material/ViewKanbanOutlined";import e5 from"@mui/icons-material/ContentCopyOutlined";import t5 from"@mui/icons-material/PrintOutlined";import o5 from"@mui/icons-material/NextPlanOutlined";import n5 from"@mui/icons-material/ContentPasteOutlined";import r5 from"@mui/icons-material/ShareOutlined";import a5 from"@mui/icons-material/DirectionsRunOutlined";import fk from"@mui/icons-material/ChevronRight";import i5 from"@mui/icons-material/ArchiveOutlined";import l5 from"@mui/icons-material/UnarchiveOutlined";import{ConfirmDialog as gk}from"@ehfuse/alerts";import{Fragment as xk,jsx as ye,jsxs as At}from"react/jsx-runtime";function Une({target:e,onClose:t,customTabs:o,sprints:a=[],myAccountSeq:r=0,onOpenDetail:i,onToggleCompleted:l,onRequestConfirm:s,onChangeDueDate:c,onChangeReminder:u,onMemberEdit:m,onMoveProject:d,onDuplicate:p,onPrint:f,onCreateFollowUp:g,onShare:x,onAssignSprint:h,onArchiveToggle:E,onDelete:b,onRestore:B,onPurge:T}){L();let z=$e(),k=Fn(),[_,D]=Ip(null),[F,R]=Ip(null),[C,y]=Ip(null);$2(()=>{e||(D(null),R(null),y(null))},[e]);let I=e?.task??null,S=!!I?.is_notice,M=!!I?.is_event,w=I?!Wn(I,r):!1,{editPolicy:q,shareText:v}=se(),O=I?Ur(I,r,q):!1,j=I?ka(I,r,q,w):!1,V=I?ka(I,r,q,!1):!1,Z=!!I?.deleted,ie=(()=>{if(!I||I.completed)return!0;let G=Vn(I,r);return G.total===0||G.count>=G.total})(),ue=V2(()=>new Set(o.filter(G=>G.useSprints).map(G=>G.key)),[o]),K=async(G="one")=>{let ae=I;if(t(),!ae)return;await gk({title:n("menu.deleteTask"),message:G==="series"?n("menu.deleteSeriesConfirm",{title:ae.title}):n("menu.deleteTaskConfirm",{title:ae.title})})&&b?.(ae.seq,G)},te=async()=>{let G=I;if(t(),!G)return;await gk({title:n("menu.purge"),message:n("menu.purgeConfirm",{title:G.title})})&&T?.(G.seq)},$=()=>{I&&E(I.seq,!I.archived),t()};return At(xk,{children:[At(wp,{open:!!e,onClose:t,transitionDuration:0,anchorReference:z?"none":"anchorPosition",anchorPosition:!z&&e?{top:e.position.top,left:e.position.left}:void 0,slotProps:{paper:{sx:{minWidth:190,...z?{position:"fixed",top:"50%",left:"50%",translate:"-50% -50%",maxHeight:"70vh"}:{}}},list:z?{sx:{"& .MuiMenuItem-root":{py:1,minHeight:0}}}:void 0},children:[At(jt,{onClick:()=>{I&&i(I),t()},sx:{fontSize:14},children:[ye(ko,{children:ye(K2,{sx:{fontSize:19}})}),n("menu.openDetail")]}),Z?ye(cm,{}):null,Z&&B?At(jt,{disabled:V,onClick:()=>{I&&B(I.seq),t()},sx:{fontSize:14},children:[ye(ko,{children:ye(U2,{sx:{fontSize:19}})}),n("menu.restore")]}):null,Z&&T?At(jt,{disabled:V,onClick:()=>{te()},sx:{fontSize:14,color:"#e5484d"},children:[ye(ko,{children:ye(Qt,{sx:{fontSize:19,color:"#e5484d"}})}),n("menu.purge")]}):null,Z?null:At(xk,{children:[At(jt,{disabled:S?(I?.author_account_seq??0)!==r:(I?.author_account_seq??0)!==r&&(I?.manager_account_seq??0)!==r,onClick:()=>{I&&l(I.seq,!I.completed),t()},sx:{fontSize:14},children:[ye(ko,{children:I?.completed?ye(Y2,{sx:{fontSize:19}}):ye(j2,{sx:{fontSize:19}})}),I?.completed?n("menu.uncomplete"):n("menu.complete")]}),!S&&s?At(jt,{disabled:ie,onClick:()=>{I&&s(I),t()},sx:{fontSize:14},children:[ye(ko,{children:ye(X2,{sx:{fontSize:19}})}),n("menu.requestConfirm")]}):null,M?null:ye(cm,{}),M?null:At(jt,{disabled:O,onClick:G=>{I&&D({anchorEl:G.currentTarget,task:I})},sx:{fontSize:14},children:[ye(ko,{children:ye(Q2,{sx:{fontSize:19}})}),n("menu.changeDue")]}),!S&&!M&&m?At(jt,{disabled:q==="coreAuthorManager"?O:!1,onClick:()=>{I&&m(I,"manager"),t()},sx:{fontSize:14},children:[ye(ko,{children:ye(J2,{sx:{fontSize:19}})}),n("menu.changeOwner")]}):null,M?null:At(jt,{disabled:O,onClick:G=>{I&&R({anchorEl:G.currentTarget,task:I})},sx:{fontSize:14},children:[ye(ko,{children:ye(Z2,{sx:{fontSize:19}})}),n("menu.moveProject"),ye(fk,{sx:{fontSize:18,ml:"auto",color:"#9a9a97"}})]}),ye(cm,{}),p?At(jt,{disabled:w,onClick:()=>{I&&p(I.seq),t()},sx:{fontSize:14},children:[ye(ko,{children:ye(e5,{sx:{fontSize:19}})}),n("menu.duplicate")]}):null,f?At(jt,{onClick:()=>{I&&f(I),t()},sx:{fontSize:14},children:[ye(ko,{children:ye(t5,{sx:{fontSize:19}})}),n("common.print")]}):null,g&&I&&!I.is_event&&!I.is_notice?At(jt,{onClick:()=>{I&&g(I.seq),t()},sx:{fontSize:14},children:[ye(ko,{children:ye(o5,{sx:{fontSize:19}})}),n("menu.createFollowUp")]}):null,At(jt,{onClick:()=>{I&&(x?x(I):ki(I,z,v)),t()},sx:{fontSize:14},children:[ye(ko,{children:z?ye(r5,{sx:{fontSize:19}}):ye(n5,{sx:{fontSize:19}})}),z?n("menu.share"):n("menu.copyContent")]}),I&&!I.is_notice&&!I.is_event&&ue.has(String(I.tab_key??""))&&h?At(jt,{onClick:G=>y(G.currentTarget),sx:{fontSize:14},children:[ye(ko,{children:ye(a5,{sx:{fontSize:19}})}),n("menu.addToSprint"),ye(fk,{sx:{fontSize:18,ml:"auto",color:"#9a9a97"}})]}):null,At(jt,{onClick:$,disabled:w||!I?.archived&&!(I&&vs(I)),sx:{fontSize:14},children:[ye(ko,{children:I?.archived?ye(l5,{sx:{fontSize:19}}):ye(i5,{sx:{fontSize:19}})}),I?.archived?n("menu.unarchive"):n("menu.archive")]}),b?ye(cm,{}):null,b?At(jt,{disabled:j,onClick:()=>{K("one")},sx:{fontSize:14,color:"#e5484d"},children:[ye(ko,{children:ye(Qt,{sx:{fontSize:19,color:"#e5484d"}})}),(I?.repeat_group_key??0)>0?n("menu.deleteThisOnly"):n("common.delete")]}):null,b&&(I?.repeat_group_key??0)>0?At(jt,{disabled:j,onClick:()=>{K("series")},sx:{fontSize:14,color:"#e5484d"},children:[ye(ko,{children:ye(Qt,{sx:{fontSize:19,color:"#e5484d"}})}),n("menu.deleteSeries")]}):null]})]}),ye(ln,{anchorEl:_?.anchorEl??null,open:!!_,date:_?.task.due_date??"",reminders:rn(_?.task),hideReminder:!!_?.task.completed,centered:z,onClose:()=>{D(null),t()},onDateChange:G=>{_&&c(_.task.seq,G)},onReminderChange:G=>{_&&u?.(_.task.seq,G)}}),At(wp,{transitionDuration:0,anchorEl:F?.anchorEl??null,open:!!F,onClose:()=>{R(null),t()},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},...k,children:[ye(jt,{selected:!F?.task.tab_key,onClick:()=>{F&&d(F.task.seq,""),R(null),t()},sx:{fontSize:14,minWidth:170},children:n("common.none")}),o.filter(G=>!G.archived).map(G=>ye(jt,{selected:F?.task.tab_key===G.key,onClick:()=>{F&&d(F.task.seq,G.key),R(null),t()},sx:{fontSize:14,minWidth:170},children:G.label},G.key))]}),ye(wp,{transitionDuration:0,anchorEl:C,open:!!C,onClose:()=>y(null),anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},children:[{seq:0,label:n("menu.backlogUnassigned")},...a.filter(G=>`custom-${G.group_seq}`===String(I?.tab_key??"")).map(G=>({seq:G.seq,label:cn(G)}))].map(G=>At(jt,{onClick:()=>{I&&h?.(I.seq,G.seq),y(null),t()},sx:{fontSize:14,minWidth:160,gap:1},children:[G.label,(I?.sprint_seq??0)===G.seq?ye(G2,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},G.seq))})]})}import{HeaderMenu as s5}from"@ehfuse/mui-virtual-data-table";import{jsx as bk}from"react/jsx-runtime";function Jne({anchorPosition:e,anchorEl:t,labelOptions:o,selectedKeys:a,onChange:r,onToggle:i,onClear:l,clearLabel:s=n("menu.clearFilter"),onClose:c}){L();let u=_i(t,e);return bk(s5,{open:!!u,anchorPosition:u,onClose:c,filter:{options:o.map(m=>({value:m.key,label:m.name,icon:bk(lk,{color:m.dot})})),value:a,onChange:m=>{if(r){r(m);return}let d=lm(a,m);d?.kind==="toggle"?i?.(d.value):d?.kind==="clear"&&l?.()},clearLabel:s}})}import c5 from"@mui/icons-material/SettingsOutlined";import{HeaderMenu as m5,HeaderMenuItem as u5,HEADER_MENU_ICON_SIZE as d5}from"@ehfuse/mui-virtual-data-table";import{jsx as mm}from"react/jsx-runtime";function ire(e){L();let{anchorPosition:t,anchorEl:o,sprints:a,value:r,onSelect:i,onManage:l,onClose:s}=e,c=_i(o,t),u=[{seq:0,label:n("common.all")},{seq:-1,label:n("menu.unassignedTasks")},...a.map(m=>({seq:m.seq,label:cn(m)}))];return mm(m5,{open:!!c,anchorPosition:c,onClose:s,header:u.map(m=>mm(ik,{checked:r===m.seq,onClick:()=>{i(m.seq),s()},children:m.label},m.seq)),children:mm(u5,{icon:mm(c5,{sx:{fontSize:d5,color:"text.secondary"}}),onClick:()=>{s(),l()},children:n("menu.manageGoals")})})}var p5={my:"tasks",mine:"tasks",sent:"tasks",notice:"notice",support:"support",bug:"bug",archive:"archive",done:"done",report:"report"};function f5(e){return p5[e]??"tasks"}var kk={get list(){return n("menu.list")},get card(){return n("menu.project")},get kanban(){return n("menu.status")},get sprint(){return n("menu.goal")},get calendar(){return n("menu.weekly")},get month(){return n("menu.monthly")},get agenda(){return n("menu.agenda")},get timeline(){return n("menu.timeline")}},hk=["list","calendar","month","card","kanban","sprint","timeline"],g5=["list","kanban"],x5=["list","card"];function mre(e){let t=f5(e);switch(t){case"notice":return{kind:t,viewOptions:[],showCreate:!0,createLabel:n("task.createNotice"),showGroupBy:!1,showSprintFilter:!1,showDateRange:!1,showHideCompleted:!0,forceFlatList:!0,columns:{notice:!0}};case"bug":return{kind:t,viewOptions:hk,showCreate:!0,createLabel:n("task.createBug"),showGroupBy:!0,showSprintFilter:!0,showDateRange:!1,showHideCompleted:!0,forceFlatList:!1,columns:{bug:!0}};case"support":return{kind:t,viewOptions:g5,showCreate:!1,createLabel:"",showGroupBy:!0,showSprintFilter:!1,showDateRange:!1,showHideCompleted:!0,forceFlatList:!1,columns:{support:!0,showProject:!1}};case"archive":return{kind:t,viewOptions:x5,showCreate:!1,createLabel:"",showGroupBy:!1,showSprintFilter:!1,showDateRange:!0,showHideCompleted:!1,forceFlatList:!0,columns:{showActions:!1}};case"done":return{kind:t,viewOptions:["list"],showCreate:!1,createLabel:"",showGroupBy:!1,showSprintFilter:!1,showDateRange:!0,showHideCompleted:!1,forceFlatList:!0,columns:{showActions:!1}};case"report":return{kind:t,viewOptions:[],showCreate:!1,createLabel:"",showGroupBy:!1,showSprintFilter:!1,showDateRange:!0,showHideCompleted:!1,forceFlatList:!0,columns:{}};default:return{kind:t,viewOptions:hk,showCreate:!0,createLabel:n("task.createTask"),showGroupBy:!0,showSprintFilter:!0,showDateRange:!1,showHideCompleted:!0,forceFlatList:!1,columns:e==="mine"?{showRequest:!1,confirmMode:"action"}:e==="sent"?{confirmMode:"time"}:{}}}}import{useMemo as b5}from"react";import{useKeyboardState as h5}from"@ehfuse/keyboard-state";var Tk=[{key:"g l",view:"list"},{key:"g b",view:"card"},{key:"g k",view:"kanban"},{key:"g s",view:"sprint"},{key:"g c",view:"calendar"},{key:"g m",view:"month"},{key:"g t",view:"timeline"}];function xre(e,t={}){let{enabled:o=!0,views:a}=t,{onCreateTask:r,onFocusSearch:i,onToggleHelp:l,onChangeView:s,onEscape:c}=e,u=a?a.join(","):"",m=b5(()=>{let d=[];if(r&&d.push({key:"n",callback:r,options:{preventDefault:!0}}),i&&d.push({key:"/",callback:i,options:{preventDefault:!0}}),l&&d.push({key:"shift+?",callback:l,options:{preventDefault:!0}}),c&&d.push({key:"escape",callback:c,options:{allowInEditable:!0}}),s)for(let p of yk(u?u.split(","):void 0))d.push({key:p.key,callback:()=>s(p.view),options:{preventDefault:!0}});return d},[r,i,l,s,c,u]);h5(o?m:[])}function yk(e){if(!e)return Tk;let t=new Set(e);return Tk.filter(o=>t.has(o.view))}function Hl(e){return[{keys:"N",description:n("task.createNew")},{keys:"/",description:n("common.search")},...yk(e).map(t=>({keys:t.key.split(" ").map(o=>o.toUpperCase()).join(" \u2192 "),description:n("task.showView",{value:kk[t.view]})})),{keys:"?",description:n("task.help")},{keys:"Esc",description:n("common.close")}]}var bre=Hl();import{Box as $l,Button as T5}from"@mui/material";import y5 from"@mui/icons-material/ArrowRightAlt";import{FormDialog as C5}from"@ehfuse/mui-form-dialog";import{useState as k5}from"react";var Ck={id:"concept",tabTitle:"manual.concept.tabTitle1",intro:"manual.concept.intro1",topics:[{title:"manual.concept.title1",lead:"manual.concept.lead1",steps:[{title:"manual.concept.title2",desc:"manual.concept.desc1"},{title:"manual.concept.title3",desc:"manual.concept.desc2"},{title:"manual.concept.title4",desc:"manual.concept.desc3"}]},{title:"manual.concept.title5",subtitle:"manual.concept.subtitle1",lead:"manual.concept.lead2",items:[{term:"manual.concept.term1",desc:"manual.concept.desc4"},{term:"manual.concept.term2",desc:"manual.concept.desc5"},{term:"manual.concept.term3",desc:"manual.concept.desc6"}]},{title:"manual.concept.title6",lead:"manual.concept.lead3",items:[{term:"manual.concept.term4",desc:"manual.concept.desc7"},{term:"manual.concept.term5",desc:"manual.concept.desc8"},{term:"manual.concept.term6",desc:"manual.concept.desc9"}]},{title:"manual.concept.title7",lead:"manual.concept.lead4",items:[{term:"manual.concept.term7",desc:"manual.concept.desc10"},{term:"manual.concept.term8",desc:"manual.concept.desc11"},{term:"manual.concept.term9",desc:"manual.concept.desc12"},{term:"manual.concept.term10",desc:"manual.concept.desc13"}]},{title:"manual.concept.title8",lead:"manual.concept.lead5",items:[{term:"manual.concept.term11",desc:"manual.concept.desc14"},{term:"manual.concept.term12",desc:"manual.concept.desc15"},{term:"manual.concept.term13",desc:"manual.concept.desc16"},{term:"manual.concept.term14",desc:"manual.concept.desc17"},{term:"manual.concept.term15",desc:"manual.concept.desc18"},{term:"manual.concept.term16",desc:"manual.concept.desc19"}]},{title:"manual.concept.title9",subtitle:"manual.concept.subtitle2",lead:"manual.concept.lead6",items:[{term:"manual.concept.term17",desc:"manual.concept.desc20"},{term:"manual.concept.term18",desc:"manual.concept.desc21"},{term:"manual.concept.term19",desc:"manual.concept.desc22"}]},{title:"manual.concept.title10",lead:"manual.concept.lead7",items:[{term:"manual.concept.term20",desc:"manual.concept.desc23"},{term:"manual.concept.term21",desc:"manual.concept.desc24"}]}]};var Sk={id:"roles",tabTitle:"manual.roles.tabTitle1",intro:"manual.roles.intro1",topics:[{title:"manual.roles.title1",subtitle:"manual.roles.subtitle1",lead:"manual.roles.lead1",items:[{term:"manual.roles.term1",desc:"manual.roles.desc1"},{term:"manual.roles.term2",desc:"manual.roles.desc2"},{term:"manual.roles.term3",desc:"manual.roles.desc3"},{term:"manual.roles.term4",desc:"manual.roles.desc4"},{term:"manual.roles.term5",desc:"manual.roles.desc5"}]},{title:"manual.roles.title2",subtitle:"manual.roles.subtitle2",lead:"manual.roles.lead2",items:[{term:"manual.roles.term6",desc:"manual.roles.desc6"},{term:"manual.roles.term7",desc:"manual.roles.desc7"},{term:"manual.roles.term8",desc:"manual.roles.desc8"},{term:"manual.roles.term9",desc:"manual.roles.desc9"},{term:"manual.roles.term10",desc:"manual.roles.desc10"},{term:"manual.roles.term11",desc:"manual.roles.desc11"}]},{title:"manual.roles.title3",subtitle:"manual.roles.subtitle3",lead:"manual.roles.lead3",items:[{term:"manual.roles.term12",desc:"manual.roles.desc12"},{term:"manual.roles.term13",desc:"manual.roles.desc13"},{term:"manual.roles.term14",desc:"manual.roles.desc14"},{term:"manual.roles.term15",desc:"manual.roles.desc15"},{term:"manual.roles.term16",desc:"manual.roles.desc16"}]},{title:"manual.roles.title4",lead:"manual.roles.lead4",items:[{term:"manual.roles.term17",desc:"manual.roles.desc17"},{term:"manual.roles.term18",desc:"manual.roles.desc18"},{term:"manual.roles.term19",desc:"manual.roles.desc19"},{term:"manual.roles.term20",desc:"manual.roles.desc20"},{term:"manual.roles.term21",desc:"manual.roles.desc21"},{term:"manual.roles.term22",desc:"manual.roles.desc22"},{term:"manual.roles.term23",desc:"manual.roles.desc23"}]},{title:"manual.roles.title5",lead:"manual.roles.lead5",items:[{term:"manual.roles.term24",desc:"manual.roles.desc24"},{term:"manual.roles.term25",desc:"manual.roles.desc25"},{term:"manual.roles.term26",desc:"manual.roles.desc26"},{term:"manual.roles.term27",desc:"manual.roles.desc27"}]},{title:"manual.roles.title6",feature:"support",lead:"manual.roles.lead6",items:[{term:"manual.roles.term28",desc:"manual.roles.desc28"},{term:"manual.roles.term29",desc:"manual.roles.desc29"},{term:"manual.roles.term30",desc:"manual.roles.desc30"},{term:"manual.roles.term31",desc:"manual.roles.desc31"}]}]};var vk={id:"basics",tabTitle:"manual.basics.tabTitle1",intro:"manual.basics.intro1",topics:[{title:"manual.basics.title1",lines:["manual.basics.line1","manual.basics.line2","manual.basics.line3","manual.basics.line4","manual.basics.line5"]},{title:"manual.basics.title2",subtitle:"manual.basics.subtitle1",lead:"manual.basics.lead1",lines:["manual.basics.line6","manual.basics.text1","manual.basics.text2","manual.basics.text3","manual.basics.text4","manual.basics.text5"]},{title:"manual.basics.title3",lines:["manual.basics.line7","manual.basics.line8","manual.basics.line9"]},{title:"manual.basics.title4",lines:["manual.basics.line10","manual.basics.line11"]},{title:"manual.basics.title5",lines:["manual.basics.line12","manual.basics.line13"]},{title:"manual.basics.title6",subtitle:"manual.basics.subtitle2",lines:["manual.basics.line14","manual.basics.line15","manual.basics.line16","manual.basics.line17"]},{title:"manual.basics.title7",lines:["manual.basics.line18","manual.basics.line19","manual.basics.line20"]}]};var Bk={id:"notify",tabTitle:"manual.notify.tabTitle1",intro:"manual.notify.intro1",topics:[{title:"manual.notify.title1",items:[{term:"manual.notify.term1",desc:"manual.notify.desc1"},{term:"manual.notify.term2",desc:"manual.notify.desc2"},{term:"manual.notify.term3",desc:"manual.notify.desc3"},{term:"manual.notify.term4",desc:"manual.notify.desc4"},{term:"manual.notify.term5",desc:"manual.notify.desc5"},{term:"manual.notify.term6",desc:"manual.notify.desc6"},{term:"manual.notify.term7",desc:"manual.notify.desc7"}]},{title:"manual.notify.title2",items:[{term:"manual.notify.term8",desc:"manual.notify.desc8"},{term:"manual.notify.term9",desc:"manual.notify.desc9"},{term:"manual.notify.term10",desc:"manual.notify.desc10"},{term:"manual.notify.term11",desc:"manual.notify.desc11"},{term:"manual.notify.term12",desc:"manual.notify.desc12"},{term:"manual.notify.term13",desc:"manual.notify.desc13"},{term:"manual.notify.term14",desc:"manual.notify.desc14"}]},{title:"manual.notify.title3",lead:"manual.notify.lead1",items:[{term:"manual.notify.term15",desc:"manual.notify.desc15"},{term:"manual.notify.term16",desc:"manual.notify.desc16"},{term:"manual.notify.term17",desc:"manual.notify.desc17"}]},{title:"manual.notify.title4",lead:"manual.notify.lead2",items:[{term:"manual.notify.term18",desc:"manual.notify.desc18"},{term:"manual.notify.term19",desc:"manual.notify.desc19"},{term:"manual.notify.term20",desc:"manual.notify.desc20"},{term:"manual.notify.term21",desc:"manual.notify.desc21"},{term:"manual.notify.term22",desc:"manual.notify.desc22"}]},{title:"manual.notify.title5",lead:"manual.notify.lead3",items:[{term:"manual.notify.term23",desc:"manual.notify.desc23"},{term:"manual.notify.term24",desc:"manual.notify.desc24"},{term:"manual.notify.term25",desc:"manual.notify.desc25"},{term:"manual.notify.term26",desc:"manual.notify.desc26"},{term:"manual.notify.term27",desc:"manual.notify.desc27"}]},{title:"manual.notify.title6",items:[{term:"manual.notify.term28",desc:"manual.notify.desc28"},{term:"manual.notify.term29",desc:"manual.notify.desc29"},{term:"manual.notify.term30",desc:"manual.notify.desc30"}]},{title:"manual.notify.title7",items:[{term:"manual.notify.term31",desc:"manual.notify.desc31"},{term:"manual.notify.term32",desc:"manual.notify.desc32"},{term:"manual.notify.term33",desc:"manual.notify.desc33"},{term:"manual.notify.term34",desc:"manual.notify.desc34"},{term:"manual.notify.term35",desc:"manual.notify.desc35"},{term:"manual.notify.term36",desc:"manual.notify.desc36"},{term:"manual.notify.term37",desc:"manual.notify.desc37"}]}]};var _k={id:"more",tabTitle:"manual.more.tabTitle1",intro:"manual.more.intro1",topics:[{title:"manual.more.title1",lead:"manual.more.lead1",lines:["manual.more.line1","manual.more.text1","manual.more.text2"]},{title:"manual.more.title2",lead:"manual.more.lead2",items:[{term:"manual.more.term1",desc:"manual.more.desc1"},{term:"manual.more.term2",desc:"manual.more.desc2"},{term:"manual.more.term3",desc:"manual.more.desc3"},{term:"manual.more.term4",desc:"manual.more.desc4"},{term:"manual.more.term5",desc:"manual.more.desc5"},{term:"manual.more.term6",desc:"manual.more.desc6"}]},{title:"manual.more.title3",lines:["manual.more.line2","manual.more.line3"]},{title:"manual.more.title4",feature:"timeline",lines:["manual.more.line4"]},{title:"manual.more.title5",feature:"charts",lines:["manual.more.line5"]},{title:"manual.more.title6",lines:["manual.more.line6","manual.more.line7","manual.more.line8"]},{title:"manual.more.title7",feature:"label",lines:["manual.more.line9"]},{title:"manual.more.title8",lines:["manual.more.line10","manual.more.line11","manual.more.line12","manual.more.line13"]},{title:"manual.more.title9",lines:["manual.more.line14","manual.more.line15"]},{title:"manual.more.title10",subtitle:"manual.more.subtitle1",lead:"manual.more.lead3",lines:["manual.more.line16","manual.more.line17","manual.more.line18","manual.more.line19"]},{title:"manual.more.title11",lines:["manual.more.line20","manual.more.line21","manual.more.line22"]},{title:"manual.more.title12",feature:"project",lines:["manual.more.line23","manual.more.line24"]},{title:"manual.more.title13",feature:"sprint",lines:["manual.more.line25","manual.more.line26"]},{title:"manual.more.title14",lines:["manual.more.line27","manual.more.line28","manual.more.line29"]},{title:"manual.more.title15",lines:["manual.more.line30"]},{title:"manual.more.title16",feature:"bug",lines:["manual.more.line31","manual.more.line32"]},{title:"manual.more.title17",feature:"support",lines:["manual.more.line33","manual.more.line34"]},{title:"manual.more.title18",feature:"report",lines:["manual.more.line35"]}]};var Ik={id:"calendar",tabTitle:"manual.calendar.tabTitle1",intro:"manual.calendar.intro1",topics:[{title:"manual.calendar.title1",lead:"manual.calendar.lead1",items:[{term:"manual.calendar.term1",desc:"manual.calendar.desc1"},{term:"manual.calendar.term2",desc:"manual.calendar.desc2"}]},{title:"manual.calendar.title2",lines:["manual.calendar.line1","manual.calendar.line2","manual.calendar.line3","manual.calendar.line4"]},{title:"manual.calendar.title3",lines:["manual.calendar.line5","manual.calendar.line6","manual.calendar.line7","manual.calendar.line8"]}]};var wk={id:"shortcuts",tabTitle:"manual.shortcuts.tabTitle1",topics:[]};var Wl=[Ck,Sk,vk,Bk,_k,Ik,wk];function Dk(e=Wl){let t=o=>o&&n(o);return e.map(o=>({...o,tabTitle:n(o.tabTitle),intro:t(o.intro),topics:o.topics.map(a=>({...a,title:n(a.title),subtitle:t(a.subtitle),lead:t(a.lead),steps:a.steps?.map(r=>({title:n(r.title),desc:n(r.desc)})),items:a.items?.map(r=>({term:n(r.term),desc:n(r.desc)})),lines:a.lines?.map(r=>n(r))}))}))}function Ek({open:e,onClose:t}){return{modals:{dialog:ro({modalIdPrefix:"taskbox-shortcut-help-dialog",open:e,onClose:t})}}}function Rk({open:e,onClose:t,features:o,initialTab:a}){let[r,i]=k5(0);return{modals:{dialog:ro({modalIdPrefix:"taskbox-manual-dialog",open:e,onClose:t,onOpen:()=>{let c=Wl.filter(u=>!u.feature||o[u.feature]!==!1).findIndex(u=>u.id===a);i(Math.max(0,c))}})},activeTabIndex:r,setActiveTabIndex:i}}import{jsx as aa,jsxs as Pk}from"react/jsx-runtime";function S5({keys:e}){return aa($l,{sx:{display:"flex",alignItems:"center",gap:.5,justifyContent:"flex-end"},children:e.split(" \u2192 ").map((t,o)=>Pk($l,{sx:{display:"flex",alignItems:"center",gap:.5},children:[o>0?aa(y5,{sx:{fontSize:18,color:"#9a9a97"}}):null,aa($l,{component:"span",sx:{minWidth:32,height:32,px:.75,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:13.5,fontWeight:700,color:"#37352f",bgcolor:"#f4f4f2",border:"1px solid #e0dfdb",borderRadius:1,fontVariantNumeric:"tabular-nums"},children:t})]},`${t}-${o}`))})}function Kre({open:e,onClose:t,views:o}){L();let{modals:a}=Ek({open:e,onClose:t}),r=Hl(o);return aa(C5,{open:a.dialog.isOpen,onClose:a.dialog.close,maxWidth:"xs",title:n("shortcut.title"),locale:Se(),titleIcons:{delete:{visible:!1}},tabs:{visible:!1},sectionContentPaddingTop:0,sections:[{id:"shortcuts",showTitle:!1,children:aa($l,{sx:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:2,rowGap:1.25,alignItems:"center",fontSize:14,color:"#37352f"},children:r.map(i=>Pk($l,{sx:{display:"contents"},children:[aa(S5,{keys:i.keys}),aa("span",{children:i.description})]},i.keys))})}],actions:{showCancelButton:!1,right:aa(T5,{variant:"contained",onClick:a.dialog.close,children:n("common.close")})}})}import{Fragment as Dp}from"react";import{Box as Pt,Button as v5}from"@mui/material";import B5 from"@mui/icons-material/ArrowRightAlt";import _5 from"@mui/icons-material/ChevronRightRounded";import I5 from"@mui/icons-material/ArrowForward";import{FormDialog as w5}from"@ehfuse/mui-form-dialog";import{Fragment as A5,jsx as Ge,jsxs as Rr}from"react/jsx-runtime";function um(e){return e.split(/(\*\*[^*]+\*\*|\s*(?:→|->)\s*)/g).filter(o=>o.length>0).map((o,a)=>o.startsWith("**")&&o.endsWith("**")?Ge(Pt,{component:"strong",sx:{fontWeight:700},children:o.slice(2,-2)},a):/^\s*(?:→|->)\s*$/.test(o)?Ge(I5,{sx:{fontSize:"1em",verticalAlign:"-0.15em",mx:.5,color:"text.secondary"}},a):Ge(Dp,{children:o},a))}function D5({keys:e}){let t=be();return Ge(Pt,{sx:{display:"flex",alignItems:"center",gap:.5,justifyContent:"flex-end"},children:e.split(" \u2192 ").map((o,a)=>Rr(Pt,{sx:{display:"flex",alignItems:"center",gap:.5},children:[a>0?Ge(B5,{sx:{fontSize:20,color:t.colors.textMuted}}):null,Ge(Pt,{component:"span",sx:{minWidth:36,height:36,px:1,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:15,fontWeight:600,color:t.colors.textPrimary,bgcolor:t.colors.surfaceSubtle,border:`1px solid ${t.colors.border}`,borderRadius:1,fontVariantNumeric:"tabular-nums"},children:o})]},`${o}-${a}`))})}function E5({steps:e}){let t=be();return Ge(Pt,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, minmax(0, 1fr))"},gap:{xs:1,sm:2},mt:1.5},children:e.map((o,a)=>Rr(Pt,{sx:{position:"relative",minWidth:0,px:1.75,py:2.5,borderRadius:2,bgcolor:t.colors.surfaceSubtle,border:`1px solid ${t.colors.border}`,"&::before":{content:'""',position:"absolute",top:-1,left:12,right:12,height:3,borderRadius:"0 0 3px 3px",bgcolor:t.colors.accent,opacity:.85},"&::after":a<e.length-1?{content:'""',display:{xs:"none",sm:"block"},position:"absolute",top:"50%",right:-12,width:8,height:8,mt:"-4px",borderTop:`2px solid ${t.colors.borderStrong}`,borderRight:`2px solid ${t.colors.borderStrong}`,transform:"rotate(45deg)"}:void 0},children:[Rr(Pt,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[Ge(Pt,{sx:{flexShrink:0,width:26,height:26,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:500,lineHeight:1,bgcolor:t.colors.accent,color:t.colors.accentContrast,fontVariantNumeric:"tabular-nums"},children:a+1}),Ge(Pt,{sx:{minWidth:0,fontSize:20,fontWeight:500,color:t.colors.textStrong,lineHeight:1.3,letterSpacing:"-0.01em"},children:o.title})]}),Ge(Pt,{sx:{mt:1.5,fontSize:15,lineHeight:1.5,color:t.colors.textPrimary,wordBreak:"keep-all"},children:o.desc})]},o.title))})}var Mk="70vh",R5=24,P5=44,Ok=`calc((${Mk} - ${R5*2+P5}px) / var(--mfd-font-scale, 1))`,O5=148;function M5({items:e}){let t=be();return Ge(Pt,{sx:{mt:1.5,display:"grid",gridTemplateColumns:{xs:"1fr",sm:`${O5}px minmax(0, 1fr)`},fontSize:15,lineHeight:1.6,color:t.colors.textPrimary,border:`1px solid ${t.colors.border}`,borderRadius:1.5,overflow:"hidden","& > *":{px:1.5,py:1.35,borderTop:`1px solid ${t.colors.border}`},"& > *:nth-of-type(even)":{borderLeft:{sm:`1px solid ${t.colors.border}`}},"& > *:nth-of-type(1)":{borderTop:0},"& > *:nth-of-type(2)":{borderTop:{xs:`1px solid ${t.colors.border}`,sm:0}}},children:e.map(o=>Rr(Dp,{children:[Ge(Pt,{sx:{fontWeight:500,color:t.colors.textStrong,wordBreak:"keep-all",bgcolor:t.colors.surfaceSubtle,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center"},children:o.term}),Ge(Pt,{sx:{wordBreak:"keep-all"},children:um(o.desc)})]},o.term))})}function L5({topic:e}){L();let t=be();return Rr(Pt,{component:"section",sx:{py:{xs:3,sm:4},borderBottom:`1px solid ${t.colors.border}`,"&:last-of-type":{pb:0,borderBottom:0}},children:[Rr(Pt,{component:"h3",sx:{m:0,mb:1.75,fontSize:24,fontWeight:500,letterSpacing:"-0.01em",lineHeight:1.3,color:t.colors.textStrong,wordBreak:"keep-all",display:"flex",alignItems:"center",flexWrap:"wrap"},children:[e.title,e.subtitle?Rr(A5,{children:[Ge(_5,{sx:{fontSize:22,color:t.colors.textMuted,mx:1,flexShrink:0}}),Ge(Pt,{component:"span",sx:{fontSize:18,fontWeight:400,color:t.colors.textPrimary},children:e.subtitle})]}):null]}),e.lead?Ge(Pt,{sx:{fontSize:15.5,lineHeight:1.65,color:t.colors.textPrimary,wordBreak:"keep-all"},children:um(e.lead)}):null,e.steps?.length?Ge(E5,{steps:e.steps}):null,e.items?.length?Ge(M5,{items:e.items}):null,e.lines?.length?Ge(Pt,{component:"ul",sx:{m:0,mt:e.lead||e.steps||e.items?1.25:0,pl:2.5,display:"flex",flexDirection:"column",gap:.5,fontSize:15,lineHeight:1.6,color:t.colors.textPrimary,wordBreak:"keep-all"},children:e.lines.map((o,a)=>Ge("li",{children:um(o)},a))}):null]})}function aae({open:e,onClose:t,views:o,features:a={},initialTab:r}){L();let i=be(),{modals:l,activeTabIndex:s,setActiveTabIndex:c}=Rk({open:e,onClose:t,features:a,initialTab:r}),u=p=>!p||a[p]!==!1,m=Hl(o),d=Dk(Wl).filter(p=>u(p.feature)).map(p=>({id:p.id,tabTitle:p.tabTitle,showTitle:!1,children:p.id==="shortcuts"?Ge(Pt,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:Ok,maxHeight:Ok,px:.5},children:Ge(Pt,{sx:{display:"grid",gridTemplateColumns:"auto auto",columnGap:2.5,rowGap:1.75,alignItems:"center",fontSize:17,fontWeight:500,color:i.colors.textPrimary},children:m.map(f=>Rr(Dp,{children:[Ge(D5,{keys:f.keys}),Ge("span",{children:f.description})]},f.keys))})}):Rr(Pt,{sx:{display:"flex",flexDirection:"column",px:.5},children:[p.intro?Ge(Pt,{sx:{p:2,borderRadius:2,bgcolor:i.colors.accentSoft,color:i.colors.textStrong,fontSize:15.5,lineHeight:1.65,wordBreak:"keep-all"},children:um(p.intro)}):null,p.topics.filter(f=>u(f.feature)).map(f=>Ge(L5,{topic:f},f.title))]})}));return Ge(w5,{open:l.dialog.isOpen,onClose:l.dialog.close,maxWidth:"md",title:n("manual.dialogTitle"),locale:Se(),titleIcons:{delete:{visible:!1}},tabs:{visible:!0,switchContent:!0},activeTabValue:s,onTabChange:c,fixedHeight:"70vh",maxContentHeight:Mk,sectionContentPaddingTop:0,fontScale:{enabled:!0},fontScaleKey:"taskbox-manual",sections:d,actions:{showCancelButton:!1,right:Ge(v5,{variant:"contained",onClick:l.dialog.close,sx:{minWidth:80},children:n("common.close")})}})}import{useEffect as F5,useRef as H5,useState as zk}from"react";import{Box as Ot,Button as Mn,IconButton as Rp,Menu as Nk,MenuItem as Fk,Switch as W5,Tooltip as Hk}from"@mui/material";import{FormDialog as Wk}from"@ehfuse/mui-form-dialog";import Pp from"@mui/icons-material/Add";import $5 from"@mui/icons-material/ArrowRightAlt";import V5 from"@mui/icons-material/BoltOutlined";import K5 from"@mui/icons-material/Close";import U5 from"@mui/icons-material/EditOutlined";import{ClearTextField as Vl,LabelSelect as Zo}from"@ehfuse/mui-form-controls";import{useEffect as q5,useRef as Lk}from"react";import{useGlobalForm as z5,useModal as N5}from"@ehfuse/forma";import{ErrorAlert as Ak}from"@ehfuse/alerts";var Ii=[{value:"due_date",get label(){return n("col.due")}},{value:"start_date",get label(){return n("col.startTime")}},{value:"priority",get label(){return n("col.priority")}},{value:"manager_account_seq",get label(){return n("col.owner")}},{value:"receiver_account_seqs",get label(){return n("col.cc")}},{value:"label_keys",get label(){return n("dialog.label")}},{value:"group_seq",get label(){return n("col.project")}},{value:"sprint_seq",get label(){return n("col.goal")}},{value:"content",get label(){return n("common.content")}},{value:"note",get label(){return n("col.note")}}];function dm(){return{editSeq:0,name:"",trigger:"created",enabled:!0,sort_no:0,condition:{},action:{}}}function Ep(e){return e.filter(t=>!t.archived).map(t=>({value:String(Pn(t.key)),label:t.label}))}function pm(e){return e.map(t=>({value:t.key,label:t.name}))}function qk(e){L();let t=Lk(e);t.current=e;let o=z5({formId:Ie("taskbox-rule-form"),initialValues:dm(),onValidate:k=>k.name.trim()?Object.keys(k.action??{}).length===0?(Ak({message:n("rule.addAction")}),!1):!0:(Ak({message:n("rule.enterName")}),!1),onSubmit:async k=>{let{editSeq:_,...D}=k,F=_>0?D.sort_no:t.current.rules.reduce((C,y)=>Math.max(C,y.sort_no),0)+1,R=_>0?await t.current.onUpdate(_,{...D,sort_no:F}):await t.current.onCreate({...D,sort_no:F});return R&&a.form.close(),R}}),a={list:pn({modalId:Ie("taskbox-rule-manage"),open:e.open,onClose:()=>t.current.onClose()}),form:N5({modalId:Ie("taskbox-rule-edit"),onClose:()=>o.setFormValues(dm())})},r=Lk(a.form);r.current=a.form,q5(()=>{if(e.open)return;let k=window.setTimeout(()=>{r.current.isOpen&&r.current.close(),o.setFormValues(dm())},500);return()=>window.clearTimeout(k)},[e.open]);let i=()=>({...o.getFormValue("condition")??{}}),l=()=>({...o.getFormValue("action")??{}}),s=(k,_)=>{let D=i();_===""||_===void 0||_===null?delete D[k]:D[k]=_,o.setFormValue("condition",D)},c=(k,_)=>{let D=l();_===""||_===void 0||_===null?delete D[k]:D[k]=_,o.setFormValue("action",D)},u=()=>{o.setFormValues(dm()),a.form.open()},m=k=>{o.setFormValues({editSeq:k.seq,name:k.name,trigger:k.trigger,enabled:k.enabled,sort_no:k.sort_no,condition:{...k.condition,...k.trigger==="field_changed"&&k.condition.changed_field===void 0?{changed_field:Ii[0]?.value??""}:{}},action:{...k.action}}),a.form.open()},d=k=>{let _=i();k!=="status_changed"&&(delete _.from_status,delete _.to_status),k!=="overdue"&&delete _.overdue_days,k!=="field_changed"&&delete _.changed_field,k!=="commented"&&(delete _.comment_contains,delete _.comment_by_others),k==="field_changed"&&_.changed_field===void 0&&(_.changed_field=Ii[0]?.value??""),o.setFormValues({trigger:k,condition:_})},p=async k=>{let _=t.current.onPickAccount;if(!_)return;let D=i(),F=k==="manager_account"?D.manager_account_seq??0:D.receiver_account_seq??0,R=await _(F,k==="manager_account"?n("col.owner"):n("col.cc"));if(!R)return;let C=i();k==="manager_account"?(C.manager_account_seq=R.accountSeq,C.manager_name=R.name):(C.receiver_account_seq=R.accountSeq,C.receiver_name=R.name),o.setFormValue("condition",C)},f=k=>{let _=Ep(t.current.customTabs),D=pm(t.current.statusOptions);k==="group_seq"?s("group_seq",Number(_[0]?.value)||0):k==="kind"?s("is_bug",!0):k==="priority"?s("priority","high"):k==="label_key"?s("label_key",D[0]?.value??""):k==="title_contains"?o.setFormValue("condition",{...i(),title_contains:""}):k==="manager_empty"?s("manager_empty",!0):k==="manager_account"||k==="receiver_account"?p(k):k==="from_status"?s("from_status",Mo[0]?.key??""):k==="to_status"?s("to_status",Mo[0]?.key??""):k==="changed_field"?s("changed_field",Ii[0]?.value??""):k==="comment_contains"?o.setFormValue("condition",{...i(),comment_contains:""}):k==="comment_by_others"?s("comment_by_others",!0):k==="overdue_days"&&s("overdue_days",1)},g=k=>{if(k==="kind"){s("is_bug",""),s("is_event","");return}if(k==="manager_account"){s("manager_account_seq",""),s("manager_name","");return}if(k==="receiver_account"){s("receiver_account_seq",""),s("receiver_name","");return}s(k,"")},x=k=>{s("is_bug",k?!0:""),s("is_event",k?"":!0)},h=async k=>{let _=t.current.onPickAccount;if(!_)return;let D=l(),F=k==="assign_manager"?D.assign_manager_account_seq??0:k==="add_receiver"?D.add_receiver_account_seq??0:D.notify_account_seq??0,R=await _(F,k==="assign_manager"?n("col.owner"):k==="add_receiver"?n("col.cc"):n("rule.notifyTarget"));if(!R)return;let C=l();k==="assign_manager"?(C.assign_manager_account_seq=R.accountSeq,C.assign_manager_name=R.name):k==="add_receiver"?(C.add_receiver_account_seq=R.accountSeq,C.add_receiver_name=R.name):(C.notify_account_seq=R.accountSeq,C.notify_name=R.name),o.setFormValue("action",C)};return{form:o,modals:a,actions:{openCreate:u,openEdit:m,changeTrigger:d,setCondition:s,setAction:c,addCondition:f,removeCondition:g,changeKind:x,pickConditionAccount:p,addAction:k=>{let _=pm(t.current.statusOptions);if(k==="set_status")c("set_status",Mo[0]?.key??"");else if(k==="set_priority")c("set_priority","high");else if(k==="add_label_key")c("add_label_key",_[0]?.value??"");else if(k==="apply_content_template"){let D=t.current.contentTemplates[0];o.setFormValue("action",{...l(),apply_content_template_seq:D?.seq??0,apply_content_template_name:D?.name??""})}else h(k)},removeAction:k=>{k==="assign_manager"?(c("assign_manager_account_seq",""),c("assign_manager_name","")):k==="add_receiver"?(c("add_receiver_account_seq",""),c("add_receiver_name","")):k==="apply_content_template"?(c("apply_content_template_seq",""),c("apply_content_template_name","")):k==="notify"?(c("notify_account_seq",""),c("notify_name",""),c("notify_message","")):c(k,"")},pickAccountFor:h,selectContentTemplate:k=>{let _=t.current.contentTemplates.find(D=>String(D.seq)===String(k));o.setFormValue("action",{...l(),apply_content_template_seq:_?.seq??0,apply_content_template_name:_?.name??""})},toggleRule:(k,_)=>t.current.onToggle(k,_),removeRule:k=>t.current.onRemove(k)}}}import{Fragment as Vk,jsx as de,jsxs as gn}from"react/jsx-runtime";var Op=[{value:"created",get label(){return n("rule.trigger.created")},get hint(){return n("rule.trigger.createdHint")}},{value:"status_changed",get label(){return n("rule.trigger.statusChanged")},get hint(){return n("rule.trigger.statusChangedHint")}},{value:"commented",get label(){return n("rule.trigger.commented")},get hint(){return n("rule.trigger.commentedHint")}},{value:"manager_assigned",get label(){return n("rule.trigger.managerAssigned")},get hint(){return n("rule.trigger.managerAssignedHint")}},{value:"attachment_added",get label(){return n("rule.trigger.attached")},get hint(){return n("rule.trigger.attachedHint")}},{value:"field_changed",get label(){return n("rule.trigger.fieldChanged")},get hint(){return n("rule.trigger.fieldChangedHint")}},{value:"overdue",get label(){return n("rule.trigger.overdue")},get hint(){return n("rule.trigger.overdueHint")}}],gm=[{value:"high",get label(){return n("priority.high")}},{value:"medium",get label(){return n("priority.medium")}},{value:"low",get label(){return n("priority.low")}}];function fm(e){return Mo.find(t=>t.key===e)?.name??e}function G5(e,t,o){let{condition:a,action:r}=e,i=[];if(a.group_seq){let c=t.find(u=>Pn(u.key)===a.group_seq);i.push(n("rule.sum.project",{label:c?.label??`#${a.group_seq}`}))}a.is_bug===!0&&i.push(n("rule.sum.bugOnly")),a.is_event===!0&&i.push(n("rule.sum.eventOnly")),a.priority&&i.push(n("rule.sum.priority",{value:gm.find(c=>c.value===a.priority)?.label})),a.label_key&&i.push(n("rule.sum.label",{value:o.find(c=>c.key===a.label_key)?.name??a.label_key})),a.title_contains&&i.push(n("rule.sum.titleContains",{title_contains:a.title_contains})),a.status&&i.push(n("rule.sum.status",{value:fm(a.status)})),a.from_status&&i.push(n("rule.sum.fromStatus",{value:fm(a.from_status)})),a.to_status&&i.push(n("rule.sum.toStatus",{value:fm(a.to_status)})),a.manager_empty===!0&&i.push(n("rule.sum.noOwner")),a.manager_empty===!1&&i.push(n("rule.sum.hasOwner")),a.manager_account_seq&&i.push(n("rule.sum.owner",{manager_name:a.manager_name||n("rule.accountNo",{manager_account_seq:a.manager_account_seq})})),a.receiver_account_seq&&i.push(n("rule.sum.ccIncludes",{receiver_name:a.receiver_name||n("rule.accountNo2",{receiver_account_seq:a.receiver_account_seq})})),a.changed_field&&i.push(n("rule.sum.fieldChanged",{value:Ii.find(c=>c.value===a.changed_field)?.label??a.changed_field})),a.comment_contains&&i.push(n("rule.sum.commentContains",{comment_contains:a.comment_contains})),a.comment_by_others===!0&&i.push(n("rule.sum.commentByOthers")),typeof a.overdue_days=="number"&&i.push(n("rule.sum.overdueDays",{overdue_days:a.overdue_days}));let l=[];r.set_status&&l.push(n("rule.sum.status",{value:fm(r.set_status)})),r.set_priority&&l.push(n("rule.sum.priority",{value:gm.find(c=>c.value===r.set_priority)?.label})),r.assign_manager_account_seq&&l.push(n("rule.sum.setOwner",{assign_manager_name:r.assign_manager_name||n("rule.specified")})),r.add_receiver_account_seq&&l.push(n("rule.sum.addCc",{add_receiver_name:r.add_receiver_name||n("rule.specified")})),r.add_label_key&&l.push(n("rule.sum.addLabel",{value:o.find(c=>c.key===r.add_label_key)?.name??r.add_label_key})),r.apply_content_template_seq&&l.push(n("rule.sum.applyTemplate",{apply_content_template_name:r.apply_content_template_name||n("rule.specified")})),r.notify_account_seq&&l.push(n("rule.sum.notify"));let s=Op.find(c=>c.value===e.trigger)?.label??e.trigger;return{left:i.length>0?`${s} \xB7 ${i.join(", ")}`:s,right:l.join(", ")||n("rule.sum.noAction")}}var $k={fontSize:16,fontWeight:700,color:"#37352f"},j5={display:"flex",alignItems:"center",gap:1},Y5={width:104,flexShrink:0,fontSize:16,color:"#37352f"};function Pae({open:e,rules:t,customTabs:o,statusOptions:a,contentTemplates:r=[],onPickAccount:i,onClose:l,onCreate:s,onUpdate:c,onToggle:u,onRemove:m}){L();let d=qk({open:e,rules:t,customTabs:o,statusOptions:a,contentTemplates:r,onPickAccount:i,onClose:l,onCreate:s,onUpdate:c,onToggle:u,onRemove:m}),{form:p,actions:f}=d,g=d.modals.list,x=d.modals.form,{setCondition:h,setAction:E,removeCondition:b,removeAction:B,pickConditionAccount:T,pickAccountFor:z,changeTrigger:k}=f,_=p.isSubmitting,D=H5(null),[F,R]=zk(null),[C,y]=zk(null);F5(()=>{if(!x.isOpen)return;let $=window.setTimeout(()=>D.current?.focus(),120);return()=>window.clearTimeout($)},[x.isOpen]);let I=Number(p.useValue("editSeq")??0)>0,S=p.useValue("trigger")??"created",M=pm(a),w=Mo.map($=>({value:$.key,label:$.name})),q=Ep(o),v=p.useValue("condition")??{},O=p.useValue("action")??{},j=v.is_bug!==void 0||v.is_event!==void 0,V=[...v.group_seq===void 0&&q.length>0?[{key:"group_seq",label:n("rule.cond.project")}]:[],...j?[]:[{key:"kind",label:n("rule.cond.kind")}],...v.priority===void 0?[{key:"priority",label:n("rule.cond.priority")}]:[],...v.label_key===void 0&&M.length>0?[{key:"label_key",label:n("rule.cond.label")}]:[],...v.title_contains===void 0?[{key:"title_contains",label:n("rule.cond.titleContains")}]:[],...v.manager_empty===void 0?[{key:"manager_empty",label:n("rule.cond.ownerEmpty")}]:[],...i&&v.manager_account_seq===void 0?[{key:"manager_account",label:n("rule.cond.owner")}]:[],...i&&v.receiver_account_seq===void 0?[{key:"receiver_account",label:n("rule.cond.ccIncludes")}]:[],...S==="status_changed"&&v.from_status===void 0?[{key:"from_status",label:n("rule.cond.fromStatus")}]:[],...S==="status_changed"&&v.to_status===void 0?[{key:"to_status",label:n("rule.cond.toStatus")}]:[],...S==="field_changed"&&v.changed_field===void 0?[{key:"changed_field",label:n("rule.cond.fieldChanged")}]:[],...S==="commented"&&v.comment_contains===void 0?[{key:"comment_contains",label:n("rule.cond.commentContains")}]:[],...S==="commented"&&v.comment_by_others===void 0?[{key:"comment_by_others",label:n("rule.cond.commentByOthers")}]:[],...S==="overdue"&&v.overdue_days===void 0?[{key:"overdue_days",label:n("rule.cond.overdueDays")}]:[]],Z=$=>{R(null),f.addCondition($)},ie=[...O.set_status===void 0?[{key:"set_status",label:n("rule.act.setStatus")}]:[],...O.set_priority===void 0?[{key:"set_priority",label:n("rule.act.setPriority")}]:[],...O.add_label_key===void 0&&M.length>0?[{key:"add_label_key",label:n("rule.act.addLabel")}]:[],...i&&O.assign_manager_account_seq===void 0?[{key:"assign_manager",label:n("rule.act.assignOwner")}]:[],...i&&O.add_receiver_account_seq===void 0?[{key:"add_receiver",label:n("rule.act.addCc")}]:[],...r.length>0&&O.apply_content_template_seq===void 0?[{key:"apply_content_template",label:n("rule.act.applyTemplate")}]:[],...i&&O.notify_account_seq===void 0?[{key:"notify",label:n("rule.act.notify")}]:[]],ue=$=>{y(null),f.addAction($)},K=($,G,ae,Re)=>gn(Ot,{sx:j5,children:[de(Ot,{sx:Y5,children:$}),gn(Ot,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:Re?"column":"row",alignItems:Re?"stretch":"center",gap:Re?.5:1},children:[G,Re?de(Ot,{sx:{fontSize:13.5,color:"#37352f"},children:Re}):null]}),de(Hk,{title:n("rule.removeRow"),arrow:!0,disableInteractive:!0,children:de(Rp,{size:"small","aria-label":n("rule.removeRowAria",{label:$}),onClick:ae,children:de(K5,{sx:{fontSize:16}})})})]}),te=()=>gn(Ot,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[de(Vl,{size:"medium",label:n("rule.ruleName"),inputRef:D,placeholder:n("rule.ruleNamePlaceholder"),name:"name",form:p}),de(Ot,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap"},children:Op.map($=>{let G=S===$.value;return de(Mn,{disableElevation:!0,variant:G?"contained":"outlined",color:G?"primary":"inherit",onClick:()=>k($.value),sx:{borderRadius:99,px:1.75,...G?{}:{color:"#57564f",borderColor:"#d9d9d6"}},children:$.label},$.value)})}),de(Ot,{sx:{fontSize:13,color:"#787774",mt:-.5},children:Op.find($=>$.value===S)?.hint}),gn(Ot,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[de(Ot,{sx:$k,children:n("rule.whenTitle")}),V.length>0?de(Mn,{size:"small",startIcon:de(Pp,{sx:{fontSize:16}}),onClick:$=>R($.currentTarget),sx:{color:"#2563eb",minWidth:0},children:n("rule.addCondition")}):null]}),v.group_seq!==void 0?K(n("col.project"),de(Zo,{size:"medium",fullWidth:!0,label:"",value:String(v.group_seq),options:q,onChange:$=>h("group_seq",Number($.target.value)||"")}),()=>b("group_seq")):null,j?K(n("col.kind"),de(Zo,{size:"medium",fullWidth:!0,label:"",value:v.is_bug?"bug":"event",options:[{value:"bug",label:n("rule.sum.bugOnly")},{value:"event",label:n("rule.sum.eventOnly")}],onChange:$=>{let G=$.target.value==="bug";h("is_bug",G?!0:""),h("is_event",G?"":!0)}}),()=>b("kind")):null,v.priority!==void 0?K(n("col.priority"),de(Zo,{size:"medium",fullWidth:!0,label:"",name:"condition.priority",form:p,options:gm}),()=>b("priority")):null,v.label_key!==void 0?K(n("dialog.label"),de(Zo,{size:"medium",fullWidth:!0,label:"",name:"condition.label_key",form:p,options:M}),()=>b("label_key")):null,v.title_contains!==void 0?K(n("common.title"),de(Vl,{size:"medium",fullWidth:!0,placeholder:n("rule.titleWordPlaceholder"),name:"condition.title_contains",form:p}),()=>b("title_contains")):null,v.manager_empty!==void 0?K(n("col.owner"),de(Zo,{size:"medium",fullWidth:!0,label:"",value:v.manager_empty?"empty":"assigned",options:[{value:"empty",label:n("common.none")},{value:"assigned",label:n("rule.present")}],onChange:$=>h("manager_empty",$.target.value==="empty")}),()=>b("manager_empty")):null,v.manager_account_seq!==void 0?K(n("col.owner"),de(Mn,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{T("manager_account")},children:v.manager_name||n("rule.accountNo",{manager_account_seq:v.manager_account_seq})}),()=>b("manager_account")):null,v.receiver_account_seq!==void 0?K(n("col.cc"),de(Mn,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{T("receiver_account")},children:v.receiver_name||n("rule.accountNo2",{receiver_account_seq:v.receiver_account_seq})}),()=>b("receiver_account")):null,v.from_status!==void 0?K(n("rule.fromStatus"),de(Zo,{size:"medium",fullWidth:!0,label:"",name:"condition.from_status",form:p,options:w}),()=>b("from_status")):null,v.to_status!==void 0?K(n("rule.toStatus"),de(Zo,{size:"medium",fullWidth:!0,label:"",name:"condition.to_status",form:p,options:w}),()=>b("to_status")):null,v.changed_field!==void 0?K(n("rule.changedField"),de(Zo,{size:"medium",fullWidth:!0,label:"",name:"condition.changed_field",form:p,options:Ii}),()=>b("changed_field")):null,v.comment_contains!==void 0?K(n("rule.commentWord"),de(Vl,{size:"medium",fullWidth:!0,placeholder:n("rule.commentWordPlaceholder"),name:"condition.comment_contains",form:p}),()=>b("comment_contains")):null,v.comment_by_others!==void 0?K(n("rule.commentAuthor"),de(Zo,{size:"medium",fullWidth:!0,label:"",value:v.comment_by_others?"others":"any",options:[{value:"others",label:n("rule.notOwner")},{value:"any",label:n("rule.anyone")}],onChange:$=>h("comment_by_others",$.target.value==="others")}),()=>b("comment_by_others")):null,v.overdue_days!==void 0?K(n("rule.elapsedDays"),de(Vl,{size:"medium",fullWidth:!0,type:"number",value:String(v.overdue_days),onChange:$=>h("overdue_days",Math.max(0,Number($.target.value)||0)),label:n("rule.overdueDaysLabel")}),()=>b("overdue_days")):null,Object.keys(v).length===0?de(Ot,{sx:{fontSize:13.5,color:"#9a9a97"},children:n("rule.noConditionHint")}):null,gn(Ot,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[de(Ot,{sx:$k,children:n("rule.doTitle")}),ie.length>0?de(Mn,{size:"small",startIcon:de(Pp,{sx:{fontSize:16}}),onClick:$=>y($.currentTarget),sx:{color:"#2563eb",minWidth:0},children:n("rule.addActionButton")}):null]}),O.set_status!==void 0?K(n("col.status"),de(Zo,{size:"medium",fullWidth:!0,label:"",name:"action.set_status",form:p,options:w}),()=>B("set_status")):null,O.set_priority!==void 0?K(n("col.priority"),de(Zo,{size:"medium",fullWidth:!0,label:"",name:"action.set_priority",form:p,options:gm}),()=>B("set_priority")):null,O.apply_content_template_seq!==void 0?K(n("rule.bodyTemplate"),de(Zo,{size:"medium",fullWidth:!0,label:"",value:String(O.apply_content_template_seq),options:r.map($=>({value:String($.seq),label:$.name})),onChange:$=>f.selectContentTemplate(String($.target.value))}),()=>B("apply_content_template"),n("rule.bodyTemplateHint")):null,O.add_label_key!==void 0?K(n("dialog.label"),de(Zo,{size:"medium",fullWidth:!0,label:"",name:"action.add_label_key",form:p,options:M}),()=>B("add_label_key")):null,O.assign_manager_account_seq!==void 0?K(n("col.owner"),de(Mn,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{z("assign_manager")},children:O.assign_manager_name||n("rule.accountNo3",{assign_manager_account_seq:O.assign_manager_account_seq})}),()=>B("assign_manager")):null,O.add_receiver_account_seq!==void 0?K(n("col.cc"),de(Mn,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{z("add_receiver")},children:O.add_receiver_name||n("rule.accountNo4",{add_receiver_account_seq:O.add_receiver_account_seq})}),()=>B("add_receiver")):null,O.notify_account_seq!==void 0?K(n("rule.notification"),gn(Vk,{children:[de(Mn,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{z("notify")},sx:{flexShrink:0},children:O.notify_name||n("rule.accountNo5",{notify_account_seq:O.notify_account_seq})}),de(Vl,{size:"medium",fullWidth:!0,placeholder:n("rule.notifyMessagePlaceholder"),value:O.notify_message??"",onChange:$=>E("notify_message",$.target.value)})]}),()=>B("notify")):null,Object.keys(O).length===0?de(Ot,{sx:{fontSize:13.5,color:"#9a9a97"},children:n("rule.pickActionHint")}):null,de(Nk,{transitionDuration:0,anchorEl:F,open:!!F,onClose:()=>R(null),children:V.map($=>de(Fk,{dense:!0,onClick:()=>Z($.key),sx:{fontSize:14},children:$.label},$.key))}),de(Nk,{transitionDuration:0,anchorEl:C,open:!!C,onClose:()=>y(null),children:ie.map($=>de(Fk,{dense:!0,onClick:()=>ue($.key),sx:{fontSize:14},children:$.label},$.key))})]});return gn(Vk,{children:[de(Wk,{open:g.isOpen,onClose:g.close,maxWidth:"sm",title:n("rule.title"),locale:Se(),titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-rule-manage",tabs:{visible:!1},contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionContentPaddingTop:0,sections:[{id:"rules",title:"",showTitle:!1,children:gn(Ot,{sx:{display:"flex",flexDirection:"column",px:2.5,py:2},children:[t.length===0?gn(Ot,{sx:{py:4,display:"flex",flexDirection:"column",alignItems:"center",gap:2,color:"#9a9a97"},children:[de(V5,{sx:{fontSize:48,color:"#d9d9d6"}}),de(Ot,{sx:{fontSize:15},children:n("rule.noRules")})]}):null,t.map($=>gn(Ot,{sx:{display:"flex",alignItems:"center",gap:2,py:1,"&:not(:last-of-type)":{borderBottom:`1px solid ${ee}`},opacity:$.enabled?1:.5},children:[de(Hk,{title:$.enabled?n("rule.enabled"):n("rule.disabled"),arrow:!0,disableInteractive:!0,children:de(W5,{size:"small",inputProps:{"aria-label":n("rule.enableAria",{name:$.name})},checked:$.enabled,onChange:(G,ae)=>f.toggleRule($.seq,ae)})}),gn(Ot,{sx:{flex:1,minWidth:0},children:[de(Ot,{sx:{fontSize:16,fontWeight:600,color:"#37352f"},children:$.name}),(()=>{let G=G5($,o,a);return gn(Ot,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5,fontSize:15,color:"#6f6f6c"},children:[de(Ot,{component:"span",children:G.left}),de($5,{sx:{fontSize:18,color:"#9a9a97",flexShrink:0}}),de(Ot,{component:"span",children:G.right})]})})()]}),de(Rp,{size:"small","aria-label":n("rule.editAria",{name:$.name}),onClick:()=>f.openEdit($),children:de(U5,{sx:{fontSize:18}})}),de(Rp,{size:"small","aria-label":n("rule.deleteAria",{name:$.name}),onClick:()=>f.removeRule($.seq),children:de(Qt,{sx:{fontSize:18}})})]},$.seq))]})}],actions:{showCancelButton:!1,left:de(Mn,{startIcon:de(Pp,{}),onClick:f.openCreate,sx:{color:"#2563eb"},children:n("rule.newRule")}),right:de(Mn,{variant:"contained",onClick:g.close,children:n("common.close")})}}),de(Wk,{open:x.isOpen,onClose:x.close,maxWidth:"sm",title:I?n("rule.editRule"):n("rule.newRule"),locale:Se(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-rule-form",tabs:{visible:!1},sectionContentPaddingTop:0,sections:[{id:"rule-form",title:"",showTitle:!1,children:te()}],actions:{showCancelButton:!0,right:de(Mn,{variant:"contained",onClick:()=>{p.submit()},disabled:_,children:I?n("common.edit"):n("rule.addRule")})}})]})}import{useEffect as nT,useRef as Ul,useState as Jk}from"react";import{Box as so,Button as Kl,IconButton as Gl,Tooltip as jl}from"@mui/material";import eL from"@mui/icons-material/Tune";import Zk from"@mui/icons-material/Add";import tL from"@mui/icons-material/EditOutlined";import oL from"@mui/icons-material/ContentCopyOutlined";import nL from"@mui/icons-material/DragIndicator";import rL from"@mui/icons-material/PlaylistAddCheckOutlined";import{DndContext as aL,PointerSensor as iL,closestCenter as lL,useSensor as sL,useSensors as cL}from"@dnd-kit/core";import{restrictToParentElement as mL,restrictToVerticalAxis as uL}from"@dnd-kit/modifiers";import{SortableContext as dL,useSortable as pL,verticalListSortingStrategy as fL}from"@dnd-kit/sortable";import{CSS as gL}from"@dnd-kit/utilities";import{FormDialog as eT}from"@ehfuse/mui-form-dialog";import{ClearTextField as Lp,LabelSelect as xL}from"@ehfuse/mui-form-controls";import bL from"@ehfuse/overlay-scrollbar";import{useEffect as X5,useRef as Kk}from"react";import{useGlobalForm as Q5,useModal as J5}from"@ehfuse/forma";import{ConfirmDialog as Z5,ErrorAlert as Uk}from"@ehfuse/alerts";var Gk=0;function jk(){return Gk+=1,`ti${Gk}`}function Mp(){return{editSeq:0,name:"",description:"",group_seq:0,itemIds:[],items:{}}}function Yk(){return{title:"",start_offset_days:0,due_offset_days:0,priority:"medium"}}function Qk(e){L();let t=Kk(e);t.current=e;let o=Q5({formId:Ie("taskbox-template-form"),initialValues:Mp(),onValidate:u=>u.name.trim()?Xk(u).length===0?(Uk({message:n("template.addItemRequired")}),!1):!0:(Uk({message:n("template.enterName")}),!1),onSubmit:async u=>{let m={name:u.name.trim(),description:u.description,group_seq:u.group_seq,items:Xk(u)},d=u.editSeq>0?await t.current.onUpdate(u.editSeq,m):await t.current.onCreate(m);return d&&(a.form.close(),o.setFormValues(Mp())),d}}),a={list:pn({modalId:Ie("taskbox-template-manage"),open:e.open,onClose:()=>t.current.onClose()}),form:J5({modalId:Ie("taskbox-template-edit")})},r=Kk(a.form);r.current=a.form,X5(()=>{if(e.open)return;let u=window.setTimeout(()=>{r.current.isOpen&&r.current.close(),o.setFormValues(Mp())},500);return()=>window.clearTimeout(u)},[e.open]);let i=(u,m)=>{let d=m.items.map(()=>jk());o.setFormValues({editSeq:u,name:m.name,description:m.description??"",group_seq:m.group_seq??0,itemIds:d,items:Object.fromEntries(m.items.map((p,f)=>[d[f],{...p}]))}),a.form.open()},l=(u,m)=>({name:m,description:u.description??"",group_seq:u.group_seq??0,items:u.items.map(d=>({...d}))}),s=(u,m)=>{let d=o.getFormValue(`items.${u}`);o.setFormValue(`items.${u}`,{...d??Yk(),...m})};return{form:o,modals:a,actions:{openCreate:()=>i(0,{name:"",description:"",group_seq:0,items:[]}),openEdit:u=>i(u.seq,l(u,u.name)),openDuplicate:u=>i(0,l(u,n("template.copyName",{name:u.name}))),closeForm:()=>a.form.close(),setItem:s,addItem:()=>{let u=jk();o.setFormValue(`items.${u}`,Yk()),o.setFormValue("itemIds",[...o.getFormValue("itemIds")??[],u])},removeItem:u=>{let m=o.getFormValue("itemIds")??[];o.setFormValue("itemIds",m.filter(d=>d!==u))},moveItem:(u,m)=>{let d=[...o.getFormValue("itemIds")??[]],p=d.indexOf(u),f=d.indexOf(m);if(p<0||f<0||p===f)return;let[g]=d.splice(p,1);d.splice(f,0,g),o.setFormValue("itemIds",d)},pickItemManager:async u=>{let m=t.current.onPickAccount;if(!m)return;let d=o.getFormValue(`items.${u}`),p=await m(d?.manager_account_seq??0,n("col.owner"));p&&s(u,{manager_account_seq:p.accountSeq,manager_name:p.name})},clearItemManager:u=>s(u,{manager_account_seq:0,manager_name:""}),removeTemplate:async u=>{await Z5({title:n("template.deleteTemplate"),message:n("template.deleteConfirm",{name:u.name})})&&t.current.onRemove(u.seq)},runTemplate:u=>t.current.onRun?.(u)}}}function Xk(e){return(e.itemIds??[]).map(t=>e.items?.[t]).filter(t=>!!t&&String(t.title??"").trim().length>0)}import{Fragment as CL,jsx as Ce,jsxs as Pr}from"react/jsx-runtime";var rT=()=>n("template.itemTitlePlaceholder"),aT=2;var iT=20,pie=`${iT+aT*8}px`;function hL({id:e,children:t}){let{attributes:o,listeners:a,setNodeRef:r,transform:i,transition:l,isDragging:s}=pL({id:e});return Ce(so,{ref:r,sx:{transform:gL.Transform.toString(i),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({handleProps:{...o,...a},dragging:s})})}function kL(e){return e.start_offset_days!==void 0||e.due_offset_days!==void 0||e.priority!==void 0&&e.priority!=="medium"||!!e.manager_account_seq||(e.label_keys?.length??0)>0||!!String(e.content??"").replace(/<[^>]*>/g,"").trim()||(e.checklist?.length??0)>0||!!String(e.note??"").trim()||!!e.visibility}function TL({id:e,index:t,isLast:o,form:a,actions:r,handleProps:i,onOpenProps:l}){L();let s=a.useValue(`items.${e}`)??{},c=kL(s);return Pr(so,{sx:{borderBottom:o?"none":"1px solid #f2f2f0",px:aT,py:1,display:"flex",alignItems:"center",gap:1},children:[Ce(so,{...i,"aria-label":n("template.reorderItem",{value:t+1}),sx:{display:"inline-flex",alignItems:"center",flexShrink:0,mr:1,color:"#c9c8c5",cursor:"grab","&:active":{cursor:"grabbing"},touchAction:"none",userSelect:"none"},children:Ce(nL,{sx:{fontSize:iT}})}),Ce(Lp,{size:"medium",fullWidth:!0,placeholder:rT(),slotProps:{htmlInput:{"data-template-title":t}},name:`items.${e}.title`,form:a}),Ce(jl,{title:c?n("template.propsFilled"):n("template.props"),arrow:!0,disableInteractive:!0,children:Ce(Gl,{size:"medium","aria-label":n("template.itemProps",{value:t+1}),onClick:()=>l(e),sx:{flexShrink:0,color:c?"primary.main":"#9a9a97"},children:Ce(eL,{sx:{fontSize:20}})})}),Ce(jl,{title:n("template.deleteItem"),arrow:!0,disableInteractive:!0,children:Ce(Gl,{size:"medium","aria-label":n("template.deleteItemAria",{value:t+1}),onClick:()=>r.removeItem(e),sx:{flexShrink:0},children:Ce(Qt,{sx:{fontSize:18}})})})]})}function tT(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function oT(e,t){let o=a=>{let[r,i,l]=a.slice(0,10).split("-").map(Number);return Date.UTC(r,(i||1)-1,l||1)};return Math.round((o(t)-o(e))/864e5)}function yL({id:e,form:t,actions:o,customTabs:a,labels:r,onAddLabel:i,onPickAccount:l,onClose:s}){L();let c=Ul(e);c.current=e;let u=Ul(s);u.current=s;let m=Ul(tT()),d=Yi({formId:"taskbox-template-item-form",onSubmit:g=>{let x=c.current;if(!x)return!1;let h=m.current;return o.setItem(x,{title:String(g.title??"").trim(),content:g.content??"",start_offset_days:g.start_date?oT(h,g.start_date):void 0,due_offset_days:g.due_date?oT(h,g.due_date):void 0,priority:g.priority,label_keys:[...g.label_keys??[]],manager_account_seq:g.manager_account_seq||void 0,manager_name:g.manager_account_seq?g.manager_name:void 0,checklist:(g.checklist??[]).map(E=>E.label).filter(E=>E.trim().length>0),note:g.note??"",visibility:g.visibility,visibility_group_seq:g.visibility==="group"?g.visibility_group_seq:void 0}),u.current(),!0}}),p=t.useValue(e?`items.${e}`:"__none__")??{},f=g=>g===void 0?"":uc(m.current,g);return nT(()=>{e&&(m.current=tT(),d.setFormValues({start_date:f(p.start_offset_days),priority:p.priority??"medium",label_keys:[...p.label_keys??[]],note:p.note??"",...p.visibility?{visibility:p.visibility,visibility_group_seq:p.visibility_group_seq??0}:{},checklist:(p.checklist??[]).map(g=>({label:g,checked:!1}))}))},[e]),Ce(ib,{open:!!e,onClose:s,form:d,statusOptions:r,customTabs:a,presetTitle:p.title??"",presetContent:p.content??"",presetDueDate:f(p.due_offset_days),presetManager:p.manager_account_seq?{name:p.manager_name??"",accountSeq:p.manager_account_seq}:null,hideTypeToggle:!0,hideProject:!0,hideMembers:!l,templateItem:!0,submitLabel:n("common.apply"),contentSyncKey:`template-${e??""}`,onAddLabelOption:i,onMemberEdit:g=>{g!=="manager"||!l||(async()=>{let x=Number(d.getFormValue("manager_account_seq"))||0,h=await l(x,n("col.owner"));h&&d.setFormValues({manager_account_seq:h.accountSeq,manager_name:h.name})})()}})}function fie({open:e,templates:t,customTabs:o,onPickAccount:a,onClose:r,onCreate:i,onUpdate:l,onRemove:s,onRun:c,labels:u=[],onAddLabel:m}){L();let[d,p]=Jk(null),f=Qk({open:e,templates:t,customTabs:o,onPickAccount:a,onClose:r,onCreate:i,onUpdate:l,onRemove:s,onRun:c}),{form:g,actions:x}=f,h=f.modals.list,E=f.modals.form,b=g.isSubmitting,B=Number(g.useValue("editSeq")??0),T=g.useValue("itemIds")??[],[z,k]=Jk(0),_=Ul(null),D=Ul(null),F=()=>{let q=D.current?.getScrollContainer()??null;if(q){q.scrollTop=q.scrollHeight;return}let v=_.current?.querySelectorAll("*")??[];for(let O of Array.from(v))if(O.scrollHeight>O.clientHeight+1){O.scrollTop=O.scrollHeight;return}},R=()=>{let q=_.current;if(!q)return null;let v=q.querySelectorAll("input[data-template-title]"),O=v.length?v:q.querySelectorAll(`input[placeholder="${rT()}"]`);return O.length?O[O.length-1]:null};nT(()=>{if(z===0)return;let q=0,v=0,O=()=>{F();let V=R();V&&document.activeElement!==V&&V.focus(),q+=1,!(V&&document.activeElement===V)&&q<8&&(v=window.setTimeout(O,50))},j=window.requestAnimationFrame(O);return()=>{window.cancelAnimationFrame(j),window.clearTimeout(v)}},[z]);let C=o.filter(q=>!q.archived).map(q=>({value:String(Pn(q.key)),label:q.label})),y=Number(g.useValue("group_seq")??0),I=cL(sL(iL,{activationConstraint:{distance:5}})),S=q=>{let v=String(q.active?.id??""),O=String(q.over?.id??"");!v||!O||v===O||x.moveItem(v,O)},M=Ce(so,{children:t.length===0?Pr(so,{sx:{py:4,display:"flex",flexDirection:"column",alignItems:"center",gap:2,color:"#9a9a97"},children:[Ce(rL,{sx:{fontSize:48,color:"#d9d9d6"}}),Ce(so,{sx:{fontSize:13.5},children:n("template.noTemplates")})]}):t.map(q=>Pr(so,{sx:{display:"flex",alignItems:"center",gap:2.5,py:1.75,"&:not(:last-of-type)::after":{content:'""',display:"block",my:1.75,borderBottom:"1px solid #f0efed"}},children:[Pr(so,{sx:{flex:1,minWidth:0},children:[Ce(so,{sx:{fontSize:18,fontWeight:600,color:"#37352f"},children:q.name}),Pr(so,{sx:{fontSize:14,color:"#787774",mt:.25},children:[n("template.taskCount",{count:q.items.length}),q.description?` \xB7 ${q.description}`:""]})]}),c?Ce(Kl,{size:"medium",variant:"outlined",onClick:()=>x.runTemplate(q),sx:{flexShrink:0},children:n("template.run")}):null,Ce(jl,{title:n("common.edit"),arrow:!0,disableInteractive:!0,children:Ce(Gl,{size:"medium","aria-label":n("template.editAria",{name:q.name}),onClick:()=>x.openEdit(q),children:Ce(tL,{sx:{fontSize:19}})})}),Ce(jl,{title:n("menu.duplicate"),arrow:!0,disableInteractive:!0,children:Ce(Gl,{size:"medium","aria-label":n("template.duplicateAria",{name:q.name}),onClick:()=>x.openDuplicate(q),children:Ce(oL,{sx:{fontSize:18}})})}),Ce(jl,{title:n("common.delete"),arrow:!0,disableInteractive:!0,children:Ce(Gl,{size:"medium","aria-label":n("template.deleteAria",{name:q.name}),onClick:()=>{x.removeTemplate(q)},children:Ce(Qt,{sx:{fontSize:18}})})})]},q.seq))}),w=Pr(so,{sx:{display:"flex",flexDirection:"column",gap:3},children:[Ce(Lp,{size:"medium",label:n("template.name"),placeholder:n("template.namePlaceholder"),fullWidth:!0,name:"name",form:g}),Pr(so,{sx:{display:"grid",gridTemplateColumns:C.length>0?"1fr 1fr":"1fr",gap:2},children:[Ce(Lp,{size:"medium",label:n("googleEvent.description"),placeholder:n("template.descriptionPlaceholder"),fullWidth:!0,name:"description",form:g}),C.length>0?Ce(xL,{size:"medium",fullWidth:!0,label:n("template.targetProject"),value:String(y),options:[{value:"0",label:ja()},...C],onChange:q=>g.setFormValue("group_seq",Number(q.target.value)||0)}):null]}),Pr(so,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[Ce(so,{sx:{fontSize:18,fontWeight:600,color:"#37352f"},children:n("template.items")}),Ce(so,{sx:{fontSize:14,color:"#37352f"},children:n("template.datesHint")})]}),T.length===0?Ce(so,{sx:{fontSize:14,color:"#9a9a97",py:2},children:n("template.noItemsHint")}):Ce(so,{ref:_,sx:{border:`1px solid ${ee}`,borderRadius:1,overflow:"hidden"},children:Ce(bL,{ref:D,style:{maxHeight:"min(560px, 52vh)"},thumb:{width:6},children:Ce(aL,{sensors:I,collisionDetection:lL,modifiers:[uL,mL],onDragEnd:S,children:Ce(dL,{items:T,strategy:fL,children:T.map((q,v)=>Ce(hL,{id:q,children:({handleProps:O})=>Ce(TL,{id:q,index:v,isLast:v===T.length-1,form:g,actions:x,handleProps:O,onOpenProps:p})},q))})})})})]});return Pr(CL,{children:[Ce(eT,{open:h.isOpen,onClose:h.close,maxWidth:"md",title:n("template.title"),locale:Se(),titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-template",tabs:{visible:!1},actions:{showCancelButton:!1,left:Ce(Kl,{startIcon:Ce(Zk,{sx:{fontSize:18}}),onClick:x.openCreate,children:n("template.newTemplate")}),right:Ce(Kl,{variant:"contained",onClick:h.close,children:n("common.close")})},sectionContentPaddingTop:0,sections:[{id:"templates",title:"",showTitle:!1,children:M}]}),Ce(eT,{open:E.isOpen,onClose:E.close,maxWidth:"md",title:B>0?n("template.editTemplate"):n("template.newTemplate"),locale:Se(),backdropClick:!1,fontScale:{enabled:!0},fontScaleKey:"taskbox-task-template-form",titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},tabs:{visible:!1},actions:{showCancelButton:!0,left:Ce(Kl,{startIcon:Ce(Zk,{sx:{fontSize:18}}),onClick:()=>{x.addItem(),k(q=>q+1)},children:n("template.addItem")}),right:Ce(Kl,{variant:"contained",disabled:b,onClick:()=>{g.submit()},children:n("common.save")})},sectionContentPaddingTop:0,sections:[{id:"template-form",title:"",showTitle:!1,children:w}]}),Ce(yL,{id:E.isOpen?d:null,form:g,actions:x,customTabs:o,labels:u,onAddLabel:m,onPickAccount:a,onClose:()=>p(null)})]})}import{Box as To,Button as vL}from"@mui/material";import{FormDialog as BL}from"@ehfuse/mui-form-dialog";import{DateTextField as _L}from"@ehfuse/mui-form-controls";import IL from"@ehfuse/overlay-scrollbar";import{useRef as Ap}from"react";import{useGlobalForm as SL}from"@ehfuse/forma";function lT(e){let t=Ap(e);t.current=e;let o=Ap(e.template);e.template&&(o.current=e.template);let a=e.template??o.current,r=Ap(a);r.current=a;let i=SL({formId:Ie("taskbox-template-run-form"),initialValues:{baseDate:e.todayStr},onValidate:c=>t.current.running||!r.current?!1:dc(r.current,c.baseDate).length>0,onSubmit:c=>r.current?(t.current.onRun(dc(r.current,c.baseDate),c.baseDate),!0):!1}),l={run:pn({modalId:Ie("taskbox-template-run"),open:e.open,onClose:()=>t.current.onClose(),onOpen:()=>i.setFormValues({baseDate:t.current.todayStr})})},s=c=>a?dc(a,c):[];return{form:i,modals:l,template:a,running:!!e.running,planTasks:s}}import{jsx as Ro,jsxs as Yl}from"react/jsx-runtime";function Rie(e){L();let t=lT(e),{form:o,running:a}=t,r=t.modals.run,i=t.template,l=String(o.useValue("baseDate")??""),s=t.planTasks(l);return Ro(BL,{open:r.isOpen,onClose:r.close,maxWidth:"md",title:i?n("template.runTitle",{name:i.name}):n("template.runTemplate"),locale:Se(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-template-run",tabs:{visible:!1},sectionContentPaddingTop:0,actions:{showCancelButton:!0,right:Ro(vL,{variant:"contained",disabled:a||s.length===0,onClick:()=>{o.submit()},children:a?n("template.creating"):n("template.createCount",{length:s.length})})},sections:[{id:"template-run",title:"",showTitle:!1,children:Yl(To,{sx:{display:"flex",flexDirection:"column",gap:2},children:[Yl(To,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[Ro(To,{sx:{width:72,flexShrink:0,fontSize:16,color:"#37352f"},children:n("template.baseDate")}),Ro(_L,{size:"medium",fullWidth:!0,name:"baseDate",form:o})]}),Ro(To,{sx:{fontSize:14.5,color:"#37352f"},children:n("template.runHint")}),Yl(To,{sx:{border:`1px solid ${ee}`,borderRadius:1,overflow:"hidden"},children:[Yl(To,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,bgcolor:"#fafaf9",borderBottom:`1px solid ${ee}`,fontSize:13.5,fontWeight:600,color:"#37352f"},children:[Ro(To,{sx:{flex:1,minWidth:0},children:n("template.task")}),Ro(To,{sx:{width:88,flexShrink:0,textAlign:"center"},children:n("board.start")}),Ro(To,{sx:{width:88,flexShrink:0,textAlign:"center"},children:n("board.due")}),Ro(To,{sx:{width:96,flexShrink:0,textAlign:"center"},children:n("col.owner")})]}),Ro(IL,{style:{maxHeight:520},thumb:{width:6},children:s.length===0?Ro(To,{sx:{p:2,fontSize:14,color:"#9a9a97"},children:n("template.nothingToCreate")}):s.map((c,u)=>Yl(To,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1.25,borderBottom:u===s.length-1?"none":"1px solid #f2f2f0",fontSize:16,fontWeight:500,color:"#111111"},children:[Ro(To,{sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.title}),Ro(To,{sx:{width:88,flexShrink:0,textAlign:"center",fontSize:13.5,color:c.start_date?"#37352f":"#9a9a97"},children:Du(c.start_date)||"-"}),Ro(To,{sx:{width:88,flexShrink:0,textAlign:"center",fontSize:13.5,color:c.due_date?"#37352f":"#9a9a97"},children:Du(c.due_date)||"-"}),Ro(To,{sx:{width:96,flexShrink:0,textAlign:"center",fontSize:13.5,color:c.manager_name?"#37352f":"#9a9a97",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.manager_name||"-"})]},u))})]})]})}]})}var wL={get urgent(){return n("print.urgent")},get high(){return n("priority.high")},get normal(){return n("priority.medium")},get low(){return n("priority.low")}};function DL(e){return e.length===0?"":e.length<=2?e.join(", "):n("print.namesAndMore",{value:e[0],value2:e.length-1})}function xm(e){let t=String(e??"").trim().slice(0,10);return/^\d{4}-\d{2}-\d{2}$/.test(t)?`${t.slice(2,4)}.${t.slice(5,7)}.${t.slice(8,10)}`:"-"}function wi(e){let t=o=>String(o).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}`}function qp(e,t,o){let r=String(e.due_date??"").slice(11,16).trim()||String(e.estimated_time??"").trim(),i=xm(e.due_date),l=String(e.start_date??"").slice(11,16).trim(),s=xm(e.start_date),c=(e.receiver_names??[]).filter(Boolean).map(m=>String(m).trim()),u=(e.checklist??[]).length?`${(e.checklist??[]).filter(m=>m.checked).length}/${(e.checklist??[]).length}`:"";return{seq:Number(e.seq??0),title:String(e.title??"").trim(),statusName:Ft(e).name,projectLabel:e.tab_key?t.get(String(e.tab_key))??"":"",managerName:String(e.manager_name??"").trim(),receiverNames:DL(c),receiverNamesFull:c.join(", "),startDate:s!=="-"&&l?`${s} ${l}`:s,dueDate:i!=="-"&&r?`${i} ${r}`:i,priorityName:wL[String(e.priority??"")]??"",checklist:u,checklistItems:(e.checklist??[]).map(m=>{let d=m.task_seq&&o?o(Number(m.task_seq)):null,p=xm(d?.due_date),f=String(d?.due_date??"").slice(11,16).trim();return{label:String(m.label??"").trim(),checked:!!m.checked,managerName:String(d?.manager_name??"").trim(),dueDate:p!=="-"?f?`${p} ${f}`:p:""}}),note:String(e.note??"").trim(),completed:!!e.completed}}function qe(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function EL(e,t){if(e===" ")return t*.3;let o=e.codePointAt(0)??0,a=o>=4352&&o<=4607||o>=12288&&o<=40959||o>=44032&&o<=55203||o>=63744&&o<=64255||o>=65280&&o<=65519;return t*(a?1:.55)}function bm(e,t){let o=0;for(let a of String(e??""))o+=EL(a,t);return o}function Di(e,t){let o=String(e??"").trim();if(!o)return["-"];let a=[],r="";for(let i of o){if(i===`
19
+ `){r&&a.push(r),r="";continue}let l=`${r}${i}`;if(l.length>t&&r){a.push(r),r=i;continue}r=l}return r&&a.push(r),a.length>0?a:["-"]}function Zn(e,t,o){let a=String(e??"").replace(/\s+/g," ").trim();if(!a)return"";if(bm(a,o)<=t)return a;let r=bm("\u2026",o),i="",l=0;for(let s of a){let c=bm(s,o);if(l+c+r>t)break;i+=s,l+=c}return`${i}\u2026`}var Ql=595.28,Jl=841.89,Zl=841.89,es=595.28,yo=28,xn=96,en=44,RL="'Malgun Gothic','\uB9D1\uC740 \uACE0\uB515','Apple SD Gothic Neo','Noto Sans KR',sans-serif",PL="'Batang','\uBC14\uD0D5','AppleMyungjo','Noto Serif KR',serif",Xl="#cbd5e1",OL=[`text { font-family: ${RL}; fill: #000000; }`,`.doc-title { font-family: ${PL}; font-size: 20px; font-weight: 700; }`,".doc-sub { font-size: 10.5px; fill: #333333; }",".doc-meta { font-size: 9.5px; fill: #333333; }",".th { font-size: 9.5px; font-weight: 700; fill: #000000; }",`.td { font-size: 9px; }
20
20
  .ck{font-size:9px;fill:#475569;}
21
- .ck.done{fill:#94a3b8;}`,".td.done { fill: #555555; }",".gt { font-size: 10px; font-weight: 700; fill: #000000; }",".label { font-size: 9px; fill: #333333; }",".value { font-size: 10px; }",".section { font-size: 11.5px; font-weight: 700; fill: #000000; }",".pageno { font-size: 9px; fill: #333333; }",`.head { fill: #eef2f7; stroke: ${Yl}; stroke-width: 0.5; }`,`.group { fill: #f8fafc; stroke: ${Yl}; stroke-width: 0.5; }`,`.frame { fill: none; stroke: ${Yl}; stroke-width: 0.5; }`,`.hline { stroke: ${Yl}; stroke-width: 0.5; }`,`.vline { stroke: ${Yl}; stroke-width: 0.5; }`,".bar { fill: #bfdbfe; stroke: #60a5fa; stroke-width: 0.6; }",".bar.done { fill: #e5e7eb; stroke: #cbd5e1; }",".bar.overdue { fill: #fecaca; stroke: #f87171; }"].join("");function Pr(e,t,o){let a=o-To;return[`<text x="${To}" y="46" class="doc-title">${Ae(e.documentTitle)}</text>`,`<text x="${To}" y="66" class="doc-sub">${Ae(e.subtitle)}</text>`,`<text x="${a}" y="42" class="doc-meta" text-anchor="end">${Ae(e.facilityName)}</text>`,`<text x="${a}" y="58" class="doc-meta" text-anchor="end">${Ae(n("print.printedAt",{time:Ii(e.printedAt)}))}${e.printedBy?` \xB7 ${Ae(e.printedBy)}`:""}</text>`,t?`<text x="${a}" y="74" class="doc-meta" text-anchor="end">${Ae(t)}</text>`:""].join("")}function Mr(e){let{width:t,height:o,body:a,pageIndex:r,pageCount:i}=e;return[`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${o}" viewBox="0 0 ${t} ${o}">`,`<style>${PL}</style>`,`<rect x="0" y="0" width="${t}" height="${o}" fill="#ffffff" />`,a,`<text x="${t/2}" y="${o-22}" class="pageno" text-anchor="middle">${r+1} / ${i}</text>`,"</svg>"].join("")}var zp=Jl,lT=Zl,Zn=To,es=zp-To,Di=22,la=20,Ei=22,Or=18,aa=5,sT=gn,cT=Zo,qp=lT-46,Lr=[{key:"no",get label(){return n("print.no")},width:30,align:"middle"},{key:"title",get label(){return n("common.title")},width:300,align:"start"},{key:"status",get label(){return n("col.status")},width:60,align:"middle"},{key:"start",get label(){return n("board.start")},width:78,align:"middle"},{key:"due",get label(){return n("board.due")},width:78,align:"middle"},{key:"manager",get label(){return n("col.owner")},width:80,align:"middle"},{key:"priority",get label(){return n("col.priority")},width:60,align:"middle"},{key:"project",get label(){return n("col.project")},width:100,align:"middle"}],ia=Lr.reduce((e,t,o)=>(e.push(o===0?Zn:e[o-1]+Lr[o-1].width),e),[]);function ML(e){let t=[],o=[],a=sT+Di,r=0,i=(l,s)=>{t.push(o),o=[],a=cT+Di,l&&(o.push({kind:"group",label:l,count:s,continued:!0}),a+=Ei)};for(let l of e){l.label&&(a+Ei+la>qp&&i("",0),o.push({kind:"group",label:l.label,count:l.rows.length,continued:!1}),a+=Ei);for(let s of l.rows){a+la>qp&&i(l.label,l.rows.length),r+=1,o.push({kind:"row",completed:s.completed,values:Lr.map(c=>{switch(c.key){case"no":return String(r);case"title":return s.title;case"status":return s.statusName;case"project":return s.projectLabel||n("props.defaultProject");case"manager":return s.managerName||"-";case"start":return s.startDate;case"due":return s.dueDate;default:return s.priorityName||"-"}})}),a+=la;for(let c of s.checklistItems)c.label&&(a+Or>qp&&i(l.label,l.rows.length),o.push({kind:"check",label:c.label,checked:c.checked,managerName:c.managerName,dueDate:c.dueDate}),a+=Or)}}return t.push(o),t.filter((l,s)=>s===0||l.length>0)}function OL(e,t){let o=[],a=[],r=(l,s,c)=>{ia.slice(1).forEach((u,m)=>{let d=m+1;c(d)||a.push(`<line x1="${u}" y1="${l}" x2="${u}" y2="${l+s}" class="vline" />`)})};o.push(`<rect x="${Zn}" y="${t}" width="${es-Zn}" height="${Di}" class="head" />`),Lr.forEach((l,s)=>{let c=ia[s],u=l.align==="middle"?c+l.width/2:c+aa;o.push(`<text x="${u}" y="${t+Di-7}" class="th" text-anchor="${l.align}">${Ae(l.label)}</text>`)}),r(t,Di,()=>!1);let i=t+Di;for(let l of e){if(l.kind==="group"){o.push(`<rect x="${Zn}" y="${i}" width="${es-Zn}" height="${Ei}" class="group" />`,`<text x="${Zn+aa}" y="${i+Ei-7}" class="gt">${Ae(`${l.continued?n("print.continued",{label:l.label}):l.label} (${l.count})`)}</text>`),i+=Ei;continue}if(l.kind==="check"){let s=ia[1]+aa+10,c=ia[4]-ia[1],u=l.checked?"ck done":"ck";o.push(`<text x="${s}" y="${i+Or-5}" class="${u}">${Ae(`${l.checked?"\u2713":"\u25CB"} ${Jn(l.label,c-aa*2-22,9)}`)}</text>`),l.dueDate&&o.push(`<text x="${ia[4]+Lr[4].width/2}" y="${i+Or-5}" class="${u}" text-anchor="middle">${Ae(Jn(l.dueDate,Lr[4].width-aa*2,9))}</text>`),l.managerName&&o.push(`<text x="${ia[5]+Lr[5].width/2}" y="${i+Or-5}" class="${u}" text-anchor="middle">${Ae(Jn(l.managerName,Lr[5].width-aa*2,9))}</text>`),o.push(`<line x1="${Zn}" y1="${i+Or}" x2="${es}" y2="${i+Or}" class="hline" />`),r(i,Or,m=>m>=2&&m<=3),i+=Or;continue}Lr.forEach((s,c)=>{let u=ia[c],m=s.align==="middle"?u+s.width/2:u+aa;o.push(`<text x="${m}" y="${i+la-6}" class="${l.completed?"td done":"td"}" text-anchor="${s.align}">${Ae(Jn(l.values[c]??"",s.width-aa*2,9))}</text>`)}),o.push(`<line x1="${Zn}" y1="${i+la}" x2="${es}" y2="${i+la}" class="hline" />`),r(i,la,()=>!1),i+=la}return o.push(...a),o.push(`<rect x="${Zn}" y="${t}" width="${es-Zn}" height="${i-t}" class="frame" />`),o.join("")}async function LL(e,t){let o=ML(t),a=t.reduce((r,i)=>r+i.rows.length,0);return o.map((r,i)=>{let l=i===0?sT:cT,s=[i===0?Pr(e,n("print.totalCount",{totalCount:a}),zp):"",OL(r,l)].join("");return Mr({width:zp,height:lT,body:s,pageIndex:i,pageCount:o.length})})}var Fp=Xl,mT=Ql,er=To,bm=Fp-To,AL=mT-46,uT=22,qL=68,zL=(bm-er)/2,NL=14,Np=58;function Ri(e){switch(e.kind){case"title":return 34;case"props":return Math.ceil(e.pairs.length/2)*uT+10;case"section":return 26;default:return NL}}function FL(e){let t=[{kind:"title",text:e.title,ticket:e.ticketNo}];return t.push({kind:"props",pairs:e.properties}),t.push({kind:"section",text:n("common.content")}),(e.content.trim()?e.content.split(`
22
- `).flatMap(a=>a.trim()?wi(a,Np):[""]):[n("print.noContent")]).forEach(a=>t.push({kind:"line",text:a,muted:!e.content.trim()})),e.checklist.length>0&&(t.push({kind:"section",text:n("print.todoCount",{value:e.checklist.filter(a=>a.checked).length,length:e.checklist.length})}),e.checklist.forEach(a=>{wi(a.label,Np-3).forEach((r,i)=>t.push({kind:i===0?"check":"line",text:r,checked:a.checked}))})),e.includeComments&&e.comments.length>0&&(t.push({kind:"section",text:n("print.commentCount",{length:e.comments.length})}),e.comments.forEach(a=>{t.push({kind:"line",text:`${a.author} \xB7 ${a.time}`,muted:!0}),wi(a.text,Np).forEach(r=>t.push({kind:"line",text:r}))})),t}function HL(e){let t=[],o=[],a=gn;for(let r of e){let i=Ri(r);a+i>AL&&(t.push(o),o=[],a=Zo),o.push(r),a+=i}return t.push(o),t}function WL(e,t){switch(e.kind){case"title":{let o=e.ticket?`<text x="${bm}" y="${t+16}" class="doc-meta" text-anchor="end">${Ae(e.ticket)}</text>`:"";return{markup:`<text x="${er}" y="${t+16}" class="section" style="font-size:14px">${Ae(e.text)}</text>${o}<line x1="${er}" y1="${t+24}" x2="${bm}" y2="${t+24}" class="hline" />`,nextY:t+Ri(e)}}case"props":{let o=[];return e.pairs.forEach((a,r)=>{let i=r%2,l=Math.floor(r/2),s=er+i*zL,c=t+l*uT;o.push(`<text x="${s}" y="${c+14}" class="label">${Ae(a.label)}</text>`,`<text x="${s+qL}" y="${c+14}" class="value">${Ae(wi(a.value||"-",26)[0]??"-")}</text>`)}),{markup:o.join(""),nextY:t+Ri(e)}}case"section":return{markup:`<text x="${er}" y="${t+16}" class="section">${Ae(e.text)}</text><line x1="${er}" y1="${t+21}" x2="${bm}" y2="${t+21}" class="hline" />`,nextY:t+Ri(e)};case"check":return{markup:`<text x="${er}" y="${t+10}" class="td">${e.checked?"\u2611":"\u2610"}</text><text x="${er+14}" y="${t+10}" class="${e.checked?"td done":"td"}">${Ae(e.text)}</text>`,nextY:t+Ri(e)};default:return{markup:`<text x="${er}" y="${t+10}" class="${e.muted?"td done":"td"}">${Ae(e.text)}</text>`,nextY:t+Ri(e)}}}async function $L(e,t){let o=HL(FL(t));return o.map((a,r)=>{let i=r===0?gn:Zo,l=[r===0?Pr(e,"",Fp):`<text x="${er}" y="${Zo-12}" class="doc-meta">${Ae(n("print.continued",{label:t.title}))}</text>`];for(let s of a){let c=WL(s,i);l.push(c.markup),i=c.nextY}return Mr({width:Fp,height:mT,body:l.join(""),pageIndex:r,pageCount:o.length})})}var Wp=Jl,fT=Zl,hm=To,ts=Wp-To,dT=fT-46,pT=210,sa=20,Hp=24;function ca(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;let t=new Date(`${e}T00:00:00`);return Number.isNaN(t.getTime())?null:t}function gT(e,t){return Math.round((t.getTime()-e.getTime())/864e5)}function VL(e,t){let o=[];e.forEach(l=>{let s=ca(l.startDate),c=ca(l.dueDate);s&&o.push(s),c&&o.push(c)});let a=ca(t)??new Date;if(o.length===0)return{start:a,days:30};let r=new Date(Math.min(...o.map(l=>l.getTime()))),i=new Date(Math.max(...o.map(l=>l.getTime())));return r.setDate(r.getDate()-1),i.setDate(i.getDate()+1),{start:r,days:Math.max(7,gT(r,i)+1)}}async function UL(e,t,o){let a=VL(t,o),r=hm+pT,l=(ts-r)/a.days,s=ca(o),c=f=>r+gT(a.start,f)*l,u=Math.max(1,Math.floor((dT-gn-Hp)/sa)),m=Math.max(1,Math.floor((dT-Zo-Hp)/sa)),d=[],p=0;for(;p<t.length||d.length===0;){let f=d.length===0?u:m;if(d.push(t.slice(p,p+f)),p+=f,p>=t.length)break}return d.map((f,g)=>{let x=g===0?gn:Zo,h=[g===0?Pr(e,n("print.totalCount2",{length:t.length}),Wp):""],E=x+Hp;h.push(`<line x1="${hm}" y1="${E}" x2="${ts}" y2="${E}" class="vline" />`);for(let b=0;b<a.days;b+=1){let B=new Date(a.start);if(B.setDate(B.getDate()+b),B.getDay()!==0&&b!==0)continue;let T=r+b*l;h.push(`<line x1="${T}" y1="${E}" x2="${T}" y2="${E+f.length*sa}" class="hline" />`,`<text x="${T+2}" y="${E-6}" class="label">${B.getMonth()+1}.${B.getDate()}</text>`)}if(s&&s>=a.start){let b=c(s);b>=r&&b<=ts&&h.push(`<line x1="${b}" y1="${E}" x2="${b}" y2="${E+f.length*sa}" stroke="#f87171" stroke-width="0.8" />`)}return f.forEach((b,B)=>{let T=E+B*sa,z=Jn(b.title,pT-64,9);h.push(`<text x="${hm}" y="${T+14}" class="${b.completed?"td done":"td"}">${Ae(z)}</text>`,`<text x="${r-6}" y="${T+14}" class="label" text-anchor="end">${Ae(b.managerName)}</text>`,`<line x1="${hm}" y1="${T+sa}" x2="${ts}" y2="${T+sa}" class="hline" />`);let k=ca(b.startDate)??ca(b.dueDate),_=ca(b.dueDate)??ca(b.startDate);if(!k||!_)return;let D=c(k),F=Math.max(D+l*.8,c(_)+l*.8),R=b.completed?"bar done":b.overdue?"bar overdue":"bar";h.push(`<rect x="${D}" y="${T+5}" width="${Math.max(3,Math.min(F,ts)-D)}" height="${sa-10}" rx="2" class="${R}" />`)}),Mr({width:Wp,height:fT,body:h.join(""),pageIndex:g,pageCount:d.length})})}function KL(e,t,o,a){return{title:e.title,managerName:e.managerName,startDate:String(t??"").slice(0,10),dueDate:String(o??"").slice(0,10),completed:e.completed,overdue:!e.completed&&!!o&&String(o).slice(0,10)<a}}var $p=Xl,bT=Ql,Pi=To,km=$p-To,xT=bT-46,Mi=30,Oi=18,hT=12;function GL(e){let t=[],o=[],a=gn,r=(i,l)=>{t.push(o),o=[],a=Zo,i&&(o.push({kind:"column",label:i,summary:l,continued:!0,gapBefore:!1}),a+=Mi)};for(let i of e){let l=o.length>0,s=l?hT:0;if(a+s+Mi+Oi>xT?(r("",""),o.push({kind:"column",label:i.label,summary:i.summary,continued:!1,gapBefore:!1}),a+=Mi):(o.push({kind:"column",label:i.label,summary:i.summary,continued:!1,gapBefore:l}),a+=s+Mi),i.items.length===0){o.push({kind:"empty"}),a+=Oi;continue}for(let c of i.items)a+Oi>xT&&r(i.label,i.summary),o.push({kind:"item",title:c.title,meta:c.meta,completed:c.completed}),a+=Oi}return t.push(o),t}async function jL(e,t,o){let a=GL(t);return a.map((r,i)=>{let l=i===0?gn:Zo,s=[i===0?Pr(e,o,$p):""];for(let c of r){if(c.kind==="column"){c.gapBefore&&(l+=hT),s.push(`<rect x="${Pi}" y="${l}" width="${km-Pi}" height="${Mi-6}" class="group" />`,`<text x="${Pi+6}" y="${l+16}" class="gt">${Ae(c.continued?n("print.continued",{label:c.label}):c.label)}</text>`,`<text x="${km-6}" y="${l+16}" class="label" text-anchor="end">${Ae(c.summary)}</text>`),l+=Mi;continue}if(c.kind==="empty"){s.push(`<text x="${Pi+12}" y="${l+12}" class="td done">${Ae(n("print.noTasks"))}</text>`),l+=Oi;continue}s.push(`<text x="${Pi+12}" y="${l+12}" class="${c.completed?"td done":"td"}">${Ae(Jn(c.title,km-Pi-12-120,9))}</text>`,`<text x="${km-6}" y="${l+12}" class="label" text-anchor="end">${Ae(c.meta)}</text>`),l+=Oi}return Mr({width:$p,height:bT,body:s.join(""),pageIndex:i,pageCount:a.length})})}var YL=[{get header(){return n("print.group")},width:16},{get header(){return n("common.title")},width:44},{get header(){return n("col.status")},width:10},{get header(){return n("col.project")},width:14},{get header(){return n("col.owner")},width:10},{get header(){return n("col.cc")},width:22},{get header(){return n("board.start")},width:12},{get header(){return n("board.due")},width:14},{get header(){return n("col.priority")},width:8},{get header(){return n("section.todo")},width:8},{get header(){return n("col.note")},width:30}],XL="FFEEF2F7",Tm="FFCBD5E1";function QL(e){return e.replace(/[\\/:*?"<>|]/g,"_").trim()||n("print.sheetName")}async function JL(e,t){let o=await import("./chunks/exceljs.min-XQ4JIAQG.js"),a=new o.Workbook,r=a.addWorksheet(n("print.sheetName"),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0,fitToWidth:1,fitToHeight:0}});r.columns=YL.map(m=>({header:m.header,width:m.width})),r.spliceRows(1,0,[`${e.documentTitle}`],[`${e.subtitle} \xB7 ${e.facilityName} \xB7 ${n("print.printedAt",{time:Ii(e.printedAt)})}${e.printedBy?` \xB7 ${e.printedBy}`:""}`]),r.getRow(1).font={bold:!0,size:14},r.getRow(2).font={size:10,color:{argb:"FF6B7280"}};let i=r.getRow(3);i.font={bold:!0,size:10},i.eachCell(m=>{m.fill={type:"pattern",pattern:"solid",fgColor:{argb:XL}},m.alignment={vertical:"middle",horizontal:"center"}}),t.forEach(m=>{m.rows.forEach(d=>{let p=r.addRow([m.label,d.title,d.statusName,d.projectLabel||n("props.defaultProject"),d.managerName,d.receiverNamesFull,d.startDate==="-"?"":d.startDate,d.dueDate==="-"?"":d.dueDate,d.priorityName,d.checklist,d.note]);p.font={size:10,color:{argb:d.completed?"FF9CA3AF":"FF111827"}},p.alignment={vertical:"middle",wrapText:!1}})});let l=r.rowCount;for(let m=3;m<=l;m+=1)r.getRow(m).eachCell({includeEmpty:!0},d=>{d.border={top:{style:"thin",color:{argb:Tm}},left:{style:"thin",color:{argb:Tm}},bottom:{style:"thin",color:{argb:Tm}},right:{style:"thin",color:{argb:Tm}}}});r.views=[{state:"frozen",ySplit:3}];let s=await a.xlsx.writeBuffer(),c=new Blob([s],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),u=Ii(e.printedAt).replace(/[: ]/g,"").slice(0,13);return{blob:c,fileName:`${QL(e.documentTitle)}_${u}.xlsx`}}function ZL(e){return String(e??"").replace(/<br\s*\/?>(?=.)/gi,`
21
+ .ck.done{fill:#94a3b8;}`,".td.done { fill: #555555; }",".gt { font-size: 10px; font-weight: 700; fill: #000000; }",".label { font-size: 9px; fill: #333333; }",".value { font-size: 10px; }",".section { font-size: 11.5px; font-weight: 700; fill: #000000; }",".pageno { font-size: 9px; fill: #333333; }",`.head { fill: #eef2f7; stroke: ${Xl}; stroke-width: 0.5; }`,`.group { fill: #f8fafc; stroke: ${Xl}; stroke-width: 0.5; }`,`.frame { fill: none; stroke: ${Xl}; stroke-width: 0.5; }`,`.hline { stroke: ${Xl}; stroke-width: 0.5; }`,`.vline { stroke: ${Xl}; stroke-width: 0.5; }`,".bar { fill: #bfdbfe; stroke: #60a5fa; stroke-width: 0.6; }",".bar.done { fill: #e5e7eb; stroke: #cbd5e1; }",".bar.overdue { fill: #fecaca; stroke: #f87171; }"].join("");function Or(e,t,o){let a=o-yo;return[`<text x="${yo}" y="46" class="doc-title">${qe(e.documentTitle)}</text>`,`<text x="${yo}" y="66" class="doc-sub">${qe(e.subtitle)}</text>`,`<text x="${a}" y="42" class="doc-meta" text-anchor="end">${qe(e.facilityName)}</text>`,`<text x="${a}" y="58" class="doc-meta" text-anchor="end">${qe(n("print.printedAt",{time:wi(e.printedAt)}))}${e.printedBy?` \xB7 ${qe(e.printedBy)}`:""}</text>`,t?`<text x="${a}" y="74" class="doc-meta" text-anchor="end">${qe(t)}</text>`:""].join("")}function Mr(e){let{width:t,height:o,body:a,pageIndex:r,pageCount:i}=e;return[`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${o}" viewBox="0 0 ${t} ${o}">`,`<style>${OL}</style>`,`<rect x="0" y="0" width="${t}" height="${o}" fill="#ffffff" />`,a,`<text x="${t/2}" y="${o-22}" class="pageno" text-anchor="middle">${r+1} / ${i}</text>`,"</svg>"].join("")}var Np=Zl,sT=es,er=yo,ts=Np-yo,Ei=22,sa=20,Ri=22,Lr=18,ia=5,cT=xn,mT=en,zp=sT-46,Ar=[{key:"no",get label(){return n("print.no")},width:30,align:"middle"},{key:"title",get label(){return n("common.title")},width:300,align:"start"},{key:"status",get label(){return n("col.status")},width:60,align:"middle"},{key:"start",get label(){return n("board.start")},width:78,align:"middle"},{key:"due",get label(){return n("board.due")},width:78,align:"middle"},{key:"manager",get label(){return n("col.owner")},width:80,align:"middle"},{key:"priority",get label(){return n("col.priority")},width:60,align:"middle"},{key:"project",get label(){return n("col.project")},width:100,align:"middle"}],la=Ar.reduce((e,t,o)=>(e.push(o===0?er:e[o-1]+Ar[o-1].width),e),[]);function ML(e){let t=[],o=[],a=cT+Ei,r=0,i=(l,s)=>{t.push(o),o=[],a=mT+Ei,l&&(o.push({kind:"group",label:l,count:s,continued:!0}),a+=Ri)};for(let l of e){l.label&&(a+Ri+sa>zp&&i("",0),o.push({kind:"group",label:l.label,count:l.rows.length,continued:!1}),a+=Ri);for(let s of l.rows){a+sa>zp&&i(l.label,l.rows.length),r+=1,o.push({kind:"row",completed:s.completed,values:Ar.map(c=>{switch(c.key){case"no":return String(r);case"title":return s.title;case"status":return s.statusName;case"project":return s.projectLabel||n("props.defaultProject");case"manager":return s.managerName||"-";case"start":return s.startDate;case"due":return s.dueDate;default:return s.priorityName||"-"}})}),a+=sa;for(let c of s.checklistItems)c.label&&(a+Lr>zp&&i(l.label,l.rows.length),o.push({kind:"check",label:c.label,checked:c.checked,managerName:c.managerName,dueDate:c.dueDate}),a+=Lr)}}return t.push(o),t.filter((l,s)=>s===0||l.length>0)}function LL(e,t){let o=[],a=[],r=(l,s,c)=>{la.slice(1).forEach((u,m)=>{let d=m+1;c(d)||a.push(`<line x1="${u}" y1="${l}" x2="${u}" y2="${l+s}" class="vline" />`)})};o.push(`<rect x="${er}" y="${t}" width="${ts-er}" height="${Ei}" class="head" />`),Ar.forEach((l,s)=>{let c=la[s],u=l.align==="middle"?c+l.width/2:c+ia;o.push(`<text x="${u}" y="${t+Ei-7}" class="th" text-anchor="${l.align}">${qe(l.label)}</text>`)}),r(t,Ei,()=>!1);let i=t+Ei;for(let l of e){if(l.kind==="group"){o.push(`<rect x="${er}" y="${i}" width="${ts-er}" height="${Ri}" class="group" />`,`<text x="${er+ia}" y="${i+Ri-7}" class="gt">${qe(`${l.continued?n("print.continued",{label:l.label}):l.label} (${l.count})`)}</text>`),i+=Ri;continue}if(l.kind==="check"){let s=la[1]+ia+10,c=la[4]-la[1],u=l.checked?"ck done":"ck";o.push(`<text x="${s}" y="${i+Lr-5}" class="${u}">${qe(`${l.checked?"\u2713":"\u25CB"} ${Zn(l.label,c-ia*2-22,9)}`)}</text>`),l.dueDate&&o.push(`<text x="${la[4]+Ar[4].width/2}" y="${i+Lr-5}" class="${u}" text-anchor="middle">${qe(Zn(l.dueDate,Ar[4].width-ia*2,9))}</text>`),l.managerName&&o.push(`<text x="${la[5]+Ar[5].width/2}" y="${i+Lr-5}" class="${u}" text-anchor="middle">${qe(Zn(l.managerName,Ar[5].width-ia*2,9))}</text>`),o.push(`<line x1="${er}" y1="${i+Lr}" x2="${ts}" y2="${i+Lr}" class="hline" />`),r(i,Lr,m=>m>=2&&m<=3),i+=Lr;continue}Ar.forEach((s,c)=>{let u=la[c],m=s.align==="middle"?u+s.width/2:u+ia;o.push(`<text x="${m}" y="${i+sa-6}" class="${l.completed?"td done":"td"}" text-anchor="${s.align}">${qe(Zn(l.values[c]??"",s.width-ia*2,9))}</text>`)}),o.push(`<line x1="${er}" y1="${i+sa}" x2="${ts}" y2="${i+sa}" class="hline" />`),r(i,sa,()=>!1),i+=sa}return o.push(...a),o.push(`<rect x="${er}" y="${t}" width="${ts-er}" height="${i-t}" class="frame" />`),o.join("")}async function AL(e,t){let o=ML(t),a=t.reduce((r,i)=>r+i.rows.length,0);return o.map((r,i)=>{let l=i===0?cT:mT,s=[i===0?Or(e,n("print.totalCount",{totalCount:a}),Np):"",LL(r,l)].join("");return Mr({width:Np,height:sT,body:s,pageIndex:i,pageCount:o.length})})}var Hp=Ql,uT=Jl,tr=yo,hm=Hp-yo,qL=uT-46,dT=22,zL=68,NL=(hm-tr)/2,FL=14,Fp=58;function Pi(e){switch(e.kind){case"title":return 34;case"props":return Math.ceil(e.pairs.length/2)*dT+10;case"section":return 26;default:return FL}}function HL(e){let t=[{kind:"title",text:e.title,ticket:e.ticketNo}];return t.push({kind:"props",pairs:e.properties}),t.push({kind:"section",text:n("common.content")}),(e.content.trim()?e.content.split(`
22
+ `).flatMap(a=>a.trim()?Di(a,Fp):[""]):[n("print.noContent")]).forEach(a=>t.push({kind:"line",text:a,muted:!e.content.trim()})),e.checklist.length>0&&(t.push({kind:"section",text:n("print.todoCount",{value:e.checklist.filter(a=>a.checked).length,length:e.checklist.length})}),e.checklist.forEach(a=>{Di(a.label,Fp-3).forEach((r,i)=>t.push({kind:i===0?"check":"line",text:r,checked:a.checked}))})),e.includeComments&&e.comments.length>0&&(t.push({kind:"section",text:n("print.commentCount",{length:e.comments.length})}),e.comments.forEach(a=>{t.push({kind:"line",text:`${a.author} \xB7 ${a.time}`,muted:!0}),Di(a.text,Fp).forEach(r=>t.push({kind:"line",text:r}))})),t}function WL(e){let t=[],o=[],a=xn;for(let r of e){let i=Pi(r);a+i>qL&&(t.push(o),o=[],a=en),o.push(r),a+=i}return t.push(o),t}function $L(e,t){switch(e.kind){case"title":{let o=e.ticket?`<text x="${hm}" y="${t+16}" class="doc-meta" text-anchor="end">${qe(e.ticket)}</text>`:"";return{markup:`<text x="${tr}" y="${t+16}" class="section" style="font-size:14px">${qe(e.text)}</text>${o}<line x1="${tr}" y1="${t+24}" x2="${hm}" y2="${t+24}" class="hline" />`,nextY:t+Pi(e)}}case"props":{let o=[];return e.pairs.forEach((a,r)=>{let i=r%2,l=Math.floor(r/2),s=tr+i*NL,c=t+l*dT;o.push(`<text x="${s}" y="${c+14}" class="label">${qe(a.label)}</text>`,`<text x="${s+zL}" y="${c+14}" class="value">${qe(Di(a.value||"-",26)[0]??"-")}</text>`)}),{markup:o.join(""),nextY:t+Pi(e)}}case"section":return{markup:`<text x="${tr}" y="${t+16}" class="section">${qe(e.text)}</text><line x1="${tr}" y1="${t+21}" x2="${hm}" y2="${t+21}" class="hline" />`,nextY:t+Pi(e)};case"check":return{markup:`<text x="${tr}" y="${t+10}" class="td">${e.checked?"\u2611":"\u2610"}</text><text x="${tr+14}" y="${t+10}" class="${e.checked?"td done":"td"}">${qe(e.text)}</text>`,nextY:t+Pi(e)};default:return{markup:`<text x="${tr}" y="${t+10}" class="${e.muted?"td done":"td"}">${qe(e.text)}</text>`,nextY:t+Pi(e)}}}async function VL(e,t){let o=WL(HL(t));return o.map((a,r)=>{let i=r===0?xn:en,l=[r===0?Or(e,"",Hp):`<text x="${tr}" y="${en-12}" class="doc-meta">${qe(n("print.continued",{label:t.title}))}</text>`];for(let s of a){let c=$L(s,i);l.push(c.markup),i=c.nextY}return Mr({width:Hp,height:uT,body:l.join(""),pageIndex:r,pageCount:o.length})})}var $p=Zl,gT=es,km=yo,os=$p-yo,pT=gT-46,fT=210,ca=20,Wp=24;function ma(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;let t=new Date(`${e}T00:00:00`);return Number.isNaN(t.getTime())?null:t}function xT(e,t){return Math.round((t.getTime()-e.getTime())/864e5)}function KL(e,t){let o=[];e.forEach(l=>{let s=ma(l.startDate),c=ma(l.dueDate);s&&o.push(s),c&&o.push(c)});let a=ma(t)??new Date;if(o.length===0)return{start:a,days:30};let r=new Date(Math.min(...o.map(l=>l.getTime()))),i=new Date(Math.max(...o.map(l=>l.getTime())));return r.setDate(r.getDate()-1),i.setDate(i.getDate()+1),{start:r,days:Math.max(7,xT(r,i)+1)}}async function UL(e,t,o){let a=KL(t,o),r=km+fT,l=(os-r)/a.days,s=ma(o),c=f=>r+xT(a.start,f)*l,u=Math.max(1,Math.floor((pT-xn-Wp)/ca)),m=Math.max(1,Math.floor((pT-en-Wp)/ca)),d=[],p=0;for(;p<t.length||d.length===0;){let f=d.length===0?u:m;if(d.push(t.slice(p,p+f)),p+=f,p>=t.length)break}return d.map((f,g)=>{let x=g===0?xn:en,h=[g===0?Or(e,n("print.totalCount2",{length:t.length}),$p):""],E=x+Wp;h.push(`<line x1="${km}" y1="${E}" x2="${os}" y2="${E}" class="vline" />`);for(let b=0;b<a.days;b+=1){let B=new Date(a.start);if(B.setDate(B.getDate()+b),B.getDay()!==0&&b!==0)continue;let T=r+b*l;h.push(`<line x1="${T}" y1="${E}" x2="${T}" y2="${E+f.length*ca}" class="hline" />`,`<text x="${T+2}" y="${E-6}" class="label">${B.getMonth()+1}.${B.getDate()}</text>`)}if(s&&s>=a.start){let b=c(s);b>=r&&b<=os&&h.push(`<line x1="${b}" y1="${E}" x2="${b}" y2="${E+f.length*ca}" stroke="#f87171" stroke-width="0.8" />`)}return f.forEach((b,B)=>{let T=E+B*ca,z=Zn(b.title,fT-64,9);h.push(`<text x="${km}" y="${T+14}" class="${b.completed?"td done":"td"}">${qe(z)}</text>`,`<text x="${r-6}" y="${T+14}" class="label" text-anchor="end">${qe(b.managerName)}</text>`,`<line x1="${km}" y1="${T+ca}" x2="${os}" y2="${T+ca}" class="hline" />`);let k=ma(b.startDate)??ma(b.dueDate),_=ma(b.dueDate)??ma(b.startDate);if(!k||!_)return;let D=c(k),F=Math.max(D+l*.8,c(_)+l*.8),R=b.completed?"bar done":b.overdue?"bar overdue":"bar";h.push(`<rect x="${D}" y="${T+5}" width="${Math.max(3,Math.min(F,os)-D)}" height="${ca-10}" rx="2" class="${R}" />`)}),Mr({width:$p,height:gT,body:h.join(""),pageIndex:g,pageCount:d.length})})}function GL(e,t,o,a){return{title:e.title,managerName:e.managerName,startDate:String(t??"").slice(0,10),dueDate:String(o??"").slice(0,10),completed:e.completed,overdue:!e.completed&&!!o&&String(o).slice(0,10)<a}}var Vp=Ql,hT=Jl,Oi=yo,Tm=Vp-yo,bT=hT-46,Mi=30,Li=18,kT=12;function jL(e){let t=[],o=[],a=xn,r=(i,l)=>{t.push(o),o=[],a=en,i&&(o.push({kind:"column",label:i,summary:l,continued:!0,gapBefore:!1}),a+=Mi)};for(let i of e){let l=o.length>0,s=l?kT:0;if(a+s+Mi+Li>bT?(r("",""),o.push({kind:"column",label:i.label,summary:i.summary,continued:!1,gapBefore:!1}),a+=Mi):(o.push({kind:"column",label:i.label,summary:i.summary,continued:!1,gapBefore:l}),a+=s+Mi),i.items.length===0){o.push({kind:"empty"}),a+=Li;continue}for(let c of i.items)a+Li>bT&&r(i.label,i.summary),o.push({kind:"item",title:c.title,meta:c.meta,completed:c.completed}),a+=Li}return t.push(o),t}async function YL(e,t,o){let a=jL(t);return a.map((r,i)=>{let l=i===0?xn:en,s=[i===0?Or(e,o,Vp):""];for(let c of r){if(c.kind==="column"){c.gapBefore&&(l+=kT),s.push(`<rect x="${Oi}" y="${l}" width="${Tm-Oi}" height="${Mi-6}" class="group" />`,`<text x="${Oi+6}" y="${l+16}" class="gt">${qe(c.continued?n("print.continued",{label:c.label}):c.label)}</text>`,`<text x="${Tm-6}" y="${l+16}" class="label" text-anchor="end">${qe(c.summary)}</text>`),l+=Mi;continue}if(c.kind==="empty"){s.push(`<text x="${Oi+12}" y="${l+12}" class="td done">${qe(n("print.noTasks"))}</text>`),l+=Li;continue}s.push(`<text x="${Oi+12}" y="${l+12}" class="${c.completed?"td done":"td"}">${qe(Zn(c.title,Tm-Oi-12-120,9))}</text>`,`<text x="${Tm-6}" y="${l+12}" class="label" text-anchor="end">${qe(c.meta)}</text>`),l+=Li}return Mr({width:Vp,height:hT,body:s.join(""),pageIndex:i,pageCount:a.length})})}var XL=[{get header(){return n("print.group")},width:16},{get header(){return n("common.title")},width:44},{get header(){return n("col.status")},width:10},{get header(){return n("col.project")},width:14},{get header(){return n("col.owner")},width:10},{get header(){return n("col.cc")},width:22},{get header(){return n("board.start")},width:12},{get header(){return n("board.due")},width:14},{get header(){return n("col.priority")},width:8},{get header(){return n("section.todo")},width:8},{get header(){return n("col.note")},width:30}],QL="FFEEF2F7",ym="FFCBD5E1";function JL(e){return e.replace(/[\\/:*?"<>|]/g,"_").trim()||n("print.sheetName")}async function ZL(e,t){let o=await import("./chunks/exceljs.min-XQ4JIAQG.js"),a=new o.Workbook,r=a.addWorksheet(n("print.sheetName"),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0,fitToWidth:1,fitToHeight:0}});r.columns=XL.map(m=>({header:m.header,width:m.width})),r.spliceRows(1,0,[`${e.documentTitle}`],[`${e.subtitle} \xB7 ${e.facilityName} \xB7 ${n("print.printedAt",{time:wi(e.printedAt)})}${e.printedBy?` \xB7 ${e.printedBy}`:""}`]),r.getRow(1).font={bold:!0,size:14},r.getRow(2).font={size:10,color:{argb:"FF6B7280"}};let i=r.getRow(3);i.font={bold:!0,size:10},i.eachCell(m=>{m.fill={type:"pattern",pattern:"solid",fgColor:{argb:QL}},m.alignment={vertical:"middle",horizontal:"center"}}),t.forEach(m=>{m.rows.forEach(d=>{let p=r.addRow([m.label,d.title,d.statusName,d.projectLabel||n("props.defaultProject"),d.managerName,d.receiverNamesFull,d.startDate==="-"?"":d.startDate,d.dueDate==="-"?"":d.dueDate,d.priorityName,d.checklist,d.note]);p.font={size:10,color:{argb:d.completed?"FF9CA3AF":"FF111827"}},p.alignment={vertical:"middle",wrapText:!1}})});let l=r.rowCount;for(let m=3;m<=l;m+=1)r.getRow(m).eachCell({includeEmpty:!0},d=>{d.border={top:{style:"thin",color:{argb:ym}},left:{style:"thin",color:{argb:ym}},bottom:{style:"thin",color:{argb:ym}},right:{style:"thin",color:{argb:ym}}}});r.views=[{state:"frozen",ySplit:3}];let s=await a.xlsx.writeBuffer(),c=new Blob([s],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),u=wi(e.printedAt).replace(/[: ]/g,"").slice(0,13);return{blob:c,fileName:`${JL(e.documentTitle)}_${u}.xlsx`}}function eA(e){return String(e??"").replace(/<br\s*\/?>(?=.)/gi,`
23
23
  `).replace(/<\/(p|div|li|h[1-6])>/gi,`
24
- `).replace(/<[^>]+>/g,"").replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function eA(e,t){let o=Ap(e,t);return{title:o.title,ticketNo:String(e.ticket_no??"").trim(),properties:[{label:n("col.status"),value:o.statusName},{label:n("col.project"),value:o.projectLabel||n("props.defaultProject")},{label:n("col.owner"),value:o.managerName},{label:n("col.cc"),value:o.receiverNamesFull},{label:n("col.startTime"),value:o.startDate},{label:n("col.due"),value:o.dueDate},{label:n("col.priority"),value:o.priorityName},{label:n("col.author"),value:String(e.created_by??"")}],content:ZL(e.content),checklist:(e.checklist??[]).map(a=>({label:String(a.label??""),checked:!!a.checked})),comments:(e.comments??[]).map(a=>({author:String(a.author??""),time:String(a.time??""),text:xi(String(a.text??""))})),includeComments:!0}}export{xH as ALL_TASK_VIEWER_ACCOUNT_SEQS,Kx as AddLabelDialog,Ms as AddTabDialog,Nd as AssistPopper,Wx as AttachmentUploadGauge,wd as AttachmentUploadPercent,mu as BUG_DEVICE_OPTIONS,a0 as BUG_GROUP_KEY,ps as BUG_ICON_COLOR,TF as BUG_KANBAN_COLUMNS,cu as BUG_REPRO_OPTIONS,uu as BUG_RESOLUTION_OPTIONS,ga as BUG_STATUS_OPTIONS,ds as BUG_TASK_ICON,xc as BugPropertiesGrid,ii as CALENDAR_CHIP_FONT_SIZE,Xu as CALENDAR_PRIORITY_DOT_COLORS,$f as COLUMN_WIDTHS,el as COMPLETED_STATUS_OPTION,Zo as CONT_BODY_TOP,fp as CUSTOM_TAB_KEY_PREFIX,VZ as CalendarLinkDialog,Jr as CalendarTaskChip,ss as ChartEmptyMessage,Yr as CommentBubbleIcon,Ac as CommentRichEditor,Xa as ConfirmCountButton,Hh as CumulativeFlowChart,Lf as DATE_REMINDER_OPTIONS,wI as DEFAULT_COMPACT_COLUMNS,Gi as DEFAULT_PROJECT_ICON,jE as DEFAULT_SLASH_COMMANDS,Hoe as DEFAULT_TASKBOX_TAB_ITEMS,Hr as DEFAULT_TASK_ICON,pa as DEFAULT_WORKLOAD_CAPACITY,bd as DRAWER_SECTION_TITLE_FONT_SIZE,_oe as DateRangeFilterPopover,Ao as DrawerSection,an as DueDatePickerPopover,QS as ENDED_EVENT_STATUS_OPTION,Vm as EVENT_ICON_COLOR,zt as EVENT_TASK_ICON,wee as EmployeeSelectDialog,gn as FIRST_BODY_TOP,fu as GROUP_BY_OPTIONS,ai as GoogleEventChip,dee as GoogleEventDialog,goe as GroupByMenuButton,ik as HeaderMenuDot,ak as HeaderRadioItem,Rs as IconPickerGrid,yx as InlineAddressInput,yr as InlineTextValue,pu as KANBAN_CLOSED_COLUMN_KEY,Zl as LANDSCAPE_HEIGHT,Jl as LANDSCAPE_WIDTH,Ene as LabelFilterMenu,Dc as LabelSelectMenu,Wh as LeadTimeDistributionChart,yb as LinkifiedText,ol as MANUAL_TASK_STATUS_OPTIONS,To as MARGIN_X,loe as MemberFilterMenu,r0 as NOTICE_GROUP_KEY,tl as NOTICE_STATUS_OPTIONS,wt as NOTICE_TASK_ICON,nf as NO_TASK_ICON,Ql as PORTRAIT_HEIGHT,Xl as PORTRAIT_WIDTH,rf as PROJECT_ICON_OPTIONS,ke as PropertyRow,Kr as RECEIVER_AVATAR_COLORS,Af as REMINDER_OPTIONS,Gr as REVIEW_DONE_BUTTON_SX,So as ReceiverAvatarStack,Vb as RelatedTasksSection,Gd as RichCommentBody,uA as STATUS_KEY_REPLIED,jp as STATUS_KEY_WAITING,i0 as SUPPORT_GROUP_KEY,Sre as ShortcutHelpDialog,Tg as SortableTaskCard,Fh as SprintBurndownChart,Gte as SprintChartsDialog,ih as SprintCloseDialog,zne as SprintFilterMenu,BZ as SprintManageDialog,Nh as SprintVelocityChart,Ka as StatusSelectMenu,Ls as TASKBOX_COLUMNS,Vf as TASKBOX_COLUMN_LAYOUT,Tr as TASKBOX_DRAWER_NARROW_MQ,dd as TASKBOX_GRID_FOUR_CQ,_T as TASKBOX_LOCALES,Ba as TASKBOX_PROPERTY_APPEARANCE,Yne as TASKBOX_SHORTCUT_HELP,pf as TASKBOX_UI_STATE_ID,hk as TASKBOX_VIEW_LABELS,B9 as TASKBOX_VIEW_MODES,qu as TASK_CARD_DRAG_HANDLE_CLASS,$a as TASK_DETAIL_FORM_FIELDS,Ji as TASK_REPEAT_RULE_OPTIONS,Mo as TASK_STATUS_OPTIONS,E0 as TIME_REMINDER_OPTIONS,Qs as TaskAckListPopover,Uo as TaskActionButton,Wc as TaskActivityDialog,Ic as TaskAttachmentsSection,sx as TaskBoxColumnSummary,nV as TaskBoxCompactTable,Vu as TaskBoxGroupBoard,I$ as TaskBoxMobileList,ex as TaskBoxMonthAgenda,Gg as TaskBoxMonthCalendar,H9 as TaskBoxSprintColumnSummary,gg as TaskBoxTable,Woe as TaskBoxTabs,ix as TaskBoxTimeline,v9 as TaskBoxView,Hg as TaskBoxWeekCalendar,ml as TaskCardContent,vc as TaskChecklistSection,wb as TaskCommentInput,Ib as TaskCommentsSection,hc as TaskContentEditor,yc as TaskContentTemplateMenu,zb as TaskContentTranslateDialog,vne as TaskContextMenu,gc as TaskCorePropertiesGrid,Md as TaskCreateBody,ab as TaskCreateDrawer,mk as TaskDateRangeFilter,Zb as TaskDetailBody,$J as TaskDetailDrawer,Pb as TaskDetailHeader,Vr as TaskIconPickerPopover,Wr as TaskLabelChips,Sc as TaskLinkDialog,Nb as TaskNoteField,uo as TaskPriorityChip,cae as TaskRuleManageDialog,Ve as TaskStatusChip,wF as TaskStatusChips,Vae as TaskTemplateManageDialog,iie as TaskTemplateRunDialog,qre as TaskboxManualDialog,qT as TaskboxProvider,zh as WorkloadCapacityDialog,$h as WorkloadChart,jh as WorkloadPersonTasks,Xh as WorkloadPersonTasksDialog,Jh as WorkloadTimelineGrid,mc as addDaysToDate,Ym as addTaskCreateChecklistItem,Zm as addTaskCreatePendingFiles,Gm as applyTaskCreateRepeatRule,nu as applyTaskRepeatRule,ru as applyTaskRepeatUntil,mA as averageWorkload,zd as buildAssistItems,Js as buildCardBaseSx,aA as buildCumulativeFlow,iA as buildLeadCycleDistribution,PI as buildPlannedTask,_f as buildStatusOptionColors,jL as buildTaskColumnsPrintSvgPages,eA as buildTaskDetailPrintData,$L as buildTaskDetailPrintSvgPages,Ds as buildTaskGroupSections,LL as buildTaskListPrintSvgPages,JL as buildTaskListXlsx,tp as buildTaskRelationsModel,WR as buildTaskShareText,UL as buildTaskTimelinePrintSvgPages,Fl as buildTaskboxShortcutHelp,ys as buildTaskboxTheme,uc as buildTemplateTasks,Kp as buildWorkloadRows,Gp as buildWorkloadTimeline,Kf as canAssignBugManager,zs as canClaimTaskItem,Gf as canCompleteTaskItem,vv as canDeleteTaskItem,Sv as canEditTaskCoreItem,Hn as canEditTaskItem,qs as canViewTaskItem,Ns as canVolunteerTaskItem,Km as changeTaskCreateType,Jn as clampPrintText,wl as commentHtmlToPlain,xi as commentPlainText,ri as compareCalendarTasks,Ur as coreEditLocked,op as countTaskRelations,cx as countWorkdays,jS as createTaskboxTheme,lx as daysLeftUntil,hs as defaultRepeatUntil,Rm as defaultTaskBoxFormValues,Pm as defaultTaskboxUiStateValues,ha as deleteLocked,im as diffFilterValues,Dl as editorHtmlToComment,Ae as escapePrintXml,xm as estimatePrintTextWidth,_u as feedAuthorName,ff as filterFilesWithinLimit,_l as findQuery,c3 as formatConfirmTime,O9 as formatHours,$o as formatKoreanDate,Vo as formatKoreanDateTime,wu as formatMonthDay,lV as formatOffsetLabel,gm as formatPrintDate,Ii as formatPrintStamp,sn as formatSprintOptionLabel,vf as getBugDeviceName,Sf as getBugReproName,Cs as getBugResolutionName,JS as getBugStatusOption,ni as getCalendarTaskTime,Om as getContributionParticipants,oA as getDefaultDateRange,nl as getEventDisplayStatusOption,CF as getNoDueStatusRank,Xx as getNoticeAckInfo,Bf as getNoticeStatusOption,NK as getNoticeTargetDisplay,uN as getProjectIconAnchorComponent,Oe as getProjectIconComponent,R0 as getReminderLabel,hu as getReminderOptions,ku as getRemindersLabel,bs as getRepeatRuleLabel,Bs as getStatusOptionsForTask,Wne as getTabHeaderConfig,As as getTaskBoxColumnDefs,pH as getTaskBoxGridMinWidth,dH as getTaskBoxGridTemplate,p5 as getTaskBoxTabKind,$n as getTaskConfirmInfo,Nt as getTaskDisplayStatusOption,vs as getTaskStatusOption,fa as getTaskboxLocale,Ga as getTaskboxNoProjectLabel,oi as groupGoogleEventsByDate,Rn as groupSeqFromTabKey,FX as hasRelation,Wb as hasTaskRelations,kb as highlightMentions,Ea as htmlToPlainText,MM as isCustomTabKey,sl as isFeedOnlyItem,nA as isFlowTask,Uf as isOpenPoolTaskItem,sA as isOverCapacity,cA as isOverloaded,du as isPastEvent,gi as isRichComment,Fs as isSupportOriginTaskItem,Ss as isTaskDone,yF as isWaitingTask,af as loadMuiIconCatalog,Cn as managerColumnName,vm as monthsAgoDate,In as narrowOrderSx,IT as normalizeTaskboxLocale,WJ as nowDateTimeString,Up as nowMinuteString,gs as parseContributionPercent,F1 as parseEstimatedHours,rA as parseTaskTimeMs,cs as pickPersonWorkloadTasks,$d as plainCommentToHtml,Aa as relationsOf,Qm as removeTaskCreateChecklistItem,eu as removeTaskCreatePendingFile,Pr as renderPrintHeader,Um as resetTaskCreateForm,cf as resolveContributionValues,nn as resolveReminders,lA as resolveRowCapacity,Ua as resolveTaskStatusOptions,lu as resolveTaskboxTheme,tA as resolveWorkloadCapacity,Oc as sanitizeCommentHtml,oV as selectDepartmentSharedTasks,jm as setTaskCreateRepeatUntil,Zi as setTaskCreateVisibility,DT as setTaskboxLabels,wT as setTaskboxLocale,NF as setTaskboxNoProjectLabel,hi as shareTaskText,Lm as splitContributionEvenly,Am as sumContributionValues,L9 as sumRemainingHours,Ec as summarizeNoticeTargets,aZ as tabKeyFromGroupSeq,kd as taskContentRichSx,Xi as taskToDetailFormValues,ln as taskVisibilityOf,Sm as taskboxIntlTag,n as tbT,on as tbTRich,qm as toContributionList,Ap as toTaskPrintRow,KL as toTimelinePrintRow,Wi as toYmd,_s as toggleLabelKey,fs as toggleReminder,Xm as toggleTaskCreateChecklistItem,Jm as updateTaskCreateChecklistItem,qd as useAssistSources,Vi as useBuildFileUrl,hd as useDrawerSectionTitleStyle,Bi as useHeaderMenuPosition,sf as useIconPickerGroups,sb as useMentionAutocomplete,Rl as useTaskActivityController,Hx as useTaskAttachmentUploadMeta,Zd as useTaskContentTranslateController,FS as useTaskCreateController,au as useTaskDetailController,Fm as useTaskDetailForm,kl as useTaskLinkController,le as useTaskboxConfig,ji as useTaskboxForm,L as useTaskboxLocale,jne as useTaskboxShortcuts,ET as useTaskboxT,xe as useTaskboxTheme,Tn as useTaskboxUiState,Ui as useUploadMaxMb,bf as validateTaskCreateForm,lt as wideColumnSx,Hs as withOriginAuthorAvatar,Mr as wrapPrintPage,wi as wrapPrintText};
24
+ `).replace(/<[^>]+>/g,"").replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function tA(e,t){let o=qp(e,t);return{title:o.title,ticketNo:String(e.ticket_no??"").trim(),properties:[{label:n("col.status"),value:o.statusName},{label:n("col.project"),value:o.projectLabel||n("props.defaultProject")},{label:n("col.owner"),value:o.managerName},{label:n("col.cc"),value:o.receiverNamesFull},{label:n("col.startTime"),value:o.startDate},{label:n("col.due"),value:o.dueDate},{label:n("col.priority"),value:o.priorityName},{label:n("col.author"),value:String(e.created_by??"")}],content:eA(e.content),checklist:(e.checklist??[]).map(a=>({label:String(a.label??""),checked:!!a.checked})),comments:(e.comments??[]).map(a=>({author:String(a.author??""),time:String(a.time??""),text:bi(String(a.text??""))})),includeComments:!0}}export{TH as ALL_TASK_VIEWER_ACCOUNT_SEQS,Gx as AddLabelDialog,Ms as AddTabDialog,Fd as AssistPopper,$x as AttachmentUploadGauge,Dd as AttachmentUploadPercent,uu as BUG_DEVICE_OPTIONS,i0 as BUG_GROUP_KEY,fs as BUG_ICON_COLOR,CF as BUG_KANBAN_COLUMNS,mu as BUG_REPRO_OPTIONS,du as BUG_RESOLUTION_OPTIONS,xa as BUG_STATUS_OPTIONS,ps as BUG_TASK_ICON,bc as BugPropertiesGrid,li as CALENDAR_CHIP_FONT_SIZE,Qu as CALENDAR_PRIORITY_DOT_COLORS,Vf as COLUMN_WIDTHS,tl as COMPLETED_STATUS_OPTION,en as CONT_BODY_TOP,gp as CUSTOM_TAB_KEY_PREFIX,see as CalendarLinkDialog,Zr as CalendarTaskChip,cs as ChartEmptyMessage,Xr as CommentBubbleIcon,qc as CommentRichEditor,Qa as ConfirmCountButton,Wh as CumulativeFlowChart,Af as DATE_REMINDER_OPTIONS,DI as DEFAULT_COMPACT_COLUMNS,ji as DEFAULT_PROJECT_ICON,YE as DEFAULT_SLASH_COMMANDS,cne as DEFAULT_TASKBOX_TAB_ITEMS,Wr as DEFAULT_TASK_ICON,fa as DEFAULT_WORKLOAD_CAPACITY,hd as DRAWER_SECTION_TITLE_FONT_SIZE,joe as DateRangeFilterPopover,qo as DrawerSection,ln as DueDatePickerPopover,JS as ENDED_EVENT_STATUS_OPTION,Km as EVENT_ICON_COLOR,Nt as EVENT_TASK_ICON,Uee as EmployeeSelectDialog,xn as FIRST_BODY_TOP,gu as GROUP_BY_OPTIONS,ii as GoogleEventChip,Eee as GoogleEventDialog,Aoe as GroupByMenuButton,lk as HeaderMenuDot,ik as HeaderRadioItem,Ps as IconPickerGrid,Cx as InlineAddressInput,Cr as InlineTextValue,fu as KANBAN_CLOSED_COLUMN_KEY,es as LANDSCAPE_HEIGHT,Zl as LANDSCAPE_WIDTH,Jne as LabelFilterMenu,Ec as LabelSelectMenu,$h as LeadTimeDistributionChart,Cb as LinkifiedText,nl as MANUAL_TASK_STATUS_OPTIONS,yo as MARGIN_X,woe as MemberFilterMenu,a0 as NOTICE_GROUP_KEY,ol as NOTICE_STATUS_OPTIONS,Dt as NOTICE_TASK_ICON,rf as NO_TASK_ICON,Jl as PORTRAIT_HEIGHT,Ql as PORTRAIT_WIDTH,af as PROJECT_ICON_OPTIONS,Te as PropertyRow,Gr as RECEIVER_AVATAR_COLORS,qf as REMINDER_OPTIONS,jr as REVIEW_DONE_BUTTON_SX,vo as ReceiverAvatarStack,Kb as RelatedTasksSection,jd as RichCommentBody,dA as STATUS_KEY_REPLIED,Yp as STATUS_KEY_WAITING,l0 as SUPPORT_GROUP_KEY,Kre as ShortcutHelpDialog,yg as SortableTaskCard,Hh as SprintBurndownChart,foe as SprintChartsDialog,lh as SprintCloseDialog,ire as SprintFilterMenu,WZ as SprintManageDialog,Fh as SprintVelocityChart,Ga as StatusSelectMenu,As as TASKBOX_COLUMNS,Kf as TASKBOX_COLUMN_LAYOUT,yr as TASKBOX_DRAWER_NARROW_MQ,pd as TASKBOX_GRID_FOUR_CQ,ee as TASKBOX_LINE_COLOR,IT as TASKBOX_LOCALES,_a as TASKBOX_PROPERTY_APPEARANCE,bre as TASKBOX_SHORTCUT_HELP,ff as TASKBOX_UI_STATE_ID,kk as TASKBOX_VIEW_LABELS,D9 as TASKBOX_VIEW_MODES,zu as TASK_CARD_DRAG_HANDLE_CLASS,Va as TASK_DETAIL_FORM_FIELDS,Zi as TASK_REPEAT_RULE_OPTIONS,Mo as TASK_STATUS_OPTIONS,R0 as TIME_REMINDER_OPTIONS,Js as TaskAckListPopover,Uo as TaskActionButton,$c as TaskActivityDialog,wc as TaskAttachmentsSection,cx as TaskBoxColumnSummary,lV as TaskBoxCompactTable,Ku as TaskBoxGroupBoard,R6 as TaskBoxMobileList,tx as TaskBoxMonthAgenda,jg as TaskBoxMonthCalendar,K9 as TaskBoxSprintColumnSummary,xg as TaskBoxTable,mne as TaskBoxTabs,lx as TaskBoxTimeline,w9 as TaskBoxView,Wg as TaskBoxWeekCalendar,ul as TaskCardContent,Bc as TaskChecklistSection,Db as TaskCommentInput,wb as TaskCommentsSection,kc as TaskContentEditor,Cc as TaskContentTemplateMenu,Nb as TaskContentTranslateDialog,Une as TaskContextMenu,xc as TaskCorePropertiesGrid,Md as TaskCreateBody,ib as TaskCreateDrawer,uk as TaskDateRangeFilter,eh as TaskDetailBody,aZ as TaskDetailDrawer,Ob as TaskDetailHeader,Kr as TaskIconPickerPopover,$r as TaskLabelChips,vc as TaskLinkDialog,Fb as TaskNoteField,po as TaskPriorityChip,Pae as TaskRuleManageDialog,Ke as TaskStatusChip,EF as TaskStatusChips,fie as TaskTemplateManageDialog,Rie as TaskTemplateRunDialog,aae as TaskboxManualDialog,zT as TaskboxProvider,Nh as WorkloadCapacityDialog,Vh as WorkloadChart,Yh as WorkloadPersonTasks,Qh as WorkloadPersonTasksDialog,Zh as WorkloadTimelineGrid,uc as addDaysToDate,Xm as addTaskCreateChecklistItem,eu as addTaskCreatePendingFiles,jm as applyTaskCreateRepeatRule,ru as applyTaskRepeatRule,au as applyTaskRepeatUntil,uA as averageWorkload,Nd as buildAssistItems,Zs as buildCardBaseSx,iA as buildCumulativeFlow,lA as buildLeadCycleDistribution,OI as buildPlannedTask,If as buildStatusOptionColors,YL as buildTaskColumnsPrintSvgPages,tA as buildTaskDetailPrintData,VL as buildTaskDetailPrintSvgPages,Es as buildTaskGroupSections,AL as buildTaskListPrintSvgPages,ZL as buildTaskListXlsx,op as buildTaskRelationsModel,$R as buildTaskShareText,UL as buildTaskTimelinePrintSvgPages,Hl as buildTaskboxShortcutHelp,Cs as buildTaskboxTheme,dc as buildTemplateTasks,Gp as buildWorkloadRows,jp as buildWorkloadTimeline,Gf as canAssignBugManager,Ns as canClaimTaskItem,jf as canCompleteTaskItem,Bv as canDeleteTaskItem,vv as canEditTaskCoreItem,Wn as canEditTaskItem,zs as canViewTaskItem,Fs as canVolunteerTaskItem,Gm as changeTaskCreateType,Zn as clampPrintText,Dl as commentHtmlToPlain,bi as commentPlainText,ai as compareCalendarTasks,Ur as coreEditLocked,np as countTaskRelations,mx as countWorkdays,YS as createTaskboxTheme,sx as daysLeftUntil,ks as defaultRepeatUntil,Pm as defaultTaskBoxFormValues,Om as defaultTaskboxUiStateValues,ka as deleteLocked,lm as diffFilterValues,El as editorHtmlToComment,qe as escapePrintXml,bm as estimatePrintTextWidth,Iu as feedAuthorName,gf as filterFilesWithinLimit,Il as findQuery,p3 as formatConfirmTime,z9 as formatHours,Vo as formatKoreanDate,Ko as formatKoreanDateTime,Du as formatMonthDay,uV as formatOffsetLabel,xm as formatPrintDate,wi as formatPrintStamp,cn as formatSprintOptionLabel,Bf as getBugDeviceName,vf as getBugReproName,Ss as getBugResolutionName,ZS as getBugStatusOption,ri as getCalendarTaskTime,Lm as getContributionParticipants,nA as getDefaultDateRange,rl as getEventDisplayStatusOption,vF as getNoDueStatusRank,Qx as getNoticeAckInfo,_f as getNoticeStatusOption,UU as getNoticeTargetDisplay,dN as getProjectIconAnchorComponent,Le as getProjectIconComponent,P0 as getReminderLabel,ku as getReminderOptions,Tu as getRemindersLabel,hs as getRepeatRuleLabel,_s as getStatusOptionsForTask,mre as getTabHeaderConfig,qs as getTaskBoxColumnDefs,bH as getTaskBoxGridMinWidth,xH as getTaskBoxGridTemplate,f5 as getTaskBoxTabKind,Vn as getTaskConfirmInfo,Ft as getTaskDisplayStatusOption,Bs as getTaskStatusOption,ga as getTaskboxLocale,ja as getTaskboxNoProjectLabel,ni as groupGoogleEventsByDate,Pn as groupSeqFromTabKey,ZX as hasRelation,$b as hasTaskRelations,Tb as highlightMentions,Ra as htmlToPlainText,MO as isCustomTabKey,cl as isFeedOnlyItem,rA as isFlowTask,Uf as isOpenPoolTaskItem,cA as isOverCapacity,mA as isOverloaded,pu as isPastEvent,xi as isRichComment,Hs as isSupportOriginTaskItem,vs as isTaskDone,SF as isWaitingTask,lf as loadMuiIconCatalog,Sn as managerColumnName,Bm as monthsAgoDate,wn as narrowOrderSx,wT as normalizeTaskboxLocale,rZ as nowDateTimeString,Up as nowMinuteString,xs as parseContributionPercent,H1 as parseEstimatedHours,aA as parseTaskTimeMs,ms as pickPersonWorkloadTasks,Vd as plainCommentToHtml,qa as relationsOf,Jm as removeTaskCreateChecklistItem,tu as removeTaskCreatePendingFile,Or as renderPrintHeader,Um as resetTaskCreateForm,mf as resolveContributionValues,rn as resolveReminders,sA as resolveRowCapacity,Ua as resolveTaskStatusOptions,su as resolveTaskboxTheme,oA as resolveWorkloadCapacity,Lc as sanitizeCommentHtml,iV as selectDepartmentSharedTasks,Ym as setTaskCreateRepeatUntil,el as setTaskCreateVisibility,ET as setTaskboxLabels,DT as setTaskboxLocale,HF as setTaskboxNoProjectLabel,ki as shareTaskText,Am as splitContributionEvenly,qm as sumContributionValues,N9 as sumRemainingHours,Rc as summarizeNoticeTargets,CZ as tabKeyFromGroupSeq,Td as taskContentRichSx,Qi as taskToDetailFormValues,sn as taskVisibilityOf,vm as taskboxIntlTag,n as tbT,nn as tbTRich,zm as toContributionList,qp as toTaskPrintRow,GL as toTimelinePrintRow,$i as toYmd,Is as toggleLabelKey,gs as toggleReminder,Qm as toggleTaskCreateChecklistItem,Zm as updateTaskCreateChecklistItem,zd as useAssistSources,Ki as useBuildFileUrl,kd as useDrawerSectionTitleStyle,_i as useHeaderMenuPosition,cf as useIconPickerGroups,cb as useMentionAutocomplete,Pl as useTaskActivityController,Wx as useTaskAttachmentUploadMeta,ep as useTaskContentTranslateController,HS as useTaskCreateController,iu as useTaskDetailController,Hm as useTaskDetailForm,Tl as useTaskLinkController,se as useTaskboxConfig,Yi as useTaskboxForm,L as useTaskboxLocale,xre as useTaskboxShortcuts,RT as useTaskboxT,be as useTaskboxTheme,yn as useTaskboxUiState,Ui as useUploadMaxMb,hf as validateTaskCreateForm,st as wideColumnSx,Ws as withOriginAuthorAvatar,Mr as wrapPrintPage,Di as wrapPrintText};
25
25
  //# sourceMappingURL=index.esm.js.map