heyio 4.0.5 → 4.0.6
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/dist/daemon/cli.js
CHANGED
|
@@ -80,7 +80,7 @@ var init_constants = __esm({
|
|
|
80
80
|
"packages/shared/dist/constants.js"() {
|
|
81
81
|
"use strict";
|
|
82
82
|
APP_NAME = "io";
|
|
83
|
-
APP_VERSION = "4.0.
|
|
83
|
+
APP_VERSION = "4.0.6";
|
|
84
84
|
API_PORT = 7777;
|
|
85
85
|
API_HOST = "0.0.0.0";
|
|
86
86
|
DEFAULT_MODEL = "gpt-4o";
|
|
@@ -60089,7 +60089,7 @@ function createApiServer(config2) {
|
|
|
60089
60089
|
});
|
|
60090
60090
|
if (existsSync2(webDirectory)) {
|
|
60091
60091
|
app.use(import_express10.default.static(webDirectory));
|
|
60092
|
-
app.
|
|
60092
|
+
app.use((_req, res) => {
|
|
60093
60093
|
res.sendFile(join5(webDirectory, "index.html"));
|
|
60094
60094
|
});
|
|
60095
60095
|
}
|
package/dist/daemon/index.js
CHANGED
|
@@ -60175,7 +60175,7 @@ var require_mod2 = __commonJS({
|
|
|
60175
60175
|
|
|
60176
60176
|
// packages/shared/dist/constants.js
|
|
60177
60177
|
var APP_NAME = "io";
|
|
60178
|
-
var APP_VERSION = "4.0.
|
|
60178
|
+
var APP_VERSION = "4.0.6";
|
|
60179
60179
|
var API_PORT = 7777;
|
|
60180
60180
|
var API_HOST = "0.0.0.0";
|
|
60181
60181
|
var DEFAULT_MODEL = "gpt-4o";
|
|
@@ -79178,7 +79178,7 @@ function createApiServer(config2) {
|
|
|
79178
79178
|
});
|
|
79179
79179
|
if (existsSync2(webDirectory)) {
|
|
79180
79180
|
app.use(import_express10.default.static(webDirectory));
|
|
79181
|
-
app.
|
|
79181
|
+
app.use((_req, res) => {
|
|
79182
79182
|
res.sendFile(join4(webDirectory, "index.html"));
|
|
79183
79183
|
});
|
|
79184
79184
|
}
|
|
@@ -398,7 +398,7 @@ Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error
|
|
|
398
398
|
*
|
|
399
399
|
* This source code is licensed under the ISC license.
|
|
400
400
|
* See the LICENSE file in the root directory of this source tree.
|
|
401
|
-
*/const kB=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ex=Ue("zap",kB);let Hf=[];const Wf=new Set;function EB(t){Hf=[t,...Hf].slice(0,50);for(const e of Wf)e()}function AB(){Hf=[];for(const t of Wf)t()}function OB(){const[,t]=j.useState(0);return j.useEffect(()=>{const e=()=>t(r=>r+1);return Wf.add(e),()=>{Wf.delete(e)}},[]),Hf}function TB(){const[t,e]=j.useState(!1),r=OB(),n=j.useRef(null),[i,a]=j.useState(0),o=Fa(),c=r.length-i;j.useEffect(()=>{function d(p){n.current&&!n.current.contains(p.target)&&e(!1)}if(t)return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[t]);function u(){e(!t),t||a(r.length)}return y.jsxs("div",{className:"relative",ref:n,children:[y.jsxs("button",{type:"button",onClick:u,className:"relative p-2 rounded-xl hover:bg-white/[0.05] text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",title:"Notifications",children:[y.jsx(dz,{className:"w-3.5 h-3.5"}),c>0&&y.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-[#E43A9C]"})]}),t&&y.jsxs("div",{className:"absolute right-0 top-full mt-2 w-80 max-h-96 overflow-y-auto rounded-xl border border-white/[0.07] bg-[#1a1a1a] shadow-2xl z-50",children:[y.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/[0.07]",children:[y.jsx("span",{className:"text-xs font-mono text-zinc-300",children:"Notifications"}),r.length>0&&y.jsx("button",{type:"button",onClick:AB,className:"text-[10px] font-mono text-zinc-500 hover:text-zinc-300 cursor-pointer",children:"Clear all"})]}),r.length===0?y.jsx("div",{className:"px-4 py-8 text-center text-zinc-600 text-xs font-mono",children:"No notifications yet"}):y.jsx("div",{className:"divide-y divide-white/[0.04]",children:r.map(d=>y.jsxs("div",{className:"px-4 py-3 hover:bg-white/[0.03]",children:[y.jsx("p",{className:"text-xs text-zinc-300 leading-relaxed",children:d.message}),y.jsx("p",{className:"text-[10px] text-zinc-600 font-mono mt-1",children:lp(d.timestamp,o)})]},d.id))})]})]})}const CB="4.0.
|
|
401
|
+
*/const kB=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ex=Ue("zap",kB);let Hf=[];const Wf=new Set;function EB(t){Hf=[t,...Hf].slice(0,50);for(const e of Wf)e()}function AB(){Hf=[];for(const t of Wf)t()}function OB(){const[,t]=j.useState(0);return j.useEffect(()=>{const e=()=>t(r=>r+1);return Wf.add(e),()=>{Wf.delete(e)}},[]),Hf}function TB(){const[t,e]=j.useState(!1),r=OB(),n=j.useRef(null),[i,a]=j.useState(0),o=Fa(),c=r.length-i;j.useEffect(()=>{function d(p){n.current&&!n.current.contains(p.target)&&e(!1)}if(t)return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[t]);function u(){e(!t),t||a(r.length)}return y.jsxs("div",{className:"relative",ref:n,children:[y.jsxs("button",{type:"button",onClick:u,className:"relative p-2 rounded-xl hover:bg-white/[0.05] text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",title:"Notifications",children:[y.jsx(dz,{className:"w-3.5 h-3.5"}),c>0&&y.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-[#E43A9C]"})]}),t&&y.jsxs("div",{className:"absolute right-0 top-full mt-2 w-80 max-h-96 overflow-y-auto rounded-xl border border-white/[0.07] bg-[#1a1a1a] shadow-2xl z-50",children:[y.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/[0.07]",children:[y.jsx("span",{className:"text-xs font-mono text-zinc-300",children:"Notifications"}),r.length>0&&y.jsx("button",{type:"button",onClick:AB,className:"text-[10px] font-mono text-zinc-500 hover:text-zinc-300 cursor-pointer",children:"Clear all"})]}),r.length===0?y.jsx("div",{className:"px-4 py-8 text-center text-zinc-600 text-xs font-mono",children:"No notifications yet"}):y.jsx("div",{className:"divide-y divide-white/[0.04]",children:r.map(d=>y.jsxs("div",{className:"px-4 py-3 hover:bg-white/[0.03]",children:[y.jsx("p",{className:"text-xs text-zinc-300 leading-relaxed",children:d.message}),y.jsx("p",{className:"text-[10px] text-zinc-600 font-mono mt-1",children:lp(d.timestamp,o)})]},d.id))})]})]})}const CB="4.0.6",Kf={SQUAD_CREATED:"squad.created",SQUAD_DELETED:"squad.deleted",SQUAD_UPDATED:"squad.updated",OBJECTIVE_STARTED:"objective.started",OBJECTIVE_COMPLETED:"objective.completed",OBJECTIVE_FAILED:"objective.failed",TASK_STARTED:"task.started",TASK_COMPLETED:"task.completed",TASK_FAILED:"task.failed",AGENT_EXECUTING:"agent.executing",AGENT_COMPLETED:"agent.completed",REVIEW_STARTED:"review.started",REVIEW_COMPLETED:"review.completed",QA_APPROVED:"qa.approved",QA_REJECTED:"qa.rejected",QA_ESCALATED:"qa.escalated",PR_CREATED:"pr.created",PR_MERGED:"pr.merged",INBOX_NEW_ITEM:"inbox.new_item",INBOX_REPLIED:"inbox.replied",CHAT_MESSAGE:"chat.message",CHAT_STREAM_CHUNK:"chat.stream_chunk",CHAT_STREAM_END:"chat.stream_end",NOTIFICATION:"notification"},jB=10,NB=1e3,PB=3e4,RB=["chat","inbox","activity"];function qP(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function IB(t){const e=JSON.parse(t);if(typeof e.type!="string")return null;const r={type:e.type,channel:e.channel,payload:e.payload},n=qP(e.payload);if(e.type===Kf.CHAT_STREAM_CHUNK){const i=e.payload;r.content=i.content}return e.type===Kf.NOTIFICATION&&n&&(r.notification=[n.title,n.body].filter(i=>typeof i=="string"&&i.length>0).join(" — ")),n&&e.type!=="connected"&&(r.event={id:typeof n.id=="string"?n.id:crypto.randomUUID(),type:e.type,timestamp:typeof n.timestamp=="string"?n.timestamp:typeof n.createdAt=="string"?n.createdAt:new Date().toISOString(),squadId:typeof n.squadId=="string"?n.squadId:void 0,instanceId:typeof n.instanceId=="string"?n.instanceId:void 0,agentRole:typeof n.agentRole=="string"?n.agentRole:void 0,model:typeof n.model=="string"?n.model:void 0,data:e.payload}),r}function FP(t={}){const[e,r]=j.useState(!1),[n,i]=j.useState(null),[a,o]=j.useState("connecting"),c=j.useRef(null),u=j.useRef(t),d=j.useRef(0),p=j.useRef(null),f=j.useRef(!0),m=j.useRef(!1);return u.current=t,j.useEffect(()=>{let b=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;const w=TP();w&&(b+=`?token=${encodeURIComponent(w)}`);const x=()=>{if(!f.current)return;o(d.current>0?"reconnecting":"connecting");const k=new WebSocket(b);c.current=k,k.onopen=()=>{const S=d.current>0||m.current;d.current=0,m.current=!1,r(!0),o("connected"),k.send(JSON.stringify({type:"subscribe",channels:RB})),S&&console.info("WebSocket reconnected")},k.onmessage=S=>{var A,C,T,O,N,R,$,K;try{const z=IB(S.data);if(!z)return;if(z.type==="connected"){i(null),(C=(A=u.current).onEvent)==null||C.call(A,z);return}if(z.type===Kf.CHAT_STREAM_CHUNK&&((O=(T=u.current).onDelta)==null||O.call(T,z.content??"")),z.type==="error"){const U=qP(z.payload);(R=(N=u.current).onError)==null||R.call(N,typeof(U==null?void 0:U.message)=="string"?U.message:"Unknown error");return}(K=($=u.current).onEvent)==null||K.call($,z)}catch{}},k.onclose=()=>{if(c.current=null,r(!1),i(null),!f.current)return;if(m.current||(m.current=!0,console.warn("WebSocket disconnected; attempting to reconnect")),d.current>=jB){o("disconnected");return}const S=Math.min(NB*2**d.current,PB);d.current+=1,o("reconnecting"),p.current=setTimeout(x,S)},k.onerror=()=>{k.close()}};return x(),()=>{var k;f.current=!1,p.current&&clearTimeout(p.current),(k=c.current)==null||k.close()}},[]),{connected:e,connectionId:n,connectionState:a}}const HP=j.createContext(null);function $B({children:t}){const[e,r]=j.useState([]),[n,i]=j.useState(""),[a,o]=j.useState(!1),[c,u]=j.useState(!1),d=j.useRef(null),p=j.useCallback(S=>{u(!1),o(!0),i(A=>A+S)},[]),f=j.useCallback(S=>{var A,C,T;if(S.type===Kf.CHAT_STREAM_END){u(!1),o(!1),r(O=>n?[...O,{id:crypto.randomUUID(),role:"assistant",content:n,timestamp:new Date().toISOString()}]:O),i("");return}S.notification&&EB({id:((A=S.event)==null?void 0:A.id)??crypto.randomUUID(),message:S.notification,timestamp:((C=S.event)==null?void 0:C.timestamp)??new Date().toISOString(),eventType:((T=S.event)==null?void 0:T.type)??"unknown"})},[n]),m=j.useCallback(()=>{u(!1),o(!1),i("")},[]),{connected:v}=FP({onDelta:p,onEvent:f,onError:m}),b=j.useCallback(async S=>{u(!0),o(!1),i("");try{const A=await Ge.post("/chat",{message:S,conversationId:d.current??void 0,source:"web"});d.current=A.conversationId}catch(A){throw u(!1),A}},[]),w=j.useCallback(()=>{n&&r(S=>[...S,{id:crypto.randomUUID(),role:"assistant",content:n,timestamp:new Date().toISOString()}]),o(!1),u(!1),i("")},[n]),x=j.useCallback(S=>{r(A=>[...A,S])},[]),k=j.useCallback(async(S,A)=>{const C=new FormData;C.append("file",S),C.append("messageId",A);const T=TP();if(!(await fetch("/api/attachments",{method:"POST",body:C,headers:T?{Authorization:`Bearer ${T}`}:void 0})).ok)throw new Error("Failed to upload attachment")},[]);return y.jsx(HP.Provider,{value:{messages:e,streaming:n,isStreaming:a,isThinking:c,connected:v,sendChatMessage:b,stopStreaming:w,addUserMessage:x,uploadAttachment:k},children:t})}function WP(){const t=j.useContext(HP);if(!t)throw new Error("useChat must be used within a ChatProvider");return t}function MB(){const[t,e]=j.useState(!1),[r,n]=j.useState(""),[i,a]=j.useState(null),o=j.useRef(null),c=j.useRef(null),u=j.useRef(null),{messages:d,streaming:p,isStreaming:f,connected:m,sendChatMessage:v,addUserMessage:b,uploadAttachment:w}=WP(),x=j.useMemo(()=>d.slice(-10),[d]);j.useLayoutEffect(()=>{const C=o.current;C&&(C.scrollTop=C.scrollHeight)});async function k(){const C=r.trim();if(!C&&!i||f)return;const T=crypto.randomUUID(),O=i==null?void 0:i.name,N=[C,O?`Attachment: ${O}`:""].filter(Boolean).join(`
|
|
402
402
|
|
|
403
403
|
`);b({id:T,role:"user",content:C,timestamp:new Date().toISOString(),attachmentName:O}),n(""),a(null),u.current&&(u.current.value=""),c.current&&(c.current.style.height="auto");try{i&&await w(i,T),await v(N),e(!0)}catch{}}function S(C){n(C.target.value),c.current&&(c.current.style.height="auto",c.current.style.height=`${Math.min(c.current.scrollHeight,96)}px`)}function A(C){C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),k())}return y.jsxs("div",{className:"fixed bottom-5 right-5 z-50 flex flex-col items-end gap-3",children:[t&&y.jsxs("div",{className:"w-[340px] h-[460px] rounded-2xl border border-white/[0.09] shadow-2xl overflow-hidden flex flex-col",style:{background:"#1c1c1c"},children:[y.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/[0.07] flex-shrink-0",style:{background:"linear-gradient(135deg, rgba(216,51,51,0.18) 0%, rgba(240,65,255,0.10) 100%)"},children:[y.jsxs("div",{className:"flex items-center gap-2.5",children:[y.jsx(Ia,{height:20}),y.jsx("span",{className:"text-xl text-white tracking-wider leading-none",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"IO"}),y.jsx("span",{className:"text-[10px] font-mono text-zinc-600 mt-0.5",children:"quick chat"})]}),y.jsx("button",{type:"button",onClick:()=>e(!1),className:"p-1 rounded-lg hover:bg-white/[0.07] text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",children:y.jsx(UP,{className:"w-3.5 h-3.5"})})]}),y.jsxs("div",{ref:o,className:"flex-1 overflow-y-auto p-3 space-y-2",children:[x.length===0&&!f?y.jsx("div",{className:"h-full flex items-center justify-center text-center px-6",children:y.jsx("p",{className:"text-xs text-zinc-500",children:"Ask IO anything without leaving this page."})}):x.map(C=>y.jsx("div",{className:`flex ${C.role==="user"?"justify-end":"justify-start"}`,title:C.timestamp,children:y.jsxs("div",{className:`max-w-[85%] ${C.role==="user"?"ml-8":"mr-8"}`,children:[C.attachmentName&&y.jsx("div",{className:"mb-1 rounded-xl border border-white/[0.08] bg-[#1e1e1e] px-3 py-2 text-[11px] font-mono text-zinc-400",children:C.attachmentName}),C.content&&y.jsx("div",{className:C.role==="user"?"bg-gradient-to-br from-[#E43A9C] to-[#D83333] rounded-xl px-3 py-2 text-xs text-white whitespace-pre-wrap":"bg-[#2a2a2a] rounded-xl px-3 py-2 text-xs text-zinc-200",children:C.role==="user"?C.content:y.jsx("div",{className:"prose-io [&_*]:text-xs",dangerouslySetInnerHTML:{__html:it.parse(C.content)}})})]})},C.id)),f&&y.jsx("div",{className:"flex justify-start",children:y.jsx("div",{className:"max-w-[85%] mr-8 bg-[#2a2a2a] rounded-xl px-3 py-2 text-xs text-zinc-200",children:p?y.jsx("div",{className:"prose-io [&_*]:text-xs",dangerouslySetInnerHTML:{__html:it.parse(p)}}):y.jsx("div",{className:"flex items-center gap-1.5 py-1",children:[0,120,240].map(C=>y.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#E43A9C] animate-bounce",style:{animationDelay:`${C}ms`}},C))})})})]}),y.jsx("div",{className:"p-2.5 border-t border-white/[0.06]",children:y.jsxs("div",{className:"bg-[#252525] border border-white/[0.08] rounded-xl overflow-hidden transition-colors focus-within:border-[#E43A9C]/30",children:[y.jsx("input",{ref:u,type:"file",className:"hidden",onChange:C=>{var T;return a(((T=C.target.files)==null?void 0:T[0])??null)}}),i&&y.jsxs("div",{className:"px-3 pt-2 text-[10px] font-mono text-zinc-400",children:["Attached: ",i.name]}),y.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-2",children:[y.jsx("button",{type:"button",onClick:()=>{var C;return(C=u.current)==null?void 0:C.click()},className:"p-1 rounded-lg text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.06] transition-colors flex-shrink-0 cursor-pointer",children:y.jsx(DP,{className:"w-3.5 h-3.5"})}),y.jsx("textarea",{ref:c,value:r,onChange:S,onKeyDown:A,placeholder:"Message IO…",rows:1,className:"flex-1 bg-transparent text-xs text-zinc-200 placeholder:text-zinc-700 resize-none focus:outline-none leading-relaxed",style:{minHeight:"18px",maxHeight:"96px",fontFamily:"Inter, sans-serif"}}),y.jsx("button",{type:"button",onClick:()=>void k(),disabled:!r.trim()&&!i||!m&&!f,className:"p-1.5 rounded-lg text-white disabled:opacity-25 disabled:cursor-not-allowed transition-opacity hover:opacity-90 flex-shrink-0 cursor-pointer",style:{background:"linear-gradient(135deg, #D83333, #E43A9C)"},children:f?y.jsx(up,{className:"w-3 h-3"}):y.jsx(zP,{className:"w-3 h-3"})})]})]})})]}),y.jsx("button",{type:"button",onClick:()=>e(C=>!C),className:"w-12 h-12 rounded-full primary-btn shadow-lg text-white flex items-center justify-center hover:opacity-95 transition-opacity","aria-label":t?"Close quick chat":"Open quick chat",children:y.jsx(Jz,{className:"w-5 h-5"})})]})}function DB({status:t}){const e={connected:"bg-green-500",idle:"bg-green-500",disconnected:"bg-zinc-600",error:"bg-red-500",working:"bg-amber-400",reviewing:"bg-blue-400"}[t],r=t==="connected"||t==="working";return y.jsxs("span",{className:"relative inline-flex items-center justify-center w-2 h-2",children:[r&&y.jsx("span",{className:`absolute inline-flex h-full w-full rounded-full ${e} opacity-40 animate-ping`}),y.jsx("span",{className:`relative inline-flex rounded-full h-2 w-2 ${e}`})]})}function Pt({children:t,variant:e="muted",className:r=""}){const n={default:"bg-[#E43A9C]/15 text-[#F041FF] border-[#E43A9C]/20",success:"bg-green-500/15 text-green-400 border-green-500/20",warning:"bg-amber-500/15 text-amber-400 border-amber-500/20",error:"bg-red-500/15 text-red-400 border-red-500/20",info:"bg-blue-500/15 text-blue-400 border-blue-500/20",muted:"bg-white/5 text-zinc-400 border-white/10"}[e];return y.jsx("span",{className:`inline-flex items-center px-2 py-px rounded-full text-[10px] font-mono border ${n} ${r}`,children:t})}function LB({name:t,color:e}){return e?y.jsx("span",{className:"inline-flex items-center px-1.5 py-px rounded text-[10px] font-mono border",style:{background:`${e}15`,color:e,borderColor:`${e}30`},children:t}):y.jsx(Pt,{variant:"muted",children:t})}function Ba({children:t,onClick:e,className:r="",type:n="button",disabled:i=!1}){return y.jsx("button",{type:n,onClick:e,disabled:i,className:`flex items-center gap-1.5 font-mono text-[11px] text-white rounded-lg active:opacity-80 primary-btn cursor-pointer disabled:opacity-50 ${r}`,children:t})}function wi({children:t,onClick:e,className:r=""}){return y.jsx("button",{type:"button",onClick:e,className:`flex items-center gap-1.5 px-2.5 py-1 rounded-lg font-mono text-[11px] text-zinc-400 bg-[#252525] hover:bg-[#2e2e2e] hover:text-zinc-100 transition-colors cursor-pointer ${r}`,children:t})}function Gf({children:t,onClick:e,className:r=""}){return y.jsx("button",{type:"button",onClick:e,className:`flex items-center gap-1.5 px-2.5 py-1 rounded-lg font-mono text-[11px] text-zinc-400 bg-[#252525] hover:bg-red-500/10 hover:text-red-400 transition-colors cursor-pointer ${r}`,children:t})}function zB({children:t,onClick:e,className:r=""}){return y.jsx("button",{type:"button",onClick:e,className:`flex items-center gap-1.5 px-2.5 py-1 rounded-lg font-mono text-[11px] text-zinc-400 bg-[#252525] hover:bg-amber-500/10 hover:text-amber-400 transition-colors cursor-pointer ${r}`,children:t})}function Ms(t){return t==="connected"||t==="idle"?"success":t==="active"||t==="working"?"warning":t==="reviewing"||t==="in meeting"||t==="planning"||t==="meeting"?"info":t==="error"||t==="failed"?"error":"muted"}function dp(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function BB(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(p){try{d(n.next(p))}catch(f){o(f)}}function u(p){try{d(n.throw(p))}catch(f){o(f)}}function d(p){p.done?a(p.value):i(p.value).then(c,u)}d((n=n.apply(t,e||[])).next())})}const UB=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class a1 extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class qB extends a1{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class aE extends a1{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class oE extends a1{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var tx;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(tx||(tx={}));class FB{constructor(e,{headers:r={},customFetch:n,region:i=tx.Any}={}){this.url=e,this.headers=r,this.region=i,this.fetch=UB(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return BB(this,arguments,void 0,function*(r,n={}){var i;let a,o;try{const{headers:c,method:u,body:d,signal:p,timeout:f}=n;let m={},{region:v}=n;v||(v=this.region);const b=new URL(`${this.url}/${r}`);v&&v!=="any"&&(m["x-region"]=v,b.searchParams.set("forceFunctionRegion",v));let w;d&&(c&&!Object.prototype.hasOwnProperty.call(c,"Content-Type")||!c)?typeof Blob<"u"&&d instanceof Blob||d instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",w=d):typeof d=="string"?(m["Content-Type"]="text/plain",w=d):typeof FormData<"u"&&d instanceof FormData?w=d:(m["Content-Type"]="application/json",w=JSON.stringify(d)):d&&typeof d!="string"&&!(typeof Blob<"u"&&d instanceof Blob)&&!(d instanceof ArrayBuffer)&&!(typeof FormData<"u"&&d instanceof FormData)?w=JSON.stringify(d):w=d;let x=p;f&&(o=new AbortController,a=setTimeout(()=>o.abort(),f),p?(x=o.signal,p.addEventListener("abort",()=>o.abort())):x=o.signal);const k=yield this.fetch(b.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),c),body:w,signal:x}).catch(T=>{throw new qB(T)}),S=k.headers.get("x-relay-error");if(S&&S==="true")throw new aE(k);if(!k.ok)throw new oE(k);let A=((i=k.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),C;return A==="application/json"?C=yield k.json():A==="application/octet-stream"||A==="application/pdf"?C=yield k.blob():A==="text/event-stream"?C=k:A==="multipart/form-data"?C=yield k.formData():C=yield k.text(),{data:C,error:null,response:k}}catch(c){return{data:null,error:c,response:c instanceof oE||c instanceof aE?c.context:void 0}}finally{a&&clearTimeout(a)}})}}const KP=3,sE=t=>Math.min(1e3*2**t,3e4),HB=[520,503],GP=["GET","HEAD","OPTIONS"];var lE=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function cE(t,e){return new Promise(r=>{if(e!=null&&e.aborted){r();return}const n=setTimeout(()=>{e==null||e.removeEventListener("abort",i),r()},t);function i(){clearTimeout(n),r()}e==null||e.addEventListener("abort",i)})}function WB(t,e,r,n){return!(!n||r>=KP||!GP.includes(t)||!HB.includes(e))}var KB=class{constructor(t){var e,r,n,i,a;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(n=t.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(i=t.urlLengthLimit)!==null&&i!==void 0?i:8e3,this.retryEnabled=(a=t.retry)!==null&&a!==void 0?a:!0,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let a=(async()=>{let o=0;for(;;){const d=new Headers(r.headers);o>0&&d.set("X-Retry-Count",String(o));let p;try{p=await n(r.url.toString(),{method:r.method,headers:d,body:JSON.stringify(r.body,(f,m)=>typeof m=="bigint"?m.toString():m),signal:r.signal})}catch(f){if((f==null?void 0:f.name)==="AbortError"||(f==null?void 0:f.code)==="ABORT_ERR"||!GP.includes(r.method))throw f;if(r.retryEnabled&&o<KP){const m=sE(o);o++,await cE(m,r.signal);continue}throw f}if(WB(r.method,p.status,o,r.retryEnabled)){var c,u;const f=(c=(u=p.headers)===null||u===void 0?void 0:u.get("Retry-After"))!==null&&c!==void 0?c:null,m=f!==null?Math.max(0,parseInt(f,10)||0)*1e3:sE(o);await p.text(),o++,await cE(m,r.signal);continue}return await r.processResponse(p)}})();return this.shouldThrowOnError||(a=a.catch(o=>{var c;let u="",d="",p="";const f=o==null?void 0:o.cause;if(f){var m,v,b,w;const S=(m=f==null?void 0:f.message)!==null&&m!==void 0?m:"",A=(v=f==null?void 0:f.code)!==null&&v!==void 0?v:"";u=`${(b=o==null?void 0:o.name)!==null&&b!==void 0?b:"FetchError"}: ${o==null?void 0:o.message}`,u+=`
|
|
404
404
|
|
|
@@ -517,4 +517,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
517
517
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RM(t,e){if(t){if(typeof t=="string")return Cw(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Cw(t,e)}}function zne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Bne(t){if(Array.isArray(t))return Cw(t)}function Cw(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function PN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ie(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?PN(Object(r),!0).forEach(function(n){ze(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):PN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ze(t,e,r){return e=IM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function IM(t){var e=Une(t,"string");return dl(e)=="symbol"?e:e+""}function Une(t,e){if(dl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(dl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var qne={xAxis:["bottom","top"],yAxis:["left","right"]},Fne={width:"100%",height:"100%"},$M={x:0,y:0};function jf(t){return t}var Hne=function(e,r){return r==="horizontal"?e.x:r==="vertical"?e.y:r==="centric"?e.angle:e.radius},Wne=function(e,r,n,i){var a=r.find(function(p){return p&&p.index===n});if(a){if(e==="horizontal")return{x:a.coordinate,y:i.y};if(e==="vertical")return{x:i.x,y:a.coordinate};if(e==="centric"){var o=a.coordinate,c=i.radius;return ie(ie(ie({},i),wr(i.cx,i.cy,c,o)),{},{angle:o,radius:c})}var u=a.coordinate,d=i.angle;return ie(ie(ie({},i),wr(i.cx,i.cy,u,d)),{},{angle:d,radius:u})}return $M},Kp=function(e,r){var n=r.graphicalItems,i=r.dataStartIndex,a=r.dataEndIndex,o=(n??[]).reduce(function(c,u){var d=u.props.data;return d&&d.length?[].concat(fl(c),fl(d)):c},[]);return o.length>0?o:e&&e.length&&ge(i)&&ge(a)?e.slice(i,a+1):[]};function MM(t){return t==="number"?[0,"auto"]:void 0}var jw=function(e,r,n,i){var a=e.graphicalItems,o=e.tooltipAxis,c=Kp(r,e);return n<0||!a||!a.length||n>=c.length?null:a.reduce(function(u,d){var p,f=(p=d.props.data)!==null&&p!==void 0?p:r;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var m;if(o.dataKey&&!o.allowDuplicatedCategory){var v=f===void 0?c:f;m=nh(v,o.dataKey,i)}else m=f&&f[n]||c[n];return m?[].concat(fl(u),[M$(d,m)]):u},[])},RN=function(e,r,n,i){var a=i||{x:e.chartX,y:e.chartY},o=Hne(a,n),c=e.orderedTooltipTicks,u=e.tooltipAxis,d=e.tooltipTicks,p=tY(o,c,d,u);if(p>=0&&d){var f=d[p]&&d[p].value,m=jw(e,r,p,f),v=Wne(n,c,p,a);return{activeTooltipIndex:p,activeLabel:f,activePayload:m,activeCoordinate:v}}return null},Kne=function(e,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,m=e.stackOffset,v=R$(p,a);return n.reduce(function(b,w){var x,k=w.type.defaultProps!==void 0?ie(ie({},w.type.defaultProps),w.props):w.props,S=k.type,A=k.dataKey,C=k.allowDataOverflow,T=k.allowDuplicatedCategory,O=k.scale,N=k.ticks,R=k.includeHidden,$=k[o];if(b[$])return b;var K=Kp(e.data,{graphicalItems:i.filter(function(q){var te,le=o in q.props?q.props[o]:(te=q.type.defaultProps)===null||te===void 0?void 0:te[o];return le===$}),dataStartIndex:u,dataEndIndex:d}),z=K.length,U,F,X;vne(k.domain,C,S)&&(U=Gx(k.domain,null,C),v&&(S==="number"||O!=="auto")&&(X=Lc(K,A,"category")));var Y=MM(S);if(!U||U.length===0){var G,Z=(G=k.domain)!==null&&G!==void 0?G:Y;if(A){if(U=Lc(K,A,S),S==="category"&&v){var W=K9(U);T&&W?(F=U,U=qh(0,z)):T||(U=Gj(Z,U,w).reduce(function(q,te){return q.indexOf(te)>=0?q:[].concat(fl(q),[te])},[]))}else if(S==="category")T?U=U.filter(function(q){return q!==""&&!tt(q)}):U=Gj(Z,U,w).reduce(function(q,te){return q.indexOf(te)>=0||te===""||tt(te)?q:[].concat(fl(q),[te])},[]);else if(S==="number"){var Q=oY(K,i.filter(function(q){var te,le,fe=o in q.props?q.props[o]:(te=q.type.defaultProps)===null||te===void 0?void 0:te[o],ve="hide"in q.props?q.props.hide:(le=q.type.defaultProps)===null||le===void 0?void 0:le.hide;return fe===$&&(R||!ve)}),A,a,p);Q&&(U=Q)}v&&(S==="number"||O!=="auto")&&(X=Lc(K,A,"category"))}else v?U=qh(0,z):c&&c[$]&&c[$].hasStack&&S==="number"?U=m==="expand"?[0,1]:$$(c[$].stackGroups,u,d):U=P$(K,i.filter(function(q){var te=o in q.props?q.props[o]:q.type.defaultProps[o],le="hide"in q.props?q.props.hide:q.type.defaultProps.hide;return te===$&&(R||!le)}),S,p,!0);if(S==="number")U=Ow(f,U,$,a,N),Z&&(U=Gx(Z,U,C));else if(S==="category"&&Z){var L=Z,I=U.every(function(q){return L.indexOf(q)>=0});I&&(U=L)}}return ie(ie({},b),{},ze({},$,ie(ie({},k),{},{axisType:a,domain:U,categoricalDomain:X,duplicateDomain:F,originalDomain:(x=k.domain)!==null&&x!==void 0?x:Y,isCategorical:v,layout:p})))},{})},Gne=function(e,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,m=Kp(e.data,{graphicalItems:n,dataStartIndex:u,dataEndIndex:d}),v=m.length,b=R$(p,a),w=-1;return n.reduce(function(x,k){var S=k.type.defaultProps!==void 0?ie(ie({},k.type.defaultProps),k.props):k.props,A=S[o],C=MM("number");if(!x[A]){w++;var T;return b?T=qh(0,v):c&&c[A]&&c[A].hasStack?(T=$$(c[A].stackGroups,u,d),T=Ow(f,T,A,a)):(T=Gx(C,P$(m,n.filter(function(O){var N,R,$=o in O.props?O.props[o]:(N=O.type.defaultProps)===null||N===void 0?void 0:N[o],K="hide"in O.props?O.props.hide:(R=O.type.defaultProps)===null||R===void 0?void 0:R.hide;return $===A&&!K}),"number",p),i.defaultProps.allowDataOverflow),T=Ow(f,T,A,a)),ie(ie({},x),{},ze({},A,ie(ie({axisType:a},i.defaultProps),{},{hide:!0,orientation:On(qne,"".concat(a,".").concat(w%2),null),domain:T,originalDomain:C,isCategorical:b,layout:p})))}return x},{})},Vne=function(e,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.children,f="".concat(i,"Id"),m=Tn(p,a),v={};return m&&m.length?v=Kne(e,{axes:m,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d}):o&&o.length&&(v=Gne(e,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d})),v},Xne=function(e){var r=Ra(e),n=Ki(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:C1(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Ph(r,n)}},IN=function(e){var r=e.children,n=e.defaultShowTooltip,i=sn(r,rl),a=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},Yne=function(e){return!e||!e.length?!1:e.some(function(r){var n=Gi(r&&r.type);return n&&n.indexOf("Bar")>=0})},$N=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Jne=function(e,r){var n=e.props,i=e.graphicalItems,a=e.xAxisMap,o=a===void 0?{}:a,c=e.yAxisMap,u=c===void 0?{}:c,d=n.width,p=n.height,f=n.children,m=n.margin||{},v=sn(f,rl),b=sn(f,Bs),w=Object.keys(u).reduce(function(T,O){var N=u[O],R=N.orientation;return!N.mirror&&!N.hide?ie(ie({},T),{},ze({},R,T[R]+N.width)):T},{left:m.left||0,right:m.right||0}),x=Object.keys(o).reduce(function(T,O){var N=o[O],R=N.orientation;return!N.mirror&&!N.hide?ie(ie({},T),{},ze({},R,On(T,"".concat(R))+N.height)):T},{top:m.top||0,bottom:m.bottom||0}),k=ie(ie({},x),w),S=k.bottom;v&&(k.bottom+=v.props.height||rl.defaultProps.height),b&&r&&(k=iY(k,i,n,r));var A=d-k.left-k.right,C=p-k.top-k.bottom;return ie(ie({brushBottom:S},k),{},{width:Math.max(A,0),height:Math.max(C,0)})},Zne=function(e,r){if(r==="xAxis")return e[r].width;if(r==="yAxis")return e[r].height},DM=function(e){var r=e.chartName,n=e.GraphicalChild,i=e.defaultTooltipEventType,a=i===void 0?"axis":i,o=e.validateTooltipEventTypes,c=o===void 0?["axis"]:o,u=e.axisComponents,d=e.legendContent,p=e.formatAxisMap,f=e.defaultProps,m=function(k,S){var A=S.graphicalItems,C=S.stackGroups,T=S.offset,O=S.updateId,N=S.dataStartIndex,R=S.dataEndIndex,$=k.barSize,K=k.layout,z=k.barGap,U=k.barCategoryGap,F=k.maxBarSize,X=$N(K),Y=X.numericAxisName,G=X.cateAxisName,Z=Yne(A),W=[];return A.forEach(function(Q,L){var I=Kp(k.data,{graphicalItems:[Q],dataStartIndex:N,dataEndIndex:R}),q=Q.type.defaultProps!==void 0?ie(ie({},Q.type.defaultProps),Q.props):Q.props,te=q.dataKey,le=q.maxBarSize,fe=q["".concat(Y,"Id")],ve=q["".concat(G,"Id")],qe={},xe=u.reduce(function(cr,_t){var Sr=S["".concat(_t.axisType,"Map")],Ir=q["".concat(_t.axisType,"Id")];Sr&&Sr[Ir]||_t.axisType==="zAxis"||Mo();var ni=Sr[Ir];return ie(ie({},cr),{},ze(ze({},_t.axisType,ni),"".concat(_t.axisType,"Ticks"),Ki(ni)))},qe),ae=xe[G],Se=xe["".concat(G,"Ticks")],Me=C&&C[fe]&&C[fe].hasStack&&vY(Q,C[fe].stackGroups),oe=Gi(Q.type).indexOf("Bar")>=0,rt=Ph(ae,Se),Fe=[],kt=Z&&rY({barSize:$,stackGroups:C,totalSize:Zne(xe,G)});if(oe){var wt,Et,_r=tt(le)?F:le,Ut=(wt=(Et=Ph(ae,Se,!0))!==null&&Et!==void 0?Et:_r)!==null&&wt!==void 0?wt:0;Fe=nY({barGap:z,barCategoryGap:U,bandSize:Ut!==rt?Ut:rt,sizeList:kt[ve],maxBarSize:_r}),Ut!==rt&&(Fe=Fe.map(function(cr){return ie(ie({},cr),{},{position:ie(ie({},cr.position),{},{offset:cr.position.offset-Ut/2})})}))}var Rr=Q&&Q.type&&Q.type.getComposedData;Rr&&W.push({props:ie(ie({},Rr(ie(ie({},xe),{},{displayedData:I,props:k,dataKey:te,item:Q,bandSize:rt,barPosition:Fe,offset:T,stackedData:Me,layout:K,dataStartIndex:N,dataEndIndex:R}))),{},ze(ze(ze({key:Q.key||"item-".concat(L)},Y,xe[Y]),G,xe[G]),"animationId",O)),childIndex:aF(Q,k.children),item:Q})}),W},v=function(k,S){var A=k.props,C=k.dataStartIndex,T=k.dataEndIndex,O=k.updateId;if(!sO({props:A}))return null;var N=A.children,R=A.layout,$=A.stackOffset,K=A.data,z=A.reverseStackOrder,U=$N(R),F=U.numericAxisName,X=U.cateAxisName,Y=Tn(N,n),G=mY(K,Y,"".concat(F,"Id"),"".concat(X,"Id"),$,z),Z=u.reduce(function(q,te){var le="".concat(te.axisType,"Map");return ie(ie({},q),{},ze({},le,Vne(A,ie(ie({},te),{},{graphicalItems:Y,stackGroups:te.axisType===F&&G,dataStartIndex:C,dataEndIndex:T}))))},{}),W=Jne(ie(ie({},Z),{},{props:A,graphicalItems:Y}),S==null?void 0:S.legendBBox);Object.keys(Z).forEach(function(q){Z[q]=p(A,Z[q],W,q.replace("Map",""),r)});var Q=Z["".concat(X,"Map")],L=Xne(Q),I=m(A,ie(ie({},Z),{},{dataStartIndex:C,dataEndIndex:T,updateId:O,graphicalItems:Y,stackGroups:G,offset:W}));return ie(ie({formattedGraphicalItems:I,graphicalItems:Y,offset:W,stackGroups:G},L),Z)},b=(function(x){function k(S){var A,C,T;return Nne(this,k),T=Ine(this,k,[S]),ze(T,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ze(T,"accessibilityManager",new yne),ze(T,"handleLegendBBoxUpdate",function(O){if(O){var N=T.state,R=N.dataStartIndex,$=N.dataEndIndex,K=N.updateId;T.setState(ie({legendBBox:O},v({props:T.props,dataStartIndex:R,dataEndIndex:$,updateId:K},ie(ie({},T.state),{},{legendBBox:O}))))}}),ze(T,"handleReceiveSyncEvent",function(O,N,R){if(T.props.syncId===O){if(R===T.eventEmitterSymbol&&typeof T.props.syncMethod!="function")return;T.applySyncEvent(N)}}),ze(T,"handleBrushChange",function(O){var N=O.startIndex,R=O.endIndex;if(N!==T.state.dataStartIndex||R!==T.state.dataEndIndex){var $=T.state.updateId;T.setState(function(){return ie({dataStartIndex:N,dataEndIndex:R},v({props:T.props,dataStartIndex:N,dataEndIndex:R,updateId:$},T.state))}),T.triggerSyncEvent({dataStartIndex:N,dataEndIndex:R})}}),ze(T,"handleMouseEnter",function(O){var N=T.getMouseInfo(O);if(N){var R=ie(ie({},N),{},{isTooltipActive:!0});T.setState(R),T.triggerSyncEvent(R);var $=T.props.onMouseEnter;Je($)&&$(R,O)}}),ze(T,"triggeredAfterMouseMove",function(O){var N=T.getMouseInfo(O),R=N?ie(ie({},N),{},{isTooltipActive:!0}):{isTooltipActive:!1};T.setState(R),T.triggerSyncEvent(R);var $=T.props.onMouseMove;Je($)&&$(R,O)}),ze(T,"handleItemMouseEnter",function(O){T.setState(function(){return{isTooltipActive:!0,activeItem:O,activePayload:O.tooltipPayload,activeCoordinate:O.tooltipPosition||{x:O.cx,y:O.cy}}})}),ze(T,"handleItemMouseLeave",function(){T.setState(function(){return{isTooltipActive:!1}})}),ze(T,"handleMouseMove",function(O){O.persist(),T.throttleTriggeredAfterMouseMove(O)}),ze(T,"handleMouseLeave",function(O){T.throttleTriggeredAfterMouseMove.cancel();var N={isTooltipActive:!1};T.setState(N),T.triggerSyncEvent(N);var R=T.props.onMouseLeave;Je(R)&&R(N,O)}),ze(T,"handleOuterEvent",function(O){var N=iF(O),R=On(T.props,"".concat(N));if(N&&Je(R)){var $,K;/.*touch.*/i.test(N)?K=T.getMouseInfo(O.changedTouches[0]):K=T.getMouseInfo(O),R(($=K)!==null&&$!==void 0?$:{},O)}}),ze(T,"handleClick",function(O){var N=T.getMouseInfo(O);if(N){var R=ie(ie({},N),{},{isTooltipActive:!0});T.setState(R),T.triggerSyncEvent(R);var $=T.props.onClick;Je($)&&$(R,O)}}),ze(T,"handleMouseDown",function(O){var N=T.props.onMouseDown;if(Je(N)){var R=T.getMouseInfo(O);N(R,O)}}),ze(T,"handleMouseUp",function(O){var N=T.props.onMouseUp;if(Je(N)){var R=T.getMouseInfo(O);N(R,O)}}),ze(T,"handleTouchMove",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&T.throttleTriggeredAfterMouseMove(O.changedTouches[0])}),ze(T,"handleTouchStart",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&T.handleMouseDown(O.changedTouches[0])}),ze(T,"handleTouchEnd",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&T.handleMouseUp(O.changedTouches[0])}),ze(T,"handleDoubleClick",function(O){var N=T.props.onDoubleClick;if(Je(N)){var R=T.getMouseInfo(O);N(R,O)}}),ze(T,"handleContextMenu",function(O){var N=T.props.onContextMenu;if(Je(N)){var R=T.getMouseInfo(O);N(R,O)}}),ze(T,"triggerSyncEvent",function(O){T.props.syncId!==void 0&&qb.emit(Fb,T.props.syncId,O,T.eventEmitterSymbol)}),ze(T,"applySyncEvent",function(O){var N=T.props,R=N.layout,$=N.syncMethod,K=T.state.updateId,z=O.dataStartIndex,U=O.dataEndIndex;if(O.dataStartIndex!==void 0||O.dataEndIndex!==void 0)T.setState(ie({dataStartIndex:z,dataEndIndex:U},v({props:T.props,dataStartIndex:z,dataEndIndex:U,updateId:K},T.state)));else if(O.activeTooltipIndex!==void 0){var F=O.chartX,X=O.chartY,Y=O.activeTooltipIndex,G=T.state,Z=G.offset,W=G.tooltipTicks;if(!Z)return;if(typeof $=="function")Y=$(W,O);else if($==="value"){Y=-1;for(var Q=0;Q<W.length;Q++)if(W[Q].value===O.activeLabel){Y=Q;break}}var L=ie(ie({},Z),{},{x:Z.left,y:Z.top}),I=Math.min(F,L.x+L.width),q=Math.min(X,L.y+L.height),te=W[Y]&&W[Y].value,le=jw(T.state,T.props.data,Y),fe=W[Y]?{x:R==="horizontal"?W[Y].coordinate:I,y:R==="horizontal"?q:W[Y].coordinate}:$M;T.setState(ie(ie({},O),{},{activeLabel:te,activeCoordinate:fe,activePayload:le,activeTooltipIndex:Y}))}else T.setState(O)}),ze(T,"renderCursor",function(O){var N,R=T.state,$=R.isTooltipActive,K=R.activeCoordinate,z=R.activePayload,U=R.offset,F=R.activeTooltipIndex,X=R.tooltipAxisBandSize,Y=T.getTooltipEventType(),G=(N=O.props.active)!==null&&N!==void 0?N:$,Z=T.props.layout,W=O.key||"_recharts-cursor";return M.createElement(kne,{key:W,activeCoordinate:K,activePayload:z,activeTooltipIndex:F,chartName:r,element:O,isActive:G,layout:Z,offset:U,tooltipAxisBandSize:X,tooltipEventType:Y})}),ze(T,"renderPolarAxis",function(O,N,R){var $=On(O,"type.axisType"),K=On(T.state,"".concat($,"Map")),z=O.type.defaultProps,U=z!==void 0?ie(ie({},z),O.props):O.props,F=K&&K[U["".concat($,"Id")]];return j.cloneElement(O,ie(ie({},F),{},{className:ot($,F.className),key:O.key||"".concat(N,"-").concat(R),ticks:Ki(F,!0)}))}),ze(T,"renderPolarGrid",function(O){var N=O.props,R=N.radialLines,$=N.polarAngles,K=N.polarRadius,z=T.state,U=z.radiusAxisMap,F=z.angleAxisMap,X=Ra(U),Y=Ra(F),G=Y.cx,Z=Y.cy,W=Y.innerRadius,Q=Y.outerRadius;return j.cloneElement(O,{polarAngles:Array.isArray($)?$:Ki(Y,!0).map(function(L){return L.coordinate}),polarRadius:Array.isArray(K)?K:Ki(X,!0).map(function(L){return L.coordinate}),cx:G,cy:Z,innerRadius:W,outerRadius:Q,key:O.key||"polar-grid",radialLines:R})}),ze(T,"renderLegend",function(){var O=T.state.formattedGraphicalItems,N=T.props,R=N.children,$=N.width,K=N.height,z=T.props.margin||{},U=$-(z.left||0)-(z.right||0),F=j$({children:R,formattedGraphicalItems:O,legendWidth:U,legendContent:d});if(!F)return null;var X=F.item,Y=NN(F,Ene);return j.cloneElement(X,ie(ie({},Y),{},{chartWidth:$,chartHeight:K,margin:z,onBBoxUpdate:T.handleLegendBBoxUpdate}))}),ze(T,"renderTooltip",function(){var O,N=T.props,R=N.children,$=N.accessibilityLayer,K=sn(R,ln);if(!K)return null;var z=T.state,U=z.isTooltipActive,F=z.activeCoordinate,X=z.activePayload,Y=z.activeLabel,G=z.offset,Z=(O=K.props.active)!==null&&O!==void 0?O:U;return j.cloneElement(K,{viewBox:ie(ie({},G),{},{x:G.left,y:G.top}),active:Z,label:Y,payload:Z?X:[],coordinate:F,accessibilityLayer:$})}),ze(T,"renderBrush",function(O){var N=T.props,R=N.margin,$=N.data,K=T.state,z=K.offset,U=K.dataStartIndex,F=K.dataEndIndex,X=K.updateId;return j.cloneElement(O,{key:O.key||"_recharts-brush",onChange:Ef(T.handleBrushChange,O.props.onChange),data:$,x:ge(O.props.x)?O.props.x:z.left,y:ge(O.props.y)?O.props.y:z.top+z.height+z.brushBottom-(R.bottom||0),width:ge(O.props.width)?O.props.width:z.width,startIndex:U,endIndex:F,updateId:"brush-".concat(X)})}),ze(T,"renderReferenceElement",function(O,N,R){if(!O)return null;var $=T,K=$.clipPathId,z=T.state,U=z.xAxisMap,F=z.yAxisMap,X=z.offset,Y=O.type.defaultProps||{},G=O.props,Z=G.xAxisId,W=Z===void 0?Y.xAxisId:Z,Q=G.yAxisId,L=Q===void 0?Y.yAxisId:Q;return j.cloneElement(O,{key:O.key||"".concat(N,"-").concat(R),xAxis:U[W],yAxis:F[L],viewBox:{x:X.left,y:X.top,width:X.width,height:X.height},clipPathId:K})}),ze(T,"renderActivePoints",function(O){var N=O.item,R=O.activePoint,$=O.basePoint,K=O.childIndex,z=O.isRange,U=[],F=N.props.key,X=N.item.type.defaultProps!==void 0?ie(ie({},N.item.type.defaultProps),N.item.props):N.item.props,Y=X.activeDot,G=X.dataKey,Z=ie(ie({index:K,dataKey:G,cx:R.x,cy:R.y,r:4,fill:t_(N.item),strokeWidth:2,stroke:"#fff",payload:R.payload,value:R.value},at(Y,!1)),ih(Y));return U.push(k.renderActiveDot(Y,Z,"".concat(F,"-activePoint-").concat(K))),$?U.push(k.renderActiveDot(Y,ie(ie({},Z),{},{cx:$.x,cy:$.y}),"".concat(F,"-basePoint-").concat(K))):z&&U.push(null),U}),ze(T,"renderGraphicChild",function(O,N,R){var $=T.filterFormatItem(O,N,R);if(!$)return null;var K=T.getTooltipEventType(),z=T.state,U=z.isTooltipActive,F=z.tooltipAxis,X=z.activeTooltipIndex,Y=z.activeLabel,G=T.props.children,Z=sn(G,ln),W=$.props,Q=W.points,L=W.isRange,I=W.baseLine,q=$.item.type.defaultProps!==void 0?ie(ie({},$.item.type.defaultProps),$.item.props):$.item.props,te=q.activeDot,le=q.hide,fe=q.activeBar,ve=q.activeShape,qe=!!(!le&&U&&Z&&(te||fe||ve)),xe={};K!=="axis"&&Z&&Z.props.trigger==="click"?xe={onClick:Ef(T.handleItemMouseEnter,O.props.onClick)}:K!=="axis"&&(xe={onMouseLeave:Ef(T.handleItemMouseLeave,O.props.onMouseLeave),onMouseEnter:Ef(T.handleItemMouseEnter,O.props.onMouseEnter)});var ae=j.cloneElement(O,ie(ie({},$.props),xe));function Se(_t){return typeof F.dataKey=="function"?F.dataKey(_t.payload):null}if(qe)if(X>=0){var Me,oe;if(F.dataKey&&!F.allowDuplicatedCategory){var rt=typeof F.dataKey=="function"?Se:"payload.".concat(F.dataKey.toString());Me=nh(Q,rt,Y),oe=L&&I&&nh(I,rt,Y)}else Me=Q==null?void 0:Q[X],oe=L&&I&&I[X];if(ve||fe){var Fe=O.props.activeIndex!==void 0?O.props.activeIndex:X;return[j.cloneElement(O,ie(ie(ie({},$.props),xe),{},{activeIndex:Fe})),null,null]}if(!tt(Me))return[ae].concat(fl(T.renderActivePoints({item:$,activePoint:Me,basePoint:oe,childIndex:X,isRange:L})))}else{var kt,wt=(kt=T.getItemByXY(T.state.activeCoordinate))!==null&&kt!==void 0?kt:{graphicalItem:ae},Et=wt.graphicalItem,_r=Et.item,Ut=_r===void 0?O:_r,Rr=Et.childIndex,cr=ie(ie(ie({},$.props),xe),{},{activeIndex:Rr});return[j.cloneElement(Ut,cr),null,null]}return L?[ae,null,null]:[ae,null]}),ze(T,"renderCustomized",function(O,N,R){return j.cloneElement(O,ie(ie({key:"recharts-customized-".concat(R)},T.props),T.state))}),ze(T,"renderMap",{CartesianGrid:{handler:jf,once:!0},ReferenceArea:{handler:T.renderReferenceElement},ReferenceLine:{handler:jf},ReferenceDot:{handler:T.renderReferenceElement},XAxis:{handler:jf},YAxis:{handler:jf},Brush:{handler:T.renderBrush,once:!0},Bar:{handler:T.renderGraphicChild},Line:{handler:T.renderGraphicChild},Area:{handler:T.renderGraphicChild},Radar:{handler:T.renderGraphicChild},RadialBar:{handler:T.renderGraphicChild},Scatter:{handler:T.renderGraphicChild},Pie:{handler:T.renderGraphicChild},Funnel:{handler:T.renderGraphicChild},Tooltip:{handler:T.renderCursor,once:!0},PolarGrid:{handler:T.renderPolarGrid,once:!0},PolarAngleAxis:{handler:T.renderPolarAxis},PolarRadiusAxis:{handler:T.renderPolarAxis},Customized:{handler:T.renderCustomized}}),T.clipPathId="".concat((A=S.id)!==null&&A!==void 0?A:zu("recharts"),"-clip"),T.throttleTriggeredAfterMouseMove=jI(T.triggeredAfterMouseMove,(C=S.throttleDelay)!==null&&C!==void 0?C:1e3/60),T.state={},T}return Dne(k,x),Rne(k,[{key:"componentDidMount",value:function(){var A,C;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var A=this.props,C=A.children,T=A.data,O=A.height,N=A.layout,R=sn(C,ln);if(R){var $=R.props.defaultIndex;if(!(typeof $!="number"||$<0||$>this.state.tooltipTicks.length-1)){var K=this.state.tooltipTicks[$]&&this.state.tooltipTicks[$].value,z=jw(this.state,T,$,K),U=this.state.tooltipTicks[$].coordinate,F=(this.state.offset.top+O)/2,X=N==="horizontal",Y=X?{x:U,y:F}:{y:U,x:F},G=this.state.formattedGraphicalItems.find(function(W){var Q=W.item;return Q.type.name==="Scatter"});G&&(Y=ie(ie({},Y),G.props.points[$].tooltipPosition),z=G.props.points[$].tooltipPayload);var Z={activeTooltipIndex:$,isTooltipActive:!0,activeLabel:K,activePayload:z,activeCoordinate:Y};this.setState(Z),this.renderCursor(R),this.accessibilityManager.setIndex($)}}}},{key:"getSnapshotBeforeUpdate",value:function(A,C){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==C.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==A.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==A.margin){var T,O;this.accessibilityManager.setDetails({offset:{left:(T=this.props.margin.left)!==null&&T!==void 0?T:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0}})}return null}},{key:"componentDidUpdate",value:function(A){mx([sn(A.children,ln)],[sn(this.props.children,ln)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var A=sn(this.props.children,ln);if(A&&typeof A.props.shared=="boolean"){var C=A.props.shared?"axis":"item";return c.indexOf(C)>=0?C:a}return a}},{key:"getMouseInfo",value:function(A){if(!this.container)return null;var C=this.container,T=C.getBoundingClientRect(),O=WW(T),N={chartX:Math.round(A.pageX-O.left),chartY:Math.round(A.pageY-O.top)},R=T.width/C.offsetWidth||1,$=this.inRange(N.chartX,N.chartY,R);if(!$)return null;var K=this.state,z=K.xAxisMap,U=K.yAxisMap,F=this.getTooltipEventType(),X=RN(this.state,this.props.data,this.props.layout,$);if(F!=="axis"&&z&&U){var Y=Ra(z).scale,G=Ra(U).scale,Z=Y&&Y.invert?Y.invert(N.chartX):null,W=G&&G.invert?G.invert(N.chartY):null;return ie(ie({},N),{},{xValue:Z,yValue:W},X)}return X?ie(ie({},N),X):null}},{key:"inRange",value:function(A,C){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,O=this.props.layout,N=A/T,R=C/T;if(O==="horizontal"||O==="vertical"){var $=this.state.offset,K=N>=$.left&&N<=$.left+$.width&&R>=$.top&&R<=$.top+$.height;return K?{x:N,y:R}:null}var z=this.state,U=z.angleAxisMap,F=z.radiusAxisMap;if(U&&F){var X=Ra(U);return Yj({x:N,y:R},X)}return null}},{key:"parseEventsOfWrapper",value:function(){var A=this.props.children,C=this.getTooltipEventType(),T=sn(A,ln),O={};T&&C==="axis"&&(T.props.trigger==="click"?O={onClick:this.handleClick}:O={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var N=ih(this.props,this.handleOuterEvent);return ie(ie({},N),O)}},{key:"addListener",value:function(){qb.on(Fb,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){qb.removeListener(Fb,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(A,C,T){for(var O=this.state.formattedGraphicalItems,N=0,R=O.length;N<R;N++){var $=O[N];if($.item===A||$.props.key===A.key||C===Gi($.item.type)&&T===$.childIndex)return $}return null}},{key:"renderClipPath",value:function(){var A=this.clipPathId,C=this.state.offset,T=C.left,O=C.top,N=C.height,R=C.width;return M.createElement("defs",null,M.createElement("clipPath",{id:A},M.createElement("rect",{x:T,y:O,height:N,width:R})))}},{key:"getXScales",value:function(){var A=this.state.xAxisMap;return A?Object.entries(A).reduce(function(C,T){var O=jN(T,2),N=O[0],R=O[1];return ie(ie({},C),{},ze({},N,R.scale))},{}):null}},{key:"getYScales",value:function(){var A=this.state.yAxisMap;return A?Object.entries(A).reduce(function(C,T){var O=jN(T,2),N=O[0],R=O[1];return ie(ie({},C),{},ze({},N,R.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(A){var C;return(C=this.state.xAxisMap)===null||C===void 0||(C=C[A])===null||C===void 0?void 0:C.scale}},{key:"getYScaleByAxisId",value:function(A){var C;return(C=this.state.yAxisMap)===null||C===void 0||(C=C[A])===null||C===void 0?void 0:C.scale}},{key:"getItemByXY",value:function(A){var C=this.state,T=C.formattedGraphicalItems,O=C.activeItem;if(T&&T.length)for(var N=0,R=T.length;N<R;N++){var $=T[N],K=$.props,z=$.item,U=z.type.defaultProps!==void 0?ie(ie({},z.type.defaultProps),z.props):z.props,F=Gi(z.type);if(F==="Bar"){var X=(K.data||[]).find(function(W){return fQ(A,W)});if(X)return{graphicalItem:$,payload:X}}else if(F==="RadialBar"){var Y=(K.data||[]).find(function(W){return Yj(A,W)});if(Y)return{graphicalItem:$,payload:Y}}else if(zp($,O)||Bp($,O)||ku($,O)){var G=ree({graphicalItem:$,activeTooltipItem:O,itemData:U.data}),Z=U.activeIndex===void 0?G:U.activeIndex;return{graphicalItem:ie(ie({},$),{},{childIndex:Z}),payload:ku($,O)?U.data[G]:$.props.data[G]}}}return null}},{key:"render",value:function(){var A=this;if(!sO(this))return null;var C=this.props,T=C.children,O=C.className,N=C.width,R=C.height,$=C.style,K=C.compact,z=C.title,U=C.desc,F=NN(C,Ane),X=at(F,!1);if(K)return M.createElement(dN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},M.createElement(yx,$s({},X,{width:N,height:R,title:z,desc:U}),this.renderClipPath(),cO(T,this.renderMap)));if(this.props.accessibilityLayer){var Y,G;X.tabIndex=(Y=this.props.tabIndex)!==null&&Y!==void 0?Y:0,X.role=(G=this.props.role)!==null&&G!==void 0?G:"application",X.onKeyDown=function(W){A.accessibilityManager.keyboardEvent(W)},X.onFocus=function(){A.accessibilityManager.focus()}}var Z=this.parseEventsOfWrapper();return M.createElement(dN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},M.createElement("div",$s({className:ot("recharts-wrapper",O),style:ie({position:"relative",cursor:"default",width:N,height:R},$)},Z,{ref:function(Q){A.container=Q}}),M.createElement(yx,$s({},X,{width:N,height:R,title:z,desc:U,style:Fne}),this.renderClipPath(),cO(T,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(j.Component);ze(b,"displayName",r),ze(b,"defaultProps",ie({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),ze(b,"getDerivedStateFromProps",function(x,k){var S=x.dataKey,A=x.data,C=x.children,T=x.width,O=x.height,N=x.layout,R=x.stackOffset,$=x.margin,K=k.dataStartIndex,z=k.dataEndIndex;if(k.updateId===void 0){var U=IN(x);return ie(ie(ie({},U),{},{updateId:0},v(ie(ie({props:x},U),{},{updateId:0}),k)),{},{prevDataKey:S,prevData:A,prevWidth:T,prevHeight:O,prevLayout:N,prevStackOffset:R,prevMargin:$,prevChildren:C})}if(S!==k.prevDataKey||A!==k.prevData||T!==k.prevWidth||O!==k.prevHeight||N!==k.prevLayout||R!==k.prevStackOffset||!zs($,k.prevMargin)){var F=IN(x),X={chartX:k.chartX,chartY:k.chartY,isTooltipActive:k.isTooltipActive},Y=ie(ie({},RN(k,A,N)),{},{updateId:k.updateId+1}),G=ie(ie(ie({},F),X),Y);return ie(ie(ie({},G),v(ie({props:x},G),k)),{},{prevDataKey:S,prevData:A,prevWidth:T,prevHeight:O,prevLayout:N,prevStackOffset:R,prevMargin:$,prevChildren:C})}if(!mx(C,k.prevChildren)){var Z,W,Q,L,I=sn(C,rl),q=I&&(Z=(W=I.props)===null||W===void 0?void 0:W.startIndex)!==null&&Z!==void 0?Z:K,te=I&&(Q=(L=I.props)===null||L===void 0?void 0:L.endIndex)!==null&&Q!==void 0?Q:z,le=q!==K||te!==z,fe=!tt(A),ve=fe&&!le?k.updateId:k.updateId+1;return ie(ie({updateId:ve},v(ie(ie({props:x},k),{},{updateId:ve,dataStartIndex:q,dataEndIndex:te}),k)),{},{prevChildren:C,dataStartIndex:q,dataEndIndex:te})}return null}),ze(b,"renderActiveDot",function(x,k,S){var A;return j.isValidElement(x)?A=j.cloneElement(x,k):Je(x)?A=x(k):A=M.createElement(n_,k),M.createElement(Xt,{className:"recharts-active-dot",key:S},A)});var w=j.forwardRef(function(k,S){return M.createElement(b,$s({},k,{ref:S}))});return w.displayName=b.displayName,w},Qne=DM({chartName:"LineChart",GraphicalChild:Ku,axisComponents:[{axisType:"xAxis",AxisComp:Ua},{axisType:"yAxis",AxisComp:qa}],formatAxisMap:rM}),Nw=DM({chartName:"BarChart",GraphicalChild:ta,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ua},{axisType:"yAxis",AxisComp:qa}],formatAxisMap:rM});const rp={backgroundColor:"#1e1e1e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#e4e0dc",fontSize:"11px",fontFamily:"JetBrains Mono, monospace"};function It(t){return t>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(Math.round(t))}function Zn(t){return`$${t.toFixed(2)}`}function Ma({label:t,value:e,sub:r,accent:n}){return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-5 py-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 mb-1",children:t}),y.jsx("p",{className:`text-xl font-mono font-medium ${n?"text-[#E43A9C]":"text-zinc-100"}`,children:e}),r&&y.jsx("p",{className:"text-[10px] font-mono text-zinc-600 mt-0.5",children:r})]})}const eie={summary:"Summary","by squad":"By Squad","by agent":"By Agent",io:"IO",timeline:"Timeline"};function tie({tabs:t,active:e,onChange:r}){return y.jsx("div",{className:"flex gap-0 border-b border-white/[0.06] mb-5",children:t.map(n=>y.jsx("button",{type:"button",onClick:()=>r(n),className:`px-4 py-2 text-[11px] font-mono transition-colors border-b-2 -mb-px cursor-pointer ${e===n?"text-[#E43A9C] border-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 border-transparent"}`,children:eie[n]??n},n))})}function rie({records:t,totals:e}){const r=e.totalInputTokens+e.totalOutputTokens,n=new Map;for(const o of t){const c=o.squadId??"__io__",u=o.squadName??(o.squadId?`${o.squadId.slice(0,8)} (deleted)`:"IO Orchestrator"),d=n.get(c)??{name:u,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=o.inputTokens,d.outputTokens+=o.outputTokens,d.calls+=1,d.cost+=o.estimatedCostUsd??0,n.set(c,d)}const i=Array.from(n.values()).sort((o,c)=>c.cost-o.cost),a=i.map(o=>({name:o.name.length>12?`${o.name.slice(0,12)}…`:o.name,cost:Number.parseFloat(o.cost.toFixed(2)),tokens:Math.round((o.inputTokens+o.outputTokens)/1e3)}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx(Ma,{label:"Total Tokens",value:It(r),sub:`${It(e.totalInputTokens)} in · ${It(e.totalOutputTokens)} out`}),y.jsx(Ma,{label:"Total Cost",value:Zn(e.totalCostUsd),accent:!0}),y.jsx(Ma,{label:"API Calls",value:It(e.callCount),sub:"across all entities"}),y.jsx(Ma,{label:"Avg Cost / Call",value:e.callCount>0?Zn(e.totalCostUsd/e.callCount):"$0.00",sub:`over ${e.callCount} calls`})]}),y.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost by entity"}),a.length>0?y.jsx(mh,{width:"100%",height:180,children:y.jsxs(Nw,{data:a,barCategoryGap:"35%",children:[y.jsx(Cu,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`$${o}`,width:40}),y.jsx(ln,{contentStyle:rp,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`$${o.toFixed(2)}`,"Cost"]}),y.jsx(ta,{dataKey:"cost",fill:"url(#costGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens by entity (k)"}),a.length>0?y.jsx(mh,{width:"100%",height:180,children:y.jsxs(Nw,{data:a,barCategoryGap:"35%",children:[y.jsx(Cu,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`${o}k`,width:40}),y.jsx(ln,{contentStyle:rp,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`${o}k`,"Tokens"]}),y.jsx(ta,{dataKey:"tokens",fill:"url(#tokenGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"tokenGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#818cf8"}),y.jsx("stop",{offset:"100%",stopColor:"#6366f1",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Entity","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsxs("tbody",{children:[i.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name)),y.jsxs("tr",{className:"bg-[#1a1a1a]",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-200 font-medium",children:"Total"}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:It(e.totalInputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:It(e.totalOutputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:e.callCount}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C] font-medium",children:Zn(e.totalCostUsd)})]})]})]})})]})}function nie({records:t}){const[e,r]=j.useState([]),[n,i]=j.useState("cost"),[a,o]=j.useState("desc");function c(f){f===n?o(m=>m==="asc"?"desc":"asc"):(i(f),o("desc"))}const u=j.useMemo(()=>{const f=new Map;for(const v of t){if(!v.squadId)continue;const b=f.get(v.squadId)??{id:v.squadId,name:v.squadName??`${v.squadId.slice(0,8)} (deleted)`,agents:new Map,inputTokens:0,outputTokens:0,calls:0,cost:0};b.inputTokens+=v.inputTokens,b.outputTokens+=v.outputTokens,b.calls+=1,b.cost+=v.estimatedCostUsd??0;const w=`${v.agentRole??"unknown"}:${v.model}`,x=b.agents.get(w)??{role:v.agentRole??"unknown",model:v.model,inputTokens:0,outputTokens:0,calls:0,cost:0};x.inputTokens+=v.inputTokens,x.outputTokens+=v.outputTokens,x.calls+=1,x.cost+=v.estimatedCostUsd??0,b.agents.set(w,x),f.set(v.squadId,b)}return[...Array.from(f.values())].sort((v,b)=>{const w=v[n],x=b[n],k=typeof w=="string"?w.localeCompare(x):w-x;return a==="desc"?-k:k})},[t,n,a]),d=f=>r(m=>m.includes(f)?m.filter(v=>v!==f):[...m,f]),p=[{key:"name",label:"Squad"},{key:"inputTokens",label:"In"},{key:"outputTokens",label:"Out"},{key:"calls",label:"Calls"},{key:"cost",label:"Cost"}];return u.length===0?y.jsx("div",{className:"text-center py-12 text-zinc-700 text-[11px] font-mono",children:"No squad usage data"}):y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center gap-1 px-1 mb-1",children:[y.jsx("span",{className:"text-[10px] font-mono text-zinc-700 mr-1",children:"sort by"}),p.map(f=>y.jsxs("button",{type:"button",onClick:()=>c(f.key),className:`flex items-center gap-0.5 px-2 py-1 rounded-lg text-[10px] font-mono transition-colors ${n===f.key?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400 hover:bg-white/[0.04]"}`,style:n===f.key?{background:"rgba(228,58,156,0.1)"}:void 0,children:[f.label,n===f.key&&y.jsx("span",{className:"text-[9px]",children:a==="desc"?"↓":"↑"})]},f.key))]}),u.map(f=>{const m=e.includes(f.id),v=Array.from(f.agents.values());return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl overflow-hidden",children:[y.jsxs("button",{type:"button",onClick:()=>d(f.id),className:"w-full flex items-center gap-3 px-4 py-3.5 hover:bg-white/[0.02] transition-colors text-left cursor-pointer",children:[y.jsx("div",{className:`transition-transform ${m?"rotate-90":""}`,children:y.jsx(Zw,{className:"w-3.5 h-3.5 text-zinc-600"})}),y.jsx("span",{className:"text-sm font-mono text-zinc-100 flex-1",children:f.name}),y.jsxs("div",{className:"flex items-center gap-6 text-[11px] font-mono",children:[y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"in"}),It(f.inputTokens)]}),y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"out"}),It(f.outputTokens)]}),y.jsxs("span",{className:"text-zinc-500",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"calls"}),f.calls]}),y.jsx("span",{className:"text-[#E43A9C] font-medium w-16 text-right",children:Zn(f.cost)})]})]}),m&&y.jsx("div",{className:"border-t border-white/[0.05]",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"bg-[#191919]",children:["Agent","Model","Input","Output","Calls","Cost"].map(b=>y.jsx("th",{className:`text-left px-4 py-2 text-zinc-700 font-medium ${b==="Cost"?"text-right":""}`,children:b},b))})}),y.jsx("tbody",{children:v.map(b=>y.jsxs("tr",{className:"border-t border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-2.5 text-zinc-300",children:b.role}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-600",children:b.model}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:It(b.inputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:It(b.outputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:b.calls}),y.jsx("td",{className:"px-4 py-2.5 text-right text-[#E43A9C]",children:Zn(b.cost)})]},b.role))})]})})]},f.id)})]})}function iie({records:t}){const e=j.useMemo(()=>{const n=new Map;for(const i of t){const a=`${i.squadId??"io"}:${i.agentRole??"orchestrator"}:${i.model}`,o=n.get(a)??{name:i.agentRole??"orchestrator",squad:i.squadName??(i.squadId?i.squadId.slice(0,8):"IO"),model:i.model,inputTokens:0,outputTokens:0,calls:0,cost:0};o.inputTokens+=i.inputTokens,o.outputTokens+=i.outputTokens,o.calls+=1,o.cost+=i.estimatedCostUsd??0,n.set(a,o)}return Array.from(n.values()).sort((i,a)=>a.cost-i.cost)},[t]),r=e.reduce((n,i)=>n+i.cost,0);return y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Agent","Squad","Model","Input","Output","Calls","Cost","% of total"].map(n=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${n==="Cost"?"text-right":""}`,children:n},n))})}),y.jsx("tbody",{children:e.map(n=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:n.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.squad}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(n.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(n.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:n.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(n.cost)}),y.jsx("td",{className:"px-4 py-3",children:y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"w-16 h-1.5 rounded-full bg-[#252525] overflow-hidden",children:y.jsx("div",{className:"h-full bg-[#E43A9C] rounded-full",style:{width:`${r>0?n.cost/r*100:0}%`}})}),y.jsx("span",{className:"text-zinc-600 text-[10px]",children:r>0?`${(n.cost/r*100).toFixed(1)}%`:"0%"})]})})]},`${n.squad}:${n.name}`))})]})})}function aie({records:t}){const e=j.useMemo(()=>t.filter(o=>!o.squadId),[t]),r=j.useMemo(()=>{const o=new Map;for(const c of e){const u=`${c.agentRole??"orchestrator"}:${c.model}`,d=o.get(u)??{name:c.agentRole??"orchestrator",model:c.model,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=c.inputTokens,d.outputTokens+=c.outputTokens,d.calls+=1,d.cost+=c.estimatedCostUsd??0,o.set(u,d)}return Array.from(o.values()).sort((c,u)=>u.cost-c.cost)},[e]),n=e.reduce((o,c)=>o+c.inputTokens,0),i=e.reduce((o,c)=>o+c.outputTokens,0),a=e.reduce((o,c)=>o+(c.estimatedCostUsd??0),0);return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx(Ma,{label:"IO Tokens",value:It(n+i),sub:`${It(n)} in · ${It(i)} out`}),y.jsx(Ma,{label:"IO Cost",value:Zn(a),accent:!0}),y.jsx(Ma,{label:"IO Calls",value:It(e.length)}),y.jsx(Ma,{label:"IO Roles",value:String(r.length)})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Role","Model","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsx("tbody",{children:r.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:o.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name))})]})})]})}function oie({records:t}){const e=Fa(),r=j.useMemo(()=>{const i=new Map;for(const a of t){const o=a.timestamp.slice(0,10),c=i.get(o)??{date:o,inputTokens:0,outputTokens:0,cost:0,calls:0};c.inputTokens+=a.inputTokens,c.outputTokens+=a.outputTokens,c.cost+=a.estimatedCostUsd??0,c.calls+=1,i.set(o,c)}return Array.from(i.values()).sort((a,o)=>a.date.localeCompare(o.date))},[t]),n=r.map(i=>({...i,label:ez(i.date,e),tokens:i.inputTokens+i.outputTokens}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens per day"}),n.length>0?y.jsx(mh,{width:"100%",height:220,children:y.jsxs(Qne,{data:n,children:[y.jsx(Cu,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:It,width:44}),y.jsx(ln,{contentStyle:rp,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[It(i),"Tokens"]}),y.jsx(Ku,{type:"monotone",dataKey:"tokens",stroke:"#E43A9C",strokeWidth:2,dot:!1})]})}):y.jsx("div",{className:"h-[220px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost per day"}),n.length>0?y.jsx(mh,{width:"100%",height:180,children:y.jsxs(Nw,{data:n,barCategoryGap:"20%",children:[y.jsx(Cu,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:i=>`$${i.toFixed(2)}`,width:44}),y.jsx(ln,{contentStyle:rp,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[Zn(i),"Cost"]}),y.jsx(ta,{dataKey:"cost",fill:"url(#costGradTl)",radius:[4,4,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGradTl",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Date","Input","Output","Calls","Cost"].map(i=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${i==="Cost"?"text-right":""}`,children:i},i))})}),y.jsx("tbody",{children:r.map(i=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:i.date}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(i.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(i.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:i.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(i.cost)})]},i.date))})]})})]})}function sie(){const[t,e]=j.useState("summary"),[r,n]=j.useState(null),[i,a]=j.useState("14d"),o=["summary","by squad","by agent","io","timeline"];if(j.useEffect(()=>{const u=new Date;i==="7d"?u.setDate(u.getDate()-7):i==="14d"?u.setDate(u.getDate()-14):i==="30d"?u.setDate(u.getDate()-30):u.setDate(u.getDate()-1),Ge.get(`/usage?since=${u.toISOString()}`).then(n).catch(()=>{})},[i]),!r)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600 font-mono text-[11px]",children:"Loading..."});const c=i==="1d"?"Today":`Last ${i}`;return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[y.jsxs("div",{className:"flex items-start justify-between mb-5 gap-4 flex-wrap",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Usage"}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:c})]}),y.jsx("div",{className:"flex gap-1 p-1 rounded-xl bg-white/[0.03] border border-white/[0.07]",children:["1d","7d","14d","30d"].map(u=>y.jsx("button",{type:"button",onClick:()=>a(u),className:`px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors cursor-pointer ${i===u?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400"}`,style:i===u?{background:"rgba(228,58,156,0.12)"}:void 0,children:u},u))})]}),y.jsx(tie,{tabs:o,active:t,onChange:u=>e(u)}),t==="summary"&&y.jsx(rie,{records:r.records,totals:r.totals}),t==="by squad"&&y.jsx(nie,{records:r.records}),t==="by agent"&&y.jsx(iie,{records:r.records}),t==="io"&&y.jsx(aie,{records:r.records}),t==="timeline"&&y.jsx(oie,{records:r.records})]})}function LM(t){return[...t].sort((e,r)=>e.isDir!==r.isDir?e.isDir?-1:1:e.name.localeCompare(r.name)).map(e=>({...e,children:LM(e.children)}))}function lie(t){const e=[];for(const r of t){const n=r.path.split("/").filter(Boolean);let i=e,a="";if(r.isDir){for(const o of n){a=a?`${a}/${o}`:o;let c=i.find(u=>u.path===a);c||(c={name:o,path:a,isDir:!0,children:[]},i.push(c)),i=c.children}continue}for(const[o,c]of n.entries()){const u=o===n.length-1;a=a?`${a}/${c}`:c;let d=i.find(p=>p.path===a);d||(d={name:u&&r.name||c,path:a,isDir:!u,children:[]},i.push(d)),i=d.children}}return LM(e)}function zM(t,e){return e?t.flatMap(r=>{const n=r.name.toLowerCase().includes(e)||r.path.toLowerCase().includes(e);if(!r.isDir)return n?[r]:[];if(n)return[r];const i=zM(r.children,e);return i.length?[{...r,children:i}]:[]}):t}function Pw(t){const e=new Set;for(const r of t)if(r.isDir){e.add(r.path);for(const n of Pw(r.children))e.add(n)}return e}function cie(t){const e=t.split("/").filter(Boolean),r=[];let n="";for(const i of e.slice(0,-1))n=n?`${n}/${i}`:i,r.push(n);return r}function BM({node:t,depth:e,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u}){const d=r===t.path,p=t.isDir&&(n.has(t.path)||i.has(t.path)),f=12+e*16,m=t.isDir&&["io","shared","squads","templates"].includes(t.path);return t.isDir?y.jsxs("div",{children:[y.jsxs("div",{className:"flex w-full items-center group rounded-lg py-2 pr-3 text-left text-[11px] font-mono text-zinc-400 transition-colors hover:bg-white/[0.04] hover:text-zinc-200",style:{paddingLeft:f},children:[y.jsxs("button",{type:"button",onClick:()=>a(t.path),className:"flex items-center gap-2 flex-1 min-w-0",children:[y.jsx(Zw,{size:14,className:`shrink-0 transition-transform ${p?"rotate-90":""}`}),p?y.jsx(zz,{size:14,className:"shrink-0 text-zinc-500"}):y.jsx(Uz,{size:14,className:"shrink-0 text-zinc-500"}),y.jsx("span",{className:"truncate",children:t.name})]}),y.jsxs("div",{className:"flex items-center gap-0.5",children:[!m&&y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),u(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-red-500/20 transition-opacity text-zinc-600 hover:text-red-400",title:`Delete ${t.name}`,children:y.jsx(Da,{size:12})}),y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),c(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-white/[0.08] transition-opacity text-zinc-600 hover:text-zinc-300",title:`Add page to ${t.name}`,children:y.jsx(n1,{size:12})})]})]}),p&&y.jsx("div",{children:t.children.map(v=>y.jsx(BM,{node:v,depth:e+1,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u},v.path))})]}):y.jsxs("button",{type:"button",onClick:()=>o(t.path),className:`flex w-full items-center gap-2 rounded-lg py-2 pr-3 text-left text-[11px] font-mono transition-colors ${d?"border-l-2 border-[#E43A9C] bg-[#E43A9C]/10 text-[#E43A9C]":"text-zinc-500 hover:bg-white/[0.04] hover:text-zinc-300"}`,style:{paddingLeft:f},children:[y.jsx(Dz,{size:14,className:"shrink-0"}),y.jsx("span",{className:"truncate",children:t.name})]})}function uie(){const[t,e]=j.useState([]),[r,n]=j.useState(null),[i,a]=j.useState(""),[o,c]=j.useState(!1),[u,d]=j.useState(""),[p,f]=j.useState(""),[m,v]=j.useState(""),[b,w]=j.useState(new Set),[x,k]=j.useState(!1),[S,A]=j.useState(null),C=j.useRef(null);j.useEffect(()=>{z()},[]);const T=j.useMemo(()=>lie(t),[t]),O=m.trim().toLowerCase(),N=j.useMemo(()=>zM(T,O),[T,O]),R=j.useMemo(()=>{const L=O?Pw(N):new Set;if(r)for(const I of cie(r))L.add(I);return L},[N,O,r]),$=r?(function L(I){for(const q of I){if(q.path===r)return q;const te=L(q.children);if(te)return te}return null})(N):null,K=($==null?void 0:$.name)??(r?r.split("/").pop()??"":"");j.useEffect(()=>{const L=Pw(T);w(I=>new Set([...I,...L]))},[T]);async function z(){try{const L=await Ge.get("/wiki/pages");e(L.map(I=>({name:I.path.split("/").pop()??I.path,path:I.path,title:I.title})))}catch{e([])}}async function U(L){try{const I=await Ge.get(`/wiki/pages/${L}`);a(I.content),d(I.content),n(L),c(!1)}catch{Qe.error("Failed to load page")}}async function F(){if(r)try{await Ge.put(`/wiki/pages/${r}`,{content:u}),a(u),c(!1),Qe.success("Page saved")}catch{Qe.error("Failed to save page")}}async function X(){if(r)try{await Ge.delete(`/wiki/pages/${r}`),Qe.success("Page deleted"),n(null),a(""),d(""),c(!1),z()}catch{Qe.error("Failed to delete page")}}function Y(L){f(`${L}/`),setTimeout(()=>{const I=C.current;I&&(I.focus(),I.setSelectionRange(I.value.length,I.value.length))},0)}function G(L){A(L)}async function Z(){if(S)try{const L=t.filter(I=>I.path.startsWith(`${S}/`));await Promise.all(L.map(I=>Ge.delete(`/wiki/pages/${I.path}`))),Qe.success(`Deleted ${S}`),r!=null&&r.startsWith(S)&&(n(null),a(""),d(""),c(!1)),z()}catch{Qe.error("Failed to delete directory")}finally{A(null)}}async function W(){let L=p.trim().replace(/^\/+|\/+$/g,"");if(!L)return;L=L.replace(/\.md$/i,"");const I=L.startsWith("io/")||L.startsWith("shared/")||L.startsWith("squads/")?L:`shared/${L}`,q=I.split("/").pop()??I;k(!0);try{await Ge.post("/wiki/pages",{path:I,title:q,content:`# ${q}
|
|
518
518
|
|
|
519
519
|
`,tags:[]}),Qe.success("Page created"),f(""),await z(),await U(I)}catch{Qe.error("Failed to create page")}finally{k(!1)}}function Q(L){w(I=>{const q=new Set(I);return q.has(L)?q.delete(L):q.add(L),q})}return y.jsxs("div",{className:"flex h-full",children:[y.jsxs("div",{className:"flex h-full w-64 flex-col border-r border-white/[0.07] bg-[#181818]",children:[y.jsx("div",{className:"border-b border-white/[0.07] p-3",children:y.jsxs("div",{className:"relative",children:[y.jsx(LP,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-zinc-600"}),y.jsx("input",{type:"text",value:m,onChange:L=>v(L.target.value),placeholder:"Search pages...",className:"w-full rounded-lg border border-white/[0.07] bg-white/[0.04] py-2 pl-8 pr-3 text-[11px] font-mono text-zinc-300 outline-none placeholder:text-zinc-700 focus:border-[#E43A9C]/50"})]})}),y.jsx("div",{className:"flex-1 overflow-y-auto px-2 py-3",children:N.length>0?N.map(L=>y.jsx(BM,{node:L,depth:0,selectedPage:r,expandedPaths:b,autoExpandedPaths:R,onToggle:Q,onSelect:U,onAddToFolder:Y,onDeleteFolder:G},L.path)):y.jsx("p",{className:"py-4 text-center font-mono text-[11px] text-zinc-700",children:"No pages found"})}),y.jsx("div",{className:"border-t border-white/[0.07] p-3",children:y.jsxs("div",{className:"space-y-2",children:[y.jsx("input",{ref:C,type:"text",value:p,onChange:L=>f(L.target.value),onKeyDown:L=>{L.key==="Enter"&&W(),L.key==="Escape"&&f("")},placeholder:"folder/new-page",className:"w-full rounded-lg border border-white/[0.07] bg-white/[0.04] px-3 py-2 text-[11px] font-mono text-zinc-300 outline-none placeholder:text-zinc-700 focus:border-[#E43A9C]/50"}),y.jsx(Ba,{onClick:W,disabled:!p.trim()||x,className:"w-full justify-center px-3 py-2",children:x?y.jsxs(y.Fragment,{children:[y.jsx(Ts,{size:13,className:"animate-spin"})," Creating..."]}):y.jsxs(y.Fragment,{children:[y.jsx(n1,{size:13})," Add Page"]})})]})})]}),y.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:r?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-white/[0.07] px-6",children:[y.jsxs("div",{className:"min-w-0",children:[y.jsx("h3",{className:"truncate font-mono text-sm text-zinc-100",children:K}),y.jsxs("p",{className:"truncate font-mono text-[11px] text-zinc-500",children:[r,".md"]})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[o?y.jsxs(y.Fragment,{children:[y.jsxs(Ba,{onClick:F,className:"px-3 py-1.5",children:[y.jsx(cp,{size:12})," Save"]}),y.jsx(wi,{onClick:()=>{c(!1),d(i)},className:"px-3 py-1.5",children:"Cancel"})]}):y.jsxs(wi,{onClick:()=>{c(!0),d(i)},className:"px-3 py-1.5",children:[y.jsx(Ff,{size:12})," Edit"]}),y.jsxs(Gf,{onClick:X,className:"px-3 py-1.5",children:[y.jsx(Da,{size:12})," Delete"]})]})]}),y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:o?y.jsx("textarea",{value:u,onChange:L=>d(L.target.value),className:"h-full min-h-[320px] w-full resize-none rounded-xl border border-white/[0.07] bg-[#181818] p-4 font-mono text-sm text-zinc-300 outline-none focus:border-[#E43A9C]/50"}):y.jsx("div",{className:"mx-auto max-w-4xl",children:y.jsx("div",{className:"prose-io text-sm text-zinc-300",dangerouslySetInnerHTML:{__html:it.parse(i)}})})})]}):y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsxs("div",{className:"text-center",children:[y.jsx(PP,{size:48,className:"mx-auto mb-3 text-zinc-800"}),y.jsx("p",{className:"font-mono text-[11px] text-zinc-700",children:"Select a page to view"})]})})}),S&&y.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:y.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-white/[0.07] bg-[#1a1a1a] p-6 shadow-2xl",children:[y.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-100",children:"Delete directory?"}),y.jsxs("p",{className:"mb-4 text-xs text-zinc-400",children:["This will permanently delete"," ",y.jsx("span",{className:"font-mono text-zinc-200",children:S})," and all its contents."]}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx(wi,{onClick:()=>A(null),className:"px-3 py-1.5",children:"Cancel"}),y.jsxs(Gf,{onClick:Z,className:"px-3 py-1.5",children:[y.jsx(Da,{size:12})," Delete"]})]})]})})]})}function die({children:t}){const{session:e,supabase:r,loading:n}=mp();return n?y.jsx("div",{className:"min-h-screen flex items-center justify-center text-[var(--color-muted-foreground)]",children:"Loading..."}):r?e?y.jsx(y.Fragment,{children:t}):y.jsx(Lq,{}):y.jsx(y.Fragment,{children:t})}function fie(){const{pathname:t}=ti(),e=t==="/"||t==="/chat"||t.startsWith("/chat/");return y.jsxs(y.Fragment,{children:[y.jsx(jL,{children:y.jsxs(Yr,{element:y.jsx(Iq,{}),children:[y.jsx(Yr,{index:!0,element:y.jsx($q,{})}),y.jsx(Yr,{path:"squads",element:y.jsx(yf,{})}),y.jsx(Yr,{path:"squads/:name",element:y.jsx(yf,{})}),y.jsx(Yr,{path:"squads/:name/instances/:instanceId",element:y.jsx(yf,{})}),y.jsx(Yr,{path:"squads/:name/agents/:role",element:y.jsx(yf,{})}),y.jsx(Yr,{path:"feed",element:y.jsx(Dq,{})}),y.jsx(Yr,{path:"skills",element:y.jsx(Xq,{})}),y.jsx(Yr,{path:"schedules",element:y.jsx(Uq,{})}),y.jsx(Yr,{path:"wiki",element:y.jsx(uie,{})}),y.jsx(Yr,{path:"settings",element:y.jsx(Wq,{})}),y.jsx(Yr,{path:"usage",element:y.jsx(sie,{})}),y.jsx(Yr,{path:"*",element:y.jsx(OL,{to:"/",replace:!0})})]})}),!e&&y.jsx(MB,{})]})}function hie(){return y.jsx(BU,{children:y.jsx(die,{children:y.jsx(Z4,{children:y.jsx($B,{children:y.jsx(fie,{})})})})})}OD.createRoot(document.getElementById("root")).render(y.jsx(j.StrictMode,{children:y.jsxs(e5,{children:[y.jsx(hie,{}),y.jsx(D5,{theme:"dark",position:"bottom-right"})]})}));
|
|
520
|
-
//# sourceMappingURL=index-
|
|
520
|
+
//# sourceMappingURL=index-BKqr_NvP.js.map
|
package/dist/web/index.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap"
|
|
12
12
|
/>
|
|
13
13
|
<title>IO</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-BKqr_NvP.js"></script>
|
|
15
15
|
<link rel="stylesheet" crossorigin href="/assets/index-B6F0UZkW.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|