import{Cd as L,Dd as O,Ed as u}from"./cli-0.5.4-3ne6665p.mjs";import{qh as G,rh as m}from"./cli-0.5.4-7c6wpbhq.mjs";import{B3 as E,M2 as U,Q2 as k,V2 as A}from"./cli-0.5.4-jqt00ywx.mjs";import{B6 as Z,Eaa as N,G$ as K,Haa as D,J6 as P,Naa as Q,T$ as C,X9 as J,Y9 as _,_aa as h,c_ as T,gba as R,mba as $,nba as y,vba as x}from"./cli-0.5.4-cbq01zg3.mjs";import{Fga as Y,Nga as f}from"./cli-0.5.4-sgcaw17t.mjs";import{Eja as I,ima as g}from"./cli-0.5.4-jmc3bzbn.mjs";import{Zma as b}from"./cli-0.5.4-aacw1src.mjs";function n(){V=!0}function c(){if(!V)return!1;return V=!1,!0}function a(j){return(z)=>({...z,...typeof j.permission_mode==="string"?{toolPermissionContext:{...z.toolPermissionContext,mode:_(j.permission_mode)}}:{},...typeof j.is_ultraplan_mode==="boolean"?{isUltraplanMode:j.is_ultraplan_mode}:{}})}function t({newState:j,oldState:z}){let W=c(),X=z.toolPermissionContext.mode,F=j.toolPermissionContext.mode;if(X!==F){let q=J(X),B=J(F);if(q!==B){let H=B==="plan"&&j.isUltraplanMode&&!z.isUltraplanMode?!0:null;L({permission_mode:B,is_ultraplan_mode:H})}O(F)}if(j.mainLoopModel!==z.mainLoopModel&&j.mainLoopModel===null){if(I(null),!W)if(R()!==void 0)Q((q)=>({...q,activeModelForProject:void 0}));else K("userSettings",{model:void 0}),y()}if(j.mainLoopModel!==z.mainLoopModel&&j.mainLoopModel!==null){if(I(j.mainLoopModel),!W)if(R()!==void 0)Q((q)=>({...q,activeModelForProject:j.mainLoopModel??void 0}));else K("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)N((H)=>({...H,showExpandedTodos:q,showSpinnerTree:B}))}if(j.verbose!==z.verbose&&D().verbose!==j.verbose){let q=j.verbose;N((B)=>({...B,verbose:q}))}if(j.settings!==z.settings)try{if(U(),k(),A(),j.settings.env!==z.settings.env)G()}catch(q){Z(Y(q))}}var V=!1;var M=b(()=>{g();E();h();f();P();m();x();T();u();C()});
export{n as td,a as ud,t as vd,M as wd};
