import{Ar as nq,Br as _q,Cr as rq,Dr as yq,Er as Wq,FD as r,GD as Cq,KG as XJ,MG as pJ,Mt as oq,Nt as AJ,Tt as eq,Vt as tq,Wt as DJ,bm as j,cm as a,yr as kq,zr as pq}from"./cli-0.5.3-jbzr8k4s.mjs";import"./cli-0.5.3-me9jkw92.mjs";import"./cli-0.5.3-bqmztzjc.mjs";import"./cli-0.5.3-ytqxzjff.mjs";import"./cli-0.5.3-h6n812td.mjs";import"./cli-0.5.3-hg8c6qbh.mjs";import"./cli-0.5.3-39jr2yrx.mjs";import"./cli-0.5.3-42e2paz8.mjs";import"./cli-0.5.3-mn45xfck.mjs";import"./cli-0.5.3-m884a3pk.mjs";import"./cli-0.5.3-4f9xxrem.mjs";import"./cli-0.5.3-gr8nsa2k.mjs";import"./cli-0.5.3-yj9nbd9d.mjs";import"./cli-0.5.3-55kd38ff.mjs";import"./cli-0.5.3-e6bjcfwg.mjs";import"./cli-0.5.3-4dbxtwh3.mjs";import"./cli-0.5.3-m0kfmb79.mjs";import"./cli-0.5.3-8zq9vdtg.mjs";import"./cli-0.5.3-vmx7agj7.mjs";import"./cli-0.5.3-h8xs2818.mjs";import"./cli-0.5.3-wcx7cnw5.mjs";import"./cli-0.5.3-9zbakvbf.mjs";import{LU as $,NU as FJ}from"./cli-0.5.3-hx550gz2.mjs";import{IW as _,KW as Z,OW as uq,nX as n,pV as c}from"./cli-0.5.3-842pf3t4.mjs";import"./cli-0.5.3-wxead1ct.mjs";import"./cli-0.5.3-s1hz35ye.mjs";import"./cli-0.5.3-g0svn6bx.mjs";import"./cli-0.5.3-sfdh3pkx.mjs";import"./cli-0.5.3-d8tjnxcj.mjs";import"./cli-0.5.3-6zfw1732.mjs";import"./cli-0.5.3-ptjdgcsy.mjs";import"./cli-0.5.3-tp3jye12.mjs";import{NY as X,OY as N,PY as g}from"./cli-0.5.3-vqmxwet2.mjs";import{QY as fJ}from"./cli-0.5.3-rch86nhn.mjs";import"./cli-0.5.3-zg2apr51.mjs";import"./cli-0.5.3-ngnshpb7.mjs";import"./cli-0.5.3-e58xste9.mjs";import"./cli-0.5.3-6163zevg.mjs";import"./cli-0.5.3-jmkkd5ph.mjs";import"./cli-0.5.3-1vt6twff.mjs";import"./cli-0.5.3-7017ez65.mjs";import"./cli-0.5.3-ea94acj4.mjs";import"./cli-0.5.3-3k22nqvy.mjs";import"./cli-0.5.3-63q4g3zt.mjs";import"./cli-0.5.3-dyhbm5kp.mjs";import"./cli-0.5.3-vpcrbd8n.mjs";import"./cli-0.5.3-jdw3ajfv.mjs";import"./cli-0.5.3-qg4a557t.mjs";import{C$ as s,I$ as Gq,I6 as bq,J6 as zJ,R$ as PJ,X_ as v,d$ as Tq}from"./cli-0.5.3-t65dek0m.mjs";import"./cli-0.5.3-kavpx97n.mjs";import"./cli-0.5.3-9bdwhdys.mjs";import"./cli-0.5.3-ttc72eq3.mjs";import"./cli-0.5.3-g75gdzrp.mjs";import"./cli-0.5.3-1rg2r7n7.mjs";import"./cli-0.5.3-6j2jk6dt.mjs";import"./cli-0.5.3-66650sba.mjs";import{Lea as QJ,Nea as HJ}from"./cli-0.5.3-9vh3vpap.mjs";import"./cli-0.5.3-n3cxyxpg.mjs";import"./cli-0.5.3-kbvzmaax.mjs";import"./cli-0.5.3-7wdgps7z.mjs";import"./cli-0.5.3-c8bcrqa4.mjs";import{gma as IJ,qla as Hq}from"./cli-0.5.3-qrvd6cmy.mjs";import{Fma as Bq,Gma as ZJ}from"./cli-0.5.3-2dk1sk8w.mjs";import{Tma as h,Xma as x}from"./cli-0.5.3-0df3r78b.mjs";function gq(O,q){let Q={PreToolUse:{},PostToolUse:{},PostToolUseFailure:{},PermissionDenied:{},Notification:{},UserPromptSubmit:{},SessionStart:{},SessionEnd:{},Stop:{},StopFailure:{},SubagentStart:{},SubagentStop:{},PreCompact:{},PostCompact:{},PermissionRequest:{},Setup:{},TeammateIdle:{},TaskCreated:{},TaskCompleted:{},Elicitation:{},ElicitationResult:{},ConfigChange:{},WorktreeCreate:{},WorktreeRemove:{},InstructionsLoaded:{},CwdChanged:{},FileChanged:{}},T=wq(q);pq(O).forEach((J)=>{let I=Q[J.event];if(I){let Y=T[J.event].matcherMetadata!==void 0?J.matcher||"":"";if(!I[Y])I[Y]=[];I[Y].push(J)}});let U=Hq();if(U)for(let[J,I]of Object.entries(U)){let Y=J,G=Q[Y];if(!G)continue;for(let D of I){let K=D.matcher||"";if("pluginRoot"in D){G[K]??=[];for(let V of D.hooks)G[K].push({event:Y,config:V,matcher:D.matcher,source:"pluginHook",pluginName:D.pluginId})}}}return Q}function jq(O,q){let Q=Object.keys(O[q]||{});return yq(Q,O,q)}function Mq(O,q,Q){let T=Q??"";return O[q]?.[T]??[]}function l(O,q){return wq(q)[O].matcherMetadata}var wq;var Eq=x(()=>{ZJ();IJ();Wq();wq=Bq(function(O){return{PreToolUse:{summary:"Before tool execution",description:`Input to command is JSON of tool call arguments.
Exit code 0 - stdout/stderr not shown
Exit code 2 - show stderr to model and block tool call
Other exit codes - show stderr to user only but continue with tool call`,matcherMetadata:{fieldToMatch:"tool_name",values:O}},PostToolUse:{summary:"After tool execution",description:`Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).
Exit code 0 - stdout shown in transcript mode (ctrl+o)
Exit code 2 - show stderr to model immediately
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"tool_name",values:O}},PostToolUseFailure:{summary:"After tool execution fails",description:`Input to command is JSON with tool_name, tool_input, tool_use_id, error, error_type, is_interrupt, and is_timeout.
Exit code 0 - stdout shown in transcript mode (ctrl+o)
Exit code 2 - show stderr to model immediately
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"tool_name",values:O}},PermissionDenied:{summary:"After auto mode classifier denies a tool call",description:`Input to command is JSON with tool_name, tool_input, tool_use_id, and reason.
Return {"hookSpecificOutput":{"hookEventName":"PermissionDenied","retry":true}} to tell the model it may retry.
Exit code 0 - stdout shown in transcript mode (ctrl+o)
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"tool_name",values:O}},Notification:{summary:"When notifications are sent",description:`Input to command is JSON with notification message and type.
Exit code 0 - stdout/stderr not shown
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"notification_type",values:["permission_prompt","idle_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]}},UserPromptSubmit:{summary:"When the user submits a prompt",description:`Input to command is JSON with original user prompt text.
Exit code 0 - stdout shown to Claude
Exit code 2 - block processing, erase original prompt, and show stderr to user only
Other exit codes - show stderr to user only`},SessionStart:{summary:"When a new session is started",description:`Input to command is JSON with session start source.
Exit code 0 - stdout shown to Claude
Blocking errors are ignored
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"source",values:["startup","resume","clear","compact"]}},Stop:{summary:"Right before Claude concludes its response",description:`Exit code 0 - stdout/stderr not shown
Exit code 2 - show stderr to model and continue conversation
Other exit codes - show stderr to user only`},StopFailure:{summary:"When the turn ends due to an API error",description:"Fires instead of Stop when an API error (rate limit, auth failure, etc.) ended the turn. Fire-and-forget — hook output and exit codes are ignored.",matcherMetadata:{fieldToMatch:"error",values:["rate_limit","authentication_failed","billing_error","invalid_request","server_error","max_output_tokens","unknown"]}},SubagentStart:{summary:"When a subagent (Agent tool call) is started",description:`Input to command is JSON with agent_id and agent_type.
Exit code 0 - stdout shown to subagent
Blocking errors are ignored
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"agent_type",values:[]}},SubagentStop:{summary:"Right before a subagent (Agent tool call) concludes its response",description:`Input to command is JSON with agent_id, agent_type, and agent_transcript_path.
Exit code 0 - stdout/stderr not shown
Exit code 2 - show stderr to subagent and continue having it run
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"agent_type",values:[]}},PreCompact:{summary:"Before conversation compaction",description:`Input to command is JSON with compaction details.
Exit code 0 - stdout appended as custom compact instructions
Exit code 2 - block compaction
Other exit codes - show stderr to user only but continue with compaction`,matcherMetadata:{fieldToMatch:"trigger",values:["manual","auto"]}},PostCompact:{summary:"After conversation compaction",description:`Input to command is JSON with compaction details and the summary.
Exit code 0 - stdout shown to user
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"trigger",values:["manual","auto"]}},SessionEnd:{summary:"When a session is ending",description:`Input to command is JSON with session end reason.
Exit code 0 - command completes successfully
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"reason",values:["clear","logout","prompt_input_exit","other"]}},PermissionRequest:{summary:"When a permission dialog is displayed",description:`Input to command is JSON with tool_name, tool_input, and tool_use_id.
Output JSON with hookSpecificOutput containing decision to allow or deny.
Exit code 0 - use hook decision if provided
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"tool_name",values:O}},Setup:{summary:"Repo setup hooks for init and maintenance",description:`Input to command is JSON with trigger (init or maintenance).
Exit code 0 - stdout shown to Claude
Blocking errors are ignored
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"trigger",values:["init","maintenance"]}},TeammateIdle:{summary:"When a teammate is about to go idle",description:`Input to command is JSON with teammate_name and team_name.
Exit code 0 - stdout/stderr not shown
Exit code 2 - show stderr to teammate and prevent idle (teammate continues working)
Other exit codes - show stderr to user only`},TaskCreated:{summary:"When a task is being created",description:`Input to command is JSON with task_id, task_subject, task_description, teammate_name, and team_name.
Exit code 0 - stdout/stderr not shown
Exit code 2 - show stderr to model and prevent task creation
Other exit codes - show stderr to user only`},TaskCompleted:{summary:"When a task is being marked as completed",description:`Input to command is JSON with task_id, task_subject, task_description, teammate_name, and team_name.
Exit code 0 - stdout/stderr not shown
Exit code 2 - show stderr to model and prevent task completion
Other exit codes - show stderr to user only`},Elicitation:{summary:"When an MCP server requests user input (elicitation)",description:`Input to command is JSON with mcp_server_name, message, and requested_schema.
Output JSON with hookSpecificOutput containing action (accept/decline/cancel) and optional content.
Exit code 0 - use hook response if provided
Exit code 2 - deny the elicitation
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"mcp_server_name",values:[]}},ElicitationResult:{summary:"After a user responds to an MCP elicitation",description:`Input to command is JSON with mcp_server_name, action, content, mode, and elicitation_id.
Output JSON with hookSpecificOutput containing optional action and content to override the response.
Exit code 0 - use hook response if provided
Exit code 2 - block the response (action becomes decline)
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"mcp_server_name",values:[]}},ConfigChange:{summary:"When configuration files change during a session",description:`Input to command is JSON with source (user_settings, project_settings, local_settings, policy_settings, skills) and file_path.
Exit code 0 - allow the change
Exit code 2 - block the change from being applied to the session
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:"source",values:["user_settings","project_settings","local_settings","policy_settings","skills"]}},InstructionsLoaded:{summary:"When an instruction file (CLAUDE.md or rule) is loaded",description:`Input to command is JSON with file_path, memory_type (User, Project, Local, Managed), load_reason (session_start, nested_traversal, path_glob_match, include, compact), globs (optional — the paths: frontmatter patterns that matched), trigger_file_path (optional — the file Claude touched that caused the load), and parent_file_path (optional — the file that @-included this one).
Exit code 0 - command completes successfully
Other exit codes - show stderr to user only
This hook is observability-only and does not support blocking.`,matcherMetadata:{fieldToMatch:"load_reason",values:["session_start","nested_traversal","path_glob_match","include","compact"]}},WorktreeCreate:{summary:"Create an isolated worktree for VCS-agnostic isolation",description:`Input to command is JSON with name (suggested worktree slug).
Stdout should contain the absolute path to the created worktree directory.
Exit code 0 - worktree created successfully
Other exit codes - worktree creation failed`},WorktreeRemove:{summary:"Remove a previously created worktree",description:`Input to command is JSON with worktree_path (absolute path to worktree).
Exit code 0 - worktree removed successfully
Other exit codes - show stderr to user only`},CwdChanged:{summary:"After the working directory changes",description:`Input to command is JSON with old_cwd and new_cwd.
CLAUDE_ENV_FILE is set — write bash exports there to apply env to subsequent BashTool commands.
Hook output can include hookSpecificOutput.watchPaths (array of absolute paths) to register with the FileChanged watcher.
Exit code 0 - command completes successfully
Other exit codes - show stderr to user only`},FileChanged:{summary:"When a watched file changes",description:`Input to command is JSON with file_path and event (change, add, unlink).
CLAUDE_ENV_FILE is set — write bash exports there to apply env to subsequent BashTool commands.
The matcher field specifies filenames to watch in the current directory (e.g. ".envrc|.env").
Hook output can include hookSpecificOutput.watchPaths (array of absolute paths) to dynamically update the watch list.
Exit code 0 - command completes successfully
Other exit codes - show stderr to user only`}}},(O)=>O.slice().sort().join(","))});function vq(O){let q=xq.c(23),{hookEventMetadata:Q,hooksByEvent:T,totalHooksCount:U,restrictedByPolicy:J,onSelectEvent:I,onCancel:Y}=O,G;if(q[0]!==U)G=v(U,"hook"),q[0]=U,q[1]=G;else G=q[1];let D=`${U} ${G} configured`,K;if(q[2]!==J)K=J&&N(_,{flexDirection:"column",children:[N(Z,{color:"suggestion",children:[bq.info," Hooks Restricted by Policy"]}),X(Z,{dimColor:!0,children:"Only hooks from managed settings can run. User-defined hooks from ~/.claudio/settings.json, .claudio/settings.json, and .claudio/settings.local.json are blocked."})]}),q[2]=J,q[3]=K;else K=q[3];let V;if(q[4]===Symbol.for("react.memo_cache_sentinel"))V=X(_,{flexDirection:"column",children:N(Z,{dimColor:!0,children:[bq.info," This menu is read-only. To add or modify hooks, edit settings.json directly or ask Claude."," ",X(uq,{url:"https://code.claude.com/docs/en/hooks",children:"Learn more"})]})}),q[4]=V;else V=q[4];let W;if(q[5]!==I)W=(f)=>{I(f)},q[5]=I,q[6]=W;else W=q[6];let w;if(q[7]!==Q)w=Object.entries(Q),q[7]=Q,q[8]=w;else w=q[8];let P;if(q[9]!==T||q[10]!==w)P=w.map((f)=>{let[p,B]=f,E=T[p]||0;return{label:E>0?N(Z,{children:[p," ",N(Z,{color:"suggestion",children:["(",E,")"]})]}):p,value:p,description:B.summary}}),q[9]=T,q[10]=w,q[11]=P;else P=q[11];let z;if(q[12]!==Y||q[13]!==W||q[14]!==P)z=X(_,{flexDirection:"column",children:X(r,{onChange:W,onCancel:Y,options:P})}),q[12]=Y,q[13]=W,q[14]=P,q[15]=z;else z=q[15];let F;if(q[16]!==K||q[17]!==z)F=N(_,{flexDirection:"column",gap:1,children:[K,V,z]}),q[16]=K,q[17]=z,q[18]=F;else F=q[18];let C;if(q[19]!==Y||q[20]!==D||q[21]!==F)C=X(j,{title:"Hooks",subtitle:D,onCancel:Y,children:F}),q[19]=Y,q[20]=D,q[21]=F,q[22]=C;else C=q[22];return C}var xq;var Sq=x(()=>{zJ();n();Tq();Cq();a();g();xq=h(c(),1)});function iq(O){let q=mq.c(19),{selectedEvent:Q,selectedMatcher:T,hooksForSelectedMatcher:U,hookEventMetadata:J,onSelect:I,onCancel:Y}=O,G=J.matcherMetadata!==void 0?`${Q} - Matcher: ${T||"(all)"}`:Q;if(U.length===0){let P;if(q[0]===Symbol.for("react.memo_cache_sentinel"))P=N(_,{flexDirection:"column",gap:1,children:[X(Z,{dimColor:!0,children:"No hooks configured for this event."}),X(Z,{dimColor:!0,children:"To add hooks, edit settings.json directly or ask Claude."})]}),q[0]=P;else P=q[0];let z;if(q[1]!==J.description||q[2]!==Y||q[3]!==G)z=X(j,{title:G,subtitle:J.description,onCancel:Y,inputGuide:UJ,children:P}),q[1]=J.description,q[2]=Y,q[3]=G,q[4]=z;else z=q[4];return z}let D=J.description,K;if(q[5]!==U)K=U.map(LJ),q[5]=U,q[6]=K;else K=q[6];let V;if(q[7]!==U||q[8]!==I)V=(P)=>{let z=parseInt(P,10),F=U[z];if(F)I(F)},q[7]=U,q[8]=I,q[9]=V;else V=q[9];let W;if(q[10]!==Y||q[11]!==K||q[12]!==V)W=X(_,{flexDirection:"column",children:X(r,{options:K,onChange:V,onCancel:Y})}),q[10]=Y,q[11]=K,q[12]=V,q[13]=W;else W=q[13];let w;if(q[14]!==J.description||q[15]!==Y||q[16]!==W||q[17]!==G)w=X(j,{title:G,subtitle:D,onCancel:Y,children:W}),q[14]=J.description,q[15]=Y,q[16]=W,q[17]=G,q[18]=w;else w=q[18];return w}function LJ(O,q){return{label:`[${O.config.type}] ${kq(O.config)}`,value:q.toString(),description:O.source==="pluginHook"&&O.pluginName?`${_q(O.source)} (${O.pluginName})`:_q(O.source)}}function UJ(){return X(Z,{children:"Esc to go back"})}var mq;var hq=x(()=>{n();Wq();Cq();a();g();mq=h(c(),1)});function lq(O){let q=dq.c(25),{selectedEvent:Q,matchersForSelectedEvent:T,hooksByEventAndMatcher:U,eventDescription:J,onSelect:I,onCancel:Y}=O,G;if(q[0]!==U||q[1]!==T||q[2]!==Q){let z;if(q[4]!==U||q[5]!==Q)z=(F)=>{let C=U[Q]?.[F]||[],f=Array.from(new Set(C.map(wJ)));return{matcher:F,sources:f,hookCount:C.length}},q[4]=U,q[5]=Q,q[6]=z;else z=q[6];G=T.map(z),q[0]=U,q[1]=T,q[2]=Q,q[3]=G}else G=q[3];let D=G;if(T.length===0){let z=`${Q} - Matchers`,F;if(q[7]===Symbol.for("react.memo_cache_sentinel"))F=N(_,{flexDirection:"column",gap:1,children:[X(Z,{dimColor:!0,children:"No hooks configured for this event."}),X(Z,{dimColor:!0,children:"To add hooks, edit settings.json directly or ask Claude."})]}),q[7]=F;else F=q[7];let C;if(q[8]!==J||q[9]!==Y||q[10]!==z)C=X(j,{title:z,subtitle:J,onCancel:Y,inputGuide:WJ,children:F}),q[8]=J,q[9]=Y,q[10]=z,q[11]=C;else C=q[11];return C}let K=`${Q} - Matchers`,V;if(q[12]!==D)V=D.map(VJ),q[12]=D,q[13]=V;else V=q[13];let W;if(q[14]!==I)W=(z)=>{I(z)},q[14]=I,q[15]=W;else W=q[15];let w;if(q[16]!==Y||q[17]!==V||q[18]!==W)w=X(_,{flexDirection:"column",children:X(r,{options:V,onChange:W,onCancel:Y})}),q[16]=Y,q[17]=V,q[18]=W,q[19]=w;else w=q[19];let P;if(q[20]!==J||q[21]!==Y||q[22]!==K||q[23]!==w)P=X(j,{title:K,subtitle:J,onCancel:Y,children:w}),q[20]=J,q[21]=Y,q[22]=K,q[23]=w,q[24]=P;else P=q[24];return P}function VJ(O){let q=O.sources.map(rq).join(", "),Q=O.matcher||"(all)";return{label:`[${q}] ${Q}`,value:O.matcher,description:`${O.hookCount} ${v(O.hookCount,"hook")}`}}function WJ(){return X(Z,{children:"Esc to go back"})}function wJ(O){return O.source}var dq;var cq=x(()=>{n();Wq();Tq();Cq();a();g();dq=h(c(),1)});function $q(O){let q=aq.c(40),{selectedHook:Q,eventSupportsMatcher:T,onCancel:U}=O,J;if(q[0]!==Q.event)J=N(Z,{children:["Event: ",X(Z,{bold:!0,children:Q.event})]}),q[0]=Q.event,q[1]=J;else J=q[1];let I;if(q[2]!==T||q[3]!==Q.matcher)I=T&&N(Z,{children:["Matcher: ",X(Z,{bold:!0,children:Q.matcher||"(all)"})]}),q[2]=T,q[3]=Q.matcher,q[4]=I;else I=q[4];let Y;if(q[5]!==Q.config.type)Y=N(Z,{children:["Type: ",X(Z,{bold:!0,children:Q.config.type})]}),q[5]=Q.config.type,q[6]=Y;else Y=q[6];let G;if(q[7]!==Q.source)G=nq(Q.source),q[7]=Q.source,q[8]=G;else G=q[8];let D;if(q[9]!==G)D=N(Z,{children:["Source:"," ",X(Z,{dimColor:!0,children:G})]}),q[9]=G,q[10]=D;else D=q[10];let K;if(q[11]!==Q.pluginName)K=Q.pluginName&&N(Z,{children:["Plugin: ",X(Z,{dimColor:!0,children:Q.pluginName})]}),q[11]=Q.pluginName,q[12]=K;else K=q[12];let V;if(q[13]!==J||q[14]!==I||q[15]!==Y||q[16]!==D||q[17]!==K)V=N(_,{flexDirection:"column",children:[J,I,Y,D,K]}),q[13]=J,q[14]=I,q[15]=Y,q[16]=D,q[17]=K,q[18]=V;else V=q[18];let W;if(q[19]!==Q.config)W=GJ(Q.config),q[19]=Q.config,q[20]=W;else W=q[20];let w;if(q[21]!==W)w=N(Z,{dimColor:!0,children:[W,":"]}),q[21]=W,q[22]=w;else w=q[22];let P;if(q[23]!==Q.config)P=KJ(Q.config),q[23]=Q.config,q[24]=P;else P=q[24];let z;if(q[25]!==P)z=X(_,{borderStyle:"round",borderDimColor:!0,paddingLeft:1,paddingRight:1,children:X(Z,{children:P})}),q[25]=P,q[26]=z;else z=q[26];let F;if(q[27]!==z||q[28]!==w)F=N(_,{flexDirection:"column",children:[w,z]}),q[27]=z,q[28]=w,q[29]=F;else F=q[29];let C;if(q[30]!==Q.config)C="statusMessage"in Q.config&&Q.config.statusMessage&&N(Z,{children:["Status message:"," ",X(Z,{dimColor:!0,children:Q.config.statusMessage})]}),q[30]=Q.config,q[31]=C;else C=q[31];let f;if(q[32]===Symbol.for("react.memo_cache_sentinel"))f=X(Z,{dimColor:!0,children:"To modify or remove this hook, edit settings.json directly or ask Claude to help."}),q[32]=f;else f=q[32];let p;if(q[33]!==F||q[34]!==C||q[35]!==V)p=N(_,{flexDirection:"column",gap:1,children:[V,F,C,f]}),q[33]=F,q[34]=C,q[35]=V,q[36]=p;else p=q[36];let B;if(q[37]!==U||q[38]!==p)B=X(j,{title:"Hook details",onCancel:U,inputGuide:RJ,children:p}),q[37]=U,q[38]=p,q[39]=B;else B=q[39];return B}function RJ(){return X(Z,{children:"Esc to go back"})}function GJ(O){switch(O.type){case"command":return"Command";case"prompt":return"Prompt";case"agent":return"Prompt";case"http":return"URL"}}function KJ(O){switch(O.type){case"command":return O.command;case"prompt":return O.prompt;case"agent":return O.prompt;case"http":return O.url}}var aq;var sq=x(()=>{n();Wq();a();g();aq=h(c(),1)});function JJ(O){let q=qJ.c(100),{toolNames:Q,onExit:T}=O,U;if(q[0]===Symbol.for("react.memo_cache_sentinel"))U={mode:"select-event"},q[0]=U;else U=q[0];let[J,I]=Rq.useState(U),[Y,G]=Rq.useState(BJ),[D,K]=Rq.useState(_J),V;if(q[1]===Symbol.for("react.memo_cache_sentinel"))V=(A)=>{if(A==="policySettings"){let R=Gq()?.disableAllHooks===!0;G(R&&s("policySettings")?.disableAllHooks===!0),K(s("policySettings")?.allowManagedHooksOnly===!0)}},q[1]=V;else V=q[1];oq(V);let W=J.mode,w="event"in J?J.event:"PreToolUse",P="matcher"in J?J.matcher:null,z=eq(CJ),F=tq(),C;if(q[2]!==z.tools||q[3]!==Q)C=[...Q,...z.tools.map(TJ)],q[2]=z.tools,q[3]=Q,q[4]=C;else C=q[4];let f=C,p;if(q[5]!==F||q[6]!==f)p=gq(F.getState(),f),q[5]=F,q[6]=f,q[7]=p;else p=q[7];let B=p,E;if(q[8]!==B||q[9]!==w)E=jq(B,w),q[8]=B,q[9]=w,q[10]=E;else E=q[10];let Kq=E,o;if(q[11]!==B||q[12]!==w||q[13]!==P)o=Mq(B,w,P),q[11]=B,q[12]=w,q[13]=P,q[14]=o;else o=q[14];let Pq=o,e;if(q[15]!==T)e=()=>{T("Hooks dialog dismissed",{display:"system"})},q[15]=T,q[16]=e;else e=q[16];let u=e,fq=W==="select-event",t;if(q[17]!==fq)t={context:"Confirmation",isActive:fq},q[17]=fq,q[18]=t;else t=q[18];$("confirm:no",u,t);let qq;if(q[19]===Symbol.for("react.memo_cache_sentinel"))qq=()=>{I({mode:"select-event"})},q[19]=qq;else qq=q[19];let Fq=W==="select-matcher",Jq;if(q[20]!==Fq)Jq={context:"Confirmation",isActive:Fq},q[20]=Fq,q[21]=Jq;else Jq=q[21];$("confirm:no",qq,Jq);let Oq;if(q[22]!==f||q[23]!==J)Oq=()=>{if("event"in J)if(l(J.event,f)!==void 0)I({mode:"select-matcher",event:J.event});else I({mode:"select-event"})},q[22]=f,q[23]=J,q[24]=Oq;else Oq=q[24];let Aq=W==="select-hook",Qq;if(q[25]!==Aq)Qq={context:"Confirmation",isActive:Aq},q[25]=Aq,q[26]=Qq;else Qq=q[26];$("confirm:no",Oq,Qq);let Xq;if(q[27]!==J)Xq=()=>{if(J.mode==="view-hook"){let{event:A,hook:L}=J;I({mode:"select-hook",event:A,matcher:L.matcher||""})}},q[27]=J,q[28]=Xq;else Xq=q[28];let Dq=W==="view-hook",Yq;if(q[29]!==Dq)Yq={context:"Confirmation",isActive:Dq},q[29]=Dq,q[30]=Yq;else Yq=q[30];$("confirm:no",Xq,Yq);let Zq;if(q[31]!==f)Zq=wq(f),q[31]=f,q[32]=Zq;else Zq=q[32];let d=Zq,YJ=Gq()?.disableAllHooks===!0,Iq;if(q[33]!==B){let A={},L=0;for(let[R,b]of Object.entries(B)){let H=Object.values(b).reduce(bJ,0);A[R]=H,L=L+H}Iq={hooksByEvent:A,totalHooksCount:L},q[33]=B,q[34]=Iq}else Iq=q[34];let{hooksByEvent:Nq,totalHooksCount:y}=Iq;if(YJ){let A;if(q[35]===Symbol.for("react.memo_cache_sentinel"))A=X(Z,{bold:!0,children:"disabled"}),q[35]=A;else A=q[35];let L=Y&&" by a managed settings file",R;if(q[36]!==y)R=X(Z,{bold:!0,children:y}),q[36]=y,q[37]=R;else R=q[37];let b;if(q[38]!==y)b=v(y,"hook"),q[38]=y,q[39]=b;else b=q[39];let H;if(q[40]!==y)H=v(y,"is","are"),q[40]=y,q[41]=H;else H=q[41];let M;if(q[42]!==L||q[43]!==R||q[44]!==b||q[45]!==H)M=N(Z,{children:["All hooks are currently ",A,L,". You have"," ",R," configured"," ",b," that"," ",H," not running."]}),q[42]=L,q[43]=R,q[44]=b,q[45]=H,q[46]=M;else M=q[46];let S,zq,Lq,Uq;if(q[47]===Symbol.for("react.memo_cache_sentinel"))S=X(_,{marginTop:1,children:X(Z,{dimColor:!0,children:"When hooks are disabled:"})}),zq=X(Z,{dimColor:!0,children:"· No hook commands will execute"}),Lq=X(Z,{dimColor:!0,children:"· StatusLine will not be displayed"}),Uq=X(Z,{dimColor:!0,children:"· Tool operations will proceed without hook validation"}),q[47]=S,q[48]=zq,q[49]=Lq,q[50]=Uq;else S=q[47],zq=q[48],Lq=q[49],Uq=q[50];let k;if(q[51]!==M)k=N(_,{flexDirection:"column",children:[M,S,zq,Lq,Uq]}),q[51]=M,q[52]=k;else k=q[52];let m;if(q[53]!==Y)m=!Y&&X(Z,{dimColor:!0,children:'To re-enable hooks, remove "disableAllHooks" from settings.json or ask Claude.'}),q[53]=Y,q[54]=m;else m=q[54];let i;if(q[55]!==k||q[56]!==m)i=N(_,{flexDirection:"column",gap:1,children:[k,m]}),q[55]=k,q[56]=m,q[57]=i;else i=q[57];let Vq;if(q[58]!==u||q[59]!==i)Vq=X(j,{title:"Hook Configuration - Disabled",onCancel:u,inputGuide:NJ,children:i}),q[58]=u,q[59]=i,q[60]=Vq;else Vq=q[60];return Vq}switch(J.mode){case"select-event":{let A;if(q[61]!==f)A=(R)=>{if(l(R,f)!==void 0)I({mode:"select-matcher",event:R});else I({mode:"select-hook",event:R,matcher:""})},q[61]=f,q[62]=A;else A=q[62];let L;if(q[63]!==u||q[64]!==d||q[65]!==Nq||q[66]!==D||q[67]!==A||q[68]!==y)L=X(vq,{hookEventMetadata:d,hooksByEvent:Nq,totalHooksCount:y,restrictedByPolicy:D,onSelectEvent:A,onCancel:u}),q[63]=u,q[64]=d,q[65]=Nq,q[66]=D,q[67]=A,q[68]=y,q[69]=L;else L=q[69];return L}case"select-matcher":{let A=d[J.event],L;if(q[70]!==J.event)L=(H)=>{I({mode:"select-hook",event:J.event,matcher:H})},q[70]=J.event,q[71]=L;else L=q[71];let R;if(q[72]===Symbol.for("react.memo_cache_sentinel"))R=()=>{I({mode:"select-event"})},q[72]=R;else R=q[72];let b;if(q[73]!==B||q[74]!==J.event||q[75]!==Kq||q[76]!==A.description||q[77]!==L)b=X(lq,{selectedEvent:J.event,matchersForSelectedEvent:Kq,hooksByEventAndMatcher:B,eventDescription:A.description,onSelect:L,onCancel:R}),q[73]=B,q[74]=J.event,q[75]=Kq,q[76]=A.description,q[77]=L,q[78]=b;else b=q[78];return b}case"select-hook":{let A=d[J.event],L;if(q[79]!==J.event)L=(H)=>{I({mode:"view-hook",event:J.event,hook:H})},q[79]=J.event,q[80]=L;else L=q[80];let R;if(q[81]!==f||q[82]!==J.event)R=()=>{if(l(J.event,f)!==void 0)I({mode:"select-matcher",event:J.event});else I({mode:"select-event"})},q[81]=f,q[82]=J.event,q[83]=R;else R=q[83];let b;if(q[84]!==Pq||q[85]!==J.event||q[86]!==J.matcher||q[87]!==A||q[88]!==L||q[89]!==R)b=X(iq,{selectedEvent:J.event,selectedMatcher:J.matcher,hooksForSelectedMatcher:Pq,hookEventMetadata:A,onSelect:L,onCancel:R}),q[84]=Pq,q[85]=J.event,q[86]=J.matcher,q[87]=A,q[88]=L,q[89]=R,q[90]=b;else b=q[90];return b}case"view-hook":{let A=J.hook,L;if(q[91]!==f||q[92]!==J.event)L=l(J.event,f),q[91]=f,q[92]=J.event,q[93]=L;else L=q[93];let R=L!==void 0,b;if(q[94]!==J)b=()=>{let{event:M,hook:S}=J;I({mode:"select-hook",event:M,matcher:S.matcher||""})},q[94]=J,q[95]=b;else b=q[95];let H;if(q[96]!==J.hook||q[97]!==R||q[98]!==b)H=X($q,{selectedHook:A,eventSupportsMatcher:R,onCancel:b}),q[96]=J.hook,q[97]=R,q[98]=b,q[99]=H;else H=q[99];return H}}}function NJ(){return X(Z,{children:"Esc to close"})}function bJ(O,q){return O+q.length}function TJ(O){return O.name}function CJ(O){return O.mcp}function _J(){return s("policySettings")?.allowManagedHooksOnly===!0}function BJ(){return Gq()?.disableAllHooks===!0&&s("policySettings")?.disableAllHooks===!0}var qJ,Rq;var OJ=x(()=>{DJ();AJ();n();FJ();Eq();PJ();Tq();a();Sq();hq();cq();sq();g();qJ=h(c(),1),Rq=h(fJ(),1)});var _O=async(O,q)=>{QJ("tengu_hooks_command",{});let T=q.getAppState().toolPermissionContext,U=XJ(T).map((J)=>J.name);return X(JJ,{toolNames:U,onExit:O})};var yJ=x(()=>{OJ();HJ();pJ();g()});yJ();export{_O as call};
