import{n as e,s as t}from"./rolldown-runtime-Czos8NxU.js";import{Bs as n,El as r,Fs as i,Ft as a,Pt as o,Rt as s,Xs as c,gs as l,qc as u,vl as d,zt as f}from"./app-initial~app-main~worktree-init-v2-page~appgen-settings-page~page~appgen-publication-ter~fzo5ij6p-BKVLyD1q.js";import{Sd as p,xd as m}from"./app-initial~app-main~new-thread-panel-page-BZHGOlMi.js";var h,g,_=e((()=>{t(r()),h=d(),g=e=>(0,h.jsxs)(`svg`,{width:16,height:16,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,h.jsx)(`path`,{d:`M8.72559 3.86914C8.97392 3.86932 9.17474 4.07097 9.1748 4.31934C9.1748 4.56776 8.97396 4.76936 8.72559 4.76953H7.34277C7.09425 4.76953 6.89258 4.56786 6.89258 4.31934C6.89264 4.07086 7.09429 3.86914 7.34277 3.86914H8.72559Z`,fill:`currentColor`}),(0,h.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9.93359 1.5498C11.2129 1.54984 12.2498 2.58698 12.25 3.86621V12.1338C12.2498 13.413 11.2129 14.4502 9.93359 14.4502H6.06641C4.78731 14.4499 3.75025 13.4129 3.75 12.1338V3.86621C3.75025 2.58711 4.78731 1.55005 6.06641 1.5498H9.93359ZM6.06641 2.4502C5.28436 2.45044 4.65064 3.08417 4.65039 3.86621V12.1338C4.65064 12.9158 5.28436 13.5496 6.06641 13.5498H9.93359C10.7158 13.5498 11.3503 12.916 11.3506 12.1338V3.86621C11.3503 3.08404 10.7158 2.45023 9.93359 2.4502H6.06641Z`,fill:`currentColor`})]})}));function v(){return(0,D.useSyncExternalStore)(S,y)}function y(){return N}function b({event:e,statsigUser:t,status:n,reason:r}){let i=T(t),a=C({event:e,status:n,reason:r,...i===void 0?{}:{statsigUser:i}});return N=[...N,a].slice(-O),n===`enqueued`&&E(a),w(),a.id}function x({id:e,statsigUser:t,status:n,reason:r}){let i=N.find(t=>t.id===e)??M.get(e);if(i==null)return;let a=T(t),o={id:i.id,timestampMs:Date.now(),event:i.event,status:n,...r==null?{}:{reason:r},...a===void 0?{}:{statsigUser:a}};N=[...N.filter(t=>t.id!==e),o].slice(-O),n===`enqueued`?E(o):M.delete(e),w()}function S(e){return j.add(e),()=>{j.delete(e)}}function C(e){let t=`${A}:${String(P).padStart(10,`0`)}`;return P+=1,{id:t,timestampMs:Date.now(),...e}}function w(){j.forEach(e=>{e()})}function T(e){if(e!==void 0)try{return structuredClone(e)}catch{return}}function E(e){if(M.delete(e.id),M.set(e.id,e),M.size<=k)return;let t=M.keys().next().value;t!=null&&M.delete(t)}var D,O,k,A,j,M,N,P,F=e((()=>{D=t(r(),1),O=100,k=200,A=typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`product-event-debug-log`,j=new Set,M=new Map,N=[],P=0}));async function I(e,t){let n=L++,r=performance.now(),i=e=>{a.info(`[statsig-refresh-diagnostics] values updated`,{safe:{hasValues:e.values!=null,refreshId:n,status:e.status,trigger:t}})};a.info(`[statsig-refresh-diagnostics] refresh started`,{safe:{loadingStatus:e.loadingStatus,refreshId:n,trigger:t}}),e.on(`values_updated`,i);try{let i=e.getContext().user;await e.dataAdapter.prefetchData(i);let o=e.updateUserSync(i,{disableBackgroundCacheRefresh:!0});a.info(`[statsig-refresh-diagnostics] refresh finished`,{safe:{durationMs:Math.round(performance.now()-r),loadingStatus:e.loadingStatus,refreshId:n,success:o.success,trigger:t},sensitive:{error:o.error}})}catch(i){a.error(`[statsig-refresh-diagnostics] refresh failed`,{safe:{durationMs:Math.round(performance.now()-r),loadingStatus:e.loadingStatus,refreshId:n,trigger:t},sensitive:{error:i}})}finally{e.off(`values_updated`,i)}}var L,R=e((()=>{o(),L=1}));function z({hostId:e,id:t,method:n,params:r,receivedAtMs:i}){let a=m(r),o=H(n);return{hostId:e,id:t,isNoisy:o,method:n,paramsPreview:a,receivedAtMs:i,severity:V(n,o),threadId:B(r)}}function B(e){let t=U.safeParse(e);return t.success?t.data.threadId??null:null}function V(e,t){return e===`error`||e.includes(`/error`)||e.includes(`failed`)?`error`:t?`noisy`:`default`}function H(e){return e.includes(`/delta`)||e.includes(`Delta`)||e.endsWith(`/output`)}var U,W=e((()=>{l(),p(),U=i({threadId:n().optional()})}));function G(e,{hostId:t,method:n,params:r}){if(!e.get(J))return;let i=Date.now(),a=e.get(X),o=z({hostId:t,id:`${i}:${a}`,method:n,params:r,receivedAtMs:i});e.set(X,a+1),e.set(Y,e=>[o,...e].slice(0,q))}function K(e,t){e.set(Y,e=>e.filter(e=>e.hostId!==t))}var q,J,Y,X,Z=e((()=>{c(),W(),f(),q=300,J=u(s,!1),Y=u(s,()=>[],{onMount:(e,t)=>(t.set(J,!0),()=>{t.set(J,!1)})}),X=u(s,0)}));export{R as a,b as c,g as d,_ as f,G as i,x as l,K as n,I as o,Z as r,F as s,Y as t,v as u};
//# sourceMappingURL=app-initial~app-main~codex-mobile-page~debug-window-page~remote-connections-settings~debug-modal-uwMmKuo2.js.map