import{hd as L,id as m}from"./cli-0.5.12-k976aej3.mjs";import{od as O,pd as G,qd as u}from"./cli-0.5.12-dpm51wzp.mjs";import{d4 as E,o3 as U,s3 as k,x3 as A}from"./cli-0.5.12-pycnjaeg.mjs";import{Bba as x,Bca as y,J$ as N,Jaa as F,Jca as C,Maa as D,Taa as Q,W$ as g,Y9 as K,Z9 as Z,d_ as P,eba as h,mba as R,sba as _,tba as $}from"./cli-0.5.12-g4wb8mj2.mjs";import{Gga as f,yga as Y}from"./cli-0.5.12-tfdwzg37.mjs";import{Nja as J,rma as b}from"./cli-0.5.12-c8f4daey.mjs";import{aoa as T}from"./cli-0.5.12-xzeb7mtb.mjs";function n(){V=!0}function M(){if(!V)return!1;return V=!1,!0}function a(j){return(z)=>({...z,...typeof j.permission_mode==="string"?{toolPermissionContext:{...z.toolPermissionContext,mode:Z(j.permission_mode)}}:{},...typeof j.is_ultraplan_mode==="boolean"?{isUltraplanMode:j.is_ultraplan_mode}:{}})}function t({newState:j,oldState:z}){let W=M(),X=z.toolPermissionContext.mode,H=j.toolPermissionContext.mode;if(X!==H){let q=K(X),B=K(H);if(q!==B){let I=B==="plan"&&j.isUltraplanMode&&!z.isUltraplanMode?!0:null;O({permission_mode:B,is_ultraplan_mode:I})}G(H)}if(j.mainLoopModel!==z.mainLoopModel&&j.mainLoopModel===null){if(J(null),!W)if(R()!==void 0)Q((q)=>({...q,activeModelForProject:void 0}));else N("userSettings",{model:void 0}),$()}if(j.mainLoopModel!==z.mainLoopModel&&j.mainLoopModel!==null){if(J(j.mainLoopModel),!W)if(R()!==void 0)Q((q)=>({...q,activeModelForProject:j.mainLoopModel??void 0}));else N("userSettings",{model:j.mainLoopModel}),_(j.mainLoopModel)}if(j.expandedView!==z.expandedView){let q=j.expandedView==="tasks",B=j.expandedView==="teammates";if(D().showExpandedTodos!==q||D().showSpinnerTree!==B)F((I)=>({...I,showExpandedTodos:q,showSpinnerTree:B}))}if(j.verbose!==z.verbose&&D().verbose!==j.verbose){let q=j.verbose;F((B)=>({...B,verbose:q}))}if(j.collapseSubagentProgress!==z.collapseSubagentProgress&&D().collapseSubagentProgress!==j.collapseSubagentProgress){let q=j.collapseSubagentProgress;F((B)=>({...B,collapseSubagentProgress:q}))}if(j.settings!==z.settings)try{if(U(),k(),A(),j.settings.env!==z.settings.env)L()}catch(q){y(Y(q))}}var V=!1;var c=T(()=>{b();E();h();f();C();m();x();P();u();g()});
export{n as cd,a as dd,t as ed,c as fd};
