const EVE_SCHEDULE_TASK_NAME_PREFIX=`eve.schedule.`;var ScheduleRegistrationError=class extends Error{scheduleId;sourceId;taskName;constructor(e,t={}){super(e),this.name=`ScheduleRegistrationError`,t.scheduleId!==void 0&&(this.scheduleId=t.scheduleId),t.sourceId!==void 0&&(this.sourceId=t.sourceId),t.taskName!==void 0&&(this.taskName=t.taskName)}};function createScheduleRegistrations(e){let t=e.map(e=>({cron:e.cron,description:`Run Eve schedule "${e.name}" from "${e.logicalPath}".`,logicalPath:e.logicalPath,scheduleId:e.name,sourceId:e.sourceId,taskName:createScheduleTaskName(e.sourceId)})).sort((e,t)=>e.sourceId.localeCompare(t.sourceId));return assertUniqueScheduleIds(t),t}function assertUniqueScheduleIds(e){let t=new Map;for(let n of e){let e=t.get(n.scheduleId);if(e===void 0){t.set(n.scheduleId,n);continue}throw new ScheduleRegistrationError(`Duplicate authored schedule id "${n.scheduleId}" found in "${e.logicalPath}" and "${n.logicalPath}".`,{scheduleId:n.scheduleId,sourceId:n.sourceId,taskName:n.taskName})}}function createScheduleTaskName(t){return`${EVE_SCHEDULE_TASK_NAME_PREFIX}${Buffer.from(t,`utf8`).toString(`base64url`)}`}export{EVE_SCHEDULE_TASK_NAME_PREFIX,ScheduleRegistrationError,createScheduleRegistrations};