@zk-tech/rrt-app 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,7 +51,7 @@ Error generating stack: `+b.message+`
51
51
  ${M}`:`以下是 ${T.displayName} 组件的代码:
52
52
  ${y}
53
53
 
54
- 请根据代码分析可能异常原因`;console.log("analyze message generated: ",{code:y,causes:M}),m([{content:D,hidden:!0}],!0)},[p,_]),S=O.useMemo(()=>Object.values(a).sort((f,h)=>f.create_time-h.create_time),[a]);return C.jsx(FS.Provider,{value:{target:n,messages:S,chat:m,updateTarget:E},children:e})},gs=()=>O.useContext(FS);function Wc(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M18 6L6 18M6 6l12 12"})})}function Xx(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m7 8l-4 4l4 4m10-8l4 4l-4 4M14 4l-4 16"})})}function Zx(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 4v6l-2 4v2h10v-2l-2-4V4m-3 12v5M8 4h8"})})}const qo="h-4 w-4 text-xs text-zinc-600 dark:text-zinc-400",US=O.memo(({fiber:t})=>{const{select:e}=mi(),n=UE(),{pinnedId:i,pin:a}=Ac(),s=t.id===i,{sourceLoc:u,resolving:c,openFile:_}=xS(t),{updateTarget:p}=gs(),m=()=>{e(null),a(s?0:t.id),setTimeout(()=>e(t.id))},E=()=>{p(t.id),n(yt.ModelAnalyze)};return C.jsxs("div",{className:"flex h-6 w-full items-center justify-between p-1",children:[C.jsxs("div",{className:"flex items-center gap-1",children:[C.jsx(AE,{names:[Zl[t.type]]}),!t.mounted&&C.jsx("span",{className:`text-xxs ${pe("font-medium text-zinc-500")}`,children:"Unmounted"})]}),C.jsxs("span",{className:"flex gap-1",children:[C.jsx(Pt,{size:"icon",variant:"ghost",disabled:!u||c,className:qo,onClick:_,children:C.jsx(Xx,{})}),C.jsx(Pt,{size:"icon",variant:"ghost",disabled:!u||c,className:qo,onClick:E,children:C.jsx(YE,{})}),C.jsx(Pt,{size:"icon",variant:"ghost",className:qo,onClick:()=>n(yt.Components),children:C.jsx(Dc,{})}),C.jsx(Pt,{size:"icon",variant:"ghost",className:pe(qo,{"!text-brand":s}),onClick:m,children:s?C.jsx(vE,{}):C.jsx(Zx,{})}),C.jsx(Pt,{size:"icon",variant:"ghost",className:qo,onClick:()=>e(null),children:C.jsx(Wc,{})})]})]})});US.displayName="FiberHeaderTools";const BS=O.memo(({fiber:t,excludeHostType:e})=>{const{fiberById:n}=sn(),i=n.get(t==null?void 0:t.ownerId),a=n.get(t==null?void 0:t.parentId);if(!t||!a)return null;let s=null;a!==i&&!(e&&Cr(a.type))&&(s=C.jsxs(C.Fragment,{children:[" ","Child of ",C.jsx(Yo,{fiber:a},a.id),", "]}));let u=null;return a===i?u=C.jsxs(C.Fragment,{children:["Created by ",C.jsx(Yo,{fiber:a},a.id)]}):i?u=C.jsxs(C.Fragment,{children:["Created by ",C.jsx(Yo,{fiber:i},i.id)]}):u=C.jsx(C.Fragment,{children:"no owner (created outside of render)"}),C.jsxs("div",{className:"text-xxs leading-3 text-zinc-500 dark:text-zinc-400",children:[s,u]})});BS.displayName="FiberHeaderNotes";const Jx=({fiber:t,excludeHostType:e})=>C.jsxs(C.Fragment,{children:[C.jsx(US,{fiber:t}),C.jsxs("div",{className:"flex flex-col px-[6px] pb-1",children:[C.jsx("div",{className:pe("text-sm font-medium text-brand",{"font-normal text-[#8c629a]":Cr(t.type)}),children:C.jsx(is,{fiber:t})}),C.jsx(BS,{fiber:t,excludeHostType:e})]})]}),ew={mount:"Mount",update:"Update","update-bailout-state":"Update bailout (rendered but return is discarded and further update is prevented due to no changes in state)","update-bailout-memo":"React.memo() update bailout (render and further updates are prevented due to no changes in props)","update-bailout-scu":'shouldComponentUpdate() bailout (state and props are set, but render and further updates are prevented due "shouldComponentUpdate" method returned false)',unmount:"Unmount","effect-create":"Create effect","effect-destroy":"Destroy effect","commit-start":"Commit start","maybe-leaks":"Potential memory leaks list changed"},$o={"commit-start":{line:pe("text-[#ececee] dark:text-[#2c2c2e]")},mount:{line:pe("text-[#daf4e0] dark:text-[#18341f]"),fiber:pe("text-[#16a34a] bg-[#daf4e0] dark:bg-[#18341f]")},update:{line:pe("text-[#fbf0d5] dark:text-[#3b3014]"),fiber:pe("text-[#ca8a04] bg-[#fbf0d5] dark:bg-[#3b3014]")},"update-bailout-state":{line:pe("text-[#d9e8f3] dark:text-[#152e3a]"),fiber:pe("text-[#7090a7] bg-[#d9e8f3] dark:bg-[#152e3a]")},"update-bailout-memo":{line:pe("text-[#d9e8f3] dark:text-[#152e3a]"),fiber:pe("text-[#7090a7] bg-[#d9e8f3] dark:bg-[#152e3a]")},"update-bailout-scu":{line:pe("text-[#d9e8f3] dark:text-[#152e3a]"),fiber:pe("text-[#7090a7] bg-[#d9e8f3] dark:bg-[#152e3a]")},unmount:{line:pe("text-[#ececee] dark:text-[#2c2c2e]"),fiber:pe("text-[#71717a] bg-[#ececee] dark:bg-[#2c2c2e]")},"effect-create":{line:pe("text-teal-600 text-opacity-20"),fiber:""},"effect-destroy":{line:pe("text-indigo-500 text-opacity-20"),fiber:""},"maybe-leaks":{line:"",fiber:""}},tw=t=>{switch(t.op){case"update":return t.specialReasons;case"update-bailout-state":return[{name:"No state changes",bailout:!0,loc:null}];case"update-bailout-memo":return[{name:"React.memo()",bailout:!0,loc:null}];case"update-bailout-scu":return[{name:"shouldComponentUpdate()",bailout:!0,loc:null}];default:return null}},nw=t=>{const{context:e,props:n,state:i}=t,a=[];return n&&n.length&&a.push("props"),e&&a.push("context"),i&&a.push("state"),a.length>0?a:null};function rw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m12 12l8-4.5M12 12v9m0-9L4 7.5m8 4.5l8 4.5M12 3v9m0 0l-8 4.5"})})}function iw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"})})}function ow(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 5v14m-7-7h14"})})}function aw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 11A8.1 8.1 0 0 0 8.729 4.695m-2.41 1.624A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 13.671 4.691M20 16v-1h-1M3 3l18 18"})})}function sw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14"})})}const GS=({op:t,selected:e,prevConjunction:n,nextConjunction:i,updateTrigger:a,children:s,details:u})=>C.jsxs("div",{className:pe("relative box-border flex items-center whitespace-nowrap text-xs"),children:[C.jsxs("div",{className:pe("absolute inset-0 flex h-full w-7 flex-col items-center justify-center",$o[t].line),children:[C.jsx("div",{className:pe("h-3 w-1",{"border-x border-background-default border-opacity-30 bg-current":n})}),C.jsx("div",{className:pe("w-1 flex-1",{"border-x border-background-default border-opacity-30 bg-current":i})}),C.jsxs("div",{className:`text-xss ${pe("mx-auto my-[5px] h-[14px] w-[14px]","border border-background-default border-opacity-30","absolute inset-0 flex items-center justify-center rounded-full",{"my-[2px] h-5 w-5 rounded-r-none":e},$o[t].fiber)}`,title:ew[t],children:[t==="unmount"?C.jsx(sw,{}):null,t==="mount"?C.jsx(ow,{}):null,a?C.jsx(rw,{}):null,t==="update"&&!a?C.jsx(iw,{}):null,t==="update-bailout-state"||t==="update-bailout-memo"||t==="update-bailout-scu"?C.jsx(aw,{}):null]})]}),C.jsxs("div",{className:pe("w-full flex-1 py-[2px] pl-7"),children:[C.jsx("div",{className:pe("mr-[6px] flex flex-wrap items-center gap-1",{"-ml-[7px]":e}),children:s}),u]})]}),lw=({commitId:t,event:e,prevConjunction:n,nextConjunction:i})=>C.jsx(GS,{op:e.op,prevConjunction:n,nextConjunction:i,children:C.jsxs("div",{className:`text-xxs ${pe("my-[2px] -ml-[22px] px-1 py-[2px]","z-10 rounded-md border border-border bg-accent","text-zinc-500 dark:text-zinc-400")}`,children:["Commit #",t]})}),cw=({fiberId:t,op:e})=>{const{selected:n,select:i}=ns(t),a=Qa(t);return a?C.jsxs("div",{className:pe("inline-flex items-baseline gap-1"),children:[C.jsx("div",{className:`text-xs ${pe("box-border flex h-5 items-center font-medium",$o[e].fiber,{"line-through":e==="unmount"},{"rounded-r-lg border border-background-default border-opacity-30 px-[6px]":n},{"cursor-pointer !bg-transparent text-brand underline-offset-2 hover:underline":!n})}`,onClick:n?void 0:()=>i(t),children:a.displayName}),a.key!==null&&C.jsx(IE,{fiber:a})]}):null},uw=({event:t,changes:e=null,expanded:n=!1,toggleExpanded:i})=>{const a=e!==null?nw(e):null;if(a===null)return null;const s=bf(e==null?void 0:e.warnings);return C.jsxs("span",{className:`text-xxs ${pe("inline-flex cursor-pointer items-center gap-[2px] py-[2px] pl-[2px] pr-1","rounded-sm bg-zinc-100 text-zinc-500 opacity-80 hover:opacity-100 dark:bg-zinc-800 dark:text-zinc-400")}`,onClick:i,children:[n?C.jsx(xE,{}):C.jsx(wE,{}),a==null?void 0:a.map(u=>C.jsx("span",{children:u},u)),s>0?C.jsx(xc,{className:"text-[8px] text-[#ca8a04]"}):null]})},fs=({values:t})=>C.jsxs("div",{className:"flex flex-wrap text-zinc-500",children:[C.jsx("code",{className:"inline-block rounded-sm bg-red-400 bg-opacity-10 px-1 text-[#ca6a6a]",children:t.prev})," → ",C.jsx("code",{className:"inline-block rounded-sm bg-green-400 bg-opacity-10 px-1 text-[#619c5c]",children:t.next})]}),dw=({diff:t,values:e})=>{const n=t.eqLeft>0||t.eqRight>0?`${t.eqLeft>0?`first ${t.eqLeft}`:""}${t.eqLeft>0&&t.eqRight>0?" and ":""}${t.eqRight>0?`last ${t.eqRight}`:""}${t.eqLeft+t.eqRight===1?" element is":" elements are"} equal`:"";return C.jsxs(C.Fragment,{children:[C.jsx(fs,{values:e}),t.prevLength!==t.nextLength&&C.jsxs("div",{className:"box-border flex min-w-full gap-1 pl-4 text-xs text-zinc-500",children:[C.jsx("span",{className:"text-[#9c913b]",children:"length "}),C.jsx(fs,{values:{prev:t.prevLength,next:t.nextLength}})]}),n?C.jsx("span",{className:`text-xxs ${pe("block min-w-full pl-3 leading-4 text-zinc-400")}`,children:n}):null]})},Kc=(t,e,n)=>t===1?`${t} ${e}`:`${t} ${n}`,_w=({diff:t})=>{const e=t.sample.length,n=t.keys-e,i=n===0?!1:t.diffKeys<=e?`… all the rest ${Kc(n,"entry has","entries have")} not changed`:t.keys===t.diffKeys?`… all the rest ${Kc(n,"entry is","entries are")} also changed`:`… ${t.diffKeys-e} of the rest ${Kc(n,"entry","entries")} ${t.diffKeys-e===1?"is":"are"} also changed`;return C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"font-mono text-zinc-400",children:"{"}),t.sample.map(a=>{const s=C.jsx("span",{children:`${a.name}: `});return"prev"in a?"next"in a?C.jsxs("div",{className:"ml-4 box-border flex min-w-full gap-1 text-xs text-zinc-500",children:[s,C.jsx(fs,{values:a})]},a.name):C.jsxs("div",{className:"relative ml-4 box-border flex min-w-full gap-1 text-xs text-[#ca6a6a]",children:[C.jsx("div",{className:"absolute -left-[10px] w-2",children:"- "}),s,C.jsx("code",{className:"rounded-sm bg-red-400 bg-opacity-10 px-1",children:a.prev})]},a.name):C.jsxs("div",{className:"relative ml-4 box-border flex min-w-full gap-1 text-xs text-[#619c5c]",children:[C.jsx("div",{className:"absolute -left-[10px] w-2",children:"+ "}),s,C.jsx("code",{className:"rounded-sm bg-green-400 bg-opacity-10 px-1",children:a.next})]},a.name)}),i?C.jsx("span",{className:`text-xxs ${pe("block min-w-full pl-3 leading-4 text-zinc-400")}`,children:i}):null,C.jsx("span",{className:"font-mono text-zinc-400",children:"}"})]})},pw=()=>C.jsxs("span",{className:`text-xxs ${pe("inline-flex h-4 items-center gap-[2px] rounded-sm px-[3px]",$o.update.fiber)}`,title:"No difference in entries. In case of props or context, a value memoization might be effective. In case of state, additional checking before changing the state can be effective.",children:[C.jsx(xc,{className:"text-[9px]"}),"Shallow equal"]}),mw="0.0.3",YS=O.createContext({}),gw=t=>{const{children:e}=t,{rpc:n}=Rr(),[i,a]=O.useState(!1),s=O.useRef(!1),[u,c]=O.useState(),[_,p]=O.useState(),m=O.useMemo(()=>({isConnected:i,env:u,config:_,setEnv:c,setConfig:p}),[i,u,_]);return O.useEffect(()=>{const E=crypto.randomUUID(),S=async()=>{var A,w,M;if(s.current)return;await((A=n.updateEnv)==null?void 0:A.call(n,{clientId:E,clientVersion:mw}));const y=await((w=n.getConfig)==null?void 0:w.call(n)),N=await((M=n.getEnv)==null?void 0:M.call(n));p(y),c(N),s.current=!0,a(!0)},f=()=>{s.current=!1,a(!1)};n.$functions.connect=S,n.$functions.disconnect=f;const h=async()=>{var y;try{await((y=n.connect)==null?void 0:y.call(n)),await S()}catch(N){console.log(N)}},T=async()=>{var y;try{await((y=n.disconnect)==null?void 0:y.call(n)),f()}catch(N){console.log(N)}};return h(),window.addEventListener("beforeunload",T),()=>{window.removeEventListener("beforeunload",T)}},[]),C.jsx(YS.Provider,{value:m,children:e})},ji=()=>O.useContext(YS),fw=({diff:t,values:e,eventId:n})=>{const{getEventFromDexie:i}=yc(),{env:a}=ji();return C.jsxs(C.Fragment,{children:[typeof t=="object"?"keys"in t?C.jsx(_w,{diff:t}):C.jsx(dw,{diff:t,values:e}):"prev"in e&&C.jsx(fs,{values:e}),(a==null?void 0:a.diffMode)==="full"?C.jsx("button",{className:`text-xxs ${pe("h-4 rounded-sm bg-brand/20 px-1.5 text-brand")}`,onClick:s=>{var u;s.stopPropagation(),(u=i==null?void 0:i(n))==null||u.then(c=>{console.log(c)})},children:"Raw"}):null,t===!1&&C.jsx(pw,{})]})},Qc=t=>{const{type:e,prelude:n,name:i,index:a,diffPrelude:s,diff:u,values:c,warn:_=!1,eventId:p,diffIndex:m}=t;return C.jsxs("div",{className:pe("flex flex-wrap items-center gap-1 border-t border-border p-1 first:border-none"),children:[C.jsx("span",{className:`text-xxs ${pe("-ml-3 rounded-sm px-1 py-[3px] font-medium uppercase","border border-border bg-zinc-100 text-zinc-500 dark:bg-zinc-900")}`,children:e}),n,C.jsx("span",{className:"text-zinc-600 dark:text-zinc-200",children:i}),s,C.jsx(fw,{diff:u,values:c,eventId:p})]},a)},Ew=t=>{const{entry:e}=t;return C.jsx(Qc,{type:"prop",name:e.name,diff:e.diff,values:e,...t})},Sw=t=>{const{entry:e,fiberId:n}=t,{fiberById:i}=sn(),a=i.get(n),s=e.context,u=s!=null&&s.providerId?i.get(s.providerId):null;return s!==null&&(a==null||a.typeDef.hooks.filter(c=>c.context===s)),C.jsx(Qc,{type:"context",name:u?C.jsx(Yo,{fiber:u}):(s==null?void 0:s.name)||"UnknownContext",diff:e.diff,values:e,warn:!1,...t})},hw=t=>{var n,i;const{entry:e}=t;return C.jsx(Qc,{type:"state",name:(n=e.hook)==null?void 0:n.name,index:(i=e.hook)==null?void 0:i.index,diff:e.diff,values:e,...t})},Tw=({eventId:t,fiberId:e,changes:n,nextConjunction:i})=>{var s,u,c;if(!n)return C.jsx(C.Fragment,{children:"Unknown changes"});const a=n.warnings;return C.jsx("div",{className:pe("mr-[6px] mt-1 rounded-md border border-border bg-white dark:bg-zinc-900"),children:C.jsxs("div",{children:[(s=n.props)==null?void 0:s.map((_,p)=>C.jsx(Ew,{diffIndex:p,eventId:t,entry:_,warn:a.props.has(_)},p)),(u=n.context)==null?void 0:u.map((_,p)=>C.jsx(Sw,{diffIndex:p,eventId:t,entry:_,fiberId:e},p)),(c=n.state)==null?void 0:c.map((_,p)=>C.jsx(hw,{diffIndex:p,eventId:t,entry:_,warn:a.state.has(_)},p))]})})},bw=({fiberId:t,event:e,changes:n,prevConjunction:i,nextConjunction:a,indirectRootTrigger:s})=>{const[u,c]=O.useState(!1),_=O.useCallback(()=>c(f=>!f),[]),{selected:p}=ns(t),m=e.op==="update"&&e.trigger===void 0,E=tw(e),S=(e.op==="update"||e.op==="update-bailout-scu")&&u&&C.jsx(Tw,{eventId:e.id,fiberId:t,changes:n,nextConjunction:a});return C.jsxs(GS,{op:e.op,selected:p,prevConjunction:i,nextConjunction:a,updateTrigger:m,indirectRootTrigger:s,details:S,children:[C.jsx(cw,{fiberId:t,op:e.op})," ",C.jsx(uw,{event:e,changes:n,expanded:u,toggleExpanded:_}),E==null?void 0:E.map((f,h)=>C.jsx("span",{className:`text-xxs ${pe("rounded-sm border border-solid border-opacity-20 p-[2px]","text-zinc-500",f.bailout?"border-[#c8d7e3]":"border-[#dec6e7] bg-[#f8e6ff] text-[#9366a5]",f.bailout?$o["update-bailout-memo"].fiber:"")}`,children:f.name},h))]})},Es=30,zS=10,VS=O.memo(({rootId:t,events:e})=>{var m,E,S,f;const{commitById:n,fiberById:i}=sn(),a=i.get(t),[s,u]=O.useState(()=>{const h=Math.max(0,e.length-Es);return h<zS?0:h}),c=O.useMemo(()=>new WeakMap,[t]),_=O.useCallback((h,T,y,N)=>{const A=c.get(h);if(A&&A.props.prevConjunction===T&&A.props.nextConjunction===y&&A.props.indirectRootTrigger===N)return A;const{target:w,targetId:M,event:D}=h;let k=null;switch(w){case"commit":k=C.jsx(lw,{commitId:M,event:D,prevConjunction:T,nextConjunction:y},D.id);break;default:k=C.jsx(bw,{fiberId:M,event:D,changes:h.changes,prevConjunction:T,nextConjunction:y,indirectRootTrigger:N},D.id)}return c.set(h,k),k},[t]);if(e===null)return null;if(!e.length)return C.jsx("div",{className:"px-2 py-1 text-xs text-zinc-400",children:"No events found"});const p=[];for(let h=s;h<e.length;h++){const{target:T,targetId:y,event:N,trigger:A}=e[h],w=(E=(m=e[h-1])==null?void 0:m.event)==null?void 0:E.commitId,M=(f=(S=e[h+1])==null?void 0:S.event)==null?void 0:f.commitId;let D=N.commitId!==-1&&N.commitId===w;const k=N.commitId!==-1&&N.commitId===M;if(N.commitId!==w){const Y=n.get(N.commitId);Y&&(p.push(_(Y.start,!1,!0,!1)),D=!0)}T==="fiber"&&y===t&&"trigger"in N&&A!==null&&(p.push(_(A,!0,!0,(a==null?void 0:a.ownerId)!==A.targetId)),D=!0),p.push(_(e[h],D,k,!1))}return C.jsxs(C.Fragment,{children:[s>0&&C.jsxs("div",{className:"mx-[6px] flex gap-[6px]",children:[s>Es+zS&&C.jsxs(Pt,{onClick:()=>u(Math.max(0,s-Es)),size:"sm",variant:"ghost",className:"h-5 flex-1 text-zinc-600 dark:text-zinc-400",style:{fontSize:10},children:["Show ",Math.min(s,Es)," more..."]}),C.jsxs(Pt,{onClick:()=>u(0),size:"sm",variant:"ghost",className:"h-5 flex-1 text-zinc-600 dark:text-zinc-400",style:{fontSize:10},children:["Show all the rest ",s,"..."]})]}),C.jsx("div",{className:"relative pb-1",children:p})]})});VS.displayName="EventList";function Rw(t){const{fiber:e,groupByParent:n,showUnmounted:i,excludeHostType:a,showSubtreeEvents:s}=t,u=tA(e.id,n,i,s),{fiberById:c}=sn(),_=O.useMemo(()=>a?u.filter(p=>{const m=c.get(p.targetId);return m?!Cr(m.type):!0}):u,[u,a,c]);return C.jsx("div",{className:"w-full flex-1 overflow-y-auto overflow-x-hidden",children:C.jsx(VS,{rootId:e.id,events:_},[e.id,n,i,s].join("-"))})}const HS=O.memo(t=>{const{rootId:e,groupByParent:n,showUnmounted:i,excludeHostType:a,showSubtreeEvents:s}=t,u=Qa(e);return u===void 0?C.jsxs("div",{className:"px-2 py-1 text-xs text-zinc-400",children:["Fiber with #",e," is not found"]}):C.jsxs("div",{className:"flex h-full w-full flex-col",children:[C.jsx(Jx,{fiber:u,excludeHostType:a}),C.jsx(Rw,{fiber:u,groupByParent:n,showUnmounted:i,excludeHostType:a,showSubtreeEvents:s})]})});HS.displayName="FiberDetail";const jc=28,qS=4,yr=pe("transition-colors rounded-lg","hover:bg-zinc-500 hover:bg-opacity-10 active:bg-zinc-500 active:bg-opacity-15","dark:hover:bg-zinc-400 dark:hover:bg-opacity-10 dark:active:bg-zinc-400 dark:active:bg-opacity-15"),Cw={top:yr,bottom:yr,left:yr,right:yr,topLeft:yr,topRight:yr,bottomLeft:yr,bottomRight:yr},vw=({value:t,setValue:e,groupByParent:n,showUnmounted:i})=>{const{selectedId:a,select:s}=mi(),{match:u}=rs(),{selectTree:c}=sn(),_=c(n,i),p=E=>{e(E.target.value,!0)},m=E=>{switch(E.code){case"Enter":{let S=null;E.shiftKey?S=_.findBack(f=>{var h;return f.id!==a&&u(((h=f.fiber)==null?void 0:h.displayName)||null)!==null},a):S=_.find(f=>{var h;return f.id!==a&&u(((h=f.fiber)==null?void 0:h.displayName)||null)!==null},a),S&&s(S.id,!1);break}case"Escape":{e("");break}}};return C.jsx(Qi,{className:"w-auto flex-1",placeholder:"Find by display name",value:t,onInput:p,onKeyDown:m})};function yw(t){const[e,n]=O.useState(0);return Tr(()=>t.subscribe(()=>n(i=>i+1)),[t]),e}function Nw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 5v14m6-6l-6 6m-6-6l6 6"})})}function Ow(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 5v14m6-8l-6-6m-6 6l6-6"})})}const Iw=t=>{const{groupByParent:e,showUnmounted:n,excludeHostType:i,autoselect:a,pattern:s,children:u}=t,{selectedId:c,select:_}=mi(),{pinnedId:p}=Ac(),{match:m}=rs(),{selectTree:E}=sn(),S=E(e,n),f=S.getOrCreate(p),h=c!==null&&S.get(c)||null,T=yw(S),[y,N]=O.useState(null),A=O.useMemo(()=>Va(M=>_(M,!1),100,{maxWait:200}),[]);if(O.useEffect(()=>{let M=null,D=0,k=0;f.walk(Y=>{var q;i&&Y.fiber&&Cr(Y.fiber.type)||m(((q=Y.fiber)==null?void 0:q.displayName)||null)!==null&&(k++,Y.id===c&&(D=k),M===null&&(M=Y.id))}),a.current&&k>0&&D===0&&(A(M),D=1),a.current=!1,N({index:D,total:k})},[c,m,S,f,T,s,i]),y===null)return null;const w=y.total===0||y.total===1&&y.index===1;return C.jsxs("div",{className:"flex items-center",children:[C.jsx("div",{className:"px-1 text-xs text-zinc-600 dark:text-zinc-400",children:y.total?`${y.index||"–"} / ${y.total}`:"No matches"}),C.jsxs("div",{children:[C.jsx(Pt,{variant:"ghost",size:"icon",className:"w-6 text-zinc-600 dark:text-zinc-400",disabled:w,onClick:()=>{const M=f===S.root||h!==null&&f.contains(h)?h:null,D=f.findBack(k=>{var Y;return i&&k.fiber&&Cr(k.fiber.type)?!1:k.id!==c&&m(((Y=k.fiber)==null?void 0:Y.displayName)||null)!==null},M);D&&_(D.id,!1)},children:C.jsx(Ow,{})}),C.jsx(Pt,{variant:"ghost",size:"icon",className:"w-6 text-zinc-600 dark:text-zinc-400",disabled:w,onClick:()=>{const M=f===S.root||h!==null&&f.contains(h)?h:null,D=f.find(k=>{var Y;return i&&k.fiber&&Cr(k.fiber.type)?!1:k.id!==c&&m(((Y=k.fiber)==null?void 0:Y.displayName)||null)!==null},M);D&&_(D.id,!1)},children:C.jsx(Nw,{})}),u]})]})},Aw=({groupByParent:t,showUnmounted:e,excludeHostType:n})=>{const i=O.useRef(!1),{setPattern:a}=rs(),[s,u]=O.useState(""),c=O.useCallback((_,p=!1)=>{p&&(i.current=!0),a(_),u(_)},[a,u]);return C.jsxs("div",{className:"flex w-full gap-1",children:[C.jsx(vw,{value:s,setValue:c,groupByParent:t,showUnmounted:e}),s?C.jsx(Iw,{groupByParent:t,showUnmounted:e,excludeHostType:n,autoselect:i,pattern:s,children:C.jsx(Pt,{variant:"ghost",size:"icon",className:"w-6 text-zinc-600 dark:text-zinc-400",onClick:()=>c(""),children:C.jsx(Wc,{})})}):null]})};function xw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 7V6a2 2 0 0 1 2-2h2M4 17v1a2 2 0 0 0 2 2h2m8-16h2a2 2 0 0 1 2 2v1m-4 13h2a2 2 0 0 0 2-2v-1m-8 0l3-8l-8 3l3.5 1.5z"})})}const ww=({excludeHostType:t})=>{const{inspectMode:e,toggleInspect:n,stopInspect:i}=Ic();return O.useEffect(()=>()=>i(),[]),C.jsx(Pt,{variant:"outline",size:"icon",onClick:()=>n(t),className:pe("min-w-7 -scale-x-100 text-base text-zinc-600 dark:text-zinc-400",{"!text-brand":e}),children:C.jsx(xw,{})})};function Dw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14M5 12l6 6m-6-6l6-6"})})}function Mw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14m-6 6l6-6m-6-6l6 6"})})}const Lw=()=>{const{hasPrev:t,hasNext:e,prev:n,next:i}=rA();return C.jsxs("div",{className:"flex",children:[C.jsx(Pt,{variant:"ghost",size:"icon",className:"w-6 text-zinc-600 dark:text-zinc-400",disabled:!t,onClick:t?n:void 0,children:C.jsx(Dw,{})}),C.jsx(Pt,{variant:"ghost",size:"icon",className:"w-6 text-zinc-600 dark:text-zinc-400",disabled:!e,onClick:e?i:void 0,children:C.jsx(Mw,{})})]})},$S=O.memo(({groupByParent:t,showUnmounted:e,excludeHostType:n})=>C.jsxs("div",{className:"m-1 flex w-full gap-1",children:[C.jsx(Lw,{}),C.jsx(Aw,{groupByParent:t,showUnmounted:e,excludeHostType:n}),C.jsx(ww,{excludeHostType:n})]}));$S.displayName="Toolbar";const WS=O.memo(()=>{const{settings:t}=Wi(yt.ComponentTree),{groupByParent:e,showUnmounted:n,excludeHostType:i,showSubtreeEvents:a,treeMode:s}=t,{selectedId:u}=mi(),{pinnedId:c}=Ac();return C.jsx("div",{className:"flex h-full flex-col",children:C.jsxs(pA,{children:[C.jsx("div",{className:"box-content flex h-9 items-center justify-center border-b border-border",children:C.jsx($S,{groupByParent:e,showUnmounted:n,excludeHostType:i})}),C.jsxs("div",{className:"flex h-full w-full flex-1 overflow-hidden",children:[C.jsxs("div",{className:"flex-1",children:[C.jsx(PE,{rootId:c,groupByParent:e}),C.jsx(LE,{rootId:c,groupByParent:e,showUnmounted:n,excludeHostType:i,treeMode:s})]}),u!==null&&C.jsx(WE,{className:"border-l border-border",handleClasses:{left:yr},enable:{left:!0},defaultSize:{width:280},children:C.jsx(HS,{rootId:u,groupByParent:e,showUnmounted:n,excludeHostType:i,showSubtreeEvents:a})})]})]})})});WS.displayName="ComponentTreeView";const Ss=t=>{const{id:e,label:n,...i}=t;return C.jsxs("div",{className:"flex items-center space-x-2",children:[C.jsx(AS,{id:e,...i}),n?C.jsx(Ho,{htmlFor:e,className:"text-secondary-foreground",children:n}):null]})},KS=O.memo(()=>{const{settings:t,update:e}=Wi(yt.ComponentTree);return C.jsxs("div",{className:"flex flex-col gap-2 pb-1",children:[C.jsx("div",{className:"text-base font-medium",children:"Component Tree"}),C.jsx(Ss,{id:"excludeHostType",checked:t.excludeHostType,onCheckedChange:n=>e({...t,excludeHostType:!!n}),label:"Exclude hostType"}),C.jsx(Ss,{id:"groupByParent",checked:t.groupByParent,onCheckedChange:n=>e({...t,groupByParent:!!n}),label:"Group by parent"}),C.jsx(Ss,{id:"showUnmounted",checked:t.showUnmounted,onCheckedChange:n=>e({...t,showUnmounted:!!n}),label:"Show unmounted"}),C.jsx(Ss,{id:"showSubtreeEvents",checked:t.showSubtreeEvents,onCheckedChange:n=>e({...t,showSubtreeEvents:!!n}),label:"Show subtree events"}),C.jsx("div",{children:"Tree Display Mode"}),C.jsxs(Hc,{className:"flex",defaultValue:t.treeMode,onValueChange:n=>e({...t,treeMode:n}),children:[C.jsxs("div",{className:"flex items-center space-x-2",children:[C.jsx(ms,{value:$i.Standard,id:"r1"}),C.jsx(Ho,{htmlFor:"r1",children:"Standard"})]}),C.jsxs("div",{className:"flex items-center space-x-2",children:[C.jsx(ms,{value:$i.ChangesOnly,id:"r2"}),C.jsx(Ho,{htmlFor:"r2",children:"Changes Only"})]})]})]})});KS.displayName="ComponentTreeSettings";const QS=O.memo(()=>{const{settings:t,update:e}=Wi(yt.ModelAnalyze);return C.jsxs("div",{className:"flex w-80 flex-col gap-2 pb-1",children:[C.jsx("div",{className:"text-base font-medium",children:"Analyze Bot"}),C.jsx(Qi,{placeholder:"Bot ID",value:t.botId,onInput:n=>e({...t,botId:n.currentTarget.value})}),C.jsx(Qi,{placeholder:"Token",type:"password",value:t.token,onInput:n=>e({...t,token:n.currentTarget.value})}),C.jsx("div",{className:"text-xs text-muted-foreground",children:"Powered by Coze."})]})});QS.displayName="ModelAnalyzeSettings";const jS=O.memo(()=>{const{rpc:t}=Rr(),{resetPanelSize:e}=vr(),{env:n}=ji(),i=O.useCallback(()=>{var a;(a=t.resetConfig)==null||a.call(t)},[t]);return C.jsxs("div",{className:"flex h-full w-full flex-col items-start gap-3 overflow-auto px-3 py-2",children:[C.jsx(KS,{}),C.jsx(QS,{}),C.jsxs("div",{className:"flex flex-col items-start gap-2 pb-1",children:[C.jsx("div",{className:"text-base font-medium",children:"Global"}),C.jsxs("div",{className:"flex gap-1",children:[C.jsxs(gi,{children:["Diff Mode: ",n==null?void 0:n.diffMode]}),C.jsxs(gi,{children:["Update Trace: ",n!=null&&n.updateTrace?"on":"off"]}),C.jsxs(gi,{children:["Commit Trace: ",n!=null&&n.commitTrace?"on":"off"]})]}),C.jsx(Pt,{onClick:i,variant:"secondary",children:"Reset Local Configs"}),!window.__PERF_MONITOR_DEVTOOLS_CLIENT_SEPARATE__&&C.jsx(Pt,{onClick:e,variant:"secondary",children:"Reset Panel Size"})]})]})});jS.displayName="SettingsView";const XS=O.createContext({}),hs=()=>O.useContext(XS),Pw=t=>{const{children:e}=t,{rpc:n}=Rr(),{isConnected:i}=ji(),[a,s]=O.useState([]),[u,c]=O.useState(),[_,p]=O.useState([]),m=O.useMemo(()=>({selectedRenderer:u,unsupportedRenderers:_,activedRenderers:a,previewRenderer:E=>{var S;return(S=n.highlightRenderer)==null?void 0:S.call(n,E)},hidePreview:()=>{var E;return(E=n.stopHighlight)==null?void 0:E.call(n)}}),[u,_,a]);return O.useEffect(()=>{n.$functions.reactRenderers=E=>{E.renderers.length>0&&c(E.renderers[0]),p(E.unsupportedRenderers)},n.$functions.activedRenderers=s},[]),O.useEffect(()=>{i||(c(void 0),p([]),s([]))},[i]),C.jsx(XS.Provider,{value:m,children:e})};function Wo(t){return C.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 16 16",...t,children:[C.jsx("path",{fill:"currentColor",d:"M4.85 2.372c-.251.145-.515.544-.546 1.416a.75.75 0 0 1-1.499-.053c.038-1.068.376-2.131 1.295-2.662c.922-.532 2.015-.29 2.961.214a.75.75 0 0 1-.706 1.324c-.773-.413-1.253-.384-1.505-.24m4.021 1.3a.75.75 0 0 1 1.056.1a16.5 16.5 0 0 1 1.57 2.268c1.04 1.802 1.681 3.648 1.854 5.196c.086.773.06 1.509-.12 2.14c-.183.635-.537 1.21-1.131 1.553c-.719.415-1.55.357-2.309.08c-.762-.278-1.547-.803-2.295-1.486a.75.75 0 0 1 1.011-1.108c.66.602 1.279.996 1.797 1.184c.522.19.85.145 1.046.031c.164-.095.33-.288.438-.667c.11-.384.145-.91.072-1.56c-.145-1.299-.7-2.947-1.663-4.613A15 15 0 0 0 8.772 4.73a.75.75 0 0 1 .1-1.056"}),C.jsx("path",{fill:"currentColor",d:"M14.5 8.206c0-.29-.214-.719-.953-1.18a.75.75 0 0 1 .795-1.273C15.248 6.32 16 7.144 16 8.206c0 1.064-.756 1.89-1.666 2.457a.75.75 0 0 1-.793-1.273c.744-.464.959-.894.959-1.184m-3.137 2.832a.75.75 0 0 1-.614.865A16.6 16.6 0 0 1 8 12.127c-2.08 0-4-.367-5.427-.992c-.713-.311-1.336-.702-1.792-1.174C.32 9.487 0 8.891 0 8.206c0-.83.466-1.52 1.085-2.04c.622-.521 1.47-.938 2.435-1.244a.75.75 0 0 1 .454 1.43c-.85.27-1.502.609-1.924.964c-.426.356-.55.663-.55.89c0 .19.085.43.359.713c.278.287.716.58 1.315.842c1.197.524 2.902.866 4.826.866c.885 0 1.727-.072 2.498-.203a.75.75 0 0 1 .865.614"}),C.jsx("path",{fill:"currentColor",d:"M4.872 13.63c.25.145.729.174 1.499-.235a.75.75 0 1 1 .704 1.325c-.944.501-2.034.74-2.953.21c-.922-.533-1.26-1.6-1.295-2.672a.75.75 0 0 1 1.499-.05c.03.875.294 1.277.546 1.422m-.884-4.133a.75.75 0 0 1-.442-.964c.302-.815.697-1.657 1.18-2.493c1.04-1.802 2.318-3.28 3.572-4.204c.626-.461 1.276-.806 1.913-.965c.641-.16 1.317-.141 1.91.202c.72.415 1.084 1.163 1.224 1.96c.141.799.078 1.741-.14 2.73a.75.75 0 1 1-1.464-.321c.191-.872.223-1.606.127-2.15c-.096-.546-.3-.807-.496-.92c-.164-.095-.415-.142-.797-.046c-.388.097-.86.33-1.387.718c-1.052.774-2.202 2.08-3.163 3.746a15 15 0 0 0-1.073 2.265a.75.75 0 0 1-.964.442"}),C.jsx("path",{fill:"currentColor",d:"M9.46 8.066a1.36 1.36 0 1 1-2.72 0a1.36 1.36 0 0 1 2.72 0"})]})}function kw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 6a3 3 0 1 0 6 0a3 3 0 0 0-6 0m18 5V8a2 2 0 0 0-2-2h-6l3 3m0-6l-3 3M3 13v3a2 2 0 0 0 2 2h6l-3-3m0 6l3-3m4 0a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})})}const Fw=(t,e=2)=>{if(typeof t>"u")return"-";if(t===0)return"0 Bytes";const n=1024,i=e<0?0:e,a=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],s=Math.floor(Math.log(t)/Math.log(n)),u=a[s];return`${parseFloat((t/Math.pow(n,s)).toFixed(i))} ${u}`},ZS=t=>{const{icon:e,text:n,...i}=t;return C.jsxs("div",{...i,className:pe("flex min-w-48 flex-1 flex-col items-center justify-center gap-2 rounded-md border border-border p-4","text-zinc-500 transition-colors hover:border-brand hover:border-opacity-10 hover:bg-brand hover:bg-opacity-10 hover:text-brand",i.className),children:[e?C.jsx("div",{className:"text-3xl",children:e}):null,n?C.jsx("div",{className:"flex flex-col items-center justify-center",children:n.filter(Boolean).map((a,s)=>C.jsx("div",{children:a},s))}):null]})},Xi=({children:t,className:e,...n})=>C.jsx("kbd",{className:pe("pointer-events-none inline select-none items-center rounded border border-border bg-muted px-1.5 py-[2px] font-mono text-xs font-medium text-muted-foreground"),...n,children:t}),Uw=()=>C.jsxs("div",{className:"flex w-full flex-col items-center justify-center gap-3 text-zinc-500 dark:text-zinc-400",children:[C.jsxs("div",{children:[C.jsx("span",{children:"Press "}),C.jsxs(Xi,{children:["Shift(",C.jsx("span",{className:"font-serif",children:"⇧"}),")"]}),C.jsx("span",{children:" + "}),C.jsxs(Xi,{children:["Alt(",C.jsx("span",{className:"font-serif",children:"⌥"}),")"]}),C.jsx("span",{children:" + "}),C.jsx(Xi,{children:"D"}),C.jsx("span",{children:" to toggle DevTools"})]}),C.jsxs("div",{children:[C.jsx("span",{children:"Press "}),C.jsxs(Xi,{children:["Shift(",C.jsx("span",{className:"font-serif",children:"⇧"}),")"]}),C.jsx("span",{children:" + "}),C.jsxs(Xi,{children:["Alt(",C.jsx("span",{className:"font-serif",children:"⌥"}),")"]}),C.jsx("span",{children:" + "}),C.jsx(Xi,{children:"X"}),C.jsx("span",{children:" to inspect"})]})]}),JS=O.memo(()=>{const{preset:t}=Rr(),{env:e}=ji(),{selectedRenderer:n}=hs(),{bytesReceived:i,events:a}=yc();return C.jsxs("div",{className:"flex h-full w-full flex-col items-start gap-8 overflow-auto px-5 py-8",children:[C.jsxs("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[C.jsxs("div",{className:"flex items-end gap-2",children:[C.jsx(Wo,{className:"h-12 w-12 text-brand"}),C.jsxs("span",{className:"text-4xl font-semibold",children:["perf-monitor ",C.jsx("span",{className:"text-brand",children:"DevTools"})]})]}),C.jsx("div",{className:"text-center text-sm text-zinc-400 dark:text-zinc-500",children:C.jsxs("div",{className:"flex justify-center gap-1",children:[C.jsx("span",{children:"Core"}),C.jsx("code",{children:`v${e==null?void 0:e.coreVersion}`}),C.jsx("span",{children:"Client"}),C.jsx("code",{children:`v${e==null?void 0:e.clientVersion}`})]})})]}),C.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[C.jsx(ZS,{icon:C.jsx(Wo,{className:"p-[2px]"}),text:[`react-dom@${n==null?void 0:n.version}`,n==null?void 0:n.bundleType]}),C.jsx(ZS,{icon:C.jsx(kw,{}),text:[`${a.length} events received`,`${Fw(i)} (${t})`]})]}),C.jsx(Uw,{})]})});JS.displayName="OverviewView";/**
54
+ 请根据代码分析可能异常原因`;console.log("analyze message generated: ",{code:y,causes:M}),m([{content:D,hidden:!0}],!0)},[p,_]),S=O.useMemo(()=>Object.values(a).sort((f,h)=>f.create_time-h.create_time),[a]);return C.jsx(FS.Provider,{value:{target:n,messages:S,chat:m,updateTarget:E},children:e})},gs=()=>O.useContext(FS);function Wc(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M18 6L6 18M6 6l12 12"})})}function Xx(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m7 8l-4 4l4 4m10-8l4 4l-4 4M14 4l-4 16"})})}function Zx(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 4v6l-2 4v2h10v-2l-2-4V4m-3 12v5M8 4h8"})})}const qo="h-4 w-4 text-xs text-zinc-600 dark:text-zinc-400",US=O.memo(({fiber:t})=>{const{select:e}=mi(),n=UE(),{pinnedId:i,pin:a}=Ac(),s=t.id===i,{sourceLoc:u,resolving:c,openFile:_}=xS(t),{updateTarget:p}=gs(),m=()=>{e(null),a(s?0:t.id),setTimeout(()=>e(t.id))},E=()=>{p(t.id),n(yt.ModelAnalyze)};return C.jsxs("div",{className:"flex h-6 w-full items-center justify-between p-1",children:[C.jsxs("div",{className:"flex items-center gap-1",children:[C.jsx(AE,{names:[Zl[t.type]]}),!t.mounted&&C.jsx("span",{className:`text-xxs ${pe("font-medium text-zinc-500")}`,children:"Unmounted"})]}),C.jsxs("span",{className:"flex gap-1",children:[C.jsx(Pt,{size:"icon",variant:"ghost",disabled:!u||c,className:qo,onClick:_,children:C.jsx(Xx,{})}),C.jsx(Pt,{size:"icon",variant:"ghost",disabled:!u||c,className:qo,onClick:E,children:C.jsx(YE,{})}),C.jsx(Pt,{size:"icon",variant:"ghost",className:qo,onClick:()=>n(yt.Components),children:C.jsx(Dc,{})}),C.jsx(Pt,{size:"icon",variant:"ghost",className:pe(qo,{"!text-brand":s}),onClick:m,children:s?C.jsx(vE,{}):C.jsx(Zx,{})}),C.jsx(Pt,{size:"icon",variant:"ghost",className:qo,onClick:()=>e(null),children:C.jsx(Wc,{})})]})]})});US.displayName="FiberHeaderTools";const BS=O.memo(({fiber:t,excludeHostType:e})=>{const{fiberById:n}=sn(),i=n.get(t==null?void 0:t.ownerId),a=n.get(t==null?void 0:t.parentId);if(!t||!a)return null;let s=null;a!==i&&!(e&&Cr(a.type))&&(s=C.jsxs(C.Fragment,{children:[" ","Child of ",C.jsx(Yo,{fiber:a},a.id),", "]}));let u=null;return a===i?u=C.jsxs(C.Fragment,{children:["Created by ",C.jsx(Yo,{fiber:a},a.id)]}):i?u=C.jsxs(C.Fragment,{children:["Created by ",C.jsx(Yo,{fiber:i},i.id)]}):u=C.jsx(C.Fragment,{children:"no owner (created outside of render)"}),C.jsxs("div",{className:"text-xxs leading-3 text-zinc-500 dark:text-zinc-400",children:[s,u]})});BS.displayName="FiberHeaderNotes";const Jx=({fiber:t,excludeHostType:e})=>C.jsxs(C.Fragment,{children:[C.jsx(US,{fiber:t}),C.jsxs("div",{className:"flex flex-col px-[6px] pb-1",children:[C.jsx("div",{className:pe("text-sm font-medium text-brand",{"font-normal text-[#8c629a]":Cr(t.type)}),children:C.jsx(is,{fiber:t})}),C.jsx(BS,{fiber:t,excludeHostType:e})]})]}),ew={mount:"Mount",update:"Update","update-bailout-state":"Update bailout (rendered but return is discarded and further update is prevented due to no changes in state)","update-bailout-memo":"React.memo() update bailout (render and further updates are prevented due to no changes in props)","update-bailout-scu":'shouldComponentUpdate() bailout (state and props are set, but render and further updates are prevented due "shouldComponentUpdate" method returned false)',unmount:"Unmount","effect-create":"Create effect","effect-destroy":"Destroy effect","commit-start":"Commit start","maybe-leaks":"Potential memory leaks list changed"},$o={"commit-start":{line:pe("text-[#ececee] dark:text-[#2c2c2e]")},mount:{line:pe("text-[#daf4e0] dark:text-[#18341f]"),fiber:pe("text-[#16a34a] bg-[#daf4e0] dark:bg-[#18341f]")},update:{line:pe("text-[#fbf0d5] dark:text-[#3b3014]"),fiber:pe("text-[#ca8a04] bg-[#fbf0d5] dark:bg-[#3b3014]")},"update-bailout-state":{line:pe("text-[#d9e8f3] dark:text-[#152e3a]"),fiber:pe("text-[#7090a7] bg-[#d9e8f3] dark:bg-[#152e3a]")},"update-bailout-memo":{line:pe("text-[#d9e8f3] dark:text-[#152e3a]"),fiber:pe("text-[#7090a7] bg-[#d9e8f3] dark:bg-[#152e3a]")},"update-bailout-scu":{line:pe("text-[#d9e8f3] dark:text-[#152e3a]"),fiber:pe("text-[#7090a7] bg-[#d9e8f3] dark:bg-[#152e3a]")},unmount:{line:pe("text-[#ececee] dark:text-[#2c2c2e]"),fiber:pe("text-[#71717a] bg-[#ececee] dark:bg-[#2c2c2e]")},"effect-create":{line:pe("text-teal-600 text-opacity-20"),fiber:""},"effect-destroy":{line:pe("text-indigo-500 text-opacity-20"),fiber:""},"maybe-leaks":{line:"",fiber:""}},tw=t=>{switch(t.op){case"update":return t.specialReasons;case"update-bailout-state":return[{name:"No state changes",bailout:!0,loc:null}];case"update-bailout-memo":return[{name:"React.memo()",bailout:!0,loc:null}];case"update-bailout-scu":return[{name:"shouldComponentUpdate()",bailout:!0,loc:null}];default:return null}},nw=t=>{const{context:e,props:n,state:i}=t,a=[];return n&&n.length&&a.push("props"),e&&a.push("context"),i&&a.push("state"),a.length>0?a:null};function rw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m12 12l8-4.5M12 12v9m0-9L4 7.5m8 4.5l8 4.5M12 3v9m0 0l-8 4.5"})})}function iw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"})})}function ow(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 5v14m-7-7h14"})})}function aw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 11A8.1 8.1 0 0 0 8.729 4.695m-2.41 1.624A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 13.671 4.691M20 16v-1h-1M3 3l18 18"})})}function sw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14"})})}const GS=({op:t,selected:e,prevConjunction:n,nextConjunction:i,updateTrigger:a,children:s,details:u})=>C.jsxs("div",{className:pe("relative box-border flex items-center whitespace-nowrap text-xs"),children:[C.jsxs("div",{className:pe("absolute inset-0 flex h-full w-7 flex-col items-center justify-center",$o[t].line),children:[C.jsx("div",{className:pe("h-3 w-1",{"border-x border-background-default border-opacity-30 bg-current":n})}),C.jsx("div",{className:pe("w-1 flex-1",{"border-x border-background-default border-opacity-30 bg-current":i})}),C.jsxs("div",{className:`text-xss ${pe("mx-auto my-[5px] h-[14px] w-[14px]","border border-background-default border-opacity-30","absolute inset-0 flex items-center justify-center rounded-full",{"my-[2px] h-5 w-5 rounded-r-none":e},$o[t].fiber)}`,title:ew[t],children:[t==="unmount"?C.jsx(sw,{}):null,t==="mount"?C.jsx(ow,{}):null,a?C.jsx(rw,{}):null,t==="update"&&!a?C.jsx(iw,{}):null,t==="update-bailout-state"||t==="update-bailout-memo"||t==="update-bailout-scu"?C.jsx(aw,{}):null]})]}),C.jsxs("div",{className:pe("w-full flex-1 py-[2px] pl-7"),children:[C.jsx("div",{className:pe("mr-[6px] flex flex-wrap items-center gap-1",{"-ml-[7px]":e}),children:s}),u]})]}),lw=({commitId:t,event:e,prevConjunction:n,nextConjunction:i})=>C.jsx(GS,{op:e.op,prevConjunction:n,nextConjunction:i,children:C.jsxs("div",{className:`text-xxs ${pe("my-[2px] -ml-[22px] px-1 py-[2px]","z-10 rounded-md border border-border bg-accent","text-zinc-500 dark:text-zinc-400")}`,children:["Commit #",t]})}),cw=({fiberId:t,op:e})=>{const{selected:n,select:i}=ns(t),a=Qa(t);return a?C.jsxs("div",{className:pe("inline-flex items-baseline gap-1"),children:[C.jsx("div",{className:`text-xs ${pe("box-border flex h-5 items-center font-medium",$o[e].fiber,{"line-through":e==="unmount"},{"rounded-r-lg border border-background-default border-opacity-30 px-[6px]":n},{"cursor-pointer !bg-transparent text-brand underline-offset-2 hover:underline":!n})}`,onClick:n?void 0:()=>i(t),children:a.displayName}),a.key!==null&&C.jsx(IE,{fiber:a})]}):null},uw=({event:t,changes:e=null,expanded:n=!1,toggleExpanded:i})=>{const a=e!==null?nw(e):null;if(a===null)return null;const s=bf(e==null?void 0:e.warnings);return C.jsxs("span",{className:`text-xxs ${pe("inline-flex cursor-pointer items-center gap-[2px] py-[2px] pl-[2px] pr-1","rounded-sm bg-zinc-100 text-zinc-500 opacity-80 hover:opacity-100 dark:bg-zinc-800 dark:text-zinc-400")}`,onClick:i,children:[n?C.jsx(xE,{}):C.jsx(wE,{}),a==null?void 0:a.map(u=>C.jsx("span",{children:u},u)),s>0?C.jsx(xc,{className:"text-[8px] text-[#ca8a04]"}):null]})},fs=({values:t})=>C.jsxs("div",{className:"flex flex-wrap text-zinc-500",children:[C.jsx("code",{className:"inline-block rounded-sm bg-red-400 bg-opacity-10 px-1 text-[#ca6a6a]",children:t.prev})," → ",C.jsx("code",{className:"inline-block rounded-sm bg-green-400 bg-opacity-10 px-1 text-[#619c5c]",children:t.next})]}),dw=({diff:t,values:e})=>{const n=t.eqLeft>0||t.eqRight>0?`${t.eqLeft>0?`first ${t.eqLeft}`:""}${t.eqLeft>0&&t.eqRight>0?" and ":""}${t.eqRight>0?`last ${t.eqRight}`:""}${t.eqLeft+t.eqRight===1?" element is":" elements are"} equal`:"";return C.jsxs(C.Fragment,{children:[C.jsx(fs,{values:e}),t.prevLength!==t.nextLength&&C.jsxs("div",{className:"box-border flex min-w-full gap-1 pl-4 text-xs text-zinc-500",children:[C.jsx("span",{className:"text-[#9c913b]",children:"length "}),C.jsx(fs,{values:{prev:t.prevLength,next:t.nextLength}})]}),n?C.jsx("span",{className:`text-xxs ${pe("block min-w-full pl-3 leading-4 text-zinc-400")}`,children:n}):null]})},Kc=(t,e,n)=>t===1?`${t} ${e}`:`${t} ${n}`,_w=({diff:t})=>{const e=t.sample.length,n=t.keys-e,i=n===0?!1:t.diffKeys<=e?`… all the rest ${Kc(n,"entry has","entries have")} not changed`:t.keys===t.diffKeys?`… all the rest ${Kc(n,"entry is","entries are")} also changed`:`… ${t.diffKeys-e} of the rest ${Kc(n,"entry","entries")} ${t.diffKeys-e===1?"is":"are"} also changed`;return C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"font-mono text-zinc-400",children:"{"}),t.sample.map(a=>{const s=C.jsx("span",{children:`${a.name}: `});return"prev"in a?"next"in a?C.jsxs("div",{className:"ml-4 box-border flex min-w-full gap-1 text-xs text-zinc-500",children:[s,C.jsx(fs,{values:a})]},a.name):C.jsxs("div",{className:"relative ml-4 box-border flex min-w-full gap-1 text-xs text-[#ca6a6a]",children:[C.jsx("div",{className:"absolute -left-[10px] w-2",children:"- "}),s,C.jsx("code",{className:"rounded-sm bg-red-400 bg-opacity-10 px-1",children:a.prev})]},a.name):C.jsxs("div",{className:"relative ml-4 box-border flex min-w-full gap-1 text-xs text-[#619c5c]",children:[C.jsx("div",{className:"absolute -left-[10px] w-2",children:"+ "}),s,C.jsx("code",{className:"rounded-sm bg-green-400 bg-opacity-10 px-1",children:a.next})]},a.name)}),i?C.jsx("span",{className:`text-xxs ${pe("block min-w-full pl-3 leading-4 text-zinc-400")}`,children:i}):null,C.jsx("span",{className:"font-mono text-zinc-400",children:"}"})]})},pw=()=>C.jsxs("span",{className:`text-xxs ${pe("inline-flex h-4 items-center gap-[2px] rounded-sm px-[3px]",$o.update.fiber)}`,title:"No difference in entries. In case of props or context, a value memoization might be effective. In case of state, additional checking before changing the state can be effective.",children:[C.jsx(xc,{className:"text-[9px]"}),"Shallow equal"]}),mw="0.0.4",YS=O.createContext({}),gw=t=>{const{children:e}=t,{rpc:n}=Rr(),[i,a]=O.useState(!1),s=O.useRef(!1),[u,c]=O.useState(),[_,p]=O.useState(),m=O.useMemo(()=>({isConnected:i,env:u,config:_,setEnv:c,setConfig:p}),[i,u,_]);return O.useEffect(()=>{const E=crypto.randomUUID(),S=async()=>{var A,w,M;if(s.current)return;await((A=n.updateEnv)==null?void 0:A.call(n,{clientId:E,clientVersion:mw}));const y=await((w=n.getConfig)==null?void 0:w.call(n)),N=await((M=n.getEnv)==null?void 0:M.call(n));p(y),c(N),s.current=!0,a(!0)},f=()=>{s.current=!1,a(!1)};n.$functions.connect=S,n.$functions.disconnect=f;const h=async()=>{var y;try{await((y=n.connect)==null?void 0:y.call(n)),await S()}catch(N){console.log(N)}},T=async()=>{var y;try{await((y=n.disconnect)==null?void 0:y.call(n)),f()}catch(N){console.log(N)}};return h(),window.addEventListener("beforeunload",T),()=>{window.removeEventListener("beforeunload",T)}},[]),C.jsx(YS.Provider,{value:m,children:e})},ji=()=>O.useContext(YS),fw=({diff:t,values:e,eventId:n})=>{const{getEventFromDexie:i}=yc(),{env:a}=ji();return C.jsxs(C.Fragment,{children:[typeof t=="object"?"keys"in t?C.jsx(_w,{diff:t}):C.jsx(dw,{diff:t,values:e}):"prev"in e&&C.jsx(fs,{values:e}),(a==null?void 0:a.diffMode)==="full"?C.jsx("button",{className:`text-xxs ${pe("h-4 rounded-sm bg-brand/20 px-1.5 text-brand")}`,onClick:s=>{var u;s.stopPropagation(),(u=i==null?void 0:i(n))==null||u.then(c=>{console.log(c)})},children:"Raw"}):null,t===!1&&C.jsx(pw,{})]})},Qc=t=>{const{type:e,prelude:n,name:i,index:a,diffPrelude:s,diff:u,values:c,warn:_=!1,eventId:p,diffIndex:m}=t;return C.jsxs("div",{className:pe("flex flex-wrap items-center gap-1 border-t border-border p-1 first:border-none"),children:[C.jsx("span",{className:`text-xxs ${pe("-ml-3 rounded-sm px-1 py-[3px] font-medium uppercase","border border-border bg-zinc-100 text-zinc-500 dark:bg-zinc-900")}`,children:e}),n,C.jsx("span",{className:"text-zinc-600 dark:text-zinc-200",children:i}),s,C.jsx(fw,{diff:u,values:c,eventId:p})]},a)},Ew=t=>{const{entry:e}=t;return C.jsx(Qc,{type:"prop",name:e.name,diff:e.diff,values:e,...t})},Sw=t=>{const{entry:e,fiberId:n}=t,{fiberById:i}=sn(),a=i.get(n),s=e.context,u=s!=null&&s.providerId?i.get(s.providerId):null;return s!==null&&(a==null||a.typeDef.hooks.filter(c=>c.context===s)),C.jsx(Qc,{type:"context",name:u?C.jsx(Yo,{fiber:u}):(s==null?void 0:s.name)||"UnknownContext",diff:e.diff,values:e,warn:!1,...t})},hw=t=>{var n,i;const{entry:e}=t;return C.jsx(Qc,{type:"state",name:(n=e.hook)==null?void 0:n.name,index:(i=e.hook)==null?void 0:i.index,diff:e.diff,values:e,...t})},Tw=({eventId:t,fiberId:e,changes:n,nextConjunction:i})=>{var s,u,c;if(!n)return C.jsx(C.Fragment,{children:"Unknown changes"});const a=n.warnings;return C.jsx("div",{className:pe("mr-[6px] mt-1 rounded-md border border-border bg-white dark:bg-zinc-900"),children:C.jsxs("div",{children:[(s=n.props)==null?void 0:s.map((_,p)=>C.jsx(Ew,{diffIndex:p,eventId:t,entry:_,warn:a.props.has(_)},p)),(u=n.context)==null?void 0:u.map((_,p)=>C.jsx(Sw,{diffIndex:p,eventId:t,entry:_,fiberId:e},p)),(c=n.state)==null?void 0:c.map((_,p)=>C.jsx(hw,{diffIndex:p,eventId:t,entry:_,warn:a.state.has(_)},p))]})})},bw=({fiberId:t,event:e,changes:n,prevConjunction:i,nextConjunction:a,indirectRootTrigger:s})=>{const[u,c]=O.useState(!1),_=O.useCallback(()=>c(f=>!f),[]),{selected:p}=ns(t),m=e.op==="update"&&e.trigger===void 0,E=tw(e),S=(e.op==="update"||e.op==="update-bailout-scu")&&u&&C.jsx(Tw,{eventId:e.id,fiberId:t,changes:n,nextConjunction:a});return C.jsxs(GS,{op:e.op,selected:p,prevConjunction:i,nextConjunction:a,updateTrigger:m,indirectRootTrigger:s,details:S,children:[C.jsx(cw,{fiberId:t,op:e.op})," ",C.jsx(uw,{event:e,changes:n,expanded:u,toggleExpanded:_}),E==null?void 0:E.map((f,h)=>C.jsx("span",{className:`text-xxs ${pe("rounded-sm border border-solid border-opacity-20 p-[2px]","text-zinc-500",f.bailout?"border-[#c8d7e3]":"border-[#dec6e7] bg-[#f8e6ff] text-[#9366a5]",f.bailout?$o["update-bailout-memo"].fiber:"")}`,children:f.name},h))]})},Es=30,zS=10,VS=O.memo(({rootId:t,events:e})=>{var m,E,S,f;const{commitById:n,fiberById:i}=sn(),a=i.get(t),[s,u]=O.useState(()=>{const h=Math.max(0,e.length-Es);return h<zS?0:h}),c=O.useMemo(()=>new WeakMap,[t]),_=O.useCallback((h,T,y,N)=>{const A=c.get(h);if(A&&A.props.prevConjunction===T&&A.props.nextConjunction===y&&A.props.indirectRootTrigger===N)return A;const{target:w,targetId:M,event:D}=h;let k=null;switch(w){case"commit":k=C.jsx(lw,{commitId:M,event:D,prevConjunction:T,nextConjunction:y},D.id);break;default:k=C.jsx(bw,{fiberId:M,event:D,changes:h.changes,prevConjunction:T,nextConjunction:y,indirectRootTrigger:N},D.id)}return c.set(h,k),k},[t]);if(e===null)return null;if(!e.length)return C.jsx("div",{className:"px-2 py-1 text-xs text-zinc-400",children:"No events found"});const p=[];for(let h=s;h<e.length;h++){const{target:T,targetId:y,event:N,trigger:A}=e[h],w=(E=(m=e[h-1])==null?void 0:m.event)==null?void 0:E.commitId,M=(f=(S=e[h+1])==null?void 0:S.event)==null?void 0:f.commitId;let D=N.commitId!==-1&&N.commitId===w;const k=N.commitId!==-1&&N.commitId===M;if(N.commitId!==w){const Y=n.get(N.commitId);Y&&(p.push(_(Y.start,!1,!0,!1)),D=!0)}T==="fiber"&&y===t&&"trigger"in N&&A!==null&&(p.push(_(A,!0,!0,(a==null?void 0:a.ownerId)!==A.targetId)),D=!0),p.push(_(e[h],D,k,!1))}return C.jsxs(C.Fragment,{children:[s>0&&C.jsxs("div",{className:"mx-[6px] flex gap-[6px]",children:[s>Es+zS&&C.jsxs(Pt,{onClick:()=>u(Math.max(0,s-Es)),size:"sm",variant:"ghost",className:"h-5 flex-1 text-zinc-600 dark:text-zinc-400",style:{fontSize:10},children:["Show ",Math.min(s,Es)," more..."]}),C.jsxs(Pt,{onClick:()=>u(0),size:"sm",variant:"ghost",className:"h-5 flex-1 text-zinc-600 dark:text-zinc-400",style:{fontSize:10},children:["Show all the rest ",s,"..."]})]}),C.jsx("div",{className:"relative pb-1",children:p})]})});VS.displayName="EventList";function Rw(t){const{fiber:e,groupByParent:n,showUnmounted:i,excludeHostType:a,showSubtreeEvents:s}=t,u=tA(e.id,n,i,s),{fiberById:c}=sn(),_=O.useMemo(()=>a?u.filter(p=>{const m=c.get(p.targetId);return m?!Cr(m.type):!0}):u,[u,a,c]);return C.jsx("div",{className:"w-full flex-1 overflow-y-auto overflow-x-hidden",children:C.jsx(VS,{rootId:e.id,events:_},[e.id,n,i,s].join("-"))})}const HS=O.memo(t=>{const{rootId:e,groupByParent:n,showUnmounted:i,excludeHostType:a,showSubtreeEvents:s}=t,u=Qa(e);return u===void 0?C.jsxs("div",{className:"px-2 py-1 text-xs text-zinc-400",children:["Fiber with #",e," is not found"]}):C.jsxs("div",{className:"flex h-full w-full flex-col",children:[C.jsx(Jx,{fiber:u,excludeHostType:a}),C.jsx(Rw,{fiber:u,groupByParent:n,showUnmounted:i,excludeHostType:a,showSubtreeEvents:s})]})});HS.displayName="FiberDetail";const jc=28,qS=4,yr=pe("transition-colors rounded-lg","hover:bg-zinc-500 hover:bg-opacity-10 active:bg-zinc-500 active:bg-opacity-15","dark:hover:bg-zinc-400 dark:hover:bg-opacity-10 dark:active:bg-zinc-400 dark:active:bg-opacity-15"),Cw={top:yr,bottom:yr,left:yr,right:yr,topLeft:yr,topRight:yr,bottomLeft:yr,bottomRight:yr},vw=({value:t,setValue:e,groupByParent:n,showUnmounted:i})=>{const{selectedId:a,select:s}=mi(),{match:u}=rs(),{selectTree:c}=sn(),_=c(n,i),p=E=>{e(E.target.value,!0)},m=E=>{switch(E.code){case"Enter":{let S=null;E.shiftKey?S=_.findBack(f=>{var h;return f.id!==a&&u(((h=f.fiber)==null?void 0:h.displayName)||null)!==null},a):S=_.find(f=>{var h;return f.id!==a&&u(((h=f.fiber)==null?void 0:h.displayName)||null)!==null},a),S&&s(S.id,!1);break}case"Escape":{e("");break}}};return C.jsx(Qi,{className:"w-auto flex-1",placeholder:"Find by display name",value:t,onInput:p,onKeyDown:m})};function yw(t){const[e,n]=O.useState(0);return Tr(()=>t.subscribe(()=>n(i=>i+1)),[t]),e}function Nw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 5v14m6-6l-6 6m-6-6l6 6"})})}function Ow(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 5v14m6-8l-6-6m-6 6l6-6"})})}const Iw=t=>{const{groupByParent:e,showUnmounted:n,excludeHostType:i,autoselect:a,pattern:s,children:u}=t,{selectedId:c,select:_}=mi(),{pinnedId:p}=Ac(),{match:m}=rs(),{selectTree:E}=sn(),S=E(e,n),f=S.getOrCreate(p),h=c!==null&&S.get(c)||null,T=yw(S),[y,N]=O.useState(null),A=O.useMemo(()=>Va(M=>_(M,!1),100,{maxWait:200}),[]);if(O.useEffect(()=>{let M=null,D=0,k=0;f.walk(Y=>{var q;i&&Y.fiber&&Cr(Y.fiber.type)||m(((q=Y.fiber)==null?void 0:q.displayName)||null)!==null&&(k++,Y.id===c&&(D=k),M===null&&(M=Y.id))}),a.current&&k>0&&D===0&&(A(M),D=1),a.current=!1,N({index:D,total:k})},[c,m,S,f,T,s,i]),y===null)return null;const w=y.total===0||y.total===1&&y.index===1;return C.jsxs("div",{className:"flex items-center",children:[C.jsx("div",{className:"px-1 text-xs text-zinc-600 dark:text-zinc-400",children:y.total?`${y.index||"–"} / ${y.total}`:"No matches"}),C.jsxs("div",{children:[C.jsx(Pt,{variant:"ghost",size:"icon",className:"w-6 text-zinc-600 dark:text-zinc-400",disabled:w,onClick:()=>{const M=f===S.root||h!==null&&f.contains(h)?h:null,D=f.findBack(k=>{var Y;return i&&k.fiber&&Cr(k.fiber.type)?!1:k.id!==c&&m(((Y=k.fiber)==null?void 0:Y.displayName)||null)!==null},M);D&&_(D.id,!1)},children:C.jsx(Ow,{})}),C.jsx(Pt,{variant:"ghost",size:"icon",className:"w-6 text-zinc-600 dark:text-zinc-400",disabled:w,onClick:()=>{const M=f===S.root||h!==null&&f.contains(h)?h:null,D=f.find(k=>{var Y;return i&&k.fiber&&Cr(k.fiber.type)?!1:k.id!==c&&m(((Y=k.fiber)==null?void 0:Y.displayName)||null)!==null},M);D&&_(D.id,!1)},children:C.jsx(Nw,{})}),u]})]})},Aw=({groupByParent:t,showUnmounted:e,excludeHostType:n})=>{const i=O.useRef(!1),{setPattern:a}=rs(),[s,u]=O.useState(""),c=O.useCallback((_,p=!1)=>{p&&(i.current=!0),a(_),u(_)},[a,u]);return C.jsxs("div",{className:"flex w-full gap-1",children:[C.jsx(vw,{value:s,setValue:c,groupByParent:t,showUnmounted:e}),s?C.jsx(Iw,{groupByParent:t,showUnmounted:e,excludeHostType:n,autoselect:i,pattern:s,children:C.jsx(Pt,{variant:"ghost",size:"icon",className:"w-6 text-zinc-600 dark:text-zinc-400",onClick:()=>c(""),children:C.jsx(Wc,{})})}):null]})};function xw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 7V6a2 2 0 0 1 2-2h2M4 17v1a2 2 0 0 0 2 2h2m8-16h2a2 2 0 0 1 2 2v1m-4 13h2a2 2 0 0 0 2-2v-1m-8 0l3-8l-8 3l3.5 1.5z"})})}const ww=({excludeHostType:t})=>{const{inspectMode:e,toggleInspect:n,stopInspect:i}=Ic();return O.useEffect(()=>()=>i(),[]),C.jsx(Pt,{variant:"outline",size:"icon",onClick:()=>n(t),className:pe("min-w-7 -scale-x-100 text-base text-zinc-600 dark:text-zinc-400",{"!text-brand":e}),children:C.jsx(xw,{})})};function Dw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14M5 12l6 6m-6-6l6-6"})})}function Mw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14m-6 6l6-6m-6-6l6 6"})})}const Lw=()=>{const{hasPrev:t,hasNext:e,prev:n,next:i}=rA();return C.jsxs("div",{className:"flex",children:[C.jsx(Pt,{variant:"ghost",size:"icon",className:"w-6 text-zinc-600 dark:text-zinc-400",disabled:!t,onClick:t?n:void 0,children:C.jsx(Dw,{})}),C.jsx(Pt,{variant:"ghost",size:"icon",className:"w-6 text-zinc-600 dark:text-zinc-400",disabled:!e,onClick:e?i:void 0,children:C.jsx(Mw,{})})]})},$S=O.memo(({groupByParent:t,showUnmounted:e,excludeHostType:n})=>C.jsxs("div",{className:"m-1 flex w-full gap-1",children:[C.jsx(Lw,{}),C.jsx(Aw,{groupByParent:t,showUnmounted:e,excludeHostType:n}),C.jsx(ww,{excludeHostType:n})]}));$S.displayName="Toolbar";const WS=O.memo(()=>{const{settings:t}=Wi(yt.ComponentTree),{groupByParent:e,showUnmounted:n,excludeHostType:i,showSubtreeEvents:a,treeMode:s}=t,{selectedId:u}=mi(),{pinnedId:c}=Ac();return C.jsx("div",{className:"flex h-full flex-col",children:C.jsxs(pA,{children:[C.jsx("div",{className:"box-content flex h-9 items-center justify-center border-b border-border",children:C.jsx($S,{groupByParent:e,showUnmounted:n,excludeHostType:i})}),C.jsxs("div",{className:"flex h-full w-full flex-1 overflow-hidden",children:[C.jsxs("div",{className:"flex-1",children:[C.jsx(PE,{rootId:c,groupByParent:e}),C.jsx(LE,{rootId:c,groupByParent:e,showUnmounted:n,excludeHostType:i,treeMode:s})]}),u!==null&&C.jsx(WE,{className:"border-l border-border",handleClasses:{left:yr},enable:{left:!0},defaultSize:{width:280},children:C.jsx(HS,{rootId:u,groupByParent:e,showUnmounted:n,excludeHostType:i,showSubtreeEvents:a})})]})]})})});WS.displayName="ComponentTreeView";const Ss=t=>{const{id:e,label:n,...i}=t;return C.jsxs("div",{className:"flex items-center space-x-2",children:[C.jsx(AS,{id:e,...i}),n?C.jsx(Ho,{htmlFor:e,className:"text-secondary-foreground",children:n}):null]})},KS=O.memo(()=>{const{settings:t,update:e}=Wi(yt.ComponentTree);return C.jsxs("div",{className:"flex flex-col gap-2 pb-1",children:[C.jsx("div",{className:"text-base font-medium",children:"Component Tree"}),C.jsx(Ss,{id:"excludeHostType",checked:t.excludeHostType,onCheckedChange:n=>e({...t,excludeHostType:!!n}),label:"Exclude hostType"}),C.jsx(Ss,{id:"groupByParent",checked:t.groupByParent,onCheckedChange:n=>e({...t,groupByParent:!!n}),label:"Group by parent"}),C.jsx(Ss,{id:"showUnmounted",checked:t.showUnmounted,onCheckedChange:n=>e({...t,showUnmounted:!!n}),label:"Show unmounted"}),C.jsx(Ss,{id:"showSubtreeEvents",checked:t.showSubtreeEvents,onCheckedChange:n=>e({...t,showSubtreeEvents:!!n}),label:"Show subtree events"}),C.jsx("div",{children:"Tree Display Mode"}),C.jsxs(Hc,{className:"flex",defaultValue:t.treeMode,onValueChange:n=>e({...t,treeMode:n}),children:[C.jsxs("div",{className:"flex items-center space-x-2",children:[C.jsx(ms,{value:$i.Standard,id:"r1"}),C.jsx(Ho,{htmlFor:"r1",children:"Standard"})]}),C.jsxs("div",{className:"flex items-center space-x-2",children:[C.jsx(ms,{value:$i.ChangesOnly,id:"r2"}),C.jsx(Ho,{htmlFor:"r2",children:"Changes Only"})]})]})]})});KS.displayName="ComponentTreeSettings";const QS=O.memo(()=>{const{settings:t,update:e}=Wi(yt.ModelAnalyze);return C.jsxs("div",{className:"flex w-80 flex-col gap-2 pb-1",children:[C.jsx("div",{className:"text-base font-medium",children:"Analyze Bot"}),C.jsx(Qi,{placeholder:"Bot ID",value:t.botId,onInput:n=>e({...t,botId:n.currentTarget.value})}),C.jsx(Qi,{placeholder:"Token",type:"password",value:t.token,onInput:n=>e({...t,token:n.currentTarget.value})}),C.jsx("div",{className:"text-xs text-muted-foreground",children:"Powered by Coze."})]})});QS.displayName="ModelAnalyzeSettings";const jS=O.memo(()=>{const{rpc:t}=Rr(),{resetPanelSize:e}=vr(),{env:n}=ji(),i=O.useCallback(()=>{var a;(a=t.resetConfig)==null||a.call(t)},[t]);return C.jsxs("div",{className:"flex h-full w-full flex-col items-start gap-3 overflow-auto px-3 py-2",children:[C.jsx(KS,{}),C.jsx(QS,{}),C.jsxs("div",{className:"flex flex-col items-start gap-2 pb-1",children:[C.jsx("div",{className:"text-base font-medium",children:"Global"}),C.jsxs("div",{className:"flex gap-1",children:[C.jsxs(gi,{children:["Diff Mode: ",n==null?void 0:n.diffMode]}),C.jsxs(gi,{children:["Update Trace: ",n!=null&&n.updateTrace?"on":"off"]}),C.jsxs(gi,{children:["Commit Trace: ",n!=null&&n.commitTrace?"on":"off"]})]}),C.jsx(Pt,{onClick:i,variant:"secondary",children:"Reset Local Configs"}),!window.__PERF_MONITOR_DEVTOOLS_CLIENT_SEPARATE__&&C.jsx(Pt,{onClick:e,variant:"secondary",children:"Reset Panel Size"})]})]})});jS.displayName="SettingsView";const XS=O.createContext({}),hs=()=>O.useContext(XS),Pw=t=>{const{children:e}=t,{rpc:n}=Rr(),{isConnected:i}=ji(),[a,s]=O.useState([]),[u,c]=O.useState(),[_,p]=O.useState([]),m=O.useMemo(()=>({selectedRenderer:u,unsupportedRenderers:_,activedRenderers:a,previewRenderer:E=>{var S;return(S=n.highlightRenderer)==null?void 0:S.call(n,E)},hidePreview:()=>{var E;return(E=n.stopHighlight)==null?void 0:E.call(n)}}),[u,_,a]);return O.useEffect(()=>{n.$functions.reactRenderers=E=>{E.renderers.length>0&&c(E.renderers[0]),p(E.unsupportedRenderers)},n.$functions.activedRenderers=s},[]),O.useEffect(()=>{i||(c(void 0),p([]),s([]))},[i]),C.jsx(XS.Provider,{value:m,children:e})};function Wo(t){return C.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 16 16",...t,children:[C.jsx("path",{fill:"currentColor",d:"M4.85 2.372c-.251.145-.515.544-.546 1.416a.75.75 0 0 1-1.499-.053c.038-1.068.376-2.131 1.295-2.662c.922-.532 2.015-.29 2.961.214a.75.75 0 0 1-.706 1.324c-.773-.413-1.253-.384-1.505-.24m4.021 1.3a.75.75 0 0 1 1.056.1a16.5 16.5 0 0 1 1.57 2.268c1.04 1.802 1.681 3.648 1.854 5.196c.086.773.06 1.509-.12 2.14c-.183.635-.537 1.21-1.131 1.553c-.719.415-1.55.357-2.309.08c-.762-.278-1.547-.803-2.295-1.486a.75.75 0 0 1 1.011-1.108c.66.602 1.279.996 1.797 1.184c.522.19.85.145 1.046.031c.164-.095.33-.288.438-.667c.11-.384.145-.91.072-1.56c-.145-1.299-.7-2.947-1.663-4.613A15 15 0 0 0 8.772 4.73a.75.75 0 0 1 .1-1.056"}),C.jsx("path",{fill:"currentColor",d:"M14.5 8.206c0-.29-.214-.719-.953-1.18a.75.75 0 0 1 .795-1.273C15.248 6.32 16 7.144 16 8.206c0 1.064-.756 1.89-1.666 2.457a.75.75 0 0 1-.793-1.273c.744-.464.959-.894.959-1.184m-3.137 2.832a.75.75 0 0 1-.614.865A16.6 16.6 0 0 1 8 12.127c-2.08 0-4-.367-5.427-.992c-.713-.311-1.336-.702-1.792-1.174C.32 9.487 0 8.891 0 8.206c0-.83.466-1.52 1.085-2.04c.622-.521 1.47-.938 2.435-1.244a.75.75 0 0 1 .454 1.43c-.85.27-1.502.609-1.924.964c-.426.356-.55.663-.55.89c0 .19.085.43.359.713c.278.287.716.58 1.315.842c1.197.524 2.902.866 4.826.866c.885 0 1.727-.072 2.498-.203a.75.75 0 0 1 .865.614"}),C.jsx("path",{fill:"currentColor",d:"M4.872 13.63c.25.145.729.174 1.499-.235a.75.75 0 1 1 .704 1.325c-.944.501-2.034.74-2.953.21c-.922-.533-1.26-1.6-1.295-2.672a.75.75 0 0 1 1.499-.05c.03.875.294 1.277.546 1.422m-.884-4.133a.75.75 0 0 1-.442-.964c.302-.815.697-1.657 1.18-2.493c1.04-1.802 2.318-3.28 3.572-4.204c.626-.461 1.276-.806 1.913-.965c.641-.16 1.317-.141 1.91.202c.72.415 1.084 1.163 1.224 1.96c.141.799.078 1.741-.14 2.73a.75.75 0 1 1-1.464-.321c.191-.872.223-1.606.127-2.15c-.096-.546-.3-.807-.496-.92c-.164-.095-.415-.142-.797-.046c-.388.097-.86.33-1.387.718c-1.052.774-2.202 2.08-3.163 3.746a15 15 0 0 0-1.073 2.265a.75.75 0 0 1-.964.442"}),C.jsx("path",{fill:"currentColor",d:"M9.46 8.066a1.36 1.36 0 1 1-2.72 0a1.36 1.36 0 0 1 2.72 0"})]})}function kw(t){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",...t,children:C.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 6a3 3 0 1 0 6 0a3 3 0 0 0-6 0m18 5V8a2 2 0 0 0-2-2h-6l3 3m0-6l-3 3M3 13v3a2 2 0 0 0 2 2h6l-3-3m0 6l3-3m4 0a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})})}const Fw=(t,e=2)=>{if(typeof t>"u")return"-";if(t===0)return"0 Bytes";const n=1024,i=e<0?0:e,a=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],s=Math.floor(Math.log(t)/Math.log(n)),u=a[s];return`${parseFloat((t/Math.pow(n,s)).toFixed(i))} ${u}`},ZS=t=>{const{icon:e,text:n,...i}=t;return C.jsxs("div",{...i,className:pe("flex min-w-48 flex-1 flex-col items-center justify-center gap-2 rounded-md border border-border p-4","text-zinc-500 transition-colors hover:border-brand hover:border-opacity-10 hover:bg-brand hover:bg-opacity-10 hover:text-brand",i.className),children:[e?C.jsx("div",{className:"text-3xl",children:e}):null,n?C.jsx("div",{className:"flex flex-col items-center justify-center",children:n.filter(Boolean).map((a,s)=>C.jsx("div",{children:a},s))}):null]})},Xi=({children:t,className:e,...n})=>C.jsx("kbd",{className:pe("pointer-events-none inline select-none items-center rounded border border-border bg-muted px-1.5 py-[2px] font-mono text-xs font-medium text-muted-foreground"),...n,children:t}),Uw=()=>C.jsxs("div",{className:"flex w-full flex-col items-center justify-center gap-3 text-zinc-500 dark:text-zinc-400",children:[C.jsxs("div",{children:[C.jsx("span",{children:"Press "}),C.jsxs(Xi,{children:["Shift(",C.jsx("span",{className:"font-serif",children:"⇧"}),")"]}),C.jsx("span",{children:" + "}),C.jsxs(Xi,{children:["Alt(",C.jsx("span",{className:"font-serif",children:"⌥"}),")"]}),C.jsx("span",{children:" + "}),C.jsx(Xi,{children:"D"}),C.jsx("span",{children:" to toggle DevTools"})]}),C.jsxs("div",{children:[C.jsx("span",{children:"Press "}),C.jsxs(Xi,{children:["Shift(",C.jsx("span",{className:"font-serif",children:"⇧"}),")"]}),C.jsx("span",{children:" + "}),C.jsxs(Xi,{children:["Alt(",C.jsx("span",{className:"font-serif",children:"⌥"}),")"]}),C.jsx("span",{children:" + "}),C.jsx(Xi,{children:"X"}),C.jsx("span",{children:" to inspect"})]})]}),JS=O.memo(()=>{const{preset:t}=Rr(),{env:e}=ji(),{selectedRenderer:n}=hs(),{bytesReceived:i,events:a}=yc();return C.jsxs("div",{className:"flex h-full w-full flex-col items-start gap-8 overflow-auto px-5 py-8",children:[C.jsxs("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[C.jsxs("div",{className:"flex items-end gap-2",children:[C.jsx(Wo,{className:"h-12 w-12 text-brand"}),C.jsxs("span",{className:"text-4xl font-semibold",children:["perf-monitor ",C.jsx("span",{className:"text-brand",children:"DevTools"})]})]}),C.jsx("div",{className:"text-center text-sm text-zinc-400 dark:text-zinc-500",children:C.jsxs("div",{className:"flex justify-center gap-1",children:[C.jsx("span",{children:"Core"}),C.jsx("code",{children:`v${e==null?void 0:e.coreVersion}`}),C.jsx("span",{children:"Client"}),C.jsx("code",{children:`v${e==null?void 0:e.clientVersion}`})]})})]}),C.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[C.jsx(ZS,{icon:C.jsx(Wo,{className:"p-[2px]"}),text:[`react-dom@${n==null?void 0:n.version}`,n==null?void 0:n.bundleType]}),C.jsx(ZS,{icon:C.jsx(kw,{}),text:[`${a.length} events received`,`${Fw(i)} (${t})`]})]}),C.jsx(Uw,{})]})});JS.displayName="OverviewView";/**
55
55
  * table-core
56
56
  *
57
57
  * Copyright (c) TanStack
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zk-tech/rrt-app",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "private": false,
5
5
  "main": "./dist/shadow-dom.js",
6
6
  "module": "./dist/shadow-dom.js",
@@ -49,8 +49,8 @@
49
49
  "dist"
50
50
  ],
51
51
  "dependencies": {
52
- "@zk-tech/rrt-bridge": "0.0.3",
53
- "@zk-tech/rrt-shared": "0.0.3"
52
+ "@zk-tech/rrt-bridge": "0.0.4",
53
+ "@zk-tech/rrt-shared": "0.0.4"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "vite build",