"use strict";exports.id=4752,exports.ids=[4752],exports.modules={66617:(a,b,c)=>{c.d(b,{X:()=>d});function d(a,b){return a&&"string"==typeof a?a.replace(/{{\s*([^}]+?)\s*}}/g,(a,c)=>{let d=String(c).split("."),e=b;for(let a of d){if(null==e)return"";e=e[a]}return null==e?"":String(e)}):a}},84752:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{STAGE_KIND:()=>i,executeStage:()=>h});var e=c(8437),f=c(66617),g=a([e]);async function h({case:a,stage:b,execution:c}){let d=b.config||{},g=a.intake_payload||{},h=a.context||{};if(c?.approval_request_id){let d=(0,e.jT)(c.approval_request_id);return d?"approved"===d.status?((0,e.v)(d.id,{action_type:"process.stage.approve",matches:c=>c?.case_id===a.id&&c?.stage_slug===b.slug}),{kind:"pass",output:{approval_id:d.id,decided_by:d.approved_by||null,decided_at:d.decided_at,decision:"approved"}}):"denied"===d.status?{kind:"fail",error:"approval_denied",output:{approval_id:d.id,decision:"denied"}}:{kind:"pass",approval_required:{approval_request_id:d.id,summary:d.summary},output:{approval_id:d.id,decision:"pending"}}:{kind:"fail",error:"approval_record_missing"}}let i=(0,f.X)(d.summary_template,{intake:g,...h})||`Approve stage "${b.name}" for case ${a.title}`,j=(0,e.D6)({action_type:d.action_type||"process.stage.approve",risk:d.risk||"medium",summary:i,payload:{case_id:a.id,stage_slug:b.slug,definition_slug:a.definition_slug},project_id:a.project_id});return{kind:"pass",approval_required:{approval_request_id:j.id,summary:j.summary},output:{approval_id:j.id,decision:"pending"}}}e=(g.then?(await g)():g)[0];let i="human_approval";d()}catch(a){d(a)}})}};