memctx 1.4.6 → 1.4.8
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.
- package/dashboard/dist/assets/{index-DERuxx9d.js → index-Bds5rrwq.js} +3 -3
- package/dashboard/dist/assets/{index.es-mDMtFUah.js → index.es-N8C_lFOW.js} +1 -1
- package/dashboard/dist/assets/{jszip.min-DeeXtAUg.js → jszip.min-DO22A2s2.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dist/src/api/logs.js +1 -1
- package/dist/src/api/logs.js.map +1 -1
- package/dist/src/services/summarizer.js +28 -9
- package/dist/src/services/summarizer.js.map +1 -1
- package/package.json +1 -1
|
@@ -449,7 +449,7 @@ Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}
|
|
|
449
449
|
0%, 100% { opacity: 1; transform: scale(1); }
|
|
450
450
|
50% { opacity: 0.5; transform: scale(0.8); }
|
|
451
451
|
}
|
|
452
|
-
`})]})}function sae({checked:r,onChange:e,disabled:t}){return b.jsx("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),t||e(!r)},disabled:t,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:0,background:"transparent",color:r?"var(--accent)":"var(--text-muted)",border:"none",cursor:t?"not-allowed":"pointer",transition:"color 0.15s"},onMouseEnter:n=>{t||(n.currentTarget.style.color="var(--accent)")},onMouseLeave:n=>{t||(n.currentTarget.style.color=r?"var(--accent)":"var(--text-muted)")},children:r?b.jsx(y1,{size:18}):b.jsx(iY,{size:18})})}const oae={productive:pne,frustrated:jre,exploratory:HO,debugging:wo,blocked:Ef},lae={trivial:"var(--green)",simple:"var(--green)",moderate:"var(--yellow)",complex:"var(--orange)",very_complex:"var(--red)"};function uae({session:r,onSessionUpdated:e,selectionMode:t,selected:n,onSelectionChange:i}){const[a,o]=he.useState(!1),[u,c]=he.useState(!1),[h,f]=he.useState(!1),[v,y]=he.useState(!1),[g,_]=he.useState(!1),[E,R]=he.useState(!1),[T,k]=he.useState(!1),N=new Date(r.started_at*1e3),A=r.duration_seconds?Math.floor(r.duration_seconds/60):r.ended_at?Math.floor((r.ended_at-r.started_at)/60):null,j=Array.isArray(r.summary_files_changed)?r.summary_files_changed:[],W=r.summary_mood?oae[r.summary_mood]:null,G=r.summary_complexity?lae[r.summary_complexity]:"var(--text-muted)",D=r.status==="active"||!r.status||r.summary_status&&r.summary_status.toLowerCase()==="in_progress",P=!!r.summary_title,U=async J=>{J.preventDefault(),J.stopPropagation(),f(!0);try{await Tr.toggleBookmark(r.id,!r.is_bookmarked),e&&e()}catch(le){at.error("Failed to update bookmark: "+le)}finally{f(!1)}},M=async J=>{J.preventDefault(),J.stopPropagation(),k(!0)},q=async()=>{k(!1),o(!0);const J=at.loading("Ending session...");try{await Tr.forceEndSession(r.id),at.dismiss(J),at.success("Session ended successfully"),e&&setTimeout(()=>e(),1e3)}catch(le){at.dismiss(J),at.error("Failed to end session: "+le)}finally{o(!1)}},B=async J=>{J.preventDefault(),J.stopPropagation(),R(!0)},Y=async J=>{J.preventDefault(),J.stopPropagation(),y(!0);try{await Tr.toggleArchive(r.id,!r.is_archived),at.success(r.is_archived?"Session unarchived":"Session archived"),e&&e()}catch(le){at.error("Failed to update archive status: "+le)}finally{y(!1)}},ue=async J=>{J.preventDefault(),J.stopPropagation(),_(!0);const le=at.loading(P?"Resyncing summary...":"Syncing summary...");try{P?await Tr.resyncSession(r.id):await Tr.syncSession(r.id),at.dismiss(le),at.success("Session queued for summarization"),e&&setTimeout(()=>e(),2e3)}catch(ye){at.dismiss(le),at.error("Failed to sync: "+ye)}finally{_(!1)}},re=async()=>{R(!1),c(!0);const J=at.loading("Deleting session...");try{await Tr.deleteSession(r.id),at.dismiss(J),at.success("Session deleted successfully"),e&&setTimeout(()=>e(),500)}catch(le){at.dismiss(J),at.error("Failed to delete session: "+le)}finally{c(!1)}};return b.jsxs(b.Fragment,{children:[b.jsx(dl,{to:`/session/${r.id}`,style:{display:"block"},children:b.jsx("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 16px",marginBottom:8,cursor:"pointer",transition:"border-color 0.15s, background 0.15s"},onMouseEnter:J=>{J.currentTarget.style.borderColor="var(--accent)",J.currentTarget.style.background="var(--surface2)"},onMouseLeave:J=>{J.currentTarget.style.borderColor="var(--border)",J.currentTarget.style.background="var(--surface)"},children:b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8},children:[t&&b.jsx("div",{style:{paddingTop:2,marginRight:8},children:b.jsx(sae,{checked:n||!1,onChange:J=>i?.(J)})}),b.jsxs("div",{style:{flex:1,minWidth:0},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[b.jsx("div",{style:{fontWeight:600,fontSize:14,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:r.summary_title||"Session "+r.id.slice(0,8)}),W&&b.jsx(W,{size:14,style:{color:"var(--text-muted)",flexShrink:0}})]}),r.summary_what_we_did&&Array.isArray(r.summary_what_we_did)&&b.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginBottom:8},children:r.summary_what_we_did[0]}),r.summary_key_insight&&b.jsxs("div",{style:{fontSize:11,color:"var(--accent)",marginBottom:8,display:"flex",alignItems:"center",gap:4},children:[b.jsx(Tf,{size:11}),r.summary_key_insight]}),(r.metric_momentum!==void 0||r.metric_frustration!==void 0||r.next_session_starting_point||r.aha_moments_count)&&b.jsxs("div",{style:{display:"flex",gap:8,marginBottom:8,fontSize:10,flexWrap:"wrap"},children:[r.next_session_starting_point&&b.jsxs("span",{style:{padding:"2px 6px",borderRadius:4,background:"var(--yellow)20",color:"var(--yellow)",border:"1px solid var(--yellow)30",display:"flex",alignItems:"center",gap:3},children:["⏭️ Start: ",r.next_session_starting_point]}),r.aha_moments_count>0&&b.jsxs("span",{style:{padding:"2px 6px",borderRadius:4,background:"var(--accent)20",color:"var(--accent)",border:"1px solid var(--accent)30",display:"flex",alignItems:"center",gap:3},children:["💡 Aha! x",r.aha_moments_count]}),r.unresolved_tech_debt&&r.unresolved_tech_debt!=="null"&&b.jsx("span",{style:{padding:"2px 6px",borderRadius:4,background:"var(--orange)20",color:"var(--orange)",border:"1px solid var(--orange)30",display:"flex",alignItems:"center",gap:3},children:"🚧 Tech Debt"}),r.metric_momentum!=null&&b.jsxs("span",{style:{padding:"2px 6px",borderRadius:4,background:r.metric_momentum>70?"var(--green)20":"var(--blue)15",color:r.metric_momentum>70?"var(--green)":"var(--blue)",border:"1px solid",borderColor:r.metric_momentum>70?"var(--green)30":"var(--blue)30",display:"flex",alignItems:"center",gap:3},children:["⚡ Momentum: ",r.metric_momentum]}),r.metric_frustration!=null&&r.metric_frustration>0&&b.jsxs("span",{style:{padding:"2px 6px",borderRadius:4,background:r.metric_frustration>50?"var(--red)20":"var(--orange)15",color:r.metric_frustration>50?"var(--red)":"var(--orange)",border:"1px solid",borderColor:r.metric_frustration>50?"var(--red)30":"var(--orange)30",display:"flex",alignItems:"center",gap:3},children:["🔴 Frustration: ",r.metric_frustration]}),r.metric_productivity!=null&&b.jsxs("span",{style:{padding:"2px 6px",borderRadius:4,background:"var(--accent)20",color:"var(--accent)",border:"1px solid var(--accent)30",display:"flex",alignItems:"center",gap:3},children:["🎯 Productivity: ",r.metric_productivity]}),r.emotional_context&&b.jsxs("span",{style:{padding:"2px 6px",borderRadius:4,background:"var(--surface)",color:"var(--text-muted)",border:"1px solid var(--border)",display:"flex",alignItems:"center",gap:3,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:r.emotional_context,children:["💬 ",r.emotional_context]})]}),b.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",flexWrap:"wrap"},children:[b.jsxs("span",{style:{fontSize:11,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:4},children:[b.jsx(fl,{size:11}),fY(N,{addSuffix:!0})]}),A!==null&&b.jsxs("span",{style:{fontSize:11,color:"var(--text-muted)"},children:[A,"m"]}),r.summary_complexity&&b.jsx("span",{style:{fontSize:10,color:G,padding:"2px 6px",background:`${G}15`,borderRadius:4,fontWeight:600},children:r.summary_complexity.replace("_"," ")}),r.total_tool_calls>0&&b.jsxs("span",{style:{fontSize:11,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:4},children:[b.jsx(wo,{size:11}),r.total_tool_calls," calls"]}),j.length>0&&b.jsxs("span",{style:{fontSize:11,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:4},children:[b.jsx(Ms,{size:11}),j.length," files"]})]})]}),b.jsxs("div",{style:{flexShrink:0,display:"flex",alignItems:"center",gap:8},children:[b.jsx("button",{onClick:U,disabled:h,title:r.is_bookmarked?"Remove bookmark":"Bookmark session",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px",background:"transparent",color:r.is_bookmarked?"var(--yellow)":"var(--text-muted)",border:"1px solid var(--border)",borderRadius:6,cursor:h?"not-allowed":"pointer",transition:"all 0.15s"},onMouseEnter:J=>{h||(J.currentTarget.style.background="var(--yellow)15",J.currentTarget.style.color="var(--yellow)",J.currentTarget.style.borderColor="var(--yellow)30")},onMouseLeave:J=>{h||(J.currentTarget.style.background="transparent",J.currentTarget.style.color=r.is_bookmarked?"var(--yellow)":"var(--text-muted)",J.currentTarget.style.borderColor="var(--border)")},children:b.jsx(aY,{size:14,fill:r.is_bookmarked?"var(--yellow)":"none"})}),b.jsx("button",{onClick:Y,disabled:v,title:r.is_archived?"Unarchive session":"Archive session",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px",background:"transparent",color:r.is_archived?"var(--blue)":"var(--text-muted)",border:"1px solid var(--border)",borderRadius:6,cursor:v?"not-allowed":"pointer",transition:"all 0.15s"},onMouseEnter:J=>{v||(J.currentTarget.style.background="var(--blue)15",J.currentTarget.style.color="var(--blue)",J.currentTarget.style.borderColor="var(--blue)30")},onMouseLeave:J=>{v||(J.currentTarget.style.background="transparent",J.currentTarget.style.color=r.is_archived?"var(--blue)":"var(--text-muted)",J.currentTarget.style.borderColor="var(--border)")},children:r.is_archived?b.jsx(Ute,{size:14}):b.jsx(Wte,{size:14})}),D&&b.jsxs("button",{onClick:M,disabled:a,style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",background:a?"var(--surface)":"var(--green)15",color:a?"var(--text-muted)":"var(--green)",border:"1px solid",borderColor:a?"var(--border)":"var(--green)30",borderRadius:6,fontSize:11,fontWeight:600,cursor:a?"not-allowed":"pointer",transition:"all 0.15s"},onMouseEnter:J=>{a||(J.currentTarget.style.background="var(--green)25")},onMouseLeave:J=>{a||(J.currentTarget.style.background="var(--green)15")},children:[b.jsx(Pc,{size:12}),a?"Ending...":"Force End"]}),b.jsxs("button",{onClick:ue,disabled:g,title:P?"Resync summary":r.transcript_path?"Sync summary":"Sync from observations",style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",background:g?"var(--surface)":!P&&!r.transcript_path?"var(--orange)15":"var(--blue)15",color:g?"var(--text-muted)":!P&&!r.transcript_path?"var(--orange)":"var(--blue)",border:"1px solid",borderColor:g?"var(--border)":!P&&!r.transcript_path?"var(--orange)30":"var(--blue)30",borderRadius:6,fontSize:11,fontWeight:600,cursor:g?"not-allowed":"pointer",transition:"all 0.15s"},onMouseEnter:J=>{if(!g){const le=!P&&!r.transcript_path?"var(--orange)25":"var(--blue)25";J.currentTarget.style.background=le}},onMouseLeave:J=>{if(!g){const le=!P&&!r.transcript_path?"var(--orange)15":"var(--blue)15";J.currentTarget.style.background=le}},children:[b.jsx(Sc,{size:12}),g?"Syncing...":P?"Resync":"Sync"]}),b.jsx("button",{onClick:B,disabled:u,title:"Delete session",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px",background:u?"var(--surface)":"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:6,cursor:u?"not-allowed":"pointer",transition:"all 0.15s"},onMouseEnter:J=>{u||(J.currentTarget.style.background="var(--red)15",J.currentTarget.style.color="var(--red)",J.currentTarget.style.borderColor="var(--red)30")},onMouseLeave:J=>{u||(J.currentTarget.style.background="transparent",J.currentTarget.style.color="var(--text-muted)",J.currentTarget.style.borderColor="var(--border)")},children:b.jsx(oY,{size:14})}),b.jsx(pY,{status:r.summary_status||r.status})]})]})})}),b.jsx(w1,{isOpen:T,title:"Force End Session",message:"This will mark the session as completed and trigger AI summarization. The session will be processed and added to your project history.",confirmText:"Force End",cancelText:"Cancel",confirmColor:"var(--green)",onConfirm:q,onCancel:()=>k(!1)}),b.jsx(w1,{isOpen:E,title:"Delete Session",message:"This will permanently remove the session and all its data including observations, preferences, knowledge, and tasks. This action cannot be undone.",confirmText:"Delete",cancelText:"Cancel",confirmColor:"var(--red)",onConfirm:re,onCancel:()=>R(!1)})]})}function cae({selectedCount:r,onBulkDelete:e,onBulkBookmark:t,onBulkTag:n,onBulkExport:i,onClearSelection:a}){return r===0?null:b.jsxs("div",{style:{position:"fixed",bottom:24,left:"50%",transform:"translateX(-50%)",background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:"12px 20px",display:"flex",alignItems:"center",gap:16,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",zIndex:1e3},children:[b.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--text)"},children:[r," selected"]}),b.jsxs("div",{style:{display:"flex",gap:8},children:[b.jsxs("button",{onClick:t,title:"Bookmark selected",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:"var(--yellow)15",color:"var(--yellow)",border:"1px solid var(--yellow)30",borderRadius:8,fontSize:12,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:o=>o.currentTarget.style.background="var(--yellow)25",onMouseLeave:o=>o.currentTarget.style.background="var(--yellow)15",children:[b.jsx(aY,{size:14}),"Bookmark"]}),b.jsxs("button",{onClick:n,title:"Tag selected",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:"var(--accent)15",color:"var(--accent)",border:"1px solid var(--accent)30",borderRadius:8,fontSize:12,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:o=>o.currentTarget.style.background="var(--accent)25",onMouseLeave:o=>o.currentTarget.style.background="var(--accent)15",children:[b.jsx(sY,{size:14}),"Tag"]}),b.jsxs("button",{onClick:i,title:"Export as ZIP",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:"var(--blue)15",color:"var(--blue)",border:"1px solid var(--blue)30",borderRadius:8,fontSize:12,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:o=>o.currentTarget.style.background="var(--blue)25",onMouseLeave:o=>o.currentTarget.style.background="var(--blue)15",children:[b.jsx(F1,{size:14}),"Export ZIP"]}),b.jsxs("button",{onClick:e,title:"Delete selected",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:"var(--red)15",color:"var(--red)",border:"1px solid var(--red)30",borderRadius:8,fontSize:12,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:o=>o.currentTarget.style.background="var(--red)25",onMouseLeave:o=>o.currentTarget.style.background="var(--red)15",children:[b.jsx(oY,{size:14}),"Delete"]})]}),b.jsx("button",{onClick:a,title:"Clear selection",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px",background:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:o=>{o.currentTarget.style.background="var(--surface2)",o.currentTarget.style.color="var(--text)"},onMouseLeave:o=>{o.currentTarget.style.background="transparent",o.currentTarget.style.color="var(--text-muted)"},children:b.jsx(ds,{size:16})})]})}const Pk=["#7c6cfc","#3b82f6","#22c55e","#eab308","#f97316","#ef4444","#ec4899","#8b5cf6"];function vY({sessionId:r,projectId:e,sessionTags:t,onUpdate:n}){const[i,a]=he.useState(!1),[o,u]=he.useState(""),[c,h]=he.useState(!1),[f,v]=he.useState(Pk[0]),y=he.useRef(null),g=Xv(),{data:_=[]}=ia({queryKey:["tags",e],queryFn:()=>Tr.getTags(e),enabled:!!e}),E=yv({mutationFn:({tagId:j})=>Tr.addSessionTag(r,j),onSuccess:()=>{g.invalidateQueries({queryKey:["session",r]}),n&&n(),u("")},onError:j=>at.error("Failed to add tag: "+j)}),R=yv({mutationFn:({tagId:j})=>Tr.removeSessionTag(r,j),onSuccess:()=>{g.invalidateQueries({queryKey:["session",r]}),n&&n()},onError:j=>at.error("Failed to remove tag: "+j)}),T=yv({mutationFn:({name:j,color:W})=>Tr.createTag(e,j,W),onSuccess:j=>{g.invalidateQueries({queryKey:["tags",e]}),E.mutate({tagId:j.id}),u(""),h(!1)},onError:j=>at.error("Failed to create tag: "+j)}),k=_.filter(j=>j.name.toLowerCase().includes(o.toLowerCase())&&!t.some(W=>W.id===j.id)),N=()=>{o.trim()&&T.mutate({name:o.trim(),color:f})},A=_.find(j=>j.name.toLowerCase()===o.toLowerCase());return he.useEffect(()=>{i&&y.current&&y.current.focus()},[i]),b.jsxs("div",{style:{position:"relative"},children:[b.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6,alignItems:"center"},children:[t.map(j=>b.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",background:j.color?`${j.color}15`:"var(--surface2)",border:"1px solid",borderColor:j.color?`${j.color}30`:"var(--border)",borderRadius:6,fontSize:12,color:j.color||"var(--text)"},children:[b.jsx(sY,{size:11}),j.name,b.jsx("button",{onClick:()=>R.mutate({tagId:j.id}),style:{background:"none",border:"none",cursor:"pointer",padding:0,display:"flex",color:"inherit",opacity:.6},children:b.jsx(ds,{size:12})})]},j.id)),b.jsxs("button",{onClick:()=>a(!i),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:6,fontSize:12,color:"var(--text-muted)",cursor:"pointer"},children:[b.jsx(Ek,{size:12}),"Add tag"]})]}),i&&b.jsxs("div",{style:{position:"absolute",top:"100%",left:0,marginTop:8,background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:12,minWidth:280,maxWidth:400,zIndex:100,boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:[b.jsx("input",{ref:y,type:"text",value:o,onChange:j=>u(j.target.value),placeholder:"Search or create tag...",style:{width:"100%",padding:"8px 10px",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:6,fontSize:13,color:"var(--text)",marginBottom:8},onKeyDown:j=>{j.key==="Enter"&&o&&!A&&N(),j.key==="Escape"&&a(!1)}}),b.jsx("div",{style:{maxHeight:200,overflowY:"auto"},children:k.length>0?k.map(j=>b.jsxs("button",{onClick:()=>E.mutate({tagId:j.id}),style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"8px 10px",background:"transparent",border:"none",borderRadius:6,fontSize:13,color:"var(--text)",cursor:"pointer",textAlign:"left"},onMouseEnter:W=>W.currentTarget.style.background="var(--surface2)",onMouseLeave:W=>W.currentTarget.style.background="transparent",children:[b.jsx("div",{style:{width:12,height:12,borderRadius:3,background:j.color||"var(--border)"}}),j.name]},j.id)):o&&!A?b.jsxs("div",{children:[b.jsxs("button",{onClick:()=>h(!c),style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"8px 10px",background:"var(--accent)15",border:"1px solid var(--accent)30",borderRadius:6,fontSize:13,color:"var(--accent)",cursor:"pointer",marginBottom:c?8:0},children:[b.jsx(Ek,{size:14}),'Create "',o,'"']}),c&&b.jsxs("div",{style:{padding:"8px 0"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:6},children:"Choose color:"}),b.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:Pk.map(j=>b.jsx("button",{onClick:()=>{v(j),N()},style:{width:24,height:24,borderRadius:4,background:j,border:f===j?"2px solid var(--text)":"none",cursor:"pointer"}},j))})]})]}):b.jsx("div",{style:{padding:"8px 10px",fontSize:12,color:"var(--text-muted)"},children:o?"No matching tags":"Start typing to search or create"})})]})]})}function dae({isOpen:r,sessionIds:e,onClose:t,onComplete:n}){const[i,a]=he.useState([]),[o,u]=he.useState(!1);if(!r)return null;const c=async()=>{if(i.length===0){at.error("Please select at least one tag");return}u(!0);const h=at.loading(`Tagging ${e.length} sessions...`);try{await Promise.all(e.map(f=>Promise.all(i.map(v=>fetch(`/api/sessions/${f}/tags`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag_id:v.id})}))))),at.dismiss(h),at.success(`Tagged ${e.length} sessions`),n(),t()}catch(f){at.dismiss(h),at.error("Failed to tag sessions: "+f)}finally{u(!1)}};return b.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2e3},children:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:24,width:"90%",maxWidth:500},children:[b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[b.jsxs("h3",{style:{fontSize:18,fontWeight:700,color:"var(--text)"},children:["Tag ",e.length," Sessions"]}),b.jsx("button",{onClick:t,style:{background:"transparent",border:"none",color:"var(--text-muted)",cursor:"pointer",padding:4},children:b.jsx(ds,{size:20})})]}),b.jsxs("div",{style:{marginBottom:20},children:[b.jsx("label",{style:{display:"block",fontSize:13,fontWeight:600,color:"var(--text)",marginBottom:8},children:"Select Tags"}),b.jsx(vY,{selectedTags:i,onChange:a})]}),b.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[b.jsx("button",{onClick:t,disabled:o,style:{padding:"8px 16px",background:"var(--surface2)",color:"var(--text)",border:"1px solid var(--border)",borderRadius:8,fontSize:13,fontWeight:600,cursor:o?"not-allowed":"pointer"},children:"Cancel"}),b.jsx("button",{onClick:c,disabled:o||i.length===0,style:{padding:"8px 16px",background:o||i.length===0?"var(--surface2)":"var(--accent)",color:o||i.length===0?"var(--text-muted)":"white",border:"none",borderRadius:8,fontSize:13,fontWeight:600,cursor:o||i.length===0?"not-allowed":"pointer"},children:o?"Tagging...":"Apply Tags"})]})]})})}function hae({projectId:r}){const{data:e}=ia({queryKey:["sessions",r],queryFn:async()=>{const h=await fetch(`/api/sessions?project_id=${r}&limit=100`);if(!h.ok)throw new Error("Failed to fetch sessions");return h.json()}}),t=WO(new Date).getTime()/1e3,n=(e||[]).filter(h=>h.started_at>=t),i=n.reduce((h,f)=>h+(f.total_tool_calls||0),0),a=new Set(n.flatMap(h=>{try{const f=h.summary_files_changed;return Array.isArray(f)?f:typeof f=="string"?JSON.parse(f):[]}catch{return[]}})).size,o=n.reduce((h,f)=>{const v=f.duration_seconds?Math.floor(f.duration_seconds/60):f.ended_at?Math.floor((f.ended_at-f.started_at)/60):0;return h+v},0),u=Math.floor(o/60),c=o%60;return b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20,marginBottom:24},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:16},children:[b.jsx(m1,{size:18,style:{color:"var(--accent)"}}),b.jsx("h3",{style:{fontSize:16,fontWeight:700,color:"var(--text)"},children:"Today's Productivity"})]}),b.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:16},children:[b.jsxs("div",{style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,padding:16},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[b.jsx(m1,{size:14,style:{color:"var(--accent)"}}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",fontWeight:600,textTransform:"uppercase"},children:"Sessions"})]}),b.jsx("div",{style:{fontSize:24,fontWeight:700,color:"var(--accent)"},children:n.length})]}),b.jsxs("div",{style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,padding:16},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[b.jsx(wo,{size:14,style:{color:"var(--blue)"}}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",fontWeight:600,textTransform:"uppercase"},children:"Tool Calls"})]}),b.jsx("div",{style:{fontSize:24,fontWeight:700,color:"var(--blue)"},children:i})]}),b.jsxs("div",{style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,padding:16},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[b.jsx(Ms,{size:14,style:{color:"var(--green)"}}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",fontWeight:600,textTransform:"uppercase"},children:"Files Touched"})]}),b.jsx("div",{style:{fontSize:24,fontWeight:700,color:"var(--green)"},children:a})]}),b.jsxs("div",{style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,padding:16},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[b.jsx(fl,{size:14,style:{color:"var(--orange)"}}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",fontWeight:600,textTransform:"uppercase"},children:"Time Spent"})]}),b.jsx("div",{style:{fontSize:24,fontWeight:700,color:"var(--orange)"},children:u>0?`${u}h ${c}m`:`${c}m`})]})]})]})}function gY({onSearch:r,placeholder:e="Search sessions...",autoFocus:t}){const[n,i]=he.useState(""),a=he.useRef(),o=c=>{const h=c.target.value;i(h),clearTimeout(a.current),h.length>=2?a.current=setTimeout(()=>r(h),300):h.length===0&&r("")},u=()=>{i(""),r("")};return b.jsxs("div",{style:{position:"relative",width:"100%",maxWidth:400},children:[b.jsx(L6,{size:16,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",color:"var(--text-muted)",pointerEvents:"none"}}),b.jsx("input",{type:"text",value:n,onChange:o,placeholder:e,autoFocus:t,style:{width:"100%",padding:"8px 36px 8px 36px",background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,color:"var(--text)",fontSize:13,fontWeight:500,outline:"none",transition:"all 0.15s"},onFocus:c=>{c.target.style.borderColor="var(--accent)",c.target.style.background="var(--surface)"},onBlur:c=>{c.target.style.borderColor="var(--border)",c.target.style.background="var(--surface2)"}}),n&&b.jsx("button",{onClick:u,style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",justifyContent:"center",padding:4,background:"transparent",color:"var(--text-muted)",border:"none",borderRadius:4,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:c=>{c.currentTarget.style.background="var(--surface)",c.currentTarget.style.color="var(--text)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent",c.currentTarget.style.color="var(--text-muted)"},children:b.jsx(ds,{size:14})})]})}function fae({onDateRangeChange:r}){const[e,t]=he.useState(""),[n,i]=he.useState(""),a=h=>{t(h),h&&n?r(new Date(h),new Date(n)):!h&&!n&&r(null,null)},o=h=>{i(h),e&&h?r(new Date(e),new Date(h)):!e&&!h&&r(null,null)},u=()=>{t(""),i(""),r(null,null)},c=e||n;return b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,padding:"6px 10px",maxWidth:400},children:[b.jsx(m1,{size:16,style:{color:"var(--text-muted)",flexShrink:0}}),b.jsx("input",{type:"date",value:e,onChange:h=>a(h.target.value),placeholder:"Start date",style:{flex:1,background:"transparent",border:"none",color:"var(--text)",fontSize:13,fontWeight:500,outline:"none"}}),b.jsx("span",{style:{color:"var(--text-muted)",fontSize:13},children:"to"}),b.jsx("input",{type:"date",value:n,onChange:h=>o(h.target.value),placeholder:"End date",style:{flex:1,background:"transparent",border:"none",color:"var(--text)",fontSize:13,fontWeight:500,outline:"none"}}),c&&b.jsx("button",{onClick:u,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:4,background:"transparent",color:"var(--text-muted)",border:"none",borderRadius:4,cursor:"pointer",transition:"all 0.15s",flexShrink:0},onMouseEnter:h=>{h.currentTarget.style.background="var(--surface)",h.currentTarget.style.color="var(--text)"},onMouseLeave:h=>{h.currentTarget.style.background="transparent",h.currentTarget.style.color="var(--text-muted)"},children:b.jsx(ds,{size:14})})]})}function pae({viewMode:r,onToggle:e}){return b.jsxs("div",{style:{display:"flex",gap:4,background:"var(--surface2)",padding:4,borderRadius:8,border:"1px solid var(--border)"},children:[b.jsxs("button",{onClick:()=>e("card"),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:r==="card"?"var(--surface)":"transparent",color:r==="card"?"var(--text)":"var(--text-muted)",border:r==="card"?"1px solid var(--border)":"1px solid transparent",borderRadius:6,fontSize:13,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:t=>{r!=="card"&&(t.currentTarget.style.background="var(--surface)")},onMouseLeave:t=>{r!=="card"&&(t.currentTarget.style.background="transparent")},children:[b.jsx(tY,{size:16}),"Cards"]}),b.jsxs("button",{onClick:()=>e("table"),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:r==="table"?"var(--surface)":"transparent",color:r==="table"?"var(--text)":"var(--text-muted)",border:r==="table"?"1px solid var(--border)":"1px solid transparent",borderRadius:6,fontSize:13,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:t=>{r!=="table"&&(t.currentTarget.style.background="var(--surface)")},onMouseLeave:t=>{r!=="table"&&(t.currentTarget.style.background="transparent")},children:[b.jsx(zre,{size:16}),"Table"]}),b.jsxs("button",{onClick:()=>e("timeline"),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:r==="timeline"?"var(--surface)":"transparent",color:r==="timeline"?"var(--text)":"var(--text-muted)",border:r==="timeline"?"1px solid var(--border)":"1px solid transparent",borderRadius:6,fontSize:13,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:t=>{r!=="timeline"&&(t.currentTarget.style.background="var(--surface)")},onMouseLeave:t=>{r!=="timeline"&&(t.currentTarget.style.background="transparent")},children:[b.jsx(fl,{size:16}),"Timeline"]})]})}function vae({sessions:r,selectionMode:e,selectedSessions:t,onSelectionChange:n}){const i=$f(),[a,o]=he.useState("date"),[u,c]=he.useState("desc"),h=g=>{a===g?c(u==="asc"?"desc":"asc"):(o(g),c("desc"))},f=[...r].sort((g,_)=>{let E=0;if(a==="date")E=g.started_at-_.started_at;else if(a==="title"){const R=(g.summary_title||"").toLowerCase(),T=(_.summary_title||"").toLowerCase();E=R.localeCompare(T)}else if(a==="duration"){const R=g.ended_at?g.ended_at-g.started_at:0,T=_.ended_at?_.ended_at-_.started_at:0;E=R-T}return u==="asc"?E:-E}),v=g=>{const _=Math.floor(g/3600),E=Math.floor(g%3600/60);return _>0?`${_}h ${E}m`:`${E}m`},y=({field:g})=>a!==g?null:u==="asc"?b.jsx(Qte,{size:12}):b.jsx(Vte,{size:12});return b.jsx("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,overflow:"hidden"},children:b.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[b.jsx("thead",{children:b.jsxs("tr",{style:{background:"var(--surface2)",borderBottom:"1px solid var(--border)"},children:[e&&b.jsx("th",{style:{padding:"12px 16px",textAlign:"left",width:40},children:b.jsx("input",{type:"checkbox",checked:t.size===r.length&&r.length>0,onChange:g=>{r.forEach(_=>n(_.id,g.target.checked))},style:{cursor:"pointer"}})}),b.jsx("th",{onClick:()=>h("date"),style:{padding:"12px 16px",textAlign:"left",fontSize:12,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",cursor:"pointer",userSelect:"none",width:140},children:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:["Date ",b.jsx(y,{field:"date"})]})}),b.jsx("th",{onClick:()=>h("title"),style:{padding:"12px 16px",textAlign:"left",fontSize:12,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",cursor:"pointer",userSelect:"none"},children:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:["Title ",b.jsx(y,{field:"title"})]})}),b.jsx("th",{onClick:()=>h("duration"),style:{padding:"12px 16px",textAlign:"left",fontSize:12,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",cursor:"pointer",userSelect:"none",width:100},children:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:["Duration ",b.jsx(y,{field:"duration"})]})}),b.jsx("th",{style:{padding:"12px 16px",textAlign:"left",fontSize:12,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",width:80},children:"Files"}),b.jsx("th",{style:{padding:"12px 16px",textAlign:"left",fontSize:12,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",width:80},children:"Tools"}),b.jsx("th",{style:{padding:"12px 16px",textAlign:"left",fontSize:12,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",width:100},children:"Status"})]})}),b.jsx("tbody",{children:f.map((g,_)=>{const E=g.ended_at?g.ended_at-g.started_at:0,R=Array.isArray(g.summary_files_changed)?g.summary_files_changed.length:0,T=g.tool_use_count||0,k=g.status==="completed";return b.jsxs("tr",{onClick:N=>{e?n(g.id,!t.has(g.id)):i(`/session/${g.id}`)},style:{borderBottom:_<f.length-1?"1px solid var(--border)":"none",cursor:"pointer",transition:"background 0.15s"},onMouseEnter:N=>{N.currentTarget.style.background="var(--surface2)"},onMouseLeave:N=>{N.currentTarget.style.background="transparent"},children:[e&&b.jsx("td",{style:{padding:"12px 16px"},children:b.jsx("input",{type:"checkbox",checked:t.has(g.id),onChange:N=>{N.stopPropagation(),n(g.id,N.target.checked)},onClick:N=>N.stopPropagation(),style:{cursor:"pointer"}})}),b.jsx("td",{style:{padding:"12px 16px",fontSize:13,color:"var(--text-muted)"},children:new Date(g.started_at*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),b.jsx("td",{style:{padding:"12px 16px",fontSize:13,fontWeight:500,color:"var(--text)"},children:g.summary_title||"Untitled Session"}),b.jsx("td",{style:{padding:"12px 16px",fontSize:13,color:"var(--text-muted)"},children:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[b.jsx(fl,{size:14}),E>0?v(E):"-"]})}),b.jsx("td",{style:{padding:"12px 16px",fontSize:13,color:"var(--text-muted)"},children:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[b.jsx(Ms,{size:14}),R]})}),b.jsx("td",{style:{padding:"12px 16px",fontSize:13,color:"var(--text-muted)"},children:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[b.jsx(wo,{size:14}),T]})}),b.jsx("td",{style:{padding:"12px 16px",fontSize:13},children:b.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",background:k?"var(--green)15":"var(--orange)15",color:k?"var(--green)":"var(--orange)",borderRadius:6,fontSize:12,fontWeight:600},children:[k?b.jsx(Pc,{size:12}):b.jsx(KV,{size:12}),k?"Done":"Active"]})})]},g.id)})})]})})}function gae({sessions:r,onDateClick:e,selectedDate:t}){const[n,i]=he.useState(new Date),a=N=>{const A=N.getFullYear(),j=N.getMonth(),W=new Date(A,j,1),D=new Date(A,j+1,0).getDate(),P=W.getDay();return{daysInMonth:D,startingDayOfWeek:P,year:A,month:j}},o=N=>{const A=N.toDateString();return r.filter(j=>new Date(j.started_at*1e3).toDateString()===A)},{daysInMonth:u,startingDayOfWeek:c,year:h,month:f}=a(n),v=()=>{i(new Date(h,f-1,1))},y=()=>{i(new Date(h,f+1,1))},g=new Date,_=N=>g.getDate()===N&&g.getMonth()===f&&g.getFullYear()===h,E=(N,A)=>N?N.toDateString()===A.toDateString():!1,R=["January","February","March","April","May","June","July","August","September","October","November","December"],T=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],k=[];for(let N=0;N<c;N++)k.push(b.jsx("div",{style:{padding:8}},`empty-${N}`));for(let N=1;N<=u;N++){const A=new Date(h,f,N),j=o(A),W=j.length>0,G=E(t,A),D=_(N);k.push(b.jsxs("div",{onClick:()=>e(A),style:{padding:8,minHeight:60,background:G?"var(--accent)15":"transparent",border:"1px solid",borderColor:D?"var(--accent)":"var(--border)",borderRadius:8,cursor:W?"pointer":"default",transition:"all 0.15s",display:"flex",flexDirection:"column",gap:4},onMouseEnter:P=>{W&&(P.currentTarget.style.background=G?"var(--accent)20":"var(--surface2)")},onMouseLeave:P=>{P.currentTarget.style.background=G?"var(--accent)15":"transparent"},children:[b.jsx("div",{style:{fontSize:13,fontWeight:D?700:500,color:D?"var(--accent)":"var(--text)"},children:N}),W&&b.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:4,marginTop:"auto"},children:b.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--accent)",background:"var(--accent)15",padding:"2px 6px",borderRadius:4},children:j.length})})]},N))}return b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20,marginBottom:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:[b.jsx("button",{onClick:v,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:8,background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",color:"var(--text)",transition:"all 0.15s"},onMouseEnter:N=>{N.currentTarget.style.background="var(--surface)"},onMouseLeave:N=>{N.currentTarget.style.background="var(--surface2)"},children:b.jsx(sre,{size:16})}),b.jsxs("h3",{style:{fontSize:16,fontWeight:700,color:"var(--text)"},children:[R[f]," ",h]}),b.jsx("button",{onClick:y,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:8,background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",color:"var(--text)",transition:"all 0.15s"},onMouseEnter:N=>{N.currentTarget.style.background="var(--surface)"},onMouseLeave:N=>{N.currentTarget.style.background="var(--surface2)"},children:b.jsx(lre,{size:16})})]}),b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:8,marginBottom:8},children:T.map(N=>b.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-muted)",textAlign:"center",padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:N},N))}),b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:8},children:k}),t&&b.jsxs("div",{style:{marginTop:16,padding:"8px 12px",background:"var(--accent)10",border:"1px solid var(--accent)30",borderRadius:8,fontSize:12,color:"var(--text)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[b.jsxs("span",{children:["Showing sessions from ",b.jsx("strong",{children:t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]}),b.jsx("button",{onClick:()=>e(t),style:{padding:"4px 8px",background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:6,fontSize:11,fontWeight:600,color:"var(--text)",cursor:"pointer",transition:"all 0.15s"},onMouseEnter:N=>{N.currentTarget.style.background="var(--surface)"},onMouseLeave:N=>{N.currentTarget.style.background="var(--surface2)"},children:"Clear"})]})]})}function mae({sessions:r}){const e=r.length,t=r.filter(A=>A.status==="completed").length,n=e>0?Math.round(t/e*100):0,i=r.reduce((A,j)=>j.ended_at?A+(j.ended_at-j.started_at):A,0),a=e>0?Math.round(i/e/60):0,o=new Set(r.flatMap(A=>Array.isArray(A.summary_files_changed)?A.summary_files_changed:[])).size,u=r.reduce((A,j)=>A+(j.tool_use_count||0),0),c={};r.forEach(A=>{A.tool_use_count>0&&(c.Read=(c.Read||0)+Math.floor(A.tool_use_count*.3),c.Edit=(c.Edit||0)+Math.floor(A.tool_use_count*.25),c.Bash=(c.Bash||0)+Math.floor(A.tool_use_count*.2),c.Write=(c.Write||0)+Math.floor(A.tool_use_count*.15),c.Grep=(c.Grep||0)+Math.floor(A.tool_use_count*.1))});const h=Object.entries(c).sort((A,j)=>j[1]-A[1]).slice(0,5),f=h.length>0?h[0][1]:1,v={};r.forEach(A=>{Array.isArray(A.summary_files_changed)&&A.summary_files_changed.forEach(j=>{v[j]=(v[j]||0)+1})});const y=Object.entries(v).sort((A,j)=>j[1]-A[1]).slice(0,10),g=y.length>0?y[0][1]:1,E=Date.now()/1e3-10080*60,R=r.filter(A=>A.started_at>=E),T={};R.forEach(A=>{const j=new Date(A.started_at*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric"});T[j]=(T[j]||0)+1});const k=[];for(let A=6;A>=0;A--){const W=new Date(Date.now()-A*24*60*60*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric"});k.push({date:W,count:T[W]||0})}const N=Math.max(...k.map(A=>A.count),1);return b.jsxs("div",{style:{marginBottom:24},children:[b.jsxs("h2",{style:{fontSize:18,fontWeight:700,marginBottom:20,display:"flex",alignItems:"center",gap:8},children:[b.jsx(q6,{size:20}),"Analytics Dashboard"]}),b.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:16,marginBottom:24},children:[b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(Pc,{size:16,style:{color:"var(--green)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Completion Rate"})]}),b.jsxs("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)"},children:[n,"%"]}),b.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:[t," of ",e," sessions"]})]}),b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(fl,{size:16,style:{color:"var(--blue)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Avg Duration"})]}),b.jsxs("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)"},children:[a,"m"]}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:"per session"})]}),b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(Ms,{size:16,style:{color:"var(--purple)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Files Changed"})]}),b.jsx("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)"},children:o}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:"unique files"})]}),b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(wo,{size:16,style:{color:"var(--orange)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Tool Uses"})]}),b.jsx("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)"},children:u}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:"total actions"})]})]}),b.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(400px, 1fr))",gap:16},children:[b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("h3",{style:{fontSize:14,fontWeight:600,marginBottom:16,display:"flex",alignItems:"center",gap:8},children:[b.jsx(au,{size:16}),"Last 7 Days Activity"]}),b.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:8,height:120},children:k.map((A,j)=>b.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[b.jsx("div",{style:{width:"100%",height:Math.max(A.count/N*100,4),background:A.count>0?"var(--accent)":"var(--surface2)",borderRadius:4,transition:"all 0.3s",position:"relative"},children:A.count>0&&b.jsx("div",{style:{position:"absolute",top:-20,left:"50%",transform:"translateX(-50%)",fontSize:11,fontWeight:600,color:"var(--text)"},children:A.count})}),b.jsx("div",{style:{fontSize:10,color:"var(--text-muted)",textAlign:"center"},children:A.date.split(" ")[1]})]},j))})]}),b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("h3",{style:{fontSize:14,fontWeight:600,marginBottom:16,display:"flex",alignItems:"center",gap:8},children:[b.jsx(wo,{size:16}),"Top Tools Used"]}),b.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:h.map(([A,j])=>b.jsxs("div",{children:[b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:4},children:[b.jsx("span",{style:{fontSize:13,fontWeight:500},children:A}),b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:j})]}),b.jsx("div",{style:{width:"100%",height:6,background:"var(--surface2)",borderRadius:3,overflow:"hidden"},children:b.jsx("div",{style:{width:`${j/f*100}%`,height:"100%",background:"var(--accent)",transition:"width 0.3s"}})})]},A))})]})]}),y.length>0&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20,marginTop:16},children:[b.jsxs("h3",{style:{fontSize:14,fontWeight:600,marginBottom:16,display:"flex",alignItems:"center",gap:8},children:[b.jsx(Ms,{size:16}),"Most Edited Files"]}),b.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:y.map(([A,j])=>b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"8px 12px",background:"var(--surface2)",borderRadius:8},children:[b.jsx("div",{style:{flex:1,fontSize:12,fontFamily:"monospace",color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A}),b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[b.jsx("div",{style:{width:100,height:6,background:"var(--surface)",borderRadius:3,overflow:"hidden"},children:b.jsx("div",{style:{width:`${j/g*100}%`,height:"100%",background:"var(--purple)",transition:"width 0.3s"}})}),b.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-muted)",minWidth:30,textAlign:"right"},children:j})]})]},A))})]})]})}function yae({sessions:r}){const e=[...r].filter(_=>_.started_at).sort((_,E)=>E.started_at-_.started_at);if(e.length===0)return null;let t=0,n=0,i=0;const a=new Date;a.setHours(0,0,0,0);const o=new Set(e.map(_=>{const E=new Date(_.started_at*1e3);return E.setHours(0,0,0,0),E.getTime()})),u=Array.from(o).sort((_,E)=>E-_),c=a.getTime(),h=c-864e5;if(u.includes(c)||u.includes(h)){let _=u.includes(c)?c:h;for(;u.includes(_);)t++,_-=864e5}if(u.length>0){i=1,n=1;for(let _=1;_<u.length;_++)(u[_-1]-u[_])/864e5===1?(i++,n=Math.max(n,i)):i=1}let f={duration:0,title:"",date:0};r.forEach(_=>{if(_.ended_at){const E=_.ended_at-_.started_at;E>f.duration&&(f={duration:E,title:_.summary_title||"Untitled",date:_.started_at})}});let v={count:0,title:"",date:0};r.forEach(_=>{const E=Array.isArray(_.summary_files_changed)?_.summary_files_changed.length:0;E>v.count&&(v={count:E,title:_.summary_title||"Untitled",date:_.started_at})});const y=_=>{const E=Math.floor(_/3600),R=Math.floor(_%3600/60);return E>0?`${E}h ${R}m`:`${R}m`},g=_=>new Date(_*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return b.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:16,marginBottom:24},children:[b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(QV,{size:16,style:{color:t>0?"var(--orange)":"var(--text-muted)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Current Streak"})]}),b.jsx("div",{style:{fontSize:28,fontWeight:700,color:t>0?"var(--orange)":"var(--text)"},children:t}),b.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:[t===1?"day":"days"," in a row"]})]}),b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(au,{size:16,style:{color:"var(--accent)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Longest Streak"})]}),b.jsx("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)"},children:n}),b.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:[n===1?"day":"days"," record"]})]}),f.duration>0&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(fl,{size:16,style:{color:"var(--blue)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Longest Session"})]}),b.jsx("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)",marginBottom:4},children:y(f.duration)}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.title}),b.jsx("div",{style:{fontSize:10,color:"var(--text-muted)",marginTop:2},children:g(f.date)})]}),v.count>0&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(Ms,{size:16,style:{color:"var(--purple)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Most Files Changed"})]}),b.jsxs("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)",marginBottom:4},children:[v.count," files"]}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v.title}),b.jsx("div",{style:{fontSize:10,color:"var(--text-muted)",marginTop:2},children:g(v.date)})]})]})}function qm({label:r,options:e,selected:t,onChange:n,placeholder:i}){const[a,o]=he.useState(!1),u=he.useRef(null);he.useEffect(()=>{const f=v=>{u.current&&!u.current.contains(v.target)&&o(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const c=f=>{t.includes(f)?n(t.filter(v=>v!==f)):n([...t,f])},h=()=>{n([])};return b.jsxs("div",{ref:u,style:{position:"relative",minWidth:200},children:[b.jsxs("button",{onClick:()=>o(!a),style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 12px",background:t.length>0?"var(--accent)15":"var(--surface2)",color:t.length>0?"var(--accent)":"var(--text)",border:"1px solid",borderColor:t.length>0?"var(--accent)30":"var(--border)",borderRadius:8,fontSize:13,fontWeight:600,cursor:"pointer",transition:"all 0.15s",width:"100%"},onMouseEnter:f=>{t.length===0&&(f.currentTarget.style.background="var(--surface)")},onMouseLeave:f=>{t.length===0&&(f.currentTarget.style.background="var(--surface2)")},children:[b.jsx("span",{children:t.length>0?`${r} (${t.length})`:i||r}),b.jsx(ire,{size:14,style:{transform:a?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),a&&b.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",zIndex:1e3,maxHeight:300,overflowY:"auto"},children:[t.length>0&&b.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsxs("span",{style:{fontSize:12,color:"var(--text-muted)"},children:[t.length," selected"]}),b.jsxs("button",{onClick:h,style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",background:"transparent",color:"var(--text-muted)",border:"none",borderRadius:4,fontSize:11,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:f=>{f.currentTarget.style.background="var(--surface2)",f.currentTarget.style.color="var(--text)"},onMouseLeave:f=>{f.currentTarget.style.background="transparent",f.currentTarget.style.color="var(--text-muted)"},children:[b.jsx(ds,{size:12}),"Clear"]})]}),e.map(f=>b.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",cursor:"pointer",transition:"background 0.15s",fontSize:13},onMouseEnter:v=>{v.currentTarget.style.background="var(--surface2)"},onMouseLeave:v=>{v.currentTarget.style.background="transparent"},children:[b.jsx("input",{type:"checkbox",checked:t.includes(f),onChange:()=>c(f),style:{cursor:"pointer"}}),b.jsx("span",{style:{color:"var(--text)"},children:f})]},f))]})]})}function bae({sessions:r,selectionMode:e,selectedSessions:t,onSelectionChange:n}){const i=$f(),a=[...r].sort((h,f)=>f.started_at-h.started_at),o={};a.forEach(h=>{const f=new Date(h.started_at*1e3).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});o[f]||(o[f]=[]),o[f].push(h)});const u=h=>new Date(h*1e3).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),c=h=>{const f=Math.floor(h/3600),v=Math.floor(h%3600/60);return f>0?`${f}h ${v}m`:`${v}m`};return b.jsx("div",{style:{position:"relative"},children:Object.entries(o).map(([h,f],v)=>b.jsxs("div",{style:{marginBottom:40},children:[b.jsx("div",{style:{position:"sticky",top:0,background:"var(--background)",zIndex:10,paddingBottom:12,marginBottom:20},children:b.jsxs("h3",{style:{fontSize:16,fontWeight:700,color:"var(--text)",display:"flex",alignItems:"center",gap:12},children:[b.jsx("div",{style:{width:12,height:12,borderRadius:"50%",background:"var(--accent)"}}),h,b.jsxs("span",{style:{fontSize:13,fontWeight:500,color:"var(--text-muted)",marginLeft:8},children:[f.length," ",f.length===1?"session":"sessions"]})]})}),b.jsxs("div",{style:{position:"relative",paddingLeft:40},children:[b.jsx("div",{style:{position:"absolute",left:5,top:0,bottom:v===Object.keys(o).length-1?"50%":0,width:2,background:"var(--border)"}}),f.map((y,g)=>{const _=y.ended_at?y.ended_at-y.started_at:0,E=Array.isArray(y.summary_files_changed)?y.summary_files_changed.length:0,R=y.tool_use_count||0,T=y.status==="completed";return b.jsxs("div",{style:{position:"relative",marginBottom:g<f.length-1?24:0},children:[b.jsx("div",{style:{position:"absolute",left:-34,top:20,width:12,height:12,borderRadius:"50%",background:T?"var(--green)":"var(--orange)",border:"3px solid var(--background)",zIndex:1}}),b.jsx("div",{onClick:k=>{e?n(y.id,!t.has(y.id)):i(`/session/${y.id}`)},style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:16,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:k=>{k.currentTarget.style.background="var(--surface2)",k.currentTarget.style.borderColor="var(--accent)30"},onMouseLeave:k=>{k.currentTarget.style.background="var(--surface)",k.currentTarget.style.borderColor="var(--border)"},children:b.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12},children:[e&&b.jsx("input",{type:"checkbox",checked:t.has(y.id),onChange:k=>{k.stopPropagation(),n(y.id,k.target.checked)},onClick:k=>k.stopPropagation(),style:{marginTop:4,cursor:"pointer"}}),b.jsxs("div",{style:{flex:1},children:[b.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginBottom:8,fontWeight:600},children:u(y.started_at)}),b.jsx("h4",{style:{fontSize:15,fontWeight:600,color:"var(--text)",marginBottom:8},children:y.summary_title||"Untitled Session"}),b.jsxs("div",{style:{display:"flex",gap:16,fontSize:12,color:"var(--text-muted)",marginBottom:8},children:[_>0&&b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[b.jsx(fl,{size:12}),c(_)]}),E>0&&b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[b.jsx(Ms,{size:12}),E," files"]}),R>0&&b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[b.jsx(wo,{size:12}),R," tools"]})]}),b.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",background:T?"var(--green)15":"var(--orange)15",color:T?"var(--green)":"var(--orange)",borderRadius:6,fontSize:11,fontWeight:600},children:[T?b.jsx(Pc,{size:10}):b.jsx(KV,{size:10}),T?"Completed":"Active"]})]})]})})]},y.id)})]})]},h))})}function xae({onOpenProject:r}){const{id:e}=A6(),[t,n]=he.useState(!1),[i,a]=he.useState(!1),[o,u]=he.useState(!1),[c,h]=he.useState(new Set),[f,v]=he.useState(!1),[y,g]=he.useState(!1),[_,E]=he.useState(!1),[R,T]=he.useState(""),[k,N]=he.useState({start:null,end:null}),[A,j]=he.useState([]),[W,G]=he.useState([]),[D,P]=he.useState([]),[U,M]=he.useState([]),[q,B]=he.useState(()=>{const fe=localStorage.getItem("sessionViewMode");return fe==="card"||fe==="table"||fe==="timeline"?fe:"card"}),[Y,ue]=he.useState(()=>localStorage.getItem("showCalendar")==="true"),[re,J]=he.useState(()=>localStorage.getItem("showAnalytics")==="true"),[le,ye]=he.useState(null),[Z,oe]=he.useState({isOpen:!1,title:"",message:"",onConfirm:()=>{},confirmText:"Confirm",confirmColor:"var(--accent)"}),{data:L,isLoading:K}=ia({queryKey:["project",e],queryFn:()=>Tr.getProject(e),enabled:!!e}),{data:te,refetch:de}=ia({queryKey:["sessions",e],queryFn:()=>Tr.getSessions({project_id:e,limit:50}),enabled:!!e,refetchInterval:15e3}),{data:ce}=ia({queryKey:["health"],queryFn:Tr.getHealth});he.useEffect(()=>{L&&e&&r(e,L.name)},[L,e,r]),he.useEffect(()=>{if(!e)return;let fe;try{fe=M6(),fe.onmessage=ke=>{try{const Be=JSON.parse(ke.data);(Be.type==="session_start"||Be.type==="session_end"||Be.type==="summary_ready")&&de()}catch{}},fe.onerror=()=>{console.log("[ProjectDetail] WebSocket error, falling back to polling")}}catch(ke){console.log("[ProjectDetail] WebSocket connection failed:",ke)}return()=>{fe?.close()}},[e,de]);const xe=async()=>{if(!e)return;n(!0);const fe=at.loading("Consolidating memory...");try{await Tr.consolidateMemory(e),at.dismiss(fe),at.success("Memory consolidation complete!")}catch(ke){at.dismiss(fe),at.error("Consolidation failed: "+ke)}finally{n(!1)}},Se=async(fe=!1)=>{e&&oe({isOpen:!0,title:fe?"Force Resync All Sessions":"Resync New Sessions",message:fe?"This will regenerate ALL summaries with v2.0 fields (mood, complexity, blockers, resolved, key insights). This may take several minutes. Continue?":'This will only process sessions without summaries. To regenerate existing summaries with v2.0 fields, use "Force Resync All". Continue?',confirmText:fe?"Force Resync":"Resync",confirmColor:fe?"var(--orange)":"var(--blue)",onConfirm:async()=>{oe({...Z,isOpen:!1}),a(!0);const ke=at.loading("Queueing sessions for resync...",0);try{const Be=await Tr.resyncProject(e,fe);at.update(ke,`Queued ${Be.result.queued} sessions. Processing...`,50),setTimeout(()=>{at.dismiss(ke),at.success(Be.result.message)},2e3),de()}catch(Be){at.dismiss(ke),at.error("Resync failed: "+Be)}finally{a(!1)}}})},Ie=()=>{u(!o),h(new Set)},Le=()=>{c.size===qt.length?h(new Set):h(new Set(qt.map(fe=>fe.id)))},Ve=(fe,ke)=>{const Be=new Set(c);ke?Be.add(fe):Be.delete(fe),h(Be)},tt=()=>{oe({isOpen:!0,title:"Delete Sessions",message:`This will permanently delete ${c.size} sessions and all their data. This action cannot be undone.`,confirmText:"Delete",confirmColor:"var(--red)",onConfirm:async()=>{oe({...Z,isOpen:!1});const fe=at.loading(`Deleting ${c.size} sessions...`);try{await Promise.all(Array.from(c).map(ke=>Tr.deleteSession(ke))),at.dismiss(fe),at.success(`Deleted ${c.size} sessions`),h(new Set),u(!1),de()}catch(ke){at.dismiss(fe),at.error("Failed to delete sessions: "+ke)}}})},Xe=async()=>{const fe=at.loading(`Bookmarking ${c.size} sessions...`);try{await Promise.all(Array.from(c).map(ke=>Tr.toggleBookmark(ke,!0))),at.dismiss(fe),at.success(`Bookmarked ${c.size} sessions`),h(new Set),u(!1),de()}catch(ke){at.dismiss(fe),at.error("Failed to bookmark sessions: "+ke)}},ht=()=>{v(!0)},ne=async()=>{const fe=at.loading(`Exporting ${c.size} sessions...`);try{const ke=(await r1(async()=>{const{default:zt}=await import("./jszip.min-DeeXtAUg.js").then(Ht=>Ht.j);return{default:zt}},[])).default,Be=new ke,ft=Array.from(c).map(zt=>Tr.getSession(zt));(await Promise.all(ft)).forEach(zt=>{const Ht=zt.summary_title||"Untitled Session",yr=`${new Date(zt.started_at*1e3).toISOString().split("T")[0]}_${Ht.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,vs=`# ${Ht}
|
|
452
|
+
`})]})}function sae({checked:r,onChange:e,disabled:t}){return b.jsx("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),t||e(!r)},disabled:t,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:0,background:"transparent",color:r?"var(--accent)":"var(--text-muted)",border:"none",cursor:t?"not-allowed":"pointer",transition:"color 0.15s"},onMouseEnter:n=>{t||(n.currentTarget.style.color="var(--accent)")},onMouseLeave:n=>{t||(n.currentTarget.style.color=r?"var(--accent)":"var(--text-muted)")},children:r?b.jsx(y1,{size:18}):b.jsx(iY,{size:18})})}const oae={productive:pne,frustrated:jre,exploratory:HO,debugging:wo,blocked:Ef},lae={trivial:"var(--green)",simple:"var(--green)",moderate:"var(--yellow)",complex:"var(--orange)",very_complex:"var(--red)"};function uae({session:r,onSessionUpdated:e,selectionMode:t,selected:n,onSelectionChange:i}){const[a,o]=he.useState(!1),[u,c]=he.useState(!1),[h,f]=he.useState(!1),[v,y]=he.useState(!1),[g,_]=he.useState(!1),[E,R]=he.useState(!1),[T,k]=he.useState(!1),N=new Date(r.started_at*1e3),A=r.duration_seconds?Math.floor(r.duration_seconds/60):r.ended_at?Math.floor((r.ended_at-r.started_at)/60):null,j=Array.isArray(r.summary_files_changed)?r.summary_files_changed:[],W=r.summary_mood?oae[r.summary_mood]:null,G=r.summary_complexity?lae[r.summary_complexity]:"var(--text-muted)",D=r.status==="active"||!r.status||r.summary_status&&r.summary_status.toLowerCase()==="in_progress",P=!!r.summary_title,U=async J=>{J.preventDefault(),J.stopPropagation(),f(!0);try{await Tr.toggleBookmark(r.id,!r.is_bookmarked),e&&e()}catch(le){at.error("Failed to update bookmark: "+le)}finally{f(!1)}},M=async J=>{J.preventDefault(),J.stopPropagation(),k(!0)},q=async()=>{k(!1),o(!0);const J=at.loading("Ending session...");try{await Tr.forceEndSession(r.id),at.dismiss(J),at.success("Session ended successfully"),e&&setTimeout(()=>e(),1e3)}catch(le){at.dismiss(J),at.error("Failed to end session: "+le)}finally{o(!1)}},B=async J=>{J.preventDefault(),J.stopPropagation(),R(!0)},Y=async J=>{J.preventDefault(),J.stopPropagation(),y(!0);try{await Tr.toggleArchive(r.id,!r.is_archived),at.success(r.is_archived?"Session unarchived":"Session archived"),e&&e()}catch(le){at.error("Failed to update archive status: "+le)}finally{y(!1)}},ue=async J=>{J.preventDefault(),J.stopPropagation(),_(!0);const le=at.loading(P?"Resyncing summary...":"Syncing summary...");try{P?await Tr.resyncSession(r.id):await Tr.syncSession(r.id),at.dismiss(le),at.success("Session queued for summarization"),e&&setTimeout(()=>e(),2e3)}catch(ye){at.dismiss(le),at.error("Failed to sync: "+ye)}finally{_(!1)}},re=async()=>{R(!1),c(!0);const J=at.loading("Deleting session...");try{await Tr.deleteSession(r.id),at.dismiss(J),at.success("Session deleted successfully"),e&&setTimeout(()=>e(),500)}catch(le){at.dismiss(J),at.error("Failed to delete session: "+le)}finally{c(!1)}};return b.jsxs(b.Fragment,{children:[b.jsx(dl,{to:`/session/${r.id}`,style:{display:"block"},children:b.jsx("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 16px",marginBottom:8,cursor:"pointer",transition:"border-color 0.15s, background 0.15s"},onMouseEnter:J=>{J.currentTarget.style.borderColor="var(--accent)",J.currentTarget.style.background="var(--surface2)"},onMouseLeave:J=>{J.currentTarget.style.borderColor="var(--border)",J.currentTarget.style.background="var(--surface)"},children:b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8},children:[t&&b.jsx("div",{style:{paddingTop:2,marginRight:8},children:b.jsx(sae,{checked:n||!1,onChange:J=>i?.(J)})}),b.jsxs("div",{style:{flex:1,minWidth:0},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[b.jsx("div",{style:{fontWeight:600,fontSize:14,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:r.summary_title||"Session "+r.id.slice(0,8)}),W&&b.jsx(W,{size:14,style:{color:"var(--text-muted)",flexShrink:0}})]}),r.summary_what_we_did&&Array.isArray(r.summary_what_we_did)&&b.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginBottom:8},children:r.summary_what_we_did[0]}),r.summary_key_insight&&b.jsxs("div",{style:{fontSize:11,color:"var(--accent)",marginBottom:8,display:"flex",alignItems:"center",gap:4},children:[b.jsx(Tf,{size:11}),r.summary_key_insight]}),(r.metric_momentum!==void 0||r.metric_frustration!==void 0||r.next_session_starting_point||r.aha_moments_count)&&b.jsxs("div",{style:{display:"flex",gap:8,marginBottom:8,fontSize:10,flexWrap:"wrap"},children:[r.next_session_starting_point&&b.jsxs("span",{style:{padding:"2px 6px",borderRadius:4,background:"var(--yellow)20",color:"var(--yellow)",border:"1px solid var(--yellow)30",display:"flex",alignItems:"center",gap:3},children:["⏭️ Start: ",r.next_session_starting_point]}),r.aha_moments_count>0&&b.jsxs("span",{style:{padding:"2px 6px",borderRadius:4,background:"var(--accent)20",color:"var(--accent)",border:"1px solid var(--accent)30",display:"flex",alignItems:"center",gap:3},children:["💡 Aha! x",r.aha_moments_count]}),r.unresolved_tech_debt&&r.unresolved_tech_debt!=="null"&&b.jsx("span",{style:{padding:"2px 6px",borderRadius:4,background:"var(--orange)20",color:"var(--orange)",border:"1px solid var(--orange)30",display:"flex",alignItems:"center",gap:3},children:"🚧 Tech Debt"}),r.metric_momentum!=null&&b.jsxs("span",{style:{padding:"2px 6px",borderRadius:4,background:r.metric_momentum>70?"var(--green)20":"var(--blue)15",color:r.metric_momentum>70?"var(--green)":"var(--blue)",border:"1px solid",borderColor:r.metric_momentum>70?"var(--green)30":"var(--blue)30",display:"flex",alignItems:"center",gap:3},children:["⚡ Momentum: ",r.metric_momentum]}),r.metric_frustration!=null&&r.metric_frustration>0&&b.jsxs("span",{style:{padding:"2px 6px",borderRadius:4,background:r.metric_frustration>50?"var(--red)20":"var(--orange)15",color:r.metric_frustration>50?"var(--red)":"var(--orange)",border:"1px solid",borderColor:r.metric_frustration>50?"var(--red)30":"var(--orange)30",display:"flex",alignItems:"center",gap:3},children:["🔴 Frustration: ",r.metric_frustration]}),r.metric_productivity!=null&&b.jsxs("span",{style:{padding:"2px 6px",borderRadius:4,background:"var(--accent)20",color:"var(--accent)",border:"1px solid var(--accent)30",display:"flex",alignItems:"center",gap:3},children:["🎯 Productivity: ",r.metric_productivity]}),r.emotional_context&&b.jsxs("span",{style:{padding:"2px 6px",borderRadius:4,background:"var(--surface)",color:"var(--text-muted)",border:"1px solid var(--border)",display:"flex",alignItems:"center",gap:3,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:r.emotional_context,children:["💬 ",r.emotional_context]})]}),b.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",flexWrap:"wrap"},children:[b.jsxs("span",{style:{fontSize:11,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:4},children:[b.jsx(fl,{size:11}),fY(N,{addSuffix:!0})]}),A!==null&&b.jsxs("span",{style:{fontSize:11,color:"var(--text-muted)"},children:[A,"m"]}),r.summary_complexity&&b.jsx("span",{style:{fontSize:10,color:G,padding:"2px 6px",background:`${G}15`,borderRadius:4,fontWeight:600},children:r.summary_complexity.replace("_"," ")}),r.total_tool_calls>0&&b.jsxs("span",{style:{fontSize:11,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:4},children:[b.jsx(wo,{size:11}),r.total_tool_calls," calls"]}),j.length>0&&b.jsxs("span",{style:{fontSize:11,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:4},children:[b.jsx(Ms,{size:11}),j.length," files"]})]})]}),b.jsxs("div",{style:{flexShrink:0,display:"flex",alignItems:"center",gap:8},children:[b.jsx("button",{onClick:U,disabled:h,title:r.is_bookmarked?"Remove bookmark":"Bookmark session",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px",background:"transparent",color:r.is_bookmarked?"var(--yellow)":"var(--text-muted)",border:"1px solid var(--border)",borderRadius:6,cursor:h?"not-allowed":"pointer",transition:"all 0.15s"},onMouseEnter:J=>{h||(J.currentTarget.style.background="var(--yellow)15",J.currentTarget.style.color="var(--yellow)",J.currentTarget.style.borderColor="var(--yellow)30")},onMouseLeave:J=>{h||(J.currentTarget.style.background="transparent",J.currentTarget.style.color=r.is_bookmarked?"var(--yellow)":"var(--text-muted)",J.currentTarget.style.borderColor="var(--border)")},children:b.jsx(aY,{size:14,fill:r.is_bookmarked?"var(--yellow)":"none"})}),b.jsx("button",{onClick:Y,disabled:v,title:r.is_archived?"Unarchive session":"Archive session",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px",background:"transparent",color:r.is_archived?"var(--blue)":"var(--text-muted)",border:"1px solid var(--border)",borderRadius:6,cursor:v?"not-allowed":"pointer",transition:"all 0.15s"},onMouseEnter:J=>{v||(J.currentTarget.style.background="var(--blue)15",J.currentTarget.style.color="var(--blue)",J.currentTarget.style.borderColor="var(--blue)30")},onMouseLeave:J=>{v||(J.currentTarget.style.background="transparent",J.currentTarget.style.color=r.is_archived?"var(--blue)":"var(--text-muted)",J.currentTarget.style.borderColor="var(--border)")},children:r.is_archived?b.jsx(Ute,{size:14}):b.jsx(Wte,{size:14})}),D&&b.jsxs("button",{onClick:M,disabled:a,style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",background:a?"var(--surface)":"var(--green)15",color:a?"var(--text-muted)":"var(--green)",border:"1px solid",borderColor:a?"var(--border)":"var(--green)30",borderRadius:6,fontSize:11,fontWeight:600,cursor:a?"not-allowed":"pointer",transition:"all 0.15s"},onMouseEnter:J=>{a||(J.currentTarget.style.background="var(--green)25")},onMouseLeave:J=>{a||(J.currentTarget.style.background="var(--green)15")},children:[b.jsx(Pc,{size:12}),a?"Ending...":"Force End"]}),b.jsxs("button",{onClick:ue,disabled:g,title:P?"Resync summary":r.transcript_path?"Sync summary":"Sync from observations",style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",background:g?"var(--surface)":!P&&!r.transcript_path?"var(--orange)15":"var(--blue)15",color:g?"var(--text-muted)":!P&&!r.transcript_path?"var(--orange)":"var(--blue)",border:"1px solid",borderColor:g?"var(--border)":!P&&!r.transcript_path?"var(--orange)30":"var(--blue)30",borderRadius:6,fontSize:11,fontWeight:600,cursor:g?"not-allowed":"pointer",transition:"all 0.15s"},onMouseEnter:J=>{if(!g){const le=!P&&!r.transcript_path?"var(--orange)25":"var(--blue)25";J.currentTarget.style.background=le}},onMouseLeave:J=>{if(!g){const le=!P&&!r.transcript_path?"var(--orange)15":"var(--blue)15";J.currentTarget.style.background=le}},children:[b.jsx(Sc,{size:12}),g?"Syncing...":P?"Resync":"Sync"]}),b.jsx("button",{onClick:B,disabled:u,title:"Delete session",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px",background:u?"var(--surface)":"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:6,cursor:u?"not-allowed":"pointer",transition:"all 0.15s"},onMouseEnter:J=>{u||(J.currentTarget.style.background="var(--red)15",J.currentTarget.style.color="var(--red)",J.currentTarget.style.borderColor="var(--red)30")},onMouseLeave:J=>{u||(J.currentTarget.style.background="transparent",J.currentTarget.style.color="var(--text-muted)",J.currentTarget.style.borderColor="var(--border)")},children:b.jsx(oY,{size:14})}),b.jsx(pY,{status:r.summary_status||r.status})]})]})})}),b.jsx(w1,{isOpen:T,title:"Force End Session",message:"This will mark the session as completed and trigger AI summarization. The session will be processed and added to your project history.",confirmText:"Force End",cancelText:"Cancel",confirmColor:"var(--green)",onConfirm:q,onCancel:()=>k(!1)}),b.jsx(w1,{isOpen:E,title:"Delete Session",message:"This will permanently remove the session and all its data including observations, preferences, knowledge, and tasks. This action cannot be undone.",confirmText:"Delete",cancelText:"Cancel",confirmColor:"var(--red)",onConfirm:re,onCancel:()=>R(!1)})]})}function cae({selectedCount:r,onBulkDelete:e,onBulkBookmark:t,onBulkTag:n,onBulkExport:i,onClearSelection:a}){return r===0?null:b.jsxs("div",{style:{position:"fixed",bottom:24,left:"50%",transform:"translateX(-50%)",background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:"12px 20px",display:"flex",alignItems:"center",gap:16,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",zIndex:1e3},children:[b.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--text)"},children:[r," selected"]}),b.jsxs("div",{style:{display:"flex",gap:8},children:[b.jsxs("button",{onClick:t,title:"Bookmark selected",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:"var(--yellow)15",color:"var(--yellow)",border:"1px solid var(--yellow)30",borderRadius:8,fontSize:12,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:o=>o.currentTarget.style.background="var(--yellow)25",onMouseLeave:o=>o.currentTarget.style.background="var(--yellow)15",children:[b.jsx(aY,{size:14}),"Bookmark"]}),b.jsxs("button",{onClick:n,title:"Tag selected",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:"var(--accent)15",color:"var(--accent)",border:"1px solid var(--accent)30",borderRadius:8,fontSize:12,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:o=>o.currentTarget.style.background="var(--accent)25",onMouseLeave:o=>o.currentTarget.style.background="var(--accent)15",children:[b.jsx(sY,{size:14}),"Tag"]}),b.jsxs("button",{onClick:i,title:"Export as ZIP",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:"var(--blue)15",color:"var(--blue)",border:"1px solid var(--blue)30",borderRadius:8,fontSize:12,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:o=>o.currentTarget.style.background="var(--blue)25",onMouseLeave:o=>o.currentTarget.style.background="var(--blue)15",children:[b.jsx(F1,{size:14}),"Export ZIP"]}),b.jsxs("button",{onClick:e,title:"Delete selected",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:"var(--red)15",color:"var(--red)",border:"1px solid var(--red)30",borderRadius:8,fontSize:12,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:o=>o.currentTarget.style.background="var(--red)25",onMouseLeave:o=>o.currentTarget.style.background="var(--red)15",children:[b.jsx(oY,{size:14}),"Delete"]})]}),b.jsx("button",{onClick:a,title:"Clear selection",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px",background:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:o=>{o.currentTarget.style.background="var(--surface2)",o.currentTarget.style.color="var(--text)"},onMouseLeave:o=>{o.currentTarget.style.background="transparent",o.currentTarget.style.color="var(--text-muted)"},children:b.jsx(ds,{size:16})})]})}const Pk=["#7c6cfc","#3b82f6","#22c55e","#eab308","#f97316","#ef4444","#ec4899","#8b5cf6"];function vY({sessionId:r,projectId:e,sessionTags:t,onUpdate:n}){const[i,a]=he.useState(!1),[o,u]=he.useState(""),[c,h]=he.useState(!1),[f,v]=he.useState(Pk[0]),y=he.useRef(null),g=Xv(),{data:_=[]}=ia({queryKey:["tags",e],queryFn:()=>Tr.getTags(e),enabled:!!e}),E=yv({mutationFn:({tagId:j})=>Tr.addSessionTag(r,j),onSuccess:()=>{g.invalidateQueries({queryKey:["session",r]}),n&&n(),u("")},onError:j=>at.error("Failed to add tag: "+j)}),R=yv({mutationFn:({tagId:j})=>Tr.removeSessionTag(r,j),onSuccess:()=>{g.invalidateQueries({queryKey:["session",r]}),n&&n()},onError:j=>at.error("Failed to remove tag: "+j)}),T=yv({mutationFn:({name:j,color:W})=>Tr.createTag(e,j,W),onSuccess:j=>{g.invalidateQueries({queryKey:["tags",e]}),E.mutate({tagId:j.id}),u(""),h(!1)},onError:j=>at.error("Failed to create tag: "+j)}),k=_.filter(j=>j.name.toLowerCase().includes(o.toLowerCase())&&!t.some(W=>W.id===j.id)),N=()=>{o.trim()&&T.mutate({name:o.trim(),color:f})},A=_.find(j=>j.name.toLowerCase()===o.toLowerCase());return he.useEffect(()=>{i&&y.current&&y.current.focus()},[i]),b.jsxs("div",{style:{position:"relative"},children:[b.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6,alignItems:"center"},children:[t.map(j=>b.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",background:j.color?`${j.color}15`:"var(--surface2)",border:"1px solid",borderColor:j.color?`${j.color}30`:"var(--border)",borderRadius:6,fontSize:12,color:j.color||"var(--text)"},children:[b.jsx(sY,{size:11}),j.name,b.jsx("button",{onClick:()=>R.mutate({tagId:j.id}),style:{background:"none",border:"none",cursor:"pointer",padding:0,display:"flex",color:"inherit",opacity:.6},children:b.jsx(ds,{size:12})})]},j.id)),b.jsxs("button",{onClick:()=>a(!i),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:6,fontSize:12,color:"var(--text-muted)",cursor:"pointer"},children:[b.jsx(Ek,{size:12}),"Add tag"]})]}),i&&b.jsxs("div",{style:{position:"absolute",top:"100%",left:0,marginTop:8,background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:12,minWidth:280,maxWidth:400,zIndex:100,boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:[b.jsx("input",{ref:y,type:"text",value:o,onChange:j=>u(j.target.value),placeholder:"Search or create tag...",style:{width:"100%",padding:"8px 10px",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:6,fontSize:13,color:"var(--text)",marginBottom:8},onKeyDown:j=>{j.key==="Enter"&&o&&!A&&N(),j.key==="Escape"&&a(!1)}}),b.jsx("div",{style:{maxHeight:200,overflowY:"auto"},children:k.length>0?k.map(j=>b.jsxs("button",{onClick:()=>E.mutate({tagId:j.id}),style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"8px 10px",background:"transparent",border:"none",borderRadius:6,fontSize:13,color:"var(--text)",cursor:"pointer",textAlign:"left"},onMouseEnter:W=>W.currentTarget.style.background="var(--surface2)",onMouseLeave:W=>W.currentTarget.style.background="transparent",children:[b.jsx("div",{style:{width:12,height:12,borderRadius:3,background:j.color||"var(--border)"}}),j.name]},j.id)):o&&!A?b.jsxs("div",{children:[b.jsxs("button",{onClick:()=>h(!c),style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"8px 10px",background:"var(--accent)15",border:"1px solid var(--accent)30",borderRadius:6,fontSize:13,color:"var(--accent)",cursor:"pointer",marginBottom:c?8:0},children:[b.jsx(Ek,{size:14}),'Create "',o,'"']}),c&&b.jsxs("div",{style:{padding:"8px 0"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:6},children:"Choose color:"}),b.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:Pk.map(j=>b.jsx("button",{onClick:()=>{v(j),N()},style:{width:24,height:24,borderRadius:4,background:j,border:f===j?"2px solid var(--text)":"none",cursor:"pointer"}},j))})]})]}):b.jsx("div",{style:{padding:"8px 10px",fontSize:12,color:"var(--text-muted)"},children:o?"No matching tags":"Start typing to search or create"})})]})]})}function dae({isOpen:r,sessionIds:e,onClose:t,onComplete:n}){const[i,a]=he.useState([]),[o,u]=he.useState(!1);if(!r)return null;const c=async()=>{if(i.length===0){at.error("Please select at least one tag");return}u(!0);const h=at.loading(`Tagging ${e.length} sessions...`);try{await Promise.all(e.map(f=>Promise.all(i.map(v=>fetch(`/api/sessions/${f}/tags`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag_id:v.id})}))))),at.dismiss(h),at.success(`Tagged ${e.length} sessions`),n(),t()}catch(f){at.dismiss(h),at.error("Failed to tag sessions: "+f)}finally{u(!1)}};return b.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2e3},children:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:24,width:"90%",maxWidth:500},children:[b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[b.jsxs("h3",{style:{fontSize:18,fontWeight:700,color:"var(--text)"},children:["Tag ",e.length," Sessions"]}),b.jsx("button",{onClick:t,style:{background:"transparent",border:"none",color:"var(--text-muted)",cursor:"pointer",padding:4},children:b.jsx(ds,{size:20})})]}),b.jsxs("div",{style:{marginBottom:20},children:[b.jsx("label",{style:{display:"block",fontSize:13,fontWeight:600,color:"var(--text)",marginBottom:8},children:"Select Tags"}),b.jsx(vY,{selectedTags:i,onChange:a})]}),b.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[b.jsx("button",{onClick:t,disabled:o,style:{padding:"8px 16px",background:"var(--surface2)",color:"var(--text)",border:"1px solid var(--border)",borderRadius:8,fontSize:13,fontWeight:600,cursor:o?"not-allowed":"pointer"},children:"Cancel"}),b.jsx("button",{onClick:c,disabled:o||i.length===0,style:{padding:"8px 16px",background:o||i.length===0?"var(--surface2)":"var(--accent)",color:o||i.length===0?"var(--text-muted)":"white",border:"none",borderRadius:8,fontSize:13,fontWeight:600,cursor:o||i.length===0?"not-allowed":"pointer"},children:o?"Tagging...":"Apply Tags"})]})]})})}function hae({projectId:r}){const{data:e}=ia({queryKey:["sessions",r],queryFn:async()=>{const h=await fetch(`/api/sessions?project_id=${r}&limit=100`);if(!h.ok)throw new Error("Failed to fetch sessions");return h.json()}}),t=WO(new Date).getTime()/1e3,n=(e||[]).filter(h=>h.started_at>=t),i=n.reduce((h,f)=>h+(f.total_tool_calls||0),0),a=new Set(n.flatMap(h=>{try{const f=h.summary_files_changed;return Array.isArray(f)?f:typeof f=="string"?JSON.parse(f):[]}catch{return[]}})).size,o=n.reduce((h,f)=>{const v=f.duration_seconds?Math.floor(f.duration_seconds/60):f.ended_at?Math.floor((f.ended_at-f.started_at)/60):0;return h+v},0),u=Math.floor(o/60),c=o%60;return b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20,marginBottom:24},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:16},children:[b.jsx(m1,{size:18,style:{color:"var(--accent)"}}),b.jsx("h3",{style:{fontSize:16,fontWeight:700,color:"var(--text)"},children:"Today's Productivity"})]}),b.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:16},children:[b.jsxs("div",{style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,padding:16},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[b.jsx(m1,{size:14,style:{color:"var(--accent)"}}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",fontWeight:600,textTransform:"uppercase"},children:"Sessions"})]}),b.jsx("div",{style:{fontSize:24,fontWeight:700,color:"var(--accent)"},children:n.length})]}),b.jsxs("div",{style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,padding:16},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[b.jsx(wo,{size:14,style:{color:"var(--blue)"}}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",fontWeight:600,textTransform:"uppercase"},children:"Tool Calls"})]}),b.jsx("div",{style:{fontSize:24,fontWeight:700,color:"var(--blue)"},children:i})]}),b.jsxs("div",{style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,padding:16},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[b.jsx(Ms,{size:14,style:{color:"var(--green)"}}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",fontWeight:600,textTransform:"uppercase"},children:"Files Touched"})]}),b.jsx("div",{style:{fontSize:24,fontWeight:700,color:"var(--green)"},children:a})]}),b.jsxs("div",{style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,padding:16},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[b.jsx(fl,{size:14,style:{color:"var(--orange)"}}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",fontWeight:600,textTransform:"uppercase"},children:"Time Spent"})]}),b.jsx("div",{style:{fontSize:24,fontWeight:700,color:"var(--orange)"},children:u>0?`${u}h ${c}m`:`${c}m`})]})]})]})}function gY({onSearch:r,placeholder:e="Search sessions...",autoFocus:t}){const[n,i]=he.useState(""),a=he.useRef(),o=c=>{const h=c.target.value;i(h),clearTimeout(a.current),h.length>=2?a.current=setTimeout(()=>r(h),300):h.length===0&&r("")},u=()=>{i(""),r("")};return b.jsxs("div",{style:{position:"relative",width:"100%",maxWidth:400},children:[b.jsx(L6,{size:16,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",color:"var(--text-muted)",pointerEvents:"none"}}),b.jsx("input",{type:"text",value:n,onChange:o,placeholder:e,autoFocus:t,style:{width:"100%",padding:"8px 36px 8px 36px",background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,color:"var(--text)",fontSize:13,fontWeight:500,outline:"none",transition:"all 0.15s"},onFocus:c=>{c.target.style.borderColor="var(--accent)",c.target.style.background="var(--surface)"},onBlur:c=>{c.target.style.borderColor="var(--border)",c.target.style.background="var(--surface2)"}}),n&&b.jsx("button",{onClick:u,style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",justifyContent:"center",padding:4,background:"transparent",color:"var(--text-muted)",border:"none",borderRadius:4,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:c=>{c.currentTarget.style.background="var(--surface)",c.currentTarget.style.color="var(--text)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent",c.currentTarget.style.color="var(--text-muted)"},children:b.jsx(ds,{size:14})})]})}function fae({onDateRangeChange:r}){const[e,t]=he.useState(""),[n,i]=he.useState(""),a=h=>{t(h),h&&n?r(new Date(h),new Date(n)):!h&&!n&&r(null,null)},o=h=>{i(h),e&&h?r(new Date(e),new Date(h)):!e&&!h&&r(null,null)},u=()=>{t(""),i(""),r(null,null)},c=e||n;return b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,padding:"6px 10px",maxWidth:400},children:[b.jsx(m1,{size:16,style:{color:"var(--text-muted)",flexShrink:0}}),b.jsx("input",{type:"date",value:e,onChange:h=>a(h.target.value),placeholder:"Start date",style:{flex:1,background:"transparent",border:"none",color:"var(--text)",fontSize:13,fontWeight:500,outline:"none"}}),b.jsx("span",{style:{color:"var(--text-muted)",fontSize:13},children:"to"}),b.jsx("input",{type:"date",value:n,onChange:h=>o(h.target.value),placeholder:"End date",style:{flex:1,background:"transparent",border:"none",color:"var(--text)",fontSize:13,fontWeight:500,outline:"none"}}),c&&b.jsx("button",{onClick:u,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:4,background:"transparent",color:"var(--text-muted)",border:"none",borderRadius:4,cursor:"pointer",transition:"all 0.15s",flexShrink:0},onMouseEnter:h=>{h.currentTarget.style.background="var(--surface)",h.currentTarget.style.color="var(--text)"},onMouseLeave:h=>{h.currentTarget.style.background="transparent",h.currentTarget.style.color="var(--text-muted)"},children:b.jsx(ds,{size:14})})]})}function pae({viewMode:r,onToggle:e}){return b.jsxs("div",{style:{display:"flex",gap:4,background:"var(--surface2)",padding:4,borderRadius:8,border:"1px solid var(--border)"},children:[b.jsxs("button",{onClick:()=>e("card"),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:r==="card"?"var(--surface)":"transparent",color:r==="card"?"var(--text)":"var(--text-muted)",border:r==="card"?"1px solid var(--border)":"1px solid transparent",borderRadius:6,fontSize:13,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:t=>{r!=="card"&&(t.currentTarget.style.background="var(--surface)")},onMouseLeave:t=>{r!=="card"&&(t.currentTarget.style.background="transparent")},children:[b.jsx(tY,{size:16}),"Cards"]}),b.jsxs("button",{onClick:()=>e("table"),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:r==="table"?"var(--surface)":"transparent",color:r==="table"?"var(--text)":"var(--text-muted)",border:r==="table"?"1px solid var(--border)":"1px solid transparent",borderRadius:6,fontSize:13,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:t=>{r!=="table"&&(t.currentTarget.style.background="var(--surface)")},onMouseLeave:t=>{r!=="table"&&(t.currentTarget.style.background="transparent")},children:[b.jsx(zre,{size:16}),"Table"]}),b.jsxs("button",{onClick:()=>e("timeline"),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:r==="timeline"?"var(--surface)":"transparent",color:r==="timeline"?"var(--text)":"var(--text-muted)",border:r==="timeline"?"1px solid var(--border)":"1px solid transparent",borderRadius:6,fontSize:13,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:t=>{r!=="timeline"&&(t.currentTarget.style.background="var(--surface)")},onMouseLeave:t=>{r!=="timeline"&&(t.currentTarget.style.background="transparent")},children:[b.jsx(fl,{size:16}),"Timeline"]})]})}function vae({sessions:r,selectionMode:e,selectedSessions:t,onSelectionChange:n}){const i=$f(),[a,o]=he.useState("date"),[u,c]=he.useState("desc"),h=g=>{a===g?c(u==="asc"?"desc":"asc"):(o(g),c("desc"))},f=[...r].sort((g,_)=>{let E=0;if(a==="date")E=g.started_at-_.started_at;else if(a==="title"){const R=(g.summary_title||"").toLowerCase(),T=(_.summary_title||"").toLowerCase();E=R.localeCompare(T)}else if(a==="duration"){const R=g.ended_at?g.ended_at-g.started_at:0,T=_.ended_at?_.ended_at-_.started_at:0;E=R-T}return u==="asc"?E:-E}),v=g=>{const _=Math.floor(g/3600),E=Math.floor(g%3600/60);return _>0?`${_}h ${E}m`:`${E}m`},y=({field:g})=>a!==g?null:u==="asc"?b.jsx(Qte,{size:12}):b.jsx(Vte,{size:12});return b.jsx("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,overflow:"hidden"},children:b.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[b.jsx("thead",{children:b.jsxs("tr",{style:{background:"var(--surface2)",borderBottom:"1px solid var(--border)"},children:[e&&b.jsx("th",{style:{padding:"12px 16px",textAlign:"left",width:40},children:b.jsx("input",{type:"checkbox",checked:t.size===r.length&&r.length>0,onChange:g=>{r.forEach(_=>n(_.id,g.target.checked))},style:{cursor:"pointer"}})}),b.jsx("th",{onClick:()=>h("date"),style:{padding:"12px 16px",textAlign:"left",fontSize:12,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",cursor:"pointer",userSelect:"none",width:140},children:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:["Date ",b.jsx(y,{field:"date"})]})}),b.jsx("th",{onClick:()=>h("title"),style:{padding:"12px 16px",textAlign:"left",fontSize:12,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",cursor:"pointer",userSelect:"none"},children:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:["Title ",b.jsx(y,{field:"title"})]})}),b.jsx("th",{onClick:()=>h("duration"),style:{padding:"12px 16px",textAlign:"left",fontSize:12,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",cursor:"pointer",userSelect:"none",width:100},children:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:["Duration ",b.jsx(y,{field:"duration"})]})}),b.jsx("th",{style:{padding:"12px 16px",textAlign:"left",fontSize:12,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",width:80},children:"Files"}),b.jsx("th",{style:{padding:"12px 16px",textAlign:"left",fontSize:12,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",width:80},children:"Tools"}),b.jsx("th",{style:{padding:"12px 16px",textAlign:"left",fontSize:12,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",width:100},children:"Status"})]})}),b.jsx("tbody",{children:f.map((g,_)=>{const E=g.ended_at?g.ended_at-g.started_at:0,R=Array.isArray(g.summary_files_changed)?g.summary_files_changed.length:0,T=g.tool_use_count||0,k=g.status==="completed";return b.jsxs("tr",{onClick:N=>{e?n(g.id,!t.has(g.id)):i(`/session/${g.id}`)},style:{borderBottom:_<f.length-1?"1px solid var(--border)":"none",cursor:"pointer",transition:"background 0.15s"},onMouseEnter:N=>{N.currentTarget.style.background="var(--surface2)"},onMouseLeave:N=>{N.currentTarget.style.background="transparent"},children:[e&&b.jsx("td",{style:{padding:"12px 16px"},children:b.jsx("input",{type:"checkbox",checked:t.has(g.id),onChange:N=>{N.stopPropagation(),n(g.id,N.target.checked)},onClick:N=>N.stopPropagation(),style:{cursor:"pointer"}})}),b.jsx("td",{style:{padding:"12px 16px",fontSize:13,color:"var(--text-muted)"},children:new Date(g.started_at*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),b.jsx("td",{style:{padding:"12px 16px",fontSize:13,fontWeight:500,color:"var(--text)"},children:g.summary_title||"Untitled Session"}),b.jsx("td",{style:{padding:"12px 16px",fontSize:13,color:"var(--text-muted)"},children:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[b.jsx(fl,{size:14}),E>0?v(E):"-"]})}),b.jsx("td",{style:{padding:"12px 16px",fontSize:13,color:"var(--text-muted)"},children:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[b.jsx(Ms,{size:14}),R]})}),b.jsx("td",{style:{padding:"12px 16px",fontSize:13,color:"var(--text-muted)"},children:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[b.jsx(wo,{size:14}),T]})}),b.jsx("td",{style:{padding:"12px 16px",fontSize:13},children:b.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",background:k?"var(--green)15":"var(--orange)15",color:k?"var(--green)":"var(--orange)",borderRadius:6,fontSize:12,fontWeight:600},children:[k?b.jsx(Pc,{size:12}):b.jsx(KV,{size:12}),k?"Done":"Active"]})})]},g.id)})})]})})}function gae({sessions:r,onDateClick:e,selectedDate:t}){const[n,i]=he.useState(new Date),a=N=>{const A=N.getFullYear(),j=N.getMonth(),W=new Date(A,j,1),D=new Date(A,j+1,0).getDate(),P=W.getDay();return{daysInMonth:D,startingDayOfWeek:P,year:A,month:j}},o=N=>{const A=N.toDateString();return r.filter(j=>new Date(j.started_at*1e3).toDateString()===A)},{daysInMonth:u,startingDayOfWeek:c,year:h,month:f}=a(n),v=()=>{i(new Date(h,f-1,1))},y=()=>{i(new Date(h,f+1,1))},g=new Date,_=N=>g.getDate()===N&&g.getMonth()===f&&g.getFullYear()===h,E=(N,A)=>N?N.toDateString()===A.toDateString():!1,R=["January","February","March","April","May","June","July","August","September","October","November","December"],T=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],k=[];for(let N=0;N<c;N++)k.push(b.jsx("div",{style:{padding:8}},`empty-${N}`));for(let N=1;N<=u;N++){const A=new Date(h,f,N),j=o(A),W=j.length>0,G=E(t,A),D=_(N);k.push(b.jsxs("div",{onClick:()=>e(A),style:{padding:8,minHeight:60,background:G?"var(--accent)15":"transparent",border:"1px solid",borderColor:D?"var(--accent)":"var(--border)",borderRadius:8,cursor:W?"pointer":"default",transition:"all 0.15s",display:"flex",flexDirection:"column",gap:4},onMouseEnter:P=>{W&&(P.currentTarget.style.background=G?"var(--accent)20":"var(--surface2)")},onMouseLeave:P=>{P.currentTarget.style.background=G?"var(--accent)15":"transparent"},children:[b.jsx("div",{style:{fontSize:13,fontWeight:D?700:500,color:D?"var(--accent)":"var(--text)"},children:N}),W&&b.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:4,marginTop:"auto"},children:b.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--accent)",background:"var(--accent)15",padding:"2px 6px",borderRadius:4},children:j.length})})]},N))}return b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20,marginBottom:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:[b.jsx("button",{onClick:v,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:8,background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",color:"var(--text)",transition:"all 0.15s"},onMouseEnter:N=>{N.currentTarget.style.background="var(--surface)"},onMouseLeave:N=>{N.currentTarget.style.background="var(--surface2)"},children:b.jsx(sre,{size:16})}),b.jsxs("h3",{style:{fontSize:16,fontWeight:700,color:"var(--text)"},children:[R[f]," ",h]}),b.jsx("button",{onClick:y,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:8,background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",color:"var(--text)",transition:"all 0.15s"},onMouseEnter:N=>{N.currentTarget.style.background="var(--surface)"},onMouseLeave:N=>{N.currentTarget.style.background="var(--surface2)"},children:b.jsx(lre,{size:16})})]}),b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:8,marginBottom:8},children:T.map(N=>b.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-muted)",textAlign:"center",padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:N},N))}),b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:8},children:k}),t&&b.jsxs("div",{style:{marginTop:16,padding:"8px 12px",background:"var(--accent)10",border:"1px solid var(--accent)30",borderRadius:8,fontSize:12,color:"var(--text)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[b.jsxs("span",{children:["Showing sessions from ",b.jsx("strong",{children:t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]}),b.jsx("button",{onClick:()=>e(t),style:{padding:"4px 8px",background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:6,fontSize:11,fontWeight:600,color:"var(--text)",cursor:"pointer",transition:"all 0.15s"},onMouseEnter:N=>{N.currentTarget.style.background="var(--surface)"},onMouseLeave:N=>{N.currentTarget.style.background="var(--surface2)"},children:"Clear"})]})]})}function mae({sessions:r}){const e=r.length,t=r.filter(A=>A.status==="completed").length,n=e>0?Math.round(t/e*100):0,i=r.reduce((A,j)=>j.ended_at?A+(j.ended_at-j.started_at):A,0),a=e>0?Math.round(i/e/60):0,o=new Set(r.flatMap(A=>Array.isArray(A.summary_files_changed)?A.summary_files_changed:[])).size,u=r.reduce((A,j)=>A+(j.tool_use_count||0),0),c={};r.forEach(A=>{A.tool_use_count>0&&(c.Read=(c.Read||0)+Math.floor(A.tool_use_count*.3),c.Edit=(c.Edit||0)+Math.floor(A.tool_use_count*.25),c.Bash=(c.Bash||0)+Math.floor(A.tool_use_count*.2),c.Write=(c.Write||0)+Math.floor(A.tool_use_count*.15),c.Grep=(c.Grep||0)+Math.floor(A.tool_use_count*.1))});const h=Object.entries(c).sort((A,j)=>j[1]-A[1]).slice(0,5),f=h.length>0?h[0][1]:1,v={};r.forEach(A=>{Array.isArray(A.summary_files_changed)&&A.summary_files_changed.forEach(j=>{v[j]=(v[j]||0)+1})});const y=Object.entries(v).sort((A,j)=>j[1]-A[1]).slice(0,10),g=y.length>0?y[0][1]:1,E=Date.now()/1e3-10080*60,R=r.filter(A=>A.started_at>=E),T={};R.forEach(A=>{const j=new Date(A.started_at*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric"});T[j]=(T[j]||0)+1});const k=[];for(let A=6;A>=0;A--){const W=new Date(Date.now()-A*24*60*60*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric"});k.push({date:W,count:T[W]||0})}const N=Math.max(...k.map(A=>A.count),1);return b.jsxs("div",{style:{marginBottom:24},children:[b.jsxs("h2",{style:{fontSize:18,fontWeight:700,marginBottom:20,display:"flex",alignItems:"center",gap:8},children:[b.jsx(q6,{size:20}),"Analytics Dashboard"]}),b.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:16,marginBottom:24},children:[b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(Pc,{size:16,style:{color:"var(--green)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Completion Rate"})]}),b.jsxs("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)"},children:[n,"%"]}),b.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:[t," of ",e," sessions"]})]}),b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(fl,{size:16,style:{color:"var(--blue)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Avg Duration"})]}),b.jsxs("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)"},children:[a,"m"]}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:"per session"})]}),b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(Ms,{size:16,style:{color:"var(--purple)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Files Changed"})]}),b.jsx("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)"},children:o}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:"unique files"})]}),b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(wo,{size:16,style:{color:"var(--orange)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Tool Uses"})]}),b.jsx("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)"},children:u}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:"total actions"})]})]}),b.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(400px, 1fr))",gap:16},children:[b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("h3",{style:{fontSize:14,fontWeight:600,marginBottom:16,display:"flex",alignItems:"center",gap:8},children:[b.jsx(au,{size:16}),"Last 7 Days Activity"]}),b.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:8,height:120},children:k.map((A,j)=>b.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[b.jsx("div",{style:{width:"100%",height:Math.max(A.count/N*100,4),background:A.count>0?"var(--accent)":"var(--surface2)",borderRadius:4,transition:"all 0.3s",position:"relative"},children:A.count>0&&b.jsx("div",{style:{position:"absolute",top:-20,left:"50%",transform:"translateX(-50%)",fontSize:11,fontWeight:600,color:"var(--text)"},children:A.count})}),b.jsx("div",{style:{fontSize:10,color:"var(--text-muted)",textAlign:"center"},children:A.date.split(" ")[1]})]},j))})]}),b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("h3",{style:{fontSize:14,fontWeight:600,marginBottom:16,display:"flex",alignItems:"center",gap:8},children:[b.jsx(wo,{size:16}),"Top Tools Used"]}),b.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:h.map(([A,j])=>b.jsxs("div",{children:[b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:4},children:[b.jsx("span",{style:{fontSize:13,fontWeight:500},children:A}),b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:j})]}),b.jsx("div",{style:{width:"100%",height:6,background:"var(--surface2)",borderRadius:3,overflow:"hidden"},children:b.jsx("div",{style:{width:`${j/f*100}%`,height:"100%",background:"var(--accent)",transition:"width 0.3s"}})})]},A))})]})]}),y.length>0&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20,marginTop:16},children:[b.jsxs("h3",{style:{fontSize:14,fontWeight:600,marginBottom:16,display:"flex",alignItems:"center",gap:8},children:[b.jsx(Ms,{size:16}),"Most Edited Files"]}),b.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:y.map(([A,j])=>b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"8px 12px",background:"var(--surface2)",borderRadius:8},children:[b.jsx("div",{style:{flex:1,fontSize:12,fontFamily:"monospace",color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A}),b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[b.jsx("div",{style:{width:100,height:6,background:"var(--surface)",borderRadius:3,overflow:"hidden"},children:b.jsx("div",{style:{width:`${j/g*100}%`,height:"100%",background:"var(--purple)",transition:"width 0.3s"}})}),b.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-muted)",minWidth:30,textAlign:"right"},children:j})]})]},A))})]})]})}function yae({sessions:r}){const e=[...r].filter(_=>_.started_at).sort((_,E)=>E.started_at-_.started_at);if(e.length===0)return null;let t=0,n=0,i=0;const a=new Date;a.setHours(0,0,0,0);const o=new Set(e.map(_=>{const E=new Date(_.started_at*1e3);return E.setHours(0,0,0,0),E.getTime()})),u=Array.from(o).sort((_,E)=>E-_),c=a.getTime(),h=c-864e5;if(u.includes(c)||u.includes(h)){let _=u.includes(c)?c:h;for(;u.includes(_);)t++,_-=864e5}if(u.length>0){i=1,n=1;for(let _=1;_<u.length;_++)(u[_-1]-u[_])/864e5===1?(i++,n=Math.max(n,i)):i=1}let f={duration:0,title:"",date:0};r.forEach(_=>{if(_.ended_at){const E=_.ended_at-_.started_at;E>f.duration&&(f={duration:E,title:_.summary_title||"Untitled",date:_.started_at})}});let v={count:0,title:"",date:0};r.forEach(_=>{const E=Array.isArray(_.summary_files_changed)?_.summary_files_changed.length:0;E>v.count&&(v={count:E,title:_.summary_title||"Untitled",date:_.started_at})});const y=_=>{const E=Math.floor(_/3600),R=Math.floor(_%3600/60);return E>0?`${E}h ${R}m`:`${R}m`},g=_=>new Date(_*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return b.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:16,marginBottom:24},children:[b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(QV,{size:16,style:{color:t>0?"var(--orange)":"var(--text-muted)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Current Streak"})]}),b.jsx("div",{style:{fontSize:28,fontWeight:700,color:t>0?"var(--orange)":"var(--text)"},children:t}),b.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:[t===1?"day":"days"," in a row"]})]}),b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(au,{size:16,style:{color:"var(--accent)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Longest Streak"})]}),b.jsx("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)"},children:n}),b.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:[n===1?"day":"days"," record"]})]}),f.duration>0&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(fl,{size:16,style:{color:"var(--blue)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Longest Session"})]}),b.jsx("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)",marginBottom:4},children:y(f.duration)}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.title}),b.jsx("div",{style:{fontSize:10,color:"var(--text-muted)",marginTop:2},children:g(f.date)})]}),v.count>0&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.jsx(Ms,{size:16,style:{color:"var(--purple)"}}),b.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Most Files Changed"})]}),b.jsxs("div",{style:{fontSize:28,fontWeight:700,color:"var(--text)",marginBottom:4},children:[v.count," files"]}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v.title}),b.jsx("div",{style:{fontSize:10,color:"var(--text-muted)",marginTop:2},children:g(v.date)})]})]})}function qm({label:r,options:e,selected:t,onChange:n,placeholder:i}){const[a,o]=he.useState(!1),u=he.useRef(null);he.useEffect(()=>{const f=v=>{u.current&&!u.current.contains(v.target)&&o(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const c=f=>{t.includes(f)?n(t.filter(v=>v!==f)):n([...t,f])},h=()=>{n([])};return b.jsxs("div",{ref:u,style:{position:"relative",minWidth:200},children:[b.jsxs("button",{onClick:()=>o(!a),style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 12px",background:t.length>0?"var(--accent)15":"var(--surface2)",color:t.length>0?"var(--accent)":"var(--text)",border:"1px solid",borderColor:t.length>0?"var(--accent)30":"var(--border)",borderRadius:8,fontSize:13,fontWeight:600,cursor:"pointer",transition:"all 0.15s",width:"100%"},onMouseEnter:f=>{t.length===0&&(f.currentTarget.style.background="var(--surface)")},onMouseLeave:f=>{t.length===0&&(f.currentTarget.style.background="var(--surface2)")},children:[b.jsx("span",{children:t.length>0?`${r} (${t.length})`:i||r}),b.jsx(ire,{size:14,style:{transform:a?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),a&&b.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",zIndex:1e3,maxHeight:300,overflowY:"auto"},children:[t.length>0&&b.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsxs("span",{style:{fontSize:12,color:"var(--text-muted)"},children:[t.length," selected"]}),b.jsxs("button",{onClick:h,style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",background:"transparent",color:"var(--text-muted)",border:"none",borderRadius:4,fontSize:11,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:f=>{f.currentTarget.style.background="var(--surface2)",f.currentTarget.style.color="var(--text)"},onMouseLeave:f=>{f.currentTarget.style.background="transparent",f.currentTarget.style.color="var(--text-muted)"},children:[b.jsx(ds,{size:12}),"Clear"]})]}),e.map(f=>b.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",cursor:"pointer",transition:"background 0.15s",fontSize:13},onMouseEnter:v=>{v.currentTarget.style.background="var(--surface2)"},onMouseLeave:v=>{v.currentTarget.style.background="transparent"},children:[b.jsx("input",{type:"checkbox",checked:t.includes(f),onChange:()=>c(f),style:{cursor:"pointer"}}),b.jsx("span",{style:{color:"var(--text)"},children:f})]},f))]})]})}function bae({sessions:r,selectionMode:e,selectedSessions:t,onSelectionChange:n}){const i=$f(),a=[...r].sort((h,f)=>f.started_at-h.started_at),o={};a.forEach(h=>{const f=new Date(h.started_at*1e3).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});o[f]||(o[f]=[]),o[f].push(h)});const u=h=>new Date(h*1e3).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),c=h=>{const f=Math.floor(h/3600),v=Math.floor(h%3600/60);return f>0?`${f}h ${v}m`:`${v}m`};return b.jsx("div",{style:{position:"relative"},children:Object.entries(o).map(([h,f],v)=>b.jsxs("div",{style:{marginBottom:40},children:[b.jsx("div",{style:{position:"sticky",top:0,background:"var(--background)",zIndex:10,paddingBottom:12,marginBottom:20},children:b.jsxs("h3",{style:{fontSize:16,fontWeight:700,color:"var(--text)",display:"flex",alignItems:"center",gap:12},children:[b.jsx("div",{style:{width:12,height:12,borderRadius:"50%",background:"var(--accent)"}}),h,b.jsxs("span",{style:{fontSize:13,fontWeight:500,color:"var(--text-muted)",marginLeft:8},children:[f.length," ",f.length===1?"session":"sessions"]})]})}),b.jsxs("div",{style:{position:"relative",paddingLeft:40},children:[b.jsx("div",{style:{position:"absolute",left:5,top:0,bottom:v===Object.keys(o).length-1?"50%":0,width:2,background:"var(--border)"}}),f.map((y,g)=>{const _=y.ended_at?y.ended_at-y.started_at:0,E=Array.isArray(y.summary_files_changed)?y.summary_files_changed.length:0,R=y.tool_use_count||0,T=y.status==="completed";return b.jsxs("div",{style:{position:"relative",marginBottom:g<f.length-1?24:0},children:[b.jsx("div",{style:{position:"absolute",left:-34,top:20,width:12,height:12,borderRadius:"50%",background:T?"var(--green)":"var(--orange)",border:"3px solid var(--background)",zIndex:1}}),b.jsx("div",{onClick:k=>{e?n(y.id,!t.has(y.id)):i(`/session/${y.id}`)},style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:16,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:k=>{k.currentTarget.style.background="var(--surface2)",k.currentTarget.style.borderColor="var(--accent)30"},onMouseLeave:k=>{k.currentTarget.style.background="var(--surface)",k.currentTarget.style.borderColor="var(--border)"},children:b.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12},children:[e&&b.jsx("input",{type:"checkbox",checked:t.has(y.id),onChange:k=>{k.stopPropagation(),n(y.id,k.target.checked)},onClick:k=>k.stopPropagation(),style:{marginTop:4,cursor:"pointer"}}),b.jsxs("div",{style:{flex:1},children:[b.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginBottom:8,fontWeight:600},children:u(y.started_at)}),b.jsx("h4",{style:{fontSize:15,fontWeight:600,color:"var(--text)",marginBottom:8},children:y.summary_title||"Untitled Session"}),b.jsxs("div",{style:{display:"flex",gap:16,fontSize:12,color:"var(--text-muted)",marginBottom:8},children:[_>0&&b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[b.jsx(fl,{size:12}),c(_)]}),E>0&&b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[b.jsx(Ms,{size:12}),E," files"]}),R>0&&b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[b.jsx(wo,{size:12}),R," tools"]})]}),b.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",background:T?"var(--green)15":"var(--orange)15",color:T?"var(--green)":"var(--orange)",borderRadius:6,fontSize:11,fontWeight:600},children:[T?b.jsx(Pc,{size:10}):b.jsx(KV,{size:10}),T?"Completed":"Active"]})]})]})})]},y.id)})]})]},h))})}function xae({onOpenProject:r}){const{id:e}=A6(),[t,n]=he.useState(!1),[i,a]=he.useState(!1),[o,u]=he.useState(!1),[c,h]=he.useState(new Set),[f,v]=he.useState(!1),[y,g]=he.useState(!1),[_,E]=he.useState(!1),[R,T]=he.useState(""),[k,N]=he.useState({start:null,end:null}),[A,j]=he.useState([]),[W,G]=he.useState([]),[D,P]=he.useState([]),[U,M]=he.useState([]),[q,B]=he.useState(()=>{const fe=localStorage.getItem("sessionViewMode");return fe==="card"||fe==="table"||fe==="timeline"?fe:"card"}),[Y,ue]=he.useState(()=>localStorage.getItem("showCalendar")==="true"),[re,J]=he.useState(()=>localStorage.getItem("showAnalytics")==="true"),[le,ye]=he.useState(null),[Z,oe]=he.useState({isOpen:!1,title:"",message:"",onConfirm:()=>{},confirmText:"Confirm",confirmColor:"var(--accent)"}),{data:L,isLoading:K}=ia({queryKey:["project",e],queryFn:()=>Tr.getProject(e),enabled:!!e}),{data:te,refetch:de}=ia({queryKey:["sessions",e],queryFn:()=>Tr.getSessions({project_id:e,limit:50}),enabled:!!e,refetchInterval:15e3}),{data:ce}=ia({queryKey:["health"],queryFn:Tr.getHealth});he.useEffect(()=>{L&&e&&r(e,L.name)},[L,e,r]),he.useEffect(()=>{if(!e)return;let fe;try{fe=M6(),fe.onmessage=ke=>{try{const Be=JSON.parse(ke.data);(Be.type==="session_start"||Be.type==="session_end"||Be.type==="summary_ready")&&de()}catch{}},fe.onerror=()=>{console.log("[ProjectDetail] WebSocket error, falling back to polling")}}catch(ke){console.log("[ProjectDetail] WebSocket connection failed:",ke)}return()=>{fe?.close()}},[e,de]);const xe=async()=>{if(!e)return;n(!0);const fe=at.loading("Consolidating memory...");try{await Tr.consolidateMemory(e),at.dismiss(fe),at.success("Memory consolidation complete!")}catch(ke){at.dismiss(fe),at.error("Consolidation failed: "+ke)}finally{n(!1)}},Se=async(fe=!1)=>{e&&oe({isOpen:!0,title:fe?"Force Resync All Sessions":"Resync New Sessions",message:fe?"This will regenerate ALL summaries with v2.0 fields (mood, complexity, blockers, resolved, key insights). This may take several minutes. Continue?":'This will only process sessions without summaries. To regenerate existing summaries with v2.0 fields, use "Force Resync All". Continue?',confirmText:fe?"Force Resync":"Resync",confirmColor:fe?"var(--orange)":"var(--blue)",onConfirm:async()=>{oe({...Z,isOpen:!1}),a(!0);const ke=at.loading("Queueing sessions for resync...",0);try{const Be=await Tr.resyncProject(e,fe);at.update(ke,`Queued ${Be.result.queued} sessions. Processing...`,50),setTimeout(()=>{at.dismiss(ke),at.success(Be.result.message)},2e3),de()}catch(Be){at.dismiss(ke),at.error("Resync failed: "+Be)}finally{a(!1)}}})},Ie=()=>{u(!o),h(new Set)},Le=()=>{c.size===qt.length?h(new Set):h(new Set(qt.map(fe=>fe.id)))},Ve=(fe,ke)=>{const Be=new Set(c);ke?Be.add(fe):Be.delete(fe),h(Be)},tt=()=>{oe({isOpen:!0,title:"Delete Sessions",message:`This will permanently delete ${c.size} sessions and all their data. This action cannot be undone.`,confirmText:"Delete",confirmColor:"var(--red)",onConfirm:async()=>{oe({...Z,isOpen:!1});const fe=at.loading(`Deleting ${c.size} sessions...`);try{await Promise.all(Array.from(c).map(ke=>Tr.deleteSession(ke))),at.dismiss(fe),at.success(`Deleted ${c.size} sessions`),h(new Set),u(!1),de()}catch(ke){at.dismiss(fe),at.error("Failed to delete sessions: "+ke)}}})},Xe=async()=>{const fe=at.loading(`Bookmarking ${c.size} sessions...`);try{await Promise.all(Array.from(c).map(ke=>Tr.toggleBookmark(ke,!0))),at.dismiss(fe),at.success(`Bookmarked ${c.size} sessions`),h(new Set),u(!1),de()}catch(ke){at.dismiss(fe),at.error("Failed to bookmark sessions: "+ke)}},ht=()=>{v(!0)},ne=async()=>{const fe=at.loading(`Exporting ${c.size} sessions...`);try{const ke=(await r1(async()=>{const{default:zt}=await import("./jszip.min-DO22A2s2.js").then(Ht=>Ht.j);return{default:zt}},[])).default,Be=new ke,ft=Array.from(c).map(zt=>Tr.getSession(zt));(await Promise.all(ft)).forEach(zt=>{const Ht=zt.summary_title||"Untitled Session",yr=`${new Date(zt.started_at*1e3).toISOString().split("T")[0]}_${Ht.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,vs=`# ${Ht}
|
|
453
453
|
|
|
454
454
|
**Date:** ${new Date(zt.started_at*1e3).toLocaleString()}
|
|
455
455
|
**Status:** ${zt.status}
|
|
@@ -613,7 +613,7 @@ T* `):O.join(` Tj
|
|
|
613
613
|
endobj\r
|
|
614
614
|
`},t.outline.count_r=function(n,i){for(var a=0;a<i.children.length;a++)n.count++,this.count_r(n,i.children[a]);return n.count}}])})(At.API),(function(r){var e=[192,193,194,195,196,197,198,199];r.processJPEG=function(t,n,i,a,o,u){var c,h=this.decode.DCT_DECODE,f=null;if(typeof t=="string"||this.__addimage__.isArrayBuffer(t)||this.__addimage__.isArrayBufferView(t)){switch(t=o||t,t=this.__addimage__.isArrayBuffer(t)?new Uint8Array(t):t,c=(function(v){for(var y,g=256*v.charCodeAt(4)+v.charCodeAt(5),_=v.length,E={width:0,height:0,numcomponents:1},R=4;R<_;R+=2){if(R+=g,e.indexOf(v.charCodeAt(R+1))!==-1){y=256*v.charCodeAt(R+5)+v.charCodeAt(R+6),E={width:256*v.charCodeAt(R+7)+v.charCodeAt(R+8),height:y,numcomponents:v.charCodeAt(R+9)};break}g=256*v.charCodeAt(R+2)+v.charCodeAt(R+3)}return E})(t=this.__addimage__.isArrayBufferView(t)?this.__addimage__.arrayBufferToBinaryString(t):t),c.numcomponents){case 1:u=this.color_spaces.DEVICE_GRAY;break;case 4:u=this.color_spaces.DEVICE_CMYK;break;case 3:u=this.color_spaces.DEVICE_RGB}f={data:t,width:c.width,height:c.height,colorSpace:u,bitsPerComponent:8,filter:h,index:n,alias:i}}return f}})(At.API),At.API.processPNG=function(r,e,t,n){if(this.__addimage__.isArrayBuffer(r)&&(r=new Uint8Array(r)),this.__addimage__.isArrayBufferView(r)){var i,a=Ioe(r,{checkCrc:!0}),o=a.width,u=a.height,c=a.channels,h=a.palette,f=a.depth;i=h&&c===1?(function(D){for(var P=D.width,U=D.height,M=D.data,q=D.palette,B=D.depth,Y=!1,ue=[],re=[],J=void 0,le=!1,ye=0,Z=0;Z<q.length;Z++){var oe=Fk(q[Z],4),L=oe[0],K=oe[1],te=oe[2],de=oe[3];ue.push(L,K,te),de!=null&&(de===0?(ye++,re.length<1&&re.push(Z)):de<255&&(le=!0))}if(le||ye>1){Y=!0,re=void 0;var ce=P*U;J=new Uint8Array(ce);for(var xe=new DataView(M.buffer),Se=0;Se<ce;Se++){var Ie=lb(xe,Se,B),Le=Fk(q[Ie],4)[3];J[Se]=Le}}else ye===0&&(re=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:Y?8:void 0,colorBytes:M,alphaBytes:J,needSMask:Y,palette:ue,mask:re}})(a):c===2||c===4?(function(D){for(var P=D.data,U=D.width,M=D.height,q=D.channels,B=D.depth,Y=q===2?"DeviceGray":"DeviceRGB",ue=q-1,re=U*M,J=ue,le=re*J,ye=1*re,Z=Math.ceil(le*B/8),oe=Math.ceil(ye*B/8),L=new Uint8Array(Z),K=new Uint8Array(oe),te=new DataView(P.buffer),de=new DataView(L.buffer),ce=new DataView(K.buffer),xe=!1,Se=0;Se<re;Se++){for(var Ie=Se*q,Le=0;Le<J;Le++)H8(de,lb(te,Ie+Le,B),Se*J+Le,B);var Ve=lb(te,Ie+J,B);Ve<(1<<B)-1&&(xe=!0),H8(ce,Ve,1*Se,B)}return{colorSpace:Y,colorsPerPixel:ue,sMaskBitsPerComponent:xe?B:void 0,colorBytes:L,alphaBytes:K,needSMask:xe}})(a):(function(D){var P=D.data,U=D.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:U,colorsPerPixel:U==="DeviceGray"?1:3,colorBytes:P instanceof Uint16Array?(function(M){for(var q=M.length,B=new Uint8Array(2*q),Y=new DataView(B.buffer,B.byteOffset,B.byteLength),ue=0;ue<q;ue++)Y.setUint16(2*ue,M[ue],!1);return B})(P):P,needSMask:!1}})(a);var v,y,g,_=i,E=_.colorSpace,R=_.colorsPerPixel,T=_.sMaskBitsPerComponent,k=_.colorBytes,N=_.alphaBytes,A=_.needSMask,j=_.palette,W=_.mask,G=null;return n!==At.API.image_compression.NONE&&typeof KO=="function"?(G=(function(D){var P;switch(D){case At.API.image_compression.FAST:P=11;break;case At.API.image_compression.MEDIUM:P=13;break;case At.API.image_compression.SLOW:P=14;break;default:P=12}return P})(n),v=this.decode.FLATE_DECODE,y="/Predictor ".concat(G," /Colors ").concat(R," /BitsPerComponent ").concat(f," /Columns ").concat(o),r=$8(k,Math.ceil(o*R*f/8),R,f,n),A&&(g=$8(N,Math.ceil(o*T/8),1,T,n))):(v=void 0,y=void 0,r=k,A&&(g=N)),(this.__addimage__.isArrayBuffer(r)||this.__addimage__.isArrayBufferView(r))&&(r=this.__addimage__.arrayBufferToBinaryString(r)),(g&&this.__addimage__.isArrayBuffer(g)||this.__addimage__.isArrayBufferView(g))&&(g=this.__addimage__.arrayBufferToBinaryString(g)),{alias:t,data:r,index:e,filter:v,decodeParameters:y,transparency:W,palette:j,sMask:g,predictor:G,width:o,height:u,bitsPerComponent:f,sMaskBitsPerComponent:T,colorSpace:E}}},(function(r){r.processGIF89A=function(e,t,n,i){var a=new Joe(e),o=a.width,u=a.height,c=[];a.decodeAndBlitFrameRGBA(0,c);var h={data:c,width:o,height:u},f=new ub(100).encode(h,100);return r.processJPEG.call(this,f,t,n,i)},r.processGIF87A=r.processGIF89A})(At.API),vo.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var r=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(r);for(var e=0;e<r;e++){var t=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0);this.palette[e]={red:i,green:n,blue:t,quad:a}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},vo.prototype.parseBGR=function(){this.pos=this.offset;var r="bit"+this.bitPP,e=this.width*this.height*4;if(e>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");this.data=new Uint8Array(e);try{this[r]()}catch(t){Yr.log("bit decode error:"+t)}},vo.prototype.bit1=function(){var r,e=Math.ceil(this.width/8),t=e%4;for(r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,i=0;i<e;i++)for(var a=this.datav.getUint8(this.pos++,!0),o=n*this.width*4+8*i*4,u=0;u<8&&8*i+u<this.width;u++){var c=this.palette[a>>7-u&1];this.data[o+4*u]=c.blue,this.data[o+4*u+1]=c.green,this.data[o+4*u+2]=c.red,this.data[o+4*u+3]=255}t!==0&&(this.pos+=4-t)}},vo.prototype.bit4=function(){for(var r=Math.ceil(this.width/2),e=r%4,t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,i=0;i<r;i++){var a=this.datav.getUint8(this.pos++,!0),o=n*this.width*4+2*i*4,u=a>>4,c=15&a,h=this.palette[u];if(this.data[o]=h.blue,this.data[o+1]=h.green,this.data[o+2]=h.red,this.data[o+3]=255,2*i+1>=this.width)break;h=this.palette[c],this.data[o+4]=h.blue,this.data[o+4+1]=h.green,this.data[o+4+2]=h.red,this.data[o+4+3]=255}e!==0&&(this.pos+=4-e)}},vo.prototype.bit8=function(){for(var r=this.width%4,e=this.height-1;e>=0;e--){for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var i=this.datav.getUint8(this.pos++,!0),a=t*this.width*4+4*n;if(i<this.palette.length){var o=this.palette[i];this.data[a]=o.red,this.data[a+1]=o.green,this.data[a+2]=o.blue,this.data[a+3]=255}else this.data[a]=255,this.data[a+1]=255,this.data[a+2]=255,this.data[a+3]=255}r!==0&&(this.pos+=4-r)}},vo.prototype.bit15=function(){for(var r=this.width%3,e=parseInt("11111",2),t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,i=0;i<this.width;i++){var a=this.datav.getUint16(this.pos,!0);this.pos+=2;var o=(a&e)/e*255|0,u=(a>>5&e)/e*255|0,c=(a>>10&e)/e*255|0,h=a>>15?255:0,f=n*this.width*4+4*i;this.data[f]=c,this.data[f+1]=u,this.data[f+2]=o,this.data[f+3]=h}this.pos+=r}},vo.prototype.bit16=function(){for(var r=this.width%3,e=parseInt("11111",2),t=parseInt("111111",2),n=this.height-1;n>=0;n--){for(var i=this.bottom_up?n:this.height-1-n,a=0;a<this.width;a++){var o=this.datav.getUint16(this.pos,!0);this.pos+=2;var u=(o&e)/e*255|0,c=(o>>5&t)/t*255|0,h=(o>>11)/e*255|0,f=i*this.width*4+4*a;this.data[f]=h,this.data[f+1]=c,this.data[f+2]=u,this.data[f+3]=255}this.pos+=r}},vo.prototype.bit24=function(){for(var r=this.height-1;r>=0;r--){for(var e=this.bottom_up?r:this.height-1-r,t=0;t<this.width;t++){var n=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),o=e*this.width*4+4*t;this.data[o]=a,this.data[o+1]=i,this.data[o+2]=n,this.data[o+3]=255}this.pos+=this.width%4}},vo.prototype.bit32=function(){for(var r=this.height-1;r>=0;r--)for(var e=this.bottom_up?r:this.height-1-r,t=0;t<this.width;t++){var n=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),u=e*this.width*4+4*t;this.data[u]=a,this.data[u+1]=i,this.data[u+2]=n,this.data[u+3]=o}},vo.prototype.getData=function(){return this.data},(function(r){r.processBMP=function(e,t,n,i){var a=new vo(e,!1),o=a.width,u=a.height,c={data:a.getData(),width:o,height:u},h=new ub(100).encode(c,100);return r.processJPEG.call(this,h,t,n,i)}})(At.API),G8.prototype.getData=function(){return this.data},(function(r){r.processWEBP=function(e,t,n,i){var a=new G8(e),o=a.width,u=a.height,c={data:a.getData(),width:o,height:u},h=new ub(100).encode(c,100);return r.processJPEG.call(this,h,t,n,i)}})(At.API),At.API.processRGBA=function(r,e,t){for(var n=r.data,i=n.length,a=new Uint8Array(i/4*3),o=new Uint8Array(i/4),u=0,c=0,h=0;h<i;h+=4){var f=n[h],v=n[h+1],y=n[h+2],g=n[h+3];a[u++]=f,a[u++]=v,a[u++]=y,o[c++]=g}var _=this.__addimage__.arrayBufferToBinaryString(a);return{alpha:this.__addimage__.arrayBufferToBinaryString(o),data:_,index:e,alias:t,colorSpace:"DeviceRGB",bitsPerComponent:8,width:r.width,height:r.height}},At.API.setLanguage=function(r){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Spain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[r]!==void 0&&(this.internal.languageSettings.languageCode=r,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")}),this.internal.languageSettings.isSubscribed=!0)),this},tf=At.API,Wm=tf.getCharWidthsArray=function(r,e){var t,n,i=(e=e||{}).font||this.internal.getFont(),a=e.fontSize||this.internal.getFontSize(),o=e.charSpace||this.internal.getCharSpace(),u=e.widths?e.widths:i.metadata.Unicode.widths,c=u.fof?u.fof:1,h=e.kerning?e.kerning:i.metadata.Unicode.kerning,f=h.fof?h.fof:1,v=e.doKerning!==!1,y=0,g=r.length,_=0,E=u[0]||c,R=[];for(t=0;t<g;t++)n=r.charCodeAt(t),typeof i.metadata.widthOfString=="function"?R.push((i.metadata.widthOfGlyph(i.metadata.characterToGlyph(n))+o*(1e3/a)||0)/1e3):(y=v&&qr(h[n])==="object"&&!isNaN(parseInt(h[n][_],10))?h[n][_]/f:0,R.push((u[n]||E)/c+y)),_=n;return R},D8=tf.getStringUnitWidth=function(r,e){var t=(e=e||{}).fontSize||this.internal.getFontSize(),n=e.font||this.internal.getFont(),i=e.charSpace||this.internal.getCharSpace();return tf.processArabic&&(r=tf.processArabic(r)),typeof n.metadata.widthOfString=="function"?n.metadata.widthOfString(r,t,i)/t:Wm.apply(this,arguments).reduce(function(a,o){return a+o},0)},q8=function(r,e,t,n){for(var i=[],a=0,o=r.length,u=0;a!==o&&u+e[a]<t;)u+=e[a],a++;i.push(r.slice(0,a));var c=a;for(u=0;a!==o;)u+e[a]>n&&(i.push(r.slice(c,a)),u=0,c=a),u+=e[a],a++;return c!==a&&i.push(r.slice(c,a)),i},L8=function(r,e,t){t||(t={});var n,i,a,o,u,c,h,f=[],v=[f],y=t.textIndent||0,g=0,_=0,E=r.split(" "),R=Wm.apply(this,[" ",t])[0];if(c=t.lineIndent===-1?E[0].length+2:t.lineIndent||0){var T=Array(c).join(" "),k=[];E.map(function(A){(A=A.split(/\s*\n/)).length>1?k=k.concat(A.map(function(j,W){return(W&&j.length?`
|
|
615
615
|
`:"")+j})):k.push(A[0])}),E=k,c=D8.apply(this,[T,t])}for(a=0,o=E.length;a<o;a++){var N=0;if(n=E[a],c&&n[0]==`
|
|
616
|
-
`&&(n=n.substr(1),N=1),y+g+(_=(i=Wm.apply(this,[n,t])).reduce(function(A,j){return A+j},0))>e||N){if(_>e){for(u=q8.apply(this,[n,i,e-(y+g),e]),f.push(u.shift()),f=[u.pop()];u.length;)v.push([u.shift()]);_=i.slice(n.length-(f[0]?f[0].length:0)).reduce(function(A,j){return A+j},0)}else f=[n];v.push(f),y=_+c,g=R}else f.push(n),y+=g+_,g=R}return h=c?function(A,j){return(j?T:"")+A.join(" ")}:function(A){return A.join(" ")},v.map(h)},tf.splitTextToSize=function(r,e,t){var n,i=(t=t||{}).fontSize||this.internal.getFontSize(),a=function(f){if(f.widths&&f.kerning)return{widths:f.widths,kerning:f.kerning};var v=this.internal.getFont(f.fontName,f.fontStyle),y="Unicode";return v.metadata[y]?{widths:v.metadata[y].widths||{0:1},kerning:v.metadata[y].kerning||{}}:{font:v.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}.call(this,t);n=Array.isArray(r)?r:String(r).split(/\r?\n/);var o=1*this.internal.scaleFactor*e/i;a.textIndent=t.textIndent?1*t.textIndent*this.internal.scaleFactor/i:0,a.lineIndent=t.lineIndent;var u,c,h=[];for(u=0,c=n.length;u<c;u++)h=h.concat(L8.apply(this,[n[u],o,a]));return h},(function(r){r.__fontmetrics__=r.__fontmetrics__||{};for(var e="0123456789abcdef",t="klmnopqrstuvwxyz",n={},i={},a=0;a<16;a++)n[t[a]]=e[a],i[e[a]]=t[a];var o=function(y){return"0x"+parseInt(y,10).toString(16)},u=r.__fontmetrics__.compress=function(y){var g,_,E,R,T=["{"];for(var k in y){if(g=y[k],isNaN(parseInt(k,10))?_="'"+k+"'":(k=parseInt(k,10),_=(_=o(k).slice(2)).slice(0,-1)+i[_.slice(-1)]),typeof g=="number")g<0?(E=o(g).slice(3),R="-"):(E=o(g).slice(2),R=""),E=R+E.slice(0,-1)+i[E.slice(-1)];else{if(qr(g)!=="object")throw new Error("Don't know what to do with value type "+qr(g)+".");E=u(g)}T.push(_+E)}return T.push("}"),T.join("")},c=r.__fontmetrics__.uncompress=function(y){if(typeof y!="string")throw new Error("Invalid argument passed to uncompress.");for(var g,_,E,R,T={},k=1,N=T,A=[],j="",W="",G=y.length-1,D=1;D<G;D+=1)(R=y[D])=="'"?g?(E=g.join(""),g=void 0):g=[]:g?g.push(R):R=="{"?(A.push([N,E]),N={},E=void 0):R=="}"?((_=A.pop())[0][_[1]]=N,E=void 0,N=_[0]):R=="-"?k=-1:E===void 0?n.hasOwnProperty(R)?(j+=n[R],E=parseInt(j,16)*k,k=1,j=""):j+=R:n.hasOwnProperty(R)?(W+=n[R],N[E]=parseInt(W,16)*k,k=1,E=void 0,W=""):W+=R;return T},h={codePages:["WinAnsiEncoding"],WinAnsiEncoding:c("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},f={Unicode:{Courier:h,"Courier-Bold":h,"Courier-BoldOblique":h,"Courier-Oblique":h,Helvetica:h,"Helvetica-Bold":h,"Helvetica-BoldOblique":h,"Helvetica-Oblique":h,"Times-Roman":h,"Times-Bold":h,"Times-BoldItalic":h,"Times-Italic":h}},v={Unicode:{"Courier-Oblique":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":c("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":c("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":c("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:c("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:c("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":c("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:c("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":c("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":c("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":c("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};r.events.push(["addFont",function(y){var g=y.font,_=v.Unicode[g.postScriptName];_&&(g.metadata.Unicode={},g.metadata.Unicode.widths=_.widths,g.metadata.Unicode.kerning=_.kerning);var E=f.Unicode[g.postScriptName];E&&(g.metadata.Unicode.encoding=E,g.encoding=E.codePages[0])}])})(At.API),(function(r){var e=function(t){for(var n=t.length,i=new Uint8Array(n),a=0;a<n;a++)i[a]=t.charCodeAt(a);return i};r.API.events.push(["addFont",function(t){var n=void 0,i=t.font,a=t.instance;if(!i.isStandardFont){if(a===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");if(typeof(n=a.existsFileInVFS(i.postScriptName)===!1?a.loadFile(i.postScriptName):a.getFileFromVFS(i.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");(function(o,u){u=/^\x00\x01\x00\x00/.test(u)?e(u):e(i1(u)),o.metadata=r.API.TTFFont.open(u),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(i,n)}}])})(At),At.API.addSvgAsImage=function(r,e,t,n,i,a,o,u){if(isNaN(e)||isNaN(t))throw Yr.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(i))throw Yr.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var c=document.createElement("canvas");c.width=n,c.height=i;var h=c.getContext("2d");h.fillStyle="#fff",h.fillRect(0,0,c.width,c.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},v=this;return(Qt.canvg?Promise.resolve(Qt.canvg):r1(()=>import("./index.es-mDMtFUah.js"),[])).catch(function(y){return Promise.reject(new Error("Could not load canvg: "+y))}).then(function(y){return y.default?y.default:y}).then(function(y){return y.fromString(h,r,f)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(y){return y.render(f)}).then(function(){v.addImage(c.toDataURL("image/jpeg",1),e,t,n,i,o,u)})},At.API.putTotalPages=function(r){var e,t=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(r,"g"),t=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(r,this.internal.getFont()),"g"),t=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var i=0;i<this.internal.pages[n].length;i++)this.internal.pages[n][i]=this.internal.pages[n][i].replace(e,t);return this},At.API.viewerPreferences=function(r,e){var t;r=r||{},e=e||!1;var n,i,a,o={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},u=Object.keys(o),c=[],h=0,f=0,v=0;function y(_,E){var R,T=!1;for(R=0;R<_.length;R+=1)_[R]===E&&(T=!0);return T}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),t=this.internal.viewerpreferences.configuration,r==="reset"||e===!0){var g=u.length;for(v=0;v<g;v+=1)t[u[v]].value=t[u[v]].defaultValue,t[u[v]].explicitSet=!1}if(qr(r)==="object"){for(i in r)if(a=r[i],y(u,i)&&a!==void 0){if(t[i].type==="boolean"&&typeof a=="boolean")t[i].value=a;else if(t[i].type==="name"&&y(t[i].valueSet,a))t[i].value=a;else if(t[i].type==="integer"&&Number.isInteger(a))t[i].value=a;else if(t[i].type==="array"){for(h=0;h<a.length;h+=1)if(n=!0,a[h].length===1&&typeof a[h][0]=="number")c.push(String(a[h]-1));else if(a[h].length>1){for(f=0;f<a[h].length;f+=1)typeof a[h][f]!="number"&&(n=!1);n===!0&&c.push([a[h][0]-1,a[h][1]-1].join(" "))}t[i].value="["+c.join(" ")+"]"}else t[i].value=t[i].defaultValue;t[i].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var _,E=[];for(_ in t)t[_].explicitSet===!0&&(t[_].type==="name"?E.push("/"+_+" /"+t[_].value):E.push("/"+_+" "+t[_].value));E.length!==0&&this.internal.write(`/ViewerPreferences
|
|
616
|
+
`&&(n=n.substr(1),N=1),y+g+(_=(i=Wm.apply(this,[n,t])).reduce(function(A,j){return A+j},0))>e||N){if(_>e){for(u=q8.apply(this,[n,i,e-(y+g),e]),f.push(u.shift()),f=[u.pop()];u.length;)v.push([u.shift()]);_=i.slice(n.length-(f[0]?f[0].length:0)).reduce(function(A,j){return A+j},0)}else f=[n];v.push(f),y=_+c,g=R}else f.push(n),y+=g+_,g=R}return h=c?function(A,j){return(j?T:"")+A.join(" ")}:function(A){return A.join(" ")},v.map(h)},tf.splitTextToSize=function(r,e,t){var n,i=(t=t||{}).fontSize||this.internal.getFontSize(),a=function(f){if(f.widths&&f.kerning)return{widths:f.widths,kerning:f.kerning};var v=this.internal.getFont(f.fontName,f.fontStyle),y="Unicode";return v.metadata[y]?{widths:v.metadata[y].widths||{0:1},kerning:v.metadata[y].kerning||{}}:{font:v.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}.call(this,t);n=Array.isArray(r)?r:String(r).split(/\r?\n/);var o=1*this.internal.scaleFactor*e/i;a.textIndent=t.textIndent?1*t.textIndent*this.internal.scaleFactor/i:0,a.lineIndent=t.lineIndent;var u,c,h=[];for(u=0,c=n.length;u<c;u++)h=h.concat(L8.apply(this,[n[u],o,a]));return h},(function(r){r.__fontmetrics__=r.__fontmetrics__||{};for(var e="0123456789abcdef",t="klmnopqrstuvwxyz",n={},i={},a=0;a<16;a++)n[t[a]]=e[a],i[e[a]]=t[a];var o=function(y){return"0x"+parseInt(y,10).toString(16)},u=r.__fontmetrics__.compress=function(y){var g,_,E,R,T=["{"];for(var k in y){if(g=y[k],isNaN(parseInt(k,10))?_="'"+k+"'":(k=parseInt(k,10),_=(_=o(k).slice(2)).slice(0,-1)+i[_.slice(-1)]),typeof g=="number")g<0?(E=o(g).slice(3),R="-"):(E=o(g).slice(2),R=""),E=R+E.slice(0,-1)+i[E.slice(-1)];else{if(qr(g)!=="object")throw new Error("Don't know what to do with value type "+qr(g)+".");E=u(g)}T.push(_+E)}return T.push("}"),T.join("")},c=r.__fontmetrics__.uncompress=function(y){if(typeof y!="string")throw new Error("Invalid argument passed to uncompress.");for(var g,_,E,R,T={},k=1,N=T,A=[],j="",W="",G=y.length-1,D=1;D<G;D+=1)(R=y[D])=="'"?g?(E=g.join(""),g=void 0):g=[]:g?g.push(R):R=="{"?(A.push([N,E]),N={},E=void 0):R=="}"?((_=A.pop())[0][_[1]]=N,E=void 0,N=_[0]):R=="-"?k=-1:E===void 0?n.hasOwnProperty(R)?(j+=n[R],E=parseInt(j,16)*k,k=1,j=""):j+=R:n.hasOwnProperty(R)?(W+=n[R],N[E]=parseInt(W,16)*k,k=1,E=void 0,W=""):W+=R;return T},h={codePages:["WinAnsiEncoding"],WinAnsiEncoding:c("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},f={Unicode:{Courier:h,"Courier-Bold":h,"Courier-BoldOblique":h,"Courier-Oblique":h,Helvetica:h,"Helvetica-Bold":h,"Helvetica-BoldOblique":h,"Helvetica-Oblique":h,"Times-Roman":h,"Times-Bold":h,"Times-BoldItalic":h,"Times-Italic":h}},v={Unicode:{"Courier-Oblique":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":c("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":c("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":c("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:c("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:c("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":c("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:c("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":c("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":c("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":c("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};r.events.push(["addFont",function(y){var g=y.font,_=v.Unicode[g.postScriptName];_&&(g.metadata.Unicode={},g.metadata.Unicode.widths=_.widths,g.metadata.Unicode.kerning=_.kerning);var E=f.Unicode[g.postScriptName];E&&(g.metadata.Unicode.encoding=E,g.encoding=E.codePages[0])}])})(At.API),(function(r){var e=function(t){for(var n=t.length,i=new Uint8Array(n),a=0;a<n;a++)i[a]=t.charCodeAt(a);return i};r.API.events.push(["addFont",function(t){var n=void 0,i=t.font,a=t.instance;if(!i.isStandardFont){if(a===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");if(typeof(n=a.existsFileInVFS(i.postScriptName)===!1?a.loadFile(i.postScriptName):a.getFileFromVFS(i.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");(function(o,u){u=/^\x00\x01\x00\x00/.test(u)?e(u):e(i1(u)),o.metadata=r.API.TTFFont.open(u),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(i,n)}}])})(At),At.API.addSvgAsImage=function(r,e,t,n,i,a,o,u){if(isNaN(e)||isNaN(t))throw Yr.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(i))throw Yr.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var c=document.createElement("canvas");c.width=n,c.height=i;var h=c.getContext("2d");h.fillStyle="#fff",h.fillRect(0,0,c.width,c.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},v=this;return(Qt.canvg?Promise.resolve(Qt.canvg):r1(()=>import("./index.es-N8C_lFOW.js"),[])).catch(function(y){return Promise.reject(new Error("Could not load canvg: "+y))}).then(function(y){return y.default?y.default:y}).then(function(y){return y.fromString(h,r,f)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(y){return y.render(f)}).then(function(){v.addImage(c.toDataURL("image/jpeg",1),e,t,n,i,o,u)})},At.API.putTotalPages=function(r){var e,t=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(r,"g"),t=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(r,this.internal.getFont()),"g"),t=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var i=0;i<this.internal.pages[n].length;i++)this.internal.pages[n][i]=this.internal.pages[n][i].replace(e,t);return this},At.API.viewerPreferences=function(r,e){var t;r=r||{},e=e||!1;var n,i,a,o={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},u=Object.keys(o),c=[],h=0,f=0,v=0;function y(_,E){var R,T=!1;for(R=0;R<_.length;R+=1)_[R]===E&&(T=!0);return T}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),t=this.internal.viewerpreferences.configuration,r==="reset"||e===!0){var g=u.length;for(v=0;v<g;v+=1)t[u[v]].value=t[u[v]].defaultValue,t[u[v]].explicitSet=!1}if(qr(r)==="object"){for(i in r)if(a=r[i],y(u,i)&&a!==void 0){if(t[i].type==="boolean"&&typeof a=="boolean")t[i].value=a;else if(t[i].type==="name"&&y(t[i].valueSet,a))t[i].value=a;else if(t[i].type==="integer"&&Number.isInteger(a))t[i].value=a;else if(t[i].type==="array"){for(h=0;h<a.length;h+=1)if(n=!0,a[h].length===1&&typeof a[h][0]=="number")c.push(String(a[h]-1));else if(a[h].length>1){for(f=0;f<a[h].length;f+=1)typeof a[h][f]!="number"&&(n=!1);n===!0&&c.push([a[h][0]-1,a[h][1]-1].join(" "))}t[i].value="["+c.join(" ")+"]"}else t[i].value=t[i].defaultValue;t[i].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var _,E=[];for(_ in t)t[_].explicitSet===!0&&(t[_].type==="name"?E.push("/"+_+" /"+t[_].value):E.push("/"+_+" "+t[_].value));E.length!==0&&this.internal.write(`/ViewerPreferences
|
|
617
617
|
<<
|
|
618
618
|
`+E.join(`
|
|
619
619
|
`)+`
|
|
@@ -727,7 +727,7 @@ end`};e.events.push(["putFont",function(a){(function(o){var u=o.font,c=o.out,h=o
|
|
|
727
727
|
`);const n=String(e).split(`
|
|
728
728
|
`),i=n.length;if(t.multi)for(let a=0;a<i;a++){const o=this.splitBlocks(n[a],t.multi);if(o!==void 0){if(o.length===0){this.lines.newLine("");continue}if(t.maxWdt>0)for(let u=0;u<o.length;u++){const c=o[u].mod,h=o[u].text;this.splitStringIntoLines(h,c,!0)}else for(let u=0;u<o.length;u++){const c=o[u].mod,h=o[u].text;this.lines.append(h,c)}this.lines.newLine()}}else if(t.maxWdt>0)for(let a=0;a<i;a++)this.splitStringIntoLines(n[a]);else for(let a=0;a<i;a++)this.lines.newLine(n[a]);return this.lines.finalize()}decodeMarkupSystem(e){let t="none";return e==="markdown"||e==="md"?t="markdown":(e===!0||e==="html")&&(t="html"),t}splitHtmlBlocks(e){const t=new CW(e),n=i=>/&/.test(i)?(t.replace(t.text,"<","<")||t.replace(t.text,"&","&")||t.add("&"),!0):!1;for(;t.position<t.text.length;){const i=t.text.charAt(t.position);t.parseWS(i)||/</.test(i)&&(t.parseStartTag("bold","<b>")||t.parseStartTag("ital","<i>")||t.parseStartTag("mono","<code>")||t.parseEndTag("bold","</b>")||t.parseEndTag("ital","</i>")||t.parseEndTag("mono","</code>"))||n(i)||t.add(i),t.position++}return t.emitBlock(),t.blocks}splitMarkdownBlocks(e){const t=new CW(e);let n=!0;const i=a=>/\\/.test(a)?(t.position<this.text.length+1&&(t.position++,a=this.text.charAt(t.position),/ \t/.test(a)?t.spacing=!0:(t.add(a),n=!1)),!0):!1;for(;t.position<t.text.length;){const a=t.text.charAt(t.position);t.parseWS(a)||i(a)||(n||t.spacing)&&(t.parseStartTag("bold","*")||t.parseStartTag("ital","_")||t.parseStartTag("mono","`"))||t.parseEndTag("bold","*","afterBold")||t.parseEndTag("ital","_","afterItal")||t.parseEndTag("mono","`","afterMono")||(t.add(a),n=!1),t.position++}return t.emitBlock(),t.blocks}splitBlocks(e,t){const n=this.decodeMarkupSystem(t);if(n==="none")return[{text:e,mod:"normal"}];if(n==="markdown")return this.splitMarkdownBlocks(e);if(n==="html")return this.splitHtmlBlocks(e)}overMaxWidth(e){const t=this.ctx.measureText(e).width;return this.lines.curWidth()+t>this.parent.fontOptions.maxWdt}getLongestFit(e){let t="",n=0;for(;n<e.length;){const a=t+(t===""?"":" ")+e[n];if(this.overMaxWidth(a))break;t=a,n++}return n}getLongestFitWord(e){let t=0;for(;t<e.length&&!this.overMaxWidth(nl(e).call(e,0,t));)t++;return t}splitStringIntoLines(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,"$1\r"),e=e.replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r");let i=e.split("\r");for(;i.length>0;){let a=this.getLongestFit(i);if(a===0){const o=i[0],u=this.getLongestFitWord(o);this.lines.newLine(nl(o).call(o,0,u),t),i[0]=nl(o).call(o,u)}else{let o=a;i[a-1]===" "?a--:i[o]===" "&&o++;const u=nl(i).call(i,0,a).join("");a==i.length&&n?this.lines.append(u,t):this.lines.newLine(u,t),i=nl(i).call(i,o)}}}}const fv=["bold","ital","boldital","mono"];class _f{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.body=e,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(t),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=n}setOptions(e){if(this.elementOptions=e,this.initFontOptions(e.font),q1(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font=="string")this.baseSize=this.fontOptions.size;else if(typeof e.font=="object"){const t=e.font.size;t!==void 0&&(this.baseSize=t)}}}initFontOptions(e){if(cr(fv,t=>{this.fontOptions[t]={}}),_f.parseFontString(this.fontOptions,e)){this.fontOptions.vadjust=0;return}cr(e,(t,n)=>{t!=null&&typeof t!="object"&&(this.fontOptions[n]=t)})}static parseFontString(e,t){if(!t||typeof t!="string")return!1;const n=t.split(" ");return e.size=+n[0].replace("px",""),e.face=n[1],e.color=n[2],!0}constrain(e){const t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},n=yc(e,"widthConstraint");if(typeof n=="number")t.maxWdt=Number(n),t.minWdt=Number(n);else if(typeof n=="object"){const a=yc(e,["widthConstraint","maximum"]);typeof a=="number"&&(t.maxWdt=Number(a));const o=yc(e,["widthConstraint","minimum"]);typeof o=="number"&&(t.minWdt=Number(o))}const i=yc(e,"heightConstraint");if(typeof i=="number")t.minHgt=Number(i);else if(typeof i=="object"){const a=yc(e,["heightConstraint","minimum"]);typeof a=="number"&&(t.minHgt=Number(a));const o=yc(e,["heightConstraint","valign"]);typeof o=="string"&&(o==="top"||o==="bottom")&&(t.valign=o)}return t}update(e,t){this.setOptions(e,!0),this.propagateFonts(t),rn(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=VR("label",t)}adjustSizes(e){const t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);const n=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=n)}addFontOptionsToPile(e,t){for(let n=0;n<t.length;++n)this.addFontToPile(e,t[n])}addFontToPile(e,t){if(t===void 0||t.font===void 0||t.font===null)return;const n=t.font;e.push(n)}getBasicOptions(e){const t={};for(let n=0;n<e.length;++n){let i=e[n];const a={};_f.parseFontString(a,i)&&(i=a),cr(i,(o,u)=>{o!==void 0&&(Object.prototype.hasOwnProperty.call(t,u)||(Lr(fv).call(fv,u)!==-1?t[u]={}:t[u]=o))})}return t}getFontOption(e,t,n){let i;for(let a=0;a<e.length;++a){const o=e[a];if(Object.prototype.hasOwnProperty.call(o,t)){if(i=o[t],i==null)continue;const u={};if(_f.parseFontString(u,i)&&(i=u),Object.prototype.hasOwnProperty.call(i,n))return i[n]}}if(Object.prototype.hasOwnProperty.call(this.fontOptions,n))return this.fontOptions[n];throw new Error("Did not find value for multi-font for property: '"+n+"'")}getFontOptions(e,t){const n={},i=["color","size","face","mod","vadjust"];for(let a=0;a<i.length;++a){const o=i[a];n[o]=this.getFontOption(e,t,o)}return n}propagateFonts(e){const t=[];this.addFontOptionsToPile(t,e),this.fontOptions=this.getBasicOptions(t);for(let n=0;n<fv.length;++n){const i=fv[n],a=this.fontOptions[i],o=this.getFontOptions(t,i);cr(o,(u,c)=>{a[c]=u}),a.size=Number(a.size),a.vadjust=Number(a.vadjust)}}draw(e,t,n,i,a){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";if(this.elementOptions.label===void 0)return;let u=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&u<this.elementOptions.scaling.label.drawThreshold-1||(u>=this.elementOptions.scaling.label.maxVisible&&(u=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,i,a,t,n,o),this._drawBackground(e),this._drawText(e,t,this.size.yLine,o,u))}_drawBackground(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!=="none"){e.fillStyle=this.fontOptions.background;const t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}_drawText(e,t,n){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle",a=arguments.length>4?arguments[4]:void 0;[t,n]=this._setAlignment(e,t,n,i),e.textAlign="left",t=t-this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign==="top"&&(n-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign==="bottom"&&(n+=(this.size.height-this.size.labelHeight)/2));for(let o=0;o<this.lineCount;o++){const u=this.lines[o];if(u&&u.blocks){let c=0;this.isEdgeLabel||this.fontOptions.align==="center"?c+=(this.size.width-u.width)/2:this.fontOptions.align==="right"&&(c+=this.size.width-u.width);for(let h=0;h<u.blocks.length;h++){const f=u.blocks[h];e.font=f.font;const[v,y]=this._getColor(f.color,a,f.strokeColor);f.strokeWidth>0&&(e.lineWidth=f.strokeWidth,e.strokeStyle=y,e.lineJoin="round"),e.fillStyle=v,f.strokeWidth>0&&e.strokeText(f.text,t+c,n+f.vadjust),e.fillText(f.text,t+c,n+f.vadjust),c+=f.width}n+=u.height}}}_setAlignment(e,t,n,i){if(this.isEdgeLabel&&this.fontOptions.align!=="horizontal"&&this.pointToSelf===!1){t=0,n=0;const a=2;this.fontOptions.align==="top"?(e.textBaseline="alphabetic",n-=2*a):this.fontOptions.align==="bottom"?(e.textBaseline="hanging",n+=2*a):e.textBaseline="middle"}else e.textBaseline=i;return[t,n]}_getColor(e,t,n){let i=e||"#000000",a=n||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){const o=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));i=Is(i,o),a=Is(a,o)}return[i,a]}getTextSize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,n),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}getSize(){let t=this.size.left,n=this.size.top-.5*2;if(this.isEdgeLabel){const a=-this.size.width*.5;switch(this.fontOptions.align){case"middle":t=a,n=-this.size.height*.5;break;case"top":t=a,n=-(this.size.height+2);break;case"bottom":t=a,n=2;break}}return{left:t,top:n,width:this.size.width,height:this.size.height}}calculateLabelSize(e,t,n){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";this._processLabel(e,t,n),this.size.left=i-this.size.width*.5,this.size.top=a-this.size.height*.5,this.size.yLine=a+(1-this.lineCount)*.5*this.fontOptions.size,o==="hanging"&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}getFormattingValues(e,t,n,i){const a=function(c,h,f){return h==="normal"?f==="mod"?"":c[f]:c[h][f]!==void 0?c[h][f]:c[f]},o={color:a(this.fontOptions,i,"color"),size:a(this.fontOptions,i,"size"),face:a(this.fontOptions,i,"face"),mod:a(this.fontOptions,i,"mod"),vadjust:a(this.fontOptions,i,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||n)&&(i==="normal"&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?o.mod="bold":typeof this.fontOptions.chooser=="function"&&this.fontOptions.chooser(o,this.elementOptions.id,t,n));let u="";return o.mod!==void 0&&o.mod!==""&&(u+=o.mod+" "),u+=o.size+"px "+o.face,e.font=u.replace(/"/g,""),o.font=e.font,o.height=o.size,o}differentState(e,t){return e!==this.selectedState||t!==this.hoverState}_processLabelText(e,t,n,i){return new Hbe(e,this,t,n).process(i)}_processLabel(e,t,n){if(this.labelDirty===!1&&!this.differentState(t,n))return;const i=this._processLabelText(e,t,n,this.elementOptions.label);this.fontOptions.minWdt>0&&i.width<this.fontOptions.minWdt&&(i.width=this.fontOptions.minWdt),this.size.labelHeight=i.height,this.fontOptions.minHgt>0&&i.height<this.fontOptions.minHgt&&(i.height=this.fontOptions.minHgt),this.lines=i.lines,this.lineCount=i.lines.length,this.size.width=i.width,this.size.height=i.height,this.selectedState=t,this.hoverState=n,this.labelDirty=!1}visible(){return!(this.size.width===0||this.size.height===0||this.elementOptions.label===void 0||this.fontOptions.size*this.body.view.scale<this.elementOptions.scaling.label.drawThreshold-1)}}class rh{constructor(e,t,n){this.body=t,this.labelModule=n,this.setOptions(e),this.top=void 0,this.left=void 0,this.height=void 0,this.width=void 0,this.radius=void 0,this.margin=void 0,this.refreshNeeded=!0,this.boundingBox={top:0,left:0,right:0,bottom:0}}setOptions(e){this.options=e}_setMargins(e){this.margin={},this.options.margin&&(typeof this.options.margin=="object"?(this.margin.top=this.options.margin.top,this.margin.right=this.options.margin.right,this.margin.bottom=this.options.margin.bottom,this.margin.left=this.options.margin.left):(this.margin.top=this.options.margin,this.margin.right=this.options.margin,this.margin.bottom=this.options.margin,this.margin.left=this.options.margin)),e.adjustSizes(this.margin)}_distanceToBorder(e,t){const n=this.options.borderWidth;return e&&this.resize(e),Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+n}enableShadow(e,t){t.shadow&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}disableShadow(e,t){t.shadow&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}enableBorderDashes(e,t){if(t.borderDashes!==!1)if(e.setLineDash!==void 0){let n=t.borderDashes;n===!0&&(n=[5,15]),e.setLineDash(n)}else console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."),this.options.shapeProperties.borderDashes=!1,t.borderDashes=!1}disableBorderDashes(e,t){t.borderDashes!==!1&&(e.setLineDash!==void 0?e.setLineDash([0]):(console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."),this.options.shapeProperties.borderDashes=!1,t.borderDashes=!1))}needsRefresh(e,t){return this.refreshNeeded===!0?(this.refreshNeeded=!1,!0):this.width===void 0||this.labelModule.differentState(e,t)}initContextForDraw(e,t){const n=t.borderWidth/this.body.view.scale;e.lineWidth=Math.min(this.width,n),e.strokeStyle=t.borderColor,e.fillStyle=t.color}performStroke(e,t){const n=t.borderWidth/this.body.view.scale;e.save(),n>0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}performFill(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),Cg(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}_addBoundingBoxMargin(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}_updateBoundingBox(e,t,n,i,a){n!==void 0&&this.resize(n,i,a),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}updateBoundingBox(e,t,n,i,a){this._updateBoundingBox(e,t,n,i,a)}getDimensionsFromLabel(e,t,n){this.textSize=this.labelModule.getTextSize(e,t,n);let i=this.textSize.width,a=this.textSize.height;const o=14;return i===0&&(i=o,a=o),{width:i,height:a}}}let Wbe=class extends rh{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,n)){const i=this.getDimensionsFromLabel(e,t,n);this.width=i.width+this.margin.right+this.margin.left,this.height=i.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}draw(e,t,n,i,a,o){this.resize(e,i,a),this.left=t-this.width/2,this.top=n-this.height/2,this.initContextForDraw(e,o),IX(e,this.left,this.top,this.width,this.height,o.borderRadius),this.performFill(e,o),this.updateBoundingBox(t,n,e,i,a),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,i,a)}updateBoundingBox(e,t,n,i,a){this._updateBoundingBox(e,t,n,i,a);const o=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(o)}distanceToBorder(e,t){e&&this.resize(e);const n=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+n}};class YR extends rh{constructor(e,t,n){super(e,t,n),this.labelOffset=0,this.selected=!1}setOptions(e,t,n){this.options=e,t===void 0&&n===void 0||this.setImages(t,n)}setImages(e,t){t&&this.selected?(this.imageObj=t,this.imageObjAlt=e):(this.imageObj=e,this.imageObjAlt=t)}switchImages(e){const t=e&&!this.selected||!e&&this.selected;if(this.selected=e,this.imageObjAlt!==void 0&&t){const n=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=n}}_getImagePadding(){const e={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){const t=this.options.imagePadding;typeof t=="object"?(e.top=t.top,e.right=t.right,e.bottom=t.bottom,e.left=t.left):(e.top=t,e.right=t,e.bottom=t,e.left=t)}return e}_resizeImage(){let e,t;if(this.options.shapeProperties.useImageSize===!1){let n=1,i=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?n=this.imageObj.width/this.imageObj.height:i=this.imageObj.height/this.imageObj.width),e=this.options.size*2*n,t=this.options.size*2*i}else{const n=this._getImagePadding();e=this.imageObj.width+n.left+n.right,t=this.imageObj.height+n.top+n.bottom}this.width=e,this.height=t,this.radius=.5*this.width}_drawRawCircle(e,t,n,i){this.initContextForDraw(e,i),wR(e,t,n,i.size),this.performFill(e,i)}_drawImageAtPosition(e,t){if(this.imageObj.width!=0){e.globalAlpha=t.opacity!==void 0?t.opacity:1,this.enableShadow(e,t);let n=1;this.options.shapeProperties.interpolation===!0&&(n=this.imageObj.width/this.width/this.body.view.scale);const i=this._getImagePadding(),a=this.left+i.left,o=this.top+i.top,u=this.width-i.left-i.right,c=this.height-i.top-i.bottom;this.imageObj.drawImageAtPosition(e,n,a,o,u,c),this.disableShadow(e,t)}}_drawImageLabel(e,t,n,i,a){let o=0;if(this.height!==void 0){o=this.height*.5;const c=this.labelModule.getTextSize(e,i,a);c.lineCount>=1&&(o+=c.height/2)}const u=n+o;this.options.label&&(this.labelOffset=o),this.labelModule.draw(e,t,u,i,a,"hanging")}}let Gbe=class extends YR{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,n)){const i=this.getDimensionsFromLabel(e,t,n),a=Math.max(i.width+this.margin.right+this.margin.left,i.height+this.margin.top+this.margin.bottom);this.options.size=a/2,this.width=a,this.height=a,this.radius=this.width/2}}draw(e,t,n,i,a,o){this.resize(e,i,a),this.left=t-this.width/2,this.top=n-this.height/2,this._drawRawCircle(e,t,n,o),this.updateBoundingBox(t,n),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,n,i,a)}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size}distanceToBorder(e){return e&&this.resize(e),this.width*.5}};class Vbe extends YR{constructor(e,t,n,i,a){super(e,t,n),this.setImages(i,a)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){const a=this.options.size*2;this.width=a,this.height=a,this.radius=.5*this.width;return}this.needsRefresh(t,n)&&this._resizeImage()}draw(e,t,n,i,a,o){this.switchImages(i),this.resize();let u=t,c=n;this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=t,this.top=n,u+=this.width/2,c+=this.height/2):(this.left=t-this.width/2,this.top=n-this.height/2),this._drawRawCircle(e,u,c,o),e.save(),e.clip(),this._drawImageAtPosition(e,o),e.restore(),this._drawImageLabel(e,u,c,i,a),this.updateBoundingBox(t,n)}updateBoundingBox(e,t){this.options.shapeProperties.coordinateOrigin==="top-left"?(this.boundingBox.top=t,this.boundingBox.left=e,this.boundingBox.right=e+this.options.size*2,this.boundingBox.bottom=t+this.options.size*2):(this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}distanceToBorder(e){return e&&this.resize(e),this.width*.5}}class zc extends rh{constructor(e,t,n){super(e,t,n)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(t,n)){var a,o;this.labelModule.getTextSize(e,t,n);const u=2*i.size;this.width=(a=this.customSizeWidth)!==null&&a!==void 0?a:u,this.height=(o=this.customSizeHeight)!==null&&o!==void 0?o:u,this.radius=.5*this.width}}_drawShape(e,t,n,i,a,o,u,c){return this.resize(e,o,u,c),this.left=i-this.width/2,this.top=a-this.height/2,this.initContextForDraw(e,c),uve(t)(e,i,a,c.size),this.performFill(e,c),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(e.font=(o?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",e.fillText(this.options.icon.code,i,a)),{drawExternalLabel:()=>{if(this.options.label!==void 0){this.labelModule.calculateLabelSize(e,o,u,i,a,"hanging");const h=a+.5*this.height+.5*this.labelModule.size.height;this.labelModule.draw(e,i,h,o,u,"hanging")}this.updateBoundingBox(i,a)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}function kW(r,e){var t=Pn(r);if(Ic){var n=Ic(r);e&&(n=Da(n).call(n,function(i){return Fc(r,i).enumerable})),t.push.apply(t,n)}return t}function Ybe(r){for(var e=1;e<arguments.length;e++){var t,n,i=arguments[e]!=null?arguments[e]:{};e%2?Kr(t=kW(Object(i),!0)).call(t,function(a){iu(r,a,i[a])}):jc?Sy(r,jc(i)):Kr(n=kW(Object(i))).call(n,function(a){Ey(r,a,Fc(i,a))})}return r}class Kbe extends zc{constructor(e,t,n,i){super(e,t,n,i),this.ctxRenderer=i}draw(e,t,n,i,a,o){this.resize(e,i,a,o),this.left=t-this.width/2,this.top=n-this.height/2,e.save();const u=this.ctxRenderer({ctx:e,id:this.options.id,x:t,y:n,state:{selected:i,hover:a},style:Ybe({},o),label:this.options.label});if(u.drawNode!=null&&u.drawNode(),e.restore(),u.drawExternalLabel){const c=u.drawExternalLabel;u.drawExternalLabel=()=>{e.save(),c(),e.restore()}}return u.nodeDimensions&&(this.customSizeWidth=u.nodeDimensions.width,this.customSizeHeight=u.nodeDimensions.height),u}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class Xbe extends rh{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e,t,n){if(this.needsRefresh(t,n)){const a=this.getDimensionsFromLabel(e,t,n).width+this.margin.right+this.margin.left;this.width=a,this.height=a,this.radius=this.width/2}}draw(e,t,n,i,a,o){this.resize(e,i,a),this.left=t-this.width/2,this.top=n-this.height/2,this.initContextForDraw(e,o),jX(e,t-this.width/2,n-this.height/2,this.width,this.height),this.performFill(e,o),this.updateBoundingBox(t,n,e,i,a),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let Qbe=class extends zc{constructor(e,t,n){super(e,t,n)}draw(e,t,n,i,a,o){return this._drawShape(e,"diamond",4,t,n,i,a,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class Zbe extends zc{constructor(e,t,n){super(e,t,n)}draw(e,t,n,i,a,o){return this._drawShape(e,"circle",2,t,n,i,a,o)}distanceToBorder(e){return e&&this.resize(e),this.options.size}}class NW extends rh{constructor(e,t,n){super(e,t,n)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,n)){const i=this.getDimensionsFromLabel(e,t,n);this.height=i.height*2,this.width=i.width+i.height,this.radius=.5*this.width}}draw(e,t,n,i,a,o){this.resize(e,i,a),this.left=t-this.width*.5,this.top=n-this.height*.5,this.initContextForDraw(e,o),l6(e,this.left,this.top,this.width,this.height),this.performFill(e,o),this.updateBoundingBox(t,n,e,i,a),this.labelModule.draw(e,t,n,i,a)}distanceToBorder(e,t){e&&this.resize(e);const n=this.width*.5,i=this.height*.5,a=Math.sin(t)*n,o=Math.cos(t)*i;return n*i/Math.sqrt(a*a+o*o)}}class Jbe extends rh{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e,t,n){this.needsRefresh(t,n)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,n,i,a,o){return this.resize(e,i,a),this.options.icon.size=this.options.icon.size||50,this.left=t-this.width/2,this.top=n-this.height/2,this._icon(e,t,n,i,a,o),{drawExternalLabel:()=>{this.options.label!==void 0&&this.labelModule.draw(e,this.left+this.iconSize.width/2+this.margin.left,n+this.height/2+5,i),this.updateBoundingBox(t,n)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.icon.size*.5,this.boundingBox.left=e-this.options.icon.size*.5,this.boundingBox.right=e+this.options.icon.size*.5,this.boundingBox.bottom=t+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+5))}_icon(e,t,n,i,a,o){const u=Number(this.options.icon.size);this.options.icon.code!==void 0?(e.font=[this.options.icon.weight!=null?this.options.icon.weight:i?"bold":"",(this.options.icon.weight!=null&&i?5:0)+u+"px",this.options.icon.face].join(" "),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",this.enableShadow(e,o),e.fillText(this.options.icon.code,t,n),this.disableShadow(e,o)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let e2e=class extends YR{constructor(e,t,n,i,a){super(e,t,n),this.setImages(i,a)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){const a=this.options.size*2;this.width=a,this.height=a;return}this.needsRefresh(t,n)&&this._resizeImage()}draw(e,t,n,i,a,o){e.save(),this.switchImages(i),this.resize();let u=t,c=n;if(this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=t,this.top=n,u+=this.width/2,c+=this.height/2):(this.left=t-this.width/2,this.top=n-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){const h=this.options.borderWidth,f=this.options.borderWidthSelected||2*this.options.borderWidth,v=(i?f:h)/this.body.view.scale;e.lineWidth=Math.min(this.width,v),e.beginPath();let y=i?this.options.color.highlight.border:a?this.options.color.hover.border:this.options.color.border,g=i?this.options.color.highlight.background:a?this.options.color.hover.background:this.options.color.background;o.opacity!==void 0&&(y=Is(y,o.opacity),g=Is(g,o.opacity)),e.strokeStyle=y,e.fillStyle=g,e.rect(this.left-.5*e.lineWidth,this.top-.5*e.lineWidth,this.width+e.lineWidth,this.height+e.lineWidth),Cg(e).call(e),this.performStroke(e,o),e.closePath()}this._drawImageAtPosition(e,o),this._drawImageLabel(e,u,c,i,a),this.updateBoundingBox(t,n),e.restore()}updateBoundingBox(e,t){this.resize(),this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=e,this.top=t):(this.left=e-this.width/2,this.top=t-this.height/2),this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class t2e extends zc{constructor(e,t,n){super(e,t,n)}draw(e,t,n,i,a,o){return this._drawShape(e,"square",2,t,n,i,a,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class r2e extends zc{constructor(e,t,n){super(e,t,n)}draw(e,t,n,i,a,o){return this._drawShape(e,"hexagon",4,t,n,i,a,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class n2e extends zc{constructor(e,t,n){super(e,t,n)}draw(e,t,n,i,a,o){return this._drawShape(e,"star",4,t,n,i,a,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class i2e extends rh{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e,t,n){this.needsRefresh(t,n)&&(this.textSize=this.labelModule.getTextSize(e,t,n),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,n,i,a,o){this.resize(e,i,a),this.left=t-this.width/2,this.top=n-this.height/2,this.enableShadow(e,o),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,i,a),this.disableShadow(e,o),this.updateBoundingBox(t,n,e,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let a2e=class extends zc{constructor(e,t,n){super(e,t,n)}draw(e,t,n,i,a,o){return this._drawShape(e,"triangle",3,t,n,i,a,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class s2e extends zc{constructor(e,t,n){super(e,t,n)}draw(e,t,n,i,a,o){return this._drawShape(e,"triangleDown",3,t,n,i,a,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}function IW(r,e){var t=Pn(r);if(Ic){var n=Ic(r);e&&(n=Da(n).call(n,function(i){return Fc(r,i).enumerable})),t.push.apply(t,n)}return t}function jW(r){for(var e=1;e<arguments.length;e++){var t,n,i=arguments[e]!=null?arguments[e]:{};e%2?Kr(t=IW(Object(i),!0)).call(t,function(a){iu(r,a,i[a])}):jc?Sy(r,jc(i)):Kr(n=IW(Object(i))).call(n,function(a){Ey(r,a,Fc(i,a))})}return r}class gn{constructor(e,t,n,i,a,o){this.options=Ac(a),this.globalOptions=a,this.defaultOptions=o,this.body=t,this.edges=[],this.id=void 0,this.imagelist=n,this.grouplist=i,this.x=void 0,this.y=void 0,this.baseSize=this.options.size,this.baseFontSize=this.options.font.size,this.predefinedPosition=!1,this.selected=!1,this.hover=!1,this.labelModule=new _f(this.body,this.options,!1),this.setOptions(e)}attachEdge(e){var t;Lr(t=this.edges).call(t,e)===-1&&this.edges.push(e)}detachEdge(e){var t;const n=Lr(t=this.edges).call(t,e);if(n!=-1){var i;cu(i=this.edges).call(i,n,1)}}setOptions(e){const t=this.options.shape;if(!e)return;if(typeof e.color<"u"&&(this._localColor=e.color),e.id!==void 0&&(this.id=e.id),this.id===void 0)throw new Error("Node must have an id");gn.checkMass(e,this.id),e.x!==void 0&&(e.x===null?(this.x=void 0,this.predefinedPosition=!1):(this.x=bo(e.x),this.predefinedPosition=!0)),e.y!==void 0&&(e.y===null?(this.y=void 0,this.predefinedPosition=!1):(this.y=bo(e.y),this.predefinedPosition=!0)),e.size!==void 0&&(this.baseSize=e.size),e.value!==void 0&&(e.value=WQ(e.value)),gn.parseOptions(this.options,e,!0,this.globalOptions,this.grouplist);const n=[e,this.options,this.defaultOptions];return this.chooser=VR("node",n),this._load_images(),this.updateLabelModule(e),e.opacity!==void 0&&gn.checkOpacity(e.opacity)&&(this.options.opacity=e.opacity),this.updateShape(t),e.hidden!==void 0||e.physics!==void 0}_load_images(){if((this.options.shape==="circularImage"||this.options.shape==="image")&&this.options.image===void 0)throw new Error("Option image must be defined for node type '"+this.options.shape+"'");if(this.options.image!==void 0){if(this.imagelist===void 0)throw new Error("Internal Error: No images provided");if(typeof this.options.image=="string")this.imageObj=this.imagelist.load(this.options.image,this.options.brokenImage,this.id);else{if(this.options.image.unselected===void 0)throw new Error("No unselected image provided");this.imageObj=this.imagelist.load(this.options.image.unselected,this.options.brokenImage,this.id),this.options.image.selected!==void 0?this.imageObjAlt=this.imagelist.load(this.options.image.selected,this.options.brokenImage,this.id):this.imageObjAlt=void 0}}}static checkOpacity(e){return 0<=e&&e<=1}static checkCoordinateOrigin(e){return e===void 0||e==="center"||e==="top-left"}static updateGroupOptions(e,t,n){var i;if(n===void 0)return;const a=e.group;if(t!==void 0&&t.group!==void 0&&a!==t.group)throw new Error("updateGroupOptions: group values in options don't match.");if(!(typeof a=="number"||typeof a=="string"&&a!=""))return;const u=n.get(a);u.opacity!==void 0&&t.opacity===void 0&&(gn.checkOpacity(u.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+u.opacity),u.opacity=void 0));const c=Da(i=vbe(t)).call(i,h=>t[h]!=null);c.push("font"),M1(c,e,u),e.color=f6(e.color)}static parseOptions(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=arguments.length>4?arguments[4]:void 0;if(M1(["color","fixed","shadow"],e,t,n),gn.checkMass(t),e.opacity!==void 0&&(gn.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),t.opacity!==void 0&&(gn.checkOpacity(t.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+t.opacity),t.opacity=void 0)),t.shapeProperties&&!gn.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),Ns(e,t,"shadow",i),t.color!==void 0&&t.color!==null){const u=f6(t.color);OQ(e.color,u)}else n===!0&&t.color===null&&(e.color=Ac(i.color));t.fixed!==void 0&&t.fixed!==null&&(typeof t.fixed=="boolean"?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(t.fixed.x!==void 0&&typeof t.fixed.x=="boolean"&&(e.fixed.x=t.fixed.x),t.fixed.y!==void 0&&typeof t.fixed.y=="boolean"&&(e.fixed.y=t.fixed.y))),n===!0&&t.font===null&&(e.font=Ac(i.font)),gn.updateGroupOptions(e,t,a),t.scaling!==void 0&&Ns(e.scaling,t.scaling,"label",i.scaling)}getFormattingValues(){const e={color:this.options.color.background,opacity:this.options.opacity,borderWidth:this.options.borderWidth,borderColor:this.options.color.border,size:this.options.size,borderDashes:this.options.shapeProperties.borderDashes,borderRadius:this.options.shapeProperties.borderRadius,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y};if(this.selected||this.hover?this.chooser===!0?this.selected?(this.options.borderWidthSelected!=null?e.borderWidth=this.options.borderWidthSelected:e.borderWidth*=2,e.color=this.options.color.highlight.background,e.borderColor=this.options.color.highlight.border,e.shadow=this.options.shadow.enabled):this.hover&&(e.color=this.options.color.hover.background,e.borderColor=this.options.color.hover.border,e.shadow=this.options.shadow.enabled):typeof this.chooser=="function"&&(this.chooser(e,this.options.id,this.selected,this.hover),e.shadow===!1&&(e.shadowColor!==this.options.shadow.color||e.shadowSize!==this.options.shadow.size||e.shadowX!==this.options.shadow.x||e.shadowY!==this.options.shadow.y)&&(e.shadow=!0)):e.shadow=this.options.shadow.enabled,this.options.opacity!==void 0){const t=this.options.opacity;e.borderColor=Is(e.borderColor,t),e.color=Is(e.color,t),e.shadowColor=Is(e.shadowColor,t)}return e}updateLabelModule(e){(this.options.label===void 0||this.options.label===null)&&(this.options.label=""),gn.updateGroupOptions(this.options,jW(jW({},e),{},{color:e&&e.color||this._localColor||void 0}),this.grouplist);const t=this.grouplist.get(this.options.group,!1),n=[e,this.options,t,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,n),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateShape(e){if(e===this.options.shape&&this.shape)this.shape.setOptions(this.options,this.imageObj,this.imageObjAlt);else switch(this.options.shape){case"box":this.shape=new Wbe(this.options,this.body,this.labelModule);break;case"circle":this.shape=new Gbe(this.options,this.body,this.labelModule);break;case"circularImage":this.shape=new Vbe(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"custom":this.shape=new Kbe(this.options,this.body,this.labelModule,this.options.ctxRenderer);break;case"database":this.shape=new Xbe(this.options,this.body,this.labelModule);break;case"diamond":this.shape=new Qbe(this.options,this.body,this.labelModule);break;case"dot":this.shape=new Zbe(this.options,this.body,this.labelModule);break;case"ellipse":this.shape=new NW(this.options,this.body,this.labelModule);break;case"icon":this.shape=new Jbe(this.options,this.body,this.labelModule);break;case"image":this.shape=new e2e(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"square":this.shape=new t2e(this.options,this.body,this.labelModule);break;case"hexagon":this.shape=new r2e(this.options,this.body,this.labelModule);break;case"star":this.shape=new n2e(this.options,this.body,this.labelModule);break;case"text":this.shape=new i2e(this.options,this.body,this.labelModule);break;case"triangle":this.shape=new a2e(this.options,this.body,this.labelModule);break;case"triangleDown":this.shape=new s2e(this.options,this.body,this.labelModule);break;default:this.shape=new NW(this.options,this.body,this.labelModule);break}this.needsRefresh()}select(){this.selected=!0,this.needsRefresh()}unselect(){this.selected=!1,this.needsRefresh()}needsRefresh(){this.shape.refreshNeeded=!0}getTitle(){return this.options.title}distanceToBorder(e,t){return this.shape.distanceToBorder(e,t)}isFixed(){return this.options.fixed.x&&this.options.fixed.y}isSelected(){return this.selected}getValue(){return this.options.value}getLabelSize(){return this.labelModule.size()}setValueRange(e,t,n){if(this.options.value!==void 0){const i=this.options.scaling.customScalingFunction(e,t,n,this.options.value),a=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){const o=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+i*o}this.options.size=this.options.scaling.min+i*a}else this.options.size=this.baseSize,this.options.font.size=this.baseFontSize;this.updateLabelModule()}draw(e){const t=this.getFormattingValues();return this.shape.draw(e,this.x,this.y,this.selected,this.hover,t)||{}}updateBoundingBox(e){this.shape.updateBoundingBox(this.x,this.y,e)}resize(e){const t=this.getFormattingValues();this.shape.resize(e,this.selected,this.hover,t)}getItemsOnPoint(e){const t=[];return this.labelModule.visible()&&y6(this.labelModule.getSize(),e)&&t.push({nodeId:this.id,labelId:0}),y6(this.shape.boundingBox,e)&&t.push({nodeId:this.id}),t}isOverlappingWith(e){return this.shape.left<e.right&&this.shape.left+this.shape.width>e.left&&this.shape.top<e.bottom&&this.shape.top+this.shape.height>e.top}isBoundingBoxOverlappingWith(e){return this.shape.boundingBox.left<e.right&&this.shape.boundingBox.right>e.left&&this.shape.boundingBox.top<e.bottom&&this.shape.boundingBox.bottom>e.top}static checkMass(e,t){if(e.mass!==void 0&&e.mass<=0){let n="";t!==void 0&&(n=" in node id: "+t),console.error("%cNegative or zero mass disallowed"+n+", setting mass to 1.",kQ),e.mass=1}}}class o2e{constructor(e,t,n,i){var a;if(this.body=e,this.images=t,this.groups=n,this.layoutEngine=i,this.body.functions.createNode=Ze(a=this.create).call(a,this),this.nodesListeners={add:(o,u)=>{this.add(u.items)},update:(o,u)=>{this.update(u.items,u.data,u.oldData)},remove:(o,u)=>{this.remove(u.items)}},this.defaultOptions={borderWidth:1,borderWidthSelected:void 0,brokenImage:void 0,color:{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},opacity:void 0,fixed:{x:!1,y:!1},font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:0,strokeColor:"#ffffff",align:"center",vadjust:0,multi:!1,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"monospace",vadjust:2}},group:void 0,hidden:!1,icon:{face:"FontAwesome",code:void 0,size:50,color:"#2B7CE9"},image:void 0,imagePadding:{top:0,right:0,bottom:0,left:0},label:void 0,labelHighlightBold:!0,level:void 0,margin:{top:5,right:5,bottom:5,left:5},mass:1,physics:!0,scaling:{min:10,max:30,label:{enabled:!1,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(o,u,c,h){if(u===o)return .5;{const f=1/(u-o);return Math.max(0,(h-o)*f)}}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},shape:"ellipse",shapeProperties:{borderDashes:!1,borderRadius:6,interpolation:!0,useImageSize:!1,useBorderWithImage:!1,coordinateOrigin:"center"},size:25,title:void 0,value:void 0,x:void 0,y:void 0},this.defaultOptions.mass<=0)throw"Internal error: mass in defaultOptions of NodesHandler may not be zero or negative";this.options=Ac(this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e,t;this.body.emitter.on("refreshNodes",Ze(e=this.refresh).call(e,this)),this.body.emitter.on("refresh",Ze(t=this.refresh).call(t,this)),this.body.emitter.on("destroy",()=>{cr(this.nodesListeners,(n,i)=>{this.body.data.nodes&&this.body.data.nodes.off(i,n)}),delete this.body.functions.createNode,delete this.nodesListeners.add,delete this.nodesListeners.update,delete this.nodesListeners.remove,delete this.nodesListeners})}setOptions(e){if(e!==void 0){if(gn.parseOptions(this.options,e),e.opacity!==void 0&&(m6(e.opacity)||!wd(e.opacity)||e.opacity<0||e.opacity>1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(const t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].updateShape();if(typeof e.font<"u"||typeof e.widthConstraint<"u"||typeof e.heightConstraint<"u")for(const t of Pn(this.body.nodes))this.body.nodes[t].updateLabelModule(),this.body.nodes[t].needsRefresh();if(e.size!==void 0)for(const t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].needsRefresh();(e.hidden!==void 0||e.physics!==void 0)&&this.body.emitter.emit("_dataChanged")}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=this.body.data.nodes;if(EX("id",e))this.body.data.nodes=e;else if(Mn(e))this.body.data.nodes=new kf,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new kf;else throw new TypeError("Array or DataSet expected");if(n&&cr(this.nodesListeners,function(i,a){n.off(a,i)}),this.body.nodes={},this.body.data.nodes){const i=this;cr(this.nodesListeners,function(o,u){i.body.data.nodes.on(u,o)});const a=this.body.data.nodes.getIds();this.add(a,!0)}t===!1&&this.body.emitter.emit("_dataChanged")}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;const i=[];for(let a=0;a<e.length;a++){n=e[a];const o=this.body.data.nodes.get(n),u=this.create(o);i.push(u),this.body.nodes[n]=u}this.layoutEngine.positionInitially(i),t===!1&&this.body.emitter.emit("_dataChanged")}update(e,t,n){const i=this.body.nodes;let a=!1;for(let o=0;o<e.length;o++){const u=e[o];let c=i[u];const h=t[o];c!==void 0?c.setOptions(h)&&(a=!0):(a=!0,c=this.create(h),i[u]=c)}!a&&n!==void 0&&(a=g0e(t).call(t,function(o,u){const c=n[u];return c&&c.level!==o.level})),a===!0?this.body.emitter.emit("_dataChanged"):this.body.emitter.emit("_dataUpdated")}remove(e){const t=this.body.nodes;for(let n=0;n<e.length;n++){const i=e[n];delete t[i]}this.body.emitter.emit("_dataChanged")}create(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gn;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}refresh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;cr(this.body.nodes,(t,n)=>{const i=this.body.data.nodes.get(n);i!==void 0&&(e===!0&&t.setOptions({x:null,y:null}),t.setOptions({fixed:!1}),t.setOptions(i))})}getPositions(e){const t={};if(e!==void 0){if(Mn(e)===!0){for(let n=0;n<e.length;n++)if(this.body.nodes[e[n]]!==void 0){const i=this.body.nodes[e[n]];t[e[n]]={x:Math.round(i.x),y:Math.round(i.y)}}}else if(this.body.nodes[e]!==void 0){const n=this.body.nodes[e];t[e]={x:Math.round(n.x),y:Math.round(n.y)}}}else for(let n=0;n<this.body.nodeIndices.length;n++){const i=this.body.nodes[this.body.nodeIndices[n]];t[this.body.nodeIndices[n]]={x:Math.round(i.x),y:Math.round(i.y)}}return t}getPosition(e){if(e==null)throw new TypeError("No id was specified for getPosition method.");if(this.body.nodes[e]==null)throw new ReferenceError("NodeId provided for getPosition does not exist. Provided: ".concat(e));return{x:Math.round(this.body.nodes[e].x),y:Math.round(this.body.nodes[e].y)}}storePositions(){const e=[],t=this.body.data.nodes.getDataSet();for(const n of t.get()){const i=n.id,a=this.body.nodes[i],o=Math.round(a.x),u=Math.round(a.y);(n.x!==o||n.y!==u)&&e.push({id:i,x:o,y:u})}t.update(e)}getBoundingBox(e){if(this.body.nodes[e]!==void 0)return this.body.nodes[e].shape.boundingBox}getConnectedNodes(e,t){const n=[];if(this.body.nodes[e]!==void 0){const i=this.body.nodes[e],a={};for(let o=0;o<i.edges.length;o++){const u=i.edges[o];t!=="to"&&u.toId==i.id?a[u.fromId]===void 0&&(n.push(u.fromId),a[u.fromId]=!0):t!=="from"&&u.fromId==i.id&&a[u.toId]===void 0&&(n.push(u.toId),a[u.toId]=!0)}}return n}getConnectedEdges(e){const t=[];if(this.body.nodes[e]!==void 0){const n=this.body.nodes[e];for(let i=0;i<n.edges.length;i++)t.push(n.edges[i].id)}else console.error("NodeId provided for getConnectedEdges does not exist. Provided: ",e);return t}moveNode(e,t,n){this.body.nodes[e]!==void 0?(this.body.nodes[e].x=Number(t),this.body.nodes[e].y=Number(n),du(()=>{this.body.emitter.emit("startSimulation")},0)):console.error("Node id supplied to moveNode does not exist. Provided: ",e)}}var PW={},MW;function l2e(){if(MW)return PW;MW=1;var r=Nt(),e=Math.hypot,t=Math.abs,n=Math.sqrt,i=!!e&&e(1/0,NaN)!==1/0;return r({target:"Math",stat:!0,arity:2,forced:i},{hypot:function(o,u){for(var c=0,h=0,f=arguments.length,v=0,y,g;h<f;)y=t(arguments[h++]),v<y?(g=v/y,c=c*g*g+1,v=y):y>0?(g=y/v,c+=g*g):c+=y;return v===1/0?1/0:v*n(c)}}),PW}var qT,DW;function u2e(){if(DW)return qT;DW=1,l2e();var r=Br();return qT=r.Math.hypot,qT}var LT,qW;function c2e(){if(qW)return LT;qW=1;var r=u2e();return LT=r,LT}var $T,LW;function d2e(){return LW||(LW=1,$T=c2e()),$T}var h2e=d2e(),f2e=Jt(h2e);class Gn{static transform(e,t){Mn(e)||(e=[e]);const n=t.point.x,i=t.point.y,a=t.angle,o=t.length;for(let u=0;u<e.length;++u){const c=e[u],h=c.x*Math.cos(a)-c.y*Math.sin(a),f=c.x*Math.sin(a)+c.y*Math.cos(a);c.x=n+o*h,c.y=i+o*f}}static drawPath(e,t){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;++n)e.lineTo(t[n].x,t[n].y);e.closePath()}}let p2e=class extends Gn{static draw(e,t){if(t.image){e.save(),e.translate(t.point.x,t.point.y),e.rotate(Math.PI/2+t.angle);const n=t.imageWidth!=null?t.imageWidth:t.image.width,i=t.imageHeight!=null?t.imageHeight:t.image.height;t.image.drawImageAtPosition(e,1,-n/2,0,n,i),e.restore()}return!1}};class v2e extends Gn{static draw(e,t){const n=[{x:0,y:0},{x:-1,y:.3},{x:-.9,y:0},{x:-1,y:-.3}];return Gn.transform(n,t),Gn.drawPath(e,n),!0}}class g2e{static draw(e,t){const n=[{x:-1,y:0},{x:0,y:.3},{x:-.4,y:0},{x:0,y:-.3}];return Gn.transform(n,t),Gn.drawPath(e,n),!0}}class m2e{static draw(e,t){const n={x:-.4,y:0};Gn.transform(n,t),e.strokeStyle=e.fillStyle,e.fillStyle="rgba(0, 0, 0, 0)";const i=Math.PI,a=t.angle-i/2,o=t.angle+i/2;return e.beginPath(),e.arc(n.x,n.y,t.length*.4,a,o,!1),e.stroke(),!0}}class y2e{static draw(e,t){const n={x:-.3,y:0};Gn.transform(n,t),e.strokeStyle=e.fillStyle,e.fillStyle="rgba(0, 0, 0, 0)";const i=Math.PI,a=t.angle+i/2,o=t.angle+3*i/2;return e.beginPath(),e.arc(n.x,n.y,t.length*.4,a,o,!1),e.stroke(),!0}}class b2e{static draw(e,t){const n=[{x:.02,y:0},{x:-1,y:.3},{x:-1,y:-.3}];return Gn.transform(n,t),Gn.drawPath(e,n),!0}}class x2e{static draw(e,t){const n=[{x:0,y:.3},{x:0,y:-.3},{x:-1,y:0}];return Gn.transform(n,t),Gn.drawPath(e,n),!0}}class w2e{static draw(e,t){const n={x:-.4,y:0};return Gn.transform(n,t),wR(e,n.x,n.y,t.length*.4),!0}}class _2e{static draw(e,t){const n=[{x:0,y:.5},{x:0,y:-.5},{x:-.15,y:-.5},{x:-.15,y:.5}];return Gn.transform(n,t),Gn.drawPath(e,n),!0}}class S2e{static draw(e,t){const n=[{x:0,y:.3},{x:0,y:-.3},{x:-.6,y:-.3},{x:-.6,y:.3}];return Gn.transform(n,t),Gn.drawPath(e,n),!0}}class E2e{static draw(e,t){const n=[{x:0,y:0},{x:-.5,y:-.3},{x:-1,y:0},{x:-.5,y:.3}];return Gn.transform(n,t),Gn.drawPath(e,n),!0}}class T2e{static draw(e,t){const n=[{x:-1,y:.3},{x:-.5,y:0},{x:-1,y:-.3},{x:0,y:0}];return Gn.transform(n,t),Gn.drawPath(e,n),!0}}class YQ{static draw(e,t){let n;switch(t.type&&(n=t.type.toLowerCase()),n){case"image":return p2e.draw(e,t);case"circle":return w2e.draw(e,t);case"box":return S2e.draw(e,t);case"crow":return g2e.draw(e,t);case"curve":return m2e.draw(e,t);case"diamond":return E2e.draw(e,t);case"inv_curve":return y2e.draw(e,t);case"triangle":return b2e.draw(e,t);case"inv_triangle":return x2e.draw(e,t);case"bar":return _2e.draw(e,t);case"vee":return T2e.draw(e,t);default:return v2e.draw(e,t)}}}function $W(r,e){var t=Pn(r);if(Ic){var n=Ic(r);e&&(n=Da(n).call(n,function(i){return Fc(r,i).enumerable})),t.push.apply(t,n)}return t}function BW(r){for(var e=1;e<arguments.length;e++){var t,n,i=arguments[e]!=null?arguments[e]:{};e%2?Kr(t=$W(Object(i),!0)).call(t,function(a){iu(r,a,i[a])}):jc?Sy(r,jc(i)):Kr(n=$W(Object(i))).call(n,function(a){Ey(r,a,Fc(i,a))})}return r}class KQ{constructor(e,t,n){iu(this,"color",{}),iu(this,"colorDirty",!0),iu(this,"hoverWidth",1.5),iu(this,"selectionWidth",2),this._body=t,this._labelModule=n,this.setOptions(e),this.fromPoint=this.from,this.toPoint=this.to}connect(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to]}cleanup(){return!1}setOptions(e){this.options=e,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.id=this.options.id}drawLine(e,t,n,i){let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes!==!1?this._drawDashedLine(e,t,a):this._drawLine(e,t,a)}_drawLine(e,t,n,i,a){if(this.from!=this.to)this._line(e,t,n,i,a);else{const[o,u,c]=this._getCircleData(e);this._circle(e,t,o,u,c)}}_drawDashedLine(e,t,n,i,a){e.lineCap="round";const o=Mn(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(o),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,n);else{const[u,c,h]=this._getCircleData(e);this._circle(e,t,u,c,h)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)PX(e,this.from.x,this.from.y,this.to.x,this.to.y,o);else{const[u,c,h]=this._getCircleData(e);this._circle(e,t,u,c,h)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}findBorderPosition(e,t,n){return this.from!=this.to?this._findBorderPosition(e,t,n):this._findBorderPositionCircle(e,t,n)}findBorderPositions(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};{var t;const[n,i]=nl(t=this._getCircleData(e)).call(t,0,2);return{from:this._findBorderPositionCircle(this.from,e,{x:n,y:i,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:n,y:i,low:.6,high:.8,direction:1})}}}_getCircleData(e){const t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);const n=GQ(e,this.options.selfReference.angle,t,this.from);return[n.x,n.y,t]}_pointOnCircle(e,t,n,i){const a=i*2*Math.PI;return{x:e+n*Math.cos(a),y:t-n*Math.sin(a)}}_findBorderPositionCircle(e,t,n){const i=n.x,a=n.y;let o=n.low,u=n.high;const c=n.direction,h=10,f=this.options.selfReference.size,v=.05;let y,g=(o+u)*.5,_=0;this.options.arrowStrikethrough===!0&&(c===-1?_=this.options.endPointOffset.from:c===1&&(_=this.options.endPointOffset.to));let E=0;do{g=(o+u)*.5,y=this._pointOnCircle(i,a,f,g);const R=Math.atan2(e.y-y.y,e.x-y.x),T=e.distanceToBorder(t,R)+_,k=Math.sqrt(Math.pow(y.x-e.x,2)+Math.pow(y.y-e.y,2)),N=T-k;if(Math.abs(N)<v)break;N>0?c>0?o=g:u=g:c>0?u=g:o=g,++E}while(o<=u&&E<h);return BW(BW({},y),{},{t:g})}getLineWidth(e,t){return e===!0?Math.max(this.selectionWidth,.3/this._body.view.scale):t===!0?Math.max(this.hoverWidth,.3/this._body.view.scale):Math.max(this.options.width,.3/this._body.view.scale)}getColor(e,t){if(t.inheritsColor!==!1){if(t.inheritsColor==="both"&&this.from.id!==this.to.id){const n=e.createLinearGradient(this.from.x,this.from.y,this.to.x,this.to.y);let i=this.from.options.color.highlight.border,a=this.to.options.color.highlight.border;return this.from.selected===!1&&this.to.selected===!1?(i=Is(this.from.options.color.border,t.opacity),a=Is(this.to.options.color.border,t.opacity)):this.from.selected===!0&&this.to.selected===!1?a=this.to.options.color.border:this.from.selected===!1&&this.to.selected===!0&&(i=this.from.options.color.border),n.addColorStop(0,i),n.addColorStop(1,a),n}return t.inheritsColor==="to"?Is(this.to.options.color.border,t.opacity):Is(this.from.options.color.border,t.opacity)}else return Is(t.color,t.opacity)}_circle(e,t,n,i,a){this.enableShadow(e,t);let o=0,u=Math.PI*2;if(!this.options.selfReference.renderBehindTheNode){const c=this.options.selfReference.angle,h=this.options.selfReference.angle+Math.PI,f=this._findBorderPositionCircle(this.from,e,{x:n,y:i,low:c,high:h,direction:-1}),v=this._findBorderPositionCircle(this.from,e,{x:n,y:i,low:c,high:h,direction:1});o=Math.atan2(f.y-i,f.x-n),u=Math.atan2(v.y-i,v.x-n)}e.beginPath(),e.arc(n,i,a,o,u,!1),e.stroke(),this.disableShadow(e,t)}getDistanceToEdge(e,t,n,i,a,o){if(this.from!=this.to)return this._getDistanceToEdge(e,t,n,i,a,o);{const[u,c,h]=this._getCircleData(void 0),f=u-a,v=c-o;return Math.abs(Math.sqrt(f*f+v*v)-h)}}_getDistanceToLine(e,t,n,i,a,o){const u=n-e,c=i-t,h=u*u+c*c;let f=((a-e)*u+(o-t)*c)/h;f>1?f=1:f<0&&(f=0);const v=e+f*u,y=t+f*c,g=v-a,_=y-o;return Math.sqrt(g*g+_*_)}getArrowData(e,t,n,i,a,o){let u,c,h,f,v,y,g;const _=o.width;t==="from"?(h=this.from,f=this.to,v=o.fromArrowScale<0,y=Math.abs(o.fromArrowScale),g=o.fromArrowType):t==="to"?(h=this.to,f=this.from,v=o.toArrowScale<0,y=Math.abs(o.toArrowScale),g=o.toArrowType):(h=this.to,f=this.from,v=o.middleArrowScale<0,y=Math.abs(o.middleArrowScale),g=o.middleArrowType);const E=15*y+3*_;if(h!=f){const N=f2e(h.x-f.x,h.y-f.y),A=E/N;if(t!=="middle")if(this.options.smooth.enabled===!0){const j=this._findBorderPosition(h,e,{via:n}),W=this.getPoint(j.t+A*(t==="from"?1:-1),n);u=Math.atan2(j.y-W.y,j.x-W.x),c=j}else u=Math.atan2(h.y-f.y,h.x-f.x),c=this._findBorderPosition(h,e);else{const j=(v?-A:A)/2,W=this.getPoint(.5+j,n),G=this.getPoint(.5-j,n);u=Math.atan2(W.y-G.y,W.x-G.x),c=this.getPoint(.5,n)}}else{const[N,A,j]=this._getCircleData(e);if(t==="from"){const W=this.options.selfReference.angle,G=this.options.selfReference.angle+Math.PI,D=this._findBorderPositionCircle(this.from,e,{x:N,y:A,low:W,high:G,direction:-1});u=D.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,c=D}else if(t==="to"){const W=this.options.selfReference.angle,G=this.options.selfReference.angle+Math.PI,D=this._findBorderPositionCircle(this.from,e,{x:N,y:A,low:W,high:G,direction:1});u=D.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,c=D}else{const W=this.options.selfReference.angle/(2*Math.PI);c=this._pointOnCircle(N,A,j,W),u=W*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}const R=c.x-E*.9*Math.cos(u),T=c.y-E*.9*Math.sin(u);return{point:c,core:{x:R,y:T},angle:u,length:E,type:g}}drawArrowHead(e,t,n,i,a){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width,YQ.draw(e,a)&&(this.enableShadow(e,t),Cg(e).call(e),this.disableShadow(e,t))}enableShadow(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}disableShadow(e,t){t.shadow===!0&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}drawBackground(e,t){if(t.background!==!1){const n={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=n.strokeStyle,e.lineWidth=n.lineWidth,e.dashes=n.dashes,this.setStrokeDashed(e,t.dashes)}}setStrokeDashed(e,t){if(t!==!1)if(e.setLineDash!==void 0){const n=Mn(t)?t:[5,5];e.setLineDash(n)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else e.setLineDash!==void 0?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}function FW(r,e){var t=Pn(r);if(Ic){var n=Ic(r);e&&(n=Da(n).call(n,function(i){return Fc(r,i).enumerable})),t.push.apply(t,n)}return t}function zW(r){for(var e=1;e<arguments.length;e++){var t,n,i=arguments[e]!=null?arguments[e]:{};e%2?Kr(t=FW(Object(i),!0)).call(t,function(a){iu(r,a,i[a])}):jc?Sy(r,jc(i)):Kr(n=FW(Object(i))).call(n,function(a){Ey(r,a,Fc(i,a))})}return r}class KR extends KQ{constructor(e,t,n){super(e,t,n)}_findBorderPositionBezier(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates();const i=10,a=.2;let o=!1,u=1,c=0,h=this.to,f,v,y=this.options.endPointOffset?this.options.endPointOffset.to:0;e.id===this.from.id&&(h=this.from,o=!0,y=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(y=0);let g=0;do{v=(c+u)*.5,f=this.getPoint(v,n);const _=Math.atan2(h.y-f.y,h.x-f.x),E=h.distanceToBorder(t,_)+y,R=Math.sqrt(Math.pow(f.x-h.x,2)+Math.pow(f.y-h.y,2)),T=E-R;if(Math.abs(T)<a)break;T<0?o===!1?c=v:u=v:o===!1?u=v:c=v,++g}while(c<=u&&g<i);return zW(zW({},f),{},{t:v})}_getDistanceToBezierEdge(e,t,n,i,a,o,u){let c=1e9,h,f,v,y,g,_=e,E=t;for(f=1;f<10;f++)v=.1*f,y=Math.pow(1-v,2)*e+2*v*(1-v)*u.x+Math.pow(v,2)*n,g=Math.pow(1-v,2)*t+2*v*(1-v)*u.y+Math.pow(v,2)*i,f>0&&(h=this._getDistanceToLine(_,E,y,g,a,o),c=h<c?h:c),_=y,E=g;return c}_bezierCurve(e,t,n,i){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),n!=null&&n.x!=null?i!=null&&i.x!=null?e.bezierCurveTo(n.x,n.y,i.x,i.y,this.toPoint.x,this.toPoint.y):e.quadraticCurveTo(n.x,n.y,this.toPoint.x,this.toPoint.y):e.lineTo(this.toPoint.x,this.toPoint.y),this.drawBackground(e,t),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}getViaNode(){return this._getViaCoordinates()}}class UW extends KR{constructor(e,t,n){super(e,t,n),iu(this,"via",this.via),this._boundFunction=()=>{this.positionBezierNode()},this._body.emitter.on("_repositionBezierNodes",this._boundFunction)}setOptions(e){super.setOptions(e);let t=!1;this.options.physics!==e.physics&&(t=!0),this.options=e,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),t===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}connect(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}cleanup(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),this.via!==void 0?(delete this._body.nodes[this.via.id],this.via=void 0,!0):!1}setupSupportNode(){if(this.via===void 0){const e="edgeId:"+this.id,t=this._body.functions.createNode({id:e,shape:"circle",physics:!0,hidden:!0});this._body.nodes[e]=t,this.via=t,this.via.parentEdgeId=this.id,this.positionBezierNode()}}positionBezierNode(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}_line(e,t,n){this._bezierCurve(e,t,n)}_getViaCoordinates(){return this.via}getViaNode(){return this.via}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){const[n,i,a]=this._getCircleData(),o=2*Math.PI*(1-e);return{x:n+a*Math.sin(o),y:i+a-a*(1-Math.cos(o))}}else return{x:Math.pow(1-e,2)*this.fromPoint.x+2*e*(1-e)*t.x+Math.pow(e,2)*this.toPoint.x,y:Math.pow(1-e,2)*this.fromPoint.y+2*e*(1-e)*t.y+Math.pow(e,2)*this.toPoint.y}}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t,this.via)}_getDistanceToEdge(e,t,n,i,a,o){return this._getDistanceToBezierEdge(e,t,n,i,a,o,this.via)}}class HW extends KR{constructor(e,t,n){super(e,t,n)}_line(e,t,n){this._bezierCurve(e,t,n)}getViaNode(){return this._getViaCoordinates()}_getViaCoordinates(){const e=this.options.smooth.roundness,t=this.options.smooth.type;let n=Math.abs(this.from.x-this.to.x),i=Math.abs(this.from.y-this.to.y);if(t==="discrete"||t==="diagonalCross"){let a,o;n<=i?a=o=e*i:a=o=e*n,this.from.x>this.to.x&&(a=-a),this.from.y>=this.to.y&&(o=-o);let u=this.from.x+a,c=this.from.y+o;return t==="discrete"&&(n<=i?u=n<e*i?this.from.x:u:c=i<e*n?this.from.y:c),{x:u,y:c}}else if(t==="straightCross"){let a=(1-e)*n,o=(1-e)*i;return n<=i?(a=0,this.from.y<this.to.y&&(o=-o)):(this.from.x<this.to.x&&(a=-a),o=0),{x:this.to.x+a,y:this.to.y+o}}else if(t==="horizontal"){let a=(1-e)*n;return this.from.x<this.to.x&&(a=-a),{x:this.to.x+a,y:this.from.y}}else if(t==="vertical"){let a=(1-e)*i;return this.from.y<this.to.y&&(a=-a),{x:this.from.x,y:this.to.y+a}}else if(t==="curvedCW"){n=this.to.x-this.from.x,i=this.from.y-this.to.y;const a=Math.sqrt(n*n+i*i),o=Math.PI,c=(Math.atan2(i,n)+(e*.5+.5)*o)%(2*o);return{x:this.from.x+(e*.5+.5)*a*Math.sin(c),y:this.from.y+(e*.5+.5)*a*Math.cos(c)}}else if(t==="curvedCCW"){n=this.to.x-this.from.x,i=this.from.y-this.to.y;const a=Math.sqrt(n*n+i*i),o=Math.PI,c=(Math.atan2(i,n)+(-e*.5+.5)*o)%(2*o);return{x:this.from.x+(e*.5+.5)*a*Math.sin(c),y:this.from.y+(e*.5+.5)*a*Math.cos(c)}}else{let a,o;n<=i?a=o=e*i:a=o=e*n,this.from.x>this.to.x&&(a=-a),this.from.y>=this.to.y&&(o=-o);let u=this.from.x+a,c=this.from.y+o;return n<=i?this.from.x<=this.to.x?u=this.to.x<u?this.to.x:u:u=this.to.x>u?this.to.x:u:this.from.y>=this.to.y?c=this.to.y>c?this.to.y:c:c=this.to.y<c?this.to.y:c,{x:u,y:c}}}_findBorderPosition(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(e,t,n.via)}_getDistanceToEdge(e,t,n,i,a,o){let u=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(e,t,n,i,a,o,u)}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates();const n=e,i=Math.pow(1-n,2)*this.fromPoint.x+2*n*(1-n)*t.x+Math.pow(n,2)*this.toPoint.x,a=Math.pow(1-n,2)*this.fromPoint.y+2*n*(1-n)*t.y+Math.pow(n,2)*this.toPoint.y;return{x:i,y:a}}}class O2e extends KR{constructor(e,t,n){super(e,t,n)}_getDistanceToBezierEdge2(e,t,n,i,a,o,u,c){let h=1e9,f=e,v=t;const y=[0,0,0,0];for(let g=1;g<10;g++){const _=.1*g;y[0]=Math.pow(1-_,3),y[1]=3*_*Math.pow(1-_,2),y[2]=3*Math.pow(_,2)*(1-_),y[3]=Math.pow(_,3);const E=y[0]*e+y[1]*u.x+y[2]*c.x+y[3]*n,R=y[0]*t+y[1]*u.y+y[2]*c.y+y[3]*i;if(g>0){const T=this._getDistanceToLine(f,v,E,R,a,o);h=T<h?T:h}f=E,v=R}return h}}class WW extends O2e{constructor(e,t,n){super(e,t,n)}_line(e,t,n){const i=n[0],a=n[1];this._bezierCurve(e,t,i,a)}_getViaCoordinates(){const e=this.from.x-this.to.x,t=this.from.y-this.to.y;let n,i,a,o;const u=this.options.smooth.roundness;return(Math.abs(e)>Math.abs(t)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection==="horizontal")&&this.options.smooth.forceDirection!=="vertical"?(i=this.from.y,o=this.to.y,n=this.from.x-u*e,a=this.to.x+u*e):(i=this.from.y-u*t,o=this.to.y+u*t,n=this.from.x,a=this.to.x),[{x:n,y:i},{x:a,y:o}]}getViaNode(){return this._getViaCoordinates()}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t)}_getDistanceToEdge(e,t,n,i,a,o){let[u,c]=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge2(e,t,n,i,a,o,u,c)}getPoint(e){let[t,n]=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates();const i=e,a=[Math.pow(1-i,3),3*i*Math.pow(1-i,2),3*Math.pow(i,2)*(1-i),Math.pow(i,3)],o=a[0]*this.fromPoint.x+a[1]*t.x+a[2]*n.x+a[3]*this.toPoint.x,u=a[0]*this.fromPoint.y+a[1]*t.y+a[2]*n.y+a[3]*this.toPoint.y;return{x:o,y:u}}}class GW extends KQ{constructor(e,t,n){super(e,t,n)}_line(e,t){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),e.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}getViaNode(){}getPoint(e){return{x:(1-e)*this.fromPoint.x+e*this.toPoint.x,y:(1-e)*this.fromPoint.y+e*this.toPoint.y}}_findBorderPosition(e,t){let n=this.to,i=this.from;e.id===this.from.id&&(n=this.from,i=this.to);const a=Math.atan2(n.y-i.y,n.x-i.x),o=n.x-i.x,u=n.y-i.y,c=Math.sqrt(o*o+u*u),h=e.distanceToBorder(t,a),f=(c-h)/c;return{x:(1-f)*i.x+f*n.x,y:(1-f)*i.y+f*n.y,t:0}}_getDistanceToEdge(e,t,n,i,a,o){return this._getDistanceToLine(e,t,n,i,a,o)}}class Cc{constructor(e,t,n,i,a){if(t===void 0)throw new Error("No body provided");this.options=Ac(i),this.globalOptions=i,this.defaultOptions=a,this.body=t,this.imagelist=n,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new _f(this.body,this.options,!0),this.setOptions(e)}setOptions(e){if(!e)return;let t=typeof e.physics<"u"&&this.options.physics!==e.physics||typeof e.hidden<"u"&&(this.options.hidden||!1)!==(e.hidden||!1)||typeof e.from<"u"&&this.options.from!==e.from||typeof e.to<"u"&&this.options.to!==e.to;Cc.parseOptions(this.options,e,!0,this.globalOptions),e.id!==void 0&&(this.id=e.id),e.from!==void 0&&(this.fromId=e.from),e.to!==void 0&&(this.toId=e.to),e.title!==void 0&&(this.title=e.title),e.value!==void 0&&(e.value=WQ(e.value));const n=[e,this.options,this.defaultOptions];return this.chooser=VR("edge",n),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}static parseOptions(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(pp(["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"],e,t,n),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(wd(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=i.endPointOffset.from!==void 0?i.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(wd(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=i.endPointOffset.to!==void 0?i.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),q1(t.label)?e.label=t.label:q1(e.label)||(e.label=void 0),Ns(e,t,"smooth",i),Ns(e,t,"shadow",i),Ns(e,t,"background",i),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:n===!0&&t.dashes===null&&(e.dashes=Od(i.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),Ns(e.scaling,t.scaling,"label",i.scaling)):n===!0&&t.scaling===null&&(e.scaling=Od(i.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows=="string"){const u=t.arrows.toLowerCase();e.arrows.to.enabled=Lr(u).call(u,"to")!=-1,e.arrows.middle.enabled=Lr(u).call(u,"middle")!=-1,e.arrows.from.enabled=Lr(u).call(u,"from")!=-1}else if(typeof t.arrows=="object")Ns(e.arrows,t.arrows,"to",i.arrows),Ns(e.arrows,t.arrows,"middle",i.arrows),Ns(e.arrows,t.arrows,"from",i.arrows);else throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+Ag(t.arrows));else n===!0&&t.arrows===null&&(e.arrows=Od(i.arrows));if(t.color!==void 0&&t.color!==null){const u=xf(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,c=e.color;if(a)rn(c,i.color,!1,n);else for(const h in c)Object.prototype.hasOwnProperty.call(c,h)&&delete c[h];if(xf(c))c.color=c,c.highlight=c,c.hover=c,c.inherit=!1,u.opacity===void 0&&(c.opacity=1);else{let h=!1;u.color!==void 0&&(c.color=u.color,h=!0),u.highlight!==void 0&&(c.highlight=u.highlight,h=!0),u.hover!==void 0&&(c.hover=u.hover,h=!0),u.inherit!==void 0&&(c.inherit=u.inherit),u.opacity!==void 0&&(c.opacity=Math.min(1,Math.max(0,u.opacity))),h===!0?c.inherit=!1:c.inherit===void 0&&(c.inherit="from")}}else n===!0&&t.color===null&&(e.color=Ac(i.color));n===!0&&t.font===null&&(e.font=Ac(i.font)),Object.prototype.hasOwnProperty.call(t,"selfReferenceSize")&&(console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"),e.selfReference.size=t.selfReferenceSize)}getFormattingValues(){const e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,n=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,i=this.options.color.inherit,a={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:n,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:i?void 0:this.options.color.color,inheritsColor:i,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){const o=this.options.selectionWidth;typeof o=="function"?a.width=o(a.width):typeof o=="number"&&(a.width+=o),a.width=Math.max(a.width,.3/this.body.view.scale),a.color=this.options.color.highlight,a.shadow=this.options.shadow.enabled}else if(this.hover){const o=this.options.hoverWidth;typeof o=="function"?a.width=o(a.width):typeof o=="number"&&(a.width+=o),a.width=Math.max(a.width,.3/this.body.view.scale),a.color=this.options.color.hover,a.shadow=this.options.shadow.enabled}}else typeof this.chooser=="function"&&(this.chooser(a,this.options.id,this.selected,this.hover),a.color!==void 0&&(a.inheritsColor=!1),a.shadow===!1&&(a.shadowColor!==this.options.shadow.color||a.shadowSize!==this.options.shadow.size||a.shadowX!==this.options.shadow.x||a.shadowY!==this.options.shadow.y)&&(a.shadow=!0));else a.shadow=this.options.shadow.enabled,a.width=Math.max(a.width,.3/this.body.view.scale);return a}updateLabelModule(e){const t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateEdgeType(){const e=this.options.smooth;let t=!1,n=!0;return this.edgeType!==void 0&&((this.edgeType instanceof UW&&e.enabled===!0&&e.type==="dynamic"||this.edgeType instanceof WW&&e.enabled===!0&&e.type==="cubicBezier"||this.edgeType instanceof HW&&e.enabled===!0&&e.type!=="dynamic"&&e.type!=="cubicBezier"||this.edgeType instanceof GW&&e.type.enabled===!1)&&(n=!1),n===!0&&(t=this.cleanup())),n===!0?e.enabled===!0?e.type==="dynamic"?(t=!0,this.edgeType=new UW(this.options,this.body,this.labelModule)):e.type==="cubicBezier"?this.edgeType=new WW(this.options,this.body,this.labelModule):this.edgeType=new HW(this.options,this.body,this.labelModule):this.edgeType=new GW(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}connect(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}disconnect(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}getTitle(){return this.title}isSelected(){return this.selected}getValue(){return this.options.value}setValueRange(e,t,n){if(this.options.value!==void 0){const i=this.options.scaling.customScalingFunction(e,t,n,this.options.value),a=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){const o=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+i*o}this.options.width=this.options.scaling.min+i*a}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}_setInteractionWidths(){typeof this.options.hoverWidth=="function"?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth=="function"?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}draw(e){const t=this.getFormattingValues();if(t.hidden)return;const n=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,n),this.drawLabel(e,n)}drawArrows(e){const t=this.getFormattingValues();if(t.hidden)return;const n=this.edgeType.getViaNode(),i={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(i.from=this.edgeType.getArrowData(e,"from",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=i.from.core),t.fromArrowSrc&&(i.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(i.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(i.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(i.to=this.edgeType.getArrowData(e,"to",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=i.to.core),t.toArrowSrc&&(i.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(i.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(i.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(i.middle=this.edgeType.getArrowData(e,"middle",n,this.selected,this.hover,t),t.middleArrowSrc&&(i.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(i.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(i.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,i.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,i.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,i.to)}drawLabel(e,t){if(this.options.label!==void 0){const n=this.from,i=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);let a;if(n.id!=i.id){this.labelModule.pointToSelf=!1,a=this.edgeType.getPoint(.5,t),e.save();const o=this._getRotation(e);o.angle!=0&&(e.translate(o.x,o.y),e.rotate(o.angle)),this.labelModule.draw(e,a.x,a.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;const o=GQ(e,this.options.selfReference.angle,this.options.selfReference.size,n);a=this._pointOnCircle(o.x,o.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,a.x,a.y,this.selected,this.hover)}}}getItemsOnPoint(e){const t=[];if(this.labelModule.visible()){const i=this._getRotation();y6(this.labelModule.getSize(),e,i)&&t.push({edgeId:this.id,labelId:0})}const n={left:e.x,top:e.y};return this.isOverlappingWith(n)&&t.push({edgeId:this.id}),t}isOverlappingWith(e){if(this.connected){const n=this.from.x,i=this.from.y,a=this.to.x,o=this.to.y,u=e.left,c=e.top;return this.edgeType.getDistanceToEdge(n,i,a,o,u,c)<10}else return!1}_getRotation(e){const t=this.edgeType.getViaNode(),n=this.edgeType.getPoint(.5,t);e!==void 0&&this.labelModule.calculateLabelSize(e,this.selected,this.hover,n.x,n.y);const i={x:n.x,y:this.labelModule.size.yLine,angle:0};if(!this.labelModule.visible()||this.options.font.align==="horizontal")return i;const a=this.from.y-this.to.y,o=this.from.x-this.to.x;let u=Math.atan2(a,o);return(u<-1&&o<0||u>0&&o<0)&&(u+=Math.PI),i.angle=u,i}_pointOnCircle(e,t,n,i){return{x:e+n*Math.cos(i),y:t-n*Math.sin(i)}}select(){this.selected=!0}unselect(){this.selected=!1}cleanup(){return this.edgeType.cleanup()}remove(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}endPointsValid(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}}class R2e{constructor(e,t,n){var i;this.body=e,this.images=t,this.groups=n,this.body.functions.createEdge=Ze(i=this.create).call(i,this),this.edgesListeners={add:(a,o)=>{this.add(o.items)},update:(a,o)=>{this.update(o.items)},remove:(a,o)=>{this.remove(o.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(a,o,u,c){if(o===a)return .5;{const h=1/(o-a);return Math.max(0,(c-a)*h)}}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},rn(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e=this,t,n;this.body.emitter.on("_forceDisableDynamicCurves",function(i){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i==="dynamic"&&(i="continuous");let o=!1;for(const u in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,u)){const c=e.body.edges[u],h=e.body.data.edges.get(u);if(h!=null){const f=h.smooth;f!==void 0&&f.enabled===!0&&f.type==="dynamic"&&(i===void 0?c.setOptions({smooth:!1}):c.setOptions({smooth:{type:i}}),o=!0)}}a===!0&&o===!0&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",()=>{this.reconnectEdges()}),this.body.emitter.on("refreshEdges",Ze(t=this.refresh).call(t,this)),this.body.emitter.on("refresh",Ze(n=this.refresh).call(n,this)),this.body.emitter.on("destroy",()=>{cr(this.edgesListeners,(i,a)=>{this.body.data.edges&&this.body.data.edges.off(a,i)}),delete this.body.functions.createEdge,delete this.edgesListeners.add,delete this.edgesListeners.update,delete this.edgesListeners.remove,delete this.edgesListeners})}setOptions(e){if(e!==void 0){Cc.parseOptions(this.options,e,!0,this.defaultOptions,!0);let t=!1;if(e.smooth!==void 0)for(const n in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,n)&&(t=this.body.edges[n].updateEdgeType()||t);if(e.font!==void 0)for(const n in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,n)&&this.body.edges[n].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit("_dataChanged")}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=this.body.data.edges;if(EX("id",e))this.body.data.edges=e;else if(Mn(e))this.body.data.edges=new kf,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new kf;else throw new TypeError("Array or DataSet expected");if(n&&cr(this.edgesListeners,(i,a)=>{n.off(a,i)}),this.body.edges={},this.body.data.edges){cr(this.edgesListeners,(a,o)=>{this.body.data.edges.on(o,a)});const i=this.body.data.edges.getIds();this.add(i,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),t===!1&&this.body.emitter.emit("_dataChanged")}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=this.body.edges,i=this.body.data.edges;for(let a=0;a<e.length;a++){const o=e[a],u=n[o];u&&u.disconnect();const c=i.get(o,{showInternalIds:!0});n[o]=this.create(c)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),t===!1&&this.body.emitter.emit("_dataChanged")}update(e){const t=this.body.edges,n=this.body.data.edges;let i=!1;for(let a=0;a<e.length;a++){const o=e[a],u=n.get(o),c=t[o];c!==void 0?(c.disconnect(),i=c.setOptions(u)||i,c.connect()):(this.body.edges[o]=this.create(u),i=!0)}i===!0?(this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),this.body.emitter.emit("_dataChanged")):this.body.emitter.emit("_dataUpdated")}remove(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length===0)return;const n=this.body.edges;cr(e,i=>{const a=n[i];a!==void 0&&a.remove()}),t&&this.body.emitter.emit("_dataChanged")}refresh(){cr(this.body.edges,(e,t)=>{const n=this.body.data.edges.get(t);n!==void 0&&e.setOptions(n)})}create(e){return new Cc(e,this.body,this.images,this.options,this.defaultOptions)}reconnectEdges(){let e;const t=this.body.nodes,n=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const i=n[e];i.from=null,i.to=null,i.connect()}}getConnectedNodes(e){const t=[];if(this.body.edges[e]!==void 0){const n=this.body.edges[e];n.fromId!==void 0&&t.push(n.fromId),n.toId!==void 0&&t.push(n.toId)}return t}_updateState(){this._addMissingEdges(),this._removeInvalidEdges()}_removeInvalidEdges(){const e=[];cr(this.body.edges,(t,n)=>{const i=this.body.nodes[t.toId],a=this.body.nodes[t.fromId];i!==void 0&&i.isCluster===!0||a!==void 0&&a.isCluster===!0||(i===void 0||a===void 0)&&e.push(n)}),this.remove(e,!1)}_addMissingEdges(){const e=this.body.data.edges;if(e==null)return;const t=this.body.edges,n=[];Kr(e).call(e,(i,a)=>{t[a]===void 0&&n.push(a)}),this.add(n,!0)}}class XQ{constructor(e,t,n){this.body=e,this.physicsBody=t,this.barnesHutTree,this.setOptions(n),this._rng=xy("BARNES HUT SOLVER")}setOptions(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}solve(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){let e;const t=this.body.nodes,n=this.physicsBody.physicsNodeIndices,i=n.length,a=this._formBarnesHutTree(t,n);this.barnesHutTree=a;for(let o=0;o<i;o++)e=t[n[o]],e.options.mass>0&&this._getForceContributions(a.root,e)}}_getForceContributions(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}_getForceContribution(e,t){if(e.childrenCount>0){const n=e.centerOfMass.x-t.x,i=e.centerOfMass.y-t.y,a=Math.sqrt(n*n+i*i);a*e.calcSize>this.thetaInversed?this._calculateForces(a,n,i,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(a,n,i,t,e)}}_calculateForces(e,t,n,i,a){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&i.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*i.shape.radius,e-i.shape.radius));const o=this.options.gravitationalConstant*a.mass*i.options.mass/Math.pow(e,3),u=t*o,c=n*o;this.physicsBody.forces[i.id].x+=u,this.physicsBody.forces[i.id].y+=c}_formBarnesHutTree(e,t){let n;const i=t.length;let a=e[t[0]].x,o=e[t[0]].y,u=e[t[0]].x,c=e[t[0]].y;for(let R=1;R<i;R++){const T=e[t[R]],k=T.x,N=T.y;T.options.mass>0&&(k<a&&(a=k),k>u&&(u=k),N<o&&(o=N),N>c&&(c=N))}const h=Math.abs(u-a)-Math.abs(c-o);h>0?(o-=.5*h,c+=.5*h):(a+=.5*h,u-=.5*h);const v=Math.max(1e-5,Math.abs(u-a)),y=.5*v,g=.5*(a+u),_=.5*(o+c),E={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:g-y,maxX:g+y,minY:_-y,maxY:_+y},size:v,calcSize:1/v,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(E.root);for(let R=0;R<i;R++)n=e[t[R]],n.options.mass>0&&this._placeInTree(E.root,n);return E}_updateBranchMass(e,t){const n=e.centerOfMass,i=e.mass+t.options.mass,a=1/i;n.x=n.x*e.mass+t.x*t.options.mass,n.x*=a,n.y=n.y*e.mass+t.y*t.options.mass,n.y*=a,e.mass=i;const o=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidth<o?o:e.maxWidth}_placeInTree(e,t,n){(n!=!0||n===void 0)&&this._updateBranchMass(e,t);const i=e.children.NW.range;let a;i.maxX>t.x?i.maxY>t.y?a="NW":a="SW":i.maxY>t.y?a="NE":a="SE",this._placeInRegion(e,t,a)}_placeInRegion(e,t,n){const i=e.children[n];switch(i.childrenCount){case 0:i.children.data=t,i.childrenCount=1,this._updateBranchMass(i,t);break;case 1:i.children.data.x===t.x&&i.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(i),this._placeInTree(i,t));break;case 4:this._placeInTree(i,t);break}}_splitBranch(e){let t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),t!=null&&this._placeInTree(e,t)}_insertRegion(e,t){let n,i,a,o;const u=.5*e.size;switch(t){case"NW":n=e.range.minX,i=e.range.minX+u,a=e.range.minY,o=e.range.minY+u;break;case"NE":n=e.range.minX+u,i=e.range.maxX,a=e.range.minY,o=e.range.minY+u;break;case"SW":n=e.range.minX,i=e.range.minX+u,a=e.range.minY+u,o=e.range.maxY;break;case"SE":n=e.range.minX+u,i=e.range.maxX,a=e.range.minY+u,o=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:n,maxX:i,minY:a,maxY:o},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}_debug(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}_drawBranch(e,t,n){n===void 0&&(n="#FF0000"),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=n,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}class A2e{constructor(e,t,n){this._rng=xy("REPULSION SOLVER"),this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e}solve(){let e,t,n,i,a,o,u,c;const h=this.body.nodes,f=this.physicsBody.physicsNodeIndices,v=this.physicsBody.forces,y=this.options.nodeDistance,g=-2/3/y,_=4/3;for(let E=0;E<f.length-1;E++){u=h[f[E]];for(let R=E+1;R<f.length;R++)c=h[f[R]],e=c.x-u.x,t=c.y-u.y,n=Math.sqrt(e*e+t*t),n===0&&(n=.1*this._rng(),e=n),n<2*y&&(n<.5*y?o=1:o=g*n+_,o=o/n,i=e*o,a=t*o,v[u.id].x-=i,v[u.id].y-=a,v[c.id].x+=i,v[c.id].y+=a)}}}class C2e{constructor(e,t,n){this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e,this.overlapAvoidanceFactor=Math.max(0,Math.min(1,this.options.avoidOverlap||0))}solve(){const e=this.body.nodes,t=this.physicsBody.physicsNodeIndices,n=this.physicsBody.forces,i=this.options.nodeDistance;for(let a=0;a<t.length-1;a++){const o=e[t[a]];for(let u=a+1;u<t.length;u++){const c=e[t[u]];if(o.level===c.level){const h=i+this.overlapAvoidanceFactor*((o.shape.radius||0)/2+(c.shape.radius||0)/2),f=c.x-o.x,v=c.y-o.y,y=Math.sqrt(f*f+v*v),g=.05;let _;y<h?_=-Math.pow(g*y,2)+Math.pow(g*h,2):_=0,y!==0&&(_=_/y);const E=f*_,R=v*_;n[o.id].x-=E,n[o.id].y-=R,n[c.id].x+=E,n[c.id].y+=R}}}}}class BT{constructor(e,t,n){this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e}solve(){let e,t;const n=this.physicsBody.physicsEdgeIndices,i=this.body.edges;let a,o,u;for(let c=0;c<n.length;c++)t=i[n[c]],t.connected===!0&&t.toId!==t.fromId&&this.body.nodes[t.toId]!==void 0&&this.body.nodes[t.fromId]!==void 0&&(t.edgeType.via!==void 0?(e=t.options.length===void 0?this.options.springLength:t.options.length,a=t.to,o=t.edgeType.via,u=t.from,this._calculateSpringForce(a,o,.5*e),this._calculateSpringForce(o,u,.5*e)):(e=t.options.length===void 0?this.options.springLength*1.5:t.options.length,this._calculateSpringForce(t.from,t.to,e)))}_calculateSpringForce(e,t,n){const i=e.x-t.x,a=e.y-t.y,o=Math.max(Math.sqrt(i*i+a*a),.01),u=this.options.springConstant*(n-o)/o,c=i*u,h=a*u;this.physicsBody.forces[e.id]!==void 0&&(this.physicsBody.forces[e.id].x+=c,this.physicsBody.forces[e.id].y+=h),this.physicsBody.forces[t.id]!==void 0&&(this.physicsBody.forces[t.id].x-=c,this.physicsBody.forces[t.id].y-=h)}}class k2e{constructor(e,t,n){this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e}solve(){let e,t,n,i,a,o,u,c;const h=this.body.edges,f=.5,v=this.physicsBody.physicsEdgeIndices,y=this.physicsBody.physicsNodeIndices,g=this.physicsBody.forces;for(let A=0;A<y.length;A++){const j=y[A];g[j].springFx=0,g[j].springFy=0}for(let A=0;A<v.length;A++)t=h[v[A]],t.connected===!0&&(e=t.options.length===void 0?this.options.springLength:t.options.length,n=t.from.x-t.to.x,i=t.from.y-t.to.y,c=Math.sqrt(n*n+i*i),c=c===0?.01:c,u=this.options.springConstant*(e-c)/c,a=n*u,o=i*u,t.to.level!=t.from.level?(g[t.toId]!==void 0&&(g[t.toId].springFx-=a,g[t.toId].springFy-=o),g[t.fromId]!==void 0&&(g[t.fromId].springFx+=a,g[t.fromId].springFy+=o)):(g[t.toId]!==void 0&&(g[t.toId].x-=f*a,g[t.toId].y-=f*o),g[t.fromId]!==void 0&&(g[t.fromId].x+=f*a,g[t.fromId].y+=f*o)));u=1;let _,E;for(let A=0;A<y.length;A++){const j=y[A];_=Math.min(u,Math.max(-u,g[j].springFx)),E=Math.min(u,Math.max(-u,g[j].springFy)),g[j].x+=_,g[j].y+=E}let R=0,T=0;for(let A=0;A<y.length;A++){const j=y[A];R+=g[j].x,T+=g[j].y}const k=R/y.length,N=T/y.length;for(let A=0;A<y.length;A++){const j=y[A];g[j].x-=k,g[j].y-=N}}}class h1{constructor(e,t,n){this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e}solve(){let e,t,n,i;const a=this.body.nodes,o=this.physicsBody.physicsNodeIndices,u=this.physicsBody.forces;for(let c=0;c<o.length;c++){const h=o[c];i=a[h],e=-i.x,t=-i.y,n=Math.sqrt(e*e+t*t),this._calculateForces(n,e,t,u,i)}}_calculateForces(e,t,n,i,a){const o=e===0?0:this.options.centralGravity/e;i[a.id].x=t*o,i[a.id].y=n*o}}class N2e extends XQ{constructor(e,t,n){super(e,t,n),this._rng=xy("FORCE ATLAS 2 BASED REPULSION SOLVER")}_calculateForces(e,t,n,i,a){e===0&&(e=.1*this._rng(),t=e),this.overlapAvoidanceFactor<1&&i.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*i.shape.radius,e-i.shape.radius));const o=i.edges.length+1,u=this.options.gravitationalConstant*a.mass*i.options.mass*o/Math.pow(e,2),c=t*u,h=n*u;this.physicsBody.forces[i.id].x+=c,this.physicsBody.forces[i.id].y+=h}}class I2e extends h1{constructor(e,t,n){super(e,t,n)}_calculateForces(e,t,n,i,a){if(e>0){const o=a.edges.length+1,u=this.options.centralGravity*o*a.options.mass;i[a.id].x=t*u,i[a.id].y=n*u}}}class j2e{constructor(e){this.body=e,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},Jn(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("initPhysics",()=>{this.initPhysics()}),this.body.emitter.on("_layoutFailed",()=>{this.layoutFailed=!0}),this.body.emitter.on("resetPhysics",()=>{this.stopSimulation(),this.ready=!1}),this.body.emitter.on("disablePhysics",()=>{this.physicsEnabled=!1,this.stopSimulation()}),this.body.emitter.on("restorePhysics",()=>{this.setOptions(this.options),this.ready===!0&&this.startSimulation()}),this.body.emitter.on("startSimulation",()=>{this.ready===!0&&this.startSimulation()}),this.body.emitter.on("stopSimulation",()=>{this.stopSimulation()}),this.body.emitter.on("destroy",()=>{this.stopSimulation(!1),this.body.emitter.off()}),this.body.emitter.on("_dataChanged",()=>{this.updatePhysicsData()})}setOptions(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,M1(["stabilization"],this.options,e),Ns(this.options,e,"stabilization"),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());const t=this.options.wind;t&&((typeof t.x!="number"||m6(t.x))&&(t.x=0),(typeof t.y!="number"||m6(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}init(){let e;this.options.solver==="forceAtlas2Based"?(e=this.options.forceAtlas2Based,this.nodesSolver=new N2e(this.body,this.physicsBody,e),this.edgesSolver=new BT(this.body,this.physicsBody,e),this.gravitySolver=new I2e(this.body,this.physicsBody,e)):this.options.solver==="repulsion"?(e=this.options.repulsion,this.nodesSolver=new A2e(this.body,this.physicsBody,e),this.edgesSolver=new BT(this.body,this.physicsBody,e),this.gravitySolver=new h1(this.body,this.physicsBody,e)):this.options.solver==="hierarchicalRepulsion"?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new C2e(this.body,this.physicsBody,e),this.edgesSolver=new k2e(this.body,this.physicsBody,e),this.gravitySolver=new h1(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new XQ(this.body,this.physicsBody,e),this.edgesSolver=new BT(this.body,this.physicsBody,e),this.gravitySolver=new h1(this.body,this.physicsBody,e)),this.modelOptions=e}initPhysics(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}startSimulation(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),this.viewFunction===void 0){var e;this.viewFunction=Ze(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}else this.body.emitter.emit("_redraw")}stopSimulation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit("_stopRendering"))}simulationStep(){const e=N1();this.physicsTick(),(N1()-e<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}_emitStabilized(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&du(()=>{this.body.emitter.emit("stabilized",{iterations:e}),this.startedStabilization=!1,this.stabilizationIterations=0},0)}physicsStep(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}adjustTimeStep(){this._evaluateStepQuality()===!0?this.timestep=1.2*this.timestep:this.timestep/1.2<this.options.timestep?this.timestep=this.options.timestep:(this.adaptiveCounter=-1,this.timestep=Math.max(this.options.timestep,this.timestep/1.2))}physicsTick(){this._startStabilizing(),this.stabilized!==!0&&(this.adaptiveTimestep===!0&&this.adaptiveTimestepEnabled===!0?(this.adaptiveCounter%this.adaptiveInterval===0?(this.timestep=2*this.timestep,this.physicsStep(),this.revert(),this.timestep=.5*this.timestep,this.physicsStep(),this.physicsStep(),this.adjustTimeStep()):this.physicsStep(),this.adaptiveCounter+=1):(this.timestep=this.options.timestep,this.physicsStep()),this.stabilized===!0&&this.revert(),this.stabilizationIterations++)}updatePhysicsData(){this.physicsBody.forces={},this.physicsBody.physicsNodeIndices=[],this.physicsBody.physicsEdgeIndices=[];const e=this.body.nodes,t=this.body.edges;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&e[n].options.physics===!0&&this.physicsBody.physicsNodeIndices.push(e[n].id);for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&t[n].options.physics===!0&&this.physicsBody.physicsEdgeIndices.push(t[n].id);for(let n=0;n<this.physicsBody.physicsNodeIndices.length;n++){const i=this.physicsBody.physicsNodeIndices[n];this.physicsBody.forces[i]={x:0,y:0},this.physicsBody.velocities[i]===void 0&&(this.physicsBody.velocities[i]={x:0,y:0})}for(const n in this.physicsBody.velocities)e[n]===void 0&&delete this.physicsBody.velocities[n]}revert(){const e=Pn(this.previousStates),t=this.body.nodes,n=this.physicsBody.velocities;this.referenceState={};for(let i=0;i<e.length;i++){const a=e[i];t[a]!==void 0?t[a].options.physics===!0&&(this.referenceState[a]={positions:{x:t[a].x,y:t[a].y}},n[a].x=this.previousStates[a].vx,n[a].y=this.previousStates[a].vy,t[a].x=this.previousStates[a].x,t[a].y=this.previousStates[a].y):delete this.previousStates[a]}}_evaluateStepQuality(){let e,t,n;const i=this.body.nodes,a=this.referenceState,o=.3;for(const u in this.referenceState)if(Object.prototype.hasOwnProperty.call(this.referenceState,u)&&i[u]!==void 0&&(e=i[u].x-a[u].positions.x,t=i[u].y-a[u].positions.y,n=Math.sqrt(Math.pow(e,2)+Math.pow(t,2)),n>o))return!1;return!0}moveNodes(){const e=this.physicsBody.physicsNodeIndices;let t=0,n=0;const i=5;for(let a=0;a<e.length;a++){const o=e[a],u=this._performStep(o);t=Math.max(t,u),n+=u}this.adaptiveTimestepEnabled=n/e.length<i,this.stabilized=t<this.options.minVelocity}calculateComponentVelocity(e,t,n){const i=this.modelOptions.damping*e,a=(t-i)/n;e+=a*this.timestep;const o=this.options.maxVelocity||1e9;return Math.abs(e)>o&&(e=e>0?o:-o),e}_performStep(e){const t=this.body.nodes[e],n=this.physicsBody.forces[e];this.options.wind&&(n.x+=this.options.wind.x,n.y+=this.options.wind.y);const i=this.physicsBody.velocities[e];return this.previousStates[e]={x:t.x,y:t.y,vx:i.x,vy:i.y},t.options.fixed.x===!1?(i.x=this.calculateComponentVelocity(i.x,n.x,t.options.mass),t.x+=i.x*this.timestep):(n.x=0,i.x=0),t.options.fixed.y===!1?(i.y=this.calculateComponentVelocity(i.y,n.y,t.options.mass),t.y+=i.y*this.timestep):(n.y=0,i.y=0),Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))}_freezeNodes(){const e=this.body.nodes;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){const n=e[t].options.fixed;this.freezeCache[t]={x:n.x,y:n.y},n.x=!0,n.y=!0}}_restoreFrozenNodes(){const e=this.body.nodes;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}stabilize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof e!="number"&&(e=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",e)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=e,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,du(()=>this._stabilizationBatch(),0)}_startStabilizing(){return this.startedStabilization===!0?!1:(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}_stabilizationBatch(){const e=()=>this.stabilized===!1&&this.stabilizationIterations<this.targetIterations,t=()=>{this.body.emitter.emit("stabilizationProgress",{iterations:this.stabilizationIterations,total:this.targetIterations})};this._startStabilizing()&&t();let n=0;for(;e()&&n<this.options.stabilization.updateInterval;)this.physicsTick(),n++;if(t(),e()){var i;du(Ze(i=this._stabilizationBatch).call(i,this),0)}else this._finalizeStabilization()}_finalizeStabilization(){this.body.emitter.emit("_allowRedraw"),this.options.stabilization.fit===!0&&this.body.emitter.emit("fit"),this.options.stabilization.onlyDynamicEdges===!0&&this._restoreFrozenNodes(),this.body.emitter.emit("stabilizationIterationsDone"),this.body.emitter.emit("_requestRedraw"),this.stabilized===!0?this._emitStabilized():this.startSimulation(),this.ready=!0}_drawForces(e){for(let t=0;t<this.physicsBody.physicsNodeIndices.length;t++){const n=this.physicsBody.physicsNodeIndices[t],i=this.body.nodes[n],a=this.physicsBody.forces[n],o=20,u=.03,c=Math.sqrt(Math.pow(a.x,2)+Math.pow(a.x,2)),h=Math.min(Math.max(5,c),15),f=3*h,v=p6((180-Math.min(1,Math.max(0,u*c))*180)/360,1,1),y={x:i.x+o*a.x,y:i.y+o*a.y};e.lineWidth=h,e.strokeStyle=v,e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(y.x,y.y),e.stroke();const g=Math.atan2(a.y,a.x);e.fillStyle=v,YQ.draw(e,{type:"arrow",point:y,angle:g,length:f}),Cg(e).call(e)}}}const Ki=[];for(let r=0;r<256;++r)Ki.push((r+256).toString(16).slice(1));function P2e(r,e=0){return(Ki[r[e+0]]+Ki[r[e+1]]+Ki[r[e+2]]+Ki[r[e+3]]+"-"+Ki[r[e+4]]+Ki[r[e+5]]+"-"+Ki[r[e+6]]+Ki[r[e+7]]+"-"+Ki[r[e+8]]+Ki[r[e+9]]+"-"+Ki[r[e+10]]+Ki[r[e+11]]+Ki[r[e+12]]+Ki[r[e+13]]+Ki[r[e+14]]+Ki[r[e+15]]).toLowerCase()}let FT;const M2e=new Uint8Array(16);function D2e(){if(!FT){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");FT=crypto.getRandomValues.bind(crypto)}return FT(M2e)}const q2e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var VW={randomUUID:q2e};function L2e(r,e,t){r=r||{};const n=r.random??r.rng?.()??D2e();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,P2e(n)}function Av(r,e,t){return VW.randomUUID&&!r?VW.randomUUID():L2e(r)}class ya{constructor(){}static getRange(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,i=-1e9,a=1e9,o=-1e9,u;if(t.length>0)for(let c=0;c<t.length;c++)u=e[t[c]],a>u.shape.boundingBox.left&&(a=u.shape.boundingBox.left),o<u.shape.boundingBox.right&&(o=u.shape.boundingBox.right),n>u.shape.boundingBox.top&&(n=u.shape.boundingBox.top),i<u.shape.boundingBox.bottom&&(i=u.shape.boundingBox.bottom);return a===1e9&&o===-1e9&&n===1e9&&i===-1e9&&(n=0,i=0,a=0,o=0),{minX:a,maxX:o,minY:n,maxY:i}}static getRangeCore(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,i=-1e9,a=1e9,o=-1e9,u;if(t.length>0)for(let c=0;c<t.length;c++)u=e[t[c]],a>u.x&&(a=u.x),o<u.x&&(o=u.x),n>u.y&&(n=u.y),i<u.y&&(i=u.y);return a===1e9&&o===-1e9&&n===1e9&&i===-1e9&&(n=0,i=0,a=0,o=0),{minX:a,maxX:o,minY:n,maxY:i}}static findCenter(e){return{x:.5*(e.maxX+e.minX),y:.5*(e.maxY+e.minY)}}static cloneOptions(e,t){const n={};return t===void 0||t==="node"?(rn(n,e.options,!0),n.x=e.x,n.y=e.y,n.amountOfConnections=e.edges.length):rn(n,e.options,!0),n}}class $2e extends gn{constructor(e,t,n,i,a,o){super(e,t,n,i,a,o),this.isCluster=!0,this.containedNodes={},this.containedEdges={}}_openChildCluster(e){const t=this.body.nodes[e];if(this.containedNodes[e]===void 0)throw new Error("node with id: "+e+" not in current cluster");if(!t.isCluster)throw new Error("node with id: "+e+" is not a cluster");delete this.containedNodes[e],cr(t.edges,n=>{delete this.containedEdges[n.id]}),cr(t.containedNodes,(n,i)=>{this.containedNodes[i]=n}),t.containedNodes={},cr(t.containedEdges,(n,i)=>{this.containedEdges[i]=n}),t.containedEdges={},cr(t.edges,n=>{cr(this.edges,i=>{var a,o;const u=Lr(a=i.clusteringEdgeReplacingIds).call(a,n.id);u!==-1&&(cr(n.clusteringEdgeReplacingIds,c=>{i.clusteringEdgeReplacingIds.push(c),this.body.edges[c].edgeReplacedById=i.id}),cu(o=i.clusteringEdgeReplacingIds).call(o,u,1))})}),t.edges=[]}}class B2e{constructor(e){this.body=e,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},Jn(this.options,this.defaultOptions),this.body.emitter.on("_resetData",()=>{this.clusteredNodes={},this.clusteredEdges={}})}clusterByHubsize(e,t){e===void 0?e=this._getHubSize():typeof e=="object"&&(t=this._checkOptions(e),e=this._getHubSize());const n=[];for(let i=0;i<this.body.nodeIndices.length;i++){const a=this.body.nodes[this.body.nodeIndices[i]];a.edges.length>=e&&n.push(a.id)}for(let i=0;i<n.length;i++)this.clusterByConnection(n[i],t,!0);this.body.emitter.emit("_dataChanged")}cluster(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.joinCondition===void 0)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");e=this._checkOptions(e);const n={},i={};cr(this.body.nodes,(a,o)=>{a.options&&e.joinCondition(a.options)===!0&&(n[o]=a,cr(a.edges,u=>{this.clusteredEdges[u.id]===void 0&&(i[u.id]=u)}))}),this._cluster(n,i,e,t)}clusterByEdgeCount(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);const i=[],a={};let o,u,c;for(let h=0;h<this.body.nodeIndices.length;h++){const f={},v={},y=this.body.nodeIndices[h],g=this.body.nodes[y];if(a[y]===void 0){c=0,u=[];for(let _=0;_<g.edges.length;_++)o=g.edges[_],this.clusteredEdges[o.id]===void 0&&(o.toId!==o.fromId&&c++,u.push(o));if(c===e){const _=function(R){if(t.joinCondition===void 0||t.joinCondition===null)return!0;const T=ya.cloneOptions(R);return t.joinCondition(T)};let E=!0;for(let R=0;R<u.length;R++){o=u[R];const T=this._getConnectedId(o,y);if(_(g))v[o.id]=o,f[y]=g,f[T]=this.body.nodes[T],a[y]=!0;else{E=!1;break}}if(Pn(f).length>0&&Pn(v).length>0&&E===!0){const T=function(){for(let k=0;k<i.length;++k)for(const N in f)if(i[k].nodes[N]!==void 0)return i[k]}();if(T!==void 0){for(const k in f)T.nodes[k]===void 0&&(T.nodes[k]=f[k]);for(const k in v)T.edges[k]===void 0&&(T.edges[k]=v[k])}else i.push({nodes:f,edges:v})}}}}for(let h=0;h<i.length;h++)this._cluster(i[h].nodes,i[h].edges,t,!1);n===!0&&this.body.emitter.emit("_dataChanged")}clusterOutliers(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}clusterBridges(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}clusterByConnection(e,t){var n;let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No nodeId supplied to clusterByConnection!");if(this.body.nodes[e]===void 0)throw new Error("The nodeId given to clusterByConnection does not exist!");const a=this.body.nodes[e];t=this._checkOptions(t,a),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=a.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=a.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=a.options.fixed.x,t.clusterNodeProperties.fixed.y=a.options.fixed.y);const o={},u={},c=a.id,h=ya.cloneOptions(a);o[c]=a;for(let v=0;v<a.edges.length;v++){const y=a.edges[v];if(this.clusteredEdges[y.id]===void 0){const g=this._getConnectedId(y,c);if(this.clusteredNodes[g]===void 0)if(g!==c)if(t.joinCondition===void 0)u[y.id]=y,o[g]=this.body.nodes[g];else{const _=ya.cloneOptions(this.body.nodes[g]);t.joinCondition(h,_)===!0&&(u[y.id]=y,o[g]=this.body.nodes[g])}else u[y.id]=y}}const f=Nf(n=Pn(o)).call(n,function(v){return o[v].id});for(const v in o){if(!Object.prototype.hasOwnProperty.call(o,v))continue;const y=o[v];for(let g=0;g<y.edges.length;g++){const _=y.edges[g];Lr(f).call(f,this._getConnectedId(_,y.id))>-1&&(u[_.id]=_)}}this._cluster(o,u,t,i)}_createClusterEdges(e,t,n,i){let a,o,u,c,h,f;const v=Pn(e),y=[];for(let E=0;E<v.length;E++){o=v[E],u=e[o];for(let R=0;R<u.edges.length;R++)a=u.edges[R],this.clusteredEdges[a.id]===void 0&&(a.toId==a.fromId?t[a.id]=a:a.toId==o?(c=n.id,h=a.fromId,f=h):(c=a.toId,h=n.id,f=c),e[f]===void 0&&y.push({edge:a,fromId:h,toId:c}))}const g=[],_=function(E){for(let R=0;R<g.length;R++){const T=g[R],k=E.fromId===T.fromId&&E.toId===T.toId,N=E.fromId===T.toId&&E.toId===T.fromId;if(k||N)return T}return null};for(let E=0;E<y.length;E++){const R=y[E],T=R.edge;let k=_(R);k===null?(k=this._createClusteredEdge(R.fromId,R.toId,T,i),g.push(k)):k.clusteringEdgeReplacingIds.push(T.id),this.body.edges[T.id].edgeReplacedById=k.id,this._backupEdgeOptions(T),T.setOptions({physics:!1})}}_checkOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}_cluster(e,t,n){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;const a=[];for(const f in e)Object.prototype.hasOwnProperty.call(e,f)&&this.clusteredNodes[f]!==void 0&&a.push(f);for(let f=0;f<a.length;++f)delete e[a[f]];if(Pn(e).length==0||Pn(e).length==1&&n.clusterNodeProperties.allowSingleNodeCluster!=!0)return;let o=rn({},n.clusterNodeProperties);if(n.processProperties!==void 0){const f=[];for(const y in e)if(Object.prototype.hasOwnProperty.call(e,y)){const g=ya.cloneOptions(e[y]);f.push(g)}const v=[];for(const y in t)if(Object.prototype.hasOwnProperty.call(t,y)&&y.substr(0,12)!=="clusterEdge:"){const g=ya.cloneOptions(t[y],"edge");v.push(g)}if(o=n.processProperties(o,f,v),!o)throw new Error("The processProperties function does not return properties!")}o.id===void 0&&(o.id="cluster:"+Av());const u=o.id;o.label===void 0&&(o.label="cluster");let c;o.x===void 0&&(c=this._getClusterPosition(e),o.x=c.x),o.y===void 0&&(c===void 0&&(c=this._getClusterPosition(e)),o.y=c.y),o.id=u;const h=this.body.functions.createNode(o,$2e);h.containedNodes=e,h.containedEdges=t,h.clusterEdgeProperties=n.clusterEdgeProperties,this.body.nodes[o.id]=h,this._clusterEdges(e,t,o,n.clusterEdgeProperties),o.id=void 0,i===!0&&this.body.emitter.emit("_dataChanged")}_backupEdgeOptions(e){this.clusteredEdges[e.id]===void 0&&(this.clusteredEdges[e.id]={physics:e.options.physics})}_restoreEdge(e){const t=this.clusteredEdges[e.id];t!==void 0&&(e.setOptions({physics:t.physics}),delete this.clusteredEdges[e.id])}isCluster(e){return this.body.nodes[e]!==void 0?this.body.nodes[e].isCluster===!0:(console.error("Node does not exist."),!1)}_getClusterPosition(e){const t=Pn(e);let n=e[t[0]].x,i=e[t[0]].x,a=e[t[0]].y,o=e[t[0]].y,u;for(let c=1;c<t.length;c++)u=e[t[c]],n=u.x<n?u.x:n,i=u.x>i?u.x:i,a=u.y<a?u.y:a,o=u.y>o?u.y:o;return{x:.5*(n+i),y:.5*(a+o)}}openCluster(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No clusterNodeId supplied to openCluster.");const i=this.body.nodes[e];if(i===void 0)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(i.isCluster!==!0||i.containedNodes===void 0||i.containedEdges===void 0)throw new Error("The node:"+e+" is not a valid cluster.");const a=this.findNode(e),o=Lr(a).call(a,e)-1;if(o>=0){const f=a[o];this.body.nodes[f]._openChildCluster(e),delete this.body.nodes[e],n===!0&&this.body.emitter.emit("_dataChanged");return}const u=i.containedNodes,c=i.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction=="function"){const f={},v={x:i.x,y:i.y};for(const g in u)if(Object.prototype.hasOwnProperty.call(u,g)){const _=this.body.nodes[g];f[g]={x:_.x,y:_.y}}const y=t.releaseFunction(v,f);for(const g in u)if(Object.prototype.hasOwnProperty.call(u,g)){const _=this.body.nodes[g];y[g]!==void 0&&(_.x=y[g].x===void 0?i.x:y[g].x,_.y=y[g].y===void 0?i.y:y[g].y)}}else cr(u,function(f){f.options.fixed.x===!1&&(f.x=i.x),f.options.fixed.y===!1&&(f.y=i.y)});for(const f in u)if(Object.prototype.hasOwnProperty.call(u,f)){const v=this.body.nodes[f];v.vx=i.vx,v.vy=i.vy,v.setOptions({physics:!0}),delete this.clusteredNodes[f]}const h=[];for(let f=0;f<i.edges.length;f++)h.push(i.edges[f]);for(let f=0;f<h.length;f++){const v=h[f],y=this._getConnectedId(v,e),g=this.clusteredNodes[y];for(let _=0;_<v.clusteringEdgeReplacingIds.length;_++){const E=v.clusteringEdgeReplacingIds[_],R=this.body.edges[E];if(R!==void 0)if(g!==void 0){const T=this.body.nodes[g.clusterId];T.containedEdges[R.id]=R,delete c[R.id];let k=R.fromId,N=R.toId;R.toId==y?N=g.clusterId:k=g.clusterId,this._createClusteredEdge(k,N,R,T.clusterEdgeProperties,{hidden:!1,physics:!0})}else this._restoreEdge(R)}v.remove()}for(const f in c)Object.prototype.hasOwnProperty.call(c,f)&&this._restoreEdge(c[f]);delete this.body.nodes[e],n===!0&&this.body.emitter.emit("_dataChanged")}getNodesInCluster(e){const t=[];if(this.isCluster(e)===!0){const n=this.body.nodes[e].containedNodes;for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&t.push(this.body.nodes[i].id)}return t}findNode(e){const t=[];let i=0,a;for(;this.clusteredNodes[e]!==void 0&&i<100;){if(a=this.body.nodes[e],a===void 0)return[];t.push(a.id),e=this.clusteredNodes[e].clusterId,i++}return a=this.body.nodes[e],a===void 0?[]:(t.push(a.id),Td(t).call(t),t)}updateClusteredNode(e,t){if(e===void 0)throw new Error("No clusteredNodeId supplied to updateClusteredNode.");if(t===void 0)throw new Error("No newOptions supplied to updateClusteredNode.");if(this.body.nodes[e]===void 0)throw new Error("The clusteredNodeId supplied to updateClusteredNode does not exist.");this.body.nodes[e].setOptions(t),this.body.emitter.emit("_dataChanged")}updateEdge(e,t){if(e===void 0)throw new Error("No startEdgeId supplied to updateEdge.");if(t===void 0)throw new Error("No newOptions supplied to updateEdge.");if(this.body.edges[e]===void 0)throw new Error("The startEdgeId supplied to updateEdge does not exist.");const n=this.getClusteredEdges(e);for(let i=0;i<n.length;i++)this.body.edges[n[i]].setOptions(t);this.body.emitter.emit("_dataChanged")}getClusteredEdges(e){const t=[];let i=0;for(;e!==void 0&&this.body.edges[e]!==void 0&&i<100;)t.push(this.body.edges[e].id),e=this.body.edges[e].edgeReplacedById,i++;return Td(t).call(t),t}getBaseEdge(e){return this.getBaseEdges(e)[0]}getBaseEdges(e){const t=[e],n=[],i=[],a=100;let o=0;for(;t.length>0&&o<a;){const u=t.pop();if(u===void 0)continue;const c=this.body.edges[u];if(c===void 0)continue;o++;const h=c.clusteringEdgeReplacingIds;if(h===void 0)i.push(u);else for(let f=0;f<h.length;++f){const v=h[f];Lr(t).call(t,h)!==-1||Lr(n).call(n,h)!==-1||t.push(v)}n.push(u)}return i}_getConnectedId(e,t){return e.toId!=t?e.toId:(e.fromId!=t,e.fromId)}_getHubSize(){let e=0,t=0,n=0,i=0;for(let c=0;c<this.body.nodeIndices.length;c++){const h=this.body.nodes[this.body.nodeIndices[c]];h.edges.length>i&&(i=h.edges.length),e+=h.edges.length,t+=Math.pow(h.edges.length,2),n+=1}e=e/n,t=t/n;const a=t-Math.pow(e,2),o=Math.sqrt(a);let u=Math.floor(e+2*o);return u>i&&(u=i),u}_createClusteredEdge(e,t,n,i,a){const o=ya.cloneOptions(n,"edge");rn(o,i),o.from=e,o.to=t,o.id="clusterEdge:"+Av(),a!==void 0&&rn(o,a);const u=this.body.functions.createEdge(o);return u.clusteringEdgeReplacingIds=[n.id],u.connect(),this.body.edges[u.id]=u,u}_clusterEdges(e,t,n,i){if(t instanceof Cc){const a=t,o={};o[a.id]=a,t=o}if(e instanceof gn){const a=e,o={};o[a.id]=a,e=o}if(n==null)throw new Error("_clusterEdges: parameter clusterNode required");i===void 0&&(i=n.clusterEdgeProperties),this._createClusterEdges(e,t,n,i);for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&this.body.edges[a]!==void 0){const o=this.body.edges[a];this._backupEdgeOptions(o),o.setOptions({physics:!1})}for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(this.clusteredNodes[a]={clusterId:n.id,node:this.body.nodes[a]},this.body.nodes[a].setOptions({physics:!1}))}_getClusterNodeForNode(e){if(e===void 0)return;const t=this.clusteredNodes[e];if(t===void 0)return;const n=t.clusterId;if(n!==void 0)return this.body.nodes[n]}_filter(e,t){const n=[];return cr(e,i=>{t(i)&&n.push(i)}),n}_updateState(){let e;const t=[],n={},i=c=>{cr(this.body.nodes,h=>{h.isCluster===!0&&c(h)})};for(e in this.clusteredNodes){if(!Object.prototype.hasOwnProperty.call(this.clusteredNodes,e))continue;this.body.nodes[e]===void 0&&t.push(e)}i(function(c){for(let h=0;h<t.length;h++)delete c.containedNodes[t[h]]});for(let c=0;c<t.length;c++)delete this.clusteredNodes[t[c]];cr(this.clusteredEdges,c=>{const h=this.body.edges[c];(h===void 0||!h.endPointsValid())&&(n[c]=c)}),i(function(c){cr(c.containedEdges,(h,f)=>{!h.endPointsValid()&&!n[f]&&(n[f]=f)})}),cr(this.body.edges,(c,h)=>{let f=!0;const v=c.clusteringEdgeReplacingIds;if(v!==void 0){let y=0;cr(v,g=>{const _=this.body.edges[g];_!==void 0&&_.endPointsValid()&&(y+=1)}),f=y>0}(!c.endPointsValid()||!f)&&(n[h]=h)}),i(c=>{cr(n,h=>{delete c.containedEdges[h],cr(c.edges,(f,v)=>{if(f.id===h){c.edges[v]=null;return}f.clusteringEdgeReplacingIds=this._filter(f.clusteringEdgeReplacingIds,function(y){return!n[y]})}),c.edges=this._filter(c.edges,function(f){return f!==null})})}),cr(n,c=>{delete this.clusteredEdges[c]}),cr(n,c=>{delete this.body.edges[c]});const a=Pn(this.body.edges);cr(a,c=>{const h=this.body.edges[c],f=this._isClusteredNode(h.fromId)||this._isClusteredNode(h.toId);if(f!==this._isClusteredEdge(h.id))if(f){const v=this._getClusterNodeForNode(h.fromId);v!==void 0&&this._clusterEdges(this.body.nodes[h.fromId],h,v);const y=this._getClusterNodeForNode(h.toId);y!==void 0&&this._clusterEdges(this.body.nodes[h.toId],h,y)}else delete this._clusterEdges[c],this._restoreEdge(h)});let o=!1,u=!0;for(;u;){const c=[];i(function(h){const f=Pn(h.containedNodes).length,v=h.options.allowSingleNodeCluster===!0;(v&&f<1||!v&&f<2)&&c.push(h.id)});for(let h=0;h<c.length;++h)this.openCluster(c[h],{},!1);u=c.length>0,o=o||u}o&&this._updateState()}_isClusteredNode(e){return this.clusteredNodes[e]!==void 0}_isClusteredEdge(e){return this.clusteredEdges[e]!==void 0}}class F2e{constructor(e,t){this.body=e,this.canvas=t,this.redrawRequested=!1,this.requestAnimationFrameRequestId=void 0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},Jn(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e;this.body.emitter.on("dragStart",()=>{this.dragging=!0}),this.body.emitter.on("dragEnd",()=>{this.dragging=!1}),this.body.emitter.on("zoom",()=>{this.zooming=!0,window.clearTimeout(this.zoomTimeoutId),this.zoomTimeoutId=du(()=>{var t;this.zooming=!1,Ze(t=this._requestRedraw).call(t,this)()},250)}),this.body.emitter.on("_resizeNodes",()=>{this._resizeNodes()}),this.body.emitter.on("_redraw",()=>{this.renderingActive===!1&&this._redraw()}),this.body.emitter.on("_blockRedraw",()=>{this.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",()=>{this.allowRedraw=!0,this.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",Ze(e=this._requestRedraw).call(e,this)),this.body.emitter.on("_startRendering",()=>{this.renderRequests+=1,this.renderingActive=!0,this._startRendering()}),this.body.emitter.on("_stopRendering",()=>{this.renderRequests-=1,this.renderingActive=this.renderRequests>0,this.requestAnimationFrameRequestId=void 0}),this.body.emitter.on("destroy",()=>{this.renderRequests=0,this.allowRedraw=!1,this.renderingActive=!1,window.cancelAnimationFrame(this.requestAnimationFrameRequestId),this.body.emitter.off()})}setOptions(e){e!==void 0&&pp(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"],this.options,e)}_startRendering(){if(this.renderingActive===!0&&this.requestAnimationFrameRequestId===void 0){var e;this.requestAnimationFrameRequestId=window.requestAnimationFrame(Ze(e=this._renderStep).call(e,this),this.simulationInterval)}}_renderStep(){this.renderingActive===!0&&(this.requestAnimationFrameRequestId=void 0,this._startRendering(),this._redraw())}redraw(){this.body.emitter.emit("setSize"),this._redraw()}_requestRedraw(){this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,window.requestAnimationFrame(()=>{this._redraw(!1)}))}_redraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;const t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();const n=this.canvas.getContext(),i=this.canvas.frame.canvas.clientWidth,a=this.canvas.frame.canvas.clientHeight;if(n.clearRect(0,0,i,a),this.canvas.frame.clientWidth===0)return;if(n.save(),n.translate(this.body.view.translation.x,this.body.view.translation.y),n.scale(this.body.view.scale,this.body.view.scale),n.beginPath(),this.body.emitter.emit("beforeDrawing",n),n.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(n),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){const{drawExternalLabels:o}=this._drawNodes(n,e);t.drawExternalLabels=o}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(n),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(n),n.beginPath(),this.body.emitter.emit("afterDrawing",n),n.closePath(),n.restore(),e===!0&&n.clearRect(0,0,i,a)}}_resizeNodes(){this.canvas.setTransform();const e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);const t=this.body.nodes;let n;for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n=t[i],n.resize(e),n.updateBoundingBox(e,n.selected));e.restore()}_drawNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=this.body.nodes,i=this.body.nodeIndices;let a;const o=[],u=[],c=20,h=this.canvas.DOMtoCanvas({x:-c,y:-c}),f=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+c,y:this.canvas.frame.canvas.clientHeight+c}),v={top:h.y,left:h.x,bottom:f.y,right:f.x},y=[];for(let R=0;R<i.length;R++)if(a=n[i[R]],a.hover)u.push(i[R]);else if(a.isSelected())o.push(i[R]);else if(t===!0){const T=a.draw(e);T.drawExternalLabel!=null&&y.push(T.drawExternalLabel)}else if(a.isBoundingBoxOverlappingWith(v)===!0){const T=a.draw(e);T.drawExternalLabel!=null&&y.push(T.drawExternalLabel)}else a.updateBoundingBox(e,a.selected);let g;const _=o.length,E=u.length;for(g=0;g<_;g++){a=n[o[g]];const R=a.draw(e);R.drawExternalLabel!=null&&y.push(R.drawExternalLabel)}for(g=0;g<E;g++){a=n[u[g]];const R=a.draw(e);R.drawExternalLabel!=null&&y.push(R.drawExternalLabel)}return{drawExternalLabels:()=>{for(const R of y)R()}}}_drawEdges(e){const t=this.body.edges,n=this.body.edgeIndices;for(let i=0;i<n.length;i++){const a=t[n[i]];a.connected===!0&&a.draw(e)}}_drawArrows(e){const t=this.body.edges,n=this.body.edgeIndices;for(let i=0;i<n.length;i++){const a=t[n[i]];a.connected===!0&&a.drawArrows(e)}}_drawSelectionBox(e){if(this.body.selectionBox.show){e.beginPath();const t=this.body.selectionBox.position.end.x-this.body.selectionBox.position.start.x,n=this.body.selectionBox.position.end.y-this.body.selectionBox.position.start.y;e.rect(this.body.selectionBox.position.start.x,this.body.selectionBox.position.start.y,t,n),e.fillStyle="rgba(151, 194, 252, 0.2)",e.fillRect(this.body.selectionBox.position.start.x,this.body.selectionBox.position.start.y,t,n),e.strokeStyle="rgba(151, 194, 252, 1)",e.stroke()}else e.closePath()}}var zT,YW;function z2e(){if(YW)return zT;YW=1,tQ();var r=Br();return zT=r.setInterval,zT}var UT,KW;function U2e(){return KW||(KW=1,UT=z2e()),UT}var H2e=U2e(),W2e=Jt(H2e);function L1(r,e){e.inputHandler=function(t){t.isFirst&&e(t)},r.on("hammer.input",e.inputHandler)}function QQ(r,e){return e.inputHandler=function(t){t.isFinal&&e(t)},r.on("hammer.input",e.inputHandler)}class G2e{constructor(e){this.body=e,this.pixelRatio=1,this.cameraState={},this.initialized=!1,this.canvasViewCenter={},this._cleanupCallbacks=[],this.options={},this.defaultOptions={autoResize:!0,height:"100%",width:"100%"},Jn(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e;this.body.emitter.once("resize",t=>{t.width!==0&&(this.body.view.translation.x=t.width*.5),t.height!==0&&(this.body.view.translation.y=t.height*.5)}),this.body.emitter.on("setSize",Ze(e=this.setSize).call(e,this)),this.body.emitter.on("destroy",()=>{this.hammerFrame.destroy(),this.hammer.destroy(),this._cleanUp()})}setOptions(e){if(e!==void 0&&pp(["width","height","autoResize"],this.options,e),this._cleanUp(),this.options.autoResize===!0){var t;if(window.ResizeObserver){const i=new ResizeObserver(()=>{this.setSize()===!0&&this.body.emitter.emit("_requestRedraw")}),{frame:a}=this;i.observe(a),this._cleanupCallbacks.push(()=>{i.unobserve(a)})}else{const i=W2e(()=>{this.setSize()===!0&&this.body.emitter.emit("_requestRedraw")},1e3);this._cleanupCallbacks.push(()=>{clearInterval(i)})}const n=Ze(t=this._onResize).call(t,this);window.addEventListener("resize",n),this._cleanupCallbacks.push(()=>{window.removeEventListener("resize",n)})}}_cleanUp(){var e,t,n;Kr(e=Td(t=cu(n=this._cleanupCallbacks).call(n,0)).call(t)).call(e,i=>{try{i()}catch(a){console.error(a)}})}_onResize(){this.setSize(),this.body.emitter.emit("_redraw")}_getCameraState(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}_setCameraState(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){const e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight;let n=this.cameraState.scale;e!=1&&t!=1?n=this.cameraState.scale*.5*(e+t):e!=1?n=this.cameraState.scale*e:t!=1&&(n=this.cameraState.scale*t),this.body.view.scale=n;const i=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),a={x:i.x-this.cameraState.position.x,y:i.y-this.cameraState.position.y};this.body.view.translation.x+=a.x*this.body.view.scale,this.body.view.translation.y+=a.y*this.body.view.scale}}_prepareValue(e){if(typeof e=="number")return e+"px";if(typeof e=="string"){if(Lr(e).call(e,"%")!==-1||Lr(e).call(e,"px")!==-1)return e;if(Lr(e).call(e,"%")===-1)return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}_create(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=0,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{const e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}_bindHammer(){this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new wf(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:wf.DIRECTION_ALL}),L1(this.hammer,e=>{this.body.eventListeners.onTouch(e)}),this.hammer.on("tap",e=>{this.body.eventListeners.onTap(e)}),this.hammer.on("doubletap",e=>{this.body.eventListeners.onDoubleTap(e)}),this.hammer.on("press",e=>{this.body.eventListeners.onHold(e)}),this.hammer.on("panstart",e=>{this.body.eventListeners.onDragStart(e)}),this.hammer.on("panmove",e=>{this.body.eventListeners.onDrag(e)}),this.hammer.on("panend",e=>{this.body.eventListeners.onDragEnd(e)}),this.hammer.on("pinch",e=>{this.body.eventListeners.onPinch(e)}),this.frame.canvas.addEventListener("wheel",e=>{this.body.eventListeners.onMouseWheel(e)}),this.frame.canvas.addEventListener("mousemove",e=>{this.body.eventListeners.onMouseMove(e)}),this.frame.canvas.addEventListener("contextmenu",e=>{this.body.eventListeners.onContext(e)}),this.hammerFrame=new wf(this.frame),QQ(this.hammerFrame,e=>{this.body.eventListeners.onRelease(e)})}setSize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);let n=!1;const i=this.frame.canvas.width,a=this.frame.canvas.height,o=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(o),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},n=!0;else{const u=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),c=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==u||this.frame.canvas.height!==c)&&this._getCameraState(o),this.frame.canvas.width!==u&&(this.frame.canvas.width=u,n=!0),this.frame.canvas.height!==c&&(this.frame.canvas.height=c,n=!0)}return n===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(i/this.pixelRatio),oldHeight:Math.round(a/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,n}getContext(){return this.frame.canvas.getContext("2d")}_determinePixelRatio(){const e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");let t=1;typeof window<"u"&&(t=window.devicePixelRatio||1);const n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/n}_setPixelRatio(){this.pixelRatio=this._determinePixelRatio()}setTransform(){const e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}_XconvertDOMtoCanvas(e){return(e-this.body.view.translation.x)/this.body.view.scale}_XconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.x}_YconvertDOMtoCanvas(e){return(e-this.body.view.translation.y)/this.body.view.scale}_YconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.y}canvasToDOM(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}DOMtoCanvas(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}function V2e(r,e){const t=Jn({nodes:e,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},r??{});if(!Mn(t.nodes))throw new TypeError("Nodes has to be an array of ids.");if(t.nodes.length===0&&(t.nodes=e),!(typeof t.minZoomLevel=="number"&&t.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!(typeof t.maxZoomLevel=="number"&&t.minZoomLevel<=t.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return t}class Y2e{constructor(e,t){var n,i;this.body=e,this.canvas=t,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",Ze(n=this.fit).call(n,this)),this.body.emitter.on("animationFinished",()=>{this.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",Ze(i=this.releaseNode).call(i,this))}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}fit(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=V2e(e,this.body.nodeIndices);const n=this.canvas.frame.canvas.clientWidth,i=this.canvas.frame.canvas.clientHeight;let a,o;if(n===0||i===0)o=1,a=ya.getRange(this.body.nodes,e.nodes);else if(t===!0){let h=0;for(const y in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,y)&&this.body.nodes[y].predefinedPosition===!0&&(h+=1);if(h>.5*this.body.nodeIndices.length){this.fit(e,!1);return}a=ya.getRange(this.body.nodes,e.nodes),o=12.662/(this.body.nodeIndices.length+7.4147)+.0964822;const v=Math.min(n/600,i/600);o*=v}else{this.body.emitter.emit("_resizeNodes"),a=ya.getRange(this.body.nodes,e.nodes);const h=Math.abs(a.maxX-a.minX)*1.1,f=Math.abs(a.maxY-a.minY)*1.1,v=n/h,y=i/f;o=v<=y?v:y}o>e.maxZoomLevel?o=e.maxZoomLevel:o<e.minZoomLevel&&(o=e.minZoomLevel);const c={position:ya.findCenter(a),scale:o,animation:e.animation};this.moveTo(c)}focus(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.body.nodes[e]!==void 0){const n={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=n,t.lockedOnNode=e,this.moveTo(t)}else console.error("Node: "+e+" cannot be found.")}moveTo(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!wd(e.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!wd(e.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!wd(e.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!wd(e.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}animateView(e){if(e===void 0)return;this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;const t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+n.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+n.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var i;this.viewFunction=Ze(i=this._lockedRedraw).call(i,this),this.body.emitter.on("initRedraw",this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw");else{var a;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=Ze(a=this._transitionRedraw).call(a,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}_lockedRedraw(){const e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.x,y:t.y-e.y},i=this.body.view.translation,a={x:i.x+n.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:i.y+n.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=a}releaseNode(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}_transitionRedraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;const t=rye[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var n;this.viewFunction=Ze(n=this._lockedRedraw).call(n,this),this.body.emitter.on("initRedraw",this.viewFunction)}this.body.emitter.emit("animationFinished")}}getScale(){return this.body.view.scale}getViewPosition(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}function XW(r){var e=r&&r.preventDefault||!1,t=r&&r.container||window,n={},i={keydown:{},keyup:{}},a={},o;for(o=97;o<=122;o++)a[String.fromCharCode(o)]={code:65+(o-97),shift:!1};for(o=65;o<=90;o++)a[String.fromCharCode(o)]={code:o,shift:!0};for(o=0;o<=9;o++)a[""+o]={code:48+o,shift:!1};for(o=1;o<=12;o++)a["F"+o]={code:111+o,shift:!1};for(o=0;o<=9;o++)a["num"+o]={code:96+o,shift:!1};a["num*"]={code:106,shift:!1},a["num+"]={code:107,shift:!1},a["num-"]={code:109,shift:!1},a["num/"]={code:111,shift:!1},a["num."]={code:110,shift:!1},a.left={code:37,shift:!1},a.up={code:38,shift:!1},a.right={code:39,shift:!1},a.down={code:40,shift:!1},a.space={code:32,shift:!1},a.enter={code:13,shift:!1},a.shift={code:16,shift:void 0},a.esc={code:27,shift:!1},a.backspace={code:8,shift:!1},a.tab={code:9,shift:!1},a.ctrl={code:17,shift:!1},a.alt={code:18,shift:!1},a.delete={code:46,shift:!1},a.pageup={code:33,shift:!1},a.pagedown={code:34,shift:!1},a["="]={code:187,shift:!1},a["-"]={code:189,shift:!1},a["]"]={code:221,shift:!1},a["["]={code:219,shift:!1};var u=function(f){h(f,"keydown")},c=function(f){h(f,"keyup")},h=function(f,v){if(i[v][f.keyCode]!==void 0){for(var y=i[v][f.keyCode],g=0;g<y.length;g++)(y[g].shift===void 0||y[g].shift==!0&&f.shiftKey==!0||y[g].shift==!1&&f.shiftKey==!1)&&y[g].fn(f);e==!0&&f.preventDefault()}};return n.bind=function(f,v,y){if(y===void 0&&(y="keydown"),a[f]===void 0)throw new Error("unsupported key: "+f);i[y][a[f].code]===void 0&&(i[y][a[f].code]=[]),i[y][a[f].code].push({fn:v,shift:a[f].shift})},n.bindAll=function(f,v){v===void 0&&(v="keydown");for(var y in a)a.hasOwnProperty(y)&&n.bind(y,f,v)},n.getKey=function(f){for(var v in a)if(a.hasOwnProperty(v)){if(f.shiftKey==!0&&a[v].shift==!0&&f.keyCode==a[v].code)return v;if(f.shiftKey==!1&&a[v].shift==!1&&f.keyCode==a[v].code)return v;if(f.keyCode==a[v].code&&v=="shift")return v}return"unknown key, currently not supported"},n.unbind=function(f,v,y){if(y===void 0&&(y="keydown"),a[f]===void 0)throw new Error("unsupported key: "+f);if(v!==void 0){var g=[],_=i[y][a[f].code];if(_!==void 0)for(var E=0;E<_.length;E++)_[E].fn==v&&_[E].shift==a[f].shift||g.push(i[y][a[f].code][E]);i[y][a[f].code]=g}else i[y][a[f].code]=[]},n.reset=function(){i={keydown:{},keyup:{}}},n.destroy=function(){i={keydown:{},keyup:{}},t.removeEventListener("keydown",u,!0),t.removeEventListener("keyup",c,!0)},t.addEventListener("keydown",u,!0),t.addEventListener("keyup",c,!0),n}class K2e{constructor(e,t){this.body=e,this.canvas=t,this.iconsCreated=!1,this.navigationHammers=[],this.boundFunctions={},this.touchTime=0,this.activated=!1,this.body.emitter.on("activate",()=>{this.activated=!0,this.configureKeyboardBindings()}),this.body.emitter.on("deactivate",()=>{this.activated=!1,this.configureKeyboardBindings()}),this.body.emitter.on("destroy",()=>{this.keycharm!==void 0&&this.keycharm.destroy()}),this.options={}}setOptions(e){e!==void 0&&(this.options=e,this.create())}create(){this.options.navigationButtons===!0?this.iconsCreated===!1&&this.loadNavigationElements():this.iconsCreated===!0&&this.cleanNavigation(),this.configureKeyboardBindings()}cleanNavigation(){if(this.navigationHammers.length!=0){for(let e=0;e<this.navigationHammers.length;e++)this.navigationHammers[e].destroy();this.navigationHammers=[]}this.navigationDOM&&this.navigationDOM.wrapper&&this.navigationDOM.wrapper.parentNode&&this.navigationDOM.wrapper.parentNode.removeChild(this.navigationDOM.wrapper),this.iconsCreated=!1}loadNavigationElements(){this.cleanNavigation(),this.navigationDOM={};const e=["up","down","left","right","zoomIn","zoomOut","zoomExtends"],t=["_moveUp","_moveDown","_moveLeft","_moveRight","_zoomIn","_zoomOut","_fit"];this.navigationDOM.wrapper=document.createElement("div"),this.navigationDOM.wrapper.className="vis-navigation",this.canvas.frame.appendChild(this.navigationDOM.wrapper);for(let o=0;o<e.length;o++){this.navigationDOM[e[o]]=document.createElement("div"),this.navigationDOM[e[o]].className="vis-button vis-"+e[o],this.navigationDOM.wrapper.appendChild(this.navigationDOM[e[o]]);const u=new wf(this.navigationDOM[e[o]]);if(t[o]==="_fit"){var n;L1(u,Ze(n=this._fit).call(n,this))}else{var i;L1(u,Ze(i=this.bindToRedraw).call(i,this,t[o]))}this.navigationHammers.push(u)}const a=new wf(this.canvas.frame);QQ(a,()=>{this._stopMovement()}),this.navigationHammers.push(a),this.iconsCreated=!0}bindToRedraw(e){if(this.boundFunctions[e]===void 0){var t;this.boundFunctions[e]=Ze(t=this[e]).call(t,this),this.body.emitter.on("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_startRendering")}}unbindFromRedraw(e){this.boundFunctions[e]!==void 0&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"),delete this.boundFunctions[e])}_fit(){new Date().valueOf()-this.touchTime>700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=new Date().valueOf())}_stopMovement(){for(const e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}_moveUp(){this.body.view.translation.y+=this.options.keyboard.speed.y}_moveDown(){this.body.view.translation.y-=this.options.keyboard.speed.y}_moveLeft(){this.body.view.translation.x+=this.options.keyboard.speed.x}_moveRight(){this.body.view.translation.x-=this.options.keyboard.speed.x}_zoomIn(){const e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,i=t/e,a=(1-i)*this.canvas.canvasViewCenter.x+n.x*i,o=(1-i)*this.canvas.canvasViewCenter.y+n.y*i;this.body.view.scale=t,this.body.view.translation={x:a,y:o},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}_zoomOut(){const e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,i=t/e,a=(1-i)*this.canvas.canvasViewCenter.x+n.x*i,o=(1-i)*this.canvas.canvasViewCenter.y+n.y*i;this.body.view.scale=t,this.body.view.translation={x:a,y:o},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}configureKeyboardBindings(){if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=XW({container:window,preventDefault:!0}):this.keycharm=XW({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var e,t,n,i,a,o,u,c,h,f,v,y,g,_,E,R,T,k,N,A,j,W,G,D;Ze(e=this.keycharm).call(e,"up",()=>{this.bindToRedraw("_moveUp")},"keydown"),Ze(t=this.keycharm).call(t,"down",()=>{this.bindToRedraw("_moveDown")},"keydown"),Ze(n=this.keycharm).call(n,"left",()=>{this.bindToRedraw("_moveLeft")},"keydown"),Ze(i=this.keycharm).call(i,"right",()=>{this.bindToRedraw("_moveRight")},"keydown"),Ze(a=this.keycharm).call(a,"=",()=>{this.bindToRedraw("_zoomIn")},"keydown"),Ze(o=this.keycharm).call(o,"num+",()=>{this.bindToRedraw("_zoomIn")},"keydown"),Ze(u=this.keycharm).call(u,"num-",()=>{this.bindToRedraw("_zoomOut")},"keydown"),Ze(c=this.keycharm).call(c,"-",()=>{this.bindToRedraw("_zoomOut")},"keydown"),Ze(h=this.keycharm).call(h,"[",()=>{this.bindToRedraw("_zoomOut")},"keydown"),Ze(f=this.keycharm).call(f,"]",()=>{this.bindToRedraw("_zoomIn")},"keydown"),Ze(v=this.keycharm).call(v,"pageup",()=>{this.bindToRedraw("_zoomIn")},"keydown"),Ze(y=this.keycharm).call(y,"pagedown",()=>{this.bindToRedraw("_zoomOut")},"keydown"),Ze(g=this.keycharm).call(g,"up",()=>{this.unbindFromRedraw("_moveUp")},"keyup"),Ze(_=this.keycharm).call(_,"down",()=>{this.unbindFromRedraw("_moveDown")},"keyup"),Ze(E=this.keycharm).call(E,"left",()=>{this.unbindFromRedraw("_moveLeft")},"keyup"),Ze(R=this.keycharm).call(R,"right",()=>{this.unbindFromRedraw("_moveRight")},"keyup"),Ze(T=this.keycharm).call(T,"=",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),Ze(k=this.keycharm).call(k,"num+",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),Ze(N=this.keycharm).call(N,"num-",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),Ze(A=this.keycharm).call(A,"-",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),Ze(j=this.keycharm).call(j,"[",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),Ze(W=this.keycharm).call(W,"]",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),Ze(G=this.keycharm).call(G,"pageup",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),Ze(D=this.keycharm).call(D,"pagedown",()=>{this.unbindFromRedraw("_zoomOut")},"keyup")}}}class X2e{constructor(e,t,n){var i,a,o,u,c,h,f,v,y,g,_,E,R;this.body=e,this.canvas=t,this.selectionHandler=n,this.navigationHandler=new K2e(e,t),this.body.eventListeners.onTap=Ze(i=this.onTap).call(i,this),this.body.eventListeners.onTouch=Ze(a=this.onTouch).call(a,this),this.body.eventListeners.onDoubleTap=Ze(o=this.onDoubleTap).call(o,this),this.body.eventListeners.onHold=Ze(u=this.onHold).call(u,this),this.body.eventListeners.onDragStart=Ze(c=this.onDragStart).call(c,this),this.body.eventListeners.onDrag=Ze(h=this.onDrag).call(h,this),this.body.eventListeners.onDragEnd=Ze(f=this.onDragEnd).call(f,this),this.body.eventListeners.onMouseWheel=Ze(v=this.onMouseWheel).call(v,this),this.body.eventListeners.onPinch=Ze(y=this.onPinch).call(y,this),this.body.eventListeners.onMouseMove=Ze(g=this.onMouseMove).call(g,this),this.body.eventListeners.onRelease=Ze(_=this.onRelease).call(_,this),this.body.eventListeners.onContext=Ze(E=this.onContext).call(E,this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=Ze(R=this.getPointer).call(R,this),this.options={},this.defaultOptions={dragNodes:!0,dragView:!0,hover:!1,keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02},bindToWindow:!0,autoFocus:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0,zoomSpeed:1},Jn(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("destroy",()=>{clearTimeout(this.popupTimer),delete this.body.functions.getPointer})}setOptions(e){e!==void 0&&(M1(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag","keyboard","multiselect","selectable","selectConnectedEdges"],this.options,e),Ns(this.options,e,"keyboard"),e.tooltip&&(Jn(this.options.tooltip,e.tooltip),e.tooltip.color&&(this.options.tooltip.color=f6(e.tooltip.color)))),this.navigationHandler.setOptions(this.options)}getPointer(e){return{x:e.x-Z1e(this.canvas.frame.canvas),y:e.y-J1e(this.canvas.frame.canvas)}}onTouch(e){new Date().valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}onTap(e){const t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t)}onDoubleTap(e){const t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,t)}onHold(e){const t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t),this.selectionHandler.generateClickEvent("hold",e,t)}onRelease(e){if(new Date().valueOf()-this.touchTime>10){const t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,t),this.touchTime=new Date().valueOf()}}onContext(e){const t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,t)}checkSelectionChanges(e){(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1)===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}_determineDifference(e,t){const n=function(i,a){const o=[];for(let u=0;u<i.length;u++){const c=i[u];Lr(a).call(a,c)===-1&&o.push(c)}return o};return{nodes:n(e.nodes,t.nodes),edges:n(e.edges,t.edges)}}onDragStart(e){if(this.drag.dragging)return;this.drag.pointer===void 0&&this.onTouch(e);const t=this.selectionHandler.getNodeAt(this.drag.pointer);if(this.drag.dragging=!0,this.drag.selection=[],this.drag.translation=Jn({},this.body.view.translation),this.drag.nodeId=void 0,e.srcEvent.shiftKey){this.body.selectionBox.show=!0;const n=this.getPointer(e.center);this.body.selectionBox.position.start={x:this.canvas._XconvertDOMtoCanvas(n.x),y:this.canvas._YconvertDOMtoCanvas(n.y)},this.body.selectionBox.position.end={x:this.canvas._XconvertDOMtoCanvas(n.x),y:this.canvas._YconvertDOMtoCanvas(n.y)}}else if(t!==void 0&&this.options.dragNodes===!0){this.drag.nodeId=t.id,t.isSelected()===!1&&this.selectionHandler.setSelection({nodes:[t.id]}),this.selectionHandler.generateClickEvent("dragStart",e,this.drag.pointer);for(const n of this.selectionHandler.getSelectedNodes()){const i={id:n.id,node:n,x:n.x,y:n.y,xFixed:n.options.fixed.x,yFixed:n.options.fixed.y};n.options.fixed.x=!0,n.options.fixed.y=!0,this.drag.selection.push(i)}}else this.selectionHandler.generateClickEvent("dragStart",e,this.drag.pointer,void 0,!0)}onDrag(e){if(this.drag.pinched===!0)return;this.body.emitter.emit("unlockNode");const t=this.getPointer(e.center),n=this.drag.selection;if(n&&n.length&&this.options.dragNodes===!0){this.selectionHandler.generateClickEvent("dragging",e,t);const i=t.x-this.drag.pointer.x,a=t.y-this.drag.pointer.y;Kr(n).call(n,o=>{const u=o.node;o.xFixed===!1&&(u.x=this.canvas._XconvertDOMtoCanvas(this.canvas._XconvertCanvasToDOM(o.x)+i)),o.yFixed===!1&&(u.y=this.canvas._YconvertDOMtoCanvas(this.canvas._YconvertCanvasToDOM(o.y)+a))}),this.body.emitter.emit("startSimulation")}else{if(e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}this.body.selectionBox.position.end={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)},this.body.emitter.emit("_requestRedraw")}if(this.options.dragView===!0&&!e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}const i=t.x-this.drag.pointer.x,a=t.y-this.drag.pointer.y;this.body.view.translation={x:this.drag.translation.x+i,y:this.drag.translation.y+a},this.body.emitter.emit("_requestRedraw")}}}onDragEnd(e){if(this.drag.dragging=!1,this.body.selectionBox.show){var t;this.body.selectionBox.show=!1;const n=this.body.selectionBox.position,i={minX:Math.min(n.start.x,n.end.x),minY:Math.min(n.start.y,n.end.y),maxX:Math.max(n.start.x,n.end.x),maxY:Math.max(n.start.y,n.end.y)},a=Da(t=this.body.nodeIndices).call(t,u=>{const c=this.body.nodes[u];return c.x>=i.minX&&c.x<=i.maxX&&c.y>=i.minY&&c.y<=i.maxY});Kr(a).call(a,u=>this.selectionHandler.selectObject(this.body.nodes[u]));const o=this.getPointer(e.center);this.selectionHandler.commitAndEmit(o,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{const n=this.drag.selection;n&&n.length?(Kr(n).call(n,function(i){i.node.options.fixed.x=i.xFixed,i.node.options.fixed.y=i.yFixed}),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}onPinch(e){const t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);const n=this.pinch.scale*e.scale;this.zoom(n,t)}zoom(e,t){if(this.options.zoomView===!0){const n=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);let i;this.drag!==void 0&&this.drag.dragging===!0&&(i=this.canvas.DOMtoCanvas(this.drag.pointer));const a=this.body.view.translation,o=e/n,u=(1-o)*t.x+a.x*o,c=(1-o)*t.y+a.y*o;if(this.body.view.scale=e,this.body.view.translation={x:u,y:c},i!=null){const h=this.canvas.canvasToDOM(i);this.drag.pointer.x=h.x,this.drag.pointer.y=h.y}this.body.emitter.emit("_requestRedraw"),n<e?this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:t}):this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:t})}}onMouseWheel(e){if(this.options.zoomView===!0){if(e.deltaY!==0){let t=this.body.view.scale;t*=1+(e.deltaY<0?1:-1)*(this.options.zoomSpeed*.1);const n=this.getPointer({x:e.clientX,y:e.clientY});this.zoom(t,n)}e.preventDefault()}}onMouseMove(e){const t=this.getPointer({x:e.clientX,y:e.clientY});let n=!1;this.popup!==void 0&&(this.popup.hidden===!1&&this._checkHidePopup(t),this.popup.hidden===!1&&(n=!0,this.popup.setPosition(t.x+3,t.y-5),this.popup.show())),this.options.keyboard.autoFocus&&this.options.keyboard.bindToWindow===!1&&this.options.keyboard.enabled===!0&&this.canvas.frame.focus(),n===!1&&(this.popupTimer!==void 0&&(clearInterval(this.popupTimer),this.popupTimer=void 0),this.drag.dragging||(this.popupTimer=du(()=>this._checkShowPopup(t),this.options.tooltipDelay))),this.options.hover===!0&&this.selectionHandler.hoverObject(e,t)}_checkShowPopup(e){const t=this.canvas._XconvertDOMtoCanvas(e.x),n=this.canvas._YconvertDOMtoCanvas(e.y),i={left:t,top:n,right:t,bottom:n},a=this.popupObj===void 0?void 0:this.popupObj.id;let o=!1,u="node";if(this.popupObj===void 0){const c=this.body.nodeIndices,h=this.body.nodes;let f;const v=[];for(let y=0;y<c.length;y++)f=h[c[y]],f.isOverlappingWith(i)===!0&&(o=!0,f.getTitle()!==void 0&&v.push(c[y]));v.length>0&&(this.popupObj=h[v[v.length-1]],o=!0)}if(this.popupObj===void 0&&o===!1){const c=this.body.edgeIndices,h=this.body.edges;let f;const v=[];for(let y=0;y<c.length;y++)f=h[c[y]],f.isOverlappingWith(i)===!0&&f.connected===!0&&f.getTitle()!==void 0&&v.push(c[y]);v.length>0&&(this.popupObj=h[v[v.length-1]],u="edge")}this.popupObj!==void 0?this.popupObj.id!==a&&(this.popup===void 0&&(this.popup=new cye(this.canvas.frame)),this.popup.popupTargetType=u,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}_checkHidePopup(e){const t=this.selectionHandler._pointerToPositionObject(e);let n=!1;if(this.popup.popupTargetType==="node"){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(n=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),n===!0)){const i=this.selectionHandler.getNodeAt(e);n=i===void 0?!1:i.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(n=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));n===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}var QW={},ZW={},JW;function Q2e(){if(JW)return ZW;JW=1;var r=UR(),e=BQ();return r("Set",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},e),ZW}var eG;function Z2e(){return eG||(eG=1,Q2e()),QW}var tG={},HT,rG;function nh(){if(rG)return HT;rG=1;var r=rp(),e=TypeError;return HT=function(t){if(typeof t=="object"&&"size"in t&&"has"in t&&"add"in t&&"delete"in t&&"keys"in t)return t;throw new e(r(t)+" is not a set")},HT}var WT,nG;function ih(){if(nG)return WT;nG=1;var r=fs(),e=FQ(),t=r("Set"),n=t.prototype;return WT={Set:t,add:e("add",1),has:e("has",1),remove:e("delete",1),proto:n},WT}var GT,iG;function ah(){if(iG)return GT;iG=1;var r=za();return GT=function(e,t,n){for(var i=n?e:e.iterator,a=e.next,o,u;!(o=r(a,i)).done;)if(u=t(o.value),u!==void 0)return u},GT}var VT,aG;function Mg(){if(aG)return VT;aG=1;var r=ah();return VT=function(e,t,n){return n?r(e.keys(),t,!0):e.forEach(t)},VT}var YT,sG;function XR(){if(sG)return YT;sG=1;var r=ih(),e=Mg(),t=r.Set,n=r.add;return YT=function(i){var a=new t;return e(i,function(o){n(a,o)}),a},YT}var KT,oG;function Dg(){return oG||(oG=1,KT=function(r){return r.size}),KT}var XT,lG;function J2e(){return lG||(lG=1,XT=function(r){return{iterator:r,next:r.next,done:!1}}),XT}var QT,uG;function sh(){if(uG)return QT;uG=1;var r=wu(),e=ml(),t=za(),n=sp(),i=J2e(),a="Invalid size",o=RangeError,u=TypeError,c=Math.max,h=function(f,v){this.set=f,this.size=c(v,0),this.has=r(f.has),this.keys=r(f.keys)};return h.prototype={getIterator:function(){return i(e(t(this.keys,this.set)))},includes:function(f){return t(this.has,this.set,f)}},QT=function(f){e(f);var v=+f.size;if(v!==v)throw new u(a);var y=n(v);if(y<0)throw new o(a);return new h(f,y)},QT}var ZT,cG;function e5e(){if(cG)return ZT;cG=1;var r=nh(),e=ih(),t=XR(),n=Dg(),i=sh(),a=Mg(),o=ah(),u=e.has,c=e.remove;return ZT=function(f){var v=r(this),y=i(f),g=t(v);return n(v)<=y.size?a(v,function(_){y.includes(_)&&c(g,_)}):o(y.getIterator(),function(_){u(g,_)&&c(g,_)}),g},ZT}var JT,dG;function oh(){return dG||(dG=1,JT=function(){return!1}),JT}var hG;function t5e(){if(hG)return tG;hG=1;var r=Nt(),e=e5e(),t=mr(),n=oh(),i=!n("difference",function(o){return o.size===0}),a=i||t(function(){var o={size:1,has:function(){return!0},keys:function(){var c=0;return{next:function(){var h=c++>1;return u.has(1)&&u.clear(),{done:h,value:2}}}}},u=new Set([1,2,3,4]);return u.difference(o).size!==3});return r({target:"Set",proto:!0,real:!0,forced:a},{difference:e}),tG}var fG={},eO,pG;function r5e(){if(pG)return eO;pG=1;var r=nh(),e=ih(),t=Dg(),n=sh(),i=Mg(),a=ah(),o=e.Set,u=e.add,c=e.has;return eO=function(f){var v=r(this),y=n(f),g=new o;return t(v)>y.size?a(y.getIterator(),function(_){c(v,_)&&u(g,_)}):i(v,function(_){y.includes(_)&&u(g,_)}),g},eO}var vG;function n5e(){if(vG)return fG;vG=1;var r=Nt(),e=mr(),t=r5e(),n=oh(),i=!n("intersection",function(a){return a.size===2&&a.has(1)&&a.has(2)})||e(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});return r({target:"Set",proto:!0,real:!0,forced:i},{intersection:t}),fG}var gG={},tO,mG;function i5e(){if(mG)return tO;mG=1;var r=nh(),e=ih().has,t=Dg(),n=sh(),i=Mg(),a=ah(),o=FR();return tO=function(c){var h=r(this),f=n(c);if(t(h)<=f.size)return i(h,function(y){if(f.includes(y))return!1},!0)!==!1;var v=f.getIterator();return a(v,function(y){if(e(h,y))return o(v,"normal",!1)})!==!1},tO}var yG;function a5e(){if(yG)return gG;yG=1;var r=Nt(),e=i5e(),t=oh(),n=!t("isDisjointFrom",function(i){return!i});return r({target:"Set",proto:!0,real:!0,forced:n},{isDisjointFrom:e}),gG}var bG={},rO,xG;function s5e(){if(xG)return rO;xG=1;var r=nh(),e=Dg(),t=Mg(),n=sh();return rO=function(a){var o=r(this),u=n(a);return e(o)>u.size?!1:t(o,function(c){if(!u.includes(c))return!1},!0)!==!1},rO}var wG;function o5e(){if(wG)return bG;wG=1;var r=Nt(),e=s5e(),t=oh(),n=!t("isSubsetOf",function(i){return i});return r({target:"Set",proto:!0,real:!0,forced:n},{isSubsetOf:e}),bG}var _G={},nO,SG;function l5e(){if(SG)return nO;SG=1;var r=nh(),e=ih().has,t=Dg(),n=sh(),i=ah(),a=FR();return nO=function(u){var c=r(this),h=n(u);if(t(c)<h.size)return!1;var f=h.getIterator();return i(f,function(v){if(!e(c,v))return a(f,"normal",!1)})!==!1},nO}var EG;function u5e(){if(EG)return _G;EG=1;var r=Nt(),e=l5e(),t=oh(),n=!t("isSupersetOf",function(i){return!i});return r({target:"Set",proto:!0,real:!0,forced:n},{isSupersetOf:e}),_G}var TG={},iO,OG;function c5e(){if(OG)return iO;OG=1;var r=nh(),e=ih(),t=XR(),n=sh(),i=ah(),a=e.add,o=e.has,u=e.remove;return iO=function(h){var f=r(this),v=n(h).getIterator(),y=t(f);return i(v,function(g){o(f,g)?u(y,g):a(y,g)}),y},iO}var aO,RG;function ZQ(){return RG||(RG=1,aO=function(r){try{var e=new Set,t={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return e.clear(),e.add(4),function(){return{done:!0}}}})}},n=e[r](t);return n.size===1&&n.values().next().value===4}catch{return!1}}),aO}var AG;function d5e(){if(AG)return TG;AG=1;var r=Nt(),e=c5e(),t=ZQ(),n=oh(),i=!n("symmetricDifference")||!t("symmetricDifference");return r({target:"Set",proto:!0,real:!0,forced:i},{symmetricDifference:e}),TG}var CG={},sO,kG;function h5e(){if(kG)return sO;kG=1;var r=nh(),e=ih().add,t=XR(),n=sh(),i=ah();return sO=function(o){var u=r(this),c=n(o).getIterator(),h=t(u);return i(c,function(f){e(h,f)}),h},sO}var NG;function f5e(){if(NG)return CG;NG=1;var r=Nt(),e=h5e(),t=ZQ(),n=oh(),i=!n("union")||!t("union");return r({target:"Set",proto:!0,real:!0,forced:i},{union:e}),CG}var oO,IG;function p5e(){if(IG)return oO;IG=1,cp(),Z2e(),t5e(),n5e(),a5e(),o5e(),u5e(),d5e(),f5e(),WR();var r=Br();return oO=r.Set,oO}var lO,jG;function v5e(){if(jG)return lO;jG=1;var r=p5e();return dp(),lO=r,lO}var uO,PG;function g5e(){return PG||(PG=1,uO=v5e()),uO}var m5e=g5e(),bc=Jt(m5e),MG={},DG={},cO,qG;function y5e(){if(qG)return cO;qG=1;var r=br(),e=HR(),t=wy().getWeakData,n=zR(),i=ml(),a=Jf(),o=Pi(),u=_y(),c=Bc(),h=Xi(),f=eh(),v=f.set,y=f.getterFor,g=c.find,_=c.findIndex,E=r([].splice),R=0,T=function(A){return A.frozen||(A.frozen=new k)},k=function(){this.entries=[]},N=function(A,j){return g(A.entries,function(W){return W[0]===j})};return k.prototype={get:function(A){var j=N(this,A);if(j)return j[1]},has:function(A){return!!N(this,A)},set:function(A,j){var W=N(this,A);W?W[1]=j:this.entries.push([A,j])},delete:function(A){var j=_(this.entries,function(W){return W[0]===A});return~j&&E(this.entries,j,1),!!~j}},cO={getConstructor:function(A,j,W,G){var D=A(function(q,B){n(q,P),v(q,{type:j,id:R++,frozen:null}),a(B)||u(B,q[G],{that:q,AS_ENTRIES:W})}),P=D.prototype,U=y(j),M=function(q,B,Y){var ue=U(q),re=t(i(B),!0);return re===!0?T(ue).set(B,Y):re[ue.id]=Y,q};return e(P,{delete:function(q){var B=U(this);if(!o(q))return!1;var Y=t(q);return Y===!0?T(B).delete(q):Y&&h(Y,B.id)&&delete Y[B.id]},has:function(B){var Y=U(this);if(!o(B))return!1;var ue=t(B);return ue===!0?T(Y).has(B):ue&&h(ue,Y.id)}}),e(P,W?{get:function(B){var Y=U(this);if(o(B)){var ue=t(B);if(ue===!0)return T(Y).get(B);if(ue)return ue[Y.id]}},set:function(B,Y){return M(this,B,Y)}}:{add:function(B){return M(this,B,!0)}}),D}},cO}var LG;function b5e(){if(LG)return DG;LG=1;var r=LQ(),e=mn(),t=br(),n=HR(),i=wy(),a=UR(),o=y5e(),u=Pi(),c=eh().enforce,h=mr(),f=BX(),v=Object,y=Array.isArray,g=v.isExtensible,_=v.isFrozen,E=v.isSealed,R=v.freeze,T=v.seal,k=!e.ActiveXObject&&"ActiveXObject"in e,N,A=function(q){return function(){return q(this,arguments.length?arguments[0]:void 0)}},j=a("WeakMap",A,o),W=j.prototype,G=t(W.set),D=function(){return r&&h(function(){var q=R([]);return G(new j,q,1),!_(q)})};if(f)if(k){N=o.getConstructor(A,"WeakMap",!0),i.enable();var P=t(W.delete),U=t(W.has),M=t(W.get);n(W,{delete:function(q){if(u(q)&&!g(q)){var B=c(this);return B.frozen||(B.frozen=new N),P(this,q)||B.frozen.delete(q)}return P(this,q)},has:function(B){if(u(B)&&!g(B)){var Y=c(this);return Y.frozen||(Y.frozen=new N),U(this,B)||Y.frozen.has(B)}return U(this,B)},get:function(B){if(u(B)&&!g(B)){var Y=c(this);return Y.frozen||(Y.frozen=new N),U(this,B)?M(this,B):Y.frozen.get(B)}return M(this,B)},set:function(B,Y){if(u(B)&&!g(B)){var ue=c(this);ue.frozen||(ue.frozen=new N),U(this,B)?G(this,B,Y):ue.frozen.set(B,Y)}else G(this,B,Y);return this}})}else D()&&n(W,{set:function(B,Y){var ue;return y(B)&&(_(B)?ue=R:E(B)&&(ue=T)),G(this,B,Y),ue&&ue(B),this}});return DG}var $G;function x5e(){return $G||($G=1,b5e()),MG}var dO,BG;function w5e(){if(BG)return dO;BG=1,cp(),x5e();var r=Br();return dO=r.WeakMap,dO}var hO,FG;function _5e(){if(FG)return hO;FG=1;var r=w5e();return dp(),hO=r,hO}var fO,zG;function S5e(){return zG||(zG=1,fO=_5e()),fO}var E5e=S5e(),qg=Jt(E5e);function Cv(r,e,t){T5e(r,e),e.set(r,t)}function T5e(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}function b6(r,e,t){return r.set(JQ(r,e),t),t}function tn(r,e){return r.get(JQ(r,e))}function JQ(r,e,t){if(typeof r=="function"?r===e:r.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function UG(r,e){const t=new bc;for(const n of e)r.has(n)||t.add(n);return t}var af=new qg,go=new qg;class HG{constructor(){Cv(this,af,new bc),Cv(this,go,new bc)}get size(){return tn(go,this).size}add(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(const i of t)tn(go,this).add(i)}delete(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(const i of t)tn(go,this).delete(i)}clear(){tn(go,this).clear()}getSelection(){return[...tn(go,this)]}getChanges(){return{added:[...UG(tn(af,this),tn(go,this))],deleted:[...UG(tn(go,this),tn(af,this))],previous:[...new bc(tn(af,this))],current:[...new bc(tn(go,this))]}}commit(){const e=this.getChanges();b6(af,this,tn(go,this)),b6(go,this,new bc(tn(af,this)));for(const t of e.added)t.select();for(const t of e.deleted)t.unselect();return e}}var hd=new qg,fd=new qg,pO=new qg;class O5e{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:()=>{};Cv(this,hd,new HG),Cv(this,fd,new HG),Cv(this,pO,void 0),b6(pO,this,e)}get sizeNodes(){return tn(hd,this).size}get sizeEdges(){return tn(fd,this).size}getNodes(){return tn(hd,this).getSelection()}getEdges(){return tn(fd,this).getSelection()}addNodes(){tn(hd,this).add(...arguments)}addEdges(){tn(fd,this).add(...arguments)}deleteNodes(e){tn(hd,this).delete(e)}deleteEdges(e){tn(fd,this).delete(e)}clear(){tn(hd,this).clear(),tn(fd,this).clear()}commit(){const e={nodes:tn(hd,this).commit(),edges:tn(fd,this).commit()};for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return tn(pO,this).call(this,e,...n),e}}class R5e{constructor(e,t){this.body=e,this.canvas=t,this._selectionAccumulator=new O5e,this.hoverObj={nodes:{},edges:{}},this.options={},this.defaultOptions={multiselect:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0},Jn(this.options,this.defaultOptions),this.body.emitter.on("_dataChanged",()=>{this.updateSelection()})}setOptions(e){e!==void 0&&pp(["multiselect","hoverConnectedEdges","selectable","selectConnectedEdges"],this.options,e)}selectOnPoint(e){let t=!1;if(this.options.selectable===!0){const n=this.getNodeAt(e)||this.getEdgeAt(e);this.unselectAll(),n!==void 0&&(t=this.selectObject(n)),this.body.emitter.emit("_requestRedraw")}return t}selectAdditionalOnPoint(e){let t=!1;if(this.options.selectable===!0){const n=this.getNodeAt(e)||this.getEdgeAt(e);n!==void 0&&(t=!0,n.isSelected()===!0?this.deselectObject(n):this.selectObject(n),this.body.emitter.emit("_requestRedraw"))}return t}_initBaseEvent(e,t){const n={};return n.pointer={DOM:{x:t.x,y:t.y},canvas:this.canvas.DOMtoCanvas(t)},n.event=e,n}generateClickEvent(e,t,n,i){let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;const o=this._initBaseEvent(t,n);if(a===!0)o.nodes=[],o.edges=[];else{const u=this.getSelection();o.nodes=u.nodes,o.edges=u.edges}i!==void 0&&(o.previousSelection=i),e=="click"&&(o.items=this.getClickedItems(n)),t.controlEdge!==void 0&&(o.controlEdge=t.controlEdge),this.body.emitter.emit(e,o)}selectObject(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;return e!==void 0?(e instanceof gn?(t===!0&&this._selectionAccumulator.addEdges(...e.edges),this._selectionAccumulator.addNodes(e)):this._selectionAccumulator.addEdges(e),!0):!1}deselectObject(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}_getAllNodesOverlappingWith(e){const t=[],n=this.body.nodes;for(let i=0;i<this.body.nodeIndices.length;i++){const a=this.body.nodeIndices[i];n[a].isOverlappingWith(e)&&t.push(a)}return t}_pointerToPositionObject(e){const t=this.canvas.DOMtoCanvas(e);return{left:t.x-1,top:t.y+1,right:t.x+1,bottom:t.y-1}}getNodeAt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;const n=this._pointerToPositionObject(e),i=this._getAllNodesOverlappingWith(n);if(i.length>0)return t===!0?this.body.nodes[i[i.length-1]]:i[i.length-1]}_getEdgesOverlappingWith(e,t){const n=this.body.edges;for(let i=0;i<this.body.edgeIndices.length;i++){const a=this.body.edgeIndices[i];n[a].isOverlappingWith(e)&&t.push(a)}}_getAllEdgesOverlappingWith(e){const t=[];return this._getEdgesOverlappingWith(e,t),t}getEdgeAt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;const n=this.canvas.DOMtoCanvas(e);let i=10,a=null;const o=this.body.edges;for(let u=0;u<this.body.edgeIndices.length;u++){const c=this.body.edgeIndices[u],h=o[c];if(h.connected){const f=h.from.x,v=h.from.y,y=h.to.x,g=h.to.y,_=h.edgeType.getDistanceToEdge(f,v,y,g,n.x,n.y);_<i&&(a=c,i=_)}}if(a!==null)return t===!0?this.body.edges[a]:a}_addToHover(e){e instanceof gn?this.hoverObj.nodes[e.id]=e:this.hoverObj.edges[e.id]=e}_removeFromSelection(e){e instanceof gn?(this._selectionAccumulator.deleteNodes(e),this._selectionAccumulator.deleteEdges(...e.edges)):this._selectionAccumulator.deleteEdges(e)}unselectAll(){this._selectionAccumulator.clear()}getSelectedNodeCount(){return this._selectionAccumulator.sizeNodes}getSelectedEdgeCount(){return this._selectionAccumulator.sizeEdges}_hoverConnectedEdges(e){for(let t=0;t<e.edges.length;t++){const n=e.edges[t];n.hover=!0,this._addToHover(n)}}emitBlurEvent(e,t,n){const i=this._initBaseEvent(e,t);n.hover===!0&&(n.hover=!1,n instanceof gn?(i.node=n.id,this.body.emitter.emit("blurNode",i)):(i.edge=n.id,this.body.emitter.emit("blurEdge",i)))}emitHoverEvent(e,t,n){const i=this._initBaseEvent(e,t);let a=!1;return n.hover===!1&&(n.hover=!0,this._addToHover(n),a=!0,n instanceof gn?(i.node=n.id,this.body.emitter.emit("hoverNode",i)):(i.edge=n.id,this.body.emitter.emit("hoverEdge",i))),a}hoverObject(e,t){let n=this.getNodeAt(t);n===void 0&&(n=this.getEdgeAt(t));let i=!1;for(const a in this.hoverObj.nodes)Object.prototype.hasOwnProperty.call(this.hoverObj.nodes,a)&&(n===void 0||n instanceof gn&&n.id!=a||n instanceof Cc)&&(this.emitBlurEvent(e,t,this.hoverObj.nodes[a]),delete this.hoverObj.nodes[a],i=!0);for(const a in this.hoverObj.edges)Object.prototype.hasOwnProperty.call(this.hoverObj.edges,a)&&(i===!0?(this.hoverObj.edges[a].hover=!1,delete this.hoverObj.edges[a]):(n===void 0||n instanceof Cc&&n.id!=a||n instanceof gn&&!n.hover)&&(this.emitBlurEvent(e,t,this.hoverObj.edges[a]),delete this.hoverObj.edges[a],i=!0));if(n!==void 0){const a=Pn(this.hoverObj.edges).length,o=Pn(this.hoverObj.nodes).length,u=n instanceof Cc&&a===0&&o===0,c=n instanceof gn&&a===0&&o===0;(i||u||c)&&(i=this.emitHoverEvent(e,t,n)),n instanceof gn&&this.options.hoverConnectedEdges===!0&&this._hoverConnectedEdges(n)}i===!0&&this.body.emitter.emit("_requestRedraw")}commitWithoutEmitting(){this._selectionAccumulator.commit()}commitAndEmit(e,t){let n=!1;const i=this._selectionAccumulator.commit(),a={nodes:i.nodes.previous,edges:i.edges.previous};i.edges.deleted.length>0&&(this.generateClickEvent("deselectEdge",t,e,a),n=!0),i.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",t,e,a),n=!0),i.nodes.added.length>0&&(this.generateClickEvent("selectNode",t,e),n=!0),i.edges.added.length>0&&(this.generateClickEvent("selectEdge",t,e),n=!0),n===!0&&this.generateClickEvent("select",t,e)}getSelection(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}getSelectedNodes(){return this._selectionAccumulator.getNodes()}getSelectedEdges(){return this._selectionAccumulator.getEdges()}getSelectedNodeIds(){var e;return Nf(e=this._selectionAccumulator.getNodes()).call(e,t=>t.id)}getSelectedEdgeIds(){var e;return Nf(e=this._selectionAccumulator.getEdges()).call(e,t=>t.id)}setSelection(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes)for(const n of e.nodes){const i=this.body.nodes[n];if(!i)throw new RangeError('Node with id "'+n+'" not found');this.selectObject(i,t.highlightEdges)}if(e.edges)for(const n of e.edges){const i=this.body.edges[n];if(!i)throw new RangeError('Edge with id "'+n+'" not found');this.selectObject(i)}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}selectNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}selectEdges(e){if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({edges:e})}updateSelection(){for(const e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(const e in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,e.id)||this._selectionAccumulator.deleteEdges(e)}getClickedItems(e){const t=this.canvas.DOMtoCanvas(e),n=[],i=this.body.nodeIndices,a=this.body.nodes;for(let c=i.length-1;c>=0;c--){const f=a[i[c]].getItemsOnPoint(t);n.push.apply(n,f)}const o=this.body.edgeIndices,u=this.body.edges;for(let c=o.length-1;c>=0;c--){const f=u[o[c]].getItemsOnPoint(t);n.push.apply(n,f)}return n}}var WG={},vO,GG;function A5e(){if(GG)return vO;GG=1;var r=op(),e=Math.floor,t=function(n,i){var a=n.length;if(a<8)for(var o=1,u,c;o<a;){for(c=o,u=n[o];c&&i(n[c-1],u)>0;)n[c]=n[--c];c!==o++&&(n[c]=u)}else for(var h=e(a/2),f=t(r(n,0,h),i),v=t(r(n,h),i),y=f.length,g=v.length,_=0,E=0;_<y||E<g;)n[_+E]=_<y&&E<g?i(f[_],v[E])<=0?f[_++]:v[E++]:_<y?f[_++]:v[E++];return n};return vO=t,vO}var gO,VG;function C5e(){if(VG)return gO;VG=1;var r=ep(),e=r.match(/firefox\/(\d+)/i);return gO=!!e&&+e[1],gO}var mO,YG;function k5e(){if(YG)return mO;YG=1;var r=ep();return mO=/MSIE|Trident/.test(r),mO}var yO,KG;function N5e(){if(KG)return yO;KG=1;var r=ep(),e=r.match(/AppleWebKit\/(\d+)\./);return yO=!!e&&+e[1],yO}var XG;function I5e(){if(XG)return WG;XG=1;var r=Nt(),e=br(),t=wu(),n=ps(),i=_u(),a=QX(),o=Fs(),u=mr(),c=A5e(),h=hp(),f=C5e(),v=k5e(),y=wg(),g=N5e(),_=[],E=e(_.sort),R=e(_.push),T=u(function(){_.sort(void 0)}),k=u(function(){_.sort(null)}),N=h("sort"),A=!u(function(){if(y)return y<70;if(!(f&&f>3)){if(v)return!0;if(g)return g<603;var G="",D,P,U,M;for(D=65;D<76;D++){switch(P=String.fromCharCode(D),D){case 66:case 69:case 70:case 72:U=3;break;case 68:case 71:U=4;break;default:U=2}for(M=0;M<47;M++)_.push({k:P+M,v:U})}for(_.sort(function(q,B){return B.v-q.v}),M=0;M<_.length;M++)P=_[M].k.charAt(0),G.charAt(G.length-1)!==P&&(G+=P);return G!=="DGBEFHACIJK"}}),j=T||!k||!N||!A,W=function(G){return function(D,P){return P===void 0?-1:D===void 0?1:G!==void 0?+G(D,P)||0:o(D)>o(P)?1:-1}};return r({target:"Array",proto:!0,forced:j},{sort:function(D){D!==void 0&&t(D);var P=n(this);if(A)return D===void 0?E(P):E(P,D);var U=[],M=i(P),q,B;for(B=0;B<M;B++)B in P&&R(U,P[B]);for(c(U,W(D)),q=i(U),B=0;B<q;)P[B]=U[B++];for(;B<M;)a(P,B++);return P}}),WG}var bO,QG;function j5e(){if(QG)return bO;QG=1,I5e();var r=Qi();return bO=r("Array","sort"),bO}var xO,ZG;function P5e(){if(ZG)return xO;ZG=1;var r=ni(),e=j5e(),t=Array.prototype;return xO=function(n){var i=n.sort;return n===t||r(t,n)&&i===t.sort?e:i},xO}var wO,JG;function M5e(){if(JG)return wO;JG=1;var r=P5e();return wO=r,wO}var _O,eV;function D5e(){return eV||(eV=1,_O=M5e()),_O}var q5e=D5e(),Sf=Jt(q5e),tV={},SO,rV;function L5e(){if(rV)return SO;rV=1;var r=wu(),e=ps(),t=oy(),n=_u(),i=TypeError,a="Reduce of empty array with no initial value",o=function(u){return function(c,h,f,v){var y=e(c),g=t(y),_=n(y);if(r(h),_===0&&f<2)throw new i(a);var E=u?_-1:0,R=u?-1:1;if(f<2)for(;;){if(E in g){v=g[E],E+=R;break}if(E+=R,u?E<0:_<=E)throw new i(a)}for(;u?E>=0:_>E;E+=R)E in g&&(v=h(v,g[E],E,y));return v}};return SO={left:o(!1),right:o(!0)},SO}var EO,nV;function $5e(){if(nV)return EO;nV=1;var r=JX();return EO=r==="NODE",EO}var iV;function B5e(){if(iV)return tV;iV=1;var r=Nt(),e=L5e().left,t=hp(),n=wg(),i=$5e(),a=!i&&n>79&&n<83,o=a||!t("reduce");return r({target:"Array",proto:!0,forced:o},{reduce:function(c){var h=arguments.length;return e(this,c,h,h>1?arguments[1]:void 0)}}),tV}var TO,aV;function F5e(){if(aV)return TO;aV=1,B5e();var r=Qi();return TO=r("Array","reduce"),TO}var OO,sV;function z5e(){if(sV)return OO;sV=1;var r=ni(),e=F5e(),t=Array.prototype;return OO=function(n){var i=n.reduce;return n===t||r(t,n)&&i===t.reduce?e:i},OO}var RO,oV;function U5e(){if(oV)return RO;oV=1;var r=z5e();return RO=r,RO}var AO,lV;function H5e(){return lV||(lV=1,AO=U5e()),AO}var W5e=H5e(),eZ=Jt(W5e);class tZ{abstract(){throw new Error("Can't instantiate abstract class!")}fake_use(){}curveType(){return this.abstract()}getPosition(e){return this.fake_use(e),this.abstract()}setPosition(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,n),this.abstract()}getTreeSize(e){return this.fake_use(e),this.abstract()}sort(e){this.fake_use(e),this.abstract()}fix(e,t){this.fake_use(e,t),this.abstract()}shift(e,t){this.fake_use(e,t),this.abstract()}}class G5e extends tZ{constructor(e){super(),this.layout=e}curveType(){return"horizontal"}getPosition(e){return e.x}setPosition(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;n!==void 0&&this.layout.hierarchical.addToOrdering(e,n),e.x=t}getTreeSize(e){const t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_x,max:t.max_x}}sort(e){Sf(e).call(e,function(t,n){return t.x-n.x})}fix(e,t){e.y=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.y=!0}shift(e,t){this.layout.body.nodes[e].x+=t}}class V5e extends tZ{constructor(e){super(),this.layout=e}curveType(){return"vertical"}getPosition(e){return e.y}setPosition(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;n!==void 0&&this.layout.hierarchical.addToOrdering(e,n),e.y=t}getTreeSize(e){const t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_y,max:t.max_y}}sort(e){Sf(e).call(e,function(t,n){return t.y-n.y})}fix(e,t){e.x=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.x=!0}shift(e,t){this.layout.body.nodes[e].y+=t}}var uV={},cV;function Y5e(){if(cV)return uV;cV=1;var r=Nt(),e=Bc().every,t=hp(),n=t("every");return r({target:"Array",proto:!0,forced:!n},{every:function(a){return e(this,a,arguments.length>1?arguments[1]:void 0)}}),uV}var CO,dV;function K5e(){if(dV)return CO;dV=1,Y5e();var r=Qi();return CO=r("Array","every"),CO}var kO,hV;function X5e(){if(hV)return kO;hV=1;var r=ni(),e=K5e(),t=Array.prototype;return kO=function(n){var i=n.every;return n===t||r(t,n)&&i===t.every?e:i},kO}var NO,fV;function Q5e(){if(fV)return NO;fV=1;var r=X5e();return NO=r,NO}var IO,pV;function Z5e(){return pV||(pV=1,IO=Q5e()),IO}var J5e=Z5e(),rZ=Jt(J5e);function exe(r,e){const t=new bc;return Kr(r).call(r,n=>{var i;Kr(i=n.edges).call(i,a=>{a.connected&&t.add(a)})}),Kr(t).call(t,n=>{const i=n.from.id,a=n.to.id;e[i]==null&&(e[i]=0),(e[a]==null||e[i]>=e[a])&&(e[a]=e[i]+1)}),e}function txe(r){return nZ(e=>{var t,n;return rZ(t=Da(n=e.edges).call(n,i=>r.has(i.toId))).call(t,i=>i.to===e)},(e,t)=>t>e,"from",r)}function rxe(r){return nZ(e=>{var t,n;return rZ(t=Da(n=e.edges).call(n,i=>r.has(i.toId))).call(t,i=>i.from===e)},(e,t)=>t<e,"to",r)}function nZ(r,e,t,n){var i;const a=Od(null),o=eZ(i=[...VQ(n).call(n)]).call(i,(v,y)=>v+1+y.edges.length,0),u=t+"Id",c=t==="to"?1:-1;for(const[v,y]of n){if(!n.has(v)||!r(y))continue;a[v]=0;const g=[y];let _=0,E;for(;E=g.pop();){var h,f;if(!n.has(v))continue;const R=a[E.id]+c;if(Kr(h=Da(f=E.edges).call(f,T=>T.connected&&T.to!==T.from&&T[t]!==E&&n.has(T.toId)&&n.has(T.fromId))).call(h,T=>{const k=T[u],N=a[k];(N==null||e(R,N))&&(a[k]=R,g.push(T[t]))}),_>o)return exe(n,a);++_}}return a}class nxe{constructor(){this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}addRelation(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}checkIfTree(){for(const e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}numTrees(){return this.treeIndex+1}setTreeIndex(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}ensureLevel(e){this.levels[e]===void 0&&(this.levels[e]=0)}getMaxLevel(e){const t={},n=i=>{if(t[i]!==void 0)return t[i];let a=this.levels[i];if(this.childrenReference[i]){const o=this.childrenReference[i];if(o.length>0)for(let u=0;u<o.length;u++)a=Math.max(a,n(o[u]))}return t[i]=a,a};return n(e)}levelDownstream(e,t){this.levels[t.id]===void 0&&(this.levels[e.id]===void 0&&(this.levels[e.id]=0),this.levels[t.id]=this.levels[e.id]+1)}setMinLevelToZero(){var e;const t=new GR;let n=0;const i=Sf(e=[...new bc(yme(this.levels))]).call(e,(a,o)=>a-o);for(const a of i)t.set(a,n++);for(const a in this.levels)Object.prototype.hasOwnProperty.call(this.levels,a)&&(this.levels[a]=t.get(this.levels[a]))}getTreeSize(e,t){let n=1e9,i=-1e9,a=1e9,o=-1e9;for(const u in this.trees)if(Object.prototype.hasOwnProperty.call(this.trees,u)&&this.trees[u]===t){const c=e[u];n=Math.min(c.x,n),i=Math.max(c.x,i),a=Math.min(c.y,a),o=Math.max(c.y,o)}return{min_x:n,max_x:i,min_y:a,max_y:o}}hasSameParent(e,t){const n=this.parentReference[e.id],i=this.parentReference[t.id];if(n===void 0||i===void 0)return!1;for(let a=0;a<n.length;a++)for(let o=0;o<i.length;o++)if(n[a]==i[o])return!0;return!1}inSameSubNetwork(e,t){return this.trees[e.id]===this.trees[t.id]}getLevels(){return Pn(this.distributionOrdering)}addToOrdering(e,t){this.distributionOrdering[t]===void 0&&(this.distributionOrdering[t]=[]);let n=!1;const i=this.distributionOrdering[t];for(const a in i)if(i[a]===e){n=!0;break}n||(this.distributionOrdering[t].push(e),this.distributionIndex[e.id]=this.distributionOrdering[t].length-1)}}class ixe{constructor(e){this.body=e,this._resetRNG(Math.random()+":"+N1()),this.setPhysics=!1,this.options={},this.optionsBackup={physics:{}},this.defaultOptions={randomSeed:void 0,improvedLayout:!0,clusterThreshold:150,hierarchical:{enabled:!1,levelSeparation:150,nodeSpacing:100,treeSpacing:200,blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:"UD",sortMethod:"hubsize"}},Jn(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("_dataChanged",()=>{this.setupHierarchicalLayout()}),this.body.emitter.on("_dataLoaded",()=>{this.layoutNetwork()}),this.body.emitter.on("_resetHierarchicalLayout",()=>{this.setupHierarchicalLayout()}),this.body.emitter.on("_adjustEdgesForHierarchicalLayout",()=>{if(this.options.hierarchical.enabled!==!0)return;const e=this.direction.curveType();this.body.emitter.emit("_forceDisableDynamicCurves",e,!1)})}setOptions(e,t){if(e!==void 0){const n=this.options.hierarchical,i=n.enabled;if(pp(["randomSeed","improvedLayout","clusterThreshold"],this.options,e),Ns(this.options,e,"hierarchical"),e.randomSeed!==void 0&&this._resetRNG(e.randomSeed),n.enabled===!0)return i===!0&&this.body.emitter.emit("refresh",!0),n.direction==="RL"||n.direction==="DU"?n.levelSeparation>0&&(n.levelSeparation*=-1):n.levelSeparation<0&&(n.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(i===!0)return this.body.emitter.emit("refresh"),rn(t,this.optionsBackup)}return t}_resetRNG(e){this.initialRandomSeed=e,this._rng=xy(this.initialRandomSeed)}adaptAllOptionsForHierarchicalLayout(e){if(this.options.hierarchical.enabled===!0){const t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:"hierarchicalRepulsion"},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||"barnesHut"):typeof e.physics=="object"?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):e.physics!==!1&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});let n=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if(typeof e.edges.smooth=="boolean")this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:n};else{const i=e.edges.smooth;i.type!==void 0&&i.type!=="dynamic"&&(n=i.type),this.optionsBackup.edges={smooth:{enabled:i.enabled===void 0?!0:i.enabled,type:i.type===void 0?"dynamic":i.type,roundness:i.roundness===void 0?.5:i.roundness,forceDirection:i.forceDirection===void 0?!1:i.forceDirection}},e.edges.smooth={enabled:i.enabled===void 0?!0:i.enabled,type:n,roundness:i.roundness===void 0?.5:i.roundness,forceDirection:i.forceDirection===void 0?!1:i.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",n)}return e}positionInitially(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);const t=e.length+50;for(let n=0;n<e.length;n++){const i=e[n],a=2*Math.PI*this._rng();i.x===void 0&&(i.x=t*Math.cos(a)),i.y===void 0&&(i.y=t*Math.sin(a))}}}layoutNetwork(){if(this.options.hierarchical.enabled!==!0&&this.options.improvedLayout===!0){const e=this.body.nodeIndices;let t=0;for(let n=0;n<e.length;n++)this.body.nodes[e[n]].predefinedPosition===!0&&(t+=1);if(t<.5*e.length){let i=0;const a=this.options.clusterThreshold,o={clusterNodeProperties:{shape:"ellipse",label:"",group:"",font:{multi:!1}},clusterEdgeProperties:{label:"",font:{multi:!1},smooth:{enabled:!1}}};if(e.length>a){const c=e.length;for(;e.length>a&&i<=10;){i+=1;const h=e.length;i%3===0?this.body.modules.clustering.clusterBridges(o):this.body.modules.clustering.clusterOutliers(o);const f=e.length;if(h==f&&i%3!==0){this._declusterAll(),this.body.emitter.emit("_layoutFailed"),console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.");return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*c)})}i>10&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();const u=70;for(let c=0;c<e.length;c++){const h=this.body.nodes[e[c]];h.predefinedPosition===!1&&(h.x+=(.5-this._rng())*u,h.y+=(.5-this._rng())*u)}this._declusterAll(),this.body.emitter.emit("_repositionBezierNodes")}}}_shiftToCenter(){const e=ya.getRangeCore(this.body.nodes,this.body.nodeIndices),t=ya.findCenter(e);for(let n=0;n<this.body.nodeIndices.length;n++){const i=this.body.nodes[this.body.nodeIndices[n]];i.x-=t.x,i.y-=t.y}}_declusterAll(){let e=!0;for(;e===!0;){e=!1;for(let t=0;t<this.body.nodeIndices.length;t++)this.body.nodes[this.body.nodeIndices[t]].isCluster===!0&&(e=!0,this.body.modules.clustering.openCluster(this.body.nodeIndices[t],{},!1));e===!0&&this.body.emitter.emit("_dataChanged")}}getSeed(){return this.initialRandomSeed}setupHierarchicalLayout(){if(this.options.hierarchical.enabled===!0&&this.body.nodeIndices.length>0){let e,t,n=!1,i=!1;this.lastNodeOnLevel={},this.hierarchical=new nxe;for(t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level!==void 0?(n=!0,this.hierarchical.levels[t]=e.options.level):i=!0);if(i===!0&&n===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");{if(i===!0){const o=this.options.hierarchical.sortMethod;o==="hubsize"?this._determineLevelsByHubsize():o==="directed"?this._determineLevelsDirected():o==="custom"&&this._determineLevelsCustomCallback()}for(const o in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,o)&&this.hierarchical.ensureLevel(o);const a=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(a),this._condenseHierarchy(),this._shiftToCenter()}}}_condenseHierarchy(){var e=this;let t=!1;const n={},i=()=>{const T=o();let k=0;for(let N=0;N<T.length-1;N++){const A=T[N].max-T[N+1].min;k+=A+this.options.hierarchical.treeSpacing,a(N+1,k)}},a=(T,k)=>{const N=this.hierarchical.trees;for(const A in N)Object.prototype.hasOwnProperty.call(N,A)&&N[A]===T&&this.direction.shift(A,k)},o=()=>{const T=[];for(let k=0;k<this.hierarchical.numTrees();k++)T.push(this.direction.getTreeSize(k));return T},u=(T,k)=>{if(!k[T.id]&&(k[T.id]=!0,this.hierarchical.childrenReference[T.id])){const N=this.hierarchical.childrenReference[T.id];if(N.length>0)for(let A=0;A<N.length;A++)u(this.body.nodes[N[A]],k)}},c=function(T){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e9,N=1e9,A=1e9,j=1e9,W=-1e9;for(const G in T)if(Object.prototype.hasOwnProperty.call(T,G)){const D=e.body.nodes[G],P=e.hierarchical.levels[D.id],U=e.direction.getPosition(D),[M,q]=e._getSpaceAroundNode(D,T);N=Math.min(M,N),A=Math.min(q,A),P<=k&&(j=Math.min(U,j),W=Math.max(U,W))}return[j,W,N,A]},h=(T,k)=>{const N=this.hierarchical.getMaxLevel(T.id),A=this.hierarchical.getMaxLevel(k.id);return Math.min(N,A)},f=(T,k,N)=>{const A=this.hierarchical;for(let j=0;j<k.length;j++){const W=k[j],G=A.distributionOrdering[W];if(G.length>1)for(let D=0;D<G.length-1;D++){const P=G[D],U=G[D+1];A.hasSameParent(P,U)&&A.inSameSubNetwork(P,U)&&T(P,U,N)}}},v=function(T,k){let N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const A=e.direction.getPosition(T),j=e.direction.getPosition(k),W=Math.abs(j-A),G=e.options.hierarchical.nodeSpacing;if(W>G){const D={},P={};u(T,D),u(k,P);const U=h(T,k),M=c(D,U),q=c(P,U),B=M[1],Y=q[0],ue=q[2];if(Math.abs(B-Y)>G){let J=B-Y+G;J<-ue+G&&(J=-ue+G),J<0&&(e._shiftBlock(k.id,J),t=!0,N===!0&&e._centerParent(k))}}},y=(T,k)=>{const N=k.id,A=k.edges,j=this.hierarchical.levels[k.id],W=this.options.hierarchical.levelSeparation*this.options.hierarchical.levelSeparation,G={},D=[];for(let ue=0;ue<A.length;ue++){const re=A[ue];if(re.toId!=re.fromId){const J=re.toId==N?re.from:re.to;G[A[ue].id]=J,this.hierarchical.levels[J.id]<j&&D.push(re)}}const P=(ue,re)=>{let J=0;for(let le=0;le<re.length;le++)if(G[re[le].id]!==void 0){const ye=this.direction.getPosition(G[re[le].id])-ue;J+=ye/Math.sqrt(ye*ye+W)}return J},U=(ue,re)=>{let J=0;for(let le=0;le<re.length;le++)if(G[re[le].id]!==void 0){const ye=this.direction.getPosition(G[re[le].id])-ue;J-=W*Math.pow(ye*ye+W,-1.5)}return J},M=(ue,re)=>{let J=this.direction.getPosition(k);const le={};for(let ye=0;ye<ue;ye++){const Z=P(J,re),oe=U(J,re),L=40,K=Math.max(-L,Math.min(L,Math.round(Z/oe)));if(J=J-K,le[J]!==void 0)break;le[J]=ye}return J},q=ue=>{const re=this.direction.getPosition(k);if(n[k.id]===void 0){const L={};u(k,L),n[k.id]=L}const J=c(n[k.id]),le=J[2],ye=J[3],Z=ue-re;let oe=0;Z>0?oe=Math.min(Z,ye-this.options.hierarchical.nodeSpacing):Z<0&&(oe=-Math.min(-Z,le-this.options.hierarchical.nodeSpacing)),oe!=0&&(this._shiftBlock(k.id,oe),t=!0)},B=ue=>{const re=this.direction.getPosition(k),[J,le]=this._getSpaceAroundNode(k),ye=ue-re;let Z=re;ye>0?Z=Math.min(re+(le-this.options.hierarchical.nodeSpacing),ue):ye<0&&(Z=Math.max(re-(J-this.options.hierarchical.nodeSpacing),ue)),Z!==re&&(this.direction.setPosition(k,Z),t=!0)};let Y=M(T,D);q(Y),Y=M(T,A),B(Y)},g=T=>{let k=this.hierarchical.getLevels();k=Td(k).call(k);for(let N=0;N<T;N++){t=!1;for(let A=0;A<k.length;A++){const j=k[A],W=this.hierarchical.distributionOrdering[j];for(let G=0;G<W.length;G++)y(1e3,W[G])}if(t!==!0)break}},_=T=>{let k=this.hierarchical.getLevels();k=Td(k).call(k);for(let N=0;N<T&&(t=!1,f(v,k,!0),t===!0);N++);},E=()=>{for(const T in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,T)&&this._centerParent(this.body.nodes[T])},R=()=>{let T=this.hierarchical.getLevels();T=Td(T).call(T);for(let k=0;k<T.length;k++){const N=T[k],A=this.hierarchical.distributionOrdering[N];for(let j=0;j<A.length;j++)this._centerParent(A[j])}};this.options.hierarchical.blockShifting===!0&&(_(5),E()),this.options.hierarchical.edgeMinimization===!0&&g(20),this.options.hierarchical.parentCentralization===!0&&R(),i()}_getSpaceAroundNode(e,t){let n=!0;t===void 0&&(n=!1);const i=this.hierarchical.levels[e.id];if(i!==void 0){const a=this.hierarchical.distributionIndex[e.id],o=this.direction.getPosition(e),u=this.hierarchical.distributionOrdering[i];let c=1e9,h=1e9;if(a!==0){const f=u[a-1];if(n===!0&&t[f.id]===void 0||n===!1){const v=this.direction.getPosition(f);c=o-v}}if(a!=u.length-1){const f=u[a+1];if(n===!0&&t[f.id]===void 0||n===!1){const v=this.direction.getPosition(f);h=Math.min(h,v-o)}}return[c,h]}else return[0,0]}_centerParent(e){if(this.hierarchical.parentReference[e.id]){const t=this.hierarchical.parentReference[e.id];for(let n=0;n<t.length;n++){const i=t[n],a=this.body.nodes[i],o=this.hierarchical.childrenReference[i];if(o!==void 0){const u=this._getCenterPosition(o),c=this.direction.getPosition(a),[h,f]=this._getSpaceAroundNode(a),v=c-u;(v<0&&Math.abs(v)<f-this.options.hierarchical.nodeSpacing||v>0&&Math.abs(v)<h-this.options.hierarchical.nodeSpacing)&&this.direction.setPosition(a,u)}}}}_placeNodesByHierarchy(e){this.positionedNodes={};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var t;let i=Pn(e[n]);i=this._indexArrayToNodes(i),Sf(t=this.direction).call(t,i);let a=0;for(let o=0;o<i.length;o++){const u=i[o];if(this.positionedNodes[u.id]===void 0){const c=this.options.hierarchical.nodeSpacing;let h=c*a;a>0&&(h=this.direction.getPosition(i[o-1])+c),this.direction.setPosition(u,h,n),this._validatePositionAndContinue(u,n,h),a++}}}}_placeBranchNodes(e,t){var n;const i=this.hierarchical.childrenReference[e];if(i===void 0)return;const a=[];for(let u=0;u<i.length;u++)a.push(this.body.nodes[i[u]]);Sf(n=this.direction).call(n,a);for(let u=0;u<a.length;u++){const c=a[u],h=this.hierarchical.levels[c.id];if(h>t&&this.positionedNodes[c.id]===void 0){const f=this.options.hierarchical.nodeSpacing;let v;u===0?v=this.direction.getPosition(this.body.nodes[e]):v=this.direction.getPosition(a[u-1])+f,this.direction.setPosition(c,v,h),this._validatePositionAndContinue(c,h,v)}else return}const o=this._getCenterPosition(a);this.direction.setPosition(this.body.nodes[e],o,t)}_validatePositionAndContinue(e,t,n){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){const i=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(n-i<this.options.hierarchical.nodeSpacing){const a=i+this.options.hierarchical.nodeSpacing-n,o=this._findCommonParent(this.lastNodeOnLevel[t],e.id);this._shiftBlock(o.withChild,a)}}this.lastNodeOnLevel[t]=e.id,this.positionedNodes[e.id]=!0,this._placeBranchNodes(e.id,t)}}_indexArrayToNodes(e){const t=[];for(let n=0;n<e.length;n++)t.push(this.body.nodes[e[n]]);return t}_getDistribution(){const e={};let t,n;for(t in this.body.nodes)if(Object.prototype.hasOwnProperty.call(this.body.nodes,t)){n=this.body.nodes[t];const i=this.hierarchical.levels[t]===void 0?0:this.hierarchical.levels[t];this.direction.fix(n,i),e[i]===void 0&&(e[i]={}),e[i][t]=n}return e}_getActiveEdges(e){const t=[];return cr(e.edges,n=>{var i;Lr(i=this.body.edgeIndices).call(i,n.id)!==-1&&t.push(n)}),t}_getHubSizes(){const e={},t=this.body.nodeIndices;cr(t,i=>{const a=this.body.nodes[i],o=this._getActiveEdges(a).length;e[o]=!0});const n=[];return cr(e,i=>{n.push(Number(i))}),Sf(n).call(n,function(i,a){return a-i}),n}_determineLevelsByHubsize(){const e=(n,i)=>{this.hierarchical.levelDownstream(n,i)},t=this._getHubSizes();for(let n=0;n<t.length;++n){const i=t[n];if(i===0)break;cr(this.body.nodeIndices,a=>{const o=this.body.nodes[a];i===this._getActiveEdges(o).length&&this._crawlNetwork(e,a)})}}_determineLevelsCustomCallback(){const t=function(i,a,o){},n=(i,a,o)=>{let u=this.hierarchical.levels[i.id];u===void 0&&(u=this.hierarchical.levels[i.id]=1e5);const c=t(ya.cloneOptions(i,"node"),ya.cloneOptions(a,"node"),ya.cloneOptions(o,"edge"));this.hierarchical.levels[a.id]=u+c};this._crawlNetwork(n),this.hierarchical.setMinLevelToZero()}_determineLevelsDirected(){var e;const t=eZ(e=this.body.nodeIndices).call(e,(n,i)=>(n.set(i,this.body.nodes[i]),n),new GR);this.options.hierarchical.shakeTowards==="roots"?this.hierarchical.levels=rxe(t):this.hierarchical.levels=txe(t),this.hierarchical.setMinLevelToZero()}_generateMap(){const e=(t,n)=>{this.hierarchical.levels[n.id]>this.hierarchical.levels[t.id]&&this.hierarchical.addRelation(t.id,n.id)};this._crawlNetwork(e),this.hierarchical.checkIfTree()}_crawlNetwork(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},t=arguments.length>1?arguments[1]:void 0;const n={},i=(a,o)=>{if(n[a.id]===void 0){this.hierarchical.setTreeIndex(a,o),n[a.id]=!0;let u;const c=this._getActiveEdges(a);for(let h=0;h<c.length;h++){const f=c[h];f.connected===!0&&(f.toId==a.id?u=f.from:u=f.to,a.id!=u.id&&(e(a,u,f),i(u,o)))}}};if(t===void 0){let a=0;for(let o=0;o<this.body.nodeIndices.length;o++){const u=this.body.nodeIndices[o];if(n[u]===void 0){const c=this.body.nodes[u];i(c,a),a+=1}}}else{const a=this.body.nodes[t];if(a===void 0){console.error("Node not found:",t);return}i(a)}}_shiftBlock(e,t){const n={},i=a=>{if(n[a])return;n[a]=!0,this.direction.shift(a,t);const o=this.hierarchical.childrenReference[a];if(o!==void 0)for(let u=0;u<o.length;u++)i(o[u])};i(e)}_findCommonParent(e,t){const n={},i=(o,u)=>{const c=this.hierarchical.parentReference[u];if(c!==void 0)for(let h=0;h<c.length;h++){const f=c[h];o[f]=!0,i(o,f)}},a=(o,u)=>{const c=this.hierarchical.parentReference[u];if(c!==void 0)for(let h=0;h<c.length;h++){const f=c[h];if(o[f]!==void 0)return{foundParent:f,withChild:u};const v=a(o,f);if(v.foundParent!==null)return v}return{foundParent:null,withChild:u}};return i(n,e),a(n,t)}setDirectionStrategy(){this.options.hierarchical.direction==="UD"||this.options.hierarchical.direction==="DU"?this.direction=new G5e(this):this.direction=new V5e(this)}_getCenterPosition(e){let t=1e9,n=-1e9;for(let i=0;i<e.length;i++){let a;if(e[i].id!==void 0)a=e[i];else{const u=e[i];a=this.body.nodes[u]}const o=this.direction.getPosition(a);t=Math.min(t,o),n=Math.max(n,o)}return .5*(t+n)}}class axe{constructor(e,t,n,i){var a,o;this.body=e,this.canvas=t,this.selectionHandler=n,this.interactionHandler=i,this.editMode=!1,this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0,this._domEventListenerCleanupQueue=[],this.temporaryUIFunctions={},this.temporaryEventFunctions=[],this.touchTime=0,this.temporaryIds={nodes:[],edges:[]},this.guiEnabled=!1,this.inMode=!1,this.selectedControlNode=void 0,this.options={},this.defaultOptions={enabled:!1,initiallyActive:!1,addNode:!0,addEdge:!0,editNode:void 0,editEdge:!0,deleteNode:!0,deleteEdge:!0,controlNodeStyle:{shape:"dot",size:6,color:{background:"#ff0000",border:"#3c3c3c",highlight:{background:"#07f968",border:"#3c3c3c"}},borderWidth:2,borderWidthSelected:2}},Jn(this.options,this.defaultOptions),this.body.emitter.on("destroy",()=>{this._clean()}),this.body.emitter.on("_dataChanged",Ze(a=this._restore).call(a,this)),this.body.emitter.on("_resetData",Ze(o=this._restore).call(o,this))}_restore(){this.inMode!==!1&&(this.options.initiallyActive===!0?this.enableEditMode():this.disableEditMode())}setOptions(e,t,n){t!==void 0&&(t.locale!==void 0?this.options.locale=t.locale:this.options.locale=n.locale,t.locales!==void 0?this.options.locales=t.locales:this.options.locales=n.locales),e!==void 0&&(typeof e=="boolean"?this.options.enabled=e:(this.options.enabled=!0,rn(this.options,e)),this.options.initiallyActive===!0&&(this.editMode=!0),this._setup())}toggleEditMode(){this.editMode===!0?this.disableEditMode():this.enableEditMode()}enableEditMode(){this.editMode=!0,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="block",this.closeDiv.style.display="block",this.editModeDiv.style.display="none",this.showManipulatorToolbar())}disableEditMode(){this.editMode=!1,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="none",this.closeDiv.style.display="none",this.editModeDiv.style.display="block",this._createEditButton())}showManipulatorToolbar(){if(this._clean(),this.manipulationDOM={},this.guiEnabled===!0){var e,t;this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";const n=this.selectionHandler.getSelectedNodeCount(),i=this.selectionHandler.getSelectedEdgeCount(),a=n+i,o=this.options.locales[this.options.locale];let u=!1;this.options.addNode!==!1&&(this._createAddNodeButton(o),u=!0),this.options.addEdge!==!1&&(u===!0?this._createSeperator(1):u=!0,this._createAddEdgeButton(o)),n===1&&typeof this.options.editNode=="function"?(u===!0?this._createSeperator(2):u=!0,this._createEditNodeButton(o)):i===1&&n===0&&this.options.editEdge!==!1&&(u===!0?this._createSeperator(3):u=!0,this._createEditEdgeButton(o)),a!==0&&(n>0&&this.options.deleteNode!==!1?(u===!0&&this._createSeperator(4),this._createDeleteButton(o)):n===0&&this.options.deleteEdge!==!1&&(u===!0&&this._createSeperator(4),this._createDeleteButton(o))),this._bindElementEvents(this.closeDiv,Ze(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",Ze(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit("_redraw")}addNodeMode(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var t;const n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,Ze(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent("click",Ze(e=this._performAddNode).call(e,this))}editNode(){this.editMode!==!0&&this.enableEditMode(),this._clean();const e=this.selectionHandler.getSelectedNodes()[0];if(e!==void 0)if(this.inMode="editNode",typeof this.options.editNode=="function")if(e.isCluster!==!0){const t=rn({},e.options,!1);if(t.x=e.x,t.y=e.y,this.options.editNode.length===2)this.options.editNode(t,n=>{n!=null&&this.inMode==="editNode"&&this.body.data.nodes.getDataSet().update(n),this.showManipulatorToolbar()});else throw new Error("The function for edit does not support two arguments (data, callback)")}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw new Error("No function has been configured to handle the editing of nodes.");else this.showManipulatorToolbar()}addEdgeMode(){var e,t,n,i,a;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var o;const u=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(u),this._createSeperator(),this._createDescription(u.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,Ze(o=this.toggleEditMode).call(o,this))}this._temporaryBindUI("onTouch",Ze(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",Ze(t=this._finishConnect).call(t,this)),this._temporaryBindUI("onDrag",Ze(n=this._dragControlNode).call(n,this)),this._temporaryBindUI("onRelease",Ze(i=this._finishConnect).call(i,this)),this._temporaryBindUI("onDragStart",Ze(a=this._dragStartEdge).call(a,this)),this._temporaryBindUI("onHold",()=>{})}editEdgeMode(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge",typeof this.options.editEdge=="object"&&typeof this.options.editEdge.editWithoutDrag=="function"&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){const o=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(o.from.id,o.to.id);return}if(this.guiEnabled===!0){var e;const o=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(o),this._createSeperator(),this._createDescription(o.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,Ze(e=this.toggleEditMode).call(e,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var t,n,i,a;const o=this.body.edges[this.edgeBeingEditedId],u=this._getNewTargetNode(o.from.x,o.from.y),c=this._getNewTargetNode(o.to.x,o.to.y);this.temporaryIds.nodes.push(u.id),this.temporaryIds.nodes.push(c.id),this.body.nodes[u.id]=u,this.body.nodeIndices.push(u.id),this.body.nodes[c.id]=c,this.body.nodeIndices.push(c.id),this._temporaryBindUI("onTouch",Ze(t=this._controlNodeTouch).call(t,this)),this._temporaryBindUI("onTap",()=>{}),this._temporaryBindUI("onHold",()=>{}),this._temporaryBindUI("onDragStart",Ze(n=this._controlNodeDragStart).call(n,this)),this._temporaryBindUI("onDrag",Ze(i=this._controlNodeDrag).call(i,this)),this._temporaryBindUI("onDragEnd",Ze(a=this._controlNodeDragEnd).call(a,this)),this._temporaryBindUI("onMouseMove",()=>{}),this._temporaryBindEvent("beforeDrawing",h=>{const f=o.edgeType.findBorderPositions(h);u.selected===!1&&(u.x=f.from.x,u.y=f.from.y),c.selected===!1&&(c.x=f.to.x,c.y=f.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}deleteSelected(){this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";const e=this.selectionHandler.getSelectedNodeIds(),t=this.selectionHandler.getSelectedEdgeIds();let n;if(e.length>0){for(let i=0;i<e.length;i++)if(this.body.nodes[e[i]].isCluster===!0){alert(this.options.locales[this.options.locale].deleteClusterError||this.options.locales.en.deleteClusterError);return}typeof this.options.deleteNode=="function"&&(n=this.options.deleteNode)}else t.length>0&&typeof this.options.deleteEdge=="function"&&(n=this.options.deleteEdge);if(typeof n=="function"){const i={nodes:e,edges:t};if(n.length===2)n(i,a=>{a!=null&&this.inMode==="delete"?(this.body.data.edges.getDataSet().remove(a.edges),this.body.data.nodes.getDataSet().remove(a.nodes),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()):(this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar())});else throw new Error("The function for delete does not support two arguments (data, callback)")}else this.body.data.edges.getDataSet().remove(t),this.body.data.nodes.getDataSet().remove(e),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}_setup(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}_createWrappers(){if(this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0){var e,t;this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",(e=(t=this.options.locales[this.options.locale])===null||t===void 0?void 0:t.close)!==null&&e!==void 0?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv)}}_getNewTargetNode(e,t){const n=rn({},this.options.controlNodeStyle);n.id="targetNode"+Av(),n.hidden=!1,n.physics=!1,n.x=e,n.y=t;const i=this.body.functions.createNode(n);return i.shape.boundingBox={left:e,right:e,top:t,bottom:t},i}_createEditButton(){var e;this._clean(),this.manipulationDOM={},mc(this.editModeDiv);const t=this.options.locales[this.options.locale],n=this._createButton("editMode","vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(n),this._bindElementEvents(n,Ze(e=this.toggleEditMode).call(e,this))}_clean(){this.inMode=!1,this.guiEnabled===!0&&(mc(this.editModeDiv),mc(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}_cleanupDOMEventListeners(){for(const t of cu(e=this._domEventListenerCleanupQueue).call(e,0)){var e;t()}}_removeManipulationDOM(){this._clean(),mc(this.manipulationDiv),mc(this.editModeDiv),mc(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}_createSeperator(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}_createAddNodeButton(e){var t;const n=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,Ze(t=this.addNodeMode).call(t,this))}_createAddEdgeButton(e){var t;const n=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,Ze(t=this.addEdgeMode).call(t,this))}_createEditNodeButton(e){var t;const n=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,Ze(t=this.editNode).call(t,this))}_createEditEdgeButton(e){var t;const n=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,Ze(t=this.editEdgeMode).call(t,this))}_createDeleteButton(e){var t;let n;this.options.rtl?n="vis-delete-rtl":n="vis-delete";const i=this._createButton("delete",n,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,Ze(t=this.deleteSelected).call(t,this))}_createBackButton(e){var t;const n=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,Ze(t=this.showManipulatorToolbar).call(t,this))}_createButton(e,t,n){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=i,this.manipulationDOM[e+"Label"].innerText=n,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}_createDescription(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}_temporaryBindEvent(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}_temporaryBindUI(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+Ag(Pn(this.body.eventListeners)))}_unbindTemporaryUIs(){for(const e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}_unbindTemporaryEvents(){for(let e=0;e<this.temporaryEventFunctions.length;e++){const t=this.temporaryEventFunctions[e].event,n=this.temporaryEventFunctions[e].boundFunction;this.body.emitter.off(t,n)}this.temporaryEventFunctions=[]}_bindElementEvents(e,t){const n=new wf(e,{});L1(n,t),this._domEventListenerCleanupQueue.push(()=>{n.destroy()});const i=a=>{let{keyCode:o,key:u}=a;(u==="Enter"||u===" "||o===13||o===32)&&t()};e.addEventListener("keyup",i,!1),this._domEventListenerCleanupQueue.push(()=>{e.removeEventListener("keyup",i,!1)})}_cleanupTemporaryNodesAndEdges(){for(let a=0;a<this.temporaryIds.edges.length;a++){var e;this.body.edges[this.temporaryIds.edges[a]].disconnect(),delete this.body.edges[this.temporaryIds.edges[a]];const o=Lr(e=this.body.edgeIndices).call(e,this.temporaryIds.edges[a]);if(o!==-1){var t;cu(t=this.body.edgeIndices).call(t,o,1)}}for(let a=0;a<this.temporaryIds.nodes.length;a++){var n;delete this.body.nodes[this.temporaryIds.nodes[a]];const o=Lr(n=this.body.nodeIndices).call(n,this.temporaryIds.nodes[a]);if(o!==-1){var i;cu(i=this.body.nodeIndices).call(i,o,1)}}this.temporaryIds={nodes:[],edges:[]}}_controlNodeTouch(e){this.selectionHandler.unselectAll(),this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Jn({},this.body.view.translation)}_controlNodeDragStart(){const e=this.lastTouch,t=this.selectionHandler._pointerToPositionObject(e),n=this.body.nodes[this.temporaryIds.nodes[0]],i=this.body.nodes[this.temporaryIds.nodes[1]],a=this.body.edges[this.edgeBeingEditedId];this.selectedControlNode=void 0;const o=n.isOverlappingWith(t),u=i.isOverlappingWith(t);o===!0?(this.selectedControlNode=n,a.edgeType.from=n):u===!0&&(this.selectedControlNode=i,a.edgeType.to=i),this.selectedControlNode!==void 0&&this.selectionHandler.selectObject(this.selectedControlNode),this.body.emitter.emit("_redraw")}_controlNodeDrag(e){this.body.emitter.emit("disablePhysics");const t=this.body.functions.getPointer(e.center),n=this.canvas.DOMtoCanvas(t);this.selectedControlNode!==void 0?(this.selectedControlNode.x=n.x,this.selectedControlNode.y=n.y):this.interactionHandler.onDrag(e),this.body.emitter.emit("_redraw")}_controlNodeDragEnd(e){const t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),i=this.body.edges[this.edgeBeingEditedId];if(this.selectedControlNode===void 0)return;this.selectionHandler.unselectAll();const a=this.selectionHandler._getAllNodesOverlappingWith(n);let o;for(let u=a.length-1;u>=0;u--)if(a[u]!==this.selectedControlNode.id){o=this.body.nodes[a[u]];break}if(o!==void 0&&this.selectedControlNode!==void 0)if(o.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const u=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===u.id?this._performEditEdge(o.id,i.to.id):this._performEditEdge(i.from.id,o.id)}else i.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}_handleConnect(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Jn({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;const t=this.lastTouch,n=this.selectionHandler.getNodeAt(t);if(n!==void 0)if(n.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const i=this._getNewTargetNode(n.x,n.y);this.body.nodes[i.id]=i,this.body.nodeIndices.push(i.id);const a=this.body.functions.createEdge({id:"connectionEdge"+Av(),from:n.id,to:i.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[a.id]=a,this.body.edgeIndices.push(a.id),this.temporaryIds.nodes.push(i.id),this.temporaryIds.edges.push(a.id)}this.touchTime=new Date().valueOf()}}_dragControlNode(e){const t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t);let i;this.temporaryIds.edges[0]!==void 0&&(i=this.body.edges[this.temporaryIds.edges[0]].fromId);const a=this.selectionHandler._getAllNodesOverlappingWith(n);let o;for(let c=a.length-1;c>=0;c--){var u;if(Lr(u=this.temporaryIds.nodes).call(u,a[c])===-1){o=this.body.nodes[a[c]];break}}if(e.controlEdge={from:i,to:o?o.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,t),this.temporaryIds.nodes[0]!==void 0){const c=this.body.nodes[this.temporaryIds.nodes[0]];c.x=this.canvas._XconvertDOMtoCanvas(t.x),c.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}_finishConnect(e){const t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t);let i;this.temporaryIds.edges[0]!==void 0&&(i=this.body.edges[this.temporaryIds.edges[0]].fromId);const a=this.selectionHandler._getAllNodesOverlappingWith(n);let o;for(let c=a.length-1;c>=0;c--){var u;if(Lr(u=this.temporaryIds.nodes).call(u,a[c])===-1){o=this.body.nodes[a[c]];break}}this._cleanupTemporaryNodesAndEdges(),o!==void 0&&(o.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[i]!==void 0&&this.body.nodes[o.id]!==void 0&&this._performAddEdge(i,o.id)),e.controlEdge={from:i,to:o?o.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}_dragStartEdge(e){const t=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,t,void 0,!0)}_performAddNode(e){const t={id:Av(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if(typeof this.options.addNode=="function")if(this.options.addNode.length===2)this.options.addNode(t,n=>{n!=null&&this.inMode==="addNode"&&this.body.data.nodes.getDataSet().add(n),this.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");else this.body.data.nodes.getDataSet().add(t),this.showManipulatorToolbar()}_performAddEdge(e,t){const n={from:e,to:t};if(typeof this.options.addEdge=="function")if(this.options.addEdge.length===2)this.options.addEdge(n,i=>{i!=null&&this.inMode==="addEdge"&&(this.body.data.edges.getDataSet().add(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw new Error("The function for connect does not support two arguments (data,callback)");else this.body.data.edges.getDataSet().add(n),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}_performEditEdge(e,t){const n={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label};let i=this.options.editEdge;if(typeof i=="object"&&(i=i.editWithoutDrag),typeof i=="function")if(i.length===2)i(n,a=>{a==null||this.inMode!=="editEdge"?(this.body.edges[n.id].updateEdgeType(),this.body.emitter.emit("_redraw"),this.showManipulatorToolbar()):(this.body.data.edges.getDataSet().update(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw new Error("The function for edit does not support two arguments (data, callback)");else this.body.data.edges.getDataSet().update(n),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}const Je="string",Qe="boolean",Pe="number",mv="array",Ot="object",iZ="dom",sxe="any",jO=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],PO={borderWidth:{number:Pe},borderWidthSelected:{number:Pe,undefined:"undefined"},brokenImage:{string:Je,undefined:"undefined"},chosen:{label:{boolean:Qe,function:"function"},node:{boolean:Qe,function:"function"},__type__:{object:Ot,boolean:Qe}},color:{border:{string:Je},background:{string:Je},highlight:{border:{string:Je},background:{string:Je},__type__:{object:Ot,string:Je}},hover:{border:{string:Je},background:{string:Je},__type__:{object:Ot,string:Je}},__type__:{object:Ot,string:Je}},opacity:{number:Pe,undefined:"undefined"},fixed:{x:{boolean:Qe},y:{boolean:Qe},__type__:{object:Ot,boolean:Qe}},font:{align:{string:Je},color:{string:Je},size:{number:Pe},face:{string:Je},background:{string:Je},strokeWidth:{number:Pe},strokeColor:{string:Je},vadjust:{number:Pe},multi:{boolean:Qe,string:Je},bold:{color:{string:Je},size:{number:Pe},face:{string:Je},mod:{string:Je},vadjust:{number:Pe},__type__:{object:Ot,string:Je}},boldital:{color:{string:Je},size:{number:Pe},face:{string:Je},mod:{string:Je},vadjust:{number:Pe},__type__:{object:Ot,string:Je}},ital:{color:{string:Je},size:{number:Pe},face:{string:Je},mod:{string:Je},vadjust:{number:Pe},__type__:{object:Ot,string:Je}},mono:{color:{string:Je},size:{number:Pe},face:{string:Je},mod:{string:Je},vadjust:{number:Pe},__type__:{object:Ot,string:Je}},__type__:{object:Ot,string:Je}},group:{string:Je,number:Pe,undefined:"undefined"},heightConstraint:{minimum:{number:Pe},valign:{string:Je},__type__:{object:Ot,boolean:Qe,number:Pe}},hidden:{boolean:Qe},icon:{face:{string:Je},code:{string:Je},size:{number:Pe},color:{string:Je},weight:{string:Je,number:Pe},__type__:{object:Ot}},id:{string:Je,number:Pe},image:{selected:{string:Je,undefined:"undefined"},unselected:{string:Je,undefined:"undefined"},__type__:{object:Ot,string:Je}},imagePadding:{top:{number:Pe},right:{number:Pe},bottom:{number:Pe},left:{number:Pe},__type__:{object:Ot,number:Pe}},label:{string:Je,undefined:"undefined"},labelHighlightBold:{boolean:Qe},level:{number:Pe,undefined:"undefined"},margin:{top:{number:Pe},right:{number:Pe},bottom:{number:Pe},left:{number:Pe},__type__:{object:Ot,number:Pe}},mass:{number:Pe},physics:{boolean:Qe},scaling:{min:{number:Pe},max:{number:Pe},label:{enabled:{boolean:Qe},min:{number:Pe},max:{number:Pe},maxVisible:{number:Pe},drawThreshold:{number:Pe},__type__:{object:Ot,boolean:Qe}},customScalingFunction:{function:"function"},__type__:{object:Ot}},shadow:{enabled:{boolean:Qe},color:{string:Je},size:{number:Pe},x:{number:Pe},y:{number:Pe},__type__:{object:Ot,boolean:Qe}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:Qe,array:mv},borderRadius:{number:Pe},interpolation:{boolean:Qe},useImageSize:{boolean:Qe},useBorderWithImage:{boolean:Qe},coordinateOrigin:{string:["center","top-left"]},__type__:{object:Ot}},size:{number:Pe},title:{string:Je,dom:iZ,undefined:"undefined"},value:{number:Pe,undefined:"undefined"},widthConstraint:{minimum:{number:Pe},maximum:{number:Pe},__type__:{object:Ot,boolean:Qe,number:Pe}},x:{number:Pe},y:{number:Pe},__type__:{object:Ot}},oxe={configure:{enabled:{boolean:Qe},filter:{boolean:Qe,string:Je,array:mv,function:"function"},container:{dom:iZ},showButton:{boolean:Qe},__type__:{object:Ot,boolean:Qe,string:Je,array:mv,function:"function"}},edges:{arrows:{to:{enabled:{boolean:Qe},scaleFactor:{number:Pe},type:{string:jO},imageHeight:{number:Pe},imageWidth:{number:Pe},src:{string:Je},__type__:{object:Ot,boolean:Qe}},middle:{enabled:{boolean:Qe},scaleFactor:{number:Pe},type:{string:jO},imageWidth:{number:Pe},imageHeight:{number:Pe},src:{string:Je},__type__:{object:Ot,boolean:Qe}},from:{enabled:{boolean:Qe},scaleFactor:{number:Pe},type:{string:jO},imageWidth:{number:Pe},imageHeight:{number:Pe},src:{string:Je},__type__:{object:Ot,boolean:Qe}},__type__:{string:["from","to","middle"],object:Ot}},endPointOffset:{from:{number:Pe},to:{number:Pe},__type__:{object:Ot,number:Pe}},arrowStrikethrough:{boolean:Qe},background:{enabled:{boolean:Qe},color:{string:Je},size:{number:Pe},dashes:{boolean:Qe,array:mv},__type__:{object:Ot,boolean:Qe}},chosen:{label:{boolean:Qe,function:"function"},edge:{boolean:Qe,function:"function"},__type__:{object:Ot,boolean:Qe}},color:{color:{string:Je},highlight:{string:Je},hover:{string:Je},inherit:{string:["from","to","both"],boolean:Qe},opacity:{number:Pe},__type__:{object:Ot,string:Je}},dashes:{boolean:Qe,array:mv},font:{color:{string:Je},size:{number:Pe},face:{string:Je},background:{string:Je},strokeWidth:{number:Pe},strokeColor:{string:Je},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:Pe},multi:{boolean:Qe,string:Je},bold:{color:{string:Je},size:{number:Pe},face:{string:Je},mod:{string:Je},vadjust:{number:Pe},__type__:{object:Ot,string:Je}},boldital:{color:{string:Je},size:{number:Pe},face:{string:Je},mod:{string:Je},vadjust:{number:Pe},__type__:{object:Ot,string:Je}},ital:{color:{string:Je},size:{number:Pe},face:{string:Je},mod:{string:Je},vadjust:{number:Pe},__type__:{object:Ot,string:Je}},mono:{color:{string:Je},size:{number:Pe},face:{string:Je},mod:{string:Je},vadjust:{number:Pe},__type__:{object:Ot,string:Je}},__type__:{object:Ot,string:Je}},hidden:{boolean:Qe},hoverWidth:{function:"function",number:Pe},label:{string:Je,undefined:"undefined"},labelHighlightBold:{boolean:Qe},length:{number:Pe,undefined:"undefined"},physics:{boolean:Qe},scaling:{min:{number:Pe},max:{number:Pe},label:{enabled:{boolean:Qe},min:{number:Pe},max:{number:Pe},maxVisible:{number:Pe},drawThreshold:{number:Pe},__type__:{object:Ot,boolean:Qe}},customScalingFunction:{function:"function"},__type__:{object:Ot}},selectionWidth:{function:"function",number:Pe},selfReferenceSize:{number:Pe},selfReference:{size:{number:Pe},angle:{number:Pe},renderBehindTheNode:{boolean:Qe},__type__:{object:Ot}},shadow:{enabled:{boolean:Qe},color:{string:Je},size:{number:Pe},x:{number:Pe},y:{number:Pe},__type__:{object:Ot,boolean:Qe}},smooth:{enabled:{boolean:Qe},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:Pe},forceDirection:{string:["horizontal","vertical","none"],boolean:Qe},__type__:{object:Ot,boolean:Qe}},title:{string:Je,undefined:"undefined"},width:{number:Pe},widthConstraint:{maximum:{number:Pe},__type__:{object:Ot,boolean:Qe,number:Pe}},value:{number:Pe,undefined:"undefined"},__type__:{object:Ot}},groups:{useDefaultGroups:{boolean:Qe},__any__:PO,__type__:{object:Ot}},interaction:{dragNodes:{boolean:Qe},dragView:{boolean:Qe},hideEdgesOnDrag:{boolean:Qe},hideEdgesOnZoom:{boolean:Qe},hideNodesOnDrag:{boolean:Qe},hover:{boolean:Qe},keyboard:{enabled:{boolean:Qe},speed:{x:{number:Pe},y:{number:Pe},zoom:{number:Pe},__type__:{object:Ot}},bindToWindow:{boolean:Qe},autoFocus:{boolean:Qe},__type__:{object:Ot,boolean:Qe}},multiselect:{boolean:Qe},navigationButtons:{boolean:Qe},selectable:{boolean:Qe},selectConnectedEdges:{boolean:Qe},hoverConnectedEdges:{boolean:Qe},tooltipDelay:{number:Pe},zoomView:{boolean:Qe},zoomSpeed:{number:Pe},__type__:{object:Ot}},layout:{randomSeed:{undefined:"undefined",number:Pe,string:Je},improvedLayout:{boolean:Qe},clusterThreshold:{number:Pe},hierarchical:{enabled:{boolean:Qe},levelSeparation:{number:Pe},nodeSpacing:{number:Pe},treeSpacing:{number:Pe},blockShifting:{boolean:Qe},edgeMinimization:{boolean:Qe},parentCentralization:{boolean:Qe},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:Ot,boolean:Qe}},__type__:{object:Ot}},manipulation:{enabled:{boolean:Qe},initiallyActive:{boolean:Qe},addNode:{boolean:Qe,function:"function"},addEdge:{boolean:Qe,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:Ot,boolean:Qe,function:"function"}},deleteNode:{boolean:Qe,function:"function"},deleteEdge:{boolean:Qe,function:"function"},controlNodeStyle:PO,__type__:{object:Ot,boolean:Qe}},nodes:PO,physics:{enabled:{boolean:Qe},barnesHut:{theta:{number:Pe},gravitationalConstant:{number:Pe},centralGravity:{number:Pe},springLength:{number:Pe},springConstant:{number:Pe},damping:{number:Pe},avoidOverlap:{number:Pe},__type__:{object:Ot}},forceAtlas2Based:{theta:{number:Pe},gravitationalConstant:{number:Pe},centralGravity:{number:Pe},springLength:{number:Pe},springConstant:{number:Pe},damping:{number:Pe},avoidOverlap:{number:Pe},__type__:{object:Ot}},repulsion:{centralGravity:{number:Pe},springLength:{number:Pe},springConstant:{number:Pe},nodeDistance:{number:Pe},damping:{number:Pe},__type__:{object:Ot}},hierarchicalRepulsion:{centralGravity:{number:Pe},springLength:{number:Pe},springConstant:{number:Pe},nodeDistance:{number:Pe},damping:{number:Pe},avoidOverlap:{number:Pe},__type__:{object:Ot}},maxVelocity:{number:Pe},minVelocity:{number:Pe},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:Qe},iterations:{number:Pe},updateInterval:{number:Pe},onlyDynamicEdges:{boolean:Qe},fit:{boolean:Qe},__type__:{object:Ot,boolean:Qe}},timestep:{number:Pe},adaptiveTimestep:{boolean:Qe},wind:{x:{number:Pe},y:{number:Pe},__type__:{object:Ot}},__type__:{object:Ot,boolean:Qe}},autoResize:{boolean:Qe},clickToUse:{boolean:Qe},locale:{string:Je},locales:{__any__:{any:sxe},__type__:{object:Ot}},height:{string:Je},width:{string:Je},__type__:{object:Ot}},aZ={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},lxe=(r,e,t)=>{var n;return!!(Oc(r).call(r,"physics")&&Oc(n=aZ.physics.solver).call(n,e)&&t.physics.solver!==e&&e!=="wind")};class uxe{constructor(){}getDistances(e,t,n){const i={},a=e.edges;for(let u=0;u<t.length;u++){const c=t[u],h={};i[c]=h;for(let f=0;f<t.length;f++)h[t[f]]=u==f?0:1e9}for(let u=0;u<n.length;u++){const c=a[n[u]];c.connected===!0&&i[c.fromId]!==void 0&&i[c.toId]!==void 0&&(i[c.fromId][c.toId]=1,i[c.toId][c.fromId]=1)}const o=t.length;for(let u=0;u<o;u++){const c=t[u],h=i[c];for(let f=0;f<o-1;f++){const v=t[f],y=i[v];for(let g=f+1;g<o;g++){const _=t[g],E=i[_],R=Math.min(y[_],y[c]+h[_]);y[_]=R,E[v]=R}}}return i}}class cxe{constructor(e,t,n){this.body=e,this.springLength=t,this.springConstant=n,this.distanceSolver=new uxe}setOptions(e){e&&(e.springLength&&(this.springLength=e.springLength),e.springConstant&&(this.springConstant=e.springConstant))}solve(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const i=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(i),this._createK_matrix(i),this._createE_matrix();const a=.01,o=1;let u=0;const c=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),h=5;let f=1e9,v=0,y=0,g=0,_=0,E=0;for(;f>a&&u<c;)for(u+=1,[v,f,y,g]=this._getHighestEnergyNode(n),_=f,E=0;_>o&&E<h;)E+=1,this._moveNode(v,y,g),[_,y,g]=this._getEnergy(v)}_getHighestEnergyNode(e){const t=this.body.nodeIndices,n=this.body.nodes;let i=0,a=t[0],o=0,u=0;for(let c=0;c<t.length;c++){const h=t[c];if(n[h].predefinedPosition!==!0||n[h].isCluster===!0&&e===!0||n[h].options.fixed.x!==!0||n[h].options.fixed.y!==!0){const[f,v,y]=this._getEnergy(h);i<f&&(i=f,a=h,o=v,u=y)}}return[a,i,o,u]}_getEnergy(e){const[t,n]=this.E_sums[e];return[Math.sqrt(t**2+n**2),t,n]}_moveNode(e,t,n){const i=this.body.nodeIndices,a=this.body.nodes;let o=0,u=0,c=0;const h=a[e].x,f=a[e].y,v=this.K_matrix[e],y=this.L_matrix[e];for(let A=0;A<i.length;A++){const j=i[A];if(j!==e){const W=a[j].x,G=a[j].y,D=v[j],P=y[j],U=1/((h-W)**2+(f-G)**2)**1.5;o+=D*(1-P*(f-G)**2*U),u+=D*(P*(h-W)*(f-G)*U),c+=D*(1-P*(h-W)**2*U)}}const g=o,_=u,E=t,R=c,T=n,k=(E/g+T/_)/(_/g-R/_),N=-(_*k+E)/g;a[e].x+=N,a[e].y+=k,this._updateE_matrix(e)}_createL_matrix(e){const t=this.body.nodeIndices,n=this.springLength;this.L_matrix=[];for(let i=0;i<t.length;i++){this.L_matrix[t[i]]={};for(let a=0;a<t.length;a++)this.L_matrix[t[i]][t[a]]=n*e[t[i]][t[a]]}}_createK_matrix(e){const t=this.body.nodeIndices,n=this.springConstant;this.K_matrix=[];for(let i=0;i<t.length;i++){this.K_matrix[t[i]]={};for(let a=0;a<t.length;a++)this.K_matrix[t[i]][t[a]]=n*e[t[i]][t[a]]**-2}}_createE_matrix(){const e=this.body.nodeIndices,t=this.body.nodes;this.E_matrix={},this.E_sums={};for(let n=0;n<e.length;n++)this.E_matrix[e[n]]=[];for(let n=0;n<e.length;n++){const i=e[n],a=t[i].x,o=t[i].y;let u=0,c=0;for(let h=n;h<e.length;h++){const f=e[h];if(f!==i){const v=t[f].x,y=t[f].y,g=1/Math.sqrt((a-v)**2+(o-y)**2);this.E_matrix[i][h]=[this.K_matrix[i][f]*(a-v-this.L_matrix[i][f]*(a-v)*g),this.K_matrix[i][f]*(o-y-this.L_matrix[i][f]*(o-y)*g)],this.E_matrix[f][n]=this.E_matrix[i][h],u+=this.E_matrix[i][h][0],c+=this.E_matrix[i][h][1]}}this.E_sums[i]=[u,c]}}_updateE_matrix(e){const t=this.body.nodeIndices,n=this.body.nodes,i=this.E_matrix[e],a=this.K_matrix[e],o=this.L_matrix[e],u=n[e].x,c=n[e].y;let h=0,f=0;for(let v=0;v<t.length;v++){const y=t[v];if(y!==e){const g=i[v],_=g[0],E=g[1],R=n[y].x,T=n[y].y,k=1/Math.sqrt((u-R)**2+(c-T)**2),N=a[y]*(u-R-o[y]*(u-R)*k),A=a[y]*(c-T-o[y]*(c-T)*k);i[v]=[N,A],h+=N,f+=A;const j=this.E_sums[y];j[0]+=N-_,j[1]+=A-E}}this.E_sums[e]=[h,f]}}function Et(r,e,t){var n,i,a,o;if(!(this instanceof Et))throw new SyntaxError("Constructor must be called with the new operator");this.options={},this.defaultOptions={locale:"en",locales:Pye,clickToUse:!1},Jn(this.options,this.defaultOptions),this.body={container:r,nodes:{},nodeIndices:[],edges:{},edgeIndices:[],emitter:{on:Ze(n=this.on).call(n,this),off:Ze(i=this.off).call(i,this),emit:Ze(a=this.emit).call(a,this),once:Ze(o=this.once).call(o,this)},eventListeners:{onTap:function(){},onTouch:function(){},onDoubleTap:function(){},onHold:function(){},onDragStart:function(){},onDrag:function(){},onDragEnd:function(){},onMouseWheel:function(){},onPinch:function(){},onMouseMove:function(){},onRelease:function(){},onContext:function(){}},data:{nodes:null,edges:null},functions:{createNode:function(){},createEdge:function(){},getPointer:function(){}},modules:{},view:{scale:1,translation:{x:0,y:0}},selectionBox:{show:!1,position:{start:{x:0,y:0},end:{x:0,y:0}}}},this.bindEventListeners(),this.images=new qye(()=>this.body.emitter.emit("_requestRedraw")),this.groups=new Zye,this.canvas=new G2e(this.body),this.selectionHandler=new R5e(this.body,this.canvas),this.interactionHandler=new X2e(this.body,this.canvas,this.selectionHandler),this.view=new Y2e(this.body,this.canvas),this.renderer=new F2e(this.body,this.canvas),this.physics=new j2e(this.body),this.layoutEngine=new ixe(this.body),this.clustering=new B2e(this.body),this.manipulation=new axe(this.body,this.canvas,this.selectionHandler,this.interactionHandler),this.nodesHandler=new o2e(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new R2e(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new cxe(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(t),this.setData(e)}MX(Et.prototype);Et.prototype.setOptions=function(r){if(r===null&&(r=void 0),r!==void 0){if(dye.validate(r,oxe)===!0&&console.error("%cErrors have been found in the supplied options object.",kQ),pp(["locale","locales","clickToUse"],this.options,r),r.locale!==void 0&&(r.locale=Mye(r.locales||this.options.locales,r.locale)),r=this.layoutEngine.setOptions(r.layout,r),this.canvas.setOptions(r),this.groups.setOptions(r.groups),this.nodesHandler.setOptions(r.nodes),this.edgesHandler.setOptions(r.edges),this.physics.setOptions(r.physics),this.manipulation.setOptions(r.manipulation,r,this.options),this.interactionHandler.setOptions(r.interaction),this.renderer.setOptions(r.interaction),this.selectionHandler.setOptions(r.interaction),r.groups!==void 0&&this.body.emitter.emit("refreshNodes"),"configure"in r&&(this.configurator||(this.configurator=new uye(this,this.body.container,aZ,this.canvas.pixelRatio,lxe)),this.configurator.setOptions(r.configure)),this.configurator&&this.configurator.options.enabled===!0){const n={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};rn(n.nodes,this.nodesHandler.options),rn(n.edges,this.edgesHandler.options),rn(n.layout,this.layoutEngine.options),rn(n.interaction,this.selectionHandler.options),rn(n.interaction,this.renderer.options),rn(n.interaction,this.interactionHandler.options),rn(n.manipulation,this.manipulation.options),rn(n.physics,this.physics.options),rn(n.global,this.canvas.options),rn(n.global,this.options),this.configurator.setModuleOptions(n)}r.clickToUse!==void 0?r.clickToUse===!0?this.activator===void 0&&(this.activator=new lye(this.canvas.frame),this.activator.on("change",()=>{this.body.emitter.emit("activate")})):(this.activator!==void 0&&(this.activator.destroy(),delete this.activator),this.body.emitter.emit("activate")):this.body.emitter.emit("activate"),this.canvas.setSize(),this.body.emitter.emit("startSimulation")}};Et.prototype._updateVisibleIndices=function(){const r=this.body.nodes,e=this.body.edges;this.body.nodeIndices=[],this.body.edgeIndices=[];for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&!this.clustering._isClusteredNode(t)&&r[t].options.hidden===!1&&this.body.nodeIndices.push(r[t].id);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t],i=r[n.fromId],a=r[n.toId],o=i!==void 0&&a!==void 0;!this.clustering._isClusteredEdge(t)&&n.options.hidden===!1&&o&&i.options.hidden===!1&&a.options.hidden===!1&&this.body.edgeIndices.push(n.id)}};Et.prototype.bindEventListeners=function(){this.body.emitter.on("_dataChanged",()=>{this.edgesHandler._updateState(),this.body.emitter.emit("_dataUpdated")}),this.body.emitter.on("_dataUpdated",()=>{this.clustering._updateState(),this._updateVisibleIndices(),this._updateValueRange(this.body.nodes),this._updateValueRange(this.body.edges),this.body.emitter.emit("startSimulation"),this.body.emitter.emit("_requestRedraw")})};Et.prototype.setData=function(r){if(this.body.emitter.emit("resetPhysics"),this.body.emitter.emit("_resetData"),this.selectionHandler.unselectAll(),r&&r.dot&&(r.nodes||r.edges))throw new SyntaxError('Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.');if(this.setOptions(r&&r.options),r&&r.dot){console.warn("The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);");const e=wye(r.dot);this.setData(e);return}else if(r&&r.gephi){console.warn("The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);");const e=_ye(r.gephi);this.setData(e);return}else this.nodesHandler.setData(r&&r.nodes,!0),this.edgesHandler.setData(r&&r.edges,!0);this.body.emitter.emit("_dataChanged"),this.body.emitter.emit("_dataLoaded"),this.body.emitter.emit("initPhysics")};Et.prototype.destroy=function(){this.body.emitter.emit("destroy"),this.body.emitter.off(),this.off(),delete this.groups,delete this.canvas,delete this.selectionHandler,delete this.interactionHandler,delete this.view,delete this.renderer,delete this.physics,delete this.layoutEngine,delete this.clustering,delete this.manipulation,delete this.nodesHandler,delete this.edgesHandler,delete this.configurator,delete this.images;for(const r in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,r)&&delete this.body.nodes[r];for(const r in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,r)&&delete this.body.edges[r];mc(this.body.container)};Et.prototype._updateValueRange=function(r){let e,t,n,i=0;for(e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const a=r[e].getValue();a!==void 0&&(t=t===void 0?a:Math.min(a,t),n=n===void 0?a:Math.max(a,n),i+=a)}if(t!==void 0&&n!==void 0)for(e in r)Object.prototype.hasOwnProperty.call(r,e)&&r[e].setValueRange(t,n,i)};Et.prototype.isActive=function(){return!this.activator||this.activator.active};Et.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)};Et.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)};Et.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)};Et.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)};Et.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)};Et.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)};Et.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)};Et.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)};Et.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)};Et.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)};Et.prototype.updateClusteredNode=function(){return this.clustering.updateClusteredNode.apply(this.clustering,arguments)};Et.prototype.getClusteredEdges=function(){return this.clustering.getClusteredEdges.apply(this.clustering,arguments)};Et.prototype.getBaseEdge=function(){return this.clustering.getBaseEdge.apply(this.clustering,arguments)};Et.prototype.getBaseEdges=function(){return this.clustering.getBaseEdges.apply(this.clustering,arguments)};Et.prototype.updateEdge=function(){return this.clustering.updateEdge.apply(this.clustering,arguments)};Et.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)};Et.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)};Et.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)};Et.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)};Et.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)};Et.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)};Et.prototype.editNodeMode=function(){return console.warn("Deprecated: Please use editNode instead of editNodeMode."),this.manipulation.editNode.apply(this.manipulation,arguments)};Et.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)};Et.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)};Et.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)};Et.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)};Et.prototype.getPosition=function(){return this.nodesHandler.getPosition.apply(this.nodesHandler,arguments)};Et.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)};Et.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)};Et.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)};Et.prototype.getConnectedNodes=function(r){return this.body.nodes[r]!==void 0?this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments):this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments)};Et.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)};Et.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)};Et.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)};Et.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)};Et.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)};Et.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)};Et.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodeIds.apply(this.selectionHandler,arguments)};Et.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdgeIds.apply(this.selectionHandler,arguments)};Et.prototype.getNodeAt=function(){const r=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return r!==void 0&&r.id!==void 0?r.id:r};Et.prototype.getEdgeAt=function(){const r=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return r!==void 0&&r.id!==void 0?r.id:r};Et.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)};Et.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)};Et.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.selectionHandler.commitWithoutEmitting.apply(this.selectionHandler),this.redraw()};Et.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)};Et.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)};Et.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)};Et.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)};Et.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)};Et.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)};Et.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)};Et.prototype.getOptionsFromConfigurator=function(){let r={};return this.configurator&&(r=this.configurator.getOptions.apply(this.configurator)),r};function sZ({projectId:r}){const e=he.useRef(null),t=he.useRef(null),[n,i]=he.useState(!0),[a,o]=he.useState(null),[u,c]=he.useState({nodes:0,edges:0}),[h,f]=he.useState(null);he.useEffect(()=>{async function _(){try{console.log("[GraphViewer] Fetching graph data for project:",r);const E=await fetch(`/api/graph/${r}`);console.log("[GraphViewer] API response status:",E.status);const R=await E.json();if(console.log("[GraphViewer] API result:",R),!R.success)throw new Error(R.error||"Failed to load graph");const{nodes:T,edges:k}=R.data;console.log("[GraphViewer] Graph data fetched:",{nodes:T.length,edges:k.length}),c({nodes:T.length,edges:k.length}),f({nodes:T,edges:k}),i(!1)}catch(E){console.error("[GraphViewer] Error fetching graph:",E),o(E instanceof Error?E.message:"Unknown error"),i(!1)}}_()},[r]),he.useEffect(()=>{if(!h){console.log("[GraphViewer] Waiting for data");return}if(n){console.log("[GraphViewer] Still in loading state");return}if(!e.current){console.log("[GraphViewer] Container not ready yet after loading is false");return}console.log("[GraphViewer] Container and data ready, rendering graph"),v(h.nodes,h.edges)},[h,n]);function v(_,E){try{if(!e.current){console.log("[GraphViewer] No container in renderGraph");return}console.log("[GraphViewer] Starting graph render");const R={file:"#3b82f6",function:"#10b981",class:"#8b5cf6",concept:"#f59e0b",problem:"#ef4444",decision:"#06b6d4"},T=new kf(_.map(A=>({id:A.id,label:A.label,title:`Type: ${A.type}
|
|
729
729
|
Confidence: ${A.confidence}`,color:R[A.type]||"#6b7280",shape:A.type==="file"?"box":"dot",font:{color:"#ffffff"}}))),k=new kf(E.map(A=>({id:A.id,from:A.sourceId,to:A.targetId,label:A.relationship,arrows:"to",width:A.weight,color:{color:A.confidence==="EXTRACTED"?"#10b981":"#6b7280",opacity:A.confidence==="AMBIGUOUS"?.3:.7}}))),N={nodes:{borderWidth:2,borderWidthSelected:4,size:25},edges:{smooth:{enabled:!0,type:"continuous",roundness:.5}},physics:{stabilization:{iterations:200},barnesHut:{gravitationalConstant:-8e3,springConstant:.04,springLength:95}},interaction:{hover:!0,tooltipDelay:100}};console.log("[GraphViewer] Creating vis-network with nodes:",T.length,"edges:",k.length),t.current=new Et(e.current,{nodes:T,edges:k},N),console.log("[GraphViewer] Network created successfully"),t.current.on("click",A=>{if(A.nodes.length>0){const j=A.nodes[0];console.log("Clicked node:",j)}}),console.log("[GraphViewer] Graph rendering complete"),i(!1)}catch(R){console.error("[GraphViewer] Error rendering graph:",R),o(R instanceof Error?R.message:"Unknown error"),i(!1)}}async function y(){try{console.log("[GraphViewer] Reloading graph data");const E=await(await fetch(`/api/graph/${r}`)).json();if(E.success){const{nodes:R,edges:T}=E.data;c({nodes:R.length,edges:T.length}),f({nodes:R,edges:T})}}catch(_){console.error("[GraphViewer] Error reloading graph:",_)}}async function g(){try{i(!0);const R=await(await fetch(`/api/graph/${r}/extract/latest`,{method:"POST"})).json();if(!R.success)throw new Error(R.error||"Failed to extract graph");await y()}catch(_){console.error("Error extracting graph:",_),o(_ instanceof Error?_.message:"Unknown error"),i(!1)}}return n?b.jsx("div",{className:"flex items-center justify-center h-96",children:b.jsx("div",{className:"text-gray-400",children:"Loading graph..."})}):a?b.jsxs("div",{className:"flex flex-col items-center justify-center h-96 gap-4",children:[b.jsxs("div",{className:"text-red-400",children:["Error: ",a]}),b.jsx("button",{onClick:y,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700",children:"Retry"})]}):b.jsxs("div",{className:"flex flex-col h-full",children:[b.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[b.jsxs("div",{className:"flex gap-4 text-sm text-gray-400",children:[b.jsxs("span",{children:[u.nodes," nodes"]}),b.jsxs("span",{children:[u.edges," edges"]})]}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx("button",{onClick:g,className:"px-3 py-1.5 bg-green-600 text-white text-sm rounded hover:bg-green-700",children:"Extract from Session"}),b.jsx("button",{onClick:y,className:"px-3 py-1.5 bg-blue-600 text-white text-sm rounded hover:bg-blue-700",children:"Refresh"})]})]}),b.jsx("div",{className:"flex-1 relative min-h-0 bg-gray-900",children:b.jsx("div",{ref:e,className:"absolute inset-0"})}),b.jsx("div",{className:"p-4 border-t border-gray-700 text-xs text-gray-400",children:b.jsxs("div",{className:"flex gap-4",children:[b.jsxs("span",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"w-3 h-3 rounded-full bg-blue-500"}),"File"]}),b.jsxs("span",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"w-3 h-3 rounded-full bg-green-500"}),"Function"]}),b.jsxs("span",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"w-3 h-3 rounded-full bg-purple-500"}),"Class"]}),b.jsxs("span",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"w-3 h-3 rounded-full bg-amber-500"}),"Concept"]}),b.jsxs("span",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"w-3 h-3 rounded-full bg-red-500"}),"Problem"]}),b.jsxs("span",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"w-3 h-3 rounded-full bg-cyan-500"}),"Decision"]})]})})]})}function vV(r){const e=[`# ${r.summary_title||"Session"}`,`Date: ${su(new Date(r.started_at*1e3),"PPpp")}`,`Status: ${r.summary_status||r.status}`,""];r.summary_mood&&e.push(`Mood: ${r.summary_mood}`),r.summary_complexity&&e.push(`Complexity: ${r.summary_complexity}`),r.summary_key_insight&&(e.push(`Key Insight: ${r.summary_key_insight}`),e.push(""));const t=v=>{if(!v)return[];if(Array.isArray(v))return v;try{return JSON.parse(v)}catch{return[]}},n=t(r.summary_what_we_did);n.length&&(e.push("## What We Did"),n.forEach(v=>e.push(`- ${v}`)),e.push(""));const i=t(r.summary_decisions);i.length&&(e.push("## Decisions Made"),i.forEach(v=>e.push(`- ${v}`)),e.push(""));const a=t(r.summary_blockers);a.length&&(e.push("## Blockers"),a.forEach(v=>e.push(`- ${v}`)),e.push(""));const o=t(r.summary_resolved);o.length&&(e.push("## Resolved"),o.forEach(v=>e.push(`- ${v}`)),e.push(""));const u=t(r.summary_files_changed);u.length&&(e.push("## Files Changed"),u.forEach(v=>e.push(`- ${v}`)),e.push(""));const c=t(r.summary_next_steps);c.length&&(e.push("## Next Steps"),c.forEach(v=>e.push(`- ${v}`)),e.push(""));const h=t(r.summary_gotchas);h.length&&(e.push("## Gotchas / Remember"),h.forEach(v=>e.push(`- ${v}`)),e.push(""));const f=t(r.summary_tech_notes);return f.length&&(e.push("## Tech Notes"),f.forEach(v=>e.push(`- ${v}`)),e.push("")),e.join(`
|
|
730
|
-
`)}function dxe({onOpenSession:r}){const{id:e}=A6(),[t,n]=he.useState(!1),[i,a]=he.useState(!1),[o,u]=he.useState("overview"),{data:c,isLoading:h,refetch:f}=ia({queryKey:["session",e],queryFn:()=>Tr.getSession(e),enabled:!!e,refetchInterval:_=>_?.status==="active"?5e3:!1});he.useEffect(()=>{c&&e&&r(e,c.summary_title||`Session ${e.slice(0,8)}`,c.project_id)},[c,e,r]),he.useEffect(()=>{if(!e)return;let _;try{_=M6(),_.onmessage=E=>{try{const R=JSON.parse(E.data);R.session_id===e&&(R.type==="session_end"||R.type==="summary_ready"||R.type==="tool_use"||R.type==="stop")&&f()}catch{}},_.onerror=()=>{console.log("[SessionDetail] WebSocket error, falling back to polling")}}catch(E){console.log("[SessionDetail] WebSocket connection failed:",E)}return()=>{_?.close()}},[e,f]),he.useEffect(()=>{e&&Tr.updateSessionActivity(e).catch(_=>{console.error("Failed to update activity:",_)})},[e]);const v=async()=>{if(!e)return;const _=!!c?.summary_title;n(!0);const E=at.loading(_?"Resyncing summary...":"Syncing summary...");try{_?await Tr.resyncSession(e):await Tr.syncSession(e),at.dismiss(E),at.success("Session queued for summarization"),setTimeout(()=>f(),2e3)}catch(R){at.dismiss(E),at.error("Failed to sync: "+R)}finally{n(!1)}};if(h)return b.jsx("div",{style:{padding:32,color:"var(--text-muted)",fontSize:13},children:"Loading session..."});if(!c)return b.jsx("div",{style:{padding:32,color:"var(--red)",fontSize:13},children:"Session not found"});const y=c.ended_at?Yie(new Date(c.ended_at*1e3),new Date(c.started_at*1e3)):null,g=!!c.summary_title;return b.jsxs("div",{style:{padding:"28px 32px",maxWidth:"100%",width:"100%"},children:[b.jsxs(dl,{to:`/project/${c.project_id}`,style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-muted)",fontSize:12,marginBottom:20},children:[b.jsx(D6,{size:13})," Back to Project"]}),b.jsxs("div",{style:{marginBottom:24},children:[b.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,marginBottom:12},children:[b.jsx("h1",{style:{fontSize:24,fontWeight:700,flex:1},children:c.summary_title||"Session "+c.id.slice(0,12)}),b.jsx(pY,{status:c.summary_status||c.status})]}),b.jsxs("div",{style:{display:"flex",gap:8,borderBottom:"1px solid var(--border)",marginBottom:24,marginTop:20},children:[b.jsx("button",{onClick:()=>u("overview"),style:{padding:"10px 16px",background:"transparent",border:"none",borderBottom:o==="overview"?"2px solid var(--accent)":"2px solid transparent",color:o==="overview"?"var(--accent)":"var(--text-muted)",fontSize:14,fontWeight:600,cursor:"pointer",transition:"all 0.15s",marginBottom:-1},children:"Overview"}),b.jsxs("button",{onClick:()=>u("timeline"),style:{padding:"10px 16px",background:"transparent",border:"none",borderBottom:o==="timeline"?"2px solid var(--accent)":"2px solid transparent",color:o==="timeline"?"var(--accent)":"var(--text-muted)",fontSize:14,fontWeight:600,cursor:"pointer",transition:"all 0.15s",marginBottom:-1},children:["Timeline (",c.observations?.length||0," events)"]}),b.jsx("button",{onClick:()=>u("graph"),style:{padding:"10px 16px",background:"transparent",border:"none",borderBottom:o==="graph"?"2px solid var(--accent)":"2px solid transparent",color:o==="graph"?"var(--accent)":"var(--text-muted)",fontSize:14,fontWeight:600,cursor:"pointer",transition:"all 0.15s",marginBottom:-1},children:"Knowledge Graph"})]}),o==="overview"&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{style:{display:"flex",gap:20,alignItems:"flex-start"},children:[b.jsxs("div",{style:{flex:"0 0 70%"},children:[b.jsxs("div",{style:{display:"flex",gap:16,flexWrap:"wrap",color:"var(--text-muted)",fontSize:14,marginBottom:16},children:[b.jsx("span",{children:su(new Date(c.started_at*1e3),"PPpp")}),y&&b.jsxs("span",{children:["Duration: ",y]}),c.total_turns>0&&b.jsxs("span",{children:[c.total_turns," turns"]}),c.total_tool_calls>0&&b.jsxs("span",{children:[c.total_tool_calls," tool calls"]})]}),b.jsx("div",{style:{marginBottom:16},children:b.jsx(vY,{sessionId:c.id,projectId:c.project_id,sessionTags:c.tags||[],onUpdate:f})}),c.next_session_starting_point&&b.jsxs("div",{style:{padding:"12px 14px",background:"var(--green)15",border:"1px solid var(--green)30",borderRadius:8,fontSize:15,color:"var(--text)",display:"flex",alignItems:"flex-start",gap:8,marginBottom:16},children:[b.jsx(VV,{size:16,style:{color:"var(--green)",flexShrink:0,marginTop:2}}),b.jsxs("div",{children:[b.jsx("strong",{style:{color:"var(--green)"},children:"Next Session Start:"})," ",c.next_session_starting_point]})]}),c.summary_key_insight&&b.jsxs("div",{style:{padding:"10px 12px",background:"var(--accent)15",border:"1px solid var(--accent)30",borderRadius:8,fontSize:15,color:"var(--text)",display:"flex",alignItems:"flex-start",gap:8,marginBottom:16},children:[b.jsx(Tf,{size:16,style:{color:"var(--accent)",flexShrink:0,marginTop:2}}),b.jsxs("div",{children:[b.jsx("strong",{style:{color:"var(--accent)"},children:"Key Insight:"})," ",c.summary_key_insight]})]}),b.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:12},children:[c.observations&&c.observations.length>0&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Total Events"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--blue)"},children:c.observations.length})]}),c.observations&&c.observations.filter(_=>_.type==="tool_use").length>0&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Tool Uses"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--accent)"},children:c.observations.filter(_=>_.type==="tool_use").length})]}),c.observations&&c.observations.filter(_=>_.type==="user_prompt").length>0&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"User Prompts"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--green)"},children:c.observations.filter(_=>_.type==="user_prompt").length})]}),(()=>{const _=c.summary_files_changed?Array.isArray(c.summary_files_changed)?c.summary_files_changed:JSON.parse(c.summary_files_changed):[];return _.length===0?null:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Files Changed"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--orange)"},children:_.length})]})})(),(()=>{const _=c.summary_decisions?Array.isArray(c.summary_decisions)?c.summary_decisions:JSON.parse(c.summary_decisions):[];return _.length===0?null:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Decisions Made"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--accent)"},children:_.length})]})})(),(()=>{const _=c.summary_next_steps?Array.isArray(c.summary_next_steps)?c.summary_next_steps:JSON.parse(c.summary_next_steps):[];return _.length===0?null:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Next Steps"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--yellow)"},children:_.length})]})})(),(()=>{const _=c.summary_gotchas?Array.isArray(c.summary_gotchas)?c.summary_gotchas:JSON.parse(c.summary_gotchas):[];return _.length===0?null:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Gotchas"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--red)"},children:_.length})]})})(),(()=>{const _=c.summary_tech_notes?Array.isArray(c.summary_tech_notes)?c.summary_tech_notes:JSON.parse(c.summary_tech_notes):[];return _.length===0?null:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Tech Notes"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--blue)"},children:_.length})]})})()]})]}),b.jsxs("div",{style:{flex:"0 0 28%",display:"flex",flexDirection:"column",gap:12},children:[c.summary_mood&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 16px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Mood"}),b.jsx("div",{style:{fontSize:18,fontWeight:700,color:"var(--text)",textTransform:"capitalize"},children:c.summary_mood})]}),c.summary_complexity&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 16px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Complexity"}),b.jsx("div",{style:{fontSize:18,fontWeight:700,color:"var(--text)",textTransform:"capitalize"},children:c.summary_complexity.replace("_"," ")})]}),(c.aha_moments_count>0||c.flow_state_duration_mins>0||c.cognitive_load_estimate>0)&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 16px",display:"flex",flexDirection:"column",gap:12},children:[b.jsx("div",{style:{fontSize:12,fontWeight:700,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:4},children:"Session Telemetry"}),c.aha_moments_count>0&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Aha! Moments"}),b.jsx("span",{style:{fontSize:14,fontWeight:600,color:"var(--yellow)"},children:c.aha_moments_count})]}),c.flow_state_duration_mins>0&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Flow State"}),b.jsxs("span",{style:{fontSize:14,fontWeight:600,color:"var(--blue)"},children:[c.flow_state_duration_mins,"m"]})]}),c.preferred_verbosity>0&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"AI Verbosity"}),b.jsx("div",{style:{width:60,height:6,background:"var(--surface2)",borderRadius:3,overflow:"hidden"},children:b.jsx("div",{style:{width:`${Math.min(100,c.preferred_verbosity)}%`,height:"100%",background:"var(--blue)"}})})]}),c.cognitive_load_estimate>0&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Cognitive Load"}),b.jsx("div",{style:{width:60,height:6,background:"var(--surface2)",borderRadius:3,overflow:"hidden"},children:b.jsx("div",{style:{width:`${Math.min(100,c.cognitive_load_estimate)}%`,height:"100%",background:c.cognitive_load_estimate>75?"var(--red)":c.cognitive_load_estimate>50?"var(--yellow)":"var(--green)"}})})]}),c.divergence_score>0&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Divergence"}),b.jsxs("span",{style:{fontSize:14,fontWeight:600,color:"var(--red)"},children:[c.divergence_score,"/100"]})]}),c.collaboration_style&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Style"}),b.jsx("span",{style:{fontSize:13,fontWeight:600,color:"var(--text)",textTransform:"capitalize"},children:c.collaboration_style})]})]}),(()=>{const _=c.summary_resolved?JSON.parse(c.summary_resolved):[];return _.length===0?null:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 16px"},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[b.jsx(Pc,{size:14,style:{color:"var(--green)"}}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Resolved"})]}),b.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:_.map((E,R)=>b.jsxs("div",{style:{fontSize:13,color:"var(--text)",lineHeight:1.4},children:["• ",E]},R))})]})})()]})]}),(()=>{const _=c.summary_blockers?JSON.parse(c.summary_blockers):[];return _.length===0?null:b.jsx("div",{style:{marginTop:16},children:b.jsxs("div",{style:{padding:"10px 12px",background:"var(--red)10",border:"1px solid var(--red)30",borderRadius:8,fontSize:14},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6,color:"var(--red)",fontWeight:600},children:[b.jsx(Ef,{size:16}),"Blockers"]}),_.map((E,R)=>b.jsxs("div",{style:{color:"var(--text-muted)",marginBottom:4},children:["• ",E]},R))]})})})(),b.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:20},children:[b.jsxs("button",{onClick:()=>a(!0),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,fontSize:13,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:_=>{_.currentTarget.style.background="var(--surface)"},onMouseLeave:_=>{_.currentTarget.style.background="var(--surface2)"},children:[b.jsx(Ms,{size:16}),c.notes?"Edit Notes":"Add Notes"]}),b.jsx(yle,{sessionId:c.id}),g&&b.jsxs(b.Fragment,{children:[b.jsx(Tae,{text:vV(c),label:"Copy as Markdown"}),b.jsx(Oae,{text:vV(c),filename:`session-${c.id.slice(0,8)}-${su(new Date(c.started_at*1e3),"yyyy-MM-dd")}.md`,label:"Download Markdown"}),b.jsx(mle,{session:c})]}),c.status!=="active"&&c.transcript_path&&b.jsxs("button",{onClick:v,disabled:t,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",background:t?"var(--surface)":"var(--blue)15",color:t?"var(--text-muted)":"var(--blue)",border:"1px solid",borderColor:t?"var(--border)":"var(--blue)30",borderRadius:8,fontSize:13,fontWeight:600,cursor:t?"not-allowed":"pointer",transition:"all 0.15s"},onMouseEnter:_=>{t||(_.currentTarget.style.background="var(--blue)25")},onMouseLeave:_=>{t||(_.currentTarget.style.background="var(--blue)15")},children:[b.jsx(Sc,{size:14}),t?"Processing...":g?"Resync Summary":"Sync Summary"]})]}),g&&b.jsxs("div",{style:{marginBottom:28},children:[b.jsx("h2",{style:{fontSize:13,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:12},children:"Summary"}),b.jsx(wae,{summary_what_we_did:c.summary_what_we_did,summary_decisions:c.summary_decisions,summary_files_changed:c.summary_files_changed,summary_next_steps:c.summary_next_steps,summary_gotchas:c.summary_gotchas,summary_tech_notes:c.summary_tech_notes,open_rabbit_holes:c.open_rabbit_holes?JSON.parse(c.open_rabbit_holes):void 0,environmental_dependencies:c.environmental_dependencies?JSON.parse(c.environmental_dependencies):void 0,unresolved_tech_debt:c.unresolved_tech_debt?JSON.parse(c.unresolved_tech_debt):void 0,testing_coverage_gap:c.testing_coverage_gap,architectural_drift:c.architectural_drift})]}),!g&&c.status==="active"&&b.jsx("div",{style:{padding:"16px",background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,fontSize:13,color:"var(--text-muted)",marginBottom:24},children:"Session is active. Summary will be generated when the session ends."})]})]}),o==="timeline"&&c.observations&&c.observations.length>0&&b.jsx("div",{children:b.jsx(Eae,{observations:c.observations})}),o==="graph"&&b.jsx("div",{style:{height:"calc(100vh - 300px)",minHeight:"600px"},children:b.jsx(sZ,{projectId:c.project_id})}),b.jsx(ble,{sessionId:c.id,initialNotes:c.notes||"",isOpen:i,onClose:()=>a(!1)})]})}function hxe(){const[r,e]=he.useState(""),[t,n]=he.useState(""),{data:i}=ia({queryKey:["projects"],queryFn:Tr.getProjects}),{data:a,isLoading:o,isFetching:u}=ia({queryKey:["search",r,t],queryFn:()=>Tr.search(r,t||void 0),enabled:r.length>=2});return b.jsxs("div",{style:{padding:"28px 32px",maxWidth:"100%",width:"100%"},children:[b.jsxs("div",{style:{marginBottom:24},children:[b.jsx("h1",{style:{fontSize:22,fontWeight:700,marginBottom:4},children:"Search"}),b.jsx("p",{style:{color:"var(--text-muted)",fontSize:13},children:"Full-text search across all session observations"})]}),b.jsxs("div",{style:{display:"flex",gap:12,marginBottom:20},children:[b.jsx("div",{style:{flex:1},children:b.jsx(gY,{onSearch:e,placeholder:"Search sessions, decisions, file paths...",autoFocus:!0})}),b.jsxs("select",{value:t,onChange:c=>n(c.target.value),style:{padding:"10px 12px",background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,color:"var(--text)",fontSize:13,outline:"none",minWidth:140},children:[b.jsx("option",{value:"",children:"All Projects"}),i?.map(c=>b.jsx("option",{value:c.id,children:c.name},c.id))]})]}),r.length<2&&b.jsxs("div",{style:{textAlign:"center",padding:"60px 0",color:"var(--text-muted)"},children:[b.jsx(Rre,{size:36,color:"var(--border)",style:{marginBottom:12}}),b.jsx("div",{style:{fontSize:14},children:"Type at least 2 characters to search"})]}),o&&r.length>=2&&b.jsx("div",{style:{color:"var(--text-muted)",fontSize:13,padding:"20px 0"},children:"Searching..."}),a?.results&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",marginBottom:12},children:[a.results.length," result",a.results.length!==1?"s":"",' for "',r,'"']}),a.results.length===0?b.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:"var(--text-muted)",fontSize:13},children:"No results found"}):a.results.map(c=>b.jsx(dl,{to:`/session/${c.session_id}`,style:{display:"block"},children:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px",marginBottom:8,cursor:"pointer",transition:"border-color 0.15s"},onMouseEnter:h=>h.currentTarget.style.borderColor="var(--accent)",onMouseLeave:h=>h.currentTarget.style.borderColor="var(--border)",children:[b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8,marginBottom:6},children:[b.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--accent)"},children:c.project_name}),b.jsx("span",{style:{fontSize:11,color:"var(--text-muted)",flexShrink:0},children:c.created_at?su(new Date(c.created_at*1e3),"MMM d, yyyy"):""})]}),b.jsx("div",{style:{fontSize:13,color:"var(--text)",marginBottom:4},children:c.content}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)"},children:c.session_title||`Session ${c.session_id?.slice(0,8)}`})]})},c.observation_id))]})]})}const fxe={session_start:{icon:Tf,color:"var(--green)",label:"Session Started"},session_end:{icon:UO,color:"var(--text-muted)",label:"Session Ended"},tool_use:{icon:wo,color:"var(--accent)",label:"Tool Use"},user_prompt:{icon:rY,color:"var(--blue)",label:"User Prompt"},stop:{icon:UO,color:"var(--text-muted)",label:"Response"},pre_compact:{icon:Pv,color:"var(--yellow)",label:"Pre-Compact"},summary_ready:{icon:Tf,color:"var(--green)",label:"Summary Ready"},connected:{icon:Pv,color:"var(--green)",label:"Connected"}};function pxe(){const[r,e]=he.useState([]),[t,n]=he.useState(!1),[i,a]=he.useState(""),o=he.useRef(null),u=he.useRef(null);return he.useEffect(()=>{let c;const h=()=>{try{c=M6(),o.current=c,c.onopen=()=>{n(!0),a("")},c.onmessage=f=>{try{const v=JSON.parse(f.data);e(y=>[v,...y].slice(0,200))}catch{}},c.onclose=()=>{n(!1),setTimeout(h,3e3)},c.onerror=()=>{a("WebSocket connection failed"),n(!1)}}catch(f){a(String(f))}};return h(),()=>{c?.close()}},[]),b.jsxs("div",{style:{padding:"28px 32px",maxWidth:"100%",width:"100%"},children:[b.jsxs("div",{style:{marginBottom:24},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[b.jsx("h1",{style:{fontSize:22,fontWeight:700},children:"Live Feed"}),b.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:t?"var(--green)":"var(--red)",display:"inline-block",animation:t?"pulse 1.5s infinite":"none"}}),b.jsx("style",{children:"@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }"})]}),b.jsx("p",{style:{color:"var(--text-muted)",fontSize:13},children:t?"Real-time events from active Claude Code sessions":"Connecting..."}),i&&b.jsx("p",{style:{color:"var(--red)",fontSize:12,marginTop:4},children:i})]}),r.length===0&&b.jsxs("div",{style:{textAlign:"center",padding:"60px 0",color:"var(--text-muted)"},children:[b.jsx(Pv,{size:36,color:"var(--border)",style:{marginBottom:12}}),b.jsx("div",{style:{fontSize:14},children:"Waiting for events..."}),b.jsx("div",{style:{fontSize:12,marginTop:8},children:"Start a Claude Code session to see live activity"})]}),b.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",gap:8},children:r.map((c,h)=>{const f=fxe[c.type]||{icon:Pv,color:"var(--text-muted)",label:c.type},v=f.icon;return b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"10px 14px",display:"flex",gap:12,alignItems:"flex-start",opacity:h>50?.6:1},children:[b.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:`${f.color}15`,border:`1px solid ${f.color}30`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:b.jsx(v,{size:12,color:f.color})}),b.jsxs("div",{style:{flex:1,minWidth:0},children:[b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[b.jsx("span",{style:{fontSize:12,fontWeight:600,color:f.color},children:f.label}),b.jsx("span",{style:{fontSize:10,color:"var(--text-muted)",flexShrink:0},children:c.timestamp?su(new Date(c.timestamp),"HH:mm:ss"):""})]}),c.tool_name&&b.jsxs("div",{style:{fontSize:12,color:"var(--text)",marginTop:2,fontFamily:"monospace"},children:[c.tool_name,c.file_path&&b.jsxs("span",{style:{color:"var(--text-muted)"},children:[" ",c.file_path]})]}),c.preview&&b.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.preview}),c.session_id&&b.jsxs("div",{style:{fontSize:10,color:"var(--text-muted)",marginTop:2,fontFamily:"monospace"},children:[c.session_id.slice(0,16),"..."]}),c.project&&b.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:2},children:["Project: ",c.project.name]}),c.title&&b.jsx("div",{style:{fontSize:12,color:"var(--green)",marginTop:2},children:c.title})]})]},h)})})]})}function vxe(){const{id:r}=A6(),[e,t]=he.useState("overview"),{data:n,isLoading:i,error:a}=ia({queryKey:["memory",r],queryFn:()=>Tr.getMemory(r),refetchInterval:15e3,enabled:!!r});if(i)return b.jsx(_xe,{});if(a)return b.jsx(Sxe,{message:String(a)});const o=n?.stats||{},u=o.total_preferences>0||o.total_knowledge>0||o.total_patterns>0||o.total_tasks>0||o.total_contacts>0,c=[{id:"overview",label:"Overview",icon:b.jsx(tY,{size:16})},{id:"preferences",label:"Preferences",icon:b.jsx(au,{size:16}),count:n?.preferences?.length||0},{id:"knowledge",label:"Knowledge",icon:b.jsx(Sk,{size:16}),count:n?.knowledge?.length||0},{id:"patterns",label:"Patterns",icon:b.jsx(HO,{size:16}),count:n?.patterns?.length||0},{id:"tasks",label:"Tasks",icon:b.jsx(y1,{size:16}),count:n?.tasks?.length||0},{id:"contacts",label:"Contacts",icon:b.jsx(Tk,{size:16}),count:n?.contacts?.length||0}];return b.jsxs("div",{style:{padding:"32px 40px",maxWidth:1200,margin:"0 auto",width:"100%",animation:"fadeIn 0.3s ease-out"},children:[b.jsxs(dl,{to:`/project/${r}`,style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-muted)",fontSize:13,marginBottom:24,textDecoration:"none",transition:"color 0.2s",fontWeight:500},onMouseOver:h=>h.currentTarget.style.color="var(--text)",onMouseOut:h=>h.currentTarget.style.color="var(--text-muted)",children:[b.jsx(D6,{size:14})," Back to Project Home"]}),b.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:32},children:b.jsxs("div",{children:[b.jsxs("h1",{style:{fontSize:32,fontWeight:800,marginBottom:8,display:"flex",alignItems:"center",gap:12,letterSpacing:"-0.5px"},children:[b.jsx("div",{style:{padding:8,background:"var(--accent)15",borderRadius:12},children:b.jsx(jv,{size:28,color:"var(--accent)"})}),"Core Memory Bank"]}),b.jsx("p",{style:{color:"var(--text-muted)",fontSize:15,maxWidth:600,lineHeight:1.5},children:"A persistent, cross-session intelligence layer. Claude learns and evolves your project constraints, patterns, and architectural mandates autonomously."})]})}),u?b.jsxs(b.Fragment,{children:[b.jsx("div",{style:{display:"flex",gap:8,borderBottom:"1px solid var(--border)",paddingBottom:16,marginBottom:32,overflowX:"auto",scrollbarWidth:"none"},children:c.map(h=>b.jsxs("button",{onClick:()=>t(h.id),style:{display:"flex",alignItems:"center",gap:8,padding:"10px 16px",borderRadius:8,background:e===h.id?"var(--surface-active, rgba(120, 120, 120, 0.1))":"transparent",border:"none",color:e===h.id?"var(--text)":"var(--text-muted)",fontSize:14,fontWeight:e===h.id?600:500,cursor:"pointer",transition:"all 0.2s ease"},children:[h.icon,h.label,h.count!==void 0&&h.count>0&&b.jsx("span",{style:{background:e===h.id?"var(--accent)":"var(--border)",color:e===h.id?"#fff":"inherit",padding:"2px 8px",borderRadius:12,fontSize:11,fontWeight:700,marginLeft:4},children:h.count})]},h.id))}),b.jsxs("div",{style:{animation:"fadeIn 0.2s ease-out"},children:[e==="overview"&&b.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:16},children:[b.jsx(pv,{icon:b.jsx(au,{size:22}),label:"Active Preferences",value:o.total_preferences,color:"var(--blue)",desc:"Stored user constraints"}),b.jsx(pv,{icon:b.jsx(Sk,{size:22}),label:"Domain Knowledge",value:o.total_knowledge,color:"var(--accent)",desc:"Architectural facts"}),b.jsx(pv,{icon:b.jsx(HO,{size:22}),label:"Learned Patterns",value:o.total_patterns,color:"var(--orange)",desc:"Recurring solutions"}),b.jsx(pv,{icon:b.jsx(y1,{size:22}),label:"Pending Tasks",value:o.total_tasks,color:"var(--green)",desc:"Identified global debt"}),b.jsx(pv,{icon:b.jsx(Tk,{size:22}),label:"Key Contacts",value:o.total_contacts,color:"var(--red)",desc:"Project stakeholders"})]}),e==="preferences"&&b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(350px, 1fr))",gap:16},children:n.preferences?.map(h=>b.jsx(gxe,{pref:h},h.id))}),e==="knowledge"&&b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(400px, 1fr))",gap:16},children:n.knowledge?.map(h=>b.jsx(mxe,{knowledge:h},h.id))}),e==="patterns"&&b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(400px, 1fr))",gap:16},children:n.patterns?.map(h=>b.jsx(yxe,{pattern:h},h.id))}),e==="tasks"&&b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(350px, 1fr))",gap:16},children:n.tasks?.map(h=>b.jsx(bxe,{task:h},h.id))}),e==="contacts"&&b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:16},children:n.contacts?.map(h=>b.jsx(xxe,{contact:h},h.id))})]})]}):b.jsx(wxe,{}),b.jsx("style",{children:`
|
|
730
|
+
`)}function dxe({onOpenSession:r}){const{id:e}=A6(),[t,n]=he.useState(!1),[i,a]=he.useState(!1),[o,u]=he.useState("overview"),{data:c,isLoading:h,refetch:f}=ia({queryKey:["session",e],queryFn:()=>Tr.getSession(e),enabled:!!e,refetchInterval:_=>_?.status==="active"?5e3:!1});he.useEffect(()=>{c&&e&&r(e,c.summary_title||`Session ${e.slice(0,8)}`,c.project_id)},[c,e,r]),he.useEffect(()=>{if(!e)return;let _;try{_=M6(),_.onmessage=E=>{try{const R=JSON.parse(E.data);R.session_id===e&&(R.type==="session_end"||R.type==="summary_ready"||R.type==="tool_use"||R.type==="stop")&&f()}catch{}},_.onerror=()=>{console.log("[SessionDetail] WebSocket error, falling back to polling")}}catch(E){console.log("[SessionDetail] WebSocket connection failed:",E)}return()=>{_?.close()}},[e,f]),he.useEffect(()=>{e&&Tr.updateSessionActivity(e).catch(_=>{console.error("Failed to update activity:",_)})},[e]);const v=async()=>{if(!e)return;const _=!!c?.summary_title;n(!0);const E=at.loading(_?"Resyncing summary...":"Syncing summary...");try{_?await Tr.resyncSession(e):await Tr.syncSession(e),at.dismiss(E),at.success("Session queued for summarization"),setTimeout(()=>f(),2e3)}catch(R){at.dismiss(E),at.error("Failed to sync: "+R)}finally{n(!1)}};if(h)return b.jsx("div",{style:{padding:32,color:"var(--text-muted)",fontSize:13},children:"Loading session..."});if(!c)return b.jsx("div",{style:{padding:32,color:"var(--red)",fontSize:13},children:"Session not found"});const y=c.ended_at?Yie(new Date(c.ended_at*1e3),new Date(c.started_at*1e3)):null,g=!!c.summary_title;return b.jsxs("div",{style:{padding:"28px 32px",maxWidth:"100%",width:"100%"},children:[b.jsxs(dl,{to:`/project/${c.project_id}`,style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-muted)",fontSize:12,marginBottom:20},children:[b.jsx(D6,{size:13})," Back to Project"]}),b.jsxs("div",{style:{marginBottom:24},children:[b.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,marginBottom:12},children:[b.jsx("h1",{style:{fontSize:24,fontWeight:700,flex:1},children:c.summary_title||"Session "+c.id.slice(0,12)}),b.jsx(pY,{status:c.summary_status||c.status})]}),b.jsxs("div",{style:{display:"flex",gap:8,borderBottom:"1px solid var(--border)",marginBottom:24,marginTop:20},children:[b.jsx("button",{onClick:()=>u("overview"),style:{padding:"10px 16px",background:"transparent",border:"none",borderBottom:o==="overview"?"2px solid var(--accent)":"2px solid transparent",color:o==="overview"?"var(--accent)":"var(--text-muted)",fontSize:14,fontWeight:600,cursor:"pointer",transition:"all 0.15s",marginBottom:-1},children:"Overview"}),b.jsxs("button",{onClick:()=>u("timeline"),style:{padding:"10px 16px",background:"transparent",border:"none",borderBottom:o==="timeline"?"2px solid var(--accent)":"2px solid transparent",color:o==="timeline"?"var(--accent)":"var(--text-muted)",fontSize:14,fontWeight:600,cursor:"pointer",transition:"all 0.15s",marginBottom:-1},children:["Timeline (",c.observations?.length||0," events)"]}),b.jsx("button",{onClick:()=>u("graph"),style:{padding:"10px 16px",background:"transparent",border:"none",borderBottom:o==="graph"?"2px solid var(--accent)":"2px solid transparent",color:o==="graph"?"var(--accent)":"var(--text-muted)",fontSize:14,fontWeight:600,cursor:"pointer",transition:"all 0.15s",marginBottom:-1},children:"Knowledge Graph"})]}),o==="overview"&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{style:{display:"flex",gap:20,alignItems:"flex-start"},children:[b.jsxs("div",{style:{flex:"0 0 70%"},children:[b.jsxs("div",{style:{display:"flex",gap:16,flexWrap:"wrap",color:"var(--text-muted)",fontSize:14,marginBottom:16},children:[b.jsx("span",{children:su(new Date(c.started_at*1e3),"PPpp")}),y&&b.jsxs("span",{children:["Duration: ",y]}),c.total_turns>0&&b.jsxs("span",{children:[c.total_turns," turns"]}),c.total_tool_calls>0&&b.jsxs("span",{children:[c.total_tool_calls," tool calls"]})]}),b.jsx("div",{style:{marginBottom:16},children:b.jsx(vY,{sessionId:c.id,projectId:c.project_id,sessionTags:c.tags||[],onUpdate:f})}),c.next_session_starting_point&&b.jsxs("div",{style:{padding:"12px 14px",background:"var(--green)15",border:"1px solid var(--green)30",borderRadius:8,fontSize:15,color:"var(--text)",display:"flex",alignItems:"flex-start",gap:8,marginBottom:16},children:[b.jsx(VV,{size:16,style:{color:"var(--green)",flexShrink:0,marginTop:2}}),b.jsxs("div",{children:[b.jsx("strong",{style:{color:"var(--green)"},children:"Next Session Start:"})," ",c.next_session_starting_point]})]}),c.summary_key_insight&&b.jsxs("div",{style:{padding:"10px 12px",background:"var(--accent)15",border:"1px solid var(--accent)30",borderRadius:8,fontSize:15,color:"var(--text)",display:"flex",alignItems:"flex-start",gap:8,marginBottom:16},children:[b.jsx(Tf,{size:16,style:{color:"var(--accent)",flexShrink:0,marginTop:2}}),b.jsxs("div",{children:[b.jsx("strong",{style:{color:"var(--accent)"},children:"Key Insight:"})," ",c.summary_key_insight]})]}),b.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:12},children:[c.observations&&c.observations.length>0&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Total Events"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--blue)"},children:c.observations.length})]}),c.observations&&c.observations.filter(_=>_.type==="tool_use").length>0&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Tool Uses"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--accent)"},children:c.observations.filter(_=>_.type==="tool_use").length})]}),c.observations&&c.observations.filter(_=>_.type==="user_prompt").length>0&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"User Prompts"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--green)"},children:c.observations.filter(_=>_.type==="user_prompt").length})]}),(()=>{const _=c.summary_files_changed?Array.isArray(c.summary_files_changed)?c.summary_files_changed:JSON.parse(c.summary_files_changed):[];return _.length===0?null:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Files Changed"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--orange)"},children:_.length})]})})(),(()=>{const _=c.summary_decisions?Array.isArray(c.summary_decisions)?c.summary_decisions:JSON.parse(c.summary_decisions):[];return _.length===0?null:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Decisions Made"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--accent)"},children:_.length})]})})(),(()=>{const _=c.summary_next_steps?Array.isArray(c.summary_next_steps)?c.summary_next_steps:JSON.parse(c.summary_next_steps):[];return _.length===0?null:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Next Steps"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--yellow)"},children:_.length})]})})(),(()=>{const _=c.summary_gotchas?Array.isArray(c.summary_gotchas)?c.summary_gotchas:JSON.parse(c.summary_gotchas):[];return _.length===0?null:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Gotchas"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--red)"},children:_.length})]})})(),(()=>{const _=c.summary_tech_notes?Array.isArray(c.summary_tech_notes)?c.summary_tech_notes:JSON.parse(c.summary_tech_notes):[];return _.length===0?null:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Tech Notes"}),b.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--blue)"},children:_.length})]})})()]})]}),b.jsxs("div",{style:{flex:"0 0 28%",display:"flex",flexDirection:"column",gap:12},children:[c.summary_mood&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 16px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Mood"}),b.jsx("div",{style:{fontSize:18,fontWeight:700,color:"var(--text)",textTransform:"capitalize"},children:c.summary_mood})]}),c.summary_complexity&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 16px"},children:[b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Complexity"}),b.jsx("div",{style:{fontSize:18,fontWeight:700,color:"var(--text)",textTransform:"capitalize"},children:c.summary_complexity.replace("_"," ")})]}),(c.total_input_tokens>0||c.total_output_tokens>0)&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 16px",display:"flex",flexDirection:"column",gap:12},children:[b.jsx("div",{style:{fontSize:12,fontWeight:700,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:4},children:"API Token Usage"}),b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Input Tokens"}),b.jsx("span",{style:{fontSize:14,fontWeight:600,color:"var(--blue)"},children:new Intl.NumberFormat().format(c.total_input_tokens||0)})]}),b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Output Tokens"}),b.jsx("span",{style:{fontSize:14,fontWeight:600,color:"var(--accent)"},children:new Intl.NumberFormat().format(c.total_output_tokens||0)})]}),c.total_cache_read_tokens>0&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Cache Hits"}),b.jsx("span",{style:{fontSize:14,fontWeight:600,color:"var(--green)"},children:new Intl.NumberFormat().format(c.total_cache_read_tokens||0)})]}),c.total_cost_usd>0&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:4,paddingTop:8,borderTop:"1px solid var(--border)"},children:[b.jsx("span",{style:{fontSize:13,fontWeight:600,color:"var(--text)"},children:"Est. Cost"}),b.jsxs("span",{style:{fontSize:14,fontWeight:700,color:"var(--green)"},children:["$",(c.total_cost_usd||0).toFixed(4)]})]})]}),(c.aha_moments_count>0||c.flow_state_duration_mins>0||c.cognitive_load_estimate>0)&&b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 16px",display:"flex",flexDirection:"column",gap:12},children:[b.jsx("div",{style:{fontSize:12,fontWeight:700,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:4},children:"Session Telemetry"}),c.aha_moments_count>0&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Aha! Moments"}),b.jsx("span",{style:{fontSize:14,fontWeight:600,color:"var(--yellow)"},children:c.aha_moments_count})]}),c.flow_state_duration_mins>0&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Flow State"}),b.jsxs("span",{style:{fontSize:14,fontWeight:600,color:"var(--blue)"},children:[c.flow_state_duration_mins,"m"]})]}),c.preferred_verbosity>0&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"AI Verbosity"}),b.jsx("div",{style:{width:60,height:6,background:"var(--surface2)",borderRadius:3,overflow:"hidden"},children:b.jsx("div",{style:{width:`${Math.min(100,c.preferred_verbosity)}%`,height:"100%",background:"var(--blue)"}})})]}),c.cognitive_load_estimate>0&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Cognitive Load"}),b.jsx("div",{style:{width:60,height:6,background:"var(--surface2)",borderRadius:3,overflow:"hidden"},children:b.jsx("div",{style:{width:`${Math.min(100,c.cognitive_load_estimate)}%`,height:"100%",background:c.cognitive_load_estimate>75?"var(--red)":c.cognitive_load_estimate>50?"var(--yellow)":"var(--green)"}})})]}),c.divergence_score>0&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Divergence"}),b.jsxs("span",{style:{fontSize:14,fontWeight:600,color:"var(--red)"},children:[c.divergence_score,"/100"]})]}),c.collaboration_style&&b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b.jsx("span",{style:{fontSize:13,color:"var(--text-muted)"},children:"Style"}),b.jsx("span",{style:{fontSize:13,fontWeight:600,color:"var(--text)",textTransform:"capitalize"},children:c.collaboration_style})]})]}),(()=>{const _=c.summary_resolved?JSON.parse(c.summary_resolved):[];return _.length===0?null:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 16px"},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[b.jsx(Pc,{size:14,style:{color:"var(--green)"}}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Resolved"})]}),b.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:_.map((E,R)=>b.jsxs("div",{style:{fontSize:13,color:"var(--text)",lineHeight:1.4},children:["• ",E]},R))})]})})()]})]}),(()=>{const _=c.summary_blockers?JSON.parse(c.summary_blockers):[];return _.length===0?null:b.jsx("div",{style:{marginTop:16},children:b.jsxs("div",{style:{padding:"10px 12px",background:"var(--red)10",border:"1px solid var(--red)30",borderRadius:8,fontSize:14},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6,color:"var(--red)",fontWeight:600},children:[b.jsx(Ef,{size:16}),"Blockers"]}),_.map((E,R)=>b.jsxs("div",{style:{color:"var(--text-muted)",marginBottom:4},children:["• ",E]},R))]})})})(),b.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:20},children:[b.jsxs("button",{onClick:()=>a(!0),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:8,fontSize:13,fontWeight:600,cursor:"pointer",transition:"all 0.15s"},onMouseEnter:_=>{_.currentTarget.style.background="var(--surface)"},onMouseLeave:_=>{_.currentTarget.style.background="var(--surface2)"},children:[b.jsx(Ms,{size:16}),c.notes?"Edit Notes":"Add Notes"]}),b.jsx(yle,{sessionId:c.id}),g&&b.jsxs(b.Fragment,{children:[b.jsx(Tae,{text:vV(c),label:"Copy as Markdown"}),b.jsx(Oae,{text:vV(c),filename:`session-${c.id.slice(0,8)}-${su(new Date(c.started_at*1e3),"yyyy-MM-dd")}.md`,label:"Download Markdown"}),b.jsx(mle,{session:c})]}),c.status!=="active"&&c.transcript_path&&b.jsxs("button",{onClick:v,disabled:t,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",background:t?"var(--surface)":"var(--blue)15",color:t?"var(--text-muted)":"var(--blue)",border:"1px solid",borderColor:t?"var(--border)":"var(--blue)30",borderRadius:8,fontSize:13,fontWeight:600,cursor:t?"not-allowed":"pointer",transition:"all 0.15s"},onMouseEnter:_=>{t||(_.currentTarget.style.background="var(--blue)25")},onMouseLeave:_=>{t||(_.currentTarget.style.background="var(--blue)15")},children:[b.jsx(Sc,{size:14}),t?"Processing...":g?"Resync Summary":"Sync Summary"]})]}),g&&b.jsxs("div",{style:{marginBottom:28},children:[b.jsx("h2",{style:{fontSize:13,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:12},children:"Summary"}),b.jsx(wae,{summary_what_we_did:c.summary_what_we_did,summary_decisions:c.summary_decisions,summary_files_changed:c.summary_files_changed,summary_next_steps:c.summary_next_steps,summary_gotchas:c.summary_gotchas,summary_tech_notes:c.summary_tech_notes,open_rabbit_holes:c.open_rabbit_holes?JSON.parse(c.open_rabbit_holes):void 0,environmental_dependencies:c.environmental_dependencies?JSON.parse(c.environmental_dependencies):void 0,unresolved_tech_debt:c.unresolved_tech_debt?JSON.parse(c.unresolved_tech_debt):void 0,testing_coverage_gap:c.testing_coverage_gap,architectural_drift:c.architectural_drift})]}),!g&&c.status==="active"&&b.jsx("div",{style:{padding:"16px",background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,fontSize:13,color:"var(--text-muted)",marginBottom:24},children:"Session is active. Summary will be generated when the session ends."})]})]}),o==="timeline"&&c.observations&&c.observations.length>0&&b.jsx("div",{children:b.jsx(Eae,{observations:c.observations})}),o==="graph"&&b.jsx("div",{style:{height:"calc(100vh - 300px)",minHeight:"600px"},children:b.jsx(sZ,{projectId:c.project_id})}),b.jsx(ble,{sessionId:c.id,initialNotes:c.notes||"",isOpen:i,onClose:()=>a(!1)})]})}function hxe(){const[r,e]=he.useState(""),[t,n]=he.useState(""),{data:i}=ia({queryKey:["projects"],queryFn:Tr.getProjects}),{data:a,isLoading:o,isFetching:u}=ia({queryKey:["search",r,t],queryFn:()=>Tr.search(r,t||void 0),enabled:r.length>=2});return b.jsxs("div",{style:{padding:"28px 32px",maxWidth:"100%",width:"100%"},children:[b.jsxs("div",{style:{marginBottom:24},children:[b.jsx("h1",{style:{fontSize:22,fontWeight:700,marginBottom:4},children:"Search"}),b.jsx("p",{style:{color:"var(--text-muted)",fontSize:13},children:"Full-text search across all session observations"})]}),b.jsxs("div",{style:{display:"flex",gap:12,marginBottom:20},children:[b.jsx("div",{style:{flex:1},children:b.jsx(gY,{onSearch:e,placeholder:"Search sessions, decisions, file paths...",autoFocus:!0})}),b.jsxs("select",{value:t,onChange:c=>n(c.target.value),style:{padding:"10px 12px",background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,color:"var(--text)",fontSize:13,outline:"none",minWidth:140},children:[b.jsx("option",{value:"",children:"All Projects"}),i?.map(c=>b.jsx("option",{value:c.id,children:c.name},c.id))]})]}),r.length<2&&b.jsxs("div",{style:{textAlign:"center",padding:"60px 0",color:"var(--text-muted)"},children:[b.jsx(Rre,{size:36,color:"var(--border)",style:{marginBottom:12}}),b.jsx("div",{style:{fontSize:14},children:"Type at least 2 characters to search"})]}),o&&r.length>=2&&b.jsx("div",{style:{color:"var(--text-muted)",fontSize:13,padding:"20px 0"},children:"Searching..."}),a?.results&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",marginBottom:12},children:[a.results.length," result",a.results.length!==1?"s":"",' for "',r,'"']}),a.results.length===0?b.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:"var(--text-muted)",fontSize:13},children:"No results found"}):a.results.map(c=>b.jsx(dl,{to:`/session/${c.session_id}`,style:{display:"block"},children:b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"12px 14px",marginBottom:8,cursor:"pointer",transition:"border-color 0.15s"},onMouseEnter:h=>h.currentTarget.style.borderColor="var(--accent)",onMouseLeave:h=>h.currentTarget.style.borderColor="var(--border)",children:[b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8,marginBottom:6},children:[b.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--accent)"},children:c.project_name}),b.jsx("span",{style:{fontSize:11,color:"var(--text-muted)",flexShrink:0},children:c.created_at?su(new Date(c.created_at*1e3),"MMM d, yyyy"):""})]}),b.jsx("div",{style:{fontSize:13,color:"var(--text)",marginBottom:4},children:c.content}),b.jsx("div",{style:{fontSize:11,color:"var(--text-muted)"},children:c.session_title||`Session ${c.session_id?.slice(0,8)}`})]})},c.observation_id))]})]})}const fxe={session_start:{icon:Tf,color:"var(--green)",label:"Session Started"},session_end:{icon:UO,color:"var(--text-muted)",label:"Session Ended"},tool_use:{icon:wo,color:"var(--accent)",label:"Tool Use"},user_prompt:{icon:rY,color:"var(--blue)",label:"User Prompt"},stop:{icon:UO,color:"var(--text-muted)",label:"Response"},pre_compact:{icon:Pv,color:"var(--yellow)",label:"Pre-Compact"},summary_ready:{icon:Tf,color:"var(--green)",label:"Summary Ready"},connected:{icon:Pv,color:"var(--green)",label:"Connected"}};function pxe(){const[r,e]=he.useState([]),[t,n]=he.useState(!1),[i,a]=he.useState(""),o=he.useRef(null),u=he.useRef(null);return he.useEffect(()=>{let c;const h=()=>{try{c=M6(),o.current=c,c.onopen=()=>{n(!0),a("")},c.onmessage=f=>{try{const v=JSON.parse(f.data);e(y=>[v,...y].slice(0,200))}catch{}},c.onclose=()=>{n(!1),setTimeout(h,3e3)},c.onerror=()=>{a("WebSocket connection failed"),n(!1)}}catch(f){a(String(f))}};return h(),()=>{c?.close()}},[]),b.jsxs("div",{style:{padding:"28px 32px",maxWidth:"100%",width:"100%"},children:[b.jsxs("div",{style:{marginBottom:24},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[b.jsx("h1",{style:{fontSize:22,fontWeight:700},children:"Live Feed"}),b.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:t?"var(--green)":"var(--red)",display:"inline-block",animation:t?"pulse 1.5s infinite":"none"}}),b.jsx("style",{children:"@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }"})]}),b.jsx("p",{style:{color:"var(--text-muted)",fontSize:13},children:t?"Real-time events from active Claude Code sessions":"Connecting..."}),i&&b.jsx("p",{style:{color:"var(--red)",fontSize:12,marginTop:4},children:i})]}),r.length===0&&b.jsxs("div",{style:{textAlign:"center",padding:"60px 0",color:"var(--text-muted)"},children:[b.jsx(Pv,{size:36,color:"var(--border)",style:{marginBottom:12}}),b.jsx("div",{style:{fontSize:14},children:"Waiting for events..."}),b.jsx("div",{style:{fontSize:12,marginTop:8},children:"Start a Claude Code session to see live activity"})]}),b.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",gap:8},children:r.map((c,h)=>{const f=fxe[c.type]||{icon:Pv,color:"var(--text-muted)",label:c.type},v=f.icon;return b.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,padding:"10px 14px",display:"flex",gap:12,alignItems:"flex-start",opacity:h>50?.6:1},children:[b.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:`${f.color}15`,border:`1px solid ${f.color}30`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:b.jsx(v,{size:12,color:f.color})}),b.jsxs("div",{style:{flex:1,minWidth:0},children:[b.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[b.jsx("span",{style:{fontSize:12,fontWeight:600,color:f.color},children:f.label}),b.jsx("span",{style:{fontSize:10,color:"var(--text-muted)",flexShrink:0},children:c.timestamp?su(new Date(c.timestamp),"HH:mm:ss"):""})]}),c.tool_name&&b.jsxs("div",{style:{fontSize:12,color:"var(--text)",marginTop:2,fontFamily:"monospace"},children:[c.tool_name,c.file_path&&b.jsxs("span",{style:{color:"var(--text-muted)"},children:[" ",c.file_path]})]}),c.preview&&b.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.preview}),c.session_id&&b.jsxs("div",{style:{fontSize:10,color:"var(--text-muted)",marginTop:2,fontFamily:"monospace"},children:[c.session_id.slice(0,16),"..."]}),c.project&&b.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:2},children:["Project: ",c.project.name]}),c.title&&b.jsx("div",{style:{fontSize:12,color:"var(--green)",marginTop:2},children:c.title})]})]},h)})})]})}function vxe(){const{id:r}=A6(),[e,t]=he.useState("overview"),{data:n,isLoading:i,error:a}=ia({queryKey:["memory",r],queryFn:()=>Tr.getMemory(r),refetchInterval:15e3,enabled:!!r});if(i)return b.jsx(_xe,{});if(a)return b.jsx(Sxe,{message:String(a)});const o=n?.stats||{},u=o.total_preferences>0||o.total_knowledge>0||o.total_patterns>0||o.total_tasks>0||o.total_contacts>0,c=[{id:"overview",label:"Overview",icon:b.jsx(tY,{size:16})},{id:"preferences",label:"Preferences",icon:b.jsx(au,{size:16}),count:n?.preferences?.length||0},{id:"knowledge",label:"Knowledge",icon:b.jsx(Sk,{size:16}),count:n?.knowledge?.length||0},{id:"patterns",label:"Patterns",icon:b.jsx(HO,{size:16}),count:n?.patterns?.length||0},{id:"tasks",label:"Tasks",icon:b.jsx(y1,{size:16}),count:n?.tasks?.length||0},{id:"contacts",label:"Contacts",icon:b.jsx(Tk,{size:16}),count:n?.contacts?.length||0}];return b.jsxs("div",{style:{padding:"32px 40px",maxWidth:1200,margin:"0 auto",width:"100%",animation:"fadeIn 0.3s ease-out"},children:[b.jsxs(dl,{to:`/project/${r}`,style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-muted)",fontSize:13,marginBottom:24,textDecoration:"none",transition:"color 0.2s",fontWeight:500},onMouseOver:h=>h.currentTarget.style.color="var(--text)",onMouseOut:h=>h.currentTarget.style.color="var(--text-muted)",children:[b.jsx(D6,{size:14})," Back to Project Home"]}),b.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:32},children:b.jsxs("div",{children:[b.jsxs("h1",{style:{fontSize:32,fontWeight:800,marginBottom:8,display:"flex",alignItems:"center",gap:12,letterSpacing:"-0.5px"},children:[b.jsx("div",{style:{padding:8,background:"var(--accent)15",borderRadius:12},children:b.jsx(jv,{size:28,color:"var(--accent)"})}),"Core Memory Bank"]}),b.jsx("p",{style:{color:"var(--text-muted)",fontSize:15,maxWidth:600,lineHeight:1.5},children:"A persistent, cross-session intelligence layer. Claude learns and evolves your project constraints, patterns, and architectural mandates autonomously."})]})}),u?b.jsxs(b.Fragment,{children:[b.jsx("div",{style:{display:"flex",gap:8,borderBottom:"1px solid var(--border)",paddingBottom:16,marginBottom:32,overflowX:"auto",scrollbarWidth:"none"},children:c.map(h=>b.jsxs("button",{onClick:()=>t(h.id),style:{display:"flex",alignItems:"center",gap:8,padding:"10px 16px",borderRadius:8,background:e===h.id?"var(--surface-active, rgba(120, 120, 120, 0.1))":"transparent",border:"none",color:e===h.id?"var(--text)":"var(--text-muted)",fontSize:14,fontWeight:e===h.id?600:500,cursor:"pointer",transition:"all 0.2s ease"},children:[h.icon,h.label,h.count!==void 0&&h.count>0&&b.jsx("span",{style:{background:e===h.id?"var(--accent)":"var(--border)",color:e===h.id?"#fff":"inherit",padding:"2px 8px",borderRadius:12,fontSize:11,fontWeight:700,marginLeft:4},children:h.count})]},h.id))}),b.jsxs("div",{style:{animation:"fadeIn 0.2s ease-out"},children:[e==="overview"&&b.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:16},children:[b.jsx(pv,{icon:b.jsx(au,{size:22}),label:"Active Preferences",value:o.total_preferences,color:"var(--blue)",desc:"Stored user constraints"}),b.jsx(pv,{icon:b.jsx(Sk,{size:22}),label:"Domain Knowledge",value:o.total_knowledge,color:"var(--accent)",desc:"Architectural facts"}),b.jsx(pv,{icon:b.jsx(HO,{size:22}),label:"Learned Patterns",value:o.total_patterns,color:"var(--orange)",desc:"Recurring solutions"}),b.jsx(pv,{icon:b.jsx(y1,{size:22}),label:"Pending Tasks",value:o.total_tasks,color:"var(--green)",desc:"Identified global debt"}),b.jsx(pv,{icon:b.jsx(Tk,{size:22}),label:"Key Contacts",value:o.total_contacts,color:"var(--red)",desc:"Project stakeholders"})]}),e==="preferences"&&b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(350px, 1fr))",gap:16},children:n.preferences?.map(h=>b.jsx(gxe,{pref:h},h.id))}),e==="knowledge"&&b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(400px, 1fr))",gap:16},children:n.knowledge?.map(h=>b.jsx(mxe,{knowledge:h},h.id))}),e==="patterns"&&b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(400px, 1fr))",gap:16},children:n.patterns?.map(h=>b.jsx(yxe,{pattern:h},h.id))}),e==="tasks"&&b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(350px, 1fr))",gap:16},children:n.tasks?.map(h=>b.jsx(bxe,{task:h},h.id))}),e==="contacts"&&b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:16},children:n.contacts?.map(h=>b.jsx(xxe,{contact:h},h.id))})]})]}):b.jsx(wxe,{}),b.jsx("style",{children:`
|
|
731
731
|
@keyframes fadeIn {
|
|
732
732
|
from { opacity: 0; transform: translateY(5px); }
|
|
733
733
|
to { opacity: 1; transform: translateY(0); }
|