const u=["prefect.block-document","prefect.deployment","prefect.flow-run","prefect.flow","prefect.task-run","prefect.work-queue","prefect.work-pool","prefect.tag","prefect.concurrency-limit","prefect.artifact-collection","prefect.automation"];function n(e){const t=new RegExp(`^(${u.join("|")})\\.`,"g").exec(e);if(!t)return null;const o=t[1]?.split(".").at(-1);return o&&i(o)?o:null}function i(e){return["block-document","deployment","flow-run","flow","task-run","work-queue","work-pool","tag","concurrency-limit","artifact-collection","automation"].includes(e)}function c(e,r){if(e)return e.find(t=>t["prefect.resource.role"]===r)}function p(e){switch(n(e.event)){case"flow-run":return f(e);case"work-queue":return l(e);default:return s(e)}}function f(e){const r=c(e.related,"flow");return{trigger:{type:"event",match:{"prefect.resource.id":e.resource["prefect.resource.id"]},match_related:r?{"prefect.resource.role":"flow","prefect.resource.id":r["prefect.resource.id"]}:{},after:[],expect:[e.event],for_each:["prefect.resource.id"],posture:"Reactive",threshold:1,within:0},triggerTemplate:"custom"}}function l(e){const r=c(e.related,"work-queue");return{trigger:{type:"event",match:{"prefect.resource.id":e.resource["prefect.resource.id"]},match_related:r?{"prefect.resource.role":"work-queue","prefect.resource.id":r["prefect.resource.id"]}:{},after:[],expect:[e.event],for_each:["prefect.resource.id"],posture:"Reactive",threshold:1,within:0},triggerTemplate:"custom"}}function s(e){return{trigger:{type:"event",match:{"prefect.resource.id":e.resource["prefect.resource.id"]},match_related:{},after:[],expect:[e.event],for_each:[],posture:"Reactive",threshold:1,within:0},triggerTemplate:"custom"}}function g(e){return(typeof e=="string"?new Date(e):e).toISOString().split("T")[0]}export{g as f,p as t};
//# sourceMappingURL=event-to-trigger-BEzU9b5I.js.map
