export function isJudgeTaskEntry(_0x46986a){return _0x46986a?.['isJudgeTask']===!![]||_0x46986a?.['taskType']==='judge'||_0x46986a?.['task_type']==='judge';}export function getDisplayTaskVariants(_0x504b62){if(!Array['isArray'](_0x504b62))return[];const _0x13d77a=_0x504b62['filter'](_0x3ece8a=>!isJudgeTaskEntry(_0x3ece8a));return _0x13d77a['length']>0x0?_0x13d77a:_0x504b62;}export function getDisplayTaskVariantCount(_0x556722){return getDisplayTaskVariants(_0x556722)['length'];}export function isDisplayTaskGroup(_0x3b3bfa){return getDisplayTaskVariantCount(_0x3b3bfa)>0x1;}export function getAggregateTaskStatus(_0x156d6b,{fallback:fallback='unknown'}={}){const _0x83e521=Array['isArray'](_0x156d6b)?_0x156d6b['filter'](Boolean):[];if(_0x83e521['length']===0x0)return fallback;const _0x1cb2fa=_0x83e521['map'](_0x32aaf2=>_0x32aaf2?.['status']||'unknown'),_0x1c3d60=_0x4cf71a=>_0x1cb2fa['every'](_0x5f29c4=>_0x5f29c4===_0x4cf71a),_0x2bf2d9=_0x44732a=>_0x1cb2fa['some'](_0x359132=>_0x359132===_0x44732a);if(_0x1c3d60('staged'))return'staged';if(_0x1c3d60('queued'))return'queued';if(_0x2bf2d9('running'))return'running';if(_0x2bf2d9('queued'))return'queued';if(_0x2bf2d9('failed'))return'failed';if(_0x1c3d60('interrupted'))return'interrupted';if(_0x2bf2d9('completed'))return'completed';return fallback;}export function getTaskTileStatus({primary:_0x2a8c58,variants:_0x5b7a45,isGroup:isGroup=![]}={}){const _0x510652=_0x2a8c58?.['status']||'unknown',_0x3e1bda=Array['isArray'](_0x5b7a45)?_0x5b7a45['filter'](Boolean):[],_0x25f48d=_0x3e1bda['some'](_0x3f2165=>_0x3f2165?.['taskId']!==_0x2a8c58?.['taskId']&&isJudgeTaskEntry(_0x3f2165));if(!isGroup&&!_0x25f48d)return _0x510652;return getAggregateTaskStatus(_0x3e1bda['length']>0x0?_0x3e1bda:[_0x2a8c58],{'fallback':_0x510652});}export function getTaskTileStatusLabel({primary:_0x1df4df,variants:_0x5ddc6c,isGroup:isGroup=![]}={}){const _0x5711b2=getTaskTileStatus({'primary':_0x1df4df,'variants':_0x5ddc6c,'isGroup':isGroup});if(_0x5711b2!=='running'){const _0x14f649={'interrupted':'Interrupted','failed':'Failed','staged':'Staged','queued':'Queued'};return _0x14f649[_0x5711b2]||'';}const _0x1a6126=Array['isArray'](_0x5ddc6c)&&_0x5ddc6c['length']>0x0?_0x5ddc6c['filter'](Boolean):[_0x1df4df]['filter'](Boolean),_0x2471a7=_0x1a6126['filter'](_0x12dfd6=>_0x12dfd6?.['status']==='running'),_0x35f7bb=_0x2471a7['length']>0x0&&_0x2471a7['every'](isJudgeTaskEntry);if(!_0x35f7bb)return'Running';return _0x2471a7['every'](_0x28d6c2=>_0x28d6c2?.['judgeMode']==='review')?'Reviewing':'Judging';}export function getTaskActivityTime(_0x461f53){const _0x371847=_0x461f53?.['lastActivityTimestamp']||_0x461f53?.['lastActivity']||_0x461f53?.['updatedAt']||_0x461f53?.['createdAt'],_0x200967=_0x371847?new Date(_0x371847)['getTime']():0x0;return Number['isFinite'](_0x200967)?_0x200967:0x0;}export function hasLiveTaskStatusDetail(_0x14d8b2){return Boolean(_0x14d8b2?.['status']==='running'&&(_0x14d8b2['lastActivityAction']||typeof _0x14d8b2['progress']==='number'||_0x14d8b2['currentPhase']));}export function getDashboardStatusDetailTask(_0x181349,_0x175c1b,_0x4d5742,{displayVariants:displayVariants=null}={}){if(!_0x4d5742)return _0x181349;if(hasLiveTaskStatusDetail(_0x181349))return _0x181349;const _0x332ec3=Array['isArray'](_0x175c1b)?_0x175c1b['filter'](Boolean):[],_0x3bfdbf=Array['isArray'](displayVariants)&&displayVariants['length']>0x0?displayVariants['filter'](Boolean):_0x332ec3,_0x4139ce=_0x3bfdbf['filter'](hasLiveTaskStatusDetail);if(_0x4139ce['length']>0x0)return _0x4139ce['sort']((_0x1bf0de,_0x399581)=>getTaskActivityTime(_0x399581)-getTaskActivityTime(_0x1bf0de))[0x0];if(_0x181349?.['status']==='queued'&&_0x181349['queuePosition'])return _0x181349;return _0x3bfdbf['find'](_0x6d4f56=>_0x6d4f56?.['status']==='queued'&&_0x6d4f56['queuePosition'])||_0x181349;}