import{Cd as L,Dd as O,Ed as u}from"./cli-0.5.3-fq3092v1.mjs";import{qh as G,rh as m}from"./cli-0.5.3-nahm9pp1.mjs";import{K2 as U,O2 as k,T2 as A,z3 as E}from"./cli-0.5.3-1vt6twff.mjs";import{Caa as N,E$ as K,Faa as D,H6 as P,Laa as Q,R$ as C,V9 as J,W9 as _,Yaa as h,a_ as T,eba as R,kba as $,lba as y,tba as x,z6 as Z}from"./cli-0.5.3-t65dek0m.mjs";import{Dga as Y,Lga as f}from"./cli-0.5.3-c8bcrqa4.mjs";import{Cja as I,gma as g}from"./cli-0.5.3-qrvd6cmy.mjs";import{Xma as b}from"./cli-0.5.3-0df3r78b.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};
